diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..57872d0 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +/vendor/ diff --git a/.gitignore b/.gitignore index 2954a13..a9adfcf 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ __pycache__/ # C extensions *.so +*.o # Distribution / packaging .Python @@ -125,3 +126,6 @@ poetry.lock # refer to https://docs.cursor.com/context/ignore-files .cursorignore .cursorindexingignore + +# Log files +*.log diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1d5c609..75de2c3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,6 +19,7 @@ exclude: > | \.gitignore$ | LICENSE$ | .*\.md$ + | vendor/.* )$ repos: @@ -67,3 +68,4 @@ repos: - scipy>=1.13 - pytest>=8 - scipy-stubs>=1.13 + - types-setuptools>=75 diff --git a/README.md b/README.md index bfc82fd..1d4eccc 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,11 @@ git clone https://github.com/PySATL/pysatl-core.git cd pysatl-core ``` -Install dependencies (via Poetry): +Install dependencies and build project (via Poetry): ```bash poetry install +poetry build ``` Or install the package locally with `pip` (editable): diff --git a/examples/example_sampling_strategy_custom_distribution.ipynb b/examples/example_sampling_strategy_custom_distribution.ipynb new file mode 100644 index 0000000..29ed139 --- /dev/null +++ b/examples/example_sampling_strategy_custom_distribution.ipynb @@ -0,0 +1,590 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "6b60a6a4", + "metadata": {}, + "source": [ + "# DefaultUnuranSamplingStrategy Sampling Examples\n" + ] + }, + { + "cell_type": "markdown", + "id": "c998c8b9", + "metadata": {}, + "source": [ + "This notebook mirrors `example_sampling_strategy_custom_distribution.py` and demonstrates four sampling tasks:\n", + "\n", + "1. Sampling from an exponential PDF using AUTO mode.\n", + "\n", + "2. Sampling via an exponential CDF with method NINV.\n", + "\n", + "3. Discrete PMF sampling with method DGT.\n", + "\n", + "4. Overriding methods (AUTO vs PINV) for a normal distribution.\n" + ] + }, + { + "cell_type": "markdown", + "id": "97c3778d", + "metadata": {}, + "source": [ + "## Imports and CustomDistribution implementation\n" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "397199d4", + "metadata": { + "name": "imports" + }, + "outputs": [], + "source": [ + "from __future__ import annotations\n", + "\n", + "import math\n", + "from collections.abc import Iterable, Mapping\n", + "from dataclasses import dataclass\n", + "from pathlib import Path\n", + "from typing import Any\n", + "\n", + "import matplotlib.pyplot as plt\n", + "import numpy as np\n", + "from IPython.display import display\n", + "\n", + "from pysatl_core.distributions import (\n", + " AnalyticalComputation,\n", + " DefaultComputationStrategy,\n", + ")\n", + "from pysatl_core.distributions.distribution import Distribution\n", + "from pysatl_core.stats._unuran.api import UnuranMethod, UnuranMethodConfig\n", + "from pysatl_core.stats._unuran.bindings._core import DefaultUnuranSamplingStrategy\n", + "from pysatl_core.types import CharacteristicName, EuclideanDistributionType, Kind\n", + "\n", + "\n", + "@dataclass(slots=True)\n", + "class CustomDistribution(Distribution):\n", + " \"\"\"Minimal univariate distribution wired to DefaultUnuranSamplingStrategy.\"\"\"\n", + "\n", + " name: str\n", + " kind: Kind\n", + " parameters: dict[str, Any]\n", + " _analytical: dict[str, AnalyticalComputation[Any, Any]]\n", + " _sampling_strategy: DefaultUnuranSamplingStrategy\n", + " _distribution_type: EuclideanDistributionType\n", + " _computation_strategy: DefaultComputationStrategy\n", + "\n", + " def __init__(\n", + " self,\n", + " name: str,\n", + " kind: Kind,\n", + " analytical_computations: Iterable[AnalyticalComputation[Any, Any]]\n", + " | Mapping[str, AnalyticalComputation[Any, Any]],\n", + " sampling_strategy: DefaultUnuranSamplingStrategy,\n", + " *,\n", + " parameters: Mapping[str, Any] | None = None,\n", + " ) -> None:\n", + " self.name = name\n", + " self.kind = kind\n", + " self.parameters = dict(parameters or {})\n", + " self._distribution_type = EuclideanDistributionType(kind=kind, dimension=1)\n", + " if isinstance(analytical_computations, Mapping):\n", + " self._analytical = dict(analytical_computations)\n", + " else:\n", + " self._analytical = {ac.target: ac for ac in analytical_computations}\n", + " self._sampling_strategy = sampling_strategy\n", + " self._computation_strategy = DefaultComputationStrategy()\n", + "\n", + " @property\n", + " def distribution_type(self) -> EuclideanDistributionType:\n", + " return self._distribution_type\n", + "\n", + " @property\n", + " def analytical_computations(self) -> Mapping[str, AnalyticalComputation[Any, Any]]:\n", + " return self._analytical\n", + "\n", + " @property\n", + " def sampling_strategy(self) -> DefaultUnuranSamplingStrategy:\n", + " return self._sampling_strategy\n", + "\n", + " def set_sampling_strategy(self, sampling_strategy: DefaultUnuranSamplingStrategy) -> None:\n", + " self._sampling_strategy = sampling_strategy\n", + "\n", + " @property\n", + " def computation_strategy(self) -> DefaultComputationStrategy:\n", + " return self._computation_strategy\n", + "\n", + " @property\n", + " def support(self) -> None:\n", + " return None" + ] + }, + { + "cell_type": "markdown", + "id": "9d0559bd", + "metadata": {}, + "source": [ + "## Plotting helpers\n" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "53f77786", + "metadata": { + "name": "helpers" + }, + "outputs": [], + "source": [ + "PLOTS_DIR = Path(\"__file__\").parent / \"plots\"\n", + "PLOTS_DIR.mkdir(exist_ok=True)\n", + "\n", + "\n", + "def _save_and_display(fig: plt.Figure, filename: str) -> None:\n", + " plots_dir = Path.cwd() / \"plots\"\n", + " plots_dir.mkdir(parents=True, exist_ok=True)\n", + "\n", + " path = plots_dir / filename\n", + " fig.savefig(path, dpi=200, bbox_inches=\"tight\")\n", + " display(fig)\n", + " print(f\" ➜ Figure saved to {path.relative_to(Path.cwd())}\")\n", + "\n", + "\n", + "def _close(fig: plt.Figure) -> None:\n", + " plt.close(fig)\n", + "\n", + "\n", + "def _plot_continuous_pdf(\n", + " title: str, xs: np.ndarray, pdf_vals: np.ndarray, samples: np.ndarray, filename: str\n", + ") -> None:\n", + " fig, ax = plt.subplots(figsize=(6, 4))\n", + " ax.set_title(title)\n", + " ax.plot(xs, pdf_vals, label=\"Ideal PDF\", color=\"tab:red\")\n", + " ax.hist(samples, bins=80, density=True, alpha=0.5, label=\"Sampled\", color=\"tab:blue\")\n", + " ax.set_xlabel(\"x\")\n", + " ax.set_ylabel(\"Density\")\n", + " ax.legend()\n", + " ax.grid(True, alpha=0.3)\n", + " _save_and_display(fig, filename)\n", + " _close(fig)\n", + "\n", + "\n", + "def _plot_normal_override(\n", + " title: str,\n", + " xs: np.ndarray,\n", + " pdf_vals: np.ndarray,\n", + " data_auto: np.ndarray,\n", + " data_pinv: np.ndarray,\n", + " filename: str,\n", + ") -> None:\n", + " fig, ax = plt.subplots(figsize=(6, 4))\n", + " ax.set_title(title)\n", + " ax.plot(xs, pdf_vals, label=\"Ideal PDF\", color=\"tab:red\")\n", + " ax.hist(\n", + " data_auto,\n", + " bins=60,\n", + " density=True,\n", + " alpha=0.55,\n", + " label=\"AUTO\",\n", + " color=\"#1f77b4\",\n", + " )\n", + " ax.hist(\n", + " data_pinv,\n", + " bins=60,\n", + " density=True,\n", + " alpha=0.45,\n", + " label=\"PINV\",\n", + " color=\"#ff7f0e\",\n", + " )\n", + " ax.set_xlabel(\"x\")\n", + " ax.set_ylabel(\"Density\")\n", + " ax.legend()\n", + " ax.grid(True, alpha=0.3)\n", + " _save_and_display(fig, filename)\n", + " _close(fig)\n", + "\n", + "\n", + "def _plot_continuous_cdf(\n", + " title: str, xs: np.ndarray, cdf_vals: np.ndarray, samples: np.ndarray, filename: str\n", + ") -> None:\n", + " fig, ax = plt.subplots(figsize=(6, 4))\n", + " ax.set_title(title)\n", + " ax.plot(xs, cdf_vals, label=\"Ideal CDF\", color=\"tab:red\")\n", + " sorted_samples = np.sort(samples)\n", + " ecdf = np.arange(1, len(sorted_samples) + 1) / len(sorted_samples)\n", + " ax.plot(sorted_samples, ecdf, label=\"Empirical CDF\", color=\"tab:blue\", linestyle=\"--\")\n", + " ax.set_xlabel(\"x\")\n", + " ax.set_ylabel(\"Probability\")\n", + " ax.legend()\n", + " ax.grid(True, alpha=0.3)\n", + " _save_and_display(fig, filename)\n", + " _close(fig)\n", + "\n", + "\n", + "def _plot_discrete_pmf(\n", + " title: str, pmf: dict[int, float], samples: np.ndarray, filename: str\n", + ") -> None:\n", + " fig, ax = plt.subplots(figsize=(6, 4))\n", + " ax.set_title(title)\n", + " xs = np.array(sorted(pmf.keys()))\n", + " probs = np.array([pmf[int(x)] for x in xs])\n", + " ax.bar(xs - 0.15, probs, width=0.3, label=\"Ideal PMF\", color=\"tab:red\", alpha=0.8)\n", + "\n", + " unique, counts = np.unique(samples.astype(int), return_counts=True)\n", + " freq = counts / counts.sum()\n", + " ax.bar(unique + 0.15, freq, width=0.3, label=\"Sampled PMF\", color=\"tab:blue\", alpha=0.6)\n", + "\n", + " ax.set_xlabel(\"value\")\n", + " ax.set_ylabel(\"Probability\")\n", + " ax.set_ylim(0, 1)\n", + " ax.legend()\n", + " ax.grid(True, axis=\"y\", alpha=0.3)\n", + " _save_and_display(fig, filename)\n", + " _close(fig)" + ] + }, + { + "cell_type": "markdown", + "id": "dfcfcdc3", + "metadata": {}, + "source": [ + "### Example 1 – Exponential PDF (AUTO)\n", + "Goal: demonstrate sampling from a continuous distribution via an analytical PDF using AUTO method.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "6fcc0377", + "metadata": { + "name": "example1" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "=== Example 1: Continuous PDF (AUTO) ===\n", + "Mean ≈ 0.5026 (expected 0.5000)\n", + "Std ≈ 0.4987 (expected 0.5000)\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAiEAAAGJCAYAAABcsOOZAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjgsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvwVt1zgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAYJ1JREFUeJzt3XlcVGX7P/DPmQEGkF12VEBxyRXFJFxSk0Qz08w0f5VIpmaaGpmJT2lmSfmkYWXuilrm9rh8K1ORQtPcFdNyQxEXVhd2GGDO+f2BTI6gwjBwmOHzfr3mVXPPfe5zXcPgXNznPucIkiRJICIiIqplCrkDICIiovqJRQgRERHJgkUIERERyYJFCBEREcmCRQgRERHJgkUIERERyYJFCBEREcmCRQgRERHJgkUIERERyYJFCBGhV69e6NWrl17bCoKAjz/+WK9t4+LiIAgC4uLitG2jRo2Cj4+PXuNVlY+PD0aNGqV9Hh0dDUEQcPz48VrZf3Xed0PYtGkTnJyckJubK1sMD1qyZAmaNGkCtVotdyhUC1iEkMko+wJ52OPw4cNyhyirf/75Bx9//DGuXr0qdygGV5dzq6uxaTQazJo1C++88w5sbGy07T4+Pjq/N66urujRowe2bdums32vXr20fRQKBezs7NCyZUu8/vrriImJqXCfD459/6OwsBBAaRFaVFSEpUuX1lzyVGeYyR0AkaF98skn8PX1Ldfu5+cnQzR1xz///IPZs2ejV69e5WYa9uzZI09QFVi+fDlEUazSNo/K7VEuXLgAhaJm/xarq+/7Tz/9hAsXLmDs2LHlXvP398d7770HAEhOTsbSpUsxZMgQLF68GG+99Za2X6NGjRAZGQkAyMvLQ0JCArZu3Yrvv/8ew4YNw/fffw9zc/OHjn0/CwsLAIClpSVCQ0OxYMECvPPOOxAEwWA5U93DIoRMTv/+/dG5c2e5wzAqZV8AdcGDX1qGJkkSCgsLYWVlBZVKVaP7ehw53/fVq1ejW7du8PLyKveal5cXXnvtNe3zkSNHws/PD1999ZVOEWJvb6/TDwA+//xzTJo0Cd999x18fHzwxRdfPHLsigwbNgzz5s3D77//jmeeeUaf9MhI8HAM1TuzZs2CQqFAbGysTvvYsWNhYWGB06dPA/h3vcLGjRsxY8YMuLu7o0GDBnjhhRdw/fr1cuNu3rwZAQEBsLKygrOzM1577TXcvHlTp8+oUaNgY2ODmzdvYvDgwbCxsYGLiwumTp0KjUaj01cURURFRaFNmzawtLSEm5sbxo0bh7t37+r08/HxwfPPP48DBw6gS5cusLS0RNOmTbF27Vptn+joaLz88ssAgN69e2unwMvWYjy4NqGoqAgzZ85EQEAA7O3t0aBBA/To0QO///571d7s+9y4cQODBw9GgwYN4OrqinfffbfC4/4VrQnZsGEDAgICYGtrCzs7O7Rr1w4LFy6sVG5l78/u3bvRuXNnWFlZaaf6H1wTUiY/Px/jxo1Dw4YNYWdnh5EjR5Z73x+2Fub+Mav6vgNAeno6Ro8eDTc3N1haWqJDhw5Ys2aNTp+rV69CEAR8+eWXWLZsGZo1awaVSoUnn3wSx44dKxfTgwoLC7Fr1y4EBwc/ti8AuLu744knnkBiYuJj+yqVSnz99ddo3bo1vv32W2RlZVVqH/cLCAiAk5MTduzYUeVtybhwJoRMTlZWFm7duqXTJggCGjZsCAD48MMP8dNPP2H06NE4c+YMbG1tsXv3bixfvhxz5sxBhw4ddLb97LPPIAgCPvjgA6SnpyMqKgrBwcGIj4+HlZUVgNIvm7CwMDz55JOIjIxEWloaFi5ciIMHD+LUqVNwcHDQjqfRaBASEoLAwEB8+eWX2Lt3L+bPn49mzZph/Pjx2n7jxo3Tjjtp0iQkJibi22+/xalTp3Dw4EGdGYOEhAQMHToUo0ePRmhoKFatWoVRo0YhICAAbdq0wdNPP41Jkybh66+/xowZM/DEE08AgPa/D8rOzsaKFSswYsQIjBkzBjk5OVi5ciVCQkJw9OhR+Pv7V+lnUlBQgD59+uDatWuYNGkSPD09sW7dOvz222+P3TYmJgYjRoxAnz59tH9Vnzt3DgcPHsTkyZMrlduFCxcwYsQIjBs3DmPGjEHLli0fuc+JEyfCwcEBH3/8MS5cuIDFixcjKSlJW5hWVlXf94KCAvTq1QsJCQmYOHEifH19sXnzZowaNQqZmZmYPHmyTv/169cjJycH48aNgyAImDdvHoYMGYIrV648ckbpxIkTKCoqQqdOnSqVR3FxMa5fv679HXocpVKJESNG4KOPPsKBAwcwYMAAnbEe/P20traGtbW1TlunTp1w8ODBSu2PjJhEZCJWr14tAajwoVKpdPqeOXNGsrCwkN58803p7t27kpeXl9S5c2epuLhY2+f333+XAEheXl5Sdna2tn3Tpk0SAGnhwoWSJElSUVGR5OrqKrVt21YqKCjQ9vv5558lANLMmTO1baGhoRIA6ZNPPtGJp2PHjlJAQID2+R9//CEBkH744Qedfrt27SrX7u3tLQGQ9u/fr21LT0+XVCqV9N5772nbNm/eLAGQfv/993LvXc+ePaWePXtqn5eUlEhqtVqnz927dyU3NzfpjTfe0GkHIM2aNavcmPeLioqSAEibNm3StuXl5Ul+fn7lYgoNDZW8vb21zydPnizZ2dlJJSUlDx3/UbmVvT+7du2q8LXQ0FDt87LPUEBAgFRUVKRtnzdvngRA2rFjx2PzfnDMqrzvZe/T999/r20rKiqSgoKCJBsbG+3nMDExUQIgNWzYULpz5462744dOyQA0k8//VRuX/dbsWKFBEA6c+ZMhfH37dtXysjIkDIyMqTTp09Lr7zyigRAeuedd3Rib9OmzUP3sW3bNp3fk7KxK/r9rOh9HDt2rGRlZfXIPMj48XAMmZxFixYhJiZG5/Hrr7/q9Gnbti1mz56NFStWICQkBLdu3cKaNWtgZlZ+cnDkyJGwtbXVPh86dCg8PDywc+dOAMDx48eRnp6Ot99+G5aWltp+AwYMQKtWrfDLL7+UG/P+4+oA0KNHD1y5ckX7fPPmzbC3t8ezzz6LW7duaR8BAQGwsbEpd1ikdevW6NGjh/a5i4sLWrZsqTNmVSiVSu16BVEUcefOHZSUlKBz5844efJklcfbuXMnPDw8MHToUG2btbV1hYsiH+Tg4IC8vLyHnnFRGb6+vggJCal0/7Fjx+rMJIwfPx5mZmban3lN2blzJ9zd3TFixAhtm7m5OSZNmoTc3Fzs27dPp//w4cPh6OiofV72GXjcz/327dsAoLPt/fbs2QMXFxe4uLigQ4cO2Lx5M15//fVy6zsepeyMm5ycHJ32wMDAcr+fI0eOLLe9o6MjCgoKkJ+fX+l9kvHh4RgyOV26dKnUwtT3338fGzZswNGjRzF37ly0bt26wn7NmzfXeS4IAvz8/LSnXCYlJQFAhVP8rVq1woEDB3TaLC0t4eLiotPm6Oios+bg0qVLyMrKgqura4Uxpaen6zxv0qRJuT4PjllVa9aswfz583H+/HkUFxdr2ys68+hxkpKS4OfnV+5QxuMOiwDA22+/jU2bNqF///7w8vJC3759MWzYMPTr16/S+69qzA/+zG1sbODh4VHjp9kmJSWhefPm5c7YKTt8U/ZZK/Pgz72sqKjsz12SpArbAwMD8emnn0IQBFhbW+OJJ57QOaRYGWXXHrm/gAcAZ2fnSq1FKYuNZ8eYNhYhVG9duXIFly5dAgCcOXOm1varVCof20cURbi6uuKHH36o8PUHi5iHjfmwL5nH+f777zFq1CgMHjwY77//PlxdXaFUKhEZGYnLly/rNaa+XF1dER8fj927d+PXX3/Fr7/+itWrV2PkyJHlFmw+TNnandrw4ALjmqTvz71sbcfdu3fRqFGjcq9XtlB4lLNnzwLQ/9T4u3fvwtraulZ/dlT7WIRQvSSKIkaNGgU7OztMmTIFc+fOxdChQzFkyJByfcsKlTKSJCEhIQHt27cHAHh7ewMoXfz44OmEFy5c0L5eFc2aNcPevXvRrVs3g/0jXJW/KLds2YKmTZti69atOtvNmjVLr317e3vj7NmzkCRJZ7wLFy5UansLCwsMHDgQAwcOhCiKePvtt7F06VJ89NFHFc6wVNelS5fQu3dv7fPc3FykpKTgueee07Y5OjoiMzNTZ7uioiKkpKTotFUlNm9vb/z1118QRVFnNuT8+fPa1w2hVatWAIDExES0a9fOIGPeT6PRYP369bC2tkb37t31GiMxMfGhC3jJdHBNCNVLCxYswJ9//olly5Zhzpw56Nq1K8aPH19u1T4ArF27Vue49pYtW5CSkoL+/fsDADp37gxXV1csWbJE55TTX3/9FefOndM5M6Cyhg0bBo1Ggzlz5pR7raSkpNyXX2U0aNAAACq1bdlf2Pf/RX3kyBEcOnSoyvsFgOeeew7JycnYsmWLti0/Px/Lli177LZl6xfKKBQKbQFY9n5XJbfKWLZsmc4hqMWLF6OkpET7MwdKC8X9+/eX2+7BmZCqxPbcc88hNTUVGzdu1LaVlJTgm2++gY2NDXr27KlPOuUEBATAwsKiRi5Pr9FoMGnSJJw7dw6TJk2CnZ2dXuOcPHkSXbt2NXB0VNdwJoRMzq+//qr9y/F+Xbt2RdOmTXHu3Dl89NFHGDVqFAYOHAig9BRbf39/7fqD+zk5OaF79+4ICwtDWloaoqKi4OfnhzFjxgAoXTj4xRdfICwsDD179sSIESO0p+j6+Pjg3XffrXIOPXv2xLhx4xAZGYn4+Hj07dsX5ubmuHTpEjZv3oyFCxfqLPKsDH9/fyiVSnzxxRfIysqCSqXCM888U+G6k+effx5bt27Fiy++iAEDBiAxMRFLlixB69at9brPyJgxY/Dtt99i5MiROHHiBDw8PLBu3bpyp2VW5M0338SdO3fwzDPPoFGjRkhKSsI333wDf39/7V/KVcmtMoqKitCnTx8MGzYMFy5cwHfffYfu3bvjhRde0InrrbfewksvvYRnn30Wp0+fxu7du+Hs7KwzVlViGzt2LJYuXYpRo0bhxIkT8PHxwZYtW3Dw4EFERUWVW1+hL0tLS/Tt2xd79+7FJ598ovc4WVlZ+P777wGUFpVlV0y9fPkyXnnllQqL6Mo4ceIE7ty5g0GDBukdGxkJGc/MITKoR52iC0BavXq1VFJSIj355JNSo0aNpMzMTJ3tFy5cKAGQNm7cKEnSv6fo/vjjj1JERITk6uoqWVlZSQMGDJCSkpLK7X/jxo1Sx44dJZVKJTk5OUmvvvqqdOPGDZ0+oaGhUoMGDcptO2vWLKmiX8dly5ZJAQEBkpWVlWRrayu1a9dOmjZtmpScnKzt4+3tLQ0YMKDctg+e/ilJkrR8+XKpadOmklKp1Dlt9MG+oihKc+fOlby9vSWVSiV17NhR+vnnn8udPitJlTtFV5IkKSkpSXrhhRcka2trydnZWZo8ebL2lONHnaK7ZcsWqW/fvpKrq6tkYWEhNWnSRBo3bpyUkpJSqdwe9v6UvVbRKbr79u2Txo4dKzk6Oko2NjbSq6++Kt2+fVtnW41GI33wwQeSs7OzZG1tLYWEhEgJCQnlxnxUbBX9jNLS0qSwsDDJ2dlZsrCwkNq1ayetXr1ap0/ZKbr//e9/y+VU2Z/H1q1bJUEQpGvXrpV7Tx72ft2vZ8+eOr9fNjY2UvPmzaXXXntN2rNnT4XbVHbsDz74QGrSpIkkiuJj+5JxEyRJz5VrRCYuLi4OvXv3xubNm6s860BU12k0GrRu3RrDhg3Te8aiJqjVavj4+GD69OnlLs5GpodrQoiI6iGlUolPPvkEixYt0usQW01ZvXo1zM3Ny11Lh0wTixAionpq+PDhuHPnjvbCYnXBW2+9hWvXrsl+c0GqHSxCiIiISBZcE0JERESy4EwIERERyYJFCBEREcmCFyurgCiKSE5Ohq2tLW+eREREVAWSJCEnJweenp7lbsb4IBYhFUhOTkbjxo3lDoOIiMhoXb9+vcIbJN6PRUgFyi6NfP36db3ve/AgURSRkZEBFxeXx1aGxoI5GQfmZByYk3FgTo+XnZ2Nxo0bV+o2AyxCKlB2CMbOzs6gRUhhYSHs7OxM6oPLnOo+5mQcmJNxYE6VV5nlDKbxDhIREZHRYRFCREREsmARQkRERLLgmhAiIqpVGo0GxcXFcoehF1EUUVxcjMLCQpNaE1KVnJRKJczMzAxyCQsWIUREVGtyc3Nx48YNGOsdQyRJgiiKyMnJMZnrSOmTk7W1NTw8PGBhYVGtfbMIISKiWqHRaHDjxg1YW1vDxcXFKL/EJUlCSUmJwWYC6oKq5CRJEoqKipCRkYHExEQ0b968WjNCLEKIiKhWFBcXQ5IkuLi4wMrKSu5w9FLfixAAsLKygrm5OZKSklBUVARLS0u99y3rAa3IyEg8+eSTsLW1haurKwYPHowLFy48drvNmzejVatWsLS0RLt27bBz506d1yVJwsyZM+Hh4QErKysEBwfj0qVLNZUGERFVgal8eddnhloPI2sRsm/fPkyYMAGHDx9GTEwMiouL0bdvX+Tl5T10mz///BMjRozA6NGjcerUKQwePBiDBw/G2bNntX3mzZuHr7/+GkuWLMGRI0fQoEEDhISEoLCwsDbSIiIiokqQ9XDMrl27dJ5HR0fD1dUVJ06cwNNPP13hNgsXLkS/fv3w/vvvAwDmzJmDmJgYfPvtt1iyZAkkSUJUVBQ+/PBDDBo0CACwdu1auLm5Yfv27XjllVdqNikiIiKqlDq1JiQrKwsA4OTk9NA+hw4dQnh4uE5bSEgItm/fDgBITExEamoqgoODta/b29sjMDAQhw4dqrAIUavVUKvV2ufZ2dkASk9bEkVR73zul/rpZ8i7ehUOcz6BhYeHQcaUmyiK2lXVpoI5GQfmZBwezKnsednDWJXFfn8OvXv3RocOHRAVFWWw/dTEmA9TUU6P61/2s33wM1uVz3CdKUJEUcSUKVPQrVs3tG3b9qH9UlNT4ebmptPm5uaG1NRU7etlbQ/r86DIyEjMnj27XHtGRobBDuFkx8ZCSktD+rlzsFAqDTKm3ERRRFZWFiRJMqnz5ZlT3cecjMODORUXF0MURZSUlKCkpETu8Cpt9OjRyMzMxP/+9z9IkgSNRgNAd21L2ZeyIfN63Jhr167Fm2++qY3F09MTffr0wdy5c+Hq6goAOqfQWltbw9PTE0FBQZgwYQI6deqk3c/vv/+Ofv36ldvH9OnT8cknn5RrLykpgSiKuH37NszNzXVey8nJqXSOdaYImTBhAs6ePYsDBw7U+r4jIiJ0ZlfK7gDo4uJisBvYFbi5oTAtDXYaDezufTiMnSiKEATB5O4myZzqPuZkHB7MqbCwEDk5OTAzM4OZWZ35+nkshUIBhUKhE/ODX7yCIEAQBIPm9bgxFQoF7OzscP78eYiiiNOnT+ONN95AamqqznKHVatWoV+/figsLMTFixexfPlydOvWDStXrsTIkSO1YwHA+fPndb73bGxsKty/mZkZFAoFGjZsWO7smKqcLVMnPgUTJ07Ezz//jP3796NRo0aP7Ovu7o60tDSdtrS0NLi7u2tfL2vzuO+wR1paGvz9/SscU6VSQaVSlWsv++AZgpmzMwBAvH3HZP6BAUp/SQz5PtUFzMk4MCfjcH9OCoVC+8UqCELpX/oFBfLEZWVV5bN0ymLOz8/HpEmTsHXrVtja2mLq1Kna18vGVKvV+M9//oMff/wRmZmZaNu2Lb744gv06tULAHD79m1MnDgR+/fvx927d9GsWTPMmDEDI0aMKLfPh8VZ9lrZd52XlxcmTZqEjz76CIWFhdrToB0dHbV9fH19ERISgtDQULzzzjt44YUX4ODgoN2Hm5sbHBwcKvVePOzzWpXPr6xFiCRJeOedd7Bt2zbExcXB19f3sdsEBQUhNjYWU6ZM0bbFxMQgKCgIQOkb7O7ujtjYWG3RkZ2djSNHjmD8+PE1kUalKO8VISW3bskWAxFRXSIVFOBCpwBZ9t3y5AkI1tZ6bTt9+nTs27cPO3bsgKurK2bMmIGTJ0/q/KE7ceJE/PPPP9iwYQM8PT2xbds29OvXD2fOnEHz5s1RWFiIgIAAfPDBB7Czs8Mvv/yC119/Hc2aNUOXLl30zsvKykp7yOtR3n33XaxduxYxMTF4+eWX9d5fdclahEyYMAHr16/Hjh07YGtrq12zYW9vr63gRo4cCS8vL0RGRgIAJk+ejJ49e2L+/PkYMGAANmzYgOPHj2PZsmUASquzKVOm4NNPP0Xz5s3h6+uLjz76CJ6enhg8eLAseQKAmYsLABYhRETGLDc3F6tXr8a6devQp08fAMCaNWt0ZvGvXbuG1atX49q1a/D09AQATJ06Fbt27cLq1asxd+5ceHl5aWdQAOCdd97B7t27sWnTJr2LkEuXLmHJkiXo3LkzbG1tH9m3VatWAICrV6/qtD94NCIpKQkNGzbUK57KkLUIWbx4MQBop6fKrF69GqNGjQJQ+sO8f2qna9euWL9+PT788EPMmDEDzZs3x/bt23UWs06bNg15eXkYO3YsMjMz0b17d+zatataV3WrrrLDMZqMDNliICKqSwQrK7Q8eUK2fevj8uXLKCoqQmBgoLbNyckJLVu21D4/c+YMNBoNWrRoobOtWq3WfqFrNBrMnTsXmzZtws2bN1FUVAS1Wg3rKs7OZGVlwcbGBqIoorCwEN27d8eKFSseu13ZWTAPHur5448/dAoYR0fHKsVTVbIfjnmcuLi4cm0vv/zyI6ePBEHAJ598UuGKXrnwcAwRkS5BEPQ+JFKX5ebmQqlU4sSJE1A+cDakjY0NAOC///0vFi5ciKioKLRr1w4NGjTAlClTUFRUVKV92dra4uTJk1AoFNqrhFfGuXPnAKDcMghfX99KrQkxlDqxMLU+MGMRQkRk9Jo1awZzc3McOXIE3t7eAIC7d+/i4sWL6NmzJwCgY8eO0Gg0SE9PR48ePSoc5+DBgxg0aBBee+01AKVnEl28eBGtW7euUjwKhQJ+fn5VziMqKgp2dnY619SSA4uQWqI9HHPrFiRJ4r0TiIiMkI2NDcLCwjBt2jQ4OzvD1dUV//nPf3SWDbRo0QKvvvoqRo4cifnz56Njx47IyMhAbGws2rdvjwEDBqB58+bYsmUL/vzzTzg6OmLBggVIS0urchFSGZmZmUhNTYVarcbFixexdOlSbN++HWvXroWDg4OsF45jEVJLlM6lxwGl4mKI2dlQ2tvLHBEREenj888/R35+PgYOHAhbW1u899572it+l1m9ejU+/fRTvPfee7h58yacnZ3x1FNP4fnnnwcAfPjhh7hy5QpCQkJgbW2NsWPHYvDgweXGMYSwsDAApdfv8PLyQvfu3XH06FHtxcrkJEjGfO3cGpKdnQ17e3tkZWUZ7GJloijiYuBTkHJy0PTnn6DSY/qsrhFFEenp6XB1dTWZ6xowJ+PAnIzDgzkVFhYiMTERvr6+sp4oUB1Vve29MdAnp0f9LKvyHWoan3QjIdy7Jw7XhRAREbEIqVWKsiIkg0UIERERi5BaJDiVnm/NmRAiIiIWIbVKOxNyixcsIyIiYhFSi8qKEA1nQoiIiFiE1Cbh3uV6S3jpdiIiIhYhtYkLU4mIiP7FIqQWKXiKLhERkRaLkFpUdp0Qzd27kIqLZY6GiIhIXrxsey0S7OwAMzOgpAQld+7A3M1N7pCIiGT3VczFWt3fu8+2qNX91TRBELBt2zYMHjxY7zFGjx6N7OxsbN++3WBxVQZnQmqRoFDArGxxajoXpxIRGYuMjAyMHz8e3t7esLGxgYeHB0JCQnDw4EG5QzNqnAmpZUpnZ5SkpfFaIURERuSll15CUVERoqOj0aRJE9y+fRu//fYbbt++LXdoRo0zIbXMzNkZABenEhEZi8zMTPzxxx/44osv0Lt3b3h7e6NLly6IiIjACy+8AABYsGAB2rVrhwYNGqBx48Z4++23kZubqx0jOjoaDg4O+Pnnn9GyZUtYW1tj6NChyM/Px5o1a+Dj4wNHR0dMmjQJGo1Gu52Pjw/mzJmDESNGoEGDBvDy8sKiRYseGe/169cxbNgwODg4wMnJCYMGDcLVq1e1r2s0GoSHh8PBwQENGzbEtGnTINe9bFmE1LKyIoQXLCMiMg42NjawsbHB9u3boVarK+yjUCjw9ddf4++//8aaNWvw22+/Ydq0aTp98vPz8fXXX2PDhg3YtWsX4uLi8OKLL2Lnzp3YuXMn1q1bh6VLl2LLli062/33v/9Fhw4dcOrUKUyfPh2TJ09GTExMhXEUFxcjJCQEtra2+OOPP3Dw4EHY2NigX79+KCoqAgDMnz8f0dHRWLVqFQ4cOIA7d+5gx44dBninqo6HY2qZ0pkXLCMiMiZmZmaIjo7GmDFjsGTJEnTs2BE9e/bEiBEj0L59ewDAlClTtP19fHzw6aef4q233sJ3332nbS8uLsbixYvRrFkzAMDQoUOxbt06pKWlwcbGBq1bt0bv3r3x+++/Y/jw4drtunXrhunTpwMAWrRogYMHD+Krr77Cs88+Wy7WjRs3QhRFrFixAoIgAABWr14NBwcHxMXFoW/fvoiKikJERASGDBkCAFiyZAn27Nlj2DetkjgTUsvMXF0BAMXp6TJHQkRElfXSSy8hOTkZO3bsQN++fbFv3z506tQJ0dHRAIC9e/eiT58+8PLygq2tLV5//XXcvn0b+fn52jGsra21BQgAuLm5wcfHBzY2Njpt6Q98PwQFBZV7fu7cuQrjPH36NBISEmBra6udwXFyckJhYSEuX76MrKwspKSkIDAwULuNmZkZOnXqpPd7Ux2cCallZi6lRQjPjiEiMi6WlpZ49tln0bt3b8yaNQtjxozBrFmz0KtXLzz//PMYP348PvvsMzg5OeHAgQMYPXo0ioqKYG1tDQAwNzfXGU8QhArbRFHUO8bc3FwEBATghx9+KPeai4uL3uPWFM6E1DIzt3tFSFqazJEQEVF1tG7dGnl5eThx4gREUcT8+fPx1FNPoUWLFkhOTjbYfg4fPlzu+RNPPFFh306dOuHSpUtwdXWFn5+fzsPe3h729vbw8PDAkSNHtNuUlJTg1KlTBou3KliE1LKywzElt25Bum8FNBER1U23b9/GM888g++//x5//fUXEhMTsXnzZsybNw+DBg2Cn58fiouL8c033+DKlStYt24dlixZYrD9Hzx4EPPmzcPFixexaNEibN68GZMnT66w76uvvgpnZ2cMGjQIf/zxBxITExEXF4dJkybhxo0bAIDJkyfj888/x/bt23H+/Hm8/fbbyMzMNFi8VcHDMbXMrGFDQKEANBqU3L4N83tFCRFRfVXXr2BqY2ODwMBAfPXVV7h8+TKKi4vRuHFjjBkzBjNmzICVlRUWLFiAL774AhEREXj66acRGRmJkSNHGmT/7733Ho4fP47Zs2fDzs4OCxYsQEhISIV9ra2tsX//fnzwwQcYMmQIcnJy4OXlhT59+sDOzk47XkpKCkJDQ6FQKBAWFoZBgwYhJyfHIPFWhSDJdXJwHZadnQ17e3tkZWVpf2jVJYoi0tPT4erqiss9e6EkIwM+W7bAqm0bg4wvh/tzUihMY1KNORkH5mQcHsypsLAQiYmJ8PX1haWlpdzh6UWSJJSUlMDMzEx79klN8vHxwZQpU3TOvjE0fXJ61M+yKt+hpvFJNzJm9+4ZU5LOdSFERFR/yVqE7N+/HwMHDoSnpycEQXjsjXNGjRoFQRDKPdq0+Xc24eOPPy73eqtWrWo4k6rRrgvhabpERFSPybomJC8vDx06dMAbb7yhvWjKoyxcuBCff/659nlJSQk6dOiAl19+WadfmzZtsHfvXu1zM7O6tfSl7AyZYp4hQ0REj3D/5dZNkazfzv3790f//v0r3b/s9KIy27dvx927dxEWFqbTz8zMDO7u7gaL01B2nLqJfGUWmmYr0QLA6VMJKH+9OyIiovqhbk0RVNHKlSsRHBwMb29vnfZLly7B09MTlpaWCAoKQmRkJJo0afLQcdRqtc79ALKzswGULqqqzkVj7ieKIiBJgCRBbe8EAFBl3jbY+HIQRRGSJBl1Dg9iTsaBORmHB3O6/7kxnxNRFrsx5/CgquZ0/8/ywc9sVT7DRluEJCcn49dff8X69et12gMDAxEdHY2WLVsiJSUFs2fPRo8ePXD27FnY2tpWOFZkZCRmz55drj0jIwOFhYUGiVcURaikQkAEYGsFALDKulXu8rzGRBRFZGVlQZIkk1rNz5zqPuZkHB7MSaPRQKPRoLCwsNyVQo2FJEnau9zWxtkxtUGfnHJzc6HRaJCZmVnu81qVU32NtghZs2YNHBwcMHjwYJ32+w/vtG/fHoGBgfD29samTZswevToCseKiIhAeHi49nl2djYaN24MFxcXg56iqxaSka+wgcLRCwBgkZ0JVyO+TogoihAEAS4uLib1jyZzqvuYk3F4MCdJklBcXIw7d+5ApVIZbZ7FxcVyh2Bwlc1JkiTk5+fj9u3baNiwYYVLH6py+rVRFiGSJGHVqlV4/fXXYWFh8ci+Dg4OaNGiBRISEh7aR6VSQaVSlWtXKBSG/SURBEAQoHYovZOuRV4OUFwMRQX7NhaCIBj+fZIZczIOzMk4PJiTp6cnEhMTce3aNZkj00/ZIQiFQmFSMyFVzcnBwQHu7u4V9q/K59coi5B9+/YhISHhoTMb98vNzcXly5fx+uuv10JklVNsbQONuQWUxUUoyciARaNGcodERFQrLCws0Lx5cxQVFckdil5EUdTOAphKsVjVnMzNzaFUKg2yb1mLkNzcXJ0ZisTERMTHx8PJyQlNmjRBREQEbt68ibVr1+pst3LlSgQGBqJt27blxpw6dSoGDhwIb29vJCcnY9asWVAqlRgxYkSN51NpggC1vROsb6WiJC2NRQgR1SsKhcJor5gqiiLMzc1haWlpUkWIXDnJWoQcP34cvXv31j4vW5cRGhqK6OhopKSklJuyy8rKwv/+9z8sXLiwwjFv3LiBESNG4Pbt23BxcUH37t1x+PDhOncL48KyIsSIF6YSERFVh6xFSK9evR55OlB0dHS5Nnt7e+Tn5z90mw0bNhgitBpXdpouL1hGRET1lWnMJRmhQvvSxakl6RkyR0JERCQPFiEyKZsJKeFMCBER1VMsQmRS6HCvCOGaECIiqqdYhMhEfe9wTHE6Z0KIiKh+YhEik0Lt4Zh0k7r/ABERUWWxCJFJ2ZoQqbAQYlaWzNEQERHVPhYhMhEtVCiyKb0vTXFqqszREBER1T4WITIqcHAGABSnpMgcCRERUe1jESKjQsfSIqSEMyFERFQPsQiRUaF2JoRFCBER1T8sQmRUNhNSnMrDMUREVP+wCJHRv4djeK0QIiKqf1iEyEh7OIZrQoiIqB5iESKj+xem8oJlRERU37AIkVGhQ0NAECAVFUFz547c4RAREdUqFiEykpRmMHPmGTJERFQ/sQiRmZmHBwCghGfIEBFRPcMiRGbm7u4AOBNCRET1D4sQmZl73CtCOBNCRET1DIsQmZm53zscw5kQIiKqZ1iEyOzfmRAWIUREVL+wCJGZdk0ID8cQEVE9wyJEZtqzY9LSIWk0MkdDRERUe1iEyMzM2RkwMwM0GpTcuiV3OERERLWGRYjMBKUSZq4uAICSFB6SISKi+oNFSB1gfu8MGS5OJSKi+kTWImT//v0YOHAgPD09IQgCtm/f/sj+cXFxEASh3CP1gS/vRYsWwcfHB5aWlggMDMTRo0drMIvqM7+3LqQ4mTMhRERUf8hahOTl5aFDhw5YtGhRlba7cOECUlJStA9XV1ftaxs3bkR4eDhmzZqFkydPokOHDggJCUF6erqhwzcYcy8vAEDxzZsyR0JERFR7zOTcef/+/dG/f/8qb+fq6goHB4cKX1uwYAHGjBmDsLAwAMCSJUvwyy+/YNWqVZg+fXp1wq0x5p6eAIDi5GSZIyEiIqo9shYh+vL394darUbbtm3x8ccfo1u3bgCAoqIinDhxAhEREdq+CoUCwcHBOHTo0EPHU6vVUKvV2ufZ2dkAAFEUIYqiQWIWRRGQpNLHA+1mnqWHY4pu3jTY/mqDKIqQJMmoYn4c5mQcmJNxYE7GwdA5VWUcoypCPDw8sGTJEnTu3BlqtRorVqxAr169cOTIEXTq1Am3bt2CRqOBm5ubznZubm44f/78Q8eNjIzE7Nmzy7VnZGSgsLDQILGLogiVVAiIACBo29PT06GxtAQAFN24gbS0NAiCUPEgdYwoisjKyoIkSVAoTGONM3MyDszJODAn42DonHJycird16iKkJYtW6Jly5ba5127dsXly5fx1VdfYd26dXqPGxERgfDwcO3z7OxsNG7cGC4uLrCzs6tWzGVEUYRaSEa+wga4r8hwdXWFaGeHbADIz4ezSgXlQw411TWiKEIQBLi4uJjULyNzqvuYk3FgTsbB0DlZ3vvDujKMqgipSJcuXXDgwAEAgLOzM5RKJdLS0nT6pKWlwf3e5dErolKpoFKpyrUrFArDfsgE4d/H/fuwtobS2RmaW7egSU2FuZOT4fZZwwRBMPz7JDPmZByYk3FgTsbBkDlVZQyjfwfj4+Phce8UVwsLCwQEBCA2Nlb7uiiKiI2NRVBQkFwhPtJXMRfxVcxF3LYpLTz+t/MYvoq5KHNURERENU/WmZDc3FwkJCRonycmJiI+Ph5OTk5o0qQJIiIicPPmTaxduxYAEBUVBV9fX7Rp0waFhYVYsWIFfvvtN+zZs0c7Rnh4OEJDQ9G5c2d06dIFUVFRyMvL054tU1cVOLrA4epFWN2uu6cSExERGZKsRcjx48fRu3dv7fOydRmhoaGIjo5GSkoKrl27pn29qKgI7733Hm7evAlra2u0b98ee/fu1Rlj+PDhyMjIwMyZM5Gamgp/f3/s2rWr3GLVuqagYWl8VnczZI6EiIiodshahPTq1QvSA6es3i86Olrn+bRp0zBt2rTHjjtx4kRMnDixuuHVqgKn0guucSaEiIjqC6NfE2IqCpxKb2JndYdFCBER1Q8sQuoI7UwIixAiIqonWITUEYX3ihDzgjyY5efKHA0REVHNYxFSR2hUliiyKb0wmtUdLk4lIiLTxyKkDuEhGSIiqk9YhNQhLEKIiKg+YRFSh7AIISKi+oRFSB1SVoRY8lohRERUD7AIqUMKGpYWIdZ30h7Tk4iIyPixCKlD8p1L7/RrfSv1kVeSJSIiMgUsQuqQssMxZoUF0GRmyhsMERFRDWMRUoeIFioUOjQEABTfd+M+IiIiU8QipI4pOyRTdO26zJEQERHVLBYhdUx+QzcAQPENFiFERGTaWITUMfnOHgA4E0JERKaPRUgdU1B2OOY614QQEZFpYxFSx+Q73zscc/2GzJEQERHVLBYhdUzZ4ZiStDSIhYUyR0NERFRzWITUMcUNbFFsaV36/zc4G0JERKaLRUhdIwgouHdIpug6F6cSEZHpYhFSB5VdK6SYRQgREZkwFiF1EE/TJSKi+oBFSB1UUHbBMs6EEBGRCWMRUgdpL93OIoSIiEwYi5A6qOxwTPGNG5BEUeZoiIiIaoasRcj+/fsxcOBAeHp6QhAEbN++/ZH9t27dimeffRYuLi6ws7NDUFAQdu/erdPn448/hiAIOo9WrVrVYBaGV+joDJiZQSoqQklamtzhEBER1QhZi5C8vDx06NABixYtqlT//fv349lnn8XOnTtx4sQJ9O7dGwMHDsSpU6d0+rVp0wYpKSnax4EDB2oi/BojKZWw8PICABQl8fLtRERkmszk3Hn//v3Rv3//SvePiorSeT537lzs2LEDP/30Ezp27KhtNzMzg7u7u6HClIWFjw+KkpJQdPUqGjwVKHc4REREBidrEVJdoigiJycHTk5OOu2XLl2Cp6cnLC0tERQUhMjISDRp0uSh46jVaqjVau3z7Oxs7fiigdZkiKIISFLpoxLMfbyBfYA6MdFgMRiaKIqQJKnOxqcP5mQcmJNxYE7GwdA5VWUcoy5CvvzyS+Tm5mLYsGHatsDAQERHR6Nly5ZISUnB7Nmz0aNHD5w9exa2trYVjhMZGYnZs2eXa8/IyEChge7fIooiVFIhIAKA8Nj+aqeGAIDcixeB9HSDxGBooigiKysLkiRBoTCNNc7MyTgwJ+PAnIyDoXPKycmpdF+jLULWr1+P2bNnY8eOHXB1ddW23394p3379ggMDIS3tzc2bdqE0aNHVzhWREQEwsPDtc+zs7PRuHFj7QJYQxBFEWohGfkKG0B4fBHi1K4t8gEgJUUnv7pEFEUIggAXFxeT+mVkTnUfczIOzMk4GDonS0vLSvc1yiJkw4YNePPNN7F582YEBwc/sq+DgwNatGiBhISEh/ZRqVRQqVTl2hUKhWE/ZILw7+MxLJs2BVB6mq6g0UAwNzdcHAYkCILh3yeZMSfjwJyMA3MyDobMqSpjGN07+OOPPyIsLAw//vgjBgwY8Nj+ubm5uHz5Mjw8PGohOsMxc3WFYGUFlJSg+OZNucMhIiIyOFmLkNzcXMTHxyM+Ph4AkJiYiPj4eFy7VnpaakREBEaOHKntv379eowcORLz589HYGAgUlNTkZqaiqysLG2fqVOnYt++fbh69Sr+/PNPvPjii1AqlRgxYkSt5lZdgkIBC29vAID66lV5gyEiIqoBshYhx48fR8eOHbWn14aHh6Njx46YOXMmACAlJUVbkADAsmXLUFJSggkTJsDDw0P7mDx5srbPjRs3MGLECLRs2RLDhg1Dw4YNcfjwYbi4uNRuctX0VcxFXLUqXZwas/sYvoq5KHNEREREhiXrmpBevXpBesQpq9HR0TrP4+LiHjvmhg0bqhlV3ZHv6gkAaJCRLHMkREREhqfXTMiVK1cMHQdVIM/lXhGSziKEiIhMj15FiJ+fH3r37o3vv//eYNfRoPLyXEsv3W6dzoWpRERkevQqQk6ePIn27dsjPDwc7u7uGDduHI4ePWro2Oq9ssMxVpm3oVSz2CMiItOiVxHi7++PhQsXIjk5GatWrUJKSgq6d++Otm3bYsGCBcjIyDB0nPVScQNbFDUovcqrdUaKzNEQEREZVrXOjjEzM8OQIUOwefNmfPHFF0hISMDUqVPRuHFjjBw5Eikp/OKsrrx7syHWXJxKREQmplpFyPHjx/H222/Dw8MDCxYswNSpU3H58mXExMQgOTkZgwYNMlSc9Va+S+m6kAZpXBdCRESmRa9TdBcsWIDVq1fjwoULeO6557B27Vo899xz2ku1+vr6Ijo6Gj4+PoaMtV7KcystQmzSbsgcCRERkWHpVYQsXrwYb7zxBkaNGvXQy6G7urpi5cqV1QqOgFy3RgCABixCiIjIxOhVhMTExKBJkyblblIjSRKuX7+OJk2awMLCAqGhoQYJsj7L9WgMALBJvQ5JFCGY0A2TiIioftPrG61Zs2a4detWufY7d+7A19e32kHRvwoaukM0M4OyuAjFyVzoS0REpkOvIuRhl1rPzc2FpaVltQIiXZJSibx7i1OLLifIHA0REZHhVOlwTHh4OABAEATMnDkT1tbW2tc0Gg2OHDkCf39/gwZIQK57I9imJEF9+QpsevaUOxwiIiKDqFIRcurUKQClMyFnzpyBhYWF9jULCwt06NABU6dONWyEhDz30nUhas6EEBGRCalSEfL7778DAMLCwrBw4ULY2dnVSFCkq+wMmaLLvHEgERGZDr3Ojlm9erWh46BHKDtDRn35MiRJgiAIMkdERERUfZUuQoYMGYLo6GjY2dlhyJAhj+y7devWagdG/8pz8YIkKCDm5KAkIwPmrq5yh0RERFRtlS5C7O3ttX+B29vb11hAVJ5kbo58Z3c0yEhG0eXLLEKIiMgkVLoIuf8QDA/H1L5c90ZokJEM9eUraBAUJHc4RERE1abXdUIKCgqQn5+vfZ6UlISoqCjs2bPHYIGRLp4hQ0REpkavImTQoEFYu3YtACAzMxNdunTB/PnzMWjQICxevNigAVIpniFDRESmRq8i5OTJk+jRowcAYMuWLXB3d0dSUhLWrl2Lr7/+2qABUintGTIJnAkhIiLToFcRkp+fD1tbWwDAnj17MGTIECgUCjz11FNISkoyaIBUKs+tMSAI0Ny5g5IK7ttDRERkbPQqQvz8/LB9+3Zcv34du3fvRt++fQEA6enpvIBZDdGoLGHe5N5syMWLMkdDRERUfXoVITNnzsTUqVPh4+ODwMBABN07W2PPnj3o2LGjQQOkf1m2aAkAKGQRQkREJkCvK6YOHToU3bt3R0pKCjp06KBt79OnD1588UWDBUe6VC1aICcmBuoLLEKIiMj46VWEAIC7uzvc3d112rp06VLtgOjhVC1bAODhGCIiMg16HY7Jy8vDRx99hK5du8LPzw9NmzbVeVTW/v37MXDgQHh6ekIQBGzfvv2x28TFxaFTp05QqVTw8/NDdHR0uT6LFi2Cj48PLC0tERgYiKNHj1Yhu7rLssW9IiQhAZJGI3M0RERE1aPXTMibb76Jffv24fXXX4eHh4feN1TLy8tDhw4d8MYbbzz2fjQAkJiYiAEDBuCtt97CDz/8gNjYWLz55pvw8PBASEgIAGDjxo0IDw/HkiVLEBgYiKioKISEhODChQtwNfLLnZs3bgzBygpSQQGKkq5B1dRX7pCIiIj0plcR8uuvv+KXX35Bt27dqrXz/v37o3///pXuv2TJEvj6+mL+/PkAgCeeeAIHDhzAV199pS1CFixYgDFjxiAsLEy7zS+//IJVq1Zh+vTp1YpXboJSCZWfHwrPnIH64kUWIUREZNT0KkIcHR3h5ORk6Fge69ChQwgODtZpCwkJwZQpUwAARUVFOHHiBCIiIrSvKxQKBAcH49ChQw8dV61WQ61Wa59nZ2cDAERRhCiKBoldFEVAkkof1RhD1aIFCs+cQeGF87Dp+6xBYqtOPJIkGew9qguYk3FgTsaBORkHQ+dUlXH0KkLmzJmDmTNnYs2aNbC2ttZnCL2kpqbCzc1Np83NzQ3Z2dkoKCjA3bt3odFoKuxz/vz5h44bGRmJ2bNnl2vPyMhAYWGhQWIXRREqqRAQAUC/w1fLd5+Cp8YKfgAuHDiGbS1OYVBHL4PEpw9RFJGVlQVJkqBQ6LW8qM5hTsaBORkH5mQcDJ1TTk5OpfvqVYTMnz8fly9fhpubG3x8fGBubq7z+smTJ/UZVjYREREIDw/XPs/Ozkbjxo3h4uJisIuviaIItZCMfIUNoOcaGgC406j0WiHWyTeQr7SRdZ2LKIoQBAEuLi4m9cvInOo+5mQcmJNxMHROlpaWle6rVxEyePBgfTarNnd3d6Slpem0paWlwc7ODlZWVlAqlVAqlRX2efB04vupVCqoVKpy7QqFwrAfMkH496GnHC8fAID17TQoiwpl/yUQBMHw75PMmJNxYE7GgTkZB0PmVJUx9CpCZs2apc9m1RYUFISdO3fqtMXExGiv2GphYYGAgADExsZqCyVRFBEbG4uJEyfWdrg1otjGDoV2jrDMvgub5GsAOjx2GyIiorpI75InMzMTK1asQEREBO7cuQOg9DDMzZs3Kz1Gbm4u4uPjER8fD6D0FNz4+Hhcu3YNQOlhkpEjR2r7v/XWW7hy5QqmTZuG8+fP47vvvsOmTZvw7rvvavuEh4dj+fLlWLNmDc6dO4fx48cjLy9Pe7aMKSibDbG7eUXeQIiIiKpBr5mQv/76C8HBwbC3t8fVq1cxZswYODk5YevWrbh27RrWrl1bqXGOHz+O3r17a5+XrcsIDQ1FdHQ0UlJStAUJAPj6+uKXX37Bu+++i4ULF6JRo0ZYsWKF9vRcABg+fDgyMjIwc+ZMpKamwt/fH7t27Sq3WNWY5TRqCpdzp2B3I1HuUIiIiPSmVxESHh6OUaNGYd68ebC1tdW2P/fcc/h//+//VXqcXr16QXrEKasVXQ21V69eOHXq1CPHnThxoskcfqlIVuNmAAC765dljoSIiEh/eh2OOXbsGMaNG1eu3cvLC6mpqdUOih4tu1HppfFtkpMgFRfLHA0REZF+9CpCVCqV9oJe97t48SJcXFyqHRQ9WoGzO4qtGkBZUgz1Fa4LISIi46RXEfLCCy/gk08+QfG9v8IFQcC1a9fwwQcf4KWXXjJogFQBQUCOV+kl2wv//kfmYIiIiPSjVxEyf/585ObmwsXFBQUFBejZsyf8/Pxga2uLzz77zNAxUgWyG5cekin8h0UIEREZJ70Wptrb2yMmJgYHDx7E6dOnkZubi06dOpW7rwvVnLLFqYXnzskcCRERkX6qXISIoojo6Ghs3boVV69ehSAI8PX1hbu7OyRJglCNq4FS5eXcW5xaeO4cJFGEYEJX7iMiovqhSt9ckiThhRdewJtvvombN2+iXbt2aNOmDZKSkjBq1Ci8+OKLNRUnPSDP1QsacwtI+fkoupokdzhERERVVqWZkOjoaOzfvx+xsbE6FxkDgN9++w2DBw/G2rVrda5ySjVDUiqR4+ULh6sXUPjPP1A19ZU7JCIioiqp0kzIjz/+iBkzZpQrQADgmWeewfTp0/HDDz8YLDh6tKyyxannuDiViIiMT5WKkL/++gv9+vV76Ov9+/fH6dOnqx0UVU522eLUs3/LHAkREVHVVakIuXPnziPvweLm5oa7d+9WOyiqnKwmzQEAhWfPQtJoZI6GiIioaqpUhGg0GpiZPXwZiVKpRElJSbWDosrJc28MwcoKYl4eihJ5MzsiIjIuVVqYKkkSRo0aBZVKVeHrarXaIEFR5UhKJW57NYVTwt/Y8eMe3HxK1L727rMtZIyMiIjo8apUhISGhj62D8+MqV1Z3s3hlPA37JMu4eZTvFgcEREZjyoVIatXr66pOEhPmd6lMx72Vy/KHAkREVHV8DKbRi7rXhFim3wViiIeDiMiIuPBIsTIFTo6Q23rAIUowu7GFbnDISIiqjQWIcZOEJDpw0MyRERkfFiEmIAs79LrhTgksQghIiLjwSLEBJStC7FPuiRzJERERJXHIsQEZDXxAwBY306DRU6mvMEQERFVEosQE1BibYMcjyYAAIcr52WOhoiIqHJYhJiIzKZPAAAcr5yTORIiIqLKYRFiIu6yCCEiIiPDIsRElBUhdtcv86JlRERkFFiEmIiChm4otHOEQlMC+2sJcodDRET0WHWiCFm0aBF8fHxgaWmJwMBAHD169KF9e/XqBUEQyj0GDBig7TNq1Khyr/fr1682UpGPIOBus9YAAMfL/8gcDBER0ePJXoRs3LgR4eHhmDVrFk6ePIkOHTogJCQE6enpFfbfunUrUlJStI+zZ89CqVTi5Zdf1unXr18/nX4//vhjbaQjq7LFqQ5cF0JEREZA9iJkwYIFGDNmDMLCwtC6dWssWbIE1tbWWLVqVYX9nZyc4O7urn3ExMTA2tq6XBGiUql0+jk6OtZGOrLSLk5NPA9JFGWOhoiI6NHM5Nx5UVERTpw4gYiICG2bQqFAcHAwDh06VKkxVq5ciVdeeQUNGjTQaY+Li4OrqyscHR3xzDPP4NNPP0XDhg0rHEOtVkOt/ncxZ3Z2NgBAFEWIBvoyF0URkKTSRw3J8fRBiYUlzAvyUHjpElTNm9fYvoDSnCRJMth7VBcwJ+PAnIwDczIOhs6pKuPIWoTcunULGo0Gbm5uOu1ubm44f/7xF906evQozp49i5UrV+q09+vXD0OGDIGvry8uX76MGTNmoH///jh06BCUSmW5cSIjIzF79uxy7RkZGSgsLKxiVhUTRREqqRAQAUAwyJgVyfFuBsdLfyM9Lg4qe/sa2w9QmlNWVhYkSYJCIfukmkEwJ+PAnIwDczIOhs4pJyen0n1lLUKqa+XKlWjXrh26dOmi0/7KK69o/79du3Zo3749mjVrhri4OPTp06fcOBEREQgPD9c+z87ORuPGjeHi4gI7OzuDxCqKItRCMvIVNoBQc0XILb92cLz0N5TnL8B1jGuN7QcozUkQBLi4uJjULyNzqvuYk3FgTsbB0DlZWlpWuq+sRYizszOUSiXS0tJ02tPS0uDu7v7IbfPy8rBhwwZ88sknj91P06ZN4ezsjISEhAqLEJVKBZVKVa5doVAY9kMmCP8+asidFu2BXzcg/9gx7ZlBNUkQBMO/TzJjTsaBORkH5mQcDJlTVcaQ9R20sLBAQEAAYmNjtW2iKCI2NhZBQUGP3Hbz5s1Qq9V47bXXHrufGzdu4Pbt2/Dw8Kh2zHVdpncLaMwtoLl1C0WXL8sdDhER0UPJXsaFh4dj+fLlWLNmDc6dO4fx48cjLy8PYWFhAICRI0fqLFwts3LlSgwePLjcYtPc3Fy8//77OHz4MK5evYrY2FgMGjQIfn5+CAkJqZWc5CSZm2vPksk7fETmaIiIiB5O9jUhw4cPR0ZGBmbOnInU1FT4+/tj165d2sWq165dKze1c+HCBRw4cAB79uwpN55SqcRff/2FNWvWIDMzE56enujbty/mzJlT4SEXU3SneTs4XziN/CNH4PTaq3KHQ0REVCHZixAAmDhxIiZOnFjha3FxceXaWrZsCekhp7paWVlh9+7dhgzP6Nxu0R4AkH/0KCRRhGBCxy2JiMh08NvJBGU3aQaFtTU0WVlQX7ggdzhEREQVYhFigiSlGaw6BwAA8o5wXQgREdVNLEJMVIPAQABA/pGH3wyQiIhITixCTJR14FMA7q0LKS6WORoiIqLyWISYKMvWT0Dp6AgxLw8Fp0/LHQ4REVE5LEJMlKBQoEG3bgCA3AMHZI6GiIioPBYhJqxB99IiJO8PFiFERFT3sAgxUV/FXMQPmtLL1Bf+/TcWbeUCVSIiqltYhJiwIjtHZDfyBQA0PB8vbzBEREQPYBFi4m616ggAcD53SuZIiIiIdLEIMXG3nrhXhJyPhySKMkdDRET0LxYhJu5u0ydQYmEJVU4mCs+dkzscIiIiLRYhJk4yM8ftlh0AALkV3AyQiIhILixC6oH0dl0AALm//S5zJERERP9iEVIPZLTpDEkQUPj33yhOTZU7HCIiIgAsQuqFIjsHZPq0AMBDMkREVHewCKkn0tuWHpLJ+e03mSMhIiIqxSKknkhvHwgAyD90GGJenszREBERsQipN/LcGsHcuwmk4mLkHjwodzhEREQsQuoNQYBt72cAALmxsTIHQ0RExCKkXrF9NhgAkBP7G8SiIpmjISKi+o5FSD2y9FYDFNo7QczNxfpvN+GrmItyh0RERPUYi5D6RKFAasduAAD3U1wXQkRE8mIRUs+UFSGuZ45CUcxDMkREJB8WIfVMpk9LFDg0hHlhPhqePyV3OEREVI/ViSJk0aJF8PHxgaWlJQIDA3H06NGH9o2OjoYgCDoPS0tLnT6SJGHmzJnw8PCAlZUVgoODcenSpZpOwzgoFEjz7woA8DjJQzJERCQf2YuQjRs3Ijw8HLNmzcLJkyfRoUMHhISEID09/aHb2NnZISUlRftISkrSeX3evHn4+uuvsWTJEhw5cgQNGjRASEgICgsLazodo5DaqTsAwPXMEYh8T4iISCayFyELFizAmDFjEBYWhtatW2PJkiWwtrbGqlWrHrqNIAhwd3fXPtzc3LSvSZKEqKgofPjhhxg0aBDat2+PtWvXIjk5Gdu3b6+FjOq+TO8WKHB0hpm6ELn79ssdDhER1VNmcu68qKgIJ06cQEREhLZNoVAgODgYhw4deuh2ubm58Pb2hiiK6NSpE+bOnYs2bdoAABITE5Gamorg4GBtf3t7ewQGBuLQoUN45ZVXyo2nVquhVqu1z7OzswEAoihCFMVq51k2FiSp9CE3QUBKpx5oGrsNWdu3w+bZ4MdvUwFRFCFJksHeo7qAORkH5mQcmJNxMHROVRlH1iLk1q1b0Gg0OjMZAODm5obz589XuE3Lli2xatUqtG/fHllZWfjyyy/RtWtX/P3332jUqBFS792qvqIxUx9yG/vIyEjMnj27XHtGRobBDuGIogiVVAiIACAYZMzquNP5KTSN3Ybc/fuRevEiFA4OVR5DFEVkZWVBkiQoFLJPqhkEczIOzMk4MCfjYOiccnJyKt1X1iJEH0FBQQgKCtI+79q1K5544gksXboUc+bM0WvMiIgIhIeHa59nZ2ejcePGcHFxgZ2dXbVjBkp/yGohGfkKG0CQvwjJ92qJrCZ+sL+WANWRI3B8/fUqjyGKIgRBgIuLi0n9MjKnuo85GQfmZBwMndODJ4s8iqxFiLOzM5RKJdLS0nTa09LS4O7uXqkxzM3N0bFjRyQkJACAdru0tDR4eHjojOnv71/hGCqVCiqVqly7QqEw7IdMEP591AE3uzwD+2sJyNqxAw1DQ/UaQxAEw79PMmNOxoE5GQfmZBwMmVNVxpD1HbSwsEBAQABi77uhmiiKiI2N1ZnteBSNRoMzZ85oCw5fX1+4u7vrjJmdnY0jR45Uesz6IqVzD8DcHOp/zqHwAi/hTkREtUv2Mi48PBzLly/HmjVrcO7cOYwfPx55eXkICwsDAIwcOVJn4eonn3yCPXv24MqVKzh58iRee+01JCUl4c033wRQWs1NmTIFn376Kf7v//4PZ86cwciRI+Hp6YnBgwfLkWKdVdzADra9egIAsnjmEBER1TLZ14QMHz4cGRkZmDlzJlJTU+Hv749du3ZpF5Zeu3ZNZ2rn7t27GDNmDFJTU+Ho6IiAgAD8+eefaN26tbbPtGnTkJeXh7FjxyIzMxPdu3fHrl27qnScqr6wHzwYOTF7kfXTT3ANfxeCubncIRERUT0hSFJdOGe0bsnOzoa9vT2ysrIMujB1+e5TyFfWjYWpZab08sWl3s9Ac+sWvKKiYNcvpNLbiqKI9PR0uLq6msyxUeZkHJiTcWBOxsHQOVXlO9Q03kHSm2BuDoehLwEA7m7YIHM0RERUn7AIITgOGwYoFMg/fBjqK4lyh0NERPUEi5B67quYi/j271yktw4AAPw2b7HMERERUX3BIoQAANe69wcAeB35DWJBgczREBFRfcAihAAAt57oiPyGbjAvyEP2zl/lDoeIiOoBFiFUSqHA9e79AAB31q0DT5oiIqKaxiKEtG4EPYsSC0uoz59H/iPuYkxERGQILEJIq7iBLW4EBQMAbq9aLXM0RERk6liEkI6kXi8ACgXyDhxA4YULcodDREQmjEUI6ShwdoNtSF8AwB3OhhARUQ1iEULlNHzjDQBA1i+/oDg1VeZoiIjIVLEIoXKs2rWD9ZNPAiUluL1ipdzhEBGRiWIRQhVynvA2ACBz0yYUp6XJHA0REZkiFiFUIevAQFh1DoBUVITby5bLHQ4REZkgFiFUIUEQ4DJxIgDOhhARUc1gEUIPZR0YCOvOnSEVF+P20mVyh0NERCbGTO4AqO75Kuai9v+dggahy/HjuL1xE5zCRsGicWMZIyMiIlPCmRB6pDvN2+FWK38oNCXI+OorucMhIiITwiKEHk0QcGHQKEiCgOydv6IgPl7uiIiIyESwCKHHymnki5uBzwAA0ub9l3fYJSIig2ARQpVyacCrECwtUXDyJHL2xMgdDhERmQAWIVQpaoeGuNTrBQBAwsef4uuf/8LCvZdkjoqIiIwZixCqtMTgl1Dg5Aqruxlotmuj3OEQEZGRYxFClaZRWeKfoW8CAHx+2wGblGsyR0RERMaMRQhVSUa7QKS16wKFqEHrTUu5SJWIiPTGIoSq7NzQMSixUMHp8t8o+uknucMhIiIjVSeKkEWLFsHHxweWlpYIDAzE0aNHH9p3+fLl6NGjBxwdHeHo6Ijg4OBy/UeNGgVBEHQe/fr1q+k06o1CJ1dcGvAqACD/u8UounFD5oiIiMgYyV6EbNy4EeHh4Zg1axZOnjyJDh06ICQkBOnp6RX2j4uLw4gRI/D777/j0KFDaNy4Mfr27YubN2/q9OvXrx9SUlK0jx9//LE20qk3knoNxJ1mrYHCQqT+50NIoih3SEREZGRkL0IWLFiAMWPGICwsDK1bt8aSJUtgbW2NVatWVdj/hx9+wNtvvw1/f3+0atUKK1asgCiKiI2N1emnUqng7u6ufTg6OtZGOvWHQoEz/+8dwNISBceO4e7338sdERERGRlZb2BXVFSEEydOICIiQtumUCgQHByMQ4cOVWqM/Px8FBcXw8nJSac9Li4Orq6ucHR0xDPPPINPP/0UDRs2rHAMtVoNtVqtfZ6dnQ0AEEURooH+whdFEZCk0oeJKHB2h9W4cShYuBDpX86HZefOsGzVSu6wqkUURUiSZLCfe13AnIwDczIOzKly41WWrEXIrVu3oNFo4ObmptPu5uaG8+fPV2qMDz74AJ6enggODta29evXD0OGDIGvry8uX76MGTNmoH///jh06BCUSmW5MSIjIzF79uxy7RkZGSgsLKxiVhUTRREqqRAQAUAwyJjykxDXuA38Wvuj4T/xODduAk6Fz8HzQX5yB6Y3URSRlZUFSZKgUMg+UWgQzMk4MCfjwJweLycnp9J9ZS1Cquvzzz/Hhg0bEBcXB0tLS237K6+8ov3/du3aoX379mjWrBni4uLQp0+fcuNEREQgPDxc+zw7OxuNGzeGi4sL7OzsDBKrKIpQC8nIV9gAgokUIZIESED8a++i67xwWGekwnfLWri8sBiCkeYoiiIEQYCLi4tJ/QPDnOo+5mQcmNPj3f99/DiyFiHOzs5QKpVIS0vTaU9LS4O7u/sjt/3yyy/x+eefY+/evWjfvv0j+zZt2hTOzs5ISEiosAhRqVRQqVTl2hUKhWE/ZILw78NUCAKKbexxOux9dFk4A54n/kD2pk1wHDFC7sj0JgiC4X/2MmNOxoE5GQfm9GhVGUPWd9DCwgIBAQE6i0rLFpkGBQU9dLt58+Zhzpw52LVrFzp37vzY/dy4cQO3b9+Gh4eHQeKm8jKbPoFLA18HAKR+Nhd5h4/IHBEREdV1spdx4eHhWL58OdasWYNz585h/PjxyMvLQ1hYGABg5MiROgtXv/jiC3z00UdYtWoVfHx8kJqaitTUVOTm5gIAcnNz8f777+Pw4cO4evUqYmNjMWjQIPj5+SEkJESWHOuLxD4vIrnz00BJCW5MnoyipCS5QyIiojpM9iJk+PDh+PLLLzFz5kz4+/sjPj4eu3bt0i5WvXbtGlJSUrT9Fy9ejKKiIgwdOhQeHh7ax5dffgkAUCqV+Ouvv/DCCy+gRYsWGD16NAICAvDHH39UeMiFDEgQcHbERFi2bw8xKwvXx78Nzb0zjYiIiB5UJxamTpw4ERMnTqzwtbi4OJ3nV69efeRYVlZW2L17t4Eio6oSLVRo9O03uPryMBRduYIbb09A4xXLoajCQiUiIqofZJ8JIdPz7elM7Bs1HcWW1sg/fhx/vDYWUbv+kTssIiKqY1iEUI3IadQUJ8d9CI25BVzPHkPbH77hpd2JiEgHixCqMXf92iD+jQ8gKpTwOhaHlA8/gqTRyB0WERHVEXViTQiZroy2nfHXyCnosOYrZG3dinPXbuHMa1Mg3bty7bvPtpA5QiIikgtnQqjGpQY8jfiwqRAVSnge348Oq/8LobhY7rCIiEhmLEKoVqR17IZTb06HaGYG99OH8OR3s2CeV/n7CxARkelhEUK1JqNdF5wY9xGKLa3hlPA3Ahd8gKJr1+QOi4iIZMIihGrV7Vb+OPLu5yhwdIZN+k1cHf4K8g4fljssIiKSAYsQqnW5nt44/N5/kdW4GTR37+LaG6Nxa8lSnsJLRFTPsAghWajtnXBkSiRuPNUHEEVkREVh/7BR+Hb7cblDIyKiWsIihGQjWqhw9tVJOPP/JkJjZg7Xs8fQ/bN3kPP773KHRkREtYBFCMnuZtCzOBw+DznujaHKycSN8W8j+T//gSaHZ88QEZkyFiFUJ+Q0bopD0xYg8ZnBgCAg639bcfm555D100+QJEnu8IiIqAawCKE6QzS3wIUXw3Bk0mfIc/WEJuMWkt+fhj8HvozCixflDo+IiAyMRQjVOXf92uDA9K9xceDr0JhbwCnhbyQOfhHJETNQfPOm3OEREZGBsAihOkkyN8eVvkPxx4eLkOofBIgisrZtw+V+/ZH62VwUp6fLHSIREVUTixCq0wqdXBE/ejoOvTcPt1u0h1RcjLvr1uHiM32wJ+wdqK9ckTtEIiLSE4sQMgpZPi1x7J05ODZhNu42fQKKkhI0PrQXVwY8j+tvT0DuHwd4sTMiIiNjJncARFVxu5U/brfyh8OVc/Dduw1uZ44g97ffkPvbbzD38oLDy0Nh/+IQmLu5yh0qERE9BmdCyChlNn0Cp8bOQNOdv8Dx9dehsLND8c2byIhaiITevZEUFoa7mzah5O5duUMlIqKH4EwIGbXvLpcAXYZC4T8Q7vF/ovHB3XC8cg75hw4j/9BhJH/8CW638ke7Yc/D5umnYe7pKXfIRER0D4sQMgmihQrJXXojuUtvWN1Kg/upA/A4+QfsbiTC5Z8TSP34BABA1dwPDZ5+GjbdusHK3x8Ka2uZIyciqr9YhJDJKXB2Q+KzLyHx2ZfQIO0G3E4fRofkf1Bw6hTUlxKgvpSAOytXAWZmsGrTBtZPdoZV586w7tgRgq2t3OETEdUbLELIpOW5NcKVvkNxBYD5yzloeP4UXP4+AadLZ2CVeRsFp0+j4PRpYMVKAIC5jw+E5s2hnjwJVn5+8gZPRGTiWIRQvVHcwBapAU8jNeBpQJJgdScdr1jeRv7x4yg4dhxFSUkovnoVuHoVwpTJcodLRGTyWIRQ/SQIKGjohtVwA3q2BnqOhHleNuyvXkLDa+ew61IRcOXR96t599kWtRQsEZFpqhOn6C5atAg+Pj6wtLREYGAgjh49+sj+mzdvRqtWrWBpaYl27dph586dOq9LkoSZM2fCw8MDVlZWCA4OxqVLl2oyBTIBxQ3scKt1J1x/dhCgePyvxlcxFyt8EBFR5cg+E7Jx40aEh4djyZIlCAwMRFRUFEJCQnDhwgW4upa/4NSff/6JESNGIDIyEs8//zzWr1+PwYMH4+TJk2jbti0AYN68efj666+xZs0a+Pr64qOPPkJISAj++ecfWFpa1naKVM9UthDhTAoR1XeCJEmSnAEEBgbiySefxLfffgsAEEURjRs3xjvvvIPp06eX6z98+HDk5eXh559/1rY99dRT8Pf3x5IlSyBJEjw9PfHee+9h6tSpAICsrCy4ubkhOjoar7zyymNjys7Ohr29PbKysmBnZ2eQPEVRxPLdp5CvtAEEwSBjyk6SYK3JZU4yqWwRI4oi0tPT4erqCkUlZniMAXMyDszJOBg6p6p8h8o6E1JUVIQTJ04gIiJC26ZQKBAcHIxDhw5VuM2hQ4cQHh6u0xYSEoLt27cDABITE5Gamorg4GDt6/b29ggMDMShQ4cqLELUajXUarX2eVZWFgAgMzMTooHuRyKKIgryclCokOr8l1ulSRIEMZc5ySRy24nKdZQkWIm5KFDcqPGcxvduVqPjlxFFEdnZ2bCwsDCpLwLmVPcxp8fLzs4GULo04nFkLUJu3boFjUYDNzc3nXY3NzecP3++wm1SU1Mr7J+amqp9vaztYX0eFBkZidmzZ5dr9/b2rlwiRAQAmCF3AERUZ+Tk5MDe3v6RfWRfE1IXRERE6MyuiKKIO3fuoGHDhhAM9JdjdnY2GjdujOvXrxvsEI/cmJNxYE7GgTkZB+b0eJIkIScnB56VuE2GrEWIs7MzlEol0tLSdNrT0tLg7u5e4Tbu7u6P7F/237S0NHh4eOj08ff3r3BMlUoFlUql0+bg4FCVVCrNzs7OZD64ZZiTcWBOxoE5GQfm9GiPmwEpI+sBLQsLCwQEBCA2NlbbJooiYmNjERQUVOE2QUFBOv0BICYmRtvf19cX7u7uOn2ys7Nx5MiRh45JREREtU/2wzHh4eEIDQ1F586d0aVLF0RFRSEvLw9hYWEAgJEjR8LLywuRkZEAgMmTJ6Nnz56YP38+BgwYgA0bNuD48eNYtmwZAEAQBEyZMgWffvopmjdvrj1F19PTE4MHD5YrTSIiInqA7EXI8OHDkZGRgZkzZyI1NRX+/v7YtWuXdmHptWvXdFbrdu3aFevXr8eHH36IGTNmoHnz5ti+fbv2GiEAMG3aNOTl5WHs2LHIzMxE9+7dsWvXLlmvEaJSqTBr1qxyh32MGXMyDszJODAn48CcDEv264QQERFR/WQaJzkTERGR0WERQkRERLJgEUJERESyYBFCREREsmARUksWLVoEHx8fWFpaIjAwEEePHpU7JL3t378fAwcOhKenJwRB0N63x5hFRkbiySefhK2tLVxdXTF48GBcuHBB7rCqZfHixWjfvr32AkRBQUH49ddf5Q7LYD7//HPtKfnG7OOPP4YgCDqPVq1ayR1Wtd28eROvvfYaGjZsCCsrK7Rr1w7Hjx+XOyy9+fj4lPs5CYKACRMmyB2a3jQaDT766CP4+vrCysoKzZo1w5w5cyp1zxdDYRFSCzZu3Ijw8HDMmjULJ0+eRIcOHRASEoL09HS5Q9NLXl4eOnTogEWLFskdisHs27cPEyZMwOHDhxETE4Pi4mL07dsXeXl5coemt0aNGuHzzz/HiRMncPz4cTzzzDMYNGgQ/v77b7lDq7Zjx45h6dKlaN++vdyhGESbNm2QkpKifRw4cEDukKrl7t276NatG8zNzfHrr7/in3/+wfz58+Ho6Ch3aHo7duyYzs8oJiYGAPDyyy/LHJn+vvjiCyxevBjffvstzp07hy+++ALz5s3DN998U3tBSFTjunTpIk2YMEH7XKPRSJ6enlJkZKSMURkGAGnbtm1yh2Fw6enpEgBp3759codiUI6OjtKKFSvkDqNacnJypObNm0sxMTFSz549pcmTJ8sdUrXMmjVL6tChg9xhGNQHH3wgde/eXe4watTkyZOlZs2aSaIoyh2K3gYMGCC98cYbOm1DhgyRXn311VqLgTMhNayoqAgnTpxAcHCwtk2hUCA4OBiHDh2SMTJ6lKysLACAk5OTzJEYhkajwYYNG5CXl2f0ty+YMGECBgwYoPM7ZewuXboET09PNG3aFK+++iquXbsmd0jV8n//93/o3LkzXn75Zbi6uqJjx45Yvny53GEZTFFREb7//nu88cYbBrvJqRy6du2K2NhYXLx4EQBw+vRpHDhwAP3796+1GGS/Yqqpu3XrFjQajfYKsGXc3Nxw/vx5maKiRxFFEVOmTEG3bt10rsRrjM6cOYOgoCAUFhbCxsYG27ZtQ+vWreUOS28bNmzAyZMncezYMblDMZjAwEBER0ejZcuWSElJwezZs9GjRw+cPXsWtra2coenlytXrmDx4sUIDw/HjBkzcOzYMUyaNAkWFhYIDQ2VO7xq2759OzIzMzFq1Ci5Q6mW6dOnIzs7G61atYJSqYRGo8Fnn32GV199tdZiYBFC9IAJEybg7NmzRn9cHgBatmyJ+Ph4ZGVlYcuWLQgNDcW+ffuMshC5fv06Jk+ejJiYGFlvwWBo9//V2b59ewQGBsLb2xubNm3C6NGjZYxMf6IoonPnzpg7dy4AoGPHjjh79iyWLFliEkXIypUr0b9//0rdqr4u27RpE3744QesX78ebdq0QXx8PKZMmQJPT89a+zmxCKlhzs7OUCqVSEtL02lPS0uDu7u7TFHRw0ycOBE///wz9u/fj0aNGskdTrVZWFjAz88PABAQEIBjx45h4cKFWLp0qcyRVd2JEyeQnp6OTp06ads0Gg3279+Pb7/9Fmq1GkqlUsYIDcPBwQEtWrRAQkKC3KHozcPDo1yh+8QTT+B///ufTBEZTlJSEvbu3YutW7fKHUq1vf/++5g+fTpeeeUVAEC7du2QlJSEyMjIWitCuCakhllYWCAgIACxsbHaNlEUERsba/TH5k2JJEmYOHEitm3bht9++w2+vr5yh1QjRFGEWq2WOwy99OnTB2fOnEF8fLz20blzZ7z66quIj483iQIEAHJzc3H58mV4eHjIHYreunXrVu4U94sXL8Lb21umiAxn9erVcHV1xYABA+QOpdry8/N1bhALAEqlEqIo1loMnAmpBeHh4QgNDUXnzp3RpUsXREVFIS8vD2FhYXKHppfc3Fydv9ISExMRHx8PJycnNGnSRMbI9DdhwgSsX78eO3bsgK2tLVJTUwEA9vb2sLKykjk6/URERKB///5o0qQJcnJysH79esTFxWH37t1yh6YXW1vbcmt0GjRogIYNGxr12p2pU6di4MCB8Pb2RnJyMmbNmgWlUokRI0bIHZre3n33XXTt2hVz587FsGHDcPToUSxbtgzLli2TO7RqEUURq1evRmhoKMzMjP/rc+DAgfjss8/QpEkTtGnTBqdOncKCBQvwxhtv1F4QtXYeTj33zTffSE2aNJEsLCykLl26SIcPH5Y7JL39/vvvEoByj9DQULlD01tF+QCQVq9eLXdoenvjjTckb29vycLCQnJxcZH69Okj7dmzR+6wDMoUTtEdPny45OHhIVlYWEheXl7S8OHDpYSEBLnDqraffvpJatu2raRSqaRWrVpJy5Ytkzukatu9e7cEQLpw4YLcoRhEdna2NHnyZKlJkyaSpaWl1LRpU+k///mPpFaray0GQZJq8dJoRERERPdwTQgRERHJgkUIERERyYJFCBEREcmCRQgRERHJgkUIERERyYJFCBEREcmCRQgRERHJgkUIERERyYJFCBEREcmCRQgRERHJgkUIERERyYJFCBEZhYyMDLi7u2Pu3Lnatj///BMWFhaIjY2VMTIi0hdvYEdERmPnzp0YPHgw/vzzT7Rs2RL+/v4YNGgQFixYIHdoRKQHFiFEZFQmTJiAvXv3onPnzjhz5gyOHTsGlUold1hEpAcWIURkVAoKCtC2bVtcv34dJ06cQLt27eQOiYj0xDUhRGRULl++jOTkZIiiiKtXr8odDhFVA2dCiMhoFBUVoUuXLvD390fLli0RFRWFM2fOwNXVVe7QiEgPLEKIyGi8//772LJlC06fPg0bGxv07NkT9vb2+Pnnn+UOjYj0wMMxRGQU4uLiEBUVhXXr1sHOzg4KhQLr1q3DH3/8gcWLF8sdHhHpgTMhREREJAvOhBAREZEsWIQQERGRLFiEEBERkSxYhBAREZEsWIQQERGRLFiEEBERkSxYhBAREZEsWIQQERGRLFiEEBERkSxYhBAREZEsWIQQERGRLP4/tKrP46S/T+QAAAAASUVORK5CYII=", + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + " ➜ Figure saved to plots/exp_pdf.png\n" + ] + } + ], + "source": [ + "def example_exponential_pdf() -> None:\n", + " print(\"=== Example 1: Continuous PDF (AUTO) ===\")\n", + " lam = 2.0\n", + "\n", + " def pdf_func(x: float, **_: Any) -> float:\n", + " return lam * math.exp(-lam * x) if x >= 0 else 0.0\n", + "\n", + " distr = CustomDistribution(\n", + " name=\"Exp(λ=2)\",\n", + " kind=Kind.CONTINUOUS,\n", + " analytical_computations=[\n", + " AnalyticalComputation(target=CharacteristicName.PDF, func=pdf_func),\n", + " ],\n", + " sampling_strategy=DefaultUnuranSamplingStrategy(),\n", + " )\n", + "\n", + " data = distr.sample(30_000).array.flatten()\n", + " print(f\"Mean ≈ {data.mean():.4f} (expected {1/lam:.4f})\")\n", + " print(f\"Std ≈ {data.std():.4f} (expected {1/lam:.4f})\")\n", + "\n", + " xs = np.linspace(0, 4 / lam, 400)\n", + " pdf_vals = np.array([pdf_func(x) for x in xs])\n", + " _plot_continuous_pdf(\"Exponential distribution (PDF)\", xs, pdf_vals, data, \"exp_pdf.png\")\n", + "\n", + "\n", + "example_exponential_pdf()" + ] + }, + { + "cell_type": "markdown", + "id": "4db66fe6", + "metadata": {}, + "source": [ + "### Example 2 – Exponential CDF with NINV\n", + "Goal: show how DefaultUnuranSamplingStrategy can work from an analytical CDF using method NINV.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "ecf2aaec", + "metadata": { + "name": "example2" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "=== Example 2: CDF sampling with NINV ===\n", + "Mean ≈ 0.6630 (expected 0.6667)\n", + "Std ≈ 0.6647 (expected 0.6667)\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAhgAAAGJCAYAAADIVkprAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjgsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvwVt1zgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAXKZJREFUeJzt3XlcFPX/B/DX7sIuN3KDCIL3haCg5pWaKJpadpqZApVZSWqkmabikZodhpZpatql5ZF9tbzyyCOPVBR/5n0hKHIp97Xszvz+ILZWFuVYdmR5PR8PHjWf/czse94szns/85kZmSiKIoiIiIiMSC51AERERGR+WGAQERGR0bHAICIiIqNjgUFERERGxwKDiIiIjI4FBhERERkdCwwiIiIyOhYYREREZHQsMIiIiMjoWGAQmbnevXujd+/e1VpXJpNh5syZ1Vp33759kMlk2Ldvn64tIiICfn5+1dpeVfn5+SEiIkK3/M0330Amk+HEiRMmef+a5N0Y1q9fD2dnZ+Tl5UkWgyF37tyBra0ttm3bJnUoVMtYYFCdUHZwqOjn6NGjUocoqXPnzmHmzJlISEiQOhSje5j37WGNTavVIiYmBm+99Rbs7OzKvbZ69Wr07t0bzs7OUKlU8PPzQ2RkpF7xde/fnJWVFRo2bIiwsDAsXrwYubm55d535syZFf6NLlu2DADg4uKCV199FdOnT6/dJJDkLKQOgKgqZs+eDX9//3LtzZo1kyCah8e5c+cwa9Ys9O7du9wIwe+//y5NUAasWLECgiBUaZ377dv9XLx4EXJ57X6Heljz/uuvv+LixYt47bXX9NoLCwvx9NNPY8eOHXj00UcxdepUODs7IyEhAevXr8e3336LxMRENGrUSLdO2d9cSUkJUlJSsG/fPkyYMAELFy7Eli1b0L59+3Lvv3Tp0nKFTZcuXXT///rrr2Px4sXYu3cvHnvsMSPvPT0sWGBQnTJw4ECEhIRIHUadolQqpQ5Bx9LSsla3L4oiioqKYG1tDZVKVavv9SBS5n316tXo3r07vL299donTZqEHTt24LPPPsOECRP0XouJicFnn31Wblv3/s1NmTIFe/fuxeDBg/HEE0/g/PnzsLa21lvn2Wefhaura4XxtW7dGu3atcM333zDAsOM8RQJmZWYmBjI5XLs2bNHr/21116DUqnE6dOnAfw7P2DdunWYOnUqPD09YWtriyeeeAJJSUnltrthwwYEBwfD2toarq6ueOmll3Dr1i29PhEREbCzs8OtW7cwdOhQ2NnZwc3NDRMnToRWq9XrKwgCYmNj0bZtW1hZWcHDwwNjxoxBZmamXj8/Pz8MHjwYf/75Jzp37gwrKys0adIE3333na7PN998g+eeew4A0KdPH92QdNnch3vnAqjVasyYMQPBwcFwdHSEra0tevbsiT/++KNqyf6PmzdvYujQobC1tYW7uzvefvttFBcXl+tnaA7GTz/9hODgYNjb28PBwQEBAQFYtGhRpfatLD87d+5ESEgIrK2t8dVXX+le++8cjDIFBQUYM2YMXFxc4ODggFGjRpXLe0VzT/67zarmHQDS0tLwyiuvwMPDA1ZWVggMDMS3336r1ychIQEymQyffPIJli9fjqZNm0KlUqFTp044fvx4uZjuVVRUhB07diA0NFSv/ebNm/jqq6/Qr1+/csUFACgUCkycOFFv9KIijz32GKZPn44bN27ghx9+eGB/Q/r164dff/0VfKC3+WKBQXVKdnY2MjIy9H7u3Lmje33atGkICgrCK6+8ojtHvHPnTqxYsQIzZsxAYGCg3vbmzp2LrVu3YvLkyRg3bhx27dqF0NBQFBYW6vp88803eP7556FQKDB//nyMHj0amzZtQo8ePZCVlaW3Pa1Wi7CwMLi4uOCTTz5Br1698Omnn2L58uV6/caMGYNJkyahe/fuWLRoESIjI7FmzRqEhYWhpKREr++VK1fw7LPPol+/fvj000/h5OSEiIgInD17FgDw6KOPYty4cQCAqVOn4vvvv8f333+P1q1bG8xhTk4OVq5cid69e2PBggWYOXMm0tPTERYWhvj4+Mr/Mv5RWFiIvn37YufOnYiKisL777+PgwcP4t13333gurt27cLw4cPh5OSEBQsW4MMPP0Tv3r1x6NChSu/bxYsXMXz4cPTr1w+LFi1CUFDQfd8zKioK58+fx8yZMzFq1CisWbMGQ4cOrfKBrqp5LywsRO/evfH9999jxIgR+Pjjj+Ho6IiIiAhdQfVfa9euxccff4wxY8bggw8+QEJCAp5++ulyn497xcXFQa1Wo2PHjnrt27dvh0ajwciRI6u0nxUp246hU0F3797V+xu9t4ADgODgYGRlZek+x2SGRKI6YPXq1SIAgz8qlUqv75kzZ0SlUim++uqrYmZmpujt7S2GhISIJSUluj5//PGHCED09vYWc3JydO3r168XAYiLFi0SRVEU1Wq16O7uLrZr104sLCzU9fvtt99EAOKMGTN0beHh4SIAcfbs2XrxdOjQQQwODtYtHzx4UAQgrlmzRq/fjh07yrU3btxYBCAeOHBA15aWliaqVCrxnXfe0bVt2LBBBCD+8ccf5XLXq1cvsVevXrpljUYjFhcX6/XJzMwUPTw8xJdfflmvHYAYExNTbpv/FRsbKwIQ169fr2vLz88XmzVrVi6m8PBwsXHjxrrl8ePHiw4ODqJGo6lw+/fbt7L87Nixw+Br4eHhuuWyz1BwcLCoVqt17R999JEIQNy8efMD9/vebVYl72V5+uGHH3RtarVa7Nq1q2hnZ6f7HF6/fl0EILq4uIh3797V9d28ebMIQPz111/Lvdd/rVy5UgQgnjlzRq/97bffFgGIp06duu/6Zcrydfz48Qr7ODo6ih06dNAtx8TEGPwb/e/vvMzhw4dFAOK6desqFQ/VPRzBoDplyZIl2LVrl97P9u3b9fq0a9cOs2bNwsqVKxEWFoaMjAx8++23sLAoP+Vo1KhRsLe31y0/++yz8PLy0l1Cd+LECaSlpeHNN9+ElZWVrt+gQYPQqlUrbN26tdw2X3/9db3lnj174tq1a7rlDRs2wNHREf369dP7lhccHAw7O7typyratGmDnj176pbd3NzQsmVLvW1WhUKh0M0PEAQBd+/ehUajQUhICE6ePFnl7W3btg1eXl549tlndW02NjblJhga0qBBA+Tn52PXrl1Vft8y/v7+CAsLq3T/1157TW8uyBtvvAELC4tav2xy27Zt8PT0xPDhw3VtlpaWGDduHPLy8rB//369/sOGDYOTk5Nuuewz8KDfe9mI3n/XBUpHrgDofd5rys7OzuDVJD///LPe3+iaNWvK9SmLLyMjw2jx0MOFkzypTuncuXOlJnlOmjQJP/30E44dO4Z58+ahTZs2Bvs1b95cb1kmk6FZs2a6yw5v3LgBAGjZsmW5dVu1aoU///xTr83Kygpubm56bU5OTnpDxJcvX0Z2djbc3d0NxpSWlqa37OvrW67Pvdusqm+//RaffvopLly4oDfkbugKnQe5ceMGmjVrBplMptduKGf3evPNN7F+/XoMHDgQ3t7e6N+/P55//nkMGDCg0u9f1Zjv/Z3b2dnBy8ur1i81vXHjBpo3b17uypayUypln7Uy9/7eyw7Ilf29i/ec8nFwcAAAgwVBdeXl5Rn8HD/66KP3neT53/ju/dyQ+WCBQWbp2rVruHz5MgDgzJkzJntfhULxwD6CIMDd3d3gtzoA5QqUirZ57wGksn744QdERERg6NChmDRpEtzd3XXzS65evVqtbVaXu7s74uPjsXPnTmzfvh3bt2/H6tWrMWrUqHKTHyty7xUMteneybq1qbq/dxcXFwClhch/J2y2atUKQOnfw4PmqVTGzZs3kZ2dXe1LxMsKpQcVIlR38RQJmR1BEBAREQEHBwdMnToVP/74IzZt2mSwb1kRUkYURVy5ckV3pUPjxo0BlE4kvNfFixd1r1dF06ZNcefOHXTv3h2hoaHlfu6diFoZVfkWuHHjRjRp0gSbNm3CyJEjERYWhtDQUBQVFVX5fYHSHF29erXcgc9QzgxRKpUYMmQIvvzyS1y9ehVjxozBd999hytXrgAw/jfce3/neXl5uH37tt7VLU5OTuUm8KrVaty+fVuvrSqxNW7cGJcvXy53H5ALFy7oXjeGskLi+vXreu0DBw6EQqGo9lUf9/r+++8BoEqnp/6rLL6KJsVS3ccCg8zOwoULcfjwYSxfvhxz5sxBt27d8MYbbxg81/vdd9/pDRlv3LgRt2/fxsCBAwEAISEhcHd3x7Jly/Quu9y+fTvOnz+PQYMGVTm+559/HlqtFnPmzCn3mkajKXdgqwxbW1sAqNS6Zd+M/1sQ/PXXXzhy5EiV3xcAHn/8cSQnJ2Pjxo26toKCgnJXzhjy3yuAAEAul+tu3FSW76rsW2UsX75c77TQ0qVLodFodL9zoLQIPHDgQLn17h3BqEpsjz/+OFJSUrBu3Tpdm0ajweeffw47Ozv06tWrOrtTTnBwMJRKZblbovv4+GD06NH4/fff8fnnn5dbTxAEfPrpp7h58+YD32Pv3r2YM2cO/P39MWLEiGrFGRcXB0dHR7Rt27Za69PDj6dIqE7Zvn277hvff3Xr1g1NmjTB+fPnMX36dERERGDIkCEASi8zDQoK0p3v/y9nZ2f06NEDkZGRSE1NRWxsLJo1a4bRo0cDKJ2Et2DBAkRGRqJXr14YPnw4UlNTsWjRIvj5+eHtt9+u8j706tULY8aMwfz58xEfH4/+/fvD0tISly9fxoYNG7Bo0SK9CZOVERQUBIVCgQULFiA7OxsqlQqPPfaYwfPjgwcPxqZNm/DUU09h0KBBuH79OpYtW4Y2bdpU67kVo0ePxhdffIFRo0YhLi4OXl5e+P7772FjY/PAdV999VXcvXsXjz32GBo1aoQbN27g888/R1BQkO6bbVX2rTLUajX69u2L559/HhcvXsSXX36JHj164IknntCL6/XXX8czzzyDfv364fTp09i5c2e54fyqxPbaa6/hq6++QkREBOLi4uDn54eNGzfi0KFDiI2NNdrkSysrK/Tv3x+7d+/G7Nmz9V779NNPcfXqVYwbNw6bNm3C4MGD4eTkhMTERGzYsAEXLlzACy+8oLdO2d+cRqNBamoq9u7di127dqFx48bYsmWL3uTnqti1axeGDBnCORjmTMIrWIgq7X6XqQIQV69eLWo0GrFTp05io0aNxKysLL31Fy1apHdJXNllqj/++KM4ZcoU0d3dXbS2thYHDRok3rhxo9z7r1u3TuzQoYOoUqlEZ2dnccSIEeLNmzf1+oSHh4u2trbl1i27dO9ey5cvF4ODg0Vra2vR3t5eDAgIEN99910xOTlZ16dx48bioEGDyq177yWQoiiKK1asEJs0aSIqFAq9Syfv7SsIgjhv3jyxcePGokqlEjt06CD+9ttv5S4hFcXKXaYqiqJ448YN8YknnhBtbGxEV1dXcfz48brLbu93merGjRvF/v37i+7u7qJSqRR9fX3FMWPGiLdv367UvlWUn7LXDF2mun//fvG1114TnZycRDs7O3HEiBHinTt39NbVarXi5MmTRVdXV9HGxkYMCwsTr1y5Um6b94vN0O8oNTVVjIyMFF1dXUWlUikGBASIq1ev1utTdpnqxx9/XG6fKvv72LRpkyiTycTExMRyr2k0GnHlypViz549RUdHR9HS0lJs3LixGBkZqXcJ671/c0qlUvT09BT79esnLlq0SO/y7jJln/X09PT7xnf+/HkRgLh79+4H7gvVXTJR5G3UqP7Zt28f+vTpgw0bNlR5tIDoYafVatGmTRs8//zzBk/FSW3ChAk4cOAA4uLiOIJhxjgHg4jIzCgUCsyePRtLlix5KB/XvnLlSnzwwQcsLswc52AQEZmhYcOGYdiwYVKHUY6Li8tDV/RQ7eAIBhERERkd52AQERGR0XEEg4iIiIyOBQYREREZXb2b5CkIApKTk2Fvb88ZzERERFUgiiJyc3PRsGHDcg/uu1e9KzCSk5Ph4+MjdRhERER1VlJSkt7D9AypdwVG2e14k5KSdI8vrilBEJCeng43N7cHVnRUM8y16TDXpsE8mw5zXXM5OTnw8fGp1K3t612BUXZaxMHBwagFRlFRERwcHPihrWXMtekw16bBPJsOc208lZliwAwTERGR0bHAICIiIqNjgUFERERGxwKDiIiIjI4FBhERERkdCwwiIiIyOhYYREREZHSSFhgHDhzAkCFD0LBhQ8hkMvzvf/974Dr79u1Dx44doVKp0KxZM3zzzTe1HicRERFVjaQFRn5+PgIDA7FkyZJK9b9+/ToGDRqEPn36ID4+HhMmTMCrr76KnTt31nKkREREVBWS3slz4MCBGDhwYKX7L1u2DP7+/vj0008BAK1bt8aff/6Jzz77DGFhYbUVJhFJQBBEAIBcXnrHwBKtgAK1FoIgQiuKuv9qBRGiCDjZKmGnKv0nLbeoBIl3CyAIKO0rlvYBSrfp42QDdwcrAEBOUQku3M6FKIoQAYgiIP7TDyLg62KDRk42uu3GJ2X90we6dcr6NnaxQRM3OwBAfrEGR67eqXD/fF1s0MKj9HbLRRoBe86nQiYz/J3P28karb1K7zys1gg4cCm9wu16OlqhnbcjAEAriNh7Ia3Cvm72KgT5NNAt7zqXWmFfZ1slghs76Zb/uJAGjSAa7NvAxhKd/Jx1y/supkGtEQz2tbeyRNemLrrlg5fTUajWGuxrq7JA92auuuXDVzKQW6wx2NfKUoFeLdx0y0ev3UFWgRrZWdlwzBD17kRpqZDhsVYeuuXjCXdxN19tcLtymQz92vzb92RiJtJyig32BYCwth6694pPykJKdlGFffu2doelovQz8PetbNzMLKywb++WbrCyVAAAziXnIPFuvsF+PZu7wVYlzaG+Tt0q/MiRIwgNDdVrCwsLw4QJEypcp7i4GMXF//7yc3JyAJTeMlYQDH/gq0oQBIiiaLTtUcWY6/sr1mhRoNai8J+ffLUW+cUaFJZoUaIV0K2pC+ytLAGU/mN34kYm1BoBJVoBao0AtVZAUYmAohIt3uzVBDb/5HrXuVRsiLsJrSBCEAHhnwN72UF+2qDWCPjnoLbtzG188cdVCLoiAHrFwIJnAtDjn4PEltPJmL757D1FQ+mBEQAWvxCEwe29AAA7/76NqB/jK9z3D59uh+dDSh9keOz6HbzybVyFfWMGt0Z4Nz8AwLlb2XhhxV8V9p0U1gJv9GoKALiWnoeRXx+rsG9Un6aI7tcCAJCcWYBXvztRYd+Xu/th2qDWEAQBWQUlGP393xX2Hd7ZB3OHtgMA5BWp77vdoUENsfD5QACAukSL0ffp27+NB5a91FG3POb7E6igZsCjzV3xTWQn3fJbP55EXrHhQiCksRPWj3lEtzxxw2lk5Bk+YLdt6IBfo7rrlt//5QwS7xo+sDZxtcXu6Ed1y7N+O4eLKbkG+3o5WuHQ5D665Q+3n0d8UrbBvo7Wljg1/d9jy8LfL+HINcPFodJCjguz//1Cu2TvFey5TxF3+YMBUPxTJK88cA2/nbldYd/TM0J1f5/fHk7AhribFfb9a8pjUNqrAADrjifi2yM3DPbb+86j8HOxrXA7VVWVf3vrVIGRkpICDw8PvTYPDw/k5OSgsLAQ1tbW5daZP38+Zs2aVa49PT0dRUUVV5JVIQgCsrOzIYoi729fy8w51+riEuTcyUbunSx4luRCkZ8PMS8XpzJKcNHVHwUOzsgp0iCvWIvcYi3yirXIU2ux+KnmcLdXAgA+P3gTa+Iq/hb6/YjWaO5W+m18R/xtLD+SXGHf/k1t4WujgSiKOJuYjt3nK/5HNCE5HR6WpYV8UupdXKjgH30ASEm/izSH0n+kMrOykVtk+Bto2etpaaXf0vJyc/Rek8tKv00qZKWjHHm5uUhLK42xKC8XrraWuj5yGSCTATLIABkgqgt1fQvz8tHYSfXPVmX/9CvtDwAW2mJd34KcQjR3Lf13pux1mUyGsu/C1ijR9c3NLkYbD5sK981BoUFaWhoEQUBBXg7aetj8u9F7OFkKuu3mFWvR1rPiA4aLStT1VWuE+/b1sIGuLwC09bT9Z6SnPC9buV7fVu42KCoxfLDxcVDo9W3pZg0ve0vDfR0t9fo2c1HBUWX4b9vDXqnX17+BJZQyw/vnZG2h19fX0RJajS20Gg0UFvqHPlulfryNHOQI8DK8XUuFTK+vl62swr5AaX7LCgwPG6B9w4r73r2TgcJ/RiVcVcJ9+2bdvQOxsHQ/nCy1FfbNy8pEmtbw6EZ15OZW/Ld9L5koVvRxMi2ZTIZffvkFQ4cOrbBPixYtEBkZiSlTpujatm3bhkGDBqGgoMBggWFoBMPHxweZmZl8mmodVNdyLWo0yL6dhqSE2/AtvAMhLR2a9HRsuGOJfWoHZAly5MASOXIViiyUuvW+2zEHbkWl37ZWtBuCTc16Vfge28f1QEvP0qH22N2XsXjvFSgVMlhZKmCrsoCtUgFrpQWUFnIseLqdbgh/17lUbPs7BUqFHJYKGZQWcigt5LCyUMDKUo4nAr2gKM6Fm5sbLqbmIT4pC3K5DAqZDAq5rPTgLi89eHfyc4bbP9+mbmcX4kpaPuQy6PUr+38/Fxs4WJcebHKLSpCRpy7Xt+y/tioFVBal/+BqhdIRkLL3rMzDluqCuvaZrsuY65rLycmBk5MTsrOzH3gMrVMjGJ6enkhN1f92lpqaCgcHB4PFBQCoVCqoVKpy7XK53KgfMJlMZvRtkmEPU67FkhKU3LoFdVISjp+/hVPJeUjLLcLtYhluQ4UUS3vkqEoP6Gu2z4JzcWn1f63tYJxo3tvgNm00RdA29oe1lQi5owOCHF2haaiAi78PHKws4WhtCQdrS9hbWcDeygK+Lra6XEQ91hzj+jaHheLBuQlr54Wwdl4Vvi4IAtLS8iCXy9HWuwHaejeoVE68nWzh7VS5IVlHGxUcbcr/fRoilwOGvwPXfQ/TZ9rcMdc1U5W81akCo2vXrti2bZte265du9C1a1eJIqL6ojArG5dOXcTZC0m4cDsbiTklSBKU+ODAUjQoKi0atrYdhI3N+5QeBe85EtprClHQviMaO6lg4eaGJ+w80VFVCGdHWzi7OMDFrQGcPFzRwN0ZFkpLAM/o1h31z09lKC34jyYRPRwkLTDy8vJw5coV3fL169cRHx8PZ2dn+Pr6YsqUKbh16xa+++47AMDrr7+OL774Au+++y5efvll7N27F+vXr8fWrVul2gUyMzmFalhmpKHk7FkU/X0GaxPU+MGyCe4obSHK5ACsSn9KL0DATRsXOKEESp9GaO/tiFzLLLg4WMHHxRY+nk5o7OsBX39PONpaAXhW9z6eUuwcEZEJSVpgnDhxAn36/DvLNzo6GgAQHh6Ob775Brdv30ZiYqLudX9/f2zduhVvv/02Fi1ahEaNGmHlypW8RJWqRRRFXE++i2OHzuDwhRScyJUjWWGL2H2L0DIrCQCg9u+GjMDSGfk2mmI0EfPQwlaGph4O8PN1RZc3v4aLjxdkMhmaoPIjDURE5k7SAqN379643xxTQ3fp7N27N06dOlWLUZE5EwoLcWb/caz5Kwl7cpW4Y1E2y98eKJ1LiMQGXmjf0A7W7QLwZIt2eNTDFf7tmsLd08VsJhYSEdW2OjUHg6g6Lv99DfnH/oLz0T9QcPQvnHfwwfoebwAWgIVWg2aF6ehoo0FXvwboHNICbrOWQ/7PxOCKp0ASEdH9sMAgsyOKIuKP/o0tu+NxIEPAVWtXPHn1NF4/cxAA0F5ZhKfEZPRu4Yq+fTvCtrEvRyaIiIyMBQaZjYS/L2Pdb8fwaypwU9UAgDNgDchFAYKHF9zD3oFdr15QNmuGz1hQEBHVKhYYVKcJRUXI/f133F2/Ac+6DMAd6waAClBp1egs3MWANh4IHfgIPBoOkTpUIqJ6hQUG1UnH/jqPjdtO4OVdyyDLygIA9GnrgauN22FoSycMfboXHN2c778RIiKqNSwwqM7QaAVs+e0IVh64hnOWzgBcEaR0R5eG1mjw7LOY+9RTUHlxWiYR0cOABQY99IpLtFi77g98FX8HKRZ2gKUzLLQa9NMkI2DyBDQb8ChkCoXUYRIR0X+wwKCH2rX9RzDs1ySkW9gCFnZwKM7DE4o0vDaiL3w7PCl1eEREVAEWGPRQKrp4EWkLPkLR4cNo0Gs8tNZahDvlIzLqcRRYyOHu7i51iEREdB8sMOihcvTMDSz96U9M2PIxrEqKIbOwwIeemWj52pOw8/aCIAgoSEuTOkwiInoAFhj0UMjIKcS8r3Zi0x1LAA3g2GoA3m1YBPeJ70Dp4yN1eEREVEUsMEhSJVoBS7ecxNIjN1EoL33G+eOZ5/Fu1BNo1KubxNEREVF1scAgyZy9lYV3VuzHhSILQG6JZjnJeC/ABn3njIfM0lLq8IiIqAZYYJAkStLSMPuTLbig8oK9Oh9RBWcRPvUVWPn6Sh0aEREZAQsMMrm8Q4eQ/O5kTMrOx/cBgzB2YDs0fykGMrlc6tCIiMhIWGCQyRy4mIpt63Zj1I9zIRNFOLdogY/mvgxVkyZSh0ZEREbGAoNMYs2By5ix9QK0sgbwbtQRz3ZrBo8p70FuZSV1aEREVAtYYFCtEgQR8zacwMpTaYBMjr43T+KFsc/DbegTUodGRES1iAUG1ZpCtRbjl+/D7zeLAACjEg/ivXdfgE1QkLSBERFRrWOBQbUiJbsIr3y5D2eztbDQavBu2iFELoyGpaen1KEREZEJsMCgWnHi1704n6mBvaYIcwviMPjLGMhtbaUOi4iITIQFBhld1qZf0HTu+5jm0QbtOjRHp8VzIFMqpQ6LiIhMiAUGGU1yViGKdu9C8fT3AVHEwEfbwjNmBmQKhdShERGRibHAIKO4lVWI5z7bC+3dbMy2dUP7IY/Bc8YMyGQyqUMjIiIJ8NaJVGPZBSUYsfgPJBcDClEL9wGh8Jw+ncUFEVE9xgKDaqRQrcXLS/choUCEe0EmlthdR9Ds93nbbyKieo6nSKjatIKIcasOIS5dDeuSIizQ/B+CPpjH4oKIiFhgUPUt+OUUdiXkwkLQYF76fvRa9iFkFvxIERERT5FQNRXlF2L3oXMAgEk39mDIZzGQ29hIHBURET0s+HWTqiXz4wX4ZOcvONKkEyIWvw8LFxepQyIioocICwyqElEUkbVhA7J+WgdrmQzhE0dC5e8vdVhERPSQYYFBlSaKIl7/ci+8dh3Ec5DBY/w42PXqJXVYRET0EGKBQZW2eu8F7EwqgkXzUPTztUObMWOkDomIiB5SLDCoUs7czML8368AMjnG3PoTjyyP4Y20iIioQryKhB4or1iDN1ccRIlMjq4pZzF28ktQ2NlJHRYRET3EWGDQfYmiiCnfH0VSsRxuBZn44BFn2AQGSh0WERE95Fhg0H39HJeEX69kQy5oEVMUjyavvSx1SEREVAdwDgbdV8aBw7DUWuHF6wcQtmQybwNORESVwgKDKqROSEDvbz9EUwt7dHhvPCw9PKQOiYiI6gh+HSWDREFA8rRpEIuL0TKwOVyefUbqkIiIqA5hgUHlFKg1GDl/C45fuwOZjQ08Z8/mJalERFQlPEVC5SzaegZ/5lricvCL2BICKBs1kjokIiKqYziCQXoSMvLx9V83AQBRWXFwf+lFiSMiIqK6iAUG6Zm/7ig0kCMk9QKeiQ6HTKGQOiQiIqqDWGCQTtz1DOxMKoJMFDDeoxA2HTpIHRIREdVRkhcYS5YsgZ+fH6ysrNClSxccO3bsvv1jY2PRsmVLWFtbw8fHB2+//TaKiopMFK35EgQR7313BADQ//ZpdJ34usQRERFRXSZpgbFu3TpER0cjJiYGJ0+eRGBgIMLCwpCWlmaw/9q1a/Hee+8hJiYG58+fx9dff41169Zh6tSpJo7c/Ow9cxOXC+WwUxfg3Z6NYOHqKnVIRERUh0laYCxcuBCjR49GZGQk2rRpg2XLlsHGxgarVq0y2P/w4cPo3r07XnzxRfj5+aF///4YPnz4A0c96MECD2/DpBNr8EryEfiHc2InERHVjGSXqarVasTFxWHKlCm6NrlcjtDQUBw5csTgOt26dcMPP/yAY8eOoXPnzrh27Rq2bduGkSNHVvg+xcXFKC4u1i3n5OQAAARBgCAIRtkXQRAgiqLRtmdqmrt3cXflCjyWnw+vcQsAC4uHdl/qeq7rEubaNJhn02Gua64quZOswMjIyIBWq4XHPbef9vDwwIULFwyu8+KLLyIjIwM9evSAKIrQaDR4/fXX73uKZP78+Zg1a1a59vT0dKPN3RAEAdnZ2RBFEfI69qyOnCINNMu/giw/H4oWzVEYEoKiCk5RPQzqcq7rGubaNJhn02Guay43N7fSfevUjbb27duHefPm4csvv0SXLl1w5coVjB8/HnPmzMH06dMNrjNlyhRER0frlnNycuDj4wM3Nzc4ODgYJS5BECCTyeDm5lbnPrSfrfkLvxe0xZsNL+KFyRNg6+kpdUj3VZdzXdcw16bBPJsOc11zVlZWle4rWYHh6uoKhUKB1NRUvfbU1FR4VnCQmz59OkaOHIlXX30VABAQEID8/Hy89tpreP/99w1+YFQqFVQqVbl2uVxu1A+YTCYz+jZr25W0PGw4eweClT08mjaGffduUodUKXUx13UVc20azLPpMNc1U5W8SZZhpVKJ4OBg7NmzR9cmCAL27NmDrl27GlynoKCg3M4p/rkRlCiKtResmVq6/QwEyNA55RxCX3te6nCIiMiMSHqKJDo6GuHh4QgJCUHnzp0RGxuL/Px8REZGAgBGjRoFb29vzJ8/HwAwZMgQLFy4EB06dNCdIpk+fTqGDBmiKzSocm5nF2Lz+QwAckRYpsCmUyepQyIiIjMiaYExbNgwpKenY8aMGUhJSUFQUBB27Nihm/iZmJioN2Ixbdo0yGQyTJs2Dbdu3YKbmxuGDBmCuXPnSrULddbKHWeggRztMq6i95gXpA6HiIjMjEysZ+cWcnJy4OjoiOzsbKNO8kxLS4O7u3udOK+XXViCrrO2owAKLLj7J4Ytny91SJVW13JdlzHXpsE8mw5zXXNVOYYyw/XQvpPXUQAFGuekYFDkk1KHQ0REZqhOXaZKxtEtbieW7tkEdcs2sH3kZanDISIiM8QCo54RCguRuXYt/HKz4P3SZMhkMqlDIiIiM8QCox4RBBGX1v0CMSsLlj4+sO/XT+qQiIjITHEORj2y6+xtDDpnh2UBT8I5IhwyXtpLRES1hAVGPbL0t3ho5QpYWcjR4OmnpQ6HiIjMGAuMeuJccg7is0UoBC3Cg70gt7aWOiQiIjJjLDDqiTW7zwAAuqacRfMXn5E4GiIiMncsMOqBYo0Wv57LAAA87VwMy4YNJY6IiIjMHQuMemDbiQTkwAIuhVkIfb6/1OEQEVE9wAKjHlj3z+mRQTmXYV/Bk2qJiIiMiffBMHOiKOLdYz9gp8YJTzzXhzfWIiIik2CBYeYKT8XD+tJZPGVtjebPfSZ1OEREVE/wFImZy9r0MwDAISwMCjs7iaMhIqL6ggWGGTt56TbeTHXHjsad0eAZ3liLiIhMh6dIzNiG344h3qUpXGQlsA4JkTocIiKqRziCYaaKSrTYdlsDABjS2pWTO4mIyKRYYJipXQf+RrbCCi6FWQh7YYDU4RARUT3DAsNM/bL/PACgvywD1l4eEkdDRET1DQsMM5RfpMahQisAwJPdmkscDRER1UcsMMzQjp3HUaywhGfBXXQa0kfqcIiIqB7iVSRmyOrkXwhJERDgaQsFH8tOREQSYIFhZsSSEjT/fSPmZGai0YoVUodDRET1FE+RmJn8w4ehzcyEwsUFdl0fkTocIiKqp1hgmJn1W48j3doRDgMHQmbBASoiIpIGj0BmJC09Cx/IWgL938e+vg2lDoeIiOoxjmCYkc1bjkCQydGsIA0+j3SUOhwiIqrHWGCYkd0X0wEA/d1kvDU4ERFJigWGmcjMykMcHAEAj/cOkDgaIiKq71hgmInffjsCjdwC/vnpaN0jWOpwiIionmOBYSa2/Z0CAAh10kAm56+ViIikxSORGSgqKML/ldgAAIb0bCNxNERERLxM1Sxo40/iu51z8H/+HRAwd6XU4RAREXEEwxzk/P47bDTFGBDkA5lCIXU4RERELDDqOkGrRd6evQAA+36hEkdDRERUigVGHbdu6wm83nYEdjTvAZtH+OwRIiJ6OHAORh239WQirjZohGybQsiVSqnDISIiAsARjDotv1iDvwpUAIDBHXwkjoaIiOhfLDDqsH1xV1EiV8AzPwPt+/eQOhwiIiIdFhh12K7DFwEAPdSpUHp4SBwNERHRv1hg1FGiKOJwmhoA8GgzF4mjISIi0scCo446nZCBNLk1VBo1eoR2kjocIiIiPbyKpI4qOX8OvZNOwtZCBqfAJ6UOh4iISE+1RjD++OMPY8dBVeR7+ggmx63F+96FfLgZERE9dKp1ZBowYACaNm2KDz74AElJScaOiSoh//BhAIBdj+4SR0JERFRetQqMW7duISoqChs3bkSTJk0QFhaG9evXQ61WV3lbS5YsgZ+fH6ysrNClSxccO3bsvv2zsrIwduxYeHl5QaVSoUWLFti2bVt1dqPOunoxERdScyHKZLDp2lXqcIiIiMqpVoHh6uqKt99+G/Hx8fjrr7/QokULvPnmm2jYsCHGjRuH06dPV2o769atQ3R0NGJiYnDy5EkEBgYiLCwMaWlpBvur1Wr069cPCQkJ2LhxIy5evIgVK1bA29u7OrtRZ63eHo83H5uIrx+NgIWTk9ThEBERlVPjk/cdO3bElClTEBUVhby8PKxatQrBwcHo2bMnzp49e991Fy5ciNGjRyMyMhJt2rTBsmXLYGNjg1WrVhnsv2rVKty9exf/+9//0L17d/j5+aFXr14IDAys6W7UKYduFwEAghs3kDYQIiKiClT7KpKSkhJs3rwZq1atwq5duxASEoIvvvgCw4cPR3p6OqZNm4bnnnsO586dM7i+Wq1GXFwcpkyZomuTy+UIDQ3FkSNHDK6zZcsWdO3aFWPHjsXmzZvh5uaGF198EZMnT4aigseUFxcXo7i4WLeck5MDABAEAYIgVHf39QiCAFEUjba9+0nLKcJ1mS1kooBe3dua5D0fJqbMdX3HXJsG82w6zHXNVSV31Sow3nrrLfz4448QRREjR47ERx99hHbt2ulet7W1xSeffIKGDRtWuI2MjAxotVp43HMHSg8PD1y4cMHgOteuXcPevXsxYsQIbNu2DVeuXMGbb76JkpISxMTEGFxn/vz5mDVrVrn29PR0FBUVVWZ3H0gQBGRnZ0MURchr+YqOnQfOAwD8c1Mg9w+s8HSSuTJlrus75to0mGfTYa5rLjc3t9J9q1VgnDt3Dp9//jmefvppqFQqg31cXV2NfjmrIAhwd3fH8uXLoVAoEBwcjFu3buHjjz+usMCYMmUKoqOjdcs5OTnw8fGBm5sbHBwcjBaXTCaDm5tbrX9o468cBGCDYMtCeDRqVKvv9TAyZa7rO+baNJhn02Gua87KyqrSfatVYMTExKBbt26wsNBfXaPR4PDhw3j00UdhYWGBXr16VbgNV1dXKBQKpKam6rWnpqbC09PT4DpeXl6wtLTUOx3SunVrpKSkQK1WQ2ngceUqlcpgESSXy436AZPJZEbfpiHHMwVAAXRr7lpv/0BMlWtirk2FeTYd5rpmqpK3amW4T58+uHv3brn27Oxs9OnTp1LbUCqVCA4Oxp49e3RtgiBgz5496FrBpZfdu3fHlStX9M4BXbp0CV5eXgaLC3NzOz0HNxV2kIkCuvfqIHU4REREFapWgSGKImQyWbn2O3fuwNbWttLbiY6OxooVK/Dtt9/i/PnzeOONN5Cfn4/IyEgAwKhRo/Qmgb7xxhu4e/cuxo8fj0uXLmHr1q2YN28exo4dW53dqHNUV87jg8PL8fr1vXBr10rqcIiIiCpUpVMkTz/9NIDSIaaIiAi9Uw9arRb/93//h27dulV6e8OGDUN6ejpmzJiBlJQUBAUFYceOHbqJn4mJiXrDMT4+Pti5cyfefvtttG/fHt7e3hg/fjwmT55cld2os7RxJxCcdgl9QpoZLPCIiIgeFlUqMBwdHQGUjmDY29vD2tpa95pSqcQjjzyC0aNHVymAqKgoREVFGXxt37595dq6du2Ko0ePVuk9zEXB8eMAAJvOnSWOhIiI6P6qVGCsXr0aAODn54eJEydW6XQI1Uza3TwsLvREe49WeKEzH89OREQPt2pfRUKmdXB/PH5u0hOn3FtglL+/1OEQERHdV6ULjI4dO2LPnj1wcnJChw4d7jsH4OTJk0YJjv515OxNAPboaFXM+RdERPTQq3SB8eSTT+omdQ4dOrS24qEKxGUKgCXwSFNXqUMhIiJ6oEoXGP89LcJTJKaVkZmH65alE2y79wyQOBoiIqIH463M6oCDB04DAPzy0+DZtqXE0RARET1YpUcwnJycKn3u39BdPqn6jv2dBMAeHVScf0FERHVDpQuM2NjYWgyD7ufSnUJAaY9O/s5Sh0JERFQplS4wwsPDazMOqoCo1WLuvi+QJLdF0OplUodDRERUKZUuMHJycnSPN8/JyblvX2M9Bp2A4kuXIBYUwNdODtc2nH9BRER1Q5XmYNy+fRvu7u5o0KCBwbkAZQ9B02q1Rg2yPis4dQoAYB0YCNl/HlNPRET0MKt0gbF37144O5fOAfjjjz9qLSDS9158EQo7jcSb7VzhK3UwRERElVTpAqNXr14G/59qj0Yr4IDohCJvD7zdyl7qcIiIiCqtWs8iAYDMzEx8/fXXOH/+PACgTZs2iIyM1I1yUM2dOXcDRQolbEsKEdDjUanDISIiqrRq3WjrwIED8PPzw+LFi5GZmYnMzEwsXrwY/v7+OHDggLFjrLeOHLsAAGhXnA5Le45gEBFR3VGtEYyxY8di2LBhWLp0KRT/TDzUarV48803MXbsWJw5c8aoQdZXJxIyATiiQwPecJWIiOqWah25rly5gnfeeUdXXACAQqFAdHQ0rly5YrTg6jNRFBFfaAkA6NLKS+JoiIiIqqZaBUbHjh11cy/+6/z58wgMDKxxUAQkpGThroUNLAQNgrszp0REVLdU+hTJ//3f/+n+f9y4cRg/fjyuXLmCRx55BABw9OhRLFmyBB9++KHxo6yH0s5eRIvMRKjkgL3fE1KHQ0REVCWVLjCCgoIgk8kgiqKu7d133y3X78UXX8SwYcOME1091uzGOSzavxg2oX35gDMiIqpzKl1gXL9+vTbjoHsU/jNR1rY9T48QEVHdU+kCo3HjxrUZB/1HsUaLzLPnYQHAun2A1OEQERFVWbVvtAUA586dQ2JiItRqtV77E09wzkBN/BF3HW92eBM9Pf4Pq9q2lTocIiKiKqtWgXHt2jU89dRTOHPmjN68jLK5AnzYWc38FX8NglwBO2slFLzBFhER1UHVukx1/Pjx8Pf3R1paGmxsbHD27FkcOHAAISEh2Ldvn5FDrH9O3soFAHRwrtEAExERkWSqdQQ7cuQI9u7dC1dXV8jlcsjlcvTo0QPz58/HuHHjcOqfR4xT1WkFEZeKLQAZENTcU+pwiIiIqqVaIxharRb2/wzdu7q6Ijk5GUDpRNCLFy8aL7p66HpGHgplFlBp1GjZsbXU4RAREVVLtUYw2rVrh9OnT8Pf3x9dunTBRx99BKVSieXLl6NJkybGjrFe+fvsDQCAX24KbNs+LnE0RERE1VOtAmPatGnIz88HAMyePRuDBw9Gz5494eLignXr1hk1wPrmzPlEAEALWQHkKpXE0RAREVVPtQqMsLAw3f83a9YMFy5cwN27d+Hk5MS7TtZQ88wk9E5KQxd/B6lDISIiqrYaX6aQlJQEAPDx8alxMAR0vXgYgXHH4PXUHKlDISIiqrZqTfLUaDSYPn06HB0d4efnBz8/Pzg6OmLatGkoKSkxdoz1higIKDp7FgBgFcA7eBIRUd1VrRGMt956C5s2bcJHH32Erl27Aii9dHXmzJm4c+cOli5datQg64tb564iUWaDhlYCVE2bSh0OERFRtVWrwFi7di1++uknDBw4UNfWvn17+Pj4YPjw4Swwqmnjn5cQGzoZffOu4WsL3mSLiIjqrmqdIlGpVPDz8yvX7u/vD6VSWdOY6q1zt7MBAM0bMIdERFS3VavAiIqKwpw5c1BcXKxrKy4uxty5cxEVFWW04OqbS/mlV+C09XWVOBIiIqKaqfQ4/NNPP623vHv3bjRq1AiBgYEAgNOnT0OtVqNv377GjbCeKFRrkKiwAwC0D+L8CyIiqtsqXWA4OjrqLT/zzDN6y7xMtWbOnU+EIJPDsTgPjdq3kjocIiKiGql0gbF69erajKPe+7/TVwEAzUoyobCykjgaIiKimqnRpQrp6em6h5u1bNkSbm5uRgmqPjqXmAHAAS1tpY6EiIio5qo1yTM/Px8vv/wyvLy88Oijj+LRRx9Fw4YN8corr6CgoMDYMdYLvdLP48ULv6O3r73UoRAREdVYtQqM6Oho7N+/H7/++iuysrKQlZWFzZs3Y//+/XjnnXeMHWO90Orvwxh54Xd0D24mdShEREQ1Vq1TJD///DM2btyI3r1769oef/xxWFtb4/nnn+eNtqpIm5ODklu3AABWrTnBk4iI6r5qFRgFBQXw8PAo1+7u7s5TJNVw9q+/ccqjNVpbaaC452odIiKiuqhap0i6du2KmJgYFBUV6doKCwsxa9Ys3bNJqPI2x99ETNdX8F27x6UOhYiIyCiqVWDExsbi0KFDaNSoEfr27Yu+ffvCx8cHhw8fxqJFi6q8vSVLlsDPzw9WVlbo0qULjh07Vqn1fvrpJ8hkMgwdOrTK7/kwOZ9RWqi1duclJEREZB6qdYokICAAly9fxpo1a3DhwgUAwPDhwzFixAhYW1tXaVvr1q1DdHQ0li1bhi5duiA2NhZhYWG4ePEi3N3dK1wvISEBEydORM+ePauzCw+VyxoVYAm0a+YpdShERERGUeUCo6SkBK1atcJvv/2G0aNH1ziAhQsXYvTo0YiMjAQALFu2DFu3bsWqVavw3nvvGVxHq9VixIgRmDVrFg4ePIisrKwaxyGVO1n5SLcsvUV4QIeWEkdDRERkHFUuMCwtLfXmXtSEWq1GXFwcpkyZomuTy+UIDQ3FkSNHKlxv9uzZcHd3xyuvvIKDBw/e9z2Ki4v1HsqWk5MDABAEAYIg1HAPoNuWKIrV2t7p+MsAAK+CO3D0bWi0mMxVTXJNVcNcmwbzbDrMdc1VJXfVOkUyduxYLFiwACtXroSFRfVvBpqRkQGtVlvuihQPDw/dqZd7/fnnn/j6668RHx9fqfeYP38+Zs2aVa49PT3daIWSIAjIzs6GKIqQy6s2reXE6SsArNFUm4P0jAyjxGPOapJrqhrm2jSYZ9NhrmsuNze30n2rVR0cP34ce/bswe+//46AgADY2upPTty0aVN1NvtAubm5GDlyJFasWAFX18o90nzKlCmIjo7WLefk5MDHxwdubm5wcHAwSlyCIEAmk8HNza3KH9rrmSUArNHa0eK+c06oVE1yTVXDXJsG82w6zHXNWVXhWVnVKjAaNGhQ7mmq1eHq6gqFQoHU1FS99tTUVHh6lp/wePXqVSQkJGDIkCG6trLhGgsLC1y8eBFNm+o/6lylUkGlUpXbllwuN+oHTCaTVWubL2XEo+3Fm+j83CB+4CupurmmqmOuTYN5Nh3mumaqkrcqFRiCIODjjz/GpUuXoFar8dhjj2HmzJlVvnKkjFKpRHBwMPbs2aO71FQQBOzZswdRUVHl+rdq1QpnzpzRa5s2bRpyc3OxaNGiOvnIeI+Lp9A3KQm+7cdJHQoREZHRVKnAmDt3LmbOnInQ0FBYW1tj8eLFSE9Px6pVq6odQHR0NMLDwxESEoLOnTsjNjYW+fn5uqtKRo0aBW9vb8yfPx9WVlZo166d3voNGjQAgHLtdYFQUICSpCQAgKpFc4mjISIiMp4qFRjfffcdvvzyS4wZMwYAsHv3bgwaNAgrV66s9nDTsGHDkJ6ejhkzZiAlJQVBQUHYsWOHbuJnYmKi2Q5lnTx2Drub9EBbIQutnZ2lDoeIiMhoqlRgJCYm4vHH/72ddWhoKGQyGZKTk9GoUaNqBxEVFWXwlAgA7Nu3777rfvPNN9V+X6n98X83saz9UIQV3sCQB3cnIiKqM6o0NKDRaMrNILW0tERJSYlRg6ovLqXlAQCaOykljoSIiMi4qjSCIYoiIiIi9K7KKCoqwuuvv653qWptXaZqbq4VygBLoIWPi9ShEBERGVWVCozw8PBybS+99JLRgqlPNFoBiYrSW4S3buMnbTBERERGVqUCY/Xq1bUVR71z/VoySuQWUGnU8A/kM0iIiMi8mOflGXXA+TNXAQC+6ixY2NhIHA0REZFxscCQyIXraQCAJpacIEtEROan+k8qoxp5Ouc8mu0/DPehvECViIjMDwsMiVheu4LWmTfQsFX17x9CRET0sOIpEokUX7sGAFA2afqAnkRERHUPCwwJJCWm4ouGPbDLNwSqJv5Sh0NERGR0PEUigfjTV7GlaU80y0/FuP/coIyIiMhccARDAhevpwIAmiiKJY6EiIiodrDAkMCV9AIAQFNHS4kjISIiqh0sMCRwtbD0v829GkgaBxERUW1hgWFioigiSVZ6584Wzb0ljoaIiKh2sMAwsZT0bBQplJCLApq0by51OERERLWCBYaJXT1bev8Lz6Is2Li5ShwNERFR7WCBYWIBecn4cVsM5mT/JXUoREREtYb3wTCx4mtX0UCdDz8fZ6lDISIiqjUcwTAx9dV/bhHetInEkRAREdUeFhgmNr/IGyvaDUG2N28RTkRE5ounSExIXazGjgatoHVWYIKPr9ThEBER1RqOYJjQ9QsJ0MoVUGnU8G7GAoOIiMwXCwwTunzpJgCgkSYHCguFxNEQERHVHhYYJnT1ZgYAwNdCI3EkREREtYsFhgldv1P6kDN/B059ISIi88YCw4QSSusLNPFwkDYQIiKiWsYCw4TShdKRi2ZNPCWOhIiIqHZxrN5EhOJirNg5D5lKO7R/+zepwyEiIqpVHMEwkZKkJMhEEa6WIqzd3aQOh4iIqFaxwDARdUICAEDZuDFkMpm0wRAREdUyniIxkR9Op+NA53AMcQd4k3AiIjJ3HMEwkRMZJTjSMACpzg2lDoWIiKjWscAwkRvFpalu6u0kcSRERES1jwWGCYiiiJsKWwBAs6YcwSAiIvPHAsMEkm9nokihhFzQokmbJlKHQ0REVOtYYJjAlQvXAQCexdmwcuYpEiIiMn8sMEzg6vUUAEAjsVDiSIiIiEyDBYYJZKVnQqVRw89G6kiIiIhMgwWGCbyQeQa//DYV43xFqUMhIiIyCRYYJqBOTIIMgIOfj9ShEBERmQQLDBNQ30wCAFj6+EocCRERkWnwVuG1LDUtE6+3G4lGuelY1chb6nCIiIhMggVGLbtyIRHXHL1RoLSBhRMvUSUiovqBp0hq2bUbqQAAb6FA4kiIiIhM56EoMJYsWQI/Pz9YWVmhS5cuOHbsWIV9V6xYgZ49e8LJyQlOTk4IDQ29b3+pJaRkAQB8VLyChIiI6g/JC4x169YhOjoaMTExOHnyJAIDAxEWFoa0tDSD/fft24fhw4fjjz/+wJEjR+Dj44P+/fvj1q1bJo68cm5kqQEAjR2VEkdCRERkOpIXGAsXLsTo0aMRGRmJNm3aYNmyZbCxscGqVasM9l+zZg3efPNNBAUFoVWrVli5ciUEQcCePXtMHHnlJBXLAACN3R0kjoSIiMh0JJ3kqVarERcXhylTpuja5HI5QkNDceTIkUpto6CgACUlJXB2djb4enFxMYqLi3XLOTk5AABBECAIQg2i/5cgCBBFsdz2RFHETZk1AMDP191o71efVZRrMj7m2jSYZ9NhrmuuKrmTtMDIyMiAVquFh4eHXruHhwcuXLhQqW1MnjwZDRs2RGhoqMHX58+fj1mzZpVrT09PR1FRUdWDNkAQBGRnZ0MURcjl/w4KFRSXwLkgCxprJzRwta3wtA9VXkW5JuNjrk2DeTYd5rrmcnNzK923Tl+m+uGHH+Knn37Cvn37YGVlZbDPlClTEB0drVvOycmBj48P3Nzc4OBgnNMWgiBAJpPBzc1N70NbkpKC5Xs+hmhhgcbz4iCzqNPpfihUlGsyPubaNJhn02Gua66iY60hkh7xXF1doVAokJqaqteempoKT0/P+677ySef4MMPP8Tu3bvRvn37CvupVCqoVKpy7XK53KgfMJlMVm6bmps3AQDKhg2hUHKSp7EYyjXVDubaNJhn02Gua6YqeZM0w0qlEsHBwXoTNMsmbHbt2rXC9T766CPMmTMHO3bsQEhIiClCrZaSpH8KjEaNJI6EiIjItCQfs4+OjkZ4eDhCQkLQuXNnxMbGIj8/H5GRkQCAUaNGwdvbG/PnzwcALFiwADNmzMDatWvh5+eHlJQUAICdnR3s7Owk2w9DFp/Px/7eE/CimxqvSB0MERGRCUleYAwbNgzp6emYMWMGUlJSEBQUhB07dugmfiYmJuoNySxduhRqtRrPPvus3nZiYmIwc+ZMU4b+QJdztLjaoBHUDbKlDoWIiMikJC8wACAqKgpRUVEGX9u3b5/eckJCQu0HZCQpJXJABTTyNHwJLRERkbniLJdalCovvQeGr7+XxJEQERGZFguMWpJ7Nwc5ljYAgMYtGkscDRERkWmxwKgliZcSAAA2miI0cG0gaSxERESmxgKjliQm3AYAeGr5mHYiIqp/HopJnuZInXEHPrlFaGwjdSRERESmxxGMWtIlOwHL93yMBR53pQ6FiIjI5Fhg1JKS5GQAgEXDhhJHQkREZHosMGpJya1bAAClt7fEkRAREZke52DUkjENH4fgOQCf27iijdTBEBERmRgLjFqgzs7BNTsPaOUKODa6/1NhiYiMSRAEqNVqqcN4KAmCgJKSEhQVFfFpqvehVCqNkh8WGLXg9tUkaOUKKAQtPD14m3AiMg21Wo3r169DEASpQ3koiaIIQRCQm5sLmUwmdTgPLblcDn9/fyiVyhpthwVGLUhMKJ3g6aYtgELODzER1T5RFHH79m0oFAr4+PjwG7oBoihCo9HAwsKCBUYFBEFAcnIybt++DV9f3xrliQVGLbiZfBeAHTzlJVKHQkT1hEajQUFBARo2bAgbG96AxxAWGJXj5uaG5ORkaDQaWFpaVns7LHFrwc2MPACApxXTS0SmodVqAaDGw9pEZZ+hss9UdfEIWAuSc0snWHk7qiSOhIjqG34zp5oy1meIBUYtsMu5C5/cVPh5OEgdChERkSRYYNSCkX9vxfI9H+O5Tr5Sh0JEVOf17t0bEyZMeOi3SfpYYBiZUFAAbWYmAMCStwknIrqviIgIDB06VOowDFKr1fjoo48QGBgIGxsbuLq6onv37li9ejVKSkon8UdEREAmk0Emk8HS0hIeHh7o168fVq1aVe5yYT8/P13fsp9GjRpJsWsmwatIjKzsGSRye3soHHiKhIioLlKr1QgLC8Pp06cxZ84cdO/eHQ4ODjh69Cg++eQTdOjQAUFBQQCAAQMGYPXq1dBqtUhNTcWOHTswfvx4bNy4EVu2bIGFxb+H2tmzZ2P06NG6ZYVCYepdMxkWGEZ27kIiwgfOQlNNFn6ROhgiqrdEUYRYWCjJe8usras9UTA/Px9vvPEGNm3aBHt7e0ycOLFcn+LiYrz//vv48ccfkZWVhXbt2mHBggXo3bs3AODOnTuIiorCgQMHkJmZiaZNm2Lq1Kl44YUXKh1HbGwsDhw4gBMnTqBDhw669iZNmuC5557Tu1uqSqWCp2fpXZu9vb3RsWNHPPLII+jbty+++eYbvPrqq7q+9vb2ur7mjgWGkSXduoMclS3yLDRSh0JE9ZhYWIiLHYMlee+WJ+Mgq+a9OCZNmoT9+/dj8+bNcHd3x9SpU3Hy5EndaAEAREVF4dy5c/jpp5/QsGFD/PLLLxgwYADOnDmD5s2bo6ioCMHBwZg8eTIcHBywdetWjBw5Ek2aNEHHjh0rFceaNWsQGhqqV1yUsbS0fOD9IR577DEEBgZi06ZNegVGfcI5GEZ2My0bAODFK1SJiKokLy8PX3/9NT755BP07dsXAQEB+Pbbb6HR/PuFLTExEatXr8aGDRvQs2dPNG3aFBMnTkSPHj2wevVqAKWjCBMnTkRQUBCaNGmCt956CwMGDMD69esrHcvly5fRqlWrGu1Pq1atkJCQoNc2efJk2NnZ6X4WL15co/d4mHEEw8iSc4oBBeBlV/27nxER1ZTM2hotT8ZJ9t7VcfXqVajVanTp0kXX5uzsjJYtW+qWz5w5A61WixYtWuitW1xcDBcXFwClN4iaN28e1q9fj1u3bkGtVqO4uLhKdzgVRbFa+3DvNu49VTRp0iREREToll1dXWv8Pg8rFhhGllwoAnZAI1c7qUMhonpMJpNV+zTFwywvLw8KhQJxcXHlJkja2ZX+u/vxxx9j0aJFiI2NRUBAAGxtbTFhwoQqPWW2RYsWuHDhQo1iPX/+PPz9/fXaXF1d0axZsxptt67gKRIjSxVKa7ZGXi4SR0JEVLc0bdoUlpaW+Ouvv3RtmZmZuHTpkm65Q4cO0Gq1SEtLQ7NmzfR+yiZPHjp0CE8++SReeuklBAYGokmTJnrbqIwXX3wRu3fvxqlTp8q9VlJSgvz8/Puuv3fvXpw5cwbPPPNMld7XnLDAMCJBrUaaRWkF7eNXP2YJExEZi52dHV555RVMmjQJe/fuxd9//42IiAi9J8O2aNECI0aMwKhRo7Bp0yZcv34dx44dw/z587F161YAQPPmzbFr1y4cPnwY58+fx5gxY5CamlqlWCZMmIDu3bujb9++WLJkCU6fPo1r165h/fr1eOSRR3D58mVd3+LiYqSkpODWrVs4efIk5s2bhyeffBKDBw/GqFGjjJOcOoinSIyo5PZtNM5JgZVQAl8fd6nDISKqcz7++GPk5eVhyJAhsLe3xzvvvIPs7Gy9PqtXr8YHH3yAd955B7du3YKrqyseeeQRDB48GAAwbdo0XLt2DWFhYbCxscFrr72GoUOHltvO/ahUKuzatQufffYZvvrqK0ycOBE2NjZo3bo1xo0bh3bt2un67tixA15eXrCwsICTkxMCAwOxePFihIeH6xVH9Y1MNMZMljokJycHjo6OyM7OhoORboQlCALS0tJgl5CApIhIKBs3RtOdO4yybdJXlmt3d/d6/YdrCsy1aRgrz0VFRbh+/Tr8/f1hZWVlxAjNBx/XXjn3+yxV5RjKfzWMqCSldAjOwstL4kiIiIikxQLDiEpupwAALD08JI6EiIhIWiwwjOjrW8CwgbOwyq6N1KEQERFJipM8jSg5X4sclS3kvMkWERHVcxzBMKLUktJ0NnKzlzgSIiIiabHAMKIUWels20be5nvrVyIiospggWEkQmEh0lSll+z48iZbRERUz7HAMJLs5DQUWZQ+QtWbIxhERFTPscAwkts3MwAADUoKYK3k3FkiIqrfWGAYiXD3LjqmXkQH7V2pQyEiokqIiIjA0KFDH9hPJpPhf//7n9He18/PD7GxsUbb3sOKBYaRNM29jblHVmCubaLUoRAR1RkRERGlj5a/52fAgAG1/t6LFi3CN99888B+t2/fxsCBA2s9nv/KycnB+++/j1atWsHKygqenp4IDQ3Fpk2bUPaEj969e+vypVKp4O3tjSFDhmDTpk3ltmcoxz169KjVfeBYvpEIaWkAAEtP3iaciKgqBgwYgNWrV+u1qVSqWn9fR0fH+76uVquhVCp1j4E3laysLPTo0QPZ2dn44IMP0KlTJ1hYWGD//v1499138dhjj6FBgwYAgNGjR2P27NnQaDS4efMmfvnlF7zwwguIiIjA8uXL9ba7evVqvcJNqVTW6n5wBMNI1Ol3AACWXryChIgeHgVqTYU/RSVao/etDpVKBU9PT70fJycn3esymQxfffUVBg8erHui6ZEjR3DlyhX07t0btra26NatG65evapbZ+bMmQgKCsJXX30FHx8f2NjYYNiwYXpPVL33FEnv3r0RFRWFCRMmwNXVFWFhYbr3/+8pkps3b2L48OFwdnaGra0tQkJC8NdffwEArl69iieffBIeHh6ws7NDp06dsHv37irlY+rUqUhISMBff/2F8PBwtGnTBi1atMDo0aMRHx8POzs7XV8bGxt4enqiUaNGeOSRR7BgwQJ89dVXWLFiRbn3bdCggV6OnZ2dqxRXVXEEw0jeduiB5IEDsdDCFaFSB0NE9I82M3ZW+Fqflm5YHdlZtxw8ZzcK7ykkynTxd8a6MV11yz0W/IG7+epy/RI+HFSDaCs2Z84cLFy4EAsXLsTkyZPx4osvokmTJpgyZQp8fX3x8ssvIyoqCtu3b9etc+XKFaxfvx6//vorcnJy8Morr+Ctt97C2rVrK3yfb7/9Fm+88QYOHTpk8PW8vDz06tUL3t7e2LJlCzw9PXHy5EkIgqB7/fHHH8fcuXOhUqnw3XffYciQIbh48SJ8fX0fuJ+CIOCnn37CiBEj0LBhw3Kv/7e4qEh4eDjeeecdbNq0CaGh0h2RWGAYSbrCBjkqWzTw4CWqRERV8dtvv5U7cE6dOhVTp07VLUdGRuL5558HAEyePBldu3bF9OnTdaMM48ePR2RkpN42ioqK8N1338Hb2xsAsHjxYgwePBgLFy6EVwVPvW7evDk++uijCmNdu3Yt0tPTcfz4cd0IQLNmzXSvBwYGIjAwULc8Z84c/PLLL9iyZQuioqIemIuMjAxkZmaiVatWD+xbEblcjhYtWiAhIUGvffjw4VAoFLrlH374oVKTXKuLBYYRFOXkIlNV+sfRyL98xUlEJJVzs8MqfE0uk+ktx02v+NvuvX3/nNynZoH9R58+fbB06VK9tnuH79u3b6/7f49/nlgdEBCg11ZUVIScnBw4OPxz00NfX11xAQBdu3aFIAi4ePFihQVGcHDwfWONj49Hhw4dKjy9kJeXh5kzZ2Lr1q24ffs2NBoNCgsLkZhYuQsAyiZw1pQoipDd8zv77LPP9EY0KsqBsbDAMIKbV25CkMmh1JbAw8PpwSsQEZmITRXuy1NbfR/E1tZWbxTAEEvLfx8iWXbgNNRWdqqiJrHcj7W19X1fnzhxInbt2oVPPvkEzZo1g7W1NZ599lmo1eVPJxni5uaGBg0a4MKFC5WO+V5arRaXL19Gp06d9No9PT0fmGdjeigmeS5ZsgR+fn6wsrJCly5dcOzYsfv237Bhg+7SnYCAAGzbts1EkRqWmJgKAPDQ5JWrGImISBqJiYlITk7WLR89ehRyuRwtW7as9jbbt2+P+Ph43L1r+J5Hhw4dQkREBJ566ikEBATA09Oz3KmK+5HL5XjhhRewZs0avdjL5OXlQaO5/2Tab7/9FpmZmXjmmWcq/b61QfICY926dYiOjkZMTAxOnjyJwMBAhIWFIe2fyz7vdfjwYQwfPhyvvPIKTp06haFDh2Lo0KH4+++/TRz5v5JSswAAnrISyWIgIqqriouLkZKSoveTkZFR4+1aWVkhPDwcp0+fxsGDBzF+/Hg8++yzNbrsdPjw4fD09MTQoUNx6NAhXLt2DT///DOOHDkCoHQOx6ZNmxAfH4/Tp0/jxRdfrPKoyty5c+Hj44MuXbrgu+++w7lz53D58mWsWrUKHTp0QF5enq5vQUEBUlJScPPmTRw9ehSTJ0/G66+/jjfeeAN9+hjvNFZ1SF5gLFy4EKNHj0ZkZCTatGmDZcuWwcbGBqtWrTLYf9GiRRgwYAAmTZqE1q1bY86cOejYsSO++OILE0f+r+S7+QAAz9q/bJuIyOzs2LEDXl5eej/GuAlUs2bN8PTTT+Pxxx9H//790b59e3z++ec12qZSqcTvv/8Od3d3PP744wgICMCHH36omzy5cOFCODk5oVu3bhgyZAjCwsLQsWPHKr2Hs7Mzjh49ipdeegkffPABOnTogJ49e+LHH3/Exx9/rHf/jhUrVsDLywtNmzbF008/jXPnzmHdunX48ssva7SfxiATjTWjpBrUajVsbGywceNGvZms4eHhyMrKwubNm8ut4+vri+joaEyYMEHXFhMTg//97384ffp0uf7FxcUoLi7WLefk5MDHxweZmZm6iUA19fXURdieKqJfSxeMeXekUbZJhgmCgPT0dLi5uUEul7w+NmvMtWkYK89FRUVISEiAv78/rKysjBhh3TRz5kxs3rwZp06d0msvKSnRm7tB5RUVFeH69eu6qQv/lZOTAycnJ2RnZz/wGCrpJM+MjAxotVrdjOAyHh4eFU5wSUlJMdg/JSXFYP/58+dj1qxZ5drT09NRVFRUzcj19XUqQY9zf8Km8fAKT+2QcQiCgOzsbIiiyINeLWOuTcNYeS4pKYEgCNBoNA88R18fCIIAURT1ciGKIrTa0vt8cL5cxTQaDQRBwJ07d8oVY7m5uZXejtlfRTJlyhRER0frlstGMNzc3Iw2giG8E430USP5Tc8EBEGATCZjrk2AuTYNY+W5qKgIubm5sLCwgIWF2f/T/kByuRwymcxgLjiCcX8WFhaQy+VwcXEpN4JRldExST+Frq6uUCgUSE1N1WtPTU2tcBKOp6dnlfqrVCqD97SXy+VG/UdTJpMZfZtkGHNtOsy1aRgjz2UH1LKf+m7WrFnlRq//e28I5qhiZZ8hQ5/JqnxGJf1XQ6lUIjg4GHv27NG1CYKAPXv2oGvXrgbX6dq1q15/ANi1a1eF/YmIiMj0JB9Hi46ORnh4OEJCQtC5c2fExsYiPz9fd8vXUaNGwdvbG/PnzwdQejvYXr164dNPP8WgQYPw008/4cSJE+WeGkdEVB9JOG+fzISxPkOSFxjDhg1Deno6ZsyYgZSUFAQFBWHHjh26iZyJiYl6QzLdunXD2rVrMW3aNEydOhXNmzfH//73P7Rr106qXSAiklzZZZJqtfqBd5skup+yu47+97kl1SHpZapSyMnJgaOjY6UusaksQRCQlpYGd3d3nquuZcy16TDXpmGsPIuiiMTERJSUlKBhw4b8nRlQdlWJhYUF52BUQBAEJCcnw9LSEr6+vuXyVJVjqOQjGEREVHMymQxeXl64fv06bty4IXU4DyVRFCEIgm5CLBkml8sNFhdVxQKDiMhMKJVKNG/evNIP1qpvyu7t4OLiwhGe+1AqlUbJDwsMIiIzIpfLeSfPCgiCAEtLS1hZWbHAMAFmmIiIiIyOBQYREREZHQsMIiIiMrp6Nwej7KrcnJwco21TEATk5ubyvJ4JMNemw1ybBvNsOsx1zZUdOytzh4t6V2CUPQnOx8dH4kiIiIjqptzcXDg6Ot63T7270VbZTUTs7e2Ndh102RNak5KSjHbzLjKMuTYd5to0mGfTYa5rThRF5ObmVupmbvVuBEMul6NRo0a1sm0HBwd+aE2EuTYd5to0mGfTYa5r5kEjF2V4EoqIiIiMjgUGERERGR0LDCNQqVSIiYmBSqWSOhSzx1ybDnNtGsyz6TDXplXvJnkSERFR7eMIBhERERkdCwwiIiIyOhYYREREZHQsMIiIiMjoWGAYwZIlS+Dn5wcrKyt06dIFx44dkzokszN//nx06tQJ9vb2cHd3x9ChQ3Hx4kWpwzJ7H374IWQyGSZMmCB1KGbp1q1beOmll+Di4gJra2sEBATgxIkTUodlVrRaLaZPnw5/f39YW1ujadOmmDNnTqWepUE1wwKjhtatW4fo6GjExMTg5MmTCAwMRFhYGNLS0qQOzazs378fY8eOxdGjR7Fr1y6UlJSgf//+yM/Plzo0s3X8+HF89dVXaN++vdShmKXMzEx0794dlpaW2L59O86dO4dPP/0UTk5OUodmVhYsWIClS5fiiy++wPnz57FgwQJ89NFH+Pzzz6UOzezxMtUa6tKlCzp16oQvvvgCQOmzTnx8fPDWW2/hvffekzg685Weng53d3fs378fjz76qNThmJ28vDx07NgRX375JT744AMEBQUhNjZW6rDMynvvvYdDhw7h4MGDUodi1gYPHgwPDw98/fXXurZnnnkG1tbW+OGHHySMzPxxBKMG1Go14uLiEBoaqmuTy+UIDQ3FkSNHJIzM/GVnZwMAnJ2dJY7EPI0dOxaDBg3S+2yTcW3ZsgUhISF47rnn4O7ujg4dOmDFihVSh2V2unXrhj179uDSpUsAgNOnT+PPP//EwIEDJY7M/NW7h50ZU0ZGBrRaLTw8PPTaPTw8cOHCBYmiMn+CIGDChAno3r072rVrJ3U4Zuenn37CyZMncfz4calDMWvXrl3D0qVLER0djalTp+L48eMYN24clEolwsPDpQ7PbLz33nvIyclBq1atoFAooNVqMXfuXIwYMULq0MweCwyqc8aOHYu///4bf/75p9ShmJ2kpCSMHz8eu3btgpWVldThmDVBEBASEoJ58+YBADp06IC///4by5YtY4FhROvXr8eaNWuwdu1atG3bFvHx8ZgwYQIaNmzIPNcyFhg14OrqCoVCgdTUVL321NRUeHp6ShSVeYuKisJvv/2GAwcOoFGjRlKHY3bi4uKQlpaGjh076tq0Wi0OHDiAL774AsXFxVAoFBJGaD68vLzQpk0bvbbWrVvj559/ligi8zRp0iS89957eOGFFwAAAQEBuHHjBubPn88Co5ZxDkYNKJVKBAcHY8+ePbo2QRCwZ88edO3aVcLIzI8oioiKisIvv/yCvXv3wt/fX+qQzFLfvn1x5swZxMfH635CQkIwYsQIxMfHs7gwou7du5e71PrSpUto3LixRBGZp4KCAsjl+oc6hUIBQRAkiqj+4AhGDUVHRyM8PBwhISHo3LkzYmNjkZ+fj8jISKlDMytjx47F2rVrsXnzZtjb2yMlJQUA4OjoCGtra4mjMx/29vbl5rXY2trCxcWF812M7O2330a3bt0wb948PP/88zh27BiWL1+O5cuXSx2aWRkyZAjmzp0LX19ftG3bFqdOncLChQvx8ssvSx2a+ROpxj7//HPR19dXVCqVYufOncWjR49KHZLZAWDwZ/Xq1VKHZvZ69eoljh8/XuowzNKvv/4qtmvXTlSpVGKrVq3E5cuXSx2S2cnJyRHHjx8v+vr6ilZWVmKTJk3E999/XywuLpY6NLPH+2AQERGR0XEOBhERERkdCwwiIiIyOhYYREREZHQsMIiIiMjoWGAQERGR0bHAICIiIqNjgUFERERGxwKDiIiIjI4FBhERERkdCwwiIiIyOhYYREREZHQsMIhIcunp6fD09MS8efN0bYcPH4ZSqcSePXskjIyIqosPOyOih8K2bdswdOhQHD58GC1btkRQUBCefPJJLFy4UOrQiKgaWGAQ0UNj7Nix2L17N0JCQnDmzBkcP34cKpVK6rCIqBpYYBDRQ6OwsBDt2rVDUlIS4uLiEBAQIHVIRFRNnINBRA+Nq1evIjk5GYIgICEhQepwiKgGOIJBRA8FtVqNzp07IygoCC1btkRsbCzOnDkDd3d3qUMjompggUFED4VJkyZh48aNOH36NOzs7NCrVy84Ojrit99+kzo0IqoGniIhIsnt27cPsbGx+P777+Hg4AC5XI7vv/8eBw8exNKlS6UOj4iqgSMYREREZHQcwSAiIiKjY4FBRERERscCg4iIiIyOBQYREREZHQsMIiIiMjoWGERERGR0LDCIiIjI6FhgEBERkdGxwCAiIiKjY4FBRERERscCg4iIiIzu/wEbZuWuvxpGVAAAAABJRU5ErkJggg==", + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + " ➜ Figure saved to plots/exp_cdf.png\n" + ] + } + ], + "source": [ + "def example_exponential_cdf() -> None:\n", + " print(\"=== Example 2: CDF sampling with NINV ===\")\n", + " lam = 1.5\n", + "\n", + " def cdf_func(x: float, **_: Any) -> float:\n", + " return 0.0 if x < 0 else 1.0 - math.exp(-lam * x)\n", + "\n", + " distr = CustomDistribution(\n", + " name=\"Exp CDF(λ=1.5)\",\n", + " kind=Kind.CONTINUOUS,\n", + " analytical_computations=[\n", + " AnalyticalComputation(target=CharacteristicName.CDF, func=cdf_func),\n", + " ],\n", + " sampling_strategy=DefaultUnuranSamplingStrategy(\n", + " default_config=UnuranMethodConfig(method=UnuranMethod.NINV, use_cdf=True)\n", + " ),\n", + " )\n", + "\n", + " data = distr.sample(40_000).array.flatten()\n", + " print(f\"Mean ≈ {data.mean():.4f} (expected {1/lam:.4f})\")\n", + " print(f\"Std ≈ {data.std():.4f} (expected {1/lam:.4f})\")\n", + "\n", + " xs = np.linspace(0, 5 / lam, 400)\n", + " cdf_vals = np.array([cdf_func(x) for x in xs])\n", + " _plot_continuous_cdf(\"Exponential distribution (CDF)\", xs, cdf_vals, data, \"exp_cdf.png\")\n", + "\n", + "\n", + "example_exponential_cdf()" + ] + }, + { + "cell_type": "markdown", + "id": "25306cd9", + "metadata": {}, + "source": [ + "### Example 3 – Discrete PMF with DGT\n", + "Goal: demonstrate sampling of a discrete PMF using method DGT without relying on registry characteristics..\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f16176cb", + "metadata": { + "name": "example3" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "=== Example 3: Discrete distribution (DGT) ===\n", + "Goal: demonstrate sampling of a discrete PMF using method DGT without relying on registry characteristics.\n", + "Observed frequencies:\n", + " value 0 → 0.200 (expected: 0.2)\n", + " value 1 → 0.496 (expected: 0.5)\n", + " value 2 → 0.303 (expected: 0.3)\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAhgAAAGJCAYAAADIVkprAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjgsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvwVt1zgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAQY5JREFUeJzt3XlcFPX/B/DXLteK3HIjsYi3Il6JeN944RWpaIp49C01IbKUUtGs8ESzPMoEzDTP1L7pD0MENUUt7/tA1Ey5VA4hzp3fHz7YrysLsjCwHK/n47GPms9+Zua947j7cuYzMxJBEAQQERERiUiq7QKIiIio9mHAICIiItExYBAREZHoGDCIiIhIdAwYREREJDoGDCIiIhIdAwYRERGJjgGDiIiIRMeAQURERKJjwCB6xcKFCyGRSLRdRrUQEREBiUSCe/fuKdt69eqFXr16Vcn6JRIJFi5cqJwu+rNJTU2tkvXL5XJMmjSpStalzrJly9C8eXMoFAqt1aDOkydPUL9+fRw8eFDbpVA1xoBBtVrRD2TRSyaTwd7eHp6enlizZg0yMzO1XaJGrl27hoULF6r84NcEJ0+exMKFC5GWlqbtUoqprrVlZGRg6dKlmDNnDqTS/31Vv7w/S6VS2NvbY8CAAYiNjVWZXy6XQyKRoF+/fmqXv3HjRuVy/vrrL2V7UYhT99qwYQMAoEGDBpg6dSrmz58v/genWkNX2wUQVYXPP/8czs7OyM/PR2JiImJjYxEQEIDQ0FD8+uuvaNOmjbLvvHnzMHfuXC1WW7Jr165h0aJF6NWrF+RyuVZq+P333zWe5+TJk1i0aBEmTZoEMzOzMs/377//Qle3cr+mSqvt5s2bKj/uVSksLAwFBQXw8fEp9l7//v0xceJECIKAhIQErFu3Dn369MGBAwcwaNAgZT+ZTIaYmBgkJibC1tZWZRlbt26FTCZDTk6O2vWvX78eRkZGKm3u7u7K/3/vvfewZs0aHDlyBH369KnIR6VaigGD6oRBgwahY8eOyumgoCAcOXIEQ4cOxbBhw3D9+nXUq1cPAKCrq1vpP2pFCgoKoFAooK+vXyXrE0Nl16pQKJCXlweZTAaZTFap63odAwMDra07PDwcw4YNU7sNmjZtinfeeUc5PXLkSLRp0warV69WCRhdu3bFn3/+iR07dsDf31/Z/vDhQxw/fhwjR47Enj171K7f29sblpaWJdbXokULtG7dGhEREQwYpBZPkVCd1adPH8yfPx/379/HTz/9pGxXNwYjKioK3bp1g5mZGYyMjNCsWTN8+umnKn1ycnKwcOFCNG3aFDKZDHZ2dhg1ahTi4+MBAPfu3YNEIsGKFSuwevVquLi4wMDAANeuXQMA3LhxA97e3rCwsIBMJkPHjh3x66+/KpcfERGBt99+GwDQu3dv5WHrlw+N/9///R+6d++O+vXrw9jYGEOGDMHVq1fLtD2uXr2KPn36oF69emjYsCG++OILtef+1Y3B+Oabb9CqVSsYGhrC3NwcHTt2xLZt25Tb8+OPPwYAODs7K+suOs0jkUgwc+ZMbN26Fa1atYKBgQEiIyOV7708BqNIamoqRo8eDRMTEzRo0AD+/v4q/xIv2tYRERHF5n15ma+rTd0YjLt37+Ltt9+GhYUFDA0N0blzZxw4cEClT2xsLCQSCXbu3Ikvv/wSDRs2hEwmQ9++fXHnzp1iNb0qISEBly5dKvH0xqtcXV1haWmJhIQElXaZTIZRo0Yp/yyK/PzzzzA3N4enp2eZll+S/v3747///S/4UG5Sh0cwqE6bMGECPv30U/z++++YNm2a2j5Xr17F0KFD0aZNG3z++ecwMDDAnTt3cOLECWWfwsJCDB06FNHR0Rg7diz8/f2RmZmJqKgoXLlyBS4uLsq+4eHhyMnJwbvvvgsDAwNYWFjg6tWr6Nq1KxwcHDB37lzUr18fO3fuxIgRI7Bnzx6MHDkSPXr0wKxZs7BmzRp8+umnaNGiBQAo/7tlyxb4+vrC09MTS5cuRXZ2NtavX49u3brh/PnzpZ5SSUxMRO/evVFQUKBc//fff688qlOajRs3YtasWfD29lb+0F+6dAmnT5/GuHHjMGrUKNy6dQs///wzVq1apfxXsZWVlXIZR44cwc6dOzFz5kxYWlq+9vTP6NGjIZfLERISglOnTmHNmjV49uwZfvzxx9fW+7Ky1PaypKQkdOnSBdnZ2Zg1axYaNGiAzZs3Y9iwYdi9ezdGjhyp0n/JkiWQSqWYPXs20tPTsWzZMowfPx6nT58uta6TJ08CANq3b1+mz/Hs2TM8e/YMjRs3LvbeuHHjMGDAAMTHxyv3w23btsHb2xt6enolLvPp06cq0zo6OjA3N1dp69ChA1atWoWrV6+idevWZaqV6hCBqBYLDw8XAAh//vlniX1MTU2Fdu3aKaeDg4OFl/9qrFq1SgAgpKSklLiMsLAwAYAQGhpa7D2FQiEIgiAkJCQIAAQTExMhOTlZpU/fvn0FV1dXIScnR2W+Ll26CE2aNFG27dq1SwAgxMTEqMyfmZkpmJmZCdOmTVNpT0xMFExNTYu1vyogIEAAIJw+fVrZlpycLJiamgoAhISEBGV7z549hZ49eyqnhw8fLrRq1arU5S9fvrzYcooAEKRSqXD16lW17wUHByuni/5shg0bptJv+vTpAgDh4sWLgiD8b1uHh4e/dpml1ebk5CT4+voqp4u20/Hjx5VtmZmZgrOzsyCXy4XCwkJBEAQhJiZGACC0aNFCyM3NVfb9+uuvBQDC5cuXi63rZfPmzRMACJmZmWrrnzJlipCSkiIkJycLp0+fFvr27SsAEFauXKlS+5AhQ4SCggLB1tZWWLx4sSAIgnDt2jUBgHD06FG1fz+KtvGrLycnp2K1nDx5UgAg7Nixo9TPQ3UTT5FQnWdkZFTq1SRFA//2799f4uWCe/bsgaWlJT744INi7716uuWtt95S+Rfy06dPceTIEYwePRqZmZlITU1Famoqnjx5Ak9PT9y+fRv//PNPqZ8hKioKaWlp8PHxUc6fmpoKHR0duLu7IyYmptT5Dx48iM6dO6NTp07KNisrK4wfP77U+YAX2+fhw4f4888/X9u3JD179kTLli3L3H/GjBkq00XbvbIvmzx48CA6deqEbt26KduMjIzw7rvv4t69e8rTXUX8/PxUxqx0794dwIvTLKV58uQJdHV1iw2yLLJp0yZYWVnB2toa7u7uOHHiBAIDAxEQEFCsr46ODkaPHo2ff/4ZwIvBnY6OjspaSrJnzx5ERUUpX1u3bi3Wp+iIRlVdNkw1C0+RUJ33/PlzWFtbl/j+mDFj8MMPP2Dq1KmYO3cu+vbti1GjRsHb21t5hUF8fDyaNWtWpsGhzs7OKtN37tyBIAiYP39+iZf9JScnw8HBocRl3r59GwBKHGxnYmJSak33799XuUKgSLNmzUqdDwDmzJmDw4cPo1OnTmjcuDEGDBiAcePGoWvXrq+dt8ir2+R1mjRpojLt4uICqVRa6ZfvlrSdik5T3b9/X+VUwRtvvKHSr+gH+dmzZxWqY/jw4Zg5cyYkEgmMjY3RqlUr1K9fv8T+48aNw5o1a3Dx4kVs27YNY8eOfe29Xnr06FHqIE8AyrEXvG8MqcOAQXXaw4cPkZ6ervbcdZF69erh2LFjiImJwYEDBxAZGYkdO3agT58++P3336Gjo6PROl8d11B0VGT27NklDrorrb6Xl7Fly5ZilyMCqNSrYlq0aIGbN2/it99+Q2RkJPbs2YN169ZhwYIFWLRoUZmWUZaxHqV59QeupB+8wsLCCq1HUyXtG8JrBkU2aNAABQUFyMzMhLGxcbH3GzZsWOYBoMCLy0tdXFwQEBCAhIQEjBs3rszzlqYoKL0uiFDdxIBBddqWLVsA4LWj6aVSKfr27Yu+ffsiNDQUX331FT777DPExMSgX79+cHFxwenTp5Gfn1/qwDl1GjVqBADQ09N77Y9GST+cRYP3rK2tNfrhKeLk5KQ8CvKymzdvlmn++vXrY8yYMRgzZgzy8vIwatQofPnllwgKCoJMJhP9X7i3b99WOepx584dKBQK5eDQoiMFr9486/79+8WWpUltTk5OarfJjRs3lO+LoXnz5gBeXE3y8j1aKsLHxwdffPEFWrRogbZt24qyzKKrVoqO4BC9jGMwqM46cuQIFi9eDGdn51LHGrw6mh6A8gs6NzcXwItxFampqfj222+L9X3dv1atra3Rq1cvfPfdd3j8+HGx91NSUpT/X3QY/NUfTk9PT5iYmOCrr75Cfn5+qctQZ/DgwTh16hTOnDmjMo+68+6vevLkicq0vr4+WrZsCUEQlLWUVHd5rV27VmX6m2++AQDlPSBMTExgaWmJY8eOqfRbt25dsWVpUtvgwYNx5swZxMXFKduysrLw/fffQy6XazSOpDQeHh4AoHKHzYqaOnUqgoODsXLlStGWefbsWZiamqJVq1aiLZNqDx7BoDrh//7v/3Djxg0UFBQgKSkJR44cQVRUFJycnPDrr7+WekOnzz//HMeOHcOQIUPg5OSE5ORkrFu3Dg0bNlQO9ps4cSJ+/PFHBAYG4syZM+jevTuysrJw+PBhTJ8+HcOHDy+1vrVr16Jbt25wdXXFtGnT0KhRIyQlJSEuLg4PHz7ExYsXAbwINjo6Oli6dCnS09NhYGCAPn36wNraGuvXr8eECRPQvn17jB07FlZWVnjw4AEOHDiArl27qg0/RT755BNs2bIFAwcOhL+/v/IyVScnJ1y6dKnU2gcMGABbW1t07doVNjY2uH79Or799lsMGTJEeXi/Q4cOAIDPPvsMY8eOhZ6eHry8vEodN1CahIQEDBs2DAMHDkRcXBx++uknjBs3Dm5ubso+U6dOxZIlSzB16lR07NgRx44dw61bt4otS5Pa5s6di59//hmDBg3CrFmzYGFhgc2bNyMhIQF79uwR7a6fjRo1QuvWrXH48GFMnjxZlGU6OTmpvadIRURFRcHLy4tjMEg9rV7DQlTJii7DK3rp6+sLtra2Qv/+/YWvv/5ayMjIKDbPq5epRkdHC8OHDxfs7e0FfX19wd7eXvDx8RFu3bqlMl92drbw2WefCc7OzoKenp5ga2sreHt7C/Hx8YIg/O/SyeXLl6utNT4+Xpg4caJga2sr6OnpCQ4ODsLQoUOF3bt3q/TbuHGj0KhRI0FHR6fYJasxMTGCp6enYGpqKshkMsHFxUWYNGmS8Ndff712W126dEno2bOnIJPJBAcHB2Hx4sXCpk2bXnuZ6nfffSf06NFDaNCggWBgYCC4uLgIH3/8sZCenq6y/MWLFwsODg6CVCpVWSYAYcaMGWprQgmXqV67dk3w9vYWjI2NBXNzc2HmzJnCv//+qzJvdna2MGXKFMHU1FQwNjYWRo8eLSQnJxdbZmm1vXqZqiC8+HPy9vYWzMzMBJlMJnTq1En47bffVPoUXaa6a9culfbSLp99VWhoqGBkZCRkZ2cX2yYlba+XFV2mWprSLlMt7bJsQRCE69evCwCEw4cPv7YWqpskgsBbsBERVTfp6elo1KgRli1bhilTpmi7nGICAgJw7NgxnD17lkcwSC0GDCKiamrp0qUIDw/HtWvXtPbQNXWePHkCJycn7Ny5E4MHD9Z2OVRNMWAQERGR6KpPJCYiIqJaQ6sB49ixY/Dy8oK9vT0kEgn27dv32nliY2PRvn17GBgYoHHjxmqflkhERETapdWAkZWVBTc3t2LXtJckISEBQ4YMQe/evXHhwgUEBARg6tSpOHToUCVXSkRERJqoNmMwJBIJ9u7dixEjRpTYZ86cOThw4ACuXLmibBs7dizS0tIQGRlZBVUSERFRWdSoG23FxcUVuw2yp6en2icIFsnNzVXebRF48cyGp0+fokGDBry0ioiISAOCICAzMxP29vavvbKpRgWMxMRE2NjYqLTZ2NggIyMD//77r9oHJoWEhJT5gUtERET0en///TcaNmxYap8aFTDKIygoCIGBgcrp9PR0vPHGG7h///5rH2FNRERE/5ORkQEnJye1T/l9VY0KGLa2tkhKSlJpS0pKgomJSYmPezYwMICBgUGxdjMzMwYMIiIiDRSdFinLEIMadR8MDw8PREdHq7RFRUUpnzxIRERE1YNWA8bz589x4cIFXLhwAcCLy1AvXLiABw8eAHhxemPixInK/u+99x7u3r2LTz75BDdu3MC6deuwc+dOfPjhh9oon4iIiEqg1YDx119/oV27dmjXrh0AIDAwEO3atcOCBQsAAI8fP1aGDQBwdnbGgQMHEBUVBTc3N6xcuRI//PADPD09tVI/ERERqVdt7oNRVTIyMmBqaor09HSOwSCiWq+wsBD5+fnaLoNqED09Pejo6Kh9T5Pf0Bo1yJOIiMru+fPnePjwIerYvyOpgiQSCRo2bAgjI6MKLYcBg4ioFiosLMTDhw9haGgIKysr3liQykQQBKSkpODhw4do0qRJiUcyyoIBg4ioFsrPz4cgCLCysirxMn4idaysrHDv3j3k5+dXKGDUqMtUiYhIMzxyQZoSa59hwCAiIiLRMWAQERGR6BgwiIioRunVq1epT9GuLsus6zjIk4ioDkl4y7tK1+e8Z7dG/SdNmoS0tDTs27evcgoqp4iICPj5+QF4MUbB3t4e/fv3x9KlS2Ftba1sB4C4uDh07txZOW9ubi7s7e3x9OlTxMTEoFevXir9X9a1a1f88ccflfxpqgYDBhERURmYmJjg5s2bUCgUuHjxIvz8/PDo0SMcOnRI2cfR0RHh4eEqAWPv3r0wMjLC06dPiy0zPDwcAwcOVE7r6+tX7oeoQjxFQkRE1VZWVhYmTpwIIyMj2NnZYeXKlcX65ObmYvbs2XBwcED9+vXh7u6O2NhY5ftPnjyBj48PHBwcYGhoCFdXV/z8888a1yKRSGBrawt7e3sMGjQIs2bNwuHDh/Hvv/8q+/j6+mL79u0qbWFhYfD19VW7TDMzM9ja2ipfFhYWGtdVXTFgEBFRtfXxxx/j6NGj2L9/P37//XfExsbi3LlzKn1mzpyJuLg4bN++HZcuXcLbb7+NgQMH4vbt2wCAnJwcdOjQAQcOHMCVK1fw7rvvYsKECThz5kyFaqtXrx4UCgUKCgqUbR06dIBcLseePXsAAA8ePMCxY8cwYcKECq2rJmLAICKiaun58+fYtGkTVqxYgb59+8LV1RWbN29W+UF/8OABwsPDsWvXLnTv3h0uLi6YPXs2unXrhvDwcACAg4MDZs+ejbZt26JRo0b44IMPMHDgQOzcubPctd2+fRsbNmxAx44dYWxsrPLe5MmTERYWBuDF2I3BgwfDyspK7XJ8fHxgZGSkfFW3sScVwTEYRERULcXHxyMvLw/u7u7KNgsLCzRr1kw5ffnyZRQWFqJp06Yq8+bm5qJBgwYAXtw2/auvvsLOnTvxzz//IC8vD7m5uTA0NNSonvT0dBgZGUGhUCAnJwfdunXDDz/8UKzfO++8g7lz5+Lu3buIiIjAmjVrSlzmqlWr0K9fP+W0nZ2dRjVVZwwYRERUYz1//hw6Ojo4e/ZssdtaFz2sa/ny5fj666+xevVquLq6on79+ggICEBeXp5G6zI2Nsa5c+cglUphZ2dX4i3YGzRogKFDh2LKlCnIycnBoEGDkJmZqbavra0tGjdurFEdNQUDBhERVUsuLi7Q09PD6dOn8cYbbwAAnj17hlu3bqFnz54AgHbt2qGwsBDJycno3r272uWcOHECw4cPxzvvvAMAUCgUuHXrFlq2bKlRPVKptMxhYPLkyRg8eDDmzJlToed51GQMGEREVC0ZGRlhypQp+Pjjj9GgQQNYW1vjs88+g1T6v+GDTZs2xfjx4zFx4kSsXLkS7dq1Q0pKCqKjo9GmTRsMGTIETZo0we7du3Hy5EmYm5sjNDQUSUlJGgcMTQwcOBApKSkwMTGptHVUdwwYRER1iKY3vtK25cuX4/nz5/Dy8oKxsTE++ugjpKenq/QJDw/HF198gY8++gj//PMPLC0t0blzZwwdOhQAMG/ePNy9exeenp4wNDTEu+++ixEjRhRbjpgkEgksLS0rbfk1gUQQBEHbRVSljIwMmJqaIj09vU4nSyKq3XJycpCQkABnZ2fIZDJtl0M1SGn7jia/obxMlYiIiETHgEFERESiY8AgIiIi0TFgEBERkegYMIiIiEh0DBhEREQkOgYMIiIiEh0DBhEREYmOAYOIiIhEx1uFExHVIUG/XK7S9YWMcq3S9VU2iUSCvXv3YsSIEeVexqRJk5CWloZ9+/aJVld1xCMYRERUbaSkpOD999/HG2+8AQMDA9ja2sLT0xMnTpzQdmlVJjY2FhKJRPmysbHBW2+9hbt37yr7yOVySCQSbN++vdj8rVq1gkQiQURERLH+L78aNmxYqZ+DAYOIiKqNt956C+fPn8fmzZtx69Yt/Prrr+jVqxeePHmi7dKq3M2bN/Ho0SPs2rULV69ehZeXFwoLC5XvOzo6Ijw8XGWeU6dOITExEfXr1y+2vM8//xyPHz9Wvs6fP1+p9TNgEBFRtZCWlobjx49j6dKl6N27N5ycnNCpUycEBQVh2LBhyn6hoaFwdXVF/fr14ejoiOnTp+P58+fK9yMiImBmZobffvsNzZo1g6GhIby9vZGdnY3NmzdDLpfD3Nwcs2bNUvnBlsvlWLx4MXx8fFC/fn04ODhg7dq1pdb8999/Y/To0TAzM4OFhQWGDx+Oe/fuKd8vLCxEYGAgzMzM0KBBA3zyySco6zNGra2tYWdnhx49emDBggW4du0a7ty5o3x//PjxOHr0KP7++29lW1hYGMaPHw9d3eIjIIyNjWFra6t8WVlZlamO8mLAICKiasHIyAhGRkbYt28fcnNzS+wnlUqxZs0aXL16FZs3b8aRI0fwySefqPTJzs7GmjVrsH37dkRGRiI2NhYjR47EwYMHcfDgQWzZsgXfffcddu9WfXz98uXL4ebmhvPnz2Pu3Lnw9/dHVFSU2jry8/Ph6ekJY2NjHD9+HCdOnICRkREGDhyIvLw8AMDKlSsRERGBsLAw/PHHH3j69Cn27t2r8bapV68eACiXCwA2Njbw9PTE5s2blZ95x44dmDx5ssbLrwwMGEREVC3o6uoiIiICmzdvhpmZGbp27YpPP/0Uly5dUukXEBCA3r17Qy6Xo0+fPvjiiy+wc+dOlT75+flYv3492rVrhx49esDb2xt//PEHNm3ahJYtW2Lo0KHo3bs3YmJiVObr2rUr5s6di6ZNm+KDDz6At7c3Vq1apbbeHTt2QKFQ4IcffoCrqytatGiB8PBwPHjwALGxsQCA1atXIygoCKNGjUKLFi2wYcMGmJqaarRdHj9+jBUrVsDBwQHNmjVTeW/y5MmIiIiAIAjYvXs3XFxc0LZtW7XLmTNnjjLEGRkZYc2aNRrVoSkGDCIiqjbeeustPHr0CL/++isGDhyI2NhYtG/fXmXA4uHDh9G3b184ODjA2NgYEyZMwJMnT5Cdna3sY2hoCBcXF+W0jY0N5HI5jIyMVNqSk5NV1u/h4VFs+vr162prvXjxIu7cuQNjY2Plj7aFhQVycnIQHx+P9PR0PH78GO7u7sp5dHV10bFjxzJti4YNG6J+/fqwt7dHVlYW9uzZA319fZU+Q4YMwfPnz3Hs2DGEhYWVevTi448/xoULF5SviRMnlqmO8uJlqkREVK3IZDL0798f/fv3x/z58zF16lQEBwdj0qRJuHfvHoYOHYr3338fX375JSwsLPDHH39gypQpyMvLg6GhIQBAT09PZZkSiURtm0KhKHedz58/R4cOHbB169Zi74kxvuH48eMwMTGBtbU1jI2N1fbR1dXFhAkTEBwcjNOnT5d6+sXS0hKNGzeucF1lxSMYRERUrbVs2RJZWVkAgLNnz0KhUGDlypXo3LkzmjZtikePHom2rlOnThWbbtGihdq+7du3x+3bt2FtbY3GjRurvExNTWFqago7OzucPn1aOU9BQQHOnj1bplqcnZ3h4uJSYrgoMnnyZBw9ehTDhw+Hubl5mZZdFRgwiIioWnjy5An69OmDn376CZcuXUJCQgJ27dqFZcuWYfjw4QCAxo0bIz8/H9988w3u3r2LLVu2YMOGDaLVcOLECSxbtgy3bt3C2rVrsWvXLvj7+6vtO378eFhaWmL48OE4fvw4EhISEBsbi1mzZuHhw4cAAH9/fyxZsgT79u3DjRs3MH36dKSlpYlWLwC0aNECqampxS5Z1TaeIiEiqkOq8501jYyM4O7ujlWrViE+Ph75+flwdHTEtGnT8OmnnwIA3NzcEBoaiqVLlyIoKAg9evRASEiIaOMJPvroI/z1119YtGgRTExMEBoaCk9PT7V9DQ0NcezYMcyZMwejRo1CZmYmHBwc0LdvX5iYmCiX9/jxY/j6+kIqlWLy5MkYOXIk0tPTRam3SIMGDURdnhgkQlkvyK0lMjIyYGpqivT0dOUOQERU2+Tk5CAhIQHOzs6QyWTaLqdGkMvlCAgIQEBAgLZL0arS9h1NfkN5ioSIiIhEx4BBREREouMYDCIiIkDlFt9UcTyCQURERKJjwCAiqsXq2Dh+EoFY+wwDBhFRLaSjowNA9eFYRGVRtM8U7UPlxTEYRES1kK6uLgwNDZGSkgI9PT1Ipfz3JL2eQqFASkoKDA0N1T7yXRMMGEREtZBEIoGdnR0SEhJw//59bZdDNYhUKsUbb7wBiURSoeUwYBAR1VL6+vpo0qQJT5OQRvT19UU54sWAQURUi0mlUt7Jk7SCJ+WIiIhIdFoPGGvXroVcLodMJoO7uzvOnDlTav/Vq1ejWbNmqFevHhwdHfHhhx8iJyeniqolIiKistBqwNixYwcCAwMRHByMc+fOwc3NDZ6enkhOTlbbf9u2bZg7dy6Cg4Nx/fp1bNq0CTt27FA+ZY+IiIiqB60GjNDQUEybNg1+fn5o2bIlNmzYAENDQ4SFhantf/LkSXTt2hXjxo2DXC7HgAED4OPj89qjHkRERFS1tDbIMy8vD2fPnkVQUJCyTSqVol+/foiLi1M7T5cuXfDTTz/hzJkz6NSpE+7evYuDBw9iwoQJJa4nNzcXubm5yumMjAwAL671VSgUIn0aIiKi2k+T302tBYzU1FQUFhbCxsZGpd3GxgY3btxQO8+4ceOQmpqKbt26QRAEFBQU4L333iv1FElISAgWLVpUrD0lJYVjN4iIiDSQmZlZ5r416jLV2NhYfPXVV1i3bh3c3d1x584d+Pv7Y/HixZg/f77aeYKCghAYGKiczsjIgKOjI6ysrGBiYlJVpRMREdV4mlzyrLWAYWlpCR0dHSQlJam0JyUlwdbWVu088+fPx4QJEzB16lQAgKurK7KysvDuu+/is88+U3tjEAMDAxgYGBRrl0qlvHUuERGRBjT53dTaL6y+vj46dOiA6OhoZZtCoUB0dDQ8PDzUzpOdnV3swxU9jIVPDCQiIqo+tHqKJDAwEL6+vujYsSM6deqE1atXIysrC35+fgCAiRMnwsHBASEhIQAALy8vhIaGol27dspTJPPnz4eXl1eFn/pGRERE4tFqwBgzZgxSUlKwYMECJCYmom3btoiMjFQO/Hzw4IHKEYt58+ZBIpFg3rx5+Oeff2BlZQUvLy98+eWX2voIREREpIZEqGPnFjIyMmBqaor09HQO8iQiItKAJr+hHOVIREREomPAICIiItExYBAREZHoGDCIiIhIdAwYREREJDoGDCIiIhIdAwYRERGJjgGDiIiIRMeAQURERKJjwCAiIiLRMWAQERGR6BgwiIiISHQMGERERCQ6BgwiIiISHQMGERERiY4Bg4iIiETHgEFERESiY8AgIiIi0TFgEBERkegYMIiIiEh0DBhEREQkOgYMIiIiEh0DBhEREYmOAYOIiIhEx4BBREREomPAICIiItExYBAREZHoGDCIiIhIdAwYREREJDoGDCIiIhIdAwYRERGJjgGDiIiIRMeAQURERKJjwCAiIiLRMWAQERGR6BgwiIiISHQMGERERCQ6BgwiIiISHQMGERERiY4Bg4iIiETHgEFERESiY8AgIiIi0TFgEBERkegYMIiIiEh0DBhEREQkOgYMIiIiEh0DBhEREYmOAYOIiIhEx4BBREREomPAICIiItExYBAREZHotB4w1q5dC7lcDplMBnd3d5w5c6bU/mlpaZgxYwbs7OxgYGCApk2b4uDBg1VULREREZVFuQJGTEyMKCvfsWMHAgMDERwcjHPnzsHNzQ2enp5ITk5W2z8vLw/9+/fHvXv3sHv3bty8eRMbN26Eg4ODKPUQERGROCSCIAiazmRgYICGDRvCz88Pvr6+cHR0LNfK3d3d8eabb+Lbb78FACgUCjg6OuKDDz7A3Llzi/XfsGEDli9fjhs3bkBPT69c68zIyICpqSnS09NhYmJSrmUQERHVRZr8hpYrYKSmpmLLli3YvHkzrl69ij59+mDKlCkYMWIE9PX1y7SMvLw8GBoaYvfu3RgxYoSy3dfXF2lpadi/f3+xeQYPHgwLCwsYGhpi//79sLKywrhx4zBnzhzo6OioXU9ubi5yc3OV0xkZGXB0dMSzZ88YMIiIiDSQkZEBc3PzMgUM3fKswNLSEh9++CE+/PBDnDt3DuHh4Zg+fTqmT5+OcePGYcqUKXBzcyt1GampqSgsLISNjY1Ku42NDW7cuKF2nrt37+LIkSMYP348Dh48iDt37mD69OnIz89HcHCw2nlCQkKwaNGiYu0pKSnIyckp4ycmIiKizMzMMvct1xGMVz169Ajff/89lixZAl1dXeTk5MDDwwMbNmxAq1atSpzHwcEBJ0+ehIeHh7L9k08+wdGjR3H69Oli8zRt2hQ5OTlISEhQHrEIDQ3F8uXL8fjxY7Xr4REMIiIicVT6EQwAyM/Px/79+xEWFoaoqCh07NgR3377LXx8fJCSkoJ58+bh7bffxrVr19TOb2lpCR0dHSQlJam0JyUlwdbWVu08dnZ20NPTUzkd0qJFCyQmJiIvL0/t6RkDAwMYGBgUa5dKpZBKtX4RDRERUY2hye9muX5hP/jgA9jZ2eE///kPmjZtivPnzyMuLg5Tp05F/fr1IZfLsWLFihJPdQCAvr4+OnTogOjoaGWbQqFAdHS0yhGNl3Xt2hV37tyBQqFQtt26dQt2dnZlHvtBREREla9cAePatWv45ptv8OjRI6xevRqtW7cu1sfS0vK1l7MGBgZi48aN2Lx5M65fv473338fWVlZ8PPzAwBMnDgRQUFByv7vv/8+nj59Cn9/f9y6dQsHDhzAV199hRkzZpTnYxAREVElKdcpkuDgYHTp0gW6uqqzFxQU4OTJk+jRowd0dXXRs2fPUpczZswYpKSkYMGCBUhMTETbtm0RGRmpHPj54MEDlcMxjo6OOHToED788EO0adMGDg4O8Pf3x5w5c8rzMYiIiKiSlGuQp46ODh4/fgxra2uV9idPnsDa2hqFhYWiFSg23geDiIiofDT5DS3XKRJBECCRSIq1P3nyBPXr1y/PIomIiKgW0egUyahRowAAEokEkyZNUrk6o7CwEJcuXUKXLl3ErZCIiIhqHI0ChqmpKYAXRzCMjY1Rr1495Xv6+vro3Lkzpk2bJm6FREREVONoFDDCw8MBAHK5HLNnz+bpECIiIlJLlDt51iQc5ElERFQ+mvyGlvkIRvv27REdHQ1zc3O0a9dO7SDPIufOnSt7tURERFTrlDlgDB8+XDmo8+WnnxIRERG9iqdIiIiIqEwq/T4YRERERKUp8ykSc3PzUsddvOzp06flLoiIiIhqvjIHjNWrV1diGURERFSblDlg+Pr6VmYdREREVIuUOWBkZGQoB3RkZGSU2peDJ4mIiOo2jcZgFD1B1czMTO14jKKHoFXnp6kSERFR5StzwDhy5AgsLCwAADExMZVWEBEREdV8vA8GERERlUml3Cr8Vc+ePcOmTZtw/fp1AEDLli3h5+enPMpBREREdVe5brR17NgxyOVyrFmzBs+ePcOzZ8+wZs0aODs749ixY2LXSERERDVMuU6RuLq6wsPDA+vXr4eOjg4AoLCwENOnT8fJkydx+fJl0QsVC0+REBERlU+l3yr8zp07+Oijj5ThAgB0dHQQGBiIO3fulGeRREREVIuUK2C0b99eOfbiZdevX4ebm1uFiyIiIqKarcyDPC9duqT8/1mzZsHf3x937txB586dAQCnTp3C2rVrsWTJEvGrJCIiohqlzGMwpFIpJBIJXte9ut9oi2MwiIiIyqdSLlNNSEiocGFERERUN5Q5YDg5OVVmHUQkkoS3vLVdQoU579mt7RKIqILKfaMtALh27RoePHiAvLw8lfZhw4ZVqCgiqtuCfqm+l7qXVcgoV22XQKRV5QoYd+/exciRI3H58mWVcRlFD0CrzmMwiIiIqPKV6zJVf39/ODs7Izk5GYaGhrh69SqOHTuGjh07IjY2VuQSiYiIqKYp1xGMuLg4HDlyBJaWlpBKpZBKpejWrRtCQkIwa9YsnD9/Xuw6iYiIqAYp1xGMwsJCGBsbAwAsLS3x6NEjAC8Ggt68eVO86oiIiKhGKtcRjNatW+PixYtwdnaGu7s7li1bBn19fXz//fdo1KiR2DUSERFRDVOugDFv3jxkZWUBAD7//HMMHToU3bt3R4MGDbBjxw5RCyQiIqKap1wBw9PTU/n/jRs3xo0bN/D06VOYm5srryQhIiKiuqtC98EAgL///hsA4OjoWOFiiIiIqHYo1yDPgoICzJ8/H6amppDL5ZDL5TA1NcW8efOQn58vdo1ERERUw5TrCMYHH3yAX375BcuWLYOHhweAF5euLly4EE+ePMH69etFLZKIiIhqlnIFjG3btmH79u0YNGiQsq1NmzZwdHSEj48PAwYREVEdV65TJAYGBpDL5cXanZ2doa+vX9GaiIiIqIYrV8CYOXMmFi9ejNzcXGVbbm4uvvzyS8ycOVO04oiIiKhmKvMpklGjRqlMHz58GA0bNoSbmxsA4OLFi8jLy0Pfvn3FrZCIiIhqnDIHDFNTU5Xpt956S2Wal6kSERFRkTIHjPDw8Mqsg4iIiGqRCt1oKyUlRflws2bNmsHKykqUooiIiKhmK9cgz6ysLEyePBl2dnbo0aMHevToAXt7e0yZMgXZ2dli10hEREQ1TLkCRmBgII4ePYr//ve/SEtLQ1paGvbv34+jR4/io48+ErtGIiIiqmHKdYpkz5492L17N3r16qVsGzx4MOrVq4fRo0fzRltERER1XLmOYGRnZ8PGxqZYu7W1NU+REBERUfkChoeHB4KDg5GTk6Ns+/fff7Fo0SLls0mIiIio7irXKZLVq1dj4MCBxW60JZPJcOjQIVELJCIiopqnXAHD1dUVt2/fxtatW3Hjxg0AgI+PD8aPH4969eqJWiARERHVPBoHjPz8fDRv3hy//fYbpk2bVhk1ERERUQ2n8RgMPT09lbEXYli7di3kcjlkMhnc3d1x5syZMs23fft2SCQSjBgxQtR6iIiIqGLKNchzxowZWLp0KQoKCipcwI4dOxAYGIjg4GCcO3cObm5u8PT0RHJycqnz3bt3D7Nnz0b37t0rXAMRERGJq1xjMP78809ER0fj999/h6urK+rXr6/y/i+//FLmZYWGhmLatGnw8/MDAGzYsAEHDhxAWFgY5s6dq3aewsJCjB8/HosWLcLx48eRlpZWno9BRERElaRcAcPMzKzY01TLIy8vD2fPnkVQUJCyTSqVol+/foiLiytxvs8//xzW1taYMmUKjh8/Xuo6cnNzkZubq5zOyMgAACgUCigUigp+AqLqR5BItF2CCARtF1Bh/H6h2kiT/VqjgKFQKLB8+XLcunULeXl56NOnDxYuXFjuK0dSU1NRWFhY7KZdNjY2yqtTXvXHH39g06ZNuHDhQpnWERISgkWLFhVrT0lJEX0sCVF1kOngoO0SKswMNf+Gfa87zUtUE2VmZpa5r0YB48svv8TChQvRr18/1KtXD2vWrEFKSgrCwsI0LrI8MjMzMWHCBGzcuBGWlpZlmicoKAiBgYHK6YyMDDg6OsLKygomJiaVVSqR1mT/84+2S6iwNBhqu4QKs7a21nYJRKKTyWRl7qtRwPjxxx+xbt06/Oc//wEAHD58GEOGDMEPP/wAqVTz8aKWlpbQ0dFBUlKSSntSUhJsbW2L9Y+Pj8e9e/fg5eWlbCs6XKOrq4ubN2/CxcVFZR4DAwMYGBgUW5ZUKi1XzUTVnUSo+acXgJp/moffL1QbabJfa/Q34MGDBxg8eLByul+/fpBIJHj06JEmi1HS19dHhw4dEB0drWxTKBSIjo5We8vx5s2b4/Lly7hw4YLyNWzYMPTu3RsXLlyAo6NjueogIiIicWl0BKOgoKDY4RE9PT3k5+eXu4DAwED4+vqiY8eO6NSpE1avXo2srCzlVSUTJ06Eg4MDQkJCIJPJ0Lp1a5X5zczMAKBYOxEREWmPRgFDEARMmjRJ5ZRDTk4O3nvvPZVLVTW5THXMmDFISUnBggULkJiYiLZt2yIyMlI58PPBgwc81EhERFTDaBQwfH19i7W98847FS5i5syZmDlzptr3YmNjS503IiKiwusnIiIicWkUMMLDwyurDiIiIqpFeO6BiIiIRMeAQURERKJjwCAiIiLRMWAQERGR6BgwiIiISHQMGERERCQ6BgwiIiISHQMGERERiY4Bg4iIiETHgEFERESiY8AgIiIi0TFgEBERkegYMIiIiEh0DBhEREQkOgYMIiIiEh0DBhEREYmOAYOIiIhEx4BBREREomPAICIiItExYBAREZHoGDCIiIhIdLraLoCIiKg6CvrlsrZLqLCQUa5aWzcDBhERVYqEt7y1XULFjA/WdgU1Gk+REBERkegYMIiIiEh0DBhEREQkOgYMIiIiEh0DBhEREYmOAYOIiIhEx4BBREREomPAICIiItExYBAREZHoGDCIiIhIdAwYREREJDoGDCIiIhIdAwYRERGJjgGDiIiIRMeAQURERKJjwCAiIiLRMWAQERGR6BgwiIiISHQMGERERCQ6BgwiIiISHQMGERERiY4Bg4iIiETHgEFERESiY8AgIiIi0TFgEBERkegYMIiIiEh01SJgrF27FnK5HDKZDO7u7jhz5kyJfTdu3Iju3bvD3Nwc5ubm6NevX6n9iYiIqOppPWDs2LEDgYGBCA4Oxrlz5+Dm5gZPT08kJyer7R8bGwsfHx/ExMQgLi4Ojo6OGDBgAP75558qrpyIiIhKovWAERoaimnTpsHPzw8tW7bEhg0bYGhoiLCwMLX9t27diunTp6Nt27Zo3rw5fvjhBygUCkRHR1dx5URERFQSXW2uPC8vD2fPnkVQUJCyTSqVol+/foiLiyvTMrKzs5Gfnw8LCwu17+fm5iI3N1c5nZGRAQBQKBRQKBQVqJ6oehIkEm2XIAJB2wVUGL9fasO+yP2wIsvTasBITU1FYWEhbGxsVNptbGxw48aNMi1jzpw5sLe3R79+/dS+HxISgkWLFhVrT0lJQU5OjuZFlyApZIloy9KWyJ5jtV1Chfl2kWu7BK3LdHDQdgkVZoZsbZdQYSWd5q1Lavq+yP2wuMzMzDL31WrAqKglS5Zg+/btiI2NhUwmU9snKCgIgYGByumMjAw4OjrCysoKJiYmotWSXQvGgKTBUNslVJi1tbW2S9A67ovVA/fFmr8vcj8srqTfWnW0GjAsLS2ho6ODpKQklfakpCTY2tqWOu+KFSuwZMkSHD58GG3atCmxn4GBAQwMDIq1S6VSSKXiDUGRCDX/UBpQ0w9nQtQ/05qK+2L1wH2xNuyL3A8rsjyt/g3Q19dHhw4dVAZoFg3Y9PDwKHG+ZcuWYfHixYiMjETHjh2rolQiIiLSgNZPkQQGBsLX1xcdO3ZEp06dsHr1amRlZcHPzw8AMHHiRDg4OCAkJAQAsHTpUixYsADbtm2DXC5HYmIiAMDIyAhGRkZa+xxERET0P1oPGGPGjEFKSgoWLFiAxMREtG3bFpGRkcqBnw8ePFA5JLN+/Xrk5eXB29tbZTnBwcFYuHBhVZZOREREJdB6wACAmTNnYubMmWrfi42NVZm+d+9e5RdEREREFcJRSERERCQ6BgwiIiISHQMGERERiY4Bg4iIiETHgEFERESiY8AgIiIi0TFgEBERkegYMIiIiEh0DBhEREQkOgYMIiIiEh0DBhEREYmOAYOIiIhEx4BBREREomPAICIiItExYBAREZHoGDCIiIhIdAwYREREJDoGDCIiIhIdAwYRERGJjgGDiIiIRMeAQURERKJjwCAiIiLRMWAQERGR6BgwiIiISHQMGERERCQ6BgwiIiISHQMGERERiY4Bg4iIiETHgEFERESiY8AgIiIi0TFgEBERkegYMIiIiEh0DBhEREQkOgYMIiIiEh0DBhEREYmOAYOIiIhEx4BBREREomPAICIiItExYBAREZHoGDCIiIhIdAwYREREJDoGDCIiIhIdAwYRERGJjgGDiIiIRMeAQURERKJjwCAiIiLRMWAQERGR6BgwiIiISHQMGERERCQ6BgwiIiISHQMGERERia5aBIy1a9dCLpdDJpPB3d0dZ86cKbX/rl270Lx5c8hkMri6uuLgwYNVVCkRERGVhdYDxo4dOxAYGIjg4GCcO3cObm5u8PT0RHJystr+J0+ehI+PD6ZMmYLz589jxIgRGDFiBK5cuVLFlRMREVFJtB4wQkNDMW3aNPj5+aFly5bYsGEDDA0NERYWprb/119/jYEDB+Ljjz9GixYtsHjxYrRv3x7ffvttFVdOREREJdHV5srz8vJw9uxZBAUFKdukUin69euHuLg4tfPExcUhMDBQpc3T0xP79u1T2z83Nxe5ubnK6fT0dABAWloaFApFBT/B/2QUFIi2LG3Jzc7UdgkVlpaWpu0StI77YvXAfbHm74vcD4vLyMgAAAiC8Nq+Wg0YqampKCwshI2NjUq7jY0Nbty4oXaexMREtf0TExPV9g8JCcGiRYuKtTs5OZWz6lrs1/3arqDCVmm7ABIH90WqDrgfligzMxOmpqal9tFqwKgKQUFBKkc8FAoFnj59igYNGkAikWixsuolIyMDjo6O+Pvvv2FiYqLtcmokbkNxcDtWHLdhxXEbqicIAjIzM2Fvb//avloNGJaWltDR0UFSUpJKe1JSEmxtbdXOY2trq1F/AwMDGBgYqLSZmZmVv+hazsTEhH+ZKojbUBzcjhXHbVhx3IbFve7IRRGtDvLU19dHhw4dEB0drWxTKBSIjo6Gh4eH2nk8PDxU+gNAVFRUif2JiIio6mn9FElgYCB8fX3RsWNHdOrUCatXr0ZWVhb8/PwAABMnToSDgwNCQkIAAP7+/ujZsydWrlyJIUOGYPv27fjrr7/w/fffa/NjEBER0Uu0HjDGjBmDlJQULFiwAImJiWjbti0iIyOVAzkfPHgAqfR/B1q6dOmCbdu2Yd68efj000/RpEkT7Nu3D61bt9bWR6gVDAwMEBwcXOx0EpUdt6E4uB0rjtuw4rgNK04ilOVaEyIiIiINaP1GW0RERFT7MGAQERGR6BgwiIiISHQMGERERCQ6Bow6ZO3atZDL5ZDJZHB3d8eZM2dK7b9r1y40b94cMpkMrq6uOHjwYBVVWn1psg0jIiIgkUhUXjKZrAqrrX6OHTsGLy8v2NvbQyKRlPgMoZfFxsaiffv2MDAwQOPGjREREVHpdVZ3mm7H2NjYYvuiRCIp8RELtV1ISAjefPNNGBsbw9raGiNGjMDNmzdfOx+/EzXDgFFH7NixA4GBgQgODsa5c+fg5uYGT09PJCcnq+1/8uRJ+Pj4YMqUKTh//jxGjBiBESNG4MqVK1VcefWh6TYEXtwF8PHjx8rX/fv3q7Di6icrKwtubm5Yu3ZtmfonJCRgyJAh6N27Ny5cuICAgABMnToVhw4dquRKqzdNt2ORmzdvquyP1tbWlVRh9Xb06FHMmDEDp06dQlRUFPLz8zFgwABkZWWVOA+/E8tBoDqhU6dOwowZM5TThYWFgr29vRASEqK2/+jRo4UhQ4aotLm7uwv/+c9/KrXO6kzTbRgeHi6YmppWUXU1DwBh7969pfb55JNPhFatWqm0jRkzRvD09KzEymqWsmzHmJgYAYDw7NmzKqmppklOThYACEePHi2xD78TNccjGHVAXl4ezp49i379+inbpFIp+vXrh7i4OLXzxMXFqfQHAE9PzxL713bl2YYA8Pz5czg5OcHR0RHDhw/H1atXq6LcWoP7objatm0LOzs79O/fHydOnNB2OdVGeno6AMDCwqLEPtwXNceAUQekpqaisLBQo8fcJyYmatS/tivPNmzWrBnCwsKwf/9+/PTTT1AoFOjSpQsePnxYFSXXCiXthxkZGfj333+1VFXNY2dnhw0bNmDPnj3Ys2cPHB0d0atXL5w7d07bpWmdQqFAQEAAunbtWuodofmdqDmt3yqcqLby8PBQeQhfly5d0KJFC3z33XdYvHixFiujuqZZs2Zo1qyZcrpLly6Ij4/HqlWrsGXLFi1Wpn0zZszAlStX8Mcff2i7lFqHRzDqAEtLS+jo6Gj0mHtbW1uN+td25dmGr9LT00O7du1w586dyiixVippPzQxMUG9evW0VFXt0KlTpzq/L86cORO//fYbYmJi0LBhw1L78jtRcwwYdYC+vj46dOig8ph7hUKB6OjoEh9z7+HhodIfAKKiokrsX9uVZxu+qrCwEJcvX4adnV1llVnrcD+sPBcuXKiz+6IgCJg5cyb27t2LI0eOwNnZ+bXzcF8sB22PMqWqsX37dsHAwECIiIgQrl27Jrz77ruCmZmZkJiYKAiCIEyYMEGYO3eusv+JEycEXV1dYcWKFcL169eF4OBgQU9PT7h8+bK2PoLWaboNFy1aJBw6dEiIj48Xzp49K4wdO1aQyWTC1atXtfURtC4zM1M4f/68cP78eQGAEBoaKpw/f164f/++IAiCMHfuXGHChAnK/nfv3hUMDQ2Fjz/+WLh+/bqwdu1aQUdHR4iMjNTWR6gWNN2Oq1atEvbt2yfcvn1buHz5suDv7y9IpVLh8OHD2voIWvX+++8LpqamQmxsrPD48WPlKzs7W9mH34kVx4BRh3zzzTfCG2+8Iejr6wudOnUSTp06pXyvZ8+egq+vr0r/nTt3Ck2bNhX09fWFVq1aCQcOHKjiiqsfTbZhQECAsq+NjY0wePBg4dy5c1qouvooulzy1VfRdvP19RV69uxZbJ62bdsK+vr6QqNGjYTw8PAqr7u60XQ7Ll26VHBxcRFkMplgYWEh9OrVSzhy5Ih2iq8G1G07ACr7Fr8TK46PayciIiLRcQwGERERiY4Bg4iIiETHgEFERESiY8AgIiIi0TFgEBERkegYMIiIiEh0DBhEREQkOgYMIiIiEh0DBhFVG3K5HKtXr9Z2GUQkAgYMIiIiEh0DBhEREYmOAYOIRPH999/D3t4eCoVCpX348OGYPHky4uPjMXz4cNjY2MDIyAhvvvkmDh8+XOLy7t27B4lEggsXLijb0tLSIJFIEBsbq2y7cuUKBg0aBCMjI9jY2GDChAlITU0V++MRkYYYMIhIFG+//TaePHmCmJgYZdvTp08RGRmJ8ePH4/nz5xg8eDCio6Nx/vx5DBw4EF5eXnjw4EG515mWloY+ffqgXbt2+OuvvxAZGYmkpCSMHj1ajI9ERBWgq+0CiKh2MDc3x6BBg7Bt2zb07dsXALB7925YWlqid+/ekEqlcHNzU/ZfvHgx9u7di19//RUzZ84s1zq//fZbtGvXDl999ZWyLSwsDI6Ojrh16xaaNm1asQ9FROXGIxhEJJrx48djz549yM3NBQBs3boVY8eOhVQqxfPnzzF79my0aNECZmZmMDIywvXr1yt0BOPixYuIiYmBkZGR8tW8eXMAQHx8vCifiYjKh0cwiEg0Xl5eEAQBBw4cwJtvvonjx49j1apVAIDZs2cjKioKK1asQOPGjVGvXj14e3sjLy9P7bKk0hf//hEEQdmWn5+v0uf58+fw8vLC0qVLi81vZ2cn1scionJgwCAi0chkMowaNQpbt27FnTt30KxZM7Rv3x4AcOLECUyaNAkjR44E8CIc3Lt3r8RlWVlZAQAeP36Mdu3aAYDKgE8AaN++Pfbs2QO5XA5dXX6dEVUnPEVCRKIaP348Dhw4gLCwMIwfP17Z3qRJE/zyyy+4cOECLl68iHHjxhW74uRl9erVQ+fOnbFkyRJcv34dR48exbx581T6zJgxA0+fPoWPjw/+/PNPxMfH49ChQ/Dz80NhYWGlfUYiej0GDCISVZ8+fWBhYYGbN29i3LhxyvbQ0FCYm5ujS5cu8PLygqenp/LoRknCwsJQUFCADh06ICAgAF988YXK+/b29jhx4gQKCwsxYMAAuLq6IiAgAGZmZspTLESkHRLh5ROcRERERCJgxCciIiLRMWAQERGR6BgwiIiISHQMGERERCQ6BgwiIiISHQMGERERiY4Bg4iIiETHgEFERESiY8AgIiIi0TFgEBERkegYMIiIiEh0/w8VPdju7OYfjQAAAABJRU5ErkJggg==", + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + " ➜ Figure saved to plots/discrete_pmf.png\n" + ] + } + ], + "source": [ + "def example_discrete_pmf() -> None:\n", + " print(\"\\n=== Example 3: Discrete distribution (DGT) ===\")\n", + " print(\n", + " \"Goal: demonstrate sampling of a discrete PMF using method DGT without\"\n", + " \" relying on registry characteristics.\"\n", + " )\n", + " pmf = {0: 0.2, 1: 0.5, 2: 0.3}\n", + "\n", + " distr = CustomDistribution(\n", + " name=\"Discrete weighted\",\n", + " kind=Kind.DISCRETE,\n", + " analytical_computations={\n", + " CharacteristicName.PMF: AnalyticalComputation(\n", + " target=CharacteristicName.PMF,\n", + " func=lambda x, **_: pmf.get(int(x), 0.0),\n", + " )\n", + " },\n", + " sampling_strategy=DefaultUnuranSamplingStrategy(\n", + " default_config=UnuranMethodConfig(\n", + " method=UnuranMethod.DGT,\n", + " use_registry_characteristics=False,\n", + " )\n", + " ),\n", + " parameters={\"pmf\": pmf},\n", + " )\n", + "\n", + " data = distr.sample(20_000).array.flatten()\n", + " unique, counts = np.unique(data, return_counts=True)\n", + " print(\"Observed frequencies:\")\n", + " for value, freq in zip(unique, counts / counts.sum(), strict=False):\n", + " print(f\" value {int(value)} → {freq:.3f} (expected: {pmf[int(value)]})\")\n", + "\n", + " _plot_discrete_pmf(\"Discrete distribution (PMF)\", pmf, data, \"discrete_pmf.png\")\n", + "\n", + "\n", + "example_discrete_pmf()" + ] + }, + { + "cell_type": "markdown", + "id": "0027a8fd", + "metadata": {}, + "source": [ + "### Example 4 – AUTO vs PINV override\n", + "Goal: compare AUTO vs an explicit PINV override on the same Gaussian distribution.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "ec91c92c", + "metadata": { + "name": "example4" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "=== Example 4: Overriding the method per sample() call ===\n", + "Goal: compare AUTO vs an explicit PINV override on the same Gaussian distribution.\n", + "Expected mean ≈ 0.000, std ≈ 1.000 for both methods.\n", + "AUTO: mean=0.018, std=0.999\n", + "PINV: mean=-0.014, std=1.003\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAiEAAAGJCAYAAABcsOOZAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjgsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvwVt1zgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAeXJJREFUeJzt3Xl4U1X6wPFvkjZJ94XupdBS9rXIUkEUxWpRZxSXERmVRWQcBR2n4gIqiOKAjjKo44AyAuLuz3FHQahUVJB9k00oS4HSDbovSZt7f3+URkJbaEva26Tv53nyQG7OPXlPkyZvzzn3HJ2qqipCCCGEEC1Mr3UAQgghhGibJAkRQgghhCYkCRFCCCGEJiQJEUIIIYQmJAkRQgghhCYkCRFCCCGEJiQJEUIIIYQmJAkRQgghhCYkCRFCCCGEJiQJEaKNuPLKK7nyyiubfL5Op+OZZ56x31+6dCk6nY4jR45cdGwXMn78eGJjY+33jxw5gk6n46WXXmr25wZ45pln0Ol0LfJczvLAAw9wzTXXaPLcd9xxB7fffrsmzy1ciyQhQpxR86VqNps5ceJErcevvPJKevfurUFk7qOsrIxnnnmGtLQ0rUOppbXGptPp0Ol0vPzyy7Ueq3nPbt682eH44cOH+e9//8v06dNrnfPWW2/Ro0cPzGYzXbp04bXXXmtwLM8//zw33ngj4eHhtZLSsz3++OP873//Y8eOHQ2uW7RNkoQIcQ6LxcLcuXO1DqPVu/vuuykvL6djx44NPqesrIxZs2Y1+ot+0aJF7N+/v5ERNs75YnvqqacoLy9v1ue/kH/+85+UlZU1qOwrr7xCXFwcV111lcPxN954g3vvvZdevXrx2muvMWTIEB566CFeeOGFBtX71FNPsWnTJvr373/ecv3792fgwIF1Jk5CnE2SECHOkZCQwKJFi8jMzGy251BVVfMvtYtlMBgwm83NOkxRWloKgKenJyaTqdme50I8PDwwm82aPX9CQgLZ2dksXLjwgmUrKyt57733ag2HlJeX8+STT3LDDTfwySefMGnSJJYtW8add97Jc889R35+/gXrPnz4MCdPnuTdd9+9YNnbb7+dTz/9lJKSkguWFW2XJCFCnGP69OnYbLYG9YZUVVXx3HPPER8fj8lkIjY2lunTp2OxWBzKxcbG8oc//IGVK1cycOBAvLy8eOONN0hLS0On0/Hxxx8za9YsoqOj8fPz47bbbqOwsBCLxcLDDz9MWFgYvr6+TJgwoVbdS5YsYcSIEYSFhWEymejZsycLFixocvstFgt///vfCQ0Nxc/PjxtvvJHjx4/XKlfXnJDNmzeTnJxMSEgIXl5exMXFcc899wDV8zhCQ0MBmDVrln2YoaZLf/z48fj6+pKens7111+Pn58fd955p/2xs+eEnO1f//oXHTt2xMvLi+HDh/Prr786PF7fXJiz67xQbHXNCWnsa//TTz8xePBgzGYznTp1YtmyZXW2py6XXXYZI0aM4MUXX7xg8vrTTz+Rl5dHUlKSw/E1a9Zw6tQpHnjgAYfjkydPprS0lOXLl18wjvpeg7pcc801lJaWsmrVqgafI9oeD60DEKK1iYuLY+zYsSxatIgnnniCqKioesvee++9vP3229x222088sgjbNiwgTlz5rB3714+++wzh7L79+9nzJgx3HfffUyaNIlu3brZH5szZw5eXl488cQTHDx4kNdeew1PT0/0ej35+fk888wz/PLLLyxdupS4uDhmzJhhP3fBggX06tWLG2+8EQ8PD7766iseeOABFEVh8uTJjW7/vffey7vvvsuf//xnhg4dyvfff88NN9xwwfNycnK49tprCQ0N5YknniAwMJAjR47w6aefAhAaGsqCBQu4//77ufnmm7nlllsA6Nu3r72OqqoqkpOTGTZsGC+99BLe3t7nfc5ly5ZRXFzM5MmTqaio4JVXXmHEiBHs2rWL8PDwBre5IbGdqzGv/cGDB7ntttuYOHEi48aNY/HixYwfP54BAwbQq1evBsX4zDPPcMUVV7BgwQJSUlLqLbdu3Tp0Ol2tIZNt27YBMHDgQIfjAwYMQK/Xs23bNu66664GxdIQPXv2xMvLi59//pmbb77ZafUKN6MKIVRVVdUlS5aogLpp0yY1PT1d9fDwUB966CH748OHD1d79eplv799+3YVUO+9916HeqZOnaoC6vfff28/1rFjRxVQV6xY4VB2zZo1KqD27t1btVqt9uNjxoxRdTqdet111zmUHzJkiNqxY0eHY2VlZbXakpycrHbq1Mnh2PDhw9Xhw4ef92dQ06YHHnjA4fif//xnFVBnzpxpP1bz8zp8+LCqqqr62Wef2X9+9cnNza1VT41x48apgPrEE0/U+djZ7T58+LAKqF5eXurx48ftxzds2KAC6t///vcLtvvcOs8X28yZM9WzPy6b8tqvXbvWfiwnJ0c1mUzqI488Uuu5zgWokydPVlVVVa+66io1IiLC/pqf/Z6tcdddd6nt2rWrVc/kyZNVg8FQ53OEhoaqd9xxxwVjqXG+n9XZunbtWus9LMTZZDhGiDp06tSJu+++mzfffJOTJ0/WWeabb74BqPVX6SOPPAJQq3s7Li6O5OTkOusaO3Ysnp6e9vuJiYmoqmofyjj7+LFjx6iqqrIf8/Lysv+/sLCQvLw8hg8fzqFDhygsLLxQU+ts00MPPeRw/OGHH77guYGBgQB8/fXXVFZWNup5z3b//fc3uOyoUaOIjo623x88eDCJiYn2djSXxr72PXv25PLLL7ffDw0NpVu3bhw6dKhRz/vMM8+QlZV13rkhp06dIigoqNbx8vJyjEZjneeYzeZmmaMUFBREXl6e0+sV7kOSECHq8dRTT1FVVVXv3JCjR4+i1+vp3Lmzw/GIiAgCAwM5evSow/G4uLh6n6tDhw4O9wMCAgCIiYmpdVxRFIfk4ueffyYpKQkfHx8CAwMJDQ21X5rZ2CSkpk3x8fEOx88eOqrP8OHDufXWW5k1axYhISHcdNNNLFmypNYcifPx8PCgffv2DS7fpUuXWse6du3a7GuXNPa1P/f1heov6IZMBj3bFVdcwVVXXXXBuSGqqtY65uXlhdVqrbN8RUWFQzLrLKqqutz6KqJlSRIiRD06derEXXfddd7eEKDBH7Ln+5A3GAyNOl7zJZOens7VV19NXl4e8+bNY/ny5axatYq///3vACiK0qDYnEGn0/HJJ5+wfv16pkyZwokTJ7jnnnsYMGBAg6+QMJlM6PXO/Viq7/Wx2WzNVve5LvQ6NsbMmTPJysrijTfeqPPxdu3a1ZncREZGYrPZyMnJcThutVo5derUeec+NVV+fj4hISFOr1e4D0lChDiPmt6QutZR6NixI4qicODAAYfj2dnZFBQUNGr9jKb66quvsFgsfPnll9x3331cf/31JCUlNfmv2po2paenOxxvzBodl156Kc8//zybN2/mvffeY/fu3Xz44YdAw7+0G+rcnz3Ab7/95nAVR1BQEAUFBbXKndtb0ZjYtHzthw8fzpVXXskLL7xQZ29I9+7dyc/Pr9ULlpCQAFBrYbPNmzejKIr9cWepqqri2LFj9OjRw6n1CvciSYgQ5xEfH89dd93FG2+8QVZWlsNj119/PQDz5893OD5v3jyABl1RcrFq/sI++y/qwsJClixZ0qT6rrvuOgBeffVVh+PntrEu+fn5tf6yr/liqxmSqbnapa6koCk+//xzh9VtN27cyIYNG+ztgOrXcN++feTm5tqP7dixg59//tmhrsbEpvVrXzM35M0336z12JAhQ1BVlS1btjgcHzFiBMHBwbUu316wYAHe3t5Oj3nPnj1UVFQwdOhQp9Yr3ItcoivEBTz55JO888477N+/3+Fyyn79+jFu3DjefPNNCgoKGD58OBs3buTtt99m1KhRtVarbA7XXnstRqORP/7xj9x3332UlJSwaNEiwsLCzjuEVJ+EhATGjBnDf/7zHwoLCxk6dCipqakcPHjwgue+/fbb/Oc//+Hmm28mPj6e4uJiFi1ahL+/v/1L28vLi549e/LRRx/RtWtXgoOD6d27d5OXw+/cuTPDhg3j/vvvx2KxMH/+fNq1a8djjz1mL3PPPfcwb948kpOTmThxIjk5OSxcuJBevXpRVFRkL9eY2LR+7YcPH87w4cP54Ycfaj02bNgw2rVrx+rVqxkxYoRD+5577jkmT57Mn/70J5KTk/nxxx959913ef755wkODraXTUtL46qrrmLmzJkOS7O/8847HD161L5y69q1a5k9ezZQvYLu2T1Aq1atwtvbW7P9a4SL0O7CHCFal7oud6xRc/no2ZfoqqqqVlZWqrNmzVLj4uJUT09PNSYmRp02bZpaUVHhUK5jx47qDTfcUKvemkt0/+///q9BsdRcKpqbm2s/9uWXX6p9+/ZVzWazGhsbq77wwgvq4sWLHS6fVdWGXaKrqqpaXl6uPvTQQ2q7du1UHx8f9Y9//KN67NixC16iu3XrVnXMmDFqhw4dVJPJpIaFhal/+MMf1M2bNzvUv27dOnXAgAGq0Wh0qHPcuHGqj49PnTHVd4nuP//5T/Xll19WY2JiVJPJpF5++eXqjh07ap3/7rvvqp06dVKNRqOakJCgrly5slad54vt3Et0VfXiX/uGvh6cdYnu2WreO3W9Tx566CG1c+fOddb35ptvqt26dVONRqMaHx+v/utf/1IVRXEo89VXX6mAunDhwlox1zznubc1a9Y4lE1MTFTvuuuuC7ZPtG06VW3CzCghhBCt1qFDh+jevTvffvstV199daPPf+yxx/jggw84ePBgk5bL3759O5dccglbt251+lwT4V4kCRFCCDd0//33c/DgwSYtmz5o0CAmTZrEX/7ylyY99x133IGiKHz88cdNOl+0HZKECCGEEEITcnWMEEIIITQhSYgQQgghNCFJiBBCCCE0IUmIEEIIITQhi5XVQVEUMjMz8fPzk82XhBBCiEZQVZXi4mKioqIuuBeUJCF1yMzMrLV7qRBCCCEa7tixYxfcFVuSkDr4+fkB1T9Af39/p9SpKAq5ubmEhoY6fZdQrUibXIO0qfVzt/aAtMlVNEebioqKiImJsX+Xno8kIXWoGYLx9/d3ahJSUVGBv7+/W715pU2tn7Sp9XO39oC0yVU0Z5saMp3BPX6KQgghhHA5koQIIYQQQhOShAghhBBCEzInRAghRIuy2WxUVlZqHUajKYpCZWUlFRUVbjUnpLFtMhgMeHh4OGUJC0lChBBCtJiSkhKOHz+OK+6dqqoqiqJQXFzsNmtINbVN3t7eREZGYjQaL+r5JQkRQgjRImw2G8ePH8fb25vQ0FCX+yJXVZWqqiqn9QK0Bo1tk6qqWK1WcnNzOXz4MF26dLmoXiFJQoQQQrSIyspKVFUlNDQULy8vrcNpNElCqnl5eeHp6cnRo0exWq2YzeYmP797DGoJIYRwGe7yBd6WOWtOjCQhQgghhNCEJCFCCCGE0IQkIUIIIcRFuvLKK3n44YdbfZ2tjSQhQohW7/nlexxuc77Zy8ebMrQOS7QR48ePZ9SoUVqHUcvSpUvR6XTodDr0ej3t27dnwoQJ5OTk2MvUPK7T6fDx8aFLly6MHz+eLVu2ONSVlpbmULbm9tRTTzVrG+TqGCGEEMJF+fv7s3//fhRFYceOHUyYMIHMzExWrlxpL7NkyRJGjhxJRUUFv/32G2+++SaJiYksXryYu+++26G+/fv3O2zc6uvr26zxS0+IEEIITaiqilJWpsntYhZLKy0tZezYsfj6+hIZGcnLL79cq4zFYmHq1KlER0fj4+NDYmIiaWlp9sdPnTrFmDFjiI6Oxtvbmz59+vDBBx80OhadTkdERARRUVFcd911PPTQQ6xevZry8nJ7mcDAQCIiIoiNjeXaa6/lk08+4c4772TKlCnk5+c71BcWFkZERIT91txJiPSECCGE0IRaXs7+SwZo8tzdtm5B5+3dpHMfffRRfvjhB7744gvCwsKYPn06W7duJSEhwV5mypQp7Nmzhw8//JCoqCg+++wzRo4cya5du+jSpQsVFRUMGDCAxx9/HH9/f5YvX87dd99NfHw8gwcPbnK7vLy8UBSFqqqq85b7+9//zrJly1i1ahW33HJLk5/vYkkSIoQQQjRQSUkJixcv5t133+Xqq68G4O2336Z9+/b2MhkZGSxZsoSMjAyioqIAmDp1KitWrGDJkiX84x//IDo6mqlTp9rPefDBB1m5ciUff/xxk5OQAwcOsHDhQgYOHIifn995y3bv3h2AI0eOOBw/ux0AR48epV27dk2KpyEkCRFCtJx1r9X/2NAHWy4O0SrovLzotnXLhQs203M3RXp6OlarlcTERPux4OBgunXrZr+/a9cubDYbXbt2dTjXYrHYv9BtNhv/+Mc/+Pjjjzlx4gRWqxWLxYJ3I3tnCgsL8fX1RVEUKioqGDZsGP/9738veF7NcNS5C8f9+OOPDglMUFBQo+JpLElChBBCaEKn0zV5SKQ1KykpwWAwsGXLFgwGg8NjNXMs/vnPf/LKK68wf/58+vTpg4+PDw8//DBWq7VRz+Xn58fWrVvR6/VERkY2eDn8vXv3AhAXF+dwPC4ujsDAwEbFcDFaxcTU119/ndjYWMxmM4mJiWzcuLFB53344YfodLpal06pqsqMGTPsL0hSUhIHDhxohsiFEEK0JfHx8Xh6erJhwwb7sfz8fH777Tf7/f79+2Oz2cjJyaFz584Ot4iICAB+/vlnbrrpJu666y769etHp06dHOpoKL1eT+fOnenUqVOj9uOZP38+/v7+JCUlNfo5nUnzJOSjjz4iJSWFmTNnsnXrVvr160dycrLDdc51OXLkCFOnTuXyyy+v9diLL77Iq6++ysKFC9mwYQM+Pj4kJydTUVHRXM0QQgjRBvj6+nLPPffw6KOP8v333/Prr78yfvx4h71Uunbtyp133snYsWP59NNPOXz4MBs3bmTOnDksX74cgC5durBq1SrWrVvH3r17ue+++8jOzm6WmAsKCsjKyuLo0aOsWrWK2267jffff58FCxa0aK9HXTQfjpk3bx6TJk1iwoQJACxcuJDly5ezePFinnjiiTrPsdls3HnnncyaNYsff/yRgoIC+2OqqjJ//nyeeuopbrrpJgCWLVtGeHg4n3/+OXfccUet+iwWCxaLxX6/qKgIAEVRUBTFKe1UFKX6cjQn1dcaSJtcQ6tq0/muijxffOdeTqmqoKrMWb4H6tkMbdr1PRofn0Za1WvkJHW1qeZYzc0VqarKP//5T0pLS/njH/+In58fKSkpFBYWOrRr8eLFzJ49m0ceeYQTJ04QEhLCpZdeyg033ICqqjz55JMcOnSI5ORkvL29mTRpEqNGjbLXc/bz1fezqjl+oZ9lzfer2WwmOjqaYcOGsWHDBi655JJa5zf0takpV9f3ZGPexzpVw3eC1WrF29ubTz75xGFIZdy4cRQUFPDFF1/Ued7MmTPZuXMnn332GePHj6egoIDPP/8cgEOHDhEfH8+2bdscLpcaPnw4CQkJvPLKK7Xqe+aZZ5g1a1at47/99tsFZxg3lKIoFBYWEhAQ4LTdB7UmbXINrapNe7+u/7Eef6j3oU/X7iVs1xb8jx/BJycTj/JS8PSkJCSS0116cqpLL6z+gQ7n3D6og5OCbn6t6jVykrraVFlZSWFhIR07dryo7d+1oqoqNpsNg8HgNjsBN7VNFRUVHD16lICAADw9PR0eKy4upmvXrhQWFjosfFYXTXtC8vLysNlshIeHOxwPDw9n3759dZ7z008/8dZbb7F9+/Y6H8/KyrLXcW6dNY+da9q0aaSkpNjvFxUVERMTQ2ho6AV/gA2lKAo6nY7Q0FC3+pCRNrV+rapN6eX1PjRn86lax3zysujx3UdcsfMXDFWVtR73P5pO1JafUPR6jicMY/+ImymOiAGqF11yFa3qNXKSutpUUVFBcXExHh4eeHho3hHfZOd+6bqDxrbJw8MDvV5Pu3btaiWUjUkwXepdUFxczN13382iRYsICQlxWr0mkwmTyVTruF6vd+oHQs36/u7yIQPSJlfRatp0vj+0zvorTF9ppfuq/6NL2pcYbNWLLhVGxJDVYwDF4e2x+AbgW1GAOTOTsN92EnQ8nQ5b1xKz7UcOXPFH9lw3Rvu2NlKreY2c6Nw26fV6h31JXI2qqva4XTH+ujS1TWfvWXPue7Yx72FNk5CQkBAMBkOtyTjZ2dn2GcRnS09P58iRI/zxj3+0H6sZe/Lw8GD//v3287Kzs4mMjHSo8+zhGSFE6+SVn0fi2/8k+NhBALK79mPPdWPIj+n8e6KiqpSppRQn+LD7hrsIPJZOt9T/Eb1rA11/+JLw/dux9F2AqVMnDVsihLgQTVNuo9HIgAEDSE1NtR9TFIXU1FSGDBlSq3z37t3ZtWsX27dvt99uvPFGrrrqKrZv305MTAxxcXFEREQ41FlUVMSGDRvqrFMI0XoEHf2Nq+Y/SvCxg1i8ffll/GP8/Jenye/Qpd4JqAAFMfFsGP8Y6+55ggrfAAKyMjg65s+UbdvWgtELIRpL8+GYlJQUxo0bx8CBAxk8eDDz58+ntLTUPpt37NixREdHM2fOHMxmM71793Y4v+byorOPP/zww8yePZsuXboQFxfH008/TVRUVKvcilkIUS3o6G8Me+NZPC3lFETF8cv4RylrF37hE8+S1WsQqVO7MmTxHIIzDnDo7vH8Mv5Rsntc4lDuyRt6OjN0IUQTaZ6EjB49mtzcXGbMmEFWVhYJCQmsWLHCPrE0IyOj0WOkjz32GKWlpfzlL3+hoKCAYcOGsWLFCpecjS1EW1B+KJthbyzB01JObnwv1k2cjs104d/Xwdkf1DnN5Me/PkPiOy8TsXcriW//k5/um8npuO7OD1wIcVE0T0KgerfBKVOm1PnY2Vsf12Xp0qW1jul0Op599lmeffZZJ0QnhGhOlXnFHHvlGzwt5VhiQqn8Q2cG5n9qf3xDxJ8bXafNZGb9hMcZsnguEfu2MfStOfww5TmKI1znsl0h2gL3mYYthHA5SkUlx179BltxOdawAE7dMhTV6Jy/jVSDBxvGTuVUx64Yy0sYsngunuWlTqlbCOEckoQIITShqiqZi7/HcvwUBn8vTt/svASkhs1kZv3E6ZQGh+F7KpsBH7x2/pVZhRAtqlUMxwgh2p6CH/dSvDkdDHraT7mOjMrmWXfB6uPHhrFTGf7adKJ2b6Jr2hfwx94XPlG0mOeX72nR55OJya2H9IQIIVqc5WQ+2e//BEDYLYl4d669LpAzFcTEs+PmiQD0/PYDKs5sYy5EY6xfvx6z2cwf/uC4xUBaWho6nc5hH7MasbGxzJ8/n6VLlzos1FbX7ciRIwCcPn2ahx9+mI4dO2I0GomKiuKee+4hIyOjBVrZsiQJEUK0KNWmkLloNaq1Cu8e7QlOTmiR5z1y6TWc6JOIXrGROW06qtXaIs8r3Mdbb73F5MmTWbt2LZmZmY06d/To0Zw8edJ+GzJkCJMmTXI4FhMTw+nTp7n00ktZvXo1Cxcu5ODBg3z44YccPHiQQYMGcejQoWZqnTZkOEYI0aJOp+6i4kguem8TUfeOQKdvoeWvdTq233ofIYf2wr595C1cSOhDD7XMcwuXV1JSwscff8z69evJyclh6dKlTJ8+vcHne3l54eXlZb9vNBrx9vautTr4k08+SWZmJgcPHrQ/1qFDB1auXEmXLl2YPHky3377rXMa1QpIT4gQosVU5hWT++kGAML+NATPIN8WfX6LXwDbb50EQN6bi7Ckp7fo8wvX9fHHH9O9e3e6devGnXfeyeLFixu05X1jKIrChx9+yJ133lkrOfHy8uKBBx5g5cqVnD592qnPqyVJQoQQLUJVVbLeXYtqrcKraySBl/fQJI4T/YbiO2IEVFWRNXu2079IhHt66623uPPOOwEYOXIkhYWF/PDDD059jtzcXAoKCujRo+7fjR49eqCqKgcPHnTq82pJkhAhRIsoXbuWkp1HUfU6jgzrTer+HFbvzbbfWlL49GnoTCbK1v9C8cqVLfrcwvXs37+fjRs3MmbMGKB6w9TRo0fz1ltvNcvztaXEWJIQIUSzUysryX7hRQBKBnSmqp2/pvEY27en3aTqYZnsuS+glJdrGo9o3d566y2qqqqIjo7Gy8sLT09PFixYwP/+9z8KCwvx969+PxcWFtY6t6CggICAgAY9T2hoKIGBgeyt5+qtvXv3otPp6Ny5c9Mb08rIxFQhhPOte83hbn7qLqyHDmHzMlI8pHHDMIlZ79c6pgI2Y8M+2OvT7t6JFH72GZUnTnB62TuE3PeXi6pPuKeqqiqWLVvGyy+/zDXXXENVVRUeHh7odDpGjRrFBx98wJ133oler2fLli107NjRfu6hQ4coLCyka9euDXouvV7P7bffznvvvcezzz7rMC+kvLyc//znPyQnJxMcHOz0dmpFkhAhRLOylVnI+3wjAMWX9UQ1eTb7c9aVuNSo2YtGbzYT+vDDZD76KKcWLSLw9j/hERTU7LEJ1/L111+Tn5/PxIkT8ff3d0hCbr31Vt566y3++te/cu+99/LII4/g4eFBnz59OHbsGI8//jiXXnopQ4cObfDz/eMf/yA1NZVrrrmGF198kd69e3P48GGeeuopKisref3115uxtS1PkhAhRLM6/d0ObKUWjJFBlPaL0zocB/43XM+pxYux7N3LqYVvED7tCa1DapNa8wqmb731FklJSQQEBNSaq3Hrrbfy4osvsnPnTl555RXmzp3L448/ztGjR4mIiOCaa67h+eefR6dr+GXo7dq145dffuHZZ5/lvvvuIysri+DgYK677jreffddOnRwr00YJQkRQjSbquJyTn+3A4DQmwdzWN+6pqHp9HrCHnmEY/feS/777xM89m48o6O1Dku0Il999VW9jw0ePNghMXnmmWd45plnGlTv+XaIDwkJ4dVXX+XVV19taJguq3V9Iggh3MrpFdtRKioxdQjB75JOWodTJ5/LhuKdmIhaWUnem4u0DkeINkV6QoQQzaKqsIzTqbuA6v1hWmxl1EbS6XSETpnM0Q0bKPjk/wgZaMSznZ9joaEPahOcEG5OekKEEM3i9Kod1QuTxYfj06d1j2N7DxqEd/cosCnkfbNV63CEaDMkCRFCOJ2tzEL+mt0AtLv+kkZNzNNKyI2DACj8cS+Vp0s0jkaItkGSECGE0+Wn7UYpt2KMCsK3X6zW4TSIT/dovLtGoVYpnF61Q+twhGgTJAkRQjiVYrFwetVOANpd17/VzgWpS/B1CQAU/LAHW5lF22CEaAMkCRFCOFXh519gKyzDI9iXgMQuWofTKL59OmKMDEKpqKRgbd1LZwshnEeSECGE06g2G6cWV2/q1S65HzoPg8YRNY5OryM4uR8Ap1fvRK2yaRyREO5NkhAhhNMUr1pN5dEMDD4mAq9ovatg1mf13my2BAVi8zZRdbqEdV9sZfXebJ5fvkfr0IRwS7JOiBDCaU6/+w4AgVf1Rt8Ce8Q0Cw8Dpf3j8f95D76bD1DeI6Z6L5p14bXLyvohznHOhofNTl63VqNV9IS8/vrrxMbGYjabSUxMZOPGjfWW/fTTTxk4cCCBgYH4+PiQkJDAO++841Bm/Pjx6HQ6h9vIkSObuxlCtGkV+/ZRvnkLeHgQdFVvrcO5KKUJnVA8DBizCzAey9U6HNEKjB8/Hr1ej9FoxGQy0blzZ5599lmqqqpIS0tDp9NRUFAAYL/fq1cvbDbHIb3AwECWLl2K1WolJCSEuXPn1vl8zz33HOHh4VRWVjZ30zSleU/IRx99REpKCgsXLiQxMZH58+eTnJzM/v37CQsLq1U+ODiYJ598ku7du2M0Gvn666+ZMGECYWFhJCcn28uNHDmSJUuW2O+bTKYWaY8QbVX+e9U71/pdk4RnkI/G0VwcxdtEWe+O+G4/hO/WdE53CGP13uxa5TbkVw/TtOYN2ITzjBw5kjfffBObzca3337L5MmT8fT0ZMiQIXWWP3ToEMuWLWPChAm1HjMajdx1110sWbKEJ55w3DhRVVWWLl3K2LFj8fR00R7FBtK8J2TevHlMmjSJCRMm0LNnTxYuXIi3tzeLFy+us/yVV17JzTffTI8ePYiPj+dvf/sbffv25aeffnIoZzKZiIiIsN+CZItuIZqNrbCQwjMbfQXfeafG0ThHaf94AMwHT6IvLtM4GtEa1HyvdOzYkfvvv5+kpCS+/PLLess/+OCDzJw5E4ul7su9J06cyG+//Vbr++uHH37g0KFDTJw40anxt0aa9oRYrVa2bNnCtGnT7Mf0ej1JSUmsX7/+guerqsr333/P/v37eeGFFxweS0tLIywsjKCgIEaMGMHs2bNp165dnfVYLBaHN0lRUREAiqKgKEpTmlaLoiioquq0+loDaZNraLY2rX/d/t/8ldtRKyowxbTDVLEOpZ4VUtU6jzaeetat8SfX87NQHeurDPHH0j4E0/E8fHYcoWhYHb0dZ3ZQvdifbVt539Ucq7nZqc56ZzTQRTxfTdyqquLl5cWpU6ccjp3dtr/97W+8++67vPrqq0ydOtWhDlVV6d27N4MGDeKtt97isssusz++ZMkShg4dSrdu3Rx/Ts3k7Pgbc07N63vu+7Yx72NNk5C8vDxsNhvh4Y4TvsLDw9m3b1+95xUWFhIdHY3FYsFgMPCf//yHa665xv74yJEjueWWW4iLiyM9PZ3p06dz3XXXsX79egyG2pcMzpkzh1mzZtU6npubS0VFxUW08HeKolBYWIiqquhb2XbmTSVtcg3N1iarFwCqolD0ffUS7YYrLiG30pvtx/PrPscY4JSnVgHFo3rIp7FLofmppeTk5NR+wOqF7Zz4igb1JvR4Gt67jpA/PBEMjj8/P7UUoO76GqGtvO8qKytRFIWqqiqqqqrsZfUtnHwpZz13g88582Vrs9lQVZU1a9awcuVKJk+ebJ/3UdOumvtGo5GnnnqKp59+mgkTJhAQEGCvq6b948eP5/HHH2fevHn4+vpSXFzMJ598wr/+9S+Hn1FzUVXVHm9jtleoqqpCURROnTpVa8iouLi4wfVoPiekKfz8/Ni+fTslJSWkpqaSkpJCp06duPLKKwG444477GX79OlD3759iY+PJy0tjauvvrpWfdOmTSMlJcV+v6ioiJiYGEJDQ/H393dKzIqiVO/WGRrqVh8y0qbWr9nalF4OQMmOIxTkFaL3NhF9WSx6YzkGa6HznqcONX+vGayFjU5CinU+dc43I7123Ja4IGzeJjxKyvHds4/ybtG16gLqrq8R2sr7rqKiguLiYjw8PPDwOOvrp4XbrPdo/FefXq/nm2++ITQ01J5M/fnPf2bWrFls2rQJwN6umj92PTw8mDRpEvPnz+fll1/mH//4h72umvbfeeedTJ06lU8//ZR77rmH//3vf+j1esaMGeP4M2pmjZ174uHhgV6vp127dpjNZofHzr1/3noa9axOFhISgsFgIDvbccJXdnY2ERER9Z6n1+vp3LkzAAkJCezdu5c5c+bYk5BzderUiZCQEA4ePFhnEmIymeqcuKrX6536gaDT6Zxep9akTa6hWdp05tu/MK26FyTw8u54mD3PfqhZ6c66Ne5EHXO+rd3TmpiVXbsug56yvrH4/bIfn+3pVJyThHDmL0dn/FzbwvtOr9c7XLV4VsGWDqxJp1111VW8+uqreHt7Ex0dbU8Satpybtt0Oh2enp48//zzjB8/ngcffNChHEBAQAC33XYbS5cuZeLEiSxdupTbb78dPz+/i21lg6iq6hBvQ9W0oa73bGPew5q+241GIwMGDCA1NdV+TFEUUlNT651tXBdFUeqd+ANw/PhxTp06RWRk5EXFK4RwVHm6hJJdGQAEDu+lcTTNo7RvHKoOzBm5eJxueDezcD8+Pj507tyZDh06NKqX4k9/+hO9evWqc9gfqieo/vTTT3z99desW7euTUxIraH5cExKSgrjxo1j4MCBDB48mPnz51NaWmq/pGns2LFER0czZ84coHr+xsCBA4mPj8disfDNN9/wzjvvsGDBAgBKSkqYNWsWt956KxEREaSnp/PYY4/RuXNnh0t4hRAXr/DnfaCqeHeNwhQRqHU4zcIW4ENFp0i80k/is/0QhSP6aR2ScEFz586t9zvoiiuuoHPnzowdO5bu3bszdOjQFo5OO5onIaNHjyY3N5cZM2aQlZVFQkICK1assE9WzcjIcOjaKS0t5YEHHuD48eN4eXnRvXt33n33XUaPHg2AwWBg586dvP322xQUFBAVFcW1117Lc889J2uFCOFEqqJS8GP1Jm+BV/TQOJrmVZoQh1f6Sbz2ZFB4RW9wsT1xWr02sILpiBEjGDFiBN99912tx3Q6Hffccw/Tp093uFq0LdCpLXH9j4spKioiICCAwsJCp05MzcnJISwszG3GfKVNrqG52lS66DEyXv4KvZeRLvPGOSzTXtfCXs6kAjZjQJMmpm6I+HOdxxOz3q//JEUl4o1vMJRUcOrGRCq6tXeo62IXK2sr77uKigoOHz5MXFxcoyYvthaqqlJVVYWHh0ej5k+0Zk1t0/ley8Z8h2reEyKEcE37lm/DGyjq1p7vD53WOpzmpddR1qsjfhv24/PrUXsSIoS4OO6RcgshWlRVfj5eBzIBKOsbp3E0LaO0T0cATIez0BeXaxyNEO5BekKEEI1W9OWX6GwK1rBAKsMDtQ6nUc477HIetiA/LNHtMJ04hfeeDEoSuzk5MiHaHukJEUI0WsH/PgWgrE+stoG0sJr2+uw60vJLjQvhhiQJEUI0SsX+/Vh++w3VoKesZ4zW4bSo8m7tUTwNeOSXYDxxSutwXJZcD+H6nPUaShIihGiUwi+qdw2t6BSBajZqHE3LUo0elJ+ZlOr961GNo3E9NcuZW61WjSMRF6usrHpn6cYu934umRMihGgw1Waj6OuvASjr2UHjaLRR1icWn1+P4rXvOAarBZtR1h9qKA8PD7y9vcnNzcXT09PlLkeWS3Sry5eVlZGTk0NgYGCdm8I2hiQhQogGK9uwgaqcHPQBAVR0qn9/J3dmjW5HVYA3HoVlROzezIn+l134JAFUL8oVGRnJ4cOHOXrU9XqSaraur9kDxx00tU2BgYHn3eOtoSQJEUKc37rX7P8t/G/1Pk/+/aPb7qqhOh3l3WPw27CfDlvXShLSSEajkS5durjkkEzN1vXt2rVzuV6c+jSlTZ6enhfdA1JDkhAhRIMolkqKtxwCIGBIN6jSOCANlfXsgN+G/YTv24axVDa1ayy9Xu+SK6YqioKnpydms9mtkhAt2+QeP0UhRLMr3nYYxVKJZ4g/Xp3b5lBMjaoQf6yhAegVG9E712sdjhAuS5IQIUSDFK77DYCAIV3dZjz8YpSfuTw5ZutajSMRwnXJcIwQ4oKqCsso3X0MAP8hXTWOpnUo6xGD/w+/EnJoL5Vf/gPPED/HAm1gZ1ghLpb0hAgh6vX88j2s3pvNpi+3gqpijQzix3xLs++S6woUP2+sMaEAFG44oHE0QrgmSUKEEBfkvScDaLtrg9SnZsXYol9+0zgSIVyTJCFCiPPyOF2MMbsA9cylqeJ35V2jUQ16LCdOU3EsT+twhHA5MidECHFeXvuPA2DpGIbiLauDnk01G6noFIHXgUx2Lt9O0fA+9sc25O/hyRt6ahidEK2f9IQIIc7La191ElLevb3GkbROZT2qh6i89h6TnXWFaCRJQoQQ9fLLOoZnXhGqXkd5lyitw2mVKuIjUIweeBSXy866QjSSJCFCiHq137EOAEtseJvbMbfBPAxUnEnQaoauhBANI0mIEKJOqqoSvf1nAMpkKOa8yrtV/3y8fjshQzJCNIIkIUKIOll++w3/nBOoBj0VnWUo5nwqOoahmDwxlFTIkIwQjSBJiBCiTkXffgtARVw4qslT42haOQ8DFZ0jARmSEaIx5BJdIQSse83hrqqqFH36IYCsDdJAZd3a4707A6/9Jygc0U/rcIRwCa2iJ+T1118nNjYWs9lMYmIiGzdurLfsp59+ysCBAwkMDMTHx4eEhATeeecdhzKqqjJjxgwiIyPx8vIiKSmJAwdkWWUhGqoiI4/KnEIUDwMV8ZFah+MSLLHh1UMypTIkI0RDaZ6EfPTRR6SkpDBz5ky2bt1Kv379SE5OJicnp87ywcHBPPnkk6xfv56dO3cyYcIEJkyYwMqVK+1lXnzxRV599VUWLlzIhg0b8PHxITk5mYqKipZqlhAurXjjQQAsnSJQjdJh2iAGPeVn5s7UrK0ihDg/zT9d5s2bx6RJk5gwYQIACxcuZPny5SxevJgnnniiVvkrr7zS4f7f/vY33n77bX766SeSk5NRVZX58+fz1FNPcdNNNwGwbNkywsPD+fzzz7njjjuavU1CuDJVVSnaVJ2EyFUxjVPePRqf3Uerr5JRbDy/fE+9ZWU1VSE0TkKsVitbtmxh2rRp9mN6vZ6kpCTWr19/wfNVVeX7779n//79vPDCCwAcPnyYrKwskpKS7OUCAgJITExk/fr1dSYhFosFi8Viv19UVASAoigoitLk9p1NURRUVXVafa2BtMk1NKhNZ11VWn44h8q8YnQmDyo6RdAaLzhVz7q1JhUdfx+SaXdoH6fi6080zn492uz7zsVImxpeZ0NpmoTk5eVhs9kIDw93OB4eHs6+ffvqPa+wsJDo6GgsFgsGg4H//Oc/XHPNNQBkZWXZ6zi3zprHzjVnzhxmzZpV63hubq7ThnAURaGwsBBVVdHrNR8Fcwppk2toUJusXvb/lm+uHkrw6NWJKp92LRFio6mA4uEDgE7bUGop6xaL784DxO34AWunjvWWO3vIuc2+71yMtKlhiouLG1xW8+GYpvDz82P79u2UlJSQmppKSkoKnTp1qjVU01DTpk0jJSXFfr+oqIiYmBhCQ0Px9/d3SsyKoqDT6QgNDXWrN6+0qfVrUJvSy+3/Pbyjelv6kIEdOWwtbIkQG62mB8RgLWx1SUhFl1B8dx4gbNcWNo/6C+gNdZYLCwuz/7/Nvu9cjLSpYcxmc4PLapqEhISEYDAYyM7OdjienZ1NREREvefp9Xo6d+4MQEJCAnv37mXOnDlceeWV9vOys7OJjPx9Vn92djYJCQl11mcymTCZau8OqtfrnfpG0+l0Tq9Ta9Im13DBNp35JreczMd6Mh8Mevz6dkB3tKDFYmws3Vm31sRyZkjGXFxAyJH95MX3qrPcua9Fm3zfuSBp04U1ph5Nf4pGo5EBAwaQmppqP6YoCqmpqQwZMqTB9SiKYp/TERcXR0REhEOdRUVFbNiwoVF1CtEWlWw/AoBP92gM3rUTc9EABr19s79LfnmbxKz3a92EENU0H45JSUlh3LhxDBw4kMGDBzN//nxKS0vtV8uMHTuW6Oho5syZA1TP3xg4cCDx8fFYLBa++eYb3nnnHRYsWABUZ3QPP/wws2fPpkuXLsTFxfH0008TFRXFqFGjtGqmEK3a6r3VvZEhP+/HBJyIbMdve7PPf5KoV0WXKHx+PYr5QGb1wmW61tZfI0TroHkSMnr0aHJzc5kxYwZZWVkkJCSwYsUK+8TSjIwMh66d0tJSHnjgAY4fP46Xlxfdu3fn3XffZfTo0fYyjz32GKWlpfzlL3+hoKCAYcOGsWLFikaNUwnR1uhLyjFlngaw/yUvmqYiNhzF04BHcTmeWflURgZrHZIQrZLmSQjAlClTmDJlSp2PpaWlOdyfPXs2s2fPPm99Op2OZ599lmeffdZZIQrh9swHTwJgjQxG8fW6QGlxXh4GKjpF4L3/BF4HMiUJEaIe7jOzRghxUbwOZgLSC+IsFV2iATD/dgLU1raiiRCtgyQhQgh0lkpMR6vXrajZDVZcnIpOEagGPZ75JXicavi6CUK0JZKECCEwH8pCp6hUBvtS1c45a+O0darJE0vH6rVAvA6c0DgaIVonSUKEEJjPDMXUDCEI56gZ2jL/lqlxJEK0TpKECNHGKVYr5kPVWxrU7AIrnKOicxSqDow5BRgKS7UOR4hWR5IQIdq4sg0b0FursPmYqYwM0joct6J4m7C2DwXAfEB6Q4Q4lyQhQrRxxaurVxcu7xwpi2o1g5ohGa/fZF6IEOeSJESINkxVFIq/r05CZD5I86g4k4QYT5xCX+qcXbmFcBeShAjRhpXv2IEtNw/F6IGlQ6jW4bglm7831oggdPw+AVgIUU2SECHasJIzGz1WxEeCQT4Omkt51+peJi+5SkYIB/KpI0QbpaoqxatWA9VXcYjmUzMkY8rIQVdh1TgaIVoPSUKEaKOs6elYjx5F5+lJRadwrcNxa1XBflS280OnqPbLoYUQkoQI0WbVXBXjPXQIqtFT42jc3+9DMnKVjBA1JAkRoo0qPjMfxO/qqzWOpG2oGfIyHclGXylDMkKAJCFCtEmVWVlU7NoFOh1+I0ZoHU6bUBkeSJWfF/pKG2EHdmkdjhCtgiQhQrRBNb0gXv374xESonE0bYROV30VEhD560aNgxGidZAkRIg2qESGYjRRc5VM5J7NqIqicTRCaE+SECHaGFthIaUbNwHgd7UMxbQkS0woitEDc3EB5Tt2aB2OEJqTJESINqZk7VqoqsLUpTPG2Fitw2lbDHoqOkUAv/dGCdGWSRIiRFuy7jWKP1wIgG+3AFj3WvVNtJiaIZni1O81jkQI7UkSIkQbolirKPk1AwC/S+I0jqZtqoiLQDF4YD18GMuhw1qHI4SmJAkRog0p3XMc1VKFR5AP5o6yYZ0WVJMnufG9ACj5XoZkRNsmSYgQbUjxtuq/vP0u6YROp9M4mrbrZO/BwO+r1grRVkkSIkQbodpslGw/AoBffxmK0dLJXoMAKN+xg6q8PI2jEUI7HloHIIRwnueX76l9UFXxU0u5J/wYtuJy9D4mvLtGtnxwwq48sB3m3r2p+PVXitesIeDWW7UOSQhNtIqekNdff53Y2FjMZjOJiYls3Fj/aoKLFi3i8ssvJygoiKCgIJKSkmqVHz9+PDqdzuE2cuTI5m6GEK2afYGyvh3ReRg0jkZsad8HgG0ffMGcb/by8aYM5nyzt+5EUgg3pXkS8tFHH5GSksLMmTPZunUr/fr1Izk5mZycnDrLp6WlMWbMGNasWcP69euJiYnh2muv5cQJx50pR44cycmTJ+23Dz74oCWaI0TrpKqUfF99SaivXBXTKtTMCwn7bScGS7nG0QihDc2TkHnz5jFp0iQmTJhAz549WbhwId7e3ixevLjO8u+99x4PPPAACQkJdO/enf/+978oikLqOQv/mEwmIiIi7LegoKCWaI4QrZLvyWNUHjuGztOAb+8OWocjgKKIGErahWOoqiT8N1k9VbRNms4JsVqtbNmyhWnTptmP6fV6kpKSWL9+fYPqKCsro7KykuDgYIfjaWlphIWFERQUxIgRI5g9ezbt2rWrsw6LxYLFYrHfLyoqAkBRFBQn7e+gKAqqqjqtvtZA2tQKqWqdx8J+3QqAT68YMHqinFOsjrNaNfWsm0s68zqd7DWILmu/JvLXTRT36k1Ni1z2/XcWl/9dqoO0qeF1NlSTkpBDhw7RqVOnppzqIC8vD5vNRnh4uMPx8PBw9u3b16A6Hn/8caKiokhKSrIfGzlyJLfccgtxcXGkp6czffp0rrvuOtavX4/BUHssfM6cOcyaNavW8dzcXCoqKhrZqropikJhYSGqqqLXa94B5RTSptbHTy2t83j47s0AKH26kWP1qvW4zRjQrHE5mwooHj4AuOKFxjWvU2HPPrD2ayL3buaYbTR46ECl3uFoV+Lqv0t1kTY1THFxcYPLNikJ6dy5M8OHD2fixIncdtttmM3mplRz0ebOncuHH35IWlqaQwx33HGH/f99+vShb9++xMfHk5aWxtV17Bo6bdo0UlJS7PeLioqIiYkhNDQUf39/p8SqKAo6nY7Q0FC3evNKm1qXYt2pWse8Tufgm3kM9HoiB0ThYaw9/8BgLWyJ8JympgfEYC10ySSkWFedQJXEJdDH2w9TWTHmI0fJ6TwQdDrCwsI0jvDiufrvUl2kTQ3TmJygSUnI1q1bWbJkCSkpKUyZMoXRo0czceJEBg8e3Kh6QkJCMBgMZGdnOxzPzs4mIiLivOe+9NJLzJ07l9WrV9O3b9/zlu3UqRMhISEcPHiwziTEZDJhMplqHdfr9U59o+l0OqfXqTVpUytTxwJkUburd8z1uuQSjP61e0HANXsTdGfdXM6Z10n18CCr5wA6bk4jdM82MroMgjPvP3fg0r9L9ZA2XVhj6mnSMyYkJPDKK6+QmZnJ4sWLOXnyJMOGDaN3797MmzeP3NzcBtVjNBoZMGCAw6TSmkmmQ4YMqfe8F198keeee44VK1YwcODACz7P8ePHOXXqFJGRsjaCaHuifq2+hN03qXYCLrRXc5VM6O5tdc/pEcKNXdTEVA8PD2655RZuuOEG/vOf/zBt2jSmTp3K9OnTuf3223nhhRcu+MWfkpLCuHHjGDhwIIMHD2b+/PmUlpYyYcIEAMaOHUt0dDRz5swB4IUXXmDGjBm8//77xMbGkpWVBYCvry++vr6UlJQwa9Ysbr31ViIiIkhPT+exxx6jc+fOJCcnX0xzhXAJiVnv2/+vL7cQcmg3ADtP7UDZ66NVWKIe2V37YfMw4n06F/+TRymKlkuoRdtxUX0vmzdv5oEHHiAyMpJ58+YxdepU0tPTWbVqFZmZmdx0000XrGP06NG89NJLzJgxg4SEBLZv386KFSvsk1UzMjI4efKkvfyCBQuwWq3cdtttREZG2m8vvfQSAAaDgZ07d3LjjTfStWtXJk6cyIABA/jxxx/rHHIRwp2Z07PQqWANC8YWKAlIa2QzmcnpWj2kXDN0JkRb0aSekHnz5rFkyRL279/P9ddfz7Jly7j++uvt40BxcXEsXbqU2NjYBtU3ZcoUpkyZUudjaWlpDvePHDly3rq8vLxYuXJlg55XCHdnPlC9iF9ZN1kbpDXL7DWIyD2bidy9iX3X3q51OEK0mCYlIQsWLOCee+5h/Pjx9Q63hIWF8dZbb11UcEKIptNVVmE6Un2pZ1m3jhpHI84nq+cAVJ2OoOOH8MqXDe1E29GkJGTVqlV06NCh1gxYVVU5duwYHTp0wGg0Mm7cOKcEKYRoPNORbPRVNqoCvKkMC8ZQWaR1SKIeFr9ACjp2JujIASJ3bwKu0DokIVpEk+aExMfHk1fH9tOnT58mLk4mVQnRGpgPVM+lKu8cVeelu6J1ye11CcCZJESItqFJSYhaz2VkJSUlmi1cJoQ4i6LglX4mCekSpXEwoiFqkpDQg79iK5JeK9E2NGo4pmZVUZ1Ox4wZM/D29rY/ZrPZ2LBhAwkJCU4NUAjReMbjeegrrNi8jFij694zSbQuZaERFIW1xz/nOCVrfyTgDzdoHZIQza5RSci2bduA6p6QXbt2YTQa7Y8ZjUb69evH1KlTnRuhEKLRvA5kAlARHwlutLKjuzvZexD+3x+n5PtUSUJEm9CoJGTNmjUATJgwgVdeecVp+6oIIZxIVTEfrB6KqZChGJeS2WsQ3b7/jJK1P6JarejO+kNPCHfUpKtjlixZ4uw4hBBO4plTgEdRGYqngYqO4Rc+QbS4s1e1heoN+WzGALbEjKTCLxBzcQGlGzfhO+wybQIUooU0OAm55ZZbWLp0Kf7+/txyyy3nLfvpp59edGBCiKYxnxmKscSGg6dB42hEo+j1nOw1iLhfVlGculqSEOH2GjxYHBAQgO7MZX4BAQHnvQkhtFMzH0SuinFNmb0HAVDy/Zp6r0QUwl00uCfk7CEYGY4RonXyycvCM68IVaejopPsGu2Kcjv3QeftTVV2NhW//opXnz5ahyREs2nStPny8nLKysrs948ePcr8+fP57rvvnBaYEKLxIn/dCIAlJgTVSyY1uiLF04jv5ZcDULw6VeNohGheTUpCbrrpJpYtWwZAQUEBgwcP5uWXX+amm25iwYIFTg1QCNFwUWeSELkqxrX5JSUBUJy6WuNIhGheTUpCtm7dyuVnMvVPPvmEiIgIjh49yrJly3j11VedGqAQomGqTp2i3ZF9AFR0liTElfkOvwI8PLAeTMdy+LDW4QjRbJqUhJSVleHn5wfAd999xy233IJer+fSSy/l6NGjTg1QCNEwJWvWoFNVrOGB2Py9L3yCaLUM/v74JCYCULxaekOE+2pSEtK5c2c+//xzjh07xsqVK7n22msByMnJkQXMhNBIzfwBGYpxD35JVwNQIvNChBtrUhIyY8YMpk6dSmxsLImJiQwZMgSo7hXp37+/UwMUQlyYraSU0nXrgDO75gqX5zuiOgkp37GDyuwcjaMRonk0acXU2267jWHDhnHy5En69etnP3711Vdz8803Oy04IUTDlP5Uvcx3SbsIqkKkN9JVDc7+AB3AunA8Aa/4cMrTsyn579MEPfmGxtEJ4XxNSkIAIiIiiIiIcDg2ePDgiw5ICNF4xauq5w1k9hmMz5lFBYXr8+0fR3l6NsVbDxOkdTBCNIMmJSGlpaXMnTuX1NRUcnJyUBTF4fFDhw45JTghxIWpVislP/wAQGafS+nCFo0jEhdr9d5sADwC/AkHSvYe58VPNvHYbYO0DUwIJ2tSEnLvvffyww8/cPfddxMZGWlfzl0I0fJKN2xAKSnBIzSU0x26QI4kIe6iKtiPynZ+eJ4qJnzvVkCSEOFempSEfPvttyxfvpzLLpPNlYTQWvF3qwDwvXoE6Js011y0YhVdovA8tZ+oXRuA+7QORwinatInVlBQEMHBwc6ORQjRSKrNRvH33wPgd801GkcjmkN5l2gAIvZtQ6mo0DgaIZyrSUnIc889x4wZMxz2jxFCtLzy7duxnTqF3t8fH5kY7pYqwwOp8vPCw1pB6fr1WocjhFM1KQl5+eWXWblyJeHh4fTp04dLLrnE4dZYr7/+OrGxsZjNZhITE9m4cWO9ZRctWsTll19OUFAQQUFBJCUl1SqvqiozZswgMjISLy8vkpKSOHDgQKPjEqK1sw/FXDkcnaenxtGIZqHT2Zfhl9VThbtp0pyQUaNGOS2Ajz76iJSUFBYuXEhiYiLz588nOTmZ/fv3ExYWVqt8WloaY8aMYejQoZjNZl544QWuvfZadu/eTXR0dbfliy++yKuvvsrbb79NXFwcTz/9NMnJyezZswez2ey02IXQkqqq9i8lGYpxbxVdovDdlk7J92tQbTZ0BoPWIQnhFDpVVVUtA0hMTGTQoEH8+9//BkBRFGJiYnjwwQd54oknLni+zWYjKCiIf//734wdOxZVVYmKiuKRRx5h6tSpABQWFhIeHs7SpUu54447LlhnUVERAQEBFBYWOm0ZekVRyMnJISwsDL2bTB6UNmmr4sOZHH7mY3RGD7q+MgG9ydN+aefZVMBmDMBgLcRdrmNztzZdsD02hdAFqzCWl9DxnWV4D2r9V8m40u9SQ0mbGqYx36FNXqysoKCATz75hPT0dB599FGCg4PZunUr4eHh9h6JC7FarWzZsoVp06bZj+n1epKSkljfwLHPsrIyKisr7RNlDx8+TFZWFklntsIGCAgIIDExkfXr19eZhFgsFiwWi/1+UVERUP3inLsGSlMpioKqqk6rrzWQNmmraEv1ejw+vWLA6ImiVn+ZnUs96+Yu3K1NF2yPQc/JngPouOUHilatwjxgQMsF10Su9LvUUNKmhtfZUE1KQnbu3ElSUhIBAQEcOXKESZMmERwczKeffkpGRgbLli1rUD15eXnYbDbCw8MdjoeHh7Nv374G1fH4448TFRVlTzqysrLsdZxbZ81j55ozZw6zZs2qdTw3N5cKJ81GVxSFwsJCVFV1qwxa2qSdwi1HAFD6dSfH6gVU/zV9LhVQPHwA3KLXANyvTQ1pT36vKDpu+YHC71ahTpjQ6tdncqXfpYaSNjVMcXFxg8s2KQlJSUlh/PjxvPjii/j5+dmPX3/99fz5z39uSpVNMnfuXD788EPS0tIuaq7HtGnTSElJsd8vKioiJiaG0NBQpw7H6HQ6QkND3erNK23ShvXIUfIz88CgJ+qSSAzGcgAM1sJaZWv+unaXoQtwvzY1pD1Hu19Nf/MilKwsAk6fxtyjR0uF1ySu8rvUGNKmhmnM93GTkpBNmzbxxhu1N1OKjo6ut7ehLiEhIRgMBrKzHcexs7Oza+1Lc66XXnqJuXPnsnr1avr27Ws/XnNednY2kZGRDnUmJCTUWZfJZMJkMtU6rtfrnfpG0+l0Tq9Ta9ImbZR+X729u0+3KDx9f/+Fr+8LTHfWzV24W5su1B6byYzPZZdRkppK6fdr8O7VqwWjaxpX+F1qLGnThTWmniY9o8lkss+bONtvv/1GaGhog+sxGo0MGDCA1NRU+zFFUUhNTWXIkCH1nvfiiy/y3HPPsWLFCgYOHOjwWFxcHBEREQ51FhUVsWHDhvPWKYQrqdmwzm9AJ40jES3J78yws8Oluuteq/8mRCvXpCTkxhtv5Nlnn6WyshKozqIyMjJ4/PHHufXWWxtVV0pKCosWLeLtt99m79693H///ZSWljJhwgQAxo4d6zBx9YUXXuDpp59m8eLFxMbGkpWVRVZWFiUlJfZYHn74YWbPns2XX37Jrl27GDt2LFFRUU69tFgIrVRm51C+YwcAvglxGkcjWpLvlcPBYMCyfz/WY8e0DkeIi9ak4ZiXX36Z2267jdDQUMrLyxk+fDhZWVkMGTKE559/vlF1jR49mtzcXGbMmEFWVhYJCQmsWLHCPrE0IyPDoWtnwYIFWK1WbrvtNod6Zs6cyTPPPAPAY489RmlpKX/5y18oKChg2LBhrFixQtYIEW6h5MxQjFd8OJ5BPhpHI1pKYtb7eOwNx7tLBGX7TlD832dol5ygdVhCXJQmJSEBAQGsWrWKn3/+mR07dlBSUsIll1zicFlsY0yZMoUpU6bU+VhaWprD/SNHjlywPp1Ox7PPPsuzzz7bpHiEaM2KV1Wvkup3iQzFtEV+l8RVJyFbDkkSIlxeo5MQRVFYunQpn376KUeOHEGn09nnYaiq2uovGxPCldkKCynduAmQJKSt8rukE9nv/0T5wSwq80vwDPLVOiQhmqxRc0JUVeXGG2/k3nvv5cSJE/Tp04devXpx9OhRxo8fz80339xccQohgJK0NKiqwtSlC8bw2muCCPfnGeyLV+fqqwCLzyxYJ4SralRPyNKlS1m7di2pqalcddVVDo99//33jBo1imXLljF27FinBimEqFZ0ZsM6v2uaNvQp3IPfwHjKD2ZRvPkQwUl9L3yCEK1Uo3pCPvjgA6ZPn14rAQEYMWIETzzxBO+9957TghNC/M5WUkLpjz8C4JecrHE0Qkv+Zy7NLjuQSVVhmcbRCNF0jUpCdu7cyciRI+t9/LrrrmPHmUsHhRDOVbImDdVqxRgbi6lrV63DERrybOeHuVM4qL/vISSEK2pUEnL69Olae7KcLTw8nPz8/IsOSghRW9HKFQD4jUyWCeAC/4HVvSHFm9M1jkSIpmvUnBCbzYaHR/2nGAwGqqqqLjooIYQjW0kppWurh2L8R47k+eV7SMzKvsBZwp35DYgn5+P1lO3PpKqoDA9/b61DEqLRGpWEqKrK+PHj69xnBcBisTglKCGEo5K0M0MxHTti6tYN0vdqHZLQwOq9jolnaHggxuwCNn6zg6F3yLYUwvU0KgkZN27cBcvIlTFCOF+xfShmpAzFCLvybu0xZhfgtf+E1qEI0SSNSkKWLFnSXHEIIeqhlJZSYh+KkatixO/Ku0YTsPZXTBm5VBWX4+HnpXVIQjSK++xFLISbKk5LQ7VY8OzYAVP37lqHI1oRW5Av1rAAdKpKybbDWocjRKNJEiJEK1e8YiUA/skyFCNqK+/WHoCizXKprnA9koQI0YpVD8WsBWQoRtStoms0AKV7j2MrqdA4GiEaR5IQIVqxkh9+qB6K6dABU48eWocjWqGqYD8qQ/zBplC8/YjW4QjRKJKECNGKFdmHYmSBMlG/miEZWbhMuBpJQoRopZSyMvtQjJ8MxYjzKO9WPSRTsvsYtlIZkhGuo1GX6AohWs6yf71HYkUFJe3CmXcYOLJH65BEK1XVzp/KEH8884rYsHwHZX1iAdiQX/2eefKGnhpGJ0T9JAkRopVqv2MdAGp8AInZH2gcjWjtynrEEPDjbrz2HrMnIUK0djIcI0QrpJSWEr53K/D7eL8Q51Pevfp9YsrIQS9DMsJFSBIiRCtU/P33eFRaqQr0oTI8UOtwhAuwBfpijQxCpyLLuAuXIUmIEK1Q4ddfA1DWowPIVTGigcq6xwDgte+YxpEI0TCShAjRylTl51P6c/V8kPIeMhQjGq68W3tUwHTiFIaiMq3DEeKCJAkRopUpXrkSqqooiI6jqp2/1uEIF6L4eWGNCQHAa99xjaMR4sIkCRGilSn6ejkAx/pfrnEkwhXJkIxwJZKECNGKVJ48SdnmzQAcT7hM42iEK6roGo2q12HMLsA3N1PrcIQ4L82TkNdff53Y2FjMZjOJiYls3Lix3rK7d+/m1ltvJTY2Fp1Ox/z582uVeeaZZ9DpdA637rL9uXARRd98C4D3wIGUB4VoHI1wRYq3CUvHMADab/tJ42iEOD9Nk5CPPvqIlJQUZs6cydatW+nXrx/Jycnk5OTUWb6srIxOnToxd+5cIiIi6q23V69enDx50n776Sf5RRSuoXB59VUx/n+4QeNIhCurGZJpv+0nUFWNoxGifpomIfPmzWPSpElMmDCBnj17snDhQry9vVm8eHGd5QcNGsQ///lP7rjjDkwmU731enh4EBERYb+FhMhflKL1sxw6hGXPXvDwwC9Z9ooRTVfRJQrVoMc/5wQBmUe0DkeIemm2bLvVamXLli1MmzbNfkyv15OUlMT69esvqu4DBw4QFRWF2WxmyJAhzJkzhw4dOtRb3mKxYLFY7PeLiooAUBQFRVEuKpYaiqKgqqrT6msNpE3OVfhVdS+Iz9Ch6AMCQM3EGX/Dqmfd3IW7tcnZ7VFNnpTHR+L92wk6bP4B5d7rnFRzw8nng2tojjY1pi7NkpC8vDxsNhvh4eEOx8PDw9m3b1+T601MTGTp0qV069aNkydPMmvWLC6//HJ+/fVX/Pz86jxnzpw5zJo1q9bx3NxcKiqcs/yxoigUFhaiqip6veZTcZxC2uQ8qqpS9NVX1f+/fBg5OTn4qaXYjAEXXzegePgA4C7Lnrlbm5qjPSX9elQnIdvWkp15Ep2HwUk1N4x8PriG5mhTcXFxg8u63QZ21133e8bft29fEhMT6dixIx9//DETJ06s85xp06aRkpJiv19UVERMTAyhoaH4+ztnnQZFUdDpdISGhrrVm1fa5Bzlu3ZRcPw4OrOZ6FGj0Pv4UKw7hcFaeNF11/x1bbAWusUXNrhfm5qjPdYYPyzefpiKC/E9lI7PsGFOqrlh5PPBNTRHm8xmc4PLapaEhISEYDAYyM7OdjienZ193kmnjRUYGEjXrl05ePBgvWVMJlOdc0z0er1T32g6nc7pdWpN2uQcxV9W94L4XX01HjU9djqd076QdGfd3IW7tcnp7THoOd5/GPE/f0vRl1/hd8UVzqq5weTzwTU4u02NqUezn6LRaGTAgAGkpqbajymKQmpqKkOGDHHa85SUlJCenk5kZKTT6hTCWZ5fvod/fLGDrM++BOCbqP48v3wPzy/fo3Fkwh1kDBwOQPHq1dhKSjWORojaNE3lUlJSWLRoEW+//TZ79+7l/vvvp7S0lAkTJgAwduxYh4mrVquV7du3s337dqxWKydOnGD79u0OvRxTp07lhx9+4MiRI6xbt46bb74Zg8HAmDFjWrx9QjRE5N6tmMqKKfcPIqdrX63DEW4kP6YzxaFRqBUVFH/3ndbhCFGLpnNCRo8eTW5uLjNmzCArK4uEhARWrFhhn6yakZHh0K2TmZlJ//797fdfeuklXnrpJYYPH05aWhoAx48fZ8yYMZw6dYrQ0FCGDRvGL7/8QmhoaIu2TYiG6rBpDQDHLrkC9C07eVC4OZ2OjIHD6fXtBxR++SWBt9ysdURCONB8YuqUKVOYMmVKnY/VJBY1YmNjUS+w8M6HH37orNCEaHbGkkIi9m4F4OigK7UNRrilY5dcQa9vP6BswwYqT57EU4amRSuieRIiRFvWftvP6BUb1vBAevITZGkdkXA3ZcFheA8cSNnmzRR+9TUhf5mkdUhC2LnP9F4hXFDHzWkAlPXuqG0gwq0FjLoJgMIvv7hgb7IQLUmSECE0YjlwgKDj6Sh6A+Vn9voQojn4JSejM5mwHkynYrdceSVaD0lChNBIweefA5DV4xIU7/r3QhLiYhn8/PC7egQAhZ99pnE0QvxO5oQI0VLWvWb/r2pTKPqkehK1qbMB52wOIET9Am6+haJvvqXwq68Ie3Qq+kasailEc5GeECE0ULrnOFWFZdi8jFTEy9UKovn5DB2CR1QkSlERxatWax2OEIAkIUJoouDHvQDVc0EM8msomp/OYCDwllsBKPjkE42jEaKafPoJ0cKqisoo3nYYgNK+cRpHI9qSwFtuBp2Osg0bsGZkaB2OEJKECNHSCn/eDzYFc1wYVWEBWocj2hDPqCh8LrsMgIL/fapxNEJIEiJEi1JVlYK11ZdIBg7vqXE0oi0KvK16SKbws89Qq6o0jka0dXJ1jBAtqGx/JtbsQvQmTwIGd4HDp7UOSbixxKz3q/+zLtx+zNfLhiEoiKqcHEp++gm/K6/UJjghkJ4QIVpUTS+I/6Vd0Js9NY5GtEV6TwMBN1WvoCoTVIXWpCdEiBZSVVJB8eZDAAReIUMxQjuB8RWcBkrWrKHq2xfwCPD+/cGhD2oWl2h7JAkRooUUrduPWmXD1CEEc2yo1uGINswUHYxXfDjl6dls/mwzJYnd7I9tyK/urXvyBkmURfOT4RghWoCqquTXTEi9oic6nU7jiERbV9Mb57PzMMimdkIj0hMiRAso37Yda2Y+OqMHAZd20Toc0cas3ptd65guwJ8IkyceBaWYDmdj6RShQWSirZOeECFaQMHHHwPgP6gzBtmsTrQCqqcHZb07AuC7LV3jaERbJUmIEM2sKj+fom++ASDoShlnF61HSf9OAJgOZWEoKNE4GtEWSRIiRDMr+OQTVKsVc8dQzJ3CL3yCEC3EFuRHRWw4OsBn+yGtwxFtkCQhQjQj1WYj/4MPAAi6uo9MSBWtTumZ3hCfXUeh0qZxNKKtkYmpQjjTutcc7pZsO0xV5kkMvmb8B3fWKCgh6lfRKZIqf288isrw3ncMYrSOSLQlkoQI0YzyU3cBUNCzA9+nn9I4GiHqoNdRmtCJgLW/4rMtHZJUkB470UJkOEaIZmLJPE3pnuOgq/6QF6K1KusTi2rQY8wuICjjgNbhiDZEkhAhmkn+mt0A+CbEYgvw0TgaIeqneJso794egE4/r9A4GtGWaJ6EvP7668TGxmI2m0lMTGTjxo31lt29eze33norsbGx6HQ65s+ff9F1CtEcbKUVFPy0F4DgEb01jkaICyvpHw9AzPafMRflaxyNaCs0TUI++ugjUlJSmDlzJlu3bqVfv34kJyeTk5NTZ/mysjI6derE3LlziYioe3W/xtYpRHMoWLsX1VKFqX0w3j3bax2OEBdUGRmMJSoYva2KTj9/q3U4oo3QdGLqvHnzmDRpEhMmTABg4cKFLF++nMWLF/PEE0/UKj9o0CAGDRoEUOfjTalTCGdTq2ycXr0TgOBrE+SyXOEySgZ2xfTlL8StW8ncT2/BZjLXWU42txPOolkSYrVa2bJlC9OmTbMf0+v1JCUlsX79+hat02KxYLFY7PeLiooAUBQFRVGaFMu5FEVBVVWn1dcaSJvqoELhxoNU5ZdiCPDGd3AXFBW03B5MPevmLtytTa2lPeVdoihpF47vqWw6blrDoctG1lmuIb8f8vngGpqjTY2pS7MkJC8vD5vNRni44wqS4eHh7Nu3r0XrnDNnDrNmzap1PDc3l4qKiibFci5FUSgsLERVVfR6zafiOIW0qTbVYqZ4RXUviOfwS8hTfcEKNmOAs0NteEyA4lE9MdZd+mTcrU2tqT3Hh11D9y/epeuPX5F76WVQx+9BQ4a35fPBNTRHm4qLixtcVtYJAaZNm0ZKSor9flFRETExMYSGhuLv7++U51AUBZ1OR2hoqFu9eaVNjkq/PkjB8Vx0Rg/aX90Vg7EcAIO10NmhNljNX9cGa6HmX3DO4m5tak3t2T94FJ2++wzvvGx89+7lZO/BtcqEhYVdsB75fHANzdEms7nuYby6aJaEhISEYDAYyM523GI6Ozu73kmnzVWnyWTCZKq9s6ler3fqG02n0zm9Tq1Jmxzlf7cdgMDLuuPp9/svotZfLLqzbu7C3drUWtpjM3tzeMi1dPv+M7qs/YqTfRJrlWno74Z8PrgGZ7epMfVo9lM0Go0MGDCA1NRU+zFFUUhNTWXIkCGtpk4hGqpi/2+U7swAHQRf21frcIRosvRh16MYPAg5tJfgI/u1Dke4MU2HY1JSUhg3bhwDBw5k8ODBzJ8/n9LSUvuVLWPHjiU6Opo5c+YA1RNP9+zZY///iRMn2L59O76+vnTu3LlBdQrhFOfsEQNwauF3APgNiMcYHtjCAQnhPBUBwWQMGE7sxlS6rf4f6++drnVIwk1pmoSMHj2a3NxcZsyYQVZWFgkJCaxYscI+sTQjI8OhWyczM5P+/fvb77/00ku89NJLDB8+nLS0tAbVKURzsGYXULQpHYCQPwzQOBohmi4x630ADH0NqJsgcu8Whu34Dz/1e0DjyIQ70nxi6pQpU5gyZUqdj9UkFjViY2NR1QtfxHa+OoVoDnnfbANVxbdvR8wdQrQOR4iLZgvyo7xbe7z3Hcd3w37op3VEwh25z8waITRSebqYwnXV4+bt/nCJxtEI4TzFl3YHwGv/cXxzTmgcjXBHmveECOHqTn27HWwKlphQ1lXqYW/2Bc8RwhVUhQZQ3jkSr4Mn6fb9Z2y5Q3qYhXNJT4gQF6GqsIyCtdWTpYsv7aZxNEI4X3FidW9IzJa1eJ+WPbiEc0kSIsRFOPXNVtRKG+ZO4Vg6XngBJyFcTWVUMBUdw9ArNrqv+kTrcISbkSREiCaqPF1C/prdAISOGgSyUZ1wU8WXVW9Y12HzGnxyMzWORrgTSUKEaKK8r7egVtnw6hqJT68YrcMRotlYo9txsscA9IpCj+/+T+twhBuRJESIJrDmFlHw414Awm5ORCe9IMLN7R15BwAx237EcuCAxtEIdyFJiBBNkPflZrAp+PRqj3e3KK3DEaLZFbTvxIm+l6JTVXJf+7fW4Qg3IUmIEI1kOXTYvi5I6Kjam3sJ4a72JI9G1eko/u47ynfv1joc4QZknRAhGin3X/OqV0ft1xGveNkOQLQdxREdONb/cjpsXcvGJ2bx030za03IfvKGnhpFJ1yR9IQI0QhlmzdTvGo16HSE3SY7M4u2Z8/IO7AZPAg7sIvwfdu0Dke4OElChGggVVHIfuFFAAKv6IEpOljjiIRoeWXtwkm//HoA+nz1NjqbTeOIhCuTJESIBir65lsqdu1C7+1N6KjBWocjhGb2X30rFm9f/LOP03FjqtbhCBcmc0KEaADFYiF33jwAdl1xE8cyiyGzWOOohNBGpbcv+669nX6fL6bnyo843v9yqsxeWoclXJD0hAjRAKeXLaMyM5Ny/2AODv+j1uEIoblDQ66lJCQCc3EBXb//VOtwhIuSJESIC6g8eZK8BQsB2H39n7EZTRpHJIT2VA9Pfv3DWAC6pH0py7mLJpHhGCEuIPuFF1HLyvDq35+MAcO1DkcITSRmvV/7YIhKRWw45iPZJHz2Fj9PeqrlAxMuTXpChDiPkp9/pnjFCtDriZg5A/TyKyOEnU5HQVI/bAYPwvdvJ+rXjVpHJFyMfKIKUQ/FaiX7udkABN15J+bu3TWOSIjWxxbkx4GrRgHQ94vFKGVl2gYkXIokIULU4/SSpViPHMEQEkLoQw9qHY4Qrdb+q2+hNCgU7/w8+/wpIRpCkhAh6mA9fJi8114FIHxUPwy7lsK610jMer/usXEh2jCb0cTOUfcAcGrxYir27NE4IuEqZGKqEOte+/3/KqgVJvY9vwxTlY2K2DA2BQbA3mzt4hOilUvMeh9CoLxrNF6/nSDz4fvo+OSt0O0OrUMTrZz0hAhxDkvadkyZp1A8PSi49pJaG3QJIepWcHUCBh8Tlow8Tq+QfWXEhUkSIsRZrLmFlH/xIwBFw3tjC/DROCIhXIfiayb8z8MAOPXVZmyHD2sckWjtWkUS8vrrrxMbG4vZbCYxMZGNG89/mdf//d//0b17d8xmM3369OGbb75xeHz8+PHodDqH28iRI5uzCcINqIpK9tI0sFZRERNKaUInrUMSwuX4X9oV334dUasUSl94EbWyUuuQRCumeRLy0UcfkZKSwsyZM9m6dSv9+vUjOTmZnJycOsuvW7eOMWPGMHHiRLZt28aoUaMYNWoUv/76q0O5kSNHcvLkSfvtgw8+aInmCBd2euV2yvadAKMH+ckyDCNEU+h0OiLGDkfvZcS2bx+nFizQOiTRimmehMybN49JkyYxYcIEevbsycKFC/H29mbx4sV1ln/llVcYOXIkjz76KD169OC5557jkksu4d///rdDOZPJREREhP0WFBTUEs0RLqr8cA45n24AwPtPV2EL8tU4IiFcl2eQL+F3V68ufOrNRZRt2qRxRKK10vTqGKvVypYtW5g2bZr9mF6vJykpifXr19d5zvr160lJSXE4lpyczOeff+5wLC0tjbCwMIKCghgxYgSzZ8+mXbt2ddZpsViwWCz2+0VFRQAoioKiKE1pWi2KoqCqqtPqaw3cpU1KeSUn3lwFNgXfAZ0wDO2DeuSo1mE5jXrWzV24W5vcqT3KmUb4Du6CMUOPdcVKTjz6GLGffYohIEDb4C6Su3zmna052tSYujRNQvLy8rDZbISHhzscDw8PZ9++fXWek5WVVWf5rKws+/2RI0dyyy23EBcXR3p6OtOnT+e6665j/fr1GAyGWnXOmTOHWbNm1Tqem5tLRUVFU5pWi6IoFBYWoqoqejdZ+ttd2lT63noqswvRBfmiu2MkhTYTNmMA7jIYowKKR/UEW2lT6+RO7cmxegHVyYh17Fj0O3dRlZnJ0Sem4fPMTHQuPMzpLp95Z2uONhUXFze4rFuuE3LHHb9fm96nTx/69u1LfHw8aWlpXH311bXKT5s2zaF3paioiJiYGEJDQ/H393dKTIqioNPpCA0Ndas3r6u3qfDzz8lf9yvooP29V2MOAoPVisFa6PJfBjVq/rqWNrVe7tSeMKMZqE5CdJGR+L38EsfuHkvlDz9gXL2aoDvv1DjCpnOHz7xzNUebzGZzg8tqmoSEhIRgMBjIznZcCCo7O5uIiIg6z4mIiGhUeYBOnToREhLCwYMH60xCTCYTJlPt7dn1er1T32g6nc7pdWrNldv0+htfM/y1WRiAoiE9+AUP1P3Z2IwBGHD9v0jPpjvr5i7crU3u0h79WQ3Q6XR49+tH2COPkPPCC+S88CJePXviPWCAdgFeJFf+zKuPs9vUmHo0/SkajUYGDBhAamqq/ZiiKKSmpjJkyJA6zxkyZIhDeYBVq1bVWx7g+PHjnDp1isjISOcELlxeVX4+iUtfxFBlpTw+guKhPbQOSQi3FTx+HP7XXwdVVRx/+GEqs+u++lG0PZqncikpKSxatIi3336bvXv3cv/991NaWsqECRMAGDt2rMPE1b/97W+sWLGCl19+mX379vHMM8+wefNmpkyZAkBJSQmPPvoov/zyC0eOHCE1NZWbbrqJzp07k5ycrEkbReui2mxkPjIVn/xcStpFkH/9ILkcV4hmpNPpiJw9G1OXLthy8zjx8MOoVqvWYYlWQPMkZPTo0bz00kvMmDGDhIQEtm/fzooVK+yTTzMyMjh58qS9/NChQ3n//fd588036devH5988gmff/45vXv3BsBgMLBz505uvPFGunbtysSJExkwYAA//vhjnUMuom1RVZXsf8yhdN06qowmfpnwGKrZqHVYQrg9vbc37V97Fb2fH+XbtnHy6RmoqjtcDyQuhk6Vd0EtRUVFBAQEUFhY6NSJqTk5OYSFhbnNWKIrtunUkqXkvPAC6HT8MvYRMvsOcdgVV4XqOSFuMEGwhrSp9XOn9iT1qP4DUlEhJ/5PtT4fSn78kWN/vR9sNkKmTCF0ymStQm00V/zMu5DmaFNjvkPd8uoYIWo8v/z3LcWjdq4ncdnL6ICdfxhLZt/65xEJIZqH7+WXEzFjBlkzZ5L373/jGR1N4M2jtA5LaESSENEmBB/ex6D3XkWnqqRfNpKDw/+odUhCuKXVe6uvXlQB26F37L07NT0kAEExUDlpEqcWLeLk00/jERqK77DLtAlYaEqSEOH2gjIOcsWbM9FXVVEeH4n5Um8Ss2UvISG0FPr3h6nMzKRo+XKOT5lCh0Vv4j1okNZhiRYmSYhwawGZR7jszefQW6uwxISS/8fBjgsZCCFaRE0PSY0N+fvQXXE3Qw6dJGLvVo7d91c6LH4Lr4QEbQIUmnCPmTVC1MFy4ADDFs7CWF6CJaodp24ZiuopebcQrYXq4ckv4x7Fe8ilKGVlZEz6C+W/7tY6LNGCJAkR7mXda7DuNcrfe4qjY27HVFqENSKIU7ddhmqUBESI1kbxNBLz+ut4DRyAUlxMxvjxlG3erHVYooXIp7JwO6V7T3D81W9QLJVYI4PIu3UYqslT67CEEPXQe3sTs/ANjt9/P2WbNpEx8V7av/oKvsOHO1zhdrYnb+jZwlGK5iBJiHArxVsPcWLhKtQqG949osm8dgCqURIQIVqzmkRDf+vfSSydR+SezRy9fzJb7pgCA67QODrRnGQ4RrgFVVXJW7SI46+vQK2y4XdJHDEP3yAJiBAuRPE08cv4R8kYcAV6xcag91+hx4oPQFG0Dk00E+kJES5PsVjImjGTwi++ACDwql5E/PlydAbJsYVwNarBg813PEiFXxBd076gx6pP8M8+zuY7HsRmavgW8cI1SBIiXFrliROcSHmE8h07UPR6ikb05UT/eHb/lqt1aEKI8zh7u4Q6DfIg32sAgSu3Er3zF0Kz9rLmntmUhka1TICiRcifisJlFa9ezaGbb6F8xw6sXj78POkpSvvHax2WEMJJynrHkjf6CmzeJow5hYz416O03/qj1mEJJ5KeEOFylDXzyPnkF/JTdwFgjgsjK+kSOvnL+gJCuBtr+xByxo4g+OtNmI7nMfi9+YQd2IVt+AsYfH20Dk9cJElCROu17rVah8r2Z5K5ZA2VOYUABCf3I+zWS0k/kNfS0QkhWoji503e6MvxW7cXv/X7iN2YyqHkK4kcdyW+vTvA0Ae1DlE0kSQhwiXYyixsfWsNvtsOVd/39SI/+RJOdIoASUCEcH96PcXDemHpEErQii1wqoRj874mYFh3wnrchUdQkNYRiiaQOSGiVVMVhfy1e0if9r49ASntG0v2Pddg6RShcXRCiJZm7RBGzvhrCErqAzoo/Gkf6SOv4/S776FWVWkdnmgk6QkRrZKqqpTtPkbOJ79QcbT6SpfKYF8Kk/pj6RimcXRCCC2pRg9+7d8VY2gwgau24ZlXSPbs2fz232XsvuEu7pl6FzqdbFTpCiQJEa3K88v3EJK+mx4rPiT0UPUqiorRg6LLelZf+SJrfwghzrC2DyFn3NX47DiM/097CMjKYOhb/+DImrcIHTUIn14x6C57SOswxXlIEiJaRh2TTM+mKgol249ww2ebMJ04VX3MoKe0XxzFl3ZH8ZFFioQQddDrKe0fT1n3GPw27MNn2yEqDmVzbN7XmOPCaPdQF/yuuQadh3zdtUbyqghNrN6bDYC+zILXngx8t6XjUVCKCVD1Okr7xlF8aTcUP29tAxVCuATVy0jRlX0pGdiVXgePkb9mNxWHczjx9xQ8o6II+vMYAm66CY/QUK1DFWeRJES0ONWmYEo/ic+uI5jTT6JTVAAUsyel/TpR0j8exc9L4yiFEK5I8TUTPmYY7a6/hPw1v5L/YzqVmZnkvPQyOf+aj+8VVxBwy834DR+OzmjUOtw2T5IQ0SKUShtle49TvPUQxduPEFJUbn/MGh5IWZ9Yynp1RDXKW1IIcfE8ArwJHTWYds8uoujrryn45H+Ub99OyZo1lKxZgyEwEN+rrsIv6Wp8LrsMvVmGfLUgn/iiWaiqSmVGBqUbNlC6bj2la1JRLJX2x21eRsp7dqC0TyxVoQEaRiqEcDc1w70AG/IPgVdPuLsnftcep8OmNXTcnIa5oIDCzz6j8LPPqDKaCBp+OT5Dh+KdeCnGuFi5uqaFSBIinEKtrMRy8CDlO3dRvm0bpRs2UHXypEMZjyAf/PrH4dc/jvWqh1zpIoRodrU2yhto4NQlV5FelkDUrxuJ/HUjPvm5FK9aTfGq1QB4hIXhfWki3v37Y+7TF3PXLjJ000wkCRGNVnX6NJYDB6k4eICyXb+SkXGUij17USsqHMopBg9OdexKXufetAvLpTIiCOSvCyGE1vR64n13wqVmChIvpzSnkF7FxZTuPUH5wSyqcnIo+vIrir78Cqi+Uq8yLBBrWADW8HB+C/Kkqp0/ireJpJ5nFk2UpeObpFUkIa+//jr//Oc/ycrKol+/frz22msMHjy43vL/93//x9NPP82RI0fo0qULL7zwAtdff739cVVVmTlzJosWLaKgoIDLLruMBQsW0KVLl5ZojstTLBaqTp7EeuIElZmZVJ44wbZNe/E+nYtfzglMpUV1nldp9iY/Jp78Dl3Ije/Fqdju2EzV46wX3LZbCCG0oNNRGR7I9vBA6BwDlTaMmacwHcvFePI0xpP56C2VZ/5/GjhsP9XmZeRIdDCeof54blIwRkfjGR2NZ1QUHqGh6L3l6r4L0TwJ+eijj0hJSWHhwoUkJiYyf/58kpOT2b9/P2FhtVfGXLduHWPGjGHOnDn84Q9/4P3332fUqFFs3bqV3r17A/Diiy/y6quv8vbbbxMXF8fTTz9NcnIye/bswdxGJh+pqopqsaAUF2MrKUE5c/s4bS8eFWV4VpRhLC8lJmczhjIL+tIK/KpsVBWXo5RZatXX4Zz7pcFhFIW3pyI8glMRnTjdoQu9lB9Ap8MX8GUPcfl7WqStQgjhNJ4GrB3DsNaszKyqGApKMJ7MxyOvCI/T5RhzT2EoKMVQbqX8YBblB7Ng/W+1qtJ7e2MICcHDaMUjwBsPf28MvmbSiy0oZiP7w0dQ6eVDpZcPVi9vqkzePHJjP3QmEzp92xiu1qmqqmoZQGJiIoMGDeLf//43AIqiEBMTw4MPPsgTTzxRq/zo0aMpLS3l66+/th+79NJLSUhIYOHChaiqSlRUFI888ghTp04FoLCwkPDwcJYuXcodd9xxwZiKiooICAigsLAQf39/p7Qz//PPKcw8iZ+PN9gUUGyoVTZUxQY1/9psqDYFbFWoNgXVVgUO/9pQqypRLdbqBMNSYf9/9X2Lw/+x2Zocb5XRTFlQCGXBYZQFhVIadObfkAi6qz+jGj1QAZsxAIO1EHcZZJE2uQZ3a5O7tQfaQJsqbXieLsYjvwRDYSmnqqLxPp1TfcvPxaPSelHPpTOZ0JvN6Ly80JtM1f+azejMZnSenug8PKpvnh7g4YHOwxOdweB438MDnYeh+r7eAHo9Or0O9AbQ69DpDag6KLFYiblnAnonJT6N+Q7VtCfEarWyZcsWpk2bZj+m1+tJSkpi/fr1dZ6zfv16UlJSHI4lJyfz+eefA3D48GGysrJISkqyPx4QEEBiYiLr16+vMwmxWCxYLL//9V9YWL1NfEFBAYqiNLl9Zzvy8jyqsrLIdUptDafqdKieBhSTJ6rRE8XogWLyqP6/yQPVy4zN24Tibaz+18uEzcuEavZ0mL9hJB8j+QRW/UYxQLkNFVBsFeitFrf6kJE2tX7u1iZ3aw+0kTb5e1XfqF4ArZBoCokGVUVXWYWhrAJ9qbX63zILhjILugoreksVOkslemvl7/+3WNFXnvWHY1lZ9a0F6Hx98bvlZqcmIVDdI38hmiYheXl52Gw2wsPDHY6Hh4ezb9++Os/Jysqqs3xWVpb98Zpj9ZU515w5c5g1a1at4x07dmxYQ4QQQghX1q6d06ssLi4mIOD8SzBoPiekNZg2bZpD74qiKJw+fZp27do57VrxoqIiYmJiOHbsmNOGeLQmbXIN0qbWz93aA9ImV9EcbVJVleLiYqKioi5YVtMkJCQkBIPBQHZ2tsPx7OxsIiIi6jwnIiLivOVr/s3OziYyMtKhTEJCQp11mkwmTCaTw7HAwMDGNKXB/P393ebNW0Pa5BqkTa2fu7UHpE2uwtltulAPSA1Np98ajUYGDBhAamqq/ZiiKKSmpjJkyJA6zxkyZIhDeYBVq1bZy8fFxREREeFQpqioiA0bNtRbpxBCCCFanubDMSkpKYwbN46BAwcyePBg5s+fT2lpKRMmTABg7NixREdHM2fOHAD+9re/MXz4cF5++WVuuOEGPvzwQzZv3sybb74JgE6n4+GHH2b27Nl06dLFfoluVFQUo0aN0qqZQgghhDiH5knI6NGjyc3NZcaMGWRlZZGQkMCKFSvsE0szMjIcZuwOHTqU999/n6eeeorp06fTpUsXPv/8c/saIQCPPfYYpaWl/OUvf6GgoIBhw4axYsUKTdcIMZlMzJw5s9awjyuTNrkGaVPr527tAWmTq9C6TZqvEyKEEEKItqltLMkmhBBCiFZHkhAhhBBCaEKSECGEEEJoQpIQIYQQQmhCkhANWSwWEhIS0Ol0bN++XetwLsqNN95Ihw4dMJvNREZGcvfdd5OZmal1WE125MgRJk6cSFxcHF5eXsTHxzNz5kys1ovblEprzz//PEOHDsXb27vZFuRrbq+//jqxsbGYzWYSExPZuHGj1iE12dq1a/njH/9IVFQUOp3OvgeWK5szZw6DBg3Cz8+PsLAwRo0axf79+7UO66IsWLCAvn372hf0GjJkCN9++63WYTnN3Llz7ctbtDRJQjT02GOPNWhZW1dw1VVX8fHHH7N//37+97//kZ6ezm233aZ1WE22b98+FEXhjTfeYPfu3fzrX/9i4cKFTJ8+XevQLorVauVPf/oT999/v9ahNMlHH31ESkoKM2fOZOvWrfTr14/k5GRycnK0Dq1JSktL6devH6+//rrWoTjNDz/8wOTJk/nll19YtWoVlZWVXHvttZSWlmodWpO1b9+euXPnsmXLFjZv3syIESO46aab2L17t9ahXbRNmzbxxhtv0LdvX20CUIUmvvnmG7V79+7q7t27VUDdtm2b1iE51RdffKHqdDrVarVqHYrTvPjii2pcXJzWYTjFkiVL1ICAAK3DaLTBgwerkydPtt+32WxqVFSUOmfOHA2jcg5A/eyzz7QOw+lycnJUQP3hhx+0DsWpgoKC1P/+979ah3FRiouL1S5duqirVq1Shw8frv7tb39r8RikJ0QD2dnZTJo0iXfeeQdvb2+tw3G606dP89577zF06FA8PT21DsdpCgsLCQ4O1jqMNstqtbJlyxaSkpLsx/R6PUlJSaxfv17DyMT5FBYWArjN747NZuPDDz+ktLTU5bcCmTx5MjfccIPD71RLkySkhamqyvjx4/nrX//KwIEDtQ7HqR5//HF8fHxo164dGRkZfPHFF1qH5DQHDx7ktdde47777tM6lDYrLy8Pm81mX025Rnh4OFlZWRpFJc5HURQefvhhLrvsModVrV3Rrl278PX1xWQy8de//pXPPvuMnj17ah1Wk3344Yds3brVviWKViQJcZInnngCnU533tu+fft47bXXKC4uZtq0aVqHfEENbVONRx99lG3btvHdd99hMBgYO3YsaitbkLexbQI4ceIEI0eO5E9/+hOTJk3SKPL6NaVNQrSEyZMn8+uvv/Lhhx9qHcpF69atG9u3b2fDhg3cf//9jBs3jj179mgdVpMcO3aMv/3tb7z33nuabmcCsmy70+Tm5nLq1KnzlunUqRO33347X331FTqdzn7cZrNhMBi48847efvtt5s71AZraJuMRmOt48ePHycmJoZ169a1qi7LxrYpMzOTK6+8kksvvZSlS5c67GPUWjTldVq6dCkPP/wwBQUFzRyd81itVry9vfnkk08cNqMcN24cBQUFLt/zptPp+Oyzz9xmo80pU6bwxRdfsHbtWuLi4rQOx+mSkpKIj4/njTfe0DqURvv888+5+eabMRgM9mM2mw2dToder8disTg81pw038DOXYSGhhIaGnrBcq+++iqzZ8+238/MzCQ5OZmPPvqIxMTE5gyx0RraprooigJUX4bcmjSmTSdOnOCqq65iwIABLFmypFUmIHBxr5MrMRqNDBgwgNTUVPsXtaIopKamMmXKFG2DE3aqqvLggw/y2WefkZaW5pYJCFS/91rb51tDXX311ezatcvh2IQJE+jevTuPP/54iyUgIElIi+vQoYPDfV9fXwDi4+Np3769FiFdtA0bNrBp0yaGDRtGUFAQ6enpPP3008THx7eqXpDGOHHiBFdeeSUdO3bkpZdeIjc31/5YRESEhpFdnIyMDE6fPk1GRgY2m82+Pk3nzp3t78XWLCUlhXHjxjFw4EAGDx7M/PnzKS0tZcKECVqH1iQlJSUcPHjQfv/w4cNs376d4ODgWp8VrmLy5Mm8//77fPHFF/j5+dnn6wQEBODl5aVxdE0zbdo0rrvuOjp06EBxcTHvv/8+aWlprFy5UuvQmsTPz6/WHJ2a+XwtPnenxa/HEQ4OHz7s8pfo7ty5U73qqqvU4OBg1WQyqbGxsepf//pX9fjx41qH1mRLlixRgTpvrmzcuHF1tmnNmjVah9Zgr732mtqhQwfVaDSqgwcPVn/55RetQ2qyNWvW1Pl6jBs3TuvQmqy+35slS5ZoHVqT3XPPPWrHjh1Vo9GohoaGqldffbX63XffaR2WU2l1ia7MCRFCCCGEJlrnILcQQggh3J4kIUIIIYTQhCQhQgghhNCEJCFCCCGE0IQkIUIIIYTQhCQhQgghhNCEJCFCCCGE0IQkIUIIIYTQhCQhQgghhNCEJCFCCCGE0IQkIUIIIYTQhCQhQgiXkJubS0REBP/4xz/sx9atW4fRaCQ1NVXDyIQQTSUb2AkhXMY333zDqFGjWLduHd26dSMhIYGbbrqJefPmaR2aEKIJJAkRQriUyZMns3r1agYOHMiuXbvYtGkTJpNJ67CEEE0gSYgQwqWUl5fTu3dvjh07xpYtW+jTp4/WIQkhmkjmhAghXEp6ejqZmZkoisKRI0e0DkcIcRGkJ0QI4TKsViuDBw8mISGBbt26MX/+fHbt2kVYWJjWoQkhmkCSECGEy3j00Uf55JNP2LFjB76+vgwfPpyAgAC+/vprrUMTQjSBDMcIIVxCWloa8+fP55133sHf3x+9Xs8777zDjz/+yIIFC7QOTwjRBNITIoQQQghNSE+IEEIIITQhSYgQQgghNCFJiBBCCCE0IUmIEEIIITQhSYgQQgghNCFJiBBCCCE0IUmIEEIIITQhSYgQQgghNCFJiBBCCCE0IUmIEEIIITQhSYgQQgghNPH/fduihKstoRwAAAAASUVORK5CYII=", + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + " ➜ Figure saved to plots/normal_override.png\n" + ] + } + ], + "source": [ + "def example_override_method() -> None:\n", + " print(\"\\n=== Example 4: Overriding the method per sample() call ===\")\n", + " print(\"Goal: compare AUTO vs an explicit PINV override on the same Gaussian distribution.\")\n", + " print(\"Expected mean ≈ 0.000, std ≈ 1.000 for both methods.\")\n", + "\n", + " def pdf_func(x: float, **_: Any) -> float:\n", + " return (1.0 / math.sqrt(2 * math.pi)) * math.exp(-0.5 * x * x)\n", + "\n", + " strategy = DefaultUnuranSamplingStrategy()\n", + " distr = CustomDistribution(\n", + " name=\"Normal N(0,1)\",\n", + " kind=Kind.CONTINUOUS,\n", + " analytical_computations=[\n", + " AnalyticalComputation(target=CharacteristicName.PDF, func=pdf_func),\n", + " ],\n", + " sampling_strategy=strategy,\n", + " )\n", + "\n", + " data_auto = distr.sample(10_000).array.flatten()\n", + " data_pinv = distr.sample(10_000, method=UnuranMethod.PINV).array.flatten()\n", + " print(f\"AUTO: mean={data_auto.mean():.3f}, std={data_auto.std():.3f}\")\n", + " print(f\"PINV: mean={data_pinv.mean():.3f}, std={data_pinv.std():.3f}\")\n", + "\n", + " xs = np.linspace(-4, 4, 400)\n", + " pdf_vals = np.array([pdf_func(x) for x in xs])\n", + " _plot_normal_override(\n", + " \"Normal distribution N(0,1)\",\n", + " xs,\n", + " pdf_vals,\n", + " data_auto,\n", + " data_pinv,\n", + " \"normal_override.png\",\n", + " )\n", + "\n", + "\n", + "example_override_method()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.3" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/examples/plots/discrete_pmf.png b/examples/plots/discrete_pmf.png new file mode 100644 index 0000000..a845910 Binary files /dev/null and b/examples/plots/discrete_pmf.png differ diff --git a/examples/plots/exp_cdf.png b/examples/plots/exp_cdf.png new file mode 100644 index 0000000..a46f298 Binary files /dev/null and b/examples/plots/exp_cdf.png differ diff --git a/examples/plots/exp_pdf.png b/examples/plots/exp_pdf.png new file mode 100644 index 0000000..ddb3bcb Binary files /dev/null and b/examples/plots/exp_pdf.png differ diff --git a/examples/plots/normal_override.png b/examples/plots/normal_override.png new file mode 100644 index 0000000..b6ee180 Binary files /dev/null and b/examples/plots/normal_override.png differ diff --git a/pyproject.toml b/pyproject.toml index 8eb3029..2fc6732 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,11 @@ [build-system] build-backend = "poetry.core.masonry.api" -requires = [ "poetry-core>=1.9" ] +requires = [ + "cffi>=1.16", + "poetry-core>=1.9", + "setuptools>=69", +] [tool.poetry] name = "pysatl-core" @@ -41,10 +45,14 @@ homepage = "https://github.com/PySATL/pysatl-core" repository = "https://github.com/PySATL/pysatl-core" urls.Issues = "https://github.com/PySATL/pysatl-core/issues" +[tool.poetry.build] +script = "src/pysatl_core/stats/_unuran/bindings/_cffi_build.py" + [tool.poetry.dependencies] python = ">=3.12" numpy = "^2.0.0" scipy = ">=1.13" +cffi = "^1.16.0" [tool.poetry.group.dev.dependencies] ruff = ">=0.6" @@ -55,6 +63,7 @@ coverage = { version = ">=7.5", extras = [ "toml" ] } pre-commit = ">=3.6" types-setuptools = "*" scipy-stubs = ">=1.13.0.0" +types-cffi = ">=1.17.0.0" [tool.poetry.group.docs.dependencies] jupyter = "^1.1.1" @@ -63,6 +72,7 @@ matplotlib = "^3.10.6" [tool.ruff] target-version = "py312" line-length = 100 +exclude = [ "vendor" ] format.line-ending = "lf" @@ -77,6 +87,9 @@ lint.isort.force-single-line = false lint.isort.known-first-party = [ "pysatl_core" ] lint.isort.order-by-type = true +[tool.codespell] +skip = "vendor/**" + [tool.pytest.ini_options] addopts = "-q --cov=pysatl_core --cov-report=term-missing" testpaths = [ "tests" ] diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..75d4429 --- /dev/null +++ b/setup.py @@ -0,0 +1,13 @@ +""" +Setup script for pysatl-core with CFFI support. + +This file is needed to integrate CFFI modules with Poetry. +""" + +from setuptools import setup + +setup( + cffi_modules=[ + "src/pysatl_core/stats/_unuran/bindings/_cffi_build.py:ffi", + ], +) diff --git a/src/pysatl_core/stats/_unuran/__init__.py b/src/pysatl_core/stats/_unuran/__init__.py new file mode 100644 index 0000000..c67d6d0 --- /dev/null +++ b/src/pysatl_core/stats/_unuran/__init__.py @@ -0,0 +1,57 @@ +""" +UNU.RAN Integration API +======================= + +This module defines the API for UNU.RAN (Universal Non-Uniform Random Number +Generator) integration. UNU.RAN provides efficient methods for generating +non-uniform random variates from various distributions. + +The API described here will be implemented through C bindings to the UNU.RAN +library in the future. Currently, this module only provides the interface +specification for integration with the distribution sampling system. + +Notes +----- +- UNU.RAN supports multiple sampling methods (inversion, rejection, etc.) +- Methods can be selected automatically or specified explicitly +- The API integrates with the :class:`~pysatl_core.distributions.strategies.SamplingStrategy` + protocol +- Currently, only univariate distributions are supported + +Examples +-------- +Create a UNU.RAN sampling strategy for a distribution: + + >>> from pysatl_core.stats._unuran import ( + >>> create_unuran_strategy, UnuranMethodConfig, UnuranMethod + >>> ) + >>> config = UnuranMethodConfig(method=UnuranMethod.AUTO) + >>> strategy = create_unuran_strategy(config) + >>> sample = strategy.sample(n=1000, distr=my_distribution) +""" + +from __future__ import annotations + +__author__ = "Artem Romanyuk" +__copyright__ = "Copyright (c) 2025 PySATL project" +__license__ = "SPDX-License-Identifier: MIT" + +from pysatl_core.stats._unuran.api import ( + UnuranMethod, + UnuranMethodConfig, + UnuranSampler, + UnuranSamplingStrategy, +) +from pysatl_core.stats._unuran.bindings import ( + DefaultUnuranSampler, + DefaultUnuranSamplingStrategy, +) + +__all__ = [ + "UnuranMethod", + "UnuranMethodConfig", + "UnuranSampler", + "UnuranSamplingStrategy", + "DefaultUnuranSampler", + "DefaultUnuranSamplingStrategy", +] diff --git a/src/pysatl_core/stats/_unuran/api.py b/src/pysatl_core/stats/_unuran/api.py new file mode 100644 index 0000000..6b8cfba --- /dev/null +++ b/src/pysatl_core/stats/_unuran/api.py @@ -0,0 +1,247 @@ +""" +UNU.RAN API Specification +======================== + +This module defines the complete API specification for UNU.RAN integration. +The interfaces described here will be implemented through C bindings to the +UNU.RAN library. + +The API is designed to integrate seamlessly with the existing distribution +sampling infrastructure in pysatl_core. +""" + +from __future__ import annotations + +__author__ = "Artem Romanyuk" +__copyright__ = "Copyright (c) 2025 PySATL project" +__license__ = "SPDX-License-Identifier: MIT" + +from dataclasses import dataclass +from enum import StrEnum +from typing import TYPE_CHECKING, Any, Protocol + +import numpy as np +import numpy.typing as npt + +if TYPE_CHECKING: + from pysatl_core.distributions.distribution import Distribution + from pysatl_core.distributions.sampling import Sample + + +class UnuranMethod(StrEnum): + """ + UNU.RAN sampling methods. + + Methods are categorized by their approach: + - Inversion methods: use inverse CDF + - Rejection methods: accept/reject based on envelope + - Transformation methods: transform from simpler distributions + - Numerical inversion: approximate inverse CDF + - Specialized methods: optimized for specific distribution types + """ + + # Automatic method selection + AUTO = "auto" + + # Inversion methods + PINV = "pinv" # Polynomial interpolation inversion + TDR = "tdr" # Transformed density rejection + + # Rejection methods + ARS = "ars" # Adaptive rejection sampling + AROU = "arou" # Automatic ratio-of-uniforms + HINV = "hinv" # Hermite interpolation inversion + NINV = "ninv" # Numerical inversion + + # Transformation methods + SROU = "srou" # Simple ratio-of-uniforms + SSROU = "ssrou" # Striped simple ratio-of-uniforms + + # Discrete methods + DARI = "dari" # Discrete automatic rejection inversion + DAU = "dau" # Discrete automatic universal + DGT = "dgt" # Discrete guide table method + DSROU = "dsrou" # Discrete simple ratio-of-uniforms + + # Specialized continuous methods + CEMP = "cemp" # Continuous empirical distribution + EMPK = "empk" # Empirical distribution with kernel smoothing + + +@dataclass(frozen=True, slots=True) +class UnuranMethodConfig: + """ + Configuration for a UNU.RAN sampling method. + + Parameters + ---------- + method : UnuranMethod + The sampling method to use. If ``UnuranMethod.AUTO``, UNU.RAN will + automatically select the best method based on available distribution + characteristics. + method_params : dict[str, Any], optional + Method-specific parameters. The exact parameters depend on the chosen + method. Common parameters include: + - ``accuracy``: target accuracy for numerical methods + - ``max_iterations``: maximum iterations for iterative methods + - ``grid_size``: grid size for interpolation methods + - ``smooth``: smoothing parameter for kernel methods + use_ppf : bool, default False + If ``True``, prefer using PPF (inverse CDF) when available. This is + typically the fastest method for univariate distributions. + use_pdf : bool, default True + If ``True``, allow using PDF for rejection-based methods. + use_cdf : bool, default False + If ``True``, allow using CDF for inversion-based methods. + use_registry_characteristics : bool, default True + If ``True``, allow using distribution characteristics from the registry + in addition to those directly available in the Distribution object. + If ``False``, use only characteristics that are directly available + in the Distribution object, without querying the registry. + seed : int | None, default None + Random seed for the sampler. If ``None``, uses system entropy. + + Notes + ----- + - Method-specific parameters are validated when the sampler is created + - Some methods require specific characteristics (e.g., rejection methods + typically need PDF) + - The ``use_*`` flags control which distribution characteristics can be + used, but do not guarantee their use + - When ``use_registry_characteristics`` is ``True``, characteristics may + be retrieved from the distribution registry if not directly available + in the Distribution object + """ + + method: UnuranMethod = UnuranMethod.AUTO + method_params: dict[str, Any] | None = None + use_ppf: bool = False + use_pdf: bool = True + use_cdf: bool = False + use_registry_characteristics: bool = True + seed: int | None = None + + def __post_init__(self) -> None: + """Validate configuration parameters.""" + if self.method_params is None: + object.__setattr__(self, "method_params", {}) + + +class UnuranSampler(Protocol): + """ + Protocol for UNU.RAN sampler instances. + + A sampler is created for a specific distribution and can generate + random variates efficiently. The sampler encapsulates the UNU.RAN + generator object and provides a Python interface for sampling. + + Notes + ----- + - Samplers are stateful and maintain internal random number generator state + - Multiple calls to ``sample()`` produce independent variates + - The sampler is bound to the distribution characteristics used at creation + """ + + def __init__( + self, + distr: Distribution, + config: UnuranMethodConfig | None = None, + **override_options: Any, + ) -> None: + """Initialize the sampler for ``distr`` with optional configuration overrides.""" + ... + + def sample(self, n: int) -> npt.NDArray[np.float64]: + """ + Generate ``n`` random variates from the distribution. + + Parameters + ---------- + n : int + Number of variates to generate. + + Returns + ------- + numpy.ndarray + 1D array of shape ``(n,)`` containing the random variates. + + Raises + ------ + RuntimeError + If sampling fails (e.g., method configuration is invalid, + distribution characteristics are insufficient). + """ + ... + + def reset(self, seed: int | None = None) -> None: + """ + Reset the sampler's random number generator. + + Parameters + ---------- + seed : int | None, optional + New random seed. If ``None``, uses system entropy. + """ + ... + + @property + def method(self) -> UnuranMethod: + """The sampling method used by this sampler.""" + ... + + @property + def is_initialized(self) -> bool: + """Whether the sampler has been successfully initialized.""" + ... + + +class UnuranSamplingStrategy(Protocol): + """ + Protocol for UNU.RAN-based sampling strategies. + + This protocol extends the standard :class:`SamplingStrategy` protocol + with UNU.RAN-specific functionality. It integrates with the distribution + system by implementing the standard ``sample()`` method. + + Notes + ----- + - The strategy may create and cache samplers per distribution + - The strategy handles the conversion from UNU.RAN output to + :class:`~pysatl_core.distributions.sampling.Sample` format + """ + + def sample(self, n: int, distr: Distribution, **options: Any) -> Sample: + """ + Generate a sample from the distribution using UNU.RAN. + + Parameters + ---------- + n : int + Number of observations to draw. + distr : Distribution + The distribution to sample from. + **options : Any + Additional options that may override the default configuration: + - ``method``: override the sampling method + - ``seed``: override the random seed + - Other method-specific parameters + + Returns + ------- + Sample + A 2D sample of shape ``(n, 1)`` for univariate distributions. + + Raises + ------ + RuntimeError + If the distribution type is not supported, or if UNU.RAN + cannot create a sampler with the available characteristics. + ValueError + If the configuration is invalid. + """ + ... + + @property + def default_config(self) -> UnuranMethodConfig: + """Default method configuration.""" + ... diff --git a/src/pysatl_core/stats/_unuran/bindings/__init__.py b/src/pysatl_core/stats/_unuran/bindings/__init__.py new file mode 100644 index 0000000..f23d4e9 --- /dev/null +++ b/src/pysatl_core/stats/_unuran/bindings/__init__.py @@ -0,0 +1,27 @@ +from __future__ import annotations + +__author__ = "Artem Romanyuk" +__copyright__ = "Copyright (c) 2025 PySATL project" +__license__ = "SPDX-License-Identifier: MIT" + +from importlib import import_module +from types import ModuleType + +from ._core import DefaultUnuranSampler, DefaultUnuranSamplingStrategy + +_unuran_cffi_module: ModuleType | None = None +try: + _unuran_cffi_module = import_module("pysatl_core.stats._unuran.bindings._unuran_cffi") +except ModuleNotFoundError: # pragma: no cover - optional binary module + try: + _unuran_cffi_module = import_module("_unuran_cffi") + except ModuleNotFoundError: # pragma: no cover - optional binary module + _unuran_cffi_module = None + +_unuran_cffi: ModuleType | None = _unuran_cffi_module + +__all__ = [ + "DefaultUnuranSampler", + "DefaultUnuranSamplingStrategy", + "_unuran_cffi", +] diff --git a/src/pysatl_core/stats/_unuran/bindings/_cffi_build.py b/src/pysatl_core/stats/_unuran/bindings/_cffi_build.py new file mode 100644 index 0000000..af49703 --- /dev/null +++ b/src/pysatl_core/stats/_unuran/bindings/_cffi_build.py @@ -0,0 +1,278 @@ +""" +CFFI build script for UNURAN. + +Compiles UNURAN from sources in vendor/unuran-1.11.0/ and creates Python bindings. +""" + +from __future__ import annotations + +__author__ = "Artem Romanyuk" +__copyright__ = "Copyright (c) 2025 PySATL project" +__license__ = "SPDX-License-Identifier: MIT" + +import os +import subprocess +import sys +from pathlib import Path +from typing import Any + +from cffi import FFI # type: ignore[import-untyped] + +# TODO: Replace with logging +ENABLE_PRINTS = False + +MODULE_NAME = "pysatl_core.stats._unuran.bindings._unuran_cffi" + + +def _print(*args: Any, **kwargs: Any) -> None: + """Conditionally print based on ENABLE_PRINTS flag.""" + if ENABLE_PRINTS: + print(*args, **kwargs) + + +ffi = FFI() + +ffi.cdef(""" + struct unur_distr; + struct unur_gen; + struct unur_par; + + typedef struct unur_distr* UNUR_DISTR; + typedef struct unur_gen* UNUR_GEN; + typedef struct unur_par* UNUR_PAR; + + UNUR_DISTR unur_distr_cont_new(void); + UNUR_DISTR unur_distr_discr_new(void); + + int unur_distr_cont_set_pdf(UNUR_DISTR distribution, + double (*pdf)(double, const struct unur_distr*)); + int unur_distr_cont_set_dpdf(UNUR_DISTR distribution, + double (*dpdf)(double, const struct unur_distr*)); + int unur_distr_cont_set_cdf(UNUR_DISTR distribution, + double (*cdf)(double, const struct unur_distr*)); + int unur_distr_cont_set_invcdf(UNUR_DISTR distribution, + double (*invcdf)(double, const struct unur_distr*)); + int unur_distr_cont_set_domain(UNUR_DISTR distribution, double left, double right); + int unur_distr_cont_set_mode(UNUR_DISTR distribution, double mode); + int unur_distr_cont_set_pdfparams(UNUR_DISTR distribution, const double* params, int n_params); + + int unur_distr_discr_set_pmf(UNUR_DISTR distribution, + double (*pmf)(int, const struct unur_distr*)); + int unur_distr_discr_set_cdf(UNUR_DISTR distribution, + double (*cdf)(int, const struct unur_distr*)); + int unur_distr_discr_set_pv(UNUR_DISTR distribution, const double* pv, int n_pv); + int unur_distr_discr_set_pmfparams(UNUR_DISTR distribution, const double* params, int n_params); + int unur_distr_discr_set_domain(UNUR_DISTR distribution, int left, int right); + int unur_distr_discr_set_pmfsum(UNUR_DISTR distribution, double sum); + int unur_distr_discr_make_pv(UNUR_DISTR distribution); + + UNUR_PAR unur_arou_new(const UNUR_DISTR distribution); + UNUR_PAR unur_tdr_new(const UNUR_DISTR distribution); + UNUR_PAR unur_hinv_new(const UNUR_DISTR distribution); + UNUR_PAR unur_pinv_new(const UNUR_DISTR distribution); + UNUR_PAR unur_ninv_new(const UNUR_DISTR distribution); + UNUR_PAR unur_dgt_new(const UNUR_DISTR distribution); + + UNUR_GEN unur_init(UNUR_PAR parameters); + + double unur_sample_cont(UNUR_GEN generator); + int unur_sample_discr(UNUR_GEN generator); + int unur_sample_vec(UNUR_GEN generator, double* vector); + + double unur_quantile(UNUR_GEN generator, double U); + + void unur_free(UNUR_GEN generator); + void unur_distr_free(UNUR_DISTR distribution); + void unur_par_free(UNUR_PAR par); + + const char* unur_get_strerror(const int errnocode); + int unur_get_errno(void); + const char* unur_gen_info(UNUR_GEN generator, int help); +""") + + +def _get_project_root() -> Path: + """Finds the project root by searching for pyproject.toml marker.""" + current_file = Path(__file__).resolve() + current_dir = current_file.parent + + while current_dir != current_dir.parent: # Stop at filesystem root + if (current_dir / "pyproject.toml").exists(): + return current_dir + current_dir = current_dir.parent + + raise RuntimeError( + f"Could not find project root (pyproject.toml) starting from {current_file.parent}" + ) + + +def _get_unuran_paths() -> tuple[Path, Path]: + """Determines paths to UNURAN sources.""" + project_root = _get_project_root() + unuran_dir = project_root / "vendor" / "unuran-1.11.0" + unuran_src = unuran_dir / "src" + + if not unuran_src.exists(): + raise FileNotFoundError( + f"UNURAN sources not found at {unuran_src}\n" + f"Expected location: {project_root}/vendor/unuran-1.11.0/src/" + ) + + return unuran_dir, unuran_src + + +def _build_unuran_library(unuran_dir: Path, build_dir: Path) -> tuple[Path | None, Path]: + """ + Builds UNURAN library via autotools. + + Returns: + (lib_path, include_dir): Path to library and directory with headers + """ + build_dir.mkdir(parents=True, exist_ok=True) + + configure_script = unuran_dir / "configure" + if not configure_script.exists(): + _print("Warning: configure script not found, will try to link with system library") + return None, unuran_dir / "src" + + _print("Configuring UNURAN...") + try: + env = os.environ.copy() + env["CFLAGS"] = "-fPIC " + env.get("CFLAGS", "") + subprocess.run( + [ + str(configure_script), + f"--prefix={build_dir}", + "--enable-static", + "--disable-shared", + ], + cwd=str(unuran_dir), + check=True, + capture_output=True, + env=env, + ) + except subprocess.CalledProcessError as e: + error_msg = e.stderr.decode() if e.stderr else "Unknown error" + _print(f"Warning: configure failed: {error_msg}") + _print("Will try to link with system library") + return None, unuran_dir / "src" + + _print("Cleaning previous build (if any)...") + subprocess.run( + ["make", "clean"], + cwd=str(unuran_dir), + capture_output=True, + ) + + _print("Building UNURAN...") + try: + env = os.environ.copy() + env["CFLAGS"] = "-fPIC " + env.get("CFLAGS", "") + subprocess.run( + ["make", "-j"], + cwd=str(unuran_dir), + check=True, + capture_output=True, + env=env, + ) + except subprocess.CalledProcessError as e: + error_msg = e.stderr.decode() if e.stderr else "Unknown error" + _print(f"Warning: make failed: {error_msg}") + _print("Will try to link with system library") + return None, unuran_dir / "src" + + lib_paths = [ + unuran_dir / "src" / ".libs" / "libunuran.a", + unuran_dir / ".libs" / "libunuran.a", + build_dir / "lib" / "libunuran.a", + ] + + for lib_path in lib_paths: + if lib_path.exists(): + _print(f"Found UNURAN library at {lib_path}") + return lib_path, unuran_dir / "src" + + _print("Warning: Built library not found, will try to link with system library") + return None, unuran_dir / "src" + + +def _setup_static_source(static_lib: Path, include_dir: Path) -> None: + """Scenario 1: Link with the freshly built static library.""" + _print(f"Using static library: {static_lib}") + ffi.set_source( + MODULE_NAME, + '#include "unuran.h"', + extra_objects=[str(static_lib)], + include_dirs=[str(include_dir)], + libraries=[], + extra_compile_args=["-std=c99", "-O2"], + ) + + +def _setup_system_source(include_dir: Path, system_lib_path: str) -> None: + """Scenario 2: Link with a library installed in the system.""" + _print(f"Using system library: {system_lib_path}") + ffi.set_source( + MODULE_NAME, + '#include "unuran.h"', + libraries=["unuran"], + include_dirs=[str(include_dir)], + library_dirs=[os.path.dirname(system_lib_path)], + ) + + +def _setup_fallback_source(include_dir: Path) -> None: + """Scenario 3: Attempt direct compilation (fallback if no library found).""" + _print("Warning: No pre-built library found, attempting direct source compilation") + _print("This may fail due to complex dependencies. Consider building UNURAN first.") + ffi.set_source( + MODULE_NAME, + '#include "unuran.h"', + include_dirs=[str(include_dir)], + libraries=["unuran"], + extra_compile_args=["-std=c99"], + ) + + +def main() -> None: + # TODO windows support + if os.name == "nt" or sys.platform.startswith("win"): + print("Skipping UNURAN CFFI build: Windows platform is not supported.") + return + + project_root = _get_project_root() + unuran_dir, unuran_src = _get_unuran_paths() + build_dir = unuran_dir.parent / "unuran-build" + + static_lib, include_dir = _build_unuran_library(unuran_dir, build_dir) + + if static_lib and static_lib.exists(): + _setup_static_source(static_lib, include_dir) + else: + import ctypes.util + + system_lib = ctypes.util.find_library("unuran") + + if system_lib: + _setup_system_source(include_dir, system_lib) + else: + _setup_fallback_source(include_dir) + + _print("Compiling CFFI bindings for UNURAN...") + _print(f"UNURAN source directory: {unuran_src}") + _print(f"Include directory: {include_dir}") + if static_lib: + _print(f"Static library: {static_lib}") + + build_output_dir = project_root / "src" + previous_cwd = Path.cwd() + try: + os.chdir(build_output_dir) + ffi.compile(verbose=True) + finally: + os.chdir(previous_cwd) + _print("Compilation complete!") + + +if __name__ == "__main__": + main() diff --git a/src/pysatl_core/stats/_unuran/bindings/_core/__init__.py b/src/pysatl_core/stats/_unuran/bindings/_core/__init__.py new file mode 100644 index 0000000..8b3c130 --- /dev/null +++ b/src/pysatl_core/stats/_unuran/bindings/_core/__init__.py @@ -0,0 +1,14 @@ +__author__ = "Artem Romanyuk" +__copyright__ = "Copyright (c) 2025 PySATL project" +__license__ = "SPDX-License-Identifier: MIT" +from .unuran_sampler import ( + DefaultUnuranSampler, +) +from .unuran_sampling_strategy import ( + DefaultUnuranSamplingStrategy, +) + +__all__ = [ + "DefaultUnuranSampler", + "DefaultUnuranSamplingStrategy", +] diff --git a/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/__init__.py b/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/__init__.py new file mode 100644 index 0000000..1f6d799 --- /dev/null +++ b/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/__init__.py @@ -0,0 +1,43 @@ +from .callbacks import ( + create_cdf_callback, + create_dpdf_callback, + create_pdf_callback, + create_pmf_callback, + create_ppf_callback, + setup_continuous_callbacks, + setup_discrete_callbacks, +) +from .cleanup import cleanup_unuran_resources +from .dgt import setup_dgt_method +from .domain import ( + calculate_pmf_sum, + determine_domain_from_pmf, + determine_domain_from_support, +) +from .initialization import ( + create_and_init_generator, + create_parameter_object, + create_unuran_distribution, + initialize_unuran_components, +) +from .utils import get_unuran_error_message + +__all__ = [ + "calculate_pmf_sum", + "cleanup_unuran_resources", + "create_and_init_generator", + "create_cdf_callback", + "create_dpdf_callback", + "create_parameter_object", + "create_pdf_callback", + "create_pmf_callback", + "create_ppf_callback", + "create_unuran_distribution", + "determine_domain_from_pmf", + "determine_domain_from_support", + "get_unuran_error_message", + "initialize_unuran_components", + "setup_continuous_callbacks", + "setup_dgt_method", + "setup_discrete_callbacks", +] diff --git a/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/callbacks.py b/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/callbacks.py new file mode 100644 index 0000000..0c5ae22 --- /dev/null +++ b/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/callbacks.py @@ -0,0 +1,234 @@ +from __future__ import annotations + +from typing import Any + +from pysatl_core.types import CharacteristicName + + +def create_pdf_callback(sampler: Any) -> Any | None: + """ + Create PDF callback function for continuous distributions. + + Returns + ------- + CFFI callback or None + CFFI callback function that wraps the distribution's PDF computation, + or None if the distribution is not continuous or PDF is not available. + + Notes + ----- + The callback signature matches UNURAN's expected format: + ``double(double, const struct unur_distr*)`` + + The callback is stored in ``_callbacks`` list to prevent garbage collection. + """ + if not sampler._is_continuous: + return None + + analytical_comps = sampler.distr.analytical_computations + if CharacteristicName.PDF not in analytical_comps: + return None + + pdf_func = analytical_comps[CharacteristicName.PDF] + + def pdf_callback(x: float, distr_ptr: Any) -> float: + return float(pdf_func(x)) + + return sampler._ffi.callback("double(double, const struct unur_distr*)", pdf_callback) + + +def create_pmf_callback(sampler: Any) -> Any | None: + """ + Create PMF callback function for discrete distributions. + + Returns + ------- + CFFI callback or None + CFFI callback function that wraps the distribution's PMF computation, + or None if the distribution is not discrete or PMF/PDF is not available. + + Notes + ----- + The callback signature matches UNURAN's expected format: + ``double(int, const struct unur_distr*)`` + + If PMF is not available, falls back to PDF (some systems use "pdf" for + discrete distributions too). The callback is stored in ``_callbacks`` + list to prevent garbage collection. + """ + if sampler._is_continuous: + return None + + analytical_comps = sampler.distr.analytical_computations + + if CharacteristicName.PMF in analytical_comps: + pmf_func = analytical_comps[CharacteristicName.PMF] + + def pmf_callback(k: int, distr_ptr: Any) -> float: + return float(pmf_func(float(k))) + + return sampler._ffi.callback("double(int, const struct unur_distr*)", pmf_callback) + + if CharacteristicName.PDF in analytical_comps: + pdf_func = analytical_comps[CharacteristicName.PDF] + + def pmf_callback(k: int, distr_ptr: Any) -> float: + return float(pdf_func(float(k))) + + return sampler._ffi.callback("double(int, const struct unur_distr*)", pmf_callback) + + return None + + +def create_cdf_callback(sampler: Any) -> Any | None: + """ + Create PMF callback function for discrete distributions. + + Returns + ------- + CFFI callback or None + CFFI callback function that wraps the distribution's PMF computation, + or None if the distribution is not discrete or PMF/PDF is not available. + + Notes + ----- + The callback signature matches UNURAN's expected format: + ``double(int, const struct unur_distr*)`` + + If PMF is not available, falls back to PDF (some systems use "pdf" for + discrete distributions too). The callback is stored in ``_callbacks`` + list to prevent garbage collection. + """ + analytical_comps = sampler.distr.analytical_computations + if CharacteristicName.CDF not in analytical_comps: + return None + + cdf_func = analytical_comps[CharacteristicName.CDF] + + if sampler._is_continuous: + + def cdf_callback_cont(x: float, distr_ptr: Any) -> float: + return float(cdf_func(x)) + + return sampler._ffi.callback("double(double, const struct unur_distr*)", cdf_callback_cont) + + def cdf_callback_discr(k: int, distr_ptr: Any) -> float: + return float(cdf_func(float(k))) + + return sampler._ffi.callback("double(int, const struct unur_distr*)", cdf_callback_discr) + + +def create_ppf_callback(sampler: Any) -> Any | None: + """ + Create PPF (inverse CDF) callback for continuous distributions. + + Returns + ------- + CFFI callback or None + Callback wrapping the distribution's PPF computation, or None if the + distribution is not continuous or lacks a PPF implementation. + """ + if not sampler._is_continuous: + return None + + analytical_comps = sampler.distr.analytical_computations + if CharacteristicName.PPF not in analytical_comps: + return None + + ppf_func = analytical_comps[CharacteristicName.PPF] + + def ppf_callback(u: float, distr_ptr: Any) -> float: + return float(ppf_func(u)) + + return sampler._ffi.callback("double(double, const struct unur_distr*)", ppf_callback) + + +def create_dpdf_callback() -> None: + """ + Create derivative PDF (dPDF) callback function. + + Returns + ------- + None + Currently always returns None as derivatives are not computed + automatically. + + Notes + ----- + This is a placeholder for future enhancement. Automatic differentiation + could be used to compute derivatives of PDF functions, which would enable + additional UNURAN methods like AROU and TDR that require dPDF. + """ + return None + + +def setup_continuous_callbacks(sampler: Any) -> None: + """ + Set up callbacks for continuous distributions. + + Configures PDF, dPDF (if available), and CDF callbacks for the UNURAN + continuous distribution object. + + Raises + ------ + RuntimeError + If setting the PDF callback fails (non-zero return code). + + Notes + ----- + All created callbacks are appended to ``_callbacks`` list to prevent + garbage collection. Only available callbacks are set (missing + characteristics are skipped). + """ + pdf_callback = sampler._create_pdf_callback() + if pdf_callback: + sampler._callbacks.append(pdf_callback) + result = sampler._lib.unur_distr_cont_set_pdf(sampler._unuran_distr, pdf_callback) + if result != 0: + raise RuntimeError(f"Failed to set PDF callback (error code: {result})") + + dpdf_callback = sampler._create_dpdf_callback() + if dpdf_callback: + sampler._callbacks.append(dpdf_callback) + sampler._lib.unur_distr_cont_set_dpdf(sampler._unuran_distr, dpdf_callback) + + cdf_callback = sampler._create_cdf_callback() + if cdf_callback: + sampler._callbacks.append(cdf_callback) + sampler._lib.unur_distr_cont_set_cdf(sampler._unuran_distr, cdf_callback) + + ppf_callback = sampler._create_ppf_callback() + if ppf_callback and hasattr(sampler._lib, "unur_distr_cont_set_invcdf"): + sampler._callbacks.append(ppf_callback) + sampler._lib.unur_distr_cont_set_invcdf(sampler._unuran_distr, ppf_callback) + + +def setup_discrete_callbacks(sampler: Any) -> None: + """ + Set up callbacks for discrete distributions. + + Configures PMF and CDF callbacks for the UNURAN discrete distribution + object. + + Raises + ------ + RuntimeError + If setting the PMF callback fails (non-zero return code). + + Notes + ----- + All created callbacks are appended to ``_callbacks`` list to prevent + garbage collection. Only available callbacks are set (missing + characteristics are skipped). + """ + pmf_callback = sampler._create_pmf_callback() + if pmf_callback: + sampler._callbacks.append(pmf_callback) + result = sampler._lib.unur_distr_discr_set_pmf(sampler._unuran_distr, pmf_callback) + if result != 0: + raise RuntimeError(f"Failed to set PMF callback (error code: {result})") + + cdf_callback = sampler._create_cdf_callback() + if cdf_callback: + sampler._callbacks.append(cdf_callback) + sampler._lib.unur_distr_discr_set_cdf(sampler._unuran_distr, cdf_callback) diff --git a/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/cleanup.py b/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/cleanup.py new file mode 100644 index 0000000..a3b1a79 --- /dev/null +++ b/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/cleanup.py @@ -0,0 +1,59 @@ +from __future__ import annotations + +import contextlib +from typing import Any + + +def cleanup_unuran_resources(sampler: Any) -> None: + """ + Clean up UNURAN resources. + + Frees all allocated UNURAN objects (generator, parameter object, + distribution object) in the correct order to avoid memory leaks. + + Notes + ----- + Cleanup order: + 1. Free generator first (this also frees the private copy of distr) + 2. Free parameter object (only if generator was not initialized) + 3. Free the original distribution object + + Important notes: + - After ``unur_init(par)``, the par object is automatically destroyed + by UNURAN, so it should NOT be freed after successful initialization + - UNURAN creates a private copy of distr inside gen, so the original + distr can be safely freed after freeing gen + - Callbacks are kept in ``_callbacks`` list to prevent garbage collection + until the object is deleted + - This method is idempotent (safe to call multiple times) + """ + if getattr(sampler, "_cleaned_up", False): + return + + sampler._cleaned_up = True + + gen_freed = False + if hasattr(sampler, "_unuran_gen") and sampler._unuran_gen is not None: + if sampler._unuran_gen != sampler._ffi.NULL: + with contextlib.suppress(Exception): + sampler._lib.unur_free(sampler._unuran_gen) + gen_freed = True + sampler._unuran_gen = None + + if hasattr(sampler, "_unuran_par") and sampler._unuran_par is not None: + if not gen_freed and sampler._unuran_par != sampler._ffi.NULL: + with contextlib.suppress(Exception): + sampler._lib.unur_par_free(sampler._unuran_par) + sampler._unuran_par = None + + if hasattr(sampler, "_unuran_distr") and sampler._unuran_distr is not None: + if sampler._unuran_distr != sampler._ffi.NULL: + with contextlib.suppress(Exception): + sampler._lib.unur_distr_free(sampler._unuran_distr) + sampler._unuran_distr = None + + if hasattr(sampler, "_callbacks"): + pass + + +__all__ = ["cleanup_unuran_resources"] diff --git a/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/dgt.py b/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/dgt.py new file mode 100644 index 0000000..80b34c0 --- /dev/null +++ b/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/dgt.py @@ -0,0 +1,103 @@ +from __future__ import annotations + +from typing import Any + +from .domain import ( + calculate_pmf_sum, + determine_domain_from_pmf, + determine_domain_from_support, +) +from .utils import get_unuran_error_message + + +def _require_attr(lib: Any, attr_name: str) -> None: + """ + Check if a required UNURAN CFFI attribute is available. + + Parameters + ---------- + lib : Any + The UNURAN CFFI library object + attr_name : str + Name of the required attribute/function + + Raises + ------ + RuntimeError + If the required attribute is not available + """ + if not hasattr(lib, attr_name): + raise RuntimeError( + f"{attr_name} is not available. " + "Please recompile CFFI module: " + "cd src/pysatl_core/stats/_unuran/bindings && python3 _cffi_build.py" + ) + + +def setup_dgt_method(sampler: Any) -> None: + """ + Set up DGT method specific requirements (domain and probability vector). + + The DGT (Discrete Generation Table) method requires: + 1. A domain to be set for the discrete distribution + 2. A probability vector (PV) to be created from the PMF + + Raises + ------ + RuntimeError + If required CFFI functions are not available, if domain setting fails, + or if PV creation fails. + + Notes + ----- + - Domain is determined from distribution support if available + - If support is unbounded or unavailable, domain is determined by + evaluating PMF until cumulative probability exceeds threshold (0.9999) + - PMF sum is calculated from the domain if possible, otherwise defaults to 1.0 + - This method should only be called for discrete distributions using + the DGT method + """ + lib = sampler._lib + ffi = sampler._ffi + + _require_attr(lib, "unur_distr_discr_set_domain") + _require_attr(lib, "unur_distr_discr_make_pv") + + domain_info = determine_domain_from_support(sampler) + + if domain_info is None: + domain_left, domain_right = determine_domain_from_pmf(sampler) + else: + domain_left_candidate, domain_right_candidate = domain_info + if domain_right_candidate is None: + domain_left, domain_right = determine_domain_from_pmf(sampler, domain_left_candidate) + else: + domain_left = domain_left_candidate + domain_right = domain_right_candidate + + result = lib.unur_distr_discr_set_domain(sampler._unuran_distr, domain_left, domain_right) + if result != 0: + raise RuntimeError( + f"Failed to set domain for discrete distribution (error code: {result}). " + f"Tried domain [{domain_left}, {domain_right}]" + ) + + pmf_sum = calculate_pmf_sum(sampler, domain_left, domain_right) + if hasattr(lib, "unur_distr_discr_set_pmfsum"): + lib.unur_distr_discr_set_pmfsum(sampler._unuran_distr, pmf_sum) + + pv_length = lib.unur_distr_discr_make_pv(sampler._unuran_distr) + if pv_length <= 0: + error_msg = ( + f"Failed to create PV from PMF (returned length: {pv_length}). " + "DGT method requires PV. " + "The PMF might not be normalized or domain is too large. " + f"Domain was set to [{domain_left}, {domain_right}], " + f"PMF sum calculated as {pmf_sum:.6f}. " + "Try setting a smaller domain or providing PV directly." + ) + full_error_msg = get_unuran_error_message(lib, ffi, error_msg) + raise RuntimeError(full_error_msg) + + +__all__ = ["setup_dgt_method"] diff --git a/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/domain.py b/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/domain.py new file mode 100644 index 0000000..4f3b610 --- /dev/null +++ b/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/domain.py @@ -0,0 +1,171 @@ +from __future__ import annotations + +from typing import Any + +import numpy as np + +from pysatl_core.types import CharacteristicName + + +def determine_domain_from_support(sampler: Any) -> tuple[int, int | None] | None: + """ + Determine domain boundaries from distribution support if available. + + Returns + ------- + tuple[int, int | None] or None + Domain as (left, right) if support is bounded, or (left, None) if only + left boundary is known, or None if support is unavailable/unbounded. + """ + support = sampler.distr.support + if support is None: + return None + + from pysatl_core.distributions.support import ( + ExplicitTableDiscreteSupport, + IntegerLatticeDiscreteSupport, + ) + + if isinstance(support, ExplicitTableDiscreteSupport): + points = support.points + if points.size == 0: + return None + left = int(np.floor(points[0])) + right = int(np.ceil(points[-1])) + return (left, right) + + if isinstance(support, IntegerLatticeDiscreteSupport): + first = support.first() + last = support.last() + + if first is not None and last is not None: + return (first, last) + + if first is not None: + return (first, None) + + return None + + first_callable = getattr(support, "first", None) + last_callable = getattr(support, "last", None) + + if callable(first_callable) and callable(last_callable): + try: + first = first_callable() + last = last_callable() + if first is not None and last is not None: + return (int(first), int(last)) + except TypeError: + pass + + return None + + +def determine_domain_from_pmf( + sampler: Any, + domain_left: int | None = None, +) -> tuple[int, int]: + """ + Determine domain boundaries by evaluating PMF until probability becomes negligible. + + This heuristic evaluates PMF starting from domain_left (or 0 if None) + and finds the right boundary where cumulative probability exceeds threshold. + + Parameters + ---------- + domain_left : int, optional + Left boundary of domain. If None, starts from 0. + + Returns + ------- + tuple[int, int] + Domain as (left, right). + """ + analytical_comps = sampler.distr.analytical_computations + + if CharacteristicName.PMF in analytical_comps: + pmf_func = analytical_comps[CharacteristicName.PMF] + elif CharacteristicName.PDF in analytical_comps: + pmf_func = analytical_comps[CharacteristicName.PDF] + else: + raise RuntimeError("PMF or PDF is required for domain determination") + + if domain_left is None: + start_k = 0 + for k in range(-10, 0): + try: + p = float(pmf_func(float(k))) + if p > 1e-10: + start_k = k + break + except (ValueError, TypeError): + break + domain_left = start_k + else: + domain_left = int(domain_left) + + cumulative_prob = 0.0 + threshold = 0.9999 + max_iterations = 10000 + domain_right = domain_left + + for k in range(domain_left, domain_left + max_iterations): + try: + p = float(pmf_func(float(k))) + if p < 0 or np.isnan(p) or np.isinf(p): + break + cumulative_prob += p + domain_right = k + + if cumulative_prob >= threshold: + break + if k > domain_left + 100 and p < 1e-10: + break + except (ValueError, TypeError): + break + + return (domain_left, domain_right) + + +def calculate_pmf_sum(sampler: Any, domain_left: int, domain_right: int) -> float: + """ + Calculate the sum of PMF over the specified domain. + + Parameters + ---------- + domain_left : int + Left boundary of domain. + domain_right : int + Right boundary of domain. + + Returns + ------- + float + Sum of PMF values over the domain. + """ + analytical_comps = sampler.distr.analytical_computations + + if CharacteristicName.PMF in analytical_comps: + pmf_func = analytical_comps[CharacteristicName.PMF] + elif CharacteristicName.PDF in analytical_comps: + pmf_func = analytical_comps[CharacteristicName.PDF] + else: + return 1.0 + + total = 0.0 + for k in range(domain_left, domain_right + 1): + try: + p = float(pmf_func(float(k))) + if p >= 0 and not (np.isnan(p) or np.isinf(p)): + total += p + except (ValueError, TypeError): + continue + + return total + + +__all__ = [ + "calculate_pmf_sum", + "determine_domain_from_pmf", + "determine_domain_from_support", +] diff --git a/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/initialization.py b/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/initialization.py new file mode 100644 index 0000000..947a27f --- /dev/null +++ b/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/initialization.py @@ -0,0 +1,140 @@ +from __future__ import annotations + +from typing import Any + +from pysatl_core.stats._unuran.api import UnuranMethod + + +def create_unuran_distribution(sampler: Any) -> None: + """ + Create UNURAN distribution object. + + Raises + ------ + RuntimeError + If the distribution object creation fails (returns NULL pointer). + + Notes + ----- + Creates either a continuous or discrete UNURAN distribution object + based on ``_is_continuous`` flag. The created object is stored in + ``_unuran_distr`` attribute. + """ + if sampler._is_continuous: + sampler._unuran_distr = sampler._lib.unur_distr_cont_new() + else: + sampler._unuran_distr = sampler._lib.unur_distr_discr_new() + + if sampler._unuran_distr == sampler._ffi.NULL: + raise RuntimeError("Failed to create UNURAN distribution object") + + +def create_parameter_object(sampler: Any) -> Any: + """ + Create UNURAN parameter object based on selected method. + + Returns + ------- + CFFI pointer + Pointer to the created UNURAN parameter object, or NULL pointer + if creation fails. + + Raises + ------ + ValueError + If the method is SROU (not available in CFFI bindings) or if the + method is unsupported. + + Notes + ----- + Maps UNURAN methods to their corresponding CFFI creation functions: + - AROU: ``unur_arou_new()`` + - TDR: ``unur_tdr_new()`` + - HINV: ``unur_hinv_new()`` + - PINV: ``unur_pinv_new()`` + - NINV: ``unur_ninv_new()`` + - DGT: ``unur_dgt_new()`` + + Note that AROU and TDR require dPDF, which may not be available. + """ + method = sampler._method + lib = sampler._lib + + if method == UnuranMethod.AROU: + return lib.unur_arou_new(sampler._unuran_distr) + if method == UnuranMethod.TDR: + return lib.unur_tdr_new(sampler._unuran_distr) + if method == UnuranMethod.HINV: + return lib.unur_hinv_new(sampler._unuran_distr) + if method == UnuranMethod.PINV: + return lib.unur_pinv_new(sampler._unuran_distr) + if method == UnuranMethod.NINV: + return lib.unur_ninv_new(sampler._unuran_distr) + if method == UnuranMethod.DGT: + return lib.unur_dgt_new(sampler._unuran_distr) + if method == UnuranMethod.SROU: + raise ValueError("Method SROU is not available in CFFI bindings. Use PINV instead.") + + raise ValueError(f"Unsupported UNURAN method: {method}") + + +def create_and_init_generator(sampler: Any) -> None: + """ + Create UNURAN parameter object and initialize the generator. + + Raises + ------ + RuntimeError + If parameter object creation fails or generator initialization fails. + + Notes + ----- + The parameter object is created based on the selected method (PINV, HINV, + DGT, etc.). After successful initialization, the parameter object is + automatically destroyed by UNURAN, so it should not be freed manually. + + The initialized generator is stored in ``_unuran_gen`` attribute. + """ + sampler._unuran_par = sampler._create_parameter_object() + if sampler._unuran_par == sampler._ffi.NULL: + error_msg = sampler._get_unuran_error_message("Failed to create UNURAN parameter object") + raise RuntimeError(error_msg) + + sampler._unuran_gen = sampler._lib.unur_init(sampler._unuran_par) + if sampler._unuran_gen == sampler._ffi.NULL: + error_msg = sampler._get_unuran_error_message("Failed to initialize UNURAN generator") + raise RuntimeError(error_msg) + + +def initialize_unuran_components(sampler: Any, seed: int | None) -> None: + """ + Initialize all UNURAN components for the sampler. + + Parameters + ---------- + seed : int, optional + Random seed for the generator. Currently not used. + """ + # TODO seed support + sampler._create_unuran_distribution() + + try: + if sampler._is_continuous: + sampler._setup_continuous_callbacks() + else: + sampler._setup_discrete_callbacks() + if sampler._method == UnuranMethod.DGT: + sampler._setup_dgt_method() + + sampler._create_and_init_generator() + except Exception: + sampler._cleanup() + raise + + +__all__ = [ + "create_and_init_generator", + "create_parameter_object", + "create_unuran_distribution", + "initialize_unuran_components", +] diff --git a/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/utils.py b/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/utils.py new file mode 100644 index 0000000..722154b --- /dev/null +++ b/src/pysatl_core/stats/_unuran/bindings/_core/_unuran_sampler/utils.py @@ -0,0 +1,34 @@ +from __future__ import annotations + +from typing import Any + + +def get_unuran_error_message(lib: Any, ffi: Any, base_msg: str) -> str: + """ + Format UNURAN error message with errno and error string. + + Parameters + ---------- + base_msg : str + Base error message to format. + + Returns + ------- + str + Formatted error message including errno and UNURAN error string + (if available). + + Notes + ----- + This helper method retrieves the current UNURAN error state and formats + a comprehensive error message for debugging purposes. + """ + errno = lib.unur_get_errno() + error_str = lib.unur_get_strerror(errno) if errno != 0 else None + error_msg = f"{base_msg} (errno: {errno})" + if error_str: + error_msg += f": {ffi.string(error_str).decode('utf-8')}" + return error_msg + + +__all__ = ["get_unuran_error_message"] diff --git a/src/pysatl_core/stats/_unuran/bindings/_core/helpers.py b/src/pysatl_core/stats/_unuran/bindings/_core/helpers.py new file mode 100644 index 0000000..6ef39c4 --- /dev/null +++ b/src/pysatl_core/stats/_unuran/bindings/_core/helpers.py @@ -0,0 +1,142 @@ +""" +UNU.RAN Helper Functions +======================== + +This module provides helper functions for UNU.RAN integration, including +characteristic detection and automatic method selection for sampling. +""" + +from __future__ import annotations + +__author__ = "Artem Romanyuk" +__copyright__ = "Copyright (c) 2025 PySATL project" +__license__ = "SPDX-License-Identifier: MIT" + +from typing import TYPE_CHECKING + +from pysatl_core.stats._unuran.api import UnuranMethod, UnuranMethodConfig +from pysatl_core.types import CharacteristicName, GenericCharacteristicName, Kind + +if TYPE_CHECKING: + from pysatl_core.distributions.distribution import Distribution + + +# TODO: move to registry module +def _get_available_characteristics(distr: Distribution) -> set[GenericCharacteristicName]: + """ + Get the set of available characteristic names for a distribution. + + This helper function queries the distribution's analytical computations + and uses the characteristic graph to determine all reachable characteristics. + + The function works by: + 1. Getting all analytical (base) characteristics from the distribution + 2. For each analytical characteristic, finding all characteristics reachable + through the graph using BFS + 3. Combining all reachable characteristics into a single set + + Parameters + ---------- + distr : Distribution + The distribution to query. + + Returns + ------- + set[GenericCharacteristicName] + Set of available characteristic names (e.g., {CharacteristicName.PDF, + CharacteristicName.CDF, CharacteristicName.PPF}). + Includes both analytical characteristics and those reachable through + the characteristic graph. + + Notes + ----- + - If the distribution has no analytical computations, returns an empty set + - The graph is obtained from the global characteristic registry + - Characteristics are considered "available" if they can be computed either + analytically or through graph-based conversions + """ + from pysatl_core.distributions.registry import characteristic_registry + + analytical_chars = set(distr.analytical_computations.keys()) + + if not analytical_chars: + return set() + + view = characteristic_registry().view(distr) + available = set(analytical_chars) + + for src_char in analytical_chars: + if src_char not in view.all_characteristics: + continue + + # Simple BFS to find all reachable nodes in the view + visited = {src_char} + queue = [src_char] + while queue: + v = queue.pop(0) + for w in view.successors_nodes(v): + if w not in visited: + visited.add(w) + queue.append(w) + available.update(visited) + + return available + + +def _select_best_method( + available_chars: set[GenericCharacteristicName], + kind: Kind, + config: UnuranMethodConfig, +) -> UnuranMethod: + """ + Select the best UNU.RAN method based on available characteristics. + + This function implements heuristics for method selection when + ``method=AUTO``. + + Parameters + ---------- + available_chars : set[GenericCharacteristicName] + Set of available characteristic names. + kind : Kind + Distribution kind (continuous or discrete). + config : UnuranMethodConfig + Method configuration. + + Returns + ------- + UnuranMethod + The selected method. + + Notes + ----- + - If PPF is available and ``use_ppf=True``, prefer PINV or HINV + - If PDF is available, prefer rejection methods (TDR, ARS) + - If CDF is available, prefer numerical inversion (NINV) + - For discrete distributions, prefer discrete-specific methods + """ + # Note: Only methods available in CFFI bindings are used + if kind == Kind.CONTINUOUS: + if CharacteristicName.PPF in available_chars and config.use_ppf: + return UnuranMethod.PINV + elif CharacteristicName.PDF in available_chars and config.use_pdf: + # PINV works with PDF (and optionally CDF/mode) + # AROU and TDR require dPDF which we may not have + return UnuranMethod.PINV + elif CharacteristicName.CDF in available_chars and config.use_cdf: + return UnuranMethod.NINV + elif CharacteristicName.PDF in available_chars: + return UnuranMethod.PINV # PINV works with PDF + else: + raise RuntimeError( + "No suitable method found. Need at least PDF, CDF, or PPF " + "for continuous distributions." + ) + else: + # Discrete distributions + if CharacteristicName.PMF in available_chars or CharacteristicName.PDF in available_chars: + return UnuranMethod.DGT + else: + raise RuntimeError( + "No suitable method found. Need at least PMF for discrete distributions." + ) diff --git a/src/pysatl_core/stats/_unuran/bindings/_core/unuran_sampler.py b/src/pysatl_core/stats/_unuran/bindings/_core/unuran_sampler.py new file mode 100644 index 0000000..40c4724 --- /dev/null +++ b/src/pysatl_core/stats/_unuran/bindings/_core/unuran_sampler.py @@ -0,0 +1,367 @@ +""" +UNU.RAN Default Sampler +======================= + +This module provides the default UNU.RAN sampler implementation that uses +the UNU.RAN library for efficient random variate generation from probability +distributions. The sampler automatically selects appropriate sampling methods +based on available distribution characteristics. +""" + +from __future__ import annotations + +__author__ = "Artem Romanyuk" +__copyright__ = "Copyright (c) 2025 PySATL project" +__license__ = "SPDX-License-Identifier: MIT" + +import contextlib +from typing import TYPE_CHECKING, Any + +import numpy as np +import numpy.typing as npt + +from pysatl_core.stats._unuran.api import UnuranMethod, UnuranMethodConfig +from pysatl_core.stats._unuran.bindings._core._unuran_sampler import ( + calculate_pmf_sum, + cleanup_unuran_resources, + create_and_init_generator, + create_cdf_callback, + create_dpdf_callback, + create_parameter_object, + create_pdf_callback, + create_pmf_callback, + create_ppf_callback, + create_unuran_distribution, + determine_domain_from_pmf, + determine_domain_from_support, + get_unuran_error_message, + initialize_unuran_components, + setup_continuous_callbacks, + setup_dgt_method, + setup_discrete_callbacks, +) +from pysatl_core.stats._unuran.bindings._core.helpers import ( + _get_available_characteristics, + _select_best_method, +) +from pysatl_core.types import EuclideanDistributionType, GenericCharacteristicName, Kind + +if TYPE_CHECKING: + from pysatl_core.distributions.distribution import Distribution + + +class DefaultUnuranSampler: + """ + Default UNU.RAN sampler implementation. + + This sampler provides a default implementation for generating random variates + from probability distributions using the UNU.RAN library. It automatically + selects appropriate sampling methods based on available distribution + characteristics (PDF, CDF, PPF, PMF). + + The sampler supports both continuous and discrete univariate distributions + and uses various UNU.RAN methods (PINV, HINV, NINV, DGT, etc.) depending on + the available characteristics and configuration. + + Attributes + ---------- + distr : Distribution + The probability distribution to sample from. + config : UnuranMethodConfig + Configuration for method selection and parameters. + method : UnuranMethod + The sampling method currently used by this sampler. + is_initialized : bool + Whether the sampler has been successfully initialized. + + Notes + ----- + - Only univariate Euclidean distributions are supported + - The sampler automatically selects the best method if ``method=AUTO`` + - Callbacks are kept alive to prevent garbage collection issues with CFFI + - Resources are automatically cleaned up when the object is deleted + """ + + def __init__( + self, distr: Distribution, config: UnuranMethodConfig | None = None, **override_options: Any + ): + """ + Initialize the UNU.RAN sampler. + + Parameters + ---------- + distr : Distribution + The probability distribution to sample from. Must be a univariate + Euclidean distribution (dimension=1). + config : UnuranMethodConfig, optional + Configuration for method selection and parameters. If None, uses + default configuration. + **override_options : Any + Additional options that override config values. Supported keys: + - ``method``: Override the sampling method + - ``seed``: Override the random seed (currently not used) + + Raises + ------ + RuntimeError + If the distribution type is not supported (not Euclidean or + dimension != 1), or if initialization fails. + + Notes + ----- + The initialization process: + 1. Validates distribution type and dimension + 2. Determines available characteristics + 3. Selects appropriate sampling method (if AUTO) + 4. Creates UNURAN distribution object + 5. Sets up callbacks for available characteristics + 6. Initializes the UNURAN generator + """ + self.distr = distr + self.config = config or UnuranMethodConfig() + self.override_options = override_options + + method_option = override_options.get("method", self.config.method) + seed = override_options.get("seed", self.config.seed) + + from pysatl_core.stats._unuran.bindings import _unuran_cffi + + if _unuran_cffi is None: + raise RuntimeError( + "UNURAN CFFI bindings are not available. " + "Please build them via `python " + "src/pysatl_core/stats/_unuran/bindings/_cffi_build.py` " + "or install pysatl-core with the compiled extension." + ) + + self._ffi: Any = _unuran_cffi.ffi + self._lib: Any = _unuran_cffi.lib + + distr_type = distr.distribution_type + if not isinstance(distr_type, EuclideanDistributionType): + raise RuntimeError( + f"Unsupported distribution type: {distr_type}. " + "Only univariate Euclidean distributions are supported." + ) + + if distr_type.dimension != 1: + raise RuntimeError( + f"Unsupported distribution dimension: {distr_type.dimension}. " + "Only univariate (dimension=1) distributions are supported." + ) + + self._kind = distr_type.kind + self._is_continuous: bool = self._kind == Kind.CONTINUOUS + + if isinstance(method_option, UnuranMethod): + method = method_option + else: + try: + method = UnuranMethod(str(method_option)) + except ValueError as exc: # pragma: no cover - defensive + raise ValueError(f"Unsupported UNU.RAN method: {method_option}") from exc + + if self.config.use_registry_characteristics: + available_chars: set[GenericCharacteristicName] = _get_available_characteristics(distr) + else: + available_chars = {str(name) for name in distr.analytical_computations} + + if method == UnuranMethod.AUTO: + method = self._select_method(available_chars) + + self._method: UnuranMethod = method + + self._unuran_distr: Any | None = None + self._unuran_par: Any | None = None + self._unuran_gen: Any | None = None + self._callbacks: list[Any] = [] # Keep callbacks alive + self._cleaned_up: bool = False # Flag to prevent double cleanup + + self._initialize_unuran(seed) + + def _select_method(self, available_chars: set[GenericCharacteristicName]) -> UnuranMethod: + """ + Select the best UNU.RAN method based on available characteristics. + + Parameters + ---------- + available_chars : set[GenericCharacteristicName] + Set of available characteristic names (e.g., PDF, CDF, PPF, PMF). + + Returns + ------- + UnuranMethod + The selected UNU.RAN sampling method. + + Notes + ----- + This method delegates to ``_select_best_method`` helper function which + implements heuristics for method selection based on available + characteristics and distribution kind. + """ + return _select_best_method(available_chars, self._kind, self.config) + + def _create_pdf_callback(self) -> Any: + return create_pdf_callback(self) + + def _create_pmf_callback(self) -> Any: + return create_pmf_callback(self) + + def _create_cdf_callback(self) -> Any: + return create_cdf_callback(self) + + def _create_ppf_callback(self) -> Any: + return create_ppf_callback(self) + + def _create_dpdf_callback(self) -> Any: + return create_dpdf_callback() + + def _get_unuran_error_message(self, base_msg: str) -> str: + return get_unuran_error_message(self._lib, self._ffi, base_msg) + + def _create_unuran_distribution(self) -> None: + create_unuran_distribution(self) + + def _setup_continuous_callbacks(self) -> None: + setup_continuous_callbacks(self) + + def _setup_discrete_callbacks(self) -> None: + setup_discrete_callbacks(self) + + def _determine_domain_from_support(self) -> tuple[int, int | None] | None: + return determine_domain_from_support(self) + + def _determine_domain_from_pmf(self, domain_left: int | None = None) -> tuple[int, int]: + return determine_domain_from_pmf(self, domain_left) + + def _calculate_pmf_sum(self, domain_left: int, domain_right: int) -> float: + return calculate_pmf_sum(self, domain_left, domain_right) + + def _setup_dgt_method(self) -> None: + setup_dgt_method(self) + + def _create_and_init_generator(self) -> None: + create_and_init_generator(self) + + def _initialize_unuran(self, seed: int | None) -> None: + initialize_unuran_components(self, seed) + + def _create_parameter_object(self) -> Any: + return create_parameter_object(self) + + def _cleanup(self) -> None: + cleanup_unuran_resources(self) + + def __del__(self) -> None: + """ + Cleanup on object deletion. + + Automatically calls ``_cleanup()`` when the object is garbage collected. + All exceptions during finalization are silently ignored. + """ + with contextlib.suppress(Exception): + self._cleanup() + + def sample(self, n: int) -> npt.NDArray[np.float64]: + """ + Generate random variates from the distribution. + + Parameters + ---------- + n : int + Number of samples to generate. Must be non-negative. + + Returns + ------- + npt.NDArray[np.float64] + 1D array of shape ``(n,)`` containing the generated samples. + + Raises + ------ + RuntimeError + If the sampler is not initialized. + ValueError + If ``n < 0``. + + Notes + ----- + Uses UNURAN's sampling functions: + - ``unur_sample_cont()`` for continuous distributions + - ``unur_sample_discr()`` for discrete distributions + + Samples are generated sequentially in a loop. For large ``n``, this + may be slower than vectorized operations, but it's necessary due to + UNURAN's C API design. + """ + if not self.is_initialized: + raise RuntimeError("Sampler is not initialized") + + if n < 0: + raise ValueError(f"Number of samples must be non-negative, got {n}") + + samples = np.empty(n, dtype=np.float64) + + if self._is_continuous: + for i in range(n): + samples[i] = self._lib.unur_sample_cont(self._unuran_gen) + else: + for i in range(n): + samples[i] = float(self._lib.unur_sample_discr(self._unuran_gen)) + + return samples + + def reset(self, seed: int | None = None) -> None: + """ + Reset the sampler's random number generator. + + Parameters + ---------- + seed : int or None, optional + Random seed for the generator. Currently not used as UNURAN's basic + API doesn't provide direct seed setting functionality. + + Notes + ----- + Currently, this method only reinitializes the sampler if it's not + initialized. Full seed support would require access to UNURAN's underlying + RNG object, which is not exposed in the basic API. + + This is a placeholder for future implementation when seed setting + functionality becomes available. + """ + # UNURAN doesn't expose RNG seed setting in the basic API + # This would require access to the underlying RNG object + # For now, we just reinitialize if needed + if not self.is_initialized: + self._initialize_unuran(seed) + + @property + def method(self) -> UnuranMethod: + """The sampling method used by this sampler.""" + return self._method + + @property + def is_initialized(self) -> bool: + """ + Check whether the sampler has been successfully initialized. + + Returns + ------- + bool + True if both the generator and distribution objects are valid + (non-NULL), False otherwise. + + Notes + ----- + This property checks that: + - ``_unuran_gen`` is not None and not NULL + - ``_unuran_distr`` is not None and not NULL + + The sampler must be initialized before calling ``sample()``. + """ + return ( + self._unuran_gen is not None + and self._unuran_gen != self._ffi.NULL + and self._unuran_distr is not None + and self._unuran_distr != self._ffi.NULL + ) diff --git a/src/pysatl_core/stats/_unuran/bindings/_core/unuran_sampling_strategy.py b/src/pysatl_core/stats/_unuran/bindings/_core/unuran_sampling_strategy.py new file mode 100644 index 0000000..e42537b --- /dev/null +++ b/src/pysatl_core/stats/_unuran/bindings/_core/unuran_sampling_strategy.py @@ -0,0 +1,153 @@ +""" +UNU.RAN Default Sampling Strategy +================================= + +This module provides the default UNU.RAN sampling strategy implementation that +creates UNU.RAN samplers for distributions and converts the output to the +standard Sample format. The strategy supports caching of samplers to improve +performance with repeated sampling from the same distribution. +""" + +from __future__ import annotations + +__author__ = "Artem Romanyuk" +__copyright__ = "Copyright (c) 2025 PySATL project" +__license__ = "SPDX-License-Identifier: MIT" + +import copy +from typing import TYPE_CHECKING, Any + +from pysatl_core.distributions.sampling import ArraySample +from pysatl_core.stats._unuran.api import UnuranMethodConfig, UnuranSamplingStrategy +from pysatl_core.stats._unuran.bindings._core.unuran_sampler import DefaultUnuranSampler + +if TYPE_CHECKING: + from pysatl_core.distributions.distribution import Distribution + from pysatl_core.distributions.sampling import Sample + from pysatl_core.stats._unuran.api import UnuranSampler + + +class DefaultUnuranSamplingStrategy(UnuranSamplingStrategy): + """ + Default UNU.RAN sampling strategy implementation. + + This strategy creates UNU.RAN samplers for distributions and converts + the output to the standard Sample format. + + Notes + ----- + - Supports caching of samplers to improve performance with repeated sampling + - By default, caching is enabled (use_cache=True) + - When caching is enabled, the last sampler and a copy of the distribution + are stored and reused if the same distribution object is used again + """ + + def __init__( + self, + default_config: UnuranMethodConfig | None = None, + sampler_class: type[UnuranSampler] | None = None, + use_cache: bool = True, + ): + """ + Initialize the sampling strategy. + + Parameters + ---------- + default_config : UnuranMethodConfig | None, optional + Default method configuration. If None, uses UnuranMethodConfig() + with default values (AUTO method selection). + sampler_class : Type[UnuranSampler] | None, optional + Class to use for creating samplers. If None, uses DefaultUnuranSampler. + use_cache : bool, optional + Whether to cache samplers for reuse. Default is True. + When True, the last sampler and distribution are cached and reused + if the same distribution object is used in subsequent calls. + """ + self._default_config = default_config or UnuranMethodConfig() + self._sampler_class: type[UnuranSampler] = sampler_class or DefaultUnuranSampler + self._use_cache = use_cache + self._cached_sampler: UnuranSampler | None = None + self._cached_distribution: Distribution | None = None + self._cached_distribution_copy: Distribution | None = None + + def sample(self, n: int, distr: Distribution, **options: Any) -> Sample: + """ + Generate a sample from the distribution using UNU.RAN. + + Parameters + ---------- + n : int + Number of observations to draw. + distr : Distribution + The distribution to sample from. + **options : Any + Additional options that may override the default configuration: + - ``method``: override the sampling method + - ``seed``: override the random seed + - Other method-specific parameters + + Returns + ------- + Sample + A 2D sample of shape ``(n, 1)`` for univariate distributions. + + Raises + ------ + RuntimeError + If the distribution type is not supported, or if UNU.RAN + cannot create a sampler with the available characteristics. + ValueError + If the configuration is invalid. + """ + if n < 0: + raise ValueError(f"Number of samples must be non-negative, got {n}") + + if self._use_cache: + sampler = self._maybe_get_cached_sampler(distr) + if sampler is None: + sampler = self._create_and_cache_sampler(distr, **options) + else: + sampler = self._sampler_class(distr, self._default_config, **options) + + samples_1d = sampler.sample(n) + + samples_2d = samples_1d.reshape(-1, 1) + + return ArraySample(samples_2d) + + def _maybe_get_cached_sampler(self, distr: Distribution) -> UnuranSampler | None: + """Return cached sampler if present and distribution matches.""" + cached_sampler = self._cached_sampler + cached_distribution = self._cached_distribution + + if cached_sampler is None or cached_distribution is None: + return None + + if distr is cached_distribution: + return cached_sampler + + cached_distribution_copy = self._cached_distribution_copy + if cached_distribution_copy is not None: + try: + if distr == cached_distribution_copy: + return cached_sampler + except (TypeError, ValueError, AttributeError): + return None + + return None + + def _create_and_cache_sampler(self, distr: Distribution, **options: Any) -> UnuranSampler: + """Create sampler instance and populate cache.""" + sampler = self._sampler_class(distr, self._default_config, **options) + self._cached_sampler = sampler + self._cached_distribution = distr + try: + self._cached_distribution_copy = copy.deepcopy(distr) + except (TypeError, ValueError, AttributeError): + self._cached_distribution_copy = None + return sampler + + @property + def default_config(self) -> UnuranMethodConfig: + """Default method configuration.""" + return self._default_config diff --git a/tests/unit/stats/__init__.py b/tests/unit/stats/__init__.py new file mode 100644 index 0000000..379db85 --- /dev/null +++ b/tests/unit/stats/__init__.py @@ -0,0 +1 @@ +"""Tests for pysatl_core.stats.*.""" diff --git a/tests/unit/stats/test_cffi_build.py b/tests/unit/stats/test_cffi_build.py new file mode 100644 index 0000000..519670a --- /dev/null +++ b/tests/unit/stats/test_cffi_build.py @@ -0,0 +1,371 @@ +from __future__ import annotations + +__author__ = "Artem Romanyuk" +__copyright__ = "Copyright (c) 2025 PySATL project" +__license__ = "SPDX-License-Identifier: MIT" + +import os +import subprocess +import sys +from collections.abc import Callable +from pathlib import Path +from types import SimpleNamespace + +import pytest + +from pysatl_core.stats._unuran.bindings import _cffi_build as cffi_build + +IS_WINDOWS = os.name == "nt" or sys.platform.startswith("win") + + +def _assert_windows_skips_build(monkeypatch: pytest.MonkeyPatch) -> None: + """Ensure main() returns early on Windows without invoking heavy build logic.""" + + def forbid(name: str) -> Callable[..., None]: + def _forbid(*args: object, **kwargs: object) -> None: + raise AssertionError(f"{name} should not be called on Windows.") + + return _forbid + + monkeypatch.setattr(cffi_build, "_get_unuran_paths", forbid("_get_unuran_paths")) + monkeypatch.setattr(cffi_build, "_build_unuran_library", forbid("_build_unuran_library")) + monkeypatch.setattr(cffi_build, "_setup_static_source", forbid("_setup_static_source")) + monkeypatch.setattr(cffi_build, "_setup_system_source", forbid("_setup_system_source")) + monkeypatch.setattr(cffi_build, "_setup_fallback_source", forbid("_setup_fallback_source")) + + compile_called = SimpleNamespace(count=0) + + class DummyFFI(SimpleNamespace): + def compile(self, verbose: bool = False) -> None: + compile_called.count += 1 + + monkeypatch.setattr(cffi_build, "ffi", DummyFFI()) + + cffi_build.main() + + assert compile_called.count == 0 + + +@pytest.fixture +def dummy_ffi(monkeypatch: pytest.MonkeyPatch) -> SimpleNamespace: + """Capture calls to ffi.set_source/compile without running a real build.""" + calls: list[tuple[str, tuple[object, ...], dict[str, object]]] = [] + + class DummyFFI(SimpleNamespace): + def set_source(self, *args: object, **kwargs: object) -> None: + calls.append(("set_source", args, kwargs)) + + def compile(self, verbose: bool = False) -> None: + calls.append(("compile", (verbose,), {})) + + dummy = DummyFFI() + monkeypatch.setattr(cffi_build, "ffi", dummy) + dummy.calls = calls + return dummy + + +class TestCffiBuild: + """Tests for `_cffi_build` helper functions and main routine.""" + + def test_get_project_root_returns_directory_with_pyproject( + self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch + ) -> None: + """Ensures _get_project_root finds the directory containing pyproject.toml.""" + project_root = tmp_path / "project" + package_dir = project_root / "src" / "pkg" + package_dir.mkdir(parents=True) + (project_root / "pyproject.toml").write_text("[build-system]\n") + dummy_file = package_dir / "module.py" + dummy_file.write_text("# test") + monkeypatch.setattr(cffi_build, "__file__", str(dummy_file)) + + assert cffi_build._get_project_root() == project_root + + def test_get_project_root_raises_when_missing_pyproject( + self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch + ) -> None: + """Verifies _get_project_root raises when no pyproject marker is found.""" + orphan_dir = tmp_path / "isolated" + nested = orphan_dir / "pkg" + nested.mkdir(parents=True) + dummy_file = nested / "module.py" + dummy_file.write_text("# test") + monkeypatch.setattr(cffi_build, "__file__", str(dummy_file)) + + with pytest.raises(RuntimeError): + cffi_build._get_project_root() + + def test_get_unuran_paths_returns_vendor_src( + self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch + ) -> None: + """Checks _get_unuran_paths returns vendor/unuran-1.11.0/src when present.""" + project_root = tmp_path / "project" + vendor_src = project_root / "vendor" / "unuran-1.11.0" / "src" + vendor_src.mkdir(parents=True, exist_ok=True) + monkeypatch.setattr(cffi_build, "_get_project_root", lambda: project_root) + + unuran_dir, unuran_src = cffi_build._get_unuran_paths() + assert unuran_dir == vendor_src.parent + assert unuran_src == vendor_src + + def test_get_unuran_paths_raises_when_src_missing( + self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch + ) -> None: + """Asserts _get_unuran_paths fails if vendor sources are absent.""" + project_root = tmp_path / "project" + project_root.mkdir(parents=True, exist_ok=True) + monkeypatch.setattr(cffi_build, "_get_project_root", lambda: project_root) + + with pytest.raises(FileNotFoundError): + cffi_build._get_unuran_paths() + + def test_build_unuran_library_returns_static_path( + self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch + ) -> None: + """Simulates successful configure/make and expects static lib path.""" + unuran_dir = tmp_path / "unuran" + src_dir = unuran_dir / "src" + libs_dir = src_dir / ".libs" + libs_dir.mkdir(parents=True, exist_ok=True) + lib_path = libs_dir / "libunuran.a" + lib_path.write_bytes(b"0") + configure_script = unuran_dir / "configure" + configure_script.parent.mkdir(parents=True, exist_ok=True) + configure_script.write_text("#!/bin/sh\n") + + build_dir = tmp_path / "build" + calls: list[list[str]] = [] + + def fake_run(cmd: list[str], **_: object) -> subprocess.CompletedProcess[str]: + calls.append(cmd) + return subprocess.CompletedProcess(cmd, 0, stdout="", stderr="") + + monkeypatch.setattr(subprocess, "run", fake_run) + + static_lib, include_dir = cffi_build._build_unuran_library(unuran_dir, build_dir) + + assert static_lib == lib_path + assert include_dir == src_dir + assert calls[0][0] == str(configure_script) + assert any("make" in call[0] for call in calls) + + def test_build_unuran_library_handles_configure_failure( + self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch + ) -> None: + """Confirms configure failure triggers fallback (None library path).""" + unuran_dir = tmp_path / "unuran" + src_dir = unuran_dir / "src" + src_dir.mkdir(parents=True, exist_ok=True) + configure_script = unuran_dir / "configure" + configure_script.parent.mkdir(parents=True, exist_ok=True) + configure_script.write_text("#!/bin/sh\n") + + def fake_run(cmd: list[str], **_: object) -> subprocess.CompletedProcess[str]: + raise subprocess.CalledProcessError(1, cmd, stderr=b"boom") + + monkeypatch.setattr(subprocess, "run", fake_run) + + static_lib, include_dir = cffi_build._build_unuran_library(unuran_dir, tmp_path / "build") + + assert static_lib is None + assert include_dir == src_dir + + def test_setup_static_source_configures_ffi( + self, tmp_path: Path, dummy_ffi: SimpleNamespace + ) -> None: + """Checks _setup_static_source wires ffi.set_source with extra_objects.""" + static_lib = tmp_path / "libunuran.a" + static_lib.write_text("") + include_dir = tmp_path / "include" + include_dir.mkdir() + + cffi_build._setup_static_source(static_lib, include_dir) + + call = dummy_ffi.calls[0] + assert call[0] == "set_source" + assert call[1][0] == cffi_build.MODULE_NAME + assert call[2]["extra_objects"] == [str(static_lib)] + assert call[2]["include_dirs"] == [str(include_dir)] + + def test_setup_system_source_configures_ffi( + self, tmp_path: Path, dummy_ffi: SimpleNamespace + ) -> None: + """Ensures _setup_system_source sets libraries/library_dirs/include_dirs.""" + include_dir = tmp_path / "include" + include_dir.mkdir() + + cffi_build._setup_system_source(include_dir, "/usr/lib/libunuran.so") + + call = dummy_ffi.calls[0] + assert call[0] == "set_source" + assert call[2]["libraries"] == ["unuran"] + assert call[2]["library_dirs"] == ["/usr/lib"] + assert call[2]["include_dirs"] == [str(include_dir)] + + def test_setup_fallback_source_configures_ffi( + self, tmp_path: Path, dummy_ffi: SimpleNamespace + ) -> None: + """Validates fallback source sets libraries and c99 compile flag.""" + include_dir = tmp_path / "include" + include_dir.mkdir() + + cffi_build._setup_fallback_source(include_dir) + + call = dummy_ffi.calls[0] + assert call[0] == "set_source" + assert call[2]["libraries"] == ["unuran"] + assert "-std=c99" in call[2]["extra_compile_args"] + + def test_main_prefers_static_library( + self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch + ) -> None: + if IS_WINDOWS: + _assert_windows_skips_build(monkeypatch) + return + """Expects main() to use static lib when available and call compile().""" + unuran_dir = tmp_path / "vendor" / "unuran-1.11.0" + unuran_dir.mkdir(parents=True) + src_dir = unuran_dir / "src" + src_dir.mkdir() + static_lib = tmp_path / "libunuran.a" + static_lib.write_text("") + include_dir = tmp_path / "include" + include_dir.mkdir() + + monkeypatch.setattr(cffi_build, "_get_unuran_paths", lambda: (unuran_dir, src_dir)) + monkeypatch.setattr( + cffi_build, "_build_unuran_library", lambda *_: (static_lib, include_dir) + ) + + static_called = SimpleNamespace(count=0) + + def fake_setup_static(path: Path, inc: Path) -> None: + static_called.count += 1 + assert path == static_lib + assert inc == include_dir + + monkeypatch.setattr(cffi_build, "_setup_static_source", fake_setup_static) + monkeypatch.setattr( + cffi_build, + "_setup_system_source", + lambda *_, **__: (_ for _ in ()).throw(AssertionError), + ) + monkeypatch.setattr( + cffi_build, + "_setup_fallback_source", + lambda *_, **__: (_ for _ in ()).throw(AssertionError), + ) + + compile_called = SimpleNamespace(count=0) + + class DummyFFI(SimpleNamespace): + def compile(self, verbose: bool = False) -> None: + compile_called.count += 1 + assert verbose is True + + monkeypatch.setattr(cffi_build, "ffi", DummyFFI()) + + cffi_build.main() + + assert static_called.count == 1 + assert compile_called.count == 1 + + def test_main_falls_back_to_system_library( + self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch + ) -> None: + if IS_WINDOWS: + _assert_windows_skips_build(monkeypatch) + return + """Confirms main() selects system library when static lib missing.""" + unuran_dir = tmp_path / "vendor" / "unuran-1.11.0" + unuran_dir.mkdir(parents=True) + src_dir = unuran_dir / "src" + src_dir.mkdir() + include_dir = tmp_path / "include" + include_dir.mkdir() + + monkeypatch.setattr(cffi_build, "_get_unuran_paths", lambda: (unuran_dir, src_dir)) + monkeypatch.setattr(cffi_build, "_build_unuran_library", lambda *_: (None, include_dir)) + + system_called = SimpleNamespace(count=0) + + def fake_setup_system(inc: Path, system_path: str) -> None: + system_called.count += 1 + assert inc == include_dir + assert system_path == "/usr/lib/libunuran.so" + + monkeypatch.setattr( + cffi_build, + "_setup_static_source", + lambda *_, **__: (_ for _ in ()).throw(AssertionError), + ) + monkeypatch.setattr(cffi_build, "_setup_system_source", fake_setup_system) + monkeypatch.setattr( + cffi_build, + "_setup_fallback_source", + lambda *_, **__: (_ for _ in ()).throw(AssertionError), + ) + + monkeypatch.setattr("ctypes.util.find_library", lambda name: f"/usr/lib/lib{name}.so") + + compile_called = SimpleNamespace(count=0) + + class DummyFFI(SimpleNamespace): + def compile(self, verbose: bool = False) -> None: + compile_called.count += 1 + + monkeypatch.setattr(cffi_build, "ffi", DummyFFI()) + + cffi_build.main() + + assert system_called.count == 1 + assert compile_called.count == 1 + + def test_main_uses_fallback_when_no_library_found( + self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch + ) -> None: + if IS_WINDOWS: + _assert_windows_skips_build(monkeypatch) + return + """Checks final fallback path is used when neither static nor system lib exist.""" + unuran_dir = tmp_path / "vendor" / "unuran-1.11.0" + unuran_dir.mkdir(parents=True) + src_dir = unuran_dir / "src" + src_dir.mkdir() + include_dir = tmp_path / "include" + include_dir.mkdir() + + monkeypatch.setattr(cffi_build, "_get_unuran_paths", lambda: (unuran_dir, src_dir)) + monkeypatch.setattr(cffi_build, "_build_unuran_library", lambda *_: (None, include_dir)) + monkeypatch.setattr("ctypes.util.find_library", lambda *_: None) + + fallback_called = SimpleNamespace(count=0) + + def fake_setup_fallback(inc: Path) -> None: + fallback_called.count += 1 + assert inc == include_dir + + monkeypatch.setattr( + cffi_build, + "_setup_static_source", + lambda *_, **__: (_ for _ in ()).throw(AssertionError), + ) + monkeypatch.setattr( + cffi_build, + "_setup_system_source", + lambda *_, **__: (_ for _ in ()).throw(AssertionError), + ) + monkeypatch.setattr(cffi_build, "_setup_fallback_source", fake_setup_fallback) + + compile_called = SimpleNamespace(count=0) + + class DummyFFI(SimpleNamespace): + def compile(self, verbose: bool = False) -> None: + compile_called.count += 1 + + monkeypatch.setattr(cffi_build, "ffi", DummyFFI()) + + cffi_build.main() + + assert fallback_called.count == 1 + assert compile_called.count == 1 diff --git a/tests/unit/stats/test_helpers.py b/tests/unit/stats/test_helpers.py new file mode 100644 index 0000000..abe33f6 --- /dev/null +++ b/tests/unit/stats/test_helpers.py @@ -0,0 +1,135 @@ +from __future__ import annotations + +__author__ = "Artem Romanyuk" +__copyright__ = "Copyright (c) 2025 PySATL project" +__license__ = "SPDX-License-Identifier: MIT" + +from types import SimpleNamespace + +import pytest + +from pysatl_core.stats._unuran.api import UnuranMethod, UnuranMethodConfig +from pysatl_core.stats._unuran.bindings._core.helpers import ( + _get_available_characteristics, + _select_best_method, +) +from pysatl_core.types import CharacteristicName, Kind + + +class TestHelpers: + """Tests covering helper functions in helpers.py.""" + + def test_get_available_characteristics_returns_empty_without_analytics( + self, monkeypatch: pytest.MonkeyPatch + ) -> None: + """Ensures registry is not consulted when distribution lacks analytical characteristics.""" + distr = SimpleNamespace(analytical_computations={}) + + monkeypatch.setattr( + "pysatl_core.distributions.registry.characteristic_registry", + lambda: (_ for _ in ()).throw(AssertionError("registry should not be called")), + ) + + assert _get_available_characteristics(distr) == set() + + def test_get_available_characteristics_collects_reachable_nodes( + self, monkeypatch: pytest.MonkeyPatch + ) -> None: + """Validates BFS collects base characteristic and all reachable nodes from registry view.""" + adjacency = { + CharacteristicName.PDF: {CharacteristicName.CDF}, + CharacteristicName.CDF: {CharacteristicName.PPF}, + } + + class DummyView: + def __init__(self) -> None: + succ_targets = {node for targets in adjacency.values() for node in targets} + self.all_characteristics = set(adjacency.keys()) | succ_targets + + def successors_nodes(self, node: CharacteristicName) -> set[CharacteristicName]: + return adjacency.get(node, set()) + + class DummyRegistry: + def view(self, distr: object) -> DummyView: + return DummyView() + + monkeypatch.setattr( + "pysatl_core.distributions.registry.characteristic_registry", + lambda: DummyRegistry(), + ) + + distr = SimpleNamespace(analytical_computations={CharacteristicName.PDF: object()}) + + result = _get_available_characteristics(distr) + assert result == { + CharacteristicName.PDF, + CharacteristicName.CDF, + CharacteristicName.PPF, + } + + def test_get_available_characteristics_skips_nodes_missing_in_view( + self, monkeypatch: pytest.MonkeyPatch + ) -> None: + """Checks that nodes absent from the registry view remain as-is without BFS expansion.""" + + class DummyView: + all_characteristics = {CharacteristicName.CDF} + + def successors_nodes(self, node: CharacteristicName) -> set[CharacteristicName]: + return {CharacteristicName.PPF} if node == CharacteristicName.CDF else set() + + class DummyRegistry: + def view(self, distr: object) -> DummyView: + return DummyView() + + monkeypatch.setattr( + "pysatl_core.distributions.registry.characteristic_registry", + lambda: DummyRegistry(), + ) + + distr = SimpleNamespace(analytical_computations={CharacteristicName.PMF: object()}) + + result = _get_available_characteristics(distr) + assert result == {CharacteristicName.PMF} + + def test_select_best_method_prefers_ppf_when_enabled(self) -> None: + """Ensures AUTO selects PINV when PPF is available and use_ppf is True.""" + config = UnuranMethodConfig(use_ppf=True, use_pdf=False, use_cdf=False) + result = _select_best_method({CharacteristicName.PPF}, Kind.CONTINUOUS, config) + assert result == UnuranMethod.PINV + + def test_select_best_method_prefers_pdf_fallback(self) -> None: + """Validates PDF availability leads to PINV even when use_ppf=False.""" + config = UnuranMethodConfig(use_ppf=False, use_pdf=True, use_cdf=False) + result = _select_best_method({CharacteristicName.PDF}, Kind.CONTINUOUS, config) + assert result == UnuranMethod.PINV + + def test_select_best_method_prefers_cdf_when_requested(self) -> None: + """Checks CDF-only continuous distributions fall back to NINV if use_cdf=True.""" + config = UnuranMethodConfig(use_ppf=False, use_pdf=False, use_cdf=True) + result = _select_best_method({CharacteristicName.CDF}, Kind.CONTINUOUS, config) + assert result == UnuranMethod.NINV + + def test_select_best_method_requires_characteristics_for_continuous(self) -> None: + """Raises RuntimeError if no usable characteristics exist for continuous distributions.""" + config = UnuranMethodConfig(use_ppf=True, use_pdf=True, use_cdf=True) + with pytest.raises(RuntimeError): + _select_best_method(set(), Kind.CONTINUOUS, config) + + def test_select_best_method_prefers_dgt_for_discrete(self) -> None: + """Verifies discrete distributions with PMF select DGT method.""" + config = UnuranMethodConfig() + result = _select_best_method({CharacteristicName.PMF}, Kind.DISCRETE, config) + assert result == UnuranMethod.DGT + + def test_select_best_method_allows_pdf_for_discrete(self) -> None: + """Confirms discrete distributions can use DGT even if only PDF is present.""" + config = UnuranMethodConfig() + result = _select_best_method({CharacteristicName.PDF}, Kind.DISCRETE, config) + assert result == UnuranMethod.DGT + + def test_select_best_method_requires_pmf_or_pdf_for_discrete(self) -> None: + """Raises RuntimeError when discrete distributions lack PMF/PDF characteristics.""" + config = UnuranMethodConfig() + with pytest.raises(RuntimeError): + _select_best_method({CharacteristicName.CDF}, Kind.DISCRETE, config) diff --git a/tests/unit/stats/test_unuran_sampling_strategy.py b/tests/unit/stats/test_unuran_sampling_strategy.py new file mode 100644 index 0000000..8e80807 --- /dev/null +++ b/tests/unit/stats/test_unuran_sampling_strategy.py @@ -0,0 +1,180 @@ +from __future__ import annotations + +__author__ = "Artem Romanyuk" +__copyright__ = "Copyright (c) 2025 PySATL project" +__license__ = "SPDX-License-Identifier: MIT" + +from collections.abc import Generator +from dataclasses import dataclass +from typing import Any, cast + +import numpy as np +import numpy.typing as npt +import pytest + +from pysatl_core.distributions.distribution import Distribution +from pysatl_core.distributions.sampling import ArraySample +from pysatl_core.stats._unuran.api import UnuranMethod, UnuranMethodConfig, UnuranSampler +from pysatl_core.stats._unuran.bindings._core.unuran_sampling_strategy import ( + DefaultUnuranSamplingStrategy, +) + + +class DummySampler(UnuranSampler): + """Minimal sampler stub recording instantiations and sample calls.""" + + instantiations: list[DummySampler] = [] + + def __init__(self, distr: Distribution, config: UnuranMethodConfig, **options: Any) -> None: + self.distr = distr + self.config = config + self.options = options + self.sample_calls: list[int] = [] + self._method = options.get("method_override", UnuranMethod.PINV) + self._is_initialized = True + DummySampler.instantiations.append(self) + + def sample(self, n: int) -> npt.NDArray[np.float64]: + self.sample_calls.append(n) + offset = float(self.options.get("offset", 0.0)) + return np.arange(n, dtype=float) + offset + + def reset(self, seed: int | None = None) -> None: # pragma: no cover - simple stub + self._is_initialized = True + + @property + def method(self) -> UnuranMethod: + return self._method + + @property + def is_initialized(self) -> bool: + return self._is_initialized + + +@pytest.fixture(autouse=True) +def reset_dummy_sampler() -> Generator[None, None, None]: + """Reset sampler instantiation tracking between tests.""" + DummySampler.instantiations.clear() + yield + DummySampler.instantiations.clear() + + +@dataclass +class DummyDistribution: + """Simple distribution stub with identifier-based equality.""" + + identifier: int + eq_raises: bool = False + + def __eq__(self, other: object) -> bool: + if self.eq_raises: + raise TypeError("Equality not supported") + if not isinstance(other, DummyDistribution): + return NotImplemented + return self.identifier == other.identifier + + def __deepcopy__(self, memo: dict[int, object]) -> DummyDistribution: + return DummyDistribution(self.identifier, self.eq_raises) + + +class NoDeepcopyDistribution(DummyDistribution): + """Distribution stub whose deepcopy operation fails.""" + + def __deepcopy__(self, memo: dict[int, object]) -> NoDeepcopyDistribution: + raise TypeError("Cannot deepcopy") + + +DummySamplerType = cast(type[UnuranSampler], DummySampler) + + +def as_distribution(distr: DummyDistribution) -> Distribution: + """Helper to satisfy typing when interacting with strategy APIs.""" + return cast(Distribution, distr) + + +class TestDefaultUnuranSamplingStrategy: + """Tests covering sampling workflow, caching helpers, and configuration.""" + + def test_sample_returns_array_sample_with_reshaped_data(self) -> None: + """sample() should reshape 1D sampler output into ArraySample column vector.""" + strategy = DefaultUnuranSamplingStrategy(sampler_class=DummySamplerType, use_cache=False) + distr = DummyDistribution(identifier=1) + + result = strategy.sample(3, as_distribution(distr), offset=1.5) + + assert isinstance(result, ArraySample) + expected = (np.arange(3, dtype=float) + 1.5).reshape(-1, 1) + np.testing.assert_array_equal(result.array, expected) + assert DummySampler.instantiations[0].options["offset"] == 1.5 + + def test_sample_negative_n_raises_value_error(self) -> None: + """sampling negative number of observations must raise ValueError.""" + strategy = DefaultUnuranSamplingStrategy(sampler_class=DummySamplerType) + with pytest.raises(ValueError, match="non-negative"): + strategy.sample(-1, as_distribution(DummyDistribution(identifier=1))) + + def test_sample_without_cache_creates_new_sampler_each_time(self) -> None: + """When caching disabled, each call should instantiate a fresh sampler.""" + strategy = DefaultUnuranSamplingStrategy(sampler_class=DummySamplerType, use_cache=False) + distr = DummyDistribution(identifier=1) + + strategy.sample(2, as_distribution(distr)) + strategy.sample(2, as_distribution(distr)) + + assert len(DummySampler.instantiations) == 2 + + def test_sample_with_cache_reuses_cached_sampler(self) -> None: + """Caching enabled should reuse sampler for repeated sampling of same distribution.""" + strategy = DefaultUnuranSamplingStrategy(sampler_class=DummySamplerType, use_cache=True) + distr = DummyDistribution(identifier=2) + + strategy.sample(3, as_distribution(distr)) + strategy.sample(2, as_distribution(distr)) + + assert len(DummySampler.instantiations) == 1 + assert DummySampler.instantiations[0].sample_calls == [3, 2] + + def test_maybe_get_cached_sampler_uses_distribution_copy_equality(self) -> None: + """Cache lookup should fallback to deepcopy comparison when object differs.""" + strategy = DefaultUnuranSamplingStrategy(sampler_class=DummySamplerType, use_cache=True) + original = DummyDistribution(identifier=3) + strategy._create_and_cache_sampler(as_distribution(original)) + + equivalent = DummyDistribution(identifier=3) + cached = strategy._maybe_get_cached_sampler(as_distribution(equivalent)) + + assert cached is strategy._cached_sampler + + def test_maybe_get_cached_sampler_returns_none_on_equality_error(self) -> None: + """Equality errors while checking cached copy should be swallowed and return None.""" + strategy = DefaultUnuranSamplingStrategy(sampler_class=DummySamplerType, use_cache=True) + strategy._cached_sampler = DummySampler( + as_distribution(DummyDistribution(1)), UnuranMethodConfig() + ) + strategy._cached_distribution = as_distribution(DummyDistribution(identifier=4)) + strategy._cached_distribution_copy = as_distribution( + DummyDistribution(identifier=5, eq_raises=True) + ) + + uncached_distribution = as_distribution(DummyDistribution(identifier=6)) + result = strategy._maybe_get_cached_sampler(uncached_distribution) + + assert result is None + + def test_create_and_cache_sampler_handles_deepcopy_errors(self) -> None: + """_create_and_cache_sampler should tolerate deepcopy failures and still cache sampler.""" + strategy = DefaultUnuranSamplingStrategy(sampler_class=DummySamplerType, use_cache=True) + distr = NoDeepcopyDistribution(identifier=7) + + sampler = strategy._create_and_cache_sampler(as_distribution(distr)) + + assert sampler is strategy._cached_sampler + assert strategy._cached_distribution is distr + assert strategy._cached_distribution_copy is None + + def test_default_config_property_returns_same_object(self) -> None: + """default_config property must expose the original configuration object.""" + config = UnuranMethodConfig() + strategy = DefaultUnuranSamplingStrategy(default_config=config) + + assert strategy.default_config is config diff --git a/tests/unit/stats/unuran_sampler/conftest.py b/tests/unit/stats/unuran_sampler/conftest.py new file mode 100644 index 0000000..a346f67 --- /dev/null +++ b/tests/unit/stats/unuran_sampler/conftest.py @@ -0,0 +1,49 @@ +from __future__ import annotations + +__author__ = "Artem Romanyuk" +__copyright__ = "Copyright (c) 2025 PySATL project" +__license__ = "SPDX-License-Identifier: MIT" + +from types import SimpleNamespace + +import pytest + +from pysatl_core.stats._unuran.bindings._core.unuran_sampler import DefaultUnuranSampler +from pysatl_core.types import CharacteristicName, EuclideanDistributionType, Kind + + +@pytest.fixture +def sampler_stub() -> DefaultUnuranSampler: + """Return an uninitialized sampler instance with default ffi/lib placeholders.""" + sampler = object.__new__(DefaultUnuranSampler) + sampler._ffi = SimpleNamespace(callback=lambda sig, fn: fn, NULL=None) + sampler._lib = SimpleNamespace() + sampler.distr = SimpleNamespace(analytical_computations={}) + sampler._callbacks = [] + sampler._cleaned_up = False + return sampler + + +@pytest.fixture +def dummy_distribution() -> SimpleNamespace: + """Factory for a minimal continuous univariate distribution.""" + return SimpleNamespace( + distribution_type=EuclideanDistributionType(kind=Kind.CONTINUOUS, dimension=1), + analytical_computations={CharacteristicName.PDF: lambda x: x}, + support=None, + ) + + +@pytest.fixture +def dummy_cffi(monkeypatch: pytest.MonkeyPatch) -> SimpleNamespace: + """Provide a fake _unuran_cffi module with ffi/lib placeholders.""" + + class DummyFFI(SimpleNamespace): + NULL = object() + + def callback(self, signature: str, func: object) -> object: + return func + + dummy = SimpleNamespace(ffi=DummyFFI(), lib=SimpleNamespace()) + monkeypatch.setattr("pysatl_core.stats._unuran.bindings._unuran_cffi", dummy) + return dummy diff --git a/tests/unit/stats/unuran_sampler/test_callbacks.py b/tests/unit/stats/unuran_sampler/test_callbacks.py new file mode 100644 index 0000000..1629951 --- /dev/null +++ b/tests/unit/stats/unuran_sampler/test_callbacks.py @@ -0,0 +1,116 @@ +from __future__ import annotations + +__author__ = "Artem Romanyuk" +__copyright__ = "Copyright (c) 2025 PySATL project" +__license__ = "SPDX-License-Identifier: MIT" + +from types import SimpleNamespace + +from pysatl_core.stats._unuran.bindings._core.unuran_sampler import DefaultUnuranSampler +from pysatl_core.types import CharacteristicName + + +class TestCallbacks: + """Tests for PDF/PMF/CDF/DPDF callbacks and error helpers.""" + + def test_create_pdf_callback_returns_wrapper(self, sampler_stub: DefaultUnuranSampler) -> None: + """Ensures PDF callback wraps the distribution's PDF for continuous case.""" + sampler_stub._is_continuous = True + sampler_stub.distr = SimpleNamespace( + analytical_computations={CharacteristicName.PDF: lambda x: x * 2} + ) + callback = sampler_stub._create_pdf_callback() + assert callable(callback) + assert callback(1.5, None) == 3.0 + + def test_create_pdf_callback_none_when_not_continuous( + self, sampler_stub: DefaultUnuranSampler + ) -> None: + """Discrete distributions should not expose PDF callback.""" + sampler_stub._is_continuous = False + sampler_stub.distr = SimpleNamespace( + analytical_computations={CharacteristicName.PDF: lambda x: x} + ) + assert sampler_stub._create_pdf_callback() is None + + def test_create_pmf_callback_prefers_pmf(self, sampler_stub: DefaultUnuranSampler) -> None: + """Discrete samplers prefer PMF characteristic when available.""" + sampler_stub._is_continuous = False + sampler_stub.distr = SimpleNamespace( + analytical_computations={ + CharacteristicName.PMF: lambda x: x + 1, + CharacteristicName.PDF: lambda x: x + 2, + } + ) + callback = sampler_stub._create_pmf_callback() + assert callable(callback) + assert callback(3, None) == 4.0 + + def test_create_pmf_callback_falls_back_to_pdf( + self, sampler_stub: DefaultUnuranSampler + ) -> None: + """PMF should fall back to PDF when PMF is missing.""" + sampler_stub._is_continuous = False + sampler_stub.distr = SimpleNamespace( + analytical_computations={CharacteristicName.PDF: lambda x: x + 5} + ) + callback = sampler_stub._create_pmf_callback() + assert callable(callback) + assert callback(2, None) == 7.0 + + def test_create_cdf_callback_continuous(self, sampler_stub: DefaultUnuranSampler) -> None: + """Continuous CDF callback should pass floating-point arguments through.""" + sampler_stub._is_continuous = True + sampler_stub.distr = SimpleNamespace( + analytical_computations={CharacteristicName.CDF: lambda x: x**2} + ) + callback = sampler_stub._create_cdf_callback() + assert callable(callback) + assert callback(3.0, None) == 9.0 + + def test_create_cdf_callback_discrete(self, sampler_stub: DefaultUnuranSampler) -> None: + """Discrete CDF callback should accept integer inputs.""" + sampler_stub._is_continuous = False + sampler_stub.distr = SimpleNamespace( + analytical_computations={CharacteristicName.CDF: lambda x: x + 0.5} + ) + callback = sampler_stub._create_cdf_callback() + assert callable(callback) + assert callback(4, None) == 4.5 + + def test_create_ppf_callback_continuous(self, sampler_stub: DefaultUnuranSampler) -> None: + """PPF callback should wrap the distribution's inverse CDF for continuous case.""" + sampler_stub._is_continuous = True + sampler_stub.distr = SimpleNamespace( + analytical_computations={CharacteristicName.PPF: lambda u: u * 10} + ) + callback = sampler_stub._create_ppf_callback() + assert callable(callback) + assert callback(0.3, None) == 3.0 + + def test_create_ppf_callback_requires_continuous_ppf( + self, sampler_stub: DefaultUnuranSampler + ) -> None: + """PPF callback should be unavailable for discrete samplers or missing characteristic.""" + sampler_stub._is_continuous = False + sampler_stub.distr = SimpleNamespace( + analytical_computations={CharacteristicName.PPF: lambda u: u} + ) + assert sampler_stub._create_ppf_callback() is None + sampler_stub._is_continuous = True + sampler_stub.distr = SimpleNamespace(analytical_computations={}) + assert sampler_stub._create_ppf_callback() is None + + def test_create_dpdf_callback_is_none(self, sampler_stub: DefaultUnuranSampler) -> None: + """Currently no dPDF callback should be created.""" + assert sampler_stub._create_dpdf_callback() is None + + def test_get_unuran_error_message_formats_errno( + self, sampler_stub: DefaultUnuranSampler + ) -> None: + """Error message should include errno and text from UNURAN.""" + sampler_stub._lib.unur_get_errno = lambda: 5 + sampler_stub._lib.unur_get_strerror = lambda err: b"boom" + sampler_stub._ffi = SimpleNamespace(string=lambda b: b, NULL=None) + msg = sampler_stub._get_unuran_error_message("Failed") + assert "Failed" in msg and "errno: 5" in msg and "boom" in msg diff --git a/tests/unit/stats/unuran_sampler/test_distribution_setup.py b/tests/unit/stats/unuran_sampler/test_distribution_setup.py new file mode 100644 index 0000000..b68d329 --- /dev/null +++ b/tests/unit/stats/unuran_sampler/test_distribution_setup.py @@ -0,0 +1,179 @@ +from __future__ import annotations + +__author__ = "Artem Romanyuk" +__copyright__ = "Copyright (c) 2025 PySATL project" +__license__ = "SPDX-License-Identifier: MIT" + +from types import SimpleNamespace +from unittest.mock import patch + +import pytest + +from pysatl_core.stats._unuran.bindings._core.unuran_sampler import DefaultUnuranSampler +from pysatl_core.types import CharacteristicName + + +class TestDistributionSetup: + """Tests for distribution object creation, callbacks, domains and DGT setup.""" + + def test_create_unuran_distribution_continuous( + self, sampler_stub: DefaultUnuranSampler + ) -> None: + """Continuous distributions should produce a UNURAN distribution via cont constructor.""" + sampler_stub._is_continuous = True + created = [] + + def cont_new() -> str: + created.append("cont") + return "CONT" + + sampler_stub._lib.unur_distr_cont_new = cont_new + sampler_stub._create_unuran_distribution() + assert sampler_stub._unuran_distr == "CONT" + + def test_create_unuran_distribution_failure_raises( + self, sampler_stub: DefaultUnuranSampler + ) -> None: + """Creation should raise if UNURAN factory returns NULL.""" + sampler_stub._is_continuous = False + sampler_stub._ffi = SimpleNamespace(NULL=None) + sampler_stub._lib.unur_distr_discr_new = lambda: None + with pytest.raises(RuntimeError, match="Failed to create UNURAN distribution"): + sampler_stub._create_unuran_distribution() + + def test_setup_continuous_callbacks_registers_pdf_and_cdf(self) -> None: + """Continuous callback setup should register PDF and CDF when provided.""" + sampler = object.__new__(DefaultUnuranSampler) + sampler._callbacks = [] + sampler._unuran_distr = "DIST" + sampler._is_continuous = True + sampler._lib = SimpleNamespace( + unur_distr_cont_set_pdf=lambda dist, cb: 0, + unur_distr_cont_set_dpdf=lambda dist, cb: 0, + unur_distr_cont_set_cdf=lambda dist, cb: 0, + ) + + with ( + patch.object(DefaultUnuranSampler, "_create_pdf_callback", autospec=True) as mock_pdf, + patch.object(DefaultUnuranSampler, "_create_dpdf_callback", autospec=True) as mock_dpdf, + patch.object(DefaultUnuranSampler, "_create_cdf_callback", autospec=True) as mock_cdf, + patch.object(DefaultUnuranSampler, "_create_ppf_callback", autospec=True) as mock_ppf, + ): + mock_pdf.return_value = "PDF" + mock_dpdf.return_value = None + mock_cdf.return_value = "CDF" + mock_ppf.return_value = None + + sampler._setup_continuous_callbacks() + + mock_pdf.assert_called_once_with(sampler) + mock_cdf.assert_called_once_with(sampler) + assert sampler._callbacks == ["PDF", "CDF"] + + def test_setup_discrete_callbacks_registers_pmf_and_cdf(self) -> None: + """Discrete callback setup should register PMF and CDF.""" + sampler = object.__new__(DefaultUnuranSampler) + sampler._callbacks = [] + sampler._unuran_distr = "DIST" + sampler._is_continuous = False + sampler._lib = SimpleNamespace( + unur_distr_discr_set_pmf=lambda dist, cb: 0, + unur_distr_discr_set_cdf=lambda dist, cb: 0, + ) + + with ( + patch.object(DefaultUnuranSampler, "_create_pmf_callback", autospec=True) as mock_pmf, + patch.object(DefaultUnuranSampler, "_create_cdf_callback", autospec=True) as mock_cdf, + ): + mock_pmf.return_value = "PMF" + mock_cdf.return_value = "CDF" + + sampler._setup_discrete_callbacks() + + mock_pmf.assert_called_once_with(sampler) + mock_cdf.assert_called_once_with(sampler) + assert sampler._callbacks == ["PMF", "CDF"] + + def test_determine_domain_from_support_explicit_table( + self, sampler_stub: DefaultUnuranSampler + ) -> None: + """Explicit discrete support should map to (min,max) integer domain.""" + from pysatl_core.distributions.support import ExplicitTableDiscreteSupport + + support = ExplicitTableDiscreteSupport([1, 2, 3]) + sampler_stub.distr = SimpleNamespace(support=support) + assert sampler_stub._determine_domain_from_support() == (1, 3) + + def test_determine_domain_from_support_custom_methods( + self, sampler_stub: DefaultUnuranSampler + ) -> None: + """Custom support with first/last methods should be used.""" + support = SimpleNamespace(first=lambda: 5, last=lambda: 8) + sampler_stub.distr = SimpleNamespace(support=support) + assert sampler_stub._determine_domain_from_support() == (5, 8) + + def test_determine_domain_from_pmf_without_left_bound( + self, sampler_stub: DefaultUnuranSampler + ) -> None: + """Domain should expand via PMF evaluation when support absent.""" + counts = {0: 0.5, 1: 0.4, 2: 0.1} + + def pmf(x: float) -> float: + return counts.get(int(x), 0.0) + + sampler_stub.distr = SimpleNamespace( + analytical_computations={CharacteristicName.PMF: pmf}, + ) + left, right = sampler_stub._determine_domain_from_pmf() + assert left <= 0 <= right and right >= 1 + + def test_determine_domain_from_pmf_with_left_bound( + self, sampler_stub: DefaultUnuranSampler + ) -> None: + """Providing left boundary should seed the PMF scan.""" + sampler_stub.distr = SimpleNamespace( + analytical_computations={CharacteristicName.PMF: lambda x: 0.5 if x in (5, 6) else 0.0}, + ) + assert sampler_stub._determine_domain_from_pmf(5) == (5, 6) + + def test_calculate_pmf_sum(self, sampler_stub: DefaultUnuranSampler) -> None: + """PMF sum should aggregate values across inclusive domain.""" + sampler_stub.distr = SimpleNamespace( + analytical_computations={CharacteristicName.PMF: lambda x: 0.1 * (x + 1)}, + ) + total = sampler_stub._calculate_pmf_sum(0, 2) + assert pytest.approx(total, rel=1e-9) == 0.6 + + def test_setup_dgt_method_configures_domain_and_pv(self) -> None: + """DGT setup should set domain, pmf sum, and build PV without errors.""" + sampler = object.__new__(DefaultUnuranSampler) + sampler._ffi = SimpleNamespace(NULL=None) + sampler._unuran_distr = "DIST" + sampler.distr = SimpleNamespace( + analytical_computations={CharacteristicName.PMF: lambda x: 0.5 if x in (0, 1) else 0.0}, + support=SimpleNamespace(first=lambda: 0, last=lambda: 1), + ) + + recorded: dict[str, object] = {} + + def set_domain(distr: object, left: int, right: int) -> int: + recorded["domain"] = (left, right) + return 0 + + def set_pmfsum(distr: object, value: float) -> None: + recorded["pmfsum"] = value + + def make_pv(distr: object) -> int: + recorded["make_pv"] = True + return 2 + + sampler._lib = SimpleNamespace( + unur_distr_discr_set_domain=set_domain, + unur_distr_discr_set_pmfsum=set_pmfsum, + unur_distr_discr_make_pv=make_pv, + ) + + sampler._setup_dgt_method() + assert recorded["domain"] == (0, 1) + assert pytest.approx(recorded["pmfsum"], rel=1e-9) == 1.0 + assert recorded.get("make_pv") is True diff --git a/tests/unit/stats/unuran_sampler/test_initialization.py b/tests/unit/stats/unuran_sampler/test_initialization.py new file mode 100644 index 0000000..59106e2 --- /dev/null +++ b/tests/unit/stats/unuran_sampler/test_initialization.py @@ -0,0 +1,79 @@ +from __future__ import annotations + +__author__ = "Artem Romanyuk" +__copyright__ = "Copyright (c) 2025 PySATL project" +__license__ = "SPDX-License-Identifier: MIT" + +from types import SimpleNamespace + +import pytest + +from pysatl_core.stats._unuran.api import UnuranMethod, UnuranMethodConfig +from pysatl_core.stats._unuran.bindings._core.unuran_sampler import DefaultUnuranSampler +from pysatl_core.types import CharacteristicName, EuclideanDistributionType, Kind + + +class TestInitialization: + """Tests covering sampler initialization and configuration.""" + + def test_init_raises_when_bindings_absent( + self, monkeypatch: pytest.MonkeyPatch, dummy_distribution: SimpleNamespace + ) -> None: + """Sampler should raise if CFFI bindings are missing.""" + monkeypatch.setattr("pysatl_core.stats._unuran.bindings._unuran_cffi", None) + + with pytest.raises(RuntimeError, match="UNURAN CFFI bindings are not available"): + DefaultUnuranSampler(dummy_distribution) + + def test_init_rejects_non_euclidean_distribution(self, dummy_cffi: SimpleNamespace) -> None: + """Non-Euclidean distribution types must be rejected.""" + distr = SimpleNamespace( + distribution_type=SimpleNamespace(kind=Kind.CONTINUOUS, dimension=1), + analytical_computations={}, + support=None, + ) + + with pytest.raises(RuntimeError, match="Unsupported distribution type"): + DefaultUnuranSampler(distr) + + def test_init_rejects_multi_dimensional_distribution(self, dummy_cffi: SimpleNamespace) -> None: + """Sampler should only allow univariate (dimension=1) distributions.""" + distr = SimpleNamespace( + distribution_type=EuclideanDistributionType(kind=Kind.CONTINUOUS, dimension=2), + analytical_computations={}, + support=None, + ) + + with pytest.raises(RuntimeError, match="Unsupported distribution dimension"): + DefaultUnuranSampler(distr) + + def test_auto_method_selection_uses_helper( + self, + dummy_cffi: SimpleNamespace, + dummy_distribution: SimpleNamespace, + monkeypatch: pytest.MonkeyPatch, + ) -> None: + """AUTO method configuration should delegate to helper with available characteristics.""" + chosen_method = UnuranMethod.NINV + captured_args: list[tuple[set[str], Kind]] = [] + + def fake_select(chars: set[str], kind: Kind, config: UnuranMethodConfig) -> UnuranMethod: + captured_args.append((chars, kind)) + return chosen_method + + monkeypatch.setattr( + "pysatl_core.stats._unuran.bindings._core.unuran_sampler._get_available_characteristics", + lambda distr: {CharacteristicName.PDF}, + ) + monkeypatch.setattr( + "pysatl_core.stats._unuran.bindings._core.unuran_sampler._select_best_method", + fake_select, + ) + monkeypatch.setattr(DefaultUnuranSampler, "_initialize_unuran", lambda self, seed: None) + + sampler = DefaultUnuranSampler( + dummy_distribution, UnuranMethodConfig(method=UnuranMethod.AUTO) + ) + + assert sampler.method == chosen_method + assert captured_args == [({CharacteristicName.PDF}, Kind.CONTINUOUS)] diff --git a/tests/unit/stats/unuran_sampler/test_orchestration.py b/tests/unit/stats/unuran_sampler/test_orchestration.py new file mode 100644 index 0000000..add128c --- /dev/null +++ b/tests/unit/stats/unuran_sampler/test_orchestration.py @@ -0,0 +1,120 @@ +from __future__ import annotations + +__author__ = "Artem Romanyuk" +__copyright__ = "Copyright (c) 2025 PySATL project" +__license__ = "SPDX-License-Identifier: MIT" + +from types import SimpleNamespace +from unittest.mock import patch + +import pytest + +from pysatl_core.stats._unuran.api import UnuranMethod +from pysatl_core.stats._unuran.bindings._core.unuran_sampler import DefaultUnuranSampler + + +class TestOrchestration: + """Tests covering generator creation, initialization, and parameter mapping.""" + + def test_create_and_init_generator_success(self) -> None: + """_create_and_init_generator should fill _unuran_par/_unuran_gen on success.""" + sampler = object.__new__(DefaultUnuranSampler) + sampler._ffi = SimpleNamespace(NULL=None) + sampler._lib = SimpleNamespace(unur_init=lambda par: "GEN") + sampler._unuran_distr = "DIST" + sampler._method = UnuranMethod.PINV + + with patch.object( + DefaultUnuranSampler, "_create_parameter_object", autospec=True + ) as mock_create_par: + mock_create_par.return_value = "PAR" + sampler._create_and_init_generator() + + mock_create_par.assert_called_once_with(sampler) + assert sampler._unuran_par == "PAR" + assert sampler._unuran_gen == "GEN" + + def test_initialize_unuran_calls_components(self) -> None: + """Continuous initialization should run distribution, callbacks, and generator setup.""" + sampler = object.__new__(DefaultUnuranSampler) + sampler._is_continuous = True + sequence: list[str] = [] + + sampler._method = UnuranMethod.PINV + + with ( + patch.object( + DefaultUnuranSampler, "_create_unuran_distribution", autospec=True + ) as mock_create_distr, + patch.object( + DefaultUnuranSampler, "_setup_continuous_callbacks", autospec=True + ) as mock_setup_cont, + patch.object( + DefaultUnuranSampler, "_create_and_init_generator", autospec=True + ) as mock_create_gen, + ): + mock_create_distr.side_effect = lambda self: sequence.append("distr") + mock_setup_cont.side_effect = lambda self: sequence.append("callbacks") + mock_create_gen.side_effect = lambda self: sequence.append("generator") + + sampler._initialize_unuran(seed=None) + + mock_create_distr.assert_called_once_with(sampler) + mock_setup_cont.assert_called_once_with(sampler) + mock_create_gen.assert_called_once_with(sampler) + assert sequence == ["distr", "callbacks", "generator"] + + def test_initialize_unuran_discrete_calls_dgt(self) -> None: + """Discrete initialization should run DGT setup after callbacks.""" + sampler = object.__new__(DefaultUnuranSampler) + sampler._is_continuous = False + sampler._method = UnuranMethod.DGT + sequence: list[str] = [] + + with ( + patch.object( + DefaultUnuranSampler, "_create_unuran_distribution", autospec=True + ) as mock_create_distr, + patch.object( + DefaultUnuranSampler, "_setup_discrete_callbacks", autospec=True + ) as mock_setup_discrete, + patch.object(DefaultUnuranSampler, "_setup_dgt_method", autospec=True) as mock_dgt, + patch.object( + DefaultUnuranSampler, "_create_and_init_generator", autospec=True + ) as mock_create_gen, + ): + mock_create_distr.side_effect = lambda self: sequence.append("distr") + mock_setup_discrete.side_effect = lambda self: sequence.append("discrete") + mock_dgt.side_effect = lambda self: sequence.append("dgt") + mock_create_gen.side_effect = lambda self: sequence.append("generator") + + sampler._initialize_unuran(seed=None) + + mock_create_distr.assert_called_once_with(sampler) + mock_setup_discrete.assert_called_once_with(sampler) + mock_dgt.assert_called_once_with(sampler) + mock_create_gen.assert_called_once_with(sampler) + assert sequence == ["distr", "discrete", "dgt", "generator"] + + def test_create_parameter_object_maps_methods(self) -> None: + """_create_parameter_object should dispatch to each UNURAN factory and reject SROU.""" + sampler = object.__new__(DefaultUnuranSampler) + sampler._unuran_distr = "DIST" + + def make(method: UnuranMethod) -> str: + sampler._method = method + sampler._lib = SimpleNamespace( + **{f"unur_{method.value.lower()}_new": lambda dist: method.value} + ) + return sampler._create_parameter_object() + + assert make(UnuranMethod.AROU) == "arou" + assert make(UnuranMethod.TDR) == "tdr" + assert make(UnuranMethod.HINV) == "hinv" + assert make(UnuranMethod.PINV) == "pinv" + assert make(UnuranMethod.NINV) == "ninv" + assert make(UnuranMethod.DGT) == "dgt" + sampler._method = UnuranMethod.SROU + sampler._lib = SimpleNamespace() + with pytest.raises(ValueError, match="Method SROU"): + sampler._create_parameter_object() diff --git a/tests/unit/stats/unuran_sampler/test_sampling_lifecycle.py b/tests/unit/stats/unuran_sampler/test_sampling_lifecycle.py new file mode 100644 index 0000000..1e3d8d6 --- /dev/null +++ b/tests/unit/stats/unuran_sampler/test_sampling_lifecycle.py @@ -0,0 +1,131 @@ +from __future__ import annotations + +__author__ = "Artem Romanyuk" +__copyright__ = "Copyright (c) 2025 PySATL project" +__license__ = "SPDX-License-Identifier: MIT" + +from types import SimpleNamespace +from unittest.mock import patch + +import numpy as np +import pytest + +from pysatl_core.stats._unuran.api import UnuranMethod +from pysatl_core.stats._unuran.bindings._core.unuran_sampler import DefaultUnuranSampler + + +class TestSamplingAndLifecycle: + """Tests for sampling behavior and lifecycle helpers.""" + + def test_sample_continuous_uses_unur_sample_cont(self) -> None: + """Sampling continuous distributions should call unur_sample_cont each time.""" + sampler = object.__new__(DefaultUnuranSampler) + values = iter([0.1, 0.2, 0.3]) + + def fake_unur_sample_cont(gen: object) -> float: + return next(values) + + sampler._is_continuous = True + sampler._lib = SimpleNamespace(unur_sample_cont=fake_unur_sample_cont) + sampler._unuran_gen = object() + sampler._unuran_distr = object() + sampler._ffi = SimpleNamespace(NULL=None) + + result = sampler.sample(3) + assert np.allclose(result, np.array([0.1, 0.2, 0.3])) + + def test_sample_discrete_uses_unur_sample_discr(self) -> None: + """Discrete sampling should call unur_sample_discr and cast to floats.""" + sampler = object.__new__(DefaultUnuranSampler) + calls: list[int] = [] + + def fake_unur_sample_discr(gen: object) -> int: + value = len(calls) + calls.append(value) + return value + + sampler._is_continuous = False + sampler._lib = SimpleNamespace(unur_sample_discr=fake_unur_sample_discr) + sampler._unuran_gen = object() + sampler._unuran_distr = object() + sampler._ffi = SimpleNamespace(NULL=None) + + result = sampler.sample(4) + assert np.array_equal(result, np.array([0.0, 1.0, 2.0, 3.0])) + assert len(calls) == 4 + + def test_sample_raises_when_not_initialized(self) -> None: + """Calling sample without initialized generator should raise.""" + sampler = object.__new__(DefaultUnuranSampler) + sampler._is_continuous = True + sampler._lib = SimpleNamespace() + sampler._ffi = SimpleNamespace(NULL=None) + sampler._unuran_gen = None + sampler._unuran_distr = None + + with pytest.raises(RuntimeError, match="Sampler is not initialized"): + sampler.sample(1) + + def test_cleanup_idempotent_and_frees_resources(self) -> None: + """_cleanup should free generator/distr once and tolerate repeated calls.""" + sampler = object.__new__(DefaultUnuranSampler) + freed: list[str] = [] + + class DummyLib: + def unur_free(self, gen: object) -> None: + freed.append("gen") + + def unur_par_free(self, par: object) -> None: + freed.append("par") + + def unur_distr_free(self, distr: object) -> None: + freed.append("distr") + + sampler._lib = DummyLib() + sampler._ffi = SimpleNamespace(NULL=None) + sampler._unuran_gen = "GEN" + sampler._unuran_par = "PAR" + sampler._unuran_distr = "DISTR" + sampler._callbacks = [] + sampler._cleaned_up = False + + sampler._cleanup() + sampler._cleanup() + + assert freed == ["gen", "distr"] + + def test_reset_reinitializes_when_not_initialized(self) -> None: + """reset() should trigger initialization only when sampler is not ready.""" + sampler = object.__new__(DefaultUnuranSampler) + sampler._unuran_gen = None + sampler._unuran_distr = None + + with patch.object(DefaultUnuranSampler, "_initialize_unuran", autospec=True) as mock_init: + sampler.reset() + + mock_init.assert_called_once_with(sampler, None) + + def test_is_initialized_property(self) -> None: + """is_initialized should reflect generator/distr being non-null.""" + sampler = object.__new__(DefaultUnuranSampler) + sampler._ffi = SimpleNamespace(NULL=None) + sampler._unuran_gen = object() + sampler._unuran_distr = object() + assert sampler.is_initialized is True + sampler._unuran_gen = None + assert sampler.is_initialized is False + + def test_method_property(self) -> None: + """method property should expose the configured UnuranMethod.""" + sampler = object.__new__(DefaultUnuranSampler) + sampler._method = UnuranMethod.PINV + assert sampler.method == UnuranMethod.PINV + + def test_del_calls_cleanup(self) -> None: + """__del__ should invoke cleanup safely.""" + sampler = object.__new__(DefaultUnuranSampler) + + with patch.object(DefaultUnuranSampler, "_cleanup", autospec=True) as mock_cleanup: + sampler.__del__() + + mock_cleanup.assert_called_once_with(sampler) diff --git a/vendor/unuran-1.11.0/AUTHORS b/vendor/unuran-1.11.0/AUTHORS new file mode 100644 index 0000000..7a06277 --- /dev/null +++ b/vendor/unuran-1.11.0/AUTHORS @@ -0,0 +1,12 @@ +Josef Leydold (josef.leydold@wu.ac.at) +Wolfgang Hoermann (hormannw@boun.edu.tr) + +Erich Janka +Guenther Tirler +Roman Karawatzki + + +Source code provided by: + +Ernst Stadlober +Renee Touzin \ No newline at end of file diff --git a/vendor/unuran-1.11.0/COPYING b/vendor/unuran-1.11.0/COPYING new file mode 100644 index 0000000..62e911f --- /dev/null +++ b/vendor/unuran-1.11.0/COPYING @@ -0,0 +1,341 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/vendor/unuran-1.11.0/ChangeLog b/vendor/unuran-1.11.0/ChangeLog new file mode 100644 index 0000000..55ac3e9 --- /dev/null +++ b/vendor/unuran-1.11.0/ChangeLog @@ -0,0 +1 @@ +see NEWS file \ No newline at end of file diff --git a/vendor/unuran-1.11.0/INSTALL b/vendor/unuran-1.11.0/INSTALL new file mode 100644 index 0000000..8a307c8 --- /dev/null +++ b/vendor/unuran-1.11.0/INSTALL @@ -0,0 +1,386 @@ + ***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + + + Installation instructions for the UNU.RAN library. + + Version 1.11.0 + + +While the code is plain ANSI C and thus quite portable, the following +adaptions might be necessary for compiling this library. + + +Uniform random number generator +............................... + + UNU.RAN can be used with any uniform random number generator but (at +the moment) some features work best with Pierre L'Ecuyer's RngStreams +library (see for +a description and downloading). + + Install the requires libraries first. + + +Installing UNU.RAN +.................. + + 1. First unzip and untar the package and change to the directory: + tar zxvf unuran-1.11.0.tar.gz + cd unuran-1.11.0 + + + 2. Optional: Edit the file `src/unuran_config.h'. + + + 3. Run a configuration script: + + sh ./configure --prefix= + + where `' is the root of the installation tree. When + omitted `/usr/local' is used. + + Use ./configure --help to get a list of other options. + In particular the following flags are important: + + [*] Enable support for some external sources of uniform random + number generators: + + --with-urng-rngstream + URNG: use Pierre L'Ecuyer's RNGSTREAM library + [default=no] + --with-urng-prng + URNG: use Otmar Lendl's PRNG library + [default=no] + --with-urng-gsl + URNG: use random number generators from GNU Scientific Library + [default=no] + + --with-urng-default + URNG: global default URNG (builtin|rngstream) + [default=builtin] + + We strongly recommend to use RngStreams library: + + sh ./configure --with-urng-rngstream --with-urng-default=rngstream + + Important: You must install the respective libraries RngStreams, + PRNG and GSL before ./configure is executed. + + [*] Also make a shared library: + + --enable-shared + build shared libraries [default=no] + + [*] The library provides the function `unur_gen_info' for + information about generator objects. This is intended for + using in interactive computing environments. + This feature can be enabled / disabled by means of the + configure flag + + --enable-info + INFO: provide function with information about generator + objects [default=`yes'] + + [*] Enable support for deprecated UNU.RAN routines if you have + some problems with older application after upgrading the + library: + + --enable-deprecated + enable support for deprecated UNU.RAN routines + [default=no] + + [*] Enable debugging tools: + + --enable-check-struct + Debug: check validity of pointers to structures + [default=no] + + --enable-logging + Debug: print informations about generator into logfile + [default=no] + + + 4. Compile and install the library: + + make + make install + + This installs the following files: + + $(prefix)/include/unuran.h + $(prefix)/include/unuran_tests.h + $(prefix)/lib/libunuran.a + $(prefix)/info/unuran.info + + Obviously `$(prefix)/include' and `$(prefix)/lib' must be in the search + path of your compiler. You can use environment variables to add these + directories to the search path. If you are using the bash type (or add to + your profile): + + export LIBRARY_PATH="HOMEDIRECTORY/lib" + export C_INCLUDE_PATH="HOMEDIRECTORY/include" + + + 5. Documentation in various formats (PDF, HTML, info, plain text) + can be found in the directory `doc'. + + + 6. You can run some tests by + make check + + However, some of these tests requires the usage of the PRNG or + RngStreams library and are only executed if these are installed + enabled by the corresponding configure flag. + + An extended set of tests is run by + make fullcheck + + However some of these might fail occasionally due to roundoff + errors or the mysteries of floating point arithmetic, since we + have used some extreme settings to test the library. + + +(For further targets for make and more details see the GNU generic installation +instructions below.) + + +Upgrading UNU.RAN +................. + +Important: + UNU.RAN now relies on some aspects of IEEE 754 compliant floating + point arithmetic. In particular, 1./0. and 0./0. must result in + INFINITY and NaN (not a number), respectively, and must not cause a + floating point exception. For almost all modern computing + architecture this is implemented in hardware. For others there + should be a special compiler flag to get this feature (e.g. -MIEEE + on DEC alpha or -mp for the Intel C compiler). + + +Upgrading UNU.RAN from version 0.9.x or earlier: + + With UNU.RAN version 1.0.x some of the macro definitions in file + 'src/unuran_config.h' are moved into file 'config.h' and are + set/controlled by the ./configure script. + + Writting logging information into the logfile must now be enabled + when running the configure script: + + sh ./configure --enable-logging + + +Upgrading UNU.RAN from version 0.7.x or earlier: + + With UNU.RAN version 0.8.x the interface for changing underlying + distributions and running a reinitialization routine has been + simplified. The old routines can be compiled into the library using + the following configure flag: + + sh ./configure --enable-deprecated + + Notice: Using these deprecated routines is not supported any more + and this strong discouraged. + + Wrapper functions for external sources of uniform random numbers + are now enabled by configure flags and not by macros defined in + file 'src/unuran_config.h'. + + The file 'src/unuran_config.h' is not installed any more. + It is now only included when the library is compiled. + It should be removed from the global include path of the compiler. + + + + +********************************************************************* +* * +* GNU generic installation instructions. * +* * +********************************************************************* + +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. diff --git a/vendor/unuran-1.11.0/KNOWN-PROBLEMS b/vendor/unuran-1.11.0/KNOWN-PROBLEMS new file mode 100644 index 0000000..d18a51c --- /dev/null +++ b/vendor/unuran-1.11.0/KNOWN-PROBLEMS @@ -0,0 +1,7 @@ + +(*) Using unur_sample_cont(), unur_sample_discr(), or unur_distr_vec() + with a generator object of the wrong distribution type results in + undefined behavior or causes a segmentation fault. + +(*) The String API does not provide the full functionality as the API + using function calls. diff --git a/vendor/unuran-1.11.0/Makefile b/vendor/unuran-1.11.0/Makefile new file mode 100644 index 0000000..a961ce6 --- /dev/null +++ b/vendor/unuran-1.11.0/Makefile @@ -0,0 +1,944 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +# AUTOMAKE_OPTIONS = + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/unuran +pkgincludedir = $(includedir)/unuran +pkglibdir = $(libdir)/unuran +pkglibexecdir = $(libexecdir)/unuran +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(am__DIST_COMMON) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + cscope distdir distdir-am dist dist-all distcheck +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ + config.h.in +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/autoconf/compile \ + $(top_srcdir)/autoconf/config.guess \ + $(top_srcdir)/autoconf/config.sub \ + $(top_srcdir)/autoconf/install-sh \ + $(top_srcdir)/autoconf/ltmain.sh \ + $(top_srcdir)/autoconf/missing AUTHORS COPYING ChangeLog \ + INSTALL NEWS README THANKS autoconf/compile \ + autoconf/config.guess autoconf/config.sub autoconf/install-sh \ + autoconf/ltmain.sh autoconf/missing +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +DIST_TARGETS = dist-gzip +# Exists only to be overridden by the user if desired. +AM_DISTCHECK_DVI_TARGET = dvi +distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' +distcleancheck_listfiles = find . -type f -print +ACLOCAL = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_CFLAGS = -Wall -Wextra -Wshadow -Wstrict-prototypes +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf +AUTOHEADER = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader +AUTOMAKE = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -fPIC +CPP = gcc -E +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +FILECMD = file +GREP = /usr/bin/grep +HAVE_DIVIDE_BY_ZERO = +HAVE_IEEE_COMPARISONS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAINT = # +MAKEINFO = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = unuran +PACKAGE_BUGREPORT = unuran@statmath.wu.ac.at +PACKAGE_NAME = unuran +PACKAGE_STRING = unuran 1.11.0 +PACKAGE_TARNAME = unuran +PACKAGE_URL = +PACKAGE_VERSION = 1.11.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +UNURAN_LT_VERSION = 16:1:0 +UNURAN_SUPPORTS_GSL = +UNURAN_SUPPORTS_PRNG = +UNURAN_SUPPORTS_RNGSTREAM = +VERSION = 1.11.0 +abs_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +have_valgrind = false +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = +top_builddir = . +top_srcdir = . +SUBDIRS = . scripts src examples experiments tests doc +DIST_SUBDIRS = $(SUBDIRS) +EXTRA_DIST = \ + README.win32 \ + UPGRADE \ + KNOWN-PROBLEMS \ + autogen.sh + + +# make special distribution for ROOT +rootdir = tmp-unuran-root +distrootfile = $(PACKAGE)-$(VERSION)-root.tar.gz +remove_rootdir = \ + { test ! -d $(rootdir) \ + || { find $(rootdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(rootdir); }; } + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + $(srcdir)/Makefile.in \ + $(srcdir)/autoconf/compile \ + $(srcdir)/autoconf/config.guess \ + $(srcdir)/autoconf/config.sub \ + $(srcdir)/autoconf/depcomp \ + $(srcdir)/autoconf/install-sh \ + $(srcdir)/autoconf/ltmain.sh \ + $(srcdir)/autoconf/mdate-sh \ + $(srcdir)/autoconf/missing \ + $(srcdir)/autoconf/test-driver + +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: # $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @test -f $@ || rm -f stamp-h1 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: # $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) +clean-cscope: + -rm -f cscope.files +cscope.files: clean-cscope cscopelist +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz + $(am__post_remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__post_remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__post_remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__post_remove_distdir) + +dist-zstd: distdir + tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst + $(am__post_remove_distdir) + +dist-tarZ: distdir + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__post_remove_distdir) + +dist-shar: distdir + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz + $(am__post_remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__post_remove_distdir) + +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + *.tar.zst*) \ + zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ + esac + chmod -R a-w $(distdir) + chmod u+w $(distdir) + mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build/sub \ + && ../../configure \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=../.. --prefix="$$dc_install_base" \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__post_remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic \ + maintainer-clean-local + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) all install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--refresh check check-am clean clean-cscope clean-generic \ + clean-libtool cscope cscopelist-am ctags ctags-am dist \ + dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ + dist-xz dist-zip dist-zstd distcheck distclean \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-local mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am + +.PRECIOUS: Makefile + + +dist-root: +# @echo "Create tar ball for ROOT" | \ +# sed 'h;s/./=/g;p;x;p;x' +# $(remove_rootdir) +# $(MAKE) +# $(MAKE) dist +# mkdir $(rootdir) +# tar zxf $(PACKAGE)-$(VERSION).tar.gz -C $(rootdir) +# (cd $(rootdir)/$(PACKAGE)-$(VERSION); \ +# sed -e 's/\(AC_INIT(\s*\[unuran\]\s*,\s*\[\)\(.*\)\]\s*,\s*\[/\1\2-root\],\[/' \ +# -e 's/\(AM_INIT_AUTOMAKE(\s*\[unuran\]\s*,\s*\[\)\(.*\)\]\s*)/\1\2-root\])/' \ +# -e '/^\s*src.*\/Makefile\s*\\/p' -e '/^\s*.*\/Makefile\s*\\/d' \ +# < ../../configure.ac > ./configure.ac; \ +# sed -e 's/^\s*SUBDIRS\s*=.*/SUBDIRS = \. src/' \ +# < ../../Makefile.am > Makefile.am; \ +# for f in `find ./src -type f -name '*.[ch]' -o -name '*.ch'`; do \ +# ./scripts/remove_comments.pl $$f; \ +# done; \ +# echo "AC_MSG_NOTICE([ " >> configure.ac; \ +# echo "*===================================================" >> configure.ac; \ +# echo "*" >> configure.ac; \ +# echo "* This is a pure source distribution!" >> configure.ac; \ +# echo "*" >> configure.ac; \ +# echo "* For a manual, documented sources, tests," >> configure.ac; \ +# echo "* and examples please download" >> configure.ac; \ +# echo "*" >> configure.ac; \ +# echo "* $(PACKAGE)-$(VERSION).tar.gz" >> configure.ac; \ +# echo "*" >> configure.ac; \ +# echo "*===================================================" >> configure.ac; \ +# echo "])" >> configure.ac; \ +# autoreconf; ./configure; \ +# $(MAKE) dist; \ +# ) +# cp $(rootdir)/$(PACKAGE)-$(VERSION)/$(PACKAGE)-*.tar.gz . +# $(remove_rootdir) +# @echo "$(distrootfile) is ready for distribution" | \ +# sed 'h;s/./=/g;p;x;p;x' + @echo "You must enable maintainer mode using" + @echo " sh ./configure --enable-maintainer-mode" + @echo "first to run 'make dist-root'!" + +# compile with almost all GCC warnings enabled +#setgccWflags: +# export CFLAGS="`cat $(top_srcdir)/scripts/gccWflags`"; \ +# ./configure --enable-maintainer-mode + +#setgccWflags-ansi: +# export CFLAGS="-ansi -pedantic `cat $(top_srcdir)/scripts/gccWflags`"; \ +# ./configure --enable-maintainer-mode + +# run checks in fullcheck mode +fullcheck: + UNURANFULLCHECK=true $(MAKE) check + +# Remark: the three files +# $(top_srcdir)/aclocal.m4 +# $(top_srcdir)/config.h.in +# $(top_srcdir)/configure +# are removed in doc/Makefile.am. +# It cannot be done here as this breaks the cleaning process. + +# auxiliary directories +maintainer-clean-local: + rm -rf unuran-win32 + @$(remove_rootdir) + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/Makefile.am b/vendor/unuran-1.11.0/Makefile.am new file mode 100644 index 0000000..046ada7 --- /dev/null +++ b/vendor/unuran-1.11.0/Makefile.am @@ -0,0 +1,112 @@ +## Process this file with automake to produce Makefile.in + +# AUTOMAKE_OPTIONS = + +SUBDIRS = . scripts src examples experiments tests doc + +DIST_SUBDIRS = $(SUBDIRS) + +EXTRA_DIST = \ + README.win32 \ + UPGRADE \ + KNOWN-PROBLEMS \ + autogen.sh + + +# make special distribution for ROOT +rootdir = tmp-unuran-root +distrootfile = $(PACKAGE)-$(VERSION)-root.tar.gz + +remove_rootdir = \ + { test ! -d $(rootdir) \ + || { find $(rootdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(rootdir); }; } + +dist-root: +if MAINTAINER_MODE + @echo "Create tar ball for ROOT" | \ + sed 'h;s/./=/g;p;x;p;x' + $(remove_rootdir) + $(MAKE) + $(MAKE) dist + mkdir $(rootdir) + tar zxf $(PACKAGE)-$(VERSION).tar.gz -C $(rootdir) + (cd $(rootdir)/$(PACKAGE)-$(VERSION); \ + sed -e 's/\(AC_INIT(\s*\[unuran\]\s*,\s*\[\)\(.*\)\]\s*,\s*\[/\1\2-root\],\[/' \ + -e 's/\(AM_INIT_AUTOMAKE(\s*\[unuran\]\s*,\s*\[\)\(.*\)\]\s*)/\1\2-root\])/' \ + -e '/^\s*src.*\/Makefile\s*\\/p' -e '/^\s*.*\/Makefile\s*\\/d' \ + < ../../configure.ac > ./configure.ac; \ + sed -e 's/^\s*SUBDIRS\s*=.*/SUBDIRS = \. src/' \ + < ../../Makefile.am > Makefile.am; \ + for f in `find ./src -type f -name '*.[ch]' -o -name '*.ch'`; do \ + ./scripts/remove_comments.pl $$f; \ + done; \ + echo "AC_MSG_NOTICE([ " >> configure.ac; \ + echo "*===================================================" >> configure.ac; \ + echo "*" >> configure.ac; \ + echo "* This is a pure source distribution!" >> configure.ac; \ + echo "*" >> configure.ac; \ + echo "* For a manual, documented sources, tests," >> configure.ac; \ + echo "* and examples please download" >> configure.ac; \ + echo "*" >> configure.ac; \ + echo "* $(PACKAGE)-$(VERSION).tar.gz" >> configure.ac; \ + echo "*" >> configure.ac; \ + echo "*===================================================" >> configure.ac; \ + echo "])" >> configure.ac; \ + autoreconf; ./configure; \ + $(MAKE) dist; \ + ) + cp $(rootdir)/$(PACKAGE)-$(VERSION)/$(PACKAGE)-*.tar.gz . + $(remove_rootdir) + @echo "$(distrootfile) is ready for distribution" | \ + sed 'h;s/./=/g;p;x;p;x' +else + @echo "You must enable maintainer mode using" + @echo " sh ./configure --enable-maintainer-mode" + @echo "first to run 'make dist-root'!" +endif + +# compile with almost all GCC warnings enabled +if MAINTAINER_MODE +setgccWflags: + export CFLAGS="`cat $(top_srcdir)/scripts/gccWflags`"; \ + ./configure --enable-maintainer-mode + +setgccWflags-ansi: + export CFLAGS="-ansi -pedantic `cat $(top_srcdir)/scripts/gccWflags`"; \ + ./configure --enable-maintainer-mode +endif + +# run checks in fullcheck mode +fullcheck: + UNURANFULLCHECK=true $(MAKE) check + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + $(srcdir)/Makefile.in \ + $(srcdir)/autoconf/compile \ + $(srcdir)/autoconf/config.guess \ + $(srcdir)/autoconf/config.sub \ + $(srcdir)/autoconf/depcomp \ + $(srcdir)/autoconf/install-sh \ + $(srcdir)/autoconf/ltmain.sh \ + $(srcdir)/autoconf/mdate-sh \ + $(srcdir)/autoconf/missing \ + $(srcdir)/autoconf/test-driver + +# Remark: the three files +# $(top_srcdir)/aclocal.m4 +# $(top_srcdir)/config.h.in +# $(top_srcdir)/configure +# are removed in doc/Makefile.am. +# It cannot be done here as this breaks the cleaning process. + +# auxiliary directories +maintainer-clean-local: + rm -rf unuran-win32 + @$(remove_rootdir) + diff --git a/vendor/unuran-1.11.0/Makefile.in b/vendor/unuran-1.11.0/Makefile.in new file mode 100644 index 0000000..f71a97e --- /dev/null +++ b/vendor/unuran-1.11.0/Makefile.in @@ -0,0 +1,944 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# AUTOMAKE_OPTIONS = +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(am__DIST_COMMON) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + cscope distdir distdir-am dist dist-all distcheck +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ + config.h.in +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/autoconf/compile \ + $(top_srcdir)/autoconf/config.guess \ + $(top_srcdir)/autoconf/config.sub \ + $(top_srcdir)/autoconf/install-sh \ + $(top_srcdir)/autoconf/ltmain.sh \ + $(top_srcdir)/autoconf/missing AUTHORS COPYING ChangeLog \ + INSTALL NEWS README THANKS autoconf/compile \ + autoconf/config.guess autoconf/config.sub autoconf/install-sh \ + autoconf/ltmain.sh autoconf/missing +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +DIST_TARGETS = dist-gzip +# Exists only to be overridden by the user if desired. +AM_DISTCHECK_DVI_TARGET = dvi +distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ +UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ +UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ +UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_valgrind = @have_valgrind@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = . scripts src examples experiments tests doc +DIST_SUBDIRS = $(SUBDIRS) +EXTRA_DIST = \ + README.win32 \ + UPGRADE \ + KNOWN-PROBLEMS \ + autogen.sh + + +# make special distribution for ROOT +rootdir = tmp-unuran-root +distrootfile = $(PACKAGE)-$(VERSION)-root.tar.gz +remove_rootdir = \ + { test ! -d $(rootdir) \ + || { find $(rootdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(rootdir); }; } + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + $(srcdir)/Makefile.in \ + $(srcdir)/autoconf/compile \ + $(srcdir)/autoconf/config.guess \ + $(srcdir)/autoconf/config.sub \ + $(srcdir)/autoconf/depcomp \ + $(srcdir)/autoconf/install-sh \ + $(srcdir)/autoconf/ltmain.sh \ + $(srcdir)/autoconf/mdate-sh \ + $(srcdir)/autoconf/missing \ + $(srcdir)/autoconf/test-driver + +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @test -f $@ || rm -f stamp-h1 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) +clean-cscope: + -rm -f cscope.files +cscope.files: clean-cscope cscopelist +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz + $(am__post_remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__post_remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__post_remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__post_remove_distdir) + +dist-zstd: distdir + tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst + $(am__post_remove_distdir) + +dist-tarZ: distdir + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__post_remove_distdir) + +dist-shar: distdir + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz + $(am__post_remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__post_remove_distdir) + +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + *.tar.zst*) \ + zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ + esac + chmod -R a-w $(distdir) + chmod u+w $(distdir) + mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build/sub \ + && ../../configure \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=../.. --prefix="$$dc_install_base" \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__post_remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic \ + maintainer-clean-local + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) all install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--refresh check check-am clean clean-cscope clean-generic \ + clean-libtool cscope cscopelist-am ctags ctags-am dist \ + dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ + dist-xz dist-zip dist-zstd distcheck distclean \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-local mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am + +.PRECIOUS: Makefile + + +dist-root: +@MAINTAINER_MODE_TRUE@ @echo "Create tar ball for ROOT" | \ +@MAINTAINER_MODE_TRUE@ sed 'h;s/./=/g;p;x;p;x' +@MAINTAINER_MODE_TRUE@ $(remove_rootdir) +@MAINTAINER_MODE_TRUE@ $(MAKE) +@MAINTAINER_MODE_TRUE@ $(MAKE) dist +@MAINTAINER_MODE_TRUE@ mkdir $(rootdir) +@MAINTAINER_MODE_TRUE@ tar zxf $(PACKAGE)-$(VERSION).tar.gz -C $(rootdir) +@MAINTAINER_MODE_TRUE@ (cd $(rootdir)/$(PACKAGE)-$(VERSION); \ +@MAINTAINER_MODE_TRUE@ sed -e 's/\(AC_INIT(\s*\[unuran\]\s*,\s*\[\)\(.*\)\]\s*,\s*\[/\1\2-root\],\[/' \ +@MAINTAINER_MODE_TRUE@ -e 's/\(AM_INIT_AUTOMAKE(\s*\[unuran\]\s*,\s*\[\)\(.*\)\]\s*)/\1\2-root\])/' \ +@MAINTAINER_MODE_TRUE@ -e '/^\s*src.*\/Makefile\s*\\/p' -e '/^\s*.*\/Makefile\s*\\/d' \ +@MAINTAINER_MODE_TRUE@ < ../../configure.ac > ./configure.ac; \ +@MAINTAINER_MODE_TRUE@ sed -e 's/^\s*SUBDIRS\s*=.*/SUBDIRS = \. src/' \ +@MAINTAINER_MODE_TRUE@ < ../../Makefile.am > Makefile.am; \ +@MAINTAINER_MODE_TRUE@ for f in `find ./src -type f -name '*.[ch]' -o -name '*.ch'`; do \ +@MAINTAINER_MODE_TRUE@ ./scripts/remove_comments.pl $$f; \ +@MAINTAINER_MODE_TRUE@ done; \ +@MAINTAINER_MODE_TRUE@ echo "AC_MSG_NOTICE([ " >> configure.ac; \ +@MAINTAINER_MODE_TRUE@ echo "*===================================================" >> configure.ac; \ +@MAINTAINER_MODE_TRUE@ echo "*" >> configure.ac; \ +@MAINTAINER_MODE_TRUE@ echo "* This is a pure source distribution!" >> configure.ac; \ +@MAINTAINER_MODE_TRUE@ echo "*" >> configure.ac; \ +@MAINTAINER_MODE_TRUE@ echo "* For a manual, documented sources, tests," >> configure.ac; \ +@MAINTAINER_MODE_TRUE@ echo "* and examples please download" >> configure.ac; \ +@MAINTAINER_MODE_TRUE@ echo "*" >> configure.ac; \ +@MAINTAINER_MODE_TRUE@ echo "* $(PACKAGE)-$(VERSION).tar.gz" >> configure.ac; \ +@MAINTAINER_MODE_TRUE@ echo "*" >> configure.ac; \ +@MAINTAINER_MODE_TRUE@ echo "*===================================================" >> configure.ac; \ +@MAINTAINER_MODE_TRUE@ echo "])" >> configure.ac; \ +@MAINTAINER_MODE_TRUE@ autoreconf; ./configure; \ +@MAINTAINER_MODE_TRUE@ $(MAKE) dist; \ +@MAINTAINER_MODE_TRUE@ ) +@MAINTAINER_MODE_TRUE@ cp $(rootdir)/$(PACKAGE)-$(VERSION)/$(PACKAGE)-*.tar.gz . +@MAINTAINER_MODE_TRUE@ $(remove_rootdir) +@MAINTAINER_MODE_TRUE@ @echo "$(distrootfile) is ready for distribution" | \ +@MAINTAINER_MODE_TRUE@ sed 'h;s/./=/g;p;x;p;x' +@MAINTAINER_MODE_FALSE@ @echo "You must enable maintainer mode using" +@MAINTAINER_MODE_FALSE@ @echo " sh ./configure --enable-maintainer-mode" +@MAINTAINER_MODE_FALSE@ @echo "first to run 'make dist-root'!" + +# compile with almost all GCC warnings enabled +@MAINTAINER_MODE_TRUE@setgccWflags: +@MAINTAINER_MODE_TRUE@ export CFLAGS="`cat $(top_srcdir)/scripts/gccWflags`"; \ +@MAINTAINER_MODE_TRUE@ ./configure --enable-maintainer-mode + +@MAINTAINER_MODE_TRUE@setgccWflags-ansi: +@MAINTAINER_MODE_TRUE@ export CFLAGS="-ansi -pedantic `cat $(top_srcdir)/scripts/gccWflags`"; \ +@MAINTAINER_MODE_TRUE@ ./configure --enable-maintainer-mode + +# run checks in fullcheck mode +fullcheck: + UNURANFULLCHECK=true $(MAKE) check + +# Remark: the three files +# $(top_srcdir)/aclocal.m4 +# $(top_srcdir)/config.h.in +# $(top_srcdir)/configure +# are removed in doc/Makefile.am. +# It cannot be done here as this breaks the cleaning process. + +# auxiliary directories +maintainer-clean-local: + rm -rf unuran-win32 + @$(remove_rootdir) + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/NEWS b/vendor/unuran-1.11.0/NEWS new file mode 100644 index 0000000..5625d78 --- /dev/null +++ b/vendor/unuran-1.11.0/NEWS @@ -0,0 +1,727 @@ + +Version 1.11.0: April 2023 + + * Methods: + + - PINV: + . Optionally improved estimate of u-error of the approximation + at the expense of considerably higher setup time. + This can be switched on by means of ... + + . new function unur_pinv_set_extra_testpoints() + + . Fixed issue with PDFs that almost vanish at the boundary of + the domain + + +Version 1.10.0: December 2022 + + * Distributions: + + - GIG: improved numerical accuracy of computation of mode + + * Internal: + + - Fixed some compiler warnings + + - Update configure script + + +Version 1.9.0: March 2022 + + * Methods: + + - CSTD: + print constants computed in init step into log file and + info string. + + - PINV: + . now also works for distributions with PDFs with constant + part + + . internal: + check pointer dPDF before using it. + disabled internal rescaling of PDF. + abort computation of area below PDF when an almost + infinite loop occurs. + do not immediately stop computation of relevant domain + when INF or NaN occurs. + + - new function unur_get_method(): + it returns the identifier for the generating method. + these identifiers are declared in 'src/methods/unur_metthods.h'. + + - new function unur_gen_is_inversion(); + returns TRUE if the generator object implements an + inversion method. + + - get rid of confusing error message for method TABL when the + the update function for the PDF area is not available. + + * Distributions: + + - beta: fixed a problem with CSTD special generator '2'. + + - added example 'example_reinit.c' + + +Version 1.8.1: April 2011 + + - fixed linker flags for GSL (thanks to Carlos) + + +Version 1.8.0: October 2010 + + * Methods: + + - DSTD: + new function unur_dstd_chg_truncated() + that allows to truncate the domain of generator object that + implements the inversion method. + + - NORTA: + use method PINV as first choice for generator of marginal + distribution. + + - PINV: + when no 'center' is provided by the user, or when the + PDF vanishes for the given 'center' or is not finite, then + the method tries to "guess" an appropriate point for the 'center'. + + new function unur_pinv_eval_approxcdf() for computing + approximate CDF. This requires to keep the table of + CDF values by means of call unur_pinv_set_keepcdf(). + + * Distributions: + + - DISCRete distribution objects: added slot 'invCDF' for + inverse CDF. New functions + . unur_distr_discr_set_invcdf() + . unur_distr_discr_get_invcdf() + . unur_distr_discr_eval_invcdf() + + - When configure flag '--with-Rmath' is used, then all special + functions (like beta and gamma function) are now taken from + Rmath library. + + - geometric distribution: fixed special random variate generator + + * Other: + + - Fixed errors detect by static analysis tools by the ROOT team + at CERN (thanks to R. Brun and L. Moneta) + + +Version 1.7.1: April 2010 + + * Methods: + + - PINV: + fixed setup for smoothness parameters 1 and 2. + It failed on x86 (32-bit) platforms. + + +Version 1.7.0: April 2010 + + * Methods: + + - PINV: + . estimation of computational domain is now more robust. + . added experimental function unur_pinv_set_use_upoints(). + . increased maximal order to 17 + . added smoothness parameter, + new function unur_pinv_set_smoothness(). + + +Version 1.6.0: February 2010 + + * Methods: + + - new method MIXT (MIXTure of distributions) + + +Version 1.5.1: November 2009 + + * fixed a minor problem with MS Visual Studio compiler + + +Version 1.5.0: November 2009 + + * Methods: + + - NINV: changed evaluation of accuracy goal of algorithms. + Now checking for the maximal tolerated x-error and maximal + tolerated u-error can be set (or disabled) independently. + [This slightly changes the generated pseudo-random sequence!] + By default, the u-error remains unchecked. + + New variant: bisection method. + This is a very slow method and should only be considered as + a last resort. + + - NORTA: try method PINV for sampling from marginal distribution. + + * Distributions: + + - added new distributions: + + hyperbolic ... Hyperbolic distribution + IG ... Inverse Gaussian distribution + GIG ... Generalized Inverse Gaussian distribution + lognormal ... Log-Normal distribution + slash ... Slash distribution + + * Tests: + + - unur_test_inverror() has been renamed to unur_test_u_error(). + + - new test function unur_test_timing_R() for (hopefully) more + robust timing results. + + * configure: + + - New exprimental configure flag '--with-Rmath': + enables usage of the Rmath stand alone library from the + R project for statistical computing. This makes some special + functions (in particular Bessel functions) available for + PDFs and CDFs of some distributions (e.g. GIG). + + +Version 1.4.1: August 2009 + + * Methods: + + - PINV: fixed bug that occured when SunStudio compiler with + flag -xO5 was used (initialization failed). + + +Version 1.4.0: June 2009 + + * Methods: + + - unur_quantile() now also supports CSTD with inversion + and DGT (for discrete distribution). + + - CSTD: generic inversion method for continuous distribution + provided that the inverse CDF is implemented in distribution + object. + + - PINV: slightly fewer PDF evaluations during setup + + * Distributions: + + - CONT (continuous univariate distribution): + support for inverse CDF: + unur_distr_cont_set_invcdf() + unur_distr_cont_get_invcdf() + unur_distr_cont_eval_invcdf() + + - unur_distr_cont_set_domain() now takes care of given + center set by a unur_distr_cont_set_center() call. + + +Version 1.3.1: January 2009 + + * Methods: + + - AROU: fixed problems with round-off errors when computing + tangents. + + +Version 1.3.0: November 2008 + + * Methods: + + - new method PINV (Polynomial interpolation based INVersion of + CDF). + + - new function unur_quantile() that (approximately) + computes the quantile for a continuous distribution. It + requires a generator object that implements an inversion + method. + + - HINV: fixed segfault when calling + unur_hinv_eval_approxinvcdf with u-value very close + too 1. + However, now when the domain has been truncated then + this function evaluates the inverse CDF of the + truncated distribution. + + +Version 1.2.4: April 2008 + + * Methods: + + - GIBBS: fixed possible infinite loops. + + - HINV: fixed round-off error that occured for truncated + distributions when compiled with 'gcc-4.3 -O2' on some + plattforms. + + +Version 1.2.3: April 2008 + + * Function parser: + + - moved (hidden) routines for code generator into + external library. + + +Version 1.2.2: April 2008 + + * Methods: + + - AROU: run DARS by default (as stated in the manual) + + - ARS: + new method unur_ars_set_max_iter(): + Sets maximum number of iterations of rejection loop. + The loops aborts then and UNUR_INFINITY is returned. + Thus (almost) infinite loops are prevented when invalid + PDFs are given but not detected during setup. + + - GIBBS: fixed rare problem with infinite loops (see ARS) + + - HRB and HRI: fixed possible infinite loop with + invalid hazad rates. + + * Uniform random number generators: + + - unur_urng_prng_new() now supports 'unur_urng_seed'. + + +Version 1.2.0: February 2008 + + * Methods: + + - New call unur_gen_info() for creating info strings + in interactive programming environments. + This feature is controlled by the '--enable-info' + configure flag. + + - Renamed method TDRGW to ARS + (avoid confusion with TDR) + old functions available as macros. + not available for string API. + + - DARI now checks for distributions with negative domains. + + * Inststallation: + + - 'make check' now runs only a restricted set of tests. + For additional tests run 'make fullcheck'. + (These might fail occasionally when randomly chosen + distribution parameter are too extreme). + + +Version 1.1.0: December 2007 + + * Methods: + + - New method MVTDR + + * Distributions: + + - CONT (continuous univariate distribution): + logarithm of CDF can be provided by user. + + +Version 1.0.1: May 2007 + + * Methods: + + - HINV: + . fixed problem with missing PDF. + . better support for heavy-tailed distributions. + . change default of u-resolution from 1.e-8 to 1.e-10. + + * Distributions: + + - CONT (continuous univariate distribution): + compute PDF and dPDF when the CDF is set by a + unur_distr_cont_set_cdfstr() call. + + +Version 1.0.0: April 2007 + + * Methods: + + - New method HIST for sampling from histograms. + + - New method CEXT, DEXT, and MVSTD: + wrapper for external generators for univariate contiuous, + discrete, and multivariate continuous distributions, resp. + + - HINV: fixed problem with truncated domains. + + - DARI: check for positive domain. + + - VMT is now deprecated. Its only usefull application + is sampling from a multinormal distribution. + Use new method MVSTD for this purpose instead. + + * Distributions: + + - Standard distributions: added F-distribution. + + - CEMP (empirical distributions): added histogram. + + - CVEC (Continuous multivariate distributions): + + . Added support for rectangular domains: + + unur_distr_cvec_set_domain_rect() + + . Using standardized marginal distributions is now + deprecated: + + unur_distr_cvec_set_stdmarginals() + unur_distr_cvec_set_stdmarginal_array() + unur_distr_cvec_set_stdmarginal_list() + unur_distr_cvec_get_stdmarginal() + + * Uniform random number generators: + + - unur_urng_fvoid_new() has been changed: + first argument must be pointer to function of prototype + double (*random)(void *state) + + * Miscellaneous: + + - Protoype of unur_run_tests() has changed: + it uses the output stream as additional argument + + - The UNU.RAN error handler has been been changed: + + unur_set_error_handler_off() allows to switch off + error messages and warnings. + + unur_set_error_handler() allows to replace the + default error handler (i.e. print a short message into a + logfile) by a customized one. + + On the other hand it is not possible any more to suppress + error messages by a compiler switch. + + - More flags for the ./configure script. + + - The size of file 'src/unuran_config.h' has been removed: + Some of the macros are either deleted at all or moved into + the file 'config.h' which is created/controlled by + ./configure script. + + - Script for creating MS Windows(R) DLL using MS Visual Studio + 2005: ./scripts/win32/build.sh + + +Version 0.9.0: January 2007 + + * This is a pre-1.0 release. + + * Deprecated Routines: + + Deprecated routines (see release notes to Version 0.8.1 + below) are now disabled by default. They are still available + but must be enable at using + + ./configure --enable-deprecated + + Notice: Deprecated routines are not tested any more and + their usage is strongly discouraged. + + * Wrapper functions for external sources of uniform random + numbers are now enabled by configure flags and not by macros + defined in file 'src/unuran_config.h'. + + * The file 'src/unuran_config.h' is not installed any more. + It is now only included when the library is compiled. + It should be removed from the global include path of the compiler. + + * Some bugs have been fixed. + + +Version 0.8.1: November 2006 + + * Methods: + + - new method ITDR (Inverse Transformed Density Rejection) + for distributions with monotone unbounded densities. + + - Implemented new routine unur_reinit() for reinitializing + existing generator object. This can be done by extracting + the underlying distribution object by a unur_get_distr(), + modify it and reinitialize the generator by running + unur_reinit(). + + - More methods support reinitialization now. + + * String API: + + - New functions unur_makegen_ssu() and unur_makegen_dsu() + to allow disribution object, generation method and + uniform random number generator as separate arguments. + + - The keyword "urng" is deprecated now and will be removed + in the next release. + + * Distributions: + + - DISCR: + now unur_distr_discr_set_pmf() and unur_distr_discr_set_cdf() + can be used after a unur_distr_discr_set_pv() call. + However, the probability vector is then removed. + + - added unur_distr_set_extobj() / unur_distr_get_extobj(): + Store pointer to external object that can be passed to + PDF, CDF, PMF or similar functions + + * Deprecated calls: + + The API for UNU.RAN has been modified. + ow there exists a general unur_reinit() call that replaces + such a call for particular methods. + Thus the following calls are now deprecated and will be + removed in the next release: + + unur_dari_reinit() + unur_dsrou_reinit() + unur_srou_reinit() + unur_ssr_reinit() + unur_utdr_reinit() + unur_tdr_reinit() + unur_tdrgw_reinit() + + To avoid lots of calls for changing the parameters or domains + of the underlying distribution the prefered method now is to + extract the distribution object from the generator object, + use the corresponding calls for distributions to change it, + and run unur_reinit(). + Thus the following calls are now deprecated and will be + removed in the next release: + + . unur_cstd_chg_pdfparams(), + . unur_dari_chg_pmfparams(), unur_dari_chg_domain(), + unur_dari_chg_mode(), unur_dari_upd_mode(), + unur_dari_chg_pmfsum(), unur_dari_upd_pmfsum(), and + . unur_dsrou_chg_pmfparams(), unur_dsrou_chg_domain(), + unur_dsrou_chg_mode(), unur_dsrou_upd_mode(), + unur_dsrou_chg_pmfsum(), unur_dsrou_upd_pmfsum(), and + . unur_dstd_chg_pmfparams(), + . unur_ninv_chg_pmfparams(), + . unur_srou_chg_pdfparams(), unur_srou_chg_domain(), + unur_srou_chg_mode(), unur_srou_upd_mode(), + unur_srou_chg_pdfarea(), unur_srou_upd_pdfarea() + . unur_ssr_chg_pdfparams(), unur_ssr_chg_domain(), + unur_ssr_chg_mode(), unur_ssr_upd_mode(), + unur_ssr_chg_pdfarea(), unur_ssr_upd_pdfarea() + . unur_utdr_chg_pdfparams(), unur_utdr_chg_domain(), + unur_utdr_chg_mode(), unur_utdr_upd_mode(), + unur_utdr_chg_pdfarea(), unur_utdr_upd_pdfarea() + + Other calls: + + . removed unur_arou_set_center() as this functionality is + already covered by the unur_distr_cont_set_center() call. + + . removed unur_tdr_set_center() as this functionality is + already covered by the unur_distr_cont_set_center() call. + + * Bug fixes: + + - fixed segfault when calling unur_urng_free() with RngStreams + object. + + +Version 0.7.2: March 2006 + + - fixed function prototype that contained C++ keyword + + +Version 0.7.1: January 2006 + + - fixed non-ASCII C compliant code in tests directory + + +Version 0.7.0: January 2006 + + * Methods: + + - new method TDRGW (robust variant of TDR - variant of Gilks & Wild) + + - new method NORTA (NORmal To Anything) + + - new method HITROU + + - new method GIBBS + + - method TDR: added reinit routine + + - method TABL: construction points can be set by new function + unur_tdr_set_cpoints(). It also replaces function + unur_tabl_set_nstp() which should not be used any more + (but is still available for compatibility). + + - method MCORR: extended to cover generation of random + correlation matrices with given eigenvalues. + + * Distributions: + + - added new distribution type for full conditional distributions + + - continuous distribution objects (CONT) have a slot for the center + of the distribution. It is now set for the distribution + directly. This mechanism replaces the _set_ calls for + all methods that make use of the center. + + - interface for setting and getting parameter-arrays for + multivariate distributions (CVEC) has been renamed. + + - adding multivariate Cauchy and Student distributions. + + * Uniform random number generator: + + - new flexible interface to uniform random number generators. + No compiler switches necessary. Thus it is now possible to + use random numbers from different libraries without + recompiling UNU.RAN. + + - The generic interface to uniform random number generators + has been enhanced. However, it cannot be accessed directly any more. + Use the corresponding calls instead (see also the message above). + + +Version 0.6.0: June 2005 + + - precompiled version for Windows + + +Version 0.5.0: August 2004 + + - UNU.RAN now makes use of IEEE 754 compliant floating point + arithmetic. In particular, 1./0. and 0./0. must result in + infinity and NaN (not a number), respectively, and must not + cause a floating point exception. + For all modern compting architecture this is implemented in + hardware or in software using a special compiler flag. + + - new methods NROU and VNROU + + - new method MCORR + + - return codes of _set_ and _get_ functions have been changed: + in case of successful execution 0 (or UNUR_SUCCESS) is returned + (instead of 1 in previous versions). + Thus it is possible to return some non-zero error code in case + of an failure. + + - the API of method VMT has changed + + - added new disribution type MATR for matrix distributions. + (Currently only used for creating random covariance matrices) + + - multivariate distribution objects now contain marginal distributions. + + - unur_distr_cvec_set_covar() now checks for positive definiteness of + given covariance matrix. + + - fixed bug in function that (automatically) computes a + probability vector by means of the probability mass + function. This caused methods that require explicitly given + probability vectors (like DAU) to truncate the last entry. + + - some other minor bug fixes + + +Version 0.4.5: July 2003 + + - added method DSS (discrete sequential search) + + - added rerandomized ARS to method AROU + + - bug fixes with discrete distributions + + +Version 0.4.4: July 2003 + + - "orderstatistics" need not be last entry in string API + + - replaced unur_tabl_set_variant_setup() by unur_tabl_set_usedars() + with a slightly different interface. + + +Version 0.4.3: June 2003 + + - fixed problem with prepocessor for MacOS X + + - fixed bug in Kinderman-Ramage Gaussian variate generator + + +Version 0.4.2: March 2003 + + - new interface for unur_tdr_eval_invcdfhat() + + - fixed bug in error handling of method AROU + + +Version 0.4.1: January 2003 + + - use build-in generator as default uniform random number generator + + - string API: fixed bug with string 'inf' in cygwin. + parsing of numbers does not depend on locale any more + + - fixed bug in Makefile + + +Version 0.4.0: January 2003 + + - added methods HRB, HRD, and HRI for distributions with given + hazard rates (bounded, decreasing, and increasing, resp.) + + - added method EMPL (empirical CDF with linear interpolation) + (for sake of completeness; method not recommended) + + - support for shared libraries + + - reorganization of source tree + + - bug fixes + + +Version 0.3.0: October 2002 + + - added method HINV (Hermite interpolation based INVersion of CDF) + + - new interface for using uniform random number generators; + all settings are now in ./src/unuran_config.h + + - added support for more uniform random number generator packages + + - included better build-in uniform pseudo-random number generator + + - added unur_gen_clone() call + + - added const qualifier in function prototypes where appropriate + + - fixed broken computation of window width in method EMPK + + - many bug fixes + + +Version 0.2.0: June 2002 + + - added new simple API (String interface) + + - added method AUTO (automatic) + + - added method DSROU (discrete simple ratio of uniforms) + + - improved method for finding construction points in methods TDR and AROU + (Derandomized adaptive rejection sampling) + + - many bug fixes + + +Version 0.1.0: March 2001 + + - First public release. diff --git a/vendor/unuran-1.11.0/README b/vendor/unuran-1.11.0/README new file mode 100644 index 0000000..c390de4 --- /dev/null +++ b/vendor/unuran-1.11.0/README @@ -0,0 +1,126 @@ + + ***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + + +UNU.RAN is an ANSI C library licensed under GPL. +It contains universal (also called automatic or black-box) algorithms +that can generate random numbers from large classes of continuous or +discrete distributions, and also from practically all standard +distributions. + +The library and an extensive online documentation are available at: + + ------------------------------------------ + http://statmath.wu.ac.at/unuran/ + ------------------------------------------ + + +--------------------------------------------------------- +A short overview +--------------------------------------------------------- + +To generate random numbers the user must supply some information about +the desired distribution, especially a C-function that computes the +density and - depending on the chosen methods - some additional +information (like the borders of the domain, the mode, the derivative +of the density ...). After a user has given this information an +init-program computes all tables and constants necessary for the +random variate generation. The sample program can then generate +variates from the desired distribution. + +The main part + of UNU.RAN are different universal algorithms (called methods). + There are: + + 7 methods for continuous univariate distributions + 3 methods for discrete univariate distributions + 1 method for univariate empirical distributions + (given by an observed sample) + 1 method for multivariate empirical distributions + (given by a vector sample) + + The choice of the method depends on the information available for + the distribution and on the desired characteristics of the algorithm + (fast initialisation and slow sampling, slow initialisation and + fast sampling). + +A second important part + of UNU.RAN is the distribution module containing all necessary + functions for many continuous and discrete univariate standard + distributions. Thus UNU.RAN can be used without extra coding to + obtain very fast generators for the best known standard + distributions. + + +UNU.RAN is coded in ANSI C but uses an object oriented programming +interface. There are three objects: + + distribution objects + containing all information of the distribution. + parameter objects + containing all input parameters (and defaults) for the + different methods. + generator object + produced by the initialization program, containing everything + necessary for sampling. + + +Of course a uniform random number generator is necessary to use +UNU.RAN. We provide an interface to use the PRNG uniform package from +the pLab team from the University of Salzburg (Austria), +available at http://random.mat.ac.at/ or from +http://statmath.wu.ac.at/prng/. +It is also no problem to include any other uniform random number +generator. + + +--------------------------------------------------------- +ADVANTAGES OF UNUNRAN +--------------------------------------------------------- + +Why can it be worth the time to download UNU.RAN and to understand the +concept of its interface? Isn't it much faster to implement a simple +standard method for the distribution I am interested in? + +- The first and main advantage lies in the modelling flexibility you + gain for your simulation. Once you have installed UNU.RAN you can + sample from practically all uni-modal (and other) distributions + without coding more than the density functions. For a big number of + standard distributions (and truncated versions of these standard + distributions) you need not even code the densities as these are + already included in UNU.RAN. + +- It is possible to sample from non-standard distribution. In fact + only a pointer to a function that returns e.g. the density at a + given point x is required. + +- Distributions can be exchanged easily. For example it is not + difficult at all to start your simulation with the normal + distribution, and switch to an empirical distribution later. + +- The library contains reliable and fast generation algorithms. The + characteristics of some these algorithms (like speed, expected + number of uniforms required etc, ...) are only slightly influenced + by the chosen distribution. (However numerical inversion is included + as a (very slow) brute force algorithm for the rare cases where the + more sophisticated methods do not work.) + +- Correlation induction facilities are included. + +--------------------------------------------------------- + +March 31st, 2001 + +Josef Leydold (leydold@statmath.wu.ac.at) +Wolfgang Hoermann (hormannw@boun.edu.tr) + + + + + + + diff --git a/vendor/unuran-1.11.0/README.win32 b/vendor/unuran-1.11.0/README.win32 new file mode 100644 index 0000000..157d85a --- /dev/null +++ b/vendor/unuran-1.11.0/README.win32 @@ -0,0 +1,28 @@ +You can create a MS Windows(R) DLL using Cygwin[1] and MS Visual +Studio 2005 [2]: + +1. Edit path variables 'VSCYG' and 'VCWIN' in file + './scripts/win32/build.sh' + (The distributed files contains the default pathes of + Cygwin and MS Visual Studio). + +2. Run './scripts/win32/build.sh' + +3. The created files can be then found in directory + 'unuran-win32': + + libunuran.dll + libunuran.dll.manifest + libunuran.def + libunuran.lib + libunuran.exp + unuran.h + +4. Applications also have to be linked against the runtime library + 'msvcr80.dll' (included in the MS Visual Studio tree). + + +References: + +[1] http://www.cygwin.com/ +[2] http://msdn2.microsoft.com/en-us/vstudio/default.aspx \ No newline at end of file diff --git a/vendor/unuran-1.11.0/THANKS b/vendor/unuran-1.11.0/THANKS new file mode 100644 index 0000000..0baa475 --- /dev/null +++ b/vendor/unuran-1.11.0/THANKS @@ -0,0 +1,20 @@ +We thank the following people for their permissions to use +some of their codes: + +Ernst Stadlober (Stadlober@stat.tu-graz.ac.at) + ... WinRand library. + +Renee Touzin + ... mrg31k3p.c (Combined multiple recursive generator) + + +We thank the following people for submitting bug reports: + +Richard Russell + +Rene Brun and Lorenzo Moneta from the ROOT team at CERN + + + +We also thank Philipp Tomsich for valuable help concerning +the C programming language. diff --git a/vendor/unuran-1.11.0/UPGRADE b/vendor/unuran-1.11.0/UPGRADE new file mode 100644 index 0000000..f0f2724 --- /dev/null +++ b/vendor/unuran-1.11.0/UPGRADE @@ -0,0 +1,51 @@ + + ***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + + +Important: + UNU.RAN now relies on some aspects of IEEE 754 compliant floating + point arithmetic. In particular, 1./0. and 0./0. must result in + INFINITY and NaN (not a number), respectively, and must not cause a + floating point exception. For almost all modern compting + architecture this is implemented in hardware. For others there + should be a special compiler flag to get this feature (e.g. -MIEEE + on DEC alpha or -mp for the Intel C compiler). + + +Upgrading UNU.RAN from version 0.9.x or earlier +............................................... + + With UNU.RAN version 1.0.x some of the macro definitions in file + 'src/unuran_config.h' are moved into file 'config.h' and are + set/controlled by the ./configure script. + + Writting logging information into the logfile must now be enabled + when running the configure script: + + sh ./configure --enable-logging + + +Upgrading UNU.RAN from version 0.7.x or earlier +............................................... + + With UNU.RAN version 0.8.x the interface for changing underlying + distributions and running a reinitialization routine has been + simplified. The old routines can be compiled into the library using + the following configure flag: + + sh ./configure --enable-deprecated + + Notice: Using these deprecated routines is not supported any more + and this strong discouraged. + + Wrapper functions for external sources of uniform random numbers + are now enabled by configure flags and not by macros defined in + file 'src/unuran_config.h'. + + The file 'src/unuran_config.h' is not installed any more. + It is now only included when the library is compiled. + It should be removed from the global include path of the compiler. diff --git a/vendor/unuran-1.11.0/acinclude.m4 b/vendor/unuran-1.11.0/acinclude.m4 new file mode 100644 index 0000000..240af3f --- /dev/null +++ b/vendor/unuran-1.11.0/acinclude.m4 @@ -0,0 +1,118 @@ +dnl +dnl AX_IEEE_COMP +dnl Check IEEE comparisons, whether "x != x" is true for NaNs +dnl ------------------------------------------------------------------------- +AC_DEFUN([AX_IEEE_COMP], +[ +AC_CACHE_CHECK([for IEEE comparisons], ac_cv_c_ieee_comparisons, +[AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include +int main (void) +{ + int status; double inf, nan; + inf = exp(1.0e10); + nan = inf / inf; + /* nan = 0.0 / 0.0; */ + status = (nan == nan); + return status; +}]])], +[ac_cv_c_ieee_comparisons="yes"], +[ac_cv_c_ieee_comparisons="no"], +[ac_cv_c_ieee_comparisons="yes"]) +]) +if test "$ac_cv_c_ieee_comparisons" != no ; then + AC_DEFINE([HAVE_IEEE_COMPARISONS], [1], + [Define to 1 if "x != x" is true for NaNs]) + AC_SUBST(HAVE_IEEE_COMPARISONS) +fi +]) # end of AX_IEEE_COMP + + +dnl +dnl AX_DIVIDE_BY_ZERO +dnl Check whether 1./0. works and results in "infinity" +dnl ------------------------------------------------------------------------- +AC_DEFUN([AX_DIVIDE_BY_ZERO], +[ +AC_CACHE_CHECK([for divide-by-zero], ac_cv_c_divide_by_zero, +[AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include +#include +int main (void) +{ + double x = 0.0; + double inf = 1.0 / x; + int status = (inf < DBL_MAX/2.); + return status; +}]])], +[ac_cv_c_divide_by_zero="yes"], +[ac_cv_c_divide_by_zero="no"], +[ac_cv_c_divide_by_zero="yes"]) +]) +if test "$ac_cv_c_divide_by_zero" != no ; then + AC_DEFINE([HAVE_DIVIDE_BY_ZERO], [1], + [Define to 1 if "1.0/0.0" results in INFINITY]) + AC_SUBST(HAVE_DIVIDE_BY_ZERO) +fi +]) # end of AX_DIVIDE_BY_ZERO + + +dnl +dnl AX_ADD_URNG_LIB([TAG],[UTAG],[NAME],[LIB],[PROG],[HEADER]) +dnl Add support for library providing uniform random number generators +dnl via configure flag and check existance of library and header file +dnl ------------------------------------------------------------------------- +AC_DEFUN([AX_ADD_URNG_LIB], +[ +AC_ARG_WITH(urng_$1, + [AS_HELP_STRING([--with-urng-$1], + [URNG: use $3 @<:@default=no@:>@])], + [case "${withval}" in + yes) ;; no) ;; + *) AC_MSG_ERROR(bad value '${withval}' for --with-urng-$1) ;; + esac], + [with_urng_$1=no]) +AS_IF([test "x$with_urng_$1" != xno], + [AC_CHECK_LIB([$4], [$5], [], []) + AC_CHECK_HEADERS([$6], + [AC_SUBST(UNURAN_SUPPORTS_$2,-DUNURAN_SUPPORTS_$2) + AC_DEFINE_UNQUOTED([UNURAN_HAS_$2], [1], [Define to 1 if you use $3.])], + [AC_MSG_FAILURE( + [PRINT_WITH_FRAME([--with-urng-$1 given, but '$6' not found]) + ]) ]) ], []) +]) + + +dnl +dnl AX_ADD_RMATH() +dnl Add support for Rmath standalone library from R project +dnl via configure flag and check existance of library +dnl (Remark: AC_CHECK_HEADERS cannot be used as is. I have skipped the +dnl test for header file Rmath.h.) +dnl ------------------------------------------------------------------------- +AC_DEFUN([AX_ADD_RMATH], +[ +AC_ARG_WITH(Rmath, + [AS_HELP_STRING([--with-Rmath], + [use Rmath library from R project @<:@EXPERIMENTAL@:>@ @<:@default=no@:>@])], + [case "${withval}" in + yes) ;; no) ;; + *) AC_MSG_ERROR(bad value '${withval}' for --with-Rmath) ;; + esac], + [with_Rmath=no]) +AS_IF([test "x$with_Rmath" != xno], + [AC_CHECK_LIB([Rmath], [bessel_k],[], + [AC_MSG_FAILURE( + [PRINT_WITH_FRAME([--with-Rmath given, but 'libRmath' not found]) + ]) ]) ], []) +]) + + +dnl +dnl PRINT_WITH_FRAME([STRING)] +dnl Print 'string' inside framed box +dnl ------------------------------------------------------------------------- +AC_DEFUN([PRINT_WITH_FRAME],[ +`echo "$1" | \ + $SED 's/\(.*\)/* \1 */;h;s/./*/g;p;s/./ /g;s/./*/;s/.$/*/;p;x;p;x;p;x;s/./*/g'` +]) # end of PRINT_WITH_FRAME diff --git a/vendor/unuran-1.11.0/aclocal.m4 b/vendor/unuran-1.11.0/aclocal.m4 new file mode 100644 index 0000000..e1fb5b6 --- /dev/null +++ b/vendor/unuran-1.11.0/aclocal.m4 @@ -0,0 +1,10266 @@ +# generated automatically by aclocal 1.16.5 -*- Autoconf -*- + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, +[m4_warning([this file was generated for autoconf 2.71. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) + +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996-2001, 2003-2019, 2021-2022 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +m4_define([_LT_COPYING], [dnl +# Copyright (C) 2014 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program or library that is built +# using GNU Libtool, you may include this file under the same +# distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +]) + +# serial 59 LT_INIT + + +# LT_PREREQ(VERSION) +# ------------------ +# Complain and exit if this libtool version is less that VERSION. +m4_defun([LT_PREREQ], +[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, + [m4_default([$3], + [m4_fatal([Libtool version $1 or higher is required], + 63)])], + [$2])]) + + +# _LT_CHECK_BUILDDIR +# ------------------ +# Complain if the absolute build directory name contains unusual characters +m4_defun([_LT_CHECK_BUILDDIR], +[case `pwd` in + *\ * | *\ *) + AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; +esac +]) + + +# LT_INIT([OPTIONS]) +# ------------------ +AC_DEFUN([LT_INIT], +[AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_BEFORE([$0], [LT_LANG])dnl +AC_BEFORE([$0], [LT_OUTPUT])dnl +AC_BEFORE([$0], [LTDL_INIT])dnl +m4_require([_LT_CHECK_BUILDDIR])dnl + +dnl Autoconf doesn't catch unexpanded LT_ macros by default: +m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl +m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl +dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 +dnl unless we require an AC_DEFUNed macro: +AC_REQUIRE([LTOPTIONS_VERSION])dnl +AC_REQUIRE([LTSUGAR_VERSION])dnl +AC_REQUIRE([LTVERSION_VERSION])dnl +AC_REQUIRE([LTOBSOLETE_VERSION])dnl +m4_require([_LT_PROG_LTMAIN])dnl + +_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) + +dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS=$ltmain + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +_LT_SETUP + +# Only expand once: +m4_define([LT_INIT]) +])# LT_INIT + +# Old names: +AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) +AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PROG_LIBTOOL], []) +dnl AC_DEFUN([AM_PROG_LIBTOOL], []) + + +# _LT_PREPARE_CC_BASENAME +# ----------------------- +m4_defun([_LT_PREPARE_CC_BASENAME], [ +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in @S|@*""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} +])# _LT_PREPARE_CC_BASENAME + + +# _LT_CC_BASENAME(CC) +# ------------------- +# It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, +# but that macro is also expanded into generated libtool script, which +# arranges for $SED and $ECHO to be set by different means. +m4_defun([_LT_CC_BASENAME], +[m4_require([_LT_PREPARE_CC_BASENAME])dnl +AC_REQUIRE([_LT_DECL_SED])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl +func_cc_basename $1 +cc_basename=$func_cc_basename_result +]) + + +# _LT_FILEUTILS_DEFAULTS +# ---------------------- +# It is okay to use these file commands and assume they have been set +# sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. +m4_defun([_LT_FILEUTILS_DEFAULTS], +[: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} +])# _LT_FILEUTILS_DEFAULTS + + +# _LT_SETUP +# --------- +m4_defun([_LT_SETUP], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl + +_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl +dnl +_LT_DECL([], [host_alias], [0], [The host system])dnl +_LT_DECL([], [host], [0])dnl +_LT_DECL([], [host_os], [0])dnl +dnl +_LT_DECL([], [build_alias], [0], [The build system])dnl +_LT_DECL([], [build], [0])dnl +_LT_DECL([], [build_os], [0])dnl +dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +test -z "$LN_S" && LN_S="ln -s" +_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl +dnl +AC_REQUIRE([LT_CMD_MAX_LEN])dnl +_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl +_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl +dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl +m4_require([_LT_CMD_RELOAD])dnl +m4_require([_LT_DECL_FILECMD])dnl +m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl +m4_require([_LT_CMD_OLD_ARCHIVE])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_WITH_SYSROOT])dnl +m4_require([_LT_CMD_TRUNCATE])dnl + +_LT_CONFIG_LIBTOOL_INIT([ +# See if we are running on zsh, and set the options that allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi +]) +if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi + +_LT_CHECK_OBJDIR + +m4_require([_LT_TAG_COMPILER])dnl + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a '.a' archive for static linking (except MSVC and +# ICC, which need '.lib'). +libext=a + +with_gnu_ld=$lt_cv_prog_gnu_ld + +old_CC=$CC +old_CFLAGS=$CFLAGS + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + _LT_PATH_MAGIC + fi + ;; +esac + +# Use C for the default configuration in the libtool script +LT_SUPPORTED_TAG([CC]) +_LT_LANG_C_CONFIG +_LT_LANG_DEFAULT_CONFIG +_LT_CONFIG_COMMANDS +])# _LT_SETUP + + +# _LT_PREPARE_SED_QUOTE_VARS +# -------------------------- +# Define a few sed substitution that help us do robust quoting. +m4_defun([_LT_PREPARE_SED_QUOTE_VARS], +[# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' +]) + +# _LT_PROG_LTMAIN +# --------------- +# Note that this code is called both from 'configure', and 'config.status' +# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, +# 'config.status' has no value for ac_aux_dir unless we are using Automake, +# so we pass a copy along to make sure it has a sensible value anyway. +m4_defun([_LT_PROG_LTMAIN], +[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl +_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) +ltmain=$ac_aux_dir/ltmain.sh +])# _LT_PROG_LTMAIN + + + +# So that we can recreate a full libtool script including additional +# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS +# in macros and then make a single call at the end using the 'libtool' +# label. + + +# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) +# ---------------------------------------- +# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL_INIT], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_INIT], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_INIT]) + + +# _LT_CONFIG_LIBTOOL([COMMANDS]) +# ------------------------------ +# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) + + +# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) +# ----------------------------------------------------- +m4_defun([_LT_CONFIG_SAVE_COMMANDS], +[_LT_CONFIG_LIBTOOL([$1]) +_LT_CONFIG_LIBTOOL_INIT([$2]) +]) + + +# _LT_FORMAT_COMMENT([COMMENT]) +# ----------------------------- +# Add leading comment marks to the start of each line, and a trailing +# full-stop to the whole comment if one is not present already. +m4_define([_LT_FORMAT_COMMENT], +[m4_ifval([$1], [ +m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], + [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) +)]) + + + + + +# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) +# ------------------------------------------------------------------- +# CONFIGNAME is the name given to the value in the libtool script. +# VARNAME is the (base) name used in the configure script. +# VALUE may be 0, 1 or 2 for a computed quote escaped value based on +# VARNAME. Any other value will be used directly. +m4_define([_LT_DECL], +[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], + [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], + [m4_ifval([$1], [$1], [$2])]) + lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) + m4_ifval([$4], + [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) + lt_dict_add_subkey([lt_decl_dict], [$2], + [tagged?], [m4_ifval([$5], [yes], [no])])]) +]) + + +# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) +# -------------------------------------------------------- +m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) + + +# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_tag_varnames], +[_lt_decl_filter([tagged?], [yes], $@)]) + + +# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) +# --------------------------------------------------------- +m4_define([_lt_decl_filter], +[m4_case([$#], + [0], [m4_fatal([$0: too few arguments: $#])], + [1], [m4_fatal([$0: too few arguments: $#: $1])], + [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], + [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], + [lt_dict_filter([lt_decl_dict], $@)])[]dnl +]) + + +# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) +# -------------------------------------------------- +m4_define([lt_decl_quote_varnames], +[_lt_decl_filter([value], [1], $@)]) + + +# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_dquote_varnames], +[_lt_decl_filter([value], [2], $@)]) + + +# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_varnames_tagged], +[m4_assert([$# <= 2])dnl +_$0(m4_quote(m4_default([$1], [[, ]])), + m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), + m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) +m4_define([_lt_decl_varnames_tagged], +[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) + + +# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_all_varnames], +[_$0(m4_quote(m4_default([$1], [[, ]])), + m4_if([$2], [], + m4_quote(lt_decl_varnames), + m4_quote(m4_shift($@))))[]dnl +]) +m4_define([_lt_decl_all_varnames], +[lt_join($@, lt_decl_varnames_tagged([$1], + lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl +]) + + +# _LT_CONFIG_STATUS_DECLARE([VARNAME]) +# ------------------------------------ +# Quote a variable value, and forward it to 'config.status' so that its +# declaration there will have the same value as in 'configure'. VARNAME +# must have a single quote delimited value for this to work. +m4_define([_LT_CONFIG_STATUS_DECLARE], +[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) + + +# _LT_CONFIG_STATUS_DECLARATIONS +# ------------------------------ +# We delimit libtool config variables with single quotes, so when +# we write them to config.status, we have to be sure to quote all +# embedded single quotes properly. In configure, this macro expands +# each variable declared with _LT_DECL (and _LT_TAGDECL) into: +# +# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' +m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], +[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), + [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAGS +# ---------------- +# Output comment and list of tags supported by the script +m4_defun([_LT_LIBTOOL_TAGS], +[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl +available_tags='_LT_TAGS'dnl +]) + + +# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) +# ----------------------------------- +# Extract the dictionary values for VARNAME (optionally with TAG) and +# expand to a commented shell variable setting: +# +# # Some comment about what VAR is for. +# visible_name=$lt_internal_name +m4_define([_LT_LIBTOOL_DECLARE], +[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], + [description])))[]dnl +m4_pushdef([_libtool_name], + m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl +m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), + [0], [_libtool_name=[$]$1], + [1], [_libtool_name=$lt_[]$1], + [2], [_libtool_name=$lt_[]$1], + [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl +m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl +]) + + +# _LT_LIBTOOL_CONFIG_VARS +# ----------------------- +# Produce commented declarations of non-tagged libtool config variables +# suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' +# script. Tagged libtool config variables (even for the LIBTOOL CONFIG +# section) are produced by _LT_LIBTOOL_TAG_VARS. +m4_defun([_LT_LIBTOOL_CONFIG_VARS], +[m4_foreach([_lt_var], + m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAG_VARS(TAG) +# ------------------------- +m4_define([_LT_LIBTOOL_TAG_VARS], +[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) + + +# _LT_TAGVAR(VARNAME, [TAGNAME]) +# ------------------------------ +m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) + + +# _LT_CONFIG_COMMANDS +# ------------------- +# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of +# variables for single and double quote escaping we saved from calls +# to _LT_DECL, we can put quote escaped variables declarations +# into 'config.status', and then the shell code to quote escape them in +# for loops in 'config.status'. Finally, any additional code accumulated +# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. +m4_defun([_LT_CONFIG_COMMANDS], +[AC_PROVIDE_IFELSE([LT_OUTPUT], + dnl If the libtool generation code has been placed in $CONFIG_LT, + dnl instead of duplicating it all over again into config.status, + dnl then we will have config.status run $CONFIG_LT later, so it + dnl needs to know what name is stored there: + [AC_CONFIG_COMMANDS([libtool], + [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], + dnl If the libtool generation code is destined for config.status, + dnl expand the accumulated commands and init code now: + [AC_CONFIG_COMMANDS([libtool], + [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) +])#_LT_CONFIG_COMMANDS + + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], +[ + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +_LT_CONFIG_STATUS_DECLARATIONS +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$[]1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_quote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_dquote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +_LT_OUTPUT_LIBTOOL_INIT +]) + +# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) +# ------------------------------------ +# Generate a child script FILE with all initialization necessary to +# reuse the environment learned by the parent script, and make the +# file executable. If COMMENT is supplied, it is inserted after the +# '#!' sequence but before initialization text begins. After this +# macro, additional text can be appended to FILE to form the body of +# the child script. The macro ends with non-zero status if the +# file could not be fully written (such as if the disk is full). +m4_ifdef([AS_INIT_GENERATED], +[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], +[m4_defun([_LT_GENERATED_FILE_INIT], +[m4_require([AS_PREPARE])]dnl +[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl +[lt_write_fail=0 +cat >$1 <<_ASEOF || lt_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || lt_write_fail=1 +AS_SHELL_SANITIZE +_AS_PREPARE +exec AS_MESSAGE_FD>&1 +_ASEOF +test 0 = "$lt_write_fail" && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT + +# LT_OUTPUT +# --------- +# This macro allows early generation of the libtool script (before +# AC_OUTPUT is called), incase it is used in configure for compilation +# tests. +AC_DEFUN([LT_OUTPUT], +[: ${CONFIG_LT=./config.lt} +AC_MSG_NOTICE([creating $CONFIG_LT]) +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) + +cat >>"$CONFIG_LT" <<\_LTEOF +lt_cl_silent=false +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) +} >&AS_MESSAGE_LOG_FD + +lt_cl_help="\ +'$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $[0] [[OPTIONS]] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to ." + +lt_cl_version="\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by $[0], generated by m4_PACKAGE_STRING. + +Copyright (C) 2011 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test 0 != $[#] +do + case $[1] in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try '$[0] --help' for more information.]) ;; + + *) AC_MSG_ERROR([unrecognized argument: $[1] +Try '$[0] --help' for more information.]) ;; + esac + shift +done + +if $lt_cl_silent; then + exec AS_MESSAGE_FD>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF +_LT_OUTPUT_LIBTOOL_COMMANDS_INIT +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AC_MSG_NOTICE([creating $ofile]) +_LT_OUTPUT_LIBTOOL_COMMANDS +AS_EXIT(0) +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +lt_cl_success=: +test yes = "$silent" && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec AS_MESSAGE_LOG_FD>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec AS_MESSAGE_LOG_FD>>config.log +$lt_cl_success || AS_EXIT(1) +])# LT_OUTPUT + + +# _LT_CONFIG(TAG) +# --------------- +# If TAG is the built-in tag, create an initial libtool script with a +# default configuration from the untagged config vars. Otherwise add code +# to config.status for appending the configuration named by TAG from the +# matching tagged config vars. +m4_defun([_LT_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_CONFIG_SAVE_COMMANDS([ + m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl + m4_if(_LT_TAG, [C], [ + # See if we are running on zsh, and set the options that allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST + fi + + cfgfile=${ofile}T + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL +# Generated automatically by $as_me ($PACKAGE) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + +_LT_COPYING +_LT_LIBTOOL_TAGS + +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + +# ### BEGIN LIBTOOL CONFIG +_LT_LIBTOOL_CONFIG_VARS +_LT_LIBTOOL_TAG_VARS +# ### END LIBTOOL CONFIG + +_LT_EOF + + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +_LT_PREPARE_MUNGE_PATH_LIST +_LT_PREPARE_CC_BASENAME + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + _LT_PROG_LTMAIN + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + $SED '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +], +[cat <<_LT_EOF >> "$ofile" + +dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded +dnl in a comment (ie after a #). +# ### BEGIN LIBTOOL TAG CONFIG: $1 +_LT_LIBTOOL_TAG_VARS(_LT_TAG) +# ### END LIBTOOL TAG CONFIG: $1 +_LT_EOF +])dnl /m4_if +], +[m4_if([$1], [], [ + PACKAGE='$PACKAGE' + VERSION='$VERSION' + RM='$RM' + ofile='$ofile'], []) +])dnl /_LT_CONFIG_SAVE_COMMANDS +])# _LT_CONFIG + + +# LT_SUPPORTED_TAG(TAG) +# --------------------- +# Trace this macro to discover what tags are supported by the libtool +# --tag option, using: +# autoconf --trace 'LT_SUPPORTED_TAG:$1' +AC_DEFUN([LT_SUPPORTED_TAG], []) + + +# C support is built-in for now +m4_define([_LT_LANG_C_enabled], []) +m4_define([_LT_TAGS], []) + + +# LT_LANG(LANG) +# ------------- +# Enable libtool support for the given language if not already enabled. +AC_DEFUN([LT_LANG], +[AC_BEFORE([$0], [LT_OUTPUT])dnl +m4_case([$1], + [C], [_LT_LANG(C)], + [C++], [_LT_LANG(CXX)], + [Go], [_LT_LANG(GO)], + [Java], [_LT_LANG(GCJ)], + [Fortran 77], [_LT_LANG(F77)], + [Fortran], [_LT_LANG(FC)], + [Windows Resource], [_LT_LANG(RC)], + [m4_ifdef([_LT_LANG_]$1[_CONFIG], + [_LT_LANG($1)], + [m4_fatal([$0: unsupported language: "$1"])])])dnl +])# LT_LANG + + +# _LT_LANG(LANGNAME) +# ------------------ +m4_defun([_LT_LANG], +[m4_ifdef([_LT_LANG_]$1[_enabled], [], + [LT_SUPPORTED_TAG([$1])dnl + m4_append([_LT_TAGS], [$1 ])dnl + m4_define([_LT_LANG_]$1[_enabled], [])dnl + _LT_LANG_$1_CONFIG($1)])dnl +])# _LT_LANG + + +m4_ifndef([AC_PROG_GO], [ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_GO. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +m4_defun([AC_PROG_GO], +[AC_LANG_PUSH(Go)dnl +AC_ARG_VAR([GOC], [Go compiler command])dnl +AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +AC_CHECK_TOOL(GOC, gccgo) +if test -z "$GOC"; then + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) + fi +fi +if test -z "$GOC"; then + AC_CHECK_PROG(GOC, gccgo, gccgo, false) +fi +])#m4_defun +])#m4_ifndef + + +# _LT_LANG_DEFAULT_CONFIG +# ----------------------- +m4_defun([_LT_LANG_DEFAULT_CONFIG], +[AC_PROVIDE_IFELSE([AC_PROG_CXX], + [LT_LANG(CXX)], + [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) + +AC_PROVIDE_IFELSE([AC_PROG_F77], + [LT_LANG(F77)], + [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) + +AC_PROVIDE_IFELSE([AC_PROG_FC], + [LT_LANG(FC)], + [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) + +dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal +dnl pulling things in needlessly. +AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([LT_PROG_GCJ], + [LT_LANG(GCJ)], + [m4_ifdef([AC_PROG_GCJ], + [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([A][M_PROG_GCJ], + [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([LT_PROG_GCJ], + [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) + +AC_PROVIDE_IFELSE([AC_PROG_GO], + [LT_LANG(GO)], + [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) + +AC_PROVIDE_IFELSE([LT_PROG_RC], + [LT_LANG(RC)], + [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) +])# _LT_LANG_DEFAULT_CONFIG + +# Obsolete macros: +AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) +AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) +AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) +AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_CXX], []) +dnl AC_DEFUN([AC_LIBTOOL_F77], []) +dnl AC_DEFUN([AC_LIBTOOL_FC], []) +dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) +dnl AC_DEFUN([AC_LIBTOOL_RC], []) + + +# _LT_TAG_COMPILER +# ---------------- +m4_defun([_LT_TAG_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl +_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl +_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl +_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_TAG_COMPILER + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +m4_defun([_LT_COMPILER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +m4_defun([_LT_LINKER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# ------------------------- +m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + AC_CHECK_TOOL([LIPO], [lipo], [:]) + AC_CHECK_TOOL([OTOOL], [otool], [:]) + AC_CHECK_TOOL([OTOOL64], [otool64], [:]) + _LT_DECL([], [DSYMUTIL], [1], + [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) + _LT_DECL([], [NMEDIT], [1], + [Tool to change global to local symbols on Mac OS X]) + _LT_DECL([], [LIPO], [1], + [Tool to manipulate fat objects and archives on Mac OS X]) + _LT_DECL([], [OTOOL], [1], + [ldd/readelf like tool for Mach-O binaries on Mac OS X]) + _LT_DECL([], [OTOOL64], [1], + [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "$LT_MULTI_MODULE"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test 0 = "$_lt_result"; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi]) + + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS=$save_LDFLAGS + ]) + + AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], + [lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD + echo "$AR $AR_FLAGS libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR $AR_FLAGS libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD + $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + ]) + case $host_os in + rhapsody* | darwin1.[[012]]) + _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + darwin*) + case $MACOSX_DEPLOYMENT_TARGET,$host in + 10.[[012]],*|,*powerpc*-darwin[[5-8]]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + *) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test yes = "$lt_cv_apple_cc_single_mod"; then + _lt_dar_single_mod='$single_module' + fi + if test yes = "$lt_cv_ld_exported_symbols_list"; then + _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' + fi + if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac +]) + + +# _LT_DARWIN_LINKER_FEATURES([TAG]) +# --------------------------------- +# Checks for linker and compiler features on darwin +m4_defun([_LT_DARWIN_LINKER_FEATURES], +[ + m4_require([_LT_REQUIRED_DARWIN_CHECKS]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_automatic, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + if test yes = "$lt_cv_ld_force_load"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], + [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined + case $cc_basename in + ifort*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; then + output_verbose_link_cmd=func_echo_all + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + _LT_TAGVAR(module_expsym_cmds, $1)="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + m4_if([$1], [CXX], +[ if test yes != "$lt_cv_apple_cc_single_mod"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" + fi +],[]) + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi +]) + +# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) +# ---------------------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +# Store the results from the different compilers for each TAGNAME. +# Allow to override them for all tags through lt_cv_aix_libpath. +m4_defun([_LT_SYS_MODULE_PATH_AIX], +[m4_require([_LT_DECL_SED])dnl +if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ + lt_aix_libpath_sed='[ + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }]' + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi],[]) + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib + fi + ]) + aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) +fi +])# _LT_SYS_MODULE_PATH_AIX + + +# _LT_SHELL_INIT(ARG) +# ------------------- +m4_define([_LT_SHELL_INIT], +[m4_divert_text([M4SH-INIT], [$1 +])])# _LT_SHELL_INIT + + + +# _LT_PROG_ECHO_BACKSLASH +# ----------------------- +# Find how we can fake an echo command that does not interpret backslash. +# In particular, with Autoconf 2.60 or later we add some code to the start +# of the generated configure script that will find a shell with a builtin +# printf (that we can use as an echo command). +m4_defun([_LT_PROG_ECHO_BACKSLASH], +[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +AC_MSG_CHECKING([how to print strings]) +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$[]1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +case $ECHO in + printf*) AC_MSG_RESULT([printf]) ;; + print*) AC_MSG_RESULT([print -r]) ;; + *) AC_MSG_RESULT([cat]) ;; +esac + +m4_ifdef([_AS_DETECT_SUGGESTED], +[_AS_DETECT_SUGGESTED([ + test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test "X`printf %s $ECHO`" = "X$ECHO" \ + || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) + +_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) +_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) +])# _LT_PROG_ECHO_BACKSLASH + + +# _LT_WITH_SYSROOT +# ---------------- +AC_DEFUN([_LT_WITH_SYSROOT], +[m4_require([_LT_DECL_SED])dnl +AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], + [Search for dependent libraries within DIR (or the compiler's sysroot + if not specified).])], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case $with_sysroot in #( + yes) + if test yes = "$GCC"; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([$with_sysroot]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and where our libraries should be installed.])]) + +# _LT_ENABLE_LOCK +# --------------- +m4_defun([_LT_ENABLE_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AS_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test no = "$enable_libtool_lock" || enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out what ABI is being produced by ac_compile, and set mode + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `$FILECMD conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE=32 + ;; + *ELF-64*) + HPUX_IA64_MODE=64 + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test yes = "$lt_cv_prog_gnu_ld"; then + case `$FILECMD conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `$FILECMD conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +mips64*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + emul=elf + case `$FILECMD conftest.$ac_objext` in + *32-bit*) + emul="${emul}32" + ;; + *64-bit*) + emul="${emul}64" + ;; + esac + case `$FILECMD conftest.$ac_objext` in + *MSB*) + emul="${emul}btsmip" + ;; + *LSB*) + emul="${emul}ltsmip" + ;; + esac + case `$FILECMD conftest.$ac_objext` in + *N32*) + emul="${emul}n32" + ;; + esac + LD="${LD-ld} -m $emul" + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the + # situations where additional linker options are needed (such as when + # doing 32-bit compilation for a host where ld defaults to 64-bit, or + # vice versa); the common cases where no linker options are needed do + # not appear in the list. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `$FILECMD conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + case `$FILECMD conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac + ;; + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + powerpcle-*linux*|powerpc64le-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test yes != "$lt_cv_cc_needs_belf"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS=$SAVE_CFLAGS + fi + ;; +*-*solaris*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `$FILECMD conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*|x86_64-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD=${LD-ld}_sol2 + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks=$enable_libtool_lock +])# _LT_ENABLE_LOCK + + +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) +: ${AR=ar} +_LT_DECL([], [AR], [1], [The archiver]) + +# Use ARFLAGS variable as AR's operation code to sync the variable naming with +# Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have +# higher priority because thats what people were doing historically (setting +# ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS +# variable obsoleted/removed. + +test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr} +lt_ar_flags=$AR_FLAGS +_LT_DECL([], [lt_ar_flags], [0], [Flags to create an archive (by configure)]) + +# Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override +# by AR_FLAGS because that was never working and AR_FLAGS is about to die. +_LT_DECL([], [AR_FLAGS], [\@S|@{ARFLAGS-"\@S|@lt_ar_flags"}], + [Flags to create an archive]) + +AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], + [lt_cv_ar_at_file=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([lt_ar_try]) + if test 0 -eq "$ac_status"; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test 0 -ne "$ac_status"; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test no = "$lt_cv_ar_at_file"; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) +])# _LT_PROG_AR + + +# _LT_CMD_OLD_ARCHIVE +# ------------------- +m4_defun([_LT_CMD_OLD_ARCHIVE], +[_LT_PROG_AR + +AC_CHECK_TOOL(STRIP, strip, :) +test -z "$STRIP" && STRIP=: +_LT_DECL([], [STRIP], [1], [A symbol stripping program]) + +AC_CHECK_TOOL(RANLIB, ranlib, :) +test -z "$RANLIB" && RANLIB=: +_LT_DECL([], [RANLIB], [1], + [Commands used to install an old-style archive]) + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + bitrig* | openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac +_LT_DECL([], [old_postinstall_cmds], [2]) +_LT_DECL([], [old_postuninstall_cmds], [2]) +_LT_TAGDECL([], [old_archive_cmds], [2], + [Commands used to build an old-style archive]) +_LT_DECL([], [lock_old_archive_extraction], [0], + [Whether to use a lock for old archive extraction]) +])# _LT_CMD_OLD_ARCHIVE + + +# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([_LT_COMPILER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $RM conftest* +]) + +if test yes = "[$]$2"; then + m4_if([$5], , :, [$5]) +else + m4_if([$6], , :, [$6]) +fi +])# _LT_COMPILER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) + + +# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------- +# Check whether the given linker option works +AC_DEFUN([_LT_LINKER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS +]) + +if test yes = "[$]$2"; then + m4_if([$4], , :, [$4]) +else + m4_if([$5], , :, [$5]) +fi +])# _LT_LINKER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) + + +# LT_CMD_MAX_LEN +#--------------- +AC_DEFUN([LT_CMD_MAX_LEN], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring=ABCD + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | $SED 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test X`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test 17 != "$i" # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n "$lt_cv_sys_max_cmd_len"; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +max_cmd_len=$lt_cv_sys_max_cmd_len +_LT_DECL([], [max_cmd_len], [0], + [What is the maximum length of a command?]) +])# LT_CMD_MAX_LEN + +# Old name: +AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) + + +# _LT_HEADER_DLFCN +# ---------------- +m4_defun([_LT_HEADER_DLFCN], +[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl +])# _LT_HEADER_DLFCN + + +# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ---------------------------------------------------------------- +m4_defun([_LT_TRY_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test yes = "$cross_compiling"; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +[#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +}] +_LT_EOF + if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_TRY_DLOPEN_SELF + + +# LT_SYS_DLOPEN_SELF +# ------------------ +AC_DEFUN([LT_SYS_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test yes != "$enable_dlopen"; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen=load_add_on + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen=LoadLibrary + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ + lt_cv_dlopen=dyld + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + tpf*) + # Don't try to run any link tests for TPF. We know it's impossible + # because TPF is a cross-compiler, and we know how we open DSOs. + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + lt_cv_dlopen_self=no + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen=shl_load], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen=dlopen], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test no = "$lt_cv_dlopen"; then + enable_dlopen=no + else + enable_dlopen=yes + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS=$CPPFLAGS + test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS=$LDFLAGS + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS=$LIBS + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test yes = "$lt_cv_dlopen_self"; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS=$save_CPPFLAGS + LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +_LT_DECL([dlopen_support], [enable_dlopen], [0], + [Whether dlopen is supported]) +_LT_DECL([dlopen_self], [enable_dlopen_self], [0], + [Whether dlopen of programs is supported]) +_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], + [Whether dlopen of statically linked programs is supported]) +])# LT_SYS_DLOPEN_SELF + +# Old name: +AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) + + +# _LT_COMPILER_C_O([TAGNAME]) +# --------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler. +# This macro does not hard code the compiler like AC_PROG_CC_C_O. +m4_defun([_LT_COMPILER_C_O], +[m4_require([_LT_DECL_SED])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* +]) +_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], + [Does compiler simultaneously support -c and -o options?]) +])# _LT_COMPILER_C_O + + +# _LT_COMPILER_FILE_LOCKS([TAGNAME]) +# ---------------------------------- +# Check to see if we can do hard links to lock some files if needed +m4_defun([_LT_COMPILER_FILE_LOCKS], +[m4_require([_LT_ENABLE_LOCK])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_COMPILER_C_O([$1]) + +hard_links=nottested +if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test no = "$hard_links"; then + AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) +])# _LT_COMPILER_FILE_LOCKS + + +# _LT_CHECK_OBJDIR +# ---------------- +m4_defun([_LT_CHECK_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +_LT_DECL([], [objdir], [0], + [The name of the directory that contains temporary libtool files])dnl +m4_pattern_allow([LT_OBJDIR])dnl +AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", + [Define to the sub-directory where libtool stores uninstalled libraries.]) +])# _LT_CHECK_OBJDIR + + +# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) +# -------------------------------------- +# Check hardcoding attributes. +m4_defun([_LT_LINKER_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || + test -n "$_LT_TAGVAR(runpath_var, $1)" || + test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then + + # We can hardcode non-existent directories. + if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && + test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then + # Linking always hardcodes the temporary library directory. + _LT_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) + +if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || + test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi +_LT_TAGDECL([], [hardcode_action], [0], + [How to hardcode a shared library path into an executable]) +])# _LT_LINKER_HARDCODE_LIBPATH + + +# _LT_CMD_STRIPLIB +# ---------------- +m4_defun([_LT_CMD_STRIPLIB], +[m4_require([_LT_DECL_EGREP]) +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -z "$STRIP"; then + AC_MSG_RESULT([no]) +else + if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + old_striplib="$STRIP --strip-debug" + striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) + else + case $host_os in + darwin*) + # FIXME - insert some real tests, host_os isn't really good enough + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + ;; + freebsd*) + if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then + old_striplib="$STRIP --strip-debug" + striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac + fi +fi +_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) +_LT_DECL([], [striplib], [1]) +])# _LT_CMD_STRIPLIB + + +# _LT_PREPARE_MUNGE_PATH_LIST +# --------------------------- +# Make sure func_munge_path_list() is defined correctly. +m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], +[[# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x@S|@2 in + x) + ;; + *:) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" + ;; + x:*) + eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" + ;; + *) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + esac +} +]])# _LT_PREPARE_PATH_LIST + + +# _LT_SYS_DYNAMIC_LINKER([TAG]) +# ----------------------------- +# PORTME Fill in your ld.so characteristics +m4_defun([_LT_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_OBJDUMP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +m4_if([$1], + [], [ +if test yes = "$GCC"; then + case $host_os in + darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; + *) lt_awk_arg='/^libraries:/' ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; + *) lt_sed_strip_eq='s|=/|/|g' ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary... + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + # ...but if some path component already ends with the multilib dir we assume + # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). + case "$lt_multi_os_dir; $lt_search_path_spec " in + "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) + lt_multi_os_dir= + ;; + esac + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" + elif test -n "$lt_multi_os_dir"; then + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS = " "; FS = "/|\n";} { + lt_foo = ""; + lt_count = 0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo = "/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=.so +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +AC_ARG_VAR([LT_SYS_LIBRARY_PATH], +[User-defined run-time library search path.]) + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='$libname$release$shared_ext$major' + ;; + +aix[[4-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test ia64 = "$host_cpu"; then + # AIX 5 supports IA64 + library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line '#! .'. This would cause the generated library to + # depend on '.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a[(]lib.so.V[)]' + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='$libname$shared_ext' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl* | *,icl*) + # Native MSVC or ICC + libname_spec='$name' + soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec=$LIB + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC and ICC wrapper + library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$versuffix$shared_ext $libname$release$major$shared_ext $libname$shared_ext' + soname_spec='$libname$release$major$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly* | midnightbsd*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[23]].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + # Handle Gentoo/FreeBSD as it was Linux + case $host_vendor in + gentoo) + version_type=linux ;; + *) + version_type=freebsd-$objformat ;; + esac + + case $version_type in + freebsd-elf*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + need_version=yes + ;; + linux) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + need_lib_prefix=no + need_version=no + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + if test 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[[3-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test yes = "$lt_cv_prog_gnu_ld"; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" + sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], + [lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [lt_cv_shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + ]) + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test yes = "$with_gnu_ld"; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec; then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' + soname_spec='$libname$shared_ext.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=sco + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test yes = "$with_gnu_ld"; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + +_LT_DECL([], [variables_saved_for_relink], [1], + [Variables whose values should be saved in libtool wrapper scripts and + restored at link time]) +_LT_DECL([], [need_lib_prefix], [0], + [Do we need the "lib" prefix for modules?]) +_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) +_LT_DECL([], [version_type], [0], [Library versioning type]) +_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) +_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) +_LT_DECL([], [shlibpath_overrides_runpath], [0], + [Is shlibpath searched before the hard-coded library search path?]) +_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) +_LT_DECL([], [library_names_spec], [1], + [[List of archive names. First name is the real one, the rest are links. + The last name is the one that the linker finds with -lNAME]]) +_LT_DECL([], [soname_spec], [1], + [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [install_override_mode], [1], + [Permission mode override for installation of shared libraries]) +_LT_DECL([], [postinstall_cmds], [2], + [Command to use after installation of a shared archive]) +_LT_DECL([], [postuninstall_cmds], [2], + [Command to use after uninstallation of a shared archive]) +_LT_DECL([], [finish_cmds], [2], + [Commands used to finish a libtool library installation in a directory]) +_LT_DECL([], [finish_eval], [1], + [[As "finish_cmds", except a single script fragment to be evaled but + not shown]]) +_LT_DECL([], [hardcode_into_libs], [0], + [Whether we should hardcode library paths into libraries]) +_LT_DECL([], [sys_lib_search_path_spec], [2], + [Compile-time system search path for libraries]) +_LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], + [Detected run-time system search path for libraries]) +_LT_DECL([], [configure_time_lt_sys_library_path], [2], + [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) +])# _LT_SYS_DYNAMIC_LINKER + + +# _LT_PATH_TOOL_PREFIX(TOOL) +# -------------------------- +# find a file program that can recognize shared library +AC_DEFUN([_LT_PATH_TOOL_PREFIX], +[m4_require([_LT_DECL_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="m4_if([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$1"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac]) +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +_LT_DECL([], [MAGIC_CMD], [0], + [Used to examine libraries when file_magic_cmd begins with "file"])dnl +])# _LT_PATH_TOOL_PREFIX + +# Old name: +AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) + + +# _LT_PATH_MAGIC +# -------------- +# find a file program that can recognize a shared library +m4_defun([_LT_PATH_MAGIC], +[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# _LT_PATH_MAGIC + + +# LT_PATH_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([LT_PATH_LD], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PROG_ECHO_BACKSLASH])dnl + +AC_ARG_WITH([gnu-ld], + [AS_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test no = "$withval" || with_gnu_ld=yes], + [with_gnu_ld=no])dnl + +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return, which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD=$ac_prog + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test yes = "$with_gnu_ld"; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i +cat conftest.i conftest.i >conftest2.i +: ${lt_DD:=$DD} +AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], +[if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: +fi]) +rm -f conftest.i conftest2.i conftest.out]) +])# _LT_PATH_DD + + +# _LT_CMD_TRUNCATE +# ---------------- +# find command to truncate a binary pipe +m4_defun([_LT_CMD_TRUNCATE], +[m4_require([_LT_PATH_DD]) +AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], +[printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +lt_cv_truncate_bin= +if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" +fi +rm -f conftest.i conftest2.i conftest.out +test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) +_LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], + [Command to truncate a binary pipe]) +])# _LT_CMD_TRUNCATE + + +# _LT_CHECK_MAGIC_METHOD +# ---------------------- +# how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_MAGIC_METHOD], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +AC_CACHE_CHECK([how to recognize dependent libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# 'unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# that responds to the $file_magic_cmd with a given extended regex. +# If you have 'file' or equivalent on your system and you're not sure +# whether 'pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[[4-9]]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[[45]]*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='$FILECMD -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly* | midnightbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=$FILECMD + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=$FILECMD + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=$FILECMD + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd* | bitrig*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +os2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +_LT_DECL([], [deplibs_check_method], [1], + [Method to check whether dependent libraries are shared objects]) +_LT_DECL([], [file_magic_cmd], [1], + [Command to use when deplibs_check_method = "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method = "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) +])# _LT_CHECK_MAGIC_METHOD + + +# LT_PATH_NM +# ---------- +# find the pathname to a BSD- or MS-compatible name lister +AC_DEFUN([LT_PATH_NM], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM=$NM +else + lt_nm_to_check=${ac_tool_prefix}nm + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/$lt_tmp_nm + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the 'sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty + case $build_os in + mingw*) lt_bad_file=conftest.nm/nofile ;; + *) lt_bad_file=/dev/null ;; + esac + case `"$tmp_nm" -B $lt_bad_file 2>&1 | $SED '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break 2 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | $SED '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break 2 + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS=$lt_save_ifs + done + : ${lt_cv_path_NM=no} +fi]) +if test no != "$lt_cv_path_NM"; then + NM=$lt_cv_path_NM +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | $SED '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols -headers" + ;; + *) + DUMPBIN=: + ;; + esac + fi + AC_SUBST([DUMPBIN]) + if test : != "$DUMPBIN"; then + NM=$DUMPBIN + fi +fi +test -z "$NM" && NM=nm +AC_SUBST([NM]) +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl + +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], + [lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) + cat conftest.out >&AS_MESSAGE_LOG_FD + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest*]) +])# LT_PATH_NM + +# Old names: +AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) +AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_PROG_NM], []) +dnl AC_DEFUN([AC_PROG_NM], []) + +# _LT_CHECK_SHAREDLIB_FROM_LINKLIB +# -------------------------------- +# how to determine the name of the shared library +# associated with a specific link library. +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +m4_require([_LT_DECL_DLLTOOL]) +AC_CACHE_CHECK([how to associate runtime and link libraries], +lt_cv_sharedlib_from_linklib_cmd, +[lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh; + # decide which one to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd=$ECHO + ;; +esac +]) +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + +_LT_DECL([], [sharedlib_from_linklib_cmd], [1], + [Command to associate shared and link libraries]) +])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB + + +# _LT_PATH_MANIFEST_TOOL +# ---------------------- +# locate the manifest tool +m4_defun([_LT_PATH_MANIFEST_TOOL], +[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], + [lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&AS_MESSAGE_LOG_FD + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest*]) +if test yes != "$lt_cv_path_mainfest_tool"; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + + +# _LT_DLL_DEF_P([FILE]) +# --------------------- +# True iff FILE is a Windows DLL '.def' file. +# Keep in sync with func_dll_def_p in the libtool script +AC_DEFUN([_LT_DLL_DEF_P], +[dnl + test DEF = "`$SED -n dnl + -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace + -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments + -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl + -e q dnl Only consider the first "real" line + $1`" dnl +])# _LT_DLL_DEF_P + + +# LT_LIB_M +# -------- +# check for math library +AC_DEFUN([LT_LIB_M], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM=-lm) + ;; +esac +AC_SUBST([LIBM]) +])# LT_LIB_M + +# Old name: +AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_CHECK_LIBM], []) + + +# _LT_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------- +m4_defun([_LT_COMPILER_NO_RTTI], +[m4_require([_LT_TAG_COMPILER])dnl + +_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test yes = "$GCC"; then + case $cc_basename in + nvcc*) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; + *) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; + esac + + _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], + [Compiler flag to turn off builtin functions]) +])# _LT_COMPILER_NO_RTTI + + +# _LT_CMD_GLOBAL_SYMBOLS +# ---------------------- +m4_defun([_LT_CMD_GLOBAL_SYMBOLS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([LT_PATH_NM])dnl +AC_REQUIRE([LT_PATH_LD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_TAG_COMPILER])dnl + +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) + if test ia64 = "$host_cpu"; then + symcode='[[ABCDEGRST]]' + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Gets list of data symbols to import. + lt_cv_sys_global_symbol_to_import="$SED -n -e 's/^I .* \(.*\)$/\1/p'" + # Adjust the below global symbol transforms to fixup imported variables. + lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" + lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" + lt_c_name_lib_hook="\ + -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ + -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" +else + # Disable hooks by default. + lt_cv_sys_global_symbol_to_import= + lt_cdecl_hook= + lt_c_name_hook= + lt_c_name_lib_hook= +fi + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="$SED -n"\ +$lt_cdecl_hook\ +" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="$SED -n"\ +$lt_c_name_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" + +# Transform an extracted symbol line into symbol name with lib prefix and +# symbol address. +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="$SED -n"\ +$lt_c_name_lib_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function, + # D for any global variable and I for any imported variable. + # Also find C++ and __fastcall symbols from MSVC++ or ICC, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK ['"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ +" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ +" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ +" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ +" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx]" + else + lt_cv_sys_global_symbol_pipe="$SED -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | $SED '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT@&t@_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT@&t@_DLSYM_CONST +#else +# define LT@&t@_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT@&t@_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[[]] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS=conftstm.$ac_objext + CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test yes = "$pipe_works"; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + +_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], + [Take the output of nm and produce a listing of raw symbols and C names]) +_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], + [Transform the output of nm in a proper C declaration]) +_LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], + [Transform the output of nm into a list of symbols to manually relocate]) +_LT_DECL([global_symbol_to_c_name_address], + [lt_cv_sys_global_symbol_to_c_name_address], [1], + [Transform the output of nm in a C name address pair]) +_LT_DECL([global_symbol_to_c_name_address_lib_prefix], + [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], + [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([nm_interface], [lt_cv_nm_interface], [1], + [The name lister interface]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) +]) # _LT_CMD_GLOBAL_SYMBOLS + + +# _LT_COMPILER_PIC([TAGNAME]) +# --------------------------- +m4_defun([_LT_COMPILER_PIC], +[m4_require([_LT_TAG_COMPILER])dnl +_LT_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_TAGVAR(lt_prog_compiler_static, $1)= + +m4_if([$1], [CXX], [ + # C++ specific cases for pic, static, wl, etc. + if test yes = "$GXX"; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly* | midnightbsd*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + if test ia64 != "$host_cpu"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64, which still supported -KPIC. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test yes = "$GCC"; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' + if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + + hpux9* | hpux10* | hpux11*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + # old Intel for x86_64, which still supported -KPIC. + ecc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' + _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' + ;; + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + *Sun\ F* | *Sun*Fortran*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Intel*\ [[CF]]*Compiler*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + *Portland\ Group*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +case $host_os in + # For platforms that do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +AC_CACHE_CHECK([for $compiler option to produce PIC], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], + [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], + [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], + [Additional compiler flags for building library objects]) + +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) +# +# Check to make sure the static flag actually works. +# +wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" +_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) +_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], + [Compiler flag to prevent dynamic linking]) +])# _LT_COMPILER_PIC + + +# _LT_LINKER_SHLIBS([TAGNAME]) +# ---------------------------- +# See if the linker supports building shared libraries. +m4_defun([_LT_LINKER_SHLIBS], +[AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +m4_if([$1], [CXX], [ + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl* | icl*) + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + ;; + esac + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +], [ + runpath_var= + _LT_TAGVAR(allow_undefined_flag, $1)= + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(archive_cmds, $1)= + _LT_TAGVAR(archive_expsym_cmds, $1)= + _LT_TAGVAR(compiler_needs_object, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(hardcode_automatic, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_separator, $1)= + _LT_TAGVAR(hardcode_minus_L, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(inherit_rpath, $1)=no + _LT_TAGVAR(link_all_deplibs, $1)=unknown + _LT_TAGVAR(module_cmds, $1)= + _LT_TAGVAR(module_expsym_cmds, $1)= + _LT_TAGVAR(old_archive_from_new_cmds, $1)= + _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_TAGVAR(thread_safe_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ' (' and ')$', so one must not match beginning or + # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', + # as well as any symbol that contains 'd'. + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++ or Intel C++ Compiler. + if test yes != "$GCC"; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) + with_gnu_ld=yes + ;; + openbsd* | bitrig*) + with_gnu_ld=no + ;; + esac + + _LT_TAGVAR(ld_shlibs, $1)=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test yes = "$with_gnu_ld"; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; + *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test yes = "$lt_use_gnu_ld_interface"; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='$wl' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v | $SED -e 's/([[^)]]\+)\s\+//' 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test ia64 != "$host_cpu"; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test linux-dietlibc = "$host_os"; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test no = "$tmp_diet" + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + _LT_TAGVAR(whole_archive_flag_spec, $1)= + tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; + xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + ;; + esac + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + tcc*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' + ;; + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then + runpath_var= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + aix_use_runtimelinking=yes + break + fi + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + ;; + esac + + if test yes = "$GCC"; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + bsdi[[45]]*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++ or Intel C++ Compiler. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl* | icl*) + # Native MSVC or ICC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC and ICC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac + ;; + + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly* | midnightbsd*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + ;; + + hpux10*) + if test yes,no = "$GCC,$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test yes,no = "$GCC,$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + m4_if($1, [], [ + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + _LT_LINKER_OPTION([if $CC understands -b], + _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) + ;; + esac + fi + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], + [lt_cv_irix_exported_symbol], + [save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], + [C++], [[int foo (void) { return 0; }]], + [Fortran 77], [[ + subroutine foo + end]], + [Fortran], [[ + subroutine foo + end]])])], + [lt_cv_irix_exported_symbol=yes], + [lt_cv_irix_exported_symbol=no]) + LDFLAGS=$save_LDFLAGS]) + if test yes = "$lt_cv_irix_exported_symbol"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' + fi + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + _LT_TAGVAR(ld_shlibs, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *nto* | *qnx*) + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + fi + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + ;; + + osf3*) + if test yes = "$GCC"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test yes = "$GCC"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' + if test yes = "$GCC"; then + wlarc='$wl' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='$wl' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. GCC discards it without '$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test yes = "$GCC"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test sequent = "$host_vendor"; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + if test sni = "$host_vendor"; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' + ;; + esac + fi + fi +]) +AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) +test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no + +_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld + +_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl +_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl +_LT_DECL([], [extract_expsyms_cmds], [2], + [The commands to extract the exported symbol list from a shared archive]) + +# +# Do we need to explicitly link libc? +# +case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test yes,yes = "$GCC,$enable_shared"; then + case $_LT_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_CACHE_CHECK([whether -lc should be explicitly linked in], + [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), + [$RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + ]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) + ;; + esac + fi + ;; +esac + +_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], + [Whether or not to add -lc for building shared libraries]) +_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], + [enable_shared_with_static_runtimes], [0], + [Whether or not to disallow shared libs when runtime libs are static]) +_LT_TAGDECL([], [export_dynamic_flag_spec], [1], + [Compiler flag to allow reflexive dlopens]) +_LT_TAGDECL([], [whole_archive_flag_spec], [1], + [Compiler flag to generate shared objects directly from archives]) +_LT_TAGDECL([], [compiler_needs_object], [1], + [Whether the compiler copes with passing no objects directly]) +_LT_TAGDECL([], [old_archive_from_new_cmds], [2], + [Create an old-style archive from a shared archive]) +_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], + [Create a temporary old-style archive to link instead of a shared archive]) +_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) +_LT_TAGDECL([], [archive_expsym_cmds], [2]) +_LT_TAGDECL([], [module_cmds], [2], + [Commands used to build a loadable module if different from building + a shared archive.]) +_LT_TAGDECL([], [module_expsym_cmds], [2]) +_LT_TAGDECL([], [with_gnu_ld], [1], + [Whether we are building with GNU ld or not]) +_LT_TAGDECL([], [allow_undefined_flag], [1], + [Flag that allows shared libraries with undefined symbols to be built]) +_LT_TAGDECL([], [no_undefined_flag], [1], + [Flag that enforces no undefined symbols]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], + [Flag to hardcode $libdir into a binary during linking. + This must work even if $libdir does not exist]) +_LT_TAGDECL([], [hardcode_libdir_separator], [1], + [Whether we need a single "-rpath" flag with a separated argument]) +_LT_TAGDECL([], [hardcode_direct], [0], + [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes + DIR into the resulting binary]) +_LT_TAGDECL([], [hardcode_direct_absolute], [0], + [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes + DIR into the resulting binary and the resulting library dependency is + "absolute", i.e impossible to change by setting $shlibpath_var if the + library is relocated]) +_LT_TAGDECL([], [hardcode_minus_L], [0], + [Set to "yes" if using the -LDIR flag during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_shlibpath_var], [0], + [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_automatic], [0], + [Set to "yes" if building a shared library automatically hardcodes DIR + into the library and all subsequent libraries and executables linked + against it]) +_LT_TAGDECL([], [inherit_rpath], [0], + [Set to yes if linker adds runtime paths of dependent libraries + to runtime path list]) +_LT_TAGDECL([], [link_all_deplibs], [0], + [Whether libtool must link a program against all its dependency libraries]) +_LT_TAGDECL([], [always_export_symbols], [0], + [Set to "yes" if exported symbols are required]) +_LT_TAGDECL([], [export_symbols_cmds], [2], + [The commands to list exported symbols]) +_LT_TAGDECL([], [exclude_expsyms], [1], + [Symbols that should not be listed in the preloaded symbols]) +_LT_TAGDECL([], [include_expsyms], [1], + [Symbols that must always be exported]) +_LT_TAGDECL([], [prelink_cmds], [2], + [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) +_LT_TAGDECL([], [file_list_spec], [1], + [Specify filename containing input files]) +dnl FIXME: Not yet implemented +dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], +dnl [Compiler flag to generate thread safe objects]) +])# _LT_LINKER_SHLIBS + + +# _LT_LANG_C_CONFIG([TAG]) +# ------------------------ +# Ensure that the configuration variables for a C compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_C_CONFIG], +[m4_require([_LT_DECL_EGREP])dnl +lt_save_CC=$CC +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_TAG_COMPILER +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + LT_SYS_DLOPEN_SELF + _LT_CMD_STRIPLIB + + # Report what library types will actually be built + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_CONFIG($1) +fi +AC_LANG_POP +CC=$lt_save_CC +])# _LT_LANG_C_CONFIG + + +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +if test -n "$CXX" && ( test no != "$CXX" && + ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || + (test g++ != "$CXX"))); then + AC_PROG_CXXCPP +else + _lt_caught_CXX_error=yes +fi + +AC_LANG_PUSH(C++) +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(compiler_needs_object, $1)=no +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_caught_CXX_error"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test yes = "$GXX"; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + else + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + fi + + if test yes = "$GXX"; then + # Set up default GNU C++ configuration + + LT_PATH_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test yes = "$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='$wl' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) + _LT_TAGVAR(ld_shlibs, $1)=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + ;; + esac + + if test yes = "$GXX"; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag=$shared_flag' $wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + # The "-G" linker flag allows undefined symbols. + _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' + # Determine the default libpath from the value encoded in an empty + # executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared + # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl* | ,icl* | no,icl*) + # Native MSVC or ICC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + freebsd-elf*) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + + freebsd* | dragonfly* | midnightbsd*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + hpux9*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' + fi + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) + _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + case $host in + osf3*) + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + ;; + *) + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ + $RM $lib.exp' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes,no = "$GXX,$with_gnu_ld"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + case $host in + osf3*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test yes,no = "$GXX,$with_gnu_ld"; then + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require '-G' NOT '-shared' on this + # platform. + _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + fi + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ + '"$_LT_TAGVAR(old_archive_cmds, $1)" + _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ + '"$_LT_TAGVAR(reload_cmds, $1)" + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) + test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no + + _LT_TAGVAR(GCC, $1)=$GXX + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test yes != "$_lt_caught_CXX_error" + +AC_LANG_POP +])# _LT_LANG_CXX_CONFIG + + +# _LT_FUNC_STRIPNAME_CNF +# ---------------------- +# func_stripname_cnf prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# +# This function is identical to the (non-XSI) version of func_stripname, +# except this one can be used by m4 code that may be executed by configure, +# rather than the libtool script. +m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl +AC_REQUIRE([_LT_DECL_SED]) +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) +func_stripname_cnf () +{ + case @S|@2 in + .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; + *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; + esac +} # func_stripname_cnf +])# _LT_FUNC_STRIPNAME_CNF + + +# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) +# --------------------------------- +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +m4_defun([_LT_SYS_HIDDEN_LIBDEPS], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl +# Dependencies to place before and after the object being linked: +_LT_TAGVAR(predep_objects, $1)= +_LT_TAGVAR(postdep_objects, $1)= +_LT_TAGVAR(predeps, $1)= +_LT_TAGVAR(postdeps, $1)= +_LT_TAGVAR(compiler_lib_search_path, $1)= + +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF +int a; +void foo (void) { a = 0; } +_LT_EOF +], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF +], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +_LT_EOF +], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer a + a=0 + return + end +_LT_EOF +], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +_LT_EOF +], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF +package foo +func foo() { +} +_LT_EOF +]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case $prev$p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test x-L = "$p" || + test x-R = "$p"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test no = "$pre_test_object_deps_done"; then + case $prev in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p + else + _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_TAGVAR(postdeps, $1)"; then + _LT_TAGVAR(postdeps, $1)=$prev$p + else + _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test no = "$pre_test_object_deps_done"; then + if test -z "$_LT_TAGVAR(predep_objects, $1)"; then + _LT_TAGVAR(predep_objects, $1)=$p + else + _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then + _LT_TAGVAR(postdep_objects, $1)=$p + else + _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +m4_if([$1], [CXX], +[case $host_os in +interix[[3-9]]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_TAGVAR(predep_objects,$1)= + _LT_TAGVAR(postdep_objects,$1)= + _LT_TAGVAR(postdeps,$1)= + ;; +esac +]) + +case " $_LT_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac + _LT_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then + _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` +fi +_LT_TAGDECL([], [compiler_lib_search_dirs], [1], + [The directories searched by this compiler when creating a shared library]) +_LT_TAGDECL([], [predep_objects], [1], + [Dependencies to place before and after the objects being linked to + create a shared library]) +_LT_TAGDECL([], [postdep_objects], [1]) +_LT_TAGDECL([], [predeps], [1]) +_LT_TAGDECL([], [postdeps], [1]) +_LT_TAGDECL([], [compiler_lib_search_path], [1], + [The library search path used internally by the compiler when linking + a shared library]) +])# _LT_SYS_HIDDEN_LIBDEPS + + +# _LT_LANG_F77_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a Fortran 77 compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_F77_CONFIG], +[AC_LANG_PUSH(Fortran 77) +if test -z "$F77" || test no = "$F77"; then + _lt_disable_F77=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the F77 compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_disable_F77"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${F77-"f77"} + CFLAGS=$FFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + GCC=$G77 + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)=$G77 + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test yes != "$_lt_disable_F77" + +AC_LANG_POP +])# _LT_LANG_F77_CONFIG + + +# _LT_LANG_FC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for a Fortran compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_FC_CONFIG], +[AC_LANG_PUSH(Fortran) + +if test -z "$FC" || test no = "$FC"; then + _lt_disable_FC=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for fc test sources. +ac_ext=${ac_fc_srcext-f} + +# Object file extension for compiled fc test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the FC compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_disable_FC"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${FC-"f95"} + CFLAGS=$FCFLAGS + compiler=$CC + GCC=$ac_cv_fc_compiler_gnu + + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test yes != "$_lt_disable_FC" + +AC_LANG_POP +])# _LT_LANG_FC_CONFIG + + +# _LT_LANG_GCJ_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Java Compiler compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_GCJ_CONFIG], +[AC_REQUIRE([LT_PROG_GCJ])dnl +AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GCJ-"gcj"} +CFLAGS=$GCJFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)=$LD +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GCJ_CONFIG + + +# _LT_LANG_GO_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Go compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_GO_CONFIG], +[AC_REQUIRE([LT_PROG_GO])dnl +AC_LANG_SAVE + +# Source file extension for Go test sources. +ac_ext=go + +# Object file extension for compiled Go test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="package main; func main() { }" + +# Code to be used in simple link tests +lt_simple_link_test_code='package main; func main() { }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GOC-"gccgo"} +CFLAGS=$GOFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)=$LD +_LT_CC_BASENAME([$compiler]) + +# Go did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GO_CONFIG + + +# _LT_LANG_RC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for the Windows resource compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_RC_CONFIG], +[AC_REQUIRE([LT_PROG_RC])dnl +AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code=$lt_simple_compile_test_code + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC= +CC=${RC-"windres"} +CFLAGS= +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +if test -n "$compiler"; then + : + _LT_CONFIG($1) +fi + +GCC=$lt_save_GCC +AC_LANG_RESTORE +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_RC_CONFIG + + +# LT_PROG_GCJ +# ----------- +AC_DEFUN([LT_PROG_GCJ], +[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], + [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], + [AC_CHECK_TOOL(GCJ, gcj,) + test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS)])])[]dnl +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_GCJ], []) + + +# LT_PROG_GO +# ---------- +AC_DEFUN([LT_PROG_GO], +[AC_CHECK_TOOL(GOC, gccgo,) +]) + + +# LT_PROG_RC +# ---------- +AC_DEFUN([LT_PROG_RC], +[AC_CHECK_TOOL(RC, windres,) +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_RC], []) + + +# _LT_DECL_EGREP +# -------------- +# If we don't have a new enough Autoconf to choose the best grep +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_EGREP], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([AC_PROG_FGREP])dnl +test -z "$GREP" && GREP=grep +_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) +_LT_DECL([], [EGREP], [1], [An ERE matcher]) +_LT_DECL([], [FGREP], [1], [A literal string matcher]) +dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too +AC_SUBST([GREP]) +]) + + +# _LT_DECL_OBJDUMP +# -------------- +# If we don't have a new enough Autoconf to choose the best objdump +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_OBJDUMP], +[AC_CHECK_TOOL(OBJDUMP, objdump, false) +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) +AC_SUBST([OBJDUMP]) +]) + +# _LT_DECL_DLLTOOL +# ---------------- +# Ensure DLLTOOL variable is set. +m4_defun([_LT_DECL_DLLTOOL], +[AC_CHECK_TOOL(DLLTOOL, dlltool, false) +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) +AC_SUBST([DLLTOOL]) +]) + +# _LT_DECL_FILECMD +# ---------------- +# Check for a file(cmd) program that can be used to detect file type and magic +m4_defun([_LT_DECL_FILECMD], +[AC_CHECK_TOOL([FILECMD], [file], [:]) +_LT_DECL([], [FILECMD], [1], [A file(cmd) program that detects file types]) +])# _LD_DECL_FILECMD + +# _LT_DECL_SED +# ------------ +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +m4_defun([_LT_DECL_SED], +[AC_PROG_SED +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" +_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) +_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], + [Sed that helps us avoid accidentally triggering echo(1) options like -n]) +])# _LT_DECL_SED + +m4_ifndef([AC_PROG_SED], [ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # + +m4_defun([AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f "$lt_ac_sed" && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test 10 -lt "$lt_ac_count" && break + lt_ac_count=`expr $lt_ac_count + 1` + if test "$lt_ac_count" -gt "$lt_ac_max"; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +])#AC_PROG_SED +])#m4_ifndef + +# Old name: +AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_SED], []) + + +# _LT_CHECK_SHELL_FEATURES +# ------------------------ +# Find out whether the shell is Bourne or XSI compatible, +# or has some other useful features. +m4_defun([_LT_CHECK_SHELL_FEATURES], +[if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi +_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac +_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl +_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl +])# _LT_CHECK_SHELL_FEATURES + + +# _LT_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine what file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac +]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS + +# Helper functions for option handling. -*- Autoconf -*- +# +# Copyright (C) 2004-2005, 2007-2009, 2011-2019, 2021-2022 Free +# Software Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 8 ltoptions.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) + + +# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) +# ------------------------------------------ +m4_define([_LT_MANGLE_OPTION], +[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) + + +# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) +# --------------------------------------- +# Set option OPTION-NAME for macro MACRO-NAME, and if there is a +# matching handler defined, dispatch to it. Other OPTION-NAMEs are +# saved as a flag. +m4_define([_LT_SET_OPTION], +[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl +m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), + _LT_MANGLE_DEFUN([$1], [$2]), + [m4_warning([Unknown $1 option '$2'])])[]dnl +]) + + +# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) +# ------------------------------------------------------------ +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +m4_define([_LT_IF_OPTION], +[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) + + +# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) +# ------------------------------------------------------- +# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME +# are set. +m4_define([_LT_UNLESS_OPTIONS], +[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), + [m4_define([$0_found])])])[]dnl +m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 +])[]dnl +]) + + +# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) +# ---------------------------------------- +# OPTION-LIST is a space-separated list of Libtool options associated +# with MACRO-NAME. If any OPTION has a matching handler declared with +# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about +# the unknown option and exit. +m4_defun([_LT_SET_OPTIONS], +[# Set options +m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [_LT_SET_OPTION([$1], _LT_Option)]) + +m4_if([$1],[LT_INIT],[ + dnl + dnl Simply set some default values (i.e off) if boolean options were not + dnl specified: + _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no + ]) + _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no + ]) + dnl + dnl If no reference was made to various pairs of opposing options, then + dnl we run the default mode handler for the pair. For example, if neither + dnl 'shared' nor 'disable-shared' was passed, we enable building of shared + dnl archives by default: + _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) + _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], + [_LT_ENABLE_FAST_INSTALL]) + _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], + [_LT_WITH_AIX_SONAME([aix])]) + ]) +])# _LT_SET_OPTIONS + + + +# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) +# ----------------------------------------- +m4_define([_LT_MANGLE_DEFUN], +[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) + + +# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) +# ----------------------------------------------- +m4_define([LT_OPTION_DEFINE], +[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl +])# LT_OPTION_DEFINE + + +# dlopen +# ------ +LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes +]) + +AU_DEFUN([AC_LIBTOOL_DLOPEN], +[_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'dlopen' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) + + +# win32-dll +# --------- +# Declare package support for building win32 dll's. +LT_OPTION_DEFINE([LT_INIT], [win32-dll], +[enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +esac + +test -z "$AS" && AS=as +_LT_DECL([], [AS], [1], [Assembler program])dnl + +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl + +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl +])# win32-dll + +AU_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'win32-dll' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) + + +# _LT_ENABLE_SHARED([DEFAULT]) +# ---------------------------- +# implement the --enable-shared flag, and supports the 'shared' and +# 'disable-shared' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_SHARED], +[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) + + _LT_DECL([build_libtool_libs], [enable_shared], [0], + [Whether or not to build shared libraries]) +])# _LT_ENABLE_SHARED + +LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) +]) + +AC_DEFUN([AC_DISABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], [disable-shared]) +]) + +AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_SHARED], []) +dnl AC_DEFUN([AM_DISABLE_SHARED], []) + + + +# _LT_ENABLE_STATIC([DEFAULT]) +# ---------------------------- +# implement the --enable-static flag, and support the 'static' and +# 'disable-static' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_STATIC], +[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_static=]_LT_ENABLE_STATIC_DEFAULT) + + _LT_DECL([build_old_libs], [enable_static], [0], + [Whether or not to build static libraries]) +])# _LT_ENABLE_STATIC + +LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) +]) + +AC_DEFUN([AC_DISABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], [disable-static]) +]) + +AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_STATIC], []) +dnl AC_DEFUN([AM_DISABLE_STATIC], []) + + + +# _LT_ENABLE_FAST_INSTALL([DEFAULT]) +# ---------------------------------- +# implement the --enable-fast-install flag, and support the 'fast-install' +# and 'disable-fast-install' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_FAST_INSTALL], +[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([fast-install], + [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) + +_LT_DECL([fast_install], [enable_fast_install], [0], + [Whether or not to optimize for fast installation])dnl +])# _LT_ENABLE_FAST_INSTALL + +LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) + +# Old names: +AU_DEFUN([AC_ENABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the 'fast-install' option into LT_INIT's first parameter.]) +]) + +AU_DEFUN([AC_DISABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the 'disable-fast-install' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) +dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) + + +# _LT_WITH_AIX_SONAME([DEFAULT]) +# ---------------------------------- +# implement the --with-aix-soname flag, and support the `aix-soname=aix' +# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT +# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. +m4_define([_LT_WITH_AIX_SONAME], +[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl +shared_archive_member_spec= +case $host,$enable_shared in +power*-*-aix[[5-9]]*,yes) + AC_MSG_CHECKING([which variant of shared library versioning to provide]) + AC_ARG_WITH([aix-soname], + [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], + [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], + [case $withval in + aix|svr4|both) + ;; + *) + AC_MSG_ERROR([Unknown argument to --with-aix-soname]) + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname], + [AC_CACHE_VAL([lt_cv_with_aix_soname], + [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) + with_aix_soname=$lt_cv_with_aix_soname]) + AC_MSG_RESULT([$with_aix_soname]) + if test aix != "$with_aix_soname"; then + # For the AIX way of multilib, we name the shared archive member + # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', + # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. + # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, + # the AIX toolchain works better with OBJECT_MODE set (default 32). + if test 64 = "${OBJECT_MODE-32}"; then + shared_archive_member_spec=shr_64 + else + shared_archive_member_spec=shr + fi + fi + ;; +*) + with_aix_soname=aix + ;; +esac + +_LT_DECL([], [shared_archive_member_spec], [0], + [Shared archive member basename, for filename based shared library versioning on AIX])dnl +])# _LT_WITH_AIX_SONAME + +LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) +LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) +LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) + + +# _LT_WITH_PIC([MODE]) +# -------------------- +# implement the --with-pic flag, and support the 'pic-only' and 'no-pic' +# LT_INIT options. +# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. +m4_define([_LT_WITH_PIC], +[AC_ARG_WITH([pic], + [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for lt_pkg in $withval; do + IFS=$lt_save_ifs + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [pic_mode=m4_default([$1], [default])]) + +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl +])# _LT_WITH_PIC + +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) + +# Old name: +AU_DEFUN([AC_LIBTOOL_PICMODE], +[_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'pic-only' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) + + +m4_define([_LTDL_MODE], []) +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], + [m4_define([_LTDL_MODE], [nonrecursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [recursive], + [m4_define([_LTDL_MODE], [recursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [subproject], + [m4_define([_LTDL_MODE], [subproject])]) + +m4_define([_LTDL_TYPE], []) +LT_OPTION_DEFINE([LTDL_INIT], [installable], + [m4_define([_LTDL_TYPE], [installable])]) +LT_OPTION_DEFINE([LTDL_INIT], [convenience], + [m4_define([_LTDL_TYPE], [convenience])]) + +# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- +# +# Copyright (C) 2004-2005, 2007-2008, 2011-2019, 2021-2022 Free Software +# Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltsugar.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) + + +# lt_join(SEP, ARG1, [ARG2...]) +# ----------------------------- +# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their +# associated separator. +# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier +# versions in m4sugar had bugs. +m4_define([lt_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) +m4_define([_lt_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) + + +# lt_car(LIST) +# lt_cdr(LIST) +# ------------ +# Manipulate m4 lists. +# These macros are necessary as long as will still need to support +# Autoconf-2.59, which quotes differently. +m4_define([lt_car], [[$1]]) +m4_define([lt_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) +m4_define([lt_unquote], $1) + + +# lt_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. +# Note that neither SEPARATOR nor STRING are expanded; they are appended +# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). +# No SEPARATOR is output if MACRO-NAME was previously undefined (different +# than defined and empty). +# +# This macro is needed until we can rely on Autoconf 2.62, since earlier +# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. +m4_define([lt_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) + + + +# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) +# ---------------------------------------------------------- +# Produce a SEP delimited list of all paired combinations of elements of +# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list +# has the form PREFIXmINFIXSUFFIXn. +# Needed until we can rely on m4_combine added in Autoconf 2.62. +m4_define([lt_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl +[[m4_foreach([_Lt_prefix], [$2], + [m4_foreach([_Lt_suffix], + ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, + [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) + + +# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) +# ----------------------------------------------------------------------- +# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited +# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. +m4_define([lt_if_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], + [lt_append([$1], [$2], [$3])$4], + [$5])], + [lt_append([$1], [$2], [$3])$4])]) + + +# lt_dict_add(DICT, KEY, VALUE) +# ----------------------------- +m4_define([lt_dict_add], +[m4_define([$1($2)], [$3])]) + + +# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) +# -------------------------------------------- +m4_define([lt_dict_add_subkey], +[m4_define([$1($2:$3)], [$4])]) + + +# lt_dict_fetch(DICT, KEY, [SUBKEY]) +# ---------------------------------- +m4_define([lt_dict_fetch], +[m4_ifval([$3], + m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), + m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) + + +# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------------------- +m4_define([lt_if_dict_fetch], +[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], + [$5], + [$6])]) + + +# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) +# -------------------------------------------------------------- +m4_define([lt_dict_filter], +[m4_if([$5], [], [], + [lt_join(m4_quote(m4_default([$4], [[, ]])), + lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), + [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl +]) + +# ltversion.m4 -- version numbers -*- Autoconf -*- +# +# Copyright (C) 2004, 2011-2019, 2021-2022 Free Software Foundation, +# Inc. +# Written by Scott James Remnant, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# @configure_input@ + +# serial 4245 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.4.7]) +m4_define([LT_PACKAGE_REVISION], [2.4.7]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.4.7' +macro_revision='2.4.7' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) + +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004-2005, 2007, 2009, 2011-2019, 2021-2022 Free +# Software Foundation, Inc. +# Written by Scott James Remnant, 2004. +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 5 lt~obsolete.m4 + +# These exist entirely to fool aclocal when bootstrapping libtool. +# +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), +# which have later been changed to m4_define as they aren't part of the +# exported API, or moved to Autoconf or Automake where they belong. +# +# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN +# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us +# using a macro with the same name in our local m4/libtool.m4 it'll +# pull the old libtool.m4 in (it doesn't see our shiny new m4_define +# and doesn't know about Autoconf macros at all.) +# +# So we provide this file, which has a silly filename so it's always +# included after everything else. This provides aclocal with the +# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything +# because those macros already exist, or will be overwritten later. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# +# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. +# Yes, that means every name once taken will need to remain here until +# we give up compatibility with versions before 1.7, at which point +# we need to keep only those names which we still refer to. + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) + +m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) +m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) +m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) +m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) +m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) +m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) +m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) +m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) +m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) +m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) +m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) +m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) +m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) +m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) +m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) +m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) +m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) +m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) +m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) +m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) +m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) +m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) +m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) +m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) +m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) +m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) +m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) +m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) +m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) +m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) +m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) +m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) +m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) +m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) +m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) +m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) +m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) +m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) +m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) +m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) +m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) +m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) +m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) + +# Copyright (C) 2002-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.16' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.16.5], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.16.5])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is '.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + + +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + AS_CASE([$CONFIG_FILES], + [*\'*], [eval set x "$CONFIG_FILES"], + [*], [set x $CONFIG_FILES]) + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`AS_DIRNAME(["$am_mf"])` + am_filepart=`AS_BASENAME(["$am_mf"])` + AM_RUN_LOG([cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles]) || am_rc=$? + done + if test $am_rc -ne 0; then + AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking).]) + fi + AS_UNSET([am_dirpart]) + AS_UNSET([am_filepart]) + AS_UNSET([am_mf]) + AS_UNSET([am_rc]) + rm -f conftest-deps.mk +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking is enabled. +# This creates each '.Po' and '.Plo' makefile fragment that we'll need in +# order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. +m4_define([AC_PROG_CC], +m4_defn([AC_PROG_CC]) +[_AM_PROG_CC_C_O +]) + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.65])dnl +m4_ifdef([_$0_ALREADY_INIT], + [m4_fatal([$0 expanded multiple times +]m4_defn([_$0_ALREADY_INIT]))], + [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[AC_DIAGNOSE([obsolete], + [$0: two- and three-arguments forms are deprecated.]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if( + m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl +]) +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi +AC_SUBST([CTAGS]) +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST([ETAGS]) +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi +AC_SUBST([CSCOPE]) + +AC_REQUIRE([AM_SILENT_RULES])dnl +dnl The testsuite driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This +dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi +dnl The trailing newline in this macro's definition is deliberate, for +dnl backward compatibility and to allow trailing 'dnl'-style comments +dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. +]) + +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST([install_sh])]) + +# Copyright (C) 2003-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MAINTAINER_MODE([DEFAULT-MODE]) +# ---------------------------------- +# Control maintainer-specific portions of Makefiles. +# Default is to disable them, unless 'enable' is passed literally. +# For symmetry, 'disable' may be passed as well. Anyway, the user +# can override the default with the --enable/--disable switch. +AC_DEFUN([AM_MAINTAINER_MODE], +[m4_case(m4_default([$1], [disable]), + [enable], [m4_define([am_maintainer_other], [disable])], + [disable], [m4_define([am_maintainer_other], [enable])], + [m4_define([am_maintainer_other], [enable]) + m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) +AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode's default is 'disable' unless 'enable' is passed + AC_ARG_ENABLE([maintainer-mode], + [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], + am_maintainer_other[ make rules and dependencies not useful + (and sometimes confusing) to the casual installer])], + [USE_MAINTAINER_MODE=$enableval], + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST([MAINT])dnl +] +) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MAKE_INCLUDE() +# ----------------- +# Check whether make has an 'include' directive that can support all +# the idioms we need for our automatic dependency tracking code. +AC_DEFUN([AM_MAKE_INCLUDE], +[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) + AS_CASE([$?:`cat confinc.out 2>/dev/null`], + ['0:this is the am__doit target'], + [AS_CASE([$s], + [BSD], [am__include='.include' am__quote='"'], + [am__include='include' am__quote=''])]) + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +AC_MSG_RESULT([${_am_result}]) +AC_SUBST([am__include])]) +AC_SUBST([am__quote])]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it is modern enough. +# If it is, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + AC_MSG_WARN(['missing' script is too old or missing]) +fi +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# -------------------- +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) + +# _AM_SET_OPTIONS(OPTIONS) +# ------------------------ +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_CC_C_O +# --------------- +# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC +# to automatically call this. +AC_DEFUN([_AM_PROG_CC_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +AC_LANG_PUSH([C])dnl +AC_CACHE_CHECK( + [whether $CC understands -c and -o together], + [am_cv_prog_cc_c_o], + [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i]) +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +AC_LANG_POP([C])]) + +# For backward compatibility. +AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) + +# Copyright (C) 2009-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# ("yes" being less verbose, "no" or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using '$V' instead of '$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor 'install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in "make install-strip", and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +# +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' + +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + + [m4_case([$1], + [ustar], + [# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi + AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi], + + [pax], + [], + + [m4_fatal([Unknown tar format])]) + + AC_MSG_CHECKING([how to create a $1 tar archive]) + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_$1-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi + done + rm -rf conftest.dir + + AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) + AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([acinclude.m4]) diff --git a/vendor/unuran-1.11.0/autoconf/compile b/vendor/unuran-1.11.0/autoconf/compile new file mode 100755 index 0000000..df363c8 --- /dev/null +++ b/vendor/unuran-1.11.0/autoconf/compile @@ -0,0 +1,348 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN* | MSYS*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/* | msys/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_dashL linkdir +# Make cl look for libraries in LINKDIR +func_cl_dashL () +{ + func_file_conv "$1" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" +} + +# func_cl_dashl library +# Do a library search-path lookup for cl +func_cl_dashl () +{ + lib=$1 + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + lib=$dir/$lib.dll.lib + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + lib=$dir/$lib.lib + break + fi + if test -f "$dir/lib$lib.a"; then + found=yes + lib=$dir/lib$lib.a + break + fi + done + IFS=$save_IFS + + if test "$found" != yes; then + lib=$lib.lib + fi +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I) + eat=1 + func_file_conv "$2" mingw + set x "$@" -I"$file" + shift + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l) + eat=1 + func_cl_dashl "$2" + set x "$@" "$lib" + shift + ;; + -l*) + func_cl_dashl "${1#-l}" + set x "$@" "$lib" + shift + ;; + -L) + eat=1 + func_cl_dashL "$2" + ;; + -L*) + func_cl_dashL "${1#-L}" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file 'INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; +esac + +ofile= +cfile= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no '-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # '.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/vendor/unuran-1.11.0/autoconf/config.guess b/vendor/unuran-1.11.0/autoconf/config.guess new file mode 100755 index 0000000..980b020 --- /dev/null +++ b/vendor/unuran-1.11.0/autoconf/config.guess @@ -0,0 +1,1774 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2022 Free Software Foundation, Inc. + +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2022-09-17' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess +# +# Please send patches to . + + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2022 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +# Just in case it came from the environment. +GUESS= + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + # prevent multiple calls if $tmp is already set + test "$tmp" && return 0 + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039,SC3028 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD=$driver + break + fi + done + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac +} + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if test -f /.attbin/uname ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +case $UNAME_SYSTEM in +Linux|GNU|GNU/*) + LIBC=unknown + + set_cc_for_build + cat <<-EOF > "$dummy.c" + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #elif defined(__GLIBC__) + LIBC=gnu + #else + #include + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif + #endif + EOF + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" + + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu + fi + ;; +esac + +# Note: order is significant - the case branches are not exclusive. + +case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + echo unknown)` + case $UNAME_MACHINE_ARCH in + aarch64eb) machine=aarch64_be-unknown ;; + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; + *) machine=$UNAME_MACHINE_ARCH-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently (or will in the future) and ABI. + case $UNAME_MACHINE_ARCH in + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # Determine ABI tags. + case $UNAME_MACHINE_ARCH in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case $UNAME_VERSION in + Debian*) + release='-gnu' + ;; + *) + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + GUESS=$machine-${os}${release}${abi-} + ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE + ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE + ;; + *:SecBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE + ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE + ;; + *:MidnightBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE + ;; + *:ekkoBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE + ;; + *:SolidBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE + ;; + *:OS108:*:*) + GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE + ;; + macppc:MirBSD:*:*) + GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE + ;; + *:MirBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE + ;; + *:Sortix:*:*) + GUESS=$UNAME_MACHINE-unknown-sortix + ;; + *:Twizzler:*:*) + GUESS=$UNAME_MACHINE-unknown-twizzler + ;; + *:Redox:*:*) + GUESS=$UNAME_MACHINE-unknown-redox + ;; + mips:OSF1:*.*) + GUESS=mips-dec-osf1 + ;; + alpha:OSF1:*:*) + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + trap '' 0 + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case $ALPHA_CPU_TYPE in + "EV4 (21064)") + UNAME_MACHINE=alpha ;; + "EV4.5 (21064)") + UNAME_MACHINE=alpha ;; + "LCA4 (21066/21068)") + UNAME_MACHINE=alpha ;; + "EV5 (21164)") + UNAME_MACHINE=alphaev5 ;; + "EV5.6 (21164A)") + UNAME_MACHINE=alphaev56 ;; + "EV5.6 (21164PC)") + UNAME_MACHINE=alphapca56 ;; + "EV5.7 (21164PC)") + UNAME_MACHINE=alphapca57 ;; + "EV6 (21264)") + UNAME_MACHINE=alphaev6 ;; + "EV6.7 (21264A)") + UNAME_MACHINE=alphaev67 ;; + "EV6.8CB (21264C)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8AL (21264B)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8CX (21264D)") + UNAME_MACHINE=alphaev68 ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE=alphaev69 ;; + "EV7 (21364)") + UNAME_MACHINE=alphaev7 ;; + "EV7.9 (21364A)") + UNAME_MACHINE=alphaev79 ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + GUESS=$UNAME_MACHINE-dec-osf$OSF_REL + ;; + Amiga*:UNIX_System_V:4.0:*) + GUESS=m68k-unknown-sysv4 + ;; + *:[Aa]miga[Oo][Ss]:*:*) + GUESS=$UNAME_MACHINE-unknown-amigaos + ;; + *:[Mm]orph[Oo][Ss]:*:*) + GUESS=$UNAME_MACHINE-unknown-morphos + ;; + *:OS/390:*:*) + GUESS=i370-ibm-openedition + ;; + *:z/VM:*:*) + GUESS=s390-ibm-zvmoe + ;; + *:OS400:*:*) + GUESS=powerpc-ibm-os400 + ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + GUESS=arm-acorn-riscix$UNAME_RELEASE + ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + GUESS=arm-unknown-riscos + ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + GUESS=hppa1.1-hitachi-hiuxmpp + ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + case `(/bin/universe) 2>/dev/null` in + att) GUESS=pyramid-pyramid-sysv3 ;; + *) GUESS=pyramid-pyramid-bsd ;; + esac + ;; + NILE*:*:*:dcosx) + GUESS=pyramid-pyramid-svr4 + ;; + DRS?6000:unix:4.0:6*) + GUESS=sparc-icl-nx6 + ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) GUESS=sparc-icl-nx7 ;; + esac + ;; + s390x:SunOS:*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL + ;; + sun4H:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-hal-solaris2$SUN_REL + ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris2$SUN_REL + ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + GUESS=i386-pc-auroraux$UNAME_RELEASE + ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + set_cc_for_build + SUN_ARCH=i386 + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH=x86_64 + fi + fi + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$SUN_ARCH-pc-solaris2$SUN_REL + ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris3$SUN_REL + ;; + sun4*:SunOS:*:*) + case `/usr/bin/arch -k` in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` + GUESS=sparc-sun-sunos$SUN_REL + ;; + sun3*:SunOS:*:*) + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 + case `/bin/arch` in + sun3) + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; + sun4) + GUESS=sparc-sun-sunos$UNAME_RELEASE + ;; + esac + ;; + aushp:SunOS:*:*) + GUESS=sparc-auspex-sunos$UNAME_RELEASE + ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + GUESS=m68k-milan-mint$UNAME_RELEASE + ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + GUESS=m68k-hades-mint$UNAME_RELEASE + ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + GUESS=m68k-unknown-mint$UNAME_RELEASE + ;; + m68k:machten:*:*) + GUESS=m68k-apple-machten$UNAME_RELEASE + ;; + powerpc:machten:*:*) + GUESS=powerpc-apple-machten$UNAME_RELEASE + ;; + RISC*:Mach:*:*) + GUESS=mips-dec-mach_bsd4.3 + ;; + RISC*:ULTRIX:*:*) + GUESS=mips-dec-ultrix$UNAME_RELEASE + ;; + VAX*:ULTRIX*:*:*) + GUESS=vax-dec-ultrix$UNAME_RELEASE + ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + GUESS=clipper-intergraph-clix$UNAME_RELEASE + ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`"$dummy" "$dummyarg"` && + { echo "$SYSTEM_NAME"; exit; } + GUESS=mips-mips-riscos$UNAME_RELEASE + ;; + Motorola:PowerMAX_OS:*:*) + GUESS=powerpc-motorola-powermax + ;; + Motorola:*:4.3:PL8-*) + GUESS=powerpc-harris-powermax + ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + GUESS=powerpc-harris-powermax + ;; + Night_Hawk:Power_UNIX:*:*) + GUESS=powerpc-harris-powerunix + ;; + m88k:CX/UX:7*:*) + GUESS=m88k-harris-cxux7 + ;; + m88k:*:4*:R4*) + GUESS=m88k-motorola-sysv4 + ;; + m88k:*:3*:R3*) + GUESS=m88k-motorola-sysv3 + ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 + then + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$TARGET_BINARY_INTERFACE"x = x + then + GUESS=m88k-dg-dgux$UNAME_RELEASE + else + GUESS=m88k-dg-dguxbcs$UNAME_RELEASE + fi + else + GUESS=i586-dg-dgux$UNAME_RELEASE + fi + ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + GUESS=m88k-dolphin-sysv3 + ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + GUESS=m88k-motorola-sysv3 + ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + GUESS=m88k-tektronix-sysv3 + ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + GUESS=m68k-tektronix-bsd + ;; + *:IRIX*:*:*) + IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` + GUESS=mips-sgi-irix$IRIX_REL + ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id + ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + GUESS=i386-ibm-aix + ;; + ia64:AIX:*:*) + if test -x /usr/bin/oslevel ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE + fi + GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV + ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` + then + GUESS=$SYSTEM_NAME + else + GUESS=rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + GUESS=rs6000-ibm-aix3.2.4 + else + GUESS=rs6000-ibm-aix3.2 + fi + ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if test -x /usr/bin/lslpp ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + else + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE + fi + GUESS=$IBM_ARCH-ibm-aix$IBM_REV + ;; + *:AIX:*:*) + GUESS=rs6000-ibm-aix + ;; + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + GUESS=romp-ibm-bsd4.4 + ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to + ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + GUESS=rs6000-bull-bosx + ;; + DPX/2?00:B.O.S.:*:*) + GUESS=m68k-bull-sysv3 + ;; + 9000/[34]??:4.3bsd:1.*:*) + GUESS=m68k-hp-bsd + ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + GUESS=m68k-hp-bsd4.4 + ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + case $UNAME_MACHINE in + 9000/31?) HP_ARCH=m68000 ;; + 9000/[34]??) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if test -x /usr/bin/getconf; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case $sc_cpu_version in + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case $sc_kernel_bits in + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 + esac ;; + esac + fi + if test "$HP_ARCH" = ""; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if test "$HP_ARCH" = hppa2.0w + then + set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH=hppa2.0w + else + HP_ARCH=hppa64 + fi + fi + GUESS=$HP_ARCH-hp-hpux$HPUX_REV + ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + GUESS=ia64-hp-hpux$HPUX_REV + ;; + 3050*:HI-UX:*:*) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + GUESS=unknown-hitachi-hiuxwe2 + ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + GUESS=hppa1.1-hp-bsd + ;; + 9000/8??:4.3bsd:*:*) + GUESS=hppa1.0-hp-bsd + ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + GUESS=hppa1.0-hp-mpeix + ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + GUESS=hppa1.1-hp-osf + ;; + hp8??:OSF1:*:*) + GUESS=hppa1.0-hp-osf + ;; + i*86:OSF1:*:*) + if test -x /usr/sbin/sysversion ; then + GUESS=$UNAME_MACHINE-unknown-osf1mk + else + GUESS=$UNAME_MACHINE-unknown-osf1 + fi + ;; + parisc*:Lites*:*:*) + GUESS=hppa1.1-hp-lites + ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + GUESS=c1-convex-bsd + ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + GUESS=c34-convex-bsd + ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + GUESS=c38-convex-bsd + ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + GUESS=c4-convex-bsd + ;; + CRAY*Y-MP:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=ymp-cray-unicos$CRAY_REL + ;; + CRAY*[A-Z]90:*:*:*) + echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=t90-cray-unicos$CRAY_REL + ;; + CRAY*T3E:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=alphaev5-cray-unicosmk$CRAY_REL + ;; + CRAY*SV1:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=sv1-cray-unicos$CRAY_REL + ;; + *:UNICOS/mp:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=craynv-cray-unicosmp$CRAY_REL + ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` + GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE + ;; + sparc*:BSD/OS:*:*) + GUESS=sparc-unknown-bsdi$UNAME_RELEASE + ;; + *:BSD/OS:*:*) + GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE + ;; + arm:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + set_cc_for_build + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi + else + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf + fi + ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case $UNAME_PROCESSOR in + amd64) + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; + esac + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL + ;; + i*:CYGWIN*:*) + GUESS=$UNAME_MACHINE-pc-cygwin + ;; + *:MINGW64*:*) + GUESS=$UNAME_MACHINE-pc-mingw64 + ;; + *:MINGW*:*) + GUESS=$UNAME_MACHINE-pc-mingw32 + ;; + *:MSYS*:*) + GUESS=$UNAME_MACHINE-pc-msys + ;; + i*:PW*:*) + GUESS=$UNAME_MACHINE-pc-pw32 + ;; + *:SerenityOS:*:*) + GUESS=$UNAME_MACHINE-pc-serenity + ;; + *:Interix*:*) + case $UNAME_MACHINE in + x86) + GUESS=i586-pc-interix$UNAME_RELEASE + ;; + authenticamd | genuineintel | EM64T) + GUESS=x86_64-unknown-interix$UNAME_RELEASE + ;; + IA64) + GUESS=ia64-unknown-interix$UNAME_RELEASE + ;; + esac ;; + i*:UWIN*:*) + GUESS=$UNAME_MACHINE-pc-uwin + ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + GUESS=x86_64-pc-cygwin + ;; + prep*:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=powerpcle-unknown-solaris2$SUN_REL + ;; + *:GNU:*:*) + # the GNU system + GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` + GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL + ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC + ;; + x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-pc-managarm-mlibc" + ;; + *:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" + ;; + *:Minix:*:*) + GUESS=$UNAME_MACHINE-unknown-minix + ;; + aarch64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arm*:Linux:*:*) + set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi + else + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf + fi + fi + ;; + avr32*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + cris:Linux:*:*) + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + crisv32:Linux:*:*) + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + e2k:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + frv:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + hexagon:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + i*86:Linux:*:*) + GUESS=$UNAME_MACHINE-pc-linux-$LIBC + ;; + ia64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + k1om:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + loongarch32:Linux:*:* | loongarch64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + m32r*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + m68*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + mips:Linux:*:* | mips64:Linux:*:*) + set_cc_for_build + IS_GLIBC=0 + test x"${LIBC}" = xgnu && IS_GLIBC=1 + sed 's/^ //' << EOF > "$dummy.c" + #undef CPU + #undef mips + #undef mipsel + #undef mips64 + #undef mips64el + #if ${IS_GLIBC} && defined(_ABI64) + LIBCABI=gnuabi64 + #else + #if ${IS_GLIBC} && defined(_ABIN32) + LIBCABI=gnuabin32 + #else + LIBCABI=${LIBC} + #endif + #endif + + #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa64r6 + #else + #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa32r6 + #else + #if defined(__mips64) + CPU=mips64 + #else + CPU=mips + #endif + #endif + #endif + + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + MIPS_ENDIAN=el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + MIPS_ENDIAN= + #else + MIPS_ENDIAN= + #endif + #endif +EOF + cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` + eval "$cc_set_vars" + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } + ;; + mips64el:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + openrisc*:Linux:*:*) + GUESS=or1k-unknown-linux-$LIBC + ;; + or32:Linux:*:* | or1k*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + padre:Linux:*:*) + GUESS=sparc-unknown-linux-$LIBC + ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + GUESS=hppa64-unknown-linux-$LIBC + ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; + PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; + *) GUESS=hppa-unknown-linux-$LIBC ;; + esac + ;; + ppc64:Linux:*:*) + GUESS=powerpc64-unknown-linux-$LIBC + ;; + ppc:Linux:*:*) + GUESS=powerpc-unknown-linux-$LIBC + ;; + ppc64le:Linux:*:*) + GUESS=powerpc64le-unknown-linux-$LIBC + ;; + ppcle:Linux:*:*) + GUESS=powerpcle-unknown-linux-$LIBC + ;; + riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + s390:Linux:*:* | s390x:Linux:*:*) + GUESS=$UNAME_MACHINE-ibm-linux-$LIBC + ;; + sh64*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + sh*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + tile*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + vax:Linux:*:*) + GUESS=$UNAME_MACHINE-dec-linux-$LIBC + ;; + x86_64:Linux:*:*) + set_cc_for_build + CPU=$UNAME_MACHINE + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __i386__ + ABI=x86 + #else + #ifdef __ILP32__ + ABI=x32 + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + x86) CPU=i686 ;; + x32) LIBCABI=${LIBC}x32 ;; + esac + fi + GUESS=$CPU-pc-linux-$LIBCABI + ;; + xtensa*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + GUESS=i386-sequent-sysv4 + ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION + ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + GUESS=$UNAME_MACHINE-pc-os2-emx + ;; + i*86:XTS-300:*:STOP) + GUESS=$UNAME_MACHINE-unknown-stop + ;; + i*86:atheos:*:*) + GUESS=$UNAME_MACHINE-unknown-atheos + ;; + i*86:syllable:*:*) + GUESS=$UNAME_MACHINE-pc-syllable + ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + GUESS=i386-unknown-lynxos$UNAME_RELEASE + ;; + i*86:*DOS:*:*) + GUESS=$UNAME_MACHINE-pc-msdosdjgpp + ;; + i*86:*:4.*:*) + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL + else + GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL + fi + ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL + else + GUESS=$UNAME_MACHINE-pc-sysv32 + fi + ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configure will decide that + # this is a cross-build. + GUESS=i586-pc-msdosdjgpp + ;; + Intel:Mach:3*:*) + GUESS=i386-pc-mach3 + ;; + paragon:*:*:*) + GUESS=i860-intel-osf1 + ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 + fi + ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + GUESS=m68010-convergent-sysv + ;; + mc68k:UNIX:SYSTEM5:3.51m) + GUESS=m68k-convergent-sysv + ;; + M680?0:D-NIX:5.3:*) + GUESS=m68k-diab-dnix + ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + GUESS=m68k-unknown-lynxos$UNAME_RELEASE + ;; + mc68030:UNIX_System_V:4.*:*) + GUESS=m68k-atari-sysv4 + ;; + TSUNAMI:LynxOS:2.*:*) + GUESS=sparc-unknown-lynxos$UNAME_RELEASE + ;; + rs6000:LynxOS:2.*:*) + GUESS=rs6000-unknown-lynxos$UNAME_RELEASE + ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + GUESS=powerpc-unknown-lynxos$UNAME_RELEASE + ;; + SM[BE]S:UNIX_SV:*:*) + GUESS=mips-dde-sysv$UNAME_RELEASE + ;; + RM*:ReliantUNIX-*:*:*) + GUESS=mips-sni-sysv4 + ;; + RM*:SINIX-*:*:*) + GUESS=mips-sni-sysv4 + ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + GUESS=$UNAME_MACHINE-sni-sysv4 + else + GUESS=ns32k-sni-sysv + fi + ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + GUESS=i586-unisys-sysv4 + ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + GUESS=hppa1.1-stratus-sysv4 + ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + GUESS=i860-stratus-sysv4 + ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + GUESS=$UNAME_MACHINE-stratus-vos + ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + GUESS=hppa1.1-stratus-vos + ;; + mc68*:A/UX:*:*) + GUESS=m68k-apple-aux$UNAME_RELEASE + ;; + news*:NEWS-OS:6*:*) + GUESS=mips-sony-newsos6 + ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if test -d /usr/nec; then + GUESS=mips-nec-sysv$UNAME_RELEASE + else + GUESS=mips-unknown-sysv$UNAME_RELEASE + fi + ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + GUESS=powerpc-be-beos + ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + GUESS=powerpc-apple-beos + ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + GUESS=i586-pc-beos + ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + GUESS=i586-pc-haiku + ;; + ppc:Haiku:*:*) # Haiku running on Apple PowerPC + GUESS=powerpc-apple-haiku + ;; + *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) + GUESS=$UNAME_MACHINE-unknown-haiku + ;; + SX-4:SUPER-UX:*:*) + GUESS=sx4-nec-superux$UNAME_RELEASE + ;; + SX-5:SUPER-UX:*:*) + GUESS=sx5-nec-superux$UNAME_RELEASE + ;; + SX-6:SUPER-UX:*:*) + GUESS=sx6-nec-superux$UNAME_RELEASE + ;; + SX-7:SUPER-UX:*:*) + GUESS=sx7-nec-superux$UNAME_RELEASE + ;; + SX-8:SUPER-UX:*:*) + GUESS=sx8-nec-superux$UNAME_RELEASE + ;; + SX-8R:SUPER-UX:*:*) + GUESS=sx8r-nec-superux$UNAME_RELEASE + ;; + SX-ACE:SUPER-UX:*:*) + GUESS=sxace-nec-superux$UNAME_RELEASE + ;; + Power*:Rhapsody:*:*) + GUESS=powerpc-apple-rhapsody$UNAME_RELEASE + ;; + *:Rhapsody:*:*) + GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE + ;; + arm64:Darwin:*:*) + GUESS=aarch64-apple-darwin$UNAME_RELEASE + ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + if command -v xcode-select > /dev/null 2> /dev/null && \ + ! xcode-select --print-path > /dev/null 2> /dev/null ; then + # Avoid executing cc if there is no toolchain installed as + # cc will be a stub that puts up a graphical alert + # prompting the user to install developer tools. + CC_FOR_BUILD=no_compiler_found + else + set_cc_for_build + fi + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # uname -m returns i386 or x86_64 + UNAME_PROCESSOR=$UNAME_MACHINE + fi + GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE + ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = x86; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE + ;; + *:QNX:*:4*) + GUESS=i386-pc-qnx + ;; + NEO-*:NONSTOP_KERNEL:*:*) + GUESS=neo-tandem-nsk$UNAME_RELEASE + ;; + NSE-*:NONSTOP_KERNEL:*:*) + GUESS=nse-tandem-nsk$UNAME_RELEASE + ;; + NSR-*:NONSTOP_KERNEL:*:*) + GUESS=nsr-tandem-nsk$UNAME_RELEASE + ;; + NSV-*:NONSTOP_KERNEL:*:*) + GUESS=nsv-tandem-nsk$UNAME_RELEASE + ;; + NSX-*:NONSTOP_KERNEL:*:*) + GUESS=nsx-tandem-nsk$UNAME_RELEASE + ;; + *:NonStop-UX:*:*) + GUESS=mips-compaq-nonstopux + ;; + BS2000:POSIX*:*:*) + GUESS=bs2000-siemens-sysv + ;; + DS/*:UNIX_System_V:*:*) + GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE + ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "${cputype-}" = 386; then + UNAME_MACHINE=i386 + elif test "x${cputype-}" != x; then + UNAME_MACHINE=$cputype + fi + GUESS=$UNAME_MACHINE-unknown-plan9 + ;; + *:TOPS-10:*:*) + GUESS=pdp10-unknown-tops10 + ;; + *:TENEX:*:*) + GUESS=pdp10-unknown-tenex + ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + GUESS=pdp10-dec-tops20 + ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + GUESS=pdp10-xkl-tops20 + ;; + *:TOPS-20:*:*) + GUESS=pdp10-unknown-tops20 + ;; + *:ITS:*:*) + GUESS=pdp10-unknown-its + ;; + SEI:*:*:SEIUX) + GUESS=mips-sei-seiux$UNAME_RELEASE + ;; + *:DragonFly:*:*) + DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL + ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case $UNAME_MACHINE in + A*) GUESS=alpha-dec-vms ;; + I*) GUESS=ia64-dec-vms ;; + V*) GUESS=vax-dec-vms ;; + esac ;; + *:XENIX:*:SysV) + GUESS=i386-pc-xenix + ;; + i*86:skyos:*:*) + SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` + GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL + ;; + i*86:rdos:*:*) + GUESS=$UNAME_MACHINE-pc-rdos + ;; + i*86:Fiwix:*:*) + GUESS=$UNAME_MACHINE-pc-fiwix + ;; + *:AROS:*:*) + GUESS=$UNAME_MACHINE-unknown-aros + ;; + x86_64:VMkernel:*:*) + GUESS=$UNAME_MACHINE-unknown-esx + ;; + amd64:Isilon\ OneFS:*:*) + GUESS=x86_64-unknown-onefs + ;; + *:Unleashed:*:*) + GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE + ;; +esac + +# Do we have a guess based on uname results? +if test "x$GUESS" != x; then + echo "$GUESS" + exit +fi + +# No uname command or uname output not recognized. +set_cc_for_build +cat > "$dummy.c" < +#include +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#include +#if defined(_SIZE_T_) || defined(SIGLOST) +#include +#endif +#endif +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); +#endif + +#if defined (vax) +#if !defined (ultrix) +#include +#if defined (BSD) +#if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +#else +#if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#endif +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#else +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname un; + uname (&un); + printf ("vax-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname *un; + uname (&un); + printf ("mips-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("mips-dec-ultrix\n"); exit (0); +#endif +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. +test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } + +echo "$0: unable to guess system type" >&2 + +case $UNAME_MACHINE:$UNAME_SYSTEM in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <&2 <&2 </dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = "$UNAME_MACHINE" +UNAME_RELEASE = "$UNAME_RELEASE" +UNAME_SYSTEM = "$UNAME_SYSTEM" +UNAME_VERSION = "$UNAME_VERSION" +EOF +fi + +exit 1 + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/vendor/unuran-1.11.0/autoconf/config.sub b/vendor/unuran-1.11.0/autoconf/config.sub new file mode 100755 index 0000000..baf1512 --- /dev/null +++ b/vendor/unuran-1.11.0/autoconf/config.sub @@ -0,0 +1,1907 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright 1992-2022 Free Software Foundation, Inc. + +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2022-09-17' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS + +Canonicalize a configuration name. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2022 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo "$1" + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Split fields of configuration type +# shellcheck disable=SC2162 +saved_IFS=$IFS +IFS="-" read field1 field2 field3 field4 <&2 + exit 1 + ;; + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 + ;; + *-*-*) + # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two + # parts + maybe_os=$field2-$field3 + case $maybe_os in + nto-qnx* | linux-* | uclinux-uclibc* \ + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ + | storm-chaos* | os2-emx* | rtmk-nova* | managarm-*) + basic_machine=$field1 + basic_os=$maybe_os + ;; + android-linux) + basic_machine=$field1-unknown + basic_os=linux-android + ;; + *) + basic_machine=$field1-$field2 + basic_os=$field3 + ;; + esac + ;; + *-*) + # A lone config we happen to match not fitting any pattern + case $field1-$field2 in + decstation-3100) + basic_machine=mips-dec + basic_os= + ;; + *-*) + # Second component is usually, but not always the OS + case $field2 in + # Prevent following clause from handling this valid os + sun*os*) + basic_machine=$field1 + basic_os=$field2 + ;; + zephyr*) + basic_machine=$field1-unknown + basic_os=$field2 + ;; + # Manufacturers + dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ + | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ + | unicom* | ibm* | next | hp | isi* | apollo | altos* \ + | convergent* | ncr* | news | 32* | 3600* | 3100* \ + | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ + | ultra | tti* | harris | dolphin | highlevel | gould \ + | cbm | ns | masscomp | apple | axis | knuth | cray \ + | microblaze* | sim | cisco \ + | oki | wec | wrs | winbond) + basic_machine=$field1-$field2 + basic_os= + ;; + *) + basic_machine=$field1 + basic_os=$field2 + ;; + esac + ;; + esac + ;; + *) + # Convert single-component short-hands not valid as part of + # multi-component configurations. + case $field1 in + 386bsd) + basic_machine=i386-pc + basic_os=bsd + ;; + a29khif) + basic_machine=a29k-amd + basic_os=udi + ;; + adobe68k) + basic_machine=m68010-adobe + basic_os=scout + ;; + alliant) + basic_machine=fx80-alliant + basic_os= + ;; + altos | altos3068) + basic_machine=m68k-altos + basic_os= + ;; + am29k) + basic_machine=a29k-none + basic_os=bsd + ;; + amdahl) + basic_machine=580-amdahl + basic_os=sysv + ;; + amiga) + basic_machine=m68k-unknown + basic_os= + ;; + amigaos | amigados) + basic_machine=m68k-unknown + basic_os=amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + basic_os=sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + basic_os=sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + basic_os=bsd + ;; + aros) + basic_machine=i386-pc + basic_os=aros + ;; + aux) + basic_machine=m68k-apple + basic_os=aux + ;; + balance) + basic_machine=ns32k-sequent + basic_os=dynix + ;; + blackfin) + basic_machine=bfin-unknown + basic_os=linux + ;; + cegcc) + basic_machine=arm-unknown + basic_os=cegcc + ;; + convex-c1) + basic_machine=c1-convex + basic_os=bsd + ;; + convex-c2) + basic_machine=c2-convex + basic_os=bsd + ;; + convex-c32) + basic_machine=c32-convex + basic_os=bsd + ;; + convex-c34) + basic_machine=c34-convex + basic_os=bsd + ;; + convex-c38) + basic_machine=c38-convex + basic_os=bsd + ;; + cray) + basic_machine=j90-cray + basic_os=unicos + ;; + crds | unos) + basic_machine=m68k-crds + basic_os= + ;; + da30) + basic_machine=m68k-da30 + basic_os= + ;; + decstation | pmax | pmin | dec3100 | decstatn) + basic_machine=mips-dec + basic_os= + ;; + delta88) + basic_machine=m88k-motorola + basic_os=sysv3 + ;; + dicos) + basic_machine=i686-pc + basic_os=dicos + ;; + djgpp) + basic_machine=i586-pc + basic_os=msdosdjgpp + ;; + ebmon29k) + basic_machine=a29k-amd + basic_os=ebmon + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + basic_os=ose + ;; + gmicro) + basic_machine=tron-gmicro + basic_os=sysv + ;; + go32) + basic_machine=i386-pc + basic_os=go32 + ;; + h8300hms) + basic_machine=h8300-hitachi + basic_os=hms + ;; + h8300xray) + basic_machine=h8300-hitachi + basic_os=xray + ;; + h8500hms) + basic_machine=h8500-hitachi + basic_os=hms + ;; + harris) + basic_machine=m88k-harris + basic_os=sysv3 + ;; + hp300 | hp300hpux) + basic_machine=m68k-hp + basic_os=hpux + ;; + hp300bsd) + basic_machine=m68k-hp + basic_os=bsd + ;; + hppaosf) + basic_machine=hppa1.1-hp + basic_os=osf + ;; + hppro) + basic_machine=hppa1.1-hp + basic_os=proelf + ;; + i386mach) + basic_machine=i386-mach + basic_os=mach + ;; + isi68 | isi) + basic_machine=m68k-isi + basic_os=sysv + ;; + m68knommu) + basic_machine=m68k-unknown + basic_os=linux + ;; + magnum | m3230) + basic_machine=mips-mips + basic_os=sysv + ;; + merlin) + basic_machine=ns32k-utek + basic_os=sysv + ;; + mingw64) + basic_machine=x86_64-pc + basic_os=mingw64 + ;; + mingw32) + basic_machine=i686-pc + basic_os=mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + basic_os=mingw32ce + ;; + monitor) + basic_machine=m68k-rom68k + basic_os=coff + ;; + morphos) + basic_machine=powerpc-unknown + basic_os=morphos + ;; + moxiebox) + basic_machine=moxie-unknown + basic_os=moxiebox + ;; + msdos) + basic_machine=i386-pc + basic_os=msdos + ;; + msys) + basic_machine=i686-pc + basic_os=msys + ;; + mvs) + basic_machine=i370-ibm + basic_os=mvs + ;; + nacl) + basic_machine=le32-unknown + basic_os=nacl + ;; + ncr3000) + basic_machine=i486-ncr + basic_os=sysv4 + ;; + netbsd386) + basic_machine=i386-pc + basic_os=netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + basic_os=linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + basic_os=newsos + ;; + news1000) + basic_machine=m68030-sony + basic_os=newsos + ;; + necv70) + basic_machine=v70-nec + basic_os=sysv + ;; + nh3000) + basic_machine=m68k-harris + basic_os=cxux + ;; + nh[45]000) + basic_machine=m88k-harris + basic_os=cxux + ;; + nindy960) + basic_machine=i960-intel + basic_os=nindy + ;; + mon960) + basic_machine=i960-intel + basic_os=mon960 + ;; + nonstopux) + basic_machine=mips-compaq + basic_os=nonstopux + ;; + os400) + basic_machine=powerpc-ibm + basic_os=os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + basic_os=ose + ;; + os68k) + basic_machine=m68k-none + basic_os=os68k + ;; + paragon) + basic_machine=i860-intel + basic_os=osf + ;; + parisc) + basic_machine=hppa-unknown + basic_os=linux + ;; + psp) + basic_machine=mipsallegrexel-sony + basic_os=psp + ;; + pw32) + basic_machine=i586-unknown + basic_os=pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + basic_os=rdos + ;; + rdos32) + basic_machine=i386-pc + basic_os=rdos + ;; + rom68k) + basic_machine=m68k-rom68k + basic_os=coff + ;; + sa29200) + basic_machine=a29k-amd + basic_os=udi + ;; + sei) + basic_machine=mips-sei + basic_os=seiux + ;; + sequent) + basic_machine=i386-sequent + basic_os= + ;; + sps7) + basic_machine=m68k-bull + basic_os=sysv2 + ;; + st2000) + basic_machine=m68k-tandem + basic_os= + ;; + stratus) + basic_machine=i860-stratus + basic_os=sysv4 + ;; + sun2) + basic_machine=m68000-sun + basic_os= + ;; + sun2os3) + basic_machine=m68000-sun + basic_os=sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + basic_os=sunos4 + ;; + sun3) + basic_machine=m68k-sun + basic_os= + ;; + sun3os3) + basic_machine=m68k-sun + basic_os=sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + basic_os=sunos4 + ;; + sun4) + basic_machine=sparc-sun + basic_os= + ;; + sun4os3) + basic_machine=sparc-sun + basic_os=sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + basic_os=sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + basic_os=solaris2 + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + basic_os= + ;; + sv1) + basic_machine=sv1-cray + basic_os=unicos + ;; + symmetry) + basic_machine=i386-sequent + basic_os=dynix + ;; + t3e) + basic_machine=alphaev5-cray + basic_os=unicos + ;; + t90) + basic_machine=t90-cray + basic_os=unicos + ;; + toad1) + basic_machine=pdp10-xkl + basic_os=tops20 + ;; + tpf) + basic_machine=s390x-ibm + basic_os=tpf + ;; + udi29k) + basic_machine=a29k-amd + basic_os=udi + ;; + ultra3) + basic_machine=a29k-nyu + basic_os=sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + basic_os=none + ;; + vaxv) + basic_machine=vax-dec + basic_os=sysv + ;; + vms) + basic_machine=vax-dec + basic_os=vms + ;; + vsta) + basic_machine=i386-pc + basic_os=vsta + ;; + vxworks960) + basic_machine=i960-wrs + basic_os=vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + basic_os=vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + basic_os=vxworks + ;; + xbox) + basic_machine=i686-pc + basic_os=mingw32 + ;; + ymp) + basic_machine=ymp-cray + basic_os=unicos + ;; + *) + basic_machine=$1 + basic_os= + ;; + esac + ;; +esac + +# Decode 1-component or ad-hoc basic machines +case $basic_machine in + # Here we handle the default manufacturer of certain CPU types. It is in + # some cases the only manufacturer, in others, it is the most popular. + w89k) + cpu=hppa1.1 + vendor=winbond + ;; + op50n) + cpu=hppa1.1 + vendor=oki + ;; + op60c) + cpu=hppa1.1 + vendor=oki + ;; + ibm*) + cpu=i370 + vendor=ibm + ;; + orion105) + cpu=clipper + vendor=highlevel + ;; + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple + ;; + pmac | pmac-mpw) + cpu=powerpc + vendor=apple + ;; + + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + cpu=m68000 + vendor=att + ;; + 3b*) + cpu=we32k + vendor=att + ;; + bluegene*) + cpu=powerpc + vendor=ibm + basic_os=cnk + ;; + decsystem10* | dec10*) + cpu=pdp10 + vendor=dec + basic_os=tops10 + ;; + decsystem20* | dec20*) + cpu=pdp10 + vendor=dec + basic_os=tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + cpu=m68k + vendor=motorola + ;; + dpx2*) + cpu=m68k + vendor=bull + basic_os=sysv3 + ;; + encore | umax | mmax) + cpu=ns32k + vendor=encore + ;; + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} + ;; + fx2800) + cpu=i860 + vendor=alliant + ;; + genix) + cpu=ns32k + vendor=ns + ;; + h3050r* | hiux*) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + cpu=m68000 + vendor=hp + ;; + hp9k3[2-9][0-9]) + cpu=m68k + vendor=hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + i*86v32) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv32 + ;; + i*86v4*) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv4 + ;; + i*86v) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv + ;; + i*86sol2) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=solaris2 + ;; + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} + ;; + iris | iris4d) + cpu=mips + vendor=sgi + case $basic_os in + irix*) + ;; + *) + basic_os=irix4 + ;; + esac + ;; + miniframe) + cpu=m68000 + vendor=convergent + ;; + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint + ;; + news-3600 | risc-news) + cpu=mips + vendor=sony + basic_os=newsos + ;; + next | m*-next) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) + ;; + ns2*) + basic_os=nextstep2 + ;; + *) + basic_os=nextstep3 + ;; + esac + ;; + np1) + cpu=np1 + vendor=gould + ;; + op50n-* | op60c-*) + cpu=hppa1.1 + vendor=oki + basic_os=proelf + ;; + pa-hitachi) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + pbd) + cpu=sparc + vendor=tti + ;; + pbb) + cpu=m68k + vendor=tti + ;; + pc532) + cpu=ns32k + vendor=pc532 + ;; + pn) + cpu=pn + vendor=gould + ;; + power) + cpu=power + vendor=ibm + ;; + ps2) + cpu=i386 + vendor=ibm + ;; + rm[46]00) + cpu=mips + vendor=siemens + ;; + rtpc | rtpc-*) + cpu=romp + vendor=ibm + ;; + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} + ;; + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks + ;; + tower | tower-32) + cpu=m68k + vendor=ncr + ;; + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu + ;; + w65) + cpu=w65 + vendor=wdc + ;; + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf + ;; + none) + cpu=none + vendor=none + ;; + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine + ;; + leon-*|leon[3-9]-*) + cpu=sparc + vendor=`echo "$basic_machine" | sed 's/-.*//'` + ;; + + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read cpu vendor <&2 + exit 1 + ;; + esac + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $vendor in + digital*) + vendor=dec + ;; + commodore*) + vendor=cbm + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if test x$basic_os != x +then + +# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just +# set os. +case $basic_os in + gnu/linux*) + kernel=linux + os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` + ;; + os2-emx) + kernel=os2 + os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` + ;; + nto-qnx*) + kernel=nto + os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` + ;; + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read kernel os <&2 + exit 1 + ;; +esac + +# As a final step for OS-related things, validate the OS-kernel combination +# (given a valid OS), if there is a kernel. +case $kernel-$os in + linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ + | linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* ) + ;; + uclinux-uclibc* ) + ;; + managarm-mlibc* | managarm-kernel* ) + ;; + -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. + echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + -kernel* ) + echo "Invalid configuration \`$1': \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + *-kernel* ) + echo "Invalid configuration \`$1': \`$kernel' does not support \`$os'." 1>&2 + exit 1 + ;; + kfreebsd*-gnu* | kopensolaris*-gnu*) + ;; + vxworks-simlinux | vxworks-simwindows | vxworks-spe) + ;; + nto-qnx*) + ;; + os2-emx) + ;; + *-eabi* | *-gnueabi*) + ;; + -*) + # Blank kernel with real OS is always fine. + ;; + *-*) + echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 + exit 1 + ;; +esac + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +case $vendor in + unknown) + case $cpu-$os in + *-riscix*) + vendor=acorn + ;; + *-sunos*) + vendor=sun + ;; + *-cnk* | *-aix*) + vendor=ibm + ;; + *-beos*) + vendor=be + ;; + *-hpux*) + vendor=hp + ;; + *-mpeix*) + vendor=hp + ;; + *-hiux*) + vendor=hitachi + ;; + *-unos*) + vendor=crds + ;; + *-dgux*) + vendor=dg + ;; + *-luna*) + vendor=omron + ;; + *-genix*) + vendor=ns + ;; + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) + vendor=ibm + ;; + s390-* | s390x-*) + vendor=ibm + ;; + *-ptx*) + vendor=sequent + ;; + *-tpf*) + vendor=ibm + ;; + *-vxsim* | *-vxworks* | *-windiss*) + vendor=wrs + ;; + *-aux*) + vendor=apple + ;; + *-hms*) + vendor=hitachi + ;; + *-mpw* | *-macos*) + vendor=apple + ;; + *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) + vendor=atari + ;; + *-vos*) + vendor=stratus + ;; + esac + ;; +esac + +echo "$cpu-$vendor-${kernel:+$kernel-}$os" +exit + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/vendor/unuran-1.11.0/autoconf/depcomp b/vendor/unuran-1.11.0/autoconf/depcomp new file mode 100755 index 0000000..715e343 --- /dev/null +++ b/vendor/unuran-1.11.0/autoconf/depcomp @@ -0,0 +1,791 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by 'PROGRAMS ARGS'. + object Object file output by 'PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputting dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +# Get the directory component of the given path, and save it in the +# global variables '$dir'. Note that this directory component will +# be either empty or ending with a '/' character. This is deliberate. +set_dir_from () +{ + case $1 in + */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; + *) dir=;; + esac +} + +# Get the suffix-stripped basename of the given path, and save it the +# global variable '$base'. +set_base_from () +{ + base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` +} + +# If no dependency file was actually created by the compiler invocation, +# we still have to create a dummy depfile, to avoid errors with the +# Makefile "include basename.Plo" scheme. +make_dummy_depfile () +{ + echo "#dummy" > "$depfile" +} + +# Factor out some common post-processing of the generated depfile. +# Requires the auxiliary global variable '$tmpdepfile' to be set. +aix_post_process_depfile () +{ + # If the compiler actually managed to produce a dependency file, + # post-process it. + if test -f "$tmpdepfile"; then + # Each line is of the form 'foo.o: dependency.h'. + # Do two passes, one to just change these to + # $object: dependency.h + # and one to simply output + # dependency.h: + # which is needed to avoid the deleted-header problem. + { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" + sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" + } > "$depfile" + rm -f "$tmpdepfile" + else + make_dummy_depfile + fi +} + +# A tabulation character. +tab=' ' +# A newline character. +nl=' +' +# Character ranges might be problematic outside the C locale. +# These definitions help. +upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ +lower=abcdefghijklmnopqrstuvwxyz +digits=0123456789 +alpha=${upper}${lower} + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Avoid interferences from the environment. +gccflag= dashmflag= + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvisualcpp +fi + +if test "$depmode" = msvc7msys; then + # This is just like msvc7 but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvc7 +fi + +if test "$depmode" = xlc; then + # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. + gccflag=-qmakedep=gcc,-MF + depmode=gcc +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. +## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. +## (see the conditional assignment to $gccflag above). +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). Also, it might not be +## supported by the other compilers which use the 'gcc' depmode. +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The second -e expression handles DOS-style file names with drive + # letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the "deleted header file" problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. +## Some versions of gcc put a space before the ':'. On the theory +## that the space means something, we add a space to the output as +## well. hp depmode also adds that space, but also prefixes the VPATH +## to the object. Take care to not repeat it in the output. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like '#:fec' to the end of the + # dependency line. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ + | tr "$nl" ' ' >> "$depfile" + echo >> "$depfile" + # The second pass generates a dummy entry for each header file. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" + ;; + +xlc) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts '$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + aix_post_process_depfile + ;; + +tcc) + # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 + # FIXME: That version still under development at the moment of writing. + # Make that this statement remains true also for stable, released + # versions. + # It will wrap lines (doesn't matter whether long or short) with a + # trailing '\', as in: + # + # foo.o : \ + # foo.c \ + # foo.h \ + # + # It will put a trailing '\' even on the last line, and will use leading + # spaces rather than leading tabs (at least since its commit 0394caf7 + # "Emit spaces for -MD"). + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. + # We have to change lines of the first kind to '$object: \'. + sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" + # And for each line of the second kind, we have to emit a 'dep.h:' + # dummy dependency, to avoid the deleted-header problem. + sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" + rm -f "$tmpdepfile" + ;; + +## The order of this option in the case statement is important, since the +## shell code in configure will try each of these formats in the order +## listed in this file. A plain '-MD' option would be understood by many +## compilers, so we must ensure this comes after the gcc and icc options. +pgcc) + # Portland's C compiler understands '-MD'. + # Will always output deps to 'file.d' where file is the root name of the + # source file under compilation, even if file resides in a subdirectory. + # The object file name does not affect the name of the '.d' file. + # pgcc 10.2 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using '\' : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + set_dir_from "$object" + # Use the source, not the object, to determine the base name, since + # that's sadly what pgcc will do too. + set_base_from "$source" + tmpdepfile=$base.d + + # For projects that build the same source file twice into different object + # files, the pgcc approach of using the *source* file root name can cause + # problems in parallel builds. Use a locking strategy to avoid stomping on + # the same $tmpdepfile. + lockdir=$base.d-lock + trap " + echo '$0: caught signal, cleaning up...' >&2 + rmdir '$lockdir' + exit 1 + " 1 2 13 15 + numtries=100 + i=$numtries + while test $i -gt 0; do + # mkdir is a portable test-and-set. + if mkdir "$lockdir" 2>/dev/null; then + # This process acquired the lock. + "$@" -MD + stat=$? + # Release the lock. + rmdir "$lockdir" + break + else + # If the lock is being held by a different process, wait + # until the winning process is done or we timeout. + while test -d "$lockdir" && test $i -gt 0; do + sleep 1 + i=`expr $i - 1` + done + fi + i=`expr $i - 1` + done + trap - 1 2 13 15 + if test $i -le 0; then + echo "$0: failed to acquire lock after $numtries attempts" >&2 + echo "$0: check lockdir '$lockdir'" >&2 + exit 1 + fi + + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" + # Add 'dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in 'foo.d' instead, so we check for that too. + # Subdirectories are respected. + set_dir_from "$object" + set_base_from "$object" + + if test "$libtool" = yes; then + # Libtool generates 2 separate objects for the 2 libraries. These + # two compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir$base.o.d # libtool 1.5 + tmpdepfile2=$dir.libs/$base.o.d # Likewise. + tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + # Same post-processing that is required for AIX mode. + aix_post_process_depfile + ;; + +msvc7) + if test "$libtool" = yes; then + showIncludes=-Wc,-showIncludes + else + showIncludes=-showIncludes + fi + "$@" $showIncludes > "$tmpdepfile" + stat=$? + grep -v '^Note: including file: ' "$tmpdepfile" + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The first sed program below extracts the file names and escapes + # backslashes for cygpath. The second sed program outputs the file + # name when reading, but also accumulates all include files in the + # hold buffer in order to output them again at the end. This only + # works with sed implementations that can handle large buffers. + sed < "$tmpdepfile" -n ' +/^Note: including file: *\(.*\)/ { + s//\1/ + s/\\/\\\\/g + p +}' | $cygpath_u | sort -u | sed -n ' +s/ /\\ /g +s/\(.*\)/'"$tab"'\1 \\/p +s/.\(.*\) \\/\1:/ +H +$ { + s/.*/'"$tab"'/ + G + p +}' >> "$depfile" + echo >> "$depfile" # make sure the fragment doesn't end with a backslash + rm -f "$tmpdepfile" + ;; + +msvc7msys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for ':' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. + "$@" $dashmflag | + sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this sed invocation + # correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no eat=no + for arg + do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + if test $eat = yes; then + eat=no + continue + fi + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix=`echo "$object" | sed 's/^.*\././'` + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + # makedepend may prepend the VPATH from the source file name to the object. + # No need to regex-escape $object, excess matching of '.' is harmless. + sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process the last invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed '1,2d' "$tmpdepfile" \ + | tr ' ' "$nl" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E \ + | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + | sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + IFS=" " + for arg + do + case "$arg" in + -o) + shift + ;; + $object) + shift + ;; + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" + echo "$tab" >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/vendor/unuran-1.11.0/autoconf/install-sh b/vendor/unuran-1.11.0/autoconf/install-sh new file mode 100755 index 0000000..ec298b5 --- /dev/null +++ b/vendor/unuran-1.11.0/autoconf/install-sh @@ -0,0 +1,541 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2020-11-14.01; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# 'make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +tab=' ' +nl=' +' +IFS=" $tab$nl" + +# Set DOITPROG to "echo" to test this script. + +doit=${DOITPROG-} +doit_exec=${doit:-exec} + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +is_target_a_directory=possibly + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. + -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -p) cpprog="$cpprog -p";; + + -s) stripcmd=$stripprog;; + + -S) backupsuffix="$2" + shift;; + + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) is_target_a_directory=never;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename. + if test -d "$dst"; then + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac + dstdir_status=0 + else + dstdir=`dirname "$dst"` + test -d "$dstdir" + dstdir_status=$? + fi + fi + + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + oIFS=$IFS + IFS=/ + set -f + set fnord $dstdir + shift + set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + set +f && + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/vendor/unuran-1.11.0/autoconf/ltmain.sh b/vendor/unuran-1.11.0/autoconf/ltmain.sh new file mode 100644 index 0000000..d6256b7 --- /dev/null +++ b/vendor/unuran-1.11.0/autoconf/ltmain.sh @@ -0,0 +1,11447 @@ +#! /usr/bin/env sh +## DO NOT EDIT - This file generated from ./build-aux/ltmain.in +## by inline-source v2019-02-19.15 + +# libtool (GNU libtool) 2.4.7 +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996-2019, 2021-2022 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +PROGRAM=libtool +PACKAGE=libtool +VERSION=2.4.7 +package_revision=2.4.7 + + +## ------ ## +## Usage. ## +## ------ ## + +# Run './libtool --help' for help with using this script from the +# command line. + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# After configure completes, it has a better idea of some of the +# shell tools we need than the defaults used by the functions shared +# with bootstrap, so set those here where they can still be over- +# ridden by the user, but otherwise take precedence. + +: ${AUTOCONF="autoconf"} +: ${AUTOMAKE="automake"} + + +## -------------------------- ## +## Source external libraries. ## +## -------------------------- ## + +# Much of our low-level functionality needs to be sourced from external +# libraries, which are installed to $pkgauxdir. + +# Set a version string for this script. +scriptversion=2019-02-19.15; # UTC + +# General shell script boiler plate, and helper functions. +# Written by Gary V. Vaughan, 2004 + +# This is free software. There is NO warranty; not even for +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Copyright (C) 2004-2019, 2021 Bootstrap Authors +# +# This file is dual licensed under the terms of the MIT license +# , and GPL version 2 or later +# . You must apply one of +# these licenses when using or redistributing this software or any of +# the files within it. See the URLs above, or the file `LICENSE` +# included in the Bootstrap distribution for the full license texts. + +# Please report bugs or propose patches to: +# + + +## ------ ## +## Usage. ## +## ------ ## + +# Evaluate this file near the top of your script to gain access to +# the functions and variables defined here: +# +# . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh +# +# If you need to override any of the default environment variable +# settings, do that before evaluating this file. + + +## -------------------- ## +## Shell normalisation. ## +## -------------------- ## + +# Some shells need a little help to be as Bourne compatible as possible. +# Before doing anything else, make sure all that help has been provided! + +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac +fi + +# NLS nuisances: We save the old values in case they are required later. +_G_user_locale= +_G_safe_locale= +for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test set = \"\${$_G_var+set}\"; then + save_$_G_var=\$$_G_var + $_G_var=C + export $_G_var + _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" + _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" + fi" +done +# These NLS vars are set unconditionally (bootstrap issue #24). Unset those +# in case the environment reset is needed later and the $save_* variant is not +# defined (see the code above). +LC_ALL=C +LANGUAGE=C +export LANGUAGE LC_ALL + +# Make sure IFS has a sensible default +sp=' ' +nl=' +' +IFS="$sp $nl" + +# There are apparently some retarded systems that use ';' as a PATH separator! +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# func_unset VAR +# -------------- +# Portably unset VAR. +# In some shells, an 'unset VAR' statement leaves a non-zero return +# status if VAR is already unset, which might be problematic if the +# statement is used at the end of a function (thus poisoning its return +# value) or when 'set -e' is active (causing even a spurious abort of +# the script in this case). +func_unset () +{ + { eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; } +} + + +# Make sure CDPATH doesn't cause `cd` commands to output the target dir. +func_unset CDPATH + +# Make sure ${,E,F}GREP behave sanely. +func_unset GREP_OPTIONS + + +## ------------------------- ## +## Locate command utilities. ## +## ------------------------- ## + + +# func_executable_p FILE +# ---------------------- +# Check that FILE is an executable regular file. +func_executable_p () +{ + test -f "$1" && test -x "$1" +} + + +# func_path_progs PROGS_LIST CHECK_FUNC [PATH] +# -------------------------------------------- +# Search for either a program that responds to --version with output +# containing "GNU", or else returned by CHECK_FUNC otherwise, by +# trying all the directories in PATH with each of the elements of +# PROGS_LIST. +# +# CHECK_FUNC should accept the path to a candidate program, and +# set $func_check_prog_result if it truncates its output less than +# $_G_path_prog_max characters. +func_path_progs () +{ + _G_progs_list=$1 + _G_check_func=$2 + _G_PATH=${3-"$PATH"} + + _G_path_prog_max=0 + _G_path_prog_found=false + _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} + for _G_dir in $_G_PATH; do + IFS=$_G_save_IFS + test -z "$_G_dir" && _G_dir=. + for _G_prog_name in $_G_progs_list; do + for _exeext in '' .EXE; do + _G_path_prog=$_G_dir/$_G_prog_name$_exeext + func_executable_p "$_G_path_prog" || continue + case `"$_G_path_prog" --version 2>&1` in + *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; + *) $_G_check_func $_G_path_prog + func_path_progs_result=$func_check_prog_result + ;; + esac + $_G_path_prog_found && break 3 + done + done + done + IFS=$_G_save_IFS + test -z "$func_path_progs_result" && { + echo "no acceptable sed could be found in \$PATH" >&2 + exit 1 + } +} + + +# We want to be able to use the functions in this file before configure +# has figured out where the best binaries are kept, which means we have +# to search for them ourselves - except when the results are already set +# where we skip the searches. + +# Unless the user overrides by setting SED, search the path for either GNU +# sed, or the sed that truncates its output the least. +test -z "$SED" && { + _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for _G_i in 1 2 3 4 5 6 7; do + _G_sed_script=$_G_sed_script$nl$_G_sed_script + done + echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed + _G_sed_script= + + func_check_prog_sed () + { + _G_path_prog=$1 + + _G_count=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo '' >> conftest.nl + "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "sed gsed" func_check_prog_sed "$PATH:/usr/xpg4/bin" + rm -f conftest.sed + SED=$func_path_progs_result +} + + +# Unless the user overrides by setting GREP, search the path for either GNU +# grep, or the grep that truncates its output the least. +test -z "$GREP" && { + func_check_prog_grep () + { + _G_path_prog=$1 + + _G_count=0 + _G_path_prog_max=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo 'GREP' >> conftest.nl + "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "grep ggrep" func_check_prog_grep "$PATH:/usr/xpg4/bin" + GREP=$func_path_progs_result +} + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# All uppercase variable names are used for environment variables. These +# variables can be overridden by the user before calling a script that +# uses them if a suitable command of that name is not already available +# in the command search PATH. + +: ${CP="cp -f"} +: ${ECHO="printf %s\n"} +: ${EGREP="$GREP -E"} +: ${FGREP="$GREP -F"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} + + +## -------------------- ## +## Useful sed snippets. ## +## -------------------- ## + +sed_dirname='s|/[^/]*$||' +sed_basename='s|^.*/||' + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='s|\([`"$\\]\)|\\\1|g' + +# Same as above, but do not quote variable references. +sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' + +# Sed substitution that converts a w32 file name or path +# that contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + +# Re-'\' parameter expansions in output of sed_double_quote_subst that +# were '\'-ed in input to the same. If an odd number of '\' preceded a +# '$' in input to sed_double_quote_subst, that '$' was protected from +# expansion. Since each input '\' is now two '\'s, look for any number +# of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. +_G_bs='\\' +_G_bs2='\\\\' +_G_bs4='\\\\\\\\' +_G_dollar='\$' +sed_double_backslash="\ + s/$_G_bs4/&\\ +/g + s/^$_G_bs2$_G_dollar/$_G_bs&/ + s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g + s/\n//g" + +# require_check_ifs_backslash +# --------------------------- +# Check if we can use backslash as IFS='\' separator, and set +# $check_ifs_backshlash_broken to ':' or 'false'. +require_check_ifs_backslash=func_require_check_ifs_backslash +func_require_check_ifs_backslash () +{ + _G_save_IFS=$IFS + IFS='\' + _G_check_ifs_backshlash='a\\b' + for _G_i in $_G_check_ifs_backshlash + do + case $_G_i in + a) + check_ifs_backshlash_broken=false + ;; + '') + break + ;; + *) + check_ifs_backshlash_broken=: + break + ;; + esac + done + IFS=$_G_save_IFS + require_check_ifs_backslash=: +} + + +## ----------------- ## +## Global variables. ## +## ----------------- ## + +# Except for the global variables explicitly listed below, the following +# functions in the '^func_' namespace, and the '^require_' namespace +# variables initialised in the 'Resource management' section, sourcing +# this file will not pollute your global namespace with anything +# else. There's no portable way to scope variables in Bourne shell +# though, so actually running these functions will sometimes place +# results into a variable named after the function, and often use +# temporary variables in the '^_G_' namespace. If you are careful to +# avoid using those namespaces casually in your sourcing script, things +# should continue to work as you expect. And, of course, you can freely +# overwrite any of the functions or variables defined here before +# calling anything to customize them. + +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +# Allow overriding, eg assuming that you follow the convention of +# putting '$debug_cmd' at the start of all your functions, you can get +# bash to show function call trace with: +# +# debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name +debug_cmd=${debug_cmd-":"} +exit_cmd=: + +# By convention, finish your script with: +# +# exit $exit_status +# +# so that you can set exit_status to non-zero if you want to indicate +# something went wrong during execution without actually bailing out at +# the point of failure. +exit_status=$EXIT_SUCCESS + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath=$0 + +# The name of this program. +progname=`$ECHO "$progpath" |$SED "$sed_basename"` + +# Make sure we have an absolute progpath for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` + progdir=`cd "$progdir" && pwd` + progpath=$progdir/$progname + ;; + *) + _G_IFS=$IFS + IFS=${PATH_SEPARATOR-:} + for progdir in $PATH; do + IFS=$_G_IFS + test -x "$progdir/$progname" && break + done + IFS=$_G_IFS + test -n "$progdir" || progdir=`pwd` + progpath=$progdir/$progname + ;; +esac + + +## ----------------- ## +## Standard options. ## +## ----------------- ## + +# The following options affect the operation of the functions defined +# below, and should be set appropriately depending on run-time para- +# meters passed on the command line. + +opt_dry_run=false +opt_quiet=false +opt_verbose=false + +# Categories 'all' and 'none' are always available. Append any others +# you will pass as the first argument to func_warning from your own +# code. +warning_categories= + +# By default, display warnings according to 'opt_warning_types'. Set +# 'warning_func' to ':' to elide all warnings, or func_fatal_error to +# treat the next displayed warning as a fatal error. +warning_func=func_warn_and_continue + +# Set to 'all' to display all warnings, 'none' to suppress all +# warnings, or a space delimited list of some subset of +# 'warning_categories' to display only the listed warnings. +opt_warning_types=all + + +## -------------------- ## +## Resource management. ## +## -------------------- ## + +# This section contains definitions for functions that each ensure a +# particular resource (a file, or a non-empty configuration variable for +# example) is available, and if appropriate to extract default values +# from pertinent package files. Call them using their associated +# 'require_*' variable to ensure that they are executed, at most, once. +# +# It's entirely deliberate that calling these functions can set +# variables that don't obey the namespace limitations obeyed by the rest +# of this file, in order that that they be as useful as possible to +# callers. + + +# require_term_colors +# ------------------- +# Allow display of bold text on terminals that support it. +require_term_colors=func_require_term_colors +func_require_term_colors () +{ + $debug_cmd + + test -t 1 && { + # COLORTERM and USE_ANSI_COLORS environment variables take + # precedence, because most terminfo databases neglect to describe + # whether color sequences are supported. + test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} + + if test 1 = "$USE_ANSI_COLORS"; then + # Standard ANSI escape sequences + tc_reset='' + tc_bold=''; tc_standout='' + tc_red=''; tc_green='' + tc_blue=''; tc_cyan='' + else + # Otherwise trust the terminfo database after all. + test -n "`tput sgr0 2>/dev/null`" && { + tc_reset=`tput sgr0` + test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` + tc_standout=$tc_bold + test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` + test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` + test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` + test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` + test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` + } + fi + } + + require_term_colors=: +} + + +## ----------------- ## +## Function library. ## +## ----------------- ## + +# This section contains a variety of useful functions to call in your +# scripts. Take note of the portable wrappers for features provided by +# some modern shells, which will fall back to slower equivalents on +# less featureful shells. + + +# func_append VAR VALUE +# --------------------- +# Append VALUE onto the existing contents of VAR. + + # We should try to minimise forks, especially on Windows where they are + # unreasonably slow, so skip the feature probes when bash or zsh are + # being used: + if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then + : ${_G_HAVE_ARITH_OP="yes"} + : ${_G_HAVE_XSI_OPS="yes"} + # The += operator was introduced in bash 3.1 + case $BASH_VERSION in + [12].* | 3.0 | 3.0*) ;; + *) + : ${_G_HAVE_PLUSEQ_OP="yes"} + ;; + esac + fi + + # _G_HAVE_PLUSEQ_OP + # Can be empty, in which case the shell is probed, "yes" if += is + # useable or anything else if it does not work. + test -z "$_G_HAVE_PLUSEQ_OP" \ + && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ + && _G_HAVE_PLUSEQ_OP=yes + +if test yes = "$_G_HAVE_PLUSEQ_OP" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_append () + { + $debug_cmd + + eval "$1+=\$2" + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_append () + { + $debug_cmd + + eval "$1=\$$1\$2" + } +fi + + +# func_append_quoted VAR VALUE +# ---------------------------- +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +if test yes = "$_G_HAVE_PLUSEQ_OP"; then + eval 'func_append_quoted () + { + $debug_cmd + + func_quote_arg pretty "$2" + eval "$1+=\\ \$func_quote_arg_result" + }' +else + func_append_quoted () + { + $debug_cmd + + func_quote_arg pretty "$2" + eval "$1=\$$1\\ \$func_quote_arg_result" + } +fi + + +# func_append_uniq VAR VALUE +# -------------------------- +# Append unique VALUE onto the existing contents of VAR, assuming +# entries are delimited by the first character of VALUE. For example: +# +# func_append_uniq options " --another-option option-argument" +# +# will only append to $options if " --another-option option-argument " +# is not already present somewhere in $options already (note spaces at +# each end implied by leading space in second argument). +func_append_uniq () +{ + $debug_cmd + + eval _G_current_value='`$ECHO $'$1'`' + _G_delim=`expr "$2" : '\(.\)'` + + case $_G_delim$_G_current_value$_G_delim in + *"$2$_G_delim"*) ;; + *) func_append "$@" ;; + esac +} + + +# func_arith TERM... +# ------------------ +# Set func_arith_result to the result of evaluating TERMs. + test -z "$_G_HAVE_ARITH_OP" \ + && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ + && _G_HAVE_ARITH_OP=yes + +if test yes = "$_G_HAVE_ARITH_OP"; then + eval 'func_arith () + { + $debug_cmd + + func_arith_result=$(( $* )) + }' +else + func_arith () + { + $debug_cmd + + func_arith_result=`expr "$@"` + } +fi + + +# func_basename FILE +# ------------------ +# Set func_basename_result to FILE with everything up to and including +# the last / stripped. +if test yes = "$_G_HAVE_XSI_OPS"; then + # If this shell supports suffix pattern removal, then use it to avoid + # forking. Hide the definitions single quotes in case the shell chokes + # on unsupported syntax... + _b='func_basename_result=${1##*/}' + _d='case $1 in + */*) func_dirname_result=${1%/*}$2 ;; + * ) func_dirname_result=$3 ;; + esac' + +else + # ...otherwise fall back to using sed. + _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' + _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` + if test "X$func_dirname_result" = "X$1"; then + func_dirname_result=$3 + else + func_append func_dirname_result "$2" + fi' +fi + +eval 'func_basename () +{ + $debug_cmd + + '"$_b"' +}' + + +# func_dirname FILE APPEND NONDIR_REPLACEMENT +# ------------------------------------------- +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +eval 'func_dirname () +{ + $debug_cmd + + '"$_d"' +}' + + +# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT +# -------------------------------------------------------- +# Perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# For efficiency, we do not delegate to the functions above but instead +# duplicate the functionality here. +eval 'func_dirname_and_basename () +{ + $debug_cmd + + '"$_b"' + '"$_d"' +}' + + +# func_echo ARG... +# ---------------- +# Echo program name prefixed message. +func_echo () +{ + $debug_cmd + + _G_message=$* + + func_echo_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS + $ECHO "$progname: $_G_line" + done + IFS=$func_echo_IFS +} + + +# func_echo_all ARG... +# -------------------- +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + + +# func_echo_infix_1 INFIX ARG... +# ------------------------------ +# Echo program name, followed by INFIX on the first line, with any +# additional lines not showing INFIX. +func_echo_infix_1 () +{ + $debug_cmd + + $require_term_colors + + _G_infix=$1; shift + _G_indent=$_G_infix + _G_prefix="$progname: $_G_infix: " + _G_message=$* + + # Strip color escape sequences before counting printable length + for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" + do + test -n "$_G_tc" && { + _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` + _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` + } + done + _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes + + func_echo_infix_1_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_infix_1_IFS + $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 + _G_prefix=$_G_indent + done + IFS=$func_echo_infix_1_IFS +} + + +# func_error ARG... +# ----------------- +# Echo program name prefixed message to standard error. +func_error () +{ + $debug_cmd + + $require_term_colors + + func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 +} + + +# func_fatal_error ARG... +# ----------------------- +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + $debug_cmd + + func_error "$*" + exit $EXIT_FAILURE +} + + +# func_grep EXPRESSION FILENAME +# ----------------------------- +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $debug_cmd + + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_len STRING +# --------------- +# Set func_len_result to the length of STRING. STRING may not +# start with a hyphen. + test -z "$_G_HAVE_XSI_OPS" \ + && (eval 'x=a/b/c; + test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ + && _G_HAVE_XSI_OPS=yes + +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_len () + { + $debug_cmd + + func_len_result=${#1} + }' +else + func_len () + { + $debug_cmd + + func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` + } +fi + + +# func_mkdir_p DIRECTORY-PATH +# --------------------------- +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + $debug_cmd + + _G_directory_path=$1 + _G_dir_list= + + if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then + + # Protect directory names starting with '-' + case $_G_directory_path in + -*) _G_directory_path=./$_G_directory_path ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$_G_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + _G_dir_list=$_G_directory_path:$_G_dir_list + + # If the last portion added has no slash in it, the list is done + case $_G_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` + done + _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` + + func_mkdir_p_IFS=$IFS; IFS=: + for _G_dir in $_G_dir_list; do + IFS=$func_mkdir_p_IFS + # mkdir can fail with a 'File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$_G_dir" 2>/dev/null || : + done + IFS=$func_mkdir_p_IFS + + # Bail out if we (or some other process) failed to create a directory. + test -d "$_G_directory_path" || \ + func_fatal_error "Failed to create '$1'" + fi +} + + +# func_mktempdir [BASENAME] +# ------------------------- +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, BASENAME is the basename for that directory. +func_mktempdir () +{ + $debug_cmd + + _G_template=${TMPDIR-/tmp}/${1-$progname} + + if test : = "$opt_dry_run"; then + # Return a directory name, but don't create it in dry-run mode + _G_tmpdir=$_G_template-$$ + else + + # If mktemp works, use that first and foremost + _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` + + if test ! -d "$_G_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + _G_tmpdir=$_G_template-${RANDOM-0}$$ + + func_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$_G_tmpdir" + umask $func_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$_G_tmpdir" || \ + func_fatal_error "cannot create temporary directory '$_G_tmpdir'" + fi + + $ECHO "$_G_tmpdir" +} + + +# func_normal_abspath PATH +# ------------------------ +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +func_normal_abspath () +{ + $debug_cmd + + # These SED scripts presuppose an absolute path with a trailing slash. + _G_pathcar='s|^/\([^/]*\).*$|\1|' + _G_pathcdr='s|^/[^/]*||' + _G_removedotparts=':dotsl + s|/\./|/|g + t dotsl + s|/\.$|/|' + _G_collapseslashes='s|/\{1,\}|/|g' + _G_finalslash='s|/*$|/|' + + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` + while :; do + # Processed it all yet? + if test / = "$func_normal_abspath_tpath"; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result"; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + + +# func_notquiet ARG... +# -------------------- +# Echo program name prefixed message only when not in quiet mode. +func_notquiet () +{ + $debug_cmd + + $opt_quiet || func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + + +# func_relative_path SRCDIR DSTDIR +# -------------------------------- +# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. +func_relative_path () +{ + $debug_cmd + + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=$func_dirname_result + if test -z "$func_relative_path_tlibdir"; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test -n "$func_stripname_result"; then + func_append func_relative_path_result "/$func_stripname_result" + fi + + # Normalisation. If bindir is libdir, return '.' else relative path. + if test -n "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + fi + + test -n "$func_relative_path_result" || func_relative_path_result=. + + : +} + + +# func_quote_portable EVAL ARG +# ---------------------------- +# Internal function to portably implement func_quote_arg. Note that we still +# keep attention to performance here so we as much as possible try to avoid +# calling sed binary (so far O(N) complexity as long as func_append is O(1)). +func_quote_portable () +{ + $debug_cmd + + $require_check_ifs_backslash + + func_quote_portable_result=$2 + + # one-time-loop (easy break) + while true + do + if $1; then + func_quote_portable_result=`$ECHO "$2" | $SED \ + -e "$sed_double_quote_subst" -e "$sed_double_backslash"` + break + fi + + # Quote for eval. + case $func_quote_portable_result in + *[\\\`\"\$]*) + # Fallback to sed for $func_check_bs_ifs_broken=:, or when the string + # contains the shell wildcard characters. + case $check_ifs_backshlash_broken$func_quote_portable_result in + :*|*[\[\*\?]*) + func_quote_portable_result=`$ECHO "$func_quote_portable_result" \ + | $SED "$sed_quote_subst"` + break + ;; + esac + + func_quote_portable_old_IFS=$IFS + for _G_char in '\' '`' '"' '$' + do + # STATE($1) PREV($2) SEPARATOR($3) + set start "" "" + func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy + IFS=$_G_char + for _G_part in $func_quote_portable_result + do + case $1 in + quote) + func_append func_quote_portable_result "$3$2" + set quote "$_G_part" "\\$_G_char" + ;; + start) + set first "" "" + func_quote_portable_result= + ;; + first) + set quote "$_G_part" "" + ;; + esac + done + done + IFS=$func_quote_portable_old_IFS + ;; + *) ;; + esac + break + done + + func_quote_portable_unquoted_result=$func_quote_portable_result + case $func_quote_portable_result in + # double-quote args containing shell metacharacters to delay + # word splitting, command substitution and variable expansion + # for a subsequent eval. + # many bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_portable_result=\"$func_quote_portable_result\" + ;; + esac +} + + +# func_quotefast_eval ARG +# ----------------------- +# Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG', +# but optimized for speed. Result is stored in $func_quotefast_eval. +if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then + printf -v _GL_test_printf_tilde %q '~' + if test '\~' = "$_GL_test_printf_tilde"; then + func_quotefast_eval () + { + printf -v func_quotefast_eval_result %q "$1" + } + else + # Broken older Bash implementations. Make those faster too if possible. + func_quotefast_eval () + { + case $1 in + '~'*) + func_quote_portable false "$1" + func_quotefast_eval_result=$func_quote_portable_result + ;; + *) + printf -v func_quotefast_eval_result %q "$1" + ;; + esac + } + fi +else + func_quotefast_eval () + { + func_quote_portable false "$1" + func_quotefast_eval_result=$func_quote_portable_result + } +fi + + +# func_quote_arg MODEs ARG +# ------------------------ +# Quote one ARG to be evaled later. MODEs argument may contain zero or more +# specifiers listed below separated by ',' character. This function returns two +# values: +# i) func_quote_arg_result +# double-quoted (when needed), suitable for a subsequent eval +# ii) func_quote_arg_unquoted_result +# has all characters that are still active within double +# quotes backslashified. Available only if 'unquoted' is specified. +# +# Available modes: +# ---------------- +# 'eval' (default) +# - escape shell special characters +# 'expand' +# - the same as 'eval'; but do not quote variable references +# 'pretty' +# - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might +# be used later in func_quote to get output like: 'echo "a b"' instead +# of 'echo a\ b'. This is slower than default on some shells. +# 'unquoted' +# - produce also $func_quote_arg_unquoted_result which does not contain +# wrapping double-quotes. +# +# Examples for 'func_quote_arg pretty,unquoted string': +# +# string | *_result | *_unquoted_result +# ------------+-----------------------+------------------- +# " | \" | \" +# a b | "a b" | a b +# "a b" | "\"a b\"" | \"a b\" +# * | "*" | * +# z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\" +# +# Examples for 'func_quote_arg pretty,unquoted,expand string': +# +# string | *_result | *_unquoted_result +# --------------+---------------------+-------------------- +# z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\" +func_quote_arg () +{ + _G_quote_expand=false + case ,$1, in + *,expand,*) + _G_quote_expand=: + ;; + esac + + case ,$1, in + *,pretty,*|*,expand,*|*,unquoted,*) + func_quote_portable $_G_quote_expand "$2" + func_quote_arg_result=$func_quote_portable_result + func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result + ;; + *) + # Faster quote-for-eval for some shells. + func_quotefast_eval "$2" + func_quote_arg_result=$func_quotefast_eval_result + ;; + esac +} + + +# func_quote MODEs ARGs... +# ------------------------ +# Quote all ARGs to be evaled later and join them into single command. See +# func_quote_arg's description for more info. +func_quote () +{ + $debug_cmd + _G_func_quote_mode=$1 ; shift + func_quote_result= + while test 0 -lt $#; do + func_quote_arg "$_G_func_quote_mode" "$1" + if test -n "$func_quote_result"; then + func_append func_quote_result " $func_quote_arg_result" + else + func_append func_quote_result "$func_quote_arg_result" + fi + shift + done +} + + +# func_stripname PREFIX SUFFIX NAME +# --------------------------------- +# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_stripname () + { + $debug_cmd + + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary variable first. + func_stripname_result=$3 + func_stripname_result=${func_stripname_result#"$1"} + func_stripname_result=${func_stripname_result%"$2"} + }' +else + func_stripname () + { + $debug_cmd + + case $2 in + .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; + *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; + esac + } +fi + + +# func_show_eval CMD [FAIL_EXP] +# ----------------------------- +# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + $debug_cmd + + _G_cmd=$1 + _G_fail_exp=${2-':'} + + func_quote_arg pretty,expand "$_G_cmd" + eval "func_notquiet $func_quote_arg_result" + + $opt_dry_run || { + eval "$_G_cmd" + _G_status=$? + if test 0 -ne "$_G_status"; then + eval "(exit $_G_status); $_G_fail_exp" + fi + } +} + + +# func_show_eval_locale CMD [FAIL_EXP] +# ------------------------------------ +# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + $debug_cmd + + _G_cmd=$1 + _G_fail_exp=${2-':'} + + $opt_quiet || { + func_quote_arg expand,pretty "$_G_cmd" + eval "func_echo $func_quote_arg_result" + } + + $opt_dry_run || { + eval "$_G_user_locale + $_G_cmd" + _G_status=$? + eval "$_G_safe_locale" + if test 0 -ne "$_G_status"; then + eval "(exit $_G_status); $_G_fail_exp" + fi + } +} + + +# func_tr_sh +# ---------- +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + $debug_cmd + + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} + + +# func_verbose ARG... +# ------------------- +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $debug_cmd + + $opt_verbose && func_echo "$*" + + : +} + + +# func_warn_and_continue ARG... +# ----------------------------- +# Echo program name prefixed warning message to standard error. +func_warn_and_continue () +{ + $debug_cmd + + $require_term_colors + + func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 +} + + +# func_warning CATEGORY ARG... +# ---------------------------- +# Echo program name prefixed warning message to standard error. Warning +# messages can be filtered according to CATEGORY, where this function +# elides messages where CATEGORY is not listed in the global variable +# 'opt_warning_types'. +func_warning () +{ + $debug_cmd + + # CATEGORY must be in the warning_categories list! + case " $warning_categories " in + *" $1 "*) ;; + *) func_internal_error "invalid warning category '$1'" ;; + esac + + _G_category=$1 + shift + + case " $opt_warning_types " in + *" $_G_category "*) $warning_func ${1+"$@"} ;; + esac +} + + +# func_sort_ver VER1 VER2 +# ----------------------- +# 'sort -V' is not generally available. +# Note this deviates from the version comparison in automake +# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a +# but this should suffice as we won't be specifying old +# version formats or redundant trailing .0 in bootstrap.conf. +# If we did want full compatibility then we should probably +# use m4_version_compare from autoconf. +func_sort_ver () +{ + $debug_cmd + + printf '%s\n%s\n' "$1" "$2" \ + | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n +} + +# func_lt_ver PREV CURR +# --------------------- +# Return true if PREV and CURR are in the correct order according to +# func_sort_ver, otherwise false. Use it like this: +# +# func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." +func_lt_ver () +{ + $debug_cmd + + test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` +} + + +# Local variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-time-zone: "UTC" +# End: +#! /bin/sh + +# A portable, pluggable option parser for Bourne shell. +# Written by Gary V. Vaughan, 2010 + +# This is free software. There is NO warranty; not even for +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Copyright (C) 2010-2019, 2021 Bootstrap Authors +# +# This file is dual licensed under the terms of the MIT license +# , and GPL version 2 or later +# . You must apply one of +# these licenses when using or redistributing this software or any of +# the files within it. See the URLs above, or the file `LICENSE` +# included in the Bootstrap distribution for the full license texts. + +# Please report bugs or propose patches to: +# + +# Set a version string for this script. +scriptversion=2019-02-19.15; # UTC + + +## ------ ## +## Usage. ## +## ------ ## + +# This file is a library for parsing options in your shell scripts along +# with assorted other useful supporting features that you can make use +# of too. +# +# For the simplest scripts you might need only: +# +# #!/bin/sh +# . relative/path/to/funclib.sh +# . relative/path/to/options-parser +# scriptversion=1.0 +# func_options ${1+"$@"} +# eval set dummy "$func_options_result"; shift +# ...rest of your script... +# +# In order for the '--version' option to work, you will need to have a +# suitably formatted comment like the one at the top of this file +# starting with '# Written by ' and ending with '# Copyright'. +# +# For '-h' and '--help' to work, you will also need a one line +# description of your script's purpose in a comment directly above the +# '# Written by ' line, like the one at the top of this file. +# +# The default options also support '--debug', which will turn on shell +# execution tracing (see the comment above debug_cmd below for another +# use), and '--verbose' and the func_verbose function to allow your script +# to display verbose messages only when your user has specified +# '--verbose'. +# +# After sourcing this file, you can plug in processing for additional +# options by amending the variables from the 'Configuration' section +# below, and following the instructions in the 'Option parsing' +# section further down. + +## -------------- ## +## Configuration. ## +## -------------- ## + +# You should override these variables in your script after sourcing this +# file so that they reflect the customisations you have added to the +# option parser. + +# The usage line for option parsing errors and the start of '-h' and +# '--help' output messages. You can embed shell variables for delayed +# expansion at the time the message is displayed, but you will need to +# quote other shell meta-characters carefully to prevent them being +# expanded when the contents are evaled. +usage='$progpath [OPTION]...' + +# Short help message in response to '-h' and '--help'. Add to this or +# override it after sourcing this library to reflect the full set of +# options your script accepts. +usage_message="\ + --debug enable verbose shell tracing + -W, --warnings=CATEGORY + report the warnings falling in CATEGORY [all] + -v, --verbose verbosely report processing + --version print version information and exit + -h, --help print short or long help message and exit +" + +# Additional text appended to 'usage_message' in response to '--help'. +long_help_message=" +Warning categories include: + 'all' show all warnings + 'none' turn off all the warnings + 'error' warnings are treated as fatal errors" + +# Help message printed before fatal option parsing errors. +fatal_help="Try '\$progname --help' for more information." + + + +## ------------------------- ## +## Hook function management. ## +## ------------------------- ## + +# This section contains functions for adding, removing, and running hooks +# in the main code. A hook is just a list of function names that can be +# run in order later on. + +# func_hookable FUNC_NAME +# ----------------------- +# Declare that FUNC_NAME will run hooks added with +# 'func_add_hook FUNC_NAME ...'. +func_hookable () +{ + $debug_cmd + + func_append hookable_fns " $1" +} + + +# func_add_hook FUNC_NAME HOOK_FUNC +# --------------------------------- +# Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must +# first have been declared "hookable" by a call to 'func_hookable'. +func_add_hook () +{ + $debug_cmd + + case " $hookable_fns " in + *" $1 "*) ;; + *) func_fatal_error "'$1' does not accept hook functions." ;; + esac + + eval func_append ${1}_hooks '" $2"' +} + + +# func_remove_hook FUNC_NAME HOOK_FUNC +# ------------------------------------ +# Remove HOOK_FUNC from the list of hook functions to be called by +# FUNC_NAME. +func_remove_hook () +{ + $debug_cmd + + eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' +} + + +# func_propagate_result FUNC_NAME_A FUNC_NAME_B +# --------------------------------------------- +# If the *_result variable of FUNC_NAME_A _is set_, assign its value to +# *_result variable of FUNC_NAME_B. +func_propagate_result () +{ + $debug_cmd + + func_propagate_result_result=: + if eval "test \"\${${1}_result+set}\" = set" + then + eval "${2}_result=\$${1}_result" + else + func_propagate_result_result=false + fi +} + + +# func_run_hooks FUNC_NAME [ARG]... +# --------------------------------- +# Run all hook functions registered to FUNC_NAME. +# It's assumed that the list of hook functions contains nothing more +# than a whitespace-delimited list of legal shell function names, and +# no effort is wasted trying to catch shell meta-characters or preserve +# whitespace. +func_run_hooks () +{ + $debug_cmd + + case " $hookable_fns " in + *" $1 "*) ;; + *) func_fatal_error "'$1' does not support hook functions." ;; + esac + + eval _G_hook_fns=\$$1_hooks; shift + + for _G_hook in $_G_hook_fns; do + func_unset "${_G_hook}_result" + eval $_G_hook '${1+"$@"}' + func_propagate_result $_G_hook func_run_hooks + if $func_propagate_result_result; then + eval set dummy "$func_run_hooks_result"; shift + fi + done +} + + + +## --------------- ## +## Option parsing. ## +## --------------- ## + +# In order to add your own option parsing hooks, you must accept the +# full positional parameter list from your hook function. You may remove +# or edit any options that you action, and then pass back the remaining +# unprocessed options in '_result', escaped +# suitably for 'eval'. +# +# The '_result' variable is automatically unset +# before your hook gets called; for best performance, only set the +# *_result variable when necessary (i.e. don't call the 'func_quote' +# function unnecessarily because it can be an expensive operation on some +# machines). +# +# Like this: +# +# my_options_prep () +# { +# $debug_cmd +# +# # Extend the existing usage message. +# usage_message=$usage_message' +# -s, --silent don'\''t print informational messages +# ' +# # No change in '$@' (ignored completely by this hook). Leave +# # my_options_prep_result variable intact. +# } +# func_add_hook func_options_prep my_options_prep +# +# +# my_silent_option () +# { +# $debug_cmd +# +# args_changed=false +# +# # Note that, for efficiency, we parse as many options as we can +# # recognise in a loop before passing the remainder back to the +# # caller on the first unrecognised argument we encounter. +# while test $# -gt 0; do +# opt=$1; shift +# case $opt in +# --silent|-s) opt_silent=: +# args_changed=: +# ;; +# # Separate non-argument short options: +# -s*) func_split_short_opt "$_G_opt" +# set dummy "$func_split_short_opt_name" \ +# "-$func_split_short_opt_arg" ${1+"$@"} +# shift +# args_changed=: +# ;; +# *) # Make sure the first unrecognised option "$_G_opt" +# # is added back to "$@" in case we need it later, +# # if $args_changed was set to 'true'. +# set dummy "$_G_opt" ${1+"$@"}; shift; break ;; +# esac +# done +# +# # Only call 'func_quote' here if we processed at least one argument. +# if $args_changed; then +# func_quote eval ${1+"$@"} +# my_silent_option_result=$func_quote_result +# fi +# } +# func_add_hook func_parse_options my_silent_option +# +# +# my_option_validation () +# { +# $debug_cmd +# +# $opt_silent && $opt_verbose && func_fatal_help "\ +# '--silent' and '--verbose' options are mutually exclusive." +# } +# func_add_hook func_validate_options my_option_validation +# +# You'll also need to manually amend $usage_message to reflect the extra +# options you parse. It's preferable to append if you can, so that +# multiple option parsing hooks can be added safely. + + +# func_options_finish [ARG]... +# ---------------------------- +# Finishing the option parse loop (call 'func_options' hooks ATM). +func_options_finish () +{ + $debug_cmd + + func_run_hooks func_options ${1+"$@"} + func_propagate_result func_run_hooks func_options_finish +} + + +# func_options [ARG]... +# --------------------- +# All the functions called inside func_options are hookable. See the +# individual implementations for details. +func_hookable func_options +func_options () +{ + $debug_cmd + + _G_options_quoted=false + + for my_func in options_prep parse_options validate_options options_finish + do + func_unset func_${my_func}_result + func_unset func_run_hooks_result + eval func_$my_func '${1+"$@"}' + func_propagate_result func_$my_func func_options + if $func_propagate_result_result; then + eval set dummy "$func_options_result"; shift + _G_options_quoted=: + fi + done + + $_G_options_quoted || { + # As we (func_options) are top-level options-parser function and + # nobody quoted "$@" for us yet, we need to do it explicitly for + # caller. + func_quote eval ${1+"$@"} + func_options_result=$func_quote_result + } +} + + +# func_options_prep [ARG]... +# -------------------------- +# All initialisations required before starting the option parse loop. +# Note that when calling hook functions, we pass through the list of +# positional parameters. If a hook function modifies that list, and +# needs to propagate that back to rest of this script, then the complete +# modified list must be put in 'func_run_hooks_result' before returning. +func_hookable func_options_prep +func_options_prep () +{ + $debug_cmd + + # Option defaults: + opt_verbose=false + opt_warning_types= + + func_run_hooks func_options_prep ${1+"$@"} + func_propagate_result func_run_hooks func_options_prep +} + + +# func_parse_options [ARG]... +# --------------------------- +# The main option parsing loop. +func_hookable func_parse_options +func_parse_options () +{ + $debug_cmd + + _G_parse_options_requote=false + # this just eases exit handling + while test $# -gt 0; do + # Defer to hook functions for initial option parsing, so they + # get priority in the event of reusing an option name. + func_run_hooks func_parse_options ${1+"$@"} + func_propagate_result func_run_hooks func_parse_options + if $func_propagate_result_result; then + eval set dummy "$func_parse_options_result"; shift + # Even though we may have changed "$@", we passed the "$@" array + # down into the hook and it quoted it for us (because we are in + # this if-branch). No need to quote it again. + _G_parse_options_requote=false + fi + + # Break out of the loop if we already parsed every option. + test $# -gt 0 || break + + # We expect that one of the options parsed in this function matches + # and thus we remove _G_opt from "$@" and need to re-quote. + _G_match_parse_options=: + _G_opt=$1 + shift + case $_G_opt in + --debug|-x) debug_cmd='set -x' + func_echo "enabling shell trace mode" >&2 + $debug_cmd + ;; + + --no-warnings|--no-warning|--no-warn) + set dummy --warnings none ${1+"$@"} + shift + ;; + + --warnings|--warning|-W) + if test $# = 0 && func_missing_arg $_G_opt; then + _G_parse_options_requote=: + break + fi + case " $warning_categories $1" in + *" $1 "*) + # trailing space prevents matching last $1 above + func_append_uniq opt_warning_types " $1" + ;; + *all) + opt_warning_types=$warning_categories + ;; + *none) + opt_warning_types=none + warning_func=: + ;; + *error) + opt_warning_types=$warning_categories + warning_func=func_fatal_error + ;; + *) + func_fatal_error \ + "unsupported warning category: '$1'" + ;; + esac + shift + ;; + + --verbose|-v) opt_verbose=: ;; + --version) func_version ;; + -\?|-h) func_usage ;; + --help) func_help ;; + + # Separate optargs to long options (plugins may need this): + --*=*) func_split_equals "$_G_opt" + set dummy "$func_split_equals_lhs" \ + "$func_split_equals_rhs" ${1+"$@"} + shift + ;; + + # Separate optargs to short options: + -W*) + func_split_short_opt "$_G_opt" + set dummy "$func_split_short_opt_name" \ + "$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-v*|-x*) + func_split_short_opt "$_G_opt" + set dummy "$func_split_short_opt_name" \ + "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) _G_parse_options_requote=: ; break ;; + -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; + *) set dummy "$_G_opt" ${1+"$@"}; shift + _G_match_parse_options=false + break + ;; + esac + + if $_G_match_parse_options; then + _G_parse_options_requote=: + fi + done + + if $_G_parse_options_requote; then + # save modified positional parameters for caller + func_quote eval ${1+"$@"} + func_parse_options_result=$func_quote_result + fi +} + + +# func_validate_options [ARG]... +# ------------------------------ +# Perform any sanity checks on option settings and/or unconsumed +# arguments. +func_hookable func_validate_options +func_validate_options () +{ + $debug_cmd + + # Display all warnings if -W was not given. + test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" + + func_run_hooks func_validate_options ${1+"$@"} + func_propagate_result func_run_hooks func_validate_options + + # Bail if the options were screwed! + $exit_cmd $EXIT_FAILURE +} + + + +## ----------------- ## +## Helper functions. ## +## ----------------- ## + +# This section contains the helper functions used by the rest of the +# hookable option parser framework in ascii-betical order. + + +# func_fatal_help ARG... +# ---------------------- +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + $debug_cmd + + eval \$ECHO \""Usage: $usage"\" + eval \$ECHO \""$fatal_help"\" + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + + +# func_help +# --------- +# Echo long help message to standard output and exit. +func_help () +{ + $debug_cmd + + func_usage_message + $ECHO "$long_help_message" + exit 0 +} + + +# func_missing_arg ARGNAME +# ------------------------ +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + $debug_cmd + + func_error "Missing argument for '$1'." + exit_cmd=exit +} + + +# func_split_equals STRING +# ------------------------ +# Set func_split_equals_lhs and func_split_equals_rhs shell variables +# after splitting STRING at the '=' sign. +test -z "$_G_HAVE_XSI_OPS" \ + && (eval 'x=a/b/c; + test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ + && _G_HAVE_XSI_OPS=yes + +if test yes = "$_G_HAVE_XSI_OPS" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_split_equals () + { + $debug_cmd + + func_split_equals_lhs=${1%%=*} + func_split_equals_rhs=${1#*=} + if test "x$func_split_equals_lhs" = "x$1"; then + func_split_equals_rhs= + fi + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_split_equals () + { + $debug_cmd + + func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` + func_split_equals_rhs= + test "x$func_split_equals_lhs=" = "x$1" \ + || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` + } +fi #func_split_equals + + +# func_split_short_opt SHORTOPT +# ----------------------------- +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +if test yes = "$_G_HAVE_XSI_OPS" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_split_short_opt () + { + $debug_cmd + + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"} + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_split_short_opt () + { + $debug_cmd + + func_split_short_opt_name=`expr "x$1" : 'x\(-.\)'` + func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` + } +fi #func_split_short_opt + + +# func_usage +# ---------- +# Echo short help message to standard output and exit. +func_usage () +{ + $debug_cmd + + func_usage_message + $ECHO "Run '$progname --help |${PAGER-more}' for full usage" + exit 0 +} + + +# func_usage_message +# ------------------ +# Echo short help message to standard output. +func_usage_message () +{ + $debug_cmd + + eval \$ECHO \""Usage: $usage"\" + echo + $SED -n 's|^# || + /^Written by/{ + x;p;x + } + h + /^Written by/q' < "$progpath" + echo + eval \$ECHO \""$usage_message"\" +} + + +# func_version +# ------------ +# Echo version message to standard output and exit. +# The version message is extracted from the calling file's header +# comments, with leading '# ' stripped: +# 1. First display the progname and version +# 2. Followed by the header comment line matching /^# Written by / +# 3. Then a blank line followed by the first following line matching +# /^# Copyright / +# 4. Immediately followed by any lines between the previous matches, +# except lines preceding the intervening completely blank line. +# For example, see the header comments of this file. +func_version () +{ + $debug_cmd + + printf '%s\n' "$progname $scriptversion" + $SED -n ' + /^# Written by /!b + s|^# ||; p; n + + :fwd2blnk + /./ { + n + b fwd2blnk + } + p; n + + :holdwrnt + s|^# || + s|^# *$|| + /^Copyright /!{ + /./H + n + b holdwrnt + } + + s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| + G + s|\(\n\)\n*|\1|g + p; q' < "$progpath" + + exit $? +} + + +# Local variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-time-zone: "UTC" +# End: + +# Set a version string. +scriptversion='(GNU libtool) 2.4.7' + + +# func_echo ARG... +# ---------------- +# Libtool also displays the current mode in messages, so override +# funclib.sh func_echo with this custom definition. +func_echo () +{ + $debug_cmd + + _G_message=$* + + func_echo_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS + $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" + done + IFS=$func_echo_IFS +} + + +# func_warning ARG... +# ------------------- +# Libtool warnings are not categorized, so override funclib.sh +# func_warning with this simpler definition. +func_warning () +{ + $debug_cmd + + $warning_func ${1+"$@"} +} + + +## ---------------- ## +## Options parsing. ## +## ---------------- ## + +# Hook in the functions to make sure our own options are parsed during +# the option parsing loop. + +usage='$progpath [OPTION]... [MODE-ARG]...' + +# Short help message in response to '-h'. +usage_message="Options: + --config show all configuration variables + --debug enable verbose shell tracing + -n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --mode=MODE use operation mode MODE + --no-warnings equivalent to '-Wnone' + --preserve-dup-deps don't remove duplicate dependency libraries + --quiet, --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + -v, --verbose print more informational messages than default + --version print version information + -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] + -h, --help, --help-all print short, long, or detailed help message +" + +# Additional text appended to 'usage_message' in response to '--help'. +func_help () +{ + $debug_cmd + + func_usage_message + $ECHO "$long_help_message + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. When passed as first option, +'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. +Try '$progname --help --mode=MODE' for a more detailed description of MODE. + +When reporting a bug, please describe a test case to reproduce it and +include the following information: + + host-triplet: $host + shell: $SHELL + compiler: $LTCC + compiler flags: $LTCFLAGS + linker: $LD (gnu? $with_gnu_ld) + version: $progname (GNU libtool) 2.4.7 + automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` + autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` + +Report bugs to . +GNU libtool home page: . +General help using GNU software: ." + exit 0 +} + + +# func_lo2o OBJECT-NAME +# --------------------- +# Transform OBJECT-NAME from a '.lo' suffix to the platform specific +# object suffix. + +lo2o=s/\\.lo\$/.$objext/ +o2lo=s/\\.$objext\$/.lo/ + +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_lo2o () + { + case $1 in + *.lo) func_lo2o_result=${1%.lo}.$objext ;; + * ) func_lo2o_result=$1 ;; + esac + }' + + # func_xform LIBOBJ-OR-SOURCE + # --------------------------- + # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) + # suffix to a '.lo' libtool-object suffix. + eval 'func_xform () + { + func_xform_result=${1%.*}.lo + }' +else + # ...otherwise fall back to using sed. + func_lo2o () + { + func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` + } + + func_xform () + { + func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` + } +fi + + +# func_fatal_configuration ARG... +# ------------------------------- +# Echo program name prefixed message to standard error, followed by +# a configuration failure hint, and exit. +func_fatal_configuration () +{ + func_fatal_error ${1+"$@"} \ + "See the $PACKAGE documentation for more information." \ + "Fatal configuration error." +} + + +# func_config +# ----------- +# Display the configuration for all the tags in this script. +func_config () +{ + re_begincf='^# ### BEGIN LIBTOOL' + re_endcf='^# ### END LIBTOOL' + + # Default configuration. + $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" + + # Now print the configurations for the tags. + for tagname in $taglist; do + $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" + done + + exit $? +} + + +# func_features +# ------------- +# Display the features supported by this script. +func_features () +{ + echo "host: $host" + if test yes = "$build_libtool_libs"; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test yes = "$build_old_libs"; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + + exit $? +} + + +# func_enable_tag TAGNAME +# ----------------------- +# Verify that TAGNAME is valid, and either flag an error and exit, or +# enable the TAGNAME tag. We also add TAGNAME to the global $taglist +# variable here. +func_enable_tag () +{ + # Global variable: + tagname=$1 + + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf=/$re_begincf/,/$re_endcf/p + + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" + ;; + esac + + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; + *) + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + + +# func_check_version_match +# ------------------------ +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +# libtool_options_prep [ARG]... +# ----------------------------- +# Preparation for options parsed by libtool. +libtool_options_prep () +{ + $debug_mode + + # Option defaults: + opt_config=false + opt_dlopen= + opt_dry_run=false + opt_help=false + opt_mode= + opt_preserve_dup_deps=false + opt_quiet=false + + nonopt= + preserve_args= + + _G_rc_lt_options_prep=: + + # Shorthand for --mode=foo, only valid as the first argument + case $1 in + clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; + compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; + execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; + finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; + install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; + link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; + uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; + *) + _G_rc_lt_options_prep=false + ;; + esac + + if $_G_rc_lt_options_prep; then + # Pass back the list of options. + func_quote eval ${1+"$@"} + libtool_options_prep_result=$func_quote_result + fi +} +func_add_hook func_options_prep libtool_options_prep + + +# libtool_parse_options [ARG]... +# --------------------------------- +# Provide handling for libtool specific options. +libtool_parse_options () +{ + $debug_cmd + + _G_rc_lt_parse_options=false + + # Perform our own loop to consume as many options as possible in + # each iteration. + while test $# -gt 0; do + _G_match_lt_parse_options=: + _G_opt=$1 + shift + case $_G_opt in + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + + --config) func_config ;; + + --dlopen|-dlopen) + opt_dlopen="${opt_dlopen+$opt_dlopen +}$1" + shift + ;; + + --preserve-dup-deps) + opt_preserve_dup_deps=: ;; + + --features) func_features ;; + + --finish) set dummy --mode finish ${1+"$@"}; shift ;; + + --help) opt_help=: ;; + + --help-all) opt_help=': help-all' ;; + + --mode) test $# = 0 && func_missing_arg $_G_opt && break + opt_mode=$1 + case $1 in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $_G_opt" + exit_cmd=exit + break + ;; + esac + shift + ;; + + --no-silent|--no-quiet) + opt_quiet=false + func_append preserve_args " $_G_opt" + ;; + + --no-warnings|--no-warning|--no-warn) + opt_warning=false + func_append preserve_args " $_G_opt" + ;; + + --no-verbose) + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --silent|--quiet) + opt_quiet=: + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --tag) test $# = 0 && func_missing_arg $_G_opt && break + opt_tag=$1 + func_append preserve_args " $_G_opt $1" + func_enable_tag "$1" + shift + ;; + + --verbose|-v) opt_quiet=false + opt_verbose=: + func_append preserve_args " $_G_opt" + ;; + + # An option not handled by this hook function: + *) set dummy "$_G_opt" ${1+"$@"} ; shift + _G_match_lt_parse_options=false + break + ;; + esac + $_G_match_lt_parse_options && _G_rc_lt_parse_options=: + done + + if $_G_rc_lt_parse_options; then + # save modified positional parameters for caller + func_quote eval ${1+"$@"} + libtool_parse_options_result=$func_quote_result + fi +} +func_add_hook func_parse_options libtool_parse_options + + + +# libtool_validate_options [ARG]... +# --------------------------------- +# Perform any sanity checks on option settings and/or unconsumed +# arguments. +libtool_validate_options () +{ + # save first non-option argument + if test 0 -lt $#; then + nonopt=$1 + shift + fi + + # preserve --debug + test : = "$debug_cmd" || func_append preserve_args " --debug" + + case $host in + # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 + # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 + *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + + $opt_help || { + # Sanity checks first: + func_check_version_match + + test yes != "$build_libtool_libs" \ + && test yes != "$build_old_libs" \ + && func_fatal_configuration "not configured to build any kind of library" + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test execute != "$opt_mode"; then + func_error "unrecognized option '-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help=$help + help="Try '$progname --help --mode=$opt_mode' for more information." + } + + # Pass back the unparsed argument list + func_quote eval ${1+"$@"} + libtool_validate_options_result=$func_quote_result +} +func_add_hook func_validate_options libtool_validate_options + + +# Process options as early as possible so that --help and --version +# can return quickly. +func_options ${1+"$@"} +eval set dummy "$func_options_result"; shift + + + +## ----------- ## +## Main. ## +## ----------- ## + +magic='%%%MAGIC variable%%%' +magic_exe='%%%MAGIC EXE variable%%%' + +# Global variables. +extracted_archives= +extracted_serial=0 + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# func_generated_by_libtool +# True iff stdin has been generated by Libtool. This function is only +# a basic sanity check; it will hardly flush out determined imposters. +func_generated_by_libtool_p () +{ + $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_p file +# True iff FILE is a libtool '.la' library or '.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool '.la' library or '.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if 'file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case $lalib_p_line in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test yes = "$lalib_p" +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + test -f "$1" && + $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $debug_cmd + + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$sp$nl + eval cmd=\"$cmd\" + IFS=$save_ifs + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# 'FILE.' does not work on cygwin managed mounts. +func_source () +{ + $debug_cmd + + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result + ;; + esac +} + +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case $lt_sysroot:$1 in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result='='$func_stripname_result + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $debug_cmd + + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case "$@ " in + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with '--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=$1 + if test yes = "$build_libtool_libs"; then + write_lobj=\'$2\' + else + write_lobj=none + fi + + if test yes = "$build_old_libs"; then + write_oldobj=\'$3\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T </dev/null` + if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= + fi + fi +} +# end: func_convert_core_file_wine_to_w32 + + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $debug_cmd + + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result= + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result"; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi + fi + done + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $debug_cmd + + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $debug_cmd + + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 + + +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $debug_cmd + + if test -z "$2" && test -n "$1"; then + func_error "Could not determine host file name corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result=$1 + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $debug_cmd + + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " '$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result=$3 + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $debug_cmd + + case $4 in + $1 ) func_to_host_path_result=$3$func_to_host_path_result + ;; + esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep + + +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via '$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $debug_cmd + + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $debug_cmd + + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 + ;; + *) + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result + ;; + esac +} +# end func_to_tool_file + + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result=$1 +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result=$func_convert_core_msys_to_w32_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 + + +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 + + +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result=$func_convert_core_file_wine_to_w32_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 + + +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result=$func_cygpath_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin + + +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result=$func_cygpath_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via '$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $debug_cmd + + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd=func_convert_path_$func_stripname_result + fi +} + + +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $debug_cmd + + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path + + +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result=$1 +} +# end func_convert_path_noop + + +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result=$func_convert_core_msys_to_w32_result + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 + + +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 + + +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result=$func_convert_core_path_wine_to_w32_result + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_nix_to_w32 + + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result=$func_cygpath_result + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result=$func_cygpath_result + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_nix_to_cygwin + + +# func_dll_def_p FILE +# True iff FILE is a Windows DLL '.def' file. +# Keep in sync with _LT_DLL_DEF_P in libtool.m4 +func_dll_def_p () +{ + $debug_cmd + + func_dll_def_p_tmp=`$SED -n \ + -e 's/^[ ]*//' \ + -e '/^\(;.*\)*$/d' \ + -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ + -e q \ + "$1"` + test DEF = "$func_dll_def_p_tmp" +} + + +# func_mode_compile arg... +func_mode_compile () +{ + $debug_cmd + + # Get the compilation command and the source file. + base_compile= + srcfile=$nonopt # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + pie_flag= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg=$arg + arg_mode=normal + ;; + + target ) + libobj=$arg + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + test -n "$libobj" && \ + func_fatal_error "you cannot specify '-o' more than once" + arg_mode=target + continue + ;; + + -pie | -fpie | -fPIE) + func_append pie_flag " $arg" + continue + ;; + + -shared | -static | -prefer-pic | -prefer-non-pic) + func_append later " $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + lastarg= + save_ifs=$IFS; IFS=, + for arg in $args; do + IFS=$save_ifs + func_append_quoted lastarg "$arg" + done + IFS=$save_ifs + func_stripname ' ' '' "$lastarg" + lastarg=$func_stripname_result + + # Add the arguments to base_compile. + func_append base_compile " $lastarg" + continue + ;; + + *) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg=$srcfile + srcfile=$arg + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + func_append_quoted base_compile "$lastarg" + done # for arg + + case $arg_mode in + arg) + func_fatal_error "you must specify an argument for -Xcompile" + ;; + target) + func_fatal_error "you must specify a target with '-o'" + ;; + *) + # Get the name of the library object. + test -z "$libobj" && { + func_basename "$srcfile" + libobj=$func_basename_result + } + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + case $libobj in + *.[cCFSifmso] | \ + *.ada | *.adb | *.ads | *.asm | \ + *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ + *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) + func_xform "$libobj" + libobj=$func_xform_result + ;; + esac + + case $libobj in + *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; + *) + func_fatal_error "cannot determine name of library object from '$libobj'" + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -shared) + test yes = "$build_libtool_libs" \ + || func_fatal_configuration "cannot build a shared library" + build_old_libs=no + continue + ;; + + -static) + build_libtool_libs=no + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + func_quote_arg pretty "$libobj" + test "X$libobj" != "X$func_quote_arg_result" \ + && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && func_warning "libobj name '$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname=$func_basename_result + xdir=$func_dirname_result + lobj=$xdir$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test yes = "$build_old_libs"; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test no = "$compiler_c_o"; then + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext + lockfile=$output_obj.lock + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test yes = "$need_locks"; then + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + elif test warn = "$need_locks"; then + if test -f "$lockfile"; then + $ECHO "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + func_append removelist " $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + func_append removelist " $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result + func_quote_arg pretty "$srcfile" + qsrcfile=$func_quote_arg_result + + # Only build a PIC object if we are building libtool libraries. + if test yes = "$build_libtool_libs"; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test no != "$pic_mode"; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + func_append command " -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + if test warn = "$need_locks" && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test yes = "$suppress_opt"; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test yes = "$build_old_libs"; then + if test yes != "$pic_mode"; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test yes = "$compiler_c_o"; then + func_append command " -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + func_append command "$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + if test warn = "$need_locks" && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test no != "$need_locks"; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { + test compile = "$opt_mode" && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $opt_mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to build PIC objects only + -prefer-non-pic try to build non-PIC objects only + -shared do not build a '.o' file suitable for static linking + -static only build a '.o' file suitable for static linking + -Wc,FLAG + -Xcompiler FLAG pass FLAG directly to the compiler + +COMPILE-COMMAND is a command to be used in creating a 'standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix '.c' with the +library object suffix, '.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to '-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the '--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the 'install' or 'cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -bindir BINDIR specify path to binaries directory (for systems where + libraries must be found in the PATH setting at runtime) + -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE use a list of object files found in FILE to specify objects + -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + -Wc,FLAG + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wa,FLAG + -Xassembler FLAG pass linker-specific FLAG directly to the assembler + -Wl,FLAG + -Xlinker FLAG pass linker-specific FLAG directly to the linker + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) + +All other options (arguments beginning with '-') are ignored. + +Every other argument is treated as a filename. Files ending in '.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in '.la', then a libtool library is created, +only library objects ('.lo' files) may be specified, and '-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created +using 'ar' and 'ranlib', or on Windows using 'lib'. + +If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode '$opt_mode'" + ;; + esac + + echo + $ECHO "Try '$progname --help' for more information about other modes." +} + +# Now that we've collected a possible --mode arg, show help if necessary +if $opt_help; then + if test : = "$opt_help"; then + func_mode_help + else + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + func_mode_help + done + } | $SED -n '1p; 2,$s/^Usage:/ or: /p' + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + echo + func_mode_help + done + } | + $SED '1d + /^When reporting/,/^Report/{ + H + d + } + $x + /information about other modes/d + /more detailed .*MODE/d + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' + fi + exit $? +fi + + +# func_mode_execute arg... +func_mode_execute () +{ + $debug_cmd + + # The first argument is the command name. + cmd=$nonopt + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $opt_dlopen; do + test -f "$file" \ + || func_fatal_help "'$file' is not a file" + + dir= + case $file in + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "'$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "'$file' was not linked with '-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir=$func_dirname_result + + if test -f "$dir/$objdir/$dlname"; then + func_append dir "/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir=$func_dirname_result + ;; + + *) + func_warning "'-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir=$absdir + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic=$magic + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -* | *.la | *.lo ) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file=$progdir/$program + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file=$progdir/$program + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_append_quoted args "$file" + done + + if $opt_dry_run; then + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + echo "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + else + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd=\$cmd$args + fi +} + +test execute = "$opt_mode" && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $debug_cmd + + libs= + libdirs= + admincmds= + + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "'$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument '$opt'" + fi + done + + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi + + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and '=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || func_append admincmds " + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_quiet && exit $EXIT_SUCCESS + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the '-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the '$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the '$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the '$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" + fi + echo + + echo "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" + fi + exit $EXIT_SUCCESS +} + +test finish = "$opt_mode" && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $debug_cmd + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || + # Allow the use of GNU shtool's install command. + case $nonopt in *shtool*) :;; *) false;; esac + then + # Aesthetically quote it. + func_quote_arg pretty "$nonopt" + install_prog="$func_quote_arg_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_arg pretty "$arg" + func_append install_prog "$func_quote_arg_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=false + stripme= + no_mode=: + for arg + do + arg2= + if test -n "$dest"; then + func_append files " $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=: ;; + -f) + if $install_cp; then :; else + prev=$arg + fi + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + if test X-m = "X$prev" && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_arg pretty "$arg" + func_append install_prog " $func_quote_arg_result" + if test -n "$arg2"; then + func_quote_arg pretty "$arg2" + fi + func_append install_shared_prog " $func_quote_arg_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the '$prev' option requires an argument" + + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_arg pretty "$install_override_mode" + func_append install_shared_prog " -m $func_quote_arg_result" + fi + fi + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=: + if $isdir; then + destdir=$dest + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir=$func_dirname_result + destname=$func_basename_result + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "'$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "'$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic=$magic + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + func_append staticlibs " $file" + ;; + + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "'$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) func_append current_libdirs " $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) func_append future_libdirs " $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir=$func_dirname_result + func_append dir "$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking '$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname=$1 + shift + + srcname=$realname + test -n "$relink_command" && srcname=${realname}T + + # Install the shared library and build the symlinks. + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme=$stripme + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme= + ;; + esac + ;; + os2*) + case $realname in + *_dll.a) + tstripme= + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try 'ln -sf' first, because the 'ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib=$destdir/$realname + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name=$func_basename_result + instname=$dir/${name}i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && func_append staticlibs " $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile=$destdir/$destname + else + func_basename "$file" + destfile=$func_basename_result + destfile=$destdir/$destfile + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest=$destfile + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to '$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test yes = "$build_old_libs"; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile=$destdir/$destname + else + func_basename "$file" + destfile=$func_basename_result + destfile=$destdir/$destfile + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext= + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=.exe + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script '$wrapper'" + + finalize=: + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "'$lib' has not been installed in '$libdir'" + finalize=false + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test no = "$fast_install" && test -n "$relink_command"; then + $opt_dry_run || { + if $finalize; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file=$func_basename_result + outputname=$tmpdir/$file + # Replace the output file specification. + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_quiet || { + func_quote_arg expand,pretty "$relink_command" + eval "func_echo $func_quote_arg_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink '$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file=$outputname + else + func_warning "cannot relink '$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name=$func_basename_result + + # Set up the ranlib parameters. + oldlib=$destdir/$name + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $tool_oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run '$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test install = "$opt_mode" && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $debug_cmd + + my_outputname=$1 + my_originator=$2 + my_pic_p=${3-false} + my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms=${my_outputname}S.c + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist=$output_objdir/$my_outputname.nm + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + +/* External symbol declarations for the compiler. */\ +" + + if test yes = "$dlself"; then + func_verbose "generating symbol list for '$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from '$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols=$output_objdir/$outputname.exp + $opt_dry_run || { + $RM $export_symbols + eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from '$dlprefile'" + func_basename "$dlprefile" + name=$func_basename_result + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename= + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname"; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename=$func_basename_result + else + # no lafile. user explicitly requested -dlpreopen . + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename"; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + func_show_eval '$RM "${nlist}I"' + if test -n "$global_symbol_to_import"; then + eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' + fi + + echo >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +extern LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[];\ +" + + if test -s "$nlist"I; then + echo >> "$output_objdir/$my_dlsyms" "\ +static void lt_syminit(void) +{ + LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; + for (; symbol->name; ++symbol) + {" + $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" + echo >> "$output_objdir/$my_dlsyms" "\ + } +}" + fi + echo >> "$output_objdir/$my_dlsyms" "\ +LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{ {\"$my_originator\", (void *) 0}," + + if test -s "$nlist"I; then + echo >> "$output_objdir/$my_dlsyms" "\ + {\"@INIT@\", (void *) <_syminit}," + fi + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + echo >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + $my_pic_p && pic_flag_for_symtable=" $pic_flag" + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) func_append symtab_cflags " $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' + + # Transform the symbol file into the correct name. + symfileobj=$output_objdir/${my_outputname}S.$objext + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for '$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` + fi +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $debug_cmd + + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $debug_cmd + + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. +func_win32_libid () +{ + $debug_cmd + + win32_libid_type=unknown + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + case $nm_interface in + "MS dumpbin") + if func_cygming_ms_implib_p "$1" || + func_cygming_gnu_implib_p "$1" + then + win32_nmres=import + else + win32_nmres= + fi + ;; + *) + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | + $SED -n -e ' + 1,100{ + / I /{ + s|.*|import| + p + q + } + }'` + ;; + esac + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $debug_cmd + + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $debug_cmd + + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive that possess that section. Heuristic: eliminate + # all those that have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $debug_cmd + + if func_cygming_gnu_implib_p "$1"; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1"; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result= + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $debug_cmd + + f_ex_an_ar_dir=$1; shift + f_ex_an_ar_oldlib=$1 + if test yes = "$lock_old_archive_extraction"; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test yes = "$lock_old_archive_extraction"; then + $opt_dry_run || rm -f "$lockfile" + fi + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $debug_cmd + + my_gentop=$1; shift + my_oldlibs=${1+"$@"} + my_oldobjs= + my_xlib= + my_xabs= + my_xdir= + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib=$func_basename_result + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir=$my_gentop/$my_xlib_u + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + func_basename "$darwin_archive" + darwin_base_archive=$func_basename_result + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches; do + func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" + $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" + cd "unfat-$$/$darwin_base_archive-$darwin_arch" + func_extract_an_archive "`pwd`" "$darwin_base_archive" + cd "$darwin_curdir" + $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` + done + + func_extract_archives_result=$my_oldobjs +} + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory where it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=${1-no} + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + + func_quote_arg pretty "$ECHO" + qECHO=$func_quote_arg_result + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=$qECHO + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ that is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options that match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + case \" \$* \" in + *\\ --lt-*) + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done ;; + esac + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test yes = "$fast_install"; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + \$ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + # Export our shlibpath_var if we have one. + if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + + export $shlibpath_var +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + func_exec_program \${1+\"\$@\"} + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} + + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +#else +# include +# include +# ifdef __CYGWIN__ +# include +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + +/* declarations of non-ANSI functions */ +#if defined __MINGW32__ +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined __CYGWIN__ +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined other_platform || defined ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined _MSC_VER +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +#elif defined __MINGW32__ +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined __CYGWIN__ +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined other platforms ... */ +#endif + +#if defined PATH_MAX +# define LT_PATHMAX PATH_MAX +#elif defined MAXPATHLEN +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +/* path handling portability macros */ +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ + defined __OS2__ +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free (stale); stale = 0; } \ +} while (0) + +#if defined LT_DEBUGWRAPPER +static int lt_debug = 1; +#else +static int lt_debug = 0; +#endif + +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); +char **prepare_spawn (char **argv); +void lt_dump_script (FILE *f); +EOF + + cat <= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + size_t tmp_len; + char *concat_name; + + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined HAVE_DOS_BASED_FILE_SYSTEM + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined HAVE_DOS_BASED_FILE_SYSTEM + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = (size_t) (q - p); + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (STREQ (str, pat)) + *str = '\0'; + } + return str; +} + +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + +static void +lt_error_core (int exit_status, const char *file, + int line, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *file, int line, const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); + va_end (ap); +} + +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + +void +lt_setenv (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + size_t len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + size_t orig_value_len = strlen (orig_value); + size_t add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + size_t len = strlen (new_value); + while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[--len] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -n -e ' +s/^\(.\{79\}\)\(..*\)/\1\ +\2/ +h +s/\([\\"]\)/\\\1/g +s/$/\\n/ +s/\([^\n]*\).*/ fputs ("\1", f);/p +g +D' + cat <<"EOF" +} +EOF +} +# end: func_emit_cwrapperexe_src + +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $debug_cmd + + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + +# func_suncc_cstd_abi +# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! +# Several compiler flags select an ABI that is incompatible with the +# Cstd library. Avoid specifying it if any are in CXXFLAGS. +func_suncc_cstd_abi () +{ + $debug_cmd + + case " $compile_command " in + *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) + suncc_use_cstd_abi=no + ;; + *) + suncc_use_cstd_abi=yes + ;; + esac +} + +# func_mode_link arg... +func_mode_link () +{ + $debug_cmd + + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # what system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll that has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + bindir= + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + os2dllname= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=false + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module=$wl-single_module + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test yes != "$build_libtool_libs" \ + && func_fatal_configuration "cannot build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg=$1 + shift + func_quote_arg pretty,unquoted "$arg" + qarg=$func_quote_arg_unquoted_result + func_append libtool_args " $func_quote_arg_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + bindir) + bindir=$arg + prev= + continue + ;; + dlfiles|dlprefiles) + $preload || { + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=: + } + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test no = "$dlself"; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test dlprefiles = "$prev"; then + dlself=yes + elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test dlfiles = "$prev"; then + func_append dlfiles " $arg" + else + func_append dlprefiles " $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols=$arg + test -f "$arg" \ + || func_fatal_error "symbol file '$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex=$arg + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) func_append deplibs " $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir=$arg + prev= + continue + ;; + mllvm) + # Clang does not use LLVM to link, so we can simply discard any + # '-mllvm $arg' options when doing the link step. + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# func_append moreargs " $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test none = "$pic_object" && + test none = "$non_pic_object"; then + func_fatal_error "cannot find name of object for '$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + if test none != "$pic_object"; then + # Prepend the subdirectory the object is found in. + pic_object=$xdir$pic_object + + if test dlfiles = "$prev"; then + if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test dlprefiles = "$prev"; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg=$pic_object + fi + + # Non-PIC object. + if test none != "$non_pic_object"; then + # Prepend the subdirectory the object is found in. + non_pic_object=$xdir$non_pic_object + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test none = "$pic_object"; then + arg=$non_pic_object + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object=$pic_object + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "'$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file '$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + os2dllname) + os2dllname=$arg + prev= + continue + ;; + precious_regex) + precious_files_regex=$arg + prev= + continue + ;; + release) + release=-$arg + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test rpath = "$prev"; then + case "$rpath " in + *" $arg "*) ;; + *) func_append rpath " $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) func_append xrpath " $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds=$arg + prev= + continue + ;; + weak) + func_append weak_libs " $arg" + prev= + continue + ;; + xassembler) + func_append compiler_flags " -Xassembler $qarg" + prev= + func_append compile_command " -Xassembler $qarg" + func_append finalize_command " -Xassembler $qarg" + continue + ;; + xcclinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg=$arg + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "'-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -bindir) + prev=bindir + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test X-export-symbols = "X$arg"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between '-L' and '$1'" + else + func_fatal_error "need path for '-L' option" + fi + fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of '$dir'" + dir=$absdir + ;; + esac + case "$deplibs " in + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; + *) + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) func_append dllsearchpath ":$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test X-lc = "X$arg" || test X-lm = "X$arg"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test X-lc = "X$arg" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) + # Do not include libc due to us having libc/libc_r. + test X-lc = "X$arg" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + func_append deplibs " System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test X-lc = "X$arg" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test X-lc = "X$arg" && continue + ;; + esac + elif test X-lc_r = "X$arg"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + func_append deplibs " $arg" + continue + ;; + + -mllvm) + prev=mllvm + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + # Solaris ld rejects as of 11.4. Refer to Oracle bug 22985199. + -pthread) + case $host in + *solaris2*) ;; + *) + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + ;; + esac + continue + ;; + -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + + # As we are forced to pass -nostdlib to g++ during linking, the option + # -pthread{,s} is not in effect; add the -lpthread to $deplist + # explicitly to link correctly. + if test "$tagname" = CXX -a x"$with_gcc" = xyes; then + case "$arg" in + -pthread*) func_append deplibs " -lpthread" ;; + esac + fi + + continue + ;; + + -multi_module) + single_module=$wl-multi_module + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "'-no-install' is ignored for $host" + func_warning "assuming '-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -os2dllname) + prev=os2dllname + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs=$IFS; IFS=, + for flag in $args; do + IFS=$save_ifs + func_quote_arg pretty "$flag" + func_append arg " $func_quote_arg_result" + func_append compiler_flags " $func_quote_arg_result" + done + IFS=$save_ifs + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs=$IFS; IFS=, + for flag in $args; do + IFS=$save_ifs + func_quote_arg pretty "$flag" + func_append arg " $wl$func_quote_arg_result" + func_append compiler_flags " $wl$func_quote_arg_result" + func_append linker_flags " $func_quote_arg_result" + done + IFS=$save_ifs + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xassembler) + prev=xassembler + continue + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result + ;; + + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # -fstack-protector* stack protector flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + # -specs=* GCC specs files + # -stdlib=* select c++ std lib with clang + # -fsanitize=* Clang/GCC memory and address sanitizer + # -fuse-ld=* Linker select flags for GCC + # -Wa,* Pass flags directly to the assembler + # -Werror, -Werror=* Report (specified) warnings as errors + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ + -specs=*|-fsanitize=*|-fuse-ld=*|-Wa,*|-Werror|-Werror=*) + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result + func_append compile_command " $arg" + func_append finalize_command " $arg" + func_append compiler_flags " $arg" + continue + ;; + + -Z*) + if test os2 = "`expr $host : '.*\(os2\)'`"; then + # OS/2 uses -Zxxx to specify OS/2-specific options + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case $arg in + -Zlinker | -Zstack) + prev=xcompiler + ;; + esac + continue + else + # Otherwise treat like 'Some other compiler flag' below + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result + fi + ;; + + # Some other compiler flag. + -* | +*) + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result + ;; + + *.$objext) + # A standard object. + func_append objs " $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test none = "$pic_object" && + test none = "$non_pic_object"; then + func_fatal_error "cannot find name of object for '$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + test none = "$pic_object" || { + # Prepend the subdirectory the object is found in. + pic_object=$xdir$pic_object + + if test dlfiles = "$prev"; then + if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test dlprefiles = "$prev"; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg=$pic_object + } + + # Non-PIC object. + if test none != "$non_pic_object"; then + # Prepend the subdirectory the object is found in. + non_pic_object=$xdir$non_pic_object + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test none = "$pic_object"; then + arg=$non_pic_object + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object=$pic_object + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "'$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + func_append deplibs " $arg" + func_append old_deplibs " $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + func_resolve_sysroot "$arg" + if test dlfiles = "$prev"; then + # This library was specified with -dlopen. + func_append dlfiles " $func_resolve_sysroot_result" + prev= + elif test dlprefiles = "$prev"; then + # The library was specified with -dlpreopen. + func_append dlprefiles " $func_resolve_sysroot_result" + prev= + else + func_append deplibs " $func_resolve_sysroot_result" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the '$prevarg' option requires an argument" + + if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname=$func_basename_result + libobjs_save=$libobjs + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + # Definition is injected by LT_CONFIG during libtool generation. + func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" + + func_dirname "$output" "/" "" + output_objdir=$func_dirname_result$objdir + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_preserve_dup_deps; then + case "$libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append libs " $deplib" + done + + if test lib = "$linkmode"; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; + esac + func_append pre_post_deps " $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=false + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test lib,link = "$linkmode,$pass"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs=$tmp_deplibs + fi + + if test lib,link = "$linkmode,$pass" || + test prog,scan = "$linkmode,$pass"; then + libs=$deplibs + deplibs= + fi + if test prog = "$linkmode"; then + case $pass in + dlopen) libs=$dlfiles ;; + dlpreopen) libs=$dlprefiles ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + if test lib,dlpreopen = "$linkmode,$pass"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + func_resolve_sysroot "$lib" + case $lib in + *.la) func_source "$func_resolve_sysroot_result" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + func_basename "$deplib" + deplib_base=$func_basename_result + case " $weak_libs " in + *" $deplib_base "*) ;; + *) func_append deplibs " $deplib" ;; + esac + done + done + libs=$dlprefiles + fi + if test dlopen = "$pass"; then + # Collect dlpreopened libraries + save_deplibs=$deplibs + deplibs= + fi + + for deplib in $libs; do + lib= + found=false + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append compiler_flags " $deplib" + if test lib = "$linkmode"; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test lib != "$linkmode" && test prog != "$linkmode"; then + func_warning "'-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test lib = "$linkmode"; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib=$searchdir/lib$name$search_ext + if test -f "$lib"; then + if test .la = "$search_ext"; then + found=: + else + found=false + fi + break 2 + fi + done + done + if $found; then + # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll=$l + done + if test "X$ll" = "X$old_library"; then # only static version available + found=false + func_dirname "$lib" "" "." + ladir=$func_dirname_result + lib=$ladir/$old_library + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + else + # deplib doesn't seem to be a libtool library + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + ;; # -l + *.ltframework) + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test lib = "$linkmode"; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test conv = "$pass" && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + prog) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + continue + fi + if test scan = "$pass"; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + *) + func_warning "'-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test link = "$pass"; then + func_stripname '-R' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; + *.$libext) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=false + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=: + fi + ;; + pass_all) + valid_a_lib=: + ;; + esac + if $valid_a_lib; then + echo + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + else + echo + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." + fi + ;; + esac + continue + ;; + prog) + if test link != "$pass"; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + elif test prog = "$linkmode"; then + if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + func_append newdlprefiles " $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append newdlfiles " $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=: + continue + ;; + esac # case $deplib + + $found || test -f "$lib" \ + || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "'$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir=$func_dirname_result + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + if test lib,link = "$linkmode,$pass" || + test prog,scan = "$linkmode,$pass" || + { test prog != "$linkmode" && test lib != "$linkmode"; }; then + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" + fi + + if test conv = "$pass"; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for '$lib'" + fi + # It is a libtool convenience library, so add in its objects. + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" + elif test prog != "$linkmode" && test lib != "$linkmode"; then + func_fatal_error "'$lib' is not a convenience library" + fi + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + if test -n "$old_library" && + { test yes = "$prefer_static_libs" || + test built,no = "$prefer_static_libs,$installed"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib=$l + done + fi + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for '$lib'" + fi + + # This library was specified with -dlopen. + if test dlopen = "$pass"; then + test -z "$libdir" \ + && func_fatal_error "cannot -dlopen a convenience library: '$lib'" + if test -z "$dlname" || + test yes != "$dlopen_support" || + test no = "$build_libtool_libs" + then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + func_append dlprefiles " $lib $dependency_libs" + else + func_append newdlfiles " $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of '$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir=$ladir + fi + ;; + esac + func_basename "$lib" + laname=$func_basename_result + + # Find the relevant object directory and library name. + if test yes = "$installed"; then + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library '$lib' was moved." + dir=$ladir + absdir=$abs_ladir + libdir=$abs_ladir + else + dir=$lt_sysroot$libdir + absdir=$lt_sysroot$libdir + fi + test yes = "$hardcode_automatic" && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir=$ladir + absdir=$abs_ladir + # Remove this search path later + func_append notinst_path " $abs_ladir" + else + dir=$ladir/$objdir + absdir=$abs_ladir/$objdir + # Remove this search path later + func_append notinst_path " $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test dlpreopen = "$pass"; then + if test -z "$libdir" && test prog = "$linkmode"; then + func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" + fi + case $host in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test lib = "$linkmode"; then + deplibs="$dir/$old_library $deplibs" + elif test prog,link = "$linkmode,$pass"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test prog = "$linkmode" && test link != "$pass"; then + func_append newlib_search_path " $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=false + if test no != "$link_all_deplibs" || test -z "$library_names" || + test no = "$build_libtool_libs"; then + linkalldeplibs=: + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + esac + # Need to link against all dependency_libs? + if $linkalldeplibs; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test prog,link = "$linkmode,$pass"; then + if test -n "$library_names" && + { { test no = "$prefer_static_libs" || + test built,yes = "$prefer_static_libs,$installed"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then + # Make sure the rpath contains only unique directories. + case $temp_rpath: in + *"$absdir:"*) ;; + *) func_append temp_rpath "$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if $alldeplibs && + { test pass_all = "$deplibs_check_method" || + { test yes = "$build_libtool_libs" && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test built = "$use_static_libs" && test yes = "$installed"; then + use_static_libs=no + fi + if test -n "$library_names" && + { test no = "$use_static_libs" || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc* | *os2*) + # No point in relinking DLLs because paths are not encoded + func_append notinst_deplibs " $lib" + need_relink=no + ;; + *) + if test no = "$installed"; then + func_append notinst_deplibs " $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule= + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule=$dlpremoduletest + break + fi + done + if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then + echo + if test prog = "$linkmode"; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test lib = "$linkmode" && + test yes = "$hardcode_into_libs"; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname=$1 + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname=$dlname + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc* | *os2*) + func_arith $current - $age + major=$func_arith_result + versuffix=-$major + ;; + esac + eval soname=\"$soname_spec\" + else + soname=$realname + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot=$soname + func_basename "$soroot" + soname=$func_basename_result + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from '$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for '$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test prog = "$linkmode" || test relink != "$opt_mode"; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test no = "$hardcode_direct"; then + add=$dir/$linklib + case $host in + *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; + *-*-sysv4*uw2*) add_dir=-L$dir ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir=-L$dir ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we cannot + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library"; then + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" + else + add=$dir/$old_library + fi + elif test -n "$old_library"; then + add=$dir/$old_library + fi + fi + esac + elif test no = "$hardcode_minus_L"; then + case $host in + *-*-sunos*) add_shlibpath=$dir ;; + esac + add_dir=-L$dir + add=-l$name + elif test no = "$hardcode_shlibpath_var"; then + add_shlibpath=$dir + add=-l$name + else + lib_linked=no + fi + ;; + relink) + if test yes = "$hardcode_direct" && + test no = "$hardcode_direct_absolute"; then + add=$dir/$linklib + elif test yes = "$hardcode_minus_L"; then + add_dir=-L$absdir + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add=-l$name + elif test yes = "$hardcode_shlibpath_var"; then + add_shlibpath=$dir + add=-l$name + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test yes != "$lib_linked"; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; + esac + fi + if test prog = "$linkmode"; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test yes != "$hardcode_direct" && + test yes != "$hardcode_minus_L" && + test yes = "$hardcode_shlibpath_var"; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + fi + fi + fi + + if test prog = "$linkmode" || test relink = "$opt_mode"; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test yes = "$hardcode_direct" && + test no = "$hardcode_direct_absolute"; then + add=$libdir/$linklib + elif test yes = "$hardcode_minus_L"; then + add_dir=-L$libdir + add=-l$name + elif test yes = "$hardcode_shlibpath_var"; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + add=-l$name + elif test yes = "$hardcode_automatic"; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib"; then + add=$inst_prefix_dir$libdir/$linklib + else + add=$libdir/$linklib + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir=-L$libdir + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add=-l$name + fi + + if test prog = "$linkmode"; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test prog = "$linkmode"; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test unsupported != "$hardcode_direct"; then + test -n "$old_library" && linklib=$old_library + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test yes = "$build_libtool_libs"; then + # Not a shared library + if test pass_all != "$deplibs_check_method"; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + $ECHO "*** Warning: This system cannot link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test yes = "$module"; then + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using 'nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** 'nm' from GNU binutils and a full rebuild may help." + fi + if test no = "$build_old_libs"; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test lib = "$linkmode"; then + if test -n "$dependency_libs" && + { test yes != "$hardcode_into_libs" || + test yes = "$build_old_libs" || + test yes = "$link_static"; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) func_append xrpath " $temp_xrpath";; + esac;; + *) func_append temp_deplibs " $libdir";; + esac + done + dependency_libs=$temp_deplibs + fi + + func_append newlib_search_path " $absdir" + # Link against this library + test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; + esac + fi + func_append tmp_libs " $func_resolve_sysroot_result" + done + + if test no != "$link_all_deplibs"; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + path= + case $deplib in + -L*) path=$deplib ;; + *.la) + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result + func_dirname "$deplib" "" "." + dir=$func_dirname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of '$dir'" + absdir=$dir + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names"; then + for tmp in $deplibrary_names; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl"; then + depdepl=$absdir/$objdir/$depdepl + darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" + func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" + path= + fi + fi + ;; + *) + path=-L$absdir/$objdir + ;; + esac + else + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "'$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "'$deplib' seems to be moved" + + path=-L$absdir + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test link = "$pass"; then + if test prog = "$linkmode"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs=$newdependency_libs + if test dlpreopen = "$pass"; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test dlopen != "$pass"; then + test conv = "$pass" || { + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) func_append lib_search_path " $dir" ;; + esac + done + newlib_search_path= + } + + if test prog,link = "$linkmode,$pass"; then + vars="compile_deplibs finalize_deplibs" + else + vars=deplibs + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) func_append tmp_libs " $deplib" ;; + esac + ;; + *) func_append tmp_libs " $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + + # Add Sun CC postdeps if required: + test CXX = "$tagname" && { + case $host_os in + linux*) + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ C*) # Sun C++ 5.9 + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + + solaris*) + func_cc_basename "$CC" + case $func_cc_basename_result in + CC* | sunCC*) + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + esac + } + + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i= + ;; + esac + if test -n "$i"; then + func_append tmp_libs " $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test prog = "$linkmode"; then + dlfiles=$newdlfiles + fi + if test prog = "$linkmode" || test lib = "$linkmode"; then + dlprefiles=$newdlprefiles + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + func_warning "'-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "'-l' and '-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "'-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "'-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "'-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "'-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "'-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs=$output + func_append objs "$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form 'libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test no = "$module" \ + && func_fatal_help "libtool library '$output' must begin with 'lib'" + + if test no != "$need_lib_prefix"; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test pass_all != "$deplibs_check_method"; then + func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" + else + echo + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + func_append libobjs " $objs" + fi + fi + + test no = "$dlself" \ + || func_warning "'-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test 1 -lt "$#" \ + && func_warning "ignoring multiple '-rpath's for a libtool library" + + install_libdir=$1 + + oldlibs= + if test -z "$rpath"; then + if test yes = "$build_libtool_libs"; then + # Building a libtool convenience library. + # Some compilers have problems with a '.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "'-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "'-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs=$IFS; IFS=: + set dummy $vinfo 0 0 0 + shift + IFS=$save_ifs + + test -n "$7" && \ + func_fatal_help "too many parameters to '-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major=$1 + number_minor=$2 + number_revision=$3 + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # that has an extra 1 added just for fun + # + case $version_type in + # correct linux to gnu/linux during the next big refactor + darwin|freebsd-elf|linux|midnightbsd-elf|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age=$number_minor + revision=$number_revision + ;; + freebsd-aout|qnx|sunos) + current=$number_major + revision=$number_minor + age=0 + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age=$number_minor + revision=$number_minor + lt_irix_increment=no + ;; + esac + ;; + no) + current=$1 + revision=$2 + age=$3 + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT '$current' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION '$revision' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE '$age' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE '$age' is greater than the current interface number '$current'" + func_fatal_error "'$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + # On Darwin other compilers + case $CC in + nagfor*) + verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" + ;; + *) + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + esac + ;; + + freebsd-aout) + major=.$current + versuffix=.$current.$revision + ;; + + freebsd-elf | midnightbsd-elf) + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + ;; + + irix | nonstopux) + if test no = "$lt_irix_increment"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring=$verstring_prefix$major.$revision + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test 0 -ne "$loop"; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring=$verstring_prefix$major.$iface:$verstring + done + + # Before this point, $major must not contain '.'. + major=.$major + versuffix=$major.$revision + ;; + + linux) # correct to gnu/linux during the next big refactor + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=.$current.$age.$revision + verstring=$current.$age.$revision + + # Add in all the interfaces that we are compatible with. + loop=$age + while test 0 -ne "$loop"; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring=$verstring:$iface.0 + done + + # Make executables depend on our current version. + func_append verstring ":$current.0" + ;; + + qnx) + major=.$current + versuffix=.$current + ;; + + sco) + major=.$current + versuffix=.$current + ;; + + sunos) + major=.$current + versuffix=.$current.$revision + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 file systems. + func_arith $current - $age + major=$func_arith_result + versuffix=-$major + ;; + + *) + func_fatal_configuration "unknown library version type '$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring=0.0 + ;; + esac + if test no = "$need_version"; then + versuffix= + else + versuffix=.0.0 + fi + fi + + # Remove version info from name if versioning should be avoided + if test yes,no = "$avoid_version,$need_version"; then + major= + versuffix= + verstring= + fi + + # Check to see if the archive will have undefined symbols. + if test yes = "$allow_undefined"; then + if test unsupported = "$allow_undefined_flag"; then + if test yes = "$build_old_libs"; then + func_warning "undefined symbols not allowed in $host shared libraries; building static only" + build_libtool_libs=no + else + func_fatal_error "can't build $host shared library unless -no-undefined is specified" + fi + fi + else + # Don't allow undefined symbols. + allow_undefined_flag=$no_undefined_flag + fi + + fi + + func_generate_dlsyms "$libname" "$libname" : + func_append libobjs " $symfileobj" + test " " = "$libobjs" && libobjs= + + if test relink != "$opt_mode"; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) + if test -n "$precious_files_regex"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + func_append removelist " $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then + func_append oldlibs " $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles=$dlfiles + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) func_append dlfiles " $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles=$dlprefiles + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) func_append dlprefiles " $lib" ;; + esac + done + + if test yes = "$build_libtool_libs"; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + func_append deplibs " System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test yes = "$build_libtool_need_lc"; then + func_append deplibs " -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release= + versuffix= + major= + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib=$potent_lib + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | $SED 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; + *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib= + break 2 + fi + done + done + fi + if test -n "$a_deplib"; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib"; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + case " $predeps $postdeps " in + *" $a_deplib "*) + func_append newdeplibs " $a_deplib" + a_deplib= + ;; + esac + fi + if test -n "$a_deplib"; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib=$potent_lib # see symlink-check above in file_magic test + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib= + break 2 + fi + done + done + fi + if test -n "$a_deplib"; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib"; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs= + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + for i in $predeps $postdeps; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` + done + fi + case $tmp_deplibs in + *[!\ \ ]*) + echo + if test none = "$deplibs_check_method"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + ;; + esac + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + if test yes = "$droppeddeps"; then + if test yes = "$module"; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using 'nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** 'nm' from GNU binutils and a full rebuild may help." + fi + if test no = "$build_old_libs"; then + oldlibs=$output_objdir/$libname.$libext + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test no = "$allow_undefined"; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test no = "$build_old_libs"; then + oldlibs=$output_objdir/$libname.$libext + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + deplibs=$new_libs + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test yes = "$build_libtool_libs"; then + # Remove $wl instances when linking with ld. + # FIXME: should test the right _cmds variable. + case $archive_cmds in + *\$LD\ *) wl= ;; + esac + if test yes = "$hardcode_into_libs"; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath=$finalize_rpath + test relink = "$opt_mode" || rpath=$compile_rpath$rpath + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append dep_rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath=$finalize_shlibpath + test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname=$1 + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname=$realname + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib=$output_objdir/$realname + linknames= + for link + do + func_append linknames " $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols=$output_objdir/$libname.uexp + func_append delfiles " $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + func_dll_def_p "$export_symbols" || { + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols=$export_symbols + export_symbols= + always_export_symbols=yes + } + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for '$libname.la'" + export_symbols=$output_objdir/$libname.exp + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs=$IFS; IFS='~' + for cmd1 in $cmds; do + IFS=$save_ifs + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test yes = "$try_normal_branch" \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=$output_objdir/$output_la.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS=$save_ifs + if test -n "$export_symbols_regex" && test : != "$skipped_export"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols=$export_symbols + test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test : != "$skipped_export" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for '$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands, which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + func_append tmp_deplibs " $test_deplib" + ;; + esac + done + deplibs=$tmp_deplibs + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test yes = "$compiler_needs_object" && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + func_append linker_flags " $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test relink = "$opt_mode"; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test yes = "$module" && test -n "$module_cmds"; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test : != "$skipped_export" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + func_basename "$output" + output_la=$func_basename_result + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then + output=$output_objdir/$output_la.lnkscript + func_verbose "creating GNU ld script: $output" + echo 'INPUT (' > $output + for obj in $save_libobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result + elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then + output=$output_objdir/$output_la.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test yes = "$compiler_needs_object"; then + firstobj="$1 " + shift + fi + for obj + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-$k.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test -z "$objlist" || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test 1 -eq "$k"; then + # The first file doesn't have a previous command to add. + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" + else + # All subsequent reloadable object files will link in + # the last one created. + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-$k.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-$k.$objext + objlist=" $obj" + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds$reload_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + func_append delfiles " $output" + + else + output= + fi + + ${skipped_export-false} && { + func_verbose "generating symbol list for '$libname.la'" + export_symbols=$output_objdir/$libname.exp + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + } + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs=$IFS; IFS='~' + for cmd in $concat_cmds; do + IFS=$save_ifs + $opt_quiet || { + func_quote_arg expand,pretty "$cmd" + eval "func_echo $func_quote_arg_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS=$save_ifs + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + ${skipped_export-false} && { + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols=$export_symbols + test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for '$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands, which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + } + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test yes = "$module" && test -n "$module_cmds"; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs=$IFS; IFS='~' + for cmd in $cmds; do + IFS=$sp$nl + eval cmd=\"$cmd\" + IFS=$save_ifs + $opt_quiet || { + func_quote_arg expand,pretty "$cmd" + eval "func_echo $func_quote_arg_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS=$save_ifs + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test yes = "$module" || test yes = "$export_dynamic"; then + # On all known operating systems, these are identical. + dlname=$soname + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + func_warning "'-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "'-l' and '-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "'-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "'-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "'-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "'-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object '$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj=$output + ;; + esac + + # Delete the old objects. + $opt_dry_run || $RM $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # if reload_cmds runs $LD directly, get rid of -Wl from + # whole_archive_flag_spec and hope we can get by with turning comma + # into space. + case $reload_cmds in + *\$LD[\ \$]*) wl= ;; + esac + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` + reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags + else + gentop=$output_objdir/${obj}x + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # If we're not building shared, we need to use non_pic_objs + test yes = "$build_libtool_libs" || libobjs=$non_pic_objects + + # Create the old-style object. + reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs + + output=$obj + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + test yes = "$build_libtool_libs" || { + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + } + + if test -n "$pic_flag" || test default != "$pic_mode"; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output=$libobj + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "'-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "'-release' is ignored for programs" + + $preload \ + && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ + && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test CXX = "$tagname"; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + func_append compile_command " $wl-bind_at_load" + func_append finalize_command " $wl-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + compile_deplibs=$new_libs + + + func_append compile_command " $compile_deplibs" + func_append finalize_command " $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) func_append dllsearchpath ":$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath=$rpath + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) func_append finalize_perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath=$rpath + + if test -n "$libobjs" && test yes = "$build_old_libs"; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" false + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=: + case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=false + ;; + *cygwin* | *mingw* ) + test yes = "$build_libtool_libs" || wrappers_required=false + ;; + *) + if test no = "$need_relink" || test yes != "$build_libtool_libs"; then + wrappers_required=false + fi + ;; + esac + $wrappers_required || { + # Replace the output file specification. + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + link_command=$compile_command$compile_rpath + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.$objext"; then + func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' + fi + + exit $exit_status + } + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + func_append rpath "$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test yes = "$no_install"; then + # We don't need to create a wrapper script. + link_command=$compile_var$compile_command$compile_rpath + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + exit $EXIT_SUCCESS + fi + + case $hardcode_action,$fast_install in + relink,*) + # Fast installation is not supported + link_command=$compile_var$compile_command$compile_rpath + relink_command=$finalize_var$finalize_command$finalize_rpath + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "'$output' will be relinked during installation" + ;; + *,yes) + link_command=$finalize_var$compile_command$finalize_rpath + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` + ;; + *,no) + link_command=$compile_var$compile_command$compile_rpath + relink_command=$finalize_var$finalize_command$finalize_rpath + ;; + *,needless) + link_command=$finalize_var$compile_command$finalize_rpath + relink_command= + ;; + esac + + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_arg pretty "$var_value" + relink_command="$var=$func_quote_arg_result; export $var; $relink_command" + fi + done + func_quote eval cd "`pwd`" + func_quote_arg pretty,unquoted "($func_quote_result; $relink_command)" + relink_command=$func_quote_arg_unquoted_result + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource=$output_path/$objdir/lt-$output_name.c + cwrapper=$output_path/$output_name.exe + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host"; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + case $build_libtool_libs in + convenience) + oldobjs="$libobjs_save $symfileobj" + addlibs=$convenience + build_libtool_libs=no + ;; + module) + oldobjs=$libobjs_save + addlibs=$old_convenience + build_libtool_libs=no + ;; + *) + oldobjs="$old_deplibs $non_pic_objects" + $preload && test -f "$symfileobj" \ + && func_append oldobjs " $symfileobj" + addlibs=$old_convenience + ;; + esac + + if test -n "$addlibs"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $addlibs + func_append oldobjs " $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append oldobjs " $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + echo "copying selected object files to avoid basename conflicts..." + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase=$func_basename_result + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" + ;; + *) func_append oldobjs " $obj" ;; + esac + done + fi + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj"; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test -z "$oldobjs"; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test yes = "$build_old_libs" && old_library=$libname.$libext + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_arg pretty,unquoted "$var_value" + relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + func_quote eval cd "`pwd`" + relink_command="($func_quote_result; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + func_quote_arg pretty,unquoted "$relink_command" + relink_command=$func_quote_arg_unquoted_result + if test yes = "$hardcode_automatic"; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test yes = "$installed"; then + if test -z "$install_libdir"; then + break + fi + output=$output_objdir/${outputname}i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name=$func_basename_result + func_resolve_sysroot "$deplib" + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` + test -z "$libdir" && \ + func_fatal_error "'$deplib' is not a valid libtool archive" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" + ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" + ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" + ;; + *) func_append newdependency_libs " $deplib" ;; + esac + done + dependency_libs=$newdependency_libs + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name=$func_basename_result + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "'$lib' is not a valid libtool archive" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" + ;; + *) func_append newdlfiles " $lib" ;; + esac + done + dlfiles=$newdlfiles + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name=$func_basename_result + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "'$lib' is not a valid libtool archive" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" + ;; + esac + done + dlprefiles=$newdlprefiles + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlfiles " $abs" + done + dlfiles=$newdlfiles + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlprefiles " $abs" + done + dlprefiles=$newdlprefiles + fi + $RM $output + # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test -n "$bindir"; then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result/$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that cannot go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test no,yes = "$installed,$need_relink"; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +if test link = "$opt_mode" || test relink = "$opt_mode"; then + func_mode_link ${1+"$@"} +fi + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $debug_cmd + + RM=$nonopt + files= + rmforce=false + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic=$magic + + for arg + do + case $arg in + -f) func_append RM " $arg"; rmforce=: ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + for file in $files; do + func_dirname "$file" "" "." + dir=$func_dirname_result + if test . = "$dir"; then + odir=$objdir + else + odir=$dir/$objdir + fi + func_basename "$file" + name=$func_basename_result + test uninstall = "$opt_mode" && odir=$dir + + # Remember odir for removal later, being careful to avoid duplicates + if test clean = "$opt_mode"; then + case " $rmdirs " in + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif $rmforce; then + continue + fi + + rmfiles=$file + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + func_append rmfiles " $odir/$n" + done + test -n "$old_library" && func_append rmfiles " $odir/$old_library" + + case $opt_mode in + clean) + case " $library_names " in + *" $dlname "*) ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; + esac + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && test none != "$pic_object"; then + func_append rmfiles " $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && test none != "$non_pic_object"; then + func_append rmfiles " $dir/$non_pic_object" + fi + fi + ;; + + *) + if test clean = "$opt_mode"; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + func_append rmfiles " $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + func_append rmfiles " $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + func_append rmfiles " $odir/$name $odir/${name}S.$objext" + if test yes = "$fast_install" && test -n "$relink_command"; then + func_append rmfiles " $odir/lt-$name" + fi + if test "X$noexename" != "X$name"; then + func_append rmfiles " $odir/lt-$noexename.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + + # Try to remove the $objdir's in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then + func_mode_uninstall ${1+"$@"} +fi + +test -z "$opt_mode" && { + help=$generic_help + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode '$opt_mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# where we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/vendor/unuran-1.11.0/autoconf/mdate-sh b/vendor/unuran-1.11.0/autoconf/mdate-sh new file mode 100755 index 0000000..e6d572d --- /dev/null +++ b/vendor/unuran-1.11.0/autoconf/mdate-sh @@ -0,0 +1,228 @@ +#!/bin/sh +# Get modification time of a file or directory and pretty-print it. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1995-2021 Free Software Foundation, Inc. +# written by Ulrich Drepper , June 1995 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +fi + +case $1 in + '') + echo "$0: No file. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: mdate-sh [--help] [--version] FILE + +Pretty-print the modification day of FILE, in the format: +1 January 1970 + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "mdate-sh $scriptversion" + exit $? + ;; +esac + +error () +{ + echo "$0: $1" >&2 + exit 1 +} + + +# Prevent date giving response in another language. +LANG=C +export LANG +LC_ALL=C +export LC_ALL +LC_TIME=C +export LC_TIME + +# Use UTC to get reproducible result. +TZ=UTC0 +export TZ + +# GNU ls changes its time format in response to the TIME_STYLE +# variable. Since we cannot assume 'unset' works, revert this +# variable to its documented default. +if test "${TIME_STYLE+set}" = set; then + TIME_STYLE=posix-long-iso + export TIME_STYLE +fi + +save_arg1=$1 + +# Find out how to get the extended ls output of a file or directory. +if ls -L /dev/null 1>/dev/null 2>&1; then + ls_command='ls -L -l -d' +else + ls_command='ls -l -d' +fi +# Avoid user/group names that might have spaces, when possible. +if ls -n /dev/null 1>/dev/null 2>&1; then + ls_command="$ls_command -n" +fi + +# A 'ls -l' line looks as follows on OS/2. +# drwxrwx--- 0 Aug 11 2001 foo +# This differs from Unix, which adds ownership information. +# drwxrwx--- 2 root root 4096 Aug 11 2001 foo +# +# To find the date, we split the line on spaces and iterate on words +# until we find a month. This cannot work with files whose owner is a +# user named "Jan", or "Feb", etc. However, it's unlikely that '/' +# will be owned by a user whose name is a month. So we first look at +# the extended ls output of the root directory to decide how many +# words should be skipped to get the date. + +# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. +set x`$ls_command /` + +# Find which argument is the month. +month= +command= +until test $month +do + test $# -gt 0 || error "failed parsing '$ls_command /' output" + shift + # Add another shift to the command. + command="$command shift;" + case $1 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; + esac +done + +test -n "$month" || error "failed parsing '$ls_command /' output" + +# Get the extended ls output of the file or directory. +set dummy x`eval "$ls_command \"\\\$save_arg1\""` + +# Remove all preceding arguments +eval $command + +# Because of the dummy argument above, month is in $2. +# +# On a POSIX system, we should have +# +# $# = 5 +# $1 = file size +# $2 = month +# $3 = day +# $4 = year or time +# $5 = filename +# +# On Darwin 7.7.0 and 7.6.0, we have +# +# $# = 4 +# $1 = day +# $2 = month +# $3 = year or time +# $4 = filename + +# Get the month. +case $2 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; +esac + +case $3 in + ???*) day=$1;; + *) day=$3; shift;; +esac + +# Here we have to deal with the problem that the ls output gives either +# the time of day or the year. +case $3 in + *:*) set `date`; eval year=\$$# + case $2 in + Jan) nummonthtod=1;; + Feb) nummonthtod=2;; + Mar) nummonthtod=3;; + Apr) nummonthtod=4;; + May) nummonthtod=5;; + Jun) nummonthtod=6;; + Jul) nummonthtod=7;; + Aug) nummonthtod=8;; + Sep) nummonthtod=9;; + Oct) nummonthtod=10;; + Nov) nummonthtod=11;; + Dec) nummonthtod=12;; + esac + # For the first six month of the year the time notation can also + # be used for files modified in the last year. + if (expr $nummonth \> $nummonthtod) > /dev/null; + then + year=`expr $year - 1` + fi;; + *) year=$3;; +esac + +# The result. +echo $day $month $year + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/vendor/unuran-1.11.0/autoconf/missing b/vendor/unuran-1.11.0/autoconf/missing new file mode 100755 index 0000000..1fe1611 --- /dev/null +++ b/vendor/unuran-1.11.0/autoconf/missing @@ -0,0 +1,215 @@ +#! /bin/sh +# Common wrapper for a few potentially missing GNU programs. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# Originally written by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try '$0 --help' for more information" + exit 1 +fi + +case $1 in + + --is-lightweight) + # Used by our autoconf macros to check whether the available missing + # script is modern enough. + exit 0 + ;; + + --run) + # Back-compat with the calling convention used by older automake. + shift + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due +to PROGRAM being missing or too old. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal autoconf autoheader autom4te automake makeinfo + bison yacc flex lex help2man + +Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and +'g' are ignored when checking the name. + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: unknown '$1' option" + echo 1>&2 "Try '$0 --help' for more information" + exit 1 + ;; + +esac + +# Run the given program, remember its exit status. +"$@"; st=$? + +# If it succeeded, we are done. +test $st -eq 0 && exit 0 + +# Also exit now if we it failed (or wasn't found), and '--version' was +# passed; such an option is passed most likely to detect whether the +# program is present and works. +case $2 in --version|--help) exit $st;; esac + +# Exit code 63 means version mismatch. This often happens when the user +# tries to use an ancient version of a tool on a file that requires a +# minimum version. +if test $st -eq 63; then + msg="probably too old" +elif test $st -eq 127; then + # Program was missing. + msg="missing on your system" +else + # Program was found and executed, but failed. Give up. + exit $st +fi + +perl_URL=https://www.perl.org/ +flex_URL=https://github.com/westes/flex +gnu_software_URL=https://www.gnu.org/software + +program_details () +{ + case $1 in + aclocal|automake) + echo "The '$1' program is part of the GNU Automake package:" + echo "<$gnu_software_URL/automake>" + echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/autoconf>" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + autoconf|autom4te|autoheader) + echo "The '$1' program is part of the GNU Autoconf package:" + echo "<$gnu_software_URL/autoconf/>" + echo "It also requires GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + esac +} + +give_advice () +{ + # Normalize program name to check for. + normalized_program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + + printf '%s\n' "'$1' is $msg." + + configure_deps="'configure.ac' or m4 files included by 'configure.ac'" + case $normalized_program in + autoconf*) + echo "You should only need it if you modified 'configure.ac'," + echo "or m4 files included by it." + program_details 'autoconf' + ;; + autoheader*) + echo "You should only need it if you modified 'acconfig.h' or" + echo "$configure_deps." + program_details 'autoheader' + ;; + automake*) + echo "You should only need it if you modified 'Makefile.am' or" + echo "$configure_deps." + program_details 'automake' + ;; + aclocal*) + echo "You should only need it if you modified 'acinclude.m4' or" + echo "$configure_deps." + program_details 'aclocal' + ;; + autom4te*) + echo "You might have modified some maintainer files that require" + echo "the 'autom4te' program to be rebuilt." + program_details 'autom4te' + ;; + bison*|yacc*) + echo "You should only need it if you modified a '.y' file." + echo "You may want to install the GNU Bison package:" + echo "<$gnu_software_URL/bison/>" + ;; + lex*|flex*) + echo "You should only need it if you modified a '.l' file." + echo "You may want to install the Fast Lexical Analyzer package:" + echo "<$flex_URL>" + ;; + help2man*) + echo "You should only need it if you modified a dependency" \ + "of a man page." + echo "You may want to install the GNU Help2man package:" + echo "<$gnu_software_URL/help2man/>" + ;; + makeinfo*) + echo "You should only need it if you modified a '.texi' file, or" + echo "any other file indirectly affecting the aspect of the manual." + echo "You might want to install the Texinfo package:" + echo "<$gnu_software_URL/texinfo/>" + echo "The spurious makeinfo call might also be the consequence of" + echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" + echo "want to install GNU make:" + echo "<$gnu_software_URL/make/>" + ;; + *) + echo "You might have modified some files without having the proper" + echo "tools for further handling them. Check the 'README' file, it" + echo "often tells you about the needed prerequisites for installing" + echo "this package. You may also peek at any GNU archive site, in" + echo "case some other package contains this missing '$1' program." + ;; + esac +} + +give_advice "$1" | sed -e '1s/^/WARNING: /' \ + -e '2,$s/^/ /' >&2 + +# Propagate the correct exit status (expected to be 127 for a program +# not found, 63 for a program that failed due to version mismatch). +exit $st + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/vendor/unuran-1.11.0/autoconf/test-driver b/vendor/unuran-1.11.0/autoconf/test-driver new file mode 100755 index 0000000..be73b80 --- /dev/null +++ b/vendor/unuran-1.11.0/autoconf/test-driver @@ -0,0 +1,153 @@ +#! /bin/sh +# test-driver - basic testsuite driver script. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 2011-2021 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +# Make unconditional expansion of undefined variables an error. This +# helps a lot in preventing typo-related bugs. +set -u + +usage_error () +{ + echo "$0: $*" >&2 + print_usage >&2 + exit 2 +} + +print_usage () +{ + cat <"$log_file" +"$@" >>"$log_file" 2>&1 +estatus=$? + +if test $enable_hard_errors = no && test $estatus -eq 99; then + tweaked_estatus=1 +else + tweaked_estatus=$estatus +fi + +case $tweaked_estatus:$expect_failure in + 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; + 0:*) col=$grn res=PASS recheck=no gcopy=no;; + 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; + 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; + *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; + *:*) col=$red res=FAIL recheck=yes gcopy=yes;; +esac + +# Report the test outcome and exit status in the logs, so that one can +# know whether the test passed or failed simply by looking at the '.log' +# file, without the need of also peaking into the corresponding '.trs' +# file (automake bug#11814). +echo "$res $test_name (exit status: $estatus)" >>"$log_file" + +# Report outcome to console. +echo "${col}${res}${std}: $test_name" + +# Register the test result, and other relevant metadata. +echo ":test-result: $res" > $trs_file +echo ":global-test-result: $res" >> $trs_file +echo ":recheck: $recheck" >> $trs_file +echo ":copy-in-global-log: $gcopy" >> $trs_file + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/vendor/unuran-1.11.0/autogen.sh b/vendor/unuran-1.11.0/autogen.sh new file mode 100755 index 0000000..896fef2 --- /dev/null +++ b/vendor/unuran-1.11.0/autogen.sh @@ -0,0 +1,86 @@ +#! /bin/sh +# Run this to generate all the initial makefiles, etc. + +# Constants +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +ORIGDIR=`pwd` +cd $srcdir +PROJECT=unuran +TEST_TYPE=-f +FILE=src/unuran_config.h # a file that should exist in the source dir +export WANT_AUTOMAKE=1.16 + +# Check for required programs +(libtoolize --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have libtool installed to compile $PROJECT." + exit 1 +} + +(autoheader --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have autoheader installed to compile $PROJECT." + exit 1 +} + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have autoconf installed to compile $PROJECT." + exit 1 +} + +(automake --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have automake installed to compile $PROJECT." + exit 1 +} + +test $TEST_TYPE $FILE || { + echo "You must run this script in the top-level $PROJECT directory" + exit 1 +} + +# Check for given command line arguments +if test -z "$*"; then + echo "I am going to run ./configure with no arguments - if you wish " + echo "to pass any to it, please specify them on the $0 command line." + echo +fi + +# Set flags for special compilers +case $CC in +*xlc | *xlc\ * | *lcc | *lcc\ *) am_opt=--include-deps;; +esac + +# Run autotools +echo "Running libtoolize ..." +libtoolize --automake + +echo; echo "Running aclocal ..." +aclocal + +echo; echo "Running autoheader ..." +autoheader --warnings=all + +echo; echo "Running automake ..." +automake --warnings=all --add-missing $am_opt + +echo; echo "Running autoconf ..." +autoconf --warnings=all +echo + +# Change to original directory +cd $ORIGDIR + +# Run ./configure script +echo; echo "Running configure ..." +$srcdir/configure --enable-maintainer-mode --enable-deprecated --enable-check-struct --enable-logging "$@" + +# End +echo +echo "Now type 'make' to compile $PROJECT." +echo + +exit 0 diff --git a/vendor/unuran-1.11.0/config.h b/vendor/unuran-1.11.0/config.h new file mode 100644 index 0000000..e560117 --- /dev/null +++ b/vendor/unuran-1.11.0/config.h @@ -0,0 +1,238 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the `alarm' function. */ +#define HAVE_ALARM 1 + +/* Define to 1 if you have the declaration of `alarm', and to 0 if you don't. + */ +#define HAVE_DECL_ALARM 1 + +/* Define to 1 if you have the declaration of `DBL_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_DBL_MAX 1 + +/* Define to 1 if you have the declaration of `getopt', and to 0 if you don't. + */ +#define HAVE_DECL_GETOPT 1 + +/* Define to 1 if you have the declaration of `HUGE_VAL', and to 0 if you + don't. */ +#define HAVE_DECL_HUGE_VAL 1 + +/* Define to 1 if you have the declaration of `hypot', and to 0 if you don't. + */ +#define HAVE_DECL_HYPOT 1 + +/* Define to 1 if you have the declaration of `INFINITY', and to 0 if you + don't. */ +#define HAVE_DECL_INFINITY 1 + +/* Define to 1 if you have the declaration of `isfinite', and to 0 if you + don't. */ +#define HAVE_DECL_ISFINITE 1 + +/* Define to 1 if you have the declaration of `isinf', and to 0 if you don't. + */ +#define HAVE_DECL_ISINF 1 + +/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. + */ +#define HAVE_DECL_ISNAN 1 + +/* Define to 1 if you have the declaration of `log1p', and to 0 if you don't. + */ +#define HAVE_DECL_LOG1P 1 + +/* Define to 1 if you have the declaration of `signal', and to 0 if you don't. + */ +#define HAVE_DECL_SIGNAL 1 + +/* Define to 1 if you have the declaration of `snprintf', and to 0 if you + don't. */ +#define HAVE_DECL_SNPRINTF 1 + +/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you + don't. */ +#define HAVE_DECL_VSNPRINTF 1 + +/* Define to 1 if "1.0/0.0" results in INFINITY */ +#define HAVE_DIVIDE_BY_ZERO 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FLOAT_H 1 + +/* Define to 1 if you have the `floor' function. */ +#define HAVE_FLOOR 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GSL_GSL_RNG_H */ + +/* Define to 1 if "x != x" is true for NaNs */ +#define HAVE_IEEE_COMPARISONS 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `gsl' library (-lgsl). */ +/* #undef HAVE_LIBGSL */ + +/* Define to 1 if you have the `gslcblas' library (-lgslcblas). */ +/* #undef HAVE_LIBGSLCBLAS */ + +/* Define to 1 if you have the `m' library (-lm). */ +#define HAVE_LIBM 1 + +/* Define to 1 if you have the `prng' library (-lprng). */ +/* #undef HAVE_LIBPRNG */ + +/* Define to 1 if you have the `Rmath' library (-lRmath). */ +/* #undef HAVE_LIBRMATH */ + +/* Define to 1 if you have the `rngstreams' library (-lrngstreams). */ +/* #undef HAVE_LIBRNGSTREAMS */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* Define to 1 if you have the `pow' function. */ +#define HAVE_POW 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PRNG_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_RNGSTREAM_H */ + +/* Define to 1 if you have the `signal' function. */ +#define HAVE_SIGNAL 1 + +/* Define to 1 if you have the `sqrt' function. */ +#define HAVE_SQRT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strtol' function. */ +#define HAVE_STRTOL 1 + +/* Define to 1 if you have the `strtoul' function. */ +#define HAVE_STRTOUL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Name of package */ +#define PACKAGE "unuran" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "unuran@statmath.wu.ac.at" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "unuran" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "unuran 1.11.0" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "unuran" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.11.0" + +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you use random number generators from GNU Scientific + Library. */ +/* #undef UNURAN_HAS_GSL */ + +/* Define to 1 if you use Otmar Lendl's PRNG library. */ +/* #undef UNURAN_HAS_PRNG */ + +/* Define to 1 if you use Pierre L'Ecuyer's RNGSTREAM library. */ +/* #undef UNURAN_HAS_RNGSTREAM */ + +/* Define to 1 if you want to use magic cookies to validate type of a pointer + */ +/* #undef UNUR_COOKIES */ + +/* Define to 1 if you want to perform additional checks against an invalid + NULL pointer */ +/* #undef UNUR_ENABLE_CHECKNULL */ + +/* Define to 1 if you want to use the info routine for printing informations + about UNU.RAN objects */ +#define UNUR_ENABLE_INFO 1 + +/* Define to 1 if you want to use a logfile for logging informations about + UNU.RAN objects */ +/* #undef UNUR_ENABLE_LOGGING */ + +/* Define to 1 if you use RNGSTREAM as global URNG. */ +/* #undef UNUR_URNG_DEFAULT_RNGSTREAM */ + +/* Define to 1 if you want to use deprecated code. */ +/* #undef USE_DEPRECATED_CODE */ + +/* Define to 1 if you want to use experimental code */ +/* #undef USE_EXPERIMENTAL_CODE */ + +/* Version number of package */ +#define VERSION "1.11.0" + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ diff --git a/vendor/unuran-1.11.0/config.h.in b/vendor/unuran-1.11.0/config.h.in new file mode 100644 index 0000000..926560c --- /dev/null +++ b/vendor/unuran-1.11.0/config.h.in @@ -0,0 +1,237 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the `alarm' function. */ +#undef HAVE_ALARM + +/* Define to 1 if you have the declaration of `alarm', and to 0 if you don't. + */ +#undef HAVE_DECL_ALARM + +/* Define to 1 if you have the declaration of `DBL_MAX', and to 0 if you + don't. */ +#undef HAVE_DECL_DBL_MAX + +/* Define to 1 if you have the declaration of `getopt', and to 0 if you don't. + */ +#undef HAVE_DECL_GETOPT + +/* Define to 1 if you have the declaration of `HUGE_VAL', and to 0 if you + don't. */ +#undef HAVE_DECL_HUGE_VAL + +/* Define to 1 if you have the declaration of `hypot', and to 0 if you don't. + */ +#undef HAVE_DECL_HYPOT + +/* Define to 1 if you have the declaration of `INFINITY', and to 0 if you + don't. */ +#undef HAVE_DECL_INFINITY + +/* Define to 1 if you have the declaration of `isfinite', and to 0 if you + don't. */ +#undef HAVE_DECL_ISFINITE + +/* Define to 1 if you have the declaration of `isinf', and to 0 if you don't. + */ +#undef HAVE_DECL_ISINF + +/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. + */ +#undef HAVE_DECL_ISNAN + +/* Define to 1 if you have the declaration of `log1p', and to 0 if you don't. + */ +#undef HAVE_DECL_LOG1P + +/* Define to 1 if you have the declaration of `signal', and to 0 if you don't. + */ +#undef HAVE_DECL_SIGNAL + +/* Define to 1 if you have the declaration of `snprintf', and to 0 if you + don't. */ +#undef HAVE_DECL_SNPRINTF + +/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you + don't. */ +#undef HAVE_DECL_VSNPRINTF + +/* Define to 1 if "1.0/0.0" results in INFINITY */ +#undef HAVE_DIVIDE_BY_ZERO + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FLOAT_H + +/* Define to 1 if you have the `floor' function. */ +#undef HAVE_FLOOR + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the header file. */ +#undef HAVE_GSL_GSL_RNG_H + +/* Define to 1 if "x != x" is true for NaNs */ +#undef HAVE_IEEE_COMPARISONS + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `gsl' library (-lgsl). */ +#undef HAVE_LIBGSL + +/* Define to 1 if you have the `gslcblas' library (-lgslcblas). */ +#undef HAVE_LIBGSLCBLAS + +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + +/* Define to 1 if you have the `prng' library (-lprng). */ +#undef HAVE_LIBPRNG + +/* Define to 1 if you have the `Rmath' library (-lRmath). */ +#undef HAVE_LIBRMATH + +/* Define to 1 if you have the `rngstreams' library (-lrngstreams). */ +#undef HAVE_LIBRNGSTREAMS + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* Define to 1 if you have the `pow' function. */ +#undef HAVE_POW + +/* Define to 1 if you have the header file. */ +#undef HAVE_PRNG_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_RNGSTREAM_H + +/* Define to 1 if you have the `signal' function. */ +#undef HAVE_SIGNAL + +/* Define to 1 if you have the `sqrt' function. */ +#undef HAVE_SQRT + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strtol' function. */ +#undef HAVE_STRTOL + +/* Define to 1 if you have the `strtoul' function. */ +#undef HAVE_STRTOUL + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#undef LT_OBJDIR + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ +#undef STDC_HEADERS + +/* Define to 1 if you use random number generators from GNU Scientific + Library. */ +#undef UNURAN_HAS_GSL + +/* Define to 1 if you use Otmar Lendl's PRNG library. */ +#undef UNURAN_HAS_PRNG + +/* Define to 1 if you use Pierre L'Ecuyer's RNGSTREAM library. */ +#undef UNURAN_HAS_RNGSTREAM + +/* Define to 1 if you want to use magic cookies to validate type of a pointer + */ +#undef UNUR_COOKIES + +/* Define to 1 if you want to perform additional checks against an invalid + NULL pointer */ +#undef UNUR_ENABLE_CHECKNULL + +/* Define to 1 if you want to use the info routine for printing informations + about UNU.RAN objects */ +#undef UNUR_ENABLE_INFO + +/* Define to 1 if you want to use a logfile for logging informations about + UNU.RAN objects */ +#undef UNUR_ENABLE_LOGGING + +/* Define to 1 if you use RNGSTREAM as global URNG. */ +#undef UNUR_URNG_DEFAULT_RNGSTREAM + +/* Define to 1 if you want to use deprecated code. */ +#undef USE_DEPRECATED_CODE + +/* Define to 1 if you want to use experimental code */ +#undef USE_EXPERIMENTAL_CODE + +/* Version number of package */ +#undef VERSION + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to `unsigned int' if does not define. */ +#undef size_t diff --git a/vendor/unuran-1.11.0/config.log b/vendor/unuran-1.11.0/config.log new file mode 100644 index 0000000..71376c8 --- /dev/null +++ b/vendor/unuran-1.11.0/config.log @@ -0,0 +1,1414 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by unuran configure 1.11.0, which was +generated by GNU Autoconf 2.71. Invocation command line was + + $ /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/configure --prefix=/home/wrdx/5_sem/pysatl-core/vendor/unuran-build --enable-static --disable-shared + +## --------- ## +## Platform. ## +## --------- ## + +hostname = wrdx +uname -m = x86_64 +uname -r = 6.14.0-36-generic +uname -s = Linux +uname -v = #36~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Oct 15 15:45:17 UTC 2 + +/usr/bin/uname -p = x86_64 +/bin/uname -X = unknown + +/bin/arch = x86_64 +/usr/bin/arch -k = unknown +/usr/convex/getsysinfo = unknown +/usr/bin/hostinfo = unknown +/bin/machine = unknown +/usr/bin/oslevel = unknown +/bin/universe = unknown + +PATH: /home/wrdx/5_sem/.venv/bin/ +PATH: /usr/local/sbin/ +PATH: /usr/local/bin/ +PATH: /usr/sbin/ +PATH: /usr/bin/ +PATH: /sbin/ +PATH: /bin/ +PATH: /usr/games/ +PATH: /usr/local/games/ +PATH: /snap/bin/ +PATH: /snap/bin/ + + +## ----------- ## +## Core tests. ## +## ----------- ## + +configure:2957: looking for aux files: ltmain.sh compile config.guess config.sub missing install-sh +configure:2970: trying ./autoconf/ +configure:2999: ./autoconf/ltmain.sh found +configure:2999: ./autoconf/compile found +configure:2999: ./autoconf/config.guess found +configure:2999: ./autoconf/config.sub found +configure:2999: ./autoconf/missing found +configure:2981: ./autoconf/install-sh found +configure:3132: checking for a BSD-compatible install +configure:3205: result: /usr/bin/install -c +configure:3216: checking whether build environment is sane +configure:3271: result: yes +configure:3430: checking for a race-free mkdir -p +configure:3474: result: /usr/bin/mkdir -p +configure:3481: checking for gawk +configure:3516: result: no +configure:3481: checking for mawk +configure:3502: found /usr/bin/mawk +configure:3513: result: mawk +configure:3524: checking whether make sets $(MAKE) +configure:3547: result: yes +configure:3577: checking whether make supports nested variables +configure:3595: result: yes +configure:3737: checking whether to enable maintainer-specific portions of Makefiles +configure:3747: result: no +configure:3767: checking build system type +configure:3782: result: x86_64-pc-linux-gnu +configure:3802: checking host system type +configure:3816: result: x86_64-pc-linux-gnu +configure:3837: checking whether make sets $(MAKE) +configure:3860: result: yes +configure:3931: checking for gcc +configure:3952: found /usr/bin/gcc +configure:3963: result: gcc +configure:4316: checking for C compiler version +configure:4325: gcc --version >&5 +gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0 +Copyright (C) 2023 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +configure:4336: $? = 0 +configure:4325: gcc -v >&5 +Using built-in specs. +COLLECT_GCC=gcc +COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper +OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 +Thread model: posix +Supported LTO compression algorithms: zlib zstd +gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04) +... rest of stderr output deleted ... +configure:4336: $? = 0 +configure:4325: gcc -V >&5 +gcc: error: unrecognized command-line option '-V' +gcc: fatal error: no input files +compilation terminated. +configure:4336: $? = 1 +configure:4325: gcc -qversion >&5 +gcc: error: unrecognized command-line option '-qversion'; did you mean '--version'? +gcc: fatal error: no input files +compilation terminated. +configure:4336: $? = 1 +configure:4325: gcc -version >&5 +gcc: error: unrecognized command-line option '-version' +gcc: fatal error: no input files +compilation terminated. +configure:4336: $? = 1 +configure:4356: checking whether the C compiler works +configure:4378: gcc -fPIC conftest.c >&5 +configure:4382: $? = 0 +configure:4432: result: yes +configure:4435: checking for C compiler default output file name +configure:4437: result: a.out +configure:4443: checking for suffix of executables +configure:4450: gcc -o conftest -fPIC conftest.c >&5 +configure:4454: $? = 0 +configure:4477: result: +configure:4499: checking whether we are cross compiling +configure:4507: gcc -o conftest -fPIC conftest.c >&5 +configure:4511: $? = 0 +configure:4518: ./conftest +configure:4522: $? = 0 +configure:4537: result: no +configure:4542: checking for suffix of object files +configure:4565: gcc -c -fPIC conftest.c >&5 +configure:4569: $? = 0 +configure:4591: result: o +configure:4595: checking whether the compiler supports GNU C +configure:4615: gcc -c -fPIC conftest.c >&5 +configure:4615: $? = 0 +configure:4625: result: yes +configure:4636: checking whether gcc accepts -g +configure:4657: gcc -c -g conftest.c >&5 +configure:4657: $? = 0 +configure:4701: result: yes +configure:4721: checking for gcc option to enable C11 features +configure:4736: gcc -c -fPIC conftest.c >&5 +configure:4736: $? = 0 +configure:4754: result: none needed +configure:4870: checking whether gcc understands -c and -o together +configure:4893: gcc -c conftest.c -o conftest2.o +configure:4896: $? = 0 +configure:4893: gcc -c conftest.c -o conftest2.o +configure:4896: $? = 0 +configure:4908: result: yes +configure:4928: checking whether make supports the include directive +configure:4943: make -f confmf.GNU && cat confinc.out +this is the am__doit target +configure:4946: $? = 0 +configure:4965: result: yes (GNU style) +configure:4991: checking dependency style of gcc +configure:5103: result: gcc3 +configure:5187: checking for g++ +configure:5208: found /usr/bin/g++ +configure:5219: result: g++ +configure:5246: checking for C++ compiler version +configure:5255: g++ --version >&5 +g++ (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0 +Copyright (C) 2023 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +configure:5266: $? = 0 +configure:5255: g++ -v >&5 +Using built-in specs. +COLLECT_GCC=g++ +COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper +OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 +Thread model: posix +Supported LTO compression algorithms: zlib zstd +gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04) +... rest of stderr output deleted ... +configure:5266: $? = 0 +configure:5255: g++ -V >&5 +g++: error: unrecognized command-line option '-V' +g++: fatal error: no input files +compilation terminated. +configure:5266: $? = 1 +configure:5255: g++ -qversion >&5 +g++: error: unrecognized command-line option '-qversion'; did you mean '--version'? +g++: fatal error: no input files +compilation terminated. +configure:5266: $? = 1 +configure:5270: checking whether the compiler supports GNU C++ +configure:5290: g++ -c conftest.cpp >&5 +configure:5290: $? = 0 +configure:5300: result: yes +configure:5311: checking whether g++ accepts -g +configure:5332: g++ -c -g conftest.cpp >&5 +configure:5332: $? = 0 +configure:5376: result: yes +configure:5396: checking for g++ option to enable C++11 features +configure:5411: g++ -c -g -O2 conftest.cpp >&5 +conftest.cpp: In function 'int main(int, char**)': +conftest.cpp:177:25: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] + 177 | cxx11test::delegate d2(); + | ^~ +conftest.cpp:177:25: note: remove parentheses to default-initialize a variable + 177 | cxx11test::delegate d2(); + | ^~ + | -- +conftest.cpp:177:25: note: or replace parentheses with braces to value-initialize a variable +configure:5411: $? = 0 +configure:5429: result: none needed +configure:5495: checking dependency style of g++ +configure:5607: result: gcc3 +configure:5627: checking how to run the C preprocessor +configure:5653: gcc -E conftest.c +configure:5653: $? = 0 +configure:5668: gcc -E conftest.c +conftest.c:11:10: fatal error: ac_nonexistent.h: No such file or directory + 11 | #include + | ^~~~~~~~~~~~~~~~~~ +compilation terminated. +configure:5668: $? = 1 +configure: failed program was: +| /* confdefs.h */ +| #define PACKAGE_NAME "unuran" +| #define PACKAGE_TARNAME "unuran" +| #define PACKAGE_VERSION "1.11.0" +| #define PACKAGE_STRING "unuran 1.11.0" +| #define PACKAGE_BUGREPORT "unuran@statmath.wu.ac.at" +| #define PACKAGE_URL "" +| #define PACKAGE "unuran" +| #define VERSION "1.11.0" +| /* end confdefs.h. */ +| #include +configure:5695: result: gcc -E +configure:5709: gcc -E conftest.c +configure:5709: $? = 0 +configure:5724: gcc -E conftest.c +conftest.c:11:10: fatal error: ac_nonexistent.h: No such file or directory + 11 | #include + | ^~~~~~~~~~~~~~~~~~ +compilation terminated. +configure:5724: $? = 1 +configure: failed program was: +| /* confdefs.h */ +| #define PACKAGE_NAME "unuran" +| #define PACKAGE_TARNAME "unuran" +| #define PACKAGE_VERSION "1.11.0" +| #define PACKAGE_STRING "unuran 1.11.0" +| #define PACKAGE_BUGREPORT "unuran@statmath.wu.ac.at" +| #define PACKAGE_URL "" +| #define PACKAGE "unuran" +| #define VERSION "1.11.0" +| /* end confdefs.h. */ +| #include +configure:5802: checking for ranlib +configure:5823: found /usr/bin/ranlib +configure:5834: result: ranlib +configure:5857: checking whether ln -s works +configure:5861: result: yes +configure:5916: checking for ar +configure:5937: found /usr/bin/ar +configure:5948: result: ar +configure:6017: checking how to print strings +configure:6044: result: printf +configure:6065: checking for a sed that does not truncate output +configure:6135: result: /usr/bin/sed +configure:6153: checking for grep that handles long lines and -e +configure:6217: result: /usr/bin/grep +configure:6222: checking for egrep +configure:6290: result: /usr/bin/grep -E +configure:6295: checking for fgrep +configure:6363: result: /usr/bin/grep -F +configure:6399: checking for ld used by gcc +configure:6467: result: /usr/bin/ld +configure:6474: checking if the linker (/usr/bin/ld) is GNU ld +configure:6490: result: yes +configure:6502: checking for BSD- or MS-compatible name lister (nm) +configure:6557: result: /usr/bin/nm -B +configure:6697: checking the name lister (/usr/bin/nm -B) interface +configure:6705: gcc -c -fPIC conftest.c >&5 +configure:6708: /usr/bin/nm -B "conftest.o" +configure:6711: output +0000000000000000 B some_variable +configure:6718: result: BSD nm +configure:6722: checking the maximum length of command line arguments +configure:6859: result: 1572864 +configure:6907: checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format +configure:6948: result: func_convert_file_noop +configure:6955: checking how to convert x86_64-pc-linux-gnu file names to toolchain format +configure:6976: result: func_convert_file_noop +configure:6983: checking for /usr/bin/ld option to reload object files +configure:6991: result: -r +configure:7070: checking for file +configure:7091: found /usr/bin/file +configure:7102: result: file +configure:7178: checking for objdump +configure:7199: found /usr/bin/objdump +configure:7210: result: objdump +configure:7242: checking how to recognize dependent libraries +configure:7443: result: pass_all +configure:7533: checking for dlltool +configure:7568: result: no +configure:7598: checking how to associate runtime and link libraries +configure:7626: result: printf %s\n +configure:7777: checking for archiver @FILE support +configure:7795: gcc -c -fPIC conftest.c >&5 +configure:7795: $? = 0 +configure:7799: ar cr libconftest.a @conftest.lst >&5 +configure:7802: $? = 0 +configure:7807: ar cr libconftest.a @conftest.lst >&5 +ar: conftest.o: No such file or directory +configure:7810: $? = 1 +configure:7822: result: @ +configure:7885: checking for strip +configure:7906: found /usr/bin/strip +configure:7917: result: strip +configure:7994: checking for ranlib +configure:8026: result: ranlib +configure:8128: checking command to parse /usr/bin/nm -B output from gcc object +configure:8282: gcc -c -fPIC conftest.c >&5 +configure:8285: $? = 0 +configure:8289: /usr/bin/nm -B conftest.o \| /usr/bin/sed -n -e 's/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' | /usr/bin/sed '/ __gnu_lto/d' \> conftest.nm +configure:8292: $? = 0 +configure:8358: gcc -o conftest -fPIC conftest.c conftstm.o >&5 +configure:8361: $? = 0 +configure:8399: result: ok +configure:8446: checking for sysroot +configure:8477: result: no +configure:8484: checking for a working dd +configure:8528: result: /usr/bin/dd +configure:8532: checking how to truncate binary pipes +configure:8548: result: /usr/bin/dd bs=4096 count=1 +configure:8685: gcc -c -fPIC conftest.c >&5 +configure:8688: $? = 0 +configure:8885: checking for mt +configure:8906: found /usr/bin/mt +configure:8917: result: mt +configure:8940: checking if mt is a manifest tool +configure:8947: mt '-?' +configure:8955: result: no +configure:9680: checking for stdio.h +configure:9680: gcc -c -fPIC conftest.c >&5 +configure:9680: $? = 0 +configure:9680: result: yes +configure:9680: checking for stdlib.h +configure:9680: gcc -c -fPIC conftest.c >&5 +configure:9680: $? = 0 +configure:9680: result: yes +configure:9680: checking for string.h +configure:9680: gcc -c -fPIC conftest.c >&5 +configure:9680: $? = 0 +configure:9680: result: yes +configure:9680: checking for inttypes.h +configure:9680: gcc -c -fPIC conftest.c >&5 +configure:9680: $? = 0 +configure:9680: result: yes +configure:9680: checking for stdint.h +configure:9680: gcc -c -fPIC conftest.c >&5 +configure:9680: $? = 0 +configure:9680: result: yes +configure:9680: checking for strings.h +configure:9680: gcc -c -fPIC conftest.c >&5 +configure:9680: $? = 0 +configure:9680: result: yes +configure:9680: checking for sys/stat.h +configure:9680: gcc -c -fPIC conftest.c >&5 +configure:9680: $? = 0 +configure:9680: result: yes +configure:9680: checking for sys/types.h +configure:9680: gcc -c -fPIC conftest.c >&5 +configure:9680: $? = 0 +configure:9680: result: yes +configure:9680: checking for unistd.h +configure:9680: gcc -c -fPIC conftest.c >&5 +configure:9680: $? = 0 +configure:9680: result: yes +configure:9680: checking for sys/time.h +configure:9680: gcc -c -fPIC conftest.c >&5 +configure:9680: $? = 0 +configure:9680: result: yes +configure:9705: checking for dlfcn.h +configure:9705: gcc -c -fPIC conftest.c >&5 +configure:9705: $? = 0 +configure:9705: result: yes +configure:9974: checking for objdir +configure:9990: result: .libs +configure:10250: checking if gcc supports -fno-rtti -fno-exceptions +configure:10269: gcc -c -fPIC -fno-rtti -fno-exceptions conftest.c >&5 +cc1: warning: command-line option '-fno-rtti' is valid for C++/D/ObjC++ but not for C +configure:10273: $? = 0 +configure:10286: result: no +configure:10644: checking for gcc option to produce PIC +configure:10652: result: -fPIC -DPIC +configure:10660: checking if gcc PIC flag -fPIC -DPIC works +configure:10679: gcc -c -fPIC -fPIC -DPIC -DPIC conftest.c >&5 +configure:10683: $? = 0 +configure:10696: result: yes +configure:10725: checking if gcc static flag -static works +configure:10754: result: yes +configure:10769: checking if gcc supports -c -o file.o +configure:10791: gcc -c -fPIC -o out/conftest2.o conftest.c >&5 +configure:10795: $? = 0 +configure:10817: result: yes +configure:10825: checking if gcc supports -c -o file.o +configure:10873: result: yes +configure:10906: checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries +configure:12174: result: yes +configure:12415: checking dynamic linker characteristics +configure:13010: gcc -o conftest -fPIC -Wl,-rpath -Wl,/foo conftest.c >&5 +configure:13010: $? = 0 +configure:13249: result: GNU/Linux ld.so +configure:13371: checking how to hardcode library paths into programs +configure:13396: result: immediate +configure:13978: checking whether stripping libraries is possible +configure:13987: result: yes +configure:14029: checking if libtool supports shared libraries +configure:14031: result: yes +configure:14034: checking whether to build shared libraries +configure:14059: result: no +configure:14062: checking whether to build static libraries +configure:14066: result: yes +configure:14089: checking how to run the C++ preprocessor +configure:14111: g++ -E conftest.cpp +configure:14111: $? = 0 +configure:14126: g++ -E conftest.cpp +conftest.cpp:24:10: fatal error: ac_nonexistent.h: No such file or directory + 24 | #include + | ^~~~~~~~~~~~~~~~~~ +compilation terminated. +configure:14126: $? = 1 +configure: failed program was: +| /* confdefs.h */ +| #define PACKAGE_NAME "unuran" +| #define PACKAGE_TARNAME "unuran" +| #define PACKAGE_VERSION "1.11.0" +| #define PACKAGE_STRING "unuran 1.11.0" +| #define PACKAGE_BUGREPORT "unuran@statmath.wu.ac.at" +| #define PACKAGE_URL "" +| #define PACKAGE "unuran" +| #define VERSION "1.11.0" +| #define HAVE_STDIO_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_UNISTD_H 1 +| #define HAVE_SYS_TIME_H 1 +| #define STDC_HEADERS 1 +| #define HAVE_DLFCN_H 1 +| #define LT_OBJDIR ".libs/" +| /* end confdefs.h. */ +| #include +configure:14153: result: g++ -E +configure:14167: g++ -E conftest.cpp +configure:14167: $? = 0 +configure:14182: g++ -E conftest.cpp +conftest.cpp:24:10: fatal error: ac_nonexistent.h: No such file or directory + 24 | #include + | ^~~~~~~~~~~~~~~~~~ +compilation terminated. +configure:14182: $? = 1 +configure: failed program was: +| /* confdefs.h */ +| #define PACKAGE_NAME "unuran" +| #define PACKAGE_TARNAME "unuran" +| #define PACKAGE_VERSION "1.11.0" +| #define PACKAGE_STRING "unuran 1.11.0" +| #define PACKAGE_BUGREPORT "unuran@statmath.wu.ac.at" +| #define PACKAGE_URL "" +| #define PACKAGE "unuran" +| #define VERSION "1.11.0" +| #define HAVE_STDIO_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_UNISTD_H 1 +| #define HAVE_SYS_TIME_H 1 +| #define STDC_HEADERS 1 +| #define HAVE_DLFCN_H 1 +| #define LT_OBJDIR ".libs/" +| /* end confdefs.h. */ +| #include +configure:14347: checking for ld used by g++ +configure:14415: result: /usr/bin/ld -m elf_x86_64 +configure:14422: checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld +configure:14438: result: yes +configure:14493: checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries +configure:15571: result: yes +configure:15607: g++ -c -g -O2 conftest.cpp >&5 +configure:15610: $? = 0 +configure:16091: checking for g++ option to produce PIC +configure:16099: result: -fPIC -DPIC +configure:16107: checking if g++ PIC flag -fPIC -DPIC works +configure:16126: g++ -c -g -O2 -fPIC -DPIC -DPIC conftest.cpp >&5 +configure:16130: $? = 0 +configure:16143: result: yes +configure:16166: checking if g++ static flag -static works +configure:16195: result: yes +configure:16207: checking if g++ supports -c -o file.o +configure:16229: g++ -c -g -O2 -o out/conftest2.o conftest.cpp >&5 +configure:16233: $? = 0 +configure:16255: result: yes +configure:16260: checking if g++ supports -c -o file.o +configure:16308: result: yes +configure:16338: checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries +configure:16378: result: yes +configure:16520: checking dynamic linker characteristics +configure:17281: result: GNU/Linux ld.so +configure:17346: checking how to hardcode library paths into programs +configure:17371: result: immediate +configure:17433: checking for sqrt in -lm +configure:17462: gcc -o conftest -fPIC conftest.c -lm >&5 +conftest.c:34:6: warning: conflicting types for built-in function 'sqrt'; expected 'double(double)' [-Wbuiltin-declaration-mismatch] + 34 | char sqrt (void); + | ^~~~ +conftest.c:1:1: note: 'sqrt' is declared in header '' + 1 | /* confdefs.h */ +configure:17462: $? = 0 +configure:17472: result: yes +configure:17483: checking for cblas_dgemm in -lgslcblas +configure:17512: gcc -o conftest -fPIC conftest.c -lgslcblas -lm >&5 +/usr/bin/ld: cannot find -lgslcblas: No such file or directory +collect2: error: ld returned 1 exit status +configure:17512: $? = 1 +configure: failed program was: +| /* confdefs.h */ +| #define PACKAGE_NAME "unuran" +| #define PACKAGE_TARNAME "unuran" +| #define PACKAGE_VERSION "1.11.0" +| #define PACKAGE_STRING "unuran 1.11.0" +| #define PACKAGE_BUGREPORT "unuran@statmath.wu.ac.at" +| #define PACKAGE_URL "" +| #define PACKAGE "unuran" +| #define VERSION "1.11.0" +| #define HAVE_STDIO_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_UNISTD_H 1 +| #define HAVE_SYS_TIME_H 1 +| #define STDC_HEADERS 1 +| #define HAVE_DLFCN_H 1 +| #define LT_OBJDIR ".libs/" +| #define HAVE_LIBM 1 +| /* end confdefs.h. */ +| +| /* Override any GCC internal prototype to avoid an error. +| Use char because int might match the return type of a GCC +| builtin and then its argument prototype would still apply. +| The 'extern "C"' is for builds by C++ compilers; +| although this is not generally supported in C code supporting it here +| has little cost and some practical benefit (sr 110532). */ +| #ifdef __cplusplus +| extern "C" +| #endif +| char cblas_dgemm (void); +| int +| main (void) +| { +| return cblas_dgemm (); +| ; +| return 0; +| } +configure:17522: result: no +configure:17532: checking for gsl_blas_dgemm in -lgsl +configure:17561: gcc -o conftest -fPIC conftest.c -lgsl -lm >&5 +/usr/bin/ld: cannot find -lgsl: No such file or directory +collect2: error: ld returned 1 exit status +configure:17561: $? = 1 +configure: failed program was: +| /* confdefs.h */ +| #define PACKAGE_NAME "unuran" +| #define PACKAGE_TARNAME "unuran" +| #define PACKAGE_VERSION "1.11.0" +| #define PACKAGE_STRING "unuran 1.11.0" +| #define PACKAGE_BUGREPORT "unuran@statmath.wu.ac.at" +| #define PACKAGE_URL "" +| #define PACKAGE "unuran" +| #define VERSION "1.11.0" +| #define HAVE_STDIO_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_UNISTD_H 1 +| #define HAVE_SYS_TIME_H 1 +| #define STDC_HEADERS 1 +| #define HAVE_DLFCN_H 1 +| #define LT_OBJDIR ".libs/" +| #define HAVE_LIBM 1 +| /* end confdefs.h. */ +| +| /* Override any GCC internal prototype to avoid an error. +| Use char because int might match the return type of a GCC +| builtin and then its argument prototype would still apply. +| The 'extern "C"' is for builds by C++ compilers; +| although this is not generally supported in C code supporting it here +| has little cost and some practical benefit (sr 110532). */ +| #ifdef __cplusplus +| extern "C" +| #endif +| char gsl_blas_dgemm (void); +| int +| main (void) +| { +| return gsl_blas_dgemm (); +| ; +| return 0; +| } +configure:17571: result: no +configure:17972: checking for float.h +configure:17972: gcc -c -fPIC conftest.c >&5 +configure:17972: $? = 0 +configure:17972: result: yes +configure:17978: checking for limits.h +configure:17978: gcc -c -fPIC conftest.c >&5 +configure:17978: $? = 0 +configure:17978: result: yes +configure:17984: checking for stdlib.h +configure:17984: result: yes +configure:17990: checking for string.h +configure:17990: result: yes +configure:17996: checking for unistd.h +configure:17996: result: yes +configure:18006: checking for an ANSI C-conforming const +configure:18073: gcc -c -fPIC conftest.c >&5 +configure:18073: $? = 0 +configure:18081: result: yes +configure:18089: checking for inline +configure:18106: gcc -c -fPIC conftest.c >&5 +configure:18106: $? = 0 +configure:18115: result: inline +configure:18133: checking for size_t +configure:18133: gcc -c -fPIC conftest.c >&5 +configure:18133: $? = 0 +configure:18133: gcc -c -fPIC conftest.c >&5 +conftest.c: In function 'main': +conftest.c:61:21: error: expected expression before ')' token + 61 | if (sizeof ((size_t))) + | ^ +configure:18133: $? = 1 +configure: failed program was: +| /* confdefs.h */ +| #define PACKAGE_NAME "unuran" +| #define PACKAGE_TARNAME "unuran" +| #define PACKAGE_VERSION "1.11.0" +| #define PACKAGE_STRING "unuran 1.11.0" +| #define PACKAGE_BUGREPORT "unuran@statmath.wu.ac.at" +| #define PACKAGE_URL "" +| #define PACKAGE "unuran" +| #define VERSION "1.11.0" +| #define HAVE_STDIO_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_UNISTD_H 1 +| #define HAVE_SYS_TIME_H 1 +| #define STDC_HEADERS 1 +| #define HAVE_DLFCN_H 1 +| #define LT_OBJDIR ".libs/" +| #define HAVE_LIBM 1 +| #define HAVE_FLOAT_H 1 +| #define HAVE_LIMITS_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_UNISTD_H 1 +| /* end confdefs.h. */ +| #include +| #ifdef HAVE_STDIO_H +| # include +| #endif +| #ifdef HAVE_STDLIB_H +| # include +| #endif +| #ifdef HAVE_STRING_H +| # include +| #endif +| #ifdef HAVE_INTTYPES_H +| # include +| #endif +| #ifdef HAVE_STDINT_H +| # include +| #endif +| #ifdef HAVE_STRINGS_H +| # include +| #endif +| #ifdef HAVE_SYS_TYPES_H +| # include +| #endif +| #ifdef HAVE_SYS_STAT_H +| # include +| #endif +| #ifdef HAVE_UNISTD_H +| # include +| #endif +| int +| main (void) +| { +| if (sizeof ((size_t))) +| return 0; +| ; +| return 0; +| } +configure:18133: result: yes +configure:18145: checking for alarm +configure:18145: gcc -o conftest -fPIC conftest.c -lm >&5 +configure:18145: $? = 0 +configure:18145: result: yes +configure:18151: checking for floor +configure:18151: gcc -o conftest -fPIC conftest.c -lm >&5 +conftest.c:47:6: warning: conflicting types for built-in function 'floor'; expected 'double(double)' [-Wbuiltin-declaration-mismatch] + 47 | char floor (void); + | ^~~~~ +conftest.c:39:1: note: 'floor' is declared in header '' + 38 | #include + 39 | #undef floor +configure:18151: $? = 0 +configure:18151: result: yes +configure:18157: checking for gettimeofday +configure:18157: gcc -o conftest -fPIC conftest.c -lm >&5 +configure:18157: $? = 0 +configure:18157: result: yes +configure:18163: checking for memset +configure:18163: gcc -o conftest -fPIC conftest.c -lm >&5 +conftest.c:49:6: warning: conflicting types for built-in function 'memset'; expected 'void *(void *, int, long unsigned int)' [-Wbuiltin-declaration-mismatch] + 49 | char memset (void); + | ^~~~~~ +conftest.c:41:1: note: 'memset' is declared in header '' + 40 | #include + 41 | #undef memset +configure:18163: $? = 0 +configure:18163: result: yes +configure:18169: checking for pow +configure:18169: gcc -o conftest -fPIC conftest.c -lm >&5 +conftest.c:50:6: warning: conflicting types for built-in function 'pow'; expected 'double(double, double)' [-Wbuiltin-declaration-mismatch] + 50 | char pow (void); + | ^~~ +conftest.c:42:1: note: 'pow' is declared in header '' + 41 | #include + 42 | #undef pow +configure:18169: $? = 0 +configure:18169: result: yes +configure:18175: checking for sqrt +configure:18175: gcc -o conftest -fPIC conftest.c -lm >&5 +conftest.c:51:6: warning: conflicting types for built-in function 'sqrt'; expected 'double(double)' [-Wbuiltin-declaration-mismatch] + 51 | char sqrt (void); + | ^~~~ +conftest.c:43:1: note: 'sqrt' is declared in header '' + 42 | #include + 43 | #undef sqrt +configure:18175: $? = 0 +configure:18175: result: yes +configure:18181: checking for strcasecmp +configure:18181: gcc -o conftest -fPIC conftest.c -lm >&5 +conftest.c:52:6: warning: conflicting types for built-in function 'strcasecmp'; expected 'int(const char *, const char *)' [-Wbuiltin-declaration-mismatch] + 52 | char strcasecmp (void); + | ^~~~~~~~~~ +configure:18181: $? = 0 +configure:18181: result: yes +configure:18187: checking for strchr +configure:18187: gcc -o conftest -fPIC conftest.c -lm >&5 +conftest.c:53:6: warning: conflicting types for built-in function 'strchr'; expected 'char *(const char *, int)' [-Wbuiltin-declaration-mismatch] + 53 | char strchr (void); + | ^~~~~~ +conftest.c:45:1: note: 'strchr' is declared in header '' + 44 | #include + 45 | #undef strchr +configure:18187: $? = 0 +configure:18187: result: yes +configure:18193: checking for strtol +configure:18193: gcc -o conftest -fPIC conftest.c -lm >&5 +configure:18193: $? = 0 +configure:18193: result: yes +configure:18199: checking for strtoul +configure:18199: gcc -o conftest -fPIC conftest.c -lm >&5 +configure:18199: $? = 0 +configure:18199: result: yes +configure:18207: checking for gcc options needed to detect all undeclared functions +configure:18229: gcc -c -fPIC conftest.c >&5 +conftest.c: In function 'main': +conftest.c:44:8: error: 'strchr' undeclared (first use in this function) + 44 | (void) strchr; + | ^~~~~~ +conftest.c:1:1: note: 'strchr' is defined in header ''; did you forget to '#include '? + 1 | /* confdefs.h */ +conftest.c:44:8: note: each undeclared identifier is reported only once for each function it appears in + 44 | (void) strchr; + | ^~~~~~ +configure:18229: $? = 1 +configure: failed program was: +| /* confdefs.h */ +| #define PACKAGE_NAME "unuran" +| #define PACKAGE_TARNAME "unuran" +| #define PACKAGE_VERSION "1.11.0" +| #define PACKAGE_STRING "unuran 1.11.0" +| #define PACKAGE_BUGREPORT "unuran@statmath.wu.ac.at" +| #define PACKAGE_URL "" +| #define PACKAGE "unuran" +| #define VERSION "1.11.0" +| #define HAVE_STDIO_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_UNISTD_H 1 +| #define HAVE_SYS_TIME_H 1 +| #define STDC_HEADERS 1 +| #define HAVE_DLFCN_H 1 +| #define LT_OBJDIR ".libs/" +| #define HAVE_LIBM 1 +| #define HAVE_FLOAT_H 1 +| #define HAVE_LIMITS_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_UNISTD_H 1 +| #define HAVE_ALARM 1 +| #define HAVE_FLOOR 1 +| #define HAVE_GETTIMEOFDAY 1 +| #define HAVE_MEMSET 1 +| #define HAVE_POW 1 +| #define HAVE_SQRT 1 +| #define HAVE_STRCASECMP 1 +| #define HAVE_STRCHR 1 +| #define HAVE_STRTOL 1 +| #define HAVE_STRTOUL 1 +| /* end confdefs.h. */ +| +| int +| main (void) +| { +| (void) strchr; +| ; +| return 0; +| } +configure:18256: gcc -c -fPIC conftest.c >&5 +configure:18256: $? = 0 +configure:18273: result: none needed +configure:18287: checking whether log1p is declared +configure:18287: gcc -c -fPIC conftest.c >&5 +configure:18287: $? = 0 +configure:18287: result: yes +configure:18297: checking whether hypot is declared +configure:18297: gcc -c -fPIC conftest.c >&5 +configure:18297: $? = 0 +configure:18297: result: yes +configure:18308: checking whether getopt is declared +configure:18308: gcc -c -fPIC conftest.c >&5 +configure:18308: $? = 0 +configure:18308: result: yes +configure:18316: checking whether snprintf is declared +configure:18316: gcc -c -fPIC conftest.c >&5 +configure:18316: $? = 0 +configure:18316: result: yes +configure:18324: checking whether vsnprintf is declared +configure:18324: gcc -c -fPIC conftest.c >&5 +configure:18324: $? = 0 +configure:18324: result: yes +configure:18334: checking whether isfinite is declared +configure:18334: gcc -c -fPIC conftest.c >&5 +configure:18334: $? = 0 +configure:18334: result: yes +configure:18344: checking whether isinf is declared +configure:18344: gcc -c -fPIC conftest.c >&5 +configure:18344: $? = 0 +configure:18344: result: yes +configure:18354: checking whether isnan is declared +configure:18354: gcc -c -fPIC conftest.c >&5 +configure:18354: $? = 0 +configure:18354: result: yes +configure:18364: checking whether INFINITY is declared +configure:18364: gcc -c -fPIC conftest.c >&5 +configure:18364: $? = 0 +configure:18364: result: yes +configure:18374: checking whether HUGE_VAL is declared +configure:18374: gcc -c -fPIC conftest.c >&5 +configure:18374: $? = 0 +configure:18374: result: yes +configure:18384: checking whether DBL_MAX is declared +configure:18384: gcc -c -fPIC conftest.c >&5 +configure:18384: $? = 0 +configure:18384: result: yes +configure:18396: checking for IEEE comparisons +configure:18420: gcc -o conftest -fPIC conftest.c -lm >&5 +configure:18420: $? = 0 +configure:18420: ./conftest +configure:18420: $? = 0 +configure:18432: result: yes +configure:18442: checking for divide-by-zero +configure:18465: gcc -o conftest -fPIC conftest.c -lm >&5 +configure:18465: $? = 0 +configure:18465: ./conftest +configure:18465: $? = 0 +configure:18477: result: yes +configure:18487: checking whether alarm is declared +configure:18487: gcc -c -fPIC conftest.c >&5 +configure:18487: $? = 0 +configure:18487: result: yes +configure:18497: checking whether signal is declared +configure:18497: gcc -c -fPIC conftest.c >&5 +configure:18497: $? = 0 +configure:18497: result: yes +configure:18507: checking for alarm +configure:18507: result: yes +configure:18513: checking for signal +configure:18513: gcc -o conftest -fPIC conftest.c -lm >&5 +configure:18513: $? = 0 +configure:18513: result: yes +configure:18642: checking for valgrind +configure:18675: result: false +configure:18848: checking that generated files are newer than configure +configure:18854: result: done +configure:18905: creating ./config.status + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by unuran config.status 1.11.0, which was +generated by GNU Autoconf 2.71. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on wrdx + +config.status:1220: creating Makefile +config.status:1220: creating src/Makefile +config.status:1220: creating src/distr/Makefile +config.status:1220: creating src/distributions/Makefile +config.status:1220: creating src/methods/Makefile +config.status:1220: creating src/parser/Makefile +config.status:1220: creating src/specfunct/Makefile +config.status:1220: creating src/tests/Makefile +config.status:1220: creating src/uniform/Makefile +config.status:1220: creating src/urng/Makefile +config.status:1220: creating src/utils/Makefile +config.status:1220: creating scripts/Makefile +config.status:1220: creating doc/Makefile +config.status:1220: creating doc/src/Makefile +config.status:1220: creating doc/figures/Makefile +config.status:1220: creating tests/Makefile +config.status:1220: creating tests/testdistributions/Makefile +config.status:1220: creating examples/Makefile +config.status:1220: creating experiments/Makefile +config.status:1220: creating config.h +config.status:1401: config.h is unchanged +config.status:1449: executing depfiles commands +config.status:1526: cd src/distr && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make: Nothing to be done for 'am--depfiles'. +config.status:1531: $? = 0 +config.status:1526: cd src/distributions && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make: Nothing to be done for 'am--depfiles'. +config.status:1531: $? = 0 +config.status:1526: cd src/methods && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make: Nothing to be done for 'am--depfiles'. +config.status:1531: $? = 0 +config.status:1526: cd src/parser && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make: Nothing to be done for 'am--depfiles'. +config.status:1531: $? = 0 +config.status:1526: cd src/specfunct && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make: Nothing to be done for 'am--depfiles'. +config.status:1531: $? = 0 +config.status:1526: cd src/tests && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make: Nothing to be done for 'am--depfiles'. +config.status:1531: $? = 0 +config.status:1526: cd src/uniform && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make: Nothing to be done for 'am--depfiles'. +config.status:1531: $? = 0 +config.status:1526: cd src/urng && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make: Nothing to be done for 'am--depfiles'. +config.status:1531: $? = 0 +config.status:1526: cd src/utils && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make: Nothing to be done for 'am--depfiles'. +config.status:1531: $? = 0 +config.status:1526: cd scripts && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make: Nothing to be done for 'am--depfiles'. +config.status:1531: $? = 0 +config.status:1526: cd tests && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make: Nothing to be done for 'am--depfiles'. +config.status:1531: $? = 0 +config.status:1526: cd tests/testdistributions && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make: Nothing to be done for 'am--depfiles'. +config.status:1531: $? = 0 +config.status:1526: cd examples && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make: Nothing to be done for 'am--depfiles'. +config.status:1531: $? = 0 +config.status:1526: cd experiments && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles +make: Nothing to be done for 'am--depfiles'. +config.status:1531: $? = 0 +config.status:1449: executing libtool commands +configure:21340: result: +*======================================================== +* +* Configuration for unuran-1.11.0: +* +* Source directory: . +* Installation directory: /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +* C Compiler: gcc +* +* Build shared library: no +* Build static library: yes +* +* Use deprecated code: no +* Enable runtime checks: no +* Enable logging of data: no +* Enable info routine: yes +* Experimenal code: no +* Use Rmath library: no +* +* Support for external uniform random number generators +* Rngstream: no +* PRNG: no +* GSL: no +* +* Default URNG: builtin +* +*======================================================== + + +## ---------------- ## +## Cache variables. ## +## ---------------- ## + +ac_cv_build=x86_64-pc-linux-gnu +ac_cv_c_compiler_gnu=yes +ac_cv_c_const=yes +ac_cv_c_divide_by_zero=yes +ac_cv_c_ieee_comparisons=yes +ac_cv_c_inline=inline +ac_cv_c_undeclared_builtin_options='none needed' +ac_cv_cxx_compiler_gnu=yes +ac_cv_env_CCC_set= +ac_cv_env_CCC_value= +ac_cv_env_CC_set= +ac_cv_env_CC_value= +ac_cv_env_CFLAGS_set=set +ac_cv_env_CFLAGS_value='-fPIC ' +ac_cv_env_CPPFLAGS_set= +ac_cv_env_CPPFLAGS_value= +ac_cv_env_CPP_set= +ac_cv_env_CPP_value= +ac_cv_env_CXXCPP_set= +ac_cv_env_CXXCPP_value= +ac_cv_env_CXXFLAGS_set= +ac_cv_env_CXXFLAGS_value= +ac_cv_env_CXX_set= +ac_cv_env_CXX_value= +ac_cv_env_LDFLAGS_set= +ac_cv_env_LDFLAGS_value= +ac_cv_env_LIBS_set= +ac_cv_env_LIBS_value= +ac_cv_env_LT_SYS_LIBRARY_PATH_set= +ac_cv_env_LT_SYS_LIBRARY_PATH_value= +ac_cv_env_build_alias_set= +ac_cv_env_build_alias_value= +ac_cv_env_host_alias_set= +ac_cv_env_host_alias_value= +ac_cv_env_target_alias_set= +ac_cv_env_target_alias_value= +ac_cv_func_alarm=yes +ac_cv_func_floor=yes +ac_cv_func_gettimeofday=yes +ac_cv_func_memset=yes +ac_cv_func_pow=yes +ac_cv_func_signal=yes +ac_cv_func_sqrt=yes +ac_cv_func_strcasecmp=yes +ac_cv_func_strchr=yes +ac_cv_func_strtol=yes +ac_cv_func_strtoul=yes +ac_cv_have_decl_DBL_MAX=yes +ac_cv_have_decl_HUGE_VAL=yes +ac_cv_have_decl_INFINITY=yes +ac_cv_have_decl_alarm=yes +ac_cv_have_decl_getopt=yes +ac_cv_have_decl_hypot=yes +ac_cv_have_decl_isfinite=yes +ac_cv_have_decl_isinf=yes +ac_cv_have_decl_isnan=yes +ac_cv_have_decl_log1p=yes +ac_cv_have_decl_signal=yes +ac_cv_have_decl_snprintf=yes +ac_cv_have_decl_vsnprintf=yes +ac_cv_header_dlfcn_h=yes +ac_cv_header_float_h=yes +ac_cv_header_inttypes_h=yes +ac_cv_header_limits_h=yes +ac_cv_header_stdint_h=yes +ac_cv_header_stdio_h=yes +ac_cv_header_stdlib_h=yes +ac_cv_header_string_h=yes +ac_cv_header_strings_h=yes +ac_cv_header_sys_stat_h=yes +ac_cv_header_sys_time_h=yes +ac_cv_header_sys_types_h=yes +ac_cv_header_unistd_h=yes +ac_cv_host=x86_64-pc-linux-gnu +ac_cv_lib_gsl_gsl_blas_dgemm=no +ac_cv_lib_gslcblas_cblas_dgemm=no +ac_cv_lib_m_sqrt=yes +ac_cv_objext=o +ac_cv_path_EGREP='/usr/bin/grep -E' +ac_cv_path_FGREP='/usr/bin/grep -F' +ac_cv_path_GREP=/usr/bin/grep +ac_cv_path_SED=/usr/bin/sed +ac_cv_path_install='/usr/bin/install -c' +ac_cv_path_lt_DD=/usr/bin/dd +ac_cv_path_mkdir=/usr/bin/mkdir +ac_cv_prog_AWK=mawk +ac_cv_prog_CPP='gcc -E' +ac_cv_prog_CXXCPP='g++ -E' +ac_cv_prog_ac_ct_AR=ar +ac_cv_prog_ac_ct_CC=gcc +ac_cv_prog_ac_ct_CXX=g++ +ac_cv_prog_ac_ct_FILECMD=file +ac_cv_prog_ac_ct_MANIFEST_TOOL=mt +ac_cv_prog_ac_ct_OBJDUMP=objdump +ac_cv_prog_ac_ct_RANLIB=ranlib +ac_cv_prog_ac_ct_STRIP=strip +ac_cv_prog_cc_c11= +ac_cv_prog_cc_g=yes +ac_cv_prog_cc_stdc= +ac_cv_prog_cxx_11=no +ac_cv_prog_cxx_cxx11= +ac_cv_prog_cxx_g=yes +ac_cv_prog_cxx_stdcxx= +ac_cv_prog_have_valgrind=false +ac_cv_prog_make_make_set=yes +ac_cv_type_size_t=yes +am_cv_CC_dependencies_compiler_type=gcc3 +am_cv_CXX_dependencies_compiler_type=gcc3 +am_cv_make_support_nested_variables=yes +am_cv_prog_cc_c_o=yes +lt_cv_ar_at_file=@ +lt_cv_deplibs_check_method=pass_all +lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_ld_reload_flag=-r +lt_cv_nm_interface='BSD nm' +lt_cv_objdir=.libs +lt_cv_path_LD=/usr/bin/ld +lt_cv_path_LDCXX='/usr/bin/ld -m elf_x86_64' +lt_cv_path_NM='/usr/bin/nm -B' +lt_cv_path_mainfest_tool=no +lt_cv_prog_compiler_c_o=yes +lt_cv_prog_compiler_c_o_CXX=yes +lt_cv_prog_compiler_pic='-fPIC -DPIC' +lt_cv_prog_compiler_pic_CXX='-fPIC -DPIC' +lt_cv_prog_compiler_pic_works=yes +lt_cv_prog_compiler_pic_works_CXX=yes +lt_cv_prog_compiler_rtti_exceptions=no +lt_cv_prog_compiler_static_works=yes +lt_cv_prog_compiler_static_works_CXX=yes +lt_cv_prog_gnu_ld=yes +lt_cv_prog_gnu_ldcxx=yes +lt_cv_sharedlib_from_linklib_cmd='printf %s\n' +lt_cv_shlibpath_overrides_runpath=yes +lt_cv_sys_global_symbol_pipe='/usr/bin/sed -n -e '\''s/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p'\'' | /usr/bin/sed '\''/ __gnu_lto/d'\''' +lt_cv_sys_global_symbol_to_c_name_address='/usr/bin/sed -n -e '\''s/^: \(.*\) .*$/ {"\1", (void *) 0},/p'\'' -e '\''s/^[ABCDGIRSTW][ABCDGIRSTW]* .* \(.*\)$/ {"\1", (void *) \&\1},/p'\''' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='/usr/bin/sed -n -e '\''s/^: \(.*\) .*$/ {"\1", (void *) 0},/p'\'' -e '\''s/^[ABCDGIRSTW][ABCDGIRSTW]* .* \(lib.*\)$/ {"\1", (void *) \&\1},/p'\'' -e '\''s/^[ABCDGIRSTW][ABCDGIRSTW]* .* \(.*\)$/ {"lib\1", (void *) \&\1},/p'\''' +lt_cv_sys_global_symbol_to_cdecl='/usr/bin/sed -n -e '\''s/^T .* \(.*\)$/extern int \1();/p'\'' -e '\''s/^[ABCDGIRSTW][ABCDGIRSTW]* .* \(.*\)$/extern char \1;/p'\''' +lt_cv_sys_global_symbol_to_import= +lt_cv_sys_max_cmd_len=1572864 +lt_cv_to_host_file_cmd=func_convert_file_noop +lt_cv_to_tool_file_cmd=func_convert_file_noop +lt_cv_truncate_bin='/usr/bin/dd bs=4096 count=1' + +## ----------------- ## +## Output variables. ## +## ----------------- ## + +ACLOCAL='${SHELL} '\''/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing'\'' aclocal-1.16' +AMDEPBACKSLASH='\' +AMDEP_FALSE='#' +AMDEP_TRUE='' +AMTAR='$${TAR-tar}' +AM_BACKSLASH='\' +AM_CFLAGS=' -Wall -Wextra -Wshadow -Wstrict-prototypes' +AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +AM_DEFAULT_VERBOSITY='1' +AM_V='$(V)' +AR='ar' +AUTOCONF='${SHELL} '\''/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing'\'' autoconf' +AUTOHEADER='${SHELL} '\''/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing'\'' autoheader' +AUTOMAKE='${SHELL} '\''/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing'\'' automake-1.16' +AWK='mawk' +CC='gcc' +CCDEPMODE='depmode=gcc3' +CFLAGS='-fPIC ' +CPP='gcc -E' +CPPFLAGS='' +CSCOPE='cscope' +CTAGS='ctags' +CXX='g++' +CXXCPP='g++ -E' +CXXDEPMODE='depmode=gcc3' +CXXFLAGS='-g -O2' +CYGPATH_W='echo' +DEFS='-DHAVE_CONFIG_H' +DEPDIR='.deps' +DLLTOOL='false' +DSYMUTIL='' +DUMPBIN='' +ECHO_C='' +ECHO_N='-n' +ECHO_T='' +EGREP='/usr/bin/grep -E' +ENABLE_DEPRECATED_FALSE='' +ENABLE_DEPRECATED_TRUE='#' +ENABLE_EXPERIMENTAL_FALSE='' +ENABLE_EXPERIMENTAL_TRUE='#' +ETAGS='etags' +EXEEXT='' +FGREP='/usr/bin/grep -F' +FILECMD='file' +GREP='/usr/bin/grep' +HAVE_DIVIDE_BY_ZERO='' +HAVE_IEEE_COMPARISONS='' +HAVE_MATHEMATICA_FALSE='' +HAVE_MATHEMATICA_TRUE='#' +HAVE_MINGW_FALSE='' +HAVE_MINGW_TRUE='#' +HAVE_VALGRIND_FALSE='' +HAVE_VALGRIND_TRUE='#' +INSTALL_DATA='${INSTALL} -m 644' +INSTALL_PROGRAM='${INSTALL}' +INSTALL_SCRIPT='${INSTALL}' +INSTALL_STRIP_PROGRAM='$(install_sh) -c -s' +LD='/usr/bin/ld -m elf_x86_64' +LDFLAGS='' +LIBOBJS='' +LIBS='-lm ' +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +LIPO='' +LN_S='ln -s' +LTLIBOBJS='' +LT_SYS_LIBRARY_PATH='' +MAINT='#' +MAINTAINER_MODE_FALSE='' +MAINTAINER_MODE_TRUE='#' +MAKEINFO='${SHELL} '\''/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing'\'' makeinfo' +MANIFEST_TOOL=':' +MKDIR_P='/usr/bin/mkdir -p' +NM='/usr/bin/nm -B' +NMEDIT='' +OBJDUMP='objdump' +OBJEXT='o' +OTOOL64='' +OTOOL='' +PACKAGE='unuran' +PACKAGE_BUGREPORT='unuran@statmath.wu.ac.at' +PACKAGE_NAME='unuran' +PACKAGE_STRING='unuran 1.11.0' +PACKAGE_TARNAME='unuran' +PACKAGE_URL='' +PACKAGE_VERSION='1.11.0' +PATH_SEPARATOR=':' +RANLIB='ranlib' +SED='/usr/bin/sed' +SET_MAKE='' +SHELL='/bin/bash' +STRIP='strip' +UNURAN_LT_VERSION='16:1:0' +UNURAN_SUPPORTS_GSL='' +UNURAN_SUPPORTS_PRNG='' +UNURAN_SUPPORTS_RNGSTREAM='' +VERSION='1.11.0' +ac_ct_AR='ar' +ac_ct_CC='gcc' +ac_ct_CXX='g++' +ac_ct_DUMPBIN='' +am__EXEEXT_FALSE='' +am__EXEEXT_TRUE='#' +am__fastdepCC_FALSE='#' +am__fastdepCC_TRUE='' +am__fastdepCXX_FALSE='#' +am__fastdepCXX_TRUE='' +am__include='include' +am__isrc='' +am__leading_dot='.' +am__nodep='_no' +am__quote='' +am__tar='$${TAR-tar} chof - "$$tardir"' +am__untar='$${TAR-tar} xf -' +bindir='${exec_prefix}/bin' +build='x86_64-pc-linux-gnu' +build_alias='' +build_cpu='x86_64' +build_os='linux-gnu' +build_vendor='pc' +datadir='${datarootdir}' +datarootdir='${prefix}/share' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +dvidir='${docdir}' +exec_prefix='${prefix}' +have_valgrind='false' +host='x86_64-pc-linux-gnu' +host_alias='' +host_cpu='x86_64' +host_os='linux-gnu' +host_vendor='pc' +htmldir='${docdir}' +includedir='${prefix}/include' +infodir='${datarootdir}/info' +install_sh='${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh' +libdir='${exec_prefix}/lib' +libexecdir='${exec_prefix}/libexec' +localedir='${datarootdir}/locale' +localstatedir='${prefix}/var' +mandir='${datarootdir}/man' +mkdir_p='$(MKDIR_P)' +oldincludedir='/usr/include' +pdfdir='${docdir}' +prefix='/home/wrdx/5_sem/pysatl-core/vendor/unuran-build' +program_transform_name='s,x,x,' +psdir='${docdir}' +runstatedir='${localstatedir}/run' +sbindir='${exec_prefix}/sbin' +sharedstatedir='${prefix}/com' +sysconfdir='${prefix}/etc' +target_alias='' + +## ----------- ## +## confdefs.h. ## +## ----------- ## + +/* confdefs.h */ +#define PACKAGE_NAME "unuran" +#define PACKAGE_TARNAME "unuran" +#define PACKAGE_VERSION "1.11.0" +#define PACKAGE_STRING "unuran 1.11.0" +#define PACKAGE_BUGREPORT "unuran@statmath.wu.ac.at" +#define PACKAGE_URL "" +#define PACKAGE "unuran" +#define VERSION "1.11.0" +#define HAVE_STDIO_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_SYS_TIME_H 1 +#define STDC_HEADERS 1 +#define HAVE_DLFCN_H 1 +#define LT_OBJDIR ".libs/" +#define HAVE_LIBM 1 +#define HAVE_FLOAT_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_ALARM 1 +#define HAVE_FLOOR 1 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_MEMSET 1 +#define HAVE_POW 1 +#define HAVE_SQRT 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_DECL_LOG1P 1 +#define HAVE_DECL_HYPOT 1 +#define HAVE_DECL_GETOPT 1 +#define HAVE_DECL_SNPRINTF 1 +#define HAVE_DECL_VSNPRINTF 1 +#define HAVE_DECL_ISFINITE 1 +#define HAVE_DECL_ISINF 1 +#define HAVE_DECL_ISNAN 1 +#define HAVE_DECL_INFINITY 1 +#define HAVE_DECL_HUGE_VAL 1 +#define HAVE_DECL_DBL_MAX 1 +#define HAVE_IEEE_COMPARISONS 1 +#define HAVE_DIVIDE_BY_ZERO 1 +#define HAVE_DECL_ALARM 1 +#define HAVE_DECL_SIGNAL 1 +#define HAVE_ALARM 1 +#define HAVE_SIGNAL 1 +#define UNUR_ENABLE_INFO 1 + +configure: exit 0 diff --git a/vendor/unuran-1.11.0/config.status b/vendor/unuran-1.11.0/config.status new file mode 100755 index 0000000..143628b --- /dev/null +++ b/vendor/unuran-1.11.0/config.status @@ -0,0 +1,2274 @@ +#! /bin/bash +# Generated by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=${CONFIG_SHELL-/bin/bash} +export SHELL +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by unuran $as_me 1.11.0, which was +generated by GNU Autoconf 2.71. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +# Files that config.status was made for. +config_files=" Makefile src/Makefile src/distr/Makefile src/distributions/Makefile src/methods/Makefile src/parser/Makefile src/specfunct/Makefile src/tests/Makefile src/uniform/Makefile src/urng/Makefile src/utils/Makefile scripts/Makefile doc/Makefile doc/src/Makefile doc/figures/Makefile tests/Makefile tests/testdistributions/Makefile examples/Makefile experiments/Makefile" +config_headers=" config.h" +config_commands=" depfiles libtool" + +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +ac_cs_config='--prefix=/home/wrdx/5_sem/pysatl-core/vendor/unuran-build --enable-static --disable-shared '\''CFLAGS=-fPIC '\''' +ac_cs_version="\ +unuran config.status 1.11.0 +configured by /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/configure, generated by GNU Autoconf 2.71, + with options \"$ac_cs_config\" + +Copyright (C) 2021 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0' +srcdir='.' +INSTALL='/usr/bin/install -c' +MKDIR_P='/usr/bin/mkdir -p' +AWK='mawk' +test -n "$AWK" || AWK=awk +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + printf "%s\n" "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf "%s\n" "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + printf "%s\n" "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +if $ac_cs_recheck; then + set X /bin/bash '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/configure' '--prefix=/home/wrdx/5_sem/pysatl-core/vendor/unuran-build' '--enable-static' '--disable-shared' 'CFLAGS=-fPIC ' $ac_configure_extra_args --no-create --no-recursion + shift + \printf "%s\n" "running CONFIG_SHELL=/bin/bash $*" >&6 + CONFIG_SHELL='/bin/bash' + export CONFIG_SHELL + exec "$@" +fi + +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + printf "%s\n" "$ac_log" +} >&5 + +# +# INIT-COMMANDS +# +AMDEP_TRUE="" MAKE="make" + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' +double_quote_subst='s/\(["`\\]\)/\\\1/g' +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' +macro_version='2.4.7' +macro_revision='2.4.7' +enable_shared='no' +enable_static='yes' +pic_mode='default' +enable_fast_install='needless' +shared_archive_member_spec='' +SHELL='/bin/bash' +ECHO='printf %s\n' +PATH_SEPARATOR=':' +host_alias='' +host='x86_64-pc-linux-gnu' +host_os='linux-gnu' +build_alias='' +build='x86_64-pc-linux-gnu' +build_os='linux-gnu' +SED='/usr/bin/sed' +Xsed='/usr/bin/sed -e 1s/^X//' +GREP='/usr/bin/grep' +EGREP='/usr/bin/grep -E' +FGREP='/usr/bin/grep -F' +LD='/usr/bin/ld -m elf_x86_64' +NM='/usr/bin/nm -B' +LN_S='ln -s' +max_cmd_len='1572864' +ac_objext='o' +exeext='' +lt_unset='unset' +lt_SP2NL='tr \040 \012' +lt_NL2SP='tr \015\012 \040\040' +lt_cv_to_host_file_cmd='func_convert_file_noop' +lt_cv_to_tool_file_cmd='func_convert_file_noop' +reload_flag=' -r' +reload_cmds='$LD$reload_flag -o $output$reload_objs' +FILECMD='file' +OBJDUMP='objdump' +deplibs_check_method='pass_all' +file_magic_cmd='$MAGIC_CMD' +file_magic_glob='' +want_nocaseglob='no' +DLLTOOL='false' +sharedlib_from_linklib_cmd='printf %s\n' +AR='ar' +lt_ar_flags='cr' +AR_FLAGS='cr' +archiver_list_spec='@' +STRIP='strip' +RANLIB='ranlib' +old_postinstall_cmds='chmod 644 $oldlib~$RANLIB $tool_oldlib' +old_postuninstall_cmds='' +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs~$RANLIB $tool_oldlib' +lock_old_archive_extraction='no' +CC='gcc' +CFLAGS='-fPIC ' +compiler='g++' +GCC='yes' +lt_cv_sys_global_symbol_pipe='/usr/bin/sed -n -e '\''s/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p'\'' | /usr/bin/sed '\''/ __gnu_lto/d'\''' +lt_cv_sys_global_symbol_to_cdecl='/usr/bin/sed -n -e '\''s/^T .* \(.*\)$/extern int \1();/p'\'' -e '\''s/^[ABCDGIRSTW][ABCDGIRSTW]* .* \(.*\)$/extern char \1;/p'\''' +lt_cv_sys_global_symbol_to_import='' +lt_cv_sys_global_symbol_to_c_name_address='/usr/bin/sed -n -e '\''s/^: \(.*\) .*$/ {"\1", (void *) 0},/p'\'' -e '\''s/^[ABCDGIRSTW][ABCDGIRSTW]* .* \(.*\)$/ {"\1", (void *) \&\1},/p'\''' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='/usr/bin/sed -n -e '\''s/^: \(.*\) .*$/ {"\1", (void *) 0},/p'\'' -e '\''s/^[ABCDGIRSTW][ABCDGIRSTW]* .* \(lib.*\)$/ {"\1", (void *) \&\1},/p'\'' -e '\''s/^[ABCDGIRSTW][ABCDGIRSTW]* .* \(.*\)$/ {"lib\1", (void *) \&\1},/p'\''' +lt_cv_nm_interface='BSD nm' +nm_file_list_spec='@' +lt_sysroot='' +lt_cv_truncate_bin='/usr/bin/dd bs=4096 count=1' +objdir='.libs' +MAGIC_CMD='file' +lt_prog_compiler_no_builtin_flag=' -fno-builtin' +lt_prog_compiler_pic=' -fPIC -DPIC' +lt_prog_compiler_wl='-Wl,' +lt_prog_compiler_static='-static' +lt_cv_prog_compiler_c_o='yes' +need_locks='no' +MANIFEST_TOOL=':' +DSYMUTIL='' +NMEDIT='' +LIPO='' +OTOOL='' +OTOOL64='' +libext='a' +shrext_cmds='.so' +extract_expsyms_cmds='' +archive_cmds_need_lc='yes' +enable_shared_with_static_runtimes='no' +export_dynamic_flag_spec='$wl--export-dynamic' +whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' +compiler_needs_object='no' +old_archive_from_new_cmds='' +old_archive_from_expsyms_cmds='' +archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' +archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' +module_cmds='' +module_expsym_cmds='' +with_gnu_ld='yes' +allow_undefined_flag='' +no_undefined_flag='' +hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' +hardcode_libdir_separator='' +hardcode_direct='no' +hardcode_direct_absolute='no' +hardcode_minus_L='no' +hardcode_shlibpath_var='unsupported' +hardcode_automatic='no' +inherit_rpath='no' +link_all_deplibs='unknown' +always_export_symbols='no' +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' +exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' +include_expsyms='' +prelink_cmds='' +postlink_cmds='' +file_list_spec='' +variables_saved_for_relink='PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH' +need_lib_prefix='no' +need_version='no' +version_type='linux' +runpath_var='LD_RUN_PATH' +shlibpath_var='LD_LIBRARY_PATH' +shlibpath_overrides_runpath='yes' +libname_spec='lib$name' +library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' +soname_spec='$libname$release$shared_ext$major' +install_override_mode='' +postinstall_cmds='' +postuninstall_cmds='' +finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' +finish_eval='' +hardcode_into_libs='yes' +sys_lib_search_path_spec='/usr/lib/gcc/x86_64-linux-gnu/13 /usr/lib/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib ' +configure_time_dlsearch_path='/lib /usr/lib /usr/lib/x86_64-linux-gnu/libfakeroot /usr/local/lib /usr/local/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu ' +configure_time_lt_sys_library_path='' +hardcode_action='immediate' +enable_dlopen='unknown' +enable_dlopen_self='unknown' +enable_dlopen_self_static='unknown' +old_striplib='strip --strip-debug' +striplib='strip --strip-unneeded' +compiler_lib_search_dirs='' +predep_objects='' +postdep_objects='' +predeps='' +postdeps='' +compiler_lib_search_path='' +LD_CXX='/usr/bin/ld -m elf_x86_64' +reload_flag_CXX=' -r' +reload_cmds_CXX='$LD$reload_flag -o $output$reload_objs' +old_archive_cmds_CXX='$AR $AR_FLAGS $oldlib$oldobjs~$RANLIB $tool_oldlib' +compiler_CXX='g++' +GCC_CXX='yes' +lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' +lt_prog_compiler_pic_CXX=' -fPIC -DPIC' +lt_prog_compiler_wl_CXX='-Wl,' +lt_prog_compiler_static_CXX='-static' +lt_cv_prog_compiler_c_o_CXX='yes' +archive_cmds_need_lc_CXX='no' +enable_shared_with_static_runtimes_CXX='no' +export_dynamic_flag_spec_CXX='$wl--export-dynamic' +whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' +compiler_needs_object_CXX='no' +old_archive_from_new_cmds_CXX='' +old_archive_from_expsyms_cmds_CXX='' +archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' +archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' +module_cmds_CXX='' +module_expsym_cmds_CXX='' +with_gnu_ld_CXX='yes' +allow_undefined_flag_CXX='' +no_undefined_flag_CXX='' +hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' +hardcode_libdir_separator_CXX='' +hardcode_direct_CXX='no' +hardcode_direct_absolute_CXX='no' +hardcode_minus_L_CXX='no' +hardcode_shlibpath_var_CXX='unsupported' +hardcode_automatic_CXX='no' +inherit_rpath_CXX='no' +link_all_deplibs_CXX='unknown' +always_export_symbols_CXX='no' +export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' +exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' +include_expsyms_CXX='' +prelink_cmds_CXX='' +postlink_cmds_CXX='' +file_list_spec_CXX='' +hardcode_action_CXX='immediate' +compiler_lib_search_dirs_CXX='/usr/lib/gcc/x86_64-linux-gnu/13 /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu /usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /usr/lib/gcc/x86_64-linux-gnu/13/../../..' +predep_objects_CXX='/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o' +postdep_objects_CXX='/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o' +predeps_CXX='' +postdeps_CXX='-lstdc++ -lm -lgcc_s -lc -lgcc_s' +compiler_lib_search_path_CXX='-L/usr/lib/gcc/x86_64-linux-gnu/13 -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/13/../../..' + +LTCC='gcc' +LTCFLAGS='-fPIC ' +compiler='gcc' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in SHELL ECHO PATH_SEPARATOR SED GREP EGREP FGREP LD NM LN_S lt_SP2NL lt_NL2SP reload_flag FILECMD OBJDUMP deplibs_check_method file_magic_cmd file_magic_glob want_nocaseglob DLLTOOL sharedlib_from_linklib_cmd AR archiver_list_spec STRIP RANLIB CC CFLAGS compiler lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl lt_cv_sys_global_symbol_to_import lt_cv_sys_global_symbol_to_c_name_address lt_cv_sys_global_symbol_to_c_name_address_lib_prefix lt_cv_nm_interface nm_file_list_spec lt_cv_truncate_bin lt_prog_compiler_no_builtin_flag lt_prog_compiler_pic lt_prog_compiler_wl lt_prog_compiler_static lt_cv_prog_compiler_c_o need_locks MANIFEST_TOOL DSYMUTIL NMEDIT LIPO OTOOL OTOOL64 shrext_cmds export_dynamic_flag_spec whole_archive_flag_spec compiler_needs_object with_gnu_ld allow_undefined_flag no_undefined_flag hardcode_libdir_flag_spec hardcode_libdir_separator exclude_expsyms include_expsyms file_list_spec variables_saved_for_relink libname_spec library_names_spec soname_spec install_override_mode finish_eval old_striplib striplib compiler_lib_search_dirs predep_objects postdep_objects predeps postdeps compiler_lib_search_path LD_CXX reload_flag_CXX compiler_CXX lt_prog_compiler_no_builtin_flag_CXX lt_prog_compiler_pic_CXX lt_prog_compiler_wl_CXX lt_prog_compiler_static_CXX lt_cv_prog_compiler_c_o_CXX export_dynamic_flag_spec_CXX whole_archive_flag_spec_CXX compiler_needs_object_CXX with_gnu_ld_CXX allow_undefined_flag_CXX no_undefined_flag_CXX hardcode_libdir_flag_spec_CXX hardcode_libdir_separator_CXX exclude_expsyms_CXX include_expsyms_CXX file_list_spec_CXX compiler_lib_search_dirs_CXX predep_objects_CXX postdep_objects_CXX predeps_CXX postdeps_CXX compiler_lib_search_path_CXX; do + case `eval \\$ECHO \\""\\$$var"\\"` in + *[\\\`\"\$]*) + eval "lt_$var=\\\"\`\$ECHO \"\$$var\" | \$SED \"\$sed_quote_subst\"\`\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_$var=\\\"\$$var\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds old_postinstall_cmds old_postuninstall_cmds old_archive_cmds extract_expsyms_cmds old_archive_from_new_cmds old_archive_from_expsyms_cmds archive_cmds archive_expsym_cmds module_cmds module_expsym_cmds export_symbols_cmds prelink_cmds postlink_cmds postinstall_cmds postuninstall_cmds finish_cmds sys_lib_search_path_spec configure_time_dlsearch_path configure_time_lt_sys_library_path reload_cmds_CXX old_archive_cmds_CXX old_archive_from_new_cmds_CXX old_archive_from_expsyms_cmds_CXX archive_cmds_CXX archive_expsym_cmds_CXX module_cmds_CXX module_expsym_cmds_CXX export_symbols_cmds_CXX prelink_cmds_CXX postlink_cmds_CXX; do + case `eval \\$ECHO \\""\\$$var"\\"` in + *[\\\`\"\$]*) + eval "lt_$var=\\\"\`\$ECHO \"\$$var\" | \$SED -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_$var=\\\"\$$var\\\"" + ;; + esac +done + +ac_aux_dir='./autoconf/' + +# See if we are running on zsh, and set the options that allow our +# commands through without removal of \ escapes INIT. +if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='unuran' + VERSION='1.11.0' + RM='rm -f' + ofile='libtool' + + + + + + + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "src/distr/Makefile") CONFIG_FILES="$CONFIG_FILES src/distr/Makefile" ;; + "src/distributions/Makefile") CONFIG_FILES="$CONFIG_FILES src/distributions/Makefile" ;; + "src/methods/Makefile") CONFIG_FILES="$CONFIG_FILES src/methods/Makefile" ;; + "src/parser/Makefile") CONFIG_FILES="$CONFIG_FILES src/parser/Makefile" ;; + "src/specfunct/Makefile") CONFIG_FILES="$CONFIG_FILES src/specfunct/Makefile" ;; + "src/tests/Makefile") CONFIG_FILES="$CONFIG_FILES src/tests/Makefile" ;; + "src/uniform/Makefile") CONFIG_FILES="$CONFIG_FILES src/uniform/Makefile" ;; + "src/urng/Makefile") CONFIG_FILES="$CONFIG_FILES src/urng/Makefile" ;; + "src/utils/Makefile") CONFIG_FILES="$CONFIG_FILES src/utils/Makefile" ;; + "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;; + "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "doc/src/Makefile") CONFIG_FILES="$CONFIG_FILES doc/src/Makefile" ;; + "doc/figures/Makefile") CONFIG_FILES="$CONFIG_FILES doc/figures/Makefile" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; + "tests/testdistributions/Makefile") CONFIG_FILES="$CONFIG_FILES tests/testdistributions/Makefile" ;; + "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; + "experiments/Makefile") CONFIG_FILES="$CONFIG_FILES experiments/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +cat >>"$ac_tmp/subs1.awk" <<\_ACAWK && +S["am__EXEEXT_FALSE"]="" +S["am__EXEEXT_TRUE"]="#" +S["LTLIBOBJS"]="" +S["LIBOBJS"]="" +S["HAVE_MINGW_FALSE"]="" +S["HAVE_MINGW_TRUE"]="#" +S["AM_CFLAGS"]=" -Wall -Wextra -Wshadow -Wstrict-prototypes" +S["HAVE_VALGRIND_FALSE"]="" +S["HAVE_VALGRIND_TRUE"]="#" +S["have_valgrind"]="false" +S["HAVE_MATHEMATICA_FALSE"]="" +S["HAVE_MATHEMATICA_TRUE"]="#" +S["ENABLE_EXPERIMENTAL_FALSE"]="" +S["ENABLE_EXPERIMENTAL_TRUE"]="#" +S["ENABLE_DEPRECATED_FALSE"]="" +S["ENABLE_DEPRECATED_TRUE"]="#" +S["HAVE_DIVIDE_BY_ZERO"]="" +S["HAVE_IEEE_COMPARISONS"]="" +S["UNURAN_SUPPORTS_GSL"]="" +S["UNURAN_SUPPORTS_PRNG"]="" +S["UNURAN_SUPPORTS_RNGSTREAM"]="" +S["CXXCPP"]="g++ -E" +S["LT_SYS_LIBRARY_PATH"]="" +S["OTOOL64"]="" +S["OTOOL"]="" +S["LIPO"]="" +S["NMEDIT"]="" +S["DSYMUTIL"]="" +S["MANIFEST_TOOL"]=":" +S["ac_ct_AR"]="ar" +S["DLLTOOL"]="false" +S["OBJDUMP"]="objdump" +S["FILECMD"]="file" +S["NM"]="/usr/bin/nm -B" +S["ac_ct_DUMPBIN"]="" +S["DUMPBIN"]="" +S["LD"]="/usr/bin/ld -m elf_x86_64" +S["FGREP"]="/usr/bin/grep -F" +S["EGREP"]="/usr/bin/grep -E" +S["GREP"]="/usr/bin/grep" +S["SED"]="/usr/bin/sed" +S["LIBTOOL"]="$(SHELL) $(top_builddir)/libtool" +S["AR"]="ar" +S["LN_S"]="ln -s" +S["RANLIB"]="ranlib" +S["CPP"]="gcc -E" +S["am__fastdepCXX_FALSE"]="#" +S["am__fastdepCXX_TRUE"]="" +S["CXXDEPMODE"]="depmode=gcc3" +S["ac_ct_CXX"]="g++" +S["CXXFLAGS"]="-g -O2" +S["CXX"]="g++" +S["am__fastdepCC_FALSE"]="#" +S["am__fastdepCC_TRUE"]="" +S["CCDEPMODE"]="depmode=gcc3" +S["am__nodep"]="_no" +S["AMDEPBACKSLASH"]="\\" +S["AMDEP_FALSE"]="#" +S["AMDEP_TRUE"]="" +S["am__include"]="include" +S["DEPDIR"]=".deps" +S["OBJEXT"]="o" +S["EXEEXT"]="" +S["ac_ct_CC"]="gcc" +S["CPPFLAGS"]="" +S["LDFLAGS"]="" +S["CFLAGS"]="-fPIC " +S["CC"]="gcc" +S["host_os"]="linux-gnu" +S["host_vendor"]="pc" +S["host_cpu"]="x86_64" +S["host"]="x86_64-pc-linux-gnu" +S["build_os"]="linux-gnu" +S["build_vendor"]="pc" +S["build_cpu"]="x86_64" +S["build"]="x86_64-pc-linux-gnu" +S["MAINT"]="#" +S["MAINTAINER_MODE_FALSE"]="" +S["MAINTAINER_MODE_TRUE"]="#" +S["UNURAN_LT_VERSION"]="16:1:0" +S["AM_BACKSLASH"]="\\" +S["AM_DEFAULT_VERBOSITY"]="1" +S["AM_DEFAULT_V"]="$(AM_DEFAULT_VERBOSITY)" +S["AM_V"]="$(V)" +S["CSCOPE"]="cscope" +S["ETAGS"]="etags" +S["CTAGS"]="ctags" +S["am__untar"]="$${TAR-tar} xf -" +S["am__tar"]="$${TAR-tar} chof - \"$$tardir\"" +S["AMTAR"]="$${TAR-tar}" +S["am__leading_dot"]="." +S["SET_MAKE"]="" +S["AWK"]="mawk" +S["mkdir_p"]="$(MKDIR_P)" +S["MKDIR_P"]="/usr/bin/mkdir -p" +S["INSTALL_STRIP_PROGRAM"]="$(install_sh) -c -s" +S["STRIP"]="strip" +S["install_sh"]="${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh" +S["MAKEINFO"]="${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo" +S["AUTOHEADER"]="${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader" +S["AUTOMAKE"]="${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16" +S["AUTOCONF"]="${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf" +S["ACLOCAL"]="${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16" +S["VERSION"]="1.11.0" +S["PACKAGE"]="unuran" +S["CYGPATH_W"]="echo" +S["am__isrc"]="" +S["INSTALL_DATA"]="${INSTALL} -m 644" +S["INSTALL_SCRIPT"]="${INSTALL}" +S["INSTALL_PROGRAM"]="${INSTALL}" +S["target_alias"]="" +S["host_alias"]="" +S["build_alias"]="" +S["LIBS"]="-lm " +S["ECHO_T"]="" +S["ECHO_N"]="-n" +S["ECHO_C"]="" +S["DEFS"]="-DHAVE_CONFIG_H" +S["mandir"]="${datarootdir}/man" +S["localedir"]="${datarootdir}/locale" +S["libdir"]="${exec_prefix}/lib" +S["psdir"]="${docdir}" +S["pdfdir"]="${docdir}" +S["dvidir"]="${docdir}" +S["htmldir"]="${docdir}" +S["infodir"]="${datarootdir}/info" +S["docdir"]="${datarootdir}/doc/${PACKAGE_TARNAME}" +S["oldincludedir"]="/usr/include" +S["includedir"]="${prefix}/include" +S["runstatedir"]="${localstatedir}/run" +S["localstatedir"]="${prefix}/var" +S["sharedstatedir"]="${prefix}/com" +S["sysconfdir"]="${prefix}/etc" +S["datadir"]="${datarootdir}" +S["datarootdir"]="${prefix}/share" +S["libexecdir"]="${exec_prefix}/libexec" +S["sbindir"]="${exec_prefix}/sbin" +S["bindir"]="${exec_prefix}/bin" +S["program_transform_name"]="s,x,x," +S["prefix"]="/home/wrdx/5_sem/pysatl-core/vendor/unuran-build" +S["exec_prefix"]="${prefix}" +S["PACKAGE_URL"]="" +S["PACKAGE_BUGREPORT"]="unuran@statmath.wu.ac.at" +S["PACKAGE_STRING"]="unuran 1.11.0" +S["PACKAGE_VERSION"]="1.11.0" +S["PACKAGE_TARNAME"]="unuran" +S["PACKAGE_NAME"]="unuran" +S["PATH_SEPARATOR"]=":" +S["SHELL"]="/bin/bash" +S["am__quote"]="" +_ACAWK +cat >>"$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +D["PACKAGE_NAME"]=" \"unuran\"" +D["PACKAGE_TARNAME"]=" \"unuran\"" +D["PACKAGE_VERSION"]=" \"1.11.0\"" +D["PACKAGE_STRING"]=" \"unuran 1.11.0\"" +D["PACKAGE_BUGREPORT"]=" \"unuran@statmath.wu.ac.at\"" +D["PACKAGE_URL"]=" \"\"" +D["PACKAGE"]=" \"unuran\"" +D["VERSION"]=" \"1.11.0\"" +D["HAVE_STDIO_H"]=" 1" +D["HAVE_STDLIB_H"]=" 1" +D["HAVE_STRING_H"]=" 1" +D["HAVE_INTTYPES_H"]=" 1" +D["HAVE_STDINT_H"]=" 1" +D["HAVE_STRINGS_H"]=" 1" +D["HAVE_SYS_STAT_H"]=" 1" +D["HAVE_SYS_TYPES_H"]=" 1" +D["HAVE_UNISTD_H"]=" 1" +D["HAVE_SYS_TIME_H"]=" 1" +D["STDC_HEADERS"]=" 1" +D["HAVE_DLFCN_H"]=" 1" +D["LT_OBJDIR"]=" \".libs/\"" +D["HAVE_LIBM"]=" 1" +D["HAVE_FLOAT_H"]=" 1" +D["HAVE_LIMITS_H"]=" 1" +D["HAVE_STDLIB_H"]=" 1" +D["HAVE_STRING_H"]=" 1" +D["HAVE_UNISTD_H"]=" 1" +D["HAVE_ALARM"]=" 1" +D["HAVE_FLOOR"]=" 1" +D["HAVE_GETTIMEOFDAY"]=" 1" +D["HAVE_MEMSET"]=" 1" +D["HAVE_POW"]=" 1" +D["HAVE_SQRT"]=" 1" +D["HAVE_STRCASECMP"]=" 1" +D["HAVE_STRCHR"]=" 1" +D["HAVE_STRTOL"]=" 1" +D["HAVE_STRTOUL"]=" 1" +D["HAVE_DECL_LOG1P"]=" 1" +D["HAVE_DECL_HYPOT"]=" 1" +D["HAVE_DECL_GETOPT"]=" 1" +D["HAVE_DECL_SNPRINTF"]=" 1" +D["HAVE_DECL_VSNPRINTF"]=" 1" +D["HAVE_DECL_ISFINITE"]=" 1" +D["HAVE_DECL_ISINF"]=" 1" +D["HAVE_DECL_ISNAN"]=" 1" +D["HAVE_DECL_INFINITY"]=" 1" +D["HAVE_DECL_HUGE_VAL"]=" 1" +D["HAVE_DECL_DBL_MAX"]=" 1" +D["HAVE_IEEE_COMPARISONS"]=" 1" +D["HAVE_DIVIDE_BY_ZERO"]=" 1" +D["HAVE_DECL_ALARM"]=" 1" +D["HAVE_DECL_SIGNAL"]=" 1" +D["HAVE_ALARM"]=" 1" +D["HAVE_SIGNAL"]=" 1" +D["UNUR_ENABLE_INFO"]=" 1" + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*([\t (]|$)/ { + line = $ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf "%s\n" "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + ac_datarootdir_hack=' + s&@datadir@&${datarootdir}&g + s&@docdir@&${datarootdir}/doc/${PACKAGE_TARNAME}&g + s&@infodir@&${datarootdir}/info&g + s&@localedir@&${datarootdir}/locale&g + s&@mandir@&${datarootdir}/man&g + s&\${datarootdir}&${prefix}/share&g' ;; +esac +ac_sed_extra="/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +} + +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$am_mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? + done + if test $am_rc -ne 0; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk +} + ;; + "libtool":C) + + # See if we are running on zsh, and set the options that allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST + fi + + cfgfile=${ofile}T + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL +# Generated automatically by $as_me ($PACKAGE) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + +# Copyright (C) 2014 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program or library that is built +# using GNU Libtool, you may include this file under the same +# distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +# The names of the tagged configurations supported by this script. +available_tags='CXX ' + +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# Shared archive member basename,for filename based shared library versioning on AIX. +shared_archive_member_spec=$shared_archive_member_spec + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The PATH separator for the build system. +PATH_SEPARATOR=$lt_PATH_SEPARATOR + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd + +# A file(cmd) program that detects file types. +FILECMD=$lt_FILECMD + +# An object symbol dumper. +OBJDUMP=$lt_OBJDUMP + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method = "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + +# The archiver. +AR=$lt_AR + +# Flags to create an archive (by configure). +lt_ar_flags=$lt_ar_flags + +# Flags to create an archive. +AR_FLAGS=\${ARFLAGS-"\$lt_ar_flags"} + +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm into a list of symbols to manually relocate. +global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# The name lister interface. +nm_interface=$lt_lt_cv_nm_interface + +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and where our libraries should be installed. +lt_sysroot=$lt_sysroot + +# Command to truncate a binary pipe. +lt_truncate_bin=$lt_lt_cv_truncate_bin + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Detected run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path + +# Explicit LT_SYS_LIBRARY_PATH set during ./configure time. +configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \$shlibpath_var if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects +postdep_objects=$lt_postdep_objects +predeps=$lt_predeps +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + +# ### END LIBTOOL CONFIG + +_LT_EOF + + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + + +ltmain=$ac_aux_dir/ltmain.sh + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + $SED '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + + cat <<_LT_EOF >> "$ofile" + +# ### BEGIN LIBTOOL TAG CONFIG: CXX + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# How to create reloadable object files. +reload_flag=$lt_reload_flag_CXX +reload_cmds=$lt_reload_cmds_CXX + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds_CXX + +# A language specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU compiler? +with_gcc=$GCC_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object_CXX + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld_CXX + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \$shlibpath_var if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute_CXX + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath_CXX + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds_CXX + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds_CXX + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec_CXX + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects_CXX +postdep_objects=$lt_postdep_objects_CXX +predeps=$lt_predeps_CXX +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# ### END LIBTOOL TAG CONFIG: CXX +_LT_EOF + + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 diff --git a/vendor/unuran-1.11.0/configure b/vendor/unuran-1.11.0/configure new file mode 100755 index 0000000..ceb4eca --- /dev/null +++ b/vendor/unuran-1.11.0/configure @@ -0,0 +1,21405 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.71 for unuran 1.11.0. +# +# Report bugs to . +# +# +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else \$as_nop + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : + +else \$as_nop + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null +then : + as_have_required=yes +else $as_nop + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : + +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$as_shell as_have_required=yes + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : + break 2 +fi +fi + done;; + esac + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi + + + if test "x$CONFIG_SHELL" != x +then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." + else + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and +$0: unuran@statmath.wu.ac.at about your system, including +$0: any error possibly output before this message. Then +$0: install a modern shell, or manually run the script +$0: under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + +SHELL=${CONFIG_SHELL-/bin/sh} + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='unuran' +PACKAGE_TARNAME='unuran' +PACKAGE_VERSION='1.11.0' +PACKAGE_STRING='unuran 1.11.0' +PACKAGE_BUGREPORT='unuran@statmath.wu.ac.at' +PACKAGE_URL='' + +ac_unique_file="src/unuran_config.h" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_STDIO_H +# include +#endif +#ifdef HAVE_STDLIB_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_header_c_list= +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +HAVE_MINGW_FALSE +HAVE_MINGW_TRUE +AM_CFLAGS +HAVE_VALGRIND_FALSE +HAVE_VALGRIND_TRUE +have_valgrind +HAVE_MATHEMATICA_FALSE +HAVE_MATHEMATICA_TRUE +ENABLE_EXPERIMENTAL_FALSE +ENABLE_EXPERIMENTAL_TRUE +ENABLE_DEPRECATED_FALSE +ENABLE_DEPRECATED_TRUE +HAVE_DIVIDE_BY_ZERO +HAVE_IEEE_COMPARISONS +UNURAN_SUPPORTS_GSL +UNURAN_SUPPORTS_PRNG +UNURAN_SUPPORTS_RNGSTREAM +CXXCPP +LT_SYS_LIBRARY_PATH +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +MANIFEST_TOOL +ac_ct_AR +DLLTOOL +OBJDUMP +FILECMD +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +EGREP +GREP +SED +LIBTOOL +AR +LN_S +RANLIB +CPP +am__fastdepCXX_FALSE +am__fastdepCXX_TRUE +CXXDEPMODE +ac_ct_CXX +CXXFLAGS +CXX +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE +UNURAN_LT_VERSION +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +CSCOPE +ETAGS +CTAGS +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +runstatedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL +am__quote' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_silent_rules +enable_maintainer_mode +enable_dependency_tracking +enable_shared +enable_static +with_pic +enable_fast_install +with_aix_soname +with_gnu_ld +with_sysroot +enable_libtool_lock +with_urng_rngstream +with_urng_prng +with_urng_gsl +with_urng_default +with_Rmath +enable_deprecated +enable_check_struct +enable_logging +enable_info +enable_experimental +with_mathematica +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CXX +CXXFLAGS +CCC +CPP +LT_SYS_LIBRARY_PATH +CXXCPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir runstatedir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures unuran 1.11.0 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/unuran] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of unuran 1.11.0:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --enable-maintainer-mode + enable make rules and dependencies not useful (and + sometimes confusing) to the casual installer + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build + --enable-shared[=PKGS] build shared libraries [default=no] + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-deprecated enable support for deprecated UNU.RAN routines + [default=no] + --enable-check-struct Debug: check validity of pointers to structures + [default=no] + --enable-logging Debug: print informations about generator into + logfile [default=no] + --enable-info Info: provide function with information about + generator objects [default=yes] + --enable-experimental Experimental code (not documented) [default=no] + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use + both] + --with-aix-soname=aix|svr4|both + shared library versioning (aka "SONAME") variant to + provide on AIX, [default=aix]. + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot[=DIR] Search for dependent libraries within DIR (or the + compiler's sysroot if not specified). + --with-urng-rngstream URNG: use Pierre L'Ecuyer's RNGSTREAM library + [default=no] + --with-urng-prng URNG: use Otmar Lendl's PRNG library [default=no] + --with-urng-gsl URNG: use random number generators from GNU + Scientific Library [default=no] + --with-urng-default URNG: global default (builtin|rngstream) + [default=builtin] + --with-Rmath use Rmath library from R project [EXPERIMENTAL] + [default=no] + --with-mathematica Use Mathematica(R) for some checks [default=no] + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CPP C preprocessor + LT_SYS_LIBRARY_PATH + User-defined run-time library search path. + CXXCPP C++ preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +unuran configure 1.11.0 +generated by GNU Autoconf 2.71 + +Copyright (C) 2021 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (void); below. */ + +#include +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (void); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main (void) +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_cxx_try_cpp LINENO +# ------------------------ +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_cpp + +# ac_fn_cxx_try_link LINENO +# ------------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_link + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR +# ------------------------------------------------------------------ +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR. +ac_fn_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +printf %s "checking whether $as_decl_name is declared... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + eval ac_save_FLAGS=\$$6 + as_fn_append $6 " $5" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + eval $6=\$ac_save_FLAGS + +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_check_decl + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by unuran $as_me 1.11.0, which was +generated by GNU Autoconf 2.71. Invocation command line was + + $ $0$ac_configure_args_raw + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" + # Save into config.log some information that might help in debugging. + { + echo + + printf "%s\n" "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + printf "%s\n" "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + printf "%s\n" "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + printf "%s\n" "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +printf "%s\n" "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + ac_site_files="$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" +else + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +fi + +for ac_site_file in $ac_site_files +do + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (char **p, int i) +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); +extern void free (void *); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +# Test code for whether the C++ compiler supports C++98 (global declarations) +ac_cxx_conftest_cxx98_globals=' +// Does the compiler advertise C++98 conformance? +#if !defined __cplusplus || __cplusplus < 199711L +# error "Compiler does not advertise C++98 conformance" +#endif + +// These inclusions are to reject old compilers that +// lack the unsuffixed header files. +#include +#include + +// and are *not* freestanding headers in C++98. +extern void assert (int); +namespace std { + extern int strcmp (const char *, const char *); +} + +// Namespaces, exceptions, and templates were all added after "C++ 2.0". +using std::exception; +using std::strcmp; + +namespace { + +void test_exception_syntax() +{ + try { + throw "test"; + } catch (const char *s) { + // Extra parentheses suppress a warning when building autoconf itself, + // due to lint rules shared with more typical C programs. + assert (!(strcmp) (s, "test")); + } +} + +template struct test_template +{ + T const val; + explicit test_template(T t) : val(t) {} + template T add(U u) { return static_cast(u) + val; } +}; + +} // anonymous namespace +' + +# Test code for whether the C++ compiler supports C++98 (body of main) +ac_cxx_conftest_cxx98_main=' + assert (argc); + assert (! argv[0]); +{ + test_exception_syntax (); + test_template tt (2.0); + assert (tt.add (4) == 6.0); + assert (true && !false); +} +' + +# Test code for whether the C++ compiler supports C++11 (global declarations) +ac_cxx_conftest_cxx11_globals=' +// Does the compiler advertise C++ 2011 conformance? +#if !defined __cplusplus || __cplusplus < 201103L +# error "Compiler does not advertise C++11 conformance" +#endif + +namespace cxx11test +{ + constexpr int get_val() { return 20; } + + struct testinit + { + int i; + double d; + }; + + class delegate + { + public: + delegate(int n) : n(n) {} + delegate(): delegate(2354) {} + + virtual int getval() { return this->n; }; + protected: + int n; + }; + + class overridden : public delegate + { + public: + overridden(int n): delegate(n) {} + virtual int getval() override final { return this->n * 2; } + }; + + class nocopy + { + public: + nocopy(int i): i(i) {} + nocopy() = default; + nocopy(const nocopy&) = delete; + nocopy & operator=(const nocopy&) = delete; + private: + int i; + }; + + // for testing lambda expressions + template Ret eval(Fn f, Ret v) + { + return f(v); + } + + // for testing variadic templates and trailing return types + template auto sum(V first) -> V + { + return first; + } + template auto sum(V first, Args... rest) -> V + { + return first + sum(rest...); + } +} +' + +# Test code for whether the C++ compiler supports C++11 (body of main) +ac_cxx_conftest_cxx11_main=' +{ + // Test auto and decltype + auto a1 = 6538; + auto a2 = 48573953.4; + auto a3 = "String literal"; + + int total = 0; + for (auto i = a3; *i; ++i) { total += *i; } + + decltype(a2) a4 = 34895.034; +} +{ + // Test constexpr + short sa[cxx11test::get_val()] = { 0 }; +} +{ + // Test initializer lists + cxx11test::testinit il = { 4323, 435234.23544 }; +} +{ + // Test range-based for + int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, + 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + for (auto &x : array) { x += 23; } +} +{ + // Test lambda expressions + using cxx11test::eval; + assert (eval ([](int x) { return x*2; }, 21) == 42); + double d = 2.0; + assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); + assert (d == 5.0); + assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); + assert (d == 5.0); +} +{ + // Test use of variadic templates + using cxx11test::sum; + auto a = sum(1); + auto b = sum(1, 2); + auto c = sum(1.0, 2.0, 3.0); +} +{ + // Test constructor delegation + cxx11test::delegate d1; + cxx11test::delegate d2(); + cxx11test::delegate d3(45); +} +{ + // Test override and final + cxx11test::overridden o1(55464); +} +{ + // Test nullptr + char *c = nullptr; +} +{ + // Test template brackets + test_template<::test_template> v(test_template(12)); +} +{ + // Unicode literals + char const *utf8 = u8"UTF-8 string \u2500"; + char16_t const *utf16 = u"UTF-8 string \u2500"; + char32_t const *utf32 = U"UTF-32 string \u2500"; +} +' + +# Test code for whether the C compiler supports C++11 (complete). +ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} +${ac_cxx_conftest_cxx11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + ${ac_cxx_conftest_cxx11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C++98 (complete). +ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" +as_fn_append ac_header_c_list " sys/time.h sys_time_h HAVE_SYS_TIME_H" + +# Auxiliary files required by this configure script. +ac_aux_files="ltmain.sh compile config.guess config.sub missing install-sh" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}/autoconf" + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + +ac_config_headers="$ac_config_headers config.h" + +am__api_version='1.16' + + + + # Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test ${ac_cv_path_install+y}; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +printf %s "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` + + +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + + + if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 +printf %s "checking for a race-free mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if test ${ac_cv_path_mkdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue + case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir ('*'coreutils) '* | \ + 'BusyBox '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test ${ac_cv_path_mkdir+y}; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +printf "%s\n" "$MKDIR_P" >&6; } + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + SET_MAKE= +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# Check whether --enable-silent-rules was given. +if test ${enable_silent_rules+y} +then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac +am_make=${MAKE-make} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='unuran' + VERSION='1.11.0' + + +printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h + + +printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + + + +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + + + +UNURAN_LT_VERSION="16:1:0" + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +printf %s "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } + # Check whether --enable-maintainer-mode was given. +if test ${enable_maintainer_mode+y} +then : + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else $as_nop + USE_MAINTAINER_MODE=no +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +printf "%s\n" "$USE_MAINTAINER_MODE" >&6; } + if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + + + + + # Make sure we can run config.sub. +$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + SET_MAKE= +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion -version; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else $as_nop + ac_file='' +fi +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+y} +ac_save_CFLAGS=$CFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +else $as_nop + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +printf %s "checking whether $CC understands -c and -o together... " >&6; } +if test ${am_cv_prog_cc_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in #( + '0:this is the am__doit target') : + case $s in #( + BSD) : + am__include='.include' am__quote='"' ;; #( + *) : + am__include='include' am__quote='' ;; +esac ;; #( + *) : + ;; +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +printf "%s\n" "${_am_result}" >&6; } + +# Check whether --enable-dependency-tracking was given. +if test ${enable_dependency_tracking+y} +then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + +depcc="$CC" am_compiler_list= + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CC_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + + + + + + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +printf "%s\n" "$CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +printf "%s\n" "$ac_ct_CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 +printf %s "checking whether the compiler supports GNU C++... " >&6; } +if test ${ac_cv_cxx_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+y} +ac_save_CXXFLAGS=$CXXFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +printf %s "checking whether $CXX accepts -g... " >&6; } +if test ${ac_cv_prog_cxx_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +else $as_nop + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + +else $as_nop + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } +if test $ac_test_CXXFLAGS; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_prog_cxx_stdcxx=no +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 +printf %s "checking for $CXX option to enable C++11 features... " >&6; } +if test ${ac_cv_prog_cxx_11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_11=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx11_program +_ACEOF +for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx11" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx11" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 + ac_prog_cxx_stdcxx=cxx11 +fi +fi +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 +printf %s "checking for $CXX option to enable C++98 features... " >&6; } +if test ${ac_cv_prog_cxx_98+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_98=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx98_program +_ACEOF +for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx98=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx98" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx98" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx98" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx98" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 + ac_prog_cxx_stdcxx=cxx98 +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CXX" am_compiler_list= + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CXX_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +printf %s "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test ${ac_cv_prog_CPP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Double quotes because $CC needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +printf "%s\n" "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +printf %s "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +printf "%s\n" "no, using $LN_S" >&6; } +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +printf "%s\n" "$AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="ar" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +printf "%s\n" "$ac_ct_AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_AR" = x; then + AR=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +else + AR="$ac_cv_prog_AR" +fi + +case `pwd` in + *\ * | *\ *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +printf "%s\n" "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.4.7' +macro_revision='2.4.7' + + + + + + + + + + + + + + +ltmain=$ac_aux_dir/ltmain.sh + +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +printf %s "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case $ECHO in + printf*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +printf "%s\n" "printf" >&6; } ;; + print*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +printf "%s\n" "print -r" >&6; } ;; + *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +printf "%s\n" "cat" >&6; } ;; +esac + + + + + + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +printf %s "checking for a sed that does not truncate output... " >&6; } +if test ${ac_cv_path_SED+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in sed gsed + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +printf "%s\n" "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +printf %s "checking for grep that handles long lines and -e... " >&6; } +if test ${ac_cv_path_GREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in grep ggrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +printf "%s\n" "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +printf %s "checking for fgrep... " >&6; } +if test ${ac_cv_path_FGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in fgrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_FGREP" || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +printf "%s\n" "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test ${with_gnu_ld+y} +then : + withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes +else $as_nop + with_gnu_ld=no +fi + +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +printf %s "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return, which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD=$ac_prog + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test yes = "$with_gnu_ld"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +printf %s "checking for GNU ld... " >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +printf %s "checking for non-GNU ld... " >&6; } +fi +if test ${lt_cv_path_LD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +printf "%s\n" "$LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +printf %s "checking if the linker ($LD) is GNU ld... " >&6; } +if test ${lt_cv_prog_gnu_ld+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +printf %s "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if test ${lt_cv_path_NM+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM=$NM +else + lt_nm_to_check=${ac_tool_prefix}nm + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/$lt_tmp_nm + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the 'sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty + case $build_os in + mingw*) lt_bad_file=conftest.nm/nofile ;; + *) lt_bad_file=/dev/null ;; + esac + case `"$tmp_nm" -B $lt_bad_file 2>&1 | $SED '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break 2 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | $SED '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break 2 + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS=$lt_save_ifs + done + : ${lt_cv_path_NM=no} +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +printf "%s\n" "$lt_cv_path_NM" >&6; } +if test no != "$lt_cv_path_NM"; then + NM=$lt_cv_path_NM +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DUMPBIN+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +printf "%s\n" "$DUMPBIN" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in dumpbin "link -dump" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DUMPBIN+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +printf "%s\n" "$ac_ct_DUMPBIN" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | $SED '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols -headers" + ;; + *) + DUMPBIN=: + ;; + esac + fi + + if test : != "$DUMPBIN"; then + NM=$DUMPBIN + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +printf %s "checking the name lister ($NM) interface... " >&6; } +if test ${lt_cv_nm_interface+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +printf "%s\n" "$lt_cv_nm_interface" >&6; } + +# find the maximum length of command line arguments +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +printf %s "checking the maximum length of command line arguments... " >&6; } +if test ${lt_cv_sys_max_cmd_len+y} +then : + printf %s "(cached) " >&6 +else $as_nop + i=0 + teststring=ABCD + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | $SED 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test X`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test 17 != "$i" # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n "$lt_cv_sys_max_cmd_len"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +printf "%s\n" "$lt_cv_sys_max_cmd_len" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 +printf "%s\n" "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +printf %s "checking how to convert $build file names to $host format... " >&6; } +if test ${lt_cv_to_host_file_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +printf "%s\n" "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +printf %s "checking how to convert $build file names to toolchain format... " >&6; } +if test ${lt_cv_to_tool_file_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +printf "%s\n" "$lt_cv_to_tool_file_cmd" >&6; } + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +printf %s "checking for $LD option to reload object files... " >&6; } +if test ${lt_cv_ld_reload_flag+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_ld_reload_flag='-r' +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +printf "%s\n" "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test yes != "$GCC"; then + reload_cmds=false + fi + ;; + darwin*) + if test yes = "$GCC"; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}file", so it can be a program name with args. +set dummy ${ac_tool_prefix}file; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_FILECMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$FILECMD"; then + ac_cv_prog_FILECMD="$FILECMD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_FILECMD="${ac_tool_prefix}file" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +FILECMD=$ac_cv_prog_FILECMD +if test -n "$FILECMD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $FILECMD" >&5 +printf "%s\n" "$FILECMD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_FILECMD"; then + ac_ct_FILECMD=$FILECMD + # Extract the first word of "file", so it can be a program name with args. +set dummy file; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_FILECMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_FILECMD"; then + ac_cv_prog_ac_ct_FILECMD="$ac_ct_FILECMD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_FILECMD="file" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_FILECMD=$ac_cv_prog_ac_ct_FILECMD +if test -n "$ac_ct_FILECMD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_FILECMD" >&5 +printf "%s\n" "$ac_ct_FILECMD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_FILECMD" = x; then + FILECMD=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + FILECMD=$ac_ct_FILECMD + fi +else + FILECMD="$ac_cv_prog_FILECMD" +fi + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +printf "%s\n" "$OBJDUMP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +printf "%s\n" "$ac_ct_OBJDUMP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +printf %s "checking how to recognize dependent libraries... " >&6; } +if test ${lt_cv_deplibs_check_method+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# 'unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# that responds to the $file_magic_cmd with a given extended regex. +# If you have 'file' or equivalent on your system and you're not sure +# whether 'pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='$FILECMD -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly* | midnightbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=$FILECMD + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=$FILECMD + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=$FILECMD + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd* | bitrig*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +os2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +printf "%s\n" "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +printf "%s\n" "$DLLTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +printf "%s\n" "$ac_ct_DLLTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +printf %s "checking how to associate runtime and link libraries... " >&6; } +if test ${lt_cv_sharedlib_from_linklib_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh; + # decide which one to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd=$ECHO + ;; +esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +printf "%s\n" "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +printf "%s\n" "$AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +printf "%s\n" "$ac_ct_AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} + + + + + + +# Use ARFLAGS variable as AR's operation code to sync the variable naming with +# Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have +# higher priority because thats what people were doing historically (setting +# ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS +# variable obsoleted/removed. + +test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr} +lt_ar_flags=$AR_FLAGS + + + + + + +# Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override +# by AR_FLAGS because that was never working and AR_FLAGS is about to die. + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +printf %s "checking for archiver @FILE support... " >&6; } +if test ${lt_cv_ar_at_file+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test 0 -eq "$ac_status"; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test 0 -ne "$ac_status"; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +printf "%s\n" "$lt_cv_ar_at_file" >&6; } + +if test no = "$lt_cv_ar_at_file"; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + bitrig* | openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +printf %s "checking command to parse $NM output from $compiler object... " >&6; } +if test ${lt_cv_sys_global_symbol_pipe+y} +then : + printf %s "(cached) " >&6 +else $as_nop + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test ia64 = "$host_cpu"; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Gets list of data symbols to import. + lt_cv_sys_global_symbol_to_import="$SED -n -e 's/^I .* \(.*\)$/\1/p'" + # Adjust the below global symbol transforms to fixup imported variables. + lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" + lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" + lt_c_name_lib_hook="\ + -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ + -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" +else + # Disable hooks by default. + lt_cv_sys_global_symbol_to_import= + lt_cdecl_hook= + lt_c_name_hook= + lt_c_name_lib_hook= +fi + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="$SED -n"\ +$lt_cdecl_hook\ +" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="$SED -n"\ +$lt_c_name_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" + +# Transform an extracted symbol line into symbol name with lib prefix and +# symbol address. +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="$SED -n"\ +$lt_c_name_lib_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function, + # D for any global variable and I for any imported variable. + # Also find C++ and __fastcall symbols from MSVC++ or ICC, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ +" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ +" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ +" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ +" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="$SED -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | $SED '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS=conftstm.$ac_objext + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test yes = "$pipe_works"; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +printf "%s\n" "failed" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +printf "%s\n" "ok" >&6; } +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +printf %s "checking for sysroot... " >&6; } + +# Check whether --with-sysroot was given. +if test ${with_sysroot+y} +then : + withval=$with_sysroot; +else $as_nop + with_sysroot=no +fi + + +lt_sysroot= +case $with_sysroot in #( + yes) + if test yes = "$GCC"; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 +printf "%s\n" "$with_sysroot" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +printf "%s\n" "${lt_sysroot:-no}" >&6; } + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 +printf %s "checking for a working dd... " >&6; } +if test ${ac_cv_path_lt_DD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +: ${lt_DD:=$DD} +if test -z "$lt_DD"; then + ac_path_lt_DD_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in dd + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_lt_DD="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_lt_DD" || continue +if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: +fi + $ac_path_lt_DD_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_lt_DD"; then + : + fi +else + ac_cv_path_lt_DD=$lt_DD +fi + +rm -f conftest.i conftest2.i conftest.out +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 +printf "%s\n" "$ac_cv_path_lt_DD" >&6; } + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 +printf %s "checking how to truncate binary pipes... " >&6; } +if test ${lt_cv_truncate_bin+y} +then : + printf %s "(cached) " >&6 +else $as_nop + printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +lt_cv_truncate_bin= +if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" +fi +rm -f conftest.i conftest2.i conftest.out +test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 +printf "%s\n" "$lt_cv_truncate_bin" >&6; } + + + + + + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + +# Check whether --enable-libtool-lock was given. +if test ${enable_libtool_lock+y} +then : + enableval=$enable_libtool_lock; +fi + +test no = "$enable_libtool_lock" || enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out what ABI is being produced by ac_compile, and set mode + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `$FILECMD conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE=32 + ;; + *ELF-64*) + HPUX_IA64_MODE=64 + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test yes = "$lt_cv_prog_gnu_ld"; then + case `$FILECMD conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `$FILECMD conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +mips64*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + emul=elf + case `$FILECMD conftest.$ac_objext` in + *32-bit*) + emul="${emul}32" + ;; + *64-bit*) + emul="${emul}64" + ;; + esac + case `$FILECMD conftest.$ac_objext` in + *MSB*) + emul="${emul}btsmip" + ;; + *LSB*) + emul="${emul}ltsmip" + ;; + esac + case `$FILECMD conftest.$ac_objext` in + *N32*) + emul="${emul}n32" + ;; + esac + LD="${LD-ld} -m $emul" + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the + # situations where additional linker options are needed (such as when + # doing 32-bit compilation for a host where ld defaults to 64-bit, or + # vice versa); the common cases where no linker options are needed do + # not appear in the list. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `$FILECMD conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + case `$FILECMD conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac + ;; + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + powerpcle-*linux*|powerpc64le-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -belf" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +printf %s "checking whether the C compiler needs -belf... " >&6; } +if test ${lt_cv_cc_needs_belf+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + lt_cv_cc_needs_belf=yes +else $as_nop + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +printf "%s\n" "$lt_cv_cc_needs_belf" >&6; } + if test yes != "$lt_cv_cc_needs_belf"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS=$SAVE_CFLAGS + fi + ;; +*-*solaris*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `$FILECMD conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*|x86_64-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD=${LD-ld}_sol2 + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks=$enable_libtool_lock + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_MANIFEST_TOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +printf "%s\n" "$MANIFEST_TOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_MANIFEST_TOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +printf "%s\n" "$ac_ct_MANIFEST_TOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi + +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +printf %s "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if test ${lt_cv_path_mainfest_tool+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +printf "%s\n" "$lt_cv_path_mainfest_tool" >&6; } +if test yes != "$lt_cv_path_mainfest_tool"; then + MANIFEST_TOOL=: +fi + + + + + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DSYMUTIL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +printf "%s\n" "$DSYMUTIL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DSYMUTIL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +printf "%s\n" "$ac_ct_DSYMUTIL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_NMEDIT+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +printf "%s\n" "$NMEDIT" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_NMEDIT+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +printf "%s\n" "$ac_ct_NMEDIT" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LIPO+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +printf "%s\n" "$LIPO" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_LIPO+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_LIPO="lipo" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +printf "%s\n" "$ac_ct_LIPO" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +printf "%s\n" "$OTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL="otool" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +printf "%s\n" "$ac_ct_OTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OTOOL64+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +printf "%s\n" "$OTOOL64" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OTOOL64+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +printf "%s\n" "$ac_ct_OTOOL64" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +printf %s "checking for -single_module linker flag... " >&6; } +if test ${lt_cv_apple_cc_single_mod+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_apple_cc_single_mod=no + if test -z "$LT_MULTI_MODULE"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&5 + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test 0 = "$_lt_result"; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +printf %s "checking for -exported_symbols_list linker flag... " >&6; } +if test ${lt_cv_ld_exported_symbols_list+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + lt_cv_ld_exported_symbols_list=yes +else $as_nop + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +printf "%s\n" "$lt_cv_ld_exported_symbols_list" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +printf %s "checking for -force_load linker flag... " >&6; } +if test ${lt_cv_ld_force_load+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR $AR_FLAGS libconftest.a conftest.o" >&5 + $AR $AR_FLAGS libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&5 + elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +printf "%s\n" "$lt_cv_ld_force_load" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + darwin*) + case $MACOSX_DEPLOYMENT_TARGET,$host in + 10.[012],*|,*powerpc*-darwin[5-8]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + *) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test yes = "$lt_cv_apple_cc_single_mod"; then + _lt_dar_single_mod='$single_module' + fi + if test yes = "$lt_cv_ld_exported_symbols_list"; then + _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' + fi + if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} + +ac_header= ac_cache= +for ac_item in $ac_header_c_list +do + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done + + + + + + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : + +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes +then : + printf "%s\n" "#define HAVE_DLFCN_H 1" >>confdefs.h + +fi + + + + +func_stripname_cnf () +{ + case $2 in + .*) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%\\\\$2\$%%"`;; + *) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%$2\$%%"`;; + esac +} # func_stripname_cnf + + + + + +# Set options +# Check whether --enable-shared was given. +if test ${enable_shared+y} +then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else $as_nop + enable_shared=no +fi + + + + + + + + + + + enable_dlopen=no + + + enable_win32_dll=no + + + + # Check whether --enable-static was given. +if test ${enable_static+y} +then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else $as_nop + enable_static=yes +fi + + + + + + + + + + +# Check whether --with-pic was given. +if test ${with_pic+y} +then : + withval=$with_pic; lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for lt_pkg in $withval; do + IFS=$lt_save_ifs + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else $as_nop + pic_mode=default +fi + + + + + + + + + # Check whether --enable-fast-install was given. +if test ${enable_fast_install+y} +then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else $as_nop + enable_fast_install=yes +fi + + + + + + + + + shared_archive_member_spec= +case $host,$enable_shared in +power*-*-aix[5-9]*,yes) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 +printf %s "checking which variant of shared library versioning to provide... " >&6; } + +# Check whether --with-aix-soname was given. +if test ${with_aix_soname+y} +then : + withval=$with_aix_soname; case $withval in + aix|svr4|both) + ;; + *) + as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname +else $as_nop + if test ${lt_cv_with_aix_soname+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_with_aix_soname=aix +fi + + with_aix_soname=$lt_cv_with_aix_soname +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 +printf "%s\n" "$with_aix_soname" >&6; } + if test aix != "$with_aix_soname"; then + # For the AIX way of multilib, we name the shared archive member + # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', + # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. + # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, + # the AIX toolchain works better with OBJECT_MODE set (default 32). + if test 64 = "${OBJECT_MODE-32}"; then + shared_archive_member_spec=shr_64 + else + shared_archive_member_spec=shr + fi + fi + ;; +*) + with_aix_soname=aix + ;; +esac + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS=$ltmain + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +printf %s "checking for objdir... " >&6; } +if test ${lt_cv_objdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +printf "%s\n" "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +printf "%s\n" "#define LT_OBJDIR \"$lt_cv_objdir/\"" >>confdefs.h + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a '.a' archive for static linking (except MSVC and +# ICC, which need '.lib'). +libext=a + +with_gnu_ld=$lt_cv_prog_gnu_ld + +old_CC=$CC +old_CFLAGS=$CFLAGS + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +func_cc_basename $compiler +cc_basename=$func_cc_basename_result + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +printf %s "checking for ${ac_tool_prefix}file... " >&6; } +if test ${lt_cv_path_MAGIC_CMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/${ac_tool_prefix}file"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac +fi + +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +printf "%s\n" "$MAGIC_CMD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +printf %s "checking for file... " >&6; } +if test ${lt_cv_path_MAGIC_CMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/file"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac +fi + +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +printf "%s\n" "$MAGIC_CMD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC=$CC +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test yes = "$GCC"; then + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +printf %s "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if test ${lt_cv_prog_compiler_rtti_exceptions+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +printf "%s\n" "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + + + if test yes = "$GCC"; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + lt_prog_compiler_pic='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + if test -n "$lt_prog_compiler_pic"; then + lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='$wl-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + # old Intel for x86_64, which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ F* | *Sun*Fortran*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Intel*\ [CF]*Compiler*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + *Portland\ Group*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms that do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +printf %s "checking for $compiler option to produce PIC... " >&6; } +if test ${lt_cv_prog_compiler_pic+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if test ${lt_cv_prog_compiler_pic_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_works" >&6; } + +if test yes = "$lt_cv_prog_compiler_pic_works"; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test ${lt_cv_prog_compiler_static_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_static_works=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +printf "%s\n" "$lt_cv_prog_compiler_static_works" >&6; } + +if test yes = "$lt_cv_prog_compiler_static_works"; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links=nottested +if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then + # do not overwrite the value of need_locks provided by the user + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +printf %s "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +printf "%s\n" "$hard_links" >&6; } + if test no = "$hard_links"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ' (' and ')$', so one must not match beginning or + # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', + # as well as any symbol that contains 'd'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++ or Intel C++ Compiler. + if test yes != "$GCC"; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) + with_gnu_ld=yes + ;; + openbsd* | bitrig*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test yes = "$with_gnu_ld"; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test yes = "$lt_use_gnu_ld_interface"; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='$wl' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + export_dynamic_flag_spec='$wl--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test ia64 != "$host_cpu"; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='$wl--export-all-symbols' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + shrext_cmds=.dll + archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes=yes + file_list_spec='@' + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + export_dynamic_flag_spec='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test linux-dietlibc = "$host_os"; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test no = "$tmp_diet" + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + compiler_needs_object=yes + ;; + esac + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + + if test yes = "$supports_anon_versioning"; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + tcc*) + export_dynamic_flag_spec='-rdynamic' + ;; + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test yes = "$supports_anon_versioning"; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test no = "$ld_shlibs"; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + aix_use_runtimelinking=yes + break + fi + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + hardcode_direct=no + hardcode_direct_absolute=no + ;; + esac + + if test yes = "$GCC"; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + export_dynamic_flag_spec='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if test ${lt_cv_aix_libpath_+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if test ${lt_cv_aix_libpath_+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' $wl-bernotok' + allow_undefined_flag=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi + archive_cmds_need_lc=yes + archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++ or Intel C++ Compiler. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl* | icl*) + # Native MSVC or ICC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC and ICC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + if test yes = "$lt_cv_ld_force_load"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec='' + fi + link_all_deplibs=yes + allow_undefined_flag=$_lt_dar_allow_undefined + case $cc_basename in + ifort*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; then + output_verbose_link_cmd=func_echo_all + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + archive_expsym_cmds="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + module_expsym_cmds="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly* | midnightbsd*) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test yes = "$GCC"; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='$wl+b $wl$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='$wl-E' + ;; + + hpux10*) + if test yes,no = "$GCC,$with_gnu_ld"; then + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec='$wl+b $wl$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='$wl-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test yes,no = "$GCC,$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +printf %s "checking if $CC understands -b... " >&6; } +if test ${lt_cv_prog_compiler__b+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler__b=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +printf "%s\n" "$lt_cv_prog_compiler__b" >&6; } + +if test yes = "$lt_cv_prog_compiler__b"; then + archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + + ;; + esac + fi + if test no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec='$wl+b $wl$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='$wl-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test yes = "$GCC"; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +printf %s "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if test ${lt_cv_irix_exported_symbol+y} +then : + printf %s "(cached) " >&6 +else $as_nop + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + lt_cv_irix_exported_symbol=yes +else $as_nop + lt_cv_irix_exported_symbol=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } + if test yes = "$lt_cv_irix_exported_symbol"; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' + fi + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + ld_shlibs=yes + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + export_dynamic_flag_spec='$wl-E' + else + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + shrext_cmds=.dll + archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes=yes + file_list_spec='@' + ;; + + osf3*) + if test yes = "$GCC"; then + allow_undefined_flag=' $wl-expect_unresolved $wl\*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test yes = "$GCC"; then + allow_undefined_flag=' $wl-expect_unresolved $wl\*' + archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test yes = "$GCC"; then + wlarc='$wl' + archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='$wl' + archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. GCC discards it without '$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test yes = "$GCC"; then + whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test sequent = "$host_vendor"; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='$wl-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='$wl-z,text' + allow_undefined_flag='$wl-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='$wl-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test sni = "$host_vendor"; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='$wl-Blargedynsym' + ;; + esac + fi + fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +printf "%s\n" "$ld_shlibs" >&6; } +test no = "$ld_shlibs" && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test yes,yes = "$GCC,$enable_shared"; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +printf %s "checking whether -lc should be explicitly linked in... " >&6; } +if test ${lt_cv_archive_cmds_need_lc+y} +then : + printf %s "(cached) " >&6 +else $as_nop + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +printf "%s\n" "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +printf %s "checking dynamic linker characteristics... " >&6; } + +if test yes = "$GCC"; then + case $host_os in + darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; + *) lt_awk_arg='/^libraries:/' ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; + *) lt_sed_strip_eq='s|=/|/|g' ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary... + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + # ...but if some path component already ends with the multilib dir we assume + # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). + case "$lt_multi_os_dir; $lt_search_path_spec " in + "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) + lt_multi_os_dir= + ;; + esac + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" + elif test -n "$lt_multi_os_dir"; then + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS = " "; FS = "/|\n";} { + lt_foo = ""; + lt_count = 0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo = "/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's|/\([A-Za-z]:\)|\1|g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=.so +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + + + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='$libname$release$shared_ext$major' + ;; + +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test ia64 = "$host_cpu"; then + # AIX 5 supports IA64 + library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line '#! .'. This would cause the generated library to + # depend on '.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a(lib.so.V)' + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='$libname$shared_ext' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl* | *,icl*) + # Native MSVC or ICC + libname_spec='$name' + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec=$LIB + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC and ICC wrapper + library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$versuffix$shared_ext $libname$release$major$shared_ext $libname$shared_ext' + soname_spec='$libname$release$major$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly* | midnightbsd*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + # Handle Gentoo/FreeBSD as it was Linux + case $host_vendor in + gentoo) + version_type=linux ;; + *) + version_type=freebsd-$objformat ;; + esac + + case $version_type in + freebsd-elf*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + need_version=yes + ;; + linux) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + need_lib_prefix=no + need_version=no + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + if test 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test yes = "$lt_cv_prog_gnu_ld"; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" + sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + hardcode_libdir_flag_spec='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if test ${lt_cv_shlibpath_overrides_runpath+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null +then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test yes = "$with_gnu_ld"; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec; then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' + soname_spec='$libname$shared_ext.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=sco + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test yes = "$with_gnu_ld"; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +printf "%s\n" "$dynamic_linker" >&6; } +test no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +printf %s "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test yes = "$hardcode_automatic"; then + + # We can hardcode non-existent directories. + if test no != "$hardcode_direct" && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && + test no != "$hardcode_minus_L"; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +printf "%s\n" "$hardcode_action" >&6; } + +if test relink = "$hardcode_action" || + test yes = "$inherit_rpath"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test yes != "$enable_dlopen"; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen=load_add_on + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen=LoadLibrary + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +printf %s "checking for dlopen in -ldl... " >&6; } +if test ${ac_cv_lib_dl_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (void); +int +main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_dl_dlopen=yes +else $as_nop + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes +then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl +else $as_nop + + lt_cv_dlopen=dyld + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + tpf*) + # Don't try to run any link tests for TPF. We know it's impossible + # because TPF is a cross-compiler, and we know how we open DSOs. + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + lt_cv_dlopen_self=no + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = xyes +then : + lt_cv_dlopen=shl_load +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +printf %s "checking for shl_load in -ldld... " >&6; } +if test ${ac_cv_lib_dld_shl_load+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (void); +int +main (void) +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_dld_shl_load=yes +else $as_nop + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +printf "%s\n" "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes +then : + lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld +else $as_nop + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = xyes +then : + lt_cv_dlopen=dlopen +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +printf %s "checking for dlopen in -ldl... " >&6; } +if test ${ac_cv_lib_dl_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (void); +int +main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_dl_dlopen=yes +else $as_nop + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes +then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +printf %s "checking for dlopen in -lsvld... " >&6; } +if test ${ac_cv_lib_svld_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (void); +int +main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_svld_dlopen=yes +else $as_nop + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes +then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +printf %s "checking for dld_link in -ldld... " >&6; } +if test ${ac_cv_lib_dld_dld_link+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char dld_link (void); +int +main (void) +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_dld_dld_link=yes +else $as_nop + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +printf "%s\n" "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes +then : + lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test no = "$lt_cv_dlopen"; then + enable_dlopen=no + else + enable_dlopen=yes + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS=$CPPFLAGS + test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS=$LDFLAGS + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS=$LIBS + LIBS="$lt_cv_dlopen_libs $LIBS" + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +printf %s "checking whether a program can dlopen itself... " >&6; } +if test ${lt_cv_dlopen_self+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test yes = "$cross_compiling"; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +printf "%s\n" "$lt_cv_dlopen_self" >&6; } + + if test yes = "$lt_cv_dlopen_self"; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +printf %s "checking whether a statically linked program can dlopen itself... " >&6; } +if test ${lt_cv_dlopen_self_static+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test yes = "$cross_compiling"; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +printf "%s\n" "$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS=$save_CPPFLAGS + LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +printf %s "checking whether stripping libraries is possible... " >&6; } +if test -z "$STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +else + if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + old_striplib="$STRIP --strip-debug" + striplib="$STRIP --strip-unneeded" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + case $host_os in + darwin*) + # FIXME - insert some real tests, host_os isn't really good enough + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + ;; + freebsd*) + if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then + old_striplib="$STRIP --strip-debug" + striplib="$STRIP --strip-unneeded" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + fi + ;; + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; + esac + fi +fi + + + + + + + + + + + + + # Report what library types will actually be built + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +printf %s "checking if libtool supports shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +printf "%s\n" "$can_build_shared" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +printf %s "checking whether to build shared libraries... " >&6; } + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +printf "%s\n" "$enable_shared" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +printf %s "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +printf "%s\n" "$enable_static" >&6; } + + + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC=$lt_save_CC + + if test -n "$CXX" && ( test no != "$CXX" && + ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || + (test g++ != "$CXX"))); then + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 +printf %s "checking how to run the C++ preprocessor... " >&6; } +if test -z "$CXXCPP"; then + if test ${ac_cv_prog_CXXCPP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Double quotes because $CXX needs to be expanded + for CXXCPP in "$CXX -E" cpp /lib/cpp + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + break +fi + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 +printf "%s\n" "$CXXCPP" >&6; } +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +else + _lt_caught_CXX_error=yes +fi + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +compiler_needs_object_CXX=no +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_direct_absolute_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_shlibpath_var_CXX=unsupported +hardcode_automatic_CXX=no +inherit_rpath_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +reload_flag_CXX=$reload_flag +reload_cmds_CXX=$reload_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_caught_CXX_error"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + + # save warnings/boilerplate of simple test code + ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + + ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + compiler_CXX=$CC + func_cc_basename $compiler +cc_basename=$func_cc_basename_result + + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test yes = "$GXX"; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' + else + lt_prog_compiler_no_builtin_flag_CXX= + fi + + if test yes = "$GXX"; then + # Set up default GNU C++ configuration + + + +# Check whether --with-gnu-ld was given. +if test ${with_gnu_ld+y} +then : + withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes +else $as_nop + with_gnu_ld=no +fi + +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +printf %s "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return, which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD=$ac_prog + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test yes = "$with_gnu_ld"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +printf %s "checking for GNU ld... " >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +printf %s "checking for non-GNU ld... " >&6; } +fi +if test ${lt_cv_path_LD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +printf "%s\n" "$LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +printf %s "checking if the linker ($LD) is GNU ld... " >&6; } +if test ${lt_cv_prog_gnu_ld+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test yes = "$with_gnu_ld"; then + archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='$wl' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + ld_shlibs_CXX=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aix[4-9]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_direct_absolute_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + file_list_spec_CXX='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + hardcode_direct_CXX=no + hardcode_direct_absolute_CXX=no + ;; + esac + + if test yes = "$GXX"; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag=$shared_flag' $wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + export_dynamic_flag_spec_CXX='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + always_export_symbols_CXX=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + # The "-G" linker flag allows undefined symbols. + no_undefined_flag_CXX='-bernotok' + # Determine the default libpath from the value encoded in an empty + # executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if test ${lt_cv_aix_libpath__CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__CXX +fi + + hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + hardcode_libdir_flag_spec_CXX='$wl-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if test ${lt_cv_aix_libpath__CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__CXX +fi + + hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' $wl-bernotok' + allow_undefined_flag_CXX=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX='$convenience' + fi + archive_cmds_need_lc_CXX=yes + archive_expsym_cmds_CXX='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared + # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_CXX=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + ld_shlibs_CXX=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl* | ,icl* | no,icl*) + # Native MSVC or ICC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_CXX=' ' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=yes + file_list_spec_CXX='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' + enable_shared_with_static_runtimes_CXX=yes + # Don't use ranlib + old_postinstall_cmds_CXX='chmod 644 $oldlib' + postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + export_dynamic_flag_spec_CXX='$wl--export-all-symbols' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs_CXX=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + + + archive_cmds_need_lc_CXX=no + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + if test yes = "$lt_cv_ld_force_load"; then + whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec_CXX='' + fi + link_all_deplibs_CXX=yes + allow_undefined_flag_CXX=$_lt_dar_allow_undefined + case $cc_basename in + ifort*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; then + output_verbose_link_cmd=func_echo_all + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + archive_expsym_cmds_CXX="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + module_expsym_cmds_CXX="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + if test yes != "$lt_cv_apple_cc_single_mod"; then + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" + archive_expsym_cmds_CXX="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" + fi + + else + ld_shlibs_CXX=no + fi + + ;; + + os2*) + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_minus_L_CXX=yes + allow_undefined_flag_CXX=unsupported + shrext_cmds=.dll + archive_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes_CXX=yes + file_list_spec_CXX='@' + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + ld_shlibs_CXX=no + ;; + + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + + freebsd* | dragonfly* | midnightbsd*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + + haiku*) + archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + link_all_deplibs_CXX=yes + ;; + + hpux9*) + hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='$wl-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' + hardcode_libdir_separator_CXX=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + export_dynamic_flag_spec_CXX='$wl-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + *) + hardcode_direct_CXX=yes + hardcode_direct_absolute_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + interix[3-9]*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + export_dynamic_flag_spec_CXX='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_CXX='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + hardcode_libdir_separator_CXX=: + inherit_rpath_CXX=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [1-5].* | *pgcpp\ [1-5].*) + prelink_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + old_archive_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + archive_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + + hardcode_libdir_flag_spec_CXX='$wl--rpath $wl$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + whole_archive_flag_spec_CXX='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + ;; + cxx*) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + if test yes = "$supports_anon_versioning"; then + archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ C*) + # Sun C++ 5.9 + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' + hardcode_libdir_flag_spec_CXX='-R$libdir' + whole_archive_flag_spec_CXX='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + compiler_needs_object_CXX=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + ld_shlibs_CXX=yes + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + hardcode_direct_absolute_CXX=yes + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='$wl-E' + whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + ld_shlibs_CXX=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + case $host in + osf3*) + allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' + archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + ;; + *) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ + $RM $lib.exp' + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + ;; + esac + + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes,no = "$GXX,$with_gnu_ld"; then + allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' + case $host in + osf3*) + archive_cmds_CXX='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + *) + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + esac + + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + archive_cmds_need_lc_CXX=yes + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test yes,no = "$GXX,$with_gnu_ld"; then + no_undefined_flag_CXX=' $wl-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require '-G' NOT '-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + fi + + hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir' + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + whole_archive_flag_spec_CXX='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag_CXX='$wl-z,text' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag_CXX='$wl-z,text' + allow_undefined_flag_CXX='$wl-z,nodefs' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='$wl-R,$libdir' + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + export_dynamic_flag_spec_CXX='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ + '"$old_archive_cmds_CXX" + reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ + '"$reload_cmds_CXX" + ;; + *) + archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +printf "%s\n" "$ld_shlibs_CXX" >&6; } + test no = "$ld_shlibs_CXX" && can_build_shared=no + + GCC_CXX=$GXX + LD_CXX=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + # Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= + +cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF + + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case $prev$p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test x-L = "$p" || + test x-R = "$p"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test no = "$pre_test_object_deps_done"; then + case $prev in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX=$prev$p + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} $prev$p" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$postdeps_CXX"; then + postdeps_CXX=$prev$p + else + postdeps_CXX="${postdeps_CXX} $prev$p" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test no = "$pre_test_object_deps_done"; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX=$p + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX=$p + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +case $host_os in +interix[3-9]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + predep_objects_CXX= + postdep_objects_CXX= + postdeps_CXX= + ;; +esac + + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + compiler_lib_search_dirs_CXX= +if test -n "${compiler_lib_search_path_CXX}"; then + compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | $SED -e 's! -L! !g' -e 's!^ !!'` +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + + + # C++ specific cases for pic, static, wl, etc. + if test yes = "$GXX"; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + lt_prog_compiler_pic_CXX='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic_CXX='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static_CXX='$wl-static' + ;; + esac + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static_CXX= + ;; + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_CXX=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic_CXX='-fPIC -shared' + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix[4-9]*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + dgux*) + case $cc_basename in + ec++*) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly* | midnightbsd*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='$wl-a ${wl}archive' + if test ia64 != "$host_cpu"; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='$wl-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64, which still supported -KPIC. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + lt_prog_compiler_static_CXX='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fpic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-qpic' + lt_prog_compiler_static_CXX='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ C*) + # Sun C++ 5.9 + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic_CXX='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx*) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc*) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +case $host_os in + # For platforms that do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +printf %s "checking for $compiler option to produce PIC... " >&6; } +if test ${lt_cv_prog_compiler_pic_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_CXX" >&6; } +lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } +if test ${lt_cv_prog_compiler_pic_works_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works_CXX=yes + fi + fi + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_works_CXX" >&6; } + +if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test ${lt_cv_prog_compiler_static_works_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_static_works_CXX=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works_CXX=yes + fi + else + lt_cv_prog_compiler_static_works_CXX=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_static_works_CXX" >&6; } + +if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then + : +else + lt_prog_compiler_static_CXX= +fi + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_c_o_CXX=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_c_o_CXX=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } + + + + +hard_links=nottested +if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; then + # do not overwrite the value of need_locks provided by the user + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +printf %s "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +printf "%s\n" "$hard_links" >&6; } + if test no = "$hard_links"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + case $host_os in + aix[4-9]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX=$ltdll_cmds + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl* | icl*) + exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + ;; + esac + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +printf "%s\n" "$ld_shlibs_CXX" >&6; } +test no = "$ld_shlibs_CXX" && can_build_shared=no + +with_gnu_ld_CXX=$with_gnu_ld + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test yes,yes = "$GCC,$enable_shared"; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +printf %s "checking whether -lc should be explicitly linked in... " >&6; } +if test ${lt_cv_archive_cmds_need_lc_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + pic_flag=$lt_prog_compiler_pic_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc_CXX=no + else + lt_cv_archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 +printf "%s\n" "$lt_cv_archive_cmds_need_lc_CXX" >&6; } + archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +printf %s "checking dynamic linker characteristics... " >&6; } + +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=.so +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + + + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='$libname$release$shared_ext$major' + ;; + +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test ia64 = "$host_cpu"; then + # AIX 5 supports IA64 + library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line '#! .'. This would cause the generated library to + # depend on '.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a(lib.so.V)' + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='$libname$shared_ext' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl* | *,icl*) + # Native MSVC or ICC + libname_spec='$name' + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec=$LIB + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC and ICC wrapper + library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$versuffix$shared_ext $libname$release$major$shared_ext $libname$shared_ext' + soname_spec='$libname$release$major$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`' + + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly* | midnightbsd*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + # Handle Gentoo/FreeBSD as it was Linux + case $host_vendor in + gentoo) + version_type=linux ;; + *) + version_type=freebsd-$objformat ;; + esac + + case $version_type in + freebsd-elf*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + need_version=yes + ;; + linux) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + need_lib_prefix=no + need_version=no + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + if test 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test yes = "$lt_cv_prog_gnu_ld"; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" + sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + hardcode_libdir_flag_spec_CXX='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if test ${lt_cv_shlibpath_overrides_runpath+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null +then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test yes = "$with_gnu_ld"; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec; then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' + soname_spec='$libname$shared_ext.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=sco + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test yes = "$with_gnu_ld"; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +printf "%s\n" "$dynamic_linker" >&6; } +test no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +printf %s "checking how to hardcode library paths into programs... " >&6; } +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || + test -n "$runpath_var_CXX" || + test yes = "$hardcode_automatic_CXX"; then + + # We can hardcode non-existent directories. + if test no != "$hardcode_direct_CXX" && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" && + test no != "$hardcode_minus_L_CXX"; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 +printf "%s\n" "$hardcode_action_CXX" >&6; } + +if test relink = "$hardcode_action_CXX" || + test yes = "$inherit_rpath_CXX"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test yes != "$_lt_caught_CXX_error" + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sqrt in -lm" >&5 +printf %s "checking for sqrt in -lm... " >&6; } +if test ${ac_cv_lib_m_sqrt+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char sqrt (void); +int +main (void) +{ +return sqrt (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_m_sqrt=yes +else $as_nop + ac_cv_lib_m_sqrt=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_sqrt" >&5 +printf "%s\n" "$ac_cv_lib_m_sqrt" >&6; } +if test "x$ac_cv_lib_m_sqrt" = xyes +then : + printf "%s\n" "#define HAVE_LIBM 1" >>confdefs.h + + LIBS="-lm $LIBS" + +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cblas_dgemm in -lgslcblas" >&5 +printf %s "checking for cblas_dgemm in -lgslcblas... " >&6; } +if test ${ac_cv_lib_gslcblas_cblas_dgemm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgslcblas $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char cblas_dgemm (void); +int +main (void) +{ +return cblas_dgemm (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_gslcblas_cblas_dgemm=yes +else $as_nop + ac_cv_lib_gslcblas_cblas_dgemm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gslcblas_cblas_dgemm" >&5 +printf "%s\n" "$ac_cv_lib_gslcblas_cblas_dgemm" >&6; } +if test "x$ac_cv_lib_gslcblas_cblas_dgemm" = xyes +then : + printf "%s\n" "#define HAVE_LIBGSLCBLAS 1" >>confdefs.h + + LIBS="-lgslcblas $LIBS" + +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gsl_blas_dgemm in -lgsl" >&5 +printf %s "checking for gsl_blas_dgemm in -lgsl... " >&6; } +if test ${ac_cv_lib_gsl_gsl_blas_dgemm+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgsl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char gsl_blas_dgemm (void); +int +main (void) +{ +return gsl_blas_dgemm (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_gsl_gsl_blas_dgemm=yes +else $as_nop + ac_cv_lib_gsl_gsl_blas_dgemm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gsl_gsl_blas_dgemm" >&5 +printf "%s\n" "$ac_cv_lib_gsl_gsl_blas_dgemm" >&6; } +if test "x$ac_cv_lib_gsl_gsl_blas_dgemm" = xyes +then : + printf "%s\n" "#define HAVE_LIBGSL 1" >>confdefs.h + + LIBS="-lgsl $LIBS" + +fi + + + + + + +# Check whether --with-urng_rngstream was given. +if test ${with_urng_rngstream+y} +then : + withval=$with_urng_rngstream; case "${withval}" in + yes) ;; no) ;; + *) as_fn_error $? "bad value '${withval}' for --with-urng-rngstream" "$LINENO" 5 ;; + esac +else $as_nop + with_urng_rngstream=no +fi + +if test "x$with_urng_rngstream" != xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for RngStream_CreateStream in -lrngstreams" >&5 +printf %s "checking for RngStream_CreateStream in -lrngstreams... " >&6; } +if test ${ac_cv_lib_rngstreams_RngStream_CreateStream+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrngstreams $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char RngStream_CreateStream (void); +int +main (void) +{ +return RngStream_CreateStream (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_rngstreams_RngStream_CreateStream=yes +else $as_nop + ac_cv_lib_rngstreams_RngStream_CreateStream=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rngstreams_RngStream_CreateStream" >&5 +printf "%s\n" "$ac_cv_lib_rngstreams_RngStream_CreateStream" >&6; } +if test "x$ac_cv_lib_rngstreams_RngStream_CreateStream" = xyes +then : + printf "%s\n" "#define HAVE_LIBRNGSTREAMS 1" >>confdefs.h + + LIBS="-lrngstreams $LIBS" + +fi + + for ac_header in RngStream.h +do : + ac_fn_c_check_header_compile "$LINENO" "RngStream.h" "ac_cv_header_RngStream_h" "$ac_includes_default" +if test "x$ac_cv_header_RngStream_h" = xyes +then : + printf "%s\n" "#define HAVE_RNGSTREAM_H 1" >>confdefs.h + UNURAN_SUPPORTS_RNGSTREAM=-DUNURAN_SUPPORTS_RNGSTREAM + + +printf "%s\n" "#define UNURAN_HAS_RNGSTREAM 1" >>confdefs.h + +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? " +`echo "--with-urng-rngstream given, but 'RngStream.h' not found" | \ + $SED 's/\(.*\)/* \1 */;h;s/./*/g;p;s/./ /g;s/./*/;s/.$/*/;p;x;p;x;p;x;s/./*/g'` + + +See \`config.log' for more details" "$LINENO" 5; } +fi + +done +fi + + + + +# Check whether --with-urng_prng was given. +if test ${with_urng_prng+y} +then : + withval=$with_urng_prng; case "${withval}" in + yes) ;; no) ;; + *) as_fn_error $? "bad value '${withval}' for --with-urng-prng" "$LINENO" 5 ;; + esac +else $as_nop + with_urng_prng=no +fi + +if test "x$with_urng_prng" != xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for prng_new in -lprng" >&5 +printf %s "checking for prng_new in -lprng... " >&6; } +if test ${ac_cv_lib_prng_prng_new+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lprng $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char prng_new (void); +int +main (void) +{ +return prng_new (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_prng_prng_new=yes +else $as_nop + ac_cv_lib_prng_prng_new=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_prng_prng_new" >&5 +printf "%s\n" "$ac_cv_lib_prng_prng_new" >&6; } +if test "x$ac_cv_lib_prng_prng_new" = xyes +then : + printf "%s\n" "#define HAVE_LIBPRNG 1" >>confdefs.h + + LIBS="-lprng $LIBS" + +fi + + for ac_header in prng.h +do : + ac_fn_c_check_header_compile "$LINENO" "prng.h" "ac_cv_header_prng_h" "$ac_includes_default" +if test "x$ac_cv_header_prng_h" = xyes +then : + printf "%s\n" "#define HAVE_PRNG_H 1" >>confdefs.h + UNURAN_SUPPORTS_PRNG=-DUNURAN_SUPPORTS_PRNG + + +printf "%s\n" "#define UNURAN_HAS_PRNG 1" >>confdefs.h + +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? " +`echo "--with-urng-prng given, but 'prng.h' not found" | \ + $SED 's/\(.*\)/* \1 */;h;s/./*/g;p;s/./ /g;s/./*/;s/.$/*/;p;x;p;x;p;x;s/./*/g'` + + +See \`config.log' for more details" "$LINENO" 5; } +fi + +done +fi + + + + +# Check whether --with-urng_gsl was given. +if test ${with_urng_gsl+y} +then : + withval=$with_urng_gsl; case "${withval}" in + yes) ;; no) ;; + *) as_fn_error $? "bad value '${withval}' for --with-urng-gsl" "$LINENO" 5 ;; + esac +else $as_nop + with_urng_gsl=no +fi + +if test "x$with_urng_gsl" != xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gsl_rng_alloc in -lgsl" >&5 +printf %s "checking for gsl_rng_alloc in -lgsl... " >&6; } +if test ${ac_cv_lib_gsl_gsl_rng_alloc+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgsl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char gsl_rng_alloc (void); +int +main (void) +{ +return gsl_rng_alloc (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_gsl_gsl_rng_alloc=yes +else $as_nop + ac_cv_lib_gsl_gsl_rng_alloc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gsl_gsl_rng_alloc" >&5 +printf "%s\n" "$ac_cv_lib_gsl_gsl_rng_alloc" >&6; } +if test "x$ac_cv_lib_gsl_gsl_rng_alloc" = xyes +then : + printf "%s\n" "#define HAVE_LIBGSL 1" >>confdefs.h + + LIBS="-lgsl $LIBS" + +fi + + for ac_header in gsl/gsl_rng.h +do : + ac_fn_c_check_header_compile "$LINENO" "gsl/gsl_rng.h" "ac_cv_header_gsl_gsl_rng_h" "$ac_includes_default" +if test "x$ac_cv_header_gsl_gsl_rng_h" = xyes +then : + printf "%s\n" "#define HAVE_GSL_GSL_RNG_H 1" >>confdefs.h + UNURAN_SUPPORTS_GSL=-DUNURAN_SUPPORTS_GSL + + +printf "%s\n" "#define UNURAN_HAS_GSL 1" >>confdefs.h + +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? " +`echo "--with-urng-gsl given, but 'gsl/gsl_rng.h' not found" | \ + $SED 's/\(.*\)/* \1 */;h;s/./*/g;p;s/./ /g;s/./*/;s/.$/*/;p;x;p;x;p;x;s/./*/g'` + + +See \`config.log' for more details" "$LINENO" 5; } +fi + +done +fi + + + +# Check whether --with-urng_default was given. +if test ${with_urng_default+y} +then : + withval=$with_urng_default; case "${withval}" in + builtin) ;; rngstream) ;; + *) as_fn_error $? "bad value '${withval}' for --with-urng-default" "$LINENO" 5 ;; + esac +else $as_nop + with_urng_default=builtin +fi + +if test "x$with_urng_default" == xrngstream +then : + if test "x$with_urng_rngstream" == xno +then : + with_urng_default=builtin + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: +******************************************************** +* +* --with-urng-default=rngstream +* but --with-urng-rngstream=no. +* use --with-urng-default=builtin instead +* +******************************************************** + " >&5 +printf "%s\n" "$as_me: +******************************************************** +* +* --with-urng-default=rngstream +* but --with-urng-rngstream=no. +* use --with-urng-default=builtin instead +* +******************************************************** + " >&6;} +else $as_nop + +printf "%s\n" "#define UNUR_URNG_DEFAULT_RNGSTREAM 1" >>confdefs.h + +fi +fi + + + +# Check whether --with-Rmath was given. +if test ${with_Rmath+y} +then : + withval=$with_Rmath; case "${withval}" in + yes) ;; no) ;; + *) as_fn_error $? "bad value '${withval}' for --with-Rmath" "$LINENO" 5 ;; + esac +else $as_nop + with_Rmath=no +fi + +if test "x$with_Rmath" != xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for bessel_k in -lRmath" >&5 +printf %s "checking for bessel_k in -lRmath... " >&6; } +if test ${ac_cv_lib_Rmath_bessel_k+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lRmath $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char bessel_k (void); +int +main (void) +{ +return bessel_k (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_Rmath_bessel_k=yes +else $as_nop + ac_cv_lib_Rmath_bessel_k=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Rmath_bessel_k" >&5 +printf "%s\n" "$ac_cv_lib_Rmath_bessel_k" >&6; } +if test "x$ac_cv_lib_Rmath_bessel_k" = xyes +then : + printf "%s\n" "#define HAVE_LIBRMATH 1" >>confdefs.h + + LIBS="-lRmath $LIBS" + +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? " +`echo "--with-Rmath given, but 'libRmath' not found" | \ + $SED 's/\(.*\)/* \1 */;h;s/./*/g;p;s/./ /g;s/./*/;s/.$/*/;p;x;p;x;p;x;s/./*/g'` + + +See \`config.log' for more details" "$LINENO" 5; } +fi + +fi + + +ac_fn_c_check_header_compile "$LINENO" "float.h" "ac_cv_header_float_h" "$ac_includes_default" +if test "x$ac_cv_header_float_h" = xyes +then : + printf "%s\n" "#define HAVE_FLOAT_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" +if test "x$ac_cv_header_limits_h" = xyes +then : + printf "%s\n" "#define HAVE_LIMITS_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" +if test "x$ac_cv_header_stdlib_h" = xyes +then : + printf "%s\n" "#define HAVE_STDLIB_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" +if test "x$ac_cv_header_string_h" = xyes +then : + printf "%s\n" "#define HAVE_STRING_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" +if test "x$ac_cv_header_unistd_h" = xyes +then : + printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h + +fi + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +printf %s "checking for an ANSI C-conforming const... " >&6; } +if test ${ac_cv_c_const+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + +#ifndef __cplusplus + /* Ultrix mips cc rejects this sort of thing. */ + typedef int charset[2]; + const charset cs = { 0, 0 }; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* IBM XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this sort of thing. */ + char tx; + char *t = &tx; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* IBM XL C 1.02.0.0 rejects this sort of thing, saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; } bx; + struct s *b = &bx; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_const=yes +else $as_nop + ac_cv_c_const=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +printf "%s\n" "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then + +printf "%s\n" "#define const /**/" >>confdefs.h + +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +printf %s "checking for inline... " >&6; } +if test ${ac_cv_c_inline+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo (void) {return 0; } +$ac_kw foo_t foo (void) {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +printf "%s\n" "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes +then : + +else $as_nop + +printf "%s\n" "#define size_t unsigned int" >>confdefs.h + +fi + + + +ac_fn_c_check_func "$LINENO" "alarm" "ac_cv_func_alarm" +if test "x$ac_cv_func_alarm" = xyes +then : + printf "%s\n" "#define HAVE_ALARM 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "floor" "ac_cv_func_floor" +if test "x$ac_cv_func_floor" = xyes +then : + printf "%s\n" "#define HAVE_FLOOR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" +if test "x$ac_cv_func_gettimeofday" = xyes +then : + printf "%s\n" "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset" +if test "x$ac_cv_func_memset" = xyes +then : + printf "%s\n" "#define HAVE_MEMSET 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow" +if test "x$ac_cv_func_pow" = xyes +then : + printf "%s\n" "#define HAVE_POW 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sqrt" "ac_cv_func_sqrt" +if test "x$ac_cv_func_sqrt" = xyes +then : + printf "%s\n" "#define HAVE_SQRT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strcasecmp" "ac_cv_func_strcasecmp" +if test "x$ac_cv_func_strcasecmp" = xyes +then : + printf "%s\n" "#define HAVE_STRCASECMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strchr" "ac_cv_func_strchr" +if test "x$ac_cv_func_strchr" = xyes +then : + printf "%s\n" "#define HAVE_STRCHR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strtol" "ac_cv_func_strtol" +if test "x$ac_cv_func_strtol" = xyes +then : + printf "%s\n" "#define HAVE_STRTOL 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strtoul" "ac_cv_func_strtoul" +if test "x$ac_cv_func_strtoul" = xyes +then : + printf "%s\n" "#define HAVE_STRTOUL 1" >>confdefs.h + +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 +printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; } +if test ${ac_cv_c_undeclared_builtin_options+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_CFLAGS=$CFLAGS + ac_cv_c_undeclared_builtin_options='cannot detect' + for ac_arg in '' -fno-builtin; do + CFLAGS="$ac_save_CFLAGS $ac_arg" + # This test program should *not* compile successfully. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +(void) strchr; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + # This test program should compile successfully. + # No library function is consistently available on + # freestanding implementations, so test against a dummy + # declaration. Include always-available headers on the + # off chance that they somehow elicit warnings. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +extern void ac_decl (int, char *); + +int +main (void) +{ +(void) ac_decl (0, (char *) 0); + (void) ac_decl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + if test x"$ac_arg" = x +then : + ac_cv_c_undeclared_builtin_options='none needed' +else $as_nop + ac_cv_c_undeclared_builtin_options=$ac_arg +fi + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + done + CFLAGS=$ac_save_CFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 +printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; } + case $ac_cv_c_undeclared_builtin_options in #( + 'cannot detect') : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot make $CC report undeclared builtins +See \`config.log' for more details" "$LINENO" 5; } ;; #( + 'none needed') : + ac_c_undeclared_builtin_options='' ;; #( + *) : + ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;; +esac + +ac_fn_check_decl "$LINENO" "log1p" "ac_cv_have_decl_log1p" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_log1p" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_LOG1P $ac_have_decl" >>confdefs.h + +ac_fn_check_decl "$LINENO" "hypot" "ac_cv_have_decl_hypot" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_hypot" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_HYPOT $ac_have_decl" >>confdefs.h + + +ac_fn_check_decl "$LINENO" "getopt" "ac_cv_have_decl_getopt" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_getopt" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_GETOPT $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_snprintf" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_SNPRINTF $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "vsnprintf" "ac_cv_have_decl_vsnprintf" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_vsnprintf" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_VSNPRINTF $ac_have_decl" >>confdefs.h + + +ac_fn_check_decl "$LINENO" "isfinite" "ac_cv_have_decl_isfinite" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_isfinite" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_ISFINITE $ac_have_decl" >>confdefs.h + +ac_fn_check_decl "$LINENO" "isinf" "ac_cv_have_decl_isinf" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_isinf" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_ISINF $ac_have_decl" >>confdefs.h + +ac_fn_check_decl "$LINENO" "isnan" "ac_cv_have_decl_isnan" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_isnan" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_ISNAN $ac_have_decl" >>confdefs.h + +ac_fn_check_decl "$LINENO" "INFINITY" "ac_cv_have_decl_INFINITY" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_INFINITY" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_INFINITY $ac_have_decl" >>confdefs.h + +ac_fn_check_decl "$LINENO" "HUGE_VAL" "ac_cv_have_decl_HUGE_VAL" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_HUGE_VAL" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_HUGE_VAL $ac_have_decl" >>confdefs.h + +ac_fn_check_decl "$LINENO" "DBL_MAX" "ac_cv_have_decl_DBL_MAX" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_DBL_MAX" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_DBL_MAX $ac_have_decl" >>confdefs.h + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for IEEE comparisons" >&5 +printf %s "checking for IEEE comparisons... " >&6; } +if test ${ac_cv_c_ieee_comparisons+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + ac_cv_c_ieee_comparisons="yes" +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +int main (void) +{ + int status; double inf, nan; + inf = exp(1.0e10); + nan = inf / inf; + /* nan = 0.0 / 0.0; */ + status = (nan == nan); + return status; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_c_ieee_comparisons="yes" +else $as_nop + ac_cv_c_ieee_comparisons="no" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_ieee_comparisons" >&5 +printf "%s\n" "$ac_cv_c_ieee_comparisons" >&6; } +if test "$ac_cv_c_ieee_comparisons" != no ; then + +printf "%s\n" "#define HAVE_IEEE_COMPARISONS 1" >>confdefs.h + + +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for divide-by-zero" >&5 +printf %s "checking for divide-by-zero... " >&6; } +if test ${ac_cv_c_divide_by_zero+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + ac_cv_c_divide_by_zero="yes" +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +int main (void) +{ + double x = 0.0; + double inf = 1.0 / x; + int status = (inf < DBL_MAX/2.); + return status; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_c_divide_by_zero="yes" +else $as_nop + ac_cv_c_divide_by_zero="no" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_divide_by_zero" >&5 +printf "%s\n" "$ac_cv_c_divide_by_zero" >&6; } +if test "$ac_cv_c_divide_by_zero" != no ; then + +printf "%s\n" "#define HAVE_DIVIDE_BY_ZERO 1" >>confdefs.h + + +fi + + +ac_fn_check_decl "$LINENO" "alarm" "ac_cv_have_decl_alarm" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_alarm" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_ALARM $ac_have_decl" >>confdefs.h + +ac_fn_check_decl "$LINENO" "signal" "ac_cv_have_decl_signal" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_signal" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_SIGNAL $ac_have_decl" >>confdefs.h + +ac_fn_c_check_func "$LINENO" "alarm" "ac_cv_func_alarm" +if test "x$ac_cv_func_alarm" = xyes +then : + printf "%s\n" "#define HAVE_ALARM 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "signal" "ac_cv_func_signal" +if test "x$ac_cv_func_signal" = xyes +then : + printf "%s\n" "#define HAVE_SIGNAL 1" >>confdefs.h + +fi + + +# Check whether --enable-deprecated was given. +if test ${enable_deprecated+y} +then : + enableval=$enable_deprecated; +else $as_nop + enable_deprecated=no +fi + + if test x$enable_deprecated = xyes; then + ENABLE_DEPRECATED_TRUE= + ENABLE_DEPRECATED_FALSE='#' +else + ENABLE_DEPRECATED_TRUE='#' + ENABLE_DEPRECATED_FALSE= +fi + +if test "x$enable_deprecated" = xyes +then : + +printf "%s\n" "#define USE_DEPRECATED_CODE 1" >>confdefs.h + +fi + +# Check whether --enable-check-struct was given. +if test ${enable_check_struct+y} +then : + enableval=$enable_check_struct; +else $as_nop + enable_check_struct=no +fi + +if test "x$enable_check_struct" = xyes +then : + +printf "%s\n" "#define UNUR_ENABLE_CHECKNULL 1" >>confdefs.h + + +printf "%s\n" "#define UNUR_COOKIES 1" >>confdefs.h + +fi + + +# Check whether --enable-logging was given. +if test ${enable_logging+y} +then : + enableval=$enable_logging; +else $as_nop + enable_logging=no +fi + +if test "x$enable_logging" = xyes +then : + +printf "%s\n" "#define UNUR_ENABLE_LOGGING 1" >>confdefs.h + +fi + +# Check whether --enable-info was given. +if test ${enable_info+y} +then : + enableval=$enable_info; +else $as_nop + enable_info=yes +fi + +if test "x$enable_info" = xyes +then : + +printf "%s\n" "#define UNUR_ENABLE_INFO 1" >>confdefs.h + +fi + + +# Check whether --enable-experimental was given. +if test ${enable_experimental+y} +then : + enableval=$enable_experimental; +else $as_nop + enable_experimental=no +fi + +if test "x$enable_experimental" = xyes +then : + +printf "%s\n" "#define USE_EXPERIMENTAL_CODE 1" >>confdefs.h + +fi + if test x$enable_experimental = xyes; then + ENABLE_EXPERIMENTAL_TRUE= + ENABLE_EXPERIMENTAL_FALSE='#' +else + ENABLE_EXPERIMENTAL_TRUE='#' + ENABLE_EXPERIMENTAL_FALSE= +fi + + + + +# Check whether --with-mathematica was given. +if test ${with_mathematica+y} +then : + withval=$with_mathematica; case "${withval}" in + yes) mathematica=true ;; + no) mathematica=false ;; + *) as_fn_error $? "bad value '${withval}' for --with-mathematica" "$LINENO" 5 ;; + esac +else $as_nop + mathematica=false +fi + + if test x$mathematica = xtrue; then + HAVE_MATHEMATICA_TRUE= + HAVE_MATHEMATICA_FALSE='#' +else + HAVE_MATHEMATICA_TRUE='#' + HAVE_MATHEMATICA_FALSE= +fi + + +# Extract the first word of "valgrind", so it can be a program name with args. +set dummy valgrind; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_have_valgrind+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$have_valgrind"; then + ac_cv_prog_have_valgrind="$have_valgrind" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_have_valgrind="true" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_have_valgrind" && ac_cv_prog_have_valgrind="false" +fi +fi +have_valgrind=$ac_cv_prog_have_valgrind +if test -n "$have_valgrind"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_valgrind" >&5 +printf "%s\n" "$have_valgrind" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + if test x$have_valgrind = xtrue; then + HAVE_VALGRIND_TRUE= + HAVE_VALGRIND_FALSE='#' +else + HAVE_VALGRIND_TRUE='#' + HAVE_VALGRIND_FALSE= +fi + + + +EXTRA_GCC_FLAGS= +EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -Wshadow -Wstrict-prototypes" +##EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -Wdeprecated-declarations -Wbad-function-cast -Wcast-align -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wstrict-prototypes -Wwrite-strings -Wconversion" + +## the following flags raise warnings: +##EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -Wcast-qual -Wfloat-equal -Wunreachable-code" +## -Wcast-qual +## Warn whenever a pointer is cast so as to remove a type qualifier from the target type. For example, warn if a +## "const char *" is cast to an ordinary "char *". +## -Wfloat-equal +## Warn if floating point values are used in equality comparisons. +## -Wunreachable-code +## Warn if the compiler detects that code will never be executed. + +CC_FLAGS= +if test X"$GCC" = Xyes ; then + CC_FLAGS="$CC_FLAGS -Wall -Wextra $EXTRA_GCC_FLAGS" +fi + +case "${host_os}" in +linux*) + case "${CC}" in + ## Intel compiler + *icc) + ## -mp is the preferred form of -mieee-fp + CC_FLAGS="$CC_FLAGS -mp" + ;; + esac + ;; +esac + +AM_CFLAGS=$CC_FLAGS + + +case "${host}" in + *-*-mingw*) + have_mingw=yes + ;; + *) + have_mingw=no +esac + if test "$have_mingw" = "yes"; then + HAVE_MINGW_TRUE= + HAVE_MINGW_FALSE='#' +else + HAVE_MINGW_TRUE='#' + HAVE_MINGW_FALSE= +fi + + + +ac_config_files="$ac_config_files Makefile src/Makefile src/distr/Makefile src/distributions/Makefile src/methods/Makefile src/parser/Makefile src/specfunct/Makefile src/tests/Makefile src/uniform/Makefile src/urng/Makefile src/utils/Makefile scripts/Makefile doc/Makefile doc/src/Makefile doc/figures/Makefile tests/Makefile tests/testdistributions/Makefile examples/Makefile experiments/Makefile" + + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_DEPRECATED_TRUE}" && test -z "${ENABLE_DEPRECATED_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DEPRECATED\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_EXPERIMENTAL_TRUE}" && test -z "${ENABLE_EXPERIMENTAL_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_EXPERIMENTAL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_MATHEMATICA_TRUE}" && test -z "${HAVE_MATHEMATICA_FALSE}"; then + as_fn_error $? "conditional \"HAVE_MATHEMATICA\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_VALGRIND_TRUE}" && test -z "${HAVE_VALGRIND_FALSE}"; then + as_fn_error $? "conditional \"HAVE_VALGRIND\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_MINGW_TRUE}" && test -z "${HAVE_MINGW_FALSE}"; then + as_fn_error $? "conditional \"HAVE_MINGW\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by unuran $as_me 1.11.0, which was +generated by GNU Autoconf 2.71. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config='$ac_cs_config_escaped' +ac_cs_version="\\ +unuran config.status 1.11.0 +configured by $0, generated by GNU Autoconf 2.71, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2021 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + printf "%s\n" "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf "%s\n" "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + printf "%s\n" "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + printf "%s\n" "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +FILECMD='`$ECHO "$FILECMD" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +lt_ar_flags='`$ECHO "$lt_ar_flags" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' +configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' +predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' +postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' +predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' +postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' +LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' +reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' +reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' +GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' +inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' +link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' +always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' +exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' +predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' +postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' +predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' +postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in SHELL \ +ECHO \ +PATH_SEPARATOR \ +SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +FILECMD \ +OBJDUMP \ +deplibs_check_method \ +file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +DLLTOOL \ +sharedlib_from_linklib_cmd \ +AR \ +archiver_list_spec \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_import \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +lt_cv_nm_interface \ +nm_file_list_spec \ +lt_cv_truncate_bin \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ +lt_prog_compiler_wl \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +MANIFEST_TOOL \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_separator \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +install_override_mode \ +finish_eval \ +old_striplib \ +striplib \ +compiler_lib_search_dirs \ +predep_objects \ +postdep_objects \ +predeps \ +postdeps \ +compiler_lib_search_path \ +LD_CXX \ +reload_flag_CXX \ +compiler_CXX \ +lt_prog_compiler_no_builtin_flag_CXX \ +lt_prog_compiler_pic_CXX \ +lt_prog_compiler_wl_CXX \ +lt_prog_compiler_static_CXX \ +lt_cv_prog_compiler_c_o_CXX \ +export_dynamic_flag_spec_CXX \ +whole_archive_flag_spec_CXX \ +compiler_needs_object_CXX \ +with_gnu_ld_CXX \ +allow_undefined_flag_CXX \ +no_undefined_flag_CXX \ +hardcode_libdir_flag_spec_CXX \ +hardcode_libdir_separator_CXX \ +exclude_expsyms_CXX \ +include_expsyms_CXX \ +file_list_spec_CXX \ +compiler_lib_search_dirs_CXX \ +predep_objects_CXX \ +postdep_objects_CXX \ +predeps_CXX \ +postdeps_CXX \ +compiler_lib_search_path_CXX; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postlink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +configure_time_dlsearch_path \ +configure_time_lt_sys_library_path \ +reload_cmds_CXX \ +old_archive_cmds_CXX \ +old_archive_from_new_cmds_CXX \ +old_archive_from_expsyms_cmds_CXX \ +archive_cmds_CXX \ +archive_expsym_cmds_CXX \ +module_cmds_CXX \ +module_expsym_cmds_CXX \ +export_symbols_cmds_CXX \ +prelink_cmds_CXX \ +postlink_cmds_CXX; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +ac_aux_dir='$ac_aux_dir' + +# See if we are running on zsh, and set the options that allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + RM='$RM' + ofile='$ofile' + + + + + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "src/distr/Makefile") CONFIG_FILES="$CONFIG_FILES src/distr/Makefile" ;; + "src/distributions/Makefile") CONFIG_FILES="$CONFIG_FILES src/distributions/Makefile" ;; + "src/methods/Makefile") CONFIG_FILES="$CONFIG_FILES src/methods/Makefile" ;; + "src/parser/Makefile") CONFIG_FILES="$CONFIG_FILES src/parser/Makefile" ;; + "src/specfunct/Makefile") CONFIG_FILES="$CONFIG_FILES src/specfunct/Makefile" ;; + "src/tests/Makefile") CONFIG_FILES="$CONFIG_FILES src/tests/Makefile" ;; + "src/uniform/Makefile") CONFIG_FILES="$CONFIG_FILES src/uniform/Makefile" ;; + "src/urng/Makefile") CONFIG_FILES="$CONFIG_FILES src/urng/Makefile" ;; + "src/utils/Makefile") CONFIG_FILES="$CONFIG_FILES src/utils/Makefile" ;; + "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;; + "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "doc/src/Makefile") CONFIG_FILES="$CONFIG_FILES doc/src/Makefile" ;; + "doc/figures/Makefile") CONFIG_FILES="$CONFIG_FILES doc/figures/Makefile" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; + "tests/testdistributions/Makefile") CONFIG_FILES="$CONFIG_FILES tests/testdistributions/Makefile" ;; + "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; + "experiments/Makefile") CONFIG_FILES="$CONFIG_FILES experiments/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf "%s\n" "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$am_mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? + done + if test $am_rc -ne 0; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk +} + ;; + "libtool":C) + + # See if we are running on zsh, and set the options that allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST + fi + + cfgfile=${ofile}T + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL +# Generated automatically by $as_me ($PACKAGE) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + +# Copyright (C) 2014 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program or library that is built +# using GNU Libtool, you may include this file under the same +# distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +# The names of the tagged configurations supported by this script. +available_tags='CXX ' + +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# Shared archive member basename,for filename based shared library versioning on AIX. +shared_archive_member_spec=$shared_archive_member_spec + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The PATH separator for the build system. +PATH_SEPARATOR=$lt_PATH_SEPARATOR + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd + +# A file(cmd) program that detects file types. +FILECMD=$lt_FILECMD + +# An object symbol dumper. +OBJDUMP=$lt_OBJDUMP + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method = "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + +# The archiver. +AR=$lt_AR + +# Flags to create an archive (by configure). +lt_ar_flags=$lt_ar_flags + +# Flags to create an archive. +AR_FLAGS=\${ARFLAGS-"\$lt_ar_flags"} + +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm into a list of symbols to manually relocate. +global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# The name lister interface. +nm_interface=$lt_lt_cv_nm_interface + +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and where our libraries should be installed. +lt_sysroot=$lt_sysroot + +# Command to truncate a binary pipe. +lt_truncate_bin=$lt_lt_cv_truncate_bin + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Detected run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path + +# Explicit LT_SYS_LIBRARY_PATH set during ./configure time. +configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \$shlibpath_var if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects +postdep_objects=$lt_postdep_objects +predeps=$lt_predeps +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + +# ### END LIBTOOL CONFIG + +_LT_EOF + + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + + +ltmain=$ac_aux_dir/ltmain.sh + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + $SED '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + + cat <<_LT_EOF >> "$ofile" + +# ### BEGIN LIBTOOL TAG CONFIG: CXX + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# How to create reloadable object files. +reload_flag=$lt_reload_flag_CXX +reload_cmds=$lt_reload_cmds_CXX + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds_CXX + +# A language specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU compiler? +with_gcc=$GCC_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object_CXX + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld_CXX + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \$shlibpath_var if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute_CXX + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath_CXX + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds_CXX + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds_CXX + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec_CXX + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects_CXX +postdep_objects=$lt_postdep_objects_CXX +predeps=$lt_predeps_CXX +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# ### END LIBTOOL TAG CONFIG: CXX +_LT_EOF + + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: +*======================================================== +* +* Configuration for ${PACKAGE}-${VERSION}: +* +* Source directory: ${srcdir} +* Installation directory: ${prefix} +* C Compiler: ${CC} +* +* Build shared library: ${enable_shared} +* Build static library: ${enable_static} +* +* Use deprecated code: ${enable_deprecated} +* Enable runtime checks: ${enable_check_struct} +* Enable logging of data: ${enable_logging} +* Enable info routine: ${enable_info} +* Experimenal code: ${enable_experimental} +* Use Rmath library: ${with_Rmath} +* +* Support for external uniform random number generators +* Rngstream: ${with_urng_rngstream} +* PRNG: ${with_urng_prng} +* GSL: ${with_urng_gsl} +* +* Default URNG: ${with_urng_default} +* +*======================================================== +" >&5 +printf "%s\n" " +*======================================================== +* +* Configuration for ${PACKAGE}-${VERSION}: +* +* Source directory: ${srcdir} +* Installation directory: ${prefix} +* C Compiler: ${CC} +* +* Build shared library: ${enable_shared} +* Build static library: ${enable_static} +* +* Use deprecated code: ${enable_deprecated} +* Enable runtime checks: ${enable_check_struct} +* Enable logging of data: ${enable_logging} +* Enable info routine: ${enable_info} +* Experimenal code: ${enable_experimental} +* Use Rmath library: ${with_Rmath} +* +* Support for external uniform random number generators +* Rngstream: ${with_urng_rngstream} +* PRNG: ${with_urng_prng} +* GSL: ${with_urng_gsl} +* +* Default URNG: ${with_urng_default} +* +*======================================================== +" >&6; } + + diff --git a/vendor/unuran-1.11.0/configure.ac b/vendor/unuran-1.11.0/configure.ac new file mode 100644 index 0000000..36cdbad --- /dev/null +++ b/vendor/unuran-1.11.0/configure.ac @@ -0,0 +1,357 @@ +dnl Process this file with autoconf to produce a configure script. + +dnl Initialize. +AC_PREREQ([2.71]) +AC_INIT([unuran],[1.11.0],[unuran@statmath.wu.ac.at]) +AC_CONFIG_AUX_DIR(autoconf) +AC_CONFIG_SRCDIR([src/unuran_config.h]) +AC_CONFIG_HEADERS([config.h]) +AM_INIT_AUTOMAKE([-Wall -Wno-extra-portability foreign]) + +dnl Library versioning (current:revision:age) +dnl See the libtool manual for an explanation of the numbers +dnl +dnl unuran-0.4.0 0:0:0 +dnl unuran-0.4.2 1:1:0 +dnl unuran-0.4.4 1:2:0 +dnl unuran-0.5.0 2:0:0 +dnl unuran-0.6.0 3:0:0 +dnl unuran-0.7.0 4:0:0 +dnl unuran-0.7.1 4:1:0 +dnl unuran-0.7.2 4:2:0 +dnl unuran-0.8.1 5:0:0 +dnl unuran-0.9.0 6:0:0 +dnl unuran-1.0.0 7:0:0 +dnl unuran-1.0.1 7:1:0 +dnl unuran-1.1.0 8:0:1 +dnl unuran-1.2.0 9:0:0 +dnl unuran-1.2.1 9:1:0 +dnl unuran-1.2.2 9:2:0 +dnl unuran-1.2.3 9:3:2 +dnl unuran-1.2.4 9:4:2 +dnl unuran-1.3.0 10:0:0 +dnl unuran-1.3.1 10:0:0 +dnl unuran-1.4.0 11:0:1 +dnl unuran-1.4.1 11:1:1 +dnl unuran-1.5.0 12:0:0 +dnl unuran-1.6.0 13:0:0 +dnl unuran-1.7.0 14:0:0 +dnl unuran-1.8.0 15:0:0 +dnl unuran-1.8.1 15:0:0 +dnl unuran-1.9.0 16:0:0 +dnl unuran-1.10.0 16:1:0 +dnl unuran-1.11.0 17:0:0 + +UNURAN_LT_VERSION="16:1:0" +AC_SUBST([UNURAN_LT_VERSION]) + +dnl use maintainer mode +AM_MAINTAINER_MODE + +dnl Check for which system. +AC_CANONICAL_HOST + +dnl Checks for programs. +AC_PROG_MAKE_SET +AC_PROG_CC +AC_PROG_CXX +AC_PROG_CPP +AC_PROG_RANLIB +AC_PROG_INSTALL +AC_PROG_LN_S +AC_CHECK_TOOL(AR, ar, :) +LT_INIT([disable-shared]) + +dnl Checks for libraries. +dnl libm: the standard math library +AC_CHECK_LIB([m], [sqrt]) + +dnl libgsl: the GNU Scientific library +dnl (used for experimental code or +dnl when the GSL uniform random number generators are used, see below) +AC_CHECK_LIB([gslcblas],[cblas_dgemm]) +AC_CHECK_LIB([gsl],[gsl_blas_dgemm]) + + +dnl Optional support for external uniform random number generators + +dnl RngStream: Pierre L'Ecuyer's multiple random stream generator +AX_ADD_URNG_LIB([rngstream],[RNGSTREAM],[Pierre L'Ecuyer's RNGSTREAM library], + [rngstreams],[RngStream_CreateStream],[RngStream.h]) + +dnl prng: Otmar Lendl's library for pseudo random number generators +AX_ADD_URNG_LIB([prng],[PRNG],[Otmar Lendl's PRNG library], + [prng],[prng_new],[prng.h]) + +dnl GSL: GNU Scientific Library +AX_ADD_URNG_LIB([gsl],[GSL],[random number generators from GNU Scientific Library], + [gsl],[gsl_rng_alloc],[gsl/gsl_rng.h]) + +dnl Default URNG +AC_ARG_WITH(urng_default, + [AS_HELP_STRING([--with-urng-default], + [URNG: global default (builtin|rngstream) @<:@default=builtin@:>@])], + [case "${withval}" in + builtin) ;; rngstream) ;; + *) AC_MSG_ERROR(bad value '${withval}' for --with-urng-default) ;; + esac], + [with_urng_default=builtin]) +AS_IF([test "x$with_urng_default" == xrngstream], + AS_IF([test "x$with_urng_rngstream" == xno], + [with_urng_default=builtin + AC_MSG_NOTICE([ +******************************************************** +* +* --with-urng-default=rngstream +* but --with-urng-rngstream=no. +* use --with-urng-default=builtin instead +* +******************************************************** + ]) ], + [AC_DEFINE([UNUR_URNG_DEFAULT_RNGSTREAM], [1], + [Define to 1 if you use RNGSTREAM as global URNG.])]), + []) + +dnl Optional support for Rmath standalone library +AX_ADD_RMATH() + +dnl Checks for header files. +AC_CHECK_HEADERS([float.h limits.h stdlib.h string.h unistd.h]) +AC_CHECK_HEADERS_ONCE([sys/time.h]) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_INLINE +AC_TYPE_SIZE_T + + +dnl Checks for library functions. +AC_CHECK_FUNCS([alarm floor gettimeofday memset pow sqrt strcasecmp strchr strtol strtoul]) + +dnl For the following function replacements exist +AC_CHECK_DECLS(log1p,,,[#include ]) +AC_CHECK_DECLS(hypot,,,[#include ]) + +dnl Checks for GNU extensions +AC_CHECK_DECLS([getopt, snprintf, vsnprintf]) + +dnl Check for C99 functions */ +AC_CHECK_DECLS(isfinite,,,[#include ]) +AC_CHECK_DECLS(isinf,,,[#include ]) +AC_CHECK_DECLS(isnan,,,[#include ]) +AC_CHECK_DECLS(INFINITY,,,[#include ]) +AC_CHECK_DECLS(HUGE_VAL,,,[#include ]) +AC_CHECK_DECLS(DBL_MAX,,,[#include ]) + +dnl Check IEEE comparisons, whether "x != x" is true for NaNs +AX_IEEE_COMP +dnl Check whether 1./0. works and results in "infinity" +AX_DIVIDE_BY_ZERO + +dnl Check for alarm and signal handler +AC_CHECK_DECLS(alarm,,,[#include ]) +AC_CHECK_DECLS(signal,,,[#include ]) +AC_CHECK_FUNCS([alarm signal]) + +dnl Some routines are deprecated. +dnl Compiling and linking these into the library can be controlled +dnl by a configure flag. +dnl Default is disabled. +AC_ARG_ENABLE(deprecated, + [AS_HELP_STRING([--enable-deprecated], + [enable support for deprecated UNU.RAN routines @<:@default=no@:>@])], + [], + [enable_deprecated=no]) +AM_CONDITIONAL(ENABLE_DEPRECATED, test x$enable_deprecated = xyes) +AS_IF([test "x$enable_deprecated" = xyes], + [AC_DEFINE([USE_DEPRECATED_CODE], [1], + [Define to 1 if you want to use deprecated code.])], + []) + +dnl UNU.RAN has additional checks against invalid NULL pointers or +dnl pointers to wrong structures. For the latter cookies are inserted +dnl into structures and checked whenever such structure is accessed. +dnl Both checks can be enabled by the '--enable-check-struct' flag. +dnl Default is disabled. +AC_ARG_ENABLE(check-struct, + [AS_HELP_STRING([--enable-check-struct], + [Debug: check validity of pointers to structures @<:@default=no@:>@])], + [], + [enable_check_struct=no]) +AS_IF([test "x$enable_check_struct" = xyes], + [AC_DEFINE([UNUR_ENABLE_CHECKNULL], [1], + [Define to 1 if you want to perform additional checks against an invalid NULL pointer]) + AC_DEFINE([UNUR_COOKIES], [1], + [Define to 1 if you want to use magic cookies to validate type of a pointer])], + []) + + +dnl UNU.RAN allows to write information about distribution and a log file. +dnl The default name of the logfile is set in 'src/unuran_config.h'. +dnl The logfile is enabled by the '--enable-logging' flag. +AC_ARG_ENABLE(logging, + [AS_HELP_STRING([--enable-logging], + [Debug: print informations about generator into logfile @<:@default=no@:>@])], + [], + [enable_logging=no]) +AS_IF([test "x$enable_logging" = xyes], + [AC_DEFINE([UNUR_ENABLE_LOGGING], [1], + [Define to 1 if you want to use a logfile for logging informations about UNU.RAN objects])], + []) + +dnl UNU.RAN provides a function that returns a string with some information +dnl about a given generator object. +dnl This function is enabled by the '--enable-info' flag. +AC_ARG_ENABLE(info, + [AS_HELP_STRING([--enable-info], + [Info: provide function with information about generator objects @<:@default=yes@:>@])], + [], + [enable_info=yes]) +AS_IF([test "x$enable_info" = xyes], + [AC_DEFINE([UNUR_ENABLE_INFO], [1], + [Define to 1 if you want to use the info routine for printing informations about UNU.RAN objects])], + []) + + +dnl UNU.RAN contains some experimental code that can be enabled +dnl by means of the '--enable-experimental' flag. +AC_ARG_ENABLE(experimental, + [AS_HELP_STRING([--enable-experimental], + [Experimental code (not documented) @<:@default=no@:>@])], + [], + [enable_experimental=no]) +AS_IF([test "x$enable_experimental" = xyes], + [AC_DEFINE([USE_EXPERIMENTAL_CODE], [1], + [Define to 1 if you want to use experimental code])], + []) +AM_CONDITIONAL(ENABLE_EXPERIMENTAL, test x$enable_experimental = xyes) + + +dnl Some tests compare the return values of PDFs, CDFs and of +dnl the function parser with the output of corresponding +dnl Mathematica(R) scripts. +dnl Thus for these tests we need Mathematica(R). +dnl However, simply checking for the existance of programm 'math' +dnl breaks the configure script when 'math' is available but +dnl ask for a password. +dnl Hence these tests are enabled by means of a configure option. +AC_ARG_WITH(mathematica, + [AS_HELP_STRING([--with-mathematica], + [Use Mathematica(R) for some checks @<:@default=no@:>@])], + [case "${withval}" in + yes) mathematica=true ;; + no) mathematica=false ;; + *) AC_MSG_ERROR(bad value '${withval}' for --with-mathematica) ;; + esac], + [mathematica=false]) +AM_CONDITIONAL(HAVE_MATHEMATICA, test x$mathematica = xtrue) + +dnl check for Valgrind +dnl (Valgrind is a GPL'd system for debugging and profiling x86-Linux programs) +AC_CHECK_PROG(have_valgrind,valgrind,true,false) +AM_CONDITIONAL(HAVE_VALGRIND, test x$have_valgrind = xtrue) + +dnl Set flags for compiler + +dnl GCC +EXTRA_GCC_FLAGS= +EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -Wshadow -Wstrict-prototypes" +##EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -Wdeprecated-declarations -Wbad-function-cast -Wcast-align -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wstrict-prototypes -Wwrite-strings -Wconversion" + +## the following flags raise warnings: +##EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -Wcast-qual -Wfloat-equal -Wunreachable-code" +## -Wcast-qual +## Warn whenever a pointer is cast so as to remove a type qualifier from the target type. For example, warn if a +## "const char *" is cast to an ordinary "char *". +## -Wfloat-equal +## Warn if floating point values are used in equality comparisons. +## -Wunreachable-code +## Warn if the compiler detects that code will never be executed. + +CC_FLAGS= +if test X"$GCC" = Xyes ; then + CC_FLAGS="$CC_FLAGS -Wall -Wextra $EXTRA_GCC_FLAGS" +fi + +case "${host_os}" in +linux*) + case "${CC}" in + ## Intel compiler + *icc) + ## -mp is the preferred form of -mieee-fp + CC_FLAGS="$CC_FLAGS -mp" + ;; + esac + ;; +esac + +AC_SUBST(AM_CFLAGS,[$CC_FLAGS]) + +dnl MinGW (Win32) +case "${host}" in + *-*-mingw*) + have_mingw=yes + ;; + *) + have_mingw=no +esac +AM_CONDITIONAL(HAVE_MINGW, test "$have_mingw" = "yes") + + +dnl create Makefiles for source +AC_CONFIG_FILES([\ + Makefile \ + src/Makefile \ + src/distr/Makefile \ + src/distributions/Makefile \ + src/methods/Makefile \ + src/parser/Makefile \ + src/specfunct/Makefile \ + src/tests/Makefile \ + src/uniform/Makefile \ + src/urng/Makefile \ + src/utils/Makefile \ + scripts/Makefile \ + doc/Makefile \ + doc/src/Makefile \ + doc/figures/Makefile \ + tests/Makefile \ + tests/testdistributions/Makefile \ + examples/Makefile \ + experiments/Makefile \ +]) + +AC_OUTPUT + +dnl ----------------------------------------- + +AC_MSG_RESULT([ +*======================================================== +* +* Configuration for ${PACKAGE}-${VERSION}: +* +* Source directory: ${srcdir} +* Installation directory: ${prefix} +* C Compiler: ${CC} +* +* Build shared library: ${enable_shared} +* Build static library: ${enable_static} +* +* Use deprecated code: ${enable_deprecated} +* Enable runtime checks: ${enable_check_struct} +* Enable logging of data: ${enable_logging} +* Enable info routine: ${enable_info} +* Experimenal code: ${enable_experimental} +* Use Rmath library: ${with_Rmath} +* +* Support for external uniform random number generators +* Rngstream: ${with_urng_rngstream} +* PRNG: ${with_urng_prng} +* GSL: ${with_urng_gsl} +* +* Default URNG: ${with_urng_default} +* +*======================================================== +]) + +dnl ----------------------------------------- diff --git a/vendor/unuran-1.11.0/doc/Makefile b/vendor/unuran-1.11.0/doc/Makefile new file mode 100644 index 0000000..6d80927 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/Makefile @@ -0,0 +1,1138 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# doc/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/unuran +pkgincludedir = $(includedir)/unuran +pkglibdir = $(libdir)/unuran +pkglibexecdir = $(libexecdir)/unuran +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +subdir = doc +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/version.texi \ + $(srcdir)/stamp-vti $(srcdir)/version_win32.texi \ + $(srcdir)/stamp-1 $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +AM_V_DVIPS = $(am__v_DVIPS_$(V)) +am__v_DVIPS_ = $(am__v_DVIPS_$(AM_DEFAULT_VERBOSITY)) +am__v_DVIPS_0 = @echo " DVIPS " $@; +am__v_DVIPS_1 = +AM_V_MAKEINFO = $(am__v_MAKEINFO_$(V)) +am__v_MAKEINFO_ = $(am__v_MAKEINFO_$(AM_DEFAULT_VERBOSITY)) +am__v_MAKEINFO_0 = @echo " MAKEINFO" $@; +am__v_MAKEINFO_1 = +AM_V_INFOHTML = $(am__v_INFOHTML_$(V)) +am__v_INFOHTML_ = $(am__v_INFOHTML_$(AM_DEFAULT_VERBOSITY)) +am__v_INFOHTML_0 = @echo " INFOHTML" $@; +am__v_INFOHTML_1 = +AM_V_TEXI2DVI = $(am__v_TEXI2DVI_$(V)) +am__v_TEXI2DVI_ = $(am__v_TEXI2DVI_$(AM_DEFAULT_VERBOSITY)) +am__v_TEXI2DVI_0 = @echo " TEXI2DVI" $@; +am__v_TEXI2DVI_1 = +AM_V_TEXI2PDF = $(am__v_TEXI2PDF_$(V)) +am__v_TEXI2PDF_ = $(am__v_TEXI2PDF_$(AM_DEFAULT_VERBOSITY)) +am__v_TEXI2PDF_0 = @echo " TEXI2PDF" $@; +am__v_TEXI2PDF_1 = +AM_V_texinfo = $(am__v_texinfo_$(V)) +am__v_texinfo_ = $(am__v_texinfo_$(AM_DEFAULT_VERBOSITY)) +am__v_texinfo_0 = -q +am__v_texinfo_1 = +AM_V_texidevnull = $(am__v_texidevnull_$(V)) +am__v_texidevnull_ = $(am__v_texidevnull_$(AM_DEFAULT_VERBOSITY)) +am__v_texidevnull_0 = > /dev/null +am__v_texidevnull_1 = +INFO_DEPS = $(srcdir)/unuran.info $(srcdir)/unuran_win32.info +am__TEXINFO_TEX_DIR = $(srcdir)/./src +DVIS = unuran.dvi unuran_win32.dvi +PDFS = unuran.pdf unuran_win32.pdf +PSS = unuran.ps unuran_win32.ps +HTMLS = unuran.html unuran_win32.html +TEXINFOS = unuran.texi unuran_win32.texi +TEXI2DVI = texi2dvi +TEXI2PDF = $(TEXI2DVI) --pdf --batch +MAKEINFOHTML = $(MAKEINFO) --html +DVIPS = dvips +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__installdirs = "$(DESTDIR)$(infodir)" +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +DATA = $(noinst_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in \ + $(top_srcdir)/autoconf/mdate-sh $(unuran_TEXINFOS) \ + $(unuran_win32_TEXINFOS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_CFLAGS = -Wall -Wextra -Wshadow -Wstrict-prototypes +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf +AUTOHEADER = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader +AUTOMAKE = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -fPIC +CPP = gcc -E +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +FILECMD = file +GREP = /usr/bin/grep +HAVE_DIVIDE_BY_ZERO = +HAVE_IEEE_COMPARISONS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAINT = # +MAKEINFO = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = unuran +PACKAGE_BUGREPORT = unuran@statmath.wu.ac.at +PACKAGE_NAME = unuran +PACKAGE_STRING = unuran 1.11.0 +PACKAGE_TARNAME = unuran +PACKAGE_URL = +PACKAGE_VERSION = 1.11.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +UNURAN_LT_VERSION = 16:1:0 +UNURAN_SUPPORTS_GSL = +UNURAN_SUPPORTS_PRNG = +UNURAN_SUPPORTS_RNGSTREAM = +VERSION = 1.11.0 +abs_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/doc +abs_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/doc +abs_top_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +have_valgrind = false +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../ +top_builddir = .. +top_srcdir = .. +SUBDIRS = src figures . +info_TEXINFOS = unuran.texi unuran_win32.texi + +# Location of same source files +TEXINFO_TEX = ./src/texinfo.tex +AM_MAKEINFOFLAGS = \ + -I $(top_srcdir)/doc \ + -I $(top_srcdir)/doc/src \ + --no-split + +AM_MAKEINFOHTMLFLAGS = \ + -I $(top_srcdir)/doc \ + -I $(top_srcdir)/doc/src \ + --css-include=$(top_srcdir)/doc/src/unuran.css \ + --no-split + + +# Automatically created part of manual +unuran_src = ./src/unuran_src.texi + +# Files with examples. +# These example files are generated from the corresponding +# files $(top_srcdir)/examples/example*.c +unuran_examples = \ + ./src/ref_example0.texi ./src/ref_example0_str.texi \ + ./src/ref_example1.texi ./src/ref_example1_str.texi \ + ./src/ref_example2.texi ./src/ref_example2_str.texi \ + ./src/ref_example3.texi ./src/ref_example3_str.texi \ + ./src/ref_example_reinit.texi \ + ./src/ref_example_gsl.texi \ + ./src/ref_example_rngstreams.texi \ + ./src/ref_example_anti.texi ./src/ref_example_anti_str.texi \ + ./src/ref_example_cext.texi \ + ./src/ref_example_cont.texi ./src/ref_example_cont_str.texi \ + ./src/ref_example_dext.texi \ + ./src/ref_example_discr.texi ./src/ref_example_discr_str.texi \ + ./src/ref_example_emp.texi ./src/ref_example_emp_str.texi \ + ./src/ref_example_vemp.texi ./src/ref_example_FuncStr.texi \ + ./src/ref_example_mixt.texi ./src/ref_example_mixt_inv.texi + + +# Sources for UNU.RAN manual +unuran_TEXINFOS = \ + unuran.texi \ + ./src/methods_cont.texi \ + ./src/methods_discr.texi \ + ./src/methods_cemp.texi \ + ./src/methods_cvec.texi \ + ./src/methods_mcmc.texi \ + ./src/methods_cvemp.texi \ + ./src/methods_matr.texi \ + $(unuran_src) \ + $(unuran_examples) \ + $(top_srcdir)/doc/figures/*.eps \ + $(top_srcdir)/doc/figures/*.pdf \ + $(top_srcdir)/doc/figures/*.png \ + $(top_srcdir)/doc/figures/*.txt + + +# Sources for (short) Win32 manual + +# Files with examples. +# These example files are generated from the corresponding +# files $(top_srcdir)/scripts/win32/example?.c +unuran_win32_examples = \ + ./src/ref_example_win32_1.texi \ + ./src/ref_example_win32_2.texi + +unuran_win32_TEXINFOS = \ + unuran_win32.texi \ + unuran_win32_libname.texi \ + $(unuran_win32_examples) + +noinst_DATA = +EXTRA_DIST = \ + unuran.html \ + unuran.txt \ + unuran.pdf \ + unuran_win32.html \ + unuran_win32.pdf + + +# Clean backup and temp files +CLEANFILES = \ + *~ + + +# Clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in \ + mdate-sh \ + $(unuran_src) \ + $(unuran_examples) \ + $(unuran_win32_examples) \ + unuran_win32_libname.texi \ + unuran.txt \ + \ + $(top_srcdir)/aclocal.m4 \ + $(top_srcdir)/config.h.in \ + $(top_srcdir)/configure + +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .dvi .html .info .pdf .ps .texi +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign doc/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +.texi.info: + $(AM_V_MAKEINFO)restore=: && backupdir="$(am__leading_dot)am$$$$" && \ + am__cwd=`pwd` && $(am__cd) $(srcdir) && \ + rm -rf $$backupdir && mkdir $$backupdir && \ + if ($(MAKEINFO) --version) >/dev/null 2>&1; then \ + for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ + if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ + done; \ + else :; fi && \ + cd "$$am__cwd"; \ + if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $@ $<; \ + then \ + rc=0; \ + $(am__cd) $(srcdir); \ + else \ + rc=$$?; \ + $(am__cd) $(srcdir) && \ + $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ + fi; \ + rm -rf $$backupdir; exit $$rc + +.texi.dvi: + $(AM_V_TEXI2DVI)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2DVI) $(AM_V_texinfo) --build-dir=$(@:.dvi=.t2d) -o $@ $(AM_V_texidevnull) \ + $< + +.texi.pdf: + $(AM_V_TEXI2PDF)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2PDF) $(AM_V_texinfo) --build-dir=$(@:.pdf=.t2p) -o $@ $(AM_V_texidevnull) \ + $< + +.texi.html: + $(AM_V_MAKEINFO)rm -rf $(@:.html=.htp) + $(AM_V_at)if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $(@:.html=.htp) $<; \ + then \ + rm -rf $@ && mv $(@:.html=.htp) $@; \ + else \ + rm -rf $(@:.html=.htp); exit 1; \ + fi +$(srcdir)/unuran.info: unuran.texi $(srcdir)/version.texi $(unuran_TEXINFOS) +unuran.dvi: unuran.texi $(srcdir)/version.texi $(unuran_TEXINFOS) +unuran.pdf: unuran.texi $(srcdir)/version.texi $(unuran_TEXINFOS) +unuran.html: unuran.texi $(srcdir)/version.texi $(unuran_TEXINFOS) +$(srcdir)/version.texi: # $(srcdir)/stamp-vti +$(srcdir)/stamp-vti: unuran.texi $(top_srcdir)/configure + @(dir=.; test -f ./unuran.texi || dir=$(srcdir); \ + set `$(SHELL) $(top_srcdir)/autoconf/mdate-sh $$dir/unuran.texi`; \ + echo "@set UPDATED $$1 $$2 $$3"; \ + echo "@set UPDATED-MONTH $$2 $$3"; \ + echo "@set EDITION $(VERSION)"; \ + echo "@set VERSION $(VERSION)") > vti.tmp$$$$ && \ + (cmp -s vti.tmp$$$$ $(srcdir)/version.texi \ + || (echo "Updating $(srcdir)/version.texi" && \ + cp vti.tmp$$$$ $(srcdir)/version.texi.tmp$$$$ && \ + mv $(srcdir)/version.texi.tmp$$$$ $(srcdir)/version.texi)) && \ + rm -f vti.tmp$$$$ $(srcdir)/version.texi.$$$$ + @cp $(srcdir)/version.texi $@ + +mostlyclean-vti: + -rm -f vti.tmp* $(srcdir)/version.texi.tmp* + +maintainer-clean-vti: +# -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi +$(srcdir)/unuran_win32.info: unuran_win32.texi $(srcdir)/version_win32.texi $(unuran_win32_TEXINFOS) +unuran_win32.dvi: unuran_win32.texi $(srcdir)/version_win32.texi $(unuran_win32_TEXINFOS) +unuran_win32.pdf: unuran_win32.texi $(srcdir)/version_win32.texi $(unuran_win32_TEXINFOS) +unuran_win32.html: unuran_win32.texi $(srcdir)/version_win32.texi $(unuran_win32_TEXINFOS) +$(srcdir)/version_win32.texi: # $(srcdir)/stamp-1 +$(srcdir)/stamp-1: unuran_win32.texi $(top_srcdir)/configure + @(dir=.; test -f ./unuran_win32.texi || dir=$(srcdir); \ + set `$(SHELL) $(top_srcdir)/autoconf/mdate-sh $$dir/unuran_win32.texi`; \ + echo "@set UPDATED $$1 $$2 $$3"; \ + echo "@set UPDATED-MONTH $$2 $$3"; \ + echo "@set EDITION $(VERSION)"; \ + echo "@set VERSION $(VERSION)") > 1.tmp$$$$ && \ + (cmp -s 1.tmp$$$$ $(srcdir)/version_win32.texi \ + || (echo "Updating $(srcdir)/version_win32.texi" && \ + cp 1.tmp$$$$ $(srcdir)/version_win32.texi.tmp$$$$ && \ + mv $(srcdir)/version_win32.texi.tmp$$$$ $(srcdir)/version_win32.texi)) && \ + rm -f 1.tmp$$$$ $(srcdir)/version_win32.texi.$$$$ + @cp $(srcdir)/version_win32.texi $@ + +mostlyclean-1: + -rm -f 1.tmp* $(srcdir)/version_win32.texi.tmp* + +maintainer-clean-1: +# -rm -f $(srcdir)/stamp-1 $(srcdir)/version_win32.texi +.dvi.ps: + $(AM_V_DVIPS)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + $(DVIPS) $(AM_V_texinfo) -o $@ $< + +uninstall-dvi-am: + @$(NORMAL_UNINSTALL) + @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \ + rm -f "$(DESTDIR)$(dvidir)/$$f"; \ + done + +uninstall-html-am: + @$(NORMAL_UNINSTALL) + @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \ + rm -rf "$(DESTDIR)$(htmldir)/$$f"; \ + done + +uninstall-info-am: + @$(PRE_UNINSTALL) + @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ + if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ + then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \ + done; \ + else :; fi + @$(NORMAL_UNINSTALL) + @list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ + (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \ + echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ + rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ + else :; fi); \ + done + +uninstall-pdf-am: + @$(NORMAL_UNINSTALL) + @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pdfdir)/$$f"; \ + done + +uninstall-ps-am: + @$(NORMAL_UNINSTALL) + @list='$(PSS)'; test -n "$(psdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \ + rm -f "$(DESTDIR)$(psdir)/$$f"; \ + done + +dist-info: $(INFO_DEPS) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; \ + for base in $$list; do \ + case $$base in \ + $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$base; then d=.; else d=$(srcdir); fi; \ + base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \ + for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \ + if test -f $$file; then \ + relfile=`expr "$$file" : "$$d/\(.*\)"`; \ + test -f "$(distdir)/$$relfile" || \ + cp -p $$file "$(distdir)/$$relfile"; \ + else :; fi; \ + done; \ + done + +mostlyclean-aminfo: + -rm -rf unuran.t2d unuran.t2p unuran_win32.t2d unuran_win32.t2p + +clean-aminfo: + -test -z "unuran.dvi unuran.pdf unuran.ps unuran.html unuran_win32.dvi \ + unuran_win32.pdf unuran_win32.ps unuran_win32.html" \ + || rm -rf unuran.dvi unuran.pdf unuran.ps unuran.html unuran_win32.dvi \ + unuran_win32.pdf unuran_win32.ps unuran_win32.html + +maintainer-clean-aminfo: + @list='$(INFO_DEPS)'; for i in $$list; do \ + i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ + echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ + rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-info +check-am: all-am +check: check-recursive +all-am: Makefile $(INFO_DEPS) $(DATA) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(infodir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-aminfo clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: $(DVIS) + +html: html-recursive + +html-am: $(HTMLS) + +info: info-recursive + +info-am: $(INFO_DEPS) + +install-data-am: install-info-am + +install-dvi: install-dvi-recursive + +install-dvi-am: $(DVIS) + @$(NORMAL_INSTALL) + @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \ + done +install-exec-am: + +install-html: install-html-recursive + +install-html-am: $(HTMLS) + @$(NORMAL_INSTALL) + @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ + $(am__strip_dir) \ + d2=$$d$$p; \ + if test -d "$$d2"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \ + else \ + list2="$$list2 $$d2"; \ + fi; \ + done; \ + test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \ + done; } +install-info: install-info-recursive + +install-info-am: $(INFO_DEPS) + @$(NORMAL_INSTALL) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \ + fi; \ + for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ + for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ + $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ + if test -f $$ifile; then \ + echo "$$ifile"; \ + else : ; fi; \ + done; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done + @$(POST_INSTALL) + @if $(am__can_run_installinfo); then \ + list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ + install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ + done; \ + else : ; fi +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: $(PDFS) + @$(NORMAL_INSTALL) + @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done +install-ps: install-ps-recursive + +install-ps-am: $(PSS) + @$(NORMAL_INSTALL) + @list='$(PSS)'; test -n "$(psdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-1 \ + maintainer-clean-aminfo maintainer-clean-generic \ + maintainer-clean-vti + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-1 mostlyclean-aminfo mostlyclean-generic \ + mostlyclean-libtool mostlyclean-vti + +pdf: pdf-recursive + +pdf-am: $(PDFS) + +ps: ps-recursive + +ps-am: $(PSS) + +uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \ + uninstall-pdf-am uninstall-ps-am + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-aminfo clean-generic clean-libtool \ + cscopelist-am ctags ctags-am dist-info distclean \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-1 maintainer-clean-aminfo \ + maintainer-clean-generic maintainer-clean-vti mostlyclean \ + mostlyclean-1 mostlyclean-aminfo mostlyclean-generic \ + mostlyclean-libtool mostlyclean-vti pdf pdf-am ps ps-am tags \ + tags-am uninstall uninstall-am uninstall-dvi-am \ + uninstall-html-am uninstall-info-am uninstall-pdf-am \ + uninstall-ps-am + +.PRECIOUS: Makefile + + +# Generated texi files ... +sinclude ./src/.dep-unuran_src_texi +$(unuran_src): $(top_srcdir)/doc/src/make_texi.pl + $(top_srcdir)/doc/src/make_texi.pl $(top_srcdir) > $(unuran_src) + +# Generated texi files for examples ... +$(unuran_examples): $(top_srcdir)/examples/example*.c + sed 's/{/@{/g;s/}/@}/g' < $(top_srcdir)/examples/`echo $* | sed 's/src\/ref_//'`.c > $@ + +$(unuran_win32_examples): $(top_srcdir)/scripts/win32/example*.c + sed 's/{/@{/g;s/}/@}/g' < \ + $(top_srcdir)/scripts/win32/`echo $* | sed 's/src\/ref_//' | sed 's/_win32_//'`.c > $@ + +# Rules for creating info, html, dvi, ps, and pdf files are provided by automake. +# Add new rules for txt. +unuran.txt: unuran.texi version.texi $(unuran_TEXINFOS) + $(MAKEINFO) $(AM_MAKEINFOFLAGS) --fill-column=80 --no-headers --number-sections \ + unuran.texi -o unuran.txt + +txt: unuran.txt + +# Name of Win32 libfile +unuran_win32_libname.texi: + @echo -n "@set LIBUNURAN libunuran" > unuran_win32_libname.texi + @grep PACKAGE_VERSION $(top_srcdir)/config.h | \ + sed 's/.*_VERSION\s*\"\(.*\)\..*\"/\1/' | sed 's/\.//' \ + >> unuran_win32_libname.texi + @echo -n "@set ZIPFILENAME unuran-" >> unuran_win32_libname.texi + @grep PACKAGE_VERSION $(top_srcdir)/config.h | \ + sed 's/.*_VERSION\s*\"\(.*\)\"/\1-win32.zip/' \ + >> unuran_win32_libname.texi + +# Remark: the last three lines are an ugly hack +# to remove these files in the top source directory. +# It cannot be done in $(top_srcdir)/Makefile.am as +# this breaks the cleaning process. + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/doc/Makefile.am b/vendor/unuran-1.11.0/doc/Makefile.am new file mode 100644 index 0000000..c28d486 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/Makefile.am @@ -0,0 +1,140 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = src figures . + +info_TEXINFOS = unuran.texi unuran_win32.texi + +# Location of same source files +TEXINFO_TEX = ./src/texinfo.tex + +AM_MAKEINFOFLAGS = \ + -I $(top_srcdir)/doc \ + -I $(top_srcdir)/doc/src \ + --no-split + +AM_MAKEINFOHTMLFLAGS = \ + -I $(top_srcdir)/doc \ + -I $(top_srcdir)/doc/src \ + --css-include=$(top_srcdir)/doc/src/unuran.css \ + --no-split + +# Automatically created part of manual +unuran_src = ./src/unuran_src.texi + +# Files with examples. +# These example files are generated from the corresponding +# files $(top_srcdir)/examples/example*.c +unuran_examples = \ + ./src/ref_example0.texi ./src/ref_example0_str.texi \ + ./src/ref_example1.texi ./src/ref_example1_str.texi \ + ./src/ref_example2.texi ./src/ref_example2_str.texi \ + ./src/ref_example3.texi ./src/ref_example3_str.texi \ + ./src/ref_example_reinit.texi \ + ./src/ref_example_gsl.texi \ + ./src/ref_example_rngstreams.texi \ + ./src/ref_example_anti.texi ./src/ref_example_anti_str.texi \ + ./src/ref_example_cext.texi \ + ./src/ref_example_cont.texi ./src/ref_example_cont_str.texi \ + ./src/ref_example_dext.texi \ + ./src/ref_example_discr.texi ./src/ref_example_discr_str.texi \ + ./src/ref_example_emp.texi ./src/ref_example_emp_str.texi \ + ./src/ref_example_vemp.texi ./src/ref_example_FuncStr.texi \ + ./src/ref_example_mixt.texi ./src/ref_example_mixt_inv.texi + +# Sources for UNU.RAN manual +unuran_TEXINFOS = \ + unuran.texi \ + ./src/methods_cont.texi \ + ./src/methods_discr.texi \ + ./src/methods_cemp.texi \ + ./src/methods_cvec.texi \ + ./src/methods_mcmc.texi \ + ./src/methods_cvemp.texi \ + ./src/methods_matr.texi \ + $(unuran_src) \ + $(unuran_examples) \ + $(top_srcdir)/doc/figures/*.eps \ + $(top_srcdir)/doc/figures/*.pdf \ + $(top_srcdir)/doc/figures/*.png \ + $(top_srcdir)/doc/figures/*.txt + + +# Sources for (short) Win32 manual + +# Files with examples. +# These example files are generated from the corresponding +# files $(top_srcdir)/scripts/win32/example?.c +unuran_win32_examples = \ + ./src/ref_example_win32_1.texi \ + ./src/ref_example_win32_2.texi + +unuran_win32_TEXINFOS = \ + unuran_win32.texi \ + unuran_win32_libname.texi \ + $(unuran_win32_examples) + + +noinst_DATA = + +EXTRA_DIST = \ + unuran.html \ + unuran.txt \ + unuran.pdf \ + unuran_win32.html \ + unuran_win32.pdf + + +# Generated texi files ... +sinclude ./src/.dep-unuran_src_texi +$(unuran_src): $(top_srcdir)/doc/src/make_texi.pl + $(top_srcdir)/doc/src/make_texi.pl $(top_srcdir) > $(unuran_src) + +# Generated texi files for examples ... +$(unuran_examples): $(top_srcdir)/examples/example*.c + sed 's/{/@{/g;s/}/@}/g' < $(top_srcdir)/examples/`echo $* | sed 's/src\/ref_//'`.c > $@ + +$(unuran_win32_examples): $(top_srcdir)/scripts/win32/example*.c + sed 's/{/@{/g;s/}/@}/g' < \ + $(top_srcdir)/scripts/win32/`echo $* | sed 's/src\/ref_//' | sed 's/_win32_//'`.c > $@ + +# Rules for creating info, html, dvi, ps, and pdf files are provided by automake. +# Add new rules for txt. +unuran.txt: unuran.texi version.texi $(unuran_TEXINFOS) + $(MAKEINFO) $(AM_MAKEINFOFLAGS) --fill-column=80 --no-headers --number-sections \ + unuran.texi -o unuran.txt + +txt: unuran.txt + +# Name of Win32 libfile +unuran_win32_libname.texi: + @echo -n "@set LIBUNURAN libunuran" > unuran_win32_libname.texi + @grep PACKAGE_VERSION $(top_srcdir)/config.h | \ + sed 's/.*_VERSION\s*\"\(.*\)\..*\"/\1/' | sed 's/\.//' \ + >> unuran_win32_libname.texi + @echo -n "@set ZIPFILENAME unuran-" >> unuran_win32_libname.texi + @grep PACKAGE_VERSION $(top_srcdir)/config.h | \ + sed 's/.*_VERSION\s*\"\(.*\)\"/\1-win32.zip/' \ + >> unuran_win32_libname.texi + +# Clean backup and temp files +CLEANFILES = \ + *~ + +# Clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in \ + mdate-sh \ + $(unuran_src) \ + $(unuran_examples) \ + $(unuran_win32_examples) \ + unuran_win32_libname.texi \ + unuran.txt \ + \ + $(top_srcdir)/aclocal.m4 \ + $(top_srcdir)/config.h.in \ + $(top_srcdir)/configure + +# Remark: the last three lines are an ugly hack +# to remove these files in the top source directory. +# It cannot be done in $(top_srcdir)/Makefile.am as +# this breaks the cleaning process. diff --git a/vendor/unuran-1.11.0/doc/Makefile.in b/vendor/unuran-1.11.0/doc/Makefile.in new file mode 100644 index 0000000..1af1473 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/Makefile.in @@ -0,0 +1,1138 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = doc +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/version.texi \ + $(srcdir)/stamp-vti $(srcdir)/version_win32.texi \ + $(srcdir)/stamp-1 $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +AM_V_DVIPS = $(am__v_DVIPS_@AM_V@) +am__v_DVIPS_ = $(am__v_DVIPS_@AM_DEFAULT_V@) +am__v_DVIPS_0 = @echo " DVIPS " $@; +am__v_DVIPS_1 = +AM_V_MAKEINFO = $(am__v_MAKEINFO_@AM_V@) +am__v_MAKEINFO_ = $(am__v_MAKEINFO_@AM_DEFAULT_V@) +am__v_MAKEINFO_0 = @echo " MAKEINFO" $@; +am__v_MAKEINFO_1 = +AM_V_INFOHTML = $(am__v_INFOHTML_@AM_V@) +am__v_INFOHTML_ = $(am__v_INFOHTML_@AM_DEFAULT_V@) +am__v_INFOHTML_0 = @echo " INFOHTML" $@; +am__v_INFOHTML_1 = +AM_V_TEXI2DVI = $(am__v_TEXI2DVI_@AM_V@) +am__v_TEXI2DVI_ = $(am__v_TEXI2DVI_@AM_DEFAULT_V@) +am__v_TEXI2DVI_0 = @echo " TEXI2DVI" $@; +am__v_TEXI2DVI_1 = +AM_V_TEXI2PDF = $(am__v_TEXI2PDF_@AM_V@) +am__v_TEXI2PDF_ = $(am__v_TEXI2PDF_@AM_DEFAULT_V@) +am__v_TEXI2PDF_0 = @echo " TEXI2PDF" $@; +am__v_TEXI2PDF_1 = +AM_V_texinfo = $(am__v_texinfo_@AM_V@) +am__v_texinfo_ = $(am__v_texinfo_@AM_DEFAULT_V@) +am__v_texinfo_0 = -q +am__v_texinfo_1 = +AM_V_texidevnull = $(am__v_texidevnull_@AM_V@) +am__v_texidevnull_ = $(am__v_texidevnull_@AM_DEFAULT_V@) +am__v_texidevnull_0 = > /dev/null +am__v_texidevnull_1 = +INFO_DEPS = $(srcdir)/unuran.info $(srcdir)/unuran_win32.info +am__TEXINFO_TEX_DIR = $(srcdir)/./src +DVIS = unuran.dvi unuran_win32.dvi +PDFS = unuran.pdf unuran_win32.pdf +PSS = unuran.ps unuran_win32.ps +HTMLS = unuran.html unuran_win32.html +TEXINFOS = unuran.texi unuran_win32.texi +TEXI2DVI = texi2dvi +TEXI2PDF = $(TEXI2DVI) --pdf --batch +MAKEINFOHTML = $(MAKEINFO) --html +DVIPS = dvips +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__installdirs = "$(DESTDIR)$(infodir)" +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +DATA = $(noinst_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in \ + $(top_srcdir)/autoconf/mdate-sh $(unuran_TEXINFOS) \ + $(unuran_win32_TEXINFOS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ +UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ +UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ +UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_valgrind = @have_valgrind@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = src figures . +info_TEXINFOS = unuran.texi unuran_win32.texi + +# Location of same source files +TEXINFO_TEX = ./src/texinfo.tex +AM_MAKEINFOFLAGS = \ + -I $(top_srcdir)/doc \ + -I $(top_srcdir)/doc/src \ + --no-split + +AM_MAKEINFOHTMLFLAGS = \ + -I $(top_srcdir)/doc \ + -I $(top_srcdir)/doc/src \ + --css-include=$(top_srcdir)/doc/src/unuran.css \ + --no-split + + +# Automatically created part of manual +unuran_src = ./src/unuran_src.texi + +# Files with examples. +# These example files are generated from the corresponding +# files $(top_srcdir)/examples/example*.c +unuran_examples = \ + ./src/ref_example0.texi ./src/ref_example0_str.texi \ + ./src/ref_example1.texi ./src/ref_example1_str.texi \ + ./src/ref_example2.texi ./src/ref_example2_str.texi \ + ./src/ref_example3.texi ./src/ref_example3_str.texi \ + ./src/ref_example_reinit.texi \ + ./src/ref_example_gsl.texi \ + ./src/ref_example_rngstreams.texi \ + ./src/ref_example_anti.texi ./src/ref_example_anti_str.texi \ + ./src/ref_example_cext.texi \ + ./src/ref_example_cont.texi ./src/ref_example_cont_str.texi \ + ./src/ref_example_dext.texi \ + ./src/ref_example_discr.texi ./src/ref_example_discr_str.texi \ + ./src/ref_example_emp.texi ./src/ref_example_emp_str.texi \ + ./src/ref_example_vemp.texi ./src/ref_example_FuncStr.texi \ + ./src/ref_example_mixt.texi ./src/ref_example_mixt_inv.texi + + +# Sources for UNU.RAN manual +unuran_TEXINFOS = \ + unuran.texi \ + ./src/methods_cont.texi \ + ./src/methods_discr.texi \ + ./src/methods_cemp.texi \ + ./src/methods_cvec.texi \ + ./src/methods_mcmc.texi \ + ./src/methods_cvemp.texi \ + ./src/methods_matr.texi \ + $(unuran_src) \ + $(unuran_examples) \ + $(top_srcdir)/doc/figures/*.eps \ + $(top_srcdir)/doc/figures/*.pdf \ + $(top_srcdir)/doc/figures/*.png \ + $(top_srcdir)/doc/figures/*.txt + + +# Sources for (short) Win32 manual + +# Files with examples. +# These example files are generated from the corresponding +# files $(top_srcdir)/scripts/win32/example?.c +unuran_win32_examples = \ + ./src/ref_example_win32_1.texi \ + ./src/ref_example_win32_2.texi + +unuran_win32_TEXINFOS = \ + unuran_win32.texi \ + unuran_win32_libname.texi \ + $(unuran_win32_examples) + +noinst_DATA = +EXTRA_DIST = \ + unuran.html \ + unuran.txt \ + unuran.pdf \ + unuran_win32.html \ + unuran_win32.pdf + + +# Clean backup and temp files +CLEANFILES = \ + *~ + + +# Clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in \ + mdate-sh \ + $(unuran_src) \ + $(unuran_examples) \ + $(unuran_win32_examples) \ + unuran_win32_libname.texi \ + unuran.txt \ + \ + $(top_srcdir)/aclocal.m4 \ + $(top_srcdir)/config.h.in \ + $(top_srcdir)/configure + +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .dvi .html .info .pdf .ps .texi +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign doc/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +.texi.info: + $(AM_V_MAKEINFO)restore=: && backupdir="$(am__leading_dot)am$$$$" && \ + am__cwd=`pwd` && $(am__cd) $(srcdir) && \ + rm -rf $$backupdir && mkdir $$backupdir && \ + if ($(MAKEINFO) --version) >/dev/null 2>&1; then \ + for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ + if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ + done; \ + else :; fi && \ + cd "$$am__cwd"; \ + if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $@ $<; \ + then \ + rc=0; \ + $(am__cd) $(srcdir); \ + else \ + rc=$$?; \ + $(am__cd) $(srcdir) && \ + $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ + fi; \ + rm -rf $$backupdir; exit $$rc + +.texi.dvi: + $(AM_V_TEXI2DVI)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2DVI) $(AM_V_texinfo) --build-dir=$(@:.dvi=.t2d) -o $@ $(AM_V_texidevnull) \ + $< + +.texi.pdf: + $(AM_V_TEXI2PDF)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2PDF) $(AM_V_texinfo) --build-dir=$(@:.pdf=.t2p) -o $@ $(AM_V_texidevnull) \ + $< + +.texi.html: + $(AM_V_MAKEINFO)rm -rf $(@:.html=.htp) + $(AM_V_at)if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $(@:.html=.htp) $<; \ + then \ + rm -rf $@ && mv $(@:.html=.htp) $@; \ + else \ + rm -rf $(@:.html=.htp); exit 1; \ + fi +$(srcdir)/unuran.info: unuran.texi $(srcdir)/version.texi $(unuran_TEXINFOS) +unuran.dvi: unuran.texi $(srcdir)/version.texi $(unuran_TEXINFOS) +unuran.pdf: unuran.texi $(srcdir)/version.texi $(unuran_TEXINFOS) +unuran.html: unuran.texi $(srcdir)/version.texi $(unuran_TEXINFOS) +$(srcdir)/version.texi: @MAINTAINER_MODE_TRUE@ $(srcdir)/stamp-vti +$(srcdir)/stamp-vti: unuran.texi $(top_srcdir)/configure + @(dir=.; test -f ./unuran.texi || dir=$(srcdir); \ + set `$(SHELL) $(top_srcdir)/autoconf/mdate-sh $$dir/unuran.texi`; \ + echo "@set UPDATED $$1 $$2 $$3"; \ + echo "@set UPDATED-MONTH $$2 $$3"; \ + echo "@set EDITION $(VERSION)"; \ + echo "@set VERSION $(VERSION)") > vti.tmp$$$$ && \ + (cmp -s vti.tmp$$$$ $(srcdir)/version.texi \ + || (echo "Updating $(srcdir)/version.texi" && \ + cp vti.tmp$$$$ $(srcdir)/version.texi.tmp$$$$ && \ + mv $(srcdir)/version.texi.tmp$$$$ $(srcdir)/version.texi)) && \ + rm -f vti.tmp$$$$ $(srcdir)/version.texi.$$$$ + @cp $(srcdir)/version.texi $@ + +mostlyclean-vti: + -rm -f vti.tmp* $(srcdir)/version.texi.tmp* + +maintainer-clean-vti: +@MAINTAINER_MODE_TRUE@ -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi +$(srcdir)/unuran_win32.info: unuran_win32.texi $(srcdir)/version_win32.texi $(unuran_win32_TEXINFOS) +unuran_win32.dvi: unuran_win32.texi $(srcdir)/version_win32.texi $(unuran_win32_TEXINFOS) +unuran_win32.pdf: unuran_win32.texi $(srcdir)/version_win32.texi $(unuran_win32_TEXINFOS) +unuran_win32.html: unuran_win32.texi $(srcdir)/version_win32.texi $(unuran_win32_TEXINFOS) +$(srcdir)/version_win32.texi: @MAINTAINER_MODE_TRUE@ $(srcdir)/stamp-1 +$(srcdir)/stamp-1: unuran_win32.texi $(top_srcdir)/configure + @(dir=.; test -f ./unuran_win32.texi || dir=$(srcdir); \ + set `$(SHELL) $(top_srcdir)/autoconf/mdate-sh $$dir/unuran_win32.texi`; \ + echo "@set UPDATED $$1 $$2 $$3"; \ + echo "@set UPDATED-MONTH $$2 $$3"; \ + echo "@set EDITION $(VERSION)"; \ + echo "@set VERSION $(VERSION)") > 1.tmp$$$$ && \ + (cmp -s 1.tmp$$$$ $(srcdir)/version_win32.texi \ + || (echo "Updating $(srcdir)/version_win32.texi" && \ + cp 1.tmp$$$$ $(srcdir)/version_win32.texi.tmp$$$$ && \ + mv $(srcdir)/version_win32.texi.tmp$$$$ $(srcdir)/version_win32.texi)) && \ + rm -f 1.tmp$$$$ $(srcdir)/version_win32.texi.$$$$ + @cp $(srcdir)/version_win32.texi $@ + +mostlyclean-1: + -rm -f 1.tmp* $(srcdir)/version_win32.texi.tmp* + +maintainer-clean-1: +@MAINTAINER_MODE_TRUE@ -rm -f $(srcdir)/stamp-1 $(srcdir)/version_win32.texi +.dvi.ps: + $(AM_V_DVIPS)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + $(DVIPS) $(AM_V_texinfo) -o $@ $< + +uninstall-dvi-am: + @$(NORMAL_UNINSTALL) + @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \ + rm -f "$(DESTDIR)$(dvidir)/$$f"; \ + done + +uninstall-html-am: + @$(NORMAL_UNINSTALL) + @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \ + rm -rf "$(DESTDIR)$(htmldir)/$$f"; \ + done + +uninstall-info-am: + @$(PRE_UNINSTALL) + @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ + if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ + then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \ + done; \ + else :; fi + @$(NORMAL_UNINSTALL) + @list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ + (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \ + echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ + rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ + else :; fi); \ + done + +uninstall-pdf-am: + @$(NORMAL_UNINSTALL) + @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pdfdir)/$$f"; \ + done + +uninstall-ps-am: + @$(NORMAL_UNINSTALL) + @list='$(PSS)'; test -n "$(psdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \ + rm -f "$(DESTDIR)$(psdir)/$$f"; \ + done + +dist-info: $(INFO_DEPS) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; \ + for base in $$list; do \ + case $$base in \ + $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$base; then d=.; else d=$(srcdir); fi; \ + base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \ + for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \ + if test -f $$file; then \ + relfile=`expr "$$file" : "$$d/\(.*\)"`; \ + test -f "$(distdir)/$$relfile" || \ + cp -p $$file "$(distdir)/$$relfile"; \ + else :; fi; \ + done; \ + done + +mostlyclean-aminfo: + -rm -rf unuran.t2d unuran.t2p unuran_win32.t2d unuran_win32.t2p + +clean-aminfo: + -test -z "unuran.dvi unuran.pdf unuran.ps unuran.html unuran_win32.dvi \ + unuran_win32.pdf unuran_win32.ps unuran_win32.html" \ + || rm -rf unuran.dvi unuran.pdf unuran.ps unuran.html unuran_win32.dvi \ + unuran_win32.pdf unuran_win32.ps unuran_win32.html + +maintainer-clean-aminfo: + @list='$(INFO_DEPS)'; for i in $$list; do \ + i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ + echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ + rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-info +check-am: all-am +check: check-recursive +all-am: Makefile $(INFO_DEPS) $(DATA) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(infodir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-aminfo clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: $(DVIS) + +html: html-recursive + +html-am: $(HTMLS) + +info: info-recursive + +info-am: $(INFO_DEPS) + +install-data-am: install-info-am + +install-dvi: install-dvi-recursive + +install-dvi-am: $(DVIS) + @$(NORMAL_INSTALL) + @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \ + done +install-exec-am: + +install-html: install-html-recursive + +install-html-am: $(HTMLS) + @$(NORMAL_INSTALL) + @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ + $(am__strip_dir) \ + d2=$$d$$p; \ + if test -d "$$d2"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \ + else \ + list2="$$list2 $$d2"; \ + fi; \ + done; \ + test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \ + done; } +install-info: install-info-recursive + +install-info-am: $(INFO_DEPS) + @$(NORMAL_INSTALL) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \ + fi; \ + for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ + for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ + $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ + if test -f $$ifile; then \ + echo "$$ifile"; \ + else : ; fi; \ + done; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done + @$(POST_INSTALL) + @if $(am__can_run_installinfo); then \ + list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ + install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ + done; \ + else : ; fi +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: $(PDFS) + @$(NORMAL_INSTALL) + @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done +install-ps: install-ps-recursive + +install-ps-am: $(PSS) + @$(NORMAL_INSTALL) + @list='$(PSS)'; test -n "$(psdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-1 \ + maintainer-clean-aminfo maintainer-clean-generic \ + maintainer-clean-vti + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-1 mostlyclean-aminfo mostlyclean-generic \ + mostlyclean-libtool mostlyclean-vti + +pdf: pdf-recursive + +pdf-am: $(PDFS) + +ps: ps-recursive + +ps-am: $(PSS) + +uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \ + uninstall-pdf-am uninstall-ps-am + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-aminfo clean-generic clean-libtool \ + cscopelist-am ctags ctags-am dist-info distclean \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-1 maintainer-clean-aminfo \ + maintainer-clean-generic maintainer-clean-vti mostlyclean \ + mostlyclean-1 mostlyclean-aminfo mostlyclean-generic \ + mostlyclean-libtool mostlyclean-vti pdf pdf-am ps ps-am tags \ + tags-am uninstall uninstall-am uninstall-dvi-am \ + uninstall-html-am uninstall-info-am uninstall-pdf-am \ + uninstall-ps-am + +.PRECIOUS: Makefile + + +# Generated texi files ... +sinclude ./src/.dep-unuran_src_texi +$(unuran_src): $(top_srcdir)/doc/src/make_texi.pl + $(top_srcdir)/doc/src/make_texi.pl $(top_srcdir) > $(unuran_src) + +# Generated texi files for examples ... +$(unuran_examples): $(top_srcdir)/examples/example*.c + sed 's/{/@{/g;s/}/@}/g' < $(top_srcdir)/examples/`echo $* | sed 's/src\/ref_//'`.c > $@ + +$(unuran_win32_examples): $(top_srcdir)/scripts/win32/example*.c + sed 's/{/@{/g;s/}/@}/g' < \ + $(top_srcdir)/scripts/win32/`echo $* | sed 's/src\/ref_//' | sed 's/_win32_//'`.c > $@ + +# Rules for creating info, html, dvi, ps, and pdf files are provided by automake. +# Add new rules for txt. +unuran.txt: unuran.texi version.texi $(unuran_TEXINFOS) + $(MAKEINFO) $(AM_MAKEINFOFLAGS) --fill-column=80 --no-headers --number-sections \ + unuran.texi -o unuran.txt + +txt: unuran.txt + +# Name of Win32 libfile +unuran_win32_libname.texi: + @echo -n "@set LIBUNURAN libunuran" > unuran_win32_libname.texi + @grep PACKAGE_VERSION $(top_srcdir)/config.h | \ + sed 's/.*_VERSION\s*\"\(.*\)\..*\"/\1/' | sed 's/\.//' \ + >> unuran_win32_libname.texi + @echo -n "@set ZIPFILENAME unuran-" >> unuran_win32_libname.texi + @grep PACKAGE_VERSION $(top_srcdir)/config.h | \ + sed 's/.*_VERSION\s*\"\(.*\)\"/\1-win32.zip/' \ + >> unuran_win32_libname.texi + +# Remark: the last three lines are an ugly hack +# to remove these files in the top source directory. +# It cannot be done in $(top_srcdir)/Makefile.am as +# this breaks the cleaning process. + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/doc/figures/Makefile b/vendor/unuran-1.11.0/doc/figures/Makefile new file mode 100644 index 0000000..a443d6d --- /dev/null +++ b/vendor/unuran-1.11.0/doc/figures/Makefile @@ -0,0 +1,473 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# doc/figures/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/unuran +pkgincludedir = $(includedir)/unuran +pkglibdir = $(libdir)/unuran +pkglibexecdir = $(libexecdir)/unuran +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +subdir = doc/figures +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_CFLAGS = -Wall -Wextra -Wshadow -Wstrict-prototypes +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf +AUTOHEADER = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader +AUTOMAKE = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -fPIC +CPP = gcc -E +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +FILECMD = file +GREP = /usr/bin/grep +HAVE_DIVIDE_BY_ZERO = +HAVE_IEEE_COMPARISONS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAINT = # +MAKEINFO = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = unuran +PACKAGE_BUGREPORT = unuran@statmath.wu.ac.at +PACKAGE_NAME = unuran +PACKAGE_STRING = unuran 1.11.0 +PACKAGE_TARNAME = unuran +PACKAGE_URL = +PACKAGE_VERSION = 1.11.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +UNURAN_LT_VERSION = 16:1:0 +UNURAN_SUPPORTS_GSL = +UNURAN_SUPPORTS_PRNG = +UNURAN_SUPPORTS_RNGSTREAM = +VERSION = 1.11.0 +abs_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/doc/figures +abs_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/doc/figures +abs_top_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +have_valgrind = false +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../../ +top_builddir = ../.. +top_srcdir = ../.. +EXTRA_DIST = \ + texpict2img.pl \ + discrete_inversion.eps discrete_inversion.pdf discrete_inversion.png discrete_inversion.txt \ + inversion.eps inversion.pdf inversion.png inversion.txt \ + rejection_from_constant_hat.eps rejection_from_constant_hat.pdf rejection_from_constant_hat.png rejection_from_constant_hat.txt \ + rou-cauchy.eps rou-cauchy.pdf rou-cauchy.png rou-cauchy.txt + + +# clean backup files +CLEANFILES = \ + *~ \ + tmp-* + + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/figures/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign doc/figures/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/doc/figures/Makefile.am b/vendor/unuran-1.11.0/doc/figures/Makefile.am new file mode 100644 index 0000000..86c4a2e --- /dev/null +++ b/vendor/unuran-1.11.0/doc/figures/Makefile.am @@ -0,0 +1,17 @@ +## Process this file with automake to produce Makefile.in + +EXTRA_DIST = \ + texpict2img.pl \ + discrete_inversion.eps discrete_inversion.pdf discrete_inversion.png discrete_inversion.txt \ + inversion.eps inversion.pdf inversion.png inversion.txt \ + rejection_from_constant_hat.eps rejection_from_constant_hat.pdf rejection_from_constant_hat.png rejection_from_constant_hat.txt \ + rou-cauchy.eps rou-cauchy.pdf rou-cauchy.png rou-cauchy.txt + +# clean backup files +CLEANFILES = \ + *~ \ + tmp-* + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/vendor/unuran-1.11.0/doc/figures/Makefile.in b/vendor/unuran-1.11.0/doc/figures/Makefile.in new file mode 100644 index 0000000..ed8257c --- /dev/null +++ b/vendor/unuran-1.11.0/doc/figures/Makefile.in @@ -0,0 +1,473 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = doc/figures +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ +UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ +UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ +UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_valgrind = @have_valgrind@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = \ + texpict2img.pl \ + discrete_inversion.eps discrete_inversion.pdf discrete_inversion.png discrete_inversion.txt \ + inversion.eps inversion.pdf inversion.png inversion.txt \ + rejection_from_constant_hat.eps rejection_from_constant_hat.pdf rejection_from_constant_hat.png rejection_from_constant_hat.txt \ + rou-cauchy.eps rou-cauchy.pdf rou-cauchy.png rou-cauchy.txt + + +# clean backup files +CLEANFILES = \ + *~ \ + tmp-* + + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/figures/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign doc/figures/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/doc/figures/discrete_inversion.eps b/vendor/unuran-1.11.0/doc/figures/discrete_inversion.eps new file mode 100644 index 0000000..8ac39bd --- /dev/null +++ b/vendor/unuran-1.11.0/doc/figures/discrete_inversion.eps @@ -0,0 +1,140 @@ +%!PS-Adobe-3.0 +%%Pages: (atend) +%%BoundingBox: 192 374 406 512 +%%HiResBoundingBox: 192.743994 374.993989 405.366061 511.710049 +%......................................... +%%Creator: ESP Ghostscript 707 (pswrite) +%%CreationDate: 2004/03/17 12:59:09 +%%DocumentData: Clean7Bit +%%LanguageLevel: 2 +%%EndComments +%%BeginProlog +% This copyright applies to everything between here and the %%EndProlog: +% Copyright 2003 artofcode LLC and Easy Software Products, all rights reserved. +%%BeginResource: procset GS_pswrite_2_0_1001 +/GS_pswrite_2_0_1001 80 dict dup begin +/PageSize 2 array def/setpagesize{ PageSize aload pop 3 index eq exch +4 index eq and{ pop pop pop}{ PageSize dup 1 +5 -1 roll put 0 4 -1 roll put dup null eq {false} {dup where} ifelse{ exch get exec} +{ pop/setpagedevice where +{ pop 1 dict dup /PageSize PageSize put setpagedevice} +{ /setpage where{ pop PageSize aload pop pageparams 3 {exch pop} repeat +setpage}if}ifelse}ifelse}ifelse} bind def +/!{bind def}bind def/#{load def}!/N/counttomark # +/rG{3{3 -1 roll 255 div}repeat setrgbcolor}!/G{255 div setgray}!/K{0 G}! +/r6{dup 3 -1 roll rG}!/r5{dup 3 1 roll rG}!/r3{dup rG}! +/w/setlinewidth #/J/setlinecap # +/j/setlinejoin #/M/setmiterlimit #/d/setdash #/i/setflat # +/m/moveto #/l/lineto #/c/rcurveto # +/p{N 2 idiv{N -2 roll rlineto}repeat}! +/P{N 0 gt{N -2 roll moveto p}if}! +/h{p closepath}!/H{P closepath}! +/lx{0 rlineto}!/ly{0 exch rlineto}!/v{0 0 6 2 roll c}!/y{2 copy c}! +/re{4 -2 roll m exch dup lx exch ly neg lx h}! +/^{3 index neg 3 index neg}! +/f{P fill}!/f*{P eofill}!/s{H stroke}!/S{P stroke}! +/q/gsave #/Q/grestore #/rf{re fill}! +/Y{P clip newpath}!/Y*{P eoclip newpath}!/rY{re Y}! +/|={pop exch 4 1 roll 1 array astore cvx 3 array astore cvx exch 1 index def exec}! +/|{exch string readstring |=}! +/+{dup type/nametype eq{2 index 7 add -3 bitshift 2 index mul}if}! +/@/currentfile #/${+ @ |}! +/B{{2 copy string{readstring pop}aload pop 4 array astore cvx +3 1 roll}repeat pop pop true}! +/Ix{[1 0 0 1 11 -2 roll exch neg exch neg]exch}! +/,{true exch Ix imagemask}!/If{false exch Ix imagemask}!/I{exch Ix image}! +/Ic{exch Ix false 3 colorimage}! +/F{/Columns counttomark 3 add -2 roll/Rows exch/K -1/BlackIs1 true>> +/CCITTFaxDecode filter}!/FX{<MFJ,O<^s8'LFs8W-!s8W-!s6BX\s8/ksoma*TrR0SFXjse\ +V/.GdKV=2uA4jW~> +, +2376 3752 36 66 /1O +$C +0F`Iu"GRYps8W-!s8W-!s8W-!s8W-!s8W#4r.TS[3$d]54?`-~> +, +2736 3752 47 66 /6H +$C +4rV2j^$k=02W!9EmIhLRmIota[r1$6G3h;6pMSg#gUHS +, +3105 3750 47 68 /1S +$C ++p5X`KH)0f"/%rk$+^GS=%Tu0%DDE&DuY=SDm6MCp"._I8sKQP&5k2(;NPk8L?q(X^A!'O6+mMG +p](9FHGWki>?c5YV.$$jK*2lC$:0>q~> +, +3473 3752 49 67 /6L +$C ++N#kR&:7Hms8W+h"](OP)=P=YrP%1dID>LQJ*lt0g[5$Mg])3j^>Jg9^\7PSmIpS4n*baQqq_~> +, +3842 3750 47 68 /1W +$C ++p(%4T]$NVF:`>A@FB%WH?r<_V#L!V\ef^Arr:lW0X:Y]l`[93?X$0G[DX9A&/8_~> +, +2059.18 5003.66 -32.38 0 S +1922 3835 6D , +1930 4971 1O , +11.9552 w +2026.8 3983.19 368.5 0 S +2395.3 4323.34 368.5 0 S +2763.81 4776.89 368.5 0 S +3132.31 5003.66 737.01 0 S +[ 40.0169 20.0084 ] 0 d +4.98132 w +2395.3 3983.19 0 340.14 S +[ 39.4394 19.7197 ] 0 d +2763.81 4323.34 0 453.55 S +[ 41.2306 20.6153 ] 0 d +3132.31 4776.89 0 226.77 S +2746.37 3918.62 17.43 -48.82 17.43 48.82 -17.43 -19.53 f +[ ] 0 d +9.96264 w +2026.8 4550.12 737.01 0 0 -651.03 S +cleartomark end end pagesave restore showpage +%%PageTrailer +%%Trailer +%%Pages: 1 +%%EOF diff --git a/vendor/unuran-1.11.0/doc/figures/discrete_inversion.pdf b/vendor/unuran-1.11.0/doc/figures/discrete_inversion.pdf new file mode 100644 index 0000000..5f8f011 Binary files /dev/null and b/vendor/unuran-1.11.0/doc/figures/discrete_inversion.pdf differ diff --git a/vendor/unuran-1.11.0/doc/figures/discrete_inversion.png b/vendor/unuran-1.11.0/doc/figures/discrete_inversion.png new file mode 100644 index 0000000..25f39c6 Binary files /dev/null and b/vendor/unuran-1.11.0/doc/figures/discrete_inversion.png differ diff --git a/vendor/unuran-1.11.0/doc/figures/discrete_inversion.txt b/vendor/unuran-1.11.0/doc/figures/discrete_inversion.txt new file mode 100644 index 0000000..a559a74 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/figures/discrete_inversion.txt @@ -0,0 +1,23 @@ + + ^ + | +1 + ======================= + | . + | . + | . + | ===========. + | . + | . + +---------------------+ + | | + | | + | ===========| + | . | + | . | + | . | + | . | + +==========. | + | V + +----------+----------+----------+----------+----------+----> + 0 1 2 3 4 5 + diff --git a/vendor/unuran-1.11.0/doc/figures/inversion.eps b/vendor/unuran-1.11.0/doc/figures/inversion.eps new file mode 100644 index 0000000..cd6894a --- /dev/null +++ b/vendor/unuran-1.11.0/doc/figures/inversion.eps @@ -0,0 +1,180 @@ +%!PS-Adobe-3.0 +%%Pages: (atend) +%%BoundingBox: 201 372 401 512 +%%HiResBoundingBox: 201.023994 372.113989 400.935495 511.710049 +%......................................... +%%Creator: ESP Ghostscript 707 (pswrite) +%%CreationDate: 2004/03/16 20:27:37 +%%DocumentData: Clean7Bit +%%LanguageLevel: 2 +%%EndComments +%%BeginProlog +% This copyright applies to everything between here and the %%EndProlog: +% Copyright 2003 artofcode LLC and Easy Software Products, all rights reserved. +%%BeginResource: procset GS_pswrite_2_0_1001 +/GS_pswrite_2_0_1001 80 dict dup begin +/PageSize 2 array def/setpagesize{ PageSize aload pop 3 index eq exch +4 index eq and{ pop pop pop}{ PageSize dup 1 +5 -1 roll put 0 4 -1 roll put dup null eq {false} {dup where} ifelse{ exch get exec} +{ pop/setpagedevice where +{ pop 1 dict dup /PageSize PageSize put setpagedevice} +{ /setpage where{ pop PageSize aload pop pageparams 3 {exch pop} repeat +setpage}if}ifelse}ifelse}ifelse} bind def +/!{bind def}bind def/#{load def}!/N/counttomark # +/rG{3{3 -1 roll 255 div}repeat setrgbcolor}!/G{255 div setgray}!/K{0 G}! +/r6{dup 3 -1 roll rG}!/r5{dup 3 1 roll rG}!/r3{dup rG}! +/w/setlinewidth #/J/setlinecap # +/j/setlinejoin #/M/setmiterlimit #/d/setdash #/i/setflat # +/m/moveto #/l/lineto #/c/rcurveto # +/p{N 2 idiv{N -2 roll rlineto}repeat}! +/P{N 0 gt{N -2 roll moveto p}if}! +/h{p closepath}!/H{P closepath}! +/lx{0 rlineto}!/ly{0 exch rlineto}!/v{0 0 6 2 roll c}!/y{2 copy c}! +/re{4 -2 roll m exch dup lx exch ly neg lx h}! +/^{3 index neg 3 index neg}! +/f{P fill}!/f*{P eofill}!/s{H stroke}!/S{P stroke}! +/q/gsave #/Q/grestore #/rf{re fill}! +/Y{P clip newpath}!/Y*{P eoclip newpath}!/rY{re Y}! +/|={pop exch 4 1 roll 1 array astore cvx 3 array astore cvx exch 1 index def exec}! +/|{exch string readstring |=}! +/+{dup type/nametype eq{2 index 7 add -3 bitshift 2 index mul}if}! +/@/currentfile #/${+ @ |}! +/B{{2 copy string{readstring pop}aload pop 4 array astore cvx +3 1 roll}repeat pop pop true}! +/Ix{[1 0 0 1 11 -2 roll exch neg exch neg]exch}! +/,{true exch Ix imagemask}!/If{false exch Ix imagemask}!/I{exch Ix image}! +/Ic{exch Ix false 3 colorimage}! +/F{/Columns counttomark 3 add -2 roll/Rows exch/K -1/BlackIs1 true>> +/CCITTFaxDecode filter}!/FX{<MFJ,O<^s8'LFs8W-!s8W-!s6BX\s8/ksoma*TrR0SFXjse\ +V/.GdKV=2uA4jW~> +, +2460 3723 36 66 /1Q +$C +0F`Iu"GRYps8W-!s8W-!s8W-!s8W-!s8W#4r.TS[3$d]54?`-~> +, +2792 3723 47 66 /6J +$C +4rV2j^$k=02W!9EmIhLRmIota[r1$6G3h;6pMSg#gUHS +, +3131 3721 47 68 /1U +$C ++p5X`KH)0f"/%rk$+^GS=%Tu0%DDE&DuY=SDm6MCp"._I8sKQP&5k2(;NPk8L?q(X^A!'O6+mMG +p](9FHGWki>?c5YV.$$jK*2lC$:0>q~> +, +3472 3723 49 67 /6N +$C ++N#kR&:7Hms8W+h"](OP)=P=YrP%1dID>LQJ*lt0g[5$Mg])3j^>Jg9^\7PSmIpS4n*baQqq_~> +, +3812 3721 47 68 /1Y +$C ++p(%4T]$NVF:`>A@FB%WH?r<_V#L!V\ef^Arr:lW0X:Y]l`[93?X$0G[DX9A&/8_~> +, +2170.78 5003.66 -64.76 0 S +2004 3835 6F , +2012 4971 1Q , +3144.95 3904.67 12.45 -34.87 12.45 34.87 -12.45 -13.95 f +2138.4 4946.96 1019.01 0 0 -1056.24 S +2299.7 3904.67 12.45 -34.87 12.45 34.87 -12.45 -13.95 f +2138.4 4323.34 173.75 0 0 -432.61 S +cleartomark end end pagesave restore showpage +%%PageTrailer +%%Trailer +%%Pages: 1 +%%EOF diff --git a/vendor/unuran-1.11.0/doc/figures/inversion.pdf b/vendor/unuran-1.11.0/doc/figures/inversion.pdf new file mode 100644 index 0000000..e753afa Binary files /dev/null and b/vendor/unuran-1.11.0/doc/figures/inversion.pdf differ diff --git a/vendor/unuran-1.11.0/doc/figures/inversion.png b/vendor/unuran-1.11.0/doc/figures/inversion.png new file mode 100644 index 0000000..64c681e Binary files /dev/null and b/vendor/unuran-1.11.0/doc/figures/inversion.png differ diff --git a/vendor/unuran-1.11.0/doc/figures/inversion.txt b/vendor/unuran-1.11.0/doc/figures/inversion.txt new file mode 100644 index 0000000..ad89da6 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/figures/inversion.txt @@ -0,0 +1,30 @@ + + ^ +1 + + | *************** + +--------------------------------------*************** + | ******* | + | ***** | + | *** | + | *** | + | ** | + | ** | + | ** | + | * | + | ** | + | * | + | * | + | * | + | * | + +------* | + | *| | + | * | | + | * | | + | * | | + | * | | + | * | | + | * | | + |* | | + | V V + +------+------+-------------+------------++-------------+-------------+---> + 0 1 2 3 4 5 diff --git a/vendor/unuran-1.11.0/doc/figures/rejection_from_constant_hat.eps b/vendor/unuran-1.11.0/doc/figures/rejection_from_constant_hat.eps new file mode 100644 index 0000000..f73c13f --- /dev/null +++ b/vendor/unuran-1.11.0/doc/figures/rejection_from_constant_hat.eps @@ -0,0 +1,335 @@ +%!PS-Adobe-3.0 +%%Pages: (atend) +%%BoundingBox: 208 385 405 504 +%%HiResBoundingBox: 208.322132 385.778133 404.324478 503.118850 +%......................................... +%%Creator: ESP Ghostscript 707 (pswrite) +%%CreationDate: 2004/03/17 09:32:10 +%%DocumentData: Clean7Bit +%%LanguageLevel: 2 +%%EndComments +%%BeginProlog +% This copyright applies to everything between here and the %%EndProlog: +% Copyright 2003 artofcode LLC and Easy Software Products, all rights reserved. +%%BeginResource: procset GS_pswrite_2_0_1001 +/GS_pswrite_2_0_1001 80 dict dup begin +/PageSize 2 array def/setpagesize{ PageSize aload pop 3 index eq exch +4 index eq and{ pop pop pop}{ PageSize dup 1 +5 -1 roll put 0 4 -1 roll put dup null eq {false} {dup where} ifelse{ exch get exec} +{ pop/setpagedevice where +{ pop 1 dict dup /PageSize PageSize put setpagedevice} +{ /setpage where{ pop PageSize aload pop pageparams 3 {exch pop} repeat +setpage}if}ifelse}ifelse}ifelse} bind def +/!{bind def}bind def/#{load def}!/N/counttomark # +/rG{3{3 -1 roll 255 div}repeat setrgbcolor}!/G{255 div setgray}!/K{0 G}! +/r6{dup 3 -1 roll rG}!/r5{dup 3 1 roll rG}!/r3{dup rG}! +/w/setlinewidth #/J/setlinecap # +/j/setlinejoin #/M/setmiterlimit #/d/setdash #/i/setflat # +/m/moveto #/l/lineto #/c/rcurveto # +/p{N 2 idiv{N -2 roll rlineto}repeat}! +/P{N 0 gt{N -2 roll moveto p}if}! +/h{p closepath}!/H{P closepath}! +/lx{0 rlineto}!/ly{0 exch rlineto}!/v{0 0 6 2 roll c}!/y{2 copy c}! +/re{4 -2 roll m exch dup lx exch ly neg lx h}! +/^{3 index neg 3 index neg}! +/f{P fill}!/f*{P eofill}!/s{H stroke}!/S{P stroke}! +/q/gsave #/Q/grestore #/rf{re fill}! +/Y{P clip newpath}!/Y*{P eoclip newpath}!/rY{re Y}! +/|={pop exch 4 1 roll 1 array astore cvx 3 array astore cvx exch 1 index def exec}! +/|{exch string readstring |=}! +/+{dup type/nametype eq{2 index 7 add -3 bitshift 2 index mul}if}! +/@/currentfile #/${+ @ |}! +/B{{2 copy string{readstring pop}aload pop 4 array astore cvx +3 1 roll}repeat pop pop true}! +/Ix{[1 0 0 1 11 -2 roll exch neg exch neg]exch}! +/,{true exch Ix imagemask}!/If{false exch Ix imagemask}!/I{exch Ix image}! +/Ic{exch Ix false 3 colorimage}! +/F{/Columns counttomark 3 add -2 roll/Rows exch/K -1/BlackIs1 true>> +/CCITTFaxDecode filter}!/FX{< + diff --git a/vendor/unuran-1.11.0/doc/figures/rou-cauchy.eps b/vendor/unuran-1.11.0/doc/figures/rou-cauchy.eps new file mode 100644 index 0000000..2e208af --- /dev/null +++ b/vendor/unuran-1.11.0/doc/figures/rou-cauchy.eps @@ -0,0 +1,145 @@ +%!PS-Adobe-3.0 +%%Pages: (atend) +%%BoundingBox: 208 387 407 503 +%%HiResBoundingBox: 208.736172 387.827988 406.943988 502.631985 +%......................................... +%%Creator: ESP Ghostscript 707 (pswrite) +%%CreationDate: 2004/03/17 11:35:01 +%%DocumentData: Clean7Bit +%%LanguageLevel: 2 +%%EndComments +%%BeginProlog +% This copyright applies to everything between here and the %%EndProlog: +% Copyright 2003 artofcode LLC and Easy Software Products, all rights reserved. +%%BeginResource: procset GS_pswrite_2_0_1001 +/GS_pswrite_2_0_1001 80 dict dup begin +/PageSize 2 array def/setpagesize{ PageSize aload pop 3 index eq exch +4 index eq and{ pop pop pop}{ PageSize dup 1 +5 -1 roll put 0 4 -1 roll put dup null eq {false} {dup where} ifelse{ exch get exec} +{ pop/setpagedevice where +{ pop 1 dict dup /PageSize PageSize put setpagedevice} +{ /setpage where{ pop PageSize aload pop pageparams 3 {exch pop} repeat +setpage}if}ifelse}ifelse}ifelse} bind def +/!{bind def}bind def/#{load def}!/N/counttomark # +/rG{3{3 -1 roll 255 div}repeat setrgbcolor}!/G{255 div setgray}!/K{0 G}! +/r6{dup 3 -1 roll rG}!/r5{dup 3 1 roll rG}!/r3{dup rG}! +/w/setlinewidth #/J/setlinecap # +/j/setlinejoin #/M/setmiterlimit #/d/setdash #/i/setflat # +/m/moveto #/l/lineto #/c/rcurveto # +/p{N 2 idiv{N -2 roll rlineto}repeat}! +/P{N 0 gt{N -2 roll moveto p}if}! +/h{p closepath}!/H{P closepath}! +/lx{0 rlineto}!/ly{0 exch rlineto}!/v{0 0 6 2 roll c}!/y{2 copy c}! +/re{4 -2 roll m exch dup lx exch ly neg lx h}! +/^{3 index neg 3 index neg}! +/f{P fill}!/f*{P eofill}!/s{H stroke}!/S{P stroke}! +/q/gsave #/Q/grestore #/rf{re fill}! +/Y{P clip newpath}!/Y*{P eoclip newpath}!/rY{re Y}! +/|={pop exch 4 1 roll 1 array astore cvx 3 array astore cvx exch 1 index def exec}! +/|{exch string readstring |=}! +/+{dup type/nametype eq{2 index 7 add -3 bitshift 2 index mul}if}! +/@/currentfile #/${+ @ |}! +/B{{2 copy string{readstring pop}aload pop 4 array astore cvx +3 1 roll}repeat pop pop true}! +/Ix{[1 0 0 1 11 -2 roll exch neg exch neg]exch}! +/,{true exch Ix imagemask}!/If{false exch Ix imagemask}!/I{exch Ix image}! +/Ic{exch Ix false 3 colorimage}! +/F{/Columns counttomark 3 add -2 roll/Rows exch/K -1/BlackIs1 true>> +/CCITTFaxDecode filter}!/FX{<K5!89]t1YUVE=7shtQ%%s8RGZhr2?-GPh8eGPCjFn"9VtrpKfps1Sg(de~> +, +3035.25 4968.2 -12.45 34.87 -12.45 -34.87 12.45 13.95 f +3022.8 3982.6 0 999.54 S +2942 4981 50 45 /1Q +$C +.KtD6&MFWUDNfBaXm*F3^Ae$,n%8%8n%[]9J+%`6hqcWY\,H("[\*#j^A?]glJ6=SBf0@k(em6~> +, +cleartomark end end pagesave restore showpage +%%PageTrailer +%%Trailer +%%Pages: 1 +%%EOF diff --git a/vendor/unuran-1.11.0/doc/figures/rou-cauchy.pdf b/vendor/unuran-1.11.0/doc/figures/rou-cauchy.pdf new file mode 100644 index 0000000..0878a95 Binary files /dev/null and b/vendor/unuran-1.11.0/doc/figures/rou-cauchy.pdf differ diff --git a/vendor/unuran-1.11.0/doc/figures/rou-cauchy.png b/vendor/unuran-1.11.0/doc/figures/rou-cauchy.png new file mode 100644 index 0000000..df386b8 Binary files /dev/null and b/vendor/unuran-1.11.0/doc/figures/rou-cauchy.png differ diff --git a/vendor/unuran-1.11.0/doc/figures/rou-cauchy.txt b/vendor/unuran-1.11.0/doc/figures/rou-cauchy.txt new file mode 100644 index 0000000..361bf7c --- /dev/null +++ b/vendor/unuran-1.11.0/doc/figures/rou-cauchy.txt @@ -0,0 +1,28 @@ + + ^ v + | + | + +---------------------------*-***********-*---------------------------+ + | *****.......|.......***** | + | ****............|............**** | + | **................|................** | + | **...................|...................** | + | *.....................|.....................* | + | *.......................|.......................* | + | *........................|.........................* | + | *..........................|..........................* | + | *...........................|...........................* | + | *............................|............................* | + | *.............................|.............................* | + | *..............................|..............................* | + | *...............................|...............................* | + | *...............................|................................* | + | *................................|................................* | + | *................................|................................* | + |*.................................|.................................*| + |*.................................|.................................*| + *..................................|..................................* + *..................................|..................................* + *..................................|..................................* +---*----------------------------------+----------------------------------*--> u + diff --git a/vendor/unuran-1.11.0/doc/figures/texpict2img.pl b/vendor/unuran-1.11.0/doc/figures/texpict2img.pl new file mode 100755 index 0000000..68f20d6 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/figures/texpict2img.pl @@ -0,0 +1,477 @@ +#!/usr/bin/perl +############################################################ + +use strict; +use Getopt::Std; + +############################################################ +# programms + +my $LATEX="latex"; +my $DVIPS="dvips"; +my $GS="gs"; +my $PS2EPSI="ps2epsi"; +my $EPSTOPDF="epstopdf"; + +############################################################ + +sub usage { + my $progname = $0; + $progname =~ s#^.*/##g; + + print STDERR < + + Read TeX file that contains a single picture and + converts it into EPS, PDF, PNG, JPEG and TXT format. + It is assumed that these pictures are produced by pstricks + commands. + Each of these is written into the respective file + where FORMAT is "eps", "pdf", "png", "jpg" or "txt". + The path information is stripped and the files are written in + working directory (i.e. the directory where the command + has been executed). + + Options: + + -r ... resolution for PNG and JPEG format [default: 150] + + -h ... height and width for TXT format (in characters) + -w [defautl: -h 30 - w 77] + + Height and width in PS and PDF format are given by units in TeX file. + + WARNING! QUICK & DIRTY HACK! +EOM + exit -1; +} + +############################################################ +# Defaults + +my $resolution = 150; +my $txt_isize = 77; +my $txt_jsize = 30; + +############################################################ +# Read arguments + +our ($opt_r, $opt_h, $opt_w); +getopts('r:h:w:'); +$resolution = $opt_r if $opt_r; +$txt_isize = $opt_w if $opt_w; +$txt_jsize = $opt_h if $opt_h; + +print STDERR "resolution = $resolution\n"; +print STDERR "TXT width = $txt_isize\n"; +print STDERR "TXT height = $txt_jsize\n"; +print STDERR "----------------------\n"; + +############################################################ +# Ret name of TeX file +# and compose names of all temp and output files +# +# Read name of TeX file from argument list ... +my $tex_file = shift; +(usage and die) unless $tex_file; + +# Get base of TeX file name +my $file_base = $tex_file; +$file_base =~ s[^.*/]{}; +$file_base =~ s/(.*)\..*$/$1/; + +# Output files +my $eps_file = "$file_base.eps"; +my $pdf_file = "$file_base.pdf"; +my $png_file = "$file_base.png"; +my $jpg_file = "$file_base.jpg"; +my $txt_file = "$file_base.txt"; + +print STDERR "TeX file = $tex_file\n"; +print STDERR "EPS file = $eps_file\n"; +print STDERR "PDF file = $pdf_file\n"; +print STDERR "PNG file = $png_file\n"; +print STDERR "JPG file = $jpg_file\n"; +print STDERR "TXT file = $txt_file\n"; +print STDERR "----------------------\n"; + +# Temp files +my $tmp_base = "tmp-$file_base-$$"; +my $tmp_tex_file = "$tmp_base.tex"; # TeX file for processing picture +my $tmp_dvi_file = "$tmp_base.dvi"; # dvi file with picture +my $tmp_ps_file_1 = "$tmp_base-1.ps"; # result of dvips +my $tmp_ps_file_2 = "$tmp_base-2.ps"; # stripped PS file (with wrong bounding boxes) +my $tmp_ps_file = "$tmp_base.ps"; # PS file with correct bounding boxes +my $tmp_epsi_file = "$tmp_base.epsi"; # result of ps2epsi (to be needed for epstopdf) + +############################################################ + +# Read TeX file and estimate TeX bounding box +my $tex_bx0 = "a"; +my $tex_by0 = 0; +my $tex_bx1 = 0; +my $tex_by1 = 0; +my $tex_code; + +open TEX, "$tex_file"; +while () { + # store tex code + $tex_code .= $_; + + if ( /\\begin\{pspicture\}\((-?[\d\.]+),\s*(-?[\d\.]+)\)\((-?[\d\.]+),\s*(-?[\d\.]+)\)/ ) { + print STDERR "junk!!\n\n"; + $tex_bx0 = $1; $tex_by0 = $2; + $tex_bx1 = $3; $tex_by1 = $4; + } +} +close TEX; + +if ($tex_bx0 eq "a") { die "Cannot find bounding box"; } + +print STDERR "TeX bounding box = ($tex_bx0,$tex_by0) x ($tex_bx1,$tex_by1)\n"; +print STDERR "----------------------\n"; + +############################################################ + +print STDERR "make temp file $tmp_tex_file\n"; + +open TEX, ">$tmp_tex_file" or die "Cannot open file $tmp_tex_file"; +print TEX + "\\documentclass{article}\n", + "\\usepackage{pstricks,pst-plot,pst-node}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\pagestyle{empty}\n", + "\\parindent 0pt\n", + "\\parskip 0pt\n", + "\\newcommand{\\onehalf}{{\\textstyle\\frac{1}{2}}}\n", + "\\begin{document}\n", + "\\mbox{}\\vfill\n", + "\\centering\n", + "\\input{$tex_file}\n", + "\\vfill\\mbox{}\n", + "\\end{document}\n"; +close TEX; + +# Make dvi +system("$LATEX $tmp_tex_file"); +print STDERR "----------------------\n"; + +# Make ps +system("$DVIPS -o $tmp_ps_file_1 $tmp_dvi_file"); +print STDERR "----------------------\n"; + +# Get PS bounding box +my $bbox = `$GS -q -sDEVICE=bbox -dNOPAUSE -dBATCH $tmp_ps_file_1 2>&1`; +my $boundingbox; +my $hiresboundingbox; +foreach my $l (split /\n/, $bbox) { + $boundingbox = $l if ($l =~ /%%BoundingBox:/); + $hiresboundingbox = $l if ($l =~ /%%HiResBoundingBox:/); +} +($boundingbox) or die "Cannot find bounding box"; +$boundingbox =~ m/^%%BoundingBox: ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)/m; +my $PS_bx0 = $1; +my $PS_by0 = $2; +my $PS_bx1 = $3; +my $PS_by1 = $4; +system("cat $tmp_ps_file_1 | sed -e 's/%%BoundingBox:.*\$/$boundingbox/' | sed -e 's/%%HiResBoundingBox:.*\$/$hiresboundingbox/'> $tmp_ps_file"); + +############################################################ + +# Make eps +print STDERR "Create EPS file ...\n"; +system("$GS -q -dNOPAUSE -dBATCH -sDEVICE=pswrite -sOutputFile=$tmp_ps_file_2 -f $tmp_ps_file_1"); +system("cat $tmp_ps_file_2 | sed -e 's/%%BoundingBox:.*\$/$boundingbox/' | sed -e 's/%%HiResBoundingBox:.*\$/$hiresboundingbox/'> $eps_file"); + +# Make pdf +print STDERR "Create PDF file ...\n"; +system("$PS2EPSI $tmp_ps_file_1 $tmp_epsi_file"); +system("$EPSTOPDF --outfile=$pdf_file $tmp_epsi_file"); + +# Make png +print STDERR "Create PNG file ...\n"; +my $translate="-$PS_bx0 -$PS_by0 translate"; +my $geometry = int($resolution*($PS_bx1-$PS_bx0)/72) ."x". int($resolution*($PS_by1-$PS_by0)/72); +system("$GS -q -dNOPAUSE -dBATCH -sDEVICE=pnggray -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=$png_file -r$resolution -g$geometry -c $translate -f $tmp_ps_file"); + +# Make jpeg +print STDERR "Create JPEG file ...\n"; +system("$GS -q -dNOPAUSE -dBATCH -sDEVICE=jpeggray -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=$jpg_file -r$resolution -g$geometry -c $translate -f $tmp_ps_file"); +print STDERR "----------------------\n"; + +############################################################ + +# Make txt file +# (very primitive support) + +print STDERR "Create TXT file ...\n"; + +# make blank page +my $txt_string = " " x ($txt_isize); +$txt_string .= "\n"; +$txt_string = $txt_string x ($txt_jsize); + +# remove % from code +$tex_code =~ s/\%//g; + +# scan tex code +while (1) { + # axes + if ($tex_code =~ /\\psaxes\s*(\[.*?\])?(\{.*?\})?(.*?)([\n])/s) { + my $line = $3; + $line =~ s/^\s*\(//; + $line =~ s/\)\s*$//; + $tex_code =~ s/\\psaxes\s*(\[.*?\])?(\{.*?\})?(.*?)([\n])/$4/s; + + my @points = split /\s*\)\s*\(\s*/, $line; + if ($#points == 0) { + (my $x, my $y) = split /\,/, $points[0], 2; + txt_joint_points("0,0","$x,0"); + txt_joint_points("0,0","0,$y"); + txt_draw_point($x,0,">"); + txt_draw_point(0,$y,"^"); + } + else { + die "Cannot handle psaxes: #points = $#points; tex = $line!\n\n\n"; + } + next; + } + + # lines + if ($tex_code =~ /\\psline\s*(\[.*?\])?(\{.*?\})?(.*?)([\n])/s) { + my $line = $3; + $line =~ s/^\s*\(//; + $line =~ s/\)\s*$//; + $tex_code =~ s/\\psline\s*(\[.*?\])?(\{.*?\})?(.*?)([\n])/$3/s; + + my @points = split /\s*\)\s*\(\s*/, $line; + for my $n (0..$#points-1) { + txt_joint_points($points[$n],$points[$n+1]); + } + next; + } + + # circles + if ($tex_code =~ /\\pscircle\*?\s*(\[.*?\])?(.*?)(\{.*?\})([\n])/s) { + my $line = $2; + $line =~ s/^\s*\(//; + $line =~ s/\)\s*$//; + $tex_code =~ s/\\pscircle\*?\s*(\[.*?\])?(.*?)(\{.*?\})([\n])/$4/s; + (my $x, my $y) = split /\,/, $line, 2; + txt_draw_point($x,$y,"o"); + next; + } + + # plot + if ($tex_code =~ /\\psplot\s*(\[.*?\])?\s*\{(.*?)\}\s*\{(.*?)\}\s*\{(.*?)\}\s*([\n])/s) { + my $x0 = $2; + my $x1 = $3; + my $code = $4; + print "plot [$x0:$x1] $code\n"; + $tex_code =~ s/\\psplot\s*(\[.*?\])?\s*\{(.*?)\}\s*\{(.*?)\}\s*\{(.*?)\}\s*([\n])/$5/s; + txt_plot($x0,$x1,$code); + next; + } + + # parametric plot + if ($tex_code =~ /\\parametricplot\s*(\[.*?\])?\s*\{(.*?)\}\s*\{(.*?)\}\s*\{(.*?)\}\s*([\n])/s) { + my $x0 = $2; + my $x1 = $3; + my $code = $4; + print "parametric plot [$x0:$x1] $code\n"; + $tex_code =~ s/\\parametricplot\s*(\[.*?\])?\s*\{(.*?)\}\s*\{(.*?)\}\s*\{(.*?)\}\s*([\n])/$5/s; + txt_parametricplot($x0,$x1,$code); + next; + } + + else { + last; + } +} + +# print page +open TXT, ">$txt_file"; +print TXT $txt_string; +close TXT; + +print STDERR "----------------------\n"; + +############################################################ +# Clear working space + +system("rm -v $tmp_base*.*"); + +exit 0; + +############################################################ + +sub txt_draw { + (my $i, my $j, my $c) = @_; + + $j = ($txt_jsize-1)-$j; + + $i=0 if $i<0; + $i=$txt_isize-1 if $i>=$txt_isize; + $j=0 if $j<0; + $j=$txt_jsize-1 if $j>=$txt_jsize; + + + my $pos = $j*($txt_isize+1) + $i; + my $oc = substr($txt_string, $pos, 1); + + CHAR: { + if ($c eq "-" and $oc eq "|" || $oc eq "+") { $c="+"; last CHAR; } + if ($c eq "|" and $oc eq "-" || $oc eq "+") { $c="+"; last CHAR; } + } + + substr($txt_string, $pos, 1) = $c; +} + +sub txt_draw_point { + (my $x, my $y, my $c) = @_; + + (my $i, my $j) = txt_xy2ij($x,$y); + txt_draw($i,$j,$c); +} + +sub txt_xy2ij { + (my $x, my $y) = @_; + + my $i = int( ($x-$tex_bx0)/($tex_bx1-$tex_bx0) * $txt_isize); + my $j = int( ($y-$tex_by0)/($tex_by1-$tex_by0) * $txt_jsize); + + return ($i,$j); +} + +sub txt_joint_points { + (my $first, my $second) = @_; + + (my $x0, my $y0) = split /\,/, $first, 2; + (my $x1, my $y1) = split /\,/, $second, 2; + + print STDERR "line ($x0,$y0) -> ($x1,$y1): "; + + # get drawing character (dependent on slope) + my $c = "."; + (my $i0, my $j0) = txt_xy2ij($x0,$y0); + (my $i1, my $j1) = txt_xy2ij($x1,$y1); + my $s = atan2 ($j1-$j0,$i1-$i0); + CHAR: { + if ($s > -0.16 && $s < 0.16 or $s > 3.00 or $s < -3.00) { $c="-"; last CHAR; } + if ($s > 1.41 && $s < 1.73 or $s > -1.73 && $s < -1.41) { $c="|"; last CHAR; } + if ($s > 0.62 && $s < 0.95 or $s > -2.52 && $s < -2.28) { $c="/"; last CHAR; } + if ($s < -0.62 && $s > -0.95 or $s < 2.52 && $s > 2.28) { $c="\\"; last CHAR; } + } + + # number of steps + my $steps = 1; + if ($s > 0.78 && $s < 2.36 or $s < -0.78 && $s > -2.36) { + $steps = $j1-$j0; + } + else { + $steps = $i1-$i0; + } + $steps *= -1 if $steps < 0; + + print STDERR "slope = $s, steps = $steps, char = $c\n"; + + # draw line + for my $t (0..$steps) { + my $x = ($t * $x0 + ($steps-$t)*$x1)/$steps; + my $y = ($t * $y0 + ($steps-$t)*$y1)/$steps; + txt_draw_point($x,$y,$c); + } +} + +sub txt_plot { + (my $x0, my $x1, my $code) = @_; + + # trim blanks + $code =~ s/^\s+//; + $code =~ s/\s+$//; + + # number of steps + (my $i0, my $j0) = txt_xy2ij($x0,"0"); + (my $i1, my $j1) = txt_xy2ij($x1,"0"); + my $steps = $i1-$i0; + $steps *= -1 if $steps < 0; + + # make plot + for my $t (0..$steps) { + my $x = ($t * $x0 + ($steps-$t)*$x1)/$steps; + my $y = (txt_plot_eval($x,$code))[0]; + txt_draw_point($x,$y,"*"); + } +} + +sub txt_parametricplot { + (my $t0, my $t1, my $code) = @_; + + # trim blanks + $code =~ s/^\s+//; + $code =~ s/\s+$//; + + # number of steps + my $steps = 100; + + # make plot + for my $s (0..$steps) { + my $t = ($s * $t0 + ($steps-$s)*$t1)/$steps; + my @x = txt_plot_eval($t,$code); + txt_draw_point($x[0],$x[1],"*"); + } +} + +# \parametricplot[plotstyle=curve,linestyle=none,fillstyle=solid,fillcolor=gray]% +# {0}{180}{t cos t sin 0.75 mul} + +sub txt_plot_eval { + (my $x, my $code) = @_; + + my @commands = split /\s+/, $code; + my @stack; + + foreach my $cmd (@commands) { + CMD:{ + if ($cmd =~ /^\-?\d*\.?\d*$/) { + push @stack, $cmd; + last CMD; } + if ($cmd eq "x" or $cmd eq "t") { + push @stack, $x; + last CMD; } + if ($cmd eq "neg") { + my $a = pop @stack; + push @stack, (-$a); + last CMD; } + if ($cmd eq "mul") { + my $a = pop @stack; + my $b = pop @stack; + push @stack, ($a*$b); + last CMD; } + if ($cmd eq "sub") { + my $a = pop @stack; + my $b = pop @stack; + push @stack, ($b-$a); + last CMD; } + if ($cmd eq "exp") { + my $a = pop @stack; + my $b = pop @stack; + push @stack, ($b ** $a); + last CMD; } + if ($cmd eq "sin") { + my $a = pop @stack; + push @stack, sin($a/57.29578); + last CMD; } + if ($cmd eq "cos") { + my $a = pop @stack; + push @stack, cos($a/57.29578); + last CMD; } + else { + die "Unknown PS command: $cmd"; + } + } + } + + return @stack; +} diff --git a/vendor/unuran-1.11.0/doc/src/Makefile b/vendor/unuran-1.11.0/doc/src/Makefile new file mode 100644 index 0000000..9b3ef9a --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/Makefile @@ -0,0 +1,488 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# doc/src/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/unuran +pkgincludedir = $(includedir)/unuran +pkglibdir = $(libdir)/unuran +pkglibexecdir = $(libexecdir)/unuran +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +subdir = doc/src +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in README texinfo.tex +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_CFLAGS = -Wall -Wextra -Wshadow -Wstrict-prototypes +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf +AUTOHEADER = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader +AUTOMAKE = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -fPIC +CPP = gcc -E +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +FILECMD = file +GREP = /usr/bin/grep +HAVE_DIVIDE_BY_ZERO = +HAVE_IEEE_COMPARISONS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAINT = # +MAKEINFO = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = unuran +PACKAGE_BUGREPORT = unuran@statmath.wu.ac.at +PACKAGE_NAME = unuran +PACKAGE_STRING = unuran 1.11.0 +PACKAGE_TARNAME = unuran +PACKAGE_URL = +PACKAGE_VERSION = 1.11.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +UNURAN_LT_VERSION = 16:1:0 +UNURAN_SUPPORTS_GSL = +UNURAN_SUPPORTS_PRNG = +UNURAN_SUPPORTS_RNGSTREAM = +VERSION = 1.11.0 +abs_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/doc/src +abs_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/doc/src +abs_top_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +have_valgrind = false +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../../ +top_builddir = ../.. +top_srcdir = ../.. +EXTRA_DIST = \ + README \ + texinfo.tex \ + make_texi.pl \ + arvag.dh \ + error_debug.dh \ + examples.dh \ + glossary.dh \ + index.dh \ + intro.dh \ + installation.dh \ + methods.dh \ + misc.dh \ + references.dh \ + stddist.dh \ + top.dh + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in \ + .dep-unuran_src_texi + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign doc/src/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am dist-hook distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# do not distribute dependencies for unuran_src.texi +dist-hook: + rm -f .dep-unuran_src_texi + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/doc/src/Makefile.am b/vendor/unuran-1.11.0/doc/src/Makefile.am new file mode 100644 index 0000000..72965a5 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/Makefile.am @@ -0,0 +1,30 @@ +## Process this file with automake to produce Makefile.in + +EXTRA_DIST = \ + README \ + texinfo.tex \ + make_texi.pl \ + arvag.dh \ + error_debug.dh \ + examples.dh \ + glossary.dh \ + index.dh \ + intro.dh \ + installation.dh \ + methods.dh \ + misc.dh \ + references.dh \ + stddist.dh \ + top.dh + +# do not distribute dependencies for unuran_src.texi +dist-hook: + rm -f .dep-unuran_src_texi + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in \ + .dep-unuran_src_texi diff --git a/vendor/unuran-1.11.0/doc/src/Makefile.in b/vendor/unuran-1.11.0/doc/src/Makefile.in new file mode 100644 index 0000000..915fb64 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/Makefile.in @@ -0,0 +1,488 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = doc/src +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in README texinfo.tex +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ +UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ +UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ +UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_valgrind = @have_valgrind@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = \ + README \ + texinfo.tex \ + make_texi.pl \ + arvag.dh \ + error_debug.dh \ + examples.dh \ + glossary.dh \ + index.dh \ + intro.dh \ + installation.dh \ + methods.dh \ + misc.dh \ + references.dh \ + stddist.dh \ + top.dh + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in \ + .dep-unuran_src_texi + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign doc/src/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am dist-hook distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# do not distribute dependencies for unuran_src.texi +dist-hook: + rm -f .dep-unuran_src_texi + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/doc/src/README b/vendor/unuran-1.11.0/doc/src/README new file mode 100644 index 0000000..18a0bfb --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/README @@ -0,0 +1,247 @@ + +(*) Simple Markups and TAGs + ======================= + +Great parts of the UNU.RAN User Manual are generated automatically from +the library header files by means of the make_texi.pl script. + +Thus all files in the unuran tree that end in .h or .dh are scanned. +(Files ending in .dh are files header files that only contains +documentation.) + +Simple markups (TAGs) are used to indicate relevant parts. +A TAG has the regular expression /^\s+=[A-Z]+/, i.e. `=' followed by +some capital letters. +(C comment strings `/*' are ignored.) + +The body of the documentation uses texinfo with some additional macros +(see below). + +There are some switches in ./doc/src/make_texi.pl: + + (*) $PAGEBREAKS: When set to 1 (non-nil) pagebreaks are inserts before + each =METHOD and =NODEX tag. + + (*) $LISTOFCALLS: When set to 1 (non-nil) lists of functions calls + (with hyperlinks) are added to top of Function Reference sections + in the HTML version of the manual. + + +(*) Nodes + ===== + +Nodes start with a node TAG and contain everything until the next +=EON TAG (`End-Of-Node') or end of file. + +Valid node TAGs are + + =TOP for the top node + =DISTR for handling distribution objects + =METHOD for generation methods + =APPENDIX for nodes in the appendix + =NODE generic node + =NODEX generic node, starts new page + +A header file that has no such TAG or with a different first TAG is +ignored and not included into the documentation. + +Node TAGs must have two arguments: +The first word is the name of the node and must be unique in the +entire documentation. +The remaining part of the line is treated as the node title, +used for the texinfo sectioning commands. +These two parts are used AS IS by texinfo. + + +(*) Section TAGs + ============ + +TAGs are used to scan the node and partition it into sections. A +node section starts with a TAG and ends with the line before the next +TAG (or end of file). It depends on the TAG how the read text is +processed further. + +The following TAGs are valid: + +=END The corresponding node section is simply ignored. Thus it can + be used as end markup of a subsection (thus its name). + +=UP Required! + the first word is the super node, i.e. the node to which it is + a subnode. + It might be followed (optionally) by anything with the regular + expression /\[\w+\]/, e.g. [14a]. + It is used to sort subnodes (lexicographically ordering of the + string between the brachets is used). + If it is omitted the node name is used instead. + +=REQUIRED List of required parameters. + Contains a list of parameter that are required for the method. + +=OPTIONAL List of optional parameters. + Contains a list of parameters that are optional for the + method. + +=SPEED Generation speed of generator method. + +=SEEALSO Similar methods. + List of methods that work similar as this method. + (not implemented yet) + +=ABSTRACT Abstract. + A very short description of method. Used in an overview. + (not implemented yet) + +=REF References for method or distribution. + Each reference has to be enclosed in square brackets + "[ ... ]". More than one reference can given; but then only + white space characters are allowed to separate them. + The format for the entries within the square brackets + is the same as for the @unurbibref macro (see below). + +=PDF PDF of distribution. + +=PMF PMF of distribution. + +=CONST Area below PDF or sum over PMF. + +=DOMAIN Domain of PDF or PMF. + +=FPARAM List of parameters of distribution. + Parameters must be given in the correct ordering. + Every line contains a parameter. + It is described by 5 fields which terminated by a colon `:'. + Eg: + 0 : alpha : > 0 : : shape : + [1] : beta : > 0 : 1 : scale : + [[2]] : gamma : : 0 : location : + + The first field is the number of the parameter. Square brackets + are used to indicate optional parameters. In this example + alpha is required. Alternative alpha and beta + or alpha, beta and gamma can be provided. + + The second field is the name of the parameter as it is + used in the =PDF, =CONSTANT and =DOMAIN subsections. + + The third field gives condition for the range of valid parameters. + + The forth field gives the default value for optional parameters, + that are used when these are omitted. + + The last field is a short description of the parameter. + +=STDGEN List of special generator for (UNU.RAN) standard distributions. + Each special generator must be given in one line. + The first entry is the identy for the special generator as given for + the unur_cstd_set_variant() and unur_dstd_set_variant() call. + Use DEF and INV as abbreviations for UNUR_STDGEN_DEFAULT and + UNUR_STDGEN_INVERSION, respectively. References must be given + in square brackets [...] as the last entry. Anything after the + references is ignored. + +=DESCRIPTION Discription of method. Can be used to print any text. + +=ROUTINES Function reference. + List of all subroutines. + The text is formated in the following way: + + lines starting with `#' are ignored. + + The text consists of blocks which are separated by one or more + blank lines outside of C comments (everything within a C + comment is treated as a single line). + In particular blocks end at a `*/' followed by an empty line. + + IMPORTANT: + A function with no description should be immediately followed + by `/* */' (on the next line). + + All C comment markers `/*' and `*/' are removed. + + A block that started with a C type declaration is treated as a + function prototype. Anything below the `;' till the end of the + block is interpreted as the function description. + + An anchor will be made for each function using the key: + funct., + e.g. `funct.unur_set_urng' for function unur_set_urng. + + If there is a function prototype with additional lines, it is + assumed that it has the same description as the following + function. (This is done recursively until a function prototype + with description is found.) + + A "function prototype" without any arguments (with or without + braces `( )' )is treated as a variable. + + A block that starts with a `==DOC' is copied verbatim into the + texi file. (Notice that `==DOC' is not a TAG as described + above). + +=OBSOLETE Functions that are obsolete and not documented any + more, but are still in the code for compatibility should be + put after this tag. Notice that the regular expression for + finding this tag is {/\*\s*=OBSOLETE.*$}. Everything after + this tag is removed (and is not even part of the string API). + + +(*) Common Transformation Rules + =========================== + +To avoid spoiling the header file with to many texinfo tags, the following +transformations are made during file procession: + +NULL --> @code{NULL} +TRUE --> @code{TRUE} +FALSE --> @code{FALSE} + +(\w+)\(\) --> @command($1) + eg.: unur_set_urng() --> @command{unur_set_urng}. + additionally hyperlinks are made automatically to + its definition in HTML output + (and in TeX and info with some restrictions). + NOTICE: there must not be blanks between the + function name and `(' or the braces! + +to insert C comment sign into a header file use +@cc_start --> /* +@cc_stop --> */ + + +(*) Special Bibtex Macros + ===================== + +There are a few additional texinfo macros. These start with @unur +and are expanded by the make_texi.pl script and not passed directly to +makeinfo. + +@unurbibref makes a reference to a book or journal listed in + references.dh. It only contains one such reference. If more + references are necessary then a series of such macros is + needed. The entry must be the corresponding anchor in the + reference.dh file. (The format in this file should be clear + from the other entries that already exist.) + Additional remarks, like "Sect.5" or "p.234" can follow but + must be separated by a colon ":". You are not allowed to use a + curly bracket "{" or "}". A comma "," is automatically + replaced by a semicolon. + (These restrictions are due to texinfo). + +@unurimage same as @image. But it will be easier to add vertical + spaces later. + +@unurmath same as @math. But we can use a more sophisticated + typesetting (once upon a time in the future). + Warning: making documantation fails when unknown TeX macros + appears, i.e., whenever new macros are used the make_texi.pl + script must be modified (see function transform_tex()). + + There are some differences to plain TeX: + - use LaTeX-style \\ for new line (line break) + + Notice: a trailing point or comma should be inside this macro + to avoid strang formating. + +@unurmathdisplay + diplaymode analog of @unurmath. diff --git a/vendor/unuran-1.11.0/doc/src/arvag.dh b/vendor/unuran-1.11.0/doc/src/arvag.dh new file mode 100644 index 0000000..a5d28d1 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/arvag.dh @@ -0,0 +1,546 @@ +/* +=APPENDIX RVG A Short Introduction to Random Variate Generation + +=UP TOP [a03] + +=DESCRIPTION + + Random variate generation is the small field of research that deals + with algorithms to generate random variates from various + distributions. It is common to assume that a uniform random number + generator is available. This is a program that produces a sequence + of independent and identically distributed continuous + @unurmath{U(0,1)} random variates (i.e. uniform random variates + on the interval @unurmath{(0,1)}). Of course real world computers can + never generate ideal random numbers and they cannot produce numbers + of arbitrary precision but state-of-the-art uniform random number + generators come close to this aim. Thus random variate generation + deals with the problem of transforming such a sequence of + @unurmath{U(0,1)} random numbers into non-uniform random variates. + + Here we shortly explain the basic ideas of the @emph{inversion}, + @emph{rejection}, and the @emph{ratio of uniforms} method. How + these ideas can be used to design a particular automatic random + variate generation algorithms that can be applied to large classes + of distributions is shortly explained in the description of the + different methods included in this manual. + + For a deeper treatment of the ideas presented here, for other + basic methods and for automatic generators we refer the interested + reader to our book [HLD04]. + +=EON +*/ +/* ------------------------------------------------------------------------- */ +/* +=NODE Inversion The Inversion Method + +=UP RVG [10] + +=DESCRIPTION + + When the inverse @unurmath{F^{-1}} of the cumulative distribution + function is known, then random variate generation is easy. + We just generate a uniformly @unurmath{U(0,1)} distributed random + number @unurmath{U} and return + + @unurmathdisplay{X=F^{-1}(U).} + + The following figure shows how the inversion method works for + the exponential distribution. + + @unurimage{figures/inversion} + + This algorithm is so simple that inversion is certainly the method + of choice if the inverse CDF is available in closed form. This is + the case e.g. for the exponential and the Cauchy distribution. + + The inversion method also has other special advantages that make it + even more attractive for simulation purposes. + It preserves the structural properties of the underlying uniform + pseudo-random number generator. + Consequently it can be used, e.g., for variance reduction techniques, + it is easy to sample from truncated distributions, from marginal + distributions, and from order statistics. + Moreover, the quality of the generated random variables depends only + on the underlying uniform (pseudo-) random number generator. + Another important advantage of the inversion method is that we can + easily characterize its performance. To generate one random variate + we always need exactly one uniform variate and one evaluation of + the inverse CDF. So its speed mainly depends on the costs for + evaluating the inverse CDF. Hence inversion is often considered as + the method of choice in the simulation literature. + + Unfortunately computing the inverse CDF is, for many important + standard distributions (e.g. for normal, student, gamma, and + beta-distributions), comparatively difficult and slow. Often no + such routines are available in standard programming libraries. + Then numerical methods for inverting the CDF are necessary, e.g. + Newton's method or (polynomial or rational) approximations of the + inverse CDF. Such procedures, however, have the disadvantage that + they are not exact and/or slow. + UNU.RAN implements several methods: + NINV (@pxref{NINV}), HINV (@pxref{HINV}) and PINV (@pxref{PINV}). + + For such approximate inversion methods the approximation error is + important for the quality of the generated point set. + Let @unurmath{X=G^{-1}(U)} denote the approximate inverse CDF, + and let @unurmath{F} and @unurmath{F^{-1}} be the exact CDF and + inverse CDF of the distribution, resp. + There are three measures for the approximation error: + + @table @emph + @item u-error + is given by + @unurmathdisplay{uerror = |U-F(G^{-1}(U))|} + Goodness-of-fit tests like the Kolmogorov-Smirnov test or the + chi-squared test look at this type of error. + We are also convinced that it is the most suitable error measure for + Monte Carlo simulations as pseudo-random numbers and points of low + discrepancy sets are located on a grid of restricted resolution. + + @item x-error + is given by + @unurmathdisplay{absolute xerror = |F^{-1}(U)-G^{-1}(U)|} + @unurmathdisplay{relative xerror = |F^{-1}(U)-G^{-1}(U)|\cdot |F^{-1}(U)|} + The x-error measure the deviation of @unurmath{G^{-1}(U)} + from the exact result. This measure is suitable when the inverse + CDF is used as a quantile function in some computations. + The main problem with the x-error is that we have to use the + @emph{absolute x-error} for @unurmath{X=F^{-1}(U)} close to zero + and the @emph{relative x-error} in the tails. + + @end table + + We use the terms @emph{u-resolution} and @emph{x-resolution} as the + maximal tolerated u-error and x-error, resp. + + UNU.RAN allows to set u-resolution and x-resolution + independently. Both requirements must be fulfilled. + We use the following strategy for checking whether the + precision goal is reached: + + @table @emph + @item checking u-error: + The u-error must be slightly smaller than the given u-resolution: + @unurmathdisplay{|U-F(G^{-1}(U))| < 0.9\cdot uresolution.} + There is no necessity to consinder the relative u-error as we have + @unurmath{0 < U < 1.} + + @item checking x-error: + We combine absoute and relative x-error and use the criterion + @unurmathdisplay{|F^{-1}(U)-G^{-1}(U)| < + xresolution \cdot (|G^{-1}(U)| + xresolution).} + + @end table + + @strong{Remark:} + It should be noted here that the criterion based on the u-error is + too stringent whereever the CDF is extremely steep (and thus the + PDF has a pole or a high and narrow peak). This is in particular a + problem for distributions with a pole (e.g., the gamma distribution + with shape parameter less than 0.5). + On the other hand using a criterion based on the x-error causes + problems whereever the CDF is extremly flat. This is in particular + the case in the (far) tails of heavy-tailed distributions (e.g., + for the Cauchy distribution). + +=EON +*/ +/* ------------------------------------------------------------------------- */ + +/* +=NODE Rejection The Rejection Method + +=UP RVG [20] + +=DESCRIPTION + + The rejection method, often called @emph{acceptance-rejection + method}, has been suggested by John von Neumann in 1951. + Since then it has proven to be the most flexible and most efficient + method to generate variates from continuous distributions. + + We explain the rejection principle first for the density + @unurmath{f(x) = sin(x)/2} on the interval @unurmath{(0,\pi).} + To generate random variates from this distribution we also can + sample random points that are uniformly distributed in the region + between the graph of @unurmath{f(x)} and the @i{x}-axis, + i.e., the shaded region in the below figure. + + @unurimage{figures/rejection_from_constant_hat} + + In general this is not a trivial task but in this example we can + easily use the rejection trick: + Sample a random point @unurmath{(X,Y)} uniformly in the + bounding rectangle @unurmath{(0,\pi)\times(0,0.5).} This is easy since + each coordinate can be sampled independently from the respective + uniform distributions @unurmath{U(0,\pi)} and @unurmath{U(0,0.5).} + Whenever the point falls into the shaded region below the graph + (indicated by dots in the figure), i.e., when @unurmath{Y < + sin(X)/2,} we accept it and return @unurmath{X} as a random variate + from the distribution with density @unurmath{f(x).} + Otherwise we have to reject the point (indicated by small circles + in the figure), and try again. + + It is quite clear that this idea works for every distribution with + a bounded density on a bounded domain. Moreover, we can use this + procedure with any multiple of the density, i.e., with any positive + bounded function with bounded integral and it is not necessary to + know the integral of this function. So we use the term density in + the sequel for any positive function with bounded integral. + + From the figure we can conclude that the performance of a rejection + algorithm depends heavily on the area of the enveloping + rectangle. Moreover, the method does not work if the target + distribution has infinite tails (or is unbounded). Hence + non-rectangular shaped regions for the envelopes are important and + we have to solve the problem of sampling points uniformly from such + domains. Looking again at the example above we notice that the + @i{x}-coordinate of the random point @unurmath{(X,Y)} was + sampled by inversion from the uniform distribution on the domain of + the given density. This motivates us to replace the density of the + uniform distribution by the (multiple of a) density @unurmath{h(x)} + of some other appropriate distribution. We only have to take care + that it is chosen such that it is always an upper bound, i.e., + @unurmath{h(x) >= f(x)} for all @unurmath{x} in the domain of the + distribution. To generate the pair @unurmath{(X,Y)} we generate + @unurmath{X} from the distribution with density proportional to + @unurmath{h(x)} and @unurmath{Y} uniformly between @unurmath{0} and + @unurmath{h(X).} The first step (generate @unurmath{X}) is usually + done by inversion (@pxref{Inversion}). + + Thus the general rejection algorithm for a hat @unurmath{h(x)} with + inverse CDF @unurmath{H^{-1}}consists of the following steps: + @enumerate + @item + Generate a @unurmath{U(0,1)} random number @unurmath{U.} + @item + Set @unurmath{X} to @unurmath{H^{-1}(U).} + @item + Generate a @unurmath{U(0,1)} random number @unurmath{V.} + @item + Set @unurmath{Y} to @unurmath{V h(X).} + @item + If @unurmath{Y <= f(X)} accept @unurmath{X} as the random variate. + @item + Else try again. + @end enumerate + + If the evaluation of the density @unurmath{f(x)} is expensive + (i.e., time consuming) it is possible to use a simple lower bound + of the density as so called @emph{squeeze function} + @unurmath{s(x)} (the triangular shaped function in the above + figure is an example for such a squeeze). We can then accept + @unurmath{X} when @unurmath{Y <= s(X)} and can thus often save the + evaluation of the density. + + We have seen so far that the rejection principle leads to + short and simple generation algorithms. The main practical problem + to apply the rejection algorithm is the search for a good fitting + hat function and for squeezes. We do not discuss these topics here + as they are the heart of the different automatic algorithms + implemented in UNU.RAN. Information about the construction of hat + and squeeze can therefore be found in the descriptions of the + methods. + + The performance characteristics of rejection algorithms mainly + depend on the fit of the hat and the squeeze. It is not difficult + to prove that: + @itemize @bullet + @item + The expected number of trials to generate one variate is the ratio + between the area below the hat and the area below the density. + @item + The expected number of evaluations of the density necessary to + generate one variate is equal to the ratio between the area below + the hat and the area below the density, when no squeeze is used. + Otherwise, when a squeeze is given it is equal to the ratio + between the area between hat and squeeze and the area below the hat. + @item + The @code{sqhratio} (i.e., the ratio between the area below the + squeeze and the area below the hat) used in some of the UNU.RAN + methods is easy to compute. It is useful as its reciprocal is an + upper bound for the expected number of trials of the rejection + algoritm. The expected number of evaluations of the density is + bounded by @unurmath{(1/sqhratio)-1.} + @end itemize + +=EON +*/ +/* ------------------------------------------------------------------------- */ +/* +=NODE Composition The Composition Method + +=UP RVG [30] + +=DESCRIPTION + + The composition method is an important principle to facilitate and + speed up random variate generation. The basic idea is simple. + To generate random variates with a given density we first split the + domain of the density into subintervals. Then we select one of + these randomly with probabilities given by the area below the + density in the respective subintervals. Finally we generate a + random variate from the density of the selected part by inversion + and return it as random variate of the full distribution. + + Composition can be combined with rejection. Thus it is possible to + decompose the domain of the distribution into subintervals and to + construct hat and squeeze functions seperatly in every + subinterval. The area below the hat must be determined in every + subinterval. Then the Composition rejection algorithm contains the + following steps: + + @enumerate + @item + Generate the index @unurmath{J} of the subinterval as the + realisation of a discrete random variate with probabilities + proportional to the area below the hat. + @item + Generate a random variate @unurmath{X} proportional to the hat in + interval @unurmath{J.} + @item + Generate the @unurmath{U(0,f(X))} random number @unurmath{Y.} + @item + If @unurmath{Y <= f(X)} accept @unurmath{X} as random variate. + @item + Else start again with generating the index @unurmath{J.} + @end enumerate + + The first step can be done in constant time (i.e., independent of + the number of chosen subintervals) by means of the indexed search + method (@pxref{IndexedSearch}). + + It is possible to reduce the number of uniform random numbers + required in the above algorithm by recycling the random numbers + used in Step 1 and additionally by applying the principle of + @emph{immediate acceptance}. + For details see @unurbibref{HLD04: Sect. 3.1}. + +=EON +*/ +/* ------------------------------------------------------------------------- */ +/* +=NODE Ratio-of-Uniforms The Ratio-of-Uniforms Method + +=UP RVG [40] + +=DESCRIPTION + + The construction of an appropriate hat function for the given + density is the crucial step for constructing rejection algorithms. + Equivalently we can try to find an appropriate envelope for the region + between the graph of the density and the @i{x}-axis, such + that we can easily sample uniformly distributed random points. + This task could become easier if we can find transformations that map + the region between the density and the axis into a region of more + suitable shape (for example into a bounded region). + + As a first example we consider the following simple algorithm for + the Cauchy distribution. + @enumerate + @item + Generate a @unurmath{U(-1,1)} random number @unurmath{U} and a + @unurmath{U(0,1)} random number @unurmath{V.} + @item + If @unurmath{U^2 + V^2 <= 1} accept @unurmath{X=U/V} as a Cauchy + random variate. + @item + Else try again. + @end enumerate + + It is possible to prove that the above algorithm indeed generates + Cauchy random variates. The fundamental principle behind this + algorithm is the fact that the region below the density is mapped + by the transformation + + @unurmathdisplay{(X,Y)\mapsto(U,V)=(2\,X\sqrt{Y},2\,\sqrt{Y})} + + into a half-disc in such a way that the ratio between the area of + the image to the area of the preimage is constant. This is due to + the fact that that the Jacobian of this transformation is constant. + + @unurimage{figures/rou-cauchy} + + The above example is a special case of a more general principle, + called the @emph{Ratio-of-uniforms (RoU) method}. It is based on + the fact that for a random variable @unurmath{X} with density + @unurmath{f(x)} and some constant @unurmath{\mu} we can generate + @unurmath{X} from the desired density by calculating + @unurmath{X=U/V+\mu} for a pair @unurmath{(U,V)} uniformly + distributed in the set + + @unurmathdisplay{A_f= \{(u,v)\colon 0 < v \leq \sqrt{f(u/v+\mu)}\}.} + + For most distributions it is best to set the constant + @unurmath{\mu} equal to the mode of the distribution. For sampling + random points uniformly distributed in @unurmath{A_f} rejection + from a convenient enveloping region is used, usually the minimal + bounding rectangle, i.e., the smallest possible rectangle that + contains @unurmath{A_f} (see the above figure). + It is given by @unurmath{(u^-,u^+)\times (0,v^+)} where + + @unurmathdisplay{ + v^+ = \sup\limits_{b_l P} + @item + @w{ } @w{ } @w{ } Set @unurmath{X} to @unurmath{X+1} and + @unurmath{P} to @unurmath{P+p(X).} + @item + Return @unurmath{X.} + @end enumerate + + With the exception of some very simple discrete distributions, + sequential search algorithms become very slow as the while-loop has + to be repeated very often. The expected number of iterations, + i.e., the number of comparisons in the while condition, is equal to + the expectation of the distribution plus @unurmath{1.} + It can therefore become arbitrary large or even infinity if the tail + of the distribution is very heavy. Another serious problem can be + critical round-off errors due to summing up many probabilities + @unurmath{p(k).} To speed up the search procedure it is best to use + indexed search. + +=EON +*/ +/* ------------------------------------------------------------------------- */ +/* +=NODE IndexedSearch Indexed Search (Guide Table Method) + +=UP RVG [60] + +=DESCRIPTION + + The idea to speed up the sequential search algorithm is easy to + understand. Instead of starting always at @unurmath{0} we store a + table of size @unurmath{C} with starting points for our search. For + this table we compute @unurmath{F^{-1}(U)} for @unurmath{C} + equidistributed values of @unurmath{U,} i.e., + for @unurmath{u_i = i/C,} @unurmath{i=0,...,C-1.} Such a table is + called @emph{guide table} or @emph{hash table}. + Then it is easy to prove that for every @unurmath{U} in + @unurmath{(0,1)} the guide table entry for @unurmath{k=floor(UC)} + is bounded by @unurmath{F^{-1}(U).} This shows that we can really + start our sequential search procedure from the table entry for + @unurmath{k} and the index @unurmath{k} of the correct table entry + can be found rapidly by means of the truncation operation. + + The two main differences between @emph{indexed search} and + @emph{sequential search} are that we start searching at the number + determined by the guide table, and that we have to compute and + store the cumulative probabilities in the setup as we have to know + the cumulative probability for the starting point of the search + algorithm. The rounding problems that can occur in the sequential + search algorithm can occur here as well. + Compared to sequential search we have now the obvious drawback + of a slow setup. The computation of the cumulative probabilities + grows linear with the size of the domain of the distribution + @unurmath{L.} What we gain is really high speed as the marginal + execution time of the sampling algorithm becomes very small. The + expected number of comparisons is bounded by @unurmath{1+L/C.} + This shows that there is a trade-off between speed and + the size of the guide table. Cache-effects in modern computers will + however slow down the speed-up for really large table sizes. + Thus we recommend to use a guide table that is about two times + larger than the probability vector to obtain optimal speed. + +=EON +*/ +/* ------------------------------------------------------------------------- */ + diff --git a/vendor/unuran-1.11.0/doc/src/error_debug.dh b/vendor/unuran-1.11.0/doc/src/error_debug.dh new file mode 100644 index 0000000..e77ea8e --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/error_debug.dh @@ -0,0 +1,25 @@ +=NODE Error_Debug Error handling and Debugging + +=UP TOP [60] + +=DESCRIPTION + UNU.RAN routines report an error whenever they cannot perform the + requested task. Additionally it is possible to get information + about the generated distribution of generator objects for debugging + purposes. However, the latter must be enabled when compiling and + installing the library. (It is disabled by default.) + This chapter describes all necessary details: + + @itemize + @item Choose an output stream to for writing the requested + information. + @item Select a debugging level. + @item Select an error handler. + @item Write your own error handler. + @item Get more information for a particular error code. + @end itemize + +=EON + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/doc/src/examples.dh b/vendor/unuran-1.11.0/doc/src/examples.dh new file mode 100644 index 0000000..e7b7901 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/examples.dh @@ -0,0 +1,269 @@ + +=NODE Examples Examples +=UP TOP [20] + +=DESCRIPTION + + The examples in this chapter should compile cleanly and can be + found in the directory @file{examples} of the source tree of + UNU.RAN. Assuming that UNU.RAN as well as the PRNG libraries + have been installed properly (@pxref{Installation}) each + of these can be compiled (using the GCC in this example) with + + @example + gcc -Wall -O2 -o example example.c -lunuran -lprng -lm + @end example + + @noindent + @emph{Remark:} @code{-lprng} must be omitted when the PRNG library + is not installed. Then however some of the examples might not work. + + The library uses three objects: + @code{UNUR_DISTR}, @code{UNUR_PAR} and @code{UNUR_GEN}. + It is not important to understand the details of these objects but + it is important not to changed the order of their creation. + The distribution object can be destroyed @emph{after} the generator + object has been made. (The parameter object is freed automatically + by the unur_init() call.) It is also important to check the result + of the unur_init() call. If it has failed the NULL pointer is + returned and causes a segmentation fault when used for sampling. + + We give all examples with the UNU.RAN standard API and the more + convenient string API. + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Example_0 As short as possible +=UP Examples [05] + +=DESCRIPTION + +Select a distribution and let UNU.RAN do all necessary steps. + +@smallexample +@include ref_example0.texi +@end smallexample + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Example_0_str As short as possible (String API) +=UP Examples [06] + +=DESCRIPTION + +Select a distribution and let UNU.RAN do all necessary steps. + +@smallexample +@include ref_example0_str.texi +@end smallexample + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Example_1 Select a method +=UP Examples [10] + +=DESCRIPTION + +Select method AROU and use it with default parameters. + +@smallexample +@include ref_example1.texi +@end smallexample + +=EON + +/*---------------------------------------------------------------------------*/ + + +=NODEX Example_1_str Select a method (String API) +=UP Examples [11] + +=DESCRIPTION + +Select method AROU and use it with default parameters. + +@smallexample +@include ref_example1_str.texi +@end smallexample + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Example_2 Arbitrary distributions +=UP Examples [20] + +=DESCRIPTION + +If you want to sample from a non-standard distribution, +UNU.RAN might be exactly what you need. +Depending on the information is available, a method +must be choosen for sampling, +see @ref{Concepts} for an overview and +@ref{Methods} for details. + +@smallexample +@include ref_example2.texi +@end smallexample + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Example_2_str Arbitrary distributions (String API) +=UP Examples [21] + +=DESCRIPTION + +If you want to sample from a non-standard distribution, +UNU.RAN might be exactly what you need. +Depending on the information is available, a method +must be choosen for sampling, +see @ref{Concepts} for an overview and +@ref{Methods} for details. + +@smallexample +@include ref_example2_str.texi +@end smallexample + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Example_3 Change parameters of the method +=UP Examples [30] + +=DESCRIPTION + +Each method for generating random numbers allows several +parameters to be modified. If you do not want to use default values, +it is possible to change them. +The following example illustrates how to change parameters. +For details see @ref{Methods}. + +@smallexample +@include ref_example3.texi +@end smallexample + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Example_3_str Change parameters of the method (String API) +=UP Examples [31] + +=DESCRIPTION + +Each method for generating random numbers allows several +parameters to be modified. If you do not want to use default values, +it is possible to change them. +The following example illustrates how to change parameters. +For details see @ref{Methods}. + +@smallexample +@include ref_example3_str.texi +@end smallexample + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Example_4 Change uniform random generator +=UP Examples [40] + +=DESCRIPTION + +All generator object use the same default uniform random number +generator by default. This can be changed to any generator of your +choice such that each generator object has its own random number +generator or can share it with some other objects. +It is also possible to change the default generator at any time. +See @ref{URNG,,Using uniform random number generators}, +for details. + +The following example shows how the uniform random number generator +can be set or changed for a generator object. It requires the +RNGSTREAMS library to be installed and used. Otherwise the example must be +modified accordingly. + +@smallexample +@include ref_example_rngstreams.texi +@end smallexample + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Example_reinit Change parameters of underlying distribution +=UP Examples [43] + +=DESCRIPTION + +One a generator object has been created it allows to draw samples from +the distribution with the given parameters. +However, some methods allow to change the parameters of the underlying +distribution and reinitialize the generator object again. +Thus when the parameters of the distribution vary for each draw we +save overhead for destroying the old object and creating a new one. + +The following example shows how the parameters of a GIG distribution +can be changed when method CSTD is used. + +@smallexample +@include ref_example_reinit.texi +@end smallexample + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Example_anti Sample pairs of antithetic random variates +=UP Examples [50] + +=DESCRIPTION +Using Method TDR it is easy to sample pairs of antithetic random variates. + +@smallexample +@include ref_example_anti.texi +@end smallexample + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Example_anti_str Sample pairs of antithetic random variates (String API) +=UP Examples [51] + +=DESCRIPTION +Using Method TDR it is easy to sample pairs of antithetic random variates. + +@smallexample +@include ref_example_anti_str.texi +@end smallexample + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Example_More More examples +=UP Examples [60] +=DESCRIPTION + +@xref{Methods_for_CONT,,Methods for continuous univariate distributions}. + +@xref{Methods_for_CEMP,,Methods for continuous empirical univariate distributions}. + +@xref{Methods_for_CVEMP,,Methods for continuous empirical multivariate distributions}. + +@xref{Methods_for_DISCR,,Methods for discrete univariate distributions}. + +=EON + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/doc/src/glossary.dh b/vendor/unuran-1.11.0/doc/src/glossary.dh new file mode 100644 index 0000000..733c03b --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/glossary.dh @@ -0,0 +1,88 @@ + +=APPENDIX Glossary Glossary + +=UP TOP [a05] + +=DESCRIPTION + +@table @strong + +@item CDF +cumulative distribution function. + +@item HR +hazard rate (or failure rate). + +@item inverse local concavity +local concavity of inverse PDF @unurmath{f^{-1}(y)} expressed in term of +@unurmath{x = f^{-1}(y).} +Is is given by +@unurmath{ilc_f(x) = 1 + x\,f''(x) / f'(x)} + +@item local concavity +maximum value of @i{c} such that PDF @i{f(x)} is @unurmath{T_c.} +Is is given by +@unurmath{lc_f(x) = 1 - f''(x)\,f(x) / f'(x)^2} + +@item PDF +probability density function. + +@item dPDF +derivative (gradient) of probability density function. + +@item PMF +probability mass function. + +@item PV +(finite) probability vector. + +@item URNG +uniform random number generator. + +@item @math{U(a,b)} +continuous uniform distribution on the interval @unurmath{(a,b).} + +@item T-concave +a function @i{f(x)} is called @i{T}-convace if the transformed function +@i{T(f(x))} is concave. +We only deal with transformations @unurmath{T_c,} where +@table @code +@item @i{c} = 0 +@unurmath{T(x) = \log(x)} +@item @i{c} = @math{-0.5} +@unurmath{T(x) = -1/\sqrt{x}} +@item @i{c} != 0 +@unurmath{T(x) = sign(x) \cdot x^c} +@end table + +@item u-error +for a given approximate inverse CDF @unurmath{X=G^{-1}(U)} +the u-error is given as +@unurmathdisplay{uerror = |U-F(G^{-1}(U))|} +where @unurmath{F} denotes the exact CDF. +Goodness-of-fit tests like the Kolmogorov-Smirnov test or the +chi-squared test look at this type of error. +See @ref{Inversion} for more details. + +@item u-resolution +the maximal tolerated u-error for an approximate inverse CDF. + +@item x-error +for a given approximate inverse CDF @unurmath{X=G^{-1}(U)} +the x-error is given as +@unurmathdisplay{xerror = |F^{-1}(U)-G^{-1}(U)|} +where @unurmath{F^{-1}} denotes the exact inverse CDF. +The x-error measure the deviation of @unurmath{G^{-1}(U)} +from the exact result. +Notice that we have to distinguish between @emph{absolute} and +@emph{relative} x-error. In UNU.RAN we use the absolute x-error near 0 +and the relative x-error otherwise. +See @ref{Inversion} for more details. + +@item x-resolution +the maximal tolerated x-error for an approximate inverse CDF. + +@end table + +=EON + diff --git a/vendor/unuran-1.11.0/doc/src/index.dh b/vendor/unuran-1.11.0/doc/src/index.dh new file mode 100644 index 0000000..5c1110e --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/index.dh @@ -0,0 +1,10 @@ + +=APPENDIX FIndex Function Index + +=UP TOP [a10] + +=DESCRIPTION +@printindex fn + +=EON + diff --git a/vendor/unuran-1.11.0/doc/src/installation.dh b/vendor/unuran-1.11.0/doc/src/installation.dh new file mode 100644 index 0000000..bc6f536 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/installation.dh @@ -0,0 +1,253 @@ + +=NODE Installation Installation +=UP Intro [30] + +=DESCRIPTION + UNU.RAN was developed on an Intel architecture under Linux with + the GNU C compiler but should compile and run on any computing + environment. It requires an ANSI compliant C compiler. + + Below find the installation instructions for unices. + + + @subsubheading Uniform random number generator + + UNU.RAN can be used with any uniform random number generator but (at the + moment) some features work best with Pierre L'Ecuyer's RngStreams library + (see @url{http://statmath.wu.ac.at/software/RngStreams/} for a + description and downloading. + For details on using uniform random number in UNU.RAN + see @ref{URNG,,Using uniform random number generators}. + + Install the required libraries first. + + + @subsubheading UNU.RAN + + @enumerate + + @item First unzip and untar the package and change to the directory: + + @example + tar zxvf unuran-@value{VERSION}.tar.gz + cd unuran-@value{VERSION} + @end example + + @item Optional: Edit the file @file{src/unuran_config.h} + + @item Run a configuration script: + + @example + sh ./configure --prefix= + @end example + + @noindent + where @code{} is the root of the installation tree. + When omitted @file{/usr/local} is used. + + Use @code{./configure --help} to get a list of other options. + In particular the following flags are important: + + @itemize @bullet + @item + Enable support for some external sources of uniform random + number generators + (@pxref{URNG,,Using uniform random number generators}): + + @table @code + @item --with-urng-rngstream + URNG: use Pierre L'Ecuyer's RNGSTREAM library + [default=@code{no}] + + @item --with-urng-prng + URNG: use Otmar Lendl's PRNG library + [default=@code{no}] + + @item --with-urng-gsl + URNG: use random number generators from GNU Scientific Library + [default=@code{no}] + + @item --with-urng-default + URNG: global default URNG (builtin|rngstream) + [default=@code{builtin}] + @end table + + We strongly recommend to use RngStreams library: + + @example + sh ./configure --with-urng-rngstream --with-urng-default=rngstream + @end example + + @emph{Important:} You must install the respective libraries + @file{RngStreams}, @file{PRNG} and @file{GSL} before + @code{./configure} is executed. + + @item + Also make a shared library: + + @table @code + @item --enable-shared + build shared libraries [default=@code{no}] + @end table + + @item + The library provides the function @code{unur_gen_info} for + information about generator objects. This is intented for + using in interactive computing environments. + This feature can be enabled / disabled by means of the + configure flag + + @table @code + @item --enable-info + INFO: provide function with information about + generator objects [default=@code{yes}] + @end table + + @item + Enable support for deprecated UNU.RAN routines if you have + some problems with older application after upgrading the + library: + + @table @code + @item --enable-deprecated + enable support for deprecated UNU.RAN routines + [default=@code{no}] + @end table + + @item + Enable debugging tools: + + @table @code + @item --enable-check-struct + Debug: check validity of pointers to structures + [default=@code{no}] + + @item --enable-logging + Debug: print informations about generator into logfile + [default=no] + @end table + @end itemize + + + @item Compile and install the libray: + + @example + make + make install + @end example + + @noindent + Obviously @code{$(prefix)/include} and @code{$(prefix)/lib} + must be in the search path of your compiler. You can use environment + variables to add these directories to the search path. If you + are using the bash type (or add to your profile): + + @example + export LIBRARY_PATH="/lib" + export C_INCLURE_PATH="/include" + @end example + + @noindent + If you want to make a shared library, then making such + a library can be enabled using + + @example + sh ./configure --enable-shared + @end example + + @noindent + If you want to link against the shared library make sure that + it can be found when executing the binary that links to the + library. If it is not installed in the usual path, then the + easiest way is to set the @code{LD_LIBRARY_PATH} environment + variable. See any operating system documentation about shared + libraries for more information, such as the ld(1) and + ld.so(8) manual pages. + + @item Documentation in various formats (PDF, HTML, info, plain + text) can be found in directory @file{doc}. + + @item You can run some tests by + + @example + make check + @end example + + @noindent + However, some of these tests requires the usage of the PRNG or + RngStreams library and are only executed if these are installed + enabled by the corresponding configure flag. + + An extended set of tests is run by + + @example + make fullcheck + @end example + + @noindent + However some of these might fail occasionally due to + roundoff errors or the mysteries of floating point arithmetic, + since we have used some extreme settings to test the library. + + @end enumerate + + + @subsubheading Upgrading + + @itemize @minus + @item @emph{Important:} + + UNU.RAN now relies on some aspects of IEEE + 754 compliant floating point arithmetic. In particular, + @code{1./0.} and @code{0./0.} must result in @code{infinity} + and @code{NaN} (not a number), respectively, and must not + cause a floating point exception. + For allmost all modern compting architecture this is implemented + in hardware. For others there should be a special compiler flag + to get this feature (e.g., @code{-MIEEE} on DEC alpha or + @code{-mp} for the Intel C complier). + + @item Upgrading UNU.RAN from version 0.9.x or earlier: + + With UNU.RAN version 1.0.x some of the macro definitions in + file @file{src/unuran_config.h} are moved into file + @file{config.h} and are set/controlled by the + @code{./configure} script. + + Writting logging information into the logfile must now be + enabled when running the configure script: + + @example + sh ./configure --enable-logging + @end example + + @item Upgrading UNU.RAN from version 0.7.x or earlier: + + With UNU.RAN version 0.8.0 the interface for changing + underlying distributions and running a reinitialization + routine has been simplified. The old routines can be compiled + into the library using the following configure flag: + + @example + sh ./configure --enable-deprecated + @end example + + @noindent + Notice: Using these deprecated routines is not supported any + more and this strong discouraged. + + Wrapper functions for external sources of uniform random + numbers are now enabled by configure flags and not by macros + defined in file @file{src/unuran_config.h}. + + The file @file{src/unuran_config.h} is not installed any + more. It is now only included when the library is compiled. + It should be removed from the global include path of the + compiler. + + @end itemize + +=EON + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/doc/src/intro.dh b/vendor/unuran-1.11.0/doc/src/intro.dh new file mode 100644 index 0000000..9c3dbd5 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/intro.dh @@ -0,0 +1,469 @@ + +=NODE Intro Introduction +=UP TOP [10] +=EON + +/*---------------------------------------------------------------------------*/ + +=NODE UsageDoc Usage of this document +=UP Intro [20] + +=DESCRIPTION + We designed this document in a way such that one can + use UNU.RAN with reading as little as necessary. + Read @ref{Installation} for the instructions to + install the library. + @ref{Concepts,,Concepts of UNU.RAN}, + discribes the basics of UNU.RAN. + It also has a short guideline for choosing an appropriate method. + In @ref{Examples} examples are given that can be copied and modified. + They also can be found in the directory @file{examples} in the + source tree. + + Further information are given in consecutive chapters. + @ref{Distribution_objects,,Handling distribution objects}, + describes how to create and manipulate distribution objects. + @ref{Stddist,,standard distributions}, + describes predefined distribution objects that are ready to use. + @ref{Methods} describes the various methods in detail. + For each of possible distribution classes + (continuous, discrete, empirical, multivariate) + there exists a short overview section that can be used to choose an + appropriate method followed by sections that describe each of the + particular methods in detail. + These are merely for users with some knowledge about + the methods who want to change method-specific parameters and can + be ignored by others. + + Abbreviations and explanation of some basic terms can be found in + @ref{Glossary}. +=EON + +/*---------------------------------------------------------------------------*/ + +=NODE UsageLib Using the library +=UP Intro [40] + +=DESCRIPTION + + @subsubheading ANSI C Compliance + + The library is written in ANSI C and is intended to conform to the + ANSI C standard. It should be portable to any system with a + working ANSI C compiler. + + The library does not rely on any non-ANSI extensions in the + interface it exports to the user. Programs you write using UNU.RAN + can be ANSI compliant. Extensions which can be used in a way + compatible with pure ANSI C are supported, however, via conditional + compilation. This allows the library to take advantage of compiler + extensions on those platforms which support them. + + To avoid namespace conflicts all exported function names and + variables have the prefix @code{unur_}, while exported macros have + the prefix @code{UNUR_}. + + + @subsubheading Compiling and Linking + + If you want to use the library you must include the UNU.RAN header + file + + @example + #include + @end example + + @noindent + If you also need the test routines then also add + + @example + #include + @end example + + @noindent + If wrapper functions for external sources of uniform random number + generators are used, the corresponding header files must also be + included, e.g., + + @example + #include + @end example + + @noindent + If these header files are not installed on the standard search path + of your compiler you will also need to provide its location to the + preprocessor as a command line flag. The default location of the + @file{unuran.h} is @file{/usr/local/include}. A typical compilation + command for a source file @file{app.c} with the GNU C compiler + @code{gcc} is, + + @example + gcc -I/usr/local/include -c app.c + @end example + + @noindent + This results in an object file @file{app.o}. The default include + path for @code{gcc} searches @file{/usr/local/include} + automatically so the @code{-I} option can be omitted when UNU.RAN is + installed in its default location. + + The library is installed as a single file, @file{libunuran.a}. A + shared version of the library is also installed on systems that + support shared libraries. The default location of these files is + @file{/usr/local/lib}. To link against the library you need to + specify the main library. The following example shows how to link + an application with the library (and the the RNGSTREAMS library if you + decide to use this source of uniform pseudo-random numbers), + + @example + gcc app.o -lunuran -lrngstreams -lm + @end example + + + @subsubheading Shared Libraries + + To run a program linked with the shared version of the library it + may be necessary to define the shell variable + @code{LD_LIBRARY_PATH} to include the directory where the library + is installed. For example, + + @example + LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + @end example + + @noindent + To compile a statically linked version of the program instead, use the + @code{-static} flag in @code{gcc}, + + @example + gcc -static app.o -lunuran -lrngstreams -lm + @end example + + + @subsubheading Compatibility with C++ + + The library header files automatically define functions to have + @code{extern "C"} linkage when included in C++ programs. + + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODE Concepts Concepts of UNU.RAN +=UP Intro [50] + +=DESCRIPTION + UNU.RAN is a C library for generating non-uniformly distributed + random variates. Its emphasis is on the generation of non-standard + distribution and on streams of random variates of special purposes. + It is designed to provide a consistent tool to + sample from distributions with various properties. + Since there is no universal method that fits for all situations, + various methods for sampling are implemented. + + UNU.RAN solves this complex task by means of an object oriented + programming interface. Three basic objects are used: + + @itemize @bullet + @item distribution object @code{UNUR_DISTR}@* + Hold all information about the random variates that should be + generated. + + @item generator object @code{UNUR_GEN}@* + Hold the generators for the given distributions. + Two generator objects are completely independent of each other. + They may share a common uniform random number generator or have + their owns. + + @item parameter object @code{UNUR_PAR}@* + Hold all information for creating a generator object. It is + necessary due to various parameters and switches for each of + these generation methods. + + Notice that the parameter objects only hold pointers to arrays + but do not have their own copy of such an array. + Especially, if a dynamically allocated array is used + it @emph{must not} be freed until the generator object has + been created! + + @end itemize + + The idea behind these structures is that creatin distributions, + choosing a generation method and draing samples are orthogonal + (ie. independent) functions of the library. + The parameter object is only introduced due to the necessity to + deal with various parameters and switches for + each of these generation methods which are required to adjust the + algorithms to unusual distributions with extreme properties but + have default values that are suitable for most applications. + These parameters and the data for distributions are set by various + functions. + + Once a generator object has been created sampling (from the + univariate continuous distribution) can be done by + the following command: + + @example + double x = unur_sample_cont(generator); + @end example + + @noindent + Analogous commands exist for discrete and multivariate + distributions. + For detailed examples that can be copied and modified + see @ref{Examples}. + + + @subheading Distribution objects + + All information about a distribution are stored in objects + (structures) of type @code{UNUR_DISTR}. + UNU.RAN has five different types of distribution objects: + + @table @code + @item cont + Continuous univariate distributions. + @item cvec + Continuous multivariate distributions. + @item discr + Discrete univariate distributions. + @item cemp + Continuous empirical univariate distribution, ie. given by a sample. + @item cvemp + Continuous empirical multivariate distribution, ie. given by a sample. + @item matr + Matrix distributions. + + @end table + + @noindent + Distribution objects can be + created from scratch by the following call + + @example + distr = unur_distr__new(); + @end example + + @noindent + where @code{} is one of the five possible types from the + above table. + Notice that these commands only create an @emph{empty} object which + still must be filled by means of calls for each type of + distribution object + (@pxref{Distribution_objects,,Handling distribution objects}). + The naming scheme of these functions is designed to indicate the + corresponding type of the distribution object and the task to be + performed. It is demonstated on the following example. + + @example + unur_distr_cont_set_pdf(distr, mypdf); + @end example + + @noindent + This command stores a PDF named @code{mypdf} in the distribution + object @code{distr} which must have the type @code{cont}. + + Of course UNU.RAN provides an easier way to use standard distributions. + Instead of using @command{unur_distr__new} calls and fuctions + @command{unur_distr__set_<@dots{}>} for setting data, + objects for standard distribution can be created by a single call. + Eg. to get an object for the normal distribution with mean 2 and + standard deviation 5 use + + @example + double parameter[2] = @{2.0 ,5.0@}; + UNUR_DISTR *distr = unur_distr_normal(parameter, 2); + @end example + + @noindent + For a list of standard distributions + see @ref{Stddist,,Standard distributions}. + + + @subheading Generation methods + + The information that a distribution object must contain depends + heavily on the chosen generation method choosen. + + Brackets indicate optional information while a tilde indicates + that only an approximation must be provided. + See @ref{Glossary}, for unfamiliar terms. + + @include methods_cont.texi + + @include methods_cemp.texi + + @include methods_cvec.texi + + @include methods_cvemp.texi + + @include methods_discr.texi + + @include methods_matr.texi + + @include methods_mcmc.texi + + Because of tremendous variety of possible problems, UNU.RAN provides many + methods. All information for creating a generator object has to be + collected in a parameter object first. + For example, if the task is to sample from a continuous distribution + the method AROU might be a good choice. Then the call + + @example + UNUR_PAR *par = unur_arou_new(distribution); + @end example + + @noindent + creates an parameter object @code{par} with a pointer to the + distribution object and default values for all necessary parameters + for method AROU. + Other methods can be used by replacing @code{arou} with the name + of the desired methods (in lower case letters): + + @example + UNUR_PAR *par = unur__new(distribution); + @end example + + @noindent + This sets the default values for all necessary parameters for the + chosen method. These are suitable for almost all + applications. Nevertheless, it is possible to control the behavior + of the method using corresponding @command{set} calls for each method. + This might be necessary to adjust the algorithm for an unusual + distribution with extreme properties, or just for fine tuning the + perforence of the algorithm. + The following example demonstrates how to change the maximum + number of iterations for method NINV to the value 50: + + @example + unur_ninv_set_max_iteration(par, 50); + @end example + + @noindent + All available methods are described in details in + @ref{Methods}. + + + @subheading Creating a generator object + + Now it is possible to create a generator object: + + @example + UNUR_GEN *generator = unur_init(par); + if (generator == NULL) exit(EXIT_FAILURE); + @end example + + @noindent + @strong{Important:} You must always check whether unur_init() has + been executed successfully. Otherwise the NULL pointer is returned + which causes a segmentation fault when used for sampling. + + @noindent + @strong{Important:} + The call of unur_init() @strong{destroys} the parameter object!@* + Moreover, it is recommended to call unur_init() immediately after + the parameter object @code{par} has created and modified. + + An existing generator object is a rather static construct. + Nevertheless, some of the parameters can still be modified by + @command{chg} calls, e.g. + + @example + unur_ninv_chg_max_iteration(gen, 30); + @end example + + @noindent + Notice that it is important @emph{when} parameters are + changed because different functions must be used: + + The function name includes the term @command{set} and the first + argument must be of type @code{UNUR_PAR} when the parameters are + changed @emph{before} the generator object is created. + + The function name includes the term @command{chg} and the first + argument must be of type @code{UNUR_GEN} when the parameters are + changed for an @emph{existing} generator object. + + For details see @ref{Methods}. + + + @subheading Sampling + + You can now use your generator object in any place of your program + to sample from your distribution. You only have to take care about + the type of variates it computes: @code{double}, @code{int} or a + vector (array of @code{double}s). + Notice that at this point it does not matter whether you are + sampling from a gamma distribution, a truncated normal distribution + or even an empirical distribution. + + + @subheading Reinitializing + + It is possible for a generator object to change the parameters and + the domain of the underlying distribution. This must be done by + extracting this object by means of a unur_get_distr() call and + changing the distribution using the correspondig set calls, + see @ref{Distribution_objects,,Handling distribution objects}. + The generator object @strong{must} then be reinitialized by means + of the unur_reinit() call. + + @emph{Important}: Currently not all methods allow reinitialization, + see the description of the particular method (keyword @i{Reinit}). + + + @subheading Destroy + + When you do not need your generator object any more, you should + destroy it: + + @example + unur_free(generator); + @end example + + + @subheading Uniform random numbers + + Each generator object can have its own uniform random number + generator or share one with others. + When created a parameter object the pointer for the uniform random + number generator is set to the default generator. However, it can be + changed at any time to any other generator: + + @example + unur_set_urng(par, urng); + @end example + + @noindent + or + + @example + unur_chg_urng(generator, urng); + @end example + + @noindent + respectively. + See @ref{URNG,,Using uniform random number generators}, + for details. + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODE Contact Contact the authors +=UP Intro [60] + +=DESCRIPTION + If you have any problems with UNU.RAN, suggestions how to improve + the library, or find a bug, please contact us via email + @email{unuran@@statmath.wu.ac.at}. + + For news please visit out homepage at + @uref{http://statmath.wu.ac.at/unuran/}. + +=EON + +/*---------------------------------------------------------------------------*/ + + diff --git a/vendor/unuran-1.11.0/doc/src/make_texi.pl b/vendor/unuran-1.11.0/doc/src/make_texi.pl new file mode 100755 index 0000000..08b967c --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/make_texi.pl @@ -0,0 +1,1649 @@ +#!/usr/bin/perl +############################################################################## +# # +# UNURAN -- Universal Non-Uniform Random number generator # +# # +############################################################################## +# # +# FILE: merge_h.pl # +# # +# Read all UNU.RAN header files, extract manual, and create texinfo file # +# # +############################################################################## +# # +# Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold # +# Department of Statistics and Mathematics, WU Wien, Austria # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the # +# Free Software Foundation, Inc., # +# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA # +# # +############################################################################## + +use strict; + +# set to 0 to disable output of nodes to stderr +my $VERBOSE = 1; + +# set to 0 if no additinal page breaks should be included +my $PAGEBREAKS = 1; + +# set to 0 if no list of calls should be added to top of +# Function Reference sections (only in HTML output) +my $LISTOFCALLS = 1; + +############################################################ +# constants + +my $DEP_file = "./src/.dep-unuran_src_texi"; + +my $greeks = + # small greek letters + "alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|". + "mu|nu|xi|omikron|pi|rho|sigma|tau|ypsilon|phi|chi|psi|omega|". + # capital greek letters + "Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Phi|Psi|Omega"; + + +############################################################ + +sub usage { + my $progname = $0; + $progname =~ s#^.*/##g; + + print STDERR < + +Perl script extracts documentation for unuran library from +header files and transform it into texinfo format. + +The output is written on STDOUT. + +For a detailed description see README. + +EOM + exit; +} + +############################################################ + +use FileHandle; + +############################################################ + +my %node_TAGs = + ( + "=TOP" => { "format" => \&texi_NODE }, + "=NODE" => { "format" => \&texi_NODE }, + "=NODEX" => { "format" => \&texi_NODE }, + "=DISTR" => { "format" => \&texi_NODE }, + "=METHOD" => { "format" => \&texi_NODE }, + "=APPENDIX" => { "format" => \&texi_NODE }, + ); + +#........................................................... + +my %TAGs = + ( + + "=UP" => { "scan" => \&scan_UP }, + "=DESCRIPTION" => { "scan" => \&scan_do_nothing }, + "=HOWTOUSE" => { "scan" => \&scan_do_nothing }, + "=ROUTINES" => { "scan" => \&scan_ROUTINES }, + "=REQUIRED" => { "scan" => \&scan_chop_blanks }, + "=OPTIONAL" => { "scan" => \&scan_chop_blanks }, + "=SPEED" => { "scan" => \&scan_chop_blanks }, + "=REINIT" => { "scan" => \&scan_chop_blanks }, + "=SEEALSO" => { "scan" => \&scan_do_nothing }, + "=ABSTRACT" => { "scan" => \&scan_do_nothing }, + "=REF" => { "scan" => \&scan_REF }, + "=PDF" => { "scan" => \&scan_PDF }, + "=PMF" => { "scan" => \&scan_PDF }, + "=CONST" => { "scan" => \&scan_PDF }, + "=CDF" => { "scan" => \&scan_PDF }, + "=DOMAIN" => { "scan" => \&scan_PDF }, + "=FPARAM" => { "scan" => \&scan_FPARAM }, + "=STDGEN" => { "scan" => \&scan_STDGEN }, + + "=END" => { "scan" => \&scan_do_nothing }, + ); + +############################################################# + +# list of nodes +my $LIST_nodes; +my @LIST_nodes_sorted; + +# list of routines +my $LIST_routines; + +# scanned input +# it is stored in the form +# $IN->{node name}->{TAG} = entry +my $IN; + +# texinfo output +my $TEXI = "\@c automatically generated by `make_texi.pl'\n\n"; + +# dependencies +my $DEP = "\$(unuran_src): "; + +############################################################# + +# read directory name from argument list ... +my $top_dir = shift; +(usage and die) unless $top_dir; + +# header files in directory tree ... +# files are stored with key = filename and +# value = complete path of file. +my %header_files; +scan_dir($top_dir); + +# now scan all header files +foreach my $file (sort keys %header_files) { + scan_file($file); +} + +# check node structure +check_node_structure(); + +# format texinfo output +texi_node("TOP",0); + +# write all output on STDOUT +print $TEXI; + +# write dependencies +open DEP, ">$DEP_file" or die "Cannot open file for writing: $DEP_file"; +print DEP "$DEP\n"; +close DEP; + +# end of job +exit 0; + + +############################################################# +# get all header files in all sub directories ... +# + +sub scan_dir { + my $dir = $_[0]; + + # search subtree for header files ... + open (FILES, "find $dir |") or die "cannot find directory \"$dir\"."; + + while () { + chomp; + next unless /^.*\/+(.*\.d?h)$/; + next if /\.\#/; + next if /source/; # we are not interested in these files + next if /struct/; # we are not interested in these files + $header_files{$1} = $_; # store file and path of file + } + close FILES; +} # end of scan_dir() + + +############################################################# +# scan given file ... +# + +sub scan_file { + my $file = $_[0]; + my $file_handle = new FileHandle; + + # open file ... + open $file_handle, $header_files{$file} or die "cannot find file $file\n"; + + # scan file + my $have_found_TAG = 0; + while (1) { + + # search for node TAG + while (<$file_handle>) { + last if /^\s*=[A-Z]/; + } + + # is there a node TAG ? + unless (/^\s*(\/\*)?\s*(=[A-Z]+)/) { + print STDERR "[$file] -- no doc --\n" if $VERBOSE and not $have_found_TAG; + close $file_handle or die "wrong file handle"; + return; + } + + # prepare line with node TAG + s/^\s*//; s/\s*$//; # trim blanks + my $node_line = $_; # store line + + # have found node TAG + (my $node_type, my $node_name, my $node_title) = split /\s+/, $node_line, 3; + + # print info on screen + print STDERR "[$file] $node_type ($node_name):\t" if $VERBOSE; + + # is this a valid node TAG + unless ($node_TAGs{$node_type}) { + print STDERR "\n\t[$file] invalid node TAG `$node_type' (skip over rest of file)\n"; + close $file_handle or die "wrong file handle"; + return; + } + + # node must be unique + if ($LIST_nodes->{$node_name}) { + print STDERR "\n\t[$file] node `$node_name' used twice (skip over node)\n"; + close $file_handle or die "wrong file handle"; + return; + } + + # store node name + $LIST_nodes->{$node_name} = 1; + $have_found_TAG = 1; + + # read till end of node + my $node_text = $node_line."\n"; + while (<$file_handle>) { + if (/^\s*(\/\*)?\s*=EON/) { + # End-Of-Node TAG + last; + } + else { + # add line to stored text + s/^\s*//; s/\s*$//; # trim blanks + $node_text .= $_."\n"; # store content of node + } + } + + # add dependency + $DEP .= "$header_files{$file} "; + + # now scan node text; + scan_node($node_text, $file); + } + +} # end of scan_file() + + +############################################################# +# scan mode ... +# + +sub scan_node { + my $node_text = $_[0]; + my $file = $_[1]; + + # add =END TAG to text (for convienience) + $node_text .= "\n=END"; + + # split into lines + my @lines = split /\n/, $node_text; + + # first line contains node definition + my $node_line = shift @lines; + + # get node name + (my $node_type, my $node_name, my $node_title) = split /\s+/, $node_line, 3; + + # store node + $IN->{$node_name}->{"=NODE_TYPE"} = $node_type; + $IN->{$node_name}->{"=TITLE"} = $node_title; + $IN->{$node_name}->{"=FILE"} = $file; + + # scan all TAGs (node sections) + my $this_TAG = "=END"; # add =END tag to node TAG + + foreach my $l (@lines) { + # next TAG ? + if ($l =~ /^\s*(\/\*)?\s*(=[A-Z]+)\s*(.*)$/) { + # store next TAG + $this_TAG = $2; + # save rest of line + $l = $3; + print STDERR " $this_TAG" if $VERBOSE and $this_TAG ne "=END"; + unless ($TAGs{$this_TAG}) { + print STDERR "\n\t[$file] $node_name: invalid TAG `$this_TAG'\n"; + last; + } + } + + # append to stored lines + # (except for =END TAG) + unless ($this_TAG eq "=END") { + $IN->{$node_name}->{$this_TAG} .= $l."\n"; + } + } + + # scan and format all node sections + foreach my $tag (keys %TAGs) { + &{$TAGs{$tag}{"scan"}} ($node_name,$tag); + # make some modifications + transform_special_strings(\($IN->{$node_name}->{$tag})); + } + + # close line on screen + print STDERR "\n" if $VERBOSE; + + # there must be an UP TAG + die "UP missing for node $node_name" unless $IN->{$node_name}->{"=UP"}; + +} # end of scan_node() + + +############################################################# +# check node structure +# +sub check_node_structure { + + # we need a TOP node + die "TOP node missing" unless $IN->{TOP}; + + # add node `(dir)' to list of node + $LIST_nodes->{"(dir)"} = 1; + + # check =UP nodes + foreach my $n (keys %{$IN}) { + unless ($LIST_nodes->{$IN->{$n}->{"=UP"}}) { + print STDERR "$n: invalid UP node `".$IN->{$n}->{"=UP"}."'\n"; + } + } + + # sort nodes + @LIST_nodes_sorted = sort nodes_by_order_tag keys %$LIST_nodes; + + # print node structure + print_node("TOP",""); + +} # end of check_node_structure() + +sub print_node { + my $node = $_[0]; # node for which all subnodes should be printed + my $indent = $_[1]; # line indent + + # print node on screen + print STDERR "$indent$node: (".$IN->{$node}->{"=TITLE"}.")\n" if $VERBOSE; + + # search for all subnodes + foreach my $n (@LIST_nodes_sorted) { + next unless $IN->{$n}->{"=UP"} eq $node; + print_node($n,"$indent\t"); + } + +} # end if print_node() + + +############################################################# +# compare two nodes by their order TAG (lexicographically) +# + +sub nodes_by_order_tag { + $IN->{$a}->{"=ORDERING"} cmp $IN->{$b}->{"=ORDERING"}; +} + + +############################################################# +# make texinfo output +# + +sub texi_node { + my $node = $_[0]; # node for which all subnodes should be printed + my $level = $_[1]; # level for node. + + # make section type + my $section = ''; + if ($IN->{$node}->{"=NODE_TYPE"} eq "=APPENDIX") { + LEVEL: { + if ($level == 0) { # TOP node + $section = "\@top "; + last LEVEL; } + if ($level == 1) { + $section = "\@appendix "; + last LEVEL; } + if ($level == 2) { + $section = "\@appendixsec"; + last LEVEL; } + if ($level == 3) { + $section = "\@appendixsubsec "; + last LEVEL; } + if ($level >= 4) { + $section = "\@appendixsubsubsec "; + last LEVEL; } + } + } + else { + LEVEL: { + if ($level == 0) { # TOP node + $section = "\@top "; + last LEVEL; } + if ($level == 1) { + $section = "\@chapter "; + last LEVEL; } + if ($level == 2) { + $section = "\@section "; + last LEVEL; } + if ($level == 3) { + $section = "\@subsection "; + last LEVEL; } + if ($level >= 4) { + $section = "\@subsubsection "; + last LEVEL; } + } + } + + # make title + my $title = $IN->{$node}->{"=TITLE"}; + if ($IN->{$node}->{"=NODE_TYPE"} eq "=METHOD") { + $title = "$node -- ".$IN->{$node}->{"=TITLE"}; + } + if ($IN->{$node}->{"=NODE_TYPE"} eq "=DISTR") { + $title = "\@code{$node} -- ".$IN->{$node}->{"=TITLE"}."\n"; + $title .= "\@anchor{funct:unur_distr_$node}\n"; + $title .= "\@findex unur_distr_$node\n"; + } + + # make menu + my $menu; + foreach my $n (@LIST_nodes_sorted) { + next unless $IN->{$n}->{"=UP"} eq $node; + $menu .= "* $n\:\: ".$IN->{$n}->{"=TITLE"}."\n"; + } + if ($menu) { + $menu = "\@menu\n".$menu."\@end menu\n\n"; + } + + # print header file name + $TEXI .= "\@c -------------------------------------\n"; + $TEXI .= "\@c ".$IN->{$node}->{"=FILE"}."\n"; + $TEXI .= "\@c\n\n"; + + # page break (?) + if ($PAGEBREAKS) { + if (($IN->{$node}->{"=NODE_TYPE"} eq "=METHOD") or + ($IN->{$node}->{"=NODE_TYPE"} eq "=NODEX")) { + $TEXI .= "\@page\n"; } + } + + # print node and section + $TEXI .= "\@node $node\n"; + $TEXI .= "$section $title\n\n"; + + # print menu + $TEXI .= $menu; + + # print REQUIRED, OPTIONAL, etc. of method + if ($IN->{$node}->{"=NODE_TYPE"} eq "=METHOD") { + if ($IN->{$node}->{"=REQUIRED"}) { + $TEXI .= "\@table \@i\n"; + if ($IN->{$node}->{"=REQUIRED"}) { + $TEXI .= "\@item Required:\n".$IN->{$node}->{"=REQUIRED"}."\n"; + } + if ($IN->{$node}->{"=OPTIONAL"}) { + $TEXI .= "\@item Optional:\n".$IN->{$node}->{"=OPTIONAL"}."\n"; + } + if ($IN->{$node}->{"=SPEED"}) { + $TEXI .= "\@item Speed:\n".$IN->{$node}->{"=SPEED"}."\n"; + } + if ($IN->{$node}->{"=REINIT"}) { + $TEXI .= "\@item Reinit:\n".$IN->{$node}->{"=REINIT"}."\n"; + } + if ($IN->{$node}->{"=REF"}) { + $TEXI .= "\@item Reference:\n".$IN->{$node}->{"=REF"}."\n"; + } + $TEXI .= "\@end table\n\n"; + } + } + + # print PDF, domain, etc. distribution + if ($IN->{$node}->{"=NODE_TYPE"} eq "=DISTR") { + $TEXI .= "\@table \@i\n"; + if ($IN->{$node}->{"=PDF"}) { + $TEXI .= "\@item PDF:\n".$IN->{$node}->{"=PDF"}."\n"; + } + if ($IN->{$node}->{"=PMF"}) { + $TEXI .= "\@item PMF:\n".$IN->{$node}->{"=PMF"}."\n"; + } + if ($IN->{$node}->{"=CONST"}) { + $TEXI .= "\@item constant:\n".$IN->{$node}->{"=CONST"}."\n"; + } + if ($IN->{$node}->{"=CDF"}) { + $TEXI .= "\@item CDF:\n".$IN->{$node}->{"=CDF"}."\n"; + } + if ($IN->{$node}->{"=DOMAIN"}) { + $TEXI .= "\@item domain:\n".$IN->{$node}->{"=DOMAIN"}."\n"; + } + if ($IN->{$node}->{"=FPARAM"}) { + $TEXI .= $IN->{$node}->{"=FPARAM"}; + } + if ($IN->{$node}->{"=REF"}) { + $TEXI .= "\@item reference:\n".$IN->{$node}->{"=REF"}."\n"; + } + if ($IN->{$node}->{"=STDGEN"}) { + $TEXI .= "\@item special generators:\n".$IN->{$node}->{"=STDGEN"}."\n"; + } + $TEXI .= "\@end table\n\n"; + } + + # print description + $TEXI .= $IN->{$node}->{"=DESCRIPTION"}; + + # print howtouse + if ($IN->{$node}->{"=HOWTOUSE"}) { + $TEXI .= "\n\@subsubheading How To Use\n\n"; + $TEXI .= $IN->{$node}->{"=HOWTOUSE"}."\n\n"; + } + + # print function reference + if ($IN->{$node}->{"=ROUTINES"}) { + $TEXI .= "\n\@subheading Function reference\n\n"; + if ($LISTOFCALLS) { + $TEXI .= $IN->{$node}->{"=ROUTINESLIST"}."\n\n"; } + $TEXI .= $IN->{$node}->{"=ROUTINES"}."\n\n"; + } + + # print `end of header file' + $TEXI .= "\n\@c\n"; + $TEXI .= "\@c end of ".$IN->{$node}->{"=FILE"}."\n"; + $TEXI .= "\@c -------------------------------------\n"; + + # search for all subnodes + foreach my $n (@LIST_nodes_sorted) { + next unless $IN->{$n}->{"=UP"} eq $node; + + # print all sub nodes + texi_node($n,$level+1); + } + +} # end of texi_node() + + +############################################################# +# scan bibligraphic references +# + +sub scan_REF { + my $node_name = $_[0]; # name of node + my $tag = $_[1]; # TAG (node section) + + # content of node + my $entry = $IN->{$node_name}->{$tag}; + + # empty ? + return unless $entry; + + # split into entries + my @bibrefs = split /\]\s*\[/, $entry; + + # now print entries + $IN->{$node_name}->{$tag} = ""; + foreach my $bre (@bibrefs) { + $bre =~ s/[\[\]]//g; # remove all square brackets + $IN->{$node_name}->{$tag} .= transform_bibref($bre); + } + +} # end of scan_REF() + + +############################################################# +# texify string +# + +sub texify_string { + my $string = $_[0]; + + # infinity --> oo + $string =~ s/(infinity)/\\infty/g; + + # replace '*' by space + $string =~ s/\*/\\, /g; + + # name of functions + $string =~ s/(exp|log|max|min|sqrt|det)/\\$1/g; + + # greek letters + $string =~ s/($greeks)/\\$1/g; + + # <, <=, etc. + $string =~ s/<=/\\leq/g; + $string =~ s/>=/\\geq/g; + + # fractions + $string =~ s/\\frac\{([^\}]+)\}\{([^\}]+)\}/\{$1\\over $2\}/g; + + return $string; + +} # end of texify_string() + + + +############################################################# +# scan domain for distribution +# + +sub scan_DOMAIN { + my $node_name = $_[0]; # name of node + my $tag = $_[1]; # TAG (node section) + + # content of node + my $entry = $IN->{$node_name}->{$tag}; + + # empty ? + return unless $entry; + + # trim heading blanks + $entry =~ s/^\s*//; + + # chop off trailing blanks + $entry =~ s/\s+$//; + + # remove newlines + $entry =~ s/\n+/ /g; + + # format tex output + my $texentry = texify_string($entry); + + # return result + $IN->{$node_name}->{$tag} = "\@iftex\n\@tex\n\$$texentry\$\n\@end tex\n\@end iftex\n"; + $IN->{$node_name}->{$tag} .= "\@ifnottex\n$entry\n\@end ifnottex\n"; + +} # end of scan_DOMAIN() + + +############################################################# +# scan PDF for distribution +# + +sub scan_PDF { + my $node_name = $_[0]; # name of node + my $tag = $_[1]; # TAG (node section) + my $texentry; # content of node converted to TeX + + # content of node + my $entry = $IN->{$node_name}->{$tag}; + + # empty ? + return unless $entry; + + # trim heading blanks + $entry =~ s/^\s*//; + + # chop off trailing blanks + $entry =~ s/\s+$//; + + # remove newlines + $entry =~ s/\n+/ /g; + + # text mode + if ($entry =~ /\@text\{(.*)\}/) { + $texentry = $1; + $entry = $1; + } + + else { + # format tex output + $texentry = "\$".texify_string($entry)."\$"; + + # format other output + $entry =~ s/\\over\s+/\//g; + + $entry =~ s/\\hbox\{\s*(\w+)\s*\}/ $1 /g; + $entry =~ s/\\hfil+\\break/\n\n/g; + + $entry =~ s/\\frac\{([^\}]+[\s\+\-]+[^\}]+)\}\{([^\}]+[\s\+\-]+[^\}]+)\}/\($1\)\/\($2\)/g; + $entry =~ s/\\frac\{([^\}]+)\}\{([^\}]+[\s\+\-]+[^\}]+)\}/$1\/\($2\)/g; + $entry =~ s/\\frac\{([^\}]+[\s\+\-]+[^\}]+)\}\{([^\}]+)\}/\($1\)\/$2/g; + $entry =~ s/\\frac\{([^\}]+)\}\{([^\}]+)\}/$1\/$2/g; + + $entry =~ s/\{/\(/g; + $entry =~ s/\}/\)/g; + } + + # return result + $IN->{$node_name}->{$tag} = "\@iftex\n\@tex\n$texentry\n\@end tex\n\@end iftex\n"; + $IN->{$node_name}->{$tag} .= "\@ifnottex\n$entry\n\@end ifnottex\n"; + +} # end of scan_PDF() + + +############################################################# +# scan list of parameters for distribution +# + +sub scan_FPARAM { + my $node_name = $_[0]; # name of node + my $tag = $_[1]; # TAG (node section) + + # content of node + my $entry = $IN->{$node_name}->{$tag}; + + # empty ? + return unless $entry; + + # trim heading blanks + $entry =~ s/^\s*//; + + # chop off trailing blanks + $entry =~ s/\s+$//; + + # remove blanks around `:' + $entry =~ s/[ \t]*\:[ \t]*/\:/g; + + # split into lines + my @lines = split /\n+/, $entry; + + # process lines + my $out; + my $texout; + my $flist; + my $n_total = 0; + my $n_optional = 0; + my $opt_level; + my $last_opt_level; + + foreach my $l (@lines) { + # each line must start with a [\d+] + next unless $l =~ /\[*\d+/; + # split into columns + my @cols = split /\:/, $l; + die "\nwrong number of columns for =FPARAM: $#cols" if $#cols != 4; + + # get entries + my $number = $cols[0]; + $number =~ s/(.*)(\d+).*/\[$2\]/; + $opt_level = $1; + + my $name = $cols[1]; + my $cond = $cols[2]; + my $default = $cols[3]; + my $type = $cols[4]; + + # append list of parameters + if ($opt_level ne $last_opt_level) { + $last_opt_level = $opt_level; + $flist .= " ["; + } + if ($n_total) { + $flist .= ", $name"; + } + else { + $flist .= " $name"; + } + + # process + $out .= "\@item \@code{$number} \@tab $name \@tab $cond \@tab $default \@tab \@i{($type)}\n"; + + $texout .= "\@item \@code{$number}\n"; + $texout .= "\@tab\@tex\$$name \$\@end tex\n"; + $texout .= "\@tab\@tex\$$cond \$\@end tex\n"; + $texout .= "\@tab $default\n"; + $texout .= "\@tab (\@i{$type})\n"; + + ++$n_total; + ++$n_optional if length $default; + } + my $n_required = $n_total - $n_optional; + + $last_opt_level =~ s/\[/ \]/g; + $flist .= $last_opt_level; + + # make TeX output + $texout =~ s/<=/\\leq/g; + $texout =~ s/>=/\\geq/g; + $texout =~ s/($greeks)(\W|\_)/\\$1$2/g; + + my $texout_header = "\@iftex\n"; + $texout_header .= "\@item parameters $n_required ($n_total): \@r{$flist}\n\n"; + $texout_header .= "\@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx}\n"; + $texout_header .= "\@item No. \@tab name \@tab \@tab default\n"; + + $IN->{$node_name}->{$tag} = $texout_header.$texout."\@end multitable\n\@end iftex\n"; + + # make other output + my $out_header = "\@ifnottex\n"; + $out_header .= "\@item parameters $n_required ($n_total): $flist\n"; + $out_header .= "\@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx}\n"; + $out_header .= "\@item No. \@tab name \@tab \@tab default\n"; + + $IN->{$node_name}->{$tag} .= $out_header.$out."\@end multitable\n\@end ifnottex\n"; + +} # end of scan_FPARAM() + + +############################################################# +# scan list of parameters for distribution +# + +sub scan_STDGEN { + my $node_name = $_[0]; # name of node + my $tag = $_[1]; # TAG (node section) + + # content of node + my $entry = $IN->{$node_name}->{$tag}; + + # empty ? + return unless $entry; + + # trim heading blanks + $entry =~ s/^\s*//; + + # chop off trailing blanks + $entry =~ s/\s+$//; + + # split into lines + my @lines = split /\n+/, $entry; + + my $out = "\@table \@code\n"; + + # process lines + foreach my $l (@lines) { + + # split into indicator and description + (my $id, my $body) = split /\s+/, $l, 2; + + if ($body =~ /\[(\w+)\]/) { + # there are references + my @references; + while ($body =~ /\[(\w+)\]/) { + $body =~ s /\[(\w+)\]\s*//; + push @references, $1; + } + $out .= "\@item $id\n"; + + # tex output + my $texbody = texify_string($body); + $texbody =~ s/(\@tex)/\n$1/g; + $texbody =~ s/(\@end\s+tex)/\n$1\n/g; + $out .= "\@iftex\n"; + $out .= $texbody; + foreach my $r (@references) { + $out .= " [$r]"; + } + $out .= "\n\@end iftex\n"; + + # remove tex marks + $body =~ s/\$//g; + $body =~ s/\@tex//g; + $body =~ s/\@end\s+tex//g; + + $out .= "\@ifhtml\n"; + $out .= "$body "; + foreach my $r (@references) { + $out .= "\@ref{bib:$r, [$r]} "; + } + $out .= "\n\@end ifhtml\n"; + + $out .= "\@ifinfo\n"; + $out .= "$body "; + foreach my $r (@references) { + $out .= "[$r] "; + } + $out .= "\n\@end ifinfo\n"; + } + + else { + # there is no reference + $out .= "\@item $id\n"; + $out .= "$body\n"; + } + } + + $out .= "\@end table\n"; + + # make other output + $IN->{$node_name}->{$tag} = $out; + +} # end of scan_STDGEN() + + +############################################################# +# chop off trailing blanks +# + +sub scan_chop_blanks { + my $node_name = $_[0]; # name of node + my $tag = $_[1]; # TAG (node section) + + # content of node + my $entry = $IN->{$node_name}->{$tag}; + + # trim heading blanks + $entry =~ s/^\s*//; + + # chop off trailing blanks + $entry =~ s/\s+$//; + + # remove newlines + $entry =~ s/\n+/ /g; + + # return result + $IN->{$node_name}->{$tag} = $entry; + +} # end of scan_chop_blanks() + + +############################################################# +# dummy routine +# + +sub scan_do_nothing { + my $node_name = $_[0]; # name of node + my $tag = $_[1]; # TAG (node section) + + # we have to process @unur macros + process_unur_macros("tex|html|info",\($IN->{$node_name}->{$tag})); + + # nothing else to do + return; +} # end of scan_do_nothing() + + +############################################################# +# scan TAG (node section) =UP +# + +sub scan_UP { + my $node_name = $_[0]; # name of node + my $tag = $_[1]; # TAG (node section); not used + + # content of node + my $entry = $IN->{$node_name}->{"=UP"}; + $entry =~ s/^\s*//; # trim heading blanks + + # we have two entries which are separated by blanks + # the first entry is the name of the UP node + # the second entry is used to order within this upper node + (my $upper_name, my $order) = split /\s+/, $entry, 2; + + # store upper node + $IN->{$node_name}->{"=UP"} = $upper_name; + + # extract string for ordering (lexicographic ordering is used) + if ($order =~ /\[(\w+)\]/) { + $IN->{$node_name}->{"=ORDERING"} = $1; + } + else { # use node name + $IN->{$node_name}->{"=ORDERING"} = $node_name; + } + +} # end if scan_UP() + + +############################################################# +# scan TAG (node section) =ROUTINES +# + +sub scan_ROUTINES { + my $node_name = $_[0]; # name of node + my $tag = $_[1]; # TAG (node section) + + # valid C data types + my @C_TYPES = ( "UNUR_PAR", + "UNUR_GEN", + "UNUR_DISTR", + "UNUR_URNG", + "UNUR_ERROR_HANDLER", + "UNUR_FUNCT_CONT", + "UNUR_FUNCT_CVEC", + "UNUR_VFUNCT_CVEC", + "FILE", + "extern", + "struct", + "const", + "void", + "int", + "double", + "float", + "long", + "char", + "short", + "unsigned", + "signed" ); + + # content of node + my $entry = $IN->{$node_name}->{"=ROUTINES"}; + + # trim heading blanks + $entry =~ s/^\s*//; + + # remove double blank lines + $entry =~ s/\n\s*\n\s*\n/\n\n/g; + + # simplify comment markers: /** --> /* + $entry =~ s/\/\*+/\/\*/g; + $entry =~ s/\*+\//\*\//g; + + # remove blanks and new lines inside comments at markers + $entry =~ s/\/\*\s+/\/\*/g; + $entry =~ s/\s+\*\//\*\//g; + + # remove blank lines at begin and end of entry + $entry =~ s/^(\s*\n)+//g; + $entry =~ s/(\s*\n)+$//g; + + # if there are blocks of comments, separated by empty lines + # then delete all but the first block of comments + ## $entry =~ s/\*\/\s*\n\s*\n\s*\/\*[.\n]*\*\//\*\//g; + + # split into blocks + my @blocks = split /\*\/\s*\n\s*\n/, $entry ; + + # store processed text + my $proc = ''; + + # local list of functions + my $listhtml; + my $listinfo; + + # deftypefn block closed + my $defblock_open = 0; + + # Store fuunction and anchor + my $fkt_block = ''; + my $anchor_block = ''; + + # process blocks + foreach my $block (@blocks) { + + # remove anyting that starts with an # + $block =~ s/^\#.*$//mg; + + # remove all comment markers + $block =~ s/\*\/\s*//g; + $block =~ s/\s*\/\*//g; + + # skill over empty blocks + next unless $block; + + # "verbatim" block ? + if ($block =~/^\s*==DOC/) { + # remove subTAG and copy text verbatim + $block =~ s/^\s*==DOC\s*//; + $proc .= "$block\n\n"; + next; # next block + } + + # split into function declaration and its description + (my $fkt, my $body) = split /\;/, $block, 2; + + # check function type + my $type_ok = 0; + foreach my $type (@C_TYPES) { + if ("$fkt " =~ /^\s*$type /) { + $type_ok = 1; + last; + } + } + # if this is not a valid type, skip to next block. + next unless $type_ok; + + # add blanks around braces + $fkt =~ s/\(/ \( /g; + $fkt =~ s/\)/ \) /g; + + # move pointer '*' from name to type + $fkt =~ s/\s+(\*+)/$1 /g; + + # get argument list of function + (my $fkt_decl, my $fn_args) = split /\s+\(\s+/, $fkt, 2; + $fn_args =~ s/\s*\)\s*$//; + my @argslist = split /\s*\,\s*/, $fn_args; + + # $fkt_decl should contain of at least two words + unless ($fkt_decl =~ /^\s*(.*)\s+([\*\w+]+)\s*$/ ) { + die "type or name missing for function: '$fkt_decl'"; + } + + # get function type and name + # the first part in $fkt_decl is the function type, + # the last word is the function name + my $fn_type = $1; + my $fn_name = $2; + + # routine name must be unique + die "Function defined twice: $fn_name" if $LIST_routines->{$fn_name}; + + # store in list of all routines + $LIST_routines->{$fn_name} = 1; + + # write entry + my $first = 1; + if (@argslist) { + # this is a function with arguments + + # store in table of routines + $listhtml .= "\@item \@ref{funct:$fn_name,$fn_name}\n"; + $listinfo .= "\@item $fn_name\n"; + + # make anchor + $anchor_block .= "\@anchor{funct:$fn_name}\n"; + # make texinfo tag + $fkt_block .= (($defblock_open) ? "\@deftypefnx" : "\@deftypefn"); + $fkt_block .= " %%%Function%%% \{$fn_type\} $fn_name ("; + foreach my $arg (@argslist) { + (my $type, my $arg_name) = split /\s+/, $arg, 2; + if ($first) { $first = 0; } + else { $fkt_block .= ", "; } + if ($arg_name) { + # we have to take care of args that are function points + if ($arg_name =~ /\s*\(/ ) { + $arg_name =~ s/\s*\(\s*/\(/g; + $arg_name =~ s/\s*\((\* )*(.*?)\s*\)\s*(.*)/\($1\@var\{$2\}\)$3/; + $fkt_block .= "$type $arg_name"; + } + else { + $arg_name =~ s/(.*?)(\s*\))*\s*$/\@var\{$1\}$2/; + $fkt_block .= "$type $arg_name"; + } + } + else { + $fkt_block .= "$type"; + } + } + $fkt_block .= ")\n"; + } + else { + # this is a function does not have arguments + # maybe it is an variable + + # store in table of routines + $listhtml .= "\@item \@ref{var:$fn_name,$fn_name}\n"; + $listinfo .= "\@item $fn_name\n"; + + # make anchor + $anchor_block .= "\@anchor{var:$fn_name}\n"; + # make texinfo tag + $fkt_block .= (($defblock_open) ? "\@deftypevarx" : "\@deftypevar"); + $fkt_block .= " \{$fn_type\} $fn_name\n"; + $fkt_block .= "\@findex $fn_name\n"; + } + # description + if ($body) { + $fkt_block .= "$body\n"; + if (@argslist) { + $fkt_block .= "\@end deftypefn\n"; } + else { + $fkt_block .= "\@end deftypevar\n"; } + $defblock_open = 0; + # for info file + my $fkt_string = $anchor_block . $fkt_block; + process_unur_macros("have_info",\$fkt_string); + $fkt_string =~ s/%%%Function%%%/Function/g; + $proc .= "\@ifinfo\n$fkt_string\@end ifinfo\n"; + # for other output formats + $fkt_string = $anchor_block . $fkt_block; + process_unur_macros("tex|html",\$fkt_string); + $fkt_string =~ s/%%%Function%%%/{}/g; + $proc .= "\@ifnotinfo\n$fkt_string\@end ifnotinfo\n\n"; + # clear blocks + $fkt_block = ''; + $anchor_block = ''; + } + else { + $defblock_open = 1; + } + } + + die "last function without description: $fkt_block" if $defblock_open; + + # make list of routines + my $listproc; + if ($listhtml) { + $listproc = "\@ifhtml\n\@itemize\n".$listhtml."\@end itemize\n\@end ifhtml\n"; + ## Currently we only display list of calls in HTML output + ## $listproc .= "\@ifnothtml\n\@itemize\n".$listinfo."\@end itemize\n\n\@end ifnothtml\n"; + } + + # store new lines + $IN->{$node_name}->{"=ROUTINES"} = $proc; + $IN->{$node_name}->{"=ROUTINESLIST"} = $listproc; + + return; + +} # end of scan_ROUTINES() + + +############################################################# +# format texinfo output for =NODE +# + +sub texi_NODE { + my $node = $_[0]; + + # node string is used AS IS. + return $node; +} # end of texi_TOP() + + +############################################################# +# transform special strings +# + +sub transform_special_strings { + my $line = $_[0]; + + # trim blanks + $$line =~ s/[ \t\r\f]+\n/\n/g; + + # @cc_start --> /* + # @cc_stop --> */ + $$line =~ s/\@cc_start/\/*/g; + $$line =~ s/\@cc_stop/*\//g; + + # NULL --> @code{NULL} + # TRUE --> @code{TRUE} + # FALSE --> @code{FALSE} + $$line =~ s/ (NULL|TRUE|FALSE)/ \@code\{$1\}/g; + $$line =~ s/^(NULL|TRUE|FALSE)/\@code\{$1\}/g; + $$line =~ s/\n(NULL|TRUE|FALSE)/\n\@code\{$1\}/g; + + # transform (\w+)\(\) --> @command($1) + my $first = "\n\@ifhtml\n\@ref\{funct:"; + my $middle = "\}\n\@end ifhtml\n\@ifnothtml\n"; + my $last = "\n\@end ifnothtml\n"; + + $$line =~ s/\s+(\w+)\(\)([\.\,\;\:])\s*/$first$1,\@command\{$1\}$2$middle\@command\{$1\}$2$last/g; + $$line =~ s/\s+(\w+)\(\)(\n|\s*)/$first$1,\@command\{$1\}$middle\@command\{$1\}$last/g; + +} # end of transform_special_strings() + + +############################################################# +# transform special strings +# + +sub process_unur_macros { + my $iftype = $_[0]; + my $lineptr = $_[1]; + my $line = $$lineptr; + + while ((my $macroidx = index $line, "\@unur") > -1) { + # start of macrobody + my $bodyidx = 1 + index $line, "{", $macroidx; + die "Cannot find opening brace for \@unur macro" unless $bodyidx > $macroidx; + # end of macrobody + my $idx = $bodyidx; + my $open = 1; + while ($open) { + ++$open if substr($line, $idx, 1) eq "{"; + --$open if substr($line, $idx, 1) eq "}"; + ++$idx; + die "Cannot find closing brace for \@unur macro" if $idx > length($line); + } + my $bodyendidx = $idx; + # get name of macro + my $macro = substr $line, $macroidx, $bodyidx-$macroidx-1; + # get body of macro + my $body = substr $line, $bodyidx, $bodyendidx-$bodyidx-1; + + # evaluate macro + my $replacement = ""; + + MACRO: { + if ($macro =~ /\@unurbibref\s*$/) { + $replacement = transform_bibref($body); + substr($line, $bodyendidx) =~ s/^[ \t]*\n?[ \t]*//; + last MACRO; + } + + if ($macro =~ /\@unurmath\s*$/) { + $replacement .= transform_tex($iftype,$body,0); + substr($line, $bodyendidx) =~ s/^[ \t]*\n?[ \t]*//; + last MACRO; + } + + if ($macro =~ /\@unurmathdisplay\s*$/) { + $replacement .= transform_tex($iftype,$body,1); + substr($line, $bodyendidx) =~ s/^[\s]+//s; + last MACRO; + } + + if ($macro =~ /\@unurimage\s*$/) { + $replacement = "\n\n\@image{$body}\n\n"; + last MACRO; + } + + else { + die "Unknown \@unur macro: $macro"; + } + } + + # replace macro + substr $line, $macroidx, $bodyendidx-$macroidx, $replacement; + + # trim white space + substr($line, 0, $macroidx) =~ s/[\s\n]+$/\n/s; + } + + $$lineptr = $line; +} # end of process_unur_macros() + + +############################################################# + +sub transform_bibref { + my $entry = $_[0]; # entry to be transformed + + # empty ? + return unless $entry; + + # remove newlines + $entry =~ s/\n+/ /g; + + # trim heading blanks + $entry =~ s/^\s*//; + + # chop off trailing blanks + $entry =~ s/\s+$//; + + # split into ref and optional remark + # which is separated by a colon + (my $anchor, my $remark) = split /[\:\,]\s*/, $entry, 2; + if ($remark) { + $remark =~ s/\,/\;/g; # we cannot use a comma here + $remark = ": $remark"; + } + + # output + my $entrywithlink = "\@ref{bib:$anchor,, [$anchor$remark]}"; + $entry = "[$anchor$remark]"; + + # output + my $output = + "\@ifhtml\n$entrywithlink\n\@end ifhtml\n". + "\@ifnothtml\n$entry\n\@end ifnothtml\n"; + + return $output; + +} # end of transform_bibref() + +############################################################# + +sub transform_tex { + my $iftype = $_[0]; + my $entry = $_[1]; # entry to be transformed + my $display = $_[2]; # whether this is a display or not + + my $tex; + my $html; + my $info; + + parse_tex($entry,\$tex,\$html,\$info); + + my $output; + + if ($iftype =~ /tex/) { + my $tmp = "\@math{$tex}\n"; + if ($display) { $tmp = "\n\@quotation\n".$tmp."\@end quotation\n\n"; } + unless ($iftype =~ /have_tex/) { $tmp = "\@iftex\n".$tmp."\@end iftex\n"; } + $output .= $tmp; + } + if ($iftype =~ /html/) { + my $tmp = "\@html\n$html\n\@end html\n"; + if ($display) { $tmp = "\@quotation\n".$tmp."\@end quotation\n"; } + unless ($iftype =~ /have_html/) { $tmp = "\@ifhtml\n".$tmp."\@end ifhtml\n"; } + $output .= $tmp; + } + if ($iftype =~ /info/) { + my $tmp = "\@math{$info}\n"; + if ($display) { $tmp = "\@quotation\n".$tmp."\@end quotation\n"; } + unless ($iftype =~ /have_info/) { $tmp = "\@ifinfo\n".$tmp."\@end ifinfo\n"; } + if ($display) { $tmp .= "\n"; } + $output .= $tmp; + } + + if ($display) { $output .= "\@noindent\n"; } + + return $output; + +} # end of transform_tex() + +############################################################# + +sub parse_tex { + my $entry = $_[0]; # entry to be parsed + + my $tex = $_[1]; # pointer to output string for all formats + my $html = $_[2]; + my $info = $_[3]; + + + # replace special characters + $entry =~ s/[\s\n]+/ /g; # trim blanks + $entry =~ s/\s*:\s*/\\colon /g; # : + $entry =~ s/\s*<=\s*/\\leq /g; # <= + $entry =~ s/\s*>=\s*/\\geq /g; # >= + $entry =~ s/\s*\\\{\s*/\\lbrace /g; # { + $entry =~ s/\s*\\\}\s*/\\rbrace /g; # } + + # scan TeX + my @token; + + until ($entry eq "") { + if ($entry =~ s/^(\s|\n)+//) { + # white space + push @token, {type=>"blank", value=>" "}; next; } + if ($entry =~ s/^([a-zA-Z]+)//) { + # text + push @token, {type=>"letter", value=>"$1"}; next; } + if ($entry =~ s/^([0-9]+)//) { + # number + push @token, {type=>"number", value=>"$1"}; next; } + if ($entry =~ s/^(\[|\]|\(|\)|\_|\'|\,|\;|\.|\=|\/|\+|\-|\<|\>|\|)//) { + # other printable symbols + push @token, {type=>"symbol", value=>"$1"}; next; } + + if ($entry =~ s/^\\([a-zA-Z]+)(\s*)//) { + # macro + push @token, {type=>"macro", value=>"\\$1$2"}; next; } + if ($entry =~ s/^\\(\\|\,|\;|{|})(\s*)//) { + # macro with special charcter + push @token, {type=>"macro", value=>"\\$1$2"}; next; } + + if ($entry =~ s/^(\_|\^|\.|\,|\!)//) { + # special characters + push @token, {type=>"special", value=>"$1"}; next; } + + if ($entry =~ /^\{/) { + # block --> find end of block + my $idx = 1; + my $open = 1; + while ($open) { + ++$open if substr($entry, $idx, 1) eq "{"; + --$open if substr($entry, $idx, 1) eq "}"; + ++$idx; + die "Cannot find closing brace for \@unur macro" if $idx > length($entry); + } + + # store block + my $block = substr $entry, 1, $idx-2; + push @token, {type=>"block", value=>"$block"}; + + # update $entry + $entry = substr $entry, $idx; + next; + } + + # else: unknown character: + print STDERR "\n\@unurmath: $entry\n"; + die "Unknown Character: '".substr($entry,0,1)."' "; + } + + # write text + while ( @token ) { + next_tex_token(\@token,$tex,$html,$info); + } + + # trim blanks + $$html =~ s/[\s\n]+/ /g; + $$html =~ s/^[\s\n]+//g; + $$html =~ s/[\s\n]+$//g; + $$info =~ s/[\s\n]+/ /g; + $$info =~ s/^[\s\n]+//g; + $$info =~ s/[\s\n]+$//g; + +} # end of parse_tex() + +############################################################# + +sub next_tex_token { + my $token = $_[0]; # pointer to token list + + my $tex = $_[1]; # pointer to output string for all formats + my $html = $_[2]; + my $info = $_[3]; + + # get next token + my $tok = shift @$token; + + # check token + die "token missing" unless $tok; + + my $type = $tok->{type}; + my $value = $tok->{value}; + + ## print STDERR "{type = $type\t value = $value}\n"; + + if ($type eq "block") { + $$tex .= "{"; + $$html .= ""; + $$info .= "("; + parse_tex($value,$tex,$html,$info); + $$tex .= "}"; + $$html .= ""; + $$info .= ")"; + return; + } + + # letters + if ($type =~ /^(letter)$/ ) { + $$tex .= $value; + $$html .= "$value"; + $$info .= $value; + return; + } + # numbers and symbols + if ($type =~ /^(blank|number|symbol)$/ ) { + $$tex .= $value; + $$html .= $value; + $$info .= $value; + return; + } + + # macros + if ($type eq "macro") { + if ($value =~ /^(\\;|\\,)\s*$/) { + # white spaces + $$tex .= $value; + $value =~ s/^(\\;|\\,)$/ /; + $$info .= $value; + $$html .= $value; + return; + } + if ($value =~ /^\\\\\s*$/) { + # new line + $$tex .= "\\hfil\\break "; + $$info .= "\@*"; + $$html .= "\@*"; + return; + } + if ($value =~ /^\\(colon|leq|geq|mapsto|times|rbrace|lbrace|ldots)\s*$/) { + # :, <=, >=, ->, x, {, } + $$tex .= $value; + $value =~ s/^\\(colon)\s*/ : /g; + $value =~ s/^\\(leq)\s*/ <= /g; + $value =~ s/^\\(geq)\s*/ >= /g; + $value =~ s/^\\(mapsto)\s*/ -> /g; + $value =~ s/^\\(times)\s*/x/g; + $value =~ s/^\\(rbrace)\s*/ \@} /g; + $value =~ s/^\\(lbrace)\s*/ \@{ /g; + $value =~ s/^\\(ldots)\s*/.../g; + $$html .= $value; + $$info .= $value; + return; + } + if ($value =~ /^\\(pm|infty|cdot)\s*$/) { + # +/-, infinity + $$tex .= $value; + $value =~ s/^\\(pm)\s*/ +\/- /g; + $value =~ s/^\\(infty)\s*/ infinity /g; + $value =~ s/^\\(cdot)\s*/ * /g; + $$html .= $value; + $$info .= $value; + return; + } + if ($value =~ /^\\(inf|sup|min|max|log|exp|det)\s*$/) { + # macros that are printed as is in non-TeX formats + $$tex .= $value; + $$html .= " $1"; + $$info .= " $1"; + return; + } + if ($value =~ /^\\(in|subset)\s*$/) { + # macros that are printed as is in non-TeX formats + $$tex .= $value; + $$html .= " $1 "; + $$info .= " $1 "; + return; + } + if ($value =~ /^\\($greeks)(\s*)$/) { + # greek letters + $$tex .= $value; + $$html .= " $1$2"; + $$info .= " $1$2"; + return; + } + if ($value =~ /^\\(limits)\s*$/) { + # macros that are ignored in non-TeX formats + $$tex .= $value; + return; + } + if ($value =~ /^\\(sqrt)\s*$/) { + # sqrt + $$tex .= $value; + $value =~ s/^\\(sqrt)\s*/sqrt/g; + $$html .= "$value("; + $$info .= $value; + next_tex_token($token,$tex,$html,$info); + $$html .= ")"; + $$info .= ""; + return; + } +# $$tex .= $value; +# $$html .= $value; +# $$info .= $value; +# return; + } + + # special characters + if ($type eq "special") { + if ($value =~ /^(\_|\^)$/) { + $$tex .= $value; + $$info .= $value; + $$html .= ($value =~ /^(\_)$/) ? "" : ""; + next_tex_token($token,$tex,$html,$info); + $$html .= ($value =~ /^(\_)$/) ? "" : ""; + return; + } + if ($value =~ /^(\.|\,|\!)$/) { + $$tex .= $value; + $$info .= $value; + $$html .= $value; + return; + } + } + + # else --> error + die "\nPanic: don't know what to do with type '$type', value = '$value'\n"; + +} # end of next_tex_token() + +############################################################# diff --git a/vendor/unuran-1.11.0/doc/src/methods.dh b/vendor/unuran-1.11.0/doc/src/methods.dh new file mode 100644 index 0000000..fdc8cee --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/methods.dh @@ -0,0 +1,227 @@ +/*---------------------------------------------------------------------------*/ + +=NODE Methods Methods for generating non-uniform random variates +=UP TOP [40] + +=DESCRIPTION + +Sampling from a particular distribution with UNU.RAN requires the +following steps: + +@enumerate +@item +Create a distribution object +(@pxref{Distribution_objects,,Handling distribution objects}). + +@item +Select a method and create a parameter object. + +@item +Initizialize the generator object using unur_init(). + +@emph{Important}: Initialization of the generator object might fail. +unur_init() returns a NULL pointer then, which @strong{must} not be +used for sampling. + +@item +Draw a sample from the generator object using the +corresponding sampling function (depending on the type of +distribution: +univariate continuous, univariate discrete, multivariate +continuous, and random matrix). + +@item +It is possible for a generator object to change the parameters and the +domain of the underlying distribution. This must be done by extracting +this object by means of a unur_get_distr() call and +changing the distribution using the correspondig set calls, +see @ref{Distribution_objects,,Handling distribution objects}. +The generator object @strong{must} then be reinitialized by means of +the unur_reinit() call. + +@emph{Important}: Currently not all methods allow reinitialization, +see the description of the particular method (keyword @i{Reinit}). + +@emph{Important}: Reinitialization of the generator object might fail. +Thus one @strong{must} check the return code of the unur_reinit() call. + +@emph{Important}: When reinitialization fails then sampling routines +always return @code{UNUR_INFINITY} (for continuous distributions) or @code{0} (for +discrete distributions), respectively. +However, it is still possible to change the underlying distribution +and try to reinitialize again. + +@end enumerate + +=EON + +/*---------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ + +=NODEX Methods_for_CONT Methods for continuous univariate distributions +=UP Methods [10] + +=DESCRIPTION + +@subheading Overview of methods + +@include methods_cont.texi + +@subheading Example + +@smallexample +@include ref_example_cont.texi +@end smallexample + +@subheading Example (String API) + +@smallexample +@include ref_example_cont_str.texi +@end smallexample + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Methods_for_CEMP Methods for continuous empirical univariate distributions +=UP Methods [20] +=DESCRIPTION + +@subheading Overview of methods + +@include methods_cemp.texi + +@subheading Example + +@smallexample +@include ref_example_emp.texi +@end smallexample + +@subheading Example (String API) + +@smallexample +@include ref_example_emp_str.texi +@end smallexample + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Methods_for_CVEC Methods for continuous multivariate distributions +=UP Methods [30] +=DESCRIPTION + +@subheading Overview of methods + +@include methods_cvec.texi + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX MCMC_Methods_for_CVEC Markov chain samplers for continuous multivariate distributions +=UP Methods [35] +=DESCRIPTION + +Markov chain samplers generate sequences of random vectors which have +the target distribution as stationary distribution. +There generated vectors are (more or less) correlated and it might take a long +time until the sequence has converged to the given target distribution. + +@strong{Beware: MCMC sampling can be dangerous!} + +@subheading Overview of methods + +@include methods_mcmc.texi + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Methods_for_CVEMP Methods for continuous empirical multivariate distributions +=UP Methods [40] +=DESCRIPTION + +@subheading Overview of methods + +@include methods_cvemp.texi + +@subheading Example + +@smallexample +@include ref_example_vemp.texi +@end smallexample + +@subheading Example (String API) + +(not implemented) + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Methods_for_DISCR Methods for discrete univariate distributions +=UP Methods [50] +=DESCRIPTION + +@subheading Overview of methods + +@include methods_discr.texi + +@subheading Example + +@smallexample +@include ref_example_discr.texi +@end smallexample + +@subheading Example (String API) + +@smallexample +@include ref_example_discr_str.texi +@end smallexample + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Methods_for_MATR Methods for random matrices +=UP Methods [60] +=DESCRIPTION + +@subheading Overview of methods + +@include methods_matr.texi + +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Methods_for_UNID Methods for uniform univariate distributions +=UP Methods [70] +=DESCRIPTION +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Meta_Methods Meta Methods for univariate distributions +=UP Methods [80] + +=DESCRIPTION + +@subheading Example + +@smallexample +@include ref_example_mixt.texi +@end smallexample + +@subheading Example (Inversion) + +@smallexample +@include ref_example_mixt_inv.texi +@end smallexample + +=EON + +/*---------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/doc/src/methods_cemp.texi b/vendor/unuran-1.11.0/doc/src/methods_cemp.texi new file mode 100644 index 0000000..ac7ccb3 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/methods_cemp.texi @@ -0,0 +1,9 @@ +@cartouche +@noindent +Methods for @b{continuous empirical univariate distributions}@* +sample with @command{unur_sample_cont} + +@noindent +EMPK: Requires an observed sample. @* +EMPL: Requires an observed sample. +@end cartouche diff --git a/vendor/unuran-1.11.0/doc/src/methods_cont.texi b/vendor/unuran-1.11.0/doc/src/methods_cont.texi new file mode 100644 index 0000000..06b9a6f --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/methods_cont.texi @@ -0,0 +1,26 @@ +@cartouche +@noindent +Methods for @b{continuous univariate distributions}@* +sample with @command{unur_sample_cont} + +@multitable {method} {PDF} {dPDF} {CDF} {mode} {area} {build-in standard distributionxx} +@item method @tab PDF @tab dPDF @tab CDF @tab mode @tab area @tab other +@item AROU @tab x @tab x @tab @tab [x] @tab @tab T-concave +@item ARS @tab x @tab x @tab @tab @tab @tab T-concave +@item CEXT @tab @tab @tab @tab @tab @tab wrapper for external generator +@item CSTD @tab @tab @tab @tab @tab @tab build-in standard distribution +@item HINV @tab [x] @tab [x] @tab x @tab @tab @tab +@item HRB @tab @tab @tab @tab @tab @tab bounded hazard rate +@item HRD @tab @tab @tab @tab @tab @tab decreasing hazard rate +@item HRI @tab @tab @tab @tab @tab @tab increasing hazard rate +@item ITDR @tab x @tab x @tab @tab x @tab @tab monotone with pole +@item NINV @tab [x] @tab @tab x @tab @tab @tab +@item NROU @tab x @tab @tab @tab [x] @tab @tab +@item PINV @tab x @tab @tab [x] @tab [~] @tab @tab +@item SROU @tab x @tab @tab @tab x @tab x @tab T-concave +@item SSR @tab x @tab @tab @tab x @tab x @tab T-concave +@item TABL @tab x @tab @tab @tab x @tab [~] @tab all local extrema +@item TDR @tab x @tab x @tab @tab @tab @tab T-concave +@item UTDR @tab x @tab @tab @tab x @tab ~ @tab T-concave +@end multitable +@end cartouche diff --git a/vendor/unuran-1.11.0/doc/src/methods_cvec.texi b/vendor/unuran-1.11.0/doc/src/methods_cvec.texi new file mode 100644 index 0000000..c26949d --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/methods_cvec.texi @@ -0,0 +1,11 @@ +@cartouche +@noindent +Methods for @b{continuous multivariate distributions}@* +sample with @command{unur_sample_vec} + +@noindent +NORTA: Requires rank correlation matrix and marginal distributions. @* +VNROU: Requires the PDF. @* +MVSTD: Generator for built-in standard distributions. @* +MVTDR: Requires PDF and gradiant of PDF. +@end cartouche diff --git a/vendor/unuran-1.11.0/doc/src/methods_cvemp.texi b/vendor/unuran-1.11.0/doc/src/methods_cvemp.texi new file mode 100644 index 0000000..2e449e7 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/methods_cvemp.texi @@ -0,0 +1,8 @@ +@cartouche +@noindent +Methods for @b{continuous empirical multivariate distributions}@* +sample with @command{unur_sample_vec} + +@noindent +VEMPK: Requires an observed sample. +@end cartouche diff --git a/vendor/unuran-1.11.0/doc/src/methods_discr.texi b/vendor/unuran-1.11.0/doc/src/methods_discr.texi new file mode 100644 index 0000000..4043711 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/methods_discr.texi @@ -0,0 +1,16 @@ +@cartouche +@noindent +Methods for @b{discrete univariate distributions}@* +sample with @command{unur_sample_discr} + +@multitable {method} {PMF} {PV} {mode} {area} {build-in standard distribution} +@item method@tab PMF @tab PV @tab mode @tab sum @tab other +@item DARI @tab x @tab @tab x @tab ~ @tab T-concave +@item DAU @tab [x] @tab x @tab @tab @tab +@item DEXT @tab @tab @tab @tab @tab wrapper for external generator +@item DGT @tab [x] @tab x @tab @tab @tab +@item DSROU @tab x @tab @tab x @tab x @tab T-concave +@item DSS @tab [x] @tab x @tab @tab x @tab +@item DSTD @tab @tab @tab @tab @tab build-in standard distribution +@end multitable +@end cartouche diff --git a/vendor/unuran-1.11.0/doc/src/methods_matr.texi b/vendor/unuran-1.11.0/doc/src/methods_matr.texi new file mode 100644 index 0000000..acd5be1 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/methods_matr.texi @@ -0,0 +1,8 @@ +@cartouche +@noindent +Methods for @b{matrix distributions}@* +sample with @command{unur_sample_matr} + +@noindent +MCORR: Distribution object for random correlation matrix. +@end cartouche diff --git a/vendor/unuran-1.11.0/doc/src/methods_mcmc.texi b/vendor/unuran-1.11.0/doc/src/methods_mcmc.texi new file mode 100644 index 0000000..3609feb --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/methods_mcmc.texi @@ -0,0 +1,13 @@ +@cartouche +@noindent +Markov Chain Methods for @b{continuous multivariate distributions}@* +sample with @command{unur_sample_vec} + +@noindent +GIBBS: T-concave logPDF and derivatives of logPDF. @* +HITRO: Requires PDF. +@end cartouche + + + + diff --git a/vendor/unuran-1.11.0/doc/src/misc.dh b/vendor/unuran-1.11.0/doc/src/misc.dh new file mode 100644 index 0000000..02882ff --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/misc.dh @@ -0,0 +1,8 @@ + +/*---------------------------------------------------------------------------*/ + +=NODE Misc Miscelleanous +=UP TOP [80] +=EON + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/doc/src/ref_example0.texi b/vendor/unuran-1.11.0/doc/src/ref_example0.texi new file mode 100644 index 0000000..8cf80e3 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example0.texi @@ -0,0 +1,69 @@ +/* ------------------------------------------------------------- */ +/* File: example0.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use a predefined standard distribution: */ + /* Gaussian with mean zero and standard deviation 1. */ + /* Since this is the standard form of the distribution, */ + /* we need not give these parameters. */ + distr = unur_distr_normal(NULL, 0); + + /* Use method AUTO: */ + /* Let UNURAN select a suitable method for you. */ + par = unur_auto_new(distr); + + /* Now you can change some of the default settings for the */ + /* parameters of the chosen method. We don't do it here. */ + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ + diff --git a/vendor/unuran-1.11.0/doc/src/ref_example0_str.texi b/vendor/unuran-1.11.0/doc/src/ref_example0_str.texi new file mode 100644 index 0000000..a6cbf19 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example0_str.texi @@ -0,0 +1,52 @@ +/* ------------------------------------------------------------- */ +/* File: example0_str.c */ +/* ------------------------------------------------------------- */ +/* String API. */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a predefined standard distribution: */ + /* Standard Gaussian distribution. */ + /* Use method AUTO: */ + /* Let UNURAN select a suitable method for you. */ + gen = unur_str2gen("normal()"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ + diff --git a/vendor/unuran-1.11.0/doc/src/ref_example1.texi b/vendor/unuran-1.11.0/doc/src/ref_example1.texi new file mode 100644 index 0000000..1923c44 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example1.texi @@ -0,0 +1,70 @@ +/* ------------------------------------------------------------- */ +/* File: example1.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use a predefined standard distribution: */ + /* Gaussian with mean zero and standard deviation 1. */ + /* Since this is the standard form of the distribution, */ + /* we need not give these parameters. */ + distr = unur_distr_normal(NULL, 0); + + /* Choose a method: AROU. */ + /* For other (suitable) methods replace "arou" with the */ + /* respective name (in lower case letters). */ + par = unur_arou_new(distr); + + /* Now you can change some of the default settings for the */ + /* parameters of the chosen method. We don't do it here. */ + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ + diff --git a/vendor/unuran-1.11.0/doc/src/ref_example1_str.texi b/vendor/unuran-1.11.0/doc/src/ref_example1_str.texi new file mode 100644 index 0000000..1918623 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example1_str.texi @@ -0,0 +1,53 @@ +/* ------------------------------------------------------------- */ +/* File: example1_str.c */ +/* ------------------------------------------------------------- */ +/* String API. */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a predefined standard distribution: */ + /* Standard Gaussian distribution. */ + /* Choose a method: AROU. */ + /* For other (suitable) methods replace "arou" with the */ + /* respective name. */ + gen = unur_str2gen("normal() & method=arou"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ + diff --git a/vendor/unuran-1.11.0/doc/src/ref_example2.texi b/vendor/unuran-1.11.0/doc/src/ref_example2.texi new file mode 100644 index 0000000..a7dd339 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example2.texi @@ -0,0 +1,115 @@ +/* ------------------------------------------------------------- */ +/* File: example2.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* In this example we build a distribution object from scratch */ +/* and sample from this distribution. */ +/* */ +/* We use method TDR (Transformed Density Rejection) which */ +/* required a PDF and the derivative of the PDF. */ + +/* ------------------------------------------------------------- */ + +/* Define the PDF and dPDF of our distribution. */ +/* */ +/* Our distribution has the PDF */ +/* */ +/* / 1 - x*x if |x| <= 1 */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ + +/* The PDF of our distribution: */ +double mypdf( double x, const UNUR_DISTR *distr ) + /* The second argument (`distr') can be used for parameters */ + /* for the PDF. (We do not use parameters in our example.) */ +@{ + if (fabs(x) >= 1.) + return 0.; + else + return (1.-x*x); +@} /* end of mypdf() */ + +/* The derivative of the PDF of our distribution: */ +double mydpdf( double x, const UNUR_DISTR *distr ) +@{ + if (fabs(x) >= 1.) + return 0.; + else + return (-2.*x); +@} /* end of mydpdf() */ + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create a new distribution object from scratch. */ + /* It is a continuous distribution, and we need a PDF and the */ + /* derivative of the PDF. Moreover we set the domain. */ + + /* Get empty distribution object for a continuous distribution */ + distr = unur_distr_cont_new(); + + /* Assign the PDF and dPDF (defined above). */ + unur_distr_cont_set_pdf( distr, mypdf ); + unur_distr_cont_set_dpdf( distr, mydpdf ); + + /* Set the domain of the distribution (optional for TDR). */ + unur_distr_cont_set_domain( distr, -1., 1. ); + + /* Choose a method: TDR. */ + par = unur_tdr_new(distr); + + /* Now you can change some of the default settings for the */ + /* parameters of the chosen method. We don't do it here. */ + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ + + diff --git a/vendor/unuran-1.11.0/doc/src/ref_example2_str.texi b/vendor/unuran-1.11.0/doc/src/ref_example2_str.texi new file mode 100644 index 0000000..962f392 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example2_str.texi @@ -0,0 +1,65 @@ +/* ------------------------------------------------------------- */ +/* File: example2_str.c */ +/* ------------------------------------------------------------- */ +/* String API. */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* In this example we use a generic distribution object */ +/* and sample from this distribution. */ +/* */ +/* The PDF of our distribution is given by */ +/* */ +/* / 1 - x*x if |x| <= 1 */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ +/* We use method TDR (Transformed Density Rejection) which */ +/* required a PDF and the derivative of the PDF. */ + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a generic continuous distribution. */ + /* Choose a method: TDR. */ + gen = unur_str2gen( + "distr = cont; pdf=\"1-x*x\"; domain=(-1,1) & method=tdr"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ + + diff --git a/vendor/unuran-1.11.0/doc/src/ref_example3.texi b/vendor/unuran-1.11.0/doc/src/ref_example3.texi new file mode 100644 index 0000000..ce3950b --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example3.texi @@ -0,0 +1,86 @@ +/* ------------------------------------------------------------- */ +/* File: example3.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + double fparams[2]; /* array for parameters for distribution */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use a predefined standard distribution: */ + /* Gaussian with mean 2. and standard deviation 0.5. */ + fparams[0] = 2.; + fparams[1] = 0.5; + distr = unur_distr_normal( fparams, 2 ); + + /* Choose a method: TDR. */ + par = unur_tdr_new(distr); + + /* Change some of the default parameters. */ + + /* We want to use T(x)=log(x) for the transformation. */ + unur_tdr_set_c( par, 0. ); + + /* We want to have the variant with immediate acceptance. */ + unur_tdr_set_variant_ia( par ); + + /* We want to use 10 construction points for the setup */ + unur_tdr_set_cpoints ( par, 10, NULL ); + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* It is possible with method TDR to truncate the distribution */ + /* for an existing generator object ... */ + unur_tdr_chg_truncated( gen, -1., 0. ); + + /* ... and sample again. */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/doc/src/ref_example3_str.texi b/vendor/unuran-1.11.0/doc/src/ref_example3_str.texi new file mode 100644 index 0000000..bce6f57 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example3_str.texi @@ -0,0 +1,63 @@ +/* ------------------------------------------------------------- */ +/* File: example3_str.c */ +/* ------------------------------------------------------------- */ +/* String API. */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a predefined standard distribution: */ + /* Gaussian with mean 2. and standard deviation 0.5. */ + /* Choose a method: TDR with parameters */ + /* c = 0: use T(x)=log(x) for the transformation; */ + /* variant "immediate acceptance"; */ + /* number of construction points = 10. */ + gen = unur_str2gen( + "normal(2,0.5) & method=tdr; c=0.; variant_ia; cpoints=10"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* It is possible with method TDR to truncate the distribution */ + /* for an existing generator object ... */ + unur_tdr_chg_truncated( gen, -1., 0. ); + + /* ... and sample again. */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/doc/src/ref_example_FuncStr.texi b/vendor/unuran-1.11.0/doc/src/ref_example_FuncStr.texi new file mode 100644 index 0000000..1011e59 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example_FuncStr.texi @@ -0,0 +1,39 @@ +/* ------------------------------------------------------------- */ +/* File: example_FuncStr.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* Example how to define the PDF for a continuous univariate */ +/* distribution using a function string. */ + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + UNUR_DISTR *distr; /* distribution object */ + char *pdfstr; + + /* Get empty distribution object for a continuous distribution */ + distr = unur_distr_cont_new(); + + /* Set PDF using function string */ + unur_distr_cont_set_pdfstr(distr,"1-x*x"); + unur_distr_cont_set_domain(distr,-1.,1.); + + /* Read function string from distribution object */ + pdfstr = unur_distr_cont_get_pdfstr(distr); + printf("functionstring: %s\n",pdfstr); + + /* Destroy distribution object and clear memory */ + unur_distr_free(distr); + free (pdfstr); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/doc/src/ref_example_anti.texi b/vendor/unuran-1.11.0/doc/src/ref_example_anti.texi new file mode 100644 index 0000000..2023031 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example_anti.texi @@ -0,0 +1,153 @@ +/* ------------------------------------------------------------- */ +/* File: example_anti.c */ +/* ------------------------------------------------------------- */ +#ifdef UNURAN_SUPPORTS_PRNG +/* ------------------------------------------------------------- */ +/* This example makes use of the PRNG library for generating */ +/* uniform random numbers. */ +/* (see http://statmath.wu.ac.at/prng/) */ +/* To compile this example you must have set */ +/* ./configure --with-urng-prng */ +/* (Of course the executable has to be linked against the */ +/* PRNG library.) */ +/* ------------------------------------------------------------- */ + +/* Example how to sample from two streams of antithetic random */ +/* variates from Gaussian N(2,5) and Gamma(4) distribution, resp.*/ + +/* ------------------------------------------------------------- */ + +/* Include UNURAN header files. */ +#include +#include + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + double xn, xg; /* will hold the random number */ + double fparams[2]; /* array for parameters for distribution */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen_normal, *gen_gamma; + /* generator objects */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng1, *urng2; /* uniform generator objects */ + + /* PRNG only: */ + /* Make a object for uniform random number generator. */ + /* For details see http://statmath.wu.ac.at/prng/. */ + + + /* The first generator: Gaussian N(2,5) */ + + /* uniform generator: We use the Mersenne Twister. */ + urng1 = unur_urng_prng_new("mt19937(1237)"); + if (urng1 == NULL) exit (EXIT_FAILURE); + + /* UNURAN generator object for N(2,5) */ + fparams[0] = 2.; + fparams[1] = 5.; + distr = unur_distr_normal( fparams, 2 ); + + /* Choose method TDR with variant PS. */ + par = unur_tdr_new( distr ); + unur_tdr_set_variant_ps( par ); + + /* Set uniform generator in parameter object. */ + unur_set_urng( par, urng1 ); + + /* Set auxilliary uniform random number generator. */ + /* We use the default generator. */ + unur_use_urng_aux_default( par ); + + /* Alternatively you can create and use your own auxilliary */ + /* uniform random number generator: */ + /* UNUR_URNG *urng_aux; */ + /* urng_aux = unur_urng_prng_new("tt800"); */ + /* if (urng_aux == NULL) exit (EXIT_FAILURE); */ + /* unur_set_urng_aux( par, urng_aux ); */ + + /* Create the generator object. */ + gen_normal = unur_init(par); + if (gen_normal == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* Destroy distribution object (gen_normal has its own copy). */ + unur_distr_free(distr); + + + /* The second generator: Gamma(4) with antithetic variates. */ + + /* uniform generator: We use the Mersenne Twister. */ + urng2 = unur_urng_prng_new("anti(mt19937(1237))"); + if (urng2 == NULL) exit (EXIT_FAILURE); + + /* UNURAN generator object for gamma(4) */ + fparams[0] = 4.; + distr = unur_distr_gamma( fparams, 1 ); + + /* Choose method TDR with variant PS. */ + par = unur_tdr_new( distr ); + unur_tdr_set_variant_ps( par ); + + /* Set uniform generator in parameter object. */ + unur_set_urng( par, urng2 ); + + /* Set auxilliary uniform random number generator. */ + /* We use the default generator. */ + unur_use_urng_aux_default( par ); + + /* Alternatively you can create and use your own auxilliary */ + /* uniform random number generator (see above). */ + /* Notice that both generator objects gen_normal and */ + /* gen_gamma can share the same auxilliary URNG. */ + + /* Create the generator object. */ + gen_gamma = unur_init(par); + if (gen_gamma == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* Destroy distribution object (gen_normal has its own copy). */ + unur_distr_free(distr); + + + /* Now we can sample pairs of negatively correlated random */ + /* variates. E.g.: */ + for (i=0; i<10; i++) @{ + xn = unur_sample_cont(gen_normal); + xg = unur_sample_cont(gen_gamma); + printf("%g, %g\n",xn,xg); + @} + + + /* When you do not need the generator objects any more, you */ + /* can destroy it. */ + unur_free(gen_normal); + unur_free(gen_gamma); + + /* We also should destroy the uniform random number generators.*/ + unur_urng_free(urng1); + unur_urng_free(urng2); + + exit (EXIT_SUCCESS); +@} /* end of main() */ + +/* ------------------------------------------------------------- */ +#else +#include +#include +int main(void) @{ + printf("You must enable the PRNG library to run this example!\n\n"); + exit (77); /* exit code for automake check routines */ +@} +#endif +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/doc/src/ref_example_anti_str.texi b/vendor/unuran-1.11.0/doc/src/ref_example_anti_str.texi new file mode 100644 index 0000000..0acd00a --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example_anti_str.texi @@ -0,0 +1,92 @@ +/* ------------------------------------------------------------- */ +/* File: example_anti_str.c */ +/* ------------------------------------------------------------- */ +/* String API. */ +/* ------------------------------------------------------------- */ +#ifdef UNURAN_SUPPORTS_PRNG +/* ------------------------------------------------------------- */ +/* This example makes use of the PRNG library for generating */ +/* uniform random numbers. */ +/* (see http://statmath.wu.ac.at/prng/) */ +/* To compile this example you must have set */ +/* ./configure --with-urng-prng */ +/* (Of course the executable has to be linked against the */ +/* PRNG library.) */ +/* ------------------------------------------------------------- */ + +/* Example how to sample from two streams of antithetic random */ +/* variates from Gaussian N(2,5) and Gamma(4) distribution, resp.*/ + +/* ------------------------------------------------------------- */ + +/* Include UNURAN header files. */ +#include +#include + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + double xn, xg; /* will hold the random number */ + + /* Declare UNURAN generator objects. */ + UNUR_GEN *gen_normal, *gen_gamma; + + /* PRNG only: */ + /* Make a object for uniform random number generator. */ + /* For details see http://statmath.wu.ac.at/prng/. */ + + /* Create the first generator: Gaussian N(2,5) */ + gen_normal = unur_str2gen("normal(2,5) & method=tdr; variant_ps & urng=mt19937(1237)"); + if (gen_normal == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + /* Set auxilliary uniform random number generator. */ + /* We use the default generator. */ + unur_chgto_urng_aux_default(gen_normal); + + /* The second generator: Gamma(4) with antithetic variates. */ + gen_gamma = unur_str2gen("gamma(4) & method=tdr; variant_ps & urng=anti(mt19937(1237))"); + if (gen_gamma == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + unur_chgto_urng_aux_default(gen_gamma); + + + /* Now we can sample pairs of negatively correlated random */ + /* variates. E.g.: */ + for (i=0; i<10; i++) @{ + xn = unur_sample_cont(gen_normal); + xg = unur_sample_cont(gen_gamma); + printf("%g, %g\n",xn,xg); + @} + + + /* When you do not need the generator objects any more, you */ + /* can destroy it. */ + + /* But first we have to destroy the uniform random number */ + /* generators. */ + unur_urng_free(unur_get_urng(gen_normal)); + unur_urng_free(unur_get_urng(gen_gamma)); + + unur_free(gen_normal); + unur_free(gen_gamma); + + + exit (EXIT_SUCCESS); +@} /* end of main() */ + +/* ------------------------------------------------------------- */ +#else +#include +#include +int main(void) @{ + printf("You must enable the PRNG library to run this example!\n\n"); + exit (77); /* exit code for automake check routines */ +@} +#endif +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/doc/src/ref_example_cext.texi b/vendor/unuran-1.11.0/doc/src/ref_example_cext.texi new file mode 100644 index 0000000..4fc20dc --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example_cext.texi @@ -0,0 +1,116 @@ +/* ------------------------------------------------------------- */ +/* File: example_cext.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* This example shows how an external generator for the */ +/* exponential distribution with one scale parameter can be */ +/* used within the UNURAN framework. */ +/* */ +/* Notice, that this example does not provide the simplest */ +/* solution. */ + +/* ------------------------------------------------------------- */ +/* Initialization routine. */ +/* */ +/* Here we simply read the scale parameter of the exponential */ +/* distribution and store it in an array for parameters of */ +/* the external generator. */ +/* [ Of course we could do this in the sampling routine as */ +/* and avoid the necessity of this initialization routine. ] */ + +int exponential_init (UNUR_GEN *gen) +@{ + /* Get pointer to parameters of exponential distribution */ + double *params = unur_cext_get_distrparams(gen); + + /* The scale parameter is the first entry (see manual) */ + double lambda = (params) ? params[0] : 1.; + + /* Get array to store this parameter for external generator */ + double *genpar = unur_cext_get_params(gen, sizeof(double)); + genpar[0] = lambda; + + /* Executed successfully */ + return UNUR_SUCCESS; +@} + +/* ------------------------------------------------------------- */ +/* Sampling routine. */ +/* */ +/* Contains the code for the external generator. */ + +double exponential_sample (UNUR_GEN *gen) +@{ + /* Get scale parameter */ + double *genpar = unur_cext_get_params(gen,0); + double lambda = genpar[0]; + + /* Sample a uniformly distributed random number */ + double U = unur_sample_urng(gen); + + /* Transform into exponentially distributed random variate */ + return ( -log(1. - U) * lambda ); +@} + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use predefined exponential distribution with scale param. 2 */ + double fpar[1] = @{ 2. @}; + distr = unur_distr_exponential(fpar, 1); + + /* Use method CEXT */ + par = unur_cext_new(distr); + + /* Set initialization and sampling routines. */ + unur_cext_set_init(par, exponential_init); + unur_cext_set_sample(par, exponential_sample); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ + diff --git a/vendor/unuran-1.11.0/doc/src/ref_example_cont.texi b/vendor/unuran-1.11.0/doc/src/ref_example_cont.texi new file mode 100644 index 0000000..59342c6 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example_cont.texi @@ -0,0 +1,114 @@ +/* ------------------------------------------------------------- */ +/* File: example_cont.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* Example how to sample from a continuous univariate */ +/* distribution. */ +/* */ +/* We build a distribution object from scratch and sample. */ + +/* ------------------------------------------------------------- */ + +/* Define the PDF and dPDF of our distribution. */ +/* */ +/* Our distribution has the PDF */ +/* */ +/* / 1 - x*x if |x| <= 1 */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ + +/* The PDF of our distribution: */ +double mypdf( double x, const UNUR_DISTR *distr ) + /* The second argument (`distr') can be used for parameters */ + /* for the PDF. (We do not use parameters in our example.) */ +@{ + if (fabs(x) >= 1.) + return 0.; + else + return (1.-x*x); +@} /* end of mypdf() */ + +/* The derivative of the PDF of our distribution: */ +double mydpdf( double x, const UNUR_DISTR *distr ) +@{ + if (fabs(x) >= 1.) + return 0.; + else + return (-2.*x); +@} /* end of mydpdf() */ + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create a new distribution object from scratch. */ + + /* Get empty distribution object for a continuous distribution */ + distr = unur_distr_cont_new(); + + /* Fill the distribution object -- the provided information */ + /* must fulfill the requirements of the method choosen below. */ + unur_distr_cont_set_pdf(distr, mypdf); /* PDF */ + unur_distr_cont_set_dpdf(distr, mydpdf); /* its derivative */ + unur_distr_cont_set_mode(distr, 0.); /* mode */ + unur_distr_cont_set_domain(distr, -1., 1.); /* domain */ + + /* Choose a method: TDR. */ + par = unur_tdr_new(distr); + + /* Set some parameters of the method TDR. */ + unur_tdr_set_variant_gw(par); + unur_tdr_set_max_sqhratio(par, 0.90); + unur_tdr_set_c(par, -0.5); + unur_tdr_set_max_intervals(par, 100); + unur_tdr_set_cpoints(par, 10, NULL); + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/doc/src/ref_example_cont_str.texi b/vendor/unuran-1.11.0/doc/src/ref_example_cont_str.texi new file mode 100644 index 0000000..87fe95e --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example_cont_str.texi @@ -0,0 +1,65 @@ +/* ------------------------------------------------------------- */ +/* File: example_cont_str.c */ +/* ------------------------------------------------------------- */ +/* String API. */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* Example how to sample from a continuous univariate */ +/* distribution. */ + +/* We use a generic distribution object and sample. */ +/* */ +/* The PDF of our distribution is given by */ +/* */ +/* / 1 - x*x if |x| <= 1 */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a generic continuous distribution. */ + /* Choose a method: TDR. */ + gen = unur_str2gen( + "distr = cont; pdf=\"1-x*x\"; domain=(-1,1); mode=0. & \ + method=tdr; variant_gw; max_sqhratio=0.90; c=-0.5; \ + max_intervals=100; cpoints=10"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/doc/src/ref_example_dext.texi b/vendor/unuran-1.11.0/doc/src/ref_example_dext.texi new file mode 100644 index 0000000..99a93ae --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example_dext.texi @@ -0,0 +1,116 @@ +/* ------------------------------------------------------------- */ +/* File: example_dext.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* This example shows how an external generator for the */ +/* geometric distribution can be used within the UNURAN */ +/* framework. */ +/* */ +/* Notice, that this example does not provide the simplest */ +/* solution. */ + +/* ------------------------------------------------------------- */ +/* Initialization routine. */ +/* */ +/* Here we simply read the parameter of the geometric */ +/* distribution and store it in an array for parameters of */ +/* the external generator. */ +/* [ Of course we could do this in the sampling routine as */ +/* and avoid the necessity of this initialization routine. ] */ + +int geometric_init (UNUR_GEN *gen) +@{ + /* Get pointer to parameters of geometric distribution */ + double *params = unur_dext_get_distrparams(gen); + + /* The parameter is the first entry (see manual) */ + double p = params[0]; + + /* Get array to store this parameter for external generator */ + double *genpar = unur_dext_get_params(gen, sizeof(double)); + genpar[0] = p; + + /* Executed successfully */ + return UNUR_SUCCESS; +@} + +/* ------------------------------------------------------------- */ +/* Sampling routine. */ +/* */ +/* Contains the code for the external generator. */ + +int geometric_sample (UNUR_GEN *gen) +@{ + /* Get scale parameter */ + double *genpar = unur_dext_get_params(gen,0); + double p = genpar[0]; + + /* Sample a uniformly distributed random number */ + double U = unur_sample_urng(gen); + + /* Transform into geometrically distributed random variate */ + return ( (int) (log(U) / log(1.-p)) ); +@} + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + int K; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use predefined geometric distribution with parameter 1/10 */ + double fpar[1] = @{ 0.1 @}; + distr = unur_distr_geometric(fpar, 1); + + /* Use method DEXT */ + par = unur_dext_new(distr); + + /* Set initialization and sampling routines. */ + unur_dext_set_init(par, geometric_init); + unur_dext_set_sample(par, geometric_sample); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) @{ + K = unur_sample_discr(gen); + printf("%d\n",K); + @} + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ + diff --git a/vendor/unuran-1.11.0/doc/src/ref_example_discr.texi b/vendor/unuran-1.11.0/doc/src/ref_example_discr.texi new file mode 100644 index 0000000..147c5d4 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example_discr.texi @@ -0,0 +1,71 @@ +/* ------------------------------------------------------------- */ +/* File: example_discr.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* Example how to sample from a discrete univariate distribution.*/ + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; + double param = 0.3; + + double probvec[10] = @{1.0, 2.0, 3.0, 4.0, 5.0,\ + 6.0, 7.0, 8.0, 4.0, 3.0@}; + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr1, *distr2; /* distribution objects */ + UNUR_PAR *par1, *par2; /* parameter objects */ + UNUR_GEN *gen1, *gen2; /* generator objects */ + + /* First distribution: defined by PMF. */ + distr1 = unur_distr_geometric(¶m, 1); + unur_distr_discr_set_mode(distr1, 0); + + /* Choose a method: DARI. */ + par1 = unur_dari_new(distr1); + gen1 = unur_init(par1); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen1 == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* Second distribution: defined by (finite) PV. */ + distr2 = unur_distr_discr_new(); + unur_distr_discr_set_pv(distr2, probvec, 10); + + /* Choose a method: DGT. */ + par2 = unur_dgt_new(distr2); + gen2 = unur_init(par2); + if (gen2 == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* print some random integers */ + for (i=0; i<10; i++)@{ + printf("number %d: %d\n", i*2, unur_sample_discr(gen1) ); + printf("number %d: %d\n", i*2+1, unur_sample_discr(gen2) ); + @} + + /* Destroy all objects. */ + unur_distr_free(distr1); + unur_distr_free(distr2); + unur_free(gen1); + unur_free(gen2); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/doc/src/ref_example_discr_str.texi b/vendor/unuran-1.11.0/doc/src/ref_example_discr_str.texi new file mode 100644 index 0000000..cd0e90a --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example_discr_str.texi @@ -0,0 +1,57 @@ +/* ------------------------------------------------------------- */ +/* File: example_discr_str.c */ +/* ------------------------------------------------------------- */ +/* String API. */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* Example how to sample from a discrete univariate distribution.*/ + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + + /* Declare UNURAN generator objects. */ + UNUR_GEN *gen1, *gen2; /* generator objects */ + + + /* First distribution: defined by PMF. */ + gen1 = unur_str2gen("geometric(0.3); mode=0 & method=dari"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen1 == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* Second distribution: defined by (finite) PV. */ + gen2 = unur_str2gen( + "distr=discr; pv=(1,2,3,4,5,6,7,8,4,3) & method=dgt"); + if (gen2 == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* print some random integers */ + for (i=0; i<10; i++)@{ + printf("number %d: %d\n", i*2, unur_sample_discr(gen1) ); + printf("number %d: %d\n", i*2+1, unur_sample_discr(gen2) ); + @} + + /* Destroy all objects. */ + unur_free(gen1); + unur_free(gen2); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/doc/src/ref_example_emp.texi b/vendor/unuran-1.11.0/doc/src/ref_example_emp.texi new file mode 100644 index 0000000..8b40619 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example_emp.texi @@ -0,0 +1,71 @@ +/* ------------------------------------------------------------- */ +/* File: example_emp.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* Example how to sample from an empirial continuous univariate */ +/* distribution. */ + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; + double x; + + /* data points */ + double data[15] = @{ -0.1, 0.05, -0.5, 0.08, 0.13,\ + -0.21,-0.44, -0.43, -0.33, -0.3, \ + 0.18, 0.2, -0.37, -0.29, -0.9 @}; + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create a distribution object and set empirical sample. */ + distr = unur_distr_cemp_new(); + unur_distr_cemp_set_data(distr, data, 15); + + /* Choose a method: EMPK. */ + par = unur_empk_new(distr); + + /* Set smooting factor. */ + unur_empk_set_smoothing(par, 0.8); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/doc/src/ref_example_emp_str.texi b/vendor/unuran-1.11.0/doc/src/ref_example_emp_str.texi new file mode 100644 index 0000000..3a371e0 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example_emp_str.texi @@ -0,0 +1,55 @@ +/* ------------------------------------------------------------- */ +/* File: example_emp_str.c */ +/* ------------------------------------------------------------- */ +/* String API. */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* Example how to sample from an empirial continuous univariate */ +/* distribution. */ + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; + double x; + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + gen = unur_str2gen("distr = cemp; \ + data=(-0.10, 0.05,-0.50, 0.08, 0.13, \ + -0.21,-0.44,-0.43,-0.33,-0.30, \ + 0.18, 0.20,-0.37,-0.29,-0.90) & \ + method=empk; smoothing=0.8"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/doc/src/ref_example_gsl.texi b/vendor/unuran-1.11.0/doc/src/ref_example_gsl.texi new file mode 100644 index 0000000..f0f7adc --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example_gsl.texi @@ -0,0 +1,71 @@ +/* ------------------------------------------------------------- */ +/* File: example_gsl.c */ +/* ------------------------------------------------------------- */ +#ifdef UNURAN_SUPPORTS_GSL +/* ------------------------------------------------------------- */ +/* This example makes use of the GSL library for generating */ +/* uniform random numbers. */ +/* (see http://www.gnu.org/software/gsl/) */ +/* To compile this example you must have set */ +/* ./configure --with-urng-gsl */ +/* (Of course the executable has to be linked against the */ +/* GSL library.) */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header files. */ +#include +#include + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng; /* uniform generator objects */ + + /* GNU Scientific Library only: */ + /* Make a object for uniform random number generator. */ + urng = unur_urng_gsl_new(gsl_rng_mt19937); + if (urng == NULL) exit (EXIT_FAILURE); + + /* Create a generator object using this URNG */ + distr = unur_distr_normal( NULL, 0 ); + par = unur_tdr_new(distr); + unur_set_urng( par, urng ); + gen = unur_init(par); + if (gen == NULL) exit (EXIT_FAILURE); + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* Destroy objects */ + unur_free(gen); + unur_urng_free(urng); + + exit (EXIT_SUCCESS); +@} /* end of main() */ + +/* ------------------------------------------------------------- */ +#else +#include +#include +int main(void) @{ + printf("You must enable the GSL to run this example!\n\n"); + exit (77); /* exit code for automake check routines */ +@} +#endif +/* ------------------------------------------------------------- */ + diff --git a/vendor/unuran-1.11.0/doc/src/ref_example_mixt.texi b/vendor/unuran-1.11.0/doc/src/ref_example_mixt.texi new file mode 100644 index 0000000..e17aa40 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example_mixt.texi @@ -0,0 +1,73 @@ +/* ------------------------------------------------------------- */ +/* File: example_mixt.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ +/* Mixture of a Gaussian and a Cauchy distribution. */ +/* ------------------------------------------------------------- */ + +int main(void) +@{ + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *comp[2]; /* array of generator objects (components)*/ + UNUR_GEN *gen; /* generator object for mixture */ + + double prob[2]; /* array of probabilities */ + + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Create generators for components */ + distr = unur_distr_normal(NULL,0); /* Gaussian distribution */ + par = unur_pinv_new(distr); /* choose method PINV */ + comp[0] = unur_init(par); /* initialize */ + unur_distr_free(distr); /* free distribution obj. */ + + distr = unur_distr_cauchy(NULL,0); /* Cauchy distribution */ + par = unur_tdr_new(distr); /* choose method TDR */ + comp[1] = unur_init(par); /* initialize */ + unur_distr_free(distr); /* free distribution obj. */ + + /* Probabilities for components (need not sum to 1) */ + prob[0] = 0.4; + prob[1] = 0.3; + + /* Create mixture */ + par = unur_mixt_new(2,prob,comp); + + /* Initialize generator object */ + gen = unur_init(par); + + /* we do not need the components any more */ + for (i=0; i<2; i++) + unur_free(comp[i]); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/doc/src/ref_example_mixt_inv.texi b/vendor/unuran-1.11.0/doc/src/ref_example_mixt_inv.texi new file mode 100644 index 0000000..0aba00d --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example_mixt_inv.texi @@ -0,0 +1,79 @@ +/* ------------------------------------------------------------- */ +/* File: example_mixt_inv.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ +/* Mixture of truncated Gaussian on (-INFINITY,0] and */ +/* Exponential distribution on [0,INFINITY) */ +/* ------------------------------------------------------------- */ + +int main(void) +@{ + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *comp[2]; /* array of generator objects (components)*/ + UNUR_GEN *gen; /* generator object for mixture */ + + double prob[2]; /* array of probabilities */ + + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Create generators for components */ + distr = unur_distr_normal(NULL,0); /* Gaussian distribution */ + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,0); + par = unur_pinv_new(distr); /* choose method PINV */ + comp[0] = unur_init(par); /* initialize */ + unur_distr_free(distr); /* free distribution obj. */ + + distr = unur_distr_exponential(NULL,0); /* Exponential distr. */ + par = unur_pinv_new(distr); /* choose method PINV */ + comp[1] = unur_init(par); /* initialize */ + unur_distr_free(distr); /* free distribution obj. */ + + /* Probabilities for components (need not sum to 1) */ + prob[0] = 0.4; + prob[1] = 0.3; + + /* Create mixture */ + par = unur_mixt_new(2,prob,comp); + + /* We want to use inversion for the mixture as well. */ + /* (Thus the above order of the components is important!) */ + unur_mixt_set_useinversion(par,TRUE); + + /* Initialize generator object */ + gen = unur_init(par); + + /* we do not need the components any more */ + for (i=0; i<2; i++) + unur_free(comp[i]); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/doc/src/ref_example_reinit.texi b/vendor/unuran-1.11.0/doc/src/ref_example_reinit.texi new file mode 100644 index 0000000..084c445 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example_reinit.texi @@ -0,0 +1,104 @@ +/* ------------------------------------------------------------- */ +/* File: example_reinit.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* In this example we show how the parameters of the underlying */ +/* distribution can be changed for an existing generator object. */ + +/* We use the GIG distribution with method CSTD. */ + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Parameters of distribution. */ + double dparam[3] = @{0.5, 1., 5.@}; + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create initial GIG distribution object */ + distr = unur_distr_gig(dparam, 3); + + /* Choose a method: CSTD. */ + par = unur_cstd_new(distr); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* It is possible for method CSTD to change the parameters of */ + /* underlying distribution. However, we have to extract to */ + /* pointer to the distribution. Be carefull with this pointer! */ + distr = unur_get_distr(gen); + + /* Change the parameter(s). */ + dparam[2] = 0.001; + unur_distr_cont_set_pdfparams(distr,dparam,3); + + /* Do not forget to reinitialize the generator object. */ + /* Check the return code. */ + /* (and try to find a better error handling) */ + if (unur_reinit(gen) != UNUR_SUCCESS) @{ + fprintf(stderr, "ERROR: cannot reinitialize generator object\n"); + exit (EXIT_FAILURE); + @} + + /* Draw a new sample. */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* Changing parameters can be repeated. */ + dparam[2] = 1000; + unur_distr_cont_set_pdfparams(distr,dparam,3); + if (unur_reinit(gen) != UNUR_SUCCESS) @{ + fprintf(stderr, "ERROR: cannot reinitialize generator object\n"); + exit (EXIT_FAILURE); + @} + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ + + diff --git a/vendor/unuran-1.11.0/doc/src/ref_example_rngstreams.texi b/vendor/unuran-1.11.0/doc/src/ref_example_rngstreams.texi new file mode 100644 index 0000000..a6a9d3e --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example_rngstreams.texi @@ -0,0 +1,117 @@ +/* ------------------------------------------------------------- */ +/* File: example_rngstreams.c */ +/* ------------------------------------------------------------- */ +#ifdef UNURAN_SUPPORTS_RNGSTREAM +/* ------------------------------------------------------------- */ +/* This example makes use of the RNGSTREAM library for */ +/* for generating uniform random numbers. */ +/* (see http://statmath.wu.ac.at/software/RngStreams/) */ +/* To compile this example you must have set */ +/* ./configure --with-urng-rngstream */ +/* (Of course the executable has to be linked against the */ +/* RNGSTREAM library.) */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header files. */ +#include +#include + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + double x; /* will hold the random number */ + double fparams[2]; /* array for parameters for distribution */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng1, *urng2; /* uniform generator objects */ + + /* The RNGSTREAMS library sets a package seed. */ + unsigned long seed[] = @{111u, 222u, 333u, 444u, 555u, 666u@}; + RngStream_SetPackageSeed(seed); + + /* RngStreams only: */ + /* Make a object for uniform random number generator. */ + /* For details see */ + /* http://statmath.wu.ac.at/software/RngStreams/ */ + urng1 = unur_urng_rngstream_new("urng-1"); + if (urng1 == NULL) exit (EXIT_FAILURE); + + /* Use a predefined standard distribution: */ + /* Beta with parameters 2 and 3. */ + fparams[0] = 2.; + fparams[1] = 3.; + distr = unur_distr_beta( fparams, 2 ); + + /* Choose a method: TDR. */ + par = unur_tdr_new(distr); + + /* Set uniform generator in parameter object */ + unur_set_urng( par, urng1 ); + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* Now we want to switch to a different (independent) stream */ + /* of uniform random numbers. */ + urng2 = unur_urng_rngstream_new("urng-2"); + if (urng2 == NULL) exit (EXIT_FAILURE); + unur_chg_urng( gen, urng2 ); + + /* ... and sample again. */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen); + printf("%f\n",x); + @} + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + /* We also should destroy the uniform random number generators.*/ + unur_urng_free(urng1); + unur_urng_free(urng2); + + exit (EXIT_SUCCESS); +@} /* end of main() */ + +/* ------------------------------------------------------------- */ +#else +#include +#include +int main(void) @{ + printf("You must enable the RNGSTREAM library to run this example!\n\n"); + exit (77); /* exit code for automake check routines */ +@} +#endif +/* ------------------------------------------------------------- */ + diff --git a/vendor/unuran-1.11.0/doc/src/ref_example_vemp.texi b/vendor/unuran-1.11.0/doc/src/ref_example_vemp.texi new file mode 100644 index 0000000..490c757 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example_vemp.texi @@ -0,0 +1,75 @@ +/* ------------------------------------------------------------- */ +/* File: example_vemp.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* Example how to sample from an empirial continuous */ +/* multivariate distribution. */ + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; + + /* 4 data points of dimension 2 */ + double data[] = @{ 1. ,1., /* 1st data point */ + -1.,1., /* 2nd data point */ + 1.,-1., /* 3rd data point */ + -1.,-1. @}; /* 4th data point */ + + double result[2]; + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create a distribution object with dimension 2. */ + distr = unur_distr_cvemp_new( 2 ); + + /* Set empirical sample. */ + unur_distr_cvemp_set_data(distr, data, 4); + + /* Choose a method: VEMPK. */ + par = unur_vempk_new(distr); + + /* Use variance correction. */ + unur_vempk_set_varcor( par, 1 ); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) @{ + unur_sample_vec(gen, result); + printf("(%f,%f)\n", result[0], result[1]); + @} + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +@} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/doc/src/ref_example_win32_1.texi b/vendor/unuran-1.11.0/doc/src/ref_example_win32_1.texi new file mode 100644 index 0000000..c27b096 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example_win32_1.texi @@ -0,0 +1,90 @@ +/* ------------------------------------------------------------- */ +/* File: example1.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header files. */ +#include +#include + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + double x; int k; /* will hold the random number */ + + /* Declare UNU.RAN objects. */ + UNUR_GEN *gen1, *gen2, *gen3; /* generator objects */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng2; /* uniform RN generator object */ + + /* -- Optional: Set seed for RNGSTREAMS library -------------- */ + + /* The RNGSTREAMS library sets a package seed. */ + unsigned long seed[] = @{111u, 222u, 333u, 444u, 555u, 666u@}; + RngStream_SetPackageSeed(seed); + + /* -- Example 1 ---------------------------------------------- */ + /* Beta distribution with shape parameters 2 and 3. */ + /* Use method 'AUTO' (AUTOmatic). */ + + /* Create generator object. */ + gen1 = unur_str2gen("beta(2,3)"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen1' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen1 == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* Now you can use the generator object `gen1' to sample from */ + /* the target distribution. Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen1); + printf("%f\n",x); + @} + + /* -- Example 2 ---------------------------------------------- */ + /* Student's t distribution with 3 degrees of freedom. */ + /* Use method 'TDR' (Transformed Density Rejection) with */ + /* "immediate acception" */ + gen2 = unur_str2gen("student(3) & method=TDR; variant_ia"); + if (gen2 == NULL) exit (EXIT_FAILURE); + + /* However, this time we use a (new) independent stream of */ + /* uniformrandom numbers. */ + urng2 = unur_urng_rngstream_new("urng2"); + unur_chg_urng( gen2, urng2 ); + + /* Draw a sample. */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen2); printf("%f\n",x); + @} + + /* -- Example 3 ---------------------------------------------- */ + /* Discrete distribution with given probability vector. */ + /* Use method 'DGT' (Discrete Guide Table method). */ + gen3 = unur_str2gen("discr; pv=(0.5,1.5,1.0,0.3) & method=DGT"); + if (gen3 == NULL) exit (EXIT_FAILURE); + + /* we use the default URNG again. So there is nothing to do. */ + + /* Draw a sample. Notice that we get integers! */ + for (i=0; i<10; i++) @{ + k = unur_sample_discr(gen3); printf("%d\n",k); + @} + + /* -- Call destructor ---------------------------------------- */ + /* When generators are not needed any they can be destroyed. */ + + unur_free(gen1); + unur_free(gen2); unur_urng_free(urng2); + unur_free(gen3); + + exit (EXIT_SUCCESS); +@} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/doc/src/ref_example_win32_2.texi b/vendor/unuran-1.11.0/doc/src/ref_example_win32_2.texi new file mode 100644 index 0000000..11f6724 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/ref_example_win32_2.texi @@ -0,0 +1,137 @@ +/* ------------------------------------------------------------- */ +/* File: example2.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header files. */ +#include +#include + +/* ------------------------------------------------------------- */ + +int main(void) +@{ + int i; /* loop variable */ + double x; int k; /* will hold the random number */ + + /* Declare UNU.RAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen1, *gen2, *gen3; /* generator objects */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng2; /* uniform RN generator object */ + + /* -- Optional: Set seed for RNGSTREAMS library -------------- */ + + /* The RNGSTREAMS library sets a package seed. */ + unsigned long seed[] = @{111u, 222u, 333u, 444u, 555u, 666u@}; + RngStream_SetPackageSeed(seed); + + /* -- Example 1 ---------------------------------------------- */ + /* Beta distribution with shape parameters 2 and 3. */ + /* Use method 'AUTO' (AUTOmatic). */ + + /* Create distribution object. */ + @{ + double fparams[] = @{2., 3.@}; + distr = unur_distr_beta( fparams, 2 ); + @} + + /* Choose a method: 'AUTO'. */ + par = unur_auto_new(distr); + + /* Create the generator object. */ + gen1 = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen1' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen1 == NULL) @{ + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + @} + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen1' to sample from */ + /* the target distribution. Eg.: */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen1); + printf("%f\n",x); + @} + + /* -- Example 2 ---------------------------------------------- */ + /* Student's t distribution with 3 degrees of freedom. */ + /* Use method 'TDR' (Transformed Density Rejection) with */ + /* "immediate acception" */ + + /* Create distribution object. */ + @{ + double fparams[] = @{3.@}; + distr = unur_distr_student( fparams, 1 ); + @} + + /* Choose a method: 'TDR'. */ + par = unur_tdr_new(distr); + /* ... and change to immediate acceptance. */ + unur_tdr_set_variant_ia(par); + + /* However, this time we use a (new) independent stream of */ + /* uniformrandom numbers. */ + urng2 = unur_urng_rngstream_new("urng2"); + unur_set_urng( par, urng2 ); + + /* Create the generator object. */ + gen2 = unur_init(par); + if (gen2 == NULL) exit (EXIT_FAILURE); + + /* Destroy distribution object. (We do not need it any more.) */ + unur_distr_free(distr); + + /* Draw a sample. */ + for (i=0; i<10; i++) @{ + x = unur_sample_cont(gen2); printf("%f\n",x); + @} + + /* -- Example 3 ---------------------------------------------- */ + /* Discrete distribution with given probability vector. */ + /* Use method 'DGT' (Discrete Guide Table method). */ + + /* Create distribution object. */ + @{ + double probs[] = @{0.5, 1.5, 1.0, 0.3@}; + distr = unur_distr_discr_new(); + unur_distr_discr_set_pv(distr, probs, 4); + @} + + /* Choose a method: 'DGT'. */ + par = unur_dgt_new(distr); + + /* we use the default URNG again. So there is nothing to do. */ + + /* Create the generator object. */ + gen3 = unur_init(par); + if (gen3 == NULL) exit (EXIT_FAILURE); + + /* Destroy distribution object. (We do not need it any more.) */ + unur_distr_free(distr); + + /* Draw a sample. Notice that we get integers! */ + for (i=0; i<10; i++) @{ + k = unur_sample_discr(gen3); printf("%d\n",k); + @} + + /* -- Call destructor ---------------------------------------- */ + /* When generators are not needed any they can be destroyed. */ + + unur_free(gen1); + unur_free(gen2); unur_urng_free(urng2); + unur_free(gen3); + + exit (EXIT_SUCCESS); +@} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/doc/src/references.dh b/vendor/unuran-1.11.0/doc/src/references.dh new file mode 100644 index 0000000..90549fa --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/references.dh @@ -0,0 +1,305 @@ +/*---------------------------------------------------------------------------*/ + +=APPENDIX Bibliography Bibliography + +=UP TOP [a07] + +=DESCRIPTION + +@subheading Standard Distributions + +@table @t + +@anchor{bib:JKKa92} +@item [JKKa92] +@sc{N.L. Johnson, S. Kotz, and A.W. Kemp} (1992). +@i{Univariate Discrete Distributions}, +2nd edition, +John Wiley & Sons, Inc., New York. + +@anchor{bib:JKBb94} +@item [JKBb94] +@sc{N.L. Johnson, S. Kotz, and N. Balakrishnan} (1994). +@i{Continuous Univariate Distributions}, +Volume 1, +2nd edition, +John Wiley & Sons, Inc., New York. + +@anchor{bib:JKBc95} +@item [JKBc95] +@sc{N.L. Johnson, S. Kotz, and N. Balakrishnan} (1995). +@i{Continuous Univariate Distributions}, +Volume 2, +2nd edition, +John Wiley & Sons, Inc., New York. + +@anchor{bib:JKBd97} +@item [JKBd97] +@sc{N.L. Johnson, S. Kotz, and N. Balakrishnan} (1997). +@i{Discrete Multivariate Distributions}, +John Wiley & Sons, Inc., New York. + +@anchor{bib:KBJe00} +@item [KBJe00] +@sc{S. Kotz, N. Balakrishnan, and N.L. Johnson} (2000). +@i{Continuous Multivariate Distributions}, +Volume 1: Models and Applications, +John Wiley & Sons, Inc., New York. + +@end table + +@c ------------------------------------------------------- + +@subheading Universal Methods -- Surveys + +@table @t + +@anchor{bib:HLD04} +@item [HLD04] +@sc{W. H@"ormann, J. Leydold, and G. Derflinger} (2004). +@i{Automatic Nonuniform Random Variate Generation}, +Springer, Berlin. + +@end table + +@c ------------------------------------------------------- + +@subheading Universal Methods + +@table @t + +@anchor{bib:AJa93} +@item [AJa93] +@sc{J.H. Ahrens} (1993). +@i{Sampling from general distributions by suboptimal division of domains}, +Grazer Math. Berichte 319, 30pp. + +@anchor{bib:AJa95} +@item [AJa95] +@sc{J.H. Ahrens} (1995). +@i{An one-table method for sampling from continuous and discrete distributions}, +Computing 54(2), pp. 127-146. + +@anchor{bib:CAa74} +@item [CAa74] +@sc{H.C. Chen and Y. Asau} (1974). +@i{On generating random variates from an empirical distribution}, +AIIE Trans. 6, pp. 163-166. + +@anchor{bib:DHLa08} +@item [DHLa08] +@sc{G. Derflinger, W. H@"ormann, and J. Leydold} (2008). +@i{Numerical inversion when only the density function is known}, +Research Report Series of the Department of Statistics and Mathematics 78, +WU Wien, Augasse 2--6, A-1090 Wien, Austria, +@uref{http://epub.wu.ac.at/english/}. + +@anchor{bib:DLa86} +@item [DLa86] +@sc{L. Devroye} (1986). +@i{Non-Uniform Random Variate Generation}, +Springer Verlag, New York. + +@anchor{bib:GWa92} +@item [GWa92] +@sc{W.R. Gilks and P. Wild} (1992). +@i{Adaptive rejection sampling for Gibbs sampling}, +Applied Statistics 41, pp. 337-348. + +@anchor{bib:HWa95} +@item [HWa95] +@sc{W. H@"ormann} (1995). +@i{A rejection technique for sampling from T-concave distributions}, +ACM Trans. Math. Software 21(2), pp. 182-193. + +@anchor{bib:HDa96} +@item [HDa96] +@sc{W. H@"ormann and G. Derflinger} (1996). +@i{Rejection-inversion to generate variates from monotone discrete distributions}, +ACM TOMACS 6(3), 169-184. + +@anchor{bib:HLa00} +@item [HLa00] +@sc{W. H@"ormann and J. Leydold} (2000). +@i{Automatic random variate generation for simulation input.} +In: J.A. Joines, R. Barton, P. Fishwick, K. Kang (eds.), +Proceedings of the 2000 Winter Simulation Conference, pp. 675-682. + +@anchor{bib:HLa03} +@item [HLa03] +@sc{W. H@"ormann and J. Leydold} (2003). +@i{Continuous Random Variate Generation by Fast Numerical Inversion}, +ACM TOMACS 13(4), 347-362. + +@anchor{bib:HLDa07} +@item [HLDa07] +@sc{W. H@"ormann, J. Leydold, and G. Derflinger} (2007). +@i{Automatic Random Variate Generation for Unbounded Densities}, +ACM Trans. Model. Comput. Simul. 17(4), pp.18. + +@anchor{bib:KLPa05} +@item [KLPa05] +@sc{R. Karawatzki, J. Leydold, and K. P@"otzelberger} (2005). +@i{Automatic Markov chain Monte Carlo procedures for sampling from multivariate distributions}, +Research Report Series of the Department of Statistics and Mathematics 27, +WU Wien, Augasse 2--6, A-1090 Wien, Austria, +@uref{http://epub.wu.ac.at/english/}. + +@anchor{bib:LJa98} +@item [LJa98] +@sc{J. Leydold} (1998). +@i{A Rejection Technique for Sampling from Log-Concave Multivariate Distributions}, +ACM TOMACS 8(3), pp. 254-280. + +@anchor{bib:LJa00} +@item [LJa00] +@sc{J. Leydold} (2000). +@i{Automatic Sampling with the Ratio-of-Uniforms Method}, +ACM Trans. Math. Software 26(1), pp. 78-98. + +@anchor{bib:LJa01} +@item [LJa01] +@sc{J. Leydold} (2001). +@i{A simple universal generator for continuous and discrete +univariate T-concave distributions}, +ACM Trans. Math. Software 27(1), pp. 66-82. + +@anchor{bib:LJa02} +@item [LJa02] +@sc{J. Leydold} (2003). +@i{Short universal generators via generalized ratio-of-uniforms method}, +Math. Comp. 72(243), pp. 1453-1471. + +@anchor{bib:WGS91} +@item [WGS91] +@sc{J.C. Wakefield, A.E. Gelfand, and A.F.M. Smith} (1992). +@i{Efficient generation of random variates via the ratio-of-uniforms method}, +Statist. Comput. 1(2), pp. 129-133. + +@anchor{bib:WAa77} +@item [WAa77] +@sc{A.J. Walker} (1977). +@i{An efficient method for generating discrete random variables with general distributions}, +ACM Trans. Math. Software 3, pp. 253-256. + +@end table + +@c ------------------------------------------------------- + +@subheading Special Generators + +@table @t + +@anchor{bib:ADa74} +@item [ADa74] +@sc{J.H. Ahrens, U. Dieter} (1974). +@i{Computer methods for sampling from gamma, beta, Poisson +and binomial distributions}, +Computing 12, 223-246. + +@anchor{bib:ADa82} +@item [ADa82] +@sc{J.H. Ahrens, U. Dieter} (1982). +@i{Generating gamma variates by a modified rejection technique}, +Communications of the ACM 25, 47-54. + +@anchor{bib:ADb82} +@item [ADb82] +@sc{J.H. Ahrens, U. Dieter} (1982). +@i{Computer generation of Poisson deviates from modified normal distributions}, +ACM Trans. Math. Software 8, 163-179. + +@anchor{bib:BMa58} +@item [BMa58] +@sc{G.E.P. Box and M.E. Muller} (1958). +@i{A note on the generation of random normal deviates}, +Annals Math. Statist. 29, 610-611. + +@anchor{bib:CHa77} +@item [CHa77] +@sc{R.C.H. Cheng} (1977). +@i{The Generation of Gamma Variables with Non-Integral Shape Parameter}, +Appl. Statist. 26(1), 71-75. + +@anchor{bib:Dag89} +@item [Dag89] +@sc{J.S. Dagpunar} (1989). +@i{An Easily Implemented Generalised Inverse Gaussian Generator}, +Commun. Statist. Simul. 18(2), 703-710. + +@anchor{bib:HDa90} +@item [HDa90] +@sc{W. H@"ormann and G. Derflinger} (1990). +@i{The ACR Method for generating normal random variables}, +OR Spektrum 12, 181-185. + +@anchor{bib:KAa81} +@item [KAa81] +@sc{A.W. Kemp} (1981). +@i{Efficient generation of logarithmically distributed +pseudo-random variables}, +Appl. Statist. 30, 249-253. + +@anchor{bib:KRa76} +@item [KRa76] +@sc{A.J. Kinderman and J.G. Ramage} (1976). +@i{Computer Generation of Normal Random Variables}, +J. Am. Stat. Assoc. 71(356), 893 - 898. + +@anchor{bib:MJa87} +@item [MJa87] +@sc{J.F. Monahan} (1987). +@i{An algorithm for generating chi random variables}, +ACM Trans. Math. Software 13, 168-172. + +@anchor{bib:MGa62} +@item [MGa62] +@sc{G. Marsaglia} (1962). +@i{Improving the Polar Method for Generating a Pair of Random Variables}, +Boeing Sci. Res. Lab., Seattle, Washington. + +@anchor{bib:MOa84} +@item [MOa84] +@sc{G. Marsaglia and I. Olkin} (1984). +@i{Generating Correlation Matrices}, +SIAM J. Sci. Stat. Comput 5, 470-475. + +@anchor{bib:STa89} +@item [STa89] +@sc{E. Stadlober} (1989). +@i{Sampling from Poisson, binomial and hypergeometric distributions: +ratio of uniforms as a simple and fast alternative}, +Bericht 303, Math. Stat. Sektion, +Forschungsgesellschaft Joanneum, Graz. + +@anchor{bib:ZHa94} +@item [ZHa94] +@sc{H. Zechner} (1994). +@i{Efficient sampling from continuous and discrete unimodal distributions}, +Pd.D. Thesis, 156 pp., Technical University Graz, Austria. + +@end table + +@c ------------------------------------------------------- + +@subheading Other references + +@table @t + +@anchor{bib:CPa76} +@item [CPa76] +@sc{R. Cranley and T.N.L. Patterson} (1976). +@i{Randomization of number theoretic methods for multiple integration}, +SIAM J. Num. Anal., Vol. 13, pp. 904-914. + +@anchor{bib:HJa61} +@item [HJa61] +@sc{R. Hooke and T.A. Jeeves} (1961). +@i{Direct Search Solution of Numerical and Statistical Problems}, +Journal of the ACM, Vol. 8, April 1961, pp. 212-229. + +@end table + +@c ------------------------------------------------------- + +=EON diff --git a/vendor/unuran-1.11.0/doc/src/stddist.dh b/vendor/unuran-1.11.0/doc/src/stddist.dh new file mode 100644 index 0000000..f603d82 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/stddist.dh @@ -0,0 +1,151 @@ + +/*---------------------------------------------------------------------------*/ + +=NODE Stddist UNU.RAN Library of standard distributions +=UP TOP [55] + +=DESCRIPTION +Although it is not its primary target, many +distributions are already implemented in UNU.RAN. +This section presents these available distributions +and their parameters. + +The syntax to get a distribuion object for distributions +@code{} is: + +@deftypefn -- {UNUR_DISTR*} unur_distr_@code{} (double* @var{params}, int @var{n_params}) +@var{params} is an array of doubles of size +@var{n_params} holding the parameters. +@end deftypefn + +@noindent +E.g. to get an object for the gamma distribution (with shape parameter) use + +@example + unur_distr_gamma( params, 1 ); +@end example + +@noindent +Distributions may have default parameters with need not be given +explicitely. +E.g. The gamma distribution has three parameters: the +shape, scale and location parameter. Only the (first) shape parameter +is required. The others can be omitted and are then set by default +values. + +@example + @cc_start alpha = 5; default: beta = 1, gamma = 0 @cc_stop + double fpar[] = @{5.@}; + unur_distr_gamma( fpar, 1 ); + + @cc_start alpha = 5, beta = 3; default: gamma = 0 @cc_stop + double fpar[] = @{5., 3.@}; + unur_distr_gamma( fpar, 2 ); + + @cc_start alpha = 5, beta = 3, gamma = -2 + double fpar[] = @{5., 3., -2.@}; + unur_distr_gamma( fpar, 3 ); +@end example + +@strong{Important:} Naturally the computational accuracy +limits the possible parameters. There shouldn't be problems +when the parameters of a distribution are in a ``reasonable'' range but +e.g. the normal distribution N(10^15,1) won't yield the desired results. +(In this case it would be better generating N(0,1) and @emph{then} +transform the results.) +@* Of course computational inaccuracy is not specific to UNU.RAN +and should always be kept in mind when working with computers. + +@emph{Important:} The routines of the standard library are included +for non-uniform random variate generation and not to provide special +functions for statistical computations. + +@subheading Remark + +The following keywords are used in the tables: +@table @i +@item PDF +probability density function, +with variable @i{x}. + +@item PMF +probability mass function, +with variable @i{k}. + +@item constant +normalization constant for given PDF and PMF, resp. +They must be multiplied by @i{constant} to get the +``real'' PDF and PMF. + +@item CDF +gives information whether the CDF is implemented in UNU.RAN. + +@item domain +domain PDF and PMF, resp. + +@item parameters @var{n_std} (@var{n_total}): @r{list} +list of parameters for distribution, where @var{n_std} is the number +of parameters for the standard form of the distribution and +@var{n_total} the total number for the (non-standard form of the) +distribution. @var{list} is the list of parameters in the order as +they are stored in the array of parameters. Optional parameter that +can be omitted are enclosed in square brackets @code{[@dots{}]}. + +A detailed list of these parameters gives then the range of valid +parameters and defaults for optional parameters that are used when +these are omitted. + +@item reference +gives reference for distribution +(@pxref{Bibliography}). + +@item special generators +lists available special generators for the distribution. +The first number is the variant that to be set by +unur_cstd_set_variant() and unur_dstd_set_variant() call, respectively. +If no variant is set the default variant @code{DEF} is used. +In the table the respective abbreviations @code{DEF} and @code{INV} +are used for @code{UNUR_STDGEN_DEFAULT} and +@code{UNUR_STDGEN_INVERSION}. +Also the references for these methods are given (@pxref{Bibliography}). + +Notice that these generators might be slower than universal methods. + +If @code{DEF} is ommited, the first entry is the default generator. + +@end table + +=EON + +/*---------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ + +=NODEX Stddist_CONT UNU.RAN Library of continuous univariate distributions +=UP Stddist [10] +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Stddist_CVEC UNU.RAN Library of continuous multivariate distributions +=UP Stddist [20] +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Stddist_DISCR UNU.RAN Library of discrete univariate distributions +=UP Stddist [30] +=DESCRIPTION + At the moment there are no CDFs implemented for discrete distribution. + Thus unur_distr_discr_upd_pmfsum() does not work properly for truncated + distribution. +=EON + +/*---------------------------------------------------------------------------*/ + +=NODEX Stddist_MATR UNU.RAN Library of random matrices +=UP Stddist [40] +=EON + +/*---------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/doc/src/texinfo.tex b/vendor/unuran-1.11.0/doc/src/texinfo.tex new file mode 100644 index 0000000..fd22fd6 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/texinfo.tex @@ -0,0 +1,9625 @@ +% texinfo.tex -- TeX macros to handle Texinfo files. +% +% Load plain if necessary, i.e., if running under initex. +\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi +% +\def\texinfoversion{2011-05-23.16} +% +% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +% 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +% +% This texinfo.tex file is free software: you can redistribute it and/or +% modify it under the terms of the GNU General Public License as +% published by the Free Software Foundation, either version 3 of the +% License, or (at your option) any later version. +% +% This texinfo.tex file is distributed in the hope that it will be +% useful, but WITHOUT ANY WARRANTY; without even the implied warranty +% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program. If not, see . +% +% As a special exception, when this file is read by TeX when processing +% a Texinfo source document, you may use the result without +% restriction. (This has been our intent since Texinfo was invented.) +% +% Please try the latest version of texinfo.tex before submitting bug +% reports; you can get the latest version from: +% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or +% ftp://tug.org/tex/texinfo.tex +% (and all CTAN mirrors, see http://www.ctan.org). +% The texinfo.tex in any given distribution could well be out +% of date, so if that's what you're using, please check. +% +% Send bug reports to bug-texinfo@gnu.org. Please include including a +% complete document in each bug report with which we can reproduce the +% problem. Patches are, of course, greatly appreciated. +% +% To process a Texinfo manual with TeX, it's most reliable to use the +% texi2dvi shell script that comes with the distribution. For a simple +% manual foo.texi, however, you can get away with this: +% tex foo.texi +% texindex foo.?? +% tex foo.texi +% tex foo.texi +% dvips foo.dvi -o # or whatever; this makes foo.ps. +% The extra TeX runs get the cross-reference information correct. +% Sometimes one run after texindex suffices, and sometimes you need more +% than two; texi2dvi does it as many times as necessary. +% +% It is possible to adapt texinfo.tex for other languages, to some +% extent. You can get the existing language-specific files from the +% full Texinfo distribution. +% +% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. + + +\message{Loading texinfo [version \texinfoversion]:} + +% If in a .fmt file, print the version number +% and turn on active characters that we couldn't do earlier because +% they might have appeared in the input file name. +\everyjob{\message{[Texinfo version \texinfoversion]}% + \catcode`+=\active \catcode`\_=\active} + +\chardef\other=12 + +% We never want plain's \outer definition of \+ in Texinfo. +% For @tex, we can use \tabalign. +\let\+ = \relax + +% Save some plain tex macros whose names we will redefine. +\let\ptexb=\b +\let\ptexbullet=\bullet +\let\ptexc=\c +\let\ptexcomma=\, +\let\ptexdot=\. +\let\ptexdots=\dots +\let\ptexend=\end +\let\ptexequiv=\equiv +\let\ptexexclam=\! +\let\ptexfootnote=\footnote +\let\ptexgtr=> +\let\ptexhat=^ +\let\ptexi=\i +\let\ptexindent=\indent +\let\ptexinsert=\insert +\let\ptexlbrace=\{ +\let\ptexless=< +\let\ptexnewwrite\newwrite +\let\ptexnoindent=\noindent +\let\ptexplus=+ +\let\ptexraggedright=\raggedright +\let\ptexrbrace=\} +\let\ptexslash=\/ +\let\ptexstar=\* +\let\ptext=\t +\let\ptextop=\top +{\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode + +% If this character appears in an error message or help string, it +% starts a new line in the output. +\newlinechar = `^^J + +% Use TeX 3.0's \inputlineno to get the line number, for better error +% messages, but if we're using an old version of TeX, don't do anything. +% +\ifx\inputlineno\thisisundefined + \let\linenumber = \empty % Pre-3.0. +\else + \def\linenumber{l.\the\inputlineno:\space} +\fi + +% Set up fixed words for English if not already set. +\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi +\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi +\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi +\ifx\putwordin\undefined \gdef\putwordin{in}\fi +\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi +\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi +\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi +\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi +\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi +\ifx\putwordof\undefined \gdef\putwordof{of}\fi +\ifx\putwordon\undefined \gdef\putwordon{on}\fi +\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi +\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi +\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi +\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi +\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi +\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi +\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi +% +\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi +\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi +\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi +\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi +\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi +\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi +\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi +\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi +\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi +\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi +\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi +\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi +% +\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi +\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi +\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi +\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi +\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi + +% Since the category of space is not known, we have to be careful. +\chardef\spacecat = 10 +\def\spaceisspace{\catcode`\ =\spacecat} + +% sometimes characters are active, so we need control sequences. +\chardef\ampChar = `\& +\chardef\colonChar = `\: +\chardef\commaChar = `\, +\chardef\dashChar = `\- +\chardef\dotChar = `\. +\chardef\exclamChar= `\! +\chardef\hashChar = `\# +\chardef\lquoteChar= `\` +\chardef\questChar = `\? +\chardef\rquoteChar= `\' +\chardef\semiChar = `\; +\chardef\slashChar = `\/ +\chardef\underChar = `\_ + +% Ignore a token. +% +\def\gobble#1{} + +% The following is used inside several \edef's. +\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} + +% Hyphenation fixes. +\hyphenation{ + Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script + ap-pen-dix bit-map bit-maps + data-base data-bases eshell fall-ing half-way long-est man-u-script + man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm + par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces + spell-ing spell-ings + stand-alone strong-est time-stamp time-stamps which-ever white-space + wide-spread wrap-around +} + +% Margin to add to right of even pages, to left of odd pages. +\newdimen\bindingoffset +\newdimen\normaloffset +\newdimen\pagewidth \newdimen\pageheight + +% For a final copy, take out the rectangles +% that mark overfull boxes (in case you have decided +% that the text looks ok even though it passes the margin). +% +\def\finalout{\overfullrule=0pt } + +% Sometimes it is convenient to have everything in the transcript file +% and nothing on the terminal. We don't just call \tracingall here, +% since that produces some useless output on the terminal. We also make +% some effort to order the tracing commands to reduce output in the log +% file; cf. trace.sty in LaTeX. +% +\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% +\def\loggingall{% + \tracingstats2 + \tracingpages1 + \tracinglostchars2 % 2 gives us more in etex + \tracingparagraphs1 + \tracingoutput1 + \tracingmacros2 + \tracingrestores1 + \showboxbreadth\maxdimen \showboxdepth\maxdimen + \ifx\eTeXversion\thisisundefined\else % etex gives us more logging + \tracingscantokens1 + \tracingifs1 + \tracinggroups1 + \tracingnesting2 + \tracingassigns1 + \fi + \tracingcommands3 % 3 gives us more in etex + \errorcontextlines16 +}% + +% add check for \lastpenalty to plain's definitions. If the last thing +% we did was a \nobreak, we don't want to insert more space. +% +\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount + \removelastskip\penalty-50\smallskip\fi\fi} +\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount + \removelastskip\penalty-100\medskip\fi\fi} +\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount + \removelastskip\penalty-200\bigskip\fi\fi} + +% Do @cropmarks to get crop marks. +% +\newif\ifcropmarks +\let\cropmarks = \cropmarkstrue +% +% Dimensions to add cropmarks at corners. +% Added by P. A. MacKay, 12 Nov. 1986 +% +\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines +\newdimen\cornerlong \cornerlong=1pc +\newdimen\cornerthick \cornerthick=.3pt +\newdimen\topandbottommargin \topandbottommargin=.75in + +% Output a mark which sets \thischapter, \thissection and \thiscolor. +% We dump everything together because we only have one kind of mark. +% This works because we only use \botmark / \topmark, not \firstmark. +% +% A mark contains a subexpression of the \ifcase ... \fi construct. +% \get*marks macros below extract the needed part using \ifcase. +% +% Another complication is to let the user choose whether \thischapter +% (\thissection) refers to the chapter (section) in effect at the top +% of a page, or that at the bottom of a page. The solution is +% described on page 260 of The TeXbook. It involves outputting two +% marks for the sectioning macros, one before the section break, and +% one after. I won't pretend I can describe this better than DEK... +\def\domark{% + \toks0=\expandafter{\lastchapterdefs}% + \toks2=\expandafter{\lastsectiondefs}% + \toks4=\expandafter{\prevchapterdefs}% + \toks6=\expandafter{\prevsectiondefs}% + \toks8=\expandafter{\lastcolordefs}% + \mark{% + \the\toks0 \the\toks2 + \noexpand\or \the\toks4 \the\toks6 + \noexpand\else \the\toks8 + }% +} +% \topmark doesn't work for the very first chapter (after the title +% page or the contents), so we use \firstmark there -- this gets us +% the mark with the chapter defs, unless the user sneaks in, e.g., +% @setcolor (or @url, or @link, etc.) between @contents and the very +% first @chapter. +\def\gettopheadingmarks{% + \ifcase0\topmark\fi + \ifx\thischapter\empty \ifcase0\firstmark\fi \fi +} +\def\getbottomheadingmarks{\ifcase1\botmark\fi} +\def\getcolormarks{\ifcase2\topmark\fi} + +% Avoid "undefined control sequence" errors. +\def\lastchapterdefs{} +\def\lastsectiondefs{} +\def\prevchapterdefs{} +\def\prevsectiondefs{} +\def\lastcolordefs{} + +% Main output routine. +\chardef\PAGE = 255 +\output = {\onepageout{\pagecontents\PAGE}} + +\newbox\headlinebox +\newbox\footlinebox + +% \onepageout takes a vbox as an argument. Note that \pagecontents +% does insertions, but you have to call it yourself. +\def\onepageout#1{% + \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi + % + \ifodd\pageno \advance\hoffset by \bindingoffset + \else \advance\hoffset by -\bindingoffset\fi + % + % Do this outside of the \shipout so @code etc. will be expanded in + % the headline as they should be, not taken literally (outputting ''code). + \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi + \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% + \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi + \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% + % + {% + % Have to do this stuff outside the \shipout because we want it to + % take effect in \write's, yet the group defined by the \vbox ends + % before the \shipout runs. + % + \indexdummies % don't expand commands in the output. + \normalturnoffactive % \ in index entries must not stay \, e.g., if + % the page break happens to be in the middle of an example. + % We don't want .vr (or whatever) entries like this: + % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} + % "\acronym" won't work when it's read back in; + % it needs to be + % {\code {{\tt \backslashcurfont }acronym} + \shipout\vbox{% + % Do this early so pdf references go to the beginning of the page. + \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi + % + \ifcropmarks \vbox to \outervsize\bgroup + \hsize = \outerhsize + \vskip-\topandbottommargin + \vtop to0pt{% + \line{\ewtop\hfil\ewtop}% + \nointerlineskip + \line{% + \vbox{\moveleft\cornerthick\nstop}% + \hfill + \vbox{\moveright\cornerthick\nstop}% + }% + \vss}% + \vskip\topandbottommargin + \line\bgroup + \hfil % center the page within the outer (page) hsize. + \ifodd\pageno\hskip\bindingoffset\fi + \vbox\bgroup + \fi + % + \unvbox\headlinebox + \pagebody{#1}% + \ifdim\ht\footlinebox > 0pt + % Only leave this space if the footline is nonempty. + % (We lessened \vsize for it in \oddfootingyyy.) + % The \baselineskip=24pt in plain's \makefootline has no effect. + \vskip 24pt + \unvbox\footlinebox + \fi + % + \ifcropmarks + \egroup % end of \vbox\bgroup + \hfil\egroup % end of (centering) \line\bgroup + \vskip\topandbottommargin plus1fill minus1fill + \boxmaxdepth = \cornerthick + \vbox to0pt{\vss + \line{% + \vbox{\moveleft\cornerthick\nsbot}% + \hfill + \vbox{\moveright\cornerthick\nsbot}% + }% + \nointerlineskip + \line{\ewbot\hfil\ewbot}% + }% + \egroup % \vbox from first cropmarks clause + \fi + }% end of \shipout\vbox + }% end of group with \indexdummies + \advancepageno + \ifnum\outputpenalty>-20000 \else\dosupereject\fi +} + +\newinsert\margin \dimen\margin=\maxdimen + +\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} +{\catcode`\@ =11 +\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi +% marginal hacks, juha@viisa.uucp (Juha Takala) +\ifvoid\margin\else % marginal info is present + \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi +\dimen@=\dp#1\relax \unvbox#1\relax +\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi +\ifr@ggedbottom \kern-\dimen@ \vfil \fi} +} + +% Here are the rules for the cropmarks. Note that they are +% offset so that the space between them is truly \outerhsize or \outervsize +% (P. A. MacKay, 12 November, 1986) +% +\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} +\def\nstop{\vbox + {\hrule height\cornerthick depth\cornerlong width\cornerthick}} +\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} +\def\nsbot{\vbox + {\hrule height\cornerlong depth\cornerthick width\cornerthick}} + +% Parse an argument, then pass it to #1. The argument is the rest of +% the input line (except we remove a trailing comment). #1 should be a +% macro which expects an ordinary undelimited TeX argument. +% +\def\parsearg{\parseargusing{}} +\def\parseargusing#1#2{% + \def\argtorun{#2}% + \begingroup + \obeylines + \spaceisspace + #1% + \parseargline\empty% Insert the \empty token, see \finishparsearg below. +} + +{\obeylines % + \gdef\parseargline#1^^M{% + \endgroup % End of the group started in \parsearg. + \argremovecomment #1\comment\ArgTerm% + }% +} + +% First remove any @comment, then any @c comment. +\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} +\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} + +% Each occurrence of `\^^M' or `\^^M' is replaced by a single space. +% +% \argremovec might leave us with trailing space, e.g., +% @end itemize @c foo +% This space token undergoes the same procedure and is eventually removed +% by \finishparsearg. +% +\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} +\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} +\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% + \def\temp{#3}% + \ifx\temp\empty + % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp: + \let\temp\finishparsearg + \else + \let\temp\argcheckspaces + \fi + % Put the space token in: + \temp#1 #3\ArgTerm +} + +% If a _delimited_ argument is enclosed in braces, they get stripped; so +% to get _exactly_ the rest of the line, we had to prevent such situation. +% We prepended an \empty token at the very beginning and we expand it now, +% just before passing the control to \argtorun. +% (Similarly, we have to think about #3 of \argcheckspacesY above: it is +% either the null string, or it ends with \^^M---thus there is no danger +% that a pair of braces would be stripped. +% +% But first, we have to remove the trailing space token. +% +\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} + +% \parseargdef\foo{...} +% is roughly equivalent to +% \def\foo{\parsearg\Xfoo} +% \def\Xfoo#1{...} +% +% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my +% favourite TeX trick. --kasal, 16nov03 + +\def\parseargdef#1{% + \expandafter \doparseargdef \csname\string#1\endcsname #1% +} +\def\doparseargdef#1#2{% + \def#2{\parsearg#1}% + \def#1##1% +} + +% Several utility definitions with active space: +{ + \obeyspaces + \gdef\obeyedspace{ } + + % Make each space character in the input produce a normal interword + % space in the output. Don't allow a line break at this space, as this + % is used only in environments like @example, where each line of input + % should produce a line of output anyway. + % + \gdef\sepspaces{\obeyspaces\let =\tie} + + % If an index command is used in an @example environment, any spaces + % therein should become regular spaces in the raw index file, not the + % expansion of \tie (\leavevmode \penalty \@M \ ). + \gdef\unsepspaces{\let =\space} +} + + +\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} + +% Define the framework for environments in texinfo.tex. It's used like this: +% +% \envdef\foo{...} +% \def\Efoo{...} +% +% It's the responsibility of \envdef to insert \begingroup before the +% actual body; @end closes the group after calling \Efoo. \envdef also +% defines \thisenv, so the current environment is known; @end checks +% whether the environment name matches. The \checkenv macro can also be +% used to check whether the current environment is the one expected. +% +% Non-false conditionals (@iftex, @ifset) don't fit into this, so they +% are not treated as environments; they don't open a group. (The +% implementation of @end takes care not to call \endgroup in this +% special case.) + + +% At run-time, environments start with this: +\def\startenvironment#1{\begingroup\def\thisenv{#1}} +% initialize +\let\thisenv\empty + +% ... but they get defined via ``\envdef\foo{...}'': +\long\def\envdef#1#2{\def#1{\startenvironment#1#2}} +\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} + +% Check whether we're in the right environment: +\def\checkenv#1{% + \def\temp{#1}% + \ifx\thisenv\temp + \else + \badenverr + \fi +} + +% Environment mismatch, #1 expected: +\def\badenverr{% + \errhelp = \EMsimple + \errmessage{This command can appear only \inenvironment\temp, + not \inenvironment\thisenv}% +} +\def\inenvironment#1{% + \ifx#1\empty + outside of any environment% + \else + in environment \expandafter\string#1% + \fi +} + +% @end foo executes the definition of \Efoo. +% But first, it executes a specialized version of \checkenv +% +\parseargdef\end{% + \if 1\csname iscond.#1\endcsname + \else + % The general wording of \badenverr may not be ideal. + \expandafter\checkenv\csname#1\endcsname + \csname E#1\endcsname + \endgroup + \fi +} + +\newhelp\EMsimple{Press RETURN to continue.} + + +% Be sure we're in horizontal mode when doing a tie, since we make space +% equivalent to this in @example-like environments. Otherwise, a space +% at the beginning of a line will start with \penalty -- and +% since \penalty is valid in vertical mode, we'd end up putting the +% penalty on the vertical list instead of in the new paragraph. +{\catcode`@ = 11 + % Avoid using \@M directly, because that causes trouble + % if the definition is written into an index file. + \global\let\tiepenalty = \@M + \gdef\tie{\leavevmode\penalty\tiepenalty\ } +} + +% @: forces normal size whitespace following. +\def\:{\spacefactor=1000 } + +% @* forces a line break. +\def\*{\hfil\break\hbox{}\ignorespaces} + +% @/ allows a line break. +\let\/=\allowbreak + +% @. is an end-of-sentence period. +\def\.{.\spacefactor=\endofsentencespacefactor\space} + +% @! is an end-of-sentence bang. +\def\!{!\spacefactor=\endofsentencespacefactor\space} + +% @? is an end-of-sentence query. +\def\?{?\spacefactor=\endofsentencespacefactor\space} + +% @frenchspacing on|off says whether to put extra space after punctuation. +% +\def\onword{on} +\def\offword{off} +% +\parseargdef\frenchspacing{% + \def\temp{#1}% + \ifx\temp\onword \plainfrenchspacing + \else\ifx\temp\offword \plainnonfrenchspacing + \else + \errhelp = \EMsimple + \errmessage{Unknown @frenchspacing option `\temp', must be on|off}% + \fi\fi +} + +% @w prevents a word break. Without the \leavevmode, @w at the +% beginning of a paragraph, when TeX is still in vertical mode, would +% produce a whole line of output instead of starting the paragraph. +\def\w#1{\leavevmode\hbox{#1}} + +% @group ... @end group forces ... to be all on one page, by enclosing +% it in a TeX vbox. We use \vtop instead of \vbox to construct the box +% to keep its height that of a normal line. According to the rules for +% \topskip (p.114 of the TeXbook), the glue inserted is +% max (\topskip - \ht (first item), 0). If that height is large, +% therefore, no glue is inserted, and the space between the headline and +% the text is small, which looks bad. +% +% Another complication is that the group might be very large. This can +% cause the glue on the previous page to be unduly stretched, because it +% does not have much material. In this case, it's better to add an +% explicit \vfill so that the extra space is at the bottom. The +% threshold for doing this is if the group is more than \vfilllimit +% percent of a page (\vfilllimit can be changed inside of @tex). +% +\newbox\groupbox +\def\vfilllimit{0.7} +% +\envdef\group{% + \ifnum\catcode`\^^M=\active \else + \errhelp = \groupinvalidhelp + \errmessage{@group invalid in context where filling is enabled}% + \fi + \startsavinginserts + % + \setbox\groupbox = \vtop\bgroup + % Do @comment since we are called inside an environment such as + % @example, where each end-of-line in the input causes an + % end-of-line in the output. We don't want the end-of-line after + % the `@group' to put extra space in the output. Since @group + % should appear on a line by itself (according to the Texinfo + % manual), we don't worry about eating any user text. + \comment +} +% +% The \vtop produces a box with normal height and large depth; thus, TeX puts +% \baselineskip glue before it, and (when the next line of text is done) +% \lineskip glue after it. Thus, space below is not quite equal to space +% above. But it's pretty close. +\def\Egroup{% + % To get correct interline space between the last line of the group + % and the first line afterwards, we have to propagate \prevdepth. + \endgraf % Not \par, as it may have been set to \lisppar. + \global\dimen1 = \prevdepth + \egroup % End the \vtop. + % \dimen0 is the vertical size of the group's box. + \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox + % \dimen2 is how much space is left on the page (more or less). + \dimen2 = \pageheight \advance\dimen2 by -\pagetotal + % if the group doesn't fit on the current page, and it's a big big + % group, force a page break. + \ifdim \dimen0 > \dimen2 + \ifdim \pagetotal < \vfilllimit\pageheight + \page + \fi + \fi + \box\groupbox + \prevdepth = \dimen1 + \checkinserts +} +% +% TeX puts in an \escapechar (i.e., `@') at the beginning of the help +% message, so this ends up printing `@group can only ...'. +% +\newhelp\groupinvalidhelp{% +group can only be used in environments such as @example,^^J% +where each line of input produces a line of output.} + +% @need space-in-mils +% forces a page break if there is not space-in-mils remaining. + +\newdimen\mil \mil=0.001in + +\parseargdef\need{% + % Ensure vertical mode, so we don't make a big box in the middle of a + % paragraph. + \par + % + % If the @need value is less than one line space, it's useless. + \dimen0 = #1\mil + \dimen2 = \ht\strutbox + \advance\dimen2 by \dp\strutbox + \ifdim\dimen0 > \dimen2 + % + % Do a \strut just to make the height of this box be normal, so the + % normal leading is inserted relative to the preceding line. + % And a page break here is fine. + \vtop to #1\mil{\strut\vfil}% + % + % TeX does not even consider page breaks if a penalty added to the + % main vertical list is 10000 or more. But in order to see if the + % empty box we just added fits on the page, we must make it consider + % page breaks. On the other hand, we don't want to actually break the + % page after the empty box. So we use a penalty of 9999. + % + % There is an extremely small chance that TeX will actually break the + % page at this \penalty, if there are no other feasible breakpoints in + % sight. (If the user is using lots of big @group commands, which + % almost-but-not-quite fill up a page, TeX will have a hard time doing + % good page breaking, for example.) However, I could not construct an + % example where a page broke at this \penalty; if it happens in a real + % document, then we can reconsider our strategy. + \penalty9999 + % + % Back up by the size of the box, whether we did a page break or not. + \kern -#1\mil + % + % Do not allow a page break right after this kern. + \nobreak + \fi +} + +% @br forces paragraph break (and is undocumented). + +\let\br = \par + +% @page forces the start of a new page. +% +\def\page{\par\vfill\supereject} + +% @exdent text.... +% outputs text on separate line in roman font, starting at standard page margin + +% This records the amount of indent in the innermost environment. +% That's how much \exdent should take out. +\newskip\exdentamount + +% This defn is used inside fill environments such as @defun. +\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} + +% This defn is used inside nofill environments such as @example. +\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount + \leftline{\hskip\leftskip{\rm#1}}}} + +% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current +% paragraph. For more general purposes, use the \margin insertion +% class. WHICH is `l' or `r'. Not documented, written for gawk manual. +% +\newskip\inmarginspacing \inmarginspacing=1cm +\def\strutdepth{\dp\strutbox} +% +\def\doinmargin#1#2{\strut\vadjust{% + \nobreak + \kern-\strutdepth + \vtop to \strutdepth{% + \baselineskip=\strutdepth + \vss + % if you have multiple lines of stuff to put here, you'll need to + % make the vbox yourself of the appropriate size. + \ifx#1l% + \llap{\ignorespaces #2\hskip\inmarginspacing}% + \else + \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% + \fi + \null + }% +}} +\def\inleftmargin{\doinmargin l} +\def\inrightmargin{\doinmargin r} +% +% @inmargin{TEXT [, RIGHT-TEXT]} +% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; +% else use TEXT for both). +% +\def\inmargin#1{\parseinmargin #1,,\finish} +\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \def\lefttext{#1}% have both texts + \def\righttext{#2}% + \else + \def\lefttext{#1}% have only one text + \def\righttext{#1}% + \fi + % + \ifodd\pageno + \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin + \else + \def\temp{\inleftmargin\lefttext}% + \fi + \temp +} + +% @| inserts a changebar to the left of the current line. It should +% surround any changed text. This approach does *not* work if the +% change spans more than two lines of output. To handle that, we would +% have adopt a much more difficult approach (putting marks into the main +% vertical list for the beginning and end of each change). This command +% is not documented, not supported, and doesn't work. +% +\def\|{% + % \vadjust can only be used in horizontal mode. + \leavevmode + % + % Append this vertical mode material after the current line in the output. + \vadjust{% + % We want to insert a rule with the height and depth of the current + % leading; that is exactly what \strutbox is supposed to record. + \vskip-\baselineskip + % + % \vadjust-items are inserted at the left edge of the type. So + % the \llap here moves out into the left-hand margin. + \llap{% + % + % For a thicker or thinner bar, change the `1pt'. + \vrule height\baselineskip width1pt + % + % This is the space between the bar and the text. + \hskip 12pt + }% + }% +} + +% @include FILE -- \input text of FILE. +% +\def\include{\parseargusing\filenamecatcodes\includezzz} +\def\includezzz#1{% + \pushthisfilestack + \def\thisfile{#1}% + {% + \makevalueexpandable % we want to expand any @value in FILE. + \turnoffactive % and allow special characters in the expansion + \indexnofonts % Allow `@@' and other weird things in file names. + \wlog{texinfo.tex: doing @include of #1^^J}% + \edef\temp{\noexpand\input #1 }% + % + % This trickery is to read FILE outside of a group, in case it makes + % definitions, etc. + \expandafter + }\temp + \popthisfilestack +} +\def\filenamecatcodes{% + \catcode`\\=\other + \catcode`~=\other + \catcode`^=\other + \catcode`_=\other + \catcode`|=\other + \catcode`<=\other + \catcode`>=\other + \catcode`+=\other + \catcode`-=\other + \catcode`\`=\other + \catcode`\'=\other +} + +\def\pushthisfilestack{% + \expandafter\pushthisfilestackX\popthisfilestack\StackTerm +} +\def\pushthisfilestackX{% + \expandafter\pushthisfilestackY\thisfile\StackTerm +} +\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% + \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% +} + +\def\popthisfilestack{\errthisfilestackempty} +\def\errthisfilestackempty{\errmessage{Internal error: + the stack of filenames is empty.}} + +\def\thisfile{} + +% @center line +% outputs that line, centered. +% +\parseargdef\center{% + \ifhmode + \let\next\centerH + \else + \let\next\centerV + \fi + \next{\hfil \ignorespaces#1\unskip \hfil}% +} +\def\centerH#1{% + {% + \hfil\break + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + \line{#1}% + \break + }% +} +\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} + +% @sp n outputs n lines of vertical space + +\parseargdef\sp{\vskip #1\baselineskip} + +% @comment ...line which is ignored... +% @c is the same as @comment +% @ignore ... @end ignore is another way to write a comment + +\def\comment{\begingroup \catcode`\^^M=\other% +\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% +\commentxxx} +{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} + +\let\c=\comment + +% @paragraphindent NCHARS +% We'll use ems for NCHARS, close enough. +% NCHARS can also be the word `asis' or `none'. +% We cannot feasibly implement @paragraphindent asis, though. +% +\def\asisword{asis} % no translation, these are keywords +\def\noneword{none} +% +\parseargdef\paragraphindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \defaultparindent = 0pt + \else + \defaultparindent = #1em + \fi + \fi + \parindent = \defaultparindent +} + +% @exampleindent NCHARS +% We'll use ems for NCHARS like @paragraphindent. +% It seems @exampleindent asis isn't necessary, but +% I preserve it to make it similar to @paragraphindent. +\parseargdef\exampleindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \lispnarrowing = 0pt + \else + \lispnarrowing = #1em + \fi + \fi +} + +% @firstparagraphindent WORD +% If WORD is `none', then suppress indentation of the first paragraph +% after a section heading. If WORD is `insert', then do indent at such +% paragraphs. +% +% The paragraph indentation is suppressed or not by calling +% \suppressfirstparagraphindent, which the sectioning commands do. +% We switch the definition of this back and forth according to WORD. +% By default, we suppress indentation. +% +\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} +\def\insertword{insert} +% +\parseargdef\firstparagraphindent{% + \def\temp{#1}% + \ifx\temp\noneword + \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent + \else\ifx\temp\insertword + \let\suppressfirstparagraphindent = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @firstparagraphindent option `\temp'}% + \fi\fi +} + +% Here is how we actually suppress indentation. Redefine \everypar to +% \kern backwards by \parindent, and then reset itself to empty. +% +% We also make \indent itself not actually do anything until the next +% paragraph. +% +\gdef\dosuppressfirstparagraphindent{% + \gdef\indent{% + \restorefirstparagraphindent + \indent + }% + \gdef\noindent{% + \restorefirstparagraphindent + \noindent + }% + \global\everypar = {% + \kern -\parindent + \restorefirstparagraphindent + }% +} + +\gdef\restorefirstparagraphindent{% + \global \let \indent = \ptexindent + \global \let \noindent = \ptexnoindent + \global \everypar = {}% +} + + +% @refill is a no-op. +\let\refill=\relax + +% If working on a large document in chapters, it is convenient to +% be able to disable indexing, cross-referencing, and contents, for test runs. +% This is done with @novalidate (before @setfilename). +% +\newif\iflinks \linkstrue % by default we want the aux files. +\let\novalidate = \linksfalse + +% @setfilename is done at the beginning of every texinfo file. +% So open here the files we need to have open while reading the input. +% This makes it possible to make a .fmt file for texinfo. +\def\setfilename{% + \fixbackslash % Turn off hack to swallow `\input texinfo'. + \iflinks + \tryauxfile + % Open the new aux file. TeX will close it automatically at exit. + \immediate\openout\auxfile=\jobname.aux + \fi % \openindices needs to do some work in any case. + \openindices + \let\setfilename=\comment % Ignore extra @setfilename cmds. + % + % If texinfo.cnf is present on the system, read it. + % Useful for site-wide @afourpaper, etc. + \openin 1 texinfo.cnf + \ifeof 1 \else \input texinfo.cnf \fi + \closein 1 + % + \comment % Ignore the actual filename. +} + +% Called from \setfilename. +% +\def\openindices{% + \newindex{cp}% + \newcodeindex{fn}% + \newcodeindex{vr}% + \newcodeindex{tp}% + \newcodeindex{ky}% + \newcodeindex{pg}% +} + +% @bye. +\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} + + +\message{pdf,} +% adobe `portable' document format +\newcount\tempnum +\newcount\lnkcount +\newtoks\filename +\newcount\filenamelength +\newcount\pgn +\newtoks\toksA +\newtoks\toksB +\newtoks\toksC +\newtoks\toksD +\newbox\boxA +\newcount\countA +\newif\ifpdf +\newif\ifpdfmakepagedest + +% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 +% can be set). So we test for \relax and 0 as well as being undefined. +\ifx\pdfoutput\thisisundefined +\else + \ifx\pdfoutput\relax + \else + \ifcase\pdfoutput + \else + \pdftrue + \fi + \fi +\fi + +% PDF uses PostScript string constants for the names of xref targets, +% for display in the outlines, and in other places. Thus, we have to +% double any backslashes. Otherwise, a name like "\node" will be +% interpreted as a newline (\n), followed by o, d, e. Not good. +% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html +% (and related messages, the final outcome is that it is up to the TeX +% user to double the backslashes and otherwise make the string valid, so +% that's what we do). + +% double active backslashes. +% +{\catcode`\@=0 \catcode`\\=\active + @gdef@activebackslashdouble{% + @catcode`@\=@active + @let\=@doublebackslash} +} + +% To handle parens, we must adopt a different approach, since parens are +% not active characters. hyperref.dtx (which has the same problem as +% us) handles it with this amazing macro to replace tokens, with minor +% changes for Texinfo. It is included here under the GPL by permission +% from the author, Heiko Oberdiek. +% +% #1 is the tokens to replace. +% #2 is the replacement. +% #3 is the control sequence with the string. +% +\def\HyPsdSubst#1#2#3{% + \def\HyPsdReplace##1#1##2\END{% + ##1% + \ifx\\##2\\% + \else + #2% + \HyReturnAfterFi{% + \HyPsdReplace##2\END + }% + \fi + }% + \xdef#3{\expandafter\HyPsdReplace#3#1\END}% +} +\long\def\HyReturnAfterFi#1\fi{\fi#1} + +% #1 is a control sequence in which to do the replacements. +\def\backslashparens#1{% + \xdef#1{#1}% redefine it as its expansion; the definition is simply + % \lastnode when called from \setref -> \pdfmkdest. + \HyPsdSubst{(}{\realbackslash(}{#1}% + \HyPsdSubst{)}{\realbackslash)}{#1}% +} + +\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images +with PDF output, and none of those formats could be found. (.eps cannot +be supported due to the design of the PDF format; use regular TeX (DVI +output) for that.)} + +\ifpdf + % + % Color manipulation macros based on pdfcolor.tex, + % except using rgb instead of cmyk; the latter is said to render as a + % very dark gray on-screen and a very dark halftone in print, instead + % of actual black. + \def\rgbDarkRed{0.50 0.09 0.12} + \def\rgbBlack{0 0 0} + % + % k sets the color for filling (usual text, etc.); + % K sets the color for stroking (thin rules, e.g., normal _'s). + \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}} + % + % Set color, and create a mark which defines \thiscolor accordingly, + % so that \makeheadline knows which color to restore. + \def\setcolor#1{% + \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}% + \domark + \pdfsetcolor{#1}% + } + % + \def\maincolor{\rgbBlack} + \pdfsetcolor{\maincolor} + \edef\thiscolor{\maincolor} + \def\lastcolordefs{} + % + \def\makefootline{% + \baselineskip24pt + \line{\pdfsetcolor{\maincolor}\the\footline}% + } + % + \def\makeheadline{% + \vbox to 0pt{% + \vskip-22.5pt + \line{% + \vbox to8.5pt{}% + % Extract \thiscolor definition from the marks. + \getcolormarks + % Typeset the headline with \maincolor, then restore the color. + \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% + }% + \vss + }% + \nointerlineskip + } + % + % + \pdfcatalog{/PageMode /UseOutlines} + % + % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). + \def\dopdfimage#1#2#3{% + \def\imagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% + \def\imageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% + % + % pdftex (and the PDF format) support .png, .jpg, .pdf (among + % others). Let's try in that order. + \let\pdfimgext=\empty + \begingroup + \openin 1 #1.png \ifeof 1 + \openin 1 #1.jpg \ifeof 1 + \openin 1 #1.jpeg \ifeof 1 + \openin 1 #1.JPG \ifeof 1 + \openin 1 #1.pdf \ifeof 1 + \openin 1 #1.PDF \ifeof 1 + \errhelp = \nopdfimagehelp + \errmessage{Could not find image file #1 for pdf}% + \else \gdef\pdfimgext{PDF}% + \fi + \else \gdef\pdfimgext{pdf}% + \fi + \else \gdef\pdfimgext{JPG}% + \fi + \else \gdef\pdfimgext{jpeg}% + \fi + \else \gdef\pdfimgext{jpg}% + \fi + \else \gdef\pdfimgext{png}% + \fi + \closein 1 + \endgroup + % + % without \immediate, ancient pdftex seg faults when the same image is + % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) + \ifnum\pdftexversion < 14 + \immediate\pdfimage + \else + \immediate\pdfximage + \fi + \ifdim \wd0 >0pt width \imagewidth \fi + \ifdim \wd2 >0pt height \imageheight \fi + \ifnum\pdftexversion<13 + #1.\pdfimgext + \else + {#1.\pdfimgext}% + \fi + \ifnum\pdftexversion < 14 \else + \pdfrefximage \pdflastximage + \fi} + % + \def\pdfmkdest#1{{% + % We have to set dummies so commands such as @code, and characters + % such as \, aren't expanded when present in a section title. + \indexnofonts + \turnoffactive + \activebackslashdouble + \makevalueexpandable + \def\pdfdestname{#1}% + \backslashparens\pdfdestname + \safewhatsit{\pdfdest name{\pdfdestname} xyz}% + }} + % + % used to mark target names; must be expandable. + \def\pdfmkpgn#1{#1} + % + % by default, use a color that is dark enough to print on paper as + % nearly black, but still distinguishable for online viewing. + \def\urlcolor{\rgbDarkRed} + \def\linkcolor{\rgbDarkRed} + \def\endlink{\setcolor{\maincolor}\pdfendlink} + % + % Adding outlines to PDF; macros for calculating structure of outlines + % come from Petr Olsak + \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% + \else \csname#1\endcsname \fi} + \def\advancenumber#1{\tempnum=\expnumber{#1}\relax + \advance\tempnum by 1 + \expandafter\xdef\csname#1\endcsname{\the\tempnum}} + % + % #1 is the section text, which is what will be displayed in the + % outline by the pdf viewer. #2 is the pdf expression for the number + % of subentries (or empty, for subsubsections). #3 is the node text, + % which might be empty if this toc entry had no corresponding node. + % #4 is the page number + % + \def\dopdfoutline#1#2#3#4{% + % Generate a link to the node text if that exists; else, use the + % page number. We could generate a destination for the section + % text in the case where a section has no node, but it doesn't + % seem worth the trouble, since most documents are normally structured. + \def\pdfoutlinedest{#3}% + \ifx\pdfoutlinedest\empty + \def\pdfoutlinedest{#4}% + \else + % Doubled backslashes in the name. + {\activebackslashdouble \xdef\pdfoutlinedest{#3}% + \backslashparens\pdfoutlinedest}% + \fi + % + % Also double the backslashes in the display string. + {\activebackslashdouble \xdef\pdfoutlinetext{#1}% + \backslashparens\pdfoutlinetext}% + % + \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% + } + % + \def\pdfmakeoutlines{% + \begingroup + % Thanh's hack / proper braces in bookmarks + \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace + \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace + % + % Read toc silently, to get counts of subentries for \pdfoutline. + \def\partentry##1##2##3##4{}% ignore parts in the outlines + \def\numchapentry##1##2##3##4{% + \def\thischapnum{##2}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + }% + \def\numsecentry##1##2##3##4{% + \advancenumber{chap\thischapnum}% + \def\thissecnum{##2}% + \def\thissubsecnum{0}% + }% + \def\numsubsecentry##1##2##3##4{% + \advancenumber{sec\thissecnum}% + \def\thissubsecnum{##2}% + }% + \def\numsubsubsecentry##1##2##3##4{% + \advancenumber{subsec\thissubsecnum}% + }% + \def\thischapnum{0}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + % + % use \def rather than \let here because we redefine \chapentry et + % al. a second time, below. + \def\appentry{\numchapentry}% + \def\appsecentry{\numsecentry}% + \def\appsubsecentry{\numsubsecentry}% + \def\appsubsubsecentry{\numsubsubsecentry}% + \def\unnchapentry{\numchapentry}% + \def\unnsecentry{\numsecentry}% + \def\unnsubsecentry{\numsubsecentry}% + \def\unnsubsubsecentry{\numsubsubsecentry}% + \readdatafile{toc}% + % + % Read toc second time, this time actually producing the outlines. + % The `-' means take the \expnumber as the absolute number of + % subentries, which we calculated on our first read of the .toc above. + % + % We use the node names as the destinations. + \def\numchapentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% + \def\numsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% + \def\numsubsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% + \def\numsubsubsecentry##1##2##3##4{% count is always zero + \dopdfoutline{##1}{}{##3}{##4}}% + % + % PDF outlines are displayed using system fonts, instead of + % document fonts. Therefore we cannot use special characters, + % since the encoding is unknown. For example, the eogonek from + % Latin 2 (0xea) gets translated to a | character. Info from + % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. + % + % xx to do this right, we have to translate 8-bit characters to + % their "best" equivalent, based on the @documentencoding. Right + % now, I guess we'll just let the pdf reader have its way. + \indexnofonts + \setupdatafile + \catcode`\\=\active \otherbackslash + \input \tocreadfilename + \endgroup + } + % + \def\skipspaces#1{\def\PP{#1}\def\D{|}% + \ifx\PP\D\let\nextsp\relax + \else\let\nextsp\skipspaces + \ifx\p\space\else\addtokens{\filename}{\PP}% + \advance\filenamelength by 1 + \fi + \fi + \nextsp} + \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} + \ifnum\pdftexversion < 14 + \let \startlink \pdfannotlink + \else + \let \startlink \pdfstartlink + \fi + % make a live url in pdf output. + \def\pdfurl#1{% + \begingroup + % it seems we really need yet another set of dummies; have not + % tried to figure out what each command should do in the context + % of @url. for now, just make @/ a no-op, that's the only one + % people have actually reported a problem with. + % + \normalturnoffactive + \def\@{@}% + \let\/=\empty + \makevalueexpandable + % do we want to go so far as to use \indexnofonts instead of just + % special-casing \var here? + \def\var##1{##1}% + % + \leavevmode\setcolor{\urlcolor}% + \startlink attr{/Border [0 0 0]}% + user{/Subtype /Link /A << /S /URI /URI (#1) >>}% + \endgroup} + \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} + \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} + \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} + \def\maketoks{% + \expandafter\poptoks\the\toksA|ENDTOKS|\relax + \ifx\first0\adn0 + \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 + \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 + \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 + \else + \ifnum0=\countA\else\makelink\fi + \ifx\first.\let\next=\done\else + \let\next=\maketoks + \addtokens{\toksB}{\the\toksD} + \ifx\first,\addtokens{\toksB}{\space}\fi + \fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \next} + \def\makelink{\addtokens{\toksB}% + {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} + \def\pdflink#1{% + \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} + \setcolor{\linkcolor}#1\endlink} + \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} +\else + % non-pdf mode + \let\pdfmkdest = \gobble + \let\pdfurl = \gobble + \let\endlink = \relax + \let\setcolor = \gobble + \let\pdfsetcolor = \gobble + \let\pdfmakeoutlines = \relax +\fi % \ifx\pdfoutput + + +\message{fonts,} + +% Change the current font style to #1, remembering it in \curfontstyle. +% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in +% italics, not bold italics. +% +\def\setfontstyle#1{% + \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. + \csname ten#1\endcsname % change the current font +} + +% Select #1 fonts with the current style. +% +\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} + +\def\rm{\fam=0 \setfontstyle{rm}} +\def\it{\fam=\itfam \setfontstyle{it}} +\def\sl{\fam=\slfam \setfontstyle{sl}} +\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} +\def\tt{\fam=\ttfam \setfontstyle{tt}} + +% Unfortunately, we have to override this for titles and the like, since +% in those cases "rm" is bold. Sigh. +\def\rmisbold{\rm\def\curfontstyle{bf}} + +% Texinfo sort of supports the sans serif font style, which plain TeX does not. +% So we set up a \sf. +\newfam\sffam +\def\sf{\fam=\sffam \setfontstyle{sf}} +\let\li = \sf % Sometimes we call it \li, not \sf. + +% We don't need math for this font style. +\def\ttsl{\setfontstyle{ttsl}} + + +% Default leading. +\newdimen\textleading \textleading = 13.2pt + +% Set the baselineskip to #1, and the lineskip and strut size +% correspondingly. There is no deep meaning behind these magic numbers +% used as factors; they just match (closely enough) what Knuth defined. +% +\def\lineskipfactor{.08333} +\def\strutheightpercent{.70833} +\def\strutdepthpercent {.29167} +% +% can get a sort of poor man's double spacing by redefining this. +\def\baselinefactor{1} +% +\def\setleading#1{% + \dimen0 = #1\relax + \normalbaselineskip = \baselinefactor\dimen0 + \normallineskip = \lineskipfactor\normalbaselineskip + \normalbaselines + \setbox\strutbox =\hbox{% + \vrule width0pt height\strutheightpercent\baselineskip + depth \strutdepthpercent \baselineskip + }% +} + +% PDF CMaps. See also LaTeX's t1.cmap. +% +% do nothing with this by default. +\expandafter\let\csname cmapOT1\endcsname\gobble +\expandafter\let\csname cmapOT1IT\endcsname\gobble +\expandafter\let\csname cmapOT1TT\endcsname\gobble + +% if we are producing pdf, and we have \pdffontattr, then define cmaps. +% (\pdffontattr was introduced many years ago, but people still run +% older pdftex's; it's easy to conditionalize, so we do.) +\ifpdf \ifx\pdffontattr\thisisundefined \else + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1-0) +%%Title: (TeX-OT1-0 TeX OT1 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1) +/Supplement 0 +>> def +/CMapName /TeX-OT1-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +8 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<23> <26> <0023> +<28> <3B> <0028> +<3F> <5B> <003F> +<5D> <5E> <005D> +<61> <7A> <0061> +<7B> <7C> <2013> +endbfrange +40 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <00660066> +<0C> <00660069> +<0D> <0066006C> +<0E> <006600660069> +<0F> <00660066006C> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<21> <0021> +<22> <201D> +<27> <2019> +<3C> <00A1> +<3D> <003D> +<3E> <00BF> +<5C> <201C> +<5F> <02D9> +<60> <2018> +<7D> <02DD> +<7E> <007E> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +% +% \cmapOT1IT + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1IT-0) +%%Title: (TeX-OT1IT-0 TeX OT1IT 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1IT) +/Supplement 0 +>> def +/CMapName /TeX-OT1IT-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +8 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<25> <26> <0025> +<28> <3B> <0028> +<3F> <5B> <003F> +<5D> <5E> <005D> +<61> <7A> <0061> +<7B> <7C> <2013> +endbfrange +42 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <00660066> +<0C> <00660069> +<0D> <0066006C> +<0E> <006600660069> +<0F> <00660066006C> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<21> <0021> +<22> <201D> +<23> <0023> +<24> <00A3> +<27> <2019> +<3C> <00A1> +<3D> <003D> +<3E> <00BF> +<5C> <201C> +<5F> <02D9> +<60> <2018> +<7D> <02DD> +<7E> <007E> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1IT\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +% +% \cmapOT1TT + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1TT-0) +%%Title: (TeX-OT1TT-0 TeX OT1TT 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1TT) +/Supplement 0 +>> def +/CMapName /TeX-OT1TT-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +5 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<21> <26> <0021> +<28> <5F> <0028> +<61> <7E> <0061> +endbfrange +32 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <2191> +<0C> <2193> +<0D> <0027> +<0E> <00A1> +<0F> <00BF> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<20> <2423> +<27> <2019> +<60> <2018> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1TT\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +\fi\fi + + +% Set the font macro #1 to the font named #2, adding on the +% specified font prefix (normally `cm'). +% #3 is the font's design size, #4 is a scale factor, #5 is the CMap +% encoding (currently only OT1, OT1IT and OT1TT are allowed, pass +% empty to omit). +\def\setfont#1#2#3#4#5{% + \font#1=\fontprefix#2#3 scaled #4 + \csname cmap#5\endcsname#1% +} +% This is what gets called when #5 of \setfont is empty. +\let\cmap\gobble +% emacs-page end of cmaps + +% Use cm as the default font prefix. +% To specify the font prefix, you must define \fontprefix +% before you read in texinfo.tex. +\ifx\fontprefix\thisisundefined +\def\fontprefix{cm} +\fi +% Support font families that don't use the same naming scheme as CM. +\def\rmshape{r} +\def\rmbshape{bx} %where the normal face is bold +\def\bfshape{b} +\def\bxshape{bx} +\def\ttshape{tt} +\def\ttbshape{tt} +\def\ttslshape{sltt} +\def\itshape{ti} +\def\itbshape{bxti} +\def\slshape{sl} +\def\slbshape{bxsl} +\def\sfshape{ss} +\def\sfbshape{ss} +\def\scshape{csc} +\def\scbshape{csc} + +% Definitions for a main text size of 11pt. This is the default in +% Texinfo. +% +\def\definetextfontsizexi{% +% Text fonts (11.2pt, magstep1). +\def\textnominalsize{11pt} +\edef\mainmagstep{\magstephalf} +\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} +\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} +\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} +\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} +\setfont\textsl\slshape{10}{\mainmagstep}{OT1} +\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} +\setfont\textsc\scshape{10}{\mainmagstep}{OT1} +\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep +\def\textecsize{1095} + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstep1}{OT1} +\setfont\deftt\ttshape{10}{\magstep1}{OT1TT} +\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000}{OT1} +\setfont\smalltt\ttshape{9}{1000}{OT1TT} +\setfont\smallbf\bfshape{10}{900}{OT1} +\setfont\smallit\itshape{9}{1000}{OT1IT} +\setfont\smallsl\slshape{9}{1000}{OT1} +\setfont\smallsf\sfshape{9}{1000}{OT1} +\setfont\smallsc\scshape{10}{900}{OT1} +\setfont\smallttsl\ttslshape{10}{900}{OT1TT} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 +\def\smallecsize{0900} + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000}{OT1} +\setfont\smallertt\ttshape{8}{1000}{OT1TT} +\setfont\smallerbf\bfshape{10}{800}{OT1} +\setfont\smallerit\itshape{8}{1000}{OT1IT} +\setfont\smallersl\slshape{8}{1000}{OT1} +\setfont\smallersf\sfshape{8}{1000}{OT1} +\setfont\smallersc\scshape{10}{800}{OT1} +\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 +\def\smallerecsize{0800} + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} +\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} +\setfont\titlesl\slbshape{10}{\magstep4}{OT1} +\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} +\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} +\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4}{OT1} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\titleecsize{2074} + +% Chapter (and unnumbered) fonts (17.28pt). +\def\chapnominalsize{17pt} +\setfont\chaprm\rmbshape{12}{\magstep2}{OT1} +\setfont\chapit\itbshape{10}{\magstep3}{OT1IT} +\setfont\chapsl\slbshape{10}{\magstep3}{OT1} +\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT} +\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT} +\setfont\chapsf\sfbshape{17}{1000}{OT1} +\let\chapbf=\chaprm +\setfont\chapsc\scbshape{10}{\magstep3}{OT1} +\font\chapi=cmmi12 scaled \magstep2 +\font\chapsy=cmsy10 scaled \magstep3 +\def\chapecsize{1728} + +% Section fonts (14.4pt). +\def\secnominalsize{14pt} +\setfont\secrm\rmbshape{12}{\magstep1}{OT1} +\setfont\secit\itbshape{10}{\magstep2}{OT1IT} +\setfont\secsl\slbshape{10}{\magstep2}{OT1} +\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} +\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} +\setfont\secsf\sfbshape{12}{\magstep1}{OT1} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep2}{OT1} +\font\seci=cmmi12 scaled \magstep1 +\font\secsy=cmsy10 scaled \magstep2 +\def\sececsize{1440} + +% Subsection fonts (13.15pt). +\def\ssecnominalsize{13pt} +\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1} +\setfont\ssecit\itbshape{10}{1315}{OT1IT} +\setfont\ssecsl\slbshape{10}{1315}{OT1} +\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT} +\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT} +\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{1315}{OT1} +\font\sseci=cmmi12 scaled \magstephalf +\font\ssecsy=cmsy10 scaled 1315 +\def\ssececsize{1200} + +% Reduced fonts for @acro in text (10pt). +\def\reducednominalsize{10pt} +\setfont\reducedrm\rmshape{10}{1000}{OT1} +\setfont\reducedtt\ttshape{10}{1000}{OT1TT} +\setfont\reducedbf\bfshape{10}{1000}{OT1} +\setfont\reducedit\itshape{10}{1000}{OT1IT} +\setfont\reducedsl\slshape{10}{1000}{OT1} +\setfont\reducedsf\sfshape{10}{1000}{OT1} +\setfont\reducedsc\scshape{10}{1000}{OT1} +\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT} +\font\reducedi=cmmi10 +\font\reducedsy=cmsy10 +\def\reducedecsize{1000} + +\textleading = 13.2pt % line spacing for 11pt CM +\textfonts % reset the current fonts +\rm +} % end of 11pt text font size definitions + + +% Definitions to make the main text be 10pt Computer Modern, with +% section, chapter, etc., sizes following suit. This is for the GNU +% Press printing of the Emacs 22 manual. Maybe other manuals in the +% future. Used with @smallbook, which sets the leading to 12pt. +% +\def\definetextfontsizex{% +% Text fonts (10pt). +\def\textnominalsize{10pt} +\edef\mainmagstep{1000} +\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} +\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} +\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} +\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} +\setfont\textsl\slshape{10}{\mainmagstep}{OT1} +\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} +\setfont\textsc\scshape{10}{\mainmagstep}{OT1} +\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep +\def\textecsize{1000} + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstephalf}{OT1} +\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} +\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000}{OT1} +\setfont\smalltt\ttshape{9}{1000}{OT1TT} +\setfont\smallbf\bfshape{10}{900}{OT1} +\setfont\smallit\itshape{9}{1000}{OT1IT} +\setfont\smallsl\slshape{9}{1000}{OT1} +\setfont\smallsf\sfshape{9}{1000}{OT1} +\setfont\smallsc\scshape{10}{900}{OT1} +\setfont\smallttsl\ttslshape{10}{900}{OT1TT} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 +\def\smallecsize{0900} + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000}{OT1} +\setfont\smallertt\ttshape{8}{1000}{OT1TT} +\setfont\smallerbf\bfshape{10}{800}{OT1} +\setfont\smallerit\itshape{8}{1000}{OT1IT} +\setfont\smallersl\slshape{8}{1000}{OT1} +\setfont\smallersf\sfshape{8}{1000}{OT1} +\setfont\smallersc\scshape{10}{800}{OT1} +\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 +\def\smallerecsize{0800} + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} +\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} +\setfont\titlesl\slbshape{10}{\magstep4}{OT1} +\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} +\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} +\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4}{OT1} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\titleecsize{2074} + +% Chapter fonts (14.4pt). +\def\chapnominalsize{14pt} +\setfont\chaprm\rmbshape{12}{\magstep1}{OT1} +\setfont\chapit\itbshape{10}{\magstep2}{OT1IT} +\setfont\chapsl\slbshape{10}{\magstep2}{OT1} +\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT} +\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT} +\setfont\chapsf\sfbshape{12}{\magstep1}{OT1} +\let\chapbf\chaprm +\setfont\chapsc\scbshape{10}{\magstep2}{OT1} +\font\chapi=cmmi12 scaled \magstep1 +\font\chapsy=cmsy10 scaled \magstep2 +\def\chapecsize{1440} + +% Section fonts (12pt). +\def\secnominalsize{12pt} +\setfont\secrm\rmbshape{12}{1000}{OT1} +\setfont\secit\itbshape{10}{\magstep1}{OT1IT} +\setfont\secsl\slbshape{10}{\magstep1}{OT1} +\setfont\sectt\ttbshape{12}{1000}{OT1TT} +\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT} +\setfont\secsf\sfbshape{12}{1000}{OT1} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep1}{OT1} +\font\seci=cmmi12 +\font\secsy=cmsy10 scaled \magstep1 +\def\sececsize{1200} + +% Subsection fonts (10pt). +\def\ssecnominalsize{10pt} +\setfont\ssecrm\rmbshape{10}{1000}{OT1} +\setfont\ssecit\itbshape{10}{1000}{OT1IT} +\setfont\ssecsl\slbshape{10}{1000}{OT1} +\setfont\ssectt\ttbshape{10}{1000}{OT1TT} +\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT} +\setfont\ssecsf\sfbshape{10}{1000}{OT1} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{1000}{OT1} +\font\sseci=cmmi10 +\font\ssecsy=cmsy10 +\def\ssececsize{1000} + +% Reduced fonts for @acro in text (9pt). +\def\reducednominalsize{9pt} +\setfont\reducedrm\rmshape{9}{1000}{OT1} +\setfont\reducedtt\ttshape{9}{1000}{OT1TT} +\setfont\reducedbf\bfshape{10}{900}{OT1} +\setfont\reducedit\itshape{9}{1000}{OT1IT} +\setfont\reducedsl\slshape{9}{1000}{OT1} +\setfont\reducedsf\sfshape{9}{1000}{OT1} +\setfont\reducedsc\scshape{10}{900}{OT1} +\setfont\reducedttsl\ttslshape{10}{900}{OT1TT} +\font\reducedi=cmmi9 +\font\reducedsy=cmsy9 +\def\reducedecsize{0900} + +\divide\parskip by 2 % reduce space between paragraphs +\textleading = 12pt % line spacing for 10pt CM +\textfonts % reset the current fonts +\rm +} % end of 10pt text font size definitions + + +% We provide the user-level command +% @fonttextsize 10 +% (or 11) to redefine the text font size. pt is assumed. +% +\def\xiword{11} +\def\xword{10} +\def\xwordpt{10pt} +% +\parseargdef\fonttextsize{% + \def\textsizearg{#1}% + %\wlog{doing @fonttextsize \textsizearg}% + % + % Set \globaldefs so that documents can use this inside @tex, since + % makeinfo 4.8 does not support it, but we need it nonetheless. + % + \begingroup \globaldefs=1 + \ifx\textsizearg\xword \definetextfontsizex + \else \ifx\textsizearg\xiword \definetextfontsizexi + \else + \errhelp=\EMsimple + \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'} + \fi\fi + \endgroup +} + + +% In order for the font changes to affect most math symbols and letters, +% we have to define the \textfont of the standard families. Since +% texinfo doesn't allow for producing subscripts and superscripts except +% in the main text, we don't bother to reset \scriptfont and +% \scriptscriptfont (which would also require loading a lot more fonts). +% +\def\resetmathfonts{% + \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy + \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf + \textfont\ttfam=\tentt \textfont\sffam=\tensf +} + +% The font-changing commands redefine the meanings of \tenSTYLE, instead +% of just \STYLE. We do this because \STYLE needs to also set the +% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire +% \tenSTYLE to set the current font. +% +% Each font-changing command also sets the names \lsize (one size lower) +% and \lllsize (three sizes lower). These relative commands are used in +% the LaTeX logo and acronyms. +% +% This all needs generalizing, badly. +% +\def\textfonts{% + \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl + \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc + \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy + \let\tenttsl=\textttsl + \def\curfontsize{text}% + \def\lsize{reduced}\def\lllsize{smaller}% + \resetmathfonts \setleading{\textleading}} +\def\titlefonts{% + \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl + \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc + \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy + \let\tenttsl=\titlettsl + \def\curfontsize{title}% + \def\lsize{chap}\def\lllsize{subsec}% + \resetmathfonts \setleading{27pt}} +\def\titlefont#1{{\titlefonts\rmisbold #1}} +\def\chapfonts{% + \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl + \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc + \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy + \let\tenttsl=\chapttsl + \def\curfontsize{chap}% + \def\lsize{sec}\def\lllsize{text}% + \resetmathfonts \setleading{19pt}} +\def\secfonts{% + \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl + \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc + \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy + \let\tenttsl=\secttsl + \def\curfontsize{sec}% + \def\lsize{subsec}\def\lllsize{reduced}% + \resetmathfonts \setleading{16pt}} +\def\subsecfonts{% + \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl + \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc + \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy + \let\tenttsl=\ssecttsl + \def\curfontsize{ssec}% + \def\lsize{text}\def\lllsize{small}% + \resetmathfonts \setleading{15pt}} +\let\subsubsecfonts = \subsecfonts +\def\reducedfonts{% + \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl + \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc + \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy + \let\tenttsl=\reducedttsl + \def\curfontsize{reduced}% + \def\lsize{small}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallfonts{% + \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl + \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc + \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy + \let\tenttsl=\smallttsl + \def\curfontsize{small}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallerfonts{% + \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl + \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc + \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy + \let\tenttsl=\smallerttsl + \def\curfontsize{smaller}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{9.5pt}} + +% Fonts for short table of contents. +\setfont\shortcontrm\rmshape{12}{1000}{OT1} +\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 +\setfont\shortcontsl\slshape{12}{1000}{OT1} +\setfont\shortconttt\ttshape{12}{1000}{OT1TT} + +% Define these just so they can be easily changed for other fonts. +\def\angleleft{$\langle$} +\def\angleright{$\rangle$} + +% Set the fonts to use with the @small... environments. +\let\smallexamplefonts = \smallfonts + +% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample +% can fit this many characters: +% 8.5x11=86 smallbook=72 a4=90 a5=69 +% If we use \scriptfonts (8pt), then we can fit this many characters: +% 8.5x11=90+ smallbook=80 a4=90+ a5=77 +% For me, subjectively, the few extra characters that fit aren't worth +% the additional smallness of 8pt. So I'm making the default 9pt. +% +% By the way, for comparison, here's what fits with @example (10pt): +% 8.5x11=71 smallbook=60 a4=75 a5=58 +% --karl, 24jan03. + +% Set up the default fonts, so we can use them for creating boxes. +% +\definetextfontsizexi + + +\message{markup,} + +% Check if we are currently using a typewriter font. Since all the +% Computer Modern typewriter fonts have zero interword stretch (and +% shrink), and it is reasonable to expect all typewriter fonts to have +% this property, we can check that font parameter. +% +\def\ifmonospace{\ifdim\fontdimen3\font=0pt } + +% Markup style infrastructure. \defmarkupstylesetup\INITMACRO will +% define and register \INITMACRO to be called on markup style changes. +% \INITMACRO can check \currentmarkupstyle for the innermost +% style and the set of \ifmarkupSTYLE switches for all styles +% currently in effect. +\newif\ifmarkupvar +\newif\ifmarkupsamp +\newif\ifmarkupkey +%\newif\ifmarkupfile % @file == @samp. +%\newif\ifmarkupoption % @option == @samp. +\newif\ifmarkupcode +\newif\ifmarkupkbd +%\newif\ifmarkupenv % @env == @code. +%\newif\ifmarkupcommand % @command == @code. +\newif\ifmarkuptex % @tex (and part of @math, for now). +\newif\ifmarkupexample +\newif\ifmarkupverb +\newif\ifmarkupverbatim + +\let\currentmarkupstyle\empty + +\def\setupmarkupstyle#1{% + \csname markup#1true\endcsname + \def\currentmarkupstyle{#1}% + \markupstylesetup +} + +\let\markupstylesetup\empty + +\def\defmarkupstylesetup#1{% + \expandafter\def\expandafter\markupstylesetup + \expandafter{\markupstylesetup #1}% + \def#1% +} + +% Markup style setup for left and right quotes. +\defmarkupstylesetup\markupsetuplq{% + \expandafter\let\expandafter \temp + \csname markupsetuplq\currentmarkupstyle\endcsname + \ifx\temp\relax \markupsetuplqdefault \else \temp \fi +} + +\defmarkupstylesetup\markupsetuprq{% + \expandafter\let\expandafter \temp + \csname markupsetuprq\currentmarkupstyle\endcsname + \ifx\temp\relax \markupsetuprqdefault \else \temp \fi +} + +{ +\catcode`\'=\active +\catcode`\`=\active + +\gdef\markupsetuplqdefault{\let`\lq} +\gdef\markupsetuprqdefault{\let'\rq} + +\gdef\markupsetcodequoteleft{\let`\codequoteleft} +\gdef\markupsetcodequoteright{\let'\codequoteright} + +\gdef\markupsetnoligaturesquoteleft{\let`\noligaturesquoteleft} +} + +\let\markupsetuplqcode \markupsetcodequoteleft +\let\markupsetuprqcode \markupsetcodequoteright +% +\let\markupsetuplqexample \markupsetcodequoteleft +\let\markupsetuprqexample \markupsetcodequoteright +% +\let\markupsetuplqsamp \markupsetcodequoteleft +\let\markupsetuprqsamp \markupsetcodequoteright +% +\let\markupsetuplqverb \markupsetcodequoteleft +\let\markupsetuprqverb \markupsetcodequoteright +% +\let\markupsetuplqverbatim \markupsetcodequoteleft +\let\markupsetuprqverbatim \markupsetcodequoteright + +\let\markupsetuplqkbd \markupsetnoligaturesquoteleft + +% Allow an option to not use regular directed right quote/apostrophe +% (char 0x27), but instead the undirected quote from cmtt (char 0x0d). +% The undirected quote is ugly, so don't make it the default, but it +% works for pasting with more pdf viewers (at least evince), the +% lilypond developers report. xpdf does work with the regular 0x27. +% +\def\codequoteright{% + \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax + \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax + '% + \else \char'15 \fi + \else \char'15 \fi +} +% +% and a similar option for the left quote char vs. a grave accent. +% Modern fonts display ASCII 0x60 as a grave accent, so some people like +% the code environments to do likewise. +% +\def\codequoteleft{% + \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax + \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax + % [Knuth] pp. 380,381,391 + % \relax disables Spanish ligatures ?` and !` of \tt font. + \relax`% + \else \char'22 \fi + \else \char'22 \fi +} + +% Commands to set the quote options. +% +\parseargdef\codequoteundirected{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxicodequoteundirected\endcsname + = t% + \else\ifx\temp\offword + \expandafter\let\csname SETtxicodequoteundirected\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}% + \fi\fi +} +% +\parseargdef\codequotebacktick{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxicodequotebacktick\endcsname + = t% + \else\ifx\temp\offword + \expandafter\let\csname SETtxicodequotebacktick\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}% + \fi\fi +} + +% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font. +\def\noligaturesquoteleft{\relax\lq} + +% Count depth in font-changes, for error checks +\newcount\fontdepth \fontdepth=0 + +% Font commands. + +% #1 is the font command (\sl or \it), #2 is the text to slant. +% If we are in a monospaced environment, however, 1) always use \ttsl, +% and 2) do not add an italic correction. +\def\dosmartslant#1#2{% + \ifusingtt + {{\ttsl #2}\let\next=\relax}% + {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}% + \next +} +\def\smartslanted{\dosmartslant\sl} +\def\smartitalic{\dosmartslant\it} + +% Output an italic correction unless \next (presumed to be the following +% character) is such as not to need one. +\def\smartitaliccorrection{% + \ifx\next,% + \else\ifx\next-% + \else\ifx\next.% + \else\ptexslash + \fi\fi\fi} + +% like \smartslanted except unconditionally uses \ttsl, and no ic. +% @var is set to this for defun arguments. +\def\ttslanted#1{{\ttsl #1}} + +% @cite is like \smartslanted except unconditionally use \sl. We never want +% ttsl for book titles, do we? +\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection} + +\let\i=\smartitalic +\let\slanted=\smartslanted +\def\var#1{\smartslanted{#1}} +\let\dfn=\smartslanted +\let\emph=\smartitalic + +% Explicit font changes: @r, @sc, undocumented @ii. +\def\r#1{{\rm #1}} % roman font +\def\sc#1{{\smallcaps#1}} % smallcaps font +\def\ii#1{{\it #1}} % italic font + +% @b, explicit bold. Also @strong. +\def\b#1{{\bf #1}} +\let\strong=\b + +% @sansserif, explicit sans. +\def\sansserif#1{{\sf #1}} + +% We can't just use \exhyphenpenalty, because that only has effect at +% the end of a paragraph. Restore normal hyphenation at the end of the +% group within which \nohyphenation is presumably called. +% +\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} +\def\restorehyphenation{\hyphenchar\font = `- } + +% Set sfcode to normal for the chars that usually have another value. +% Can't use plain's \frenchspacing because it uses the `\x notation, and +% sometimes \x has an active definition that messes things up. +% +\catcode`@=11 + \def\plainfrenchspacing{% + \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m + \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m + \def\endofsentencespacefactor{1000}% for @. and friends + } + \def\plainnonfrenchspacing{% + \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 + \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 + \def\endofsentencespacefactor{3000}% for @. and friends + } +\catcode`@=\other +\def\endofsentencespacefactor{3000}% default + +% @t, explicit typewriter. +\def\t#1{% + {\tt \rawbackslash \plainfrenchspacing #1}% + \null +} + +% @samp. +\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}} + +% definition of @key that produces a lozenge. Doesn't adjust to text size. +%\setfont\keyrm\rmshape{8}{1000}{OT1} +%\font\keysy=cmsy9 +%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% +% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% +% \vbox{\hrule\kern-0.4pt +% \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% +% \kern-0.4pt\hrule}% +% \kern-.06em\raise0.4pt\hbox{\angleright}}}} + +% definition of @key with no lozenge. If the current font is already +% monospace, don't change it; that way, we respect @kbdinputstyle. But +% if it isn't monospace, then use \tt. +% +\def\key#1{{\setupmarkupstyle{key}% + \nohyphenation + \ifmonospace\else\tt\fi + #1}\null} + +% ctrl is no longer a Texinfo command. +\def\ctrl #1{{\tt \rawbackslash \hat}#1} + +% @file, @option are the same as @samp. +\let\file=\samp +\let\option=\samp + +% @code is a modification of @t, +% which makes spaces the same size as normal in the surrounding text. +\def\tclose#1{% + {% + % Change normal interword space to be same as for the current font. + \spaceskip = \fontdimen2\font + % + % Switch to typewriter. + \tt + % + % But `\ ' produces the large typewriter interword space. + \def\ {{\spaceskip = 0pt{} }}% + % + % Turn off hyphenation. + \nohyphenation + % + \rawbackslash + \plainfrenchspacing + #1% + }% + \null +} + +% We *must* turn on hyphenation at `-' and `_' in @code. +% Otherwise, it is too hard to avoid overfull hboxes +% in the Emacs manual, the Library manual, etc. + +% Unfortunately, TeX uses one parameter (\hyphenchar) to control +% both hyphenation at - and hyphenation within words. +% We must therefore turn them both off (\tclose does that) +% and arrange explicitly to hyphenate at a dash. +% -- rms. +{ + \catcode`\-=\active \catcode`\_=\active + \catcode`\'=\active \catcode`\`=\active + \global\let'=\rq \global\let`=\lq % default definitions + % + \global\def\code{\begingroup + \setupmarkupstyle{code}% + % The following should really be moved into \setupmarkupstyle handlers. + \catcode\dashChar=\active \catcode\underChar=\active + \ifallowcodebreaks + \let-\codedash + \let_\codeunder + \else + \let-\realdash + \let_\realunder + \fi + \codex + } +} + +\def\codex #1{\tclose{#1}\endgroup} + +\def\realdash{-} +\def\codedash{-\discretionary{}{}{}} +\def\codeunder{% + % this is all so @math{@code{var_name}+1} can work. In math mode, _ + % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) + % will therefore expand the active definition of _, which is us + % (inside @code that is), therefore an endless loop. + \ifusingtt{\ifmmode + \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. + \else\normalunderscore \fi + \discretionary{}{}{}}% + {\_}% +} + +% An additional complication: the above will allow breaks after, e.g., +% each of the four underscores in __typeof__. This is undesirable in +% some manuals, especially if they don't have long identifiers in +% general. @allowcodebreaks provides a way to control this. +% +\newif\ifallowcodebreaks \allowcodebreakstrue + +\def\keywordtrue{true} +\def\keywordfalse{false} + +\parseargdef\allowcodebreaks{% + \def\txiarg{#1}% + \ifx\txiarg\keywordtrue + \allowcodebreakstrue + \else\ifx\txiarg\keywordfalse + \allowcodebreaksfalse + \else + \errhelp = \EMsimple + \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}% + \fi\fi +} + +% @uref (abbreviation for `urlref') takes an optional (comma-separated) +% second argument specifying the text to display and an optional third +% arg as text to display instead of (rather than in addition to) the url +% itself. First (mandatory) arg is the url. +% (This \urefnobreak definition isn't used now, leaving it for a while +% for comparison.) +\def\urefnobreak#1{\dourefnobreak #1,,,\finish} +\def\dourefnobreak#1,#2,#3,#4\finish{\begingroup + \unsepspaces + \pdfurl{#1}% + \setbox0 = \hbox{\ignorespaces #3}% + \ifdim\wd0 > 0pt + \unhbox0 % third arg given, show only that + \else + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url + \fi + \else + \code{#1}% only url given, so show it + \fi + \fi + \endlink +\endgroup} + +% This \urefbreak definition is the active one. +\def\urefbreak{\begingroup \urefcatcodes \dourefbreak} +\let\uref=\urefbreak +\def\dourefbreak#1{\urefbreakfinish #1,,,\finish} +\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example + \unsepspaces + \pdfurl{#1}% + \setbox0 = \hbox{\ignorespaces #3}% + \ifdim\wd0 > 0pt + \unhbox0 % third arg given, show only that + \else + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url + \fi + \else + \urefcode{#1}% only url given, so show it + \fi + \fi + \endlink +\endgroup} + +% Allow line breaks around only a few characters (only). +\def\urefcatcodes{% + \catcode\ampChar=\active \catcode\dotChar=\active + \catcode\hashChar=\active \catcode\questChar=\active + \catcode\slashChar=\active +} +{ + \urefcatcodes + % + \global\def\urefcode{\begingroup + \setupmarkupstyle{code}% + \urefcatcodes + \let&\urefcodeamp + \let.\urefcodedot + \let#\urefcodehash + \let?\urefcodequest + \let/\urefcodeslash + \codex + } + % + % By default, they are just regular characters. + \global\def&{\normalamp} + \global\def.{\normaldot} + \global\def#{\normalhash} + \global\def?{\normalquest} + \global\def/{\normalslash} +} + +% we put a little stretch before and after the breakable chars, to help +% line breaking of long url's. The unequal skips make look better in +% cmtt at least, especially for dots. +\def\urefprestretch{\urefprebreak \hskip0pt plus.13em } +\def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em } +% +\def\urefcodeamp{\urefprestretch \&\urefpoststretch} +\def\urefcodedot{\urefprestretch .\urefpoststretch} +\def\urefcodehash{\urefprestretch \#\urefpoststretch} +\def\urefcodequest{\urefprestretch ?\urefpoststretch} +\def\urefcodeslash{\futurelet\next\urefcodeslashfinish} +{ + \catcode`\/=\active + \global\def\urefcodeslashfinish{% + \urefprestretch \slashChar + % Allow line break only after the final / in a sequence of + % slashes, to avoid line break between the slashes in http://. + \ifx\next/\else \urefpoststretch \fi + } +} + +% One more complication: by default we'll break after the special +% characters, but some people like to break before the special chars, so +% allow that. Also allow no breaking at all, for manual control. +% +\parseargdef\urefbreakstyle{% + \def\txiarg{#1}% + \ifx\txiarg\wordnone + \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak} + \else\ifx\txiarg\wordbefore + \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak} + \else\ifx\txiarg\wordafter + \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak} + \else + \errhelp = \EMsimple + \errmessage{Unknown @urefbreakstyle setting `\txiarg'}% + \fi\fi\fi +} +\def\wordafter{after} +\def\wordbefore{before} +\def\wordnone{none} + +\urefbreakstyle after + +% @url synonym for @uref, since that's how everyone uses it. +% +\let\url=\uref + +% rms does not like angle brackets --karl, 17may97. +% So now @email is just like @uref, unless we are pdf. +% +%\def\email#1{\angleleft{\tt #1}\angleright} +\ifpdf + \def\email#1{\doemail#1,,\finish} + \def\doemail#1,#2,#3\finish{\begingroup + \unsepspaces + \pdfurl{mailto:#1}% + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi + \endlink + \endgroup} +\else + \let\email=\uref +\fi + +% @kbd is like @code, except that if the argument is just one @key command, +% then @kbd has no effect. +\def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}} + +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), +% `example' (@kbd uses ttsl only inside of @example and friends), +% or `code' (@kbd uses normal tty font always). +\parseargdef\kbdinputstyle{% + \def\txiarg{#1}% + \ifx\txiarg\worddistinct + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% + \else\ifx\txiarg\wordexample + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% + \else\ifx\txiarg\wordcode + \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \else + \errhelp = \EMsimple + \errmessage{Unknown @kbdinputstyle setting `\txiarg'}% + \fi\fi\fi +} +\def\worddistinct{distinct} +\def\wordexample{example} +\def\wordcode{code} + +% Default is `distinct'. +\kbdinputstyle distinct + +\def\xkey{\key} +\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% +\ifx\one\xkey\ifx\threex\three \key{#2}% +\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi +\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi} + +% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. +\let\indicateurl=\code +\let\env=\code +\let\command=\code + +% @clicksequence{File @click{} Open ...} +\def\clicksequence#1{\begingroup #1\endgroup} + +% @clickstyle @arrow (by default) +\parseargdef\clickstyle{\def\click{#1}} +\def\click{\arrow} + +% Typeset a dimension, e.g., `in' or `pt'. The only reason for the +% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. +% +\def\dmn#1{\thinspace #1} + +% @l was never documented to mean ``switch to the Lisp font'', +% and it is not used as such in any manual I can find. We need it for +% Polish suppressed-l. --karl, 22sep96. +%\def\l#1{{\li #1}\null} + +% @acronym for "FBI", "NATO", and the like. +% We print this one point size smaller, since it's intended for +% all-uppercase. +% +\def\acronym#1{\doacronym #1,,\finish} +\def\doacronym#1,#2,#3\finish{% + {\selectfonts\lsize #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} + +% @abbr for "Comput. J." and the like. +% No font change, but don't do end-of-sentence spacing. +% +\def\abbr#1{\doabbr #1,,\finish} +\def\doabbr#1,#2,#3\finish{% + {\plainfrenchspacing #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} + +% @asis just yields its argument. Used with @table, for example. +% +\def\asis#1{#1} + +% @math outputs its argument in math mode. +% +% One complication: _ usually means subscripts, but it could also mean +% an actual _ character, as in @math{@var{some_variable} + 1}. So make +% _ active, and distinguish by seeing if the current family is \slfam, +% which is what @var uses. +{ + \catcode`\_ = \active + \gdef\mathunderscore{% + \catcode`\_=\active + \def_{\ifnum\fam=\slfam \_\else\sb\fi}% + } +} +% Another complication: we want \\ (and @\) to output a math (or tt) \. +% FYI, plain.tex uses \\ as a temporary control sequence (for no +% particular reason), but this is not advertised and we don't care. +% +% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. +\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} +% +\def\math{% + \tex + \mathunderscore + \let\\ = \mathbackslash + \mathactive + % make the texinfo accent commands work in math mode + \let\"=\ddot + \let\'=\acute + \let\==\bar + \let\^=\hat + \let\`=\grave + \let\u=\breve + \let\v=\check + \let\~=\tilde + \let\dotaccent=\dot + $\finishmath +} +\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. + +% Some active characters (such as <) are spaced differently in math. +% We have to reset their definitions in case the @math was an argument +% to a command which sets the catcodes (such as @item or @section). +% +{ + \catcode`^ = \active + \catcode`< = \active + \catcode`> = \active + \catcode`+ = \active + \catcode`' = \active + \gdef\mathactive{% + \let^ = \ptexhat + \let< = \ptexless + \let> = \ptexgtr + \let+ = \ptexplus + \let' = \ptexquoteright + } +} + + +\message{glyphs,} +% and logos. + +% @@ prints an @. +\def\@{\char64 } + +% Used to generate quoted braces. Unless we're in typewriter, use +% \ecfont because the CM text fonts do not have braces, and we don't +% want to switch into math. +\def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}} +\def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}} +\let\{=\mylbrace +\let\}=\myrbrace +\begingroup + % Definitions to produce \{ and \} commands for indices, + % and @{ and @} for the aux/toc files. + \catcode`\{ = \other \catcode`\} = \other + \catcode`\[ = 1 \catcode`\] = 2 + \catcode`\! = 0 \catcode`\\ = \other + !gdef!lbracecmd[\{]% + !gdef!rbracecmd[\}]% + !gdef!lbraceatcmd[@{]% + !gdef!rbraceatcmd[@}]% +!endgroup + +% @comma{} to avoid , parsing problems. +\let\comma = , + +% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. +\let\, = \ptexc +\let\dotaccent = \ptexdot +\def\ringaccent#1{{\accent23 #1}} +\let\tieaccent = \ptext +\let\ubaraccent = \ptexb +\let\udotaccent = \d + +% Other special characters: @questiondown @exclamdown @ordf @ordm +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. +\def\questiondown{?`} +\def\exclamdown{!`} +\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} +\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} + +% Dotless i and dotless j, used for accents. +\def\imacro{i} +\def\jmacro{j} +\def\dotless#1{% + \def\temp{#1}% + \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi + \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi + \else \errmessage{@dotless can be used only with i or j}% + \fi\fi +} + +% The \TeX{} logo, as in plain, but resetting the spacing so that a +% period following counts as ending a sentence. (Idea found in latex.) +% +\edef\TeX{\TeX \spacefactor=1000 } + +% @LaTeX{} logo. Not quite the same results as the definition in +% latex.ltx, since we use a different font for the raised A; it's most +% convenient for us to use an explicitly smaller font, rather than using +% the \scriptstyle font (since we don't reset \scriptstyle and +% \scriptscriptstyle). +% +\def\LaTeX{% + L\kern-.36em + {\setbox0=\hbox{T}% + \vbox to \ht0{\hbox{% + \ifx\textnominalsize\xwordpt + % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX. + % Revert to plain's \scriptsize, which is 7pt. + \count255=\the\fam $\fam\count255 \scriptstyle A$% + \else + % For 11pt, we can use our lllsize. + \selectfonts\lllsize A% + \fi + }% + \vss + }}% + \kern-.15em + \TeX +} + +% Some math mode symbols. +\def\bullet{$\ptexbullet$} +\def\geq{\ifmmode \ge\else $\ge$\fi} +\def\leq{\ifmmode \le\else $\le$\fi} +\def\minus{\ifmmode -\else $-$\fi} + +% @dots{} outputs an ellipsis using the current font. +% We do .5em per period so that it has the same spacing in the cm +% typewriter fonts as three actual period characters; on the other hand, +% in other typewriter fonts three periods are wider than 1.5em. So do +% whichever is larger. +% +\def\dots{% + \leavevmode + \setbox0=\hbox{...}% get width of three periods + \ifdim\wd0 > 1.5em + \dimen0 = \wd0 + \else + \dimen0 = 1.5em + \fi + \hbox to \dimen0{% + \hskip 0pt plus.25fil + .\hskip 0pt plus1fil + .\hskip 0pt plus1fil + .\hskip 0pt plus.5fil + }% +} + +% @enddots{} is an end-of-sentence ellipsis. +% +\def\enddots{% + \dots + \spacefactor=\endofsentencespacefactor +} + +% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. +% +% Since these characters are used in examples, they should be an even number of +% \tt widths. Each \tt character is 1en, so two makes it 1em. +% +\def\point{$\star$} +\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}} +\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} +\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}} +\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} +\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}} + +% The @error{} command. +% Adapted from the TeXbook's \boxit. +% +\newbox\errorbox +% +{\tentt \global\dimen0 = 3em}% Width of the box. +\dimen2 = .55pt % Thickness of rules +% The text. (`r' is open on the right, `e' somewhat less so on the left.) +\setbox0 = \hbox{\kern-.75pt \reducedsf error\kern-1.5pt} +% +\setbox\errorbox=\hbox to \dimen0{\hfil + \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. + \advance\hsize by -2\dimen2 % Rules. + \vbox{% + \hrule height\dimen2 + \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. + \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. + \kern3pt\vrule width\dimen2}% Space to right. + \hrule height\dimen2} + \hfil} +% +\def\error{\leavevmode\lower.7ex\copy\errorbox} + +% @pounds{} is a sterling sign, which Knuth put in the CM italic font. +% +\def\pounds{{\it\$}} + +% @euro{} comes from a separate font, depending on the current style. +% We use the free feym* fonts from the eurosym package by Henrik +% Theiling, which support regular, slanted, bold and bold slanted (and +% "outlined" (blackboard board, sort of) versions, which we don't need). +% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. +% +% Although only regular is the truly official Euro symbol, we ignore +% that. The Euro is designed to be slightly taller than the regular +% font height. +% +% feymr - regular +% feymo - slanted +% feybr - bold +% feybo - bold slanted +% +% There is no good (free) typewriter version, to my knowledge. +% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. +% Hmm. +% +% Also doesn't work in math. Do we need to do math with euro symbols? +% Hope not. +% +% +\def\euro{{\eurofont e}} +\def\eurofont{% + % We set the font at each command, rather than predefining it in + % \textfonts and the other font-switching commands, so that + % installations which never need the symbol don't have to have the + % font installed. + % + % There is only one designed size (nominal 10pt), so we always scale + % that to the current nominal size. + % + % By the way, simply using "at 1em" works for cmr10 and the like, but + % does not work for cmbx10 and other extended/shrunken fonts. + % + \def\eurosize{\csname\curfontsize nominalsize\endcsname}% + % + \ifx\curfontstyle\bfstylename + % bold: + \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize + \else + % regular: + \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize + \fi + \thiseurofont +} + +% Glyphs from the EC fonts. We don't use \let for the aliases, because +% sometimes we redefine the original macro, and the alias should reflect +% the redefinition. +% +% Use LaTeX names for the Icelandic letters. +\def\DH{{\ecfont \char"D0}} % Eth +\def\dh{{\ecfont \char"F0}} % eth +\def\TH{{\ecfont \char"DE}} % Thorn +\def\th{{\ecfont \char"FE}} % thorn +% +\def\guillemetleft{{\ecfont \char"13}} +\def\guillemotleft{\guillemetleft} +\def\guillemetright{{\ecfont \char"14}} +\def\guillemotright{\guillemetright} +\def\guilsinglleft{{\ecfont \char"0E}} +\def\guilsinglright{{\ecfont \char"0F}} +\def\quotedblbase{{\ecfont \char"12}} +\def\quotesinglbase{{\ecfont \char"0D}} +% +% This positioning is not perfect (see the ogonek LaTeX package), but +% we have the precomposed glyphs for the most common cases. We put the +% tests to use those glyphs in the single \ogonek macro so we have fewer +% dummy definitions to worry about for index entries, etc. +% +% ogonek is also used with other letters in Lithuanian (IOU), but using +% the precomposed glyphs for those is not so easy since they aren't in +% the same EC font. +\def\ogonek#1{{% + \def\temp{#1}% + \ifx\temp\macrocharA\Aogonek + \else\ifx\temp\macrochara\aogonek + \else\ifx\temp\macrocharE\Eogonek + \else\ifx\temp\macrochare\eogonek + \else + \ecfont \setbox0=\hbox{#1}% + \ifdim\ht0=1ex\accent"0C #1% + \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}% + \fi + \fi\fi\fi\fi + }% +} +\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A} +\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a} +\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E} +\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e} +% +% Use the ec* fonts (cm-super in outline format) for non-CM glyphs. +\def\ecfont{% + % We can't distinguish serif/sans and italic/slanted, but this + % is used for crude hacks anyway (like adding French and German + % quotes to documents typeset with CM, where we lose kerning), so + % hopefully nobody will notice/care. + \edef\ecsize{\csname\curfontsize ecsize\endcsname}% + \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% + \ifx\curfontstyle\bfstylename + % bold: + \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize + \else + % regular: + \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize + \fi + \thisecfont +} + +% @registeredsymbol - R in a circle. The font for the R should really +% be smaller yet, but lllsize is the best we can do for now. +% Adapted from the plain.tex definition of \copyright. +% +\def\registeredsymbol{% + $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% + \hfil\crcr\Orb}}% + }$% +} + +% @textdegree - the normal degrees sign. +% +\def\textdegree{$^\circ$} + +% Laurent Siebenmann reports \Orb undefined with: +% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 +% so we'll define it if necessary. +% +\ifx\Orb\thisisundefined +\def\Orb{\mathhexbox20D} +\fi + +% Quotes. +\chardef\quotedblleft="5C +\chardef\quotedblright=`\" +\chardef\quoteleft=`\` +\chardef\quoteright=`\' + + +\message{page headings,} + +\newskip\titlepagetopglue \titlepagetopglue = 1.5in +\newskip\titlepagebottomglue \titlepagebottomglue = 2pc + +% First the title page. Must do @settitle before @titlepage. +\newif\ifseenauthor +\newif\iffinishedtitlepage + +% Do an implicit @contents or @shortcontents after @end titlepage if the +% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. +% +\newif\ifsetcontentsaftertitlepage + \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue +\newif\ifsetshortcontentsaftertitlepage + \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue + +\parseargdef\shorttitlepage{% + \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}% + \endgroup\page\hbox{}\page} + +\envdef\titlepage{% + % Open one extra group, as we want to close it in the middle of \Etitlepage. + \begingroup + \parindent=0pt \textfonts + % Leave some space at the very top of the page. + \vglue\titlepagetopglue + % No rule at page bottom unless we print one at the top with @title. + \finishedtitlepagetrue + % + % Most title ``pages'' are actually two pages long, with space + % at the top of the second. We don't want the ragged left on the second. + \let\oldpage = \page + \def\page{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + \let\page = \oldpage + \page + \null + }% +} + +\def\Etitlepage{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + % It is important to do the page break before ending the group, + % because the headline and footline are only empty inside the group. + % If we use the new definition of \page, we always get a blank page + % after the title page, which we certainly don't want. + \oldpage + \endgroup + % + % Need this before the \...aftertitlepage checks so that if they are + % in effect the toc pages will come out with page numbers. + \HEADINGSon + % + % If they want short, they certainly want long too. + \ifsetshortcontentsaftertitlepage + \shortcontents + \contents + \global\let\shortcontents = \relax + \global\let\contents = \relax + \fi + % + \ifsetcontentsaftertitlepage + \contents + \global\let\contents = \relax + \global\let\shortcontents = \relax + \fi +} + +\def\finishtitlepage{% + \vskip4pt \hrule height 2pt width \hsize + \vskip\titlepagebottomglue + \finishedtitlepagetrue +} + +% Macros to be used within @titlepage: + +\let\subtitlerm=\tenrm +\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} + +\parseargdef\title{% + \checkenv\titlepage + \leftline{\titlefonts\rmisbold #1} + % print a rule at the page bottom also. + \finishedtitlepagefalse + \vskip4pt \hrule height 4pt width \hsize \vskip4pt +} + +\parseargdef\subtitle{% + \checkenv\titlepage + {\subtitlefont \rightline{#1}}% +} + +% @author should come last, but may come many times. +% It can also be used inside @quotation. +% +\parseargdef\author{% + \def\temp{\quotation}% + \ifx\thisenv\temp + \def\quotationauthor{#1}% printed in \Equotation. + \else + \checkenv\titlepage + \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi + {\secfonts\rmisbold \leftline{#1}}% + \fi +} + + +% Set up page headings and footings. + +\let\thispage=\folio + +\newtoks\evenheadline % headline on even pages +\newtoks\oddheadline % headline on odd pages +\newtoks\evenfootline % footline on even pages +\newtoks\oddfootline % footline on odd pages + +% Now make TeX use those variables +\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline + \else \the\evenheadline \fi}} +\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline + \else \the\evenfootline \fi}\HEADINGShook} +\let\HEADINGShook=\relax + +% Commands to set those variables. +% For example, this is what @headings on does +% @evenheading @thistitle|@thispage|@thischapter +% @oddheading @thischapter|@thispage|@thistitle +% @evenfooting @thisfile|| +% @oddfooting ||@thisfile + + +\def\evenheading{\parsearg\evenheadingxxx} +\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} +\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% +\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddheading{\parsearg\oddheadingxxx} +\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} +\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% +\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% + +\def\evenfooting{\parsearg\evenfootingxxx} +\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} +\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% +\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddfooting{\parsearg\oddfootingxxx} +\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} +\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% + \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% + % + % Leave some space for the footline. Hopefully ok to assume + % @evenfooting will not be used by itself. + \global\advance\pageheight by -12pt + \global\advance\vsize by -12pt +} + +\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} + +% @evenheadingmarks top \thischapter <- chapter at the top of a page +% @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page +% +% The same set of arguments for: +% +% @oddheadingmarks +% @evenfootingmarks +% @oddfootingmarks +% @everyheadingmarks +% @everyfootingmarks + +\def\evenheadingmarks{\headingmarks{even}{heading}} +\def\oddheadingmarks{\headingmarks{odd}{heading}} +\def\evenfootingmarks{\headingmarks{even}{footing}} +\def\oddfootingmarks{\headingmarks{odd}{footing}} +\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1} + \headingmarks{odd}{heading}{#1} } +\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1} + \headingmarks{odd}{footing}{#1} } +% #1 = even/odd, #2 = heading/footing, #3 = top/bottom. +\def\headingmarks#1#2#3 {% + \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname + \global\expandafter\let\csname get#1#2marks\endcsname \temp +} + +\everyheadingmarks bottom +\everyfootingmarks bottom + +% @headings double turns headings on for double-sided printing. +% @headings single turns headings on for single-sided printing. +% @headings off turns them off. +% @headings on same as @headings double, retained for compatibility. +% @headings after turns on double-sided headings after this page. +% @headings doubleafter turns on double-sided headings after this page. +% @headings singleafter turns on single-sided headings after this page. +% By default, they are off at the start of a document, +% and turned `on' after @end titlepage. + +\def\headings #1 {\csname HEADINGS#1\endcsname} + +\def\headingsoff{% non-global headings elimination + \evenheadline={\hfil}\evenfootline={\hfil}% + \oddheadline={\hfil}\oddfootline={\hfil}% +} + +\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting +\HEADINGSoff % it's the default + +% When we turn headings on, set the page number to 1. +% For double-sided printing, put current file name in lower left corner, +% chapter name on inside top of right hand pages, document +% title on inside top of left hand pages, and page numbers on outside top +% edge of all pages. +\def\HEADINGSdouble{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} +\let\contentsalignmacro = \chappager + +% For single-sided printing, chapter title goes across top left of page, +% page number on top right. +\def\HEADINGSsingle{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} +\def\HEADINGSon{\HEADINGSdouble} + +\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} +\let\HEADINGSdoubleafter=\HEADINGSafter +\def\HEADINGSdoublex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} + +\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} +\def\HEADINGSsinglex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} + +% Subroutines used in generating headings +% This produces Day Month Year style of output. +% Only define if not already defined, in case a txi-??.tex file has set +% up a different format (e.g., txi-cs.tex does this). +\ifx\today\thisisundefined +\def\today{% + \number\day\space + \ifcase\month + \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr + \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug + \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec + \fi + \space\number\year} +\fi + +% @settitle line... specifies the title of the document, for headings. +% It generates no output of its own. +\def\thistitle{\putwordNoTitle} +\def\settitle{\parsearg{\gdef\thistitle}} + + +\message{tables,} +% Tables -- @table, @ftable, @vtable, @item(x). + +% default indentation of table text +\newdimen\tableindent \tableindent=.8in +% default indentation of @itemize and @enumerate text +\newdimen\itemindent \itemindent=.3in +% margin between end of table item and start of table text. +\newdimen\itemmargin \itemmargin=.1in + +% used internally for \itemindent minus \itemmargin +\newdimen\itemmax + +% Note @table, @ftable, and @vtable define @item, @itemx, etc., with +% these defs. +% They also define \itemindex +% to index the item name in whatever manner is desired (perhaps none). + +\newif\ifitemxneedsnegativevskip + +\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} + +\def\internalBitem{\smallbreak \parsearg\itemzzz} +\def\internalBitemx{\itemxpar \parsearg\itemzzz} + +\def\itemzzz #1{\begingroup % + \advance\hsize by -\rightskip + \advance\hsize by -\tableindent + \setbox0=\hbox{\itemindicate{#1}}% + \itemindex{#1}% + \nobreak % This prevents a break before @itemx. + % + % If the item text does not fit in the space we have, put it on a line + % by itself, and do not allow a page break either before or after that + % line. We do not start a paragraph here because then if the next + % command is, e.g., @kindex, the whatsit would get put into the + % horizontal list on a line by itself, resulting in extra blank space. + \ifdim \wd0>\itemmax + % + % Make this a paragraph so we get the \parskip glue and wrapping, + % but leave it ragged-right. + \begingroup + \advance\leftskip by-\tableindent + \advance\hsize by\tableindent + \advance\rightskip by0pt plus1fil\relax + \leavevmode\unhbox0\par + \endgroup + % + % We're going to be starting a paragraph, but we don't want the + % \parskip glue -- logically it's part of the @item we just started. + \nobreak \vskip-\parskip + % + % Stop a page break at the \parskip glue coming up. However, if + % what follows is an environment such as @example, there will be no + % \parskip glue; then the negative vskip we just inserted would + % cause the example and the item to crash together. So we use this + % bizarre value of 10001 as a signal to \aboveenvbreak to insert + % \parskip glue after all. Section titles are handled this way also. + % + \penalty 10001 + \endgroup + \itemxneedsnegativevskipfalse + \else + % The item text fits into the space. Start a paragraph, so that the + % following text (if any) will end up on the same line. + \noindent + % Do this with kerns and \unhbox so that if there is a footnote in + % the item text, it can migrate to the main vertical list and + % eventually be printed. + \nobreak\kern-\tableindent + \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 + \unhbox0 + \nobreak\kern\dimen0 + \endgroup + \itemxneedsnegativevskiptrue + \fi +} + +\def\item{\errmessage{@item while not in a list environment}} +\def\itemx{\errmessage{@itemx while not in a list environment}} + +% @table, @ftable, @vtable. +\envdef\table{% + \let\itemindex\gobble + \tablecheck{table}% +} +\envdef\ftable{% + \def\itemindex ##1{\doind {fn}{\code{##1}}}% + \tablecheck{ftable}% +} +\envdef\vtable{% + \def\itemindex ##1{\doind {vr}{\code{##1}}}% + \tablecheck{vtable}% +} +\def\tablecheck#1{% + \ifnum \the\catcode`\^^M=\active + \endgroup + \errmessage{This command won't work in this context; perhaps the problem is + that we are \inenvironment\thisenv}% + \def\next{\doignore{#1}}% + \else + \let\next\tablex + \fi + \next +} +\def\tablex#1{% + \def\itemindicate{#1}% + \parsearg\tabley +} +\def\tabley#1{% + {% + \makevalueexpandable + \edef\temp{\noexpand\tablez #1\space\space\space}% + \expandafter + }\temp \endtablez +} +\def\tablez #1 #2 #3 #4\endtablez{% + \aboveenvbreak + \ifnum 0#1>0 \advance \leftskip by #1\mil \fi + \ifnum 0#2>0 \tableindent=#2\mil \fi + \ifnum 0#3>0 \advance \rightskip by #3\mil \fi + \itemmax=\tableindent + \advance \itemmax by -\itemmargin + \advance \leftskip by \tableindent + \exdentamount=\tableindent + \parindent = 0pt + \parskip = \smallskipamount + \ifdim \parskip=0pt \parskip=2pt \fi + \let\item = \internalBitem + \let\itemx = \internalBitemx +} +\def\Etable{\endgraf\afterenvbreak} +\let\Eftable\Etable +\let\Evtable\Etable +\let\Eitemize\Etable +\let\Eenumerate\Etable + +% This is the counter used by @enumerate, which is really @itemize + +\newcount \itemno + +\envdef\itemize{\parsearg\doitemize} + +\def\doitemize#1{% + \aboveenvbreak + \itemmax=\itemindent + \advance\itemmax by -\itemmargin + \advance\leftskip by \itemindent + \exdentamount=\itemindent + \parindent=0pt + \parskip=\smallskipamount + \ifdim\parskip=0pt \parskip=2pt \fi + % + % Try typesetting the item mark that if the document erroneously says + % something like @itemize @samp (intending @table), there's an error + % right away at the @itemize. It's not the best error message in the + % world, but it's better than leaving it to the @item. This means if + % the user wants an empty mark, they have to say @w{} not just @w. + \def\itemcontents{#1}% + \setbox0 = \hbox{\itemcontents}% + % + % @itemize with no arg is equivalent to @itemize @bullet. + \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi + % + \let\item=\itemizeitem +} + +% Definition of @item while inside @itemize and @enumerate. +% +\def\itemizeitem{% + \advance\itemno by 1 % for enumerations + {\let\par=\endgraf \smallbreak}% reasonable place to break + {% + % If the document has an @itemize directly after a section title, a + % \nobreak will be last on the list, and \sectionheading will have + % done a \vskip-\parskip. In that case, we don't want to zero + % parskip, or the item text will crash with the heading. On the + % other hand, when there is normal text preceding the item (as there + % usually is), we do want to zero parskip, or there would be too much + % space. In that case, we won't have a \nobreak before. At least + % that's the theory. + \ifnum\lastpenalty<10000 \parskip=0in \fi + \noindent + \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% + % + \vadjust{\penalty 1200}}% not good to break after first line of item. + \flushcr +} + +% \splitoff TOKENS\endmark defines \first to be the first token in +% TOKENS, and \rest to be the remainder. +% +\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% + +% Allow an optional argument of an uppercase letter, lowercase letter, +% or number, to specify the first label in the enumerated list. No +% argument is the same as `1'. +% +\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} +\def\enumeratey #1 #2\endenumeratey{% + % If we were given no argument, pretend we were given `1'. + \def\thearg{#1}% + \ifx\thearg\empty \def\thearg{1}\fi + % + % Detect if the argument is a single token. If so, it might be a + % letter. Otherwise, the only valid thing it can be is a number. + % (We will always have one token, because of the test we just made. + % This is a good thing, since \splitoff doesn't work given nothing at + % all -- the first parameter is undelimited.) + \expandafter\splitoff\thearg\endmark + \ifx\rest\empty + % Only one token in the argument. It could still be anything. + % A ``lowercase letter'' is one whose \lccode is nonzero. + % An ``uppercase letter'' is one whose \lccode is both nonzero, and + % not equal to itself. + % Otherwise, we assume it's a number. + % + % We need the \relax at the end of the \ifnum lines to stop TeX from + % continuing to look for a . + % + \ifnum\lccode\expandafter`\thearg=0\relax + \numericenumerate % a number (we hope) + \else + % It's a letter. + \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax + \lowercaseenumerate % lowercase letter + \else + \uppercaseenumerate % uppercase letter + \fi + \fi + \else + % Multiple tokens in the argument. We hope it's a number. + \numericenumerate + \fi +} + +% An @enumerate whose labels are integers. The starting integer is +% given in \thearg. +% +\def\numericenumerate{% + \itemno = \thearg + \startenumeration{\the\itemno}% +} + +% The starting (lowercase) letter is in \thearg. +\def\lowercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more lowercase letters in @enumerate; get a bigger + alphabet}% + \fi + \char\lccode\itemno + }% +} + +% The starting (uppercase) letter is in \thearg. +\def\uppercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more uppercase letters in @enumerate; get a bigger + alphabet} + \fi + \char\uccode\itemno + }% +} + +% Call \doitemize, adding a period to the first argument and supplying the +% common last two arguments. Also subtract one from the initial value in +% \itemno, since @item increments \itemno. +% +\def\startenumeration#1{% + \advance\itemno by -1 + \doitemize{#1.}\flushcr +} + +% @alphaenumerate and @capsenumerate are abbreviations for giving an arg +% to @enumerate. +% +\def\alphaenumerate{\enumerate{a}} +\def\capsenumerate{\enumerate{A}} +\def\Ealphaenumerate{\Eenumerate} +\def\Ecapsenumerate{\Eenumerate} + + +% @multitable macros +% Amy Hendrickson, 8/18/94, 3/6/96 +% +% @multitable ... @end multitable will make as many columns as desired. +% Contents of each column will wrap at width given in preamble. Width +% can be specified either with sample text given in a template line, +% or in percent of \hsize, the current width of text on page. + +% Table can continue over pages but will only break between lines. + +% To make preamble: +% +% Either define widths of columns in terms of percent of \hsize: +% @multitable @columnfractions .25 .3 .45 +% @item ... +% +% Numbers following @columnfractions are the percent of the total +% current hsize to be used for each column. You may use as many +% columns as desired. + + +% Or use a template: +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item ... +% using the widest term desired in each column. + +% Each new table line starts with @item, each subsequent new column +% starts with @tab. Empty columns may be produced by supplying @tab's +% with nothing between them for as many times as empty columns are needed, +% ie, @tab@tab@tab will produce two empty columns. + +% @item, @tab do not need to be on their own lines, but it will not hurt +% if they are. + +% Sample multitable: + +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item first col stuff @tab second col stuff @tab third col +% @item +% first col stuff +% @tab +% second col stuff +% @tab +% third col +% @item first col stuff @tab second col stuff +% @tab Many paragraphs of text may be used in any column. +% +% They will wrap at the width determined by the template. +% @item@tab@tab This will be in third column. +% @end multitable + +% Default dimensions may be reset by user. +% @multitableparskip is vertical space between paragraphs in table. +% @multitableparindent is paragraph indent in table. +% @multitablecolmargin is horizontal space to be left between columns. +% @multitablelinespace is space to leave between table items, baseline +% to baseline. +% 0pt means it depends on current normal line spacing. +% +\newskip\multitableparskip +\newskip\multitableparindent +\newdimen\multitablecolspace +\newskip\multitablelinespace +\multitableparskip=0pt +\multitableparindent=6pt +\multitablecolspace=12pt +\multitablelinespace=0pt + +% Macros used to set up halign preamble: +% +\let\endsetuptable\relax +\def\xendsetuptable{\endsetuptable} +\let\columnfractions\relax +\def\xcolumnfractions{\columnfractions} +\newif\ifsetpercent + +% #1 is the @columnfraction, usually a decimal number like .5, but might +% be just 1. We just use it, whatever it is. +% +\def\pickupwholefraction#1 {% + \global\advance\colcount by 1 + \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% + \setuptable +} + +\newcount\colcount +\def\setuptable#1{% + \def\firstarg{#1}% + \ifx\firstarg\xendsetuptable + \let\go = \relax + \else + \ifx\firstarg\xcolumnfractions + \global\setpercenttrue + \else + \ifsetpercent + \let\go\pickupwholefraction + \else + \global\advance\colcount by 1 + \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a + % separator; typically that is always in the input, anyway. + \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% + \fi + \fi + \ifx\go\pickupwholefraction + % Put the argument back for the \pickupwholefraction call, so + % we'll always have a period there to be parsed. + \def\go{\pickupwholefraction#1}% + \else + \let\go = \setuptable + \fi% + \fi + \go +} + +% multitable-only commands. +% +% @headitem starts a heading row, which we typeset in bold. +% Assignments have to be global since we are inside the implicit group +% of an alignment entry. \everycr resets \everytab so we don't have to +% undo it ourselves. +\def\headitemfont{\b}% for people to use in the template row; not changeable +\def\headitem{% + \checkenv\multitable + \crcr + \global\everytab={\bf}% can't use \headitemfont since the parsing differs + \the\everytab % for the first item +}% +% +% A \tab used to include \hskip1sp. But then the space in a template +% line is not enough. That is bad. So let's go back to just `&' until +% we again encounter the problem the 1sp was intended to solve. +% --karl, nathan@acm.org, 20apr99. +\def\tab{\checkenv\multitable &\the\everytab}% + +% @multitable ... @end multitable definitions: +% +\newtoks\everytab % insert after every tab. +% +\envdef\multitable{% + \vskip\parskip + \startsavinginserts + % + % @item within a multitable starts a normal row. + % We use \def instead of \let so that if one of the multitable entries + % contains an @itemize, we don't choke on the \item (seen as \crcr aka + % \endtemplate) expanding \doitemize. + \def\item{\crcr}% + % + \tolerance=9500 + \hbadness=9500 + \setmultitablespacing + \parskip=\multitableparskip + \parindent=\multitableparindent + \overfullrule=0pt + \global\colcount=0 + % + \everycr = {% + \noalign{% + \global\everytab={}% + \global\colcount=0 % Reset the column counter. + % Check for saved footnotes, etc. + \checkinserts + % Keeps underfull box messages off when table breaks over pages. + %\filbreak + % Maybe so, but it also creates really weird page breaks when the + % table breaks over pages. Wouldn't \vfil be better? Wait until the + % problem manifests itself, so it can be fixed for real --karl. + }% + }% + % + \parsearg\domultitable +} +\def\domultitable#1{% + % To parse everything between @multitable and @item: + \setuptable#1 \endsetuptable + % + % This preamble sets up a generic column definition, which will + % be used as many times as user calls for columns. + % \vtop will set a single line and will also let text wrap and + % continue for many paragraphs if desired. + \halign\bgroup &% + \global\advance\colcount by 1 + \multistrut + \vtop{% + % Use the current \colcount to find the correct column width: + \hsize=\expandafter\csname col\the\colcount\endcsname + % + % In order to keep entries from bumping into each other + % we will add a \leftskip of \multitablecolspace to all columns after + % the first one. + % + % If a template has been used, we will add \multitablecolspace + % to the width of each template entry. + % + % If the user has set preamble in terms of percent of \hsize we will + % use that dimension as the width of the column, and the \leftskip + % will keep entries from bumping into each other. Table will start at + % left margin and final column will justify at right margin. + % + % Make sure we don't inherit \rightskip from the outer environment. + \rightskip=0pt + \ifnum\colcount=1 + % The first column will be indented with the surrounding text. + \advance\hsize by\leftskip + \else + \ifsetpercent \else + % If user has not set preamble in terms of percent of \hsize + % we will advance \hsize by \multitablecolspace. + \advance\hsize by \multitablecolspace + \fi + % In either case we will make \leftskip=\multitablecolspace: + \leftskip=\multitablecolspace + \fi + % Ignoring space at the beginning and end avoids an occasional spurious + % blank line, when TeX decides to break the line at the space before the + % box from the multistrut, so the strut ends up on a line by itself. + % For example: + % @multitable @columnfractions .11 .89 + % @item @code{#} + % @tab Legal holiday which is valid in major parts of the whole country. + % Is automatically provided with highlighting sequences respectively + % marking characters. + \noindent\ignorespaces##\unskip\multistrut + }\cr +} +\def\Emultitable{% + \crcr + \egroup % end the \halign + \global\setpercentfalse +} + +\def\setmultitablespacing{% + \def\multistrut{\strut}% just use the standard line spacing + % + % Compute \multitablelinespace (if not defined by user) for use in + % \multitableparskip calculation. We used define \multistrut based on + % this, but (ironically) that caused the spacing to be off. + % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. +\ifdim\multitablelinespace=0pt +\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip +\global\advance\multitablelinespace by-\ht0 +\fi +% Test to see if parskip is larger than space between lines of +% table. If not, do nothing. +% If so, set to same dimension as multitablelinespace. +\ifdim\multitableparskip>\multitablelinespace +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi% +\ifdim\multitableparskip=0pt +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi} + + +\message{conditionals,} + +% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, +% @ifnotxml always succeed. They currently do nothing; we don't +% attempt to check whether the conditionals are properly nested. But we +% have to remember that they are conditionals, so that @end doesn't +% attempt to close an environment group. +% +\def\makecond#1{% + \expandafter\let\csname #1\endcsname = \relax + \expandafter\let\csname iscond.#1\endcsname = 1 +} +\makecond{iftex} +\makecond{ifnotdocbook} +\makecond{ifnothtml} +\makecond{ifnotinfo} +\makecond{ifnotplaintext} +\makecond{ifnotxml} + +% Ignore @ignore, @ifhtml, @ifinfo, and the like. +% +\def\direntry{\doignore{direntry}} +\def\documentdescription{\doignore{documentdescription}} +\def\docbook{\doignore{docbook}} +\def\html{\doignore{html}} +\def\ifdocbook{\doignore{ifdocbook}} +\def\ifhtml{\doignore{ifhtml}} +\def\ifinfo{\doignore{ifinfo}} +\def\ifnottex{\doignore{ifnottex}} +\def\ifplaintext{\doignore{ifplaintext}} +\def\ifxml{\doignore{ifxml}} +\def\ignore{\doignore{ignore}} +\def\menu{\doignore{menu}} +\def\xml{\doignore{xml}} + +% Ignore text until a line `@end #1', keeping track of nested conditionals. +% +% A count to remember the depth of nesting. +\newcount\doignorecount + +\def\doignore#1{\begingroup + % Scan in ``verbatim'' mode: + \obeylines + \catcode`\@ = \other + \catcode`\{ = \other + \catcode`\} = \other + % + % Make sure that spaces turn into tokens that match what \doignoretext wants. + \spaceisspace + % + % Count number of #1's that we've seen. + \doignorecount = 0 + % + % Swallow text until we reach the matching `@end #1'. + \dodoignore{#1}% +} + +{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. + \obeylines % + % + \gdef\dodoignore#1{% + % #1 contains the command name as a string, e.g., `ifinfo'. + % + % Define a command to find the next `@end #1'. + \long\def\doignoretext##1^^M@end #1{% + \doignoretextyyy##1^^M@#1\_STOP_}% + % + % And this command to find another #1 command, at the beginning of a + % line. (Otherwise, we would consider a line `@c @ifset', for + % example, to count as an @ifset for nesting.) + \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% + % + % And now expand that command. + \doignoretext ^^M% + }% +} + +\def\doignoreyyy#1{% + \def\temp{#1}% + \ifx\temp\empty % Nothing found. + \let\next\doignoretextzzz + \else % Found a nested condition, ... + \advance\doignorecount by 1 + \let\next\doignoretextyyy % ..., look for another. + % If we're here, #1 ends with ^^M\ifinfo (for example). + \fi + \next #1% the token \_STOP_ is present just after this macro. +} + +% We have to swallow the remaining "\_STOP_". +% +\def\doignoretextzzz#1{% + \ifnum\doignorecount = 0 % We have just found the outermost @end. + \let\next\enddoignore + \else % Still inside a nested condition. + \advance\doignorecount by -1 + \let\next\doignoretext % Look for the next @end. + \fi + \next +} + +% Finish off ignored text. +{ \obeylines% + % Ignore anything after the last `@end #1'; this matters in verbatim + % environments, where otherwise the newline after an ignored conditional + % would result in a blank line in the output. + \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% +} + + +% @set VAR sets the variable VAR to an empty value. +% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. +% +% Since we want to separate VAR from REST-OF-LINE (which might be +% empty), we can't just use \parsearg; we have to insert a space of our +% own to delimit the rest of the line, and then take it out again if we +% didn't need it. +% We rely on the fact that \parsearg sets \catcode`\ =10. +% +\parseargdef\set{\setyyy#1 \endsetyyy} +\def\setyyy#1 #2\endsetyyy{% + {% + \makevalueexpandable + \def\temp{#2}% + \edef\next{\gdef\makecsname{SET#1}}% + \ifx\temp\empty + \next{}% + \else + \setzzz#2\endsetzzz + \fi + }% +} +% Remove the trailing space \setxxx inserted. +\def\setzzz#1 \endsetzzz{\next{#1}} + +% @clear VAR clears (i.e., unsets) the variable VAR. +% +\parseargdef\clear{% + {% + \makevalueexpandable + \global\expandafter\let\csname SET#1\endcsname=\relax + }% +} + +% @value{foo} gets the text saved in variable foo. +\def\value{\begingroup\makevalueexpandable\valuexxx} +\def\valuexxx#1{\expandablevalue{#1}\endgroup} +{ + \catcode`\- = \active \catcode`\_ = \active + % + \gdef\makevalueexpandable{% + \let\value = \expandablevalue + % We don't want these characters active, ... + \catcode`\-=\other \catcode`\_=\other + % ..., but we might end up with active ones in the argument if + % we're called from @code, as @code{@value{foo-bar_}}, though. + % So \let them to their normal equivalents. + \let-\realdash \let_\normalunderscore + } +} + +% We have this subroutine so that we can handle at least some @value's +% properly in indexes (we call \makevalueexpandable in \indexdummies). +% The command has to be fully expandable (if the variable is set), since +% the result winds up in the index file. This means that if the +% variable's value contains other Texinfo commands, it's almost certain +% it will fail (although perhaps we could fix that with sufficient work +% to do a one-level expansion on the result, instead of complete). +% +\def\expandablevalue#1{% + \expandafter\ifx\csname SET#1\endcsname\relax + {[No value for ``#1'']}% + \message{Variable `#1', used in @value, is not set.}% + \else + \csname SET#1\endcsname + \fi +} + +% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined +% with @set. +% +% To get special treatment of `@end ifset,' call \makeond and the redefine. +% +\makecond{ifset} +\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} +\def\doifset#1#2{% + {% + \makevalueexpandable + \let\next=\empty + \expandafter\ifx\csname SET#2\endcsname\relax + #1% If not set, redefine \next. + \fi + \expandafter + }\next +} +\def\ifsetfail{\doignore{ifset}} + +% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been +% defined with @set, or has been undefined with @clear. +% +% The `\else' inside the `\doifset' parameter is a trick to reuse the +% above code: if the variable is not set, do nothing, if it is set, +% then redefine \next to \ifclearfail. +% +\makecond{ifclear} +\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} +\def\ifclearfail{\doignore{ifclear}} + +% @dircategory CATEGORY -- specify a category of the dir file +% which this file should belong to. Ignore this in TeX. +\let\dircategory=\comment + +% @defininfoenclose. +\let\definfoenclose=\comment + + +\message{indexing,} +% Index generation facilities + +% Define \newwrite to be identical to plain tex's \newwrite +% except not \outer, so it can be used within macros and \if's. +\edef\newwrite{\makecsname{ptexnewwrite}} + +% \newindex {foo} defines an index named foo. +% It automatically defines \fooindex such that +% \fooindex ...rest of line... puts an entry in the index foo. +% It also defines \fooindfile to be the number of the output channel for +% the file that accumulates this index. The file's extension is foo. +% The name of an index should be no more than 2 characters long +% for the sake of vms. +% +\def\newindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 % Open the file + \fi + \expandafter\xdef\csname#1index\endcsname{% % Define @#1index + \noexpand\doindex{#1}} +} + +% @defindex foo == \newindex{foo} +% +\def\defindex{\parsearg\newindex} + +% Define @defcodeindex, like @defindex except put all entries in @code. +% +\def\defcodeindex{\parsearg\newcodeindex} +% +\def\newcodeindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 + \fi + \expandafter\xdef\csname#1index\endcsname{% + \noexpand\docodeindex{#1}}% +} + + +% @synindex foo bar makes index foo feed into index bar. +% Do this instead of @defindex foo if you don't want it as a separate index. +% +% @syncodeindex foo bar similar, but put all entries made for index foo +% inside @code. +% +\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} +\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} + +% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), +% #3 the target index (bar). +\def\dosynindex#1#2#3{% + % Only do \closeout if we haven't already done it, else we'll end up + % closing the target index. + \expandafter \ifx\csname donesynindex#2\endcsname \relax + % The \closeout helps reduce unnecessary open files; the limit on the + % Acorn RISC OS is a mere 16 files. + \expandafter\closeout\csname#2indfile\endcsname + \expandafter\let\csname donesynindex#2\endcsname = 1 + \fi + % redefine \fooindfile: + \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname + \expandafter\let\csname#2indfile\endcsname=\temp + % redefine \fooindex: + \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% +} + +% Define \doindex, the driver for all \fooindex macros. +% Argument #1 is generated by the calling \fooindex macro, +% and it is "foo", the name of the index. + +% \doindex just uses \parsearg; it calls \doind for the actual work. +% This is because \doind is more useful to call from other macros. + +% There is also \dosubind {index}{topic}{subtopic} +% which makes an entry in a two-level index such as the operation index. + +\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} +\def\singleindexer #1{\doind{\indexname}{#1}} + +% like the previous two, but they put @code around the argument. +\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} +\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} + +% Take care of Texinfo commands that can appear in an index entry. +% Since there are some commands we want to expand, and others we don't, +% we have to laboriously prevent expansion for those that we don't. +% +\def\indexdummies{% + \escapechar = `\\ % use backslash in output files. + \def\@{@}% change to @@ when we switch to @ as escape char in index files. + \def\ {\realbackslash\space }% + % + % Need these unexpandable (because we define \tt as a dummy) + % definitions when @{ or @} appear in index entry text. Also, more + % complicated, when \tex is in effect and \{ is a \delimiter again. + % We can't use \lbracecmd and \rbracecmd because texindex assumes + % braces and backslashes are used only as delimiters. Perhaps we + % should define @lbrace and @rbrace commands a la @comma. + \def\{{{\tt\char123}}% + \def\}{{\tt\char125}}% + % + % I don't entirely understand this, but when an index entry is + % generated from a macro call, the \endinput which \scanmacro inserts + % causes processing to be prematurely terminated. This is, + % apparently, because \indexsorttmp is fully expanded, and \endinput + % is an expandable command. The redefinition below makes \endinput + % disappear altogether for that purpose -- although logging shows that + % processing continues to some further point. On the other hand, it + % seems \endinput does not hurt in the printed index arg, since that + % is still getting written without apparent harm. + % + % Sample source (mac-idx3.tex, reported by Graham Percival to + % help-texinfo, 22may06): + % @macro funindex {WORD} + % @findex xyz + % @end macro + % ... + % @funindex commtest + % + % The above is not enough to reproduce the bug, but it gives the flavor. + % + % Sample whatsit resulting: + % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}} + % + % So: + \let\endinput = \empty + % + % Do the redefinitions. + \commondummies +} + +% For the aux and toc files, @ is the escape character. So we want to +% redefine everything using @ as the escape character (instead of +% \realbackslash, still used for index files). When everything uses @, +% this will be simpler. +% +\def\atdummies{% + \def\@{@@}% + \def\ {@ }% + \let\{ = \lbraceatcmd + \let\} = \rbraceatcmd + % + % Do the redefinitions. + \commondummies + \otherbackslash +} + +% Called from \indexdummies and \atdummies. +% +\def\commondummies{% + % + % \definedummyword defines \#1 as \string\#1\space, thus effectively + % preventing its expansion. This is used only for control words, + % not control letters, because the \space would be incorrect for + % control characters, but is needed to separate the control word + % from whatever follows. + % + % For control letters, we have \definedummyletter, which omits the + % space. + % + % These can be used both for control words that take an argument and + % those that do not. If it is followed by {arg} in the input, then + % that will dutifully get written to the index (or wherever). + % + \def\definedummyword ##1{\def##1{\string##1\space}}% + \def\definedummyletter##1{\def##1{\string##1}}% + \let\definedummyaccent\definedummyletter + % + \commondummiesnofonts + % + \definedummyletter\_% + \definedummyletter\-% + % + % Non-English letters. + \definedummyword\AA + \definedummyword\AE + \definedummyword\DH + \definedummyword\L + \definedummyword\O + \definedummyword\OE + \definedummyword\TH + \definedummyword\aa + \definedummyword\ae + \definedummyword\dh + \definedummyword\exclamdown + \definedummyword\l + \definedummyword\o + \definedummyword\oe + \definedummyword\ordf + \definedummyword\ordm + \definedummyword\questiondown + \definedummyword\ss + \definedummyword\th + % + % Although these internal commands shouldn't show up, sometimes they do. + \definedummyword\bf + \definedummyword\gtr + \definedummyword\hat + \definedummyword\less + \definedummyword\sf + \definedummyword\sl + \definedummyword\tclose + \definedummyword\tt + % + \definedummyword\LaTeX + \definedummyword\TeX + % + % Assorted special characters. + \definedummyword\arrow + \definedummyword\bullet + \definedummyword\comma + \definedummyword\copyright + \definedummyword\registeredsymbol + \definedummyword\dots + \definedummyword\enddots + \definedummyword\entrybreak + \definedummyword\equiv + \definedummyword\error + \definedummyword\euro + \definedummyword\expansion + \definedummyword\geq + \definedummyword\guillemetleft + \definedummyword\guillemetright + \definedummyword\guilsinglleft + \definedummyword\guilsinglright + \definedummyword\leq + \definedummyword\minus + \definedummyword\ogonek + \definedummyword\pounds + \definedummyword\point + \definedummyword\print + \definedummyword\quotedblbase + \definedummyword\quotedblleft + \definedummyword\quotedblright + \definedummyword\quoteleft + \definedummyword\quoteright + \definedummyword\quotesinglbase + \definedummyword\result + \definedummyword\textdegree + % + % We want to disable all macros so that they are not expanded by \write. + \macrolist + % + \normalturnoffactive + % + % Handle some cases of @value -- where it does not contain any + % (non-fully-expandable) commands. + \makevalueexpandable +} + +% \commondummiesnofonts: common to \commondummies and \indexnofonts. +% +\def\commondummiesnofonts{% + % Control letters and accents. + \definedummyletter\!% + \definedummyaccent\"% + \definedummyaccent\'% + \definedummyletter\*% + \definedummyaccent\,% + \definedummyletter\.% + \definedummyletter\/% + \definedummyletter\:% + \definedummyaccent\=% + \definedummyletter\?% + \definedummyaccent\^% + \definedummyaccent\`% + \definedummyaccent\~% + \definedummyword\u + \definedummyword\v + \definedummyword\H + \definedummyword\dotaccent + \definedummyword\ogonek + \definedummyword\ringaccent + \definedummyword\tieaccent + \definedummyword\ubaraccent + \definedummyword\udotaccent + \definedummyword\dotless + % + % Texinfo font commands. + \definedummyword\b + \definedummyword\i + \definedummyword\r + \definedummyword\sansserif + \definedummyword\sc + \definedummyword\slanted + \definedummyword\t + % + % Commands that take arguments. + \definedummyword\acronym + \definedummyword\cite + \definedummyword\code + \definedummyword\command + \definedummyword\dfn + \definedummyword\dmn + \definedummyword\email + \definedummyword\emph + \definedummyword\env + \definedummyword\file + \definedummyword\indicateurl + \definedummyword\kbd + \definedummyword\key + \definedummyword\math + \definedummyword\option + \definedummyword\pxref + \definedummyword\ref + \definedummyword\samp + \definedummyword\strong + \definedummyword\tie + \definedummyword\uref + \definedummyword\url + \definedummyword\var + \definedummyword\verb + \definedummyword\w + \definedummyword\xref +} + +% \indexnofonts is used when outputting the strings to sort the index +% by, and when constructing control sequence names. It eliminates all +% control sequences and just writes whatever the best ASCII sort string +% would be for a given command (usually its argument). +% +\def\indexnofonts{% + % Accent commands should become @asis. + \def\definedummyaccent##1{\let##1\asis}% + % We can just ignore other control letters. + \def\definedummyletter##1{\let##1\empty}% + % All control words become @asis by default; overrides below. + \let\definedummyword\definedummyaccent + % + \commondummiesnofonts + % + % Don't no-op \tt, since it isn't a user-level command + % and is used in the definitions of the active chars like <, >, |, etc. + % Likewise with the other plain tex font commands. + %\let\tt=\asis + % + \def\ { }% + \def\@{@}% + \def\_{\normalunderscore}% + \def\-{}% @- shouldn't affect sorting + % + % Unfortunately, texindex is not prepared to handle braces in the + % content at all. So for index sorting, we map @{ and @} to strings + % starting with |, since that ASCII character is between ASCII { and }. + \def\{{|a}% + \def\}{|b}% + % + % Non-English letters. + \def\AA{AA}% + \def\AE{AE}% + \def\DH{DZZ}% + \def\L{L}% + \def\OE{OE}% + \def\O{O}% + \def\TH{ZZZ}% + \def\aa{aa}% + \def\ae{ae}% + \def\dh{dzz}% + \def\exclamdown{!}% + \def\l{l}% + \def\oe{oe}% + \def\ordf{a}% + \def\ordm{o}% + \def\o{o}% + \def\questiondown{?}% + \def\ss{ss}% + \def\th{zzz}% + % + \def\LaTeX{LaTeX}% + \def\TeX{TeX}% + % + % Assorted special characters. + % (The following {} will end up in the sort string, but that's ok.) + \def\arrow{->}% + \def\bullet{bullet}% + \def\comma{,}% + \def\copyright{copyright}% + \def\dots{...}% + \def\enddots{...}% + \def\equiv{==}% + \def\error{error}% + \def\euro{euro}% + \def\expansion{==>}% + \def\geq{>=}% + \def\guillemetleft{<<}% + \def\guillemetright{>>}% + \def\guilsinglleft{<}% + \def\guilsinglright{>}% + \def\leq{<=}% + \def\minus{-}% + \def\point{.}% + \def\pounds{pounds}% + \def\print{-|}% + \def\quotedblbase{"}% + \def\quotedblleft{"}% + \def\quotedblright{"}% + \def\quoteleft{`}% + \def\quoteright{'}% + \def\quotesinglbase{,}% + \def\registeredsymbol{R}% + \def\result{=>}% + \def\textdegree{o}% + % + \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax + \else \indexlquoteignore \fi + % + % We need to get rid of all macros, leaving only the arguments (if present). + % Of course this is not nearly correct, but it is the best we can do for now. + % makeinfo does not expand macros in the argument to @deffn, which ends up + % writing an index entry, and texindex isn't prepared for an index sort entry + % that starts with \. + % + % Since macro invocations are followed by braces, we can just redefine them + % to take a single TeX argument. The case of a macro invocation that + % goes to end-of-line is not handled. + % + \macrolist +} + +% Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us +% ignore left quotes in the sort term. +{\catcode`\`=\active + \gdef\indexlquoteignore{\let`=\empty}} + +\let\indexbackslash=0 %overridden during \printindex. +\let\SETmarginindex=\relax % put index entries in margin (undocumented)? + +% Most index entries go through here, but \dosubind is the general case. +% #1 is the index name, #2 is the entry text. +\def\doind#1#2{\dosubind{#1}{#2}{}} + +% Workhorse for all \fooindexes. +% #1 is name of index, #2 is stuff to put there, #3 is subentry -- +% empty if called from \doind, as we usually are (the main exception +% is with most defuns, which call us directly). +% +\def\dosubind#1#2#3{% + \iflinks + {% + % Store the main index entry text (including the third arg). + \toks0 = {#2}% + % If third arg is present, precede it with a space. + \def\thirdarg{#3}% + \ifx\thirdarg\empty \else + \toks0 = \expandafter{\the\toks0 \space #3}% + \fi + % + \edef\writeto{\csname#1indfile\endcsname}% + % + \safewhatsit\dosubindwrite + }% + \fi +} + +% Write the entry in \toks0 to the index file: +% +\def\dosubindwrite{% + % Put the index entry in the margin if desired. + \ifx\SETmarginindex\relax\else + \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% + \fi + % + % Remember, we are within a group. + \indexdummies % Must do this here, since \bf, etc expand at this stage + \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now + % so it will be output as is; and it will print as backslash. + % + % Process the index entry with all font commands turned off, to + % get the string to sort by. + {\indexnofonts + \edef\temp{\the\toks0}% need full expansion + \xdef\indexsorttmp{\temp}% + }% + % + % Set up the complete index entry, with both the sort key and + % the original text, including any font commands. We write + % three arguments to \entry to the .?? file (four in the + % subentry case), texindex reduces to two when writing the .??s + % sorted result. + \edef\temp{% + \write\writeto{% + \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% + }% + \temp +} + +% Take care of unwanted page breaks/skips around a whatsit: +% +% If a skip is the last thing on the list now, preserve it +% by backing up by \lastskip, doing the \write, then inserting +% the skip again. Otherwise, the whatsit generated by the +% \write or \pdfdest will make \lastskip zero. The result is that +% sequences like this: +% @end defun +% @tindex whatever +% @defun ... +% will have extra space inserted, because the \medbreak in the +% start of the @defun won't see the skip inserted by the @end of +% the previous defun. +% +% But don't do any of this if we're not in vertical mode. We +% don't want to do a \vskip and prematurely end a paragraph. +% +% Avoid page breaks due to these extra skips, too. +% +% But wait, there is a catch there: +% We'll have to check whether \lastskip is zero skip. \ifdim is not +% sufficient for this purpose, as it ignores stretch and shrink parts +% of the skip. The only way seems to be to check the textual +% representation of the skip. +% +% The following is almost like \def\zeroskipmacro{0.0pt} except that +% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). +% +\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} +% +\newskip\whatsitskip +\newcount\whatsitpenalty +% +% ..., ready, GO: +% +\def\safewhatsit#1{% +\ifhmode + #1% +\else + % \lastskip and \lastpenalty cannot both be nonzero simultaneously. + \whatsitskip = \lastskip + \edef\lastskipmacro{\the\lastskip}% + \whatsitpenalty = \lastpenalty + % + % If \lastskip is nonzero, that means the last item was a + % skip. And since a skip is discardable, that means this + % -\whatsitskip glue we're inserting is preceded by a + % non-discardable item, therefore it is not a potential + % breakpoint, therefore no \nobreak needed. + \ifx\lastskipmacro\zeroskipmacro + \else + \vskip-\whatsitskip + \fi + % + #1% + % + \ifx\lastskipmacro\zeroskipmacro + % If \lastskip was zero, perhaps the last item was a penalty, and + % perhaps it was >=10000, e.g., a \nobreak. In that case, we want + % to re-insert the same penalty (values >10000 are used for various + % signals); since we just inserted a non-discardable item, any + % following glue (such as a \parskip) would be a breakpoint. For example: + % + % @deffn deffn-whatever + % @vindex index-whatever + % Description. + % would allow a break between the index-whatever whatsit + % and the "Description." paragraph. + \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi + \else + % On the other hand, if we had a nonzero \lastskip, + % this make-up glue would be preceded by a non-discardable item + % (the whatsit from the \write), so we must insert a \nobreak. + \nobreak\vskip\whatsitskip + \fi +\fi +} + +% The index entry written in the file actually looks like +% \entry {sortstring}{page}{topic} +% or +% \entry {sortstring}{page}{topic}{subtopic} +% The texindex program reads in these files and writes files +% containing these kinds of lines: +% \initial {c} +% before the first topic whose initial is c +% \entry {topic}{pagelist} +% for a topic that is used without subtopics +% \primary {topic} +% for the beginning of a topic that is used with subtopics +% \secondary {subtopic}{pagelist} +% for each subtopic. + +% Define the user-accessible indexing commands +% @findex, @vindex, @kindex, @cindex. + +\def\findex {\fnindex} +\def\kindex {\kyindex} +\def\cindex {\cpindex} +\def\vindex {\vrindex} +\def\tindex {\tpindex} +\def\pindex {\pgindex} + +\def\cindexsub {\begingroup\obeylines\cindexsub} +{\obeylines % +\gdef\cindexsub "#1" #2^^M{\endgroup % +\dosubind{cp}{#2}{#1}}} + +% Define the macros used in formatting output of the sorted index material. + +% @printindex causes a particular index (the ??s file) to get printed. +% It does not print any chapter heading (usually an @unnumbered). +% +\parseargdef\printindex{\begingroup + \dobreak \chapheadingskip{10000}% + % + \smallfonts \rm + \tolerance = 9500 + \plainfrenchspacing + \everypar = {}% don't want the \kern\-parindent from indentation suppression. + % + % See if the index file exists and is nonempty. + % Change catcode of @ here so that if the index file contains + % \initial {@} + % as its first line, TeX doesn't complain about mismatched braces + % (because it thinks @} is a control sequence). + \catcode`\@ = 11 + \openin 1 \jobname.#1s + \ifeof 1 + % \enddoublecolumns gets confused if there is no text in the index, + % and it loses the chapter title and the aux file entries for the + % index. The easiest way to prevent this problem is to make sure + % there is some text. + \putwordIndexNonexistent + \else + % + % If the index file exists but is empty, then \openin leaves \ifeof + % false. We have to make TeX try to read something from the file, so + % it can discover if there is anything in it. + \read 1 to \temp + \ifeof 1 + \putwordIndexIsEmpty + \else + % Index files are almost Texinfo source, but we use \ as the escape + % character. It would be better to use @, but that's too big a change + % to make right now. + \def\indexbackslash{\backslashcurfont}% + \catcode`\\ = 0 + \escapechar = `\\ + \begindoublecolumns + \input \jobname.#1s + \enddoublecolumns + \fi + \fi + \closein 1 +\endgroup} + +% These macros are used by the sorted index file itself. +% Change them to control the appearance of the index. + +\def\initial#1{{% + % Some minor font changes for the special characters. + \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt + % + % Remove any glue we may have, we'll be inserting our own. + \removelastskip + % + % We like breaks before the index initials, so insert a bonus. + \nobreak + \vskip 0pt plus 3\baselineskip + \penalty 0 + \vskip 0pt plus -3\baselineskip + % + % Typeset the initial. Making this add up to a whole number of + % baselineskips increases the chance of the dots lining up from column + % to column. It still won't often be perfect, because of the stretch + % we need before each entry, but it's better. + % + % No shrink because it confuses \balancecolumns. + \vskip 1.67\baselineskip plus .5\baselineskip + \leftline{\secbf #1}% + % Do our best not to break after the initial. + \nobreak + \vskip .33\baselineskip plus .1\baselineskip +}} + +% \entry typesets a paragraph consisting of the text (#1), dot leaders, and +% then page number (#2) flushed to the right margin. It is used for index +% and table of contents entries. The paragraph is indented by \leftskip. +% +% A straightforward implementation would start like this: +% \def\entry#1#2{... +% But this freezes the catcodes in the argument, and can cause problems to +% @code, which sets - active. This problem was fixed by a kludge--- +% ``-'' was active throughout whole index, but this isn't really right. +% The right solution is to prevent \entry from swallowing the whole text. +% --kasal, 21nov03 +\def\entry{% + \begingroup + % + % Start a new paragraph if necessary, so our assignments below can't + % affect previous text. + \par + % + % Do not fill out the last line with white space. + \parfillskip = 0in + % + % No extra space above this paragraph. + \parskip = 0in + % + % Do not prefer a separate line ending with a hyphen to fewer lines. + \finalhyphendemerits = 0 + % + % \hangindent is only relevant when the entry text and page number + % don't both fit on one line. In that case, bob suggests starting the + % dots pretty far over on the line. Unfortunately, a large + % indentation looks wrong when the entry text itself is broken across + % lines. So we use a small indentation and put up with long leaders. + % + % \hangafter is reset to 1 (which is the value we want) at the start + % of each paragraph, so we need not do anything with that. + \hangindent = 2em + % + % When the entry text needs to be broken, just fill out the first line + % with blank space. + \rightskip = 0pt plus1fil + % + % A bit of stretch before each entry for the benefit of balancing + % columns. + \vskip 0pt plus1pt + % + % When reading the text of entry, convert explicit line breaks + % from @* into spaces. The user might give these in long section + % titles, for instance. + \def\*{\unskip\space\ignorespaces}% + \def\entrybreak{\hfil\break}% + % + % Swallow the left brace of the text (first parameter): + \afterassignment\doentry + \let\temp = +} +\def\entrybreak{\unskip\space\ignorespaces}% +\def\doentry{% + \bgroup % Instead of the swallowed brace. + \noindent + \aftergroup\finishentry + % And now comes the text of the entry. +} +\def\finishentry#1{% + % #1 is the page number. + % + % The following is kludged to not output a line of dots in the index if + % there are no page numbers. The next person who breaks this will be + % cursed by a Unix daemon. + \setbox\boxA = \hbox{#1}% + \ifdim\wd\boxA = 0pt + \ % + \else + % + % If we must, put the page number on a line of its own, and fill out + % this line with blank space. (The \hfil is overwhelmed with the + % fill leaders glue in \indexdotfill if the page number does fit.) + \hfil\penalty50 + \null\nobreak\indexdotfill % Have leaders before the page number. + % + % The `\ ' here is removed by the implicit \unskip that TeX does as + % part of (the primitive) \par. Without it, a spurious underfull + % \hbox ensues. + \ifpdf + \pdfgettoks#1.% + \ \the\toksA + \else + \ #1% + \fi + \fi + \par + \endgroup +} + +% Like plain.tex's \dotfill, except uses up at least 1 em. +\def\indexdotfill{\cleaders + \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill} + +\def\primary #1{\line{#1\hfil}} + +\newskip\secondaryindent \secondaryindent=0.5cm +\def\secondary#1#2{{% + \parfillskip=0in + \parskip=0in + \hangindent=1in + \hangafter=1 + \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill + \ifpdf + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. + \else + #2 + \fi + \par +}} + +% Define two-column mode, which we use to typeset indexes. +% Adapted from the TeXbook, page 416, which is to say, +% the manmac.tex format used to print the TeXbook itself. +\catcode`\@=11 + +\newbox\partialpage +\newdimen\doublecolumnhsize + +\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns + % Grab any single-column material above us. + \output = {% + % + % Here is a possibility not foreseen in manmac: if we accumulate a + % whole lot of material, we might end up calling this \output + % routine twice in a row (see the doublecol-lose test, which is + % essentially a couple of indexes with @setchapternewpage off). In + % that case we just ship out what is in \partialpage with the normal + % output routine. Generally, \partialpage will be empty when this + % runs and this will be a no-op. See the indexspread.tex test case. + \ifvoid\partialpage \else + \onepageout{\pagecontents\partialpage}% + \fi + % + \global\setbox\partialpage = \vbox{% + % Unvbox the main output page. + \unvbox\PAGE + \kern-\topskip \kern\baselineskip + }% + }% + \eject % run that output routine to set \partialpage + % + % Use the double-column output routine for subsequent pages. + \output = {\doublecolumnout}% + % + % Change the page size parameters. We could do this once outside this + % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 + % format, but then we repeat the same computation. Repeating a couple + % of assignments once per index is clearly meaningless for the + % execution time, so we may as well do it in one place. + % + % First we halve the line length, less a little for the gutter between + % the columns. We compute the gutter based on the line length, so it + % changes automatically with the paper format. The magic constant + % below is chosen so that the gutter has the same value (well, +-<1pt) + % as it did when we hard-coded it. + % + % We put the result in a separate register, \doublecolumhsize, so we + % can restore it in \pagesofar, after \hsize itself has (potentially) + % been clobbered. + % + \doublecolumnhsize = \hsize + \advance\doublecolumnhsize by -.04154\hsize + \divide\doublecolumnhsize by 2 + \hsize = \doublecolumnhsize + % + % Double the \vsize as well. (We don't need a separate register here, + % since nobody clobbers \vsize.) + \vsize = 2\vsize +} + +% The double-column output routine for all double-column pages except +% the last. +% +\def\doublecolumnout{% + \splittopskip=\topskip \splitmaxdepth=\maxdepth + % Get the available space for the double columns -- the normal + % (undoubled) page height minus any material left over from the + % previous page. + \dimen@ = \vsize + \divide\dimen@ by 2 + \advance\dimen@ by -\ht\partialpage + % + % box0 will be the left-hand column, box2 the right. + \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ + \onepageout\pagesofar + \unvbox255 + \penalty\outputpenalty +} +% +% Re-output the contents of the output page -- any previous material, +% followed by the two boxes we just split, in box0 and box2. +\def\pagesofar{% + \unvbox\partialpage + % + \hsize = \doublecolumnhsize + \wd0=\hsize \wd2=\hsize + \hbox to\pagewidth{\box0\hfil\box2}% +} +% +% All done with double columns. +\def\enddoublecolumns{% + % The following penalty ensures that the page builder is exercised + % _before_ we change the output routine. This is necessary in the + % following situation: + % + % The last section of the index consists only of a single entry. + % Before this section, \pagetotal is less than \pagegoal, so no + % break occurs before the last section starts. However, the last + % section, consisting of \initial and the single \entry, does not + % fit on the page and has to be broken off. Without the following + % penalty the page builder will not be exercised until \eject + % below, and by that time we'll already have changed the output + % routine to the \balancecolumns version, so the next-to-last + % double-column page will be processed with \balancecolumns, which + % is wrong: The two columns will go to the main vertical list, with + % the broken-off section in the recent contributions. As soon as + % the output routine finishes, TeX starts reconsidering the page + % break. The two columns and the broken-off section both fit on the + % page, because the two columns now take up only half of the page + % goal. When TeX sees \eject from below which follows the final + % section, it invokes the new output routine that we've set after + % \balancecolumns below; \onepageout will try to fit the two columns + % and the final section into the vbox of \pageheight (see + % \pagebody), causing an overfull box. + % + % Note that glue won't work here, because glue does not exercise the + % page builder, unlike penalties (see The TeXbook, pp. 280-281). + \penalty0 + % + \output = {% + % Split the last of the double-column material. Leave it on the + % current page, no automatic page break. + \balancecolumns + % + % If we end up splitting too much material for the current page, + % though, there will be another page break right after this \output + % invocation ends. Having called \balancecolumns once, we do not + % want to call it again. Therefore, reset \output to its normal + % definition right away. (We hope \balancecolumns will never be + % called on to balance too much material, but if it is, this makes + % the output somewhat more palatable.) + \global\output = {\onepageout{\pagecontents\PAGE}}% + }% + \eject + \endgroup % started in \begindoublecolumns + % + % \pagegoal was set to the doubled \vsize above, since we restarted + % the current page. We're now back to normal single-column + % typesetting, so reset \pagegoal to the normal \vsize (after the + % \endgroup where \vsize got restored). + \pagegoal = \vsize +} +% +% Called at the end of the double column material. +\def\balancecolumns{% + \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. + \dimen@ = \ht0 + \advance\dimen@ by \topskip + \advance\dimen@ by-\baselineskip + \divide\dimen@ by 2 % target to split to + %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% + \splittopskip = \topskip + % Loop until we get a decent breakpoint. + {% + \vbadness = 10000 + \loop + \global\setbox3 = \copy0 + \global\setbox1 = \vsplit3 to \dimen@ + \ifdim\ht3>\dimen@ + \global\advance\dimen@ by 1pt + \repeat + }% + %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% + \setbox0=\vbox to\dimen@{\unvbox1}% + \setbox2=\vbox to\dimen@{\unvbox3}% + % + \pagesofar +} +\catcode`\@ = \other + + +\message{sectioning,} +% Chapters, sections, etc. + +% Let's start with @part. +\outer\parseargdef\part{\partzzz{#1}} +\def\partzzz#1{% + \chapoddpage + \null + \vskip.3\vsize % move it down on the page a bit + \begingroup + \noindent \titlefonts\rmisbold #1\par % the text + \let\lastnode=\empty % no node to associate with + \writetocentry{part}{#1}{}% but put it in the toc + \headingsoff % no headline or footline on the part page + \chapoddpage + \endgroup +} + +% \unnumberedno is an oxymoron. But we count the unnumbered +% sections so that we can refer to them unambiguously in the pdf +% outlines by their "section number". We avoid collisions with chapter +% numbers by starting them at 10000. (If a document ever has 10000 +% chapters, we're in trouble anyway, I'm sure.) +\newcount\unnumberedno \unnumberedno = 10000 +\newcount\chapno +\newcount\secno \secno=0 +\newcount\subsecno \subsecno=0 +\newcount\subsubsecno \subsubsecno=0 + +% This counter is funny since it counts through charcodes of letters A, B, ... +\newcount\appendixno \appendixno = `\@ +% +% \def\appendixletter{\char\the\appendixno} +% We do the following ugly conditional instead of the above simple +% construct for the sake of pdftex, which needs the actual +% letter in the expansion, not just typeset. +% +\def\appendixletter{% + \ifnum\appendixno=`A A% + \else\ifnum\appendixno=`B B% + \else\ifnum\appendixno=`C C% + \else\ifnum\appendixno=`D D% + \else\ifnum\appendixno=`E E% + \else\ifnum\appendixno=`F F% + \else\ifnum\appendixno=`G G% + \else\ifnum\appendixno=`H H% + \else\ifnum\appendixno=`I I% + \else\ifnum\appendixno=`J J% + \else\ifnum\appendixno=`K K% + \else\ifnum\appendixno=`L L% + \else\ifnum\appendixno=`M M% + \else\ifnum\appendixno=`N N% + \else\ifnum\appendixno=`O O% + \else\ifnum\appendixno=`P P% + \else\ifnum\appendixno=`Q Q% + \else\ifnum\appendixno=`R R% + \else\ifnum\appendixno=`S S% + \else\ifnum\appendixno=`T T% + \else\ifnum\appendixno=`U U% + \else\ifnum\appendixno=`V V% + \else\ifnum\appendixno=`W W% + \else\ifnum\appendixno=`X X% + \else\ifnum\appendixno=`Y Y% + \else\ifnum\appendixno=`Z Z% + % The \the is necessary, despite appearances, because \appendixletter is + % expanded while writing the .toc file. \char\appendixno is not + % expandable, thus it is written literally, thus all appendixes come out + % with the same letter (or @) in the toc without it. + \else\char\the\appendixno + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} + +% Each @chapter defines these (using marks) as the number+name, number +% and name of the chapter. Page headings and footings can use +% these. @section does likewise. +\def\thischapter{} +\def\thischapternum{} +\def\thischaptername{} +\def\thissection{} +\def\thissectionnum{} +\def\thissectionname{} + +\newcount\absseclevel % used to calculate proper heading level +\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count + +% @raisesections: treat @section as chapter, @subsection as section, etc. +\def\raisesections{\global\advance\secbase by -1} +\let\up=\raisesections % original BFox name + +% @lowersections: treat @chapter as section, @section as subsection, etc. +\def\lowersections{\global\advance\secbase by 1} +\let\down=\lowersections % original BFox name + +% we only have subsub. +\chardef\maxseclevel = 3 +% +% A numbered section within an unnumbered changes to unnumbered too. +% To achieve this, remember the "biggest" unnum. sec. we are currently in: +\chardef\unnlevel = \maxseclevel +% +% Trace whether the current chapter is an appendix or not: +% \chapheadtype is "N" or "A", unnumbered chapters are ignored. +\def\chapheadtype{N} + +% Choose a heading macro +% #1 is heading type +% #2 is heading level +% #3 is text for heading +\def\genhead#1#2#3{% + % Compute the abs. sec. level: + \absseclevel=#2 + \advance\absseclevel by \secbase + % Make sure \absseclevel doesn't fall outside the range: + \ifnum \absseclevel < 0 + \absseclevel = 0 + \else + \ifnum \absseclevel > 3 + \absseclevel = 3 + \fi + \fi + % The heading type: + \def\headtype{#1}% + \if \headtype U% + \ifnum \absseclevel < \unnlevel + \chardef\unnlevel = \absseclevel + \fi + \else + % Check for appendix sections: + \ifnum \absseclevel = 0 + \edef\chapheadtype{\headtype}% + \else + \if \headtype A\if \chapheadtype N% + \errmessage{@appendix... within a non-appendix chapter}% + \fi\fi + \fi + % Check for numbered within unnumbered: + \ifnum \absseclevel > \unnlevel + \def\headtype{U}% + \else + \chardef\unnlevel = 3 + \fi + \fi + % Now print the heading: + \if \headtype U% + \ifcase\absseclevel + \unnumberedzzz{#3}% + \or \unnumberedseczzz{#3}% + \or \unnumberedsubseczzz{#3}% + \or \unnumberedsubsubseczzz{#3}% + \fi + \else + \if \headtype A% + \ifcase\absseclevel + \appendixzzz{#3}% + \or \appendixsectionzzz{#3}% + \or \appendixsubseczzz{#3}% + \or \appendixsubsubseczzz{#3}% + \fi + \else + \ifcase\absseclevel + \chapterzzz{#3}% + \or \seczzz{#3}% + \or \numberedsubseczzz{#3}% + \or \numberedsubsubseczzz{#3}% + \fi + \fi + \fi + \suppressfirstparagraphindent +} + +% an interface: +\def\numhead{\genhead N} +\def\apphead{\genhead A} +\def\unnmhead{\genhead U} + +% @chapter, @appendix, @unnumbered. Increment top-level counter, reset +% all lower-level sectioning counters to zero. +% +% Also set \chaplevelprefix, which we prepend to @float sequence numbers +% (e.g., figures), q.v. By default (before any chapter), that is empty. +\let\chaplevelprefix = \empty +% +\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz +\def\chapterzzz#1{% + % section resetting is \global in case the chapter is in a group, such + % as an @include file. + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\chapno by 1 + % + % Used for \float. + \gdef\chaplevelprefix{\the\chapno.}% + \resetallfloatnos + % + % \putwordChapter can contain complex things in translations. + \toks0=\expandafter{\putwordChapter}% + \message{\the\toks0 \space \the\chapno}% + % + % Write the actual heading. + \chapmacro{#1}{Ynumbered}{\the\chapno}% + % + % So @section and the like are numbered underneath this chapter. + \global\let\section = \numberedsec + \global\let\subsection = \numberedsubsec + \global\let\subsubsection = \numberedsubsubsec +} + +\outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz +% +\def\appendixzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\appendixno by 1 + \gdef\chaplevelprefix{\appendixletter.}% + \resetallfloatnos + % + % \putwordAppendix can contain complex things in translations. + \toks0=\expandafter{\putwordAppendix}% + \message{\the\toks0 \space \appendixletter}% + % + \chapmacro{#1}{Yappendix}{\appendixletter}% + % + \global\let\section = \appendixsec + \global\let\subsection = \appendixsubsec + \global\let\subsubsection = \appendixsubsubsec +} + +% normally unnmhead0 calls unnumberedzzz: +\outer\parseargdef\unnumbered{\unnmhead0{#1}} +\def\unnumberedzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\unnumberedno by 1 + % + % Since an unnumbered has no number, no prefix for figures. + \global\let\chaplevelprefix = \empty + \resetallfloatnos + % + % This used to be simply \message{#1}, but TeX fully expands the + % argument to \message. Therefore, if #1 contained @-commands, TeX + % expanded them. For example, in `@unnumbered The @cite{Book}', TeX + % expanded @cite (which turns out to cause errors because \cite is meant + % to be executed, not expanded). + % + % Anyway, we don't want the fully-expanded definition of @cite to appear + % as a result of the \message, we just want `@cite' itself. We use + % \the to achieve this: TeX expands \the only once, + % simply yielding the contents of . (We also do this for + % the toc entries.) + \toks0 = {#1}% + \message{(\the\toks0)}% + % + \chapmacro{#1}{Ynothing}{\the\unnumberedno}% + % + \global\let\section = \unnumberedsec + \global\let\subsection = \unnumberedsubsec + \global\let\subsubsection = \unnumberedsubsubsec +} + +% @centerchap is like @unnumbered, but the heading is centered. +\outer\parseargdef\centerchap{% + % Well, we could do the following in a group, but that would break + % an assumption that \chapmacro is called at the outermost level. + % Thus we are safer this way: --kasal, 24feb04 + \let\centerparametersmaybe = \centerparameters + \unnmhead0{#1}% + \let\centerparametersmaybe = \relax +} + +% @top is like @unnumbered. +\let\top\unnumbered + +% Sections. +% +\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz +\def\seczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% +} + +% normally calls appendixsectionzzz: +\outer\parseargdef\appendixsection{\apphead1{#1}} +\def\appendixsectionzzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% +} +\let\appendixsec\appendixsection + +% normally calls unnumberedseczzz: +\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} +\def\unnumberedseczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% +} + +% Subsections. +% +% normally calls numberedsubseczzz: +\outer\parseargdef\numberedsubsec{\numhead2{#1}} +\def\numberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% +} + +% normally calls appendixsubseczzz: +\outer\parseargdef\appendixsubsec{\apphead2{#1}} +\def\appendixsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno}% +} + +% normally calls unnumberedsubseczzz: +\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} +\def\unnumberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno}% +} + +% Subsubsections. +% +% normally numberedsubsubseczzz: +\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} +\def\numberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynumbered}% + {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +% normally appendixsubsubseczzz: +\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} +\def\appendixsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +% normally unnumberedsubsubseczzz: +\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} +\def\unnumberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +% These macros control what the section commands do, according +% to what kind of chapter we are in (ordinary, appendix, or unnumbered). +% Define them by default for a numbered chapter. +\let\section = \numberedsec +\let\subsection = \numberedsubsec +\let\subsubsection = \numberedsubsubsec + +% Define @majorheading, @heading and @subheading + +% NOTE on use of \vbox for chapter headings, section headings, and such: +% 1) We use \vbox rather than the earlier \line to permit +% overlong headings to fold. +% 2) \hyphenpenalty is set to 10000 because hyphenation in a +% heading is obnoxious; this forbids it. +% 3) Likewise, headings look best if no \parindent is used, and +% if justification is not attempted. Hence \raggedright. + +\def\majorheading{% + {\advance\chapheadingskip by 10pt \chapbreak }% + \parsearg\chapheadingzzz +} + +\def\chapheading{\chapbreak \parsearg\chapheadingzzz} +\def\chapheadingzzz#1{% + {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\ptexraggedright + \rmisbold #1\hfill}}% + \bigskip \par\penalty 200\relax + \suppressfirstparagraphindent +} + +% @heading, @subheading, @subsubheading. +\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} + +% These macros generate a chapter, section, etc. heading only +% (including whitespace, linebreaking, etc. around it), +% given all the information in convenient, parsed form. + +% Args are the skip and penalty (usually negative) +\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} + +% Parameter controlling skip before chapter headings (if needed) +\newskip\chapheadingskip + +% Define plain chapter starts, and page on/off switching for it. +\def\chapbreak{\dobreak \chapheadingskip {-4000}} +\def\chappager{\par\vfill\supereject} +% Because \domark is called before \chapoddpage, the filler page will +% get the headings for the next chapter, which is wrong. But we don't +% care -- we just disable all headings on the filler page. +\def\chapoddpage{% + \chappager + \ifodd\pageno \else + \begingroup + \headingsoff + \null + \chappager + \endgroup + \fi +} + +\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} + +\def\CHAPPAGoff{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chapbreak +\global\let\pagealignmacro=\chappager} + +\def\CHAPPAGon{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chappager +\global\let\pagealignmacro=\chappager +\global\def\HEADINGSon{\HEADINGSsingle}} + +\def\CHAPPAGodd{% +\global\let\contentsalignmacro = \chapoddpage +\global\let\pchapsepmacro=\chapoddpage +\global\let\pagealignmacro=\chapoddpage +\global\def\HEADINGSon{\HEADINGSdouble}} + +\CHAPPAGon + +% Chapter opening. +% +% #1 is the text, #2 is the section type (Ynumbered, Ynothing, +% Yappendix, Yomitfromtoc), #3 the chapter number. +% +% To test against our argument. +\def\Ynothingkeyword{Ynothing} +\def\Yomitfromtockeyword{Yomitfromtoc} +\def\Yappendixkeyword{Yappendix} +% +\def\chapmacro#1#2#3{% + % Insert the first mark before the heading break (see notes for \domark). + \let\prevchapterdefs=\lastchapterdefs + \let\prevsectiondefs=\lastsectiondefs + \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% + \gdef\thissection{}}% + % + \def\temptype{#2}% + \ifx\temptype\Ynothingkeyword + \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\thischapter{\thischaptername}}% + \else\ifx\temptype\Yomitfromtockeyword + \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\thischapter{}}% + \else\ifx\temptype\Yappendixkeyword + \toks0={#1}% + \xdef\lastchapterdefs{% + \gdef\noexpand\thischaptername{\the\toks0}% + \gdef\noexpand\thischapternum{\appendixletter}% + % \noexpand\putwordAppendix avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thischapter{\noexpand\putwordAppendix{} + \noexpand\thischapternum: + \noexpand\thischaptername}% + }% + \else + \toks0={#1}% + \xdef\lastchapterdefs{% + \gdef\noexpand\thischaptername{\the\toks0}% + \gdef\noexpand\thischapternum{\the\chapno}% + % \noexpand\putwordChapter avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thischapter{\noexpand\putwordChapter{} + \noexpand\thischapternum: + \noexpand\thischaptername}% + }% + \fi\fi\fi + % + % Output the mark. Pass it through \safewhatsit, to take care of + % the preceding space. + \safewhatsit\domark + % + % Insert the chapter heading break. + \pchapsepmacro + % + % Now the second mark, after the heading break. No break points + % between here and the heading. + \let\prevchapterdefs=\lastchapterdefs + \let\prevsectiondefs=\lastsectiondefs + \domark + % + {% + \chapfonts \rmisbold + % + % Have to define \lastsection before calling \donoderef, because the + % xref code eventually uses it. On the other hand, it has to be called + % after \pchapsepmacro, or the headline will change too soon. + \gdef\lastsection{#1}% + % + % Only insert the separating space if we have a chapter/appendix + % number, and don't print the unnumbered ``number''. + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unnchap}% + \else\ifx\temptype\Yomitfromtockeyword + \setbox0 = \hbox{}% contents like unnumbered, but no toc entry + \def\toctype{omit}% + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% + \def\toctype{app}% + \else + \setbox0 = \hbox{#3\enspace}% + \def\toctype{numchap}% + \fi\fi\fi + % + % Write the toc entry for this chapter. Must come before the + % \donoderef, because we include the current node name in the toc + % entry, and \donoderef resets it to empty. + \writetocentry{\toctype}{#1}{#3}% + % + % For pdftex, we have to write out the node definition (aka, make + % the pdfdest) after any page break, but before the actual text has + % been typeset. If the destination for the pdf outline is after the + % text, then jumping from the outline may wind up with the text not + % being visible, for instance under high magnification. + \donoderef{#2}% + % + % Typeset the actual heading. + \nobreak % Avoid page breaks at the interline glue. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright + \hangindent=\wd0 \centerparametersmaybe + \unhbox0 #1\par}% + }% + \nobreak\bigskip % no page break after a chapter title + \nobreak +} + +% @centerchap -- centered and unnumbered. +\let\centerparametersmaybe = \relax +\def\centerparameters{% + \advance\rightskip by 3\rightskip + \leftskip = \rightskip + \parfillskip = 0pt +} + + +% I don't think this chapter style is supported any more, so I'm not +% updating it with the new noderef stuff. We'll see. --karl, 11aug03. +% +\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} +% +\def\unnchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\ptexraggedright + \rmisbold #1\hfill}}\bigskip \par\nobreak +} +\def\chfopen #1#2{\chapoddpage {\chapfonts +\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% +\par\penalty 5000 % +} +\def\centerchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt + \hfill {\rmisbold #1}\hfill}}\bigskip \par\nobreak +} +\def\CHAPFopen{% + \global\let\chapmacro=\chfopen + \global\let\centerchapmacro=\centerchfopen} + + +% Section titles. These macros combine the section number parts and +% call the generic \sectionheading to do the printing. +% +\newskip\secheadingskip +\def\secheadingbreak{\dobreak \secheadingskip{-1000}} + +% Subsection titles. +\newskip\subsecheadingskip +\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} + +% Subsubsection titles. +\def\subsubsecheadingskip{\subsecheadingskip} +\def\subsubsecheadingbreak{\subsecheadingbreak} + + +% Print any size, any type, section title. +% +% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is +% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the +% section number. +% +\def\seckeyword{sec} +% +\def\sectionheading#1#2#3#4{% + {% + \checkenv{}% should not be in an environment. + % + % Switch to the right set of fonts. + \csname #2fonts\endcsname \rmisbold + % + \def\sectionlevel{#2}% + \def\temptype{#3}% + % + % Insert first mark before the heading break (see notes for \domark). + \let\prevsectiondefs=\lastsectiondefs + \ifx\temptype\Ynothingkeyword + \ifx\sectionlevel\seckeyword + \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% + \gdef\thissection{\thissectionname}}% + \fi + \else\ifx\temptype\Yomitfromtockeyword + % Don't redefine \thissection. + \else\ifx\temptype\Yappendixkeyword + \ifx\sectionlevel\seckeyword + \toks0={#1}% + \xdef\lastsectiondefs{% + \gdef\noexpand\thissectionname{\the\toks0}% + \gdef\noexpand\thissectionnum{#4}% + % \noexpand\putwordSection avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thissection{\noexpand\putwordSection{} + \noexpand\thissectionnum: + \noexpand\thissectionname}% + }% + \fi + \else + \ifx\sectionlevel\seckeyword + \toks0={#1}% + \xdef\lastsectiondefs{% + \gdef\noexpand\thissectionname{\the\toks0}% + \gdef\noexpand\thissectionnum{#4}% + % \noexpand\putwordSection avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thissection{\noexpand\putwordSection{} + \noexpand\thissectionnum: + \noexpand\thissectionname}% + }% + \fi + \fi\fi\fi + % + % Go into vertical mode. Usually we'll already be there, but we + % don't want the following whatsit to end up in a preceding paragraph + % if the document didn't happen to have a blank line. + \par + % + % Output the mark. Pass it through \safewhatsit, to take care of + % the preceding space. + \safewhatsit\domark + % + % Insert space above the heading. + \csname #2headingbreak\endcsname + % + % Now the second mark, after the heading break. No break points + % between here and the heading. + \let\prevsectiondefs=\lastsectiondefs + \domark + % + % Only insert the space after the number if we have a section number. + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unn}% + \gdef\lastsection{#1}% + \else\ifx\temptype\Yomitfromtockeyword + % for @headings -- no section number, don't include in toc, + % and don't redefine \lastsection. + \setbox0 = \hbox{}% + \def\toctype{omit}% + \let\sectionlevel=\empty + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{#4\enspace}% + \def\toctype{app}% + \gdef\lastsection{#1}% + \else + \setbox0 = \hbox{#4\enspace}% + \def\toctype{num}% + \gdef\lastsection{#1}% + \fi\fi\fi + % + % Write the toc entry (before \donoderef). See comments in \chapmacro. + \writetocentry{\toctype\sectionlevel}{#1}{#4}% + % + % Write the node reference (= pdf destination for pdftex). + % Again, see comments in \chapmacro. + \donoderef{#3}% + % + % Interline glue will be inserted when the vbox is completed. + % That glue will be a valid breakpoint for the page, since it'll be + % preceded by a whatsit (usually from the \donoderef, or from the + % \writetocentry if there was no node). We don't want to allow that + % break, since then the whatsits could end up on page n while the + % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. + \nobreak + % + % Output the actual section heading. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright + \hangindent=\wd0 % zero if no section number + \unhbox0 #1}% + }% + % Add extra space after the heading -- half of whatever came above it. + % Don't allow stretch, though. + \kern .5 \csname #2headingskip\endcsname + % + % Do not let the kern be a potential breakpoint, as it would be if it + % was followed by glue. + \nobreak + % + % We'll almost certainly start a paragraph next, so don't let that + % glue accumulate. (Not a breakpoint because it's preceded by a + % discardable item.) + \vskip-\parskip + % + % This is purely so the last item on the list is a known \penalty > + % 10000. This is so \startdefun can avoid allowing breakpoints after + % section headings. Otherwise, it would insert a valid breakpoint between: + % + % @section sec-whatever + % @deffn def-whatever + \penalty 10001 +} + + +\message{toc,} +% Table of contents. +\newwrite\tocfile + +% Write an entry to the toc file, opening it if necessary. +% Called from @chapter, etc. +% +% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} +% We append the current node name (if any) and page number as additional +% arguments for the \{chap,sec,...}entry macros which will eventually +% read this. The node name is used in the pdf outlines as the +% destination to jump to. +% +% We open the .toc file for writing here instead of at @setfilename (or +% any other fixed time) so that @contents can be anywhere in the document. +% But if #1 is `omit', then we don't do anything. This is used for the +% table of contents chapter openings themselves. +% +\newif\iftocfileopened +\def\omitkeyword{omit}% +% +\def\writetocentry#1#2#3{% + \edef\writetoctype{#1}% + \ifx\writetoctype\omitkeyword \else + \iftocfileopened\else + \immediate\openout\tocfile = \jobname.toc + \global\tocfileopenedtrue + \fi + % + \iflinks + {\atdummies + \edef\temp{% + \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% + \temp + }% + \fi + \fi + % + % Tell \shipout to create a pdf destination on each page, if we're + % writing pdf. These are used in the table of contents. We can't + % just write one on every page because the title pages are numbered + % 1 and 2 (the page numbers aren't printed), and so are the first + % two pages of the document. Thus, we'd have two destinations named + % `1', and two named `2'. + \ifpdf \global\pdfmakepagedesttrue \fi +} + + +% These characters do not print properly in the Computer Modern roman +% fonts, so we must take special care. This is more or less redundant +% with the Texinfo input format setup at the end of this file. +% +\def\activecatcodes{% + \catcode`\"=\active + \catcode`\$=\active + \catcode`\<=\active + \catcode`\>=\active + \catcode`\\=\active + \catcode`\^=\active + \catcode`\_=\active + \catcode`\|=\active + \catcode`\~=\active +} + + +% Read the toc file, which is essentially Texinfo input. +\def\readtocfile{% + \setupdatafile + \activecatcodes + \input \tocreadfilename +} + +\newskip\contentsrightmargin \contentsrightmargin=1in +\newcount\savepageno +\newcount\lastnegativepageno \lastnegativepageno = -1 + +% Prepare to read what we've written to \tocfile. +% +\def\startcontents#1{% + % If @setchapternewpage on, and @headings double, the contents should + % start on an odd page, unlike chapters. Thus, we maintain + % \contentsalignmacro in parallel with \pagealignmacro. + % From: Torbjorn Granlund + \contentsalignmacro + \immediate\closeout\tocfile + % + % Don't need to put `Contents' or `Short Contents' in the headline. + % It is abundantly clear what they are. + \chapmacro{#1}{Yomitfromtoc}{}% + % + \savepageno = \pageno + \begingroup % Set up to handle contents files properly. + \raggedbottom % Worry more about breakpoints than the bottom. + \advance\hsize by -\contentsrightmargin % Don't use the full line length. + % + % Roman numerals for page numbers. + \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi +} + +% redefined for the two-volume lispref. We always output on +% \jobname.toc even if this is redefined. +% +\def\tocreadfilename{\jobname.toc} + +% Normal (long) toc. +% +\def\contents{% + \startcontents{\putwordTOC}% + \openin 1 \tocreadfilename\space + \ifeof 1 \else + \readtocfile + \fi + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \ifeof 1 \else + \pdfmakeoutlines + \fi + \closein 1 + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} + +% And just the chapters. +\def\summarycontents{% + \startcontents{\putwordShortTOC}% + % + \let\partentry = \shortpartentry + \let\numchapentry = \shortchapentry + \let\appentry = \shortchapentry + \let\unnchapentry = \shortunnchapentry + % We want a true roman here for the page numbers. + \secfonts + \let\rm=\shortcontrm \let\bf=\shortcontbf + \let\sl=\shortcontsl \let\tt=\shortconttt + \rm + \hyphenpenalty = 10000 + \advance\baselineskip by 1pt % Open it up a little. + \def\numsecentry##1##2##3##4{} + \let\appsecentry = \numsecentry + \let\unnsecentry = \numsecentry + \let\numsubsecentry = \numsecentry + \let\appsubsecentry = \numsecentry + \let\unnsubsecentry = \numsecentry + \let\numsubsubsecentry = \numsecentry + \let\appsubsubsecentry = \numsecentry + \let\unnsubsubsecentry = \numsecentry + \openin 1 \tocreadfilename\space + \ifeof 1 \else + \readtocfile + \fi + \closein 1 + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} +\let\shortcontents = \summarycontents + +% Typeset the label for a chapter or appendix for the short contents. +% The arg is, e.g., `A' for an appendix, or `3' for a chapter. +% +\def\shortchaplabel#1{% + % This space should be enough, since a single number is .5em, and the + % widest letter (M) is 1em, at least in the Computer Modern fonts. + % But use \hss just in case. + % (This space doesn't include the extra space that gets added after + % the label; that gets put in by \shortchapentry above.) + % + % We'd like to right-justify chapter numbers, but that looks strange + % with appendix letters. And right-justifying numbers and + % left-justifying letters looks strange when there is less than 10 + % chapters. Have to read the whole toc once to know how many chapters + % there are before deciding ... + \hbox to 1em{#1\hss}% +} + +% These macros generate individual entries in the table of contents. +% The first argument is the chapter or section name. +% The last argument is the page number. +% The arguments in between are the chapter number, section number, ... + +% Parts, in the main contents. Replace the part number, which doesn't +% exist, with an empty box. Let's hope all the numbers have the same width. +% Also ignore the page number, which is conventionally not printed. +\def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}} +\def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}} +% +% Parts, in the short toc. +\def\shortpartentry#1#2#3#4{% + \penalty-300 + \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip + \shortchapentry{{\bf #1}}{\numeralbox}{}{}% +} + +% Chapters, in the main contents. +\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} +% +% Chapters, in the short toc. +% See comments in \dochapentry re vbox and related settings. +\def\shortchapentry#1#2#3#4{% + \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% +} + +% Appendices, in the main contents. +% Need the word Appendix, and a fixed-size box. +% +\def\appendixbox#1{% + % We use M since it's probably the widest letter. + \setbox0 = \hbox{\putwordAppendix{} M}% + \hbox to \wd0{\putwordAppendix{} #1\hss}} +% +\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} + +% Unnumbered chapters. +\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} +\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} + +% Sections. +\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} +\let\appsecentry=\numsecentry +\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} + +% Subsections. +\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} +\let\appsubsecentry=\numsubsecentry +\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} + +% And subsubsections. +\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} +\let\appsubsubsecentry=\numsubsubsecentry +\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} + +% This parameter controls the indentation of the various levels. +% Same as \defaultparindent. +\newdimen\tocindent \tocindent = 15pt + +% Now for the actual typesetting. In all these, #1 is the text and #2 is the +% page number. +% +% If the toc has to be broken over pages, we want it to be at chapters +% if at all possible; hence the \penalty. +\def\dochapentry#1#2{% + \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip + \begingroup + \chapentryfonts + \tocentry{#1}{\dopageno\bgroup#2\egroup}% + \endgroup + \nobreak\vskip .25\baselineskip plus.1\baselineskip +} + +\def\dosecentry#1#2{\begingroup + \secentryfonts \leftskip=\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsecentry#1#2{\begingroup + \subsecentryfonts \leftskip=2\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsubsecentry#1#2{\begingroup + \subsubsecentryfonts \leftskip=3\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +% We use the same \entry macro as for the index entries. +\let\tocentry = \entry + +% Space between chapter (or whatever) number and the title. +\def\labelspace{\hskip1em \relax} + +\def\dopageno#1{{\rm #1}} +\def\doshortpageno#1{{\rm #1}} + +\def\chapentryfonts{\secfonts \rm} +\def\secentryfonts{\textfonts} +\def\subsecentryfonts{\textfonts} +\def\subsubsecentryfonts{\textfonts} + + +\message{environments,} +% @foo ... @end foo. + +% @tex ... @end tex escapes into raw TeX temporarily. +% One exception: @ is still an escape character, so that @end tex works. +% But \@ or @@ will get a plain @ character. + +\envdef\tex{% + \setupmarkupstyle{tex}% + \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 + \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 + \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie + \catcode `\%=14 + \catcode `\+=\other + \catcode `\"=\other + \catcode `\|=\other + \catcode `\<=\other + \catcode `\>=\other + \catcode`\`=\other + \catcode`\'=\other + \escapechar=`\\ + % + % ' is active in math mode (mathcode"8000). So reset it, and all our + % other math active characters (just in case), to plain's definitions. + \mathactive + % + \let\b=\ptexb + \let\bullet=\ptexbullet + \let\c=\ptexc + \let\,=\ptexcomma + \let\.=\ptexdot + \let\dots=\ptexdots + \let\equiv=\ptexequiv + \let\!=\ptexexclam + \let\i=\ptexi + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \let\{=\ptexlbrace + \let\+=\tabalign + \let\}=\ptexrbrace + \let\/=\ptexslash + \let\*=\ptexstar + \let\t=\ptext + \expandafter \let\csname top\endcsname=\ptextop % outer + \let\frenchspacing=\plainfrenchspacing + % + \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% + \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% + \def\@{@}% +} +% There is no need to define \Etex. + +% Define @lisp ... @end lisp. +% @lisp environment forms a group so it can rebind things, +% including the definition of @end lisp (which normally is erroneous). + +% Amount to narrow the margins by for @lisp. +\newskip\lispnarrowing \lispnarrowing=0.4in + +% This is the definition that ^^M gets inside @lisp, @example, and other +% such environments. \null is better than a space, since it doesn't +% have any width. +\def\lisppar{\null\endgraf} + +% This space is always present above and below environments. +\newskip\envskipamount \envskipamount = 0pt + +% Make spacing and below environment symmetrical. We use \parskip here +% to help in doing that, since in @example-like environments \parskip +% is reset to zero; thus the \afterenvbreak inserts no space -- but the +% start of the next paragraph will insert \parskip. +% +\def\aboveenvbreak{{% + % =10000 instead of <10000 because of a special case in \itemzzz and + % \sectionheading, q.v. + \ifnum \lastpenalty=10000 \else + \advance\envskipamount by \parskip + \endgraf + \ifdim\lastskip<\envskipamount + \removelastskip + % it's not a good place to break if the last penalty was \nobreak + % or better ... + \ifnum\lastpenalty<10000 \penalty-50 \fi + \vskip\envskipamount + \fi + \fi +}} + +\let\afterenvbreak = \aboveenvbreak + +% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will +% also clear it, so that its embedded environments do the narrowing again. +\let\nonarrowing=\relax + +% @cartouche ... @end cartouche: draw rectangle w/rounded corners around +% environment contents. +\font\circle=lcircle10 +\newdimen\circthick +\newdimen\cartouter\newdimen\cartinner +\newskip\normbskip\newskip\normpskip\newskip\normlskip +\circthick=\fontdimen8\circle +% +\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth +\def\ctr{{\hskip 6pt\circle\char'010}} +\def\cbl{{\circle\char'012\hskip -6pt}} +\def\cbr{{\hskip 6pt\circle\char'011}} +\def\carttop{\hbox to \cartouter{\hskip\lskip + \ctl\leaders\hrule height\circthick\hfil\ctr + \hskip\rskip}} +\def\cartbot{\hbox to \cartouter{\hskip\lskip + \cbl\leaders\hrule height\circthick\hfil\cbr + \hskip\rskip}} +% +\newskip\lskip\newskip\rskip + +\envdef\cartouche{% + \ifhmode\par\fi % can't be in the midst of a paragraph. + \startsavinginserts + \lskip=\leftskip \rskip=\rightskip + \leftskip=0pt\rightskip=0pt % we want these *outside*. + \cartinner=\hsize \advance\cartinner by-\lskip + \advance\cartinner by-\rskip + \cartouter=\hsize + \advance\cartouter by 18.4pt % allow for 3pt kerns on either + % side, and for 6pt waste from + % each corner char, and rule thickness + \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip + % Flag to tell @lisp, etc., not to narrow margin. + \let\nonarrowing = t% + \vbox\bgroup + \baselineskip=0pt\parskip=0pt\lineskip=0pt + \carttop + \hbox\bgroup + \hskip\lskip + \vrule\kern3pt + \vbox\bgroup + \kern3pt + \hsize=\cartinner + \baselineskip=\normbskip + \lineskip=\normlskip + \parskip=\normpskip + \vskip -\parskip + \comment % For explanation, see the end of \def\group. +} +\def\Ecartouche{% + \ifhmode\par\fi + \kern3pt + \egroup + \kern3pt\vrule + \hskip\rskip + \egroup + \cartbot + \egroup + \checkinserts +} + + +% This macro is called at the beginning of all the @example variants, +% inside a group. +\newdimen\nonfillparindent +\def\nonfillstart{% + \aboveenvbreak + \hfuzz = 12pt % Don't be fussy + \sepspaces % Make spaces be word-separators rather than space tokens. + \let\par = \lisppar % don't ignore blank lines + \obeylines % each line of input is a line of output + \parskip = 0pt + % Turn off paragraph indentation but redefine \indent to emulate + % the normal \indent. + \nonfillparindent=\parindent + \parindent = 0pt + \let\indent\nonfillindent + % + \emergencystretch = 0pt % don't try to avoid overfull boxes + \ifx\nonarrowing\relax + \advance \leftskip by \lispnarrowing + \exdentamount=\lispnarrowing + \else + \let\nonarrowing = \relax + \fi + \let\exdent=\nofillexdent +} + +\begingroup +\obeyspaces +% We want to swallow spaces (but not other tokens) after the fake +% @indent in our nonfill-environments, where spaces are normally +% active and set to @tie, resulting in them not being ignored after +% @indent. +\gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}% +\gdef\nonfillindentcheck{% +\ifx\temp % +\expandafter\nonfillindentgobble% +\else% +\leavevmode\nonfillindentbox% +\fi% +}% +\endgroup +\def\nonfillindentgobble#1{\nonfillindent} +\def\nonfillindentbox{\hbox to \nonfillparindent{\hss}} + +% If you want all examples etc. small: @set dispenvsize small. +% If you want even small examples the full size: @set dispenvsize nosmall. +% This affects the following displayed environments: +% @example, @display, @format, @lisp +% +\def\smallword{small} +\def\nosmallword{nosmall} +\let\SETdispenvsize\relax +\def\setnormaldispenv{% + \ifx\SETdispenvsize\smallword + % end paragraph for sake of leading, in case document has no blank + % line. This is redundant with what happens in \aboveenvbreak, but + % we need to do it before changing the fonts, and it's inconvenient + % to change the fonts afterward. + \ifnum \lastpenalty=10000 \else \endgraf \fi + \smallexamplefonts \rm + \fi +} +\def\setsmalldispenv{% + \ifx\SETdispenvsize\nosmallword + \else + \ifnum \lastpenalty=10000 \else \endgraf \fi + \smallexamplefonts \rm + \fi +} + +% We often define two environments, @foo and @smallfoo. +% Let's do it in one command. #1 is the env name, #2 the definition. +\def\makedispenvdef#1#2{% + \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}% + \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}% + \expandafter\let\csname E#1\endcsname \afterenvbreak + \expandafter\let\csname Esmall#1\endcsname \afterenvbreak +} + +% Define two environment synonyms (#1 and #2) for an environment. +\def\maketwodispenvdef#1#2#3{% + \makedispenvdef{#1}{#3}% + \makedispenvdef{#2}{#3}% +} +% +% @lisp: indented, narrowed, typewriter font; +% @example: same as @lisp. +% +% @smallexample and @smalllisp: use smaller fonts. +% Originally contributed by Pavel@xerox. +% +\maketwodispenvdef{lisp}{example}{% + \nonfillstart + \tt\setupmarkupstyle{example}% + \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. + \gobble % eat return +} +% @display/@smalldisplay: same as @lisp except keep current font. +% +\makedispenvdef{display}{% + \nonfillstart + \gobble +} + +% @format/@smallformat: same as @display except don't narrow margins. +% +\makedispenvdef{format}{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} + +% @flushleft: same as @format, but doesn't obey \SETdispenvsize. +\envdef\flushleft{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} +\let\Eflushleft = \afterenvbreak + +% @flushright. +% +\envdef\flushright{% + \let\nonarrowing = t% + \nonfillstart + \advance\leftskip by 0pt plus 1fill\relax + \gobble +} +\let\Eflushright = \afterenvbreak + + +% @raggedright does more-or-less normal line breaking but no right +% justification. From plain.tex. +\envdef\raggedright{% + \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax +} +\let\Eraggedright\par + +\envdef\raggedleft{% + \parindent=0pt \leftskip0pt plus2em + \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt + \hbadness=10000 % Last line will usually be underfull, so turn off + % badness reporting. +} +\let\Eraggedleft\par + +\envdef\raggedcenter{% + \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em + \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt + \hbadness=10000 % Last line will usually be underfull, so turn off + % badness reporting. +} +\let\Eraggedcenter\par + + +% @quotation does normal linebreaking (hence we can't use \nonfillstart) +% and narrows the margins. We keep \parskip nonzero in general, since +% we're doing normal filling. So, when using \aboveenvbreak and +% \afterenvbreak, temporarily make \parskip 0. +% +\makedispenvdef{quotation}{\quotationstart} +% +\def\quotationstart{% + {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip + \parindent=0pt + % + % @cartouche defines \nonarrowing to inhibit narrowing at next level down. + \ifx\nonarrowing\relax + \advance\leftskip by \lispnarrowing + \advance\rightskip by \lispnarrowing + \exdentamount = \lispnarrowing + \else + \let\nonarrowing = \relax + \fi + \parsearg\quotationlabel +} + +% We have retained a nonzero parskip for the environment, since we're +% doing normal filling. +% +\def\Equotation{% + \par + \ifx\quotationauthor\thisisundefined\else + % indent a bit. + \leftline{\kern 2\leftskip \sl ---\quotationauthor}% + \fi + {\parskip=0pt \afterenvbreak}% +} +\def\Esmallquotation{\Equotation} + +% If we're given an argument, typeset it in bold with a colon after. +\def\quotationlabel#1{% + \def\temp{#1}% + \ifx\temp\empty \else + {\bf #1: }% + \fi +} + + +% LaTeX-like @verbatim...@end verbatim and @verb{...} +% If we want to allow any as delimiter, +% we need the curly braces so that makeinfo sees the @verb command, eg: +% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org +% +% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. +% +% [Knuth] p.344; only we need to do the other characters Texinfo sets +% active too. Otherwise, they get lost as the first character on a +% verbatim line. +\def\dospecials{% + \do\ \do\\\do\{\do\}\do\$\do\&% + \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% + \do\<\do\>\do\|\do\@\do+\do\"% + % Don't do the quotes -- if we do, @set txicodequoteundirected and + % @set txicodequotebacktick will not have effect on @verb and + % @verbatim, and ?` and !` ligatures won't get disabled. + %\do\`\do\'% +} +% +% [Knuth] p. 380 +\def\uncatcodespecials{% + \def\do##1{\catcode`##1=\other}\dospecials} +% +% Setup for the @verb command. +% +% Eight spaces for a tab +\begingroup + \catcode`\^^I=\active + \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} +\endgroup +% +\def\setupverb{% + \tt % easiest (and conventionally used) font for verbatim + \def\par{\leavevmode\endgraf}% + \setupmarkupstyle{verb}% + \tabeightspaces + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces +} + +% Setup for the @verbatim environment +% +% Real tab expansion. +\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount +% +% We typeset each line of the verbatim in an \hbox, so we can handle +% tabs. The \global is in case the verbatim line starts with an accent, +% or some other command that starts with a begin-group. Otherwise, the +% entire \verbbox would disappear at the corresponding end-group, before +% it is typeset. Meanwhile, we can't have nested verbatim commands +% (can we?), so the \global won't be overwriting itself. +\newbox\verbbox +\def\starttabbox{\global\setbox\verbbox=\hbox\bgroup} +% +\begingroup + \catcode`\^^I=\active + \gdef\tabexpand{% + \catcode`\^^I=\active + \def^^I{\leavevmode\egroup + \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab + \divide\dimen\verbbox by\tabw + \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw + \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw + \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox + }% + } +\endgroup + +% start the verbatim environment. +\def\setupverbatim{% + \let\nonarrowing = t% + \nonfillstart + \tt % easiest (and conventionally used) font for verbatim + % The \leavevmode here is for blank lines. Otherwise, we would + % never \starttabox and the \egroup would end verbatim mode. + \def\par{\leavevmode\egroup\box\verbbox\endgraf}% + \tabexpand + \setupmarkupstyle{verbatim}% + % Respect line breaks, + % print special symbols as themselves, and + % make each space count. + % Must do in this order: + \obeylines \uncatcodespecials \sepspaces + \everypar{\starttabbox}% +} + +% Do the @verb magic: verbatim text is quoted by unique +% delimiter characters. Before first delimiter expect a +% right brace, after last delimiter expect closing brace: +% +% \def\doverb'{'#1'}'{#1} +% +% [Knuth] p. 382; only eat outer {} +\begingroup + \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other + \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] +\endgroup +% +\def\verb{\begingroup\setupverb\doverb} +% +% +% Do the @verbatim magic: define the macro \doverbatim so that +% the (first) argument ends when '@end verbatim' is reached, ie: +% +% \def\doverbatim#1@end verbatim{#1} +% +% For Texinfo it's a lot easier than for LaTeX, +% because texinfo's \verbatim doesn't stop at '\end{verbatim}': +% we need not redefine '\', '{' and '}'. +% +% Inspired by LaTeX's verbatim command set [latex.ltx] +% +\begingroup + \catcode`\ =\active + \obeylines % + % ignore everything up to the first ^^M, that's the newline at the end + % of the @verbatim input line itself. Otherwise we get an extra blank + % line in the output. + \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% + % We really want {...\end verbatim} in the body of the macro, but + % without the active space; thus we have to use \xdef and \gobble. +\endgroup +% +\envdef\verbatim{% + \setupverbatim\doverbatim +} +\let\Everbatim = \afterenvbreak + + +% @verbatiminclude FILE - insert text of file in verbatim environment. +% +\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} +% +\def\doverbatiminclude#1{% + {% + \makevalueexpandable + \setupverbatim + \indexnofonts % Allow `@@' and other weird things in file names. + \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}% + \input #1 + \afterenvbreak + }% +} + +% @copying ... @end copying. +% Save the text away for @insertcopying later. +% +% We save the uninterpreted tokens, rather than creating a box. +% Saving the text in a box would be much easier, but then all the +% typesetting commands (@smallbook, font changes, etc.) have to be done +% beforehand -- and a) we want @copying to be done first in the source +% file; b) letting users define the frontmatter in as flexible order as +% possible is very desirable. +% +\def\copying{\checkenv{}\begingroup\scanargctxt\docopying} +\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} +% +\def\insertcopying{% + \begingroup + \parindent = 0pt % paragraph indentation looks wrong on title page + \scanexp\copyingtext + \endgroup +} + + +\message{defuns,} +% @defun etc. + +\newskip\defbodyindent \defbodyindent=.4in +\newskip\defargsindent \defargsindent=50pt +\newskip\deflastargmargin \deflastargmargin=18pt +\newcount\defunpenalty + +% Start the processing of @deffn: +\def\startdefun{% + \ifnum\lastpenalty<10000 + \medbreak + \defunpenalty=10003 % Will keep this @deffn together with the + % following @def command, see below. + \else + % If there are two @def commands in a row, we'll have a \nobreak, + % which is there to keep the function description together with its + % header. But if there's nothing but headers, we need to allow a + % break somewhere. Check specifically for penalty 10002, inserted + % by \printdefunline, instead of 10000, since the sectioning + % commands also insert a nobreak penalty, and we don't want to allow + % a break between a section heading and a defun. + % + % As a further refinement, we avoid "club" headers by signalling + % with penalty of 10003 after the very first @deffn in the + % sequence (see above), and penalty of 10002 after any following + % @def command. + \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi + % + % Similarly, after a section heading, do not allow a break. + % But do insert the glue. + \medskip % preceded by discardable penalty, so not a breakpoint + \fi + % + \parindent=0in + \advance\leftskip by \defbodyindent + \exdentamount=\defbodyindent +} + +\def\dodefunx#1{% + % First, check whether we are in the right environment: + \checkenv#1% + % + % As above, allow line break if we have multiple x headers in a row. + % It's not a great place, though. + \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi + % + % And now, it's time to reuse the body of the original defun: + \expandafter\gobbledefun#1% +} +\def\gobbledefun#1\startdefun{} + +% \printdefunline \deffnheader{text} +% +\def\printdefunline#1#2{% + \begingroup + % call \deffnheader: + #1#2 \endheader + % common ending: + \interlinepenalty = 10000 + \advance\rightskip by 0pt plus 1fil\relax + \endgraf + \nobreak\vskip -\parskip + \penalty\defunpenalty % signal to \startdefun and \dodefunx + % Some of the @defun-type tags do not enable magic parentheses, + % rendering the following check redundant. But we don't optimize. + \checkparencounts + \endgroup +} + +\def\Edefun{\endgraf\medbreak} + +% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; +% the only thing remaining is to define \deffnheader. +% +\def\makedefun#1{% + \expandafter\let\csname E#1\endcsname = \Edefun + \edef\temp{\noexpand\domakedefun + \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% + \temp +} + +% \domakedefun \deffn \deffnx \deffnheader +% +% Define \deffn and \deffnx, without parameters. +% \deffnheader has to be defined explicitly. +% +\def\domakedefun#1#2#3{% + \envdef#1{% + \startdefun + \doingtypefnfalse % distinguish typed functions from all else + \parseargusing\activeparens{\printdefunline#3}% + }% + \def#2{\dodefunx#1}% + \def#3% +} + +\newif\ifdoingtypefn % doing typed function? +\newif\ifrettypeownline % typeset return type on its own line? + +% @deftypefnnewline on|off says whether the return type of typed functions +% are printed on their own line. This affects @deftypefn, @deftypefun, +% @deftypeop, and @deftypemethod. +% +\parseargdef\deftypefnnewline{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxideftypefnnl\endcsname + = \empty + \else\ifx\temp\offword + \expandafter\let\csname SETtxideftypefnnl\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @txideftypefnnl value `\temp', + must be on|off}% + \fi\fi +} + +% Untyped functions: + +% @deffn category name args +\makedefun{deffn}{\deffngeneral{}} + +% @deffn category class name args +\makedefun{defop}#1 {\defopon{#1\ \putwordon}} + +% \defopon {category on}class name args +\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deffngeneral {subind}category name args +% +\def\deffngeneral#1#2 #3 #4\endheader{% + % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. + \dosubind{fn}{\code{#3}}{#1}% + \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% +} + +% Typed functions: + +% @deftypefn category type name args +\makedefun{deftypefn}{\deftypefngeneral{}} + +% @deftypeop category class type name args +\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} + +% \deftypeopon {category on}class type name args +\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deftypefngeneral {subind}category type name args +% +\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% + \dosubind{fn}{\code{#4}}{#1}% + \doingtypefntrue + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +% Typed variables: + +% @deftypevr category type var args +\makedefun{deftypevr}{\deftypecvgeneral{}} + +% @deftypecv category class type var args +\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} + +% \deftypecvof {category of}class type var args +\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } + +% \deftypecvgeneral {subind}category type var args +% +\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% + \dosubind{vr}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +% Untyped variables: + +% @defvr category var args +\makedefun{defvr}#1 {\deftypevrheader{#1} {} } + +% @defcv category class var args +\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} + +% \defcvof {category of}class var args +\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } + +% Types: + +% @deftp category name args +\makedefun{deftp}#1 #2 #3\endheader{% + \doind{tp}{\code{#2}}% + \defname{#1}{}{#2}\defunargs{#3\unskip}% +} + +% Remaining @defun-like shortcuts: +\makedefun{defun}{\deffnheader{\putwordDeffunc} } +\makedefun{defmac}{\deffnheader{\putwordDefmac} } +\makedefun{defspec}{\deffnheader{\putwordDefspec} } +\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } +\makedefun{defvar}{\defvrheader{\putwordDefvar} } +\makedefun{defopt}{\defvrheader{\putwordDefopt} } +\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } +\makedefun{defmethod}{\defopon\putwordMethodon} +\makedefun{deftypemethod}{\deftypeopon\putwordMethodon} +\makedefun{defivar}{\defcvof\putwordInstanceVariableof} +\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} + +% \defname, which formats the name of the @def (not the args). +% #1 is the category, such as "Function". +% #2 is the return type, if any. +% #3 is the function name. +% +% We are followed by (but not passed) the arguments, if any. +% +\def\defname#1#2#3{% + \par + % Get the values of \leftskip and \rightskip as they were outside the @def... + \advance\leftskip by -\defbodyindent + % + % Determine if we are typesetting the return type of a typed function + % on a line by itself. + \rettypeownlinefalse + \ifdoingtypefn % doing a typed function specifically? + % then check user option for putting return type on its own line: + \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else + \rettypeownlinetrue + \fi + \fi + % + % How we'll format the category name. Putting it in brackets helps + % distinguish it from the body text that may end up on the next line + % just below it. + \def\temp{#1}% + \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} + % + % Figure out line sizes for the paragraph shape. We'll always have at + % least two. + \tempnum = 2 + % + % The first line needs space for \box0; but if \rightskip is nonzero, + % we need only space for the part of \box0 which exceeds it: + \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip + % + % If doing a return type on its own line, we'll have another line. + \ifrettypeownline + \advance\tempnum by 1 + \def\maybeshapeline{0in \hsize}% + \else + \def\maybeshapeline{}% + \fi + % + % The continuations: + \dimen2=\hsize \advance\dimen2 by -\defargsindent + % + % The final paragraph shape: + \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2 + % + % Put the category name at the right margin. + \noindent + \hbox to 0pt{% + \hfil\box0 \kern-\hsize + % \hsize has to be shortened this way: + \kern\leftskip + % Intentionally do not respect \rightskip, since we need the space. + }% + % + % Allow all lines to be underfull without complaint: + \tolerance=10000 \hbadness=10000 + \exdentamount=\defbodyindent + {% + % defun fonts. We use typewriter by default (used to be bold) because: + % . we're printing identifiers, they should be in tt in principle. + % . in languages with many accents, such as Czech or French, it's + % common to leave accents off identifiers. The result looks ok in + % tt, but exceedingly strange in rm. + % . we don't want -- and --- to be treated as ligatures. + % . this still does not fix the ?` and !` ligatures, but so far no + % one has made identifiers using them :). + \df \tt + \def\temp{#2}% text of the return type + \ifx\temp\empty\else + \tclose{\temp}% typeset the return type + \ifrettypeownline + % put return type on its own line; prohibit line break following: + \hfil\vadjust{\nobreak}\break + \else + \space % type on same line, so just followed by a space + \fi + \fi % no return type + #3% output function name + }% + {\rm\enskip}% hskip 0.5 em of \tenrm + % + \boldbrax + % arguments will be output next, if any. +} + +% Print arguments in slanted roman (not ttsl), inconsistently with using +% tt for the name. This is because literal text is sometimes needed in +% the argument list (groff manual), and ttsl and tt are not very +% distinguishable. Prevent hyphenation at `-' chars. +% +\def\defunargs#1{% + % use sl by default (not ttsl), + % tt for the names. + \df \sl \hyphenchar\font=0 + % + % On the other hand, if an argument has two dashes (for instance), we + % want a way to get ttsl. Let's try @var for that. + \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}% + #1% + \sl\hyphenchar\font=45 +} + +% We want ()&[] to print specially on the defun line. +% +\def\activeparens{% + \catcode`\(=\active \catcode`\)=\active + \catcode`\[=\active \catcode`\]=\active + \catcode`\&=\active +} + +% Make control sequences which act like normal parenthesis chars. +\let\lparen = ( \let\rparen = ) + +% Be sure that we always have a definition for `(', etc. For example, +% if the fn name has parens in it, \boldbrax will not be in effect yet, +% so TeX would otherwise complain about undefined control sequence. +{ + \activeparens + \global\let(=\lparen \global\let)=\rparen + \global\let[=\lbrack \global\let]=\rbrack + \global\let& = \& + + \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} + \gdef\magicamp{\let&=\amprm} +} + +\newcount\parencount + +% If we encounter &foo, then turn on ()-hacking afterwards +\newif\ifampseen +\def\amprm#1 {\ampseentrue{\bf\ }} + +\def\parenfont{% + \ifampseen + % At the first level, print parens in roman, + % otherwise use the default font. + \ifnum \parencount=1 \rm \fi + \else + % The \sf parens (in \boldbrax) actually are a little bolder than + % the contained text. This is especially needed for [ and ] . + \sf + \fi +} +\def\infirstlevel#1{% + \ifampseen + \ifnum\parencount=1 + #1% + \fi + \fi +} +\def\bfafterword#1 {#1 \bf} + +\def\opnr{% + \global\advance\parencount by 1 + {\parenfont(}% + \infirstlevel \bfafterword +} +\def\clnr{% + {\parenfont)}% + \infirstlevel \sl + \global\advance\parencount by -1 +} + +\newcount\brackcount +\def\lbrb{% + \global\advance\brackcount by 1 + {\bf[}% +} +\def\rbrb{% + {\bf]}% + \global\advance\brackcount by -1 +} + +\def\checkparencounts{% + \ifnum\parencount=0 \else \badparencount \fi + \ifnum\brackcount=0 \else \badbrackcount \fi +} +% these should not use \errmessage; the glibc manual, at least, actually +% has such constructs (when documenting function pointers). +\def\badparencount{% + \message{Warning: unbalanced parentheses in @def...}% + \global\parencount=0 +} +\def\badbrackcount{% + \message{Warning: unbalanced square brackets in @def...}% + \global\brackcount=0 +} + + +\message{macros,} +% @macro. + +% To do this right we need a feature of e-TeX, \scantokens, +% which we arrange to emulate with a temporary file in ordinary TeX. +\ifx\eTeXversion\thisisundefined + \newwrite\macscribble + \def\scantokens#1{% + \toks0={#1}% + \immediate\openout\macscribble=\jobname.tmp + \immediate\write\macscribble{\the\toks0}% + \immediate\closeout\macscribble + \input \jobname.tmp + } +\fi + +\def\scanmacro#1{\begingroup + \newlinechar`\^^M + \let\xeatspaces\eatspaces + % + % Undo catcode changes of \startcontents and \doprintindex + % When called from @insertcopying or (short)caption, we need active + % backslash to get it printed correctly. Previously, we had + % \catcode`\\=\other instead. We'll see whether a problem appears + % with macro expansion. --kasal, 19aug04 + \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ + % + % ... and for \example: + \spaceisspace + % + % The \empty here causes a following catcode 5 newline to be eaten as + % part of reading whitespace after a control sequence. It does not + % eat a catcode 13 newline. There's no good way to handle the two + % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX + % would then have different behavior). See the Macro Details node in + % the manual for the workaround we recommend for macros and + % line-oriented commands. + % + \scantokens{#1\empty}% +\endgroup} + +\def\scanexp#1{% + \edef\temp{\noexpand\scanmacro{#1}}% + \temp +} + +\newcount\paramno % Count of parameters +\newtoks\macname % Macro name +\newif\ifrecursive % Is it recursive? + +% List of all defined macros in the form +% \definedummyword\macro1\definedummyword\macro2... +% Currently is also contains all @aliases; the list can be split +% if there is a need. +\def\macrolist{} + +% Add the macro to \macrolist +\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} +\def\addtomacrolistxxx#1{% + \toks0 = \expandafter{\macrolist\definedummyword#1}% + \xdef\macrolist{\the\toks0}% +} + +% Utility routines. +% This does \let #1 = #2, with \csnames; that is, +% \let \csname#1\endcsname = \csname#2\endcsname +% (except of course we have to play expansion games). +% +\def\cslet#1#2{% + \expandafter\let + \csname#1\expandafter\endcsname + \csname#2\endcsname +} + +% Trim leading and trailing spaces off a string. +% Concepts from aro-bend problem 15 (see CTAN). +{\catcode`\@=11 +\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} +\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} +\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} +\def\unbrace#1{#1} +\unbrace{\gdef\trim@@@ #1 } #2@{#1} +} + +% Trim a single trailing ^^M off a string. +{\catcode`\^^M=\other \catcode`\Q=3% +\gdef\eatcr #1{\eatcra #1Q^^MQ}% +\gdef\eatcra#1^^MQ{\eatcrb#1Q}% +\gdef\eatcrb#1Q#2Q{#1}% +} + +% Macro bodies are absorbed as an argument in a context where +% all characters are catcode 10, 11 or 12, except \ which is active +% (as in normal texinfo). It is necessary to change the definition of \ +% to recognize macro arguments; this is the job of \mbodybackslash. +% +% Non-ASCII encodings make 8-bit characters active, so un-activate +% them to avoid their expansion. Must do this non-globally, to +% confine the change to the current group. +% +% It's necessary to have hard CRs when the macro is executed. This is +% done by making ^^M (\endlinechar) catcode 12 when reading the macro +% body, and then making it the \newlinechar in \scanmacro. +% +\def\scanctxt{% used as subroutine + \catcode`\"=\other + \catcode`\+=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\@=\other + \catcode`\^=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\~=\other + \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi +} + +\def\scanargctxt{% used for copying and captions, not macros. + \scanctxt + \catcode`\\=\other + \catcode`\^^M=\other +} + +\def\macrobodyctxt{% used for @macro definitions + \scanctxt + \catcode`\{=\other + \catcode`\}=\other + \catcode`\^^M=\other + \usembodybackslash +} + +\def\macroargctxt{% used when scanning invocations + \scanctxt + \catcode`\\=0 +} +% why catcode 0 for \ in the above? To recognize \\ \{ \} as "escapes" +% for the single characters \ { }. Thus, we end up with the "commands" +% that would be written @\ @{ @} in a Texinfo document. +% +% We already have @{ and @}. For @\, we define it here, and only for +% this purpose, to produce a typewriter backslash (so, the @\ that we +% define for @math can't be used with @macro calls): +% +\def\\{\normalbackslash}% +% +% We would like to do this for \, too, since that is what makeinfo does. +% But it is not possible, because Texinfo already has a command @, for a +% cedilla accent. Documents must use @comma{} instead. +% +% \anythingelse will almost certainly be an error of some kind. + + +% \mbodybackslash is the definition of \ in @macro bodies. +% It maps \foo\ => \csname macarg.foo\endcsname => #N +% where N is the macro parameter number. +% We define \csname macarg.\endcsname to be \realbackslash, so +% \\ in macro replacement text gets you a backslash. +% +{\catcode`@=0 @catcode`@\=@active + @gdef@usembodybackslash{@let\=@mbodybackslash} + @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} +} +\expandafter\def\csname macarg.\endcsname{\realbackslash} + +\def\margbackslash#1{\char`\#1 } + +\def\macro{\recursivefalse\parsearg\macroxxx} +\def\rmacro{\recursivetrue\parsearg\macroxxx} + +\def\macroxxx#1{% + \getargs{#1}% now \macname is the macname and \argl the arglist + \ifx\argl\empty % no arguments + \paramno=0 + \else + \expandafter\parsemargdef \argl;% + \fi + \if1\csname ismacro.\the\macname\endcsname + \message{Warning: redefining \the\macname}% + \else + \expandafter\ifx\csname \the\macname\endcsname \relax + \else \errmessage{Macro name \the\macname\space already defined}\fi + \global\cslet{macsave.\the\macname}{\the\macname}% + \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% + \addtomacrolist{\the\macname}% + \fi + \begingroup \macrobodyctxt + \ifrecursive \expandafter\parsermacbody + \else \expandafter\parsemacbody + \fi} + +\parseargdef\unmacro{% + \if1\csname ismacro.#1\endcsname + \global\cslet{#1}{macsave.#1}% + \global\expandafter\let \csname ismacro.#1\endcsname=0% + % Remove the macro name from \macrolist: + \begingroup + \expandafter\let\csname#1\endcsname \relax + \let\definedummyword\unmacrodo + \xdef\macrolist{\macrolist}% + \endgroup + \else + \errmessage{Macro #1 not defined}% + \fi +} + +% Called by \do from \dounmacro on each macro. The idea is to omit any +% macro definitions that have been changed to \relax. +% +\def\unmacrodo#1{% + \ifx #1\relax + % remove this + \else + \noexpand\definedummyword \noexpand#1% + \fi +} + +% This makes use of the obscure feature that if the last token of a +% is #, then the preceding argument is delimited by +% an opening brace, and that opening brace is not consumed. +\def\getargs#1{\getargsxxx#1{}} +\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} +\def\getmacname#1 #2\relax{\macname={#1}} +\def\getmacargs#1{\def\argl{#1}} + +% Parse the optional {params} list. Set up \paramno and \paramlist +% so \defmacro knows what to do. Define \macarg.blah for each blah +% in the params list to be ##N where N is the position in that list. +% That gets used by \mbodybackslash (above). +% +% We need to get `macro parameter char #' into several definitions. +% The technique used is stolen from LaTeX: let \hash be something +% unexpandable, insert that wherever you need a #, and then redefine +% it to # just before using the token list produced. +% +% The same technique is used to protect \eatspaces till just before +% the macro is used. + +\def\parsemargdef#1;{% + \paramno=0\def\paramlist{}% + \let\hash\relax + \let\xeatspaces\relax + \parsemargdefxxx#1,;,% +} +\def\parsemargdefxxx#1,{% + \if#1;\let\next=\relax + \else \let\next=\parsemargdefxxx + \advance\paramno by 1 + \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname + {\xeatspaces{\hash\the\paramno}}% + \edef\paramlist{\paramlist\hash\the\paramno,}% + \fi\next} + +% These two commands read recursive and nonrecursive macro bodies. +% (They're different since rec and nonrec macros end differently.) +% +\long\def\parsemacbody#1@end macro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% +\long\def\parsermacbody#1@end rmacro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% + +% This defines the macro itself. There are six cases: recursive and +% nonrecursive macros of zero, one, and many arguments. +% Much magic with \expandafter here. +% \xdef is used so that macro definitions will survive the file +% they're defined in; @include reads the file inside a group. +% +\def\defmacro{% + \let\hash=##% convert placeholders to macro parameter chars + \ifrecursive + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\scanmacro{\temp}}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup\noexpand\scanmacro{\temp}}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \fi + \else + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \expandafter\noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \fi + \fi} + +\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} + +% \braceorline decides whether the next nonwhitespace character is a +% {. If so it reads up to the closing }, if not, it reads the whole +% line. Whatever was read is then fed to the next control sequence +% as an argument (by \parsebrace or \parsearg). +% +\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} +\def\braceorlinexxx{% + \ifx\nchar\bgroup\else + \expandafter\parsearg + \fi \macnamexxx} + + +% @alias. +% We need some trickery to remove the optional spaces around the equal +% sign. Make them active and then expand them all to nothing. +% +\def\alias{\parseargusing\obeyspaces\aliasxxx} +\def\aliasxxx #1{\aliasyyy#1\relax} +\def\aliasyyy #1=#2\relax{% + {% + \expandafter\let\obeyedspace=\empty + \addtomacrolist{#1}% + \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% + }% + \next +} + + +\message{cross references,} + +\newwrite\auxfile +\newif\ifhavexrefs % True if xref values are known. +\newif\ifwarnedxrefs % True if we warned once that they aren't known. + +% @inforef is relatively simple. +\def\inforef #1{\inforefzzz #1,,,,**} +\def\inforefzzz #1,#2,#3,#4**{% + \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, + node \samp{\ignorespaces#1{}}} + +% @node's only job in TeX is to define \lastnode, which is used in +% cross-references. The @node line might or might not have commas, and +% might or might not have spaces before the first comma, like: +% @node foo , bar , ... +% We don't want such trailing spaces in the node name. +% +\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} +% +% also remove a trailing comma, in case of something like this: +% @node Help-Cross, , , Cross-refs +\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} +\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} + +\let\nwnode=\node +\let\lastnode=\empty + +% Write a cross-reference definition for the current node. #1 is the +% type (Ynumbered, Yappendix, Ynothing). +% +\def\donoderef#1{% + \ifx\lastnode\empty\else + \setref{\lastnode}{#1}% + \global\let\lastnode=\empty + \fi +} + +% @anchor{NAME} -- define xref target at arbitrary point. +% +\newcount\savesfregister +% +\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} +\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} +\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} + +% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an +% anchor), which consists of three parts: +% 1) NAME-title - the current sectioning name taken from \lastsection, +% or the anchor name. +% 2) NAME-snt - section number and type, passed as the SNT arg, or +% empty for anchors. +% 3) NAME-pg - the page number. +% +% This is called from \donoderef, \anchor, and \dofloat. In the case of +% floats, there is an additional part, which is not written here: +% 4) NAME-lof - the text as it should appear in a @listoffloats. +% +\def\setref#1#2{% + \pdfmkdest{#1}% + \iflinks + {% + \atdummies % preserve commands, but don't expand them + \edef\writexrdef##1##2{% + \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef + ##1}{##2}}% these are parameters of \writexrdef + }% + \toks0 = \expandafter{\lastsection}% + \immediate \writexrdef{title}{\the\toks0 }% + \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. + \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout + }% + \fi +} + +% @xrefautosectiontitle on|off says whether @section(ing) names are used +% automatically in xrefs, if the third arg is not explicitly specified. +% This was provided as a "secret" @set xref-automatic-section-title +% variable, now it's official. +% +\parseargdef\xrefautomaticsectiontitle{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETxref-automatic-section-title\endcsname + = \empty + \else\ifx\temp\offword + \expandafter\let\csname SETxref-automatic-section-title\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @xrefautomaticsectiontitle value `\temp', + must be on|off}% + \fi\fi +} + + +% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is +% the node name, #2 the name of the Info cross-reference, #3 the printed +% node name, #4 the name of the Info file, #5 the name of the printed +% manual. All but the node name can be omitted. +% +\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} +\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} +\def\ref#1{\xrefX[#1,,,,,,,]} +\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup + \unsepspaces + \def\printedmanual{\ignorespaces #5}% + \def\printedrefname{\ignorespaces #3}% + \setbox1=\hbox{\printedmanual\unskip}% + \setbox0=\hbox{\printedrefname\unskip}% + \ifdim \wd0 = 0pt + % No printed node name was explicitly given. + \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax + % Use the node name inside the square brackets. + \def\printedrefname{\ignorespaces #1}% + \else + % Use the actual chapter/section title appear inside + % the square brackets. Use the real section title if we have it. + \ifdim \wd1 > 0pt + % It is in another manual, so we don't have it. + \def\printedrefname{\ignorespaces #1}% + \else + \ifhavexrefs + % We know the real title if we have the xref values. + \def\printedrefname{\refx{#1-title}{}}% + \else + % Otherwise just copy the Info node name. + \def\printedrefname{\ignorespaces #1}% + \fi% + \fi + \fi + \fi + % + % Make link in pdf output. + \ifpdf + {\indexnofonts + \turnoffactive + % This expands tokens, so do it after making catcode changes, so _ + % etc. don't get their TeX definitions. + \getfilename{#4}% + % + % See comments at \activebackslashdouble. + {\activebackslashdouble \xdef\pdfxrefdest{#1}% + \backslashparens\pdfxrefdest}% + % + \leavevmode + \startlink attr{/Border [0 0 0]}% + \ifnum\filenamelength>0 + goto file{\the\filename.pdf} name{\pdfxrefdest}% + \else + goto name{\pdfmkpgn{\pdfxrefdest}}% + \fi + }% + \setcolor{\linkcolor}% + \fi + % + % Float references are printed completely differently: "Figure 1.2" + % instead of "[somenode], p.3". We distinguish them by the + % LABEL-title being set to a magic string. + {% + % Have to otherify everything special to allow the \csname to + % include an _ in the xref name, etc. + \indexnofonts + \turnoffactive + \expandafter\global\expandafter\let\expandafter\Xthisreftitle + \csname XR#1-title\endcsname + }% + \iffloat\Xthisreftitle + % If the user specified the print name (third arg) to the ref, + % print it instead of our usual "Figure 1.2". + \ifdim\wd0 = 0pt + \refx{#1-snt}{}% + \else + \printedrefname + \fi + % + % if the user also gave the printed manual name (fifth arg), append + % "in MANUALNAME". + \ifdim \wd1 > 0pt + \space \putwordin{} \cite{\printedmanual}% + \fi + \else + % node/anchor (non-float) references. + % + % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not + % insert empty discretionaries after hyphens, which means that it will + % not find a line break at a hyphen in a node names. Since some manuals + % are best written with fairly long node names, containing hyphens, this + % is a loss. Therefore, we give the text of the node name again, so it + % is as if TeX is seeing it for the first time. + \ifdim \wd1 > 0pt + \putwordSection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% + \else + % _ (for example) has to be the character _ for the purposes of the + % control sequence corresponding to the node, but it has to expand + % into the usual \leavevmode...\vrule stuff for purposes of + % printing. So we \turnoffactive for the \refx-snt, back on for the + % printing, back off for the \refx-pg. + {\turnoffactive + % Only output a following space if the -snt ref is nonempty; for + % @unnumbered and @anchor, it won't be. + \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% + \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi + }% + % output the `[mynode]' via a macro so it can be overridden. + \xrefprintnodename\printedrefname + % + % But we always want a comma and a space: + ,\space + % + % output the `page 3'. + \turnoffactive \putwordpage\tie\refx{#1-pg}{}% + \fi + \fi + \endlink +\endgroup} + +% This macro is called from \xrefX for the `[nodename]' part of xref +% output. It's a separate macro only so it can be changed more easily, +% since square brackets don't work well in some documents. Particularly +% one that Bob is working on :). +% +\def\xrefprintnodename#1{[#1]} + +% Things referred to by \setref. +% +\def\Ynothing{} +\def\Yomitfromtoc{} +\def\Ynumbered{% + \ifnum\secno=0 + \putwordChapter@tie \the\chapno + \else \ifnum\subsecno=0 + \putwordSection@tie \the\chapno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno + \else + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} +\def\Yappendix{% + \ifnum\secno=0 + \putwordAppendix@tie @char\the\appendixno{}% + \else \ifnum\subsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno + \else + \putwordSection@tie + @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} + +% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. +% If its value is nonempty, SUFFIX is output afterward. +% +\def\refx#1#2{% + {% + \indexnofonts + \otherbackslash + \expandafter\global\expandafter\let\expandafter\thisrefX + \csname XR#1\endcsname + }% + \ifx\thisrefX\relax + % If not defined, say something at least. + \angleleft un\-de\-fined\angleright + \iflinks + \ifhavexrefs + {\toks0 = {#1}% avoid expansion of possibly-complex value + \message{\linenumber Undefined cross reference `\the\toks0'.}}% + \else + \ifwarnedxrefs\else + \global\warnedxrefstrue + \message{Cross reference values unknown; you must run TeX again.}% + \fi + \fi + \fi + \else + % It's defined, so just use it. + \thisrefX + \fi + #2% Output the suffix in any case. +} + +% This is the macro invoked by entries in the aux file. Usually it's +% just a \def (we prepend XR to the control sequence name to avoid +% collisions). But if this is a float type, we have more work to do. +% +\def\xrdef#1#2{% + {% The node name might contain 8-bit characters, which in our current + % implementation are changed to commands like @'e. Don't let these + % mess up the control sequence name. + \indexnofonts + \turnoffactive + \xdef\safexrefname{#1}% + }% + % + \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref + % + % Was that xref control sequence that we just defined for a float? + \expandafter\iffloat\csname XR\safexrefname\endcsname + % it was a float, and we have the (safe) float type in \iffloattype. + \expandafter\let\expandafter\floatlist + \csname floatlist\iffloattype\endcsname + % + % Is this the first time we've seen this float type? + \expandafter\ifx\floatlist\relax + \toks0 = {\do}% yes, so just \do + \else + % had it before, so preserve previous elements in list. + \toks0 = \expandafter{\floatlist\do}% + \fi + % + % Remember this xref in the control sequence \floatlistFLOATTYPE, + % for later use in \listoffloats. + \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0 + {\safexrefname}}% + \fi +} + +% Read the last existing aux file, if any. No error if none exists. +% +\def\tryauxfile{% + \openin 1 \jobname.aux + \ifeof 1 \else + \readdatafile{aux}% + \global\havexrefstrue + \fi + \closein 1 +} + +\def\setupdatafile{% + \catcode`\^^@=\other + \catcode`\^^A=\other + \catcode`\^^B=\other + \catcode`\^^C=\other + \catcode`\^^D=\other + \catcode`\^^E=\other + \catcode`\^^F=\other + \catcode`\^^G=\other + \catcode`\^^H=\other + \catcode`\^^K=\other + \catcode`\^^L=\other + \catcode`\^^N=\other + \catcode`\^^P=\other + \catcode`\^^Q=\other + \catcode`\^^R=\other + \catcode`\^^S=\other + \catcode`\^^T=\other + \catcode`\^^U=\other + \catcode`\^^V=\other + \catcode`\^^W=\other + \catcode`\^^X=\other + \catcode`\^^Z=\other + \catcode`\^^[=\other + \catcode`\^^\=\other + \catcode`\^^]=\other + \catcode`\^^^=\other + \catcode`\^^_=\other + % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. + % in xref tags, i.e., node names. But since ^^e4 notation isn't + % supported in the main text, it doesn't seem desirable. Furthermore, + % that is not enough: for node names that actually contain a ^ + % character, we would end up writing a line like this: 'xrdef {'hat + % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first + % argument, and \hat is not an expandable control sequence. It could + % all be worked out, but why? Either we support ^^ or we don't. + % + % The other change necessary for this was to define \auxhat: + % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter + % and then to call \auxhat in \setq. + % + \catcode`\^=\other + % + % Special characters. Should be turned off anyway, but... + \catcode`\~=\other + \catcode`\[=\other + \catcode`\]=\other + \catcode`\"=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\$=\other + \catcode`\#=\other + \catcode`\&=\other + \catcode`\%=\other + \catcode`+=\other % avoid \+ for paranoia even though we've turned it off + % + % This is to support \ in node names and titles, since the \ + % characters end up in a \csname. It's easier than + % leaving it active and making its active definition an actual \ + % character. What I don't understand is why it works in the *value* + % of the xrdef. Seems like it should be a catcode12 \, and that + % should not typeset properly. But it works, so I'm moving on for + % now. --karl, 15jan04. + \catcode`\\=\other + % + % Make the characters 128-255 be printing characters. + {% + \count1=128 + \def\loop{% + \catcode\count1=\other + \advance\count1 by 1 + \ifnum \count1<256 \loop \fi + }% + }% + % + % @ is our escape character in .aux files, and we need braces. + \catcode`\{=1 + \catcode`\}=2 + \catcode`\@=0 +} + +\def\readdatafile#1{% +\begingroup + \setupdatafile + \input\jobname.#1 +\endgroup} + + +\message{insertions,} +% including footnotes. + +\newcount \footnoteno + +% The trailing space in the following definition for supereject is +% vital for proper filling; pages come out unaligned when you do a +% pagealignmacro call if that space before the closing brace is +% removed. (Generally, numeric constants should always be followed by a +% space to prevent strange expansion errors.) +\def\supereject{\par\penalty -20000\footnoteno =0 } + +% @footnotestyle is meaningful for info output only. +\let\footnotestyle=\comment + +{\catcode `\@=11 +% +% Auto-number footnotes. Otherwise like plain. +\gdef\footnote{% + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \global\advance\footnoteno by \@ne + \edef\thisfootno{$^{\the\footnoteno}$}% + % + % In case the footnote comes at the end of a sentence, preserve the + % extra spacing after we do the footnote number. + \let\@sf\empty + \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi + % + % Remove inadvertent blank space before typesetting the footnote number. + \unskip + \thisfootno\@sf + \dofootnote +}% + +% Don't bother with the trickery in plain.tex to not require the +% footnote text as a parameter. Our footnotes don't need to be so general. +% +% Oh yes, they do; otherwise, @ifset (and anything else that uses +% \parseargline) fails inside footnotes because the tokens are fixed when +% the footnote is read. --karl, 16nov96. +% +\gdef\dofootnote{% + \insert\footins\bgroup + % We want to typeset this text as a normal paragraph, even if the + % footnote reference occurs in (for example) a display environment. + % So reset some parameters. + \hsize=\pagewidth + \interlinepenalty\interfootnotelinepenalty + \splittopskip\ht\strutbox % top baseline for broken footnotes + \splitmaxdepth\dp\strutbox + \floatingpenalty\@MM + \leftskip\z@skip + \rightskip\z@skip + \spaceskip\z@skip + \xspaceskip\z@skip + \parindent\defaultparindent + % + \smallfonts \rm + % + % Because we use hanging indentation in footnotes, a @noindent appears + % to exdent this text, so make it be a no-op. makeinfo does not use + % hanging indentation so @noindent can still be needed within footnote + % text after an @example or the like (not that this is good style). + \let\noindent = \relax + % + % Hang the footnote text off the number. Use \everypar in case the + % footnote extends for more than one paragraph. + \everypar = {\hang}% + \textindent{\thisfootno}% + % + % Don't crash into the line above the footnote text. Since this + % expands into a box, it must come within the paragraph, lest it + % provide a place where TeX can split the footnote. + \footstrut + \futurelet\next\fo@t +} +}%end \catcode `\@=11 + +% In case a @footnote appears in a vbox, save the footnote text and create +% the real \insert just after the vbox finished. Otherwise, the insertion +% would be lost. +% Similarly, if a @footnote appears inside an alignment, save the footnote +% text to a box and make the \insert when a row of the table is finished. +% And the same can be done for other insert classes. --kasal, 16nov03. + +% Replace the \insert primitive by a cheating macro. +% Deeper inside, just make sure that the saved insertions are not spilled +% out prematurely. +% +\def\startsavinginserts{% + \ifx \insert\ptexinsert + \let\insert\saveinsert + \else + \let\checkinserts\relax + \fi +} + +% This \insert replacement works for both \insert\footins{foo} and +% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. +% +\def\saveinsert#1{% + \edef\next{\noexpand\savetobox \makeSAVEname#1}% + \afterassignment\next + % swallow the left brace + \let\temp = +} +\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} +\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} + +\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} + +\def\placesaveins#1{% + \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname + {\box#1}% +} + +% eat @SAVE -- beware, all of them have catcode \other: +{ + \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) + \gdef\gobblesave @SAVE{} +} + +% initialization: +\def\newsaveins #1{% + \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% + \next +} +\def\newsaveinsX #1{% + \csname newbox\endcsname #1% + \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts + \checksaveins #1}% +} + +% initialize: +\let\checkinserts\empty +\newsaveins\footins +\newsaveins\margin + + +% @image. We use the macros from epsf.tex to support this. +% If epsf.tex is not installed and @image is used, we complain. +% +% Check for and read epsf.tex up front. If we read it only at @image +% time, we might be inside a group, and then its definitions would get +% undone and the next image would fail. +\openin 1 = epsf.tex +\ifeof 1 \else + % Do not bother showing banner with epsf.tex v2.7k (available in + % doc/epsf.tex and on ctan). + \def\epsfannounce{\toks0 = }% + \input epsf.tex +\fi +\closein 1 +% +% We will only complain once about lack of epsf.tex. +\newif\ifwarnednoepsf +\newhelp\noepsfhelp{epsf.tex must be installed for images to + work. It is also included in the Texinfo distribution, or you can get + it from ftp://tug.org/tex/epsf.tex.} +% +\def\image#1{% + \ifx\epsfbox\thisiundefined + \ifwarnednoepsf \else + \errhelp = \noepsfhelp + \errmessage{epsf.tex not found, images will be ignored}% + \global\warnednoepsftrue + \fi + \else + \imagexxx #1,,,,,\finish + \fi +} +% +% Arguments to @image: +% #1 is (mandatory) image filename; we tack on .eps extension. +% #2 is (optional) width, #3 is (optional) height. +% #4 is (ignored optional) html alt text. +% #5 is (ignored optional) extension. +% #6 is just the usual extra ignored arg for parsing stuff. +\newif\ifimagevmode +\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup + \catcode`\^^M = 5 % in case we're inside an example + \normalturnoffactive % allow _ et al. in names + % If the image is by itself, center it. + \ifvmode + \imagevmodetrue + \nobreak\medskip + % Usually we'll have text after the image which will insert + % \parskip glue, so insert it here too to equalize the space + % above and below. + \nobreak\vskip\parskip + \nobreak + \fi + % + % Leave vertical mode so that indentation from an enclosing + % environment such as @quotation is respected. On the other hand, if + % it's at the top level, we don't want the normal paragraph indentation. + \noindent + % + % Output the image. + \ifpdf + \dopdfimage{#1}{#2}{#3}% + \else + % \epsfbox itself resets \epsf?size at each figure. + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi + \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi + \epsfbox{#1.eps}% + \fi + % + \ifimagevmode \medskip \fi % space after the standalone image +\endgroup} + + +% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, +% etc. We don't actually implement floating yet, we always include the +% float "here". But it seemed the best name for the future. +% +\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} + +% There may be a space before second and/or third parameter; delete it. +\def\eatcommaspace#1, {#1,} + +% #1 is the optional FLOATTYPE, the text label for this float, typically +% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, +% this float will not be numbered and cannot be referred to. +% +% #2 is the optional xref label. Also must be present for the float to +% be referable. +% +% #3 is the optional positioning argument; for now, it is ignored. It +% will somehow specify the positions allowed to float to (here, top, bottom). +% +% We keep a separate counter for each FLOATTYPE, which we reset at each +% chapter-level command. +\let\resetallfloatnos=\empty +% +\def\dofloat#1,#2,#3,#4\finish{% + \let\thiscaption=\empty + \let\thisshortcaption=\empty + % + % don't lose footnotes inside @float. + % + % BEWARE: when the floats start float, we have to issue warning whenever an + % insert appears inside a float which could possibly float. --kasal, 26may04 + % + \startsavinginserts + % + % We can't be used inside a paragraph. + \par + % + \vtop\bgroup + \def\floattype{#1}% + \def\floatlabel{#2}% + \def\floatloc{#3}% we do nothing with this yet. + % + \ifx\floattype\empty + \let\safefloattype=\empty + \else + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + \fi + % + % If label is given but no type, we handle that as the empty type. + \ifx\floatlabel\empty \else + % We want each FLOATTYPE to be numbered separately (Figure 1, + % Table 1, Figure 2, ...). (And if no label, no number.) + % + \expandafter\getfloatno\csname\safefloattype floatno\endcsname + \global\advance\floatno by 1 + % + {% + % This magic value for \lastsection is output by \setref as the + % XREFLABEL-title value. \xrefX uses it to distinguish float + % labels (which have a completely different output format) from + % node and anchor labels. And \xrdef uses it to construct the + % lists of floats. + % + \edef\lastsection{\floatmagic=\safefloattype}% + \setref{\floatlabel}{Yfloat}% + }% + \fi + % + % start with \parskip glue, I guess. + \vskip\parskip + % + % Don't suppress indentation if a float happens to start a section. + \restorefirstparagraphindent +} + +% we have these possibilities: +% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap +% @float Foo,lbl & no caption: Foo 1.1 +% @float Foo & @caption{Cap}: Foo: Cap +% @float Foo & no caption: Foo +% @float ,lbl & Caption{Cap}: 1.1: Cap +% @float ,lbl & no caption: 1.1 +% @float & @caption{Cap}: Cap +% @float & no caption: +% +\def\Efloat{% + \let\floatident = \empty + % + % In all cases, if we have a float type, it comes first. + \ifx\floattype\empty \else \def\floatident{\floattype}\fi + % + % If we have an xref label, the number comes next. + \ifx\floatlabel\empty \else + \ifx\floattype\empty \else % if also had float type, need tie first. + \appendtomacro\floatident{\tie}% + \fi + % the number. + \appendtomacro\floatident{\chaplevelprefix\the\floatno}% + \fi + % + % Start the printed caption with what we've constructed in + % \floatident, but keep it separate; we need \floatident again. + \let\captionline = \floatident + % + \ifx\thiscaption\empty \else + \ifx\floatident\empty \else + \appendtomacro\captionline{: }% had ident, so need a colon between + \fi + % + % caption text. + \appendtomacro\captionline{\scanexp\thiscaption}% + \fi + % + % If we have anything to print, print it, with space before. + % Eventually this needs to become an \insert. + \ifx\captionline\empty \else + \vskip.5\parskip + \captionline + % + % Space below caption. + \vskip\parskip + \fi + % + % If have an xref label, write the list of floats info. Do this + % after the caption, to avoid chance of it being a breakpoint. + \ifx\floatlabel\empty \else + % Write the text that goes in the lof to the aux file as + % \floatlabel-lof. Besides \floatident, we include the short + % caption if specified, else the full caption if specified, else nothing. + {% + \atdummies + % + % since we read the caption text in the macro world, where ^^M + % is turned into a normal character, we have to scan it back, so + % we don't write the literal three characters "^^M" into the aux file. + \scanexp{% + \xdef\noexpand\gtemp{% + \ifx\thisshortcaption\empty + \thiscaption + \else + \thisshortcaption + \fi + }% + }% + \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident + \ifx\gtemp\empty \else : \gtemp \fi}}% + }% + \fi + \egroup % end of \vtop + % + % place the captured inserts + % + % BEWARE: when the floats start floating, we have to issue warning + % whenever an insert appears inside a float which could possibly + % float. --kasal, 26may04 + % + \checkinserts +} + +% Append the tokens #2 to the definition of macro #1, not expanding either. +% +\def\appendtomacro#1#2{% + \expandafter\def\expandafter#1\expandafter{#1#2}% +} + +% @caption, @shortcaption +% +\def\caption{\docaption\thiscaption} +\def\shortcaption{\docaption\thisshortcaption} +\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} +\def\defcaption#1#2{\egroup \def#1{#2}} + +% The parameter is the control sequence identifying the counter we are +% going to use. Create it if it doesn't exist and assign it to \floatno. +\def\getfloatno#1{% + \ifx#1\relax + % Haven't seen this figure type before. + \csname newcount\endcsname #1% + % + % Remember to reset this floatno at the next chap. + \expandafter\gdef\expandafter\resetallfloatnos + \expandafter{\resetallfloatnos #1=0 }% + \fi + \let\floatno#1% +} + +% \setref calls this to get the XREFLABEL-snt value. We want an @xref +% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we +% first read the @float command. +% +\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% + +% Magic string used for the XREFLABEL-title value, so \xrefX can +% distinguish floats from other xref types. +\def\floatmagic{!!float!!} + +% #1 is the control sequence we are passed; we expand into a conditional +% which is true if #1 represents a float ref. That is, the magic +% \lastsection value which we \setref above. +% +\def\iffloat#1{\expandafter\doiffloat#1==\finish} +% +% #1 is (maybe) the \floatmagic string. If so, #2 will be the +% (safe) float type for this float. We set \iffloattype to #2. +% +\def\doiffloat#1=#2=#3\finish{% + \def\temp{#1}% + \def\iffloattype{#2}% + \ifx\temp\floatmagic +} + +% @listoffloats FLOATTYPE - print a list of floats like a table of contents. +% +\parseargdef\listoffloats{% + \def\floattype{#1}% floattype + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + % + % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. + \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax + \ifhavexrefs + % if the user said @listoffloats foo but never @float foo. + \message{\linenumber No `\safefloattype' floats to list.}% + \fi + \else + \begingroup + \leftskip=\tocindent % indent these entries like a toc + \let\do=\listoffloatsdo + \csname floatlist\safefloattype\endcsname + \endgroup + \fi +} + +% This is called on each entry in a list of floats. We're passed the +% xref label, in the form LABEL-title, which is how we save it in the +% aux file. We strip off the -title and look up \XRLABEL-lof, which +% has the text we're supposed to typeset here. +% +% Figures without xref labels will not be included in the list (since +% they won't appear in the aux file). +% +\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} +\def\listoffloatsdoentry#1-title\finish{{% + % Can't fully expand XR#1-lof because it can contain anything. Just + % pass the control sequence. On the other hand, XR#1-pg is just the + % page number, and we want to fully expand that so we can get a link + % in pdf output. + \toksA = \expandafter{\csname XR#1-lof\endcsname}% + % + % use the same \entry macro we use to generate the TOC and index. + \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% + \writeentry +}} + + +\message{localization,} + +% For single-language documents, @documentlanguage is usually given very +% early, just after @documentencoding. Single argument is the language +% (de) or locale (de_DE) abbreviation. +% +{ + \catcode`\_ = \active + \globaldefs=1 +\parseargdef\documentlanguage{\begingroup + \let_=\normalunderscore % normal _ character for filenames + \tex % read txi-??.tex file in plain TeX. + % Read the file by the name they passed if it exists. + \openin 1 txi-#1.tex + \ifeof 1 + \documentlanguagetrywithoutunderscore{#1_\finish}% + \else + \globaldefs = 1 % everything in the txi-LL files needs to persist + \input txi-#1.tex + \fi + \closein 1 + \endgroup % end raw TeX +\endgroup} +% +% If they passed de_DE, and txi-de_DE.tex doesn't exist, +% try txi-de.tex. +% +\gdef\documentlanguagetrywithoutunderscore#1_#2\finish{% + \openin 1 txi-#1.tex + \ifeof 1 + \errhelp = \nolanghelp + \errmessage{Cannot read language file txi-#1.tex}% + \else + \globaldefs = 1 % everything in the txi-LL files needs to persist + \input txi-#1.tex + \fi + \closein 1 +} +}% end of special _ catcode +% +\newhelp\nolanghelp{The given language definition file cannot be found or +is empty. Maybe you need to install it? Putting it in the current +directory should work if nowhere else does.} + +% This macro is called from txi-??.tex files; the first argument is the +% \language name to set (without the "\lang@" prefix), the second and +% third args are \{left,right}hyphenmin. +% +% The language names to pass are determined when the format is built. +% See the etex.log file created at that time, e.g., +% /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log. +% +% With TeX Live 2008, etex now includes hyphenation patterns for all +% available languages. This means we can support hyphenation in +% Texinfo, at least to some extent. (This still doesn't solve the +% accented characters problem.) +% +\catcode`@=11 +\def\txisetlanguage#1#2#3{% + % do not set the language if the name is undefined in the current TeX. + \expandafter\ifx\csname lang@#1\endcsname \relax + \message{no patterns for #1}% + \else + \global\language = \csname lang@#1\endcsname + \fi + % but there is no harm in adjusting the hyphenmin values regardless. + \global\lefthyphenmin = #2\relax + \global\righthyphenmin = #3\relax +} + +% Helpers for encodings. +% Set the catcode of characters 128 through 255 to the specified number. +% +\def\setnonasciicharscatcode#1{% + \count255=128 + \loop\ifnum\count255<256 + \global\catcode\count255=#1\relax + \advance\count255 by 1 + \repeat +} + +\def\setnonasciicharscatcodenonglobal#1{% + \count255=128 + \loop\ifnum\count255<256 + \catcode\count255=#1\relax + \advance\count255 by 1 + \repeat +} + +% @documentencoding sets the definition of non-ASCII characters +% according to the specified encoding. +% +\parseargdef\documentencoding{% + % Encoding being declared for the document. + \def\declaredencoding{\csname #1.enc\endcsname}% + % + % Supported encodings: names converted to tokens in order to be able + % to compare them with \ifx. + \def\ascii{\csname US-ASCII.enc\endcsname}% + \def\latnine{\csname ISO-8859-15.enc\endcsname}% + \def\latone{\csname ISO-8859-1.enc\endcsname}% + \def\lattwo{\csname ISO-8859-2.enc\endcsname}% + \def\utfeight{\csname UTF-8.enc\endcsname}% + % + \ifx \declaredencoding \ascii + \asciichardefs + % + \else \ifx \declaredencoding \lattwo + \setnonasciicharscatcode\active + \lattwochardefs + % + \else \ifx \declaredencoding \latone + \setnonasciicharscatcode\active + \latonechardefs + % + \else \ifx \declaredencoding \latnine + \setnonasciicharscatcode\active + \latninechardefs + % + \else \ifx \declaredencoding \utfeight + \setnonasciicharscatcode\active + \utfeightchardefs + % + \else + \message{Unknown document encoding #1, ignoring.}% + % + \fi % utfeight + \fi % latnine + \fi % latone + \fi % lattwo + \fi % ascii +} + +% A message to be logged when using a character that isn't available +% the default font encoding (OT1). +% +\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}} + +% Take account of \c (plain) vs. \, (Texinfo) difference. +\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi} + +% First, make active non-ASCII characters in order for them to be +% correctly categorized when TeX reads the replacement text of +% macros containing the character definitions. +\setnonasciicharscatcode\active +% +% Latin1 (ISO-8859-1) character definitions. +\def\latonechardefs{% + \gdef^^a0{\tie} + \gdef^^a1{\exclamdown} + \gdef^^a2{\missingcharmsg{CENT SIGN}} + \gdef^^a3{{\pounds}} + \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} + \gdef^^a5{\missingcharmsg{YEN SIGN}} + \gdef^^a6{\missingcharmsg{BROKEN BAR}} + \gdef^^a7{\S} + \gdef^^a8{\"{}} + \gdef^^a9{\copyright} + \gdef^^aa{\ordf} + \gdef^^ab{\guillemetleft} + \gdef^^ac{$\lnot$} + \gdef^^ad{\-} + \gdef^^ae{\registeredsymbol} + \gdef^^af{\={}} + % + \gdef^^b0{\textdegree} + \gdef^^b1{$\pm$} + \gdef^^b2{$^2$} + \gdef^^b3{$^3$} + \gdef^^b4{\'{}} + \gdef^^b5{$\mu$} + \gdef^^b6{\P} + % + \gdef^^b7{$^.$} + \gdef^^b8{\cedilla\ } + \gdef^^b9{$^1$} + \gdef^^ba{\ordm} + % + \gdef^^bb{\guillemetright} + \gdef^^bc{$1\over4$} + \gdef^^bd{$1\over2$} + \gdef^^be{$3\over4$} + \gdef^^bf{\questiondown} + % + \gdef^^c0{\`A} + \gdef^^c1{\'A} + \gdef^^c2{\^A} + \gdef^^c3{\~A} + \gdef^^c4{\"A} + \gdef^^c5{\ringaccent A} + \gdef^^c6{\AE} + \gdef^^c7{\cedilla C} + \gdef^^c8{\`E} + \gdef^^c9{\'E} + \gdef^^ca{\^E} + \gdef^^cb{\"E} + \gdef^^cc{\`I} + \gdef^^cd{\'I} + \gdef^^ce{\^I} + \gdef^^cf{\"I} + % + \gdef^^d0{\DH} + \gdef^^d1{\~N} + \gdef^^d2{\`O} + \gdef^^d3{\'O} + \gdef^^d4{\^O} + \gdef^^d5{\~O} + \gdef^^d6{\"O} + \gdef^^d7{$\times$} + \gdef^^d8{\O} + \gdef^^d9{\`U} + \gdef^^da{\'U} + \gdef^^db{\^U} + \gdef^^dc{\"U} + \gdef^^dd{\'Y} + \gdef^^de{\TH} + \gdef^^df{\ss} + % + \gdef^^e0{\`a} + \gdef^^e1{\'a} + \gdef^^e2{\^a} + \gdef^^e3{\~a} + \gdef^^e4{\"a} + \gdef^^e5{\ringaccent a} + \gdef^^e6{\ae} + \gdef^^e7{\cedilla c} + \gdef^^e8{\`e} + \gdef^^e9{\'e} + \gdef^^ea{\^e} + \gdef^^eb{\"e} + \gdef^^ec{\`{\dotless i}} + \gdef^^ed{\'{\dotless i}} + \gdef^^ee{\^{\dotless i}} + \gdef^^ef{\"{\dotless i}} + % + \gdef^^f0{\dh} + \gdef^^f1{\~n} + \gdef^^f2{\`o} + \gdef^^f3{\'o} + \gdef^^f4{\^o} + \gdef^^f5{\~o} + \gdef^^f6{\"o} + \gdef^^f7{$\div$} + \gdef^^f8{\o} + \gdef^^f9{\`u} + \gdef^^fa{\'u} + \gdef^^fb{\^u} + \gdef^^fc{\"u} + \gdef^^fd{\'y} + \gdef^^fe{\th} + \gdef^^ff{\"y} +} + +% Latin9 (ISO-8859-15) encoding character definitions. +\def\latninechardefs{% + % Encoding is almost identical to Latin1. + \latonechardefs + % + \gdef^^a4{\euro} + \gdef^^a6{\v S} + \gdef^^a8{\v s} + \gdef^^b4{\v Z} + \gdef^^b8{\v z} + \gdef^^bc{\OE} + \gdef^^bd{\oe} + \gdef^^be{\"Y} +} + +% Latin2 (ISO-8859-2) character definitions. +\def\lattwochardefs{% + \gdef^^a0{\tie} + \gdef^^a1{\ogonek{A}} + \gdef^^a2{\u{}} + \gdef^^a3{\L} + \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} + \gdef^^a5{\v L} + \gdef^^a6{\'S} + \gdef^^a7{\S} + \gdef^^a8{\"{}} + \gdef^^a9{\v S} + \gdef^^aa{\cedilla S} + \gdef^^ab{\v T} + \gdef^^ac{\'Z} + \gdef^^ad{\-} + \gdef^^ae{\v Z} + \gdef^^af{\dotaccent Z} + % + \gdef^^b0{\textdegree} + \gdef^^b1{\ogonek{a}} + \gdef^^b2{\ogonek{ }} + \gdef^^b3{\l} + \gdef^^b4{\'{}} + \gdef^^b5{\v l} + \gdef^^b6{\'s} + \gdef^^b7{\v{}} + \gdef^^b8{\cedilla\ } + \gdef^^b9{\v s} + \gdef^^ba{\cedilla s} + \gdef^^bb{\v t} + \gdef^^bc{\'z} + \gdef^^bd{\H{}} + \gdef^^be{\v z} + \gdef^^bf{\dotaccent z} + % + \gdef^^c0{\'R} + \gdef^^c1{\'A} + \gdef^^c2{\^A} + \gdef^^c3{\u A} + \gdef^^c4{\"A} + \gdef^^c5{\'L} + \gdef^^c6{\'C} + \gdef^^c7{\cedilla C} + \gdef^^c8{\v C} + \gdef^^c9{\'E} + \gdef^^ca{\ogonek{E}} + \gdef^^cb{\"E} + \gdef^^cc{\v E} + \gdef^^cd{\'I} + \gdef^^ce{\^I} + \gdef^^cf{\v D} + % + \gdef^^d0{\DH} + \gdef^^d1{\'N} + \gdef^^d2{\v N} + \gdef^^d3{\'O} + \gdef^^d4{\^O} + \gdef^^d5{\H O} + \gdef^^d6{\"O} + \gdef^^d7{$\times$} + \gdef^^d8{\v R} + \gdef^^d9{\ringaccent U} + \gdef^^da{\'U} + \gdef^^db{\H U} + \gdef^^dc{\"U} + \gdef^^dd{\'Y} + \gdef^^de{\cedilla T} + \gdef^^df{\ss} + % + \gdef^^e0{\'r} + \gdef^^e1{\'a} + \gdef^^e2{\^a} + \gdef^^e3{\u a} + \gdef^^e4{\"a} + \gdef^^e5{\'l} + \gdef^^e6{\'c} + \gdef^^e7{\cedilla c} + \gdef^^e8{\v c} + \gdef^^e9{\'e} + \gdef^^ea{\ogonek{e}} + \gdef^^eb{\"e} + \gdef^^ec{\v e} + \gdef^^ed{\'{\dotless{i}}} + \gdef^^ee{\^{\dotless{i}}} + \gdef^^ef{\v d} + % + \gdef^^f0{\dh} + \gdef^^f1{\'n} + \gdef^^f2{\v n} + \gdef^^f3{\'o} + \gdef^^f4{\^o} + \gdef^^f5{\H o} + \gdef^^f6{\"o} + \gdef^^f7{$\div$} + \gdef^^f8{\v r} + \gdef^^f9{\ringaccent u} + \gdef^^fa{\'u} + \gdef^^fb{\H u} + \gdef^^fc{\"u} + \gdef^^fd{\'y} + \gdef^^fe{\cedilla t} + \gdef^^ff{\dotaccent{}} +} + +% UTF-8 character definitions. +% +% This code to support UTF-8 is based on LaTeX's utf8.def, with some +% changes for Texinfo conventions. It is included here under the GPL by +% permission from Frank Mittelbach and the LaTeX team. +% +\newcount\countUTFx +\newcount\countUTFy +\newcount\countUTFz + +\gdef\UTFviiiTwoOctets#1#2{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\endcsname} +% +\gdef\UTFviiiThreeOctets#1#2#3{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname} +% +\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname} + +\gdef\UTFviiiDefined#1{% + \ifx #1\relax + \message{\linenumber Unicode char \string #1 not defined for Texinfo}% + \else + \expandafter #1% + \fi +} + +\begingroup + \catcode`\~13 + \catcode`\"12 + + \def\UTFviiiLoop{% + \global\catcode\countUTFx\active + \uccode`\~\countUTFx + \uppercase\expandafter{\UTFviiiTmp}% + \advance\countUTFx by 1 + \ifnum\countUTFx < \countUTFy + \expandafter\UTFviiiLoop + \fi} + + \countUTFx = "C2 + \countUTFy = "E0 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiTwoOctets\string~}} + \UTFviiiLoop + + \countUTFx = "E0 + \countUTFy = "F0 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiThreeOctets\string~}} + \UTFviiiLoop + + \countUTFx = "F0 + \countUTFy = "F4 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiFourOctets\string~}} + \UTFviiiLoop +\endgroup + +\begingroup + \catcode`\"=12 + \catcode`\<=12 + \catcode`\.=12 + \catcode`\,=12 + \catcode`\;=12 + \catcode`\!=12 + \catcode`\~=13 + + \gdef\DeclareUnicodeCharacter#1#2{% + \countUTFz = "#1\relax + %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}% + \begingroup + \parseXMLCharref + \def\UTFviiiTwoOctets##1##2{% + \csname u8:##1\string ##2\endcsname}% + \def\UTFviiiThreeOctets##1##2##3{% + \csname u8:##1\string ##2\string ##3\endcsname}% + \def\UTFviiiFourOctets##1##2##3##4{% + \csname u8:##1\string ##2\string ##3\string ##4\endcsname}% + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter + \gdef\UTFviiiTmp{#2}% + \endgroup} + + \gdef\parseXMLCharref{% + \ifnum\countUTFz < "A0\relax + \errhelp = \EMsimple + \errmessage{Cannot define Unicode char value < 00A0}% + \else\ifnum\countUTFz < "800\relax + \parseUTFviiiA,% + \parseUTFviiiB C\UTFviiiTwoOctets.,% + \else\ifnum\countUTFz < "10000\relax + \parseUTFviiiA;% + \parseUTFviiiA,% + \parseUTFviiiB E\UTFviiiThreeOctets.{,;}% + \else + \parseUTFviiiA;% + \parseUTFviiiA,% + \parseUTFviiiA!% + \parseUTFviiiB F\UTFviiiFourOctets.{!,;}% + \fi\fi\fi + } + + \gdef\parseUTFviiiA#1{% + \countUTFx = \countUTFz + \divide\countUTFz by 64 + \countUTFy = \countUTFz + \multiply\countUTFz by 64 + \advance\countUTFx by -\countUTFz + \advance\countUTFx by 128 + \uccode `#1\countUTFx + \countUTFz = \countUTFy} + + \gdef\parseUTFviiiB#1#2#3#4{% + \advance\countUTFz by "#10\relax + \uccode `#3\countUTFz + \uppercase{\gdef\UTFviiiTmp{#2#3#4}}} +\endgroup + +\def\utfeightchardefs{% + \DeclareUnicodeCharacter{00A0}{\tie} + \DeclareUnicodeCharacter{00A1}{\exclamdown} + \DeclareUnicodeCharacter{00A3}{\pounds} + \DeclareUnicodeCharacter{00A8}{\"{ }} + \DeclareUnicodeCharacter{00A9}{\copyright} + \DeclareUnicodeCharacter{00AA}{\ordf} + \DeclareUnicodeCharacter{00AB}{\guillemetleft} + \DeclareUnicodeCharacter{00AD}{\-} + \DeclareUnicodeCharacter{00AE}{\registeredsymbol} + \DeclareUnicodeCharacter{00AF}{\={ }} + + \DeclareUnicodeCharacter{00B0}{\ringaccent{ }} + \DeclareUnicodeCharacter{00B4}{\'{ }} + \DeclareUnicodeCharacter{00B8}{\cedilla{ }} + \DeclareUnicodeCharacter{00BA}{\ordm} + \DeclareUnicodeCharacter{00BB}{\guillemetright} + \DeclareUnicodeCharacter{00BF}{\questiondown} + + \DeclareUnicodeCharacter{00C0}{\`A} + \DeclareUnicodeCharacter{00C1}{\'A} + \DeclareUnicodeCharacter{00C2}{\^A} + \DeclareUnicodeCharacter{00C3}{\~A} + \DeclareUnicodeCharacter{00C4}{\"A} + \DeclareUnicodeCharacter{00C5}{\AA} + \DeclareUnicodeCharacter{00C6}{\AE} + \DeclareUnicodeCharacter{00C7}{\cedilla{C}} + \DeclareUnicodeCharacter{00C8}{\`E} + \DeclareUnicodeCharacter{00C9}{\'E} + \DeclareUnicodeCharacter{00CA}{\^E} + \DeclareUnicodeCharacter{00CB}{\"E} + \DeclareUnicodeCharacter{00CC}{\`I} + \DeclareUnicodeCharacter{00CD}{\'I} + \DeclareUnicodeCharacter{00CE}{\^I} + \DeclareUnicodeCharacter{00CF}{\"I} + + \DeclareUnicodeCharacter{00D0}{\DH} + \DeclareUnicodeCharacter{00D1}{\~N} + \DeclareUnicodeCharacter{00D2}{\`O} + \DeclareUnicodeCharacter{00D3}{\'O} + \DeclareUnicodeCharacter{00D4}{\^O} + \DeclareUnicodeCharacter{00D5}{\~O} + \DeclareUnicodeCharacter{00D6}{\"O} + \DeclareUnicodeCharacter{00D8}{\O} + \DeclareUnicodeCharacter{00D9}{\`U} + \DeclareUnicodeCharacter{00DA}{\'U} + \DeclareUnicodeCharacter{00DB}{\^U} + \DeclareUnicodeCharacter{00DC}{\"U} + \DeclareUnicodeCharacter{00DD}{\'Y} + \DeclareUnicodeCharacter{00DE}{\TH} + \DeclareUnicodeCharacter{00DF}{\ss} + + \DeclareUnicodeCharacter{00E0}{\`a} + \DeclareUnicodeCharacter{00E1}{\'a} + \DeclareUnicodeCharacter{00E2}{\^a} + \DeclareUnicodeCharacter{00E3}{\~a} + \DeclareUnicodeCharacter{00E4}{\"a} + \DeclareUnicodeCharacter{00E5}{\aa} + \DeclareUnicodeCharacter{00E6}{\ae} + \DeclareUnicodeCharacter{00E7}{\cedilla{c}} + \DeclareUnicodeCharacter{00E8}{\`e} + \DeclareUnicodeCharacter{00E9}{\'e} + \DeclareUnicodeCharacter{00EA}{\^e} + \DeclareUnicodeCharacter{00EB}{\"e} + \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}} + \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}} + \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}} + \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}} + + \DeclareUnicodeCharacter{00F0}{\dh} + \DeclareUnicodeCharacter{00F1}{\~n} + \DeclareUnicodeCharacter{00F2}{\`o} + \DeclareUnicodeCharacter{00F3}{\'o} + \DeclareUnicodeCharacter{00F4}{\^o} + \DeclareUnicodeCharacter{00F5}{\~o} + \DeclareUnicodeCharacter{00F6}{\"o} + \DeclareUnicodeCharacter{00F8}{\o} + \DeclareUnicodeCharacter{00F9}{\`u} + \DeclareUnicodeCharacter{00FA}{\'u} + \DeclareUnicodeCharacter{00FB}{\^u} + \DeclareUnicodeCharacter{00FC}{\"u} + \DeclareUnicodeCharacter{00FD}{\'y} + \DeclareUnicodeCharacter{00FE}{\th} + \DeclareUnicodeCharacter{00FF}{\"y} + + \DeclareUnicodeCharacter{0100}{\=A} + \DeclareUnicodeCharacter{0101}{\=a} + \DeclareUnicodeCharacter{0102}{\u{A}} + \DeclareUnicodeCharacter{0103}{\u{a}} + \DeclareUnicodeCharacter{0104}{\ogonek{A}} + \DeclareUnicodeCharacter{0105}{\ogonek{a}} + \DeclareUnicodeCharacter{0106}{\'C} + \DeclareUnicodeCharacter{0107}{\'c} + \DeclareUnicodeCharacter{0108}{\^C} + \DeclareUnicodeCharacter{0109}{\^c} + \DeclareUnicodeCharacter{0118}{\ogonek{E}} + \DeclareUnicodeCharacter{0119}{\ogonek{e}} + \DeclareUnicodeCharacter{010A}{\dotaccent{C}} + \DeclareUnicodeCharacter{010B}{\dotaccent{c}} + \DeclareUnicodeCharacter{010C}{\v{C}} + \DeclareUnicodeCharacter{010D}{\v{c}} + \DeclareUnicodeCharacter{010E}{\v{D}} + + \DeclareUnicodeCharacter{0112}{\=E} + \DeclareUnicodeCharacter{0113}{\=e} + \DeclareUnicodeCharacter{0114}{\u{E}} + \DeclareUnicodeCharacter{0115}{\u{e}} + \DeclareUnicodeCharacter{0116}{\dotaccent{E}} + \DeclareUnicodeCharacter{0117}{\dotaccent{e}} + \DeclareUnicodeCharacter{011A}{\v{E}} + \DeclareUnicodeCharacter{011B}{\v{e}} + \DeclareUnicodeCharacter{011C}{\^G} + \DeclareUnicodeCharacter{011D}{\^g} + \DeclareUnicodeCharacter{011E}{\u{G}} + \DeclareUnicodeCharacter{011F}{\u{g}} + + \DeclareUnicodeCharacter{0120}{\dotaccent{G}} + \DeclareUnicodeCharacter{0121}{\dotaccent{g}} + \DeclareUnicodeCharacter{0124}{\^H} + \DeclareUnicodeCharacter{0125}{\^h} + \DeclareUnicodeCharacter{0128}{\~I} + \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}} + \DeclareUnicodeCharacter{012A}{\=I} + \DeclareUnicodeCharacter{012B}{\={\dotless{i}}} + \DeclareUnicodeCharacter{012C}{\u{I}} + \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}} + + \DeclareUnicodeCharacter{0130}{\dotaccent{I}} + \DeclareUnicodeCharacter{0131}{\dotless{i}} + \DeclareUnicodeCharacter{0132}{IJ} + \DeclareUnicodeCharacter{0133}{ij} + \DeclareUnicodeCharacter{0134}{\^J} + \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}} + \DeclareUnicodeCharacter{0139}{\'L} + \DeclareUnicodeCharacter{013A}{\'l} + + \DeclareUnicodeCharacter{0141}{\L} + \DeclareUnicodeCharacter{0142}{\l} + \DeclareUnicodeCharacter{0143}{\'N} + \DeclareUnicodeCharacter{0144}{\'n} + \DeclareUnicodeCharacter{0147}{\v{N}} + \DeclareUnicodeCharacter{0148}{\v{n}} + \DeclareUnicodeCharacter{014C}{\=O} + \DeclareUnicodeCharacter{014D}{\=o} + \DeclareUnicodeCharacter{014E}{\u{O}} + \DeclareUnicodeCharacter{014F}{\u{o}} + + \DeclareUnicodeCharacter{0150}{\H{O}} + \DeclareUnicodeCharacter{0151}{\H{o}} + \DeclareUnicodeCharacter{0152}{\OE} + \DeclareUnicodeCharacter{0153}{\oe} + \DeclareUnicodeCharacter{0154}{\'R} + \DeclareUnicodeCharacter{0155}{\'r} + \DeclareUnicodeCharacter{0158}{\v{R}} + \DeclareUnicodeCharacter{0159}{\v{r}} + \DeclareUnicodeCharacter{015A}{\'S} + \DeclareUnicodeCharacter{015B}{\'s} + \DeclareUnicodeCharacter{015C}{\^S} + \DeclareUnicodeCharacter{015D}{\^s} + \DeclareUnicodeCharacter{015E}{\cedilla{S}} + \DeclareUnicodeCharacter{015F}{\cedilla{s}} + + \DeclareUnicodeCharacter{0160}{\v{S}} + \DeclareUnicodeCharacter{0161}{\v{s}} + \DeclareUnicodeCharacter{0162}{\cedilla{t}} + \DeclareUnicodeCharacter{0163}{\cedilla{T}} + \DeclareUnicodeCharacter{0164}{\v{T}} + + \DeclareUnicodeCharacter{0168}{\~U} + \DeclareUnicodeCharacter{0169}{\~u} + \DeclareUnicodeCharacter{016A}{\=U} + \DeclareUnicodeCharacter{016B}{\=u} + \DeclareUnicodeCharacter{016C}{\u{U}} + \DeclareUnicodeCharacter{016D}{\u{u}} + \DeclareUnicodeCharacter{016E}{\ringaccent{U}} + \DeclareUnicodeCharacter{016F}{\ringaccent{u}} + + \DeclareUnicodeCharacter{0170}{\H{U}} + \DeclareUnicodeCharacter{0171}{\H{u}} + \DeclareUnicodeCharacter{0174}{\^W} + \DeclareUnicodeCharacter{0175}{\^w} + \DeclareUnicodeCharacter{0176}{\^Y} + \DeclareUnicodeCharacter{0177}{\^y} + \DeclareUnicodeCharacter{0178}{\"Y} + \DeclareUnicodeCharacter{0179}{\'Z} + \DeclareUnicodeCharacter{017A}{\'z} + \DeclareUnicodeCharacter{017B}{\dotaccent{Z}} + \DeclareUnicodeCharacter{017C}{\dotaccent{z}} + \DeclareUnicodeCharacter{017D}{\v{Z}} + \DeclareUnicodeCharacter{017E}{\v{z}} + + \DeclareUnicodeCharacter{01C4}{D\v{Z}} + \DeclareUnicodeCharacter{01C5}{D\v{z}} + \DeclareUnicodeCharacter{01C6}{d\v{z}} + \DeclareUnicodeCharacter{01C7}{LJ} + \DeclareUnicodeCharacter{01C8}{Lj} + \DeclareUnicodeCharacter{01C9}{lj} + \DeclareUnicodeCharacter{01CA}{NJ} + \DeclareUnicodeCharacter{01CB}{Nj} + \DeclareUnicodeCharacter{01CC}{nj} + \DeclareUnicodeCharacter{01CD}{\v{A}} + \DeclareUnicodeCharacter{01CE}{\v{a}} + \DeclareUnicodeCharacter{01CF}{\v{I}} + + \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}} + \DeclareUnicodeCharacter{01D1}{\v{O}} + \DeclareUnicodeCharacter{01D2}{\v{o}} + \DeclareUnicodeCharacter{01D3}{\v{U}} + \DeclareUnicodeCharacter{01D4}{\v{u}} + + \DeclareUnicodeCharacter{01E2}{\={\AE}} + \DeclareUnicodeCharacter{01E3}{\={\ae}} + \DeclareUnicodeCharacter{01E6}{\v{G}} + \DeclareUnicodeCharacter{01E7}{\v{g}} + \DeclareUnicodeCharacter{01E8}{\v{K}} + \DeclareUnicodeCharacter{01E9}{\v{k}} + + \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}} + \DeclareUnicodeCharacter{01F1}{DZ} + \DeclareUnicodeCharacter{01F2}{Dz} + \DeclareUnicodeCharacter{01F3}{dz} + \DeclareUnicodeCharacter{01F4}{\'G} + \DeclareUnicodeCharacter{01F5}{\'g} + \DeclareUnicodeCharacter{01F8}{\`N} + \DeclareUnicodeCharacter{01F9}{\`n} + \DeclareUnicodeCharacter{01FC}{\'{\AE}} + \DeclareUnicodeCharacter{01FD}{\'{\ae}} + \DeclareUnicodeCharacter{01FE}{\'{\O}} + \DeclareUnicodeCharacter{01FF}{\'{\o}} + + \DeclareUnicodeCharacter{021E}{\v{H}} + \DeclareUnicodeCharacter{021F}{\v{h}} + + \DeclareUnicodeCharacter{0226}{\dotaccent{A}} + \DeclareUnicodeCharacter{0227}{\dotaccent{a}} + \DeclareUnicodeCharacter{0228}{\cedilla{E}} + \DeclareUnicodeCharacter{0229}{\cedilla{e}} + \DeclareUnicodeCharacter{022E}{\dotaccent{O}} + \DeclareUnicodeCharacter{022F}{\dotaccent{o}} + + \DeclareUnicodeCharacter{0232}{\=Y} + \DeclareUnicodeCharacter{0233}{\=y} + \DeclareUnicodeCharacter{0237}{\dotless{j}} + + \DeclareUnicodeCharacter{02DB}{\ogonek{ }} + + \DeclareUnicodeCharacter{1E02}{\dotaccent{B}} + \DeclareUnicodeCharacter{1E03}{\dotaccent{b}} + \DeclareUnicodeCharacter{1E04}{\udotaccent{B}} + \DeclareUnicodeCharacter{1E05}{\udotaccent{b}} + \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}} + \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}} + \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}} + \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}} + \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}} + \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}} + \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}} + \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}} + + \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}} + \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}} + + \DeclareUnicodeCharacter{1E20}{\=G} + \DeclareUnicodeCharacter{1E21}{\=g} + \DeclareUnicodeCharacter{1E22}{\dotaccent{H}} + \DeclareUnicodeCharacter{1E23}{\dotaccent{h}} + \DeclareUnicodeCharacter{1E24}{\udotaccent{H}} + \DeclareUnicodeCharacter{1E25}{\udotaccent{h}} + \DeclareUnicodeCharacter{1E26}{\"H} + \DeclareUnicodeCharacter{1E27}{\"h} + + \DeclareUnicodeCharacter{1E30}{\'K} + \DeclareUnicodeCharacter{1E31}{\'k} + \DeclareUnicodeCharacter{1E32}{\udotaccent{K}} + \DeclareUnicodeCharacter{1E33}{\udotaccent{k}} + \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}} + \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}} + \DeclareUnicodeCharacter{1E36}{\udotaccent{L}} + \DeclareUnicodeCharacter{1E37}{\udotaccent{l}} + \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}} + \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}} + \DeclareUnicodeCharacter{1E3E}{\'M} + \DeclareUnicodeCharacter{1E3F}{\'m} + + \DeclareUnicodeCharacter{1E40}{\dotaccent{M}} + \DeclareUnicodeCharacter{1E41}{\dotaccent{m}} + \DeclareUnicodeCharacter{1E42}{\udotaccent{M}} + \DeclareUnicodeCharacter{1E43}{\udotaccent{m}} + \DeclareUnicodeCharacter{1E44}{\dotaccent{N}} + \DeclareUnicodeCharacter{1E45}{\dotaccent{n}} + \DeclareUnicodeCharacter{1E46}{\udotaccent{N}} + \DeclareUnicodeCharacter{1E47}{\udotaccent{n}} + \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}} + \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}} + + \DeclareUnicodeCharacter{1E54}{\'P} + \DeclareUnicodeCharacter{1E55}{\'p} + \DeclareUnicodeCharacter{1E56}{\dotaccent{P}} + \DeclareUnicodeCharacter{1E57}{\dotaccent{p}} + \DeclareUnicodeCharacter{1E58}{\dotaccent{R}} + \DeclareUnicodeCharacter{1E59}{\dotaccent{r}} + \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}} + \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}} + \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}} + \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}} + + \DeclareUnicodeCharacter{1E60}{\dotaccent{S}} + \DeclareUnicodeCharacter{1E61}{\dotaccent{s}} + \DeclareUnicodeCharacter{1E62}{\udotaccent{S}} + \DeclareUnicodeCharacter{1E63}{\udotaccent{s}} + \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}} + \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}} + \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}} + \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}} + \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}} + \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}} + + \DeclareUnicodeCharacter{1E7C}{\~V} + \DeclareUnicodeCharacter{1E7D}{\~v} + \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}} + \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}} + + \DeclareUnicodeCharacter{1E80}{\`W} + \DeclareUnicodeCharacter{1E81}{\`w} + \DeclareUnicodeCharacter{1E82}{\'W} + \DeclareUnicodeCharacter{1E83}{\'w} + \DeclareUnicodeCharacter{1E84}{\"W} + \DeclareUnicodeCharacter{1E85}{\"w} + \DeclareUnicodeCharacter{1E86}{\dotaccent{W}} + \DeclareUnicodeCharacter{1E87}{\dotaccent{w}} + \DeclareUnicodeCharacter{1E88}{\udotaccent{W}} + \DeclareUnicodeCharacter{1E89}{\udotaccent{w}} + \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}} + \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}} + \DeclareUnicodeCharacter{1E8C}{\"X} + \DeclareUnicodeCharacter{1E8D}{\"x} + \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}} + \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}} + + \DeclareUnicodeCharacter{1E90}{\^Z} + \DeclareUnicodeCharacter{1E91}{\^z} + \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}} + \DeclareUnicodeCharacter{1E93}{\udotaccent{z}} + \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}} + \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}} + \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}} + \DeclareUnicodeCharacter{1E97}{\"t} + \DeclareUnicodeCharacter{1E98}{\ringaccent{w}} + \DeclareUnicodeCharacter{1E99}{\ringaccent{y}} + + \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}} + \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}} + + \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}} + \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}} + \DeclareUnicodeCharacter{1EBC}{\~E} + \DeclareUnicodeCharacter{1EBD}{\~e} + + \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}} + \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}} + \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}} + \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}} + + \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}} + \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}} + + \DeclareUnicodeCharacter{1EF2}{\`Y} + \DeclareUnicodeCharacter{1EF3}{\`y} + \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}} + + \DeclareUnicodeCharacter{1EF8}{\~Y} + \DeclareUnicodeCharacter{1EF9}{\~y} + + \DeclareUnicodeCharacter{2013}{--} + \DeclareUnicodeCharacter{2014}{---} + \DeclareUnicodeCharacter{2018}{\quoteleft} + \DeclareUnicodeCharacter{2019}{\quoteright} + \DeclareUnicodeCharacter{201A}{\quotesinglbase} + \DeclareUnicodeCharacter{201C}{\quotedblleft} + \DeclareUnicodeCharacter{201D}{\quotedblright} + \DeclareUnicodeCharacter{201E}{\quotedblbase} + \DeclareUnicodeCharacter{2022}{\bullet} + \DeclareUnicodeCharacter{2026}{\dots} + \DeclareUnicodeCharacter{2039}{\guilsinglleft} + \DeclareUnicodeCharacter{203A}{\guilsinglright} + \DeclareUnicodeCharacter{20AC}{\euro} + + \DeclareUnicodeCharacter{2192}{\expansion} + \DeclareUnicodeCharacter{21D2}{\result} + + \DeclareUnicodeCharacter{2212}{\minus} + \DeclareUnicodeCharacter{2217}{\point} + \DeclareUnicodeCharacter{2261}{\equiv} +}% end of \utfeightchardefs + + +% US-ASCII character definitions. +\def\asciichardefs{% nothing need be done + \relax +} + +% Make non-ASCII characters printable again for compatibility with +% existing Texinfo documents that may use them, even without declaring a +% document encoding. +% +\setnonasciicharscatcode \other + + +\message{formatting,} + +\newdimen\defaultparindent \defaultparindent = 15pt + +\chapheadingskip = 15pt plus 4pt minus 2pt +\secheadingskip = 12pt plus 3pt minus 2pt +\subsecheadingskip = 9pt plus 2pt minus 2pt + +% Prevent underfull vbox error messages. +\vbadness = 10000 + +% Don't be very finicky about underfull hboxes, either. +\hbadness = 6666 + +% Following George Bush, get rid of widows and orphans. +\widowpenalty=10000 +\clubpenalty=10000 + +% Use TeX 3.0's \emergencystretch to help line breaking, but if we're +% using an old version of TeX, don't do anything. We want the amount of +% stretch added to depend on the line length, hence the dependence on +% \hsize. We call this whenever the paper size is set. +% +\def\setemergencystretch{% + \ifx\emergencystretch\thisisundefined + % Allow us to assign to \emergencystretch anyway. + \def\emergencystretch{\dimen0}% + \else + \emergencystretch = .15\hsize + \fi +} + +% Parameters in order: 1) textheight; 2) textwidth; +% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; +% 7) physical page height; 8) physical page width. +% +% We also call \setleading{\textleading}, so the caller should define +% \textleading. The caller should also set \parskip. +% +\def\internalpagesizes#1#2#3#4#5#6#7#8{% + \voffset = #3\relax + \topskip = #6\relax + \splittopskip = \topskip + % + \vsize = #1\relax + \advance\vsize by \topskip + \outervsize = \vsize + \advance\outervsize by 2\topandbottommargin + \pageheight = \vsize + % + \hsize = #2\relax + \outerhsize = \hsize + \advance\outerhsize by 0.5in + \pagewidth = \hsize + % + \normaloffset = #4\relax + \bindingoffset = #5\relax + % + \ifpdf + \pdfpageheight #7\relax + \pdfpagewidth #8\relax + % if we don't reset these, they will remain at "1 true in" of + % whatever layout pdftex was dumped with. + \pdfhorigin = 1 true in + \pdfvorigin = 1 true in + \fi + % + \setleading{\textleading} + % + \parindent = \defaultparindent + \setemergencystretch +} + +% @letterpaper (the default). +\def\letterpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % If page is nothing but text, make it come out even. + \internalpagesizes{607.2pt}{6in}% that's 46 lines + {\voffset}{.25in}% + {\bindingoffset}{36pt}% + {11in}{8.5in}% +}} + +% Use @smallbook to reset parameters for 7x9.25 trim size. +\def\smallbook{{\globaldefs = 1 + \parskip = 2pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.5in}{5in}% + {-.2in}{0in}% + {\bindingoffset}{16pt}% + {9.25in}{7in}% + % + \lispnarrowing = 0.3in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .5cm +}} + +% Use @smallerbook to reset parameters for 6x9 trim size. +% (Just testing, parameters still in flux.) +\def\smallerbook{{\globaldefs = 1 + \parskip = 1.5pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.4in}{4.8in}% + {-.2in}{-.4in}% + {0pt}{14pt}% + {9in}{6in}% + % + \lispnarrowing = 0.25in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .4cm +}} + +% Use @afourpaper to print on European A4 paper. +\def\afourpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % Double-side printing via postscript on Laserjet 4050 + % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. + % To change the settings for a different printer or situation, adjust + % \normaloffset until the front-side and back-side texts align. Then + % do the same for \bindingoffset. You can set these for testing in + % your texinfo source file like this: + % @tex + % \global\normaloffset = -6mm + % \global\bindingoffset = 10mm + % @end tex + \internalpagesizes{673.2pt}{160mm}% that's 51 lines + {\voffset}{\hoffset}% + {\bindingoffset}{44pt}% + {297mm}{210mm}% + % + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = 5mm +}} + +% Use @afivepaper to print on European A5 paper. +% From romildo@urano.iceb.ufop.br, 2 July 2000. +% He also recommends making @example and @lisp be small. +\def\afivepaper{{\globaldefs = 1 + \parskip = 2pt plus 1pt minus 0.1pt + \textleading = 12.5pt + % + \internalpagesizes{160mm}{120mm}% + {\voffset}{\hoffset}% + {\bindingoffset}{8pt}% + {210mm}{148mm}% + % + \lispnarrowing = 0.2in + \tolerance = 800 + \hfuzz = 1.2pt + \contentsrightmargin = 0pt + \defbodyindent = 2mm + \tableindent = 12mm +}} + +% A specific text layout, 24x15cm overall, intended for A4 paper. +\def\afourlatex{{\globaldefs = 1 + \afourpaper + \internalpagesizes{237mm}{150mm}% + {\voffset}{4.6mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + % + % Must explicitly reset to 0 because we call \afourpaper. + \globaldefs = 0 +}} + +% Use @afourwide to print on A4 paper in landscape format. +\def\afourwide{{\globaldefs = 1 + \afourpaper + \internalpagesizes{241mm}{165mm}% + {\voffset}{-2.95mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + \globaldefs = 0 +}} + +% @pagesizes TEXTHEIGHT[,TEXTWIDTH] +% Perhaps we should allow setting the margins, \topskip, \parskip, +% and/or leading, also. Or perhaps we should compute them somehow. +% +\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} +\def\pagesizesyyy#1,#2,#3\finish{{% + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi + \globaldefs = 1 + % + \parskip = 3pt plus 2pt minus 1pt + \setleading{\textleading}% + % + \dimen0 = #1\relax + \advance\dimen0 by \voffset + % + \dimen2 = \hsize + \advance\dimen2 by \normaloffset + % + \internalpagesizes{#1}{\hsize}% + {\voffset}{\normaloffset}% + {\bindingoffset}{44pt}% + {\dimen0}{\dimen2}% +}} + +% Set default to letter. +% +\letterpaper + + +\message{and turning on texinfo input format.} + +\def^^L{\par} % remove \outer, so ^L can appear in an @comment + +% DEL is a comment character, in case @c does not suffice. +\catcode`\^^? = 14 + +% Define macros to output various characters with catcode for normal text. +\catcode`\"=\other \def\normaldoublequote{"} +\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix +\catcode`\+=\other \def\normalplus{+} +\catcode`\<=\other \def\normalless{<} +\catcode`\>=\other \def\normalgreater{>} +\catcode`\^=\other \def\normalcaret{^} +\catcode`\_=\other \def\normalunderscore{_} +\catcode`\|=\other \def\normalverticalbar{|} +\catcode`\~=\other \def\normaltilde{~} + +% This macro is used to make a character print one way in \tt +% (where it can probably be output as-is), and another way in other fonts, +% where something hairier probably needs to be done. +% +% #1 is what to print if we are indeed using \tt; #2 is what to print +% otherwise. Since all the Computer Modern typewriter fonts have zero +% interword stretch (and shrink), and it is reasonable to expect all +% typewriter fonts to have this, we can check that font parameter. +% +\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} + +% Same as above, but check for italic font. Actually this also catches +% non-italic slanted fonts since it is impossible to distinguish them from +% italic fonts. But since this is only used by $ and it uses \sl anyway +% this is not a problem. +\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} + +% Turn off all special characters except @ +% (and those which the user can use as if they were ordinary). +% Most of these we simply print from the \tt font, but for some, we can +% use math or other variants that look better in normal text. + +\catcode`\"=\active +\def\activedoublequote{{\tt\char34}} +\let"=\activedoublequote +\catcode`\~=\active +\def~{{\tt\char126}} +\chardef\hat=`\^ +\catcode`\^=\active +\def^{{\tt \hat}} + +\catcode`\_=\active +\def_{\ifusingtt\normalunderscore\_} +\let\realunder=_ +% Subroutine for the previous macro. +\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } + +\catcode`\|=\active +\def|{{\tt\char124}} +\chardef \less=`\< +\catcode`\<=\active +\def<{{\tt \less}} +\chardef \gtr=`\> +\catcode`\>=\active +\def>{{\tt \gtr}} +\catcode`\+=\active +\def+{{\tt \char 43}} +\catcode`\$=\active +\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix + +% If a .fmt file is being used, characters that might appear in a file +% name cannot be active until we have parsed the command line. +% So turn them off again, and have \everyjob (or @setfilename) turn them on. +% \otherifyactive is called near the end of this file. +\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} + +% Used sometimes to turn off (effectively) the active characters even after +% parsing them. +\def\turnoffactive{% + \normalturnoffactive + \otherbackslash +} + +\catcode`\@=0 + +% \backslashcurfont outputs one backslash character in current font, +% as in \char`\\. +\global\chardef\backslashcurfont=`\\ +\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work + +% \realbackslash is an actual character `\' with catcode other, and +% \doublebackslash is two of them (for the pdf outlines). +{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} + +% In texinfo, backslash is an active character; it prints the backslash +% in fixed width font. +\catcode`\\=\active +@def@normalbackslash{{@tt@backslashcurfont}} +% On startup, @fixbackslash assigns: +% @let \ = @normalbackslash + +% \rawbackslash defines an active \ to do \backslashcurfont. +% \otherbackslash defines an active \ to be a literal `\' character with +% catcode other. +@gdef@rawbackslash{@let\=@backslashcurfont} +@gdef@otherbackslash{@let\=@realbackslash} + +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of +% the literal character `\'. +% +@def@normalturnoffactive{% + @let"=@normaldoublequote + @let$=@normaldollar %$ font-lock fix + @let+=@normalplus + @let<=@normalless + @let>=@normalgreater + @let\=@normalbackslash + @let^=@normalcaret + @let_=@normalunderscore + @let|=@normalverticalbar + @let~=@normaltilde + @markupsetuplqdefault + @markupsetuprqdefault + @unsepspaces +} + +% Make _ and + \other characters, temporarily. +% This is canceled by @fixbackslash. +@otherifyactive + +% If a .fmt file is being used, we don't want the `\input texinfo' to show up. +% That is what \eatinput is for; after that, the `\' should revert to printing +% a backslash. +% +@gdef@eatinput input texinfo{@fixbackslash} +@global@let\ = @eatinput + +% On the other hand, perhaps the file did not have a `\input texinfo'. Then +% the first `\' in the file would cause an error. This macro tries to fix +% that, assuming it is called before the first `\' could plausibly occur. +% Also turn back on active characters that might appear in the input +% file name, in case not using a pre-dumped format. +% +@gdef@fixbackslash{% + @ifx\@eatinput @let\ = @normalbackslash @fi + @catcode`+=@active + @catcode`@_=@active +} + +% Say @foo, not \foo, in error messages. +@escapechar = `@@ + +% These (along with & and #) are made active for url-breaking, so need +% active definitions as the normal characters. +@def@normaldot{.} +@def@normalquest{?} +@def@normalslash{/} + +% These look ok in all fonts, so just make them not special. +@catcode`@& = @other @def@normalamp{&} +@catcode`@# = @other @def@normalhash{#} +@catcode`@% = @other @def@normalpercent{%} + +@c Finally, make ` and ' active, so that txicodequoteundirected and +@c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we +@c don't make ` and ' active, @code will not get them as active chars. +@c Do this last of all since we use ` in the previous @catcode assignments. +@catcode`@'=@active +@catcode`@`=@active +@markupsetuplqdefault +@markupsetuprqdefault + +@c Local variables: +@c eval: (add-hook 'write-file-hooks 'time-stamp) +@c page-delimiter: "^\\\\message" +@c time-stamp-start: "def\\\\texinfoversion{" +@c time-stamp-format: "%:y-%02m-%02d.%02H" +@c time-stamp-end: "}" +@c End: + +@c vim:sw=2: + +@ignore + arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 +@end ignore diff --git a/vendor/unuran-1.11.0/doc/src/top.dh b/vendor/unuran-1.11.0/doc/src/top.dh new file mode 100644 index 0000000..9e94964 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/top.dh @@ -0,0 +1,154 @@ + +=TOP TOP UNU.RAN -- Universal Non-Uniform RANdom number generators + +=UP (dir) + +=DESCRIPTION + @ifinfo + @noindent + This is the online-documentation of UNU.RAN.@* + Version: @value{VERSION}@* + Date: @value{UPDATED} + @end ifinfo + + + UNU.RAN (Universal Non-Uniform RAndom Number generator) is + a collection of algorithms for generating non-uniform + pseudorandom variates as a library of C functions + designed and implemented by the ARVAG (Automatic Random VAriate + Generation) project group in Vienna, and + released under the GNU Public License (GPL). + It is especially designed for such situations where + + @itemize @minus + @item a non-standard distribution or a truncated distribution is + needed. + + @item experiments with different types of distributions are made. + + @item random variates for variance reduction techniques are used. + + @item fast generators of predictable quality are necessary. + + @end itemize + + Of course it is also well suited for standard distributions. + However due to its more sophisticated programming interface it + might not be as easy to use if you only look for a generator for + the standard normal distribution. (Although UNU.RAN provides + generators that are superior in many aspects to those found in + quite a number of other libraries.) + + + + UNU.RAN implements several methods for generating random numbers. + The choice depends primary on the information about the + distribution can be provided and -- if the user is familar with + the different methods -- on the preferences of the user. + + The design goals of UNU.RAN are to provide @emph{reliable}, + @emph{portable} and @emph{robust} (as far as this is possible) + functions with a consisent and easy to use interface. It is + suitable for all situation where experiments with different + distributions including non-standard distributions. + For example it is no problem to replace the normal distribution + by an empirical distribution in a model. + + Since originally designed as a library for so called black-box or + universal algorithms its interface is different from other + libraries. (Nevertheless it also contains special generators for + standard distributions.) It does not provide subroutines for + random variate generation for particular distributions. Instead + it uses an object-oriented interface. Distributions and + generators are treated as independent objects. This approach + allows one not only to have different methods for generating + non-uniform random variates. It is also possible to choose the + method which is optimal for a given situation (e.g. speed, quality + of random numbers, using for variance reduction techniques, + etc.). It also allows to sample from non-standard distribution or + even from distributions that arise in a model and can only be + computed in a complicated subroutine. + + Sampling from a particular distribution requires the following steps: + + @enumerate + @item + Create a distribution object. + (Objects for standard distributions are available in the library) + + @item + Choose a method. + + @item + Initialize the generator, i.e., create the generator object. + If the choosen method is not suitable for the given distribution + (or if the distribution object contains too little information + about the distribution) the initialization routine fails and + produces an error message. Thus the generator object does + (probably) not produce false results (random variates of a + different distribution). + + @item + Use this generator object to sample from the distribution. + + @end enumerate + + There are four types of objects that can be manipulated + independently: + + @itemize @bullet + + @item + @strong{Distribution objects:} + hold all information about the random variates that should be + generated. The following types of distributions are available: + + @itemize @minus + @item + Continuous and Discrete distributions + @item + Empirical distributions + @item + Multivariate distributions + @end itemize + + Of course a library of standard distributions is included + (and these can be further modified to get, e.g., truncated + distributions). Moreover the library provides subroutines to + build almost arbitrary distributions. + + @item + @strong{Generator objects:} + hold the generators for the given distributions. It is possible + to build independent generator objects for the same distribution + object which might use the same or different methods for + generation. (If the choosen method is not suitable for the given + method, a NULL pointer is returned in the initialization step). + + @item + @strong{Parameter objects:} + Each transformation method requires several parameters to adjust + the generator to a given distribution. The parameter object holds + all this information. When created it contains all necessary + default settings. It is only used to create a generator object + and destroyed immediately. Altough there is no need to change + these parameters or even know about their existence for ``usual + distributions'', they allow a fine tuning of the generator to + work with distributions with some awkward properties. The library + provides all necessary functions to change these default + parameters. + + @item + @strong{Uniform Random Number Generators:} + All generator objects need one (or more) streams of uniform + random numbers that are transformed into random variates of the + given distribution. These are given as pointers to appropriate + functions or structures (objects). Two generator objects may have + their own uniform random number generators or share a common + one. Any functions that produce uniform (pseudo-) random numbers + can be used. We suggest Otmar Lendl's PRNG library. + + @end itemize + +=EON + diff --git a/vendor/unuran-1.11.0/doc/src/unuran_src.texi b/vendor/unuran-1.11.0/doc/src/unuran_src.texi new file mode 100644 index 0000000..c93d7c3 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/src/unuran_src.texi @@ -0,0 +1,34542 @@ +@c automatically generated by `make_texi.pl' + +@c ------------------------------------- +@c top.dh +@c + +@node TOP +@top UNU.RAN -- Universal Non-Uniform RANdom number generators + +@menu +* Intro:: Introduction +* Examples:: Examples +* StringAPI:: String Interface +* Distribution_objects:: Handling distribution objects +* Methods:: Methods for generating non-uniform random variates +* URNG:: Using uniform random number generators +* Stddist:: UNU.RAN Library of standard distributions +* Error_Debug:: Error handling and Debugging +* Testing:: Testing +* Misc:: Miscelleanous +* RVG:: A Short Introduction to Random Variate Generation +* Glossary:: Glossary +* Bibliography:: Bibliography +* FIndex:: Function Index +@end menu + + +@ifinfo +@noindent +This is the online-documentation of UNU.RAN.@* +Version: @value{VERSION}@* +Date: @value{UPDATED} +@end ifinfo + + +UNU.RAN (Universal Non-Uniform RAndom Number generator) is +a collection of algorithms for generating non-uniform +pseudorandom variates as a library of C functions +designed and implemented by the ARVAG (Automatic Random VAriate +Generation) project group in Vienna, and +released under the GNU Public License (GPL). +It is especially designed for such situations where + +@itemize @minus +@item a non-standard distribution or a truncated distribution is +needed. + +@item experiments with different types of distributions are made. + +@item random variates for variance reduction techniques are used. + +@item fast generators of predictable quality are necessary. + +@end itemize + +Of course it is also well suited for standard distributions. +However due to its more sophisticated programming interface it +might not be as easy to use if you only look for a generator for +the standard normal distribution. (Although UNU.RAN provides +generators that are superior in many aspects to those found in +quite a number of other libraries.) + + + +UNU.RAN implements several methods for generating random numbers. +The choice depends primary on the information about the +distribution can be provided and -- if the user is familar with +the different methods -- on the preferences of the user. + +The design goals of UNU.RAN are to provide @emph{reliable}, +@emph{portable} and @emph{robust} (as far as this is possible) +functions with a consisent and easy to use interface. It is +suitable for all situation where experiments with different +distributions including non-standard distributions. +For example it is no problem to replace the normal distribution +by an empirical distribution in a model. + +Since originally designed as a library for so called black-box or +universal algorithms its interface is different from other +libraries. (Nevertheless it also contains special generators for +standard distributions.) It does not provide subroutines for +random variate generation for particular distributions. Instead +it uses an object-oriented interface. Distributions and +generators are treated as independent objects. This approach +allows one not only to have different methods for generating +non-uniform random variates. It is also possible to choose the +method which is optimal for a given situation (e.g. speed, quality +of random numbers, using for variance reduction techniques, +etc.). It also allows to sample from non-standard distribution or +even from distributions that arise in a model and can only be +computed in a complicated subroutine. + +Sampling from a particular distribution requires the following steps: + +@enumerate +@item +Create a distribution object. +(Objects for standard distributions are available in the library) + +@item +Choose a method. + +@item +Initialize the generator, i.e., create the generator object. +If the choosen method is not suitable for the given distribution +(or if the distribution object contains too little information +about the distribution) the initialization routine fails and +produces an error message. Thus the generator object does +(probably) not produce false results (random variates of a +different distribution). + +@item +Use this generator object to sample from the distribution. + +@end enumerate + +There are four types of objects that can be manipulated +independently: + +@itemize @bullet + +@item +@strong{Distribution objects:} +hold all information about the random variates that should be +generated. The following types of distributions are available: + +@itemize @minus +@item +Continuous and Discrete distributions +@item +Empirical distributions +@item +Multivariate distributions +@end itemize + +Of course a library of standard distributions is included +(and these can be further modified to get, e.g., truncated +distributions). Moreover the library provides subroutines to +build almost arbitrary distributions. + +@item +@strong{Generator objects:} +hold the generators for the given distributions. It is possible +to build independent generator objects for the same distribution +object which might use the same or different methods for +generation. (If the choosen method is not suitable for the given +method, a @code{NULL} pointer is returned in the initialization step). + +@item +@strong{Parameter objects:} +Each transformation method requires several parameters to adjust +the generator to a given distribution. The parameter object holds +all this information. When created it contains all necessary +default settings. It is only used to create a generator object +and destroyed immediately. Altough there is no need to change +these parameters or even know about their existence for ``usual +distributions'', they allow a fine tuning of the generator to +work with distributions with some awkward properties. The library +provides all necessary functions to change these default +parameters. + +@item +@strong{Uniform Random Number Generators:} +All generator objects need one (or more) streams of uniform +random numbers that are transformed into random variates of the +given distribution. These are given as pointers to appropriate +functions or structures (objects). Two generator objects may have +their own uniform random number generators or share a common +one. Any functions that produce uniform (pseudo-) random numbers +can be used. We suggest Otmar Lendl's PRNG library. + +@end itemize + + + +@c +@c end of top.dh +@c ------------------------------------- +@c ------------------------------------- +@c intro.dh +@c + +@node Intro +@chapter Introduction + +@menu +* UsageDoc:: Usage of this document +* Installation:: Installation +* UsageLib:: Using the library +* Concepts:: Concepts of UNU.RAN +* Contact:: Contact the authors +@end menu + + +@c +@c end of intro.dh +@c ------------------------------------- +@c ------------------------------------- +@c intro.dh +@c + +@node UsageDoc +@section Usage of this document + + +We designed this document in a way such that one can +use UNU.RAN with reading as little as necessary. +Read @ref{Installation} for the instructions to +install the library. +@ref{Concepts,,Concepts of UNU.RAN}, +discribes the basics of UNU.RAN. +It also has a short guideline for choosing an appropriate method. +In @ref{Examples} examples are given that can be copied and modified. +They also can be found in the directory @file{examples} in the +source tree. + +Further information are given in consecutive chapters. +@ref{Distribution_objects,,Handling distribution objects}, +describes how to create and manipulate distribution objects. +@ref{Stddist,,standard distributions}, +describes predefined distribution objects that are ready to use. +@ref{Methods} describes the various methods in detail. +For each of possible distribution classes +(continuous, discrete, empirical, multivariate) +there exists a short overview section that can be used to choose an +appropriate method followed by sections that describe each of the +particular methods in detail. +These are merely for users with some knowledge about +the methods who want to change method-specific parameters and can +be ignored by others. + +Abbreviations and explanation of some basic terms can be found in +@ref{Glossary}. + + +@c +@c end of intro.dh +@c ------------------------------------- +@c ------------------------------------- +@c installation.dh +@c + +@node Installation +@section Installation + + +UNU.RAN was developed on an Intel architecture under Linux with +the GNU C compiler but should compile and run on any computing +environment. It requires an ANSI compliant C compiler. + +Below find the installation instructions for unices. + + +@subsubheading Uniform random number generator + +UNU.RAN can be used with any uniform random number generator but (at the +moment) some features work best with Pierre L'Ecuyer's RngStreams library +(see @url{http://statmath.wu.ac.at/software/RngStreams/} for a +description and downloading. +For details on using uniform random number in UNU.RAN +see @ref{URNG,,Using uniform random number generators}. + +Install the required libraries first. + + +@subsubheading UNU.RAN + +@enumerate + +@item First unzip and untar the package and change to the directory: + +@example +tar zxvf unuran-@value{VERSION}.tar.gz +cd unuran-@value{VERSION} +@end example + +@item Optional: Edit the file @file{src/unuran_config.h} + +@item Run a configuration script: + +@example +sh ./configure --prefix= +@end example + +@noindent +where @code{} is the root of the installation tree. +When omitted @file{/usr/local} is used. + +Use @code{./configure --help} to get a list of other options. +In particular the following flags are important: + +@itemize @bullet +@item +Enable support for some external sources of uniform random +number generators +(@pxref{URNG,,Using uniform random number generators}): + +@table @code +@item --with-urng-rngstream +URNG: use Pierre L'Ecuyer's RNGSTREAM library +[default=@code{no}] + +@item --with-urng-prng +URNG: use Otmar Lendl's PRNG library +[default=@code{no}] + +@item --with-urng-gsl +URNG: use random number generators from GNU Scientific Library +[default=@code{no}] + +@item --with-urng-default +URNG: global default URNG (builtin|rngstream) +[default=@code{builtin}] +@end table + +We strongly recommend to use RngStreams library: + +@example +sh ./configure --with-urng-rngstream --with-urng-default=rngstream +@end example + +@emph{Important:} You must install the respective libraries +@file{RngStreams}, @file{PRNG} and @file{GSL} before +@code{./configure} is executed. + +@item +Also make a shared library: + +@table @code +@item --enable-shared +build shared libraries [default=@code{no}] +@end table + +@item +The library provides the function @code{unur_gen_info} for +information about generator objects. This is intented for +using in interactive computing environments. +This feature can be enabled / disabled by means of the +configure flag + +@table @code +@item --enable-info +INFO: provide function with information about +generator objects [default=@code{yes}] +@end table + +@item +Enable support for deprecated UNU.RAN routines if you have +some problems with older application after upgrading the +library: + +@table @code +@item --enable-deprecated +enable support for deprecated UNU.RAN routines +[default=@code{no}] +@end table + +@item +Enable debugging tools: + +@table @code +@item --enable-check-struct +Debug: check validity of pointers to structures +[default=@code{no}] + +@item --enable-logging +Debug: print informations about generator into logfile +[default=no] +@end table +@end itemize + + +@item Compile and install the libray: + +@example +make +make install +@end example + +@noindent +Obviously @code{$(prefix)/include} and @code{$(prefix)/lib} +must be in the search path of your compiler. You can use environment +variables to add these directories to the search path. If you +are using the bash type (or add to your profile): + +@example +export LIBRARY_PATH="/lib" +export C_INCLURE_PATH="/include" +@end example + +@noindent +If you want to make a shared library, then making such +a library can be enabled using + +@example +sh ./configure --enable-shared +@end example + +@noindent +If you want to link against the shared library make sure that +it can be found when executing the binary that links to the +library. If it is not installed in the usual path, then the +easiest way is to set the @code{LD_LIBRARY_PATH} environment +variable. See any operating system documentation about shared +libraries for more information, such as the ld(1) and +ld.so(8) manual pages. + +@item Documentation in various formats (PDF, HTML, info, plain +text) can be found in directory @file{doc}. + +@item You can run some tests by + +@example +make check +@end example + +@noindent +However, some of these tests requires the usage of the PRNG or +RngStreams library and are only executed if these are installed +enabled by the corresponding configure flag. + +An extended set of tests is run by + +@example +make fullcheck +@end example + +@noindent +However some of these might fail occasionally due to +roundoff errors or the mysteries of floating point arithmetic, +since we have used some extreme settings to test the library. + +@end enumerate + + +@subsubheading Upgrading + +@itemize @minus +@item @emph{Important:} + +UNU.RAN now relies on some aspects of IEEE +754 compliant floating point arithmetic. In particular, +@code{1./0.} and @code{0./0.} must result in @code{infinity} +and @code{NaN} (not a number), respectively, and must not +cause a floating point exception. +For allmost all modern compting architecture this is implemented +in hardware. For others there should be a special compiler flag +to get this feature (e.g., @code{-MIEEE} on DEC alpha or +@code{-mp} for the Intel C complier). + +@item Upgrading UNU.RAN from version 0.9.x or earlier: + +With UNU.RAN version 1.0.x some of the macro definitions in +file @file{src/unuran_config.h} are moved into file +@file{config.h} and are set/controlled by the +@code{./configure} script. + +Writting logging information into the logfile must now be +enabled when running the configure script: + +@example +sh ./configure --enable-logging +@end example + +@item Upgrading UNU.RAN from version 0.7.x or earlier: + +With UNU.RAN version 0.8.0 the interface for changing +underlying distributions and running a reinitialization +routine has been simplified. The old routines can be compiled +into the library using the following configure flag: + +@example +sh ./configure --enable-deprecated +@end example + +@noindent +Notice: Using these deprecated routines is not supported any +more and this strong discouraged. + +Wrapper functions for external sources of uniform random +numbers are now enabled by configure flags and not by macros +defined in file @file{src/unuran_config.h}. + +The file @file{src/unuran_config.h} is not installed any +more. It is now only included when the library is compiled. +It should be removed from the global include path of the +compiler. + +@end itemize + + + +@c +@c end of installation.dh +@c ------------------------------------- +@c ------------------------------------- +@c intro.dh +@c + +@node UsageLib +@section Using the library + + + +@subsubheading ANSI C Compliance + +The library is written in ANSI C and is intended to conform to the +ANSI C standard. It should be portable to any system with a +working ANSI C compiler. + +The library does not rely on any non-ANSI extensions in the +interface it exports to the user. Programs you write using UNU.RAN +can be ANSI compliant. Extensions which can be used in a way +compatible with pure ANSI C are supported, however, via conditional +compilation. This allows the library to take advantage of compiler +extensions on those platforms which support them. + +To avoid namespace conflicts all exported function names and +variables have the prefix @code{unur_}, while exported macros have +the prefix @code{UNUR_}. + + +@subsubheading Compiling and Linking + +If you want to use the library you must include the UNU.RAN header +file + +@example +#include +@end example + +@noindent +If you also need the test routines then also add + +@example +#include +@end example + +@noindent +If wrapper functions for external sources of uniform random number +generators are used, the corresponding header files must also be +included, e.g., + +@example +#include +@end example + +@noindent +If these header files are not installed on the standard search path +of your compiler you will also need to provide its location to the +preprocessor as a command line flag. The default location of the +@file{unuran.h} is @file{/usr/local/include}. A typical compilation +command for a source file @file{app.c} with the GNU C compiler +@code{gcc} is, + +@example +gcc -I/usr/local/include -c app.c +@end example + +@noindent +This results in an object file @file{app.o}. The default include +path for @code{gcc} searches @file{/usr/local/include} +automatically so the @code{-I} option can be omitted when UNU.RAN is +installed in its default location. + +The library is installed as a single file, @file{libunuran.a}. A +shared version of the library is also installed on systems that +support shared libraries. The default location of these files is +@file{/usr/local/lib}. To link against the library you need to +specify the main library. The following example shows how to link +an application with the library (and the the RNGSTREAMS library if you +decide to use this source of uniform pseudo-random numbers), + +@example +gcc app.o -lunuran -lrngstreams -lm +@end example + + +@subsubheading Shared Libraries + +To run a program linked with the shared version of the library it +may be necessary to define the shell variable +@code{LD_LIBRARY_PATH} to include the directory where the library +is installed. For example, + +@example +LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH +@end example + +@noindent +To compile a statically linked version of the program instead, use the +@code{-static} flag in @code{gcc}, + +@example +gcc -static app.o -lunuran -lrngstreams -lm +@end example + + +@subsubheading Compatibility with C++ + +The library header files automatically define functions to have +@code{extern "C"} linkage when included in C++ programs. + + + + +@c +@c end of intro.dh +@c ------------------------------------- +@c ------------------------------------- +@c intro.dh +@c + +@node Concepts +@section Concepts of UNU.RAN + + +UNU.RAN is a C library for generating non-uniformly distributed +random variates. Its emphasis is on the generation of non-standard +distribution and on streams of random variates of special purposes. +It is designed to provide a consistent tool to +sample from distributions with various properties. +Since there is no universal method that fits for all situations, +various methods for sampling are implemented. + +UNU.RAN solves this complex task by means of an object oriented +programming interface. Three basic objects are used: + +@itemize @bullet +@item distribution object @code{UNUR_DISTR}@* +Hold all information about the random variates that should be +generated. + +@item generator object @code{UNUR_GEN}@* +Hold the generators for the given distributions. +Two generator objects are completely independent of each other. +They may share a common uniform random number generator or have +their owns. + +@item parameter object @code{UNUR_PAR}@* +Hold all information for creating a generator object. It is +necessary due to various parameters and switches for each of +these generation methods. + +Notice that the parameter objects only hold pointers to arrays +but do not have their own copy of such an array. +Especially, if a dynamically allocated array is used +it @emph{must not} be freed until the generator object has +been created! + +@end itemize + +The idea behind these structures is that creatin distributions, +choosing a generation method and draing samples are orthogonal +(ie. independent) functions of the library. +The parameter object is only introduced due to the necessity to +deal with various parameters and switches for +each of these generation methods which are required to adjust the +algorithms to unusual distributions with extreme properties but +have default values that are suitable for most applications. +These parameters and the data for distributions are set by various +functions. + +Once a generator object has been created sampling (from the +univariate continuous distribution) can be done by +the following command: + +@example +double x = unur_sample_cont(generator); +@end example + +@noindent +Analogous commands exist for discrete and multivariate +distributions. +For detailed examples that can be copied and modified +see @ref{Examples}. + + +@subheading Distribution objects + +All information about a distribution are stored in objects +(structures) of type @code{UNUR_DISTR}. +UNU.RAN has five different types of distribution objects: + +@table @code +@item cont +Continuous univariate distributions. +@item cvec +Continuous multivariate distributions. +@item discr +Discrete univariate distributions. +@item cemp +Continuous empirical univariate distribution, ie. given by a sample. +@item cvemp +Continuous empirical multivariate distribution, ie. given by a sample. +@item matr +Matrix distributions. + +@end table + +@noindent +Distribution objects can be +created from scratch by the following call + +@example +distr = unur_distr__new(); +@end example + +@noindent +where @code{} is one of the five possible types from the +above table. +Notice that these commands only create an @emph{empty} object which +still must be filled by means of calls for each type of +distribution object +(@pxref{Distribution_objects,,Handling distribution objects}). +The naming scheme of these functions is designed to indicate the +corresponding type of the distribution object and the task to be +performed. It is demonstated on the following example. + +@example +unur_distr_cont_set_pdf(distr, mypdf); +@end example + +@noindent +This command stores a PDF named @code{mypdf} in the distribution +object @code{distr} which must have the type @code{cont}. + +Of course UNU.RAN provides an easier way to use standard distributions. +Instead of using @command{unur_distr__new} calls and fuctions +@command{unur_distr__set_<@dots{}>} for setting data, +objects for standard distribution can be created by a single call. +Eg. to get an object for the normal distribution with mean 2 and +standard deviation 5 use + +@example +double parameter[2] = @{2.0 ,5.0@}; +UNUR_DISTR *distr = unur_distr_normal(parameter, 2); +@end example + +@noindent +For a list of standard distributions +see @ref{Stddist,,Standard distributions}. + + +@subheading Generation methods + +The information that a distribution object must contain depends +heavily on the chosen generation method choosen. + +Brackets indicate optional information while a tilde indicates +that only an approximation must be provided. +See @ref{Glossary}, for unfamiliar terms. + +@include methods_cont.texi + +@include methods_cemp.texi + +@include methods_cvec.texi + +@include methods_cvemp.texi + +@include methods_discr.texi + +@include methods_matr.texi + +@include methods_mcmc.texi + +Because of tremendous variety of possible problems, UNU.RAN provides many +methods. All information for creating a generator object has to be +collected in a parameter object first. +For example, if the task is to sample from a continuous distribution +the method AROU might be a good choice. Then the call + +@example +UNUR_PAR *par = unur_arou_new(distribution); +@end example + +@noindent +creates an parameter object @code{par} with a pointer to the +distribution object and default values for all necessary parameters +for method AROU. +Other methods can be used by replacing @code{arou} with the name +of the desired methods (in lower case letters): + +@example +UNUR_PAR *par = unur__new(distribution); +@end example + +@noindent +This sets the default values for all necessary parameters for the +chosen method. These are suitable for almost all +applications. Nevertheless, it is possible to control the behavior +of the method using corresponding @command{set} calls for each method. +This might be necessary to adjust the algorithm for an unusual +distribution with extreme properties, or just for fine tuning the +perforence of the algorithm. +The following example demonstrates how to change the maximum +number of iterations for method NINV to the value 50: + +@example +unur_ninv_set_max_iteration(par, 50); +@end example + +@noindent +All available methods are described in details in +@ref{Methods}. + + +@subheading Creating a generator object + +Now it is possible to create a generator object: + +@example +UNUR_GEN *generator = unur_init(par); +if (generator == @code{NULL}) exit(EXIT_FAILURE); +@end example + +@noindent +@strong{Important:} You must always check whether +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +has +been executed successfully. Otherwise the @code{NULL} pointer is returned +which causes a segmentation fault when used for sampling. + +@noindent +@strong{Important:} +The call of +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +@strong{destroys} the parameter object!@* +Moreover, it is recommended to call +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +immediately after +the parameter object @code{par} has created and modified. + +An existing generator object is a rather static construct. +Nevertheless, some of the parameters can still be modified by +@command{chg} calls, e.g. + +@example +unur_ninv_chg_max_iteration(gen, 30); +@end example + +@noindent +Notice that it is important @emph{when} parameters are +changed because different functions must be used: + +The function name includes the term @command{set} and the first +argument must be of type @code{UNUR_PAR} when the parameters are +changed @emph{before} the generator object is created. + +The function name includes the term @command{chg} and the first +argument must be of type @code{UNUR_GEN} when the parameters are +changed for an @emph{existing} generator object. + +For details see @ref{Methods}. + + +@subheading Sampling + +You can now use your generator object in any place of your program +to sample from your distribution. You only have to take care about +the type of variates it computes: @code{double}, @code{int} or a +vector (array of @code{double}s). +Notice that at this point it does not matter whether you are +sampling from a gamma distribution, a truncated normal distribution +or even an empirical distribution. + + +@subheading Reinitializing + +It is possible for a generator object to change the parameters and +the domain of the underlying distribution. This must be done by +extracting this object by means of a +@ifhtml +@ref{funct:unur_get_distr,@command{unur_get_distr}} +@end ifhtml +@ifnothtml +@command{unur_get_distr} +@end ifnothtml +call and +changing the distribution using the correspondig set calls, +see @ref{Distribution_objects,,Handling distribution objects}. +The generator object @strong{must} then be reinitialized by means +of the +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +call. + +@emph{Important}: Currently not all methods allow reinitialization, +see the description of the particular method (keyword @i{Reinit}). + + +@subheading Destroy + +When you do not need your generator object any more, you should +destroy it: + +@example +unur_free(generator); +@end example + + +@subheading Uniform random numbers + +Each generator object can have its own uniform random number +generator or share one with others. +When created a parameter object the pointer for the uniform random +number generator is set to the default generator. However, it can be +changed at any time to any other generator: + +@example +unur_set_urng(par, urng); +@end example + +@noindent +or + +@example +unur_chg_urng(generator, urng); +@end example + +@noindent +respectively. +See @ref{URNG,,Using uniform random number generators}, +for details. + + + +@c +@c end of intro.dh +@c ------------------------------------- +@c ------------------------------------- +@c intro.dh +@c + +@node Contact +@section Contact the authors + + +If you have any problems with UNU.RAN, suggestions how to improve +the library, or find a bug, please contact us via email +@email{unuran@@statmath.wu.ac.at}. + +For news please visit out homepage at +@uref{http://statmath.wu.ac.at/unuran/}. + + + +@c +@c end of intro.dh +@c ------------------------------------- +@c ------------------------------------- +@c examples.dh +@c + +@node Examples +@chapter Examples + +@menu +* Example_0:: As short as possible +* Example_0_str:: As short as possible (String API) +* Example_1:: Select a method +* Example_1_str:: Select a method (String API) +* Example_2:: Arbitrary distributions +* Example_2_str:: Arbitrary distributions (String API) +* Example_3:: Change parameters of the method +* Example_3_str:: Change parameters of the method (String API) +* Example_4:: Change uniform random generator +* Example_reinit:: Change parameters of underlying distribution +* Example_anti:: Sample pairs of antithetic random variates +* Example_anti_str:: Sample pairs of antithetic random variates (String API) +* Example_More:: More examples +@end menu + + + +The examples in this chapter should compile cleanly and can be +found in the directory @file{examples} of the source tree of +UNU.RAN. Assuming that UNU.RAN as well as the PRNG libraries +have been installed properly (@pxref{Installation}) each +of these can be compiled (using the GCC in this example) with + +@example +gcc -Wall -O2 -o example example.c -lunuran -lprng -lm +@end example + +@noindent +@emph{Remark:} @code{-lprng} must be omitted when the PRNG library +is not installed. Then however some of the examples might not work. + +The library uses three objects: +@code{UNUR_DISTR}, @code{UNUR_PAR} and @code{UNUR_GEN}. +It is not important to understand the details of these objects but +it is important not to changed the order of their creation. +The distribution object can be destroyed @emph{after} the generator +object has been made. (The parameter object is freed automatically +by the +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +call.) It is also important to check the result +of the +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +call. If it has failed the @code{NULL} pointer is +returned and causes a segmentation fault when used for sampling. + +We give all examples with the UNU.RAN standard API and the more +convenient string API. + + + +@c +@c end of examples.dh +@c ------------------------------------- +@c ------------------------------------- +@c examples.dh +@c + +@page +@node Example_0 +@section As short as possible + + + +Select a distribution and let UNU.RAN do all necessary steps. + +@smallexample +@include ref_example0.texi +@end smallexample + + + +@c +@c end of examples.dh +@c ------------------------------------- +@c ------------------------------------- +@c examples.dh +@c + +@page +@node Example_0_str +@section As short as possible (String API) + + + +Select a distribution and let UNU.RAN do all necessary steps. + +@smallexample +@include ref_example0_str.texi +@end smallexample + + + +@c +@c end of examples.dh +@c ------------------------------------- +@c ------------------------------------- +@c examples.dh +@c + +@page +@node Example_1 +@section Select a method + + + +Select method AROU and use it with default parameters. + +@smallexample +@include ref_example1.texi +@end smallexample + + + +@c +@c end of examples.dh +@c ------------------------------------- +@c ------------------------------------- +@c examples.dh +@c + +@page +@node Example_1_str +@section Select a method (String API) + + + +Select method AROU and use it with default parameters. + +@smallexample +@include ref_example1_str.texi +@end smallexample + + + +@c +@c end of examples.dh +@c ------------------------------------- +@c ------------------------------------- +@c examples.dh +@c + +@page +@node Example_2 +@section Arbitrary distributions + + + +If you want to sample from a non-standard distribution, +UNU.RAN might be exactly what you need. +Depending on the information is available, a method +must be choosen for sampling, +see @ref{Concepts} for an overview and +@ref{Methods} for details. + +@smallexample +@include ref_example2.texi +@end smallexample + + + +@c +@c end of examples.dh +@c ------------------------------------- +@c ------------------------------------- +@c examples.dh +@c + +@page +@node Example_2_str +@section Arbitrary distributions (String API) + + + +If you want to sample from a non-standard distribution, +UNU.RAN might be exactly what you need. +Depending on the information is available, a method +must be choosen for sampling, +see @ref{Concepts} for an overview and +@ref{Methods} for details. + +@smallexample +@include ref_example2_str.texi +@end smallexample + + + +@c +@c end of examples.dh +@c ------------------------------------- +@c ------------------------------------- +@c examples.dh +@c + +@page +@node Example_3 +@section Change parameters of the method + + + +Each method for generating random numbers allows several +parameters to be modified. If you do not want to use default values, +it is possible to change them. +The following example illustrates how to change parameters. +For details see @ref{Methods}. + +@smallexample +@include ref_example3.texi +@end smallexample + + + +@c +@c end of examples.dh +@c ------------------------------------- +@c ------------------------------------- +@c examples.dh +@c + +@page +@node Example_3_str +@section Change parameters of the method (String API) + + + +Each method for generating random numbers allows several +parameters to be modified. If you do not want to use default values, +it is possible to change them. +The following example illustrates how to change parameters. +For details see @ref{Methods}. + +@smallexample +@include ref_example3_str.texi +@end smallexample + + + +@c +@c end of examples.dh +@c ------------------------------------- +@c ------------------------------------- +@c examples.dh +@c + +@page +@node Example_4 +@section Change uniform random generator + + + +All generator object use the same default uniform random number +generator by default. This can be changed to any generator of your +choice such that each generator object has its own random number +generator or can share it with some other objects. +It is also possible to change the default generator at any time. +See @ref{URNG,,Using uniform random number generators}, +for details. + +The following example shows how the uniform random number generator +can be set or changed for a generator object. It requires the +RNGSTREAMS library to be installed and used. Otherwise the example must be +modified accordingly. + +@smallexample +@include ref_example_rngstreams.texi +@end smallexample + + + +@c +@c end of examples.dh +@c ------------------------------------- +@c ------------------------------------- +@c examples.dh +@c + +@page +@node Example_reinit +@section Change parameters of underlying distribution + + + +One a generator object has been created it allows to draw samples from +the distribution with the given parameters. +However, some methods allow to change the parameters of the underlying +distribution and reinitialize the generator object again. +Thus when the parameters of the distribution vary for each draw we +save overhead for destroying the old object and creating a new one. + +The following example shows how the parameters of a GIG distribution +can be changed when method CSTD is used. + +@smallexample +@include ref_example_reinit.texi +@end smallexample + + + +@c +@c end of examples.dh +@c ------------------------------------- +@c ------------------------------------- +@c examples.dh +@c + +@page +@node Example_anti +@section Sample pairs of antithetic random variates + + +Using Method TDR it is easy to sample pairs of antithetic random variates. + +@smallexample +@include ref_example_anti.texi +@end smallexample + + + +@c +@c end of examples.dh +@c ------------------------------------- +@c ------------------------------------- +@c examples.dh +@c + +@page +@node Example_anti_str +@section Sample pairs of antithetic random variates (String API) + + +Using Method TDR it is easy to sample pairs of antithetic random variates. + +@smallexample +@include ref_example_anti_str.texi +@end smallexample + + + +@c +@c end of examples.dh +@c ------------------------------------- +@c ------------------------------------- +@c examples.dh +@c + +@page +@node Example_More +@section More examples + + + +@xref{Methods_for_CONT,,Methods for continuous univariate distributions}. + +@xref{Methods_for_CEMP,,Methods for continuous empirical univariate distributions}. + +@xref{Methods_for_CVEMP,,Methods for continuous empirical multivariate distributions}. + +@xref{Methods_for_DISCR,,Methods for discrete univariate distributions}. + + + +@c +@c end of examples.dh +@c ------------------------------------- +@c ------------------------------------- +@c parser.h +@c + +@node StringAPI +@chapter String Interface + +@menu +* StringSyntax:: Syntax of String Interface +* StringDistr:: Distribution String +* StringFunct:: Function String +* StringMethod:: Method String +* StringURNG:: Uniform RNG String +@end menu + + + +The string interface (string API) provided by the +@ifhtml +@ref{funct:unur_str2gen,@command{unur_str2gen}} +@end ifhtml +@ifnothtml +@command{unur_str2gen} +@end ifnothtml +call is the easiest way to use UNU.RAN. This +function takes a character string as its argument. The string is +parsed and the information obtained is used to create a generator +object. It returns @code{NULL} if this fails, either due to a syntax +error, or due to invalid data. In both cases @code{unur_error} is +set to the corresponding error codes +(@pxref{Error_reporting,,Error reporting}). +Additionally there exists the call +@ifhtml +@ref{funct:unur_str2distr,@command{unur_str2distr}} +@end ifhtml +@ifnothtml +@command{unur_str2distr} +@end ifnothtml +that only +produces a distribution object. + +Notice that the string interface does not implement all features of +the UNU.RAN library. For trickier tasks it might be necessary to use +the UNU.RAN calls. + +In @ref{Examples}, all examples are given using both the +UNU.RAN standard API and this convenient string API. +The corresponding programm codes are equivalent. + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_str2gen,unur_str2gen} +@item @ref{funct:unur_str2distr,unur_str2distr} +@item @ref{funct:unur_makegen_ssu,unur_makegen_ssu} +@item @ref{funct:unur_makegen_dsu,unur_makegen_dsu} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_str2gen} +@deftypefn Function {UNUR_GEN*} unur_str2gen (const @var{char* string}) +Get a generator object for the distribution, method and uniform +random number generator as described in the given @var{string}. +See @ref{StringSyntax,,Syntax of String Interface}, for details. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_str2gen} +@deftypefn {} {UNUR_GEN*} unur_str2gen (const @var{char* string}) +Get a generator object for the distribution, method and uniform +random number generator as described in the given @var{string}. +See @ref{StringSyntax,,Syntax of String Interface}, for details. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_str2distr} +@deftypefn Function {UNUR_DISTR*} unur_str2distr (const @var{char* string}) +Get a distribution object for the distribution described in +@var{string}. +See @ref{StringSyntax,,Syntax of String Interface}, +and @ref{StringDistr,,Distribution String}, +for details. However, only the block for the distribution object is +allowed. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_str2distr} +@deftypefn {} {UNUR_DISTR*} unur_str2distr (const @var{char* string}) +Get a distribution object for the distribution described in +@var{string}. +See @ref{StringSyntax,,Syntax of String Interface}, +and @ref{StringDistr,,Distribution String}, +for details. However, only the block for the distribution object is +allowed. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_makegen_ssu} +@anchor{funct:unur_makegen_dsu} +@deftypefn Function {UNUR_GEN*} unur_makegen_ssu (const @var{char* distrstr}, const @var{char* methodstr}, UNUR_URNG* @var{urng}) +@deftypefnx Function {UNUR_GEN*} unur_makegen_dsu (const @var{UNUR_DISTR* distribution}, const @var{char* methodstr}, UNUR_URNG* @var{urng}) +Make a generator object for the distribution, method and uniform +random number generator. The distribution can be given either as +string @var{distrstr} or as a distribution object @var{distr}. +The method must be given as a string @var{methodstr}. +For the syntax of these strings see +@ref{StringSyntax,,Syntax of String Interface}. +However, the @code{method} keyword is optional for these calls +and can be omitted. If @var{methodstr} is the empty (blank) string +or @code{NULL} method AUTO is used. +The uniform random number generator is optional. If +@var{urng} is @code{NULL} then the default uniform random number generator +is used. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_makegen_ssu} +@anchor{funct:unur_makegen_dsu} +@deftypefn {} {UNUR_GEN*} unur_makegen_ssu (const @var{char* distrstr}, const @var{char* methodstr}, UNUR_URNG* @var{urng}) +@deftypefnx {} {UNUR_GEN*} unur_makegen_dsu (const @var{UNUR_DISTR* distribution}, const @var{char* methodstr}, UNUR_URNG* @var{urng}) +Make a generator object for the distribution, method and uniform +random number generator. The distribution can be given either as +string @var{distrstr} or as a distribution object @var{distr}. +The method must be given as a string @var{methodstr}. +For the syntax of these strings see +@ref{StringSyntax,,Syntax of String Interface}. +However, the @code{method} keyword is optional for these calls +and can be omitted. If @var{methodstr} is the empty (blank) string +or @code{NULL} method AUTO is used. +The uniform random number generator is optional. If +@var{urng} is @code{NULL} then the default uniform random number generator +is used. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of parser.h +@c ------------------------------------- +@c ------------------------------------- +@c parser.h +@c + +@node StringSyntax +@section Syntax of String Interface + + + +The given string holds information about the requested distribution +and (optional) about the sampling method and the uniform random +number generator invoked. The interpretation of the string is not +case-sensitive, all white spaces are ignored. + +The string consists of up to three blocks, separated by ampersands +@code{&}. + +Each block consists of @code{=} pairs, separated by +semicolons @code{;}. + +The first key in each block is used to indicate each block. +We have three different blocks with the following (first) keys: +@table @code +@item distr +definition of the distribution +(@pxref{StringDistr,,Distribution String}). + +@item method +description of the transformation method +(@pxref{StringMethod,,Method String}). + +@item urng +uniform random number generation +(@pxref{StringURNG,,Uniform RNG String}). +@end table + +The @code{distr} block must be the very first block and is +obligatory. All the other blocks are optional and can be arranged +in arbitrary order. + +For details see the following description of each block. + +In the following example + +@example +distr = normal(3.,0.75); domain = (0,inf) & method = tdr; c = 0 +@end example + +@noindent +we have a distribution block for the truncated normal distribution +with mean 3 and standard deviation 0.75 on domain (0,infinity); +and block for choosing method TDR with parameter c set to 0. + +The @code{=} pairs that follow the first (initial) pair +in each block are used to set parameters. +The name of the parameter is given by the @code{} string. It is +deduced from the UNU.RAN set calls by taking the part after +@code{@dots{}_set_}. +The @code{} string holds the parameters to be +set, separated by commata @code{,}. +There are three types of parameters: +@table @emph +@item string @code{"@dots{}"} or @code{'@dots{}'} +i.e. any sequence of characters enclosed by double quotes +@code{"@dots{}"} or single quotes @code{'@dots{}'} +(there is no distinction between double quotes @code{"} and +single quotes @code{'}). +@item list @code{(@dots{},@dots{})} +i.e. list of @emph{numbers}, separated by commata @code{,}, +enclosed in parenthesis @code{(...)}. +@item number +a sequence of characters that is not enclosed by double quotes +@code{"@dots{}"}, single quotes @code{'@dots{}'}, +or parenthesis @code{(...)}. +It is interpreted as float or integer depending on the type of +the corresponding parameter. +@end table +The @code{} string (including the character @code{=}) can be +omitted when no argument is required. + +At the moment not all @command{set} calls are supported. +The syntax for the @code{} can be directly derived from the +corresponding @command{set} calls. To simplify the syntax additional +shortcuts are possible. The following table lists the parameters for +the @code{set} calls that are supported by the string interface; the +entry in parenthesis gives the type of the argument as +@code{} string: + +@table @code +@item int @i{(number)}: +The @i{number} is interpreted as an integer. +@code{true} and @code{on} are transformed to @code{1}, +@code{false} and @code{off} are transformed to @code{0}. +A missing argument is interpreted as @code{1}. + +@item int, int @i{(number, number} @r{or} @i{list)}: +The two numbers or the first two entries in the list are +interpreted as a integers. +@code{inf} and @code{-inf} are transformed to @code{INT_MAX} and +@code{INT_MIN} respectively, i.e. the largest and smallest +integers that can be represented by the computer. + +@item unsigned @i{(number)}: +The @i{number} is interpreted as an unsigned hexadecimal +integer. + +@item double @i{(number)}: +The number is interpreted as a floating point number. +@code{inf} is transformed to @code{UNUR_INFINITY}. + +@item double, double @i{(number, number} @r{or} @i{list)}: +The two numbers or the first two entries in the list are +interpreted as a floating point numbers. +@code{inf} is transformed to @code{UNUR_INFINITY}. However using +@code{inf} in the list might not work for all versions of C. Then it +is recommended to use two single numbers instead of a list. + +@item int, double* @i{([number,] list} @r{or} @i{number)}: +@itemize @minus +@item +The list is interpreted as a double array. +The (first) number as its length. +If it is less than the actual size of the array only the +first entries of the array are used. +@item +If only the list is given (i.e., if the first number is omitted), +the first number is set to the actual size of the array. +@item +If only the number is given (i.e., if the list is omitted), the @code{NULL} +pointer is used instead an array as argument. +@end itemize + +@item double*, int @i{(list [,number])}: +The list is interpreted as a double array. +The (second) number as its length. +If the length is omitted, it is replaced by the actual size of the +array. (Only in the @code{distribution} block!) + +@item char* @i{(string)}: +The character string is passed as is to the corresponding set +call. + +@end table + +Notice that missing entries in a list of numbers are interpreted as +@code{0}. E.g, a the list @code{(1,,3)} is read as @code{(1,0,3)}, the +list @code{(1,2,)} as @code{(1,2,0)}. + +The the list of @code{key} strings in +@ref{KeysDistr,,Keys for Distribution String}, and +@ref{KeysMethod,,Keys for Method String}, for further details. + + + +@c +@c end of parser.h +@c ------------------------------------- +@c ------------------------------------- +@c parser.h +@c + +@page +@node StringDistr +@section Distribution String + +@menu +* KeysDistr:: Keys for Distribution String +@end menu + + + +The @code{distr} block must be the very first block and is +obligatory. For that reason the keyword @code{distr} is optional and +can be omitted (together with the @code{=} character). +Moreover it is ignored while parsing the string. However, to +avoid some possible confusion it has to start with the +letter @code{d} (if it is given at all). + +The value of the @code{distr} key is used to get the distribution +object, either via a @command{unur_distr_} call for a standard +distribution via a @command{unur_distr__new} call to get an +object of a generic distribution. +However not all generic distributions are supported yet. + +The parameters for the standard distribution are given +as a list. There must not be any character (other than white space) +between the name of the standard distribution and the opening +parenthesis @code{(} of this list. E.g., to get a beta distribution, +use + +@example +distr = beta(2,4) +@end example + +To get an object for a discrete distribution with probability +vector (0.5,0.2,0.3), use + +@example +distr = discr; pv = (0.5,0.2,0.3) +@end example + +It is also possible to set a PDF, PMF, or CDF using a string. +E.g., to create a continuous distribution with PDF proportional to +@code{exp(-sqrt(2+(x-1)^2) + (x-1))} and domain (0,inf) use + +@example +distr = cont; pdf = "exp(-sqrt(2+(x-1)^2) + (x-1))" +@end example + +@noindent +Notice: If this string is used in an +@ifhtml +@ref{funct:unur_str2distr,@command{unur_str2distr}} +@end ifhtml +@ifnothtml +@command{unur_str2distr} +@end ifnothtml +or +@ifhtml +@ref{funct:unur_str2gen,@command{unur_str2gen}} +@end ifhtml +@ifnothtml +@command{unur_str2gen} +@end ifnothtml +call the double quotes @code{"} must be protected by +@code{\"}. Alternatively, single quotes may be used instead + +@example +distr = cont; pdf = 'exp(-sqrt(2+(x-1)^2) + (x-1))' +@end example + +For the details of function strings see +@ref{StringFunct,,Function String}. + + + +@c +@c end of parser.h +@c ------------------------------------- +@c ------------------------------------- +@c stringparser_doc.dh +@c + +@node KeysDistr +@subsection Keys for Distribution String + + + +List of standard distributions @pxref{Stddist,,Standard distributions} + +@itemize @minus +@item @code{[distr =] beta(@dots{})} @ @ @ @ @result{} @pxref{beta} +@item @code{[distr =] binomial(@dots{})} @ @ @ @ @result{} @pxref{binomial} +@item @code{[distr =] cauchy(@dots{})} @ @ @ @ @result{} @pxref{cauchy} +@item @code{[distr =] chi(@dots{})} @ @ @ @ @result{} @pxref{chi} +@item @code{[distr =] chisquare(@dots{})} @ @ @ @ @result{} @pxref{chisquare} +@item @code{[distr =] exponential(@dots{})} @ @ @ @ @result{} @pxref{exponential} +@item @code{[distr =] extremeI(@dots{})} @ @ @ @ @result{} @pxref{extremeI} +@item @code{[distr =] extremeII(@dots{})} @ @ @ @ @result{} @pxref{extremeII} +@item @code{[distr =] F(@dots{})} @ @ @ @ @result{} @pxref{F} +@item @code{[distr =] gamma(@dots{})} @ @ @ @ @result{} @pxref{gamma} +@item @code{[distr =] geometric(@dots{})} @ @ @ @ @result{} @pxref{geometric} +@item @code{[distr =] gig(@dots{})} @ @ @ @ @result{} @pxref{gig} +@item @code{[distr =] gig2(@dots{})} @ @ @ @ @result{} @pxref{gig2} +@item @code{[distr =] hyperbolic(@dots{})} @ @ @ @ @result{} @pxref{hyperbolic} +@item @code{[distr =] hypergeometric(@dots{})} @ @ @ @ @result{} @pxref{hypergeometric} +@item @code{[distr =] ig(@dots{})} @ @ @ @ @result{} @pxref{ig} +@item @code{[distr =] laplace(@dots{})} @ @ @ @ @result{} @pxref{laplace} +@item @code{[distr =] logarithmic(@dots{})} @ @ @ @ @result{} @pxref{logarithmic} +@item @code{[distr =] logistic(@dots{})} @ @ @ @ @result{} @pxref{logistic} +@item @code{[distr =] lognormal(@dots{})} @ @ @ @ @result{} @pxref{lognormal} +@item @code{[distr =] lomax(@dots{})} @ @ @ @ @result{} @pxref{lomax} +@item @code{[distr =] negativebinomial(@dots{})} @ @ @ @ @result{} @pxref{negativebinomial} +@item @code{[distr =] normal(@dots{})} @ @ @ @ @result{} @pxref{normal} +@item @code{[distr =] pareto(@dots{})} @ @ @ @ @result{} @pxref{pareto} +@item @code{[distr =] poisson(@dots{})} @ @ @ @ @result{} @pxref{poisson} +@item @code{[distr =] powerexponential(@dots{})} @ @ @ @ @result{} @pxref{powerexponential} +@item @code{[distr =] rayleigh(@dots{})} @ @ @ @ @result{} @pxref{rayleigh} +@item @code{[distr =] slash(@dots{})} @ @ @ @ @result{} @pxref{slash} +@item @code{[distr =] student(@dots{})} @ @ @ @ @result{} @pxref{student} +@item @code{[distr =] triangular(@dots{})} @ @ @ @ @result{} @pxref{triangular} +@item @code{[distr =] uniform(@dots{})} @ @ @ @ @result{} @pxref{uniform} +@item @code{[distr =] weibull(@dots{})} @ @ @ @ @result{} @pxref{weibull} +@end itemize + +List of generic distributions @pxref{Distribution_objects,,Handling Distribution Objects} + +@itemize @minus +@item @code{[distr =] cemp} @ @ @ @ @result{} @pxref{CEMP} +@item @code{[distr =] cont} @ @ @ @ @result{} @pxref{CONT} +@item @code{[distr =] discr} @ @ @ @ @result{} @pxref{DISCR} +@end itemize + +@emph{Notice}: +Order statistics for continuous distributions (@pxref{CORDER}) are +supported by using the key @code{orderstatistics} for distributions +of type @code{CONT}. + +List of keys that are available via the String API. +For description see the corresponding UNU.RAN set calls. + +@itemize @bullet +@item All distribution types +@table @code +@item name = "@i{}" +@result{} @pxref{funct:unur_distr_set_name,,@command{unur_distr_set_name}} +@end table + +@item @code{cemp} @ @i{(Distribution Type)}@ @ @ @ (@pxref{CEMP}) +@table @code +@item data = (@i{}) [, @i{}] +@result{} @pxref{funct:unur_distr_cemp_set_data,,@command{unur_distr_cemp_set_data}} +@item hist_bins = (@i{}) [, @i{}] +@result{} @pxref{funct:unur_distr_cemp_set_hist_bins,,@command{unur_distr_cemp_set_hist_bins}} +@item hist_domain = @i{}, @i{} | (@i{}) +@result{} @pxref{funct:unur_distr_cemp_set_hist_domain,,@command{unur_distr_cemp_set_hist_domain}} +@item hist_prob = (@i{}) [, @i{}] +@result{} @pxref{funct:unur_distr_cemp_set_hist_prob,,@command{unur_distr_cemp_set_hist_prob}} +@end table + +@item @code{cont} @ @i{(Distribution Type)}@ @ @ @ (@pxref{CONT}) +@table @code +@item cdf = "@i{}" +@result{} @pxref{funct:unur_distr_cont_set_cdfstr,,@command{unur_distr_cont_set_cdfstr}} +@item center = @i{} +@result{} @pxref{funct:unur_distr_cont_set_center,,@command{unur_distr_cont_set_center}} +@item domain = @i{}, @i{} | (@i{}) +@result{} @pxref{funct:unur_distr_cont_set_domain,,@command{unur_distr_cont_set_domain}} +@item hr = "@i{}" +@result{} @pxref{funct:unur_distr_cont_set_hrstr,,@command{unur_distr_cont_set_hrstr}} +@item logcdf = "@i{}" +@result{} @pxref{funct:unur_distr_cont_set_logcdfstr,,@command{unur_distr_cont_set_logcdfstr}} +@item logpdf = "@i{}" +@result{} @pxref{funct:unur_distr_cont_set_logpdfstr,,@command{unur_distr_cont_set_logpdfstr}} +@item mode = @i{} +@result{} @pxref{funct:unur_distr_cont_set_mode,,@command{unur_distr_cont_set_mode}} +@item pdf = "@i{}" +@result{} @pxref{funct:unur_distr_cont_set_pdfstr,,@command{unur_distr_cont_set_pdfstr}} +@item pdfarea = @i{} +@result{} @pxref{funct:unur_distr_cont_set_pdfarea,,@command{unur_distr_cont_set_pdfarea}} +@item pdfparams = (@i{}) [, @i{}] +@result{} @pxref{funct:unur_distr_cont_set_pdfparams,,@command{unur_distr_cont_set_pdfparams}} +@item orderstatistics = @i{}, @i{} | (@i{}) +Make order statistics for given distribution. The first parameter +gives the sample size, the second parameter its rank. +(see @pxref{funct:unur_distr_corder_new,,@command{unur_distr_corder_new}}) +@end table + +@item @code{discr} @ @i{(Distribution Type)}@ @ @ @ (@pxref{DISCR}) +@table @code +@item cdf = "@i{}" +@result{} @pxref{funct:unur_distr_discr_set_cdfstr,,@command{unur_distr_discr_set_cdfstr}} +@item domain = @i{}, @i{} | (@i{}) +@result{} @pxref{funct:unur_distr_discr_set_domain,,@command{unur_distr_discr_set_domain}} +@item mode [= @i{}] +@result{} @pxref{funct:unur_distr_discr_set_mode,,@command{unur_distr_discr_set_mode}} +@item pmf = "@i{}" +@result{} @pxref{funct:unur_distr_discr_set_pmfstr,,@command{unur_distr_discr_set_pmfstr}} +@item pmfparams = (@i{}) [, @i{}] +@result{} @pxref{funct:unur_distr_discr_set_pmfparams,,@command{unur_distr_discr_set_pmfparams}} +@item pmfsum = @i{} +@result{} @pxref{funct:unur_distr_discr_set_pmfsum,,@command{unur_distr_discr_set_pmfsum}} +@item pv = (@i{}) [, @i{}] +@result{} @pxref{funct:unur_distr_discr_set_pv,,@command{unur_distr_discr_set_pv}} +@end table + +@end itemize + + + + +@c +@c end of stringparser_doc.dh +@c ------------------------------------- +@c ------------------------------------- +@c functparser_doc.dh +@c + +@page +@node StringFunct +@section Function String + + + +In unuran it is also possible to define functions (e.g. CDF or PDF) as +strings. As you can see in Example 2 (@ref{Example_2_str}) it is very +easy to define the PDF of a distribution object by means of a string. +The possibilities using this string interface are more restricted than +using a pointer to a routine coded in C (@ref{Example_2}). +But the differences in evaluation time is small. +When a distribution object is defined using this string interface then +of course the same conditions on the given density or CDF must be +satisfied for a chosen method as for the standard API. +This string interface can be used for both within the UNU.RAN string +API using the +@ifhtml +@ref{funct:unur_str2gen,@command{unur_str2gen}} +@end ifhtml +@ifnothtml +@command{unur_str2gen} +@end ifnothtml +call, and for calls that define the +density or CDF for a particular distribution object as done with +(e.g.) the call +@ifhtml +@ref{funct:unur_distr_cont_set_pdfstr,@command{unur_distr_cont_set_pdfstr}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdfstr}. +@end ifnothtml +Here is an example for the latter case: + +@example +unur_distr_cont_set_pdfstr(distr,"1-x*x"); +@end example + + +@subheading Syntax + +The syntax for the function string is case insensitive, white spaces +are ingnored. The expressions are similar to most programming languages +and mathematical programs (see also the examples below). It is especially +influenced by C. The usual preceedence rules are used (from highest +to lowest preceedence: functions, power, multiplication, +addition, relation operators). Use parentheses in case of doubt or +when these preceedences should be changed. + +Relation operators can be used as indicator functions, i.e. the term +@code{(x>1)} is evaluted as @code{1} if this relation is satisfied, +and as @code{0} otherwise. + +The first unknown symbol (letter or word) is interpreted as the +variable of the function. It is recommended to use @code{x}. +Only one variable can be used. + +@noindent +@emph{Important}: The symbol @code{e} is used twice, for Euler's +constant (= 2.7182@dots{}) and as exponent. +The multiplication operator @code{*} must not be omitted, i.e. +@code{2 x} is interpreted as the string @code{2x} (which will result +in a syntax error). + + +@subheading List of symbols + +@cartouche +@noindent +@b{Numbers} + +@noindent +Numbers are composed using digits and, optionally, a sign, +a decimal point, and an exponent indicated by @code{e}. + +@multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} +@item Symbol @tab Explanation @tab Examples +@item @code{0@dots{}9} @tab @i{digits} @tab @code{2343} +@item @code{.} @tab @i{decimal point} @tab @code{165.567} +@item @code{-} @tab @i{negative sign} @tab @code{-465.223} +@item @code{e} @tab @i{exponet} @tab @code{13.2e-4} (=0.00132) +@end multitable +@end cartouche + +@cartouche +@noindent +@b{Constants} + +@multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} +@item @code{pi} @tab @i{pi = 3.1415@dots{}} @tab @code{3*pi+2} +@item @code{e} @tab @i{Euler's constant} @tab @code{3*e+2} (= 10.15@dots{}; +do not cofuse with @code{3e2} = 300) +@item @code{inf} @tab @i{infinity} @tab (used for domains) +@end multitable +@end cartouche + +@cartouche +@noindent +@b{Special symbols} + +@multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} +@item @code{(} @tab @i{opening parenthesis} @tab @code{2*(3+x)} +@item @code{)} @tab @i{closing parenthesis} @tab @code{2*(3+x)} +@item @code{,} @tab @i{(argument) list separator} @tab @code{mod(13,2)} +@end multitable +@end cartouche + +@cartouche +@noindent +@b{Relation operators (Indicator functions)} + +@multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} +@item @code{<} @tab @i{less than} @tab @code{(x<1)} +@item @code{=} @tab @i{equal} @tab @code{(2=x)} +@item @code{==} @tab @i{same as} @code{=} @tab @code{(x==3)} +@item @code{>} @tab @i{greater than} @tab @code{(x>0)} +@item @code{<=} @tab @i{less than or equal} @tab @code{(x<=1)} +@item @code{!=} @tab @i{not equal} @tab @code{(x!0)} +@item @code{<>} @tab @i{same as} @code{!=} @tab @code{(x<>pi)} +@item @code{>=} @tab @i{greater or equal} @tab @code{(x>=1)} +@end multitable +@end cartouche + +@cartouche +@noindent +@b{Arithmetic operators} + +@multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} +@item @code{+} @tab @i{addition} @tab @code{2+x} +@item @code{-} @tab @i{subtraction} @tab @code{2-x} +@item @code{*} @tab @i{multiplication} @tab @code{2*x} +@item @code{/} @tab @i{division} @tab @code{x/2} +@item @code{^} @tab @i{power} @tab @code{x^2} +@end multitable +@end cartouche + +@cartouche +@noindent +@b{Functions} + +@multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} +@item @code{mod} @tab @code{mod(m,n)} @i{remainder of devision m over n} @tab mod(x,2) +@item @code{exp} @tab @i{exponential function +(same as @code{e^x})} @tab @code{exp(-x^2)} (same as @code{e^(-x^2)}) +@item @code{log} @tab @i{natural logarithm} @tab @code{log(x)} +@item @code{sin} @tab @i{sine} @tab @code{sin(x)} +@item @code{cos} @tab @i{cosine} @tab @code{cos(x)} +@item @code{tan} @tab @i{tangent} @tab @code{tan(x)} +@item @code{sec} @tab @i{secant} @tab @code{sec(x*2)} +@item @code{sqrt} @tab @i{square root} @tab @code{sqrt(2*x)} +@item @code{abs} @tab @i{absolute value} @tab @code{abs(x)} +@item @code{sgn} @tab @i{sign function} @tab @code{sign(x)*3} +@end multitable +@end cartouche + +@cartouche +@noindent +@b{Variable} + +@multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} +@item @code{x} @tab @i{variable} @tab @code{3*x^2} +@end multitable +@end cartouche + + +@subheading Examples + +@example +1.231+7.9876*x-1.234e-3*x^2+3.335e-5*x^3 +sin(2*pi*x)+x^2 +exp(-((x-3)/2.1)^2) +@end example + +@noindent +It is also possible to define functions using different terms +on separate domains. However, instead of constructs using +@code{if @dots{} then @dots{} else @dots{}} +indicator functions are available. + +@noindent +For example to define the density of triangular distribution +with domain (-1,1) and mode 0 use + +@example +(x>-1)*(x<0)*(1+x) + (x>=0)*(x<1)*(1-x) +@end example + + + +@c +@c end of functparser_doc.dh +@c ------------------------------------- +@c ------------------------------------- +@c parser.h +@c + +@page +@node StringMethod +@section Method String + +@menu +* KeysMethod:: Keys for Method String +@end menu + + + +The key @code{method} is obligatory, it must be the first key and its +value is the name of a method suitable for the choosen standard +distribution. E.g., if method AROU is chosen, use + +@example +method = arou +@end example + +Of course the all following keys dependend on the method choosen at +first. All corresponding @command{set} calls of UNU.RAN are available +and the key is the string after the @command{unur__set_} +part of the command. E.g., UNU.RAN provides the command +@command{unur_arou_set_max_sqhratio} to set a parameter of method AROU. +To call this function via the string-interface, the +key @code{max_sqhratio} can be used: + +@example +max_sqhratio = 0.9 +@end example + +@noindent +Additionally the keyword @code{debug} can be used to set debugging +flags (see @ref{Debug,,Debugging}, for details). + +If this block is omitted, a suitable default method is used. Notice +however that the default method may change in future versions of +UNU.RAN. + + + +@c +@c end of parser.h +@c ------------------------------------- +@c ------------------------------------- +@c stringparser_doc.dh +@c + +@node KeysMethod +@subsection Keys for Method String + + + +List of methods and keys that are available via the String API. +For description see the corresponding UNU.RAN set calls. + +@itemize @bullet +@item @code{method = arou} @ @ @ @ @result{} @command{unur_arou_new} +(@pxref{AROU}) +@table @code +@item cpoints = @i{} [, (@i{})] | (@i{}) +@result{} @pxref{funct:unur_arou_set_cpoints,,@command{unur_arou_set_cpoints}} +@item darsfactor = @i{} +@result{} @pxref{funct:unur_arou_set_darsfactor,,@command{unur_arou_set_darsfactor}} +@item guidefactor = @i{} +@result{} @pxref{funct:unur_arou_set_guidefactor,,@command{unur_arou_set_guidefactor}} +@item max_segments [= @i{}] +@result{} @pxref{funct:unur_arou_set_max_segments,,@command{unur_arou_set_max_segments}} +@item max_sqhratio = @i{} +@result{} @pxref{funct:unur_arou_set_max_sqhratio,,@command{unur_arou_set_max_sqhratio}} +@item pedantic [= @i{}] +@result{} @pxref{funct:unur_arou_set_pedantic,,@command{unur_arou_set_pedantic}} +@item usecenter [= @i{}] +@result{} @pxref{funct:unur_arou_set_usecenter,,@command{unur_arou_set_usecenter}} +@item usedars [= @i{}] +@result{} @pxref{funct:unur_arou_set_usedars,,@command{unur_arou_set_usedars}} +@item verify [= @i{}] +@result{} @pxref{funct:unur_arou_set_verify,,@command{unur_arou_set_verify}} +@end table + +@item @code{method = ars} @ @ @ @ @result{} @command{unur_ars_new} +(@pxref{ARS}) +@table @code +@item cpoints = @i{} [, (@i{})] | (@i{}) +@result{} @pxref{funct:unur_ars_set_cpoints,,@command{unur_ars_set_cpoints}} +@item max_intervals [= @i{}] +@result{} @pxref{funct:unur_ars_set_max_intervals,,@command{unur_ars_set_max_intervals}} +@item max_iter [= @i{}] +@result{} @pxref{funct:unur_ars_set_max_iter,,@command{unur_ars_set_max_iter}} +@item pedantic [= @i{}] +@result{} @pxref{funct:unur_ars_set_pedantic,,@command{unur_ars_set_pedantic}} +@item reinit_ncpoints [= @i{}] +@result{} @pxref{funct:unur_ars_set_reinit_ncpoints,,@command{unur_ars_set_reinit_ncpoints}} +@item reinit_percentiles = @i{} [, (@i{})] | (@i{}) +@result{} @pxref{funct:unur_ars_set_reinit_percentiles,,@command{unur_ars_set_reinit_percentiles}} +@item verify [= @i{}] +@result{} @pxref{funct:unur_ars_set_verify,,@command{unur_ars_set_verify}} +@end table + +@item @code{method = auto} @ @ @ @ @result{} @command{unur_auto_new} +(@pxref{AUTO}) +@table @code +@item logss [= @i{}] +@result{} @pxref{funct:unur_auto_set_logss,,@command{unur_auto_set_logss}} +@end table + +@item @code{method = cstd} @ @ @ @ @result{} @command{unur_cstd_new} +(@pxref{CSTD}) +@table @code +@item variant = @i{} +@result{} @pxref{funct:unur_cstd_set_variant,,@command{unur_cstd_set_variant}} +@end table + +@item @code{method = dari} @ @ @ @ @result{} @command{unur_dari_new} +(@pxref{DARI}) +@table @code +@item cpfactor = @i{} +@result{} @pxref{funct:unur_dari_set_cpfactor,,@command{unur_dari_set_cpfactor}} +@item squeeze [= @i{}] +@result{} @pxref{funct:unur_dari_set_squeeze,,@command{unur_dari_set_squeeze}} +@item tablesize [= @i{}] +@result{} @pxref{funct:unur_dari_set_tablesize,,@command{unur_dari_set_tablesize}} +@item verify [= @i{}] +@result{} @pxref{funct:unur_dari_set_verify,,@command{unur_dari_set_verify}} +@end table + +@item @code{method = dau} @ @ @ @ @result{} @command{unur_dau_new} +(@pxref{DAU}) +@table @code +@item urnfactor = @i{} +@result{} @pxref{funct:unur_dau_set_urnfactor,,@command{unur_dau_set_urnfactor}} +@end table + +@item @code{method = dgt} @ @ @ @ @result{} @command{unur_dgt_new} +(@pxref{DGT}) +@table @code +@item guidefactor = @i{} +@result{} @pxref{funct:unur_dgt_set_guidefactor,,@command{unur_dgt_set_guidefactor}} +@item variant = @i{} +@result{} @pxref{funct:unur_dgt_set_variant,,@command{unur_dgt_set_variant}} +@end table + +@item @code{method = dsrou} @ @ @ @ @result{} @command{unur_dsrou_new} +(@pxref{DSROU}) +@table @code +@item cdfatmode = @i{} +@result{} @pxref{funct:unur_dsrou_set_cdfatmode,,@command{unur_dsrou_set_cdfatmode}} +@item verify [= @i{}] +@result{} @pxref{funct:unur_dsrou_set_verify,,@command{unur_dsrou_set_verify}} +@end table + +@item @code{method = dstd} @ @ @ @ @result{} @command{unur_dstd_new} +(@pxref{DSTD}) +@table @code +@item variant = @i{} +@result{} @pxref{funct:unur_dstd_set_variant,,@command{unur_dstd_set_variant}} +@end table + +@item @code{method = empk} @ @ @ @ @result{} @command{unur_empk_new} +(@pxref{EMPK}) +@table @code +@item beta = @i{} +@result{} @pxref{funct:unur_empk_set_beta,,@command{unur_empk_set_beta}} +@item kernel = @i{} +@result{} @pxref{funct:unur_empk_set_kernel,,@command{unur_empk_set_kernel}} +@item positive [= @i{}] +@result{} @pxref{funct:unur_empk_set_positive,,@command{unur_empk_set_positive}} +@item smoothing = @i{} +@result{} @pxref{funct:unur_empk_set_smoothing,,@command{unur_empk_set_smoothing}} +@item varcor [= @i{}] +@result{} @pxref{funct:unur_empk_set_varcor,,@command{unur_empk_set_varcor}} +@end table + +@item @code{method = gibbs} @ @ @ @ @result{} @command{unur_gibbs_new} +(@pxref{GIBBS}) +@table @code +@item burnin [= @i{}] +@result{} @pxref{funct:unur_gibbs_set_burnin,,@command{unur_gibbs_set_burnin}} +@item c = @i{} +@result{} @pxref{funct:unur_gibbs_set_c,,@command{unur_gibbs_set_c}} +@item thinning [= @i{}] +@result{} @pxref{funct:unur_gibbs_set_thinning,,@command{unur_gibbs_set_thinning}} +@item variant_coordinate +@result{} @pxref{funct:unur_gibbs_set_variant_coordinate,,@command{unur_gibbs_set_variant_coordinate}} +@item variant_random_direction +@result{} @pxref{funct:unur_gibbs_set_variant_random_direction,,@command{unur_gibbs_set_variant_random_direction}} +@end table + +@item @code{method = hinv} @ @ @ @ @result{} @command{unur_hinv_new} +(@pxref{HINV}) +@table @code +@item boundary = @i{}, @i{} | (@i{}) +@result{} @pxref{funct:unur_hinv_set_boundary,,@command{unur_hinv_set_boundary}} +@item cpoints = (@i{}), @i{} +@result{} @pxref{funct:unur_hinv_set_cpoints,,@command{unur_hinv_set_cpoints}} +@item guidefactor = @i{} +@result{} @pxref{funct:unur_hinv_set_guidefactor,,@command{unur_hinv_set_guidefactor}} +@item max_intervals [= @i{}] +@result{} @pxref{funct:unur_hinv_set_max_intervals,,@command{unur_hinv_set_max_intervals}} +@item order [= @i{}] +@result{} @pxref{funct:unur_hinv_set_order,,@command{unur_hinv_set_order}} +@item u_resolution = @i{} +@result{} @pxref{funct:unur_hinv_set_u_resolution,,@command{unur_hinv_set_u_resolution}} +@end table + +@item @code{method = hitro} @ @ @ @ @result{} @command{unur_hitro_new} +(@pxref{HITRO}) +@table @code +@item adaptive_multiplier = @i{} +@result{} @pxref{funct:unur_hitro_set_adaptive_multiplier,,@command{unur_hitro_set_adaptive_multiplier}} +@item burnin [= @i{}] +@result{} @pxref{funct:unur_hitro_set_burnin,,@command{unur_hitro_set_burnin}} +@item r = @i{} +@result{} @pxref{funct:unur_hitro_set_r,,@command{unur_hitro_set_r}} +@item thinning [= @i{}] +@result{} @pxref{funct:unur_hitro_set_thinning,,@command{unur_hitro_set_thinning}} +@item use_adaptiveline [= @i{}] +@result{} @pxref{funct:unur_hitro_set_use_adaptiveline,,@command{unur_hitro_set_use_adaptiveline}} +@item use_adaptiverectangle [= @i{}] +@result{} @pxref{funct:unur_hitro_set_use_adaptiverectangle,,@command{unur_hitro_set_use_adaptiverectangle}} +@item use_boundingrectangle [= @i{}] +@result{} @pxref{funct:unur_hitro_set_use_boundingrectangle,,@command{unur_hitro_set_use_boundingrectangle}} +@item v = @i{} +@result{} @pxref{funct:unur_hitro_set_v,,@command{unur_hitro_set_v}} +@item variant_coordinate +@result{} @pxref{funct:unur_hitro_set_variant_coordinate,,@command{unur_hitro_set_variant_coordinate}} +@item variant_random_direction +@result{} @pxref{funct:unur_hitro_set_variant_random_direction,,@command{unur_hitro_set_variant_random_direction}} +@end table + +@item @code{method = hrb} @ @ @ @ @result{} @command{unur_hrb_new} +(@pxref{HRB}) +@table @code +@item upperbound = @i{} +@result{} @pxref{funct:unur_hrb_set_upperbound,,@command{unur_hrb_set_upperbound}} +@item verify [= @i{}] +@result{} @pxref{funct:unur_hrb_set_verify,,@command{unur_hrb_set_verify}} +@end table + +@item @code{method = hrd} @ @ @ @ @result{} @command{unur_hrd_new} +(@pxref{HRD}) +@table @code +@item verify [= @i{}] +@result{} @pxref{funct:unur_hrd_set_verify,,@command{unur_hrd_set_verify}} +@end table + +@item @code{method = hri} @ @ @ @ @result{} @command{unur_hri_new} +(@pxref{HRI}) +@table @code +@item p0 = @i{} +@result{} @pxref{funct:unur_hri_set_p0,,@command{unur_hri_set_p0}} +@item verify [= @i{}] +@result{} @pxref{funct:unur_hri_set_verify,,@command{unur_hri_set_verify}} +@end table + +@item @code{method = itdr} @ @ @ @ @result{} @command{unur_itdr_new} +(@pxref{ITDR}) +@table @code +@item cp = @i{} +@result{} @pxref{funct:unur_itdr_set_cp,,@command{unur_itdr_set_cp}} +@item ct = @i{} +@result{} @pxref{funct:unur_itdr_set_ct,,@command{unur_itdr_set_ct}} +@item verify [= @i{}] +@result{} @pxref{funct:unur_itdr_set_verify,,@command{unur_itdr_set_verify}} +@item xi = @i{} +@result{} @pxref{funct:unur_itdr_set_xi,,@command{unur_itdr_set_xi}} +@end table + +@item @code{method = mvtdr} @ @ @ @ @result{} @command{unur_mvtdr_new} +(@pxref{MVTDR}) +@table @code +@item boundsplitting = @i{} +@result{} @pxref{funct:unur_mvtdr_set_boundsplitting,,@command{unur_mvtdr_set_boundsplitting}} +@item maxcones [= @i{}] +@result{} @pxref{funct:unur_mvtdr_set_maxcones,,@command{unur_mvtdr_set_maxcones}} +@item stepsmin [= @i{}] +@result{} @pxref{funct:unur_mvtdr_set_stepsmin,,@command{unur_mvtdr_set_stepsmin}} +@item verify [= @i{}] +@result{} @pxref{funct:unur_mvtdr_set_verify,,@command{unur_mvtdr_set_verify}} +@end table + +@item @code{method = ninv} @ @ @ @ @result{} @command{unur_ninv_new} +(@pxref{NINV}) +@table @code +@item max_iter [= @i{}] +@result{} @pxref{funct:unur_ninv_set_max_iter,,@command{unur_ninv_set_max_iter}} +@item start = @i{}, @i{} | (@i{}) +@result{} @pxref{funct:unur_ninv_set_start,,@command{unur_ninv_set_start}} +@item table [= @i{}] +@result{} @pxref{funct:unur_ninv_set_table,,@command{unur_ninv_set_table}} +@item u_resolution = @i{} +@result{} @pxref{funct:unur_ninv_set_u_resolution,,@command{unur_ninv_set_u_resolution}} +@item usebisect +@result{} @pxref{funct:unur_ninv_set_usebisect,,@command{unur_ninv_set_usebisect}} +@item usenewton +@result{} @pxref{funct:unur_ninv_set_usenewton,,@command{unur_ninv_set_usenewton}} +@item useregula +@result{} @pxref{funct:unur_ninv_set_useregula,,@command{unur_ninv_set_useregula}} +@item x_resolution = @i{} +@result{} @pxref{funct:unur_ninv_set_x_resolution,,@command{unur_ninv_set_x_resolution}} +@end table + +@item @code{method = nrou} @ @ @ @ @result{} @command{unur_nrou_new} +(@pxref{NROU}) +@table @code +@item center = @i{} +@result{} @pxref{funct:unur_nrou_set_center,,@command{unur_nrou_set_center}} +@item r = @i{} +@result{} @pxref{funct:unur_nrou_set_r,,@command{unur_nrou_set_r}} +@item u = @i{}, @i{} | (@i{}) +@result{} @pxref{funct:unur_nrou_set_u,,@command{unur_nrou_set_u}} +@item v = @i{} +@result{} @pxref{funct:unur_nrou_set_v,,@command{unur_nrou_set_v}} +@item verify [= @i{}] +@result{} @pxref{funct:unur_nrou_set_verify,,@command{unur_nrou_set_verify}} +@end table + +@item @code{method = pinv} @ @ @ @ @result{} @command{unur_pinv_new} +(@pxref{PINV}) +@table @code +@item boundary = @i{}, @i{} | (@i{}) +@result{} @pxref{funct:unur_pinv_set_boundary,,@command{unur_pinv_set_boundary}} +@item extra_testpoints [= @i{}] +@result{} @pxref{funct:unur_pinv_set_extra_testpoints,,@command{unur_pinv_set_extra_testpoints}} +@item keepcdf [= @i{}] +@result{} @pxref{funct:unur_pinv_set_keepcdf,,@command{unur_pinv_set_keepcdf}} +@item max_intervals [= @i{}] +@result{} @pxref{funct:unur_pinv_set_max_intervals,,@command{unur_pinv_set_max_intervals}} +@item order [= @i{}] +@result{} @pxref{funct:unur_pinv_set_order,,@command{unur_pinv_set_order}} +@item searchboundary = @i{}, @i{} | (@i{}) +@result{} @pxref{funct:unur_pinv_set_searchboundary,,@command{unur_pinv_set_searchboundary}} +@item smoothness [= @i{}] +@result{} @pxref{funct:unur_pinv_set_smoothness,,@command{unur_pinv_set_smoothness}} +@item u_resolution = @i{} +@result{} @pxref{funct:unur_pinv_set_u_resolution,,@command{unur_pinv_set_u_resolution}} +@item use_upoints [= @i{}] +@result{} @pxref{funct:unur_pinv_set_use_upoints,,@command{unur_pinv_set_use_upoints}} +@item usecdf +@result{} @pxref{funct:unur_pinv_set_usecdf,,@command{unur_pinv_set_usecdf}} +@item usepdf +@result{} @pxref{funct:unur_pinv_set_usepdf,,@command{unur_pinv_set_usepdf}} +@end table + +@item @code{method = srou} @ @ @ @ @result{} @command{unur_srou_new} +(@pxref{SROU}) +@table @code +@item cdfatmode = @i{} +@result{} @pxref{funct:unur_srou_set_cdfatmode,,@command{unur_srou_set_cdfatmode}} +@item pdfatmode = @i{} +@result{} @pxref{funct:unur_srou_set_pdfatmode,,@command{unur_srou_set_pdfatmode}} +@item r = @i{} +@result{} @pxref{funct:unur_srou_set_r,,@command{unur_srou_set_r}} +@item usemirror [= @i{}] +@result{} @pxref{funct:unur_srou_set_usemirror,,@command{unur_srou_set_usemirror}} +@item usesqueeze [= @i{}] +@result{} @pxref{funct:unur_srou_set_usesqueeze,,@command{unur_srou_set_usesqueeze}} +@item verify [= @i{}] +@result{} @pxref{funct:unur_srou_set_verify,,@command{unur_srou_set_verify}} +@end table + +@item @code{method = ssr} @ @ @ @ @result{} @command{unur_ssr_new} +(@pxref{SSR}) +@table @code +@item cdfatmode = @i{} +@result{} @pxref{funct:unur_ssr_set_cdfatmode,,@command{unur_ssr_set_cdfatmode}} +@item pdfatmode = @i{} +@result{} @pxref{funct:unur_ssr_set_pdfatmode,,@command{unur_ssr_set_pdfatmode}} +@item usesqueeze [= @i{}] +@result{} @pxref{funct:unur_ssr_set_usesqueeze,,@command{unur_ssr_set_usesqueeze}} +@item verify [= @i{}] +@result{} @pxref{funct:unur_ssr_set_verify,,@command{unur_ssr_set_verify}} +@end table + +@item @code{method = tabl} @ @ @ @ @result{} @command{unur_tabl_new} +(@pxref{TABL}) +@table @code +@item areafraction = @i{} +@result{} @pxref{funct:unur_tabl_set_areafraction,,@command{unur_tabl_set_areafraction}} +@item boundary = @i{}, @i{} | (@i{}) +@result{} @pxref{funct:unur_tabl_set_boundary,,@command{unur_tabl_set_boundary}} +@item cpoints = @i{} [, (@i{})] | (@i{}) +@result{} @pxref{funct:unur_tabl_set_cpoints,,@command{unur_tabl_set_cpoints}} +@item darsfactor = @i{} +@result{} @pxref{funct:unur_tabl_set_darsfactor,,@command{unur_tabl_set_darsfactor}} +@item guidefactor = @i{} +@result{} @pxref{funct:unur_tabl_set_guidefactor,,@command{unur_tabl_set_guidefactor}} +@item max_intervals [= @i{}] +@result{} @pxref{funct:unur_tabl_set_max_intervals,,@command{unur_tabl_set_max_intervals}} +@item max_sqhratio = @i{} +@result{} @pxref{funct:unur_tabl_set_max_sqhratio,,@command{unur_tabl_set_max_sqhratio}} +@item nstp [= @i{}] +@result{} @pxref{funct:unur_tabl_set_nstp,,@command{unur_tabl_set_nstp}} +@item pedantic [= @i{}] +@result{} @pxref{funct:unur_tabl_set_pedantic,,@command{unur_tabl_set_pedantic}} +@item slopes = (@i{}), @i{} +@result{} @pxref{funct:unur_tabl_set_slopes,,@command{unur_tabl_set_slopes}} +@item usedars [= @i{}] +@result{} @pxref{funct:unur_tabl_set_usedars,,@command{unur_tabl_set_usedars}} +@item useear [= @i{}] +@result{} @pxref{funct:unur_tabl_set_useear,,@command{unur_tabl_set_useear}} +@item variant_ia [= @i{}] +@result{} @pxref{funct:unur_tabl_set_variant_ia,,@command{unur_tabl_set_variant_ia}} +@item variant_splitmode = @i{} +@result{} @pxref{funct:unur_tabl_set_variant_splitmode,,@command{unur_tabl_set_variant_splitmode}} +@item verify [= @i{}] +@result{} @pxref{funct:unur_tabl_set_verify,,@command{unur_tabl_set_verify}} +@end table + +@item @code{method = tdr} @ @ @ @ @result{} @command{unur_tdr_new} +(@pxref{TDR}) +@table @code +@item c = @i{} +@result{} @pxref{funct:unur_tdr_set_c,,@command{unur_tdr_set_c}} +@item cpoints = @i{} [, (@i{})] | (@i{}) +@result{} @pxref{funct:unur_tdr_set_cpoints,,@command{unur_tdr_set_cpoints}} +@item darsfactor = @i{} +@result{} @pxref{funct:unur_tdr_set_darsfactor,,@command{unur_tdr_set_darsfactor}} +@item guidefactor = @i{} +@result{} @pxref{funct:unur_tdr_set_guidefactor,,@command{unur_tdr_set_guidefactor}} +@item max_intervals [= @i{}] +@result{} @pxref{funct:unur_tdr_set_max_intervals,,@command{unur_tdr_set_max_intervals}} +@item max_sqhratio = @i{} +@result{} @pxref{funct:unur_tdr_set_max_sqhratio,,@command{unur_tdr_set_max_sqhratio}} +@item pedantic [= @i{}] +@result{} @pxref{funct:unur_tdr_set_pedantic,,@command{unur_tdr_set_pedantic}} +@item reinit_ncpoints [= @i{}] +@result{} @pxref{funct:unur_tdr_set_reinit_ncpoints,,@command{unur_tdr_set_reinit_ncpoints}} +@item reinit_percentiles = @i{} [, (@i{})] | (@i{}) +@result{} @pxref{funct:unur_tdr_set_reinit_percentiles,,@command{unur_tdr_set_reinit_percentiles}} +@item usecenter [= @i{}] +@result{} @pxref{funct:unur_tdr_set_usecenter,,@command{unur_tdr_set_usecenter}} +@item usedars [= @i{}] +@result{} @pxref{funct:unur_tdr_set_usedars,,@command{unur_tdr_set_usedars}} +@item usemode [= @i{}] +@result{} @pxref{funct:unur_tdr_set_usemode,,@command{unur_tdr_set_usemode}} +@item variant_gw +@result{} @pxref{funct:unur_tdr_set_variant_gw,,@command{unur_tdr_set_variant_gw}} +@item variant_ia +@result{} @pxref{funct:unur_tdr_set_variant_ia,,@command{unur_tdr_set_variant_ia}} +@item variant_ps +@result{} @pxref{funct:unur_tdr_set_variant_ps,,@command{unur_tdr_set_variant_ps}} +@item verify [= @i{}] +@result{} @pxref{funct:unur_tdr_set_verify,,@command{unur_tdr_set_verify}} +@end table + +@item @code{method = utdr} @ @ @ @ @result{} @command{unur_utdr_new} +(@pxref{UTDR}) +@table @code +@item cpfactor = @i{} +@result{} @pxref{funct:unur_utdr_set_cpfactor,,@command{unur_utdr_set_cpfactor}} +@item deltafactor = @i{} +@result{} @pxref{funct:unur_utdr_set_deltafactor,,@command{unur_utdr_set_deltafactor}} +@item pdfatmode = @i{} +@result{} @pxref{funct:unur_utdr_set_pdfatmode,,@command{unur_utdr_set_pdfatmode}} +@item verify [= @i{}] +@result{} @pxref{funct:unur_utdr_set_verify,,@command{unur_utdr_set_verify}} +@end table + +@item @code{method = vempk} @ @ @ @ @result{} @command{unur_vempk_new} +(@pxref{VEMPK}) +@table @code +@item smoothing = @i{} +@result{} @pxref{funct:unur_vempk_set_smoothing,,@command{unur_vempk_set_smoothing}} +@item varcor [= @i{}] +@result{} @pxref{funct:unur_vempk_set_varcor,,@command{unur_vempk_set_varcor}} +@end table + +@item @code{method = vnrou} @ @ @ @ @result{} @command{unur_vnrou_new} +(@pxref{VNROU}) +@table @code +@item r = @i{} +@result{} @pxref{funct:unur_vnrou_set_r,,@command{unur_vnrou_set_r}} +@item v = @i{} +@result{} @pxref{funct:unur_vnrou_set_v,,@command{unur_vnrou_set_v}} +@item verify [= @i{}] +@result{} @pxref{funct:unur_vnrou_set_verify,,@command{unur_vnrou_set_verify}} +@end table + +@end itemize + + + + +@c +@c end of stringparser_doc.dh +@c ------------------------------------- +@c ------------------------------------- +@c parser.h +@c + +@page +@node StringURNG +@section Uniform RNG String + + + +The value of the @code{urng} key is passed to the PRNG interface (see +@ifinfo +@xref{Top,,Overview,prng,PRNG Manual}. +@end ifinfo +@ifnotinfo +@uref{http://statmath.wu.ac.at/prng/manual/,PRNG manual} +@end ifnotinfo +for details). +However it only works when using the PRNG library is enabled, +see @ref{Installation} for details. There are no other keys. + +IMPORTANT: UNU.RAN creates a new uniform random number generator for +the generator object. The pointer to this uniform generator +has to be read and saved via a +@ifhtml +@ref{funct:unur_get_urng,@command{unur_get_urng}} +@end ifhtml +@ifnothtml +@command{unur_get_urng} +@end ifnothtml +call in order to +clear the memory @emph{before} the UNU.RAN generator object is +destroyed. + +If this block is omitted the UNU.RAN default generator is used +(which @emph{must not} be destroyed). + + + +@c +@c end of parser.h +@c ------------------------------------- +@c ------------------------------------- +@c distr.h +@c + +@page +@node Distribution_objects +@chapter Handling distribution objects + +@menu +* AllDistr:: Functions for all kinds of distribution objects +* CONT:: Continuous univariate distributions +* CORDER:: Continuous univariate order statistics +* CEMP:: Continuous empirical univariate distributions +* CVEC:: Continuous multivariate distributions +* CONDI:: Continuous univariate full conditional distribution +* CVEMP:: Continuous empirical multivariate distributions +* MATR:: MATRix distributions +* DISCR:: Discrete univariate distributions +@end menu + + +Objects of type @code{UNUR_DISTR} are used for handling +distributions. All data about a distribution are stored in this +object. UNU.RAN provides functions that return instances of such +objects for standard distributions +(@pxref{Stddist,,Standard distributions}). +It is then possible to change these distribution objects by +various set calls. Moreover, it is possible to build a +distribution object entirely from scratch. For this purpose +there exists @command{unur_distr__new} calls that +return an empty object of this type for each object type +(eg. univariate contiuous) which can be filled with the +appropriate set calls. + +UNU.RAN distinguishes between several types of distributions, +each of which has its own sets of possible parameters (for +details see the corresponding sections): +@itemize @minus +@item continuous univariate distributions +@item continuous univariate order statistics +@item continuous empirical univariate distributions +@item continuous multivariate distributions +@item continuous empirical multivariate distributions +@item matrix distributions +@item discrete univariate distributions +@end itemize + +Notice that there are essential data about a distribution, +eg. the PDF, a list of (shape, scale, location) parameters for +the distribution, and the domain of (the possibly truncated) +distribution. And there exist parameters that are/can be +derived from these, eg. the mode of the distribution or the area +below the given PDF (which need not be normalized for many +methods). UNU.RAN keeps track of parameters which are +known. Thus if one of the essential parameters is changed all +derived parameters are marked as unknown and must be set again +if these are required for the chosen generation method. +Additionally to set calls there are calls for updating derived +parameters for objects provided by the UNU.RAN library of standard +distributions (one for each parameter to avoid computational +overhead since not all parameters are required for all generator +methods). + +All parameters of distribution objects can be read by +corresponding get calls. + +Every generator object has its own copy of a distribution object +which is accessible by a +@ifhtml +@ref{funct:unur_get_distr,@command{unur_get_distr}} +@end ifhtml +@ifnothtml +@command{unur_get_distr} +@end ifnothtml +call. Thus the +parameter for this distribution can be read. However, +@strong{never} extract the distribution object out of a +generator object and run one of the set calls on it to modify +the distribution. (How should the poor generator object know +what has happend?) Instead there exist calls for each of the +generator methods that change particular parameters of the +internal copy of the distribution object. + + +@subsubheading How To Use + + +UNU.RAN collects all data required for a particular generation +method in a @emph{distribution object}. There are two ways to +get an instance of a distributions object: +@enumerate +@item +Build a distribtion from scratch, by means of +the corresponding @command{unur_distr__new} call, +where @command{} is the type of the distribution as +listed in the below subsections. + +@item +Use the corresponding @command{unur_distr__new} call +to get prebuild distribution from the UNU.RAN library of standard +distributions. +Here @command{} is the name of the +standard distribution in @ref{Stddist,,Standard distributions}. +@end enumerate + +In either cases the corresponding +@command{unur_distr__set_} calls to set the +necessary parameters @command{} (case 1), or +change the values of the standard distribution in case 2 (if +this makes sense for you). In the latter case @command{} +is the type to which the standard distribution belongs to. +These @command{set} calls return @code{UNUR_SUCCESS} when the +correspondig parameter has been set successfully. Otherwise an +error code is returned. + +The parameters of a distribution are divided into +@emph{essential} and @emph{derived} parameters. + +Notice, that there are some restrictions in setting parameters +to avoid possible confusions. +Changing essential parameters marks derived parameters as +@code{unknown}. Some of the parameters cannot be changed any +more when already set; some parameters block each others. +In such a case a new instance of a distribution object has to be +build. + +Additionally @command{unur_distr__upd_} calls can +be used for updating derived parameters for objects provided by +the UNU.RAN library of standard distributions. + +All parameters of a distribution object get be read by means of +@command{unur_distr__get_} calls. + +Every distribution object be identified by its @code{name} which +is a string of arbitrary characters provided by the user. For +standard distribution it is automatically set to +@command{} in the corresponding @command{new} call. It can +be changed to any other string. + + + + + +@c +@c end of distr.h +@c ------------------------------------- +@c ------------------------------------- +@c distr.h +@c + +@page +@node AllDistr +@section Functions for all kinds of distribution objects + + +The calls in this section can be applied to all distribution +objects. + +@itemize @minus +@item Destroy @command{free} an instance of a generator object. + +@item Ask for the @command{type} of a generator object. + +@item Ask for the @command{dimension} of a generator object. + +@item Deal with the @command{name} (identifier string) of a generator object. +@end itemize + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_distr_free,unur_distr_free} +@item @ref{funct:unur_distr_set_name,unur_distr_set_name} +@item @ref{funct:unur_distr_get_name,unur_distr_get_name} +@item @ref{funct:unur_distr_get_dim,unur_distr_get_dim} +@item @ref{funct:unur_distr_get_type,unur_distr_get_type} +@item @ref{funct:unur_distr_is_cont,unur_distr_is_cont} +@item @ref{funct:unur_distr_is_cvec,unur_distr_is_cvec} +@item @ref{funct:unur_distr_is_cemp,unur_distr_is_cemp} +@item @ref{funct:unur_distr_is_cvemp,unur_distr_is_cvemp} +@item @ref{funct:unur_distr_is_discr,unur_distr_is_discr} +@item @ref{funct:unur_distr_is_matr,unur_distr_is_matr} +@item @ref{funct:unur_distr_set_extobj,unur_distr_set_extobj} +@item @ref{funct:unur_distr_get_extobj,unur_distr_get_extobj} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_distr_free} +@deftypefn Function {void} unur_distr_free (UNUR_DISTR* @var{distribution}) +Destroy the @var{distribution} object. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_free} +@deftypefn {} {void} unur_distr_free (UNUR_DISTR* @var{distribution}) +Destroy the @var{distribution} object. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_set_name} +@anchor{funct:unur_distr_get_name} +@deftypefn Function {int} unur_distr_set_name (UNUR_DISTR* @var{distribution}, const @var{char* name}) +@deftypefnx Function {const char*} unur_distr_get_name (const @var{UNUR_DISTR* distribution}) +Set and get @var{name} of @var{distribution}. The @var{name} can be +an arbitrary character string. It can be used to identify generator +objects for the user. It is used by UNU.RAN when printing +information of the distribution object into a log files. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_set_name} +@anchor{funct:unur_distr_get_name} +@deftypefn {} {int} unur_distr_set_name (UNUR_DISTR* @var{distribution}, const @var{char* name}) +@deftypefnx {} {const char*} unur_distr_get_name (const @var{UNUR_DISTR* distribution}) +Set and get @var{name} of @var{distribution}. The @var{name} can be +an arbitrary character string. It can be used to identify generator +objects for the user. It is used by UNU.RAN when printing +information of the distribution object into a log files. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_get_dim} +@deftypefn Function {int} unur_distr_get_dim (const @var{UNUR_DISTR* distribution}) +Get number of components of a random vector (its dimension) the +@var{distribution}. + +For univariate distributions it returns dimension @code{1}. + +For matrix distributions it returns the number of components +(i.e., number of rows times number of columns). +When the respective numbers of rows and columns are needed use +@ifhtml +@ref{funct:unur_distr_matr_get_dim,@command{unur_distr_matr_get_dim}} +@end ifhtml +@ifnothtml +@command{unur_distr_matr_get_dim} +@end ifnothtml +instead. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_get_dim} +@deftypefn {} {int} unur_distr_get_dim (const @var{UNUR_DISTR* distribution}) +Get number of components of a random vector (its dimension) the +@var{distribution}. + +For univariate distributions it returns dimension @code{1}. + +For matrix distributions it returns the number of components +(i.e., number of rows times number of columns). +When the respective numbers of rows and columns are needed use +@ifhtml +@ref{funct:unur_distr_matr_get_dim,@command{unur_distr_matr_get_dim}} +@end ifhtml +@ifnothtml +@command{unur_distr_matr_get_dim} +@end ifnothtml +instead. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_get_type} +@deftypefn Function {unsigned int} unur_distr_get_type (const @var{UNUR_DISTR* distribution}) +Get type of @var{distribution}. +Possible types are +@table @code +@item UNUR_DISTR_CONT +univariate continuous distribution +@item UNUR_DISTR_CEMP +empirical continuous univariate distribution (i.e. a sample) +@item UNUR_DISTR_CVEC +continuous mulitvariate distribution +@item UNUR_DISTR_CVEMP +empirical continuous multivariate distribution (i.e. a vector sample) +@item UNUR_DISTR_DISCR +discrete univariate distribution +@item UNUR_DISTR_MATR +matrix distribution +@end table + +Alternatively the @command{unur_distr_is_} +calls can be used. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_get_type} +@deftypefn {} {unsigned int} unur_distr_get_type (const @var{UNUR_DISTR* distribution}) +Get type of @var{distribution}. +Possible types are +@table @code +@item UNUR_DISTR_CONT +univariate continuous distribution +@item UNUR_DISTR_CEMP +empirical continuous univariate distribution (i.e. a sample) +@item UNUR_DISTR_CVEC +continuous mulitvariate distribution +@item UNUR_DISTR_CVEMP +empirical continuous multivariate distribution (i.e. a vector sample) +@item UNUR_DISTR_DISCR +discrete univariate distribution +@item UNUR_DISTR_MATR +matrix distribution +@end table + +Alternatively the @command{unur_distr_is_} +calls can be used. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_is_cont} +@deftypefn Function {int} unur_distr_is_cont (const @var{UNUR_DISTR* distribution}) +@code{TRUE} if @var{distribution} is a continuous univariate distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_is_cont} +@deftypefn {} {int} unur_distr_is_cont (const @var{UNUR_DISTR* distribution}) +@code{TRUE} if @var{distribution} is a continuous univariate distribution. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_is_cvec} +@deftypefn Function {int} unur_distr_is_cvec (const @var{UNUR_DISTR* distribution}) +@code{TRUE} if @var{distribution} is a continuous multivariate distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_is_cvec} +@deftypefn {} {int} unur_distr_is_cvec (const @var{UNUR_DISTR* distribution}) +@code{TRUE} if @var{distribution} is a continuous multivariate distribution. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_is_cemp} +@deftypefn Function {int} unur_distr_is_cemp (const @var{UNUR_DISTR* distribution}) +@code{TRUE} if @var{distribution} is an empirical continuous univariate distribution, +i.e. a sample. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_is_cemp} +@deftypefn {} {int} unur_distr_is_cemp (const @var{UNUR_DISTR* distribution}) +@code{TRUE} if @var{distribution} is an empirical continuous univariate distribution, +i.e. a sample. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_is_cvemp} +@deftypefn Function {int} unur_distr_is_cvemp (const @var{UNUR_DISTR* distribution}) +@code{TRUE} if @var{distribution} is an empirical continuous multivariate +distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_is_cvemp} +@deftypefn {} {int} unur_distr_is_cvemp (const @var{UNUR_DISTR* distribution}) +@code{TRUE} if @var{distribution} is an empirical continuous multivariate +distribution. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_is_discr} +@deftypefn Function {int} unur_distr_is_discr (const @var{UNUR_DISTR* distribution}) +@code{TRUE} if @var{distribution} is a discrete univariate distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_is_discr} +@deftypefn {} {int} unur_distr_is_discr (const @var{UNUR_DISTR* distribution}) +@code{TRUE} if @var{distribution} is a discrete univariate distribution. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_is_matr} +@deftypefn Function {int} unur_distr_is_matr (const @var{UNUR_DISTR* distribution}) +@code{TRUE} if @var{distribution} is a matrix distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_is_matr} +@deftypefn {} {int} unur_distr_is_matr (const @var{UNUR_DISTR* distribution}) +@code{TRUE} if @var{distribution} is a matrix distribution. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_set_extobj} +@deftypefn Function {int} unur_distr_set_extobj (UNUR_DISTR* @var{distribution}, const @var{void* extobj}) +Store a pointer to an external object. This might be usefull if +the PDF, PMF, CDF or other functions used to implement a particular +distribution a parameter set that cannot be stored as doubles +(e.g. pointers to some structure that holds information of the distribution). + +@strong{Important:} +When UNU.RAN copies this distribution object into the generator object, +then the address @var{extobj} that this pointer contains is simply copied. +Thus the generator holds an address of a non-private object! +Once the generator object has been created any change in the external +object might effect the generator object. + +@strong{Warning:} +External objects must be used with care. Once the generator object has been +created or the distribution object has been copied you @emph{must not} +destroy this external object. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_set_extobj} +@deftypefn {} {int} unur_distr_set_extobj (UNUR_DISTR* @var{distribution}, const @var{void* extobj}) +Store a pointer to an external object. This might be usefull if +the PDF, PMF, CDF or other functions used to implement a particular +distribution a parameter set that cannot be stored as doubles +(e.g. pointers to some structure that holds information of the distribution). + +@strong{Important:} +When UNU.RAN copies this distribution object into the generator object, +then the address @var{extobj} that this pointer contains is simply copied. +Thus the generator holds an address of a non-private object! +Once the generator object has been created any change in the external +object might effect the generator object. + +@strong{Warning:} +External objects must be used with care. Once the generator object has been +created or the distribution object has been copied you @emph{must not} +destroy this external object. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_get_extobj} +@deftypefn Function {const void*} unur_distr_get_extobj (const @var{UNUR_DISTR* distribution}) +Get the pointer to the external object. + +@emph{Important:} +Changing this object must be done with with extreme care. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_get_extobj} +@deftypefn {} {const void*} unur_distr_get_extobj (const @var{UNUR_DISTR* distribution}) +Get the pointer to the external object. + +@emph{Important:} +Changing this object must be done with with extreme care. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of distr.h +@c ------------------------------------- +@c ------------------------------------- +@c cont.h +@c + +@page +@node CONT +@section Continuous univariate distributions + + +The calls in this section can be applied to continuous +univariate distributions. + +@itemize @minus +@item Create a @command{new} instance of a continuous univariate +distribution. + +@item Handle and evaluate +distribution function (CDF, @command{cdf}), +probability density function (PDF, @command{pdf}) and the +derivative of the density function (@command{dpdf}). +The following is important: +@itemize . +@item @command{pdf} need not be normalized, i.e., +any integrable nonnegative function can be used. +@item @command{dpdf} must the derivate of the function provided +as @command{pdf}. +@item @command{cdf} must be a distribution function, i.e. it +must be monotonically increasing with range [0,1]. +@item If @command{cdf} and @command{pdf} are used together for a +pariticular generation method, then @command{pdf} must be the +derivate of the @command{cdf}, i.e., it must be normalized. +@end itemize + +@item Handle and evaluate +the logarithm of the probability density function (logPDF, +@command{logpdf}) and the derivative of the logarithm of the +density function (@command{dlogpdf}). + +Some methods use the logarithm of the density if available. + +@item Set (and change) parameters (@command{pdfparams}) and the +area below the graph (@command{pdfarea}) of the given density. + +@item Set the @command{mode} (or pole) of the distribution. + +@item Set the @command{center} of the distribution. +It is used by some generation methods to adjust the parameters +of the generation algorithms to gain better performance. It can +be seens as the location of the ``central part'' of the +distribution. + +@item Some generation methods require the hazard rate +(@command{hr}) of the distribution instead of its @command{pdf}. + +@item Alternatively, @command{cdf}, @command{pdf}, @command{dpdf}, +and @command{hr} can be provided as @command{str}ings instead of +function pointers. + +@item Set the @command{domain} of the distribution. Notice that +the library also can handle truncated distributions, i.e., +distributions that are derived from (standard) distributions by +simply restricting its domain to a subset. However, there is a +subtle difference between changing the domain of a distribution +object by a +@ifhtml +@ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_domain} +@end ifnothtml +call and changing the +(truncated) domain for an existing generator object. The domain +of the distribution object is used to create the generator +object with hats, squeezes, tables, etc. Whereas truncating the +domain of an existing generator object need not necessarily +require a recomputation of these data. Thus by a +@command{unur__chg_truncated} call (if available) the +sampling region is restricted to the subset of the domain of the +given distribution object. However, generation methods that +require a recreation of the generator object when the domain is +changed have a @command{unur__chg_domain} call instead. +For these calls there are of course no restrictions on the given +domain (i.e., it is possible to increase the domain of the +distribution) (@pxref{Methods}, for details). + +@end itemize + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_distr_cont_new,unur_distr_cont_new} +@item @ref{funct:unur_distr_cont_set_pdf,unur_distr_cont_set_pdf} +@item @ref{funct:unur_distr_cont_set_dpdf,unur_distr_cont_set_dpdf} +@item @ref{funct:unur_distr_cont_set_cdf,unur_distr_cont_set_cdf} +@item @ref{funct:unur_distr_cont_set_invcdf,unur_distr_cont_set_invcdf} +@item @ref{funct:unur_distr_cont_get_pdf,unur_distr_cont_get_pdf} +@item @ref{funct:unur_distr_cont_get_dpdf,unur_distr_cont_get_dpdf} +@item @ref{funct:unur_distr_cont_get_cdf,unur_distr_cont_get_cdf} +@item @ref{funct:unur_distr_cont_get_invcdf,unur_distr_cont_get_invcdf} +@item @ref{funct:unur_distr_cont_eval_pdf,unur_distr_cont_eval_pdf} +@item @ref{funct:unur_distr_cont_eval_dpdf,unur_distr_cont_eval_dpdf} +@item @ref{funct:unur_distr_cont_eval_cdf,unur_distr_cont_eval_cdf} +@item @ref{funct:unur_distr_cont_eval_invcdf,unur_distr_cont_eval_invcdf} +@item @ref{funct:unur_distr_cont_set_logpdf,unur_distr_cont_set_logpdf} +@item @ref{funct:unur_distr_cont_set_dlogpdf,unur_distr_cont_set_dlogpdf} +@item @ref{funct:unur_distr_cont_set_logcdf,unur_distr_cont_set_logcdf} +@item @ref{funct:unur_distr_cont_get_logpdf,unur_distr_cont_get_logpdf} +@item @ref{funct:unur_distr_cont_get_dlogpdf,unur_distr_cont_get_dlogpdf} +@item @ref{funct:unur_distr_cont_get_logcdf,unur_distr_cont_get_logcdf} +@item @ref{funct:unur_distr_cont_eval_logpdf,unur_distr_cont_eval_logpdf} +@item @ref{funct:unur_distr_cont_eval_dlogpdf,unur_distr_cont_eval_dlogpdf} +@item @ref{funct:unur_distr_cont_eval_logcdf,unur_distr_cont_eval_logcdf} +@item @ref{funct:unur_distr_cont_set_pdfstr,unur_distr_cont_set_pdfstr} +@item @ref{funct:unur_distr_cont_set_cdfstr,unur_distr_cont_set_cdfstr} +@item @ref{funct:unur_distr_cont_get_pdfstr,unur_distr_cont_get_pdfstr} +@item @ref{funct:unur_distr_cont_get_dpdfstr,unur_distr_cont_get_dpdfstr} +@item @ref{funct:unur_distr_cont_get_cdfstr,unur_distr_cont_get_cdfstr} +@item @ref{funct:unur_distr_cont_set_pdfparams,unur_distr_cont_set_pdfparams} +@item @ref{funct:unur_distr_cont_get_pdfparams,unur_distr_cont_get_pdfparams} +@item @ref{funct:unur_distr_cont_set_pdfparams_vec,unur_distr_cont_set_pdfparams_vec} +@item @ref{funct:unur_distr_cont_get_pdfparams_vec,unur_distr_cont_get_pdfparams_vec} +@item @ref{funct:unur_distr_cont_set_logpdfstr,unur_distr_cont_set_logpdfstr} +@item @ref{funct:unur_distr_cont_get_logpdfstr,unur_distr_cont_get_logpdfstr} +@item @ref{funct:unur_distr_cont_get_dlogpdfstr,unur_distr_cont_get_dlogpdfstr} +@item @ref{funct:unur_distr_cont_set_logcdfstr,unur_distr_cont_set_logcdfstr} +@item @ref{funct:unur_distr_cont_get_logcdfstr,unur_distr_cont_get_logcdfstr} +@item @ref{funct:unur_distr_cont_set_domain,unur_distr_cont_set_domain} +@item @ref{funct:unur_distr_cont_get_domain,unur_distr_cont_get_domain} +@item @ref{funct:unur_distr_cont_get_truncated,unur_distr_cont_get_truncated} +@item @ref{funct:unur_distr_cont_set_hr,unur_distr_cont_set_hr} +@item @ref{funct:unur_distr_cont_get_hr,unur_distr_cont_get_hr} +@item @ref{funct:unur_distr_cont_eval_hr,unur_distr_cont_eval_hr} +@item @ref{funct:unur_distr_cont_set_hrstr,unur_distr_cont_set_hrstr} +@item @ref{funct:unur_distr_cont_get_hrstr,unur_distr_cont_get_hrstr} +@item @ref{funct:unur_distr_cont_set_mode,unur_distr_cont_set_mode} +@item @ref{funct:unur_distr_cont_upd_mode,unur_distr_cont_upd_mode} +@item @ref{funct:unur_distr_cont_get_mode,unur_distr_cont_get_mode} +@item @ref{funct:unur_distr_cont_set_center,unur_distr_cont_set_center} +@item @ref{funct:unur_distr_cont_get_center,unur_distr_cont_get_center} +@item @ref{funct:unur_distr_cont_set_pdfarea,unur_distr_cont_set_pdfarea} +@item @ref{funct:unur_distr_cont_upd_pdfarea,unur_distr_cont_upd_pdfarea} +@item @ref{funct:unur_distr_cont_get_pdfarea,unur_distr_cont_get_pdfarea} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_distr_cont_new} +@deftypefn Function {UNUR_DISTR*} unur_distr_cont_new (void) +Create a new (empty) object for univariate continuous distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_new} +@deftypefn {} {UNUR_DISTR*} unur_distr_cont_new (void) +Create a new (empty) object for univariate continuous distribution. +@end deftypefn +@end ifnotinfo + +@subsubheading Essential parameters + +@ifinfo +@anchor{funct:unur_distr_cont_set_pdf} +@anchor{funct:unur_distr_cont_set_dpdf} +@anchor{funct:unur_distr_cont_set_cdf} +@anchor{funct:unur_distr_cont_set_invcdf} +@deftypefn Function {int} unur_distr_cont_set_pdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{pdf}) +@deftypefnx Function {int} unur_distr_cont_set_dpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{dpdf}) +@deftypefnx Function {int} unur_distr_cont_set_cdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{cdf}) +@deftypefnx Function {int} unur_distr_cont_set_invcdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{invcdf}) +Set respective pointer to the probability density function (PDF), +the derivative of the probability density function (dPDF), the +cumulative distribution function (CDF), and the inverse CDF of the +@var{distribution}. +Each of these function pointers must be of type +@code{double funct(double x, const UNUR_DISTR *distr)}. + +Due to the fact that some of the methods do not require a +normalized PDF the following is important: + +@itemize @minus +@item +The given CDF must be the cumulative distribution function of +the (non-truncated) distribution. If a distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}) +is truncated, there is no need to change the CDF. + +@item +If both the CDF and the PDF are used (for a method or for order +statistics), the PDF must be the derivative of the CDF. +If a truncated distribution for one of the standard distributions +from the UNU.RAN library of standard distributions is used, +there is no need to change the PDF. + +@item +If the area below the PDF is required for a given distribution +it must be given by the +@ifhtml +@ref{funct:unur_distr_cont_set_pdfarea,@command{unur_distr_cont_set_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdfarea} +@end ifnothtml +call. +For a truncated distribution this must be of course the integral of +the PDF in the given truncated domain. +For distributions from the UNU.RAN library of standard +distributions this is done automatically by the +@ifhtml +@ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_pdfarea} +@end ifnothtml +call. + +@end itemize + +It is important to note that all these functions must return a +result for all values of @var{x}. Eg., if the domain of a given +PDF is the interval [-1,1], then the given function must return +@code{0.0} for all points outside this interval. +In case of an overflow the PDF should return +@code{UNUR_INFINITY}. + +It is not possible to change such a function. Once the PDF or +CDF is set it cannot be overwritten. This also holds when the +logPDF is given or when the PDF +is given by the +@ifhtml +@ref{funct:unur_distr_cont_set_pdfstr,@command{unur_distr_cont_set_pdfstr}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdfstr} +@end ifnothtml +or +@ifhtml +@ref{funct:unur_distr_cont_set_logpdfstr,@command{unur_distr_cont_set_logpdfstr}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_logpdfstr} +@end ifnothtml +call. +A new distribution object has to be used instead. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_set_pdf} +@anchor{funct:unur_distr_cont_set_dpdf} +@anchor{funct:unur_distr_cont_set_cdf} +@anchor{funct:unur_distr_cont_set_invcdf} +@deftypefn {} {int} unur_distr_cont_set_pdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{pdf}) +@deftypefnx {} {int} unur_distr_cont_set_dpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{dpdf}) +@deftypefnx {} {int} unur_distr_cont_set_cdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{cdf}) +@deftypefnx {} {int} unur_distr_cont_set_invcdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{invcdf}) +Set respective pointer to the probability density function (PDF), +the derivative of the probability density function (dPDF), the +cumulative distribution function (CDF), and the inverse CDF of the +@var{distribution}. +Each of these function pointers must be of type +@code{double funct(double x, const UNUR_DISTR *distr)}. + +Due to the fact that some of the methods do not require a +normalized PDF the following is important: + +@itemize @minus +@item +The given CDF must be the cumulative distribution function of +the (non-truncated) distribution. If a distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}) +is truncated, there is no need to change the CDF. + +@item +If both the CDF and the PDF are used (for a method or for order +statistics), the PDF must be the derivative of the CDF. +If a truncated distribution for one of the standard distributions +from the UNU.RAN library of standard distributions is used, +there is no need to change the PDF. + +@item +If the area below the PDF is required for a given distribution +it must be given by the +@ifhtml +@ref{funct:unur_distr_cont_set_pdfarea,@command{unur_distr_cont_set_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdfarea} +@end ifnothtml +call. +For a truncated distribution this must be of course the integral of +the PDF in the given truncated domain. +For distributions from the UNU.RAN library of standard +distributions this is done automatically by the +@ifhtml +@ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_pdfarea} +@end ifnothtml +call. + +@end itemize + +It is important to note that all these functions must return a +result for all values of @var{x}. Eg., if the domain of a given +PDF is the interval [-1,1], then the given function must return +@code{0.0} for all points outside this interval. +In case of an overflow the PDF should return +@code{UNUR_INFINITY}. + +It is not possible to change such a function. Once the PDF or +CDF is set it cannot be overwritten. This also holds when the +logPDF is given or when the PDF +is given by the +@ifhtml +@ref{funct:unur_distr_cont_set_pdfstr,@command{unur_distr_cont_set_pdfstr}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdfstr} +@end ifnothtml +or +@ifhtml +@ref{funct:unur_distr_cont_set_logpdfstr,@command{unur_distr_cont_set_logpdfstr}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_logpdfstr} +@end ifnothtml +call. +A new distribution object has to be used instead. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_get_pdf} +@anchor{funct:unur_distr_cont_get_dpdf} +@anchor{funct:unur_distr_cont_get_cdf} +@anchor{funct:unur_distr_cont_get_invcdf} +@deftypefn Function {UNUR_FUNCT_CONT*} unur_distr_cont_get_pdf (const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {UNUR_FUNCT_CONT*} unur_distr_cont_get_dpdf (const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {UNUR_FUNCT_CONT*} unur_distr_cont_get_cdf (const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {UNUR_FUNCT_CONT*} unur_distr_cont_get_invcdf (const @var{UNUR_DISTR* distribution}) +Get the respective pointer to the PDF, the derivative of the +PDF, the CDF, and the inverse CDF of the @var{distribution}. The +pointer is of type @code{double funct(double x, const UNUR_DISTR *distr)}. +If the corresponding function is not available for the distribution, +the @code{NULL} pointer is returned. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_get_pdf} +@anchor{funct:unur_distr_cont_get_dpdf} +@anchor{funct:unur_distr_cont_get_cdf} +@anchor{funct:unur_distr_cont_get_invcdf} +@deftypefn {} {UNUR_FUNCT_CONT*} unur_distr_cont_get_pdf (const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {UNUR_FUNCT_CONT*} unur_distr_cont_get_dpdf (const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {UNUR_FUNCT_CONT*} unur_distr_cont_get_cdf (const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {UNUR_FUNCT_CONT*} unur_distr_cont_get_invcdf (const @var{UNUR_DISTR* distribution}) +Get the respective pointer to the PDF, the derivative of the +PDF, the CDF, and the inverse CDF of the @var{distribution}. The +pointer is of type @code{double funct(double x, const UNUR_DISTR *distr)}. +If the corresponding function is not available for the distribution, +the @code{NULL} pointer is returned. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_eval_pdf} +@anchor{funct:unur_distr_cont_eval_dpdf} +@anchor{funct:unur_distr_cont_eval_cdf} +@anchor{funct:unur_distr_cont_eval_invcdf} +@deftypefn Function {double} unur_distr_cont_eval_pdf (double @var{x}, const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {double} unur_distr_cont_eval_dpdf (double @var{x}, const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {double} unur_distr_cont_eval_cdf (double @var{x}, const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {double} unur_distr_cont_eval_invcdf (double @var{u}, const @var{UNUR_DISTR* distribution}) +Evaluate the PDF, derivative of the PDF, the CDF, and the inverse +CDF at @var{x} and @var{u},respectively. +Notice that @var{distribution} must not be the @code{NULL} pointer. +If the corresponding function is not available for the distribution, +@code{UNUR_INFINITY} is returned and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_DATA}. + +@emph{IMPORTANT:} +In the case of a truncated standard distribution these calls always +return the respective values of the @emph{untruncated} distribution! +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_eval_pdf} +@anchor{funct:unur_distr_cont_eval_dpdf} +@anchor{funct:unur_distr_cont_eval_cdf} +@anchor{funct:unur_distr_cont_eval_invcdf} +@deftypefn {} {double} unur_distr_cont_eval_pdf (double @var{x}, const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {double} unur_distr_cont_eval_dpdf (double @var{x}, const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {double} unur_distr_cont_eval_cdf (double @var{x}, const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {double} unur_distr_cont_eval_invcdf (double @var{u}, const @var{UNUR_DISTR* distribution}) +Evaluate the PDF, derivative of the PDF, the CDF, and the inverse +CDF at @var{x} and @var{u},respectively. +Notice that @var{distribution} must not be the @code{NULL} pointer. +If the corresponding function is not available for the distribution, +@code{UNUR_INFINITY} is returned and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_DATA}. + +@emph{IMPORTANT:} +In the case of a truncated standard distribution these calls always +return the respective values of the @emph{untruncated} distribution! +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_set_logpdf} +@anchor{funct:unur_distr_cont_set_dlogpdf} +@anchor{funct:unur_distr_cont_set_logcdf} +@anchor{funct:unur_distr_cont_get_logpdf} +@anchor{funct:unur_distr_cont_get_dlogpdf} +@anchor{funct:unur_distr_cont_get_logcdf} +@anchor{funct:unur_distr_cont_eval_logpdf} +@anchor{funct:unur_distr_cont_eval_dlogpdf} +@anchor{funct:unur_distr_cont_eval_logcdf} +@deftypefn Function {int} unur_distr_cont_set_logpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{logpdf}) +@deftypefnx Function {int} unur_distr_cont_set_dlogpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{dlogpdf}) +@deftypefnx Function {int} unur_distr_cont_set_logcdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{logcdf}) +@deftypefnx Function {UNUR_FUNCT_CONT*} unur_distr_cont_get_logpdf (const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {UNUR_FUNCT_CONT*} unur_distr_cont_get_dlogpdf (const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {UNUR_FUNCT_CONT*} unur_distr_cont_get_logcdf (const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {double} unur_distr_cont_eval_logpdf (double @var{x}, const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {double} unur_distr_cont_eval_dlogpdf (double @var{x}, const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {double} unur_distr_cont_eval_logcdf (double @var{x}, const @var{UNUR_DISTR* distribution}) +Analogous calls for the logarithm of the density distribution functions. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_set_logpdf} +@anchor{funct:unur_distr_cont_set_dlogpdf} +@anchor{funct:unur_distr_cont_set_logcdf} +@anchor{funct:unur_distr_cont_get_logpdf} +@anchor{funct:unur_distr_cont_get_dlogpdf} +@anchor{funct:unur_distr_cont_get_logcdf} +@anchor{funct:unur_distr_cont_eval_logpdf} +@anchor{funct:unur_distr_cont_eval_dlogpdf} +@anchor{funct:unur_distr_cont_eval_logcdf} +@deftypefn {} {int} unur_distr_cont_set_logpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{logpdf}) +@deftypefnx {} {int} unur_distr_cont_set_dlogpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{dlogpdf}) +@deftypefnx {} {int} unur_distr_cont_set_logcdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{logcdf}) +@deftypefnx {} {UNUR_FUNCT_CONT*} unur_distr_cont_get_logpdf (const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {UNUR_FUNCT_CONT*} unur_distr_cont_get_dlogpdf (const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {UNUR_FUNCT_CONT*} unur_distr_cont_get_logcdf (const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {double} unur_distr_cont_eval_logpdf (double @var{x}, const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {double} unur_distr_cont_eval_dlogpdf (double @var{x}, const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {double} unur_distr_cont_eval_logcdf (double @var{x}, const @var{UNUR_DISTR* distribution}) +Analogous calls for the logarithm of the density distribution functions. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_set_pdfstr} +@deftypefn Function {int} unur_distr_cont_set_pdfstr (UNUR_DISTR* @var{distribution}, const @var{char* pdfstr}) +This function provides an alternative way to set a PDF and its +derivative of the @var{distribution}. +@var{pdfstr} is a character string that contains the formula +for the PDF, see @ref{StringFunct,,Function String}, for details. +The derivative of the given PDF is computed automatically. +See also the remarks for the +@ifhtml +@ref{funct:unur_distr_cont_set_pdf,@command{unur_distr_cont_set_pdf}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdf} +@end ifnothtml +call. + +It is not possible to call this funtion twice or to call this +function after a +@ifhtml +@ref{funct:unur_distr_cont_set_pdf,@command{unur_distr_cont_set_pdf}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdf} +@end ifnothtml +call. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_set_pdfstr} +@deftypefn {} {int} unur_distr_cont_set_pdfstr (UNUR_DISTR* @var{distribution}, const @var{char* pdfstr}) +This function provides an alternative way to set a PDF and its +derivative of the @var{distribution}. +@var{pdfstr} is a character string that contains the formula +for the PDF, see @ref{StringFunct,,Function String}, for details. +The derivative of the given PDF is computed automatically. +See also the remarks for the +@ifhtml +@ref{funct:unur_distr_cont_set_pdf,@command{unur_distr_cont_set_pdf}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdf} +@end ifnothtml +call. + +It is not possible to call this funtion twice or to call this +function after a +@ifhtml +@ref{funct:unur_distr_cont_set_pdf,@command{unur_distr_cont_set_pdf}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdf} +@end ifnothtml +call. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_set_cdfstr} +@deftypefn Function {int} unur_distr_cont_set_cdfstr (UNUR_DISTR* @var{distribution}, const @var{char* cdfstr}) +This function provides an alternative way to set a CDF; analogously +to the +@ifhtml +@ref{funct:unur_distr_cont_set_pdfstr,@command{unur_distr_cont_set_pdfstr}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdfstr} +@end ifnothtml +call. +The PDF and its derivative of the given CDF are computed automatically. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_set_cdfstr} +@deftypefn {} {int} unur_distr_cont_set_cdfstr (UNUR_DISTR* @var{distribution}, const @var{char* cdfstr}) +This function provides an alternative way to set a CDF; analogously +to the +@ifhtml +@ref{funct:unur_distr_cont_set_pdfstr,@command{unur_distr_cont_set_pdfstr}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdfstr} +@end ifnothtml +call. +The PDF and its derivative of the given CDF are computed automatically. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_get_pdfstr} +@anchor{funct:unur_distr_cont_get_dpdfstr} +@anchor{funct:unur_distr_cont_get_cdfstr} +@deftypefn Function {char*} unur_distr_cont_get_pdfstr (const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {char*} unur_distr_cont_get_dpdfstr (const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {char*} unur_distr_cont_get_cdfstr (const @var{UNUR_DISTR* distribution}) +Get pointer to respective string for PDF, derivate of PDF, and CDF +of @var{distribution} that is given as string (instead of a +function pointer). +This call allocates memory to produce this string. It should be +freed when it is not used any more. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_get_pdfstr} +@anchor{funct:unur_distr_cont_get_dpdfstr} +@anchor{funct:unur_distr_cont_get_cdfstr} +@deftypefn {} {char*} unur_distr_cont_get_pdfstr (const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {char*} unur_distr_cont_get_dpdfstr (const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {char*} unur_distr_cont_get_cdfstr (const @var{UNUR_DISTR* distribution}) +Get pointer to respective string for PDF, derivate of PDF, and CDF +of @var{distribution} that is given as string (instead of a +function pointer). +This call allocates memory to produce this string. It should be +freed when it is not used any more. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_set_pdfparams} +@deftypefn Function {int} unur_distr_cont_set_pdfparams (UNUR_DISTR* @var{distribution}, const @var{double* params}, int @var{n_params}) +Sets array of parameters for @var{distribution}. There is an upper limit +for the number of parameters @code{n_params}. It is given by the +macro @code{UNUR_DISTR_MAXPARAMS} in @file{unuran_config.h}. (It is set to +5 by default but can be changed to any appropriate nonnegative number.) +If @var{n_params} is negative or exceeds this limit no parameters +are copied into the distribution object and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_NPARAMS}. + +For standard distributions from the UNU.RAN library the parameters +are checked. Moreover, the domain is updated automatically unless it +has been changed before by a +@ifhtml +@ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_domain} +@end ifnothtml +call. +If the given parameters are invalid for the standard distribution, +then no parameters are set and an error code is returned. +Notice, that the given parameter list for such a distribution is +handled in the same way as in the corresponding @command{new} +calls, i.e. optional parameters for the PDF that are not present in +the given list are (re-)set to their default values. + +@strong{Important:} If the parameters of a distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}) +are changed, then neither its mode nor the normalization +constant are updated. Please use the respective calls +@ifhtml +@ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_mode} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_pdfarea}. +@end ifnothtml +Moreover, if the domain has been changed by a +@ifhtml +@ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_domain} +@end ifnothtml +it is not automatically updated, either. +Updating the normalization constant is in particular very important, +when the CDF of the distribution is used. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_set_pdfparams} +@deftypefn {} {int} unur_distr_cont_set_pdfparams (UNUR_DISTR* @var{distribution}, const @var{double* params}, int @var{n_params}) +Sets array of parameters for @var{distribution}. There is an upper limit +for the number of parameters @code{n_params}. It is given by the +macro @code{UNUR_DISTR_MAXPARAMS} in @file{unuran_config.h}. (It is set to +5 by default but can be changed to any appropriate nonnegative number.) +If @var{n_params} is negative or exceeds this limit no parameters +are copied into the distribution object and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_NPARAMS}. + +For standard distributions from the UNU.RAN library the parameters +are checked. Moreover, the domain is updated automatically unless it +has been changed before by a +@ifhtml +@ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_domain} +@end ifnothtml +call. +If the given parameters are invalid for the standard distribution, +then no parameters are set and an error code is returned. +Notice, that the given parameter list for such a distribution is +handled in the same way as in the corresponding @command{new} +calls, i.e. optional parameters for the PDF that are not present in +the given list are (re-)set to their default values. + +@strong{Important:} If the parameters of a distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}) +are changed, then neither its mode nor the normalization +constant are updated. Please use the respective calls +@ifhtml +@ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_mode} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_pdfarea}. +@end ifnothtml +Moreover, if the domain has been changed by a +@ifhtml +@ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_domain} +@end ifnothtml +it is not automatically updated, either. +Updating the normalization constant is in particular very important, +when the CDF of the distribution is used. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_get_pdfparams} +@deftypefn Function {int} unur_distr_cont_get_pdfparams (const @var{UNUR_DISTR* distribution}, const @var{double** params}) +Get number of parameters of the PDF and set pointer @var{params} to +array of parameters. If no parameters are stored in the object, an +error code is returned and @code{params} is set to @code{NULL}. + +@emph{Important:} Do @strong{not} change the entries in @var{params}! +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_get_pdfparams} +@deftypefn {} {int} unur_distr_cont_get_pdfparams (const @var{UNUR_DISTR* distribution}, const @var{double** params}) +Get number of parameters of the PDF and set pointer @var{params} to +array of parameters. If no parameters are stored in the object, an +error code is returned and @code{params} is set to @code{NULL}. + +@emph{Important:} Do @strong{not} change the entries in @var{params}! +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_set_pdfparams_vec} +@deftypefn Function {int} unur_distr_cont_set_pdfparams_vec (UNUR_DISTR* @var{distribution}, int @var{par}, const @var{double* param_vec}, int @var{n_param_vec}) +This function provides an interface for additional vector parameters for a +continuous @var{distribution}. + +It sets the parameter with number @var{par}. +@var{par} indicates directly which of the parameters is set and +must be a number between @code{0} and @code{UNUR_DISTR_MAXPARAMS}-1 +(the upper limit of possible parameters defined in +@file{unuran_config.h}; it is set to 5 but can be changed to any +appropriate nonnegative number.) + +The entries of a this parameter are given by the array @var{param_vec} +of size @var{n_param_vec}. + +If @var{param_vec} is @code{NULL} then the corresponding entry is cleared. + +If an error occurs no parameters are copied into the parameter +object @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_set_pdfparams_vec} +@deftypefn {} {int} unur_distr_cont_set_pdfparams_vec (UNUR_DISTR* @var{distribution}, int @var{par}, const @var{double* param_vec}, int @var{n_param_vec}) +This function provides an interface for additional vector parameters for a +continuous @var{distribution}. + +It sets the parameter with number @var{par}. +@var{par} indicates directly which of the parameters is set and +must be a number between @code{0} and @code{UNUR_DISTR_MAXPARAMS}-1 +(the upper limit of possible parameters defined in +@file{unuran_config.h}; it is set to 5 but can be changed to any +appropriate nonnegative number.) + +The entries of a this parameter are given by the array @var{param_vec} +of size @var{n_param_vec}. + +If @var{param_vec} is @code{NULL} then the corresponding entry is cleared. + +If an error occurs no parameters are copied into the parameter +object @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_get_pdfparams_vec} +@deftypefn Function {int} unur_distr_cont_get_pdfparams_vec (const @var{UNUR_DISTR* distribution}, int @var{par}, const @var{double** param_vecs}) +Get parameter of the PDF with number @var{par}. +The pointer to the parameter array is stored in @var{param_vecs}, its +size is returned by the function. +If the requested parameter is not set, then an error code is returned +and @code{params} is set to @code{NULL}. + +@emph{Important:} Do @strong{not} change the entries in @var{param_vecs}! +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_get_pdfparams_vec} +@deftypefn {} {int} unur_distr_cont_get_pdfparams_vec (const @var{UNUR_DISTR* distribution}, int @var{par}, const @var{double** param_vecs}) +Get parameter of the PDF with number @var{par}. +The pointer to the parameter array is stored in @var{param_vecs}, its +size is returned by the function. +If the requested parameter is not set, then an error code is returned +and @code{params} is set to @code{NULL}. + +@emph{Important:} Do @strong{not} change the entries in @var{param_vecs}! +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_set_logpdfstr} +@anchor{funct:unur_distr_cont_get_logpdfstr} +@anchor{funct:unur_distr_cont_get_dlogpdfstr} +@anchor{funct:unur_distr_cont_set_logcdfstr} +@anchor{funct:unur_distr_cont_get_logcdfstr} +@deftypefn Function {int} unur_distr_cont_set_logpdfstr (UNUR_DISTR* @var{distribution}, const @var{char* logpdfstr}) +@deftypefnx Function {char*} unur_distr_cont_get_logpdfstr (const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {char*} unur_distr_cont_get_dlogpdfstr (const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {int} unur_distr_cont_set_logcdfstr (UNUR_DISTR* @var{distribution}, const @var{char* logcdfstr}) +@deftypefnx Function {char*} unur_distr_cont_get_logcdfstr (const @var{UNUR_DISTR* distribution}) +Analogous calls for the logarithm of the density and distribution functions. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_set_logpdfstr} +@anchor{funct:unur_distr_cont_get_logpdfstr} +@anchor{funct:unur_distr_cont_get_dlogpdfstr} +@anchor{funct:unur_distr_cont_set_logcdfstr} +@anchor{funct:unur_distr_cont_get_logcdfstr} +@deftypefn {} {int} unur_distr_cont_set_logpdfstr (UNUR_DISTR* @var{distribution}, const @var{char* logpdfstr}) +@deftypefnx {} {char*} unur_distr_cont_get_logpdfstr (const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {char*} unur_distr_cont_get_dlogpdfstr (const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {int} unur_distr_cont_set_logcdfstr (UNUR_DISTR* @var{distribution}, const @var{char* logcdfstr}) +@deftypefnx {} {char*} unur_distr_cont_get_logcdfstr (const @var{UNUR_DISTR* distribution}) +Analogous calls for the logarithm of the density and distribution functions. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_set_domain} +@deftypefn Function {int} unur_distr_cont_set_domain (UNUR_DISTR* @var{distribution}, double @var{left}, double @var{right}) +Set the left and right borders of the domain of the +distribution. This can also be used to truncate an existing +distribution. For setting the boundary to +@math{+/- infinity} +use @code{+/- UNUR_INFINITY}. +If @var{right} is not strictly greater than @var{left} no domain +is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. + +@emph{Important:} For some technical reasons it is assumed that the density +is unimodal and thus monotone on either side of the mode! This is used in +the case when the given mode is outside of the original domain. Then the +mode is set to the corresponding boundary of the new domain. +If this result is not the desired it must be changed by using a +@ifhtml +@ref{funct:unur_distr_cont_set_mode,@command{unur_distr_cont_set_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_mode} +@end ifnothtml +call (or a +@ifhtml +@ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_mode} +@end ifnothtml +call). The same holds for the center of the distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_set_domain} +@deftypefn {} {int} unur_distr_cont_set_domain (UNUR_DISTR* @var{distribution}, double @var{left}, double @var{right}) +Set the left and right borders of the domain of the +distribution. This can also be used to truncate an existing +distribution. For setting the boundary to +@iftex +@math{\pm\infty} +@end iftex +@ifhtml +@html ++/- infinity +@end html +@end ifhtml +use @code{+/- UNUR_INFINITY}. +If @var{right} is not strictly greater than @var{left} no domain +is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. + +@emph{Important:} For some technical reasons it is assumed that the density +is unimodal and thus monotone on either side of the mode! This is used in +the case when the given mode is outside of the original domain. Then the +mode is set to the corresponding boundary of the new domain. +If this result is not the desired it must be changed by using a +@ifhtml +@ref{funct:unur_distr_cont_set_mode,@command{unur_distr_cont_set_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_mode} +@end ifnothtml +call (or a +@ifhtml +@ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_mode} +@end ifnothtml +call). The same holds for the center of the distribution. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_get_domain} +@deftypefn Function {int} unur_distr_cont_get_domain (const @var{UNUR_DISTR* distribution}, double* @var{left}, double* @var{right}) +Get the left and right borders of the domain of the +distribution. If the domain is not set @code{+/- UNUR_INFINITY} is +assumed and returned. No error is reported in this case. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_get_domain} +@deftypefn {} {int} unur_distr_cont_get_domain (const @var{UNUR_DISTR* distribution}, double* @var{left}, double* @var{right}) +Get the left and right borders of the domain of the +distribution. If the domain is not set @code{+/- UNUR_INFINITY} is +assumed and returned. No error is reported in this case. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_get_truncated} +@deftypefn Function {int} unur_distr_cont_get_truncated (const @var{UNUR_DISTR* distribution}, double* @var{left}, double* @var{right}) +Get the left and right borders of the (truncated) domain of the +distribution. For non-truncated distribution this call is +equivalent to the +@ifhtml +@ref{funct:unur_distr_cont_get_domain,@command{unur_distr_cont_get_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_get_domain} +@end ifnothtml +call. + +This call is only useful in connection with a +@ifhtml +@ref{funct:unur_get_distr,@command{unur_get_distr}} +@end ifhtml +@ifnothtml +@command{unur_get_distr} +@end ifnothtml +call +to get the boundaries of the sampling region of a generator object. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_get_truncated} +@deftypefn {} {int} unur_distr_cont_get_truncated (const @var{UNUR_DISTR* distribution}, double* @var{left}, double* @var{right}) +Get the left and right borders of the (truncated) domain of the +distribution. For non-truncated distribution this call is +equivalent to the +@ifhtml +@ref{funct:unur_distr_cont_get_domain,@command{unur_distr_cont_get_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_get_domain} +@end ifnothtml +call. + +This call is only useful in connection with a +@ifhtml +@ref{funct:unur_get_distr,@command{unur_get_distr}} +@end ifhtml +@ifnothtml +@command{unur_get_distr} +@end ifnothtml +call +to get the boundaries of the sampling region of a generator object. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_set_hr} +@deftypefn Function {int} unur_distr_cont_set_hr (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{hazard}) +Set pointer to the hazard rate (HR) of the @var{distribution}. + +The @emph{hazard rate} (or failure rate) is a mathematical way of +describing aging. If the lifetime @i{X} is a random variable with +density @i{f(x)} and CDF @i{F(x)} the hazard rate @i{h(x)} +is defined as @i{h(x) = f(x) / (1-F(x))}. +In other words, @i{h(x)} represents the (conditional) rate of +failure of a unit that has survived up to time @i{x} with +probability @i{1-F(x)}. +The key distribution is the exponential distribution as it has +constant hazard rate of value 1. Hazard rates tending to infinity +describe distributions with sub-exponential tails whereas +distributions with hazard rates tending to zero have heavier tails +than the exponential distribution. + +It is important to note that all these functions must return a +result for all floats @i{x}. In case of an overflow the PDF should +return @code{UNUR_INFINITY}. + +@strong{Important}: Do not simply use @i{f(x) / (1-F(x))}, since +this is numerically very unstable and results in numerical noise +if @i{F(x)} is (very) close to 1. Moreover, if the density @i{f(x)} +is known a generation method that uses the density is more +appropriate. + +It is not possible to change such a function. Once the HR is set it +cannot be overwritten. This also holds when the HR is given by the +@ifhtml +@ref{funct:unur_distr_cont_set_hrstr,@command{unur_distr_cont_set_hrstr}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_hrstr} +@end ifnothtml +call. A new distribution object has to +be used instead. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_set_hr} +@deftypefn {} {int} unur_distr_cont_set_hr (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{hazard}) +Set pointer to the hazard rate (HR) of the @var{distribution}. + +The @emph{hazard rate} (or failure rate) is a mathematical way of +describing aging. If the lifetime @i{X} is a random variable with +density @i{f(x)} and CDF @i{F(x)} the hazard rate @i{h(x)} +is defined as @i{h(x) = f(x) / (1-F(x))}. +In other words, @i{h(x)} represents the (conditional) rate of +failure of a unit that has survived up to time @i{x} with +probability @i{1-F(x)}. +The key distribution is the exponential distribution as it has +constant hazard rate of value 1. Hazard rates tending to infinity +describe distributions with sub-exponential tails whereas +distributions with hazard rates tending to zero have heavier tails +than the exponential distribution. + +It is important to note that all these functions must return a +result for all floats @i{x}. In case of an overflow the PDF should +return @code{UNUR_INFINITY}. + +@strong{Important}: Do not simply use @i{f(x) / (1-F(x))}, since +this is numerically very unstable and results in numerical noise +if @i{F(x)} is (very) close to 1. Moreover, if the density @i{f(x)} +is known a generation method that uses the density is more +appropriate. + +It is not possible to change such a function. Once the HR is set it +cannot be overwritten. This also holds when the HR is given by the +@ifhtml +@ref{funct:unur_distr_cont_set_hrstr,@command{unur_distr_cont_set_hrstr}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_hrstr} +@end ifnothtml +call. A new distribution object has to +be used instead. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_get_hr} +@deftypefn Function {UNUR_FUNCT_CONT*} unur_distr_cont_get_hr (const @var{UNUR_DISTR* distribution}) +Get the pointer to the hazard rate of the @var{distribution}. The +pointer is of type +@code{double funct(double x, const UNUR_DISTR *distr)}. +If the corresponding function is not available for the distribution, +the @code{NULL} pointer is returned. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_get_hr} +@deftypefn {} {UNUR_FUNCT_CONT*} unur_distr_cont_get_hr (const @var{UNUR_DISTR* distribution}) +Get the pointer to the hazard rate of the @var{distribution}. The +pointer is of type +@code{double funct(double x, const UNUR_DISTR *distr)}. +If the corresponding function is not available for the distribution, +the @code{NULL} pointer is returned. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_eval_hr} +@deftypefn Function {double} unur_distr_cont_eval_hr (double @var{x}, const @var{UNUR_DISTR* distribution}) +Evaluate the hazard rate at @var{x}. +Notice that @var{distribution} must not be the @code{NULL} pointer. +If the corresponding function is not available for the distribution, +@code{UNUR_INFINITY} is returned and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_DATA}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_eval_hr} +@deftypefn {} {double} unur_distr_cont_eval_hr (double @var{x}, const @var{UNUR_DISTR* distribution}) +Evaluate the hazard rate at @var{x}. +Notice that @var{distribution} must not be the @code{NULL} pointer. +If the corresponding function is not available for the distribution, +@code{UNUR_INFINITY} is returned and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_DATA}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_set_hrstr} +@deftypefn Function {int} unur_distr_cont_set_hrstr (UNUR_DISTR* @var{distribution}, const @var{char* hrstr}) +This function provides an alternative way to set a hazard rate and its +derivative of the @var{distribution}. +@var{hrstr} is a character string that contains the formula +for the HR, see @ref{StringFunct,,Function String}, for details. +See also the remarks for the +@ifhtml +@ref{funct:unur_distr_cont_set_hr,@command{unur_distr_cont_set_hr}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_hr} +@end ifnothtml +call. + +It is not possible to call this funtion twice or to call this +function after a +@ifhtml +@ref{funct:unur_distr_cont_set_hr,@command{unur_distr_cont_set_hr}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_hr} +@end ifnothtml +call. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_set_hrstr} +@deftypefn {} {int} unur_distr_cont_set_hrstr (UNUR_DISTR* @var{distribution}, const @var{char* hrstr}) +This function provides an alternative way to set a hazard rate and its +derivative of the @var{distribution}. +@var{hrstr} is a character string that contains the formula +for the HR, see @ref{StringFunct,,Function String}, for details. +See also the remarks for the +@ifhtml +@ref{funct:unur_distr_cont_set_hr,@command{unur_distr_cont_set_hr}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_hr} +@end ifnothtml +call. + +It is not possible to call this funtion twice or to call this +function after a +@ifhtml +@ref{funct:unur_distr_cont_set_hr,@command{unur_distr_cont_set_hr}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_hr} +@end ifnothtml +call. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_get_hrstr} +@deftypefn Function {char*} unur_distr_cont_get_hrstr (const @var{UNUR_DISTR* distribution}) +Get pointer to string for HR of @var{distribution} that is given +via the string interface. This call allocates memory to produce +this string. It should be freed when it is not used any more. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_get_hrstr} +@deftypefn {} {char*} unur_distr_cont_get_hrstr (const @var{UNUR_DISTR* distribution}) +Get pointer to string for HR of @var{distribution} that is given +via the string interface. This call allocates memory to produce +this string. It should be freed when it is not used any more. +@end deftypefn +@end ifnotinfo + +@subsubheading Derived parameters + +The following paramters @strong{must} be set whenever one of the essential +parameters has been set or changed (and the parameter is required +for the chosen method). + +@ifinfo +@anchor{funct:unur_distr_cont_set_mode} +@deftypefn Function {int} unur_distr_cont_set_mode (UNUR_DISTR* @var{distribution}, double @var{mode}) +Set mode of @var{distribution}. The @var{mode} must be contained in +the domain of @var{distribution}. Otherwise the mode is not set and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. +For distributions with unbounded density, this call is used to set +the pole of the PDF. Notice that the PDF should then return +@code{UNUR_INFINITY} at the pole. +Notice that the mode is adjusted when the domain is set, see the +remark for the +@ifhtml +@ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_domain} +@end ifnothtml +call. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_set_mode} +@deftypefn {} {int} unur_distr_cont_set_mode (UNUR_DISTR* @var{distribution}, double @var{mode}) +Set mode of @var{distribution}. The @var{mode} must be contained in +the domain of @var{distribution}. Otherwise the mode is not set and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. +For distributions with unbounded density, this call is used to set +the pole of the PDF. Notice that the PDF should then return +@code{UNUR_INFINITY} at the pole. +Notice that the mode is adjusted when the domain is set, see the +remark for the +@ifhtml +@ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_domain} +@end ifnothtml +call. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_upd_mode} +@deftypefn Function {int} unur_distr_cont_upd_mode (UNUR_DISTR* @var{distribution}) +Recompute the mode of the @var{distribution}. This call works +properly for distribution objects from the UNU.RAN library of +standard distributions when the corresponding function is +available. Otherwise a (slow) numerical mode finder based on +Brent's algorithm is used. If it failes @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_DATA}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_upd_mode} +@deftypefn {} {int} unur_distr_cont_upd_mode (UNUR_DISTR* @var{distribution}) +Recompute the mode of the @var{distribution}. This call works +properly for distribution objects from the UNU.RAN library of +standard distributions when the corresponding function is +available. Otherwise a (slow) numerical mode finder based on +Brent's algorithm is used. If it failes @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_DATA}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_get_mode} +@deftypefn Function {double} unur_distr_cont_get_mode (UNUR_DISTR* @var{distribution}) +Get mode of @var{distribution}. If the mode is not marked as known, +@ifhtml +@ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_mode} +@end ifnothtml +is called to compute the mode. If this +is not successful @code{UNUR_INFINITY} is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. +(There is no difference between the case where no routine for +computing the mode is available and the case where no mode exists +for the distribution at all.) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_get_mode} +@deftypefn {} {double} unur_distr_cont_get_mode (UNUR_DISTR* @var{distribution}) +Get mode of @var{distribution}. If the mode is not marked as known, +@ifhtml +@ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_mode} +@end ifnothtml +is called to compute the mode. If this +is not successful @code{UNUR_INFINITY} is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. +(There is no difference between the case where no routine for +computing the mode is available and the case where no mode exists +for the distribution at all.) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_set_center} +@deftypefn Function {int} unur_distr_cont_set_center (UNUR_DISTR* @var{distribution}, double @var{center}) +Set center of the @var{distribution}. The center is used by some +methods to shift the distribution in order to decrease numerical +round-off error. If not given explicitly a default is used. + +@emph{Important:} This call does not check whether the center is +contained in the given domain. + +Default: The mode, if set by a +@ifhtml +@ref{funct:unur_distr_cont_set_mode,@command{unur_distr_cont_set_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_mode} +@end ifnothtml +or +@ifhtml +@ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_mode} +@end ifnothtml +call; otherwise @code{0}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_set_center} +@deftypefn {} {int} unur_distr_cont_set_center (UNUR_DISTR* @var{distribution}, double @var{center}) +Set center of the @var{distribution}. The center is used by some +methods to shift the distribution in order to decrease numerical +round-off error. If not given explicitly a default is used. + +@emph{Important:} This call does not check whether the center is +contained in the given domain. + +Default: The mode, if set by a +@ifhtml +@ref{funct:unur_distr_cont_set_mode,@command{unur_distr_cont_set_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_mode} +@end ifnothtml +or +@ifhtml +@ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_mode} +@end ifnothtml +call; otherwise @code{0}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_get_center} +@deftypefn Function {double} unur_distr_cont_get_center (const @var{UNUR_DISTR* distribution}) +Get center of the @var{distribution}. It always returns some point +as there always exists a default for the center, see +@ifhtml +@ref{funct:unur_distr_cont_set_center,@command{unur_distr_cont_set_center}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_center}. +@end ifnothtml +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_get_center} +@deftypefn {} {double} unur_distr_cont_get_center (const @var{UNUR_DISTR* distribution}) +Get center of the @var{distribution}. It always returns some point +as there always exists a default for the center, see +@ifhtml +@ref{funct:unur_distr_cont_set_center,@command{unur_distr_cont_set_center}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_center}. +@end ifnothtml +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_set_pdfarea} +@deftypefn Function {int} unur_distr_cont_set_pdfarea (UNUR_DISTR* @var{distribution}, double @var{area}) +Set the area below the PDF. If @code{area} is non-positive, no +area is set and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_SET}. + +For a distribution object created by the +UNU.RAN library of standard distributions you always should use +the +@ifhtml +@ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_pdfarea}. +@end ifnothtml +Otherwise there might be +ambiguous side-effects. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_set_pdfarea} +@deftypefn {} {int} unur_distr_cont_set_pdfarea (UNUR_DISTR* @var{distribution}, double @var{area}) +Set the area below the PDF. If @code{area} is non-positive, no +area is set and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_SET}. + +For a distribution object created by the +UNU.RAN library of standard distributions you always should use +the +@ifhtml +@ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_pdfarea}. +@end ifnothtml +Otherwise there might be +ambiguous side-effects. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_upd_pdfarea} +@deftypefn Function {int} unur_distr_cont_upd_pdfarea (UNUR_DISTR* @var{distribution}) +Recompute the area below the PDF of the distribution. +It only works for distribution objects from the +UNU.RAN library of standard distributions when the +corresponding function is available. Otherwise @code{unur_errno} is +set to @code{UNUR_ERR_DISTR_DATA}. + +This call also sets the normalization constant such that the given +PDF is the derivative of a given CDF, i.e. the area is 1. +However, for truncated distributions the area is smaller than 1. + +The call does not work for distributions from the +UNU.RAN library of standard distributions with truncated +domain when the CDF is not available. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_upd_pdfarea} +@deftypefn {} {int} unur_distr_cont_upd_pdfarea (UNUR_DISTR* @var{distribution}) +Recompute the area below the PDF of the distribution. +It only works for distribution objects from the +UNU.RAN library of standard distributions when the +corresponding function is available. Otherwise @code{unur_errno} is +set to @code{UNUR_ERR_DISTR_DATA}. + +This call also sets the normalization constant such that the given +PDF is the derivative of a given CDF, i.e. the area is 1. +However, for truncated distributions the area is smaller than 1. + +The call does not work for distributions from the +UNU.RAN library of standard distributions with truncated +domain when the CDF is not available. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cont_get_pdfarea} +@deftypefn Function {double} unur_distr_cont_get_pdfarea (UNUR_DISTR* @var{distribution}) +Get the area below the PDF of the distribution. If this area is +not known,@* +@ifhtml +@ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_pdfarea} +@end ifnothtml +is called to compute +it. If this is not successful @code{UNUR_INFINITY} is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cont_get_pdfarea} +@deftypefn {} {double} unur_distr_cont_get_pdfarea (UNUR_DISTR* @var{distribution}) +Get the area below the PDF of the distribution. If this area is +not known,@* +@ifhtml +@ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_pdfarea} +@end ifnothtml +is called to compute +it. If this is not successful @code{UNUR_INFINITY} is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of cont.h +@c ------------------------------------- +@c ------------------------------------- +@c corder.h +@c + +@page +@node CORDER +@section Continuous univariate order statistics + + +These are special cases of a continuous univariate distributions +and thus they have most of these parameters (with the exception +that functions cannot be changed). Additionally, + +@itemize @minus +@item there is a call to extract the underlying distribution, + +@item and a call to handle the @command{rank} of the order +statistics. + +@end itemize + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_distr_corder_new,unur_distr_corder_new} +@item @ref{funct:unur_distr_corder_get_distribution,unur_distr_corder_get_distribution} +@item @ref{funct:unur_distr_corder_set_rank,unur_distr_corder_set_rank} +@item @ref{funct:unur_distr_corder_get_rank,unur_distr_corder_get_rank} +@item @ref{funct:unur_distr_corder_get_pdf,unur_distr_corder_get_pdf} +@item @ref{funct:unur_distr_corder_get_dpdf,unur_distr_corder_get_dpdf} +@item @ref{funct:unur_distr_corder_get_cdf,unur_distr_corder_get_cdf} +@item @ref{funct:unur_distr_corder_eval_pdf,unur_distr_corder_eval_pdf} +@item @ref{funct:unur_distr_corder_eval_dpdf,unur_distr_corder_eval_dpdf} +@item @ref{funct:unur_distr_corder_eval_cdf,unur_distr_corder_eval_cdf} +@item @ref{funct:unur_distr_corder_set_pdfparams,unur_distr_corder_set_pdfparams} +@item @ref{funct:unur_distr_corder_get_pdfparams,unur_distr_corder_get_pdfparams} +@item @ref{funct:unur_distr_corder_set_domain,unur_distr_corder_set_domain} +@item @ref{funct:unur_distr_corder_get_domain,unur_distr_corder_get_domain} +@item @ref{funct:unur_distr_corder_get_truncated,unur_distr_corder_get_truncated} +@item @ref{funct:unur_distr_corder_set_mode,unur_distr_corder_set_mode} +@item @ref{funct:unur_distr_corder_upd_mode,unur_distr_corder_upd_mode} +@item @ref{funct:unur_distr_corder_get_mode,unur_distr_corder_get_mode} +@item @ref{funct:unur_distr_corder_set_pdfarea,unur_distr_corder_set_pdfarea} +@item @ref{funct:unur_distr_corder_upd_pdfarea,unur_distr_corder_upd_pdfarea} +@item @ref{funct:unur_distr_corder_get_pdfarea,unur_distr_corder_get_pdfarea} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_distr_corder_new} +@deftypefn Function {UNUR_DISTR*} unur_distr_corder_new (const @var{UNUR_DISTR* distribution}, int @var{n}, int @var{k}) +Create an object for order statistics of sample size +@var{n} and rank @var{k}. +@var{distribution} must be a pointer to a univariate continuous +distribution. +The resulting generator object is of the same type as of a +@ifhtml +@ref{funct:unur_distr_cont_new,@command{unur_distr_cont_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_new} +@end ifnothtml +call. +(However, it cannot be used to make an order statistics out of an +order statistics.) + +To have a PDF for the order statistics, the given distribution +object must contain a CDF and a PDF. Moreover, it is assumed that +the given PDF is the derivative of the given CDF. Otherwise the +area below the PDF of the order statistics is not computed correctly. + +@emph{Important:} There is no warning when the computed area below +the PDF of the order statistics is wrong. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_corder_new} +@deftypefn {} {UNUR_DISTR*} unur_distr_corder_new (const @var{UNUR_DISTR* distribution}, int @var{n}, int @var{k}) +Create an object for order statistics of sample size +@var{n} and rank @var{k}. +@var{distribution} must be a pointer to a univariate continuous +distribution. +The resulting generator object is of the same type as of a +@ifhtml +@ref{funct:unur_distr_cont_new,@command{unur_distr_cont_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_new} +@end ifnothtml +call. +(However, it cannot be used to make an order statistics out of an +order statistics.) + +To have a PDF for the order statistics, the given distribution +object must contain a CDF and a PDF. Moreover, it is assumed that +the given PDF is the derivative of the given CDF. Otherwise the +area below the PDF of the order statistics is not computed correctly. + +@emph{Important:} There is no warning when the computed area below +the PDF of the order statistics is wrong. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_corder_get_distribution} +@deftypefn Function {const UNUR_DISTR*} unur_distr_corder_get_distribution (const @var{UNUR_DISTR* distribution}) +Get pointer to distribution object for underlying distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_corder_get_distribution} +@deftypefn {} {const UNUR_DISTR*} unur_distr_corder_get_distribution (const @var{UNUR_DISTR* distribution}) +Get pointer to distribution object for underlying distribution. +@end deftypefn +@end ifnotinfo + +@subsubheading Essential parameters + +@ifinfo +@anchor{funct:unur_distr_corder_set_rank} +@deftypefn Function {int} unur_distr_corder_set_rank (UNUR_DISTR* @var{distribution}, int @var{n}, int @var{k}) +Change sample size @var{n} and rank @var{k} of order statistics. +In case of invalid data, no parameters are changed. +The area below the PDF can be set to that of the underlying +distribution by a +@ifhtml +@ref{funct:unur_distr_corder_upd_pdfarea,@command{unur_distr_corder_upd_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_corder_upd_pdfarea} +@end ifnothtml +call. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_corder_set_rank} +@deftypefn {} {int} unur_distr_corder_set_rank (UNUR_DISTR* @var{distribution}, int @var{n}, int @var{k}) +Change sample size @var{n} and rank @var{k} of order statistics. +In case of invalid data, no parameters are changed. +The area below the PDF can be set to that of the underlying +distribution by a +@ifhtml +@ref{funct:unur_distr_corder_upd_pdfarea,@command{unur_distr_corder_upd_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_corder_upd_pdfarea} +@end ifnothtml +call. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_corder_get_rank} +@deftypefn Function {int} unur_distr_corder_get_rank (const @var{UNUR_DISTR* distribution}, int* @var{n}, int* @var{k}) +Get sample size @var{n} and rank @var{k} of order statistics. +In case of error an error code is returned. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_corder_get_rank} +@deftypefn {} {int} unur_distr_corder_get_rank (const @var{UNUR_DISTR* distribution}, int* @var{n}, int* @var{k}) +Get sample size @var{n} and rank @var{k} of order statistics. +In case of error an error code is returned. +@end deftypefn +@end ifnotinfo + +Additionally most of the set and get calls for continuous +univariate distributions work. The most important exceptions are +that the PDF and CDF cannot be changed and +@ifhtml +@ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_mode} +@end ifnothtml +uses in any way a (slow) numerical +method that might fail. + +@ifinfo +@anchor{funct:unur_distr_corder_get_pdf} +@anchor{funct:unur_distr_corder_get_dpdf} +@anchor{funct:unur_distr_corder_get_cdf} +@deftypefn Function {UNUR_FUNCT_CONT*} unur_distr_corder_get_pdf (UNUR_DISTR* @var{distribution}) +@deftypefnx Function {UNUR_FUNCT_CONT*} unur_distr_corder_get_dpdf (UNUR_DISTR* @var{distribution}) +@deftypefnx Function {UNUR_FUNCT_CONT*} unur_distr_corder_get_cdf (UNUR_DISTR* @var{distribution}) +Get the respective pointer to the PDF, the derivative of the +PDF and the CDF of the distribution, respectively. The pointer is of type +@code{double funct(double x, UNUR_DISTR *distr)}. +If the corresponding function is not available for the distribution, +the @code{NULL} pointer is returned. +See also +@ifhtml +@ref{funct:unur_distr_cont_get_pdf,@command{unur_distr_cont_get_pdf}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_get_pdf}. +@end ifnothtml +(Macro) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_corder_get_pdf} +@anchor{funct:unur_distr_corder_get_dpdf} +@anchor{funct:unur_distr_corder_get_cdf} +@deftypefn {} {UNUR_FUNCT_CONT*} unur_distr_corder_get_pdf (UNUR_DISTR* @var{distribution}) +@deftypefnx {} {UNUR_FUNCT_CONT*} unur_distr_corder_get_dpdf (UNUR_DISTR* @var{distribution}) +@deftypefnx {} {UNUR_FUNCT_CONT*} unur_distr_corder_get_cdf (UNUR_DISTR* @var{distribution}) +Get the respective pointer to the PDF, the derivative of the +PDF and the CDF of the distribution, respectively. The pointer is of type +@code{double funct(double x, UNUR_DISTR *distr)}. +If the corresponding function is not available for the distribution, +the @code{NULL} pointer is returned. +See also +@ifhtml +@ref{funct:unur_distr_cont_get_pdf,@command{unur_distr_cont_get_pdf}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_get_pdf}. +@end ifnothtml +(Macro) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_corder_eval_pdf} +@anchor{funct:unur_distr_corder_eval_dpdf} +@anchor{funct:unur_distr_corder_eval_cdf} +@deftypefn Function {double} unur_distr_corder_eval_pdf (double @var{x}, UNUR_DISTR* @var{distribution}) +@deftypefnx Function {double} unur_distr_corder_eval_dpdf (double @var{x}, UNUR_DISTR* @var{distribution}) +@deftypefnx Function {double} unur_distr_corder_eval_cdf (double @var{x}, UNUR_DISTR* @var{distribution}) +Evaluate the PDF, derivative of the PDF. and the CDF, +respectively, at @var{x}. +Notice that @var{distribution} must not be the @code{NULL} pointer. +If the corresponding function is not available for the distribution, +@code{UNUR_INFINITY} is returned and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_DATA}. +See also +@ifhtml +@ref{funct:unur_distr_cont_eval_pdf,@command{unur_distr_cont_eval_pdf}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_eval_pdf}. +@end ifnothtml +(Macro) + +@emph{IMPORTANT:} +In the case of a truncated standard distribution these calls always +return the respective values of the @emph{untruncated} distribution! +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_corder_eval_pdf} +@anchor{funct:unur_distr_corder_eval_dpdf} +@anchor{funct:unur_distr_corder_eval_cdf} +@deftypefn {} {double} unur_distr_corder_eval_pdf (double @var{x}, UNUR_DISTR* @var{distribution}) +@deftypefnx {} {double} unur_distr_corder_eval_dpdf (double @var{x}, UNUR_DISTR* @var{distribution}) +@deftypefnx {} {double} unur_distr_corder_eval_cdf (double @var{x}, UNUR_DISTR* @var{distribution}) +Evaluate the PDF, derivative of the PDF. and the CDF, +respectively, at @var{x}. +Notice that @var{distribution} must not be the @code{NULL} pointer. +If the corresponding function is not available for the distribution, +@code{UNUR_INFINITY} is returned and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_DATA}. +See also +@ifhtml +@ref{funct:unur_distr_cont_eval_pdf,@command{unur_distr_cont_eval_pdf}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_eval_pdf}. +@end ifnothtml +(Macro) + +@emph{IMPORTANT:} +In the case of a truncated standard distribution these calls always +return the respective values of the @emph{untruncated} distribution! +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_corder_set_pdfparams} +@deftypefn Function {int} unur_distr_corder_set_pdfparams (UNUR_DISTR* @var{distribution}, double* @var{params}, int @var{n_params}) +Set array of parameters for underlying distribution. +See +@ifhtml +@ref{funct:unur_distr_cont_set_pdfparams,@command{unur_distr_cont_set_pdfparams}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdfparams} +@end ifnothtml +for details. +(Macro) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_corder_set_pdfparams} +@deftypefn {} {int} unur_distr_corder_set_pdfparams (UNUR_DISTR* @var{distribution}, double* @var{params}, int @var{n_params}) +Set array of parameters for underlying distribution. +See +@ifhtml +@ref{funct:unur_distr_cont_set_pdfparams,@command{unur_distr_cont_set_pdfparams}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdfparams} +@end ifnothtml +for details. +(Macro) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_corder_get_pdfparams} +@deftypefn Function {int} unur_distr_corder_get_pdfparams (UNUR_DISTR* @var{distribution}, double** @var{params}) +Get number of parameters of the PDF of the underlying distribution +and set pointer @var{params} to array of parameters. +See +@ifhtml +@ref{funct:unur_distr_cont_get_pdfparams,@command{unur_distr_cont_get_pdfparams}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_get_pdfparams} +@end ifnothtml +for details. +(Macro) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_corder_get_pdfparams} +@deftypefn {} {int} unur_distr_corder_get_pdfparams (UNUR_DISTR* @var{distribution}, double** @var{params}) +Get number of parameters of the PDF of the underlying distribution +and set pointer @var{params} to array of parameters. +See +@ifhtml +@ref{funct:unur_distr_cont_get_pdfparams,@command{unur_distr_cont_get_pdfparams}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_get_pdfparams} +@end ifnothtml +for details. +(Macro) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_corder_set_domain} +@deftypefn Function {int} unur_distr_corder_set_domain (UNUR_DISTR* @var{distribution}, double @var{left}, double @var{right}) +Set the left and right borders of the domain of the +distribution. +See +@ifhtml +@ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_domain} +@end ifnothtml +for details. +(Macro) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_corder_set_domain} +@deftypefn {} {int} unur_distr_corder_set_domain (UNUR_DISTR* @var{distribution}, double @var{left}, double @var{right}) +Set the left and right borders of the domain of the +distribution. +See +@ifhtml +@ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_domain} +@end ifnothtml +for details. +(Macro) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_corder_get_domain} +@deftypefn Function {int} unur_distr_corder_get_domain (UNUR_DISTR* @var{distribution}, double* @var{left}, double* @var{right}) +Get the left and right borders of the domain of the +distribution. +See +@ifhtml +@ref{funct:unur_distr_cont_get_domain,@command{unur_distr_cont_get_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_get_domain} +@end ifnothtml +for details. +(Macro) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_corder_get_domain} +@deftypefn {} {int} unur_distr_corder_get_domain (UNUR_DISTR* @var{distribution}, double* @var{left}, double* @var{right}) +Get the left and right borders of the domain of the +distribution. +See +@ifhtml +@ref{funct:unur_distr_cont_get_domain,@command{unur_distr_cont_get_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_get_domain} +@end ifnothtml +for details. +(Macro) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_corder_get_truncated} +@deftypefn Function {int} unur_distr_corder_get_truncated (UNUR_DISTR* @var{distribution}, double* @var{left}, double* @var{right}) +Get the left and right borders of the (truncated) domain of the +distribution. +See +@ifhtml +@ref{funct:unur_distr_cont_get_truncated,@command{unur_distr_cont_get_truncated}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_get_truncated} +@end ifnothtml +for details. +(Macro) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_corder_get_truncated} +@deftypefn {} {int} unur_distr_corder_get_truncated (UNUR_DISTR* @var{distribution}, double* @var{left}, double* @var{right}) +Get the left and right borders of the (truncated) domain of the +distribution. +See +@ifhtml +@ref{funct:unur_distr_cont_get_truncated,@command{unur_distr_cont_get_truncated}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_get_truncated} +@end ifnothtml +for details. +(Macro) +@end deftypefn +@end ifnotinfo + +@subsubheading Derived parameters + +The following paramters @strong{must} be set whenever one of the essential +parameters has been set or changed (and the parameter is required +for the chosen method). + +@ifinfo +@anchor{funct:unur_distr_corder_set_mode} +@deftypefn Function {int} unur_distr_corder_set_mode (UNUR_DISTR* @var{distribution}, double @var{mode}) +Set mode of distribution. +See also +@ifhtml +@ref{funct:unur_distr_corder_set_mode,@command{unur_distr_corder_set_mode}.} +@end ifhtml +@ifnothtml +@command{unur_distr_corder_set_mode}. +@end ifnothtml +(Macro) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_corder_set_mode} +@deftypefn {} {int} unur_distr_corder_set_mode (UNUR_DISTR* @var{distribution}, double @var{mode}) +Set mode of distribution. +See also +@ifhtml +@ref{funct:unur_distr_corder_set_mode,@command{unur_distr_corder_set_mode}.} +@end ifhtml +@ifnothtml +@command{unur_distr_corder_set_mode}. +@end ifnothtml +(Macro) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_corder_upd_mode} +@deftypefn Function {double} unur_distr_corder_upd_mode (UNUR_DISTR* @var{distribution}) +Recompute the mode of the distribution numerically. Notice that +this routine is slow and might not work properly in every case. +See also +@ifhtml +@ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_mode} +@end ifnothtml +for further details. +(Macro) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_corder_upd_mode} +@deftypefn {} {double} unur_distr_corder_upd_mode (UNUR_DISTR* @var{distribution}) +Recompute the mode of the distribution numerically. Notice that +this routine is slow and might not work properly in every case. +See also +@ifhtml +@ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_mode} +@end ifnothtml +for further details. +(Macro) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_corder_get_mode} +@deftypefn Function {double} unur_distr_corder_get_mode (UNUR_DISTR* @var{distribution}) +Get mode of distribution. +See +@ifhtml +@ref{funct:unur_distr_cont_get_mode,@command{unur_distr_cont_get_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_get_mode} +@end ifnothtml +for details. +(Macro) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_corder_get_mode} +@deftypefn {} {double} unur_distr_corder_get_mode (UNUR_DISTR* @var{distribution}) +Get mode of distribution. +See +@ifhtml +@ref{funct:unur_distr_cont_get_mode,@command{unur_distr_cont_get_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_get_mode} +@end ifnothtml +for details. +(Macro) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_corder_set_pdfarea} +@deftypefn Function {int} unur_distr_corder_set_pdfarea (UNUR_DISTR* @var{distribution}, double @var{area}) +Set the area below the PDF. +See +@ifhtml +@ref{funct:unur_distr_cont_set_pdfarea,@command{unur_distr_cont_set_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdfarea} +@end ifnothtml +for details. +(Macro) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_corder_set_pdfarea} +@deftypefn {} {int} unur_distr_corder_set_pdfarea (UNUR_DISTR* @var{distribution}, double @var{area}) +Set the area below the PDF. +See +@ifhtml +@ref{funct:unur_distr_cont_set_pdfarea,@command{unur_distr_cont_set_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdfarea} +@end ifnothtml +for details. +(Macro) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_corder_upd_pdfarea} +@deftypefn Function {double} unur_distr_corder_upd_pdfarea (UNUR_DISTR* @var{distribution}) +Recompute the area below the PDF of the distribution. +It only works for order statistics for distribution objects from +the UNU.RAN library of standard distributions when the +corresponding function is available. +@ifhtml +@ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_pdfarea} +@end ifnothtml +assumes that the PDF of the underlying +distribution is normalized, i.e. it is the derivative of its CDF. +Otherwise the computed area is wrong and there is @strong{no} warning +about this failure. +See +@ifhtml +@ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_pdfarea} +@end ifnothtml +for further details. +(Macro) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_corder_upd_pdfarea} +@deftypefn {} {double} unur_distr_corder_upd_pdfarea (UNUR_DISTR* @var{distribution}) +Recompute the area below the PDF of the distribution. +It only works for order statistics for distribution objects from +the UNU.RAN library of standard distributions when the +corresponding function is available. +@ifhtml +@ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_pdfarea} +@end ifnothtml +assumes that the PDF of the underlying +distribution is normalized, i.e. it is the derivative of its CDF. +Otherwise the computed area is wrong and there is @strong{no} warning +about this failure. +See +@ifhtml +@ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_pdfarea} +@end ifnothtml +for further details. +(Macro) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_corder_get_pdfarea} +@deftypefn Function {double} unur_distr_corder_get_pdfarea (UNUR_DISTR* @var{distribution}) +Get the area below the PDF of the distribution. +See +@ifhtml +@ref{funct:unur_distr_cont_get_pdfarea,@command{unur_distr_cont_get_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_get_pdfarea} +@end ifnothtml +for details. +(Macro) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_corder_get_pdfarea} +@deftypefn {} {double} unur_distr_corder_get_pdfarea (UNUR_DISTR* @var{distribution}) +Get the area below the PDF of the distribution. +See +@ifhtml +@ref{funct:unur_distr_cont_get_pdfarea,@command{unur_distr_cont_get_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_get_pdfarea} +@end ifnothtml +for details. +(Macro) +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of corder.h +@c ------------------------------------- +@c ------------------------------------- +@c cemp.h +@c + +@page +@node CEMP +@section Continuous empirical univariate distributions + + +Empirical univariate distributions are derived from observed data. +There are two ways to create such a generator object: +@enumerate +@item +By a list of @emph{raw data} by means of a +@ifhtml +@ref{funct:unur_distr_cemp_set_data,@command{unur_distr_cemp_set_data}} +@end ifhtml +@ifnothtml +@command{unur_distr_cemp_set_data} +@end ifnothtml +call. +@item +By a @emph{histogram} (i.e. preprocessed data) by means of a +@ifhtml +@ref{funct:unur_distr_cemp_set_hist,@command{unur_distr_cemp_set_hist}} +@end ifhtml +@ifnothtml +@command{unur_distr_cemp_set_hist} +@end ifnothtml +call. +@end enumerate +How these data are used to sample from the empirical distribution +depends from the chosen generation method. + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_distr_cemp_new,unur_distr_cemp_new} +@item @ref{funct:unur_distr_cemp_set_data,unur_distr_cemp_set_data} +@item @ref{funct:unur_distr_cemp_read_data,unur_distr_cemp_read_data} +@item @ref{funct:unur_distr_cemp_get_data,unur_distr_cemp_get_data} +@item @ref{funct:unur_distr_cemp_set_hist,unur_distr_cemp_set_hist} +@item @ref{funct:unur_distr_cemp_set_hist_prob,unur_distr_cemp_set_hist_prob} +@item @ref{funct:unur_distr_cemp_set_hist_domain,unur_distr_cemp_set_hist_domain} +@item @ref{funct:unur_distr_cemp_set_hist_bins,unur_distr_cemp_set_hist_bins} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_distr_cemp_new} +@deftypefn Function {UNUR_DISTR*} unur_distr_cemp_new (void) +Create a new (empty) object for empirical univariate continuous distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cemp_new} +@deftypefn {} {UNUR_DISTR*} unur_distr_cemp_new (void) +Create a new (empty) object for empirical univariate continuous distribution. +@end deftypefn +@end ifnotinfo + +@subsubheading Essential parameters + +@ifinfo +@anchor{funct:unur_distr_cemp_set_data} +@deftypefn Function {int} unur_distr_cemp_set_data (UNUR_DISTR* @var{distribution}, const @var{double* sample}, int @var{n_sample}) +Set observed sample for empirical distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cemp_set_data} +@deftypefn {} {int} unur_distr_cemp_set_data (UNUR_DISTR* @var{distribution}, const @var{double* sample}, int @var{n_sample}) +Set observed sample for empirical distribution. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cemp_read_data} +@deftypefn Function {int} unur_distr_cemp_read_data (UNUR_DISTR* @var{distribution}, const @var{char* filename}) +Read data from file @file{filename}. +It reads the first number from each line. +Numbers are parsed by means of the C standard routine @command{strtod}. +Lines that do not start with @code{+}, @code{-}, @code{.}, or a +digit are ignored. (Beware of lines starting with a blank!) + +In case of an error (file cannot be opened, invalid string for +double in line) no data are copied into the distribution object +and an error code is returned. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cemp_read_data} +@deftypefn {} {int} unur_distr_cemp_read_data (UNUR_DISTR* @var{distribution}, const @var{char* filename}) +Read data from file @file{filename}. +It reads the first number from each line. +Numbers are parsed by means of the C standard routine @command{strtod}. +Lines that do not start with @code{+}, @code{-}, @code{.}, or a +digit are ignored. (Beware of lines starting with a blank!) + +In case of an error (file cannot be opened, invalid string for +double in line) no data are copied into the distribution object +and an error code is returned. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cemp_get_data} +@deftypefn Function {int} unur_distr_cemp_get_data (const @var{UNUR_DISTR* distribution}, const @var{double** sample}) +Get number of samples and set pointer @var{sample} to array of +observations. If no sample has been given, an error code +is returned and @code{sample} is set to @code{NULL}. + +@emph{Important:} Do @strong{not} change the entries in @var{sample}! +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cemp_get_data} +@deftypefn {} {int} unur_distr_cemp_get_data (const @var{UNUR_DISTR* distribution}, const @var{double** sample}) +Get number of samples and set pointer @var{sample} to array of +observations. If no sample has been given, an error code +is returned and @code{sample} is set to @code{NULL}. + +@emph{Important:} Do @strong{not} change the entries in @var{sample}! +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cemp_set_hist} +@deftypefn Function {int} unur_distr_cemp_set_hist (UNUR_DISTR* @var{distribution}, const @var{double* prob}, int @var{n_prob}, double @var{xmin}, double @var{xmax}) +Set a histogram with bins of equal width. @var{prob} is an array +of length @var{n_prob} that contains the probabilities for the bins +(in ascending order). @var{xmin} and @var{xmax} give the lower and +upper bound of the histogram, respectively. The bins are assumed to +have equal width. + +@emph{Remark:} This is shortcut for calling +@ifhtml +@ref{funct:unur_distr_cemp_set_hist_prob,@command{unur_distr_cemp_set_hist_prob}} +@end ifhtml +@ifnothtml +@command{unur_distr_cemp_set_hist_prob} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_distr_cemp_set_hist_domain,@command{unur_distr_cemp_set_hist_domain}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cemp_set_hist_domain}. +@end ifnothtml +@emph{Notice:} All sampling methods either use raw data or histogram. +It is possible to set both types of data; however, it is not +checked whether the given histogran corresponds to possibly given +raw data. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cemp_set_hist} +@deftypefn {} {int} unur_distr_cemp_set_hist (UNUR_DISTR* @var{distribution}, const @var{double* prob}, int @var{n_prob}, double @var{xmin}, double @var{xmax}) +Set a histogram with bins of equal width. @var{prob} is an array +of length @var{n_prob} that contains the probabilities for the bins +(in ascending order). @var{xmin} and @var{xmax} give the lower and +upper bound of the histogram, respectively. The bins are assumed to +have equal width. + +@emph{Remark:} This is shortcut for calling +@ifhtml +@ref{funct:unur_distr_cemp_set_hist_prob,@command{unur_distr_cemp_set_hist_prob}} +@end ifhtml +@ifnothtml +@command{unur_distr_cemp_set_hist_prob} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_distr_cemp_set_hist_domain,@command{unur_distr_cemp_set_hist_domain}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cemp_set_hist_domain}. +@end ifnothtml +@emph{Notice:} All sampling methods either use raw data or histogram. +It is possible to set both types of data; however, it is not +checked whether the given histogran corresponds to possibly given +raw data. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cemp_set_hist_prob} +@deftypefn Function {int} unur_distr_cemp_set_hist_prob (UNUR_DISTR* @var{distribution}, const @var{double* prob}, int @var{n_prob}) +Set probabilities of a histogram with @var{n_prob} bins. +Hence @var{prob} must be an array of length @var{n_prob} that +contains the probabilities for the bins in ascending order. +It is important also to set the location of the bins either +with a +@ifhtml +@ref{funct:unur_distr_cemp_set_hist_domain,@command{unur_distr_cemp_set_hist_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cemp_set_hist_domain} +@end ifnothtml +for bins of equal +width or +@ifhtml +@ref{funct:unur_distr_cemp_set_hist_bins,@command{unur_distr_cemp_set_hist_bins}} +@end ifhtml +@ifnothtml +@command{unur_distr_cemp_set_hist_bins} +@end ifnothtml +when the bins have +different width. + +@emph{Notice:} All sampling methods either use raw data or histogram. +It is possible to set both types of data; however, it is not +checked whether the given histogram corresponds to possibly given +raw data. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cemp_set_hist_prob} +@deftypefn {} {int} unur_distr_cemp_set_hist_prob (UNUR_DISTR* @var{distribution}, const @var{double* prob}, int @var{n_prob}) +Set probabilities of a histogram with @var{n_prob} bins. +Hence @var{prob} must be an array of length @var{n_prob} that +contains the probabilities for the bins in ascending order. +It is important also to set the location of the bins either +with a +@ifhtml +@ref{funct:unur_distr_cemp_set_hist_domain,@command{unur_distr_cemp_set_hist_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cemp_set_hist_domain} +@end ifnothtml +for bins of equal +width or +@ifhtml +@ref{funct:unur_distr_cemp_set_hist_bins,@command{unur_distr_cemp_set_hist_bins}} +@end ifhtml +@ifnothtml +@command{unur_distr_cemp_set_hist_bins} +@end ifnothtml +when the bins have +different width. + +@emph{Notice:} All sampling methods either use raw data or histogram. +It is possible to set both types of data; however, it is not +checked whether the given histogram corresponds to possibly given +raw data. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cemp_set_hist_domain} +@deftypefn Function {int} unur_distr_cemp_set_hist_domain (UNUR_DISTR* @var{distribution}, double @var{xmin}, double @var{xmax}) +Set a domain of a histogram with bins of equal width. +@var{xmin} and @var{xmax} give the lower and upper bound of the +histogram, respectively. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cemp_set_hist_domain} +@deftypefn {} {int} unur_distr_cemp_set_hist_domain (UNUR_DISTR* @var{distribution}, double @var{xmin}, double @var{xmax}) +Set a domain of a histogram with bins of equal width. +@var{xmin} and @var{xmax} give the lower and upper bound of the +histogram, respectively. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cemp_set_hist_bins} +@deftypefn Function {int} unur_distr_cemp_set_hist_bins (UNUR_DISTR* @var{distribution}, const @var{double* bins}, int @var{n_bins}) +Set location of bins of a histogram with @var{n_bins} bins. +Hence @var{bins} must be an array of length @var{n_bins}. +The domain of the @var{distribution} is automatically set by +this call and overrides any calls to +@ifhtml +@ref{funct:unur_distr_cemp_set_hist_domain,@command{unur_distr_cemp_set_hist_domain}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cemp_set_hist_domain}. +@end ifnothtml +@emph{Important:} +The probabilities of the bins of the @var{distribution} must be +already be set by a +@ifhtml +@ref{funct:unur_distr_cemp_set_hist_prob,@command{unur_distr_cemp_set_hist_prob}} +@end ifhtml +@ifnothtml +@command{unur_distr_cemp_set_hist_prob} +@end ifnothtml +(or a +@ifhtml +@ref{funct:unur_distr_cemp_set_hist,@command{unur_distr_cemp_set_hist}} +@end ifhtml +@ifnothtml +@command{unur_distr_cemp_set_hist} +@end ifnothtml +call) and the value of +@var{n_bins} must equal @var{n_prob}@code{+1} from the +corresponding value of the respective call. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cemp_set_hist_bins} +@deftypefn {} {int} unur_distr_cemp_set_hist_bins (UNUR_DISTR* @var{distribution}, const @var{double* bins}, int @var{n_bins}) +Set location of bins of a histogram with @var{n_bins} bins. +Hence @var{bins} must be an array of length @var{n_bins}. +The domain of the @var{distribution} is automatically set by +this call and overrides any calls to +@ifhtml +@ref{funct:unur_distr_cemp_set_hist_domain,@command{unur_distr_cemp_set_hist_domain}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cemp_set_hist_domain}. +@end ifnothtml +@emph{Important:} +The probabilities of the bins of the @var{distribution} must be +already be set by a +@ifhtml +@ref{funct:unur_distr_cemp_set_hist_prob,@command{unur_distr_cemp_set_hist_prob}} +@end ifhtml +@ifnothtml +@command{unur_distr_cemp_set_hist_prob} +@end ifnothtml +(or a +@ifhtml +@ref{funct:unur_distr_cemp_set_hist,@command{unur_distr_cemp_set_hist}} +@end ifhtml +@ifnothtml +@command{unur_distr_cemp_set_hist} +@end ifnothtml +call) and the value of +@var{n_bins} must equal @var{n_prob}@code{+1} from the +corresponding value of the respective call. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of cemp.h +@c ------------------------------------- +@c ------------------------------------- +@c cvec.h +@c + +@page +@node CVEC +@section Continuous multivariate distributions + + +The following calls handle multivariate distributions. +However, the requirements of particular generation methods is not +as unique as for univariate distributions. Moreover, random vector +generation methods are still under development. +The below functions are a first attempt to handle this situation. + +Notice that some of the parameters -- when given carelessly -- might +contradict to others. For example: Some methods require the +marginal distribution and some methods need a standardized form of +the marginal distributions, where the actual mean and variance is +stored in the mean vector and the covariance matrix, respectively. + +We also have to mention that some methods might abuse some of the +parameters. Please read the discription of the chosen sampling +method carfully. + +The following kind of calls exists: + +@itemize @minus +@item Create a @command{new} instance of a continuous multivariate +distribution; + +@item Handle and evaluate +probability density function (PDF, @command{pdf}) and the +gradient of the density function (@command{dpdf}). +The following is important: +@itemize . +@item @command{pdf} need not be normalized, i.e., +any integrable nonnegative function can be used. +@item @command{dpdf} must the derivate of the function provided +as @command{pdf}. +@end itemize + +@item Handle and evaluate +the logarithm of the probability density function (logPDF, +@command{logpdf}) and the gradient of the logarithm of the +density function (@command{dlogpdf}). + +Some methods use the logarithm of the density if available. + +@item Set (and change) parameters (@command{pdfparams}) and the +volume below the graph (@command{pdfvol}) of the given density. + +@item Set @command{mode} and @command{mean} of the distribution. + +@item Set the @command{center} of the distribution. +It is used by some generation methods to adjust the parameters +of the generation algorithms to gain better performance. It can +be seens as the location of the ``central part'' of the +distribution. + +@item Handle the @command{covar}iance matrix of the distribution and +its @command{cholesky} and @command{inv}verse matrices. + +@item Set the @command{rankcorr}elation matrix of the distribution. + +@item Deal with @command{marginal} distributions. + +@item Set domain of the distribution. + +@end itemize + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_distr_cvec_new,unur_distr_cvec_new} +@item @ref{funct:unur_distr_cvec_set_pdf,unur_distr_cvec_set_pdf} +@item @ref{funct:unur_distr_cvec_set_dpdf,unur_distr_cvec_set_dpdf} +@item @ref{funct:unur_distr_cvec_set_pdpdf,unur_distr_cvec_set_pdpdf} +@item @ref{funct:unur_distr_cvec_get_pdf,unur_distr_cvec_get_pdf} +@item @ref{funct:unur_distr_cvec_get_dpdf,unur_distr_cvec_get_dpdf} +@item @ref{funct:unur_distr_cvec_eval_pdf,unur_distr_cvec_eval_pdf} +@item @ref{funct:unur_distr_cvec_eval_dpdf,unur_distr_cvec_eval_dpdf} +@item @ref{funct:unur_distr_cvec_eval_pdpdf,unur_distr_cvec_eval_pdpdf} +@item @ref{funct:unur_distr_cvec_set_logpdf,unur_distr_cvec_set_logpdf} +@item @ref{funct:unur_distr_cvec_set_dlogpdf,unur_distr_cvec_set_dlogpdf} +@item @ref{funct:unur_distr_cvec_set_pdlogpdf,unur_distr_cvec_set_pdlogpdf} +@item @ref{funct:unur_distr_cvec_get_logpdf,unur_distr_cvec_get_logpdf} +@item @ref{funct:unur_distr_cvec_get_dlogpdf,unur_distr_cvec_get_dlogpdf} +@item @ref{funct:unur_distr_cvec_eval_logpdf,unur_distr_cvec_eval_logpdf} +@item @ref{funct:unur_distr_cvec_eval_dlogpdf,unur_distr_cvec_eval_dlogpdf} +@item @ref{funct:unur_distr_cvec_eval_pdlogpdf,unur_distr_cvec_eval_pdlogpdf} +@item @ref{funct:unur_distr_cvec_set_mean,unur_distr_cvec_set_mean} +@item @ref{funct:unur_distr_cvec_get_mean,unur_distr_cvec_get_mean} +@item @ref{funct:unur_distr_cvec_set_covar,unur_distr_cvec_set_covar} +@item @ref{funct:unur_distr_cvec_set_covar_inv,unur_distr_cvec_set_covar_inv} +@item @ref{funct:unur_distr_cvec_get_covar,unur_distr_cvec_get_covar} +@item @ref{funct:unur_distr_cvec_get_cholesky,unur_distr_cvec_get_cholesky} +@item @ref{funct:unur_distr_cvec_get_covar_inv,unur_distr_cvec_get_covar_inv} +@item @ref{funct:unur_distr_cvec_set_rankcorr,unur_distr_cvec_set_rankcorr} +@item @ref{funct:unur_distr_cvec_get_rankcorr,unur_distr_cvec_get_rankcorr} +@item @ref{funct:unur_distr_cvec_get_rk_cholesky,unur_distr_cvec_get_rk_cholesky} +@item @ref{funct:unur_distr_cvec_set_marginals,unur_distr_cvec_set_marginals} +@item @ref{funct:unur_distr_cvec_set_marginal_array,unur_distr_cvec_set_marginal_array} +@item @ref{funct:unur_distr_cvec_set_marginal_list,unur_distr_cvec_set_marginal_list} +@item @ref{funct:unur_distr_cvec_get_marginal,unur_distr_cvec_get_marginal} +@item @ref{funct:unur_distr_cvec_set_pdfparams,unur_distr_cvec_set_pdfparams} +@item @ref{funct:unur_distr_cvec_get_pdfparams,unur_distr_cvec_get_pdfparams} +@item @ref{funct:unur_distr_cvec_set_pdfparams_vec,unur_distr_cvec_set_pdfparams_vec} +@item @ref{funct:unur_distr_cvec_get_pdfparams_vec,unur_distr_cvec_get_pdfparams_vec} +@item @ref{funct:unur_distr_cvec_set_domain_rect,unur_distr_cvec_set_domain_rect} +@item @ref{funct:unur_distr_cvec_is_indomain,unur_distr_cvec_is_indomain} +@item @ref{funct:unur_distr_cvec_set_mode,unur_distr_cvec_set_mode} +@item @ref{funct:unur_distr_cvec_upd_mode,unur_distr_cvec_upd_mode} +@item @ref{funct:unur_distr_cvec_get_mode,unur_distr_cvec_get_mode} +@item @ref{funct:unur_distr_cvec_set_center,unur_distr_cvec_set_center} +@item @ref{funct:unur_distr_cvec_get_center,unur_distr_cvec_get_center} +@item @ref{funct:unur_distr_cvec_set_pdfvol,unur_distr_cvec_set_pdfvol} +@item @ref{funct:unur_distr_cvec_upd_pdfvol,unur_distr_cvec_upd_pdfvol} +@item @ref{funct:unur_distr_cvec_get_pdfvol,unur_distr_cvec_get_pdfvol} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_distr_cvec_new} +@deftypefn Function {UNUR_DISTR*} unur_distr_cvec_new (int @var{dim}) +Create a new (empty) object for multivariate continuous +distribution. @var{dim} is the number of components of the random +vector (i.e. its dimension). It is also possible to use dimension 1. +Notice, however, that this is treated as a distribution of random +vectors with only one component and not as a distribution of +real numbers. For the latter +@ifhtml +@ref{funct:unur_distr_cont_new,@command{unur_distr_cont_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_new} +@end ifnothtml +should be used +to create an object for a univariate distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_new} +@deftypefn {} {UNUR_DISTR*} unur_distr_cvec_new (int @var{dim}) +Create a new (empty) object for multivariate continuous +distribution. @var{dim} is the number of components of the random +vector (i.e. its dimension). It is also possible to use dimension 1. +Notice, however, that this is treated as a distribution of random +vectors with only one component and not as a distribution of +real numbers. For the latter +@ifhtml +@ref{funct:unur_distr_cont_new,@command{unur_distr_cont_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_new} +@end ifnothtml +should be used +to create an object for a univariate distribution. +@end deftypefn +@end ifnotinfo + +@subsubheading Essential parameters + +@ifinfo +@anchor{funct:unur_distr_cvec_set_pdf} +@deftypefn Function {int} unur_distr_cvec_set_pdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CVEC* @var{pdf}) +Set respective pointer to the PDF of the @var{distribution}. +This function must be of type +@code{double funct(const double *x, UNUR_DISTR *distr)}, +where @var{x} must be a pointer to a double array of appropriate +size (i.e. of the same size as given to the +@ifhtml +@ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_new} +@end ifnothtml +call). + +It is not necessary that the given PDF is normalized, i.e. the +integral need not be 1. +Nevertheless the volume below the PDF can be provided by a +@ifhtml +@ref{funct:unur_distr_cvec_set_pdfvol,@command{unur_distr_cvec_set_pdfvol}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_pdfvol} +@end ifnothtml +call. + +It is not possible to change the PDF. Once the PDF is set it cannot +be overwritten. This also holds when the logPDF is given. +A new distribution object has to be used instead. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_set_pdf} +@deftypefn {} {int} unur_distr_cvec_set_pdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CVEC* @var{pdf}) +Set respective pointer to the PDF of the @var{distribution}. +This function must be of type +@code{double funct(const double *x, UNUR_DISTR *distr)}, +where @var{x} must be a pointer to a double array of appropriate +size (i.e. of the same size as given to the +@ifhtml +@ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_new} +@end ifnothtml +call). + +It is not necessary that the given PDF is normalized, i.e. the +integral need not be 1. +Nevertheless the volume below the PDF can be provided by a +@ifhtml +@ref{funct:unur_distr_cvec_set_pdfvol,@command{unur_distr_cvec_set_pdfvol}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_pdfvol} +@end ifnothtml +call. + +It is not possible to change the PDF. Once the PDF is set it cannot +be overwritten. This also holds when the logPDF is given. +A new distribution object has to be used instead. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_set_dpdf} +@deftypefn Function {int} unur_distr_cvec_set_dpdf (UNUR_DISTR* @var{distribution}, UNUR_VFUNCT_CVEC* @var{dpdf}) +Set pointer to the gradient of the PDF. The type of this function must be +@code{int funct(double *result, const double *x, UNUR_DISTR *distr)}, +where @var{result} and @var{x} must be pointers to double arrays of +appropriate size (i.e. of the same size as given to the +@ifhtml +@ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_new} +@end ifnothtml +call). +The gradient of the PDF is stored in the array @var{result}. +The function should return an error code in case of an error and must +return @code{UNUR_SUCCESS} otherwise. + +The given function must be the gradient of the function +given by a +@ifhtml +@ref{funct:unur_distr_cvec_set_pdf,@command{unur_distr_cvec_set_pdf}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_pdf} +@end ifnothtml +call. + +It is not possible to change the gradient of the PDF. Once the dPDF +is set it cannot be overwritten. This also holds when the gradient +of the logPDF is given. +A new distribution object has to be used instead. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_set_dpdf} +@deftypefn {} {int} unur_distr_cvec_set_dpdf (UNUR_DISTR* @var{distribution}, UNUR_VFUNCT_CVEC* @var{dpdf}) +Set pointer to the gradient of the PDF. The type of this function must be +@code{int funct(double *result, const double *x, UNUR_DISTR *distr)}, +where @var{result} and @var{x} must be pointers to double arrays of +appropriate size (i.e. of the same size as given to the +@ifhtml +@ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_new} +@end ifnothtml +call). +The gradient of the PDF is stored in the array @var{result}. +The function should return an error code in case of an error and must +return @code{UNUR_SUCCESS} otherwise. + +The given function must be the gradient of the function +given by a +@ifhtml +@ref{funct:unur_distr_cvec_set_pdf,@command{unur_distr_cvec_set_pdf}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_pdf} +@end ifnothtml +call. + +It is not possible to change the gradient of the PDF. Once the dPDF +is set it cannot be overwritten. This also holds when the gradient +of the logPDF is given. +A new distribution object has to be used instead. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_set_pdpdf} +@deftypefn Function {int} unur_distr_cvec_set_pdpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCTD_CVEC* @var{pdpdf}) +Set pointer to partial derivatives of the PDF. The type of this function must be +@code{double funct(const double *x, int coord, UNUR_DISTR *distr)}, +where @var{x} must be a pointer to a double array of appropriate +size (i.e. of the same size as given to the +@ifhtml +@ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_new} +@end ifnothtml +call). @var{coord} is the coordinate for which the partial dervative should be +computed. + +Notice that @var{coord} must be an integer from @{0,@dots{},dim-1@}. + +It is not possible to change the partial derivative of the PDF. Once the pdPDF +is set it cannot be overwritten. This also holds when the partial derivative +of the logPDF is given. +A new distribution object has to be used instead. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_set_pdpdf} +@deftypefn {} {int} unur_distr_cvec_set_pdpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCTD_CVEC* @var{pdpdf}) +Set pointer to partial derivatives of the PDF. The type of this function must be +@code{double funct(const double *x, int coord, UNUR_DISTR *distr)}, +where @var{x} must be a pointer to a double array of appropriate +size (i.e. of the same size as given to the +@ifhtml +@ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_new} +@end ifnothtml +call). @var{coord} is the coordinate for which the partial dervative should be +computed. + +Notice that @var{coord} must be an integer from @{0,@dots{},dim-1@}. + +It is not possible to change the partial derivative of the PDF. Once the pdPDF +is set it cannot be overwritten. This also holds when the partial derivative +of the logPDF is given. +A new distribution object has to be used instead. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_get_pdf} +@deftypefn Function {UNUR_FUNCT_CVEC*} unur_distr_cvec_get_pdf (const @var{UNUR_DISTR* distribution}) +Get the pointer to the PDF of the @var{distribution}. The +pointer is of type +@code{double funct(const double *x, UNUR_DISTR *distr)}. +If the corresponding function is not available for the +@var{distribution}, the @code{NULL} pointer is returned. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_get_pdf} +@deftypefn {} {UNUR_FUNCT_CVEC*} unur_distr_cvec_get_pdf (const @var{UNUR_DISTR* distribution}) +Get the pointer to the PDF of the @var{distribution}. The +pointer is of type +@code{double funct(const double *x, UNUR_DISTR *distr)}. +If the corresponding function is not available for the +@var{distribution}, the @code{NULL} pointer is returned. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_get_dpdf} +@deftypefn Function {UNUR_VFUNCT_CVEC*} unur_distr_cvec_get_dpdf (const @var{UNUR_DISTR* distribution}) +Get the pointer to the gradient of the PDF of the +@var{distribution}. The pointer is of type +@code{int double funct(double *result, const double *x, UNUR_DISTR *distr)}. +If the corresponding function is not available for the +@var{distribution}, the @code{NULL} pointer is returned. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_get_dpdf} +@deftypefn {} {UNUR_VFUNCT_CVEC*} unur_distr_cvec_get_dpdf (const @var{UNUR_DISTR* distribution}) +Get the pointer to the gradient of the PDF of the +@var{distribution}. The pointer is of type +@code{int double funct(double *result, const double *x, UNUR_DISTR *distr)}. +If the corresponding function is not available for the +@var{distribution}, the @code{NULL} pointer is returned. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_eval_pdf} +@deftypefn Function {double} unur_distr_cvec_eval_pdf (const @var{double* x}, UNUR_DISTR* @var{distribution}) +Evaluate the PDF of the @var{distribution} at @var{x}. +@var{x} must be a pointer to a double array of appropriate size +(i.e. of the same size as given to the +@ifhtml +@ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_new} +@end ifnothtml +call) +that contains the vector for which the function has to be evaluated. + +Notice that @var{distribution} must not be the @code{NULL} pointer. +If the corresponding function is not available for the +@var{distribution}, @code{UNUR_INFINITY} is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_eval_pdf} +@deftypefn {} {double} unur_distr_cvec_eval_pdf (const @var{double* x}, UNUR_DISTR* @var{distribution}) +Evaluate the PDF of the @var{distribution} at @var{x}. +@var{x} must be a pointer to a double array of appropriate size +(i.e. of the same size as given to the +@ifhtml +@ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_new} +@end ifnothtml +call) +that contains the vector for which the function has to be evaluated. + +Notice that @var{distribution} must not be the @code{NULL} pointer. +If the corresponding function is not available for the +@var{distribution}, @code{UNUR_INFINITY} is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_eval_dpdf} +@deftypefn Function {int} unur_distr_cvec_eval_dpdf (double* @var{result}, const @var{double* x}, UNUR_DISTR* @var{distribution}) +Evaluate the gradient of the PDF of the @var{distribution} at +@var{x}. +The result is stored in the double array @var{result}. +Both @var{result} and @var{x} must be pointer to double arrays of +appropriate size (i.e. of the same size as given to the +@ifhtml +@ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_new} +@end ifnothtml +call). + +Notice that @var{distribution} must not be the @code{NULL} pointer. +If the corresponding function is not available for the +@var{distribution}, an error code is returned and @code{unur_errno} +is set to @code{UNUR_ERR_DISTR_DATA} (@var{result} is left unmodified). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_eval_dpdf} +@deftypefn {} {int} unur_distr_cvec_eval_dpdf (double* @var{result}, const @var{double* x}, UNUR_DISTR* @var{distribution}) +Evaluate the gradient of the PDF of the @var{distribution} at +@var{x}. +The result is stored in the double array @var{result}. +Both @var{result} and @var{x} must be pointer to double arrays of +appropriate size (i.e. of the same size as given to the +@ifhtml +@ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_new} +@end ifnothtml +call). + +Notice that @var{distribution} must not be the @code{NULL} pointer. +If the corresponding function is not available for the +@var{distribution}, an error code is returned and @code{unur_errno} +is set to @code{UNUR_ERR_DISTR_DATA} (@var{result} is left unmodified). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_eval_pdpdf} +@deftypefn Function {double} unur_distr_cvec_eval_pdpdf (const @var{double* x}, int @var{coord}, UNUR_DISTR* @var{distribution}) +Evaluate the partial derivative of the PDF of the @var{distribution} +at @var{x} for the coordinate @var{coord}. +@var{x} must be a pointer to a double array of appropriate size +(i.e. of the same size as given to the +@ifhtml +@ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_new} +@end ifnothtml +call) +that contains the vector for which the function has to be evaluated. + +Notice that @var{coord} must be an integer from @{0,@dots{},dim-1@}. + +Notice that @var{distribution} must not be the @code{NULL} pointer. +If the corresponding function is not available for the +@var{distribution}, @code{UNUR_INFINITY} is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_eval_pdpdf} +@deftypefn {} {double} unur_distr_cvec_eval_pdpdf (const @var{double* x}, int @var{coord}, UNUR_DISTR* @var{distribution}) +Evaluate the partial derivative of the PDF of the @var{distribution} +at @var{x} for the coordinate @var{coord}. +@var{x} must be a pointer to a double array of appropriate size +(i.e. of the same size as given to the +@ifhtml +@ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_new} +@end ifnothtml +call) +that contains the vector for which the function has to be evaluated. + +Notice that @var{coord} must be an integer from @{0,@dots{},dim-1@}. + +Notice that @var{distribution} must not be the @code{NULL} pointer. +If the corresponding function is not available for the +@var{distribution}, @code{UNUR_INFINITY} is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_set_logpdf} +@anchor{funct:unur_distr_cvec_set_dlogpdf} +@anchor{funct:unur_distr_cvec_set_pdlogpdf} +@anchor{funct:unur_distr_cvec_get_logpdf} +@anchor{funct:unur_distr_cvec_get_dlogpdf} +@anchor{funct:unur_distr_cvec_eval_logpdf} +@anchor{funct:unur_distr_cvec_eval_dlogpdf} +@anchor{funct:unur_distr_cvec_eval_pdlogpdf} +@deftypefn Function {int} unur_distr_cvec_set_logpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CVEC* @var{logpdf}) +@deftypefnx Function {int} unur_distr_cvec_set_dlogpdf (UNUR_DISTR* @var{distribution}, UNUR_VFUNCT_CVEC* @var{dlogpdf}) +@deftypefnx Function {int} unur_distr_cvec_set_pdlogpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCTD_CVEC* @var{pdlogpdf}) +@deftypefnx Function {UNUR_FUNCT_CVEC*} unur_distr_cvec_get_logpdf (const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {UNUR_VFUNCT_CVEC*} unur_distr_cvec_get_dlogpdf (const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {double} unur_distr_cvec_eval_logpdf (const @var{double* x}, UNUR_DISTR* @var{distribution}) +@deftypefnx Function {int} unur_distr_cvec_eval_dlogpdf (double* @var{result}, const @var{double* x}, UNUR_DISTR* @var{distribution}) +@deftypefnx Function {double} unur_distr_cvec_eval_pdlogpdf (const @var{double* x}, int @var{coord}, UNUR_DISTR* @var{distribution}) +Analogous calls for the logarithm of the density function. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_set_logpdf} +@anchor{funct:unur_distr_cvec_set_dlogpdf} +@anchor{funct:unur_distr_cvec_set_pdlogpdf} +@anchor{funct:unur_distr_cvec_get_logpdf} +@anchor{funct:unur_distr_cvec_get_dlogpdf} +@anchor{funct:unur_distr_cvec_eval_logpdf} +@anchor{funct:unur_distr_cvec_eval_dlogpdf} +@anchor{funct:unur_distr_cvec_eval_pdlogpdf} +@deftypefn {} {int} unur_distr_cvec_set_logpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CVEC* @var{logpdf}) +@deftypefnx {} {int} unur_distr_cvec_set_dlogpdf (UNUR_DISTR* @var{distribution}, UNUR_VFUNCT_CVEC* @var{dlogpdf}) +@deftypefnx {} {int} unur_distr_cvec_set_pdlogpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCTD_CVEC* @var{pdlogpdf}) +@deftypefnx {} {UNUR_FUNCT_CVEC*} unur_distr_cvec_get_logpdf (const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {UNUR_VFUNCT_CVEC*} unur_distr_cvec_get_dlogpdf (const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {double} unur_distr_cvec_eval_logpdf (const @var{double* x}, UNUR_DISTR* @var{distribution}) +@deftypefnx {} {int} unur_distr_cvec_eval_dlogpdf (double* @var{result}, const @var{double* x}, UNUR_DISTR* @var{distribution}) +@deftypefnx {} {double} unur_distr_cvec_eval_pdlogpdf (const @var{double* x}, int @var{coord}, UNUR_DISTR* @var{distribution}) +Analogous calls for the logarithm of the density function. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_set_mean} +@deftypefn Function {int} unur_distr_cvec_set_mean (UNUR_DISTR* @var{distribution}, const @var{double* mean}) +Set mean vector for multivariate @var{distribution}. +@var{mean} must be a pointer to an array of size @code{dim}, where +@code{dim} is the dimension returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +A @code{NULL} pointer for @var{mean} is interpreted as the zero +vector (0,@dots{},0). + +@strong{Important:} If the parameters of a distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}) +are changed, then neither its mode nor the normalization +constant are updated. Please use the respective calls +@ifhtml +@ref{funct:unur_distr_cvec_upd_mode,@command{unur_distr_cvec_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_upd_mode} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_distr_cvec_upd_pdfvol,@command{unur_distr_cvec_upd_pdfvol}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_upd_pdfvol}. +@end ifnothtml +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_set_mean} +@deftypefn {} {int} unur_distr_cvec_set_mean (UNUR_DISTR* @var{distribution}, const @var{double* mean}) +Set mean vector for multivariate @var{distribution}. +@var{mean} must be a pointer to an array of size @code{dim}, where +@code{dim} is the dimension returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +A @code{NULL} pointer for @var{mean} is interpreted as the zero +vector (0,@dots{},0). + +@strong{Important:} If the parameters of a distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}) +are changed, then neither its mode nor the normalization +constant are updated. Please use the respective calls +@ifhtml +@ref{funct:unur_distr_cvec_upd_mode,@command{unur_distr_cvec_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_upd_mode} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_distr_cvec_upd_pdfvol,@command{unur_distr_cvec_upd_pdfvol}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_upd_pdfvol}. +@end ifnothtml +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_get_mean} +@deftypefn Function {const double*} unur_distr_cvec_get_mean (const @var{UNUR_DISTR* distribution}) +Get the mean vector of the @var{distribution}. The function returns a +pointer to an array of size @code{dim}. +If the mean vector is not marked as known the @code{NULL} pointer is +returned and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_GET}. + +@emph{Important:} Do @strong{not} modify the array that holds the +mean vector! +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_get_mean} +@deftypefn {} {const double*} unur_distr_cvec_get_mean (const @var{UNUR_DISTR* distribution}) +Get the mean vector of the @var{distribution}. The function returns a +pointer to an array of size @code{dim}. +If the mean vector is not marked as known the @code{NULL} pointer is +returned and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_GET}. + +@emph{Important:} Do @strong{not} modify the array that holds the +mean vector! +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_set_covar} +@deftypefn Function {int} unur_distr_cvec_set_covar (UNUR_DISTR* @var{distribution}, const @var{double* covar}) +Set covariance matrix for multivariate @var{distribution}. +@var{covar} must be a pointer to an array of size +@code{dim} x @code{dim}, where @code{dim} is the dimension returned +by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +The rows of the matrix have to be stored +consecutively in this array. + +@var{covar} must be a variance-covariance matrix of the +@var{distribution}, i.e. it must be symmetric and positive definit and +its diagonal entries (i.e. the variance of the components of the +random vector) must be strictly positive. +The Cholesky factor is computed (and stored) to verify the positive +definiteness condition. +Notice that the inverse of the given covariance matrix is +automatically computed when it is requested by some routine. +Notice that the computation of this inverse matrix is unstable in +case of high correlations and/or high dimensions. Thus it might +fail and methods that require this inverse cannot be used. +As an alternative the inverse of the covariance matrix can be +directly set by a +@ifhtml +@ref{funct:unur_distr_cvec_set_covar_inv,@command{unur_distr_cvec_set_covar_inv}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_covar_inv} +@end ifnothtml +call. + +A @code{NULL} pointer for @var{covar} is interpreted as the +identity matrix. + +@emph{Important:} This entry is abused in some methods which do not +require the covariance matrix. It is then used to perform some +transformation to obtain better performance. + +@emph{Important:} In case of an error (e.g. because @var{covar} is +not a valid covariance matrix) an error code is returned. +Moreover, the covariance matrix is not set and is marked as +unknown. A previously set covariance matrix is then no longer +available. + +@strong{Important:} If the parameters of a distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}) +are changed, then neither its mode nor the normalization +constant are updated. Please use the respective calls +@ifhtml +@ref{funct:unur_distr_cvec_upd_mode,@command{unur_distr_cvec_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_upd_mode} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_distr_cvec_upd_pdfvol,@command{unur_distr_cvec_upd_pdfvol}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_upd_pdfvol}. +@end ifnothtml +@emph{Remark:} UNU.RAN does not check whether the an eventually +set covariance matrix and a rank-correlation matrix do not +contradict each other. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_set_covar} +@deftypefn {} {int} unur_distr_cvec_set_covar (UNUR_DISTR* @var{distribution}, const @var{double* covar}) +Set covariance matrix for multivariate @var{distribution}. +@var{covar} must be a pointer to an array of size +@code{dim} x @code{dim}, where @code{dim} is the dimension returned +by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +The rows of the matrix have to be stored +consecutively in this array. + +@var{covar} must be a variance-covariance matrix of the +@var{distribution}, i.e. it must be symmetric and positive definit and +its diagonal entries (i.e. the variance of the components of the +random vector) must be strictly positive. +The Cholesky factor is computed (and stored) to verify the positive +definiteness condition. +Notice that the inverse of the given covariance matrix is +automatically computed when it is requested by some routine. +Notice that the computation of this inverse matrix is unstable in +case of high correlations and/or high dimensions. Thus it might +fail and methods that require this inverse cannot be used. +As an alternative the inverse of the covariance matrix can be +directly set by a +@ifhtml +@ref{funct:unur_distr_cvec_set_covar_inv,@command{unur_distr_cvec_set_covar_inv}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_covar_inv} +@end ifnothtml +call. + +A @code{NULL} pointer for @var{covar} is interpreted as the +identity matrix. + +@emph{Important:} This entry is abused in some methods which do not +require the covariance matrix. It is then used to perform some +transformation to obtain better performance. + +@emph{Important:} In case of an error (e.g. because @var{covar} is +not a valid covariance matrix) an error code is returned. +Moreover, the covariance matrix is not set and is marked as +unknown. A previously set covariance matrix is then no longer +available. + +@strong{Important:} If the parameters of a distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}) +are changed, then neither its mode nor the normalization +constant are updated. Please use the respective calls +@ifhtml +@ref{funct:unur_distr_cvec_upd_mode,@command{unur_distr_cvec_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_upd_mode} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_distr_cvec_upd_pdfvol,@command{unur_distr_cvec_upd_pdfvol}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_upd_pdfvol}. +@end ifnothtml +@emph{Remark:} UNU.RAN does not check whether the an eventually +set covariance matrix and a rank-correlation matrix do not +contradict each other. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_set_covar_inv} +@deftypefn Function {int} unur_distr_cvec_set_covar_inv (UNUR_DISTR* @var{distribution}, const @var{double* covar_inv}) +Set inverse of the covariance matrix for multivariate @var{distribution}. +@var{covar_inv} must be a pointer to an array of size +@code{dim} x @code{dim}, where @code{dim} is the dimension returned +by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +The rows of the matrix have to be stored +consecutively in this array. + +@var{covar_inv} must be symmetric and positive definit. Only the +symmetry of the matrix is checked. + +A @code{NULL} pointer for @var{covar_inv} is interpreted as the identity matrix. + +@emph{Important:} In case of an error (because @var{covar_inv} is +not symetric) an error code is returned. +Moreover, the inverse of the covariance matrix is not set and is +marked as unknown. A previously set inverse matrix is then no longer +available. + +@emph{Remark:} UNU.RAN does not check whether the given matrix is +positive definit. + +@emph{Remark:} UNU.RAN does not check whether the matrix +@var{covar_inv} is the inverse of the eventually set covariance +matrix. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_set_covar_inv} +@deftypefn {} {int} unur_distr_cvec_set_covar_inv (UNUR_DISTR* @var{distribution}, const @var{double* covar_inv}) +Set inverse of the covariance matrix for multivariate @var{distribution}. +@var{covar_inv} must be a pointer to an array of size +@code{dim} x @code{dim}, where @code{dim} is the dimension returned +by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +The rows of the matrix have to be stored +consecutively in this array. + +@var{covar_inv} must be symmetric and positive definit. Only the +symmetry of the matrix is checked. + +A @code{NULL} pointer for @var{covar_inv} is interpreted as the identity matrix. + +@emph{Important:} In case of an error (because @var{covar_inv} is +not symetric) an error code is returned. +Moreover, the inverse of the covariance matrix is not set and is +marked as unknown. A previously set inverse matrix is then no longer +available. + +@emph{Remark:} UNU.RAN does not check whether the given matrix is +positive definit. + +@emph{Remark:} UNU.RAN does not check whether the matrix +@var{covar_inv} is the inverse of the eventually set covariance +matrix. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_get_covar} +@anchor{funct:unur_distr_cvec_get_cholesky} +@anchor{funct:unur_distr_cvec_get_covar_inv} +@deftypefn Function {const double*} unur_distr_cvec_get_covar (const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {const double*} unur_distr_cvec_get_cholesky (const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {const double*} unur_distr_cvec_get_covar_inv (UNUR_DISTR* @var{distribution}) +Get covariance matrix of @var{distribution}, its Cholesky factor, +and its inverse, respectively. The function returns a +pointer to an array of size @code{dim} x @code{dim}. +The rows of the matrix are stored consecutively in this array. +If the requested matrix is not marked as known the @code{NULL} +pointer is returned and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_GET}. + +@emph{Important:} Do @strong{not} modify the array that holds the +covariance matrix! + +@emph{Remark:} The inverse of the covariance matrix is computed +if it is not already stored. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_get_covar} +@anchor{funct:unur_distr_cvec_get_cholesky} +@anchor{funct:unur_distr_cvec_get_covar_inv} +@deftypefn {} {const double*} unur_distr_cvec_get_covar (const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {const double*} unur_distr_cvec_get_cholesky (const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {const double*} unur_distr_cvec_get_covar_inv (UNUR_DISTR* @var{distribution}) +Get covariance matrix of @var{distribution}, its Cholesky factor, +and its inverse, respectively. The function returns a +pointer to an array of size @code{dim} x @code{dim}. +The rows of the matrix are stored consecutively in this array. +If the requested matrix is not marked as known the @code{NULL} +pointer is returned and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_GET}. + +@emph{Important:} Do @strong{not} modify the array that holds the +covariance matrix! + +@emph{Remark:} The inverse of the covariance matrix is computed +if it is not already stored. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_set_rankcorr} +@deftypefn Function {int} unur_distr_cvec_set_rankcorr (UNUR_DISTR* @var{distribution}, const @var{double* rankcorr}) +Set rank-correlation matrix (Spearman's correlation) for +multivariate @var{distribution}. +@var{rankcorr} must be a pointer to an array of size +@code{dim} x @code{dim}, where @code{dim} is the dimension returned +by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +The rows of the matrix have to be stored +consecutively in this array. + +@var{rankcorr} must be a rank-correlation matrix of the +@var{distribution}, i.e. it must be symmetric and positive definite +and its diagonal entries must be equal to @code{1}. + +The Cholesky factor is computed (and stored) to verify the +positive definiteness condition. + +A @code{NULL} pointer for @var{rankcorr} is interpreted as the identity matrix. + +@emph{Important:} In case of an error (e.g. because @var{rankcorr} is +not a valid rank-correlation matrix) an error code is returned. +Moreover, the rank-correlation matrix is not set and is marked as +unknown. A previously set rank-correlation matrix is then no longer +available. + +@emph{Remark:} UNU.RAN does not check whether the an eventually +set covariance matrix and a rank-correlation matrix do not +contradict each other. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_set_rankcorr} +@deftypefn {} {int} unur_distr_cvec_set_rankcorr (UNUR_DISTR* @var{distribution}, const @var{double* rankcorr}) +Set rank-correlation matrix (Spearman's correlation) for +multivariate @var{distribution}. +@var{rankcorr} must be a pointer to an array of size +@code{dim} x @code{dim}, where @code{dim} is the dimension returned +by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +The rows of the matrix have to be stored +consecutively in this array. + +@var{rankcorr} must be a rank-correlation matrix of the +@var{distribution}, i.e. it must be symmetric and positive definite +and its diagonal entries must be equal to @code{1}. + +The Cholesky factor is computed (and stored) to verify the +positive definiteness condition. + +A @code{NULL} pointer for @var{rankcorr} is interpreted as the identity matrix. + +@emph{Important:} In case of an error (e.g. because @var{rankcorr} is +not a valid rank-correlation matrix) an error code is returned. +Moreover, the rank-correlation matrix is not set and is marked as +unknown. A previously set rank-correlation matrix is then no longer +available. + +@emph{Remark:} UNU.RAN does not check whether the an eventually +set covariance matrix and a rank-correlation matrix do not +contradict each other. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_get_rankcorr} +@anchor{funct:unur_distr_cvec_get_rk_cholesky} +@deftypefn Function {const double*} unur_distr_cvec_get_rankcorr (const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {const double*} unur_distr_cvec_get_rk_cholesky (const @var{UNUR_DISTR* distribution}) +Get rank-correlation matrix and its cholesky factor, respectively, +of @var{distribution}. The function +returns a pointer to an array of size @code{dim} x @code{dim}. +The rows of the matrix are stored consecutively in this array. +If the requested matrix is not marked as known the @code{NULL} +pointer is returned and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_GET}. + +@emph{Important:} Do @strong{not} modify the array that holds the +rank-correlation matrix! +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_get_rankcorr} +@anchor{funct:unur_distr_cvec_get_rk_cholesky} +@deftypefn {} {const double*} unur_distr_cvec_get_rankcorr (const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {const double*} unur_distr_cvec_get_rk_cholesky (const @var{UNUR_DISTR* distribution}) +Get rank-correlation matrix and its cholesky factor, respectively, +of @var{distribution}. The function +returns a pointer to an array of size @code{dim} x @code{dim}. +The rows of the matrix are stored consecutively in this array. +If the requested matrix is not marked as known the @code{NULL} +pointer is returned and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_GET}. + +@emph{Important:} Do @strong{not} modify the array that holds the +rank-correlation matrix! +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_set_marginals} +@deftypefn Function {int} unur_distr_cvec_set_marginals (UNUR_DISTR* @var{distribution}, UNUR_DISTR* @var{marginal}) +Sets marginal distributions of the given @var{distribution} to the +same @var{marginal} distribution object. The @var{marginal} +distribution must be an instance of a continuous univariate +distribution object. Notice that the marginal distribution is +copied into the @var{distribution} object. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_set_marginals} +@deftypefn {} {int} unur_distr_cvec_set_marginals (UNUR_DISTR* @var{distribution}, UNUR_DISTR* @var{marginal}) +Sets marginal distributions of the given @var{distribution} to the +same @var{marginal} distribution object. The @var{marginal} +distribution must be an instance of a continuous univariate +distribution object. Notice that the marginal distribution is +copied into the @var{distribution} object. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_set_marginal_array} +@deftypefn Function {int} unur_distr_cvec_set_marginal_array (UNUR_DISTR* @var{distribution}, UNUR_DISTR** @var{marginals}) +Analogously to the above +@ifhtml +@ref{funct:unur_distr_cvec_set_marginals,@command{unur_distr_cvec_set_marginals}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_marginals} +@end ifnothtml +call. +However, now an array @var{marginals} of the pointers to each of +the marginal distributions must be given. It @strong{must} be an +array of size @code{dim}, where @code{dim} is the dimension +returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +@emph{Notice}: Local copies for each of the entries are stored in +the @var{distribution} object. If some of these entries are +identical (i.e. contain the same pointer), then for each of these a +new copy is made. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_set_marginal_array} +@deftypefn {} {int} unur_distr_cvec_set_marginal_array (UNUR_DISTR* @var{distribution}, UNUR_DISTR** @var{marginals}) +Analogously to the above +@ifhtml +@ref{funct:unur_distr_cvec_set_marginals,@command{unur_distr_cvec_set_marginals}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_marginals} +@end ifnothtml +call. +However, now an array @var{marginals} of the pointers to each of +the marginal distributions must be given. It @strong{must} be an +array of size @code{dim}, where @code{dim} is the dimension +returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +@emph{Notice}: Local copies for each of the entries are stored in +the @var{distribution} object. If some of these entries are +identical (i.e. contain the same pointer), then for each of these a +new copy is made. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_set_marginal_list} +@deftypefn Function {int} unur_distr_cvec_set_marginal_list (UNUR_DISTR* @var{distribution}, ...) +Similar to the above +@ifhtml +@ref{funct:unur_distr_cvec_set_marginal_array,@command{unur_distr_cvec_set_marginal_array}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_marginal_array} +@end ifnothtml +call. +However, now the pointers to the particular marginal distributions +can be given as parameter and does not require an array of +pointers. Additionally the given distribution objects are +immediately destroyed. Thus calls like +@ifhtml +@ref{funct:unur_distr_normal,@command{unur_distr_normal}} +@end ifhtml +@ifnothtml +@command{unur_distr_normal} +@end ifnothtml +can be +used as arguments. +(With +@ifhtml +@ref{funct:unur_distr_cvec_set_marginal_array,@command{unur_distr_cvec_set_marginal_array}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_marginal_array} +@end ifnothtml +the result of such call +has to be stored in a pointer since it has to be freed afterwarts +to avoid memory leaks!) + +The number of pointers to in the list of function arguments +@strong{must} be equal to the dimension of the @var{distribution}, +i.e. the dimension returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +If one of the given pointer to marginal distributions is the @code{NULL} +pointer then the marginal distributions of @var{distribution} are +not set (or previous settings are not changed) and an error code is +returned. + +@strong{Important:} All distribution objects given in the argument +list are destroyed! +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_set_marginal_list} +@deftypefn {} {int} unur_distr_cvec_set_marginal_list (UNUR_DISTR* @var{distribution}, ...) +Similar to the above +@ifhtml +@ref{funct:unur_distr_cvec_set_marginal_array,@command{unur_distr_cvec_set_marginal_array}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_marginal_array} +@end ifnothtml +call. +However, now the pointers to the particular marginal distributions +can be given as parameter and does not require an array of +pointers. Additionally the given distribution objects are +immediately destroyed. Thus calls like +@ifhtml +@ref{funct:unur_distr_normal,@command{unur_distr_normal}} +@end ifhtml +@ifnothtml +@command{unur_distr_normal} +@end ifnothtml +can be +used as arguments. +(With +@ifhtml +@ref{funct:unur_distr_cvec_set_marginal_array,@command{unur_distr_cvec_set_marginal_array}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_marginal_array} +@end ifnothtml +the result of such call +has to be stored in a pointer since it has to be freed afterwarts +to avoid memory leaks!) + +The number of pointers to in the list of function arguments +@strong{must} be equal to the dimension of the @var{distribution}, +i.e. the dimension returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +If one of the given pointer to marginal distributions is the @code{NULL} +pointer then the marginal distributions of @var{distribution} are +not set (or previous settings are not changed) and an error code is +returned. + +@strong{Important:} All distribution objects given in the argument +list are destroyed! +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_get_marginal} +@deftypefn Function {const UNUR_DISTR*} unur_distr_cvec_get_marginal (const @var{UNUR_DISTR* distribution}, int @var{n}) +Get pointer to the @var{n}-th marginal distribution +object from the given multivariate @var{distribution}. +If this does not exist, @code{NULL} is returned. +The marginal distributions are enumerated from @code{1} +to @code{dim}, where @code{dim} is the dimension +returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_get_marginal} +@deftypefn {} {const UNUR_DISTR*} unur_distr_cvec_get_marginal (const @var{UNUR_DISTR* distribution}, int @var{n}) +Get pointer to the @var{n}-th marginal distribution +object from the given multivariate @var{distribution}. +If this does not exist, @code{NULL} is returned. +The marginal distributions are enumerated from @code{1} +to @code{dim}, where @code{dim} is the dimension +returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_set_pdfparams} +@deftypefn Function {int} unur_distr_cvec_set_pdfparams (UNUR_DISTR* @var{distribution}, const @var{double* params}, int @var{n_params}) +Sets array of parameters for @var{distribution}. There is an upper limit +for the number of parameters @code{n_params}. It is given by the +macro @code{UNUR_DISTR_MAXPARAMS} in @file{unuran_config.h}. (It is set to +5 by default but can be changed to any appropriate nonnegative number.) +If @var{n_params} is negative or exceeds this limit no parameters +are copied into the distribution object and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_NPARAMS}. + +For standard distributions from the UNU.RAN library the parameters +are checked. Moreover, the domain is updated automatically. +If the given parameters are invalid for the standard distribution, +then no parameters are set and an error code is returned. +Notice that the given parameter list for such a distribution is +handled in the same way as in the corresponding @command{new} +calls, i.e. optional parameters for the PDF that are not present in +the given list are (re-)set to their default values. + +@strong{Important:} If the parameters of a distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}) +are changed, then neither its mode nor the normalization +constant are updated. Please use the respective calls +@ifhtml +@ref{funct:unur_distr_cvec_upd_mode,@command{unur_distr_cvec_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_upd_mode} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_distr_cvec_upd_pdfvol,@command{unur_distr_cvec_upd_pdfvol}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_upd_pdfvol}. +@end ifnothtml +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_set_pdfparams} +@deftypefn {} {int} unur_distr_cvec_set_pdfparams (UNUR_DISTR* @var{distribution}, const @var{double* params}, int @var{n_params}) +Sets array of parameters for @var{distribution}. There is an upper limit +for the number of parameters @code{n_params}. It is given by the +macro @code{UNUR_DISTR_MAXPARAMS} in @file{unuran_config.h}. (It is set to +5 by default but can be changed to any appropriate nonnegative number.) +If @var{n_params} is negative or exceeds this limit no parameters +are copied into the distribution object and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_NPARAMS}. + +For standard distributions from the UNU.RAN library the parameters +are checked. Moreover, the domain is updated automatically. +If the given parameters are invalid for the standard distribution, +then no parameters are set and an error code is returned. +Notice that the given parameter list for such a distribution is +handled in the same way as in the corresponding @command{new} +calls, i.e. optional parameters for the PDF that are not present in +the given list are (re-)set to their default values. + +@strong{Important:} If the parameters of a distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}) +are changed, then neither its mode nor the normalization +constant are updated. Please use the respective calls +@ifhtml +@ref{funct:unur_distr_cvec_upd_mode,@command{unur_distr_cvec_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_upd_mode} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_distr_cvec_upd_pdfvol,@command{unur_distr_cvec_upd_pdfvol}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_upd_pdfvol}. +@end ifnothtml +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_get_pdfparams} +@deftypefn Function {int} unur_distr_cvec_get_pdfparams (const @var{UNUR_DISTR* distribution}, const @var{double** params}) +Get number of parameters of the PDF and set pointer @var{params} to +array of parameters. If no parameters are stored in the object, an +error code is returned and @code{params} is set to @code{NULL}. + +@emph{Important:} Do @strong{not} change the entries in @var{params}! +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_get_pdfparams} +@deftypefn {} {int} unur_distr_cvec_get_pdfparams (const @var{UNUR_DISTR* distribution}, const @var{double** params}) +Get number of parameters of the PDF and set pointer @var{params} to +array of parameters. If no parameters are stored in the object, an +error code is returned and @code{params} is set to @code{NULL}. + +@emph{Important:} Do @strong{not} change the entries in @var{params}! +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_set_pdfparams_vec} +@deftypefn Function {int} unur_distr_cvec_set_pdfparams_vec (UNUR_DISTR* @var{distribution}, int @var{par}, const @var{double* param_vec}, int @var{n_params}) +This function provides an interface for additional vector parameters for a +multivariate @var{distribution} besides mean vector and covariance +matrix which have their own calls. + +It sets the parameter with number @var{par}. +@var{par} indicates directly which of the parameters is set and +must be a number between @code{0} and @code{UNUR_DISTR_MAXPARAMS}-1 +(the upper limit of possible parameters defined in +@file{unuran_config.h}; it is set to 5 but can be changed to any +appropriate nonnegative number.) + +The entries of a this parameter are given by the array @var{param_vec} +of size @var{n_params}. Notice that using this interface an +An (@i{n} x @i{m})-matrix has to be stored in an array of length +@var{n_params} = @i{n} times @i{m}; where the rows of the matrix +are stored consecutively in this array. + +Due to great variety of possible parameters for a multivariate +@var{distribution} there is no simpler interface. + +If @var{param_vec} is @code{NULL} then the corresponding entry is cleared. + +@strong{Important:} If the parameters of a distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}) +are changed, then neither its mode nor the normalization +constant are updated. Please use the respective calls +@ifhtml +@ref{funct:unur_distr_cvec_upd_mode,@command{unur_distr_cvec_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_upd_mode} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_distr_cvec_upd_pdfvol,@command{unur_distr_cvec_upd_pdfvol}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_upd_pdfvol}. +@end ifnothtml +If an error occurs no parameters are copied into the parameter +object @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_set_pdfparams_vec} +@deftypefn {} {int} unur_distr_cvec_set_pdfparams_vec (UNUR_DISTR* @var{distribution}, int @var{par}, const @var{double* param_vec}, int @var{n_params}) +This function provides an interface for additional vector parameters for a +multivariate @var{distribution} besides mean vector and covariance +matrix which have their own calls. + +It sets the parameter with number @var{par}. +@var{par} indicates directly which of the parameters is set and +must be a number between @code{0} and @code{UNUR_DISTR_MAXPARAMS}-1 +(the upper limit of possible parameters defined in +@file{unuran_config.h}; it is set to 5 but can be changed to any +appropriate nonnegative number.) + +The entries of a this parameter are given by the array @var{param_vec} +of size @var{n_params}. Notice that using this interface an +An (@i{n} x @i{m})-matrix has to be stored in an array of length +@var{n_params} = @i{n} times @i{m}; where the rows of the matrix +are stored consecutively in this array. + +Due to great variety of possible parameters for a multivariate +@var{distribution} there is no simpler interface. + +If @var{param_vec} is @code{NULL} then the corresponding entry is cleared. + +@strong{Important:} If the parameters of a distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}) +are changed, then neither its mode nor the normalization +constant are updated. Please use the respective calls +@ifhtml +@ref{funct:unur_distr_cvec_upd_mode,@command{unur_distr_cvec_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_upd_mode} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_distr_cvec_upd_pdfvol,@command{unur_distr_cvec_upd_pdfvol}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_upd_pdfvol}. +@end ifnothtml +If an error occurs no parameters are copied into the parameter +object @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_get_pdfparams_vec} +@deftypefn Function {int} unur_distr_cvec_get_pdfparams_vec (const @var{UNUR_DISTR* distribution}, int @var{par}, const @var{double** param_vecs}) +Get parameter of the PDF with number @var{par}. +The pointer to the parameter array is stored in @var{param_vecs}, its +size is returned by the function. +If the requested parameter is not set, then an error code is returned +and @code{params} is set to @code{NULL}. + +@emph{Important:} Do @strong{not} change the entries in @var{param_vecs}! +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_get_pdfparams_vec} +@deftypefn {} {int} unur_distr_cvec_get_pdfparams_vec (const @var{UNUR_DISTR* distribution}, int @var{par}, const @var{double** param_vecs}) +Get parameter of the PDF with number @var{par}. +The pointer to the parameter array is stored in @var{param_vecs}, its +size is returned by the function. +If the requested parameter is not set, then an error code is returned +and @code{params} is set to @code{NULL}. + +@emph{Important:} Do @strong{not} change the entries in @var{param_vecs}! +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_set_domain_rect} +@deftypefn Function {int} unur_distr_cvec_set_domain_rect (UNUR_DISTR* @var{distribution}, const @var{double* lowerleft}, const @var{double* upperright}) +Set rectangular domain for @var{distribution} with @var{lowerleft} +and @var{upperright} vertices. Both must be pointer to an +array of the size returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +A @code{NULL} pointer is interpreted as the zero vector (0,@dots{},0). +For setting a coordinate of the boundary to +@math{+/- infinity} +use @code{+/- UNUR_INFINITY}. +The @var{lowerleft} vertex must be strictly smaller than +@var{upperright} in each component. Otherwise no domain +is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. + +By default the domain of a distribution is unbounded. Thus one can +use this call to truncate an existing distribution. + +@emph{Important:} Changing the domain of @var{distribution} +marks derived parameters like the mode or the center as unknown and +must be set @emph{after} changing the domain. This is important for +the already set (or default) value for the center does not +fall into the given domain. +Notice that calls of the PDF and derived functions return @code{0.} +when the parameter is not contained in the domain. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_set_domain_rect} +@deftypefn {} {int} unur_distr_cvec_set_domain_rect (UNUR_DISTR* @var{distribution}, const @var{double* lowerleft}, const @var{double* upperright}) +Set rectangular domain for @var{distribution} with @var{lowerleft} +and @var{upperright} vertices. Both must be pointer to an +array of the size returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +A @code{NULL} pointer is interpreted as the zero vector (0,@dots{},0). +For setting a coordinate of the boundary to +@iftex +@math{\pm\infty} +@end iftex +@ifhtml +@html ++/- infinity +@end html +@end ifhtml +use @code{+/- UNUR_INFINITY}. +The @var{lowerleft} vertex must be strictly smaller than +@var{upperright} in each component. Otherwise no domain +is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. + +By default the domain of a distribution is unbounded. Thus one can +use this call to truncate an existing distribution. + +@emph{Important:} Changing the domain of @var{distribution} +marks derived parameters like the mode or the center as unknown and +must be set @emph{after} changing the domain. This is important for +the already set (or default) value for the center does not +fall into the given domain. +Notice that calls of the PDF and derived functions return @code{0.} +when the parameter is not contained in the domain. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_is_indomain} +@deftypefn Function {int} unur_distr_cvec_is_indomain (const @var{double* x}, const @var{UNUR_DISTR* distribution}) +Check whether @var{x} falls into the domain of @var{distribution}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_is_indomain} +@deftypefn {} {int} unur_distr_cvec_is_indomain (const @var{double* x}, const @var{UNUR_DISTR* distribution}) +Check whether @var{x} falls into the domain of @var{distribution}. +@end deftypefn +@end ifnotinfo + +@subsubheading Derived parameters + +The following paramters @strong{must} be set whenever one of the +essential parameters has been set or changed (and the parameter is +required for the chosen method). + +@ifinfo +@anchor{funct:unur_distr_cvec_set_mode} +@deftypefn Function {int} unur_distr_cvec_set_mode (UNUR_DISTR* @var{distribution}, const @var{double* mode}) +Set mode of the @var{distribution}. @var{mode} must be a pointer to an +array of the size returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +A @code{NULL} pointer for @var{mode} is interpreted as the zero +vector (0,@dots{},0). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_set_mode} +@deftypefn {} {int} unur_distr_cvec_set_mode (UNUR_DISTR* @var{distribution}, const @var{double* mode}) +Set mode of the @var{distribution}. @var{mode} must be a pointer to an +array of the size returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +A @code{NULL} pointer for @var{mode} is interpreted as the zero +vector (0,@dots{},0). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_upd_mode} +@deftypefn Function {int} unur_distr_cvec_upd_mode (UNUR_DISTR* @var{distribution}) +Recompute the mode of the @var{distribution}. This call works +properly for distribution objects from the UNU.RAN library of +standard distributions when the corresponding function is +available. If it failes @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_DATA}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_upd_mode} +@deftypefn {} {int} unur_distr_cvec_upd_mode (UNUR_DISTR* @var{distribution}) +Recompute the mode of the @var{distribution}. This call works +properly for distribution objects from the UNU.RAN library of +standard distributions when the corresponding function is +available. If it failes @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_DATA}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_get_mode} +@deftypefn Function {const double*} unur_distr_cvec_get_mode (UNUR_DISTR* @var{distribution}) +Get mode of the @var{distribution}. The function returns a pointer to +an array of the size returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +If the mode is not marked as known the @code{NULL} pointer is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. +(There is no difference between the case where no routine for +computing the mode is available and the case where no mode exists +for the @var{distribution} at all.) + +@emph{Important:} Do @strong{not} modify the array that holds the mode! +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_get_mode} +@deftypefn {} {const double*} unur_distr_cvec_get_mode (UNUR_DISTR* @var{distribution}) +Get mode of the @var{distribution}. The function returns a pointer to +an array of the size returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +If the mode is not marked as known the @code{NULL} pointer is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. +(There is no difference between the case where no routine for +computing the mode is available and the case where no mode exists +for the @var{distribution} at all.) + +@emph{Important:} Do @strong{not} modify the array that holds the mode! +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_set_center} +@deftypefn Function {int} unur_distr_cvec_set_center (UNUR_DISTR* @var{distribution}, const @var{double* center}) +Set center of the @var{distribution}. @var{center} must be a pointer to an +array of the size returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +A @code{NULL} pointer for @var{center} is interpreted as the zero +vector (0,@dots{},0). + +The center is used by some methods to shift the distribution in +order to decrease numerical round-off error. +If not given explicitly a default is used. +Moreover, it is used as starting point for several numerical search +algorithm (e.g. for the mode). Then @var{center} must be a pointer +where the call to the PDF returns a non-zero value. +In particular @var{center} must contained in the domain of the distribution. + +Default: The mode, if given by a +@ifhtml +@ref{funct:unur_distr_cvec_set_mode,@command{unur_distr_cvec_set_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_mode} +@end ifnothtml +call; +else the mean, if given by a +@ifhtml +@ref{funct:unur_distr_cvec_set_mean,@command{unur_distr_cvec_set_mean}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_mean} +@end ifnothtml +call; +otherwise the null vector (0,@dots{},0). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_set_center} +@deftypefn {} {int} unur_distr_cvec_set_center (UNUR_DISTR* @var{distribution}, const @var{double* center}) +Set center of the @var{distribution}. @var{center} must be a pointer to an +array of the size returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +A @code{NULL} pointer for @var{center} is interpreted as the zero +vector (0,@dots{},0). + +The center is used by some methods to shift the distribution in +order to decrease numerical round-off error. +If not given explicitly a default is used. +Moreover, it is used as starting point for several numerical search +algorithm (e.g. for the mode). Then @var{center} must be a pointer +where the call to the PDF returns a non-zero value. +In particular @var{center} must contained in the domain of the distribution. + +Default: The mode, if given by a +@ifhtml +@ref{funct:unur_distr_cvec_set_mode,@command{unur_distr_cvec_set_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_mode} +@end ifnothtml +call; +else the mean, if given by a +@ifhtml +@ref{funct:unur_distr_cvec_set_mean,@command{unur_distr_cvec_set_mean}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_mean} +@end ifnothtml +call; +otherwise the null vector (0,@dots{},0). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_get_center} +@deftypefn Function {const double*} unur_distr_cvec_get_center (UNUR_DISTR* @var{distribution}) +Get center of the @var{distribution}. The function returns a pointer to +an array of the size returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +It always returns some point as there always exists a default for +the center, see +@ifhtml +@ref{funct:unur_distr_cvec_set_center,@command{unur_distr_cvec_set_center}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_center}. +@end ifnothtml +@emph{Important:} Do @strong{not} modify the array that holds the center! +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_get_center} +@deftypefn {} {const double*} unur_distr_cvec_get_center (UNUR_DISTR* @var{distribution}) +Get center of the @var{distribution}. The function returns a pointer to +an array of the size returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +It always returns some point as there always exists a default for +the center, see +@ifhtml +@ref{funct:unur_distr_cvec_set_center,@command{unur_distr_cvec_set_center}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_center}. +@end ifnothtml +@emph{Important:} Do @strong{not} modify the array that holds the center! +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_set_pdfvol} +@deftypefn Function {int} unur_distr_cvec_set_pdfvol (UNUR_DISTR* @var{distribution}, double @var{volume}) +Set the volume below the PDF. If @var{vol} is non-positive, no +volume is set and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_SET}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_set_pdfvol} +@deftypefn {} {int} unur_distr_cvec_set_pdfvol (UNUR_DISTR* @var{distribution}, double @var{volume}) +Set the volume below the PDF. If @var{vol} is non-positive, no +volume is set and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_SET}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_upd_pdfvol} +@deftypefn Function {int} unur_distr_cvec_upd_pdfvol (UNUR_DISTR* @var{distribution}) +Recompute the volume below the PDF of the distribution. +It only works for distribution objects from the +UNU.RAN library of standard distributions when the +corresponding function is available. Otherwise @code{unur_errno} is +set to @code{UNUR_ERR_DISTR_DATA}. + +This call also sets the normalization constant such that the given +PDF is the derivative of a given CDF, i.e. the volume is 1. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_upd_pdfvol} +@deftypefn {} {int} unur_distr_cvec_upd_pdfvol (UNUR_DISTR* @var{distribution}) +Recompute the volume below the PDF of the distribution. +It only works for distribution objects from the +UNU.RAN library of standard distributions when the +corresponding function is available. Otherwise @code{unur_errno} is +set to @code{UNUR_ERR_DISTR_DATA}. + +This call also sets the normalization constant such that the given +PDF is the derivative of a given CDF, i.e. the volume is 1. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvec_get_pdfvol} +@deftypefn Function {double} unur_distr_cvec_get_pdfvol (UNUR_DISTR* @var{distribution}) +Get the volume below the PDF of the @var{distribution}. If this volume is +not known,@* +@ifhtml +@ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_pdfarea} +@end ifnothtml +is called to compute +it. If this is not successful @code{UNUR_INFINITY} is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvec_get_pdfvol} +@deftypefn {} {double} unur_distr_cvec_get_pdfvol (UNUR_DISTR* @var{distribution}) +Get the volume below the PDF of the @var{distribution}. If this volume is +not known,@* +@ifhtml +@ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_pdfarea} +@end ifnothtml +is called to compute +it. If this is not successful @code{UNUR_INFINITY} is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of cvec.h +@c ------------------------------------- +@c ------------------------------------- +@c condi.h +@c + +@page +@node CONDI +@section Continuous univariate full conditional distribution + + +Full conditional distribution for a given continuous +multivariate distributiion. The condition is a position vector +and either a variable that is variated or a vector that +indicates the direction on which the random vector can variate. + +There is a subtle difference between using direction +vector and using the @var{k}-th variable. +When a direction vector is given the PDF of the conditional +distribution is defined by +@iftex +@math{f(t) = PDF(pos + t\cdot dir).} +@end iftex +@ifhtml +@html +f(t) = PDF(pos + t * dir). +@end html +@end ifhtml +@ifinfo +@math{f(t) = PDF(pos + t * dir).} +@end ifinfo +When a variable is selected the full conditional distribution +with all other variables fixed is used. + +This is a special case of a continuous univariate distribution +and thus they have most of these parameters (with the exception +that functions cannot be changed). Additionally, + +@itemize @minus +@item there is a call to extract the underlying multivariate +distribution, + +@item and a call to handle the variables that are fixed and the +direction for changing the random vector. + +@end itemize + +This distibution type is primarily used for evaluation the +conditional distribution and its derivative (as required for, +e.g., the Gibbs sampler). The density is not normalized (i.e. does +not integrate to one). Mode and area are not available and it +does not make sense to use any call to set or change parameters +except the ones given below. + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_distr_condi_new,unur_distr_condi_new} +@item @ref{funct:unur_distr_condi_set_condition,unur_distr_condi_set_condition} +@item @ref{funct:unur_distr_condi_get_condition,unur_distr_condi_get_condition} +@item @ref{funct:unur_distr_condi_get_distribution,unur_distr_condi_get_distribution} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_distr_condi_new} +@deftypefn Function {UNUR_DISTR*} unur_distr_condi_new (const @var{UNUR_DISTR* distribution}, const @var{double* pos}, const @var{double* dir}, int @var{k}) +Create an object for full conditional distribution for the given +@var{distribution}. The condition is given by a position vector +@var{pos} and either the @var{k}-th variable that is variated or +the vector @var{dir} that contains the direction on which the +random vector can variate. + +@var{distribution} must be a pointer to a multivariate continuous +distribution. +@var{pos} must be a pointer to an array of size @code{dim}, where +@code{dim} is the dimension of the underlying distribution object. +@var{dir} must be a pointer to an array if size @code{dim} or @code{NULL}. +@var{k} must be in the range @code{0, @dots{}, dim-1}. +If the @var{k}-th variable is used, @var{dir} must be set to @code{NULL}. + +@emph{Notice:} There is a subtle difference between using direction +vector @var{dir} and using the @var{k}-th variable. +When @var{dir} is given, the current position @var{pos} is mapped into +0 of the conditional distribution and the derivative is taken from +the function PDF(@var{pos}+t*@var{dir}) w.r.t. @i{t}. +On the other hand, when the coordinate @var{k} is used (i.e., when +@var{dir} is set to @code{NULL}), the full conditional distribution of the +distribution is considered (as used for the Gibbs sampler). +In particular, the current point is just projected into the +one-dimensional subspace without mapping it into the point 0. + +@emph{Notice:} If a coordinate @var{k} is used, then the @var{k}-th +partial derivative is used if it as available. Otherwise the +gradient is computed and the @var{k}-th component is returned. + +The resulting generator object is of the same type as of a +@ifhtml +@ref{funct:unur_distr_cont_new,@command{unur_distr_cont_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_new} +@end ifnothtml +call. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_condi_new} +@deftypefn {} {UNUR_DISTR*} unur_distr_condi_new (const @var{UNUR_DISTR* distribution}, const @var{double* pos}, const @var{double* dir}, int @var{k}) +Create an object for full conditional distribution for the given +@var{distribution}. The condition is given by a position vector +@var{pos} and either the @var{k}-th variable that is variated or +the vector @var{dir} that contains the direction on which the +random vector can variate. + +@var{distribution} must be a pointer to a multivariate continuous +distribution. +@var{pos} must be a pointer to an array of size @code{dim}, where +@code{dim} is the dimension of the underlying distribution object. +@var{dir} must be a pointer to an array if size @code{dim} or @code{NULL}. +@var{k} must be in the range @code{0, @dots{}, dim-1}. +If the @var{k}-th variable is used, @var{dir} must be set to @code{NULL}. + +@emph{Notice:} There is a subtle difference between using direction +vector @var{dir} and using the @var{k}-th variable. +When @var{dir} is given, the current position @var{pos} is mapped into +0 of the conditional distribution and the derivative is taken from +the function PDF(@var{pos}+t*@var{dir}) w.r.t. @i{t}. +On the other hand, when the coordinate @var{k} is used (i.e., when +@var{dir} is set to @code{NULL}), the full conditional distribution of the +distribution is considered (as used for the Gibbs sampler). +In particular, the current point is just projected into the +one-dimensional subspace without mapping it into the point 0. + +@emph{Notice:} If a coordinate @var{k} is used, then the @var{k}-th +partial derivative is used if it as available. Otherwise the +gradient is computed and the @var{k}-th component is returned. + +The resulting generator object is of the same type as of a +@ifhtml +@ref{funct:unur_distr_cont_new,@command{unur_distr_cont_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_new} +@end ifnothtml +call. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_condi_set_condition} +@deftypefn Function {int} unur_distr_condi_set_condition (struct @var{unur_distr* distribution}, const @var{double* pos}, const @var{double* dir}, int @var{k}) +Set/change condition for conditional @var{distribution}. +Change values of fixed variables to @var{pos} and use direction +@var{dir} or @var{k}-th variable of conditional @var{distribution}. + +@var{pos} must be a pointer to an array of size @code{dim}, where +@code{dim} is the dimension of the underlying distribution object. +@var{dir} must be a pointer to an array if size @code{dim} or @code{NULL}. +@var{k} must be in the range @code{0, @dots{}, dim-1}. +If the @var{k}-th variable is used, @var{dir} must be set to @code{NULL}. + +@emph{Notice:} There is a subtle difference between using direction +vector @var{dir} and using the @var{k}-th variable. +When @var{dir} is given, the current position @var{pos} is mapped into +0 of the conditional distribution and the derivative is taken from +the function PDF(@var{pos}+t*@var{dir}) w.r.t. @i{t}. +On the other hand, when the coordinate @var{k} is used (i.e., when +@var{dir} is set to @code{NULL}), the full conditional distribution of the +distribution is considered (as used for the Gibbs sampler). +In particular, the current point is just projected into the +one-dimensional subspace without mapping it into the point 0. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_condi_set_condition} +@deftypefn {} {int} unur_distr_condi_set_condition (struct @var{unur_distr* distribution}, const @var{double* pos}, const @var{double* dir}, int @var{k}) +Set/change condition for conditional @var{distribution}. +Change values of fixed variables to @var{pos} and use direction +@var{dir} or @var{k}-th variable of conditional @var{distribution}. + +@var{pos} must be a pointer to an array of size @code{dim}, where +@code{dim} is the dimension of the underlying distribution object. +@var{dir} must be a pointer to an array if size @code{dim} or @code{NULL}. +@var{k} must be in the range @code{0, @dots{}, dim-1}. +If the @var{k}-th variable is used, @var{dir} must be set to @code{NULL}. + +@emph{Notice:} There is a subtle difference between using direction +vector @var{dir} and using the @var{k}-th variable. +When @var{dir} is given, the current position @var{pos} is mapped into +0 of the conditional distribution and the derivative is taken from +the function PDF(@var{pos}+t*@var{dir}) w.r.t. @i{t}. +On the other hand, when the coordinate @var{k} is used (i.e., when +@var{dir} is set to @code{NULL}), the full conditional distribution of the +distribution is considered (as used for the Gibbs sampler). +In particular, the current point is just projected into the +one-dimensional subspace without mapping it into the point 0. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_condi_get_condition} +@deftypefn Function {int} unur_distr_condi_get_condition (struct @var{unur_distr* distribution}, const @var{double** pos}, const @var{double** dir}, int* @var{k}) +Get condition for conditional @var{distribution}. +The values for the fixed variables are stored in @var{pos}, which +must be a pointer to an array of size @code{dim}. +The condition is stored in @var{dir} and @var{k}, respectively. + +@emph{Important:} Do @strong{not} change the entries in @var{pos} +and @var{dir}! +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_condi_get_condition} +@deftypefn {} {int} unur_distr_condi_get_condition (struct @var{unur_distr* distribution}, const @var{double** pos}, const @var{double** dir}, int* @var{k}) +Get condition for conditional @var{distribution}. +The values for the fixed variables are stored in @var{pos}, which +must be a pointer to an array of size @code{dim}. +The condition is stored in @var{dir} and @var{k}, respectively. + +@emph{Important:} Do @strong{not} change the entries in @var{pos} +and @var{dir}! +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_condi_get_distribution} +@deftypefn Function {const UNUR_DISTR*} unur_distr_condi_get_distribution (const @var{UNUR_DISTR* distribution}) +Get pointer to distribution object for underlying distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_condi_get_distribution} +@deftypefn {} {const UNUR_DISTR*} unur_distr_condi_get_distribution (const @var{UNUR_DISTR* distribution}) +Get pointer to distribution object for underlying distribution. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of condi.h +@c ------------------------------------- +@c ------------------------------------- +@c cvemp.h +@c + +@page +@node CVEMP +@section Continuous empirical multivariate distributions + + +Empirical multivariate distributions are just lists of vectors +(with the same dimension). +Thus there are only calls to insert these data. +How these data are used to sample from the empirical distribution +depends from the chosen generation method. + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_distr_cvemp_new,unur_distr_cvemp_new} +@item @ref{funct:unur_distr_cvemp_set_data,unur_distr_cvemp_set_data} +@item @ref{funct:unur_distr_cvemp_read_data,unur_distr_cvemp_read_data} +@item @ref{funct:unur_distr_cvemp_get_data,unur_distr_cvemp_get_data} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_distr_cvemp_new} +@deftypefn Function {UNUR_DISTR*} unur_distr_cvemp_new (int @var{dim}) +Create a new (empty) object for an empirical multivariate +continuous distribution. @var{dim} is the number of components of +the random vector (i.e. its dimension). It must be at least 2; +otherwise +@ifhtml +@ref{funct:unur_distr_cemp_new,@command{unur_distr_cemp_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cemp_new} +@end ifnothtml +should be used to create an object +for an empirical univariate distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvemp_new} +@deftypefn {} {UNUR_DISTR*} unur_distr_cvemp_new (int @var{dim}) +Create a new (empty) object for an empirical multivariate +continuous distribution. @var{dim} is the number of components of +the random vector (i.e. its dimension). It must be at least 2; +otherwise +@ifhtml +@ref{funct:unur_distr_cemp_new,@command{unur_distr_cemp_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cemp_new} +@end ifnothtml +should be used to create an object +for an empirical univariate distribution. +@end deftypefn +@end ifnotinfo + +@subsubheading Essential parameters + +@ifinfo +@anchor{funct:unur_distr_cvemp_set_data} +@deftypefn Function {int} unur_distr_cvemp_set_data (UNUR_DISTR* @var{distribution}, const @var{double* sample}, int @var{n_sample}) +Set observed sample for empirical @var{distribution}. +@var{sample} is an array of doubles of size +@code{dim} x @var{n_sample}, where +@code{dim} is the dimension of the @var{distribution} returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +The data points must be stored consecutively in @var{sample}, i.e., +data points (x1, y1), (x2, y2), @dots{} are given as an array +@{x1, y1, x2, y2, @dots{}@}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvemp_set_data} +@deftypefn {} {int} unur_distr_cvemp_set_data (UNUR_DISTR* @var{distribution}, const @var{double* sample}, int @var{n_sample}) +Set observed sample for empirical @var{distribution}. +@var{sample} is an array of doubles of size +@code{dim} x @var{n_sample}, where +@code{dim} is the dimension of the @var{distribution} returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +The data points must be stored consecutively in @var{sample}, i.e., +data points (x1, y1), (x2, y2), @dots{} are given as an array +@{x1, y1, x2, y2, @dots{}@}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvemp_read_data} +@deftypefn Function {int} unur_distr_cvemp_read_data (UNUR_DISTR* @var{distribution}, const @var{char* filename}) +Read data from file @file{filename}. +It reads the first @code{dim} numbers from each line, where +@code{dim} is the dimension of the @var{distribution} returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +Numbers are parsed by means of the C standard routine @command{strtod}. +Lines that do not start with @code{+}, @code{-}, @code{.}, or a +digit are ignored. (Beware of lines starting with a blank!) + +In case of an error (file cannot be opened, too few entries in a +line, invalid string for double in line) no data are copied into +the distribution object and an error code is returned. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvemp_read_data} +@deftypefn {} {int} unur_distr_cvemp_read_data (UNUR_DISTR* @var{distribution}, const @var{char* filename}) +Read data from file @file{filename}. +It reads the first @code{dim} numbers from each line, where +@code{dim} is the dimension of the @var{distribution} returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim}. +@end ifnothtml +Numbers are parsed by means of the C standard routine @command{strtod}. +Lines that do not start with @code{+}, @code{-}, @code{.}, or a +digit are ignored. (Beware of lines starting with a blank!) + +In case of an error (file cannot be opened, too few entries in a +line, invalid string for double in line) no data are copied into +the distribution object and an error code is returned. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_cvemp_get_data} +@deftypefn Function {int} unur_distr_cvemp_get_data (const @var{UNUR_DISTR* distribution}, const @var{double** sample}) +Get number of samples and set pointer @var{sample} to array of +observations. If no sample has been given, an error code +is returned and @var{sample} is set to @code{NULL}. +If successful @var{sample} points to an array of length +@code{dim} x @code{n_sample}, where +@code{dim} is the dimension of the distribution returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim} +@end ifnothtml +and @code{n_sample} the return value of the +function. + +@emph{Important:} Do @strong{not} modify the array @var{sample}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_cvemp_get_data} +@deftypefn {} {int} unur_distr_cvemp_get_data (const @var{UNUR_DISTR* distribution}, const @var{double** sample}) +Get number of samples and set pointer @var{sample} to array of +observations. If no sample has been given, an error code +is returned and @var{sample} is set to @code{NULL}. +If successful @var{sample} points to an array of length +@code{dim} x @code{n_sample}, where +@code{dim} is the dimension of the distribution returned by +@ifhtml +@ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}} +@end ifhtml +@ifnothtml +@command{unur_distr_get_dim} +@end ifnothtml +and @code{n_sample} the return value of the +function. + +@emph{Important:} Do @strong{not} modify the array @var{sample}. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of cvemp.h +@c ------------------------------------- +@c ------------------------------------- +@c matr.h +@c + +@page +@node MATR +@section MATRix distributions + + +Distributions for random matrices. Notice that UNU.RAN uses +arrays of @code{double}s to handle matrices. The rows of +the matrix are stored consecutively. + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_distr_matr_new,unur_distr_matr_new} +@item @ref{funct:unur_distr_matr_get_dim,unur_distr_matr_get_dim} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_distr_matr_new} +@deftypefn Function {UNUR_DISTR*} unur_distr_matr_new (int @var{n_rows}, int @var{n_cols}) +Create a new (empty) object for a matrix distribution. @var{n_rows} +and @var{n_cols} are the respective numbers of rows and columns of +the random matrix (i.e. its dimensions). It is also possible to +have only one number or rows and/or columns. +Notice, however, that this is treated as a distribution of random +matrices with only one row or column or component and not as a +distribution of vectors or real numbers. For the latter +@ifhtml +@ref{funct:unur_distr_cont_new,@command{unur_distr_cont_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_new} +@end ifnothtml +or +@ifhtml +@ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_new} +@end ifnothtml +should be +used to create an object for a univariate distribution and a +multivariate (vector) distribution, respectively. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_matr_new} +@deftypefn {} {UNUR_DISTR*} unur_distr_matr_new (int @var{n_rows}, int @var{n_cols}) +Create a new (empty) object for a matrix distribution. @var{n_rows} +and @var{n_cols} are the respective numbers of rows and columns of +the random matrix (i.e. its dimensions). It is also possible to +have only one number or rows and/or columns. +Notice, however, that this is treated as a distribution of random +matrices with only one row or column or component and not as a +distribution of vectors or real numbers. For the latter +@ifhtml +@ref{funct:unur_distr_cont_new,@command{unur_distr_cont_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_new} +@end ifnothtml +or +@ifhtml +@ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_new} +@end ifnothtml +should be +used to create an object for a univariate distribution and a +multivariate (vector) distribution, respectively. +@end deftypefn +@end ifnotinfo + +@subsubheading Essential parameters + +@ifinfo +@anchor{funct:unur_distr_matr_get_dim} +@deftypefn Function {int} unur_distr_matr_get_dim (const @var{UNUR_DISTR* distribution}, int* @var{n_rows}, int* @var{n_cols}) +Get number of rows and columns of random matrix (its dimension). +It returns the total number of components. If successfull +@code{UNUR_SUCCESS} is returned. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_matr_get_dim} +@deftypefn {} {int} unur_distr_matr_get_dim (const @var{UNUR_DISTR* distribution}, int* @var{n_rows}, int* @var{n_cols}) +Get number of rows and columns of random matrix (its dimension). +It returns the total number of components. If successfull +@code{UNUR_SUCCESS} is returned. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of matr.h +@c ------------------------------------- +@c ------------------------------------- +@c discr.h +@c + +@page +@node DISCR +@section Discrete univariate distributions + + +The calls in this section can be applied to discrete +univariate distributions. + +@itemize @minus +@item Create a @command{new} instance of a discrete univariate +distribution. + +@item Handle and evaluate +distribution function (CDF, @command{cdf}) and +probability mass function (PMF, @command{pmf}). +The following is important: +@itemize . +@item @command{pmf} need not be normalized, i.e., +any summable nonnegative function on the set of intergers can be +used. +@item @command{cdf} must be a distribution function, i.e. it +must be monotonically increasing with range [0,1]. +@item If @command{cdf} and @command{pdf} are used together for a +pariticular generation method, then @command{pmf} must be +normalized, i.e. it must sum to 1. +@end itemize + +@item Alternatively, @command{cdf} and @command{pdf} can be +provided as @command{str}ings instead of function pointers. + +@item Some generation methods require a (finite) probability +vector (PV, @command{pv}), i.e. an array of @code{double}s. +It can be automatically computed if the @command{pmf} is +given but @command{pv} is not. + +@item Set (and change) parameters (@command{pmfparams}) and the +total sum (@command{pmfsum}) of the given PMF or PV. + +@item Set the @command{mode} of the distribution. + +@item Set the @command{domain} of the distribution. + +@end itemize + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_distr_discr_new,unur_distr_discr_new} +@item @ref{funct:unur_distr_discr_set_pv,unur_distr_discr_set_pv} +@item @ref{funct:unur_distr_discr_make_pv,unur_distr_discr_make_pv} +@item @ref{funct:unur_distr_discr_get_pv,unur_distr_discr_get_pv} +@item @ref{funct:unur_distr_discr_set_pmf,unur_distr_discr_set_pmf} +@item @ref{funct:unur_distr_discr_set_cdf,unur_distr_discr_set_cdf} +@item @ref{funct:unur_distr_discr_set_invcdf,unur_distr_discr_set_invcdf} +@item @ref{funct:unur_distr_discr_eval_pv,unur_distr_discr_eval_pv} +@item @ref{funct:unur_distr_discr_eval_pmf,unur_distr_discr_eval_pmf} +@item @ref{funct:unur_distr_discr_eval_cdf,unur_distr_discr_eval_cdf} +@item @ref{funct:unur_distr_discr_eval_invcdf,unur_distr_discr_eval_invcdf} +@item @ref{funct:unur_distr_discr_set_pmfstr,unur_distr_discr_set_pmfstr} +@item @ref{funct:unur_distr_discr_set_cdfstr,unur_distr_discr_set_cdfstr} +@item @ref{funct:unur_distr_discr_get_pmfstr,unur_distr_discr_get_pmfstr} +@item @ref{funct:unur_distr_discr_get_cdfstr,unur_distr_discr_get_cdfstr} +@item @ref{funct:unur_distr_discr_set_pmfparams,unur_distr_discr_set_pmfparams} +@item @ref{funct:unur_distr_discr_get_pmfparams,unur_distr_discr_get_pmfparams} +@item @ref{funct:unur_distr_discr_set_domain,unur_distr_discr_set_domain} +@item @ref{funct:unur_distr_discr_get_domain,unur_distr_discr_get_domain} +@item @ref{funct:unur_distr_discr_set_mode,unur_distr_discr_set_mode} +@item @ref{funct:unur_distr_discr_upd_mode,unur_distr_discr_upd_mode} +@item @ref{funct:unur_distr_discr_get_mode,unur_distr_discr_get_mode} +@item @ref{funct:unur_distr_discr_set_pmfsum,unur_distr_discr_set_pmfsum} +@item @ref{funct:unur_distr_discr_upd_pmfsum,unur_distr_discr_upd_pmfsum} +@item @ref{funct:unur_distr_discr_get_pmfsum,unur_distr_discr_get_pmfsum} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_distr_discr_new} +@deftypefn Function {UNUR_DISTR*} unur_distr_discr_new (void) +Create a new (empty) object for a univariate discrete distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_new} +@deftypefn {} {UNUR_DISTR*} unur_distr_discr_new (void) +Create a new (empty) object for a univariate discrete distribution. +@end deftypefn +@end ifnotinfo + +@subsubheading Essential parameters + +There are two interfaces for discrete univariate distributions: +Either provide a (finite) probability vector (PV). +Or provide a probability mass function (PMF). For the latter +case there are also a couple of derived parameters that are not +required when a PV is given. + +It is not possible to set both a PMF and a PV directly. However, the +PV can be computed from the PMF (or the CDF if no PMF is available) +by means of a +@ifhtml +@ref{funct:unur_distr_discr_make_pv,@command{unur_distr_discr_make_pv}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_make_pv} +@end ifnothtml +call. +If both the PV and the PMF are given in the distribution object it +depends on the generation method which of these is used. + +@ifinfo +@anchor{funct:unur_distr_discr_set_pv} +@deftypefn Function {int} unur_distr_discr_set_pv (UNUR_DISTR* @var{distribution}, const @var{double* pv}, int @var{n_pv}) +Set finite probability vector (PV) for the @var{distribution}. It is not +necessary that the entries in the given PV sum to 1. +@var{n_pv} must be positive. However, there is no testing +whether all entries in @var{pv} are non-negative. + +If no domain has been set, then the left boundary is set to +@code{0}, by default. If @var{n_pv} is too large, e.g. because +left boundary + @var{n_pv} exceeds the range of integers, +then the call fails. + +Notice that it is not possible to set both a PV and a PMF or CDF. +If the PMF or CDF is set first one cannot set the PV. +If the PMF or CDF is set first after a PV is set, the latter is +removed (and recomputed using +@ifhtml +@ref{funct:unur_distr_discr_make_pv,@command{unur_distr_discr_make_pv}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_make_pv} +@end ifnothtml +when required). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_set_pv} +@deftypefn {} {int} unur_distr_discr_set_pv (UNUR_DISTR* @var{distribution}, const @var{double* pv}, int @var{n_pv}) +Set finite probability vector (PV) for the @var{distribution}. It is not +necessary that the entries in the given PV sum to 1. +@var{n_pv} must be positive. However, there is no testing +whether all entries in @var{pv} are non-negative. + +If no domain has been set, then the left boundary is set to +@code{0}, by default. If @var{n_pv} is too large, e.g. because +left boundary + @var{n_pv} exceeds the range of integers, +then the call fails. + +Notice that it is not possible to set both a PV and a PMF or CDF. +If the PMF or CDF is set first one cannot set the PV. +If the PMF or CDF is set first after a PV is set, the latter is +removed (and recomputed using +@ifhtml +@ref{funct:unur_distr_discr_make_pv,@command{unur_distr_discr_make_pv}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_make_pv} +@end ifnothtml +when required). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_discr_make_pv} +@deftypefn Function {int} unur_distr_discr_make_pv (UNUR_DISTR* @var{distribution}) +Compute a PV when a PMF or CDF is given. However, when the +domain is not given or is too large and the sum over the PMF is given +then the (right) tail of the @var{distribution} is chopped off such that +the probability for the tail region is less than 1.e-8. +If the sum over the PMF is not given a PV of maximal length is +computed. + +The maximal size of the created PV is bounded by the macro +@code{UNUR_MAX_AUTO_PV} that is defined in @file{unuran_config.h}. + +If successful, the length of the generated PV is returned. +If the sum over the PMF on the chopped tail is not neglible small +(i.e. greater than 1.e-8 or unknown) than the +negative of the length of the PV is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. + +Notice that the left boundary of the PV is set to @code{0} by +default when a discrete distribution object is created from +scratch. + +If computing a PV fails for some reasons, an error code is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_make_pv} +@deftypefn {} {int} unur_distr_discr_make_pv (UNUR_DISTR* @var{distribution}) +Compute a PV when a PMF or CDF is given. However, when the +domain is not given or is too large and the sum over the PMF is given +then the (right) tail of the @var{distribution} is chopped off such that +the probability for the tail region is less than 1.e-8. +If the sum over the PMF is not given a PV of maximal length is +computed. + +The maximal size of the created PV is bounded by the macro +@code{UNUR_MAX_AUTO_PV} that is defined in @file{unuran_config.h}. + +If successful, the length of the generated PV is returned. +If the sum over the PMF on the chopped tail is not neglible small +(i.e. greater than 1.e-8 or unknown) than the +negative of the length of the PV is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. + +Notice that the left boundary of the PV is set to @code{0} by +default when a discrete distribution object is created from +scratch. + +If computing a PV fails for some reasons, an error code is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_discr_get_pv} +@deftypefn Function {int} unur_distr_discr_get_pv (const @var{UNUR_DISTR* distribution}, const @var{double** pv}) +Get length of PV of the @var{distribution} and set pointer +@var{pv} to array of probabilities. If no PV is given, +an error code is returned and @var{pv} is set to @code{NULL}.@* +(It does not call +@ifhtml +@ref{funct:unur_distr_discr_make_pv,@command{unur_distr_discr_make_pv}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_make_pv} +@end ifnothtml +!) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_get_pv} +@deftypefn {} {int} unur_distr_discr_get_pv (const @var{UNUR_DISTR* distribution}, const @var{double** pv}) +Get length of PV of the @var{distribution} and set pointer +@var{pv} to array of probabilities. If no PV is given, +an error code is returned and @var{pv} is set to @code{NULL}.@* +(It does not call +@ifhtml +@ref{funct:unur_distr_discr_make_pv,@command{unur_distr_discr_make_pv}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_make_pv} +@end ifnothtml +!) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_discr_set_pmf} +@anchor{funct:unur_distr_discr_set_cdf} +@deftypefn Function {int} unur_distr_discr_set_pmf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_DISCR* @var{pmf}) +@deftypefnx Function {int} unur_distr_discr_set_cdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_DISCR* @var{cdf}) +Set respective pointer to the PMF and the CDF of the @var{distribution}. +These functions must be of type +@code{double funct(int k, const UNUR_DISTR *distr)}. + +It is important to note that all these functions must return a +result for all integers @var{k}. E.g., if the domain of a given +PMF is the interval @{1,2,3,@dots{},100@}, than the given function +must return @code{0.0} for all points outside this interval. + +The default domain for the PMF or CDF is [@code{0}, @code{INT_MAX}]. +The domain can be changed using a +@ifhtml +@ref{funct:unur_distr_discr_set_domain,@command{unur_distr_discr_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_set_domain} +@end ifnothtml +call. + +It is not possible to change such a function. Once the PMF or +CDF is set it cannot be overwritten. A new distribution object +has to be used instead. + +Notice that it is not possible to set both a PV and a PMF or CDF. +If the PMF or CDF is set first one cannot set the PV. +If the PMF or CDF is set first after a PV is set, the latter is +removed (and recomputed using +@ifhtml +@ref{funct:unur_distr_discr_make_pv,@command{unur_distr_discr_make_pv}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_make_pv} +@end ifnothtml +when required). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_set_pmf} +@anchor{funct:unur_distr_discr_set_cdf} +@deftypefn {} {int} unur_distr_discr_set_pmf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_DISCR* @var{pmf}) +@deftypefnx {} {int} unur_distr_discr_set_cdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_DISCR* @var{cdf}) +Set respective pointer to the PMF and the CDF of the @var{distribution}. +These functions must be of type +@code{double funct(int k, const UNUR_DISTR *distr)}. + +It is important to note that all these functions must return a +result for all integers @var{k}. E.g., if the domain of a given +PMF is the interval @{1,2,3,@dots{},100@}, than the given function +must return @code{0.0} for all points outside this interval. + +The default domain for the PMF or CDF is [@code{0}, @code{INT_MAX}]. +The domain can be changed using a +@ifhtml +@ref{funct:unur_distr_discr_set_domain,@command{unur_distr_discr_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_set_domain} +@end ifnothtml +call. + +It is not possible to change such a function. Once the PMF or +CDF is set it cannot be overwritten. A new distribution object +has to be used instead. + +Notice that it is not possible to set both a PV and a PMF or CDF. +If the PMF or CDF is set first one cannot set the PV. +If the PMF or CDF is set first after a PV is set, the latter is +removed (and recomputed using +@ifhtml +@ref{funct:unur_distr_discr_make_pv,@command{unur_distr_discr_make_pv}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_make_pv} +@end ifnothtml +when required). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_discr_set_invcdf} +@deftypefn Function {int} unur_distr_discr_set_invcdf (UNUR_DISTR* @var{distribution}, UNUR_IFUNCT_DISCR* @var{invcdf}) +Set inverse CDF of the @var{distribution}. +@var{invcdf} must be a pointer must be of type +@code{int funct(double x, const UNUR_DISTR *distr)}, +i.e., it should return a @code{double}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_set_invcdf} +@deftypefn {} {int} unur_distr_discr_set_invcdf (UNUR_DISTR* @var{distribution}, UNUR_IFUNCT_DISCR* @var{invcdf}) +Set inverse CDF of the @var{distribution}. +@var{invcdf} must be a pointer must be of type +@code{int funct(double x, const UNUR_DISTR *distr)}, +i.e., it should return a @code{double}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_discr_eval_pv} +@anchor{funct:unur_distr_discr_eval_pmf} +@anchor{funct:unur_distr_discr_eval_cdf} +@deftypefn Function {double} unur_distr_discr_eval_pv (int @var{k}, const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {double} unur_distr_discr_eval_pmf (int @var{k}, const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {double} unur_distr_discr_eval_cdf (int @var{k}, const @var{UNUR_DISTR* distribution}) +Evaluate the PV, PMF, and the CDF, respectively, at k. +Notice that @var{distribution} must not be the @code{NULL} pointer. +If no PV is set for the @var{distribution}, then +@ifhtml +@ref{funct:unur_distr_discr_eval_pv,@command{unur_distr_discr_eval_pv}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_eval_pv} +@end ifnothtml +behaves like +@ifhtml +@ref{funct:unur_distr_discr_eval_pmf,@command{unur_distr_discr_eval_pmf}.} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_eval_pmf}. +@end ifnothtml +If the corresponding function is not available for the @var{distribution}, +@code{UNUR_INFINITY} is returned and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_DATA}. + +@emph{IMPORTANT:} +In the case of a truncated standard distribution these calls always +return the respective values of the @emph{untruncated} distribution! +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_eval_pv} +@anchor{funct:unur_distr_discr_eval_pmf} +@anchor{funct:unur_distr_discr_eval_cdf} +@deftypefn {} {double} unur_distr_discr_eval_pv (int @var{k}, const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {double} unur_distr_discr_eval_pmf (int @var{k}, const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {double} unur_distr_discr_eval_cdf (int @var{k}, const @var{UNUR_DISTR* distribution}) +Evaluate the PV, PMF, and the CDF, respectively, at k. +Notice that @var{distribution} must not be the @code{NULL} pointer. +If no PV is set for the @var{distribution}, then +@ifhtml +@ref{funct:unur_distr_discr_eval_pv,@command{unur_distr_discr_eval_pv}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_eval_pv} +@end ifnothtml +behaves like +@ifhtml +@ref{funct:unur_distr_discr_eval_pmf,@command{unur_distr_discr_eval_pmf}.} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_eval_pmf}. +@end ifnothtml +If the corresponding function is not available for the @var{distribution}, +@code{UNUR_INFINITY} is returned and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_DATA}. + +@emph{IMPORTANT:} +In the case of a truncated standard distribution these calls always +return the respective values of the @emph{untruncated} distribution! +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_discr_eval_invcdf} +@deftypefn Function {int} unur_distr_discr_eval_invcdf (double @var{u}, const @var{UNUR_DISTR* distribution}) +Evaluate the inverse CDF at @var{u}. +Notice that @var{distribution} must not be the @code{NULL} pointer. +If the corresponding function is not available for the distribution, +@code{INT_MAX} is returned and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_DATA}. + +@emph{IMPORTANT:} +In the case of a truncated standard distribution these calls always +return the respective values of the @emph{untruncated} distribution! +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_eval_invcdf} +@deftypefn {} {int} unur_distr_discr_eval_invcdf (double @var{u}, const @var{UNUR_DISTR* distribution}) +Evaluate the inverse CDF at @var{u}. +Notice that @var{distribution} must not be the @code{NULL} pointer. +If the corresponding function is not available for the distribution, +@code{INT_MAX} is returned and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_DATA}. + +@emph{IMPORTANT:} +In the case of a truncated standard distribution these calls always +return the respective values of the @emph{untruncated} distribution! +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_discr_set_pmfstr} +@deftypefn Function {int} unur_distr_discr_set_pmfstr (UNUR_DISTR* @var{distribution}, const @var{char* pmfstr}) +This function provides an alternative way to set a PMF of the +@var{distribution}. +@var{pmfstr} is a character string that contains the formula +for the PMF, see @ref{StringFunct,,Function String}, for details. +See also the remarks for the +@ifhtml +@ref{funct:unur_distr_discr_set_pmf,@command{unur_distr_discr_set_pmf}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_set_pmf} +@end ifnothtml +call. + +It is not possible to call this funtion twice or to call this +function after a +@ifhtml +@ref{funct:unur_distr_discr_set_pmf,@command{unur_distr_discr_set_pmf}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_set_pmf} +@end ifnothtml +call. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_set_pmfstr} +@deftypefn {} {int} unur_distr_discr_set_pmfstr (UNUR_DISTR* @var{distribution}, const @var{char* pmfstr}) +This function provides an alternative way to set a PMF of the +@var{distribution}. +@var{pmfstr} is a character string that contains the formula +for the PMF, see @ref{StringFunct,,Function String}, for details. +See also the remarks for the +@ifhtml +@ref{funct:unur_distr_discr_set_pmf,@command{unur_distr_discr_set_pmf}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_set_pmf} +@end ifnothtml +call. + +It is not possible to call this funtion twice or to call this +function after a +@ifhtml +@ref{funct:unur_distr_discr_set_pmf,@command{unur_distr_discr_set_pmf}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_set_pmf} +@end ifnothtml +call. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_discr_set_cdfstr} +@deftypefn Function {int} unur_distr_discr_set_cdfstr (UNUR_DISTR* @var{distribution}, const @var{char* cdfstr}) +This function provides an alternative way to set a CDF; analogously +to the +@ifhtml +@ref{funct:unur_distr_discr_set_pmfstr,@command{unur_distr_discr_set_pmfstr}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_set_pmfstr} +@end ifnothtml +call. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_set_cdfstr} +@deftypefn {} {int} unur_distr_discr_set_cdfstr (UNUR_DISTR* @var{distribution}, const @var{char* cdfstr}) +This function provides an alternative way to set a CDF; analogously +to the +@ifhtml +@ref{funct:unur_distr_discr_set_pmfstr,@command{unur_distr_discr_set_pmfstr}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_set_pmfstr} +@end ifnothtml +call. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_discr_get_pmfstr} +@anchor{funct:unur_distr_discr_get_cdfstr} +@deftypefn Function {char*} unur_distr_discr_get_pmfstr (const @var{UNUR_DISTR* distribution}) +@deftypefnx Function {char*} unur_distr_discr_get_cdfstr (const @var{UNUR_DISTR* distribution}) +Get pointer to respective string for PMF and CDF +of @var{distribution} that is given via the string interface. +This call allocates memory to produce this string. It should be +freed when it is not used any more. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_get_pmfstr} +@anchor{funct:unur_distr_discr_get_cdfstr} +@deftypefn {} {char*} unur_distr_discr_get_pmfstr (const @var{UNUR_DISTR* distribution}) +@deftypefnx {} {char*} unur_distr_discr_get_cdfstr (const @var{UNUR_DISTR* distribution}) +Get pointer to respective string for PMF and CDF +of @var{distribution} that is given via the string interface. +This call allocates memory to produce this string. It should be +freed when it is not used any more. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_discr_set_pmfparams} +@deftypefn Function {int} unur_distr_discr_set_pmfparams (UNUR_DISTR* @var{distribution}, const @var{double* params}, int @var{n_params}) +Set array of parameters for @var{distribution}. There is an upper limit +for the number of parameters @var{n_params}. It is given by the +macro @code{UNUR_DISTR_MAXPARAMS} in @file{unuran_config.h}. (It is set to +5 but can be changed to any appropriate nonnegative number.) +If @var{n_params} is negative or exceeds this limit no parameters +are copied into the @var{distribution} object and @code{unur_errno} +is set to @code{UNUR_ERR_DISTR_NPARAMS}. + +For standard distributions from the UNU.RAN library the parameters +are checked. Moreover, the domain is updated automatically unless it +has been changed before by a +@ifhtml +@ref{funct:unur_distr_discr_set_domain,@command{unur_distr_discr_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_set_domain} +@end ifnothtml +call. +If the given parameters are invalid for the standard distribution, +then no parameters are set and an error code is returned. +Notice that the given parameter list for such a distribution is +handled in the same way as in the corresponding @command{new} +calls, i.e. optional parameters for the PDF that are not present in +the given list are (re-)set to their default values. + +@emph{Important:} Integer parameter must be given as @code{double}s. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_set_pmfparams} +@deftypefn {} {int} unur_distr_discr_set_pmfparams (UNUR_DISTR* @var{distribution}, const @var{double* params}, int @var{n_params}) +Set array of parameters for @var{distribution}. There is an upper limit +for the number of parameters @var{n_params}. It is given by the +macro @code{UNUR_DISTR_MAXPARAMS} in @file{unuran_config.h}. (It is set to +5 but can be changed to any appropriate nonnegative number.) +If @var{n_params} is negative or exceeds this limit no parameters +are copied into the @var{distribution} object and @code{unur_errno} +is set to @code{UNUR_ERR_DISTR_NPARAMS}. + +For standard distributions from the UNU.RAN library the parameters +are checked. Moreover, the domain is updated automatically unless it +has been changed before by a +@ifhtml +@ref{funct:unur_distr_discr_set_domain,@command{unur_distr_discr_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_set_domain} +@end ifnothtml +call. +If the given parameters are invalid for the standard distribution, +then no parameters are set and an error code is returned. +Notice that the given parameter list for such a distribution is +handled in the same way as in the corresponding @command{new} +calls, i.e. optional parameters for the PDF that are not present in +the given list are (re-)set to their default values. + +@emph{Important:} Integer parameter must be given as @code{double}s. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_discr_get_pmfparams} +@deftypefn Function {int} unur_distr_discr_get_pmfparams (const @var{UNUR_DISTR* distribution}, const @var{double** params}) +Get number of parameters of the PMF and set pointer +@var{params} to array of parameters. If no parameters are stored +in the object, an error code is returned and @code{params} is set to +@code{NULL}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_get_pmfparams} +@deftypefn {} {int} unur_distr_discr_get_pmfparams (const @var{UNUR_DISTR* distribution}, const @var{double** params}) +Get number of parameters of the PMF and set pointer +@var{params} to array of parameters. If no parameters are stored +in the object, an error code is returned and @code{params} is set to +@code{NULL}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_discr_set_domain} +@deftypefn Function {int} unur_distr_discr_set_domain (UNUR_DISTR* @var{distribution}, int @var{left}, int @var{right}) +Set the left and right borders of the domain of the +@var{distribution}. This can also be used to truncate an existing +distribution. For setting the boundary to +@math{+/- infinity} +use +@code{INT_MIN} and @code{INT_MAX}, respectively. +If @var{right} is not strictly greater than @var{left} no domain +is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. +It is allowed to use this call to increase the domain. +If the PV of the discrete distribution is used, +than the right boudary is ignored (and internally set to +@var{left} + size of PV @math{- 1}). +Notice that @code{INT_MIN} and @code{INT_MAX} are interpreted as +(minus/plus) infinity. + +Default: [@code{0}, @code{INT_MAX}]. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_set_domain} +@deftypefn {} {int} unur_distr_discr_set_domain (UNUR_DISTR* @var{distribution}, int @var{left}, int @var{right}) +Set the left and right borders of the domain of the +@var{distribution}. This can also be used to truncate an existing +distribution. For setting the boundary to +@iftex +@math{\pm\infty} +@end iftex +@ifhtml +@html ++/- infinity +@end html +@end ifhtml +use +@code{INT_MIN} and @code{INT_MAX}, respectively. +If @var{right} is not strictly greater than @var{left} no domain +is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. +It is allowed to use this call to increase the domain. +If the PV of the discrete distribution is used, +than the right boudary is ignored (and internally set to +@var{left} + size of PV @math{- 1}). +Notice that @code{INT_MIN} and @code{INT_MAX} are interpreted as +(minus/plus) infinity. + +Default: [@code{0}, @code{INT_MAX}]. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_discr_get_domain} +@deftypefn Function {int} unur_distr_discr_get_domain (const @var{UNUR_DISTR* distribution}, int* @var{left}, int* @var{right}) +Get the left and right borders of the domain of the +@var{distribution}. If the domain is not set explicitly +the interval [@code{INT_MIN}, @code{INT_MAX}] is assumed and returned. +When a PV is given then the domain is set automatically to +[@code{0},size of PV @math{- 1}]. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_get_domain} +@deftypefn {} {int} unur_distr_discr_get_domain (const @var{UNUR_DISTR* distribution}, int* @var{left}, int* @var{right}) +Get the left and right borders of the domain of the +@var{distribution}. If the domain is not set explicitly +the interval [@code{INT_MIN}, @code{INT_MAX}] is assumed and returned. +When a PV is given then the domain is set automatically to +[@code{0},size of PV @math{- 1}]. +@end deftypefn +@end ifnotinfo + +@subsubheading Derived parameters + +The following paramters @strong{must} be set whenever one of the essential +parameters has been set or changed (and the parameter is required +for the chosen method). + +@ifinfo +@anchor{funct:unur_distr_discr_set_mode} +@deftypefn Function {int} unur_distr_discr_set_mode (UNUR_DISTR* @var{distribution}, int @var{mode}) +Set mode of @var{distribution}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_set_mode} +@deftypefn {} {int} unur_distr_discr_set_mode (UNUR_DISTR* @var{distribution}, int @var{mode}) +Set mode of @var{distribution}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_discr_upd_mode} +@deftypefn Function {int} unur_distr_discr_upd_mode (UNUR_DISTR* @var{distribution}) +Recompute the mode of the @var{distribution}. This call works properly +for distribution objects from the +UNU.RAN library of standard distributions +when the corresponding function is available. +Otherwise a (slow) numerical mode finder is used. It only works properly +for unimodal probability mass functions. If it failes +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_upd_mode} +@deftypefn {} {int} unur_distr_discr_upd_mode (UNUR_DISTR* @var{distribution}) +Recompute the mode of the @var{distribution}. This call works properly +for distribution objects from the +UNU.RAN library of standard distributions +when the corresponding function is available. +Otherwise a (slow) numerical mode finder is used. It only works properly +for unimodal probability mass functions. If it failes +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_discr_get_mode} +@deftypefn Function {int} unur_distr_discr_get_mode (UNUR_DISTR* @var{distribution}) +Get mode of @var{distribution}. If the mode is not marked as known, +@ifhtml +@ref{funct:unur_distr_discr_upd_mode,@command{unur_distr_discr_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_upd_mode} +@end ifnothtml +is called to compute the mode. If this +is not successful @code{INT_MAX} is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. +(There is no difference between the case where no routine for +computing the mode is available and the case where no mode exists +for the distribution at all.) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_get_mode} +@deftypefn {} {int} unur_distr_discr_get_mode (UNUR_DISTR* @var{distribution}) +Get mode of @var{distribution}. If the mode is not marked as known, +@ifhtml +@ref{funct:unur_distr_discr_upd_mode,@command{unur_distr_discr_upd_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_upd_mode} +@end ifnothtml +is called to compute the mode. If this +is not successful @code{INT_MAX} is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. +(There is no difference between the case where no routine for +computing the mode is available and the case where no mode exists +for the distribution at all.) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_discr_set_pmfsum} +@deftypefn Function {int} unur_distr_discr_set_pmfsum (UNUR_DISTR* @var{distribution}, double @var{sum}) +Set the sum over the PMF. If @code{sum} is non-positive, no +sum is set and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_SET}. + +For a distribution object created by the +UNU.RAN library of standard distributions you always should use +the +@ifhtml +@ref{funct:unur_distr_discr_upd_pmfsum,@command{unur_distr_discr_upd_pmfsum}.} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_upd_pmfsum}. +@end ifnothtml +Otherwise there might be +ambiguous side-effects. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_set_pmfsum} +@deftypefn {} {int} unur_distr_discr_set_pmfsum (UNUR_DISTR* @var{distribution}, double @var{sum}) +Set the sum over the PMF. If @code{sum} is non-positive, no +sum is set and @code{unur_errno} is set to +@code{UNUR_ERR_DISTR_SET}. + +For a distribution object created by the +UNU.RAN library of standard distributions you always should use +the +@ifhtml +@ref{funct:unur_distr_discr_upd_pmfsum,@command{unur_distr_discr_upd_pmfsum}.} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_upd_pmfsum}. +@end ifnothtml +Otherwise there might be +ambiguous side-effects. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_discr_upd_pmfsum} +@deftypefn Function {int} unur_distr_discr_upd_pmfsum (UNUR_DISTR* @var{distribution}) +Recompute the sum over the PMF of the @var{distribution}. +In most cases the normalization constant is recomputed and thus the +sum is 1. This call works for distribution objects from the UNU.RAN +library of standard distributions when the corresponding function +is available. When a PV, a PMF with finite domain, or a CDF is +given, a simple generic function which uses a naive summation loop +is used. If this computation is not possible, an error code is +returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. + +The call does not work for distributions from the +UNU.RAN library of standard distributions with truncated +domain when the CDF is not available. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_upd_pmfsum} +@deftypefn {} {int} unur_distr_discr_upd_pmfsum (UNUR_DISTR* @var{distribution}) +Recompute the sum over the PMF of the @var{distribution}. +In most cases the normalization constant is recomputed and thus the +sum is 1. This call works for distribution objects from the UNU.RAN +library of standard distributions when the corresponding function +is available. When a PV, a PMF with finite domain, or a CDF is +given, a simple generic function which uses a naive summation loop +is used. If this computation is not possible, an error code is +returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. + +The call does not work for distributions from the +UNU.RAN library of standard distributions with truncated +domain when the CDF is not available. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_distr_discr_get_pmfsum} +@deftypefn Function {double} unur_distr_discr_get_pmfsum (UNUR_DISTR* @var{distribution}) +Get the sum over the PMF of the @var{distribution}. If this sum is +not known, +@ifhtml +@ref{funct:unur_distr_discr_upd_pmfsum,@command{unur_distr_discr_upd_pmfsum}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_upd_pmfsum} +@end ifnothtml +is called to compute +it. If this is not successful @code{UNUR_INFINITY} is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_distr_discr_get_pmfsum} +@deftypefn {} {double} unur_distr_discr_get_pmfsum (UNUR_DISTR* @var{distribution}) +Get the sum over the PMF of the @var{distribution}. If this sum is +not known, +@ifhtml +@ref{funct:unur_distr_discr_upd_pmfsum,@command{unur_distr_discr_upd_pmfsum}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_upd_pmfsum} +@end ifnothtml +is called to compute +it. If this is not successful @code{UNUR_INFINITY} is returned and +@code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of discr.h +@c ------------------------------------- +@c ------------------------------------- +@c methods.dh +@c + +@node Methods +@chapter Methods for generating non-uniform random variates + +@menu +* Methods_all:: Routines for all generator objects +* AUTO:: Select method automatically +* Methods_for_CONT:: Methods for continuous univariate distributions +* Methods_for_CEMP:: Methods for continuous empirical univariate distributions +* Methods_for_CVEC:: Methods for continuous multivariate distributions +* MCMC_Methods_for_CVEC:: Markov chain samplers for continuous multivariate distributions +* Methods_for_CVEMP:: Methods for continuous empirical multivariate distributions +* Methods_for_DISCR:: Methods for discrete univariate distributions +* Methods_for_MATR:: Methods for random matrices +* Methods_for_UNID:: Methods for uniform univariate distributions +* Meta_Methods:: Meta Methods for univariate distributions +@end menu + + + +Sampling from a particular distribution with UNU.RAN requires the +following steps: + +@enumerate +@item +Create a distribution object +(@pxref{Distribution_objects,,Handling distribution objects}). + +@item +Select a method and create a parameter object. + +@item +Initizialize the generator object using +@ifhtml +@ref{funct:unur_init,@command{unur_init}.} +@end ifhtml +@ifnothtml +@command{unur_init}. +@end ifnothtml +@emph{Important}: Initialization of the generator object might fail. +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +returns a @code{NULL} pointer then, which @strong{must} not be +used for sampling. + +@item +Draw a sample from the generator object using the +corresponding sampling function (depending on the type of +distribution: +univariate continuous, univariate discrete, multivariate +continuous, and random matrix). + +@item +It is possible for a generator object to change the parameters and the +domain of the underlying distribution. This must be done by extracting +this object by means of a +@ifhtml +@ref{funct:unur_get_distr,@command{unur_get_distr}} +@end ifhtml +@ifnothtml +@command{unur_get_distr} +@end ifnothtml +call and +changing the distribution using the correspondig set calls, +see @ref{Distribution_objects,,Handling distribution objects}. +The generator object @strong{must} then be reinitialized by means of +the +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +call. + +@emph{Important}: Currently not all methods allow reinitialization, +see the description of the particular method (keyword @i{Reinit}). + +@emph{Important}: Reinitialization of the generator object might fail. +Thus one @strong{must} check the return code of the +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +call. + +@emph{Important}: When reinitialization fails then sampling routines +always return @code{UNUR_INFINITY} (for continuous distributions) or @code{0} (for +discrete distributions), respectively. +However, it is still possible to change the underlying distribution +and try to reinitialize again. + +@end enumerate + + + +@c +@c end of methods.dh +@c ------------------------------------- +@c ------------------------------------- +@c x_gen.h +@c + +@node Methods_all +@section Routines for all generator objects + + +Routines for all generator objects. + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_init,unur_init} +@item @ref{funct:unur_reinit,unur_reinit} +@item @ref{funct:unur_sample_discr,unur_sample_discr} +@item @ref{funct:unur_sample_cont,unur_sample_cont} +@item @ref{funct:unur_sample_vec,unur_sample_vec} +@item @ref{funct:unur_sample_matr,unur_sample_matr} +@item @ref{funct:unur_quantile,unur_quantile} +@item @ref{funct:unur_free,unur_free} +@item @ref{funct:unur_gen_info,unur_gen_info} +@item @ref{funct:unur_get_dimension,unur_get_dimension} +@item @ref{funct:unur_get_genid,unur_get_genid} +@item @ref{funct:unur_get_method,unur_get_method} +@item @ref{funct:unur_gen_is_inversion,unur_gen_is_inversion} +@item @ref{funct:unur_get_distr,unur_get_distr} +@item @ref{funct:unur_set_use_distr_privatecopy,unur_set_use_distr_privatecopy} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_init} +@deftypefn Function {UNUR_GEN*} unur_init (UNUR_PAR* @var{parameters}) +Initialize a generator object. All necessary information must be +stored in the parameter object. + +@strong{Important:} If an error has occurred a @code{NULL} pointer is +return. This must not be used for the sampling routines (this causes a +segmentation fault). + +@strong{Always} check whether the call was successful or not! + +@emph{Important:} This call destroys the @var{parameter} object +automatically. Thus it is not necessary/allowed to free it. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_init} +@deftypefn {} {UNUR_GEN*} unur_init (UNUR_PAR* @var{parameters}) +Initialize a generator object. All necessary information must be +stored in the parameter object. + +@strong{Important:} If an error has occurred a @code{NULL} pointer is +return. This must not be used for the sampling routines (this causes a +segmentation fault). + +@strong{Always} check whether the call was successful or not! + +@emph{Important:} This call destroys the @var{parameter} object +automatically. Thus it is not necessary/allowed to free it. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_reinit} +@deftypefn Function {int} unur_reinit (UNUR_GEN* @var{generator}) +Update an existing generator object after the underlying +distribution has been modified (using +@ifhtml +@ref{funct:unur_get_distr,@command{unur_get_distr}} +@end ifhtml +@ifnothtml +@command{unur_get_distr} +@end ifnothtml +together +with corresponding set calls. +It @strong{must} be executed before sampling using this generator +object is continued as otherwise it produces an invalid sample or +might even cause a segmentation fault. + +@emph{Important}: Currently not all methods allow reinitialization, +see the description of the particular method (keyword @i{Reinit}). + +@emph{Important}: Reinitialization of the generator object might fail. +Thus one @strong{must} check the return code: + +@table @asis +@item @code{UNUR_SUCCESS (0x0u)} +success (no error) +@item @code{UNUR_ERR_NO_REINIT} +reinit routine not implemented. +@item other values +some error has occured while trying to reinitialize the generator +object. +@end table + +@emph{Important}: When reinitialization fails then sampling routines +always return @code{UNUR_INFINITY} (for continuous distributions) +or @code{0} (for discrete distributions), respectively. +However, it is still possible to change the underlying distribution +and try to reinitialize again. + +@emph{Important}: When one tries to run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit},} +@end ifhtml +@ifnothtml +@command{unur_reinit}, +@end ifnothtml +but reinitialization +is not implemented, then the generator object cannot be used any more +and must be destroyed and a new one has to be built from scratch. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_reinit} +@deftypefn {} {int} unur_reinit (UNUR_GEN* @var{generator}) +Update an existing generator object after the underlying +distribution has been modified (using +@ifhtml +@ref{funct:unur_get_distr,@command{unur_get_distr}} +@end ifhtml +@ifnothtml +@command{unur_get_distr} +@end ifnothtml +together +with corresponding set calls. +It @strong{must} be executed before sampling using this generator +object is continued as otherwise it produces an invalid sample or +might even cause a segmentation fault. + +@emph{Important}: Currently not all methods allow reinitialization, +see the description of the particular method (keyword @i{Reinit}). + +@emph{Important}: Reinitialization of the generator object might fail. +Thus one @strong{must} check the return code: + +@table @asis +@item @code{UNUR_SUCCESS (0x0u)} +success (no error) +@item @code{UNUR_ERR_NO_REINIT} +reinit routine not implemented. +@item other values +some error has occured while trying to reinitialize the generator +object. +@end table + +@emph{Important}: When reinitialization fails then sampling routines +always return @code{UNUR_INFINITY} (for continuous distributions) +or @code{0} (for discrete distributions), respectively. +However, it is still possible to change the underlying distribution +and try to reinitialize again. + +@emph{Important}: When one tries to run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit},} +@end ifhtml +@ifnothtml +@command{unur_reinit}, +@end ifnothtml +but reinitialization +is not implemented, then the generator object cannot be used any more +and must be destroyed and a new one has to be built from scratch. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_sample_discr} +@anchor{funct:unur_sample_cont} +@anchor{funct:unur_sample_vec} +@anchor{funct:unur_sample_matr} +@deftypefn Function {int } unur_sample_discr (UNUR_GEN* @var{generator}) +@deftypefnx Function {double} unur_sample_cont (UNUR_GEN* @var{generator}) +@deftypefnx Function {int } unur_sample_vec (UNUR_GEN* @var{generator}, double* @var{vector}) +@deftypefnx Function {int } unur_sample_matr (UNUR_GEN* @var{generator}, double* @var{matrix}) +Sample from generator object. The three routines depend on the type +of the generator object (discrete or continuous univariate +distribution, multivariate distribution, or random matrix). + +@emph{Notice:} UNU.RAN uses arrays of @code{double}s to handle +matrices. There the rows of the matrix are stored consecutively. + +@emph{Notice:} The routines +@ifhtml +@ref{funct:unur_sample_vec,@command{unur_sample_vec}} +@end ifhtml +@ifnothtml +@command{unur_sample_vec} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_sample_matr,@command{unur_sample_matr}} +@end ifhtml +@ifnothtml +@command{unur_sample_matr} +@end ifnothtml +return @code{UNUR_SUCCESS} if generation was successful and +some error code otherwise. + +@strong{Important:} These routines do @strong{not} check whether +@var{generator} is an invalid @code{NULL} pointer. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_sample_discr} +@anchor{funct:unur_sample_cont} +@anchor{funct:unur_sample_vec} +@anchor{funct:unur_sample_matr} +@deftypefn {} {int } unur_sample_discr (UNUR_GEN* @var{generator}) +@deftypefnx {} {double} unur_sample_cont (UNUR_GEN* @var{generator}) +@deftypefnx {} {int } unur_sample_vec (UNUR_GEN* @var{generator}, double* @var{vector}) +@deftypefnx {} {int } unur_sample_matr (UNUR_GEN* @var{generator}, double* @var{matrix}) +Sample from generator object. The three routines depend on the type +of the generator object (discrete or continuous univariate +distribution, multivariate distribution, or random matrix). + +@emph{Notice:} UNU.RAN uses arrays of @code{double}s to handle +matrices. There the rows of the matrix are stored consecutively. + +@emph{Notice:} The routines +@ifhtml +@ref{funct:unur_sample_vec,@command{unur_sample_vec}} +@end ifhtml +@ifnothtml +@command{unur_sample_vec} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_sample_matr,@command{unur_sample_matr}} +@end ifhtml +@ifnothtml +@command{unur_sample_matr} +@end ifnothtml +return @code{UNUR_SUCCESS} if generation was successful and +some error code otherwise. + +@strong{Important:} These routines do @strong{not} check whether +@var{generator} is an invalid @code{NULL} pointer. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_quantile} +@deftypefn Function {double} unur_quantile (UNUR_GEN* @var{generator}, double @var{U}) +Compute the @var{U} quantile of a continuous distribution using a +@var{generator} object that implements an (approximate) inversion +methods. + +The following methods are currently available: +@itemize +@item +HINV, @pxref{HINV}. +@item +NINV, @pxref{NINV}. +@item +PINV, @pxref{PINV}. +@item +CSTD, @pxref{CSTD}. @* +This requires that @var{generator} implements an inversion method. +@item +DGT, @pxref{DGT}. @* +The return value is (of course) type casted to @code{double}. +@end itemize + +@strong{Important:} This routine does @strong{not} check whether +@var{generator} is an invalid @code{NULL} pointer. + +In case of an error UNUR_INFINITY or INT_MAX +(depending on the type of @var{generator}) is returned. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_quantile} +@deftypefn {} {double} unur_quantile (UNUR_GEN* @var{generator}, double @var{U}) +Compute the @var{U} quantile of a continuous distribution using a +@var{generator} object that implements an (approximate) inversion +methods. + +The following methods are currently available: +@itemize +@item +HINV, @pxref{HINV}. +@item +NINV, @pxref{NINV}. +@item +PINV, @pxref{PINV}. +@item +CSTD, @pxref{CSTD}. @* +This requires that @var{generator} implements an inversion method. +@item +DGT, @pxref{DGT}. @* +The return value is (of course) type casted to @code{double}. +@end itemize + +@strong{Important:} This routine does @strong{not} check whether +@var{generator} is an invalid @code{NULL} pointer. + +In case of an error UNUR_INFINITY or INT_MAX +(depending on the type of @var{generator}) is returned. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_free} +@deftypefn Function {void } unur_free (UNUR_GEN* @var{generator}) +Destroy (free) the given generator object. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_free} +@deftypefn {} {void } unur_free (UNUR_GEN* @var{generator}) +Destroy (free) the given generator object. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_gen_info} +@deftypefn Function {const char*} unur_gen_info (UNUR_GEN* @var{generator}, int @var{help}) +Get a string with informations about the given @var{generator}. +These informations allow some fine tuning of the generation method. +If @var{help} is @code{TRUE}, some hints on setting parameters are given. + +This function is intented for using in interactive environments +(like @t{R}). + +If an error occurs, then @code{NULL} is returned. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_gen_info} +@deftypefn {} {const char*} unur_gen_info (UNUR_GEN* @var{generator}, int @var{help}) +Get a string with informations about the given @var{generator}. +These informations allow some fine tuning of the generation method. +If @var{help} is @code{TRUE}, some hints on setting parameters are given. + +This function is intented for using in interactive environments +(like @t{R}). + +If an error occurs, then @code{NULL} is returned. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_get_dimension} +@deftypefn Function {int} unur_get_dimension (const @var{UNUR_GEN* generator}) +Get the number of dimension of a (multivariate) distribution. +For a univariate distribution @code{1} is return. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_get_dimension} +@deftypefn {} {int} unur_get_dimension (const @var{UNUR_GEN* generator}) +Get the number of dimension of a (multivariate) distribution. +For a univariate distribution @code{1} is return. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_get_genid} +@deftypefn Function {const char*} unur_get_genid (const @var{UNUR_GEN* generator}) +Get identifier string for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_get_genid} +@deftypefn {} {const char*} unur_get_genid (const @var{UNUR_GEN* generator}) +Get identifier string for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_get_method} +@deftypefn Function {unsigned int} unur_get_method (const @var{UNUR_GEN* generator}) +Get identifier for generating method. +These identifiers are declared in @file{src/methods/unur_metthods.h}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_get_method} +@deftypefn {} {unsigned int} unur_get_method (const @var{UNUR_GEN* generator}) +Get identifier for generating method. +These identifiers are declared in @file{src/methods/unur_metthods.h}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_gen_is_inversion} +@deftypefn Function {int} unur_gen_is_inversion (const @var{UNUR_GEN* gen}) +Return @code{TRUE} if the generator object implements an inversion method, +and @code{FALSE} otherwise. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_gen_is_inversion} +@deftypefn {} {int} unur_gen_is_inversion (const @var{UNUR_GEN* gen}) +Return @code{TRUE} if the generator object implements an inversion method, +and @code{FALSE} otherwise. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_get_distr} +@deftypefn Function {UNUR_DISTR*} unur_get_distr (const @var{UNUR_GEN* generator}) +Get pointer to distribution object from generator object. +This function can be used to change the parameters of the distribution +and reinitialize the generator object. +Notice that currently @strong{not all} generating methods have a +reinitialize routine. +This function should be used with extreme care. Changing the distribution +is changed and using the generator object without reinitializing +might cause wrong samples or segmentation faults. +Moreover, if the corresponding generator object is freed, the +pointer must not be used. + +@strong{Important:} The returned distribution object must not +be freed. If the distribution object is changed then one @strong{must} +run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +! +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_get_distr} +@deftypefn {} {UNUR_DISTR*} unur_get_distr (const @var{UNUR_GEN* generator}) +Get pointer to distribution object from generator object. +This function can be used to change the parameters of the distribution +and reinitialize the generator object. +Notice that currently @strong{not all} generating methods have a +reinitialize routine. +This function should be used with extreme care. Changing the distribution +is changed and using the generator object without reinitializing +might cause wrong samples or segmentation faults. +Moreover, if the corresponding generator object is freed, the +pointer must not be used. + +@strong{Important:} The returned distribution object must not +be freed. If the distribution object is changed then one @strong{must} +run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +! +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_set_use_distr_privatecopy} +@deftypefn Function {int} unur_set_use_distr_privatecopy (UNUR_PAR* @var{parameters}, int @var{use_privatecopy}) +Set flag whether the generator object should make a private copy of +the given distribution object or just stores the pointer to this +distribution object. Values for @var{use_privatecopy}: +@table @code +@item @code{TRUE} +make a private copy (default) +@item @code{FALSE} +do not make a private copy and store pointer to given (external) +distribution object. +@end table + +By default, generator objects keep their own private copy of the +given distribution object. Thus the generator object can be handled +independently from other UNU.RAN objects (with uniform random number +generators as the only exception). When the generator object is +initialized the given distribution object is cloned and stored. + +However, in some rare situations it can be useful when only the +pointer to the given distribution object is stored without making a +private copy. A possible example is when only one random variate has +to be drawn from the distribution. +This behavior can be achieved when @var{use_localcopy} is set to +@code{FALSE}. + +@strong{Warning!} +Using a pointer to the external distribution object instead of a +private copy must be done with @strong{extreme care}! +When the distrubtion object is changed or freed then the generator +object does not work any more, might case a segmentation fault, or +(even worse) produces garbage. +On the other hand, when the generator object is initialized or used +to draw a random sampling the distribution object may be changed. + +@emph{Notice:} +The prototypes of all @code{unur__new} calls use a +@code{const} qualifier for the distribution argument. +However, if @var{use_privatecopy} is set to @code{FALSE} this qualifier is +discarded and the distribution might be changed. + +@strong{Important!} +If @var{use_localcopy} is set to @code{FALSE} and the corresponding +distribution object is changed then one must run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +on the generator object. +(Notice that currently not all generation methods support +reinitialization.) + +Default: @var{use_privatecopy} is @code{TRUE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_set_use_distr_privatecopy} +@deftypefn {} {int} unur_set_use_distr_privatecopy (UNUR_PAR* @var{parameters}, int @var{use_privatecopy}) +Set flag whether the generator object should make a private copy of +the given distribution object or just stores the pointer to this +distribution object. Values for @var{use_privatecopy}: +@table @code +@item @code{TRUE} +make a private copy (default) +@item @code{FALSE} +do not make a private copy and store pointer to given (external) +distribution object. +@end table + +By default, generator objects keep their own private copy of the +given distribution object. Thus the generator object can be handled +independently from other UNU.RAN objects (with uniform random number +generators as the only exception). When the generator object is +initialized the given distribution object is cloned and stored. + +However, in some rare situations it can be useful when only the +pointer to the given distribution object is stored without making a +private copy. A possible example is when only one random variate has +to be drawn from the distribution. +This behavior can be achieved when @var{use_localcopy} is set to +@code{FALSE}. + +@strong{Warning!} +Using a pointer to the external distribution object instead of a +private copy must be done with @strong{extreme care}! +When the distrubtion object is changed or freed then the generator +object does not work any more, might case a segmentation fault, or +(even worse) produces garbage. +On the other hand, when the generator object is initialized or used +to draw a random sampling the distribution object may be changed. + +@emph{Notice:} +The prototypes of all @code{unur__new} calls use a +@code{const} qualifier for the distribution argument. +However, if @var{use_privatecopy} is set to @code{FALSE} this qualifier is +discarded and the distribution might be changed. + +@strong{Important!} +If @var{use_localcopy} is set to @code{FALSE} and the corresponding +distribution object is changed then one must run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +on the generator object. +(Notice that currently not all generation methods support +reinitialization.) + +Default: @var{use_privatecopy} is @code{TRUE}. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of x_gen.h +@c ------------------------------------- +@c ------------------------------------- +@c auto.h +@c + +@page +@node AUTO +@section AUTO -- Select method automatically + + +AUTO selects a an appropriate method for the given distribution +object automatically. There are no parameters for this method, +yet. But it is planned to give some parameter to describe the +task for which the random variate generator is used for and thus +make the choice of the generating method more appropriate. +Notice that the required sampling routine for the generator +object depends on the type of the given distribution object. + +The chosen method also depends on the sample size for which the +generator object will be used. If only a few random variates +the order of magnitude of the sample size should be set via a +@ifhtml +@ref{funct:unur_auto_set_logss,@command{unur_auto_set_logss}} +@end ifhtml +@ifnothtml +@command{unur_auto_set_logss} +@end ifnothtml +call. + +IMPORTANT: This is an experimental version and the method chosen +may change in future releases of UNU.RAN. + +For an example see @ref{Example_0,As short as possible,Example: As short as possible}. + + +@subsubheading How To Use + + +Create a generator object for the given distribution object. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_auto_new,unur_auto_new} +@item @ref{funct:unur_auto_set_logss,unur_auto_set_logss} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_auto_new} +@deftypefn Function {UNUR_PAR*} unur_auto_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_auto_new} +@deftypefn {} {UNUR_PAR*} unur_auto_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_auto_set_logss} +@deftypefn Function {int} unur_auto_set_logss (UNUR_PAR* @var{parameters}, int @var{logss}) +Set the order of magnitude for the size of the sample that will be +generated by the generator, i.e., the the common logarithm of the +sample size. + +Default is 10. + +Notice: This feature will be used in future releases of UNU.RAN only. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_auto_set_logss} +@deftypefn {} {int} unur_auto_set_logss (UNUR_PAR* @var{parameters}, int @var{logss}) +Set the order of magnitude for the size of the sample that will be +generated by the generator, i.e., the the common logarithm of the +sample size. + +Default is 10. + +Notice: This feature will be used in future releases of UNU.RAN only. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of auto.h +@c ------------------------------------- +@c ------------------------------------- +@c methods.dh +@c + +@page +@node Methods_for_CONT +@section Methods for continuous univariate distributions + +@menu +* AROU:: Automatic Ratio-Of-Uniforms method +* ARS:: Adaptive Rejection Sampling +* CEXT:: wrapper for Continuous EXTernal generators +* CSTD:: Continuous STandarD distributions +* HINV:: Hermite interpolation based INVersion of CDF +* HRB:: Hazard Rate Bounded +* HRD:: Hazard Rate Decreasing +* HRI:: Hazard Rate Increasing +* ITDR:: Inverse Transformed Density Rejection +* NINV:: Numerical INVersion +* NROU:: Naive Ratio-Of-Uniforms method +* PINV:: Polynomial interpolation based INVersion of CDF +* SROU:: Simple Ratio-Of-Uniforms method +* SSR:: Simple Setup Rejection +* TABL:: a TABLe method with piecewise constant hats +* TDR:: Transformed Density Rejection +* UTDR:: Universal Transformed Density Rejection +@end menu + + + +@subheading Overview of methods + +@include methods_cont.texi + +@subheading Example + +@smallexample +@include ref_example_cont.texi +@end smallexample + +@subheading Example (String API) + +@smallexample +@include ref_example_cont_str.texi +@end smallexample + + + +@c +@c end of methods.dh +@c ------------------------------------- +@c ------------------------------------- +@c arou.h +@c + +@page +@node AROU +@subsection AROU -- Automatic Ratio-Of-Uniforms method + +@table @i +@item Required: +T-concave PDF, dPDF +@item Optional: +mode +@item Speed: +Set-up: slow, Sampling: fast +@item Reinit: +not implemented +@item Reference: +@ifhtml +@ref{bib:LJa00,, [LJa00]} +@end ifhtml +@ifnothtml +[LJa00] +@end ifnothtml + +@end table + + +AROU is a variant of the ratio-of-uniforms method that uses the +fact that the transformed region is convex for many distributions. +It works for all T-concave distributions with T(x) = -1/sqrt(x). + +It is possible to use this method for correlation induction by +setting an auxiliary uniform random number generator via the +@ifhtml +@ref{funct:unur_set_urng_aux,@command{unur_set_urng_aux}} +@end ifhtml +@ifnothtml +@command{unur_set_urng_aux} +@end ifnothtml +call. (Notice that this must be done after a +possible +@ifhtml +@ref{funct:unur_set_urng,@command{unur_set_urng}} +@end ifhtml +@ifnothtml +@command{unur_set_urng} +@end ifnothtml +call.) +When an auxiliary generator is used then the number of used +uniform random numbers that is used up for one generated random +variate is constant and equal to 1. + +There exists a test mode that verifies whether the conditions for +the method are satisfied or not while sampling. It can be +switched on by calling +@ifhtml +@ref{funct:unur_arou_set_verify,@command{unur_arou_set_verify}} +@end ifhtml +@ifnothtml +@command{unur_arou_set_verify} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_arou_chg_verify,@command{unur_arou_chg_verify},} +@end ifhtml +@ifnothtml +@command{unur_arou_chg_verify}, +@end ifnothtml +respectively. +Notice however that sampling is (much) slower then. + +For densities with modes not close to 0 it is suggested to set +either the mode or the center of the distribution by the +@ifhtml +@ref{funct:unur_distr_cont_set_mode,@command{unur_distr_cont_set_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_mode} +@end ifnothtml +or +@ifhtml +@ref{funct:unur_distr_cont_set_center,@command{unur_distr_cont_set_center}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_center} +@end ifnothtml +call. +The latter is the approximate location of the mode or the mean +of the distribution. This location provides some information +about the main part of the PDF and is used to avoid numerical +problems. + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_arou_new,unur_arou_new} +@item @ref{funct:unur_arou_set_usedars,unur_arou_set_usedars} +@item @ref{funct:unur_arou_set_darsfactor,unur_arou_set_darsfactor} +@item @ref{funct:unur_arou_set_max_sqhratio,unur_arou_set_max_sqhratio} +@item @ref{funct:unur_arou_get_sqhratio,unur_arou_get_sqhratio} +@item @ref{funct:unur_arou_get_hatarea,unur_arou_get_hatarea} +@item @ref{funct:unur_arou_get_squeezearea,unur_arou_get_squeezearea} +@item @ref{funct:unur_arou_set_max_segments,unur_arou_set_max_segments} +@item @ref{funct:unur_arou_set_cpoints,unur_arou_set_cpoints} +@item @ref{funct:unur_arou_set_usecenter,unur_arou_set_usecenter} +@item @ref{funct:unur_arou_set_guidefactor,unur_arou_set_guidefactor} +@item @ref{funct:unur_arou_set_verify,unur_arou_set_verify} +@item @ref{funct:unur_arou_chg_verify,unur_arou_chg_verify} +@item @ref{funct:unur_arou_set_pedantic,unur_arou_set_pedantic} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_arou_new} +@deftypefn Function {UNUR_PAR*} unur_arou_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_arou_new} +@deftypefn {} {UNUR_PAR*} unur_arou_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_arou_set_usedars} +@deftypefn Function {int} unur_arou_set_usedars (UNUR_PAR* @var{parameters}, int @var{usedars}) +If @var{usedars} is set to @code{TRUE}, ``derandomized adaptive rejection +sampling'' (DARS) is used in setup. +Segments where the area between hat and squeeze is too +large compared to the average area between hat and squeeze +over all intervals are split. +This procedure is repeated until the ratio between area below squeeze +and area below hat exceeds the bound given by +@ifhtml +@ref{funct:unur_arou_set_max_sqhratio,@command{unur_arou_set_max_sqhratio}} +@end ifhtml +@ifnothtml +@command{unur_arou_set_max_sqhratio} +@end ifnothtml +call or the maximum number of segments is +reached. Moreover, it also aborts when no more segments can be +found for splitting. + +Segments are split such that the angle of the segments are halved +(corresponds to arc-mean rule of method TDR (@pxref{TDR})). + +Default is @code{TRUE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_arou_set_usedars} +@deftypefn {} {int} unur_arou_set_usedars (UNUR_PAR* @var{parameters}, int @var{usedars}) +If @var{usedars} is set to @code{TRUE}, ``derandomized adaptive rejection +sampling'' (DARS) is used in setup. +Segments where the area between hat and squeeze is too +large compared to the average area between hat and squeeze +over all intervals are split. +This procedure is repeated until the ratio between area below squeeze +and area below hat exceeds the bound given by +@ifhtml +@ref{funct:unur_arou_set_max_sqhratio,@command{unur_arou_set_max_sqhratio}} +@end ifhtml +@ifnothtml +@command{unur_arou_set_max_sqhratio} +@end ifnothtml +call or the maximum number of segments is +reached. Moreover, it also aborts when no more segments can be +found for splitting. + +Segments are split such that the angle of the segments are halved +(corresponds to arc-mean rule of method TDR (@pxref{TDR})). + +Default is @code{TRUE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_arou_set_darsfactor} +@deftypefn Function {int} unur_arou_set_darsfactor (UNUR_PAR* @var{parameters}, double @var{factor}) +Set factor for ``derandomized adaptive rejection sampling''. +This factor is used to determine the segments that are ``too +large'', that is, all segments where the area between squeeze and +hat is larger than @var{factor} times the average area over all +intervals between squeeze and hat. +Notice that all segments are split when @var{factor} is set to +@code{0.}, and that there is no splitting at all when @var{factor} +is set to @code{UNUR_INFINITY}. + +Default is @code{0.99}. There is no need to change this parameter. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_arou_set_darsfactor} +@deftypefn {} {int} unur_arou_set_darsfactor (UNUR_PAR* @var{parameters}, double @var{factor}) +Set factor for ``derandomized adaptive rejection sampling''. +This factor is used to determine the segments that are ``too +large'', that is, all segments where the area between squeeze and +hat is larger than @var{factor} times the average area over all +intervals between squeeze and hat. +Notice that all segments are split when @var{factor} is set to +@code{0.}, and that there is no splitting at all when @var{factor} +is set to @code{UNUR_INFINITY}. + +Default is @code{0.99}. There is no need to change this parameter. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_arou_set_max_sqhratio} +@deftypefn Function {int} unur_arou_set_max_sqhratio (UNUR_PAR* @var{parameters}, double @var{max_ratio}) +Set upper bound for the +ratio (area inside squeeze) / (area inside envelope). +It must be a number between 0 and 1. +When the ratio exceeds the given number no further construction +points are inserted via adaptive rejection sampling. +Use @code{0} if no construction points should be added after the +setup. +Use @code{1} if adding new construction points should not be +stopped until the maximum number of construction points is reached. + +Default is @code{0.99}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_arou_set_max_sqhratio} +@deftypefn {} {int} unur_arou_set_max_sqhratio (UNUR_PAR* @var{parameters}, double @var{max_ratio}) +Set upper bound for the +ratio (area inside squeeze) / (area inside envelope). +It must be a number between 0 and 1. +When the ratio exceeds the given number no further construction +points are inserted via adaptive rejection sampling. +Use @code{0} if no construction points should be added after the +setup. +Use @code{1} if adding new construction points should not be +stopped until the maximum number of construction points is reached. + +Default is @code{0.99}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_arou_get_sqhratio} +@deftypefn Function {double} unur_arou_get_sqhratio (const @var{UNUR_GEN* generator}) +Get the current ratio (area inside squeeze) / (area inside envelope) +for the generator. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_arou_get_sqhratio} +@deftypefn {} {double} unur_arou_get_sqhratio (const @var{UNUR_GEN* generator}) +Get the current ratio (area inside squeeze) / (area inside envelope) +for the generator. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_arou_get_hatarea} +@deftypefn Function {double} unur_arou_get_hatarea (const @var{UNUR_GEN* generator}) +Get the area below the hat for the generator. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_arou_get_hatarea} +@deftypefn {} {double} unur_arou_get_hatarea (const @var{UNUR_GEN* generator}) +Get the area below the hat for the generator. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_arou_get_squeezearea} +@deftypefn Function {double} unur_arou_get_squeezearea (const @var{UNUR_GEN* generator}) +Get the area below the squeeze for the generator. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_arou_get_squeezearea} +@deftypefn {} {double} unur_arou_get_squeezearea (const @var{UNUR_GEN* generator}) +Get the area below the squeeze for the generator. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_arou_set_max_segments} +@deftypefn Function {int} unur_arou_set_max_segments (UNUR_PAR* @var{parameters}, int @var{max_segs}) +Set maximum number of segements. +No construction points are added @emph{after} the setup when the +number of segments succeeds @var{max_segs}. + +Default is @code{100}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_arou_set_max_segments} +@deftypefn {} {int} unur_arou_set_max_segments (UNUR_PAR* @var{parameters}, int @var{max_segs}) +Set maximum number of segements. +No construction points are added @emph{after} the setup when the +number of segments succeeds @var{max_segs}. + +Default is @code{100}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_arou_set_cpoints} +@deftypefn Function {int} unur_arou_set_cpoints (UNUR_PAR* @var{parameters}, int @var{n_stp}, const @var{double* stp}) +Set construction points for enveloping polygon. +If @var{stp} is @code{NULL}, then a heuristical rule of thumb is used to +get @var{n_stp} construction points. +This is the default behavior when this routine is not called. +The (default) number of construction points is @code{30}, then. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_arou_set_cpoints} +@deftypefn {} {int} unur_arou_set_cpoints (UNUR_PAR* @var{parameters}, int @var{n_stp}, const @var{double* stp}) +Set construction points for enveloping polygon. +If @var{stp} is @code{NULL}, then a heuristical rule of thumb is used to +get @var{n_stp} construction points. +This is the default behavior when this routine is not called. +The (default) number of construction points is @code{30}, then. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_arou_set_usecenter} +@deftypefn Function {int} unur_arou_set_usecenter (UNUR_PAR* @var{parameters}, int @var{usecenter}) +Use the center as construction point. +Default is @code{TRUE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_arou_set_usecenter} +@deftypefn {} {int} unur_arou_set_usecenter (UNUR_PAR* @var{parameters}, int @var{usecenter}) +Use the center as construction point. +Default is @code{TRUE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_arou_set_guidefactor} +@deftypefn Function {int} unur_arou_set_guidefactor (UNUR_PAR* @var{parameters}, double @var{factor}) +Set factor for relative size of the guide table for indexed search +(see also method DGT @ref{DGT}). It must be greater than or equal +to @code{0}. +When set to @code{0}, then sequential search is used. + +Default is @code{2}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_arou_set_guidefactor} +@deftypefn {} {int} unur_arou_set_guidefactor (UNUR_PAR* @var{parameters}, double @var{factor}) +Set factor for relative size of the guide table for indexed search +(see also method DGT @ref{DGT}). It must be greater than or equal +to @code{0}. +When set to @code{0}, then sequential search is used. + +Default is @code{2}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_arou_set_verify} +@anchor{funct:unur_arou_chg_verify} +@deftypefn Function {int} unur_arou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx Function {int} unur_arou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_arou_set_verify} +@anchor{funct:unur_arou_chg_verify} +@deftypefn {} {int} unur_arou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx {} {int} unur_arou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_arou_set_pedantic} +@deftypefn Function {int} unur_arou_set_pedantic (UNUR_PAR* @var{parameters}, int @var{pedantic}) +Sometimes it might happen that +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +has been executed +successfully. But when additional construction points are added by +adaptive rejection sampling, the algorithm detects that the +PDF is not T-concave. + +With @var{pedantic} being @code{TRUE}, the +sampling routine is then exchanged by a routine that simply returns +@code{UNUR_INFINITY}. Otherwise the new point is not added to the +list of construction points. At least the hat function remains +T-concave. + +Setting @var{pedantic} to @code{FALSE} allows sampling from a +distribution which is ``almost'' T-concave and small errors are +tolerated. However it might happen that the hat function cannot be +improved significantly. When the hat function that has been +constructed by the +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +call is extremely large then it +might happen that the generation times are extremely high +(even hours are possible in extremely rare cases). + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_arou_set_pedantic} +@deftypefn {} {int} unur_arou_set_pedantic (UNUR_PAR* @var{parameters}, int @var{pedantic}) +Sometimes it might happen that +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +has been executed +successfully. But when additional construction points are added by +adaptive rejection sampling, the algorithm detects that the +PDF is not T-concave. + +With @var{pedantic} being @code{TRUE}, the +sampling routine is then exchanged by a routine that simply returns +@code{UNUR_INFINITY}. Otherwise the new point is not added to the +list of construction points. At least the hat function remains +T-concave. + +Setting @var{pedantic} to @code{FALSE} allows sampling from a +distribution which is ``almost'' T-concave and small errors are +tolerated. However it might happen that the hat function cannot be +improved significantly. When the hat function that has been +constructed by the +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +call is extremely large then it +might happen that the generation times are extremely high +(even hours are possible in extremely rare cases). + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of arou.h +@c ------------------------------------- +@c ------------------------------------- +@c ars.h +@c + +@page +@node ARS +@subsection ARS -- Adaptive Rejection Sampling + +@table @i +@item Required: +concave logPDF, derivative of logPDF +@item Optional: +mode +@item Speed: +Set-up: fast, Sampling: slow +@item Reinit: +supported +@item Reference: +@ifhtml +@ref{bib:GWa92,, [GWa92]} +@end ifhtml +@ifnothtml +[GWa92] +@end ifnothtml +@ifhtml +@ref{bib:HLD04,, [HLD04: Cha.4]} +@end ifhtml +@ifnothtml +[HLD04: Cha.4] +@end ifnothtml + +@end table + + +ARS is an acceptance/rejection method that uses the concavity +of the log-density function to construct hat function and +squeezes automatically. +It is very similar to method TDR (@pxref{TDR}) with variant GW, +parameter @code{c = 0}, and DARS switched off. +Moreover, method ARS requires the logPDF and its derivative +dlogPDF to run. On the other hand, it is designed to draw only a +(very) small samples and it is much more robust against +densities with very large or small areas below the PDF as +it occurs, for example, in conditional distributions of +(high dimensional) multivariate distributions. +Additionally, it can be re-initialized when the underlying +distribution has been modified. +Thus it is well suited for Gibbs sampling. + +Notice, that method ARS is a restricted version of TDR. If the +full functionally of Transformed Density Rejection is needed use +method @ref{TDR}. + + +@subsubheading How To Use + + +Method ARS is designed for distributions with log-concave +densities. To use this method you need a distribution object +with the logarithm of the PDF and its derivative given. + +The number of construction points as well as a set of such +points can be provided using +@ifhtml +@ref{funct:unur_ars_set_cpoints,@command{unur_ars_set_cpoints}.} +@end ifhtml +@ifnothtml +@command{unur_ars_set_cpoints}. +@end ifnothtml +Notice that addition construction points are added by means of +adaptive rejection sampling until the maximal number of +intervals given by +@ifhtml +@ref{funct:unur_ars_set_max_intervals,@command{unur_ars_set_max_intervals}} +@end ifhtml +@ifnothtml +@command{unur_ars_set_max_intervals} +@end ifnothtml +is reached. + +A generated distribution object can be reinitialized using the +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +call. When +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +is called construction +points for the new generator are necessary. There are two options: +Either the same construction points as for the initial generator +(given by a +@ifhtml +@ref{funct:unur_ars_set_cpoints,@command{unur_ars_set_cpoints}} +@end ifhtml +@ifnothtml +@command{unur_ars_set_cpoints} +@end ifnothtml +call) are used (this is the +default), or percentiles of the old hat function can be used. +This can be set or changed using +@ifhtml +@ref{funct:unur_ars_set_reinit_percentiles,@command{unur_ars_set_reinit_percentiles}} +@end ifhtml +@ifnothtml +@command{unur_ars_set_reinit_percentiles} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_ars_chg_reinit_percentiles,@command{unur_ars_chg_reinit_percentiles}.} +@end ifhtml +@ifnothtml +@command{unur_ars_chg_reinit_percentiles}. +@end ifnothtml +This feature is usefull when the underlying distribution object +is only moderately changed. (An example is Gibbs sampling with +small correlations.) + +There exists a test mode that verifies whether the conditions for +the method are satisfied or not. It can be switched on by calling +@ifhtml +@ref{funct:unur_ars_set_verify,@command{unur_ars_set_verify}} +@end ifhtml +@ifnothtml +@command{unur_ars_set_verify} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_ars_chg_verify,@command{unur_ars_chg_verify},} +@end ifhtml +@ifnothtml +@command{unur_ars_chg_verify}, +@end ifnothtml +respectively. +Notice however that sampling is (much) slower then. + +Method ARS aborts after a given number of iterations and return +UNUR_INFINITY to prevent (almost) infinite loops. This might +happen when the starting hat is much too large and it is not +possible to insert new construction points due to severe +numerical errors or (more likely) the given PDF is not +log-concave. This maximum number of iterations can be set by +means of a +@ifhtml +@ref{funct:unur_ars_set_max_iter,@command{unur_ars_set_max_iter}} +@end ifhtml +@ifnothtml +@command{unur_ars_set_max_iter} +@end ifnothtml +call. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_ars_new,unur_ars_new} +@item @ref{funct:unur_ars_set_max_intervals,unur_ars_set_max_intervals} +@item @ref{funct:unur_ars_set_cpoints,unur_ars_set_cpoints} +@item @ref{funct:unur_ars_set_reinit_percentiles,unur_ars_set_reinit_percentiles} +@item @ref{funct:unur_ars_chg_reinit_percentiles,unur_ars_chg_reinit_percentiles} +@item @ref{funct:unur_ars_set_reinit_ncpoints,unur_ars_set_reinit_ncpoints} +@item @ref{funct:unur_ars_chg_reinit_ncpoints,unur_ars_chg_reinit_ncpoints} +@item @ref{funct:unur_ars_set_max_iter,unur_ars_set_max_iter} +@item @ref{funct:unur_ars_set_verify,unur_ars_set_verify} +@item @ref{funct:unur_ars_chg_verify,unur_ars_chg_verify} +@item @ref{funct:unur_ars_set_pedantic,unur_ars_set_pedantic} +@item @ref{funct:unur_ars_get_loghatarea,unur_ars_get_loghatarea} +@item @ref{funct:unur_ars_eval_invcdfhat,unur_ars_eval_invcdfhat} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_ars_new} +@deftypefn Function {UNUR_PAR*} unur_ars_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ars_new} +@deftypefn {} {UNUR_PAR*} unur_ars_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ars_set_max_intervals} +@deftypefn Function {int} unur_ars_set_max_intervals (UNUR_PAR* @var{parameters}, int @var{max_ivs}) +Set maximum number of intervals. +No construction points are added after the setup when the number of +intervals suceeds @var{max_ivs}. +It is increased automatically to twice the number of construction +points if this is larger. + +Default is @code{200}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ars_set_max_intervals} +@deftypefn {} {int} unur_ars_set_max_intervals (UNUR_PAR* @var{parameters}, int @var{max_ivs}) +Set maximum number of intervals. +No construction points are added after the setup when the number of +intervals suceeds @var{max_ivs}. +It is increased automatically to twice the number of construction +points if this is larger. + +Default is @code{200}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ars_set_cpoints} +@deftypefn Function {int} unur_ars_set_cpoints (UNUR_PAR* @var{parameters}, int @var{n_cpoints}, const @var{double* cpoints}) +Set construction points for the hat function. If @var{cpoints} is +@code{NULL} then a heuristic rule of thumb is used to get @var{n_cpoints} +construction points. This is the default behavior. +@var{n_cpoints} should be at least @code{2}, otherwise defaults are used. + +The default number of construction points is 2. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ars_set_cpoints} +@deftypefn {} {int} unur_ars_set_cpoints (UNUR_PAR* @var{parameters}, int @var{n_cpoints}, const @var{double* cpoints}) +Set construction points for the hat function. If @var{cpoints} is +@code{NULL} then a heuristic rule of thumb is used to get @var{n_cpoints} +construction points. This is the default behavior. +@var{n_cpoints} should be at least @code{2}, otherwise defaults are used. + +The default number of construction points is 2. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ars_set_reinit_percentiles} +@anchor{funct:unur_ars_chg_reinit_percentiles} +@deftypefn Function {int} unur_ars_set_reinit_percentiles (UNUR_PAR* @var{parameters}, int @var{n_percentiles}, const @var{double* percentiles}) +@deftypefnx Function {int} unur_ars_chg_reinit_percentiles (UNUR_GEN* @var{generator}, int @var{n_percentiles}, const @var{double* percentiles}) +By default, when the @var{generator} object is reinitialized, it +used the same construction points as for the initialization +procedure. +Often the underlying distribution object has been changed only +moderately. For example, the full conditional distribution of a +multivariate distribution. +In this case it might be more appropriate to use +percentilesm of the hat function for the last (unchanged) +distribution. @var{percentiles} must then be a pointer to an +ordered array of numbers between @code{0.01} and @code{0.99}. +If @var{percentiles} is @code{NULL}, then a heuristic rule of thumb is +used to get @var{n_percentiles} values for these percentiles. +Notice that @var{n_percentiles} must be at least @code{2}, +otherwise defaults are used. +(Then the first and third quartiles are used by default.) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ars_set_reinit_percentiles} +@anchor{funct:unur_ars_chg_reinit_percentiles} +@deftypefn {} {int} unur_ars_set_reinit_percentiles (UNUR_PAR* @var{parameters}, int @var{n_percentiles}, const @var{double* percentiles}) +@deftypefnx {} {int} unur_ars_chg_reinit_percentiles (UNUR_GEN* @var{generator}, int @var{n_percentiles}, const @var{double* percentiles}) +By default, when the @var{generator} object is reinitialized, it +used the same construction points as for the initialization +procedure. +Often the underlying distribution object has been changed only +moderately. For example, the full conditional distribution of a +multivariate distribution. +In this case it might be more appropriate to use +percentilesm of the hat function for the last (unchanged) +distribution. @var{percentiles} must then be a pointer to an +ordered array of numbers between @code{0.01} and @code{0.99}. +If @var{percentiles} is @code{NULL}, then a heuristic rule of thumb is +used to get @var{n_percentiles} values for these percentiles. +Notice that @var{n_percentiles} must be at least @code{2}, +otherwise defaults are used. +(Then the first and third quartiles are used by default.) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ars_set_reinit_ncpoints} +@anchor{funct:unur_ars_chg_reinit_ncpoints} +@deftypefn Function {int} unur_ars_set_reinit_ncpoints (UNUR_PAR* @var{parameters}, int @var{ncpoints}) +@deftypefnx Function {int} unur_ars_chg_reinit_ncpoints (UNUR_GEN* @var{generator}, int @var{ncpoints}) +When reinit fails with the given construction points or the percentiles +of the old hat function, another trial is undertaken with @var{ncpoints} +construction points. @var{ncpoints} must be at least @code{10}. + +Default: @code{30} +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ars_set_reinit_ncpoints} +@anchor{funct:unur_ars_chg_reinit_ncpoints} +@deftypefn {} {int} unur_ars_set_reinit_ncpoints (UNUR_PAR* @var{parameters}, int @var{ncpoints}) +@deftypefnx {} {int} unur_ars_chg_reinit_ncpoints (UNUR_GEN* @var{generator}, int @var{ncpoints}) +When reinit fails with the given construction points or the percentiles +of the old hat function, another trial is undertaken with @var{ncpoints} +construction points. @var{ncpoints} must be at least @code{10}. + +Default: @code{30} +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ars_set_max_iter} +@deftypefn Function {int} unur_ars_set_max_iter (UNUR_PAR* @var{parameters}, int @var{max_iter}) +The rejection loop stops after @var{max_iter} iterations and return +UNUR_INFINITY. + +Default: @code{10000} +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ars_set_max_iter} +@deftypefn {} {int} unur_ars_set_max_iter (UNUR_PAR* @var{parameters}, int @var{max_iter}) +The rejection loop stops after @var{max_iter} iterations and return +UNUR_INFINITY. + +Default: @code{10000} +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ars_set_verify} +@anchor{funct:unur_ars_chg_verify} +@deftypefn Function {int} unur_ars_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx Function {int} unur_ars_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ars_set_verify} +@anchor{funct:unur_ars_chg_verify} +@deftypefn {} {int} unur_ars_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx {} {int} unur_ars_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ars_set_pedantic} +@deftypefn Function {int} unur_ars_set_pedantic (UNUR_PAR* @var{parameters}, int @var{pedantic}) +Sometimes it might happen that +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +has been executed +successfully. But when additional construction points are added by +adaptive rejection sampling, the algorithm detects that the +PDF is not log-concave. + +With @var{pedantic} being @code{TRUE}, the +sampling routine is exchanged by a routine that simply returns +@code{UNUR_INFINITY}. Otherwise the new point is not added to the +list of construction points. At least the hat function remains +log-concave. + +Setting @var{pedantic} to @code{FALSE} allows sampling from a +distribution which is ``almost'' log-concave and small errors are +tolerated. However it might happen that the hat function cannot be +improved significantly. When the hat functions that has been +constructed by the +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +call is extremely large then it +might happen that the generation times are extremely high +(even hours are possible in extremely rare cases). + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ars_set_pedantic} +@deftypefn {} {int} unur_ars_set_pedantic (UNUR_PAR* @var{parameters}, int @var{pedantic}) +Sometimes it might happen that +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +has been executed +successfully. But when additional construction points are added by +adaptive rejection sampling, the algorithm detects that the +PDF is not log-concave. + +With @var{pedantic} being @code{TRUE}, the +sampling routine is exchanged by a routine that simply returns +@code{UNUR_INFINITY}. Otherwise the new point is not added to the +list of construction points. At least the hat function remains +log-concave. + +Setting @var{pedantic} to @code{FALSE} allows sampling from a +distribution which is ``almost'' log-concave and small errors are +tolerated. However it might happen that the hat function cannot be +improved significantly. When the hat functions that has been +constructed by the +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +call is extremely large then it +might happen that the generation times are extremely high +(even hours are possible in extremely rare cases). + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ars_get_loghatarea} +@deftypefn Function {double} unur_ars_get_loghatarea (const @var{UNUR_GEN* generator}) +Get the logarithm of area below the hat for the generator. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ars_get_loghatarea} +@deftypefn {} {double} unur_ars_get_loghatarea (const @var{UNUR_GEN* generator}) +Get the logarithm of area below the hat for the generator. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ars_eval_invcdfhat} +@deftypefn Function {double} unur_ars_eval_invcdfhat (const @var{UNUR_GEN* generator}, double @var{u}) +Evaluate the inverse of the CDF of the hat distribution at @var{u}. + +If @var{u} is out of the domain [0,1] then @code{unur_errno} is set +to @code{UNUR_ERR_DOMAIN} and the respective bound of +the domain of the distribution are returned (which is +@code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of +unbounded domains). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ars_eval_invcdfhat} +@deftypefn {} {double} unur_ars_eval_invcdfhat (const @var{UNUR_GEN* generator}, double @var{u}) +Evaluate the inverse of the CDF of the hat distribution at @var{u}. + +If @var{u} is out of the domain [0,1] then @code{unur_errno} is set +to @code{UNUR_ERR_DOMAIN} and the respective bound of +the domain of the distribution are returned (which is +@code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of +unbounded domains). +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of ars.h +@c ------------------------------------- +@c ------------------------------------- +@c cext.h +@c + +@page +@node CEXT +@subsection CEXT -- wrapper for Continuous EXTernal generators + +@table @i +@item Required: +routine for sampling continuous random variates +@item Speed: +depends on external generator +@item Reinit: +supported +@end table + + +Method CEXT is a wrapper for external generators for continuous +univariate distributions. It allows the usage of external +random variate generators within the UNU.RAN framework. + + +@subsubheading How To Use + + +The following steps are required to use some external generator +within the UNU.RAN framework (some of these are optional): + +@enumerate +@item +Make an empty generator object using a +@ifhtml +@ref{funct:unur_cext_new,@command{unur_cext_new}} +@end ifhtml +@ifnothtml +@command{unur_cext_new} +@end ifnothtml +call. +The argument @var{distribution} is optional and can be replaced +by @code{NULL}. However, it is required if you want to pass +parameters of the generated distribution to the external +generator or for running some validation tests provided by +UNU.RAN. + +@item +Create an initialization routine of type +@code{int (*init)(UNUR_GEN *gen)} and plug it into the generator +object using the +@ifhtml +@ref{funct:unur_cext_set_init,@command{unur_cext_set_init}} +@end ifhtml +@ifnothtml +@command{unur_cext_set_init} +@end ifnothtml +call. Notice that the +@var{init} routine must return @code{UNUR_SUCCESS} when it has +been executed successfully and @code{UNUR_FAILURE} otherwise. +It is possible to get the size of and the pointer to the array +of parameters of the underlying distribution object by the +respective calls +@ifhtml +@ref{funct:unur_cext_get_ndistrparams,@command{unur_cext_get_ndistrparams}} +@end ifhtml +@ifnothtml +@command{unur_cext_get_ndistrparams} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_cext_get_distrparams,@command{unur_cext_get_distrparams}.} +@end ifhtml +@ifnothtml +@command{unur_cext_get_distrparams}. +@end ifnothtml +Parameters for the external generator that are computed in the +@var{init} routine can be stored in a single array or structure +which is available by the +@ifhtml +@ref{funct:unur_cext_get_params,@command{unur_cext_get_params}} +@end ifhtml +@ifnothtml +@command{unur_cext_get_params} +@end ifnothtml +call. + +Using an @var{init} routine is optional and can be omitted. + +@item +Create a sampling routine of type +@code{double (*sample)(UNUR_GEN *gen)} and plug it into the +generator object using the +@ifhtml +@ref{funct:unur_cext_set_sample,@command{unur_cext_set_sample}} +@end ifhtml +@ifnothtml +@command{unur_cext_set_sample} +@end ifnothtml +call. + +Uniform random numbers are provided by the +@ifhtml +@ref{funct:unur_sample_urng,@command{unur_sample_urng}} +@end ifhtml +@ifnothtml +@command{unur_sample_urng} +@end ifnothtml +call. Do not use your own implementation of a uniform random +number generator directly. If you want to use your own random +number generator we recommend to use the UNU.RAN interface (see +@pxref{URNG,,Using uniform random number generators}). + +The array or structure that contains parameters for the external +generator that are computed in the @var{init} routine are +available using the +@ifhtml +@ref{funct:unur_cext_get_params,@command{unur_cext_get_params}} +@end ifhtml +@ifnothtml +@command{unur_cext_get_params} +@end ifnothtml +call. + +Using a @var{sample} routine is of course obligatory. +@end enumerate + +It is possible to change the parameters and the domain of the +chosen distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the +generator object. The @var{init} routine is then called again. + +Here is a short example that demonstrates the application of +this method by means of the exponential distribution: + +@smallexample +@include ref_example_cext.texi +@end smallexample + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_cext_new,unur_cext_new} +@item @ref{funct:unur_cext_set_init,unur_cext_set_init} +@item @ref{funct:unur_cext_set_sample,unur_cext_set_sample} +@item @ref{funct:unur_cext_get_params,unur_cext_get_params} +@item @ref{funct:unur_cext_get_distrparams,unur_cext_get_distrparams} +@item @ref{funct:unur_cext_get_ndistrparams,unur_cext_get_ndistrparams} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_cext_new} +@deftypefn Function {UNUR_PAR*} unur_cext_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for new generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_cext_new} +@deftypefn {} {UNUR_PAR*} unur_cext_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for new generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_cext_set_init} +@deftypefn Function {int} unur_cext_set_init (UNUR_PAR* @var{parameters}, int (* @var{init})(UNUR_GEN* gen )) +Set initialization routine for external generator. Inside the + +@emph{Important:} The routine @var{init} must return +@code{UNUR_SUCCESS} when the generator was initialized successfully +and @code{UNUR_FAILURE} otherwise. + +Parameters that are computed in the @var{init} routine can be +stored in an array or structure that is avaiable by means of the +@ifhtml +@ref{funct:unur_cext_get_params,@command{unur_cext_get_params}} +@end ifhtml +@ifnothtml +@command{unur_cext_get_params} +@end ifnothtml +call. Parameters of the underlying +distribution object can be obtained by the +@ifhtml +@ref{funct:unur_cext_get_distrparams,@command{unur_cext_get_distrparams}} +@end ifhtml +@ifnothtml +@command{unur_cext_get_distrparams} +@end ifnothtml +call. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_cext_set_init} +@deftypefn {} {int} unur_cext_set_init (UNUR_PAR* @var{parameters}, int (* @var{init})(UNUR_GEN* gen )) +Set initialization routine for external generator. Inside the + +@emph{Important:} The routine @var{init} must return +@code{UNUR_SUCCESS} when the generator was initialized successfully +and @code{UNUR_FAILURE} otherwise. + +Parameters that are computed in the @var{init} routine can be +stored in an array or structure that is avaiable by means of the +@ifhtml +@ref{funct:unur_cext_get_params,@command{unur_cext_get_params}} +@end ifhtml +@ifnothtml +@command{unur_cext_get_params} +@end ifnothtml +call. Parameters of the underlying +distribution object can be obtained by the +@ifhtml +@ref{funct:unur_cext_get_distrparams,@command{unur_cext_get_distrparams}} +@end ifhtml +@ifnothtml +@command{unur_cext_get_distrparams} +@end ifnothtml +call. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_cext_set_sample} +@deftypefn Function {int} unur_cext_set_sample (UNUR_PAR* @var{parameters}, double (* @var{sample})(UNUR_GEN* gen )) +Set sampling routine for external generator. + +@emph{Important:} +Use @code{unur_sample_urng(gen)} to get a uniform random number. +The pointer to the array or structure that contains the parameters +that are precomputed in the @var{init} routine are available by +@code{unur_cext_get_params(gen,0)}. +Additionally one can use the +@ifhtml +@ref{funct:unur_cext_get_distrparams,@command{unur_cext_get_distrparams}} +@end ifhtml +@ifnothtml +@command{unur_cext_get_distrparams} +@end ifnothtml +call. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_cext_set_sample} +@deftypefn {} {int} unur_cext_set_sample (UNUR_PAR* @var{parameters}, double (* @var{sample})(UNUR_GEN* gen )) +Set sampling routine for external generator. + +@emph{Important:} +Use @code{unur_sample_urng(gen)} to get a uniform random number. +The pointer to the array or structure that contains the parameters +that are precomputed in the @var{init} routine are available by +@code{unur_cext_get_params(gen,0)}. +Additionally one can use the +@ifhtml +@ref{funct:unur_cext_get_distrparams,@command{unur_cext_get_distrparams}} +@end ifhtml +@ifnothtml +@command{unur_cext_get_distrparams} +@end ifnothtml +call. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_cext_get_params} +@deftypefn Function {void*} unur_cext_get_params (UNUR_GEN* @var{generator}, size_t @var{size}) +Get pointer to memory block for storing parameters of external +generator. A memory block of size @var{size} is automatically (re-) +allocated if necessary and the pointer to this block is stored in +the @var{generator} object. If one only needs the pointer to this +memory block set @var{size} to @code{0}. + +Notice, that @var{size} is the size of the memory block and not the +length of an array. + +@emph{Important:} This rountine should only be used in the +initialization and sampling routine of the external generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_cext_get_params} +@deftypefn {} {void*} unur_cext_get_params (UNUR_GEN* @var{generator}, size_t @var{size}) +Get pointer to memory block for storing parameters of external +generator. A memory block of size @var{size} is automatically (re-) +allocated if necessary and the pointer to this block is stored in +the @var{generator} object. If one only needs the pointer to this +memory block set @var{size} to @code{0}. + +Notice, that @var{size} is the size of the memory block and not the +length of an array. + +@emph{Important:} This rountine should only be used in the +initialization and sampling routine of the external generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_cext_get_distrparams} +@anchor{funct:unur_cext_get_ndistrparams} +@deftypefn Function {double*} unur_cext_get_distrparams (UNUR_GEN* @var{generator}) +@deftypefnx Function {int} unur_cext_get_ndistrparams (UNUR_GEN* @var{generator}) +Get size of and pointer to array of parameters of underlying +distribution in @var{generator} object. + +@emph{Important:} These rountines should only be used in the +initialization and sampling routine of the external generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_cext_get_distrparams} +@anchor{funct:unur_cext_get_ndistrparams} +@deftypefn {} {double*} unur_cext_get_distrparams (UNUR_GEN* @var{generator}) +@deftypefnx {} {int} unur_cext_get_ndistrparams (UNUR_GEN* @var{generator}) +Get size of and pointer to array of parameters of underlying +distribution in @var{generator} object. + +@emph{Important:} These rountines should only be used in the +initialization and sampling routine of the external generator. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of cext.h +@c ------------------------------------- +@c ------------------------------------- +@c cstd.h +@c + +@page +@node CSTD +@subsection CSTD -- Continuous STandarD distributions + +@table @i +@item Required: +standard distribution from UNU.RAN library (@pxref{Stddist,,Standard distributions}) or continuous distribution with inverse CDF. +@item Speed: +Set-up: fast, Sampling: depends on distribution and generator +@item Reinit: +supported +@end table + + +CSTD is a wrapper for special generators for continuous +univariate standard distributions. It only works for +distributions in the UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}) +or for continuous distributions where the inverse CDF is given. +If a distribution object is provided that is build from scratch, +it must provide the inverse CDF. Then CSTD implements the +inversion method. Otherwise, the @code{NULL} pointer is returned. + +For some distributions more than one special generator +is possible. + + +@subsubheading How To Use + + +Create a distribution object for a standard distribution +from the UNU.RAN library +(@pxref{Stddist,,Standard distributions}), +or create a continuous distribution object and set the function +for the inverse CDF using +@ifhtml +@ref{funct:unur_distr_cont_set_invcdf,@command{unur_distr_cont_set_invcdf}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_invcdf}. +@end ifnothtml +For some distributions more than one special generator +(@emph{variants}) is possible. These can be choosen by a +@ifhtml +@ref{funct:unur_cstd_set_variant,@command{unur_cstd_set_variant}} +@end ifhtml +@ifnothtml +@command{unur_cstd_set_variant} +@end ifnothtml +call. For possible variants +@pxref{Stddist,,Standard distributions}. +However the following are common to all distributions: + +@table @code +@item UNUR_STDGEN_DEFAULT +the default generator. +@item UNUR_STDGEN_FAST +the fastest available special generator. +@item UNUR_STDGEN_INVERSION +the inversion method (if available). +@end table + +Notice that the variant @code{UNUR_STDGEN_FAST} for a special +generator may be slower than one of the universal algorithms! +Additional variants may exist for particular distributions. + +Sampling from truncated distributions (which can be constructed by +changing the default domain of a distribution by means of +@ifhtml +@ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_domain} +@end ifnothtml +or +@ifhtml +@ref{funct:unur_cstd_chg_truncated,@command{unur_cstd_chg_truncated}} +@end ifhtml +@ifnothtml +@command{unur_cstd_chg_truncated} +@end ifnothtml +calls) +is possible but requires the inversion method. Moreover the CDF +of the distribution must be implemented. + +It is possible to change the parameters and the domain of the chosen +distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator object. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_cstd_new,unur_cstd_new} +@item @ref{funct:unur_cstd_set_variant,unur_cstd_set_variant} +@item @ref{funct:unur_cstd_chg_truncated,unur_cstd_chg_truncated} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_cstd_new} +@deftypefn Function {UNUR_PAR*} unur_cstd_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for new generator. It requires a distribution object +for a continuous univariant distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}). + +Using a truncated distribution is allowed only if the inversion method +is available and selected by the +@ifhtml +@ref{funct:unur_cstd_set_variant,@command{unur_cstd_set_variant}} +@end ifhtml +@ifnothtml +@command{unur_cstd_set_variant} +@end ifnothtml +call immediately +after creating the parameter object. +Use a +@ifhtml +@ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_domain} +@end ifnothtml +call to get a truncated distribution. +To change the domain of a (truncated) distribution of a generator use the +@ifhtml +@ref{funct:unur_cstd_chg_truncated,@command{unur_cstd_chg_truncated}} +@end ifhtml +@ifnothtml +@command{unur_cstd_chg_truncated} +@end ifnothtml +call. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_cstd_new} +@deftypefn {} {UNUR_PAR*} unur_cstd_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for new generator. It requires a distribution object +for a continuous univariant distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}). + +Using a truncated distribution is allowed only if the inversion method +is available and selected by the +@ifhtml +@ref{funct:unur_cstd_set_variant,@command{unur_cstd_set_variant}} +@end ifhtml +@ifnothtml +@command{unur_cstd_set_variant} +@end ifnothtml +call immediately +after creating the parameter object. +Use a +@ifhtml +@ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_domain} +@end ifnothtml +call to get a truncated distribution. +To change the domain of a (truncated) distribution of a generator use the +@ifhtml +@ref{funct:unur_cstd_chg_truncated,@command{unur_cstd_chg_truncated}} +@end ifhtml +@ifnothtml +@command{unur_cstd_chg_truncated} +@end ifnothtml +call. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_cstd_set_variant} +@deftypefn Function {int} unur_cstd_set_variant (UNUR_PAR* @var{parameters}, unsigned @var{variant}) +Set variant (special generator) for sampling from a given distribution. +For possible variants +@pxref{Stddist,,Standard distributions}. + +Common variants are @code{UNUR_STDGEN_DEFAULT} for the default generator, +@code{UNUR_STDGEN_FAST} for (one of the) fastest implemented +special generators, and @code{UNUR_STDGEN_INVERSION} for the +inversion method (if available). +If the selected variant number is not implemented, then an error code is +returned and the variant is not changed. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_cstd_set_variant} +@deftypefn {} {int} unur_cstd_set_variant (UNUR_PAR* @var{parameters}, unsigned @var{variant}) +Set variant (special generator) for sampling from a given distribution. +For possible variants +@pxref{Stddist,,Standard distributions}. + +Common variants are @code{UNUR_STDGEN_DEFAULT} for the default generator, +@code{UNUR_STDGEN_FAST} for (one of the) fastest implemented +special generators, and @code{UNUR_STDGEN_INVERSION} for the +inversion method (if available). +If the selected variant number is not implemented, then an error code is +returned and the variant is not changed. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_cstd_chg_truncated} +@deftypefn Function {int} unur_cstd_chg_truncated (UNUR_GEN* @var{generator}, double @var{left}, double @var{right}) +Change left and right border of the domain of the (truncated) distribution. +This is only possible if the inversion method is used. +Otherwise this call has no effect and an error code is returned. + +Notice that the given truncated domain must be a subset of the +domain of the given distribution. The generator always uses the +intersection of the domain of the distribution and the truncated +domain given by this call. + +It is not required to run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +after this call has been used. + +@emph{Important:} If the CDF is (almost) the same for @var{left} and +@var{right} and (almost) equal to @code{0} or @code{1}, then the truncated +domain is not chanced and the call returns an error code. + +@emph{Notice:} If the parameters of the distribution has been changed +it is recommended to set the truncated domain again, since the +former call might change the domain of the distribution but not +update the values for the boundaries of the truncated +distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_cstd_chg_truncated} +@deftypefn {} {int} unur_cstd_chg_truncated (UNUR_GEN* @var{generator}, double @var{left}, double @var{right}) +Change left and right border of the domain of the (truncated) distribution. +This is only possible if the inversion method is used. +Otherwise this call has no effect and an error code is returned. + +Notice that the given truncated domain must be a subset of the +domain of the given distribution. The generator always uses the +intersection of the domain of the distribution and the truncated +domain given by this call. + +It is not required to run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +after this call has been used. + +@emph{Important:} If the CDF is (almost) the same for @var{left} and +@var{right} and (almost) equal to @code{0} or @code{1}, then the truncated +domain is not chanced and the call returns an error code. + +@emph{Notice:} If the parameters of the distribution has been changed +it is recommended to set the truncated domain again, since the +former call might change the domain of the distribution but not +update the values for the boundaries of the truncated +distribution. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of cstd.h +@c ------------------------------------- +@c ------------------------------------- +@c hinv.h +@c + +@page +@node HINV +@subsection HINV -- Hermite interpolation based INVersion of CDF + +@table @i +@item Required: +CDF +@item Optional: +PDF, dPDF +@item Speed: +Set-up: (very) slow, Sampling: (very) fast +@item Reinit: +supported +@item Reference: +@ifhtml +@ref{bib:HLa03,, [HLa03]} +@end ifhtml +@ifnothtml +[HLa03] +@end ifnothtml +@ifhtml +@ref{bib:HLD04,, [HLD04: Sect.7.2; Alg.7.1]} +@end ifhtml +@ifnothtml +[HLD04: Sect.7.2; Alg.7.1] +@end ifnothtml + +@end table + + +HINV is a variant of numerical inversion, where the inverse CDF +is approximated using Hermite interpolation, i.e., the interval +[0,1] is split into several intervals and in each interval the +inverse CDF is approximated by polynomials constructed by means +of values of the CDF and PDF at interval boundaries. This makes +it possible to improve the accuracy by splitting a particular +interval without recomputations in unaffected intervals. Three +types of splines are implemented: linear, cubic, and quintic +interpolation. For linear interpolation only the CDF is +required. Cubic interpolation also requires PDF and quintic +interpolation PDF and its derivative. + +These splines have to be computed in a setup step. However, it +only works for distributions with bounded domain; for +distributions with unbounded domain the tails are chopped off +such that the probability for the tail regions is small compared +to the given u-resolution. + +The method is not exact, as it only produces random variates of +the approximated distribution. Nevertheless, the maximal +numerical error in "u-direction" (i.e. |U-CDF(X)|, for +X = "approximate inverse CDF"(U) |U-CDF(X)|) can be set to the +required resolution (within machine precision). +Notice that very small values of the u-resolution are possible +but may increase the cost for the setup step. + +As the possible maximal error is only estimated in the setup it +may be necessary to set some special design points for computing +the Hermite interpolation to guarantee that the maximal u-error +can not be bigger than desired. Such points are points where the +density is not differentiable or has a local extremum. Notice +that there is no necessity to do so. However, if you do not +provide these points to the algorithm there might be a small +chance that the approximation error is larger than the given +u-resolution, or that the required number of intervals is larger +than necessary. + + +@subsubheading How To Use + + +HINV works for continuous univariate distribution objects with +given CDF and (optional) PDF. It uses Hermite interpolation of +order 1, 3 [default] or 5. The order can be set by means of +@ifhtml +@ref{funct:unur_hinv_set_order,@command{unur_hinv_set_order}.} +@end ifhtml +@ifnothtml +@command{unur_hinv_set_order}. +@end ifnothtml +For distributions with unbounded domains the tails are chopped +off such that the probability for the tail regions is small +compared to the given u-resulution. For finding these cut points +the algorithm starts with the region @code{[-1.e20,1.e20]}. For +the exceptional case where this might be too small (or one knows +this region and wants to avoid this search heuristics) it can be +directly set via a +@ifhtml +@ref{funct:unur_hinv_set_boundary,@command{unur_hinv_set_boundary}} +@end ifhtml +@ifnothtml +@command{unur_hinv_set_boundary} +@end ifnothtml +call. + +It is possible to use this method for generating from truncated +distributions. It even can be changed for an existing generator +object by an +@ifhtml +@ref{funct:unur_hinv_chg_truncated,@command{unur_hinv_chg_truncated}} +@end ifhtml +@ifnothtml +@command{unur_hinv_chg_truncated} +@end ifnothtml +call. + +This method is not exact, as it only produces random variates of +the approximated distribution. Nevertheless, the numerical error +in "u-direction" (i.e. |U-CDF(X)|, for +X = "approximate inverse CDF"(U) |U-CDF(X)|) can be controlled +by means of +@ifhtml +@ref{funct:unur_hinv_set_u_resolution,@command{unur_hinv_set_u_resolution}.} +@end ifhtml +@ifnothtml +@command{unur_hinv_set_u_resolution}. +@end ifnothtml +The possible maximal error is only estimated in the setup. Thus +it might be necessary to set some special design points for +computing the Hermite interpolation to guarantee that the +maximal u-error can not be bigger than desired. Such points +(e.g. extremal points of the PDF, points with infinite +derivative) can be set using using the +@ifhtml +@ref{funct:unur_hinv_set_cpoints,@command{unur_hinv_set_cpoints}} +@end ifhtml +@ifnothtml +@command{unur_hinv_set_cpoints} +@end ifnothtml +call. +If the mode for a unimodal distribution is set in the distribution +object this mode is automatically used as design-point if the +@ifhtml +@ref{funct:unur_hinv_set_cpoints,@command{unur_hinv_set_cpoints}} +@end ifhtml +@ifnothtml +@command{unur_hinv_set_cpoints} +@end ifnothtml +call is not used. + +As already mentioned the maximal error of this approximation is +only estimated. If this error is crucial for an application we +recommend to compute this error using +@ifhtml +@ref{funct:unur_hinv_estimate_error,@command{unur_hinv_estimate_error}} +@end ifhtml +@ifnothtml +@command{unur_hinv_estimate_error} +@end ifnothtml +which runs a small Monte Carlo simulation. + +It is possible to change the parameters and the domain of the chosen +distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator object. +The values given by the last +@ifhtml +@ref{funct:unur_hinv_chg_truncated,@command{unur_hinv_chg_truncated}} +@end ifhtml +@ifnothtml +@command{unur_hinv_chg_truncated} +@end ifnothtml +call will be +then changed to the values of the domain of the underlying distribution +object. Moreover, starting construction points (nodes) that are given by +a +@ifhtml +@ref{funct:unur_hinv_set_cpoints,@command{unur_hinv_set_cpoints}} +@end ifhtml +@ifnothtml +@command{unur_hinv_set_cpoints} +@end ifnothtml +call are ignored when +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +is +called. +It is important to note that for a distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}) +the normalization constant has to be updated using the +@ifhtml +@ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_pdfarea} +@end ifnothtml +call whenever its parameters have been +changed by means of a +@ifhtml +@ref{funct:unur_distr_cont_set_pdfparams,@command{unur_distr_cont_set_pdfparams}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdfparams} +@end ifnothtml +call. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_hinv_new,unur_hinv_new} +@item @ref{funct:unur_hinv_set_order,unur_hinv_set_order} +@item @ref{funct:unur_hinv_set_u_resolution,unur_hinv_set_u_resolution} +@item @ref{funct:unur_hinv_set_cpoints,unur_hinv_set_cpoints} +@item @ref{funct:unur_hinv_set_boundary,unur_hinv_set_boundary} +@item @ref{funct:unur_hinv_set_guidefactor,unur_hinv_set_guidefactor} +@item @ref{funct:unur_hinv_set_max_intervals,unur_hinv_set_max_intervals} +@item @ref{funct:unur_hinv_get_n_intervals,unur_hinv_get_n_intervals} +@item @ref{funct:unur_hinv_eval_approxinvcdf,unur_hinv_eval_approxinvcdf} +@item @ref{funct:unur_hinv_chg_truncated,unur_hinv_chg_truncated} +@item @ref{funct:unur_hinv_estimate_error,unur_hinv_estimate_error} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_hinv_new} +@deftypefn Function {UNUR_PAR*} unur_hinv_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hinv_new} +@deftypefn {} {UNUR_PAR*} unur_hinv_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hinv_set_order} +@deftypefn Function {int} unur_hinv_set_order (UNUR_PAR* @var{parameters}, int @var{order}) +Set order of Hermite interpolation. Valid orders are +@code{1}, @code{3}, and @code{5}. +Notice that @var{order} greater than @code{1} requires the density +of the distribution, and @var{order} greater than @code{3} even +requires the derivative of the density. Using @var{order} @code{1} +results for most distributions in a huge number of intervals +and is therefore not recommended. If the maximal error in +u-direction is very small (say smaller than @code{1.e-10}), +@var{order} @code{5} is recommended as it leads to considerably +fewer design points, as long there are no poles or heavy tails. + +@emph{Remark:} When the target distribution has poles or (very) heavy +tails @var{order} @code{5} (i.e., quintic interpolation) is +numerically less stable and more sensitive to round-off errors than +@var{order} @code{3} (i.e., cubic interpolation). + +Default is @code{3} if the density is given and @code{1} otherwise. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hinv_set_order} +@deftypefn {} {int} unur_hinv_set_order (UNUR_PAR* @var{parameters}, int @var{order}) +Set order of Hermite interpolation. Valid orders are +@code{1}, @code{3}, and @code{5}. +Notice that @var{order} greater than @code{1} requires the density +of the distribution, and @var{order} greater than @code{3} even +requires the derivative of the density. Using @var{order} @code{1} +results for most distributions in a huge number of intervals +and is therefore not recommended. If the maximal error in +u-direction is very small (say smaller than @code{1.e-10}), +@var{order} @code{5} is recommended as it leads to considerably +fewer design points, as long there are no poles or heavy tails. + +@emph{Remark:} When the target distribution has poles or (very) heavy +tails @var{order} @code{5} (i.e., quintic interpolation) is +numerically less stable and more sensitive to round-off errors than +@var{order} @code{3} (i.e., cubic interpolation). + +Default is @code{3} if the density is given and @code{1} otherwise. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hinv_set_u_resolution} +@deftypefn Function {int} unur_hinv_set_u_resolution (UNUR_PAR* @var{parameters}, double @var{u_resolution}) +Set maximal error in u-direction. However, the given u-error must not +be smaller than machine epsilon (@code{DBL_EPSILON}) and should not be +too close to this value. As the resolution of most uniform random +number sources is 2^(-32) = @code{2.3e-10}, a value of @code{1.e-10} +leads to an inversion algorithm that could be called exact. For most +simulations slightly bigger values for the maximal error are enough +as well. + +Remark: The u-error might become larger than @var{u_resolution} due +to rescaling of floating point numbers when the domain of the +distribution is truncated by a +@ifhtml +@ref{funct:unur_hinv_chg_truncated,@command{unur_hinv_chg_truncated}} +@end ifhtml +@ifnothtml +@command{unur_hinv_chg_truncated} +@end ifnothtml +call. + +Default is @code{1.e-10}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hinv_set_u_resolution} +@deftypefn {} {int} unur_hinv_set_u_resolution (UNUR_PAR* @var{parameters}, double @var{u_resolution}) +Set maximal error in u-direction. However, the given u-error must not +be smaller than machine epsilon (@code{DBL_EPSILON}) and should not be +too close to this value. As the resolution of most uniform random +number sources is 2^(-32) = @code{2.3e-10}, a value of @code{1.e-10} +leads to an inversion algorithm that could be called exact. For most +simulations slightly bigger values for the maximal error are enough +as well. + +Remark: The u-error might become larger than @var{u_resolution} due +to rescaling of floating point numbers when the domain of the +distribution is truncated by a +@ifhtml +@ref{funct:unur_hinv_chg_truncated,@command{unur_hinv_chg_truncated}} +@end ifhtml +@ifnothtml +@command{unur_hinv_chg_truncated} +@end ifnothtml +call. + +Default is @code{1.e-10}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hinv_set_cpoints} +@deftypefn Function {int} unur_hinv_set_cpoints (UNUR_PAR* @var{parameters}, const @var{double* stp}, int @var{n_stp}) +Set starting construction points (nodes) for Hermite interpolation. + +As the possible maximal error is only estimated in the setup +it may be necessary to set some special design points for +computing the Hermite interpolation to guarantee that the +maximal u-error can not be bigger than desired. We suggest to +include as special design points all local extrema of the density, +all points where the density is not differentiable, and isolated +points inside of the domain with density 0. +If there is an interval with density constant equal to 0 inside of +the given domain of the density, both endpoints of this interval +should be included as special design points. Notice that there is no +necessity to do so. However, if these points are not provided to +the algorithm the approximation error might be larger than the +given u-resolution, or the required number of intervals could be +larger than necessary. + +@emph{Important}: Notice that the given points must be in +increasing order and they must be disjoint. + +@emph{Important}: The boundary point of the computational region +must not be given in this list! +Points outside the boundary of the computational region are ignored. + +Default is for unimodal densities - if known - the mode of the +density, if it is not equal to the border of the domain. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hinv_set_cpoints} +@deftypefn {} {int} unur_hinv_set_cpoints (UNUR_PAR* @var{parameters}, const @var{double* stp}, int @var{n_stp}) +Set starting construction points (nodes) for Hermite interpolation. + +As the possible maximal error is only estimated in the setup +it may be necessary to set some special design points for +computing the Hermite interpolation to guarantee that the +maximal u-error can not be bigger than desired. We suggest to +include as special design points all local extrema of the density, +all points where the density is not differentiable, and isolated +points inside of the domain with density 0. +If there is an interval with density constant equal to 0 inside of +the given domain of the density, both endpoints of this interval +should be included as special design points. Notice that there is no +necessity to do so. However, if these points are not provided to +the algorithm the approximation error might be larger than the +given u-resolution, or the required number of intervals could be +larger than necessary. + +@emph{Important}: Notice that the given points must be in +increasing order and they must be disjoint. + +@emph{Important}: The boundary point of the computational region +must not be given in this list! +Points outside the boundary of the computational region are ignored. + +Default is for unimodal densities - if known - the mode of the +density, if it is not equal to the border of the domain. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hinv_set_boundary} +@deftypefn Function {int} unur_hinv_set_boundary (UNUR_PAR* @var{parameters}, double @var{left}, double @var{right}) +Set the left and right boundary of the computational interval. +Of course @code{+/- UNUR_INFINITY} is not allowed. +If the CDF at @var{left} and @var{right} is not close to the +respective values @code{0.} and @code{1.} then this interval is +increased by a (rather slow) search algorithm. + +@emph{Important}: This call does not change the domain of the +given distribution itself. But it restricts the domain for the +resulting random variates. + +Default is @code{1.e20}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hinv_set_boundary} +@deftypefn {} {int} unur_hinv_set_boundary (UNUR_PAR* @var{parameters}, double @var{left}, double @var{right}) +Set the left and right boundary of the computational interval. +Of course @code{+/- UNUR_INFINITY} is not allowed. +If the CDF at @var{left} and @var{right} is not close to the +respective values @code{0.} and @code{1.} then this interval is +increased by a (rather slow) search algorithm. + +@emph{Important}: This call does not change the domain of the +given distribution itself. But it restricts the domain for the +resulting random variates. + +Default is @code{1.e20}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hinv_set_guidefactor} +@deftypefn Function {int} unur_hinv_set_guidefactor (UNUR_PAR* @var{parameters}, double @var{factor}) +Set factor for relative size of the guide table for indexed search +(see also method DGT @ref{DGT}). It must be greater than or equal +to @code{0}. +When set to @code{0}, then sequential search is used. + +Default is @code{1}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hinv_set_guidefactor} +@deftypefn {} {int} unur_hinv_set_guidefactor (UNUR_PAR* @var{parameters}, double @var{factor}) +Set factor for relative size of the guide table for indexed search +(see also method DGT @ref{DGT}). It must be greater than or equal +to @code{0}. +When set to @code{0}, then sequential search is used. + +Default is @code{1}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hinv_set_max_intervals} +@deftypefn Function {int} unur_hinv_set_max_intervals (UNUR_PAR* @var{parameters}, int @var{max_ivs}) +Set maximum number of intervals. No generator object is created if +the necessary number of intervals for the Hermite interpolation +exceeds @var{max_ivs}. It is used to prevent the algorithm to eat up +all memory for very badly shaped CDFs. + +Default is @code{1000000} (1.e6). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hinv_set_max_intervals} +@deftypefn {} {int} unur_hinv_set_max_intervals (UNUR_PAR* @var{parameters}, int @var{max_ivs}) +Set maximum number of intervals. No generator object is created if +the necessary number of intervals for the Hermite interpolation +exceeds @var{max_ivs}. It is used to prevent the algorithm to eat up +all memory for very badly shaped CDFs. + +Default is @code{1000000} (1.e6). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hinv_get_n_intervals} +@deftypefn Function {int} unur_hinv_get_n_intervals (const @var{UNUR_GEN* generator}) +Get number of nodes (design points) used for Hermite interpolation in +the generator object. The number of intervals is the number of +nodes minus 1. +It returns an error code in case of an error. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hinv_get_n_intervals} +@deftypefn {} {int} unur_hinv_get_n_intervals (const @var{UNUR_GEN* generator}) +Get number of nodes (design points) used for Hermite interpolation in +the generator object. The number of intervals is the number of +nodes minus 1. +It returns an error code in case of an error. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hinv_eval_approxinvcdf} +@deftypefn Function {double} unur_hinv_eval_approxinvcdf (const @var{UNUR_GEN* generator}, double @var{u}) +Evaluate Hermite interpolation of inverse CDF at @var{u}. +If @var{u} is out of the domain [0,1] then @code{unur_errno} is set +to @code{UNUR_ERR_DOMAIN} and the respective bound of +the domain of the distribution are returned (which is +@code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of +unbounded domains). + +@emph{Notice}: When the domain has been truncated by a +@ifhtml +@ref{funct:unur_hinv_chg_truncated,@command{unur_hinv_chg_truncated}} +@end ifhtml +@ifnothtml +@command{unur_hinv_chg_truncated} +@end ifnothtml +call then the inverse CDF of the +truncated distribution is returned. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hinv_eval_approxinvcdf} +@deftypefn {} {double} unur_hinv_eval_approxinvcdf (const @var{UNUR_GEN* generator}, double @var{u}) +Evaluate Hermite interpolation of inverse CDF at @var{u}. +If @var{u} is out of the domain [0,1] then @code{unur_errno} is set +to @code{UNUR_ERR_DOMAIN} and the respective bound of +the domain of the distribution are returned (which is +@code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of +unbounded domains). + +@emph{Notice}: When the domain has been truncated by a +@ifhtml +@ref{funct:unur_hinv_chg_truncated,@command{unur_hinv_chg_truncated}} +@end ifhtml +@ifnothtml +@command{unur_hinv_chg_truncated} +@end ifnothtml +call then the inverse CDF of the +truncated distribution is returned. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hinv_chg_truncated} +@deftypefn Function {int} unur_hinv_chg_truncated (UNUR_GEN* @var{generator}, double @var{left}, double @var{right}) +Changes the borders of the domain of the (truncated) distribution. + +Notice that the given truncated domain must be a subset of the +domain of the given distribution. The generator always uses the +intersection of the domain of the distribution and the truncated +domain given by this call. The tables of splines are not recomputed. +Thus it might happen that the relative error for the generated variates +from the truncated distribution is greater than the bound for the +non-truncated distribution. This call also fails when the CDF values +of the boundary points are too close, i.e. when only a few different +floating point numbers would be computed due to round-off errors +with floating point arithmetic. + +Remark: The u-error might become larger than the @var{u_resolution} +given by a +@ifhtml +@ref{funct:unur_hinv_set_u_resolution,@command{unur_hinv_set_u_resolution}} +@end ifhtml +@ifnothtml +@command{unur_hinv_set_u_resolution} +@end ifnothtml +call due to rescaling of +floating point numbers when the domain of the distribution is +truncated. + +When failed an error code is returned. + +@emph{Important}: Always check the return code since the domain is +not changed in case of an error. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hinv_chg_truncated} +@deftypefn {} {int} unur_hinv_chg_truncated (UNUR_GEN* @var{generator}, double @var{left}, double @var{right}) +Changes the borders of the domain of the (truncated) distribution. + +Notice that the given truncated domain must be a subset of the +domain of the given distribution. The generator always uses the +intersection of the domain of the distribution and the truncated +domain given by this call. The tables of splines are not recomputed. +Thus it might happen that the relative error for the generated variates +from the truncated distribution is greater than the bound for the +non-truncated distribution. This call also fails when the CDF values +of the boundary points are too close, i.e. when only a few different +floating point numbers would be computed due to round-off errors +with floating point arithmetic. + +Remark: The u-error might become larger than the @var{u_resolution} +given by a +@ifhtml +@ref{funct:unur_hinv_set_u_resolution,@command{unur_hinv_set_u_resolution}} +@end ifhtml +@ifnothtml +@command{unur_hinv_set_u_resolution} +@end ifnothtml +call due to rescaling of +floating point numbers when the domain of the distribution is +truncated. + +When failed an error code is returned. + +@emph{Important}: Always check the return code since the domain is +not changed in case of an error. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hinv_estimate_error} +@deftypefn Function {int} unur_hinv_estimate_error (const @var{UNUR_GEN* generator}, int @var{samplesize}, double* @var{max_error}, double* @var{MAE}) +Estimate maximal u-error and mean absolute error (MAE) for +@var{generator} by means of a (quasi-) Monte-Carlo simulation with +sample size @var{samplesize}. +The results are stored in @var{max_error} and @var{MAE}, respectively. + +It returns @code{UNUR_SUCCESS} if successful. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hinv_estimate_error} +@deftypefn {} {int} unur_hinv_estimate_error (const @var{UNUR_GEN* generator}, int @var{samplesize}, double* @var{max_error}, double* @var{MAE}) +Estimate maximal u-error and mean absolute error (MAE) for +@var{generator} by means of a (quasi-) Monte-Carlo simulation with +sample size @var{samplesize}. +The results are stored in @var{max_error} and @var{MAE}, respectively. + +It returns @code{UNUR_SUCCESS} if successful. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of hinv.h +@c ------------------------------------- +@c ------------------------------------- +@c hrb.h +@c + +@page +@node HRB +@subsection HRB -- Hazard Rate Bounded + +@table @i +@item Required: +bounded hazard rate +@item Optional: +upper bound for hazard rate +@item Speed: +Set-up: fast, Sampling: slow +@item Reinit: +supported +@item Reference: +@ifhtml +@ref{bib:HLD04,, [HLD04: Sect.9.1.4; Alg.9.4]} +@end ifhtml +@ifnothtml +[HLD04: Sect.9.1.4; Alg.9.4] +@end ifnothtml + +@end table + + +Generates random variate with given hazard rate which must be +bounded from above. It uses the thinning method with a constant +dominating hazard function. + + +@subsubheading How To Use + + +HRB requires a hazard function for a continuous distribution +together with an upper bound. The latter has to be set using the +@ifhtml +@ref{funct:unur_hrb_set_upperbound,@command{unur_hrb_set_upperbound}} +@end ifhtml +@ifnothtml +@command{unur_hrb_set_upperbound} +@end ifnothtml +call. If no such upper bound is given +it is assumed that the upper bound can be achieved by evaluating +the hazard rate at the left hand boundary of the domain of the +distribution. Notice, however, that for decreasing hazard rate +the method HRD (@pxref{HRD,,Hazard Rate Decreasing}) is much +faster and thus the prefered method. + +It is important to note that the domain of the distribution can +be set via a +@ifhtml +@ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_domain} +@end ifnothtml +call. +However, the left border must not be negative. Otherwise it is +set to @code{0}. This is also the default if no domain is +given at all. For computational reasons the right border is +always set to @code{UNUR_INFINITY} independently of the given +domain. Thus for domains bounded from right the function for +computing the hazard rate should return @code{UNUR_INFINITY} +right of this domain. + +For distributions with increasing hazard rate method HRI +(@pxref{HRI,,Hazard Rate Increasing}) is required. + +It is possible to change the parameters and the domain of the chosen +distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator object. +Notice, that the upper bound given by the +@ifhtml +@ref{funct:unur_hrb_set_upperbound,@command{unur_hrb_set_upperbound}} +@end ifhtml +@ifnothtml +@command{unur_hrb_set_upperbound} +@end ifnothtml +call +cannot be changed and must be valid for the changed distribution. + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_hrb_new,unur_hrb_new} +@item @ref{funct:unur_hrb_set_upperbound,unur_hrb_set_upperbound} +@item @ref{funct:unur_hrb_set_verify,unur_hrb_set_verify} +@item @ref{funct:unur_hrb_chg_verify,unur_hrb_chg_verify} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_hrb_new} +@deftypefn Function {UNUR_PAR*} unur_hrb_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hrb_new} +@deftypefn {} {UNUR_PAR*} unur_hrb_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hrb_set_upperbound} +@deftypefn Function {int} unur_hrb_set_upperbound (UNUR_PAR* @var{parameters}, double @var{upperbound}) +Set upper bound for hazard rate. If this call is not used it is +assumed that the the maximum of the hazard rate is achieved at the +left hand boundary of the domain of the distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hrb_set_upperbound} +@deftypefn {} {int} unur_hrb_set_upperbound (UNUR_PAR* @var{parameters}, double @var{upperbound}) +Set upper bound for hazard rate. If this call is not used it is +assumed that the the maximum of the hazard rate is achieved at the +left hand boundary of the domain of the distribution. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hrb_set_verify} +@anchor{funct:unur_hrb_chg_verify} +@deftypefn Function {int} unur_hrb_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx Function {int} unur_hrb_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the hazard rate is not bounded by the given bound, then +@code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hrb_set_verify} +@anchor{funct:unur_hrb_chg_verify} +@deftypefn {} {int} unur_hrb_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx {} {int} unur_hrb_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the hazard rate is not bounded by the given bound, then +@code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of hrb.h +@c ------------------------------------- +@c ------------------------------------- +@c hrd.h +@c + +@page +@node HRD +@subsection HRD -- Hazard Rate Decreasing + +@table @i +@item Required: +decreasing (non-increasing) hazard rate +@item Speed: +Set-up: fast, Sampling: slow +@item Reinit: +supported +@item Reference: +@ifhtml +@ref{bib:HLD04,, [HLD04: Sect.9.1.5; Alg.9.5]} +@end ifhtml +@ifnothtml +[HLD04: Sect.9.1.5; Alg.9.5] +@end ifnothtml + +@end table + + +Generates random variate with given non-increasing hazard rate. +It is necessary that the distribution object contains this +hazard rate. Decreasing hazard rate implies that the +corresponding PDF of the distribution has heavier tails than the +exponential distribution (which has constant hazard rate). + + +@subsubheading How To Use + + +HRD requires a hazard function for a continuous distribution +with non-increasing hazard rate. There are no parameters for +this method. + +It is important to note that the domain of the distribution can +be set via a +@ifhtml +@ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_domain} +@end ifnothtml +call. However, only +the left hand boundary is used. For computational reasons the +right hand boundary is always reset to @code{UNUR_INFINITY}. +If no domain is given by the user then the left hand boundary is +set to @code{0}. + +For distributions which do not have decreasing hazard rates but +are bounded from above use method HRB +(@pxref{HRB,,Hazard Rate Bounded}). +For distributions with increasing hazard rate method HRI +(@pxref{HRI,,Hazard Rate Increasing}) is required. + +It is possible to change the parameters and the domain of the chosen +distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator object. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_hrd_new,unur_hrd_new} +@item @ref{funct:unur_hrd_set_verify,unur_hrd_set_verify} +@item @ref{funct:unur_hrd_chg_verify,unur_hrd_chg_verify} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_hrd_new} +@deftypefn Function {UNUR_PAR*} unur_hrd_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hrd_new} +@deftypefn {} {UNUR_PAR*} unur_hrd_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hrd_set_verify} +@anchor{funct:unur_hrd_chg_verify} +@deftypefn Function {int} unur_hrd_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx Function {int} unur_hrd_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the hazard rate is not bounded by the given bound, then +@code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hrd_set_verify} +@anchor{funct:unur_hrd_chg_verify} +@deftypefn {} {int} unur_hrd_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx {} {int} unur_hrd_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the hazard rate is not bounded by the given bound, then +@code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of hrd.h +@c ------------------------------------- +@c ------------------------------------- +@c hri.h +@c + +@page +@node HRI +@subsection HRI -- Hazard Rate Increasing + +@table @i +@item Required: +increasing (non-decreasing) hazard rate +@item Speed: +Set-up: fast, Sampling: slow +@item Reinit: +supported +@item Reference: +@ifhtml +@ref{bib:HLD04,, [HLD04: Sect.9.1.6; Alg.9.6]} +@end ifhtml +@ifnothtml +[HLD04: Sect.9.1.6; Alg.9.6] +@end ifnothtml + +@end table + + +Generates random variate with given non-increasing hazard rate. +It is necessary that the distribution object contains this hazard rate. +Increasing hazard rate implies that the corresponding PDF of the +distribution has heavier tails than the exponential distribution +(which has constant hazard rate). + +The method uses a decomposition of the hazard rate into a main +part which is constant for all @i{x} beyond some point @i{p0} +and a remaining part. From both of these parts points are +sampled using the thinning method and the minimum of both is +returned. Sampling from the first part is easier as we have a +constant dominating hazard rate. Thus @i{p0} should be large. On +the other hand, if @i{p0} is large than the thinning algorithm +needs many iteration. Thus the performance of the the algorithm +deponds on the choice of @i{p0}. We found that values close to +the expectation of the generated distribution result in good +performance. + + +@subsubheading How To Use + + +HRI requires a hazard function for a continuous distribution +with non-decreasing hazard rate. +The parameter @i{p0} should be set to a value close to the +expectation of the required distribution using +@ifhtml +@ref{funct:unur_hri_set_p0,@command{unur_hri_set_p0}.} +@end ifhtml +@ifnothtml +@command{unur_hri_set_p0}. +@end ifnothtml +If performance is crucial one may try other +values as well. + +It is important to note that the domain of the distribution can +be set via a +@ifhtml +@ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_domain} +@end ifnothtml +call. However, only +the left hand boundary is used. For computational reasons the +right hand boundary is always reset to @code{UNUR_INFINITY}. +If no domain is given by the user then the left hand boundary is +set to @code{0}. + +For distributions with decreasing hazard rate method HRD +(@pxref{HRI,,Hazard Rate Decreasing}) is required. +For distributions which do not have increasing or decreasing +hazard rates but are bounded from above use method HRB +(@pxref{HRB,,Hazard Rate Bounded}). + +It is possible to change the parameters and the domain of the chosen +distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator object. + + +Notice, that the upper bound given by the +@ifhtml +@ref{funct:unur_hrb_set_upperbound,@command{unur_hrb_set_upperbound}} +@end ifhtml +@ifnothtml +@command{unur_hrb_set_upperbound} +@end ifnothtml +call +cannot be changed and must be valid for the changed distribution. +Notice that the parameter @i{p0} which has been set by a +@ifhtml +@ref{funct:unur_hri_set_p0,@command{unur_hri_set_p0}} +@end ifhtml +@ifnothtml +@command{unur_hri_set_p0} +@end ifnothtml +call cannot be changed and must be valid for the changed distribution. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_hri_new,unur_hri_new} +@item @ref{funct:unur_hri_set_p0,unur_hri_set_p0} +@item @ref{funct:unur_hri_set_verify,unur_hri_set_verify} +@item @ref{funct:unur_hri_chg_verify,unur_hri_chg_verify} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_hri_new} +@deftypefn Function {UNUR_PAR*} unur_hri_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hri_new} +@deftypefn {} {UNUR_PAR*} unur_hri_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hri_set_p0} +@deftypefn Function {int} unur_hri_set_p0 (UNUR_PAR* @var{parameters}, double @var{p0}) +Set design point for algorithm. It is used to split the domain of the +distribution. Values for @var{p0} close to the expectation of the +distribution results in a relatively good performance of the algorithm. +It is important that the hazard rate at this point must be greater +than @code{0} and less than @code{UNUR_INFINITY}. + +Default: left boundary of domain + @code{1.} +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hri_set_p0} +@deftypefn {} {int} unur_hri_set_p0 (UNUR_PAR* @var{parameters}, double @var{p0}) +Set design point for algorithm. It is used to split the domain of the +distribution. Values for @var{p0} close to the expectation of the +distribution results in a relatively good performance of the algorithm. +It is important that the hazard rate at this point must be greater +than @code{0} and less than @code{UNUR_INFINITY}. + +Default: left boundary of domain + @code{1.} +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hri_set_verify} +@anchor{funct:unur_hri_chg_verify} +@deftypefn Function {int} unur_hri_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx Function {int} unur_hri_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the hazard rate is not bounded by the given bound, then +@code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hri_set_verify} +@anchor{funct:unur_hri_chg_verify} +@deftypefn {} {int} unur_hri_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx {} {int} unur_hri_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the hazard rate is not bounded by the given bound, then +@code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of hri.h +@c ------------------------------------- +@c ------------------------------------- +@c itdr.h +@c + +@page +@node ITDR +@subsection ITDR -- Inverse Transformed Density Rejection + +@table @i +@item Required: +monotone PDF, dPDF, pole +@item Optional: +splitting point between pole and tail region, c-values +@item Speed: +Set-up: moderate, Sampling: moderate +@item Reinit: +supported +@item Reference: +@ifhtml +@ref{bib:HLDa07,, [HLDa07]} +@end ifhtml +@ifnothtml +[HLDa07] +@end ifnothtml + +@end table + + +ITDR is an acceptance/rejection method that works for monotone +densities. It is especially designed for PDFs with a single +pole. It uses different hat functions for the pole region and +for the tail region. For the tail region @emph{Transformed Density +Rejection} with a single construction point is used. +For the pole region a variant called @emph{Inverse Transformed +Density Rejection} is used. The optimal splitting point between +the two regions and the respective maximum local concavity and +inverse local concavity (@pxref{Glossary}) that guarantee valid +hat functions for each regions are estimated. +This splitting point is set to the intersection point of local +concavity and inverse local concavity. +However, it is assumed that both, the local concavity and the +inverse local concavity do not have a local minimum in the +interior of the domain (which is the case for all standard +distributions with a single pole). +In other cases (or when the built-in search routines do not +compute non-optimal values) one can provide the splitting point, +and the @i{c}-values. + + +@subsubheading How To Use + + +Method ITDR requires a distribution object with given PDF +and its derivative and the location of the pole (or mode). +The PDF must be monotone and may contain a pole. +It must be set via the +@ifhtml +@ref{funct:unur_distr_cont_set_pdf,@command{unur_distr_cont_set_pdf}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdf} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_distr_cont_set_dpdf,@command{unur_distr_cont_set_dpdf}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_dpdf} +@end ifnothtml +calls. The PDF should return +UNUR_INFINITY for the pole. Alternatively, one can also +set the logarithm of the PDF and its derivative via the +@ifhtml +@ref{funct:unur_distr_cont_set_logpdf,@command{unur_distr_cont_set_logpdf}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_logpdf} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_distr_cont_set_dlogpdf,@command{unur_distr_cont_set_dlogpdf}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_dlogpdf} +@end ifnothtml +calls. This is in especially useful since then the setup and +search routines are numerically more stable. Moreover, for many +distributions computing the logarithm of the PDF is less +expensive then computing the PDF directly. + +The pole of the distribution is given by a +@ifhtml +@ref{funct:unur_distr_cont_set_mode,@command{unur_distr_cont_set_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_mode} +@end ifnothtml +call. Notice that distributions with +``heavy'' poles may have numerical problems caused by the +resultion of the floating point numbers used by computers. +While the minimal distance between two different floating point +numbers is about @code{1.e-320} near @code{0.} it increases +to @code{1.e-16} near @code{1.} Thus any random variate +generator implemented on a digital computer in fact draws samples +from a discrete distribution that approximates the desired +continuous distribution. For distributions with ``heavy'' poles +not at 0 this approximation may be too crude and thus every +goodness-of-fit test will fail. +Besides this theoretic problem that cannot be resolved we +have to take into consideration that round-off errors occur more +frequently when we have PDFs with poles far away from +@code{0.} Method ITDR tries to handles this situation as good as +possible by moving the pole into @code{0.} +Thus do not use a wrapper for your PDF that hides this shift +since the information about the resolution of the floating point +numbers near the pole gets lost. + +Method ITDR uses different hats for the pole region and for the +tail region. The splitting point between these two regions, the +optimal @i{c}-value and design points for constructing the hats +using Transformed Density Rejection are computed automatically. +(The results of these computations can be read using the +respective calls +@ifhtml +@ref{funct:unur_itdr_get_xi,@command{unur_itdr_get_xi},} +@end ifhtml +@ifnothtml +@command{unur_itdr_get_xi}, +@end ifnothtml +@ifhtml +@ref{funct:unur_itdr_get_cp,@command{unur_itdr_get_cp}} +@end ifhtml +@ifnothtml +@command{unur_itdr_get_cp} +@end ifnothtml +, and +@ifhtml +@ref{funct:unur_itdr_get_ct,@command{unur_itdr_get_ct}} +@end ifhtml +@ifnothtml +@command{unur_itdr_get_ct} +@end ifnothtml +for the intersection point between local +concavity and inverse local concavity, the @i{c}-value for the +pole and the tail region.) +However, one can also analyze the local concavity and inverse +local concavity set the corresponding values using +@ifhtml +@ref{funct:unur_itdr_set_xi,@command{unur_itdr_set_xi},} +@end ifhtml +@ifnothtml +@command{unur_itdr_set_xi}, +@end ifnothtml +@ifhtml +@ref{funct:unur_itdr_set_cp,@command{unur_itdr_set_cp}} +@end ifhtml +@ifnothtml +@command{unur_itdr_set_cp} +@end ifnothtml +, and +@ifhtml +@ref{funct:unur_itdr_set_ct,@command{unur_itdr_set_ct}} +@end ifhtml +@ifnothtml +@command{unur_itdr_set_ct} +@end ifnothtml +calls. +Notice, that @i{c}-values greater than -1/2 can be set to +@code{-0.5}. Although this results in smaller acceptance +probabities sampling from the hat distribution is much faster +than for other values of @i{c}. Depending on the expenses of +evaluating the PDF the resulting algorithm is usually faster. + +It is possible to change the parameters and the domain of the chosen +distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator object. +However, the values given by +@ifhtml +@ref{funct:unur_itdr_set_xi,@command{unur_itdr_set_xi},} +@end ifhtml +@ifnothtml +@command{unur_itdr_set_xi}, +@end ifnothtml +@ifhtml +@ref{funct:unur_itdr_set_cp,@command{unur_itdr_set_cp}} +@end ifhtml +@ifnothtml +@command{unur_itdr_set_cp} +@end ifnothtml +, +or +@ifhtml +@ref{funct:unur_itdr_set_ct,@command{unur_itdr_set_ct}} +@end ifhtml +@ifnothtml +@command{unur_itdr_set_ct} +@end ifnothtml +calls are then ignored when +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +is +called. + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_itdr_new,unur_itdr_new} +@item @ref{funct:unur_itdr_set_xi,unur_itdr_set_xi} +@item @ref{funct:unur_itdr_set_cp,unur_itdr_set_cp} +@item @ref{funct:unur_itdr_set_ct,unur_itdr_set_ct} +@item @ref{funct:unur_itdr_get_xi,unur_itdr_get_xi} +@item @ref{funct:unur_itdr_get_cp,unur_itdr_get_cp} +@item @ref{funct:unur_itdr_get_ct,unur_itdr_get_ct} +@item @ref{funct:unur_itdr_get_area,unur_itdr_get_area} +@item @ref{funct:unur_itdr_set_verify,unur_itdr_set_verify} +@item @ref{funct:unur_itdr_chg_verify,unur_itdr_chg_verify} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_itdr_new} +@deftypefn Function {UNUR_PAR*} unur_itdr_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_itdr_new} +@deftypefn {} {UNUR_PAR*} unur_itdr_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_itdr_set_xi} +@deftypefn Function {int} unur_itdr_set_xi (UNUR_PAR* @var{parameters}, double @var{xi}) +Sets points where local concavity and inverse local concavity +are (almost) equal. It is used to estimate the respective c-values +for pole region and hat regions and to determine the splitting point @i{bx} +between pole and tail region. +If no such point is provided it will be computed automatically. + +Default: not set. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_itdr_set_xi} +@deftypefn {} {int} unur_itdr_set_xi (UNUR_PAR* @var{parameters}, double @var{xi}) +Sets points where local concavity and inverse local concavity +are (almost) equal. It is used to estimate the respective c-values +for pole region and hat regions and to determine the splitting point @i{bx} +between pole and tail region. +If no such point is provided it will be computed automatically. + +Default: not set. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_itdr_set_cp} +@deftypefn Function {int} unur_itdr_set_cp (UNUR_PAR* @var{parameters}, double @var{cp}) +Sets parameter @var{cp} for transformation T for inverse +density in pole region. +It must be at most 0 and greater than -1. +A value of @code{-0.5} is treated separately and usually results in +faster marginal generation time (at the expense of smaller +acceptance probabilities. +If no @var{cp}-value is given it is estimated automatically. + +Default: not set. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_itdr_set_cp} +@deftypefn {} {int} unur_itdr_set_cp (UNUR_PAR* @var{parameters}, double @var{cp}) +Sets parameter @var{cp} for transformation T for inverse +density in pole region. +It must be at most 0 and greater than -1. +A value of @code{-0.5} is treated separately and usually results in +faster marginal generation time (at the expense of smaller +acceptance probabilities. +If no @var{cp}-value is given it is estimated automatically. + +Default: not set. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_itdr_set_ct} +@deftypefn Function {int} unur_itdr_set_ct (UNUR_PAR* @var{parameters}, double @var{ct}) +Sets parameter @var{ct} for transformation T for +density in tail region. +It must be at most 0. For densities with unbounded domain +it must be greater than -1. +A value of @code{-0.5} is treated separately and usually results in +faster marginal generation time (at the expense of smaller +acceptance probabilities. +If no @var{ct}-value is given it is estimated automatically. + +Default: not set. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_itdr_set_ct} +@deftypefn {} {int} unur_itdr_set_ct (UNUR_PAR* @var{parameters}, double @var{ct}) +Sets parameter @var{ct} for transformation T for +density in tail region. +It must be at most 0. For densities with unbounded domain +it must be greater than -1. +A value of @code{-0.5} is treated separately and usually results in +faster marginal generation time (at the expense of smaller +acceptance probabilities. +If no @var{ct}-value is given it is estimated automatically. + +Default: not set. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_itdr_get_xi} +@anchor{funct:unur_itdr_get_cp} +@anchor{funct:unur_itdr_get_ct} +@deftypefn Function {double} unur_itdr_get_xi (UNUR_GEN* @var{generator}) +@deftypefnx Function {double} unur_itdr_get_cp (UNUR_GEN* @var{generator}) +@deftypefnx Function {double} unur_itdr_get_ct (UNUR_GEN* @var{generator}) +Get intersection point @var{xi}, and c-values @var{cp} and @var{ct}, +respectively. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_itdr_get_xi} +@anchor{funct:unur_itdr_get_cp} +@anchor{funct:unur_itdr_get_ct} +@deftypefn {} {double} unur_itdr_get_xi (UNUR_GEN* @var{generator}) +@deftypefnx {} {double} unur_itdr_get_cp (UNUR_GEN* @var{generator}) +@deftypefnx {} {double} unur_itdr_get_ct (UNUR_GEN* @var{generator}) +Get intersection point @var{xi}, and c-values @var{cp} and @var{ct}, +respectively. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_itdr_get_area} +@deftypefn Function {double} unur_itdr_get_area (UNUR_GEN* @var{generator}) +Get area below hat. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_itdr_get_area} +@deftypefn {} {double} unur_itdr_get_area (UNUR_GEN* @var{generator}) +Get area below hat. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_itdr_set_verify} +@deftypefn Function {int} unur_itdr_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. + +If the condition +@math{PDF(x) <= hat(x)} +is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However, notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_itdr_set_verify} +@deftypefn {} {int} unur_itdr_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. + +If the condition +@iftex +@math{PDF(x) \leq hat(x)} +@end iftex +@ifhtml +@html +PDF(x) <= hat(x) +@end html +@end ifhtml +is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However, notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_itdr_chg_verify} +@deftypefn Function {int} unur_itdr_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Change the verifying of algorithm while sampling on/off. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_itdr_chg_verify} +@deftypefn {} {int} unur_itdr_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Change the verifying of algorithm while sampling on/off. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of itdr.h +@c ------------------------------------- +@c ------------------------------------- +@c ninv.h +@c + +@page +@node NINV +@subsection NINV -- Numerical INVersion + +@table @i +@item Required: +CDF +@item Optional: +PDF +@item Speed: +Set-up: optional, Sampling: (very) slow +@item Reinit: +supported +@end table + + +NINV implementations of some methods for numerical inversion: +Newton's method, regula falsi (combined with interval +bisectioning), and bisection method. +Regula falsi and bisection method require only the CDF while +Newton's method also requires the PDF. +To speed up marginal generation times a table with suitable +starting points can be created during the setup. +The performance of the algorithm can adjusted by the desired +accuracy of the method. +It is possible to use this method for generating from truncated +distributions. The truncated domain can be changed for an +existing generator object. + + +@subsubheading How To Use + + +Method NINV generates random variates by numerical +inversion and requires a continuous univariate distribution +objects with given CDF. Three variants are available: + +@itemize @minus +@item Regula falsi [default] +@item Newton's method +@item Interval bisectioning +@end itemize + +Newton's method additionally requires the PDF of the +distribution and cannot be used otherwise (NINV automatically +switches to regula falsi then). +Default algorithm is regula falsi. It is slightly slower but +numerically much more stable than Newton's algorithm. +Interval bisectioning is the slowest method and should only be +considered as a last resort when the other methods fails. + +It is possible to draw samples from truncated distributions. +The truncated domain can even be changed for an existing generator +object by an +@ifhtml +@ref{funct:unur_ninv_chg_truncated,@command{unur_ninv_chg_truncated}} +@end ifhtml +@ifnothtml +@command{unur_ninv_chg_truncated} +@end ifnothtml +call. + +Marginal generation times can be sped up by means of a table +with suitable starting points which can be created during the +setup. Using such a table can be switched on by means of a +@ifhtml +@ref{funct:unur_ninv_set_table,@command{unur_ninv_set_table}} +@end ifhtml +@ifnothtml +@command{unur_ninv_set_table} +@end ifnothtml +call where the table size is given as a +parameter. The table is still useful when the (truncated) domain +is changed often, since it is computed for the +domain of the given distribution. (It is not possible to enlarge +this domain.) If it is necessary to recalculate the table during +sampling, the command +@ifhtml +@ref{funct:unur_ninv_chg_table,@command{unur_ninv_chg_table}} +@end ifhtml +@ifnothtml +@command{unur_ninv_chg_table} +@end ifnothtml +can be used. +As a rule of thumb using such a table is appropriate when the +number of generated points exceeds the table size by a factor of +100. + +The default number of iterations of NINV should be enough for all +reasonable cases. Nevertheless, it is possible to adjust the maximal +number of iterations with the commands +@ifhtml +@ref{funct:unur_ninv_set_max_iter,@command{unur_ninv_set_max_iter}} +@end ifhtml +@ifnothtml +@command{unur_ninv_set_max_iter} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_ninv_chg_max_iter,@command{unur_ninv_chg_max_iter}.} +@end ifhtml +@ifnothtml +@command{unur_ninv_chg_max_iter}. +@end ifnothtml +In particular this might be necessary when the PDF has a pole or +the distribution has extremely heavy tails. + +It is also possible to set/change the accuracy of the method +(which also heavily influencies the generation time). +We use two measures for the approximation error which can be +used independently: x-error and u-error +(@pxref{Inversion} for more details). +It is possible to set the maximal tolerated error using +with +@ifhtml +@ref{funct:unur_ninv_set_x_resolution,@command{unur_ninv_set_x_resolution}} +@end ifhtml +@ifnothtml +@command{unur_ninv_set_x_resolution} +@end ifnothtml +and +with +@ifhtml +@ref{funct:unur_ninv_set_u_resolution,@command{unur_ninv_set_u_resolution},} +@end ifhtml +@ifnothtml +@command{unur_ninv_set_u_resolution}, +@end ifnothtml +resp., and change it with the +respective calls +@ifhtml +@ref{funct:unur_ninv_chg_x_resolution,@command{unur_ninv_chg_x_resolution}} +@end ifhtml +@ifnothtml +@command{unur_ninv_chg_x_resolution} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_ninv_chg_x_resolution,@command{unur_ninv_chg_x_resolution}.} +@end ifhtml +@ifnothtml +@command{unur_ninv_chg_x_resolution}. +@end ifnothtml +The algorithm tries to satisfy @emph{both} accuracy goals (and +raises an error flag it this fails). +One of these accuracy checks can be disabled by setting the +accuracy goal to a negative value. + +NINV tries to use proper starting values for both the regula +falsi and bisection method, and for Newton's method. Of course +the user might have more knowledge about the properties of the +target distribution and is able to share his wisdom with NINV +using the respective commands +@ifhtml +@ref{funct:unur_ninv_set_start,@command{unur_ninv_set_start}} +@end ifhtml +@ifnothtml +@command{unur_ninv_set_start} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_ninv_chg_start,@command{unur_ninv_chg_start}.} +@end ifhtml +@ifnothtml +@command{unur_ninv_chg_start}. +@end ifnothtml +It is possible to change the parameters and the domain of the chosen +distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator object. +The values given by the last +@ifhtml +@ref{funct:unur_ninv_chg_truncated,@command{unur_ninv_chg_truncated}} +@end ifhtml +@ifnothtml +@command{unur_ninv_chg_truncated} +@end ifnothtml +call will be +then changed to the values of the domain of the underlying distribution +object. It is important to note that for a distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}) +the normalization constant has to be updated using the +@ifhtml +@ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_upd_pdfarea} +@end ifnothtml +call whenever its parameters have been +changed by means of a +@ifhtml +@ref{funct:unur_distr_cont_set_pdfparams,@command{unur_distr_cont_set_pdfparams}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdfparams} +@end ifnothtml +call. + +It might happen that NINV aborts +@ifhtml +@ref{funct:unur_sample_cont,@command{unur_sample_cont}} +@end ifhtml +@ifnothtml +@command{unur_sample_cont} +@end ifnothtml +without +computing the correct value (because the maximal number +iterations has been exceeded). Then the last approximate value +for @i{x} is returned (with might be fairly false) and +@code{unur_error} is set to @code{UNUR_ERR_GEN_SAMPLING}. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_ninv_new,unur_ninv_new} +@item @ref{funct:unur_ninv_set_useregula,unur_ninv_set_useregula} +@item @ref{funct:unur_ninv_set_usenewton,unur_ninv_set_usenewton} +@item @ref{funct:unur_ninv_set_usebisect,unur_ninv_set_usebisect} +@item @ref{funct:unur_ninv_set_max_iter,unur_ninv_set_max_iter} +@item @ref{funct:unur_ninv_chg_max_iter,unur_ninv_chg_max_iter} +@item @ref{funct:unur_ninv_set_x_resolution,unur_ninv_set_x_resolution} +@item @ref{funct:unur_ninv_chg_x_resolution,unur_ninv_chg_x_resolution} +@item @ref{funct:unur_ninv_set_u_resolution,unur_ninv_set_u_resolution} +@item @ref{funct:unur_ninv_chg_u_resolution,unur_ninv_chg_u_resolution} +@item @ref{funct:unur_ninv_set_start,unur_ninv_set_start} +@item @ref{funct:unur_ninv_chg_start,unur_ninv_chg_start} +@item @ref{funct:unur_ninv_set_table,unur_ninv_set_table} +@item @ref{funct:unur_ninv_chg_table,unur_ninv_chg_table} +@item @ref{funct:unur_ninv_chg_truncated,unur_ninv_chg_truncated} +@item @ref{funct:unur_ninv_eval_approxinvcdf,unur_ninv_eval_approxinvcdf} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_ninv_new} +@deftypefn Function {UNUR_PAR*} unur_ninv_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ninv_new} +@deftypefn {} {UNUR_PAR*} unur_ninv_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ninv_set_useregula} +@deftypefn Function {int} unur_ninv_set_useregula (UNUR_PAR* @var{parameters}) +Switch to regula falsi combined with interval bisectioning. +(This the default.) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ninv_set_useregula} +@deftypefn {} {int} unur_ninv_set_useregula (UNUR_PAR* @var{parameters}) +Switch to regula falsi combined with interval bisectioning. +(This the default.) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ninv_set_usenewton} +@deftypefn Function {int} unur_ninv_set_usenewton (UNUR_PAR* @var{parameters}) +Switch to Newton's method. +Notice that it is numerically less stable than regula falsi. +It it is not possible to invert the CDF for a particular uniform random +number @i{U} when calling +@ifhtml +@ref{funct:unur_sample_cont,@command{unur_sample_cont},} +@end ifhtml +@ifnothtml +@command{unur_sample_cont}, +@end ifnothtml +@code{unur_error} is set +to @code{UNUR_ERR_GEN_SAMPLING}. +Thus it is recommended to check @code{unur_error} before +using the result of the sampling routine. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ninv_set_usenewton} +@deftypefn {} {int} unur_ninv_set_usenewton (UNUR_PAR* @var{parameters}) +Switch to Newton's method. +Notice that it is numerically less stable than regula falsi. +It it is not possible to invert the CDF for a particular uniform random +number @i{U} when calling +@ifhtml +@ref{funct:unur_sample_cont,@command{unur_sample_cont},} +@end ifhtml +@ifnothtml +@command{unur_sample_cont}, +@end ifnothtml +@code{unur_error} is set +to @code{UNUR_ERR_GEN_SAMPLING}. +Thus it is recommended to check @code{unur_error} before +using the result of the sampling routine. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ninv_set_usebisect} +@deftypefn Function {int} unur_ninv_set_usebisect (UNUR_PAR* @var{parameters}) +Switch to bisection method. This is a slow algorithm and should +only be used as a last resort. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ninv_set_usebisect} +@deftypefn {} {int} unur_ninv_set_usebisect (UNUR_PAR* @var{parameters}) +Switch to bisection method. This is a slow algorithm and should +only be used as a last resort. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ninv_set_max_iter} +@anchor{funct:unur_ninv_chg_max_iter} +@deftypefn Function {int} unur_ninv_set_max_iter (UNUR_PAR* @var{parameters}, int @var{max_iter}) +@deftypefnx Function {int} unur_ninv_chg_max_iter (UNUR_GEN* @var{generator}, int @var{max_iter}) +Set and change number of maximal iterations. +Default is @code{100}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ninv_set_max_iter} +@anchor{funct:unur_ninv_chg_max_iter} +@deftypefn {} {int} unur_ninv_set_max_iter (UNUR_PAR* @var{parameters}, int @var{max_iter}) +@deftypefnx {} {int} unur_ninv_chg_max_iter (UNUR_GEN* @var{generator}, int @var{max_iter}) +Set and change number of maximal iterations. +Default is @code{100}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ninv_set_x_resolution} +@anchor{funct:unur_ninv_chg_x_resolution} +@deftypefn Function {int} unur_ninv_set_x_resolution (UNUR_PAR* @var{parameters}, double @var{x_resolution}) +@deftypefnx Function {int} unur_ninv_chg_x_resolution (UNUR_GEN* @var{generator}, double @var{x_resolution}) +Set and change the maximal tolerated relative x-error. +If @var{x_resolution} is negative then checking of the x-error is +disabled. + +Default is @code{1.e-8}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ninv_set_x_resolution} +@anchor{funct:unur_ninv_chg_x_resolution} +@deftypefn {} {int} unur_ninv_set_x_resolution (UNUR_PAR* @var{parameters}, double @var{x_resolution}) +@deftypefnx {} {int} unur_ninv_chg_x_resolution (UNUR_GEN* @var{generator}, double @var{x_resolution}) +Set and change the maximal tolerated relative x-error. +If @var{x_resolution} is negative then checking of the x-error is +disabled. + +Default is @code{1.e-8}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ninv_set_u_resolution} +@anchor{funct:unur_ninv_chg_u_resolution} +@deftypefn Function {int} unur_ninv_set_u_resolution (UNUR_PAR* @var{parameters}, double @var{u_resolution}) +@deftypefnx Function {int} unur_ninv_chg_u_resolution (UNUR_GEN* @var{generator}, double @var{u_resolution}) +Set and change the maximal tolerated (abolute) u-error. +If @var{u_resolution} is negative then checking of the u-error is +disabled. + +Default is @code{-1} (disabled). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ninv_set_u_resolution} +@anchor{funct:unur_ninv_chg_u_resolution} +@deftypefn {} {int} unur_ninv_set_u_resolution (UNUR_PAR* @var{parameters}, double @var{u_resolution}) +@deftypefnx {} {int} unur_ninv_chg_u_resolution (UNUR_GEN* @var{generator}, double @var{u_resolution}) +Set and change the maximal tolerated (abolute) u-error. +If @var{u_resolution} is negative then checking of the u-error is +disabled. + +Default is @code{-1} (disabled). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ninv_set_start} +@deftypefn Function {int} unur_ninv_set_start (UNUR_PAR* @var{parameters}, double @var{left}, double @var{right}) +Set starting points. +If not set, suitable values are chosen automatically. + +@multitable @columnfractions 0.2 0.2 0.6 +@item Newton: @tab @var{left}: @tab starting point +@item Regula falsi: @tab @var{left}, @var{right}: @tab boundary of starting interval +@end multitable + +If the starting points are not set then the follwing points are used by +default: +@multitable @columnfractions 0.2 0.2 0.6 +@item Newton: @tab @var{left}: @tab CDF(@var{left}) = 0.5 +@item Regula falsi: @tab @var{left}: @tab CDF(@var{left}) = 0.1 +@item @tab @var{right}: @tab CDF(@var{right}) = 0.9 +@end multitable + +If @var{left} == @var{right}, then UNU.RAN always uses the default +starting points! +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ninv_set_start} +@deftypefn {} {int} unur_ninv_set_start (UNUR_PAR* @var{parameters}, double @var{left}, double @var{right}) +Set starting points. +If not set, suitable values are chosen automatically. + +@multitable @columnfractions 0.2 0.2 0.6 +@item Newton: @tab @var{left}: @tab starting point +@item Regula falsi: @tab @var{left}, @var{right}: @tab boundary of starting interval +@end multitable + +If the starting points are not set then the follwing points are used by +default: +@multitable @columnfractions 0.2 0.2 0.6 +@item Newton: @tab @var{left}: @tab CDF(@var{left}) = 0.5 +@item Regula falsi: @tab @var{left}: @tab CDF(@var{left}) = 0.1 +@item @tab @var{right}: @tab CDF(@var{right}) = 0.9 +@end multitable + +If @var{left} == @var{right}, then UNU.RAN always uses the default +starting points! +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ninv_chg_start} +@deftypefn Function {int} unur_ninv_chg_start (UNUR_GEN* @var{gen}, double @var{left}, double @var{right}) +Change the starting points for numerical inversion. +If left==right, then UNU.RAN uses the default starting points +(see +@ifhtml +@ref{funct:unur_ninv_set_start,@command{unur_ninv_set_start}} +@end ifhtml +@ifnothtml +@command{unur_ninv_set_start} +@end ifnothtml +). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ninv_chg_start} +@deftypefn {} {int} unur_ninv_chg_start (UNUR_GEN* @var{gen}, double @var{left}, double @var{right}) +Change the starting points for numerical inversion. +If left==right, then UNU.RAN uses the default starting points +(see +@ifhtml +@ref{funct:unur_ninv_set_start,@command{unur_ninv_set_start}} +@end ifhtml +@ifnothtml +@command{unur_ninv_set_start} +@end ifnothtml +). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ninv_set_table} +@deftypefn Function {int} unur_ninv_set_table (UNUR_PAR* @var{parameters}, int @var{no_of_points}) +Generates a table with @var{no_of_points} points containing +suitable starting values for the iteration. The value of +@var{no_of_points} must be at least 10 (otherwise it will be set +to 10 automatically). + +The table points are chosen such that the CDF at these points +form an equidistance sequence in the interval (0,1). + +If a table is used, then the starting points given by +@ifhtml +@ref{funct:unur_ninv_set_start,@command{unur_ninv_set_start}} +@end ifhtml +@ifnothtml +@command{unur_ninv_set_start} +@end ifnothtml +are ignored. + +No table is used by default. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ninv_set_table} +@deftypefn {} {int} unur_ninv_set_table (UNUR_PAR* @var{parameters}, int @var{no_of_points}) +Generates a table with @var{no_of_points} points containing +suitable starting values for the iteration. The value of +@var{no_of_points} must be at least 10 (otherwise it will be set +to 10 automatically). + +The table points are chosen such that the CDF at these points +form an equidistance sequence in the interval (0,1). + +If a table is used, then the starting points given by +@ifhtml +@ref{funct:unur_ninv_set_start,@command{unur_ninv_set_start}} +@end ifhtml +@ifnothtml +@command{unur_ninv_set_start} +@end ifnothtml +are ignored. + +No table is used by default. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ninv_chg_table} +@deftypefn Function {int} unur_ninv_chg_table (UNUR_GEN* @var{gen}, int @var{no_of_points}) +Recomputes a table as described in +@ifhtml +@ref{funct:unur_ninv_set_table,@command{unur_ninv_set_table}.} +@end ifhtml +@ifnothtml +@command{unur_ninv_set_table}. +@end ifnothtml +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ninv_chg_table} +@deftypefn {} {int} unur_ninv_chg_table (UNUR_GEN* @var{gen}, int @var{no_of_points}) +Recomputes a table as described in +@ifhtml +@ref{funct:unur_ninv_set_table,@command{unur_ninv_set_table}.} +@end ifhtml +@ifnothtml +@command{unur_ninv_set_table}. +@end ifnothtml +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ninv_chg_truncated} +@deftypefn Function {int} unur_ninv_chg_truncated (UNUR_GEN* @var{gen}, double @var{left}, double @var{right}) +Changes the borders of the domain of the (truncated) distribution. + +Notice that the given truncated domain must be a subset of the +domain of the given distribution. The generator always uses the +intersection of the domain of the distribution and the truncated +domain given by this call. +Moreover the starting point(s) will not be changed. + +@emph{Important:} If the CDF is (almost) the same for @var{left} and +@var{right} and (almost) equal to @code{0} or @code{1}, then the truncated +domain is @emph{not} chanced and the call returns an error code. + +@emph{Notice:} If the parameters of the distribution has been changed by a +@ifhtml +@ref{funct:unur_distr_cont_set_pdfparams,@command{unur_distr_cont_set_pdfparams}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdfparams} +@end ifnothtml +call it is recommended to set the +truncated domain again, since the former call might change the +domain of the distribution but not update the values for the +boundaries of the truncated distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ninv_chg_truncated} +@deftypefn {} {int} unur_ninv_chg_truncated (UNUR_GEN* @var{gen}, double @var{left}, double @var{right}) +Changes the borders of the domain of the (truncated) distribution. + +Notice that the given truncated domain must be a subset of the +domain of the given distribution. The generator always uses the +intersection of the domain of the distribution and the truncated +domain given by this call. +Moreover the starting point(s) will not be changed. + +@emph{Important:} If the CDF is (almost) the same for @var{left} and +@var{right} and (almost) equal to @code{0} or @code{1}, then the truncated +domain is @emph{not} chanced and the call returns an error code. + +@emph{Notice:} If the parameters of the distribution has been changed by a +@ifhtml +@ref{funct:unur_distr_cont_set_pdfparams,@command{unur_distr_cont_set_pdfparams}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_pdfparams} +@end ifnothtml +call it is recommended to set the +truncated domain again, since the former call might change the +domain of the distribution but not update the values for the +boundaries of the truncated distribution. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ninv_eval_approxinvcdf} +@deftypefn Function {double} unur_ninv_eval_approxinvcdf (const @var{UNUR_GEN* generator}, double @var{u}) +Get approximate approximate value of inverse CDF at @var{u}. +If @var{u} is out of the domain [0,1] then @code{unur_errno} is set +to @code{UNUR_ERR_DOMAIN} and the respective bound of +the domain of the distribution are returned (which is +@code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of +unbounded domains). + +@emph{Notice}: This function always evaluates the inverse CDF of +the given distribution. A call to +@ifhtml +@ref{funct:unur_ninv_chg_truncated,@command{unur_ninv_chg_truncated}} +@end ifhtml +@ifnothtml +@command{unur_ninv_chg_truncated} +@end ifnothtml +call +has no effect. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ninv_eval_approxinvcdf} +@deftypefn {} {double} unur_ninv_eval_approxinvcdf (const @var{UNUR_GEN* generator}, double @var{u}) +Get approximate approximate value of inverse CDF at @var{u}. +If @var{u} is out of the domain [0,1] then @code{unur_errno} is set +to @code{UNUR_ERR_DOMAIN} and the respective bound of +the domain of the distribution are returned (which is +@code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of +unbounded domains). + +@emph{Notice}: This function always evaluates the inverse CDF of +the given distribution. A call to +@ifhtml +@ref{funct:unur_ninv_chg_truncated,@command{unur_ninv_chg_truncated}} +@end ifhtml +@ifnothtml +@command{unur_ninv_chg_truncated} +@end ifnothtml +call +has no effect. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of ninv.h +@c ------------------------------------- +@c ------------------------------------- +@c nrou.h +@c + +@page +@node NROU +@subsection NROU -- Naive Ratio-Of-Uniforms method + +@table @i +@item Required: +PDF +@item Optional: +mode, center, bounding rectangle for acceptance region +@item Speed: +Set-up: slow or fast, Sampling: moderate +@item Reinit: +supported +@item Reference: +@ifhtml +@ref{bib:HLD04,, [HLD04: Sect.2.4 and Sect.6.4]} +@end ifhtml +@ifnothtml +[HLD04: Sect.2.4 and Sect.6.4] +@end ifnothtml + +@end table + + +NROU is an implementation of the (generalized) ratio-of-uniforms +method which uses (minimal) bounding rectangles, see +@ref{Ratio-of-Uniforms}. It uses a positive control parameter +@i{r} for adjusting the algorithm to the given distribution to +improve performance and/or to make this method applicable. +Larger values of @i{r} increase the class of distributions +for which the method works at the expense of a higher rejection +constant. For computational reasons @i{r=1} should be used if +possible (this is the default). +Moreover, this implementation uses the center +@iftex +@math{\mu} +@end iftex +@ifhtml +@html +mu +@end html +@end ifhtml +@ifinfo +@math{mu} +@end ifinfo +of +the distribution (see +@ifhtml +@ref{funct:unur_distr_cont_get_center,@command{unur_distr_cont_get_center}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_get_center} +@end ifnothtml +for +details of its default values). + +For the special case with +@iftex +@math{r=1} +@end iftex +@ifhtml +@html +r=1 +@end html +@end ifhtml +@ifinfo +@math{r=1} +@end ifinfo +the coordinates of the +minimal bounding rectangles are given by +@iftex + +@quotation +@math{ v^+ = \sup\limits_{x} \sqrt{PDF(x)}, \hfil\break u^- = \inf\limits_{x} (x-\mu) \sqrt{PDF(x)}, \hfil\break u^+ = \sup\limits_{x} (x-\mu) \sqrt{PDF(x)}, } +@end quotation + +@end iftex +@ifhtml +@quotation +@html +v+ = sup_x sqrt(PDF(x)), @*u- = inf_x (x- mu) sqrt(PDF(x)), @*u+ = sup_x (x- mu) sqrt(PDF(x)), +@end html +@end quotation +@end ifhtml +@ifinfo +@quotation +@math{v^+ = sup_(x) sqrt(PDF(x)), @*u^- = inf_(x) (x- mu) sqrt(PDF(x)), @*u^+ = sup_(x) (x- mu) sqrt(PDF(x)),} +@end quotation +@end ifinfo + +@noindent +where +@iftex +@math{\mu} +@end iftex +@ifhtml +@html +mu +@end html +@end ifhtml +@ifinfo +@math{mu} +@end ifinfo +is the center of the distribution. +For other values of @i{r} we have +@iftex + +@quotation +@math{ v^+ = \sup\limits_{x} (PDF(x))^{1/(r+1)}, \hfil\break u^- = \inf\limits_{x} (x-\mu) (PDF(x))^{r/(r+1)}, \hfil\break u^+ = \sup\limits_{x} (x-\mu) (PDF(x))^{r/(r+1)}. } +@end quotation + +@end iftex +@ifhtml +@quotation +@html +v+ = sup_x (PDF(x))1/(r+1), @*u- = inf_x (x- mu) (PDF(x))r/(r+1), @*u+ = sup_x (x- mu) (PDF(x))r/(r+1). +@end html +@end quotation +@end ifhtml +@ifinfo +@quotation +@math{v^+ = sup_(x) (PDF(x))^(1/(r+1)), @*u^- = inf_(x) (x- mu) (PDF(x))^(r/(r+1)), @*u^+ = sup_(x) (x- mu) (PDF(x))^(r/(r+1)).} +@end quotation +@end ifinfo + +@noindent +These bounds can be given directly. Otherwise they are computed +automatically by means of a (slow) numerical routine. +Of course this routine can fail, especially when this rectangle +is not bounded. + +It is important to note that the algorithm works with +@iftex +@math{PDF(x-\mu)} +@end iftex +@ifhtml +@html +PDF(x- mu) +@end html +@end ifhtml +@ifinfo +@math{PDF(x- mu)} +@end ifinfo +instead of +@iftex +@math{PDF(x).} +@end iftex +@ifhtml +@html +PDF(x). +@end html +@end ifhtml +@ifinfo +@math{PDF(x).} +@end ifinfo +This is important as otherwise the acceptance region can become +a very long and skinny ellipsoid along a diagonal of the (huge) +bounding rectangle. + + +@subsubheading How To Use + + +For using the NROU method UNU.RAN needs the PDF of the +distribution. Additionally, the parameter @i{r} can be set via +a +@ifhtml +@ref{funct:unur_vnrou_set_r,@command{unur_vnrou_set_r}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_r} +@end ifnothtml +call. Notice that the acceptance +probability decreases when @i{r} is increased. On the other +hand is is more unlikely that the bounding rectangle does not +exist if @i{r} is small. + +A bounding rectangle can be given by the +@ifhtml +@ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_u} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_v} +@end ifnothtml +calls. + +@emph{Important:} The bounding rectangle has to be +provided for the function +@iftex +@math{PDF(x-center)!} +@end iftex +@ifhtml +@html +PDF(x-center)! +@end html +@end ifhtml +@ifinfo +@math{PDF(x-center)!} +@end ifinfo +Notice that @code{center} is the center of the given +distribution, see +@ifhtml +@ref{funct:unur_distr_cont_set_center,@command{unur_distr_cont_set_center}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_center}. +@end ifnothtml +If in doubt or if this value is not optimal, it can be changed +(overridden) by a +@ifhtml +@ref{funct:unur_nrou_set_center,@command{unur_nrou_set_center}} +@end ifhtml +@ifnothtml +@command{unur_nrou_set_center} +@end ifnothtml +call. + +If the coordinates of the bounding rectangle are not provided by +the user then the minimal bounding rectangle is computed +automatically. + +By means of +@ifhtml +@ref{funct:unur_vnrou_set_verify,@command{unur_vnrou_set_verify}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_verify} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_vnrou_chg_verify,@command{unur_vnrou_chg_verify}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_chg_verify} +@end ifnothtml +one can run the sampling algorithm in a checking mode, i.e., in +every cycle of the rejection loop it is checked whether the used +rectangle indeed enclosed the acceptance region of the +distribution. When in doubt (e.g., when it is not clear whether +the numerical routine has worked correctly) this can be used to +run a small Monte Carlo study. + +It is possible to change the parameters and the domain of the chosen +distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator object. +Notice, that derived parameters like the mode must also be (re-) set +if the parameters or the domain has be changed. +Notice, however, that then the values that has been set by +@ifhtml +@ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_u} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_v} +@end ifnothtml +calls are removed and +the coordinates of the bounding box are computed numerically. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_nrou_new,unur_nrou_new} +@item @ref{funct:unur_nrou_set_u,unur_nrou_set_u} +@item @ref{funct:unur_nrou_set_v,unur_nrou_set_v} +@item @ref{funct:unur_nrou_set_r,unur_nrou_set_r} +@item @ref{funct:unur_nrou_set_center,unur_nrou_set_center} +@item @ref{funct:unur_nrou_set_verify,unur_nrou_set_verify} +@item @ref{funct:unur_nrou_chg_verify,unur_nrou_chg_verify} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_nrou_new} +@deftypefn Function {UNUR_PAR*} unur_nrou_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_nrou_new} +@deftypefn {} {UNUR_PAR*} unur_nrou_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_nrou_set_u} +@deftypefn Function {int} unur_nrou_set_u (UNUR_PAR* @var{parameters}, double @var{umin}, double @var{umax}) +Sets left and right boundary of bounding rectangle. +If no values are given, the boundary of the minimal bounding +rectangle is computed numerically. + +@emph{Notice}: Computing the minimal bounding rectangle may fail +under some circumstances. Moreover, for multimodal distributions +the bounds might be too small as only local extrema are computed. +Nevertheless, for +@math{T_c} +-concave distributions with +@math{c=-1/2} +it should work. + +@emph{Important:} The bounding rectangle that has to be +provided is for the function +@math{PDF(x-center)!} + +Default: not set. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_nrou_set_u} +@deftypefn {} {int} unur_nrou_set_u (UNUR_PAR* @var{parameters}, double @var{umin}, double @var{umax}) +Sets left and right boundary of bounding rectangle. +If no values are given, the boundary of the minimal bounding +rectangle is computed numerically. + +@emph{Notice}: Computing the minimal bounding rectangle may fail +under some circumstances. Moreover, for multimodal distributions +the bounds might be too small as only local extrema are computed. +Nevertheless, for +@iftex +@math{T_c} +@end iftex +@ifhtml +@html +T_c +@end html +@end ifhtml +-concave distributions with +@iftex +@math{c=-1/2} +@end iftex +@ifhtml +@html +c=-1/2 +@end html +@end ifhtml +it should work. + +@emph{Important:} The bounding rectangle that has to be +provided is for the function +@iftex +@math{PDF(x-center)!} +@end iftex +@ifhtml +@html +PDF(x-center)! +@end html +@end ifhtml + +Default: not set. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_nrou_set_v} +@deftypefn Function {int} unur_nrou_set_v (UNUR_PAR* @var{parameters}, double @var{vmax}) +Set upper boundary for bounding rectangle. If this value is not +given then +@math{sqrt(PDF(mode))} +is used instead. + +@emph{Notice}: When the mode is not given for the distribution +object, then it will be computed numerically. + +Default: not set. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_nrou_set_v} +@deftypefn {} {int} unur_nrou_set_v (UNUR_PAR* @var{parameters}, double @var{vmax}) +Set upper boundary for bounding rectangle. If this value is not +given then +@iftex +@math{\sqrt{PDF(mode)}} +@end iftex +@ifhtml +@html +sqrt(PDF(mode)) +@end html +@end ifhtml +is used instead. + +@emph{Notice}: When the mode is not given for the distribution +object, then it will be computed numerically. + +Default: not set. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_nrou_set_r} +@deftypefn Function {int} unur_nrou_set_r (UNUR_PAR* @var{parameters}, double @var{r}) +Sets the parameter @var{r} of the generalized ratio-of-uniforms +method. + +@emph{Notice}: This parameter must satisfy @var{r}>0. + +Default: @code{1}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_nrou_set_r} +@deftypefn {} {int} unur_nrou_set_r (UNUR_PAR* @var{parameters}, double @var{r}) +Sets the parameter @var{r} of the generalized ratio-of-uniforms +method. + +@emph{Notice}: This parameter must satisfy @var{r}>0. + +Default: @code{1}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_nrou_set_center} +@deftypefn Function {int} unur_nrou_set_center (UNUR_PAR* @var{parameters}, double @var{center}) +Set the center +@math{mu} +of the PDF. +If not set the center of the given distribution object is used. + +Default: see +@ifhtml +@ref{funct:unur_distr_cont_set_center,@command{unur_distr_cont_set_center}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_center}. +@end ifnothtml +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_nrou_set_center} +@deftypefn {} {int} unur_nrou_set_center (UNUR_PAR* @var{parameters}, double @var{center}) +Set the center +@iftex +@math{\mu} +@end iftex +@ifhtml +@html +mu +@end html +@end ifhtml +of the PDF. +If not set the center of the given distribution object is used. + +Default: see +@ifhtml +@ref{funct:unur_distr_cont_set_center,@command{unur_distr_cont_set_center}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_center}. +@end ifnothtml +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_nrou_set_verify} +@deftypefn Function {int} unur_nrou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. + +If the condition +@math{PDF(x) <= hat(x)} +is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However, notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_nrou_set_verify} +@deftypefn {} {int} unur_nrou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. + +If the condition +@iftex +@math{PDF(x) \leq hat(x)} +@end iftex +@ifhtml +@html +PDF(x) <= hat(x) +@end html +@end ifhtml +is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However, notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_nrou_chg_verify} +@deftypefn Function {int} unur_nrou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Change the verifying of algorithm while sampling on/off. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_nrou_chg_verify} +@deftypefn {} {int} unur_nrou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Change the verifying of algorithm while sampling on/off. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of nrou.h +@c ------------------------------------- +@c ------------------------------------- +@c pinv.h +@c + +@page +@node PINV +@subsection PINV -- Polynomial interpolation based INVersion of CDF + +@table @i +@item Required: +PDF +@item Optional: +domain, center, CDF, derivative of PDF +@item Speed: +Set-up: (very) slow, Sampling: (very) fast +@item Reinit: +not implemented +@item Reference: +@ifhtml +@ref{bib:DHLa08,, [DHLa08]} +@end ifhtml +@ifnothtml +[DHLa08] +@end ifnothtml + +@end table + + +PINV is a variant of numerical inversion, where the inverse CDF +is approximated using Newton's interpolating formula. +The interval [0,1] is split into several subintervals. In each +of these the inverse CDF is constructed at nodes +@iftex +@math{(CDF(x),x)} +@end iftex +@ifhtml +@html +(CDF(x),x) +@end html +@end ifhtml +@ifinfo +@math{(CDF(x),x)} +@end ifinfo +for some points @i{x} in this subinterval. +If the PDF is given, then the CDF is computed numerically +from the given PDF using adaptive Gauss-Lobatto +integration with 5 points. Subintervals are split until the +requested accuracy goal is reached. + +The method is not exact, as it only produces random variates of +the approximated distribution. Nevertheless, the maximal +tolerated approximation error can be set to be the resolution +(but of course is bounded by the machine precision). +We use the u-error +@iftex +@math{|U-CDF(X)|} +@end iftex +@ifhtml +@html +|U-CDF(X)| +@end html +@end ifhtml +@ifinfo +@math{|U-CDF(X)|} +@end ifinfo +to measure the error +for @i{X} = "approximate inverse CDF"(@i{U}). +Notice that very small values of the u-resolution are possible +but increase the cost for the setup step. +We call the maximal tolerated u-error the @emph{u-resolution} of +the algorithm in the sequel. + +Both the order of the interpolating polynomial and the +u-resolution can be selected. + +The interpolating polynomials have to be computed in a setup +step. However, it only works for distributions with bounded +domain; for distributions with unbounded domain the tails are +cut off such that the probability for the tail regions is +small compared to the given u-resolution. + +The construction of the interpolation polynomial only works when +the PDF is unimodal or when the PDF does not vanish between two +modes. + +There are some restrictions for the given distribution: +@itemize +@item +The support of the distribution (i.e., the region where the PDF +is strictly positive) must be connected. In practice this means, +that the region where PDF is "not too small" must be connected. +Unimodal densities satisfy this condition. +If this condition is violated then the domain of the +distribution might be truncated. +@item +When the PDF is integrated numerically, then the given PDF must +be continuous and should be smooth. +@item +The PDF must be bounded. +@item +The algorithm has problems when the distribution has heavy tails +(as then the inverse CDF becomes very steep at 0 or 1) +and the requested u-resolution is very small. +E.g., the Cauchy distribution is likely to show this problem +when the requested u-resolution is less then @code{1.e-12}. +@end itemize +Regions with very small PDF values or heavy tails might lead to +an abortion of the set-up or (even worse) the approximation +error might become larger than requested, since the (computation of the) +interpolating polynomial becomes numerically unstable. + +@emph{Remark:} +We also have implemented experimental variants. +However, we observed that these variants are more sensitive to +round-off errors, especially in the right hand tail and we +@emph{do not recommend} their usage unless there are severe +reasons. + +@itemize @minus +@item +Use a function that implements the CDF instead of numerical +integration of the PDF. + +@item +Use Hermite interpolation instead of Newton interpolation. +Thus the first (and second) derivative of the interpolating +polynomial coincides with that of the inverse CDF. +Consequently the interpolant is also (twice) differentiable even +at the interval boundaries. +This variant can be seen as limiting case of Newton +interpolation with double (or triple) points as nodes. + +We have used a @emph{smoothness} parameter to control this +feature. However, besides numerical problems we observed that +this variant requires more intervals and thus larger setup times +and higher memory consumptions. +@end itemize + + + +@subsubheading How To Use + + +PINV works for continuous univariate distribution objects with +given PDF. The corresponding distribution object should contain a +typical point of the distribution, i.e., a point where the PDF +is not too small, e.g., (a point near) the mode. +However, it is important that the center is @strong{not} the +pole of the distribution (or a point too close to the pole). +It can be set using a +@ifhtml +@ref{funct:unur_distr_cont_set_center,@command{unur_distr_cont_set_center}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_center} +@end ifnothtml +or +a +@ifhtml +@ref{funct:unur_distr_cont_set_mode,@command{unur_distr_cont_set_mode}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_mode} +@end ifnothtml +call. If neither is set, or if the +given center cannot be used, then a simple search routine tries +to find an appropriate point for the center. + +It is recommended that the domain of the distribution with +bounded domain is specified using a +@ifhtml +@ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_cont_set_domain} +@end ifnothtml +call. Otherwise, the boundary is searched numerically which +might be rather expensive, especially when this boundary point +is @code{0}. + +The inverse CDF is interpolated using Newton polynomials. +The order of this polynomial can be set by means of a +@ifhtml +@ref{funct:unur_pinv_set_order,@command{unur_pinv_set_order}} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_order} +@end ifnothtml +call. + +The smoothness of the interpolant at interval boundaries can be +controlled using a +@ifhtml +@ref{funct:unur_pinv_set_smoothness,@command{unur_pinv_set_smoothness}} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_smoothness} +@end ifnothtml +call. +Then Hermite interpolation instead of Newton interpolation is +used. (The former can be seen as a limiting case of Newton +interpolation with double (or triple) points.) +However, using higher smoothness is @emph{not recommended} +unless differentiability at the interval boundaries is +important. + +For distributions with unbounded domains the tails are cut +off such that the probability for the tail regions is small +compared to the given u-resolution. For finding these cut points +the algorithm starts with the region @code{[-1.e100,1.e100]}. For +the exceptional case where this does not work these starting +points can be changed via a +@ifhtml +@ref{funct:unur_pinv_set_boundary,@command{unur_pinv_set_boundary}} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_boundary} +@end ifnothtml +call. + +This method is not exact, as it only produces random variates of +the approximated distribution. Nevertheless, the numerical error +in "u-direction" (i.e., |U-CDF(X)|, for +X = "approximate inverse CDF"(U) |U-CDF(X)|) can be controlled +by means of +@ifhtml +@ref{funct:unur_pinv_set_u_resolution,@command{unur_pinv_set_u_resolution}.} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_u_resolution}. +@end ifnothtml +However, the maximal error of this approximation is only +estimated. For very small u-resolutions the actual approximation +error might be (slightly) larger than the requested u-resolution. +(Of course the size of this value depends on the given PDF.) +If this error is crucial for an application we recommend to +compute this error using +@ifhtml +@ref{funct:unur_pinv_estimate_error,@command{unur_pinv_estimate_error}} +@end ifhtml +@ifnothtml +@command{unur_pinv_estimate_error} +@end ifnothtml +which runs a +small Monte Carlo simulation. +It is also possible to improve the error estimate during setup +by means of +@ifhtml +@ref{funct:unur_pinv_set_extra_testpoints,@command{unur_pinv_set_extra_testpoints}.} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_extra_testpoints}. +@end ifnothtml +See also the documentation for function +@ifhtml +@ref{funct:unur_pinv_set_u_resolution,@command{unur_pinv_set_u_resolution}} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_u_resolution} +@end ifnothtml +and the remark given there. + +The number of required subintervals heavily depends on the order +of the interpolating polynomial and the requested u-resolution: +it increases when order or u-resolution are decreased. +It can be checked using a +@ifhtml +@ref{funct:unur_pinv_get_n_intervals,@command{unur_pinv_get_n_intervals}} +@end ifhtml +@ifnothtml +@command{unur_pinv_get_n_intervals} +@end ifnothtml +call. +The maximum number of such subintervals is fixed but can be +increased using a +@ifhtml +@ref{funct:unur_pinv_set_max_intervals,@command{unur_pinv_set_max_intervals}} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_max_intervals} +@end ifnothtml +call. +If this maximum number is too small then the set-up aborts with +a corresponding error message. + +It is also possible to use the CDF of the distribution instead +of the PDF. Then the distribution object must contain a pointer +to the CDF. Moreover, this variant of the algorithm has to be +switched on using an +@ifhtml +@ref{funct:unur_pinv_set_usecdf,@command{unur_pinv_set_usecdf}} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_usecdf} +@end ifnothtml +call. +Notice, however, that the setup for this variant is numerically +less stable than using integration of the PDF (the default +variant). Thus using the CDF is @emph{not recommended}. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_pinv_new,unur_pinv_new} +@item @ref{funct:unur_pinv_set_order,unur_pinv_set_order} +@item @ref{funct:unur_pinv_set_smoothness,unur_pinv_set_smoothness} +@item @ref{funct:unur_pinv_set_u_resolution,unur_pinv_set_u_resolution} +@item @ref{funct:unur_pinv_set_extra_testpoints,unur_pinv_set_extra_testpoints} +@item @ref{funct:unur_pinv_set_use_upoints,unur_pinv_set_use_upoints} +@item @ref{funct:unur_pinv_set_usepdf,unur_pinv_set_usepdf} +@item @ref{funct:unur_pinv_set_usecdf,unur_pinv_set_usecdf} +@item @ref{funct:unur_pinv_set_boundary,unur_pinv_set_boundary} +@item @ref{funct:unur_pinv_set_searchboundary,unur_pinv_set_searchboundary} +@item @ref{funct:unur_pinv_set_max_intervals,unur_pinv_set_max_intervals} +@item @ref{funct:unur_pinv_get_n_intervals,unur_pinv_get_n_intervals} +@item @ref{funct:unur_pinv_set_keepcdf,unur_pinv_set_keepcdf} +@item @ref{funct:unur_pinv_eval_approxinvcdf,unur_pinv_eval_approxinvcdf} +@item @ref{funct:unur_pinv_eval_approxcdf,unur_pinv_eval_approxcdf} +@item @ref{funct:unur_pinv_estimate_error,unur_pinv_estimate_error} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_pinv_new} +@deftypefn Function {UNUR_PAR*} unur_pinv_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_pinv_new} +@deftypefn {} {UNUR_PAR*} unur_pinv_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_pinv_set_order} +@deftypefn Function {int} unur_pinv_set_order (UNUR_PAR* @var{parameters}, int @var{order}) +Set order of interpolation. Valid orders are between @code{3} and +@code{17}. Higher orders result in fewer intervals for the +approximations. + +Default: @code{5}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_pinv_set_order} +@deftypefn {} {int} unur_pinv_set_order (UNUR_PAR* @var{parameters}, int @var{order}) +Set order of interpolation. Valid orders are between @code{3} and +@code{17}. Higher orders result in fewer intervals for the +approximations. + +Default: @code{5}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_pinv_set_smoothness} +@deftypefn Function {int} unur_pinv_set_smoothness (UNUR_PAR* @var{parameters}, int @var{smoothness}) +Set smoothness of interpolant. By construction the interpolant is +piecewise polynomial and thus smooth on each of the intervals +where these polynomials are constructed. At the interval +boundaries, however, it usually not be differentiable. +Method PINV also implements variants of Newton interpolation where +the first (or second) derivative of the interpolating +polynomial coincides with the respective derivative of the inverse +CDF at the nodes. The the interpolant is (twice) differentiable +even at the interval boundaries. +These variants can be seen as limiting case of Newton interpolation +with double (or triple) points as nodes and are known as Hermite +interpolation. + +Possible values for @var{smoothness}: + +@multitable @columnfractions .1 .25 .60 +@headitem Value @tab Effect @tab Requirements +@item @code{0} +@tab continuous +@tab requires PDF (or CDF) + +@item @code{1} +@tab differentiable +@tab requires PDF (optional: CDF), @* +order of polynomial must be odd + +@item @code{2} +@tab twice differentiable +@tab requires PDF and its derivative (optional: CDF), @* +order must be 5, 8, 11, 14 or 17 +@end multitable + +If the order of the polynomial does not satisfy the given +condition, then it is increased to the next larger possible value. + +@emph{Remark:} +A higher smoothness parameter usually results in a higher number of +intervals and thus a higher setup time and memory consumption. +We also observed that higher smoothness parameters make the +algorithm more sensible for round-off error. Then the setup fails. + +@emph{Remark:} +If the interpolating polynomial cannot be constructed for the +requested smoothness on a particular interval, +then the smoothness parameter is reduced for that interval. + +@emph{Remark:} +For order @code{3} and smoothness @code{1} (cubic Hermite +interpolation) monotonicity is guaranteed by checking a simple +monotonicity condition for the coefficients of the polynomials. + +@emph{Remark:} +Using @var{smoothness} larger than @code{0} is +@emph{not recommended} unless differentiability at the interval +boundaries is important for ones application. + +Default: @code{0}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_pinv_set_smoothness} +@deftypefn {} {int} unur_pinv_set_smoothness (UNUR_PAR* @var{parameters}, int @var{smoothness}) +Set smoothness of interpolant. By construction the interpolant is +piecewise polynomial and thus smooth on each of the intervals +where these polynomials are constructed. At the interval +boundaries, however, it usually not be differentiable. +Method PINV also implements variants of Newton interpolation where +the first (or second) derivative of the interpolating +polynomial coincides with the respective derivative of the inverse +CDF at the nodes. The the interpolant is (twice) differentiable +even at the interval boundaries. +These variants can be seen as limiting case of Newton interpolation +with double (or triple) points as nodes and are known as Hermite +interpolation. + +Possible values for @var{smoothness}: + +@multitable @columnfractions .1 .25 .60 +@headitem Value @tab Effect @tab Requirements +@item @code{0} +@tab continuous +@tab requires PDF (or CDF) + +@item @code{1} +@tab differentiable +@tab requires PDF (optional: CDF), @* +order of polynomial must be odd + +@item @code{2} +@tab twice differentiable +@tab requires PDF and its derivative (optional: CDF), @* +order must be 5, 8, 11, 14 or 17 +@end multitable + +If the order of the polynomial does not satisfy the given +condition, then it is increased to the next larger possible value. + +@emph{Remark:} +A higher smoothness parameter usually results in a higher number of +intervals and thus a higher setup time and memory consumption. +We also observed that higher smoothness parameters make the +algorithm more sensible for round-off error. Then the setup fails. + +@emph{Remark:} +If the interpolating polynomial cannot be constructed for the +requested smoothness on a particular interval, +then the smoothness parameter is reduced for that interval. + +@emph{Remark:} +For order @code{3} and smoothness @code{1} (cubic Hermite +interpolation) monotonicity is guaranteed by checking a simple +monotonicity condition for the coefficients of the polynomials. + +@emph{Remark:} +Using @var{smoothness} larger than @code{0} is +@emph{not recommended} unless differentiability at the interval +boundaries is important for ones application. + +Default: @code{0}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_pinv_set_u_resolution} +@deftypefn Function {int} unur_pinv_set_u_resolution (UNUR_PAR* @var{parameters}, double @var{u_resolution}) +Set maximal tolerated u-error. Values of @var{u_resolution} must +at least @code{1.e-15} and @code{1.e-5} at most. +Notice that the resolution of most uniform random number sources is +@math{2^(-32)} += @code{2.3e-10}. Thus a value of @code{1.e-10} +leads to an inversion algorithm that could be called exact. For most +simulations slightly bigger values for the maximal error are enough +as well. + +Smaller values for @var{u_resolution} increase the number of +subinterval that are necessary for the approximation of the inverse +CDF. For very small values (less then @code{1.e-12}) this number +might exceed the maximum number of such intervals. However, this +number can be increased using a +@ifhtml +@ref{funct:unur_pinv_set_max_intervals,@command{unur_pinv_set_max_intervals}} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_max_intervals} +@end ifnothtml +call. + +@emph{Remark:} +We ran many experiments and found that the observed u-error was +always smaller than the given @var{u_resolution} whenever this +value was @code{1.e-12}. For values smaller than @code{1e-13} the +maximal observed u-error was slightly larger. One use @code{1.e-15} +if best approximation is required. However, then the actual u-error +can be as large as @code{1.e-14}. + +Consider calling +@ifhtml +@ref{funct:unur_pinv_set_extra_testpoints,@command{unur_pinv_set_extra_testpoints}} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_extra_testpoints} +@end ifnothtml +in order to +reduce the risk of larger approximation errors. + +@strong{Warning!} +These figures are based on our experiments (with some tolerance +added to be on the safe side). There is no guarantee for these error +estimates for a particular distribution. + +Default is @code{1.e-10}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_pinv_set_u_resolution} +@deftypefn {} {int} unur_pinv_set_u_resolution (UNUR_PAR* @var{parameters}, double @var{u_resolution}) +Set maximal tolerated u-error. Values of @var{u_resolution} must +at least @code{1.e-15} and @code{1.e-5} at most. +Notice that the resolution of most uniform random number sources is +@iftex +@math{2^{-32}} +@end iftex +@ifhtml +@html +2-32 +@end html +@end ifhtml += @code{2.3e-10}. Thus a value of @code{1.e-10} +leads to an inversion algorithm that could be called exact. For most +simulations slightly bigger values for the maximal error are enough +as well. + +Smaller values for @var{u_resolution} increase the number of +subinterval that are necessary for the approximation of the inverse +CDF. For very small values (less then @code{1.e-12}) this number +might exceed the maximum number of such intervals. However, this +number can be increased using a +@ifhtml +@ref{funct:unur_pinv_set_max_intervals,@command{unur_pinv_set_max_intervals}} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_max_intervals} +@end ifnothtml +call. + +@emph{Remark:} +We ran many experiments and found that the observed u-error was +always smaller than the given @var{u_resolution} whenever this +value was @code{1.e-12}. For values smaller than @code{1e-13} the +maximal observed u-error was slightly larger. One use @code{1.e-15} +if best approximation is required. However, then the actual u-error +can be as large as @code{1.e-14}. + +Consider calling +@ifhtml +@ref{funct:unur_pinv_set_extra_testpoints,@command{unur_pinv_set_extra_testpoints}} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_extra_testpoints} +@end ifnothtml +in order to +reduce the risk of larger approximation errors. + +@strong{Warning!} +These figures are based on our experiments (with some tolerance +added to be on the safe side). There is no guarantee for these error +estimates for a particular distribution. + +Default is @code{1.e-10}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_pinv_set_extra_testpoints} +@deftypefn Function {int} unur_pinv_set_extra_testpoints (UNUR_PAR* @var{parameters}, int @var{n_points}) +During setup method PINV checks the current u-error by means of +carefully selected test points and improves the approximation where +necessary. However, it nevertheless may happen, that the +maximal approximation error is larger than estimated in some +interval (which usually is hit with a very small probability). +This estimate can be improved by using extra test points +which can be added by means of this call. +However, this increases the setup time considerably. +Note that these additional points are selected equidistributed +in each subinterval. + +Default is @code{0} (i.e., no additional test points are used). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_pinv_set_extra_testpoints} +@deftypefn {} {int} unur_pinv_set_extra_testpoints (UNUR_PAR* @var{parameters}, int @var{n_points}) +During setup method PINV checks the current u-error by means of +carefully selected test points and improves the approximation where +necessary. However, it nevertheless may happen, that the +maximal approximation error is larger than estimated in some +interval (which usually is hit with a very small probability). +This estimate can be improved by using extra test points +which can be added by means of this call. +However, this increases the setup time considerably. +Note that these additional points are selected equidistributed +in each subinterval. + +Default is @code{0} (i.e., no additional test points are used). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_pinv_set_use_upoints} +@deftypefn Function {int} unur_pinv_set_use_upoints (UNUR_PAR* @var{parameters}, int @var{use_upoints}) +If @var{use_upoints} is @code{TRUE}, then the nodes of the interpolating +polynomial are constructed by means of Chebyshev points in u-scale +not in x-scale. This results is a better approximation but almost +doubles the number of PDF or CDF evaluations during the setup. +(This is an experimental feature.) + +Default: @code{FALSE} +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_pinv_set_use_upoints} +@deftypefn {} {int} unur_pinv_set_use_upoints (UNUR_PAR* @var{parameters}, int @var{use_upoints}) +If @var{use_upoints} is @code{TRUE}, then the nodes of the interpolating +polynomial are constructed by means of Chebyshev points in u-scale +not in x-scale. This results is a better approximation but almost +doubles the number of PDF or CDF evaluations during the setup. +(This is an experimental feature.) + +Default: @code{FALSE} +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_pinv_set_usepdf} +@deftypefn Function {int} unur_pinv_set_usepdf (UNUR_PAR* @var{parameters}) +Use PDF (if available) to compute approximate inverse CDF. + +This is the default. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_pinv_set_usepdf} +@deftypefn {} {int} unur_pinv_set_usepdf (UNUR_PAR* @var{parameters}) +Use PDF (if available) to compute approximate inverse CDF. + +This is the default. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_pinv_set_usecdf} +@deftypefn Function {int} unur_pinv_set_usecdf (UNUR_PAR* @var{parameters}) +Use CDF (if available) to compute approximate inverse CDF. +This variant is intend for running experiments with method PINV. + +@emph{Remark:} +We ran many experiments and found that for small values of the +given @var{u_resolution} (less than @code{1.e-12}) the setup fails +for distributions with heavy tails. We found that using the PDF +(instead of the CDF) is numerically more stable. +This is especially the case when the smoothness parameter is set +to @code{1} or @code{2}. + +Using the CDF is @strong{not recommended}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_pinv_set_usecdf} +@deftypefn {} {int} unur_pinv_set_usecdf (UNUR_PAR* @var{parameters}) +Use CDF (if available) to compute approximate inverse CDF. +This variant is intend for running experiments with method PINV. + +@emph{Remark:} +We ran many experiments and found that for small values of the +given @var{u_resolution} (less than @code{1.e-12}) the setup fails +for distributions with heavy tails. We found that using the PDF +(instead of the CDF) is numerically more stable. +This is especially the case when the smoothness parameter is set +to @code{1} or @code{2}. + +Using the CDF is @strong{not recommended}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_pinv_set_boundary} +@deftypefn Function {int} unur_pinv_set_boundary (UNUR_PAR* @var{parameters}, double @var{left}, double @var{right}) +Set @var{left} and @var{right} point for finding the cut-off points +for the "computational domain", i.e., the domain that covers the +essential part of the distribution. +The cut-off points are computed such that the tail probabilities +are smaller than given by +@ifhtml +@ref{funct:unur_pinv_set_u_resolution,@command{unur_pinv_set_u_resolution}.} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_u_resolution}. +@end ifnothtml +It is usually safe to use a large interval. +However, @code{+/- UNUR_INFINITY} is not allowed. + +@emph{Important}: This call does not change the domain of the +given distribution itself. But it restricts the domain for the +resulting random variates. + +Default: intersection of @code{[-1.e100,+1.e100]} and the given +domain of the distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_pinv_set_boundary} +@deftypefn {} {int} unur_pinv_set_boundary (UNUR_PAR* @var{parameters}, double @var{left}, double @var{right}) +Set @var{left} and @var{right} point for finding the cut-off points +for the "computational domain", i.e., the domain that covers the +essential part of the distribution. +The cut-off points are computed such that the tail probabilities +are smaller than given by +@ifhtml +@ref{funct:unur_pinv_set_u_resolution,@command{unur_pinv_set_u_resolution}.} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_u_resolution}. +@end ifnothtml +It is usually safe to use a large interval. +However, @code{+/- UNUR_INFINITY} is not allowed. + +@emph{Important}: This call does not change the domain of the +given distribution itself. But it restricts the domain for the +resulting random variates. + +Default: intersection of @code{[-1.e100,+1.e100]} and the given +domain of the distribution. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_pinv_set_searchboundary} +@deftypefn Function {int} unur_pinv_set_searchboundary (UNUR_PAR* @var{parameters}, int @var{left}, int @var{right}) +If @var{left} or @var{right} is set to @code{FALSE} then the respective +boundary as given by a +@ifhtml +@ref{funct:unur_pinv_set_boundary,@command{unur_pinv_set_boundary}} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_boundary} +@end ifnothtml +call is used +without any further computations. +However, these boundary points might cause numerical problems +during the setup when PDF returns @code{0} ``almost everywhere''. +If set to @code{TRUE} (the default) then the computational interval is +shortened to a more sensible region by means of a search algorithm. +Switching off this search is useful, e.g., for the Gamma(2) +distribution where the left border @code{0} is fixed and finite. + +@emph{Remark:} +The searching algorithm assumes that the support of the distribution +is connected. + +@emph{Remark:} +Do not set this parameter to @code{FALSE} except when searching for +cut-off points fails and one wants to try with precomputed values. + +Default: @code{TRUE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_pinv_set_searchboundary} +@deftypefn {} {int} unur_pinv_set_searchboundary (UNUR_PAR* @var{parameters}, int @var{left}, int @var{right}) +If @var{left} or @var{right} is set to @code{FALSE} then the respective +boundary as given by a +@ifhtml +@ref{funct:unur_pinv_set_boundary,@command{unur_pinv_set_boundary}} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_boundary} +@end ifnothtml +call is used +without any further computations. +However, these boundary points might cause numerical problems +during the setup when PDF returns @code{0} ``almost everywhere''. +If set to @code{TRUE} (the default) then the computational interval is +shortened to a more sensible region by means of a search algorithm. +Switching off this search is useful, e.g., for the Gamma(2) +distribution where the left border @code{0} is fixed and finite. + +@emph{Remark:} +The searching algorithm assumes that the support of the distribution +is connected. + +@emph{Remark:} +Do not set this parameter to @code{FALSE} except when searching for +cut-off points fails and one wants to try with precomputed values. + +Default: @code{TRUE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_pinv_set_max_intervals} +@deftypefn Function {int} unur_pinv_set_max_intervals (UNUR_PAR* @var{parameters}, int @var{max_ivs}) +Set maximum number of intervals. @var{max_ivs} must be at least +@code{100} and at most @code{1000000}. + +Default is @code{10000}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_pinv_set_max_intervals} +@deftypefn {} {int} unur_pinv_set_max_intervals (UNUR_PAR* @var{parameters}, int @var{max_ivs}) +Set maximum number of intervals. @var{max_ivs} must be at least +@code{100} and at most @code{1000000}. + +Default is @code{10000}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_pinv_get_n_intervals} +@deftypefn Function {int} unur_pinv_get_n_intervals (const @var{UNUR_GEN* generator}) +Get number of intervals used for interpolation in +the generator object. +It returns @code{0} in case of an error. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_pinv_get_n_intervals} +@deftypefn {} {int} unur_pinv_get_n_intervals (const @var{UNUR_GEN* generator}) +Get number of intervals used for interpolation in +the generator object. +It returns @code{0} in case of an error. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_pinv_set_keepcdf} +@deftypefn Function {int} unur_pinv_set_keepcdf (UNUR_PAR* @var{parameters}, int @var{keepcdf}) +If the PDF is given, then the CDF is computed numerically +from the given PDF using adaptive Gauss-Lobatto integration. +Thus a table of CDF points is stored to keep the number of +evaluations of the PDF minimal. Usually this table is discarded +when the setup is completed. +If @var{keepcdf} is @code{TRUE}, then this table is kept and can be used +to compute the CDF of the underlying distribution by means of +function +@ifhtml +@ref{funct:unur_pinv_eval_approxcdf,@command{unur_pinv_eval_approxcdf}.} +@end ifhtml +@ifnothtml +@command{unur_pinv_eval_approxcdf}. +@end ifnothtml +This option is ignored when +@ifhtml +@ref{funct:unur_pinv_set_usecdf,@command{unur_pinv_set_usecdf}} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_usecdf} +@end ifnothtml +is called. + +Default: @code{FALSE} +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_pinv_set_keepcdf} +@deftypefn {} {int} unur_pinv_set_keepcdf (UNUR_PAR* @var{parameters}, int @var{keepcdf}) +If the PDF is given, then the CDF is computed numerically +from the given PDF using adaptive Gauss-Lobatto integration. +Thus a table of CDF points is stored to keep the number of +evaluations of the PDF minimal. Usually this table is discarded +when the setup is completed. +If @var{keepcdf} is @code{TRUE}, then this table is kept and can be used +to compute the CDF of the underlying distribution by means of +function +@ifhtml +@ref{funct:unur_pinv_eval_approxcdf,@command{unur_pinv_eval_approxcdf}.} +@end ifhtml +@ifnothtml +@command{unur_pinv_eval_approxcdf}. +@end ifnothtml +This option is ignored when +@ifhtml +@ref{funct:unur_pinv_set_usecdf,@command{unur_pinv_set_usecdf}} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_usecdf} +@end ifnothtml +is called. + +Default: @code{FALSE} +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_pinv_eval_approxinvcdf} +@deftypefn Function {double} unur_pinv_eval_approxinvcdf (const @var{UNUR_GEN* generator}, double @var{u}) +Evaluate interpolation of inverse CDF at @var{u}. +If @var{u} is out of the domain (0,1) then @code{unur_errno} is set +to @code{UNUR_ERR_DOMAIN} and the respective bound of +the domain of the distribution are returned (which is +@code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of +unbounded domains). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_pinv_eval_approxinvcdf} +@deftypefn {} {double} unur_pinv_eval_approxinvcdf (const @var{UNUR_GEN* generator}, double @var{u}) +Evaluate interpolation of inverse CDF at @var{u}. +If @var{u} is out of the domain (0,1) then @code{unur_errno} is set +to @code{UNUR_ERR_DOMAIN} and the respective bound of +the domain of the distribution are returned (which is +@code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of +unbounded domains). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_pinv_eval_approxcdf} +@deftypefn Function {double} unur_pinv_eval_approxcdf (const @var{UNUR_GEN* generator}, double @var{x}) +Evaluate (approximate) CDF at @var{x}. If the PDF of the +distribution is given, then adaptive Gauss-Lobatto integration is +used to compute the CDF. +If the PDF is used to create the generator object, then the +table of integral values must not removed at the end of setup and thus +@ifhtml +@ref{funct:unur_pinv_set_keepcdf,@command{unur_pinv_set_keepcdf}} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_keepcdf} +@end ifnothtml +must be called. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_pinv_eval_approxcdf} +@deftypefn {} {double} unur_pinv_eval_approxcdf (const @var{UNUR_GEN* generator}, double @var{x}) +Evaluate (approximate) CDF at @var{x}. If the PDF of the +distribution is given, then adaptive Gauss-Lobatto integration is +used to compute the CDF. +If the PDF is used to create the generator object, then the +table of integral values must not removed at the end of setup and thus +@ifhtml +@ref{funct:unur_pinv_set_keepcdf,@command{unur_pinv_set_keepcdf}} +@end ifhtml +@ifnothtml +@command{unur_pinv_set_keepcdf} +@end ifnothtml +must be called. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_pinv_estimate_error} +@deftypefn Function {int} unur_pinv_estimate_error (const @var{UNUR_GEN* generator}, int @var{samplesize}, double* @var{max_error}, double* @var{MAE}) +Estimate maximal u-error and mean absolute error (MAE) for @var{generator} +by means of Monte-Carlo simulation with sample size @var{samplesize}. +The results are stored in @var{max_error} and @var{MAE}, respectively. + +It returns @code{UNUR_SUCCESS} if successful. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_pinv_estimate_error} +@deftypefn {} {int} unur_pinv_estimate_error (const @var{UNUR_GEN* generator}, int @var{samplesize}, double* @var{max_error}, double* @var{MAE}) +Estimate maximal u-error and mean absolute error (MAE) for @var{generator} +by means of Monte-Carlo simulation with sample size @var{samplesize}. +The results are stored in @var{max_error} and @var{MAE}, respectively. + +It returns @code{UNUR_SUCCESS} if successful. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of pinv.h +@c ------------------------------------- +@c ------------------------------------- +@c srou.h +@c + +@page +@node SROU +@subsection SROU -- Simple Ratio-Of-Uniforms method + +@table @i +@item Required: +T-concave PDF, mode, area +@item Speed: +Set-up: fast, Sampling: slow +@item Reinit: +supported +@item Reference: +@ifhtml +@ref{bib:LJa01,, [LJa01]} +@end ifhtml +@ifnothtml +[LJa01] +@end ifnothtml +@ifhtml +@ref{bib:LJa02,, [LJa02]} +@end ifhtml +@ifnothtml +[LJa02] +@end ifnothtml +@ifhtml +@ref{bib:HLD04,, [HLD04: Sect.6.3.1; Sect.6.3.2; Sect.6.4.1; Alg.6.4; Alg.6.5; Alg.6.7]} +@end ifhtml +@ifnothtml +[HLD04: Sect.6.3.1; Sect.6.3.2; Sect.6.4.1; Alg.6.4; Alg.6.5; Alg.6.7] +@end ifnothtml + +@end table + + +SROU is based on the ratio-of-uniforms method +(@pxref{Ratio-of-Uniforms}) that uses universal inequalities for +constructing a (universal) bounding rectangle. +It works for all @i{T}-concave distributions, including +log-concave and @i{T}-concave distributions with +@iftex +@math{T(x) = -1/\sqrt{x}.} +@end iftex +@ifhtml +@html +T(x) = -1/sqrt(x). +@end html +@end ifhtml +@ifinfo +@math{T(x) = -1/sqrt(x).} +@end ifinfo + +Moreover an (optional) parameter @code{r} can be given, to +adjust the generator to the given distribution. This parameter +is strongly related to the parameter @code{c} for transformed +density rejection (@pxref{TDR}) via the formula +@i{c = -r/(r+1)}. The rejection constant increases with higher +values for @code{r}. On the other hand, the given density must +be +@iftex +@math{T_c} +@end iftex +@ifhtml +@html +T_c +@end html +@end ifhtml +@ifinfo +@math{T_c} +@end ifinfo +-concave for the corresponding @i{c}. +The default setting for @code{r} is 1 which results in a very +simple code. (For other settings, sampling uniformly from the +acceptance region is more complicated.) + +Optionally the CDF at the mode can be given to increase the +performance of the algorithm. Then the rejection constant is +reduced by 1/2 and (if @code{r=1}) even a universal squeeze can +(but need not be) used. +A way to increase the performance of the algorithm when the +CDF at the mode is not provided is the usage of the mirror +principle (only if @code{r=1}). However, using squeezes and using +the mirror principle is only recommended when the PDF is +expensive to compute. + +The exact location of the mode and/or the area below the PDF can +be replace by appropriate bounds. Then the algorithm still works +but has larger rejection constants. + + +@subsubheading How To Use + + +SROU works for any continuous univariate distribution object with +given +@iftex +@math{T_c} +@end iftex +@ifhtml +@html +T_c +@end html +@end ifhtml +@ifinfo +@math{T_c} +@end ifinfo +-concave PDF with +@iftex +@math{c<1,} +@end iftex +@ifhtml +@html +c<1, +@end html +@end ifhtml +@ifinfo +@math{c<1,} +@end ifinfo +) +mode and area below PDF. Optional the CDF at the mode +can be given to increase the performance of the algorithm by +means of the +@ifhtml +@ref{funct:unur_srou_set_cdfatmode,@command{unur_srou_set_cdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_srou_set_cdfatmode} +@end ifnothtml +call. Additionally +squeezes can be used and switched on via +@ifhtml +@ref{funct:unur_srou_set_usesqueeze,@command{unur_srou_set_usesqueeze}} +@end ifhtml +@ifnothtml +@command{unur_srou_set_usesqueeze} +@end ifnothtml +(only if @code{r=1}). +A way to increase the performance of the algorithm when the +CDF at the mode is not provided is the usage of the mirror +principle which can be swithced on by means of a +@ifhtml +@ref{funct:unur_srou_set_usemirror,@command{unur_srou_set_usemirror}} +@end ifhtml +@ifnothtml +@command{unur_srou_set_usemirror} +@end ifnothtml +call (only if @code{r=1}) . +However using squeezes and using +the mirror principle is only recommended when the PDF is +expensive to compute. + +The parameter @code{r} can be given, to adjust the generator to +the given distribution. This parameter is strongly related +parameter @code{c} for transformed density rejection via the +formula @i{c = -r/(r+1)}. +The parameter @code{r} can be any value larger than or equal to +1. Values less then 1 are automatically set to 1. +The rejection constant depends on the chosen parameter +@code{r} but not on the particular distribution. It is 4 for +@code{r} equal to 1 and higher for higher values of @code{r}. +It is important to note that different algorithms for different +values of @code{r}: If @code{r} equal to 1 this is much faster +than the algorithm for @code{r} greater than 1. +The default setting for @code{r} is 1. + +If the (exact) area below the PDF is not known, then an upper +bound can be used instead (which of course increases the rejection +constant). But then the squeeze flag must not be set and +@ifhtml +@ref{funct:unur_srou_set_cdfatmode,@command{unur_srou_set_cdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_srou_set_cdfatmode} +@end ifnothtml +must not be used. + +If the exact location of the mode is not known, then use the +approximate location and provide the (exact) value of the PDF at +the mode by means of the +@ifhtml +@ref{funct:unur_srou_set_pdfatmode,@command{unur_srou_set_pdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_srou_set_pdfatmode} +@end ifnothtml +call. But then +@ifhtml +@ref{funct:unur_srou_set_cdfatmode,@command{unur_srou_set_cdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_srou_set_cdfatmode} +@end ifnothtml +must not be used. Notice, that a (slow) +numerical mode finder will be used if no mode is given at all. +It is even possible to give an upper bound for the PDF only. +However, then the (upper bound for the) area below the PDF has to be +multiplied by the ratio between the upper bound and the lower bound of +the PDF at the mode. Again setting the squeeze flag and using +@ifhtml +@ref{funct:unur_srou_set_cdfatmode,@command{unur_srou_set_cdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_srou_set_cdfatmode} +@end ifnothtml +is not allowed. + +It is possible to change the parameters and the domain of the chosen +distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator object. +Notice, that derived parameters like the mode must also be (re-) set +if the parameters or the domain has be changed. +Moreover, if the PDF at the mode has been provided by a +@ifhtml +@ref{funct:unur_srou_set_pdfatmode,@command{unur_srou_set_pdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_srou_set_pdfatmode} +@end ifnothtml +call, additionally +@ifhtml +@ref{funct:unur_srou_chg_pdfatmode,@command{unur_srou_chg_pdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_srou_chg_pdfatmode} +@end ifnothtml +must be used (otherwise this call is +not necessary since then this figure is computed directly from +the PDF). + +There exists a test mode that verifies whether the conditions +for the method are satisfied or not while sampling. It can be +switched on by calling +@ifhtml +@ref{funct:unur_srou_set_verify,@command{unur_srou_set_verify}} +@end ifhtml +@ifnothtml +@command{unur_srou_set_verify} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_srou_chg_verify,@command{unur_srou_chg_verify},} +@end ifhtml +@ifnothtml +@command{unur_srou_chg_verify}, +@end ifnothtml +respectively. Notice however that +sampling is (a little bit) slower then. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_srou_new,unur_srou_new} +@item @ref{funct:unur_srou_set_r,unur_srou_set_r} +@item @ref{funct:unur_srou_set_cdfatmode,unur_srou_set_cdfatmode} +@item @ref{funct:unur_srou_set_pdfatmode,unur_srou_set_pdfatmode} +@item @ref{funct:unur_srou_set_usesqueeze,unur_srou_set_usesqueeze} +@item @ref{funct:unur_srou_set_usemirror,unur_srou_set_usemirror} +@item @ref{funct:unur_srou_set_verify,unur_srou_set_verify} +@item @ref{funct:unur_srou_chg_verify,unur_srou_chg_verify} +@item @ref{funct:unur_srou_chg_cdfatmode,unur_srou_chg_cdfatmode} +@item @ref{funct:unur_srou_chg_pdfatmode,unur_srou_chg_pdfatmode} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_srou_new} +@deftypefn Function {UNUR_PAR*} unur_srou_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_srou_new} +@deftypefn {} {UNUR_PAR*} unur_srou_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_srou_set_r} +@deftypefn Function {int} unur_srou_set_r (UNUR_PAR* @var{parameters}, double @var{r}) +Set parameter @var{r} for transformation. +Only values greater than or equal to 1 are allowed. +The performance of the generator decreases when @var{r} is +increased. On the other hand @var{r} must not be set to small, +since the given density must be T_c-concave for +@i{c = -r/(r+1)}. + +@emph{Notice:} If @var{r} is set to @code{1} a simpler and much +faster algorithm is used then for @var{r} greater than one. + +For computational reasons values of @var{r} that are greater than +@code{1} but less than @code{1.01} are always set to @code{1.01}. + +Default is @code{1}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_srou_set_r} +@deftypefn {} {int} unur_srou_set_r (UNUR_PAR* @var{parameters}, double @var{r}) +Set parameter @var{r} for transformation. +Only values greater than or equal to 1 are allowed. +The performance of the generator decreases when @var{r} is +increased. On the other hand @var{r} must not be set to small, +since the given density must be T_c-concave for +@i{c = -r/(r+1)}. + +@emph{Notice:} If @var{r} is set to @code{1} a simpler and much +faster algorithm is used then for @var{r} greater than one. + +For computational reasons values of @var{r} that are greater than +@code{1} but less than @code{1.01} are always set to @code{1.01}. + +Default is @code{1}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_srou_set_cdfatmode} +@deftypefn Function {int} unur_srou_set_cdfatmode (UNUR_PAR* @var{parameters}, double @var{Fmode}) +Set CDF at mode. +When set, the performance of the algorithm is increased by factor 2. +However, when the parameters of the distribution are changed +@ifhtml +@ref{funct:unur_srou_chg_cdfatmode,@command{unur_srou_chg_cdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_srou_chg_cdfatmode} +@end ifnothtml +has to be used to update this value. + +Default: not set. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_srou_set_cdfatmode} +@deftypefn {} {int} unur_srou_set_cdfatmode (UNUR_PAR* @var{parameters}, double @var{Fmode}) +Set CDF at mode. +When set, the performance of the algorithm is increased by factor 2. +However, when the parameters of the distribution are changed +@ifhtml +@ref{funct:unur_srou_chg_cdfatmode,@command{unur_srou_chg_cdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_srou_chg_cdfatmode} +@end ifnothtml +has to be used to update this value. + +Default: not set. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_srou_set_pdfatmode} +@deftypefn Function {int} unur_srou_set_pdfatmode (UNUR_PAR* @var{parameters}, double @var{fmode}) +Set pdf at mode. +When set, the PDF at the mode is never changed. +This is to avoid additional computations, when the PDF does not +change when parameters of the distributions vary. +It is only useful when the PDF at the mode does not change with +changing parameters of the distribution. + +@emph{IMPORTANT:} +This call has to be executed after a possible call of +@ifhtml +@ref{funct:unur_srou_set_r,@command{unur_srou_set_r}.} +@end ifhtml +@ifnothtml +@command{unur_srou_set_r}. +@end ifnothtml +Default: not set. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_srou_set_pdfatmode} +@deftypefn {} {int} unur_srou_set_pdfatmode (UNUR_PAR* @var{parameters}, double @var{fmode}) +Set pdf at mode. +When set, the PDF at the mode is never changed. +This is to avoid additional computations, when the PDF does not +change when parameters of the distributions vary. +It is only useful when the PDF at the mode does not change with +changing parameters of the distribution. + +@emph{IMPORTANT:} +This call has to be executed after a possible call of +@ifhtml +@ref{funct:unur_srou_set_r,@command{unur_srou_set_r}.} +@end ifhtml +@ifnothtml +@command{unur_srou_set_r}. +@end ifnothtml +Default: not set. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_srou_set_usesqueeze} +@deftypefn Function {int} unur_srou_set_usesqueeze (UNUR_PAR* @var{parameters}, int @var{usesqueeze}) +Set flag for using universal squeeze (default: off). +Using squeezes is only useful when the evaluation of the PDF is +(extremely) expensive. +Using squeezes is automatically disabled when the CDF at the mode +is not given (then no universal squeezes exist). + +Squeezes can only be used if @code{r=1}. + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_srou_set_usesqueeze} +@deftypefn {} {int} unur_srou_set_usesqueeze (UNUR_PAR* @var{parameters}, int @var{usesqueeze}) +Set flag for using universal squeeze (default: off). +Using squeezes is only useful when the evaluation of the PDF is +(extremely) expensive. +Using squeezes is automatically disabled when the CDF at the mode +is not given (then no universal squeezes exist). + +Squeezes can only be used if @code{r=1}. + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_srou_set_usemirror} +@deftypefn Function {int} unur_srou_set_usemirror (UNUR_PAR* @var{parameters}, int @var{usemirror}) +Set flag for using mirror principle (default: off). +Using the mirror principle is only useful when the CDF at the +mode is not known and the evaluation of the PDF is rather cheap compared +to the marginal generation time of the underlying uniform random +number generator. +It is automatically disabled when the CDF at the mode is given. +(Then there is no necessity to use the mirror principle. However disabling +is only done during the initialization step but not at a re-initialization +step.) + +The mirror principle can only be used if @code{r=1}. + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_srou_set_usemirror} +@deftypefn {} {int} unur_srou_set_usemirror (UNUR_PAR* @var{parameters}, int @var{usemirror}) +Set flag for using mirror principle (default: off). +Using the mirror principle is only useful when the CDF at the +mode is not known and the evaluation of the PDF is rather cheap compared +to the marginal generation time of the underlying uniform random +number generator. +It is automatically disabled when the CDF at the mode is given. +(Then there is no necessity to use the mirror principle. However disabling +is only done during the initialization step but not at a re-initialization +step.) + +The mirror principle can only be used if @code{r=1}. + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_srou_set_verify} +@anchor{funct:unur_srou_chg_verify} +@deftypefn Function {int} unur_srou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx Function {int} unur_srou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_srou_set_verify} +@anchor{funct:unur_srou_chg_verify} +@deftypefn {} {int} unur_srou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx {} {int} unur_srou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_srou_chg_cdfatmode} +@deftypefn Function {int} unur_srou_chg_cdfatmode (UNUR_GEN* @var{generator}, double @var{Fmode}) +Change CDF at mode of distribution. +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +must be executed before sampling from the +generator again. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_srou_chg_cdfatmode} +@deftypefn {} {int} unur_srou_chg_cdfatmode (UNUR_GEN* @var{generator}, double @var{Fmode}) +Change CDF at mode of distribution. +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +must be executed before sampling from the +generator again. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_srou_chg_pdfatmode} +@deftypefn Function {int} unur_srou_chg_pdfatmode (UNUR_GEN* @var{generator}, double @var{fmode}) +Change PDF at mode of distribution. +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +must be executed before sampling from the +generator again. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_srou_chg_pdfatmode} +@deftypefn {} {int} unur_srou_chg_pdfatmode (UNUR_GEN* @var{generator}, double @var{fmode}) +Change PDF at mode of distribution. +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +must be executed before sampling from the +generator again. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of srou.h +@c ------------------------------------- +@c ------------------------------------- +@c ssr.h +@c + +@page +@node SSR +@subsection SSR -- Simple Setup Rejection + +@table @i +@item Required: +T-concave PDF, mode, area +@item Speed: +Set-up: fast, Sampling: slow +@item Reinit: +supported +@item Reference: +@ifhtml +@ref{bib:LJa01,, [LJa01]} +@end ifhtml +@ifnothtml +[LJa01] +@end ifnothtml +@ifhtml +@ref{bib:HLD04,, [HLD04: Sect.6.3.3; Alg.6.6]} +@end ifhtml +@ifnothtml +[HLD04: Sect.6.3.3; Alg.6.6] +@end ifnothtml + +@end table + + +SSR is an acceptance/rejection method that uses universal +inequalities for constructing (universal) hats and squeezes +(@pxref{Rejection}). +It works for all @i{T}-concave distributions with +@iftex +@math{T(x) = -1/\sqrt{x}.} +@end iftex +@ifhtml +@html +T(x) = -1/sqrt(x). +@end html +@end ifhtml +@ifinfo +@math{T(x) = -1/sqrt(x).} +@end ifinfo + +It requires the PDF, the (exact) location of the mode and the +area below the given PDF. The rejection constant is 4 for all +@i{T}-concave distributions with unbounded domain and is less +than 4 when the domain is bounded. Optionally the CDF at the +mode can be given to increase the performance of the algorithm. +Then the rejection constant is at most 2 and a universal squeeze +can (but need not be) used. However, using squeezes is not +recommended unless the evaluation of the PDF is expensive. + +The exact location of the mode and/or the area below the PDF can +be replace by appropriate bounds. Then the algorithm still works +but has larger rejection constants. + + +@subsubheading How To Use + + +SSR works for any continuous univariate distribution object with +given @i{T}-concave PDF (with +@iftex +@math{T(x) = -1/\sqrt{x},)} +@end iftex +@ifhtml +@html +T(x) = -1/sqrt(x),) +@end html +@end ifhtml +@ifinfo +@math{T(x) = -1/sqrt(x),)} +@end ifinfo +mode and area below PDF. Optional the CDF at the mode +can be given to increase the performance of the algorithm by +means of the +@ifhtml +@ref{funct:unur_ssr_set_cdfatmode,@command{unur_ssr_set_cdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_ssr_set_cdfatmode} +@end ifnothtml +call. Additionally +squeezes can be used and switched on via +@ifhtml +@ref{funct:unur_ssr_set_usesqueeze,@command{unur_ssr_set_usesqueeze}.} +@end ifhtml +@ifnothtml +@command{unur_ssr_set_usesqueeze}. +@end ifnothtml +If the (exact) area below the PDF is not known, then an upper +bound can be used instead (which of course increases the rejection +constant). But then the squeeze flag must not be set and +@ifhtml +@ref{funct:unur_ssr_set_cdfatmode,@command{unur_ssr_set_cdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_ssr_set_cdfatmode} +@end ifnothtml +must not be used. + +If the exact location of the mode is not known, then use the +approximate location and provide the (exact) value of the PDF at +the mode by means of the +@ifhtml +@ref{funct:unur_ssr_set_pdfatmode,@command{unur_ssr_set_pdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_ssr_set_pdfatmode} +@end ifnothtml +call. But then +@ifhtml +@ref{funct:unur_ssr_set_cdfatmode,@command{unur_ssr_set_cdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_ssr_set_cdfatmode} +@end ifnothtml +must not be used. Notice, that a (slow) +numerical mode finder will be used if no mode is given at all. +It is even possible to give an upper bound for the PDF only. +However, then the (upper bound for the) area below the PDF has to be +multiplied by the ratio between the upper bound and the lower bound of +the PDF at the mode. Again setting the squeeze flag and using +@ifhtml +@ref{funct:unur_ssr_set_cdfatmode,@command{unur_ssr_set_cdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_ssr_set_cdfatmode} +@end ifnothtml +is not allowed. + +It is possible to change the parameters and the domain of the chosen +distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator object. +Notice, that derived parameters like the mode must also be (re-) set +if the parameters or the domain has be changed. +Moreover, if the PDF at the mode has been provided by a +@ifhtml +@ref{funct:unur_ssr_set_pdfatmode,@command{unur_ssr_set_pdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_ssr_set_pdfatmode} +@end ifnothtml +call, additionally +@ifhtml +@ref{funct:unur_ssr_chg_pdfatmode,@command{unur_ssr_chg_pdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_ssr_chg_pdfatmode} +@end ifnothtml +must be used (otherwise this call is +not necessary since then this figure is computed directly from +the PDF). + +@emph{Important:} +If any of mode, PDF or CDF at the mode, or the area below the mode +has been changed, then +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +must be executed. +(Otherwise the generator produces garbage). + +There exists a test mode that verifies whether the conditions for +the method are satisfied or not while sampling. It can be +switched on/off by calling +@ifhtml +@ref{funct:unur_ssr_set_verify,@command{unur_ssr_set_verify}} +@end ifhtml +@ifnothtml +@command{unur_ssr_set_verify} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_ssr_chg_verify,@command{unur_ssr_chg_verify},} +@end ifhtml +@ifnothtml +@command{unur_ssr_chg_verify}, +@end ifnothtml +respectively. +Notice, however, that sampling is (a little bit) slower then. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_ssr_new,unur_ssr_new} +@item @ref{funct:unur_ssr_set_cdfatmode,unur_ssr_set_cdfatmode} +@item @ref{funct:unur_ssr_set_pdfatmode,unur_ssr_set_pdfatmode} +@item @ref{funct:unur_ssr_set_usesqueeze,unur_ssr_set_usesqueeze} +@item @ref{funct:unur_ssr_set_verify,unur_ssr_set_verify} +@item @ref{funct:unur_ssr_chg_verify,unur_ssr_chg_verify} +@item @ref{funct:unur_ssr_chg_cdfatmode,unur_ssr_chg_cdfatmode} +@item @ref{funct:unur_ssr_chg_pdfatmode,unur_ssr_chg_pdfatmode} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_ssr_new} +@deftypefn Function {UNUR_PAR*} unur_ssr_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ssr_new} +@deftypefn {} {UNUR_PAR*} unur_ssr_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ssr_set_cdfatmode} +@deftypefn Function {int} unur_ssr_set_cdfatmode (UNUR_PAR* @var{parameters}, double @var{Fmode}) +Set CDF at mode. +When set, the performance of the algorithm is increased by factor 2. +However, when the parameters of the distribution are changed +@ifhtml +@ref{funct:unur_ssr_chg_cdfatmode,@command{unur_ssr_chg_cdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_ssr_chg_cdfatmode} +@end ifnothtml +has to be used to update this value. + +Default: not set. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ssr_set_cdfatmode} +@deftypefn {} {int} unur_ssr_set_cdfatmode (UNUR_PAR* @var{parameters}, double @var{Fmode}) +Set CDF at mode. +When set, the performance of the algorithm is increased by factor 2. +However, when the parameters of the distribution are changed +@ifhtml +@ref{funct:unur_ssr_chg_cdfatmode,@command{unur_ssr_chg_cdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_ssr_chg_cdfatmode} +@end ifnothtml +has to be used to update this value. + +Default: not set. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ssr_set_pdfatmode} +@deftypefn Function {int} unur_ssr_set_pdfatmode (UNUR_PAR* @var{parameters}, double @var{fmode}) +Set pdf at mode. +When set, the PDF at the mode is never changed. +This is to avoid additional computations, when the PDF does not +change when parameters of the distributions vary. +It is only useful when the PDF at the mode does not change with +changing parameters for the distribution. + +Default: not set. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ssr_set_pdfatmode} +@deftypefn {} {int} unur_ssr_set_pdfatmode (UNUR_PAR* @var{parameters}, double @var{fmode}) +Set pdf at mode. +When set, the PDF at the mode is never changed. +This is to avoid additional computations, when the PDF does not +change when parameters of the distributions vary. +It is only useful when the PDF at the mode does not change with +changing parameters for the distribution. + +Default: not set. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ssr_set_usesqueeze} +@deftypefn Function {int} unur_ssr_set_usesqueeze (UNUR_PAR* @var{parameters}, int @var{usesqueeze}) +Set flag for using universal squeeze (default: off). +Using squeezes is only useful when the evaluation of the PDF is +(extremely) expensive. +Using squeezes is automatically disabled when the CDF at the mode +is not given (then no universal squeezes exist). + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ssr_set_usesqueeze} +@deftypefn {} {int} unur_ssr_set_usesqueeze (UNUR_PAR* @var{parameters}, int @var{usesqueeze}) +Set flag for using universal squeeze (default: off). +Using squeezes is only useful when the evaluation of the PDF is +(extremely) expensive. +Using squeezes is automatically disabled when the CDF at the mode +is not given (then no universal squeezes exist). + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ssr_set_verify} +@anchor{funct:unur_ssr_chg_verify} +@deftypefn Function {int} unur_ssr_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx Function {int} unur_ssr_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ssr_set_verify} +@anchor{funct:unur_ssr_chg_verify} +@deftypefn {} {int} unur_ssr_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx {} {int} unur_ssr_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ssr_chg_cdfatmode} +@deftypefn Function {int} unur_ssr_chg_cdfatmode (UNUR_GEN* @var{generator}, double @var{Fmode}) +Change CDF at mode of distribution. +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +must be executed before sampling from the +generator again. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ssr_chg_cdfatmode} +@deftypefn {} {int} unur_ssr_chg_cdfatmode (UNUR_GEN* @var{generator}, double @var{Fmode}) +Change CDF at mode of distribution. +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +must be executed before sampling from the +generator again. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_ssr_chg_pdfatmode} +@deftypefn Function {int} unur_ssr_chg_pdfatmode (UNUR_GEN* @var{generator}, double @var{fmode}) +Change PDF at mode of distribution. +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +must be executed before sampling from the +generator again. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_ssr_chg_pdfatmode} +@deftypefn {} {int} unur_ssr_chg_pdfatmode (UNUR_GEN* @var{generator}, double @var{fmode}) +Change PDF at mode of distribution. +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +must be executed before sampling from the +generator again. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of ssr.h +@c ------------------------------------- +@c ------------------------------------- +@c tabl.h +@c + +@page +@node TABL +@subsection TABL -- a TABLe method with piecewise constant hats + +@table @i +@item Required: +PDF, all local extrema, cut-off values for the tails +@item Optional: +approximate area +@item Speed: +Set-up: (very) slow, Sampling: fast +@item Reinit: +not implemented +@item Reference: +@ifhtml +@ref{bib:AJa93,, [AJa93]} +@end ifhtml +@ifnothtml +[AJa93] +@end ifnothtml +@ifhtml +@ref{bib:AJa95,, [AJa95]} +@end ifhtml +@ifnothtml +[AJa95] +@end ifnothtml +@ifhtml +@ref{bib:HLD04,, [HLD04: Cha.5.1]} +@end ifhtml +@ifnothtml +[HLD04: Cha.5.1] +@end ifnothtml + +@end table + + +TABL (called Ahrens method in +@ifhtml +@ref{bib:HLD04,, [HLD04]} +@end ifhtml +@ifnothtml +[HLD04] +@end ifnothtml +) +is an acceptance/rejection method (@pxref{Rejection}) that uses +a decomposition of the domain of the distribution into many +short subintervals. Inside of these subintervals constant hat +and squeeze functions are utilized. Thus it is easy to use the +idea of immediate acceptance for points below the squeeze. This +reduces the expected number of uniform random numbers per +generated random variate to less than two. Using a large number +of subintervals only little more than one random number is +necessary on average. Thus this method becomes very fast. + +Due to the constant hat function this method only works for +distributions with bounded domains. Thus for unbounded domains +the left and right tails have to be cut off. This is no problem +when the probability of falling into these tail regions is +beyond computational relevance (e.g. smaller than @code{1.e-12}). + +For easy construction of hat and squeeze functions it is necessary +to know the regions of monotonicity (called @emph{slopes}) or +equivalently all local maxima and minima of the density. +The main problem for this method in the setup is the choice of the +subintervals. A simple and close to optimal approach is the +"equal area rule" +@ifhtml +@ref{bib:HLD04,, [HLD04: Cha.5.1]} +@end ifhtml +@ifnothtml +[HLD04: Cha.5.1] +@end ifnothtml +. There the subintervals are +selected such that the area below the hat is the same for +each subinterval which can be realized with a simple recursion. +If more subintervals are necessary it is possible to split +either randomly chosen intervals (adaptive rejection sampling, ARS) +or those intervals, where the ratio between squeeze and hat is +smallest. This version of the setup is called derandomized ARS +(DARS). With the default settings TABL is first calculating +approximately 30 subintervals with the equal area rule. Then +DARS is used till the desired fit of the hat is reached. + +A convenient measure to control the quality of the fit of hat +and squeeze is the ratio (area below squeeze)/(area below hat) +called @code{sqhratio} which must be smaller or equal to one. +The expected number of iterations in the rejection algorithm +is known to be smaller than 1/sqhratio and the expected number +of evaluations of the density is bounded by @code{1/sqhratio - 1}. +So values of the sqhratio close to one (e.g. @code{0.95} or +@code{0.99}) lead to many subintervals. Thus a better fitting +hat is constructed and the sampling algorithm becomes fast; on +the other hand large tables are needed and the setup is very +slow. For moderate values of sqhratio (e.g. @code{0.9} or +@code{0.8}) the sampling is slower but the required tables are +smaller and the setup is not so slow. + +It follows from the above explanations that TABL is always +requiring a slow setup and that it is not very well suited for +heavy-tailed distributions. + + +@subsubheading How To Use + + + +For using the TABL method UNU.RAN needs a bounded interval to +which the generated variates can be restricted and information +about all local extrema of the distribution. For unimodal +densities it is sufficient to provide the mode of the +distribution. For the case of a built-in unimodal distribution +with bounded domain all these information is present in the +distribution object and thus no extra input is necessary (see +example_TABL1 below). + +For a built-in unimodal distribution with unbounded domain we +should specify the cut-off values for the tails. This can be +done with the +@ifhtml +@ref{funct:unur_tabl_set_boundary,@command{unur_tabl_set_boundary}} +@end ifhtml +@ifnothtml +@command{unur_tabl_set_boundary} +@end ifnothtml +call (see example_TABL2 +below). For the case that we do not set these boundaries the +default values of @code{+/- 1.e20} are used. We can see in +example_TABL1 that this still works fine for many standard +distributions. + +For the case of a multimodal distribution we have to set the +regions of monotonicity (called slopes) explicitly using the +@ifhtml +@ref{funct:unur_tabl_set_slopes,@command{unur_tabl_set_slopes}} +@end ifhtml +@ifnothtml +@command{unur_tabl_set_slopes} +@end ifnothtml +command (see example_TABL3 below). + +To controll the fit of the hat and the size of the tables and +thus the speed of the setup and the sampling it is most +convenient to use the +@ifhtml +@ref{funct:unur_tabl_set_max_sqhratio,@command{unur_tabl_set_max_sqhratio}} +@end ifhtml +@ifnothtml +@command{unur_tabl_set_max_sqhratio} +@end ifnothtml +call. The +default is @code{0.9} which is a sensible value for most +distributions and applications. If very large samples of a +distribution are required or the evaluation of a density is very +slow it may be useful to increase the sqhratio to +eg. @code{0.95} or even @code{0.99}. With the +@ifhtml +@ref{funct:unur_tabl_get_sqhratio,@command{unur_tabl_get_sqhratio}} +@end ifhtml +@ifnothtml +@command{unur_tabl_get_sqhratio} +@end ifnothtml +call we can check which sqhratio was +really reached. If that value is below the desired value it is +necessary to increase the maximal number of subintervals, which +defaults to @code{1000}, using the +@ifhtml +@ref{funct:unur_tabl_set_max_intervals,@command{unur_tabl_set_max_intervals}} +@end ifhtml +@ifnothtml +@command{unur_tabl_set_max_intervals} +@end ifnothtml +call. +The +@ifhtml +@ref{funct:unur_tabl_get_n_intervals,@command{unur_tabl_get_n_intervals}} +@end ifhtml +@ifnothtml +@command{unur_tabl_get_n_intervals} +@end ifnothtml +call can be used to find out the +number of subintervals the setup calculated. + +It is also possible to set the number of intervals and their +respective boundaries by means of the +@ifhtml +@ref{funct:unur_tabl_set_cpoints,@command{unur_tabl_set_cpoints}} +@end ifhtml +@ifnothtml +@command{unur_tabl_set_cpoints} +@end ifnothtml +call. + +It is also possible to use method TABL for correlation induction +(variance reduction) by setting of an auxiliary uniform random +number generator via the +@ifhtml +@ref{funct:unur_set_urng_aux,@command{unur_set_urng_aux}} +@end ifhtml +@ifnothtml +@command{unur_set_urng_aux} +@end ifnothtml +call. (Notice that +this must be done after a possible +@ifhtml +@ref{funct:unur_set_urng,@command{unur_set_urng}} +@end ifhtml +@ifnothtml +@command{unur_set_urng} +@end ifnothtml +call.) +However, this only works when immediate acceptance is switched +off by a +@ifhtml +@ref{funct:unur_tabl_set_variant_ia,@command{unur_tabl_set_variant_ia}} +@end ifhtml +@ifnothtml +@command{unur_tabl_set_variant_ia} +@end ifnothtml +call. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_tabl_new,unur_tabl_new} +@item @ref{funct:unur_tabl_set_variant_ia,unur_tabl_set_variant_ia} +@item @ref{funct:unur_tabl_set_cpoints,unur_tabl_set_cpoints} +@item @ref{funct:unur_tabl_set_nstp,unur_tabl_set_nstp} +@item @ref{funct:unur_tabl_set_useear,unur_tabl_set_useear} +@item @ref{funct:unur_tabl_set_areafraction,unur_tabl_set_areafraction} +@item @ref{funct:unur_tabl_set_usedars,unur_tabl_set_usedars} +@item @ref{funct:unur_tabl_set_darsfactor,unur_tabl_set_darsfactor} +@item @ref{funct:unur_tabl_set_variant_splitmode,unur_tabl_set_variant_splitmode} +@item @ref{funct:unur_tabl_set_max_sqhratio,unur_tabl_set_max_sqhratio} +@item @ref{funct:unur_tabl_get_sqhratio,unur_tabl_get_sqhratio} +@item @ref{funct:unur_tabl_get_hatarea,unur_tabl_get_hatarea} +@item @ref{funct:unur_tabl_get_squeezearea,unur_tabl_get_squeezearea} +@item @ref{funct:unur_tabl_set_max_intervals,unur_tabl_set_max_intervals} +@item @ref{funct:unur_tabl_get_n_intervals,unur_tabl_get_n_intervals} +@item @ref{funct:unur_tabl_set_slopes,unur_tabl_set_slopes} +@item @ref{funct:unur_tabl_set_guidefactor,unur_tabl_set_guidefactor} +@item @ref{funct:unur_tabl_set_boundary,unur_tabl_set_boundary} +@item @ref{funct:unur_tabl_chg_truncated,unur_tabl_chg_truncated} +@item @ref{funct:unur_tabl_set_verify,unur_tabl_set_verify} +@item @ref{funct:unur_tabl_chg_verify,unur_tabl_chg_verify} +@item @ref{funct:unur_tabl_set_pedantic,unur_tabl_set_pedantic} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_tabl_new} +@deftypefn Function {UNUR_PAR*} unur_tabl_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_new} +@deftypefn {} {UNUR_PAR*} unur_tabl_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_set_variant_ia} +@deftypefn Function {int} unur_tabl_set_variant_ia (UNUR_PAR* @var{parameters}, int @var{use_ia}) +Use immediate acceptance when @var{use_ia} is set to @code{TRUE}. +This technique requires less uniform. If it is set to @code{FALSE}, +``classical'' acceptance/rejection from hat distribution +is used. + +@emph{Notice:} Auxiliary uniform random number generators for +correlation induction (variance reduction) can only be used when +``classical'' acceptance/rejection is used. + +Default: @code{TRUE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_set_variant_ia} +@deftypefn {} {int} unur_tabl_set_variant_ia (UNUR_PAR* @var{parameters}, int @var{use_ia}) +Use immediate acceptance when @var{use_ia} is set to @code{TRUE}. +This technique requires less uniform. If it is set to @code{FALSE}, +``classical'' acceptance/rejection from hat distribution +is used. + +@emph{Notice:} Auxiliary uniform random number generators for +correlation induction (variance reduction) can only be used when +``classical'' acceptance/rejection is used. + +Default: @code{TRUE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_set_cpoints} +@deftypefn Function {int} unur_tabl_set_cpoints (UNUR_PAR* @var{parameters}, int @var{n_cpoints}, const @var{double* cpoints}) +Set construction points for the hat function. If @var{stp} is @code{NULL} +than a heuristic rule of thumb is used to get @var{n_stp} +construction points. This is the default behavior. + +The default number of construction points is @code{30}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_set_cpoints} +@deftypefn {} {int} unur_tabl_set_cpoints (UNUR_PAR* @var{parameters}, int @var{n_cpoints}, const @var{double* cpoints}) +Set construction points for the hat function. If @var{stp} is @code{NULL} +than a heuristic rule of thumb is used to get @var{n_stp} +construction points. This is the default behavior. + +The default number of construction points is @code{30}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_set_nstp} +@deftypefn Function {int} unur_tabl_set_nstp (UNUR_PAR* @var{parameters}, int @var{n_stp}) +Set number of construction points for the hat function. @var{n_stp} +must be greater than zero. After the setup there are about +@var{n_stp} construction points. However it might be larger when a +small fraction is given by the +@ifhtml +@ref{funct:unur_tabl_set_areafraction,@command{unur_tabl_set_areafraction}} +@end ifhtml +@ifnothtml +@command{unur_tabl_set_areafraction} +@end ifnothtml +call. +It also might be smaller for some variants. + +Default is @code{30}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_set_nstp} +@deftypefn {} {int} unur_tabl_set_nstp (UNUR_PAR* @var{parameters}, int @var{n_stp}) +Set number of construction points for the hat function. @var{n_stp} +must be greater than zero. After the setup there are about +@var{n_stp} construction points. However it might be larger when a +small fraction is given by the +@ifhtml +@ref{funct:unur_tabl_set_areafraction,@command{unur_tabl_set_areafraction}} +@end ifhtml +@ifnothtml +@command{unur_tabl_set_areafraction} +@end ifnothtml +call. +It also might be smaller for some variants. + +Default is @code{30}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_set_useear} +@deftypefn Function {int} unur_tabl_set_useear (UNUR_PAR* @var{parameters}, int @var{useear}) +If @var{useear} is set to @code{TRUE}, the ``equal area rule'' is used, +the given slopes are partitioned in such a way that the area below +the hat function in each subinterval (``stripe'') has the same +area (except the last the last interval which can be smaller). +The area can be set by means of the +@ifhtml +@ref{funct:unur_tabl_set_areafraction,@command{unur_tabl_set_areafraction}} +@end ifhtml +@ifnothtml +@command{unur_tabl_set_areafraction} +@end ifnothtml +call. + +Default is @code{TRUE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_set_useear} +@deftypefn {} {int} unur_tabl_set_useear (UNUR_PAR* @var{parameters}, int @var{useear}) +If @var{useear} is set to @code{TRUE}, the ``equal area rule'' is used, +the given slopes are partitioned in such a way that the area below +the hat function in each subinterval (``stripe'') has the same +area (except the last the last interval which can be smaller). +The area can be set by means of the +@ifhtml +@ref{funct:unur_tabl_set_areafraction,@command{unur_tabl_set_areafraction}} +@end ifhtml +@ifnothtml +@command{unur_tabl_set_areafraction} +@end ifnothtml +call. + +Default is @code{TRUE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_set_areafraction} +@deftypefn Function {int} unur_tabl_set_areafraction (UNUR_PAR* @var{parameters}, double @var{fraction}) +Set parameter for the equal area rule. During the setup a piecewise +constant hat is constructed, such that the area below each of these +pieces (strips) is the same and equal to the (given) area below the +PDF times @var{fraction} (which must be greater than +zero). + +@emph{Important:} If the area below the PDF is not set in the +distribution object, then 1 is assumed. + +Default is @code{0.1}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_set_areafraction} +@deftypefn {} {int} unur_tabl_set_areafraction (UNUR_PAR* @var{parameters}, double @var{fraction}) +Set parameter for the equal area rule. During the setup a piecewise +constant hat is constructed, such that the area below each of these +pieces (strips) is the same and equal to the (given) area below the +PDF times @var{fraction} (which must be greater than +zero). + +@emph{Important:} If the area below the PDF is not set in the +distribution object, then 1 is assumed. + +Default is @code{0.1}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_set_usedars} +@deftypefn Function {int} unur_tabl_set_usedars (UNUR_PAR* @var{parameters}, int @var{usedars}) +If @var{usedars} is set to @code{TRUE}, ``derandomized adaptive rejection +sampling'' (DARS) is used in the setup. +Intervals, where the area between hat and squeeze is too +large compared to the average area between hat and squeeze +over all intervals, are split. +This procedure is repeated until the ratio between squeeze and hat +exceeds the bound given by +@ifhtml +@ref{funct:unur_tabl_set_max_sqhratio,@command{unur_tabl_set_max_sqhratio}} +@end ifhtml +@ifnothtml +@command{unur_tabl_set_max_sqhratio} +@end ifnothtml +call or the +maximum number of intervals is reached. Moreover, it also aborts +when no more intervals can be found for splitting. + +For finding splitting points the arc-mean rule (a mixture of +arithmetic mean and harmonic mean) is used. + +Default is @code{TRUE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_set_usedars} +@deftypefn {} {int} unur_tabl_set_usedars (UNUR_PAR* @var{parameters}, int @var{usedars}) +If @var{usedars} is set to @code{TRUE}, ``derandomized adaptive rejection +sampling'' (DARS) is used in the setup. +Intervals, where the area between hat and squeeze is too +large compared to the average area between hat and squeeze +over all intervals, are split. +This procedure is repeated until the ratio between squeeze and hat +exceeds the bound given by +@ifhtml +@ref{funct:unur_tabl_set_max_sqhratio,@command{unur_tabl_set_max_sqhratio}} +@end ifhtml +@ifnothtml +@command{unur_tabl_set_max_sqhratio} +@end ifnothtml +call or the +maximum number of intervals is reached. Moreover, it also aborts +when no more intervals can be found for splitting. + +For finding splitting points the arc-mean rule (a mixture of +arithmetic mean and harmonic mean) is used. + +Default is @code{TRUE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_set_darsfactor} +@deftypefn Function {int} unur_tabl_set_darsfactor (UNUR_PAR* @var{parameters}, double @var{factor}) +Set factor for ``derandomized adaptive rejection sampling''. +This factor is used to determine the segments that are ``too +large'', that is, all segments where the area between squeeze and +hat is larger than @var{factor} times the average area over all +intervals between squeeze and hat. +Notice that all segments are split when @var{factor} is set to +@code{0.}, and that there is no splitting at all when @var{factor} +is set to @code{UNUR_INFINITY}. + +Default is @code{0.99}. There is no need to change this parameter. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_set_darsfactor} +@deftypefn {} {int} unur_tabl_set_darsfactor (UNUR_PAR* @var{parameters}, double @var{factor}) +Set factor for ``derandomized adaptive rejection sampling''. +This factor is used to determine the segments that are ``too +large'', that is, all segments where the area between squeeze and +hat is larger than @var{factor} times the average area over all +intervals between squeeze and hat. +Notice that all segments are split when @var{factor} is set to +@code{0.}, and that there is no splitting at all when @var{factor} +is set to @code{UNUR_INFINITY}. + +Default is @code{0.99}. There is no need to change this parameter. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_set_variant_splitmode} +@deftypefn Function {int} unur_tabl_set_variant_splitmode (UNUR_PAR* @var{parameters}, unsigned @var{splitmode}) +There are three variants for adaptive rejection sampling. These +differ in the way how an interval is split: +@table @r +@item splitmode @code{1} +use the generated point to split the interval. +@item splitmode @code{2} +use the mean point of the interval. +@item splitmode @code{3} +use the arcmean point; +suggested for distributions with heavy tails. + +@end table +Default is splitmode @code{2}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_set_variant_splitmode} +@deftypefn {} {int} unur_tabl_set_variant_splitmode (UNUR_PAR* @var{parameters}, unsigned @var{splitmode}) +There are three variants for adaptive rejection sampling. These +differ in the way how an interval is split: +@table @r +@item splitmode @code{1} +use the generated point to split the interval. +@item splitmode @code{2} +use the mean point of the interval. +@item splitmode @code{3} +use the arcmean point; +suggested for distributions with heavy tails. + +@end table +Default is splitmode @code{2}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_set_max_sqhratio} +@deftypefn Function {int} unur_tabl_set_max_sqhratio (UNUR_PAR* @var{parameters}, double @var{max_ratio}) +Set upper bound for the +ratio (area below squeeze) / (area below hat). +It must be a number between 0 and 1. +When the ratio exceeds the given number no further construction +points are inserted via DARS in the setup. + +For the case of ARS (unur_tabl_set_usedars() must be set to @code{FALSE}): +Use @code{0} if no construction points should be added after the setup. +Use @code{1} if added new construction points should not be stopped +until the maximum number of construction points is reached. +If @var{max_ratio} is close to one, many construction points are used. + +Default is @code{0.9}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_set_max_sqhratio} +@deftypefn {} {int} unur_tabl_set_max_sqhratio (UNUR_PAR* @var{parameters}, double @var{max_ratio}) +Set upper bound for the +ratio (area below squeeze) / (area below hat). +It must be a number between 0 and 1. +When the ratio exceeds the given number no further construction +points are inserted via DARS in the setup. + +For the case of ARS (unur_tabl_set_usedars() must be set to @code{FALSE}): +Use @code{0} if no construction points should be added after the setup. +Use @code{1} if added new construction points should not be stopped +until the maximum number of construction points is reached. +If @var{max_ratio} is close to one, many construction points are used. + +Default is @code{0.9}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_get_sqhratio} +@deftypefn Function {double} unur_tabl_get_sqhratio (const @var{UNUR_GEN* generator}) +Get the current ratio (area below squeeze) / (area below hat) +for the generator. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_get_sqhratio} +@deftypefn {} {double} unur_tabl_get_sqhratio (const @var{UNUR_GEN* generator}) +Get the current ratio (area below squeeze) / (area below hat) +for the generator. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_get_hatarea} +@deftypefn Function {double} unur_tabl_get_hatarea (const @var{UNUR_GEN* generator}) +Get the area below the hat for the generator. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_get_hatarea} +@deftypefn {} {double} unur_tabl_get_hatarea (const @var{UNUR_GEN* generator}) +Get the area below the hat for the generator. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_get_squeezearea} +@deftypefn Function {double} unur_tabl_get_squeezearea (const @var{UNUR_GEN* generator}) +Get the area below the squeeze for the generator. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_get_squeezearea} +@deftypefn {} {double} unur_tabl_get_squeezearea (const @var{UNUR_GEN* generator}) +Get the area below the squeeze for the generator. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_set_max_intervals} +@deftypefn Function {int} unur_tabl_set_max_intervals (UNUR_PAR* @var{parameters}, int @var{max_ivs}) +Set maximum number of intervals. +No construction points are added in or after the setup when the +number of intervals suceeds @var{max_ivs}. + +Default is @code{1000}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_set_max_intervals} +@deftypefn {} {int} unur_tabl_set_max_intervals (UNUR_PAR* @var{parameters}, int @var{max_ivs}) +Set maximum number of intervals. +No construction points are added in or after the setup when the +number of intervals suceeds @var{max_ivs}. + +Default is @code{1000}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_get_n_intervals} +@deftypefn Function {int} unur_tabl_get_n_intervals (const @var{UNUR_GEN* generator}) +Get the current number of intervals. +(In case of an error 0 is returned.) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_get_n_intervals} +@deftypefn {} {int} unur_tabl_get_n_intervals (const @var{UNUR_GEN* generator}) +Get the current number of intervals. +(In case of an error 0 is returned.) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_set_slopes} +@deftypefn Function {int} unur_tabl_set_slopes (UNUR_PAR* @var{parameters}, const @var{double* slopes}, int @var{n_slopes}) +Set slopes for the PDF. +A slope is an interval [a,b] or [b,a] where the PDF is +monotone and PDF(a) >= PDF(b). +The list of slopes is given by an array @var{slopes} where each +consecutive tuple (i.e. @code{(slopes[0], slopes[1])}, +@code{(slopes[2], slopes[3])}, etc.) defines one slope. +Slopes must be sorted (i.e. both @code{slopes[0]} and +@code{slopes[1]} must not be greater than any entry of the slope +@code{(slopes[2], slopes[3])}, etc.) +and must not be overlapping. Otherwise no slopes are set and +@var{unur_errno} is set to @code{UNUR_ERR_PAR_SET}. + +@emph{Notice:} @var{n_slopes} is the number of slopes (and not the +length of the array @var{slopes}). + +@emph{Notice} that setting slopes resets the given domain for the +distribution. However, in case of a standard distribution the area +below the PDF is not updated. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_set_slopes} +@deftypefn {} {int} unur_tabl_set_slopes (UNUR_PAR* @var{parameters}, const @var{double* slopes}, int @var{n_slopes}) +Set slopes for the PDF. +A slope is an interval [a,b] or [b,a] where the PDF is +monotone and PDF(a) >= PDF(b). +The list of slopes is given by an array @var{slopes} where each +consecutive tuple (i.e. @code{(slopes[0], slopes[1])}, +@code{(slopes[2], slopes[3])}, etc.) defines one slope. +Slopes must be sorted (i.e. both @code{slopes[0]} and +@code{slopes[1]} must not be greater than any entry of the slope +@code{(slopes[2], slopes[3])}, etc.) +and must not be overlapping. Otherwise no slopes are set and +@var{unur_errno} is set to @code{UNUR_ERR_PAR_SET}. + +@emph{Notice:} @var{n_slopes} is the number of slopes (and not the +length of the array @var{slopes}). + +@emph{Notice} that setting slopes resets the given domain for the +distribution. However, in case of a standard distribution the area +below the PDF is not updated. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_set_guidefactor} +@deftypefn Function {int} unur_tabl_set_guidefactor (UNUR_PAR* @var{parameters}, double @var{factor}) +Set factor for relative size of the guide table for indexed search +(see also method DGT @ref{DGT}). It must be greater than or equal +to @code{0}. +When set to @code{0}, then sequential search is used. + +Default is @code{1}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_set_guidefactor} +@deftypefn {} {int} unur_tabl_set_guidefactor (UNUR_PAR* @var{parameters}, double @var{factor}) +Set factor for relative size of the guide table for indexed search +(see also method DGT @ref{DGT}). It must be greater than or equal +to @code{0}. +When set to @code{0}, then sequential search is used. + +Default is @code{1}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_set_boundary} +@deftypefn Function {int} unur_tabl_set_boundary (UNUR_PAR* @var{parameters}, double @var{left}, double @var{right}) +Set the left and right boundary of the computation interval. +The piecewise hat is only constructed inside this interval. The +probability outside of this region must not be of +computational relevance. +Of course @code{+/- UNUR_INFINITY} is not allowed. + +Default is @code{-1.e20,1.e20}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_set_boundary} +@deftypefn {} {int} unur_tabl_set_boundary (UNUR_PAR* @var{parameters}, double @var{left}, double @var{right}) +Set the left and right boundary of the computation interval. +The piecewise hat is only constructed inside this interval. The +probability outside of this region must not be of +computational relevance. +Of course @code{+/- UNUR_INFINITY} is not allowed. + +Default is @code{-1.e20,1.e20}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_chg_truncated} +@deftypefn Function {int} unur_tabl_chg_truncated (UNUR_GEN* @var{gen}, double @var{left}, double @var{right}) +Change the borders of the domain of the (truncated) distribution. + +Notice that the given truncated domain must be a subset of the +domain of the given distribution. The generator always uses the +intersection of the domain of the distribution and the truncated +domain given by this call. The hat function will not be changed. + +@emph{Important:} +The ratio between the area below the hat and the area below the +squeeze changes when the sampling region is restricted. In particalur +it becomes (very) large when sampling from the (far) tail of the +distribution. Then it is better to create a generator object for the +tail of distribution only. + +@emph{Important:} +This call does not work for variant @code{IA} (immediate +acceptance). In this case UNU.RAN switches @emph{automatically} to +variant @code{RH} (use ``classical'' acceptance/rejection from hat +distribution) and does revert to the variant originally set by the +user. + +@emph{Important:} +It is not a good idea to use adaptave rejection sampling while +sampling from a domain that is a strict subset of the domain that +has been used to construct the hat. +For that reason adaptive adding of construction points is +@emph{automatically disabled} by this call. + +@emph{Important:} If the CDF of the hat is (almost) the same +for @var{left} and @var{right} and (almost) equal to @code{0} or +@code{1}, then the truncated domain is not changed and the call +returns an error code. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_chg_truncated} +@deftypefn {} {int} unur_tabl_chg_truncated (UNUR_GEN* @var{gen}, double @var{left}, double @var{right}) +Change the borders of the domain of the (truncated) distribution. + +Notice that the given truncated domain must be a subset of the +domain of the given distribution. The generator always uses the +intersection of the domain of the distribution and the truncated +domain given by this call. The hat function will not be changed. + +@emph{Important:} +The ratio between the area below the hat and the area below the +squeeze changes when the sampling region is restricted. In particalur +it becomes (very) large when sampling from the (far) tail of the +distribution. Then it is better to create a generator object for the +tail of distribution only. + +@emph{Important:} +This call does not work for variant @code{IA} (immediate +acceptance). In this case UNU.RAN switches @emph{automatically} to +variant @code{RH} (use ``classical'' acceptance/rejection from hat +distribution) and does revert to the variant originally set by the +user. + +@emph{Important:} +It is not a good idea to use adaptave rejection sampling while +sampling from a domain that is a strict subset of the domain that +has been used to construct the hat. +For that reason adaptive adding of construction points is +@emph{automatically disabled} by this call. + +@emph{Important:} If the CDF of the hat is (almost) the same +for @var{left} and @var{right} and (almost) equal to @code{0} or +@code{1}, then the truncated domain is not changed and the call +returns an error code. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_set_verify} +@anchor{funct:unur_tabl_chg_verify} +@deftypefn Function {int} unur_tabl_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx Function {int} unur_tabl_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_set_verify} +@anchor{funct:unur_tabl_chg_verify} +@deftypefn {} {int} unur_tabl_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx {} {int} unur_tabl_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_tabl_set_pedantic} +@deftypefn Function {int} unur_tabl_set_pedantic (UNUR_PAR* @var{parameters}, int @var{pedantic}) +Sometimes it might happen that +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +has been executed +successfully. But when additional construction points are added by +adaptive rejection sampling, the algorithm detects that the +PDF is not monotone in the given slopes. + +With @var{pedantic} being @code{TRUE}, the sampling routine is exchanged +by a routine that simply returns @code{UNUR_INFINITY} indicating an +error. + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_tabl_set_pedantic} +@deftypefn {} {int} unur_tabl_set_pedantic (UNUR_PAR* @var{parameters}, int @var{pedantic}) +Sometimes it might happen that +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +has been executed +successfully. But when additional construction points are added by +adaptive rejection sampling, the algorithm detects that the +PDF is not monotone in the given slopes. + +With @var{pedantic} being @code{TRUE}, the sampling routine is exchanged +by a routine that simply returns @code{UNUR_INFINITY} indicating an +error. + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of tabl.h +@c ------------------------------------- +@c ------------------------------------- +@c tdr.h +@c + +@page +@node TDR +@subsection TDR -- Transformed Density Rejection + +@table @i +@item Required: +T-concave PDF, dPDF +@item Optional: +mode +@item Speed: +Set-up: slow, Sampling: fast +@item Reinit: +supported +@item Reference: +@ifhtml +@ref{bib:GWa92,, [GWa92]} +@end ifhtml +@ifnothtml +[GWa92] +@end ifnothtml +@ifhtml +@ref{bib:HWa95,, [HWa95]} +@end ifhtml +@ifnothtml +[HWa95] +@end ifnothtml +@ifhtml +@ref{bib:HLD04,, [HLD04: Cha.4]} +@end ifhtml +@ifnothtml +[HLD04: Cha.4] +@end ifnothtml + +@end table + + +TDR is an acceptance/rejection method that uses the concavity of a +transformed density to construct hat function and squeezes +automatically. Such PDFs are called T-concave. Currently the +following transformations are implemented and can be selected by +setting their @code{c}-values by a +@ifhtml +@ref{funct:unur_tdr_set_c,@command{unur_tdr_set_c}} +@end ifhtml +@ifnothtml +@command{unur_tdr_set_c} +@end ifnothtml +call: + +@table @code +@item c = 0 +T(x) = log(x) +@item c = -0.5 +T(x) = -1/sqrt(x) @ @ @ @ @ (Default) +@end table + +In future releases the transformations T(x) = -(x)^c will be +available for any c with 0 > c > -1. +Notice that if a PDF is T-concave for a c then it also T-concave +for every c'T(x) = -1/sqrt(()x). +@end html +@end ifhtml +@ifinfo +@math{T(x) = -1/sqrt(x).} +@end ifinfo + +It requires the PDF and the (exact) location of the mode. +Notice that if no mode is given at all, a (slow) numerical mode +finder will be used. +Moreover the approximate area below the given PDF is used. +(If no area is given for the distribution the algorithm assumes that it +is approximately 1.) +The rejection constant is bounded from above by 4 +for all @i{T}-concave distributions. + + +@subsubheading How To Use + + +UTDR works for any continuous univariate distribution object with +given @i{T}-concave PDF (with +@iftex +@math{T(x) = -1/\sqrt{x},)} +@end iftex +@ifhtml +@html +T(x) = -1/sqrt(x),) +@end html +@end ifhtml +@ifinfo +@math{T(x) = -1/sqrt(x),)} +@end ifinfo +mode and approximate area below PDF. + +When the PDF does not change at the mode for varying parameters, then +this value can be set with +@ifhtml +@ref{funct:unur_utdr_set_pdfatmode,@command{unur_utdr_set_pdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_utdr_set_pdfatmode} +@end ifnothtml +to avoid some +computations. Since this value will not be updated any more when the +parameters of the distribution are changed, +the +@ifhtml +@ref{funct:unur_utdr_chg_pdfatmode,@command{unur_utdr_chg_pdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_utdr_chg_pdfatmode} +@end ifnothtml +call is necessary to do this manually. + +It is possible to change the parameters and the domain of the chosen +distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator object. +Notice, that derived parameters like the mode must also be (re-) set +if the parameters or the domain has be changed. +Moreover, if the PDF at the mode has been provided by a +@ifhtml +@ref{funct:unur_utdr_set_pdfatmode,@command{unur_utdr_set_pdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_utdr_set_pdfatmode} +@end ifnothtml +call, additionally +@ifhtml +@ref{funct:unur_utdr_chg_pdfatmode,@command{unur_utdr_chg_pdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_utdr_chg_pdfatmode} +@end ifnothtml +must be used (otherwise this call is +not necessary since then this figure is computed directly from +the PDF). + +There exists a test mode that verifies whether the conditions for +the method are satisfied or not. It can be switched on by calling +@ifhtml +@ref{funct:unur_utdr_set_verify,@command{unur_utdr_set_verify}} +@end ifhtml +@ifnothtml +@command{unur_utdr_set_verify} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_utdr_chg_verify,@command{unur_utdr_chg_verify},} +@end ifhtml +@ifnothtml +@command{unur_utdr_chg_verify}, +@end ifnothtml +respectively. +Notice however that sampling is slower then. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_utdr_new,unur_utdr_new} +@item @ref{funct:unur_utdr_set_pdfatmode,unur_utdr_set_pdfatmode} +@item @ref{funct:unur_utdr_set_cpfactor,unur_utdr_set_cpfactor} +@item @ref{funct:unur_utdr_set_deltafactor,unur_utdr_set_deltafactor} +@item @ref{funct:unur_utdr_set_verify,unur_utdr_set_verify} +@item @ref{funct:unur_utdr_chg_verify,unur_utdr_chg_verify} +@item @ref{funct:unur_utdr_chg_pdfatmode,unur_utdr_chg_pdfatmode} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_utdr_new} +@deftypefn Function {UNUR_PAR*} unur_utdr_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_utdr_new} +@deftypefn {} {UNUR_PAR*} unur_utdr_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_utdr_set_pdfatmode} +@deftypefn Function {int} unur_utdr_set_pdfatmode (UNUR_PAR* @var{parameters}, double @var{fmode}) +Set pdf at mode. +When set, the PDF at the mode is never changed. +This is to avoid additional computations, when the PDF does not +change when parameters of the distributions vary. +It is only useful when the PDF at the mode does not change with +changing parameters for the distribution. + +Default: not set. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_utdr_set_pdfatmode} +@deftypefn {} {int} unur_utdr_set_pdfatmode (UNUR_PAR* @var{parameters}, double @var{fmode}) +Set pdf at mode. +When set, the PDF at the mode is never changed. +This is to avoid additional computations, when the PDF does not +change when parameters of the distributions vary. +It is only useful when the PDF at the mode does not change with +changing parameters for the distribution. + +Default: not set. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_utdr_set_cpfactor} +@deftypefn Function {int} unur_utdr_set_cpfactor (UNUR_PAR* @var{parameters}, double @var{cp_factor}) +Set factor for position of left and right construction point. +The @var{cp_factor} is used to find almost optimal construction +points for the hat function. +There is no need to change this factor in almost all situations. + +Default is @code{0.664}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_utdr_set_cpfactor} +@deftypefn {} {int} unur_utdr_set_cpfactor (UNUR_PAR* @var{parameters}, double @var{cp_factor}) +Set factor for position of left and right construction point. +The @var{cp_factor} is used to find almost optimal construction +points for the hat function. +There is no need to change this factor in almost all situations. + +Default is @code{0.664}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_utdr_set_deltafactor} +@deftypefn Function {int} unur_utdr_set_deltafactor (UNUR_PAR* @var{parameters}, double @var{delta}) +Set factor for replacing tangents by secants. +higher factors increase the rejection constant but reduces the risk of +serious round-off errors. +There is no need to change this factor it almost all situations. + +Default is @code{1.e-5}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_utdr_set_deltafactor} +@deftypefn {} {int} unur_utdr_set_deltafactor (UNUR_PAR* @var{parameters}, double @var{delta}) +Set factor for replacing tangents by secants. +higher factors increase the rejection constant but reduces the risk of +serious round-off errors. +There is no need to change this factor it almost all situations. + +Default is @code{1.e-5}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_utdr_set_verify} +@anchor{funct:unur_utdr_chg_verify} +@deftypefn Function {int} unur_utdr_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx Function {int} unur_utdr_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_utdr_set_verify} +@anchor{funct:unur_utdr_chg_verify} +@deftypefn {} {int} unur_utdr_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx {} {int} unur_utdr_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_utdr_chg_pdfatmode} +@deftypefn Function {int} unur_utdr_chg_pdfatmode (UNUR_GEN* @var{generator}, double @var{fmode}) +Change PDF at mode of distribution. +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +must be executed before sampling from the +generator again. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_utdr_chg_pdfatmode} +@deftypefn {} {int} unur_utdr_chg_pdfatmode (UNUR_GEN* @var{generator}, double @var{fmode}) +Change PDF at mode of distribution. +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +must be executed before sampling from the +generator again. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of utdr.h +@c ------------------------------------- +@c ------------------------------------- +@c methods.dh +@c + +@page +@node Methods_for_CEMP +@section Methods for continuous empirical univariate distributions + +@menu +* EMPK:: EMPirical distribution with Kernel smoothing +* EMPL:: EMPirical distribution with Linear interpolation +* HIST:: HISTogramm of empirical distribution +@end menu + + + +@subheading Overview of methods + +@include methods_cemp.texi + +@subheading Example + +@smallexample +@include ref_example_emp.texi +@end smallexample + +@subheading Example (String API) + +@smallexample +@include ref_example_emp_str.texi +@end smallexample + + + +@c +@c end of methods.dh +@c ------------------------------------- +@c ------------------------------------- +@c empk.h +@c + +@page +@node EMPK +@subsection EMPK -- EMPirical distribution with Kernel smoothing + +@table @i +@item Required: +observed sample +@item Speed: +Set-up: slow (as sample is sorted), Sampling: fast (depends on kernel) +@item Reinit: +not implemented +@item Reference: +@ifhtml +@ref{bib:HLa00,, [HLa00]} +@end ifhtml +@ifnothtml +[HLa00] +@end ifnothtml +@ifhtml +@ref{bib:HLD04,, [HLD04: Sect.12.1.2]} +@end ifhtml +@ifnothtml +[HLD04: Sect.12.1.2] +@end ifnothtml + +@end table + + +EMPK generates random variates from an empirical distribution that is +given by an observed sample. The idea is that simply choosing a random +point from the sample and to return it with some added noise results +in a method that has very nice properties, as it can be seen as sampling +from a kernel density estimate. If the underlying distribution is +continuous, especially the fine structur of the resulting empirical +distribution is much better than using only resampling without noise. + +Clearly we have to decide about the density of the noise (called kernel) +and about the standard deviation of the noise. +The mathematical theory of kernel density estimation shows us that we +are comparatively free in choosing the kernel. It also supplies us with +a simple formula to compute the optimal standarddeviation of the noise, +called bandwidth (or window width) of the kernel. + +The variance of the estimated density is slightly larger than +that of the observed sample. However, this can be easily +corrected if required. + +There is also a correction (mirroring technique) for +distributions with non-negative support. + +A simple robust reference method is implemented to find a good +standard deviation of the noise (i.e. the bandwidth of +kernel density estimation). For some cases +(e.g. densities with two or more sharp distinct peaks) there +kernel density estimation can be adjusted by changing the +smoothness factor and the so called beta factor. + + +@subsubheading How To Use + + +EMPK uses empirical distributions. The main parameter is the +choice if of kernel density. The most important kernels can be +set by +@ifhtml +@ref{funct:unur_empk_set_kernel,@command{unur_empk_set_kernel}.} +@end ifhtml +@ifnothtml +@command{unur_empk_set_kernel}. +@end ifnothtml +Additionally generators for other +kernels can be used by using +@ifhtml +@ref{funct:unur_empk_set_kernelgen,@command{unur_empk_set_kernelgen}} +@end ifhtml +@ifnothtml +@command{unur_empk_set_kernelgen} +@end ifnothtml +instead. +Additionally variance correction and a correction for +non-negative variates can be switched on. + +The two other parameters (smoothing factor and beta factor) are +only useful for people knowing the theory of kernel density +estimation. It is not necessary to change them if +the true underlying distribution is somehow comparable with a +bell-shaped curve, even skewed or with some not too sharp extra peaks. +In all these cases the simple robust reference method implemented to +find a good standard deviation of the noise (i.e. the bandwidth of +kernel density estimation) should give sensible results. +However, it might be necessary to overwrite this automatic method +to find the bandwidth eg. when resampling from data with +two or more sharp distinct peaks. Then the distribution has nearly +discrete components as well and our automatic method may +easily choose too large a bandwidth which results in an +empirical distribution which is oversmoothed (i.e. it has +lower peaks than the original distribution). Then it +is recommended to decrease the bandwidth using the +@ifhtml +@ref{funct:unur_empk_set_smoothing,@command{unur_empk_set_smoothing}} +@end ifhtml +@ifnothtml +@command{unur_empk_set_smoothing} +@end ifnothtml +call. A smoothing factor of @code{1} +is the default. A smoothing factor of @code{0} leads to naive +resampling of the data. Thus an appropriate value between these +extremes should be choosen. We recommend to consult a reference +on kernel smoothing when doing so; but it is not a simple problem +to determine an optimal bandwidth for distributions with sharp peaks. + +In general, for most applications it is perfectly ok to use the +default values offered. Unless you have some knowledge on +density estimation we do not recommend to change anything. +There are two exceptions: + +@enumerate A +@item +In the case that the unknown underlying distribution is not continuous +but discrete you should "turn off" the adding of the noise by setting: + +@example +unur_empk_set_smoothing(par, 0.) +@end example + +@item +In the case that you are especially +interested in a fast sampling algorithm use the call +@example +unur_empk_set_kernel(par, UNUR_DISTR_BOXCAR); +@end example +to change the used noise distribution from the default Gaussian +distribution to the uniform distribution. +@end enumerate + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_empk_new,unur_empk_new} +@item @ref{funct:unur_empk_set_kernel,unur_empk_set_kernel} +@item @ref{funct:unur_empk_set_kernelgen,unur_empk_set_kernelgen} +@item @ref{funct:unur_empk_set_beta,unur_empk_set_beta} +@item @ref{funct:unur_empk_set_smoothing,unur_empk_set_smoothing} +@item @ref{funct:unur_empk_chg_smoothing,unur_empk_chg_smoothing} +@item @ref{funct:unur_empk_set_varcor,unur_empk_set_varcor} +@item @ref{funct:unur_empk_chg_varcor,unur_empk_chg_varcor} +@item @ref{funct:unur_empk_set_positive,unur_empk_set_positive} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_empk_new} +@deftypefn Function {UNUR_PAR*} unur_empk_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_empk_new} +@deftypefn {} {UNUR_PAR*} unur_empk_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_empk_set_kernel} +@deftypefn Function {int} unur_empk_set_kernel (UNUR_PAR* @var{parameters}, unsigned @var{kernel}) +Select one of the supported kernel distributions. Currently the following +kernels are supported: + +@table @code +@item UNUR_DISTR_GAUSSIAN +Gaussian (normal) kernel +@item UNUR_DISTR_EPANECHNIKOV +Epanechnikov kernel +@item UNUR_DISTR_BOXCAR +Boxcar (uniform, rectangular) kernel +@item UNUR_DISTR_STUDENT +t3 kernel (Student's distribution with 3 degrees of freedom) +@item UNUR_DISTR_LOGISTIC +logistic kernel +@end table + +For other kernels (including kernels with Student's distribution +with other than 3 degrees of freedom) use the +@ifhtml +@ref{funct:unur_empk_set_kernelgen,@command{unur_empk_set_kernelgen}} +@end ifhtml +@ifnothtml +@command{unur_empk_set_kernelgen} +@end ifnothtml +call. + +It is not possible to call +@ifhtml +@ref{funct:unur_empk_set_kernel,@command{unur_empk_set_kernel}} +@end ifhtml +@ifnothtml +@command{unur_empk_set_kernel} +@end ifnothtml +twice. + +Default is the Gaussian kernel. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_empk_set_kernel} +@deftypefn {} {int} unur_empk_set_kernel (UNUR_PAR* @var{parameters}, unsigned @var{kernel}) +Select one of the supported kernel distributions. Currently the following +kernels are supported: + +@table @code +@item UNUR_DISTR_GAUSSIAN +Gaussian (normal) kernel +@item UNUR_DISTR_EPANECHNIKOV +Epanechnikov kernel +@item UNUR_DISTR_BOXCAR +Boxcar (uniform, rectangular) kernel +@item UNUR_DISTR_STUDENT +t3 kernel (Student's distribution with 3 degrees of freedom) +@item UNUR_DISTR_LOGISTIC +logistic kernel +@end table + +For other kernels (including kernels with Student's distribution +with other than 3 degrees of freedom) use the +@ifhtml +@ref{funct:unur_empk_set_kernelgen,@command{unur_empk_set_kernelgen}} +@end ifhtml +@ifnothtml +@command{unur_empk_set_kernelgen} +@end ifnothtml +call. + +It is not possible to call +@ifhtml +@ref{funct:unur_empk_set_kernel,@command{unur_empk_set_kernel}} +@end ifhtml +@ifnothtml +@command{unur_empk_set_kernel} +@end ifnothtml +twice. + +Default is the Gaussian kernel. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_empk_set_kernelgen} +@deftypefn Function {int} unur_empk_set_kernelgen (UNUR_PAR* @var{parameters}, const @var{UNUR_GEN* kernelgen}, double @var{alpha}, double @var{kernelvar}) +Set generator for the kernel used for density estimation. + +@var{alpha} is used to compute the optimal bandwidth from the point of +view of minimizing the mean integrated square error (MISE). +It depends on the kernel K and is given by +@example +alpha(K) = Var(K)^(-2/5)@{ \int K(t)^2 dt@}^(1/5) +@end example +For standard kernels (see above) alpha is computed by the algorithm. + +@var{kernvar} is the variance of the used kernel. It is only required +for the variance corrected version of density estimation (which is +used by default); otherwise it is ignored. +If @var{kernelvar} is nonpositive, variance correction is disabled. +For standard kernels (see above) @var{kernvar} is computed by the +algorithm. + +It is not possible to call +@ifhtml +@ref{funct:unur_empk_set_kernelgen,@command{unur_empk_set_kernelgen}} +@end ifhtml +@ifnothtml +@command{unur_empk_set_kernelgen} +@end ifnothtml +after a standard kernel +has been selected by a +@ifhtml +@ref{funct:unur_empk_set_kernel,@command{unur_empk_set_kernel}} +@end ifhtml +@ifnothtml +@command{unur_empk_set_kernel} +@end ifnothtml +call. + +Notice that the uniform random number generator of the kernel +generator is overwritten during the +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +call and at each +@ifhtml +@ref{funct:unur_chg_urng,@command{unur_chg_urng}} +@end ifhtml +@ifnothtml +@command{unur_chg_urng} +@end ifnothtml +call with the uniform generator used for the empirical +distribution. + +Default is the Gaussian kernel. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_empk_set_kernelgen} +@deftypefn {} {int} unur_empk_set_kernelgen (UNUR_PAR* @var{parameters}, const @var{UNUR_GEN* kernelgen}, double @var{alpha}, double @var{kernelvar}) +Set generator for the kernel used for density estimation. + +@var{alpha} is used to compute the optimal bandwidth from the point of +view of minimizing the mean integrated square error (MISE). +It depends on the kernel K and is given by +@example +alpha(K) = Var(K)^(-2/5)@{ \int K(t)^2 dt@}^(1/5) +@end example +For standard kernels (see above) alpha is computed by the algorithm. + +@var{kernvar} is the variance of the used kernel. It is only required +for the variance corrected version of density estimation (which is +used by default); otherwise it is ignored. +If @var{kernelvar} is nonpositive, variance correction is disabled. +For standard kernels (see above) @var{kernvar} is computed by the +algorithm. + +It is not possible to call +@ifhtml +@ref{funct:unur_empk_set_kernelgen,@command{unur_empk_set_kernelgen}} +@end ifhtml +@ifnothtml +@command{unur_empk_set_kernelgen} +@end ifnothtml +after a standard kernel +has been selected by a +@ifhtml +@ref{funct:unur_empk_set_kernel,@command{unur_empk_set_kernel}} +@end ifhtml +@ifnothtml +@command{unur_empk_set_kernel} +@end ifnothtml +call. + +Notice that the uniform random number generator of the kernel +generator is overwritten during the +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +call and at each +@ifhtml +@ref{funct:unur_chg_urng,@command{unur_chg_urng}} +@end ifhtml +@ifnothtml +@command{unur_chg_urng} +@end ifnothtml +call with the uniform generator used for the empirical +distribution. + +Default is the Gaussian kernel. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_empk_set_beta} +@deftypefn Function {int} unur_empk_set_beta (UNUR_PAR* @var{parameters}, double @var{beta}) +@var{beta} is used to compute the optimal bandwidth from the point +of view of minimizing the mean integrated square error (MISE). +@var{beta} depends on the (unknown) distribution of the sampled data +points. +By default Gaussian distribution is assumed for the sample +(@var{beta} = 1.3637439). There is no requirement to change +@var{beta}. + +Default: @code{1.3637439} +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_empk_set_beta} +@deftypefn {} {int} unur_empk_set_beta (UNUR_PAR* @var{parameters}, double @var{beta}) +@var{beta} is used to compute the optimal bandwidth from the point +of view of minimizing the mean integrated square error (MISE). +@var{beta} depends on the (unknown) distribution of the sampled data +points. +By default Gaussian distribution is assumed for the sample +(@var{beta} = 1.3637439). There is no requirement to change +@var{beta}. + +Default: @code{1.3637439} +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_empk_set_smoothing} +@anchor{funct:unur_empk_chg_smoothing} +@deftypefn Function {int} unur_empk_set_smoothing (UNUR_PAR* @var{parameters}, double @var{smoothing}) +@deftypefnx Function {int} unur_empk_chg_smoothing (UNUR_GEN* @var{generator}, double @var{smoothing}) +Set and change the smoothing factor. +The smoothing factor controlles how ``smooth'' the resulting density +estimation will be. A smoothing factor equal to @code{0} results in naive +resampling. A very large smoothing factor (together with the +variance correction) results in a density which is approximately +equal to the kernel. +Default is 1 which results in a smoothing parameter minimising +the MISE (mean integrated squared error) if the data are not too +far away from normal. If a large smoothing factor is used, then +variance correction must be switched on. + +Default: @code{1} +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_empk_set_smoothing} +@anchor{funct:unur_empk_chg_smoothing} +@deftypefn {} {int} unur_empk_set_smoothing (UNUR_PAR* @var{parameters}, double @var{smoothing}) +@deftypefnx {} {int} unur_empk_chg_smoothing (UNUR_GEN* @var{generator}, double @var{smoothing}) +Set and change the smoothing factor. +The smoothing factor controlles how ``smooth'' the resulting density +estimation will be. A smoothing factor equal to @code{0} results in naive +resampling. A very large smoothing factor (together with the +variance correction) results in a density which is approximately +equal to the kernel. +Default is 1 which results in a smoothing parameter minimising +the MISE (mean integrated squared error) if the data are not too +far away from normal. If a large smoothing factor is used, then +variance correction must be switched on. + +Default: @code{1} +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_empk_set_varcor} +@anchor{funct:unur_empk_chg_varcor} +@deftypefn Function {int} unur_empk_set_varcor (UNUR_PAR* @var{parameters}, int @var{varcor}) +@deftypefnx Function {int} unur_empk_chg_varcor (UNUR_GEN* @var{generator}, int @var{varcor}) +Switch variance correction in generator on/off. +If @var{varcor} is @code{TRUE} then the variance of the used +density estimation is the same as the sample variance. However this +increases the MISE of the estimation a little bit. + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_empk_set_varcor} +@anchor{funct:unur_empk_chg_varcor} +@deftypefn {} {int} unur_empk_set_varcor (UNUR_PAR* @var{parameters}, int @var{varcor}) +@deftypefnx {} {int} unur_empk_chg_varcor (UNUR_GEN* @var{generator}, int @var{varcor}) +Switch variance correction in generator on/off. +If @var{varcor} is @code{TRUE} then the variance of the used +density estimation is the same as the sample variance. However this +increases the MISE of the estimation a little bit. + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_empk_set_positive} +@deftypefn Function {int} unur_empk_set_positive (UNUR_PAR* @var{parameters}, int @var{positive}) +If @var{positive} is @code{TRUE} then only nonnegative random variates are +generated. This is done by means of a mirroring technique. + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_empk_set_positive} +@deftypefn {} {int} unur_empk_set_positive (UNUR_PAR* @var{parameters}, int @var{positive}) +If @var{positive} is @code{TRUE} then only nonnegative random variates are +generated. This is done by means of a mirroring technique. + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of empk.h +@c ------------------------------------- +@c ------------------------------------- +@c empl.h +@c + +@page +@node EMPL +@subsection EMPL -- EMPirical distribution with Linear interpolation + +@table @i +@item Required: +observed sample +@item Speed: +Set-up: slow (as sample is sorted), Sampling: very fast (inversion) +@item Reinit: +not implemented +@item Reference: +@ifhtml +@ref{bib:HLa00,, [HLa00]} +@end ifhtml +@ifnothtml +[HLa00] +@end ifnothtml +@ifhtml +@ref{bib:HLD04,, [HLD04: Sect.12.1.3]} +@end ifhtml +@ifnothtml +[HLD04: Sect.12.1.3] +@end ifnothtml + +@end table + + +EMPL generates random variates from an empirical distribution +that is given by an observed sample. This is done by linear +interpolation of the empirical CDF. Although this +method is suggested in the books of Law and Kelton (2000) and +Bratly, Fox, and Schrage (1987) we do not recommend this method at +all since it has many theoretical drawbacks: +The variance of empirical distribution function does not +coincide with the variance of the given sample. Moreover, +when the sample increases the empirical density function +does not converge to the density of the underlying random +variate. Notice that the range of the generated point set is +always given by the range of the given sample. + +This method is provided in UNU.RAN for the sake of +completeness. We always recommend to use method EMPK +(@pxref{EMPK,,EMPirical distribution with Kernel smoothing}). + +If the data seem to be far away from having a bell shaped +histogram, then we think that naive resampling is still better +than linear interpolation. + + +@subsubheading How To Use + + +EMPL creates and samples from an empiral distribution by linear +interpolation of the empirical CDF. There are no parameters to +set. + +@noindent +@emph{Important}: We do not recommend to use this method! Use +method EMPK +(@pxref{EMPK,,EMPirical distribution with Kernel smoothing}) +instead. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_empl_new,unur_empl_new} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_empl_new} +@deftypefn Function {UNUR_PAR*} unur_empl_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_empl_new} +@deftypefn {} {UNUR_PAR*} unur_empl_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of empl.h +@c ------------------------------------- +@c ------------------------------------- +@c hist.h +@c + +@page +@node HIST +@subsection HIST -- HISTogramm of empirical distribution + +@table @i +@item Required: +histogram +@item Speed: +Set-up: moderate, Sampling: fast +@item Reinit: +not implemented +@end table + + +Method HIST generates random variates from an empirical distribution +that is given as histogram. Sampling is done using the inversion +method. + +If observed (raw) data are provided we recommend method EMPK +(@pxref{EMPK,,EMPirical distribution with Kernel smoothing}) +instead of compting a histogram as this reduces information. + + +@subsubheading How To Use + + +Method HIST uses empirical distributions that are given as a +histgram. There are no optional parameters. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_hist_new,unur_hist_new} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_hist_new} +@deftypefn Function {UNUR_PAR*} unur_hist_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hist_new} +@deftypefn {} {UNUR_PAR*} unur_hist_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of hist.h +@c ------------------------------------- +@c ------------------------------------- +@c methods.dh +@c + +@page +@node Methods_for_CVEC +@section Methods for continuous multivariate distributions + +@menu +* MVSTD:: MultiVariate continuous STandarD distributions +* MVTDR:: Multi-Variate Transformed Density Rejection +* NORTA:: NORmal To Anything +* VNROU:: Multivariate Naive Ratio-Of-Uniforms method +@end menu + + + +@subheading Overview of methods + +@include methods_cvec.texi + + + +@c +@c end of methods.dh +@c ------------------------------------- +@c ------------------------------------- +@c mvstd.h +@c + +@page +@node MVSTD +@subsection MVSTD -- MultiVariate continuous STandarD distributions + +@table @i +@item Required: +standard distribution from UNU.RAN library (@pxref{Stddist,,Standard distributions}). +@item Speed: +depends on distribution and generator +@item Reinit: +supported +@end table + + +MVSTD is a wrapper for special generators for multivariate +continuous standard distributions. It only works for +distributions in the UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}). +If a distribution object is provided that is build from scratch, +or if no special generator for the given standard distribution is +provided, the @code{NULL} pointer is returned. + + +@subsubheading How To Use + + +Create a distribution object for a standard distribution +from the UNU.RAN library (@pxref{Stddist,,Standard distributions}). + +Sampling from truncated distributions (which can be constructed by +changing the default domain of a distribution by means of +@ifhtml +@ref{funct:unur_distr_cvec_set_domain_rect,@command{unur_distr_cvec_set_domain_rect}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_domain_rect} +@end ifnothtml +call) is not possible. + +It is possible to change the parameters and the domain of the chosen +distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator object. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_mvstd_new,unur_mvstd_new} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_mvstd_new} +@deftypefn Function {UNUR_PAR*} unur_mvstd_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for new generator. It requires a distribution object +for a multivariate continuous distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}). +Using a truncated distribution is not possible. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_mvstd_new} +@deftypefn {} {UNUR_PAR*} unur_mvstd_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for new generator. It requires a distribution object +for a multivariate continuous distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}). +Using a truncated distribution is not possible. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of mvstd.h +@c ------------------------------------- +@c ------------------------------------- +@c mvtdr.h +@c + +@page +@node MVTDR +@subsection MVTDR -- Multi-Variate Transformed Density Rejection + +@table @i +@item Required: +log-concave (log)PDF, gradient of (log)PDF +@item Optional: +mode +@item Speed: +Set-up: slow, Sampling: depends on dimension +@item Reinit: +not implemented +@item Reference: +@ifhtml +@ref{bib:HLD04,, [HLD04: Sect.11.3.4; Alg.11.15.]} +@end ifhtml +@ifnothtml +[HLD04: Sect.11.3.4; Alg.11.15.] +@end ifnothtml +@ifhtml +@ref{bib:LJa98,, [LJa98]} +@end ifhtml +@ifnothtml +[LJa98] +@end ifnothtml + +@end table + + +MVTDR a multivariate version of the Transformed Density Rection +(@pxref{TDR}) that works for log-concave densities. +For this method the domain of the distribution is partitioned +into cones with the mode (or the center) of the distribution as +their (common) vertex. The hat function is then constructed as +tangent planes of the transformed density in each of these +cones. The respective construction points lie on the central +lines in the cones through the vertex. The point is chosen such +that the hat is minimal among all such points (see the given +references for more details). + +The cones are created by starting with the orthants of the reals +space. These are then iteratively split when the volume below +the hat in such cones is too large. Thus an increasing number of +cones results in a better fitting hat function. +Notice however, that the required number of cones increases +exponentially with the number of dimension. +Moreover, due to the construction the rejection does not +converge to 1 and remains strictly larger than 1. + +For distributions with bounded domains the cones are cut to +pyramids that cover the domain. + + +@subsubheading How To Use + + +Create a multivariate generator object that contains the PDF and +its gradient. This object also should contain the mode of the +distribution (or a point nearby should be provided as center of +the distribution). + +The method has three parameter to adjust the method for the given +distribution: + +@table @code +@item stepsmin +Minimal number of iterations for splitting cones. +Notice that we start with 2^dim initial cones and that we arrive +at 2^(dim+stepsmin) cones after these splits. So this number +must be set with care. It can be set by a +@ifhtml +@ref{funct:unur_mvtdr_set_stepsmin,@command{unur_mvtdr_set_stepsmin}} +@end ifhtml +@ifnothtml +@command{unur_mvtdr_set_stepsmin} +@end ifnothtml +call. + +@item boundsplitting +Cones where the volume below the hat is relatively large +(i.e. larger than the average volume over all cones times +@code{boundsplitting} are further split. +This parameter can set via a +@ifhtml +@ref{funct:unur_mvtdr_set_boundsplitting,@command{unur_mvtdr_set_boundsplitting}} +@end ifhtml +@ifnothtml +@command{unur_mvtdr_set_boundsplitting} +@end ifnothtml +call. + +@item maxcones +The maximum number of generated cones. When this number is +reached, the initialization routine is stopped. Notice that the +rejection constant can be still prohibitive large. +This parameter can set via a +@ifhtml +@ref{funct:unur_mvtdr_set_maxcones,@command{unur_mvtdr_set_maxcones}} +@end ifhtml +@ifnothtml +@command{unur_mvtdr_set_maxcones} +@end ifnothtml +call. + +@end table + +Setting of these parameter can be quite tricky. The default +settings lead to hat functions where the volume below the hat is +similar in each cone. However, there might be some problems with +distributions with higher correlations, since then too few cones +are created. Then it might be necessary to increase the values +for @code{stepsmin} and @code{maxcones} and to set +@code{boundsplitting} to @code{0}. + +The number of cones and the total volume below the hat can be +controlled using the respective calls +@ifhtml +@ref{funct:unur_mvtdr_get_ncones,@command{unur_mvtdr_get_ncones}} +@end ifhtml +@ifnothtml +@command{unur_mvtdr_get_ncones} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_mvtdr_get_hatvol,@command{unur_mvtdr_get_hatvol}.} +@end ifhtml +@ifnothtml +@command{unur_mvtdr_get_hatvol}. +@end ifnothtml +Notice, that the rejection constant is +bounded from below by some figure (larger than 1) that depends +on the dimension. + +Unfortunately, the algorithm cannot detect the quality of the +constructed hat. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_mvtdr_new,unur_mvtdr_new} +@item @ref{funct:unur_mvtdr_set_stepsmin,unur_mvtdr_set_stepsmin} +@item @ref{funct:unur_mvtdr_set_boundsplitting,unur_mvtdr_set_boundsplitting} +@item @ref{funct:unur_mvtdr_set_maxcones,unur_mvtdr_set_maxcones} +@item @ref{funct:unur_mvtdr_get_ncones,unur_mvtdr_get_ncones} +@item @ref{funct:unur_mvtdr_get_hatvol,unur_mvtdr_get_hatvol} +@item @ref{funct:unur_mvtdr_set_verify,unur_mvtdr_set_verify} +@item @ref{funct:unur_mvtdr_chg_verify,unur_mvtdr_chg_verify} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_mvtdr_new} +@deftypefn Function {UNUR_PAR*} unur_mvtdr_new (const @var{UNUR_DISTR* distribution}) +Get parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_mvtdr_new} +@deftypefn {} {UNUR_PAR*} unur_mvtdr_new (const @var{UNUR_DISTR* distribution}) +Get parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_mvtdr_set_stepsmin} +@deftypefn Function {int} unur_mvtdr_set_stepsmin (UNUR_PAR* @var{parameters}, int @var{stepsmin}) +Set minimum number of triangulation step for each starting cone. +@var{stepsmin} must be nonnegative. + +Default: @code{5}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_mvtdr_set_stepsmin} +@deftypefn {} {int} unur_mvtdr_set_stepsmin (UNUR_PAR* @var{parameters}, int @var{stepsmin}) +Set minimum number of triangulation step for each starting cone. +@var{stepsmin} must be nonnegative. + +Default: @code{5}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_mvtdr_set_boundsplitting} +@deftypefn Function {int} unur_mvtdr_set_boundsplitting (UNUR_PAR* @var{parameters}, double @var{boundsplitting}) +Set bound for splitting cones. All cones are split which have a +volume below the hat that is greater than @var{bound_splitting} times +the average over all volumes. However, the number given by the +@ifhtml +@ref{funct:unur_mvtdr_set_maxcones,@command{unur_mvtdr_set_maxcones}} +@end ifhtml +@ifnothtml +@command{unur_mvtdr_set_maxcones} +@end ifnothtml +is not exceeded. +Notice that the later number is always reached +if @var{bound_splitting} is less than 1. + +Default: @code{1.5} +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_mvtdr_set_boundsplitting} +@deftypefn {} {int} unur_mvtdr_set_boundsplitting (UNUR_PAR* @var{parameters}, double @var{boundsplitting}) +Set bound for splitting cones. All cones are split which have a +volume below the hat that is greater than @var{bound_splitting} times +the average over all volumes. However, the number given by the +@ifhtml +@ref{funct:unur_mvtdr_set_maxcones,@command{unur_mvtdr_set_maxcones}} +@end ifhtml +@ifnothtml +@command{unur_mvtdr_set_maxcones} +@end ifnothtml +is not exceeded. +Notice that the later number is always reached +if @var{bound_splitting} is less than 1. + +Default: @code{1.5} +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_mvtdr_set_maxcones} +@deftypefn Function {int} unur_mvtdr_set_maxcones (UNUR_PAR* @var{parameters}, int @var{maxcones}) +Set maximum number of cones. + +Notice that this number is always increased to +@math{2^(dim+stepsmin)} +where @i{dim} is the dimension of the +distribution object and @i{stepsmin} the given mimimum number of +triangulation steps. + +Notice: For higher dimensions and/or higher correlations between the +coordinates of the random vector the required number of cones can +be very high. A too small maximum number of cones can lead to +a very high rejection constant. + +Default: @code{10000}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_mvtdr_set_maxcones} +@deftypefn {} {int} unur_mvtdr_set_maxcones (UNUR_PAR* @var{parameters}, int @var{maxcones}) +Set maximum number of cones. + +Notice that this number is always increased to +@iftex +@math{2^{dim+stepsmin}} +@end iftex +@ifhtml +@html +2dim+stepsmin +@end html +@end ifhtml +where @i{dim} is the dimension of the +distribution object and @i{stepsmin} the given mimimum number of +triangulation steps. + +Notice: For higher dimensions and/or higher correlations between the +coordinates of the random vector the required number of cones can +be very high. A too small maximum number of cones can lead to +a very high rejection constant. + +Default: @code{10000}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_mvtdr_get_ncones} +@deftypefn Function {int} unur_mvtdr_get_ncones (const @var{UNUR_GEN* generator}) +Get the number of cones used for the hat function of the +@var{generator}. +(In case of an error @code{0} is returned.) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_mvtdr_get_ncones} +@deftypefn {} {int} unur_mvtdr_get_ncones (const @var{UNUR_GEN* generator}) +Get the number of cones used for the hat function of the +@var{generator}. +(In case of an error @code{0} is returned.) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_mvtdr_get_hatvol} +@deftypefn Function {double} unur_mvtdr_get_hatvol (const @var{UNUR_GEN* generator}) +Get the volume below the hat for the @var{generator}. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_mvtdr_get_hatvol} +@deftypefn {} {double} unur_mvtdr_get_hatvol (const @var{UNUR_GEN* generator}) +Get the volume below the hat for the @var{generator}. +(In case of an error @code{UNUR_INFINITY} is returned.) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_mvtdr_set_verify} +@anchor{funct:unur_mvtdr_chg_verify} +@deftypefn Function {int} unur_mvtdr_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx Function {int} unur_mvtdr_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_mvtdr_set_verify} +@anchor{funct:unur_mvtdr_chg_verify} +@deftypefn {} {int} unur_mvtdr_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx {} {int} unur_mvtdr_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of mvtdr.h +@c ------------------------------------- +@c ------------------------------------- +@c norta.h +@c + +@page +@node NORTA +@subsection NORTA -- NORmal To Anything + +@table @i +@item Required: +rank correlation matrix, marginal distributions +@item Speed: +Set-up: slow, Sampling: depends on dimension +@item Reinit: +not implemented +@item Reference: +@ifhtml +@ref{bib:HLD04,, [HLD04: Sect.12.5.2; Alg.12.11.]} +@end ifhtml +@ifnothtml +[HLD04: Sect.12.5.2; Alg.12.11.] +@end ifnothtml + +@end table + + +NORTA (NORmal to anything) is a model to get random vectors with +given marginal distributions and rank correlation. + +@strong{Important:} Notice that marginal distribution and (rank) +correlation structure do not uniquely define a multivariate +distribution. Thus there are many other (more or less sensible) +models. + +In the NORTA model multinormal random variates with the given +(Spearman's) rank correlations are generated. +In a second step the (standard normal distributed) marginal variates +are transformed by means of the CDF of the normal distribution to get +uniform marginals. The resulting random vectors have uniform +marginals and the desired rank correlation between its components. +Such a random vector is called 'copula'. + +By means of the inverse CDF the uniform marginals are then +transformed into the target marginal distributions. This +transformation does not change the rank correlation. + +For the generation of the multinormal distribution the +(Spearman's) rank correlation matrix is transformed into the +corresponding (Pearson) correlation matrix. Samples from the +resulting multinormal distribution are generated by means of the +Cholesky decomposition of the covariance matrix. + +It can happen that the desired rank correlation matrix is not +feasible, i.e., it cannot occur as rank correlation matrix of a +multinormal distribution. The resulting "covariance" matrix is +not positive definite. In this case an eigenvector correction +method is used. Then all non-positive eigenvalues are set to a +small positive value and hence the rank correlation matrix of the +generated random vectors is "close" to the desired matrix. + + +@subsubheading How To Use + + +Create a multivariate generator object and set marginal +distributions using +@ifhtml +@ref{funct:unur_distr_cvec_set_marginals,@command{unur_distr_cvec_set_marginals},} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_marginals}, +@end ifnothtml +@ifhtml +@ref{funct:unur_distr_cvec_set_marginal_array,@command{unur_distr_cvec_set_marginal_array}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_marginal_array} +@end ifnothtml +, or +@ifhtml +@ref{funct:unur_distr_cvec_set_marginal_list,@command{unur_distr_cvec_set_marginal_list}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_marginal_list}. +@end ifnothtml +(Do not use the corresponding calls for the standard +marginal distributions). + +When the domain of the multivariate distribution is set by of a +@ifhtml +@ref{funct:unur_distr_cvec_set_domain_rect,@command{unur_distr_cvec_set_domain_rect}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_domain_rect} +@end ifnothtml +call then the domain of each +of the marginal distributions is truncated by the respective +coordinates of the given rectangle. + +If copulae are required (i.e. multivariate distributions with +uniform marginals) such a generator object can be created by +means of +@ifhtml +@ref{funct:unur_distr_copula,@command{unur_distr_copula}} +@end ifhtml +@ifnothtml +@command{unur_distr_copula} +@end ifnothtml +. + +There are no optional parameters for this method. + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_norta_new,unur_norta_new} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_norta_new} +@deftypefn Function {UNUR_PAR*} unur_norta_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_norta_new} +@deftypefn {} {UNUR_PAR*} unur_norta_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of norta.h +@c ------------------------------------- +@c ------------------------------------- +@c vnrou.h +@c + +@page +@node VNROU +@subsection VNROU -- Multivariate Naive Ratio-Of-Uniforms method + +@table @i +@item Required: +PDF +@item Optional: +mode, center, bounding rectangle for acceptance region +@item Speed: +Set-up: fast or slow, Sampling: slow +@item Reinit: +supported +@item Reference: +@ifhtml +@ref{bib:WGS91,, [WGS91]} +@end ifhtml +@ifnothtml +[WGS91] +@end ifnothtml + +@end table + + +VNROU is an implementation of the multivariate +ratio-of-uniforms method which uses a (minimal) bounding +hyper-rectangle, see also @ref{Ratio-of-Uniforms}. It uses an +additional parameter @i{r} that can be used for adjusting the +algorithm to the given distribution to improve performance +and/or to make this method applicable. Larger values of +@i{r} increase the class of distributions for which the +method works at the expense of higher rejection +constants. Moreover, this implementation uses the center +@iftex +@math{\mu} +@end iftex +@ifhtml +@html +mu +@end html +@end ifhtml +@ifinfo +@math{mu} +@end ifinfo +of the distribution (which is set to the mode or +mean by default, see +@ifhtml +@ref{funct:unur_distr_cvec_get_center,@command{unur_distr_cvec_get_center}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_get_center} +@end ifnothtml +for details of +its default values). + +The minimal bounding has then the coordinates +@iftex + +@quotation +@math{ v^+ = \sup\limits_{x} (f(x))^{1/r\,d+1}, \hfil\break u^-_i = \inf\limits_{x_i} (x_i-\mu_i) (f(x))^{r/r\,d+1}, \hfil\break u^+_i = \sup\limits_{x_i} (x_i-\mu_i) (f(x))^{r/r\,d+1}, } +@end quotation + +@end iftex +@ifhtml +@quotation +@html +v+ = sup_x (f(x))1/r d+1, @*u-_i = inf_x_i (x_i- mu_i) (f(x))r/r d+1, @*u+_i = sup_x_i (x_i- mu_i) (f(x))r/r d+1, +@end html +@end quotation +@end ifhtml +@ifinfo +@quotation +@math{v^+ = sup_(x) (f(x))^(1/r d+1), @*u^-_i = inf_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), @*u^+_i = sup_(x_i) (x_i- mu_i) (f(x))^(r/r d+1),} +@end quotation +@end ifinfo + +@noindent +where +@iftex +@math{x_i} +@end iftex +@ifhtml +@html +x_i +@end html +@end ifhtml +@ifinfo +@math{x_i} +@end ifinfo +is the @i{i}-th coordinate of point @i{x}; +@iftex +@math{\mu_i} +@end iftex +@ifhtml +@html +mu_i +@end html +@end ifhtml +@ifinfo +@math{mu_i} +@end ifinfo +is the @i{i}-th coordinate of the center +@iftex +@math{\mu.} +@end iftex +@ifhtml +@html +mu. +@end html +@end ifhtml +@ifinfo +@math{mu.} +@end ifinfo +@iftex +@math{d} +@end iftex +@ifhtml +@html +d +@end html +@end ifhtml +@ifinfo +@math{d} +@end ifinfo +denotes the dimension of the distribution. +These bounds can either be given directly, or are computed +automatically by means of an numerical routine +by Hooke and Jeeves +@ifhtml +@ref{bib:HJa61,, [HJa61]} +@end ifhtml +@ifnothtml +[HJa61] +@end ifnothtml +called direct search +(see @file{src/utils/hooke.c} for further references and +details). Of course this algorithm can fail, especially when +this rectangle is not bounded. + +It is important to note that the algorithm works with +@iftex +@math{PDF(x-center)} +@end iftex +@ifhtml +@html +PDF(x-center) +@end html +@end ifhtml +@ifinfo +@math{PDF(x-center)} +@end ifinfo +instead of +@iftex +@math{PDF(x),} +@end iftex +@ifhtml +@html +PDF(x), +@end html +@end ifhtml +@ifinfo +@math{PDF(x),} +@end ifinfo +i.e. the bounding rectangle has to be +provided for +@iftex +@math{PDF(x-center).} +@end iftex +@ifhtml +@html +PDF(x-center). +@end html +@end ifhtml +@ifinfo +@math{PDF(x-center).} +@end ifinfo +This is important as otherwise the acceptance region can become +a very long and skinny ellipsoid along a diagonal of the (huge) +bounding rectangle. + +VNROU is based on the rejection method (@pxref{Rejection}), +and it is important to note that the acceptance probability +decreases exponentially with dimension. Thus even for moderately +many dimensions (e.g. 5) the number of repetitions to get one +random vector can be prohibitively large and the algorithm seems +to stay in an infinite loop. + + +@subsubheading How To Use + + +For using the VNROU method UNU.RAN needs the PDF of the +distribution. Additionally, the parameter @i{r} can be set via +a +@ifhtml +@ref{funct:unur_vnrou_set_r,@command{unur_vnrou_set_r}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_r} +@end ifnothtml +call. Notice that the acceptance +probability decreases when @i{r} is increased. On the other +hand is is more unlikely that the bounding rectangle does not +exist if @i{r} is small. + +A bounding rectangle can be given by the +@ifhtml +@ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_u} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_v} +@end ifnothtml +calls. + +@emph{Important:} The bounding rectangle has to be +provided for the function +@iftex +@math{PDF(x-center)!} +@end iftex +@ifhtml +@html +PDF(x-center)! +@end html +@end ifhtml +@ifinfo +@math{PDF(x-center)!} +@end ifinfo +Notice that @code{center} is the center of the given +distribution, see +@ifhtml +@ref{funct:unur_distr_cvec_set_center,@command{unur_distr_cvec_set_center}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_center}. +@end ifnothtml +If in doubt or if this value is not optimal, it can be changed +(overridden) by a +@ifhtml +@ref{funct:unur_distr_cvec_set_center,@command{unur_distr_cvec_set_center}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_center} +@end ifnothtml +call. + +If the coordinates of the bounding rectangle are not provided by +the user then the minimal bounding rectangle is computed +automatically. + +By means of +@ifhtml +@ref{funct:unur_vnrou_set_verify,@command{unur_vnrou_set_verify}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_verify} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_vnrou_chg_verify,@command{unur_vnrou_chg_verify}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_chg_verify} +@end ifnothtml +one can run the sampling algorithm in a checking mode, i.e., in +every cycle of the rejection loop it is checked whether the used +rectangle indeed enclosed the acceptance region of the +distribution. When in doubt (e.g., when it is not clear whether +the numerical routine has worked correctly) this can be used to +run a small Monte Carlo study. + +@strong{Important:} +The rejection constant (i.e. the expected number of iterations +for generationg one random vector) can be extremely high, in +particular when the dimension is 4 or higher. +Then the algorithm will perform almost infinite loops. +Thus it is recommended to read the volume below the hat function +by means of the +@ifhtml +@ref{funct:unur_vnrou_get_volumehat,@command{unur_vnrou_get_volumehat}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_get_volumehat} +@end ifnothtml +call. The returned +number divided by the volume below the PDF (which is 1 in case +of a normalized PDF) gives the rejection constant. + +It is possible to change the parameters and the domain of the chosen +distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator object. +Notice, that the coordinates of a bounding rectangle given by +@ifhtml +@ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_u} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_v} +@end ifnothtml +calls are used also +when the generator is reused. These can be changed by means of +@ifhtml +@ref{funct:unur_vnrou_chg_u,@command{unur_vnrou_chg_u}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_chg_u} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_vnrou_chg_v,@command{unur_vnrou_chg_v}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_chg_v} +@end ifnothtml +calls. +(If no such coordinates have been given, then they are computed +numerically during the reinitialization proceedure.) + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_vnrou_new,unur_vnrou_new} +@item @ref{funct:unur_vnrou_set_u,unur_vnrou_set_u} +@item @ref{funct:unur_vnrou_chg_u,unur_vnrou_chg_u} +@item @ref{funct:unur_vnrou_set_v,unur_vnrou_set_v} +@item @ref{funct:unur_vnrou_chg_v,unur_vnrou_chg_v} +@item @ref{funct:unur_vnrou_set_r,unur_vnrou_set_r} +@item @ref{funct:unur_vnrou_set_verify,unur_vnrou_set_verify} +@item @ref{funct:unur_vnrou_chg_verify,unur_vnrou_chg_verify} +@item @ref{funct:unur_vnrou_get_volumehat,unur_vnrou_get_volumehat} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_vnrou_new} +@deftypefn Function {UNUR_PAR*} unur_vnrou_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_vnrou_new} +@deftypefn {} {UNUR_PAR*} unur_vnrou_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_vnrou_set_u} +@deftypefn Function {int} unur_vnrou_set_u (UNUR_PAR* @var{parameters}, double* @var{umin}, double* @var{umax}) +Sets left and right boundaries of bounding hyper-rectangle. +If no values are given, the boundary of the minimal bounding +hyper-rectangle is computed numerically. + +@strong{Important}: The boundaries are those of the density shifted +by the center of the distribution, i.e., for the +function +@math{PDF(x-center)!} + +@emph{Notice}: Computing the minimal bounding rectangle may fail +under some circumstances. Moreover, for multimodal distributions +the bounds might be too small as only local extrema are computed. +Nevertheless, for log-concave distributions it should work. + +Default: not set (i.e. computed automatically) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_vnrou_set_u} +@deftypefn {} {int} unur_vnrou_set_u (UNUR_PAR* @var{parameters}, double* @var{umin}, double* @var{umax}) +Sets left and right boundaries of bounding hyper-rectangle. +If no values are given, the boundary of the minimal bounding +hyper-rectangle is computed numerically. + +@strong{Important}: The boundaries are those of the density shifted +by the center of the distribution, i.e., for the +function +@iftex +@math{PDF(x-center)!} +@end iftex +@ifhtml +@html +PDF(x-center)! +@end html +@end ifhtml + +@emph{Notice}: Computing the minimal bounding rectangle may fail +under some circumstances. Moreover, for multimodal distributions +the bounds might be too small as only local extrema are computed. +Nevertheless, for log-concave distributions it should work. + +Default: not set (i.e. computed automatically) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_vnrou_chg_u} +@deftypefn Function {int} unur_vnrou_chg_u (UNUR_GEN* @var{generator}, double* @var{umin}, double* @var{umax}) +Change left and right boundaries of bounding hyper-rectangle. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_vnrou_chg_u} +@deftypefn {} {int} unur_vnrou_chg_u (UNUR_GEN* @var{generator}, double* @var{umin}, double* @var{umax}) +Change left and right boundaries of bounding hyper-rectangle. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_vnrou_set_v} +@deftypefn Function {int} unur_vnrou_set_v (UNUR_PAR* @var{parameters}, double @var{vmax}) +Set upper boundary for bounding hyper-rectangle. +If no values are given, the density at the mode is evaluated. +If no mode is given for the distribution it is computed +numerically (and might fail). + +Default: not set (i.e. computed automatically) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_vnrou_set_v} +@deftypefn {} {int} unur_vnrou_set_v (UNUR_PAR* @var{parameters}, double @var{vmax}) +Set upper boundary for bounding hyper-rectangle. +If no values are given, the density at the mode is evaluated. +If no mode is given for the distribution it is computed +numerically (and might fail). + +Default: not set (i.e. computed automatically) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_vnrou_chg_v} +@deftypefn Function {int} unur_vnrou_chg_v (UNUR_GEN* @var{generator}, double @var{vmax}) +Change upper boundary for bounding hyper-rectangle. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_vnrou_chg_v} +@deftypefn {} {int} unur_vnrou_chg_v (UNUR_GEN* @var{generator}, double @var{vmax}) +Change upper boundary for bounding hyper-rectangle. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_vnrou_set_r} +@deftypefn Function {int} unur_vnrou_set_r (UNUR_PAR* @var{parameters}, double @var{r}) +Sets the parameter @var{r} of the generalized multivariate +ratio-of-uniforms method. + +@emph{Notice}: This parameter must satisfy @var{r}>0. + +Default: @code{1}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_vnrou_set_r} +@deftypefn {} {int} unur_vnrou_set_r (UNUR_PAR* @var{parameters}, double @var{r}) +Sets the parameter @var{r} of the generalized multivariate +ratio-of-uniforms method. + +@emph{Notice}: This parameter must satisfy @var{r}>0. + +Default: @code{1}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_vnrou_set_verify} +@deftypefn Function {int} unur_vnrou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. + +If the condition PDF(@i{x}) <= hat(@i{x}) is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_vnrou_set_verify} +@deftypefn {} {int} unur_vnrou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. + +If the condition PDF(@i{x}) <= hat(@i{x}) is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_vnrou_chg_verify} +@deftypefn Function {int} unur_vnrou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Change the verifying of algorithm while sampling on/off. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_vnrou_chg_verify} +@deftypefn {} {int} unur_vnrou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Change the verifying of algorithm while sampling on/off. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_vnrou_get_volumehat} +@deftypefn Function {double} unur_vnrou_get_volumehat (const @var{UNUR_GEN* generator}) +Get the volume of below the hat. +For normalized densities, i.e. when the volume below PDF is 1, +this value equals the rejection constant for the vnrou method. + +In case of an error UNUR_INFINITY is returned. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_vnrou_get_volumehat} +@deftypefn {} {double} unur_vnrou_get_volumehat (const @var{UNUR_GEN* generator}) +Get the volume of below the hat. +For normalized densities, i.e. when the volume below PDF is 1, +this value equals the rejection constant for the vnrou method. + +In case of an error UNUR_INFINITY is returned. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of vnrou.h +@c ------------------------------------- +@c ------------------------------------- +@c methods.dh +@c + +@page +@node MCMC_Methods_for_CVEC +@section Markov chain samplers for continuous multivariate distributions + +@menu +* GIBBS:: Markov Chain - GIBBS sampler +* HITRO:: Markov Chain - HIT-and-run sampler with Ratio-Of-uniforms +@end menu + + + +Markov chain samplers generate sequences of random vectors which have +the target distribution as stationary distribution. +There generated vectors are (more or less) correlated and it might take a long +time until the sequence has converged to the given target distribution. + +@strong{Beware: MCMC sampling can be dangerous!} + +@subheading Overview of methods + +@include methods_mcmc.texi + + + +@c +@c end of methods.dh +@c ------------------------------------- +@c ------------------------------------- +@c gibbs.h +@c + +@page +@node GIBBS +@subsection GIBBS -- Markov Chain - GIBBS sampler + +@table @i +@item Required: +T-concave logPDF, derivatives of logPDF +@item Speed: +Set-up: fast, Sampling: moderate +@item Reinit: +not implemented +@item Reference: +@ifhtml +@ref{bib:HLD04,, [HLD04: Sect.14.1.2]} +@end ifhtml +@ifnothtml +[HLD04: Sect.14.1.2] +@end ifnothtml + +@end table + + +Method GIBBS implements a Gibbs sampler for a multivariate +distribution with given joint density and its gradient. +When running such a Markov chain all coordinates are updated +cyclically using full conditional distributions. After each step +the state of the chain is returned (i.e., a random point is +returned whenever a single coordinate has been updated). +It is also possible to return only points after all coordinates +have been updated by "thinning" the chain. +Moreover, to reduce autocorrelation this thinning factor can be +any integer. Notice, however, that the sampling time for a chain +of given length is increased by the same factor, too. + +GIBBS also provides a variant of the Gibbs sampler where in +each step a point from the full conditional distribution along +some random direction is sampled. This direction is chosen +uniformly from the sphere in each step. +This method is also known as Hit-and-Run algorithm for +non-uniform distributions. + +Our experiences shows that the original Gibbs sampler with +sampling along coordinate axes is superior to random direction +sampling as long as the correlations between the components of +the random vector are not too high. + +For both variants transformed density rejection (see methods +@pxref{TDR} and @pxref{ARS}) is used to +sample from the full conditional distributions. In opposition to +the univariate case, it is important that the factor @code{c} is +as large as possible. I.e., for a log-concave density @code{c} +must be set to @code{0.}, since otherwise numerical underflow +might stop the algorithm. + +@emph{Important:} GIBBS does not generate independent random +points. The starting point of the Gibbs chain must be in a +"typical" region of the target distribution. If such a point is +not known or would be too expensive, then the first part of the +chain should be discarded (burn-in of the chain). + + +@subsubheading How To Use + + +For using the GIBBS method UNU.RAN needs the logarithm of the +PDF of the multivariate joint distribution and its gradient or +partial derivatives. + +It provides two variants: +@table @emph +@item coordinate direction sampling (Gibbs sampling) [default] +The coordinates are updated cyclically. +It requires the partial derivatives of the (logarithm of the) +PDF of the target distribution, +see +@ifhtml +@ref{funct:unur_distr_cvec_set_pdlogpdf,@command{unur_distr_cvec_set_pdlogpdf}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_pdlogpdf}. +@end ifnothtml +Otherwise, the gradient of the logPDF +(see +@ifhtml +@ref{funct:unur_distr_cvec_set_dlogpdf,@command{unur_distr_cvec_set_dlogpdf}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_dlogpdf} +@end ifnothtml +) +is used, which is more expensive. + +This variant can be selected using +@ifhtml +@ref{funct:unur_gibbs_set_variant_coordinate,@command{unur_gibbs_set_variant_coordinate}.} +@end ifhtml +@ifnothtml +@command{unur_gibbs_set_variant_coordinate}. +@end ifnothtml +@item random direction sampling (nonuniform Hit-and-Run algorithm) +In each step is a direction is sampled uniformly from the sphere +and the next point in the chain is sampled from the full +conditional distribution along this direction. + +It requires the gradient of the logPDF and thus each step is +more expensive than each step for coordinate direction sampling. + +This variant can be selected using +@ifhtml +@ref{funct:unur_gibbs_set_variant_random_direction,@command{unur_gibbs_set_variant_random_direction}.} +@end ifhtml +@ifnothtml +@command{unur_gibbs_set_variant_random_direction}. +@end ifnothtml +@end table + +It is important that the @code{c} parameter for the TDR method +is as large as possible. For logconcave distribution it must be +set to @code{0}, since otherwise numerical underflow can cause +the algorithm to stop. + +The starting point of the Gibbs chain must be "typical" for the +target distribution. If such a point is not known or would be +too expensive, then the first part of the chain should be +discarded (burn-in of the chain). When using the +@ifhtml +@ref{funct:unur_gibbs_set_burnin,@command{unur_gibbs_set_burnin}} +@end ifhtml +@ifnothtml +@command{unur_gibbs_set_burnin} +@end ifnothtml +call this is done during the setup +of the Gibbs sampler object. + +In case of a fatal error in the generator for conditional +distributions the methods generates points that contain +UNUR_INFINITY. + +@strong{Warning:} The algorithm requires that all full +conditionals for the given distribution object are +@i{T}-concave. However, this property is not checked. +If this property is not satisfied, then generation from the +conditional distributions becomes (very) slow and might fail or +(even worse) produces random vectors from an incorrect +distribution. +When using +@ifhtml +@ref{funct:unur_gibbs_set_burnin,@command{unur_gibbs_set_burnin}} +@end ifhtml +@ifnothtml +@command{unur_gibbs_set_burnin} +@end ifnothtml +then the setup already +might fail. Thus when in doubt whether GIBBS can be used for +the targent distribution it is a good idea to use a burn-in for +checking. + +@emph{Remark:} It might happen (very rarely) that the chain +becomes stuck due to numerical errors. (This is in particular the +case when the given PDF does not fulfill the condition of this +method.) +When this happens during burn-in then the setup is aborted +(i.e. it fails). Otherwise the chain restarts again from its +starting point. + +@strong{Warning:} Be carefull with debugging flags. If it +contains flag @code{0x01000000u} it produces a lot of output for +each step in the algorithm. +(This flag is switched of in the default debugging flags). + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_gibbs_new,unur_gibbs_new} +@item @ref{funct:unur_gibbs_set_variant_coordinate,unur_gibbs_set_variant_coordinate} +@item @ref{funct:unur_gibbs_set_variant_random_direction,unur_gibbs_set_variant_random_direction} +@item @ref{funct:unur_gibbs_set_c,unur_gibbs_set_c} +@item @ref{funct:unur_gibbs_set_startingpoint,unur_gibbs_set_startingpoint} +@item @ref{funct:unur_gibbs_set_thinning,unur_gibbs_set_thinning} +@item @ref{funct:unur_gibbs_set_burnin,unur_gibbs_set_burnin} +@item @ref{funct:unur_gibbs_get_state,unur_gibbs_get_state} +@item @ref{funct:unur_gibbs_chg_state,unur_gibbs_chg_state} +@item @ref{funct:unur_gibbs_reset_state,unur_gibbs_reset_state} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_gibbs_new} +@deftypefn Function {UNUR_PAR*} unur_gibbs_new (const @var{UNUR_DISTR* distribution}) +........................................................................... +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_gibbs_new} +@deftypefn {} {UNUR_PAR*} unur_gibbs_new (const @var{UNUR_DISTR* distribution}) +........................................................................... +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_gibbs_set_variant_coordinate} +@deftypefn Function {int} unur_gibbs_set_variant_coordinate (UNUR_PAR* @var{parameters}) +Coordinate Direction Sampling: +Sampling along the coordinate directions (cyclic). + +This is the default. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_gibbs_set_variant_coordinate} +@deftypefn {} {int} unur_gibbs_set_variant_coordinate (UNUR_PAR* @var{parameters}) +Coordinate Direction Sampling: +Sampling along the coordinate directions (cyclic). + +This is the default. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_gibbs_set_variant_random_direction} +@deftypefn Function {int} unur_gibbs_set_variant_random_direction (UNUR_PAR* @var{parameters}) +Random Direction Sampling: +Sampling along the random directions. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_gibbs_set_variant_random_direction} +@deftypefn {} {int} unur_gibbs_set_variant_random_direction (UNUR_PAR* @var{parameters}) +Random Direction Sampling: +Sampling along the random directions. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_gibbs_set_c} +@deftypefn Function {int} unur_gibbs_set_c (UNUR_PAR* @var{parameters}, double @var{c}) +Set parameter @var{c} for transformation +@math{T} +of the +transformed density rejection method. +Currently only values between @code{0} and @code{-0.5} are +allowed. If @code{c} is between @code{0} and @code{-0.5} it is set +to @code{-0.5}. + +For @var{c} @code{=0} (for logconcave densities) method ARS +(@pxref{ARS}) is used which is very robust against badly +normalized PDFs. For other values method TDR (@pxref{TDR}) is used. + +The value for @var{c} should be as large as possible to avoid +fatal numerical underflows. Thus for log-concave distributions +@var{c} must be set to @code{0.} + +Default is @code{0}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_gibbs_set_c} +@deftypefn {} {int} unur_gibbs_set_c (UNUR_PAR* @var{parameters}, double @var{c}) +Set parameter @var{c} for transformation +@iftex +@math{T} +@end iftex +@ifhtml +@html +T +@end html +@end ifhtml +of the +transformed density rejection method. +Currently only values between @code{0} and @code{-0.5} are +allowed. If @code{c} is between @code{0} and @code{-0.5} it is set +to @code{-0.5}. + +For @var{c} @code{=0} (for logconcave densities) method ARS +(@pxref{ARS}) is used which is very robust against badly +normalized PDFs. For other values method TDR (@pxref{TDR}) is used. + +The value for @var{c} should be as large as possible to avoid +fatal numerical underflows. Thus for log-concave distributions +@var{c} must be set to @code{0.} + +Default is @code{0}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_gibbs_set_startingpoint} +@deftypefn Function {int} unur_gibbs_set_startingpoint (UNUR_PAR* @var{parameters}, const @var{double* x0}) +Sets the starting point of the Gibbs sampler. @var{x0} must be +a "typical" point of the given distribution. +If such a "typical" point is not known and a starting point is +merely guessed, the first part of the Gibbs chain should be +discarded (@emph{burn-in}), e.g.\ by mean of the +@ifhtml +@ref{funct:unur_gibbs_set_burnin,@command{unur_gibbs_set_burnin}} +@end ifhtml +@ifnothtml +@command{unur_gibbs_set_burnin} +@end ifnothtml +call. + +Default is the result of +@ifhtml +@ref{funct:unur_distr_cvec_get_center,@command{unur_distr_cvec_get_center}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_get_center} +@end ifnothtml +for the +given distribution object. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_gibbs_set_startingpoint} +@deftypefn {} {int} unur_gibbs_set_startingpoint (UNUR_PAR* @var{parameters}, const @var{double* x0}) +Sets the starting point of the Gibbs sampler. @var{x0} must be +a "typical" point of the given distribution. +If such a "typical" point is not known and a starting point is +merely guessed, the first part of the Gibbs chain should be +discarded (@emph{burn-in}), e.g.\ by mean of the +@ifhtml +@ref{funct:unur_gibbs_set_burnin,@command{unur_gibbs_set_burnin}} +@end ifhtml +@ifnothtml +@command{unur_gibbs_set_burnin} +@end ifnothtml +call. + +Default is the result of +@ifhtml +@ref{funct:unur_distr_cvec_get_center,@command{unur_distr_cvec_get_center}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_get_center} +@end ifnothtml +for the +given distribution object. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_gibbs_set_thinning} +@deftypefn Function {int} unur_gibbs_set_thinning (UNUR_PAR* @var{parameters}, int @var{thinning}) +Sets the @var{thinning} parameter. When @var{thinning} is set to +@i{k} then every @i{k}-th point from the iteration is returned by +the sampling algorithm. + +@emph{Notice}: This parameter must satisfy @var{thinning}>=1. + +Default: @code{1}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_gibbs_set_thinning} +@deftypefn {} {int} unur_gibbs_set_thinning (UNUR_PAR* @var{parameters}, int @var{thinning}) +Sets the @var{thinning} parameter. When @var{thinning} is set to +@i{k} then every @i{k}-th point from the iteration is returned by +the sampling algorithm. + +@emph{Notice}: This parameter must satisfy @var{thinning}>=1. + +Default: @code{1}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_gibbs_set_burnin} +@deftypefn Function {int} unur_gibbs_set_burnin (UNUR_PAR* @var{parameters}, int @var{burnin}) +If a "typical" point for the target distribution is not known but +merely guessed, the first part of the Gibbs chain should be +discarded (@emph{burn-in}). This can be done during the +initialization of the generator object. +The length of the burn-in can is then @var{burnin}. + +When method GIBBS is not applicable for the target distribution +then the initialization already might fail during the burn-in. +Thus this reduces the risk of running a generator that returns +UNUR_INFINITY cased by some fatal error during sampling. + +The thinning factor set by a +@ifhtml +@ref{funct:unur_gibbs_set_thinning,@command{unur_gibbs_set_thinning}} +@end ifhtml +@ifnothtml +@command{unur_gibbs_set_thinning} +@end ifnothtml +call has +no effect on the length of the burn-in, i.e., for the burn-in +always a thinning factor @code{1} is used. + +@emph{Notice}: This parameter must satisfy @var{thinning}>=0. + +Default: @code{0}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_gibbs_set_burnin} +@deftypefn {} {int} unur_gibbs_set_burnin (UNUR_PAR* @var{parameters}, int @var{burnin}) +If a "typical" point for the target distribution is not known but +merely guessed, the first part of the Gibbs chain should be +discarded (@emph{burn-in}). This can be done during the +initialization of the generator object. +The length of the burn-in can is then @var{burnin}. + +When method GIBBS is not applicable for the target distribution +then the initialization already might fail during the burn-in. +Thus this reduces the risk of running a generator that returns +UNUR_INFINITY cased by some fatal error during sampling. + +The thinning factor set by a +@ifhtml +@ref{funct:unur_gibbs_set_thinning,@command{unur_gibbs_set_thinning}} +@end ifhtml +@ifnothtml +@command{unur_gibbs_set_thinning} +@end ifnothtml +call has +no effect on the length of the burn-in, i.e., for the burn-in +always a thinning factor @code{1} is used. + +@emph{Notice}: This parameter must satisfy @var{thinning}>=0. + +Default: @code{0}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_gibbs_get_state} +@anchor{funct:unur_gibbs_chg_state} +@deftypefn Function {const double*} unur_gibbs_get_state (UNUR_GEN* @var{generator}) +@deftypefnx Function {int} unur_gibbs_chg_state (UNUR_GEN* @var{generator}, const @var{double* state}) +Get and change the current state of the Gibbs chain. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_gibbs_get_state} +@anchor{funct:unur_gibbs_chg_state} +@deftypefn {} {const double*} unur_gibbs_get_state (UNUR_GEN* @var{generator}) +@deftypefnx {} {int} unur_gibbs_chg_state (UNUR_GEN* @var{generator}, const @var{double* state}) +Get and change the current state of the Gibbs chain. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_gibbs_reset_state} +@deftypefn Function {int} unur_gibbs_reset_state (UNUR_GEN* @var{generator}) +Reset state of chain to starting point. + +@emph{Notice:} Currently this function does not reset +the generators for conditional distributions. Thus it is not +possible to get the same Gibbs chain even when the underlying +uniform random number generator is reset. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_gibbs_reset_state} +@deftypefn {} {int} unur_gibbs_reset_state (UNUR_GEN* @var{generator}) +Reset state of chain to starting point. + +@emph{Notice:} Currently this function does not reset +the generators for conditional distributions. Thus it is not +possible to get the same Gibbs chain even when the underlying +uniform random number generator is reset. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of gibbs.h +@c ------------------------------------- +@c ------------------------------------- +@c hitro.h +@c + +@page +@node HITRO +@subsection HITRO -- Markov Chain - HIT-and-run sampler with Ratio-Of-uniforms + +@table @i +@item Required: +PDF +@item Optional: +mode, center, bounding rectangle for acceptance region +@item Speed: +Set-up: fast, Sampling: fast +@item Reinit: +not implemented +@item Reference: +@ifhtml +@ref{bib:KLPa05,, [KLPa05]} +@end ifhtml +@ifnothtml +[KLPa05] +@end ifnothtml + +@end table + + +HITRO is an implementation of a hit-and-run sampler that runs on +the acceptance region of the multivariate ratio-of-uniforms +method, see @ref{Ratio-of-Uniforms}. + +The Ratio-of-Uniforms transforms the region below the density +into some region that we call "region of acceptance" in the +following. The minimal bounding hyperrectangle of this region +is given by +@iftex + +@quotation +@math{ v^+ = \sup\limits_{x} (f(x))^{1/r\,d+1}, \hfil\break u^-_i = \inf\limits_{x_i} (x_i-\mu_i) (f(x))^{r/r\,d+1}, \hfil\break u^+_i = \sup\limits_{x_i} (x_i-\mu_i) (f(x))^{r/r\,d+1}, } +@end quotation + +@end iftex +@ifhtml +@quotation +@html +v+ = sup_x (f(x))1/r d+1, @*u-_i = inf_x_i (x_i- mu_i) (f(x))r/r d+1, @*u+_i = sup_x_i (x_i- mu_i) (f(x))r/r d+1, +@end html +@end quotation +@end ifhtml +@ifinfo +@quotation +@math{v^+ = sup_(x) (f(x))^(1/r d+1), @*u^-_i = inf_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), @*u^+_i = sup_(x_i) (x_i- mu_i) (f(x))^(r/r d+1),} +@end quotation +@end ifinfo + +@noindent +where @i{d} denotes the dimension of the distribution; +@iftex +@math{x_i} +@end iftex +@ifhtml +@html +x_i +@end html +@end ifhtml +@ifinfo +@math{x_i} +@end ifinfo +is the @i{i}-th coordinate of point @i{x}; +@iftex +@math{\mu_i} +@end iftex +@ifhtml +@html +mu_i +@end html +@end ifhtml +@ifinfo +@math{mu_i} +@end ifinfo +is the @i{i}-th coordinate of the center +@iftex +@math{\mu} +@end iftex +@ifhtml +@html +mu +@end html +@end ifhtml +@ifinfo +@math{mu} +@end ifinfo +of the distribution, i.e., a point in the +"main region" of the distribution. +Using the center is important, since otherwise the acceptance +region can become a very long and skinny ellipsoid along a +diagonal of the (huge) bounding rectangle. + +For each step of the Hit-and-Run algorithm we have to choose +some direction. This direction together with the current point +of the chain determines a straight line. Then a point is sampled +uniformly on intersection of this line and the region of +acceptance. This is done by rejection from a uniform distribution +on a line segment that covers it. +Depending of the chosen variant the endpoints of this covering +line are computed either by means of a (not necessary minimal) +bounding hyper-rectangle, or just the "covering plate" of the +bounding hyper-rectangle. + +The required bounds of the hyper-rectable can be given directly +by the user. Otherwise, these are computed automatically by +means of a numerical routine by Hooke and Jeeves +@ifhtml +@ref{bib:HJa61,, [HJa61]} +@end ifhtml +@ifnothtml +[HJa61] +@end ifnothtml +called direct search (see +@file{src/utils/hooke.c} for further references and details). +However, this expensive computation can be avoided by determine +these bounds "on the fly" by the following adaptive algorithm: +Start with some (small) hyper-rectangle and enlarge it whenever +the endpoints of the covering line segment are not contained in +the acceptance region of the Ratio-of-Unfiorms method. +This approach works reliable as long as the region of acceptance +is convex. + +The performance of the uniform sampling from the line segment is +much improved if the covering line is adjusted (shortened) +whenever a point is rejected (adaptive sampling). This technique +reduces the expected number of iterations enormously. + +Method HITRO requires that the region of acceptance of the +Ratio-of-Uniforms method is bounded. The shape of this region +can be controlled by a parameter @i{r}. Higher values of @i{r} +result in larger classes of distributions with bounded region +of acceptance. (A distribution that has such a bounded region for +some @i{r} also has a bounded region for every @i{r'} greater +than @i{r}.) On the other hand the acceptance probability +decreases with increasing @i{r}. Moreover, round-off errors are +more likely and (for large values of @i{r}) might result in a +chain with a stationary distribution different from the target +distribution. + +Method HITRO works optimal for distributions whose region of +acceptance is convex. This is in particular the case for all +log-concave distributions when we set @i{r} = @code{1}. +For bounded but non-convex regions of acceptance convergence is +yet not guarenteed by mathematical theory. + + + +@subsubheading How To Use + + +Method HITRO requires the PDF of the target distribution +(derivatives are not necessary). + +The acceptance region of the Ratio-of-Uniforms transformation +must be bounded. Its shape is controlled by parameter @i{r}. +By default this parameter is set to @code{1} as this guarentees +a convex region of acceptance when the PDF of the given +distribution is log-concave. It should only be set to a +different (higher!) value using +@ifhtml +@ref{funct:unur_vnrou_set_r,@command{unur_vnrou_set_r}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_r} +@end ifnothtml +if otherwise +@iftex +@math{x_i\,(f(x))^{r/r\,d+1}} +@end iftex +@ifhtml +@html +x_i (f(x))r/r d+1 +@end html +@end ifhtml +@ifinfo +@math{x_i (f(x))^(r/r d+1)} +@end ifinfo +were not +bounded for each coordinate. + +There are two variants of the HITRO sampler: +@table @emph +@item coordinate direction sampling. [default] +The coordinates are updated cyclically. +This can be seen as a Gibbs sampler running on the acceptance +region of the Ratio-of-Uniforms method. +This variant can be selected using +@ifhtml +@ref{funct:unur_hitro_set_variant_coordinate,@command{unur_hitro_set_variant_coordinate}.} +@end ifhtml +@ifnothtml +@command{unur_hitro_set_variant_coordinate}. +@end ifnothtml +@item random direction sampling. +In each step is a direction is sampled uniformly from the +sphere. + +This variant can be selected using +@ifhtml +@ref{funct:unur_hitro_set_variant_random_direction,@command{unur_hitro_set_variant_random_direction}.} +@end ifhtml +@ifnothtml +@command{unur_hitro_set_variant_random_direction}. +@end ifnothtml +@end table + +Notice that each iteration of the coordinate direction sampler is +cheaper than an iteration of the random direction sampler. + +Sampling uniformly from the line segment can be adjusted in +several ways: + +@table @emph +@item Adaptive line sampling vs. simple rejection. +When adaptive line sampling is switched on, the covering line is +shortened whenever a point is rejected. However, when the region +of acceptance is not convex the line segment from which we have +to sample might not be connected. We found that the algorithm +still works but at the time being there is no formal proof that +the generated Markov chain has the required stationary +distribution. + +Adaptive line sampling can switch on/off by means of the +@ifhtml +@ref{funct:unur_hitro_set_use_adaptiveline,@command{unur_hitro_set_use_adaptiveline}} +@end ifhtml +@ifnothtml +@command{unur_hitro_set_use_adaptiveline} +@end ifnothtml +call. + +@item Bounding hyper-rectangle vs. "covering plate". +For computing the covering line we can use the bounding +hyper-rectangle or just its upper bound. +The latter saves computing time during the setup and +when computing the covering during at each iteration step +at the expense of a longer covering line. When adaptive line +sampling is used the total generation time for the entire chain +is shorter when only the "covering plate" is used. + +@emph{Notice:} When coordinate sampling is used the entire +bounding rectangle is used. + +Using the entire bounding hyper-rectangle can be switched on/off +by means of the +@ifhtml +@ref{funct:unur_hitro_set_use_boundingrectangle,@command{unur_hitro_set_use_boundingrectangle}} +@end ifhtml +@ifnothtml +@command{unur_hitro_set_use_boundingrectangle} +@end ifnothtml +call. + +@item Deterministic vs. adaptive bounding hyper-rectangle. +A bounding rectangle can be given by the +@ifhtml +@ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_u} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_v} +@end ifnothtml +calls. +Otherwise, the minimal bounding rectangle is computed +automatically during the setup by means of a numerical +algorithm. However, this is (very) slow especially in higher +dimensions and it might happen that this algorithm (like +any other numerical algorithm) does not return a correct result. + +Alternatively the bounding rectangle can be computed +adaptively. In the latter case +@ifhtml +@ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_u} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_v} +@end ifnothtml +can be used to provide a starting rectangle +which must be sufficiently small. +Then both endpoints of the covering line segment are always +check whether they are outside the acceptance region of the +Ratio-of-Uniforms method. If they are not, then the line segment +and the ("bounding") rectangle are enlarged using a factor that +can be given using the +@ifhtml +@ref{funct:unur_hitro_set_adaptive_multiplier,@command{unur_hitro_set_adaptive_multiplier}} +@end ifhtml +@ifnothtml +@command{unur_hitro_set_adaptive_multiplier} +@end ifnothtml +call. + +Notice, that running this method in the adaptive rectangle +mode requires that the region of acceptance is convex when random +directions are used, or the given PDF is unimodal when +coordinate direction sampling is used. +Moreover, it requires two additional calls to the PDF in each +iteration step of the chain. + +Using addaptive bounding rectangles can be switched on/off +by means of the +@ifhtml +@ref{funct:unur_hitro_set_use_adaptiverectangle,@command{unur_hitro_set_use_adaptiverectangle}} +@end ifhtml +@ifnothtml +@command{unur_hitro_set_use_adaptiverectangle} +@end ifnothtml +call. + +@end table + +The algorithm takes of a bounded rectangular domain given by a +@ifhtml +@ref{funct:unur_distr_cvec_set_domain_rect,@command{unur_distr_cvec_set_domain_rect}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_domain_rect} +@end ifnothtml +call, i.e. the PDF is set to +zero for every @i{x} outside the given domain. +However, it is only the coordinate direction sampler where the +boundary values are directly used to get the endpoins of the +coverline line for the line sampling step. + + +@emph{Important:} The bounding rectangle has to be +provided for the function +@iftex +@math{PDF(x-center)!} +@end iftex +@ifhtml +@html +PDF(x-center)! +@end html +@end ifhtml +@ifinfo +@math{PDF(x-center)!} +@end ifinfo +Notice that @code{center} is the center of the given +distribution, see +@ifhtml +@ref{funct:unur_distr_cvec_set_center,@command{unur_distr_cvec_set_center}.} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_center}. +@end ifnothtml +If in doubt or if this value is not optimal, it can be changed +(overridden) by a +@ifhtml +@ref{funct:unur_distr_cvec_set_center,@command{unur_distr_cvec_set_center}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_center} +@end ifnothtml +call. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_hitro_new,unur_hitro_new} +@item @ref{funct:unur_hitro_set_variant_coordinate,unur_hitro_set_variant_coordinate} +@item @ref{funct:unur_hitro_set_variant_random_direction,unur_hitro_set_variant_random_direction} +@item @ref{funct:unur_hitro_set_use_adaptiveline,unur_hitro_set_use_adaptiveline} +@item @ref{funct:unur_hitro_set_use_boundingrectangle,unur_hitro_set_use_boundingrectangle} +@item @ref{funct:unur_hitro_set_use_adaptiverectangle,unur_hitro_set_use_adaptiverectangle} +@item @ref{funct:unur_hitro_set_r,unur_hitro_set_r} +@item @ref{funct:unur_hitro_set_v,unur_hitro_set_v} +@item @ref{funct:unur_hitro_set_u,unur_hitro_set_u} +@item @ref{funct:unur_hitro_set_adaptive_multiplier,unur_hitro_set_adaptive_multiplier} +@item @ref{funct:unur_hitro_set_startingpoint,unur_hitro_set_startingpoint} +@item @ref{funct:unur_hitro_set_thinning,unur_hitro_set_thinning} +@item @ref{funct:unur_hitro_set_burnin,unur_hitro_set_burnin} +@item @ref{funct:unur_hitro_get_state,unur_hitro_get_state} +@item @ref{funct:unur_hitro_chg_state,unur_hitro_chg_state} +@item @ref{funct:unur_hitro_reset_state,unur_hitro_reset_state} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_hitro_new} +@deftypefn Function {UNUR_PAR*} unur_hitro_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hitro_new} +@deftypefn {} {UNUR_PAR*} unur_hitro_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hitro_set_variant_coordinate} +@deftypefn Function {int} unur_hitro_set_variant_coordinate (UNUR_PAR* @var{parameters}) +Coordinate Direction Sampling: +Sampling along the coordinate directions (cyclic). + +@emph{Notice:} For this variant the entire bounding rectangle is +always used independent of the +@ifhtml +@ref{funct:unur_hitro_set_use_boundingrectangle,@command{unur_hitro_set_use_boundingrectangle}} +@end ifhtml +@ifnothtml +@command{unur_hitro_set_use_boundingrectangle} +@end ifnothtml +call. + +This is the default. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hitro_set_variant_coordinate} +@deftypefn {} {int} unur_hitro_set_variant_coordinate (UNUR_PAR* @var{parameters}) +Coordinate Direction Sampling: +Sampling along the coordinate directions (cyclic). + +@emph{Notice:} For this variant the entire bounding rectangle is +always used independent of the +@ifhtml +@ref{funct:unur_hitro_set_use_boundingrectangle,@command{unur_hitro_set_use_boundingrectangle}} +@end ifhtml +@ifnothtml +@command{unur_hitro_set_use_boundingrectangle} +@end ifnothtml +call. + +This is the default. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hitro_set_variant_random_direction} +@deftypefn Function {int} unur_hitro_set_variant_random_direction (UNUR_PAR* @var{parameters}) +Random Direction Sampling: +Sampling along the random directions. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hitro_set_variant_random_direction} +@deftypefn {} {int} unur_hitro_set_variant_random_direction (UNUR_PAR* @var{parameters}) +Random Direction Sampling: +Sampling along the random directions. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hitro_set_use_adaptiveline} +@deftypefn Function {int} unur_hitro_set_use_adaptiveline (UNUR_PAR* @var{parameters}, int @var{adaptive}) +When @var{adaptive} is set to @code{TRUE} adaptive line sampling is +applied, otherwise simple rejection is used. + +@emph{Notice:} When adaptive line sampling is switched off, +the entire bounding rectangle must be used since otherwise the +sampling time can be arbitrarily slow. + +@emph{Warning:} When adaptive line sampling is switched off, +sampling can be arbitrarily slow. In particular this happens +when random direction sampling is used for distributions with +rectangular domains. Then the algorithm can be trapped into +a vertex (or even edge). + +Default is @code{TRUE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hitro_set_use_adaptiveline} +@deftypefn {} {int} unur_hitro_set_use_adaptiveline (UNUR_PAR* @var{parameters}, int @var{adaptive}) +When @var{adaptive} is set to @code{TRUE} adaptive line sampling is +applied, otherwise simple rejection is used. + +@emph{Notice:} When adaptive line sampling is switched off, +the entire bounding rectangle must be used since otherwise the +sampling time can be arbitrarily slow. + +@emph{Warning:} When adaptive line sampling is switched off, +sampling can be arbitrarily slow. In particular this happens +when random direction sampling is used for distributions with +rectangular domains. Then the algorithm can be trapped into +a vertex (or even edge). + +Default is @code{TRUE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hitro_set_use_boundingrectangle} +@deftypefn Function {int} unur_hitro_set_use_boundingrectangle (UNUR_PAR* @var{parameters}, int @var{rectangle}) +When @var{rectangle} is set to @code{TRUE} the entire bounding rectangle is used +for computing the covering line. Otherwise, only an upper bound for the +acceptance region is used. + +@emph{Notice:} When coordinate sampling is used the entire +bounding rectangle has is always used and this call has no effect. + +Default: @code{FALSE} for random direction samplig, @code{TRUE} for coordinate +direction sampling. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hitro_set_use_boundingrectangle} +@deftypefn {} {int} unur_hitro_set_use_boundingrectangle (UNUR_PAR* @var{parameters}, int @var{rectangle}) +When @var{rectangle} is set to @code{TRUE} the entire bounding rectangle is used +for computing the covering line. Otherwise, only an upper bound for the +acceptance region is used. + +@emph{Notice:} When coordinate sampling is used the entire +bounding rectangle has is always used and this call has no effect. + +Default: @code{FALSE} for random direction samplig, @code{TRUE} for coordinate +direction sampling. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hitro_set_use_adaptiverectangle} +@deftypefn Function {int} unur_hitro_set_use_adaptiverectangle (UNUR_PAR* @var{parameters}, int @var{adaptive}) +When @var{adaptive} is set to @code{FALSE} the bounding rectangle is +determined during the setup. Either, it is computed automatically by +a (slow) numerical method, or it must be provided by +@ifhtml +@ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_u} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_v} +@end ifnothtml +calls. + +If @var{adaptive} is set to @code{TRUE} the bounding rectangle is computed +adaptively. In this case the +@ifhtml +@ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_u} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_v} +@end ifnothtml +calls can be used to provide a starting +rectangle. This should be sufficiently small. +If not given then we assume +@math{v_(max) = 1,} +@math{u_(min)=(-0.001,-0.001,...,-0.001),} +and +@math{u_(max)=(0.001,0.001,...,0.001).} +Adaptive enlargements of the bounding hyperrectangle can be +controlled set setting an enlargement factor given +by a +@ifhtml +@ref{funct:unur_hitro_set_adaptive_multiplier,@command{unur_hitro_set_adaptive_multiplier}} +@end ifhtml +@ifnothtml +@command{unur_hitro_set_adaptive_multiplier} +@end ifnothtml +call. + +Using adaptive computation of the bounding rectangle reduces the +setup time significantly (when it is not given by the user) at the +expense of two additional PDF evaluations during each iteration +step. + +@emph{Important:} Using adaptive bounding rectangles requires that +the region of acceptance is convex when random directions are used, +or a unimodal PDF when coordinate direction sampling is used. + +Default: @code{FALSE} for random direction samplig, @code{TRUE} for coordinate +direction sampling. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hitro_set_use_adaptiverectangle} +@deftypefn {} {int} unur_hitro_set_use_adaptiverectangle (UNUR_PAR* @var{parameters}, int @var{adaptive}) +When @var{adaptive} is set to @code{FALSE} the bounding rectangle is +determined during the setup. Either, it is computed automatically by +a (slow) numerical method, or it must be provided by +@ifhtml +@ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_u} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_v} +@end ifnothtml +calls. + +If @var{adaptive} is set to @code{TRUE} the bounding rectangle is computed +adaptively. In this case the +@ifhtml +@ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_u} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} +@end ifhtml +@ifnothtml +@command{unur_vnrou_set_v} +@end ifnothtml +calls can be used to provide a starting +rectangle. This should be sufficiently small. +If not given then we assume +@iftex +@math{v_{max} = 1,} +@end iftex +@ifhtml +@html +v_max = 1, +@end html +@end ifhtml +@iftex +@math{u_{min}=(-0.001,-0.001,\ldots,-0.001),} +@end iftex +@ifhtml +@html +u_min=(-0.001,-0.001,...,-0.001), +@end html +@end ifhtml +and +@iftex +@math{u_{max}=(0.001,0.001,\ldots,0.001).} +@end iftex +@ifhtml +@html +u_max=(0.001,0.001,...,0.001). +@end html +@end ifhtml +Adaptive enlargements of the bounding hyperrectangle can be +controlled set setting an enlargement factor given +by a +@ifhtml +@ref{funct:unur_hitro_set_adaptive_multiplier,@command{unur_hitro_set_adaptive_multiplier}} +@end ifhtml +@ifnothtml +@command{unur_hitro_set_adaptive_multiplier} +@end ifnothtml +call. + +Using adaptive computation of the bounding rectangle reduces the +setup time significantly (when it is not given by the user) at the +expense of two additional PDF evaluations during each iteration +step. + +@emph{Important:} Using adaptive bounding rectangles requires that +the region of acceptance is convex when random directions are used, +or a unimodal PDF when coordinate direction sampling is used. + +Default: @code{FALSE} for random direction samplig, @code{TRUE} for coordinate +direction sampling. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hitro_set_r} +@deftypefn Function {int} unur_hitro_set_r (UNUR_PAR* @var{parameters}, double @var{r}) +Sets the parameter @var{r} of the generalized multivariate +ratio-of-uniforms method. + +@emph{Notice}: This parameter must satisfy @var{r}>0. + +Default: @code{1}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hitro_set_r} +@deftypefn {} {int} unur_hitro_set_r (UNUR_PAR* @var{parameters}, double @var{r}) +Sets the parameter @var{r} of the generalized multivariate +ratio-of-uniforms method. + +@emph{Notice}: This parameter must satisfy @var{r}>0. + +Default: @code{1}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hitro_set_v} +@deftypefn Function {int} unur_hitro_set_v (UNUR_PAR* @var{parameters}, double @var{vmax}) +Set upper boundary for bounding hyper-rectangle. +If not set not set the mode of the distribution is used. + +If adaptive bounding rectangles the value is used for the +starting rectangle. If not given (and the mode of the distribution +is not known) then @var{vmax}=@code{1e-3} is used. + +If deterministic bounding rectangles these values are the given +values are used for the rectangle. If no value is given +(and the mode of the distribution is not known), the upper +bound of the minimal bounding hyper-rectangle is computed +numerically (slow). + +Default: not set. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hitro_set_v} +@deftypefn {} {int} unur_hitro_set_v (UNUR_PAR* @var{parameters}, double @var{vmax}) +Set upper boundary for bounding hyper-rectangle. +If not set not set the mode of the distribution is used. + +If adaptive bounding rectangles the value is used for the +starting rectangle. If not given (and the mode of the distribution +is not known) then @var{vmax}=@code{1e-3} is used. + +If deterministic bounding rectangles these values are the given +values are used for the rectangle. If no value is given +(and the mode of the distribution is not known), the upper +bound of the minimal bounding hyper-rectangle is computed +numerically (slow). + +Default: not set. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hitro_set_u} +@deftypefn Function {int} unur_hitro_set_u (UNUR_PAR* @var{parameters}, const @var{double* umin}, const @var{double* umax}) +Sets left and right boundaries of bounding hyper-rectangle. + +If adaptive bounding rectangles these values are used for the +starting rectangle. If not given then +@var{umin}=@code{@{-b,-b,@dots{},-b@}} and +@var{umax}=@code{@{b,b,@dots{},b@}} with @code{b=1.e-3} is used. + +If deterministic bounding rectangles these values are the given +values are used for the rectangle. If no values are given, the +boundary of the minimal bounding hyper-rectangle is computed +numerically (slow). + +@strong{Important}: The boundaries are those of the density shifted +by the center of the distribution, i.e., for the +function +@math{PDF(x-center)!} + +@emph{Notice}: Computing the minimal bounding rectangle may fail +under some circumstances. Moreover, for multimodal distributions +the bounds might be too small as only local extrema are computed. +Nevertheless, for log-concave distributions it should work. + +Default: not set. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hitro_set_u} +@deftypefn {} {int} unur_hitro_set_u (UNUR_PAR* @var{parameters}, const @var{double* umin}, const @var{double* umax}) +Sets left and right boundaries of bounding hyper-rectangle. + +If adaptive bounding rectangles these values are used for the +starting rectangle. If not given then +@var{umin}=@code{@{-b,-b,@dots{},-b@}} and +@var{umax}=@code{@{b,b,@dots{},b@}} with @code{b=1.e-3} is used. + +If deterministic bounding rectangles these values are the given +values are used for the rectangle. If no values are given, the +boundary of the minimal bounding hyper-rectangle is computed +numerically (slow). + +@strong{Important}: The boundaries are those of the density shifted +by the center of the distribution, i.e., for the +function +@iftex +@math{PDF(x-center)!} +@end iftex +@ifhtml +@html +PDF(x-center)! +@end html +@end ifhtml + +@emph{Notice}: Computing the minimal bounding rectangle may fail +under some circumstances. Moreover, for multimodal distributions +the bounds might be too small as only local extrema are computed. +Nevertheless, for log-concave distributions it should work. + +Default: not set. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hitro_set_adaptive_multiplier} +@deftypefn Function {int} unur_hitro_set_adaptive_multiplier (UNUR_PAR* @var{parameters}, double @var{factor}) +Adaptive enlargements of the bounding hyperrectangle can be +controlled set setting the enlargement @var{factor}. +This must be greater than 1. Values close to 1 result in small +adaptive steps and thus reduce the risk of too large bounding +rectangles. On the other hand many adaptive steps might be +necessary. + +@emph{Notice:} For practical reasons this call does not accept +values for @var{factor} less than @code{1.0001}. If this value is +UNUR_INFINITY this results in infinite loops. + +Default: @code{1.1} +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hitro_set_adaptive_multiplier} +@deftypefn {} {int} unur_hitro_set_adaptive_multiplier (UNUR_PAR* @var{parameters}, double @var{factor}) +Adaptive enlargements of the bounding hyperrectangle can be +controlled set setting the enlargement @var{factor}. +This must be greater than 1. Values close to 1 result in small +adaptive steps and thus reduce the risk of too large bounding +rectangles. On the other hand many adaptive steps might be +necessary. + +@emph{Notice:} For practical reasons this call does not accept +values for @var{factor} less than @code{1.0001}. If this value is +UNUR_INFINITY this results in infinite loops. + +Default: @code{1.1} +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hitro_set_startingpoint} +@deftypefn Function {int} unur_hitro_set_startingpoint (UNUR_PAR* @var{parameters}, const @var{double* x0}) +Sets the starting point of the HITRO sampler in the original +scale. @var{x0} must be a "typical" point of the given distribution. +If such a "typical" point is not known and a starting point is +merely guessed, the first part of the HITRO chain should be +discarded (@emph{burn-in}), e.g.\ by mean of the +@ifhtml +@ref{funct:unur_hitro_set_burnin,@command{unur_hitro_set_burnin}} +@end ifhtml +@ifnothtml +@command{unur_hitro_set_burnin} +@end ifnothtml +call. + +@emph{Important:} The PDF of the distribution must not vanish at +the given point @var{x0}. + +Default is the result of +@ifhtml +@ref{funct:unur_distr_cvec_get_center,@command{unur_distr_cvec_get_center}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_get_center} +@end ifnothtml +for the +given distribution object. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hitro_set_startingpoint} +@deftypefn {} {int} unur_hitro_set_startingpoint (UNUR_PAR* @var{parameters}, const @var{double* x0}) +Sets the starting point of the HITRO sampler in the original +scale. @var{x0} must be a "typical" point of the given distribution. +If such a "typical" point is not known and a starting point is +merely guessed, the first part of the HITRO chain should be +discarded (@emph{burn-in}), e.g.\ by mean of the +@ifhtml +@ref{funct:unur_hitro_set_burnin,@command{unur_hitro_set_burnin}} +@end ifhtml +@ifnothtml +@command{unur_hitro_set_burnin} +@end ifnothtml +call. + +@emph{Important:} The PDF of the distribution must not vanish at +the given point @var{x0}. + +Default is the result of +@ifhtml +@ref{funct:unur_distr_cvec_get_center,@command{unur_distr_cvec_get_center}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_get_center} +@end ifnothtml +for the +given distribution object. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hitro_set_thinning} +@deftypefn Function {int} unur_hitro_set_thinning (UNUR_PAR* @var{parameters}, int @var{thinning}) +Sets the @var{thinning} parameter. When @var{thinning} is set to +@i{k} then every @i{k}-th point from the iteration is returned by +the sampling algorithm. +If thinning has to be set such that each coordinate is updated +when using coordinate direction sampling, then @var{thinning} +should be @code{dim+1} (or any multiple of it) where +@code{dim} is the dimension of the distribution object. + +@emph{Notice}: This parameter must satisfy @var{thinning}>=1. + +Default: @code{1}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hitro_set_thinning} +@deftypefn {} {int} unur_hitro_set_thinning (UNUR_PAR* @var{parameters}, int @var{thinning}) +Sets the @var{thinning} parameter. When @var{thinning} is set to +@i{k} then every @i{k}-th point from the iteration is returned by +the sampling algorithm. +If thinning has to be set such that each coordinate is updated +when using coordinate direction sampling, then @var{thinning} +should be @code{dim+1} (or any multiple of it) where +@code{dim} is the dimension of the distribution object. + +@emph{Notice}: This parameter must satisfy @var{thinning}>=1. + +Default: @code{1}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hitro_set_burnin} +@deftypefn Function {int} unur_hitro_set_burnin (UNUR_PAR* @var{parameters}, int @var{burnin}) +If a "typical" point for the target distribution is not known but +merely guessed, the first part of the HITRO chain should be +discarded (@emph{burn-in}). This can be done during the +initialization of the generator object. +The length of the burn-in can is then @var{burnin}. + +The thinning factor set by a +@ifhtml +@ref{funct:unur_hitro_set_thinning,@command{unur_hitro_set_thinning}} +@end ifhtml +@ifnothtml +@command{unur_hitro_set_thinning} +@end ifnothtml +call has +no effect on the length of the burn-in, i.e., for the burn-in +always a thinning factor @code{1} is used. + +@emph{Notice}: This parameter must satisfy @var{thinning}>=0. + +Default: @code{0}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hitro_set_burnin} +@deftypefn {} {int} unur_hitro_set_burnin (UNUR_PAR* @var{parameters}, int @var{burnin}) +If a "typical" point for the target distribution is not known but +merely guessed, the first part of the HITRO chain should be +discarded (@emph{burn-in}). This can be done during the +initialization of the generator object. +The length of the burn-in can is then @var{burnin}. + +The thinning factor set by a +@ifhtml +@ref{funct:unur_hitro_set_thinning,@command{unur_hitro_set_thinning}} +@end ifhtml +@ifnothtml +@command{unur_hitro_set_thinning} +@end ifnothtml +call has +no effect on the length of the burn-in, i.e., for the burn-in +always a thinning factor @code{1} is used. + +@emph{Notice}: This parameter must satisfy @var{thinning}>=0. + +Default: @code{0}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hitro_get_state} +@anchor{funct:unur_hitro_chg_state} +@deftypefn Function {const double*} unur_hitro_get_state (UNUR_GEN* @var{generator}) +@deftypefnx Function {int} unur_hitro_chg_state (UNUR_GEN* @var{generator}, const @var{double* state}) +Get and change the current state of the HITRO chain. + +@emph{Notice:} The state variable contains the point in the +@code{dim+1} dimensional point in the (tansformed) region of +acceptance of the Ratio-of-Uniforms method. Its coordinate +are stored in the following order: +@code{state[] = @{v, u1, u2, @dots{}, udim@}}. + +If the state can only be changed if the given @var{state} is inside +this region. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hitro_get_state} +@anchor{funct:unur_hitro_chg_state} +@deftypefn {} {const double*} unur_hitro_get_state (UNUR_GEN* @var{generator}) +@deftypefnx {} {int} unur_hitro_chg_state (UNUR_GEN* @var{generator}, const @var{double* state}) +Get and change the current state of the HITRO chain. + +@emph{Notice:} The state variable contains the point in the +@code{dim+1} dimensional point in the (tansformed) region of +acceptance of the Ratio-of-Uniforms method. Its coordinate +are stored in the following order: +@code{state[] = @{v, u1, u2, @dots{}, udim@}}. + +If the state can only be changed if the given @var{state} is inside +this region. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_hitro_reset_state} +@deftypefn Function {int} unur_hitro_reset_state (UNUR_GEN* @var{generator}) +Reset state of chain to starting point. + +@emph{Notice:} Currently this function does not reset +the generators for conditional distributions. Thus it is not +possible to get the same HITRO chain even when the underlying +uniform random number generator is reset. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_hitro_reset_state} +@deftypefn {} {int} unur_hitro_reset_state (UNUR_GEN* @var{generator}) +Reset state of chain to starting point. + +@emph{Notice:} Currently this function does not reset +the generators for conditional distributions. Thus it is not +possible to get the same HITRO chain even when the underlying +uniform random number generator is reset. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of hitro.h +@c ------------------------------------- +@c ------------------------------------- +@c methods.dh +@c + +@page +@node Methods_for_CVEMP +@section Methods for continuous empirical multivariate distributions + +@menu +* VEMPK:: (Vector) EMPirical distribution with Kernel smoothing +@end menu + + + +@subheading Overview of methods + +@include methods_cvemp.texi + +@subheading Example + +@smallexample +@include ref_example_vemp.texi +@end smallexample + +@subheading Example (String API) + +(not implemented) + + + +@c +@c end of methods.dh +@c ------------------------------------- +@c ------------------------------------- +@c vempk.h +@c + +@page +@node VEMPK +@subsection VEMPK -- (Vector) EMPirical distribution with Kernel smoothing + +@table @i +@item Required: +observed sample +@item Speed: +Set-up: slow, Sampling: slow (depends on dimension) +@item Reinit: +not implemented +@item Reference: +@ifhtml +@ref{bib:HLa00,, [HLa00]} +@end ifhtml +@ifnothtml +[HLa00] +@end ifnothtml +@ifhtml +@ref{bib:HLD04,, [HLD04: Sect.12.2.1]} +@end ifhtml +@ifnothtml +[HLD04: Sect.12.2.1] +@end ifnothtml + +@end table + + +VEMPK generates random variates from a multivariate empirical +distribution that is given by an observed sample. The idea is +that simply choosing a random point from the sample and to +return it with some added noise results in a method that has +very nice properties, as it can be seen as sampling from a +kernel density estimate. +Clearly we have to decide about the density of the noise (called kernel) +and about the covariance matrix of the noise. +The mathematical theory of kernel density estimation shows us that we +are comparatively free in choosing the kernel. +It also supplies us with a simple formula to compute the optimal +standarddeviation of the noise, called bandwidth (or window +width) of the kernel. + +Currently only a Gaussian kernel with the same covariance matrix +as the given sample is implemented. +However it is possible to choose between a variance corrected +version or those with optimal MISE. +Additionally a smoothing factor can be set to adjust the +estimated density to non-bell-shaped data densities. + + +@subsubheading How To Use + + +VEMPK uses empirical distributions. The main parameter would be +the choice if of kernel density. However, currently only +Gaussian kernels are supported. The parameters for the density +are computed by a simple but robust method. However, it is +possible to control its behavior by changing the smoothing +factor. +Additionally, variance correction can be swithed on (at the +price of suboptimal MISE). + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_vempk_new,unur_vempk_new} +@item @ref{funct:unur_vempk_set_smoothing,unur_vempk_set_smoothing} +@item @ref{funct:unur_vempk_chg_smoothing,unur_vempk_chg_smoothing} +@item @ref{funct:unur_vempk_set_varcor,unur_vempk_set_varcor} +@item @ref{funct:unur_vempk_chg_varcor,unur_vempk_chg_varcor} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_vempk_new} +@deftypefn Function {UNUR_PAR*} unur_vempk_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_vempk_new} +@deftypefn {} {UNUR_PAR*} unur_vempk_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_vempk_set_smoothing} +@anchor{funct:unur_vempk_chg_smoothing} +@deftypefn Function {int} unur_vempk_set_smoothing (UNUR_PAR* @var{parameters}, double @var{smoothing}) +@deftypefnx Function {int} unur_vempk_chg_smoothing (UNUR_GEN* @var{generator}, double @var{smoothing}) +Set and change the smoothing factor. +The smoothing factor controlles how ``smooth'' the resulting density +estimation will be. A smoothing factor equal to 0 results in naive +resampling. A very large smoothing factor (together with the +variance correction) results in a density which is approximately +equal to the kernel. +Default is 1 which results in a smoothing parameter minimising +the MISE (mean integrated squared error) if the data are not too +far away from normal. If a large smoothing factor is used, then +variance correction must be switched on. + +Default: @code{1} +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_vempk_set_smoothing} +@anchor{funct:unur_vempk_chg_smoothing} +@deftypefn {} {int} unur_vempk_set_smoothing (UNUR_PAR* @var{parameters}, double @var{smoothing}) +@deftypefnx {} {int} unur_vempk_chg_smoothing (UNUR_GEN* @var{generator}, double @var{smoothing}) +Set and change the smoothing factor. +The smoothing factor controlles how ``smooth'' the resulting density +estimation will be. A smoothing factor equal to 0 results in naive +resampling. A very large smoothing factor (together with the +variance correction) results in a density which is approximately +equal to the kernel. +Default is 1 which results in a smoothing parameter minimising +the MISE (mean integrated squared error) if the data are not too +far away from normal. If a large smoothing factor is used, then +variance correction must be switched on. + +Default: @code{1} +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_vempk_set_varcor} +@anchor{funct:unur_vempk_chg_varcor} +@deftypefn Function {int} unur_vempk_set_varcor (UNUR_PAR* @var{parameters}, int @var{varcor}) +@deftypefnx Function {int} unur_vempk_chg_varcor (UNUR_GEN* @var{generator}, int @var{varcor}) +Switch variance correction in generator on/off. +If @var{varcor} is @code{TRUE} then the variance of the used +density estimation is the same as the sample variance. However this +increases the MISE of the estimation a little bit. + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_vempk_set_varcor} +@anchor{funct:unur_vempk_chg_varcor} +@deftypefn {} {int} unur_vempk_set_varcor (UNUR_PAR* @var{parameters}, int @var{varcor}) +@deftypefnx {} {int} unur_vempk_chg_varcor (UNUR_GEN* @var{generator}, int @var{varcor}) +Switch variance correction in generator on/off. +If @var{varcor} is @code{TRUE} then the variance of the used +density estimation is the same as the sample variance. However this +increases the MISE of the estimation a little bit. + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of vempk.h +@c ------------------------------------- +@c ------------------------------------- +@c methods.dh +@c + +@page +@node Methods_for_DISCR +@section Methods for discrete univariate distributions + +@menu +* DARI:: Discrete Automatic Rejection Inversion +* DAU:: (Discrete) Alias-Urn method +* DEXT:: wrapper for Discrete EXTernal generators +* DGT:: (Discrete) Guide Table method (indexed search) +* DSROU:: Discrete Simple Ratio-Of-Uniforms method +* DSS:: (Discrete) Sequential Search method +* DSTD:: Discrete STandarD distributions +@end menu + + + +@subheading Overview of methods + +@include methods_discr.texi + +@subheading Example + +@smallexample +@include ref_example_discr.texi +@end smallexample + +@subheading Example (String API) + +@smallexample +@include ref_example_discr_str.texi +@end smallexample + + + +@c +@c end of methods.dh +@c ------------------------------------- +@c ------------------------------------- +@c dari.h +@c + +@page +@node DARI +@subsection DARI -- Discrete Automatic Rejection Inversion + +@table @i +@item Required: +T-concave PMF, mode, approximate area +@item Speed: +Set-up: moderate, Sampling: fast +@item Reinit: +supported +@item Reference: +@ifhtml +@ref{bib:HDa96,, [HDa96]} +@end ifhtml +@ifnothtml +[HDa96] +@end ifnothtml +@ifhtml +@ref{bib:HLD04,, [HLD04: Sect.10.2; Alg.10.4]} +@end ifhtml +@ifnothtml +[HLD04: Sect.10.2; Alg.10.4] +@end ifnothtml + +@end table + + +DARI is based on rejection inversion, which can be seen as an +adaptation of transformed density rejection to discrete +distributions. The used transformation is +@iftex +@math{-1/\sqrt{x}} +@end iftex +@ifhtml +@html +-1/sqrt(x) +@end html +@end ifhtml +@ifinfo +@math{-1/sqrt(x)} +@end ifinfo +. + +DARI uses three almost optimal points for constructing the +(continuous) hat. Rejection is then done in horizontal +direction. Rejection inversion uses only one uniform random +variate per trial. + +DARI has moderate set-up times (the PMF is evaluated nine +times), and good marginal speed, especially if an auxiliary +array is used to store values during generation. + +DARI works for all +@iftex +@math{T_{-1/2}} +@end iftex +@ifhtml +@html +T_-1/2 +@end html +@end ifhtml +@ifinfo +@math{T_(-1/2)} +@end ifinfo +-concave distributions. It requires the PMF +and the location of the mode. Moreover the approximate sum over the PMF +is used. (If no sum is given for the distribution the algorithm +assumes that it is approximately 1.) +The rejection constant is bounded from above by 4 for all @i{T}-concave +distributions. + + +@subsubheading How To Use + + +DARI works for discrete distribution object with given PMF. +The sum over probabilities should be approximately +one. Otherwise it must be set by a +@ifhtml +@ref{funct:unur_distr_discr_set_pmfsum,@command{unur_distr_discr_set_pmfsum}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_set_pmfsum} +@end ifnothtml +call to its (approximate) value. + +The size of an auxiliary table can be set by +@ifhtml +@ref{funct:unur_dari_set_tablesize,@command{unur_dari_set_tablesize}.} +@end ifhtml +@ifnothtml +@command{unur_dari_set_tablesize}. +@end ifnothtml +The expected number of evaluations can be reduced by switching +the use of squeezes by means of +@ifhtml +@ref{funct:unur_dari_set_squeeze,@command{unur_dari_set_squeeze}.} +@end ifhtml +@ifnothtml +@command{unur_dari_set_squeeze}. +@end ifnothtml +It is possible to change the parameters and the domain of the chosen +distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator object. +Notice, that derived parameters like the mode must also be (re-) set +if the parameters or the domain has be changed. + +There exists a test mode that verifies whether the conditions for +the method are satisfied or not. It can be switched on by calling +@ifhtml +@ref{funct:unur_dari_set_verify,@command{unur_dari_set_verify}} +@end ifhtml +@ifnothtml +@command{unur_dari_set_verify} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_dari_chg_verify,@command{unur_dari_chg_verify},} +@end ifhtml +@ifnothtml +@command{unur_dari_chg_verify}, +@end ifnothtml +respectively. +Notice however that sampling is (much) slower then. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_dari_new,unur_dari_new} +@item @ref{funct:unur_dari_set_squeeze,unur_dari_set_squeeze} +@item @ref{funct:unur_dari_set_tablesize,unur_dari_set_tablesize} +@item @ref{funct:unur_dari_set_cpfactor,unur_dari_set_cpfactor} +@item @ref{funct:unur_dari_set_verify,unur_dari_set_verify} +@item @ref{funct:unur_dari_chg_verify,unur_dari_chg_verify} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_dari_new} +@deftypefn Function {UNUR_PAR*} unur_dari_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dari_new} +@deftypefn {} {UNUR_PAR*} unur_dari_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_dari_set_squeeze} +@deftypefn Function {int} unur_dari_set_squeeze (UNUR_PAR* @var{parameters}, int @var{squeeze}) +Turn utilization of the squeeze of the algorithm on/off. +This squeeze does not resamble the squeeze of the continuous TDR +method. It was especially designed for rejection inversion. + +The squeeze is not necessary if the size of the auxiliary table is +big enough (for the given distribution). +Using a squeeze is suggested to speed up the algorithm if the +domain of the distribution is very big or if only small samples are +produced. + +Default: no squeeze. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dari_set_squeeze} +@deftypefn {} {int} unur_dari_set_squeeze (UNUR_PAR* @var{parameters}, int @var{squeeze}) +Turn utilization of the squeeze of the algorithm on/off. +This squeeze does not resamble the squeeze of the continuous TDR +method. It was especially designed for rejection inversion. + +The squeeze is not necessary if the size of the auxiliary table is +big enough (for the given distribution). +Using a squeeze is suggested to speed up the algorithm if the +domain of the distribution is very big or if only small samples are +produced. + +Default: no squeeze. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_dari_set_tablesize} +@deftypefn Function {int} unur_dari_set_tablesize (UNUR_PAR* @var{parameters}, int @var{size}) +Set the size for the auxiliary table, that stores constants +computed during generation. +If @var{size} is set to @code{0} no table is used. +The speed-up can be impressive if the PMF is expensive to +evaluate and the ``main part of the distribution'' is concentrated +in an interval shorter than the size of the table. + +Default is @code{100}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dari_set_tablesize} +@deftypefn {} {int} unur_dari_set_tablesize (UNUR_PAR* @var{parameters}, int @var{size}) +Set the size for the auxiliary table, that stores constants +computed during generation. +If @var{size} is set to @code{0} no table is used. +The speed-up can be impressive if the PMF is expensive to +evaluate and the ``main part of the distribution'' is concentrated +in an interval shorter than the size of the table. + +Default is @code{100}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_dari_set_cpfactor} +@deftypefn Function {int} unur_dari_set_cpfactor (UNUR_PAR* @var{parameters}, double @var{cp_factor}) +Set factor for position of the left and right construction point, +resp. +The @var{cp_factor} is used to find almost optimal construction +points for the hat function. +The @var{cp_factor} must be positive and should not exceed 2. +There is no need to change this factor in almost all situations. + +Default is @code{0.664}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dari_set_cpfactor} +@deftypefn {} {int} unur_dari_set_cpfactor (UNUR_PAR* @var{parameters}, double @var{cp_factor}) +Set factor for position of the left and right construction point, +resp. +The @var{cp_factor} is used to find almost optimal construction +points for the hat function. +The @var{cp_factor} must be positive and should not exceed 2. +There is no need to change this factor in almost all situations. + +Default is @code{0.664}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_dari_set_verify} +@anchor{funct:unur_dari_chg_verify} +@deftypefn Function {int} unur_dari_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx Function {int} unur_dari_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the condition is violated for some @i{x} then @code{unur_errno} +is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this +might happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dari_set_verify} +@anchor{funct:unur_dari_chg_verify} +@deftypefn {} {int} unur_dari_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx {} {int} unur_dari_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the condition is violated for some @i{x} then @code{unur_errno} +is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this +might happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of dari.h +@c ------------------------------------- +@c ------------------------------------- +@c dau.h +@c + +@page +@node DAU +@subsection DAU -- (Discrete) Alias-Urn method + +@table @i +@item Required: +probability vector (PV) +@item Speed: +Set-up: slow (linear with the vector-length), Sampling: very fast +@item Reinit: +supported +@item Reference: +@ifhtml +@ref{bib:WAa77,, [WAa77]} +@end ifhtml +@ifnothtml +[WAa77] +@end ifnothtml +@ifhtml +@ref{bib:HLD04,, [HLD04: Sect.3.2]} +@end ifhtml +@ifnothtml +[HLD04: Sect.3.2] +@end ifnothtml + +@end table + + +DAU samples from distributions with arbitrary but finite +probability vectors (PV) of length @i{N}. +The algorithmus is based on an ingeneous method by A.J. Walker +and requires a table of size (at least) @i{N}. +It needs one random numbers and only one comparison for each +generated random variate. The setup time for constructing the +tables is @i{O(N)}. + +By default the probability vector is indexed starting at +@code{0}. However this can be changed in the distribution object by +a +@ifhtml +@ref{funct:unur_distr_discr_set_domain,@command{unur_distr_discr_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_set_domain} +@end ifnothtml +call. + +The method also works when no probability vector but a PMF is +given. However then additionally a bounded (not too large) domain +must be given or the sum over the PMF (see +@ifhtml +@ref{funct:unur_distr_discr_make_pv,@command{unur_distr_discr_make_pv}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_make_pv} +@end ifnothtml +for details). + + +@subsubheading How To Use + + +Create an object for a discrete distribution either by setting a +probability vector or a PMF. The performance can be slightly +influenced by setting the size of the used table which can be +changed by +@ifhtml +@ref{funct:unur_dau_set_urnfactor,@command{unur_dau_set_urnfactor}.} +@end ifhtml +@ifnothtml +@command{unur_dau_set_urnfactor}. +@end ifnothtml +It is possible to change the parameters and the domain of the chosen +distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator object. + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_dau_new,unur_dau_new} +@item @ref{funct:unur_dau_set_urnfactor,unur_dau_set_urnfactor} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_dau_new} +@deftypefn Function {UNUR_PAR*} unur_dau_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dau_new} +@deftypefn {} {UNUR_PAR*} unur_dau_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_dau_set_urnfactor} +@deftypefn Function {int} unur_dau_set_urnfactor (UNUR_PAR* @var{parameters}, double @var{factor}) +Set size of urn table relative to length of the probability +vector. It must not be less than 1. Larger tables result in +(slightly) faster generation times but require a more expensive +setup. However sizes larger than 2 are not recommended. + +Default is @code{1}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dau_set_urnfactor} +@deftypefn {} {int} unur_dau_set_urnfactor (UNUR_PAR* @var{parameters}, double @var{factor}) +Set size of urn table relative to length of the probability +vector. It must not be less than 1. Larger tables result in +(slightly) faster generation times but require a more expensive +setup. However sizes larger than 2 are not recommended. + +Default is @code{1}. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of dau.h +@c ------------------------------------- +@c ------------------------------------- +@c dext.h +@c + +@page +@node DEXT +@subsection DEXT -- wrapper for Discrete EXTernal generators + +@table @i +@item Required: +routine for sampling discrete random variates +@item Speed: +depends on external generator +@item Reinit: +supported +@end table + + +Method DEXT is a wrapper for external generators for discrete +univariate distributions. It allows the usage of external +random variate generators within the UNU.RAN framework. + + +@subsubheading How To Use + + +The following steps are required to use some external generator +within the UNU.RAN framework (some of these are optional): + +@enumerate +@item +Make an empty generator object using a +@ifhtml +@ref{funct:unur_dext_new,@command{unur_dext_new}} +@end ifhtml +@ifnothtml +@command{unur_dext_new} +@end ifnothtml +call. +The argument @var{distribution} is optional and can be replaced +by @code{NULL}. However, it is required if you want to pass +parameters of the generated distribution to the external +generator or for running some validation tests provided by +UNU.RAN. + +@item +Create an initialization routine of type +@code{int (*init)(UNUR_GEN *gen)} and plug it into the generator +object using the +@ifhtml +@ref{funct:unur_dext_set_init,@command{unur_dext_set_init}} +@end ifhtml +@ifnothtml +@command{unur_dext_set_init} +@end ifnothtml +call. Notice that the +@var{init} routine must return @code{UNUR_SUCCESS} when it has +been executed successfully and @code{UNUR_FAILURE} otherwise. +It is possible to get the size of and the pointer to the array +of parameters of the underlying distribution object by the +respective calls +@ifhtml +@ref{funct:unur_dext_get_ndistrparams,@command{unur_dext_get_ndistrparams}} +@end ifhtml +@ifnothtml +@command{unur_dext_get_ndistrparams} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_dext_get_distrparams,@command{unur_dext_get_distrparams}.} +@end ifhtml +@ifnothtml +@command{unur_dext_get_distrparams}. +@end ifnothtml +Parameters for the external generator that are computed in the +@var{init} routine can be stored in a single array or structure +which is available by the +@ifhtml +@ref{funct:unur_dext_get_params,@command{unur_dext_get_params}} +@end ifhtml +@ifnothtml +@command{unur_dext_get_params} +@end ifnothtml +call. + +Using an @var{init} routine is optional and can be omitted. + +@item +Create a sampling routine of type +@code{int (*sample)(UNUR_GEN *gen)} and plug it into the +generator object using the +@ifhtml +@ref{funct:unur_dext_set_sample,@command{unur_dext_set_sample}} +@end ifhtml +@ifnothtml +@command{unur_dext_set_sample} +@end ifnothtml +call. + +Uniform random numbers are provided by the +@ifhtml +@ref{funct:unur_sample_urng,@command{unur_sample_urng}} +@end ifhtml +@ifnothtml +@command{unur_sample_urng} +@end ifnothtml +call. Do not use your own implementation of a uniform random +number generator directly. If you want to use your own random +number generator we recommend to use the UNU.RAN interface (see +@pxref{URNG,,Using uniform random number generators}). + +The array or structure that contains parameters for the external +generator that are computed in the @var{init} routine are +available using the +@ifhtml +@ref{funct:unur_dext_get_params,@command{unur_dext_get_params}} +@end ifhtml +@ifnothtml +@command{unur_dext_get_params} +@end ifnothtml +call. + +Using a @var{sample} routine is of course obligatory. +@end enumerate + +It is possible to change the parameters and the domain of the +chosen distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the +generator object. The @var{init} routine is then called again. + +Here is a short example that demonstrates the application of +this method by means of the geometric distribution: + +@smallexample +@include ref_example_dext.texi +@end smallexample + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_dext_new,unur_dext_new} +@item @ref{funct:unur_dext_set_init,unur_dext_set_init} +@item @ref{funct:unur_dext_set_sample,unur_dext_set_sample} +@item @ref{funct:unur_dext_get_params,unur_dext_get_params} +@item @ref{funct:unur_dext_get_distrparams,unur_dext_get_distrparams} +@item @ref{funct:unur_dext_get_ndistrparams,unur_dext_get_ndistrparams} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_dext_new} +@deftypefn Function {UNUR_PAR*} unur_dext_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for new generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dext_new} +@deftypefn {} {UNUR_PAR*} unur_dext_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for new generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_dext_set_init} +@deftypefn Function {int} unur_dext_set_init (UNUR_PAR* @var{parameters}, int (* @var{init})(UNUR_GEN* gen )) +Set initialization routine for external generator. Inside the + +@emph{Important:} The routine @var{init} must return +@code{UNUR_SUCCESS} when the generator was initialized successfully +and @code{UNUR_FAILURE} otherwise. + +Parameters that are computed in the @var{init} routine can be +stored in an array or structure that is avaiable by means of the +@ifhtml +@ref{funct:unur_dext_get_params,@command{unur_dext_get_params}} +@end ifhtml +@ifnothtml +@command{unur_dext_get_params} +@end ifnothtml +call. Parameters of the underlying +distribution object can be obtained by the +@ifhtml +@ref{funct:unur_dext_get_distrparams,@command{unur_dext_get_distrparams}} +@end ifhtml +@ifnothtml +@command{unur_dext_get_distrparams} +@end ifnothtml +call. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dext_set_init} +@deftypefn {} {int} unur_dext_set_init (UNUR_PAR* @var{parameters}, int (* @var{init})(UNUR_GEN* gen )) +Set initialization routine for external generator. Inside the + +@emph{Important:} The routine @var{init} must return +@code{UNUR_SUCCESS} when the generator was initialized successfully +and @code{UNUR_FAILURE} otherwise. + +Parameters that are computed in the @var{init} routine can be +stored in an array or structure that is avaiable by means of the +@ifhtml +@ref{funct:unur_dext_get_params,@command{unur_dext_get_params}} +@end ifhtml +@ifnothtml +@command{unur_dext_get_params} +@end ifnothtml +call. Parameters of the underlying +distribution object can be obtained by the +@ifhtml +@ref{funct:unur_dext_get_distrparams,@command{unur_dext_get_distrparams}} +@end ifhtml +@ifnothtml +@command{unur_dext_get_distrparams} +@end ifnothtml +call. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_dext_set_sample} +@deftypefn Function {int} unur_dext_set_sample (UNUR_PAR* @var{parameters}, int (* @var{sample})(UNUR_GEN* gen )) +Set sampling routine for external generator. + +@emph{Important:} +Use @code{unur_sample_urng(gen)} to get a uniform random number. +The pointer to the array or structure that contains the parameters +that are precomputed in the @var{init} routine are available by +@code{unur_dext_get_params(gen,0)}. +Additionally one can use the +@ifhtml +@ref{funct:unur_dext_get_distrparams,@command{unur_dext_get_distrparams}} +@end ifhtml +@ifnothtml +@command{unur_dext_get_distrparams} +@end ifnothtml +call. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dext_set_sample} +@deftypefn {} {int} unur_dext_set_sample (UNUR_PAR* @var{parameters}, int (* @var{sample})(UNUR_GEN* gen )) +Set sampling routine for external generator. + +@emph{Important:} +Use @code{unur_sample_urng(gen)} to get a uniform random number. +The pointer to the array or structure that contains the parameters +that are precomputed in the @var{init} routine are available by +@code{unur_dext_get_params(gen,0)}. +Additionally one can use the +@ifhtml +@ref{funct:unur_dext_get_distrparams,@command{unur_dext_get_distrparams}} +@end ifhtml +@ifnothtml +@command{unur_dext_get_distrparams} +@end ifnothtml +call. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_dext_get_params} +@deftypefn Function {void*} unur_dext_get_params (UNUR_GEN* @var{generator}, size_t @var{size}) +Get pointer to memory block for storing parameters of external +generator. A memory block of size @var{size} is automatically (re-) +allocated if necessary and the pointer to this block is stored in +the @var{generator} object. If one only needs the pointer to this +memory block set @var{size} to @code{0}. + +Notice, that @var{size} is the size of the memory block and not the +length of an array. + +@emph{Important:} This rountine should only be used in the +initialization and sampling routine of the external generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dext_get_params} +@deftypefn {} {void*} unur_dext_get_params (UNUR_GEN* @var{generator}, size_t @var{size}) +Get pointer to memory block for storing parameters of external +generator. A memory block of size @var{size} is automatically (re-) +allocated if necessary and the pointer to this block is stored in +the @var{generator} object. If one only needs the pointer to this +memory block set @var{size} to @code{0}. + +Notice, that @var{size} is the size of the memory block and not the +length of an array. + +@emph{Important:} This rountine should only be used in the +initialization and sampling routine of the external generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_dext_get_distrparams} +@anchor{funct:unur_dext_get_ndistrparams} +@deftypefn Function {double*} unur_dext_get_distrparams (UNUR_GEN* @var{generator}) +@deftypefnx Function {int} unur_dext_get_ndistrparams (UNUR_GEN* @var{generator}) +Get size of and pointer to array of parameters of underlying +distribution in @var{generator} object. + +@emph{Important:} These rountines should only be used in the +initialization and sampling routine of the external generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dext_get_distrparams} +@anchor{funct:unur_dext_get_ndistrparams} +@deftypefn {} {double*} unur_dext_get_distrparams (UNUR_GEN* @var{generator}) +@deftypefnx {} {int} unur_dext_get_ndistrparams (UNUR_GEN* @var{generator}) +Get size of and pointer to array of parameters of underlying +distribution in @var{generator} object. + +@emph{Important:} These rountines should only be used in the +initialization and sampling routine of the external generator. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of dext.h +@c ------------------------------------- +@c ------------------------------------- +@c dgt.h +@c + +@page +@node DGT +@subsection DGT -- (Discrete) Guide Table method (indexed search) + +@table @i +@item Required: +probability vector (PV) +@item Speed: +Set-up: slow (linear with the vector-length), Sampling: very fast +@item Reinit: +supported +@item Reference: +@ifhtml +@ref{bib:CAa74,, [CAa74]} +@end ifhtml +@ifnothtml +[CAa74] +@end ifnothtml +@ifhtml +@ref{bib:HLD04,, [HLD04: Sect.3.1.2]} +@end ifhtml +@ifnothtml +[HLD04: Sect.3.1.2] +@end ifnothtml + +@end table + + +DGT samples from arbitrary but finite probability vectors. Random +numbers are generated by the inversion method, i.e., + +@enumerate +@item +Generate a random number U ~ U(0,1). +@item +Find smallest integer I such that F(I) = P(X<=I) >= U. +@end enumerate + +Step (2) is the crucial step. Using sequential search requires +@i{O(E(X))} comparisons, where @i{E(X)} is the expectation of +the distribution. Indexed search, however, uses a guide table to +jump to some @i{I'} <= @i{I} near @i{I} to find @i{X} in constant +time. Indeed the expected number of comparisons is reduced to 2, +when the guide table has the same size as the probability vector +(this is the default). For larger guide tables this number +becomes smaller (but is always larger than 1), for smaller +tables it becomes larger. For the limit case of table size 1 the +algorithm simply does sequential search (but uses a more expensive +setup then method DSS (@pxref{DSS}). On the other hand the +setup time for guide table is @i{O(N)}, where @i{N} denotes the +length of the probability vector (for size 1 no preprocessing is +required). Moreover, for very large guide tables memory effects might +even reduce the speed of the algorithm. So we do not recommend to +use guide tables that are more than three times larger than the +given probability vector. If only a few random numbers have to be +generated, (much) smaller table sizes are better. +The size of the guide table relative to the length of the given +probability vector can be set by a +@ifhtml +@ref{funct:unur_dgt_set_guidefactor,@command{unur_dgt_set_guidefactor}} +@end ifhtml +@ifnothtml +@command{unur_dgt_set_guidefactor} +@end ifnothtml +call. + +There exist two variants for the setup step which can be set by a +@ifhtml +@ref{funct:unur_dgt_set_variant,@command{unur_dgt_set_variant}} +@end ifhtml +@ifnothtml +@command{unur_dgt_set_variant} +@end ifnothtml +call: Variants 1 and 2. +Variant 2 is faster but more sensitive to roundoff errors when the +guide table is large. By default variant 2 is used for short +probability vectors (@i{N}<1000) and variant 1 otherwise. + +By default the probability vector is indexed starting at +@code{0}. However this can be changed in the distribution object by +a +@ifhtml +@ref{funct:unur_distr_discr_set_domain,@command{unur_distr_discr_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_set_domain} +@end ifnothtml +call. + +The method also works when no probability vector but a PMF is +given. However, then additionally a bounded (not too large) domain +must be given or the sum over the PMF. In the latter case the +domain of the distribution is trucated (see +@ifhtml +@ref{funct:unur_distr_discr_make_pv,@command{unur_distr_discr_make_pv}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_make_pv} +@end ifnothtml +for details). + + +@subsubheading How To Use + + +Create an object for a discrete distribution either by setting a +probability vector or a PMF. The performance can be slightly +influenced by setting the size of the used table which can be +changed by +@ifhtml +@ref{funct:unur_dgt_set_guidefactor,@command{unur_dgt_set_guidefactor}.} +@end ifhtml +@ifnothtml +@command{unur_dgt_set_guidefactor}. +@end ifnothtml +It is possible to change the parameters and the domain of the chosen +distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator object. + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_dgt_new,unur_dgt_new} +@item @ref{funct:unur_dgt_set_guidefactor,unur_dgt_set_guidefactor} +@item @ref{funct:unur_dgt_set_variant,unur_dgt_set_variant} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_dgt_new} +@deftypefn Function {UNUR_PAR*} unur_dgt_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dgt_new} +@deftypefn {} {UNUR_PAR*} unur_dgt_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_dgt_set_guidefactor} +@deftypefn Function {int} unur_dgt_set_guidefactor (UNUR_PAR* @var{parameters}, double @var{factor}) +Set size of guide table relative to length of PV. +Larger guide tables result in faster generation time but require a +more expensive setup. Sizes larger than 3 are not recommended. +If the relative size is set to 0, sequential search is used. +However, this is not recommended, except in exceptional cases, since +method DSS (@pxref{DSS}) is has almost no setup and is thus faster +(but requires the sum over the PV as input parameter). + +Default is @code{1}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dgt_set_guidefactor} +@deftypefn {} {int} unur_dgt_set_guidefactor (UNUR_PAR* @var{parameters}, double @var{factor}) +Set size of guide table relative to length of PV. +Larger guide tables result in faster generation time but require a +more expensive setup. Sizes larger than 3 are not recommended. +If the relative size is set to 0, sequential search is used. +However, this is not recommended, except in exceptional cases, since +method DSS (@pxref{DSS}) is has almost no setup and is thus faster +(but requires the sum over the PV as input parameter). + +Default is @code{1}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_dgt_set_variant} +@deftypefn Function {int} unur_dgt_set_variant (UNUR_PAR* @var{parameters}, unsigned @var{variant}) +Set variant for setup step. Possible values are @code{1} or +@code{2}. +Variant @code{2} is faster but more sensitive to roundoff errors +when the guide table is large. +By default variant @code{2} is used for short probability +vectors (@i{N}<1000) and variant @code{1} otherwise. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dgt_set_variant} +@deftypefn {} {int} unur_dgt_set_variant (UNUR_PAR* @var{parameters}, unsigned @var{variant}) +Set variant for setup step. Possible values are @code{1} or +@code{2}. +Variant @code{2} is faster but more sensitive to roundoff errors +when the guide table is large. +By default variant @code{2} is used for short probability +vectors (@i{N}<1000) and variant @code{1} otherwise. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of dgt.h +@c ------------------------------------- +@c ------------------------------------- +@c dsrou.h +@c + +@page +@node DSROU +@subsection DSROU -- Discrete Simple Ratio-Of-Uniforms method + +@table @i +@item Required: +T-concave PMF, mode, sum over PMF +@item Speed: +Set-up: fast, Sampling: slow +@item Reinit: +supported +@item Reference: +@ifhtml +@ref{bib:LJa01,, [LJa01]} +@end ifhtml +@ifnothtml +[LJa01] +@end ifnothtml +@ifhtml +@ref{bib:HLD04,, [HLD04: Sect.10.3.2; Alg.10.6]} +@end ifhtml +@ifnothtml +[HLD04: Sect.10.3.2; Alg.10.6] +@end ifnothtml + +@end table + + +DSROU is based on the ratio-of-uniforms method +(@pxref{Ratio-of-Uniforms}) but uses universal +inequalities for constructing a (universal) bounding rectangle. +It works for all @i{T}-concave distributions with +@iftex +@math{T(x) = -1/\sqrt{x}} +@end iftex +@ifhtml +@html +T(x) = -1/sqrt(x) +@end html +@end ifhtml +@ifinfo +@math{T(x) = -1/sqrt(x)} +@end ifinfo +. + +The method requires the PMF, the (exact) location of the mode +and the sum over the given PDF. The rejection constant is 4 for +all @i{T}-concave distributions. Optionally the CDF at the mode +can be given to increase the performance of the algorithm. Then +the rejection constant is reduced to 2. + + +@subsubheading How To Use + + +The method works for @i{T}-concave discrete distributions with +given PMF. The sum over of the PMF or an upper bound of this sum +must be known. + +Optionally the CDF at the mode can be given to increase the +performance using +@ifhtml +@ref{funct:unur_dsrou_set_cdfatmode,@command{unur_dsrou_set_cdfatmode}.} +@end ifhtml +@ifnothtml +@command{unur_dsrou_set_cdfatmode}. +@end ifnothtml +However, this @strong{must not} be called if the sum over the +PMF is replaced by an upper bound. + +It is possible to change the parameters and the domain of the chosen +distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator object. + +If any of mode, CDF at mode, or the sum over the PMF has been +changed, then +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +must be executed. +(Otherwise the generator produces garbage). + +There exists a test mode that verifies whether the conditions +for the method are satisfied or not while sampling. It can be +switched on or off by calling +@ifhtml +@ref{funct:unur_dsrou_set_verify,@command{unur_dsrou_set_verify}} +@end ifhtml +@ifnothtml +@command{unur_dsrou_set_verify} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_dsrou_chg_verify,@command{unur_dsrou_chg_verify},} +@end ifhtml +@ifnothtml +@command{unur_dsrou_chg_verify}, +@end ifnothtml +respectively. +Notice however that sampling is (a little bit) slower then. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_dsrou_new,unur_dsrou_new} +@item @ref{funct:unur_dsrou_set_cdfatmode,unur_dsrou_set_cdfatmode} +@item @ref{funct:unur_dsrou_set_verify,unur_dsrou_set_verify} +@item @ref{funct:unur_dsrou_chg_verify,unur_dsrou_chg_verify} +@item @ref{funct:unur_dsrou_chg_cdfatmode,unur_dsrou_chg_cdfatmode} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_dsrou_new} +@deftypefn Function {UNUR_PAR*} unur_dsrou_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dsrou_new} +@deftypefn {} {UNUR_PAR*} unur_dsrou_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_dsrou_set_cdfatmode} +@deftypefn Function {int} unur_dsrou_set_cdfatmode (UNUR_PAR* @var{parameters}, double @var{Fmode}) +Set CDF at mode. +When set, the performance of the algorithm is increased by factor 2. +However, when the parameters of the distribution are changed +@ifhtml +@ref{funct:unur_dsrou_chg_cdfatmode,@command{unur_dsrou_chg_cdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_dsrou_chg_cdfatmode} +@end ifnothtml +has to be used to update this value. +Notice that the algorithm detects a mode at the left boundary of +the domain automatically and it is not necessary to use this call +for a monotonically decreasing PMF. + +Default: not set. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dsrou_set_cdfatmode} +@deftypefn {} {int} unur_dsrou_set_cdfatmode (UNUR_PAR* @var{parameters}, double @var{Fmode}) +Set CDF at mode. +When set, the performance of the algorithm is increased by factor 2. +However, when the parameters of the distribution are changed +@ifhtml +@ref{funct:unur_dsrou_chg_cdfatmode,@command{unur_dsrou_chg_cdfatmode}} +@end ifhtml +@ifnothtml +@command{unur_dsrou_chg_cdfatmode} +@end ifnothtml +has to be used to update this value. +Notice that the algorithm detects a mode at the left boundary of +the domain automatically and it is not necessary to use this call +for a monotonically decreasing PMF. + +Default: not set. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_dsrou_set_verify} +@anchor{funct:unur_dsrou_chg_verify} +@deftypefn Function {int} unur_dsrou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx Function {int} unur_dsrou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the condition squeeze(@i{x}) <= PMF(@i{x}) <= hat(@i{x}) is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dsrou_set_verify} +@anchor{funct:unur_dsrou_chg_verify} +@deftypefn {} {int} unur_dsrou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) +@deftypefnx {} {int} unur_dsrou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) +Turn verifying of algorithm while sampling on/off. +If the condition squeeze(@i{x}) <= PMF(@i{x}) <= hat(@i{x}) is +violated for some @i{x} then @code{unur_errno} is set to +@code{UNUR_ERR_GEN_CONDITION}. However notice that this might +happen due to round-off errors for a few values of +@i{x} (less than 1%). + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_dsrou_chg_cdfatmode} +@deftypefn Function {int} unur_dsrou_chg_cdfatmode (UNUR_GEN* @var{generator}, double @var{Fmode}) +Change CDF at mode of distribution. +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +must be executed before sampling from the +generator again. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dsrou_chg_cdfatmode} +@deftypefn {} {int} unur_dsrou_chg_cdfatmode (UNUR_GEN* @var{generator}, double @var{Fmode}) +Change CDF at mode of distribution. +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +must be executed before sampling from the +generator again. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of dsrou.h +@c ------------------------------------- +@c ------------------------------------- +@c dss.h +@c + +@page +@node DSS +@subsection DSS -- (Discrete) Sequential Search method + +@table @i +@item Required: +probability vector (PV) and sum over PV; or probability mass function(PMF), sum over PV and domain; or or cumulative distribution function (CDF) +@item Speed: +Set-up: fast, Sampling: very slow (linear in expectation) +@item Reinit: +supported +@item Reference: +@ifhtml +@ref{bib:HLD04,, [HLD04: Sect.3.1.1; Alg.3.1]} +@end ifhtml +@ifnothtml +[HLD04: Sect.3.1.1; Alg.3.1] +@end ifnothtml + +@end table + + +DSS samples from arbitrary discrete distributions. +Random numbers are generated by the inversion method, i.e., + +@enumerate +@item +Generate a random number U ~ U(0,1). +@item +Find smallest integer I such that F(I) = P(X<=I) >= U. +@end enumerate + +Step (2) is the crucial step. Using sequential search requires +@i{O(E(X))} comparisons, where @i{E(X)} is the expectation of +the distribution. Thus this method is only recommended when only +a few random variates from the given distribution are required. +Otherwise, table methods like DGT (@pxref{DGT}) or DAU (@pxref{DAU}) +are much faster. These methods also need not the sum over the +PMF (or PV) as input. On the other hand, however, these methods +always compute a table. + +DSS runs with the PV, the PMF, or the CDF of the distribution. +It uses actually uses the first one in this list (in this +ordering) that could be found. + + +@subsubheading How To Use + + +It works with a discrete distribution object with contains at +least the PV, the PMF, or the CDF. + +It is possible to change the parameters and the domain of the chosen +distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator object. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_dss_new,unur_dss_new} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_dss_new} +@deftypefn Function {UNUR_PAR*} unur_dss_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dss_new} +@deftypefn {} {UNUR_PAR*} unur_dss_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of dss.h +@c ------------------------------------- +@c ------------------------------------- +@c dstd.h +@c + +@page +@node DSTD +@subsection DSTD -- Discrete STandarD distributions + +@table @i +@item Required: +standard distribution from UNU.RAN library (@pxref{Stddist,,Standard distributions}) or discrete distribution with inverse CDF. +@item Speed: +Set-up: fast, Sampling: depends on distribution and generator +@item Reinit: +supported +@end table + + +DSTD is a wrapper for special generators for discrete univariate +standard distributions. It only works for distributions in the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}) +or for discrete distributions where the inverse CDF is given. +If a distribution object is provided that is build from scratch, +it must provide the inverse CDF. Then CSTD implements the +inversion method. Otherwise, the @code{NULL} pointer is returned. + +For some distributions more than one special generator +is possible. + + +@subsubheading How To Use + + +Create a distribution object for a standard distribution +from the UNU.RAN library +(@pxref{Stddist,,Standard distributions}), +or create a discrete distribution object and set the function +for the inverse CDF using +@ifhtml +@ref{funct:unur_distr_discr_set_invcdf,@command{unur_distr_discr_set_invcdf}.} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_set_invcdf}. +@end ifnothtml +For some distributions more than one special generator +(@emph{variants}) is possible. These can be choosen by a +@ifhtml +@ref{funct:unur_dstd_set_variant,@command{unur_dstd_set_variant}} +@end ifhtml +@ifnothtml +@command{unur_dstd_set_variant} +@end ifnothtml +call. For possible variants +@xref{Stddist,,Standard distributions}. +However the following are common to all distributions: + +@table @code +@item UNUR_STDGEN_DEFAULT +the default generator. +@item UNUR_STDGEN_FAST +the fastest available special generator. +@item UNUR_STDGEN_INVERSION +the inversion method (if available). +@end table + +Notice that the variant @code{UNUR_STDGEN_FAST} for a special +generator might be slower than one of the universal algorithms! +Additional variants may exist for particular distributions. + +Sampling from truncated distributions (which can be constructed by +changing the default domain of a distribution by means of +@ifhtml +@ref{funct:unur_distr_discr_set_domain,@command{unur_distr_discr_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_set_domain} +@end ifnothtml +or unur_dstd_chg_truncated calls) +is possible but requires the inversion method. Moreover the CDF +of the distribution must be implemented. + +It is possible to change the parameters and the domain of the chosen +distribution and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator object. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_dstd_new,unur_dstd_new} +@item @ref{funct:unur_dstd_set_variant,unur_dstd_set_variant} +@item @ref{funct:unur_dstd_chg_truncated,unur_dstd_chg_truncated} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_dstd_new} +@deftypefn Function {UNUR_PAR*} unur_dstd_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for new generator. It requires a distribution object +for a discrete univariant distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}). + +Using a truncated distribution is allowed only if the inversion method +is available and selected by the +@ifhtml +@ref{funct:unur_dstd_set_variant,@command{unur_dstd_set_variant}} +@end ifhtml +@ifnothtml +@command{unur_dstd_set_variant} +@end ifnothtml +call immediately +after creating the parameter object. +Use a +@ifhtml +@ref{funct:unur_distr_discr_set_domain,@command{unur_distr_discr_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_set_domain} +@end ifnothtml +call to get a truncated +distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dstd_new} +@deftypefn {} {UNUR_PAR*} unur_dstd_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for new generator. It requires a distribution object +for a discrete univariant distribution from the +UNU.RAN library of standard distributions +(@pxref{Stddist,,Standard distributions}). + +Using a truncated distribution is allowed only if the inversion method +is available and selected by the +@ifhtml +@ref{funct:unur_dstd_set_variant,@command{unur_dstd_set_variant}} +@end ifhtml +@ifnothtml +@command{unur_dstd_set_variant} +@end ifnothtml +call immediately +after creating the parameter object. +Use a +@ifhtml +@ref{funct:unur_distr_discr_set_domain,@command{unur_distr_discr_set_domain}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_set_domain} +@end ifnothtml +call to get a truncated +distribution. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_dstd_set_variant} +@deftypefn Function {int} unur_dstd_set_variant (UNUR_PAR* @var{parameters}, unsigned @var{variant}) +Set variant (special generator) for sampling from a given distribution. +For possible variants +@pxref{Stddist,,Standard distributions}. + +Common variants are @code{UNUR_STDGEN_DEFAULT} for the default generator, +@code{UNUR_STDGEN_FAST} for (one of the) fastest implemented +special generators, and @code{UNUR_STDGEN_INVERSION} for the +inversion method (if available). +If the selected variant number is not implemented, then an error code is +returned and the variant is not changed. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dstd_set_variant} +@deftypefn {} {int} unur_dstd_set_variant (UNUR_PAR* @var{parameters}, unsigned @var{variant}) +Set variant (special generator) for sampling from a given distribution. +For possible variants +@pxref{Stddist,,Standard distributions}. + +Common variants are @code{UNUR_STDGEN_DEFAULT} for the default generator, +@code{UNUR_STDGEN_FAST} for (one of the) fastest implemented +special generators, and @code{UNUR_STDGEN_INVERSION} for the +inversion method (if available). +If the selected variant number is not implemented, then an error code is +returned and the variant is not changed. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_dstd_chg_truncated} +@deftypefn Function {int} unur_dstd_chg_truncated (UNUR_GEN* @var{generator}, int @var{left}, int @var{right}) +Change left and right border of the domain of the (truncated) distribution. +This is only possible if the inversion method is used. +Otherwise this call has no effect and an error code is returned. + +Notice that the given truncated domain must be a subset of the +domain of the given distribution. The generator always uses the +intersection of the domain of the distribution and the truncated +domain given by this call. + +It is not required to run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +after this call has been used. + +@emph{Important:} If the CDF is (almost) the same for @var{left} and +@var{right} and (almost) equal to @code{0} or @code{1}, then the truncated +domain is not chanced and the call returns an error code. + +@emph{Notice:} If the parameters of the distribution has been changed +it is recommended to set the truncated domain again, since the +former call might change the domain of the distribution but not +update the values for the boundaries of the truncated +distribution. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_dstd_chg_truncated} +@deftypefn {} {int} unur_dstd_chg_truncated (UNUR_GEN* @var{generator}, int @var{left}, int @var{right}) +Change left and right border of the domain of the (truncated) distribution. +This is only possible if the inversion method is used. +Otherwise this call has no effect and an error code is returned. + +Notice that the given truncated domain must be a subset of the +domain of the given distribution. The generator always uses the +intersection of the domain of the distribution and the truncated +domain given by this call. + +It is not required to run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +after this call has been used. + +@emph{Important:} If the CDF is (almost) the same for @var{left} and +@var{right} and (almost) equal to @code{0} or @code{1}, then the truncated +domain is not chanced and the call returns an error code. + +@emph{Notice:} If the parameters of the distribution has been changed +it is recommended to set the truncated domain again, since the +former call might change the domain of the distribution but not +update the values for the boundaries of the truncated +distribution. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of dstd.h +@c ------------------------------------- +@c ------------------------------------- +@c methods.dh +@c + +@page +@node Methods_for_MATR +@section Methods for random matrices + +@menu +* MCORR:: Random CORRelation matrix +@end menu + + + +@subheading Overview of methods + +@include methods_matr.texi + + + +@c +@c end of methods.dh +@c ------------------------------------- +@c ------------------------------------- +@c mcorr.h +@c + +@page +@node MCORR +@subsection MCORR -- Random CORRelation matrix + +@table @i +@item Required: +Distribution object for random correlation matrix +@item Speed: +Set-up: fast, Sampling: depends on dimension +@item Reinit: +supported +@item Reference: +@ifhtml +@ref{bib:DLa86,, [DLa86: Sect.6.1; p.605]} +@end ifhtml +@ifnothtml +[DLa86: Sect.6.1; p.605] +@end ifnothtml +@ifhtml +@ref{bib:MOa84,, [MOa84]} +@end ifhtml +@ifnothtml +[MOa84] +@end ifnothtml + +@end table + + +MCORR generates a random correlation matrix +(Pearson's correlation). +Two methods are used: + +@enumerate +@item +When a random correlation matrix having given eigenvalues is +sought, the method of Marsaglia and Olkin [MOa84] is used. +In this case, the correlation matrix +@iftex +@math{R} +@end iftex +@ifhtml +@html +R +@end html +@end ifhtml +@ifinfo +@math{R} +@end ifinfo +is given as +@iftex +@math{R=PDP'} +@end iftex +@ifhtml +@html +R=PDP' +@end html +@end ifhtml +@ifinfo +@math{R=PDP'} +@end ifinfo +where +@iftex +@math{D} +@end iftex +@ifhtml +@html +D +@end html +@end ifhtml +@ifinfo +@math{D} +@end ifinfo +is a diagonal +matrix containing the eigenvalues and +@iftex +@math{P} +@end iftex +@ifhtml +@html +P +@end html +@end ifhtml +@ifinfo +@math{P} +@end ifinfo +is a random +orthonormal matrix. In higher dimensions, the rounding-errors +introduced in the previous matrix multiplications could lead +to a non-symmetric correlation matrix. Therefore the symmetric +correlation matrix is computed as +@iftex +@math{R=(PDP'+P'DP)/2} +@end iftex +@ifhtml +@html +R=(PDP'+P'DP)/2 +@end html +@end ifhtml +@ifinfo +@math{R=(PDP'+P'DP)/2} +@end ifinfo +. + +@item +A matrix +@iftex +@math{H} +@end iftex +@ifhtml +@html +H +@end html +@end ifhtml +@ifinfo +@math{H} +@end ifinfo +is generated where all rows are +independent random vectors of unit length uniformly on a sphere. +Then +@iftex +@math{HH'} +@end iftex +@ifhtml +@html +HH' +@end html +@end ifhtml +@ifinfo +@math{HH'} +@end ifinfo +is a correlation matrix (and vice versa if +@iftex +@math{HH'} +@end iftex +@ifhtml +@html +HH' +@end html +@end ifhtml +@ifinfo +@math{HH'} +@end ifinfo +is a correlation matrix then the rows of +@iftex +@math{H} +@end iftex +@ifhtml +@html +H +@end html +@end ifhtml +@ifinfo +@math{H} +@end ifinfo +are random vectors on a sphere). + +@end enumerate + +Notice that due to round-off errors the generated matrices might +not be positive definite in extremely rare cases +(especially when the given eigenvalues are amost 0). + +There are many other possibilites (distributions) of sampling +the random rows from a sphere. The chosen methods are simple but +does not result in a uniform distriubution of the random +correlation matrices. + +It only works with distribution objects of random correlation +matrices (@pxref{correlation,,Random Correlation Matrix}). + + +@subsubheading How To Use + + +Create a distibution object for random correlation matrices by a +@code{unur_distr_correlation} call +(@pxref{correlation,,Random Correlation Matrix}). + +When a correlation matrix with given eigenvalues should be +generated, these eigenvalues can be set by a +@ifhtml +@ref{funct:unur_mcorr_set_eigenvalues,@command{unur_mcorr_set_eigenvalues}} +@end ifhtml +@ifnothtml +@command{unur_mcorr_set_eigenvalues} +@end ifnothtml +call. + +Otherwise, a faster algorithm is used that generates +correlation matrices with random eigenstructure. + +Notice that due to round-off errors, +there is a (small) chance that the resulting matrix is +not positive definite for a Cholesky decomposition algorithm, +especially when the dimension of the distribution is high. + +It is possible to change the given eigenvalues using +@ifhtml +@ref{funct:unur_mcorr_chg_eigenvalues,@command{unur_mcorr_chg_eigenvalues}} +@end ifhtml +@ifnothtml +@command{unur_mcorr_chg_eigenvalues} +@end ifnothtml +and run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to +reinitialize the generator object. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_mcorr_new,unur_mcorr_new} +@item @ref{funct:unur_mcorr_set_eigenvalues,unur_mcorr_set_eigenvalues} +@item @ref{funct:unur_mcorr_chg_eigenvalues,unur_mcorr_chg_eigenvalues} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_mcorr_new} +@deftypefn Function {UNUR_PAR*} unur_mcorr_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_mcorr_new} +@deftypefn {} {UNUR_PAR*} unur_mcorr_new (const @var{UNUR_DISTR* distribution}) +Get default parameters for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_mcorr_set_eigenvalues} +@deftypefn Function {int} unur_mcorr_set_eigenvalues (UNUR_PAR* @var{par}, const @var{double* eigenvalues}) +Sets the (optional) eigenvalues of the correlation matrix. +If set, then the Marsaglia and Olkin algorithm will be used +to generate random correlation matrices with given eigenvalues. + +Important: the given eigenvalues of the correlation matrix must be +strictly positive and sum to the dimension of the matrix. +If non-positive eigenvalues are attempted, no eigenvalues are set +and an error code is returned. +In case, that their sum is different from the dimension, an implicit +scaling to give the correct sum is performed. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_mcorr_set_eigenvalues} +@deftypefn {} {int} unur_mcorr_set_eigenvalues (UNUR_PAR* @var{par}, const @var{double* eigenvalues}) +Sets the (optional) eigenvalues of the correlation matrix. +If set, then the Marsaglia and Olkin algorithm will be used +to generate random correlation matrices with given eigenvalues. + +Important: the given eigenvalues of the correlation matrix must be +strictly positive and sum to the dimension of the matrix. +If non-positive eigenvalues are attempted, no eigenvalues are set +and an error code is returned. +In case, that their sum is different from the dimension, an implicit +scaling to give the correct sum is performed. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_mcorr_chg_eigenvalues} +@deftypefn Function {int} unur_mcorr_chg_eigenvalues (UNUR_GEN* @var{gen}, const @var{double* eigenvalues}) +Change the eigenvalues of the correlation matrix. +One must run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator +object then. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_mcorr_chg_eigenvalues} +@deftypefn {} {int} unur_mcorr_chg_eigenvalues (UNUR_GEN* @var{gen}, const @var{double* eigenvalues}) +Change the eigenvalues of the correlation matrix. +One must run +@ifhtml +@ref{funct:unur_reinit,@command{unur_reinit}} +@end ifhtml +@ifnothtml +@command{unur_reinit} +@end ifnothtml +to reinitialize the generator +object then. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of mcorr.h +@c ------------------------------------- +@c ------------------------------------- +@c methods.dh +@c + +@page +@node Methods_for_UNID +@section Methods for uniform univariate distributions + +@menu +* UNIF:: wrapper for UNIForm random number generator +@end menu + + + + +@c +@c end of methods.dh +@c ------------------------------------- +@c ------------------------------------- +@c unif.h +@c + +@page +@node UNIF +@subsection UNIF -- wrapper for UNIForm random number generator + + +UNIF is a simple wrapper that makes it possible to use a uniform +random number generator as a UNU.RAN generator. There are no +parameters for this method. + + +@subsubheading How To Use + + +Create a generator object with @code{NULL} as argument. The created generator +object returns raw random numbers from the underlying uniform +random number generator. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_unif_new,unur_unif_new} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_unif_new} +@deftypefn Function {UNUR_PAR*} unur_unif_new (const @var{UNUR_DISTR* dummy}) +Get default parameters for generator. +UNIF does not need a distribution object. @var{dummy} is not used and +can (should) be set to @code{NULL}. It is used to keep the API consistent. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_unif_new} +@deftypefn {} {UNUR_PAR*} unur_unif_new (const @var{UNUR_DISTR* dummy}) +Get default parameters for generator. +UNIF does not need a distribution object. @var{dummy} is not used and +can (should) be set to @code{NULL}. It is used to keep the API consistent. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of unif.h +@c ------------------------------------- +@c ------------------------------------- +@c methods.dh +@c + +@page +@node Meta_Methods +@section Meta Methods for univariate distributions + +@menu +* MIXT:: MIXTure of distributions +@end menu + + + +@subheading Example + +@smallexample +@include ref_example_mixt.texi +@end smallexample + +@subheading Example (Inversion) + +@smallexample +@include ref_example_mixt_inv.texi +@end smallexample + + + +@c +@c end of methods.dh +@c ------------------------------------- +@c ------------------------------------- +@c mixt.h +@c + +@page +@node MIXT +@subsection MIXT -- MIXTure of distributions + + +MIXT allows to sample from a mixture of univariate +distributions. + +Let +@iftex +@math{f_1,\ldots,f_n} +@end iftex +@ifhtml +@html +f_1,...,f_n +@end html +@end ifhtml +@ifinfo +@math{f_1,...,f_n} +@end ifinfo +be PDFs of various distributions +called the components and +@iftex +@math{(p_1,\ldots,p_n)} +@end iftex +@ifhtml +@html +(p_1,...,p_n) +@end html +@end ifhtml +@ifinfo +@math{(p_1,...,p_n)} +@end ifinfo +be a +probability vector. Then +@iftex +@math{f(x) = p_1\cdot f_1(x) + \ldots + p_n\cdot f_n(x)} +@end iftex +@ifhtml +@html +f(x) = p_1 * f_1(x) + ...+ p_n * f_n(x) +@end html +@end ifhtml +@ifinfo +@math{f(x) = p_1 * f_1(x) + ...+ p_n * f_n(x)} +@end ifinfo +is the PDF of the so called mixture of these distributions. + +Method MIXT takes generator objects for the components and +a probability vector and creates a generator object for +this mixture. + +The sampling part works as follows: + +@enumerate +@item +Generate an index @i{J} as the realisation of a discrete +random variate with the given probability vector. +This is done by means of method DGT +(@pxref{DGT,Guide Table method}). +@item +Generate a random variate @i{X} with PDF +@iftex +@math{f_J.} +@end iftex +@ifhtml +@html +f_J. +@end html +@end ifhtml +@ifinfo +@math{f_J.} +@end ifinfo +@end enumerate + +When the (interior of the) domains of the the components are +disjoint then it is possible to sample from the mixture by +inversion, provided that the following conditions are met: + +@itemize @minus +@item +The generator objects must use an inversion method for each +component. +@item +The domains of the PDFs +@iftex +@math{f_i} +@end iftex +@ifhtml +@html +f_i +@end html +@end ifhtml +@ifinfo +@math{f_i} +@end ifinfo +must not overlap. +@item +The components must be ordered with respect to their domains. +@end itemize + + +@subsubheading How To Use + + +Create generator objects for the components of the mixture and +store the corresponding pointers in an array. +Store all probabilities an a double array of the same size. +Create the parameter object for the generator of the mixture +distribution by means of +@ifhtml +@ref{funct:unur_mixt_new,@command{unur_mixt_new}.} +@end ifhtml +@ifnothtml +@command{unur_mixt_new}. +@end ifnothtml +The components of the mixture can be any continuous or discrete +univariate distributions. This also includes generators for +empirical distributions and mixtures of distributions. +In particular, mixtures can also be defined recursively. + +@emph{Remark:} +The components of the mixture can be continuous or discrete +distributions. The resulting mixture, however, is always a +continuous distribution and thus +@ifhtml +@ref{funct:unur_sample_cont,@command{unur_sample_cont}} +@end ifhtml +@ifnothtml +@command{unur_sample_cont} +@end ifnothtml +must be used! + +The inversion method can be switched on by means of +@ifhtml +@ref{funct:unur_mixt_set_useinversion,@command{unur_mixt_set_useinversion}} +@end ifhtml +@ifnothtml +@command{unur_mixt_set_useinversion} +@end ifnothtml +call. +However, the conditions for this method must then be met. +Otherwise, initialization of the mixture object fails. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_mixt_new,unur_mixt_new} +@item @ref{funct:unur_mixt_set_useinversion,unur_mixt_set_useinversion} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_mixt_new} +@deftypefn Function {UNUR_PAR*} unur_mixt_new (int @var{n}, const @var{double* prob}, UNUR_GEN** @var{comp}) +Get default parameters for the generator for a mixture of the +distributions given in the array @var{comp} (components) of length +@var{n}. The probabilities are given by @var{prob}. + +The generators in @var{comp} must be objects for (continuous or +discrete) univariate distributions +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_mixt_new} +@deftypefn {} {UNUR_PAR*} unur_mixt_new (int @var{n}, const @var{double* prob}, UNUR_GEN** @var{comp}) +Get default parameters for the generator for a mixture of the +distributions given in the array @var{comp} (components) of length +@var{n}. The probabilities are given by @var{prob}. + +The generators in @var{comp} must be objects for (continuous or +discrete) univariate distributions +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_mixt_set_useinversion} +@deftypefn Function {int} unur_mixt_set_useinversion (UNUR_PAR* @var{parameters}, int @var{useinv}) +If @var{useinv} is @code{TRUE}, then the inversion method is used for +sampling from the mixture distribution. + +However, the following conditions must be satisfied: + +@itemize @minus +@item +The generator objects must use an inversion method for each +component. +@item +The domains of the components must not overlap. +@item +The components must be ordered with respect to their domains. +@end itemize + +If one of these conditions is violated, then initialization of the +mixture object fails. + +Default is @code{FALSE}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_mixt_set_useinversion} +@deftypefn {} {int} unur_mixt_set_useinversion (UNUR_PAR* @var{parameters}, int @var{useinv}) +If @var{useinv} is @code{TRUE}, then the inversion method is used for +sampling from the mixture distribution. + +However, the following conditions must be satisfied: + +@itemize @minus +@item +The generator objects must use an inversion method for each +component. +@item +The domains of the components must not overlap. +@item +The components must be ordered with respect to their domains. +@end itemize + +If one of these conditions is violated, then initialization of the +mixture object fails. + +Default is @code{FALSE}. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of mixt.h +@c ------------------------------------- +@c ------------------------------------- +@c urng.h +@c + +@node URNG +@chapter Using uniform random number generators + +@menu +* URNG-FVOID:: Simple interface for uniform random number generators +* URNG-GSL:: Interface to GSL uniform random number generators +* URNG-GSLQRNG:: Interface to GSL generators for quasi-random points +* URNG-PRNG:: Interface to Otmar Lendl's pseudo-random number generators +* URNG-RNGSTREAM:: Interface to L'Ecuyer's RNGSTREAM random number generators +* URNG-RANDOMSHIFT:: Combine point set generator with random shifts +@end menu + + +UNU.RAN is designed to work with many sources of (pseudo-) random +numbers or low discrepancy numbers (so called quasi-random +numbers) for almost all tasks in discrete event simulation, +(quasi-) Monte Carlo integration or any other stochastic +methods. Hence UNU.RAN uses pointers to access uniform (pseudo-) +random number generators (URNG). + +Each UNU.RAN (non-uniform random variate) generator object has a +pointer to a URNG object. Thus each UNU.RAN generator object may +have its own (independent) URNG or several generator objects can +share the same URNG. + +If no URNG is provided for a parameter or generator object a default +generator is used which is the same for all generators. This URNG is +defined in @file{unuran_config.h} at compile time and can be +changed at runtime. + +UNU.RAN uses a unified interface for all sources of random numbers. +Unfortunately, the API for random number generators, like the +@file{GSL} (GNU Scientific Library), Otmar Lendl's @file{prng} +(Pseudo random number generators), or a single function +implemented by the user herself, are quite different. +Hence an object of type @code{UNUR_URNG} is introduced to store +the URNG. Thus it is possible to handle different sources of +such URNGs with the unified API. It is inspired from similar to +Pierre L'Ecuyers @file{RngStreams} library: + +@itemize @minus +@item seed the random number generator; +@item get a uniform random number; +@item reset the URNG; +@item skip to the begining next substream; +@item sample antithetic numbers; +@item delete the URNG object. +@end itemize + +The routine to create a URNG depends on the chosen random number +generator (i.e. library). Nevertheless, there exist wrapper +functions to simplify this task. + +Currently the following sources of uniform random numbers are +directly supported (i.e., there exist wrapper functions). +Of course other random number generation libraries can be used. + +@enumerate + +@item +@code{FVOID} + +URNGs of type @code{double uniform(void *state)}. +The argument @var{state} can be simply ignored in the +implementation of @code{uniform} when a global state variable is +used. +UNU.RAN contains some build-in URNGs of this type in directory +@file{src/uniform/}. + +@item +@code{PRNG} + +URNGs from Otmar Lendl's @code{prng} library. It provides a very +flexible way to sample form arbitrary URNGs by means of an object +oriented programing paradigma. Similarly to the UNU.RAN library +independent generator objects can be build and used. + +This library has been developed by the pLab group at the university +of Salzburg (Austria, EU) and implemented by Otmar Lendl. +It is available from +@uref{http://statmath.wu.ac.at/prng/} +or from the pLab site at +@uref{http://random.mat.sbg.ac.at/}. + +This interface must be compiled into UNU.RAN using the +configure flag @code{--with-urng-prng}. + +@item +@code{RNGSTREAM} + +Pierre L'Ecuyer's @code{RngStream} library for multiple +independent streams of pseudo-random numbers. +A GNU-style package is available from +@uref{http://statmath.wu.ac.at/software/RngStreams/}. + +This interface must be compiled into UNU.RAN using the +configure flag @code{--with-urng-rngstream}. + +@item +@code{GSL} + +URNG from the GNU Scientific Library (GSL). +It is available from +@uref{http://www.gnu.org/software/gsl/}. + +This interface must be compiled into UNU.RAN using the +configure flag @code{--with-urng-gsl}. + +@end enumerate + + +@subsubheading How To Use + + +Each UNU.RAN generator object has a pointer to a uniform +(pseudo-) random number generator (URNG). It can be set via the +@ifhtml +@ref{funct:unur_set_urng,@command{unur_set_urng}} +@end ifhtml +@ifnothtml +@command{unur_set_urng} +@end ifnothtml +call. It is also possible to read this pointer +via +@ifhtml +@ref{funct:unur_get_urng,@command{unur_get_urng}} +@end ifhtml +@ifnothtml +@command{unur_get_urng} +@end ifnothtml +or change the URNG for an existing generator +object by means of +@ifhtml +@ref{funct:unur_chg_urng,@command{unur_chg_urng}.} +@end ifhtml +@ifnothtml +@command{unur_chg_urng}. +@end ifnothtml +It is important to note that these calls only copy the pointer +to the URNG object into the generator object. + +If no URNG is provided for a parameter or generator object a default +URNG is used which is the same for all generators. This URNG is +defined in @file{unuran_config.h} at compile time. A pointer to +this default URNG can be obtained via +@ifhtml +@ref{funct:unur_get_default_urng,@command{unur_get_default_urng}.} +@end ifhtml +@ifnothtml +@command{unur_get_default_urng}. +@end ifnothtml +Nevertheless, it is also possible to change this default URNG by +another one at runtime by means of the +@ifhtml +@ref{funct:unur_set_default_urng,@command{unur_set_default_urng}} +@end ifhtml +@ifnothtml +@command{unur_set_default_urng} +@end ifnothtml +call. However, this only takes effect for new parameter objects. + +Some generating methods provide the possibility of correlation +induction. For this feature a second auxiliary URNG is required. +It can be set and changed by +@ifhtml +@ref{funct:unur_set_urng_aux,@command{unur_set_urng_aux}} +@end ifhtml +@ifnothtml +@command{unur_set_urng_aux} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_chg_urng_aux,@command{unur_chg_urng_aux}} +@end ifhtml +@ifnothtml +@command{unur_chg_urng_aux} +@end ifnothtml +calls, respectively. Since the auxiliary +URNG is by default the same as the main URNG, the +auxiliary URNG must be set after any +@ifhtml +@ref{funct:unur_set_urng,@command{unur_set_urng}} +@end ifhtml +@ifnothtml +@command{unur_set_urng} +@end ifnothtml +or +@ifhtml +@ref{funct:unur_chg_urng,@command{unur_chg_urng}} +@end ifhtml +@ifnothtml +@command{unur_chg_urng} +@end ifnothtml +call! Since in special cases mixing of two URNG +might cause problems, we supply a default auxiliary generator +that can be used by a +@ifhtml +@ref{funct:unur_use_urng_aux_default,@command{unur_use_urng_aux_default}} +@end ifhtml +@ifnothtml +@command{unur_use_urng_aux_default} +@end ifnothtml +call (after +the main URNG has been set). This default auxiliary generator +can be changed with analogous calls as the (main) default +uniform generator. + +Uniform random number generators form different sources have +different programming interfaces. Thus UNU.RAN stores all +information about a particular uniform random number generator +in a structure of type @code{UNUR_URNG}. Before a URNG can be +used with UNU.RAN an appropriate object has to be created ba a +@ifhtml +@ref{funct:unur_urng_new,@command{unur_urng_new}} +@end ifhtml +@ifnothtml +@command{unur_urng_new} +@end ifnothtml +call. +This call takes two arguments: the pointer to the sampling +routine of the generator and a pointer to a possible argument +that stores the state of the generator. The function must be of +type @code{double (*sampleunif)(void *params)}, but functions +without any argument also work. +Additionally one can set pointers to functions for reseting or +jumping the streams generated by the URNG by the corresponding +@code{set} calls. + +UNU.RAN provides a unified API to all sources of random numbers. +Notice, however, that not all functions work for all random +number generators (as the respective library has not implemented +the corresponding feature). + +There are wrapper functions for some libraries of uniform random +number generators to simplify the task of creating a UNU.RAN +object for URNGs. +These functions must be compiled into UNU.RAN using the +corresponding configure flags (see description of the respective +interface below). + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_get_default_urng,unur_get_default_urng} +@item @ref{funct:unur_set_default_urng,unur_set_default_urng} +@item @ref{funct:unur_set_default_urng_aux,unur_set_default_urng_aux} +@item @ref{funct:unur_get_default_urng_aux,unur_get_default_urng_aux} +@item @ref{funct:unur_set_urng,unur_set_urng} +@item @ref{funct:unur_chg_urng,unur_chg_urng} +@item @ref{funct:unur_get_urng,unur_get_urng} +@item @ref{funct:unur_set_urng_aux,unur_set_urng_aux} +@item @ref{funct:unur_use_urng_aux_default,unur_use_urng_aux_default} +@item @ref{funct:unur_chgto_urng_aux_default,unur_chgto_urng_aux_default} +@item @ref{funct:unur_chg_urng_aux,unur_chg_urng_aux} +@item @ref{funct:unur_get_urng_aux,unur_get_urng_aux} +@item @ref{funct:unur_urng_sample,unur_urng_sample} +@item @ref{funct:unur_sample_urng,unur_sample_urng} +@item @ref{funct:unur_urng_sample_array,unur_urng_sample_array} +@item @ref{funct:unur_urng_reset,unur_urng_reset} +@item @ref{funct:unur_urng_sync,unur_urng_sync} +@item @ref{funct:unur_urng_seed,unur_urng_seed} +@item @ref{funct:unur_urng_anti,unur_urng_anti} +@item @ref{funct:unur_urng_nextsub,unur_urng_nextsub} +@item @ref{funct:unur_urng_resetsub,unur_urng_resetsub} +@item @ref{funct:unur_gen_sync,unur_gen_sync} +@item @ref{funct:unur_gen_seed,unur_gen_seed} +@item @ref{funct:unur_gen_anti,unur_gen_anti} +@item @ref{funct:unur_gen_reset,unur_gen_reset} +@item @ref{funct:unur_gen_nextsub,unur_gen_nextsub} +@item @ref{funct:unur_gen_resetsub,unur_gen_resetsub} +@item @ref{funct:unur_urng_new,unur_urng_new} +@item @ref{funct:unur_urng_free,unur_urng_free} +@item @ref{funct:unur_urng_set_sample_array,unur_urng_set_sample_array} +@item @ref{funct:unur_urng_set_sync,unur_urng_set_sync} +@item @ref{funct:unur_urng_set_seed,unur_urng_set_seed} +@item @ref{funct:unur_urng_set_anti,unur_urng_set_anti} +@item @ref{funct:unur_urng_set_reset,unur_urng_set_reset} +@item @ref{funct:unur_urng_set_nextsub,unur_urng_set_nextsub} +@item @ref{funct:unur_urng_set_resetsub,unur_urng_set_resetsub} +@item @ref{funct:unur_urng_set_delete,unur_urng_set_delete} +@end itemize +@end ifhtml + + +@subheading Set and get default uniform RNGs + +@ifinfo +@anchor{funct:unur_get_default_urng} +@deftypefn Function {UNUR_URNG*} unur_get_default_urng (void) +Get the pointer to the default URNG. The default URNG is used by all +generators where no URNG was set explicitly by a +@ifhtml +@ref{funct:unur_set_urng,@command{unur_set_urng}} +@end ifhtml +@ifnothtml +@command{unur_set_urng} +@end ifnothtml +call. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_get_default_urng} +@deftypefn {} {UNUR_URNG*} unur_get_default_urng (void) +Get the pointer to the default URNG. The default URNG is used by all +generators where no URNG was set explicitly by a +@ifhtml +@ref{funct:unur_set_urng,@command{unur_set_urng}} +@end ifhtml +@ifnothtml +@command{unur_set_urng} +@end ifnothtml +call. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_set_default_urng} +@deftypefn Function {UNUR_URNG*} unur_set_default_urng (UNUR_URNG* @var{urng_new}) +Change the default URNG that is used for new parameter objects. +It returns the pointer to the old default URNG that has been used. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_set_default_urng} +@deftypefn {} {UNUR_URNG*} unur_set_default_urng (UNUR_URNG* @var{urng_new}) +Change the default URNG that is used for new parameter objects. +It returns the pointer to the old default URNG that has been used. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_set_default_urng_aux} +@anchor{funct:unur_get_default_urng_aux} +@deftypefn Function {UNUR_URNG*} unur_set_default_urng_aux (UNUR_URNG* @var{urng_new}) +@deftypefnx Function {UNUR_URNG*} unur_get_default_urng_aux (void) +Analogous calls for default auxiliary generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_set_default_urng_aux} +@anchor{funct:unur_get_default_urng_aux} +@deftypefn {} {UNUR_URNG*} unur_set_default_urng_aux (UNUR_URNG* @var{urng_new}) +@deftypefnx {} {UNUR_URNG*} unur_get_default_urng_aux (void) +Analogous calls for default auxiliary generator. +@end deftypefn +@end ifnotinfo + +@subheading Set, change and get uniform RNGs in generator objects + +@ifinfo +@anchor{funct:unur_set_urng} +@deftypefn Function {int} unur_set_urng (UNUR_PAR* @var{parameters}, UNUR_URNG* @var{urng}) +Use the URNG @code{urng} for the new generator. This overrides the +default URNG. It also sets the auxiliary URNG to @code{urng}. + +@emph{Important}: For multivariate distributions that use +marginal distributions this call does not work properly. +It is then better first to create the generator object (by +a +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +call) and then change the URNG by means of +@ifhtml +@ref{funct:unur_chg_urng,@command{unur_chg_urng}.} +@end ifhtml +@ifnothtml +@command{unur_chg_urng}. +@end ifnothtml +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_set_urng} +@deftypefn {} {int} unur_set_urng (UNUR_PAR* @var{parameters}, UNUR_URNG* @var{urng}) +Use the URNG @code{urng} for the new generator. This overrides the +default URNG. It also sets the auxiliary URNG to @code{urng}. + +@emph{Important}: For multivariate distributions that use +marginal distributions this call does not work properly. +It is then better first to create the generator object (by +a +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +call) and then change the URNG by means of +@ifhtml +@ref{funct:unur_chg_urng,@command{unur_chg_urng}.} +@end ifhtml +@ifnothtml +@command{unur_chg_urng}. +@end ifnothtml +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_chg_urng} +@deftypefn Function {UNUR_URNG*} unur_chg_urng (UNUR_GEN* @var{generator}, UNUR_URNG* @var{urng}) +Change the URNG for the given generator. It returns the pointer to +the old URNG that has been used by the generator. +It also changes the auxiliary URNG to @code{urng} and thus it +overrides the last +@ifhtml +@ref{funct:unur_chg_urng_aux,@command{unur_chg_urng_aux}} +@end ifhtml +@ifnothtml +@command{unur_chg_urng_aux} +@end ifnothtml +call. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_chg_urng} +@deftypefn {} {UNUR_URNG*} unur_chg_urng (UNUR_GEN* @var{generator}, UNUR_URNG* @var{urng}) +Change the URNG for the given generator. It returns the pointer to +the old URNG that has been used by the generator. +It also changes the auxiliary URNG to @code{urng} and thus it +overrides the last +@ifhtml +@ref{funct:unur_chg_urng_aux,@command{unur_chg_urng_aux}} +@end ifhtml +@ifnothtml +@command{unur_chg_urng_aux} +@end ifnothtml +call. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_get_urng} +@deftypefn Function {UNUR_URNG*} unur_get_urng (UNUR_GEN* @var{generator}) +Get the pointer to the URNG that is used by the @var{generator}. +This is usefull if two generators should share the same URNG. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_get_urng} +@deftypefn {} {UNUR_URNG*} unur_get_urng (UNUR_GEN* @var{generator}) +Get the pointer to the URNG that is used by the @var{generator}. +This is usefull if two generators should share the same URNG. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_set_urng_aux} +@deftypefn Function {int} unur_set_urng_aux (UNUR_PAR* @var{parameters}, UNUR_URNG* @var{urng_aux}) +Use the auxiliary URNG @code{urng_aux} for the new generator. +(Default is the default URNG or the URNG from the last +@ifhtml +@ref{funct:unur_set_urng,@command{unur_set_urng}} +@end ifhtml +@ifnothtml +@command{unur_set_urng} +@end ifnothtml +call. Thus if the auxiliary generator should be +different to the main URNG, +@ifhtml +@ref{funct:unur_set_urng_aux,@command{unur_set_urng_aux}} +@end ifhtml +@ifnothtml +@command{unur_set_urng_aux} +@end ifnothtml +must be called after +@ifhtml +@ref{funct:unur_set_urng,@command{unur_set_urng}.} +@end ifhtml +@ifnothtml +@command{unur_set_urng}. +@end ifnothtml +The auxiliary URNG is used as second stream of uniform random +number for correlation induction. +It is not possible to set an auxiliary URNG for a method that does +not need one. In this case an error code is returned. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_set_urng_aux} +@deftypefn {} {int} unur_set_urng_aux (UNUR_PAR* @var{parameters}, UNUR_URNG* @var{urng_aux}) +Use the auxiliary URNG @code{urng_aux} for the new generator. +(Default is the default URNG or the URNG from the last +@ifhtml +@ref{funct:unur_set_urng,@command{unur_set_urng}} +@end ifhtml +@ifnothtml +@command{unur_set_urng} +@end ifnothtml +call. Thus if the auxiliary generator should be +different to the main URNG, +@ifhtml +@ref{funct:unur_set_urng_aux,@command{unur_set_urng_aux}} +@end ifhtml +@ifnothtml +@command{unur_set_urng_aux} +@end ifnothtml +must be called after +@ifhtml +@ref{funct:unur_set_urng,@command{unur_set_urng}.} +@end ifhtml +@ifnothtml +@command{unur_set_urng}. +@end ifnothtml +The auxiliary URNG is used as second stream of uniform random +number for correlation induction. +It is not possible to set an auxiliary URNG for a method that does +not need one. In this case an error code is returned. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_use_urng_aux_default} +@deftypefn Function {int} unur_use_urng_aux_default (UNUR_PAR* @var{parameters}) +Use the default auxiliary URNG. +(It must be set after +@ifhtml +@ref{funct:unur_get_urng,@command{unur_get_urng}.} +@end ifhtml +@ifnothtml +@command{unur_get_urng}. +@end ifnothtml +) +It is not possible to set an auxiliary URNG for a method that does +not use one (i.e. the call returns an error code). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_use_urng_aux_default} +@deftypefn {} {int} unur_use_urng_aux_default (UNUR_PAR* @var{parameters}) +Use the default auxiliary URNG. +(It must be set after +@ifhtml +@ref{funct:unur_get_urng,@command{unur_get_urng}.} +@end ifhtml +@ifnothtml +@command{unur_get_urng}. +@end ifnothtml +) +It is not possible to set an auxiliary URNG for a method that does +not use one (i.e. the call returns an error code). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_chgto_urng_aux_default} +@deftypefn Function {int} unur_chgto_urng_aux_default (UNUR_GEN* @var{generator}) +Switch to default auxiliary URNG. +(It must be set after +@ifhtml +@ref{funct:unur_get_urng,@command{unur_get_urng}.} +@end ifhtml +@ifnothtml +@command{unur_get_urng}. +@end ifnothtml +) +It is not possible to set an auxiliary URNG for a method that does +not use one (i.e. the call returns an error code). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_chgto_urng_aux_default} +@deftypefn {} {int} unur_chgto_urng_aux_default (UNUR_GEN* @var{generator}) +Switch to default auxiliary URNG. +(It must be set after +@ifhtml +@ref{funct:unur_get_urng,@command{unur_get_urng}.} +@end ifhtml +@ifnothtml +@command{unur_get_urng}. +@end ifnothtml +) +It is not possible to set an auxiliary URNG for a method that does +not use one (i.e. the call returns an error code). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_chg_urng_aux} +@deftypefn Function {UNUR_URNG*} unur_chg_urng_aux (UNUR_GEN* @var{generator}, UNUR_URNG* @var{urng_aux}) +Change the auxiliary URNG for the given @var{generator}. It returns +the pointer to the old auxiliary URNG that has been used by the +generator. It has to be called after each +@ifhtml +@ref{funct:unur_chg_urng,@command{unur_chg_urng}} +@end ifhtml +@ifnothtml +@command{unur_chg_urng} +@end ifnothtml +when the +auxiliary URNG should be different from the main URNG. +It is not possible to change the auxiliary URNG for a method that +does not use one (i.e. the call @code{NULL}). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_chg_urng_aux} +@deftypefn {} {UNUR_URNG*} unur_chg_urng_aux (UNUR_GEN* @var{generator}, UNUR_URNG* @var{urng_aux}) +Change the auxiliary URNG for the given @var{generator}. It returns +the pointer to the old auxiliary URNG that has been used by the +generator. It has to be called after each +@ifhtml +@ref{funct:unur_chg_urng,@command{unur_chg_urng}} +@end ifhtml +@ifnothtml +@command{unur_chg_urng} +@end ifnothtml +when the +auxiliary URNG should be different from the main URNG. +It is not possible to change the auxiliary URNG for a method that +does not use one (i.e. the call @code{NULL}). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_get_urng_aux} +@deftypefn Function {UNUR_URNG*} unur_get_urng_aux (UNUR_GEN* @var{generator}) +Get the pointer to the auxiliary URNG that is used by the +@var{generator}. This is usefull if two generators should share the same +URNG. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_get_urng_aux} +@deftypefn {} {UNUR_URNG*} unur_get_urng_aux (UNUR_GEN* @var{generator}) +Get the pointer to the auxiliary URNG that is used by the +@var{generator}. This is usefull if two generators should share the same +URNG. +@end deftypefn +@end ifnotinfo + +@subheading Handle uniform RNGs + +@emph{Notice:} Some of the below function calls do not work for +every source of random numbers since not every library has +implemented these features. + +@ifinfo +@anchor{funct:unur_urng_sample} +@deftypefn Function {double} unur_urng_sample (UNUR_URNG* @var{urng}) +Get a uniform random number from @var{urng}. +If the @code{NULL} pointer is given, the default uniform generator is +used. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_sample} +@deftypefn {} {double} unur_urng_sample (UNUR_URNG* @var{urng}) +Get a uniform random number from @var{urng}. +If the @code{NULL} pointer is given, the default uniform generator is +used. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_sample_urng} +@deftypefn Function {double} unur_sample_urng (UNUR_GEN* @var{gen}) +Get a uniform random number from the underlying uniform +random number generator of generator @var{gen}. +If the @code{NULL} pointer is given, the default uniform generator is +used. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_sample_urng} +@deftypefn {} {double} unur_sample_urng (UNUR_GEN* @var{gen}) +Get a uniform random number from the underlying uniform +random number generator of generator @var{gen}. +If the @code{NULL} pointer is given, the default uniform generator is +used. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_sample_array} +@deftypefn Function {int} unur_urng_sample_array (UNUR_URNG* @var{urng}, double* @var{X}, int @var{dim}) +Set array @var{X} of length @var{dim} with uniform random numbers +sampled from generator @var{urng}. If @var{urng} is the @code{NULL} +pointer, the default uniform generator is used. + +@emph{Important:} +If @var{urng} is based on a point set generator (this is the case +for generators of low discrepance point sets as used in quasi-Monte +Carlo methods) it has a ``natural dimension'' @i{s}. +In this case either only the first @i{s} entries of @var{X} are +filled (if @i{s} < @var{dim}), or the first @var{dim} coordinates +of the generated point are filled. + +The called returns the actual number of entries filled. In case of +an error @code{0} is returned. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_sample_array} +@deftypefn {} {int} unur_urng_sample_array (UNUR_URNG* @var{urng}, double* @var{X}, int @var{dim}) +Set array @var{X} of length @var{dim} with uniform random numbers +sampled from generator @var{urng}. If @var{urng} is the @code{NULL} +pointer, the default uniform generator is used. + +@emph{Important:} +If @var{urng} is based on a point set generator (this is the case +for generators of low discrepance point sets as used in quasi-Monte +Carlo methods) it has a ``natural dimension'' @i{s}. +In this case either only the first @i{s} entries of @var{X} are +filled (if @i{s} < @var{dim}), or the first @var{dim} coordinates +of the generated point are filled. + +The called returns the actual number of entries filled. In case of +an error @code{0} is returned. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_reset} +@deftypefn Function {int} unur_urng_reset (UNUR_URNG* @var{urng}) +Reset @var{urng} object. +The routine tries two ways to reset the generator (in this order): + +@enumerate +@item +It uses the reset function given by an +@ifhtml +@ref{funct:unur_urng_set_reset,@command{unur_urng_set_reset}} +@end ifhtml +@ifnothtml +@command{unur_urng_set_reset} +@end ifnothtml +call. + +@item +It uses the seed given by the last +@ifhtml +@ref{funct:unur_urng_seed,@command{unur_urng_seed}} +@end ifhtml +@ifnothtml +@command{unur_urng_seed} +@end ifnothtml +call (which +requires a seeding function given by a +@ifhtml +@ref{funct:unur_urng_set_seed,@command{unur_urng_set_seed}} +@end ifhtml +@ifnothtml +@command{unur_urng_set_seed} +@end ifnothtml +call). +@end enumerate + +If neither of the two methods work resetting of the generator is +not possible and an error code is returned. + +If the @code{NULL} pointer is given, the default uniform generator is +reset. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_reset} +@deftypefn {} {int} unur_urng_reset (UNUR_URNG* @var{urng}) +Reset @var{urng} object. +The routine tries two ways to reset the generator (in this order): + +@enumerate +@item +It uses the reset function given by an +@ifhtml +@ref{funct:unur_urng_set_reset,@command{unur_urng_set_reset}} +@end ifhtml +@ifnothtml +@command{unur_urng_set_reset} +@end ifnothtml +call. + +@item +It uses the seed given by the last +@ifhtml +@ref{funct:unur_urng_seed,@command{unur_urng_seed}} +@end ifhtml +@ifnothtml +@command{unur_urng_seed} +@end ifnothtml +call (which +requires a seeding function given by a +@ifhtml +@ref{funct:unur_urng_set_seed,@command{unur_urng_set_seed}} +@end ifhtml +@ifnothtml +@command{unur_urng_set_seed} +@end ifnothtml +call). +@end enumerate + +If neither of the two methods work resetting of the generator is +not possible and an error code is returned. + +If the @code{NULL} pointer is given, the default uniform generator is +reset. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_sync} +@deftypefn Function {int} unur_urng_sync (UNUR_URNG* @var{urng}) +Jump into defined state ("sync") of the generator. This is useful +when point generators are used where the coordinates are +sampled via +@ifhtml +@ref{funct:unur_urng_sample,@command{unur_urng_sample}.} +@end ifhtml +@ifnothtml +@command{unur_urng_sample}. +@end ifnothtml +Then this call can be used to +jump to the first coordinate of the next generated point. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_sync} +@deftypefn {} {int} unur_urng_sync (UNUR_URNG* @var{urng}) +Jump into defined state ("sync") of the generator. This is useful +when point generators are used where the coordinates are +sampled via +@ifhtml +@ref{funct:unur_urng_sample,@command{unur_urng_sample}.} +@end ifhtml +@ifnothtml +@command{unur_urng_sample}. +@end ifnothtml +Then this call can be used to +jump to the first coordinate of the next generated point. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_seed} +@deftypefn Function {int} unur_urng_seed (UNUR_URNG* @var{urng}, unsigned @var{long seed}) +Set @var{seed} for generator @var{urng}. +It returns an error code if this is not possible for the given +URNG. If the @code{NULL} pointer is given, the default uniform generator is +seeded (if possible). + +@emph{Notice}: Seeding should be done only once for a particular +generator (except for resetting it to the initial state). +Expertise is required when multiple seeds are used to get independent +streams. Thus we recommend appropriate libraries for this task, +e.g. Pierre L'Ecuyer's @file{RngStreams} package. For this library +only a package seed can be set and thus the +@ifhtml +@ref{funct:unur_urng_seed,@command{unur_urng_seed}} +@end ifhtml +@ifnothtml +@command{unur_urng_seed} +@end ifnothtml +call +will not have any effect to generators of this type. Use +@ifhtml +@ref{funct:unur_urng_reset,@command{unur_urng_reset}} +@end ifhtml +@ifnothtml +@command{unur_urng_reset} +@end ifnothtml +or +@ifhtml +@ref{funct:unur_urng_rngstream_new,@command{unur_urng_rngstream_new}} +@end ifhtml +@ifnothtml +@command{unur_urng_rngstream_new} +@end ifnothtml +instead, depending +whether one wants to reset the stream or get a new stream that is +independent from the previous ones. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_seed} +@deftypefn {} {int} unur_urng_seed (UNUR_URNG* @var{urng}, unsigned @var{long seed}) +Set @var{seed} for generator @var{urng}. +It returns an error code if this is not possible for the given +URNG. If the @code{NULL} pointer is given, the default uniform generator is +seeded (if possible). + +@emph{Notice}: Seeding should be done only once for a particular +generator (except for resetting it to the initial state). +Expertise is required when multiple seeds are used to get independent +streams. Thus we recommend appropriate libraries for this task, +e.g. Pierre L'Ecuyer's @file{RngStreams} package. For this library +only a package seed can be set and thus the +@ifhtml +@ref{funct:unur_urng_seed,@command{unur_urng_seed}} +@end ifhtml +@ifnothtml +@command{unur_urng_seed} +@end ifnothtml +call +will not have any effect to generators of this type. Use +@ifhtml +@ref{funct:unur_urng_reset,@command{unur_urng_reset}} +@end ifhtml +@ifnothtml +@command{unur_urng_reset} +@end ifnothtml +or +@ifhtml +@ref{funct:unur_urng_rngstream_new,@command{unur_urng_rngstream_new}} +@end ifhtml +@ifnothtml +@command{unur_urng_rngstream_new} +@end ifnothtml +instead, depending +whether one wants to reset the stream or get a new stream that is +independent from the previous ones. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_anti} +@deftypefn Function {int} unur_urng_anti (UNUR_URNG* @var{urng}, int @var{anti}) +Switch to antithetic random numbers in @var{urng}. +It returns an error code if this is not possible for the given +URNG. + +If the @code{NULL} pointer is given, the antithetic flag of the default +uniform generator is switched (if possible). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_anti} +@deftypefn {} {int} unur_urng_anti (UNUR_URNG* @var{urng}, int @var{anti}) +Switch to antithetic random numbers in @var{urng}. +It returns an error code if this is not possible for the given +URNG. + +If the @code{NULL} pointer is given, the antithetic flag of the default +uniform generator is switched (if possible). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_nextsub} +@deftypefn Function {int} unur_urng_nextsub (UNUR_URNG* @var{urng}) +Jump to start of the next substream of @var{urng}. +It returns an error code if this is not possible for the given +URNG. + +If the @code{NULL} pointer is given, the default uniform generator is set +to the start of the next substream (if possible). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_nextsub} +@deftypefn {} {int} unur_urng_nextsub (UNUR_URNG* @var{urng}) +Jump to start of the next substream of @var{urng}. +It returns an error code if this is not possible for the given +URNG. + +If the @code{NULL} pointer is given, the default uniform generator is set +to the start of the next substream (if possible). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_resetsub} +@deftypefn Function {int} unur_urng_resetsub (UNUR_URNG* @var{urng}) +Jump to start of the current substream of @var{urng}. +It returns an error code if this is not possible for the given +URNG. + +If the @code{NULL} pointer is given, the default uniform generator is set +to the start of the current substream (if possible). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_resetsub} +@deftypefn {} {int} unur_urng_resetsub (UNUR_URNG* @var{urng}) +Jump to start of the current substream of @var{urng}. +It returns an error code if this is not possible for the given +URNG. + +If the @code{NULL} pointer is given, the default uniform generator is set +to the start of the current substream (if possible). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_gen_sync} +@anchor{funct:unur_gen_seed} +@anchor{funct:unur_gen_anti} +@anchor{funct:unur_gen_reset} +@anchor{funct:unur_gen_nextsub} +@anchor{funct:unur_gen_resetsub} +@deftypefn Function {int} unur_gen_sync (UNUR_GEN* @var{generator}) +@deftypefnx Function {int} unur_gen_seed (UNUR_GEN* @var{generator}, unsigned @var{long seed}) +@deftypefnx Function {int} unur_gen_anti (UNUR_GEN* @var{generator}, int @var{anti}) +@deftypefnx Function {int} unur_gen_reset (UNUR_GEN* @var{generator}) +@deftypefnx Function {int} unur_gen_nextsub (UNUR_GEN* @var{generator}) +@deftypefnx Function {int} unur_gen_resetsub (UNUR_GEN* @var{generator}) +Analogous to +@ifhtml +@ref{funct:unur_urng_sync,@command{unur_urng_sync},} +@end ifhtml +@ifnothtml +@command{unur_urng_sync}, +@end ifnothtml +@ifhtml +@ref{funct:unur_urng_seed,@command{unur_urng_seed}} +@end ifhtml +@ifnothtml +@command{unur_urng_seed} +@end ifnothtml +, +@ifhtml +@ref{funct:unur_urng_anti,@command{unur_urng_anti},} +@end ifhtml +@ifnothtml +@command{unur_urng_anti}, +@end ifnothtml +@ifhtml +@ref{funct:unur_urng_reset,@command{unur_urng_reset}} +@end ifhtml +@ifnothtml +@command{unur_urng_reset} +@end ifnothtml +, +@ifhtml +@ref{funct:unur_urng_nextsub,@command{unur_urng_nextsub},} +@end ifhtml +@ifnothtml +@command{unur_urng_nextsub}, +@end ifnothtml +and +@ifhtml +@ref{funct:unur_urng_resetsub,@command{unur_urng_resetsub},} +@end ifhtml +@ifnothtml +@command{unur_urng_resetsub}, +@end ifnothtml +but act on the URNG object used by the @var{generator} object. + +@emph{Warning:} These calls should be used with care as it +influences all generator objects that share the same URNG object! +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_gen_sync} +@anchor{funct:unur_gen_seed} +@anchor{funct:unur_gen_anti} +@anchor{funct:unur_gen_reset} +@anchor{funct:unur_gen_nextsub} +@anchor{funct:unur_gen_resetsub} +@deftypefn {} {int} unur_gen_sync (UNUR_GEN* @var{generator}) +@deftypefnx {} {int} unur_gen_seed (UNUR_GEN* @var{generator}, unsigned @var{long seed}) +@deftypefnx {} {int} unur_gen_anti (UNUR_GEN* @var{generator}, int @var{anti}) +@deftypefnx {} {int} unur_gen_reset (UNUR_GEN* @var{generator}) +@deftypefnx {} {int} unur_gen_nextsub (UNUR_GEN* @var{generator}) +@deftypefnx {} {int} unur_gen_resetsub (UNUR_GEN* @var{generator}) +Analogous to +@ifhtml +@ref{funct:unur_urng_sync,@command{unur_urng_sync},} +@end ifhtml +@ifnothtml +@command{unur_urng_sync}, +@end ifnothtml +@ifhtml +@ref{funct:unur_urng_seed,@command{unur_urng_seed}} +@end ifhtml +@ifnothtml +@command{unur_urng_seed} +@end ifnothtml +, +@ifhtml +@ref{funct:unur_urng_anti,@command{unur_urng_anti},} +@end ifhtml +@ifnothtml +@command{unur_urng_anti}, +@end ifnothtml +@ifhtml +@ref{funct:unur_urng_reset,@command{unur_urng_reset}} +@end ifhtml +@ifnothtml +@command{unur_urng_reset} +@end ifnothtml +, +@ifhtml +@ref{funct:unur_urng_nextsub,@command{unur_urng_nextsub},} +@end ifhtml +@ifnothtml +@command{unur_urng_nextsub}, +@end ifnothtml +and +@ifhtml +@ref{funct:unur_urng_resetsub,@command{unur_urng_resetsub},} +@end ifhtml +@ifnothtml +@command{unur_urng_resetsub}, +@end ifnothtml +but act on the URNG object used by the @var{generator} object. + +@emph{Warning:} These calls should be used with care as it +influences all generator objects that share the same URNG object! +@end deftypefn +@end ifnotinfo + +@subheading API to create a new URNG object + +@emph{Notice:} These functions are provided to built a +UNUR_URNG object for a particular external random number +generator from scratch. For some libraries that contain random +number generators (like the GSL) there are special calls, +e.g. +@ifhtml +@ref{funct:unur_urng_gsl_new,@command{unur_urng_gsl_new},} +@end ifhtml +@ifnothtml +@command{unur_urng_gsl_new}, +@end ifnothtml +to get such an object. Then there is no +need to change the UNUR_URNG object as it already contains all +available features. + +If you have a particular library for random number generators you +can either write wrapper function like those in +@file{src/uniform/urng_gsl.c} or write an email to the authors of +UNU.RAN to write it for you. + +@ifinfo +@anchor{funct:unur_urng_new} +@deftypefn Function {UNUR_URNG*} unur_urng_new (double (* @var{sampleunif})(void* state ), void* @var{state}) +Get a new URNG object. +@var{sampleunif} is a function to the uniform sampling routine, +@var{state} a pointer to its arguments which usually contains the +state variables of the generator. + +Functions @var{sampleunif} with a different type for @var{p} or +without an argument at all also work. A typecast might be necessary +to avoid compiler warnings or error messages. + +For functions @var{sampleunif} that does not have any argument +should use @code{NULL} for @var{state}. + +@emph{Important:} @var{sampleunif} must not be the @code{NULL} pointer. + +There are appropriate calls that simplifies the task of creating +URNG objects for some libraries with uniform random number +generators, see below. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_new} +@deftypefn {} {UNUR_URNG*} unur_urng_new (double (* @var{sampleunif})(void* state ), void* @var{state}) +Get a new URNG object. +@var{sampleunif} is a function to the uniform sampling routine, +@var{state} a pointer to its arguments which usually contains the +state variables of the generator. + +Functions @var{sampleunif} with a different type for @var{p} or +without an argument at all also work. A typecast might be necessary +to avoid compiler warnings or error messages. + +For functions @var{sampleunif} that does not have any argument +should use @code{NULL} for @var{state}. + +@emph{Important:} @var{sampleunif} must not be the @code{NULL} pointer. + +There are appropriate calls that simplifies the task of creating +URNG objects for some libraries with uniform random number +generators, see below. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_free} +@deftypefn Function {void} unur_urng_free (UNUR_URNG* @var{urng}) +Destroy @var{urng} object. +It returns an error code if this is not possible. + +If the @code{NULL} is given, this function does nothing. + +@emph{Warning:} This call must be used with care. The @var{urng} +object must not be used by any existing generator object! +It is designed to work in conjunction with the wrapper functions +to create URNG objects for generators of a particular library. +Thus an object created by an +@ifhtml +@ref{funct:unur_urng_prng_new,@command{unur_urng_prng_new}} +@end ifhtml +@ifnothtml +@command{unur_urng_prng_new} +@end ifnothtml +call can be +simply destroyed by an +@ifhtml +@ref{funct:unur_urng_free,@command{unur_urng_free}} +@end ifhtml +@ifnothtml +@command{unur_urng_free} +@end ifnothtml +call. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_free} +@deftypefn {} {void} unur_urng_free (UNUR_URNG* @var{urng}) +Destroy @var{urng} object. +It returns an error code if this is not possible. + +If the @code{NULL} is given, this function does nothing. + +@emph{Warning:} This call must be used with care. The @var{urng} +object must not be used by any existing generator object! +It is designed to work in conjunction with the wrapper functions +to create URNG objects for generators of a particular library. +Thus an object created by an +@ifhtml +@ref{funct:unur_urng_prng_new,@command{unur_urng_prng_new}} +@end ifhtml +@ifnothtml +@command{unur_urng_prng_new} +@end ifnothtml +call can be +simply destroyed by an +@ifhtml +@ref{funct:unur_urng_free,@command{unur_urng_free}} +@end ifhtml +@ifnothtml +@command{unur_urng_free} +@end ifnothtml +call. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_set_sample_array} +@deftypefn Function {int} unur_urng_set_sample_array (UNUR_URNG* @var{urng}, unsigned int(* @var{samplearray})(void* state, double* @var{X}, int @var{dim} )) +Set function to fill array @var{X} of length @var{dim} with random +numbers generated by generator @var{urng} (if available). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_set_sample_array} +@deftypefn {} {int} unur_urng_set_sample_array (UNUR_URNG* @var{urng}, unsigned int(* @var{samplearray})(void* state, double* @var{X}, int @var{dim} )) +Set function to fill array @var{X} of length @var{dim} with random +numbers generated by generator @var{urng} (if available). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_set_sync} +@deftypefn Function {int} unur_urng_set_sync (UNUR_URNG* @var{urng}, void (* @var{sync})(void* state )) +Set function for jumping into a defined state (``sync''). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_set_sync} +@deftypefn {} {int} unur_urng_set_sync (UNUR_URNG* @var{urng}, void (* @var{sync})(void* state )) +Set function for jumping into a defined state (``sync''). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_set_seed} +@deftypefn Function {int} unur_urng_set_seed (UNUR_URNG* @var{urng}, void (* @var{setseed})(void* state, unsigned @var{long seed} )) +Set function to seed generator @var{urng} (if available). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_set_seed} +@deftypefn {} {int} unur_urng_set_seed (UNUR_URNG* @var{urng}, void (* @var{setseed})(void* state, unsigned @var{long seed} )) +Set function to seed generator @var{urng} (if available). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_set_anti} +@deftypefn Function {int} unur_urng_set_anti (UNUR_URNG* @var{urng}, void (* @var{setanti})(void* state, int @var{anti} )) +Set function to switch the antithetic flag of generator @var{urng} +(if available). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_set_anti} +@deftypefn {} {int} unur_urng_set_anti (UNUR_URNG* @var{urng}, void (* @var{setanti})(void* state, int @var{anti} )) +Set function to switch the antithetic flag of generator @var{urng} +(if available). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_set_reset} +@deftypefn Function {int} unur_urng_set_reset (UNUR_URNG* @var{urng}, void (* @var{reset})(void* state )) +Set function for reseting the uniform random number generator +@var{urng} (if available). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_set_reset} +@deftypefn {} {int} unur_urng_set_reset (UNUR_URNG* @var{urng}, void (* @var{reset})(void* state )) +Set function for reseting the uniform random number generator +@var{urng} (if available). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_set_nextsub} +@deftypefn Function {int} unur_urng_set_nextsub (UNUR_URNG* @var{urng}, void (* @var{nextsub})(void* state )) +Set function that allows jumping to start of the next substream of +@var{urng} (if available). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_set_nextsub} +@deftypefn {} {int} unur_urng_set_nextsub (UNUR_URNG* @var{urng}, void (* @var{nextsub})(void* state )) +Set function that allows jumping to start of the next substream of +@var{urng} (if available). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_set_resetsub} +@deftypefn Function {int} unur_urng_set_resetsub (UNUR_URNG* @var{urng}, void (* @var{resetsub})(void* state )) +Set function that allows jumping to start of the current substream +of @var{urng} (if available). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_set_resetsub} +@deftypefn {} {int} unur_urng_set_resetsub (UNUR_URNG* @var{urng}, void (* @var{resetsub})(void* state )) +Set function that allows jumping to start of the current substream +of @var{urng} (if available). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_set_delete} +@deftypefn Function {int} unur_urng_set_delete (UNUR_URNG* @var{urng}, void (* @var{fpdelete})(void* state )) +Set function for destroying @var{urng} (if available). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_set_delete} +@deftypefn {} {int} unur_urng_set_delete (UNUR_URNG* @var{urng}, void (* @var{fpdelete})(void* state )) +Set function for destroying @var{urng} (if available). +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of urng.h +@c ------------------------------------- +@c ------------------------------------- +@c urng_fvoid.h +@c + +@node URNG-FVOID +@section Simple interface for uniform random number generators + + +Simple interface for URNGs of type @code{double uniform(void *state)}. + +UNU.RAN contains some build-in URNGs of this type: +@table @code +@item unur_urng_MRG31k3p +Combined multiple recursive generator by Pierre L'Ecuyer and +Renee Touzin. +@item unur_urng_fish +Linear congruential generator by Fishman and Moore. +@item unur_urng_mstd +Linear congruential generator "Minimal Standard" by Park and Miller. +@end table + +Notice, however, that these generators are provided as a +fallback for the case that no state-of-the-art uniform random +number generators (e.g. @pxref{URNG-RNGSTREAM,Pierre L'Ecuyer's +@file{Rngstream} library, Pierre L'Ecuyer's @file{Rngstream} +library}) are used. + + +@subsubheading How To Use + + +Create an URNG object using +@ifhtml +@ref{funct:unur_urng_fvoid_new,@command{unur_urng_fvoid_new}.} +@end ifhtml +@ifnothtml +@command{unur_urng_fvoid_new}. +@end ifnothtml +By this call a pointer to the sampling routine and (optional) a +pointer to a reset routine are copied into the URNG object. +Other functions, like seeding the URNG, switching to antithetic +random number, or jumping to next substream, can be added to the +URNG object by the respective calls, e.g. by +@ifhtml +@ref{funct:unur_urng_set_seed,@command{unur_urng_set_seed}.} +@end ifhtml +@ifnothtml +@command{unur_urng_set_seed}. +@end ifnothtml +The following routines are supported for URNG objects of this +type: + +@itemize @minus +@item +@ifhtml +@ref{funct:unur_urng_sample,@command{unur_urng_sample}} +@end ifhtml +@ifnothtml +@command{unur_urng_sample} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_sample_array,@command{unur_urng_sample_array}} +@end ifhtml +@ifnothtml +@command{unur_urng_sample_array} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_seed,@command{unur_urng_seed}} +@end ifhtml +@ifnothtml +@command{unur_urng_seed} +@end ifnothtml +[optional] +@item +@ifhtml +@ref{funct:unur_urng_reset,@command{unur_urng_reset}} +@end ifhtml +@ifnothtml +@command{unur_urng_reset} +@end ifnothtml +[optional] +@item +@ifhtml +@ref{funct:unur_urng_free,@command{unur_urng_free}} +@end ifhtml +@ifnothtml +@command{unur_urng_free} +@end ifnothtml +@end itemize + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_urng_fvoid_new,unur_urng_fvoid_new} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_urng_fvoid_new} +@deftypefn Function {UNUR_URNG*} unur_urng_fvoid_new (double (* @var{urand})(void* state ), void (* @var{reset})(void* state )) +Make a URNG object for a generator that consists of a single +function call @var{urand}. + +If there is no @var{reset} function use @code{NULL} for the second argument. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_fvoid_new} +@deftypefn {} {UNUR_URNG*} unur_urng_fvoid_new (double (* @var{urand})(void* state ), void (* @var{reset})(void* state )) +Make a URNG object for a generator that consists of a single +function call @var{urand}. + +If there is no @var{reset} function use @code{NULL} for the second argument. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of urng_fvoid.h +@c ------------------------------------- +@c ------------------------------------- +@c urng_gsl.h +@c + +@node URNG-GSL +@section Interface to GSL uniform random number generators + + +Interface to the uniform random number generators from the +GNU Scientific Library (GSL). Documentation and source code +of this library is available from +@uref{http://www.gnu.org/software/gsl/}. + +The interface to the GSL must be compiled into UNU.RAN using the +configure flag @code{--with-urng-gsl}. +Notice that the GSL has to be installed before running +@code{./configure}. + + +@subsubheading How To Use + + +When using this interface @file{unuran_urng_gsl.h} must be included +in the corresponding C file, i.e., one must add the line + +@example +#include +@end example + +@noindent +Moreover, one must not forget to link the executable against +@file{libgsl}. + +The following routines are supported for URNG objects of +type GSL: + +@itemize @minus +@item +@ifhtml +@ref{funct:unur_urng_sample,@command{unur_urng_sample}} +@end ifhtml +@ifnothtml +@command{unur_urng_sample} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_sample_array,@command{unur_urng_sample_array}} +@end ifhtml +@ifnothtml +@command{unur_urng_sample_array} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_seed,@command{unur_urng_seed}} +@end ifhtml +@ifnothtml +@command{unur_urng_seed} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_reset,@command{unur_urng_reset}} +@end ifhtml +@ifnothtml +@command{unur_urng_reset} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_free,@command{unur_urng_free}} +@end ifhtml +@ifnothtml +@command{unur_urng_free} +@end ifnothtml +@end itemize + +@smallexample +@include ref_example_gsl.texi +@end smallexample + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_urng_gsl_new,unur_urng_gsl_new} +@item @ref{funct:unur_urng_gslptr_new,unur_urng_gslptr_new} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_urng_gsl_new} +@deftypefn Function {UNUR_URNG*} unur_urng_gsl_new (const @var{gsl_rng_type* urngtype}) +Make object for URNGs from the @file{GSL} (GNU Scientific Library). +@var{urngtype} is the type of the chosen generator as described in the +GSL manual (see Section Random Number Generation). This library is +available from @uref{http://www.gnu.org/software/gsl/}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_gsl_new} +@deftypefn {} {UNUR_URNG*} unur_urng_gsl_new (const @var{gsl_rng_type* urngtype}) +Make object for URNGs from the @file{GSL} (GNU Scientific Library). +@var{urngtype} is the type of the chosen generator as described in the +GSL manual (see Section Random Number Generation). This library is +available from @uref{http://www.gnu.org/software/gsl/}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_gslptr_new} +@deftypefn Function {UNUR_URNG*} unur_urng_gslptr_new (gsl_rng* @var{urng}) +Similar to +@ifhtml +@ref{funct:unur_urng_gsl_new,@command{unur_urng_gsl_new}} +@end ifhtml +@ifnothtml +@command{unur_urng_gsl_new} +@end ifnothtml +but it uses a pointer to a +generator object as returned by @code{gsl_rng_alloc(rng_type)}; +see @file{GSL} manual for details. + +@emph{Notice}: There is a subtle but important difference between +these two calls. When a generator object is created by a +@ifhtml +@ref{funct:unur_urng_gsl_new,@command{unur_urng_gsl_new}} +@end ifhtml +@ifnothtml +@command{unur_urng_gsl_new} +@end ifnothtml +call, then resetting of the generator works. +When a generator object is created by a +@ifhtml +@ref{funct:unur_urng_gslptr_new,@command{unur_urng_gslptr_new}} +@end ifhtml +@ifnothtml +@command{unur_urng_gslptr_new} +@end ifnothtml +call, then resetting only works after a +@code{unur_urng_seed(urng,myseed)} call. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_gslptr_new} +@deftypefn {} {UNUR_URNG*} unur_urng_gslptr_new (gsl_rng* @var{urng}) +Similar to +@ifhtml +@ref{funct:unur_urng_gsl_new,@command{unur_urng_gsl_new}} +@end ifhtml +@ifnothtml +@command{unur_urng_gsl_new} +@end ifnothtml +but it uses a pointer to a +generator object as returned by @code{gsl_rng_alloc(rng_type)}; +see @file{GSL} manual for details. + +@emph{Notice}: There is a subtle but important difference between +these two calls. When a generator object is created by a +@ifhtml +@ref{funct:unur_urng_gsl_new,@command{unur_urng_gsl_new}} +@end ifhtml +@ifnothtml +@command{unur_urng_gsl_new} +@end ifnothtml +call, then resetting of the generator works. +When a generator object is created by a +@ifhtml +@ref{funct:unur_urng_gslptr_new,@command{unur_urng_gslptr_new}} +@end ifhtml +@ifnothtml +@command{unur_urng_gslptr_new} +@end ifnothtml +call, then resetting only works after a +@code{unur_urng_seed(urng,myseed)} call. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of urng_gsl.h +@c ------------------------------------- +@c ------------------------------------- +@c urng_gslqrng.h +@c + +@node URNG-GSLQRNG +@section Interface to GSL generators for quasi-random points + + +Interface to the generators for quasi-random points (also called +low discrepancy point sets) from the GNU Scientific Library (GSL). +Documentation and source code of this library is available from +@uref{http://www.gnu.org/software/gsl/}. + +The interface to the GSL must be compiled into UNU.RAN using the +configure flag @code{--with-urng-gsl}. +Notice that the GSL has to be installed before running +@code{./configure}. + + +@subsubheading How To Use + + +When using this interface @file{unuran_urng_gsl.h} must be included +in the corresponding C file, i.e., one must add the line + +@example +#include +@end example + +@noindent +Moreover, one must not forget to link the executable against +@file{libgsl}. + +The following routines are supported for URNG objects of this +type: + +@itemize @minus +@item +@ifhtml +@ref{funct:unur_urng_sample,@command{unur_urng_sample}} +@end ifhtml +@ifnothtml +@command{unur_urng_sample} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_sample_array,@command{unur_urng_sample_array}} +@end ifhtml +@ifnothtml +@command{unur_urng_sample_array} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_reset,@command{unur_urng_reset}} +@end ifhtml +@ifnothtml +@command{unur_urng_reset} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_sync,@command{unur_urng_sync}} +@end ifhtml +@ifnothtml +@command{unur_urng_sync} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_free,@command{unur_urng_free}} +@end ifhtml +@ifnothtml +@command{unur_urng_free} +@end ifnothtml +@end itemize +@ifhtml +@ref{funct:unur_urng_sync,@command{unur_urng_sync}} +@end ifhtml +@ifnothtml +@command{unur_urng_sync} +@end ifnothtml +is used to jump to the first coordinate of +the next point generated by the generator. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_urng_gslqrng_new,unur_urng_gslqrng_new} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_urng_gslqrng_new} +@deftypefn Function {UNUR_URNG*} unur_urng_gslqrng_new (const @var{gsl_qrng_type* qrngtype}, unsigned @var{int dim}) +Make object for quasi-random point generators for dimension +@var{dim} from the @file{GSL} (GNU Scientific Library). +@var{qrngtype} is the type of the chosen generator as described in +the GSL manual (see section Quasi-Random Sequences). +This library is available from @uref{http://www.gnu.org/software/gsl/}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_gslqrng_new} +@deftypefn {} {UNUR_URNG*} unur_urng_gslqrng_new (const @var{gsl_qrng_type* qrngtype}, unsigned @var{int dim}) +Make object for quasi-random point generators for dimension +@var{dim} from the @file{GSL} (GNU Scientific Library). +@var{qrngtype} is the type of the chosen generator as described in +the GSL manual (see section Quasi-Random Sequences). +This library is available from @uref{http://www.gnu.org/software/gsl/}. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of urng_gslqrng.h +@c ------------------------------------- +@c ------------------------------------- +@c urng_prng.h +@c + +@node URNG-PRNG +@section Interface to Otmar Lendl's pseudo-random number generators + + +URNGs from Otmar Lendl's @code{prng} library. It provides a very +flexible way to sample form arbitrary URNGs by means of an object +oriented programing paradigma. Similarly to the UNU.RAN library +independent generator objects can be build and used. + +This library has been developed by the pLab group at the university +of Salzburg (Austria, EU) and implemented by Otmar Lendl. +It is available from +@uref{http://statmath.wu.ac.at/prng/} +or from the pLab site at +@uref{http://random.mat.sbg.ac.at/}. + +The interface to the PRNG library must be compiled into UNU.RAN using the +configure flag @code{--with-urng-prng}. +Notice that the PRNG library has to be installed before running +@code{./configure}. + + +@subsubheading How To Use + + +When using this interface @file{unuran_urng_prng.h} must be included +in the corresponding C file, i.e., one must add the line + +@example +#include +@end example + +@noindent +Moreover, one must not forget to link the executable against +@file{libprng}. + +The following routines are supported for URNG objects of +type PRNG: + +@itemize @minus +@item +@ifhtml +@ref{funct:unur_urng_sample,@command{unur_urng_sample}} +@end ifhtml +@ifnothtml +@command{unur_urng_sample} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_sample_array,@command{unur_urng_sample_array}} +@end ifhtml +@ifnothtml +@command{unur_urng_sample_array} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_seed,@command{unur_urng_seed}} +@end ifhtml +@ifnothtml +@command{unur_urng_seed} +@end ifnothtml +(availability depends on chosen PRNG generator!) +@item +@ifhtml +@ref{funct:unur_urng_reset,@command{unur_urng_reset}} +@end ifhtml +@ifnothtml +@command{unur_urng_reset} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_free,@command{unur_urng_free}} +@end ifhtml +@ifnothtml +@command{unur_urng_free} +@end ifnothtml +@end itemize + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_urng_prng_new,unur_urng_prng_new} +@item @ref{funct:unur_urng_prngptr_new,unur_urng_prngptr_new} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_urng_prng_new} +@deftypefn Function {UNUR_URNG*} unur_urng_prng_new (const @var{char* prngstr}) +Make object for URNGs from Otmar Lendl's @file{prng} package. +@var{prngstr} is a string that contains the necessary information +to create a uniform random number generator. For the format of this +string see the @file{prng} user manual. + +The @file{prng} library provides a very flexible way to sample form +arbitrary URNGs by means of an object oriented programing +paradigma. Similarly to the UNU.RAN library independent generator +objects can be build and used. The library has been developed +and implemented by Otmar Lendl as member of the pLab group at the +university of Salzburg (Austria, EU). + +It is available via anonymous ftp from +@uref{http://statmath.wu.ac.at/prng/} +or from the pLab site at +@uref{http://random.mat.sbg.ac.at/}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_prng_new} +@deftypefn {} {UNUR_URNG*} unur_urng_prng_new (const @var{char* prngstr}) +Make object for URNGs from Otmar Lendl's @file{prng} package. +@var{prngstr} is a string that contains the necessary information +to create a uniform random number generator. For the format of this +string see the @file{prng} user manual. + +The @file{prng} library provides a very flexible way to sample form +arbitrary URNGs by means of an object oriented programing +paradigma. Similarly to the UNU.RAN library independent generator +objects can be build and used. The library has been developed +and implemented by Otmar Lendl as member of the pLab group at the +university of Salzburg (Austria, EU). + +It is available via anonymous ftp from +@uref{http://statmath.wu.ac.at/prng/} +or from the pLab site at +@uref{http://random.mat.sbg.ac.at/}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_prngptr_new} +@deftypefn Function {UNUR_URNG*} unur_urng_prngptr_new (struct @var{prng* urng}) +Similar to +@ifhtml +@ref{funct:unur_urng_prng_new,@command{unur_urng_prng_new}} +@end ifhtml +@ifnothtml +@command{unur_urng_prng_new} +@end ifnothtml +but it uses a pointer to a +generator object as returned by @code{prng_new(prngstr)}; +see @file{prng} manual for details. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_prngptr_new} +@deftypefn {} {UNUR_URNG*} unur_urng_prngptr_new (struct @var{prng* urng}) +Similar to +@ifhtml +@ref{funct:unur_urng_prng_new,@command{unur_urng_prng_new}} +@end ifhtml +@ifnothtml +@command{unur_urng_prng_new} +@end ifnothtml +but it uses a pointer to a +generator object as returned by @code{prng_new(prngstr)}; +see @file{prng} manual for details. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of urng_prng.h +@c ------------------------------------- +@c ------------------------------------- +@c urng_rngstreams.h +@c + +@node URNG-RNGSTREAM +@section Interface to L'Ecuyer's RNGSTREAM random number generators + + +URNGs from Pierre L'Ecuyer's @file{RngStream} library for multiple +independent streams of pseudo-random numbers. +This library provides multiple independent streams of +pseudo-random numbers which itselves can be splitted into many +substreams. It is available from +@uref{http://www.iro.umontreal.ca/~lecuyer/myftp/streams00/c/}. +A GNU-style package is available from +@uref{http://statmath.wu.ac.at/software/RngStreams/}. + +The interface to the RngStream library must be compiled into UNU.RAN using the +configure flag @code{--with-urng-rngstream}. +Notice that the RngStream library has to be installed before running +@code{./configure}. + + +@subsubheading How To Use + + +When using this interface @file{unuran_urng_rngstream.h} must be included +in the corresponding C file, i.e., one must add the line + +@example +#include +@end example + +@noindent +Moreover, one must not forget to link the executable against the +@file{RngStream} library (i.e., when using the GNU-style package +in UNIX like environments one has to add @code{-lrngstreams} +when linking an executable). + +Notice that the @file{rngstream} library uses a package seed, +that means one should seed the uniform random number generator +only once in an application using the routine +@uref{http://statmath.wu.ac.at/software/RngStreams/doc/rngstreams.html#index-RngStream_005fSetPackageSeed-2,,@code{RngStream_SetPackageSeed}}: + +@example +unsigned long seed[] = @{111u, 222u, 333u, 444u, 555u, 666u@}; +RngStream_SetPackageSeed(seed); +@end example + +@noindent +The following routines are supported for URNG objects of this +type: + +@itemize @minus +@item +@ifhtml +@ref{funct:unur_urng_sample,@command{unur_urng_sample}} +@end ifhtml +@ifnothtml +@command{unur_urng_sample} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_sample_array,@command{unur_urng_sample_array}} +@end ifhtml +@ifnothtml +@command{unur_urng_sample_array} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_reset,@command{unur_urng_reset}} +@end ifhtml +@ifnothtml +@command{unur_urng_reset} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_nextsub,@command{unur_urng_nextsub}} +@end ifhtml +@ifnothtml +@command{unur_urng_nextsub} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_resetsub,@command{unur_urng_resetsub}} +@end ifhtml +@ifnothtml +@command{unur_urng_resetsub} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_anti,@command{unur_urng_anti}} +@end ifhtml +@ifnothtml +@command{unur_urng_anti} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_free,@command{unur_urng_free}} +@end ifhtml +@ifnothtml +@command{unur_urng_free} +@end ifnothtml +@end itemize + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_urng_rngstream_new,unur_urng_rngstream_new} +@item @ref{funct:unur_urng_rngstreamptr_new,unur_urng_rngstreamptr_new} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_urng_rngstream_new} +@deftypefn Function {UNUR_URNG*} unur_urng_rngstream_new (const @var{char* urngstr}) +Make object for URNGs from Pierre L'Ecuyer's @file{RngStream} +library. @var{urngstr} is an arbitrary string to label a stream. It +need not be unique. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_rngstream_new} +@deftypefn {} {UNUR_URNG*} unur_urng_rngstream_new (const @var{char* urngstr}) +Make object for URNGs from Pierre L'Ecuyer's @file{RngStream} +library. @var{urngstr} is an arbitrary string to label a stream. It +need not be unique. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_rngstreamptr_new} +@deftypefn Function {UNUR_URNG*} unur_urng_rngstreamptr_new (RngStream @var{rngstream}) +Similar to +@ifhtml +@ref{funct:unur_urng_rngstream_new,@command{unur_urng_rngstream_new}} +@end ifhtml +@ifnothtml +@command{unur_urng_rngstream_new} +@end ifnothtml +but it uses a pointer to a +generator object as returned by @code{RngStream_CreateStream()}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_rngstreamptr_new} +@deftypefn {} {UNUR_URNG*} unur_urng_rngstreamptr_new (RngStream @var{rngstream}) +Similar to +@ifhtml +@ref{funct:unur_urng_rngstream_new,@command{unur_urng_rngstream_new}} +@end ifhtml +@ifnothtml +@command{unur_urng_rngstream_new} +@end ifnothtml +but it uses a pointer to a +generator object as returned by @code{RngStream_CreateStream()}. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of urng_rngstreams.h +@c ------------------------------------- +@c ------------------------------------- +@c urng_randomshift.h +@c + +@node URNG-RANDOMSHIFT +@section Combine point set generator with random shifts + + +Generators of type RANDOMSHIFT combine a point set generator with +generators to apply random shifts as proposed in +@ifhtml +@ref{bib:CPa76,, [CPa76]} +@end ifhtml +@ifnothtml +[CPa76] +@end ifnothtml +: + +@enumerate +@item +Sample and store a random vector S. +@item +Run a QMC simulation where S is added to each point of the +generated quasi-random point (mod 1). +@item +Repeat steps 1 and 2. +@end enumerate + + +@subsubheading How To Use + + +Create a URNG object for a point set generator and a URNG object +for a generator to create shift vectors at random. +The meta URNG object can then be created using +@ifhtml +@ref{funct:unur_urng_randomshift_new,@command{unur_urng_randomshift_new}.} +@end ifhtml +@ifnothtml +@command{unur_urng_randomshift_new}. +@end ifnothtml +Notice that only pointers to the two underlying URNG generator +objects are copied into the newly created meta generator. Thus +manipulating the meta URNG also changes the underlying URNGs +and vice versa. + +The following routines are supported for URNG objects of +type RANDOMSHIFT: + +@itemize @minus +@item +@ifhtml +@ref{funct:unur_urng_sample,@command{unur_urng_sample}} +@end ifhtml +@ifnothtml +@command{unur_urng_sample} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_sample_array,@command{unur_urng_sample_array}} +@end ifhtml +@ifnothtml +@command{unur_urng_sample_array} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_reset,@command{unur_urng_reset}} +@end ifhtml +@ifnothtml +@command{unur_urng_reset} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_sync,@command{unur_urng_sync}} +@end ifhtml +@ifnothtml +@command{unur_urng_sync} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_randomshift_nextshift,@command{unur_urng_randomshift_nextshift}} +@end ifhtml +@ifnothtml +@command{unur_urng_randomshift_nextshift} +@end ifnothtml +@item +@ifhtml +@ref{funct:unur_urng_free,@command{unur_urng_free}} +@end ifhtml +@ifnothtml +@command{unur_urng_free} +@end ifnothtml +@end itemize +@ifhtml +@ref{funct:unur_urng_sync,@command{unur_urng_sync}} +@end ifhtml +@ifnothtml +@command{unur_urng_sync} +@end ifnothtml +is used to jump to the first coordinate of +the next point generated by the generator. +@ifhtml +@ref{funct:unur_urng_randomshift_nextshift,@command{unur_urng_randomshift_nextshift}} +@end ifhtml +@ifnothtml +@command{unur_urng_randomshift_nextshift} +@end ifnothtml +allows to replace the shift +vector by another randomly chosen shift vector. + +@emph{Important:} +@ifhtml +@ref{funct:unur_urng_sync,@command{unur_urng_sync}} +@end ifhtml +@ifnothtml +@command{unur_urng_sync} +@end ifnothtml +is only available if it is +if it is implemented for the underlying point set generator. + +@emph{Important:} +@ifhtml +@ref{funct:unur_urng_reset,@command{unur_urng_reset}} +@end ifhtml +@ifnothtml +@command{unur_urng_reset} +@end ifnothtml +is only available if it is +available for both underlying generators. + + + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_urng_randomshift_new,unur_urng_randomshift_new} +@item @ref{funct:unur_urng_randomshift_nextshift,unur_urng_randomshift_nextshift} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_urng_randomshift_new} +@deftypefn Function {UNUR_URNG*} unur_urng_randomshift_new (UNUR_URNG* @var{qrng}, UNUR_URNG* @var{srng}, int @var{dim}) +Make object for URNG with randomly shifted point sets. +@var{qrng} is a generated that generates point sets of dimension @var{dim}. +@var{srng} is a generated that generates random numbers or vectors. + +@emph{Notice:} Only pointers to the respective objects @var{qrng} +and @var{srng} are copied into the created meta generator. Thus +manipulating the meta URNG also changes the underlying URNGs +and vice versa. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_randomshift_new} +@deftypefn {} {UNUR_URNG*} unur_urng_randomshift_new (UNUR_URNG* @var{qrng}, UNUR_URNG* @var{srng}, int @var{dim}) +Make object for URNG with randomly shifted point sets. +@var{qrng} is a generated that generates point sets of dimension @var{dim}. +@var{srng} is a generated that generates random numbers or vectors. + +@emph{Notice:} Only pointers to the respective objects @var{qrng} +and @var{srng} are copied into the created meta generator. Thus +manipulating the meta URNG also changes the underlying URNGs +and vice versa. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_urng_randomshift_nextshift} +@deftypefn Function {int} unur_urng_randomshift_nextshift (UNUR_URNG* @var{urng}) +Get the next (randomly chosen) vector for shifting the points set, and the +underlying point generator @var{qrng} is reset. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_urng_randomshift_nextshift} +@deftypefn {} {int} unur_urng_randomshift_nextshift (UNUR_URNG* @var{urng}) +Get the next (randomly chosen) vector for shifting the points set, and the +underlying point generator @var{qrng} is reset. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of urng_randomshift.h +@c ------------------------------------- +@c ------------------------------------- +@c stddist.dh +@c + +@node Stddist +@chapter UNU.RAN Library of standard distributions + +@menu +* Stddist_CONT:: UNU.RAN Library of continuous univariate distributions +* Stddist_CVEC:: UNU.RAN Library of continuous multivariate distributions +* Stddist_DISCR:: UNU.RAN Library of discrete univariate distributions +* Stddist_MATR:: UNU.RAN Library of random matrices +@end menu + + +Although it is not its primary target, many +distributions are already implemented in UNU.RAN. +This section presents these available distributions +and their parameters. + +The syntax to get a distribuion object for distributions +@code{} is: + +@deftypefn -- {UNUR_DISTR*} unur_distr_@code{} (double* @var{params}, int @var{n_params}) +@var{params} is an array of doubles of size +@var{n_params} holding the parameters. +@end deftypefn + +@noindent +E.g. to get an object for the gamma distribution (with shape parameter) use + +@example +unur_distr_gamma( params, 1 ); +@end example + +@noindent +Distributions may have default parameters with need not be given +explicitely. +E.g. The gamma distribution has three parameters: the +shape, scale and location parameter. Only the (first) shape parameter +is required. The others can be omitted and are then set by default +values. + +@example +/* alpha = 5; default: beta = 1, gamma = 0 */ +double fpar[] = @{5.@}; +unur_distr_gamma( fpar, 1 ); + +/* alpha = 5, beta = 3; default: gamma = 0 */ +double fpar[] = @{5., 3.@}; +unur_distr_gamma( fpar, 2 ); + +/* alpha = 5, beta = 3, gamma = -2 +double fpar[] = @{5., 3., -2.@}; +unur_distr_gamma( fpar, 3 ); +@end example + +@strong{Important:} Naturally the computational accuracy +limits the possible parameters. There shouldn't be problems +when the parameters of a distribution are in a ``reasonable'' range but +e.g. the normal distribution N(10^15,1) won't yield the desired results. +(In this case it would be better generating N(0,1) and @emph{then} +transform the results.) +@* Of course computational inaccuracy is not specific to UNU.RAN +and should always be kept in mind when working with computers. + +@emph{Important:} The routines of the standard library are included +for non-uniform random variate generation and not to provide special +functions for statistical computations. + +@subheading Remark + +The following keywords are used in the tables: +@table @i +@item PDF +probability density function, +with variable @i{x}. + +@item PMF +probability mass function, +with variable @i{k}. + +@item constant +normalization constant for given PDF and PMF, resp. +They must be multiplied by @i{constant} to get the +``real'' PDF and PMF. + +@item CDF +gives information whether the CDF is implemented in UNU.RAN. + +@item domain +domain PDF and PMF, resp. + +@item parameters @var{n_std} (@var{n_total}): @r{list} +list of parameters for distribution, where @var{n_std} is the number +of parameters for the standard form of the distribution and +@var{n_total} the total number for the (non-standard form of the) +distribution. @var{list} is the list of parameters in the order as +they are stored in the array of parameters. Optional parameter that +can be omitted are enclosed in square brackets @code{[@dots{}]}. + +A detailed list of these parameters gives then the range of valid +parameters and defaults for optional parameters that are used when +these are omitted. + +@item reference +gives reference for distribution +(@pxref{Bibliography}). + +@item special generators +lists available special generators for the distribution. +The first number is the variant that to be set by +@ifhtml +@ref{funct:unur_cstd_set_variant,@command{unur_cstd_set_variant}} +@end ifhtml +@ifnothtml +@command{unur_cstd_set_variant} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_dstd_set_variant,@command{unur_dstd_set_variant}} +@end ifhtml +@ifnothtml +@command{unur_dstd_set_variant} +@end ifnothtml +call, respectively. +If no variant is set the default variant @code{DEF} is used. +In the table the respective abbreviations @code{DEF} and @code{INV} +are used for @code{UNUR_STDGEN_DEFAULT} and +@code{UNUR_STDGEN_INVERSION}. +Also the references for these methods are given (@pxref{Bibliography}). + +Notice that these generators might be slower than universal methods. + +If @code{DEF} is ommited, the first entry is the default generator. + +@end table + + + +@c +@c end of stddist.dh +@c ------------------------------------- +@c ------------------------------------- +@c stddist.dh +@c + +@page +@node Stddist_CONT +@section UNU.RAN Library of continuous univariate distributions + +@menu +* F:: F-distribution +* beta:: Beta distribution +* cauchy:: Cauchy distribution +* chi:: Chi distribution +* chisquare:: Chisquare distribution +* exponential:: Exponential distribution +* extremeI:: Extreme value type I (Gumbel-type) distribution +* extremeII:: Extreme value type II (Frechet-type) distribution +* gamma:: Gamma distribution +* gig:: Generalized Inverse Gaussian distribution +* gig2:: Generalized Inverse Gaussian distribution +* hyperbolic:: Hyperbolic distribution +* ig:: Inverse Gaussian distribution +* laplace:: Laplace distribution +* logistic:: Logistic distribution +* lognormal:: Log-Normal distribution +* lomax:: Lomax distribution (Pareto distribution of second kind) +* normal:: Normal distribution +* pareto:: Pareto distribution (of first kind) +* powerexponential:: Powerexponential (Subbotin) distribution +* rayleigh:: Rayleigh distribution +* slash:: Slash distribution +* student:: Student's t distribution +* triangular:: Triangular distribution +* uniform:: Uniform distribution +* weibull:: Weibull distribution +@end menu + + +@c +@c end of stddist.dh +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node F +@subsection @code{F} -- F-distribution +@anchor{funct:unur_distr_F} +@findex unur_distr_F + + +@table @i +@item PDF: +@iftex +@tex +$(x^{\nu_1/2-1}) / (1+\nu_1/\nu_2 x)^{(\nu_1+\nu_2)/2}$ +@end tex +@end iftex +@ifnottex +(x^(nu_1/2-1)) / (1+nu_1/nu_2 x)^((nu_1+nu_2)/2) +@end ifnottex + +@item constant: +@iftex +@tex +$(\nu_1/\nu_2)^{\nu_1/2} / B(\nu_1/2,\nu_2/2)$ +@end tex +@end iftex +@ifnottex +(nu_1/nu_2)^(nu_1/2) / B(nu_1/2,nu_2/2) +@end ifnottex + +@item domain: +@iftex +@tex +$0 < x < \infty$ +@end tex +@end iftex +@ifnottex +0 < x < infinity +@end ifnottex + +@iftex +@item parameters 2 (2): @r{ nu_1, nu_2} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$\nu_1 $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{scale}) +@item @code{[1]} +@tab@tex$\nu_2 $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{scale}) +@end multitable +@end iftex +@ifnottex +@item parameters 2 (2): nu_1, nu_2 +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab nu_1 @tab > 0 @tab @tab @i{(scale)} +@item @code{[1]} @tab nu_2 @tab > 0 @tab @tab @i{(scale)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBc95,, [JKBc95: Ch.27; p.322]} +@end ifhtml +@ifnothtml +[JKBc95: Ch.27; p.322] +@end ifnothtml + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node beta +@subsection @code{beta} -- Beta distribution +@anchor{funct:unur_distr_beta} +@findex unur_distr_beta + + +@table @i +@item PDF: +@iftex +@tex +$(x-a)^{p-1} \, (b-x)^{q-1}$ +@end tex +@end iftex +@ifnottex +(x-a)^(p-1) * (b-x)^(q-1) +@end ifnottex + +@item constant: +@iftex +@tex +$1 / (B(p,q) \, (b-a)^{p+q-1})$ +@end tex +@end iftex +@ifnottex +1 / (B(p,q) * (b-a)^(p+q-1)) +@end ifnottex + +@item domain: +@iftex +@tex +$a < x < b$ +@end tex +@end iftex +@ifnottex +a < x < b +@end ifnottex + +@iftex +@item parameters 2 (4): @r{ p, q [, a, b ]} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$p $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{scale}) +@item @code{[1]} +@tab@tex$q $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{scale}) +@item @code{[2]} +@tab@tex$a $@end tex +@tab@tex$ $@end tex +@tab 0 +@tab (@i{location, scale}) +@item @code{[3]} +@tab@tex$b $@end tex +@tab@tex$> a $@end tex +@tab 1 +@tab (@i{location, scale}) +@end multitable +@end iftex +@ifnottex +@item parameters 2 (4): p, q [, a, b ] +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab p @tab > 0 @tab @tab @i{(scale)} +@item @code{[1]} @tab q @tab > 0 @tab @tab @i{(scale)} +@item @code{[2]} @tab a @tab @tab 0 @tab @i{(location, scale)} +@item @code{[3]} @tab b @tab > a @tab 1 @tab @i{(location, scale)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBc95,, [JKBc95: Ch.25; p.210]} +@end ifhtml +@ifnothtml +[JKBc95: Ch.25; p.210] +@end ifnothtml + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node cauchy +@subsection @code{cauchy} -- Cauchy distribution +@anchor{funct:unur_distr_cauchy} +@findex unur_distr_cauchy + + +@table @i +@item PDF: +@iftex +@tex +$1/(1 + ((x-\theta)/\lambda)^2)$ +@end tex +@end iftex +@ifnottex +1/(1 + ((x-theta)/lambda)^2) +@end ifnottex + +@item constant: +@iftex +@tex +$1/(\pi \, \lambda)$ +@end tex +@end iftex +@ifnottex +1/(pi * lambda) +@end ifnottex + +@item domain: +@iftex +@tex +$-\infty < x < \infty$ +@end tex +@end iftex +@ifnottex +-infinity < x < infinity +@end ifnottex + +@iftex +@item parameters 0 (2): @r{ [ theta [, lambda ] ]} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$\theta $@end tex +@tab@tex$ $@end tex +@tab 0 +@tab (@i{location}) +@item @code{[1]} +@tab@tex$\lambda $@end tex +@tab@tex$> 0 $@end tex +@tab 1 +@tab (@i{scale}) +@end multitable +@end iftex +@ifnottex +@item parameters 0 (2): [ theta [, lambda ] ] +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab theta @tab @tab 0 @tab @i{(location)} +@item @code{[1]} @tab lambda @tab > 0 @tab 1 @tab @i{(scale)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBb94,, [JKBb94: Ch.16; p.299]} +@end ifhtml +@ifnothtml +[JKBb94: Ch.16; p.299] +@end ifnothtml + +@item special generators: +@table @code +@item INV +Inversion method +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node chi +@subsection @code{chi} -- Chi distribution +@anchor{funct:unur_distr_chi} +@findex unur_distr_chi + + +@table @i +@item PDF: +@iftex +@tex +$x^{\nu-1} \, \exp( -x^2/2 )$ +@end tex +@end iftex +@ifnottex +x^(nu-1) * exp( -x^2/2 ) +@end ifnottex + +@item constant: +@iftex +@tex +$1 / (2^{(\nu/2)-1} \, \Gamma(\nu/2))$ +@end tex +@end iftex +@ifnottex +1 / (2^((nu/2)-1) * Gamma(nu/2)) +@end ifnottex + +@item domain: +@iftex +@tex +$0 \leq x < \infty$ +@end tex +@end iftex +@ifnottex +0 <= x < infinity +@end ifnottex + +@iftex +@item parameters 1 (1): @r{ nu} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$\nu $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{shape}) +@end multitable +@end iftex +@ifnottex +@item parameters 1 (1): nu +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab nu @tab > 0 @tab @tab @i{(shape)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBb94,, [JKBb94: Ch.18; p.417]} +@end ifhtml +@ifnothtml +[JKBb94: Ch.18; p.417] +@end ifnothtml + +@item special generators: +@table @code +@item DEF +@iftex +Ratio of Uniforms with shift (only for +@tex $\nu \geq 1$ +@end tex +) [MJa87] +@end iftex +@ifhtml +Ratio of Uniforms with shift (only for nu >= 1) @ref{bib:MJa87, [MJa87]} +@end ifhtml +@ifinfo +Ratio of Uniforms with shift (only for nu >= 1) [MJa87] +@end ifinfo +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node chisquare +@subsection @code{chisquare} -- Chisquare distribution +@anchor{funct:unur_distr_chisquare} +@findex unur_distr_chisquare + + +@table @i +@item PDF: +@iftex +@tex +$x^{(\nu/2)-1} \, \exp( -x/2 )$ +@end tex +@end iftex +@ifnottex +x^((nu/2)-1) * exp( -x/2 ) +@end ifnottex + +@item constant: +@iftex +@tex +$1 / (2^{\nu/2} \, \Gamma(\nu/2))$ +@end tex +@end iftex +@ifnottex +1 / (2^(nu/2) * Gamma(nu/2)) +@end ifnottex + +@item domain: +@iftex +@tex +$0 \leq x < \infty$ +@end tex +@end iftex +@ifnottex +0 <= x < infinity +@end ifnottex + +@iftex +@item parameters 1 (1): @r{ nu} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$\nu $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{shape (degrees of freedom)}) +@end multitable +@end iftex +@ifnottex +@item parameters 1 (1): nu +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab nu @tab > 0 @tab @tab @i{(shape (degrees of freedom))} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBb94,, [JKBb94: Ch.18; p.416]} +@end ifhtml +@ifnothtml +[JKBb94: Ch.18; p.416] +@end ifnothtml + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node exponential +@subsection @code{exponential} -- Exponential distribution +@anchor{funct:unur_distr_exponential} +@findex unur_distr_exponential + + +@table @i +@item PDF: +@iftex +@tex +$\exp( -(x-\theta)/\sigma)$ +@end tex +@end iftex +@ifnottex +exp( -(x-theta)/sigma) +@end ifnottex + +@item constant: +@iftex +@tex +$1/\sigma$ +@end tex +@end iftex +@ifnottex +1/sigma +@end ifnottex + +@item domain: +@iftex +@tex +$\theta \leq x < \infty$ +@end tex +@end iftex +@ifnottex +theta <= x < infinity +@end ifnottex + +@iftex +@item parameters 0 (2): @r{ [ sigma [, theta ] ]} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$\sigma $@end tex +@tab@tex$> 0 $@end tex +@tab 1 +@tab (@i{scale}) +@item @code{[1]} +@tab@tex$\theta $@end tex +@tab@tex$ $@end tex +@tab 0 +@tab (@i{location}) +@end multitable +@end iftex +@ifnottex +@item parameters 0 (2): [ sigma [, theta ] ] +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab sigma @tab > 0 @tab 1 @tab @i{(scale)} +@item @code{[1]} @tab theta @tab @tab 0 @tab @i{(location)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBb94,, [JKBb94: Ch.19; p.494]} +@end ifhtml +@ifnothtml +[JKBb94: Ch.19; p.494] +@end ifnothtml + +@item special generators: +@table @code +@item INV +Inversion method +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node extremeI +@subsection @code{extremeI} -- Extreme value type I (Gumbel-type) distribution +@anchor{funct:unur_distr_extremeI} +@findex unur_distr_extremeI + + +@table @i +@item PDF: +@iftex +@tex +$\exp( -\exp( -{x-\zeta\over \theta} ) - {x-\zeta\over \theta} )$ +@end tex +@end iftex +@ifnottex +exp( -exp( -(x-zeta)/theta ) - (x-zeta)/theta ) +@end ifnottex + +@item constant: +@iftex +@tex +$1/\theta$ +@end tex +@end iftex +@ifnottex +1/theta +@end ifnottex + +@item domain: +@iftex +@tex +$-\infty < x <\infty$ +@end tex +@end iftex +@ifnottex +-infinity < x 0 $@end tex +@tab 1 +@tab (@i{scale}) +@end multitable +@end iftex +@ifnottex +@item parameters 0 (2): [ zeta [, theta ] ] +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab zeta @tab @tab 0 @tab @i{(location)} +@item @code{[1]} @tab theta @tab > 0 @tab 1 @tab @i{(scale)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBc95,, [JKBc95: Ch.22; p.2]} +@end ifhtml +@ifnothtml +[JKBc95: Ch.22; p.2] +@end ifnothtml + +@item special generators: +@table @code +@item INV +Inversion method +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node extremeII +@subsection @code{extremeII} -- Extreme value type II (Frechet-type) distribution +@anchor{funct:unur_distr_extremeII} +@findex unur_distr_extremeII + + +@table @i +@item PDF: +@iftex +@tex +$\exp( -({x-\zeta\over \theta})^{-k}) \, ({x-\zeta\over \theta})^{-k-1}$ +@end tex +@end iftex +@ifnottex +exp( -((x-zeta)/theta)^(-k)) * ((x-zeta)/theta)^(-k-1) +@end ifnottex + +@item constant: +@iftex +@tex +$k/\theta$ +@end tex +@end iftex +@ifnottex +k/theta +@end ifnottex + +@item domain: +@iftex +@tex +$\zeta < x <\infty$ +@end tex +@end iftex +@ifnottex +zeta < x 0 $@end tex +@tab +@tab (@i{shape}) +@item @code{[1]} +@tab@tex$\zeta $@end tex +@tab@tex$ $@end tex +@tab 0 +@tab (@i{location}) +@item @code{[2]} +@tab@tex$\theta $@end tex +@tab@tex$> 0 $@end tex +@tab 1 +@tab (@i{scale}) +@end multitable +@end iftex +@ifnottex +@item parameters 1 (3): k [, zeta [, theta ] ] +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab k @tab > 0 @tab @tab @i{(shape)} +@item @code{[1]} @tab zeta @tab @tab 0 @tab @i{(location)} +@item @code{[2]} @tab theta @tab > 0 @tab 1 @tab @i{(scale)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBc95,, [JKBc95: Ch.22; p.2]} +@end ifhtml +@ifnothtml +[JKBc95: Ch.22; p.2] +@end ifnothtml + +@item special generators: +@table @code +@item INV +Inversion method +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node gamma +@subsection @code{gamma} -- Gamma distribution +@anchor{funct:unur_distr_gamma} +@findex unur_distr_gamma + + +@table @i +@item PDF: +@iftex +@tex +$({x-\gamma\over \beta})^{\alpha-1} \, \exp( -{x-\gamma\over \beta} )$ +@end tex +@end iftex +@ifnottex +((x-gamma)/beta)^(alpha-1) * exp( -(x-gamma)/beta ) +@end ifnottex + +@item constant: +@iftex +@tex +$1 / (\beta \, \Gamma(\alpha))$ +@end tex +@end iftex +@ifnottex +1 / (beta * Gamma(alpha)) +@end ifnottex + +@item domain: +@iftex +@tex +$\gamma < x < \infty$ +@end tex +@end iftex +@ifnottex +gamma < x < infinity +@end ifnottex + +@iftex +@item parameters 1 (3): @r{ alpha [, beta [, gamma ] ]} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$\alpha $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{shape}) +@item @code{[1]} +@tab@tex$\beta $@end tex +@tab@tex$> 0 $@end tex +@tab 1 +@tab (@i{scale}) +@item @code{[2]} +@tab@tex$\gamma $@end tex +@tab@tex$ $@end tex +@tab 0 +@tab (@i{location}) +@end multitable +@end iftex +@ifnottex +@item parameters 1 (3): alpha [, beta [, gamma ] ] +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab alpha @tab > 0 @tab @tab @i{(shape)} +@item @code{[1]} @tab beta @tab > 0 @tab 1 @tab @i{(scale)} +@item @code{[2]} @tab gamma @tab @tab 0 @tab @i{(location)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBb94,, [JKBb94: Ch.17; p.337]} +@end ifhtml +@ifnothtml +[JKBb94: Ch.17; p.337] +@end ifnothtml + +@item special generators: +@table @code +@item DEF +@iftex +Acceptance Rejection combined with Acceptance Complement [ADa74] [ADa82] +@end iftex +@ifhtml +Acceptance Rejection combined with Acceptance Complement @ref{bib:ADa74, [ADa74]} @ref{bib:ADa82, [ADa82]} +@end ifhtml +@ifinfo +Acceptance Rejection combined with Acceptance Complement [ADa74] [ADa82] +@end ifinfo +@item 2 +@iftex +Rejection from \log-\logistic envelopes [CHa77] +@end iftex +@ifhtml +Rejection from log-logistic envelopes @ref{bib:CHa77, [CHa77]} +@end ifhtml +@ifinfo +Rejection from log-logistic envelopes [CHa77] +@end ifinfo +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node gig +@subsection @code{gig} -- Generalized Inverse Gaussian distribution +@anchor{funct:unur_distr_gig} +@findex unur_distr_gig + + +@table @i +@item PDF: +@iftex +@tex +$x^{\theta-1} \, \exp( -{1\over 2} \, \omega \, ({x\over \eta} + {\eta\over x}))$ +@end tex +@end iftex +@ifnottex +x^(theta-1) * exp( -1/2 * omega * (x/eta + eta/x)) +@end ifnottex + +@item constant: +@iftex +@tex +not implemented! +@end tex +@end iftex +@ifnottex +not implemented! +@end ifnottex + +@item CDF: +@iftex +@tex +not implemented! +@end tex +@end iftex +@ifnottex +not implemented! +@end ifnottex + +@item domain: +@iftex +@tex +$0 < x <\infty$ +@end tex +@end iftex +@ifnottex +0 < x 0 $@end tex +@tab +@tab (@i{scale}) +@item @code{[2]} +@tab@tex$\eta $@end tex +@tab@tex$> 0 $@end tex +@tab 1 +@tab (@i{shape}) +@end multitable +@end iftex +@ifnottex +@item parameters 2 (3): theta, omega [, eta ] +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab theta @tab @tab @tab @i{(shape)} +@item @code{[1]} @tab omega @tab > 0 @tab @tab @i{(scale)} +@item @code{[2]} @tab eta @tab > 0 @tab 1 @tab @i{(shape)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBb94,, [JKBb94: Ch.15; p.84]} +@end ifhtml +@ifnothtml +[JKBb94: Ch.15; p.84] +@end ifnothtml + +@item special generators: +@table @code +@item DEF +@iftex +Ratio-of-Uniforms method [Dag89] +@end iftex +@ifhtml +Ratio-of-Uniforms method @ref{bib:Dag89, [Dag89]} +@end ifhtml +@ifinfo +Ratio-of-Uniforms method [Dag89] +@end ifinfo +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node gig2 +@subsection @code{gig2} -- Generalized Inverse Gaussian distribution +@anchor{funct:unur_distr_gig2} +@findex unur_distr_gig2 + + +@table @i +@item PDF: +@iftex +@tex +$x^{\theta-1} \, \exp( -{1\over 2} \, ({\chi\over x} + \psi\, x))$ +@end tex +@end iftex +@ifnottex +x^(theta-1) * exp( -1/2 * (chi/x + psi*x)) +@end ifnottex + +@item constant: +@iftex +@tex +not implemented! +@end tex +@end iftex +@ifnottex +not implemented! +@end ifnottex + +@item CDF: +@iftex +@tex +not implemented! +@end tex +@end iftex +@ifnottex +not implemented! +@end ifnottex + +@item domain: +@iftex +@tex +$0 < x <\infty$ +@end tex +@end iftex +@ifnottex +0 < x 0 $@end tex +@tab +@tab (@i{shape}) +@item @code{[2]} +@tab@tex$\chi $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{shape}) +@end multitable +@end iftex +@ifnottex +@item parameters 3 (3): theta, psi, chi +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab theta @tab @tab @tab @i{(shape)} +@item @code{[1]} @tab psi @tab > 0 @tab @tab @i{(shape)} +@item @code{[2]} @tab chi @tab > 0 @tab @tab @i{(shape)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBb94,, [JKBb94: Ch.15; p.84]} +@end ifhtml +@ifnothtml +[JKBb94: Ch.15; p.84] +@end ifnothtml + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node hyperbolic +@subsection @code{hyperbolic} -- Hyperbolic distribution +@anchor{funct:unur_distr_hyperbolic} +@findex unur_distr_hyperbolic + + +@table @i +@item PDF: +@iftex +@tex +$\exp( -\alpha \, \sqrt{\delta^2 + (x - \mu)^2} + \beta\, (x-\mu) )$ +@end tex +@end iftex +@ifnottex +exp( -alpha * sqrt(delta^2 + (x - mu)^2) + beta*(x-mu) ) +@end ifnottex + +@item constant: +@iftex +@tex +not implemented! +@end tex +@end iftex +@ifnottex +not implemented! +@end ifnottex + +@item CDF: +@iftex +@tex +not implemented! +@end tex +@end iftex +@ifnottex +not implemented! +@end ifnottex + +@item domain: +@iftex +@tex +$-\infty < x <\infty$ +@end tex +@end iftex +@ifnottex +-infinity < x |\beta| $@end tex +@tab +@tab (@i{shape (tail)}) +@item @code{[1]} +@tab@tex$\beta $@end tex +@tab@tex$ $@end tex +@tab +@tab (@i{shape (asymmetry)}) +@item @code{[2]} +@tab@tex$\delta $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{scale}) +@item @code{[3]} +@tab@tex$\mu $@end tex +@tab@tex$ $@end tex +@tab +@tab (@i{location}) +@end multitable +@end iftex +@ifnottex +@item parameters 4 (4): alpha, beta, delta, mu +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab alpha @tab >|beta| @tab @tab @i{(shape (tail))} +@item @code{[1]} @tab beta @tab @tab @tab @i{(shape (asymmetry))} +@item @code{[2]} @tab delta @tab > 0 @tab @tab @i{(scale)} +@item @code{[3]} @tab mu @tab @tab @tab @i{(location)} +@end multitable +@end ifnottex +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node ig +@subsection @code{ig} -- Inverse Gaussian distribution +@anchor{funct:unur_distr_ig} +@findex unur_distr_ig + + +@table @i +@item PDF: +@iftex +@tex +$\sqrt{ {\lambda\over 2\, \pi\, x^3} } \, \exp( -{\lambda\, (x-\mu)^2\over 2\, \mu^2\, x} )$ +@end tex +@end iftex +@ifnottex +sqrt( lambda/2*pi*x^3 ) * exp( -(lambda*(x-mu)^2)/2*mu^2*x ) +@end ifnottex + +@item constant: +@iftex +@tex +$1$ +@end tex +@end iftex +@ifnottex +1 +@end ifnottex + +@item CDF: +@iftex +@tex +not implemented! +@end tex +@end iftex +@ifnottex +not implemented! +@end ifnottex + +@item domain: +@iftex +@tex +$0 < x <\infty$ +@end tex +@end iftex +@ifnottex +0 < x 0 $@end tex +@tab +@tab (@i{mean}) +@item @code{[1]} +@tab@tex$\lambda $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{shape}) +@end multitable +@end iftex +@ifnottex +@item parameters 2 (2): mu, lambda +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab mu @tab > 0 @tab @tab @i{(mean)} +@item @code{[1]} @tab lambda @tab > 0 @tab @tab @i{(shape)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBb94,, [JKBb94: Ch.15; p.259]} +@end ifhtml +@ifnothtml +[JKBb94: Ch.15; p.259] +@end ifnothtml + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node laplace +@subsection @code{laplace} -- Laplace distribution +@anchor{funct:unur_distr_laplace} +@findex unur_distr_laplace + + +@table @i +@item PDF: +@iftex +@tex +$\exp( -|x-\theta| / \phi )$ +@end tex +@end iftex +@ifnottex +exp( -|x-theta| / phi ) +@end ifnottex + +@item constant: +@iftex +@tex +$1/(2 \, \phi)$ +@end tex +@end iftex +@ifnottex +1/(2 * phi) +@end ifnottex + +@item domain: +@iftex +@tex +$-\infty < x <\infty$ +@end tex +@end iftex +@ifnottex +-infinity < x 0 $@end tex +@tab 1 +@tab (@i{scale}) +@end multitable +@end iftex +@ifnottex +@item parameters 0 (2): [ theta [, phi ] ] +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab theta @tab @tab 0 @tab @i{(location)} +@item @code{[1]} @tab phi @tab > 0 @tab 1 @tab @i{(scale)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBc95,, [JKBc95: Ch.24; p.164]} +@end ifhtml +@ifnothtml +[JKBc95: Ch.24; p.164] +@end ifnothtml + +@item special generators: +@table @code +@item INV +Inversion method +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node logistic +@subsection @code{logistic} -- Logistic distribution +@anchor{funct:unur_distr_logistic} +@findex unur_distr_logistic + + +@table @i +@item PDF: +@iftex +@tex +$\exp(-{x-\alpha\over \beta}) \, (1 + \exp(-{x-\alpha\over \beta}))^{-2}$ +@end tex +@end iftex +@ifnottex +exp(-(x-alpha)/beta) * (1 + exp(-(x-alpha)/beta))^(-2) +@end ifnottex + +@item constant: +@iftex +@tex +$1/\beta$ +@end tex +@end iftex +@ifnottex +1/beta +@end ifnottex + +@item domain: +@iftex +@tex +$-\infty < x <\infty$ +@end tex +@end iftex +@ifnottex +-infinity < x 0 $@end tex +@tab 1 +@tab (@i{scale}) +@end multitable +@end iftex +@ifnottex +@item parameters 0 (2): [ alpha [, beta ] ] +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab alpha @tab @tab 0 @tab @i{(location)} +@item @code{[1]} @tab beta @tab > 0 @tab 1 @tab @i{(scale)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBc95,, [JKBc95: Ch.23; p.115]} +@end ifhtml +@ifnothtml +[JKBc95: Ch.23; p.115] +@end ifnothtml + +@item special generators: +@table @code +@item INV +Inversion method +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node lognormal +@subsection @code{lognormal} -- Log-Normal distribution +@anchor{funct:unur_distr_lognormal} +@findex unur_distr_lognormal + + +@table @i +@item PDF: +@iftex +@tex +$1/(x-\theta) \, \exp( -(\log(x-\theta)-\zeta)^2/(2 \sigma^2) )$ +@end tex +@end iftex +@ifnottex +1/(x-theta) * exp( -(log(x-theta)-zeta)^2/(2 sigma^2) ) +@end ifnottex + +@item constant: +@iftex +@tex +$1/(\sigma \, \sqrt{2 \pi})$ +@end tex +@end iftex +@ifnottex +1/(sigma * sqrt(2 pi)) +@end ifnottex + +@item domain: +@iftex +@tex +$\theta \leq x < \infty$ +@end tex +@end iftex +@ifnottex +theta <= x < infinity +@end ifnottex + +@iftex +@item parameters 2 (3): @r{ zeta, sigma [, theta ]} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$\zeta $@end tex +@tab@tex$ $@end tex +@tab +@tab (@i{shape}) +@item @code{[1]} +@tab@tex$\sigma $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{shape}) +@item @code{[2]} +@tab@tex$\theta $@end tex +@tab@tex$ $@end tex +@tab 0 +@tab (@i{location}) +@end multitable +@end iftex +@ifnottex +@item parameters 2 (3): zeta, sigma [, theta ] +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab zeta @tab @tab @tab @i{(shape)} +@item @code{[1]} @tab sigma @tab > 0 @tab @tab @i{(shape)} +@item @code{[2]} @tab theta @tab @tab 0 @tab @i{(location)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBb94,, [JKBb94: Ch.14; p. 208]} +@end ifhtml +@ifnothtml +[JKBb94: Ch.14; p. 208] +@end ifnothtml + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node lomax +@subsection @code{lomax} -- Lomax distribution (Pareto distribution of second kind) +@anchor{funct:unur_distr_lomax} +@findex unur_distr_lomax + + +@table @i +@item PDF: +@iftex +@tex +$(x+C)^{-(a+1)}$ +@end tex +@end iftex +@ifnottex +(x+C)^(-(a+1)) +@end ifnottex + +@item constant: +@iftex +@tex +$a \, C^a$ +@end tex +@end iftex +@ifnottex +a * C^a +@end ifnottex + +@item domain: +@iftex +@tex +$0 \leq x < \infty$ +@end tex +@end iftex +@ifnottex +0 <= x < infinity +@end ifnottex + +@iftex +@item parameters 1 (2): @r{ a [, C ]} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$a $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{shape}) +@item @code{[1]} +@tab@tex$C $@end tex +@tab@tex$> 0 $@end tex +@tab 1 +@tab (@i{scale}) +@end multitable +@end iftex +@ifnottex +@item parameters 1 (2): a [, C ] +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab a @tab > 0 @tab @tab @i{(shape)} +@item @code{[1]} @tab C @tab > 0 @tab 1 @tab @i{(scale)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBb94,, [JKBb94: Ch.20; p.575]} +@end ifhtml +@ifnothtml +[JKBb94: Ch.20; p.575] +@end ifnothtml + +@item special generators: +@table @code +@item INV +Inversion method +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node normal +@subsection @code{normal} -- Normal distribution +@anchor{funct:unur_distr_normal} +@findex unur_distr_normal + + +@table @i +@item PDF: +@iftex +@tex +$\exp( -{1\over 2} \, ({x-\mu\over \sigma})^2 )$ +@end tex +@end iftex +@ifnottex +exp( -1/2 * ((x-mu)/sigma)^2 ) +@end ifnottex + +@item constant: +@iftex +@tex +$1 / (\sigma \, \sqrt{2 \pi})$ +@end tex +@end iftex +@ifnottex +1 / (sigma * sqrt(2 pi)) +@end ifnottex + +@item domain: +@iftex +@tex +$-\infty < x < \infty$ +@end tex +@end iftex +@ifnottex +-infinity < x < infinity +@end ifnottex + +@iftex +@item parameters 0 (2): @r{ [ mu [, sigma ] ]} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$\mu $@end tex +@tab@tex$ $@end tex +@tab 0 +@tab (@i{location}) +@item @code{[1]} +@tab@tex$\sigma $@end tex +@tab@tex$> 0 $@end tex +@tab 1 +@tab (@i{scale}) +@end multitable +@end iftex +@ifnottex +@item parameters 0 (2): [ mu [, sigma ] ] +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab mu @tab @tab 0 @tab @i{(location)} +@item @code{[1]} @tab sigma @tab > 0 @tab 1 @tab @i{(scale)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBb94,, [JKBb94: Ch.13; p.80]} +@end ifhtml +@ifnothtml +[JKBb94: Ch.13; p.80] +@end ifnothtml + +@item special generators: +@table @code +@item DEF +@iftex +ACR method (Acceptance-Complement Ratio) [HDa90] +@end iftex +@ifhtml +ACR method (Acceptance-Complement Ratio) @ref{bib:HDa90, [HDa90]} +@end ifhtml +@ifinfo +ACR method (Acceptance-Complement Ratio) [HDa90] +@end ifinfo +@item 1 +@iftex +Box-Muller method [BMa58] +@end iftex +@ifhtml +Box-Muller method @ref{bib:BMa58, [BMa58]} +@end ifhtml +@ifinfo +Box-Muller method [BMa58] +@end ifinfo +@item 2 +@iftex +Polar method with rejection [MGa62] +@end iftex +@ifhtml +Polar method with rejection @ref{bib:MGa62, [MGa62]} +@end ifhtml +@ifinfo +Polar method with rejection [MGa62] +@end ifinfo +@item 3 +@iftex +Kindermann-Ramage method [KRa76] +@end iftex +@ifhtml +Kindermann-Ramage method @ref{bib:KRa76, [KRa76]} +@end ifhtml +@ifinfo +Kindermann-Ramage method [KRa76] +@end ifinfo +@item INV +Inversion method (slow) +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node pareto +@subsection @code{pareto} -- Pareto distribution (of first kind) +@anchor{funct:unur_distr_pareto} +@findex unur_distr_pareto + + +@table @i +@item PDF: +@iftex +@tex +$x^{-(a+1)}$ +@end tex +@end iftex +@ifnottex +x^(-(a+1)) +@end ifnottex + +@item constant: +@iftex +@tex +$a \, k^a$ +@end tex +@end iftex +@ifnottex +a * k^a +@end ifnottex + +@item domain: +@iftex +@tex +$k < x < \infty$ +@end tex +@end iftex +@ifnottex +k < x < infinity +@end ifnottex + +@iftex +@item parameters 2 (2): @r{ k, a} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$k $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{shape, location}) +@item @code{[1]} +@tab@tex$a $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{shape}) +@end multitable +@end iftex +@ifnottex +@item parameters 2 (2): k, a +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab k @tab > 0 @tab @tab @i{(shape, location)} +@item @code{[1]} @tab a @tab > 0 @tab @tab @i{(shape)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBb94,, [JKBb94: Ch.20; p.574]} +@end ifhtml +@ifnothtml +[JKBb94: Ch.20; p.574] +@end ifnothtml + +@item special generators: +@table @code +@item INV +Inversion method +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node powerexponential +@subsection @code{powerexponential} -- Powerexponential (Subbotin) distribution +@anchor{funct:unur_distr_powerexponential} +@findex unur_distr_powerexponential + + +@table @i +@item PDF: +@iftex +@tex +$\exp( -|x|^\tau )$ +@end tex +@end iftex +@ifnottex +exp( -|x|^tau ) +@end ifnottex + +@item constant: +@iftex +@tex +$1 / (2 \, \Gamma(1+1/\tau))$ +@end tex +@end iftex +@ifnottex +1 / (2 * Gamma(1+1/tau)) +@end ifnottex + +@item domain: +@iftex +@tex +$-\infty < x < \infty$ +@end tex +@end iftex +@ifnottex +-infinity < x < infinity +@end ifnottex + +@iftex +@item parameters 1 (1): @r{ tau} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$\tau $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{shape}) +@end multitable +@end iftex +@ifnottex +@item parameters 1 (1): tau +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab tau @tab > 0 @tab @tab @i{(shape)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBc95,, [JKBc95: Ch.24; p.195]} +@end ifhtml +@ifnothtml +[JKBc95: Ch.24; p.195] +@end ifnothtml + +@item special generators: +@table @code +@item DEF +@iftex +Transformed density rejection (only for +@tex $\tau \geq 1$ +@end tex +) [DLa86] +@end iftex +@ifhtml +Transformed density rejection (only for tau >= 1) @ref{bib:DLa86, [DLa86]} +@end ifhtml +@ifinfo +Transformed density rejection (only for tau >= 1) [DLa86] +@end ifinfo +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node rayleigh +@subsection @code{rayleigh} -- Rayleigh distribution +@anchor{funct:unur_distr_rayleigh} +@findex unur_distr_rayleigh + + +@table @i +@item PDF: +@iftex +@tex +$x \, \exp( -1/2 \, ({x\over \sigma})^2 )$ +@end tex +@end iftex +@ifnottex +x * exp( -1/2 * (x/sigma)^2 ) +@end ifnottex + +@item constant: +@iftex +@tex +$1 / \sigma^2$ +@end tex +@end iftex +@ifnottex +1 / sigma^2 +@end ifnottex + +@item domain: +@iftex +@tex +$0 \leq x < \infty$ +@end tex +@end iftex +@ifnottex +0 <= x < infinity +@end ifnottex + +@iftex +@item parameters 1 (1): @r{ sigma} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$\sigma $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{scale}) +@end multitable +@end iftex +@ifnottex +@item parameters 1 (1): sigma +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab sigma @tab > 0 @tab @tab @i{(scale)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBb94,, [JKBb94: Ch.18; p.456]} +@end ifhtml +@ifnothtml +[JKBb94: Ch.18; p.456] +@end ifnothtml + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node slash +@subsection @code{slash} -- Slash distribution +@anchor{funct:unur_distr_slash} +@findex unur_distr_slash + + +@table @i +@item PDF: +@iftex +@tex +$(1 - \exp(-x^2/2)) / x^2$ +@end tex +@end iftex +@ifnottex +(1 - exp(-x^2/2)) / x^2 +@end ifnottex + +@item constant: +@iftex +@tex +$1 / \sqrt{2 \pi}$ +@end tex +@end iftex +@ifnottex +1 / sqrt(2 pi) +@end ifnottex + +@item CDF: +@iftex +@tex +not implemented! +@end tex +@end iftex +@ifnottex +not implemented! +@end ifnottex + +@item domain: +@iftex +@tex +$-\infty < x < \infty$ +@end tex +@end iftex +@ifnottex +-infinity < x < infinity +@end ifnottex + +@item reference: +@ifhtml +@ref{bib:JKBb94,, [JKBb94: Ch.12; p.63]} +@end ifhtml +@ifnothtml +[JKBb94: Ch.12; p.63] +@end ifnothtml + +@item special generators: +@table @code +@item DEF +Ratio of normal and uniform random variates +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node student +@subsection @code{student} -- Student's t distribution +@anchor{funct:unur_distr_student} +@findex unur_distr_student + + +@table @i +@item PDF: +@iftex +@tex +$(1+{t^2\over \nu})^{-(\nu+1)/2}$ +@end tex +@end iftex +@ifnottex +(1+t^2/nu)^(-(nu+1)/2) +@end ifnottex + +@item constant: +@iftex +@tex +$1 / (\sqrt{\nu} \, B(1/2,\nu/2))$ +@end tex +@end iftex +@ifnottex +1 / (sqrt(nu) * B(1/2,nu/2)) +@end ifnottex + +@item CDF: +@iftex +@tex +not implemented! +@end tex +@end iftex +@ifnottex +not implemented! +@end ifnottex + +@item domain: +@iftex +@tex +$-\infty < x < \infty$ +@end tex +@end iftex +@ifnottex +-infinity < x < infinity +@end ifnottex + +@iftex +@item parameters 1 (1): @r{ nu} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$\nu $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{shape}) +@end multitable +@end iftex +@ifnottex +@item parameters 1 (1): nu +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab nu @tab > 0 @tab @tab @i{(shape)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBc95,, [JKBc95: Ch.28; p.362]} +@end ifhtml +@ifnothtml +[JKBc95: Ch.28; p.362] +@end ifnothtml + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node triangular +@subsection @code{triangular} -- Triangular distribution +@anchor{funct:unur_distr_triangular} +@findex unur_distr_triangular + + +@table @i +@item PDF: +@iftex +@tex +$2\, x / H, \hbox{ for } 0 \leq x \leq H \hfill\break 2\, (1-x) / (1-H), \hbox{ for } H \leq x \leq 1$ +@end tex +@end iftex +@ifnottex +2*x / H, for 0 <= x <= H + + 2*(1-x) / (1-H), for H <= x <= 1 +@end ifnottex + +@item constant: +@iftex +@tex +$1$ +@end tex +@end iftex +@ifnottex +1 +@end ifnottex + +@item domain: +@iftex +@tex +$0 \leq x \leq 1$ +@end tex +@end iftex +@ifnottex +0 <= x <= 1 +@end ifnottex + +@iftex +@item parameters 0 (1): @r{ [ H ]} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$H $@end tex +@tab@tex$0 \leq H \leq 1 $@end tex +@tab 1/2 +@tab (@i{shape}) +@end multitable +@end iftex +@ifnottex +@item parameters 0 (1): [ H ] +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab H @tab 0 <= H <= 1 @tab 1/2 @tab @i{(shape)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBc95,, [JKBc95: Ch.26; p.297]} +@end ifhtml +@ifnothtml +[JKBc95: Ch.26; p.297] +@end ifnothtml + +@item special generators: +@table @code +@item INV +Inversion method +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node uniform +@subsection @code{uniform} -- Uniform distribution +@anchor{funct:unur_distr_uniform} +@findex unur_distr_uniform + + +@table @i +@item PDF: +@iftex +@tex +$1 / (b-a)$ +@end tex +@end iftex +@ifnottex +1 / (b-a) +@end ifnottex + +@item constant: +@iftex +@tex +$1$ +@end tex +@end iftex +@ifnottex +1 +@end ifnottex + +@item domain: +@iftex +@tex +$a < x < b$ +@end tex +@end iftex +@ifnottex +a < x < b +@end ifnottex + +@iftex +@item parameters 0 (2): @r{ [ a, b ]} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$a $@end tex +@tab@tex$ $@end tex +@tab 0 +@tab (@i{location}) +@item @code{[1]} +@tab@tex$b $@end tex +@tab@tex$> a $@end tex +@tab 1 +@tab (@i{location}) +@end multitable +@end iftex +@ifnottex +@item parameters 0 (2): [ a, b ] +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab a @tab @tab 0 @tab @i{(location)} +@item @code{[1]} @tab b @tab > a @tab 1 @tab @i{(location)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBc95,, [JKBc95: Ch.26; p.276]} +@end ifhtml +@ifnothtml +[JKBc95: Ch.26; p.276] +@end ifnothtml + +@item special generators: +@table @code +@item INV +Inversion method +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node weibull +@subsection @code{weibull} -- Weibull distribution +@anchor{funct:unur_distr_weibull} +@findex unur_distr_weibull + + +@table @i +@item PDF: +@iftex +@tex +$({x-\zeta\over \alpha})^{c-1} \, \exp( -({x-\zeta\over \alpha})^c )$ +@end tex +@end iftex +@ifnottex +((x-zeta)/alpha)^(c-1) * exp( -((x-zeta)/alpha)^c ) +@end ifnottex + +@item constant: +@iftex +@tex +$c / \alpha$ +@end tex +@end iftex +@ifnottex +c / alpha +@end ifnottex + +@item domain: +@iftex +@tex +$\zeta < x < \infty$ +@end tex +@end iftex +@ifnottex +zeta < x < infinity +@end ifnottex + +@iftex +@item parameters 1 (3): @r{ c [, alpha [, zeta ] ]} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$c $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{shape}) +@item @code{[1]} +@tab@tex$\alpha $@end tex +@tab@tex$> 0 $@end tex +@tab 1 +@tab (@i{scale}) +@item @code{[2]} +@tab@tex$\zeta $@end tex +@tab@tex$ $@end tex +@tab 0 +@tab (@i{location}) +@end multitable +@end iftex +@ifnottex +@item parameters 1 (3): c [, alpha [, zeta ] ] +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab c @tab > 0 @tab @tab @i{(shape)} +@item @code{[1]} @tab alpha @tab > 0 @tab 1 @tab @i{(scale)} +@item @code{[2]} @tab zeta @tab @tab 0 @tab @i{(location)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKBb94,, [JKBb94: Ch.21; p.628]} +@end ifhtml +@ifnothtml +[JKBb94: Ch.21; p.628] +@end ifnothtml + +@item special generators: +@table @code +@item INV +Inversion method +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c stddist.dh +@c + +@page +@node Stddist_CVEC +@section UNU.RAN Library of continuous multivariate distributions + +@menu +* copula:: Copula (distribution with uniform marginals) +* multicauchy:: Multicauchy distribution +* multiexponential:: Multiexponential distribution +* multinormal:: Multinormal distribution +* multistudent:: Multistudent distribution +@end menu + + +@c +@c end of stddist.dh +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node copula +@subsection @code{copula} -- Copula (distribution with uniform marginals) +@anchor{funct:unur_distr_copula} +@findex unur_distr_copula + + +@table @i +@end table + + +@code{UNUR_DISTR *unur_distr_copula(int dim, const double *rankcorr)} +creates a distribution object for a copula with @var{dim} components. +@var{rankcorr} is an array of size @var{dim}x@var{dim} and holds the +rank correlation matrix (Spearman's correlation), where the rows of +the matrix are stored consecutively in this array. The @code{NULL} pointer +can be used instead the identity matrix. + +If @var{covar} is not a valid rank correlation matrix (i.e., not positive +definite) then no distribution object is created and @code{NULL} is returned. + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node multicauchy +@subsection @code{multicauchy} -- Multicauchy distribution +@anchor{funct:unur_distr_multicauchy} +@findex unur_distr_multicauchy + + +@table @i +@item PDF: +@iftex +@tex +$f(x) = 1 / ( 1 + (x-\mu)^t . \Sigma^{-1} . (x-\mu) )^{(dim+1)/2}$ +@end tex +@end iftex +@ifnottex +f(x) = 1 / ( 1 + (x-mu)^t . Sigma^(-1) . (x-mu) )^((dim+1)/2) +@end ifnottex + +@item constant: +@iftex +@tex +$\Gamma((dim+1)/2) / ( \pi^{(dim+1)/2} \, \sqrt{\det(\Sigma)} )$ +@end tex +@end iftex +@ifnottex +Gamma((dim+1)/2) / ( pi^((dim+1)/2) * sqrt(det(Sigma)) ) +@end ifnottex + +@item domain: +@iftex +@tex +$-\infty^{dim} < x < \infty^{dim}$ +@end tex +@end iftex +@ifnottex +-infinity^(dim) < x < infinity^(dim) +@end ifnottex + +@iftex +@item parameters 0 (2): @r{ [ mu, Sigma ]} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$\mu $@end tex +@tab@tex$ $@end tex +@tab (0,@dots{},0) +@tab (@i{location}) +@item @code{[1]} +@tab@tex$\Sigma $@end tex +@tab@tex$Symm, Pos. def. $@end tex +@tab I +@tab (@i{shape}) +@end multitable +@end iftex +@ifnottex +@item parameters 0 (2): [ mu, Sigma ] +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab mu @tab @tab (0,@dots{},0) @tab @i{(location)} +@item @code{[1]} @tab Sigma @tab Symm, Pos. def. @tab I @tab @i{(shape)} +@end multitable +@end ifnottex +@item special generators: +@table @code +@item DEF +Cholesky factor +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node multiexponential +@subsection @code{multiexponential} -- Multiexponential distribution +@anchor{funct:unur_distr_multiexponential} +@findex unur_distr_multiexponential + + +@table @i +@item PDF: +@iftex +@tex +$f(x) = Prod_{i=0}^{i=dim-1} \exp(-(dim-i) (x_{i}-x_{i-1} - (\theta_i-\theta_{i-1}) ) / \sigma_i); with x_{-1}=0 and \theta_{i-1}=0$ +@end tex +@end iftex +@ifnottex +f(x) = Prod_(i=0)^(i=dim-1) exp(-(dim-i) (x_(i)-x_(i-1) - (theta_i-theta_(i-1)) ) / sigma_i); with x_(-1)=0 and theta_(i-1)=0 +@end ifnottex + +@item constant: +@iftex +@tex +$Prod_{i=0}^{i=dim-1} 1/\sigma_i$ +@end tex +@end iftex +@ifnottex +Prod_(i=0)^(i=dim-1) 1/sigma_i +@end ifnottex + +@item domain: +@iftex +@tex +$0^{dim} \leq x < \infty^{dim}$ +@end tex +@end iftex +@ifnottex +0^(dim) <= x < infinity^(dim) +@end ifnottex + +@iftex +@item parameters 0 (2): @r{ [ sigma, theta ]} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$\sigma $@end tex +@tab@tex$ $@end tex +@tab (1,@dots{},1) +@tab (@i{shape}) +@item @code{[1]} +@tab@tex$\theta $@end tex +@tab@tex$ $@end tex +@tab (0,@dots{},0) +@tab (@i{location}) +@end multitable +@end iftex +@ifnottex +@item parameters 0 (2): [ sigma, theta ] +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab sigma @tab @tab (1,@dots{},1) @tab @i{(shape)} +@item @code{[1]} @tab theta @tab @tab (0,@dots{},0) @tab @i{(location)} +@end multitable +@end ifnottex +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node multinormal +@subsection @code{multinormal} -- Multinormal distribution +@anchor{funct:unur_distr_multinormal} +@findex unur_distr_multinormal + + +@table @i +@item PDF: +@iftex +@tex +$f(x) = \exp( -1/2 \, (x-\mu)^t . \Sigma^{-1} . (x-\mu) )$ +@end tex +@end iftex +@ifnottex +f(x) = exp( -1/2 * (x-mu)^t . Sigma^(-1) . (x-mu) ) +@end ifnottex + +@item constant: +@iftex +@tex +$1 / ( (2 \pi)^{dim/2} \, \sqrt{\det(\Sigma)} )$ +@end tex +@end iftex +@ifnottex +1 / ( (2 pi)^(dim/2) * sqrt(det(Sigma)) ) +@end ifnottex + +@item domain: +@iftex +@tex +$-\infty^{dim} < x < \infty^{dim}$ +@end tex +@end iftex +@ifnottex +-infinity^(dim) < x < infinity^(dim) +@end ifnottex + +@iftex +@item parameters 0 (2): @r{ [ mu, Sigma ]} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$\mu $@end tex +@tab@tex$ $@end tex +@tab (0,@dots{},0) +@tab (@i{location}) +@item @code{[1]} +@tab@tex$\Sigma $@end tex +@tab@tex$Symm, Pos. def. $@end tex +@tab I +@tab (@i{shape}) +@end multitable +@end iftex +@ifnottex +@item parameters 0 (2): [ mu, Sigma ] +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab mu @tab @tab (0,@dots{},0) @tab @i{(location)} +@item @code{[1]} @tab Sigma @tab Symm, Pos. def. @tab I @tab @i{(shape)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:KBJe00,, [KBJe00: Ch.45; p.105]} +@end ifhtml +@ifnothtml +[KBJe00: Ch.45; p.105] +@end ifnothtml + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node multistudent +@subsection @code{multistudent} -- Multistudent distribution +@anchor{funct:unur_distr_multistudent} +@findex unur_distr_multistudent + + +@table @i +@item PDF: +@iftex +@tex +$f(x) = 1 / ( 1 + (x-\mu)^t . \Sigma^{-1} . (x-\mu) / m)^{(dim+m)/2} )$ +@end tex +@end iftex +@ifnottex +f(x) = 1 / ( 1 + (x-mu)^t . Sigma^(-1) . (x-mu) / m)^((dim+m)/2) ) +@end ifnottex + +@item constant: +@iftex +@tex +$\Gamma((dim+m)/2) / ( \Gamma(m/2) (m\, \pi)^{dim/2} \, \sqrt{\det(\Sigma)} )$ +@end tex +@end iftex +@ifnottex +Gamma((dim+m)/2) / ( Gamma(m/2) (m*pi)^(dim/2) * sqrt(det(Sigma)) ) +@end ifnottex + +@item domain: +@iftex +@tex +$-\infty^{dim} < x < \infty^{dim}$ +@end tex +@end iftex +@ifnottex +-infinity^(dim) < x < infinity^(dim) +@end ifnottex + +@iftex +@item parameters 0 (3): @r{ [ m, mu, Sigma ]} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$m $@end tex +@tab@tex$m>0 $@end tex +@tab 1 +@tab (@i{location}) +@item @code{[1]} +@tab@tex$\mu $@end tex +@tab@tex$ $@end tex +@tab (0,@dots{},0) +@tab (@i{location}) +@item @code{[2]} +@tab@tex$\Sigma $@end tex +@tab@tex$Symm, Pos. def. $@end tex +@tab I +@tab (@i{shape}) +@end multitable +@end iftex +@ifnottex +@item parameters 0 (3): [ m, mu, Sigma ] +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab m @tab m>0 @tab 1 @tab @i{(location)} +@item @code{[1]} @tab mu @tab @tab (0,@dots{},0) @tab @i{(location)} +@item @code{[2]} @tab Sigma @tab Symm, Pos. def. @tab I @tab @i{(shape)} +@end multitable +@end ifnottex +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c stddist.dh +@c + +@page +@node Stddist_DISCR +@section UNU.RAN Library of discrete univariate distributions + +@menu +* binomial:: Binomial distribution +* geometric:: Geometric distribution +* hypergeometric:: Hypergeometric distribution +* logarithmic:: Logarithmic distribution +* negativebinomial:: Negative Binomial distribution +* poisson:: Poisson distribution +@end menu + + +At the moment there are no CDFs implemented for discrete distribution. +Thus +@ifhtml +@ref{funct:unur_distr_discr_upd_pmfsum,@command{unur_distr_discr_upd_pmfsum}} +@end ifhtml +@ifnothtml +@command{unur_distr_discr_upd_pmfsum} +@end ifnothtml +does not work properly for truncated +distribution. + + +@c +@c end of stddist.dh +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node binomial +@subsection @code{binomial} -- Binomial distribution +@anchor{funct:unur_distr_binomial} +@findex unur_distr_binomial + + +@table @i +@item PMF: +@iftex +@tex +${n \choose k} \, p^k \, (1-p)^{n-k}$ +@end tex +@end iftex +@ifnottex +(n \choose k) * p^k * (1-p)^(n-k) +@end ifnottex + +@item constant: +@iftex +@tex +$1$ +@end tex +@end iftex +@ifnottex +1 +@end ifnottex + +@item domain: +@iftex +@tex +$0 \leq k \leq n$ +@end tex +@end iftex +@ifnottex +0 <= k <= n +@end ifnottex + +@iftex +@item parameters 2 (2): @r{ n, p} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$n $@end tex +@tab@tex$\geq 1 $@end tex +@tab +@tab (@i{no. of elements}) +@item @code{[1]} +@tab@tex$p $@end tex +@tab@tex$0 < p < 1 $@end tex +@tab +@tab (@i{shape}) +@end multitable +@end iftex +@ifnottex +@item parameters 2 (2): n, p +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab n @tab >= 1 @tab @tab @i{(no. of elements)} +@item @code{[1]} @tab p @tab 0 < p < 1 @tab @tab @i{(shape)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKKa92,, [JKKa92: Ch.3; p.105]} +@end ifhtml +@ifnothtml +[JKKa92: Ch.3; p.105] +@end ifnothtml + +@item special generators: +@table @code +@item DEF +@iftex +Ratio of Uniforms/Inversion [STa89] +@end iftex +@ifhtml +Ratio of Uniforms/Inversion @ref{bib:STa89, [STa89]} +@end ifhtml +@ifinfo +Ratio of Uniforms/Inversion [STa89] +@end ifinfo +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node geometric +@subsection @code{geometric} -- Geometric distribution +@anchor{funct:unur_distr_geometric} +@findex unur_distr_geometric + + +@table @i +@item PMF: +@iftex +@tex +$p \, (1-p)^k$ +@end tex +@end iftex +@ifnottex +p * (1-p)^k +@end ifnottex + +@item constant: +@iftex +@tex +$1$ +@end tex +@end iftex +@ifnottex +1 +@end ifnottex + +@item domain: +@iftex +@tex +$0 \leq k < \infty$ +@end tex +@end iftex +@ifnottex +0 <= k < infinity +@end ifnottex + +@iftex +@item parameters 1 (1): @r{ p} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$p $@end tex +@tab@tex$0 < p < 1 $@end tex +@tab +@tab (@i{shape}) +@end multitable +@end iftex +@ifnottex +@item parameters 1 (1): p +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab p @tab 0 < p < 1 @tab @tab @i{(shape)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKKa92,, [JKKa92: Ch.5.2; p.201]} +@end ifhtml +@ifnothtml +[JKKa92: Ch.5.2; p.201] +@end ifnothtml + +@item special generators: +@table @code +@item INV +Inversion method +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node hypergeometric +@subsection @code{hypergeometric} -- Hypergeometric distribution +@anchor{funct:unur_distr_hypergeometric} +@findex unur_distr_hypergeometric + + +@table @i +@item PMF: +@iftex +@tex +${M \choose k} \, {N-M \choose n-k} / {N \choose n}$ +@end tex +@end iftex +@ifnottex +(M \choose k) * (N-M \choose n-k) / (N \choose n) +@end ifnottex + +@item constant: +@iftex +@tex +$1$ +@end tex +@end iftex +@ifnottex +1 +@end ifnottex + +@item domain: +@iftex +@tex +$\max(0,n-N+M) \leq k \leq \min(n,M)$ +@end tex +@end iftex +@ifnottex +max(0,n-N+M) <= k <= min(n,M) +@end ifnottex + +@iftex +@item parameters 3 (3): @r{ N, M, n} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$N $@end tex +@tab@tex$\geq 1 $@end tex +@tab +@tab (@i{no. of elements}) +@item @code{[1]} +@tab@tex$M $@end tex +@tab@tex$1 \leq M \leq N $@end tex +@tab +@tab (@i{shape}) +@item @code{[2]} +@tab@tex$n $@end tex +@tab@tex$1 \leq n \leq N $@end tex +@tab +@tab (@i{shape}) +@end multitable +@end iftex +@ifnottex +@item parameters 3 (3): N, M, n +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab N @tab >= 1 @tab @tab @i{(no. of elements)} +@item @code{[1]} @tab M @tab 1 <= M <= N @tab @tab @i{(shape)} +@item @code{[2]} @tab n @tab 1 <= n <= N @tab @tab @i{(shape)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKKa92,, [JKKa92: Ch.6; p.237]} +@end ifhtml +@ifnothtml +[JKKa92: Ch.6; p.237] +@end ifnothtml + +@item special generators: +@table @code +@item DEF +@iftex +Ratio of Uniforms/Inversion [STa89] +@end iftex +@ifhtml +Ratio of Uniforms/Inversion @ref{bib:STa89, [STa89]} +@end ifhtml +@ifinfo +Ratio of Uniforms/Inversion [STa89] +@end ifinfo +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node logarithmic +@subsection @code{logarithmic} -- Logarithmic distribution +@anchor{funct:unur_distr_logarithmic} +@findex unur_distr_logarithmic + + +@table @i +@item PMF: +@iftex +@tex +$\theta^k / k$ +@end tex +@end iftex +@ifnottex +theta^k / k +@end ifnottex + +@item constant: +@iftex +@tex +$- \log( 1.-\theta);$ +@end tex +@end iftex +@ifnottex +- log( 1.-theta); +@end ifnottex + +@item domain: +@iftex +@tex +$1 \leq k < \infty$ +@end tex +@end iftex +@ifnottex +1 <= k < infinity +@end ifnottex + +@iftex +@item parameters 1 (1): @r{ theta} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$\theta $@end tex +@tab@tex$0 < \theta < 1 $@end tex +@tab +@tab (@i{shape}) +@end multitable +@end iftex +@ifnottex +@item parameters 1 (1): theta +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab theta @tab 0 < theta < 1 @tab @tab @i{(shape)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKKa92,, [JKKa92: Ch.7; p.285]} +@end ifhtml +@ifnothtml +[JKKa92: Ch.7; p.285] +@end ifnothtml + +@item special generators: +@table @code +@item DEF +@iftex +Inversion/Transformation [KAa81] +@end iftex +@ifhtml +Inversion/Transformation @ref{bib:KAa81, [KAa81]} +@end ifhtml +@ifinfo +Inversion/Transformation [KAa81] +@end ifinfo +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node negativebinomial +@subsection @code{negativebinomial} -- Negative Binomial distribution +@anchor{funct:unur_distr_negativebinomial} +@findex unur_distr_negativebinomial + + +@table @i +@item PMF: +@iftex +@tex +${k+r-1 \choose r-1} \, p^r \, (1-p)^k$ +@end tex +@end iftex +@ifnottex +(k+r-1 \choose r-1) * p^r * (1-p)^k +@end ifnottex + +@item constant: +@iftex +@tex +$1$ +@end tex +@end iftex +@ifnottex +1 +@end ifnottex + +@item domain: +@iftex +@tex +$0 \leq k < \infty$ +@end tex +@end iftex +@ifnottex +0 <= k < infinity +@end ifnottex + +@iftex +@item parameters 2 (2): @r{ p, r} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$p $@end tex +@tab@tex$0 < p < 1 $@end tex +@tab +@tab (@i{shape}) +@item @code{[1]} +@tab@tex$r $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{shape}) +@end multitable +@end iftex +@ifnottex +@item parameters 2 (2): p, r +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab p @tab 0 < p < 1 @tab @tab @i{(shape)} +@item @code{[1]} @tab r @tab > 0 @tab @tab @i{(shape)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKKa92,, [JKKa92: Ch.5.1; p.200]} +@end ifhtml +@ifnothtml +[JKKa92: Ch.5.1; p.200] +@end ifnothtml + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node poisson +@subsection @code{poisson} -- Poisson distribution +@anchor{funct:unur_distr_poisson} +@findex unur_distr_poisson + + +@table @i +@item PMF: +@iftex +@tex +$\theta^k / k!$ +@end tex +@end iftex +@ifnottex +theta^k / k! +@end ifnottex + +@item constant: +@iftex +@tex +$\exp(\theta)$ +@end tex +@end iftex +@ifnottex +exp(theta) +@end ifnottex + +@item domain: +@iftex +@tex +$0 \leq k < \infty$ +@end tex +@end iftex +@ifnottex +0 <= k < infinity +@end ifnottex + +@iftex +@item parameters 1 (1): @r{ theta} + +@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} +@tab@tex$\theta $@end tex +@tab@tex$> 0 $@end tex +@tab +@tab (@i{shape}) +@end multitable +@end iftex +@ifnottex +@item parameters 1 (1): theta +@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} +@item No. @tab name @tab @tab default +@item @code{[0]} @tab theta @tab > 0 @tab @tab @i{(shape)} +@end multitable +@end ifnottex +@item reference: +@ifhtml +@ref{bib:JKKa92,, [JKKa92: Ch.4; p.151]} +@end ifhtml +@ifnothtml +[JKKa92: Ch.4; p.151] +@end ifnothtml + +@item special generators: +@table @code +@item DEF +@iftex +Tabulated Inversion combined with Acceptance Complement [ADb82] +@end iftex +@ifhtml +Tabulated Inversion combined with Acceptance Complement @ref{bib:ADb82, [ADb82]} +@end ifhtml +@ifinfo +Tabulated Inversion combined with Acceptance Complement [ADb82] +@end ifinfo +@item 2 +@iftex +Tabulated Inversion combined with Patchwork Rejection [ZHa94] +@end iftex +@ifhtml +Tabulated Inversion combined with Patchwork Rejection @ref{bib:ZHa94, [ZHa94]} +@end ifhtml +@ifinfo +Tabulated Inversion combined with Patchwork Rejection [ZHa94] +@end ifinfo +@end table + +@end table + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c stddist.dh +@c + +@page +@node Stddist_MATR +@section UNU.RAN Library of random matrices + +@menu +* correlation:: Random correlation matrix +@end menu + + +@c +@c end of stddist.dh +@c ------------------------------------- +@c ------------------------------------- +@c unur_distributions.h +@c + +@node correlation +@subsection @code{correlation} -- Random correlation matrix +@anchor{funct:unur_distr_correlation} +@findex unur_distr_correlation + + +@table @i +@end table + + +@code{UNUR_DISTR *unur_distr_correlation( int n )} +creates a distribution object for a random correlation matrix of +@var{n} rows and columns. It can be used with method MCORR +(@pxref{MCORR,,Random Correlation Matrix}) to +generate random correlation matrices of the given size. + + + +@c +@c end of unur_distributions.h +@c ------------------------------------- +@c ------------------------------------- +@c error_debug.dh +@c + +@node Error_Debug +@chapter Error handling and Debugging + +@menu +* Output_streams:: Output streams +* Debug:: Debugging +* Error_reporting:: Error reporting +* Errno:: Error codes +* Error_handlers:: Error handlers +@end menu + + +UNU.RAN routines report an error whenever they cannot perform the +requested task. Additionally it is possible to get information +about the generated distribution of generator objects for debugging +purposes. However, the latter must be enabled when compiling and +installing the library. (It is disabled by default.) +This chapter describes all necessary details: + +@itemize +@item Choose an output stream to for writing the requested +information. +@item Select a debugging level. +@item Select an error handler. +@item Write your own error handler. +@item Get more information for a particular error code. +@end itemize + + + +@c +@c end of error_debug.dh +@c ------------------------------------- +@c ------------------------------------- +@c stream.h +@c + +@node Output_streams +@section Output streams + + +@cindex Error handlers +@cindex Output streams + +UNU.RAN uses a logfile for writing all error messages, warnings, +and debugging information onto an output stream. This stream can +be set at runtime by the +@ifhtml +@ref{funct:unur_set_stream,@command{unur_set_stream}} +@end ifhtml +@ifnothtml +@command{unur_set_stream} +@end ifnothtml +call. +If no such stream is given by the user a default stream is used +by the library: all messages are written into the file +@file{unuran.log} in the current working directory. The name of +this logfile is defined by the macro @code{UNUR_LOG_FILE} in +@file{unuran_config.h}. +(If UNU.RAN fails to open this file for writing, @file{stderr} +is used instead.) + +To destinguish between messages for different objects each of +these has its own identifier which is composed by the name of +the distribution obejct and generator type, resp., followed by a +dot and three digits. +(If there are more than 999 generators then the identifiers are +not unique.) + +@emph{Remark:} Writting debugging information must be switched +on at compile time using the configure flag +@code{--enable-logging}, see @ref{Debug,,Debugging}. + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_set_stream,unur_set_stream} +@item @ref{funct:unur_get_stream,unur_get_stream} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_set_stream} +@deftypefn Function {FILE*} unur_set_stream (FILE* @var{new_stream}) +This function sets a new file handler for the output stream, +@var{new_stream}, for the UNU.RAN library routines. The previous +handler is returned (so that you can restore it later). +Note that the pointer to a user defined file handler is stored in a +static variable, so there can be only one output stream handler per +program. This function should be not be used in multi-threaded +programs except to set up a program-wide error handler from a +master thread. + +The @code{NULL} pointer is not allowed. +(If you want to disable logging of debugging information use +unur_set_default_debug(UNUR_DEBUG_OFF) instead. +If you want to disable error messages at all use +@ifhtml +@ref{funct:unur_set_error_handler_off,@command{unur_set_error_handler_off}.} +@end ifhtml +@ifnothtml +@command{unur_set_error_handler_off}. +@end ifnothtml +) +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_set_stream} +@deftypefn {} {FILE*} unur_set_stream (FILE* @var{new_stream}) +This function sets a new file handler for the output stream, +@var{new_stream}, for the UNU.RAN library routines. The previous +handler is returned (so that you can restore it later). +Note that the pointer to a user defined file handler is stored in a +static variable, so there can be only one output stream handler per +program. This function should be not be used in multi-threaded +programs except to set up a program-wide error handler from a +master thread. + +The @code{NULL} pointer is not allowed. +(If you want to disable logging of debugging information use +unur_set_default_debug(UNUR_DEBUG_OFF) instead. +If you want to disable error messages at all use +@ifhtml +@ref{funct:unur_set_error_handler_off,@command{unur_set_error_handler_off}.} +@end ifhtml +@ifnothtml +@command{unur_set_error_handler_off}. +@end ifnothtml +) +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_get_stream} +@deftypefn Function {FILE*} unur_get_stream (void) +Get the file handle for the current output stream. It can be used to +allow applications to write additional information into the logfile. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_get_stream} +@deftypefn {} {FILE*} unur_get_stream (void) +Get the file handle for the current output stream. It can be used to +allow applications to write additional information into the logfile. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of stream.h +@c ------------------------------------- +@c ------------------------------------- +@c debug.h +@c + +@node Debug +@section Debugging + + +The UNU.RAN library has several debugging levels which +can be switched on/off by debugging flags. This debugging +feature must be enabled when building the library using the +@code{--enable-logging} configure flag. + +The debugging levels range from print a short description of the +created generator object to a detailed description of hat +functions and tracing the sampling routines. The output is printed +onto the debugging output stream +(@pxref{Output_streams,,Output streams}). + +The debugging flags can be set or changed by the respective calls +@ifhtml +@ref{funct:unur_set_debug,@command{unur_set_debug}} +@end ifhtml +@ifnothtml +@command{unur_set_debug} +@end ifnothtml +and +@ifhtml +@ref{funct:unur_chg_debug,@command{unur_chg_debug}} +@end ifhtml +@ifnothtml +@command{unur_chg_debug} +@end ifnothtml +independently for each +generator. + +By default flag @code{UNUR_DEBUG_INIT} (see +below) is used. This default flags is set by the macro +@code{UNUR_DEBUGFLAG_DEFAULT} in @file{unuran_config.h} and can +be changed at runtime by a +@ifhtml +@ref{funct:unur_set_default_debug,@command{unur_set_default_debug}} +@end ifhtml +@ifnothtml +@command{unur_set_default_debug} +@end ifnothtml +call. + +Off course these debugging flags +depend on the chosen method. Since most of these are merely for +debugging the library itself, a description of the flags are given +in the corresponding source files of the method. +Nevertheless, the following flags can be used with all methods. + +Common debug flags: + +@ftable @code +@item UNUR_DEBUG_OFF +@findex UNUR_DEBUG_OFF +switch off all debuging information +@item UNUR_DEBUG_ALL +@findex UNUR_DEBUG_ALL +all avaivable information +@item UNUR_DEBUG_INIT +@findex UNUR_DEBUG_INIT +parameters of generator object after initialization +@item UNUR_DEBUG_SETUP +@findex UNUR_DEBUG_SETUP +data created at setup +@item UNUR_DEBUG_ADAPT +@findex UNUR_DEBUG_ADAPT +data created during adaptive steps +@item UNUR_DEBUG_SAMPLE +@findex UNUR_DEBUG_SAMPLE +trace sampling +@end ftable + +Notice that these are flags which could be combined using the +@code{|} operator. + +Almost all routines check a given pointer before they read from or write +to the given address. This does not hold for time-critical routines +like all sampling routines. Thus you are responsible for checking a +pointer that is returned from a +@ifhtml +@ref{funct:unur_init,@command{unur_init}} +@end ifhtml +@ifnothtml +@command{unur_init} +@end ifnothtml +call. +However, it is possible to turn on checking for invalid @code{NULL} pointers +even in such time-critical routines by building the library +using the @code{--enable-check-struct} configure flag. + +Another debugging tool used in the library are magic cookies that +validate a given pointer. It produces an error whenever a given +pointer points to an object that is invalid in the context. +The usage of magic cookies is also switched on by the +@code{--enable-check-struct} configure flag. + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_set_debug,unur_set_debug} +@item @ref{funct:unur_chg_debug,unur_chg_debug} +@item @ref{funct:unur_set_default_debug,unur_set_default_debug} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_set_debug} +@deftypefn Function {int} unur_set_debug (UNUR_PAR* @var{parameters}, unsigned @var{debug}) +Set debugging flags for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_set_debug} +@deftypefn {} {int} unur_set_debug (UNUR_PAR* @var{parameters}, unsigned @var{debug}) +Set debugging flags for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_chg_debug} +@deftypefn Function {int} unur_chg_debug (UNUR_GEN* @var{generator}, unsigned @var{debug}) +Change debugging flags for generator. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_chg_debug} +@deftypefn {} {int} unur_chg_debug (UNUR_GEN* @var{generator}, unsigned @var{debug}) +Change debugging flags for generator. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_set_default_debug} +@deftypefn Function {int} unur_set_default_debug (unsigned @var{debug}) +Change default debugging flag. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_set_default_debug} +@deftypefn {} {int} unur_set_default_debug (unsigned @var{debug}) +Change default debugging flag. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of debug.h +@c ------------------------------------- +@c ------------------------------------- +@c error.h +@c + +@node Error_reporting +@section Error reporting + + +UNU.RAN routines report an error whenever they cannot perform the +requested task. For example, applying transformed density +rejection to a distribution that violates the T-concavity +condition, or trying to set a parameter that is out of range, +result in an error message. +It might also happen that the setup fails for transformed density +rejection for a T-concave distribution with some extreme density +function simply because of round-off errors that makes the +generation of a hat function numerically impossible. +Situations like this may happen when using black box algorithms and +you should check the return values of all routines. + +All @command{..._set_...}, and @command{..._chg_...} calls +return @code{UNUR_SUCCESS} if they could be executed +successfully. Otherwise, some error codes are returned if it was +not possible to set or change the desired parameters, +e.g. because the given values are out of range, or simply +because the set call does not work for the chosen method. + +All routines that return a pointer to the requested object will +return a @code{NULL} pointer in case of error. +(Thus you should always check the pointer to avoid possible +segmentation faults. Sampling routines usually do not check the +given pointer to the generator object.) + +The library distinguishes between two major classes of error: + +@table @emph + +@item (fatal) errors: +The library was not able to construct the +requested object. + +@item warnings: +Some problems encounters while constructing a generator +object. The routine has tried to solve the problem but the resulting +object might not be what you want. For example, chosing a special +variant of a method does not work and the initialization routine +might switch to another variant. Then the generator produces random +variates of the requested distribution but correlation induction +is not possible. However, it also might happen that +changing the domain of a distribution has failed. Then the generator +produced random variates with too large/too small range, i.e. their +distribution is not correct. +@end table + +It is obvious from the example that this distinction between errors +and warning is rather crude and sometimes arbitrary. + +UNU.RAN routines use the global variable @var{unur_errno} to +report errors, completely analogously to @var{errno} in the ANSI +C standard library. +(However this approach is not thread-safe. There can +be only one instance of a global variable per program. Different +threads of execution may overwrite @var{unur_errno} +simultaneously). +Thus when an error occurs the caller of the routine can examine the +error code in @var{unur_errno} to get more details about the +reason why a routine failed. You get a short +description of the error by a +@ifhtml +@ref{funct:unur_get_strerror,@command{unur_get_strerror}} +@end ifhtml +@ifnothtml +@command{unur_get_strerror} +@end ifnothtml +call. +All the error code numbers have prefix @code{UNUR_ERR_} and expand +to non-zero constant unsigned integer values. +Error codes are divided into six main groups, +see @ref{Errno,,Error codes}. + +Alternatively, the variable @var{unur_errno} can also read by a +@ifhtml +@ref{funct:unur_get_errno,@command{unur_get_errno}} +@end ifhtml +@ifnothtml +@command{unur_get_errno} +@end ifnothtml +call and can be reset by the +@ifhtml +@ref{funct:unur_reset_errno,@command{unur_reset_errno}} +@end ifhtml +@ifnothtml +@command{unur_reset_errno} +@end ifnothtml +call (this is in particular required for the Windows version of the +library). + +Additionally, there exists a error handler +(@pxref{Error_handlers,,Error handlers}) that is invoked in case +of an error. + + +In addition to reporting errors by setting error codes in +@var{unur_errno}, the library also has an error handler +function. This function is called by other library functions +when they report an error, just before they return to the +caller (@pxref{Error_handlers,,Error handlers}). +The default behavior of the error handler is to print a short +message: + +@example +AROU.004: [error] arou.c:1500 - (generator) condition for method violated: +AROU.004: ..> PDF not unimodal +@end example + +The purpose of the error handler is to provide a function +where a breakpoint can be set that will catch library errors when +running under the debugger. It is not intended for use in production +programs, which should handle any errors using the return codes. + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{var:unur_errno,unur_errno} +@item @ref{funct:unur_get_errno,unur_get_errno} +@item @ref{funct:unur_reset_errno,unur_reset_errno} +@item @ref{funct:unur_get_strerror,unur_get_strerror} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{var:unur_errno} +@deftypevar {extern int} unur_errno +@findex unur_errno +Global variable for reporting diagnostics of error. +@end deftypevar +@end ifinfo +@ifnotinfo +@anchor{var:unur_errno} +@deftypevar {extern int} unur_errno +@findex unur_errno +Global variable for reporting diagnostics of error. +@end deftypevar +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_get_errno} +@deftypefn Function {int} unur_get_errno (void) +Get current value of global variable @var{unur_errno}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_get_errno} +@deftypefn {} {int} unur_get_errno (void) +Get current value of global variable @var{unur_errno}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_reset_errno} +@deftypefn Function {void} unur_reset_errno (void) +Reset global variable @var{unur_errno} to @code{UNUR_SUCCESS} +(i.e., no errors occured). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_reset_errno} +@deftypefn {} {void} unur_reset_errno (void) +Reset global variable @var{unur_errno} to @code{UNUR_SUCCESS} +(i.e., no errors occured). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_get_strerror} +@deftypefn Function {const char*} unur_get_strerror (const @var{int errnocode}) +Get a short description for error code value. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_get_strerror} +@deftypefn {} {const char*} unur_get_strerror (const @var{int errnocode}) +Get a short description for error code value. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of error.h +@c ------------------------------------- +@c ------------------------------------- +@c unur_errno.h +@c + +@node Errno +@section Error codes + + + +@subsubheading List of error codes + +@itemize @bullet +@item Procedure executed successfully (no error) +@ftable @code +@item UNUR_SUCCESS (0x0u) +success (no error) +@end ftable + +@item Errors that occurred while handling distribution objects. +@ftable @code +@item UNUR_ERR_DISTR_SET +set failed (invalid parameter). +@item UNUR_ERR_DISTR_GET +get failed (parameter not set). +@item UNUR_ERR_DISTR_NPARAMS +invalid number of parameters. +@item UNUR_ERR_DISTR_DOMAIN +parameter(s) out of domain. +@item UNUR_ERR_DISTR_GEN +invalid variant for special generator. +@item UNUR_ERR_DISTR_REQUIRED +incomplete distribution object, entry missing. +@item UNUR_ERR_DISTR_UNKNOWN +unknown distribution, cannot handle. +@item UNUR_ERR_DISTR_INVALID +invalid distribution object. +@item UNUR_ERR_DISTR_DATA +data are missing. +@item UNUR_ERR_DISTR_PROP +desired property does not exist +@end ftable + +@item Errors that occurred while handling parameter objects. +@ftable @code +@item UNUR_ERR_PAR_SET +set failed (invalid parameter) +@item UNUR_ERR_PAR_VARIANT +invalid variant -> using default +@item UNUR_ERR_PAR_INVALID +invalid parameter object +@end ftable + +@item Errors that occurred while handling generator objects. +@ftable @code +@item UNUR_ERR_GEN +error with generator object. +@item UNUR_ERR_GEN_DATA +(possibly) invalid data. +@item UNUR_ERR_GEN_CONDITION +condition for method violated. +@item UNUR_ERR_GEN_INVALID +invalid generator object. +@item UNUR_ERR_GEN_SAMPLING +sampling error. +@item UNUR_ERR_NO_REINIT +reinit routine not implemented. +@item UNUR_ERR_NO_QUANTILE +quantile routine not implemented. +@end ftable + +@item Errors that occurred while handling URNG objects. +@ftable @code +@item UNUR_ERR_URNG +generic error with URNG object. +@item UNUR_ERR_URNG_MISS +missing functionality. +@end ftable + +@item Errors that occurred while parsing strings. +@ftable @code +@item UNUR_ERR_STR +error in string. +@item UNUR_ERR_STR_UNKNOWN +unknown keyword. +@item UNUR_ERR_STR_SYNTAX +syntax error. +@item UNUR_ERR_STR_INVALID +invalid parameter. +@item UNUR_ERR_FSTR_SYNTAX +syntax error in function string. +@item UNUR_ERR_FSTR_DERIV +cannot derivate function. +@end ftable + +@item Other run time errors. +@ftable @code +@item UNUR_ERR_DOMAIN +argument out of domain. +@item UNUR_ERR_ROUNDOFF +(serious) round-off error. +@item UNUR_ERR_MALLOC +virtual memory exhausted. +@item UNUR_ERR_NULL +invalid @code{NULL} pointer. +@item UNUR_ERR_COOKIE +invalid cookie. +@item UNUR_ERR_GENERIC +generic error. +@item UNUR_ERR_SILENT +silent error (no error message). +@item UNUR_ERR_INF +infinity occured. +@item UNUR_ERR_NAN +NaN occured. +@item UNUR_ERR_COMPILE +Requested routine requires different compilation switches. +Recompilation of library necessary. +@item UNUR_ERR_SHOULD_NOT_HAPPEN +Internal error, that should not happen. +Please report this bug! +@end ftable + +@end itemize + + +@c +@c end of unur_errno.h +@c ------------------------------------- +@c ------------------------------------- +@c error.h +@c + +@node Error_handlers +@section Error handlers + + +The default behavior of the UNU.RAN error handler is to print a +short message onto the output stream, usually a logfile +(@pxref{Output_streams,,Output streams}), e.g., + +@example +AROU.004: [error] arou.c:1500 - (generator) condition for method violated: +AROU.004: ..> PDF not unimodal +@end example + +This error handler can be switched off using the +@ifhtml +@ref{funct:unur_set_error_handler_off,@command{unur_set_error_handler_off}} +@end ifhtml +@ifnothtml +@command{unur_set_error_handler_off} +@end ifnothtml +call, or replace it by a new one. +Thus it allows to set a breakpoint that will catch library errors when +running under the debugger. It also can be used to redirect +error messages when UNU.RAN is included in general purpose +libraries or in interactive programming environments. + +@deftp {Data Type} UNUR_ERROR_HANDLER + +This is the type of UNU.RAN error handler functions. An error +handler will be passed six arguments which specify +the identifier of the object where the error occured (a string), +the name of the source file in which it occurred (also a string), +the line number in that file (an integer), +the type of error (a string: @code{"error"} or @code{"warning"}), +the error number (an integert), and +the reason for the error (a string). +The source file and line number are set at compile time +using the @code{__FILE__} and @code{__LINE__} directives in the +preprocessor. +The error number can be translated into a short description +using a +@ifhtml +@ref{funct:unur_get_strerror,@command{unur_get_strerror}} +@end ifhtml +@ifnothtml +@command{unur_get_strerror} +@end ifnothtml +call. +An error handler function returns type @code{void}. + +Error handler functions should be defined like this, +@example +void my_handler( +@ @ @ @ @ @ @ @ @ @ @ const char *objid, +@ @ @ @ @ @ @ @ @ @ @ const char *file, +@ @ @ @ @ @ @ @ @ @ @ int line, +@ @ @ @ @ @ @ @ @ @ @ const char *errortype, +@ @ @ @ @ @ @ @ @ @ @ int unur_errno, +@ @ @ @ @ @ @ @ @ @ @ const char *reason ) +@end example +@end deftp + +To request the use of your own error handler you need the call +@ifhtml +@ref{funct:unur_set_error_handler,@command{unur_set_error_handler}.} +@end ifhtml +@ifnothtml +@command{unur_set_error_handler}. +@end ifnothtml + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_set_error_handler,unur_set_error_handler} +@item @ref{funct:unur_set_error_handler_off,unur_set_error_handler_off} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_set_error_handler} +@deftypefn Function {UNUR_ERROR_HANDLER*} unur_set_error_handler (UNUR_ERROR_HANDLER* @var{new_handler}) +This function sets a new error handler, @var{new_handler}, for the +UNU.RAN library routines. The previous handler is returned (so that you +can restore it later). Note that the pointer to a user defined +error handler function is stored in a static variable, so there +can be only one error handler per program. This function should +be not be used in multi-threaded programs except to set up a +program-wide error handler from a master thread. + +To use the default behavior set the error handler to @code{NULL}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_set_error_handler} +@deftypefn {} {UNUR_ERROR_HANDLER*} unur_set_error_handler (UNUR_ERROR_HANDLER* @var{new_handler}) +This function sets a new error handler, @var{new_handler}, for the +UNU.RAN library routines. The previous handler is returned (so that you +can restore it later). Note that the pointer to a user defined +error handler function is stored in a static variable, so there +can be only one error handler per program. This function should +be not be used in multi-threaded programs except to set up a +program-wide error handler from a master thread. + +To use the default behavior set the error handler to @code{NULL}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_set_error_handler_off} +@deftypefn Function {UNUR_ERROR_HANDLER*} unur_set_error_handler_off (void) +This function turns off the error handler by defining an error +handler which does nothing (except of setting @var{unur_errno}. +The previous handler is returned (so that you can restore it later). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_set_error_handler_off} +@deftypefn {} {UNUR_ERROR_HANDLER*} unur_set_error_handler_off (void) +This function turns off the error handler by defining an error +handler which does nothing (except of setting @var{unur_errno}. +The previous handler is returned (so that you can restore it later). +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of error.h +@c ------------------------------------- +@c ------------------------------------- +@c unuran_tests.h +@c + +@node Testing +@chapter Testing + + +The following routines can be used to test the performance of the +implemented generators and can be used to verify the implementions. +They are declared in @file{unuran_tests.h} which has to be included. + + +@subheading Function reference + +@ifhtml +@itemize +@item @ref{funct:unur_run_tests,unur_run_tests} +@item @ref{funct:unur_test_printsample,unur_test_printsample} +@item @ref{funct:unur_test_timing,unur_test_timing} +@item @ref{funct:unur_test_timing_R,unur_test_timing_R} +@item @ref{funct:unur_test_timing_uniform,unur_test_timing_uniform} +@item @ref{funct:unur_test_timing_exponential,unur_test_timing_exponential} +@item @ref{funct:unur_test_timing_total,unur_test_timing_total} +@item @ref{funct:unur_test_count_urn,unur_test_count_urn} +@item @ref{funct:unur_test_count_pdf,unur_test_count_pdf} +@item @ref{funct:unur_test_par_count_pdf,unur_test_par_count_pdf} +@item @ref{funct:unur_test_chi2,unur_test_chi2} +@item @ref{funct:unur_test_moments,unur_test_moments} +@item @ref{funct:unur_test_correlation,unur_test_correlation} +@item @ref{funct:unur_test_quartiles,unur_test_quartiles} +@item @ref{funct:unur_test_u_error,unur_test_u_error} +@end itemize +@end ifhtml + + +@ifinfo +@anchor{funct:unur_run_tests} +@deftypefn Function {void} unur_run_tests (UNUR_PAR* @var{parameters}, unsigned @var{tests}, FILE* @var{out}) +Run a battery of tests. +The following tests are available (use @code{|} to combine these +tests): +@table @code +@item UNUR_TEST_ALL +run all possible tests. +@item UNUR_TEST_TIME +estimate generation times. +@item UNUR_TEST_N_URNG +count number of uniform random numbers +@item UNUR_TEST_N_PDF +count number of PDF calls +@item UNUR_TEST_CHI2 +run chi^2 test for goodness of fit +@item UNUR_TEST_SAMPLE +print a small sample. +@end table +All these tests can be started individually (see below). +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_run_tests} +@deftypefn {} {void} unur_run_tests (UNUR_PAR* @var{parameters}, unsigned @var{tests}, FILE* @var{out}) +Run a battery of tests. +The following tests are available (use @code{|} to combine these +tests): +@table @code +@item UNUR_TEST_ALL +run all possible tests. +@item UNUR_TEST_TIME +estimate generation times. +@item UNUR_TEST_N_URNG +count number of uniform random numbers +@item UNUR_TEST_N_PDF +count number of PDF calls +@item UNUR_TEST_CHI2 +run chi^2 test for goodness of fit +@item UNUR_TEST_SAMPLE +print a small sample. +@end table +All these tests can be started individually (see below). +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_test_printsample} +@deftypefn Function {void} unur_test_printsample (UNUR_GEN* @var{generator}, int @var{n_rows}, int @var{n_cols}, FILE* @var{out}) +Print a small sample with @var{n_rows} rows and @var{n_cols} columns. +@var{out} is the output stream to which all results are written. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_test_printsample} +@deftypefn {} {void} unur_test_printsample (UNUR_GEN* @var{generator}, int @var{n_rows}, int @var{n_cols}, FILE* @var{out}) +Print a small sample with @var{n_rows} rows and @var{n_cols} columns. +@var{out} is the output stream to which all results are written. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_test_timing} +@deftypefn Function {UNUR_GEN*} unur_test_timing (UNUR_PAR* @var{parameters}, int @var{log10_samplesize}, double* @var{time_setup}, double* @var{time_sample}, int @var{verbosity}, FILE* @var{out}) +Timing. @var{parameters} is an parameter object for which setup +time and marginal generation times have to be measured. The results +are written into @var{time_setup} and @var{time_sample}, +respectively. @var{log10_samplesize} is the common logarithm of the +sample size that is used for timing. + +If @var{verbosity} is @code{TRUE} then a small table is printed to +output stream @var{out} with setup time, marginal generation time and +average generation times for generating 10, 100, @dots{} random +variates. All times are given in micro seconds and relative to +the generation times for the underlying uniform random number +(using the UNIF interface) and an exponential distributed +random variate using the inversion method. + +The created generator object is returned. +If a generator object could not be created successfully, then @code{NULL} +is returned. + +If @var{verbosity} is @code{TRUE} the result is written to the output +stream @var{out}. + +Notice: All timing results are subject to heavy changes. Reruning +timings usually results in different results. Minor changes in +the source code can cause changes in such timings up to 25 percent. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_test_timing} +@deftypefn {} {UNUR_GEN*} unur_test_timing (UNUR_PAR* @var{parameters}, int @var{log10_samplesize}, double* @var{time_setup}, double* @var{time_sample}, int @var{verbosity}, FILE* @var{out}) +Timing. @var{parameters} is an parameter object for which setup +time and marginal generation times have to be measured. The results +are written into @var{time_setup} and @var{time_sample}, +respectively. @var{log10_samplesize} is the common logarithm of the +sample size that is used for timing. + +If @var{verbosity} is @code{TRUE} then a small table is printed to +output stream @var{out} with setup time, marginal generation time and +average generation times for generating 10, 100, @dots{} random +variates. All times are given in micro seconds and relative to +the generation times for the underlying uniform random number +(using the UNIF interface) and an exponential distributed +random variate using the inversion method. + +The created generator object is returned. +If a generator object could not be created successfully, then @code{NULL} +is returned. + +If @var{verbosity} is @code{TRUE} the result is written to the output +stream @var{out}. + +Notice: All timing results are subject to heavy changes. Reruning +timings usually results in different results. Minor changes in +the source code can cause changes in such timings up to 25 percent. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_test_timing_R} +@deftypefn Function {double} unur_test_timing_R (UNUR_PAR* @var{parameters}, const @var{char* distrstr}, const @var{char* methodstr}, double @var{log10_samplesize}, double* @var{time_setup}, double* @var{time_marginal}) +Timing. @var{parameters} is an parameter object for which setup +time and marginal generation times have to be measured. The results +are written into @var{time_setup} and @var{time_marginal}, +respectively. @var{log10_samplesize} is the common logarithm of the +sample size that is used for timing. + +Alternatively, one could provide the "parameter object" using +strings @var{distrstr} and @var{methodstr} as used for +@ifhtml +@ref{funct:unur_makegen_ssu,@command{unur_makegen_ssu}.} +@end ifhtml +@ifnothtml +@command{unur_makegen_ssu}. +@end ifnothtml +The results are more accurate than those of function +@ifhtml +@ref{funct:unur_test_timing,@command{unur_test_timing}} +@end ifhtml +@ifnothtml +@command{unur_test_timing} +@end ifnothtml +as the timings are computed using linear +regression with several timings for sample size 1 and +10^@var{log10_samplesize}. +For each sample size total generation time (including setup) is +measured 10 times. Since the these timings can be influenced by +external effects (like disc sync or handling of interupts) the 2 +fastest and the 3 slowest timings are discarded. +Intercept and slope for simple linear regression are than stored +and +@math{R^2} +is returned. + +In case of an error @code{-100.} is returned. + +Notice: All timing results are subject to heavy changes. Reruning +timings usually results in different results. Minor changes in +the source code can cause changes in such timings up to 25 percent. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_test_timing_R} +@deftypefn {} {double} unur_test_timing_R (UNUR_PAR* @var{parameters}, const @var{char* distrstr}, const @var{char* methodstr}, double @var{log10_samplesize}, double* @var{time_setup}, double* @var{time_marginal}) +Timing. @var{parameters} is an parameter object for which setup +time and marginal generation times have to be measured. The results +are written into @var{time_setup} and @var{time_marginal}, +respectively. @var{log10_samplesize} is the common logarithm of the +sample size that is used for timing. + +Alternatively, one could provide the "parameter object" using +strings @var{distrstr} and @var{methodstr} as used for +@ifhtml +@ref{funct:unur_makegen_ssu,@command{unur_makegen_ssu}.} +@end ifhtml +@ifnothtml +@command{unur_makegen_ssu}. +@end ifnothtml +The results are more accurate than those of function +@ifhtml +@ref{funct:unur_test_timing,@command{unur_test_timing}} +@end ifhtml +@ifnothtml +@command{unur_test_timing} +@end ifnothtml +as the timings are computed using linear +regression with several timings for sample size 1 and +10^@var{log10_samplesize}. +For each sample size total generation time (including setup) is +measured 10 times. Since the these timings can be influenced by +external effects (like disc sync or handling of interupts) the 2 +fastest and the 3 slowest timings are discarded. +Intercept and slope for simple linear regression are than stored +and +@iftex +@math{R^2} +@end iftex +@ifhtml +@html +R2 +@end html +@end ifhtml +is returned. + +In case of an error @code{-100.} is returned. + +Notice: All timing results are subject to heavy changes. Reruning +timings usually results in different results. Minor changes in +the source code can cause changes in such timings up to 25 percent. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_test_timing_uniform} +@anchor{funct:unur_test_timing_exponential} +@deftypefn Function {double} unur_test_timing_uniform (const @var{UNUR_PAR* parameters}, int @var{log10_samplesize}) +@deftypefnx Function {double} unur_test_timing_exponential (const @var{UNUR_PAR* parameters}, int @var{log10_samplesize}) +Marginal generation times for the underlying uniform random number +(using the UNIF interface) and an exponential distributed +random variate using the inversion method. These times are used in +@ifhtml +@ref{funct:unur_test_timing,@command{unur_test_timing}} +@end ifhtml +@ifnothtml +@command{unur_test_timing} +@end ifnothtml +to compute the relative timings results. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_test_timing_uniform} +@anchor{funct:unur_test_timing_exponential} +@deftypefn {} {double} unur_test_timing_uniform (const @var{UNUR_PAR* parameters}, int @var{log10_samplesize}) +@deftypefnx {} {double} unur_test_timing_exponential (const @var{UNUR_PAR* parameters}, int @var{log10_samplesize}) +Marginal generation times for the underlying uniform random number +(using the UNIF interface) and an exponential distributed +random variate using the inversion method. These times are used in +@ifhtml +@ref{funct:unur_test_timing,@command{unur_test_timing}} +@end ifhtml +@ifnothtml +@command{unur_test_timing} +@end ifnothtml +to compute the relative timings results. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_test_timing_total} +@deftypefn Function {double} unur_test_timing_total (const @var{UNUR_PAR* parameters}, int @var{samplesize}, double @var{avg_duration}) +Timing. @var{parameters} is an parameter object for which average +times a sample of size @var{samplesize} (including setup) are +estimated. Thus sampling is repeated and the median of these timings +is returned (in micro seconds). The number of iterations is computed +automatically such that the total amount of time necessary for the +test ist approximately @var{avg_duration} (given in seconds). +However, for very slow generator with expensive setup time the time +necessary for this test may be (much) larger. + +If an error occurs then @code{-1} is returned. + +Notice: All timing results are subject to heavy changes. Reruning +timings usually results in different results. Minor changes in +the source code can cause changes in such timings up to 25 percent. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_test_timing_total} +@deftypefn {} {double} unur_test_timing_total (const @var{UNUR_PAR* parameters}, int @var{samplesize}, double @var{avg_duration}) +Timing. @var{parameters} is an parameter object for which average +times a sample of size @var{samplesize} (including setup) are +estimated. Thus sampling is repeated and the median of these timings +is returned (in micro seconds). The number of iterations is computed +automatically such that the total amount of time necessary for the +test ist approximately @var{avg_duration} (given in seconds). +However, for very slow generator with expensive setup time the time +necessary for this test may be (much) larger. + +If an error occurs then @code{-1} is returned. + +Notice: All timing results are subject to heavy changes. Reruning +timings usually results in different results. Minor changes in +the source code can cause changes in such timings up to 25 percent. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_test_count_urn} +@deftypefn Function {int} unur_test_count_urn (UNUR_GEN* @var{generator}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) +Count used uniform random numbers. It returns the total number of +uniform random numbers required for a sample of non-uniform random +variates of size @var{samplesize}. In case of an error @code{-1} +is returned. + +If @var{verbosity} is @code{TRUE} the result is written to the output +stream @var{out}. + +@emph{Notice:} This test uses global variables to store +counters. Thus it is not thread save. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_test_count_urn} +@deftypefn {} {int} unur_test_count_urn (UNUR_GEN* @var{generator}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) +Count used uniform random numbers. It returns the total number of +uniform random numbers required for a sample of non-uniform random +variates of size @var{samplesize}. In case of an error @code{-1} +is returned. + +If @var{verbosity} is @code{TRUE} the result is written to the output +stream @var{out}. + +@emph{Notice:} This test uses global variables to store +counters. Thus it is not thread save. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_test_count_pdf} +@deftypefn Function {int} unur_test_count_pdf (UNUR_GEN* @var{generator}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) +Count evaluations of PDF and similar functions. It returns the +total number of evaluations of all such functions required for a +sample of non-uniform random variates of size @var{samplesize}. +If @var{verbosity} is @code{TRUE} then a more detailed report is printed +to the output stream @var{out}. +In case of an error @code{-1} is returned. +This test is run on a copy of the given generator object. + +@emph{Notice:} The printed numbers of evaluation should be interpreted +with care. For example, methods either use the PDF or the logPDF; +if only the logPDF is given, but a method needs the PDF then both +the logPDF and the PDF (a wrapper around the logPDF) are called and +thus one call to the PDF is counted twice. + +@emph{Notice:} This test uses global variables to store function +pointers and counters. Thus it is not thread save. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_test_count_pdf} +@deftypefn {} {int} unur_test_count_pdf (UNUR_GEN* @var{generator}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) +Count evaluations of PDF and similar functions. It returns the +total number of evaluations of all such functions required for a +sample of non-uniform random variates of size @var{samplesize}. +If @var{verbosity} is @code{TRUE} then a more detailed report is printed +to the output stream @var{out}. +In case of an error @code{-1} is returned. +This test is run on a copy of the given generator object. + +@emph{Notice:} The printed numbers of evaluation should be interpreted +with care. For example, methods either use the PDF or the logPDF; +if only the logPDF is given, but a method needs the PDF then both +the logPDF and the PDF (a wrapper around the logPDF) are called and +thus one call to the PDF is counted twice. + +@emph{Notice:} This test uses global variables to store function +pointers and counters. Thus it is not thread save. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_test_par_count_pdf} +@deftypefn Function {int} unur_test_par_count_pdf (UNUR_PAR* @var{parameters}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) +Same as +@ifhtml +@ref{funct:unur_test_count_pdf,@command{unur_test_count_pdf}} +@end ifhtml +@ifnothtml +@command{unur_test_count_pdf} +@end ifnothtml +except that it is run on a parameter +object. Thus it also prints the number of function evaluations for +the setup. The temporary created generator object is destroyed +before the results are returned. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_test_par_count_pdf} +@deftypefn {} {int} unur_test_par_count_pdf (UNUR_PAR* @var{parameters}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) +Same as +@ifhtml +@ref{funct:unur_test_count_pdf,@command{unur_test_count_pdf}} +@end ifhtml +@ifnothtml +@command{unur_test_count_pdf} +@end ifnothtml +except that it is run on a parameter +object. Thus it also prints the number of function evaluations for +the setup. The temporary created generator object is destroyed +before the results are returned. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_test_chi2} +@deftypefn Function {double} unur_test_chi2 (UNUR_GEN* @var{generator}, int @var{intervals}, int @var{samplesize}, int @var{classmin}, int @var{verbosity}, FILE* @var{out}) +Run a Chi^2 test with the @var{generator}. +The resulting p-value is returned. + +It works with discrete und continuous univariate distributions. +For the latter the CDF of the distribution is required. + +@var{intervals} is the number of intervals that is used for +continuous univariate distributions. @var{samplesize} is the size +of the sample that is used for testing. If it is set to @code{0} +then a sample of size @var{intervals}^2 is used (bounded to some +upper bound). + +@var{classmin} is the minimum number of expected entries per +class. If a class has to few entries then some classes are joined. + +@var{verbosity} controls the output of the routine. If it is set +to @code{1} then the result is written to the output stream +@var{out}. If it is set to @code{2} additionally the list of +expected and observed data is printed. +If it is set to @code{3} then all generated numbers are printed. +There is no output when it is set to @code{0}. + +@emph{Notice:} For multivariate distributions the generated points +are transformed by the inverse of the Cholesky factor of the +covariance matrix and the mean vectors (if given for the underlying +distribution). The marginal distributions of the transformed +vectors are then tested against the marginal distribution given by +a +@ifhtml +@ref{funct:unur_distr_cvec_set_marginals,@command{unur_distr_cvec_set_marginals}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_marginals} +@end ifnothtml +or +@ifhtml +@ref{funct:unur_distr_cvec_set_marginal_array,@command{unur_distr_cvec_set_marginal_array}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_marginal_array} +@end ifnothtml +call. +(Notice that these marginal distributions are never set by default +for any of the distributions provided by UNU.RAN.) +Then the Bonferroni corrected p-value of all these tests is returned. +However, the test may not be performed correctly if the domain of the +underlying distribution is truncated by a +@ifhtml +@ref{funct:unur_distr_cvec_set_domain_rect,@command{unur_distr_cvec_set_domain_rect}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_domain_rect} +@end ifnothtml +call and the components of the +distribution are correlated (i.e. +@ifhtml +@ref{funct:unur_distr_cvec_set_covar,@command{unur_distr_cvec_set_covar}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_covar} +@end ifnothtml +is +called with the non-NULL argument). Then it almost surely will fail. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_test_chi2} +@deftypefn {} {double} unur_test_chi2 (UNUR_GEN* @var{generator}, int @var{intervals}, int @var{samplesize}, int @var{classmin}, int @var{verbosity}, FILE* @var{out}) +Run a Chi^2 test with the @var{generator}. +The resulting p-value is returned. + +It works with discrete und continuous univariate distributions. +For the latter the CDF of the distribution is required. + +@var{intervals} is the number of intervals that is used for +continuous univariate distributions. @var{samplesize} is the size +of the sample that is used for testing. If it is set to @code{0} +then a sample of size @var{intervals}^2 is used (bounded to some +upper bound). + +@var{classmin} is the minimum number of expected entries per +class. If a class has to few entries then some classes are joined. + +@var{verbosity} controls the output of the routine. If it is set +to @code{1} then the result is written to the output stream +@var{out}. If it is set to @code{2} additionally the list of +expected and observed data is printed. +If it is set to @code{3} then all generated numbers are printed. +There is no output when it is set to @code{0}. + +@emph{Notice:} For multivariate distributions the generated points +are transformed by the inverse of the Cholesky factor of the +covariance matrix and the mean vectors (if given for the underlying +distribution). The marginal distributions of the transformed +vectors are then tested against the marginal distribution given by +a +@ifhtml +@ref{funct:unur_distr_cvec_set_marginals,@command{unur_distr_cvec_set_marginals}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_marginals} +@end ifnothtml +or +@ifhtml +@ref{funct:unur_distr_cvec_set_marginal_array,@command{unur_distr_cvec_set_marginal_array}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_marginal_array} +@end ifnothtml +call. +(Notice that these marginal distributions are never set by default +for any of the distributions provided by UNU.RAN.) +Then the Bonferroni corrected p-value of all these tests is returned. +However, the test may not be performed correctly if the domain of the +underlying distribution is truncated by a +@ifhtml +@ref{funct:unur_distr_cvec_set_domain_rect,@command{unur_distr_cvec_set_domain_rect}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_domain_rect} +@end ifnothtml +call and the components of the +distribution are correlated (i.e. +@ifhtml +@ref{funct:unur_distr_cvec_set_covar,@command{unur_distr_cvec_set_covar}} +@end ifhtml +@ifnothtml +@command{unur_distr_cvec_set_covar} +@end ifnothtml +is +called with the non-NULL argument). Then it almost surely will fail. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_test_moments} +@deftypefn Function {int} unur_test_moments (UNUR_GEN* @var{generator}, double* @var{moments}, int @var{n_moments}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) +Computes the first @var{n_moments} central moments for a sample of +size @var{samplesize}. The result is stored into the array +@var{moments}. +@var{n_moments} must be an integer between @code{1} and @code{4}. +For multivariate distributions the moments are stored consecutively +for each dimension and the provided @var{moments}-array must have +a length of at least (@var{n_moments}+1) * @var{dim}, where @var{dim} +is the dimension of the multivariate distribution. +The @var{m}'th moment for the @var{d}'th dimension (0<=@var{d}<@var{dim}) +is thus stored in the array element +@var{moments}[@var{d}*@var{n_moments}+@var{m}] + +If @var{verbosity} is @code{TRUE} the result is written to the output +stream @var{out}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_test_moments} +@deftypefn {} {int} unur_test_moments (UNUR_GEN* @var{generator}, double* @var{moments}, int @var{n_moments}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) +Computes the first @var{n_moments} central moments for a sample of +size @var{samplesize}. The result is stored into the array +@var{moments}. +@var{n_moments} must be an integer between @code{1} and @code{4}. +For multivariate distributions the moments are stored consecutively +for each dimension and the provided @var{moments}-array must have +a length of at least (@var{n_moments}+1) * @var{dim}, where @var{dim} +is the dimension of the multivariate distribution. +The @var{m}'th moment for the @var{d}'th dimension (0<=@var{d}<@var{dim}) +is thus stored in the array element +@var{moments}[@var{d}*@var{n_moments}+@var{m}] + +If @var{verbosity} is @code{TRUE} the result is written to the output +stream @var{out}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_test_correlation} +@deftypefn Function {double} unur_test_correlation (UNUR_GEN* @var{generator1}, UNUR_GEN* @var{generator2}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) +Compute the correlation coefficient between streams from +@var{generator1} and @var{generator2} for two samples of size +@var{samplesize}. +The resultung correlation is returned. + +If @var{verbosity} is @code{TRUE} the result is written to the output +stream @var{out}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_test_correlation} +@deftypefn {} {double} unur_test_correlation (UNUR_GEN* @var{generator1}, UNUR_GEN* @var{generator2}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) +Compute the correlation coefficient between streams from +@var{generator1} and @var{generator2} for two samples of size +@var{samplesize}. +The resultung correlation is returned. + +If @var{verbosity} is @code{TRUE} the result is written to the output +stream @var{out}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_test_quartiles} +@deftypefn Function {int} unur_test_quartiles (UNUR_GEN* @var{generator}, double* @var{q0}, double* @var{q1}, double* @var{q2}, double* @var{q3}, double* @var{q4}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) +Estimate quartiles of sample of size @var{samplesize}. +The resulting quantiles are stored in the variables @var{q}: +@table @var +@item q0 +minimum +@item q1 +25% +@item q2 +median (50%) +@item q3 +75% +@item q4 +maximum +@end table + +If @var{verbosity} is @code{TRUE} the result is written to the output +stream @var{out}. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_test_quartiles} +@deftypefn {} {int} unur_test_quartiles (UNUR_GEN* @var{generator}, double* @var{q0}, double* @var{q1}, double* @var{q2}, double* @var{q3}, double* @var{q4}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) +Estimate quartiles of sample of size @var{samplesize}. +The resulting quantiles are stored in the variables @var{q}: +@table @var +@item q0 +minimum +@item q1 +25% +@item q2 +median (50%) +@item q3 +75% +@item q4 +maximum +@end table + +If @var{verbosity} is @code{TRUE} the result is written to the output +stream @var{out}. +@end deftypefn +@end ifnotinfo + +@ifinfo +@anchor{funct:unur_test_u_error} +@deftypefn Function {double} unur_test_u_error (const @var{UNUR_GEN* generator}, double* @var{max_error}, double* @var{MAE}, double @var{threshold}, int @var{samplesize}, int @var{randomized}, int @var{testtails}, int @var{verbosity}, FILE* @var{out}) +Estimate U-error of an inversion method, i.e. +@math{error = | CDF^(-1)(U) - U |} +, by means of a simple Monte +Carlo method. +Maximum and mean absolute errors are stored in @var{max_error} and +@var{MAE}, respectively. +The particular computed U-errors should not exceed the given +@var{threshold}. However, approximization and round-off errors +might occasionally trigger such an event. +Thus the function returns a penalty score. It is @code{0.} when the +U-error never exceed the @var{threshold} value. It roughly gives the +portion of particular test points where the U-error is too larger. +However, each such event is weighted with +@math{1 + 10 x(uerror - threshold) / threshold} +. + +If @var{randomized} is @code{TRUE} a pseudo-random sequence is used for +the estimation. + +If @var{randomized} is @code{FALSE} then the U-values are choosen +equidistributed. +If in addition @var{randomized} is set to @code{TRUE} then the tails of +the distributions are tested with a more dense set of points. + +If @var{verbosity} is @code{TRUE} the result is written to the output +stream @var{out}. + +When the domain of the distribution is truncated then the u-error +might be larger due to rescaling of floating point numbers. Thus +the observed u-errors are corrected by the corresponding rescaling +factor. + +The test also works for discrete distributions albeit with some +restrictions: +It does not work correctly with truncated distributions and the +@var{testtails} flag is ignored. +Moreover, the value stored in @var{MAE} is rather useless. + +In case of an error a negative value is returned. +@end deftypefn +@end ifinfo +@ifnotinfo +@anchor{funct:unur_test_u_error} +@deftypefn {} {double} unur_test_u_error (const @var{UNUR_GEN* generator}, double* @var{max_error}, double* @var{MAE}, double @var{threshold}, int @var{samplesize}, int @var{randomized}, int @var{testtails}, int @var{verbosity}, FILE* @var{out}) +Estimate U-error of an inversion method, i.e. +@iftex +@math{error = | CDF^{-1}(U) - U |} +@end iftex +@ifhtml +@html +error = | CDF-1(U) - U | +@end html +@end ifhtml +, by means of a simple Monte +Carlo method. +Maximum and mean absolute errors are stored in @var{max_error} and +@var{MAE}, respectively. +The particular computed U-errors should not exceed the given +@var{threshold}. However, approximization and round-off errors +might occasionally trigger such an event. +Thus the function returns a penalty score. It is @code{0.} when the +U-error never exceed the @var{threshold} value. It roughly gives the +portion of particular test points where the U-error is too larger. +However, each such event is weighted with +@iftex +@math{1 + 10 \times (uerror - threshold) / threshold} +@end iftex +@ifhtml +@html +1 + 10 x(uerror - threshold) / threshold +@end html +@end ifhtml +. + +If @var{randomized} is @code{TRUE} a pseudo-random sequence is used for +the estimation. + +If @var{randomized} is @code{FALSE} then the U-values are choosen +equidistributed. +If in addition @var{randomized} is set to @code{TRUE} then the tails of +the distributions are tested with a more dense set of points. + +If @var{verbosity} is @code{TRUE} the result is written to the output +stream @var{out}. + +When the domain of the distribution is truncated then the u-error +might be larger due to rescaling of floating point numbers. Thus +the observed u-errors are corrected by the corresponding rescaling +factor. + +The test also works for discrete distributions albeit with some +restrictions: +It does not work correctly with truncated distributions and the +@var{testtails} flag is ignored. +Moreover, the value stored in @var{MAE} is rather useless. + +In case of an error a negative value is returned. +@end deftypefn +@end ifnotinfo + + + + +@c +@c end of unuran_tests.h +@c ------------------------------------- +@c ------------------------------------- +@c misc.dh +@c + +@node Misc +@chapter Miscelleanous + +@menu +* Math:: Mathematics +@end menu + + +@c +@c end of misc.dh +@c ------------------------------------- +@c ------------------------------------- +@c umath.h +@c + +@node Math +@section Mathematics + + +The following macros have been defined + +@ftable @code +@item UNUR_INFINITY +indicates infinity for floating point numbers (of type @code{double}). +Internally @code{HUGE_VAL} is used. + +@item INT_MAX +@itemx INT_MIN +indicate infinity and minus infinity, resp., for integers +(defined by ISO C standard). + +@item @code{TRUE} +@itemx @code{FALSE} +bolean expression for return values of @code{set} functions. +@end ftable + + +@c +@c end of umath.h +@c ------------------------------------- +@c ------------------------------------- +@c arvag.dh +@c + +@node RVG +@appendix A Short Introduction to Random Variate Generation + +@menu +* Inversion:: The Inversion Method +* Rejection:: The Rejection Method +* Composition:: The Composition Method +* Ratio-of-Uniforms:: The Ratio-of-Uniforms Method +* DiscreteInversion:: Inversion for Discrete Distributions +* IndexedSearch:: Indexed Search (Guide Table Method) +@end menu + + + +Random variate generation is the small field of research that deals +with algorithms to generate random variates from various +distributions. It is common to assume that a uniform random number +generator is available. This is a program that produces a sequence +of independent and identically distributed continuous +@iftex +@math{U(0,1)} +@end iftex +@ifhtml +@html +U(0,1) +@end html +@end ifhtml +@ifinfo +@math{U(0,1)} +@end ifinfo +random variates (i.e. uniform random variates +on the interval +@iftex +@math{(0,1)} +@end iftex +@ifhtml +@html +(0,1) +@end html +@end ifhtml +@ifinfo +@math{(0,1)} +@end ifinfo +). Of course real world computers can +never generate ideal random numbers and they cannot produce numbers +of arbitrary precision but state-of-the-art uniform random number +generators come close to this aim. Thus random variate generation +deals with the problem of transforming such a sequence of +@iftex +@math{U(0,1)} +@end iftex +@ifhtml +@html +U(0,1) +@end html +@end ifhtml +@ifinfo +@math{U(0,1)} +@end ifinfo +random numbers into non-uniform random variates. + +Here we shortly explain the basic ideas of the @emph{inversion}, +@emph{rejection}, and the @emph{ratio of uniforms} method. How +these ideas can be used to design a particular automatic random +variate generation algorithms that can be applied to large classes +of distributions is shortly explained in the description of the +different methods included in this manual. + +For a deeper treatment of the ideas presented here, for other +basic methods and for automatic generators we refer the interested +reader to our book [HLD04]. + + + +@c +@c end of arvag.dh +@c ------------------------------------- +@c ------------------------------------- +@c arvag.dh +@c + +@node Inversion +@section The Inversion Method + + + +When the inverse +@iftex +@math{F^{-1}} +@end iftex +@ifhtml +@html +F-1 +@end html +@end ifhtml +@ifinfo +@math{F^(-1)} +@end ifinfo +of the cumulative distribution +function is known, then random variate generation is easy. +We just generate a uniformly +@iftex +@math{U(0,1)} +@end iftex +@ifhtml +@html +U(0,1) +@end html +@end ifhtml +@ifinfo +@math{U(0,1)} +@end ifinfo +distributed random +number +@iftex +@math{U} +@end iftex +@ifhtml +@html +U +@end html +@end ifhtml +@ifinfo +@math{U} +@end ifinfo +and return +@iftex + +@quotation +@math{X=F^{-1}(U).} +@end quotation + +@end iftex +@ifhtml +@quotation +@html +X=F-1(U). +@end html +@end quotation +@end ifhtml +@ifinfo +@quotation +@math{X=F^(-1)(U).} +@end quotation +@end ifinfo + +@noindent +The following figure shows how the inversion method works for +the exponential distribution. + + +@image{figures/inversion} + + + +This algorithm is so simple that inversion is certainly the method +of choice if the inverse CDF is available in closed form. This is +the case e.g. for the exponential and the Cauchy distribution. + +The inversion method also has other special advantages that make it +even more attractive for simulation purposes. +It preserves the structural properties of the underlying uniform +pseudo-random number generator. +Consequently it can be used, e.g., for variance reduction techniques, +it is easy to sample from truncated distributions, from marginal +distributions, and from order statistics. +Moreover, the quality of the generated random variables depends only +on the underlying uniform (pseudo-) random number generator. +Another important advantage of the inversion method is that we can +easily characterize its performance. To generate one random variate +we always need exactly one uniform variate and one evaluation of +the inverse CDF. So its speed mainly depends on the costs for +evaluating the inverse CDF. Hence inversion is often considered as +the method of choice in the simulation literature. + +Unfortunately computing the inverse CDF is, for many important +standard distributions (e.g. for normal, student, gamma, and +beta-distributions), comparatively difficult and slow. Often no +such routines are available in standard programming libraries. +Then numerical methods for inverting the CDF are necessary, e.g. +Newton's method or (polynomial or rational) approximations of the +inverse CDF. Such procedures, however, have the disadvantage that +they are not exact and/or slow. +UNU.RAN implements several methods: +NINV (@pxref{NINV}), HINV (@pxref{HINV}) and PINV (@pxref{PINV}). + +For such approximate inversion methods the approximation error is +important for the quality of the generated point set. +Let +@iftex +@math{X=G^{-1}(U)} +@end iftex +@ifhtml +@html +X=G-1(U) +@end html +@end ifhtml +@ifinfo +@math{X=G^(-1)(U)} +@end ifinfo +denote the approximate inverse CDF, +and let +@iftex +@math{F} +@end iftex +@ifhtml +@html +F +@end html +@end ifhtml +@ifinfo +@math{F} +@end ifinfo +and +@iftex +@math{F^{-1}} +@end iftex +@ifhtml +@html +F-1 +@end html +@end ifhtml +@ifinfo +@math{F^(-1)} +@end ifinfo +be the exact CDF and +inverse CDF of the distribution, resp. +There are three measures for the approximation error: + +@table @emph +@item u-error +is given by +@iftex + +@quotation +@math{uerror = |U-F(G^{-1}(U))|} +@end quotation + +@end iftex +@ifhtml +@quotation +@html +uerror = |U-F(G-1(U))| +@end html +@end quotation +@end ifhtml +@ifinfo +@quotation +@math{uerror = |U-F(G^(-1)(U))|} +@end quotation +@end ifinfo + +@noindent +Goodness-of-fit tests like the Kolmogorov-Smirnov test or the +chi-squared test look at this type of error. +We are also convinced that it is the most suitable error measure for +Monte Carlo simulations as pseudo-random numbers and points of low +discrepancy sets are located on a grid of restricted resolution. + +@item x-error +is given by +@iftex + +@quotation +@math{absolute xerror = |F^{-1}(U)-G^{-1}(U)|} +@end quotation + +@end iftex +@ifhtml +@quotation +@html +absolute xerror = |F-1(U)-G-1(U)| +@end html +@end quotation +@end ifhtml +@ifinfo +@quotation +@math{absolute xerror = |F^(-1)(U)-G^(-1)(U)|} +@end quotation +@end ifinfo + +@noindent +@iftex + +@quotation +@math{relative xerror = |F^{-1}(U)-G^{-1}(U)|\cdot |F^{-1}(U)|} +@end quotation + +@end iftex +@ifhtml +@quotation +@html +relative xerror = |F-1(U)-G-1(U)| * |F-1(U)| +@end html +@end quotation +@end ifhtml +@ifinfo +@quotation +@math{relative xerror = |F^(-1)(U)-G^(-1)(U)| * |F^(-1)(U)|} +@end quotation +@end ifinfo + +@noindent +The x-error measure the deviation of +@iftex +@math{G^{-1}(U)} +@end iftex +@ifhtml +@html +G-1(U) +@end html +@end ifhtml +@ifinfo +@math{G^(-1)(U)} +@end ifinfo +from the exact result. This measure is suitable when the inverse +CDF is used as a quantile function in some computations. +The main problem with the x-error is that we have to use the +@emph{absolute x-error} for +@iftex +@math{X=F^{-1}(U)} +@end iftex +@ifhtml +@html +X=F-1(U) +@end html +@end ifhtml +@ifinfo +@math{X=F^(-1)(U)} +@end ifinfo +close to zero +and the @emph{relative x-error} in the tails. + +@end table + +We use the terms @emph{u-resolution} and @emph{x-resolution} as the +maximal tolerated u-error and x-error, resp. + +UNU.RAN allows to set u-resolution and x-resolution +independently. Both requirements must be fulfilled. +We use the following strategy for checking whether the +precision goal is reached: + +@table @emph +@item checking u-error: +The u-error must be slightly smaller than the given u-resolution: +@iftex + +@quotation +@math{|U-F(G^{-1}(U))| < 0.9\cdot uresolution.} +@end quotation + +@end iftex +@ifhtml +@quotation +@html +|U-F(G-1(U))| < 0.9 * uresolution. +@end html +@end quotation +@end ifhtml +@ifinfo +@quotation +@math{|U-F(G^(-1)(U))| < 0.9 * uresolution.} +@end quotation +@end ifinfo + +@noindent +There is no necessity to consinder the relative u-error as we have +@iftex +@math{0 < U < 1.} +@end iftex +@ifhtml +@html +0 < U < 1. +@end html +@end ifhtml +@ifinfo +@math{0 < U < 1.} +@end ifinfo + +@item checking x-error: +We combine absoute and relative x-error and use the criterion +@iftex + +@quotation +@math{|F^{-1}(U)-G^{-1}(U)| < xresolution \cdot (|G^{-1}(U)| + xresolution).} +@end quotation + +@end iftex +@ifhtml +@quotation +@html +|F-1(U)-G-1(U)| < xresolution * (|G-1(U)| + xresolution). +@end html +@end quotation +@end ifhtml +@ifinfo +@quotation +@math{|F^(-1)(U)-G^(-1)(U)| < xresolution * (|G^(-1)(U)| + xresolution).} +@end quotation +@end ifinfo + +@noindent +@end table + +@strong{Remark:} +It should be noted here that the criterion based on the u-error is +too stringent whereever the CDF is extremely steep (and thus the +PDF has a pole or a high and narrow peak). This is in particular a +problem for distributions with a pole (e.g., the gamma distribution +with shape parameter less than 0.5). +On the other hand using a criterion based on the x-error causes +problems whereever the CDF is extremly flat. This is in particular +the case in the (far) tails of heavy-tailed distributions (e.g., +for the Cauchy distribution). + + + +@c +@c end of arvag.dh +@c ------------------------------------- +@c ------------------------------------- +@c arvag.dh +@c + +@node Rejection +@section The Rejection Method + + + +The rejection method, often called @emph{acceptance-rejection +method}, has been suggested by John von Neumann in 1951. +Since then it has proven to be the most flexible and most efficient +method to generate variates from continuous distributions. + +We explain the rejection principle first for the density +@iftex +@math{f(x) = sin(x)/2} +@end iftex +@ifhtml +@html +f(x) = sin(x)/2 +@end html +@end ifhtml +@ifinfo +@math{f(x) = sin(x)/2} +@end ifinfo +on the interval +@iftex +@math{(0,\pi).} +@end iftex +@ifhtml +@html +(0, pi). +@end html +@end ifhtml +@ifinfo +@math{(0, pi).} +@end ifinfo +To generate random variates from this distribution we also can +sample random points that are uniformly distributed in the region +between the graph of +@iftex +@math{f(x)} +@end iftex +@ifhtml +@html +f(x) +@end html +@end ifhtml +@ifinfo +@math{f(x)} +@end ifinfo +and the @i{x}-axis, +i.e., the shaded region in the below figure. + + +@image{figures/rejection_from_constant_hat} + + + +In general this is not a trivial task but in this example we can +easily use the rejection trick: +Sample a random point +@iftex +@math{(X,Y)} +@end iftex +@ifhtml +@html +(X,Y) +@end html +@end ifhtml +@ifinfo +@math{(X,Y)} +@end ifinfo +uniformly in the +bounding rectangle +@iftex +@math{(0,\pi)\times(0,0.5).} +@end iftex +@ifhtml +@html +(0, pi)x(0,0.5). +@end html +@end ifhtml +@ifinfo +@math{(0, pi)x(0,0.5).} +@end ifinfo +This is easy since +each coordinate can be sampled independently from the respective +uniform distributions +@iftex +@math{U(0,\pi)} +@end iftex +@ifhtml +@html +U(0, pi) +@end html +@end ifhtml +@ifinfo +@math{U(0, pi)} +@end ifinfo +and +@iftex +@math{U(0,0.5).} +@end iftex +@ifhtml +@html +U(0,0.5). +@end html +@end ifhtml +@ifinfo +@math{U(0,0.5).} +@end ifinfo +Whenever the point falls into the shaded region below the graph +(indicated by dots in the figure), i.e., when +@iftex +@math{Y < sin(X)/2,} +@end iftex +@ifhtml +@html +Y < sin(X)/2, +@end html +@end ifhtml +@ifinfo +@math{Y < sin(X)/2,} +@end ifinfo +we accept it and return +@iftex +@math{X} +@end iftex +@ifhtml +@html +X +@end html +@end ifhtml +@ifinfo +@math{X} +@end ifinfo +as a random variate +from the distribution with density +@iftex +@math{f(x).} +@end iftex +@ifhtml +@html +f(x). +@end html +@end ifhtml +@ifinfo +@math{f(x).} +@end ifinfo +Otherwise we have to reject the point (indicated by small circles +in the figure), and try again. + +It is quite clear that this idea works for every distribution with +a bounded density on a bounded domain. Moreover, we can use this +procedure with any multiple of the density, i.e., with any positive +bounded function with bounded integral and it is not necessary to +know the integral of this function. So we use the term density in +the sequel for any positive function with bounded integral. + +From the figure we can conclude that the performance of a rejection +algorithm depends heavily on the area of the enveloping +rectangle. Moreover, the method does not work if the target +distribution has infinite tails (or is unbounded). Hence +non-rectangular shaped regions for the envelopes are important and +we have to solve the problem of sampling points uniformly from such +domains. Looking again at the example above we notice that the +@i{x}-coordinate of the random point +@iftex +@math{(X,Y)} +@end iftex +@ifhtml +@html +(X,Y) +@end html +@end ifhtml +@ifinfo +@math{(X,Y)} +@end ifinfo +was +sampled by inversion from the uniform distribution on the domain of +the given density. This motivates us to replace the density of the +uniform distribution by the (multiple of a) density +@iftex +@math{h(x)} +@end iftex +@ifhtml +@html +h(x) +@end html +@end ifhtml +@ifinfo +@math{h(x)} +@end ifinfo +of some other appropriate distribution. We only have to take care +that it is chosen such that it is always an upper bound, i.e., +@iftex +@math{h(x)\geq f(x)} +@end iftex +@ifhtml +@html +h(x) >= f(x) +@end html +@end ifhtml +@ifinfo +@math{h(x) >= f(x)} +@end ifinfo +for all +@iftex +@math{x} +@end iftex +@ifhtml +@html +x +@end html +@end ifhtml +@ifinfo +@math{x} +@end ifinfo +in the domain of the +distribution. To generate the pair +@iftex +@math{(X,Y)} +@end iftex +@ifhtml +@html +(X,Y) +@end html +@end ifhtml +@ifinfo +@math{(X,Y)} +@end ifinfo +we generate +@iftex +@math{X} +@end iftex +@ifhtml +@html +X +@end html +@end ifhtml +@ifinfo +@math{X} +@end ifinfo +from the distribution with density proportional to +@iftex +@math{h(x)} +@end iftex +@ifhtml +@html +h(x) +@end html +@end ifhtml +@ifinfo +@math{h(x)} +@end ifinfo +and +@iftex +@math{Y} +@end iftex +@ifhtml +@html +Y +@end html +@end ifhtml +@ifinfo +@math{Y} +@end ifinfo +uniformly between +@iftex +@math{0} +@end iftex +@ifhtml +@html +0 +@end html +@end ifhtml +@ifinfo +@math{0} +@end ifinfo +and +@iftex +@math{h(X).} +@end iftex +@ifhtml +@html +h(X). +@end html +@end ifhtml +@ifinfo +@math{h(X).} +@end ifinfo +The first step (generate +@iftex +@math{X} +@end iftex +@ifhtml +@html +X +@end html +@end ifhtml +@ifinfo +@math{X} +@end ifinfo +) is usually +done by inversion (@pxref{Inversion}). + +Thus the general rejection algorithm for a hat +@iftex +@math{h(x)} +@end iftex +@ifhtml +@html +h(x) +@end html +@end ifhtml +@ifinfo +@math{h(x)} +@end ifinfo +with +inverse CDF +@iftex +@math{H^{-1}} +@end iftex +@ifhtml +@html +H-1 +@end html +@end ifhtml +@ifinfo +@math{H^(-1)} +@end ifinfo +consists of the following steps: +@enumerate +@item +Generate a +@iftex +@math{U(0,1)} +@end iftex +@ifhtml +@html +U(0,1) +@end html +@end ifhtml +@ifinfo +@math{U(0,1)} +@end ifinfo +random number +@iftex +@math{U.} +@end iftex +@ifhtml +@html +U. +@end html +@end ifhtml +@ifinfo +@math{U.} +@end ifinfo +@item +Set +@iftex +@math{X} +@end iftex +@ifhtml +@html +X +@end html +@end ifhtml +@ifinfo +@math{X} +@end ifinfo +to +@iftex +@math{H^{-1}(U).} +@end iftex +@ifhtml +@html +H-1(U). +@end html +@end ifhtml +@ifinfo +@math{H^(-1)(U).} +@end ifinfo +@item +Generate a +@iftex +@math{U(0,1)} +@end iftex +@ifhtml +@html +U(0,1) +@end html +@end ifhtml +@ifinfo +@math{U(0,1)} +@end ifinfo +random number +@iftex +@math{V.} +@end iftex +@ifhtml +@html +V. +@end html +@end ifhtml +@ifinfo +@math{V.} +@end ifinfo +@item +Set +@iftex +@math{Y} +@end iftex +@ifhtml +@html +Y +@end html +@end ifhtml +@ifinfo +@math{Y} +@end ifinfo +to +@iftex +@math{V h(X).} +@end iftex +@ifhtml +@html +V h(X). +@end html +@end ifhtml +@ifinfo +@math{V h(X).} +@end ifinfo +@item +If +@iftex +@math{Y\leq f(X)} +@end iftex +@ifhtml +@html +Y <= f(X) +@end html +@end ifhtml +@ifinfo +@math{Y <= f(X)} +@end ifinfo +accept +@iftex +@math{X} +@end iftex +@ifhtml +@html +X +@end html +@end ifhtml +@ifinfo +@math{X} +@end ifinfo +as the random variate. +@item +Else try again. +@end enumerate + +If the evaluation of the density +@iftex +@math{f(x)} +@end iftex +@ifhtml +@html +f(x) +@end html +@end ifhtml +@ifinfo +@math{f(x)} +@end ifinfo +is expensive +(i.e., time consuming) it is possible to use a simple lower bound +of the density as so called @emph{squeeze function} +@iftex +@math{s(x)} +@end iftex +@ifhtml +@html +s(x) +@end html +@end ifhtml +@ifinfo +@math{s(x)} +@end ifinfo +(the triangular shaped function in the above +figure is an example for such a squeeze). We can then accept +@iftex +@math{X} +@end iftex +@ifhtml +@html +X +@end html +@end ifhtml +@ifinfo +@math{X} +@end ifinfo +when +@iftex +@math{Y\leq s(X)} +@end iftex +@ifhtml +@html +Y <= s(X) +@end html +@end ifhtml +@ifinfo +@math{Y <= s(X)} +@end ifinfo +and can thus often save the +evaluation of the density. + +We have seen so far that the rejection principle leads to +short and simple generation algorithms. The main practical problem +to apply the rejection algorithm is the search for a good fitting +hat function and for squeezes. We do not discuss these topics here +as they are the heart of the different automatic algorithms +implemented in UNU.RAN. Information about the construction of hat +and squeeze can therefore be found in the descriptions of the +methods. + +The performance characteristics of rejection algorithms mainly +depend on the fit of the hat and the squeeze. It is not difficult +to prove that: +@itemize @bullet +@item +The expected number of trials to generate one variate is the ratio +between the area below the hat and the area below the density. +@item +The expected number of evaluations of the density necessary to +generate one variate is equal to the ratio between the area below +the hat and the area below the density, when no squeeze is used. +Otherwise, when a squeeze is given it is equal to the ratio +between the area between hat and squeeze and the area below the hat. +@item +The @code{sqhratio} (i.e., the ratio between the area below the +squeeze and the area below the hat) used in some of the UNU.RAN +methods is easy to compute. It is useful as its reciprocal is an +upper bound for the expected number of trials of the rejection +algoritm. The expected number of evaluations of the density is +bounded by +@iftex +@math{(1/sqhratio)-1.} +@end iftex +@ifhtml +@html +(1/sqhratio)-1. +@end html +@end ifhtml +@ifinfo +@math{(1/sqhratio)-1.} +@end ifinfo +@end itemize + + + +@c +@c end of arvag.dh +@c ------------------------------------- +@c ------------------------------------- +@c arvag.dh +@c + +@node Composition +@section The Composition Method + + + +The composition method is an important principle to facilitate and +speed up random variate generation. The basic idea is simple. +To generate random variates with a given density we first split the +domain of the density into subintervals. Then we select one of +these randomly with probabilities given by the area below the +density in the respective subintervals. Finally we generate a +random variate from the density of the selected part by inversion +and return it as random variate of the full distribution. + +Composition can be combined with rejection. Thus it is possible to +decompose the domain of the distribution into subintervals and to +construct hat and squeeze functions seperatly in every +subinterval. The area below the hat must be determined in every +subinterval. Then the Composition rejection algorithm contains the +following steps: + +@enumerate +@item +Generate the index +@iftex +@math{J} +@end iftex +@ifhtml +@html +J +@end html +@end ifhtml +@ifinfo +@math{J} +@end ifinfo +of the subinterval as the +realisation of a discrete random variate with probabilities +proportional to the area below the hat. +@item +Generate a random variate +@iftex +@math{X} +@end iftex +@ifhtml +@html +X +@end html +@end ifhtml +@ifinfo +@math{X} +@end ifinfo +proportional to the hat in +interval +@iftex +@math{J.} +@end iftex +@ifhtml +@html +J. +@end html +@end ifhtml +@ifinfo +@math{J.} +@end ifinfo +@item +Generate the +@iftex +@math{U(0,f(X))} +@end iftex +@ifhtml +@html +U(0,f(X)) +@end html +@end ifhtml +@ifinfo +@math{U(0,f(X))} +@end ifinfo +random number +@iftex +@math{Y.} +@end iftex +@ifhtml +@html +Y. +@end html +@end ifhtml +@ifinfo +@math{Y.} +@end ifinfo +@item +If +@iftex +@math{Y\leq f(X)} +@end iftex +@ifhtml +@html +Y <= f(X) +@end html +@end ifhtml +@ifinfo +@math{Y <= f(X)} +@end ifinfo +accept +@iftex +@math{X} +@end iftex +@ifhtml +@html +X +@end html +@end ifhtml +@ifinfo +@math{X} +@end ifinfo +as random variate. +@item +Else start again with generating the index +@iftex +@math{J.} +@end iftex +@ifhtml +@html +J. +@end html +@end ifhtml +@ifinfo +@math{J.} +@end ifinfo +@end enumerate + +The first step can be done in constant time (i.e., independent of +the number of chosen subintervals) by means of the indexed search +method (@pxref{IndexedSearch}). + +It is possible to reduce the number of uniform random numbers +required in the above algorithm by recycling the random numbers +used in Step 1 and additionally by applying the principle of +@emph{immediate acceptance}. +For details see +@ifhtml +@ref{bib:HLD04,, [HLD04: Sect. 3.1]} +@end ifhtml +@ifnothtml +[HLD04: Sect. 3.1] +@end ifnothtml +. + + + +@c +@c end of arvag.dh +@c ------------------------------------- +@c ------------------------------------- +@c arvag.dh +@c + +@node Ratio-of-Uniforms +@section The Ratio-of-Uniforms Method + + + +The construction of an appropriate hat function for the given +density is the crucial step for constructing rejection algorithms. +Equivalently we can try to find an appropriate envelope for the region +between the graph of the density and the @i{x}-axis, such +that we can easily sample uniformly distributed random points. +This task could become easier if we can find transformations that map +the region between the density and the axis into a region of more +suitable shape (for example into a bounded region). + +As a first example we consider the following simple algorithm for +the Cauchy distribution. +@enumerate +@item +Generate a +@iftex +@math{U(-1,1)} +@end iftex +@ifhtml +@html +U(-1,1) +@end html +@end ifhtml +@ifinfo +@math{U(-1,1)} +@end ifinfo +random number +@iftex +@math{U} +@end iftex +@ifhtml +@html +U +@end html +@end ifhtml +@ifinfo +@math{U} +@end ifinfo +and a +@iftex +@math{U(0,1)} +@end iftex +@ifhtml +@html +U(0,1) +@end html +@end ifhtml +@ifinfo +@math{U(0,1)} +@end ifinfo +random number +@iftex +@math{V.} +@end iftex +@ifhtml +@html +V. +@end html +@end ifhtml +@ifinfo +@math{V.} +@end ifinfo +@item +If +@iftex +@math{U^2 + V^2\leq 1} +@end iftex +@ifhtml +@html +U2 + V2 <= 1 +@end html +@end ifhtml +@ifinfo +@math{U^2 + V^2 <= 1} +@end ifinfo +accept +@iftex +@math{X=U/V} +@end iftex +@ifhtml +@html +X=U/V +@end html +@end ifhtml +@ifinfo +@math{X=U/V} +@end ifinfo +as a Cauchy +random variate. +@item +Else try again. +@end enumerate + +It is possible to prove that the above algorithm indeed generates +Cauchy random variates. The fundamental principle behind this +algorithm is the fact that the region below the density is mapped +by the transformation +@iftex + +@quotation +@math{(X,Y)\mapsto(U,V)=(2\,X\sqrt{Y},2\,\sqrt{Y})} +@end quotation + +@end iftex +@ifhtml +@quotation +@html +(X,Y) -> (U,V)=(2 Xsqrt(Y),2 sqrt(Y)) +@end html +@end quotation +@end ifhtml +@ifinfo +@quotation +@math{(X,Y) -> (U,V)=(2 Xsqrt(Y),2 sqrt(Y))} +@end quotation +@end ifinfo + +@noindent +into a half-disc in such a way that the ratio between the area of +the image to the area of the preimage is constant. This is due to +the fact that that the Jacobian of this transformation is constant. + + +@image{figures/rou-cauchy} + + + +The above example is a special case of a more general principle, +called the @emph{Ratio-of-uniforms (RoU) method}. It is based on +the fact that for a random variable +@iftex +@math{X} +@end iftex +@ifhtml +@html +X +@end html +@end ifhtml +@ifinfo +@math{X} +@end ifinfo +with density +@iftex +@math{f(x)} +@end iftex +@ifhtml +@html +f(x) +@end html +@end ifhtml +@ifinfo +@math{f(x)} +@end ifinfo +and some constant +@iftex +@math{\mu} +@end iftex +@ifhtml +@html +mu +@end html +@end ifhtml +@ifinfo +@math{mu} +@end ifinfo +we can generate +@iftex +@math{X} +@end iftex +@ifhtml +@html +X +@end html +@end ifhtml +@ifinfo +@math{X} +@end ifinfo +from the desired density by calculating +@iftex +@math{X=U/V+\mu} +@end iftex +@ifhtml +@html +X=U/V+ mu +@end html +@end ifhtml +@ifinfo +@math{X=U/V+ mu} +@end ifinfo +for a pair +@iftex +@math{(U,V)} +@end iftex +@ifhtml +@html +(U,V) +@end html +@end ifhtml +@ifinfo +@math{(U,V)} +@end ifinfo +uniformly +distributed in the set +@iftex + +@quotation +@math{A_f=\lbrace (u,v)\colon 0 < v \leq \sqrt{f(u/v+\mu)}\rbrace .} +@end quotation + +@end iftex +@ifhtml +@quotation +@html +A_f= @{ (u,v) : 0 < v <= sqrt(f(u/v+ mu)) @} . +@end html +@end quotation +@end ifhtml +@ifinfo +@quotation +@math{A_f= @{ (u,v) : 0 < v <= sqrt(f(u/v+ mu)) @} .} +@end quotation +@end ifinfo + +@noindent +For most distributions it is best to set the constant +@iftex +@math{\mu} +@end iftex +@ifhtml +@html +mu +@end html +@end ifhtml +@ifinfo +@math{mu} +@end ifinfo +equal to the mode of the distribution. For sampling +random points uniformly distributed in +@iftex +@math{A_f} +@end iftex +@ifhtml +@html +A_f +@end html +@end ifhtml +@ifinfo +@math{A_f} +@end ifinfo +rejection +from a convenient enveloping region is used, usually the minimal +bounding rectangle, i.e., the smallest possible rectangle that +contains +@iftex +@math{A_f} +@end iftex +@ifhtml +@html +A_f +@end html +@end ifhtml +@ifinfo +@math{A_f} +@end ifinfo +(see the above figure). +It is given by +@iftex +@math{(u^-,u^+)\times (0,v^+)} +@end iftex +@ifhtml +@html +(u-,u+)x(0,v+) +@end html +@end ifhtml +@ifinfo +@math{(u^-,u^+)x(0,v^+)} +@end ifinfo +where +@iftex + +@quotation +@math{ v^+ = \sup\limits_{b_lv+ = sup_b_l<x<b_r sqrt(f(x)), @*u- = inf_b_l<x<b_r (x- mu) sqrt(f(x)), @*u+ = sup_b_l<x<b_r (x- mu) sqrt(f(x)). +@end html +@end quotation +@end ifhtml +@ifinfo +@quotation +@math{v^+ = sup_(b_lU(u-,u+) +@end html +@end ifhtml +@ifinfo +@math{U(u^-,u^+)} +@end ifinfo +random number +@iftex +@math{U} +@end iftex +@ifhtml +@html +U +@end html +@end ifhtml +@ifinfo +@math{U} +@end ifinfo +and a +@iftex +@math{U(0,v^+)} +@end iftex +@ifhtml +@html +U(0,v+) +@end html +@end ifhtml +@ifinfo +@math{U(0,v^+)} +@end ifinfo +random number +@iftex +@math{V.} +@end iftex +@ifhtml +@html +V. +@end html +@end ifhtml +@ifinfo +@math{V.} +@end ifinfo +@item +Set +@iftex +@math{X} +@end iftex +@ifhtml +@html +X +@end html +@end ifhtml +@ifinfo +@math{X} +@end ifinfo +to +@iftex +@math{U/V+\mu.} +@end iftex +@ifhtml +@html +U/V+ mu. +@end html +@end ifhtml +@ifinfo +@math{U/V+ mu.} +@end ifinfo +@item +If +@iftex +@math{V^2 \leq f(X)} +@end iftex +@ifhtml +@html +V2 <= f(X) +@end html +@end ifhtml +@ifinfo +@math{V^2 <= f(X)} +@end ifinfo +accept +@iftex +@math{X} +@end iftex +@ifhtml +@html +X +@end html +@end ifhtml +@ifinfo +@math{X} +@end ifinfo +as the random +variate. +@item +Else try again. +@end enumerate + +To apply the ratio-of-uniforms algorithm to a certain density +we have to solve the simple optimization problems in the +definitions above to obtain the design constants +@iftex +@math{u^-,} +@end iftex +@ifhtml +@html +u-, +@end html +@end ifhtml +@ifinfo +@math{u^-,} +@end ifinfo +@iftex +@math{u^+,} +@end iftex +@ifhtml +@html +u+, +@end html +@end ifhtml +@ifinfo +@math{u^+,} +@end ifinfo +and +@iftex +@math{v^+.} +@end iftex +@ifhtml +@html +v+. +@end html +@end ifhtml +@ifinfo +@math{v^+.} +@end ifinfo +This simple algorithm works for all distributions +with bounded densities that have subquadratic tails (i.e., +tails like +@iftex +@math{1/x^2} +@end iftex +@ifhtml +@html +1/x2 +@end html +@end ifhtml +@ifinfo +@math{1/x^2} +@end ifinfo +or lower). For most standard +distributions it has quite good rejection constants. +(E.g. 1.3688 for the normal and 1.4715 for the exponential +distribution.) + +Nevertheless, we use more sophisticated method that construct +better fitting envelopes, like method AROU (@pxref{AROU}), or even +avoid the computation of these design constants and thus have +almost no setup, like method SROU (@pxref{SROU}). + +@subheading The Generalized Ratio-of-Uniforms Method + +The Ratio-of-Uniforms method can be generalized: If a point +@iftex +@math{(U,V)} +@end iftex +@ifhtml +@html +(U,V) +@end html +@end ifhtml +@ifinfo +@math{(U,V)} +@end ifinfo +is uniformly distributed in the set +@iftex + +@quotation +@math{A_f=\lbrace (u,v)\colon 0 < v \leq (f(u/v^r+\mu))^{1/(r+1)}\rbrace } +@end quotation + +@end iftex +@ifhtml +@quotation +@html +A_f= @{ (u,v) : 0 < v <= (f(u/vr+ mu))1/(r+1) @} +@end html +@end quotation +@end ifhtml +@ifinfo +@quotation +@math{A_f= @{ (u,v) : 0 < v <= (f(u/v^r+ mu))^(1/(r+1)) @}} +@end quotation +@end ifinfo + +@noindent +then +@iftex +@math{X=U/V^r+\mu} +@end iftex +@ifhtml +@html +X=U/Vr+ mu +@end html +@end ifhtml +@ifinfo +@math{X=U/V^r+ mu} +@end ifinfo +has the denity +@iftex +@math{f(x).} +@end iftex +@ifhtml +@html +f(x). +@end html +@end ifhtml +@ifinfo +@math{f(x).} +@end ifinfo +The minimal bounding rectangle of this region is given by +@iftex +@math{(u^-,u^+)\times (0,v^+)} +@end iftex +@ifhtml +@html +(u-,u+)x(0,v+) +@end html +@end ifhtml +@ifinfo +@math{(u^-,u^+)x(0,v^+)} +@end ifinfo +where +@iftex + +@quotation +@math{ v^+ = \sup\limits_{b_lv+ = sup_b_l<x<b_r (f(x))1/(r+1), @*u- = inf_b_l<x<b_r (x- mu) (f(x))r/(r+1), @*u+ = sup_b_l<x<b_r (x- mu) (f(x))r/(r+1). +@end html +@end quotation +@end ifhtml +@ifinfo +@quotation +@math{v^+ = sup_(b_lr=1. +@end html +@end ifhtml +@ifinfo +@math{r=1.} +@end ifinfo + + + +@c +@c end of arvag.dh +@c ------------------------------------- +@c ------------------------------------- +@c arvag.dh +@c + +@node DiscreteInversion +@section Inversion for Discrete Distributions + + + +We have already presented the idea of the inversion method to +generate from continuous random variables (@pxref{Inversion}). For +a discrete random variable +@iftex +@math{X} +@end iftex +@ifhtml +@html +X +@end html +@end ifhtml +@ifinfo +@math{X} +@end ifinfo +we can write it +mathematically in the same way: +@iftex + +@quotation +@math{X=F^{-1}(U),} +@end quotation + +@end iftex +@ifhtml +@quotation +@html +X=F-1(U), +@end html +@end quotation +@end ifhtml +@ifinfo +@quotation +@math{X=F^(-1)(U),} +@end quotation +@end ifinfo + +@noindent +where +@iftex +@math{F} +@end iftex +@ifhtml +@html +F +@end html +@end ifhtml +@ifinfo +@math{F} +@end ifinfo +is the CDF of the desired distribution and +@iftex +@math{U} +@end iftex +@ifhtml +@html +U +@end html +@end ifhtml +@ifinfo +@math{U} +@end ifinfo +is a uniform +@iftex +@math{U(0,1)} +@end iftex +@ifhtml +@html +U(0,1) +@end html +@end ifhtml +@ifinfo +@math{U(0,1)} +@end ifinfo +random number. The +difference compared to the continuous case is that +@iftex +@math{F} +@end iftex +@ifhtml +@html +F +@end html +@end ifhtml +@ifinfo +@math{F} +@end ifinfo +is +now a step-function. The following figure illustrates the idea of +discrete inversion for a simple distribution. + + +@image{figures/discrete_inversion} + + + +To realize this idea on a computer we have to use a search +algorithm. For the simplest version called @emph{Sequential Search} +the CDF is computed on-the-fly as sum of the probabilities +@iftex +@math{p(k),} +@end iftex +@ifhtml +@html +p(k), +@end html +@end ifhtml +@ifinfo +@math{p(k),} +@end ifinfo +since this is usually much cheaper than computing +the CDF directly. It is obvious that the basic form of the search +algorithm only works for discrete random variables with probability +mass functions +@iftex +@math{p(k)} +@end iftex +@ifhtml +@html +p(k) +@end html +@end ifhtml +@ifinfo +@math{p(k)} +@end ifinfo +for nonnegative +@iftex +@math{k.} +@end iftex +@ifhtml +@html +k. +@end html +@end ifhtml +@ifinfo +@math{k.} +@end ifinfo +The +sequential search algorithm consists of the following basic steps: + +@enumerate +@item +Generate a +@iftex +@math{U(0,1)} +@end iftex +@ifhtml +@html +U(0,1) +@end html +@end ifhtml +@ifinfo +@math{U(0,1)} +@end ifinfo +random number +@iftex +@math{U.} +@end iftex +@ifhtml +@html +U. +@end html +@end ifhtml +@ifinfo +@math{U.} +@end ifinfo +@item +Set +@iftex +@math{X} +@end iftex +@ifhtml +@html +X +@end html +@end ifhtml +@ifinfo +@math{X} +@end ifinfo +to +@iftex +@math{0} +@end iftex +@ifhtml +@html +0 +@end html +@end ifhtml +@ifinfo +@math{0} +@end ifinfo +and +@iftex +@math{P} +@end iftex +@ifhtml +@html +P +@end html +@end ifhtml +@ifinfo +@math{P} +@end ifinfo +to +@iftex +@math{p(0).} +@end iftex +@ifhtml +@html +p(0). +@end html +@end ifhtml +@ifinfo +@math{p(0).} +@end ifinfo +@item +Do while +@iftex +@math{U > P} +@end iftex +@ifhtml +@html +U > P +@end html +@end ifhtml +@ifinfo +@math{U > P} +@end ifinfo +@item +@w{ } @w{ } @w{ } Set +@iftex +@math{X} +@end iftex +@ifhtml +@html +X +@end html +@end ifhtml +@ifinfo +@math{X} +@end ifinfo +to +@iftex +@math{X+1} +@end iftex +@ifhtml +@html +X+1 +@end html +@end ifhtml +@ifinfo +@math{X+1} +@end ifinfo +and +@iftex +@math{P} +@end iftex +@ifhtml +@html +P +@end html +@end ifhtml +@ifinfo +@math{P} +@end ifinfo +to +@iftex +@math{P+p(X).} +@end iftex +@ifhtml +@html +P+p(X). +@end html +@end ifhtml +@ifinfo +@math{P+p(X).} +@end ifinfo +@item +Return +@iftex +@math{X.} +@end iftex +@ifhtml +@html +X. +@end html +@end ifhtml +@ifinfo +@math{X.} +@end ifinfo +@end enumerate + +With the exception of some very simple discrete distributions, +sequential search algorithms become very slow as the while-loop has +to be repeated very often. The expected number of iterations, +i.e., the number of comparisons in the while condition, is equal to +the expectation of the distribution plus +@iftex +@math{1.} +@end iftex +@ifhtml +@html +1. +@end html +@end ifhtml +@ifinfo +@math{1.} +@end ifinfo +It can therefore become arbitrary large or even infinity if the tail +of the distribution is very heavy. Another serious problem can be +critical round-off errors due to summing up many probabilities +@iftex +@math{p(k).} +@end iftex +@ifhtml +@html +p(k). +@end html +@end ifhtml +@ifinfo +@math{p(k).} +@end ifinfo +To speed up the search procedure it is best to use +indexed search. + + + +@c +@c end of arvag.dh +@c ------------------------------------- +@c ------------------------------------- +@c arvag.dh +@c + +@node IndexedSearch +@section Indexed Search (Guide Table Method) + + + +The idea to speed up the sequential search algorithm is easy to +understand. Instead of starting always at +@iftex +@math{0} +@end iftex +@ifhtml +@html +0 +@end html +@end ifhtml +@ifinfo +@math{0} +@end ifinfo +we store a +table of size +@iftex +@math{C} +@end iftex +@ifhtml +@html +C +@end html +@end ifhtml +@ifinfo +@math{C} +@end ifinfo +with starting points for our search. For +this table we compute +@iftex +@math{F^{-1}(U)} +@end iftex +@ifhtml +@html +F-1(U) +@end html +@end ifhtml +@ifinfo +@math{F^(-1)(U)} +@end ifinfo +for +@iftex +@math{C} +@end iftex +@ifhtml +@html +C +@end html +@end ifhtml +@ifinfo +@math{C} +@end ifinfo +equidistributed values of +@iftex +@math{U,} +@end iftex +@ifhtml +@html +U, +@end html +@end ifhtml +@ifinfo +@math{U,} +@end ifinfo +i.e., +for +@iftex +@math{u_i = i/C,} +@end iftex +@ifhtml +@html +u_i = i/C, +@end html +@end ifhtml +@ifinfo +@math{u_i = i/C,} +@end ifinfo +@iftex +@math{i=0,...,C-1.} +@end iftex +@ifhtml +@html +i=0,...,C-1. +@end html +@end ifhtml +@ifinfo +@math{i=0,...,C-1.} +@end ifinfo +Such a table is +called @emph{guide table} or @emph{hash table}. +Then it is easy to prove that for every +@iftex +@math{U} +@end iftex +@ifhtml +@html +U +@end html +@end ifhtml +@ifinfo +@math{U} +@end ifinfo +in +@iftex +@math{(0,1)} +@end iftex +@ifhtml +@html +(0,1) +@end html +@end ifhtml +@ifinfo +@math{(0,1)} +@end ifinfo +the guide table entry for +@iftex +@math{k=floor(UC)} +@end iftex +@ifhtml +@html +k=floor(UC) +@end html +@end ifhtml +@ifinfo +@math{k=floor(UC)} +@end ifinfo +is bounded by +@iftex +@math{F^{-1}(U).} +@end iftex +@ifhtml +@html +F-1(U). +@end html +@end ifhtml +@ifinfo +@math{F^(-1)(U).} +@end ifinfo +This shows that we can really +start our sequential search procedure from the table entry for +@iftex +@math{k} +@end iftex +@ifhtml +@html +k +@end html +@end ifhtml +@ifinfo +@math{k} +@end ifinfo +and the index +@iftex +@math{k} +@end iftex +@ifhtml +@html +k +@end html +@end ifhtml +@ifinfo +@math{k} +@end ifinfo +of the correct table entry +can be found rapidly by means of the truncation operation. + +The two main differences between @emph{indexed search} and +@emph{sequential search} are that we start searching at the number +determined by the guide table, and that we have to compute and +store the cumulative probabilities in the setup as we have to know +the cumulative probability for the starting point of the search +algorithm. The rounding problems that can occur in the sequential +search algorithm can occur here as well. +Compared to sequential search we have now the obvious drawback +of a slow setup. The computation of the cumulative probabilities +grows linear with the size of the domain of the distribution +@iftex +@math{L.} +@end iftex +@ifhtml +@html +L. +@end html +@end ifhtml +@ifinfo +@math{L.} +@end ifinfo +What we gain is really high speed as the marginal +execution time of the sampling algorithm becomes very small. The +expected number of comparisons is bounded by +@iftex +@math{1+L/C.} +@end iftex +@ifhtml +@html +1+L/C. +@end html +@end ifhtml +@ifinfo +@math{1+L/C.} +@end ifinfo +This shows that there is a trade-off between speed and +the size of the guide table. Cache-effects in modern computers will +however slow down the speed-up for really large table sizes. +Thus we recommend to use a guide table that is about two times +larger than the probability vector to obtain optimal speed. + + + +@c +@c end of arvag.dh +@c ------------------------------------- +@c ------------------------------------- +@c glossary.dh +@c + +@node Glossary +@appendix Glossary + + + +@table @strong + +@item CDF +cumulative distribution function. + +@item HR +hazard rate (or failure rate). + +@item inverse local concavity +local concavity of inverse PDF +@iftex +@math{f^{-1}(y)} +@end iftex +@ifhtml +@html +f-1(y) +@end html +@end ifhtml +@ifinfo +@math{f^(-1)(y)} +@end ifinfo +expressed in term of +@iftex +@math{x = f^{-1}(y).} +@end iftex +@ifhtml +@html +x = f-1(y). +@end html +@end ifhtml +@ifinfo +@math{x = f^(-1)(y).} +@end ifinfo +Is is given by +@iftex +@math{ilc_f(x) = 1 + x\,f''(x) / f'(x)} +@end iftex +@ifhtml +@html +ilc_f(x) = 1 + x f''(x) / f'(x) +@end html +@end ifhtml +@ifinfo +@math{ilc_f(x) = 1 + x f''(x) / f'(x)} +@end ifinfo + +@item local concavity +maximum value of @i{c} such that PDF @i{f(x)} is +@iftex +@math{T_c.} +@end iftex +@ifhtml +@html +T_c. +@end html +@end ifhtml +@ifinfo +@math{T_c.} +@end ifinfo +Is is given by +@iftex +@math{lc_f(x) = 1 - f''(x)\,f(x) / f'(x)^2} +@end iftex +@ifhtml +@html +lc_f(x) = 1 - f''(x) f(x) / f'(x)2 +@end html +@end ifhtml +@ifinfo +@math{lc_f(x) = 1 - f''(x) f(x) / f'(x)^2} +@end ifinfo + +@item PDF +probability density function. + +@item dPDF +derivative (gradient) of probability density function. + +@item PMF +probability mass function. + +@item PV +(finite) probability vector. + +@item URNG +uniform random number generator. + +@item @math{U(a,b)} +continuous uniform distribution on the interval +@iftex +@math{(a,b).} +@end iftex +@ifhtml +@html +(a,b). +@end html +@end ifhtml +@ifinfo +@math{(a,b).} +@end ifinfo + +@item T-concave +a function @i{f(x)} is called @i{T}-convace if the transformed function +@i{T(f(x))} is concave. +We only deal with transformations +@iftex +@math{T_c,} +@end iftex +@ifhtml +@html +T_c, +@end html +@end ifhtml +@ifinfo +@math{T_c,} +@end ifinfo +where +@table @code +@item @i{c} = 0 +@iftex +@math{T(x) = \log(x)} +@end iftex +@ifhtml +@html +T(x) = log(x) +@end html +@end ifhtml +@ifinfo +@math{T(x) = log(x)} +@end ifinfo +@item @i{c} = @math{-0.5} +@iftex +@math{T(x) = -1/\sqrt{x}} +@end iftex +@ifhtml +@html +T(x) = -1/sqrt(x) +@end html +@end ifhtml +@ifinfo +@math{T(x) = -1/sqrt(x)} +@end ifinfo +@item @i{c} != 0 +@iftex +@math{T(x) = sign(x) \cdot x^c} +@end iftex +@ifhtml +@html +T(x) = sign(x) * xc +@end html +@end ifhtml +@ifinfo +@math{T(x) = sign(x) * x^c} +@end ifinfo +@end table + +@item u-error +for a given approximate inverse CDF +@iftex +@math{X=G^{-1}(U)} +@end iftex +@ifhtml +@html +X=G-1(U) +@end html +@end ifhtml +@ifinfo +@math{X=G^(-1)(U)} +@end ifinfo +the u-error is given as +@iftex + +@quotation +@math{uerror = |U-F(G^{-1}(U))|} +@end quotation + +@end iftex +@ifhtml +@quotation +@html +uerror = |U-F(G-1(U))| +@end html +@end quotation +@end ifhtml +@ifinfo +@quotation +@math{uerror = |U-F(G^(-1)(U))|} +@end quotation +@end ifinfo + +@noindent +where +@iftex +@math{F} +@end iftex +@ifhtml +@html +F +@end html +@end ifhtml +@ifinfo +@math{F} +@end ifinfo +denotes the exact CDF. +Goodness-of-fit tests like the Kolmogorov-Smirnov test or the +chi-squared test look at this type of error. +See @ref{Inversion} for more details. + +@item u-resolution +the maximal tolerated u-error for an approximate inverse CDF. + +@item x-error +for a given approximate inverse CDF +@iftex +@math{X=G^{-1}(U)} +@end iftex +@ifhtml +@html +X=G-1(U) +@end html +@end ifhtml +@ifinfo +@math{X=G^(-1)(U)} +@end ifinfo +the x-error is given as +@iftex + +@quotation +@math{xerror = |F^{-1}(U)-G^{-1}(U)|} +@end quotation + +@end iftex +@ifhtml +@quotation +@html +xerror = |F-1(U)-G-1(U)| +@end html +@end quotation +@end ifhtml +@ifinfo +@quotation +@math{xerror = |F^(-1)(U)-G^(-1)(U)|} +@end quotation +@end ifinfo + +@noindent +where +@iftex +@math{F^{-1}} +@end iftex +@ifhtml +@html +F-1 +@end html +@end ifhtml +@ifinfo +@math{F^(-1)} +@end ifinfo +denotes the exact inverse CDF. +The x-error measure the deviation of +@iftex +@math{G^{-1}(U)} +@end iftex +@ifhtml +@html +G-1(U) +@end html +@end ifhtml +@ifinfo +@math{G^(-1)(U)} +@end ifinfo +from the exact result. +Notice that we have to distinguish between @emph{absolute} and +@emph{relative} x-error. In UNU.RAN we use the absolute x-error near 0 +and the relative x-error otherwise. +See @ref{Inversion} for more details. + +@item x-resolution +the maximal tolerated x-error for an approximate inverse CDF. + +@end table + + + +@c +@c end of glossary.dh +@c ------------------------------------- +@c ------------------------------------- +@c references.dh +@c + +@node Bibliography +@appendix Bibliography + + + +@subheading Standard Distributions + +@table @t + +@anchor{bib:JKKa92} +@item [JKKa92] +@sc{N.L. Johnson, S. Kotz, and A.W. Kemp} (1992). +@i{Univariate Discrete Distributions}, +2nd edition, +John Wiley & Sons, Inc., New York. + +@anchor{bib:JKBb94} +@item [JKBb94] +@sc{N.L. Johnson, S. Kotz, and N. Balakrishnan} (1994). +@i{Continuous Univariate Distributions}, +Volume 1, +2nd edition, +John Wiley & Sons, Inc., New York. + +@anchor{bib:JKBc95} +@item [JKBc95] +@sc{N.L. Johnson, S. Kotz, and N. Balakrishnan} (1995). +@i{Continuous Univariate Distributions}, +Volume 2, +2nd edition, +John Wiley & Sons, Inc., New York. + +@anchor{bib:JKBd97} +@item [JKBd97] +@sc{N.L. Johnson, S. Kotz, and N. Balakrishnan} (1997). +@i{Discrete Multivariate Distributions}, +John Wiley & Sons, Inc., New York. + +@anchor{bib:KBJe00} +@item [KBJe00] +@sc{S. Kotz, N. Balakrishnan, and N.L. Johnson} (2000). +@i{Continuous Multivariate Distributions}, +Volume 1: Models and Applications, +John Wiley & Sons, Inc., New York. + +@end table + +@c ------------------------------------------------------- + +@subheading Universal Methods -- Surveys + +@table @t + +@anchor{bib:HLD04} +@item [HLD04] +@sc{W. H@"ormann, J. Leydold, and G. Derflinger} (2004). +@i{Automatic Nonuniform Random Variate Generation}, +Springer, Berlin. + +@end table + +@c ------------------------------------------------------- + +@subheading Universal Methods + +@table @t + +@anchor{bib:AJa93} +@item [AJa93] +@sc{J.H. Ahrens} (1993). +@i{Sampling from general distributions by suboptimal division of domains}, +Grazer Math. Berichte 319, 30pp. + +@anchor{bib:AJa95} +@item [AJa95] +@sc{J.H. Ahrens} (1995). +@i{An one-table method for sampling from continuous and discrete distributions}, +Computing 54(2), pp. 127-146. + +@anchor{bib:CAa74} +@item [CAa74] +@sc{H.C. Chen and Y. Asau} (1974). +@i{On generating random variates from an empirical distribution}, +AIIE Trans. 6, pp. 163-166. + +@anchor{bib:DHLa08} +@item [DHLa08] +@sc{G. Derflinger, W. H@"ormann, and J. Leydold} (2008). +@i{Numerical inversion when only the density function is known}, +Research Report Series of the Department of Statistics and Mathematics 78, +WU Wien, Augasse 2--6, A-1090 Wien, Austria, +@uref{http://epub.wu.ac.at/english/}. + +@anchor{bib:DLa86} +@item [DLa86] +@sc{L. Devroye} (1986). +@i{Non-Uniform Random Variate Generation}, +Springer Verlag, New York. + +@anchor{bib:GWa92} +@item [GWa92] +@sc{W.R. Gilks and P. Wild} (1992). +@i{Adaptive rejection sampling for Gibbs sampling}, +Applied Statistics 41, pp. 337-348. + +@anchor{bib:HWa95} +@item [HWa95] +@sc{W. H@"ormann} (1995). +@i{A rejection technique for sampling from T-concave distributions}, +ACM Trans. Math. Software 21(2), pp. 182-193. + +@anchor{bib:HDa96} +@item [HDa96] +@sc{W. H@"ormann and G. Derflinger} (1996). +@i{Rejection-inversion to generate variates from monotone discrete distributions}, +ACM TOMACS 6(3), 169-184. + +@anchor{bib:HLa00} +@item [HLa00] +@sc{W. H@"ormann and J. Leydold} (2000). +@i{Automatic random variate generation for simulation input.} +In: J.A. Joines, R. Barton, P. Fishwick, K. Kang (eds.), +Proceedings of the 2000 Winter Simulation Conference, pp. 675-682. + +@anchor{bib:HLa03} +@item [HLa03] +@sc{W. H@"ormann and J. Leydold} (2003). +@i{Continuous Random Variate Generation by Fast Numerical Inversion}, +ACM TOMACS 13(4), 347-362. + +@anchor{bib:HLDa07} +@item [HLDa07] +@sc{W. H@"ormann, J. Leydold, and G. Derflinger} (2007). +@i{Automatic Random Variate Generation for Unbounded Densities}, +ACM Trans. Model. Comput. Simul. 17(4), pp.18. + +@anchor{bib:KLPa05} +@item [KLPa05] +@sc{R. Karawatzki, J. Leydold, and K. P@"otzelberger} (2005). +@i{Automatic Markov chain Monte Carlo procedures for sampling from multivariate distributions}, +Research Report Series of the Department of Statistics and Mathematics 27, +WU Wien, Augasse 2--6, A-1090 Wien, Austria, +@uref{http://epub.wu.ac.at/english/}. + +@anchor{bib:LJa98} +@item [LJa98] +@sc{J. Leydold} (1998). +@i{A Rejection Technique for Sampling from Log-Concave Multivariate Distributions}, +ACM TOMACS 8(3), pp. 254-280. + +@anchor{bib:LJa00} +@item [LJa00] +@sc{J. Leydold} (2000). +@i{Automatic Sampling with the Ratio-of-Uniforms Method}, +ACM Trans. Math. Software 26(1), pp. 78-98. + +@anchor{bib:LJa01} +@item [LJa01] +@sc{J. Leydold} (2001). +@i{A simple universal generator for continuous and discrete +univariate T-concave distributions}, +ACM Trans. Math. Software 27(1), pp. 66-82. + +@anchor{bib:LJa02} +@item [LJa02] +@sc{J. Leydold} (2003). +@i{Short universal generators via generalized ratio-of-uniforms method}, +Math. Comp. 72(243), pp. 1453-1471. + +@anchor{bib:WGS91} +@item [WGS91] +@sc{J.C. Wakefield, A.E. Gelfand, and A.F.M. Smith} (1992). +@i{Efficient generation of random variates via the ratio-of-uniforms method}, +Statist. Comput. 1(2), pp. 129-133. + +@anchor{bib:WAa77} +@item [WAa77] +@sc{A.J. Walker} (1977). +@i{An efficient method for generating discrete random variables with general distributions}, +ACM Trans. Math. Software 3, pp. 253-256. + +@end table + +@c ------------------------------------------------------- + +@subheading Special Generators + +@table @t + +@anchor{bib:ADa74} +@item [ADa74] +@sc{J.H. Ahrens, U. Dieter} (1974). +@i{Computer methods for sampling from gamma, beta, Poisson +and binomial distributions}, +Computing 12, 223-246. + +@anchor{bib:ADa82} +@item [ADa82] +@sc{J.H. Ahrens, U. Dieter} (1982). +@i{Generating gamma variates by a modified rejection technique}, +Communications of the ACM 25, 47-54. + +@anchor{bib:ADb82} +@item [ADb82] +@sc{J.H. Ahrens, U. Dieter} (1982). +@i{Computer generation of Poisson deviates from modified normal distributions}, +ACM Trans. Math. Software 8, 163-179. + +@anchor{bib:BMa58} +@item [BMa58] +@sc{G.E.P. Box and M.E. Muller} (1958). +@i{A note on the generation of random normal deviates}, +Annals Math. Statist. 29, 610-611. + +@anchor{bib:CHa77} +@item [CHa77] +@sc{R.C.H. Cheng} (1977). +@i{The Generation of Gamma Variables with Non-Integral Shape Parameter}, +Appl. Statist. 26(1), 71-75. + +@anchor{bib:Dag89} +@item [Dag89] +@sc{J.S. Dagpunar} (1989). +@i{An Easily Implemented Generalised Inverse Gaussian Generator}, +Commun. Statist. Simul. 18(2), 703-710. + +@anchor{bib:HDa90} +@item [HDa90] +@sc{W. H@"ormann and G. Derflinger} (1990). +@i{The ACR Method for generating normal random variables}, +OR Spektrum 12, 181-185. + +@anchor{bib:KAa81} +@item [KAa81] +@sc{A.W. Kemp} (1981). +@i{Efficient generation of logarithmically distributed +pseudo-random variables}, +Appl. Statist. 30, 249-253. + +@anchor{bib:KRa76} +@item [KRa76] +@sc{A.J. Kinderman and J.G. Ramage} (1976). +@i{Computer Generation of Normal Random Variables}, +J. Am. Stat. Assoc. 71(356), 893 - 898. + +@anchor{bib:MJa87} +@item [MJa87] +@sc{J.F. Monahan} (1987). +@i{An algorithm for generating chi random variables}, +ACM Trans. Math. Software 13, 168-172. + +@anchor{bib:MGa62} +@item [MGa62] +@sc{G. Marsaglia} (1962). +@i{Improving the Polar Method for Generating a Pair of Random Variables}, +Boeing Sci. Res. Lab., Seattle, Washington. + +@anchor{bib:MOa84} +@item [MOa84] +@sc{G. Marsaglia and I. Olkin} (1984). +@i{Generating Correlation Matrices}, +SIAM J. Sci. Stat. Comput 5, 470-475. + +@anchor{bib:STa89} +@item [STa89] +@sc{E. Stadlober} (1989). +@i{Sampling from Poisson, binomial and hypergeometric distributions: +ratio of uniforms as a simple and fast alternative}, +Bericht 303, Math. Stat. Sektion, +Forschungsgesellschaft Joanneum, Graz. + +@anchor{bib:ZHa94} +@item [ZHa94] +@sc{H. Zechner} (1994). +@i{Efficient sampling from continuous and discrete unimodal distributions}, +Pd.D. Thesis, 156 pp., Technical University Graz, Austria. + +@end table + +@c ------------------------------------------------------- + +@subheading Other references + +@table @t + +@anchor{bib:CPa76} +@item [CPa76] +@sc{R. Cranley and T.N.L. Patterson} (1976). +@i{Randomization of number theoretic methods for multiple integration}, +SIAM J. Num. Anal., Vol. 13, pp. 904-914. + +@anchor{bib:HJa61} +@item [HJa61] +@sc{R. Hooke and T.A. Jeeves} (1961). +@i{Direct Search Solution of Numerical and Statistical Problems}, +Journal of the ACM, Vol. 8, April 1961, pp. 212-229. + +@end table + +@c ------------------------------------------------------- + + + +@c +@c end of references.dh +@c ------------------------------------- +@c ------------------------------------- +@c index.dh +@c + +@node FIndex +@appendix Function Index + + +@printindex fn + + + +@c +@c end of index.dh +@c ------------------------------------- diff --git a/vendor/unuran-1.11.0/doc/stamp-1 b/vendor/unuran-1.11.0/doc/stamp-1 new file mode 100644 index 0000000..885c611 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/stamp-1 @@ -0,0 +1,4 @@ +@set UPDATED 21 April 2023 +@set UPDATED-MONTH April 2023 +@set EDITION 1.11.0 +@set VERSION 1.11.0 diff --git a/vendor/unuran-1.11.0/doc/stamp-vti b/vendor/unuran-1.11.0/doc/stamp-vti new file mode 100644 index 0000000..885c611 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/stamp-vti @@ -0,0 +1,4 @@ +@set UPDATED 21 April 2023 +@set UPDATED-MONTH April 2023 +@set EDITION 1.11.0 +@set VERSION 1.11.0 diff --git a/vendor/unuran-1.11.0/doc/unuran.info b/vendor/unuran-1.11.0/doc/unuran.info new file mode 100644 index 0000000..2b3f6b3 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/unuran.info @@ -0,0 +1,16440 @@ +This is unuran.info, produced by makeinfo version 7.0.3 from +unuran.texi. + +Copyright © 2000–2012 Institut fuer Statistik, WU Wien. + +Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. +INFO-DIR-SECTION Scientific software +START-INFO-DIR-ENTRY +* unuran: (unuran). UNU.RAN – Universal Non-Uniform Random number generator +END-INFO-DIR-ENTRY + + +File: unuran.info, Node: Top, Next: Intro, Up: (dir) + +UNU.RAN – Universal Non-Uniform RANdom number generators +******************************************************** + +* Menu: + +* Intro:: Introduction +* Examples:: Examples +* StringAPI:: String Interface +* Distribution_objects:: Handling distribution objects +* Methods:: Methods for generating non-uniform random variates +* URNG:: Using uniform random number generators +* Stddist:: UNU.RAN Library of standard distributions +* Error_Debug:: Error handling and Debugging +* Testing:: Testing +* Misc:: Miscelleanous +* RVG:: A Short Introduction to Random Variate Generation +* Glossary:: Glossary +* Bibliography:: Bibliography +* FIndex:: Function Index + +This is the online-documentation of UNU.RAN. +Version: 1.11.0 +Date: 21 April 2023 + + UNU.RAN (Universal Non-Uniform RAndom Number generator) is a +collection of algorithms for generating non-uniform pseudorandom +variates as a library of C functions designed and implemented by the +ARVAG (Automatic Random VAriate Generation) project group in Vienna, and +released under the GNU Public License (GPL). It is especially designed +for such situations where + + − a non-standard distribution or a truncated distribution is needed. + + − experiments with different types of distributions are made. + + − random variates for variance reduction techniques are used. + + − fast generators of predictable quality are necessary. + + Of course it is also well suited for standard distributions. However +due to its more sophisticated programming interface it might not be as +easy to use if you only look for a generator for the standard normal +distribution. (Although UNU.RAN provides generators that are superior +in many aspects to those found in quite a number of other libraries.) + + UNU.RAN implements several methods for generating random numbers. +The choice depends primary on the information about the distribution can +be provided and – if the user is familar with the different methods – on +the preferences of the user. + + The design goals of UNU.RAN are to provide _reliable_, _portable_ and +_robust_ (as far as this is possible) functions with a consisent and +easy to use interface. It is suitable for all situation where +experiments with different distributions including non-standard +distributions. For example it is no problem to replace the normal +distribution by an empirical distribution in a model. + + Since originally designed as a library for so called black-box or +universal algorithms its interface is different from other libraries. +(Nevertheless it also contains special generators for standard +distributions.) It does not provide subroutines for random variate +generation for particular distributions. Instead it uses an +object-oriented interface. Distributions and generators are treated as +independent objects. This approach allows one not only to have +different methods for generating non-uniform random variates. It is +also possible to choose the method which is optimal for a given +situation (e.g. speed, quality of random numbers, using for variance +reduction techniques, etc.). It also allows to sample from non-standard +distribution or even from distributions that arise in a model and can +only be computed in a complicated subroutine. + + Sampling from a particular distribution requires the following steps: + + 1. Create a distribution object. (Objects for standard distributions + are available in the library) + + 2. Choose a method. + + 3. Initialize the generator, i.e., create the generator object. If + the choosen method is not suitable for the given distribution (or + if the distribution object contains too little information about + the distribution) the initialization routine fails and produces an + error message. Thus the generator object does (probably) not + produce false results (random variates of a different + distribution). + + 4. Use this generator object to sample from the distribution. + + There are four types of objects that can be manipulated +independently: + + • *Distribution objects:* hold all information about the random + variates that should be generated. The following types of + distributions are available: + + − Continuous and Discrete distributions + − Empirical distributions + − Multivariate distributions + + Of course a library of standard distributions is included (and + these can be further modified to get, e.g., truncated + distributions). Moreover the library provides subroutines to build + almost arbitrary distributions. + + • *Generator objects:* hold the generators for the given + distributions. It is possible to build independent generator + objects for the same distribution object which might use the same + or different methods for generation. (If the choosen method is not + suitable for the given method, a ‘NULL’ pointer is returned in the + initialization step). + + • *Parameter objects:* Each transformation method requires several + parameters to adjust the generator to a given distribution. The + parameter object holds all this information. When created it + contains all necessary default settings. It is only used to create + a generator object and destroyed immediately. Altough there is no + need to change these parameters or even know about their existence + for “usual distributions”, they allow a fine tuning of the + generator to work with distributions with some awkward properties. + The library provides all necessary functions to change these + default parameters. + + • *Uniform Random Number Generators:* All generator objects need one + (or more) streams of uniform random numbers that are transformed + into random variates of the given distribution. These are given as + pointers to appropriate functions or structures (objects). Two + generator objects may have their own uniform random number + generators or share a common one. Any functions that produce + uniform (pseudo-) random numbers can be used. We suggest Otmar + Lendl’s PRNG library. + + +File: unuran.info, Node: Intro, Next: Examples, Prev: Top, Up: Top + +1 Introduction +************** + +* Menu: + +* UsageDoc:: Usage of this document +* Installation:: Installation +* UsageLib:: Using the library +* Concepts:: Concepts of UNU.RAN +* Contact:: Contact the authors + + +File: unuran.info, Node: UsageDoc, Next: Installation, Up: Intro + +1.1 Usage of this document +========================== + +We designed this document in a way such that one can use UNU.RAN with +reading as little as necessary. Read *note Installation:: for the +instructions to install the library. *note Concepts of UNU.RAN: +Concepts, discribes the basics of UNU.RAN. It also has a short guideline +for choosing an appropriate method. In *note Examples:: examples are +given that can be copied and modified. They also can be found in the +directory ‘examples’ in the source tree. + + Further information are given in consecutive chapters. *note +Handling distribution objects: Distribution_objects, describes how to +create and manipulate distribution objects. *note standard +distributions: Stddist, describes predefined distribution objects that +are ready to use. *note Methods:: describes the various methods in +detail. For each of possible distribution classes (continuous, +discrete, empirical, multivariate) there exists a short overview section +that can be used to choose an appropriate method followed by sections +that describe each of the particular methods in detail. These are +merely for users with some knowledge about the methods who want to +change method-specific parameters and can be ignored by others. + + Abbreviations and explanation of some basic terms can be found in +*note Glossary::. + + +File: unuran.info, Node: Installation, Next: UsageLib, Prev: UsageDoc, Up: Intro + +1.2 Installation +================ + +UNU.RAN was developed on an Intel architecture under Linux with the GNU +C compiler but should compile and run on any computing environment. It +requires an ANSI compliant C compiler. + + Below find the installation instructions for unices. + +Uniform random number generator +............................... + +UNU.RAN can be used with any uniform random number generator but (at the +moment) some features work best with Pierre L’Ecuyer’s RngStreams +library (see for a +description and downloading. For details on using uniform random number +in UNU.RAN see *note Using uniform random number generators: URNG. + + Install the required libraries first. + +UNU.RAN +....... + + 1. First unzip and untar the package and change to the directory: + + tar zxvf unuran-1.11.0.tar.gz + cd unuran-1.11.0 + + 2. Optional: Edit the file ‘src/unuran_config.h’ + + 3. Run a configuration script: + + sh ./configure --prefix= + + where ‘’ is the root of the installation tree. When + omitted ‘/usr/local’ is used. + + Use ‘./configure --help’ to get a list of other options. In + particular the following flags are important: + + • Enable support for some external sources of uniform random + number generators (*note Using uniform random number + generators: URNG.): + + ‘--with-urng-rngstream’ + URNG: use Pierre L’Ecuyer’s RNGSTREAM library + [default=‘no’] + + ‘--with-urng-prng’ + URNG: use Otmar Lendl’s PRNG library [default=‘no’] + + ‘--with-urng-gsl’ + URNG: use random number generators from GNU Scientific + Library [default=‘no’] + + ‘--with-urng-default’ + URNG: global default URNG (builtin|rngstream) + [default=‘builtin’] + + We strongly recommend to use RngStreams library: + + sh ./configure --with-urng-rngstream --with-urng-default=rngstream + + _Important:_ You must install the respective libraries + ‘RngStreams’, ‘PRNG’ and ‘GSL’ before ‘./configure’ is + executed. + + • Also make a shared library: + + ‘--enable-shared’ + build shared libraries [default=‘no’] + + • The library provides the function ‘unur_gen_info’ for + information about generator objects. This is intented for + using in interactive computing environments. This feature can + be enabled / disabled by means of the configure flag + + ‘--enable-info’ + INFO: provide function with information about generator + objects [default=‘yes’] + + • Enable support for deprecated UNU.RAN routines if you have + some problems with older application after upgrading the + library: + + ‘--enable-deprecated’ + enable support for deprecated UNU.RAN routines + [default=‘no’] + + • Enable debugging tools: + + ‘--enable-check-struct’ + Debug: check validity of pointers to structures + [default=‘no’] + + ‘--enable-logging’ + Debug: print informations about generator into logfile + [default=no] + + 4. Compile and install the libray: + + make + make install + + Obviously ‘$(prefix)/include’ and ‘$(prefix)/lib’ must be in the + search path of your compiler. You can use environment variables to + add these directories to the search path. If you are using the + bash type (or add to your profile): + + export LIBRARY_PATH="/lib" + export C_INCLURE_PATH="/include" + + If you want to make a shared library, then making such a library + can be enabled using + + sh ./configure --enable-shared + + If you want to link against the shared library make sure that it + can be found when executing the binary that links to the library. + If it is not installed in the usual path, then the easiest way is + to set the ‘LD_LIBRARY_PATH’ environment variable. See any + operating system documentation about shared libraries for more + information, such as the ld(1) and ld.so(8) manual pages. + + 5. Documentation in various formats (PDF, HTML, info, plain text) can + be found in directory ‘doc’. + + 6. You can run some tests by + + make check + + However, some of these tests requires the usage of the PRNG or + RngStreams library and are only executed if these are installed + enabled by the corresponding configure flag. + + An extended set of tests is run by + + make fullcheck + + However some of these might fail occasionally due to roundoff + errors or the mysteries of floating point arithmetic, since we have + used some extreme settings to test the library. + +Upgrading +......... + + − _Important:_ + + UNU.RAN now relies on some aspects of IEEE 754 compliant floating + point arithmetic. In particular, ‘1./0.’ and ‘0./0.’ must result + in ‘infinity’ and ‘NaN’ (not a number), respectively, and must not + cause a floating point exception. For allmost all modern compting + architecture this is implemented in hardware. For others there + should be a special compiler flag to get this feature (e.g., + ‘-MIEEE’ on DEC alpha or ‘-mp’ for the Intel C complier). + + − Upgrading UNU.RAN from version 0.9.x or earlier: + + With UNU.RAN version 1.0.x some of the macro definitions in file + ‘src/unuran_config.h’ are moved into file ‘config.h’ and are + set/controlled by the ‘./configure’ script. + + Writting logging information into the logfile must now be enabled + when running the configure script: + + sh ./configure --enable-logging + + − Upgrading UNU.RAN from version 0.7.x or earlier: + + With UNU.RAN version 0.8.0 the interface for changing underlying + distributions and running a reinitialization routine has been + simplified. The old routines can be compiled into the library + using the following configure flag: + + sh ./configure --enable-deprecated + + Notice: Using these deprecated routines is not supported any more + and this strong discouraged. + + Wrapper functions for external sources of uniform random numbers + are now enabled by configure flags and not by macros defined in + file ‘src/unuran_config.h’. + + The file ‘src/unuran_config.h’ is not installed any more. It is + now only included when the library is compiled. It should be + removed from the global include path of the compiler. + + +File: unuran.info, Node: UsageLib, Next: Concepts, Prev: Installation, Up: Intro + +1.3 Using the library +===================== + +ANSI C Compliance +................. + +The library is written in ANSI C and is intended to conform to the ANSI +C standard. It should be portable to any system with a working ANSI C +compiler. + + The library does not rely on any non-ANSI extensions in the interface +it exports to the user. Programs you write using UNU.RAN can be ANSI +compliant. Extensions which can be used in a way compatible with pure +ANSI C are supported, however, via conditional compilation. This allows +the library to take advantage of compiler extensions on those platforms +which support them. + + To avoid namespace conflicts all exported function names and +variables have the prefix ‘unur_’, while exported macros have the prefix +‘UNUR_’. + +Compiling and Linking +..................... + +If you want to use the library you must include the UNU.RAN header file + + #include + +If you also need the test routines then also add + + #include + +If wrapper functions for external sources of uniform random number +generators are used, the corresponding header files must also be +included, e.g., + + #include + +If these header files are not installed on the standard search path of +your compiler you will also need to provide its location to the +preprocessor as a command line flag. The default location of the +‘unuran.h’ is ‘/usr/local/include’. A typical compilation command for a +source file ‘app.c’ with the GNU C compiler ‘gcc’ is, + + gcc -I/usr/local/include -c app.c + +This results in an object file ‘app.o’. The default include path for +‘gcc’ searches ‘/usr/local/include’ automatically so the ‘-I’ option can +be omitted when UNU.RAN is installed in its default location. + + The library is installed as a single file, ‘libunuran.a’. A shared +version of the library is also installed on systems that support shared +libraries. The default location of these files is ‘/usr/local/lib’. To +link against the library you need to specify the main library. The +following example shows how to link an application with the library (and +the the RNGSTREAMS library if you decide to use this source of uniform +pseudo-random numbers), + + gcc app.o -lunuran -lrngstreams -lm + +Shared Libraries +................ + +To run a program linked with the shared version of the library it may be +necessary to define the shell variable ‘LD_LIBRARY_PATH’ to include the +directory where the library is installed. For example, + + LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + +To compile a statically linked version of the program instead, use the +‘-static’ flag in ‘gcc’, + + gcc -static app.o -lunuran -lrngstreams -lm + +Compatibility with C++ +...................... + +The library header files automatically define functions to have ‘extern +"C"’ linkage when included in C++ programs. + + +File: unuran.info, Node: Concepts, Next: Contact, Prev: UsageLib, Up: Intro + +1.4 Concepts of UNU.RAN +======================= + +UNU.RAN is a C library for generating non-uniformly distributed random +variates. Its emphasis is on the generation of non-standard +distribution and on streams of random variates of special purposes. It +is designed to provide a consistent tool to sample from distributions +with various properties. Since there is no universal method that fits +for all situations, various methods for sampling are implemented. + + UNU.RAN solves this complex task by means of an object oriented +programming interface. Three basic objects are used: + + • distribution object ‘UNUR_DISTR’ + Hold all information about the random variates that should be + generated. + + • generator object ‘UNUR_GEN’ + Hold the generators for the given distributions. Two generator + objects are completely independent of each other. They may share a + common uniform random number generator or have their owns. + + • parameter object ‘UNUR_PAR’ + Hold all information for creating a generator object. It is + necessary due to various parameters and switches for each of these + generation methods. + + Notice that the parameter objects only hold pointers to arrays but + do not have their own copy of such an array. Especially, if a + dynamically allocated array is used it _must not_ be freed until + the generator object has been created! + + The idea behind these structures is that creatin distributions, +choosing a generation method and draing samples are orthogonal (ie. +independent) functions of the library. The parameter object is only +introduced due to the necessity to deal with various parameters and +switches for each of these generation methods which are required to +adjust the algorithms to unusual distributions with extreme properties +but have default values that are suitable for most applications. These +parameters and the data for distributions are set by various functions. + + Once a generator object has been created sampling (from the +univariate continuous distribution) can be done by the following +command: + + double x = unur_sample_cont(generator); + +Analogous commands exist for discrete and multivariate distributions. +For detailed examples that can be copied and modified see *note +Examples::. + +Distribution objects +-------------------- + +All information about a distribution are stored in objects (structures) +of type ‘UNUR_DISTR’. UNU.RAN has five different types of distribution +objects: + +‘cont’ + Continuous univariate distributions. +‘cvec’ + Continuous multivariate distributions. +‘discr’ + Discrete univariate distributions. +‘cemp’ + Continuous empirical univariate distribution, ie. given by a + sample. +‘cvemp’ + Continuous empirical multivariate distribution, ie. given by a + sample. +‘matr’ + Matrix distributions. + +Distribution objects can be created from scratch by the following call + + distr = unur_distr__new(); + +where ‘’ is one of the five possible types from the above table. +Notice that these commands only create an _empty_ object which still +must be filled by means of calls for each type of distribution object +(*note Handling distribution objects: Distribution_objects.). The +naming scheme of these functions is designed to indicate the +corresponding type of the distribution object and the task to be +performed. It is demonstated on the following example. + + unur_distr_cont_set_pdf(distr, mypdf); + +This command stores a PDF named ‘mypdf’ in the distribution object +‘distr’ which must have the type ‘cont’. + + Of course UNU.RAN provides an easier way to use standard +distributions. Instead of using ‘unur_distr__new’ calls and +fuctions ‘unur_distr__set_<...>’ for setting data, objects for +standard distribution can be created by a single call. Eg. to get an +object for the normal distribution with mean 2 and standard deviation 5 +use + + double parameter[2] = {2.0 ,5.0}; + UNUR_DISTR *distr = unur_distr_normal(parameter, 2); + +For a list of standard distributions see *note Standard distributions: +Stddist. + +Generation methods +------------------ + +The information that a distribution object must contain depends heavily +on the chosen generation method choosen. + + Brackets indicate optional information while a tilde indicates that +only an approximation must be provided. See *note Glossary::, for +unfamiliar terms. + +Methods for continuous univariate distributions +sample with ‘unur_sample_cont’ + +method PDF dPDF CDF mode area other +AROU x x [x] T-concave +ARS x x T-concave +CEXT wrapper for external generator +CSTD build-in standard distribution +HINV [x] [x] x +HRB bounded hazard rate +HRD decreasing hazard rate +HRI increasing hazard rate +ITDR x x x monotone with pole +NINV [x] x +NROU x [x] +PINV x [x] [~] +SROU x x x T-concave +SSR x x x T-concave +TABL x x [~] all local extrema +TDR x x T-concave +UTDR x x ~ T-concave + +Methods for continuous empirical univariate distributions +sample with ‘unur_sample_cont’ + +EMPK: Requires an observed sample. +EMPL: Requires an observed sample. + +Methods for continuous multivariate distributions +sample with ‘unur_sample_vec’ + +NORTA: Requires rank correlation matrix and marginal distributions. +VNROU: Requires the PDF. +MVSTD: Generator for built-in standard distributions. +MVTDR: Requires PDF and gradiant of PDF. + +Methods for continuous empirical multivariate distributions +sample with ‘unur_sample_vec’ + +VEMPK: Requires an observed sample. + +Methods for discrete univariate distributions +sample with ‘unur_sample_discr’ + +method PMF PV mode sum other +DARI x x ~ T-concave +DAU [x] x +DEXT wrapper for external generator +DGT [x] x +DSROU x x x T-concave +DSS [x] x x +DSTD build-in standard distribution + +Methods for matrix distributions +sample with ‘unur_sample_matr’ + +MCORR: Distribution object for random correlation matrix. + +Markov Chain Methods for continuous multivariate distributions +sample with ‘unur_sample_vec’ + +GIBBS: T-concave logPDF and derivatives of logPDF. +HITRO: Requires PDF. + + Because of tremendous variety of possible problems, UNU.RAN provides +many methods. All information for creating a generator object has to be +collected in a parameter object first. For example, if the task is to +sample from a continuous distribution the method AROU might be a good +choice. Then the call + + UNUR_PAR *par = unur_arou_new(distribution); + +creates an parameter object ‘par’ with a pointer to the distribution +object and default values for all necessary parameters for method AROU. +Other methods can be used by replacing ‘arou’ with the name of the +desired methods (in lower case letters): + + UNUR_PAR *par = unur__new(distribution); + +This sets the default values for all necessary parameters for the chosen +method. These are suitable for almost all applications. Nevertheless, +it is possible to control the behavior of the method using corresponding +‘set’ calls for each method. This might be necessary to adjust the +algorithm for an unusual distribution with extreme properties, or just +for fine tuning the perforence of the algorithm. The following example +demonstrates how to change the maximum number of iterations for method +NINV to the value 50: + + unur_ninv_set_max_iteration(par, 50); + +All available methods are described in details in *note Methods::. + +Creating a generator object +--------------------------- + +Now it is possible to create a generator object: + + UNUR_GEN *generator = unur_init(par); + if (generator == NULL) exit(EXIT_FAILURE); + +*Important:* You must always check whether ‘unur_init’ has been executed +successfully. Otherwise the ‘NULL’ pointer is returned which causes a +segmentation fault when used for sampling. + +*Important:* The call of ‘unur_init’ *destroys* the parameter object! +Moreover, it is recommended to call ‘unur_init’ immediately after the +parameter object ‘par’ has created and modified. + + An existing generator object is a rather static construct. +Nevertheless, some of the parameters can still be modified by ‘chg’ +calls, e.g. + + unur_ninv_chg_max_iteration(gen, 30); + +Notice that it is important _when_ parameters are changed because +different functions must be used: + + The function name includes the term ‘set’ and the first argument must +be of type ‘UNUR_PAR’ when the parameters are changed _before_ the +generator object is created. + + The function name includes the term ‘chg’ and the first argument must +be of type ‘UNUR_GEN’ when the parameters are changed for an _existing_ +generator object. + + For details see *note Methods::. + +Sampling +-------- + +You can now use your generator object in any place of your program to +sample from your distribution. You only have to take care about the +type of variates it computes: ‘double’, ‘int’ or a vector (array of +‘double’s). Notice that at this point it does not matter whether you +are sampling from a gamma distribution, a truncated normal distribution +or even an empirical distribution. + +Reinitializing +-------------- + +It is possible for a generator object to change the parameters and the +domain of the underlying distribution. This must be done by extracting +this object by means of a ‘unur_get_distr’ call and changing the +distribution using the correspondig set calls, see *note Handling +distribution objects: Distribution_objects. The generator object *must* +then be reinitialized by means of the ‘unur_reinit’ call. + + _Important_: Currently not all methods allow reinitialization, see +the description of the particular method (keyword Reinit). + +Destroy +------- + +When you do not need your generator object any more, you should destroy +it: + + unur_free(generator); + +Uniform random numbers +---------------------- + +Each generator object can have its own uniform random number generator +or share one with others. When created a parameter object the pointer +for the uniform random number generator is set to the default generator. +However, it can be changed at any time to any other generator: + + unur_set_urng(par, urng); + +or + + unur_chg_urng(generator, urng); + +respectively. See *note Using uniform random number generators: URNG, +for details. + + +File: unuran.info, Node: Contact, Prev: Concepts, Up: Intro + +1.5 Contact the authors +======================= + +If you have any problems with UNU.RAN, suggestions how to improve the +library, or find a bug, please contact us via email +. + + For news please visit out homepage at +. + + +File: unuran.info, Node: Examples, Next: StringAPI, Prev: Intro, Up: Top + +2 Examples +********** + +* Menu: + +* Example_0:: As short as possible +* Example_0_str:: As short as possible (String API) +* Example_1:: Select a method +* Example_1_str:: Select a method (String API) +* Example_2:: Arbitrary distributions +* Example_2_str:: Arbitrary distributions (String API) +* Example_3:: Change parameters of the method +* Example_3_str:: Change parameters of the method (String API) +* Example_4:: Change uniform random generator +* Example_reinit:: Change parameters of underlying distribution +* Example_anti:: Sample pairs of antithetic random variates +* Example_anti_str:: Sample pairs of antithetic random variates (String API) +* Example_More:: More examples + +The examples in this chapter should compile cleanly and can be found in +the directory ‘examples’ of the source tree of UNU.RAN. Assuming that +UNU.RAN as well as the PRNG libraries have been installed properly +(*note Installation::) each of these can be compiled (using the GCC in +this example) with + + gcc -Wall -O2 -o example example.c -lunuran -lprng -lm + +_Remark:_ ‘-lprng’ must be omitted when the PRNG library is not +installed. Then however some of the examples might not work. + + The library uses three objects: ‘UNUR_DISTR’, ‘UNUR_PAR’ and +‘UNUR_GEN’. It is not important to understand the details of these +objects but it is important not to changed the order of their creation. +The distribution object can be destroyed _after_ the generator object +has been made. (The parameter object is freed automatically by the +‘unur_init’ call.) It is also important to check the result of the +‘unur_init’ call. If it has failed the ‘NULL’ pointer is returned and +causes a segmentation fault when used for sampling. + + We give all examples with the UNU.RAN standard API and the more +convenient string API. + + +File: unuran.info, Node: Example_0, Next: Example_0_str, Up: Examples + +2.1 As short as possible +======================== + +Select a distribution and let UNU.RAN do all necessary steps. + + /* ------------------------------------------------------------- */ + /* File: example0.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use a predefined standard distribution: */ + /* Gaussian with mean zero and standard deviation 1. */ + /* Since this is the standard form of the distribution, */ + /* we need not give these parameters. */ + distr = unur_distr_normal(NULL, 0); + + /* Use method AUTO: */ + /* Let UNURAN select a suitable method for you. */ + par = unur_auto_new(distr); + + /* Now you can change some of the default settings for the */ + /* parameters of the chosen method. We don't do it here. */ + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + + +File: unuran.info, Node: Example_0_str, Next: Example_1, Prev: Example_0, Up: Examples + +2.2 As short as possible (String API) +===================================== + +Select a distribution and let UNU.RAN do all necessary steps. + + /* ------------------------------------------------------------- */ + /* File: example0_str.c */ + /* ------------------------------------------------------------- */ + /* String API. */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a predefined standard distribution: */ + /* Standard Gaussian distribution. */ + /* Use method AUTO: */ + /* Let UNURAN select a suitable method for you. */ + gen = unur_str2gen("normal()"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + + +File: unuran.info, Node: Example_1, Next: Example_1_str, Prev: Example_0_str, Up: Examples + +2.3 Select a method +=================== + +Select method AROU and use it with default parameters. + + /* ------------------------------------------------------------- */ + /* File: example1.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use a predefined standard distribution: */ + /* Gaussian with mean zero and standard deviation 1. */ + /* Since this is the standard form of the distribution, */ + /* we need not give these parameters. */ + distr = unur_distr_normal(NULL, 0); + + /* Choose a method: AROU. */ + /* For other (suitable) methods replace "arou" with the */ + /* respective name (in lower case letters). */ + par = unur_arou_new(distr); + + /* Now you can change some of the default settings for the */ + /* parameters of the chosen method. We don't do it here. */ + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + + +File: unuran.info, Node: Example_1_str, Next: Example_2, Prev: Example_1, Up: Examples + +2.4 Select a method (String API) +================================ + +Select method AROU and use it with default parameters. + + /* ------------------------------------------------------------- */ + /* File: example1_str.c */ + /* ------------------------------------------------------------- */ + /* String API. */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a predefined standard distribution: */ + /* Standard Gaussian distribution. */ + /* Choose a method: AROU. */ + /* For other (suitable) methods replace "arou" with the */ + /* respective name. */ + gen = unur_str2gen("normal() & method=arou"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + + +File: unuran.info, Node: Example_2, Next: Example_2_str, Prev: Example_1_str, Up: Examples + +2.5 Arbitrary distributions +=========================== + +If you want to sample from a non-standard distribution, UNU.RAN might be +exactly what you need. Depending on the information is available, a +method must be choosen for sampling, see *note Concepts:: for an +overview and *note Methods:: for details. + + /* ------------------------------------------------------------- */ + /* File: example2.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* In this example we build a distribution object from scratch */ + /* and sample from this distribution. */ + /* */ + /* We use method TDR (Transformed Density Rejection) which */ + /* required a PDF and the derivative of the PDF. */ + + /* ------------------------------------------------------------- */ + + /* Define the PDF and dPDF of our distribution. */ + /* */ + /* Our distribution has the PDF */ + /* */ + /* / 1 - x*x if |x| <= 1 */ + /* f(x) = < */ + /* \ 0 otherwise */ + /* */ + + /* The PDF of our distribution: */ + double mypdf( double x, const UNUR_DISTR *distr ) + /* The second argument (`distr') can be used for parameters */ + /* for the PDF. (We do not use parameters in our example.) */ + { + if (fabs(x) >= 1.) + return 0.; + else + return (1.-x*x); + } /* end of mypdf() */ + + /* The derivative of the PDF of our distribution: */ + double mydpdf( double x, const UNUR_DISTR *distr ) + { + if (fabs(x) >= 1.) + return 0.; + else + return (-2.*x); + } /* end of mydpdf() */ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create a new distribution object from scratch. */ + /* It is a continuous distribution, and we need a PDF and the */ + /* derivative of the PDF. Moreover we set the domain. */ + + /* Get empty distribution object for a continuous distribution */ + distr = unur_distr_cont_new(); + + /* Assign the PDF and dPDF (defined above). */ + unur_distr_cont_set_pdf( distr, mypdf ); + unur_distr_cont_set_dpdf( distr, mydpdf ); + + /* Set the domain of the distribution (optional for TDR). */ + unur_distr_cont_set_domain( distr, -1., 1. ); + + /* Choose a method: TDR. */ + par = unur_tdr_new(distr); + + /* Now you can change some of the default settings for the */ + /* parameters of the chosen method. We don't do it here. */ + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + + + +File: unuran.info, Node: Example_2_str, Next: Example_3, Prev: Example_2, Up: Examples + +2.6 Arbitrary distributions (String API) +======================================== + +If you want to sample from a non-standard distribution, UNU.RAN might be +exactly what you need. Depending on the information is available, a +method must be choosen for sampling, see *note Concepts:: for an +overview and *note Methods:: for details. + + /* ------------------------------------------------------------- */ + /* File: example2_str.c */ + /* ------------------------------------------------------------- */ + /* String API. */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* In this example we use a generic distribution object */ + /* and sample from this distribution. */ + /* */ + /* The PDF of our distribution is given by */ + /* */ + /* / 1 - x*x if |x| <= 1 */ + /* f(x) = < */ + /* \ 0 otherwise */ + /* */ + /* We use method TDR (Transformed Density Rejection) which */ + /* required a PDF and the derivative of the PDF. */ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a generic continuous distribution. */ + /* Choose a method: TDR. */ + gen = unur_str2gen( + "distr = cont; pdf=\"1-x*x\"; domain=(-1,1) & method=tdr"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + + + +File: unuran.info, Node: Example_3, Next: Example_3_str, Prev: Example_2_str, Up: Examples + +2.7 Change parameters of the method +=================================== + +Each method for generating random numbers allows several parameters to +be modified. If you do not want to use default values, it is possible +to change them. The following example illustrates how to change +parameters. For details see *note Methods::. + + /* ------------------------------------------------------------- */ + /* File: example3.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + double fparams[2]; /* array for parameters for distribution */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use a predefined standard distribution: */ + /* Gaussian with mean 2. and standard deviation 0.5. */ + fparams[0] = 2.; + fparams[1] = 0.5; + distr = unur_distr_normal( fparams, 2 ); + + /* Choose a method: TDR. */ + par = unur_tdr_new(distr); + + /* Change some of the default parameters. */ + + /* We want to use T(x)=log(x) for the transformation. */ + unur_tdr_set_c( par, 0. ); + + /* We want to have the variant with immediate acceptance. */ + unur_tdr_set_variant_ia( par ); + + /* We want to use 10 construction points for the setup */ + unur_tdr_set_cpoints ( par, 10, NULL ); + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* It is possible with method TDR to truncate the distribution */ + /* for an existing generator object ... */ + unur_tdr_chg_truncated( gen, -1., 0. ); + + /* ... and sample again. */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + +File: unuran.info, Node: Example_3_str, Next: Example_4, Prev: Example_3, Up: Examples + +2.8 Change parameters of the method (String API) +================================================ + +Each method for generating random numbers allows several parameters to +be modified. If you do not want to use default values, it is possible +to change them. The following example illustrates how to change +parameters. For details see *note Methods::. + + /* ------------------------------------------------------------- */ + /* File: example3_str.c */ + /* ------------------------------------------------------------- */ + /* String API. */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a predefined standard distribution: */ + /* Gaussian with mean 2. and standard deviation 0.5. */ + /* Choose a method: TDR with parameters */ + /* c = 0: use T(x)=log(x) for the transformation; */ + /* variant "immediate acceptance"; */ + /* number of construction points = 10. */ + gen = unur_str2gen( + "normal(2,0.5) & method=tdr; c=0.; variant_ia; cpoints=10"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* It is possible with method TDR to truncate the distribution */ + /* for an existing generator object ... */ + unur_tdr_chg_truncated( gen, -1., 0. ); + + /* ... and sample again. */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + +File: unuran.info, Node: Example_4, Next: Example_reinit, Prev: Example_3_str, Up: Examples + +2.9 Change uniform random generator +=================================== + +All generator object use the same default uniform random number +generator by default. This can be changed to any generator of your +choice such that each generator object has its own random number +generator or can share it with some other objects. It is also possible +to change the default generator at any time. See *note Using uniform +random number generators: URNG, for details. + + The following example shows how the uniform random number generator +can be set or changed for a generator object. It requires the +RNGSTREAMS library to be installed and used. Otherwise the example must +be modified accordingly. + + /* ------------------------------------------------------------- */ + /* File: example_rngstreams.c */ + /* ------------------------------------------------------------- */ + #ifdef UNURAN_SUPPORTS_RNGSTREAM + /* ------------------------------------------------------------- */ + /* This example makes use of the RNGSTREAM library for */ + /* for generating uniform random numbers. */ + /* (see http://statmath.wu.ac.at/software/RngStreams/) */ + /* To compile this example you must have set */ + /* ./configure --with-urng-rngstream */ + /* (Of course the executable has to be linked against the */ + /* RNGSTREAM library.) */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header files. */ + #include + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + double fparams[2]; /* array for parameters for distribution */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng1, *urng2; /* uniform generator objects */ + + /* The RNGSTREAMS library sets a package seed. */ + unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; + RngStream_SetPackageSeed(seed); + + /* RngStreams only: */ + /* Make a object for uniform random number generator. */ + /* For details see */ + /* http://statmath.wu.ac.at/software/RngStreams/ */ + urng1 = unur_urng_rngstream_new("urng-1"); + if (urng1 == NULL) exit (EXIT_FAILURE); + + /* Use a predefined standard distribution: */ + /* Beta with parameters 2 and 3. */ + fparams[0] = 2.; + fparams[1] = 3.; + distr = unur_distr_beta( fparams, 2 ); + + /* Choose a method: TDR. */ + par = unur_tdr_new(distr); + + /* Set uniform generator in parameter object */ + unur_set_urng( par, urng1 ); + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* Now we want to switch to a different (independent) stream */ + /* of uniform random numbers. */ + urng2 = unur_urng_rngstream_new("urng-2"); + if (urng2 == NULL) exit (EXIT_FAILURE); + unur_chg_urng( gen, urng2 ); + + /* ... and sample again. */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + /* We also should destroy the uniform random number generators.*/ + unur_urng_free(urng1); + unur_urng_free(urng2); + + exit (EXIT_SUCCESS); + } /* end of main() */ + + /* ------------------------------------------------------------- */ + #else + #include + #include + int main(void) { + printf("You must enable the RNGSTREAM library to run this example!\n\n"); + exit (77); /* exit code for automake check routines */ + } + #endif + /* ------------------------------------------------------------- */ + + + +File: unuran.info, Node: Example_reinit, Next: Example_anti, Prev: Example_4, Up: Examples + +2.10 Change parameters of underlying distribution +================================================= + +One a generator object has been created it allows to draw samples from +the distribution with the given parameters. However, some methods allow +to change the parameters of the underlying distribution and reinitialize +the generator object again. Thus when the parameters of the +distribution vary for each draw we save overhead for destroying the old +object and creating a new one. + + The following example shows how the parameters of a GIG distribution +can be changed when method CSTD is used. + + /* ------------------------------------------------------------- */ + /* File: example_reinit.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* In this example we show how the parameters of the underlying */ + /* distribution can be changed for an existing generator object. */ + + /* We use the GIG distribution with method CSTD. */ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Parameters of distribution. */ + double dparam[3] = {0.5, 1., 5.}; + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create initial GIG distribution object */ + distr = unur_distr_gig(dparam, 3); + + /* Choose a method: CSTD. */ + par = unur_cstd_new(distr); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* It is possible for method CSTD to change the parameters of */ + /* underlying distribution. However, we have to extract to */ + /* pointer to the distribution. Be carefull with this pointer! */ + distr = unur_get_distr(gen); + + /* Change the parameter(s). */ + dparam[2] = 0.001; + unur_distr_cont_set_pdfparams(distr,dparam,3); + + /* Do not forget to reinitialize the generator object. */ + /* Check the return code. */ + /* (and try to find a better error handling) */ + if (unur_reinit(gen) != UNUR_SUCCESS) { + fprintf(stderr, "ERROR: cannot reinitialize generator object\n"); + exit (EXIT_FAILURE); + } + + /* Draw a new sample. */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* Changing parameters can be repeated. */ + dparam[2] = 1000; + unur_distr_cont_set_pdfparams(distr,dparam,3); + if (unur_reinit(gen) != UNUR_SUCCESS) { + fprintf(stderr, "ERROR: cannot reinitialize generator object\n"); + exit (EXIT_FAILURE); + } + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + + + +File: unuran.info, Node: Example_anti, Next: Example_anti_str, Prev: Example_reinit, Up: Examples + +2.11 Sample pairs of antithetic random variates +=============================================== + +Using Method TDR it is easy to sample pairs of antithetic random +variates. + + /* ------------------------------------------------------------- */ + /* File: example_anti.c */ + /* ------------------------------------------------------------- */ + #ifdef UNURAN_SUPPORTS_PRNG + /* ------------------------------------------------------------- */ + /* This example makes use of the PRNG library for generating */ + /* uniform random numbers. */ + /* (see http://statmath.wu.ac.at/prng/) */ + /* To compile this example you must have set */ + /* ./configure --with-urng-prng */ + /* (Of course the executable has to be linked against the */ + /* PRNG library.) */ + /* ------------------------------------------------------------- */ + + /* Example how to sample from two streams of antithetic random */ + /* variates from Gaussian N(2,5) and Gamma(4) distribution, resp.*/ + + /* ------------------------------------------------------------- */ + + /* Include UNURAN header files. */ + #include + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double xn, xg; /* will hold the random number */ + double fparams[2]; /* array for parameters for distribution */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen_normal, *gen_gamma; + /* generator objects */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng1, *urng2; /* uniform generator objects */ + + /* PRNG only: */ + /* Make a object for uniform random number generator. */ + /* For details see http://statmath.wu.ac.at/prng/. */ + + + /* The first generator: Gaussian N(2,5) */ + + /* uniform generator: We use the Mersenne Twister. */ + urng1 = unur_urng_prng_new("mt19937(1237)"); + if (urng1 == NULL) exit (EXIT_FAILURE); + + /* UNURAN generator object for N(2,5) */ + fparams[0] = 2.; + fparams[1] = 5.; + distr = unur_distr_normal( fparams, 2 ); + + /* Choose method TDR with variant PS. */ + par = unur_tdr_new( distr ); + unur_tdr_set_variant_ps( par ); + + /* Set uniform generator in parameter object. */ + unur_set_urng( par, urng1 ); + + /* Set auxilliary uniform random number generator. */ + /* We use the default generator. */ + unur_use_urng_aux_default( par ); + + /* Alternatively you can create and use your own auxilliary */ + /* uniform random number generator: */ + /* UNUR_URNG *urng_aux; */ + /* urng_aux = unur_urng_prng_new("tt800"); */ + /* if (urng_aux == NULL) exit (EXIT_FAILURE); */ + /* unur_set_urng_aux( par, urng_aux ); */ + + /* Create the generator object. */ + gen_normal = unur_init(par); + if (gen_normal == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Destroy distribution object (gen_normal has its own copy). */ + unur_distr_free(distr); + + + /* The second generator: Gamma(4) with antithetic variates. */ + + /* uniform generator: We use the Mersenne Twister. */ + urng2 = unur_urng_prng_new("anti(mt19937(1237))"); + if (urng2 == NULL) exit (EXIT_FAILURE); + + /* UNURAN generator object for gamma(4) */ + fparams[0] = 4.; + distr = unur_distr_gamma( fparams, 1 ); + + /* Choose method TDR with variant PS. */ + par = unur_tdr_new( distr ); + unur_tdr_set_variant_ps( par ); + + /* Set uniform generator in parameter object. */ + unur_set_urng( par, urng2 ); + + /* Set auxilliary uniform random number generator. */ + /* We use the default generator. */ + unur_use_urng_aux_default( par ); + + /* Alternatively you can create and use your own auxilliary */ + /* uniform random number generator (see above). */ + /* Notice that both generator objects gen_normal and */ + /* gen_gamma can share the same auxilliary URNG. */ + + /* Create the generator object. */ + gen_gamma = unur_init(par); + if (gen_gamma == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Destroy distribution object (gen_normal has its own copy). */ + unur_distr_free(distr); + + + /* Now we can sample pairs of negatively correlated random */ + /* variates. E.g.: */ + for (i=0; i<10; i++) { + xn = unur_sample_cont(gen_normal); + xg = unur_sample_cont(gen_gamma); + printf("%g, %g\n",xn,xg); + } + + + /* When you do not need the generator objects any more, you */ + /* can destroy it. */ + unur_free(gen_normal); + unur_free(gen_gamma); + + /* We also should destroy the uniform random number generators.*/ + unur_urng_free(urng1); + unur_urng_free(urng2); + + exit (EXIT_SUCCESS); + } /* end of main() */ + + /* ------------------------------------------------------------- */ + #else + #include + #include + int main(void) { + printf("You must enable the PRNG library to run this example!\n\n"); + exit (77); /* exit code for automake check routines */ + } + #endif + /* ------------------------------------------------------------- */ + + +File: unuran.info, Node: Example_anti_str, Next: Example_More, Prev: Example_anti, Up: Examples + +2.12 Sample pairs of antithetic random variates (String API) +============================================================ + +Using Method TDR it is easy to sample pairs of antithetic random +variates. + + /* ------------------------------------------------------------- */ + /* File: example_anti_str.c */ + /* ------------------------------------------------------------- */ + /* String API. */ + /* ------------------------------------------------------------- */ + #ifdef UNURAN_SUPPORTS_PRNG + /* ------------------------------------------------------------- */ + /* This example makes use of the PRNG library for generating */ + /* uniform random numbers. */ + /* (see http://statmath.wu.ac.at/prng/) */ + /* To compile this example you must have set */ + /* ./configure --with-urng-prng */ + /* (Of course the executable has to be linked against the */ + /* PRNG library.) */ + /* ------------------------------------------------------------- */ + + /* Example how to sample from two streams of antithetic random */ + /* variates from Gaussian N(2,5) and Gamma(4) distribution, resp.*/ + + /* ------------------------------------------------------------- */ + + /* Include UNURAN header files. */ + #include + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double xn, xg; /* will hold the random number */ + + /* Declare UNURAN generator objects. */ + UNUR_GEN *gen_normal, *gen_gamma; + + /* PRNG only: */ + /* Make a object for uniform random number generator. */ + /* For details see http://statmath.wu.ac.at/prng/. */ + + /* Create the first generator: Gaussian N(2,5) */ + gen_normal = unur_str2gen("normal(2,5) & method=tdr; variant_ps & urng=mt19937(1237)"); + if (gen_normal == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + /* Set auxilliary uniform random number generator. */ + /* We use the default generator. */ + unur_chgto_urng_aux_default(gen_normal); + + /* The second generator: Gamma(4) with antithetic variates. */ + gen_gamma = unur_str2gen("gamma(4) & method=tdr; variant_ps & urng=anti(mt19937(1237))"); + if (gen_gamma == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + unur_chgto_urng_aux_default(gen_gamma); + + + /* Now we can sample pairs of negatively correlated random */ + /* variates. E.g.: */ + for (i=0; i<10; i++) { + xn = unur_sample_cont(gen_normal); + xg = unur_sample_cont(gen_gamma); + printf("%g, %g\n",xn,xg); + } + + + /* When you do not need the generator objects any more, you */ + /* can destroy it. */ + + /* But first we have to destroy the uniform random number */ + /* generators. */ + unur_urng_free(unur_get_urng(gen_normal)); + unur_urng_free(unur_get_urng(gen_gamma)); + + unur_free(gen_normal); + unur_free(gen_gamma); + + + exit (EXIT_SUCCESS); + } /* end of main() */ + + /* ------------------------------------------------------------- */ + #else + #include + #include + int main(void) { + printf("You must enable the PRNG library to run this example!\n\n"); + exit (77); /* exit code for automake check routines */ + } + #endif + /* ------------------------------------------------------------- */ + + +File: unuran.info, Node: Example_More, Prev: Example_anti_str, Up: Examples + +2.13 More examples +================== + +*Note Methods for continuous univariate distributions: Methods_for_CONT. + + *Note Methods for continuous empirical univariate distributions: +Methods_for_CEMP. + + *Note Methods for continuous empirical multivariate distributions: +Methods_for_CVEMP. + + *Note Methods for discrete univariate distributions: +Methods_for_DISCR. + + +File: unuran.info, Node: StringAPI, Next: Distribution_objects, Prev: Examples, Up: Top + +3 String Interface +****************** + +* Menu: + +* StringSyntax:: Syntax of String Interface +* StringDistr:: Distribution String +* StringFunct:: Function String +* StringMethod:: Method String +* StringURNG:: Uniform RNG String + +The string interface (string API) provided by the ‘unur_str2gen’ call is +the easiest way to use UNU.RAN. This function takes a character string +as its argument. The string is parsed and the information obtained is +used to create a generator object. It returns ‘NULL’ if this fails, +either due to a syntax error, or due to invalid data. In both cases +‘unur_error’ is set to the corresponding error codes (*note Error +reporting: Error_reporting.). Additionally there exists the call +‘unur_str2distr’ that only produces a distribution object. + + Notice that the string interface does not implement all features of +the UNU.RAN library. For trickier tasks it might be necessary to use +the UNU.RAN calls. + + In *note Examples::, all examples are given using both the UNU.RAN +standard API and this convenient string API. The corresponding programm +codes are equivalent. + +Function reference +------------------ + + -- Function: UNUR_GEN* unur_str2gen (const CHAR* STRING) + Get a generator object for the distribution, method and uniform + random number generator as described in the given STRING. See + *note Syntax of String Interface: StringSyntax, for details. + + -- Function: UNUR_DISTR* unur_str2distr (const CHAR* STRING) + Get a distribution object for the distribution described in STRING. + See *note Syntax of String Interface: StringSyntax, and *note + Distribution String: StringDistr, for details. However, only the + block for the distribution object is allowed. + + -- Function: UNUR_GEN* unur_makegen_ssu (const CHAR* DISTRSTR, const + CHAR* METHODSTR, UNUR_URNG* URNG) + -- Function: UNUR_GEN* unur_makegen_dsu (const UNUR_DISTR* + DISTRIBUTION, const CHAR* METHODSTR, UNUR_URNG* URNG) + Make a generator object for the distribution, method and uniform + random number generator. The distribution can be given either as + string DISTRSTR or as a distribution object DISTR. The method must + be given as a string METHODSTR. For the syntax of these strings + see *note Syntax of String Interface: StringSyntax. However, the + ‘method’ keyword is optional for these calls and can be omitted. + If METHODSTR is the empty (blank) string or ‘NULL’ method AUTO is + used. The uniform random number generator is optional. If URNG is + ‘NULL’ then the default uniform random number generator is used. + + +File: unuran.info, Node: StringSyntax, Next: StringDistr, Up: StringAPI + +3.1 Syntax of String Interface +============================== + +The given string holds information about the requested distribution and +(optional) about the sampling method and the uniform random number +generator invoked. The interpretation of the string is not +case-sensitive, all white spaces are ignored. + + The string consists of up to three blocks, separated by ampersands +‘&’. + + Each block consists of ‘=’ pairs, separated by semicolons +‘;’. + + The first key in each block is used to indicate each block. We have +three different blocks with the following (first) keys: +‘distr’ + definition of the distribution (*note Distribution String: + StringDistr.). + +‘method’ + description of the transformation method (*note Method String: + StringMethod.). + +‘urng’ + uniform random number generation (*note Uniform RNG String: + StringURNG.). + + The ‘distr’ block must be the very first block and is obligatory. +All the other blocks are optional and can be arranged in arbitrary +order. + + For details see the following description of each block. + + In the following example + + distr = normal(3.,0.75); domain = (0,inf) & method = tdr; c = 0 + +we have a distribution block for the truncated normal distribution with +mean 3 and standard deviation 0.75 on domain (0,infinity); and block for +choosing method TDR with parameter c set to 0. + + The ‘=’ pairs that follow the first (initial) pair in +each block are used to set parameters. The name of the parameter is +given by the ‘’ string. It is deduced from the UNU.RAN set calls +by taking the part after ‘..._set_’. The ‘’ string holds the +parameters to be set, separated by commata ‘,’. There are three types +of parameters: +_string ‘"..."’ or ‘'...'’_ + i.e. any sequence of characters enclosed by double quotes ‘"..."’ + or single quotes ‘'...'’ (there is no distinction between double + quotes ‘"’ and single quotes ‘'’). +_list ‘(...,...)’_ + i.e. list of _numbers_, separated by commata ‘,’, enclosed in + parenthesis ‘(...)’. +_number_ + a sequence of characters that is not enclosed by double quotes + ‘"..."’, single quotes ‘'...'’, or parenthesis ‘(...)’. It is + interpreted as float or integer depending on the type of the + corresponding parameter. + The ‘’ string (including the character ‘=’) can be omitted +when no argument is required. + + At the moment not all ‘set’ calls are supported. The syntax for the +‘’ can be directly derived from the corresponding ‘set’ calls. +To simplify the syntax additional shortcuts are possible. The following +table lists the parameters for the ‘set’ calls that are supported by the +string interface; the entry in parenthesis gives the type of the +argument as ‘’ string: + +‘int (number):’ + The number is interpreted as an integer. ‘true’ and ‘on’ are + transformed to ‘1’, ‘false’ and ‘off’ are transformed to ‘0’. A + missing argument is interpreted as ‘1’. + +‘int, int (number, number or list):’ + The two numbers or the first two entries in the list are + interpreted as a integers. ‘inf’ and ‘-inf’ are transformed to + ‘INT_MAX’ and ‘INT_MIN’ respectively, i.e. the largest and + smallest integers that can be represented by the computer. + +‘unsigned (number):’ + The number is interpreted as an unsigned hexadecimal integer. + +‘double (number):’ + The number is interpreted as a floating point number. ‘inf’ is + transformed to ‘UNUR_INFINITY’. + +‘double, double (number, number or list):’ + The two numbers or the first two entries in the list are + interpreted as a floating point numbers. ‘inf’ is transformed to + ‘UNUR_INFINITY’. However using ‘inf’ in the list might not work + for all versions of C. Then it is recommended to use two single + numbers instead of a list. + +‘int, double* ([number,] list or number):’ + − The list is interpreted as a double array. The (first) number + as its length. If it is less than the actual size of the + array only the first entries of the array are used. + − If only the list is given (i.e., if the first number is + omitted), the first number is set to the actual size of the + array. + − If only the number is given (i.e., if the list is omitted), + the ‘NULL’ pointer is used instead an array as argument. + +‘double*, int (list [,number]):’ + The list is interpreted as a double array. The (second) number as + its length. If the length is omitted, it is replaced by the actual + size of the array. (Only in the ‘distribution’ block!) + +‘char* (string):’ + The character string is passed as is to the corresponding set call. + + Notice that missing entries in a list of numbers are interpreted as +‘0’. E.g, a the list ‘(1,,3)’ is read as ‘(1,0,3)’, the list ‘(1,2,)’ +as ‘(1,2,0)’. + + The the list of ‘key’ strings in *note Keys for Distribution String: +KeysDistr, and *note Keys for Method String: KeysMethod, for further +details. + + +File: unuran.info, Node: StringDistr, Next: StringFunct, Prev: StringSyntax, Up: StringAPI + +3.2 Distribution String +======================= + +* Menu: + +* KeysDistr:: Keys for Distribution String + +The ‘distr’ block must be the very first block and is obligatory. For +that reason the keyword ‘distr’ is optional and can be omitted (together +with the ‘=’ character). Moreover it is ignored while parsing the +string. However, to avoid some possible confusion it has to start with +the letter ‘d’ (if it is given at all). + + The value of the ‘distr’ key is used to get the distribution object, +either via a ‘unur_distr_’ call for a standard distribution via a +‘unur_distr__new’ call to get an object of a generic +distribution. However not all generic distributions are supported yet. + + The parameters for the standard distribution are given as a list. +There must not be any character (other than white space) between the +name of the standard distribution and the opening parenthesis ‘(’ of +this list. E.g., to get a beta distribution, use + + distr = beta(2,4) + + To get an object for a discrete distribution with probability vector +(0.5,0.2,0.3), use + + distr = discr; pv = (0.5,0.2,0.3) + + It is also possible to set a PDF, PMF, or CDF using a string. E.g., +to create a continuous distribution with PDF proportional to +‘exp(-sqrt(2+(x-1)^2) + (x-1))’ and domain (0,inf) use + + distr = cont; pdf = "exp(-sqrt(2+(x-1)^2) + (x-1))" + +Notice: If this string is used in an ‘unur_str2distr’ or ‘unur_str2gen’ +call the double quotes ‘"’ must be protected by ‘\"’. Alternatively, +single quotes may be used instead + + distr = cont; pdf = 'exp(-sqrt(2+(x-1)^2) + (x-1))' + + For the details of function strings see *note Function String: +StringFunct. + + +File: unuran.info, Node: KeysDistr, Up: StringDistr + +3.2.1 Keys for Distribution String +---------------------------------- + +List of standard distributions *note Standard distributions: Stddist. + + − ‘[distr =] beta(...)’ ⇒ *note beta:: + − ‘[distr =] binomial(...)’ ⇒ *note binomial:: + − ‘[distr =] cauchy(...)’ ⇒ *note cauchy:: + − ‘[distr =] chi(...)’ ⇒ *note chi:: + − ‘[distr =] chisquare(...)’ ⇒ *note chisquare:: + − ‘[distr =] exponential(...)’ ⇒ *note exponential:: + − ‘[distr =] extremeI(...)’ ⇒ *note extremeI:: + − ‘[distr =] extremeII(...)’ ⇒ *note extremeII:: + − ‘[distr =] F(...)’ ⇒ *note F:: + − ‘[distr =] gamma(...)’ ⇒ *note gamma:: + − ‘[distr =] geometric(...)’ ⇒ *note geometric:: + − ‘[distr =] gig(...)’ ⇒ *note gig:: + − ‘[distr =] gig2(...)’ ⇒ *note gig2:: + − ‘[distr =] hyperbolic(...)’ ⇒ *note hyperbolic:: + − ‘[distr =] hypergeometric(...)’ ⇒ *note hypergeometric:: + − ‘[distr =] ig(...)’ ⇒ *note ig:: + − ‘[distr =] laplace(...)’ ⇒ *note laplace:: + − ‘[distr =] logarithmic(...)’ ⇒ *note logarithmic:: + − ‘[distr =] logistic(...)’ ⇒ *note logistic:: + − ‘[distr =] lognormal(...)’ ⇒ *note lognormal:: + − ‘[distr =] lomax(...)’ ⇒ *note lomax:: + − ‘[distr =] negativebinomial(...)’ ⇒ *note negativebinomial:: + − ‘[distr =] normal(...)’ ⇒ *note normal:: + − ‘[distr =] pareto(...)’ ⇒ *note pareto:: + − ‘[distr =] poisson(...)’ ⇒ *note poisson:: + − ‘[distr =] powerexponential(...)’ ⇒ *note powerexponential:: + − ‘[distr =] rayleigh(...)’ ⇒ *note rayleigh:: + − ‘[distr =] slash(...)’ ⇒ *note slash:: + − ‘[distr =] student(...)’ ⇒ *note student:: + − ‘[distr =] triangular(...)’ ⇒ *note triangular:: + − ‘[distr =] uniform(...)’ ⇒ *note uniform:: + − ‘[distr =] weibull(...)’ ⇒ *note weibull:: + + List of generic distributions *note Handling Distribution Objects: +Distribution_objects. + + − ‘[distr =] cemp’ ⇒ *note CEMP:: + − ‘[distr =] cont’ ⇒ *note CONT:: + − ‘[distr =] discr’ ⇒ *note DISCR:: + + _Notice_: Order statistics for continuous distributions (*note +CORDER::) are supported by using the key ‘orderstatistics’ for +distributions of type ‘CONT’. + + List of keys that are available via the String API. For description +see the corresponding UNU.RAN set calls. + + • All distribution types + ‘name = ""’ + ⇒ *note ‘unur_distr_set_name’: funct:unur_distr_set_name. + + • ‘cemp’ (Distribution Type) (*note CEMP::) + ‘data = () [, ]’ + ⇒ *note ‘unur_distr_cemp_set_data’: + funct:unur_distr_cemp_set_data. + ‘hist_bins = () [, ]’ + ⇒ *note ‘unur_distr_cemp_set_hist_bins’: + funct:unur_distr_cemp_set_hist_bins. + ‘hist_domain = , | ()’ + ⇒ *note ‘unur_distr_cemp_set_hist_domain’: + funct:unur_distr_cemp_set_hist_domain. + ‘hist_prob = () [, ]’ + ⇒ *note ‘unur_distr_cemp_set_hist_prob’: + funct:unur_distr_cemp_set_hist_prob. + + • ‘cont’ (Distribution Type) (*note CONT::) + ‘cdf = ""’ + ⇒ *note ‘unur_distr_cont_set_cdfstr’: + funct:unur_distr_cont_set_cdfstr. + ‘center = ’ + ⇒ *note ‘unur_distr_cont_set_center’: + funct:unur_distr_cont_set_center. + ‘domain = , | ()’ + ⇒ *note ‘unur_distr_cont_set_domain’: + funct:unur_distr_cont_set_domain. + ‘hr = ""’ + ⇒ *note ‘unur_distr_cont_set_hrstr’: + funct:unur_distr_cont_set_hrstr. + ‘logcdf = ""’ + ⇒ *note ‘unur_distr_cont_set_logcdfstr’: + funct:unur_distr_cont_set_logcdfstr. + ‘logpdf = ""’ + ⇒ *note ‘unur_distr_cont_set_logpdfstr’: + funct:unur_distr_cont_set_logpdfstr. + ‘mode = ’ + ⇒ *note ‘unur_distr_cont_set_mode’: + funct:unur_distr_cont_set_mode. + ‘pdf = ""’ + ⇒ *note ‘unur_distr_cont_set_pdfstr’: + funct:unur_distr_cont_set_pdfstr. + ‘pdfarea = ’ + ⇒ *note ‘unur_distr_cont_set_pdfarea’: + funct:unur_distr_cont_set_pdfarea. + ‘pdfparams = () [, ]’ + ⇒ *note ‘unur_distr_cont_set_pdfparams’: + funct:unur_distr_cont_set_pdfparams. + ‘orderstatistics = , | ()’ + Make order statistics for given distribution. The first + parameter gives the sample size, the second parameter its + rank. (see *note ‘unur_distr_corder_new’: + funct:unur_distr_corder_new.) + + • ‘discr’ (Distribution Type) (*note DISCR::) + ‘cdf = ""’ + ⇒ *note ‘unur_distr_discr_set_cdfstr’: + funct:unur_distr_discr_set_cdfstr. + ‘domain = , | ()’ + ⇒ *note ‘unur_distr_discr_set_domain’: + funct:unur_distr_discr_set_domain. + ‘mode [= ]’ + ⇒ *note ‘unur_distr_discr_set_mode’: + funct:unur_distr_discr_set_mode. + ‘pmf = ""’ + ⇒ *note ‘unur_distr_discr_set_pmfstr’: + funct:unur_distr_discr_set_pmfstr. + ‘pmfparams = () [, ]’ + ⇒ *note ‘unur_distr_discr_set_pmfparams’: + funct:unur_distr_discr_set_pmfparams. + ‘pmfsum = ’ + ⇒ *note ‘unur_distr_discr_set_pmfsum’: + funct:unur_distr_discr_set_pmfsum. + ‘pv = () [, ]’ + ⇒ *note ‘unur_distr_discr_set_pv’: + funct:unur_distr_discr_set_pv. + + +File: unuran.info, Node: StringFunct, Next: StringMethod, Prev: StringDistr, Up: StringAPI + +3.3 Function String +=================== + +In unuran it is also possible to define functions (e.g. CDF or PDF) as +strings. As you can see in Example 2 (*note Example_2_str::) it is very +easy to define the PDF of a distribution object by means of a string. +The possibilities using this string interface are more restricted than +using a pointer to a routine coded in C (*note Example_2::). But the +differences in evaluation time is small. When a distribution object is +defined using this string interface then of course the same conditions +on the given density or CDF must be satisfied for a chosen method as for +the standard API. This string interface can be used for both within the +UNU.RAN string API using the ‘unur_str2gen’ call, and for calls that +define the density or CDF for a particular distribution object as done +with (e.g.) the call ‘unur_distr_cont_set_pdfstr’. Here is an example +for the latter case: + + unur_distr_cont_set_pdfstr(distr,"1-x*x"); + +Syntax +------ + +The syntax for the function string is case insensitive, white spaces are +ingnored. The expressions are similar to most programming languages and +mathematical programs (see also the examples below). It is especially +influenced by C. The usual preceedence rules are used (from highest to +lowest preceedence: functions, power, multiplication, addition, relation +operators). Use parentheses in case of doubt or when these preceedences +should be changed. + + Relation operators can be used as indicator functions, i.e. the term +‘(x>1)’ is evaluted as ‘1’ if this relation is satisfied, and as ‘0’ +otherwise. + + The first unknown symbol (letter or word) is interpreted as the +variable of the function. It is recommended to use ‘x’. Only one +variable can be used. + +_Important_: The symbol ‘e’ is used twice, for Euler’s constant (= +2.7182...) and as exponent. The multiplication operator ‘*’ must not be +omitted, i.e. ‘2 x’ is interpreted as the string ‘2x’ (which will +result in a syntax error). + +List of symbols +--------------- + +Numbers + +Numbers are composed using digits and, optionally, a sign, a decimal +point, and an exponent indicated by ‘e’. + +Symbol Explanation Examples +‘0...9’ digits ‘2343’ +‘.’ decimal point ‘165.567’ +‘-’ negative sign ‘-465.223’ +‘e’ exponet ‘13.2e-4’ (=0.00132) + +Constants + +‘pi’ pi = 3.1415... ‘3*pi+2’ +‘e’ Euler’s constant ‘3*e+2’ (= 10.15...; do not + cofuse with ‘3e2’ = 300) +‘inf’ infinity (used for domains) + +Special symbols + +‘(’ opening parenthesis ‘2*(3+x)’ +‘)’ closing parenthesis ‘2*(3+x)’ +‘,’ (argument) list separator ‘mod(13,2)’ + +Relation operators (Indicator functions) + +‘<’ less than ‘(x<1)’ +‘=’ equal ‘(2=x)’ +‘==’ same as ‘=’ ‘(x==3)’ +‘>’ greater than ‘(x>0)’ +‘<=’ less than or equal ‘(x<=1)’ +‘!=’ not equal ‘(x!0)’ +‘<>’ same as ‘!=’ ‘(x<>pi)’ +‘>=’ greater or equal ‘(x>=1)’ + +Arithmetic operators + +‘+’ addition ‘2+x’ +‘-’ subtraction ‘2-x’ +‘*’ multiplication ‘2*x’ +‘/’ division ‘x/2’ +‘^’ power ‘x^2’ + +Functions + +‘mod’ ‘mod(m,n)’ remainder of mod(x,2) + devision m over n +‘exp’ exponential function ‘exp(-x^2)’ (same as + (same as ‘e^x’) ‘e^(-x^2)’) +‘log’ natural logarithm ‘log(x)’ +‘sin’ sine ‘sin(x)’ +‘cos’ cosine ‘cos(x)’ +‘tan’ tangent ‘tan(x)’ +‘sec’ secant ‘sec(x*2)’ +‘sqrt’ square root ‘sqrt(2*x)’ +‘abs’ absolute value ‘abs(x)’ +‘sgn’ sign function ‘sign(x)*3’ + +Variable + +‘x’ variable ‘3*x^2’ + +Examples +-------- + + 1.231+7.9876*x-1.234e-3*x^2+3.335e-5*x^3 + sin(2*pi*x)+x^2 + exp(-((x-3)/2.1)^2) + +It is also possible to define functions using different terms on +separate domains. However, instead of constructs using ‘if ... then ... +else ...’ indicator functions are available. + +For example to define the density of triangular distribution with domain +(-1,1) and mode 0 use + + (x>-1)*(x<0)*(1+x) + (x>=0)*(x<1)*(1-x) + + +File: unuran.info, Node: StringMethod, Next: StringURNG, Prev: StringFunct, Up: StringAPI + +3.4 Method String +================= + +* Menu: + +* KeysMethod:: Keys for Method String + +The key ‘method’ is obligatory, it must be the first key and its value +is the name of a method suitable for the choosen standard distribution. +E.g., if method AROU is chosen, use + + method = arou + + Of course the all following keys dependend on the method choosen at +first. All corresponding ‘set’ calls of UNU.RAN are available and the +key is the string after the ‘unur__set_’ part of the +command. E.g., UNU.RAN provides the command +‘unur_arou_set_max_sqhratio’ to set a parameter of method AROU. To call +this function via the string-interface, the key ‘max_sqhratio’ can be +used: + + max_sqhratio = 0.9 + +Additionally the keyword ‘debug’ can be used to set debugging flags (see +*note Debugging: Debug, for details). + + If this block is omitted, a suitable default method is used. Notice +however that the default method may change in future versions of +UNU.RAN. + + +File: unuran.info, Node: KeysMethod, Up: StringMethod + +3.4.1 Keys for Method String +---------------------------- + +List of methods and keys that are available via the String API. For +description see the corresponding UNU.RAN set calls. + + • ‘method = arou’ ⇒ ‘unur_arou_new’ (*note AROU::) + ‘cpoints = [, ()] | ()’ + ⇒ *note ‘unur_arou_set_cpoints’: funct:unur_arou_set_cpoints. + ‘darsfactor = ’ + ⇒ *note ‘unur_arou_set_darsfactor’: + funct:unur_arou_set_darsfactor. + ‘guidefactor = ’ + ⇒ *note ‘unur_arou_set_guidefactor’: + funct:unur_arou_set_guidefactor. + ‘max_segments [= ]’ + ⇒ *note ‘unur_arou_set_max_segments’: + funct:unur_arou_set_max_segments. + ‘max_sqhratio = ’ + ⇒ *note ‘unur_arou_set_max_sqhratio’: + funct:unur_arou_set_max_sqhratio. + ‘pedantic [= ]’ + ⇒ *note ‘unur_arou_set_pedantic’: + funct:unur_arou_set_pedantic. + ‘usecenter [= ]’ + ⇒ *note ‘unur_arou_set_usecenter’: + funct:unur_arou_set_usecenter. + ‘usedars [= ]’ + ⇒ *note ‘unur_arou_set_usedars’: funct:unur_arou_set_usedars. + ‘verify [= ]’ + ⇒ *note ‘unur_arou_set_verify’: funct:unur_arou_set_verify. + + • ‘method = ars’ ⇒ ‘unur_ars_new’ (*note ARS::) + ‘cpoints = [, ()] | ()’ + ⇒ *note ‘unur_ars_set_cpoints’: funct:unur_ars_set_cpoints. + ‘max_intervals [= ]’ + ⇒ *note ‘unur_ars_set_max_intervals’: + funct:unur_ars_set_max_intervals. + ‘max_iter [= ]’ + ⇒ *note ‘unur_ars_set_max_iter’: funct:unur_ars_set_max_iter. + ‘pedantic [= ]’ + ⇒ *note ‘unur_ars_set_pedantic’: funct:unur_ars_set_pedantic. + ‘reinit_ncpoints [= ]’ + ⇒ *note ‘unur_ars_set_reinit_ncpoints’: + funct:unur_ars_set_reinit_ncpoints. + ‘reinit_percentiles = [, ()] | ()’ + ⇒ *note ‘unur_ars_set_reinit_percentiles’: + funct:unur_ars_set_reinit_percentiles. + ‘verify [= ]’ + ⇒ *note ‘unur_ars_set_verify’: funct:unur_ars_set_verify. + + • ‘method = auto’ ⇒ ‘unur_auto_new’ (*note AUTO::) + ‘logss [= ]’ + ⇒ *note ‘unur_auto_set_logss’: funct:unur_auto_set_logss. + + • ‘method = cstd’ ⇒ ‘unur_cstd_new’ (*note CSTD::) + ‘variant = ’ + ⇒ *note ‘unur_cstd_set_variant’: funct:unur_cstd_set_variant. + + • ‘method = dari’ ⇒ ‘unur_dari_new’ (*note DARI::) + ‘cpfactor = ’ + ⇒ *note ‘unur_dari_set_cpfactor’: + funct:unur_dari_set_cpfactor. + ‘squeeze [= ]’ + ⇒ *note ‘unur_dari_set_squeeze’: funct:unur_dari_set_squeeze. + ‘tablesize [= ]’ + ⇒ *note ‘unur_dari_set_tablesize’: + funct:unur_dari_set_tablesize. + ‘verify [= ]’ + ⇒ *note ‘unur_dari_set_verify’: funct:unur_dari_set_verify. + + • ‘method = dau’ ⇒ ‘unur_dau_new’ (*note DAU::) + ‘urnfactor = ’ + ⇒ *note ‘unur_dau_set_urnfactor’: + funct:unur_dau_set_urnfactor. + + • ‘method = dgt’ ⇒ ‘unur_dgt_new’ (*note DGT::) + ‘guidefactor = ’ + ⇒ *note ‘unur_dgt_set_guidefactor’: + funct:unur_dgt_set_guidefactor. + ‘variant = ’ + ⇒ *note ‘unur_dgt_set_variant’: funct:unur_dgt_set_variant. + + • ‘method = dsrou’ ⇒ ‘unur_dsrou_new’ (*note DSROU::) + ‘cdfatmode = ’ + ⇒ *note ‘unur_dsrou_set_cdfatmode’: + funct:unur_dsrou_set_cdfatmode. + ‘verify [= ]’ + ⇒ *note ‘unur_dsrou_set_verify’: funct:unur_dsrou_set_verify. + + • ‘method = dstd’ ⇒ ‘unur_dstd_new’ (*note DSTD::) + ‘variant = ’ + ⇒ *note ‘unur_dstd_set_variant’: funct:unur_dstd_set_variant. + + • ‘method = empk’ ⇒ ‘unur_empk_new’ (*note EMPK::) + ‘beta = ’ + ⇒ *note ‘unur_empk_set_beta’: funct:unur_empk_set_beta. + ‘kernel = ’ + ⇒ *note ‘unur_empk_set_kernel’: funct:unur_empk_set_kernel. + ‘positive [= ]’ + ⇒ *note ‘unur_empk_set_positive’: + funct:unur_empk_set_positive. + ‘smoothing = ’ + ⇒ *note ‘unur_empk_set_smoothing’: + funct:unur_empk_set_smoothing. + ‘varcor [= ]’ + ⇒ *note ‘unur_empk_set_varcor’: funct:unur_empk_set_varcor. + + • ‘method = gibbs’ ⇒ ‘unur_gibbs_new’ (*note GIBBS::) + ‘burnin [= ]’ + ⇒ *note ‘unur_gibbs_set_burnin’: funct:unur_gibbs_set_burnin. + ‘c = ’ + ⇒ *note ‘unur_gibbs_set_c’: funct:unur_gibbs_set_c. + ‘thinning [= ]’ + ⇒ *note ‘unur_gibbs_set_thinning’: + funct:unur_gibbs_set_thinning. + ‘variant_coordinate’ + ⇒ *note ‘unur_gibbs_set_variant_coordinate’: + funct:unur_gibbs_set_variant_coordinate. + ‘variant_random_direction’ + ⇒ *note ‘unur_gibbs_set_variant_random_direction’: + funct:unur_gibbs_set_variant_random_direction. + + • ‘method = hinv’ ⇒ ‘unur_hinv_new’ (*note HINV::) + ‘boundary = , | ()’ + ⇒ *note ‘unur_hinv_set_boundary’: + funct:unur_hinv_set_boundary. + ‘cpoints = (), ’ + ⇒ *note ‘unur_hinv_set_cpoints’: funct:unur_hinv_set_cpoints. + ‘guidefactor = ’ + ⇒ *note ‘unur_hinv_set_guidefactor’: + funct:unur_hinv_set_guidefactor. + ‘max_intervals [= ]’ + ⇒ *note ‘unur_hinv_set_max_intervals’: + funct:unur_hinv_set_max_intervals. + ‘order [= ]’ + ⇒ *note ‘unur_hinv_set_order’: funct:unur_hinv_set_order. + ‘u_resolution = ’ + ⇒ *note ‘unur_hinv_set_u_resolution’: + funct:unur_hinv_set_u_resolution. + + • ‘method = hitro’ ⇒ ‘unur_hitro_new’ (*note HITRO::) + ‘adaptive_multiplier = ’ + ⇒ *note ‘unur_hitro_set_adaptive_multiplier’: + funct:unur_hitro_set_adaptive_multiplier. + ‘burnin [= ]’ + ⇒ *note ‘unur_hitro_set_burnin’: funct:unur_hitro_set_burnin. + ‘r = ’ + ⇒ *note ‘unur_hitro_set_r’: funct:unur_hitro_set_r. + ‘thinning [= ]’ + ⇒ *note ‘unur_hitro_set_thinning’: + funct:unur_hitro_set_thinning. + ‘use_adaptiveline [= ]’ + ⇒ *note ‘unur_hitro_set_use_adaptiveline’: + funct:unur_hitro_set_use_adaptiveline. + ‘use_adaptiverectangle [= ]’ + ⇒ *note ‘unur_hitro_set_use_adaptiverectangle’: + funct:unur_hitro_set_use_adaptiverectangle. + ‘use_boundingrectangle [= ]’ + ⇒ *note ‘unur_hitro_set_use_boundingrectangle’: + funct:unur_hitro_set_use_boundingrectangle. + ‘v = ’ + ⇒ *note ‘unur_hitro_set_v’: funct:unur_hitro_set_v. + ‘variant_coordinate’ + ⇒ *note ‘unur_hitro_set_variant_coordinate’: + funct:unur_hitro_set_variant_coordinate. + ‘variant_random_direction’ + ⇒ *note ‘unur_hitro_set_variant_random_direction’: + funct:unur_hitro_set_variant_random_direction. + + • ‘method = hrb’ ⇒ ‘unur_hrb_new’ (*note HRB::) + ‘upperbound = ’ + ⇒ *note ‘unur_hrb_set_upperbound’: + funct:unur_hrb_set_upperbound. + ‘verify [= ]’ + ⇒ *note ‘unur_hrb_set_verify’: funct:unur_hrb_set_verify. + + • ‘method = hrd’ ⇒ ‘unur_hrd_new’ (*note HRD::) + ‘verify [= ]’ + ⇒ *note ‘unur_hrd_set_verify’: funct:unur_hrd_set_verify. + + • ‘method = hri’ ⇒ ‘unur_hri_new’ (*note HRI::) + ‘p0 = ’ + ⇒ *note ‘unur_hri_set_p0’: funct:unur_hri_set_p0. + ‘verify [= ]’ + ⇒ *note ‘unur_hri_set_verify’: funct:unur_hri_set_verify. + + • ‘method = itdr’ ⇒ ‘unur_itdr_new’ (*note ITDR::) + ‘cp = ’ + ⇒ *note ‘unur_itdr_set_cp’: funct:unur_itdr_set_cp. + ‘ct = ’ + ⇒ *note ‘unur_itdr_set_ct’: funct:unur_itdr_set_ct. + ‘verify [= ]’ + ⇒ *note ‘unur_itdr_set_verify’: funct:unur_itdr_set_verify. + ‘xi = ’ + ⇒ *note ‘unur_itdr_set_xi’: funct:unur_itdr_set_xi. + + • ‘method = mvtdr’ ⇒ ‘unur_mvtdr_new’ (*note MVTDR::) + ‘boundsplitting = ’ + ⇒ *note ‘unur_mvtdr_set_boundsplitting’: + funct:unur_mvtdr_set_boundsplitting. + ‘maxcones [= ]’ + ⇒ *note ‘unur_mvtdr_set_maxcones’: + funct:unur_mvtdr_set_maxcones. + ‘stepsmin [= ]’ + ⇒ *note ‘unur_mvtdr_set_stepsmin’: + funct:unur_mvtdr_set_stepsmin. + ‘verify [= ]’ + ⇒ *note ‘unur_mvtdr_set_verify’: funct:unur_mvtdr_set_verify. + + • ‘method = ninv’ ⇒ ‘unur_ninv_new’ (*note NINV::) + ‘max_iter [= ]’ + ⇒ *note ‘unur_ninv_set_max_iter’: + funct:unur_ninv_set_max_iter. + ‘start = , | ()’ + ⇒ *note ‘unur_ninv_set_start’: funct:unur_ninv_set_start. + ‘table [= ]’ + ⇒ *note ‘unur_ninv_set_table’: funct:unur_ninv_set_table. + ‘u_resolution = ’ + ⇒ *note ‘unur_ninv_set_u_resolution’: + funct:unur_ninv_set_u_resolution. + ‘usebisect’ + ⇒ *note ‘unur_ninv_set_usebisect’: + funct:unur_ninv_set_usebisect. + ‘usenewton’ + ⇒ *note ‘unur_ninv_set_usenewton’: + funct:unur_ninv_set_usenewton. + ‘useregula’ + ⇒ *note ‘unur_ninv_set_useregula’: + funct:unur_ninv_set_useregula. + ‘x_resolution = ’ + ⇒ *note ‘unur_ninv_set_x_resolution’: + funct:unur_ninv_set_x_resolution. + + • ‘method = nrou’ ⇒ ‘unur_nrou_new’ (*note NROU::) + ‘center = ’ + ⇒ *note ‘unur_nrou_set_center’: funct:unur_nrou_set_center. + ‘r = ’ + ⇒ *note ‘unur_nrou_set_r’: funct:unur_nrou_set_r. + ‘u = , | ()’ + ⇒ *note ‘unur_nrou_set_u’: funct:unur_nrou_set_u. + ‘v = ’ + ⇒ *note ‘unur_nrou_set_v’: funct:unur_nrou_set_v. + ‘verify [= ]’ + ⇒ *note ‘unur_nrou_set_verify’: funct:unur_nrou_set_verify. + + • ‘method = pinv’ ⇒ ‘unur_pinv_new’ (*note PINV::) + ‘boundary = , | ()’ + ⇒ *note ‘unur_pinv_set_boundary’: + funct:unur_pinv_set_boundary. + ‘extra_testpoints [= ]’ + ⇒ *note ‘unur_pinv_set_extra_testpoints’: + funct:unur_pinv_set_extra_testpoints. + ‘keepcdf [= ]’ + ⇒ *note ‘unur_pinv_set_keepcdf’: funct:unur_pinv_set_keepcdf. + ‘max_intervals [= ]’ + ⇒ *note ‘unur_pinv_set_max_intervals’: + funct:unur_pinv_set_max_intervals. + ‘order [= ]’ + ⇒ *note ‘unur_pinv_set_order’: funct:unur_pinv_set_order. + ‘searchboundary = , | ()’ + ⇒ *note ‘unur_pinv_set_searchboundary’: + funct:unur_pinv_set_searchboundary. + ‘smoothness [= ]’ + ⇒ *note ‘unur_pinv_set_smoothness’: + funct:unur_pinv_set_smoothness. + ‘u_resolution = ’ + ⇒ *note ‘unur_pinv_set_u_resolution’: + funct:unur_pinv_set_u_resolution. + ‘use_upoints [= ]’ + ⇒ *note ‘unur_pinv_set_use_upoints’: + funct:unur_pinv_set_use_upoints. + ‘usecdf’ + ⇒ *note ‘unur_pinv_set_usecdf’: funct:unur_pinv_set_usecdf. + ‘usepdf’ + ⇒ *note ‘unur_pinv_set_usepdf’: funct:unur_pinv_set_usepdf. + + • ‘method = srou’ ⇒ ‘unur_srou_new’ (*note SROU::) + ‘cdfatmode = ’ + ⇒ *note ‘unur_srou_set_cdfatmode’: + funct:unur_srou_set_cdfatmode. + ‘pdfatmode = ’ + ⇒ *note ‘unur_srou_set_pdfatmode’: + funct:unur_srou_set_pdfatmode. + ‘r = ’ + ⇒ *note ‘unur_srou_set_r’: funct:unur_srou_set_r. + ‘usemirror [= ]’ + ⇒ *note ‘unur_srou_set_usemirror’: + funct:unur_srou_set_usemirror. + ‘usesqueeze [= ]’ + ⇒ *note ‘unur_srou_set_usesqueeze’: + funct:unur_srou_set_usesqueeze. + ‘verify [= ]’ + ⇒ *note ‘unur_srou_set_verify’: funct:unur_srou_set_verify. + + • ‘method = ssr’ ⇒ ‘unur_ssr_new’ (*note SSR::) + ‘cdfatmode = ’ + ⇒ *note ‘unur_ssr_set_cdfatmode’: + funct:unur_ssr_set_cdfatmode. + ‘pdfatmode = ’ + ⇒ *note ‘unur_ssr_set_pdfatmode’: + funct:unur_ssr_set_pdfatmode. + ‘usesqueeze [= ]’ + ⇒ *note ‘unur_ssr_set_usesqueeze’: + funct:unur_ssr_set_usesqueeze. + ‘verify [= ]’ + ⇒ *note ‘unur_ssr_set_verify’: funct:unur_ssr_set_verify. + + • ‘method = tabl’ ⇒ ‘unur_tabl_new’ (*note TABL::) + ‘areafraction = ’ + ⇒ *note ‘unur_tabl_set_areafraction’: + funct:unur_tabl_set_areafraction. + ‘boundary = , | ()’ + ⇒ *note ‘unur_tabl_set_boundary’: + funct:unur_tabl_set_boundary. + ‘cpoints = [, ()] | ()’ + ⇒ *note ‘unur_tabl_set_cpoints’: funct:unur_tabl_set_cpoints. + ‘darsfactor = ’ + ⇒ *note ‘unur_tabl_set_darsfactor’: + funct:unur_tabl_set_darsfactor. + ‘guidefactor = ’ + ⇒ *note ‘unur_tabl_set_guidefactor’: + funct:unur_tabl_set_guidefactor. + ‘max_intervals [= ]’ + ⇒ *note ‘unur_tabl_set_max_intervals’: + funct:unur_tabl_set_max_intervals. + ‘max_sqhratio = ’ + ⇒ *note ‘unur_tabl_set_max_sqhratio’: + funct:unur_tabl_set_max_sqhratio. + ‘nstp [= ]’ + ⇒ *note ‘unur_tabl_set_nstp’: funct:unur_tabl_set_nstp. + ‘pedantic [= ]’ + ⇒ *note ‘unur_tabl_set_pedantic’: + funct:unur_tabl_set_pedantic. + ‘slopes = (), ’ + ⇒ *note ‘unur_tabl_set_slopes’: funct:unur_tabl_set_slopes. + ‘usedars [= ]’ + ⇒ *note ‘unur_tabl_set_usedars’: funct:unur_tabl_set_usedars. + ‘useear [= ]’ + ⇒ *note ‘unur_tabl_set_useear’: funct:unur_tabl_set_useear. + ‘variant_ia [= ]’ + ⇒ *note ‘unur_tabl_set_variant_ia’: + funct:unur_tabl_set_variant_ia. + ‘variant_splitmode = ’ + ⇒ *note ‘unur_tabl_set_variant_splitmode’: + funct:unur_tabl_set_variant_splitmode. + ‘verify [= ]’ + ⇒ *note ‘unur_tabl_set_verify’: funct:unur_tabl_set_verify. + + • ‘method = tdr’ ⇒ ‘unur_tdr_new’ (*note TDR::) + ‘c = ’ + ⇒ *note ‘unur_tdr_set_c’: funct:unur_tdr_set_c. + ‘cpoints = [, ()] | ()’ + ⇒ *note ‘unur_tdr_set_cpoints’: funct:unur_tdr_set_cpoints. + ‘darsfactor = ’ + ⇒ *note ‘unur_tdr_set_darsfactor’: + funct:unur_tdr_set_darsfactor. + ‘guidefactor = ’ + ⇒ *note ‘unur_tdr_set_guidefactor’: + funct:unur_tdr_set_guidefactor. + ‘max_intervals [= ]’ + ⇒ *note ‘unur_tdr_set_max_intervals’: + funct:unur_tdr_set_max_intervals. + ‘max_sqhratio = ’ + ⇒ *note ‘unur_tdr_set_max_sqhratio’: + funct:unur_tdr_set_max_sqhratio. + ‘pedantic [= ]’ + ⇒ *note ‘unur_tdr_set_pedantic’: funct:unur_tdr_set_pedantic. + ‘reinit_ncpoints [= ]’ + ⇒ *note ‘unur_tdr_set_reinit_ncpoints’: + funct:unur_tdr_set_reinit_ncpoints. + ‘reinit_percentiles = [, ()] | ()’ + ⇒ *note ‘unur_tdr_set_reinit_percentiles’: + funct:unur_tdr_set_reinit_percentiles. + ‘usecenter [= ]’ + ⇒ *note ‘unur_tdr_set_usecenter’: + funct:unur_tdr_set_usecenter. + ‘usedars [= ]’ + ⇒ *note ‘unur_tdr_set_usedars’: funct:unur_tdr_set_usedars. + ‘usemode [= ]’ + ⇒ *note ‘unur_tdr_set_usemode’: funct:unur_tdr_set_usemode. + ‘variant_gw’ + ⇒ *note ‘unur_tdr_set_variant_gw’: + funct:unur_tdr_set_variant_gw. + ‘variant_ia’ + ⇒ *note ‘unur_tdr_set_variant_ia’: + funct:unur_tdr_set_variant_ia. + ‘variant_ps’ + ⇒ *note ‘unur_tdr_set_variant_ps’: + funct:unur_tdr_set_variant_ps. + ‘verify [= ]’ + ⇒ *note ‘unur_tdr_set_verify’: funct:unur_tdr_set_verify. + + • ‘method = utdr’ ⇒ ‘unur_utdr_new’ (*note UTDR::) + ‘cpfactor = ’ + ⇒ *note ‘unur_utdr_set_cpfactor’: + funct:unur_utdr_set_cpfactor. + ‘deltafactor = ’ + ⇒ *note ‘unur_utdr_set_deltafactor’: + funct:unur_utdr_set_deltafactor. + ‘pdfatmode = ’ + ⇒ *note ‘unur_utdr_set_pdfatmode’: + funct:unur_utdr_set_pdfatmode. + ‘verify [= ]’ + ⇒ *note ‘unur_utdr_set_verify’: funct:unur_utdr_set_verify. + + • ‘method = vempk’ ⇒ ‘unur_vempk_new’ (*note VEMPK::) + ‘smoothing = ’ + ⇒ *note ‘unur_vempk_set_smoothing’: + funct:unur_vempk_set_smoothing. + ‘varcor [= ]’ + ⇒ *note ‘unur_vempk_set_varcor’: funct:unur_vempk_set_varcor. + + • ‘method = vnrou’ ⇒ ‘unur_vnrou_new’ (*note VNROU::) + ‘r = ’ + ⇒ *note ‘unur_vnrou_set_r’: funct:unur_vnrou_set_r. + ‘v = ’ + ⇒ *note ‘unur_vnrou_set_v’: funct:unur_vnrou_set_v. + ‘verify [= ]’ + ⇒ *note ‘unur_vnrou_set_verify’: funct:unur_vnrou_set_verify. + + +File: unuran.info, Node: StringURNG, Prev: StringMethod, Up: StringAPI + +3.5 Uniform RNG String +====================== + +The value of the ‘urng’ key is passed to the PRNG interface (see *Note +Overview: (prng)Top. for details). However it only works when using +the PRNG library is enabled, see *note Installation:: for details. +There are no other keys. + + IMPORTANT: UNU.RAN creates a new uniform random number generator for +the generator object. The pointer to this uniform generator has to be +read and saved via a ‘unur_get_urng’ call in order to clear the memory +_before_ the UNU.RAN generator object is destroyed. + + If this block is omitted the UNU.RAN default generator is used (which +_must not_ be destroyed). + + +File: unuran.info, Node: Distribution_objects, Next: Methods, Prev: StringAPI, Up: Top + +4 Handling distribution objects +******************************* + +* Menu: + +* AllDistr:: Functions for all kinds of distribution objects +* CONT:: Continuous univariate distributions +* CORDER:: Continuous univariate order statistics +* CEMP:: Continuous empirical univariate distributions +* CVEC:: Continuous multivariate distributions +* CONDI:: Continuous univariate full conditional distribution +* CVEMP:: Continuous empirical multivariate distributions +* MATR:: MATRix distributions +* DISCR:: Discrete univariate distributions + +Objects of type ‘UNUR_DISTR’ are used for handling distributions. All +data about a distribution are stored in this object. UNU.RAN provides +functions that return instances of such objects for standard +distributions (*note Standard distributions: Stddist.). It is then +possible to change these distribution objects by various set calls. +Moreover, it is possible to build a distribution object entirely from +scratch. For this purpose there exists ‘unur_distr__new’ calls +that return an empty object of this type for each object type (eg. +univariate contiuous) which can be filled with the appropriate set +calls. + + UNU.RAN distinguishes between several types of distributions, each of +which has its own sets of possible parameters (for details see the +corresponding sections): + − continuous univariate distributions + − continuous univariate order statistics + − continuous empirical univariate distributions + − continuous multivariate distributions + − continuous empirical multivariate distributions + − matrix distributions + − discrete univariate distributions + + Notice that there are essential data about a distribution, eg. the +PDF, a list of (shape, scale, location) parameters for the distribution, +and the domain of (the possibly truncated) distribution. And there +exist parameters that are/can be derived from these, eg. the mode of +the distribution or the area below the given PDF (which need not be +normalized for many methods). UNU.RAN keeps track of parameters which +are known. Thus if one of the essential parameters is changed all +derived parameters are marked as unknown and must be set again if these +are required for the chosen generation method. Additionally to set +calls there are calls for updating derived parameters for objects +provided by the UNU.RAN library of standard distributions (one for each +parameter to avoid computational overhead since not all parameters are +required for all generator methods). + + All parameters of distribution objects can be read by corresponding +get calls. + + Every generator object has its own copy of a distribution object +which is accessible by a ‘unur_get_distr’ call. Thus the parameter for +this distribution can be read. However, *never* extract the +distribution object out of a generator object and run one of the set +calls on it to modify the distribution. (How should the poor generator +object know what has happend?) Instead there exist calls for each of +the generator methods that change particular parameters of the internal +copy of the distribution object. + +How To Use +.......... + +UNU.RAN collects all data required for a particular generation method in +a _distribution object_. There are two ways to get an instance of a +distributions object: + 1. Build a distribtion from scratch, by means of the corresponding + ‘unur_distr__new’ call, where ‘’ is the type of the + distribution as listed in the below subsections. + + 2. Use the corresponding ‘unur_distr__new’ call to get prebuild + distribution from the UNU.RAN library of standard distributions. + Here ‘’ is the name of the standard distribution in *note + Standard distributions: Stddist. + + In either cases the corresponding ‘unur_distr__set_’ +calls to set the necessary parameters ‘’ (case 1), or change the +values of the standard distribution in case 2 (if this makes sense for +you). In the latter case ‘’ is the type to which the standard +distribution belongs to. These ‘set’ calls return ‘UNUR_SUCCESS’ when +the correspondig parameter has been set successfully. Otherwise an +error code is returned. + + The parameters of a distribution are divided into _essential_ and +_derived_ parameters. + + Notice, that there are some restrictions in setting parameters to +avoid possible confusions. Changing essential parameters marks derived +parameters as ‘unknown’. Some of the parameters cannot be changed any +more when already set; some parameters block each others. In such a +case a new instance of a distribution object has to be build. + + Additionally ‘unur_distr__upd_’ calls can be used for +updating derived parameters for objects provided by the UNU.RAN library +of standard distributions. + + All parameters of a distribution object get be read by means of +‘unur_distr__get_’ calls. + + Every distribution object be identified by its ‘name’ which is a +string of arbitrary characters provided by the user. For standard +distribution it is automatically set to ‘’ in the corresponding +‘new’ call. It can be changed to any other string. + + +File: unuran.info, Node: AllDistr, Next: CONT, Up: Distribution_objects + +4.1 Functions for all kinds of distribution objects +=================================================== + +The calls in this section can be applied to all distribution objects. + + − Destroy ‘free’ an instance of a generator object. + + − Ask for the ‘type’ of a generator object. + + − Ask for the ‘dimension’ of a generator object. + + − Deal with the ‘name’ (identifier string) of a generator object. + +Function reference +------------------ + + -- Function: void unur_distr_free (UNUR_DISTR* DISTRIBUTION) + Destroy the DISTRIBUTION object. + + -- Function: int unur_distr_set_name (UNUR_DISTR* DISTRIBUTION, const + CHAR* NAME) + -- Function: const char* unur_distr_get_name (const UNUR_DISTR* + DISTRIBUTION) + Set and get NAME of DISTRIBUTION. The NAME can be an arbitrary + character string. It can be used to identify generator objects for + the user. It is used by UNU.RAN when printing information of the + distribution object into a log files. + + -- Function: int unur_distr_get_dim (const UNUR_DISTR* DISTRIBUTION) + Get number of components of a random vector (its dimension) the + DISTRIBUTION. + + For univariate distributions it returns dimension ‘1’. + + For matrix distributions it returns the number of components (i.e., + number of rows times number of columns). When the respective + numbers of rows and columns are needed use + ‘unur_distr_matr_get_dim’ instead. + + -- Function: unsigned int unur_distr_get_type (const UNUR_DISTR* + DISTRIBUTION) + Get type of DISTRIBUTION. Possible types are + ‘UNUR_DISTR_CONT’ + univariate continuous distribution + ‘UNUR_DISTR_CEMP’ + empirical continuous univariate distribution (i.e. a sample) + ‘UNUR_DISTR_CVEC’ + continuous mulitvariate distribution + ‘UNUR_DISTR_CVEMP’ + empirical continuous multivariate distribution (i.e. a vector + sample) + ‘UNUR_DISTR_DISCR’ + discrete univariate distribution + ‘UNUR_DISTR_MATR’ + matrix distribution + + Alternatively the ‘unur_distr_is_’ calls can be used. + + -- Function: int unur_distr_is_cont (const UNUR_DISTR* DISTRIBUTION) + ‘TRUE’ if DISTRIBUTION is a continuous univariate distribution. + + -- Function: int unur_distr_is_cvec (const UNUR_DISTR* DISTRIBUTION) + ‘TRUE’ if DISTRIBUTION is a continuous multivariate distribution. + + -- Function: int unur_distr_is_cemp (const UNUR_DISTR* DISTRIBUTION) + ‘TRUE’ if DISTRIBUTION is an empirical continuous univariate + distribution, i.e. a sample. + + -- Function: int unur_distr_is_cvemp (const UNUR_DISTR* DISTRIBUTION) + ‘TRUE’ if DISTRIBUTION is an empirical continuous multivariate + distribution. + + -- Function: int unur_distr_is_discr (const UNUR_DISTR* DISTRIBUTION) + ‘TRUE’ if DISTRIBUTION is a discrete univariate distribution. + + -- Function: int unur_distr_is_matr (const UNUR_DISTR* DISTRIBUTION) + ‘TRUE’ if DISTRIBUTION is a matrix distribution. + + -- Function: int unur_distr_set_extobj (UNUR_DISTR* DISTRIBUTION, const + VOID* EXTOBJ) + Store a pointer to an external object. This might be usefull if + the PDF, PMF, CDF or other functions used to implement a particular + distribution a parameter set that cannot be stored as doubles (e.g. + pointers to some structure that holds information of the + distribution). + + *Important:* When UNU.RAN copies this distribution object into the + generator object, then the address EXTOBJ that this pointer + contains is simply copied. Thus the generator holds an address of + a non-private object! Once the generator object has been created + any change in the external object might effect the generator + object. + + *Warning:* External objects must be used with care. Once the + generator object has been created or the distribution object has + been copied you _must not_ destroy this external object. + + -- Function: const void* unur_distr_get_extobj (const UNUR_DISTR* + DISTRIBUTION) + Get the pointer to the external object. + + _Important:_ Changing this object must be done with with extreme + care. + + +File: unuran.info, Node: CONT, Next: CORDER, Prev: AllDistr, Up: Distribution_objects + +4.2 Continuous univariate distributions +======================================= + +The calls in this section can be applied to continuous univariate +distributions. + + − Create a ‘new’ instance of a continuous univariate distribution. + + − Handle and evaluate distribution function (CDF, ‘cdf’), probability + density function (PDF, ‘pdf’) and the derivative of the density + function (‘dpdf’). The following is important: + . ‘pdf’ need not be normalized, i.e., any integrable + nonnegative function can be used. + . ‘dpdf’ must the derivate of the function provided as ‘pdf’. + . ‘cdf’ must be a distribution function, i.e. it must be + monotonically increasing with range [0,1]. + . If ‘cdf’ and ‘pdf’ are used together for a pariticular + generation method, then ‘pdf’ must be the derivate of the + ‘cdf’, i.e., it must be normalized. + + − Handle and evaluate the logarithm of the probability density + function (logPDF, ‘logpdf’) and the derivative of the logarithm of + the density function (‘dlogpdf’). + + Some methods use the logarithm of the density if available. + + − Set (and change) parameters (‘pdfparams’) and the area below the + graph (‘pdfarea’) of the given density. + + − Set the ‘mode’ (or pole) of the distribution. + + − Set the ‘center’ of the distribution. It is used by some + generation methods to adjust the parameters of the generation + algorithms to gain better performance. It can be seens as the + location of the “central part” of the distribution. + + − Some generation methods require the hazard rate (‘hr’) of the + distribution instead of its ‘pdf’. + + − Alternatively, ‘cdf’, ‘pdf’, ‘dpdf’, and ‘hr’ can be provided as + ‘str’ings instead of function pointers. + + − Set the ‘domain’ of the distribution. Notice that the library also + can handle truncated distributions, i.e., distributions that are + derived from (standard) distributions by simply restricting its + domain to a subset. However, there is a subtle difference between + changing the domain of a distribution object by a + ‘unur_distr_cont_set_domain’ call and changing the (truncated) + domain for an existing generator object. The domain of the + distribution object is used to create the generator object with + hats, squeezes, tables, etc. Whereas truncating the domain of an + existing generator object need not necessarily require a + recomputation of these data. Thus by a + ‘unur__chg_truncated’ call (if available) the sampling + region is restricted to the subset of the domain of the given + distribution object. However, generation methods that require a + recreation of the generator object when the domain is changed have + a ‘unur__chg_domain’ call instead. For these calls there + are of course no restrictions on the given domain (i.e., it is + possible to increase the domain of the distribution) (*note + Methods::, for details). + +Function reference +------------------ + + -- Function: UNUR_DISTR* unur_distr_cont_new (void) + Create a new (empty) object for univariate continuous distribution. + +Essential parameters +.................... + + -- Function: int unur_distr_cont_set_pdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CONT* PDF) + -- Function: int unur_distr_cont_set_dpdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CONT* DPDF) + -- Function: int unur_distr_cont_set_cdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CONT* CDF) + -- Function: int unur_distr_cont_set_invcdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CONT* INVCDF) + Set respective pointer to the probability density function (PDF), + the derivative of the probability density function (dPDF), the + cumulative distribution function (CDF), and the inverse CDF of the + DISTRIBUTION. Each of these function pointers must be of type + ‘double funct(double x, const UNUR_DISTR *distr)’. + + Due to the fact that some of the methods do not require a + normalized PDF the following is important: + + − The given CDF must be the cumulative distribution function of + the (non-truncated) distribution. If a distribution from the + UNU.RAN library of standard distributions (*note Standard + distributions: Stddist.) is truncated, there is no need to + change the CDF. + + − If both the CDF and the PDF are used (for a method or for + order statistics), the PDF must be the derivative of the CDF. + If a truncated distribution for one of the standard + distributions from the UNU.RAN library of standard + distributions is used, there is no need to change the PDF. + + − If the area below the PDF is required for a given distribution + it must be given by the ‘unur_distr_cont_set_pdfarea’ call. + For a truncated distribution this must be of course the + integral of the PDF in the given truncated domain. For + distributions from the UNU.RAN library of standard + distributions this is done automatically by the + ‘unur_distr_cont_upd_pdfarea’ call. + + It is important to note that all these functions must return a + result for all values of X. Eg., if the domain of a given PDF is + the interval [-1,1], then the given function must return ‘0.0’ for + all points outside this interval. In case of an overflow the PDF + should return ‘UNUR_INFINITY’. + + It is not possible to change such a function. Once the PDF or CDF + is set it cannot be overwritten. This also holds when the logPDF + is given or when the PDF is given by the + ‘unur_distr_cont_set_pdfstr’ or ‘unur_distr_cont_set_logpdfstr’ + call. A new distribution object has to be used instead. + + -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_pdf (const + UNUR_DISTR* DISTRIBUTION) + -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_dpdf (const + UNUR_DISTR* DISTRIBUTION) + -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_cdf (const + UNUR_DISTR* DISTRIBUTION) + -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_invcdf (const + UNUR_DISTR* DISTRIBUTION) + Get the respective pointer to the PDF, the derivative of the PDF, + the CDF, and the inverse CDF of the DISTRIBUTION. The pointer is + of type ‘double funct(double x, const UNUR_DISTR *distr)’. If the + corresponding function is not available for the distribution, the + ‘NULL’ pointer is returned. + + -- Function: double unur_distr_cont_eval_pdf (double X, const + UNUR_DISTR* DISTRIBUTION) + -- Function: double unur_distr_cont_eval_dpdf (double X, const + UNUR_DISTR* DISTRIBUTION) + -- Function: double unur_distr_cont_eval_cdf (double X, const + UNUR_DISTR* DISTRIBUTION) + -- Function: double unur_distr_cont_eval_invcdf (double U, const + UNUR_DISTR* DISTRIBUTION) + Evaluate the PDF, derivative of the PDF, the CDF, and the inverse + CDF at X and U,respectively. Notice that DISTRIBUTION must not be + the ‘NULL’ pointer. If the corresponding function is not available + for the distribution, ‘UNUR_INFINITY’ is returned and ‘unur_errno’ + is set to ‘UNUR_ERR_DISTR_DATA’. + + _IMPORTANT:_ In the case of a truncated standard distribution these + calls always return the respective values of the _untruncated_ + distribution! + + -- Function: int unur_distr_cont_set_logpdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CONT* LOGPDF) + -- Function: int unur_distr_cont_set_dlogpdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CONT* DLOGPDF) + -- Function: int unur_distr_cont_set_logcdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CONT* LOGCDF) + -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_logpdf (const + UNUR_DISTR* DISTRIBUTION) + -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_dlogpdf (const + UNUR_DISTR* DISTRIBUTION) + -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_logcdf (const + UNUR_DISTR* DISTRIBUTION) + -- Function: double unur_distr_cont_eval_logpdf (double X, const + UNUR_DISTR* DISTRIBUTION) + -- Function: double unur_distr_cont_eval_dlogpdf (double X, const + UNUR_DISTR* DISTRIBUTION) + -- Function: double unur_distr_cont_eval_logcdf (double X, const + UNUR_DISTR* DISTRIBUTION) + Analogous calls for the logarithm of the density distribution + functions. + + -- Function: int unur_distr_cont_set_pdfstr (UNUR_DISTR* DISTRIBUTION, + const CHAR* PDFSTR) + This function provides an alternative way to set a PDF and its + derivative of the DISTRIBUTION. PDFSTR is a character string that + contains the formula for the PDF, see *note Function String: + StringFunct, for details. The derivative of the given PDF is + computed automatically. See also the remarks for the + ‘unur_distr_cont_set_pdf’ call. + + It is not possible to call this funtion twice or to call this + function after a ‘unur_distr_cont_set_pdf’ call. + + -- Function: int unur_distr_cont_set_cdfstr (UNUR_DISTR* DISTRIBUTION, + const CHAR* CDFSTR) + This function provides an alternative way to set a CDF; analogously + to the ‘unur_distr_cont_set_pdfstr’ call. The PDF and its + derivative of the given CDF are computed automatically. + + -- Function: char* unur_distr_cont_get_pdfstr (const UNUR_DISTR* + DISTRIBUTION) + -- Function: char* unur_distr_cont_get_dpdfstr (const UNUR_DISTR* + DISTRIBUTION) + -- Function: char* unur_distr_cont_get_cdfstr (const UNUR_DISTR* + DISTRIBUTION) + Get pointer to respective string for PDF, derivate of PDF, and CDF + of DISTRIBUTION that is given as string (instead of a function + pointer). This call allocates memory to produce this string. It + should be freed when it is not used any more. + + -- Function: int unur_distr_cont_set_pdfparams (UNUR_DISTR* + DISTRIBUTION, const DOUBLE* PARAMS, int N_PARAMS) + Sets array of parameters for DISTRIBUTION. There is an upper limit + for the number of parameters ‘n_params’. It is given by the macro + ‘UNUR_DISTR_MAXPARAMS’ in ‘unuran_config.h’. (It is set to 5 by + default but can be changed to any appropriate nonnegative number.) + If N_PARAMS is negative or exceeds this limit no parameters are + copied into the distribution object and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_NPARAMS’. + + For standard distributions from the UNU.RAN library the parameters + are checked. Moreover, the domain is updated automatically unless + it has been changed before by a ‘unur_distr_cont_set_domain’ call. + If the given parameters are invalid for the standard distribution, + then no parameters are set and an error code is returned. Notice, + that the given parameter list for such a distribution is handled in + the same way as in the corresponding ‘new’ calls, i.e. optional + parameters for the PDF that are not present in the given list are + (re-)set to their default values. + + *Important:* If the parameters of a distribution from the UNU.RAN + library of standard distributions (*note Standard distributions: + Stddist.) are changed, then neither its mode nor the normalization + constant are updated. Please use the respective calls + ‘unur_distr_cont_upd_mode’ and ‘unur_distr_cont_upd_pdfarea’. + Moreover, if the domain has been changed by a + ‘unur_distr_cont_set_domain’ it is not automatically updated, + either. Updating the normalization constant is in particular very + important, when the CDF of the distribution is used. + + -- Function: int unur_distr_cont_get_pdfparams (const UNUR_DISTR* + DISTRIBUTION, const DOUBLE** PARAMS) + Get number of parameters of the PDF and set pointer PARAMS to array + of parameters. If no parameters are stored in the object, an error + code is returned and ‘params’ is set to ‘NULL’. + + _Important:_ Do *not* change the entries in PARAMS! + + -- Function: int unur_distr_cont_set_pdfparams_vec (UNUR_DISTR* + DISTRIBUTION, int PAR, const DOUBLE* PARAM_VEC, int + N_PARAM_VEC) + This function provides an interface for additional vector + parameters for a continuous DISTRIBUTION. + + It sets the parameter with number PAR. PAR indicates directly + which of the parameters is set and must be a number between ‘0’ and + ‘UNUR_DISTR_MAXPARAMS’-1 (the upper limit of possible parameters + defined in ‘unuran_config.h’; it is set to 5 but can be changed to + any appropriate nonnegative number.) + + The entries of a this parameter are given by the array PARAM_VEC of + size N_PARAM_VEC. + + If PARAM_VEC is ‘NULL’ then the corresponding entry is cleared. + + If an error occurs no parameters are copied into the parameter + object ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. + + -- Function: int unur_distr_cont_get_pdfparams_vec (const UNUR_DISTR* + DISTRIBUTION, int PAR, const DOUBLE** PARAM_VECS) + Get parameter of the PDF with number PAR. The pointer to the + parameter array is stored in PARAM_VECS, its size is returned by + the function. If the requested parameter is not set, then an error + code is returned and ‘params’ is set to ‘NULL’. + + _Important:_ Do *not* change the entries in PARAM_VECS! + + -- Function: int unur_distr_cont_set_logpdfstr (UNUR_DISTR* + DISTRIBUTION, const CHAR* LOGPDFSTR) + -- Function: char* unur_distr_cont_get_logpdfstr (const UNUR_DISTR* + DISTRIBUTION) + -- Function: char* unur_distr_cont_get_dlogpdfstr (const UNUR_DISTR* + DISTRIBUTION) + -- Function: int unur_distr_cont_set_logcdfstr (UNUR_DISTR* + DISTRIBUTION, const CHAR* LOGCDFSTR) + -- Function: char* unur_distr_cont_get_logcdfstr (const UNUR_DISTR* + DISTRIBUTION) + Analogous calls for the logarithm of the density and distribution + functions. + + -- Function: int unur_distr_cont_set_domain (UNUR_DISTR* DISTRIBUTION, + double LEFT, double RIGHT) + Set the left and right borders of the domain of the distribution. + This can also be used to truncate an existing distribution. For + setting the boundary to +/- infinity use ‘+/- UNUR_INFINITY’. If + RIGHT is not strictly greater than LEFT no domain is set and + ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. + + _Important:_ For some technical reasons it is assumed that the + density is unimodal and thus monotone on either side of the mode! + This is used in the case when the given mode is outside of the + original domain. Then the mode is set to the corresponding + boundary of the new domain. If this result is not the desired it + must be changed by using a ‘unur_distr_cont_set_mode’ call (or a + ‘unur_distr_cont_upd_mode’ call). The same holds for the center of + the distribution. + + -- Function: int unur_distr_cont_get_domain (const UNUR_DISTR* + DISTRIBUTION, double* LEFT, double* RIGHT) + Get the left and right borders of the domain of the distribution. + If the domain is not set ‘+/- UNUR_INFINITY’ is assumed and + returned. No error is reported in this case. + + -- Function: int unur_distr_cont_get_truncated (const UNUR_DISTR* + DISTRIBUTION, double* LEFT, double* RIGHT) + Get the left and right borders of the (truncated) domain of the + distribution. For non-truncated distribution this call is + equivalent to the ‘unur_distr_cont_get_domain’ call. + + This call is only useful in connection with a ‘unur_get_distr’ call + to get the boundaries of the sampling region of a generator object. + + -- Function: int unur_distr_cont_set_hr (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CONT* HAZARD) + Set pointer to the hazard rate (HR) of the DISTRIBUTION. + + The _hazard rate_ (or failure rate) is a mathematical way of + describing aging. If the lifetime X is a random variable with + density f(x) and CDF F(x) the hazard rate h(x) is defined as h(x) = + f(x) / (1-F(x)). In other words, h(x) represents the (conditional) + rate of failure of a unit that has survived up to time x with + probability 1-F(x). The key distribution is the exponential + distribution as it has constant hazard rate of value 1. Hazard + rates tending to infinity describe distributions with + sub-exponential tails whereas distributions with hazard rates + tending to zero have heavier tails than the exponential + distribution. + + It is important to note that all these functions must return a + result for all floats x. In case of an overflow the PDF should + return ‘UNUR_INFINITY’. + + *Important*: Do not simply use f(x) / (1-F(x)), since this is + numerically very unstable and results in numerical noise if F(x) is + (very) close to 1. Moreover, if the density f(x) is known a + generation method that uses the density is more appropriate. + + It is not possible to change such a function. Once the HR is set + it cannot be overwritten. This also holds when the HR is given by + the ‘unur_distr_cont_set_hrstr’ call. A new distribution object + has to be used instead. + + -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_hr (const UNUR_DISTR* + DISTRIBUTION) + Get the pointer to the hazard rate of the DISTRIBUTION. The + pointer is of type ‘double funct(double x, const UNUR_DISTR + *distr)’. If the corresponding function is not available for the + distribution, the ‘NULL’ pointer is returned. + + -- Function: double unur_distr_cont_eval_hr (double X, const + UNUR_DISTR* DISTRIBUTION) + Evaluate the hazard rate at X. Notice that DISTRIBUTION must not + be the ‘NULL’ pointer. If the corresponding function is not + available for the distribution, ‘UNUR_INFINITY’ is returned and + ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. + + -- Function: int unur_distr_cont_set_hrstr (UNUR_DISTR* DISTRIBUTION, + const CHAR* HRSTR) + This function provides an alternative way to set a hazard rate and + its derivative of the DISTRIBUTION. HRSTR is a character string + that contains the formula for the HR, see *note Function String: + StringFunct, for details. See also the remarks for the + ‘unur_distr_cont_set_hr’ call. + + It is not possible to call this funtion twice or to call this + function after a ‘unur_distr_cont_set_hr’ call. + + -- Function: char* unur_distr_cont_get_hrstr (const UNUR_DISTR* + DISTRIBUTION) + Get pointer to string for HR of DISTRIBUTION that is given via the + string interface. This call allocates memory to produce this + string. It should be freed when it is not used any more. + +Derived parameters +.................. + +The following paramters *must* be set whenever one of the essential +parameters has been set or changed (and the parameter is required for +the chosen method). + + -- Function: int unur_distr_cont_set_mode (UNUR_DISTR* DISTRIBUTION, + double MODE) + Set mode of DISTRIBUTION. The MODE must be contained in the domain + of DISTRIBUTION. Otherwise the mode is not set and ‘unur_errno’ is + set to ‘UNUR_ERR_DISTR_SET’. For distributions with unbounded + density, this call is used to set the pole of the PDF. Notice that + the PDF should then return ‘UNUR_INFINITY’ at the pole. Notice + that the mode is adjusted when the domain is set, see the remark + for the ‘unur_distr_cont_set_domain’ call. + + -- Function: int unur_distr_cont_upd_mode (UNUR_DISTR* DISTRIBUTION) + Recompute the mode of the DISTRIBUTION. This call works properly + for distribution objects from the UNU.RAN library of standard + distributions when the corresponding function is available. + Otherwise a (slow) numerical mode finder based on Brent’s algorithm + is used. If it failes ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_DATA’. + + -- Function: double unur_distr_cont_get_mode (UNUR_DISTR* DISTRIBUTION) + Get mode of DISTRIBUTION. If the mode is not marked as known, + ‘unur_distr_cont_upd_mode’ is called to compute the mode. If this + is not successful ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is + set to ‘UNUR_ERR_DISTR_GET’. (There is no difference between the + case where no routine for computing the mode is available and the + case where no mode exists for the distribution at all.) + + -- Function: int unur_distr_cont_set_center (UNUR_DISTR* DISTRIBUTION, + double CENTER) + Set center of the DISTRIBUTION. The center is used by some methods + to shift the distribution in order to decrease numerical round-off + error. If not given explicitly a default is used. + + _Important:_ This call does not check whether the center is + contained in the given domain. + + Default: The mode, if set by a ‘unur_distr_cont_set_mode’ or + ‘unur_distr_cont_upd_mode’ call; otherwise ‘0’. + + -- Function: double unur_distr_cont_get_center (const UNUR_DISTR* + DISTRIBUTION) + Get center of the DISTRIBUTION. It always returns some point as + there always exists a default for the center, see + ‘unur_distr_cont_set_center’. + + -- Function: int unur_distr_cont_set_pdfarea (UNUR_DISTR* DISTRIBUTION, + double AREA) + Set the area below the PDF. If ‘area’ is non-positive, no area is + set and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. + + For a distribution object created by the UNU.RAN library of + standard distributions you always should use the + ‘unur_distr_cont_upd_pdfarea’. Otherwise there might be ambiguous + side-effects. + + -- Function: int unur_distr_cont_upd_pdfarea (UNUR_DISTR* DISTRIBUTION) + Recompute the area below the PDF of the distribution. It only + works for distribution objects from the UNU.RAN library of standard + distributions when the corresponding function is available. + Otherwise ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. + + This call also sets the normalization constant such that the given + PDF is the derivative of a given CDF, i.e. the area is 1. + However, for truncated distributions the area is smaller than 1. + + The call does not work for distributions from the UNU.RAN library + of standard distributions with truncated domain when the CDF is not + available. + + -- Function: double unur_distr_cont_get_pdfarea (UNUR_DISTR* + DISTRIBUTION) + Get the area below the PDF of the distribution. If this area is + not known, + ‘unur_distr_cont_upd_pdfarea’ is called to compute it. If this is + not successful ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set + to ‘UNUR_ERR_DISTR_GET’. + + +File: unuran.info, Node: CORDER, Next: CEMP, Prev: CONT, Up: Distribution_objects + +4.3 Continuous univariate order statistics +========================================== + +These are special cases of a continuous univariate distributions and +thus they have most of these parameters (with the exception that +functions cannot be changed). Additionally, + + − there is a call to extract the underlying distribution, + + − and a call to handle the ‘rank’ of the order statistics. + +Function reference +------------------ + + -- Function: UNUR_DISTR* unur_distr_corder_new (const UNUR_DISTR* + DISTRIBUTION, int N, int K) + Create an object for order statistics of sample size N and rank K. + DISTRIBUTION must be a pointer to a univariate continuous + distribution. The resulting generator object is of the same type + as of a ‘unur_distr_cont_new’ call. (However, it cannot be used to + make an order statistics out of an order statistics.) + + To have a PDF for the order statistics, the given distribution + object must contain a CDF and a PDF. Moreover, it is assumed that + the given PDF is the derivative of the given CDF. Otherwise the + area below the PDF of the order statistics is not computed + correctly. + + _Important:_ There is no warning when the computed area below the + PDF of the order statistics is wrong. + + -- Function: const UNUR_DISTR* unur_distr_corder_get_distribution + (const UNUR_DISTR* DISTRIBUTION) + Get pointer to distribution object for underlying distribution. + +Essential parameters +.................... + + -- Function: int unur_distr_corder_set_rank (UNUR_DISTR* DISTRIBUTION, + int N, int K) + Change sample size N and rank K of order statistics. In case of + invalid data, no parameters are changed. The area below the PDF + can be set to that of the underlying distribution by a + ‘unur_distr_corder_upd_pdfarea’ call. + + -- Function: int unur_distr_corder_get_rank (const UNUR_DISTR* + DISTRIBUTION, int* N, int* K) + Get sample size N and rank K of order statistics. In case of error + an error code is returned. + + Additionally most of the set and get calls for continuous univariate +distributions work. The most important exceptions are that the PDF and +CDF cannot be changed and ‘unur_distr_cont_upd_mode’ uses in any way a +(slow) numerical method that might fail. + + -- Function: UNUR_FUNCT_CONT* unur_distr_corder_get_pdf (UNUR_DISTR* + DISTRIBUTION) + -- Function: UNUR_FUNCT_CONT* unur_distr_corder_get_dpdf (UNUR_DISTR* + DISTRIBUTION) + -- Function: UNUR_FUNCT_CONT* unur_distr_corder_get_cdf (UNUR_DISTR* + DISTRIBUTION) + Get the respective pointer to the PDF, the derivative of the PDF + and the CDF of the distribution, respectively. The pointer is of + type ‘double funct(double x, UNUR_DISTR *distr)’. If the + corresponding function is not available for the distribution, the + ‘NULL’ pointer is returned. See also ‘unur_distr_cont_get_pdf’. + (Macro) + + -- Function: double unur_distr_corder_eval_pdf (double X, UNUR_DISTR* + DISTRIBUTION) + -- Function: double unur_distr_corder_eval_dpdf (double X, UNUR_DISTR* + DISTRIBUTION) + -- Function: double unur_distr_corder_eval_cdf (double X, UNUR_DISTR* + DISTRIBUTION) + Evaluate the PDF, derivative of the PDF. and the CDF, respectively, + at X. Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If + the corresponding function is not available for the distribution, + ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_DATA’. See also ‘unur_distr_cont_eval_pdf’. + (Macro) + + _IMPORTANT:_ In the case of a truncated standard distribution these + calls always return the respective values of the _untruncated_ + distribution! + + -- Function: int unur_distr_corder_set_pdfparams (UNUR_DISTR* + DISTRIBUTION, double* PARAMS, int N_PARAMS) + Set array of parameters for underlying distribution. See + ‘unur_distr_cont_set_pdfparams’ for details. (Macro) + + -- Function: int unur_distr_corder_get_pdfparams (UNUR_DISTR* + DISTRIBUTION, double** PARAMS) + Get number of parameters of the PDF of the underlying distribution + and set pointer PARAMS to array of parameters. See + ‘unur_distr_cont_get_pdfparams’ for details. (Macro) + + -- Function: int unur_distr_corder_set_domain (UNUR_DISTR* + DISTRIBUTION, double LEFT, double RIGHT) + Set the left and right borders of the domain of the distribution. + See ‘unur_distr_cont_set_domain’ for details. (Macro) + + -- Function: int unur_distr_corder_get_domain (UNUR_DISTR* + DISTRIBUTION, double* LEFT, double* RIGHT) + Get the left and right borders of the domain of the distribution. + See ‘unur_distr_cont_get_domain’ for details. (Macro) + + -- Function: int unur_distr_corder_get_truncated (UNUR_DISTR* + DISTRIBUTION, double* LEFT, double* RIGHT) + Get the left and right borders of the (truncated) domain of the + distribution. See ‘unur_distr_cont_get_truncated’ for details. + (Macro) + +Derived parameters +.................. + +The following paramters *must* be set whenever one of the essential +parameters has been set or changed (and the parameter is required for +the chosen method). + + -- Function: int unur_distr_corder_set_mode (UNUR_DISTR* DISTRIBUTION, + double MODE) + Set mode of distribution. See also ‘unur_distr_corder_set_mode’. + (Macro) + + -- Function: double unur_distr_corder_upd_mode (UNUR_DISTR* + DISTRIBUTION) + Recompute the mode of the distribution numerically. Notice that + this routine is slow and might not work properly in every case. + See also ‘unur_distr_cont_upd_mode’ for further details. (Macro) + + -- Function: double unur_distr_corder_get_mode (UNUR_DISTR* + DISTRIBUTION) + Get mode of distribution. See ‘unur_distr_cont_get_mode’ for + details. (Macro) + + -- Function: int unur_distr_corder_set_pdfarea (UNUR_DISTR* + DISTRIBUTION, double AREA) + Set the area below the PDF. See ‘unur_distr_cont_set_pdfarea’ for + details. (Macro) + + -- Function: double unur_distr_corder_upd_pdfarea (UNUR_DISTR* + DISTRIBUTION) + Recompute the area below the PDF of the distribution. It only + works for order statistics for distribution objects from the + UNU.RAN library of standard distributions when the corresponding + function is available. ‘unur_distr_cont_upd_pdfarea’ assumes that + the PDF of the underlying distribution is normalized, i.e. it is + the derivative of its CDF. Otherwise the computed area is wrong and + there is *no* warning about this failure. See + ‘unur_distr_cont_upd_pdfarea’ for further details. (Macro) + + -- Function: double unur_distr_corder_get_pdfarea (UNUR_DISTR* + DISTRIBUTION) + Get the area below the PDF of the distribution. See + ‘unur_distr_cont_get_pdfarea’ for details. (Macro) + + +File: unuran.info, Node: CEMP, Next: CVEC, Prev: CORDER, Up: Distribution_objects + +4.4 Continuous empirical univariate distributions +================================================= + +Empirical univariate distributions are derived from observed data. +There are two ways to create such a generator object: + 1. By a list of _raw data_ by means of a ‘unur_distr_cemp_set_data’ + call. + 2. By a _histogram_ (i.e. preprocessed data) by means of a + ‘unur_distr_cemp_set_hist’ call. + How these data are used to sample from the empirical distribution +depends from the chosen generation method. + +Function reference +------------------ + + -- Function: UNUR_DISTR* unur_distr_cemp_new (void) + Create a new (empty) object for empirical univariate continuous + distribution. + +Essential parameters +.................... + + -- Function: int unur_distr_cemp_set_data (UNUR_DISTR* DISTRIBUTION, + const DOUBLE* SAMPLE, int N_SAMPLE) + Set observed sample for empirical distribution. + + -- Function: int unur_distr_cemp_read_data (UNUR_DISTR* DISTRIBUTION, + const CHAR* FILENAME) + Read data from file ‘filename’. It reads the first number from + each line. Numbers are parsed by means of the C standard routine + ‘strtod’. Lines that do not start with ‘+’, ‘-’, ‘.’, or a digit + are ignored. (Beware of lines starting with a blank!) + + In case of an error (file cannot be opened, invalid string for + double in line) no data are copied into the distribution object and + an error code is returned. + + -- Function: int unur_distr_cemp_get_data (const UNUR_DISTR* + DISTRIBUTION, const DOUBLE** SAMPLE) + Get number of samples and set pointer SAMPLE to array of + observations. If no sample has been given, an error code is + returned and ‘sample’ is set to ‘NULL’. + + _Important:_ Do *not* change the entries in SAMPLE! + + -- Function: int unur_distr_cemp_set_hist (UNUR_DISTR* DISTRIBUTION, + const DOUBLE* PROB, int N_PROB, double XMIN, double XMAX) + Set a histogram with bins of equal width. PROB is an array of + length N_PROB that contains the probabilities for the bins (in + ascending order). XMIN and XMAX give the lower and upper bound of + the histogram, respectively. The bins are assumed to have equal + width. + + _Remark:_ This is shortcut for calling + ‘unur_distr_cemp_set_hist_prob’ and + ‘unur_distr_cemp_set_hist_domain’. _Notice:_ All sampling methods + either use raw data or histogram. It is possible to set both types + of data; however, it is not checked whether the given histogran + corresponds to possibly given raw data. + + -- Function: int unur_distr_cemp_set_hist_prob (UNUR_DISTR* + DISTRIBUTION, const DOUBLE* PROB, int N_PROB) + Set probabilities of a histogram with N_PROB bins. Hence PROB must + be an array of length N_PROB that contains the probabilities for + the bins in ascending order. It is important also to set the + location of the bins either with a + ‘unur_distr_cemp_set_hist_domain’ for bins of equal width or + ‘unur_distr_cemp_set_hist_bins’ when the bins have different width. + + _Notice:_ All sampling methods either use raw data or histogram. + It is possible to set both types of data; however, it is not + checked whether the given histogram corresponds to possibly given + raw data. + + -- Function: int unur_distr_cemp_set_hist_domain (UNUR_DISTR* + DISTRIBUTION, double XMIN, double XMAX) + Set a domain of a histogram with bins of equal width. XMIN and + XMAX give the lower and upper bound of the histogram, respectively. + + -- Function: int unur_distr_cemp_set_hist_bins (UNUR_DISTR* + DISTRIBUTION, const DOUBLE* BINS, int N_BINS) + Set location of bins of a histogram with N_BINS bins. Hence BINS + must be an array of length N_BINS. The domain of the DISTRIBUTION + is automatically set by this call and overrides any calls to + ‘unur_distr_cemp_set_hist_domain’. _Important:_ The probabilities + of the bins of the DISTRIBUTION must be already be set by a + ‘unur_distr_cemp_set_hist_prob’ (or a ‘unur_distr_cemp_set_hist’ + call) and the value of N_BINS must equal N_PROB‘+1’ from the + corresponding value of the respective call. + + +File: unuran.info, Node: CVEC, Next: CONDI, Prev: CEMP, Up: Distribution_objects + +4.5 Continuous multivariate distributions +========================================= + +The following calls handle multivariate distributions. However, the +requirements of particular generation methods is not as unique as for +univariate distributions. Moreover, random vector generation methods +are still under development. The below functions are a first attempt to +handle this situation. + + Notice that some of the parameters – when given carelessly – might +contradict to others. For example: Some methods require the marginal +distribution and some methods need a standardized form of the marginal +distributions, where the actual mean and variance is stored in the mean +vector and the covariance matrix, respectively. + + We also have to mention that some methods might abuse some of the +parameters. Please read the discription of the chosen sampling method +carfully. + + The following kind of calls exists: + + − Create a ‘new’ instance of a continuous multivariate distribution; + + − Handle and evaluate probability density function (PDF, ‘pdf’) and + the gradient of the density function (‘dpdf’). The following is + important: + . ‘pdf’ need not be normalized, i.e., any integrable + nonnegative function can be used. + . ‘dpdf’ must the derivate of the function provided as ‘pdf’. + + − Handle and evaluate the logarithm of the probability density + function (logPDF, ‘logpdf’) and the gradient of the logarithm of + the density function (‘dlogpdf’). + + Some methods use the logarithm of the density if available. + + − Set (and change) parameters (‘pdfparams’) and the volume below the + graph (‘pdfvol’) of the given density. + + − Set ‘mode’ and ‘mean’ of the distribution. + + − Set the ‘center’ of the distribution. It is used by some + generation methods to adjust the parameters of the generation + algorithms to gain better performance. It can be seens as the + location of the “central part” of the distribution. + + − Handle the ‘covar’iance matrix of the distribution and its + ‘cholesky’ and ‘inv’verse matrices. + + − Set the ‘rankcorr’elation matrix of the distribution. + + − Deal with ‘marginal’ distributions. + + − Set domain of the distribution. + +Function reference +------------------ + + -- Function: UNUR_DISTR* unur_distr_cvec_new (int DIM) + Create a new (empty) object for multivariate continuous + distribution. DIM is the number of components of the random vector + (i.e. its dimension). It is also possible to use dimension 1. + Notice, however, that this is treated as a distribution of random + vectors with only one component and not as a distribution of real + numbers. For the latter ‘unur_distr_cont_new’ should be used to + create an object for a univariate distribution. + +Essential parameters +.................... + + -- Function: int unur_distr_cvec_set_pdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CVEC* PDF) + Set respective pointer to the PDF of the DISTRIBUTION. This + function must be of type ‘double funct(const double *x, UNUR_DISTR + *distr)’, where X must be a pointer to a double array of + appropriate size (i.e. of the same size as given to the + ‘unur_distr_cvec_new’ call). + + It is not necessary that the given PDF is normalized, i.e. the + integral need not be 1. Nevertheless the volume below the PDF can + be provided by a ‘unur_distr_cvec_set_pdfvol’ call. + + It is not possible to change the PDF. Once the PDF is set it cannot + be overwritten. This also holds when the logPDF is given. A new + distribution object has to be used instead. + + -- Function: int unur_distr_cvec_set_dpdf (UNUR_DISTR* DISTRIBUTION, + UNUR_VFUNCT_CVEC* DPDF) + Set pointer to the gradient of the PDF. The type of this function + must be ‘int funct(double *result, const double *x, UNUR_DISTR + *distr)’, where RESULT and X must be pointers to double arrays of + appropriate size (i.e. of the same size as given to the + ‘unur_distr_cvec_new’ call). The gradient of the PDF is stored in + the array RESULT. The function should return an error code in case + of an error and must return ‘UNUR_SUCCESS’ otherwise. + + The given function must be the gradient of the function given by a + ‘unur_distr_cvec_set_pdf’ call. + + It is not possible to change the gradient of the PDF. Once the dPDF + is set it cannot be overwritten. This also holds when the gradient + of the logPDF is given. A new distribution object has to be used + instead. + + -- Function: int unur_distr_cvec_set_pdpdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCTD_CVEC* PDPDF) + Set pointer to partial derivatives of the PDF. The type of this + function must be ‘double funct(const double *x, int coord, + UNUR_DISTR *distr)’, where X must be a pointer to a double array of + appropriate size (i.e. of the same size as given to the + ‘unur_distr_cvec_new’ call). COORD is the coordinate for which the + partial dervative should be computed. + + Notice that COORD must be an integer from {0,...,dim-1}. + + It is not possible to change the partial derivative of the PDF. + Once the pdPDF is set it cannot be overwritten. This also holds + when the partial derivative of the logPDF is given. A new + distribution object has to be used instead. + + -- Function: UNUR_FUNCT_CVEC* unur_distr_cvec_get_pdf (const + UNUR_DISTR* DISTRIBUTION) + Get the pointer to the PDF of the DISTRIBUTION. The pointer is of + type ‘double funct(const double *x, UNUR_DISTR *distr)’. If the + corresponding function is not available for the DISTRIBUTION, the + ‘NULL’ pointer is returned. + + -- Function: UNUR_VFUNCT_CVEC* unur_distr_cvec_get_dpdf (const + UNUR_DISTR* DISTRIBUTION) + Get the pointer to the gradient of the PDF of the DISTRIBUTION. + The pointer is of type ‘int double funct(double *result, const + double *x, UNUR_DISTR *distr)’. If the corresponding function is + not available for the DISTRIBUTION, the ‘NULL’ pointer is returned. + + -- Function: double unur_distr_cvec_eval_pdf (const DOUBLE* X, + UNUR_DISTR* DISTRIBUTION) + Evaluate the PDF of the DISTRIBUTION at X. X must be a pointer to + a double array of appropriate size (i.e. of the same size as given + to the ‘unur_distr_cvec_new’ call) that contains the vector for + which the function has to be evaluated. + + Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the + corresponding function is not available for the DISTRIBUTION, + ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_DATA’. + + -- Function: int unur_distr_cvec_eval_dpdf (double* RESULT, const + DOUBLE* X, UNUR_DISTR* DISTRIBUTION) + Evaluate the gradient of the PDF of the DISTRIBUTION at X. The + result is stored in the double array RESULT. Both RESULT and X + must be pointer to double arrays of appropriate size (i.e. of the + same size as given to the ‘unur_distr_cvec_new’ call). + + Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the + corresponding function is not available for the DISTRIBUTION, an + error code is returned and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_DATA’ (RESULT is left unmodified). + + -- Function: double unur_distr_cvec_eval_pdpdf (const DOUBLE* X, int + COORD, UNUR_DISTR* DISTRIBUTION) + Evaluate the partial derivative of the PDF of the DISTRIBUTION at X + for the coordinate COORD. X must be a pointer to a double array of + appropriate size (i.e. of the same size as given to the + ‘unur_distr_cvec_new’ call) that contains the vector for which the + function has to be evaluated. + + Notice that COORD must be an integer from {0,...,dim-1}. + + Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the + corresponding function is not available for the DISTRIBUTION, + ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_DATA’. + + -- Function: int unur_distr_cvec_set_logpdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CVEC* LOGPDF) + -- Function: int unur_distr_cvec_set_dlogpdf (UNUR_DISTR* DISTRIBUTION, + UNUR_VFUNCT_CVEC* DLOGPDF) + -- Function: int unur_distr_cvec_set_pdlogpdf (UNUR_DISTR* + DISTRIBUTION, UNUR_FUNCTD_CVEC* PDLOGPDF) + -- Function: UNUR_FUNCT_CVEC* unur_distr_cvec_get_logpdf (const + UNUR_DISTR* DISTRIBUTION) + -- Function: UNUR_VFUNCT_CVEC* unur_distr_cvec_get_dlogpdf (const + UNUR_DISTR* DISTRIBUTION) + -- Function: double unur_distr_cvec_eval_logpdf (const DOUBLE* X, + UNUR_DISTR* DISTRIBUTION) + -- Function: int unur_distr_cvec_eval_dlogpdf (double* RESULT, const + DOUBLE* X, UNUR_DISTR* DISTRIBUTION) + -- Function: double unur_distr_cvec_eval_pdlogpdf (const DOUBLE* X, int + COORD, UNUR_DISTR* DISTRIBUTION) + Analogous calls for the logarithm of the density function. + + -- Function: int unur_distr_cvec_set_mean (UNUR_DISTR* DISTRIBUTION, + const DOUBLE* MEAN) + Set mean vector for multivariate DISTRIBUTION. MEAN must be a + pointer to an array of size ‘dim’, where ‘dim’ is the dimension + returned by ‘unur_distr_get_dim’. A ‘NULL’ pointer for MEAN is + interpreted as the zero vector (0,...,0). + + *Important:* If the parameters of a distribution from the UNU.RAN + library of standard distributions (*note Standard distributions: + Stddist.) are changed, then neither its mode nor the normalization + constant are updated. Please use the respective calls + ‘unur_distr_cvec_upd_mode’ and ‘unur_distr_cvec_upd_pdfvol’. + + -- Function: const double* unur_distr_cvec_get_mean (const UNUR_DISTR* + DISTRIBUTION) + Get the mean vector of the DISTRIBUTION. The function returns a + pointer to an array of size ‘dim’. If the mean vector is not + marked as known the ‘NULL’ pointer is returned and ‘unur_errno’ is + set to ‘UNUR_ERR_DISTR_GET’. + + _Important:_ Do *not* modify the array that holds the mean vector! + + -- Function: int unur_distr_cvec_set_covar (UNUR_DISTR* DISTRIBUTION, + const DOUBLE* COVAR) + Set covariance matrix for multivariate DISTRIBUTION. COVAR must be + a pointer to an array of size ‘dim’ x ‘dim’, where ‘dim’ is the + dimension returned by ‘unur_distr_get_dim’. The rows of the matrix + have to be stored consecutively in this array. + + COVAR must be a variance-covariance matrix of the DISTRIBUTION, + i.e. it must be symmetric and positive definit and its diagonal + entries (i.e. the variance of the components of the random vector) + must be strictly positive. The Cholesky factor is computed (and + stored) to verify the positive definiteness condition. Notice that + the inverse of the given covariance matrix is automatically + computed when it is requested by some routine. Notice that the + computation of this inverse matrix is unstable in case of high + correlations and/or high dimensions. Thus it might fail and + methods that require this inverse cannot be used. As an + alternative the inverse of the covariance matrix can be directly + set by a ‘unur_distr_cvec_set_covar_inv’ call. + + A ‘NULL’ pointer for COVAR is interpreted as the identity matrix. + + _Important:_ This entry is abused in some methods which do not + require the covariance matrix. It is then used to perform some + transformation to obtain better performance. + + _Important:_ In case of an error (e.g. because COVAR is not a + valid covariance matrix) an error code is returned. Moreover, the + covariance matrix is not set and is marked as unknown. A + previously set covariance matrix is then no longer available. + + *Important:* If the parameters of a distribution from the UNU.RAN + library of standard distributions (*note Standard distributions: + Stddist.) are changed, then neither its mode nor the normalization + constant are updated. Please use the respective calls + ‘unur_distr_cvec_upd_mode’ and ‘unur_distr_cvec_upd_pdfvol’. + _Remark:_ UNU.RAN does not check whether the an eventually set + covariance matrix and a rank-correlation matrix do not contradict + each other. + + -- Function: int unur_distr_cvec_set_covar_inv (UNUR_DISTR* + DISTRIBUTION, const DOUBLE* COVAR_INV) + Set inverse of the covariance matrix for multivariate DISTRIBUTION. + COVAR_INV must be a pointer to an array of size ‘dim’ x ‘dim’, + where ‘dim’ is the dimension returned by ‘unur_distr_get_dim’. The + rows of the matrix have to be stored consecutively in this array. + + COVAR_INV must be symmetric and positive definit. Only the + symmetry of the matrix is checked. + + A ‘NULL’ pointer for COVAR_INV is interpreted as the identity + matrix. + + _Important:_ In case of an error (because COVAR_INV is not + symetric) an error code is returned. Moreover, the inverse of the + covariance matrix is not set and is marked as unknown. A + previously set inverse matrix is then no longer available. + + _Remark:_ UNU.RAN does not check whether the given matrix is + positive definit. + + _Remark:_ UNU.RAN does not check whether the matrix COVAR_INV is + the inverse of the eventually set covariance matrix. + + -- Function: const double* unur_distr_cvec_get_covar (const UNUR_DISTR* + DISTRIBUTION) + -- Function: const double* unur_distr_cvec_get_cholesky (const + UNUR_DISTR* DISTRIBUTION) + -- Function: const double* unur_distr_cvec_get_covar_inv (UNUR_DISTR* + DISTRIBUTION) + Get covariance matrix of DISTRIBUTION, its Cholesky factor, and its + inverse, respectively. The function returns a pointer to an array + of size ‘dim’ x ‘dim’. The rows of the matrix are stored + consecutively in this array. If the requested matrix is not marked + as known the ‘NULL’ pointer is returned and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_GET’. + + _Important:_ Do *not* modify the array that holds the covariance + matrix! + + _Remark:_ The inverse of the covariance matrix is computed if it is + not already stored. + + -- Function: int unur_distr_cvec_set_rankcorr (UNUR_DISTR* + DISTRIBUTION, const DOUBLE* RANKCORR) + Set rank-correlation matrix (Spearman’s correlation) for + multivariate DISTRIBUTION. RANKCORR must be a pointer to an array + of size ‘dim’ x ‘dim’, where ‘dim’ is the dimension returned by + ‘unur_distr_get_dim’. The rows of the matrix have to be stored + consecutively in this array. + + RANKCORR must be a rank-correlation matrix of the DISTRIBUTION, + i.e. it must be symmetric and positive definite and its diagonal + entries must be equal to ‘1’. + + The Cholesky factor is computed (and stored) to verify the positive + definiteness condition. + + A ‘NULL’ pointer for RANKCORR is interpreted as the identity + matrix. + + _Important:_ In case of an error (e.g. because RANKCORR is not a + valid rank-correlation matrix) an error code is returned. + Moreover, the rank-correlation matrix is not set and is marked as + unknown. A previously set rank-correlation matrix is then no + longer available. + + _Remark:_ UNU.RAN does not check whether the an eventually set + covariance matrix and a rank-correlation matrix do not contradict + each other. + + -- Function: const double* unur_distr_cvec_get_rankcorr (const + UNUR_DISTR* DISTRIBUTION) + -- Function: const double* unur_distr_cvec_get_rk_cholesky (const + UNUR_DISTR* DISTRIBUTION) + Get rank-correlation matrix and its cholesky factor, respectively, + of DISTRIBUTION. The function returns a pointer to an array of + size ‘dim’ x ‘dim’. The rows of the matrix are stored + consecutively in this array. If the requested matrix is not marked + as known the ‘NULL’ pointer is returned and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_GET’. + + _Important:_ Do *not* modify the array that holds the + rank-correlation matrix! + + -- Function: int unur_distr_cvec_set_marginals (UNUR_DISTR* + DISTRIBUTION, UNUR_DISTR* MARGINAL) + Sets marginal distributions of the given DISTRIBUTION to the same + MARGINAL distribution object. The MARGINAL distribution must be an + instance of a continuous univariate distribution object. Notice + that the marginal distribution is copied into the DISTRIBUTION + object. + + -- Function: int unur_distr_cvec_set_marginal_array (UNUR_DISTR* + DISTRIBUTION, UNUR_DISTR** MARGINALS) + Analogously to the above ‘unur_distr_cvec_set_marginals’ call. + However, now an array MARGINALS of the pointers to each of the + marginal distributions must be given. It *must* be an array of + size ‘dim’, where ‘dim’ is the dimension returned by + ‘unur_distr_get_dim’. _Notice_: Local copies for each of the + entries are stored in the DISTRIBUTION object. If some of these + entries are identical (i.e. contain the same pointer), then for + each of these a new copy is made. + + -- Function: int unur_distr_cvec_set_marginal_list (UNUR_DISTR* + DISTRIBUTION, ...) + Similar to the above ‘unur_distr_cvec_set_marginal_array’ call. + However, now the pointers to the particular marginal distributions + can be given as parameter and does not require an array of + pointers. Additionally the given distribution objects are + immediately destroyed. Thus calls like ‘unur_distr_normal’ can be + used as arguments. (With ‘unur_distr_cvec_set_marginal_array’ the + result of such call has to be stored in a pointer since it has to + be freed afterwarts to avoid memory leaks!) + + The number of pointers to in the list of function arguments *must* + be equal to the dimension of the DISTRIBUTION, i.e. the dimension + returned by ‘unur_distr_get_dim’. If one of the given pointer to + marginal distributions is the ‘NULL’ pointer then the marginal + distributions of DISTRIBUTION are not set (or previous settings are + not changed) and an error code is returned. + + *Important:* All distribution objects given in the argument list + are destroyed! + + -- Function: const UNUR_DISTR* unur_distr_cvec_get_marginal (const + UNUR_DISTR* DISTRIBUTION, int N) + Get pointer to the N-th marginal distribution object from the given + multivariate DISTRIBUTION. If this does not exist, ‘NULL’ is + returned. The marginal distributions are enumerated from ‘1’ to + ‘dim’, where ‘dim’ is the dimension returned by + ‘unur_distr_get_dim’. + + -- Function: int unur_distr_cvec_set_pdfparams (UNUR_DISTR* + DISTRIBUTION, const DOUBLE* PARAMS, int N_PARAMS) + Sets array of parameters for DISTRIBUTION. There is an upper limit + for the number of parameters ‘n_params’. It is given by the macro + ‘UNUR_DISTR_MAXPARAMS’ in ‘unuran_config.h’. (It is set to 5 by + default but can be changed to any appropriate nonnegative number.) + If N_PARAMS is negative or exceeds this limit no parameters are + copied into the distribution object and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_NPARAMS’. + + For standard distributions from the UNU.RAN library the parameters + are checked. Moreover, the domain is updated automatically. If + the given parameters are invalid for the standard distribution, + then no parameters are set and an error code is returned. Notice + that the given parameter list for such a distribution is handled in + the same way as in the corresponding ‘new’ calls, i.e. optional + parameters for the PDF that are not present in the given list are + (re-)set to their default values. + + *Important:* If the parameters of a distribution from the UNU.RAN + library of standard distributions (*note Standard distributions: + Stddist.) are changed, then neither its mode nor the normalization + constant are updated. Please use the respective calls + ‘unur_distr_cvec_upd_mode’ and ‘unur_distr_cvec_upd_pdfvol’. + + -- Function: int unur_distr_cvec_get_pdfparams (const UNUR_DISTR* + DISTRIBUTION, const DOUBLE** PARAMS) + Get number of parameters of the PDF and set pointer PARAMS to array + of parameters. If no parameters are stored in the object, an error + code is returned and ‘params’ is set to ‘NULL’. + + _Important:_ Do *not* change the entries in PARAMS! + + -- Function: int unur_distr_cvec_set_pdfparams_vec (UNUR_DISTR* + DISTRIBUTION, int PAR, const DOUBLE* PARAM_VEC, int N_PARAMS) + This function provides an interface for additional vector + parameters for a multivariate DISTRIBUTION besides mean vector and + covariance matrix which have their own calls. + + It sets the parameter with number PAR. PAR indicates directly + which of the parameters is set and must be a number between ‘0’ and + ‘UNUR_DISTR_MAXPARAMS’-1 (the upper limit of possible parameters + defined in ‘unuran_config.h’; it is set to 5 but can be changed to + any appropriate nonnegative number.) + + The entries of a this parameter are given by the array PARAM_VEC of + size N_PARAMS. Notice that using this interface an An (n x + m)-matrix has to be stored in an array of length N_PARAMS = n times + m; where the rows of the matrix are stored consecutively in this + array. + + Due to great variety of possible parameters for a multivariate + DISTRIBUTION there is no simpler interface. + + If PARAM_VEC is ‘NULL’ then the corresponding entry is cleared. + + *Important:* If the parameters of a distribution from the UNU.RAN + library of standard distributions (*note Standard distributions: + Stddist.) are changed, then neither its mode nor the normalization + constant are updated. Please use the respective calls + ‘unur_distr_cvec_upd_mode’ and ‘unur_distr_cvec_upd_pdfvol’. If an + error occurs no parameters are copied into the parameter object + ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. + + -- Function: int unur_distr_cvec_get_pdfparams_vec (const UNUR_DISTR* + DISTRIBUTION, int PAR, const DOUBLE** PARAM_VECS) + Get parameter of the PDF with number PAR. The pointer to the + parameter array is stored in PARAM_VECS, its size is returned by + the function. If the requested parameter is not set, then an error + code is returned and ‘params’ is set to ‘NULL’. + + _Important:_ Do *not* change the entries in PARAM_VECS! + + -- Function: int unur_distr_cvec_set_domain_rect (UNUR_DISTR* + DISTRIBUTION, const DOUBLE* LOWERLEFT, const DOUBLE* + UPPERRIGHT) + Set rectangular domain for DISTRIBUTION with LOWERLEFT and + UPPERRIGHT vertices. Both must be pointer to an array of the size + returned by ‘unur_distr_get_dim’. A ‘NULL’ pointer is interpreted + as the zero vector (0,...,0). For setting a coordinate of the + boundary to +/- infinity use ‘+/- UNUR_INFINITY’. The LOWERLEFT + vertex must be strictly smaller than UPPERRIGHT in each component. + Otherwise no domain is set and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_SET’. + + By default the domain of a distribution is unbounded. Thus one can + use this call to truncate an existing distribution. + + _Important:_ Changing the domain of DISTRIBUTION marks derived + parameters like the mode or the center as unknown and must be set + _after_ changing the domain. This is important for the already set + (or default) value for the center does not fall into the given + domain. Notice that calls of the PDF and derived functions return + ‘0.’ when the parameter is not contained in the domain. + + -- Function: int unur_distr_cvec_is_indomain (const DOUBLE* X, const + UNUR_DISTR* DISTRIBUTION) + Check whether X falls into the domain of DISTRIBUTION. + +Derived parameters +.................. + +The following paramters *must* be set whenever one of the essential +parameters has been set or changed (and the parameter is required for +the chosen method). + + -- Function: int unur_distr_cvec_set_mode (UNUR_DISTR* DISTRIBUTION, + const DOUBLE* MODE) + Set mode of the DISTRIBUTION. MODE must be a pointer to an array + of the size returned by ‘unur_distr_get_dim’. A ‘NULL’ pointer for + MODE is interpreted as the zero vector (0,...,0). + + -- Function: int unur_distr_cvec_upd_mode (UNUR_DISTR* DISTRIBUTION) + Recompute the mode of the DISTRIBUTION. This call works properly + for distribution objects from the UNU.RAN library of standard + distributions when the corresponding function is available. If it + failes ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. + + -- Function: const double* unur_distr_cvec_get_mode (UNUR_DISTR* + DISTRIBUTION) + Get mode of the DISTRIBUTION. The function returns a pointer to an + array of the size returned by ‘unur_distr_get_dim’. If the mode is + not marked as known the ‘NULL’ pointer is returned and ‘unur_errno’ + is set to ‘UNUR_ERR_DISTR_GET’. (There is no difference between + the case where no routine for computing the mode is available and + the case where no mode exists for the DISTRIBUTION at all.) + + _Important:_ Do *not* modify the array that holds the mode! + + -- Function: int unur_distr_cvec_set_center (UNUR_DISTR* DISTRIBUTION, + const DOUBLE* CENTER) + Set center of the DISTRIBUTION. CENTER must be a pointer to an + array of the size returned by ‘unur_distr_get_dim’. A ‘NULL’ + pointer for CENTER is interpreted as the zero vector (0,...,0). + + The center is used by some methods to shift the distribution in + order to decrease numerical round-off error. If not given + explicitly a default is used. Moreover, it is used as starting + point for several numerical search algorithm (e.g. for the mode). + Then CENTER must be a pointer where the call to the PDF returns a + non-zero value. In particular CENTER must contained in the domain + of the distribution. + + Default: The mode, if given by a ‘unur_distr_cvec_set_mode’ call; + else the mean, if given by a ‘unur_distr_cvec_set_mean’ call; + otherwise the null vector (0,...,0). + + -- Function: const double* unur_distr_cvec_get_center (UNUR_DISTR* + DISTRIBUTION) + Get center of the DISTRIBUTION. The function returns a pointer to + an array of the size returned by ‘unur_distr_get_dim’. It always + returns some point as there always exists a default for the center, + see ‘unur_distr_cvec_set_center’. _Important:_ Do *not* modify the + array that holds the center! + + -- Function: int unur_distr_cvec_set_pdfvol (UNUR_DISTR* DISTRIBUTION, + double VOLUME) + Set the volume below the PDF. If VOL is non-positive, no volume is + set and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. + + -- Function: int unur_distr_cvec_upd_pdfvol (UNUR_DISTR* DISTRIBUTION) + Recompute the volume below the PDF of the distribution. It only + works for distribution objects from the UNU.RAN library of standard + distributions when the corresponding function is available. + Otherwise ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. + + This call also sets the normalization constant such that the given + PDF is the derivative of a given CDF, i.e. the volume is 1. + + -- Function: double unur_distr_cvec_get_pdfvol (UNUR_DISTR* + DISTRIBUTION) + Get the volume below the PDF of the DISTRIBUTION. If this volume + is not known, + ‘unur_distr_cont_upd_pdfarea’ is called to compute it. If this is + not successful ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set + to ‘UNUR_ERR_DISTR_GET’. + + +File: unuran.info, Node: CONDI, Next: CVEMP, Prev: CVEC, Up: Distribution_objects + +4.6 Continuous univariate full conditional distribution +======================================================= + +Full conditional distribution for a given continuous multivariate +distributiion. The condition is a position vector and either a variable +that is variated or a vector that indicates the direction on which the +random vector can variate. + + There is a subtle difference between using direction vector and using +the K-th variable. When a direction vector is given the PDF of the +conditional distribution is defined by f(t) = PDF(pos + t * dir). When a +variable is selected the full conditional distribution with all other +variables fixed is used. + + This is a special case of a continuous univariate distribution and +thus they have most of these parameters (with the exception that +functions cannot be changed). Additionally, + + − there is a call to extract the underlying multivariate + distribution, + + − and a call to handle the variables that are fixed and the direction + for changing the random vector. + + This distibution type is primarily used for evaluation the +conditional distribution and its derivative (as required for, e.g., the +Gibbs sampler). The density is not normalized (i.e. does not integrate +to one). Mode and area are not available and it does not make sense to +use any call to set or change parameters except the ones given below. + +Function reference +------------------ + + -- Function: UNUR_DISTR* unur_distr_condi_new (const UNUR_DISTR* + DISTRIBUTION, const DOUBLE* POS, const DOUBLE* DIR, int K) + Create an object for full conditional distribution for the given + DISTRIBUTION. The condition is given by a position vector POS and + either the K-th variable that is variated or the vector DIR that + contains the direction on which the random vector can variate. + + DISTRIBUTION must be a pointer to a multivariate continuous + distribution. POS must be a pointer to an array of size ‘dim’, + where ‘dim’ is the dimension of the underlying distribution object. + DIR must be a pointer to an array if size ‘dim’ or ‘NULL’. K must + be in the range ‘0, ..., dim-1’. If the K-th variable is used, DIR + must be set to ‘NULL’. + + _Notice:_ There is a subtle difference between using direction + vector DIR and using the K-th variable. When DIR is given, the + current position POS is mapped into 0 of the conditional + distribution and the derivative is taken from the function + PDF(POS+t*DIR) w.r.t. t. On the other hand, when the coordinate K + is used (i.e., when DIR is set to ‘NULL’), the full conditional + distribution of the distribution is considered (as used for the + Gibbs sampler). In particular, the current point is just projected + into the one-dimensional subspace without mapping it into the point + 0. + + _Notice:_ If a coordinate K is used, then the K-th partial + derivative is used if it as available. Otherwise the gradient is + computed and the K-th component is returned. + + The resulting generator object is of the same type as of a + ‘unur_distr_cont_new’ call. + + -- Function: int unur_distr_condi_set_condition (struct UNUR_DISTR* + DISTRIBUTION, const DOUBLE* POS, const DOUBLE* DIR, int K) + Set/change condition for conditional DISTRIBUTION. Change values + of fixed variables to POS and use direction DIR or K-th variable of + conditional DISTRIBUTION. + + POS must be a pointer to an array of size ‘dim’, where ‘dim’ is the + dimension of the underlying distribution object. DIR must be a + pointer to an array if size ‘dim’ or ‘NULL’. K must be in the + range ‘0, ..., dim-1’. If the K-th variable is used, DIR must be + set to ‘NULL’. + + _Notice:_ There is a subtle difference between using direction + vector DIR and using the K-th variable. When DIR is given, the + current position POS is mapped into 0 of the conditional + distribution and the derivative is taken from the function + PDF(POS+t*DIR) w.r.t. t. On the other hand, when the coordinate K + is used (i.e., when DIR is set to ‘NULL’), the full conditional + distribution of the distribution is considered (as used for the + Gibbs sampler). In particular, the current point is just projected + into the one-dimensional subspace without mapping it into the point + 0. + + -- Function: int unur_distr_condi_get_condition (struct UNUR_DISTR* + DISTRIBUTION, const DOUBLE** POS, const DOUBLE** DIR, int* K) + Get condition for conditional DISTRIBUTION. The values for the + fixed variables are stored in POS, which must be a pointer to an + array of size ‘dim’. The condition is stored in DIR and K, + respectively. + + _Important:_ Do *not* change the entries in POS and DIR! + + -- Function: const UNUR_DISTR* unur_distr_condi_get_distribution (const + UNUR_DISTR* DISTRIBUTION) + Get pointer to distribution object for underlying distribution. + + +File: unuran.info, Node: CVEMP, Next: MATR, Prev: CONDI, Up: Distribution_objects + +4.7 Continuous empirical multivariate distributions +=================================================== + +Empirical multivariate distributions are just lists of vectors (with the +same dimension). Thus there are only calls to insert these data. How +these data are used to sample from the empirical distribution depends +from the chosen generation method. + +Function reference +------------------ + + -- Function: UNUR_DISTR* unur_distr_cvemp_new (int DIM) + Create a new (empty) object for an empirical multivariate + continuous distribution. DIM is the number of components of the + random vector (i.e. its dimension). It must be at least 2; + otherwise ‘unur_distr_cemp_new’ should be used to create an object + for an empirical univariate distribution. + +Essential parameters +.................... + + -- Function: int unur_distr_cvemp_set_data (UNUR_DISTR* DISTRIBUTION, + const DOUBLE* SAMPLE, int N_SAMPLE) + Set observed sample for empirical DISTRIBUTION. SAMPLE is an array + of doubles of size ‘dim’ x N_SAMPLE, where ‘dim’ is the dimension + of the DISTRIBUTION returned by ‘unur_distr_get_dim’. The data + points must be stored consecutively in SAMPLE, i.e., data points + (x1, y1), (x2, y2), ... are given as an array {x1, y1, x2, y2, + ...}. + + -- Function: int unur_distr_cvemp_read_data (UNUR_DISTR* DISTRIBUTION, + const CHAR* FILENAME) + Read data from file ‘filename’. It reads the first ‘dim’ numbers + from each line, where ‘dim’ is the dimension of the DISTRIBUTION + returned by ‘unur_distr_get_dim’. Numbers are parsed by means of + the C standard routine ‘strtod’. Lines that do not start with ‘+’, + ‘-’, ‘.’, or a digit are ignored. (Beware of lines starting with a + blank!) + + In case of an error (file cannot be opened, too few entries in a + line, invalid string for double in line) no data are copied into + the distribution object and an error code is returned. + + -- Function: int unur_distr_cvemp_get_data (const UNUR_DISTR* + DISTRIBUTION, const DOUBLE** SAMPLE) + Get number of samples and set pointer SAMPLE to array of + observations. If no sample has been given, an error code is + returned and SAMPLE is set to ‘NULL’. If successful SAMPLE points + to an array of length ‘dim’ x ‘n_sample’, where ‘dim’ is the + dimension of the distribution returned by ‘unur_distr_get_dim’ and + ‘n_sample’ the return value of the function. + + _Important:_ Do *not* modify the array SAMPLE. + + +File: unuran.info, Node: MATR, Next: DISCR, Prev: CVEMP, Up: Distribution_objects + +4.8 MATRix distributions +======================== + +Distributions for random matrices. Notice that UNU.RAN uses arrays of +‘double’s to handle matrices. The rows of the matrix are stored +consecutively. + +Function reference +------------------ + + -- Function: UNUR_DISTR* unur_distr_matr_new (int N_ROWS, int N_COLS) + Create a new (empty) object for a matrix distribution. N_ROWS and + N_COLS are the respective numbers of rows and columns of the random + matrix (i.e. its dimensions). It is also possible to have only + one number or rows and/or columns. Notice, however, that this is + treated as a distribution of random matrices with only one row or + column or component and not as a distribution of vectors or real + numbers. For the latter ‘unur_distr_cont_new’ or + ‘unur_distr_cvec_new’ should be used to create an object for a + univariate distribution and a multivariate (vector) distribution, + respectively. + +Essential parameters +.................... + + -- Function: int unur_distr_matr_get_dim (const UNUR_DISTR* + DISTRIBUTION, int* N_ROWS, int* N_COLS) + Get number of rows and columns of random matrix (its dimension). + It returns the total number of components. If successfull + ‘UNUR_SUCCESS’ is returned. + + +File: unuran.info, Node: DISCR, Prev: MATR, Up: Distribution_objects + +4.9 Discrete univariate distributions +===================================== + +The calls in this section can be applied to discrete univariate +distributions. + + − Create a ‘new’ instance of a discrete univariate distribution. + + − Handle and evaluate distribution function (CDF, ‘cdf’) and + probability mass function (PMF, ‘pmf’). The following is + important: + . ‘pmf’ need not be normalized, i.e., any summable nonnegative + function on the set of intergers can be used. + . ‘cdf’ must be a distribution function, i.e. it must be + monotonically increasing with range [0,1]. + . If ‘cdf’ and ‘pdf’ are used together for a pariticular + generation method, then ‘pmf’ must be normalized, i.e. it + must sum to 1. + + − Alternatively, ‘cdf’ and ‘pdf’ can be provided as ‘str’ings instead + of function pointers. + + − Some generation methods require a (finite) probability vector (PV, + ‘pv’), i.e. an array of ‘double’s. It can be automatically + computed if the ‘pmf’ is given but ‘pv’ is not. + + − Set (and change) parameters (‘pmfparams’) and the total sum + (‘pmfsum’) of the given PMF or PV. + + − Set the ‘mode’ of the distribution. + + − Set the ‘domain’ of the distribution. + +Function reference +------------------ + + -- Function: UNUR_DISTR* unur_distr_discr_new (void) + Create a new (empty) object for a univariate discrete distribution. + +Essential parameters +.................... + +There are two interfaces for discrete univariate distributions: Either +provide a (finite) probability vector (PV). Or provide a probability +mass function (PMF). For the latter case there are also a couple of +derived parameters that are not required when a PV is given. + + It is not possible to set both a PMF and a PV directly. However, the +PV can be computed from the PMF (or the CDF if no PMF is available) by +means of a ‘unur_distr_discr_make_pv’ call. If both the PV and the PMF +are given in the distribution object it depends on the generation method +which of these is used. + + -- Function: int unur_distr_discr_set_pv (UNUR_DISTR* DISTRIBUTION, + const DOUBLE* PV, int N_PV) + Set finite probability vector (PV) for the DISTRIBUTION. It is not + necessary that the entries in the given PV sum to 1. N_PV must be + positive. However, there is no testing whether all entries in PV + are non-negative. + + If no domain has been set, then the left boundary is set to ‘0’, by + default. If N_PV is too large, e.g. because left boundary + N_PV + exceeds the range of integers, then the call fails. + + Notice that it is not possible to set both a PV and a PMF or CDF. + If the PMF or CDF is set first one cannot set the PV. If the PMF or + CDF is set first after a PV is set, the latter is removed (and + recomputed using ‘unur_distr_discr_make_pv’ when required). + + -- Function: int unur_distr_discr_make_pv (UNUR_DISTR* DISTRIBUTION) + Compute a PV when a PMF or CDF is given. However, when the domain + is not given or is too large and the sum over the PMF is given then + the (right) tail of the DISTRIBUTION is chopped off such that the + probability for the tail region is less than 1.e-8. If the sum + over the PMF is not given a PV of maximal length is computed. + + The maximal size of the created PV is bounded by the macro + ‘UNUR_MAX_AUTO_PV’ that is defined in ‘unuran_config.h’. + + If successful, the length of the generated PV is returned. If the + sum over the PMF on the chopped tail is not neglible small (i.e. + greater than 1.e-8 or unknown) than the negative of the length of + the PV is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. + + Notice that the left boundary of the PV is set to ‘0’ by default + when a discrete distribution object is created from scratch. + + If computing a PV fails for some reasons, an error code is returned + and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. + + -- Function: int unur_distr_discr_get_pv (const UNUR_DISTR* + DISTRIBUTION, const DOUBLE** PV) + Get length of PV of the DISTRIBUTION and set pointer PV to array of + probabilities. If no PV is given, an error code is returned and PV + is set to ‘NULL’. + (It does not call ‘unur_distr_discr_make_pv’ !) + + -- Function: int unur_distr_discr_set_pmf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_DISCR* PMF) + -- Function: int unur_distr_discr_set_cdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_DISCR* CDF) + Set respective pointer to the PMF and the CDF of the DISTRIBUTION. + These functions must be of type ‘double funct(int k, const + UNUR_DISTR *distr)’. + + It is important to note that all these functions must return a + result for all integers K. E.g., if the domain of a given PMF is + the interval {1,2,3,...,100}, than the given function must return + ‘0.0’ for all points outside this interval. + + The default domain for the PMF or CDF is [‘0’, ‘INT_MAX’]. The + domain can be changed using a ‘unur_distr_discr_set_domain’ call. + + It is not possible to change such a function. Once the PMF or CDF + is set it cannot be overwritten. A new distribution object has to + be used instead. + + Notice that it is not possible to set both a PV and a PMF or CDF. + If the PMF or CDF is set first one cannot set the PV. If the PMF or + CDF is set first after a PV is set, the latter is removed (and + recomputed using ‘unur_distr_discr_make_pv’ when required). + + -- Function: int unur_distr_discr_set_invcdf (UNUR_DISTR* DISTRIBUTION, + UNUR_IFUNCT_DISCR* INVCDF) + Set inverse CDF of the DISTRIBUTION. INVCDF must be a pointer must + be of type ‘int funct(double x, const UNUR_DISTR *distr)’, i.e., it + should return a ‘double’. + + -- Function: double unur_distr_discr_eval_pv (int K, const UNUR_DISTR* + DISTRIBUTION) + -- Function: double unur_distr_discr_eval_pmf (int K, const UNUR_DISTR* + DISTRIBUTION) + -- Function: double unur_distr_discr_eval_cdf (int K, const UNUR_DISTR* + DISTRIBUTION) + Evaluate the PV, PMF, and the CDF, respectively, at k. Notice that + DISTRIBUTION must not be the ‘NULL’ pointer. If no PV is set for + the DISTRIBUTION, then ‘unur_distr_discr_eval_pv’ behaves like + ‘unur_distr_discr_eval_pmf’. If the corresponding function is not + available for the DISTRIBUTION, ‘UNUR_INFINITY’ is returned and + ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. + + _IMPORTANT:_ In the case of a truncated standard distribution these + calls always return the respective values of the _untruncated_ + distribution! + + -- Function: int unur_distr_discr_eval_invcdf (double U, const + UNUR_DISTR* DISTRIBUTION) + Evaluate the inverse CDF at U. Notice that DISTRIBUTION must not + be the ‘NULL’ pointer. If the corresponding function is not + available for the distribution, ‘INT_MAX’ is returned and + ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. + + _IMPORTANT:_ In the case of a truncated standard distribution these + calls always return the respective values of the _untruncated_ + distribution! + + -- Function: int unur_distr_discr_set_pmfstr (UNUR_DISTR* DISTRIBUTION, + const CHAR* PMFSTR) + This function provides an alternative way to set a PMF of the + DISTRIBUTION. PMFSTR is a character string that contains the + formula for the PMF, see *note Function String: StringFunct, for + details. See also the remarks for the ‘unur_distr_discr_set_pmf’ + call. + + It is not possible to call this funtion twice or to call this + function after a ‘unur_distr_discr_set_pmf’ call. + + -- Function: int unur_distr_discr_set_cdfstr (UNUR_DISTR* DISTRIBUTION, + const CHAR* CDFSTR) + This function provides an alternative way to set a CDF; analogously + to the ‘unur_distr_discr_set_pmfstr’ call. + + -- Function: char* unur_distr_discr_get_pmfstr (const UNUR_DISTR* + DISTRIBUTION) + -- Function: char* unur_distr_discr_get_cdfstr (const UNUR_DISTR* + DISTRIBUTION) + Get pointer to respective string for PMF and CDF of DISTRIBUTION + that is given via the string interface. This call allocates memory + to produce this string. It should be freed when it is not used any + more. + + -- Function: int unur_distr_discr_set_pmfparams (UNUR_DISTR* + DISTRIBUTION, const DOUBLE* PARAMS, int N_PARAMS) + Set array of parameters for DISTRIBUTION. There is an upper limit + for the number of parameters N_PARAMS. It is given by the macro + ‘UNUR_DISTR_MAXPARAMS’ in ‘unuran_config.h’. (It is set to 5 but + can be changed to any appropriate nonnegative number.) If N_PARAMS + is negative or exceeds this limit no parameters are copied into the + DISTRIBUTION object and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_NPARAMS’. + + For standard distributions from the UNU.RAN library the parameters + are checked. Moreover, the domain is updated automatically unless + it has been changed before by a ‘unur_distr_discr_set_domain’ call. + If the given parameters are invalid for the standard distribution, + then no parameters are set and an error code is returned. Notice + that the given parameter list for such a distribution is handled in + the same way as in the corresponding ‘new’ calls, i.e. optional + parameters for the PDF that are not present in the given list are + (re-)set to their default values. + + _Important:_ Integer parameter must be given as ‘double’s. + + -- Function: int unur_distr_discr_get_pmfparams (const UNUR_DISTR* + DISTRIBUTION, const DOUBLE** PARAMS) + Get number of parameters of the PMF and set pointer PARAMS to array + of parameters. If no parameters are stored in the object, an error + code is returned and ‘params’ is set to ‘NULL’. + + -- Function: int unur_distr_discr_set_domain (UNUR_DISTR* DISTRIBUTION, + int LEFT, int RIGHT) + Set the left and right borders of the domain of the DISTRIBUTION. + This can also be used to truncate an existing distribution. For + setting the boundary to +/- infinity use ‘INT_MIN’ and ‘INT_MAX’, + respectively. If RIGHT is not strictly greater than LEFT no domain + is set and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. It is + allowed to use this call to increase the domain. If the PV of the + discrete distribution is used, than the right boudary is ignored + (and internally set to LEFT + size of PV - 1). Notice that + ‘INT_MIN’ and ‘INT_MAX’ are interpreted as (minus/plus) infinity. + + Default: [‘0’, ‘INT_MAX’]. + + -- Function: int unur_distr_discr_get_domain (const UNUR_DISTR* + DISTRIBUTION, int* LEFT, int* RIGHT) + Get the left and right borders of the domain of the DISTRIBUTION. + If the domain is not set explicitly the interval [‘INT_MIN’, + ‘INT_MAX’] is assumed and returned. When a PV is given then the + domain is set automatically to [‘0’,size of PV - 1]. + +Derived parameters +.................. + +The following paramters *must* be set whenever one of the essential +parameters has been set or changed (and the parameter is required for +the chosen method). + + -- Function: int unur_distr_discr_set_mode (UNUR_DISTR* DISTRIBUTION, + int MODE) + Set mode of DISTRIBUTION. + + -- Function: int unur_distr_discr_upd_mode (UNUR_DISTR* DISTRIBUTION) + Recompute the mode of the DISTRIBUTION. This call works properly + for distribution objects from the UNU.RAN library of standard + distributions when the corresponding function is available. + Otherwise a (slow) numerical mode finder is used. It only works + properly for unimodal probability mass functions. If it failes + ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. + + -- Function: int unur_distr_discr_get_mode (UNUR_DISTR* DISTRIBUTION) + Get mode of DISTRIBUTION. If the mode is not marked as known, + ‘unur_distr_discr_upd_mode’ is called to compute the mode. If this + is not successful ‘INT_MAX’ is returned and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_GET’. (There is no difference between the case + where no routine for computing the mode is available and the case + where no mode exists for the distribution at all.) + + -- Function: int unur_distr_discr_set_pmfsum (UNUR_DISTR* DISTRIBUTION, + double SUM) + Set the sum over the PMF. If ‘sum’ is non-positive, no sum is set + and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. + + For a distribution object created by the UNU.RAN library of + standard distributions you always should use the + ‘unur_distr_discr_upd_pmfsum’. Otherwise there might be ambiguous + side-effects. + + -- Function: int unur_distr_discr_upd_pmfsum (UNUR_DISTR* DISTRIBUTION) + Recompute the sum over the PMF of the DISTRIBUTION. In most cases + the normalization constant is recomputed and thus the sum is 1. + This call works for distribution objects from the UNU.RAN library + of standard distributions when the corresponding function is + available. When a PV, a PMF with finite domain, or a CDF is given, + a simple generic function which uses a naive summation loop is + used. If this computation is not possible, an error code is + returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. + + The call does not work for distributions from the UNU.RAN library + of standard distributions with truncated domain when the CDF is not + available. + + -- Function: double unur_distr_discr_get_pmfsum (UNUR_DISTR* + DISTRIBUTION) + Get the sum over the PMF of the DISTRIBUTION. If this sum is not + known, ‘unur_distr_discr_upd_pmfsum’ is called to compute it. If + this is not successful ‘UNUR_INFINITY’ is returned and ‘unur_errno’ + is set to ‘UNUR_ERR_DISTR_GET’. + + +File: unuran.info, Node: Methods, Next: URNG, Prev: Distribution_objects, Up: Top + +5 Methods for generating non-uniform random variates +**************************************************** + +* Menu: + +* Methods_all:: Routines for all generator objects +* AUTO:: Select method automatically +* Methods_for_CONT:: Methods for continuous univariate distributions +* Methods_for_CEMP:: Methods for continuous empirical univariate distributions +* Methods_for_CVEC:: Methods for continuous multivariate distributions +* MCMC_Methods_for_CVEC:: Markov chain samplers for continuous multivariate distributions +* Methods_for_CVEMP:: Methods for continuous empirical multivariate distributions +* Methods_for_DISCR:: Methods for discrete univariate distributions +* Methods_for_MATR:: Methods for random matrices +* Methods_for_UNID:: Methods for uniform univariate distributions +* Meta_Methods:: Meta Methods for univariate distributions + +Sampling from a particular distribution with UNU.RAN requires the +following steps: + + 1. Create a distribution object (*note Handling distribution objects: + Distribution_objects.). + + 2. Select a method and create a parameter object. + + 3. Initizialize the generator object using ‘unur_init’. _Important_: + Initialization of the generator object might fail. ‘unur_init’ + returns a ‘NULL’ pointer then, which *must* not be used for + sampling. + + 4. Draw a sample from the generator object using the corresponding + sampling function (depending on the type of distribution: + univariate continuous, univariate discrete, multivariate + continuous, and random matrix). + + 5. It is possible for a generator object to change the parameters and + the domain of the underlying distribution. This must be done by + extracting this object by means of a ‘unur_get_distr’ call and + changing the distribution using the correspondig set calls, see + *note Handling distribution objects: Distribution_objects. The + generator object *must* then be reinitialized by means of the + ‘unur_reinit’ call. + + _Important_: Currently not all methods allow reinitialization, see + the description of the particular method (keyword Reinit). + + _Important_: Reinitialization of the generator object might fail. + Thus one *must* check the return code of the ‘unur_reinit’ call. + + _Important_: When reinitialization fails then sampling routines + always return ‘UNUR_INFINITY’ (for continuous distributions) or ‘0’ + (for discrete distributions), respectively. However, it is still + possible to change the underlying distribution and try to + reinitialize again. + + +File: unuran.info, Node: Methods_all, Next: AUTO, Up: Methods + +5.1 Routines for all generator objects +====================================== + +Routines for all generator objects. + +Function reference +------------------ + + -- Function: UNUR_GEN* unur_init (UNUR_PAR* PARAMETERS) + Initialize a generator object. All necessary information must be + stored in the parameter object. + + *Important:* If an error has occurred a ‘NULL’ pointer is return. + This must not be used for the sampling routines (this causes a + segmentation fault). + + *Always* check whether the call was successful or not! + + _Important:_ This call destroys the PARAMETER object automatically. + Thus it is not necessary/allowed to free it. + + -- Function: int unur_reinit (UNUR_GEN* GENERATOR) + Update an existing generator object after the underlying + distribution has been modified (using ‘unur_get_distr’ together + with corresponding set calls. It *must* be executed before + sampling using this generator object is continued as otherwise it + produces an invalid sample or might even cause a segmentation + fault. + + _Important_: Currently not all methods allow reinitialization, see + the description of the particular method (keyword Reinit). + + _Important_: Reinitialization of the generator object might fail. + Thus one *must* check the return code: + + ‘UNUR_SUCCESS (0x0u)’ + success (no error) + ‘UNUR_ERR_NO_REINIT’ + reinit routine not implemented. + other values + some error has occured while trying to reinitialize the + generator object. + + _Important_: When reinitialization fails then sampling routines + always return ‘UNUR_INFINITY’ (for continuous distributions) or ‘0’ + (for discrete distributions), respectively. However, it is still + possible to change the underlying distribution and try to + reinitialize again. + + _Important_: When one tries to run ‘unur_reinit’, but + reinitialization is not implemented, then the generator object + cannot be used any more and must be destroyed and a new one has to + be built from scratch. + + -- Function: int unur_sample_discr (UNUR_GEN* GENERATOR) + -- Function: double unur_sample_cont (UNUR_GEN* GENERATOR) + -- Function: int unur_sample_vec (UNUR_GEN* GENERATOR, double* VECTOR) + -- Function: int unur_sample_matr (UNUR_GEN* GENERATOR, double* MATRIX) + Sample from generator object. The three routines depend on the + type of the generator object (discrete or continuous univariate + distribution, multivariate distribution, or random matrix). + + _Notice:_ UNU.RAN uses arrays of ‘double’s to handle matrices. + There the rows of the matrix are stored consecutively. + + _Notice:_ The routines ‘unur_sample_vec’ and ‘unur_sample_matr’ + return ‘UNUR_SUCCESS’ if generation was successful and some error + code otherwise. + + *Important:* These routines do *not* check whether GENERATOR is an + invalid ‘NULL’ pointer. + + -- Function: double unur_quantile (UNUR_GEN* GENERATOR, double U) + Compute the U quantile of a continuous distribution using a + GENERATOR object that implements an (approximate) inversion + methods. + + The following methods are currently available: + • HINV, *note HINV::. + • NINV, *note NINV::. + • PINV, *note PINV::. + • CSTD, *note CSTD::. + This requires that GENERATOR implements an inversion method. + • DGT, *note DGT::. + The return value is (of course) type casted to ‘double’. + + *Important:* This routine does *not* check whether GENERATOR is an + invalid ‘NULL’ pointer. + + In case of an error UNUR_INFINITY or INT_MAX (depending on the type + of GENERATOR) is returned. + + -- Function: void unur_free (UNUR_GEN* GENERATOR) + Destroy (free) the given generator object. + + -- Function: const char* unur_gen_info (UNUR_GEN* GENERATOR, int HELP) + Get a string with informations about the given GENERATOR. These + informations allow some fine tuning of the generation method. If + HELP is ‘TRUE’, some hints on setting parameters are given. + + This function is intented for using in interactive environments + (like R). + + If an error occurs, then ‘NULL’ is returned. + + -- Function: int unur_get_dimension (const UNUR_GEN* GENERATOR) + Get the number of dimension of a (multivariate) distribution. For + a univariate distribution ‘1’ is return. + + -- Function: const char* unur_get_genid (const UNUR_GEN* GENERATOR) + Get identifier string for generator. + + -- Function: unsigned int unur_get_method (const UNUR_GEN* GENERATOR) + Get identifier for generating method. These identifiers are + declared in ‘src/methods/unur_metthods.h’. + + -- Function: int unur_gen_is_inversion (const UNUR_GEN* GEN) + Return ‘TRUE’ if the generator object implements an inversion + method, and ‘FALSE’ otherwise. + + -- Function: UNUR_DISTR* unur_get_distr (const UNUR_GEN* GENERATOR) + Get pointer to distribution object from generator object. This + function can be used to change the parameters of the distribution + and reinitialize the generator object. Notice that currently *not + all* generating methods have a reinitialize routine. This function + should be used with extreme care. Changing the distribution is + changed and using the generator object without reinitializing might + cause wrong samples or segmentation faults. Moreover, if the + corresponding generator object is freed, the pointer must not be + used. + + *Important:* The returned distribution object must not be freed. + If the distribution object is changed then one *must* run + ‘unur_reinit’ ! + + -- Function: int unur_set_use_distr_privatecopy (UNUR_PAR* PARAMETERS, + int USE_PRIVATECOPY) + Set flag whether the generator object should make a private copy of + the given distribution object or just stores the pointer to this + distribution object. Values for USE_PRIVATECOPY: + ‘TRUE’ + make a private copy (default) + ‘FALSE’ + do not make a private copy and store pointer to given + (external) distribution object. + + By default, generator objects keep their own private copy of the + given distribution object. Thus the generator object can be + handled independently from other UNU.RAN objects (with uniform + random number generators as the only exception). When the + generator object is initialized the given distribution object is + cloned and stored. + + However, in some rare situations it can be useful when only the + pointer to the given distribution object is stored without making a + private copy. A possible example is when only one random variate + has to be drawn from the distribution. This behavior can be + achieved when USE_LOCALCOPY is set to ‘FALSE’. + + *Warning!* Using a pointer to the external distribution object + instead of a private copy must be done with *extreme care*! When + the distrubtion object is changed or freed then the generator + object does not work any more, might case a segmentation fault, or + (even worse) produces garbage. On the other hand, when the + generator object is initialized or used to draw a random sampling + the distribution object may be changed. + + _Notice:_ The prototypes of all ‘unur__new’ calls use a + ‘const’ qualifier for the distribution argument. However, if + USE_PRIVATECOPY is set to ‘FALSE’ this qualifier is discarded and + the distribution might be changed. + + *Important!* If USE_LOCALCOPY is set to ‘FALSE’ and the + corresponding distribution object is changed then one must run + ‘unur_reinit’ on the generator object. (Notice that currently not + all generation methods support reinitialization.) + + Default: USE_PRIVATECOPY is ‘TRUE’. + + +File: unuran.info, Node: AUTO, Next: Methods_for_CONT, Prev: Methods_all, Up: Methods + +5.2 AUTO – Select method automatically +====================================== + +AUTO selects a an appropriate method for the given distribution object +automatically. There are no parameters for this method, yet. But it is +planned to give some parameter to describe the task for which the random +variate generator is used for and thus make the choice of the generating +method more appropriate. Notice that the required sampling routine for +the generator object depends on the type of the given distribution +object. + + The chosen method also depends on the sample size for which the +generator object will be used. If only a few random variates the order +of magnitude of the sample size should be set via a +‘unur_auto_set_logss’ call. + + IMPORTANT: This is an experimental version and the method chosen may +change in future releases of UNU.RAN. + + For an example see *note As short as possible: Example_0. + +How To Use +.......... + +Create a generator object for the given distribution object. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_auto_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_auto_set_logss (UNUR_PAR* PARAMETERS, int LOGSS) + Set the order of magnitude for the size of the sample that will be + generated by the generator, i.e., the the common logarithm of the + sample size. + + Default is 10. + + Notice: This feature will be used in future releases of UNU.RAN + only. + + +File: unuran.info, Node: Methods_for_CONT, Next: Methods_for_CEMP, Prev: AUTO, Up: Methods + +5.3 Methods for continuous univariate distributions +=================================================== + +* Menu: + +* AROU:: Automatic Ratio-Of-Uniforms method +* ARS:: Adaptive Rejection Sampling +* CEXT:: wrapper for Continuous EXTernal generators +* CSTD:: Continuous STandarD distributions +* HINV:: Hermite interpolation based INVersion of CDF +* HRB:: Hazard Rate Bounded +* HRD:: Hazard Rate Decreasing +* HRI:: Hazard Rate Increasing +* ITDR:: Inverse Transformed Density Rejection +* NINV:: Numerical INVersion +* NROU:: Naive Ratio-Of-Uniforms method +* PINV:: Polynomial interpolation based INVersion of CDF +* SROU:: Simple Ratio-Of-Uniforms method +* SSR:: Simple Setup Rejection +* TABL:: a TABLe method with piecewise constant hats +* TDR:: Transformed Density Rejection +* UTDR:: Universal Transformed Density Rejection + +Overview of methods +------------------- + +Methods for continuous univariate distributions +sample with ‘unur_sample_cont’ + +method PDF dPDF CDF mode area other +AROU x x [x] T-concave +ARS x x T-concave +CEXT wrapper for external generator +CSTD build-in standard distribution +HINV [x] [x] x +HRB bounded hazard rate +HRD decreasing hazard rate +HRI increasing hazard rate +ITDR x x x monotone with pole +NINV [x] x +NROU x [x] +PINV x [x] [~] +SROU x x x T-concave +SSR x x x T-concave +TABL x x [~] all local extrema +TDR x x T-concave +UTDR x x ~ T-concave + +Example +------- + + /* ------------------------------------------------------------- */ + /* File: example_cont.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* Example how to sample from a continuous univariate */ + /* distribution. */ + /* */ + /* We build a distribution object from scratch and sample. */ + + /* ------------------------------------------------------------- */ + + /* Define the PDF and dPDF of our distribution. */ + /* */ + /* Our distribution has the PDF */ + /* */ + /* / 1 - x*x if |x| <= 1 */ + /* f(x) = < */ + /* \ 0 otherwise */ + /* */ + + /* The PDF of our distribution: */ + double mypdf( double x, const UNUR_DISTR *distr ) + /* The second argument (`distr') can be used for parameters */ + /* for the PDF. (We do not use parameters in our example.) */ + { + if (fabs(x) >= 1.) + return 0.; + else + return (1.-x*x); + } /* end of mypdf() */ + + /* The derivative of the PDF of our distribution: */ + double mydpdf( double x, const UNUR_DISTR *distr ) + { + if (fabs(x) >= 1.) + return 0.; + else + return (-2.*x); + } /* end of mydpdf() */ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create a new distribution object from scratch. */ + + /* Get empty distribution object for a continuous distribution */ + distr = unur_distr_cont_new(); + + /* Fill the distribution object -- the provided information */ + /* must fulfill the requirements of the method choosen below. */ + unur_distr_cont_set_pdf(distr, mypdf); /* PDF */ + unur_distr_cont_set_dpdf(distr, mydpdf); /* its derivative */ + unur_distr_cont_set_mode(distr, 0.); /* mode */ + unur_distr_cont_set_domain(distr, -1., 1.); /* domain */ + + /* Choose a method: TDR. */ + par = unur_tdr_new(distr); + + /* Set some parameters of the method TDR. */ + unur_tdr_set_variant_gw(par); + unur_tdr_set_max_sqhratio(par, 0.90); + unur_tdr_set_c(par, -0.5); + unur_tdr_set_max_intervals(par, 100); + unur_tdr_set_cpoints(par, 10, NULL); + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + +Example (String API) +-------------------- + + /* ------------------------------------------------------------- */ + /* File: example_cont_str.c */ + /* ------------------------------------------------------------- */ + /* String API. */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* Example how to sample from a continuous univariate */ + /* distribution. */ + + /* We use a generic distribution object and sample. */ + /* */ + /* The PDF of our distribution is given by */ + /* */ + /* / 1 - x*x if |x| <= 1 */ + /* f(x) = < */ + /* \ 0 otherwise */ + /* */ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a generic continuous distribution. */ + /* Choose a method: TDR. */ + gen = unur_str2gen( + "distr = cont; pdf=\"1-x*x\"; domain=(-1,1); mode=0. & \ + method=tdr; variant_gw; max_sqhratio=0.90; c=-0.5; \ + max_intervals=100; cpoints=10"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + +File: unuran.info, Node: AROU, Next: ARS, Up: Methods_for_CONT + +5.3.1 AROU – Automatic Ratio-Of-Uniforms method +----------------------------------------------- + +Required: + T-concave PDF, dPDF +Optional: + mode +Speed: + Set-up: slow, Sampling: fast +Reinit: + not implemented +Reference: + [LJa00] + + AROU is a variant of the ratio-of-uniforms method that uses the fact +that the transformed region is convex for many distributions. It works +for all T-concave distributions with T(x) = -1/sqrt(x). + + It is possible to use this method for correlation induction by +setting an auxiliary uniform random number generator via the +‘unur_set_urng_aux’ call. (Notice that this must be done after a +possible ‘unur_set_urng’ call.) When an auxiliary generator is used +then the number of used uniform random numbers that is used up for one +generated random variate is constant and equal to 1. + + There exists a test mode that verifies whether the conditions for the +method are satisfied or not while sampling. It can be switched on by +calling ‘unur_arou_set_verify’ and ‘unur_arou_chg_verify’, respectively. +Notice however that sampling is (much) slower then. + + For densities with modes not close to 0 it is suggested to set either +the mode or the center of the distribution by the +‘unur_distr_cont_set_mode’ or ‘unur_distr_cont_set_center’ call. The +latter is the approximate location of the mode or the mean of the +distribution. This location provides some information about the main +part of the PDF and is used to avoid numerical problems. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_arou_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_arou_set_usedars (UNUR_PAR* PARAMETERS, int + USEDARS) + If USEDARS is set to ‘TRUE’, “derandomized adaptive rejection + sampling” (DARS) is used in setup. Segments where the area between + hat and squeeze is too large compared to the average area between + hat and squeeze over all intervals are split. This procedure is + repeated until the ratio between area below squeeze and area below + hat exceeds the bound given by ‘unur_arou_set_max_sqhratio’ call or + the maximum number of segments is reached. Moreover, it also + aborts when no more segments can be found for splitting. + + Segments are split such that the angle of the segments are halved + (corresponds to arc-mean rule of method TDR (*note TDR::)). + + Default is ‘TRUE’. + + -- Function: int unur_arou_set_darsfactor (UNUR_PAR* PARAMETERS, double + FACTOR) + Set factor for “derandomized adaptive rejection sampling”. This + factor is used to determine the segments that are “too large”, that + is, all segments where the area between squeeze and hat is larger + than FACTOR times the average area over all intervals between + squeeze and hat. Notice that all segments are split when FACTOR is + set to ‘0.’, and that there is no splitting at all when FACTOR is + set to ‘UNUR_INFINITY’. + + Default is ‘0.99’. There is no need to change this parameter. + + -- Function: int unur_arou_set_max_sqhratio (UNUR_PAR* PARAMETERS, + double MAX_RATIO) + Set upper bound for the ratio (area inside squeeze) / (area inside + envelope). It must be a number between 0 and 1. When the ratio + exceeds the given number no further construction points are + inserted via adaptive rejection sampling. Use ‘0’ if no + construction points should be added after the setup. Use ‘1’ if + adding new construction points should not be stopped until the + maximum number of construction points is reached. + + Default is ‘0.99’. + + -- Function: double unur_arou_get_sqhratio (const UNUR_GEN* GENERATOR) + Get the current ratio (area inside squeeze) / (area inside + envelope) for the generator. (In case of an error ‘UNUR_INFINITY’ + is returned.) + + -- Function: double unur_arou_get_hatarea (const UNUR_GEN* GENERATOR) + Get the area below the hat for the generator. (In case of an error + ‘UNUR_INFINITY’ is returned.) + + -- Function: double unur_arou_get_squeezearea (const UNUR_GEN* + GENERATOR) + Get the area below the squeeze for the generator. (In case of an + error ‘UNUR_INFINITY’ is returned.) + + -- Function: int unur_arou_set_max_segments (UNUR_PAR* PARAMETERS, int + MAX_SEGS) + Set maximum number of segements. No construction points are added + _after_ the setup when the number of segments succeeds MAX_SEGS. + + Default is ‘100’. + + -- Function: int unur_arou_set_cpoints (UNUR_PAR* PARAMETERS, int + N_STP, const DOUBLE* STP) + Set construction points for enveloping polygon. If STP is ‘NULL’, + then a heuristical rule of thumb is used to get N_STP construction + points. This is the default behavior when this routine is not + called. The (default) number of construction points is ‘30’, then. + + -- Function: int unur_arou_set_usecenter (UNUR_PAR* PARAMETERS, int + USECENTER) + Use the center as construction point. Default is ‘TRUE’. + + -- Function: int unur_arou_set_guidefactor (UNUR_PAR* PARAMETERS, + double FACTOR) + Set factor for relative size of the guide table for indexed search + (see also method DGT *note DGT::). It must be greater than or + equal to ‘0’. When set to ‘0’, then sequential search is used. + + Default is ‘2’. + + -- Function: int unur_arou_set_verify (UNUR_PAR* PARAMETERS, int + VERIFY) + -- Function: int unur_arou_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the + condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x + then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However + notice that this might happen due to round-off errors for a few + values of x (less than 1%). + + Default is ‘FALSE’. + + -- Function: int unur_arou_set_pedantic (UNUR_PAR* PARAMETERS, int + PEDANTIC) + Sometimes it might happen that ‘unur_init’ has been executed + successfully. But when additional construction points are added by + adaptive rejection sampling, the algorithm detects that the PDF is + not T-concave. + + With PEDANTIC being ‘TRUE’, the sampling routine is then exchanged + by a routine that simply returns ‘UNUR_INFINITY’. Otherwise the + new point is not added to the list of construction points. At + least the hat function remains T-concave. + + Setting PEDANTIC to ‘FALSE’ allows sampling from a distribution + which is “almost” T-concave and small errors are tolerated. + However it might happen that the hat function cannot be improved + significantly. When the hat function that has been constructed by + the ‘unur_init’ call is extremely large then it might happen that + the generation times are extremely high (even hours are possible in + extremely rare cases). + + Default is ‘FALSE’. + + +File: unuran.info, Node: ARS, Next: CEXT, Prev: AROU, Up: Methods_for_CONT + +5.3.2 ARS – Adaptive Rejection Sampling +--------------------------------------- + +Required: + concave logPDF, derivative of logPDF +Optional: + mode +Speed: + Set-up: fast, Sampling: slow +Reinit: + supported +Reference: + [GWa92] [HLD04: Cha.4] + + ARS is an acceptance/rejection method that uses the concavity of the +log-density function to construct hat function and squeezes +automatically. It is very similar to method TDR (*note TDR::) with +variant GW, parameter ‘c = 0’, and DARS switched off. Moreover, method +ARS requires the logPDF and its derivative dlogPDF to run. On the other +hand, it is designed to draw only a (very) small samples and it is much +more robust against densities with very large or small areas below the +PDF as it occurs, for example, in conditional distributions of (high +dimensional) multivariate distributions. Additionally, it can be +re-initialized when the underlying distribution has been modified. Thus +it is well suited for Gibbs sampling. + + Notice, that method ARS is a restricted version of TDR. If the full +functionally of Transformed Density Rejection is needed use method *note +TDR::. + +How To Use +.......... + +Method ARS is designed for distributions with log-concave densities. To +use this method you need a distribution object with the logarithm of the +PDF and its derivative given. + + The number of construction points as well as a set of such points can +be provided using ‘unur_ars_set_cpoints’. Notice that addition +construction points are added by means of adaptive rejection sampling +until the maximal number of intervals given by +‘unur_ars_set_max_intervals’ is reached. + + A generated distribution object can be reinitialized using the +‘unur_reinit’ call. When ‘unur_reinit’ is called construction points +for the new generator are necessary. There are two options: Either the +same construction points as for the initial generator (given by a +‘unur_ars_set_cpoints’ call) are used (this is the default), or +percentiles of the old hat function can be used. This can be set or +changed using ‘unur_ars_set_reinit_percentiles’ and +‘unur_ars_chg_reinit_percentiles’. This feature is usefull when the +underlying distribution object is only moderately changed. (An example +is Gibbs sampling with small correlations.) + + There exists a test mode that verifies whether the conditions for the +method are satisfied or not. It can be switched on by calling +‘unur_ars_set_verify’ and ‘unur_ars_chg_verify’, respectively. Notice +however that sampling is (much) slower then. + + Method ARS aborts after a given number of iterations and return +UNUR_INFINITY to prevent (almost) infinite loops. This might happen +when the starting hat is much too large and it is not possible to insert +new construction points due to severe numerical errors or (more likely) +the given PDF is not log-concave. This maximum number of iterations can +be set by means of a ‘unur_ars_set_max_iter’ call. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_ars_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_ars_set_max_intervals (UNUR_PAR* PARAMETERS, int + MAX_IVS) + Set maximum number of intervals. No construction points are added + after the setup when the number of intervals suceeds MAX_IVS. It + is increased automatically to twice the number of construction + points if this is larger. + + Default is ‘200’. + + -- Function: int unur_ars_set_cpoints (UNUR_PAR* PARAMETERS, int + N_CPOINTS, const DOUBLE* CPOINTS) + Set construction points for the hat function. If CPOINTS is ‘NULL’ + then a heuristic rule of thumb is used to get N_CPOINTS + construction points. This is the default behavior. N_CPOINTS + should be at least ‘2’, otherwise defaults are used. + + The default number of construction points is 2. + + -- Function: int unur_ars_set_reinit_percentiles (UNUR_PAR* PARAMETERS, + int N_PERCENTILES, const DOUBLE* PERCENTILES) + -- Function: int unur_ars_chg_reinit_percentiles (UNUR_GEN* GENERATOR, + int N_PERCENTILES, const DOUBLE* PERCENTILES) + By default, when the GENERATOR object is reinitialized, it used the + same construction points as for the initialization procedure. + Often the underlying distribution object has been changed only + moderately. For example, the full conditional distribution of a + multivariate distribution. In this case it might be more + appropriate to use percentilesm of the hat function for the last + (unchanged) distribution. PERCENTILES must then be a pointer to an + ordered array of numbers between ‘0.01’ and ‘0.99’. If PERCENTILES + is ‘NULL’, then a heuristic rule of thumb is used to get + N_PERCENTILES values for these percentiles. Notice that + N_PERCENTILES must be at least ‘2’, otherwise defaults are used. + (Then the first and third quartiles are used by default.) + + -- Function: int unur_ars_set_reinit_ncpoints (UNUR_PAR* PARAMETERS, + int NCPOINTS) + -- Function: int unur_ars_chg_reinit_ncpoints (UNUR_GEN* GENERATOR, int + NCPOINTS) + When reinit fails with the given construction points or the + percentiles of the old hat function, another trial is undertaken + with NCPOINTS construction points. NCPOINTS must be at least ‘10’. + + Default: ‘30’ + + -- Function: int unur_ars_set_max_iter (UNUR_PAR* PARAMETERS, int + MAX_ITER) + The rejection loop stops after MAX_ITER iterations and return + UNUR_INFINITY. + + Default: ‘10000’ + + -- Function: int unur_ars_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) + -- Function: int unur_ars_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the + condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x + then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However + notice that this might happen due to round-off errors for a few + values of x (less than 1%). + + Default is ‘FALSE’. + + -- Function: int unur_ars_set_pedantic (UNUR_PAR* PARAMETERS, int + PEDANTIC) + Sometimes it might happen that ‘unur_init’ has been executed + successfully. But when additional construction points are added by + adaptive rejection sampling, the algorithm detects that the PDF is + not log-concave. + + With PEDANTIC being ‘TRUE’, the sampling routine is exchanged by a + routine that simply returns ‘UNUR_INFINITY’. Otherwise the new + point is not added to the list of construction points. At least + the hat function remains log-concave. + + Setting PEDANTIC to ‘FALSE’ allows sampling from a distribution + which is “almost” log-concave and small errors are tolerated. + However it might happen that the hat function cannot be improved + significantly. When the hat functions that has been constructed by + the ‘unur_init’ call is extremely large then it might happen that + the generation times are extremely high (even hours are possible in + extremely rare cases). + + Default is ‘FALSE’. + + -- Function: double unur_ars_get_loghatarea (const UNUR_GEN* GENERATOR) + Get the logarithm of area below the hat for the generator. (In + case of an error ‘UNUR_INFINITY’ is returned.) + + -- Function: double unur_ars_eval_invcdfhat (const UNUR_GEN* GENERATOR, + double U) + Evaluate the inverse of the CDF of the hat distribution at U. + + If U is out of the domain [0,1] then ‘unur_errno’ is set to + ‘UNUR_ERR_DOMAIN’ and the respective bound of the domain of the + distribution are returned (which is ‘-UNUR_INFINITY’ or + ‘UNUR_INFINITY’ in the case of unbounded domains). + + +File: unuran.info, Node: CEXT, Next: CSTD, Prev: ARS, Up: Methods_for_CONT + +5.3.3 CEXT – wrapper for Continuous EXTernal generators +------------------------------------------------------- + +Required: + routine for sampling continuous random variates +Speed: + depends on external generator +Reinit: + supported + + Method CEXT is a wrapper for external generators for continuous +univariate distributions. It allows the usage of external random +variate generators within the UNU.RAN framework. + +How To Use +.......... + +The following steps are required to use some external generator within +the UNU.RAN framework (some of these are optional): + + 1. Make an empty generator object using a ‘unur_cext_new’ call. The + argument DISTRIBUTION is optional and can be replaced by ‘NULL’. + However, it is required if you want to pass parameters of the + generated distribution to the external generator or for running + some validation tests provided by UNU.RAN. + + 2. Create an initialization routine of type ‘int (*init)(UNUR_GEN + *gen)’ and plug it into the generator object using the + ‘unur_cext_set_init’ call. Notice that the INIT routine must + return ‘UNUR_SUCCESS’ when it has been executed successfully and + ‘UNUR_FAILURE’ otherwise. It is possible to get the size of and + the pointer to the array of parameters of the underlying + distribution object by the respective calls + ‘unur_cext_get_ndistrparams’ and ‘unur_cext_get_distrparams’. + Parameters for the external generator that are computed in the INIT + routine can be stored in a single array or structure which is + available by the ‘unur_cext_get_params’ call. + + Using an INIT routine is optional and can be omitted. + + 3. Create a sampling routine of type ‘double (*sample)(UNUR_GEN *gen)’ + and plug it into the generator object using the + ‘unur_cext_set_sample’ call. + + Uniform random numbers are provided by the ‘unur_sample_urng’ call. + Do not use your own implementation of a uniform random number + generator directly. If you want to use your own random number + generator we recommend to use the UNU.RAN interface (see *note + Using uniform random number generators: URNG.). + + The array or structure that contains parameters for the external + generator that are computed in the INIT routine are available using + the ‘unur_cext_get_params’ call. + + Using a SAMPLE routine is of course obligatory. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. +The INIT routine is then called again. + + Here is a short example that demonstrates the application of this +method by means of the exponential distribution: + + /* ------------------------------------------------------------- */ + /* File: example_cext.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* This example shows how an external generator for the */ + /* exponential distribution with one scale parameter can be */ + /* used within the UNURAN framework. */ + /* */ + /* Notice, that this example does not provide the simplest */ + /* solution. */ + + /* ------------------------------------------------------------- */ + /* Initialization routine. */ + /* */ + /* Here we simply read the scale parameter of the exponential */ + /* distribution and store it in an array for parameters of */ + /* the external generator. */ + /* [ Of course we could do this in the sampling routine as */ + /* and avoid the necessity of this initialization routine. ] */ + + int exponential_init (UNUR_GEN *gen) + { + /* Get pointer to parameters of exponential distribution */ + double *params = unur_cext_get_distrparams(gen); + + /* The scale parameter is the first entry (see manual) */ + double lambda = (params) ? params[0] : 1.; + + /* Get array to store this parameter for external generator */ + double *genpar = unur_cext_get_params(gen, sizeof(double)); + genpar[0] = lambda; + + /* Executed successfully */ + return UNUR_SUCCESS; + } + + /* ------------------------------------------------------------- */ + /* Sampling routine. */ + /* */ + /* Contains the code for the external generator. */ + + double exponential_sample (UNUR_GEN *gen) + { + /* Get scale parameter */ + double *genpar = unur_cext_get_params(gen,0); + double lambda = genpar[0]; + + /* Sample a uniformly distributed random number */ + double U = unur_sample_urng(gen); + + /* Transform into exponentially distributed random variate */ + return ( -log(1. - U) * lambda ); + } + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use predefined exponential distribution with scale param. 2 */ + double fpar[1] = { 2. }; + distr = unur_distr_exponential(fpar, 1); + + /* Use method CEXT */ + par = unur_cext_new(distr); + + /* Set initialization and sampling routines. */ + unur_cext_set_init(par, exponential_init); + unur_cext_set_sample(par, exponential_sample); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_cext_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for new generator. + + -- Function: int unur_cext_set_init (UNUR_PAR* PARAMETERS, int (* + INIT)(UNUR_GEN* gen )) + Set initialization routine for external generator. Inside the + + _Important:_ The routine INIT must return ‘UNUR_SUCCESS’ when the + generator was initialized successfully and ‘UNUR_FAILURE’ + otherwise. + + Parameters that are computed in the INIT routine can be stored in + an array or structure that is avaiable by means of the + ‘unur_cext_get_params’ call. Parameters of the underlying + distribution object can be obtained by the + ‘unur_cext_get_distrparams’ call. + + -- Function: int unur_cext_set_sample (UNUR_PAR* PARAMETERS, double (* + SAMPLE)(UNUR_GEN* gen )) + Set sampling routine for external generator. + + _Important:_ Use ‘unur_sample_urng(gen)’ to get a uniform random + number. The pointer to the array or structure that contains the + parameters that are precomputed in the INIT routine are available + by ‘unur_cext_get_params(gen,0)’. Additionally one can use the + ‘unur_cext_get_distrparams’ call. + + -- Function: void* unur_cext_get_params (UNUR_GEN* GENERATOR, size_t + SIZE) + Get pointer to memory block for storing parameters of external + generator. A memory block of size SIZE is automatically (re-) + allocated if necessary and the pointer to this block is stored in + the GENERATOR object. If one only needs the pointer to this memory + block set SIZE to ‘0’. + + Notice, that SIZE is the size of the memory block and not the + length of an array. + + _Important:_ This rountine should only be used in the + initialization and sampling routine of the external generator. + + -- Function: double* unur_cext_get_distrparams (UNUR_GEN* GENERATOR) + -- Function: int unur_cext_get_ndistrparams (UNUR_GEN* GENERATOR) + Get size of and pointer to array of parameters of underlying + distribution in GENERATOR object. + + _Important:_ These rountines should only be used in the + initialization and sampling routine of the external generator. + + +File: unuran.info, Node: CSTD, Next: HINV, Prev: CEXT, Up: Methods_for_CONT + +5.3.4 CSTD – Continuous STandarD distributions +---------------------------------------------- + +Required: + standard distribution from UNU.RAN library (*note Standard + distributions: Stddist.) or continuous distribution with inverse + CDF. +Speed: + Set-up: fast, Sampling: depends on distribution and generator +Reinit: + supported + + CSTD is a wrapper for special generators for continuous univariate +standard distributions. It only works for distributions in the UNU.RAN +library of standard distributions (*note Standard distributions: +Stddist.) or for continuous distributions where the inverse CDF is +given. If a distribution object is provided that is build from scratch, +it must provide the inverse CDF. Then CSTD implements the inversion +method. Otherwise, the ‘NULL’ pointer is returned. + + For some distributions more than one special generator is possible. + +How To Use +.......... + +Create a distribution object for a standard distribution from the +UNU.RAN library (*note Standard distributions: Stddist.), or create a +continuous distribution object and set the function for the inverse CDF +using ‘unur_distr_cont_set_invcdf’. For some distributions more than +one special generator (_variants_) is possible. These can be choosen by +a ‘unur_cstd_set_variant’ call. For possible variants *note Standard +distributions: Stddist. However the following are common to all +distributions: + +‘UNUR_STDGEN_DEFAULT’ + the default generator. +‘UNUR_STDGEN_FAST’ + the fastest available special generator. +‘UNUR_STDGEN_INVERSION’ + the inversion method (if available). + + Notice that the variant ‘UNUR_STDGEN_FAST’ for a special generator +may be slower than one of the universal algorithms! Additional variants +may exist for particular distributions. + + Sampling from truncated distributions (which can be constructed by +changing the default domain of a distribution by means of +‘unur_distr_cont_set_domain’ or ‘unur_cstd_chg_truncated’ calls) is +possible but requires the inversion method. Moreover the CDF of the +distribution must be implemented. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_cstd_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for new generator. It requires a + distribution object for a continuous univariant distribution from + the UNU.RAN library of standard distributions (*note Standard + distributions: Stddist.). + + Using a truncated distribution is allowed only if the inversion + method is available and selected by the ‘unur_cstd_set_variant’ + call immediately after creating the parameter object. Use a + ‘unur_distr_cont_set_domain’ call to get a truncated distribution. + To change the domain of a (truncated) distribution of a generator + use the ‘unur_cstd_chg_truncated’ call. + + -- Function: int unur_cstd_set_variant (UNUR_PAR* PARAMETERS, unsigned + VARIANT) + Set variant (special generator) for sampling from a given + distribution. For possible variants *note Standard distributions: + Stddist. + + Common variants are ‘UNUR_STDGEN_DEFAULT’ for the default + generator, ‘UNUR_STDGEN_FAST’ for (one of the) fastest implemented + special generators, and ‘UNUR_STDGEN_INVERSION’ for the inversion + method (if available). If the selected variant number is not + implemented, then an error code is returned and the variant is not + changed. + + -- Function: int unur_cstd_chg_truncated (UNUR_GEN* GENERATOR, double + LEFT, double RIGHT) + Change left and right border of the domain of the (truncated) + distribution. This is only possible if the inversion method is + used. Otherwise this call has no effect and an error code is + returned. + + Notice that the given truncated domain must be a subset of the + domain of the given distribution. The generator always uses the + intersection of the domain of the distribution and the truncated + domain given by this call. + + It is not required to run ‘unur_reinit’ after this call has been + used. + + _Important:_ If the CDF is (almost) the same for LEFT and RIGHT and + (almost) equal to ‘0’ or ‘1’, then the truncated domain is not + chanced and the call returns an error code. + + _Notice:_ If the parameters of the distribution has been changed it + is recommended to set the truncated domain again, since the former + call might change the domain of the distribution but not update the + values for the boundaries of the truncated distribution. + + +File: unuran.info, Node: HINV, Next: HRB, Prev: CSTD, Up: Methods_for_CONT + +5.3.5 HINV – Hermite interpolation based INVersion of CDF +--------------------------------------------------------- + +Required: + CDF +Optional: + PDF, dPDF +Speed: + Set-up: (very) slow, Sampling: (very) fast +Reinit: + supported +Reference: + [HLa03] [HLD04: Sect.7.2; Alg.7.1] + + HINV is a variant of numerical inversion, where the inverse CDF is +approximated using Hermite interpolation, i.e., the interval [0,1] is +split into several intervals and in each interval the inverse CDF is +approximated by polynomials constructed by means of values of the CDF +and PDF at interval boundaries. This makes it possible to improve the +accuracy by splitting a particular interval without recomputations in +unaffected intervals. Three types of splines are implemented: linear, +cubic, and quintic interpolation. For linear interpolation only the CDF +is required. Cubic interpolation also requires PDF and quintic +interpolation PDF and its derivative. + + These splines have to be computed in a setup step. However, it only +works for distributions with bounded domain; for distributions with +unbounded domain the tails are chopped off such that the probability for +the tail regions is small compared to the given u-resolution. + + The method is not exact, as it only produces random variates of the +approximated distribution. Nevertheless, the maximal numerical error in +"u-direction" (i.e. |U-CDF(X)|, for X = "approximate inverse CDF"(U) +|U-CDF(X)|) can be set to the required resolution (within machine +precision). Notice that very small values of the u-resolution are +possible but may increase the cost for the setup step. + + As the possible maximal error is only estimated in the setup it may +be necessary to set some special design points for computing the Hermite +interpolation to guarantee that the maximal u-error can not be bigger +than desired. Such points are points where the density is not +differentiable or has a local extremum. Notice that there is no +necessity to do so. However, if you do not provide these points to the +algorithm there might be a small chance that the approximation error is +larger than the given u-resolution, or that the required number of +intervals is larger than necessary. + +How To Use +.......... + +HINV works for continuous univariate distribution objects with given CDF +and (optional) PDF. It uses Hermite interpolation of order 1, 3 +[default] or 5. The order can be set by means of ‘unur_hinv_set_order’. +For distributions with unbounded domains the tails are chopped off such +that the probability for the tail regions is small compared to the given +u-resulution. For finding these cut points the algorithm starts with +the region ‘[-1.e20,1.e20]’. For the exceptional case where this might +be too small (or one knows this region and wants to avoid this search +heuristics) it can be directly set via a ‘unur_hinv_set_boundary’ call. + + It is possible to use this method for generating from truncated +distributions. It even can be changed for an existing generator object +by an ‘unur_hinv_chg_truncated’ call. + + This method is not exact, as it only produces random variates of the +approximated distribution. Nevertheless, the numerical error in +"u-direction" (i.e. |U-CDF(X)|, for X = "approximate inverse CDF"(U) +|U-CDF(X)|) can be controlled by means of ‘unur_hinv_set_u_resolution’. +The possible maximal error is only estimated in the setup. Thus it +might be necessary to set some special design points for computing the +Hermite interpolation to guarantee that the maximal u-error can not be +bigger than desired. Such points (e.g. extremal points of the PDF, +points with infinite derivative) can be set using using the +‘unur_hinv_set_cpoints’ call. If the mode for a unimodal distribution +is set in the distribution object this mode is automatically used as +design-point if the ‘unur_hinv_set_cpoints’ call is not used. + + As already mentioned the maximal error of this approximation is only +estimated. If this error is crucial for an application we recommend to +compute this error using ‘unur_hinv_estimate_error’ which runs a small +Monte Carlo simulation. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. +The values given by the last ‘unur_hinv_chg_truncated’ call will be then +changed to the values of the domain of the underlying distribution +object. Moreover, starting construction points (nodes) that are given +by a ‘unur_hinv_set_cpoints’ call are ignored when ‘unur_reinit’ is +called. It is important to note that for a distribution from the +UNU.RAN library of standard distributions (*note Standard distributions: +Stddist.) the normalization constant has to be updated using the +‘unur_distr_cont_upd_pdfarea’ call whenever its parameters have been +changed by means of a ‘unur_distr_cont_set_pdfparams’ call. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_hinv_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_hinv_set_order (UNUR_PAR* PARAMETERS, int ORDER) + Set order of Hermite interpolation. Valid orders are ‘1’, ‘3’, and + ‘5’. Notice that ORDER greater than ‘1’ requires the density of + the distribution, and ORDER greater than ‘3’ even requires the + derivative of the density. Using ORDER ‘1’ results for most + distributions in a huge number of intervals and is therefore not + recommended. If the maximal error in u-direction is very small + (say smaller than ‘1.e-10’), ORDER ‘5’ is recommended as it leads + to considerably fewer design points, as long there are no poles or + heavy tails. + + _Remark:_ When the target distribution has poles or (very) heavy + tails ORDER ‘5’ (i.e., quintic interpolation) is numerically less + stable and more sensitive to round-off errors than ORDER ‘3’ (i.e., + cubic interpolation). + + Default is ‘3’ if the density is given and ‘1’ otherwise. + + -- Function: int unur_hinv_set_u_resolution (UNUR_PAR* PARAMETERS, + double U_RESOLUTION) + Set maximal error in u-direction. However, the given u-error must + not be smaller than machine epsilon (‘DBL_EPSILON’) and should not + be too close to this value. As the resolution of most uniform + random number sources is 2^(-32) = ‘2.3e-10’, a value of ‘1.e-10’ + leads to an inversion algorithm that could be called exact. For + most simulations slightly bigger values for the maximal error are + enough as well. + + Remark: The u-error might become larger than U_RESOLUTION due to + rescaling of floating point numbers when the domain of the + distribution is truncated by a ‘unur_hinv_chg_truncated’ call. + + Default is ‘1.e-10’. + + -- Function: int unur_hinv_set_cpoints (UNUR_PAR* PARAMETERS, const + DOUBLE* STP, int N_STP) + Set starting construction points (nodes) for Hermite interpolation. + + As the possible maximal error is only estimated in the setup it may + be necessary to set some special design points for computing the + Hermite interpolation to guarantee that the maximal u-error can not + be bigger than desired. We suggest to include as special design + points all local extrema of the density, all points where the + density is not differentiable, and isolated points inside of the + domain with density 0. If there is an interval with density + constant equal to 0 inside of the given domain of the density, both + endpoints of this interval should be included as special design + points. Notice that there is no necessity to do so. However, if + these points are not provided to the algorithm the approximation + error might be larger than the given u-resolution, or the required + number of intervals could be larger than necessary. + + _Important_: Notice that the given points must be in increasing + order and they must be disjoint. + + _Important_: The boundary point of the computational region must + not be given in this list! Points outside the boundary of the + computational region are ignored. + + Default is for unimodal densities - if known - the mode of the + density, if it is not equal to the border of the domain. + + -- Function: int unur_hinv_set_boundary (UNUR_PAR* PARAMETERS, double + LEFT, double RIGHT) + Set the left and right boundary of the computational interval. Of + course ‘+/- UNUR_INFINITY’ is not allowed. If the CDF at LEFT and + RIGHT is not close to the respective values ‘0.’ and ‘1.’ then this + interval is increased by a (rather slow) search algorithm. + + _Important_: This call does not change the domain of the given + distribution itself. But it restricts the domain for the resulting + random variates. + + Default is ‘1.e20’. + + -- Function: int unur_hinv_set_guidefactor (UNUR_PAR* PARAMETERS, + double FACTOR) + Set factor for relative size of the guide table for indexed search + (see also method DGT *note DGT::). It must be greater than or + equal to ‘0’. When set to ‘0’, then sequential search is used. + + Default is ‘1’. + + -- Function: int unur_hinv_set_max_intervals (UNUR_PAR* PARAMETERS, int + MAX_IVS) + Set maximum number of intervals. No generator object is created if + the necessary number of intervals for the Hermite interpolation + exceeds MAX_IVS. It is used to prevent the algorithm to eat up all + memory for very badly shaped CDFs. + + Default is ‘1000000’ (1.e6). + + -- Function: int unur_hinv_get_n_intervals (const UNUR_GEN* GENERATOR) + Get number of nodes (design points) used for Hermite interpolation + in the generator object. The number of intervals is the number of + nodes minus 1. It returns an error code in case of an error. + + -- Function: double unur_hinv_eval_approxinvcdf (const UNUR_GEN* + GENERATOR, double U) + Evaluate Hermite interpolation of inverse CDF at U. If U is out of + the domain [0,1] then ‘unur_errno’ is set to ‘UNUR_ERR_DOMAIN’ and + the respective bound of the domain of the distribution are returned + (which is ‘-UNUR_INFINITY’ or ‘UNUR_INFINITY’ in the case of + unbounded domains). + + _Notice_: When the domain has been truncated by a + ‘unur_hinv_chg_truncated’ call then the inverse CDF of the + truncated distribution is returned. + + -- Function: int unur_hinv_chg_truncated (UNUR_GEN* GENERATOR, double + LEFT, double RIGHT) + Changes the borders of the domain of the (truncated) distribution. + + Notice that the given truncated domain must be a subset of the + domain of the given distribution. The generator always uses the + intersection of the domain of the distribution and the truncated + domain given by this call. The tables of splines are not + recomputed. Thus it might happen that the relative error for the + generated variates from the truncated distribution is greater than + the bound for the non-truncated distribution. This call also fails + when the CDF values of the boundary points are too close, i.e. + when only a few different floating point numbers would be computed + due to round-off errors with floating point arithmetic. + + Remark: The u-error might become larger than the U_RESOLUTION given + by a ‘unur_hinv_set_u_resolution’ call due to rescaling of floating + point numbers when the domain of the distribution is truncated. + + When failed an error code is returned. + + _Important_: Always check the return code since the domain is not + changed in case of an error. + + -- Function: int unur_hinv_estimate_error (const UNUR_GEN* GENERATOR, + int SAMPLESIZE, double* MAX_ERROR, double* MAE) + Estimate maximal u-error and mean absolute error (MAE) for + GENERATOR by means of a (quasi-) Monte-Carlo simulation with sample + size SAMPLESIZE. The results are stored in MAX_ERROR and MAE, + respectively. + + It returns ‘UNUR_SUCCESS’ if successful. + + +File: unuran.info, Node: HRB, Next: HRD, Prev: HINV, Up: Methods_for_CONT + +5.3.6 HRB – Hazard Rate Bounded +------------------------------- + +Required: + bounded hazard rate +Optional: + upper bound for hazard rate +Speed: + Set-up: fast, Sampling: slow +Reinit: + supported +Reference: + [HLD04: Sect.9.1.4; Alg.9.4] + + Generates random variate with given hazard rate which must be bounded +from above. It uses the thinning method with a constant dominating +hazard function. + +How To Use +.......... + +HRB requires a hazard function for a continuous distribution together +with an upper bound. The latter has to be set using the +‘unur_hrb_set_upperbound’ call. If no such upper bound is given it is +assumed that the upper bound can be achieved by evaluating the hazard +rate at the left hand boundary of the domain of the distribution. +Notice, however, that for decreasing hazard rate the method HRD (*note +Hazard Rate Decreasing: HRD.) is much faster and thus the prefered +method. + + It is important to note that the domain of the distribution can be +set via a ‘unur_distr_cont_set_domain’ call. However, the left border +must not be negative. Otherwise it is set to ‘0’. This is also the +default if no domain is given at all. For computational reasons the +right border is always set to ‘UNUR_INFINITY’ independently of the given +domain. Thus for domains bounded from right the function for computing +the hazard rate should return ‘UNUR_INFINITY’ right of this domain. + + For distributions with increasing hazard rate method HRI (*note +Hazard Rate Increasing: HRI.) is required. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. +Notice, that the upper bound given by the ‘unur_hrb_set_upperbound’ call +cannot be changed and must be valid for the changed distribution. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_hrb_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_hrb_set_upperbound (UNUR_PAR* PARAMETERS, double + UPPERBOUND) + Set upper bound for hazard rate. If this call is not used it is + assumed that the the maximum of the hazard rate is achieved at the + left hand boundary of the domain of the distribution. + + -- Function: int unur_hrb_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) + -- Function: int unur_hrb_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the hazard + rate is not bounded by the given bound, then ‘unur_errno’ is set to + ‘UNUR_ERR_GEN_CONDITION’. + + Default is ‘FALSE’. + + +File: unuran.info, Node: HRD, Next: HRI, Prev: HRB, Up: Methods_for_CONT + +5.3.7 HRD – Hazard Rate Decreasing +---------------------------------- + +Required: + decreasing (non-increasing) hazard rate +Speed: + Set-up: fast, Sampling: slow +Reinit: + supported +Reference: + [HLD04: Sect.9.1.5; Alg.9.5] + + Generates random variate with given non-increasing hazard rate. It +is necessary that the distribution object contains this hazard rate. +Decreasing hazard rate implies that the corresponding PDF of the +distribution has heavier tails than the exponential distribution (which +has constant hazard rate). + +How To Use +.......... + +HRD requires a hazard function for a continuous distribution with +non-increasing hazard rate. There are no parameters for this method. + + It is important to note that the domain of the distribution can be +set via a ‘unur_distr_cont_set_domain’ call. However, only the left +hand boundary is used. For computational reasons the right hand +boundary is always reset to ‘UNUR_INFINITY’. If no domain is given by +the user then the left hand boundary is set to ‘0’. + + For distributions which do not have decreasing hazard rates but are +bounded from above use method HRB (*note Hazard Rate Bounded: HRB.). For +distributions with increasing hazard rate method HRI (*note Hazard Rate +Increasing: HRI.) is required. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_hrd_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_hrd_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) + -- Function: int unur_hrd_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the hazard + rate is not bounded by the given bound, then ‘unur_errno’ is set to + ‘UNUR_ERR_GEN_CONDITION’. + + Default is ‘FALSE’. + + +File: unuran.info, Node: HRI, Next: ITDR, Prev: HRD, Up: Methods_for_CONT + +5.3.8 HRI – Hazard Rate Increasing +---------------------------------- + +Required: + increasing (non-decreasing) hazard rate +Speed: + Set-up: fast, Sampling: slow +Reinit: + supported +Reference: + [HLD04: Sect.9.1.6; Alg.9.6] + + Generates random variate with given non-increasing hazard rate. It +is necessary that the distribution object contains this hazard rate. +Increasing hazard rate implies that the corresponding PDF of the +distribution has heavier tails than the exponential distribution (which +has constant hazard rate). + + The method uses a decomposition of the hazard rate into a main part +which is constant for all x beyond some point p0 and a remaining part. +From both of these parts points are sampled using the thinning method +and the minimum of both is returned. Sampling from the first part is +easier as we have a constant dominating hazard rate. Thus p0 should be +large. On the other hand, if p0 is large than the thinning algorithm +needs many iteration. Thus the performance of the the algorithm deponds +on the choice of p0. We found that values close to the expectation of +the generated distribution result in good performance. + +How To Use +.......... + +HRI requires a hazard function for a continuous distribution with +non-decreasing hazard rate. The parameter p0 should be set to a value +close to the expectation of the required distribution using +‘unur_hri_set_p0’. If performance is crucial one may try other values +as well. + + It is important to note that the domain of the distribution can be +set via a ‘unur_distr_cont_set_domain’ call. However, only the left +hand boundary is used. For computational reasons the right hand +boundary is always reset to ‘UNUR_INFINITY’. If no domain is given by +the user then the left hand boundary is set to ‘0’. + + For distributions with decreasing hazard rate method HRD (*note +Hazard Rate Decreasing: HRI.) is required. For distributions which do +not have increasing or decreasing hazard rates but are bounded from +above use method HRB (*note Hazard Rate Bounded: HRB.). + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. + + Notice, that the upper bound given by the ‘unur_hrb_set_upperbound’ +call cannot be changed and must be valid for the changed distribution. +Notice that the parameter p0 which has been set by a ‘unur_hri_set_p0’ +call cannot be changed and must be valid for the changed distribution. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_hri_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_hri_set_p0 (UNUR_PAR* PARAMETERS, double P0) + Set design point for algorithm. It is used to split the domain of + the distribution. Values for P0 close to the expectation of the + distribution results in a relatively good performance of the + algorithm. It is important that the hazard rate at this point must + be greater than ‘0’ and less than ‘UNUR_INFINITY’. + + Default: left boundary of domain + ‘1.’ + + -- Function: int unur_hri_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) + -- Function: int unur_hri_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the hazard + rate is not bounded by the given bound, then ‘unur_errno’ is set to + ‘UNUR_ERR_GEN_CONDITION’. + + Default is ‘FALSE’. + + +File: unuran.info, Node: ITDR, Next: NINV, Prev: HRI, Up: Methods_for_CONT + +5.3.9 ITDR – Inverse Transformed Density Rejection +-------------------------------------------------- + +Required: + monotone PDF, dPDF, pole +Optional: + splitting point between pole and tail region, c-values +Speed: + Set-up: moderate, Sampling: moderate +Reinit: + supported +Reference: + [HLDa07] + + ITDR is an acceptance/rejection method that works for monotone +densities. It is especially designed for PDFs with a single pole. It +uses different hat functions for the pole region and for the tail +region. For the tail region _Transformed Density Rejection_ with a +single construction point is used. For the pole region a variant called +_Inverse Transformed Density Rejection_ is used. The optimal splitting +point between the two regions and the respective maximum local concavity +and inverse local concavity (*note Glossary::) that guarantee valid hat +functions for each regions are estimated. This splitting point is set +to the intersection point of local concavity and inverse local +concavity. However, it is assumed that both, the local concavity and +the inverse local concavity do not have a local minimum in the interior +of the domain (which is the case for all standard distributions with a +single pole). In other cases (or when the built-in search routines do +not compute non-optimal values) one can provide the splitting point, and +the c-values. + +How To Use +.......... + +Method ITDR requires a distribution object with given PDF and its +derivative and the location of the pole (or mode). The PDF must be +monotone and may contain a pole. It must be set via the +‘unur_distr_cont_set_pdf’ and ‘unur_distr_cont_set_dpdf’ calls. The PDF +should return UNUR_INFINITY for the pole. Alternatively, one can also +set the logarithm of the PDF and its derivative via the +‘unur_distr_cont_set_logpdf’ and ‘unur_distr_cont_set_dlogpdf’ calls. +This is in especially useful since then the setup and search routines +are numerically more stable. Moreover, for many distributions computing +the logarithm of the PDF is less expensive then computing the PDF +directly. + + The pole of the distribution is given by a ‘unur_distr_cont_set_mode’ +call. Notice that distributions with “heavy” poles may have numerical +problems caused by the resultion of the floating point numbers used by +computers. While the minimal distance between two different floating +point numbers is about ‘1.e-320’ near ‘0.’ it increases to ‘1.e-16’ near +‘1.’ Thus any random variate generator implemented on a digital computer +in fact draws samples from a discrete distribution that approximates the +desired continuous distribution. For distributions with “heavy” poles +not at 0 this approximation may be too crude and thus every +goodness-of-fit test will fail. Besides this theoretic problem that +cannot be resolved we have to take into consideration that round-off +errors occur more frequently when we have PDFs with poles far away from +‘0.’ Method ITDR tries to handles this situation as good as possible by +moving the pole into ‘0.’ Thus do not use a wrapper for your PDF that +hides this shift since the information about the resolution of the +floating point numbers near the pole gets lost. + + Method ITDR uses different hats for the pole region and for the tail +region. The splitting point between these two regions, the optimal +c-value and design points for constructing the hats using Transformed +Density Rejection are computed automatically. (The results of these +computations can be read using the respective calls ‘unur_itdr_get_xi’, +‘unur_itdr_get_cp’ , and ‘unur_itdr_get_ct’ for the intersection point +between local concavity and inverse local concavity, the c-value for the +pole and the tail region.) However, one can also analyze the local +concavity and inverse local concavity set the corresponding values using +‘unur_itdr_set_xi’, ‘unur_itdr_set_cp’ , and ‘unur_itdr_set_ct’ calls. +Notice, that c-values greater than -1/2 can be set to ‘-0.5’. Although +this results in smaller acceptance probabities sampling from the hat +distribution is much faster than for other values of c. Depending on +the expenses of evaluating the PDF the resulting algorithm is usually +faster. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. +However, the values given by ‘unur_itdr_set_xi’, ‘unur_itdr_set_cp’ , or +‘unur_itdr_set_ct’ calls are then ignored when ‘unur_reinit’ is called. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_itdr_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_itdr_set_xi (UNUR_PAR* PARAMETERS, double XI) + Sets points where local concavity and inverse local concavity are + (almost) equal. It is used to estimate the respective c-values for + pole region and hat regions and to determine the splitting point bx + between pole and tail region. If no such point is provided it will + be computed automatically. + + Default: not set. + + -- Function: int unur_itdr_set_cp (UNUR_PAR* PARAMETERS, double CP) + Sets parameter CP for transformation T for inverse density in pole + region. It must be at most 0 and greater than -1. A value of + ‘-0.5’ is treated separately and usually results in faster marginal + generation time (at the expense of smaller acceptance + probabilities. If no CP-value is given it is estimated + automatically. + + Default: not set. + + -- Function: int unur_itdr_set_ct (UNUR_PAR* PARAMETERS, double CT) + Sets parameter CT for transformation T for density in tail region. + It must be at most 0. For densities with unbounded domain it must + be greater than -1. A value of ‘-0.5’ is treated separately and + usually results in faster marginal generation time (at the expense + of smaller acceptance probabilities. If no CT-value is given it is + estimated automatically. + + Default: not set. + + -- Function: double unur_itdr_get_xi (UNUR_GEN* GENERATOR) + -- Function: double unur_itdr_get_cp (UNUR_GEN* GENERATOR) + -- Function: double unur_itdr_get_ct (UNUR_GEN* GENERATOR) + Get intersection point XI, and c-values CP and CT, respectively. + (In case of an error ‘UNUR_INFINITY’ is returned.) + + -- Function: double unur_itdr_get_area (UNUR_GEN* GENERATOR) + Get area below hat. (In case of an error ‘UNUR_INFINITY’ is + returned.) + + -- Function: int unur_itdr_set_verify (UNUR_PAR* PARAMETERS, int + VERIFY) + Turn verifying of algorithm while sampling on/off. + + If the condition PDF(x) <= hat(x) is violated for some x then + ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However, notice + that this might happen due to round-off errors for a few values of + x (less than 1%). + + Default is ‘FALSE’. + + -- Function: int unur_itdr_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Change the verifying of algorithm while sampling on/off. + + +File: unuran.info, Node: NINV, Next: NROU, Prev: ITDR, Up: Methods_for_CONT + +5.3.10 NINV – Numerical INVersion +--------------------------------- + +Required: + CDF +Optional: + PDF +Speed: + Set-up: optional, Sampling: (very) slow +Reinit: + supported + + NINV implementations of some methods for numerical inversion: +Newton’s method, regula falsi (combined with interval bisectioning), and +bisection method. Regula falsi and bisection method require only the +CDF while Newton’s method also requires the PDF. To speed up marginal +generation times a table with suitable starting points can be created +during the setup. The performance of the algorithm can adjusted by the +desired accuracy of the method. It is possible to use this method for +generating from truncated distributions. The truncated domain can be +changed for an existing generator object. + +How To Use +.......... + +Method NINV generates random variates by numerical inversion and +requires a continuous univariate distribution objects with given CDF. +Three variants are available: + + − Regula falsi [default] + − Newton’s method + − Interval bisectioning + + Newton’s method additionally requires the PDF of the distribution and +cannot be used otherwise (NINV automatically switches to regula falsi +then). Default algorithm is regula falsi. It is slightly slower but +numerically much more stable than Newton’s algorithm. Interval +bisectioning is the slowest method and should only be considered as a +last resort when the other methods fails. + + It is possible to draw samples from truncated distributions. The +truncated domain can even be changed for an existing generator object by +an ‘unur_ninv_chg_truncated’ call. + + Marginal generation times can be sped up by means of a table with +suitable starting points which can be created during the setup. Using +such a table can be switched on by means of a ‘unur_ninv_set_table’ call +where the table size is given as a parameter. The table is still useful +when the (truncated) domain is changed often, since it is computed for +the domain of the given distribution. (It is not possible to enlarge +this domain.) If it is necessary to recalculate the table during +sampling, the command ‘unur_ninv_chg_table’ can be used. As a rule of +thumb using such a table is appropriate when the number of generated +points exceeds the table size by a factor of 100. + + The default number of iterations of NINV should be enough for all +reasonable cases. Nevertheless, it is possible to adjust the maximal +number of iterations with the commands ‘unur_ninv_set_max_iter’ and +‘unur_ninv_chg_max_iter’. In particular this might be necessary when +the PDF has a pole or the distribution has extremely heavy tails. + + It is also possible to set/change the accuracy of the method (which +also heavily influencies the generation time). We use two measures for +the approximation error which can be used independently: x-error and +u-error (*note Inversion:: for more details). It is possible to set the +maximal tolerated error using with ‘unur_ninv_set_x_resolution’ and with +‘unur_ninv_set_u_resolution’, resp., and change it with the respective +calls ‘unur_ninv_chg_x_resolution’ and ‘unur_ninv_chg_x_resolution’. +The algorithm tries to satisfy _both_ accuracy goals (and raises an +error flag it this fails). One of these accuracy checks can be disabled +by setting the accuracy goal to a negative value. + + NINV tries to use proper starting values for both the regula falsi +and bisection method, and for Newton’s method. Of course the user might +have more knowledge about the properties of the target distribution and +is able to share his wisdom with NINV using the respective commands +‘unur_ninv_set_start’ and ‘unur_ninv_chg_start’. It is possible to +change the parameters and the domain of the chosen distribution and run +‘unur_reinit’ to reinitialize the generator object. The values given by +the last ‘unur_ninv_chg_truncated’ call will be then changed to the +values of the domain of the underlying distribution object. It is +important to note that for a distribution from the UNU.RAN library of +standard distributions (*note Standard distributions: Stddist.) the +normalization constant has to be updated using the +‘unur_distr_cont_upd_pdfarea’ call whenever its parameters have been +changed by means of a ‘unur_distr_cont_set_pdfparams’ call. + + It might happen that NINV aborts ‘unur_sample_cont’ without computing +the correct value (because the maximal number iterations has been +exceeded). Then the last approximate value for x is returned (with +might be fairly false) and ‘unur_error’ is set to +‘UNUR_ERR_GEN_SAMPLING’. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_ninv_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_ninv_set_useregula (UNUR_PAR* PARAMETERS) + Switch to regula falsi combined with interval bisectioning. (This + the default.) + + -- Function: int unur_ninv_set_usenewton (UNUR_PAR* PARAMETERS) + Switch to Newton’s method. Notice that it is numerically less + stable than regula falsi. It it is not possible to invert the CDF + for a particular uniform random number U when calling + ‘unur_sample_cont’, ‘unur_error’ is set to ‘UNUR_ERR_GEN_SAMPLING’. + Thus it is recommended to check ‘unur_error’ before using the + result of the sampling routine. + + -- Function: int unur_ninv_set_usebisect (UNUR_PAR* PARAMETERS) + Switch to bisection method. This is a slow algorithm and should + only be used as a last resort. + + -- Function: int unur_ninv_set_max_iter (UNUR_PAR* PARAMETERS, int + MAX_ITER) + -- Function: int unur_ninv_chg_max_iter (UNUR_GEN* GENERATOR, int + MAX_ITER) + Set and change number of maximal iterations. Default is ‘100’. + + -- Function: int unur_ninv_set_x_resolution (UNUR_PAR* PARAMETERS, + double X_RESOLUTION) + -- Function: int unur_ninv_chg_x_resolution (UNUR_GEN* GENERATOR, + double X_RESOLUTION) + Set and change the maximal tolerated relative x-error. If + X_RESOLUTION is negative then checking of the x-error is disabled. + + Default is ‘1.e-8’. + + -- Function: int unur_ninv_set_u_resolution (UNUR_PAR* PARAMETERS, + double U_RESOLUTION) + -- Function: int unur_ninv_chg_u_resolution (UNUR_GEN* GENERATOR, + double U_RESOLUTION) + Set and change the maximal tolerated (abolute) u-error. If + U_RESOLUTION is negative then checking of the u-error is disabled. + + Default is ‘-1’ (disabled). + + -- Function: int unur_ninv_set_start (UNUR_PAR* PARAMETERS, double + LEFT, double RIGHT) + Set starting points. If not set, suitable values are chosen + automatically. + + Newton: LEFT: starting point + Regula LEFT, RIGHT: boundary of starting interval + falsi: + + If the starting points are not set then the follwing points are + used by default: + Newton: LEFT: CDF(LEFT) = 0.5 + Regula LEFT: CDF(LEFT) = 0.1 + falsi: + RIGHT: CDF(RIGHT) = 0.9 + + If LEFT == RIGHT, then UNU.RAN always uses the default starting + points! + + -- Function: int unur_ninv_chg_start (UNUR_GEN* GEN, double LEFT, + double RIGHT) + Change the starting points for numerical inversion. If + left==right, then UNU.RAN uses the default starting points (see + ‘unur_ninv_set_start’ ). + + -- Function: int unur_ninv_set_table (UNUR_PAR* PARAMETERS, int + NO_OF_POINTS) + Generates a table with NO_OF_POINTS points containing suitable + starting values for the iteration. The value of NO_OF_POINTS must + be at least 10 (otherwise it will be set to 10 automatically). + + The table points are chosen such that the CDF at these points form + an equidistance sequence in the interval (0,1). + + If a table is used, then the starting points given by + ‘unur_ninv_set_start’ are ignored. + + No table is used by default. + + -- Function: int unur_ninv_chg_table (UNUR_GEN* GEN, int NO_OF_POINTS) + Recomputes a table as described in ‘unur_ninv_set_table’. + + -- Function: int unur_ninv_chg_truncated (UNUR_GEN* GEN, double LEFT, + double RIGHT) + Changes the borders of the domain of the (truncated) distribution. + + Notice that the given truncated domain must be a subset of the + domain of the given distribution. The generator always uses the + intersection of the domain of the distribution and the truncated + domain given by this call. Moreover the starting point(s) will not + be changed. + + _Important:_ If the CDF is (almost) the same for LEFT and RIGHT and + (almost) equal to ‘0’ or ‘1’, then the truncated domain is _not_ + chanced and the call returns an error code. + + _Notice:_ If the parameters of the distribution has been changed by + a ‘unur_distr_cont_set_pdfparams’ call it is recommended to set the + truncated domain again, since the former call might change the + domain of the distribution but not update the values for the + boundaries of the truncated distribution. + + -- Function: double unur_ninv_eval_approxinvcdf (const UNUR_GEN* + GENERATOR, double U) + Get approximate approximate value of inverse CDF at U. If U is out + of the domain [0,1] then ‘unur_errno’ is set to ‘UNUR_ERR_DOMAIN’ + and the respective bound of the domain of the distribution are + returned (which is ‘-UNUR_INFINITY’ or ‘UNUR_INFINITY’ in the case + of unbounded domains). + + _Notice_: This function always evaluates the inverse CDF of the + given distribution. A call to ‘unur_ninv_chg_truncated’ call has + no effect. + + +File: unuran.info, Node: NROU, Next: PINV, Prev: NINV, Up: Methods_for_CONT + +5.3.11 NROU – Naive Ratio-Of-Uniforms method +-------------------------------------------- + +Required: + PDF +Optional: + mode, center, bounding rectangle for acceptance region +Speed: + Set-up: slow or fast, Sampling: moderate +Reinit: + supported +Reference: + [HLD04: Sect.2.4 and Sect.6.4] + + NROU is an implementation of the (generalized) ratio-of-uniforms +method which uses (minimal) bounding rectangles, see *note +Ratio-of-Uniforms::. It uses a positive control parameter r for +adjusting the algorithm to the given distribution to improve performance +and/or to make this method applicable. Larger values of r increase the +class of distributions for which the method works at the expense of a +higher rejection constant. For computational reasons r=1 should be used +if possible (this is the default). Moreover, this implementation uses +the center mu of the distribution (see ‘unur_distr_cont_get_center’ for +details of its default values). + + For the special case with r=1 the coordinates of the minimal bounding +rectangles are given by + v^+ = sup_(x) sqrt(PDF(x)), + u^- = inf_(x) (x- mu) sqrt(PDF(x)), + u^+ = sup_(x) (x- mu) sqrt(PDF(x)), + +where mu is the center of the distribution. For other values of r we +have + v^+ = sup_(x) (PDF(x))^(1/(r+1)), + u^- = inf_(x) (x- mu) (PDF(x))^(r/(r+1)), + u^+ = sup_(x) (x- mu) (PDF(x))^(r/(r+1)). + +These bounds can be given directly. Otherwise they are computed +automatically by means of a (slow) numerical routine. Of course this +routine can fail, especially when this rectangle is not bounded. + + It is important to note that the algorithm works with PDF(x- mu) +instead of PDF(x). This is important as otherwise the acceptance region +can become a very long and skinny ellipsoid along a diagonal of the +(huge) bounding rectangle. + +How To Use +.......... + +For using the NROU method UNU.RAN needs the PDF of the distribution. +Additionally, the parameter r can be set via a ‘unur_vnrou_set_r’ call. +Notice that the acceptance probability decreases when r is increased. +On the other hand is is more unlikely that the bounding rectangle does +not exist if r is small. + + A bounding rectangle can be given by the ‘unur_vnrou_set_u’ and +‘unur_vnrou_set_v’ calls. + + _Important:_ The bounding rectangle has to be provided for the +function PDF(x-center)! Notice that ‘center’ is the center of the given +distribution, see ‘unur_distr_cont_set_center’. If in doubt or if this +value is not optimal, it can be changed (overridden) by a +‘unur_nrou_set_center’ call. + + If the coordinates of the bounding rectangle are not provided by the +user then the minimal bounding rectangle is computed automatically. + + By means of ‘unur_vnrou_set_verify’ and ‘unur_vnrou_chg_verify’ one +can run the sampling algorithm in a checking mode, i.e., in every cycle +of the rejection loop it is checked whether the used rectangle indeed +enclosed the acceptance region of the distribution. When in doubt +(e.g., when it is not clear whether the numerical routine has worked +correctly) this can be used to run a small Monte Carlo study. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. +Notice, that derived parameters like the mode must also be (re-) set if +the parameters or the domain has be changed. Notice, however, that then +the values that has been set by ‘unur_vnrou_set_u’ and +‘unur_vnrou_set_v’ calls are removed and the coordinates of the bounding +box are computed numerically. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_nrou_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_nrou_set_u (UNUR_PAR* PARAMETERS, double UMIN, + double UMAX) + Sets left and right boundary of bounding rectangle. If no values + are given, the boundary of the minimal bounding rectangle is + computed numerically. + + _Notice_: Computing the minimal bounding rectangle may fail under + some circumstances. Moreover, for multimodal distributions the + bounds might be too small as only local extrema are computed. + Nevertheless, for T_c -concave distributions with c=-1/2 it should + work. + + _Important:_ The bounding rectangle that has to be provided is for + the function PDF(x-center)! + + Default: not set. + + -- Function: int unur_nrou_set_v (UNUR_PAR* PARAMETERS, double VMAX) + Set upper boundary for bounding rectangle. If this value is not + given then sqrt(PDF(mode)) is used instead. + + _Notice_: When the mode is not given for the distribution object, + then it will be computed numerically. + + Default: not set. + + -- Function: int unur_nrou_set_r (UNUR_PAR* PARAMETERS, double R) + Sets the parameter R of the generalized ratio-of-uniforms method. + + _Notice_: This parameter must satisfy R>0. + + Default: ‘1’. + + -- Function: int unur_nrou_set_center (UNUR_PAR* PARAMETERS, double + CENTER) + Set the center mu of the PDF. If not set the center of the given + distribution object is used. + + Default: see ‘unur_distr_cont_set_center’. + + -- Function: int unur_nrou_set_verify (UNUR_PAR* PARAMETERS, int + VERIFY) + Turn verifying of algorithm while sampling on/off. + + If the condition PDF(x) <= hat(x) is violated for some x then + ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However, notice + that this might happen due to round-off errors for a few values of + x (less than 1%). + + Default is ‘FALSE’. + + -- Function: int unur_nrou_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Change the verifying of algorithm while sampling on/off. + + +File: unuran.info, Node: PINV, Next: SROU, Prev: NROU, Up: Methods_for_CONT + +5.3.12 PINV – Polynomial interpolation based INVersion of CDF +------------------------------------------------------------- + +Required: + PDF +Optional: + domain, center, CDF, derivative of PDF +Speed: + Set-up: (very) slow, Sampling: (very) fast +Reinit: + not implemented +Reference: + [DHLa08] + + PINV is a variant of numerical inversion, where the inverse CDF is +approximated using Newton’s interpolating formula. The interval [0,1] +is split into several subintervals. In each of these the inverse CDF is +constructed at nodes (CDF(x),x) for some points x in this subinterval. +If the PDF is given, then the CDF is computed numerically from the given +PDF using adaptive Gauss-Lobatto integration with 5 points. +Subintervals are split until the requested accuracy goal is reached. + + The method is not exact, as it only produces random variates of the +approximated distribution. Nevertheless, the maximal tolerated +approximation error can be set to be the resolution (but of course is +bounded by the machine precision). We use the u-error |U-CDF(X)| to +measure the error for X = "approximate inverse CDF"(U). Notice that very +small values of the u-resolution are possible but increase the cost for +the setup step. We call the maximal tolerated u-error the +_u-resolution_ of the algorithm in the sequel. + + Both the order of the interpolating polynomial and the u-resolution +can be selected. + + The interpolating polynomials have to be computed in a setup step. +However, it only works for distributions with bounded domain; for +distributions with unbounded domain the tails are cut off such that the +probability for the tail regions is small compared to the given +u-resolution. + + The construction of the interpolation polynomial only works when the +PDF is unimodal or when the PDF does not vanish between two modes. + + There are some restrictions for the given distribution: + • The support of the distribution (i.e., the region where the PDF is + strictly positive) must be connected. In practice this means, that + the region where PDF is "not too small" must be connected. + Unimodal densities satisfy this condition. If this condition is + violated then the domain of the distribution might be truncated. + • When the PDF is integrated numerically, then the given PDF must be + continuous and should be smooth. + • The PDF must be bounded. + • The algorithm has problems when the distribution has heavy tails + (as then the inverse CDF becomes very steep at 0 or 1) and the + requested u-resolution is very small. E.g., the Cauchy + distribution is likely to show this problem when the requested + u-resolution is less then ‘1.e-12’. + Regions with very small PDF values or heavy tails might lead to an +abortion of the set-up or (even worse) the approximation error might +become larger than requested, since the (computation of the) +interpolating polynomial becomes numerically unstable. + + _Remark:_ We also have implemented experimental variants. However, +we observed that these variants are more sensitive to round-off errors, +especially in the right hand tail and we _do not recommend_ their usage +unless there are severe reasons. + + − Use a function that implements the CDF instead of numerical + integration of the PDF. + + − Use Hermite interpolation instead of Newton interpolation. Thus + the first (and second) derivative of the interpolating polynomial + coincides with that of the inverse CDF. Consequently the + interpolant is also (twice) differentiable even at the interval + boundaries. This variant can be seen as limiting case of Newton + interpolation with double (or triple) points as nodes. + + We have used a _smoothness_ parameter to control this feature. + However, besides numerical problems we observed that this variant + requires more intervals and thus larger setup times and higher + memory consumptions. + +How To Use +.......... + +PINV works for continuous univariate distribution objects with given +PDF. The corresponding distribution object should contain a typical +point of the distribution, i.e., a point where the PDF is not too small, +e.g., (a point near) the mode. However, it is important that the center +is *not* the pole of the distribution (or a point too close to the +pole). It can be set using a ‘unur_distr_cont_set_center’ or a +‘unur_distr_cont_set_mode’ call. If neither is set, or if the given +center cannot be used, then a simple search routine tries to find an +appropriate point for the center. + + It is recommended that the domain of the distribution with bounded +domain is specified using a ‘unur_distr_cont_set_domain’ call. +Otherwise, the boundary is searched numerically which might be rather +expensive, especially when this boundary point is ‘0’. + + The inverse CDF is interpolated using Newton polynomials. The order +of this polynomial can be set by means of a ‘unur_pinv_set_order’ call. + + The smoothness of the interpolant at interval boundaries can be +controlled using a ‘unur_pinv_set_smoothness’ call. Then Hermite +interpolation instead of Newton interpolation is used. (The former can +be seen as a limiting case of Newton interpolation with double (or +triple) points.) However, using higher smoothness is _not recommended_ +unless differentiability at the interval boundaries is important. + + For distributions with unbounded domains the tails are cut off such +that the probability for the tail regions is small compared to the given +u-resolution. For finding these cut points the algorithm starts with +the region ‘[-1.e100,1.e100]’. For the exceptional case where this does +not work these starting points can be changed via a +‘unur_pinv_set_boundary’ call. + + This method is not exact, as it only produces random variates of the +approximated distribution. Nevertheless, the numerical error in +"u-direction" (i.e., |U-CDF(X)|, for X = "approximate inverse CDF"(U) +|U-CDF(X)|) can be controlled by means of ‘unur_pinv_set_u_resolution’. +However, the maximal error of this approximation is only estimated. For +very small u-resolutions the actual approximation error might be +(slightly) larger than the requested u-resolution. (Of course the size +of this value depends on the given PDF.) If this error is crucial for an +application we recommend to compute this error using +‘unur_pinv_estimate_error’ which runs a small Monte Carlo simulation. +It is also possible to improve the error estimate during setup by means +of ‘unur_pinv_set_extra_testpoints’. See also the documentation for +function ‘unur_pinv_set_u_resolution’ and the remark given there. + + The number of required subintervals heavily depends on the order of +the interpolating polynomial and the requested u-resolution: it +increases when order or u-resolution are decreased. It can be checked +using a ‘unur_pinv_get_n_intervals’ call. The maximum number of such +subintervals is fixed but can be increased using a +‘unur_pinv_set_max_intervals’ call. If this maximum number is too small +then the set-up aborts with a corresponding error message. + + It is also possible to use the CDF of the distribution instead of the +PDF. Then the distribution object must contain a pointer to the CDF. +Moreover, this variant of the algorithm has to be switched on using an +‘unur_pinv_set_usecdf’ call. Notice, however, that the setup for this +variant is numerically less stable than using integration of the PDF +(the default variant). Thus using the CDF is _not recommended_. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_pinv_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_pinv_set_order (UNUR_PAR* PARAMETERS, int ORDER) + Set order of interpolation. Valid orders are between ‘3’ and ‘17’. + Higher orders result in fewer intervals for the approximations. + + Default: ‘5’. + + -- Function: int unur_pinv_set_smoothness (UNUR_PAR* PARAMETERS, int + SMOOTHNESS) + Set smoothness of interpolant. By construction the interpolant is + piecewise polynomial and thus smooth on each of the intervals where + these polynomials are constructed. At the interval boundaries, + however, it usually not be differentiable. Method PINV also + implements variants of Newton interpolation where the first (or + second) derivative of the interpolating polynomial coincides with + the respective derivative of the inverse CDF at the nodes. The the + interpolant is (twice) differentiable even at the interval + boundaries. These variants can be seen as limiting case of Newton + interpolation with double (or triple) points as nodes and are known + as Hermite interpolation. + + Possible values for SMOOTHNESS: + + Value Effect Requirements + ----------------------------------------------------------------------- + ‘0’ continuous requires PDF (or CDF) + + ‘1’ differentiable requires PDF (optional: CDF), + order of polynomial must be odd + + ‘2’ twice requires PDF and its derivative + differentiable (optional: CDF), + order must be 5, 8, 11, 14 or 17 + + If the order of the polynomial does not satisfy the given + condition, then it is increased to the next larger possible value. + + _Remark:_ A higher smoothness parameter usually results in a higher + number of intervals and thus a higher setup time and memory + consumption. We also observed that higher smoothness parameters + make the algorithm more sensible for round-off error. Then the + setup fails. + + _Remark:_ If the interpolating polynomial cannot be constructed for + the requested smoothness on a particular interval, then the + smoothness parameter is reduced for that interval. + + _Remark:_ For order ‘3’ and smoothness ‘1’ (cubic Hermite + interpolation) monotonicity is guaranteed by checking a simple + monotonicity condition for the coefficients of the polynomials. + + _Remark:_ Using SMOOTHNESS larger than ‘0’ is _not recommended_ + unless differentiability at the interval boundaries is important + for ones application. + + Default: ‘0’. + + -- Function: int unur_pinv_set_u_resolution (UNUR_PAR* PARAMETERS, + double U_RESOLUTION) + Set maximal tolerated u-error. Values of U_RESOLUTION must at + least ‘1.e-15’ and ‘1.e-5’ at most. Notice that the resolution of + most uniform random number sources is 2^(-32) = ‘2.3e-10’. Thus a + value of ‘1.e-10’ leads to an inversion algorithm that could be + called exact. For most simulations slightly bigger values for the + maximal error are enough as well. + + Smaller values for U_RESOLUTION increase the number of subinterval + that are necessary for the approximation of the inverse CDF. For + very small values (less then ‘1.e-12’) this number might exceed the + maximum number of such intervals. However, this number can be + increased using a ‘unur_pinv_set_max_intervals’ call. + + _Remark:_ We ran many experiments and found that the observed + u-error was always smaller than the given U_RESOLUTION whenever + this value was ‘1.e-12’. For values smaller than ‘1e-13’ the + maximal observed u-error was slightly larger. One use ‘1.e-15’ if + best approximation is required. However, then the actual u-error + can be as large as ‘1.e-14’. + + Consider calling ‘unur_pinv_set_extra_testpoints’ in order to + reduce the risk of larger approximation errors. + + *Warning!* These figures are based on our experiments (with some + tolerance added to be on the safe side). There is no guarantee for + these error estimates for a particular distribution. + + Default is ‘1.e-10’. + + -- Function: int unur_pinv_set_extra_testpoints (UNUR_PAR* PARAMETERS, + int N_POINTS) + During setup method PINV checks the current u-error by means of + carefully selected test points and improves the approximation where + necessary. However, it nevertheless may happen, that the maximal + approximation error is larger than estimated in some interval + (which usually is hit with a very small probability). This + estimate can be improved by using extra test points which can be + added by means of this call. However, this increases the setup + time considerably. Note that these additional points are selected + equidistributed in each subinterval. + + Default is ‘0’ (i.e., no additional test points are used). + + -- Function: int unur_pinv_set_use_upoints (UNUR_PAR* PARAMETERS, int + USE_UPOINTS) + If USE_UPOINTS is ‘TRUE’, then the nodes of the interpolating + polynomial are constructed by means of Chebyshev points in u-scale + not in x-scale. This results is a better approximation but almost + doubles the number of PDF or CDF evaluations during the setup. + (This is an experimental feature.) + + Default: ‘FALSE’ + + -- Function: int unur_pinv_set_usepdf (UNUR_PAR* PARAMETERS) + Use PDF (if available) to compute approximate inverse CDF. + + This is the default. + + -- Function: int unur_pinv_set_usecdf (UNUR_PAR* PARAMETERS) + Use CDF (if available) to compute approximate inverse CDF. This + variant is intend for running experiments with method PINV. + + _Remark:_ We ran many experiments and found that for small values + of the given U_RESOLUTION (less than ‘1.e-12’) the setup fails for + distributions with heavy tails. We found that using the PDF + (instead of the CDF) is numerically more stable. This is + especially the case when the smoothness parameter is set to ‘1’ or + ‘2’. + + Using the CDF is *not recommended*. + + -- Function: int unur_pinv_set_boundary (UNUR_PAR* PARAMETERS, double + LEFT, double RIGHT) + Set LEFT and RIGHT point for finding the cut-off points for the + "computational domain", i.e., the domain that covers the essential + part of the distribution. The cut-off points are computed such + that the tail probabilities are smaller than given by + ‘unur_pinv_set_u_resolution’. It is usually safe to use a large + interval. However, ‘+/- UNUR_INFINITY’ is not allowed. + + _Important_: This call does not change the domain of the given + distribution itself. But it restricts the domain for the resulting + random variates. + + Default: intersection of ‘[-1.e100,+1.e100]’ and the given domain + of the distribution. + + -- Function: int unur_pinv_set_searchboundary (UNUR_PAR* PARAMETERS, + int LEFT, int RIGHT) + If LEFT or RIGHT is set to ‘FALSE’ then the respective boundary as + given by a ‘unur_pinv_set_boundary’ call is used without any + further computations. However, these boundary points might cause + numerical problems during the setup when PDF returns ‘0’ “almost + everywhere”. If set to ‘TRUE’ (the default) then the computational + interval is shortened to a more sensible region by means of a + search algorithm. Switching off this search is useful, e.g., for + the Gamma(2) distribution where the left border ‘0’ is fixed and + finite. + + _Remark:_ The searching algorithm assumes that the support of the + distribution is connected. + + _Remark:_ Do not set this parameter to ‘FALSE’ except when + searching for cut-off points fails and one wants to try with + precomputed values. + + Default: ‘TRUE’. + + -- Function: int unur_pinv_set_max_intervals (UNUR_PAR* PARAMETERS, int + MAX_IVS) + Set maximum number of intervals. MAX_IVS must be at least ‘100’ + and at most ‘1000000’. + + Default is ‘10000’. + + -- Function: int unur_pinv_get_n_intervals (const UNUR_GEN* GENERATOR) + Get number of intervals used for interpolation in the generator + object. It returns ‘0’ in case of an error. + + -- Function: int unur_pinv_set_keepcdf (UNUR_PAR* PARAMETERS, int + KEEPCDF) + If the PDF is given, then the CDF is computed numerically from the + given PDF using adaptive Gauss-Lobatto integration. Thus a table + of CDF points is stored to keep the number of evaluations of the + PDF minimal. Usually this table is discarded when the setup is + completed. If KEEPCDF is ‘TRUE’, then this table is kept and can + be used to compute the CDF of the underlying distribution by means + of function ‘unur_pinv_eval_approxcdf’. This option is ignored + when ‘unur_pinv_set_usecdf’ is called. + + Default: ‘FALSE’ + + -- Function: double unur_pinv_eval_approxinvcdf (const UNUR_GEN* + GENERATOR, double U) + Evaluate interpolation of inverse CDF at U. If U is out of the + domain (0,1) then ‘unur_errno’ is set to ‘UNUR_ERR_DOMAIN’ and the + respective bound of the domain of the distribution are returned + (which is ‘-UNUR_INFINITY’ or ‘UNUR_INFINITY’ in the case of + unbounded domains). + + -- Function: double unur_pinv_eval_approxcdf (const UNUR_GEN* + GENERATOR, double X) + Evaluate (approximate) CDF at X. If the PDF of the distribution is + given, then adaptive Gauss-Lobatto integration is used to compute + the CDF. If the PDF is used to create the generator object, then + the table of integral values must not removed at the end of setup + and thus ‘unur_pinv_set_keepcdf’ must be called. + + -- Function: int unur_pinv_estimate_error (const UNUR_GEN* GENERATOR, + int SAMPLESIZE, double* MAX_ERROR, double* MAE) + Estimate maximal u-error and mean absolute error (MAE) for + GENERATOR by means of Monte-Carlo simulation with sample size + SAMPLESIZE. The results are stored in MAX_ERROR and MAE, + respectively. + + It returns ‘UNUR_SUCCESS’ if successful. + + +File: unuran.info, Node: SROU, Next: SSR, Prev: PINV, Up: Methods_for_CONT + +5.3.13 SROU – Simple Ratio-Of-Uniforms method +--------------------------------------------- + +Required: + T-concave PDF, mode, area +Speed: + Set-up: fast, Sampling: slow +Reinit: + supported +Reference: + [LJa01] [LJa02] [HLD04: Sect.6.3.1; Sect.6.3.2; Sect.6.4.1; + Alg.6.4; Alg.6.5; Alg.6.7] + + SROU is based on the ratio-of-uniforms method (*note +Ratio-of-Uniforms::) that uses universal inequalities for constructing a +(universal) bounding rectangle. It works for all T-concave +distributions, including log-concave and T-concave distributions with +T(x) = -1/sqrt(x). + + Moreover an (optional) parameter ‘r’ can be given, to adjust the +generator to the given distribution. This parameter is strongly related +to the parameter ‘c’ for transformed density rejection (*note TDR::) via +the formula c = -r/(r+1). The rejection constant increases with higher +values for ‘r’. On the other hand, the given density must be T_c +-concave for the corresponding c. The default setting for ‘r’ is 1 +which results in a very simple code. (For other settings, sampling +uniformly from the acceptance region is more complicated.) + + Optionally the CDF at the mode can be given to increase the +performance of the algorithm. Then the rejection constant is reduced by +1/2 and (if ‘r=1’) even a universal squeeze can (but need not be) used. +A way to increase the performance of the algorithm when the CDF at the +mode is not provided is the usage of the mirror principle (only if +‘r=1’). However, using squeezes and using the mirror principle is only +recommended when the PDF is expensive to compute. + + The exact location of the mode and/or the area below the PDF can be +replace by appropriate bounds. Then the algorithm still works but has +larger rejection constants. + +How To Use +.......... + +SROU works for any continuous univariate distribution object with given +T_c -concave PDF with c<1, ) mode and area below PDF. Optional the CDF +at the mode can be given to increase the performance of the algorithm by +means of the ‘unur_srou_set_cdfatmode’ call. Additionally squeezes can +be used and switched on via ‘unur_srou_set_usesqueeze’ (only if ‘r=1’). +A way to increase the performance of the algorithm when the CDF at the +mode is not provided is the usage of the mirror principle which can be +swithced on by means of a ‘unur_srou_set_usemirror’ call (only if ‘r=1’) +. However using squeezes and using the mirror principle is only +recommended when the PDF is expensive to compute. + + The parameter ‘r’ can be given, to adjust the generator to the given +distribution. This parameter is strongly related parameter ‘c’ for +transformed density rejection via the formula c = -r/(r+1). The +parameter ‘r’ can be any value larger than or equal to 1. Values less +then 1 are automatically set to 1. The rejection constant depends on +the chosen parameter ‘r’ but not on the particular distribution. It is +4 for ‘r’ equal to 1 and higher for higher values of ‘r’. It is +important to note that different algorithms for different values of ‘r’: +If ‘r’ equal to 1 this is much faster than the algorithm for ‘r’ greater +than 1. The default setting for ‘r’ is 1. + + If the (exact) area below the PDF is not known, then an upper bound +can be used instead (which of course increases the rejection constant). +But then the squeeze flag must not be set and ‘unur_srou_set_cdfatmode’ +must not be used. + + If the exact location of the mode is not known, then use the +approximate location and provide the (exact) value of the PDF at the +mode by means of the ‘unur_srou_set_pdfatmode’ call. But then +‘unur_srou_set_cdfatmode’ must not be used. Notice, that a (slow) +numerical mode finder will be used if no mode is given at all. It is +even possible to give an upper bound for the PDF only. However, then +the (upper bound for the) area below the PDF has to be multiplied by the +ratio between the upper bound and the lower bound of the PDF at the +mode. Again setting the squeeze flag and using +‘unur_srou_set_cdfatmode’ is not allowed. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. +Notice, that derived parameters like the mode must also be (re-) set if +the parameters or the domain has be changed. Moreover, if the PDF at +the mode has been provided by a ‘unur_srou_set_pdfatmode’ call, +additionally ‘unur_srou_chg_pdfatmode’ must be used (otherwise this call +is not necessary since then this figure is computed directly from the +PDF). + + There exists a test mode that verifies whether the conditions for the +method are satisfied or not while sampling. It can be switched on by +calling ‘unur_srou_set_verify’ and ‘unur_srou_chg_verify’, respectively. +Notice however that sampling is (a little bit) slower then. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_srou_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_srou_set_r (UNUR_PAR* PARAMETERS, double R) + Set parameter R for transformation. Only values greater than or + equal to 1 are allowed. The performance of the generator decreases + when R is increased. On the other hand R must not be set to small, + since the given density must be T_c-concave for c = -r/(r+1). + + _Notice:_ If R is set to ‘1’ a simpler and much faster algorithm is + used then for R greater than one. + + For computational reasons values of R that are greater than ‘1’ but + less than ‘1.01’ are always set to ‘1.01’. + + Default is ‘1’. + + -- Function: int unur_srou_set_cdfatmode (UNUR_PAR* PARAMETERS, double + FMODE) + Set CDF at mode. When set, the performance of the algorithm is + increased by factor 2. However, when the parameters of the + distribution are changed ‘unur_srou_chg_cdfatmode’ has to be used + to update this value. + + Default: not set. + + -- Function: int unur_srou_set_pdfatmode (UNUR_PAR* PARAMETERS, double + FMODE) + Set pdf at mode. When set, the PDF at the mode is never changed. + This is to avoid additional computations, when the PDF does not + change when parameters of the distributions vary. It is only + useful when the PDF at the mode does not change with changing + parameters of the distribution. + + _IMPORTANT:_ This call has to be executed after a possible call of + ‘unur_srou_set_r’. Default: not set. + + -- Function: int unur_srou_set_usesqueeze (UNUR_PAR* PARAMETERS, int + USESQUEEZE) + Set flag for using universal squeeze (default: off). Using + squeezes is only useful when the evaluation of the PDF is + (extremely) expensive. Using squeezes is automatically disabled + when the CDF at the mode is not given (then no universal squeezes + exist). + + Squeezes can only be used if ‘r=1’. + + Default is ‘FALSE’. + + -- Function: int unur_srou_set_usemirror (UNUR_PAR* PARAMETERS, int + USEMIRROR) + Set flag for using mirror principle (default: off). Using the + mirror principle is only useful when the CDF at the mode is not + known and the evaluation of the PDF is rather cheap compared to the + marginal generation time of the underlying uniform random number + generator. It is automatically disabled when the CDF at the mode + is given. (Then there is no necessity to use the mirror principle. + However disabling is only done during the initialization step but + not at a re-initialization step.) + + The mirror principle can only be used if ‘r=1’. + + Default is ‘FALSE’. + + -- Function: int unur_srou_set_verify (UNUR_PAR* PARAMETERS, int + VERIFY) + -- Function: int unur_srou_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the + condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x + then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However + notice that this might happen due to round-off errors for a few + values of x (less than 1%). + + Default is ‘FALSE’. + + -- Function: int unur_srou_chg_cdfatmode (UNUR_GEN* GENERATOR, double + FMODE) + Change CDF at mode of distribution. ‘unur_reinit’ must be executed + before sampling from the generator again. + + -- Function: int unur_srou_chg_pdfatmode (UNUR_GEN* GENERATOR, double + FMODE) + Change PDF at mode of distribution. ‘unur_reinit’ must be executed + before sampling from the generator again. + + +File: unuran.info, Node: SSR, Next: TABL, Prev: SROU, Up: Methods_for_CONT + +5.3.14 SSR – Simple Setup Rejection +----------------------------------- + +Required: + T-concave PDF, mode, area +Speed: + Set-up: fast, Sampling: slow +Reinit: + supported +Reference: + [LJa01] [HLD04: Sect.6.3.3; Alg.6.6] + + SSR is an acceptance/rejection method that uses universal +inequalities for constructing (universal) hats and squeezes (*note +Rejection::). It works for all T-concave distributions with T(x) = +-1/sqrt(x). + + It requires the PDF, the (exact) location of the mode and the area +below the given PDF. The rejection constant is 4 for all T-concave +distributions with unbounded domain and is less than 4 when the domain +is bounded. Optionally the CDF at the mode can be given to increase the +performance of the algorithm. Then the rejection constant is at most 2 +and a universal squeeze can (but need not be) used. However, using +squeezes is not recommended unless the evaluation of the PDF is +expensive. + + The exact location of the mode and/or the area below the PDF can be +replace by appropriate bounds. Then the algorithm still works but has +larger rejection constants. + +How To Use +.......... + +SSR works for any continuous univariate distribution object with given +T-concave PDF (with T(x) = -1/sqrt(x),) mode and area below PDF. +Optional the CDF at the mode can be given to increase the performance of +the algorithm by means of the ‘unur_ssr_set_cdfatmode’ call. +Additionally squeezes can be used and switched on via +‘unur_ssr_set_usesqueeze’. If the (exact) area below the PDF is not +known, then an upper bound can be used instead (which of course +increases the rejection constant). But then the squeeze flag must not +be set and ‘unur_ssr_set_cdfatmode’ must not be used. + + If the exact location of the mode is not known, then use the +approximate location and provide the (exact) value of the PDF at the +mode by means of the ‘unur_ssr_set_pdfatmode’ call. But then +‘unur_ssr_set_cdfatmode’ must not be used. Notice, that a (slow) +numerical mode finder will be used if no mode is given at all. It is +even possible to give an upper bound for the PDF only. However, then +the (upper bound for the) area below the PDF has to be multiplied by the +ratio between the upper bound and the lower bound of the PDF at the +mode. Again setting the squeeze flag and using ‘unur_ssr_set_cdfatmode’ +is not allowed. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. +Notice, that derived parameters like the mode must also be (re-) set if +the parameters or the domain has be changed. Moreover, if the PDF at +the mode has been provided by a ‘unur_ssr_set_pdfatmode’ call, +additionally ‘unur_ssr_chg_pdfatmode’ must be used (otherwise this call +is not necessary since then this figure is computed directly from the +PDF). + + _Important:_ If any of mode, PDF or CDF at the mode, or the area +below the mode has been changed, then ‘unur_reinit’ must be executed. +(Otherwise the generator produces garbage). + + There exists a test mode that verifies whether the conditions for the +method are satisfied or not while sampling. It can be switched on/off +by calling ‘unur_ssr_set_verify’ and ‘unur_ssr_chg_verify’, +respectively. Notice, however, that sampling is (a little bit) slower +then. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_ssr_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_ssr_set_cdfatmode (UNUR_PAR* PARAMETERS, double + FMODE) + Set CDF at mode. When set, the performance of the algorithm is + increased by factor 2. However, when the parameters of the + distribution are changed ‘unur_ssr_chg_cdfatmode’ has to be used to + update this value. + + Default: not set. + + -- Function: int unur_ssr_set_pdfatmode (UNUR_PAR* PARAMETERS, double + FMODE) + Set pdf at mode. When set, the PDF at the mode is never changed. + This is to avoid additional computations, when the PDF does not + change when parameters of the distributions vary. It is only + useful when the PDF at the mode does not change with changing + parameters for the distribution. + + Default: not set. + + -- Function: int unur_ssr_set_usesqueeze (UNUR_PAR* PARAMETERS, int + USESQUEEZE) + Set flag for using universal squeeze (default: off). Using + squeezes is only useful when the evaluation of the PDF is + (extremely) expensive. Using squeezes is automatically disabled + when the CDF at the mode is not given (then no universal squeezes + exist). + + Default is ‘FALSE’. + + -- Function: int unur_ssr_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) + -- Function: int unur_ssr_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the + condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x + then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However + notice that this might happen due to round-off errors for a few + values of x (less than 1%). + + Default is ‘FALSE’. + + -- Function: int unur_ssr_chg_cdfatmode (UNUR_GEN* GENERATOR, double + FMODE) + Change CDF at mode of distribution. ‘unur_reinit’ must be executed + before sampling from the generator again. + + -- Function: int unur_ssr_chg_pdfatmode (UNUR_GEN* GENERATOR, double + FMODE) + Change PDF at mode of distribution. ‘unur_reinit’ must be executed + before sampling from the generator again. + + +File: unuran.info, Node: TABL, Next: TDR, Prev: SSR, Up: Methods_for_CONT + +5.3.15 TABL – a TABLe method with piecewise constant hats +--------------------------------------------------------- + +Required: + PDF, all local extrema, cut-off values for the tails +Optional: + approximate area +Speed: + Set-up: (very) slow, Sampling: fast +Reinit: + not implemented +Reference: + [AJa93] [AJa95] [HLD04: Cha.5.1] + + TABL (called Ahrens method in [HLD04] ) is an acceptance/rejection +method (*note Rejection::) that uses a decomposition of the domain of +the distribution into many short subintervals. Inside of these +subintervals constant hat and squeeze functions are utilized. Thus it +is easy to use the idea of immediate acceptance for points below the +squeeze. This reduces the expected number of uniform random numbers per +generated random variate to less than two. Using a large number of +subintervals only little more than one random number is necessary on +average. Thus this method becomes very fast. + + Due to the constant hat function this method only works for +distributions with bounded domains. Thus for unbounded domains the left +and right tails have to be cut off. This is no problem when the +probability of falling into these tail regions is beyond computational +relevance (e.g. smaller than ‘1.e-12’). + + For easy construction of hat and squeeze functions it is necessary to +know the regions of monotonicity (called _slopes_) or equivalently all +local maxima and minima of the density. The main problem for this +method in the setup is the choice of the subintervals. A simple and +close to optimal approach is the "equal area rule" [HLD04: Cha.5.1] . +There the subintervals are selected such that the area below the hat is +the same for each subinterval which can be realized with a simple +recursion. If more subintervals are necessary it is possible to split +either randomly chosen intervals (adaptive rejection sampling, ARS) or +those intervals, where the ratio between squeeze and hat is smallest. +This version of the setup is called derandomized ARS (DARS). With the +default settings TABL is first calculating approximately 30 subintervals +with the equal area rule. Then DARS is used till the desired fit of the +hat is reached. + + A convenient measure to control the quality of the fit of hat and +squeeze is the ratio (area below squeeze)/(area below hat) called +‘sqhratio’ which must be smaller or equal to one. The expected number +of iterations in the rejection algorithm is known to be smaller than +1/sqhratio and the expected number of evaluations of the density is +bounded by ‘1/sqhratio - 1’. So values of the sqhratio close to one +(e.g. ‘0.95’ or ‘0.99’) lead to many subintervals. Thus a better +fitting hat is constructed and the sampling algorithm becomes fast; on +the other hand large tables are needed and the setup is very slow. For +moderate values of sqhratio (e.g. ‘0.9’ or ‘0.8’) the sampling is +slower but the required tables are smaller and the setup is not so slow. + + It follows from the above explanations that TABL is always requiring +a slow setup and that it is not very well suited for heavy-tailed +distributions. + +How To Use +.......... + +For using the TABL method UNU.RAN needs a bounded interval to which the +generated variates can be restricted and information about all local +extrema of the distribution. For unimodal densities it is sufficient to +provide the mode of the distribution. For the case of a built-in +unimodal distribution with bounded domain all these information is +present in the distribution object and thus no extra input is necessary +(see example_TABL1 below). + + For a built-in unimodal distribution with unbounded domain we should +specify the cut-off values for the tails. This can be done with the +‘unur_tabl_set_boundary’ call (see example_TABL2 below). For the case +that we do not set these boundaries the default values of ‘+/- 1.e20’ +are used. We can see in example_TABL1 that this still works fine for +many standard distributions. + + For the case of a multimodal distribution we have to set the regions +of monotonicity (called slopes) explicitly using the +‘unur_tabl_set_slopes’ command (see example_TABL3 below). + + To controll the fit of the hat and the size of the tables and thus +the speed of the setup and the sampling it is most convenient to use the +‘unur_tabl_set_max_sqhratio’ call. The default is ‘0.9’ which is a +sensible value for most distributions and applications. If very large +samples of a distribution are required or the evaluation of a density is +very slow it may be useful to increase the sqhratio to eg. ‘0.95’ or +even ‘0.99’. With the ‘unur_tabl_get_sqhratio’ call we can check which +sqhratio was really reached. If that value is below the desired value +it is necessary to increase the maximal number of subintervals, which +defaults to ‘1000’, using the ‘unur_tabl_set_max_intervals’ call. The +‘unur_tabl_get_n_intervals’ call can be used to find out the number of +subintervals the setup calculated. + + It is also possible to set the number of intervals and their +respective boundaries by means of the ‘unur_tabl_set_cpoints’ call. + + It is also possible to use method TABL for correlation induction +(variance reduction) by setting of an auxiliary uniform random number +generator via the ‘unur_set_urng_aux’ call. (Notice that this must be +done after a possible ‘unur_set_urng’ call.) However, this only works +when immediate acceptance is switched off by a +‘unur_tabl_set_variant_ia’ call. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_tabl_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_tabl_set_variant_ia (UNUR_PAR* PARAMETERS, int + USE_IA) + Use immediate acceptance when USE_IA is set to ‘TRUE’. This + technique requires less uniform. If it is set to ‘FALSE’, + “classical” acceptance/rejection from hat distribution is used. + + _Notice:_ Auxiliary uniform random number generators for + correlation induction (variance reduction) can only be used when + “classical” acceptance/rejection is used. + + Default: ‘TRUE’. + + -- Function: int unur_tabl_set_cpoints (UNUR_PAR* PARAMETERS, int + N_CPOINTS, const DOUBLE* CPOINTS) + Set construction points for the hat function. If STP is ‘NULL’ + than a heuristic rule of thumb is used to get N_STP construction + points. This is the default behavior. + + The default number of construction points is ‘30’. + + -- Function: int unur_tabl_set_nstp (UNUR_PAR* PARAMETERS, int N_STP) + Set number of construction points for the hat function. N_STP must + be greater than zero. After the setup there are about N_STP + construction points. However it might be larger when a small + fraction is given by the ‘unur_tabl_set_areafraction’ call. It + also might be smaller for some variants. + + Default is ‘30’. + + -- Function: int unur_tabl_set_useear (UNUR_PAR* PARAMETERS, int + USEEAR) + If USEEAR is set to ‘TRUE’, the “equal area rule” is used, the + given slopes are partitioned in such a way that the area below the + hat function in each subinterval (“stripe”) has the same area + (except the last the last interval which can be smaller). The area + can be set by means of the ‘unur_tabl_set_areafraction’ call. + + Default is ‘TRUE’. + + -- Function: int unur_tabl_set_areafraction (UNUR_PAR* PARAMETERS, + double FRACTION) + Set parameter for the equal area rule. During the setup a + piecewise constant hat is constructed, such that the area below + each of these pieces (strips) is the same and equal to the (given) + area below the PDF times FRACTION (which must be greater than + zero). + + _Important:_ If the area below the PDF is not set in the + distribution object, then 1 is assumed. + + Default is ‘0.1’. + + -- Function: int unur_tabl_set_usedars (UNUR_PAR* PARAMETERS, int + USEDARS) + If USEDARS is set to ‘TRUE’, “derandomized adaptive rejection + sampling” (DARS) is used in the setup. Intervals, where the area + between hat and squeeze is too large compared to the average area + between hat and squeeze over all intervals, are split. This + procedure is repeated until the ratio between squeeze and hat + exceeds the bound given by ‘unur_tabl_set_max_sqhratio’ call or the + maximum number of intervals is reached. Moreover, it also aborts + when no more intervals can be found for splitting. + + For finding splitting points the arc-mean rule (a mixture of + arithmetic mean and harmonic mean) is used. + + Default is ‘TRUE’. + + -- Function: int unur_tabl_set_darsfactor (UNUR_PAR* PARAMETERS, double + FACTOR) + Set factor for “derandomized adaptive rejection sampling”. This + factor is used to determine the segments that are “too large”, that + is, all segments where the area between squeeze and hat is larger + than FACTOR times the average area over all intervals between + squeeze and hat. Notice that all segments are split when FACTOR is + set to ‘0.’, and that there is no splitting at all when FACTOR is + set to ‘UNUR_INFINITY’. + + Default is ‘0.99’. There is no need to change this parameter. + + -- Function: int unur_tabl_set_variant_splitmode (UNUR_PAR* PARAMETERS, + unsigned SPLITMODE) + There are three variants for adaptive rejection sampling. These + differ in the way how an interval is split: + splitmode ‘1’ + use the generated point to split the interval. + splitmode ‘2’ + use the mean point of the interval. + splitmode ‘3’ + use the arcmean point; suggested for distributions with heavy + tails. + + Default is splitmode ‘2’. + + -- Function: int unur_tabl_set_max_sqhratio (UNUR_PAR* PARAMETERS, + double MAX_RATIO) + Set upper bound for the ratio (area below squeeze) / (area below + hat). It must be a number between 0 and 1. When the ratio exceeds + the given number no further construction points are inserted via + DARS in the setup. + + For the case of ARS (unur_tabl_set_usedars() must be set to + ‘FALSE’): Use ‘0’ if no construction points should be added after + the setup. Use ‘1’ if added new construction points should not be + stopped until the maximum number of construction points is reached. + If MAX_RATIO is close to one, many construction points are used. + + Default is ‘0.9’. + + -- Function: double unur_tabl_get_sqhratio (const UNUR_GEN* GENERATOR) + Get the current ratio (area below squeeze) / (area below hat) for + the generator. (In case of an error ‘UNUR_INFINITY’ is returned.) + + -- Function: double unur_tabl_get_hatarea (const UNUR_GEN* GENERATOR) + Get the area below the hat for the generator. (In case of an error + ‘UNUR_INFINITY’ is returned.) + + -- Function: double unur_tabl_get_squeezearea (const UNUR_GEN* + GENERATOR) + Get the area below the squeeze for the generator. (In case of an + error ‘UNUR_INFINITY’ is returned.) + + -- Function: int unur_tabl_set_max_intervals (UNUR_PAR* PARAMETERS, int + MAX_IVS) + Set maximum number of intervals. No construction points are added + in or after the setup when the number of intervals suceeds MAX_IVS. + + Default is ‘1000’. + + -- Function: int unur_tabl_get_n_intervals (const UNUR_GEN* GENERATOR) + Get the current number of intervals. (In case of an error 0 is + returned.) + + -- Function: int unur_tabl_set_slopes (UNUR_PAR* PARAMETERS, const + DOUBLE* SLOPES, int N_SLOPES) + Set slopes for the PDF. A slope is an interval [a,b] or [b,a] + where the PDF is monotone and PDF(a) >= PDF(b). The list of slopes + is given by an array SLOPES where each consecutive tuple (i.e. + ‘(slopes[0], slopes[1])’, ‘(slopes[2], slopes[3])’, etc.) defines + one slope. Slopes must be sorted (i.e. both ‘slopes[0]’ and + ‘slopes[1]’ must not be greater than any entry of the slope + ‘(slopes[2], slopes[3])’, etc.) and must not be overlapping. + Otherwise no slopes are set and UNUR_ERRNO is set to + ‘UNUR_ERR_PAR_SET’. + + _Notice:_ N_SLOPES is the number of slopes (and not the length of + the array SLOPES). + + _Notice_ that setting slopes resets the given domain for the + distribution. However, in case of a standard distribution the area + below the PDF is not updated. + + -- Function: int unur_tabl_set_guidefactor (UNUR_PAR* PARAMETERS, + double FACTOR) + Set factor for relative size of the guide table for indexed search + (see also method DGT *note DGT::). It must be greater than or + equal to ‘0’. When set to ‘0’, then sequential search is used. + + Default is ‘1’. + + -- Function: int unur_tabl_set_boundary (UNUR_PAR* PARAMETERS, double + LEFT, double RIGHT) + Set the left and right boundary of the computation interval. The + piecewise hat is only constructed inside this interval. The + probability outside of this region must not be of computational + relevance. Of course ‘+/- UNUR_INFINITY’ is not allowed. + + Default is ‘-1.e20,1.e20’. + + -- Function: int unur_tabl_chg_truncated (UNUR_GEN* GEN, double LEFT, + double RIGHT) + Change the borders of the domain of the (truncated) distribution. + + Notice that the given truncated domain must be a subset of the + domain of the given distribution. The generator always uses the + intersection of the domain of the distribution and the truncated + domain given by this call. The hat function will not be changed. + + _Important:_ The ratio between the area below the hat and the area + below the squeeze changes when the sampling region is restricted. + In particalur it becomes (very) large when sampling from the (far) + tail of the distribution. Then it is better to create a generator + object for the tail of distribution only. + + _Important:_ This call does not work for variant ‘IA’ (immediate + acceptance). In this case UNU.RAN switches _automatically_ to + variant ‘RH’ (use “classical” acceptance/rejection from hat + distribution) and does revert to the variant originally set by the + user. + + _Important:_ It is not a good idea to use adaptave rejection + sampling while sampling from a domain that is a strict subset of + the domain that has been used to construct the hat. For that + reason adaptive adding of construction points is _automatically + disabled_ by this call. + + _Important:_ If the CDF of the hat is (almost) the same for LEFT + and RIGHT and (almost) equal to ‘0’ or ‘1’, then the truncated + domain is not changed and the call returns an error code. + + -- Function: int unur_tabl_set_verify (UNUR_PAR* PARAMETERS, int + VERIFY) + -- Function: int unur_tabl_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the + condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x + then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However + notice that this might happen due to round-off errors for a few + values of x (less than 1%). + + Default is ‘FALSE’. + + -- Function: int unur_tabl_set_pedantic (UNUR_PAR* PARAMETERS, int + PEDANTIC) + Sometimes it might happen that ‘unur_init’ has been executed + successfully. But when additional construction points are added by + adaptive rejection sampling, the algorithm detects that the PDF is + not monotone in the given slopes. + + With PEDANTIC being ‘TRUE’, the sampling routine is exchanged by a + routine that simply returns ‘UNUR_INFINITY’ indicating an error. + + Default is ‘FALSE’. + + +File: unuran.info, Node: TDR, Next: UTDR, Prev: TABL, Up: Methods_for_CONT + +5.3.16 TDR – Transformed Density Rejection +------------------------------------------ + +Required: + T-concave PDF, dPDF +Optional: + mode +Speed: + Set-up: slow, Sampling: fast +Reinit: + supported +Reference: + [GWa92] [HWa95] [HLD04: Cha.4] + + TDR is an acceptance/rejection method that uses the concavity of a +transformed density to construct hat function and squeezes +automatically. Such PDFs are called T-concave. Currently the following +transformations are implemented and can be selected by setting their +‘c’-values by a ‘unur_tdr_set_c’ call: + +‘c = 0’ + T(x) = log(x) +‘c = -0.5’ + T(x) = -1/sqrt(x) (Default) + + In future releases the transformations T(x) = -(x)^c will be +available for any c with 0 > c > -1. Notice that if a PDF is T-concave +for a c then it also T-concave for every c’ + + /* ------------------------------------------------------------- */ + + /* Example how to sample from an empirial continuous univariate */ + /* distribution. */ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; + double x; + + /* data points */ + double data[15] = { -0.1, 0.05, -0.5, 0.08, 0.13,\ + -0.21,-0.44, -0.43, -0.33, -0.3, \ + 0.18, 0.2, -0.37, -0.29, -0.9 }; + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create a distribution object and set empirical sample. */ + distr = unur_distr_cemp_new(); + unur_distr_cemp_set_data(distr, data, 15); + + /* Choose a method: EMPK. */ + par = unur_empk_new(distr); + + /* Set smooting factor. */ + unur_empk_set_smoothing(par, 0.8); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + +Example (String API) +-------------------- + + /* ------------------------------------------------------------- */ + /* File: example_emp_str.c */ + /* ------------------------------------------------------------- */ + /* String API. */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* Example how to sample from an empirial continuous univariate */ + /* distribution. */ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; + double x; + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + gen = unur_str2gen("distr = cemp; \ + data=(-0.10, 0.05,-0.50, 0.08, 0.13, \ + -0.21,-0.44,-0.43,-0.33,-0.30, \ + 0.18, 0.20,-0.37,-0.29,-0.90) & \ + method=empk; smoothing=0.8"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + +File: unuran.info, Node: EMPK, Next: EMPL, Up: Methods_for_CEMP + +5.4.1 EMPK – EMPirical distribution with Kernel smoothing +--------------------------------------------------------- + +Required: + observed sample +Speed: + Set-up: slow (as sample is sorted), Sampling: fast (depends on + kernel) +Reinit: + not implemented +Reference: + [HLa00] [HLD04: Sect.12.1.2] + + EMPK generates random variates from an empirical distribution that is +given by an observed sample. The idea is that simply choosing a random +point from the sample and to return it with some added noise results in +a method that has very nice properties, as it can be seen as sampling +from a kernel density estimate. If the underlying distribution is +continuous, especially the fine structur of the resulting empirical +distribution is much better than using only resampling without noise. + + Clearly we have to decide about the density of the noise (called +kernel) and about the standard deviation of the noise. The mathematical +theory of kernel density estimation shows us that we are comparatively +free in choosing the kernel. It also supplies us with a simple formula +to compute the optimal standarddeviation of the noise, called bandwidth +(or window width) of the kernel. + + The variance of the estimated density is slightly larger than that of +the observed sample. However, this can be easily corrected if required. + + There is also a correction (mirroring technique) for distributions +with non-negative support. + + A simple robust reference method is implemented to find a good +standard deviation of the noise (i.e. the bandwidth of kernel density +estimation). For some cases (e.g. densities with two or more sharp +distinct peaks) there kernel density estimation can be adjusted by +changing the smoothness factor and the so called beta factor. + +How To Use +.......... + +EMPK uses empirical distributions. The main parameter is the choice if +of kernel density. The most important kernels can be set by +‘unur_empk_set_kernel’. Additionally generators for other kernels can +be used by using ‘unur_empk_set_kernelgen’ instead. Additionally +variance correction and a correction for non-negative variates can be +switched on. + + The two other parameters (smoothing factor and beta factor) are only +useful for people knowing the theory of kernel density estimation. It +is not necessary to change them if the true underlying distribution is +somehow comparable with a bell-shaped curve, even skewed or with some +not too sharp extra peaks. In all these cases the simple robust +reference method implemented to find a good standard deviation of the +noise (i.e. the bandwidth of kernel density estimation) should give +sensible results. However, it might be necessary to overwrite this +automatic method to find the bandwidth eg. when resampling from data +with two or more sharp distinct peaks. Then the distribution has nearly +discrete components as well and our automatic method may easily choose +too large a bandwidth which results in an empirical distribution which +is oversmoothed (i.e. it has lower peaks than the original +distribution). Then it is recommended to decrease the bandwidth using +the ‘unur_empk_set_smoothing’ call. A smoothing factor of ‘1’ is the +default. A smoothing factor of ‘0’ leads to naive resampling of the +data. Thus an appropriate value between these extremes should be +choosen. We recommend to consult a reference on kernel smoothing when +doing so; but it is not a simple problem to determine an optimal +bandwidth for distributions with sharp peaks. + + In general, for most applications it is perfectly ok to use the +default values offered. Unless you have some knowledge on density +estimation we do not recommend to change anything. There are two +exceptions: + + A. In the case that the unknown underlying distribution is not + continuous but discrete you should "turn off" the adding of the + noise by setting: + + unur_empk_set_smoothing(par, 0.) + + B. In the case that you are especially interested in a fast sampling + algorithm use the call + unur_empk_set_kernel(par, UNUR_DISTR_BOXCAR); + to change the used noise distribution from the default Gaussian + distribution to the uniform distribution. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_empk_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_empk_set_kernel (UNUR_PAR* PARAMETERS, unsigned + KERNEL) + Select one of the supported kernel distributions. Currently the + following kernels are supported: + + ‘UNUR_DISTR_GAUSSIAN’ + Gaussian (normal) kernel + ‘UNUR_DISTR_EPANECHNIKOV’ + Epanechnikov kernel + ‘UNUR_DISTR_BOXCAR’ + Boxcar (uniform, rectangular) kernel + ‘UNUR_DISTR_STUDENT’ + t3 kernel (Student’s distribution with 3 degrees of freedom) + ‘UNUR_DISTR_LOGISTIC’ + logistic kernel + + For other kernels (including kernels with Student’s distribution + with other than 3 degrees of freedom) use the + ‘unur_empk_set_kernelgen’ call. + + It is not possible to call ‘unur_empk_set_kernel’ twice. + + Default is the Gaussian kernel. + + -- Function: int unur_empk_set_kernelgen (UNUR_PAR* PARAMETERS, const + UNUR_GEN* KERNELGEN, double ALPHA, double KERNELVAR) + Set generator for the kernel used for density estimation. + + ALPHA is used to compute the optimal bandwidth from the point of + view of minimizing the mean integrated square error (MISE). It + depends on the kernel K and is given by + alpha(K) = Var(K)^(-2/5){ \int K(t)^2 dt}^(1/5) + For standard kernels (see above) alpha is computed by the + algorithm. + + KERNVAR is the variance of the used kernel. It is only required + for the variance corrected version of density estimation (which is + used by default); otherwise it is ignored. If KERNELVAR is + nonpositive, variance correction is disabled. For standard kernels + (see above) KERNVAR is computed by the algorithm. + + It is not possible to call ‘unur_empk_set_kernelgen’ after a + standard kernel has been selected by a ‘unur_empk_set_kernel’ call. + + Notice that the uniform random number generator of the kernel + generator is overwritten during the ‘unur_init’ call and at each + ‘unur_chg_urng’ call with the uniform generator used for the + empirical distribution. + + Default is the Gaussian kernel. + + -- Function: int unur_empk_set_beta (UNUR_PAR* PARAMETERS, double BETA) + BETA is used to compute the optimal bandwidth from the point of + view of minimizing the mean integrated square error (MISE). BETA + depends on the (unknown) distribution of the sampled data points. + By default Gaussian distribution is assumed for the sample (BETA = + 1.3637439). There is no requirement to change BETA. + + Default: ‘1.3637439’ + + -- Function: int unur_empk_set_smoothing (UNUR_PAR* PARAMETERS, double + SMOOTHING) + -- Function: int unur_empk_chg_smoothing (UNUR_GEN* GENERATOR, double + SMOOTHING) + Set and change the smoothing factor. The smoothing factor + controlles how “smooth” the resulting density estimation will be. + A smoothing factor equal to ‘0’ results in naive resampling. A + very large smoothing factor (together with the variance correction) + results in a density which is approximately equal to the kernel. + Default is 1 which results in a smoothing parameter minimising the + MISE (mean integrated squared error) if the data are not too far + away from normal. If a large smoothing factor is used, then + variance correction must be switched on. + + Default: ‘1’ + + -- Function: int unur_empk_set_varcor (UNUR_PAR* PARAMETERS, int + VARCOR) + -- Function: int unur_empk_chg_varcor (UNUR_GEN* GENERATOR, int VARCOR) + Switch variance correction in generator on/off. If VARCOR is + ‘TRUE’ then the variance of the used density estimation is the same + as the sample variance. However this increases the MISE of the + estimation a little bit. + + Default is ‘FALSE’. + + -- Function: int unur_empk_set_positive (UNUR_PAR* PARAMETERS, int + POSITIVE) + If POSITIVE is ‘TRUE’ then only nonnegative random variates are + generated. This is done by means of a mirroring technique. + + Default is ‘FALSE’. + + +File: unuran.info, Node: EMPL, Next: HIST, Prev: EMPK, Up: Methods_for_CEMP + +5.4.2 EMPL – EMPirical distribution with Linear interpolation +------------------------------------------------------------- + +Required: + observed sample +Speed: + Set-up: slow (as sample is sorted), Sampling: very fast (inversion) +Reinit: + not implemented +Reference: + [HLa00] [HLD04: Sect.12.1.3] + + EMPL generates random variates from an empirical distribution that is +given by an observed sample. This is done by linear interpolation of +the empirical CDF. Although this method is suggested in the books of Law +and Kelton (2000) and Bratly, Fox, and Schrage (1987) we do not +recommend this method at all since it has many theoretical drawbacks: +The variance of empirical distribution function does not coincide with +the variance of the given sample. Moreover, when the sample increases +the empirical density function does not converge to the density of the +underlying random variate. Notice that the range of the generated point +set is always given by the range of the given sample. + + This method is provided in UNU.RAN for the sake of completeness. We +always recommend to use method EMPK (*note EMPirical distribution with +Kernel smoothing: EMPK.). + + If the data seem to be far away from having a bell shaped histogram, +then we think that naive resampling is still better than linear +interpolation. + +How To Use +.......... + +EMPL creates and samples from an empiral distribution by linear +interpolation of the empirical CDF. There are no parameters to set. + +_Important_: We do not recommend to use this method! Use method EMPK +(*note EMPirical distribution with Kernel smoothing: EMPK.) instead. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_empl_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + +File: unuran.info, Node: HIST, Prev: EMPL, Up: Methods_for_CEMP + +5.4.3 HIST – HISTogramm of empirical distribution +------------------------------------------------- + +Required: + histogram +Speed: + Set-up: moderate, Sampling: fast +Reinit: + not implemented + + Method HIST generates random variates from an empirical distribution +that is given as histogram. Sampling is done using the inversion +method. + + If observed (raw) data are provided we recommend method EMPK (*note +EMPirical distribution with Kernel smoothing: EMPK.) instead of compting +a histogram as this reduces information. + +How To Use +.......... + +Method HIST uses empirical distributions that are given as a histgram. +There are no optional parameters. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_hist_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + +File: unuran.info, Node: Methods_for_CVEC, Next: MCMC_Methods_for_CVEC, Prev: Methods_for_CEMP, Up: Methods + +5.5 Methods for continuous multivariate distributions +===================================================== + +* Menu: + +* MVSTD:: MultiVariate continuous STandarD distributions +* MVTDR:: Multi-Variate Transformed Density Rejection +* NORTA:: NORmal To Anything +* VNROU:: Multivariate Naive Ratio-Of-Uniforms method + +Overview of methods +------------------- + +Methods for continuous multivariate distributions +sample with ‘unur_sample_vec’ + +NORTA: Requires rank correlation matrix and marginal distributions. +VNROU: Requires the PDF. +MVSTD: Generator for built-in standard distributions. +MVTDR: Requires PDF and gradiant of PDF. + + +File: unuran.info, Node: MVSTD, Next: MVTDR, Up: Methods_for_CVEC + +5.5.1 MVSTD – MultiVariate continuous STandarD distributions +------------------------------------------------------------ + +Required: + standard distribution from UNU.RAN library (*note Standard + distributions: Stddist.). +Speed: + depends on distribution and generator +Reinit: + supported + + MVSTD is a wrapper for special generators for multivariate continuous +standard distributions. It only works for distributions in the UNU.RAN +library of standard distributions (*note Standard distributions: +Stddist.). If a distribution object is provided that is build from +scratch, or if no special generator for the given standard distribution +is provided, the ‘NULL’ pointer is returned. + +How To Use +.......... + +Create a distribution object for a standard distribution from the +UNU.RAN library (*note Standard distributions: Stddist.). + + Sampling from truncated distributions (which can be constructed by +changing the default domain of a distribution by means of +‘unur_distr_cvec_set_domain_rect’ call) is not possible. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_mvstd_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for new generator. It requires a + distribution object for a multivariate continuous distribution from + the UNU.RAN library of standard distributions (*note Standard + distributions: Stddist.). Using a truncated distribution is not + possible. + + +File: unuran.info, Node: MVTDR, Next: NORTA, Prev: MVSTD, Up: Methods_for_CVEC + +5.5.2 MVTDR – Multi-Variate Transformed Density Rejection +--------------------------------------------------------- + +Required: + log-concave (log)PDF, gradient of (log)PDF +Optional: + mode +Speed: + Set-up: slow, Sampling: depends on dimension +Reinit: + not implemented +Reference: + [HLD04: Sect.11.3.4; Alg.11.15.] [LJa98] + + MVTDR a multivariate version of the Transformed Density Rection +(*note TDR::) that works for log-concave densities. For this method the +domain of the distribution is partitioned into cones with the mode (or +the center) of the distribution as their (common) vertex. The hat +function is then constructed as tangent planes of the transformed +density in each of these cones. The respective construction points lie +on the central lines in the cones through the vertex. The point is +chosen such that the hat is minimal among all such points (see the given +references for more details). + + The cones are created by starting with the orthants of the reals +space. These are then iteratively split when the volume below the hat +in such cones is too large. Thus an increasing number of cones results +in a better fitting hat function. Notice however, that the required +number of cones increases exponentially with the number of dimension. +Moreover, due to the construction the rejection does not converge to 1 +and remains strictly larger than 1. + + For distributions with bounded domains the cones are cut to pyramids +that cover the domain. + +How To Use +.......... + +Create a multivariate generator object that contains the PDF and its +gradient. This object also should contain the mode of the distribution +(or a point nearby should be provided as center of the distribution). + + The method has three parameter to adjust the method for the given +distribution: + +‘stepsmin’ + Minimal number of iterations for splitting cones. Notice that we + start with 2^dim initial cones and that we arrive at + 2^(dim+stepsmin) cones after these splits. So this number must be + set with care. It can be set by a ‘unur_mvtdr_set_stepsmin’ call. + +‘boundsplitting’ + Cones where the volume below the hat is relatively large (i.e. + larger than the average volume over all cones times + ‘boundsplitting’ are further split. This parameter can set via a + ‘unur_mvtdr_set_boundsplitting’ call. + +‘maxcones’ + The maximum number of generated cones. When this number is + reached, the initialization routine is stopped. Notice that the + rejection constant can be still prohibitive large. This parameter + can set via a ‘unur_mvtdr_set_maxcones’ call. + + Setting of these parameter can be quite tricky. The default settings +lead to hat functions where the volume below the hat is similar in each +cone. However, there might be some problems with distributions with +higher correlations, since then too few cones are created. Then it +might be necessary to increase the values for ‘stepsmin’ and ‘maxcones’ +and to set ‘boundsplitting’ to ‘0’. + + The number of cones and the total volume below the hat can be +controlled using the respective calls ‘unur_mvtdr_get_ncones’ and +‘unur_mvtdr_get_hatvol’. Notice, that the rejection constant is bounded +from below by some figure (larger than 1) that depends on the dimension. + + Unfortunately, the algorithm cannot detect the quality of the +constructed hat. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_mvtdr_new (const UNUR_DISTR* DISTRIBUTION) + Get parameters for generator. + + -- Function: int unur_mvtdr_set_stepsmin (UNUR_PAR* PARAMETERS, int + STEPSMIN) + Set minimum number of triangulation step for each starting cone. + STEPSMIN must be nonnegative. + + Default: ‘5’. + + -- Function: int unur_mvtdr_set_boundsplitting (UNUR_PAR* PARAMETERS, + double BOUNDSPLITTING) + Set bound for splitting cones. All cones are split which have a + volume below the hat that is greater than BOUND_SPLITTING times the + average over all volumes. However, the number given by the + ‘unur_mvtdr_set_maxcones’ is not exceeded. Notice that the later + number is always reached if BOUND_SPLITTING is less than 1. + + Default: ‘1.5’ + + -- Function: int unur_mvtdr_set_maxcones (UNUR_PAR* PARAMETERS, int + MAXCONES) + Set maximum number of cones. + + Notice that this number is always increased to 2^(dim+stepsmin) + where dim is the dimension of the distribution object and stepsmin + the given mimimum number of triangulation steps. + + Notice: For higher dimensions and/or higher correlations between + the coordinates of the random vector the required number of cones + can be very high. A too small maximum number of cones can lead to + a very high rejection constant. + + Default: ‘10000’. + + -- Function: int unur_mvtdr_get_ncones (const UNUR_GEN* GENERATOR) + Get the number of cones used for the hat function of the GENERATOR. + (In case of an error ‘0’ is returned.) + + -- Function: double unur_mvtdr_get_hatvol (const UNUR_GEN* GENERATOR) + Get the volume below the hat for the GENERATOR. (In case of an + error ‘UNUR_INFINITY’ is returned.) + + -- Function: int unur_mvtdr_set_verify (UNUR_PAR* PARAMETERS, int + VERIFY) + -- Function: int unur_mvtdr_chg_verify (UNUR_GEN* GENERATOR, int + VERIFY) + Turn verifying of algorithm while sampling on/off. If the + condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x + then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However + notice that this might happen due to round-off errors for a few + values of x (less than 1%). + + Default is ‘FALSE’. + + +File: unuran.info, Node: NORTA, Next: VNROU, Prev: MVTDR, Up: Methods_for_CVEC + +5.5.3 NORTA – NORmal To Anything +-------------------------------- + +Required: + rank correlation matrix, marginal distributions +Speed: + Set-up: slow, Sampling: depends on dimension +Reinit: + not implemented +Reference: + [HLD04: Sect.12.5.2; Alg.12.11.] + + NORTA (NORmal to anything) is a model to get random vectors with +given marginal distributions and rank correlation. + + *Important:* Notice that marginal distribution and (rank) correlation +structure do not uniquely define a multivariate distribution. Thus +there are many other (more or less sensible) models. + + In the NORTA model multinormal random variates with the given +(Spearman’s) rank correlations are generated. In a second step the +(standard normal distributed) marginal variates are transformed by means +of the CDF of the normal distribution to get uniform marginals. The +resulting random vectors have uniform marginals and the desired rank +correlation between its components. Such a random vector is called +’copula’. + + By means of the inverse CDF the uniform marginals are then +transformed into the target marginal distributions. This transformation +does not change the rank correlation. + + For the generation of the multinormal distribution the (Spearman’s) +rank correlation matrix is transformed into the corresponding (Pearson) +correlation matrix. Samples from the resulting multinormal distribution +are generated by means of the Cholesky decomposition of the covariance +matrix. + + It can happen that the desired rank correlation matrix is not +feasible, i.e., it cannot occur as rank correlation matrix of a +multinormal distribution. The resulting "covariance" matrix is not +positive definite. In this case an eigenvector correction method is +used. Then all non-positive eigenvalues are set to a small positive +value and hence the rank correlation matrix of the generated random +vectors is "close" to the desired matrix. + +How To Use +.......... + +Create a multivariate generator object and set marginal distributions +using ‘unur_distr_cvec_set_marginals’, +‘unur_distr_cvec_set_marginal_array’ , or +‘unur_distr_cvec_set_marginal_list’. (Do not use the corresponding +calls for the standard marginal distributions). + + When the domain of the multivariate distribution is set by of a +‘unur_distr_cvec_set_domain_rect’ call then the domain of each of the +marginal distributions is truncated by the respective coordinates of the +given rectangle. + + If copulae are required (i.e. multivariate distributions with +uniform marginals) such a generator object can be created by means of +‘unur_distr_copula’ . + + There are no optional parameters for this method. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_norta_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + +File: unuran.info, Node: VNROU, Prev: NORTA, Up: Methods_for_CVEC + +5.5.4 VNROU – Multivariate Naive Ratio-Of-Uniforms method +--------------------------------------------------------- + +Required: + PDF +Optional: + mode, center, bounding rectangle for acceptance region +Speed: + Set-up: fast or slow, Sampling: slow +Reinit: + supported +Reference: + [WGS91] + + VNROU is an implementation of the multivariate ratio-of-uniforms +method which uses a (minimal) bounding hyper-rectangle, see also *note +Ratio-of-Uniforms::. It uses an additional parameter r that can be used +for adjusting the algorithm to the given distribution to improve +performance and/or to make this method applicable. Larger values of r +increase the class of distributions for which the method works at the +expense of higher rejection constants. Moreover, this implementation +uses the center mu of the distribution (which is set to the mode or mean +by default, see ‘unur_distr_cvec_get_center’ for details of its default +values). + + The minimal bounding has then the coordinates + v^+ = sup_(x) (f(x))^(1/r d+1), + u^-_i = inf_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), + u^+_i = sup_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), + +where x_i is the i-th coordinate of point x; mu_i is the i-th coordinate +of the center mu. d denotes the dimension of the distribution. These +bounds can either be given directly, or are computed automatically by +means of an numerical routine by Hooke and Jeeves [HJa61] called direct +search (see ‘src/utils/hooke.c’ for further references and details). Of +course this algorithm can fail, especially when this rectangle is not +bounded. + + It is important to note that the algorithm works with PDF(x-center) +instead of PDF(x), i.e. the bounding rectangle has to be provided for +PDF(x-center). This is important as otherwise the acceptance region can +become a very long and skinny ellipsoid along a diagonal of the (huge) +bounding rectangle. + + VNROU is based on the rejection method (*note Rejection::), and it is +important to note that the acceptance probability decreases +exponentially with dimension. Thus even for moderately many dimensions +(e.g. 5) the number of repetitions to get one random vector can be +prohibitively large and the algorithm seems to stay in an infinite loop. + +How To Use +.......... + +For using the VNROU method UNU.RAN needs the PDF of the distribution. +Additionally, the parameter r can be set via a ‘unur_vnrou_set_r’ call. +Notice that the acceptance probability decreases when r is increased. +On the other hand is is more unlikely that the bounding rectangle does +not exist if r is small. + + A bounding rectangle can be given by the ‘unur_vnrou_set_u’ and +‘unur_vnrou_set_v’ calls. + + _Important:_ The bounding rectangle has to be provided for the +function PDF(x-center)! Notice that ‘center’ is the center of the given +distribution, see ‘unur_distr_cvec_set_center’. If in doubt or if this +value is not optimal, it can be changed (overridden) by a +‘unur_distr_cvec_set_center’ call. + + If the coordinates of the bounding rectangle are not provided by the +user then the minimal bounding rectangle is computed automatically. + + By means of ‘unur_vnrou_set_verify’ and ‘unur_vnrou_chg_verify’ one +can run the sampling algorithm in a checking mode, i.e., in every cycle +of the rejection loop it is checked whether the used rectangle indeed +enclosed the acceptance region of the distribution. When in doubt +(e.g., when it is not clear whether the numerical routine has worked +correctly) this can be used to run a small Monte Carlo study. + + *Important:* The rejection constant (i.e. the expected number of +iterations for generationg one random vector) can be extremely high, in +particular when the dimension is 4 or higher. Then the algorithm will +perform almost infinite loops. Thus it is recommended to read the +volume below the hat function by means of the ‘unur_vnrou_get_volumehat’ +call. The returned number divided by the volume below the PDF (which is +1 in case of a normalized PDF) gives the rejection constant. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. +Notice, that the coordinates of a bounding rectangle given by +‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ calls are used also when the +generator is reused. These can be changed by means of +‘unur_vnrou_chg_u’ and ‘unur_vnrou_chg_v’ calls. (If no such +coordinates have been given, then they are computed numerically during +the reinitialization proceedure.) + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_vnrou_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_vnrou_set_u (UNUR_PAR* PARAMETERS, double* UMIN, + double* UMAX) + Sets left and right boundaries of bounding hyper-rectangle. If no + values are given, the boundary of the minimal bounding + hyper-rectangle is computed numerically. + + *Important*: The boundaries are those of the density shifted by the + center of the distribution, i.e., for the function PDF(x-center)! + + _Notice_: Computing the minimal bounding rectangle may fail under + some circumstances. Moreover, for multimodal distributions the + bounds might be too small as only local extrema are computed. + Nevertheless, for log-concave distributions it should work. + + Default: not set (i.e. computed automatically) + + -- Function: int unur_vnrou_chg_u (UNUR_GEN* GENERATOR, double* UMIN, + double* UMAX) + Change left and right boundaries of bounding hyper-rectangle. + + -- Function: int unur_vnrou_set_v (UNUR_PAR* PARAMETERS, double VMAX) + Set upper boundary for bounding hyper-rectangle. If no values are + given, the density at the mode is evaluated. If no mode is given + for the distribution it is computed numerically (and might fail). + + Default: not set (i.e. computed automatically) + + -- Function: int unur_vnrou_chg_v (UNUR_GEN* GENERATOR, double VMAX) + Change upper boundary for bounding hyper-rectangle. + + -- Function: int unur_vnrou_set_r (UNUR_PAR* PARAMETERS, double R) + Sets the parameter R of the generalized multivariate + ratio-of-uniforms method. + + _Notice_: This parameter must satisfy R>0. + + Default: ‘1’. + + -- Function: int unur_vnrou_set_verify (UNUR_PAR* PARAMETERS, int + VERIFY) + Turn verifying of algorithm while sampling on/off. + + If the condition PDF(x) <= hat(x) is violated for some x then + ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However notice + that this might happen due to round-off errors for a few values of + x (less than 1%). + + Default is ‘FALSE’. + + -- Function: int unur_vnrou_chg_verify (UNUR_GEN* GENERATOR, int + VERIFY) + Change the verifying of algorithm while sampling on/off. + + -- Function: double unur_vnrou_get_volumehat (const UNUR_GEN* + GENERATOR) + Get the volume of below the hat. For normalized densities, i.e. + when the volume below PDF is 1, this value equals the rejection + constant for the vnrou method. + + In case of an error UNUR_INFINITY is returned. + + +File: unuran.info, Node: MCMC_Methods_for_CVEC, Next: Methods_for_CVEMP, Prev: Methods_for_CVEC, Up: Methods + +5.6 Markov chain samplers for continuous multivariate distributions +=================================================================== + +* Menu: + +* GIBBS:: Markov Chain - GIBBS sampler +* HITRO:: Markov Chain - HIT-and-run sampler with Ratio-Of-uniforms + +Markov chain samplers generate sequences of random vectors which have +the target distribution as stationary distribution. There generated +vectors are (more or less) correlated and it might take a long time +until the sequence has converged to the given target distribution. + + *Beware: MCMC sampling can be dangerous!* + +Overview of methods +------------------- + +Markov Chain Methods for continuous multivariate distributions +sample with ‘unur_sample_vec’ + +GIBBS: T-concave logPDF and derivatives of logPDF. +HITRO: Requires PDF. + + +File: unuran.info, Node: GIBBS, Next: HITRO, Up: MCMC_Methods_for_CVEC + +5.6.1 GIBBS – Markov Chain - GIBBS sampler +------------------------------------------ + +Required: + T-concave logPDF, derivatives of logPDF +Speed: + Set-up: fast, Sampling: moderate +Reinit: + not implemented +Reference: + [HLD04: Sect.14.1.2] + + Method GIBBS implements a Gibbs sampler for a multivariate +distribution with given joint density and its gradient. When running +such a Markov chain all coordinates are updated cyclically using full +conditional distributions. After each step the state of the chain is +returned (i.e., a random point is returned whenever a single coordinate +has been updated). It is also possible to return only points after all +coordinates have been updated by "thinning" the chain. Moreover, to +reduce autocorrelation this thinning factor can be any integer. Notice, +however, that the sampling time for a chain of given length is increased +by the same factor, too. + + GIBBS also provides a variant of the Gibbs sampler where in each step +a point from the full conditional distribution along some random +direction is sampled. This direction is chosen uniformly from the +sphere in each step. This method is also known as Hit-and-Run algorithm +for non-uniform distributions. + + Our experiences shows that the original Gibbs sampler with sampling +along coordinate axes is superior to random direction sampling as long +as the correlations between the components of the random vector are not +too high. + + For both variants transformed density rejection (see methods *note +TDR:: and *note ARS::) is used to sample from the full conditional +distributions. In opposition to the univariate case, it is important +that the factor ‘c’ is as large as possible. I.e., for a log-concave +density ‘c’ must be set to ‘0.’, since otherwise numerical underflow +might stop the algorithm. + + _Important:_ GIBBS does not generate independent random points. The +starting point of the Gibbs chain must be in a "typical" region of the +target distribution. If such a point is not known or would be too +expensive, then the first part of the chain should be discarded (burn-in +of the chain). + +How To Use +.......... + +For using the GIBBS method UNU.RAN needs the logarithm of the PDF of the +multivariate joint distribution and its gradient or partial derivatives. + + It provides two variants: +_coordinate direction sampling (Gibbs sampling) [default]_ + The coordinates are updated cyclically. It requires the partial + derivatives of the (logarithm of the) PDF of the target + distribution, see ‘unur_distr_cvec_set_pdlogpdf’. Otherwise, the + gradient of the logPDF (see ‘unur_distr_cvec_set_dlogpdf’ ) is + used, which is more expensive. + + This variant can be selected using + ‘unur_gibbs_set_variant_coordinate’. +_random direction sampling (nonuniform Hit-and-Run algorithm)_ + In each step is a direction is sampled uniformly from the sphere + and the next point in the chain is sampled from the full + conditional distribution along this direction. + + It requires the gradient of the logPDF and thus each step is more + expensive than each step for coordinate direction sampling. + + This variant can be selected using + ‘unur_gibbs_set_variant_random_direction’. + + It is important that the ‘c’ parameter for the TDR method is as large +as possible. For logconcave distribution it must be set to ‘0’, since +otherwise numerical underflow can cause the algorithm to stop. + + The starting point of the Gibbs chain must be "typical" for the +target distribution. If such a point is not known or would be too +expensive, then the first part of the chain should be discarded (burn-in +of the chain). When using the ‘unur_gibbs_set_burnin’ call this is done +during the setup of the Gibbs sampler object. + + In case of a fatal error in the generator for conditional +distributions the methods generates points that contain UNUR_INFINITY. + + *Warning:* The algorithm requires that all full conditionals for the +given distribution object are T-concave. However, this property is not +checked. If this property is not satisfied, then generation from the +conditional distributions becomes (very) slow and might fail or (even +worse) produces random vectors from an incorrect distribution. When +using ‘unur_gibbs_set_burnin’ then the setup already might fail. Thus +when in doubt whether GIBBS can be used for the targent distribution it +is a good idea to use a burn-in for checking. + + _Remark:_ It might happen (very rarely) that the chain becomes stuck +due to numerical errors. (This is in particular the case when the given +PDF does not fulfill the condition of this method.) When this happens +during burn-in then the setup is aborted (i.e. it fails). Otherwise +the chain restarts again from its starting point. + + *Warning:* Be carefull with debugging flags. If it contains flag +‘0x01000000u’ it produces a lot of output for each step in the +algorithm. (This flag is switched of in the default debugging flags). + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_gibbs_new (const UNUR_DISTR* DISTRIBUTION) + ........................................................................... + + -- Function: int unur_gibbs_set_variant_coordinate (UNUR_PAR* + PARAMETERS) + Coordinate Direction Sampling: Sampling along the coordinate + directions (cyclic). + + This is the default. + + -- Function: int unur_gibbs_set_variant_random_direction (UNUR_PAR* + PARAMETERS) + Random Direction Sampling: Sampling along the random directions. + + -- Function: int unur_gibbs_set_c (UNUR_PAR* PARAMETERS, double C) + Set parameter C for transformation T of the transformed density + rejection method. Currently only values between ‘0’ and ‘-0.5’ are + allowed. If ‘c’ is between ‘0’ and ‘-0.5’ it is set to ‘-0.5’. + + For C ‘=0’ (for logconcave densities) method ARS (*note ARS::) is + used which is very robust against badly normalized PDFs. For other + values method TDR (*note TDR::) is used. + + The value for C should be as large as possible to avoid fatal + numerical underflows. Thus for log-concave distributions C must be + set to ‘0.’ + + Default is ‘0’. + + -- Function: int unur_gibbs_set_startingpoint (UNUR_PAR* PARAMETERS, + const DOUBLE* X0) + Sets the starting point of the Gibbs sampler. X0 must be a + "typical" point of the given distribution. If such a "typical" + point is not known and a starting point is merely guessed, the + first part of the Gibbs chain should be discarded (_burn-in_), + e.g.\ by mean of the ‘unur_gibbs_set_burnin’ call. + + Default is the result of ‘unur_distr_cvec_get_center’ for the given + distribution object. + + -- Function: int unur_gibbs_set_thinning (UNUR_PAR* PARAMETERS, int + THINNING) + Sets the THINNING parameter. When THINNING is set to k then every + k-th point from the iteration is returned by the sampling + algorithm. + + _Notice_: This parameter must satisfy THINNING>=1. + + Default: ‘1’. + + -- Function: int unur_gibbs_set_burnin (UNUR_PAR* PARAMETERS, int + BURNIN) + If a "typical" point for the target distribution is not known but + merely guessed, the first part of the Gibbs chain should be + discarded (_burn-in_). This can be done during the initialization + of the generator object. The length of the burn-in can is then + BURNIN. + + When method GIBBS is not applicable for the target distribution + then the initialization already might fail during the burn-in. + Thus this reduces the risk of running a generator that returns + UNUR_INFINITY cased by some fatal error during sampling. + + The thinning factor set by a ‘unur_gibbs_set_thinning’ call has no + effect on the length of the burn-in, i.e., for the burn-in always a + thinning factor ‘1’ is used. + + _Notice_: This parameter must satisfy THINNING>=0. + + Default: ‘0’. + + -- Function: const double* unur_gibbs_get_state (UNUR_GEN* GENERATOR) + -- Function: int unur_gibbs_chg_state (UNUR_GEN* GENERATOR, const + DOUBLE* STATE) + Get and change the current state of the Gibbs chain. + + -- Function: int unur_gibbs_reset_state (UNUR_GEN* GENERATOR) + Reset state of chain to starting point. + + _Notice:_ Currently this function does not reset the generators for + conditional distributions. Thus it is not possible to get the same + Gibbs chain even when the underlying uniform random number + generator is reset. + + +File: unuran.info, Node: HITRO, Prev: GIBBS, Up: MCMC_Methods_for_CVEC + +5.6.2 HITRO – Markov Chain - HIT-and-run sampler with Ratio-Of-uniforms +----------------------------------------------------------------------- + +Required: + PDF +Optional: + mode, center, bounding rectangle for acceptance region +Speed: + Set-up: fast, Sampling: fast +Reinit: + not implemented +Reference: + [KLPa05] + + HITRO is an implementation of a hit-and-run sampler that runs on the +acceptance region of the multivariate ratio-of-uniforms method, see +*note Ratio-of-Uniforms::. + + The Ratio-of-Uniforms transforms the region below the density into +some region that we call "region of acceptance" in the following. The +minimal bounding hyperrectangle of this region is given by + v^+ = sup_(x) (f(x))^(1/r d+1), + u^-_i = inf_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), + u^+_i = sup_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), + +where d denotes the dimension of the distribution; x_i is the i-th +coordinate of point x; mu_i is the i-th coordinate of the center mu of +the distribution, i.e., a point in the "main region" of the +distribution. Using the center is important, since otherwise the +acceptance region can become a very long and skinny ellipsoid along a +diagonal of the (huge) bounding rectangle. + + For each step of the Hit-and-Run algorithm we have to choose some +direction. This direction together with the current point of the chain +determines a straight line. Then a point is sampled uniformly on +intersection of this line and the region of acceptance. This is done by +rejection from a uniform distribution on a line segment that covers it. +Depending of the chosen variant the endpoints of this covering line are +computed either by means of a (not necessary minimal) bounding +hyper-rectangle, or just the "covering plate" of the bounding +hyper-rectangle. + + The required bounds of the hyper-rectable can be given directly by +the user. Otherwise, these are computed automatically by means of a +numerical routine by Hooke and Jeeves [HJa61] called direct search (see +‘src/utils/hooke.c’ for further references and details). However, this +expensive computation can be avoided by determine these bounds "on the +fly" by the following adaptive algorithm: Start with some (small) +hyper-rectangle and enlarge it whenever the endpoints of the covering +line segment are not contained in the acceptance region of the +Ratio-of-Unfiorms method. This approach works reliable as long as the +region of acceptance is convex. + + The performance of the uniform sampling from the line segment is much +improved if the covering line is adjusted (shortened) whenever a point +is rejected (adaptive sampling). This technique reduces the expected +number of iterations enormously. + + Method HITRO requires that the region of acceptance of the +Ratio-of-Uniforms method is bounded. The shape of this region can be +controlled by a parameter r. Higher values of r result in larger +classes of distributions with bounded region of acceptance. (A +distribution that has such a bounded region for some r also has a +bounded region for every r’ greater than r.) On the other hand the +acceptance probability decreases with increasing r. Moreover, round-off +errors are more likely and (for large values of r) might result in a +chain with a stationary distribution different from the target +distribution. + + Method HITRO works optimal for distributions whose region of +acceptance is convex. This is in particular the case for all +log-concave distributions when we set r = ‘1’. For bounded but +non-convex regions of acceptance convergence is yet not guarenteed by +mathematical theory. + +How To Use +.......... + +Method HITRO requires the PDF of the target distribution (derivatives +are not necessary). + + The acceptance region of the Ratio-of-Uniforms transformation must be +bounded. Its shape is controlled by parameter r. By default this +parameter is set to ‘1’ as this guarentees a convex region of acceptance +when the PDF of the given distribution is log-concave. It should only +be set to a different (higher!) value using ‘unur_vnrou_set_r’ if +otherwise x_i (f(x))^(r/r d+1) were not bounded for each coordinate. + + There are two variants of the HITRO sampler: +_coordinate direction sampling. [default]_ + The coordinates are updated cyclically. This can be seen as a + Gibbs sampler running on the acceptance region of the + Ratio-of-Uniforms method. This variant can be selected using + ‘unur_hitro_set_variant_coordinate’. +_random direction sampling._ + In each step is a direction is sampled uniformly from the sphere. + + This variant can be selected using + ‘unur_hitro_set_variant_random_direction’. + + Notice that each iteration of the coordinate direction sampler is +cheaper than an iteration of the random direction sampler. + + Sampling uniformly from the line segment can be adjusted in several +ways: + +_Adaptive line sampling vs. simple rejection._ + When adaptive line sampling is switched on, the covering line is + shortened whenever a point is rejected. However, when the region + of acceptance is not convex the line segment from which we have to + sample might not be connected. We found that the algorithm still + works but at the time being there is no formal proof that the + generated Markov chain has the required stationary distribution. + + Adaptive line sampling can switch on/off by means of the + ‘unur_hitro_set_use_adaptiveline’ call. + +_Bounding hyper-rectangle vs. "covering plate"._ + For computing the covering line we can use the bounding + hyper-rectangle or just its upper bound. The latter saves + computing time during the setup and when computing the covering + during at each iteration step at the expense of a longer covering + line. When adaptive line sampling is used the total generation + time for the entire chain is shorter when only the "covering plate" + is used. + + _Notice:_ When coordinate sampling is used the entire bounding + rectangle is used. + + Using the entire bounding hyper-rectangle can be switched on/off by + means of the ‘unur_hitro_set_use_boundingrectangle’ call. + +_Deterministic vs. adaptive bounding hyper-rectangle._ + A bounding rectangle can be given by the ‘unur_vnrou_set_u’ and + ‘unur_vnrou_set_v’ calls. Otherwise, the minimal bounding + rectangle is computed automatically during the setup by means of a + numerical algorithm. However, this is (very) slow especially in + higher dimensions and it might happen that this algorithm (like any + other numerical algorithm) does not return a correct result. + + Alternatively the bounding rectangle can be computed adaptively. + In the latter case ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ can be + used to provide a starting rectangle which must be sufficiently + small. Then both endpoints of the covering line segment are always + check whether they are outside the acceptance region of the + Ratio-of-Uniforms method. If they are not, then the line segment + and the ("bounding") rectangle are enlarged using a factor that can + be given using the ‘unur_hitro_set_adaptive_multiplier’ call. + + Notice, that running this method in the adaptive rectangle mode + requires that the region of acceptance is convex when random + directions are used, or the given PDF is unimodal when coordinate + direction sampling is used. Moreover, it requires two additional + calls to the PDF in each iteration step of the chain. + + Using addaptive bounding rectangles can be switched on/off by means + of the ‘unur_hitro_set_use_adaptiverectangle’ call. + + The algorithm takes of a bounded rectangular domain given by a +‘unur_distr_cvec_set_domain_rect’ call, i.e. the PDF is set to zero for +every x outside the given domain. However, it is only the coordinate +direction sampler where the boundary values are directly used to get the +endpoins of the coverline line for the line sampling step. + + _Important:_ The bounding rectangle has to be provided for the +function PDF(x-center)! Notice that ‘center’ is the center of the given +distribution, see ‘unur_distr_cvec_set_center’. If in doubt or if this +value is not optimal, it can be changed (overridden) by a +‘unur_distr_cvec_set_center’ call. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_hitro_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_hitro_set_variant_coordinate (UNUR_PAR* + PARAMETERS) + Coordinate Direction Sampling: Sampling along the coordinate + directions (cyclic). + + _Notice:_ For this variant the entire bounding rectangle is always + used independent of the ‘unur_hitro_set_use_boundingrectangle’ + call. + + This is the default. + + -- Function: int unur_hitro_set_variant_random_direction (UNUR_PAR* + PARAMETERS) + Random Direction Sampling: Sampling along the random directions. + + -- Function: int unur_hitro_set_use_adaptiveline (UNUR_PAR* PARAMETERS, + int ADAPTIVE) + When ADAPTIVE is set to ‘TRUE’ adaptive line sampling is applied, + otherwise simple rejection is used. + + _Notice:_ When adaptive line sampling is switched off, the entire + bounding rectangle must be used since otherwise the sampling time + can be arbitrarily slow. + + _Warning:_ When adaptive line sampling is switched off, sampling + can be arbitrarily slow. In particular this happens when random + direction sampling is used for distributions with rectangular + domains. Then the algorithm can be trapped into a vertex (or even + edge). + + Default is ‘TRUE’. + + -- Function: int unur_hitro_set_use_boundingrectangle (UNUR_PAR* + PARAMETERS, int RECTANGLE) + When RECTANGLE is set to ‘TRUE’ the entire bounding rectangle is + used for computing the covering line. Otherwise, only an upper + bound for the acceptance region is used. + + _Notice:_ When coordinate sampling is used the entire bounding + rectangle has is always used and this call has no effect. + + Default: ‘FALSE’ for random direction samplig, ‘TRUE’ for + coordinate direction sampling. + + -- Function: int unur_hitro_set_use_adaptiverectangle (UNUR_PAR* + PARAMETERS, int ADAPTIVE) + When ADAPTIVE is set to ‘FALSE’ the bounding rectangle is + determined during the setup. Either, it is computed automatically + by a (slow) numerical method, or it must be provided by + ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ calls. + + If ADAPTIVE is set to ‘TRUE’ the bounding rectangle is computed + adaptively. In this case the ‘unur_vnrou_set_u’ and + ‘unur_vnrou_set_v’ calls can be used to provide a starting + rectangle. This should be sufficiently small. If not given then + we assume v_(max) = 1, u_(min)=(-0.001,-0.001,...,-0.001), and + u_(max)=(0.001,0.001,...,0.001). Adaptive enlargements of the + bounding hyperrectangle can be controlled set setting an + enlargement factor given by a ‘unur_hitro_set_adaptive_multiplier’ + call. + + Using adaptive computation of the bounding rectangle reduces the + setup time significantly (when it is not given by the user) at the + expense of two additional PDF evaluations during each iteration + step. + + _Important:_ Using adaptive bounding rectangles requires that the + region of acceptance is convex when random directions are used, or + a unimodal PDF when coordinate direction sampling is used. + + Default: ‘FALSE’ for random direction samplig, ‘TRUE’ for + coordinate direction sampling. + + -- Function: int unur_hitro_set_r (UNUR_PAR* PARAMETERS, double R) + Sets the parameter R of the generalized multivariate + ratio-of-uniforms method. + + _Notice_: This parameter must satisfy R>0. + + Default: ‘1’. + + -- Function: int unur_hitro_set_v (UNUR_PAR* PARAMETERS, double VMAX) + Set upper boundary for bounding hyper-rectangle. If not set not + set the mode of the distribution is used. + + If adaptive bounding rectangles the value is used for the starting + rectangle. If not given (and the mode of the distribution is not + known) then VMAX=‘1e-3’ is used. + + If deterministic bounding rectangles these values are the given + values are used for the rectangle. If no value is given (and the + mode of the distribution is not known), the upper bound of the + minimal bounding hyper-rectangle is computed numerically (slow). + + Default: not set. + + -- Function: int unur_hitro_set_u (UNUR_PAR* PARAMETERS, const DOUBLE* + UMIN, const DOUBLE* UMAX) + Sets left and right boundaries of bounding hyper-rectangle. + + If adaptive bounding rectangles these values are used for the + starting rectangle. If not given then UMIN=‘{-b,-b,...,-b}’ and + UMAX=‘{b,b,...,b}’ with ‘b=1.e-3’ is used. + + If deterministic bounding rectangles these values are the given + values are used for the rectangle. If no values are given, the + boundary of the minimal bounding hyper-rectangle is computed + numerically (slow). + + *Important*: The boundaries are those of the density shifted by the + center of the distribution, i.e., for the function PDF(x-center)! + + _Notice_: Computing the minimal bounding rectangle may fail under + some circumstances. Moreover, for multimodal distributions the + bounds might be too small as only local extrema are computed. + Nevertheless, for log-concave distributions it should work. + + Default: not set. + + -- Function: int unur_hitro_set_adaptive_multiplier (UNUR_PAR* + PARAMETERS, double FACTOR) + Adaptive enlargements of the bounding hyperrectangle can be + controlled set setting the enlargement FACTOR. This must be + greater than 1. Values close to 1 result in small adaptive steps + and thus reduce the risk of too large bounding rectangles. On the + other hand many adaptive steps might be necessary. + + _Notice:_ For practical reasons this call does not accept values + for FACTOR less than ‘1.0001’. If this value is UNUR_INFINITY this + results in infinite loops. + + Default: ‘1.1’ + + -- Function: int unur_hitro_set_startingpoint (UNUR_PAR* PARAMETERS, + const DOUBLE* X0) + Sets the starting point of the HITRO sampler in the original scale. + X0 must be a "typical" point of the given distribution. If such a + "typical" point is not known and a starting point is merely + guessed, the first part of the HITRO chain should be discarded + (_burn-in_), e.g.\ by mean of the ‘unur_hitro_set_burnin’ call. + + _Important:_ The PDF of the distribution must not vanish at the + given point X0. + + Default is the result of ‘unur_distr_cvec_get_center’ for the given + distribution object. + + -- Function: int unur_hitro_set_thinning (UNUR_PAR* PARAMETERS, int + THINNING) + Sets the THINNING parameter. When THINNING is set to k then every + k-th point from the iteration is returned by the sampling + algorithm. If thinning has to be set such that each coordinate is + updated when using coordinate direction sampling, then THINNING + should be ‘dim+1’ (or any multiple of it) where ‘dim’ is the + dimension of the distribution object. + + _Notice_: This parameter must satisfy THINNING>=1. + + Default: ‘1’. + + -- Function: int unur_hitro_set_burnin (UNUR_PAR* PARAMETERS, int + BURNIN) + If a "typical" point for the target distribution is not known but + merely guessed, the first part of the HITRO chain should be + discarded (_burn-in_). This can be done during the initialization + of the generator object. The length of the burn-in can is then + BURNIN. + + The thinning factor set by a ‘unur_hitro_set_thinning’ call has no + effect on the length of the burn-in, i.e., for the burn-in always a + thinning factor ‘1’ is used. + + _Notice_: This parameter must satisfy THINNING>=0. + + Default: ‘0’. + + -- Function: const double* unur_hitro_get_state (UNUR_GEN* GENERATOR) + -- Function: int unur_hitro_chg_state (UNUR_GEN* GENERATOR, const + DOUBLE* STATE) + Get and change the current state of the HITRO chain. + + _Notice:_ The state variable contains the point in the ‘dim+1’ + dimensional point in the (tansformed) region of acceptance of the + Ratio-of-Uniforms method. Its coordinate are stored in the + following order: ‘state[] = {v, u1, u2, ..., udim}’. + + If the state can only be changed if the given STATE is inside this + region. + + -- Function: int unur_hitro_reset_state (UNUR_GEN* GENERATOR) + Reset state of chain to starting point. + + _Notice:_ Currently this function does not reset the generators for + conditional distributions. Thus it is not possible to get the same + HITRO chain even when the underlying uniform random number + generator is reset. + + +File: unuran.info, Node: Methods_for_CVEMP, Next: Methods_for_DISCR, Prev: MCMC_Methods_for_CVEC, Up: Methods + +5.7 Methods for continuous empirical multivariate distributions +=============================================================== + +* Menu: + +* VEMPK:: (Vector) EMPirical distribution with Kernel smoothing + +Overview of methods +------------------- + +Methods for continuous empirical multivariate distributions +sample with ‘unur_sample_vec’ + +VEMPK: Requires an observed sample. + +Example +------- + + /* ------------------------------------------------------------- */ + /* File: example_vemp.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* Example how to sample from an empirial continuous */ + /* multivariate distribution. */ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; + + /* 4 data points of dimension 2 */ + double data[] = { 1. ,1., /* 1st data point */ + -1.,1., /* 2nd data point */ + 1.,-1., /* 3rd data point */ + -1.,-1. }; /* 4th data point */ + + double result[2]; + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create a distribution object with dimension 2. */ + distr = unur_distr_cvemp_new( 2 ); + + /* Set empirical sample. */ + unur_distr_cvemp_set_data(distr, data, 4); + + /* Choose a method: VEMPK. */ + par = unur_vempk_new(distr); + + /* Use variance correction. */ + unur_vempk_set_varcor( par, 1 ); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + unur_sample_vec(gen, result); + printf("(%f,%f)\n", result[0], result[1]); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + +Example (String API) +-------------------- + +(not implemented) + + +File: unuran.info, Node: VEMPK, Up: Methods_for_CVEMP + +5.7.1 VEMPK – (Vector) EMPirical distribution with Kernel smoothing +------------------------------------------------------------------- + +Required: + observed sample +Speed: + Set-up: slow, Sampling: slow (depends on dimension) +Reinit: + not implemented +Reference: + [HLa00] [HLD04: Sect.12.2.1] + + VEMPK generates random variates from a multivariate empirical +distribution that is given by an observed sample. The idea is that +simply choosing a random point from the sample and to return it with +some added noise results in a method that has very nice properties, as +it can be seen as sampling from a kernel density estimate. Clearly we +have to decide about the density of the noise (called kernel) and about +the covariance matrix of the noise. The mathematical theory of kernel +density estimation shows us that we are comparatively free in choosing +the kernel. It also supplies us with a simple formula to compute the +optimal standarddeviation of the noise, called bandwidth (or window +width) of the kernel. + + Currently only a Gaussian kernel with the same covariance matrix as +the given sample is implemented. However it is possible to choose +between a variance corrected version or those with optimal MISE. +Additionally a smoothing factor can be set to adjust the estimated +density to non-bell-shaped data densities. + +How To Use +.......... + +VEMPK uses empirical distributions. The main parameter would be the +choice if of kernel density. However, currently only Gaussian kernels +are supported. The parameters for the density are computed by a simple +but robust method. However, it is possible to control its behavior by +changing the smoothing factor. Additionally, variance correction can be +swithed on (at the price of suboptimal MISE). + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_vempk_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_vempk_set_smoothing (UNUR_PAR* PARAMETERS, double + SMOOTHING) + -- Function: int unur_vempk_chg_smoothing (UNUR_GEN* GENERATOR, double + SMOOTHING) + Set and change the smoothing factor. The smoothing factor + controlles how “smooth” the resulting density estimation will be. + A smoothing factor equal to 0 results in naive resampling. A very + large smoothing factor (together with the variance correction) + results in a density which is approximately equal to the kernel. + Default is 1 which results in a smoothing parameter minimising the + MISE (mean integrated squared error) if the data are not too far + away from normal. If a large smoothing factor is used, then + variance correction must be switched on. + + Default: ‘1’ + + -- Function: int unur_vempk_set_varcor (UNUR_PAR* PARAMETERS, int + VARCOR) + -- Function: int unur_vempk_chg_varcor (UNUR_GEN* GENERATOR, int + VARCOR) + Switch variance correction in generator on/off. If VARCOR is + ‘TRUE’ then the variance of the used density estimation is the same + as the sample variance. However this increases the MISE of the + estimation a little bit. + + Default is ‘FALSE’. + + +File: unuran.info, Node: Methods_for_DISCR, Next: Methods_for_MATR, Prev: Methods_for_CVEMP, Up: Methods + +5.8 Methods for discrete univariate distributions +================================================= + +* Menu: + +* DARI:: Discrete Automatic Rejection Inversion +* DAU:: (Discrete) Alias-Urn method +* DEXT:: wrapper for Discrete EXTernal generators +* DGT:: (Discrete) Guide Table method (indexed search) +* DSROU:: Discrete Simple Ratio-Of-Uniforms method +* DSS:: (Discrete) Sequential Search method +* DSTD:: Discrete STandarD distributions + +Overview of methods +------------------- + +Methods for discrete univariate distributions +sample with ‘unur_sample_discr’ + +method PMF PV mode sum other +DARI x x ~ T-concave +DAU [x] x +DEXT wrapper for external generator +DGT [x] x +DSROU x x x T-concave +DSS [x] x x +DSTD build-in standard distribution + +Example +------- + + /* ------------------------------------------------------------- */ + /* File: example_discr.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* Example how to sample from a discrete univariate distribution.*/ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; + double param = 0.3; + + double probvec[10] = {1.0, 2.0, 3.0, 4.0, 5.0,\ + 6.0, 7.0, 8.0, 4.0, 3.0}; + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr1, *distr2; /* distribution objects */ + UNUR_PAR *par1, *par2; /* parameter objects */ + UNUR_GEN *gen1, *gen2; /* generator objects */ + + /* First distribution: defined by PMF. */ + distr1 = unur_distr_geometric(¶m, 1); + unur_distr_discr_set_mode(distr1, 0); + + /* Choose a method: DARI. */ + par1 = unur_dari_new(distr1); + gen1 = unur_init(par1); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen1 == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Second distribution: defined by (finite) PV. */ + distr2 = unur_distr_discr_new(); + unur_distr_discr_set_pv(distr2, probvec, 10); + + /* Choose a method: DGT. */ + par2 = unur_dgt_new(distr2); + gen2 = unur_init(par2); + if (gen2 == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* print some random integers */ + for (i=0; i<10; i++){ + printf("number %d: %d\n", i*2, unur_sample_discr(gen1) ); + printf("number %d: %d\n", i*2+1, unur_sample_discr(gen2) ); + } + + /* Destroy all objects. */ + unur_distr_free(distr1); + unur_distr_free(distr2); + unur_free(gen1); + unur_free(gen2); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + +Example (String API) +-------------------- + + /* ------------------------------------------------------------- */ + /* File: example_discr_str.c */ + /* ------------------------------------------------------------- */ + /* String API. */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* Example how to sample from a discrete univariate distribution.*/ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + + /* Declare UNURAN generator objects. */ + UNUR_GEN *gen1, *gen2; /* generator objects */ + + + /* First distribution: defined by PMF. */ + gen1 = unur_str2gen("geometric(0.3); mode=0 & method=dari"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen1 == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Second distribution: defined by (finite) PV. */ + gen2 = unur_str2gen( + "distr=discr; pv=(1,2,3,4,5,6,7,8,4,3) & method=dgt"); + if (gen2 == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* print some random integers */ + for (i=0; i<10; i++){ + printf("number %d: %d\n", i*2, unur_sample_discr(gen1) ); + printf("number %d: %d\n", i*2+1, unur_sample_discr(gen2) ); + } + + /* Destroy all objects. */ + unur_free(gen1); + unur_free(gen2); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + +File: unuran.info, Node: DARI, Next: DAU, Up: Methods_for_DISCR + +5.8.1 DARI – Discrete Automatic Rejection Inversion +--------------------------------------------------- + +Required: + T-concave PMF, mode, approximate area +Speed: + Set-up: moderate, Sampling: fast +Reinit: + supported +Reference: + [HDa96] [HLD04: Sect.10.2; Alg.10.4] + + DARI is based on rejection inversion, which can be seen as an +adaptation of transformed density rejection to discrete distributions. +The used transformation is -1/sqrt(x) . + + DARI uses three almost optimal points for constructing the +(continuous) hat. Rejection is then done in horizontal direction. +Rejection inversion uses only one uniform random variate per trial. + + DARI has moderate set-up times (the PMF is evaluated nine times), and +good marginal speed, especially if an auxiliary array is used to store +values during generation. + + DARI works for all T_(-1/2) -concave distributions. It requires the +PMF and the location of the mode. Moreover the approximate sum over the +PMF is used. (If no sum is given for the distribution the algorithm +assumes that it is approximately 1.) The rejection constant is bounded +from above by 4 for all T-concave distributions. + +How To Use +.......... + +DARI works for discrete distribution object with given PMF. The sum over +probabilities should be approximately one. Otherwise it must be set by +a ‘unur_distr_discr_set_pmfsum’ call to its (approximate) value. + + The size of an auxiliary table can be set by +‘unur_dari_set_tablesize’. The expected number of evaluations can be +reduced by switching the use of squeezes by means of +‘unur_dari_set_squeeze’. It is possible to change the parameters and +the domain of the chosen distribution and run ‘unur_reinit’ to +reinitialize the generator object. Notice, that derived parameters like +the mode must also be (re-) set if the parameters or the domain has be +changed. + + There exists a test mode that verifies whether the conditions for the +method are satisfied or not. It can be switched on by calling +‘unur_dari_set_verify’ and ‘unur_dari_chg_verify’, respectively. Notice +however that sampling is (much) slower then. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_dari_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_dari_set_squeeze (UNUR_PAR* PARAMETERS, int + SQUEEZE) + Turn utilization of the squeeze of the algorithm on/off. This + squeeze does not resamble the squeeze of the continuous TDR method. + It was especially designed for rejection inversion. + + The squeeze is not necessary if the size of the auxiliary table is + big enough (for the given distribution). Using a squeeze is + suggested to speed up the algorithm if the domain of the + distribution is very big or if only small samples are produced. + + Default: no squeeze. + + -- Function: int unur_dari_set_tablesize (UNUR_PAR* PARAMETERS, int + SIZE) + Set the size for the auxiliary table, that stores constants + computed during generation. If SIZE is set to ‘0’ no table is + used. The speed-up can be impressive if the PMF is expensive to + evaluate and the “main part of the distribution” is concentrated in + an interval shorter than the size of the table. + + Default is ‘100’. + + -- Function: int unur_dari_set_cpfactor (UNUR_PAR* PARAMETERS, double + CP_FACTOR) + Set factor for position of the left and right construction point, + resp. The CP_FACTOR is used to find almost optimal construction + points for the hat function. The CP_FACTOR must be positive and + should not exceed 2. There is no need to change this factor in + almost all situations. + + Default is ‘0.664’. + + -- Function: int unur_dari_set_verify (UNUR_PAR* PARAMETERS, int + VERIFY) + -- Function: int unur_dari_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the + condition is violated for some x then ‘unur_errno’ is set to + ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen + due to round-off errors for a few values of x (less than 1%). + + Default is ‘FALSE’. + + +File: unuran.info, Node: DAU, Next: DEXT, Prev: DARI, Up: Methods_for_DISCR + +5.8.2 DAU – (Discrete) Alias-Urn method +--------------------------------------- + +Required: + probability vector (PV) +Speed: + Set-up: slow (linear with the vector-length), Sampling: very fast +Reinit: + supported +Reference: + [WAa77] [HLD04: Sect.3.2] + + DAU samples from distributions with arbitrary but finite probability +vectors (PV) of length N. The algorithmus is based on an ingeneous +method by A.J. Walker and requires a table of size (at least) N. It +needs one random numbers and only one comparison for each generated +random variate. The setup time for constructing the tables is O(N). + + By default the probability vector is indexed starting at ‘0’. +However this can be changed in the distribution object by a +‘unur_distr_discr_set_domain’ call. + + The method also works when no probability vector but a PMF is given. +However then additionally a bounded (not too large) domain must be given +or the sum over the PMF (see ‘unur_distr_discr_make_pv’ for details). + +How To Use +.......... + +Create an object for a discrete distribution either by setting a +probability vector or a PMF. The performance can be slightly influenced +by setting the size of the used table which can be changed by +‘unur_dau_set_urnfactor’. It is possible to change the parameters and +the domain of the chosen distribution and run ‘unur_reinit’ to +reinitialize the generator object. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_dau_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_dau_set_urnfactor (UNUR_PAR* PARAMETERS, double + FACTOR) + Set size of urn table relative to length of the probability vector. + It must not be less than 1. Larger tables result in (slightly) + faster generation times but require a more expensive setup. + However sizes larger than 2 are not recommended. + + Default is ‘1’. + + +File: unuran.info, Node: DEXT, Next: DGT, Prev: DAU, Up: Methods_for_DISCR + +5.8.3 DEXT – wrapper for Discrete EXTernal generators +----------------------------------------------------- + +Required: + routine for sampling discrete random variates +Speed: + depends on external generator +Reinit: + supported + + Method DEXT is a wrapper for external generators for discrete +univariate distributions. It allows the usage of external random +variate generators within the UNU.RAN framework. + +How To Use +.......... + +The following steps are required to use some external generator within +the UNU.RAN framework (some of these are optional): + + 1. Make an empty generator object using a ‘unur_dext_new’ call. The + argument DISTRIBUTION is optional and can be replaced by ‘NULL’. + However, it is required if you want to pass parameters of the + generated distribution to the external generator or for running + some validation tests provided by UNU.RAN. + + 2. Create an initialization routine of type ‘int (*init)(UNUR_GEN + *gen)’ and plug it into the generator object using the + ‘unur_dext_set_init’ call. Notice that the INIT routine must + return ‘UNUR_SUCCESS’ when it has been executed successfully and + ‘UNUR_FAILURE’ otherwise. It is possible to get the size of and + the pointer to the array of parameters of the underlying + distribution object by the respective calls + ‘unur_dext_get_ndistrparams’ and ‘unur_dext_get_distrparams’. + Parameters for the external generator that are computed in the INIT + routine can be stored in a single array or structure which is + available by the ‘unur_dext_get_params’ call. + + Using an INIT routine is optional and can be omitted. + + 3. Create a sampling routine of type ‘int (*sample)(UNUR_GEN *gen)’ + and plug it into the generator object using the + ‘unur_dext_set_sample’ call. + + Uniform random numbers are provided by the ‘unur_sample_urng’ call. + Do not use your own implementation of a uniform random number + generator directly. If you want to use your own random number + generator we recommend to use the UNU.RAN interface (see *note + Using uniform random number generators: URNG.). + + The array or structure that contains parameters for the external + generator that are computed in the INIT routine are available using + the ‘unur_dext_get_params’ call. + + Using a SAMPLE routine is of course obligatory. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. +The INIT routine is then called again. + + Here is a short example that demonstrates the application of this +method by means of the geometric distribution: + + /* ------------------------------------------------------------- */ + /* File: example_dext.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* This example shows how an external generator for the */ + /* geometric distribution can be used within the UNURAN */ + /* framework. */ + /* */ + /* Notice, that this example does not provide the simplest */ + /* solution. */ + + /* ------------------------------------------------------------- */ + /* Initialization routine. */ + /* */ + /* Here we simply read the parameter of the geometric */ + /* distribution and store it in an array for parameters of */ + /* the external generator. */ + /* [ Of course we could do this in the sampling routine as */ + /* and avoid the necessity of this initialization routine. ] */ + + int geometric_init (UNUR_GEN *gen) + { + /* Get pointer to parameters of geometric distribution */ + double *params = unur_dext_get_distrparams(gen); + + /* The parameter is the first entry (see manual) */ + double p = params[0]; + + /* Get array to store this parameter for external generator */ + double *genpar = unur_dext_get_params(gen, sizeof(double)); + genpar[0] = p; + + /* Executed successfully */ + return UNUR_SUCCESS; + } + + /* ------------------------------------------------------------- */ + /* Sampling routine. */ + /* */ + /* Contains the code for the external generator. */ + + int geometric_sample (UNUR_GEN *gen) + { + /* Get scale parameter */ + double *genpar = unur_dext_get_params(gen,0); + double p = genpar[0]; + + /* Sample a uniformly distributed random number */ + double U = unur_sample_urng(gen); + + /* Transform into geometrically distributed random variate */ + return ( (int) (log(U) / log(1.-p)) ); + } + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + int K; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use predefined geometric distribution with parameter 1/10 */ + double fpar[1] = { 0.1 }; + distr = unur_distr_geometric(fpar, 1); + + /* Use method DEXT */ + par = unur_dext_new(distr); + + /* Set initialization and sampling routines. */ + unur_dext_set_init(par, geometric_init); + unur_dext_set_sample(par, geometric_sample); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) { + K = unur_sample_discr(gen); + printf("%d\n",K); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_dext_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for new generator. + + -- Function: int unur_dext_set_init (UNUR_PAR* PARAMETERS, int (* + INIT)(UNUR_GEN* gen )) + Set initialization routine for external generator. Inside the + + _Important:_ The routine INIT must return ‘UNUR_SUCCESS’ when the + generator was initialized successfully and ‘UNUR_FAILURE’ + otherwise. + + Parameters that are computed in the INIT routine can be stored in + an array or structure that is avaiable by means of the + ‘unur_dext_get_params’ call. Parameters of the underlying + distribution object can be obtained by the + ‘unur_dext_get_distrparams’ call. + + -- Function: int unur_dext_set_sample (UNUR_PAR* PARAMETERS, int (* + SAMPLE)(UNUR_GEN* gen )) + Set sampling routine for external generator. + + _Important:_ Use ‘unur_sample_urng(gen)’ to get a uniform random + number. The pointer to the array or structure that contains the + parameters that are precomputed in the INIT routine are available + by ‘unur_dext_get_params(gen,0)’. Additionally one can use the + ‘unur_dext_get_distrparams’ call. + + -- Function: void* unur_dext_get_params (UNUR_GEN* GENERATOR, size_t + SIZE) + Get pointer to memory block for storing parameters of external + generator. A memory block of size SIZE is automatically (re-) + allocated if necessary and the pointer to this block is stored in + the GENERATOR object. If one only needs the pointer to this memory + block set SIZE to ‘0’. + + Notice, that SIZE is the size of the memory block and not the + length of an array. + + _Important:_ This rountine should only be used in the + initialization and sampling routine of the external generator. + + -- Function: double* unur_dext_get_distrparams (UNUR_GEN* GENERATOR) + -- Function: int unur_dext_get_ndistrparams (UNUR_GEN* GENERATOR) + Get size of and pointer to array of parameters of underlying + distribution in GENERATOR object. + + _Important:_ These rountines should only be used in the + initialization and sampling routine of the external generator. + + +File: unuran.info, Node: DGT, Next: DSROU, Prev: DEXT, Up: Methods_for_DISCR + +5.8.4 DGT – (Discrete) Guide Table method (indexed search) +---------------------------------------------------------- + +Required: + probability vector (PV) +Speed: + Set-up: slow (linear with the vector-length), Sampling: very fast +Reinit: + supported +Reference: + [CAa74] [HLD04: Sect.3.1.2] + + DGT samples from arbitrary but finite probability vectors. Random +numbers are generated by the inversion method, i.e., + + 1. Generate a random number U ~ U(0,1). + 2. Find smallest integer I such that F(I) = P(X<=I) >= U. + + Step (2) is the crucial step. Using sequential search requires +O(E(X)) comparisons, where E(X) is the expectation of the distribution. +Indexed search, however, uses a guide table to jump to some I’ <= I near +I to find X in constant time. Indeed the expected number of comparisons +is reduced to 2, when the guide table has the same size as the +probability vector (this is the default). For larger guide tables this +number becomes smaller (but is always larger than 1), for smaller tables +it becomes larger. For the limit case of table size 1 the algorithm +simply does sequential search (but uses a more expensive setup then +method DSS (*note DSS::). On the other hand the setup time for guide +table is O(N), where N denotes the length of the probability vector (for +size 1 no preprocessing is required). Moreover, for very large guide +tables memory effects might even reduce the speed of the algorithm. So +we do not recommend to use guide tables that are more than three times +larger than the given probability vector. If only a few random numbers +have to be generated, (much) smaller table sizes are better. The size +of the guide table relative to the length of the given probability +vector can be set by a ‘unur_dgt_set_guidefactor’ call. + + There exist two variants for the setup step which can be set by a +‘unur_dgt_set_variant’ call: Variants 1 and 2. Variant 2 is faster but +more sensitive to roundoff errors when the guide table is large. By +default variant 2 is used for short probability vectors (N<1000) and +variant 1 otherwise. + + By default the probability vector is indexed starting at ‘0’. +However this can be changed in the distribution object by a +‘unur_distr_discr_set_domain’ call. + + The method also works when no probability vector but a PMF is given. +However, then additionally a bounded (not too large) domain must be +given or the sum over the PMF. In the latter case the domain of the +distribution is trucated (see ‘unur_distr_discr_make_pv’ for details). + +How To Use +.......... + +Create an object for a discrete distribution either by setting a +probability vector or a PMF. The performance can be slightly influenced +by setting the size of the used table which can be changed by +‘unur_dgt_set_guidefactor’. It is possible to change the parameters and +the domain of the chosen distribution and run ‘unur_reinit’ to +reinitialize the generator object. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_dgt_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_dgt_set_guidefactor (UNUR_PAR* PARAMETERS, double + FACTOR) + Set size of guide table relative to length of PV. Larger guide + tables result in faster generation time but require a more + expensive setup. Sizes larger than 3 are not recommended. If the + relative size is set to 0, sequential search is used. However, + this is not recommended, except in exceptional cases, since method + DSS (*note DSS::) is has almost no setup and is thus faster (but + requires the sum over the PV as input parameter). + + Default is ‘1’. + + -- Function: int unur_dgt_set_variant (UNUR_PAR* PARAMETERS, unsigned + VARIANT) + Set variant for setup step. Possible values are ‘1’ or ‘2’. + Variant ‘2’ is faster but more sensitive to roundoff errors when + the guide table is large. By default variant ‘2’ is used for short + probability vectors (N<1000) and variant ‘1’ otherwise. + + +File: unuran.info, Node: DSROU, Next: DSS, Prev: DGT, Up: Methods_for_DISCR + +5.8.5 DSROU – Discrete Simple Ratio-Of-Uniforms method +------------------------------------------------------ + +Required: + T-concave PMF, mode, sum over PMF +Speed: + Set-up: fast, Sampling: slow +Reinit: + supported +Reference: + [LJa01] [HLD04: Sect.10.3.2; Alg.10.6] + + DSROU is based on the ratio-of-uniforms method (*note +Ratio-of-Uniforms::) but uses universal inequalities for constructing a +(universal) bounding rectangle. It works for all T-concave +distributions with T(x) = -1/sqrt(x) . + + The method requires the PMF, the (exact) location of the mode and the +sum over the given PDF. The rejection constant is 4 for all T-concave +distributions. Optionally the CDF at the mode can be given to increase +the performance of the algorithm. Then the rejection constant is +reduced to 2. + +How To Use +.......... + +The method works for T-concave discrete distributions with given PMF. +The sum over of the PMF or an upper bound of this sum must be known. + + Optionally the CDF at the mode can be given to increase the +performance using ‘unur_dsrou_set_cdfatmode’. However, this *must not* +be called if the sum over the PMF is replaced by an upper bound. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. + + If any of mode, CDF at mode, or the sum over the PMF has been +changed, then ‘unur_reinit’ must be executed. (Otherwise the generator +produces garbage). + + There exists a test mode that verifies whether the conditions for the +method are satisfied or not while sampling. It can be switched on or +off by calling ‘unur_dsrou_set_verify’ and ‘unur_dsrou_chg_verify’, +respectively. Notice however that sampling is (a little bit) slower +then. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_dsrou_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_dsrou_set_cdfatmode (UNUR_PAR* PARAMETERS, double + FMODE) + Set CDF at mode. When set, the performance of the algorithm is + increased by factor 2. However, when the parameters of the + distribution are changed ‘unur_dsrou_chg_cdfatmode’ has to be used + to update this value. Notice that the algorithm detects a mode at + the left boundary of the domain automatically and it is not + necessary to use this call for a monotonically decreasing PMF. + + Default: not set. + + -- Function: int unur_dsrou_set_verify (UNUR_PAR* PARAMETERS, int + VERIFY) + -- Function: int unur_dsrou_chg_verify (UNUR_GEN* GENERATOR, int + VERIFY) + Turn verifying of algorithm while sampling on/off. If the + condition squeeze(x) <= PMF(x) <= hat(x) is violated for some x + then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However + notice that this might happen due to round-off errors for a few + values of x (less than 1%). + + Default is ‘FALSE’. + + -- Function: int unur_dsrou_chg_cdfatmode (UNUR_GEN* GENERATOR, double + FMODE) + Change CDF at mode of distribution. ‘unur_reinit’ must be executed + before sampling from the generator again. + + +File: unuran.info, Node: DSS, Next: DSTD, Prev: DSROU, Up: Methods_for_DISCR + +5.8.6 DSS – (Discrete) Sequential Search method +----------------------------------------------- + +Required: + probability vector (PV) and sum over PV; or probability mass + function(PMF), sum over PV and domain; or or cumulative + distribution function (CDF) +Speed: + Set-up: fast, Sampling: very slow (linear in expectation) +Reinit: + supported +Reference: + [HLD04: Sect.3.1.1; Alg.3.1] + + DSS samples from arbitrary discrete distributions. Random numbers +are generated by the inversion method, i.e., + + 1. Generate a random number U ~ U(0,1). + 2. Find smallest integer I such that F(I) = P(X<=I) >= U. + + Step (2) is the crucial step. Using sequential search requires +O(E(X)) comparisons, where E(X) is the expectation of the distribution. +Thus this method is only recommended when only a few random variates +from the given distribution are required. Otherwise, table methods like +DGT (*note DGT::) or DAU (*note DAU::) are much faster. These methods +also need not the sum over the PMF (or PV) as input. On the other hand, +however, these methods always compute a table. + + DSS runs with the PV, the PMF, or the CDF of the distribution. It +uses actually uses the first one in this list (in this ordering) that +could be found. + +How To Use +.......... + +It works with a discrete distribution object with contains at least the +PV, the PMF, or the CDF. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_dss_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + +File: unuran.info, Node: DSTD, Prev: DSS, Up: Methods_for_DISCR + +5.8.7 DSTD – Discrete STandarD distributions +-------------------------------------------- + +Required: + standard distribution from UNU.RAN library (*note Standard + distributions: Stddist.) or discrete distribution with inverse CDF. +Speed: + Set-up: fast, Sampling: depends on distribution and generator +Reinit: + supported + + DSTD is a wrapper for special generators for discrete univariate +standard distributions. It only works for distributions in the UNU.RAN +library of standard distributions (*note Standard distributions: +Stddist.) or for discrete distributions where the inverse CDF is given. +If a distribution object is provided that is build from scratch, it must +provide the inverse CDF. Then CSTD implements the inversion method. +Otherwise, the ‘NULL’ pointer is returned. + + For some distributions more than one special generator is possible. + +How To Use +.......... + +Create a distribution object for a standard distribution from the +UNU.RAN library (*note Standard distributions: Stddist.), or create a +discrete distribution object and set the function for the inverse CDF +using ‘unur_distr_discr_set_invcdf’. For some distributions more than +one special generator (_variants_) is possible. These can be choosen by +a ‘unur_dstd_set_variant’ call. For possible variants *Note Standard +distributions: Stddist. However the following are common to all +distributions: + +‘UNUR_STDGEN_DEFAULT’ + the default generator. +‘UNUR_STDGEN_FAST’ + the fastest available special generator. +‘UNUR_STDGEN_INVERSION’ + the inversion method (if available). + + Notice that the variant ‘UNUR_STDGEN_FAST’ for a special generator +might be slower than one of the universal algorithms! Additional +variants may exist for particular distributions. + + Sampling from truncated distributions (which can be constructed by +changing the default domain of a distribution by means of +‘unur_distr_discr_set_domain’ or unur_dstd_chg_truncated calls) is +possible but requires the inversion method. Moreover the CDF of the +distribution must be implemented. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_dstd_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for new generator. It requires a + distribution object for a discrete univariant distribution from the + UNU.RAN library of standard distributions (*note Standard + distributions: Stddist.). + + Using a truncated distribution is allowed only if the inversion + method is available and selected by the ‘unur_dstd_set_variant’ + call immediately after creating the parameter object. Use a + ‘unur_distr_discr_set_domain’ call to get a truncated distribution. + + -- Function: int unur_dstd_set_variant (UNUR_PAR* PARAMETERS, unsigned + VARIANT) + Set variant (special generator) for sampling from a given + distribution. For possible variants *note Standard distributions: + Stddist. + + Common variants are ‘UNUR_STDGEN_DEFAULT’ for the default + generator, ‘UNUR_STDGEN_FAST’ for (one of the) fastest implemented + special generators, and ‘UNUR_STDGEN_INVERSION’ for the inversion + method (if available). If the selected variant number is not + implemented, then an error code is returned and the variant is not + changed. + + -- Function: int unur_dstd_chg_truncated (UNUR_GEN* GENERATOR, int + LEFT, int RIGHT) + Change left and right border of the domain of the (truncated) + distribution. This is only possible if the inversion method is + used. Otherwise this call has no effect and an error code is + returned. + + Notice that the given truncated domain must be a subset of the + domain of the given distribution. The generator always uses the + intersection of the domain of the distribution and the truncated + domain given by this call. + + It is not required to run ‘unur_reinit’ after this call has been + used. + + _Important:_ If the CDF is (almost) the same for LEFT and RIGHT and + (almost) equal to ‘0’ or ‘1’, then the truncated domain is not + chanced and the call returns an error code. + + _Notice:_ If the parameters of the distribution has been changed it + is recommended to set the truncated domain again, since the former + call might change the domain of the distribution but not update the + values for the boundaries of the truncated distribution. + + +File: unuran.info, Node: Methods_for_MATR, Next: Methods_for_UNID, Prev: Methods_for_DISCR, Up: Methods + +5.9 Methods for random matrices +=============================== + +* Menu: + +* MCORR:: Random CORRelation matrix + +Overview of methods +------------------- + +Methods for matrix distributions +sample with ‘unur_sample_matr’ + +MCORR: Distribution object for random correlation matrix. + + +File: unuran.info, Node: MCORR, Up: Methods_for_MATR + +5.9.1 MCORR – Random CORRelation matrix +--------------------------------------- + +Required: + Distribution object for random correlation matrix +Speed: + Set-up: fast, Sampling: depends on dimension +Reinit: + supported +Reference: + [DLa86: Sect.6.1; p.605] [MOa84] + + MCORR generates a random correlation matrix (Pearson’s correlation). +Two methods are used: + + 1. When a random correlation matrix having given eigenvalues is + sought, the method of Marsaglia and Olkin [MOa84] is used. In this + case, the correlation matrix R is given as R=PDP' where D is a + diagonal matrix containing the eigenvalues and P is a random + orthonormal matrix. In higher dimensions, the rounding-errors + introduced in the previous matrix multiplications could lead to a + non-symmetric correlation matrix. Therefore the symmetric + correlation matrix is computed as R=(PDP'+P'DP)/2 . + + 2. A matrix H is generated where all rows are independent random + vectors of unit length uniformly on a sphere. Then HH' is a + correlation matrix (and vice versa if HH' is a correlation matrix + then the rows of H are random vectors on a sphere). + + Notice that due to round-off errors the generated matrices might not +be positive definite in extremely rare cases (especially when the given +eigenvalues are amost 0). + + There are many other possibilites (distributions) of sampling the +random rows from a sphere. The chosen methods are simple but does not +result in a uniform distriubution of the random correlation matrices. + + It only works with distribution objects of random correlation +matrices (*note Random Correlation Matrix: correlation.). + +How To Use +.......... + +Create a distibution object for random correlation matrices by a +‘unur_distr_correlation’ call (*note Random Correlation Matrix: +correlation.). + + When a correlation matrix with given eigenvalues should be generated, +these eigenvalues can be set by a ‘unur_mcorr_set_eigenvalues’ call. + + Otherwise, a faster algorithm is used that generates correlation +matrices with random eigenstructure. + + Notice that due to round-off errors, there is a (small) chance that +the resulting matrix is not positive definite for a Cholesky +decomposition algorithm, especially when the dimension of the +distribution is high. + + It is possible to change the given eigenvalues using +‘unur_mcorr_chg_eigenvalues’ and run ‘unur_reinit’ to reinitialize the +generator object. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_mcorr_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_mcorr_set_eigenvalues (UNUR_PAR* PAR, const + DOUBLE* EIGENVALUES) + Sets the (optional) eigenvalues of the correlation matrix. If set, + then the Marsaglia and Olkin algorithm will be used to generate + random correlation matrices with given eigenvalues. + + Important: the given eigenvalues of the correlation matrix must be + strictly positive and sum to the dimension of the matrix. If + non-positive eigenvalues are attempted, no eigenvalues are set and + an error code is returned. In case, that their sum is different + from the dimension, an implicit scaling to give the correct sum is + performed. + + -- Function: int unur_mcorr_chg_eigenvalues (UNUR_GEN* GEN, const + DOUBLE* EIGENVALUES) + Change the eigenvalues of the correlation matrix. One must run + ‘unur_reinit’ to reinitialize the generator object then. + + +File: unuran.info, Node: Methods_for_UNID, Next: Meta_Methods, Prev: Methods_for_MATR, Up: Methods + +5.10 Methods for uniform univariate distributions +================================================= + +* Menu: + +* UNIF:: wrapper for UNIForm random number generator + + +File: unuran.info, Node: UNIF, Up: Methods_for_UNID + +5.10.1 UNIF – wrapper for UNIForm random number generator +--------------------------------------------------------- + +UNIF is a simple wrapper that makes it possible to use a uniform random +number generator as a UNU.RAN generator. There are no parameters for +this method. + +How To Use +.......... + +Create a generator object with ‘NULL’ as argument. The created +generator object returns raw random numbers from the underlying uniform +random number generator. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_unif_new (const UNUR_DISTR* DUMMY) + Get default parameters for generator. UNIF does not need a + distribution object. DUMMY is not used and can (should) be set to + ‘NULL’. It is used to keep the API consistent. + + +File: unuran.info, Node: Meta_Methods, Prev: Methods_for_UNID, Up: Methods + +5.11 Meta Methods for univariate distributions +============================================== + +* Menu: + +* MIXT:: MIXTure of distributions + +Example +------- + + /* ------------------------------------------------------------- */ + /* File: example_mixt.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + /* Mixture of a Gaussian and a Cauchy distribution. */ + /* ------------------------------------------------------------- */ + + int main(void) + { + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *comp[2]; /* array of generator objects (components)*/ + UNUR_GEN *gen; /* generator object for mixture */ + + double prob[2]; /* array of probabilities */ + + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Create generators for components */ + distr = unur_distr_normal(NULL,0); /* Gaussian distribution */ + par = unur_pinv_new(distr); /* choose method PINV */ + comp[0] = unur_init(par); /* initialize */ + unur_distr_free(distr); /* free distribution obj. */ + + distr = unur_distr_cauchy(NULL,0); /* Cauchy distribution */ + par = unur_tdr_new(distr); /* choose method TDR */ + comp[1] = unur_init(par); /* initialize */ + unur_distr_free(distr); /* free distribution obj. */ + + /* Probabilities for components (need not sum to 1) */ + prob[0] = 0.4; + prob[1] = 0.3; + + /* Create mixture */ + par = unur_mixt_new(2,prob,comp); + + /* Initialize generator object */ + gen = unur_init(par); + + /* we do not need the components any more */ + for (i=0; i<2; i++) + unur_free(comp[i]); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + +Example (Inversion) +------------------- + + /* ------------------------------------------------------------- */ + /* File: example_mixt_inv.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + /* Mixture of truncated Gaussian on (-INFINITY,0] and */ + /* Exponential distribution on [0,INFINITY) */ + /* ------------------------------------------------------------- */ + + int main(void) + { + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *comp[2]; /* array of generator objects (components)*/ + UNUR_GEN *gen; /* generator object for mixture */ + + double prob[2]; /* array of probabilities */ + + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Create generators for components */ + distr = unur_distr_normal(NULL,0); /* Gaussian distribution */ + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,0); + par = unur_pinv_new(distr); /* choose method PINV */ + comp[0] = unur_init(par); /* initialize */ + unur_distr_free(distr); /* free distribution obj. */ + + distr = unur_distr_exponential(NULL,0); /* Exponential distr. */ + par = unur_pinv_new(distr); /* choose method PINV */ + comp[1] = unur_init(par); /* initialize */ + unur_distr_free(distr); /* free distribution obj. */ + + /* Probabilities for components (need not sum to 1) */ + prob[0] = 0.4; + prob[1] = 0.3; + + /* Create mixture */ + par = unur_mixt_new(2,prob,comp); + + /* We want to use inversion for the mixture as well. */ + /* (Thus the above order of the components is important!) */ + unur_mixt_set_useinversion(par,TRUE); + + /* Initialize generator object */ + gen = unur_init(par); + + /* we do not need the components any more */ + for (i=0; i<2; i++) + unur_free(comp[i]); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + +File: unuran.info, Node: MIXT, Up: Meta_Methods + +5.11.1 MIXT – MIXTure of distributions +-------------------------------------- + +MIXT allows to sample from a mixture of univariate distributions. + + Let f_1,...,f_n be PDFs of various distributions called the +components and (p_1,...,p_n) be a probability vector. Then f(x) = p_1 * +f_1(x) + ...+ p_n * f_n(x) is the PDF of the so called mixture of these +distributions. + + Method MIXT takes generator objects for the components and a +probability vector and creates a generator object for this mixture. + + The sampling part works as follows: + + 1. Generate an index J as the realisation of a discrete random variate + with the given probability vector. This is done by means of method + DGT (*note Guide Table method: DGT.). + 2. Generate a random variate X with PDF f_J. + + When the (interior of the) domains of the the components are disjoint +then it is possible to sample from the mixture by inversion, provided +that the following conditions are met: + + − The generator objects must use an inversion method for each + component. + − The domains of the PDFs f_i must not overlap. + − The components must be ordered with respect to their domains. + +How To Use +.......... + +Create generator objects for the components of the mixture and store the +corresponding pointers in an array. Store all probabilities an a double +array of the same size. Create the parameter object for the generator +of the mixture distribution by means of ‘unur_mixt_new’. The components +of the mixture can be any continuous or discrete univariate +distributions. This also includes generators for empirical +distributions and mixtures of distributions. In particular, mixtures +can also be defined recursively. + + _Remark:_ The components of the mixture can be continuous or discrete +distributions. The resulting mixture, however, is always a continuous +distribution and thus ‘unur_sample_cont’ must be used! + + The inversion method can be switched on by means of +‘unur_mixt_set_useinversion’ call. However, the conditions for this +method must then be met. Otherwise, initialization of the mixture +object fails. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_mixt_new (int N, const DOUBLE* PROB, + UNUR_GEN** COMP) + Get default parameters for the generator for a mixture of the + distributions given in the array COMP (components) of length N. + The probabilities are given by PROB. + + The generators in COMP must be objects for (continuous or discrete) + univariate distributions + + -- Function: int unur_mixt_set_useinversion (UNUR_PAR* PARAMETERS, int + USEINV) + If USEINV is ‘TRUE’, then the inversion method is used for sampling + from the mixture distribution. + + However, the following conditions must be satisfied: + + − The generator objects must use an inversion method for each + component. + − The domains of the components must not overlap. + − The components must be ordered with respect to their domains. + + If one of these conditions is violated, then initialization of the + mixture object fails. + + Default is ‘FALSE’. + + +File: unuran.info, Node: URNG, Next: Stddist, Prev: Methods, Up: Top + +6 Using uniform random number generators +**************************************** + +* Menu: + +* URNG-FVOID:: Simple interface for uniform random number generators +* URNG-GSL:: Interface to GSL uniform random number generators +* URNG-GSLQRNG:: Interface to GSL generators for quasi-random points +* URNG-PRNG:: Interface to Otmar Lendl’s pseudo-random number generators +* URNG-RNGSTREAM:: Interface to L’Ecuyer’s RNGSTREAM random number generators +* URNG-RANDOMSHIFT:: Combine point set generator with random shifts + +UNU.RAN is designed to work with many sources of (pseudo-) random +numbers or low discrepancy numbers (so called quasi-random numbers) for +almost all tasks in discrete event simulation, (quasi-) Monte Carlo +integration or any other stochastic methods. Hence UNU.RAN uses +pointers to access uniform (pseudo-) random number generators (URNG). + + Each UNU.RAN (non-uniform random variate) generator object has a +pointer to a URNG object. Thus each UNU.RAN generator object may have +its own (independent) URNG or several generator objects can share the +same URNG. + + If no URNG is provided for a parameter or generator object a default +generator is used which is the same for all generators. This URNG is +defined in ‘unuran_config.h’ at compile time and can be changed at +runtime. + + UNU.RAN uses a unified interface for all sources of random numbers. +Unfortunately, the API for random number generators, like the ‘GSL’ (GNU +Scientific Library), Otmar Lendl’s ‘prng’ (Pseudo random number +generators), or a single function implemented by the user herself, are +quite different. Hence an object of type ‘UNUR_URNG’ is introduced to +store the URNG. Thus it is possible to handle different sources of such +URNGs with the unified API. It is inspired from similar to Pierre +L’Ecuyers ‘RngStreams’ library: + + − seed the random number generator; + − get a uniform random number; + − reset the URNG; + − skip to the begining next substream; + − sample antithetic numbers; + − delete the URNG object. + + The routine to create a URNG depends on the chosen random number +generator (i.e. library). Nevertheless, there exist wrapper functions +to simplify this task. + + Currently the following sources of uniform random numbers are +directly supported (i.e., there exist wrapper functions). Of course +other random number generation libraries can be used. + + 1. ‘FVOID’ + + URNGs of type ‘double uniform(void *state)’. The argument STATE + can be simply ignored in the implementation of ‘uniform’ when a + global state variable is used. UNU.RAN contains some build-in + URNGs of this type in directory ‘src/uniform/’. + + 2. ‘PRNG’ + + URNGs from Otmar Lendl’s ‘prng’ library. It provides a very + flexible way to sample form arbitrary URNGs by means of an object + oriented programing paradigma. Similarly to the UNU.RAN library + independent generator objects can be build and used. + + This library has been developed by the pLab group at the university + of Salzburg (Austria, EU) and implemented by Otmar Lendl. It is + available from or from the pLab + site at . + + This interface must be compiled into UNU.RAN using the configure + flag ‘--with-urng-prng’. + + 3. ‘RNGSTREAM’ + + Pierre L’Ecuyer’s ‘RngStream’ library for multiple independent + streams of pseudo-random numbers. A GNU-style package is available + from . + + This interface must be compiled into UNU.RAN using the configure + flag ‘--with-urng-rngstream’. + + 4. ‘GSL’ + + URNG from the GNU Scientific Library (GSL). It is available from + . + + This interface must be compiled into UNU.RAN using the configure + flag ‘--with-urng-gsl’. + +How To Use +.......... + +Each UNU.RAN generator object has a pointer to a uniform (pseudo-) +random number generator (URNG). It can be set via the ‘unur_set_urng’ +call. It is also possible to read this pointer via ‘unur_get_urng’ or +change the URNG for an existing generator object by means of +‘unur_chg_urng’. It is important to note that these calls only copy the +pointer to the URNG object into the generator object. + + If no URNG is provided for a parameter or generator object a default +URNG is used which is the same for all generators. This URNG is defined +in ‘unuran_config.h’ at compile time. A pointer to this default URNG +can be obtained via ‘unur_get_default_urng’. Nevertheless, it is also +possible to change this default URNG by another one at runtime by means +of the ‘unur_set_default_urng’ call. However, this only takes effect +for new parameter objects. + + Some generating methods provide the possibility of correlation +induction. For this feature a second auxiliary URNG is required. It +can be set and changed by ‘unur_set_urng_aux’ and ‘unur_chg_urng_aux’ +calls, respectively. Since the auxiliary URNG is by default the same as +the main URNG, the auxiliary URNG must be set after any ‘unur_set_urng’ +or ‘unur_chg_urng’ call! Since in special cases mixing of two URNG +might cause problems, we supply a default auxiliary generator that can +be used by a ‘unur_use_urng_aux_default’ call (after the main URNG has +been set). This default auxiliary generator can be changed with +analogous calls as the (main) default uniform generator. + + Uniform random number generators form different sources have +different programming interfaces. Thus UNU.RAN stores all information +about a particular uniform random number generator in a structure of +type ‘UNUR_URNG’. Before a URNG can be used with UNU.RAN an appropriate +object has to be created ba a ‘unur_urng_new’ call. This call takes two +arguments: the pointer to the sampling routine of the generator and a +pointer to a possible argument that stores the state of the generator. +The function must be of type ‘double (*sampleunif)(void *params)’, but +functions without any argument also work. Additionally one can set +pointers to functions for reseting or jumping the streams generated by +the URNG by the corresponding ‘set’ calls. + + UNU.RAN provides a unified API to all sources of random numbers. +Notice, however, that not all functions work for all random number +generators (as the respective library has not implemented the +corresponding feature). + + There are wrapper functions for some libraries of uniform random +number generators to simplify the task of creating a UNU.RAN object for +URNGs. These functions must be compiled into UNU.RAN using the +corresponding configure flags (see description of the respective +interface below). + +Function reference +------------------ + +Set and get default uniform RNGs +-------------------------------- + + -- Function: UNUR_URNG* unur_get_default_urng (void) + Get the pointer to the default URNG. The default URNG is used by + all generators where no URNG was set explicitly by a + ‘unur_set_urng’ call. + + -- Function: UNUR_URNG* unur_set_default_urng (UNUR_URNG* URNG_NEW) + Change the default URNG that is used for new parameter objects. It + returns the pointer to the old default URNG that has been used. + + -- Function: UNUR_URNG* unur_set_default_urng_aux (UNUR_URNG* URNG_NEW) + -- Function: UNUR_URNG* unur_get_default_urng_aux (void) + Analogous calls for default auxiliary generator. + +Set, change and get uniform RNGs in generator objects +----------------------------------------------------- + + -- Function: int unur_set_urng (UNUR_PAR* PARAMETERS, UNUR_URNG* URNG) + Use the URNG ‘urng’ for the new generator. This overrides the + default URNG. It also sets the auxiliary URNG to ‘urng’. + + _Important_: For multivariate distributions that use marginal + distributions this call does not work properly. It is then better + first to create the generator object (by a ‘unur_init’ call) and + then change the URNG by means of ‘unur_chg_urng’. + + -- Function: UNUR_URNG* unur_chg_urng (UNUR_GEN* GENERATOR, UNUR_URNG* + URNG) + Change the URNG for the given generator. It returns the pointer to + the old URNG that has been used by the generator. It also changes + the auxiliary URNG to ‘urng’ and thus it overrides the last + ‘unur_chg_urng_aux’ call. + + -- Function: UNUR_URNG* unur_get_urng (UNUR_GEN* GENERATOR) + Get the pointer to the URNG that is used by the GENERATOR. This is + usefull if two generators should share the same URNG. + + -- Function: int unur_set_urng_aux (UNUR_PAR* PARAMETERS, UNUR_URNG* + URNG_AUX) + Use the auxiliary URNG ‘urng_aux’ for the new generator. (Default + is the default URNG or the URNG from the last ‘unur_set_urng’ call. + Thus if the auxiliary generator should be different to the main + URNG, ‘unur_set_urng_aux’ must be called after ‘unur_set_urng’. + The auxiliary URNG is used as second stream of uniform random + number for correlation induction. It is not possible to set an + auxiliary URNG for a method that does not need one. In this case + an error code is returned. + + -- Function: int unur_use_urng_aux_default (UNUR_PAR* PARAMETERS) + Use the default auxiliary URNG. (It must be set after + ‘unur_get_urng’. ) It is not possible to set an auxiliary URNG + for a method that does not use one (i.e. the call returns an error + code). + + -- Function: int unur_chgto_urng_aux_default (UNUR_GEN* GENERATOR) + Switch to default auxiliary URNG. (It must be set after + ‘unur_get_urng’. ) It is not possible to set an auxiliary URNG + for a method that does not use one (i.e. the call returns an error + code). + + -- Function: UNUR_URNG* unur_chg_urng_aux (UNUR_GEN* GENERATOR, + UNUR_URNG* URNG_AUX) + Change the auxiliary URNG for the given GENERATOR. It returns the + pointer to the old auxiliary URNG that has been used by the + generator. It has to be called after each ‘unur_chg_urng’ when the + auxiliary URNG should be different from the main URNG. It is not + possible to change the auxiliary URNG for a method that does not + use one (i.e. the call ‘NULL’). + + -- Function: UNUR_URNG* unur_get_urng_aux (UNUR_GEN* GENERATOR) + Get the pointer to the auxiliary URNG that is used by the + GENERATOR. This is usefull if two generators should share the same + URNG. + +Handle uniform RNGs +------------------- + +_Notice:_ Some of the below function calls do not work for every source +of random numbers since not every library has implemented these +features. + + -- Function: double unur_urng_sample (UNUR_URNG* URNG) + Get a uniform random number from URNG. If the ‘NULL’ pointer is + given, the default uniform generator is used. + + -- Function: double unur_sample_urng (UNUR_GEN* GEN) + Get a uniform random number from the underlying uniform random + number generator of generator GEN. If the ‘NULL’ pointer is given, + the default uniform generator is used. + + -- Function: int unur_urng_sample_array (UNUR_URNG* URNG, double* X, + int DIM) + Set array X of length DIM with uniform random numbers sampled from + generator URNG. If URNG is the ‘NULL’ pointer, the default uniform + generator is used. + + _Important:_ If URNG is based on a point set generator (this is the + case for generators of low discrepance point sets as used in + quasi-Monte Carlo methods) it has a “natural dimension” s. In this + case either only the first s entries of X are filled (if s < DIM), + or the first DIM coordinates of the generated point are filled. + + The called returns the actual number of entries filled. In case of + an error ‘0’ is returned. + + -- Function: int unur_urng_reset (UNUR_URNG* URNG) + Reset URNG object. The routine tries two ways to reset the + generator (in this order): + + 1. It uses the reset function given by an ‘unur_urng_set_reset’ + call. + + 2. It uses the seed given by the last ‘unur_urng_seed’ call + (which requires a seeding function given by a + ‘unur_urng_set_seed’ call). + + If neither of the two methods work resetting of the generator is + not possible and an error code is returned. + + If the ‘NULL’ pointer is given, the default uniform generator is + reset. + + -- Function: int unur_urng_sync (UNUR_URNG* URNG) + Jump into defined state ("sync") of the generator. This is useful + when point generators are used where the coordinates are sampled + via ‘unur_urng_sample’. Then this call can be used to jump to the + first coordinate of the next generated point. + + -- Function: int unur_urng_seed (UNUR_URNG* URNG, unsigned LONG SEED) + Set SEED for generator URNG. It returns an error code if this is + not possible for the given URNG. If the ‘NULL’ pointer is given, + the default uniform generator is seeded (if possible). + + _Notice_: Seeding should be done only once for a particular + generator (except for resetting it to the initial state). + Expertise is required when multiple seeds are used to get + independent streams. Thus we recommend appropriate libraries for + this task, e.g. Pierre L’Ecuyer’s ‘RngStreams’ package. For this + library only a package seed can be set and thus the + ‘unur_urng_seed’ call will not have any effect to generators of + this type. Use ‘unur_urng_reset’ or ‘unur_urng_rngstream_new’ + instead, depending whether one wants to reset the stream or get a + new stream that is independent from the previous ones. + + -- Function: int unur_urng_anti (UNUR_URNG* URNG, int ANTI) + Switch to antithetic random numbers in URNG. It returns an error + code if this is not possible for the given URNG. + + If the ‘NULL’ pointer is given, the antithetic flag of the default + uniform generator is switched (if possible). + + -- Function: int unur_urng_nextsub (UNUR_URNG* URNG) + Jump to start of the next substream of URNG. It returns an error + code if this is not possible for the given URNG. + + If the ‘NULL’ pointer is given, the default uniform generator is + set to the start of the next substream (if possible). + + -- Function: int unur_urng_resetsub (UNUR_URNG* URNG) + Jump to start of the current substream of URNG. It returns an + error code if this is not possible for the given URNG. + + If the ‘NULL’ pointer is given, the default uniform generator is + set to the start of the current substream (if possible). + + -- Function: int unur_gen_sync (UNUR_GEN* GENERATOR) + -- Function: int unur_gen_seed (UNUR_GEN* GENERATOR, unsigned LONG + SEED) + -- Function: int unur_gen_anti (UNUR_GEN* GENERATOR, int ANTI) + -- Function: int unur_gen_reset (UNUR_GEN* GENERATOR) + -- Function: int unur_gen_nextsub (UNUR_GEN* GENERATOR) + -- Function: int unur_gen_resetsub (UNUR_GEN* GENERATOR) + Analogous to ‘unur_urng_sync’, ‘unur_urng_seed’ , ‘unur_urng_anti’, + ‘unur_urng_reset’ , ‘unur_urng_nextsub’, and ‘unur_urng_resetsub’, + but act on the URNG object used by the GENERATOR object. + + _Warning:_ These calls should be used with care as it influences + all generator objects that share the same URNG object! + +API to create a new URNG object +------------------------------- + +_Notice:_ These functions are provided to built a UNUR_URNG object for a +particular external random number generator from scratch. For some +libraries that contain random number generators (like the GSL) there are +special calls, e.g. ‘unur_urng_gsl_new’, to get such an object. Then +there is no need to change the UNUR_URNG object as it already contains +all available features. + + If you have a particular library for random number generators you can +either write wrapper function like those in ‘src/uniform/urng_gsl.c’ or +write an email to the authors of UNU.RAN to write it for you. + + -- Function: UNUR_URNG* unur_urng_new (double (* SAMPLEUNIF)(void* + state ), void* STATE) + Get a new URNG object. SAMPLEUNIF is a function to the uniform + sampling routine, STATE a pointer to its arguments which usually + contains the state variables of the generator. + + Functions SAMPLEUNIF with a different type for P or without an + argument at all also work. A typecast might be necessary to avoid + compiler warnings or error messages. + + For functions SAMPLEUNIF that does not have any argument should use + ‘NULL’ for STATE. + + _Important:_ SAMPLEUNIF must not be the ‘NULL’ pointer. + + There are appropriate calls that simplifies the task of creating + URNG objects for some libraries with uniform random number + generators, see below. + + -- Function: void unur_urng_free (UNUR_URNG* URNG) + Destroy URNG object. It returns an error code if this is not + possible. + + If the ‘NULL’ is given, this function does nothing. + + _Warning:_ This call must be used with care. The URNG object must + not be used by any existing generator object! It is designed to + work in conjunction with the wrapper functions to create URNG + objects for generators of a particular library. Thus an object + created by an ‘unur_urng_prng_new’ call can be simply destroyed by + an ‘unur_urng_free’ call. + + -- Function: int unur_urng_set_sample_array (UNUR_URNG* URNG, unsigned + int(* SAMPLEARRAY)(void* state, double* X, int DIM )) + Set function to fill array X of length DIM with random numbers + generated by generator URNG (if available). + + -- Function: int unur_urng_set_sync (UNUR_URNG* URNG, void (* + SYNC)(void* state )) + Set function for jumping into a defined state (“sync”). + + -- Function: int unur_urng_set_seed (UNUR_URNG* URNG, void (* + SETSEED)(void* state, unsigned LONG SEED )) + Set function to seed generator URNG (if available). + + -- Function: int unur_urng_set_anti (UNUR_URNG* URNG, void (* + SETANTI)(void* state, int ANTI )) + Set function to switch the antithetic flag of generator URNG (if + available). + + -- Function: int unur_urng_set_reset (UNUR_URNG* URNG, void (* + RESET)(void* state )) + Set function for reseting the uniform random number generator URNG + (if available). + + -- Function: int unur_urng_set_nextsub (UNUR_URNG* URNG, void (* + NEXTSUB)(void* state )) + Set function that allows jumping to start of the next substream of + URNG (if available). + + -- Function: int unur_urng_set_resetsub (UNUR_URNG* URNG, void (* + RESETSUB)(void* state )) + Set function that allows jumping to start of the current substream + of URNG (if available). + + -- Function: int unur_urng_set_delete (UNUR_URNG* URNG, void (* + FPDELETE)(void* state )) + Set function for destroying URNG (if available). + + +File: unuran.info, Node: URNG-FVOID, Next: URNG-GSL, Up: URNG + +6.1 Simple interface for uniform random number generators +========================================================= + +Simple interface for URNGs of type ‘double uniform(void *state)’. + + UNU.RAN contains some build-in URNGs of this type: +‘unur_urng_MRG31k3p’ + Combined multiple recursive generator by Pierre L’Ecuyer and Renee + Touzin. +‘unur_urng_fish’ + Linear congruential generator by Fishman and Moore. +‘unur_urng_mstd’ + Linear congruential generator "Minimal Standard" by Park and + Miller. + + Notice, however, that these generators are provided as a fallback for +the case that no state-of-the-art uniform random number generators (e.g. +*note Pierre L’Ecuyer’s ‘Rngstream’ library: URNG-RNGSTREAM.) are used. + +How To Use +.......... + +Create an URNG object using ‘unur_urng_fvoid_new’. By this call a +pointer to the sampling routine and (optional) a pointer to a reset +routine are copied into the URNG object. Other functions, like seeding +the URNG, switching to antithetic random number, or jumping to next +substream, can be added to the URNG object by the respective calls, e.g. +by ‘unur_urng_set_seed’. The following routines are supported for URNG +objects of this type: + + − ‘unur_urng_sample’ + − ‘unur_urng_sample_array’ + − ‘unur_urng_seed’ [optional] + − ‘unur_urng_reset’ [optional] + − ‘unur_urng_free’ + +Function reference +------------------ + + -- Function: UNUR_URNG* unur_urng_fvoid_new (double (* URAND)(void* + state ), void (* RESET)(void* state )) + Make a URNG object for a generator that consists of a single + function call URAND. + + If there is no RESET function use ‘NULL’ for the second argument. + + +File: unuran.info, Node: URNG-GSL, Next: URNG-GSLQRNG, Prev: URNG-FVOID, Up: URNG + +6.2 Interface to GSL uniform random number generators +===================================================== + +Interface to the uniform random number generators from the GNU +Scientific Library (GSL). Documentation and source code of this library +is available from . + + The interface to the GSL must be compiled into UNU.RAN using the +configure flag ‘--with-urng-gsl’. Notice that the GSL has to be +installed before running ‘./configure’. + +How To Use +.......... + +When using this interface ‘unuran_urng_gsl.h’ must be included in the +corresponding C file, i.e., one must add the line + + #include + +Moreover, one must not forget to link the executable against ‘libgsl’. + + The following routines are supported for URNG objects of type GSL: + + − ‘unur_urng_sample’ + − ‘unur_urng_sample_array’ + − ‘unur_urng_seed’ + − ‘unur_urng_reset’ + − ‘unur_urng_free’ + + /* ------------------------------------------------------------- */ + /* File: example_gsl.c */ + /* ------------------------------------------------------------- */ + #ifdef UNURAN_SUPPORTS_GSL + /* ------------------------------------------------------------- */ + /* This example makes use of the GSL library for generating */ + /* uniform random numbers. */ + /* (see http://www.gnu.org/software/gsl/) */ + /* To compile this example you must have set */ + /* ./configure --with-urng-gsl */ + /* (Of course the executable has to be linked against the */ + /* GSL library.) */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header files. */ + #include + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng; /* uniform generator objects */ + + /* GNU Scientific Library only: */ + /* Make a object for uniform random number generator. */ + urng = unur_urng_gsl_new(gsl_rng_mt19937); + if (urng == NULL) exit (EXIT_FAILURE); + + /* Create a generator object using this URNG */ + distr = unur_distr_normal( NULL, 0 ); + par = unur_tdr_new(distr); + unur_set_urng( par, urng ); + gen = unur_init(par); + if (gen == NULL) exit (EXIT_FAILURE); + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* Destroy objects */ + unur_free(gen); + unur_urng_free(urng); + + exit (EXIT_SUCCESS); + } /* end of main() */ + + /* ------------------------------------------------------------- */ + #else + #include + #include + int main(void) { + printf("You must enable the GSL to run this example!\n\n"); + exit (77); /* exit code for automake check routines */ + } + #endif + /* ------------------------------------------------------------- */ + + +Function reference +------------------ + + -- Function: UNUR_URNG* unur_urng_gsl_new (const GSL_RNG_TYPE* + URNGTYPE) + Make object for URNGs from the ‘GSL’ (GNU Scientific Library). + URNGTYPE is the type of the chosen generator as described in the + GSL manual (see Section Random Number Generation). This library is + available from . + + -- Function: UNUR_URNG* unur_urng_gslptr_new (gsl_rng* URNG) + Similar to ‘unur_urng_gsl_new’ but it uses a pointer to a generator + object as returned by ‘gsl_rng_alloc(rng_type)’; see ‘GSL’ manual + for details. + + _Notice_: There is a subtle but important difference between these + two calls. When a generator object is created by a + ‘unur_urng_gsl_new’ call, then resetting of the generator works. + When a generator object is created by a ‘unur_urng_gslptr_new’ + call, then resetting only works after a + ‘unur_urng_seed(urng,myseed)’ call. + + +File: unuran.info, Node: URNG-GSLQRNG, Next: URNG-PRNG, Prev: URNG-GSL, Up: URNG + +6.3 Interface to GSL generators for quasi-random points +======================================================= + +Interface to the generators for quasi-random points (also called low +discrepancy point sets) from the GNU Scientific Library (GSL). +Documentation and source code of this library is available from +. + + The interface to the GSL must be compiled into UNU.RAN using the +configure flag ‘--with-urng-gsl’. Notice that the GSL has to be +installed before running ‘./configure’. + +How To Use +.......... + +When using this interface ‘unuran_urng_gsl.h’ must be included in the +corresponding C file, i.e., one must add the line + + #include + +Moreover, one must not forget to link the executable against ‘libgsl’. + + The following routines are supported for URNG objects of this type: + + − ‘unur_urng_sample’ + − ‘unur_urng_sample_array’ + − ‘unur_urng_reset’ + − ‘unur_urng_sync’ + − ‘unur_urng_free’ + ‘unur_urng_sync’ is used to jump to the first coordinate of the next +point generated by the generator. + +Function reference +------------------ + + -- Function: UNUR_URNG* unur_urng_gslqrng_new (const GSL_QRNG_TYPE* + QRNGTYPE, unsigned INT DIM) + Make object for quasi-random point generators for dimension DIM + from the ‘GSL’ (GNU Scientific Library). QRNGTYPE is the type of + the chosen generator as described in the GSL manual (see section + Quasi-Random Sequences). This library is available from + . + + +File: unuran.info, Node: URNG-PRNG, Next: URNG-RNGSTREAM, Prev: URNG-GSLQRNG, Up: URNG + +6.4 Interface to Otmar Lendl’s pseudo-random number generators +============================================================== + +URNGs from Otmar Lendl’s ‘prng’ library. It provides a very flexible +way to sample form arbitrary URNGs by means of an object oriented +programing paradigma. Similarly to the UNU.RAN library independent +generator objects can be build and used. + + This library has been developed by the pLab group at the university +of Salzburg (Austria, EU) and implemented by Otmar Lendl. It is +available from or from the pLab site at +. + + The interface to the PRNG library must be compiled into UNU.RAN using +the configure flag ‘--with-urng-prng’. Notice that the PRNG library has +to be installed before running ‘./configure’. + +How To Use +.......... + +When using this interface ‘unuran_urng_prng.h’ must be included in the +corresponding C file, i.e., one must add the line + + #include + +Moreover, one must not forget to link the executable against ‘libprng’. + + The following routines are supported for URNG objects of type PRNG: + + − ‘unur_urng_sample’ + − ‘unur_urng_sample_array’ + − ‘unur_urng_seed’ (availability depends on chosen PRNG generator!) + − ‘unur_urng_reset’ + − ‘unur_urng_free’ + +Function reference +------------------ + + -- Function: UNUR_URNG* unur_urng_prng_new (const CHAR* PRNGSTR) + Make object for URNGs from Otmar Lendl’s ‘prng’ package. PRNGSTR + is a string that contains the necessary information to create a + uniform random number generator. For the format of this string see + the ‘prng’ user manual. + + The ‘prng’ library provides a very flexible way to sample form + arbitrary URNGs by means of an object oriented programing + paradigma. Similarly to the UNU.RAN library independent generator + objects can be build and used. The library has been developed and + implemented by Otmar Lendl as member of the pLab group at the + university of Salzburg (Austria, EU). + + It is available via anonymous ftp from + or from the pLab site at + . + + -- Function: UNUR_URNG* unur_urng_prngptr_new (struct PRNG* URNG) + Similar to ‘unur_urng_prng_new’ but it uses a pointer to a + generator object as returned by ‘prng_new(prngstr)’; see ‘prng’ + manual for details. + + +File: unuran.info, Node: URNG-RNGSTREAM, Next: URNG-RANDOMSHIFT, Prev: URNG-PRNG, Up: URNG + +6.5 Interface to L’Ecuyer’s RNGSTREAM random number generators +============================================================== + +URNGs from Pierre L’Ecuyer’s ‘RngStream’ library for multiple +independent streams of pseudo-random numbers. This library provides +multiple independent streams of pseudo-random numbers which itselves can +be splitted into many substreams. It is available from +. A GNU-style +package is available from +. + + The interface to the RngStream library must be compiled into UNU.RAN +using the configure flag ‘--with-urng-rngstream’. Notice that the +RngStream library has to be installed before running ‘./configure’. + +How To Use +.......... + +When using this interface ‘unuran_urng_rngstream.h’ must be included in +the corresponding C file, i.e., one must add the line + + #include + +Moreover, one must not forget to link the executable against the +‘RngStream’ library (i.e., when using the GNU-style package in UNIX like +environments one has to add ‘-lrngstreams’ when linking an executable). + + Notice that the ‘rngstream’ library uses a package seed, that means +one should seed the uniform random number generator only once in an +application using the routine ‘RngStream_SetPackageSeed’: + + unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; + RngStream_SetPackageSeed(seed); + +The following routines are supported for URNG objects of this type: + + − ‘unur_urng_sample’ + − ‘unur_urng_sample_array’ + − ‘unur_urng_reset’ + − ‘unur_urng_nextsub’ + − ‘unur_urng_resetsub’ + − ‘unur_urng_anti’ + − ‘unur_urng_free’ + +Function reference +------------------ + + -- Function: UNUR_URNG* unur_urng_rngstream_new (const CHAR* URNGSTR) + Make object for URNGs from Pierre L’Ecuyer’s ‘RngStream’ library. + URNGSTR is an arbitrary string to label a stream. It need not be + unique. + + -- Function: UNUR_URNG* unur_urng_rngstreamptr_new (RngStream + RNGSTREAM) + Similar to ‘unur_urng_rngstream_new’ but it uses a pointer to a + generator object as returned by ‘RngStream_CreateStream()’. + + +File: unuran.info, Node: URNG-RANDOMSHIFT, Prev: URNG-RNGSTREAM, Up: URNG + +6.6 Combine point set generator with random shifts +================================================== + +Generators of type RANDOMSHIFT combine a point set generator with +generators to apply random shifts as proposed in [CPa76] : + + 1. Sample and store a random vector S. + 2. Run a QMC simulation where S is added to each point of the + generated quasi-random point (mod 1). + 3. Repeat steps 1 and 2. + +How To Use +.......... + +Create a URNG object for a point set generator and a URNG object for a +generator to create shift vectors at random. The meta URNG object can +then be created using ‘unur_urng_randomshift_new’. Notice that only +pointers to the two underlying URNG generator objects are copied into +the newly created meta generator. Thus manipulating the meta URNG also +changes the underlying URNGs and vice versa. + + The following routines are supported for URNG objects of type +RANDOMSHIFT: + + − ‘unur_urng_sample’ + − ‘unur_urng_sample_array’ + − ‘unur_urng_reset’ + − ‘unur_urng_sync’ + − ‘unur_urng_randomshift_nextshift’ + − ‘unur_urng_free’ + ‘unur_urng_sync’ is used to jump to the first coordinate of the next +point generated by the generator. ‘unur_urng_randomshift_nextshift’ +allows to replace the shift vector by another randomly chosen shift +vector. + + _Important:_ ‘unur_urng_sync’ is only available if it is if it is +implemented for the underlying point set generator. + + _Important:_ ‘unur_urng_reset’ is only available if it is available +for both underlying generators. + +Function reference +------------------ + + -- Function: UNUR_URNG* unur_urng_randomshift_new (UNUR_URNG* QRNG, + UNUR_URNG* SRNG, int DIM) + Make object for URNG with randomly shifted point sets. QRNG is a + generated that generates point sets of dimension DIM. SRNG is a + generated that generates random numbers or vectors. + + _Notice:_ Only pointers to the respective objects QRNG and SRNG are + copied into the created meta generator. Thus manipulating the meta + URNG also changes the underlying URNGs and vice versa. + + -- Function: int unur_urng_randomshift_nextshift (UNUR_URNG* URNG) + Get the next (randomly chosen) vector for shifting the points set, + and the underlying point generator QRNG is reset. + + +File: unuran.info, Node: Stddist, Next: Error_Debug, Prev: URNG, Up: Top + +7 UNU.RAN Library of standard distributions +******************************************* + +* Menu: + +* Stddist_CONT:: UNU.RAN Library of continuous univariate distributions +* Stddist_CVEC:: UNU.RAN Library of continuous multivariate distributions +* Stddist_DISCR:: UNU.RAN Library of discrete univariate distributions +* Stddist_MATR:: UNU.RAN Library of random matrices + +Although it is not its primary target, many distributions are already +implemented in UNU.RAN. This section presents these available +distributions and their parameters. + + The syntax to get a distribuion object for distributions ‘’ +is: + + -- --: UNUR_DISTR* unur_distr_ (double* PARAMS, int N_PARAMS) + PARAMS is an array of doubles of size N_PARAMS holding the + parameters. + +E.g. to get an object for the gamma distribution (with shape parameter) +use + + unur_distr_gamma( params, 1 ); + +Distributions may have default parameters with need not be given +explicitely. E.g. The gamma distribution has three parameters: the +shape, scale and location parameter. Only the (first) shape parameter +is required. The others can be omitted and are then set by default +values. + + /* alpha = 5; default: beta = 1, gamma = 0 */ + double fpar[] = {5.}; + unur_distr_gamma( fpar, 1 ); + + /* alpha = 5, beta = 3; default: gamma = 0 */ + double fpar[] = {5., 3.}; + unur_distr_gamma( fpar, 2 ); + + /* alpha = 5, beta = 3, gamma = -2 + double fpar[] = {5., 3., -2.}; + unur_distr_gamma( fpar, 3 ); + + *Important:* Naturally the computational accuracy limits the possible +parameters. There shouldn’t be problems when the parameters of a +distribution are in a “reasonable” range but e.g. the normal +distribution N(10^15,1) won’t yield the desired results. (In this case +it would be better generating N(0,1) and _then_ transform the results.) + +Of course computational inaccuracy is not specific to UNU.RAN and should +always be kept in mind when working with computers. + + _Important:_ The routines of the standard library are included for +non-uniform random variate generation and not to provide special +functions for statistical computations. + +Remark +------ + +The following keywords are used in the tables: +PDF + probability density function, with variable x. + +PMF + probability mass function, with variable k. + +constant + normalization constant for given PDF and PMF, resp. They must be + multiplied by constant to get the “real” PDF and PMF. + +CDF + gives information whether the CDF is implemented in UNU.RAN. + +domain + domain PDF and PMF, resp. + +parameters N_STD (N_TOTAL): list + list of parameters for distribution, where N_STD is the number of + parameters for the standard form of the distribution and N_TOTAL + the total number for the (non-standard form of the) distribution. + LIST is the list of parameters in the order as they are stored in + the array of parameters. Optional parameter that can be omitted + are enclosed in square brackets ‘[...]’. + + A detailed list of these parameters gives then the range of valid + parameters and defaults for optional parameters that are used when + these are omitted. + +reference + gives reference for distribution (*note Bibliography::). + +special generators + lists available special generators for the distribution. The first + number is the variant that to be set by ‘unur_cstd_set_variant’ and + ‘unur_dstd_set_variant’ call, respectively. If no variant is set + the default variant ‘DEF’ is used. In the table the respective + abbreviations ‘DEF’ and ‘INV’ are used for ‘UNUR_STDGEN_DEFAULT’ + and ‘UNUR_STDGEN_INVERSION’. Also the references for these methods + are given (*note Bibliography::). + + Notice that these generators might be slower than universal + methods. + + If ‘DEF’ is ommited, the first entry is the default generator. + + +File: unuran.info, Node: Stddist_CONT, Next: Stddist_CVEC, Up: Stddist + +7.1 UNU.RAN Library of continuous univariate distributions +========================================================== + +* Menu: + +* F:: F-distribution +* beta:: Beta distribution +* cauchy:: Cauchy distribution +* chi:: Chi distribution +* chisquare:: Chisquare distribution +* exponential:: Exponential distribution +* extremeI:: Extreme value type I (Gumbel-type) distribution +* extremeII:: Extreme value type II (Frechet-type) distribution +* gamma:: Gamma distribution +* gig:: Generalized Inverse Gaussian distribution +* gig2:: Generalized Inverse Gaussian distribution +* hyperbolic:: Hyperbolic distribution +* ig:: Inverse Gaussian distribution +* laplace:: Laplace distribution +* logistic:: Logistic distribution +* lognormal:: Log-Normal distribution +* lomax:: Lomax distribution (Pareto distribution of second kind) +* normal:: Normal distribution +* pareto:: Pareto distribution (of first kind) +* powerexponential:: Powerexponential (Subbotin) distribution +* rayleigh:: Rayleigh distribution +* slash:: Slash distribution +* student:: Student’s t distribution +* triangular:: Triangular distribution +* uniform:: Uniform distribution +* weibull:: Weibull distribution + + +File: unuran.info, Node: F, Next: beta, Up: Stddist_CONT + +7.1.1 ‘F’ – F-distribution +-------------------------- + +PDF: + (x^(nu_1/2-1)) / (1+nu_1/nu_2 x)^((nu_1+nu_2)/2) + +constant: + (nu_1/nu_2)^(nu_1/2) / B(nu_1/2,nu_2/2) + +domain: + 0 < x < infinity + +parameters 2 (2): nu_1, nu_2 + No. name default + ‘[0]’ nu_1 > 0 (scale) + ‘[1]’ nu_2 > 0 (scale) +reference: + [JKBc95: Ch.27; p.322] + + +File: unuran.info, Node: beta, Next: cauchy, Prev: F, Up: Stddist_CONT + +7.1.2 ‘beta’ – Beta distribution +-------------------------------- + +PDF: + (x-a)^(p-1) * (b-x)^(q-1) + +constant: + 1 / (B(p,q) * (b-a)^(p+q-1)) + +domain: + a < x < b + +parameters 2 (4): p, q [, a, b ] + No. name default + ‘[0]’ p > 0 (scale) + ‘[1]’ q > 0 (scale) + ‘[2]’ a 0 (location, scale) + ‘[3]’ b > a 1 (location, scale) +reference: + [JKBc95: Ch.25; p.210] + + +File: unuran.info, Node: cauchy, Next: chi, Prev: beta, Up: Stddist_CONT + +7.1.3 ‘cauchy’ – Cauchy distribution +------------------------------------ + +PDF: + 1/(1 + ((x-theta)/lambda)^2) + +constant: + 1/(pi * lambda) + +domain: + -infinity < x < infinity + +parameters 0 (2): [ theta [, lambda ] ] + No. name default + ‘[0]’ theta 0 (location) + ‘[1]’ lambda > 0 1 (scale) +reference: + [JKBb94: Ch.16; p.299] + +special generators: + ‘INV’ + Inversion method + + +File: unuran.info, Node: chi, Next: chisquare, Prev: cauchy, Up: Stddist_CONT + +7.1.4 ‘chi’ – Chi distribution +------------------------------ + +PDF: + x^(nu-1) * exp( -x^2/2 ) + +constant: + 1 / (2^((nu/2)-1) * Gamma(nu/2)) + +domain: + 0 <= x < infinity + +parameters 1 (1): nu + No. name default + ‘[0]’ nu > 0 (shape) +reference: + [JKBb94: Ch.18; p.417] + +special generators: + ‘DEF’ + Ratio of Uniforms with shift (only for nu >= 1) [MJa87] + + +File: unuran.info, Node: chisquare, Next: exponential, Prev: chi, Up: Stddist_CONT + +7.1.5 ‘chisquare’ – Chisquare distribution +------------------------------------------ + +PDF: + x^((nu/2)-1) * exp( -x/2 ) + +constant: + 1 / (2^(nu/2) * Gamma(nu/2)) + +domain: + 0 <= x < infinity + +parameters 1 (1): nu + No. name default + ‘[0]’ nu > 0 (shape (degrees of + freedom)) +reference: + [JKBb94: Ch.18; p.416] + + +File: unuran.info, Node: exponential, Next: extremeI, Prev: chisquare, Up: Stddist_CONT + +7.1.6 ‘exponential’ – Exponential distribution +---------------------------------------------- + +PDF: + exp( -(x-theta)/sigma) + +constant: + 1/sigma + +domain: + theta <= x < infinity + +parameters 0 (2): [ sigma [, theta ] ] + No. name default + ‘[0]’ sigma > 0 1 (scale) + ‘[1]’ theta 0 (location) +reference: + [JKBb94: Ch.19; p.494] + +special generators: + ‘INV’ + Inversion method + + +File: unuran.info, Node: extremeI, Next: extremeII, Prev: exponential, Up: Stddist_CONT + +7.1.7 ‘extremeI’ – Extreme value type I (Gumbel-type) distribution +------------------------------------------------------------------ + +PDF: + exp( -exp( -(x-zeta)/theta ) - (x-zeta)/theta ) + +constant: + 1/theta + +domain: + -infinity < x 0 1 (scale) +reference: + [JKBc95: Ch.22; p.2] + +special generators: + ‘INV’ + Inversion method + + +File: unuran.info, Node: extremeII, Next: gamma, Prev: extremeI, Up: Stddist_CONT + +7.1.8 ‘extremeII’ – Extreme value type II (Frechet-type) distribution +--------------------------------------------------------------------- + +PDF: + exp( -((x-zeta)/theta)^(-k)) * ((x-zeta)/theta)^(-k-1) + +constant: + k/theta + +domain: + zeta < x 0 (shape) + ‘[1]’ zeta 0 (location) + ‘[2]’ theta > 0 1 (scale) +reference: + [JKBc95: Ch.22; p.2] + +special generators: + ‘INV’ + Inversion method + + +File: unuran.info, Node: gamma, Next: gig, Prev: extremeII, Up: Stddist_CONT + +7.1.9 ‘gamma’ – Gamma distribution +---------------------------------- + +PDF: + ((x-gamma)/beta)^(alpha-1) * exp( -(x-gamma)/beta ) + +constant: + 1 / (beta * Gamma(alpha)) + +domain: + gamma < x < infinity + +parameters 1 (3): alpha [, beta [, gamma ] ] + No. name default + ‘[0]’ alpha > 0 (shape) + ‘[1]’ beta > 0 1 (scale) + ‘[2]’ gamma 0 (location) +reference: + [JKBb94: Ch.17; p.337] + +special generators: + ‘DEF’ + Acceptance Rejection combined with Acceptance Complement + [ADa74] [ADa82] + ‘2’ + Rejection from log-logistic envelopes [CHa77] + + +File: unuran.info, Node: gig, Next: gig2, Prev: gamma, Up: Stddist_CONT + +7.1.10 ‘gig’ – Generalized Inverse Gaussian distribution +-------------------------------------------------------- + +PDF: + x^(theta-1) * exp( -1/2 * omega * (x/eta + eta/x)) + +constant: + not implemented! + +CDF: + not implemented! + +domain: + 0 < x 0 (scale) + ‘[2]’ eta > 0 1 (shape) +reference: + [JKBb94: Ch.15; p.84] + +special generators: + ‘DEF’ + Ratio-of-Uniforms method [Dag89] + + +File: unuran.info, Node: gig2, Next: hyperbolic, Prev: gig, Up: Stddist_CONT + +7.1.11 ‘gig2’ – Generalized Inverse Gaussian distribution +--------------------------------------------------------- + +PDF: + x^(theta-1) * exp( -1/2 * (chi/x + psi*x)) + +constant: + not implemented! + +CDF: + not implemented! + +domain: + 0 < x 0 (shape) + ‘[2]’ chi > 0 (shape) +reference: + [JKBb94: Ch.15; p.84] + + +File: unuran.info, Node: hyperbolic, Next: ig, Prev: gig2, Up: Stddist_CONT + +7.1.12 ‘hyperbolic’ – Hyperbolic distribution +--------------------------------------------- + +PDF: + exp( -alpha * sqrt(delta^2 + (x - mu)^2) + beta*(x-mu) ) + +constant: + not implemented! + +CDF: + not implemented! + +domain: + -infinity < x |beta| (shape (tail)) + ‘[1]’ beta (shape (asymmetry)) + ‘[2]’ delta > 0 (scale) + ‘[3]’ mu (location) + + +File: unuran.info, Node: ig, Next: laplace, Prev: hyperbolic, Up: Stddist_CONT + +7.1.13 ‘ig’ – Inverse Gaussian distribution +------------------------------------------- + +PDF: + sqrt( lambda/2*pi*x^3 ) * exp( -(lambda*(x-mu)^2)/2*mu^2*x ) + +constant: + 1 + +CDF: + not implemented! + +domain: + 0 < x 0 (mean) + ‘[1]’ lambda > 0 (shape) +reference: + [JKBb94: Ch.15; p.259] + + +File: unuran.info, Node: laplace, Next: logistic, Prev: ig, Up: Stddist_CONT + +7.1.14 ‘laplace’ – Laplace distribution +--------------------------------------- + +PDF: + exp( -|x-theta| / phi ) + +constant: + 1/(2 * phi) + +domain: + -infinity < x 0 1 (scale) +reference: + [JKBc95: Ch.24; p.164] + +special generators: + ‘INV’ + Inversion method + + +File: unuran.info, Node: logistic, Next: lognormal, Prev: laplace, Up: Stddist_CONT + +7.1.15 ‘logistic’ – Logistic distribution +----------------------------------------- + +PDF: + exp(-(x-alpha)/beta) * (1 + exp(-(x-alpha)/beta))^(-2) + +constant: + 1/beta + +domain: + -infinity < x 0 1 (scale) +reference: + [JKBc95: Ch.23; p.115] + +special generators: + ‘INV’ + Inversion method + + +File: unuran.info, Node: lognormal, Next: lomax, Prev: logistic, Up: Stddist_CONT + +7.1.16 ‘lognormal’ – Log-Normal distribution +-------------------------------------------- + +PDF: + 1/(x-theta) * exp( -(log(x-theta)-zeta)^2/(2 sigma^2) ) + +constant: + 1/(sigma * sqrt(2 pi)) + +domain: + theta <= x < infinity + +parameters 2 (3): zeta, sigma [, theta ] + No. name default + ‘[0]’ zeta (shape) + ‘[1]’ sigma > 0 (shape) + ‘[2]’ theta 0 (location) +reference: + [JKBb94: Ch.14; p. 208] + + +File: unuran.info, Node: lomax, Next: normal, Prev: lognormal, Up: Stddist_CONT + +7.1.17 ‘lomax’ – Lomax distribution (Pareto distribution of second kind) +------------------------------------------------------------------------ + +PDF: + (x+C)^(-(a+1)) + +constant: + a * C^a + +domain: + 0 <= x < infinity + +parameters 1 (2): a [, C ] + No. name default + ‘[0]’ a > 0 (shape) + ‘[1]’ C > 0 1 (scale) +reference: + [JKBb94: Ch.20; p.575] + +special generators: + ‘INV’ + Inversion method + + +File: unuran.info, Node: normal, Next: pareto, Prev: lomax, Up: Stddist_CONT + +7.1.18 ‘normal’ – Normal distribution +------------------------------------- + +PDF: + exp( -1/2 * ((x-mu)/sigma)^2 ) + +constant: + 1 / (sigma * sqrt(2 pi)) + +domain: + -infinity < x < infinity + +parameters 0 (2): [ mu [, sigma ] ] + No. name default + ‘[0]’ mu 0 (location) + ‘[1]’ sigma > 0 1 (scale) +reference: + [JKBb94: Ch.13; p.80] + +special generators: + ‘DEF’ + ACR method (Acceptance-Complement Ratio) [HDa90] + ‘1’ + Box-Muller method [BMa58] + ‘2’ + Polar method with rejection [MGa62] + ‘3’ + Kindermann-Ramage method [KRa76] + ‘INV’ + Inversion method (slow) + + +File: unuran.info, Node: pareto, Next: powerexponential, Prev: normal, Up: Stddist_CONT + +7.1.19 ‘pareto’ – Pareto distribution (of first kind) +----------------------------------------------------- + +PDF: + x^(-(a+1)) + +constant: + a * k^a + +domain: + k < x < infinity + +parameters 2 (2): k, a + No. name default + ‘[0]’ k > 0 (shape, location) + ‘[1]’ a > 0 (shape) +reference: + [JKBb94: Ch.20; p.574] + +special generators: + ‘INV’ + Inversion method + + +File: unuran.info, Node: powerexponential, Next: rayleigh, Prev: pareto, Up: Stddist_CONT + +7.1.20 ‘powerexponential’ – Powerexponential (Subbotin) distribution +-------------------------------------------------------------------- + +PDF: + exp( -|x|^tau ) + +constant: + 1 / (2 * Gamma(1+1/tau)) + +domain: + -infinity < x < infinity + +parameters 1 (1): tau + No. name default + ‘[0]’ tau > 0 (shape) +reference: + [JKBc95: Ch.24; p.195] + +special generators: + ‘DEF’ + Transformed density rejection (only for tau >= 1) [DLa86] + + +File: unuran.info, Node: rayleigh, Next: slash, Prev: powerexponential, Up: Stddist_CONT + +7.1.21 ‘rayleigh’ – Rayleigh distribution +----------------------------------------- + +PDF: + x * exp( -1/2 * (x/sigma)^2 ) + +constant: + 1 / sigma^2 + +domain: + 0 <= x < infinity + +parameters 1 (1): sigma + No. name default + ‘[0]’ sigma > 0 (scale) +reference: + [JKBb94: Ch.18; p.456] + + +File: unuran.info, Node: slash, Next: student, Prev: rayleigh, Up: Stddist_CONT + +7.1.22 ‘slash’ – Slash distribution +----------------------------------- + +PDF: + (1 - exp(-x^2/2)) / x^2 + +constant: + 1 / sqrt(2 pi) + +CDF: + not implemented! + +domain: + -infinity < x < infinity + +reference: + [JKBb94: Ch.12; p.63] + +special generators: + ‘DEF’ + Ratio of normal and uniform random variates + + +File: unuran.info, Node: student, Next: triangular, Prev: slash, Up: Stddist_CONT + +7.1.23 ‘student’ – Student’s t distribution +------------------------------------------- + +PDF: + (1+t^2/nu)^(-(nu+1)/2) + +constant: + 1 / (sqrt(nu) * B(1/2,nu/2)) + +CDF: + not implemented! + +domain: + -infinity < x < infinity + +parameters 1 (1): nu + No. name default + ‘[0]’ nu > 0 (shape) +reference: + [JKBc95: Ch.28; p.362] + + +File: unuran.info, Node: triangular, Next: uniform, Prev: student, Up: Stddist_CONT + +7.1.24 ‘triangular’ – Triangular distribution +--------------------------------------------- + +PDF: + 2*x / H, for 0 <= x <= H + + 2*(1-x) / (1-H), for H <= x <= 1 + +constant: + 1 + +domain: + 0 <= x <= 1 + +parameters 0 (1): [ H ] + No. name default + ‘[0]’ H 0 <= H <= 1 1/2 (shape) +reference: + [JKBc95: Ch.26; p.297] + +special generators: + ‘INV’ + Inversion method + + +File: unuran.info, Node: uniform, Next: weibull, Prev: triangular, Up: Stddist_CONT + +7.1.25 ‘uniform’ – Uniform distribution +--------------------------------------- + +PDF: + 1 / (b-a) + +constant: + 1 + +domain: + a < x < b + +parameters 0 (2): [ a, b ] + No. name default + ‘[0]’ a 0 (location) + ‘[1]’ b > a 1 (location) +reference: + [JKBc95: Ch.26; p.276] + +special generators: + ‘INV’ + Inversion method + + +File: unuran.info, Node: weibull, Prev: uniform, Up: Stddist_CONT + +7.1.26 ‘weibull’ – Weibull distribution +--------------------------------------- + +PDF: + ((x-zeta)/alpha)^(c-1) * exp( -((x-zeta)/alpha)^c ) + +constant: + c / alpha + +domain: + zeta < x < infinity + +parameters 1 (3): c [, alpha [, zeta ] ] + No. name default + ‘[0]’ c > 0 (shape) + ‘[1]’ alpha > 0 1 (scale) + ‘[2]’ zeta 0 (location) +reference: + [JKBb94: Ch.21; p.628] + +special generators: + ‘INV’ + Inversion method + + +File: unuran.info, Node: Stddist_CVEC, Next: Stddist_DISCR, Prev: Stddist_CONT, Up: Stddist + +7.2 UNU.RAN Library of continuous multivariate distributions +============================================================ + +* Menu: + +* copula:: Copula (distribution with uniform marginals) +* multicauchy:: Multicauchy distribution +* multiexponential:: Multiexponential distribution +* multinormal:: Multinormal distribution +* multistudent:: Multistudent distribution + + +File: unuran.info, Node: copula, Next: multicauchy, Up: Stddist_CVEC + +7.2.1 ‘copula’ – Copula (distribution with uniform marginals) +------------------------------------------------------------- + + ‘UNUR_DISTR *unur_distr_copula(int dim, const double *rankcorr)’ +creates a distribution object for a copula with DIM components. +RANKCORR is an array of size DIMxDIM and holds the rank correlation +matrix (Spearman’s correlation), where the rows of the matrix are stored +consecutively in this array. The ‘NULL’ pointer can be used instead the +identity matrix. + + If COVAR is not a valid rank correlation matrix (i.e., not positive +definite) then no distribution object is created and ‘NULL’ is returned. + + +File: unuran.info, Node: multicauchy, Next: multiexponential, Prev: copula, Up: Stddist_CVEC + +7.2.2 ‘multicauchy’ – Multicauchy distribution +---------------------------------------------- + +PDF: + f(x) = 1 / ( 1 + (x-mu)^t . Sigma^(-1) . (x-mu) )^((dim+1)/2) + +constant: + Gamma((dim+1)/2) / ( pi^((dim+1)/2) * sqrt(det(Sigma)) ) + +domain: + -infinity^(dim) < x < infinity^(dim) + +parameters 0 (2): [ mu, Sigma ] + No. name default + ‘[0]’ mu (0,...,0) (location) + ‘[1]’ Sigma Symm, Pos. I (shape) + def. +special generators: + ‘DEF’ + Cholesky factor + + +File: unuran.info, Node: multiexponential, Next: multinormal, Prev: multicauchy, Up: Stddist_CVEC + +7.2.3 ‘multiexponential’ – Multiexponential distribution +-------------------------------------------------------- + +PDF: + f(x) = Prod_(i=0)^(i=dim-1) exp(-(dim-i) (x_(i)-x_(i-1) - + (theta_i-theta_(i-1)) ) / sigma_i); with x_(-1)=0 and theta_(i-1)=0 + +constant: + Prod_(i=0)^(i=dim-1) 1/sigma_i + +domain: + 0^(dim) <= x < infinity^(dim) + +parameters 0 (2): [ sigma, theta ] + No. name default + ‘[0]’ sigma (1,...,1) (shape) + ‘[1]’ theta (0,...,0) (location) + + +File: unuran.info, Node: multinormal, Next: multistudent, Prev: multiexponential, Up: Stddist_CVEC + +7.2.4 ‘multinormal’ – Multinormal distribution +---------------------------------------------- + +PDF: + f(x) = exp( -1/2 * (x-mu)^t . Sigma^(-1) . (x-mu) ) + +constant: + 1 / ( (2 pi)^(dim/2) * sqrt(det(Sigma)) ) + +domain: + -infinity^(dim) < x < infinity^(dim) + +parameters 0 (2): [ mu, Sigma ] + No. name default + ‘[0]’ mu (0,...,0) (location) + ‘[1]’ Sigma Symm, Pos. I (shape) + def. +reference: + [KBJe00: Ch.45; p.105] + + +File: unuran.info, Node: multistudent, Prev: multinormal, Up: Stddist_CVEC + +7.2.5 ‘multistudent’ – Multistudent distribution +------------------------------------------------ + +PDF: + f(x) = 1 / ( 1 + (x-mu)^t . Sigma^(-1) . (x-mu) / m)^((dim+m)/2) + ) + +constant: + Gamma((dim+m)/2) / ( Gamma(m/2) (m*pi)^(dim/2) * sqrt(det(Sigma)) ) + +domain: + -infinity^(dim) < x < infinity^(dim) + +parameters 0 (3): [ m, mu, Sigma ] + No. name default + ‘[0]’ m m>0 1 (location) + ‘[1]’ mu (0,...,0) (location) + ‘[2]’ Sigma Symm, Pos. I (shape) + def. + + +File: unuran.info, Node: Stddist_DISCR, Next: Stddist_MATR, Prev: Stddist_CVEC, Up: Stddist + +7.3 UNU.RAN Library of discrete univariate distributions +======================================================== + +* Menu: + +* binomial:: Binomial distribution +* geometric:: Geometric distribution +* hypergeometric:: Hypergeometric distribution +* logarithmic:: Logarithmic distribution +* negativebinomial:: Negative Binomial distribution +* poisson:: Poisson distribution + +At the moment there are no CDFs implemented for discrete distribution. +Thus ‘unur_distr_discr_upd_pmfsum’ does not work properly for truncated +distribution. + + +File: unuran.info, Node: binomial, Next: geometric, Up: Stddist_DISCR + +7.3.1 ‘binomial’ – Binomial distribution +---------------------------------------- + +PMF: + (n \choose k) * p^k * (1-p)^(n-k) + +constant: + 1 + +domain: + 0 <= k <= n + +parameters 2 (2): n, p + No. name default + ‘[0]’ n >= 1 (no. of elements) + ‘[1]’ p 0 < p < 1 (shape) +reference: + [JKKa92: Ch.3; p.105] + +special generators: + ‘DEF’ + Ratio of Uniforms/Inversion [STa89] + + +File: unuran.info, Node: geometric, Next: hypergeometric, Prev: binomial, Up: Stddist_DISCR + +7.3.2 ‘geometric’ – Geometric distribution +------------------------------------------ + +PMF: + p * (1-p)^k + +constant: + 1 + +domain: + 0 <= k < infinity + +parameters 1 (1): p + No. name default + ‘[0]’ p 0 < p < 1 (shape) +reference: + [JKKa92: Ch.5.2; p.201] + +special generators: + ‘INV’ + Inversion method + + +File: unuran.info, Node: hypergeometric, Next: logarithmic, Prev: geometric, Up: Stddist_DISCR + +7.3.3 ‘hypergeometric’ – Hypergeometric distribution +---------------------------------------------------- + +PMF: + (M \choose k) * (N-M \choose n-k) / (N \choose n) + +constant: + 1 + +domain: + max(0,n-N+M) <= k <= min(n,M) + +parameters 3 (3): N, M, n + No. name default + ‘[0]’ N >= 1 (no. of elements) + ‘[1]’ M 1 <= M <= N (shape) + ‘[2]’ n 1 <= n <= N (shape) +reference: + [JKKa92: Ch.6; p.237] + +special generators: + ‘DEF’ + Ratio of Uniforms/Inversion [STa89] + + +File: unuran.info, Node: logarithmic, Next: negativebinomial, Prev: hypergeometric, Up: Stddist_DISCR + +7.3.4 ‘logarithmic’ – Logarithmic distribution +---------------------------------------------- + +PMF: + theta^k / k + +constant: + - log( 1.-theta); + +domain: + 1 <= k < infinity + +parameters 1 (1): theta + No. name default + ‘[0]’ theta 0 < theta < (shape) + 1 +reference: + [JKKa92: Ch.7; p.285] + +special generators: + ‘DEF’ + Inversion/Transformation [KAa81] + + +File: unuran.info, Node: negativebinomial, Next: poisson, Prev: logarithmic, Up: Stddist_DISCR + +7.3.5 ‘negativebinomial’ – Negative Binomial distribution +--------------------------------------------------------- + +PMF: + (k+r-1 \choose r-1) * p^r * (1-p)^k + +constant: + 1 + +domain: + 0 <= k < infinity + +parameters 2 (2): p, r + No. name default + ‘[0]’ p 0 < p < 1 (shape) + ‘[1]’ r > 0 (shape) +reference: + [JKKa92: Ch.5.1; p.200] + + +File: unuran.info, Node: poisson, Prev: negativebinomial, Up: Stddist_DISCR + +7.3.6 ‘poisson’ – Poisson distribution +-------------------------------------- + +PMF: + theta^k / k! + +constant: + exp(theta) + +domain: + 0 <= k < infinity + +parameters 1 (1): theta + No. name default + ‘[0]’ theta > 0 (shape) +reference: + [JKKa92: Ch.4; p.151] + +special generators: + ‘DEF’ + Tabulated Inversion combined with Acceptance Complement + [ADb82] + ‘2’ + Tabulated Inversion combined with Patchwork Rejection [ZHa94] + + +File: unuran.info, Node: Stddist_MATR, Prev: Stddist_DISCR, Up: Stddist + +7.4 UNU.RAN Library of random matrices +====================================== + +* Menu: + +* correlation:: Random correlation matrix + + +File: unuran.info, Node: correlation, Up: Stddist_MATR + +7.4.1 ‘correlation’ – Random correlation matrix +----------------------------------------------- + + ‘UNUR_DISTR *unur_distr_correlation( int n )’ creates a distribution +object for a random correlation matrix of N rows and columns. It can be +used with method MCORR (*note Random Correlation Matrix: MCORR.) to +generate random correlation matrices of the given size. + + +File: unuran.info, Node: Error_Debug, Next: Testing, Prev: Stddist, Up: Top + +8 Error handling and Debugging +****************************** + +* Menu: + +* Output_streams:: Output streams +* Debug:: Debugging +* Error_reporting:: Error reporting +* Errno:: Error codes +* Error_handlers:: Error handlers + +UNU.RAN routines report an error whenever they cannot perform the +requested task. Additionally it is possible to get information about +the generated distribution of generator objects for debugging purposes. +However, the latter must be enabled when compiling and installing the +library. (It is disabled by default.) This chapter describes all +necessary details: + + • Choose an output stream to for writing the requested information. + • Select a debugging level. + • Select an error handler. + • Write your own error handler. + • Get more information for a particular error code. + + +File: unuran.info, Node: Output_streams, Next: Debug, Up: Error_Debug + +8.1 Output streams +================== + +UNU.RAN uses a logfile for writing all error messages, warnings, and +debugging information onto an output stream. This stream can be set at +runtime by the ‘unur_set_stream’ call. If no such stream is given by +the user a default stream is used by the library: all messages are +written into the file ‘unuran.log’ in the current working directory. +The name of this logfile is defined by the macro ‘UNUR_LOG_FILE’ in +‘unuran_config.h’. (If UNU.RAN fails to open this file for writing, +‘stderr’ is used instead.) + + To destinguish between messages for different objects each of these +has its own identifier which is composed by the name of the distribution +obejct and generator type, resp., followed by a dot and three digits. +(If there are more than 999 generators then the identifiers are not +unique.) + + _Remark:_ Writting debugging information must be switched on at +compile time using the configure flag ‘--enable-logging’, see *note +Debugging: Debug. + +Function reference +------------------ + + -- Function: FILE* unur_set_stream (FILE* NEW_STREAM) + This function sets a new file handler for the output stream, + NEW_STREAM, for the UNU.RAN library routines. The previous handler + is returned (so that you can restore it later). Note that the + pointer to a user defined file handler is stored in a static + variable, so there can be only one output stream handler per + program. This function should be not be used in multi-threaded + programs except to set up a program-wide error handler from a + master thread. + + The ‘NULL’ pointer is not allowed. (If you want to disable logging + of debugging information use unur_set_default_debug(UNUR_DEBUG_OFF) + instead. If you want to disable error messages at all use + ‘unur_set_error_handler_off’. ) + + -- Function: FILE* unur_get_stream (void) + Get the file handle for the current output stream. It can be used + to allow applications to write additional information into the + logfile. + + +File: unuran.info, Node: Debug, Next: Error_reporting, Prev: Output_streams, Up: Error_Debug + +8.2 Debugging +============= + +The UNU.RAN library has several debugging levels which can be switched +on/off by debugging flags. This debugging feature must be enabled when +building the library using the ‘--enable-logging’ configure flag. + + The debugging levels range from print a short description of the +created generator object to a detailed description of hat functions and +tracing the sampling routines. The output is printed onto the debugging +output stream (*note Output streams: Output_streams.). + + The debugging flags can be set or changed by the respective calls +‘unur_set_debug’ and ‘unur_chg_debug’ independently for each generator. + + By default flag ‘UNUR_DEBUG_INIT’ (see below) is used. This default +flags is set by the macro ‘UNUR_DEBUGFLAG_DEFAULT’ in ‘unuran_config.h’ +and can be changed at runtime by a ‘unur_set_default_debug’ call. + + Off course these debugging flags depend on the chosen method. Since +most of these are merely for debugging the library itself, a description +of the flags are given in the corresponding source files of the method. +Nevertheless, the following flags can be used with all methods. + + Common debug flags: + +‘UNUR_DEBUG_OFF’ + switch off all debuging information +‘UNUR_DEBUG_ALL’ + all avaivable information +‘UNUR_DEBUG_INIT’ + parameters of generator object after initialization +‘UNUR_DEBUG_SETUP’ + data created at setup +‘UNUR_DEBUG_ADAPT’ + data created during adaptive steps +‘UNUR_DEBUG_SAMPLE’ + trace sampling + + Notice that these are flags which could be combined using the ‘|’ +operator. + + Almost all routines check a given pointer before they read from or +write to the given address. This does not hold for time-critical +routines like all sampling routines. Thus you are responsible for +checking a pointer that is returned from a ‘unur_init’ call. However, +it is possible to turn on checking for invalid ‘NULL’ pointers even in +such time-critical routines by building the library using the +‘--enable-check-struct’ configure flag. + + Another debugging tool used in the library are magic cookies that +validate a given pointer. It produces an error whenever a given pointer +points to an object that is invalid in the context. The usage of magic +cookies is also switched on by the ‘--enable-check-struct’ configure +flag. + +Function reference +------------------ + + -- Function: int unur_set_debug (UNUR_PAR* PARAMETERS, unsigned DEBUG) + Set debugging flags for generator. + + -- Function: int unur_chg_debug (UNUR_GEN* GENERATOR, unsigned DEBUG) + Change debugging flags for generator. + + -- Function: int unur_set_default_debug (unsigned DEBUG) + Change default debugging flag. + + +File: unuran.info, Node: Error_reporting, Next: Errno, Prev: Debug, Up: Error_Debug + +8.3 Error reporting +=================== + +UNU.RAN routines report an error whenever they cannot perform the +requested task. For example, applying transformed density rejection to +a distribution that violates the T-concavity condition, or trying to set +a parameter that is out of range, result in an error message. It might +also happen that the setup fails for transformed density rejection for a +T-concave distribution with some extreme density function simply because +of round-off errors that makes the generation of a hat function +numerically impossible. Situations like this may happen when using +black box algorithms and you should check the return values of all +routines. + + All ‘..._set_...’, and ‘..._chg_...’ calls return ‘UNUR_SUCCESS’ if +they could be executed successfully. Otherwise, some error codes are +returned if it was not possible to set or change the desired parameters, +e.g. because the given values are out of range, or simply because the +set call does not work for the chosen method. + + All routines that return a pointer to the requested object will +return a ‘NULL’ pointer in case of error. (Thus you should always check +the pointer to avoid possible segmentation faults. Sampling routines +usually do not check the given pointer to the generator object.) + + The library distinguishes between two major classes of error: + +_(fatal) errors:_ + The library was not able to construct the requested object. + +_warnings:_ + Some problems encounters while constructing a generator object. + The routine has tried to solve the problem but the resulting object + might not be what you want. For example, chosing a special variant + of a method does not work and the initialization routine might + switch to another variant. Then the generator produces random + variates of the requested distribution but correlation induction is + not possible. However, it also might happen that changing the + domain of a distribution has failed. Then the generator produced + random variates with too large/too small range, i.e. their + distribution is not correct. + + It is obvious from the example that this distinction between errors +and warning is rather crude and sometimes arbitrary. + + UNU.RAN routines use the global variable UNUR_ERRNO to report errors, +completely analogously to ERRNO in the ANSI C standard library. +(However this approach is not thread-safe. There can be only one +instance of a global variable per program. Different threads of +execution may overwrite UNUR_ERRNO simultaneously). Thus when an error +occurs the caller of the routine can examine the error code in +UNUR_ERRNO to get more details about the reason why a routine failed. +You get a short description of the error by a ‘unur_get_strerror’ call. +All the error code numbers have prefix ‘UNUR_ERR_’ and expand to +non-zero constant unsigned integer values. Error codes are divided into +six main groups, see *note Error codes: Errno. + + Alternatively, the variable UNUR_ERRNO can also read by a +‘unur_get_errno’ call and can be reset by the ‘unur_reset_errno’ call +(this is in particular required for the Windows version of the library). + + Additionally, there exists a error handler (*note Error handlers: +Error_handlers.) that is invoked in case of an error. + + In addition to reporting errors by setting error codes in UNUR_ERRNO, +the library also has an error handler function. This function is called +by other library functions when they report an error, just before they +return to the caller (*note Error handlers: Error_handlers.). The +default behavior of the error handler is to print a short message: + + AROU.004: [error] arou.c:1500 - (generator) condition for method violated: + AROU.004: ..> PDF not unimodal + + The purpose of the error handler is to provide a function where a +breakpoint can be set that will catch library errors when running under +the debugger. It is not intended for use in production programs, which +should handle any errors using the return codes. + +Function reference +------------------ + + -- Variable: extern int unur_errno + Global variable for reporting diagnostics of error. + + -- Function: int unur_get_errno (void) + Get current value of global variable UNUR_ERRNO. + + -- Function: void unur_reset_errno (void) + Reset global variable UNUR_ERRNO to ‘UNUR_SUCCESS’ (i.e., no errors + occured). + + -- Function: const char* unur_get_strerror (const INT ERRNOCODE) + Get a short description for error code value. + + +File: unuran.info, Node: Errno, Next: Error_handlers, Prev: Error_reporting, Up: Error_Debug + +8.4 Error codes +=============== + +List of error codes +................... + + • Procedure executed successfully (no error) + ‘UNUR_SUCCESS (0x0u)’ + success (no error) + + • Errors that occurred while handling distribution objects. + ‘UNUR_ERR_DISTR_SET’ + set failed (invalid parameter). + ‘UNUR_ERR_DISTR_GET’ + get failed (parameter not set). + ‘UNUR_ERR_DISTR_NPARAMS’ + invalid number of parameters. + ‘UNUR_ERR_DISTR_DOMAIN’ + parameter(s) out of domain. + ‘UNUR_ERR_DISTR_GEN’ + invalid variant for special generator. + ‘UNUR_ERR_DISTR_REQUIRED’ + incomplete distribution object, entry missing. + ‘UNUR_ERR_DISTR_UNKNOWN’ + unknown distribution, cannot handle. + ‘UNUR_ERR_DISTR_INVALID’ + invalid distribution object. + ‘UNUR_ERR_DISTR_DATA’ + data are missing. + ‘UNUR_ERR_DISTR_PROP’ + desired property does not exist + + • Errors that occurred while handling parameter objects. + ‘UNUR_ERR_PAR_SET’ + set failed (invalid parameter) + ‘UNUR_ERR_PAR_VARIANT’ + invalid variant -> using default + ‘UNUR_ERR_PAR_INVALID’ + invalid parameter object + + • Errors that occurred while handling generator objects. + ‘UNUR_ERR_GEN’ + error with generator object. + ‘UNUR_ERR_GEN_DATA’ + (possibly) invalid data. + ‘UNUR_ERR_GEN_CONDITION’ + condition for method violated. + ‘UNUR_ERR_GEN_INVALID’ + invalid generator object. + ‘UNUR_ERR_GEN_SAMPLING’ + sampling error. + ‘UNUR_ERR_NO_REINIT’ + reinit routine not implemented. + ‘UNUR_ERR_NO_QUANTILE’ + quantile routine not implemented. + + • Errors that occurred while handling URNG objects. + ‘UNUR_ERR_URNG’ + generic error with URNG object. + ‘UNUR_ERR_URNG_MISS’ + missing functionality. + + • Errors that occurred while parsing strings. + ‘UNUR_ERR_STR’ + error in string. + ‘UNUR_ERR_STR_UNKNOWN’ + unknown keyword. + ‘UNUR_ERR_STR_SYNTAX’ + syntax error. + ‘UNUR_ERR_STR_INVALID’ + invalid parameter. + ‘UNUR_ERR_FSTR_SYNTAX’ + syntax error in function string. + ‘UNUR_ERR_FSTR_DERIV’ + cannot derivate function. + + • Other run time errors. + ‘UNUR_ERR_DOMAIN’ + argument out of domain. + ‘UNUR_ERR_ROUNDOFF’ + (serious) round-off error. + ‘UNUR_ERR_MALLOC’ + virtual memory exhausted. + ‘UNUR_ERR_NULL’ + invalid ‘NULL’ pointer. + ‘UNUR_ERR_COOKIE’ + invalid cookie. + ‘UNUR_ERR_GENERIC’ + generic error. + ‘UNUR_ERR_SILENT’ + silent error (no error message). + ‘UNUR_ERR_INF’ + infinity occured. + ‘UNUR_ERR_NAN’ + NaN occured. + ‘UNUR_ERR_COMPILE’ + Requested routine requires different compilation switches. + Recompilation of library necessary. + ‘UNUR_ERR_SHOULD_NOT_HAPPEN’ + Internal error, that should not happen. Please report this + bug! + + +File: unuran.info, Node: Error_handlers, Prev: Errno, Up: Error_Debug + +8.5 Error handlers +================== + +The default behavior of the UNU.RAN error handler is to print a short +message onto the output stream, usually a logfile (*note Output streams: +Output_streams.), e.g., + + AROU.004: [error] arou.c:1500 - (generator) condition for method violated: + AROU.004: ..> PDF not unimodal + + This error handler can be switched off using the +‘unur_set_error_handler_off’ call, or replace it by a new one. Thus it +allows to set a breakpoint that will catch library errors when running +under the debugger. It also can be used to redirect error messages when +UNU.RAN is included in general purpose libraries or in interactive +programming environments. + + -- Data Type: UNUR_ERROR_HANDLER + + This is the type of UNU.RAN error handler functions. An error + handler will be passed six arguments which specify the identifier + of the object where the error occured (a string), the name of the + source file in which it occurred (also a string), the line number + in that file (an integer), the type of error (a string: ‘"error"’ + or ‘"warning"’), the error number (an integert), and the reason for + the error (a string). The source file and line number are set at + compile time using the ‘__FILE__’ and ‘__LINE__’ directives in the + preprocessor. The error number can be translated into a short + description using a ‘unur_get_strerror’ call. An error handler + function returns type ‘void’. + + Error handler functions should be defined like this, + void my_handler( + const char *objid, + const char *file, + int line, + const char *errortype, + int unur_errno, + const char *reason ) + + To request the use of your own error handler you need the call +‘unur_set_error_handler’. + +Function reference +------------------ + + -- Function: UNUR_ERROR_HANDLER* unur_set_error_handler + (UNUR_ERROR_HANDLER* NEW_HANDLER) + This function sets a new error handler, NEW_HANDLER, for the + UNU.RAN library routines. The previous handler is returned (so + that you can restore it later). Note that the pointer to a user + defined error handler function is stored in a static variable, so + there can be only one error handler per program. This function + should be not be used in multi-threaded programs except to set up a + program-wide error handler from a master thread. + + To use the default behavior set the error handler to ‘NULL’. + + -- Function: UNUR_ERROR_HANDLER* unur_set_error_handler_off (void) + This function turns off the error handler by defining an error + handler which does nothing (except of setting UNUR_ERRNO. The + previous handler is returned (so that you can restore it later). + + +File: unuran.info, Node: Testing, Next: Misc, Prev: Error_Debug, Up: Top + +9 Testing +********* + +The following routines can be used to test the performance of the +implemented generators and can be used to verify the implementions. +They are declared in ‘unuran_tests.h’ which has to be included. + +Function reference +------------------ + + -- Function: void unur_run_tests (UNUR_PAR* PARAMETERS, unsigned TESTS, + FILE* OUT) + Run a battery of tests. The following tests are available (use ‘|’ + to combine these tests): + ‘UNUR_TEST_ALL’ + run all possible tests. + ‘UNUR_TEST_TIME’ + estimate generation times. + ‘UNUR_TEST_N_URNG’ + count number of uniform random numbers + ‘UNUR_TEST_N_PDF’ + count number of PDF calls + ‘UNUR_TEST_CHI2’ + run chi^2 test for goodness of fit + ‘UNUR_TEST_SAMPLE’ + print a small sample. + All these tests can be started individually (see below). + + -- Function: void unur_test_printsample (UNUR_GEN* GENERATOR, int + N_ROWS, int N_COLS, FILE* OUT) + Print a small sample with N_ROWS rows and N_COLS columns. OUT is + the output stream to which all results are written. + + -- Function: UNUR_GEN* unur_test_timing (UNUR_PAR* PARAMETERS, int + LOG10_SAMPLESIZE, double* TIME_SETUP, double* TIME_SAMPLE, int + VERBOSITY, FILE* OUT) + Timing. PARAMETERS is an parameter object for which setup time and + marginal generation times have to be measured. The results are + written into TIME_SETUP and TIME_SAMPLE, respectively. + LOG10_SAMPLESIZE is the common logarithm of the sample size that is + used for timing. + + If VERBOSITY is ‘TRUE’ then a small table is printed to output + stream OUT with setup time, marginal generation time and average + generation times for generating 10, 100, ... random variates. All + times are given in micro seconds and relative to the generation + times for the underlying uniform random number (using the UNIF + interface) and an exponential distributed random variate using the + inversion method. + + The created generator object is returned. If a generator object + could not be created successfully, then ‘NULL’ is returned. + + If VERBOSITY is ‘TRUE’ the result is written to the output stream + OUT. + + Notice: All timing results are subject to heavy changes. Reruning + timings usually results in different results. Minor changes in the + source code can cause changes in such timings up to 25 percent. + + -- Function: double unur_test_timing_R (UNUR_PAR* PARAMETERS, const + CHAR* DISTRSTR, const CHAR* METHODSTR, double + LOG10_SAMPLESIZE, double* TIME_SETUP, double* TIME_MARGINAL) + Timing. PARAMETERS is an parameter object for which setup time and + marginal generation times have to be measured. The results are + written into TIME_SETUP and TIME_MARGINAL, respectively. + LOG10_SAMPLESIZE is the common logarithm of the sample size that is + used for timing. + + Alternatively, one could provide the "parameter object" using + strings DISTRSTR and METHODSTR as used for ‘unur_makegen_ssu’. The + results are more accurate than those of function ‘unur_test_timing’ + as the timings are computed using linear regression with several + timings for sample size 1 and 10^LOG10_SAMPLESIZE. For each sample + size total generation time (including setup) is measured 10 times. + Since the these timings can be influenced by external effects (like + disc sync or handling of interupts) the 2 fastest and the 3 slowest + timings are discarded. Intercept and slope for simple linear + regression are than stored and R^2 is returned. + + In case of an error ‘-100.’ is returned. + + Notice: All timing results are subject to heavy changes. Reruning + timings usually results in different results. Minor changes in the + source code can cause changes in such timings up to 25 percent. + + -- Function: double unur_test_timing_uniform (const UNUR_PAR* + PARAMETERS, int LOG10_SAMPLESIZE) + -- Function: double unur_test_timing_exponential (const UNUR_PAR* + PARAMETERS, int LOG10_SAMPLESIZE) + Marginal generation times for the underlying uniform random number + (using the UNIF interface) and an exponential distributed random + variate using the inversion method. These times are used in + ‘unur_test_timing’ to compute the relative timings results. + + -- Function: double unur_test_timing_total (const UNUR_PAR* PARAMETERS, + int SAMPLESIZE, double AVG_DURATION) + Timing. PARAMETERS is an parameter object for which average times + a sample of size SAMPLESIZE (including setup) are estimated. Thus + sampling is repeated and the median of these timings is returned + (in micro seconds). The number of iterations is computed + automatically such that the total amount of time necessary for the + test ist approximately AVG_DURATION (given in seconds). However, + for very slow generator with expensive setup time the time + necessary for this test may be (much) larger. + + If an error occurs then ‘-1’ is returned. + + Notice: All timing results are subject to heavy changes. Reruning + timings usually results in different results. Minor changes in the + source code can cause changes in such timings up to 25 percent. + + -- Function: int unur_test_count_urn (UNUR_GEN* GENERATOR, int + SAMPLESIZE, int VERBOSITY, FILE* OUT) + Count used uniform random numbers. It returns the total number of + uniform random numbers required for a sample of non-uniform random + variates of size SAMPLESIZE. In case of an error ‘-1’ is returned. + + If VERBOSITY is ‘TRUE’ the result is written to the output stream + OUT. + + _Notice:_ This test uses global variables to store counters. Thus + it is not thread save. + + -- Function: int unur_test_count_pdf (UNUR_GEN* GENERATOR, int + SAMPLESIZE, int VERBOSITY, FILE* OUT) + Count evaluations of PDF and similar functions. It returns the + total number of evaluations of all such functions required for a + sample of non-uniform random variates of size SAMPLESIZE. If + VERBOSITY is ‘TRUE’ then a more detailed report is printed to the + output stream OUT. In case of an error ‘-1’ is returned. This + test is run on a copy of the given generator object. + + _Notice:_ The printed numbers of evaluation should be interpreted + with care. For example, methods either use the PDF or the logPDF; + if only the logPDF is given, but a method needs the PDF then both + the logPDF and the PDF (a wrapper around the logPDF) are called and + thus one call to the PDF is counted twice. + + _Notice:_ This test uses global variables to store function + pointers and counters. Thus it is not thread save. + + -- Function: int unur_test_par_count_pdf (UNUR_PAR* PARAMETERS, int + SAMPLESIZE, int VERBOSITY, FILE* OUT) + Same as ‘unur_test_count_pdf’ except that it is run on a parameter + object. Thus it also prints the number of function evaluations for + the setup. The temporary created generator object is destroyed + before the results are returned. + + -- Function: double unur_test_chi2 (UNUR_GEN* GENERATOR, int INTERVALS, + int SAMPLESIZE, int CLASSMIN, int VERBOSITY, FILE* OUT) + Run a Chi^2 test with the GENERATOR. The resulting p-value is + returned. + + It works with discrete und continuous univariate distributions. + For the latter the CDF of the distribution is required. + + INTERVALS is the number of intervals that is used for continuous + univariate distributions. SAMPLESIZE is the size of the sample + that is used for testing. If it is set to ‘0’ then a sample of + size INTERVALS^2 is used (bounded to some upper bound). + + CLASSMIN is the minimum number of expected entries per class. If a + class has to few entries then some classes are joined. + + VERBOSITY controls the output of the routine. If it is set to ‘1’ + then the result is written to the output stream OUT. If it is set + to ‘2’ additionally the list of expected and observed data is + printed. If it is set to ‘3’ then all generated numbers are + printed. There is no output when it is set to ‘0’. + + _Notice:_ For multivariate distributions the generated points are + transformed by the inverse of the Cholesky factor of the covariance + matrix and the mean vectors (if given for the underlying + distribution). The marginal distributions of the transformed + vectors are then tested against the marginal distribution given by + a ‘unur_distr_cvec_set_marginals’ or + ‘unur_distr_cvec_set_marginal_array’ call. (Notice that these + marginal distributions are never set by default for any of the + distributions provided by UNU.RAN.) Then the Bonferroni corrected + p-value of all these tests is returned. However, the test may not + be performed correctly if the domain of the underlying distribution + is truncated by a ‘unur_distr_cvec_set_domain_rect’ call and the + components of the distribution are correlated (i.e. + ‘unur_distr_cvec_set_covar’ is called with the non-NULL argument). + Then it almost surely will fail. + + -- Function: int unur_test_moments (UNUR_GEN* GENERATOR, double* + MOMENTS, int N_MOMENTS, int SAMPLESIZE, int VERBOSITY, FILE* + OUT) + Computes the first N_MOMENTS central moments for a sample of size + SAMPLESIZE. The result is stored into the array MOMENTS. + N_MOMENTS must be an integer between ‘1’ and ‘4’. For multivariate + distributions the moments are stored consecutively for each + dimension and the provided MOMENTS-array must have a length of at + least (N_MOMENTS+1) * DIM, where DIM is the dimension of the + multivariate distribution. The M’th moment for the D’th dimension + (0<=D= f(x) for all x in +the domain of the distribution. To generate the pair (X,Y) we generate +X from the distribution with density proportional to h(x) and Y +uniformly between 0 and h(X). The first step (generate X ) is usually +done by inversion (*note Inversion::). + + Thus the general rejection algorithm for a hat h(x) with inverse CDF +H^(-1) consists of the following steps: + 1. Generate a U(0,1) random number U. + 2. Set X to H^(-1)(U). + 3. Generate a U(0,1) random number V. + 4. Set Y to V h(X). + 5. If Y <= f(X) accept X as the random variate. + 6. Else try again. + + If the evaluation of the density f(x) is expensive (i.e., time +consuming) it is possible to use a simple lower bound of the density as +so called _squeeze function_ s(x) (the triangular shaped function in the +above figure is an example for such a squeeze). We can then accept X +when Y <= s(X) and can thus often save the evaluation of the density. + + We have seen so far that the rejection principle leads to short and +simple generation algorithms. The main practical problem to apply the +rejection algorithm is the search for a good fitting hat function and +for squeezes. We do not discuss these topics here as they are the heart +of the different automatic algorithms implemented in UNU.RAN. +Information about the construction of hat and squeeze can therefore be +found in the descriptions of the methods. + + The performance characteristics of rejection algorithms mainly depend +on the fit of the hat and the squeeze. It is not difficult to prove +that: + • The expected number of trials to generate one variate is the ratio + between the area below the hat and the area below the density. + • The expected number of evaluations of the density necessary to + generate one variate is equal to the ratio between the area below + the hat and the area below the density, when no squeeze is used. + Otherwise, when a squeeze is given it is equal to the ratio between + the area between hat and squeeze and the area below the hat. + • The ‘sqhratio’ (i.e., the ratio between the area below the squeeze + and the area below the hat) used in some of the UNU.RAN methods is + easy to compute. It is useful as its reciprocal is an upper bound + for the expected number of trials of the rejection algoritm. The + expected number of evaluations of the density is bounded by + (1/sqhratio)-1. + + +File: unuran.info, Node: Composition, Next: Ratio-of-Uniforms, Prev: Rejection, Up: RVG + +A.3 The Composition Method +========================== + +The composition method is an important principle to facilitate and speed +up random variate generation. The basic idea is simple. To generate +random variates with a given density we first split the domain of the +density into subintervals. Then we select one of these randomly with +probabilities given by the area below the density in the respective +subintervals. Finally we generate a random variate from the density of +the selected part by inversion and return it as random variate of the +full distribution. + + Composition can be combined with rejection. Thus it is possible to +decompose the domain of the distribution into subintervals and to +construct hat and squeeze functions seperatly in every subinterval. The +area below the hat must be determined in every subinterval. Then the +Composition rejection algorithm contains the following steps: + + 1. Generate the index J of the subinterval as the realisation of a + discrete random variate with probabilities proportional to the area + below the hat. + 2. Generate a random variate X proportional to the hat in interval J. + 3. Generate the U(0,f(X)) random number Y. + 4. If Y <= f(X) accept X as random variate. + 5. Else start again with generating the index J. + + The first step can be done in constant time (i.e., independent of the +number of chosen subintervals) by means of the indexed search method +(*note IndexedSearch::). + + It is possible to reduce the number of uniform random numbers +required in the above algorithm by recycling the random numbers used in +Step 1 and additionally by applying the principle of _immediate +acceptance_. For details see [HLD04: Sect. 3.1] . + + +File: unuran.info, Node: Ratio-of-Uniforms, Next: DiscreteInversion, Prev: Composition, Up: RVG + +A.4 The Ratio-of-Uniforms Method +================================ + +The construction of an appropriate hat function for the given density is +the crucial step for constructing rejection algorithms. Equivalently we +can try to find an appropriate envelope for the region between the graph +of the density and the x-axis, such that we can easily sample uniformly +distributed random points. This task could become easier if we can find +transformations that map the region between the density and the axis +into a region of more suitable shape (for example into a bounded +region). + + As a first example we consider the following simple algorithm for the +Cauchy distribution. + 1. Generate a U(-1,1) random number U and a U(0,1) random number V. + 2. If U^2 + V^2 <= 1 accept X=U/V as a Cauchy random variate. + 3. Else try again. + + It is possible to prove that the above algorithm indeed generates +Cauchy random variates. The fundamental principle behind this algorithm +is the fact that the region below the density is mapped by the +transformation + (X,Y) -> (U,V)=(2 Xsqrt(Y),2 sqrt(Y)) + +into a half-disc in such a way that the ratio between the area of the +image to the area of the preimage is constant. This is due to the fact +that that the Jacobian of this transformation is constant. + +[image src="figures/rou-cauchy.png" text=" + ^ v + | + | + +---------------------------*-***********-*---------------------------+ + | *****.......|.......***** | + | ****............|............**** | + | **................|................** | + | **...................|...................** | + | *.....................|.....................* | + | *.......................|.......................* | + | *........................|.........................* | + | *..........................|..........................* | + | *...........................|...........................* | + | *............................|............................* | + | *.............................|.............................* | + | *..............................|..............................* | + | *...............................|...............................* | + | *...............................|................................* | + | *................................|................................* | + | *................................|................................* | + |*.................................|.................................*| + |*.................................|.................................*| + *..................................|..................................* + *..................................|..................................* + *..................................|..................................* +---*----------------------------------+----------------------------------*--> u +"] + + + The above example is a special case of a more general principle, +called the _Ratio-of-uniforms (RoU) method_. It is based on the fact +that for a random variable X with density f(x) and some constant mu we +can generate X from the desired density by calculating X=U/V+ mu for a +pair (U,V) uniformly distributed in the set + A_f= { (u,v) : 0 < v <= sqrt(f(u/v+ mu)) } . + +For most distributions it is best to set the constant mu equal to the +mode of the distribution. For sampling random points uniformly +distributed in A_f rejection from a convenient enveloping region is +used, usually the minimal bounding rectangle, i.e., the smallest +possible rectangle that contains A_f (see the above figure). It is +given by (u^-,u^+)x(0,v^+) where + v^+ = sup_(b_l P + 4. Set X to X+1 and P to P+p(X). + 5. Return X. + + With the exception of some very simple discrete distributions, +sequential search algorithms become very slow as the while-loop has to +be repeated very often. The expected number of iterations, i.e., the +number of comparisons in the while condition, is equal to the +expectation of the distribution plus 1. It can therefore become +arbitrary large or even infinity if the tail of the distribution is very +heavy. Another serious problem can be critical round-off errors due to +summing up many probabilities p(k). To speed up the search procedure it +is best to use indexed search. + + +File: unuran.info, Node: IndexedSearch, Prev: DiscreteInversion, Up: RVG + +A.6 Indexed Search (Guide Table Method) +======================================= + +The idea to speed up the sequential search algorithm is easy to +understand. Instead of starting always at 0 we store a table of size C +with starting points for our search. For this table we compute +F^(-1)(U) for C equidistributed values of U, i.e., for u_i = i/C, +i=0,...,C-1. Such a table is called _guide table_ or _hash table_. Then +it is easy to prove that for every U in (0,1) the guide table entry for +k=floor(UC) is bounded by F^(-1)(U). This shows that we can really start +our sequential search procedure from the table entry for k and the index +k of the correct table entry can be found rapidly by means of the +truncation operation. + + The two main differences between _indexed search_ and _sequential +search_ are that we start searching at the number determined by the +guide table, and that we have to compute and store the cumulative +probabilities in the setup as we have to know the cumulative probability +for the starting point of the search algorithm. The rounding problems +that can occur in the sequential search algorithm can occur here as +well. Compared to sequential search we have now the obvious drawback of +a slow setup. The computation of the cumulative probabilities grows +linear with the size of the domain of the distribution L. What we gain +is really high speed as the marginal execution time of the sampling +algorithm becomes very small. The expected number of comparisons is +bounded by 1+L/C. This shows that there is a trade-off between speed and +the size of the guide table. Cache-effects in modern computers will +however slow down the speed-up for really large table sizes. Thus we +recommend to use a guide table that is about two times larger than the +probability vector to obtain optimal speed. + + +File: unuran.info, Node: Glossary, Next: Bibliography, Prev: RVG, Up: Top + +Appendix B Glossary +******************* + +*CDF* + cumulative distribution function. + +*HR* + hazard rate (or failure rate). + +*inverse local concavity* + local concavity of inverse PDF f^(-1)(y) expressed in term of x = + f^(-1)(y). Is is given by ilc_f(x) = 1 + x f''(x) / f'(x) + +*local concavity* + maximum value of c such that PDF f(x) is T_c. Is is given by + lc_f(x) = 1 - f''(x) f(x) / f'(x)^2 + +*PDF* + probability density function. + +*dPDF* + derivative (gradient) of probability density function. + +*PMF* + probability mass function. + +*PV* + (finite) probability vector. + +*URNG* + uniform random number generator. + +*U(a,b)* + continuous uniform distribution on the interval (a,b). + +*T-concave* + a function f(x) is called T-convace if the transformed function + T(f(x)) is concave. We only deal with transformations T_c, where + ‘c = 0’ + T(x) = log(x) + ‘c = -0.5’ + T(x) = -1/sqrt(x) + ‘c != 0’ + T(x) = sign(x) * x^c + +*u-error* + for a given approximate inverse CDF X=G^(-1)(U) the u-error is + given as + uerror = |U-F(G^(-1)(U))| + + where F denotes the exact CDF. Goodness-of-fit tests like the + Kolmogorov-Smirnov test or the chi-squared test look at this type + of error. See *note Inversion:: for more details. + +*u-resolution* + the maximal tolerated u-error for an approximate inverse CDF. + +*x-error* + for a given approximate inverse CDF X=G^(-1)(U) the x-error is + given as + xerror = |F^(-1)(U)-G^(-1)(U)| + + where F^(-1) denotes the exact inverse CDF. The x-error measure the + deviation of G^(-1)(U) from the exact result. Notice that we have + to distinguish between _absolute_ and _relative_ x-error. In + UNU.RAN we use the absolute x-error near 0 and the relative x-error + otherwise. See *note Inversion:: for more details. + +*x-resolution* + the maximal tolerated x-error for an approximate inverse CDF. + + +File: unuran.info, Node: Bibliography, Next: FIndex, Prev: Glossary, Up: Top + +Appendix C Bibliography +*********************** + +Standard Distributions +---------------------- + +[JKKa92] + N.L. JOHNSON, S. KOTZ, AND A.W. KEMP (1992). Univariate Discrete + Distributions, 2nd edition, John Wiley & Sons, Inc., New York. + +[JKBb94] + N.L. JOHNSON, S. KOTZ, AND N. BALAKRISHNAN (1994). Continuous + Univariate Distributions, Volume 1, 2nd edition, John Wiley & Sons, + Inc., New York. + +[JKBc95] + N.L. JOHNSON, S. KOTZ, AND N. BALAKRISHNAN (1995). Continuous + Univariate Distributions, Volume 2, 2nd edition, John Wiley & Sons, + Inc., New York. + +[JKBd97] + N.L. JOHNSON, S. KOTZ, AND N. BALAKRISHNAN (1997). Discrete + Multivariate Distributions, John Wiley & Sons, Inc., New York. + +[KBJe00] + S. KOTZ, N. BALAKRISHNAN, AND N.L. JOHNSON (2000). Continuous + Multivariate Distributions, Volume 1: Models and Applications, John + Wiley & Sons, Inc., New York. + +Universal Methods – Surveys +--------------------------- + +[HLD04] + W. HÖRMANN, J. LEYDOLD, AND G. DERFLINGER (2004). Automatic + Nonuniform Random Variate Generation, Springer, Berlin. + +Universal Methods +----------------- + +[AJa93] + J.H. AHRENS (1993). Sampling from general distributions by + suboptimal division of domains, Grazer Math. Berichte 319, 30pp. + +[AJa95] + J.H. AHRENS (1995). An one-table method for sampling from + continuous and discrete distributions, Computing 54(2), pp. + 127-146. + +[CAa74] + H.C. CHEN AND Y. ASAU (1974). On generating random variates from + an empirical distribution, AIIE Trans. 6, pp. 163-166. + +[DHLa08] + G. DERFLINGER, W. HÖRMANN, AND J. LEYDOLD (2008). Numerical + inversion when only the density function is known, Research Report + Series of the Department of Statistics and Mathematics 78, WU Wien, + Augasse 2–6, A-1090 Wien, Austria, . + +[DLa86] + L. DEVROYE (1986). Non-Uniform Random Variate Generation, Springer + Verlag, New York. + +[GWa92] + W.R. GILKS AND P. WILD (1992). Adaptive rejection sampling for + Gibbs sampling, Applied Statistics 41, pp. 337-348. + +[HWa95] + W. HÖRMANN (1995). A rejection technique for sampling from + T-concave distributions, ACM Trans. Math. Software 21(2), pp. + 182-193. + +[HDa96] + W. HÖRMANN AND G. DERFLINGER (1996). Rejection-inversion to + generate variates from monotone discrete distributions, ACM TOMACS + 6(3), 169-184. + +[HLa00] + W. HÖRMANN AND J. LEYDOLD (2000). Automatic random variate + generation for simulation input. In: J.A. Joines, R. Barton, P. + Fishwick, K. Kang (eds.), Proceedings of the 2000 Winter Simulation + Conference, pp. 675-682. + +[HLa03] + W. HÖRMANN AND J. LEYDOLD (2003). Continuous Random Variate + Generation by Fast Numerical Inversion, ACM TOMACS 13(4), 347-362. + +[HLDa07] + W. HÖRMANN, J. LEYDOLD, AND G. DERFLINGER (2007). Automatic Random + Variate Generation for Unbounded Densities, ACM Trans. Model. + Comput. Simul. 17(4), pp.18. + +[KLPa05] + R. KARAWATZKI, J. LEYDOLD, AND K. PÖTZELBERGER (2005). Automatic + Markov chain Monte Carlo procedures for sampling from multivariate + distributions, Research Report Series of the Department of + Statistics and Mathematics 27, WU Wien, Augasse 2–6, A-1090 Wien, + Austria, . + +[LJa98] + J. LEYDOLD (1998). A Rejection Technique for Sampling from + Log-Concave Multivariate Distributions, ACM TOMACS 8(3), pp. + 254-280. + +[LJa00] + J. LEYDOLD (2000). Automatic Sampling with the Ratio-of-Uniforms + Method, ACM Trans. Math. Software 26(1), pp. 78-98. + +[LJa01] + J. LEYDOLD (2001). A simple universal generator for continuous and + discrete univariate T-concave distributions, ACM Trans. Math. + Software 27(1), pp. 66-82. + +[LJa02] + J. LEYDOLD (2003). Short universal generators via generalized + ratio-of-uniforms method, Math. Comp. 72(243), pp. 1453-1471. + +[WGS91] + J.C. WAKEFIELD, A.E. GELFAND, AND A.F.M. SMITH (1992). Efficient + generation of random variates via the ratio-of-uniforms method, + Statist. Comput. 1(2), pp. 129-133. + +[WAa77] + A.J. WALKER (1977). An efficient method for generating discrete + random variables with general distributions, ACM Trans. Math. + Software 3, pp. 253-256. + +Special Generators +------------------ + +[ADa74] + J.H. AHRENS, U. DIETER (1974). Computer methods for sampling from + gamma, beta, Poisson and binomial distributions, Computing 12, + 223-246. + +[ADa82] + J.H. AHRENS, U. DIETER (1982). Generating gamma variates by a + modified rejection technique, Communications of the ACM 25, 47-54. + +[ADb82] + J.H. AHRENS, U. DIETER (1982). Computer generation of Poisson + deviates from modified normal distributions, ACM Trans. Math. + Software 8, 163-179. + +[BMa58] + G.E.P. BOX AND M.E. MULLER (1958). A note on the generation of + random normal deviates, Annals Math. Statist. 29, 610-611. + +[CHa77] + R.C.H. CHENG (1977). The Generation of Gamma Variables with + Non-Integral Shape Parameter, Appl. Statist. 26(1), 71-75. + +[Dag89] + J.S. DAGPUNAR (1989). An Easily Implemented Generalised Inverse + Gaussian Generator, Commun. Statist. Simul. 18(2), 703-710. + +[HDa90] + W. HÖRMANN AND G. DERFLINGER (1990). The ACR Method for generating + normal random variables, OR Spektrum 12, 181-185. + +[KAa81] + A.W. KEMP (1981). Efficient generation of logarithmically + distributed pseudo-random variables, Appl. Statist. 30, 249-253. + +[KRa76] + A.J. KINDERMAN AND J.G. RAMAGE (1976). Computer Generation of + Normal Random Variables, J. Am. Stat. Assoc. 71(356), 893 - 898. + +[MJa87] + J.F. MONAHAN (1987). An algorithm for generating chi random + variables, ACM Trans. Math. Software 13, 168-172. + +[MGa62] + G. MARSAGLIA (1962). Improving the Polar Method for Generating a + Pair of Random Variables, Boeing Sci. Res. Lab., Seattle, + Washington. + +[MOa84] + G. MARSAGLIA AND I. OLKIN (1984). Generating Correlation Matrices, + SIAM J. Sci. Stat. Comput 5, 470-475. + +[STa89] + E. STADLOBER (1989). Sampling from Poisson, binomial and + hypergeometric distributions: ratio of uniforms as a simple and + fast alternative, Bericht 303, Math. Stat. Sektion, + Forschungsgesellschaft Joanneum, Graz. + +[ZHa94] + H. ZECHNER (1994). Efficient sampling from continuous and discrete + unimodal distributions, Pd.D. Thesis, 156 pp., Technical University + Graz, Austria. + +Other references +---------------- + +[CPa76] + R. CRANLEY AND T.N.L. PATTERSON (1976). Randomization of number + theoretic methods for multiple integration, SIAM J. Num. Anal., + Vol. 13, pp. 904-914. + +[HJa61] + R. HOOKE AND T.A. JEEVES (1961). Direct Search Solution of + Numerical and Statistical Problems, Journal of the ACM, Vol. 8, + April 1961, pp. 212-229. + + +File: unuran.info, Node: FIndex, Prev: Bibliography, Up: Top + +Appendix D Function Index +************************* + +[index] +* Menu: + +* FALSE: Math. (line 18) +* INT_MAX: Math. (line 12) +* INT_MIN: Math. (line 13) +* TRUE: Math. (line 17) +* unur_arou_chg_verify: AROU. (line 128) +* unur_arou_get_hatarea: AROU. (line 91) +* unur_arou_get_sqhratio: AROU. (line 86) +* unur_arou_get_squeezearea: AROU. (line 95) +* unur_arou_new: AROU. (line 43) +* unur_arou_set_cpoints: AROU. (line 107) +* unur_arou_set_darsfactor: AROU. (line 62) +* unur_arou_set_guidefactor: AROU. (line 118) +* unur_arou_set_max_segments: AROU. (line 100) +* unur_arou_set_max_sqhratio: AROU. (line 74) +* unur_arou_set_pedantic: AROU. (line 137) +* unur_arou_set_usecenter: AROU. (line 114) +* unur_arou_set_usedars: AROU. (line 46) +* unur_arou_set_verify: AROU. (line 126) +* unur_ars_chg_reinit_ncpoints: ARS. (line 112) +* unur_ars_chg_reinit_percentiles: ARS. (line 95) +* unur_ars_chg_verify: ARS. (line 128) +* unur_ars_eval_invcdfhat: ARS. (line 163) +* unur_ars_get_loghatarea: ARS. (line 159) +* unur_ars_new: ARS. (line 72) +* unur_ars_set_cpoints: ARS. (line 84) +* unur_ars_set_max_intervals: ARS. (line 75) +* unur_ars_set_max_iter: ARS. (line 120) +* unur_ars_set_pedantic: ARS. (line 137) +* unur_ars_set_reinit_ncpoints: ARS. (line 110) +* unur_ars_set_reinit_percentiles: ARS. (line 93) +* unur_ars_set_verify: ARS. (line 127) +* unur_auto_new: AUTO. (line 32) +* unur_auto_set_logss: AUTO. (line 35) +* unur_cext_get_distrparams: CEXT. (line 227) +* unur_cext_get_ndistrparams: CEXT. (line 228) +* unur_cext_get_params: CEXT. (line 213) +* unur_cext_new: CEXT. (line 186) +* unur_cext_set_init: CEXT. (line 189) +* unur_cext_set_sample: CEXT. (line 203) +* unur_chgto_urng_aux_default: URNG. (line 205) +* unur_chg_debug: Debug. (line 65) +* unur_chg_urng: URNG. (line 177) +* unur_chg_urng_aux: URNG. (line 211) +* unur_cstd_chg_truncated: CSTD. (line 86) +* unur_cstd_new: CSTD. (line 60) +* unur_cstd_set_variant: CSTD. (line 73) +* unur_dari_chg_verify: DARI. (line 95) +* unur_dari_new: DARI. (line 57) +* unur_dari_set_cpfactor: DARI. (line 83) +* unur_dari_set_squeeze: DARI. (line 60) +* unur_dari_set_tablesize: DARI. (line 73) +* unur_dari_set_verify: DARI. (line 93) +* unur_dau_new: DAU. (line 42) +* unur_dau_set_urnfactor: DAU. (line 45) +* UNUR_DEBUG_ADAPT: Debug. (line 37) +* UNUR_DEBUG_ADAPT <1>: Debug. (line 38) +* UNUR_DEBUG_ALL: Debug. (line 31) +* UNUR_DEBUG_ALL <1>: Debug. (line 32) +* UNUR_DEBUG_INIT: Debug. (line 33) +* UNUR_DEBUG_INIT <1>: Debug. (line 34) +* UNUR_DEBUG_OFF: Debug. (line 29) +* UNUR_DEBUG_OFF <1>: Debug. (line 30) +* UNUR_DEBUG_SAMPLE: Debug. (line 39) +* UNUR_DEBUG_SAMPLE <1>: Debug. (line 40) +* UNUR_DEBUG_SETUP: Debug. (line 35) +* UNUR_DEBUG_SETUP <1>: Debug. (line 36) +* unur_dext_get_distrparams: DEXT. (line 227) +* unur_dext_get_ndistrparams: DEXT. (line 228) +* unur_dext_get_params: DEXT. (line 213) +* unur_dext_new: DEXT. (line 186) +* unur_dext_set_init: DEXT. (line 189) +* unur_dext_set_sample: DEXT. (line 203) +* unur_dgt_new: DGT. (line 68) +* unur_dgt_set_guidefactor: DGT. (line 71) +* unur_dgt_set_variant: DGT. (line 83) +* unur_distr_: Stddist. (line 20) +* unur_distr_beta: beta. (line 6) +* unur_distr_binomial: binomial. (line 6) +* unur_distr_cauchy: cauchy. (line 6) +* unur_distr_cemp_get_data: CEMP. (line 40) +* unur_distr_cemp_new: CEMP. (line 18) +* unur_distr_cemp_read_data: CEMP. (line 29) +* unur_distr_cemp_set_data: CEMP. (line 25) +* unur_distr_cemp_set_hist: CEMP. (line 48) +* unur_distr_cemp_set_hist_bins: CEMP. (line 82) +* unur_distr_cemp_set_hist_domain: CEMP. (line 77) +* unur_distr_cemp_set_hist_prob: CEMP. (line 63) +* unur_distr_chi: chi. (line 6) +* unur_distr_chisquare: chisquare. (line 6) +* unur_distr_condi_get_condition: CONDI. (line 91) +* unur_distr_condi_get_distribution: CONDI. (line 100) +* unur_distr_condi_new: CONDI. (line 36) +* unur_distr_condi_set_condition: CONDI. (line 68) +* unur_distr_cont_eval_cdf: CONT. (line 141) +* unur_distr_cont_eval_dlogpdf: CONT. (line 169) +* unur_distr_cont_eval_dpdf: CONT. (line 139) +* unur_distr_cont_eval_hr: CONT. (line 354) +* unur_distr_cont_eval_invcdf: CONT. (line 143) +* unur_distr_cont_eval_logcdf: CONT. (line 171) +* unur_distr_cont_eval_logpdf: CONT. (line 167) +* unur_distr_cont_eval_pdf: CONT. (line 137) +* unur_distr_cont_get_cdf: CONT. (line 127) +* unur_distr_cont_get_cdfstr: CONT. (line 198) +* unur_distr_cont_get_center: CONT. (line 423) +* unur_distr_cont_get_dlogpdf: CONT. (line 163) +* unur_distr_cont_get_dlogpdfstr: CONT. (line 276) +* unur_distr_cont_get_domain: CONT. (line 302) +* unur_distr_cont_get_dpdf: CONT. (line 125) +* unur_distr_cont_get_dpdfstr: CONT. (line 196) +* unur_distr_cont_get_hr: CONT. (line 347) +* unur_distr_cont_get_hrstr: CONT. (line 372) +* unur_distr_cont_get_invcdf: CONT. (line 129) +* unur_distr_cont_get_logcdf: CONT. (line 165) +* unur_distr_cont_get_logcdfstr: CONT. (line 280) +* unur_distr_cont_get_logpdf: CONT. (line 161) +* unur_distr_cont_get_logpdfstr: CONT. (line 274) +* unur_distr_cont_get_mode: CONT. (line 403) +* unur_distr_cont_get_pdf: CONT. (line 123) +* unur_distr_cont_get_pdfarea: CONT. (line 453) +* unur_distr_cont_get_pdfparams: CONT. (line 235) +* unur_distr_cont_get_pdfparams_vec: CONT. (line 263) +* unur_distr_cont_get_pdfstr: CONT. (line 194) +* unur_distr_cont_get_truncated: CONT. (line 308) +* unur_distr_cont_new: CONT. (line 68) +* unur_distr_cont_set_cdf: CONT. (line 78) +* unur_distr_cont_set_cdfstr: CONT. (line 188) +* unur_distr_cont_set_center: CONT. (line 411) +* unur_distr_cont_set_dlogpdf: CONT. (line 157) +* unur_distr_cont_set_domain: CONT. (line 285) +* unur_distr_cont_set_dpdf: CONT. (line 76) +* unur_distr_cont_set_hr: CONT. (line 317) +* unur_distr_cont_set_hrstr: CONT. (line 361) +* unur_distr_cont_set_invcdf: CONT. (line 80) +* unur_distr_cont_set_logcdf: CONT. (line 159) +* unur_distr_cont_set_logcdfstr: CONT. (line 278) +* unur_distr_cont_set_logpdf: CONT. (line 155) +* unur_distr_cont_set_logpdfstr: CONT. (line 272) +* unur_distr_cont_set_mode: CONT. (line 385) +* unur_distr_cont_set_pdf: CONT. (line 74) +* unur_distr_cont_set_pdfarea: CONT. (line 429) +* unur_distr_cont_set_pdfparams: CONT. (line 205) +* unur_distr_cont_set_pdfparams_vec: CONT. (line 243) +* unur_distr_cont_set_pdfstr: CONT. (line 176) +* unur_distr_cont_upd_mode: CONT. (line 395) +* unur_distr_cont_upd_pdfarea: CONT. (line 439) +* unur_distr_copula: copula. (line 6) +* unur_distr_corder_eval_cdf: CORDER. (line 75) +* unur_distr_corder_eval_dpdf: CORDER. (line 73) +* unur_distr_corder_eval_pdf: CORDER. (line 71) +* unur_distr_corder_get_cdf: CORDER. (line 62) +* unur_distr_corder_get_distribution: CORDER. (line 34) +* unur_distr_corder_get_domain: CORDER. (line 104) +* unur_distr_corder_get_dpdf: CORDER. (line 60) +* unur_distr_corder_get_mode: CORDER. (line 133) +* unur_distr_corder_get_pdf: CORDER. (line 58) +* unur_distr_corder_get_pdfarea: CORDER. (line 154) +* unur_distr_corder_get_pdfparams: CORDER. (line 93) +* unur_distr_corder_get_rank: CORDER. (line 48) +* unur_distr_corder_get_truncated: CORDER. (line 109) +* unur_distr_corder_new: CORDER. (line 17) +* unur_distr_corder_set_domain: CORDER. (line 99) +* unur_distr_corder_set_mode: CORDER. (line 122) +* unur_distr_corder_set_pdfarea: CORDER. (line 138) +* unur_distr_corder_set_pdfparams: CORDER. (line 88) +* unur_distr_corder_set_rank: CORDER. (line 41) +* unur_distr_corder_upd_mode: CORDER. (line 127) +* unur_distr_corder_upd_pdfarea: CORDER. (line 143) +* unur_distr_correlation: correlation. (line 6) +* unur_distr_cvec_eval_dlogpdf: CVEC. (line 188) +* unur_distr_cvec_eval_dpdf: CVEC. (line 149) +* unur_distr_cvec_eval_logpdf: CVEC. (line 186) +* unur_distr_cvec_eval_pdf: CVEC. (line 137) +* unur_distr_cvec_eval_pdlogpdf: CVEC. (line 190) +* unur_distr_cvec_eval_pdpdf: CVEC. (line 161) +* unur_distr_cvec_get_center: CVEC. (line 536) +* unur_distr_cvec_get_cholesky: CVEC. (line 282) +* unur_distr_cvec_get_covar: CVEC. (line 280) +* unur_distr_cvec_get_covar_inv: CVEC. (line 284) +* unur_distr_cvec_get_dlogpdf: CVEC. (line 184) +* unur_distr_cvec_get_dpdf: CVEC. (line 130) +* unur_distr_cvec_get_logpdf: CVEC. (line 182) +* unur_distr_cvec_get_marginal: CVEC. (line 381) +* unur_distr_cvec_get_mean: CVEC. (line 207) +* unur_distr_cvec_get_mode: CVEC. (line 507) +* unur_distr_cvec_get_pdf: CVEC. (line 123) +* unur_distr_cvec_get_pdfparams: CVEC. (line 414) +* unur_distr_cvec_get_pdfparams_vec: CVEC. (line 453) +* unur_distr_cvec_get_pdfvol: CVEC. (line 558) +* unur_distr_cvec_get_rankcorr: CVEC. (line 327) +* unur_distr_cvec_get_rk_cholesky: CVEC. (line 329) +* unur_distr_cvec_is_indomain: CVEC. (line 484) +* unur_distr_cvec_new: CVEC. (line 61) +* unur_distr_cvec_set_center: CVEC. (line 518) +* unur_distr_cvec_set_covar: CVEC. (line 216) +* unur_distr_cvec_set_covar_inv: CVEC. (line 256) +* unur_distr_cvec_set_dlogpdf: CVEC. (line 178) +* unur_distr_cvec_set_domain_rect: CVEC. (line 462) +* unur_distr_cvec_set_dpdf: CVEC. (line 89) +* unur_distr_cvec_set_logpdf: CVEC. (line 176) +* unur_distr_cvec_set_marginals: CVEC. (line 341) +* unur_distr_cvec_set_marginal_array: CVEC. (line 349) +* unur_distr_cvec_set_marginal_list: CVEC. (line 360) +* unur_distr_cvec_set_mean: CVEC. (line 194) +* unur_distr_cvec_set_mode: CVEC. (line 495) +* unur_distr_cvec_set_pdf: CVEC. (line 73) +* unur_distr_cvec_set_pdfparams: CVEC. (line 389) +* unur_distr_cvec_set_pdfparams_vec: CVEC. (line 422) +* unur_distr_cvec_set_pdfvol: CVEC. (line 544) +* unur_distr_cvec_set_pdlogpdf: CVEC. (line 180) +* unur_distr_cvec_set_pdpdf: CVEC. (line 107) +* unur_distr_cvec_set_rankcorr: CVEC. (line 299) +* unur_distr_cvec_upd_mode: CVEC. (line 501) +* unur_distr_cvec_upd_pdfvol: CVEC. (line 549) +* unur_distr_cvemp_get_data: CVEMP. (line 46) +* unur_distr_cvemp_new: CVEMP. (line 14) +* unur_distr_cvemp_read_data: CVEMP. (line 33) +* unur_distr_cvemp_set_data: CVEMP. (line 24) +* unur_distr_discr_eval_cdf: DISCR. (line 135) +* unur_distr_discr_eval_invcdf: DISCR. (line 148) +* unur_distr_discr_eval_pmf: DISCR. (line 133) +* unur_distr_discr_eval_pv: DISCR. (line 131) +* unur_distr_discr_get_cdfstr: DISCR. (line 177) +* unur_distr_discr_get_domain: DISCR. (line 226) +* unur_distr_discr_get_mode: DISCR. (line 252) +* unur_distr_discr_get_pmfparams: DISCR. (line 206) +* unur_distr_discr_get_pmfstr: DISCR. (line 175) +* unur_distr_discr_get_pmfsum: DISCR. (line 284) +* unur_distr_discr_get_pv: DISCR. (line 93) +* unur_distr_discr_make_pv: DISCR. (line 72) +* unur_distr_discr_new: DISCR. (line 39) +* unur_distr_discr_set_cdf: DISCR. (line 102) +* unur_distr_discr_set_cdfstr: DISCR. (line 170) +* unur_distr_discr_set_domain: DISCR. (line 212) +* unur_distr_discr_set_invcdf: DISCR. (line 125) +* unur_distr_discr_set_mode: DISCR. (line 240) +* unur_distr_discr_set_pmf: DISCR. (line 100) +* unur_distr_discr_set_pmfparams: DISCR. (line 184) +* unur_distr_discr_set_pmfstr: DISCR. (line 159) +* unur_distr_discr_set_pmfsum: DISCR. (line 260) +* unur_distr_discr_set_pv: DISCR. (line 56) +* unur_distr_discr_upd_mode: DISCR. (line 244) +* unur_distr_discr_upd_pmfsum: DISCR. (line 270) +* unur_distr_exponential: exponential. (line 6) +* unur_distr_extremeI: extremeI. (line 6) +* unur_distr_extremeII: extremeII. (line 6) +* unur_distr_F: F. (line 6) +* unur_distr_free: AllDistr. (line 19) +* unur_distr_gamma: gamma. (line 6) +* unur_distr_geometric: geometric. (line 6) +* unur_distr_get_dim: AllDistr. (line 31) +* unur_distr_get_extobj: AllDistr. (line 100) +* unur_distr_get_name: AllDistr. (line 24) +* unur_distr_get_type: AllDistr. (line 42) +* unur_distr_gig: gig. (line 6) +* unur_distr_gig2: gig2. (line 6) +* unur_distr_hyperbolic: hyperbolic. (line 6) +* unur_distr_hypergeometric: hypergeometric. (line 6) +* unur_distr_ig: ig. (line 6) +* unur_distr_is_cemp: AllDistr. (line 67) +* unur_distr_is_cont: AllDistr. (line 61) +* unur_distr_is_cvec: AllDistr. (line 64) +* unur_distr_is_cvemp: AllDistr. (line 71) +* unur_distr_is_discr: AllDistr. (line 75) +* unur_distr_is_matr: AllDistr. (line 78) +* unur_distr_laplace: laplace. (line 6) +* unur_distr_logarithmic: logarithmic. (line 6) +* unur_distr_logistic: logistic. (line 6) +* unur_distr_lognormal: lognormal. (line 6) +* unur_distr_lomax: lomax. (line 6) +* unur_distr_matr_get_dim: MATR. (line 28) +* unur_distr_matr_new: MATR. (line 13) +* unur_distr_multicauchy: multicauchy. (line 6) +* unur_distr_multiexponential: multiexponential. (line 6) +* unur_distr_multinormal: multinormal. (line 6) +* unur_distr_multistudent: multistudent. (line 6) +* unur_distr_negativebinomial: negativebinomial. (line 6) +* unur_distr_normal: normal. (line 6) +* unur_distr_pareto: pareto. (line 6) +* unur_distr_poisson: poisson. (line 6) +* unur_distr_powerexponential: powerexponential. (line 6) +* unur_distr_rayleigh: rayleigh. (line 6) +* unur_distr_set_extobj: AllDistr. (line 81) +* unur_distr_set_name: AllDistr. (line 22) +* unur_distr_slash: slash. (line 6) +* unur_distr_student: student. (line 6) +* unur_distr_triangular: triangular. (line 6) +* unur_distr_uniform: uniform. (line 6) +* unur_distr_weibull: weibull. (line 6) +* unur_dsrou_chg_cdfatmode: DSROU. (line 78) +* unur_dsrou_chg_verify: DSROU. (line 68) +* unur_dsrou_new: DSROU. (line 52) +* unur_dsrou_set_cdfatmode: DSROU. (line 55) +* unur_dsrou_set_verify: DSROU. (line 66) +* unur_dss_new: DSS. (line 47) +* unur_dstd_chg_truncated: DSTD. (line 83) +* unur_dstd_new: DSTD. (line 59) +* unur_dstd_set_variant: DSTD. (line 70) +* unur_empk_chg_smoothing: EMPK. (line 159) +* unur_empk_chg_varcor: EMPK. (line 175) +* unur_empk_new: EMPK. (line 94) +* unur_empk_set_beta: EMPK. (line 148) +* unur_empk_set_kernel: EMPK. (line 97) +* unur_empk_set_kernelgen: EMPK. (line 121) +* unur_empk_set_positive: EMPK. (line 183) +* unur_empk_set_smoothing: EMPK. (line 157) +* unur_empk_set_varcor: EMPK. (line 173) +* unur_empl_new: EMPL. (line 46) +* unur_errno: Error_reporting. (line 85) +* UNUR_ERR_COMPILE: Errno. (line 98) +* UNUR_ERR_COOKIE: Errno. (line 88) +* UNUR_ERR_DISTR_DATA: Errno. (line 30) +* UNUR_ERR_DISTR_DOMAIN: Errno. (line 20) +* UNUR_ERR_DISTR_GEN: Errno. (line 22) +* UNUR_ERR_DISTR_GET: Errno. (line 16) +* UNUR_ERR_DISTR_INVALID: Errno. (line 28) +* UNUR_ERR_DISTR_NPARAMS: Errno. (line 18) +* UNUR_ERR_DISTR_PROP: Errno. (line 32) +* UNUR_ERR_DISTR_REQUIRED: Errno. (line 24) +* UNUR_ERR_DISTR_SET: Errno. (line 14) +* UNUR_ERR_DISTR_UNKNOWN: Errno. (line 26) +* UNUR_ERR_DOMAIN: Errno. (line 80) +* UNUR_ERR_FSTR_DERIV: Errno. (line 76) +* UNUR_ERR_FSTR_SYNTAX: Errno. (line 74) +* UNUR_ERR_GEN: Errno. (line 44) +* UNUR_ERR_GENERIC: Errno. (line 90) +* UNUR_ERR_GEN_CONDITION: Errno. (line 48) +* UNUR_ERR_GEN_DATA: Errno. (line 46) +* UNUR_ERR_GEN_INVALID: Errno. (line 50) +* UNUR_ERR_GEN_SAMPLING: Errno. (line 52) +* UNUR_ERR_INF: Errno. (line 94) +* UNUR_ERR_MALLOC: Errno. (line 84) +* UNUR_ERR_NAN: Errno. (line 96) +* UNUR_ERR_NO_QUANTILE: Errno. (line 56) +* UNUR_ERR_NO_REINIT: Errno. (line 54) +* UNUR_ERR_NULL: Errno. (line 86) +* UNUR_ERR_PAR_INVALID: Errno. (line 40) +* UNUR_ERR_PAR_SET: Errno. (line 36) +* UNUR_ERR_PAR_VARIANT: Errno. (line 38) +* UNUR_ERR_ROUNDOFF: Errno. (line 82) +* UNUR_ERR_SHOULD_NOT_HAPPEN: Errno. (line 101) +* UNUR_ERR_SILENT: Errno. (line 92) +* UNUR_ERR_STR: Errno. (line 66) +* UNUR_ERR_STR_INVALID: Errno. (line 72) +* UNUR_ERR_STR_SYNTAX: Errno. (line 70) +* UNUR_ERR_STR_UNKNOWN: Errno. (line 68) +* UNUR_ERR_URNG: Errno. (line 60) +* UNUR_ERR_URNG_MISS: Errno. (line 62) +* unur_free: Methods_all. (line 95) +* unur_gen_anti: URNG. (line 319) +* unur_gen_info: Methods_all. (line 98) +* unur_gen_is_inversion: Methods_all. (line 119) +* unur_gen_nextsub: URNG. (line 321) +* unur_gen_reset: URNG. (line 320) +* unur_gen_resetsub: URNG. (line 322) +* unur_gen_seed: URNG. (line 317) +* unur_gen_sync: URNG. (line 316) +* unur_get_default_urng: URNG. (line 152) +* unur_get_default_urng_aux: URNG. (line 162) +* unur_get_dimension: Methods_all. (line 108) +* unur_get_distr: Methods_all. (line 123) +* unur_get_errno: Error_reporting. (line 87) +* unur_get_genid: Methods_all. (line 112) +* unur_get_method: Methods_all. (line 115) +* unur_get_stream: Output_streams. (line 43) +* unur_get_strerror: Error_reporting. (line 94) +* unur_get_urng: URNG. (line 184) +* unur_get_urng_aux: URNG. (line 220) +* unur_gibbs_chg_state: GIBBS. (line 184) +* unur_gibbs_get_state: GIBBS. (line 183) +* unur_gibbs_new: GIBBS. (line 112) +* unur_gibbs_reset_state: GIBBS. (line 188) +* unur_gibbs_set_burnin: GIBBS. (line 162) +* unur_gibbs_set_c: GIBBS. (line 126) +* unur_gibbs_set_startingpoint: GIBBS. (line 141) +* unur_gibbs_set_thinning: GIBBS. (line 152) +* unur_gibbs_set_variant_coordinate: GIBBS. (line 115) +* unur_gibbs_set_variant_random_direction: GIBBS. (line 122) +* unur_hinv_chg_truncated: HINV. (line 212) +* unur_hinv_estimate_error: HINV. (line 236) +* unur_hinv_eval_approxinvcdf: HINV. (line 200) +* unur_hinv_get_n_intervals: HINV. (line 195) +* unur_hinv_new: HINV. (line 100) +* unur_hinv_set_boundary: HINV. (line 165) +* unur_hinv_set_cpoints: HINV. (line 137) +* unur_hinv_set_guidefactor: HINV. (line 178) +* unur_hinv_set_max_intervals: HINV. (line 186) +* unur_hinv_set_order: HINV. (line 103) +* unur_hinv_set_u_resolution: HINV. (line 121) +* unur_hist_new: HIST. (line 30) +* unur_hitro_chg_state: HITRO. (line 356) +* unur_hitro_get_state: HITRO. (line 355) +* unur_hitro_new: HITRO. (line 176) +* unur_hitro_reset_state: HITRO. (line 368) +* unur_hitro_set_adaptive_multiplier: HITRO. (line 298) +* unur_hitro_set_burnin: HITRO. (line 339) +* unur_hitro_set_r: HITRO. (line 252) +* unur_hitro_set_startingpoint: HITRO. (line 312) +* unur_hitro_set_thinning: HITRO. (line 326) +* unur_hitro_set_u: HITRO. (line 275) +* unur_hitro_set_use_adaptiveline: HITRO. (line 194) +* unur_hitro_set_use_adaptiverectangle: HITRO. (line 223) +* unur_hitro_set_use_boundingrectangle: HITRO. (line 211) +* unur_hitro_set_v: HITRO. (line 260) +* unur_hitro_set_variant_coordinate: HITRO. (line 179) +* unur_hitro_set_variant_random_direction: HITRO. (line 190) +* unur_hrb_chg_verify: HRB. (line 62) +* unur_hrb_new: HRB. (line 52) +* unur_hrb_set_upperbound: HRB. (line 55) +* unur_hrb_set_verify: HRB. (line 61) +* unur_hrd_chg_verify: HRD. (line 48) +* unur_hrd_new: HRD. (line 44) +* unur_hrd_set_verify: HRD. (line 47) +* unur_hri_chg_verify: HRI. (line 75) +* unur_hri_new: HRI. (line 62) +* unur_hri_set_p0: HRI. (line 65) +* unur_hri_set_verify: HRI. (line 74) +* UNUR_INFINITY: Math. (line 8) +* unur_init: Methods_all. (line 11) +* unur_itdr_chg_verify: ITDR. (line 143) +* unur_itdr_get_area: ITDR. (line 128) +* unur_itdr_get_cp: ITDR. (line 123) +* unur_itdr_get_ct: ITDR. (line 124) +* unur_itdr_get_xi: ITDR. (line 122) +* unur_itdr_new: ITDR. (line 90) +* unur_itdr_set_cp: ITDR. (line 102) +* unur_itdr_set_ct: ITDR. (line 112) +* unur_itdr_set_verify: ITDR. (line 132) +* unur_itdr_set_xi: ITDR. (line 93) +* unur_makegen_dsu: StringAPI. (line 47) +* unur_makegen_ssu: StringAPI. (line 45) +* unur_mcorr_chg_eigenvalues: MCORR. (line 84) +* unur_mcorr_new: MCORR. (line 68) +* unur_mcorr_set_eigenvalues: MCORR. (line 71) +* unur_mixt_new: MIXT. (line 56) +* unur_mixt_set_useinversion: MIXT. (line 65) +* unur_mvstd_new: MVSTD. (line 37) +* unur_mvtdr_chg_verify: MVTDR. (line 129) +* unur_mvtdr_get_hatvol: MVTDR. (line 123) +* unur_mvtdr_get_ncones: MVTDR. (line 119) +* unur_mvtdr_new: MVTDR. (line 84) +* unur_mvtdr_set_boundsplitting: MVTDR. (line 94) +* unur_mvtdr_set_maxcones: MVTDR. (line 104) +* unur_mvtdr_set_stepsmin: MVTDR. (line 87) +* unur_mvtdr_set_verify: MVTDR. (line 127) +* unur_ninv_chg_max_iter: NINV. (line 120) +* unur_ninv_chg_start: NINV. (line 161) +* unur_ninv_chg_table: NINV. (line 181) +* unur_ninv_chg_truncated: NINV. (line 184) +* unur_ninv_chg_u_resolution: NINV. (line 135) +* unur_ninv_chg_x_resolution: NINV. (line 126) +* unur_ninv_eval_approxinvcdf: NINV. (line 204) +* unur_ninv_new: NINV. (line 99) +* unur_ninv_set_max_iter: NINV. (line 118) +* unur_ninv_set_start: NINV. (line 142) +* unur_ninv_set_table: NINV. (line 167) +* unur_ninv_set_usebisect: NINV. (line 114) +* unur_ninv_set_usenewton: NINV. (line 106) +* unur_ninv_set_useregula: NINV. (line 102) +* unur_ninv_set_u_resolution: NINV. (line 133) +* unur_ninv_set_x_resolution: NINV. (line 124) +* unur_norta_new: NORTA. (line 71) +* unur_nrou_chg_verify: NROU. (line 142) +* unur_nrou_new: NROU. (line 88) +* unur_nrou_set_center: NROU. (line 124) +* unur_nrou_set_r: NROU. (line 117) +* unur_nrou_set_u: NROU. (line 91) +* unur_nrou_set_v: NROU. (line 108) +* unur_nrou_set_verify: NROU. (line 131) +* unur_pinv_estimate_error: PINV. (line 361) +* unur_pinv_eval_approxcdf: PINV. (line 353) +* unur_pinv_eval_approxinvcdf: PINV. (line 345) +* unur_pinv_get_n_intervals: PINV. (line 328) +* unur_pinv_new: PINV. (line 152) +* unur_pinv_set_boundary: PINV. (line 284) +* unur_pinv_set_extra_testpoints: PINV. (line 242) +* unur_pinv_set_keepcdf: PINV. (line 332) +* unur_pinv_set_max_intervals: PINV. (line 321) +* unur_pinv_set_order: PINV. (line 155) +* unur_pinv_set_searchboundary: PINV. (line 300) +* unur_pinv_set_smoothness: PINV. (line 161) +* unur_pinv_set_usecdf: PINV. (line 271) +* unur_pinv_set_usepdf: PINV. (line 266) +* unur_pinv_set_use_upoints: PINV. (line 256) +* unur_pinv_set_u_resolution: PINV. (line 211) +* unur_quantile: Methods_all. (line 75) +* unur_reinit: Methods_all. (line 24) +* unur_reset_errno: Error_reporting. (line 90) +* unur_run_tests: Testing. (line 13) +* unur_sample_cont: Methods_all. (line 58) +* unur_sample_discr: Methods_all. (line 57) +* unur_sample_matr: Methods_all. (line 60) +* unur_sample_urng: URNG. (line 236) +* unur_sample_vec: Methods_all. (line 59) +* unur_set_debug: Debug. (line 62) +* unur_set_default_debug: Debug. (line 68) +* unur_set_default_urng: URNG. (line 157) +* unur_set_default_urng_aux: URNG. (line 161) +* unur_set_error_handler: Error_handlers. (line 49) +* unur_set_error_handler_off: Error_handlers. (line 61) +* unur_set_stream: Output_streams. (line 28) +* unur_set_urng: URNG. (line 168) +* unur_set_urng_aux: URNG. (line 188) +* unur_set_use_distr_privatecopy: Methods_all. (line 138) +* unur_srou_chg_cdfatmode: SROU. (line 176) +* unur_srou_chg_pdfatmode: SROU. (line 181) +* unur_srou_chg_verify: SROU. (line 167) +* unur_srou_new: SROU. (line 101) +* unur_srou_set_cdfatmode: SROU. (line 118) +* unur_srou_set_pdfatmode: SROU. (line 127) +* unur_srou_set_r: SROU. (line 104) +* unur_srou_set_usemirror: SROU. (line 150) +* unur_srou_set_usesqueeze: SROU. (line 138) +* unur_srou_set_verify: SROU. (line 165) +* unur_ssr_chg_cdfatmode: SSR. (line 121) +* unur_ssr_chg_pdfatmode: SSR. (line 126) +* unur_ssr_chg_verify: SSR. (line 112) +* unur_ssr_new: SSR. (line 79) +* unur_ssr_set_cdfatmode: SSR. (line 82) +* unur_ssr_set_pdfatmode: SSR. (line 91) +* unur_ssr_set_usesqueeze: SSR. (line 101) +* unur_ssr_set_verify: SSR. (line 111) +* unur_str2distr: StringAPI. (line 39) +* unur_str2gen: StringAPI. (line 34) +* UNUR_SUCCESS (0x0u): Errno. (line 10) +* unur_tabl_chg_truncated: TABL. (line 284) +* unur_tabl_chg_verify: TABL. (line 317) +* unur_tabl_get_hatarea: TABL. (line 228) +* unur_tabl_get_n_intervals: TABL. (line 244) +* unur_tabl_get_sqhratio: TABL. (line 224) +* unur_tabl_get_squeezearea: TABL. (line 232) +* unur_tabl_new: TABL. (line 112) +* unur_tabl_set_areafraction: TABL. (line 154) +* unur_tabl_set_boundary: TABL. (line 275) +* unur_tabl_set_cpoints: TABL. (line 127) +* unur_tabl_set_darsfactor: TABL. (line 183) +* unur_tabl_set_guidefactor: TABL. (line 267) +* unur_tabl_set_max_intervals: TABL. (line 237) +* unur_tabl_set_max_sqhratio: TABL. (line 209) +* unur_tabl_set_nstp: TABL. (line 135) +* unur_tabl_set_pedantic: TABL. (line 326) +* unur_tabl_set_slopes: TABL. (line 248) +* unur_tabl_set_usedars: TABL. (line 167) +* unur_tabl_set_useear: TABL. (line 144) +* unur_tabl_set_variant_ia: TABL. (line 115) +* unur_tabl_set_variant_splitmode: TABL. (line 195) +* unur_tabl_set_verify: TABL. (line 315) +* unur_tdr_chg_reinit_ncpoints: TDR. (line 195) +* unur_tdr_chg_reinit_percentiles: TDR. (line 178) +* unur_tdr_chg_truncated: TDR. (line 203) +* unur_tdr_chg_verify: TDR. (line 292) +* unur_tdr_eval_invcdfhat: TDR. (line 323) +* unur_tdr_get_hatarea: TDR. (line 248) +* unur_tdr_get_sqhratio: TDR. (line 244) +* unur_tdr_get_squeezearea: TDR. (line 252) +* unur_tdr_new: TDR. (line 96) +* unur_tdr_set_c: TDR. (line 99) +* unur_tdr_set_cpoints: TDR. (line 168) +* unur_tdr_set_darsfactor: TDR. (line 156) +* unur_tdr_set_guidefactor: TDR. (line 283) +* unur_tdr_set_max_intervals: TDR. (line 257) +* unur_tdr_set_max_sqhratio: TDR. (line 232) +* unur_tdr_set_pedantic: TDR. (line 301) +* unur_tdr_set_reinit_ncpoints: TDR. (line 193) +* unur_tdr_set_reinit_percentiles: TDR. (line 176) +* unur_tdr_set_usecenter: TDR. (line 266) +* unur_tdr_set_usedars: TDR. (line 118) +* unur_tdr_set_usemode: TDR. (line 270) +* unur_tdr_set_variant_gw: TDR. (line 106) +* unur_tdr_set_variant_ia: TDR. (line 114) +* unur_tdr_set_variant_ps: TDR. (line 110) +* unur_tdr_set_verify: TDR. (line 291) +* unur_test_chi2: Testing. (line 152) +* unur_test_correlation: Testing. (line 206) +* unur_test_count_pdf: Testing. (line 127) +* unur_test_count_urn: Testing. (line 115) +* unur_test_moments: Testing. (line 190) +* unur_test_par_count_pdf: Testing. (line 145) +* unur_test_printsample: Testing. (line 31) +* unur_test_quartiles: Testing. (line 216) +* unur_test_timing: Testing. (line 36) +* unur_test_timing_exponential: Testing. (line 91) +* unur_test_timing_R: Testing. (line 63) +* unur_test_timing_total: Testing. (line 98) +* unur_test_timing_uniform: Testing. (line 89) +* unur_test_u_error: Testing. (line 235) +* unur_unif_new: UNIF. (line 20) +* unur_urng_anti: URNG. (line 295) +* unur_urng_free: URNG. (line 363) +* unur_urng_fvoid_new: URNG-FVOID. (line 42) +* unur_urng_gslptr_new: URNG-GSL. (line 114) +* unur_urng_gslqrng_new: URNG-GSLQRNG. (line 38) +* unur_urng_gsl_new: URNG-GSL. (line 107) +* unur_urng_new: URNG. (line 344) +* unur_urng_nextsub: URNG. (line 302) +* unur_urng_prngptr_new: URNG-PRNG. (line 58) +* unur_urng_prng_new: URNG-PRNG. (line 41) +* unur_urng_randomshift_new: URNG-RANDOMSHIFT. (line 47) +* unur_urng_randomshift_nextshift: URNG-RANDOMSHIFT. (line 57) +* unur_urng_reset: URNG. (line 256) +* unur_urng_resetsub: URNG. (line 309) +* unur_urng_rngstreamptr_new: URNG-RNGSTREAM. (line 55) +* unur_urng_rngstream_new: URNG-RNGSTREAM. (line 50) +* unur_urng_sample: URNG. (line 232) +* unur_urng_sample_array: URNG. (line 241) +* unur_urng_seed: URNG. (line 279) +* unur_urng_set_anti: URNG. (line 389) +* unur_urng_set_delete: URNG. (line 409) +* unur_urng_set_nextsub: URNG. (line 399) +* unur_urng_set_reset: URNG. (line 394) +* unur_urng_set_resetsub: URNG. (line 404) +* unur_urng_set_sample_array: URNG. (line 376) +* unur_urng_set_seed: URNG. (line 385) +* unur_urng_set_sync: URNG. (line 381) +* unur_urng_sync: URNG. (line 273) +* unur_use_urng_aux_default: URNG. (line 199) +* unur_utdr_chg_pdfatmode: UTDR. (line 98) +* unur_utdr_chg_verify: UTDR. (line 89) +* unur_utdr_new: UTDR. (line 56) +* unur_utdr_set_cpfactor: UTDR. (line 69) +* unur_utdr_set_deltafactor: UTDR. (line 78) +* unur_utdr_set_pdfatmode: UTDR. (line 59) +* unur_utdr_set_verify: UTDR. (line 87) +* unur_vempk_chg_smoothing: VEMPK. (line 51) +* unur_vempk_chg_varcor: VEMPK. (line 67) +* unur_vempk_new: VEMPK. (line 46) +* unur_vempk_set_smoothing: VEMPK. (line 49) +* unur_vempk_set_varcor: VEMPK. (line 65) +* unur_vnrou_chg_u: VNROU. (line 120) +* unur_vnrou_chg_v: VNROU. (line 131) +* unur_vnrou_chg_verify: VNROU. (line 153) +* unur_vnrou_get_volumehat: VNROU. (line 157) +* unur_vnrou_new: VNROU. (line 101) +* unur_vnrou_set_r: VNROU. (line 134) +* unur_vnrou_set_u: VNROU. (line 104) +* unur_vnrou_set_v: VNROU. (line 124) +* unur_vnrou_set_verify: VNROU. (line 142) + + + +Tag Table: +Node: Top454 +Node: Intro6597 +Node: UsageDoc6874 +Node: Installation8289 +Node: UsageLib15178 +Node: Concepts18181 +Node: Contact29211 +Node: Examples29555 +Node: Example_031457 +Node: Example_0_str34653 +Node: Example_137132 +Node: Example_1_str40406 +Node: Example_242955 +Node: Example_2_str48257 +Node: Example_351650 +Node: Example_3_str55554 +Node: Example_458753 +Node: Example_reinit64706 +Node: Example_anti69541 +Node: Example_anti_str76289 +Node: Example_More80662 +Node: StringAPI81110 +Ref: funct:unur_str2gen82357 +Ref: funct:unur_str2distr82619 +Ref: funct:unur_makegen_ssu82944 +Ref: funct:unur_makegen_dsu82944 +Node: StringSyntax83834 +Node: StringDistr89192 +Node: KeysDistr91022 +Node: StringFunct97159 +Node: StringMethod102125 +Node: KeysMethod103216 +Node: StringURNG122234 +Node: Distribution_objects122967 +Node: AllDistr128280 +Ref: funct:unur_distr_free128824 +Ref: funct:unur_distr_set_name128925 +Ref: funct:unur_distr_get_name128925 +Ref: funct:unur_distr_get_dim129364 +Ref: funct:unur_distr_get_type129821 +Ref: funct:unur_distr_is_cont130525 +Ref: funct:unur_distr_is_cvec130669 +Ref: funct:unur_distr_is_cemp130815 +Ref: funct:unur_distr_is_cvemp130991 +Ref: funct:unur_distr_is_discr131154 +Ref: funct:unur_distr_is_matr131297 +Ref: funct:unur_distr_set_extobj131426 +Ref: funct:unur_distr_get_extobj132382 +Node: CONT132601 +Ref: funct:unur_distr_cont_new135901 +Ref: funct:unur_distr_cont_set_pdf136071 +Ref: funct:unur_distr_cont_set_dpdf136071 +Ref: funct:unur_distr_cont_set_cdf136071 +Ref: funct:unur_distr_cont_set_invcdf136071 +Ref: funct:unur_distr_cont_get_pdf138687 +Ref: funct:unur_distr_cont_get_dpdf138687 +Ref: funct:unur_distr_cont_get_cdf138687 +Ref: funct:unur_distr_cont_get_invcdf138687 +Ref: funct:unur_distr_cont_eval_pdf139410 +Ref: funct:unur_distr_cont_eval_dpdf139410 +Ref: funct:unur_distr_cont_eval_cdf139410 +Ref: funct:unur_distr_cont_eval_invcdf139410 +Ref: funct:unur_distr_cont_set_logpdf140314 +Ref: funct:unur_distr_cont_set_dlogpdf140314 +Ref: funct:unur_distr_cont_set_logcdf140314 +Ref: funct:unur_distr_cont_get_logpdf140314 +Ref: funct:unur_distr_cont_get_dlogpdf140314 +Ref: funct:unur_distr_cont_get_logcdf140314 +Ref: funct:unur_distr_cont_eval_logpdf140314 +Ref: funct:unur_distr_cont_eval_dlogpdf140314 +Ref: funct:unur_distr_cont_eval_logcdf140314 +Ref: funct:unur_distr_cont_set_pdfstr141332 +Ref: funct:unur_distr_cont_set_cdfstr141934 +Ref: funct:unur_distr_cont_get_pdfstr142239 +Ref: funct:unur_distr_cont_get_dpdfstr142239 +Ref: funct:unur_distr_cont_get_cdfstr142239 +Ref: funct:unur_distr_cont_set_pdfparams142773 +Ref: funct:unur_distr_cont_get_pdfparams144593 +Ref: funct:unur_distr_cont_set_pdfparams_vec144973 +Ref: funct:unur_distr_cont_get_pdfparams_vec145878 +Ref: funct:unur_distr_cont_set_logpdfstr146343 +Ref: funct:unur_distr_cont_get_logpdfstr146343 +Ref: funct:unur_distr_cont_get_dlogpdfstr146343 +Ref: funct:unur_distr_cont_set_logcdfstr146343 +Ref: funct:unur_distr_cont_get_logcdfstr146343 +Ref: funct:unur_distr_cont_set_domain146927 +Ref: funct:unur_distr_cont_get_domain147895 +Ref: funct:unur_distr_cont_get_truncated148204 +Ref: funct:unur_distr_cont_set_hr148671 +Ref: funct:unur_distr_cont_get_hr150217 +Ref: funct:unur_distr_cont_eval_hr150576 +Ref: funct:unur_distr_cont_set_hrstr150948 +Ref: funct:unur_distr_cont_get_hrstr151487 +Ref: funct:unur_distr_cont_set_mode151977 +Ref: funct:unur_distr_cont_upd_mode152560 +Ref: funct:unur_distr_cont_get_mode152996 +Ref: funct:unur_distr_cont_set_center153500 +Ref: funct:unur_distr_cont_get_center154033 +Ref: funct:unur_distr_cont_set_pdfarea154289 +Ref: funct:unur_distr_cont_upd_pdfarea154742 +Ref: funct:unur_distr_cont_get_pdfarea155459 +Node: CORDER155822 +Ref: funct:unur_distr_corder_new156350 +Ref: funct:unur_distr_corder_get_distribution157202 +Ref: funct:unur_distr_corder_set_rank157425 +Ref: funct:unur_distr_corder_get_rank157769 +Ref: funct:unur_distr_corder_get_pdf158240 +Ref: funct:unur_distr_corder_get_dpdf158240 +Ref: funct:unur_distr_corder_get_cdf158240 +Ref: funct:unur_distr_corder_eval_pdf158894 +Ref: funct:unur_distr_corder_eval_dpdf158894 +Ref: funct:unur_distr_corder_eval_cdf158894 +Ref: funct:unur_distr_corder_set_pdfparams159718 +Ref: funct:unur_distr_corder_get_pdfparams159962 +Ref: funct:unur_distr_corder_set_domain160259 +Ref: funct:unur_distr_corder_get_domain160506 +Ref: funct:unur_distr_corder_get_truncated160755 +Ref: funct:unur_distr_corder_set_mode161225 +Ref: funct:unur_distr_corder_upd_mode161409 +Ref: funct:unur_distr_corder_get_mode161709 +Ref: funct:unur_distr_corder_set_pdfarea161889 +Ref: funct:unur_distr_corder_upd_pdfarea162086 +Ref: funct:unur_distr_corder_get_pdfarea162720 +Node: CEMP162928 +Ref: funct:unur_distr_cemp_new163580 +Ref: funct:unur_distr_cemp_set_data163765 +Ref: funct:unur_distr_cemp_read_data163935 +Ref: funct:unur_distr_cemp_get_data164504 +Ref: funct:unur_distr_cemp_set_hist164853 +Ref: funct:unur_distr_cemp_set_hist_prob165635 +Ref: funct:unur_distr_cemp_set_hist_domain166373 +Ref: funct:unur_distr_cemp_set_hist_bins166629 +Node: CVEC167294 +Ref: funct:unur_distr_cvec_new169753 +Ref: funct:unur_distr_cvec_set_pdf170325 +Ref: funct:unur_distr_cvec_set_dpdf171128 +Ref: funct:unur_distr_cvec_set_pdpdf172067 +Ref: funct:unur_distr_cvec_get_pdf172882 +Ref: funct:unur_distr_cvec_get_dpdf173235 +Ref: funct:unur_distr_cvec_eval_pdf173625 +Ref: funct:unur_distr_cvec_eval_dpdf174231 +Ref: funct:unur_distr_cvec_eval_pdpdf174884 +Ref: funct:unur_distr_cvec_set_logpdf175622 +Ref: funct:unur_distr_cvec_set_dlogpdf175622 +Ref: funct:unur_distr_cvec_set_pdlogpdf175622 +Ref: funct:unur_distr_cvec_get_logpdf175622 +Ref: funct:unur_distr_cvec_get_dlogpdf175622 +Ref: funct:unur_distr_cvec_eval_logpdf175622 +Ref: funct:unur_distr_cvec_eval_dlogpdf175622 +Ref: funct:unur_distr_cvec_eval_pdlogpdf175622 +Ref: funct:unur_distr_cvec_set_mean176556 +Ref: funct:unur_distr_cvec_get_mean177274 +Ref: funct:unur_distr_cvec_set_covar177703 +Ref: funct:unur_distr_cvec_set_covar_inv179940 +Ref: funct:unur_distr_cvec_get_covar181026 +Ref: funct:unur_distr_cvec_get_cholesky181026 +Ref: funct:unur_distr_cvec_get_covar_inv181026 +Ref: funct:unur_distr_cvec_set_rankcorr181902 +Ref: funct:unur_distr_cvec_get_rankcorr183155 +Ref: funct:unur_distr_cvec_get_rk_cholesky183155 +Ref: funct:unur_distr_cvec_set_marginals183842 +Ref: funct:unur_distr_cvec_set_marginal_array184245 +Ref: funct:unur_distr_cvec_set_marginal_list184885 +Ref: funct:unur_distr_cvec_get_marginal186030 +Ref: funct:unur_distr_cvec_set_pdfparams186452 +Ref: funct:unur_distr_cvec_get_pdfparams187937 +Ref: funct:unur_distr_cvec_set_pdfparams_vec188317 +Ref: funct:unur_distr_cvec_get_pdfparams_vec189948 +Ref: funct:unur_distr_cvec_set_domain_rect190413 +Ref: funct:unur_distr_cvec_is_indomain191635 +Ref: funct:unur_distr_cvec_set_mode192000 +Ref: funct:unur_distr_cvec_upd_mode192308 +Ref: funct:unur_distr_cvec_get_mode192655 +Ref: funct:unur_distr_cvec_set_center193253 +Ref: funct:unur_distr_cvec_get_center194204 +Ref: funct:unur_distr_cvec_set_pdfvol194628 +Ref: funct:unur_distr_cvec_upd_pdfvol194864 +Ref: funct:unur_distr_cvec_get_pdfvol195353 +Node: CONDI195719 +Ref: funct:unur_distr_condi_new197234 +Ref: funct:unur_distr_condi_set_condition198976 +Ref: funct:unur_distr_condi_get_condition200249 +Ref: funct:unur_distr_condi_get_distribution200681 +Node: CVEMP200860 +Ref: funct:unur_distr_cvemp_new201343 +Ref: funct:unur_distr_cvemp_set_data201766 +Ref: funct:unur_distr_cvemp_read_data202258 +Ref: funct:unur_distr_cvemp_get_data202967 +Node: MATR203543 +Ref: funct:unur_distr_matr_new203878 +Ref: funct:unur_distr_matr_get_dim204641 +Node: DISCR204924 +Ref: funct:unur_distr_discr_new206391 +Ref: funct:unur_distr_discr_set_pv207150 +Ref: funct:unur_distr_discr_make_pv207986 +Ref: funct:unur_distr_discr_get_pv209116 +Ref: funct:unur_distr_discr_set_pmf209451 +Ref: funct:unur_distr_discr_set_cdf209451 +Ref: funct:unur_distr_discr_set_invcdf210690 +Ref: funct:unur_distr_discr_eval_pv210986 +Ref: funct:unur_distr_discr_eval_pmf210986 +Ref: funct:unur_distr_discr_eval_cdf210986 +Ref: funct:unur_distr_discr_eval_invcdf211866 +Ref: funct:unur_distr_discr_set_pmfstr212395 +Ref: funct:unur_distr_discr_set_cdfstr212916 +Ref: funct:unur_distr_discr_get_pmfstr213145 +Ref: funct:unur_distr_discr_get_cdfstr213145 +Ref: funct:unur_distr_discr_set_pmfparams213555 +Ref: funct:unur_distr_discr_get_pmfparams214827 +Ref: funct:unur_distr_discr_set_domain215150 +Ref: funct:unur_distr_discr_get_domain215951 +Ref: funct:unur_distr_discr_set_mode216539 +Ref: funct:unur_distr_discr_upd_mode216662 +Ref: funct:unur_distr_discr_get_mode217135 +Ref: funct:unur_distr_discr_set_pmfsum217632 +Ref: funct:unur_distr_discr_upd_pmfsum218080 +Ref: funct:unur_distr_discr_get_pmfsum218872 +Node: Methods219227 +Node: Methods_all221901 +Ref: funct:unur_init222124 +Ref: funct:unur_reinit222645 +Ref: funct:unur_sample_discr224088 +Ref: funct:unur_sample_cont224088 +Ref: funct:unur_sample_vec224088 +Ref: funct:unur_sample_matr224088 +Ref: funct:unur_quantile224968 +Ref: funct:unur_free225745 +Ref: funct:unur_gen_info225845 +Ref: funct:unur_get_dimension226268 +Ref: funct:unur_get_genid226456 +Ref: funct:unur_get_method226568 +Ref: funct:unur_gen_is_inversion226758 +Ref: funct:unur_get_distr226932 +Ref: funct:unur_set_use_distr_privatecopy227736 +Node: AUTO229949 +Ref: funct:unur_auto_new231082 +Ref: funct:unur_auto_set_logss231197 +Node: Methods_for_CONT231533 +Node: AROU241527 +Ref: funct:unur_arou_new243152 +Ref: funct:unur_arou_set_usedars243267 +Ref: funct:unur_arou_set_darsfactor244087 +Ref: funct:unur_arou_set_max_sqhratio244722 +Ref: funct:unur_arou_get_sqhratio245318 +Ref: funct:unur_arou_get_hatarea245550 +Ref: funct:unur_arou_get_squeezearea245734 +Ref: funct:unur_arou_set_max_segments245936 +Ref: funct:unur_arou_set_cpoints246199 +Ref: funct:unur_arou_set_usecenter246596 +Ref: funct:unur_arou_set_guidefactor246754 +Ref: funct:unur_arou_set_verify247090 +Ref: funct:unur_arou_chg_verify247090 +Ref: funct:unur_arou_set_pedantic247589 +Node: ARS248670 +Ref: funct:unur_ars_new251781 +Ref: funct:unur_ars_set_max_intervals251895 +Ref: funct:unur_ars_set_cpoints252257 +Ref: funct:unur_ars_set_reinit_percentiles252690 +Ref: funct:unur_ars_chg_reinit_percentiles252690 +Ref: funct:unur_ars_set_reinit_ncpoints253778 +Ref: funct:unur_ars_chg_reinit_ncpoints253778 +Ref: funct:unur_ars_set_max_iter254202 +Ref: funct:unur_ars_set_verify254404 +Ref: funct:unur_ars_chg_verify254404 +Ref: funct:unur_ars_set_pedantic254891 +Ref: funct:unur_ars_get_loghatarea255973 +Ref: funct:unur_ars_eval_invcdfhat256172 +Node: CEXT256601 +Ref: funct:unur_cext_new264532 +Ref: funct:unur_cext_set_init264651 +Ref: funct:unur_cext_set_sample265270 +Ref: funct:unur_cext_get_params265760 +Ref: funct:unur_cext_get_distrparams266380 +Ref: funct:unur_cext_get_ndistrparams266380 +Node: CSTD266753 +Ref: funct:unur_cstd_new269141 +Ref: funct:unur_cstd_set_variant269849 +Ref: funct:unur_cstd_chg_truncated270462 +Node: HINV271589 +Ref: funct:unur_hinv_new276655 +Ref: funct:unur_hinv_set_order276770 +Ref: funct:unur_hinv_set_u_resolution277774 +Ref: funct:unur_hinv_set_cpoints278569 +Ref: funct:unur_hinv_set_boundary280065 +Ref: funct:unur_hinv_set_guidefactor280654 +Ref: funct:unur_hinv_set_max_intervals280990 +Ref: funct:unur_hinv_get_n_intervals281377 +Ref: funct:unur_hinv_eval_approxinvcdf281661 +Ref: funct:unur_hinv_chg_truncated282249 +Ref: funct:unur_hinv_estimate_error283483 +Node: HRB283888 +Ref: funct:unur_hrb_new285843 +Ref: funct:unur_hrb_set_upperbound285957 +Ref: funct:unur_hrb_set_verify286253 +Ref: funct:unur_hrb_chg_verify286253 +Node: HRD286612 +Ref: funct:unur_hrd_new288172 +Ref: funct:unur_hrd_set_verify288286 +Ref: funct:unur_hrd_chg_verify288286 +Node: HRI288645 +Ref: funct:unur_hri_new291283 +Ref: funct:unur_hri_set_p0291397 +Ref: funct:unur_hri_set_verify291861 +Ref: funct:unur_hri_chg_verify291861 +Node: ITDR292220 +Ref: funct:unur_itdr_new296916 +Ref: funct:unur_itdr_set_xi297031 +Ref: funct:unur_itdr_set_cp297447 +Ref: funct:unur_itdr_set_ct297898 +Ref: funct:unur_itdr_get_xi298385 +Ref: funct:unur_itdr_get_cp298385 +Ref: funct:unur_itdr_get_ct298385 +Ref: funct:unur_itdr_get_area298696 +Ref: funct:unur_itdr_set_verify298845 +Ref: funct:unur_itdr_chg_verify299258 +Node: NINV299394 +Ref: funct:unur_ninv_new304180 +Ref: funct:unur_ninv_set_useregula304295 +Ref: funct:unur_ninv_set_usenewton304452 +Ref: funct:unur_ninv_set_usebisect304912 +Ref: funct:unur_ninv_set_max_iter305084 +Ref: funct:unur_ninv_chg_max_iter305084 +Ref: funct:unur_ninv_set_x_resolution305333 +Ref: funct:unur_ninv_chg_x_resolution305333 +Ref: funct:unur_ninv_set_u_resolution305697 +Ref: funct:unur_ninv_chg_u_resolution305697 +Ref: funct:unur_ninv_set_start306070 +Ref: funct:unur_ninv_chg_start306724 +Ref: funct:unur_ninv_set_table306980 +Ref: funct:unur_ninv_chg_table307543 +Ref: funct:unur_ninv_chg_truncated307683 +Ref: funct:unur_ninv_eval_approxinvcdf308683 +Node: NROU309270 +Ref: funct:unur_nrou_new312986 +Ref: funct:unur_nrou_set_u313101 +Ref: funct:unur_nrou_set_v313780 +Ref: funct:unur_nrou_set_r314109 +Ref: funct:unur_nrou_set_center314321 +Ref: funct:unur_nrou_set_verify314566 +Ref: funct:unur_nrou_chg_verify314979 +Node: PINV315115 +Ref: funct:unur_pinv_new322816 +Ref: funct:unur_pinv_set_order322931 +Ref: funct:unur_pinv_set_smoothness323178 +Ref: funct:unur_pinv_set_u_resolution325632 +Ref: funct:unur_pinv_set_extra_testpoints327247 +Ref: funct:unur_pinv_set_use_upoints328011 +Ref: funct:unur_pinv_set_usepdf328456 +Ref: funct:unur_pinv_set_usecdf328610 +Ref: funct:unur_pinv_set_boundary329216 +Ref: funct:unur_pinv_set_searchboundary329992 +Ref: funct:unur_pinv_set_max_intervals330982 +Ref: funct:unur_pinv_get_n_intervals331211 +Ref: funct:unur_pinv_set_keepcdf331407 +Ref: funct:unur_pinv_eval_approxinvcdf332071 +Ref: funct:unur_pinv_eval_approxcdf332486 +Ref: funct:unur_pinv_estimate_error332924 +Node: SROU333318 +Ref: funct:unur_srou_new338369 +Ref: funct:unur_srou_set_r338484 +Ref: funct:unur_srou_set_cdfatmode339112 +Ref: funct:unur_srou_set_pdfatmode339462 +Ref: funct:unur_srou_set_usesqueeze339983 +Ref: funct:unur_srou_set_usemirror340434 +Ref: funct:unur_srou_set_verify341147 +Ref: funct:unur_srou_chg_verify341147 +Ref: funct:unur_srou_chg_cdfatmode341646 +Ref: funct:unur_srou_chg_pdfatmode341859 +Node: SSR342072 +Ref: funct:unur_ssr_new345554 +Ref: funct:unur_ssr_set_cdfatmode345668 +Ref: funct:unur_ssr_set_pdfatmode346016 +Ref: funct:unur_ssr_set_usesqueeze346441 +Ref: funct:unur_ssr_set_verify346845 +Ref: funct:unur_ssr_chg_verify346845 +Ref: funct:unur_ssr_chg_cdfatmode347332 +Ref: funct:unur_ssr_chg_pdfatmode347544 +Node: TABL347756 +Ref: funct:unur_tabl_new353421 +Ref: funct:unur_tabl_set_variant_ia353536 +Ref: funct:unur_tabl_set_cpoints354047 +Ref: funct:unur_tabl_set_nstp354407 +Ref: funct:unur_tabl_set_useear354831 +Ref: funct:unur_tabl_set_areafraction355308 +Ref: funct:unur_tabl_set_usedars355824 +Ref: funct:unur_tabl_set_darsfactor356610 +Ref: funct:unur_tabl_set_variant_splitmode357245 +Ref: funct:unur_tabl_set_max_sqhratio357765 +Ref: funct:unur_tabl_get_sqhratio358491 +Ref: funct:unur_tabl_get_hatarea358711 +Ref: funct:unur_tabl_get_squeezearea358895 +Ref: funct:unur_tabl_set_max_intervals359097 +Ref: funct:unur_tabl_get_n_intervals359364 +Ref: funct:unur_tabl_set_slopes359522 +Ref: funct:unur_tabl_set_guidefactor360494 +Ref: funct:unur_tabl_set_boundary360830 +Ref: funct:unur_tabl_chg_truncated361242 +Ref: funct:unur_tabl_set_verify362835 +Ref: funct:unur_tabl_chg_verify362835 +Ref: funct:unur_tabl_set_pedantic363334 +Node: TDR363858 +Ref: funct:unur_tdr_new367649 +Ref: funct:unur_tdr_set_c367763 +Ref: funct:unur_tdr_set_variant_gw368019 +Ref: funct:unur_tdr_set_variant_ps368194 +Ref: funct:unur_tdr_set_variant_ia368382 +Ref: funct:unur_tdr_set_usedars368582 +Ref: funct:unur_tdr_set_darsfactor370689 +Ref: funct:unur_tdr_set_cpoints371326 +Ref: funct:unur_tdr_set_reinit_percentiles371671 +Ref: funct:unur_tdr_chg_reinit_percentiles371671 +Ref: funct:unur_tdr_set_reinit_ncpoints372759 +Ref: funct:unur_tdr_chg_reinit_ncpoints372759 +Ref: funct:unur_tdr_chg_truncated373183 +Ref: funct:unur_tdr_set_max_sqhratio374694 +Ref: funct:unur_tdr_get_sqhratio375269 +Ref: funct:unur_tdr_get_hatarea375488 +Ref: funct:unur_tdr_get_squeezearea375671 +Ref: funct:unur_tdr_set_max_intervals375872 +Ref: funct:unur_tdr_set_usecenter376234 +Ref: funct:unur_tdr_set_usemode376391 +Ref: funct:unur_tdr_set_guidefactor377047 +Ref: funct:unur_tdr_set_verify377376 +Ref: funct:unur_tdr_chg_verify377376 +Ref: funct:unur_tdr_set_pedantic377863 +Ref: funct:unur_tdr_eval_invcdfhat378939 +Node: UTDR379986 +Ref: funct:unur_utdr_new382237 +Ref: funct:unur_utdr_set_pdfatmode382352 +Ref: funct:unur_utdr_set_cpfactor382778 +Ref: funct:unur_utdr_set_deltafactor383137 +Ref: funct:unur_utdr_set_verify383489 +Ref: funct:unur_utdr_chg_verify383489 +Ref: funct:unur_utdr_chg_pdfatmode383988 +Node: Methods_for_CEMP384201 +Node: EMPK389979 +Ref: funct:unur_empk_new394309 +Ref: funct:unur_empk_set_kernel394424 +Ref: funct:unur_empk_set_kernelgen395260 +Ref: funct:unur_empk_set_beta396542 +Ref: funct:unur_empk_set_smoothing396987 +Ref: funct:unur_empk_chg_smoothing396987 +Ref: funct:unur_empk_set_varcor397805 +Ref: funct:unur_empk_chg_varcor397805 +Ref: funct:unur_empk_set_positive398236 +Node: EMPL398493 +Ref: funct:unur_empl_new400237 +Node: HIST400352 +Ref: funct:unur_hist_new401126 +Node: Methods_for_CVEC401241 +Node: MVSTD401984 +Ref: funct:unur_mvstd_new403287 +Node: MVTDR403647 +Ref: funct:unur_mvtdr_new407191 +Ref: funct:unur_mvtdr_set_stepsmin407299 +Ref: funct:unur_mvtdr_set_boundsplitting407518 +Ref: funct:unur_mvtdr_set_maxcones407996 +Ref: funct:unur_mvtdr_get_ncones408595 +Ref: funct:unur_mvtdr_get_hatvol408785 +Ref: funct:unur_mvtdr_set_verify408971 +Ref: funct:unur_mvtdr_chg_verify408971 +Node: NORTA409482 +Ref: funct:unur_norta_new412289 +Node: VNROU412405 +Ref: funct:unur_vnrou_new417083 +Ref: funct:unur_vnrou_set_u417199 +Ref: funct:unur_vnrou_chg_u417946 +Ref: funct:unur_vnrou_set_v418109 +Ref: funct:unur_vnrou_chg_v418449 +Ref: funct:unur_vnrou_set_r418577 +Ref: funct:unur_vnrou_set_verify418808 +Ref: funct:unur_vnrou_chg_verify419221 +Ref: funct:unur_vnrou_get_volumehat419368 +Node: MCMC_Methods_for_CVEC419681 +Node: GIBBS420584 +Ref: funct:unur_gibbs_new425741 +Ref: funct:unur_gibbs_set_variant_coordinate425895 +Ref: funct:unur_gibbs_set_variant_random_direction426100 +Ref: funct:unur_gibbs_set_c426262 +Ref: funct:unur_gibbs_set_startingpoint426949 +Ref: funct:unur_gibbs_set_thinning427482 +Ref: funct:unur_gibbs_set_burnin427804 +Ref: funct:unur_gibbs_get_state428717 +Ref: funct:unur_gibbs_chg_state428717 +Ref: funct:unur_gibbs_reset_state428939 +Node: HITRO429284 +Ref: funct:unur_hitro_new437749 +Ref: funct:unur_hitro_set_variant_coordinate437865 +Ref: funct:unur_hitro_set_variant_random_direction438226 +Ref: funct:unur_hitro_set_use_adaptiveline438388 +Ref: funct:unur_hitro_set_use_boundingrectangle439096 +Ref: funct:unur_hitro_set_use_adaptiverectangle439629 +Ref: funct:unur_hitro_set_r441092 +Ref: funct:unur_hitro_set_v441323 +Ref: funct:unur_hitro_set_u442001 +Ref: funct:unur_hitro_set_adaptive_multiplier443045 +Ref: funct:unur_hitro_set_startingpoint443682 +Ref: funct:unur_hitro_set_thinning444327 +Ref: funct:unur_hitro_set_burnin444891 +Ref: funct:unur_hitro_get_state445536 +Ref: funct:unur_hitro_chg_state445536 +Ref: funct:unur_hitro_reset_state446115 +Node: Methods_for_CVEMP446460 +Node: VEMPK450086 +Ref: funct:unur_vempk_new451952 +Ref: funct:unur_vempk_set_smoothing452068 +Ref: funct:unur_vempk_chg_smoothing452068 +Ref: funct:unur_vempk_set_varcor452882 +Ref: funct:unur_vempk_chg_varcor452882 +Node: Methods_for_DISCR453325 +Node: DARI459325 +Ref: funct:unur_dari_new461569 +Ref: funct:unur_dari_set_squeeze461684 +Ref: funct:unur_dari_set_tablesize462266 +Ref: funct:unur_dari_set_cpfactor462717 +Ref: funct:unur_dari_set_verify463148 +Ref: funct:unur_dari_chg_verify463148 +Node: DAU463611 +Ref: funct:unur_dau_new465134 +Ref: funct:unur_dau_set_urnfactor465248 +Node: DEXT465625 +Ref: funct:unur_dext_new473506 +Ref: funct:unur_dext_set_init473625 +Ref: funct:unur_dext_set_sample474244 +Ref: funct:unur_dext_get_params474731 +Ref: funct:unur_dext_get_distrparams475351 +Ref: funct:unur_dext_get_ndistrparams475351 +Node: DGT475724 +Ref: funct:unur_dgt_new478800 +Ref: funct:unur_dgt_set_guidefactor478914 +Ref: funct:unur_dgt_set_variant479502 +Node: DSROU479883 +Ref: funct:unur_dsrou_new481786 +Ref: funct:unur_dsrou_set_cdfatmode481902 +Ref: funct:unur_dsrou_set_verify482432 +Ref: funct:unur_dsrou_chg_verify482432 +Ref: funct:unur_dsrou_chg_cdfatmode482943 +Node: DSS483157 +Ref: funct:unur_dss_new484808 +Node: DSTD484922 +Ref: funct:unur_dstd_new487276 +Ref: funct:unur_dstd_set_variant487863 +Ref: funct:unur_dstd_chg_truncated488476 +Node: Methods_for_MATR489597 +Node: MCORR489988 +Ref: funct:unur_mcorr_new492558 +Ref: funct:unur_mcorr_set_eigenvalues492674 +Ref: funct:unur_mcorr_chg_eigenvalues493342 +Node: Methods_for_UNID493576 +Node: UNIF493846 +Ref: funct:unur_unif_new494406 +Node: Meta_Methods494665 +Node: MIXT501503 +Ref: funct:unur_mixt_new503721 +Ref: funct:unur_mixt_set_useinversion504097 +Node: URNG504718 +Ref: funct:unur_get_default_urng511701 +Ref: funct:unur_set_default_urng511915 +Ref: funct:unur_set_default_urng_aux512127 +Ref: funct:unur_get_default_urng_aux512127 +Ref: funct:unur_set_urng512422 +Ref: funct:unur_chg_urng512906 +Ref: funct:unur_get_urng513244 +Ref: funct:unur_set_urng_aux513438 +Ref: funct:unur_use_urng_aux_default514067 +Ref: funct:unur_chgto_urng_aux_default514353 +Ref: funct:unur_chg_urng_aux514642 +Ref: funct:unur_get_urng_aux515135 +Ref: funct:unur_urng_sample515536 +Ref: funct:unur_sample_urng515718 +Ref: funct:unur_urng_sample_array515962 +Ref: funct:unur_urng_reset516692 +Ref: funct:unur_urng_sync517311 +Ref: funct:unur_urng_seed517632 +Ref: funct:unur_urng_anti518589 +Ref: funct:unur_urng_nextsub518903 +Ref: funct:unur_urng_resetsub519217 +Ref: funct:unur_gen_sync519538 +Ref: funct:unur_gen_seed519538 +Ref: funct:unur_gen_anti519538 +Ref: funct:unur_gen_reset519538 +Ref: funct:unur_gen_nextsub519538 +Ref: funct:unur_gen_resetsub519538 +Ref: funct:unur_urng_new520935 +Ref: funct:unur_urng_free521740 +Ref: funct:unur_urng_set_sample_array522327 +Ref: funct:unur_urng_set_sync522581 +Ref: funct:unur_urng_set_seed522741 +Ref: funct:unur_urng_set_anti522916 +Ref: funct:unur_urng_set_reset523111 +Ref: funct:unur_urng_set_nextsub523301 +Ref: funct:unur_urng_set_resetsub523500 +Ref: funct:unur_urng_set_delete523704 +Node: URNG-FVOID523859 +Ref: funct:unur_urng_fvoid_new525374 +Node: URNG-GSL525661 +Ref: funct:unur_urng_gsl_new529769 +Ref: funct:unur_urng_gslptr_new530125 +Node: URNG-GSLQRNG530728 +Ref: funct:unur_urng_gslqrng_new531976 +Node: URNG-PRNG532401 +Ref: funct:unur_urng_prng_new533893 +Ref: funct:unur_urng_prngptr_new534747 +Node: URNG-RNGSTREAM534985 +Ref: funct:unur_urng_rngstream_new536893 +Ref: funct:unur_urng_rngstreamptr_new537128 +Node: URNG-RANDOMSHIFT537355 +Ref: funct:unur_urng_randomshift_new539040 +Ref: funct:unur_urng_randomshift_nextshift539551 +Node: Stddist539747 +Node: Stddist_CONT543763 +Node: F545002 +Ref: funct:unur_distr_F545126 +Node: beta545507 +Ref: funct:unur_distr_beta545658 +Node: cauchy546142 +Ref: funct:unur_distr_cauchy546303 +Node: chi546725 +Ref: funct:unur_distr_chi546879 +Node: chisquare547264 +Ref: funct:unur_distr_chisquare547447 +Node: exponential547797 +Ref: funct:unur_distr_exponential547993 +Node: extremeI548397 +Ref: funct:unur_distr_extremeI548633 +Node: extremeII549061 +Ref: funct:unur_distr_extremeII549297 +Node: gamma549790 +Ref: funct:unur_distr_gamma549951 +Node: gig550602 +Ref: funct:unur_distr_gig550802 +Node: gig2551338 +Ref: funct:unur_distr_gig2551545 +Node: hyperbolic551988 +Ref: funct:unur_distr_hyperbolic552170 +Node: ig552686 +Ref: funct:unur_distr_ig552867 +Node: laplace553248 +Ref: funct:unur_distr_laplace553419 +Node: logistic553828 +Ref: funct:unur_distr_logistic554010 +Node: lognormal554446 +Ref: funct:unur_distr_lognormal554632 +Node: lomax555085 +Ref: funct:unur_distr_lomax555325 +Node: normal555702 +Ref: funct:unur_distr_normal555869 +Node: pareto556542 +Ref: funct:unur_distr_pareto556752 +Node: powerexponential557130 +Ref: funct:unur_distr_powerexponential557372 +Node: rayleigh557750 +Ref: funct:unur_distr_rayleigh557937 +Node: slash558207 +Ref: funct:unur_distr_slash558373 +Node: student558635 +Ref: funct:unur_distr_student558821 +Node: triangular559133 +Ref: funct:unur_distr_triangular559323 +Node: uniform559674 +Ref: funct:unur_distr_uniform559852 +Node: weibull560216 +Ref: funct:unur_distr_weibull560375 +Node: Stddist_CVEC560870 +Node: copula561334 +Ref: funct:unur_distr_copula561540 +Node: multicauchy562063 +Ref: funct:unur_distr_multicauchy562264 +Node: multiexponential562753 +Ref: funct:unur_distr_multiexponential562979 +Node: multinormal563416 +Ref: funct:unur_distr_multinormal563623 +Node: multistudent564065 +Ref: funct:unur_distr_multistudent564251 +Node: Stddist_DISCR564766 +Node: binomial565397 +Ref: funct:unur_distr_binomial565562 +Node: geometric565971 +Ref: funct:unur_distr_geometric566163 +Node: hypergeometric566465 +Ref: funct:unur_distr_hypergeometric566680 +Node: logarithmic567186 +Ref: funct:unur_distr_logarithmic567396 +Node: negativebinomial567757 +Ref: funct:unur_distr_negativebinomial567982 +Node: poisson568308 +Ref: funct:unur_distr_poisson568475 +Node: Stddist_MATR568931 +Node: correlation569140 +Ref: funct:unur_distr_correlation569303 +Node: Error_Debug569577 +Node: Output_streams570477 +Ref: funct:unur_set_stream571613 +Ref: funct:unur_get_stream572421 +Node: Debug572619 +Ref: funct:unur_set_debug575142 +Ref: funct:unur_chg_debug575255 +Ref: funct:unur_set_default_debug575370 +Node: Error_reporting575465 +Ref: var:unur_errno579658 +Ref: funct:unur_get_errno579752 +Ref: funct:unur_reset_errno579847 +Ref: funct:unur_get_strerror579983 +Node: Errno580101 +Node: Error_handlers583445 +Ref: funct:unur_set_error_handler585467 +Ref: funct:unur_set_error_handler_off586112 +Node: Testing586387 +Ref: funct:unur_run_tests586730 +Ref: funct:unur_test_printsample587387 +Ref: funct:unur_test_timing587624 +Ref: funct:unur_test_timing_R588983 +Ref: funct:unur_test_timing_uniform590448 +Ref: funct:unur_test_timing_exponential590448 +Ref: funct:unur_test_timing_total590944 +Ref: funct:unur_test_count_urn591867 +Ref: funct:unur_test_count_pdf592388 +Ref: funct:unur_test_par_count_pdf593372 +Ref: funct:unur_test_chi2593746 +Ref: funct:unur_test_moments595852 +Ref: funct:unur_test_correlation596664 +Ref: funct:unur_test_quartiles597075 +Ref: funct:unur_test_u_error597586 +Node: Misc599434 +Node: Math599572 +Node: RVG600043 +Node: Inversion601784 +Node: Rejection608669 +Node: Composition615888 +Node: Ratio-of-Uniforms617693 +Node: DiscreteInversion623748 +Node: IndexedSearch627166 +Node: Glossary629065 +Node: Bibliography631125 +Ref: bib:JKKa92631305 +Ref: bib:JKBb94631454 +Ref: bib:JKBc95631626 +Ref: bib:JKBd97631798 +Ref: bib:KBJe00631942 +Ref: bib:HLD04632187 +Ref: bib:AJa93632361 +Ref: bib:AJa95632506 +Ref: bib:CAa74632658 +Ref: bib:DHLa08632800 +Ref: bib:DLa86633097 +Ref: bib:GWa92633202 +Ref: bib:HWa95633338 +Ref: bib:HDa96633496 +Ref: bib:HLa00633664 +Ref: bib:HLa03633913 +Ref: bib:HLDa07634061 +Ref: bib:KLPa05634249 +Ref: bib:LJa98634587 +Ref: bib:LJa00634741 +Ref: bib:LJa01634881 +Ref: bib:LJa02635064 +Ref: bib:WGS91635211 +Ref: bib:WAa77635404 +Ref: bib:ADa74635621 +Ref: bib:ADa82635784 +Ref: bib:ADb82635933 +Ref: bib:BMa58636104 +Ref: bib:CHa77636248 +Ref: bib:Dag89636389 +Ref: bib:HDa90636536 +Ref: bib:KAa81636674 +Ref: bib:KRa76636819 +Ref: bib:MJa87636969 +Ref: bib:MGa62637101 +Ref: bib:MOa84637263 +Ref: bib:STa89637390 +Ref: bib:ZHa94637634 +Ref: bib:CPa76637844 +Ref: bib:HJa61638022 +Node: FIndex638197 + +End Tag Table + + +Local Variables: +coding: utf-8 +End: diff --git a/vendor/unuran-1.11.0/doc/unuran.texi b/vendor/unuran-1.11.0/doc/unuran.texi new file mode 100644 index 0000000..c070e93 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/unuran.texi @@ -0,0 +1,74 @@ +\input texinfo @c -*-texinfo-*- + +@c %**start of header +@setfilename unuran.info +@settitle UNU.RAN User Manual +@iftex +@afourpaper +@end iftex +@footnotestyle end +@setchapternewpage odd +@c %**end of header + +@c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +@c +@c Some data about this software +@c + +@dircategory Scientific software +@direntry +* unuran: (unuran). UNU.RAN -- Universal Non-Uniform Random number generator +@end direntry + +@c Version ... +@include version.texi + +@c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +@c +@c Copyright +@c + +@copying +@noindent +Copyright @copyright{} 2000--2012 Institut fuer Statistik, WU Wien. + +@noindent +Permission is granted to make and distribute verbatim +copies of this manual provided the copyright notice and +this permission notice are preserved on all copies. +@end copying + +@c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +@c +@c Titlepage ... +@c + +@titlepage +@title UNU.RAN User Manual +@subtitle Generating non-uniform random numbers +@subtitle Version @value{VERSION}, @value{UPDATED} + +@author Josef Leydold +@author Wolfgang H@"ormann + +@page +@vskip 0pt plus 1filll +@insertcopying +@end titlepage + +@c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +@c +@c Table of contents +@c + +@contents + +@c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +@c +@c insert automatically generated documentation ... +@c + +@include unuran_src.texi + +@c -------------------------------------------------------------------- +@bye diff --git a/vendor/unuran-1.11.0/doc/unuran.txt b/vendor/unuran-1.11.0/doc/unuran.txt new file mode 100644 index 0000000..1180d1c --- /dev/null +++ b/vendor/unuran-1.11.0/doc/unuran.txt @@ -0,0 +1,14337 @@ +UNU.RAN – Universal Non-Uniform RANdom number generators +1 Introduction + 1.1 Usage of this document + 1.2 Installation + 1.3 Using the library + 1.4 Concepts of UNU.RAN + 1.5 Contact the authors +2 Examples + 2.1 As short as possible + 2.2 As short as possible (String API) + 2.3 Select a method + 2.4 Select a method (String API) + 2.5 Arbitrary distributions + 2.6 Arbitrary distributions (String API) + 2.7 Change parameters of the method + 2.8 Change parameters of the method (String API) + 2.9 Change uniform random generator + 2.10 Change parameters of underlying distribution + 2.11 Sample pairs of antithetic random variates + 2.12 Sample pairs of antithetic random variates (String API) + 2.13 More examples +3 String Interface + 3.1 Syntax of String Interface + 3.2 Distribution String + 3.2.1 Keys for Distribution String + 3.3 Function String + 3.4 Method String + 3.4.1 Keys for Method String + 3.5 Uniform RNG String +4 Handling distribution objects + 4.1 Functions for all kinds of distribution objects + 4.2 Continuous univariate distributions + 4.3 Continuous univariate order statistics + 4.4 Continuous empirical univariate distributions + 4.5 Continuous multivariate distributions + 4.6 Continuous univariate full conditional distribution + 4.7 Continuous empirical multivariate distributions + 4.8 MATRix distributions + 4.9 Discrete univariate distributions +5 Methods for generating non-uniform random variates + 5.1 Routines for all generator objects + 5.2 AUTO – Select method automatically + 5.3 Methods for continuous univariate distributions + 5.3.1 AROU – Automatic Ratio-Of-Uniforms method + 5.3.2 ARS – Adaptive Rejection Sampling + 5.3.3 CEXT – wrapper for Continuous EXTernal generators + 5.3.4 CSTD – Continuous STandarD distributions + 5.3.5 HINV – Hermite interpolation based INVersion of CDF + 5.3.6 HRB – Hazard Rate Bounded + 5.3.7 HRD – Hazard Rate Decreasing + 5.3.8 HRI – Hazard Rate Increasing + 5.3.9 ITDR – Inverse Transformed Density Rejection + 5.3.10 NINV – Numerical INVersion + 5.3.11 NROU – Naive Ratio-Of-Uniforms method + 5.3.12 PINV – Polynomial interpolation based INVersion of CDF + 5.3.13 SROU – Simple Ratio-Of-Uniforms method + 5.3.14 SSR – Simple Setup Rejection + 5.3.15 TABL – a TABLe method with piecewise constant hats + 5.3.16 TDR – Transformed Density Rejection + 5.3.17 UTDR – Universal Transformed Density Rejection + 5.4 Methods for continuous empirical univariate distributions + 5.4.1 EMPK – EMPirical distribution with Kernel smoothing + 5.4.2 EMPL – EMPirical distribution with Linear interpolation + 5.4.3 HIST – HISTogramm of empirical distribution + 5.5 Methods for continuous multivariate distributions + 5.5.1 MVSTD – MultiVariate continuous STandarD distributions + 5.5.2 MVTDR – Multi-Variate Transformed Density Rejection + 5.5.3 NORTA – NORmal To Anything + 5.5.4 VNROU – Multivariate Naive Ratio-Of-Uniforms method + 5.6 Markov chain samplers for continuous multivariate distributions + 5.6.1 GIBBS – Markov Chain - GIBBS sampler + 5.6.2 HITRO – Markov Chain - HIT-and-run sampler with Ratio-Of-uniforms + 5.7 Methods for continuous empirical multivariate distributions + 5.7.1 VEMPK – (Vector) EMPirical distribution with Kernel smoothing + 5.8 Methods for discrete univariate distributions + 5.8.1 DARI – Discrete Automatic Rejection Inversion + 5.8.2 DAU – (Discrete) Alias-Urn method + 5.8.3 DEXT – wrapper for Discrete EXTernal generators + 5.8.4 DGT – (Discrete) Guide Table method (indexed search) + 5.8.5 DSROU – Discrete Simple Ratio-Of-Uniforms method + 5.8.6 DSS – (Discrete) Sequential Search method + 5.8.7 DSTD – Discrete STandarD distributions + 5.9 Methods for random matrices + 5.9.1 MCORR – Random CORRelation matrix + 5.10 Methods for uniform univariate distributions + 5.10.1 UNIF – wrapper for UNIForm random number generator + 5.11 Meta Methods for univariate distributions + 5.11.1 MIXT – MIXTure of distributions +6 Using uniform random number generators + 6.1 Simple interface for uniform random number generators + 6.2 Interface to GSL uniform random number generators + 6.3 Interface to GSL generators for quasi-random points + 6.4 Interface to Otmar Lendl’s pseudo-random number generators + 6.5 Interface to L’Ecuyer’s RNGSTREAM random number generators + 6.6 Combine point set generator with random shifts +7 UNU.RAN Library of standard distributions + 7.1 UNU.RAN Library of continuous univariate distributions + 7.1.1 ‘F’ – F-distribution + 7.1.2 ‘beta’ – Beta distribution + 7.1.3 ‘cauchy’ – Cauchy distribution + 7.1.4 ‘chi’ – Chi distribution + 7.1.5 ‘chisquare’ – Chisquare distribution + 7.1.6 ‘exponential’ – Exponential distribution + 7.1.7 ‘extremeI’ – Extreme value type I (Gumbel-type) distribution + 7.1.8 ‘extremeII’ – Extreme value type II (Frechet-type) distribution + 7.1.9 ‘gamma’ – Gamma distribution + 7.1.10 ‘gig’ – Generalized Inverse Gaussian distribution + 7.1.11 ‘gig2’ – Generalized Inverse Gaussian distribution + 7.1.12 ‘hyperbolic’ – Hyperbolic distribution + 7.1.13 ‘ig’ – Inverse Gaussian distribution + 7.1.14 ‘laplace’ – Laplace distribution + 7.1.15 ‘logistic’ – Logistic distribution + 7.1.16 ‘lognormal’ – Log-Normal distribution + 7.1.17 ‘lomax’ – Lomax distribution (Pareto distribution of second kind) + 7.1.18 ‘normal’ – Normal distribution + 7.1.19 ‘pareto’ – Pareto distribution (of first kind) + 7.1.20 ‘powerexponential’ – Powerexponential (Subbotin) distribution + 7.1.21 ‘rayleigh’ – Rayleigh distribution + 7.1.22 ‘slash’ – Slash distribution + 7.1.23 ‘student’ – Student’s t distribution + 7.1.24 ‘triangular’ – Triangular distribution + 7.1.25 ‘uniform’ – Uniform distribution + 7.1.26 ‘weibull’ – Weibull distribution + 7.2 UNU.RAN Library of continuous multivariate distributions + 7.2.1 ‘copula’ – Copula (distribution with uniform marginals) + 7.2.2 ‘multicauchy’ – Multicauchy distribution + 7.2.3 ‘multiexponential’ – Multiexponential distribution + 7.2.4 ‘multinormal’ – Multinormal distribution + 7.2.5 ‘multistudent’ – Multistudent distribution + 7.3 UNU.RAN Library of discrete univariate distributions + 7.3.1 ‘binomial’ – Binomial distribution + 7.3.2 ‘geometric’ – Geometric distribution + 7.3.3 ‘hypergeometric’ – Hypergeometric distribution + 7.3.4 ‘logarithmic’ – Logarithmic distribution + 7.3.5 ‘negativebinomial’ – Negative Binomial distribution + 7.3.6 ‘poisson’ – Poisson distribution + 7.4 UNU.RAN Library of random matrices + 7.4.1 ‘correlation’ – Random correlation matrix +8 Error handling and Debugging + 8.1 Output streams + 8.2 Debugging + 8.3 Error reporting + 8.4 Error codes + 8.5 Error handlers +9 Testing +10 Miscelleanous + 10.1 Mathematics +Appendix A A Short Introduction to Random Variate Generation + A.1 The Inversion Method + A.2 The Rejection Method + A.3 The Composition Method + A.4 The Ratio-of-Uniforms Method + A.5 Inversion for Discrete Distributions + A.6 Indexed Search (Guide Table Method) +Appendix B Glossary +Appendix C Bibliography +Appendix D Function Index +UNU.RAN – Universal Non-Uniform RANdom number generators +******************************************************** + +This is the online-documentation of UNU.RAN. +Version: 1.11.0 +Date: 21 April 2023 + + UNU.RAN (Universal Non-Uniform RAndom Number generator) is a collection of +algorithms for generating non-uniform pseudorandom variates as a library of C +functions designed and implemented by the ARVAG (Automatic Random VAriate +Generation) project group in Vienna, and released under the GNU Public License +(GPL). It is especially designed for such situations where + + − a non-standard distribution or a truncated distribution is needed. + + − experiments with different types of distributions are made. + + − random variates for variance reduction techniques are used. + + − fast generators of predictable quality are necessary. + + Of course it is also well suited for standard distributions. However due to +its more sophisticated programming interface it might not be as easy to use if +you only look for a generator for the standard normal distribution. (Although +UNU.RAN provides generators that are superior in many aspects to those found in +quite a number of other libraries.) + + UNU.RAN implements several methods for generating random numbers. The choice +depends primary on the information about the distribution can be provided and – +if the user is familar with the different methods – on the preferences of the +user. + + The design goals of UNU.RAN are to provide _reliable_, _portable_ and +_robust_ (as far as this is possible) functions with a consisent and easy to use +interface. It is suitable for all situation where experiments with different +distributions including non-standard distributions. For example it is no +problem to replace the normal distribution by an empirical distribution in a +model. + + Since originally designed as a library for so called black-box or universal +algorithms its interface is different from other libraries. (Nevertheless it +also contains special generators for standard distributions.) It does not +provide subroutines for random variate generation for particular distributions. +Instead it uses an object-oriented interface. Distributions and generators are +treated as independent objects. This approach allows one not only to have +different methods for generating non-uniform random variates. It is also +possible to choose the method which is optimal for a given situation (e.g. +speed, quality of random numbers, using for variance reduction techniques, +etc.). It also allows to sample from non-standard distribution or even from +distributions that arise in a model and can only be computed in a complicated +subroutine. + + Sampling from a particular distribution requires the following steps: + + 1. Create a distribution object. (Objects for standard distributions are + available in the library) + + 2. Choose a method. + + 3. Initialize the generator, i.e., create the generator object. If the + choosen method is not suitable for the given distribution (or if the + distribution object contains too little information about the distribution) + the initialization routine fails and produces an error message. Thus the + generator object does (probably) not produce false results (random variates + of a different distribution). + + 4. Use this generator object to sample from the distribution. + + There are four types of objects that can be manipulated independently: + + • *Distribution objects:* hold all information about the random variates that + should be generated. The following types of distributions are available: + + − Continuous and Discrete distributions + − Empirical distributions + − Multivariate distributions + + Of course a library of standard distributions is included (and these can be + further modified to get, e.g., truncated distributions). Moreover the + library provides subroutines to build almost arbitrary distributions. + + • *Generator objects:* hold the generators for the given distributions. It + is possible to build independent generator objects for the same + distribution object which might use the same or different methods for + generation. (If the choosen method is not suitable for the given method, a + ‘NULL’ pointer is returned in the initialization step). + + • *Parameter objects:* Each transformation method requires several parameters + to adjust the generator to a given distribution. The parameter object + holds all this information. When created it contains all necessary default + settings. It is only used to create a generator object and destroyed + immediately. Altough there is no need to change these parameters or even + know about their existence for “usual distributions”, they allow a fine + tuning of the generator to work with distributions with some awkward + properties. The library provides all necessary functions to change these + default parameters. + + • *Uniform Random Number Generators:* All generator objects need one (or + more) streams of uniform random numbers that are transformed into random + variates of the given distribution. These are given as pointers to + appropriate functions or structures (objects). Two generator objects may + have their own uniform random number generators or share a common one. Any + functions that produce uniform (pseudo-) random numbers can be used. We + suggest Otmar Lendl’s PRNG library. + +1 Introduction +************** + +1.1 Usage of this document +========================== + +We designed this document in a way such that one can use UNU.RAN with reading as +little as necessary. Read *note Installation:: for the instructions to install +the library. *note Concepts of UNU.RAN: Concepts, discribes the basics of +UNU.RAN. It also has a short guideline for choosing an appropriate method. In +*note Examples:: examples are given that can be copied and modified. They also +can be found in the directory ‘examples’ in the source tree. + + Further information are given in consecutive chapters. *note Handling +distribution objects: Distribution_objects, describes how to create and +manipulate distribution objects. *note standard distributions: Stddist, +describes predefined distribution objects that are ready to use. *note +Methods:: describes the various methods in detail. For each of possible +distribution classes (continuous, discrete, empirical, multivariate) there +exists a short overview section that can be used to choose an appropriate method +followed by sections that describe each of the particular methods in detail. +These are merely for users with some knowledge about the methods who want to +change method-specific parameters and can be ignored by others. + + Abbreviations and explanation of some basic terms can be found in *note +Glossary::. + +1.2 Installation +================ + +UNU.RAN was developed on an Intel architecture under Linux with the GNU C +compiler but should compile and run on any computing environment. It requires +an ANSI compliant C compiler. + + Below find the installation instructions for unices. + +Uniform random number generator +............................... + +UNU.RAN can be used with any uniform random number generator but (at the moment) +some features work best with Pierre L’Ecuyer’s RngStreams library (see + for a description and +downloading. For details on using uniform random number in UNU.RAN see *note +Using uniform random number generators: URNG. + + Install the required libraries first. + +UNU.RAN +....... + + 1. First unzip and untar the package and change to the directory: + + tar zxvf unuran-1.11.0.tar.gz + cd unuran-1.11.0 + + 2. Optional: Edit the file ‘src/unuran_config.h’ + + 3. Run a configuration script: + + sh ./configure --prefix= + + where ‘’ is the root of the installation tree. When omitted + ‘/usr/local’ is used. + + Use ‘./configure --help’ to get a list of other options. In particular the + following flags are important: + + • Enable support for some external sources of uniform random number + generators (*note Using uniform random number generators: URNG.): + + ‘--with-urng-rngstream’ + URNG: use Pierre L’Ecuyer’s RNGSTREAM library [default=‘no’] + + ‘--with-urng-prng’ + URNG: use Otmar Lendl’s PRNG library [default=‘no’] + + ‘--with-urng-gsl’ + URNG: use random number generators from GNU Scientific Library + [default=‘no’] + + ‘--with-urng-default’ + URNG: global default URNG (builtin|rngstream) [default=‘builtin’] + + We strongly recommend to use RngStreams library: + + sh ./configure --with-urng-rngstream --with-urng-default=rngstream + + _Important:_ You must install the respective libraries ‘RngStreams’, + ‘PRNG’ and ‘GSL’ before ‘./configure’ is executed. + + • Also make a shared library: + + ‘--enable-shared’ + build shared libraries [default=‘no’] + + • The library provides the function ‘unur_gen_info’ for information + about generator objects. This is intented for using in interactive + computing environments. This feature can be enabled / disabled by + means of the configure flag + + ‘--enable-info’ + INFO: provide function with information about generator objects + [default=‘yes’] + + • Enable support for deprecated UNU.RAN routines if you have some + problems with older application after upgrading the library: + + ‘--enable-deprecated’ + enable support for deprecated UNU.RAN routines [default=‘no’] + + • Enable debugging tools: + + ‘--enable-check-struct’ + Debug: check validity of pointers to structures [default=‘no’] + + ‘--enable-logging’ + Debug: print informations about generator into logfile + [default=no] + + 4. Compile and install the libray: + + make + make install + + Obviously ‘$(prefix)/include’ and ‘$(prefix)/lib’ must be in the search + path of your compiler. You can use environment variables to add these + directories to the search path. If you are using the bash type (or add to + your profile): + + export LIBRARY_PATH="/lib" + export C_INCLURE_PATH="/include" + + If you want to make a shared library, then making such a library can be + enabled using + + sh ./configure --enable-shared + + If you want to link against the shared library make sure that it can be + found when executing the binary that links to the library. If it is not + installed in the usual path, then the easiest way is to set the + ‘LD_LIBRARY_PATH’ environment variable. See any operating system + documentation about shared libraries for more information, such as the + ld(1) and ld.so(8) manual pages. + + 5. Documentation in various formats (PDF, HTML, info, plain text) can be found + in directory ‘doc’. + + 6. You can run some tests by + + make check + + However, some of these tests requires the usage of the PRNG or RngStreams + library and are only executed if these are installed enabled by the + corresponding configure flag. + + An extended set of tests is run by + + make fullcheck + + However some of these might fail occasionally due to roundoff errors or the + mysteries of floating point arithmetic, since we have used some extreme + settings to test the library. + +Upgrading +......... + + − _Important:_ + + UNU.RAN now relies on some aspects of IEEE 754 compliant floating point + arithmetic. In particular, ‘1./0.’ and ‘0./0.’ must result in ‘infinity’ + and ‘NaN’ (not a number), respectively, and must not cause a floating point + exception. For allmost all modern compting architecture this is + implemented in hardware. For others there should be a special compiler + flag to get this feature (e.g., ‘-MIEEE’ on DEC alpha or ‘-mp’ for the + Intel C complier). + + − Upgrading UNU.RAN from version 0.9.x or earlier: + + With UNU.RAN version 1.0.x some of the macro definitions in file + ‘src/unuran_config.h’ are moved into file ‘config.h’ and are set/controlled + by the ‘./configure’ script. + + Writting logging information into the logfile must now be enabled when + running the configure script: + + sh ./configure --enable-logging + + − Upgrading UNU.RAN from version 0.7.x or earlier: + + With UNU.RAN version 0.8.0 the interface for changing underlying + distributions and running a reinitialization routine has been simplified. + The old routines can be compiled into the library using the following + configure flag: + + sh ./configure --enable-deprecated + + Notice: Using these deprecated routines is not supported any more and this + strong discouraged. + + Wrapper functions for external sources of uniform random numbers are now + enabled by configure flags and not by macros defined in file + ‘src/unuran_config.h’. + + The file ‘src/unuran_config.h’ is not installed any more. It is now only + included when the library is compiled. It should be removed from the + global include path of the compiler. + +1.3 Using the library +===================== + +ANSI C Compliance +................. + +The library is written in ANSI C and is intended to conform to the ANSI C +standard. It should be portable to any system with a working ANSI C compiler. + + The library does not rely on any non-ANSI extensions in the interface it +exports to the user. Programs you write using UNU.RAN can be ANSI compliant. +Extensions which can be used in a way compatible with pure ANSI C are supported, +however, via conditional compilation. This allows the library to take advantage +of compiler extensions on those platforms which support them. + + To avoid namespace conflicts all exported function names and variables have +the prefix ‘unur_’, while exported macros have the prefix ‘UNUR_’. + +Compiling and Linking +..................... + +If you want to use the library you must include the UNU.RAN header file + + #include + +If you also need the test routines then also add + + #include + +If wrapper functions for external sources of uniform random number generators +are used, the corresponding header files must also be included, e.g., + + #include + +If these header files are not installed on the standard search path of your +compiler you will also need to provide its location to the preprocessor as a +command line flag. The default location of the ‘unuran.h’ is +‘/usr/local/include’. A typical compilation command for a source file ‘app.c’ +with the GNU C compiler ‘gcc’ is, + + gcc -I/usr/local/include -c app.c + +This results in an object file ‘app.o’. The default include path for ‘gcc’ +searches ‘/usr/local/include’ automatically so the ‘-I’ option can be omitted +when UNU.RAN is installed in its default location. + + The library is installed as a single file, ‘libunuran.a’. A shared version +of the library is also installed on systems that support shared libraries. The +default location of these files is ‘/usr/local/lib’. To link against the +library you need to specify the main library. The following example shows how +to link an application with the library (and the the RNGSTREAMS library if you +decide to use this source of uniform pseudo-random numbers), + + gcc app.o -lunuran -lrngstreams -lm + +Shared Libraries +................ + +To run a program linked with the shared version of the library it may be +necessary to define the shell variable ‘LD_LIBRARY_PATH’ to include the +directory where the library is installed. For example, + + LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + +To compile a statically linked version of the program instead, use the ‘-static’ +flag in ‘gcc’, + + gcc -static app.o -lunuran -lrngstreams -lm + +Compatibility with C++ +...................... + +The library header files automatically define functions to have ‘extern "C"’ +linkage when included in C++ programs. + +1.4 Concepts of UNU.RAN +======================= + +UNU.RAN is a C library for generating non-uniformly distributed random variates. +Its emphasis is on the generation of non-standard distribution and on streams of +random variates of special purposes. It is designed to provide a consistent +tool to sample from distributions with various properties. Since there is no +universal method that fits for all situations, various methods for sampling are +implemented. + + UNU.RAN solves this complex task by means of an object oriented programming +interface. Three basic objects are used: + + • distribution object ‘UNUR_DISTR’ + Hold all information about the random variates that should be generated. + + • generator object ‘UNUR_GEN’ + Hold the generators for the given distributions. Two generator objects are + completely independent of each other. They may share a common uniform + random number generator or have their owns. + + • parameter object ‘UNUR_PAR’ + Hold all information for creating a generator object. It is necessary due + to various parameters and switches for each of these generation methods. + + Notice that the parameter objects only hold pointers to arrays but do not + have their own copy of such an array. Especially, if a dynamically + allocated array is used it _must not_ be freed until the generator object + has been created! + + The idea behind these structures is that creatin distributions, choosing a +generation method and draing samples are orthogonal (ie. independent) functions +of the library. The parameter object is only introduced due to the necessity to +deal with various parameters and switches for each of these generation methods +which are required to adjust the algorithms to unusual distributions with +extreme properties but have default values that are suitable for most +applications. These parameters and the data for distributions are set by +various functions. + + Once a generator object has been created sampling (from the univariate +continuous distribution) can be done by the following command: + + double x = unur_sample_cont(generator); + +Analogous commands exist for discrete and multivariate distributions. For +detailed examples that can be copied and modified see *note Examples::. + +Distribution objects +-------------------- + +All information about a distribution are stored in objects (structures) of type +‘UNUR_DISTR’. UNU.RAN has five different types of distribution objects: + +‘cont’ + Continuous univariate distributions. +‘cvec’ + Continuous multivariate distributions. +‘discr’ + Discrete univariate distributions. +‘cemp’ + Continuous empirical univariate distribution, ie. given by a sample. +‘cvemp’ + Continuous empirical multivariate distribution, ie. given by a sample. +‘matr’ + Matrix distributions. + +Distribution objects can be created from scratch by the following call + + distr = unur_distr__new(); + +where ‘’ is one of the five possible types from the above table. Notice +that these commands only create an _empty_ object which still must be filled by +means of calls for each type of distribution object (*note Handling distribution +objects: Distribution_objects.). The naming scheme of these functions is +designed to indicate the corresponding type of the distribution object and the +task to be performed. It is demonstated on the following example. + + unur_distr_cont_set_pdf(distr, mypdf); + +This command stores a PDF named ‘mypdf’ in the distribution object ‘distr’ which +must have the type ‘cont’. + + Of course UNU.RAN provides an easier way to use standard distributions. +Instead of using ‘unur_distr__new’ calls and fuctions +‘unur_distr__set_<...>’ for setting data, objects for standard +distribution can be created by a single call. Eg. to get an object for the +normal distribution with mean 2 and standard deviation 5 use + + double parameter[2] = {2.0 ,5.0}; + UNUR_DISTR *distr = unur_distr_normal(parameter, 2); + +For a list of standard distributions see *note Standard distributions: Stddist. + +Generation methods +------------------ + +The information that a distribution object must contain depends heavily on the +chosen generation method choosen. + + Brackets indicate optional information while a tilde indicates that only an +approximation must be provided. See *note Glossary::, for unfamiliar terms. + +Methods for continuous univariate distributions +sample with ‘unur_sample_cont’ + +method PDF dPDF CDF mode area other +AROU x x [x] T-concave +ARS x x T-concave +CEXT wrapper for external generator +CSTD build-in standard distribution +HINV [x] [x] x +HRB bounded hazard rate +HRD decreasing hazard rate +HRI increasing hazard rate +ITDR x x x monotone with pole +NINV [x] x +NROU x [x] +PINV x [x] [~] +SROU x x x T-concave +SSR x x x T-concave +TABL x x [~] all local extrema +TDR x x T-concave +UTDR x x ~ T-concave + +Methods for continuous empirical univariate distributions +sample with ‘unur_sample_cont’ + +EMPK: Requires an observed sample. +EMPL: Requires an observed sample. + +Methods for continuous multivariate distributions +sample with ‘unur_sample_vec’ + +NORTA: Requires rank correlation matrix and marginal distributions. +VNROU: Requires the PDF. +MVSTD: Generator for built-in standard distributions. +MVTDR: Requires PDF and gradiant of PDF. + +Methods for continuous empirical multivariate distributions +sample with ‘unur_sample_vec’ + +VEMPK: Requires an observed sample. + +Methods for discrete univariate distributions +sample with ‘unur_sample_discr’ + +method PMF PV mode sum other +DARI x x ~ T-concave +DAU [x] x +DEXT wrapper for external generator +DGT [x] x +DSROU x x x T-concave +DSS [x] x x +DSTD build-in standard distribution + +Methods for matrix distributions +sample with ‘unur_sample_matr’ + +MCORR: Distribution object for random correlation matrix. + +Markov Chain Methods for continuous multivariate distributions +sample with ‘unur_sample_vec’ + +GIBBS: T-concave logPDF and derivatives of logPDF. +HITRO: Requires PDF. + + Because of tremendous variety of possible problems, UNU.RAN provides many +methods. All information for creating a generator object has to be collected in +a parameter object first. For example, if the task is to sample from a +continuous distribution the method AROU might be a good choice. Then the call + + UNUR_PAR *par = unur_arou_new(distribution); + +creates an parameter object ‘par’ with a pointer to the distribution object and +default values for all necessary parameters for method AROU. Other methods can +be used by replacing ‘arou’ with the name of the desired methods (in lower case +letters): + + UNUR_PAR *par = unur__new(distribution); + +This sets the default values for all necessary parameters for the chosen method. +These are suitable for almost all applications. Nevertheless, it is possible to +control the behavior of the method using corresponding ‘set’ calls for each +method. This might be necessary to adjust the algorithm for an unusual +distribution with extreme properties, or just for fine tuning the perforence of +the algorithm. The following example demonstrates how to change the maximum +number of iterations for method NINV to the value 50: + + unur_ninv_set_max_iteration(par, 50); + +All available methods are described in details in *note Methods::. + +Creating a generator object +--------------------------- + +Now it is possible to create a generator object: + + UNUR_GEN *generator = unur_init(par); + if (generator == NULL) exit(EXIT_FAILURE); + +*Important:* You must always check whether ‘unur_init’ has been executed +successfully. Otherwise the ‘NULL’ pointer is returned which causes a +segmentation fault when used for sampling. + +*Important:* The call of ‘unur_init’ *destroys* the parameter object! +Moreover, it is recommended to call ‘unur_init’ immediately after the parameter +object ‘par’ has created and modified. + + An existing generator object is a rather static construct. Nevertheless, +some of the parameters can still be modified by ‘chg’ calls, e.g. + + unur_ninv_chg_max_iteration(gen, 30); + +Notice that it is important _when_ parameters are changed because different +functions must be used: + + The function name includes the term ‘set’ and the first argument must be of +type ‘UNUR_PAR’ when the parameters are changed _before_ the generator object is +created. + + The function name includes the term ‘chg’ and the first argument must be of +type ‘UNUR_GEN’ when the parameters are changed for an _existing_ generator +object. + + For details see *note Methods::. + +Sampling +-------- + +You can now use your generator object in any place of your program to sample +from your distribution. You only have to take care about the type of variates +it computes: ‘double’, ‘int’ or a vector (array of ‘double’s). Notice that at +this point it does not matter whether you are sampling from a gamma +distribution, a truncated normal distribution or even an empirical distribution. + +Reinitializing +-------------- + +It is possible for a generator object to change the parameters and the domain of +the underlying distribution. This must be done by extracting this object by +means of a ‘unur_get_distr’ call and changing the distribution using the +correspondig set calls, see *note Handling distribution objects: +Distribution_objects. The generator object *must* then be reinitialized by +means of the ‘unur_reinit’ call. + + _Important_: Currently not all methods allow reinitialization, see the +description of the particular method (keyword Reinit). + +Destroy +------- + +When you do not need your generator object any more, you should destroy it: + + unur_free(generator); + +Uniform random numbers +---------------------- + +Each generator object can have its own uniform random number generator or share +one with others. When created a parameter object the pointer for the uniform +random number generator is set to the default generator. However, it can be +changed at any time to any other generator: + + unur_set_urng(par, urng); + +or + + unur_chg_urng(generator, urng); + +respectively. See *note Using uniform random number generators: URNG, for +details. + +1.5 Contact the authors +======================= + +If you have any problems with UNU.RAN, suggestions how to improve the library, +or find a bug, please contact us via email . + + For news please visit out homepage at . + +2 Examples +********** + +The examples in this chapter should compile cleanly and can be found in the +directory ‘examples’ of the source tree of UNU.RAN. Assuming that UNU.RAN as +well as the PRNG libraries have been installed properly (*note Installation::) +each of these can be compiled (using the GCC in this example) with + + gcc -Wall -O2 -o example example.c -lunuran -lprng -lm + +_Remark:_ ‘-lprng’ must be omitted when the PRNG library is not installed. Then +however some of the examples might not work. + + The library uses three objects: ‘UNUR_DISTR’, ‘UNUR_PAR’ and ‘UNUR_GEN’. It +is not important to understand the details of these objects but it is important +not to changed the order of their creation. The distribution object can be +destroyed _after_ the generator object has been made. (The parameter object is +freed automatically by the ‘unur_init’ call.) It is also important to check the +result of the ‘unur_init’ call. If it has failed the ‘NULL’ pointer is returned +and causes a segmentation fault when used for sampling. + + We give all examples with the UNU.RAN standard API and the more convenient +string API. + +2.1 As short as possible +======================== + +Select a distribution and let UNU.RAN do all necessary steps. + + /* ------------------------------------------------------------- */ + /* File: example0.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use a predefined standard distribution: */ + /* Gaussian with mean zero and standard deviation 1. */ + /* Since this is the standard form of the distribution, */ + /* we need not give these parameters. */ + distr = unur_distr_normal(NULL, 0); + + /* Use method AUTO: */ + /* Let UNURAN select a suitable method for you. */ + par = unur_auto_new(distr); + + /* Now you can change some of the default settings for the */ + /* parameters of the chosen method. We don't do it here. */ + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + +2.2 As short as possible (String API) +===================================== + +Select a distribution and let UNU.RAN do all necessary steps. + + /* ------------------------------------------------------------- */ + /* File: example0_str.c */ + /* ------------------------------------------------------------- */ + /* String API. */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a predefined standard distribution: */ + /* Standard Gaussian distribution. */ + /* Use method AUTO: */ + /* Let UNURAN select a suitable method for you. */ + gen = unur_str2gen("normal()"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + +2.3 Select a method +=================== + +Select method AROU and use it with default parameters. + + /* ------------------------------------------------------------- */ + /* File: example1.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use a predefined standard distribution: */ + /* Gaussian with mean zero and standard deviation 1. */ + /* Since this is the standard form of the distribution, */ + /* we need not give these parameters. */ + distr = unur_distr_normal(NULL, 0); + + /* Choose a method: AROU. */ + /* For other (suitable) methods replace "arou" with the */ + /* respective name (in lower case letters). */ + par = unur_arou_new(distr); + + /* Now you can change some of the default settings for the */ + /* parameters of the chosen method. We don't do it here. */ + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + +2.4 Select a method (String API) +================================ + +Select method AROU and use it with default parameters. + + /* ------------------------------------------------------------- */ + /* File: example1_str.c */ + /* ------------------------------------------------------------- */ + /* String API. */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a predefined standard distribution: */ + /* Standard Gaussian distribution. */ + /* Choose a method: AROU. */ + /* For other (suitable) methods replace "arou" with the */ + /* respective name. */ + gen = unur_str2gen("normal() & method=arou"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + +2.5 Arbitrary distributions +=========================== + +If you want to sample from a non-standard distribution, UNU.RAN might be exactly +what you need. Depending on the information is available, a method must be +choosen for sampling, see *note Concepts:: for an overview and *note Methods:: +for details. + + /* ------------------------------------------------------------- */ + /* File: example2.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* In this example we build a distribution object from scratch */ + /* and sample from this distribution. */ + /* */ + /* We use method TDR (Transformed Density Rejection) which */ + /* required a PDF and the derivative of the PDF. */ + + /* ------------------------------------------------------------- */ + + /* Define the PDF and dPDF of our distribution. */ + /* */ + /* Our distribution has the PDF */ + /* */ + /* / 1 - x*x if |x| <= 1 */ + /* f(x) = < */ + /* \ 0 otherwise */ + /* */ + + /* The PDF of our distribution: */ + double mypdf( double x, const UNUR_DISTR *distr ) + /* The second argument (`distr') can be used for parameters */ + /* for the PDF. (We do not use parameters in our example.) */ + { + if (fabs(x) >= 1.) + return 0.; + else + return (1.-x*x); + } /* end of mypdf() */ + + /* The derivative of the PDF of our distribution: */ + double mydpdf( double x, const UNUR_DISTR *distr ) + { + if (fabs(x) >= 1.) + return 0.; + else + return (-2.*x); + } /* end of mydpdf() */ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create a new distribution object from scratch. */ + /* It is a continuous distribution, and we need a PDF and the */ + /* derivative of the PDF. Moreover we set the domain. */ + + /* Get empty distribution object for a continuous distribution */ + distr = unur_distr_cont_new(); + + /* Assign the PDF and dPDF (defined above). */ + unur_distr_cont_set_pdf( distr, mypdf ); + unur_distr_cont_set_dpdf( distr, mydpdf ); + + /* Set the domain of the distribution (optional for TDR). */ + unur_distr_cont_set_domain( distr, -1., 1. ); + + /* Choose a method: TDR. */ + par = unur_tdr_new(distr); + + /* Now you can change some of the default settings for the */ + /* parameters of the chosen method. We don't do it here. */ + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + + +2.6 Arbitrary distributions (String API) +======================================== + +If you want to sample from a non-standard distribution, UNU.RAN might be exactly +what you need. Depending on the information is available, a method must be +choosen for sampling, see *note Concepts:: for an overview and *note Methods:: +for details. + + /* ------------------------------------------------------------- */ + /* File: example2_str.c */ + /* ------------------------------------------------------------- */ + /* String API. */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* In this example we use a generic distribution object */ + /* and sample from this distribution. */ + /* */ + /* The PDF of our distribution is given by */ + /* */ + /* / 1 - x*x if |x| <= 1 */ + /* f(x) = < */ + /* \ 0 otherwise */ + /* */ + /* We use method TDR (Transformed Density Rejection) which */ + /* required a PDF and the derivative of the PDF. */ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a generic continuous distribution. */ + /* Choose a method: TDR. */ + gen = unur_str2gen( + "distr = cont; pdf=\"1-x*x\"; domain=(-1,1) & method=tdr"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + + +2.7 Change parameters of the method +=================================== + +Each method for generating random numbers allows several parameters to be +modified. If you do not want to use default values, it is possible to change +them. The following example illustrates how to change parameters. For details +see *note Methods::. + + /* ------------------------------------------------------------- */ + /* File: example3.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + double fparams[2]; /* array for parameters for distribution */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use a predefined standard distribution: */ + /* Gaussian with mean 2. and standard deviation 0.5. */ + fparams[0] = 2.; + fparams[1] = 0.5; + distr = unur_distr_normal( fparams, 2 ); + + /* Choose a method: TDR. */ + par = unur_tdr_new(distr); + + /* Change some of the default parameters. */ + + /* We want to use T(x)=log(x) for the transformation. */ + unur_tdr_set_c( par, 0. ); + + /* We want to have the variant with immediate acceptance. */ + unur_tdr_set_variant_ia( par ); + + /* We want to use 10 construction points for the setup */ + unur_tdr_set_cpoints ( par, 10, NULL ); + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* It is possible with method TDR to truncate the distribution */ + /* for an existing generator object ... */ + unur_tdr_chg_truncated( gen, -1., 0. ); + + /* ... and sample again. */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + +2.8 Change parameters of the method (String API) +================================================ + +Each method for generating random numbers allows several parameters to be +modified. If you do not want to use default values, it is possible to change +them. The following example illustrates how to change parameters. For details +see *note Methods::. + + /* ------------------------------------------------------------- */ + /* File: example3_str.c */ + /* ------------------------------------------------------------- */ + /* String API. */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a predefined standard distribution: */ + /* Gaussian with mean 2. and standard deviation 0.5. */ + /* Choose a method: TDR with parameters */ + /* c = 0: use T(x)=log(x) for the transformation; */ + /* variant "immediate acceptance"; */ + /* number of construction points = 10. */ + gen = unur_str2gen( + "normal(2,0.5) & method=tdr; c=0.; variant_ia; cpoints=10"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* It is possible with method TDR to truncate the distribution */ + /* for an existing generator object ... */ + unur_tdr_chg_truncated( gen, -1., 0. ); + + /* ... and sample again. */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + +2.9 Change uniform random generator +=================================== + +All generator object use the same default uniform random number generator by +default. This can be changed to any generator of your choice such that each +generator object has its own random number generator or can share it with some +other objects. It is also possible to change the default generator at any time. +See *note Using uniform random number generators: URNG, for details. + + The following example shows how the uniform random number generator can be +set or changed for a generator object. It requires the RNGSTREAMS library to be +installed and used. Otherwise the example must be modified accordingly. + + /* ------------------------------------------------------------- */ + /* File: example_rngstreams.c */ + /* ------------------------------------------------------------- */ + #ifdef UNURAN_SUPPORTS_RNGSTREAM + /* ------------------------------------------------------------- */ + /* This example makes use of the RNGSTREAM library for */ + /* for generating uniform random numbers. */ + /* (see http://statmath.wu.ac.at/software/RngStreams/) */ + /* To compile this example you must have set */ + /* ./configure --with-urng-rngstream */ + /* (Of course the executable has to be linked against the */ + /* RNGSTREAM library.) */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header files. */ + #include + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + double fparams[2]; /* array for parameters for distribution */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng1, *urng2; /* uniform generator objects */ + + /* The RNGSTREAMS library sets a package seed. */ + unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; + RngStream_SetPackageSeed(seed); + + /* RngStreams only: */ + /* Make a object for uniform random number generator. */ + /* For details see */ + /* http://statmath.wu.ac.at/software/RngStreams/ */ + urng1 = unur_urng_rngstream_new("urng-1"); + if (urng1 == NULL) exit (EXIT_FAILURE); + + /* Use a predefined standard distribution: */ + /* Beta with parameters 2 and 3. */ + fparams[0] = 2.; + fparams[1] = 3.; + distr = unur_distr_beta( fparams, 2 ); + + /* Choose a method: TDR. */ + par = unur_tdr_new(distr); + + /* Set uniform generator in parameter object */ + unur_set_urng( par, urng1 ); + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* Now we want to switch to a different (independent) stream */ + /* of uniform random numbers. */ + urng2 = unur_urng_rngstream_new("urng-2"); + if (urng2 == NULL) exit (EXIT_FAILURE); + unur_chg_urng( gen, urng2 ); + + /* ... and sample again. */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + /* We also should destroy the uniform random number generators.*/ + unur_urng_free(urng1); + unur_urng_free(urng2); + + exit (EXIT_SUCCESS); + } /* end of main() */ + + /* ------------------------------------------------------------- */ + #else + #include + #include + int main(void) { + printf("You must enable the RNGSTREAM library to run this example!\n\n"); + exit (77); /* exit code for automake check routines */ + } + #endif + /* ------------------------------------------------------------- */ + + +2.10 Change parameters of underlying distribution +================================================= + +One a generator object has been created it allows to draw samples from the +distribution with the given parameters. However, some methods allow to change +the parameters of the underlying distribution and reinitialize the generator +object again. Thus when the parameters of the distribution vary for each draw +we save overhead for destroying the old object and creating a new one. + + The following example shows how the parameters of a GIG distribution can be +changed when method CSTD is used. + + /* ------------------------------------------------------------- */ + /* File: example_reinit.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* In this example we show how the parameters of the underlying */ + /* distribution can be changed for an existing generator object. */ + + /* We use the GIG distribution with method CSTD. */ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Parameters of distribution. */ + double dparam[3] = {0.5, 1., 5.}; + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create initial GIG distribution object */ + distr = unur_distr_gig(dparam, 3); + + /* Choose a method: CSTD. */ + par = unur_cstd_new(distr); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* It is possible for method CSTD to change the parameters of */ + /* underlying distribution. However, we have to extract to */ + /* pointer to the distribution. Be carefull with this pointer! */ + distr = unur_get_distr(gen); + + /* Change the parameter(s). */ + dparam[2] = 0.001; + unur_distr_cont_set_pdfparams(distr,dparam,3); + + /* Do not forget to reinitialize the generator object. */ + /* Check the return code. */ + /* (and try to find a better error handling) */ + if (unur_reinit(gen) != UNUR_SUCCESS) { + fprintf(stderr, "ERROR: cannot reinitialize generator object\n"); + exit (EXIT_FAILURE); + } + + /* Draw a new sample. */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* Changing parameters can be repeated. */ + dparam[2] = 1000; + unur_distr_cont_set_pdfparams(distr,dparam,3); + if (unur_reinit(gen) != UNUR_SUCCESS) { + fprintf(stderr, "ERROR: cannot reinitialize generator object\n"); + exit (EXIT_FAILURE); + } + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + + +2.11 Sample pairs of antithetic random variates +=============================================== + +Using Method TDR it is easy to sample pairs of antithetic random variates. + + /* ------------------------------------------------------------- */ + /* File: example_anti.c */ + /* ------------------------------------------------------------- */ + #ifdef UNURAN_SUPPORTS_PRNG + /* ------------------------------------------------------------- */ + /* This example makes use of the PRNG library for generating */ + /* uniform random numbers. */ + /* (see http://statmath.wu.ac.at/prng/) */ + /* To compile this example you must have set */ + /* ./configure --with-urng-prng */ + /* (Of course the executable has to be linked against the */ + /* PRNG library.) */ + /* ------------------------------------------------------------- */ + + /* Example how to sample from two streams of antithetic random */ + /* variates from Gaussian N(2,5) and Gamma(4) distribution, resp.*/ + + /* ------------------------------------------------------------- */ + + /* Include UNURAN header files. */ + #include + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double xn, xg; /* will hold the random number */ + double fparams[2]; /* array for parameters for distribution */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen_normal, *gen_gamma; + /* generator objects */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng1, *urng2; /* uniform generator objects */ + + /* PRNG only: */ + /* Make a object for uniform random number generator. */ + /* For details see http://statmath.wu.ac.at/prng/. */ + + + /* The first generator: Gaussian N(2,5) */ + + /* uniform generator: We use the Mersenne Twister. */ + urng1 = unur_urng_prng_new("mt19937(1237)"); + if (urng1 == NULL) exit (EXIT_FAILURE); + + /* UNURAN generator object for N(2,5) */ + fparams[0] = 2.; + fparams[1] = 5.; + distr = unur_distr_normal( fparams, 2 ); + + /* Choose method TDR with variant PS. */ + par = unur_tdr_new( distr ); + unur_tdr_set_variant_ps( par ); + + /* Set uniform generator in parameter object. */ + unur_set_urng( par, urng1 ); + + /* Set auxilliary uniform random number generator. */ + /* We use the default generator. */ + unur_use_urng_aux_default( par ); + + /* Alternatively you can create and use your own auxilliary */ + /* uniform random number generator: */ + /* UNUR_URNG *urng_aux; */ + /* urng_aux = unur_urng_prng_new("tt800"); */ + /* if (urng_aux == NULL) exit (EXIT_FAILURE); */ + /* unur_set_urng_aux( par, urng_aux ); */ + + /* Create the generator object. */ + gen_normal = unur_init(par); + if (gen_normal == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Destroy distribution object (gen_normal has its own copy). */ + unur_distr_free(distr); + + + /* The second generator: Gamma(4) with antithetic variates. */ + + /* uniform generator: We use the Mersenne Twister. */ + urng2 = unur_urng_prng_new("anti(mt19937(1237))"); + if (urng2 == NULL) exit (EXIT_FAILURE); + + /* UNURAN generator object for gamma(4) */ + fparams[0] = 4.; + distr = unur_distr_gamma( fparams, 1 ); + + /* Choose method TDR with variant PS. */ + par = unur_tdr_new( distr ); + unur_tdr_set_variant_ps( par ); + + /* Set uniform generator in parameter object. */ + unur_set_urng( par, urng2 ); + + /* Set auxilliary uniform random number generator. */ + /* We use the default generator. */ + unur_use_urng_aux_default( par ); + + /* Alternatively you can create and use your own auxilliary */ + /* uniform random number generator (see above). */ + /* Notice that both generator objects gen_normal and */ + /* gen_gamma can share the same auxilliary URNG. */ + + /* Create the generator object. */ + gen_gamma = unur_init(par); + if (gen_gamma == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Destroy distribution object (gen_normal has its own copy). */ + unur_distr_free(distr); + + + /* Now we can sample pairs of negatively correlated random */ + /* variates. E.g.: */ + for (i=0; i<10; i++) { + xn = unur_sample_cont(gen_normal); + xg = unur_sample_cont(gen_gamma); + printf("%g, %g\n",xn,xg); + } + + + /* When you do not need the generator objects any more, you */ + /* can destroy it. */ + unur_free(gen_normal); + unur_free(gen_gamma); + + /* We also should destroy the uniform random number generators.*/ + unur_urng_free(urng1); + unur_urng_free(urng2); + + exit (EXIT_SUCCESS); + } /* end of main() */ + + /* ------------------------------------------------------------- */ + #else + #include + #include + int main(void) { + printf("You must enable the PRNG library to run this example!\n\n"); + exit (77); /* exit code for automake check routines */ + } + #endif + /* ------------------------------------------------------------- */ + +2.12 Sample pairs of antithetic random variates (String API) +============================================================ + +Using Method TDR it is easy to sample pairs of antithetic random variates. + + /* ------------------------------------------------------------- */ + /* File: example_anti_str.c */ + /* ------------------------------------------------------------- */ + /* String API. */ + /* ------------------------------------------------------------- */ + #ifdef UNURAN_SUPPORTS_PRNG + /* ------------------------------------------------------------- */ + /* This example makes use of the PRNG library for generating */ + /* uniform random numbers. */ + /* (see http://statmath.wu.ac.at/prng/) */ + /* To compile this example you must have set */ + /* ./configure --with-urng-prng */ + /* (Of course the executable has to be linked against the */ + /* PRNG library.) */ + /* ------------------------------------------------------------- */ + + /* Example how to sample from two streams of antithetic random */ + /* variates from Gaussian N(2,5) and Gamma(4) distribution, resp.*/ + + /* ------------------------------------------------------------- */ + + /* Include UNURAN header files. */ + #include + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double xn, xg; /* will hold the random number */ + + /* Declare UNURAN generator objects. */ + UNUR_GEN *gen_normal, *gen_gamma; + + /* PRNG only: */ + /* Make a object for uniform random number generator. */ + /* For details see http://statmath.wu.ac.at/prng/. */ + + /* Create the first generator: Gaussian N(2,5) */ + gen_normal = unur_str2gen("normal(2,5) & method=tdr; variant_ps & urng=mt19937(1237)"); + if (gen_normal == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + /* Set auxilliary uniform random number generator. */ + /* We use the default generator. */ + unur_chgto_urng_aux_default(gen_normal); + + /* The second generator: Gamma(4) with antithetic variates. */ + gen_gamma = unur_str2gen("gamma(4) & method=tdr; variant_ps & urng=anti(mt19937(1237))"); + if (gen_gamma == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + unur_chgto_urng_aux_default(gen_gamma); + + + /* Now we can sample pairs of negatively correlated random */ + /* variates. E.g.: */ + for (i=0; i<10; i++) { + xn = unur_sample_cont(gen_normal); + xg = unur_sample_cont(gen_gamma); + printf("%g, %g\n",xn,xg); + } + + + /* When you do not need the generator objects any more, you */ + /* can destroy it. */ + + /* But first we have to destroy the uniform random number */ + /* generators. */ + unur_urng_free(unur_get_urng(gen_normal)); + unur_urng_free(unur_get_urng(gen_gamma)); + + unur_free(gen_normal); + unur_free(gen_gamma); + + + exit (EXIT_SUCCESS); + } /* end of main() */ + + /* ------------------------------------------------------------- */ + #else + #include + #include + int main(void) { + printf("You must enable the PRNG library to run this example!\n\n"); + exit (77); /* exit code for automake check routines */ + } + #endif + /* ------------------------------------------------------------- */ + +2.13 More examples +================== + +*Note Methods for continuous univariate distributions: Methods_for_CONT. + + *Note Methods for continuous empirical univariate distributions: +Methods_for_CEMP. + + *Note Methods for continuous empirical multivariate distributions: +Methods_for_CVEMP. + + *Note Methods for discrete univariate distributions: Methods_for_DISCR. + +3 String Interface +****************** + +The string interface (string API) provided by the ‘unur_str2gen’ call is the +easiest way to use UNU.RAN. This function takes a character string as its +argument. The string is parsed and the information obtained is used to create a +generator object. It returns ‘NULL’ if this fails, either due to a syntax +error, or due to invalid data. In both cases ‘unur_error’ is set to the +corresponding error codes (*note Error reporting: Error_reporting.). +Additionally there exists the call ‘unur_str2distr’ that only produces a +distribution object. + + Notice that the string interface does not implement all features of the +UNU.RAN library. For trickier tasks it might be necessary to use the UNU.RAN +calls. + + In *note Examples::, all examples are given using both the UNU.RAN standard +API and this convenient string API. The corresponding programm codes are +equivalent. + +Function reference +------------------ + + -- Function: UNUR_GEN* unur_str2gen (const CHAR* STRING) + Get a generator object for the distribution, method and uniform random + number generator as described in the given STRING. See *note Syntax of + String Interface: StringSyntax, for details. + + -- Function: UNUR_DISTR* unur_str2distr (const CHAR* STRING) + Get a distribution object for the distribution described in STRING. See + *note Syntax of String Interface: StringSyntax, and *note Distribution + String: StringDistr, for details. However, only the block for the + distribution object is allowed. + + -- Function: UNUR_GEN* unur_makegen_ssu (const CHAR* DISTRSTR, const CHAR* + METHODSTR, UNUR_URNG* URNG) + -- Function: UNUR_GEN* unur_makegen_dsu (const UNUR_DISTR* DISTRIBUTION, const + CHAR* METHODSTR, UNUR_URNG* URNG) + Make a generator object for the distribution, method and uniform random + number generator. The distribution can be given either as string DISTRSTR + or as a distribution object DISTR. The method must be given as a string + METHODSTR. For the syntax of these strings see *note Syntax of String + Interface: StringSyntax. However, the ‘method’ keyword is optional for + these calls and can be omitted. If METHODSTR is the empty (blank) string + or ‘NULL’ method AUTO is used. The uniform random number generator is + optional. If URNG is ‘NULL’ then the default uniform random number + generator is used. + +3.1 Syntax of String Interface +============================== + +The given string holds information about the requested distribution and +(optional) about the sampling method and the uniform random number generator +invoked. The interpretation of the string is not case-sensitive, all white +spaces are ignored. + + The string consists of up to three blocks, separated by ampersands ‘&’. + + Each block consists of ‘=’ pairs, separated by semicolons ‘;’. + + The first key in each block is used to indicate each block. We have three +different blocks with the following (first) keys: +‘distr’ + definition of the distribution (*note Distribution String: StringDistr.). + +‘method’ + description of the transformation method (*note Method String: + StringMethod.). + +‘urng’ + uniform random number generation (*note Uniform RNG String: StringURNG.). + + The ‘distr’ block must be the very first block and is obligatory. All the +other blocks are optional and can be arranged in arbitrary order. + + For details see the following description of each block. + + In the following example + + distr = normal(3.,0.75); domain = (0,inf) & method = tdr; c = 0 + +we have a distribution block for the truncated normal distribution with mean 3 +and standard deviation 0.75 on domain (0,infinity); and block for choosing +method TDR with parameter c set to 0. + + The ‘=’ pairs that follow the first (initial) pair in each block +are used to set parameters. The name of the parameter is given by the ‘’ +string. It is deduced from the UNU.RAN set calls by taking the part after +‘..._set_’. The ‘’ string holds the parameters to be set, separated by +commata ‘,’. There are three types of parameters: +_string ‘"..."’ or ‘'...'’_ + i.e. any sequence of characters enclosed by double quotes ‘"..."’ or + single quotes ‘'...'’ (there is no distinction between double quotes ‘"’ + and single quotes ‘'’). +_list ‘(...,...)’_ + i.e. list of _numbers_, separated by commata ‘,’, enclosed in parenthesis + ‘(...)’. +_number_ + a sequence of characters that is not enclosed by double quotes ‘"..."’, + single quotes ‘'...'’, or parenthesis ‘(...)’. It is interpreted as float + or integer depending on the type of the corresponding parameter. + The ‘’ string (including the character ‘=’) can be omitted when no +argument is required. + + At the moment not all ‘set’ calls are supported. The syntax for the +‘’ can be directly derived from the corresponding ‘set’ calls. To +simplify the syntax additional shortcuts are possible. The following table +lists the parameters for the ‘set’ calls that are supported by the string +interface; the entry in parenthesis gives the type of the argument as ‘’ +string: + +‘int (number):’ + The number is interpreted as an integer. ‘true’ and ‘on’ are transformed + to ‘1’, ‘false’ and ‘off’ are transformed to ‘0’. A missing argument is + interpreted as ‘1’. + +‘int, int (number, number or list):’ + The two numbers or the first two entries in the list are interpreted as a + integers. ‘inf’ and ‘-inf’ are transformed to ‘INT_MAX’ and ‘INT_MIN’ + respectively, i.e. the largest and smallest integers that can be + represented by the computer. + +‘unsigned (number):’ + The number is interpreted as an unsigned hexadecimal integer. + +‘double (number):’ + The number is interpreted as a floating point number. ‘inf’ is transformed + to ‘UNUR_INFINITY’. + +‘double, double (number, number or list):’ + The two numbers or the first two entries in the list are interpreted as a + floating point numbers. ‘inf’ is transformed to ‘UNUR_INFINITY’. However + using ‘inf’ in the list might not work for all versions of C. Then it is + recommended to use two single numbers instead of a list. + +‘int, double* ([number,] list or number):’ + − The list is interpreted as a double array. The (first) number as its + length. If it is less than the actual size of the array only the + first entries of the array are used. + − If only the list is given (i.e., if the first number is omitted), the + first number is set to the actual size of the array. + − If only the number is given (i.e., if the list is omitted), the ‘NULL’ + pointer is used instead an array as argument. + +‘double*, int (list [,number]):’ + The list is interpreted as a double array. The (second) number as its + length. If the length is omitted, it is replaced by the actual size of the + array. (Only in the ‘distribution’ block!) + +‘char* (string):’ + The character string is passed as is to the corresponding set call. + + Notice that missing entries in a list of numbers are interpreted as ‘0’. +E.g, a the list ‘(1,,3)’ is read as ‘(1,0,3)’, the list ‘(1,2,)’ as ‘(1,2,0)’. + + The the list of ‘key’ strings in *note Keys for Distribution String: +KeysDistr, and *note Keys for Method String: KeysMethod, for further details. + +3.2 Distribution String +======================= + +The ‘distr’ block must be the very first block and is obligatory. For that +reason the keyword ‘distr’ is optional and can be omitted (together with the ‘=’ +character). Moreover it is ignored while parsing the string. However, to avoid +some possible confusion it has to start with the letter ‘d’ (if it is given at +all). + + The value of the ‘distr’ key is used to get the distribution object, either +via a ‘unur_distr_’ call for a standard distribution via a +‘unur_distr__new’ call to get an object of a generic distribution. +However not all generic distributions are supported yet. + + The parameters for the standard distribution are given as a list. There must +not be any character (other than white space) between the name of the standard +distribution and the opening parenthesis ‘(’ of this list. E.g., to get a beta +distribution, use + + distr = beta(2,4) + + To get an object for a discrete distribution with probability vector +(0.5,0.2,0.3), use + + distr = discr; pv = (0.5,0.2,0.3) + + It is also possible to set a PDF, PMF, or CDF using a string. E.g., to +create a continuous distribution with PDF proportional to ‘exp(-sqrt(2+(x-1)^2) ++ (x-1))’ and domain (0,inf) use + + distr = cont; pdf = "exp(-sqrt(2+(x-1)^2) + (x-1))" + +Notice: If this string is used in an ‘unur_str2distr’ or ‘unur_str2gen’ call the +double quotes ‘"’ must be protected by ‘\"’. Alternatively, single quotes may +be used instead + + distr = cont; pdf = 'exp(-sqrt(2+(x-1)^2) + (x-1))' + + For the details of function strings see *note Function String: StringFunct. + +3.2.1 Keys for Distribution String +---------------------------------- + +List of standard distributions *note Standard distributions: Stddist. + + − ‘[distr =] beta(...)’ ⇒ *note beta:: + − ‘[distr =] binomial(...)’ ⇒ *note binomial:: + − ‘[distr =] cauchy(...)’ ⇒ *note cauchy:: + − ‘[distr =] chi(...)’ ⇒ *note chi:: + − ‘[distr =] chisquare(...)’ ⇒ *note chisquare:: + − ‘[distr =] exponential(...)’ ⇒ *note exponential:: + − ‘[distr =] extremeI(...)’ ⇒ *note extremeI:: + − ‘[distr =] extremeII(...)’ ⇒ *note extremeII:: + − ‘[distr =] F(...)’ ⇒ *note F:: + − ‘[distr =] gamma(...)’ ⇒ *note gamma:: + − ‘[distr =] geometric(...)’ ⇒ *note geometric:: + − ‘[distr =] gig(...)’ ⇒ *note gig:: + − ‘[distr =] gig2(...)’ ⇒ *note gig2:: + − ‘[distr =] hyperbolic(...)’ ⇒ *note hyperbolic:: + − ‘[distr =] hypergeometric(...)’ ⇒ *note hypergeometric:: + − ‘[distr =] ig(...)’ ⇒ *note ig:: + − ‘[distr =] laplace(...)’ ⇒ *note laplace:: + − ‘[distr =] logarithmic(...)’ ⇒ *note logarithmic:: + − ‘[distr =] logistic(...)’ ⇒ *note logistic:: + − ‘[distr =] lognormal(...)’ ⇒ *note lognormal:: + − ‘[distr =] lomax(...)’ ⇒ *note lomax:: + − ‘[distr =] negativebinomial(...)’ ⇒ *note negativebinomial:: + − ‘[distr =] normal(...)’ ⇒ *note normal:: + − ‘[distr =] pareto(...)’ ⇒ *note pareto:: + − ‘[distr =] poisson(...)’ ⇒ *note poisson:: + − ‘[distr =] powerexponential(...)’ ⇒ *note powerexponential:: + − ‘[distr =] rayleigh(...)’ ⇒ *note rayleigh:: + − ‘[distr =] slash(...)’ ⇒ *note slash:: + − ‘[distr =] student(...)’ ⇒ *note student:: + − ‘[distr =] triangular(...)’ ⇒ *note triangular:: + − ‘[distr =] uniform(...)’ ⇒ *note uniform:: + − ‘[distr =] weibull(...)’ ⇒ *note weibull:: + + List of generic distributions *note Handling Distribution Objects: +Distribution_objects. + + − ‘[distr =] cemp’ ⇒ *note CEMP:: + − ‘[distr =] cont’ ⇒ *note CONT:: + − ‘[distr =] discr’ ⇒ *note DISCR:: + + _Notice_: Order statistics for continuous distributions (*note CORDER::) are +supported by using the key ‘orderstatistics’ for distributions of type ‘CONT’. + + List of keys that are available via the String API. For description see the +corresponding UNU.RAN set calls. + + • All distribution types + ‘name = ""’ + ⇒ *note ‘unur_distr_set_name’: funct:unur_distr_set_name. + + • ‘cemp’ (Distribution Type) (*note CEMP::) + ‘data = () [, ]’ + ⇒ *note ‘unur_distr_cemp_set_data’: funct:unur_distr_cemp_set_data. + ‘hist_bins = () [, ]’ + ⇒ *note ‘unur_distr_cemp_set_hist_bins’: + funct:unur_distr_cemp_set_hist_bins. + ‘hist_domain = , | ()’ + ⇒ *note ‘unur_distr_cemp_set_hist_domain’: + funct:unur_distr_cemp_set_hist_domain. + ‘hist_prob = () [, ]’ + ⇒ *note ‘unur_distr_cemp_set_hist_prob’: + funct:unur_distr_cemp_set_hist_prob. + + • ‘cont’ (Distribution Type) (*note CONT::) + ‘cdf = ""’ + ⇒ *note ‘unur_distr_cont_set_cdfstr’: + funct:unur_distr_cont_set_cdfstr. + ‘center = ’ + ⇒ *note ‘unur_distr_cont_set_center’: + funct:unur_distr_cont_set_center. + ‘domain = , | ()’ + ⇒ *note ‘unur_distr_cont_set_domain’: + funct:unur_distr_cont_set_domain. + ‘hr = ""’ + ⇒ *note ‘unur_distr_cont_set_hrstr’: funct:unur_distr_cont_set_hrstr. + ‘logcdf = ""’ + ⇒ *note ‘unur_distr_cont_set_logcdfstr’: + funct:unur_distr_cont_set_logcdfstr. + ‘logpdf = ""’ + ⇒ *note ‘unur_distr_cont_set_logpdfstr’: + funct:unur_distr_cont_set_logpdfstr. + ‘mode = ’ + ⇒ *note ‘unur_distr_cont_set_mode’: funct:unur_distr_cont_set_mode. + ‘pdf = ""’ + ⇒ *note ‘unur_distr_cont_set_pdfstr’: + funct:unur_distr_cont_set_pdfstr. + ‘pdfarea = ’ + ⇒ *note ‘unur_distr_cont_set_pdfarea’: + funct:unur_distr_cont_set_pdfarea. + ‘pdfparams = () [, ]’ + ⇒ *note ‘unur_distr_cont_set_pdfparams’: + funct:unur_distr_cont_set_pdfparams. + ‘orderstatistics = , | ()’ + Make order statistics for given distribution. The first parameter + gives the sample size, the second parameter its rank. (see *note + ‘unur_distr_corder_new’: funct:unur_distr_corder_new.) + + • ‘discr’ (Distribution Type) (*note DISCR::) + ‘cdf = ""’ + ⇒ *note ‘unur_distr_discr_set_cdfstr’: + funct:unur_distr_discr_set_cdfstr. + ‘domain = , | ()’ + ⇒ *note ‘unur_distr_discr_set_domain’: + funct:unur_distr_discr_set_domain. + ‘mode [= ]’ + ⇒ *note ‘unur_distr_discr_set_mode’: funct:unur_distr_discr_set_mode. + ‘pmf = ""’ + ⇒ *note ‘unur_distr_discr_set_pmfstr’: + funct:unur_distr_discr_set_pmfstr. + ‘pmfparams = () [, ]’ + ⇒ *note ‘unur_distr_discr_set_pmfparams’: + funct:unur_distr_discr_set_pmfparams. + ‘pmfsum = ’ + ⇒ *note ‘unur_distr_discr_set_pmfsum’: + funct:unur_distr_discr_set_pmfsum. + ‘pv = () [, ]’ + ⇒ *note ‘unur_distr_discr_set_pv’: funct:unur_distr_discr_set_pv. + +3.3 Function String +=================== + +In unuran it is also possible to define functions (e.g. CDF or PDF) as strings. +As you can see in Example 2 (*note Example_2_str::) it is very easy to define +the PDF of a distribution object by means of a string. The possibilities using +this string interface are more restricted than using a pointer to a routine +coded in C (*note Example_2::). But the differences in evaluation time is +small. When a distribution object is defined using this string interface then +of course the same conditions on the given density or CDF must be satisfied for +a chosen method as for the standard API. This string interface can be used for +both within the UNU.RAN string API using the ‘unur_str2gen’ call, and for calls +that define the density or CDF for a particular distribution object as done with +(e.g.) the call ‘unur_distr_cont_set_pdfstr’. Here is an example for the +latter case: + + unur_distr_cont_set_pdfstr(distr,"1-x*x"); + +Syntax +------ + +The syntax for the function string is case insensitive, white spaces are +ingnored. The expressions are similar to most programming languages and +mathematical programs (see also the examples below). It is especially +influenced by C. The usual preceedence rules are used (from highest to lowest +preceedence: functions, power, multiplication, addition, relation operators). +Use parentheses in case of doubt or when these preceedences should be changed. + + Relation operators can be used as indicator functions, i.e. the term ‘(x>1)’ +is evaluted as ‘1’ if this relation is satisfied, and as ‘0’ otherwise. + + The first unknown symbol (letter or word) is interpreted as the variable of +the function. It is recommended to use ‘x’. Only one variable can be used. + +_Important_: The symbol ‘e’ is used twice, for Euler’s constant (= 2.7182...) +and as exponent. The multiplication operator ‘*’ must not be omitted, i.e. ‘2 +x’ is interpreted as the string ‘2x’ (which will result in a syntax error). + +List of symbols +--------------- + +Numbers + +Numbers are composed using digits and, optionally, a sign, a decimal point, and +an exponent indicated by ‘e’. + +Symbol Explanation Examples +‘0...9’ digits ‘2343’ +‘.’ decimal point ‘165.567’ +‘-’ negative sign ‘-465.223’ +‘e’ exponet ‘13.2e-4’ (=0.00132) + +Constants + +‘pi’ pi = 3.1415... ‘3*pi+2’ +‘e’ Euler’s constant ‘3*e+2’ (= 10.15...; do not + cofuse with ‘3e2’ = 300) +‘inf’ infinity (used for domains) + +Special symbols + +‘(’ opening parenthesis ‘2*(3+x)’ +‘)’ closing parenthesis ‘2*(3+x)’ +‘,’ (argument) list separator ‘mod(13,2)’ + +Relation operators (Indicator functions) + +‘<’ less than ‘(x<1)’ +‘=’ equal ‘(2=x)’ +‘==’ same as ‘=’ ‘(x==3)’ +‘>’ greater than ‘(x>0)’ +‘<=’ less than or equal ‘(x<=1)’ +‘!=’ not equal ‘(x!0)’ +‘<>’ same as ‘!=’ ‘(x<>pi)’ +‘>=’ greater or equal ‘(x>=1)’ + +Arithmetic operators + +‘+’ addition ‘2+x’ +‘-’ subtraction ‘2-x’ +‘*’ multiplication ‘2*x’ +‘/’ division ‘x/2’ +‘^’ power ‘x^2’ + +Functions + +‘mod’ ‘mod(m,n)’ remainder of mod(x,2) + devision m over n +‘exp’ exponential function ‘exp(-x^2)’ (same as + (same as ‘e^x’) ‘e^(-x^2)’) +‘log’ natural logarithm ‘log(x)’ +‘sin’ sine ‘sin(x)’ +‘cos’ cosine ‘cos(x)’ +‘tan’ tangent ‘tan(x)’ +‘sec’ secant ‘sec(x*2)’ +‘sqrt’ square root ‘sqrt(2*x)’ +‘abs’ absolute value ‘abs(x)’ +‘sgn’ sign function ‘sign(x)*3’ + +Variable + +‘x’ variable ‘3*x^2’ + +Examples +-------- + + 1.231+7.9876*x-1.234e-3*x^2+3.335e-5*x^3 + sin(2*pi*x)+x^2 + exp(-((x-3)/2.1)^2) + +It is also possible to define functions using different terms on separate +domains. However, instead of constructs using ‘if ... then ... else ...’ +indicator functions are available. + +For example to define the density of triangular distribution with domain (-1,1) +and mode 0 use + + (x>-1)*(x<0)*(1+x) + (x>=0)*(x<1)*(1-x) + +3.4 Method String +================= + +The key ‘method’ is obligatory, it must be the first key and its value is the +name of a method suitable for the choosen standard distribution. E.g., if +method AROU is chosen, use + + method = arou + + Of course the all following keys dependend on the method choosen at first. +All corresponding ‘set’ calls of UNU.RAN are available and the key is the string +after the ‘unur__set_’ part of the command. E.g., UNU.RAN provides +the command ‘unur_arou_set_max_sqhratio’ to set a parameter of method AROU. To +call this function via the string-interface, the key ‘max_sqhratio’ can be used: + + max_sqhratio = 0.9 + +Additionally the keyword ‘debug’ can be used to set debugging flags (see *note +Debugging: Debug, for details). + + If this block is omitted, a suitable default method is used. Notice however +that the default method may change in future versions of UNU.RAN. + +3.4.1 Keys for Method String +---------------------------- + +List of methods and keys that are available via the String API. For description +see the corresponding UNU.RAN set calls. + + • ‘method = arou’ ⇒ ‘unur_arou_new’ (*note AROU::) + ‘cpoints = [, ()] | ()’ + ⇒ *note ‘unur_arou_set_cpoints’: funct:unur_arou_set_cpoints. + ‘darsfactor = ’ + ⇒ *note ‘unur_arou_set_darsfactor’: funct:unur_arou_set_darsfactor. + ‘guidefactor = ’ + ⇒ *note ‘unur_arou_set_guidefactor’: funct:unur_arou_set_guidefactor. + ‘max_segments [= ]’ + ⇒ *note ‘unur_arou_set_max_segments’: + funct:unur_arou_set_max_segments. + ‘max_sqhratio = ’ + ⇒ *note ‘unur_arou_set_max_sqhratio’: + funct:unur_arou_set_max_sqhratio. + ‘pedantic [= ]’ + ⇒ *note ‘unur_arou_set_pedantic’: funct:unur_arou_set_pedantic. + ‘usecenter [= ]’ + ⇒ *note ‘unur_arou_set_usecenter’: funct:unur_arou_set_usecenter. + ‘usedars [= ]’ + ⇒ *note ‘unur_arou_set_usedars’: funct:unur_arou_set_usedars. + ‘verify [= ]’ + ⇒ *note ‘unur_arou_set_verify’: funct:unur_arou_set_verify. + + • ‘method = ars’ ⇒ ‘unur_ars_new’ (*note ARS::) + ‘cpoints = [, ()] | ()’ + ⇒ *note ‘unur_ars_set_cpoints’: funct:unur_ars_set_cpoints. + ‘max_intervals [= ]’ + ⇒ *note ‘unur_ars_set_max_intervals’: + funct:unur_ars_set_max_intervals. + ‘max_iter [= ]’ + ⇒ *note ‘unur_ars_set_max_iter’: funct:unur_ars_set_max_iter. + ‘pedantic [= ]’ + ⇒ *note ‘unur_ars_set_pedantic’: funct:unur_ars_set_pedantic. + ‘reinit_ncpoints [= ]’ + ⇒ *note ‘unur_ars_set_reinit_ncpoints’: + funct:unur_ars_set_reinit_ncpoints. + ‘reinit_percentiles = [, ()] | ()’ + ⇒ *note ‘unur_ars_set_reinit_percentiles’: + funct:unur_ars_set_reinit_percentiles. + ‘verify [= ]’ + ⇒ *note ‘unur_ars_set_verify’: funct:unur_ars_set_verify. + + • ‘method = auto’ ⇒ ‘unur_auto_new’ (*note AUTO::) + ‘logss [= ]’ + ⇒ *note ‘unur_auto_set_logss’: funct:unur_auto_set_logss. + + • ‘method = cstd’ ⇒ ‘unur_cstd_new’ (*note CSTD::) + ‘variant = ’ + ⇒ *note ‘unur_cstd_set_variant’: funct:unur_cstd_set_variant. + + • ‘method = dari’ ⇒ ‘unur_dari_new’ (*note DARI::) + ‘cpfactor = ’ + ⇒ *note ‘unur_dari_set_cpfactor’: funct:unur_dari_set_cpfactor. + ‘squeeze [= ]’ + ⇒ *note ‘unur_dari_set_squeeze’: funct:unur_dari_set_squeeze. + ‘tablesize [= ]’ + ⇒ *note ‘unur_dari_set_tablesize’: funct:unur_dari_set_tablesize. + ‘verify [= ]’ + ⇒ *note ‘unur_dari_set_verify’: funct:unur_dari_set_verify. + + • ‘method = dau’ ⇒ ‘unur_dau_new’ (*note DAU::) + ‘urnfactor = ’ + ⇒ *note ‘unur_dau_set_urnfactor’: funct:unur_dau_set_urnfactor. + + • ‘method = dgt’ ⇒ ‘unur_dgt_new’ (*note DGT::) + ‘guidefactor = ’ + ⇒ *note ‘unur_dgt_set_guidefactor’: funct:unur_dgt_set_guidefactor. + ‘variant = ’ + ⇒ *note ‘unur_dgt_set_variant’: funct:unur_dgt_set_variant. + + • ‘method = dsrou’ ⇒ ‘unur_dsrou_new’ (*note DSROU::) + ‘cdfatmode = ’ + ⇒ *note ‘unur_dsrou_set_cdfatmode’: funct:unur_dsrou_set_cdfatmode. + ‘verify [= ]’ + ⇒ *note ‘unur_dsrou_set_verify’: funct:unur_dsrou_set_verify. + + • ‘method = dstd’ ⇒ ‘unur_dstd_new’ (*note DSTD::) + ‘variant = ’ + ⇒ *note ‘unur_dstd_set_variant’: funct:unur_dstd_set_variant. + + • ‘method = empk’ ⇒ ‘unur_empk_new’ (*note EMPK::) + ‘beta = ’ + ⇒ *note ‘unur_empk_set_beta’: funct:unur_empk_set_beta. + ‘kernel = ’ + ⇒ *note ‘unur_empk_set_kernel’: funct:unur_empk_set_kernel. + ‘positive [= ]’ + ⇒ *note ‘unur_empk_set_positive’: funct:unur_empk_set_positive. + ‘smoothing = ’ + ⇒ *note ‘unur_empk_set_smoothing’: funct:unur_empk_set_smoothing. + ‘varcor [= ]’ + ⇒ *note ‘unur_empk_set_varcor’: funct:unur_empk_set_varcor. + + • ‘method = gibbs’ ⇒ ‘unur_gibbs_new’ (*note GIBBS::) + ‘burnin [= ]’ + ⇒ *note ‘unur_gibbs_set_burnin’: funct:unur_gibbs_set_burnin. + ‘c = ’ + ⇒ *note ‘unur_gibbs_set_c’: funct:unur_gibbs_set_c. + ‘thinning [= ]’ + ⇒ *note ‘unur_gibbs_set_thinning’: funct:unur_gibbs_set_thinning. + ‘variant_coordinate’ + ⇒ *note ‘unur_gibbs_set_variant_coordinate’: + funct:unur_gibbs_set_variant_coordinate. + ‘variant_random_direction’ + ⇒ *note ‘unur_gibbs_set_variant_random_direction’: + funct:unur_gibbs_set_variant_random_direction. + + • ‘method = hinv’ ⇒ ‘unur_hinv_new’ (*note HINV::) + ‘boundary = , | ()’ + ⇒ *note ‘unur_hinv_set_boundary’: funct:unur_hinv_set_boundary. + ‘cpoints = (), ’ + ⇒ *note ‘unur_hinv_set_cpoints’: funct:unur_hinv_set_cpoints. + ‘guidefactor = ’ + ⇒ *note ‘unur_hinv_set_guidefactor’: funct:unur_hinv_set_guidefactor. + ‘max_intervals [= ]’ + ⇒ *note ‘unur_hinv_set_max_intervals’: + funct:unur_hinv_set_max_intervals. + ‘order [= ]’ + ⇒ *note ‘unur_hinv_set_order’: funct:unur_hinv_set_order. + ‘u_resolution = ’ + ⇒ *note ‘unur_hinv_set_u_resolution’: + funct:unur_hinv_set_u_resolution. + + • ‘method = hitro’ ⇒ ‘unur_hitro_new’ (*note HITRO::) + ‘adaptive_multiplier = ’ + ⇒ *note ‘unur_hitro_set_adaptive_multiplier’: + funct:unur_hitro_set_adaptive_multiplier. + ‘burnin [= ]’ + ⇒ *note ‘unur_hitro_set_burnin’: funct:unur_hitro_set_burnin. + ‘r = ’ + ⇒ *note ‘unur_hitro_set_r’: funct:unur_hitro_set_r. + ‘thinning [= ]’ + ⇒ *note ‘unur_hitro_set_thinning’: funct:unur_hitro_set_thinning. + ‘use_adaptiveline [= ]’ + ⇒ *note ‘unur_hitro_set_use_adaptiveline’: + funct:unur_hitro_set_use_adaptiveline. + ‘use_adaptiverectangle [= ]’ + ⇒ *note ‘unur_hitro_set_use_adaptiverectangle’: + funct:unur_hitro_set_use_adaptiverectangle. + ‘use_boundingrectangle [= ]’ + ⇒ *note ‘unur_hitro_set_use_boundingrectangle’: + funct:unur_hitro_set_use_boundingrectangle. + ‘v = ’ + ⇒ *note ‘unur_hitro_set_v’: funct:unur_hitro_set_v. + ‘variant_coordinate’ + ⇒ *note ‘unur_hitro_set_variant_coordinate’: + funct:unur_hitro_set_variant_coordinate. + ‘variant_random_direction’ + ⇒ *note ‘unur_hitro_set_variant_random_direction’: + funct:unur_hitro_set_variant_random_direction. + + • ‘method = hrb’ ⇒ ‘unur_hrb_new’ (*note HRB::) + ‘upperbound = ’ + ⇒ *note ‘unur_hrb_set_upperbound’: funct:unur_hrb_set_upperbound. + ‘verify [= ]’ + ⇒ *note ‘unur_hrb_set_verify’: funct:unur_hrb_set_verify. + + • ‘method = hrd’ ⇒ ‘unur_hrd_new’ (*note HRD::) + ‘verify [= ]’ + ⇒ *note ‘unur_hrd_set_verify’: funct:unur_hrd_set_verify. + + • ‘method = hri’ ⇒ ‘unur_hri_new’ (*note HRI::) + ‘p0 = ’ + ⇒ *note ‘unur_hri_set_p0’: funct:unur_hri_set_p0. + ‘verify [= ]’ + ⇒ *note ‘unur_hri_set_verify’: funct:unur_hri_set_verify. + + • ‘method = itdr’ ⇒ ‘unur_itdr_new’ (*note ITDR::) + ‘cp = ’ + ⇒ *note ‘unur_itdr_set_cp’: funct:unur_itdr_set_cp. + ‘ct = ’ + ⇒ *note ‘unur_itdr_set_ct’: funct:unur_itdr_set_ct. + ‘verify [= ]’ + ⇒ *note ‘unur_itdr_set_verify’: funct:unur_itdr_set_verify. + ‘xi = ’ + ⇒ *note ‘unur_itdr_set_xi’: funct:unur_itdr_set_xi. + + • ‘method = mvtdr’ ⇒ ‘unur_mvtdr_new’ (*note MVTDR::) + ‘boundsplitting = ’ + ⇒ *note ‘unur_mvtdr_set_boundsplitting’: + funct:unur_mvtdr_set_boundsplitting. + ‘maxcones [= ]’ + ⇒ *note ‘unur_mvtdr_set_maxcones’: funct:unur_mvtdr_set_maxcones. + ‘stepsmin [= ]’ + ⇒ *note ‘unur_mvtdr_set_stepsmin’: funct:unur_mvtdr_set_stepsmin. + ‘verify [= ]’ + ⇒ *note ‘unur_mvtdr_set_verify’: funct:unur_mvtdr_set_verify. + + • ‘method = ninv’ ⇒ ‘unur_ninv_new’ (*note NINV::) + ‘max_iter [= ]’ + ⇒ *note ‘unur_ninv_set_max_iter’: funct:unur_ninv_set_max_iter. + ‘start = , | ()’ + ⇒ *note ‘unur_ninv_set_start’: funct:unur_ninv_set_start. + ‘table [= ]’ + ⇒ *note ‘unur_ninv_set_table’: funct:unur_ninv_set_table. + ‘u_resolution = ’ + ⇒ *note ‘unur_ninv_set_u_resolution’: + funct:unur_ninv_set_u_resolution. + ‘usebisect’ + ⇒ *note ‘unur_ninv_set_usebisect’: funct:unur_ninv_set_usebisect. + ‘usenewton’ + ⇒ *note ‘unur_ninv_set_usenewton’: funct:unur_ninv_set_usenewton. + ‘useregula’ + ⇒ *note ‘unur_ninv_set_useregula’: funct:unur_ninv_set_useregula. + ‘x_resolution = ’ + ⇒ *note ‘unur_ninv_set_x_resolution’: + funct:unur_ninv_set_x_resolution. + + • ‘method = nrou’ ⇒ ‘unur_nrou_new’ (*note NROU::) + ‘center = ’ + ⇒ *note ‘unur_nrou_set_center’: funct:unur_nrou_set_center. + ‘r = ’ + ⇒ *note ‘unur_nrou_set_r’: funct:unur_nrou_set_r. + ‘u = , | ()’ + ⇒ *note ‘unur_nrou_set_u’: funct:unur_nrou_set_u. + ‘v = ’ + ⇒ *note ‘unur_nrou_set_v’: funct:unur_nrou_set_v. + ‘verify [= ]’ + ⇒ *note ‘unur_nrou_set_verify’: funct:unur_nrou_set_verify. + + • ‘method = pinv’ ⇒ ‘unur_pinv_new’ (*note PINV::) + ‘boundary = , | ()’ + ⇒ *note ‘unur_pinv_set_boundary’: funct:unur_pinv_set_boundary. + ‘extra_testpoints [= ]’ + ⇒ *note ‘unur_pinv_set_extra_testpoints’: + funct:unur_pinv_set_extra_testpoints. + ‘keepcdf [= ]’ + ⇒ *note ‘unur_pinv_set_keepcdf’: funct:unur_pinv_set_keepcdf. + ‘max_intervals [= ]’ + ⇒ *note ‘unur_pinv_set_max_intervals’: + funct:unur_pinv_set_max_intervals. + ‘order [= ]’ + ⇒ *note ‘unur_pinv_set_order’: funct:unur_pinv_set_order. + ‘searchboundary = , | ()’ + ⇒ *note ‘unur_pinv_set_searchboundary’: + funct:unur_pinv_set_searchboundary. + ‘smoothness [= ]’ + ⇒ *note ‘unur_pinv_set_smoothness’: funct:unur_pinv_set_smoothness. + ‘u_resolution = ’ + ⇒ *note ‘unur_pinv_set_u_resolution’: + funct:unur_pinv_set_u_resolution. + ‘use_upoints [= ]’ + ⇒ *note ‘unur_pinv_set_use_upoints’: funct:unur_pinv_set_use_upoints. + ‘usecdf’ + ⇒ *note ‘unur_pinv_set_usecdf’: funct:unur_pinv_set_usecdf. + ‘usepdf’ + ⇒ *note ‘unur_pinv_set_usepdf’: funct:unur_pinv_set_usepdf. + + • ‘method = srou’ ⇒ ‘unur_srou_new’ (*note SROU::) + ‘cdfatmode = ’ + ⇒ *note ‘unur_srou_set_cdfatmode’: funct:unur_srou_set_cdfatmode. + ‘pdfatmode = ’ + ⇒ *note ‘unur_srou_set_pdfatmode’: funct:unur_srou_set_pdfatmode. + ‘r = ’ + ⇒ *note ‘unur_srou_set_r’: funct:unur_srou_set_r. + ‘usemirror [= ]’ + ⇒ *note ‘unur_srou_set_usemirror’: funct:unur_srou_set_usemirror. + ‘usesqueeze [= ]’ + ⇒ *note ‘unur_srou_set_usesqueeze’: funct:unur_srou_set_usesqueeze. + ‘verify [= ]’ + ⇒ *note ‘unur_srou_set_verify’: funct:unur_srou_set_verify. + + • ‘method = ssr’ ⇒ ‘unur_ssr_new’ (*note SSR::) + ‘cdfatmode = ’ + ⇒ *note ‘unur_ssr_set_cdfatmode’: funct:unur_ssr_set_cdfatmode. + ‘pdfatmode = ’ + ⇒ *note ‘unur_ssr_set_pdfatmode’: funct:unur_ssr_set_pdfatmode. + ‘usesqueeze [= ]’ + ⇒ *note ‘unur_ssr_set_usesqueeze’: funct:unur_ssr_set_usesqueeze. + ‘verify [= ]’ + ⇒ *note ‘unur_ssr_set_verify’: funct:unur_ssr_set_verify. + + • ‘method = tabl’ ⇒ ‘unur_tabl_new’ (*note TABL::) + ‘areafraction = ’ + ⇒ *note ‘unur_tabl_set_areafraction’: + funct:unur_tabl_set_areafraction. + ‘boundary = , | ()’ + ⇒ *note ‘unur_tabl_set_boundary’: funct:unur_tabl_set_boundary. + ‘cpoints = [, ()] | ()’ + ⇒ *note ‘unur_tabl_set_cpoints’: funct:unur_tabl_set_cpoints. + ‘darsfactor = ’ + ⇒ *note ‘unur_tabl_set_darsfactor’: funct:unur_tabl_set_darsfactor. + ‘guidefactor = ’ + ⇒ *note ‘unur_tabl_set_guidefactor’: funct:unur_tabl_set_guidefactor. + ‘max_intervals [= ]’ + ⇒ *note ‘unur_tabl_set_max_intervals’: + funct:unur_tabl_set_max_intervals. + ‘max_sqhratio = ’ + ⇒ *note ‘unur_tabl_set_max_sqhratio’: + funct:unur_tabl_set_max_sqhratio. + ‘nstp [= ]’ + ⇒ *note ‘unur_tabl_set_nstp’: funct:unur_tabl_set_nstp. + ‘pedantic [= ]’ + ⇒ *note ‘unur_tabl_set_pedantic’: funct:unur_tabl_set_pedantic. + ‘slopes = (), ’ + ⇒ *note ‘unur_tabl_set_slopes’: funct:unur_tabl_set_slopes. + ‘usedars [= ]’ + ⇒ *note ‘unur_tabl_set_usedars’: funct:unur_tabl_set_usedars. + ‘useear [= ]’ + ⇒ *note ‘unur_tabl_set_useear’: funct:unur_tabl_set_useear. + ‘variant_ia [= ]’ + ⇒ *note ‘unur_tabl_set_variant_ia’: funct:unur_tabl_set_variant_ia. + ‘variant_splitmode = ’ + ⇒ *note ‘unur_tabl_set_variant_splitmode’: + funct:unur_tabl_set_variant_splitmode. + ‘verify [= ]’ + ⇒ *note ‘unur_tabl_set_verify’: funct:unur_tabl_set_verify. + + • ‘method = tdr’ ⇒ ‘unur_tdr_new’ (*note TDR::) + ‘c = ’ + ⇒ *note ‘unur_tdr_set_c’: funct:unur_tdr_set_c. + ‘cpoints = [, ()] | ()’ + ⇒ *note ‘unur_tdr_set_cpoints’: funct:unur_tdr_set_cpoints. + ‘darsfactor = ’ + ⇒ *note ‘unur_tdr_set_darsfactor’: funct:unur_tdr_set_darsfactor. + ‘guidefactor = ’ + ⇒ *note ‘unur_tdr_set_guidefactor’: funct:unur_tdr_set_guidefactor. + ‘max_intervals [= ]’ + ⇒ *note ‘unur_tdr_set_max_intervals’: + funct:unur_tdr_set_max_intervals. + ‘max_sqhratio = ’ + ⇒ *note ‘unur_tdr_set_max_sqhratio’: funct:unur_tdr_set_max_sqhratio. + ‘pedantic [= ]’ + ⇒ *note ‘unur_tdr_set_pedantic’: funct:unur_tdr_set_pedantic. + ‘reinit_ncpoints [= ]’ + ⇒ *note ‘unur_tdr_set_reinit_ncpoints’: + funct:unur_tdr_set_reinit_ncpoints. + ‘reinit_percentiles = [, ()] | ()’ + ⇒ *note ‘unur_tdr_set_reinit_percentiles’: + funct:unur_tdr_set_reinit_percentiles. + ‘usecenter [= ]’ + ⇒ *note ‘unur_tdr_set_usecenter’: funct:unur_tdr_set_usecenter. + ‘usedars [= ]’ + ⇒ *note ‘unur_tdr_set_usedars’: funct:unur_tdr_set_usedars. + ‘usemode [= ]’ + ⇒ *note ‘unur_tdr_set_usemode’: funct:unur_tdr_set_usemode. + ‘variant_gw’ + ⇒ *note ‘unur_tdr_set_variant_gw’: funct:unur_tdr_set_variant_gw. + ‘variant_ia’ + ⇒ *note ‘unur_tdr_set_variant_ia’: funct:unur_tdr_set_variant_ia. + ‘variant_ps’ + ⇒ *note ‘unur_tdr_set_variant_ps’: funct:unur_tdr_set_variant_ps. + ‘verify [= ]’ + ⇒ *note ‘unur_tdr_set_verify’: funct:unur_tdr_set_verify. + + • ‘method = utdr’ ⇒ ‘unur_utdr_new’ (*note UTDR::) + ‘cpfactor = ’ + ⇒ *note ‘unur_utdr_set_cpfactor’: funct:unur_utdr_set_cpfactor. + ‘deltafactor = ’ + ⇒ *note ‘unur_utdr_set_deltafactor’: funct:unur_utdr_set_deltafactor. + ‘pdfatmode = ’ + ⇒ *note ‘unur_utdr_set_pdfatmode’: funct:unur_utdr_set_pdfatmode. + ‘verify [= ]’ + ⇒ *note ‘unur_utdr_set_verify’: funct:unur_utdr_set_verify. + + • ‘method = vempk’ ⇒ ‘unur_vempk_new’ (*note VEMPK::) + ‘smoothing = ’ + ⇒ *note ‘unur_vempk_set_smoothing’: funct:unur_vempk_set_smoothing. + ‘varcor [= ]’ + ⇒ *note ‘unur_vempk_set_varcor’: funct:unur_vempk_set_varcor. + + • ‘method = vnrou’ ⇒ ‘unur_vnrou_new’ (*note VNROU::) + ‘r = ’ + ⇒ *note ‘unur_vnrou_set_r’: funct:unur_vnrou_set_r. + ‘v = ’ + ⇒ *note ‘unur_vnrou_set_v’: funct:unur_vnrou_set_v. + ‘verify [= ]’ + ⇒ *note ‘unur_vnrou_set_verify’: funct:unur_vnrou_set_verify. + +3.5 Uniform RNG String +====================== + +The value of the ‘urng’ key is passed to the PRNG interface (see *Note Overview: +(prng)Top. for details). However it only works when using the PRNG library is +enabled, see *note Installation:: for details. There are no other keys. + + IMPORTANT: UNU.RAN creates a new uniform random number generator for the +generator object. The pointer to this uniform generator has to be read and +saved via a ‘unur_get_urng’ call in order to clear the memory _before_ the +UNU.RAN generator object is destroyed. + + If this block is omitted the UNU.RAN default generator is used (which _must +not_ be destroyed). + +4 Handling distribution objects +******************************* + +Objects of type ‘UNUR_DISTR’ are used for handling distributions. All data +about a distribution are stored in this object. UNU.RAN provides functions that +return instances of such objects for standard distributions (*note Standard +distributions: Stddist.). It is then possible to change these distribution +objects by various set calls. Moreover, it is possible to build a distribution +object entirely from scratch. For this purpose there exists +‘unur_distr__new’ calls that return an empty object of this type for each +object type (eg. univariate contiuous) which can be filled with the appropriate +set calls. + + UNU.RAN distinguishes between several types of distributions, each of which +has its own sets of possible parameters (for details see the corresponding +sections): + − continuous univariate distributions + − continuous univariate order statistics + − continuous empirical univariate distributions + − continuous multivariate distributions + − continuous empirical multivariate distributions + − matrix distributions + − discrete univariate distributions + + Notice that there are essential data about a distribution, eg. the PDF, a +list of (shape, scale, location) parameters for the distribution, and the domain +of (the possibly truncated) distribution. And there exist parameters that +are/can be derived from these, eg. the mode of the distribution or the area +below the given PDF (which need not be normalized for many methods). UNU.RAN +keeps track of parameters which are known. Thus if one of the essential +parameters is changed all derived parameters are marked as unknown and must be +set again if these are required for the chosen generation method. Additionally +to set calls there are calls for updating derived parameters for objects +provided by the UNU.RAN library of standard distributions (one for each +parameter to avoid computational overhead since not all parameters are required +for all generator methods). + + All parameters of distribution objects can be read by corresponding get +calls. + + Every generator object has its own copy of a distribution object which is +accessible by a ‘unur_get_distr’ call. Thus the parameter for this distribution +can be read. However, *never* extract the distribution object out of a +generator object and run one of the set calls on it to modify the distribution. +(How should the poor generator object know what has happend?) Instead there +exist calls for each of the generator methods that change particular parameters +of the internal copy of the distribution object. + +How To Use +.......... + +UNU.RAN collects all data required for a particular generation method in a +_distribution object_. There are two ways to get an instance of a distributions +object: + 1. Build a distribtion from scratch, by means of the corresponding + ‘unur_distr__new’ call, where ‘’ is the type of the + distribution as listed in the below subsections. + + 2. Use the corresponding ‘unur_distr__new’ call to get prebuild + distribution from the UNU.RAN library of standard distributions. Here + ‘’ is the name of the standard distribution in *note Standard + distributions: Stddist. + + In either cases the corresponding ‘unur_distr__set_’ calls to +set the necessary parameters ‘’ (case 1), or change the values of the +standard distribution in case 2 (if this makes sense for you). In the latter +case ‘’ is the type to which the standard distribution belongs to. These +‘set’ calls return ‘UNUR_SUCCESS’ when the correspondig parameter has been set +successfully. Otherwise an error code is returned. + + The parameters of a distribution are divided into _essential_ and _derived_ +parameters. + + Notice, that there are some restrictions in setting parameters to avoid +possible confusions. Changing essential parameters marks derived parameters as +‘unknown’. Some of the parameters cannot be changed any more when already set; +some parameters block each others. In such a case a new instance of a +distribution object has to be build. + + Additionally ‘unur_distr__upd_’ calls can be used for updating +derived parameters for objects provided by the UNU.RAN library of standard +distributions. + + All parameters of a distribution object get be read by means of +‘unur_distr__get_’ calls. + + Every distribution object be identified by its ‘name’ which is a string of +arbitrary characters provided by the user. For standard distribution it is +automatically set to ‘’ in the corresponding ‘new’ call. It can be +changed to any other string. + +4.1 Functions for all kinds of distribution objects +=================================================== + +The calls in this section can be applied to all distribution objects. + + − Destroy ‘free’ an instance of a generator object. + + − Ask for the ‘type’ of a generator object. + + − Ask for the ‘dimension’ of a generator object. + + − Deal with the ‘name’ (identifier string) of a generator object. + +Function reference +------------------ + + -- Function: void unur_distr_free (UNUR_DISTR* DISTRIBUTION) + Destroy the DISTRIBUTION object. + + -- Function: int unur_distr_set_name (UNUR_DISTR* DISTRIBUTION, const CHAR* + NAME) + -- Function: const char* unur_distr_get_name (const UNUR_DISTR* DISTRIBUTION) + Set and get NAME of DISTRIBUTION. The NAME can be an arbitrary character + string. It can be used to identify generator objects for the user. It is + used by UNU.RAN when printing information of the distribution object into a + log files. + + -- Function: int unur_distr_get_dim (const UNUR_DISTR* DISTRIBUTION) + Get number of components of a random vector (its dimension) the + DISTRIBUTION. + + For univariate distributions it returns dimension ‘1’. + + For matrix distributions it returns the number of components (i.e., number + of rows times number of columns). When the respective numbers of rows and + columns are needed use ‘unur_distr_matr_get_dim’ instead. + + -- Function: unsigned int unur_distr_get_type (const UNUR_DISTR* DISTRIBUTION) + Get type of DISTRIBUTION. Possible types are + ‘UNUR_DISTR_CONT’ + univariate continuous distribution + ‘UNUR_DISTR_CEMP’ + empirical continuous univariate distribution (i.e. a sample) + ‘UNUR_DISTR_CVEC’ + continuous mulitvariate distribution + ‘UNUR_DISTR_CVEMP’ + empirical continuous multivariate distribution (i.e. a vector sample) + ‘UNUR_DISTR_DISCR’ + discrete univariate distribution + ‘UNUR_DISTR_MATR’ + matrix distribution + + Alternatively the ‘unur_distr_is_’ calls can be used. + + -- Function: int unur_distr_is_cont (const UNUR_DISTR* DISTRIBUTION) + ‘TRUE’ if DISTRIBUTION is a continuous univariate distribution. + + -- Function: int unur_distr_is_cvec (const UNUR_DISTR* DISTRIBUTION) + ‘TRUE’ if DISTRIBUTION is a continuous multivariate distribution. + + -- Function: int unur_distr_is_cemp (const UNUR_DISTR* DISTRIBUTION) + ‘TRUE’ if DISTRIBUTION is an empirical continuous univariate distribution, + i.e. a sample. + + -- Function: int unur_distr_is_cvemp (const UNUR_DISTR* DISTRIBUTION) + ‘TRUE’ if DISTRIBUTION is an empirical continuous multivariate + distribution. + + -- Function: int unur_distr_is_discr (const UNUR_DISTR* DISTRIBUTION) + ‘TRUE’ if DISTRIBUTION is a discrete univariate distribution. + + -- Function: int unur_distr_is_matr (const UNUR_DISTR* DISTRIBUTION) + ‘TRUE’ if DISTRIBUTION is a matrix distribution. + + -- Function: int unur_distr_set_extobj (UNUR_DISTR* DISTRIBUTION, const VOID* + EXTOBJ) + Store a pointer to an external object. This might be usefull if the PDF, + PMF, CDF or other functions used to implement a particular distribution a + parameter set that cannot be stored as doubles (e.g. pointers to some + structure that holds information of the distribution). + + *Important:* When UNU.RAN copies this distribution object into the + generator object, then the address EXTOBJ that this pointer contains is + simply copied. Thus the generator holds an address of a non-private + object! Once the generator object has been created any change in the + external object might effect the generator object. + + *Warning:* External objects must be used with care. Once the generator + object has been created or the distribution object has been copied you + _must not_ destroy this external object. + + -- Function: const void* unur_distr_get_extobj (const UNUR_DISTR* DISTRIBUTION) + Get the pointer to the external object. + + _Important:_ Changing this object must be done with with extreme care. + +4.2 Continuous univariate distributions +======================================= + +The calls in this section can be applied to continuous univariate distributions. + + − Create a ‘new’ instance of a continuous univariate distribution. + + − Handle and evaluate distribution function (CDF, ‘cdf’), probability density + function (PDF, ‘pdf’) and the derivative of the density function (‘dpdf’). + The following is important: + . ‘pdf’ need not be normalized, i.e., any integrable nonnegative + function can be used. + . ‘dpdf’ must the derivate of the function provided as ‘pdf’. + . ‘cdf’ must be a distribution function, i.e. it must be monotonically + increasing with range [0,1]. + . If ‘cdf’ and ‘pdf’ are used together for a pariticular generation + method, then ‘pdf’ must be the derivate of the ‘cdf’, i.e., it must be + normalized. + + − Handle and evaluate the logarithm of the probability density function + (logPDF, ‘logpdf’) and the derivative of the logarithm of the density + function (‘dlogpdf’). + + Some methods use the logarithm of the density if available. + + − Set (and change) parameters (‘pdfparams’) and the area below the graph + (‘pdfarea’) of the given density. + + − Set the ‘mode’ (or pole) of the distribution. + + − Set the ‘center’ of the distribution. It is used by some generation + methods to adjust the parameters of the generation algorithms to gain + better performance. It can be seens as the location of the “central part” + of the distribution. + + − Some generation methods require the hazard rate (‘hr’) of the distribution + instead of its ‘pdf’. + + − Alternatively, ‘cdf’, ‘pdf’, ‘dpdf’, and ‘hr’ can be provided as ‘str’ings + instead of function pointers. + + − Set the ‘domain’ of the distribution. Notice that the library also can + handle truncated distributions, i.e., distributions that are derived from + (standard) distributions by simply restricting its domain to a subset. + However, there is a subtle difference between changing the domain of a + distribution object by a ‘unur_distr_cont_set_domain’ call and changing the + (truncated) domain for an existing generator object. The domain of the + distribution object is used to create the generator object with hats, + squeezes, tables, etc. Whereas truncating the domain of an existing + generator object need not necessarily require a recomputation of these + data. Thus by a ‘unur__chg_truncated’ call (if available) the + sampling region is restricted to the subset of the domain of the given + distribution object. However, generation methods that require a recreation + of the generator object when the domain is changed have a + ‘unur__chg_domain’ call instead. For these calls there are of + course no restrictions on the given domain (i.e., it is possible to + increase the domain of the distribution) (*note Methods::, for details). + +Function reference +------------------ + + -- Function: UNUR_DISTR* unur_distr_cont_new (void) + Create a new (empty) object for univariate continuous distribution. + +Essential parameters +.................... + + -- Function: int unur_distr_cont_set_pdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CONT* PDF) + -- Function: int unur_distr_cont_set_dpdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CONT* DPDF) + -- Function: int unur_distr_cont_set_cdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CONT* CDF) + -- Function: int unur_distr_cont_set_invcdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CONT* INVCDF) + Set respective pointer to the probability density function (PDF), the + derivative of the probability density function (dPDF), the cumulative + distribution function (CDF), and the inverse CDF of the DISTRIBUTION. Each + of these function pointers must be of type ‘double funct(double x, const + UNUR_DISTR *distr)’. + + Due to the fact that some of the methods do not require a normalized PDF + the following is important: + + − The given CDF must be the cumulative distribution function of the + (non-truncated) distribution. If a distribution from the UNU.RAN + library of standard distributions (*note Standard distributions: + Stddist.) is truncated, there is no need to change the CDF. + + − If both the CDF and the PDF are used (for a method or for order + statistics), the PDF must be the derivative of the CDF. If a truncated + distribution for one of the standard distributions from the UNU.RAN + library of standard distributions is used, there is no need to change + the PDF. + + − If the area below the PDF is required for a given distribution it must + be given by the ‘unur_distr_cont_set_pdfarea’ call. For a truncated + distribution this must be of course the integral of the PDF in the + given truncated domain. For distributions from the UNU.RAN library of + standard distributions this is done automatically by the + ‘unur_distr_cont_upd_pdfarea’ call. + + It is important to note that all these functions must return a result for + all values of X. Eg., if the domain of a given PDF is the interval [-1,1], + then the given function must return ‘0.0’ for all points outside this + interval. In case of an overflow the PDF should return ‘UNUR_INFINITY’. + + It is not possible to change such a function. Once the PDF or CDF is set + it cannot be overwritten. This also holds when the logPDF is given or when + the PDF is given by the ‘unur_distr_cont_set_pdfstr’ or + ‘unur_distr_cont_set_logpdfstr’ call. A new distribution object has to be + used instead. + + -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_pdf (const UNUR_DISTR* + DISTRIBUTION) + -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_dpdf (const UNUR_DISTR* + DISTRIBUTION) + -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_cdf (const UNUR_DISTR* + DISTRIBUTION) + -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_invcdf (const UNUR_DISTR* + DISTRIBUTION) + Get the respective pointer to the PDF, the derivative of the PDF, the CDF, + and the inverse CDF of the DISTRIBUTION. The pointer is of type ‘double + funct(double x, const UNUR_DISTR *distr)’. If the corresponding function + is not available for the distribution, the ‘NULL’ pointer is returned. + + -- Function: double unur_distr_cont_eval_pdf (double X, const UNUR_DISTR* + DISTRIBUTION) + -- Function: double unur_distr_cont_eval_dpdf (double X, const UNUR_DISTR* + DISTRIBUTION) + -- Function: double unur_distr_cont_eval_cdf (double X, const UNUR_DISTR* + DISTRIBUTION) + -- Function: double unur_distr_cont_eval_invcdf (double U, const UNUR_DISTR* + DISTRIBUTION) + Evaluate the PDF, derivative of the PDF, the CDF, and the inverse CDF at X + and U,respectively. Notice that DISTRIBUTION must not be the ‘NULL’ + pointer. If the corresponding function is not available for the + distribution, ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_DATA’. + + _IMPORTANT:_ In the case of a truncated standard distribution these calls + always return the respective values of the _untruncated_ distribution! + + -- Function: int unur_distr_cont_set_logpdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CONT* LOGPDF) + -- Function: int unur_distr_cont_set_dlogpdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CONT* DLOGPDF) + -- Function: int unur_distr_cont_set_logcdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CONT* LOGCDF) + -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_logpdf (const UNUR_DISTR* + DISTRIBUTION) + -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_dlogpdf (const UNUR_DISTR* + DISTRIBUTION) + -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_logcdf (const UNUR_DISTR* + DISTRIBUTION) + -- Function: double unur_distr_cont_eval_logpdf (double X, const UNUR_DISTR* + DISTRIBUTION) + -- Function: double unur_distr_cont_eval_dlogpdf (double X, const UNUR_DISTR* + DISTRIBUTION) + -- Function: double unur_distr_cont_eval_logcdf (double X, const UNUR_DISTR* + DISTRIBUTION) + Analogous calls for the logarithm of the density distribution functions. + + -- Function: int unur_distr_cont_set_pdfstr (UNUR_DISTR* DISTRIBUTION, const + CHAR* PDFSTR) + This function provides an alternative way to set a PDF and its derivative + of the DISTRIBUTION. PDFSTR is a character string that contains the + formula for the PDF, see *note Function String: StringFunct, for details. + The derivative of the given PDF is computed automatically. See also the + remarks for the ‘unur_distr_cont_set_pdf’ call. + + It is not possible to call this funtion twice or to call this function + after a ‘unur_distr_cont_set_pdf’ call. + + -- Function: int unur_distr_cont_set_cdfstr (UNUR_DISTR* DISTRIBUTION, const + CHAR* CDFSTR) + This function provides an alternative way to set a CDF; analogously to the + ‘unur_distr_cont_set_pdfstr’ call. The PDF and its derivative of the given + CDF are computed automatically. + + -- Function: char* unur_distr_cont_get_pdfstr (const UNUR_DISTR* DISTRIBUTION) + -- Function: char* unur_distr_cont_get_dpdfstr (const UNUR_DISTR* DISTRIBUTION) + -- Function: char* unur_distr_cont_get_cdfstr (const UNUR_DISTR* DISTRIBUTION) + Get pointer to respective string for PDF, derivate of PDF, and CDF of + DISTRIBUTION that is given as string (instead of a function pointer). This + call allocates memory to produce this string. It should be freed when it + is not used any more. + + -- Function: int unur_distr_cont_set_pdfparams (UNUR_DISTR* DISTRIBUTION, const + DOUBLE* PARAMS, int N_PARAMS) + Sets array of parameters for DISTRIBUTION. There is an upper limit for the + number of parameters ‘n_params’. It is given by the macro + ‘UNUR_DISTR_MAXPARAMS’ in ‘unuran_config.h’. (It is set to 5 by default + but can be changed to any appropriate nonnegative number.) If N_PARAMS is + negative or exceeds this limit no parameters are copied into the + distribution object and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_NPARAMS’. + + For standard distributions from the UNU.RAN library the parameters are + checked. Moreover, the domain is updated automatically unless it has been + changed before by a ‘unur_distr_cont_set_domain’ call. If the given + parameters are invalid for the standard distribution, then no parameters + are set and an error code is returned. Notice, that the given parameter + list for such a distribution is handled in the same way as in the + corresponding ‘new’ calls, i.e. optional parameters for the PDF that are + not present in the given list are (re-)set to their default values. + + *Important:* If the parameters of a distribution from the UNU.RAN library + of standard distributions (*note Standard distributions: Stddist.) are + changed, then neither its mode nor the normalization constant are updated. + Please use the respective calls ‘unur_distr_cont_upd_mode’ and + ‘unur_distr_cont_upd_pdfarea’. Moreover, if the domain has been changed by + a ‘unur_distr_cont_set_domain’ it is not automatically updated, either. + Updating the normalization constant is in particular very important, when + the CDF of the distribution is used. + + -- Function: int unur_distr_cont_get_pdfparams (const UNUR_DISTR* DISTRIBUTION, + const DOUBLE** PARAMS) + Get number of parameters of the PDF and set pointer PARAMS to array of + parameters. If no parameters are stored in the object, an error code is + returned and ‘params’ is set to ‘NULL’. + + _Important:_ Do *not* change the entries in PARAMS! + + -- Function: int unur_distr_cont_set_pdfparams_vec (UNUR_DISTR* DISTRIBUTION, + int PAR, const DOUBLE* PARAM_VEC, int N_PARAM_VEC) + This function provides an interface for additional vector parameters for a + continuous DISTRIBUTION. + + It sets the parameter with number PAR. PAR indicates directly which of the + parameters is set and must be a number between ‘0’ and + ‘UNUR_DISTR_MAXPARAMS’-1 (the upper limit of possible parameters defined in + ‘unuran_config.h’; it is set to 5 but can be changed to any appropriate + nonnegative number.) + + The entries of a this parameter are given by the array PARAM_VEC of size + N_PARAM_VEC. + + If PARAM_VEC is ‘NULL’ then the corresponding entry is cleared. + + If an error occurs no parameters are copied into the parameter object + ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. + + -- Function: int unur_distr_cont_get_pdfparams_vec (const UNUR_DISTR* + DISTRIBUTION, int PAR, const DOUBLE** PARAM_VECS) + Get parameter of the PDF with number PAR. The pointer to the parameter + array is stored in PARAM_VECS, its size is returned by the function. If + the requested parameter is not set, then an error code is returned and + ‘params’ is set to ‘NULL’. + + _Important:_ Do *not* change the entries in PARAM_VECS! + + -- Function: int unur_distr_cont_set_logpdfstr (UNUR_DISTR* DISTRIBUTION, const + CHAR* LOGPDFSTR) + -- Function: char* unur_distr_cont_get_logpdfstr (const UNUR_DISTR* + DISTRIBUTION) + -- Function: char* unur_distr_cont_get_dlogpdfstr (const UNUR_DISTR* + DISTRIBUTION) + -- Function: int unur_distr_cont_set_logcdfstr (UNUR_DISTR* DISTRIBUTION, const + CHAR* LOGCDFSTR) + -- Function: char* unur_distr_cont_get_logcdfstr (const UNUR_DISTR* + DISTRIBUTION) + Analogous calls for the logarithm of the density and distribution + functions. + + -- Function: int unur_distr_cont_set_domain (UNUR_DISTR* DISTRIBUTION, double + LEFT, double RIGHT) + Set the left and right borders of the domain of the distribution. This can + also be used to truncate an existing distribution. For setting the + boundary to +/- infinity use ‘+/- UNUR_INFINITY’. If RIGHT is not strictly + greater than LEFT no domain is set and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_SET’. + + _Important:_ For some technical reasons it is assumed that the density is + unimodal and thus monotone on either side of the mode! This is used in the + case when the given mode is outside of the original domain. Then the mode + is set to the corresponding boundary of the new domain. If this result is + not the desired it must be changed by using a ‘unur_distr_cont_set_mode’ + call (or a ‘unur_distr_cont_upd_mode’ call). The same holds for the center + of the distribution. + + -- Function: int unur_distr_cont_get_domain (const UNUR_DISTR* DISTRIBUTION, + double* LEFT, double* RIGHT) + Get the left and right borders of the domain of the distribution. If the + domain is not set ‘+/- UNUR_INFINITY’ is assumed and returned. No error is + reported in this case. + + -- Function: int unur_distr_cont_get_truncated (const UNUR_DISTR* DISTRIBUTION, + double* LEFT, double* RIGHT) + Get the left and right borders of the (truncated) domain of the + distribution. For non-truncated distribution this call is equivalent to + the ‘unur_distr_cont_get_domain’ call. + + This call is only useful in connection with a ‘unur_get_distr’ call to get + the boundaries of the sampling region of a generator object. + + -- Function: int unur_distr_cont_set_hr (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CONT* HAZARD) + Set pointer to the hazard rate (HR) of the DISTRIBUTION. + + The _hazard rate_ (or failure rate) is a mathematical way of describing + aging. If the lifetime X is a random variable with density f(x) and CDF + F(x) the hazard rate h(x) is defined as h(x) = f(x) / (1-F(x)). In other + words, h(x) represents the (conditional) rate of failure of a unit that has + survived up to time x with probability 1-F(x). The key distribution is the + exponential distribution as it has constant hazard rate of value 1. Hazard + rates tending to infinity describe distributions with sub-exponential tails + whereas distributions with hazard rates tending to zero have heavier tails + than the exponential distribution. + + It is important to note that all these functions must return a result for + all floats x. In case of an overflow the PDF should return + ‘UNUR_INFINITY’. + + *Important*: Do not simply use f(x) / (1-F(x)), since this is numerically + very unstable and results in numerical noise if F(x) is (very) close to 1. + Moreover, if the density f(x) is known a generation method that uses the + density is more appropriate. + + It is not possible to change such a function. Once the HR is set it cannot + be overwritten. This also holds when the HR is given by the + ‘unur_distr_cont_set_hrstr’ call. A new distribution object has to be used + instead. + + -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_hr (const UNUR_DISTR* + DISTRIBUTION) + Get the pointer to the hazard rate of the DISTRIBUTION. The pointer is of + type ‘double funct(double x, const UNUR_DISTR *distr)’. If the + corresponding function is not available for the distribution, the ‘NULL’ + pointer is returned. + + -- Function: double unur_distr_cont_eval_hr (double X, const UNUR_DISTR* + DISTRIBUTION) + Evaluate the hazard rate at X. Notice that DISTRIBUTION must not be the + ‘NULL’ pointer. If the corresponding function is not available for the + distribution, ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_DATA’. + + -- Function: int unur_distr_cont_set_hrstr (UNUR_DISTR* DISTRIBUTION, const + CHAR* HRSTR) + This function provides an alternative way to set a hazard rate and its + derivative of the DISTRIBUTION. HRSTR is a character string that contains + the formula for the HR, see *note Function String: StringFunct, for + details. See also the remarks for the ‘unur_distr_cont_set_hr’ call. + + It is not possible to call this funtion twice or to call this function + after a ‘unur_distr_cont_set_hr’ call. + + -- Function: char* unur_distr_cont_get_hrstr (const UNUR_DISTR* DISTRIBUTION) + Get pointer to string for HR of DISTRIBUTION that is given via the string + interface. This call allocates memory to produce this string. It should + be freed when it is not used any more. + +Derived parameters +.................. + +The following paramters *must* be set whenever one of the essential parameters +has been set or changed (and the parameter is required for the chosen method). + + -- Function: int unur_distr_cont_set_mode (UNUR_DISTR* DISTRIBUTION, double + MODE) + Set mode of DISTRIBUTION. The MODE must be contained in the domain of + DISTRIBUTION. Otherwise the mode is not set and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_SET’. For distributions with unbounded density, this call + is used to set the pole of the PDF. Notice that the PDF should then return + ‘UNUR_INFINITY’ at the pole. Notice that the mode is adjusted when the + domain is set, see the remark for the ‘unur_distr_cont_set_domain’ call. + + -- Function: int unur_distr_cont_upd_mode (UNUR_DISTR* DISTRIBUTION) + Recompute the mode of the DISTRIBUTION. This call works properly for + distribution objects from the UNU.RAN library of standard distributions + when the corresponding function is available. Otherwise a (slow) numerical + mode finder based on Brent’s algorithm is used. If it failes ‘unur_errno’ + is set to ‘UNUR_ERR_DISTR_DATA’. + + -- Function: double unur_distr_cont_get_mode (UNUR_DISTR* DISTRIBUTION) + Get mode of DISTRIBUTION. If the mode is not marked as known, + ‘unur_distr_cont_upd_mode’ is called to compute the mode. If this is not + successful ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_GET’. (There is no difference between the case where no + routine for computing the mode is available and the case where no mode + exists for the distribution at all.) + + -- Function: int unur_distr_cont_set_center (UNUR_DISTR* DISTRIBUTION, double + CENTER) + Set center of the DISTRIBUTION. The center is used by some methods to + shift the distribution in order to decrease numerical round-off error. If + not given explicitly a default is used. + + _Important:_ This call does not check whether the center is contained in + the given domain. + + Default: The mode, if set by a ‘unur_distr_cont_set_mode’ or + ‘unur_distr_cont_upd_mode’ call; otherwise ‘0’. + + -- Function: double unur_distr_cont_get_center (const UNUR_DISTR* DISTRIBUTION) + Get center of the DISTRIBUTION. It always returns some point as there + always exists a default for the center, see ‘unur_distr_cont_set_center’. + + -- Function: int unur_distr_cont_set_pdfarea (UNUR_DISTR* DISTRIBUTION, double + AREA) + Set the area below the PDF. If ‘area’ is non-positive, no area is set and + ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. + + For a distribution object created by the UNU.RAN library of standard + distributions you always should use the ‘unur_distr_cont_upd_pdfarea’. + Otherwise there might be ambiguous side-effects. + + -- Function: int unur_distr_cont_upd_pdfarea (UNUR_DISTR* DISTRIBUTION) + Recompute the area below the PDF of the distribution. It only works for + distribution objects from the UNU.RAN library of standard distributions + when the corresponding function is available. Otherwise ‘unur_errno’ is + set to ‘UNUR_ERR_DISTR_DATA’. + + This call also sets the normalization constant such that the given PDF is + the derivative of a given CDF, i.e. the area is 1. However, for truncated + distributions the area is smaller than 1. + + The call does not work for distributions from the UNU.RAN library of + standard distributions with truncated domain when the CDF is not available. + + -- Function: double unur_distr_cont_get_pdfarea (UNUR_DISTR* DISTRIBUTION) + Get the area below the PDF of the distribution. If this area is not known, + ‘unur_distr_cont_upd_pdfarea’ is called to compute it. If this is not + successful ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_GET’. + +4.3 Continuous univariate order statistics +========================================== + +These are special cases of a continuous univariate distributions and thus they +have most of these parameters (with the exception that functions cannot be +changed). Additionally, + + − there is a call to extract the underlying distribution, + + − and a call to handle the ‘rank’ of the order statistics. + +Function reference +------------------ + + -- Function: UNUR_DISTR* unur_distr_corder_new (const UNUR_DISTR* DISTRIBUTION, + int N, int K) + Create an object for order statistics of sample size N and rank K. + DISTRIBUTION must be a pointer to a univariate continuous distribution. + The resulting generator object is of the same type as of a + ‘unur_distr_cont_new’ call. (However, it cannot be used to make an order + statistics out of an order statistics.) + + To have a PDF for the order statistics, the given distribution object must + contain a CDF and a PDF. Moreover, it is assumed that the given PDF is the + derivative of the given CDF. Otherwise the area below the PDF of the order + statistics is not computed correctly. + + _Important:_ There is no warning when the computed area below the PDF of + the order statistics is wrong. + + -- Function: const UNUR_DISTR* unur_distr_corder_get_distribution (const + UNUR_DISTR* DISTRIBUTION) + Get pointer to distribution object for underlying distribution. + +Essential parameters +.................... + + -- Function: int unur_distr_corder_set_rank (UNUR_DISTR* DISTRIBUTION, int N, + int K) + Change sample size N and rank K of order statistics. In case of invalid + data, no parameters are changed. The area below the PDF can be set to that + of the underlying distribution by a ‘unur_distr_corder_upd_pdfarea’ call. + + -- Function: int unur_distr_corder_get_rank (const UNUR_DISTR* DISTRIBUTION, + int* N, int* K) + Get sample size N and rank K of order statistics. In case of error an + error code is returned. + + Additionally most of the set and get calls for continuous univariate +distributions work. The most important exceptions are that the PDF and CDF +cannot be changed and ‘unur_distr_cont_upd_mode’ uses in any way a (slow) +numerical method that might fail. + + -- Function: UNUR_FUNCT_CONT* unur_distr_corder_get_pdf (UNUR_DISTR* + DISTRIBUTION) + -- Function: UNUR_FUNCT_CONT* unur_distr_corder_get_dpdf (UNUR_DISTR* + DISTRIBUTION) + -- Function: UNUR_FUNCT_CONT* unur_distr_corder_get_cdf (UNUR_DISTR* + DISTRIBUTION) + Get the respective pointer to the PDF, the derivative of the PDF and the + CDF of the distribution, respectively. The pointer is of type ‘double + funct(double x, UNUR_DISTR *distr)’. If the corresponding function is not + available for the distribution, the ‘NULL’ pointer is returned. See also + ‘unur_distr_cont_get_pdf’. (Macro) + + -- Function: double unur_distr_corder_eval_pdf (double X, UNUR_DISTR* + DISTRIBUTION) + -- Function: double unur_distr_corder_eval_dpdf (double X, UNUR_DISTR* + DISTRIBUTION) + -- Function: double unur_distr_corder_eval_cdf (double X, UNUR_DISTR* + DISTRIBUTION) + Evaluate the PDF, derivative of the PDF. and the CDF, respectively, at X. + Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the + corresponding function is not available for the distribution, + ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_DATA’. See also ‘unur_distr_cont_eval_pdf’. (Macro) + + _IMPORTANT:_ In the case of a truncated standard distribution these calls + always return the respective values of the _untruncated_ distribution! + + -- Function: int unur_distr_corder_set_pdfparams (UNUR_DISTR* DISTRIBUTION, + double* PARAMS, int N_PARAMS) + Set array of parameters for underlying distribution. See + ‘unur_distr_cont_set_pdfparams’ for details. (Macro) + + -- Function: int unur_distr_corder_get_pdfparams (UNUR_DISTR* DISTRIBUTION, + double** PARAMS) + Get number of parameters of the PDF of the underlying distribution and set + pointer PARAMS to array of parameters. See ‘unur_distr_cont_get_pdfparams’ + for details. (Macro) + + -- Function: int unur_distr_corder_set_domain (UNUR_DISTR* DISTRIBUTION, double + LEFT, double RIGHT) + Set the left and right borders of the domain of the distribution. See + ‘unur_distr_cont_set_domain’ for details. (Macro) + + -- Function: int unur_distr_corder_get_domain (UNUR_DISTR* DISTRIBUTION, + double* LEFT, double* RIGHT) + Get the left and right borders of the domain of the distribution. See + ‘unur_distr_cont_get_domain’ for details. (Macro) + + -- Function: int unur_distr_corder_get_truncated (UNUR_DISTR* DISTRIBUTION, + double* LEFT, double* RIGHT) + Get the left and right borders of the (truncated) domain of the + distribution. See ‘unur_distr_cont_get_truncated’ for details. (Macro) + +Derived parameters +.................. + +The following paramters *must* be set whenever one of the essential parameters +has been set or changed (and the parameter is required for the chosen method). + + -- Function: int unur_distr_corder_set_mode (UNUR_DISTR* DISTRIBUTION, double + MODE) + Set mode of distribution. See also ‘unur_distr_corder_set_mode’. (Macro) + + -- Function: double unur_distr_corder_upd_mode (UNUR_DISTR* DISTRIBUTION) + Recompute the mode of the distribution numerically. Notice that this + routine is slow and might not work properly in every case. See also + ‘unur_distr_cont_upd_mode’ for further details. (Macro) + + -- Function: double unur_distr_corder_get_mode (UNUR_DISTR* DISTRIBUTION) + Get mode of distribution. See ‘unur_distr_cont_get_mode’ for details. + (Macro) + + -- Function: int unur_distr_corder_set_pdfarea (UNUR_DISTR* DISTRIBUTION, + double AREA) + Set the area below the PDF. See ‘unur_distr_cont_set_pdfarea’ for details. + (Macro) + + -- Function: double unur_distr_corder_upd_pdfarea (UNUR_DISTR* DISTRIBUTION) + Recompute the area below the PDF of the distribution. It only works for + order statistics for distribution objects from the UNU.RAN library of + standard distributions when the corresponding function is available. + ‘unur_distr_cont_upd_pdfarea’ assumes that the PDF of the underlying + distribution is normalized, i.e. it is the derivative of its CDF. + Otherwise the computed area is wrong and there is *no* warning about this + failure. See ‘unur_distr_cont_upd_pdfarea’ for further details. (Macro) + + -- Function: double unur_distr_corder_get_pdfarea (UNUR_DISTR* DISTRIBUTION) + Get the area below the PDF of the distribution. See + ‘unur_distr_cont_get_pdfarea’ for details. (Macro) + +4.4 Continuous empirical univariate distributions +================================================= + +Empirical univariate distributions are derived from observed data. There are +two ways to create such a generator object: + 1. By a list of _raw data_ by means of a ‘unur_distr_cemp_set_data’ call. + 2. By a _histogram_ (i.e. preprocessed data) by means of a + ‘unur_distr_cemp_set_hist’ call. + How these data are used to sample from the empirical distribution depends +from the chosen generation method. + +Function reference +------------------ + + -- Function: UNUR_DISTR* unur_distr_cemp_new (void) + Create a new (empty) object for empirical univariate continuous + distribution. + +Essential parameters +.................... + + -- Function: int unur_distr_cemp_set_data (UNUR_DISTR* DISTRIBUTION, const + DOUBLE* SAMPLE, int N_SAMPLE) + Set observed sample for empirical distribution. + + -- Function: int unur_distr_cemp_read_data (UNUR_DISTR* DISTRIBUTION, const + CHAR* FILENAME) + Read data from file ‘filename’. It reads the first number from each line. + Numbers are parsed by means of the C standard routine ‘strtod’. Lines that + do not start with ‘+’, ‘-’, ‘.’, or a digit are ignored. (Beware of lines + starting with a blank!) + + In case of an error (file cannot be opened, invalid string for double in + line) no data are copied into the distribution object and an error code is + returned. + + -- Function: int unur_distr_cemp_get_data (const UNUR_DISTR* DISTRIBUTION, + const DOUBLE** SAMPLE) + Get number of samples and set pointer SAMPLE to array of observations. If + no sample has been given, an error code is returned and ‘sample’ is set to + ‘NULL’. + + _Important:_ Do *not* change the entries in SAMPLE! + + -- Function: int unur_distr_cemp_set_hist (UNUR_DISTR* DISTRIBUTION, const + DOUBLE* PROB, int N_PROB, double XMIN, double XMAX) + Set a histogram with bins of equal width. PROB is an array of length + N_PROB that contains the probabilities for the bins (in ascending order). + XMIN and XMAX give the lower and upper bound of the histogram, + respectively. The bins are assumed to have equal width. + + _Remark:_ This is shortcut for calling ‘unur_distr_cemp_set_hist_prob’ and + ‘unur_distr_cemp_set_hist_domain’. _Notice:_ All sampling methods either + use raw data or histogram. It is possible to set both types of data; + however, it is not checked whether the given histogran corresponds to + possibly given raw data. + + -- Function: int unur_distr_cemp_set_hist_prob (UNUR_DISTR* DISTRIBUTION, const + DOUBLE* PROB, int N_PROB) + Set probabilities of a histogram with N_PROB bins. Hence PROB must be an + array of length N_PROB that contains the probabilities for the bins in + ascending order. It is important also to set the location of the bins + either with a ‘unur_distr_cemp_set_hist_domain’ for bins of equal width or + ‘unur_distr_cemp_set_hist_bins’ when the bins have different width. + + _Notice:_ All sampling methods either use raw data or histogram. It is + possible to set both types of data; however, it is not checked whether the + given histogram corresponds to possibly given raw data. + + -- Function: int unur_distr_cemp_set_hist_domain (UNUR_DISTR* DISTRIBUTION, + double XMIN, double XMAX) + Set a domain of a histogram with bins of equal width. XMIN and XMAX give + the lower and upper bound of the histogram, respectively. + + -- Function: int unur_distr_cemp_set_hist_bins (UNUR_DISTR* DISTRIBUTION, const + DOUBLE* BINS, int N_BINS) + Set location of bins of a histogram with N_BINS bins. Hence BINS must be + an array of length N_BINS. The domain of the DISTRIBUTION is automatically + set by this call and overrides any calls to + ‘unur_distr_cemp_set_hist_domain’. _Important:_ The probabilities of the + bins of the DISTRIBUTION must be already be set by a + ‘unur_distr_cemp_set_hist_prob’ (or a ‘unur_distr_cemp_set_hist’ call) and + the value of N_BINS must equal N_PROB‘+1’ from the corresponding value of + the respective call. + +4.5 Continuous multivariate distributions +========================================= + +The following calls handle multivariate distributions. However, the +requirements of particular generation methods is not as unique as for univariate +distributions. Moreover, random vector generation methods are still under +development. The below functions are a first attempt to handle this situation. + + Notice that some of the parameters – when given carelessly – might contradict +to others. For example: Some methods require the marginal distribution and some +methods need a standardized form of the marginal distributions, where the actual +mean and variance is stored in the mean vector and the covariance matrix, +respectively. + + We also have to mention that some methods might abuse some of the parameters. +Please read the discription of the chosen sampling method carfully. + + The following kind of calls exists: + + − Create a ‘new’ instance of a continuous multivariate distribution; + + − Handle and evaluate probability density function (PDF, ‘pdf’) and the + gradient of the density function (‘dpdf’). The following is important: + . ‘pdf’ need not be normalized, i.e., any integrable nonnegative + function can be used. + . ‘dpdf’ must the derivate of the function provided as ‘pdf’. + + − Handle and evaluate the logarithm of the probability density function + (logPDF, ‘logpdf’) and the gradient of the logarithm of the density + function (‘dlogpdf’). + + Some methods use the logarithm of the density if available. + + − Set (and change) parameters (‘pdfparams’) and the volume below the graph + (‘pdfvol’) of the given density. + + − Set ‘mode’ and ‘mean’ of the distribution. + + − Set the ‘center’ of the distribution. It is used by some generation + methods to adjust the parameters of the generation algorithms to gain + better performance. It can be seens as the location of the “central part” + of the distribution. + + − Handle the ‘covar’iance matrix of the distribution and its ‘cholesky’ and + ‘inv’verse matrices. + + − Set the ‘rankcorr’elation matrix of the distribution. + + − Deal with ‘marginal’ distributions. + + − Set domain of the distribution. + +Function reference +------------------ + + -- Function: UNUR_DISTR* unur_distr_cvec_new (int DIM) + Create a new (empty) object for multivariate continuous distribution. DIM + is the number of components of the random vector (i.e. its dimension). It + is also possible to use dimension 1. Notice, however, that this is treated + as a distribution of random vectors with only one component and not as a + distribution of real numbers. For the latter ‘unur_distr_cont_new’ should + be used to create an object for a univariate distribution. + +Essential parameters +.................... + + -- Function: int unur_distr_cvec_set_pdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CVEC* PDF) + Set respective pointer to the PDF of the DISTRIBUTION. This function must + be of type ‘double funct(const double *x, UNUR_DISTR *distr)’, where X must + be a pointer to a double array of appropriate size (i.e. of the same size + as given to the ‘unur_distr_cvec_new’ call). + + It is not necessary that the given PDF is normalized, i.e. the integral + need not be 1. Nevertheless the volume below the PDF can be provided by a + ‘unur_distr_cvec_set_pdfvol’ call. + + It is not possible to change the PDF. Once the PDF is set it cannot be + overwritten. This also holds when the logPDF is given. A new distribution + object has to be used instead. + + -- Function: int unur_distr_cvec_set_dpdf (UNUR_DISTR* DISTRIBUTION, + UNUR_VFUNCT_CVEC* DPDF) + Set pointer to the gradient of the PDF. The type of this function must be + ‘int funct(double *result, const double *x, UNUR_DISTR *distr)’, where + RESULT and X must be pointers to double arrays of appropriate size (i.e. + of the same size as given to the ‘unur_distr_cvec_new’ call). The gradient + of the PDF is stored in the array RESULT. The function should return an + error code in case of an error and must return ‘UNUR_SUCCESS’ otherwise. + + The given function must be the gradient of the function given by a + ‘unur_distr_cvec_set_pdf’ call. + + It is not possible to change the gradient of the PDF. Once the dPDF is set + it cannot be overwritten. This also holds when the gradient of the logPDF + is given. A new distribution object has to be used instead. + + -- Function: int unur_distr_cvec_set_pdpdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCTD_CVEC* PDPDF) + Set pointer to partial derivatives of the PDF. The type of this function + must be ‘double funct(const double *x, int coord, UNUR_DISTR *distr)’, + where X must be a pointer to a double array of appropriate size (i.e. of + the same size as given to the ‘unur_distr_cvec_new’ call). COORD is the + coordinate for which the partial dervative should be computed. + + Notice that COORD must be an integer from {0,...,dim-1}. + + It is not possible to change the partial derivative of the PDF. Once the + pdPDF is set it cannot be overwritten. This also holds when the partial + derivative of the logPDF is given. A new distribution object has to be + used instead. + + -- Function: UNUR_FUNCT_CVEC* unur_distr_cvec_get_pdf (const UNUR_DISTR* + DISTRIBUTION) + Get the pointer to the PDF of the DISTRIBUTION. The pointer is of type + ‘double funct(const double *x, UNUR_DISTR *distr)’. If the corresponding + function is not available for the DISTRIBUTION, the ‘NULL’ pointer is + returned. + + -- Function: UNUR_VFUNCT_CVEC* unur_distr_cvec_get_dpdf (const UNUR_DISTR* + DISTRIBUTION) + Get the pointer to the gradient of the PDF of the DISTRIBUTION. The + pointer is of type ‘int double funct(double *result, const double *x, + UNUR_DISTR *distr)’. If the corresponding function is not available for + the DISTRIBUTION, the ‘NULL’ pointer is returned. + + -- Function: double unur_distr_cvec_eval_pdf (const DOUBLE* X, UNUR_DISTR* + DISTRIBUTION) + Evaluate the PDF of the DISTRIBUTION at X. X must be a pointer to a double + array of appropriate size (i.e. of the same size as given to the + ‘unur_distr_cvec_new’ call) that contains the vector for which the function + has to be evaluated. + + Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the + corresponding function is not available for the DISTRIBUTION, + ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_DATA’. + + -- Function: int unur_distr_cvec_eval_dpdf (double* RESULT, const DOUBLE* X, + UNUR_DISTR* DISTRIBUTION) + Evaluate the gradient of the PDF of the DISTRIBUTION at X. The result is + stored in the double array RESULT. Both RESULT and X must be pointer to + double arrays of appropriate size (i.e. of the same size as given to the + ‘unur_distr_cvec_new’ call). + + Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the + corresponding function is not available for the DISTRIBUTION, an error code + is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’ (RESULT is + left unmodified). + + -- Function: double unur_distr_cvec_eval_pdpdf (const DOUBLE* X, int COORD, + UNUR_DISTR* DISTRIBUTION) + Evaluate the partial derivative of the PDF of the DISTRIBUTION at X for the + coordinate COORD. X must be a pointer to a double array of appropriate + size (i.e. of the same size as given to the ‘unur_distr_cvec_new’ call) + that contains the vector for which the function has to be evaluated. + + Notice that COORD must be an integer from {0,...,dim-1}. + + Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the + corresponding function is not available for the DISTRIBUTION, + ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_DATA’. + + -- Function: int unur_distr_cvec_set_logpdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_CVEC* LOGPDF) + -- Function: int unur_distr_cvec_set_dlogpdf (UNUR_DISTR* DISTRIBUTION, + UNUR_VFUNCT_CVEC* DLOGPDF) + -- Function: int unur_distr_cvec_set_pdlogpdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCTD_CVEC* PDLOGPDF) + -- Function: UNUR_FUNCT_CVEC* unur_distr_cvec_get_logpdf (const UNUR_DISTR* + DISTRIBUTION) + -- Function: UNUR_VFUNCT_CVEC* unur_distr_cvec_get_dlogpdf (const UNUR_DISTR* + DISTRIBUTION) + -- Function: double unur_distr_cvec_eval_logpdf (const DOUBLE* X, UNUR_DISTR* + DISTRIBUTION) + -- Function: int unur_distr_cvec_eval_dlogpdf (double* RESULT, const DOUBLE* X, + UNUR_DISTR* DISTRIBUTION) + -- Function: double unur_distr_cvec_eval_pdlogpdf (const DOUBLE* X, int COORD, + UNUR_DISTR* DISTRIBUTION) + Analogous calls for the logarithm of the density function. + + -- Function: int unur_distr_cvec_set_mean (UNUR_DISTR* DISTRIBUTION, const + DOUBLE* MEAN) + Set mean vector for multivariate DISTRIBUTION. MEAN must be a pointer to + an array of size ‘dim’, where ‘dim’ is the dimension returned by + ‘unur_distr_get_dim’. A ‘NULL’ pointer for MEAN is interpreted as the zero + vector (0,...,0). + + *Important:* If the parameters of a distribution from the UNU.RAN library + of standard distributions (*note Standard distributions: Stddist.) are + changed, then neither its mode nor the normalization constant are updated. + Please use the respective calls ‘unur_distr_cvec_upd_mode’ and + ‘unur_distr_cvec_upd_pdfvol’. + + -- Function: const double* unur_distr_cvec_get_mean (const UNUR_DISTR* + DISTRIBUTION) + Get the mean vector of the DISTRIBUTION. The function returns a pointer to + an array of size ‘dim’. If the mean vector is not marked as known the + ‘NULL’ pointer is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’. + + _Important:_ Do *not* modify the array that holds the mean vector! + + -- Function: int unur_distr_cvec_set_covar (UNUR_DISTR* DISTRIBUTION, const + DOUBLE* COVAR) + Set covariance matrix for multivariate DISTRIBUTION. COVAR must be a + pointer to an array of size ‘dim’ x ‘dim’, where ‘dim’ is the dimension + returned by ‘unur_distr_get_dim’. The rows of the matrix have to be stored + consecutively in this array. + + COVAR must be a variance-covariance matrix of the DISTRIBUTION, i.e. it + must be symmetric and positive definit and its diagonal entries (i.e. the + variance of the components of the random vector) must be strictly positive. + The Cholesky factor is computed (and stored) to verify the positive + definiteness condition. Notice that the inverse of the given covariance + matrix is automatically computed when it is requested by some routine. + Notice that the computation of this inverse matrix is unstable in case of + high correlations and/or high dimensions. Thus it might fail and methods + that require this inverse cannot be used. As an alternative the inverse of + the covariance matrix can be directly set by a + ‘unur_distr_cvec_set_covar_inv’ call. + + A ‘NULL’ pointer for COVAR is interpreted as the identity matrix. + + _Important:_ This entry is abused in some methods which do not require the + covariance matrix. It is then used to perform some transformation to + obtain better performance. + + _Important:_ In case of an error (e.g. because COVAR is not a valid + covariance matrix) an error code is returned. Moreover, the covariance + matrix is not set and is marked as unknown. A previously set covariance + matrix is then no longer available. + + *Important:* If the parameters of a distribution from the UNU.RAN library + of standard distributions (*note Standard distributions: Stddist.) are + changed, then neither its mode nor the normalization constant are updated. + Please use the respective calls ‘unur_distr_cvec_upd_mode’ and + ‘unur_distr_cvec_upd_pdfvol’. _Remark:_ UNU.RAN does not check whether the + an eventually set covariance matrix and a rank-correlation matrix do not + contradict each other. + + -- Function: int unur_distr_cvec_set_covar_inv (UNUR_DISTR* DISTRIBUTION, const + DOUBLE* COVAR_INV) + Set inverse of the covariance matrix for multivariate DISTRIBUTION. + COVAR_INV must be a pointer to an array of size ‘dim’ x ‘dim’, where ‘dim’ + is the dimension returned by ‘unur_distr_get_dim’. The rows of the matrix + have to be stored consecutively in this array. + + COVAR_INV must be symmetric and positive definit. Only the symmetry of the + matrix is checked. + + A ‘NULL’ pointer for COVAR_INV is interpreted as the identity matrix. + + _Important:_ In case of an error (because COVAR_INV is not symetric) an + error code is returned. Moreover, the inverse of the covariance matrix is + not set and is marked as unknown. A previously set inverse matrix is then + no longer available. + + _Remark:_ UNU.RAN does not check whether the given matrix is positive + definit. + + _Remark:_ UNU.RAN does not check whether the matrix COVAR_INV is the + inverse of the eventually set covariance matrix. + + -- Function: const double* unur_distr_cvec_get_covar (const UNUR_DISTR* + DISTRIBUTION) + -- Function: const double* unur_distr_cvec_get_cholesky (const UNUR_DISTR* + DISTRIBUTION) + -- Function: const double* unur_distr_cvec_get_covar_inv (UNUR_DISTR* + DISTRIBUTION) + Get covariance matrix of DISTRIBUTION, its Cholesky factor, and its + inverse, respectively. The function returns a pointer to an array of size + ‘dim’ x ‘dim’. The rows of the matrix are stored consecutively in this + array. If the requested matrix is not marked as known the ‘NULL’ pointer + is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’. + + _Important:_ Do *not* modify the array that holds the covariance matrix! + + _Remark:_ The inverse of the covariance matrix is computed if it is not + already stored. + + -- Function: int unur_distr_cvec_set_rankcorr (UNUR_DISTR* DISTRIBUTION, const + DOUBLE* RANKCORR) + Set rank-correlation matrix (Spearman’s correlation) for multivariate + DISTRIBUTION. RANKCORR must be a pointer to an array of size ‘dim’ x + ‘dim’, where ‘dim’ is the dimension returned by ‘unur_distr_get_dim’. The + rows of the matrix have to be stored consecutively in this array. + + RANKCORR must be a rank-correlation matrix of the DISTRIBUTION, i.e. it + must be symmetric and positive definite and its diagonal entries must be + equal to ‘1’. + + The Cholesky factor is computed (and stored) to verify the positive + definiteness condition. + + A ‘NULL’ pointer for RANKCORR is interpreted as the identity matrix. + + _Important:_ In case of an error (e.g. because RANKCORR is not a valid + rank-correlation matrix) an error code is returned. Moreover, the + rank-correlation matrix is not set and is marked as unknown. A previously + set rank-correlation matrix is then no longer available. + + _Remark:_ UNU.RAN does not check whether the an eventually set covariance + matrix and a rank-correlation matrix do not contradict each other. + + -- Function: const double* unur_distr_cvec_get_rankcorr (const UNUR_DISTR* + DISTRIBUTION) + -- Function: const double* unur_distr_cvec_get_rk_cholesky (const UNUR_DISTR* + DISTRIBUTION) + Get rank-correlation matrix and its cholesky factor, respectively, of + DISTRIBUTION. The function returns a pointer to an array of size ‘dim’ x + ‘dim’. The rows of the matrix are stored consecutively in this array. If + the requested matrix is not marked as known the ‘NULL’ pointer is returned + and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’. + + _Important:_ Do *not* modify the array that holds the rank-correlation + matrix! + + -- Function: int unur_distr_cvec_set_marginals (UNUR_DISTR* DISTRIBUTION, + UNUR_DISTR* MARGINAL) + Sets marginal distributions of the given DISTRIBUTION to the same MARGINAL + distribution object. The MARGINAL distribution must be an instance of a + continuous univariate distribution object. Notice that the marginal + distribution is copied into the DISTRIBUTION object. + + -- Function: int unur_distr_cvec_set_marginal_array (UNUR_DISTR* DISTRIBUTION, + UNUR_DISTR** MARGINALS) + Analogously to the above ‘unur_distr_cvec_set_marginals’ call. However, + now an array MARGINALS of the pointers to each of the marginal + distributions must be given. It *must* be an array of size ‘dim’, where + ‘dim’ is the dimension returned by ‘unur_distr_get_dim’. _Notice_: Local + copies for each of the entries are stored in the DISTRIBUTION object. If + some of these entries are identical (i.e. contain the same pointer), then + for each of these a new copy is made. + + -- Function: int unur_distr_cvec_set_marginal_list (UNUR_DISTR* DISTRIBUTION, + ...) + Similar to the above ‘unur_distr_cvec_set_marginal_array’ call. However, + now the pointers to the particular marginal distributions can be given as + parameter and does not require an array of pointers. Additionally the + given distribution objects are immediately destroyed. Thus calls like + ‘unur_distr_normal’ can be used as arguments. (With + ‘unur_distr_cvec_set_marginal_array’ the result of such call has to be + stored in a pointer since it has to be freed afterwarts to avoid memory + leaks!) + + The number of pointers to in the list of function arguments *must* be equal + to the dimension of the DISTRIBUTION, i.e. the dimension returned by + ‘unur_distr_get_dim’. If one of the given pointer to marginal + distributions is the ‘NULL’ pointer then the marginal distributions of + DISTRIBUTION are not set (or previous settings are not changed) and an + error code is returned. + + *Important:* All distribution objects given in the argument list are + destroyed! + + -- Function: const UNUR_DISTR* unur_distr_cvec_get_marginal (const UNUR_DISTR* + DISTRIBUTION, int N) + Get pointer to the N-th marginal distribution object from the given + multivariate DISTRIBUTION. If this does not exist, ‘NULL’ is returned. + The marginal distributions are enumerated from ‘1’ to ‘dim’, where ‘dim’ is + the dimension returned by ‘unur_distr_get_dim’. + + -- Function: int unur_distr_cvec_set_pdfparams (UNUR_DISTR* DISTRIBUTION, const + DOUBLE* PARAMS, int N_PARAMS) + Sets array of parameters for DISTRIBUTION. There is an upper limit for the + number of parameters ‘n_params’. It is given by the macro + ‘UNUR_DISTR_MAXPARAMS’ in ‘unuran_config.h’. (It is set to 5 by default + but can be changed to any appropriate nonnegative number.) If N_PARAMS is + negative or exceeds this limit no parameters are copied into the + distribution object and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_NPARAMS’. + + For standard distributions from the UNU.RAN library the parameters are + checked. Moreover, the domain is updated automatically. If the given + parameters are invalid for the standard distribution, then no parameters + are set and an error code is returned. Notice that the given parameter + list for such a distribution is handled in the same way as in the + corresponding ‘new’ calls, i.e. optional parameters for the PDF that are + not present in the given list are (re-)set to their default values. + + *Important:* If the parameters of a distribution from the UNU.RAN library + of standard distributions (*note Standard distributions: Stddist.) are + changed, then neither its mode nor the normalization constant are updated. + Please use the respective calls ‘unur_distr_cvec_upd_mode’ and + ‘unur_distr_cvec_upd_pdfvol’. + + -- Function: int unur_distr_cvec_get_pdfparams (const UNUR_DISTR* DISTRIBUTION, + const DOUBLE** PARAMS) + Get number of parameters of the PDF and set pointer PARAMS to array of + parameters. If no parameters are stored in the object, an error code is + returned and ‘params’ is set to ‘NULL’. + + _Important:_ Do *not* change the entries in PARAMS! + + -- Function: int unur_distr_cvec_set_pdfparams_vec (UNUR_DISTR* DISTRIBUTION, + int PAR, const DOUBLE* PARAM_VEC, int N_PARAMS) + This function provides an interface for additional vector parameters for a + multivariate DISTRIBUTION besides mean vector and covariance matrix which + have their own calls. + + It sets the parameter with number PAR. PAR indicates directly which of the + parameters is set and must be a number between ‘0’ and + ‘UNUR_DISTR_MAXPARAMS’-1 (the upper limit of possible parameters defined in + ‘unuran_config.h’; it is set to 5 but can be changed to any appropriate + nonnegative number.) + + The entries of a this parameter are given by the array PARAM_VEC of size + N_PARAMS. Notice that using this interface an An (n x m)-matrix has to be + stored in an array of length N_PARAMS = n times m; where the rows of the + matrix are stored consecutively in this array. + + Due to great variety of possible parameters for a multivariate DISTRIBUTION + there is no simpler interface. + + If PARAM_VEC is ‘NULL’ then the corresponding entry is cleared. + + *Important:* If the parameters of a distribution from the UNU.RAN library + of standard distributions (*note Standard distributions: Stddist.) are + changed, then neither its mode nor the normalization constant are updated. + Please use the respective calls ‘unur_distr_cvec_upd_mode’ and + ‘unur_distr_cvec_upd_pdfvol’. If an error occurs no parameters are copied + into the parameter object ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. + + -- Function: int unur_distr_cvec_get_pdfparams_vec (const UNUR_DISTR* + DISTRIBUTION, int PAR, const DOUBLE** PARAM_VECS) + Get parameter of the PDF with number PAR. The pointer to the parameter + array is stored in PARAM_VECS, its size is returned by the function. If + the requested parameter is not set, then an error code is returned and + ‘params’ is set to ‘NULL’. + + _Important:_ Do *not* change the entries in PARAM_VECS! + + -- Function: int unur_distr_cvec_set_domain_rect (UNUR_DISTR* DISTRIBUTION, + const DOUBLE* LOWERLEFT, const DOUBLE* UPPERRIGHT) + Set rectangular domain for DISTRIBUTION with LOWERLEFT and UPPERRIGHT + vertices. Both must be pointer to an array of the size returned by + ‘unur_distr_get_dim’. A ‘NULL’ pointer is interpreted as the zero vector + (0,...,0). For setting a coordinate of the boundary to +/- infinity use + ‘+/- UNUR_INFINITY’. The LOWERLEFT vertex must be strictly smaller than + UPPERRIGHT in each component. Otherwise no domain is set and ‘unur_errno’ + is set to ‘UNUR_ERR_DISTR_SET’. + + By default the domain of a distribution is unbounded. Thus one can use + this call to truncate an existing distribution. + + _Important:_ Changing the domain of DISTRIBUTION marks derived parameters + like the mode or the center as unknown and must be set _after_ changing the + domain. This is important for the already set (or default) value for the + center does not fall into the given domain. Notice that calls of the PDF + and derived functions return ‘0.’ when the parameter is not contained in + the domain. + + -- Function: int unur_distr_cvec_is_indomain (const DOUBLE* X, const + UNUR_DISTR* DISTRIBUTION) + Check whether X falls into the domain of DISTRIBUTION. + +Derived parameters +.................. + +The following paramters *must* be set whenever one of the essential parameters +has been set or changed (and the parameter is required for the chosen method). + + -- Function: int unur_distr_cvec_set_mode (UNUR_DISTR* DISTRIBUTION, const + DOUBLE* MODE) + Set mode of the DISTRIBUTION. MODE must be a pointer to an array of the + size returned by ‘unur_distr_get_dim’. A ‘NULL’ pointer for MODE is + interpreted as the zero vector (0,...,0). + + -- Function: int unur_distr_cvec_upd_mode (UNUR_DISTR* DISTRIBUTION) + Recompute the mode of the DISTRIBUTION. This call works properly for + distribution objects from the UNU.RAN library of standard distributions + when the corresponding function is available. If it failes ‘unur_errno’ is + set to ‘UNUR_ERR_DISTR_DATA’. + + -- Function: const double* unur_distr_cvec_get_mode (UNUR_DISTR* DISTRIBUTION) + Get mode of the DISTRIBUTION. The function returns a pointer to an array + of the size returned by ‘unur_distr_get_dim’. If the mode is not marked as + known the ‘NULL’ pointer is returned and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_GET’. (There is no difference between the case where no + routine for computing the mode is available and the case where no mode + exists for the DISTRIBUTION at all.) + + _Important:_ Do *not* modify the array that holds the mode! + + -- Function: int unur_distr_cvec_set_center (UNUR_DISTR* DISTRIBUTION, const + DOUBLE* CENTER) + Set center of the DISTRIBUTION. CENTER must be a pointer to an array of + the size returned by ‘unur_distr_get_dim’. A ‘NULL’ pointer for CENTER is + interpreted as the zero vector (0,...,0). + + The center is used by some methods to shift the distribution in order to + decrease numerical round-off error. If not given explicitly a default is + used. Moreover, it is used as starting point for several numerical search + algorithm (e.g. for the mode). Then CENTER must be a pointer where the + call to the PDF returns a non-zero value. In particular CENTER must + contained in the domain of the distribution. + + Default: The mode, if given by a ‘unur_distr_cvec_set_mode’ call; else the + mean, if given by a ‘unur_distr_cvec_set_mean’ call; otherwise the null + vector (0,...,0). + + -- Function: const double* unur_distr_cvec_get_center (UNUR_DISTR* + DISTRIBUTION) + Get center of the DISTRIBUTION. The function returns a pointer to an array + of the size returned by ‘unur_distr_get_dim’. It always returns some point + as there always exists a default for the center, see + ‘unur_distr_cvec_set_center’. _Important:_ Do *not* modify the array that + holds the center! + + -- Function: int unur_distr_cvec_set_pdfvol (UNUR_DISTR* DISTRIBUTION, double + VOLUME) + Set the volume below the PDF. If VOL is non-positive, no volume is set and + ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. + + -- Function: int unur_distr_cvec_upd_pdfvol (UNUR_DISTR* DISTRIBUTION) + Recompute the volume below the PDF of the distribution. It only works for + distribution objects from the UNU.RAN library of standard distributions + when the corresponding function is available. Otherwise ‘unur_errno’ is + set to ‘UNUR_ERR_DISTR_DATA’. + + This call also sets the normalization constant such that the given PDF is + the derivative of a given CDF, i.e. the volume is 1. + + -- Function: double unur_distr_cvec_get_pdfvol (UNUR_DISTR* DISTRIBUTION) + Get the volume below the PDF of the DISTRIBUTION. If this volume is not + known, + ‘unur_distr_cont_upd_pdfarea’ is called to compute it. If this is not + successful ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_GET’. + +4.6 Continuous univariate full conditional distribution +======================================================= + +Full conditional distribution for a given continuous multivariate distributiion. +The condition is a position vector and either a variable that is variated or a +vector that indicates the direction on which the random vector can variate. + + There is a subtle difference between using direction vector and using the +K-th variable. When a direction vector is given the PDF of the conditional +distribution is defined by f(t) = PDF(pos + t * dir). When a variable is +selected the full conditional distribution with all other variables fixed is +used. + + This is a special case of a continuous univariate distribution and thus they +have most of these parameters (with the exception that functions cannot be +changed). Additionally, + + − there is a call to extract the underlying multivariate distribution, + + − and a call to handle the variables that are fixed and the direction for + changing the random vector. + + This distibution type is primarily used for evaluation the conditional +distribution and its derivative (as required for, e.g., the Gibbs sampler). The +density is not normalized (i.e. does not integrate to one). Mode and area are +not available and it does not make sense to use any call to set or change +parameters except the ones given below. + +Function reference +------------------ + + -- Function: UNUR_DISTR* unur_distr_condi_new (const UNUR_DISTR* DISTRIBUTION, + const DOUBLE* POS, const DOUBLE* DIR, int K) + Create an object for full conditional distribution for the given + DISTRIBUTION. The condition is given by a position vector POS and either + the K-th variable that is variated or the vector DIR that contains the + direction on which the random vector can variate. + + DISTRIBUTION must be a pointer to a multivariate continuous distribution. + POS must be a pointer to an array of size ‘dim’, where ‘dim’ is the + dimension of the underlying distribution object. DIR must be a pointer to + an array if size ‘dim’ or ‘NULL’. K must be in the range ‘0, ..., dim-1’. + If the K-th variable is used, DIR must be set to ‘NULL’. + + _Notice:_ There is a subtle difference between using direction vector DIR + and using the K-th variable. When DIR is given, the current position POS + is mapped into 0 of the conditional distribution and the derivative is + taken from the function PDF(POS+t*DIR) w.r.t. t. On the other hand, when + the coordinate K is used (i.e., when DIR is set to ‘NULL’), the full + conditional distribution of the distribution is considered (as used for the + Gibbs sampler). In particular, the current point is just projected into + the one-dimensional subspace without mapping it into the point 0. + + _Notice:_ If a coordinate K is used, then the K-th partial derivative is + used if it as available. Otherwise the gradient is computed and the K-th + component is returned. + + The resulting generator object is of the same type as of a + ‘unur_distr_cont_new’ call. + + -- Function: int unur_distr_condi_set_condition (struct UNUR_DISTR* + DISTRIBUTION, const DOUBLE* POS, const DOUBLE* DIR, int K) + Set/change condition for conditional DISTRIBUTION. Change values of fixed + variables to POS and use direction DIR or K-th variable of conditional + DISTRIBUTION. + + POS must be a pointer to an array of size ‘dim’, where ‘dim’ is the + dimension of the underlying distribution object. DIR must be a pointer to + an array if size ‘dim’ or ‘NULL’. K must be in the range ‘0, ..., dim-1’. + If the K-th variable is used, DIR must be set to ‘NULL’. + + _Notice:_ There is a subtle difference between using direction vector DIR + and using the K-th variable. When DIR is given, the current position POS + is mapped into 0 of the conditional distribution and the derivative is + taken from the function PDF(POS+t*DIR) w.r.t. t. On the other hand, when + the coordinate K is used (i.e., when DIR is set to ‘NULL’), the full + conditional distribution of the distribution is considered (as used for the + Gibbs sampler). In particular, the current point is just projected into + the one-dimensional subspace without mapping it into the point 0. + + -- Function: int unur_distr_condi_get_condition (struct UNUR_DISTR* + DISTRIBUTION, const DOUBLE** POS, const DOUBLE** DIR, int* K) + Get condition for conditional DISTRIBUTION. The values for the fixed + variables are stored in POS, which must be a pointer to an array of size + ‘dim’. The condition is stored in DIR and K, respectively. + + _Important:_ Do *not* change the entries in POS and DIR! + + -- Function: const UNUR_DISTR* unur_distr_condi_get_distribution (const + UNUR_DISTR* DISTRIBUTION) + Get pointer to distribution object for underlying distribution. + +4.7 Continuous empirical multivariate distributions +=================================================== + +Empirical multivariate distributions are just lists of vectors (with the same +dimension). Thus there are only calls to insert these data. How these data are +used to sample from the empirical distribution depends from the chosen +generation method. + +Function reference +------------------ + + -- Function: UNUR_DISTR* unur_distr_cvemp_new (int DIM) + Create a new (empty) object for an empirical multivariate continuous + distribution. DIM is the number of components of the random vector (i.e. + its dimension). It must be at least 2; otherwise ‘unur_distr_cemp_new’ + should be used to create an object for an empirical univariate + distribution. + +Essential parameters +.................... + + -- Function: int unur_distr_cvemp_set_data (UNUR_DISTR* DISTRIBUTION, const + DOUBLE* SAMPLE, int N_SAMPLE) + Set observed sample for empirical DISTRIBUTION. SAMPLE is an array of + doubles of size ‘dim’ x N_SAMPLE, where ‘dim’ is the dimension of the + DISTRIBUTION returned by ‘unur_distr_get_dim’. The data points must be + stored consecutively in SAMPLE, i.e., data points (x1, y1), (x2, y2), ... + are given as an array {x1, y1, x2, y2, ...}. + + -- Function: int unur_distr_cvemp_read_data (UNUR_DISTR* DISTRIBUTION, const + CHAR* FILENAME) + Read data from file ‘filename’. It reads the first ‘dim’ numbers from each + line, where ‘dim’ is the dimension of the DISTRIBUTION returned by + ‘unur_distr_get_dim’. Numbers are parsed by means of the C standard + routine ‘strtod’. Lines that do not start with ‘+’, ‘-’, ‘.’, or a digit + are ignored. (Beware of lines starting with a blank!) + + In case of an error (file cannot be opened, too few entries in a line, + invalid string for double in line) no data are copied into the distribution + object and an error code is returned. + + -- Function: int unur_distr_cvemp_get_data (const UNUR_DISTR* DISTRIBUTION, + const DOUBLE** SAMPLE) + Get number of samples and set pointer SAMPLE to array of observations. If + no sample has been given, an error code is returned and SAMPLE is set to + ‘NULL’. If successful SAMPLE points to an array of length ‘dim’ x + ‘n_sample’, where ‘dim’ is the dimension of the distribution returned by + ‘unur_distr_get_dim’ and ‘n_sample’ the return value of the function. + + _Important:_ Do *not* modify the array SAMPLE. + +4.8 MATRix distributions +======================== + +Distributions for random matrices. Notice that UNU.RAN uses arrays of ‘double’s +to handle matrices. The rows of the matrix are stored consecutively. + +Function reference +------------------ + + -- Function: UNUR_DISTR* unur_distr_matr_new (int N_ROWS, int N_COLS) + Create a new (empty) object for a matrix distribution. N_ROWS and N_COLS + are the respective numbers of rows and columns of the random matrix (i.e. + its dimensions). It is also possible to have only one number or rows + and/or columns. Notice, however, that this is treated as a distribution of + random matrices with only one row or column or component and not as a + distribution of vectors or real numbers. For the latter + ‘unur_distr_cont_new’ or ‘unur_distr_cvec_new’ should be used to create an + object for a univariate distribution and a multivariate (vector) + distribution, respectively. + +Essential parameters +.................... + + -- Function: int unur_distr_matr_get_dim (const UNUR_DISTR* DISTRIBUTION, int* + N_ROWS, int* N_COLS) + Get number of rows and columns of random matrix (its dimension). It + returns the total number of components. If successfull ‘UNUR_SUCCESS’ is + returned. + +4.9 Discrete univariate distributions +===================================== + +The calls in this section can be applied to discrete univariate distributions. + + − Create a ‘new’ instance of a discrete univariate distribution. + + − Handle and evaluate distribution function (CDF, ‘cdf’) and probability mass + function (PMF, ‘pmf’). The following is important: + . ‘pmf’ need not be normalized, i.e., any summable nonnegative function + on the set of intergers can be used. + . ‘cdf’ must be a distribution function, i.e. it must be monotonically + increasing with range [0,1]. + . If ‘cdf’ and ‘pdf’ are used together for a pariticular generation + method, then ‘pmf’ must be normalized, i.e. it must sum to 1. + + − Alternatively, ‘cdf’ and ‘pdf’ can be provided as ‘str’ings instead of + function pointers. + + − Some generation methods require a (finite) probability vector (PV, ‘pv’), + i.e. an array of ‘double’s. It can be automatically computed if the ‘pmf’ + is given but ‘pv’ is not. + + − Set (and change) parameters (‘pmfparams’) and the total sum (‘pmfsum’) of + the given PMF or PV. + + − Set the ‘mode’ of the distribution. + + − Set the ‘domain’ of the distribution. + +Function reference +------------------ + + -- Function: UNUR_DISTR* unur_distr_discr_new (void) + Create a new (empty) object for a univariate discrete distribution. + +Essential parameters +.................... + +There are two interfaces for discrete univariate distributions: Either provide a +(finite) probability vector (PV). Or provide a probability mass function (PMF). +For the latter case there are also a couple of derived parameters that are not +required when a PV is given. + + It is not possible to set both a PMF and a PV directly. However, the PV can +be computed from the PMF (or the CDF if no PMF is available) by means of a +‘unur_distr_discr_make_pv’ call. If both the PV and the PMF are given in the +distribution object it depends on the generation method which of these is used. + + -- Function: int unur_distr_discr_set_pv (UNUR_DISTR* DISTRIBUTION, const + DOUBLE* PV, int N_PV) + Set finite probability vector (PV) for the DISTRIBUTION. It is not + necessary that the entries in the given PV sum to 1. N_PV must be + positive. However, there is no testing whether all entries in PV are + non-negative. + + If no domain has been set, then the left boundary is set to ‘0’, by + default. If N_PV is too large, e.g. because left boundary + N_PV exceeds + the range of integers, then the call fails. + + Notice that it is not possible to set both a PV and a PMF or CDF. If the + PMF or CDF is set first one cannot set the PV. If the PMF or CDF is set + first after a PV is set, the latter is removed (and recomputed using + ‘unur_distr_discr_make_pv’ when required). + + -- Function: int unur_distr_discr_make_pv (UNUR_DISTR* DISTRIBUTION) + Compute a PV when a PMF or CDF is given. However, when the domain is not + given or is too large and the sum over the PMF is given then the (right) + tail of the DISTRIBUTION is chopped off such that the probability for the + tail region is less than 1.e-8. If the sum over the PMF is not given a PV + of maximal length is computed. + + The maximal size of the created PV is bounded by the macro + ‘UNUR_MAX_AUTO_PV’ that is defined in ‘unuran_config.h’. + + If successful, the length of the generated PV is returned. If the sum over + the PMF on the chopped tail is not neglible small (i.e. greater than 1.e-8 + or unknown) than the negative of the length of the PV is returned and + ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. + + Notice that the left boundary of the PV is set to ‘0’ by default when a + discrete distribution object is created from scratch. + + If computing a PV fails for some reasons, an error code is returned and + ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. + + -- Function: int unur_distr_discr_get_pv (const UNUR_DISTR* DISTRIBUTION, const + DOUBLE** PV) + Get length of PV of the DISTRIBUTION and set pointer PV to array of + probabilities. If no PV is given, an error code is returned and PV is set + to ‘NULL’. + (It does not call ‘unur_distr_discr_make_pv’ !) + + -- Function: int unur_distr_discr_set_pmf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_DISCR* PMF) + -- Function: int unur_distr_discr_set_cdf (UNUR_DISTR* DISTRIBUTION, + UNUR_FUNCT_DISCR* CDF) + Set respective pointer to the PMF and the CDF of the DISTRIBUTION. These + functions must be of type ‘double funct(int k, const UNUR_DISTR *distr)’. + + It is important to note that all these functions must return a result for + all integers K. E.g., if the domain of a given PMF is the interval + {1,2,3,...,100}, than the given function must return ‘0.0’ for all points + outside this interval. + + The default domain for the PMF or CDF is [‘0’, ‘INT_MAX’]. The domain can + be changed using a ‘unur_distr_discr_set_domain’ call. + + It is not possible to change such a function. Once the PMF or CDF is set + it cannot be overwritten. A new distribution object has to be used + instead. + + Notice that it is not possible to set both a PV and a PMF or CDF. If the + PMF or CDF is set first one cannot set the PV. If the PMF or CDF is set + first after a PV is set, the latter is removed (and recomputed using + ‘unur_distr_discr_make_pv’ when required). + + -- Function: int unur_distr_discr_set_invcdf (UNUR_DISTR* DISTRIBUTION, + UNUR_IFUNCT_DISCR* INVCDF) + Set inverse CDF of the DISTRIBUTION. INVCDF must be a pointer must be of + type ‘int funct(double x, const UNUR_DISTR *distr)’, i.e., it should return + a ‘double’. + + -- Function: double unur_distr_discr_eval_pv (int K, const UNUR_DISTR* + DISTRIBUTION) + -- Function: double unur_distr_discr_eval_pmf (int K, const UNUR_DISTR* + DISTRIBUTION) + -- Function: double unur_distr_discr_eval_cdf (int K, const UNUR_DISTR* + DISTRIBUTION) + Evaluate the PV, PMF, and the CDF, respectively, at k. Notice that + DISTRIBUTION must not be the ‘NULL’ pointer. If no PV is set for the + DISTRIBUTION, then ‘unur_distr_discr_eval_pv’ behaves like + ‘unur_distr_discr_eval_pmf’. If the corresponding function is not + available for the DISTRIBUTION, ‘UNUR_INFINITY’ is returned and + ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. + + _IMPORTANT:_ In the case of a truncated standard distribution these calls + always return the respective values of the _untruncated_ distribution! + + -- Function: int unur_distr_discr_eval_invcdf (double U, const UNUR_DISTR* + DISTRIBUTION) + Evaluate the inverse CDF at U. Notice that DISTRIBUTION must not be the + ‘NULL’ pointer. If the corresponding function is not available for the + distribution, ‘INT_MAX’ is returned and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_DATA’. + + _IMPORTANT:_ In the case of a truncated standard distribution these calls + always return the respective values of the _untruncated_ distribution! + + -- Function: int unur_distr_discr_set_pmfstr (UNUR_DISTR* DISTRIBUTION, const + CHAR* PMFSTR) + This function provides an alternative way to set a PMF of the DISTRIBUTION. + PMFSTR is a character string that contains the formula for the PMF, see + *note Function String: StringFunct, for details. See also the remarks for + the ‘unur_distr_discr_set_pmf’ call. + + It is not possible to call this funtion twice or to call this function + after a ‘unur_distr_discr_set_pmf’ call. + + -- Function: int unur_distr_discr_set_cdfstr (UNUR_DISTR* DISTRIBUTION, const + CHAR* CDFSTR) + This function provides an alternative way to set a CDF; analogously to the + ‘unur_distr_discr_set_pmfstr’ call. + + -- Function: char* unur_distr_discr_get_pmfstr (const UNUR_DISTR* DISTRIBUTION) + -- Function: char* unur_distr_discr_get_cdfstr (const UNUR_DISTR* DISTRIBUTION) + Get pointer to respective string for PMF and CDF of DISTRIBUTION that is + given via the string interface. This call allocates memory to produce this + string. It should be freed when it is not used any more. + + -- Function: int unur_distr_discr_set_pmfparams (UNUR_DISTR* DISTRIBUTION, + const DOUBLE* PARAMS, int N_PARAMS) + Set array of parameters for DISTRIBUTION. There is an upper limit for the + number of parameters N_PARAMS. It is given by the macro + ‘UNUR_DISTR_MAXPARAMS’ in ‘unuran_config.h’. (It is set to 5 but can be + changed to any appropriate nonnegative number.) If N_PARAMS is negative or + exceeds this limit no parameters are copied into the DISTRIBUTION object + and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_NPARAMS’. + + For standard distributions from the UNU.RAN library the parameters are + checked. Moreover, the domain is updated automatically unless it has been + changed before by a ‘unur_distr_discr_set_domain’ call. If the given + parameters are invalid for the standard distribution, then no parameters + are set and an error code is returned. Notice that the given parameter + list for such a distribution is handled in the same way as in the + corresponding ‘new’ calls, i.e. optional parameters for the PDF that are + not present in the given list are (re-)set to their default values. + + _Important:_ Integer parameter must be given as ‘double’s. + + -- Function: int unur_distr_discr_get_pmfparams (const UNUR_DISTR* + DISTRIBUTION, const DOUBLE** PARAMS) + Get number of parameters of the PMF and set pointer PARAMS to array of + parameters. If no parameters are stored in the object, an error code is + returned and ‘params’ is set to ‘NULL’. + + -- Function: int unur_distr_discr_set_domain (UNUR_DISTR* DISTRIBUTION, int + LEFT, int RIGHT) + Set the left and right borders of the domain of the DISTRIBUTION. This can + also be used to truncate an existing distribution. For setting the + boundary to +/- infinity use ‘INT_MIN’ and ‘INT_MAX’, respectively. If + RIGHT is not strictly greater than LEFT no domain is set and ‘unur_errno’ + is set to ‘UNUR_ERR_DISTR_SET’. It is allowed to use this call to increase + the domain. If the PV of the discrete distribution is used, than the right + boudary is ignored (and internally set to LEFT + size of PV - 1). Notice + that ‘INT_MIN’ and ‘INT_MAX’ are interpreted as (minus/plus) infinity. + + Default: [‘0’, ‘INT_MAX’]. + + -- Function: int unur_distr_discr_get_domain (const UNUR_DISTR* DISTRIBUTION, + int* LEFT, int* RIGHT) + Get the left and right borders of the domain of the DISTRIBUTION. If the + domain is not set explicitly the interval [‘INT_MIN’, ‘INT_MAX’] is assumed + and returned. When a PV is given then the domain is set automatically to + [‘0’,size of PV - 1]. + +Derived parameters +.................. + +The following paramters *must* be set whenever one of the essential parameters +has been set or changed (and the parameter is required for the chosen method). + + -- Function: int unur_distr_discr_set_mode (UNUR_DISTR* DISTRIBUTION, int MODE) + Set mode of DISTRIBUTION. + + -- Function: int unur_distr_discr_upd_mode (UNUR_DISTR* DISTRIBUTION) + Recompute the mode of the DISTRIBUTION. This call works properly for + distribution objects from the UNU.RAN library of standard distributions + when the corresponding function is available. Otherwise a (slow) numerical + mode finder is used. It only works properly for unimodal probability mass + functions. If it failes ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. + + -- Function: int unur_distr_discr_get_mode (UNUR_DISTR* DISTRIBUTION) + Get mode of DISTRIBUTION. If the mode is not marked as known, + ‘unur_distr_discr_upd_mode’ is called to compute the mode. If this is not + successful ‘INT_MAX’ is returned and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_GET’. (There is no difference between the case where no + routine for computing the mode is available and the case where no mode + exists for the distribution at all.) + + -- Function: int unur_distr_discr_set_pmfsum (UNUR_DISTR* DISTRIBUTION, double + SUM) + Set the sum over the PMF. If ‘sum’ is non-positive, no sum is set and + ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. + + For a distribution object created by the UNU.RAN library of standard + distributions you always should use the ‘unur_distr_discr_upd_pmfsum’. + Otherwise there might be ambiguous side-effects. + + -- Function: int unur_distr_discr_upd_pmfsum (UNUR_DISTR* DISTRIBUTION) + Recompute the sum over the PMF of the DISTRIBUTION. In most cases the + normalization constant is recomputed and thus the sum is 1. This call + works for distribution objects from the UNU.RAN library of standard + distributions when the corresponding function is available. When a PV, a + PMF with finite domain, or a CDF is given, a simple generic function which + uses a naive summation loop is used. If this computation is not possible, + an error code is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. + + The call does not work for distributions from the UNU.RAN library of + standard distributions with truncated domain when the CDF is not available. + + -- Function: double unur_distr_discr_get_pmfsum (UNUR_DISTR* DISTRIBUTION) + Get the sum over the PMF of the DISTRIBUTION. If this sum is not known, + ‘unur_distr_discr_upd_pmfsum’ is called to compute it. If this is not + successful ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to + ‘UNUR_ERR_DISTR_GET’. + +5 Methods for generating non-uniform random variates +**************************************************** + +Sampling from a particular distribution with UNU.RAN requires the following +steps: + + 1. Create a distribution object (*note Handling distribution objects: + Distribution_objects.). + + 2. Select a method and create a parameter object. + + 3. Initizialize the generator object using ‘unur_init’. _Important_: + Initialization of the generator object might fail. ‘unur_init’ returns a + ‘NULL’ pointer then, which *must* not be used for sampling. + + 4. Draw a sample from the generator object using the corresponding sampling + function (depending on the type of distribution: univariate continuous, + univariate discrete, multivariate continuous, and random matrix). + + 5. It is possible for a generator object to change the parameters and the + domain of the underlying distribution. This must be done by extracting + this object by means of a ‘unur_get_distr’ call and changing the + distribution using the correspondig set calls, see *note Handling + distribution objects: Distribution_objects. The generator object *must* + then be reinitialized by means of the ‘unur_reinit’ call. + + _Important_: Currently not all methods allow reinitialization, see the + description of the particular method (keyword Reinit). + + _Important_: Reinitialization of the generator object might fail. Thus one + *must* check the return code of the ‘unur_reinit’ call. + + _Important_: When reinitialization fails then sampling routines always + return ‘UNUR_INFINITY’ (for continuous distributions) or ‘0’ (for discrete + distributions), respectively. However, it is still possible to change the + underlying distribution and try to reinitialize again. + +5.1 Routines for all generator objects +====================================== + +Routines for all generator objects. + +Function reference +------------------ + + -- Function: UNUR_GEN* unur_init (UNUR_PAR* PARAMETERS) + Initialize a generator object. All necessary information must be stored in + the parameter object. + + *Important:* If an error has occurred a ‘NULL’ pointer is return. This + must not be used for the sampling routines (this causes a segmentation + fault). + + *Always* check whether the call was successful or not! + + _Important:_ This call destroys the PARAMETER object automatically. Thus + it is not necessary/allowed to free it. + + -- Function: int unur_reinit (UNUR_GEN* GENERATOR) + Update an existing generator object after the underlying distribution has + been modified (using ‘unur_get_distr’ together with corresponding set + calls. It *must* be executed before sampling using this generator object + is continued as otherwise it produces an invalid sample or might even cause + a segmentation fault. + + _Important_: Currently not all methods allow reinitialization, see the + description of the particular method (keyword Reinit). + + _Important_: Reinitialization of the generator object might fail. Thus one + *must* check the return code: + + ‘UNUR_SUCCESS (0x0u)’ + success (no error) + ‘UNUR_ERR_NO_REINIT’ + reinit routine not implemented. + other values + some error has occured while trying to reinitialize the generator + object. + + _Important_: When reinitialization fails then sampling routines always + return ‘UNUR_INFINITY’ (for continuous distributions) or ‘0’ (for discrete + distributions), respectively. However, it is still possible to change the + underlying distribution and try to reinitialize again. + + _Important_: When one tries to run ‘unur_reinit’, but reinitialization is + not implemented, then the generator object cannot be used any more and must + be destroyed and a new one has to be built from scratch. + + -- Function: int unur_sample_discr (UNUR_GEN* GENERATOR) + -- Function: double unur_sample_cont (UNUR_GEN* GENERATOR) + -- Function: int unur_sample_vec (UNUR_GEN* GENERATOR, double* VECTOR) + -- Function: int unur_sample_matr (UNUR_GEN* GENERATOR, double* MATRIX) + Sample from generator object. The three routines depend on the type of the + generator object (discrete or continuous univariate distribution, + multivariate distribution, or random matrix). + + _Notice:_ UNU.RAN uses arrays of ‘double’s to handle matrices. There the + rows of the matrix are stored consecutively. + + _Notice:_ The routines ‘unur_sample_vec’ and ‘unur_sample_matr’ return + ‘UNUR_SUCCESS’ if generation was successful and some error code otherwise. + + *Important:* These routines do *not* check whether GENERATOR is an invalid + ‘NULL’ pointer. + + -- Function: double unur_quantile (UNUR_GEN* GENERATOR, double U) + Compute the U quantile of a continuous distribution using a GENERATOR + object that implements an (approximate) inversion methods. + + The following methods are currently available: + • HINV, *note HINV::. + • NINV, *note NINV::. + • PINV, *note PINV::. + • CSTD, *note CSTD::. + This requires that GENERATOR implements an inversion method. + • DGT, *note DGT::. + The return value is (of course) type casted to ‘double’. + + *Important:* This routine does *not* check whether GENERATOR is an invalid + ‘NULL’ pointer. + + In case of an error UNUR_INFINITY or INT_MAX (depending on the type of + GENERATOR) is returned. + + -- Function: void unur_free (UNUR_GEN* GENERATOR) + Destroy (free) the given generator object. + + -- Function: const char* unur_gen_info (UNUR_GEN* GENERATOR, int HELP) + Get a string with informations about the given GENERATOR. These + informations allow some fine tuning of the generation method. If HELP is + ‘TRUE’, some hints on setting parameters are given. + + This function is intented for using in interactive environments (like R). + + If an error occurs, then ‘NULL’ is returned. + + -- Function: int unur_get_dimension (const UNUR_GEN* GENERATOR) + Get the number of dimension of a (multivariate) distribution. For a + univariate distribution ‘1’ is return. + + -- Function: const char* unur_get_genid (const UNUR_GEN* GENERATOR) + Get identifier string for generator. + + -- Function: unsigned int unur_get_method (const UNUR_GEN* GENERATOR) + Get identifier for generating method. These identifiers are declared in + ‘src/methods/unur_metthods.h’. + + -- Function: int unur_gen_is_inversion (const UNUR_GEN* GEN) + Return ‘TRUE’ if the generator object implements an inversion method, and + ‘FALSE’ otherwise. + + -- Function: UNUR_DISTR* unur_get_distr (const UNUR_GEN* GENERATOR) + Get pointer to distribution object from generator object. This function + can be used to change the parameters of the distribution and reinitialize + the generator object. Notice that currently *not all* generating methods + have a reinitialize routine. This function should be used with extreme + care. Changing the distribution is changed and using the generator object + without reinitializing might cause wrong samples or segmentation faults. + Moreover, if the corresponding generator object is freed, the pointer must + not be used. + + *Important:* The returned distribution object must not be freed. If the + distribution object is changed then one *must* run ‘unur_reinit’ ! + + -- Function: int unur_set_use_distr_privatecopy (UNUR_PAR* PARAMETERS, int + USE_PRIVATECOPY) + Set flag whether the generator object should make a private copy of the + given distribution object or just stores the pointer to this distribution + object. Values for USE_PRIVATECOPY: + ‘TRUE’ + make a private copy (default) + ‘FALSE’ + do not make a private copy and store pointer to given (external) + distribution object. + + By default, generator objects keep their own private copy of the given + distribution object. Thus the generator object can be handled + independently from other UNU.RAN objects (with uniform random number + generators as the only exception). When the generator object is + initialized the given distribution object is cloned and stored. + + However, in some rare situations it can be useful when only the pointer to + the given distribution object is stored without making a private copy. A + possible example is when only one random variate has to be drawn from the + distribution. This behavior can be achieved when USE_LOCALCOPY is set to + ‘FALSE’. + + *Warning!* Using a pointer to the external distribution object instead of + a private copy must be done with *extreme care*! When the distrubtion + object is changed or freed then the generator object does not work any + more, might case a segmentation fault, or (even worse) produces garbage. + On the other hand, when the generator object is initialized or used to draw + a random sampling the distribution object may be changed. + + _Notice:_ The prototypes of all ‘unur__new’ calls use a ‘const’ + qualifier for the distribution argument. However, if USE_PRIVATECOPY is + set to ‘FALSE’ this qualifier is discarded and the distribution might be + changed. + + *Important!* If USE_LOCALCOPY is set to ‘FALSE’ and the corresponding + distribution object is changed then one must run ‘unur_reinit’ on the + generator object. (Notice that currently not all generation methods + support reinitialization.) + + Default: USE_PRIVATECOPY is ‘TRUE’. + +5.2 AUTO – Select method automatically +====================================== + +AUTO selects a an appropriate method for the given distribution object +automatically. There are no parameters for this method, yet. But it is planned +to give some parameter to describe the task for which the random variate +generator is used for and thus make the choice of the generating method more +appropriate. Notice that the required sampling routine for the generator object +depends on the type of the given distribution object. + + The chosen method also depends on the sample size for which the generator +object will be used. If only a few random variates the order of magnitude of +the sample size should be set via a ‘unur_auto_set_logss’ call. + + IMPORTANT: This is an experimental version and the method chosen may change +in future releases of UNU.RAN. + + For an example see *note As short as possible: Example_0. + +How To Use +.......... + +Create a generator object for the given distribution object. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_auto_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_auto_set_logss (UNUR_PAR* PARAMETERS, int LOGSS) + Set the order of magnitude for the size of the sample that will be + generated by the generator, i.e., the the common logarithm of the sample + size. + + Default is 10. + + Notice: This feature will be used in future releases of UNU.RAN only. + +5.3 Methods for continuous univariate distributions +=================================================== + +Overview of methods +------------------- + +Methods for continuous univariate distributions +sample with ‘unur_sample_cont’ + +method PDF dPDF CDF mode area other +AROU x x [x] T-concave +ARS x x T-concave +CEXT wrapper for external generator +CSTD build-in standard distribution +HINV [x] [x] x +HRB bounded hazard rate +HRD decreasing hazard rate +HRI increasing hazard rate +ITDR x x x monotone with pole +NINV [x] x +NROU x [x] +PINV x [x] [~] +SROU x x x T-concave +SSR x x x T-concave +TABL x x [~] all local extrema +TDR x x T-concave +UTDR x x ~ T-concave + +Example +------- + + /* ------------------------------------------------------------- */ + /* File: example_cont.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* Example how to sample from a continuous univariate */ + /* distribution. */ + /* */ + /* We build a distribution object from scratch and sample. */ + + /* ------------------------------------------------------------- */ + + /* Define the PDF and dPDF of our distribution. */ + /* */ + /* Our distribution has the PDF */ + /* */ + /* / 1 - x*x if |x| <= 1 */ + /* f(x) = < */ + /* \ 0 otherwise */ + /* */ + + /* The PDF of our distribution: */ + double mypdf( double x, const UNUR_DISTR *distr ) + /* The second argument (`distr') can be used for parameters */ + /* for the PDF. (We do not use parameters in our example.) */ + { + if (fabs(x) >= 1.) + return 0.; + else + return (1.-x*x); + } /* end of mypdf() */ + + /* The derivative of the PDF of our distribution: */ + double mydpdf( double x, const UNUR_DISTR *distr ) + { + if (fabs(x) >= 1.) + return 0.; + else + return (-2.*x); + } /* end of mydpdf() */ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create a new distribution object from scratch. */ + + /* Get empty distribution object for a continuous distribution */ + distr = unur_distr_cont_new(); + + /* Fill the distribution object -- the provided information */ + /* must fulfill the requirements of the method choosen below. */ + unur_distr_cont_set_pdf(distr, mypdf); /* PDF */ + unur_distr_cont_set_dpdf(distr, mydpdf); /* its derivative */ + unur_distr_cont_set_mode(distr, 0.); /* mode */ + unur_distr_cont_set_domain(distr, -1., 1.); /* domain */ + + /* Choose a method: TDR. */ + par = unur_tdr_new(distr); + + /* Set some parameters of the method TDR. */ + unur_tdr_set_variant_gw(par); + unur_tdr_set_max_sqhratio(par, 0.90); + unur_tdr_set_c(par, -0.5); + unur_tdr_set_max_intervals(par, 100); + unur_tdr_set_cpoints(par, 10, NULL); + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + +Example (String API) +-------------------- + + /* ------------------------------------------------------------- */ + /* File: example_cont_str.c */ + /* ------------------------------------------------------------- */ + /* String API. */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* Example how to sample from a continuous univariate */ + /* distribution. */ + + /* We use a generic distribution object and sample. */ + /* */ + /* The PDF of our distribution is given by */ + /* */ + /* / 1 - x*x if |x| <= 1 */ + /* f(x) = < */ + /* \ 0 otherwise */ + /* */ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a generic continuous distribution. */ + /* Choose a method: TDR. */ + gen = unur_str2gen( + "distr = cont; pdf=\"1-x*x\"; domain=(-1,1); mode=0. & \ + method=tdr; variant_gw; max_sqhratio=0.90; c=-0.5; \ + max_intervals=100; cpoints=10"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + +5.3.1 AROU – Automatic Ratio-Of-Uniforms method +----------------------------------------------- + +Required: + T-concave PDF, dPDF +Optional: + mode +Speed: + Set-up: slow, Sampling: fast +Reinit: + not implemented +Reference: + [LJa00] + + AROU is a variant of the ratio-of-uniforms method that uses the fact that the +transformed region is convex for many distributions. It works for all T-concave +distributions with T(x) = -1/sqrt(x). + + It is possible to use this method for correlation induction by setting an +auxiliary uniform random number generator via the ‘unur_set_urng_aux’ call. +(Notice that this must be done after a possible ‘unur_set_urng’ call.) When an +auxiliary generator is used then the number of used uniform random numbers that +is used up for one generated random variate is constant and equal to 1. + + There exists a test mode that verifies whether the conditions for the method +are satisfied or not while sampling. It can be switched on by calling +‘unur_arou_set_verify’ and ‘unur_arou_chg_verify’, respectively. Notice however +that sampling is (much) slower then. + + For densities with modes not close to 0 it is suggested to set either the +mode or the center of the distribution by the ‘unur_distr_cont_set_mode’ or +‘unur_distr_cont_set_center’ call. The latter is the approximate location of +the mode or the mean of the distribution. This location provides some +information about the main part of the PDF and is used to avoid numerical +problems. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_arou_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_arou_set_usedars (UNUR_PAR* PARAMETERS, int USEDARS) + If USEDARS is set to ‘TRUE’, “derandomized adaptive rejection sampling” + (DARS) is used in setup. Segments where the area between hat and squeeze + is too large compared to the average area between hat and squeeze over all + intervals are split. This procedure is repeated until the ratio between + area below squeeze and area below hat exceeds the bound given by + ‘unur_arou_set_max_sqhratio’ call or the maximum number of segments is + reached. Moreover, it also aborts when no more segments can be found for + splitting. + + Segments are split such that the angle of the segments are halved + (corresponds to arc-mean rule of method TDR (*note TDR::)). + + Default is ‘TRUE’. + + -- Function: int unur_arou_set_darsfactor (UNUR_PAR* PARAMETERS, double FACTOR) + Set factor for “derandomized adaptive rejection sampling”. This factor is + used to determine the segments that are “too large”, that is, all segments + where the area between squeeze and hat is larger than FACTOR times the + average area over all intervals between squeeze and hat. Notice that all + segments are split when FACTOR is set to ‘0.’, and that there is no + splitting at all when FACTOR is set to ‘UNUR_INFINITY’. + + Default is ‘0.99’. There is no need to change this parameter. + + -- Function: int unur_arou_set_max_sqhratio (UNUR_PAR* PARAMETERS, double + MAX_RATIO) + Set upper bound for the ratio (area inside squeeze) / (area inside + envelope). It must be a number between 0 and 1. When the ratio exceeds + the given number no further construction points are inserted via adaptive + rejection sampling. Use ‘0’ if no construction points should be added + after the setup. Use ‘1’ if adding new construction points should not be + stopped until the maximum number of construction points is reached. + + Default is ‘0.99’. + + -- Function: double unur_arou_get_sqhratio (const UNUR_GEN* GENERATOR) + Get the current ratio (area inside squeeze) / (area inside envelope) for + the generator. (In case of an error ‘UNUR_INFINITY’ is returned.) + + -- Function: double unur_arou_get_hatarea (const UNUR_GEN* GENERATOR) + Get the area below the hat for the generator. (In case of an error + ‘UNUR_INFINITY’ is returned.) + + -- Function: double unur_arou_get_squeezearea (const UNUR_GEN* GENERATOR) + Get the area below the squeeze for the generator. (In case of an error + ‘UNUR_INFINITY’ is returned.) + + -- Function: int unur_arou_set_max_segments (UNUR_PAR* PARAMETERS, int + MAX_SEGS) + Set maximum number of segements. No construction points are added _after_ + the setup when the number of segments succeeds MAX_SEGS. + + Default is ‘100’. + + -- Function: int unur_arou_set_cpoints (UNUR_PAR* PARAMETERS, int N_STP, const + DOUBLE* STP) + Set construction points for enveloping polygon. If STP is ‘NULL’, then a + heuristical rule of thumb is used to get N_STP construction points. This + is the default behavior when this routine is not called. The (default) + number of construction points is ‘30’, then. + + -- Function: int unur_arou_set_usecenter (UNUR_PAR* PARAMETERS, int USECENTER) + Use the center as construction point. Default is ‘TRUE’. + + -- Function: int unur_arou_set_guidefactor (UNUR_PAR* PARAMETERS, double + FACTOR) + Set factor for relative size of the guide table for indexed search (see + also method DGT *note DGT::). It must be greater than or equal to ‘0’. + When set to ‘0’, then sequential search is used. + + Default is ‘2’. + + -- Function: int unur_arou_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) + -- Function: int unur_arou_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the condition + squeeze(x) <= PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is + set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due + to round-off errors for a few values of x (less than 1%). + + Default is ‘FALSE’. + + -- Function: int unur_arou_set_pedantic (UNUR_PAR* PARAMETERS, int PEDANTIC) + Sometimes it might happen that ‘unur_init’ has been executed successfully. + But when additional construction points are added by adaptive rejection + sampling, the algorithm detects that the PDF is not T-concave. + + With PEDANTIC being ‘TRUE’, the sampling routine is then exchanged by a + routine that simply returns ‘UNUR_INFINITY’. Otherwise the new point is + not added to the list of construction points. At least the hat function + remains T-concave. + + Setting PEDANTIC to ‘FALSE’ allows sampling from a distribution which is + “almost” T-concave and small errors are tolerated. However it might happen + that the hat function cannot be improved significantly. When the hat + function that has been constructed by the ‘unur_init’ call is extremely + large then it might happen that the generation times are extremely high + (even hours are possible in extremely rare cases). + + Default is ‘FALSE’. + +5.3.2 ARS – Adaptive Rejection Sampling +--------------------------------------- + +Required: + concave logPDF, derivative of logPDF +Optional: + mode +Speed: + Set-up: fast, Sampling: slow +Reinit: + supported +Reference: + [GWa92] [HLD04: Cha.4] + + ARS is an acceptance/rejection method that uses the concavity of the +log-density function to construct hat function and squeezes automatically. It +is very similar to method TDR (*note TDR::) with variant GW, parameter ‘c = 0’, +and DARS switched off. Moreover, method ARS requires the logPDF and its +derivative dlogPDF to run. On the other hand, it is designed to draw only a +(very) small samples and it is much more robust against densities with very +large or small areas below the PDF as it occurs, for example, in conditional +distributions of (high dimensional) multivariate distributions. Additionally, +it can be re-initialized when the underlying distribution has been modified. +Thus it is well suited for Gibbs sampling. + + Notice, that method ARS is a restricted version of TDR. If the full +functionally of Transformed Density Rejection is needed use method *note TDR::. + +How To Use +.......... + +Method ARS is designed for distributions with log-concave densities. To use +this method you need a distribution object with the logarithm of the PDF and its +derivative given. + + The number of construction points as well as a set of such points can be +provided using ‘unur_ars_set_cpoints’. Notice that addition construction points +are added by means of adaptive rejection sampling until the maximal number of +intervals given by ‘unur_ars_set_max_intervals’ is reached. + + A generated distribution object can be reinitialized using the ‘unur_reinit’ +call. When ‘unur_reinit’ is called construction points for the new generator +are necessary. There are two options: Either the same construction points as +for the initial generator (given by a ‘unur_ars_set_cpoints’ call) are used +(this is the default), or percentiles of the old hat function can be used. This +can be set or changed using ‘unur_ars_set_reinit_percentiles’ and +‘unur_ars_chg_reinit_percentiles’. This feature is usefull when the underlying +distribution object is only moderately changed. (An example is Gibbs sampling +with small correlations.) + + There exists a test mode that verifies whether the conditions for the method +are satisfied or not. It can be switched on by calling ‘unur_ars_set_verify’ +and ‘unur_ars_chg_verify’, respectively. Notice however that sampling is (much) +slower then. + + Method ARS aborts after a given number of iterations and return UNUR_INFINITY +to prevent (almost) infinite loops. This might happen when the starting hat is +much too large and it is not possible to insert new construction points due to +severe numerical errors or (more likely) the given PDF is not log-concave. This +maximum number of iterations can be set by means of a ‘unur_ars_set_max_iter’ +call. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_ars_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_ars_set_max_intervals (UNUR_PAR* PARAMETERS, int MAX_IVS) + Set maximum number of intervals. No construction points are added after + the setup when the number of intervals suceeds MAX_IVS. It is increased + automatically to twice the number of construction points if this is larger. + + Default is ‘200’. + + -- Function: int unur_ars_set_cpoints (UNUR_PAR* PARAMETERS, int N_CPOINTS, + const DOUBLE* CPOINTS) + Set construction points for the hat function. If CPOINTS is ‘NULL’ then a + heuristic rule of thumb is used to get N_CPOINTS construction points. This + is the default behavior. N_CPOINTS should be at least ‘2’, otherwise + defaults are used. + + The default number of construction points is 2. + + -- Function: int unur_ars_set_reinit_percentiles (UNUR_PAR* PARAMETERS, int + N_PERCENTILES, const DOUBLE* PERCENTILES) + -- Function: int unur_ars_chg_reinit_percentiles (UNUR_GEN* GENERATOR, int + N_PERCENTILES, const DOUBLE* PERCENTILES) + By default, when the GENERATOR object is reinitialized, it used the same + construction points as for the initialization procedure. Often the + underlying distribution object has been changed only moderately. For + example, the full conditional distribution of a multivariate distribution. + In this case it might be more appropriate to use percentilesm of the hat + function for the last (unchanged) distribution. PERCENTILES must then be a + pointer to an ordered array of numbers between ‘0.01’ and ‘0.99’. If + PERCENTILES is ‘NULL’, then a heuristic rule of thumb is used to get + N_PERCENTILES values for these percentiles. Notice that N_PERCENTILES must + be at least ‘2’, otherwise defaults are used. (Then the first and third + quartiles are used by default.) + + -- Function: int unur_ars_set_reinit_ncpoints (UNUR_PAR* PARAMETERS, int + NCPOINTS) + -- Function: int unur_ars_chg_reinit_ncpoints (UNUR_GEN* GENERATOR, int + NCPOINTS) + When reinit fails with the given construction points or the percentiles of + the old hat function, another trial is undertaken with NCPOINTS + construction points. NCPOINTS must be at least ‘10’. + + Default: ‘30’ + + -- Function: int unur_ars_set_max_iter (UNUR_PAR* PARAMETERS, int MAX_ITER) + The rejection loop stops after MAX_ITER iterations and return + UNUR_INFINITY. + + Default: ‘10000’ + + -- Function: int unur_ars_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) + -- Function: int unur_ars_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the condition + squeeze(x) <= PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is + set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due + to round-off errors for a few values of x (less than 1%). + + Default is ‘FALSE’. + + -- Function: int unur_ars_set_pedantic (UNUR_PAR* PARAMETERS, int PEDANTIC) + Sometimes it might happen that ‘unur_init’ has been executed successfully. + But when additional construction points are added by adaptive rejection + sampling, the algorithm detects that the PDF is not log-concave. + + With PEDANTIC being ‘TRUE’, the sampling routine is exchanged by a routine + that simply returns ‘UNUR_INFINITY’. Otherwise the new point is not added + to the list of construction points. At least the hat function remains + log-concave. + + Setting PEDANTIC to ‘FALSE’ allows sampling from a distribution which is + “almost” log-concave and small errors are tolerated. However it might + happen that the hat function cannot be improved significantly. When the + hat functions that has been constructed by the ‘unur_init’ call is + extremely large then it might happen that the generation times are + extremely high (even hours are possible in extremely rare cases). + + Default is ‘FALSE’. + + -- Function: double unur_ars_get_loghatarea (const UNUR_GEN* GENERATOR) + Get the logarithm of area below the hat for the generator. (In case of an + error ‘UNUR_INFINITY’ is returned.) + + -- Function: double unur_ars_eval_invcdfhat (const UNUR_GEN* GENERATOR, double + U) + Evaluate the inverse of the CDF of the hat distribution at U. + + If U is out of the domain [0,1] then ‘unur_errno’ is set to + ‘UNUR_ERR_DOMAIN’ and the respective bound of the domain of the + distribution are returned (which is ‘-UNUR_INFINITY’ or ‘UNUR_INFINITY’ in + the case of unbounded domains). + +5.3.3 CEXT – wrapper for Continuous EXTernal generators +------------------------------------------------------- + +Required: + routine for sampling continuous random variates +Speed: + depends on external generator +Reinit: + supported + + Method CEXT is a wrapper for external generators for continuous univariate +distributions. It allows the usage of external random variate generators within +the UNU.RAN framework. + +How To Use +.......... + +The following steps are required to use some external generator within the +UNU.RAN framework (some of these are optional): + + 1. Make an empty generator object using a ‘unur_cext_new’ call. The argument + DISTRIBUTION is optional and can be replaced by ‘NULL’. However, it is + required if you want to pass parameters of the generated distribution to + the external generator or for running some validation tests provided by + UNU.RAN. + + 2. Create an initialization routine of type ‘int (*init)(UNUR_GEN *gen)’ and + plug it into the generator object using the ‘unur_cext_set_init’ call. + Notice that the INIT routine must return ‘UNUR_SUCCESS’ when it has been + executed successfully and ‘UNUR_FAILURE’ otherwise. It is possible to get + the size of and the pointer to the array of parameters of the underlying + distribution object by the respective calls ‘unur_cext_get_ndistrparams’ + and ‘unur_cext_get_distrparams’. Parameters for the external generator + that are computed in the INIT routine can be stored in a single array or + structure which is available by the ‘unur_cext_get_params’ call. + + Using an INIT routine is optional and can be omitted. + + 3. Create a sampling routine of type ‘double (*sample)(UNUR_GEN *gen)’ and + plug it into the generator object using the ‘unur_cext_set_sample’ call. + + Uniform random numbers are provided by the ‘unur_sample_urng’ call. Do not + use your own implementation of a uniform random number generator directly. + If you want to use your own random number generator we recommend to use the + UNU.RAN interface (see *note Using uniform random number generators: + URNG.). + + The array or structure that contains parameters for the external generator + that are computed in the INIT routine are available using the + ‘unur_cext_get_params’ call. + + Using a SAMPLE routine is of course obligatory. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. The +INIT routine is then called again. + + Here is a short example that demonstrates the application of this method by +means of the exponential distribution: + + /* ------------------------------------------------------------- */ + /* File: example_cext.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* This example shows how an external generator for the */ + /* exponential distribution with one scale parameter can be */ + /* used within the UNURAN framework. */ + /* */ + /* Notice, that this example does not provide the simplest */ + /* solution. */ + + /* ------------------------------------------------------------- */ + /* Initialization routine. */ + /* */ + /* Here we simply read the scale parameter of the exponential */ + /* distribution and store it in an array for parameters of */ + /* the external generator. */ + /* [ Of course we could do this in the sampling routine as */ + /* and avoid the necessity of this initialization routine. ] */ + + int exponential_init (UNUR_GEN *gen) + { + /* Get pointer to parameters of exponential distribution */ + double *params = unur_cext_get_distrparams(gen); + + /* The scale parameter is the first entry (see manual) */ + double lambda = (params) ? params[0] : 1.; + + /* Get array to store this parameter for external generator */ + double *genpar = unur_cext_get_params(gen, sizeof(double)); + genpar[0] = lambda; + + /* Executed successfully */ + return UNUR_SUCCESS; + } + + /* ------------------------------------------------------------- */ + /* Sampling routine. */ + /* */ + /* Contains the code for the external generator. */ + + double exponential_sample (UNUR_GEN *gen) + { + /* Get scale parameter */ + double *genpar = unur_cext_get_params(gen,0); + double lambda = genpar[0]; + + /* Sample a uniformly distributed random number */ + double U = unur_sample_urng(gen); + + /* Transform into exponentially distributed random variate */ + return ( -log(1. - U) * lambda ); + } + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use predefined exponential distribution with scale param. 2 */ + double fpar[1] = { 2. }; + distr = unur_distr_exponential(fpar, 1); + + /* Use method CEXT */ + par = unur_cext_new(distr); + + /* Set initialization and sampling routines. */ + unur_cext_set_init(par, exponential_init); + unur_cext_set_sample(par, exponential_sample); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_cext_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for new generator. + + -- Function: int unur_cext_set_init (UNUR_PAR* PARAMETERS, int (* + INIT)(UNUR_GEN* gen )) + Set initialization routine for external generator. Inside the + + _Important:_ The routine INIT must return ‘UNUR_SUCCESS’ when the generator + was initialized successfully and ‘UNUR_FAILURE’ otherwise. + + Parameters that are computed in the INIT routine can be stored in an array + or structure that is avaiable by means of the ‘unur_cext_get_params’ call. + Parameters of the underlying distribution object can be obtained by the + ‘unur_cext_get_distrparams’ call. + + -- Function: int unur_cext_set_sample (UNUR_PAR* PARAMETERS, double (* + SAMPLE)(UNUR_GEN* gen )) + Set sampling routine for external generator. + + _Important:_ Use ‘unur_sample_urng(gen)’ to get a uniform random number. + The pointer to the array or structure that contains the parameters that are + precomputed in the INIT routine are available by + ‘unur_cext_get_params(gen,0)’. Additionally one can use the + ‘unur_cext_get_distrparams’ call. + + -- Function: void* unur_cext_get_params (UNUR_GEN* GENERATOR, size_t SIZE) + Get pointer to memory block for storing parameters of external generator. + A memory block of size SIZE is automatically (re-) allocated if necessary + and the pointer to this block is stored in the GENERATOR object. If one + only needs the pointer to this memory block set SIZE to ‘0’. + + Notice, that SIZE is the size of the memory block and not the length of an + array. + + _Important:_ This rountine should only be used in the initialization and + sampling routine of the external generator. + + -- Function: double* unur_cext_get_distrparams (UNUR_GEN* GENERATOR) + -- Function: int unur_cext_get_ndistrparams (UNUR_GEN* GENERATOR) + Get size of and pointer to array of parameters of underlying distribution + in GENERATOR object. + + _Important:_ These rountines should only be used in the initialization and + sampling routine of the external generator. + +5.3.4 CSTD – Continuous STandarD distributions +---------------------------------------------- + +Required: + standard distribution from UNU.RAN library (*note Standard distributions: + Stddist.) or continuous distribution with inverse CDF. +Speed: + Set-up: fast, Sampling: depends on distribution and generator +Reinit: + supported + + CSTD is a wrapper for special generators for continuous univariate standard +distributions. It only works for distributions in the UNU.RAN library of +standard distributions (*note Standard distributions: Stddist.) or for +continuous distributions where the inverse CDF is given. If a distribution +object is provided that is build from scratch, it must provide the inverse CDF. +Then CSTD implements the inversion method. Otherwise, the ‘NULL’ pointer is +returned. + + For some distributions more than one special generator is possible. + +How To Use +.......... + +Create a distribution object for a standard distribution from the UNU.RAN +library (*note Standard distributions: Stddist.), or create a continuous +distribution object and set the function for the inverse CDF using +‘unur_distr_cont_set_invcdf’. For some distributions more than one special +generator (_variants_) is possible. These can be choosen by a +‘unur_cstd_set_variant’ call. For possible variants *note Standard +distributions: Stddist. However the following are common to all distributions: + +‘UNUR_STDGEN_DEFAULT’ + the default generator. +‘UNUR_STDGEN_FAST’ + the fastest available special generator. +‘UNUR_STDGEN_INVERSION’ + the inversion method (if available). + + Notice that the variant ‘UNUR_STDGEN_FAST’ for a special generator may be +slower than one of the universal algorithms! Additional variants may exist for +particular distributions. + + Sampling from truncated distributions (which can be constructed by changing +the default domain of a distribution by means of ‘unur_distr_cont_set_domain’ or +‘unur_cstd_chg_truncated’ calls) is possible but requires the inversion method. +Moreover the CDF of the distribution must be implemented. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_cstd_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for new generator. It requires a distribution + object for a continuous univariant distribution from the UNU.RAN library of + standard distributions (*note Standard distributions: Stddist.). + + Using a truncated distribution is allowed only if the inversion method is + available and selected by the ‘unur_cstd_set_variant’ call immediately + after creating the parameter object. Use a ‘unur_distr_cont_set_domain’ + call to get a truncated distribution. To change the domain of a + (truncated) distribution of a generator use the ‘unur_cstd_chg_truncated’ + call. + + -- Function: int unur_cstd_set_variant (UNUR_PAR* PARAMETERS, unsigned VARIANT) + Set variant (special generator) for sampling from a given distribution. + For possible variants *note Standard distributions: Stddist. + + Common variants are ‘UNUR_STDGEN_DEFAULT’ for the default generator, + ‘UNUR_STDGEN_FAST’ for (one of the) fastest implemented special generators, + and ‘UNUR_STDGEN_INVERSION’ for the inversion method (if available). If + the selected variant number is not implemented, then an error code is + returned and the variant is not changed. + + -- Function: int unur_cstd_chg_truncated (UNUR_GEN* GENERATOR, double LEFT, + double RIGHT) + Change left and right border of the domain of the (truncated) distribution. + This is only possible if the inversion method is used. Otherwise this call + has no effect and an error code is returned. + + Notice that the given truncated domain must be a subset of the domain of + the given distribution. The generator always uses the intersection of the + domain of the distribution and the truncated domain given by this call. + + It is not required to run ‘unur_reinit’ after this call has been used. + + _Important:_ If the CDF is (almost) the same for LEFT and RIGHT and + (almost) equal to ‘0’ or ‘1’, then the truncated domain is not chanced and + the call returns an error code. + + _Notice:_ If the parameters of the distribution has been changed it is + recommended to set the truncated domain again, since the former call might + change the domain of the distribution but not update the values for the + boundaries of the truncated distribution. + +5.3.5 HINV – Hermite interpolation based INVersion of CDF +--------------------------------------------------------- + +Required: + CDF +Optional: + PDF, dPDF +Speed: + Set-up: (very) slow, Sampling: (very) fast +Reinit: + supported +Reference: + [HLa03] [HLD04: Sect.7.2; Alg.7.1] + + HINV is a variant of numerical inversion, where the inverse CDF is +approximated using Hermite interpolation, i.e., the interval [0,1] is split into +several intervals and in each interval the inverse CDF is approximated by +polynomials constructed by means of values of the CDF and PDF at interval +boundaries. This makes it possible to improve the accuracy by splitting a +particular interval without recomputations in unaffected intervals. Three types +of splines are implemented: linear, cubic, and quintic interpolation. For +linear interpolation only the CDF is required. Cubic interpolation also +requires PDF and quintic interpolation PDF and its derivative. + + These splines have to be computed in a setup step. However, it only works +for distributions with bounded domain; for distributions with unbounded domain +the tails are chopped off such that the probability for the tail regions is +small compared to the given u-resolution. + + The method is not exact, as it only produces random variates of the +approximated distribution. Nevertheless, the maximal numerical error in +"u-direction" (i.e. |U-CDF(X)|, for X = "approximate inverse CDF"(U) +|U-CDF(X)|) can be set to the required resolution (within machine precision). +Notice that very small values of the u-resolution are possible but may increase +the cost for the setup step. + + As the possible maximal error is only estimated in the setup it may be +necessary to set some special design points for computing the Hermite +interpolation to guarantee that the maximal u-error can not be bigger than +desired. Such points are points where the density is not differentiable or has +a local extremum. Notice that there is no necessity to do so. However, if you +do not provide these points to the algorithm there might be a small chance that +the approximation error is larger than the given u-resolution, or that the +required number of intervals is larger than necessary. + +How To Use +.......... + +HINV works for continuous univariate distribution objects with given CDF and +(optional) PDF. It uses Hermite interpolation of order 1, 3 [default] or 5. The +order can be set by means of ‘unur_hinv_set_order’. For distributions with +unbounded domains the tails are chopped off such that the probability for the +tail regions is small compared to the given u-resulution. For finding these cut +points the algorithm starts with the region ‘[-1.e20,1.e20]’. For the +exceptional case where this might be too small (or one knows this region and +wants to avoid this search heuristics) it can be directly set via a +‘unur_hinv_set_boundary’ call. + + It is possible to use this method for generating from truncated +distributions. It even can be changed for an existing generator object by an +‘unur_hinv_chg_truncated’ call. + + This method is not exact, as it only produces random variates of the +approximated distribution. Nevertheless, the numerical error in "u-direction" +(i.e. |U-CDF(X)|, for X = "approximate inverse CDF"(U) |U-CDF(X)|) can be +controlled by means of ‘unur_hinv_set_u_resolution’. The possible maximal error +is only estimated in the setup. Thus it might be necessary to set some special +design points for computing the Hermite interpolation to guarantee that the +maximal u-error can not be bigger than desired. Such points (e.g. extremal +points of the PDF, points with infinite derivative) can be set using using the +‘unur_hinv_set_cpoints’ call. If the mode for a unimodal distribution is set in +the distribution object this mode is automatically used as design-point if the +‘unur_hinv_set_cpoints’ call is not used. + + As already mentioned the maximal error of this approximation is only +estimated. If this error is crucial for an application we recommend to compute +this error using ‘unur_hinv_estimate_error’ which runs a small Monte Carlo +simulation. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. The +values given by the last ‘unur_hinv_chg_truncated’ call will be then changed to +the values of the domain of the underlying distribution object. Moreover, +starting construction points (nodes) that are given by a ‘unur_hinv_set_cpoints’ +call are ignored when ‘unur_reinit’ is called. It is important to note that for +a distribution from the UNU.RAN library of standard distributions (*note +Standard distributions: Stddist.) the normalization constant has to be updated +using the ‘unur_distr_cont_upd_pdfarea’ call whenever its parameters have been +changed by means of a ‘unur_distr_cont_set_pdfparams’ call. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_hinv_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_hinv_set_order (UNUR_PAR* PARAMETERS, int ORDER) + Set order of Hermite interpolation. Valid orders are ‘1’, ‘3’, and ‘5’. + Notice that ORDER greater than ‘1’ requires the density of the + distribution, and ORDER greater than ‘3’ even requires the derivative of + the density. Using ORDER ‘1’ results for most distributions in a huge + number of intervals and is therefore not recommended. If the maximal error + in u-direction is very small (say smaller than ‘1.e-10’), ORDER ‘5’ is + recommended as it leads to considerably fewer design points, as long there + are no poles or heavy tails. + + _Remark:_ When the target distribution has poles or (very) heavy tails + ORDER ‘5’ (i.e., quintic interpolation) is numerically less stable and more + sensitive to round-off errors than ORDER ‘3’ (i.e., cubic interpolation). + + Default is ‘3’ if the density is given and ‘1’ otherwise. + + -- Function: int unur_hinv_set_u_resolution (UNUR_PAR* PARAMETERS, double + U_RESOLUTION) + Set maximal error in u-direction. However, the given u-error must not be + smaller than machine epsilon (‘DBL_EPSILON’) and should not be too close to + this value. As the resolution of most uniform random number sources is + 2^(-32) = ‘2.3e-10’, a value of ‘1.e-10’ leads to an inversion algorithm + that could be called exact. For most simulations slightly bigger values + for the maximal error are enough as well. + + Remark: The u-error might become larger than U_RESOLUTION due to rescaling + of floating point numbers when the domain of the distribution is truncated + by a ‘unur_hinv_chg_truncated’ call. + + Default is ‘1.e-10’. + + -- Function: int unur_hinv_set_cpoints (UNUR_PAR* PARAMETERS, const DOUBLE* + STP, int N_STP) + Set starting construction points (nodes) for Hermite interpolation. + + As the possible maximal error is only estimated in the setup it may be + necessary to set some special design points for computing the Hermite + interpolation to guarantee that the maximal u-error can not be bigger than + desired. We suggest to include as special design points all local extrema + of the density, all points where the density is not differentiable, and + isolated points inside of the domain with density 0. If there is an + interval with density constant equal to 0 inside of the given domain of the + density, both endpoints of this interval should be included as special + design points. Notice that there is no necessity to do so. However, if + these points are not provided to the algorithm the approximation error + might be larger than the given u-resolution, or the required number of + intervals could be larger than necessary. + + _Important_: Notice that the given points must be in increasing order and + they must be disjoint. + + _Important_: The boundary point of the computational region must not be + given in this list! Points outside the boundary of the computational + region are ignored. + + Default is for unimodal densities - if known - the mode of the density, if + it is not equal to the border of the domain. + + -- Function: int unur_hinv_set_boundary (UNUR_PAR* PARAMETERS, double LEFT, + double RIGHT) + Set the left and right boundary of the computational interval. Of course + ‘+/- UNUR_INFINITY’ is not allowed. If the CDF at LEFT and RIGHT is not + close to the respective values ‘0.’ and ‘1.’ then this interval is + increased by a (rather slow) search algorithm. + + _Important_: This call does not change the domain of the given distribution + itself. But it restricts the domain for the resulting random variates. + + Default is ‘1.e20’. + + -- Function: int unur_hinv_set_guidefactor (UNUR_PAR* PARAMETERS, double + FACTOR) + Set factor for relative size of the guide table for indexed search (see + also method DGT *note DGT::). It must be greater than or equal to ‘0’. + When set to ‘0’, then sequential search is used. + + Default is ‘1’. + + -- Function: int unur_hinv_set_max_intervals (UNUR_PAR* PARAMETERS, int + MAX_IVS) + Set maximum number of intervals. No generator object is created if the + necessary number of intervals for the Hermite interpolation exceeds + MAX_IVS. It is used to prevent the algorithm to eat up all memory for very + badly shaped CDFs. + + Default is ‘1000000’ (1.e6). + + -- Function: int unur_hinv_get_n_intervals (const UNUR_GEN* GENERATOR) + Get number of nodes (design points) used for Hermite interpolation in the + generator object. The number of intervals is the number of nodes minus 1. + It returns an error code in case of an error. + + -- Function: double unur_hinv_eval_approxinvcdf (const UNUR_GEN* GENERATOR, + double U) + Evaluate Hermite interpolation of inverse CDF at U. If U is out of the + domain [0,1] then ‘unur_errno’ is set to ‘UNUR_ERR_DOMAIN’ and the + respective bound of the domain of the distribution are returned (which is + ‘-UNUR_INFINITY’ or ‘UNUR_INFINITY’ in the case of unbounded domains). + + _Notice_: When the domain has been truncated by a ‘unur_hinv_chg_truncated’ + call then the inverse CDF of the truncated distribution is returned. + + -- Function: int unur_hinv_chg_truncated (UNUR_GEN* GENERATOR, double LEFT, + double RIGHT) + Changes the borders of the domain of the (truncated) distribution. + + Notice that the given truncated domain must be a subset of the domain of + the given distribution. The generator always uses the intersection of the + domain of the distribution and the truncated domain given by this call. + The tables of splines are not recomputed. Thus it might happen that the + relative error for the generated variates from the truncated distribution + is greater than the bound for the non-truncated distribution. This call + also fails when the CDF values of the boundary points are too close, i.e. + when only a few different floating point numbers would be computed due to + round-off errors with floating point arithmetic. + + Remark: The u-error might become larger than the U_RESOLUTION given by a + ‘unur_hinv_set_u_resolution’ call due to rescaling of floating point + numbers when the domain of the distribution is truncated. + + When failed an error code is returned. + + _Important_: Always check the return code since the domain is not changed + in case of an error. + + -- Function: int unur_hinv_estimate_error (const UNUR_GEN* GENERATOR, int + SAMPLESIZE, double* MAX_ERROR, double* MAE) + Estimate maximal u-error and mean absolute error (MAE) for GENERATOR by + means of a (quasi-) Monte-Carlo simulation with sample size SAMPLESIZE. + The results are stored in MAX_ERROR and MAE, respectively. + + It returns ‘UNUR_SUCCESS’ if successful. + +5.3.6 HRB – Hazard Rate Bounded +------------------------------- + +Required: + bounded hazard rate +Optional: + upper bound for hazard rate +Speed: + Set-up: fast, Sampling: slow +Reinit: + supported +Reference: + [HLD04: Sect.9.1.4; Alg.9.4] + + Generates random variate with given hazard rate which must be bounded from +above. It uses the thinning method with a constant dominating hazard function. + +How To Use +.......... + +HRB requires a hazard function for a continuous distribution together with an +upper bound. The latter has to be set using the ‘unur_hrb_set_upperbound’ call. +If no such upper bound is given it is assumed that the upper bound can be +achieved by evaluating the hazard rate at the left hand boundary of the domain +of the distribution. Notice, however, that for decreasing hazard rate the +method HRD (*note Hazard Rate Decreasing: HRD.) is much faster and thus the +prefered method. + + It is important to note that the domain of the distribution can be set via a +‘unur_distr_cont_set_domain’ call. However, the left border must not be +negative. Otherwise it is set to ‘0’. This is also the default if no domain is +given at all. For computational reasons the right border is always set to +‘UNUR_INFINITY’ independently of the given domain. Thus for domains bounded +from right the function for computing the hazard rate should return +‘UNUR_INFINITY’ right of this domain. + + For distributions with increasing hazard rate method HRI (*note Hazard Rate +Increasing: HRI.) is required. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. +Notice, that the upper bound given by the ‘unur_hrb_set_upperbound’ call cannot +be changed and must be valid for the changed distribution. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_hrb_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_hrb_set_upperbound (UNUR_PAR* PARAMETERS, double + UPPERBOUND) + Set upper bound for hazard rate. If this call is not used it is assumed + that the the maximum of the hazard rate is achieved at the left hand + boundary of the domain of the distribution. + + -- Function: int unur_hrb_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) + -- Function: int unur_hrb_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the hazard rate is + not bounded by the given bound, then ‘unur_errno’ is set to + ‘UNUR_ERR_GEN_CONDITION’. + + Default is ‘FALSE’. + +5.3.7 HRD – Hazard Rate Decreasing +---------------------------------- + +Required: + decreasing (non-increasing) hazard rate +Speed: + Set-up: fast, Sampling: slow +Reinit: + supported +Reference: + [HLD04: Sect.9.1.5; Alg.9.5] + + Generates random variate with given non-increasing hazard rate. It is +necessary that the distribution object contains this hazard rate. Decreasing +hazard rate implies that the corresponding PDF of the distribution has heavier +tails than the exponential distribution (which has constant hazard rate). + +How To Use +.......... + +HRD requires a hazard function for a continuous distribution with non-increasing +hazard rate. There are no parameters for this method. + + It is important to note that the domain of the distribution can be set via a +‘unur_distr_cont_set_domain’ call. However, only the left hand boundary is +used. For computational reasons the right hand boundary is always reset to +‘UNUR_INFINITY’. If no domain is given by the user then the left hand boundary +is set to ‘0’. + + For distributions which do not have decreasing hazard rates but are bounded +from above use method HRB (*note Hazard Rate Bounded: HRB.). For distributions +with increasing hazard rate method HRI (*note Hazard Rate Increasing: HRI.) is +required. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_hrd_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_hrd_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) + -- Function: int unur_hrd_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the hazard rate is + not bounded by the given bound, then ‘unur_errno’ is set to + ‘UNUR_ERR_GEN_CONDITION’. + + Default is ‘FALSE’. + +5.3.8 HRI – Hazard Rate Increasing +---------------------------------- + +Required: + increasing (non-decreasing) hazard rate +Speed: + Set-up: fast, Sampling: slow +Reinit: + supported +Reference: + [HLD04: Sect.9.1.6; Alg.9.6] + + Generates random variate with given non-increasing hazard rate. It is +necessary that the distribution object contains this hazard rate. Increasing +hazard rate implies that the corresponding PDF of the distribution has heavier +tails than the exponential distribution (which has constant hazard rate). + + The method uses a decomposition of the hazard rate into a main part which is +constant for all x beyond some point p0 and a remaining part. From both of +these parts points are sampled using the thinning method and the minimum of both +is returned. Sampling from the first part is easier as we have a constant +dominating hazard rate. Thus p0 should be large. On the other hand, if p0 is +large than the thinning algorithm needs many iteration. Thus the performance of +the the algorithm deponds on the choice of p0. We found that values close to +the expectation of the generated distribution result in good performance. + +How To Use +.......... + +HRI requires a hazard function for a continuous distribution with non-decreasing +hazard rate. The parameter p0 should be set to a value close to the expectation +of the required distribution using ‘unur_hri_set_p0’. If performance is crucial +one may try other values as well. + + It is important to note that the domain of the distribution can be set via a +‘unur_distr_cont_set_domain’ call. However, only the left hand boundary is +used. For computational reasons the right hand boundary is always reset to +‘UNUR_INFINITY’. If no domain is given by the user then the left hand boundary +is set to ‘0’. + + For distributions with decreasing hazard rate method HRD (*note Hazard Rate +Decreasing: HRI.) is required. For distributions which do not have increasing +or decreasing hazard rates but are bounded from above use method HRB (*note +Hazard Rate Bounded: HRB.). + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. + + Notice, that the upper bound given by the ‘unur_hrb_set_upperbound’ call +cannot be changed and must be valid for the changed distribution. Notice that +the parameter p0 which has been set by a ‘unur_hri_set_p0’ call cannot be +changed and must be valid for the changed distribution. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_hri_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_hri_set_p0 (UNUR_PAR* PARAMETERS, double P0) + Set design point for algorithm. It is used to split the domain of the + distribution. Values for P0 close to the expectation of the distribution + results in a relatively good performance of the algorithm. It is important + that the hazard rate at this point must be greater than ‘0’ and less than + ‘UNUR_INFINITY’. + + Default: left boundary of domain + ‘1.’ + + -- Function: int unur_hri_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) + -- Function: int unur_hri_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the hazard rate is + not bounded by the given bound, then ‘unur_errno’ is set to + ‘UNUR_ERR_GEN_CONDITION’. + + Default is ‘FALSE’. + +5.3.9 ITDR – Inverse Transformed Density Rejection +-------------------------------------------------- + +Required: + monotone PDF, dPDF, pole +Optional: + splitting point between pole and tail region, c-values +Speed: + Set-up: moderate, Sampling: moderate +Reinit: + supported +Reference: + [HLDa07] + + ITDR is an acceptance/rejection method that works for monotone densities. It +is especially designed for PDFs with a single pole. It uses different hat +functions for the pole region and for the tail region. For the tail region +_Transformed Density Rejection_ with a single construction point is used. For +the pole region a variant called _Inverse Transformed Density Rejection_ is +used. The optimal splitting point between the two regions and the respective +maximum local concavity and inverse local concavity (*note Glossary::) that +guarantee valid hat functions for each regions are estimated. This splitting +point is set to the intersection point of local concavity and inverse local +concavity. However, it is assumed that both, the local concavity and the +inverse local concavity do not have a local minimum in the interior of the +domain (which is the case for all standard distributions with a single pole). +In other cases (or when the built-in search routines do not compute non-optimal +values) one can provide the splitting point, and the c-values. + +How To Use +.......... + +Method ITDR requires a distribution object with given PDF and its derivative and +the location of the pole (or mode). The PDF must be monotone and may contain a +pole. It must be set via the ‘unur_distr_cont_set_pdf’ and +‘unur_distr_cont_set_dpdf’ calls. The PDF should return UNUR_INFINITY for the +pole. Alternatively, one can also set the logarithm of the PDF and its +derivative via the ‘unur_distr_cont_set_logpdf’ and +‘unur_distr_cont_set_dlogpdf’ calls. This is in especially useful since then +the setup and search routines are numerically more stable. Moreover, for many +distributions computing the logarithm of the PDF is less expensive then +computing the PDF directly. + + The pole of the distribution is given by a ‘unur_distr_cont_set_mode’ call. +Notice that distributions with “heavy” poles may have numerical problems caused +by the resultion of the floating point numbers used by computers. While the +minimal distance between two different floating point numbers is about ‘1.e-320’ +near ‘0.’ it increases to ‘1.e-16’ near ‘1.’ Thus any random variate generator +implemented on a digital computer in fact draws samples from a discrete +distribution that approximates the desired continuous distribution. For +distributions with “heavy” poles not at 0 this approximation may be too crude +and thus every goodness-of-fit test will fail. Besides this theoretic problem +that cannot be resolved we have to take into consideration that round-off errors +occur more frequently when we have PDFs with poles far away from ‘0.’ Method +ITDR tries to handles this situation as good as possible by moving the pole into +‘0.’ Thus do not use a wrapper for your PDF that hides this shift since the +information about the resolution of the floating point numbers near the pole +gets lost. + + Method ITDR uses different hats for the pole region and for the tail region. +The splitting point between these two regions, the optimal c-value and design +points for constructing the hats using Transformed Density Rejection are +computed automatically. (The results of these computations can be read using +the respective calls ‘unur_itdr_get_xi’, ‘unur_itdr_get_cp’ , and +‘unur_itdr_get_ct’ for the intersection point between local concavity and +inverse local concavity, the c-value for the pole and the tail region.) +However, one can also analyze the local concavity and inverse local concavity +set the corresponding values using ‘unur_itdr_set_xi’, ‘unur_itdr_set_cp’ , and +‘unur_itdr_set_ct’ calls. Notice, that c-values greater than -1/2 can be set to +‘-0.5’. Although this results in smaller acceptance probabities sampling from +the hat distribution is much faster than for other values of c. Depending on +the expenses of evaluating the PDF the resulting algorithm is usually faster. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. +However, the values given by ‘unur_itdr_set_xi’, ‘unur_itdr_set_cp’ , or +‘unur_itdr_set_ct’ calls are then ignored when ‘unur_reinit’ is called. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_itdr_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_itdr_set_xi (UNUR_PAR* PARAMETERS, double XI) + Sets points where local concavity and inverse local concavity are (almost) + equal. It is used to estimate the respective c-values for pole region and + hat regions and to determine the splitting point bx between pole and tail + region. If no such point is provided it will be computed automatically. + + Default: not set. + + -- Function: int unur_itdr_set_cp (UNUR_PAR* PARAMETERS, double CP) + Sets parameter CP for transformation T for inverse density in pole region. + It must be at most 0 and greater than -1. A value of ‘-0.5’ is treated + separately and usually results in faster marginal generation time (at the + expense of smaller acceptance probabilities. If no CP-value is given it is + estimated automatically. + + Default: not set. + + -- Function: int unur_itdr_set_ct (UNUR_PAR* PARAMETERS, double CT) + Sets parameter CT for transformation T for density in tail region. It must + be at most 0. For densities with unbounded domain it must be greater than + -1. A value of ‘-0.5’ is treated separately and usually results in faster + marginal generation time (at the expense of smaller acceptance + probabilities. If no CT-value is given it is estimated automatically. + + Default: not set. + + -- Function: double unur_itdr_get_xi (UNUR_GEN* GENERATOR) + -- Function: double unur_itdr_get_cp (UNUR_GEN* GENERATOR) + -- Function: double unur_itdr_get_ct (UNUR_GEN* GENERATOR) + Get intersection point XI, and c-values CP and CT, respectively. (In case + of an error ‘UNUR_INFINITY’ is returned.) + + -- Function: double unur_itdr_get_area (UNUR_GEN* GENERATOR) + Get area below hat. (In case of an error ‘UNUR_INFINITY’ is returned.) + + -- Function: int unur_itdr_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) + Turn verifying of algorithm while sampling on/off. + + If the condition PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ + is set to ‘UNUR_ERR_GEN_CONDITION’. However, notice that this might happen + due to round-off errors for a few values of x (less than 1%). + + Default is ‘FALSE’. + + -- Function: int unur_itdr_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Change the verifying of algorithm while sampling on/off. + +5.3.10 NINV – Numerical INVersion +--------------------------------- + +Required: + CDF +Optional: + PDF +Speed: + Set-up: optional, Sampling: (very) slow +Reinit: + supported + + NINV implementations of some methods for numerical inversion: Newton’s +method, regula falsi (combined with interval bisectioning), and bisection +method. Regula falsi and bisection method require only the CDF while Newton’s +method also requires the PDF. To speed up marginal generation times a table with +suitable starting points can be created during the setup. The performance of +the algorithm can adjusted by the desired accuracy of the method. It is +possible to use this method for generating from truncated distributions. The +truncated domain can be changed for an existing generator object. + +How To Use +.......... + +Method NINV generates random variates by numerical inversion and requires a +continuous univariate distribution objects with given CDF. Three variants are +available: + + − Regula falsi [default] + − Newton’s method + − Interval bisectioning + + Newton’s method additionally requires the PDF of the distribution and cannot +be used otherwise (NINV automatically switches to regula falsi then). Default +algorithm is regula falsi. It is slightly slower but numerically much more +stable than Newton’s algorithm. Interval bisectioning is the slowest method and +should only be considered as a last resort when the other methods fails. + + It is possible to draw samples from truncated distributions. The truncated +domain can even be changed for an existing generator object by an +‘unur_ninv_chg_truncated’ call. + + Marginal generation times can be sped up by means of a table with suitable +starting points which can be created during the setup. Using such a table can +be switched on by means of a ‘unur_ninv_set_table’ call where the table size is +given as a parameter. The table is still useful when the (truncated) domain is +changed often, since it is computed for the domain of the given distribution. +(It is not possible to enlarge this domain.) If it is necessary to recalculate +the table during sampling, the command ‘unur_ninv_chg_table’ can be used. As a +rule of thumb using such a table is appropriate when the number of generated +points exceeds the table size by a factor of 100. + + The default number of iterations of NINV should be enough for all reasonable +cases. Nevertheless, it is possible to adjust the maximal number of iterations +with the commands ‘unur_ninv_set_max_iter’ and ‘unur_ninv_chg_max_iter’. In +particular this might be necessary when the PDF has a pole or the distribution +has extremely heavy tails. + + It is also possible to set/change the accuracy of the method (which also +heavily influencies the generation time). We use two measures for the +approximation error which can be used independently: x-error and u-error (*note +Inversion:: for more details). It is possible to set the maximal tolerated +error using with ‘unur_ninv_set_x_resolution’ and with +‘unur_ninv_set_u_resolution’, resp., and change it with the respective calls +‘unur_ninv_chg_x_resolution’ and ‘unur_ninv_chg_x_resolution’. The algorithm +tries to satisfy _both_ accuracy goals (and raises an error flag it this fails). +One of these accuracy checks can be disabled by setting the accuracy goal to a +negative value. + + NINV tries to use proper starting values for both the regula falsi and +bisection method, and for Newton’s method. Of course the user might have more +knowledge about the properties of the target distribution and is able to share +his wisdom with NINV using the respective commands ‘unur_ninv_set_start’ and +‘unur_ninv_chg_start’. It is possible to change the parameters and the domain +of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator +object. The values given by the last ‘unur_ninv_chg_truncated’ call will be +then changed to the values of the domain of the underlying distribution object. +It is important to note that for a distribution from the UNU.RAN library of +standard distributions (*note Standard distributions: Stddist.) the +normalization constant has to be updated using the ‘unur_distr_cont_upd_pdfarea’ +call whenever its parameters have been changed by means of a +‘unur_distr_cont_set_pdfparams’ call. + + It might happen that NINV aborts ‘unur_sample_cont’ without computing the +correct value (because the maximal number iterations has been exceeded). Then +the last approximate value for x is returned (with might be fairly false) and +‘unur_error’ is set to ‘UNUR_ERR_GEN_SAMPLING’. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_ninv_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_ninv_set_useregula (UNUR_PAR* PARAMETERS) + Switch to regula falsi combined with interval bisectioning. (This the + default.) + + -- Function: int unur_ninv_set_usenewton (UNUR_PAR* PARAMETERS) + Switch to Newton’s method. Notice that it is numerically less stable than + regula falsi. It it is not possible to invert the CDF for a particular + uniform random number U when calling ‘unur_sample_cont’, ‘unur_error’ is + set to ‘UNUR_ERR_GEN_SAMPLING’. Thus it is recommended to check + ‘unur_error’ before using the result of the sampling routine. + + -- Function: int unur_ninv_set_usebisect (UNUR_PAR* PARAMETERS) + Switch to bisection method. This is a slow algorithm and should only be + used as a last resort. + + -- Function: int unur_ninv_set_max_iter (UNUR_PAR* PARAMETERS, int MAX_ITER) + -- Function: int unur_ninv_chg_max_iter (UNUR_GEN* GENERATOR, int MAX_ITER) + Set and change number of maximal iterations. Default is ‘100’. + + -- Function: int unur_ninv_set_x_resolution (UNUR_PAR* PARAMETERS, double + X_RESOLUTION) + -- Function: int unur_ninv_chg_x_resolution (UNUR_GEN* GENERATOR, double + X_RESOLUTION) + Set and change the maximal tolerated relative x-error. If X_RESOLUTION is + negative then checking of the x-error is disabled. + + Default is ‘1.e-8’. + + -- Function: int unur_ninv_set_u_resolution (UNUR_PAR* PARAMETERS, double + U_RESOLUTION) + -- Function: int unur_ninv_chg_u_resolution (UNUR_GEN* GENERATOR, double + U_RESOLUTION) + Set and change the maximal tolerated (abolute) u-error. If U_RESOLUTION is + negative then checking of the u-error is disabled. + + Default is ‘-1’ (disabled). + + -- Function: int unur_ninv_set_start (UNUR_PAR* PARAMETERS, double LEFT, double + RIGHT) + Set starting points. If not set, suitable values are chosen automatically. + + Newton: LEFT: starting point + Regula falsi: LEFT, RIGHT: boundary of starting interval + + If the starting points are not set then the follwing points are used by + default: + Newton: LEFT: CDF(LEFT) = 0.5 + Regula falsi: LEFT: CDF(LEFT) = 0.1 + RIGHT: CDF(RIGHT) = 0.9 + + If LEFT == RIGHT, then UNU.RAN always uses the default starting points! + + -- Function: int unur_ninv_chg_start (UNUR_GEN* GEN, double LEFT, double RIGHT) + Change the starting points for numerical inversion. If left==right, then + UNU.RAN uses the default starting points (see ‘unur_ninv_set_start’ ). + + -- Function: int unur_ninv_set_table (UNUR_PAR* PARAMETERS, int NO_OF_POINTS) + Generates a table with NO_OF_POINTS points containing suitable starting + values for the iteration. The value of NO_OF_POINTS must be at least 10 + (otherwise it will be set to 10 automatically). + + The table points are chosen such that the CDF at these points form an + equidistance sequence in the interval (0,1). + + If a table is used, then the starting points given by ‘unur_ninv_set_start’ + are ignored. + + No table is used by default. + + -- Function: int unur_ninv_chg_table (UNUR_GEN* GEN, int NO_OF_POINTS) + Recomputes a table as described in ‘unur_ninv_set_table’. + + -- Function: int unur_ninv_chg_truncated (UNUR_GEN* GEN, double LEFT, double + RIGHT) + Changes the borders of the domain of the (truncated) distribution. + + Notice that the given truncated domain must be a subset of the domain of + the given distribution. The generator always uses the intersection of the + domain of the distribution and the truncated domain given by this call. + Moreover the starting point(s) will not be changed. + + _Important:_ If the CDF is (almost) the same for LEFT and RIGHT and + (almost) equal to ‘0’ or ‘1’, then the truncated domain is _not_ chanced + and the call returns an error code. + + _Notice:_ If the parameters of the distribution has been changed by a + ‘unur_distr_cont_set_pdfparams’ call it is recommended to set the truncated + domain again, since the former call might change the domain of the + distribution but not update the values for the boundaries of the truncated + distribution. + + -- Function: double unur_ninv_eval_approxinvcdf (const UNUR_GEN* GENERATOR, + double U) + Get approximate approximate value of inverse CDF at U. If U is out of the + domain [0,1] then ‘unur_errno’ is set to ‘UNUR_ERR_DOMAIN’ and the + respective bound of the domain of the distribution are returned (which is + ‘-UNUR_INFINITY’ or ‘UNUR_INFINITY’ in the case of unbounded domains). + + _Notice_: This function always evaluates the inverse CDF of the given + distribution. A call to ‘unur_ninv_chg_truncated’ call has no effect. + +5.3.11 NROU – Naive Ratio-Of-Uniforms method +-------------------------------------------- + +Required: + PDF +Optional: + mode, center, bounding rectangle for acceptance region +Speed: + Set-up: slow or fast, Sampling: moderate +Reinit: + supported +Reference: + [HLD04: Sect.2.4 and Sect.6.4] + + NROU is an implementation of the (generalized) ratio-of-uniforms method which +uses (minimal) bounding rectangles, see *note Ratio-of-Uniforms::. It uses a +positive control parameter r for adjusting the algorithm to the given +distribution to improve performance and/or to make this method applicable. +Larger values of r increase the class of distributions for which the method +works at the expense of a higher rejection constant. For computational reasons +r=1 should be used if possible (this is the default). Moreover, this +implementation uses the center mu of the distribution (see +‘unur_distr_cont_get_center’ for details of its default values). + + For the special case with r=1 the coordinates of the minimal bounding +rectangles are given by + v^+ = sup_(x) sqrt(PDF(x)), + u^- = inf_(x) (x- mu) sqrt(PDF(x)), + u^+ = sup_(x) (x- mu) sqrt(PDF(x)), + +where mu is the center of the distribution. For other values of r we have + v^+ = sup_(x) (PDF(x))^(1/(r+1)), + u^- = inf_(x) (x- mu) (PDF(x))^(r/(r+1)), + u^+ = sup_(x) (x- mu) (PDF(x))^(r/(r+1)). + +These bounds can be given directly. Otherwise they are computed automatically +by means of a (slow) numerical routine. Of course this routine can fail, +especially when this rectangle is not bounded. + + It is important to note that the algorithm works with PDF(x- mu) instead of +PDF(x). This is important as otherwise the acceptance region can become a very +long and skinny ellipsoid along a diagonal of the (huge) bounding rectangle. + +How To Use +.......... + +For using the NROU method UNU.RAN needs the PDF of the distribution. +Additionally, the parameter r can be set via a ‘unur_vnrou_set_r’ call. Notice +that the acceptance probability decreases when r is increased. On the other +hand is is more unlikely that the bounding rectangle does not exist if r is +small. + + A bounding rectangle can be given by the ‘unur_vnrou_set_u’ and +‘unur_vnrou_set_v’ calls. + + _Important:_ The bounding rectangle has to be provided for the function +PDF(x-center)! Notice that ‘center’ is the center of the given distribution, see +‘unur_distr_cont_set_center’. If in doubt or if this value is not optimal, it +can be changed (overridden) by a ‘unur_nrou_set_center’ call. + + If the coordinates of the bounding rectangle are not provided by the user +then the minimal bounding rectangle is computed automatically. + + By means of ‘unur_vnrou_set_verify’ and ‘unur_vnrou_chg_verify’ one can run +the sampling algorithm in a checking mode, i.e., in every cycle of the rejection +loop it is checked whether the used rectangle indeed enclosed the acceptance +region of the distribution. When in doubt (e.g., when it is not clear whether +the numerical routine has worked correctly) this can be used to run a small +Monte Carlo study. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. +Notice, that derived parameters like the mode must also be (re-) set if the +parameters or the domain has be changed. Notice, however, that then the values +that has been set by ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ calls are removed +and the coordinates of the bounding box are computed numerically. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_nrou_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_nrou_set_u (UNUR_PAR* PARAMETERS, double UMIN, double + UMAX) + Sets left and right boundary of bounding rectangle. If no values are + given, the boundary of the minimal bounding rectangle is computed + numerically. + + _Notice_: Computing the minimal bounding rectangle may fail under some + circumstances. Moreover, for multimodal distributions the bounds might be + too small as only local extrema are computed. Nevertheless, for T_c + -concave distributions with c=-1/2 it should work. + + _Important:_ The bounding rectangle that has to be provided is for the + function PDF(x-center)! + + Default: not set. + + -- Function: int unur_nrou_set_v (UNUR_PAR* PARAMETERS, double VMAX) + Set upper boundary for bounding rectangle. If this value is not given then + sqrt(PDF(mode)) is used instead. + + _Notice_: When the mode is not given for the distribution object, then it + will be computed numerically. + + Default: not set. + + -- Function: int unur_nrou_set_r (UNUR_PAR* PARAMETERS, double R) + Sets the parameter R of the generalized ratio-of-uniforms method. + + _Notice_: This parameter must satisfy R>0. + + Default: ‘1’. + + -- Function: int unur_nrou_set_center (UNUR_PAR* PARAMETERS, double CENTER) + Set the center mu of the PDF. If not set the center of the given + distribution object is used. + + Default: see ‘unur_distr_cont_set_center’. + + -- Function: int unur_nrou_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) + Turn verifying of algorithm while sampling on/off. + + If the condition PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ + is set to ‘UNUR_ERR_GEN_CONDITION’. However, notice that this might happen + due to round-off errors for a few values of x (less than 1%). + + Default is ‘FALSE’. + + -- Function: int unur_nrou_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Change the verifying of algorithm while sampling on/off. + +5.3.12 PINV – Polynomial interpolation based INVersion of CDF +------------------------------------------------------------- + +Required: + PDF +Optional: + domain, center, CDF, derivative of PDF +Speed: + Set-up: (very) slow, Sampling: (very) fast +Reinit: + not implemented +Reference: + [DHLa08] + + PINV is a variant of numerical inversion, where the inverse CDF is +approximated using Newton’s interpolating formula. The interval [0,1] is split +into several subintervals. In each of these the inverse CDF is constructed at +nodes (CDF(x),x) for some points x in this subinterval. If the PDF is given, +then the CDF is computed numerically from the given PDF using adaptive +Gauss-Lobatto integration with 5 points. Subintervals are split until the +requested accuracy goal is reached. + + The method is not exact, as it only produces random variates of the +approximated distribution. Nevertheless, the maximal tolerated approximation +error can be set to be the resolution (but of course is bounded by the machine +precision). We use the u-error |U-CDF(X)| to measure the error for X = +"approximate inverse CDF"(U). Notice that very small values of the u-resolution +are possible but increase the cost for the setup step. We call the maximal +tolerated u-error the _u-resolution_ of the algorithm in the sequel. + + Both the order of the interpolating polynomial and the u-resolution can be +selected. + + The interpolating polynomials have to be computed in a setup step. However, +it only works for distributions with bounded domain; for distributions with +unbounded domain the tails are cut off such that the probability for the tail +regions is small compared to the given u-resolution. + + The construction of the interpolation polynomial only works when the PDF is +unimodal or when the PDF does not vanish between two modes. + + There are some restrictions for the given distribution: + • The support of the distribution (i.e., the region where the PDF is strictly + positive) must be connected. In practice this means, that the region where + PDF is "not too small" must be connected. Unimodal densities satisfy this + condition. If this condition is violated then the domain of the + distribution might be truncated. + • When the PDF is integrated numerically, then the given PDF must be + continuous and should be smooth. + • The PDF must be bounded. + • The algorithm has problems when the distribution has heavy tails (as then + the inverse CDF becomes very steep at 0 or 1) and the requested + u-resolution is very small. E.g., the Cauchy distribution is likely to + show this problem when the requested u-resolution is less then ‘1.e-12’. + Regions with very small PDF values or heavy tails might lead to an abortion +of the set-up or (even worse) the approximation error might become larger than +requested, since the (computation of the) interpolating polynomial becomes +numerically unstable. + + _Remark:_ We also have implemented experimental variants. However, we +observed that these variants are more sensitive to round-off errors, especially +in the right hand tail and we _do not recommend_ their usage unless there are +severe reasons. + + − Use a function that implements the CDF instead of numerical integration of + the PDF. + + − Use Hermite interpolation instead of Newton interpolation. Thus the first + (and second) derivative of the interpolating polynomial coincides with that + of the inverse CDF. Consequently the interpolant is also (twice) + differentiable even at the interval boundaries. This variant can be seen + as limiting case of Newton interpolation with double (or triple) points as + nodes. + + We have used a _smoothness_ parameter to control this feature. However, + besides numerical problems we observed that this variant requires more + intervals and thus larger setup times and higher memory consumptions. + +How To Use +.......... + +PINV works for continuous univariate distribution objects with given PDF. The +corresponding distribution object should contain a typical point of the +distribution, i.e., a point where the PDF is not too small, e.g., (a point near) +the mode. However, it is important that the center is *not* the pole of the +distribution (or a point too close to the pole). It can be set using a +‘unur_distr_cont_set_center’ or a ‘unur_distr_cont_set_mode’ call. If neither +is set, or if the given center cannot be used, then a simple search routine +tries to find an appropriate point for the center. + + It is recommended that the domain of the distribution with bounded domain is +specified using a ‘unur_distr_cont_set_domain’ call. Otherwise, the boundary is +searched numerically which might be rather expensive, especially when this +boundary point is ‘0’. + + The inverse CDF is interpolated using Newton polynomials. The order of this +polynomial can be set by means of a ‘unur_pinv_set_order’ call. + + The smoothness of the interpolant at interval boundaries can be controlled +using a ‘unur_pinv_set_smoothness’ call. Then Hermite interpolation instead of +Newton interpolation is used. (The former can be seen as a limiting case of +Newton interpolation with double (or triple) points.) However, using higher +smoothness is _not recommended_ unless differentiability at the interval +boundaries is important. + + For distributions with unbounded domains the tails are cut off such that the +probability for the tail regions is small compared to the given u-resolution. +For finding these cut points the algorithm starts with the region +‘[-1.e100,1.e100]’. For the exceptional case where this does not work these +starting points can be changed via a ‘unur_pinv_set_boundary’ call. + + This method is not exact, as it only produces random variates of the +approximated distribution. Nevertheless, the numerical error in "u-direction" +(i.e., |U-CDF(X)|, for X = "approximate inverse CDF"(U) |U-CDF(X)|) can be +controlled by means of ‘unur_pinv_set_u_resolution’. However, the maximal error +of this approximation is only estimated. For very small u-resolutions the +actual approximation error might be (slightly) larger than the requested +u-resolution. (Of course the size of this value depends on the given PDF.) If +this error is crucial for an application we recommend to compute this error +using ‘unur_pinv_estimate_error’ which runs a small Monte Carlo simulation. It +is also possible to improve the error estimate during setup by means of +‘unur_pinv_set_extra_testpoints’. See also the documentation for function +‘unur_pinv_set_u_resolution’ and the remark given there. + + The number of required subintervals heavily depends on the order of the +interpolating polynomial and the requested u-resolution: it increases when order +or u-resolution are decreased. It can be checked using a +‘unur_pinv_get_n_intervals’ call. The maximum number of such subintervals is +fixed but can be increased using a ‘unur_pinv_set_max_intervals’ call. If this +maximum number is too small then the set-up aborts with a corresponding error +message. + + It is also possible to use the CDF of the distribution instead of the PDF. +Then the distribution object must contain a pointer to the CDF. Moreover, this +variant of the algorithm has to be switched on using an ‘unur_pinv_set_usecdf’ +call. Notice, however, that the setup for this variant is numerically less +stable than using integration of the PDF (the default variant). Thus using the +CDF is _not recommended_. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_pinv_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_pinv_set_order (UNUR_PAR* PARAMETERS, int ORDER) + Set order of interpolation. Valid orders are between ‘3’ and ‘17’. Higher + orders result in fewer intervals for the approximations. + + Default: ‘5’. + + -- Function: int unur_pinv_set_smoothness (UNUR_PAR* PARAMETERS, int + SMOOTHNESS) + Set smoothness of interpolant. By construction the interpolant is + piecewise polynomial and thus smooth on each of the intervals where these + polynomials are constructed. At the interval boundaries, however, it + usually not be differentiable. Method PINV also implements variants of + Newton interpolation where the first (or second) derivative of the + interpolating polynomial coincides with the respective derivative of the + inverse CDF at the nodes. The the interpolant is (twice) differentiable + even at the interval boundaries. These variants can be seen as limiting + case of Newton interpolation with double (or triple) points as nodes and + are known as Hermite interpolation. + + Possible values for SMOOTHNESS: + + Value Effect Requirements + ------------------------------------------------------------------------------- + ‘0’ continuous requires PDF (or CDF) + + ‘1’ differentiable requires PDF (optional: CDF), + order of polynomial must be odd + + ‘2’ twice requires PDF and its derivative (optional: + differentiable CDF), + order must be 5, 8, 11, 14 or 17 + + If the order of the polynomial does not satisfy the given condition, then + it is increased to the next larger possible value. + + _Remark:_ A higher smoothness parameter usually results in a higher number + of intervals and thus a higher setup time and memory consumption. We also + observed that higher smoothness parameters make the algorithm more sensible + for round-off error. Then the setup fails. + + _Remark:_ If the interpolating polynomial cannot be constructed for the + requested smoothness on a particular interval, then the smoothness + parameter is reduced for that interval. + + _Remark:_ For order ‘3’ and smoothness ‘1’ (cubic Hermite interpolation) + monotonicity is guaranteed by checking a simple monotonicity condition for + the coefficients of the polynomials. + + _Remark:_ Using SMOOTHNESS larger than ‘0’ is _not recommended_ unless + differentiability at the interval boundaries is important for ones + application. + + Default: ‘0’. + + -- Function: int unur_pinv_set_u_resolution (UNUR_PAR* PARAMETERS, double + U_RESOLUTION) + Set maximal tolerated u-error. Values of U_RESOLUTION must at least + ‘1.e-15’ and ‘1.e-5’ at most. Notice that the resolution of most uniform + random number sources is 2^(-32) = ‘2.3e-10’. Thus a value of ‘1.e-10’ + leads to an inversion algorithm that could be called exact. For most + simulations slightly bigger values for the maximal error are enough as + well. + + Smaller values for U_RESOLUTION increase the number of subinterval that are + necessary for the approximation of the inverse CDF. For very small values + (less then ‘1.e-12’) this number might exceed the maximum number of such + intervals. However, this number can be increased using a + ‘unur_pinv_set_max_intervals’ call. + + _Remark:_ We ran many experiments and found that the observed u-error was + always smaller than the given U_RESOLUTION whenever this value was + ‘1.e-12’. For values smaller than ‘1e-13’ the maximal observed u-error was + slightly larger. One use ‘1.e-15’ if best approximation is required. + However, then the actual u-error can be as large as ‘1.e-14’. + + Consider calling ‘unur_pinv_set_extra_testpoints’ in order to reduce the + risk of larger approximation errors. + + *Warning!* These figures are based on our experiments (with some tolerance + added to be on the safe side). There is no guarantee for these error + estimates for a particular distribution. + + Default is ‘1.e-10’. + + -- Function: int unur_pinv_set_extra_testpoints (UNUR_PAR* PARAMETERS, int + N_POINTS) + During setup method PINV checks the current u-error by means of carefully + selected test points and improves the approximation where necessary. + However, it nevertheless may happen, that the maximal approximation error + is larger than estimated in some interval (which usually is hit with a very + small probability). This estimate can be improved by using extra test + points which can be added by means of this call. However, this increases + the setup time considerably. Note that these additional points are + selected equidistributed in each subinterval. + + Default is ‘0’ (i.e., no additional test points are used). + + -- Function: int unur_pinv_set_use_upoints (UNUR_PAR* PARAMETERS, int + USE_UPOINTS) + If USE_UPOINTS is ‘TRUE’, then the nodes of the interpolating polynomial + are constructed by means of Chebyshev points in u-scale not in x-scale. + This results is a better approximation but almost doubles the number of PDF + or CDF evaluations during the setup. (This is an experimental feature.) + + Default: ‘FALSE’ + + -- Function: int unur_pinv_set_usepdf (UNUR_PAR* PARAMETERS) + Use PDF (if available) to compute approximate inverse CDF. + + This is the default. + + -- Function: int unur_pinv_set_usecdf (UNUR_PAR* PARAMETERS) + Use CDF (if available) to compute approximate inverse CDF. This variant is + intend for running experiments with method PINV. + + _Remark:_ We ran many experiments and found that for small values of the + given U_RESOLUTION (less than ‘1.e-12’) the setup fails for distributions + with heavy tails. We found that using the PDF (instead of the CDF) is + numerically more stable. This is especially the case when the smoothness + parameter is set to ‘1’ or ‘2’. + + Using the CDF is *not recommended*. + + -- Function: int unur_pinv_set_boundary (UNUR_PAR* PARAMETERS, double LEFT, + double RIGHT) + Set LEFT and RIGHT point for finding the cut-off points for the + "computational domain", i.e., the domain that covers the essential part of + the distribution. The cut-off points are computed such that the tail + probabilities are smaller than given by ‘unur_pinv_set_u_resolution’. It + is usually safe to use a large interval. However, ‘+/- UNUR_INFINITY’ is + not allowed. + + _Important_: This call does not change the domain of the given distribution + itself. But it restricts the domain for the resulting random variates. + + Default: intersection of ‘[-1.e100,+1.e100]’ and the given domain of the + distribution. + + -- Function: int unur_pinv_set_searchboundary (UNUR_PAR* PARAMETERS, int LEFT, + int RIGHT) + If LEFT or RIGHT is set to ‘FALSE’ then the respective boundary as given by + a ‘unur_pinv_set_boundary’ call is used without any further computations. + However, these boundary points might cause numerical problems during the + setup when PDF returns ‘0’ “almost everywhere”. If set to ‘TRUE’ (the + default) then the computational interval is shortened to a more sensible + region by means of a search algorithm. Switching off this search is + useful, e.g., for the Gamma(2) distribution where the left border ‘0’ is + fixed and finite. + + _Remark:_ The searching algorithm assumes that the support of the + distribution is connected. + + _Remark:_ Do not set this parameter to ‘FALSE’ except when searching for + cut-off points fails and one wants to try with precomputed values. + + Default: ‘TRUE’. + + -- Function: int unur_pinv_set_max_intervals (UNUR_PAR* PARAMETERS, int + MAX_IVS) + Set maximum number of intervals. MAX_IVS must be at least ‘100’ and at + most ‘1000000’. + + Default is ‘10000’. + + -- Function: int unur_pinv_get_n_intervals (const UNUR_GEN* GENERATOR) + Get number of intervals used for interpolation in the generator object. It + returns ‘0’ in case of an error. + + -- Function: int unur_pinv_set_keepcdf (UNUR_PAR* PARAMETERS, int KEEPCDF) + If the PDF is given, then the CDF is computed numerically from the given + PDF using adaptive Gauss-Lobatto integration. Thus a table of CDF points + is stored to keep the number of evaluations of the PDF minimal. Usually + this table is discarded when the setup is completed. If KEEPCDF is ‘TRUE’, + then this table is kept and can be used to compute the CDF of the + underlying distribution by means of function ‘unur_pinv_eval_approxcdf’. + This option is ignored when ‘unur_pinv_set_usecdf’ is called. + + Default: ‘FALSE’ + + -- Function: double unur_pinv_eval_approxinvcdf (const UNUR_GEN* GENERATOR, + double U) + Evaluate interpolation of inverse CDF at U. If U is out of the domain + (0,1) then ‘unur_errno’ is set to ‘UNUR_ERR_DOMAIN’ and the respective + bound of the domain of the distribution are returned (which is + ‘-UNUR_INFINITY’ or ‘UNUR_INFINITY’ in the case of unbounded domains). + + -- Function: double unur_pinv_eval_approxcdf (const UNUR_GEN* GENERATOR, double + X) + Evaluate (approximate) CDF at X. If the PDF of the distribution is given, + then adaptive Gauss-Lobatto integration is used to compute the CDF. If the + PDF is used to create the generator object, then the table of integral + values must not removed at the end of setup and thus + ‘unur_pinv_set_keepcdf’ must be called. + + -- Function: int unur_pinv_estimate_error (const UNUR_GEN* GENERATOR, int + SAMPLESIZE, double* MAX_ERROR, double* MAE) + Estimate maximal u-error and mean absolute error (MAE) for GENERATOR by + means of Monte-Carlo simulation with sample size SAMPLESIZE. The results + are stored in MAX_ERROR and MAE, respectively. + + It returns ‘UNUR_SUCCESS’ if successful. + +5.3.13 SROU – Simple Ratio-Of-Uniforms method +--------------------------------------------- + +Required: + T-concave PDF, mode, area +Speed: + Set-up: fast, Sampling: slow +Reinit: + supported +Reference: + [LJa01] [LJa02] [HLD04: Sect.6.3.1; Sect.6.3.2; Sect.6.4.1; Alg.6.4; + Alg.6.5; Alg.6.7] + + SROU is based on the ratio-of-uniforms method (*note Ratio-of-Uniforms::) +that uses universal inequalities for constructing a (universal) bounding +rectangle. It works for all T-concave distributions, including log-concave and +T-concave distributions with T(x) = -1/sqrt(x). + + Moreover an (optional) parameter ‘r’ can be given, to adjust the generator to +the given distribution. This parameter is strongly related to the parameter ‘c’ +for transformed density rejection (*note TDR::) via the formula c = -r/(r+1). +The rejection constant increases with higher values for ‘r’. On the other hand, +the given density must be T_c -concave for the corresponding c. The default +setting for ‘r’ is 1 which results in a very simple code. (For other settings, +sampling uniformly from the acceptance region is more complicated.) + + Optionally the CDF at the mode can be given to increase the performance of +the algorithm. Then the rejection constant is reduced by 1/2 and (if ‘r=1’) +even a universal squeeze can (but need not be) used. A way to increase the +performance of the algorithm when the CDF at the mode is not provided is the +usage of the mirror principle (only if ‘r=1’). However, using squeezes and +using the mirror principle is only recommended when the PDF is expensive to +compute. + + The exact location of the mode and/or the area below the PDF can be replace +by appropriate bounds. Then the algorithm still works but has larger rejection +constants. + +How To Use +.......... + +SROU works for any continuous univariate distribution object with given T_c +-concave PDF with c<1, ) mode and area below PDF. Optional the CDF at the mode +can be given to increase the performance of the algorithm by means of the +‘unur_srou_set_cdfatmode’ call. Additionally squeezes can be used and switched +on via ‘unur_srou_set_usesqueeze’ (only if ‘r=1’). A way to increase the +performance of the algorithm when the CDF at the mode is not provided is the +usage of the mirror principle which can be swithced on by means of a +‘unur_srou_set_usemirror’ call (only if ‘r=1’) . However using squeezes and +using the mirror principle is only recommended when the PDF is expensive to +compute. + + The parameter ‘r’ can be given, to adjust the generator to the given +distribution. This parameter is strongly related parameter ‘c’ for transformed +density rejection via the formula c = -r/(r+1). The parameter ‘r’ can be any +value larger than or equal to 1. Values less then 1 are automatically set to 1. +The rejection constant depends on the chosen parameter ‘r’ but not on the +particular distribution. It is 4 for ‘r’ equal to 1 and higher for higher +values of ‘r’. It is important to note that different algorithms for different +values of ‘r’: If ‘r’ equal to 1 this is much faster than the algorithm for ‘r’ +greater than 1. The default setting for ‘r’ is 1. + + If the (exact) area below the PDF is not known, then an upper bound can be +used instead (which of course increases the rejection constant). But then the +squeeze flag must not be set and ‘unur_srou_set_cdfatmode’ must not be used. + + If the exact location of the mode is not known, then use the approximate +location and provide the (exact) value of the PDF at the mode by means of the +‘unur_srou_set_pdfatmode’ call. But then ‘unur_srou_set_cdfatmode’ must not be +used. Notice, that a (slow) numerical mode finder will be used if no mode is +given at all. It is even possible to give an upper bound for the PDF only. +However, then the (upper bound for the) area below the PDF has to be multiplied +by the ratio between the upper bound and the lower bound of the PDF at the mode. +Again setting the squeeze flag and using ‘unur_srou_set_cdfatmode’ is not +allowed. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. +Notice, that derived parameters like the mode must also be (re-) set if the +parameters or the domain has be changed. Moreover, if the PDF at the mode has +been provided by a ‘unur_srou_set_pdfatmode’ call, additionally +‘unur_srou_chg_pdfatmode’ must be used (otherwise this call is not necessary +since then this figure is computed directly from the PDF). + + There exists a test mode that verifies whether the conditions for the method +are satisfied or not while sampling. It can be switched on by calling +‘unur_srou_set_verify’ and ‘unur_srou_chg_verify’, respectively. Notice however +that sampling is (a little bit) slower then. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_srou_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_srou_set_r (UNUR_PAR* PARAMETERS, double R) + Set parameter R for transformation. Only values greater than or equal to 1 + are allowed. The performance of the generator decreases when R is + increased. On the other hand R must not be set to small, since the given + density must be T_c-concave for c = -r/(r+1). + + _Notice:_ If R is set to ‘1’ a simpler and much faster algorithm is used + then for R greater than one. + + For computational reasons values of R that are greater than ‘1’ but less + than ‘1.01’ are always set to ‘1.01’. + + Default is ‘1’. + + -- Function: int unur_srou_set_cdfatmode (UNUR_PAR* PARAMETERS, double FMODE) + Set CDF at mode. When set, the performance of the algorithm is increased + by factor 2. However, when the parameters of the distribution are changed + ‘unur_srou_chg_cdfatmode’ has to be used to update this value. + + Default: not set. + + -- Function: int unur_srou_set_pdfatmode (UNUR_PAR* PARAMETERS, double FMODE) + Set pdf at mode. When set, the PDF at the mode is never changed. This is + to avoid additional computations, when the PDF does not change when + parameters of the distributions vary. It is only useful when the PDF at + the mode does not change with changing parameters of the distribution. + + _IMPORTANT:_ This call has to be executed after a possible call of + ‘unur_srou_set_r’. Default: not set. + + -- Function: int unur_srou_set_usesqueeze (UNUR_PAR* PARAMETERS, int + USESQUEEZE) + Set flag for using universal squeeze (default: off). Using squeezes is + only useful when the evaluation of the PDF is (extremely) expensive. Using + squeezes is automatically disabled when the CDF at the mode is not given + (then no universal squeezes exist). + + Squeezes can only be used if ‘r=1’. + + Default is ‘FALSE’. + + -- Function: int unur_srou_set_usemirror (UNUR_PAR* PARAMETERS, int USEMIRROR) + Set flag for using mirror principle (default: off). Using the mirror + principle is only useful when the CDF at the mode is not known and the + evaluation of the PDF is rather cheap compared to the marginal generation + time of the underlying uniform random number generator. It is + automatically disabled when the CDF at the mode is given. (Then there is + no necessity to use the mirror principle. However disabling is only done + during the initialization step but not at a re-initialization step.) + + The mirror principle can only be used if ‘r=1’. + + Default is ‘FALSE’. + + -- Function: int unur_srou_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) + -- Function: int unur_srou_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the condition + squeeze(x) <= PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is + set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due + to round-off errors for a few values of x (less than 1%). + + Default is ‘FALSE’. + + -- Function: int unur_srou_chg_cdfatmode (UNUR_GEN* GENERATOR, double FMODE) + Change CDF at mode of distribution. ‘unur_reinit’ must be executed before + sampling from the generator again. + + -- Function: int unur_srou_chg_pdfatmode (UNUR_GEN* GENERATOR, double FMODE) + Change PDF at mode of distribution. ‘unur_reinit’ must be executed before + sampling from the generator again. + +5.3.14 SSR – Simple Setup Rejection +----------------------------------- + +Required: + T-concave PDF, mode, area +Speed: + Set-up: fast, Sampling: slow +Reinit: + supported +Reference: + [LJa01] [HLD04: Sect.6.3.3; Alg.6.6] + + SSR is an acceptance/rejection method that uses universal inequalities for +constructing (universal) hats and squeezes (*note Rejection::). It works for +all T-concave distributions with T(x) = -1/sqrt(x). + + It requires the PDF, the (exact) location of the mode and the area below the +given PDF. The rejection constant is 4 for all T-concave distributions with +unbounded domain and is less than 4 when the domain is bounded. Optionally the +CDF at the mode can be given to increase the performance of the algorithm. Then +the rejection constant is at most 2 and a universal squeeze can (but need not +be) used. However, using squeezes is not recommended unless the evaluation of +the PDF is expensive. + + The exact location of the mode and/or the area below the PDF can be replace +by appropriate bounds. Then the algorithm still works but has larger rejection +constants. + +How To Use +.......... + +SSR works for any continuous univariate distribution object with given T-concave +PDF (with T(x) = -1/sqrt(x),) mode and area below PDF. Optional the CDF at the +mode can be given to increase the performance of the algorithm by means of the +‘unur_ssr_set_cdfatmode’ call. Additionally squeezes can be used and switched +on via ‘unur_ssr_set_usesqueeze’. If the (exact) area below the PDF is not +known, then an upper bound can be used instead (which of course increases the +rejection constant). But then the squeeze flag must not be set and +‘unur_ssr_set_cdfatmode’ must not be used. + + If the exact location of the mode is not known, then use the approximate +location and provide the (exact) value of the PDF at the mode by means of the +‘unur_ssr_set_pdfatmode’ call. But then ‘unur_ssr_set_cdfatmode’ must not be +used. Notice, that a (slow) numerical mode finder will be used if no mode is +given at all. It is even possible to give an upper bound for the PDF only. +However, then the (upper bound for the) area below the PDF has to be multiplied +by the ratio between the upper bound and the lower bound of the PDF at the mode. +Again setting the squeeze flag and using ‘unur_ssr_set_cdfatmode’ is not +allowed. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. +Notice, that derived parameters like the mode must also be (re-) set if the +parameters or the domain has be changed. Moreover, if the PDF at the mode has +been provided by a ‘unur_ssr_set_pdfatmode’ call, additionally +‘unur_ssr_chg_pdfatmode’ must be used (otherwise this call is not necessary +since then this figure is computed directly from the PDF). + + _Important:_ If any of mode, PDF or CDF at the mode, or the area below the +mode has been changed, then ‘unur_reinit’ must be executed. (Otherwise the +generator produces garbage). + + There exists a test mode that verifies whether the conditions for the method +are satisfied or not while sampling. It can be switched on/off by calling +‘unur_ssr_set_verify’ and ‘unur_ssr_chg_verify’, respectively. Notice, however, +that sampling is (a little bit) slower then. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_ssr_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_ssr_set_cdfatmode (UNUR_PAR* PARAMETERS, double FMODE) + Set CDF at mode. When set, the performance of the algorithm is increased + by factor 2. However, when the parameters of the distribution are changed + ‘unur_ssr_chg_cdfatmode’ has to be used to update this value. + + Default: not set. + + -- Function: int unur_ssr_set_pdfatmode (UNUR_PAR* PARAMETERS, double FMODE) + Set pdf at mode. When set, the PDF at the mode is never changed. This is + to avoid additional computations, when the PDF does not change when + parameters of the distributions vary. It is only useful when the PDF at + the mode does not change with changing parameters for the distribution. + + Default: not set. + + -- Function: int unur_ssr_set_usesqueeze (UNUR_PAR* PARAMETERS, int USESQUEEZE) + Set flag for using universal squeeze (default: off). Using squeezes is + only useful when the evaluation of the PDF is (extremely) expensive. Using + squeezes is automatically disabled when the CDF at the mode is not given + (then no universal squeezes exist). + + Default is ‘FALSE’. + + -- Function: int unur_ssr_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) + -- Function: int unur_ssr_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the condition + squeeze(x) <= PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is + set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due + to round-off errors for a few values of x (less than 1%). + + Default is ‘FALSE’. + + -- Function: int unur_ssr_chg_cdfatmode (UNUR_GEN* GENERATOR, double FMODE) + Change CDF at mode of distribution. ‘unur_reinit’ must be executed before + sampling from the generator again. + + -- Function: int unur_ssr_chg_pdfatmode (UNUR_GEN* GENERATOR, double FMODE) + Change PDF at mode of distribution. ‘unur_reinit’ must be executed before + sampling from the generator again. + +5.3.15 TABL – a TABLe method with piecewise constant hats +--------------------------------------------------------- + +Required: + PDF, all local extrema, cut-off values for the tails +Optional: + approximate area +Speed: + Set-up: (very) slow, Sampling: fast +Reinit: + not implemented +Reference: + [AJa93] [AJa95] [HLD04: Cha.5.1] + + TABL (called Ahrens method in [HLD04] ) is an acceptance/rejection method +(*note Rejection::) that uses a decomposition of the domain of the distribution +into many short subintervals. Inside of these subintervals constant hat and +squeeze functions are utilized. Thus it is easy to use the idea of immediate +acceptance for points below the squeeze. This reduces the expected number of +uniform random numbers per generated random variate to less than two. Using a +large number of subintervals only little more than one random number is +necessary on average. Thus this method becomes very fast. + + Due to the constant hat function this method only works for distributions +with bounded domains. Thus for unbounded domains the left and right tails have +to be cut off. This is no problem when the probability of falling into these +tail regions is beyond computational relevance (e.g. smaller than ‘1.e-12’). + + For easy construction of hat and squeeze functions it is necessary to know +the regions of monotonicity (called _slopes_) or equivalently all local maxima +and minima of the density. The main problem for this method in the setup is the +choice of the subintervals. A simple and close to optimal approach is the +"equal area rule" [HLD04: Cha.5.1] . There the subintervals are selected such +that the area below the hat is the same for each subinterval which can be +realized with a simple recursion. If more subintervals are necessary it is +possible to split either randomly chosen intervals (adaptive rejection sampling, +ARS) or those intervals, where the ratio between squeeze and hat is smallest. +This version of the setup is called derandomized ARS (DARS). With the default +settings TABL is first calculating approximately 30 subintervals with the equal +area rule. Then DARS is used till the desired fit of the hat is reached. + + A convenient measure to control the quality of the fit of hat and squeeze is +the ratio (area below squeeze)/(area below hat) called ‘sqhratio’ which must be +smaller or equal to one. The expected number of iterations in the rejection +algorithm is known to be smaller than 1/sqhratio and the expected number of +evaluations of the density is bounded by ‘1/sqhratio - 1’. So values of the +sqhratio close to one (e.g. ‘0.95’ or ‘0.99’) lead to many subintervals. Thus +a better fitting hat is constructed and the sampling algorithm becomes fast; on +the other hand large tables are needed and the setup is very slow. For moderate +values of sqhratio (e.g. ‘0.9’ or ‘0.8’) the sampling is slower but the +required tables are smaller and the setup is not so slow. + + It follows from the above explanations that TABL is always requiring a slow +setup and that it is not very well suited for heavy-tailed distributions. + +How To Use +.......... + +For using the TABL method UNU.RAN needs a bounded interval to which the +generated variates can be restricted and information about all local extrema of +the distribution. For unimodal densities it is sufficient to provide the mode +of the distribution. For the case of a built-in unimodal distribution with +bounded domain all these information is present in the distribution object and +thus no extra input is necessary (see example_TABL1 below). + + For a built-in unimodal distribution with unbounded domain we should specify +the cut-off values for the tails. This can be done with the +‘unur_tabl_set_boundary’ call (see example_TABL2 below). For the case that we +do not set these boundaries the default values of ‘+/- 1.e20’ are used. We can +see in example_TABL1 that this still works fine for many standard distributions. + + For the case of a multimodal distribution we have to set the regions of +monotonicity (called slopes) explicitly using the ‘unur_tabl_set_slopes’ command +(see example_TABL3 below). + + To controll the fit of the hat and the size of the tables and thus the speed +of the setup and the sampling it is most convenient to use the +‘unur_tabl_set_max_sqhratio’ call. The default is ‘0.9’ which is a sensible +value for most distributions and applications. If very large samples of a +distribution are required or the evaluation of a density is very slow it may be +useful to increase the sqhratio to eg. ‘0.95’ or even ‘0.99’. With the +‘unur_tabl_get_sqhratio’ call we can check which sqhratio was really reached. +If that value is below the desired value it is necessary to increase the maximal +number of subintervals, which defaults to ‘1000’, using the +‘unur_tabl_set_max_intervals’ call. The ‘unur_tabl_get_n_intervals’ call can be +used to find out the number of subintervals the setup calculated. + + It is also possible to set the number of intervals and their respective +boundaries by means of the ‘unur_tabl_set_cpoints’ call. + + It is also possible to use method TABL for correlation induction (variance +reduction) by setting of an auxiliary uniform random number generator via the +‘unur_set_urng_aux’ call. (Notice that this must be done after a possible +‘unur_set_urng’ call.) However, this only works when immediate acceptance is +switched off by a ‘unur_tabl_set_variant_ia’ call. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_tabl_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_tabl_set_variant_ia (UNUR_PAR* PARAMETERS, int USE_IA) + Use immediate acceptance when USE_IA is set to ‘TRUE’. This technique + requires less uniform. If it is set to ‘FALSE’, “classical” + acceptance/rejection from hat distribution is used. + + _Notice:_ Auxiliary uniform random number generators for correlation + induction (variance reduction) can only be used when “classical” + acceptance/rejection is used. + + Default: ‘TRUE’. + + -- Function: int unur_tabl_set_cpoints (UNUR_PAR* PARAMETERS, int N_CPOINTS, + const DOUBLE* CPOINTS) + Set construction points for the hat function. If STP is ‘NULL’ than a + heuristic rule of thumb is used to get N_STP construction points. This is + the default behavior. + + The default number of construction points is ‘30’. + + -- Function: int unur_tabl_set_nstp (UNUR_PAR* PARAMETERS, int N_STP) + Set number of construction points for the hat function. N_STP must be + greater than zero. After the setup there are about N_STP construction + points. However it might be larger when a small fraction is given by the + ‘unur_tabl_set_areafraction’ call. It also might be smaller for some + variants. + + Default is ‘30’. + + -- Function: int unur_tabl_set_useear (UNUR_PAR* PARAMETERS, int USEEAR) + If USEEAR is set to ‘TRUE’, the “equal area rule” is used, the given slopes + are partitioned in such a way that the area below the hat function in each + subinterval (“stripe”) has the same area (except the last the last interval + which can be smaller). The area can be set by means of the + ‘unur_tabl_set_areafraction’ call. + + Default is ‘TRUE’. + + -- Function: int unur_tabl_set_areafraction (UNUR_PAR* PARAMETERS, double + FRACTION) + Set parameter for the equal area rule. During the setup a piecewise + constant hat is constructed, such that the area below each of these pieces + (strips) is the same and equal to the (given) area below the PDF times + FRACTION (which must be greater than zero). + + _Important:_ If the area below the PDF is not set in the distribution + object, then 1 is assumed. + + Default is ‘0.1’. + + -- Function: int unur_tabl_set_usedars (UNUR_PAR* PARAMETERS, int USEDARS) + If USEDARS is set to ‘TRUE’, “derandomized adaptive rejection sampling” + (DARS) is used in the setup. Intervals, where the area between hat and + squeeze is too large compared to the average area between hat and squeeze + over all intervals, are split. This procedure is repeated until the ratio + between squeeze and hat exceeds the bound given by + ‘unur_tabl_set_max_sqhratio’ call or the maximum number of intervals is + reached. Moreover, it also aborts when no more intervals can be found for + splitting. + + For finding splitting points the arc-mean rule (a mixture of arithmetic + mean and harmonic mean) is used. + + Default is ‘TRUE’. + + -- Function: int unur_tabl_set_darsfactor (UNUR_PAR* PARAMETERS, double FACTOR) + Set factor for “derandomized adaptive rejection sampling”. This factor is + used to determine the segments that are “too large”, that is, all segments + where the area between squeeze and hat is larger than FACTOR times the + average area over all intervals between squeeze and hat. Notice that all + segments are split when FACTOR is set to ‘0.’, and that there is no + splitting at all when FACTOR is set to ‘UNUR_INFINITY’. + + Default is ‘0.99’. There is no need to change this parameter. + + -- Function: int unur_tabl_set_variant_splitmode (UNUR_PAR* PARAMETERS, + unsigned SPLITMODE) + There are three variants for adaptive rejection sampling. These differ in + the way how an interval is split: + splitmode ‘1’ + use the generated point to split the interval. + splitmode ‘2’ + use the mean point of the interval. + splitmode ‘3’ + use the arcmean point; suggested for distributions with heavy tails. + + Default is splitmode ‘2’. + + -- Function: int unur_tabl_set_max_sqhratio (UNUR_PAR* PARAMETERS, double + MAX_RATIO) + Set upper bound for the ratio (area below squeeze) / (area below hat). It + must be a number between 0 and 1. When the ratio exceeds the given number + no further construction points are inserted via DARS in the setup. + + For the case of ARS (unur_tabl_set_usedars() must be set to ‘FALSE’): Use + ‘0’ if no construction points should be added after the setup. Use ‘1’ if + added new construction points should not be stopped until the maximum + number of construction points is reached. If MAX_RATIO is close to one, + many construction points are used. + + Default is ‘0.9’. + + -- Function: double unur_tabl_get_sqhratio (const UNUR_GEN* GENERATOR) + Get the current ratio (area below squeeze) / (area below hat) for the + generator. (In case of an error ‘UNUR_INFINITY’ is returned.) + + -- Function: double unur_tabl_get_hatarea (const UNUR_GEN* GENERATOR) + Get the area below the hat for the generator. (In case of an error + ‘UNUR_INFINITY’ is returned.) + + -- Function: double unur_tabl_get_squeezearea (const UNUR_GEN* GENERATOR) + Get the area below the squeeze for the generator. (In case of an error + ‘UNUR_INFINITY’ is returned.) + + -- Function: int unur_tabl_set_max_intervals (UNUR_PAR* PARAMETERS, int + MAX_IVS) + Set maximum number of intervals. No construction points are added in or + after the setup when the number of intervals suceeds MAX_IVS. + + Default is ‘1000’. + + -- Function: int unur_tabl_get_n_intervals (const UNUR_GEN* GENERATOR) + Get the current number of intervals. (In case of an error 0 is returned.) + + -- Function: int unur_tabl_set_slopes (UNUR_PAR* PARAMETERS, const DOUBLE* + SLOPES, int N_SLOPES) + Set slopes for the PDF. A slope is an interval [a,b] or [b,a] where + the PDF is monotone and PDF(a) >= PDF(b). The list of slopes is given by + an array SLOPES where each consecutive tuple (i.e. ‘(slopes[0], + slopes[1])’, ‘(slopes[2], slopes[3])’, etc.) defines one slope. Slopes + must be sorted (i.e. both ‘slopes[0]’ and ‘slopes[1]’ must not be greater + than any entry of the slope ‘(slopes[2], slopes[3])’, etc.) and must not + be overlapping. Otherwise no slopes are set and UNUR_ERRNO is set to + ‘UNUR_ERR_PAR_SET’. + + _Notice:_ N_SLOPES is the number of slopes (and not the length of the array + SLOPES). + + _Notice_ that setting slopes resets the given domain for the distribution. + However, in case of a standard distribution the area below the PDF is not + updated. + + -- Function: int unur_tabl_set_guidefactor (UNUR_PAR* PARAMETERS, double + FACTOR) + Set factor for relative size of the guide table for indexed search (see + also method DGT *note DGT::). It must be greater than or equal to ‘0’. + When set to ‘0’, then sequential search is used. + + Default is ‘1’. + + -- Function: int unur_tabl_set_boundary (UNUR_PAR* PARAMETERS, double LEFT, + double RIGHT) + Set the left and right boundary of the computation interval. The piecewise + hat is only constructed inside this interval. The probability outside of + this region must not be of computational relevance. Of course ‘+/- + UNUR_INFINITY’ is not allowed. + + Default is ‘-1.e20,1.e20’. + + -- Function: int unur_tabl_chg_truncated (UNUR_GEN* GEN, double LEFT, double + RIGHT) + Change the borders of the domain of the (truncated) distribution. + + Notice that the given truncated domain must be a subset of the domain of + the given distribution. The generator always uses the intersection of the + domain of the distribution and the truncated domain given by this call. + The hat function will not be changed. + + _Important:_ The ratio between the area below the hat and the area below + the squeeze changes when the sampling region is restricted. In particalur + it becomes (very) large when sampling from the (far) tail of the + distribution. Then it is better to create a generator object for the tail + of distribution only. + + _Important:_ This call does not work for variant ‘IA’ (immediate + acceptance). In this case UNU.RAN switches _automatically_ to variant ‘RH’ + (use “classical” acceptance/rejection from hat distribution) and does + revert to the variant originally set by the user. + + _Important:_ It is not a good idea to use adaptave rejection sampling while + sampling from a domain that is a strict subset of the domain that has been + used to construct the hat. For that reason adaptive adding of construction + points is _automatically disabled_ by this call. + + _Important:_ If the CDF of the hat is (almost) the same for LEFT and RIGHT + and (almost) equal to ‘0’ or ‘1’, then the truncated domain is not changed + and the call returns an error code. + + -- Function: int unur_tabl_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) + -- Function: int unur_tabl_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the condition + squeeze(x) <= PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is + set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due + to round-off errors for a few values of x (less than 1%). + + Default is ‘FALSE’. + + -- Function: int unur_tabl_set_pedantic (UNUR_PAR* PARAMETERS, int PEDANTIC) + Sometimes it might happen that ‘unur_init’ has been executed successfully. + But when additional construction points are added by adaptive rejection + sampling, the algorithm detects that the PDF is not monotone in the given + slopes. + + With PEDANTIC being ‘TRUE’, the sampling routine is exchanged by a routine + that simply returns ‘UNUR_INFINITY’ indicating an error. + + Default is ‘FALSE’. + +5.3.16 TDR – Transformed Density Rejection +------------------------------------------ + +Required: + T-concave PDF, dPDF +Optional: + mode +Speed: + Set-up: slow, Sampling: fast +Reinit: + supported +Reference: + [GWa92] [HWa95] [HLD04: Cha.4] + + TDR is an acceptance/rejection method that uses the concavity of a +transformed density to construct hat function and squeezes automatically. Such +PDFs are called T-concave. Currently the following transformations are +implemented and can be selected by setting their ‘c’-values by a +‘unur_tdr_set_c’ call: + +‘c = 0’ + T(x) = log(x) +‘c = -0.5’ + T(x) = -1/sqrt(x) (Default) + + In future releases the transformations T(x) = -(x)^c will be available for +any c with 0 > c > -1. Notice that if a PDF is T-concave for a c then it also +T-concave for every c’ + + /* ------------------------------------------------------------- */ + + /* Example how to sample from an empirial continuous univariate */ + /* distribution. */ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; + double x; + + /* data points */ + double data[15] = { -0.1, 0.05, -0.5, 0.08, 0.13,\ + -0.21,-0.44, -0.43, -0.33, -0.3, \ + 0.18, 0.2, -0.37, -0.29, -0.9 }; + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create a distribution object and set empirical sample. */ + distr = unur_distr_cemp_new(); + unur_distr_cemp_set_data(distr, data, 15); + + /* Choose a method: EMPK. */ + par = unur_empk_new(distr); + + /* Set smooting factor. */ + unur_empk_set_smoothing(par, 0.8); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + +Example (String API) +-------------------- + + /* ------------------------------------------------------------- */ + /* File: example_emp_str.c */ + /* ------------------------------------------------------------- */ + /* String API. */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* Example how to sample from an empirial continuous univariate */ + /* distribution. */ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; + double x; + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + gen = unur_str2gen("distr = cemp; \ + data=(-0.10, 0.05,-0.50, 0.08, 0.13, \ + -0.21,-0.44,-0.43,-0.33,-0.30, \ + 0.18, 0.20,-0.37,-0.29,-0.90) & \ + method=empk; smoothing=0.8"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + +5.4.1 EMPK – EMPirical distribution with Kernel smoothing +--------------------------------------------------------- + +Required: + observed sample +Speed: + Set-up: slow (as sample is sorted), Sampling: fast (depends on kernel) +Reinit: + not implemented +Reference: + [HLa00] [HLD04: Sect.12.1.2] + + EMPK generates random variates from an empirical distribution that is given +by an observed sample. The idea is that simply choosing a random point from the +sample and to return it with some added noise results in a method that has very +nice properties, as it can be seen as sampling from a kernel density estimate. +If the underlying distribution is continuous, especially the fine structur of +the resulting empirical distribution is much better than using only resampling +without noise. + + Clearly we have to decide about the density of the noise (called kernel) and +about the standard deviation of the noise. The mathematical theory of kernel +density estimation shows us that we are comparatively free in choosing the +kernel. It also supplies us with a simple formula to compute the optimal +standarddeviation of the noise, called bandwidth (or window width) of the +kernel. + + The variance of the estimated density is slightly larger than that of the +observed sample. However, this can be easily corrected if required. + + There is also a correction (mirroring technique) for distributions with +non-negative support. + + A simple robust reference method is implemented to find a good standard +deviation of the noise (i.e. the bandwidth of kernel density estimation). For +some cases (e.g. densities with two or more sharp distinct peaks) there kernel +density estimation can be adjusted by changing the smoothness factor and the so +called beta factor. + +How To Use +.......... + +EMPK uses empirical distributions. The main parameter is the choice if of +kernel density. The most important kernels can be set by +‘unur_empk_set_kernel’. Additionally generators for other kernels can be used +by using ‘unur_empk_set_kernelgen’ instead. Additionally variance correction +and a correction for non-negative variates can be switched on. + + The two other parameters (smoothing factor and beta factor) are only useful +for people knowing the theory of kernel density estimation. It is not necessary +to change them if the true underlying distribution is somehow comparable with a +bell-shaped curve, even skewed or with some not too sharp extra peaks. In all +these cases the simple robust reference method implemented to find a good +standard deviation of the noise (i.e. the bandwidth of kernel density +estimation) should give sensible results. However, it might be necessary to +overwrite this automatic method to find the bandwidth eg. when resampling from +data with two or more sharp distinct peaks. Then the distribution has nearly +discrete components as well and our automatic method may easily choose too large +a bandwidth which results in an empirical distribution which is oversmoothed +(i.e. it has lower peaks than the original distribution). Then it is +recommended to decrease the bandwidth using the ‘unur_empk_set_smoothing’ call. +A smoothing factor of ‘1’ is the default. A smoothing factor of ‘0’ leads to +naive resampling of the data. Thus an appropriate value between these extremes +should be choosen. We recommend to consult a reference on kernel smoothing when +doing so; but it is not a simple problem to determine an optimal bandwidth for +distributions with sharp peaks. + + In general, for most applications it is perfectly ok to use the default +values offered. Unless you have some knowledge on density estimation we do not +recommend to change anything. There are two exceptions: + + A. In the case that the unknown underlying distribution is not continuous but + discrete you should "turn off" the adding of the noise by setting: + + unur_empk_set_smoothing(par, 0.) + + B. In the case that you are especially interested in a fast sampling algorithm + use the call + unur_empk_set_kernel(par, UNUR_DISTR_BOXCAR); + to change the used noise distribution from the default Gaussian + distribution to the uniform distribution. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_empk_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_empk_set_kernel (UNUR_PAR* PARAMETERS, unsigned KERNEL) + Select one of the supported kernel distributions. Currently the following + kernels are supported: + + ‘UNUR_DISTR_GAUSSIAN’ + Gaussian (normal) kernel + ‘UNUR_DISTR_EPANECHNIKOV’ + Epanechnikov kernel + ‘UNUR_DISTR_BOXCAR’ + Boxcar (uniform, rectangular) kernel + ‘UNUR_DISTR_STUDENT’ + t3 kernel (Student’s distribution with 3 degrees of freedom) + ‘UNUR_DISTR_LOGISTIC’ + logistic kernel + + For other kernels (including kernels with Student’s distribution with other + than 3 degrees of freedom) use the ‘unur_empk_set_kernelgen’ call. + + It is not possible to call ‘unur_empk_set_kernel’ twice. + + Default is the Gaussian kernel. + + -- Function: int unur_empk_set_kernelgen (UNUR_PAR* PARAMETERS, const UNUR_GEN* + KERNELGEN, double ALPHA, double KERNELVAR) + Set generator for the kernel used for density estimation. + + ALPHA is used to compute the optimal bandwidth from the point of view of + minimizing the mean integrated square error (MISE). It depends on the + kernel K and is given by + alpha(K) = Var(K)^(-2/5){ \int K(t)^2 dt}^(1/5) + For standard kernels (see above) alpha is computed by the algorithm. + + KERNVAR is the variance of the used kernel. It is only required for the + variance corrected version of density estimation (which is used by + default); otherwise it is ignored. If KERNELVAR is nonpositive, variance + correction is disabled. For standard kernels (see above) KERNVAR is + computed by the algorithm. + + It is not possible to call ‘unur_empk_set_kernelgen’ after a standard + kernel has been selected by a ‘unur_empk_set_kernel’ call. + + Notice that the uniform random number generator of the kernel generator is + overwritten during the ‘unur_init’ call and at each ‘unur_chg_urng’ call + with the uniform generator used for the empirical distribution. + + Default is the Gaussian kernel. + + -- Function: int unur_empk_set_beta (UNUR_PAR* PARAMETERS, double BETA) + BETA is used to compute the optimal bandwidth from the point of view of + minimizing the mean integrated square error (MISE). BETA depends on the + (unknown) distribution of the sampled data points. By default Gaussian + distribution is assumed for the sample (BETA = 1.3637439). There is no + requirement to change BETA. + + Default: ‘1.3637439’ + + -- Function: int unur_empk_set_smoothing (UNUR_PAR* PARAMETERS, double + SMOOTHING) + -- Function: int unur_empk_chg_smoothing (UNUR_GEN* GENERATOR, double + SMOOTHING) + Set and change the smoothing factor. The smoothing factor controlles how + “smooth” the resulting density estimation will be. A smoothing factor + equal to ‘0’ results in naive resampling. A very large smoothing factor + (together with the variance correction) results in a density which is + approximately equal to the kernel. Default is 1 which results in a + smoothing parameter minimising the MISE (mean integrated squared error) if + the data are not too far away from normal. If a large smoothing factor is + used, then variance correction must be switched on. + + Default: ‘1’ + + -- Function: int unur_empk_set_varcor (UNUR_PAR* PARAMETERS, int VARCOR) + -- Function: int unur_empk_chg_varcor (UNUR_GEN* GENERATOR, int VARCOR) + Switch variance correction in generator on/off. If VARCOR is ‘TRUE’ then + the variance of the used density estimation is the same as the sample + variance. However this increases the MISE of the estimation a little bit. + + Default is ‘FALSE’. + + -- Function: int unur_empk_set_positive (UNUR_PAR* PARAMETERS, int POSITIVE) + If POSITIVE is ‘TRUE’ then only nonnegative random variates are generated. + This is done by means of a mirroring technique. + + Default is ‘FALSE’. + +5.4.2 EMPL – EMPirical distribution with Linear interpolation +------------------------------------------------------------- + +Required: + observed sample +Speed: + Set-up: slow (as sample is sorted), Sampling: very fast (inversion) +Reinit: + not implemented +Reference: + [HLa00] [HLD04: Sect.12.1.3] + + EMPL generates random variates from an empirical distribution that is given +by an observed sample. This is done by linear interpolation of the empirical +CDF. Although this method is suggested in the books of Law and Kelton (2000) and +Bratly, Fox, and Schrage (1987) we do not recommend this method at all since it +has many theoretical drawbacks: The variance of empirical distribution function +does not coincide with the variance of the given sample. Moreover, when the +sample increases the empirical density function does not converge to the density +of the underlying random variate. Notice that the range of the generated point +set is always given by the range of the given sample. + + This method is provided in UNU.RAN for the sake of completeness. We always +recommend to use method EMPK (*note EMPirical distribution with Kernel +smoothing: EMPK.). + + If the data seem to be far away from having a bell shaped histogram, then we +think that naive resampling is still better than linear interpolation. + +How To Use +.......... + +EMPL creates and samples from an empiral distribution by linear interpolation of +the empirical CDF. There are no parameters to set. + +_Important_: We do not recommend to use this method! Use method EMPK (*note +EMPirical distribution with Kernel smoothing: EMPK.) instead. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_empl_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + +5.4.3 HIST – HISTogramm of empirical distribution +------------------------------------------------- + +Required: + histogram +Speed: + Set-up: moderate, Sampling: fast +Reinit: + not implemented + + Method HIST generates random variates from an empirical distribution that is +given as histogram. Sampling is done using the inversion method. + + If observed (raw) data are provided we recommend method EMPK (*note EMPirical +distribution with Kernel smoothing: EMPK.) instead of compting a histogram as +this reduces information. + +How To Use +.......... + +Method HIST uses empirical distributions that are given as a histgram. There +are no optional parameters. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_hist_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + +5.5 Methods for continuous multivariate distributions +===================================================== + +Overview of methods +------------------- + +Methods for continuous multivariate distributions +sample with ‘unur_sample_vec’ + +NORTA: Requires rank correlation matrix and marginal distributions. +VNROU: Requires the PDF. +MVSTD: Generator for built-in standard distributions. +MVTDR: Requires PDF and gradiant of PDF. + +5.5.1 MVSTD – MultiVariate continuous STandarD distributions +------------------------------------------------------------ + +Required: + standard distribution from UNU.RAN library (*note Standard distributions: + Stddist.). +Speed: + depends on distribution and generator +Reinit: + supported + + MVSTD is a wrapper for special generators for multivariate continuous +standard distributions. It only works for distributions in the UNU.RAN library +of standard distributions (*note Standard distributions: Stddist.). If a +distribution object is provided that is build from scratch, or if no special +generator for the given standard distribution is provided, the ‘NULL’ pointer is +returned. + +How To Use +.......... + +Create a distribution object for a standard distribution from the UNU.RAN +library (*note Standard distributions: Stddist.). + + Sampling from truncated distributions (which can be constructed by changing +the default domain of a distribution by means of +‘unur_distr_cvec_set_domain_rect’ call) is not possible. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_mvstd_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for new generator. It requires a distribution + object for a multivariate continuous distribution from the UNU.RAN library + of standard distributions (*note Standard distributions: Stddist.). Using + a truncated distribution is not possible. + +5.5.2 MVTDR – Multi-Variate Transformed Density Rejection +--------------------------------------------------------- + +Required: + log-concave (log)PDF, gradient of (log)PDF +Optional: + mode +Speed: + Set-up: slow, Sampling: depends on dimension +Reinit: + not implemented +Reference: + [HLD04: Sect.11.3.4; Alg.11.15.] [LJa98] + + MVTDR a multivariate version of the Transformed Density Rection (*note TDR::) +that works for log-concave densities. For this method the domain of the +distribution is partitioned into cones with the mode (or the center) of the +distribution as their (common) vertex. The hat function is then constructed as +tangent planes of the transformed density in each of these cones. The +respective construction points lie on the central lines in the cones through the +vertex. The point is chosen such that the hat is minimal among all such points +(see the given references for more details). + + The cones are created by starting with the orthants of the reals space. +These are then iteratively split when the volume below the hat in such cones is +too large. Thus an increasing number of cones results in a better fitting hat +function. Notice however, that the required number of cones increases +exponentially with the number of dimension. Moreover, due to the construction +the rejection does not converge to 1 and remains strictly larger than 1. + + For distributions with bounded domains the cones are cut to pyramids that +cover the domain. + +How To Use +.......... + +Create a multivariate generator object that contains the PDF and its gradient. +This object also should contain the mode of the distribution (or a point nearby +should be provided as center of the distribution). + + The method has three parameter to adjust the method for the given +distribution: + +‘stepsmin’ + Minimal number of iterations for splitting cones. Notice that we start + with 2^dim initial cones and that we arrive at 2^(dim+stepsmin) cones after + these splits. So this number must be set with care. It can be set by a + ‘unur_mvtdr_set_stepsmin’ call. + +‘boundsplitting’ + Cones where the volume below the hat is relatively large (i.e. larger than + the average volume over all cones times ‘boundsplitting’ are further split. + This parameter can set via a ‘unur_mvtdr_set_boundsplitting’ call. + +‘maxcones’ + The maximum number of generated cones. When this number is reached, the + initialization routine is stopped. Notice that the rejection constant can + be still prohibitive large. This parameter can set via a + ‘unur_mvtdr_set_maxcones’ call. + + Setting of these parameter can be quite tricky. The default settings lead to +hat functions where the volume below the hat is similar in each cone. However, +there might be some problems with distributions with higher correlations, since +then too few cones are created. Then it might be necessary to increase the +values for ‘stepsmin’ and ‘maxcones’ and to set ‘boundsplitting’ to ‘0’. + + The number of cones and the total volume below the hat can be controlled +using the respective calls ‘unur_mvtdr_get_ncones’ and ‘unur_mvtdr_get_hatvol’. +Notice, that the rejection constant is bounded from below by some figure (larger +than 1) that depends on the dimension. + + Unfortunately, the algorithm cannot detect the quality of the constructed +hat. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_mvtdr_new (const UNUR_DISTR* DISTRIBUTION) + Get parameters for generator. + + -- Function: int unur_mvtdr_set_stepsmin (UNUR_PAR* PARAMETERS, int STEPSMIN) + Set minimum number of triangulation step for each starting cone. STEPSMIN + must be nonnegative. + + Default: ‘5’. + + -- Function: int unur_mvtdr_set_boundsplitting (UNUR_PAR* PARAMETERS, double + BOUNDSPLITTING) + Set bound for splitting cones. All cones are split which have a volume + below the hat that is greater than BOUND_SPLITTING times the average over + all volumes. However, the number given by the ‘unur_mvtdr_set_maxcones’ is + not exceeded. Notice that the later number is always reached if + BOUND_SPLITTING is less than 1. + + Default: ‘1.5’ + + -- Function: int unur_mvtdr_set_maxcones (UNUR_PAR* PARAMETERS, int MAXCONES) + Set maximum number of cones. + + Notice that this number is always increased to 2^(dim+stepsmin) where dim + is the dimension of the distribution object and stepsmin the given mimimum + number of triangulation steps. + + Notice: For higher dimensions and/or higher correlations between the + coordinates of the random vector the required number of cones can be very + high. A too small maximum number of cones can lead to a very high + rejection constant. + + Default: ‘10000’. + + -- Function: int unur_mvtdr_get_ncones (const UNUR_GEN* GENERATOR) + Get the number of cones used for the hat function of the GENERATOR. (In + case of an error ‘0’ is returned.) + + -- Function: double unur_mvtdr_get_hatvol (const UNUR_GEN* GENERATOR) + Get the volume below the hat for the GENERATOR. (In case of an error + ‘UNUR_INFINITY’ is returned.) + + -- Function: int unur_mvtdr_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) + -- Function: int unur_mvtdr_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the condition + squeeze(x) <= PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is + set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due + to round-off errors for a few values of x (less than 1%). + + Default is ‘FALSE’. + +5.5.3 NORTA – NORmal To Anything +-------------------------------- + +Required: + rank correlation matrix, marginal distributions +Speed: + Set-up: slow, Sampling: depends on dimension +Reinit: + not implemented +Reference: + [HLD04: Sect.12.5.2; Alg.12.11.] + + NORTA (NORmal to anything) is a model to get random vectors with given +marginal distributions and rank correlation. + + *Important:* Notice that marginal distribution and (rank) correlation +structure do not uniquely define a multivariate distribution. Thus there are +many other (more or less sensible) models. + + In the NORTA model multinormal random variates with the given (Spearman’s) +rank correlations are generated. In a second step the (standard normal +distributed) marginal variates are transformed by means of the CDF of the normal +distribution to get uniform marginals. The resulting random vectors have +uniform marginals and the desired rank correlation between its components. Such +a random vector is called ’copula’. + + By means of the inverse CDF the uniform marginals are then transformed into +the target marginal distributions. This transformation does not change the rank +correlation. + + For the generation of the multinormal distribution the (Spearman’s) rank +correlation matrix is transformed into the corresponding (Pearson) correlation +matrix. Samples from the resulting multinormal distribution are generated by +means of the Cholesky decomposition of the covariance matrix. + + It can happen that the desired rank correlation matrix is not feasible, i.e., +it cannot occur as rank correlation matrix of a multinormal distribution. The +resulting "covariance" matrix is not positive definite. In this case an +eigenvector correction method is used. Then all non-positive eigenvalues are +set to a small positive value and hence the rank correlation matrix of the +generated random vectors is "close" to the desired matrix. + +How To Use +.......... + +Create a multivariate generator object and set marginal distributions using +‘unur_distr_cvec_set_marginals’, ‘unur_distr_cvec_set_marginal_array’ , or +‘unur_distr_cvec_set_marginal_list’. (Do not use the corresponding calls for +the standard marginal distributions). + + When the domain of the multivariate distribution is set by of a +‘unur_distr_cvec_set_domain_rect’ call then the domain of each of the marginal +distributions is truncated by the respective coordinates of the given rectangle. + + If copulae are required (i.e. multivariate distributions with uniform +marginals) such a generator object can be created by means of +‘unur_distr_copula’ . + + There are no optional parameters for this method. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_norta_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + +5.5.4 VNROU – Multivariate Naive Ratio-Of-Uniforms method +--------------------------------------------------------- + +Required: + PDF +Optional: + mode, center, bounding rectangle for acceptance region +Speed: + Set-up: fast or slow, Sampling: slow +Reinit: + supported +Reference: + [WGS91] + + VNROU is an implementation of the multivariate ratio-of-uniforms method which +uses a (minimal) bounding hyper-rectangle, see also *note Ratio-of-Uniforms::. +It uses an additional parameter r that can be used for adjusting the algorithm +to the given distribution to improve performance and/or to make this method +applicable. Larger values of r increase the class of distributions for which +the method works at the expense of higher rejection constants. Moreover, this +implementation uses the center mu of the distribution (which is set to the mode +or mean by default, see ‘unur_distr_cvec_get_center’ for details of its default +values). + + The minimal bounding has then the coordinates + v^+ = sup_(x) (f(x))^(1/r d+1), + u^-_i = inf_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), + u^+_i = sup_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), + +where x_i is the i-th coordinate of point x; mu_i is the i-th coordinate of the +center mu. d denotes the dimension of the distribution. These bounds can either +be given directly, or are computed automatically by means of an numerical +routine by Hooke and Jeeves [HJa61] called direct search (see +‘src/utils/hooke.c’ for further references and details). Of course this +algorithm can fail, especially when this rectangle is not bounded. + + It is important to note that the algorithm works with PDF(x-center) instead +of PDF(x), i.e. the bounding rectangle has to be provided for PDF(x-center). +This is important as otherwise the acceptance region can become a very long and +skinny ellipsoid along a diagonal of the (huge) bounding rectangle. + + VNROU is based on the rejection method (*note Rejection::), and it is +important to note that the acceptance probability decreases exponentially with +dimension. Thus even for moderately many dimensions (e.g. 5) the number of +repetitions to get one random vector can be prohibitively large and the +algorithm seems to stay in an infinite loop. + +How To Use +.......... + +For using the VNROU method UNU.RAN needs the PDF of the distribution. +Additionally, the parameter r can be set via a ‘unur_vnrou_set_r’ call. Notice +that the acceptance probability decreases when r is increased. On the other +hand is is more unlikely that the bounding rectangle does not exist if r is +small. + + A bounding rectangle can be given by the ‘unur_vnrou_set_u’ and +‘unur_vnrou_set_v’ calls. + + _Important:_ The bounding rectangle has to be provided for the function +PDF(x-center)! Notice that ‘center’ is the center of the given distribution, see +‘unur_distr_cvec_set_center’. If in doubt or if this value is not optimal, it +can be changed (overridden) by a ‘unur_distr_cvec_set_center’ call. + + If the coordinates of the bounding rectangle are not provided by the user +then the minimal bounding rectangle is computed automatically. + + By means of ‘unur_vnrou_set_verify’ and ‘unur_vnrou_chg_verify’ one can run +the sampling algorithm in a checking mode, i.e., in every cycle of the rejection +loop it is checked whether the used rectangle indeed enclosed the acceptance +region of the distribution. When in doubt (e.g., when it is not clear whether +the numerical routine has worked correctly) this can be used to run a small +Monte Carlo study. + + *Important:* The rejection constant (i.e. the expected number of iterations +for generationg one random vector) can be extremely high, in particular when the +dimension is 4 or higher. Then the algorithm will perform almost infinite +loops. Thus it is recommended to read the volume below the hat function by +means of the ‘unur_vnrou_get_volumehat’ call. The returned number divided by +the volume below the PDF (which is 1 in case of a normalized PDF) gives the +rejection constant. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. +Notice, that the coordinates of a bounding rectangle given by ‘unur_vnrou_set_u’ +and ‘unur_vnrou_set_v’ calls are used also when the generator is reused. These +can be changed by means of ‘unur_vnrou_chg_u’ and ‘unur_vnrou_chg_v’ calls. (If +no such coordinates have been given, then they are computed numerically during +the reinitialization proceedure.) + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_vnrou_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_vnrou_set_u (UNUR_PAR* PARAMETERS, double* UMIN, double* + UMAX) + Sets left and right boundaries of bounding hyper-rectangle. If no values + are given, the boundary of the minimal bounding hyper-rectangle is computed + numerically. + + *Important*: The boundaries are those of the density shifted by the center + of the distribution, i.e., for the function PDF(x-center)! + + _Notice_: Computing the minimal bounding rectangle may fail under some + circumstances. Moreover, for multimodal distributions the bounds might be + too small as only local extrema are computed. Nevertheless, for + log-concave distributions it should work. + + Default: not set (i.e. computed automatically) + + -- Function: int unur_vnrou_chg_u (UNUR_GEN* GENERATOR, double* UMIN, double* + UMAX) + Change left and right boundaries of bounding hyper-rectangle. + + -- Function: int unur_vnrou_set_v (UNUR_PAR* PARAMETERS, double VMAX) + Set upper boundary for bounding hyper-rectangle. If no values are given, + the density at the mode is evaluated. If no mode is given for the + distribution it is computed numerically (and might fail). + + Default: not set (i.e. computed automatically) + + -- Function: int unur_vnrou_chg_v (UNUR_GEN* GENERATOR, double VMAX) + Change upper boundary for bounding hyper-rectangle. + + -- Function: int unur_vnrou_set_r (UNUR_PAR* PARAMETERS, double R) + Sets the parameter R of the generalized multivariate ratio-of-uniforms + method. + + _Notice_: This parameter must satisfy R>0. + + Default: ‘1’. + + -- Function: int unur_vnrou_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) + Turn verifying of algorithm while sampling on/off. + + If the condition PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ + is set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen + due to round-off errors for a few values of x (less than 1%). + + Default is ‘FALSE’. + + -- Function: int unur_vnrou_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Change the verifying of algorithm while sampling on/off. + + -- Function: double unur_vnrou_get_volumehat (const UNUR_GEN* GENERATOR) + Get the volume of below the hat. For normalized densities, i.e. when the + volume below PDF is 1, this value equals the rejection constant for the + vnrou method. + + In case of an error UNUR_INFINITY is returned. + +5.6 Markov chain samplers for continuous multivariate distributions +=================================================================== + +Markov chain samplers generate sequences of random vectors which have the target +distribution as stationary distribution. There generated vectors are (more or +less) correlated and it might take a long time until the sequence has converged +to the given target distribution. + + *Beware: MCMC sampling can be dangerous!* + +Overview of methods +------------------- + +Markov Chain Methods for continuous multivariate distributions +sample with ‘unur_sample_vec’ + +GIBBS: T-concave logPDF and derivatives of logPDF. +HITRO: Requires PDF. + +5.6.1 GIBBS – Markov Chain - GIBBS sampler +------------------------------------------ + +Required: + T-concave logPDF, derivatives of logPDF +Speed: + Set-up: fast, Sampling: moderate +Reinit: + not implemented +Reference: + [HLD04: Sect.14.1.2] + + Method GIBBS implements a Gibbs sampler for a multivariate distribution with +given joint density and its gradient. When running such a Markov chain all +coordinates are updated cyclically using full conditional distributions. After +each step the state of the chain is returned (i.e., a random point is returned +whenever a single coordinate has been updated). It is also possible to return +only points after all coordinates have been updated by "thinning" the chain. +Moreover, to reduce autocorrelation this thinning factor can be any integer. +Notice, however, that the sampling time for a chain of given length is increased +by the same factor, too. + + GIBBS also provides a variant of the Gibbs sampler where in each step a point +from the full conditional distribution along some random direction is sampled. +This direction is chosen uniformly from the sphere in each step. This method is +also known as Hit-and-Run algorithm for non-uniform distributions. + + Our experiences shows that the original Gibbs sampler with sampling along +coordinate axes is superior to random direction sampling as long as the +correlations between the components of the random vector are not too high. + + For both variants transformed density rejection (see methods *note TDR:: and +*note ARS::) is used to sample from the full conditional distributions. In +opposition to the univariate case, it is important that the factor ‘c’ is as +large as possible. I.e., for a log-concave density ‘c’ must be set to ‘0.’, +since otherwise numerical underflow might stop the algorithm. + + _Important:_ GIBBS does not generate independent random points. The starting +point of the Gibbs chain must be in a "typical" region of the target +distribution. If such a point is not known or would be too expensive, then the +first part of the chain should be discarded (burn-in of the chain). + +How To Use +.......... + +For using the GIBBS method UNU.RAN needs the logarithm of the PDF of the +multivariate joint distribution and its gradient or partial derivatives. + + It provides two variants: +_coordinate direction sampling (Gibbs sampling) [default]_ + The coordinates are updated cyclically. It requires the partial + derivatives of the (logarithm of the) PDF of the target distribution, see + ‘unur_distr_cvec_set_pdlogpdf’. Otherwise, the gradient of the logPDF (see + ‘unur_distr_cvec_set_dlogpdf’ ) is used, which is more expensive. + + This variant can be selected using ‘unur_gibbs_set_variant_coordinate’. +_random direction sampling (nonuniform Hit-and-Run algorithm)_ + In each step is a direction is sampled uniformly from the sphere and the + next point in the chain is sampled from the full conditional distribution + along this direction. + + It requires the gradient of the logPDF and thus each step is more expensive + than each step for coordinate direction sampling. + + This variant can be selected using + ‘unur_gibbs_set_variant_random_direction’. + + It is important that the ‘c’ parameter for the TDR method is as large as +possible. For logconcave distribution it must be set to ‘0’, since otherwise +numerical underflow can cause the algorithm to stop. + + The starting point of the Gibbs chain must be "typical" for the target +distribution. If such a point is not known or would be too expensive, then the +first part of the chain should be discarded (burn-in of the chain). When using +the ‘unur_gibbs_set_burnin’ call this is done during the setup of the Gibbs +sampler object. + + In case of a fatal error in the generator for conditional distributions the +methods generates points that contain UNUR_INFINITY. + + *Warning:* The algorithm requires that all full conditionals for the given +distribution object are T-concave. However, this property is not checked. If +this property is not satisfied, then generation from the conditional +distributions becomes (very) slow and might fail or (even worse) produces random +vectors from an incorrect distribution. When using ‘unur_gibbs_set_burnin’ then +the setup already might fail. Thus when in doubt whether GIBBS can be used for +the targent distribution it is a good idea to use a burn-in for checking. + + _Remark:_ It might happen (very rarely) that the chain becomes stuck due to +numerical errors. (This is in particular the case when the given PDF does not +fulfill the condition of this method.) When this happens during burn-in then +the setup is aborted (i.e. it fails). Otherwise the chain restarts again from +its starting point. + + *Warning:* Be carefull with debugging flags. If it contains flag +‘0x01000000u’ it produces a lot of output for each step in the algorithm. (This +flag is switched of in the default debugging flags). + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_gibbs_new (const UNUR_DISTR* DISTRIBUTION) + ........................................................................... + + -- Function: int unur_gibbs_set_variant_coordinate (UNUR_PAR* PARAMETERS) + Coordinate Direction Sampling: Sampling along the coordinate directions + (cyclic). + + This is the default. + + -- Function: int unur_gibbs_set_variant_random_direction (UNUR_PAR* PARAMETERS) + Random Direction Sampling: Sampling along the random directions. + + -- Function: int unur_gibbs_set_c (UNUR_PAR* PARAMETERS, double C) + Set parameter C for transformation T of the transformed density rejection + method. Currently only values between ‘0’ and ‘-0.5’ are allowed. If ‘c’ + is between ‘0’ and ‘-0.5’ it is set to ‘-0.5’. + + For C ‘=0’ (for logconcave densities) method ARS (*note ARS::) is used + which is very robust against badly normalized PDFs. For other values + method TDR (*note TDR::) is used. + + The value for C should be as large as possible to avoid fatal numerical + underflows. Thus for log-concave distributions C must be set to ‘0.’ + + Default is ‘0’. + + -- Function: int unur_gibbs_set_startingpoint (UNUR_PAR* PARAMETERS, const + DOUBLE* X0) + Sets the starting point of the Gibbs sampler. X0 must be a "typical" point + of the given distribution. If such a "typical" point is not known and a + starting point is merely guessed, the first part of the Gibbs chain should + be discarded (_burn-in_), e.g.\ by mean of the ‘unur_gibbs_set_burnin’ + call. + + Default is the result of ‘unur_distr_cvec_get_center’ for the given + distribution object. + + -- Function: int unur_gibbs_set_thinning (UNUR_PAR* PARAMETERS, int THINNING) + Sets the THINNING parameter. When THINNING is set to k then every k-th + point from the iteration is returned by the sampling algorithm. + + _Notice_: This parameter must satisfy THINNING>=1. + + Default: ‘1’. + + -- Function: int unur_gibbs_set_burnin (UNUR_PAR* PARAMETERS, int BURNIN) + If a "typical" point for the target distribution is not known but merely + guessed, the first part of the Gibbs chain should be discarded (_burn-in_). + This can be done during the initialization of the generator object. The + length of the burn-in can is then BURNIN. + + When method GIBBS is not applicable for the target distribution then the + initialization already might fail during the burn-in. Thus this reduces + the risk of running a generator that returns UNUR_INFINITY cased by some + fatal error during sampling. + + The thinning factor set by a ‘unur_gibbs_set_thinning’ call has no effect + on the length of the burn-in, i.e., for the burn-in always a thinning + factor ‘1’ is used. + + _Notice_: This parameter must satisfy THINNING>=0. + + Default: ‘0’. + + -- Function: const double* unur_gibbs_get_state (UNUR_GEN* GENERATOR) + -- Function: int unur_gibbs_chg_state (UNUR_GEN* GENERATOR, const DOUBLE* + STATE) + Get and change the current state of the Gibbs chain. + + -- Function: int unur_gibbs_reset_state (UNUR_GEN* GENERATOR) + Reset state of chain to starting point. + + _Notice:_ Currently this function does not reset the generators for + conditional distributions. Thus it is not possible to get the same Gibbs + chain even when the underlying uniform random number generator is reset. + +5.6.2 HITRO – Markov Chain - HIT-and-run sampler with Ratio-Of-uniforms +----------------------------------------------------------------------- + +Required: + PDF +Optional: + mode, center, bounding rectangle for acceptance region +Speed: + Set-up: fast, Sampling: fast +Reinit: + not implemented +Reference: + [KLPa05] + + HITRO is an implementation of a hit-and-run sampler that runs on the +acceptance region of the multivariate ratio-of-uniforms method, see *note +Ratio-of-Uniforms::. + + The Ratio-of-Uniforms transforms the region below the density into some +region that we call "region of acceptance" in the following. The minimal +bounding hyperrectangle of this region is given by + v^+ = sup_(x) (f(x))^(1/r d+1), + u^-_i = inf_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), + u^+_i = sup_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), + +where d denotes the dimension of the distribution; x_i is the i-th coordinate of +point x; mu_i is the i-th coordinate of the center mu of the distribution, i.e., +a point in the "main region" of the distribution. Using the center is +important, since otherwise the acceptance region can become a very long and +skinny ellipsoid along a diagonal of the (huge) bounding rectangle. + + For each step of the Hit-and-Run algorithm we have to choose some direction. +This direction together with the current point of the chain determines a +straight line. Then a point is sampled uniformly on intersection of this line +and the region of acceptance. This is done by rejection from a uniform +distribution on a line segment that covers it. Depending of the chosen variant +the endpoints of this covering line are computed either by means of a (not +necessary minimal) bounding hyper-rectangle, or just the "covering plate" of the +bounding hyper-rectangle. + + The required bounds of the hyper-rectable can be given directly by the user. +Otherwise, these are computed automatically by means of a numerical routine by +Hooke and Jeeves [HJa61] called direct search (see ‘src/utils/hooke.c’ for +further references and details). However, this expensive computation can be +avoided by determine these bounds "on the fly" by the following adaptive +algorithm: Start with some (small) hyper-rectangle and enlarge it whenever the +endpoints of the covering line segment are not contained in the acceptance +region of the Ratio-of-Unfiorms method. This approach works reliable as long as +the region of acceptance is convex. + + The performance of the uniform sampling from the line segment is much +improved if the covering line is adjusted (shortened) whenever a point is +rejected (adaptive sampling). This technique reduces the expected number of +iterations enormously. + + Method HITRO requires that the region of acceptance of the Ratio-of-Uniforms +method is bounded. The shape of this region can be controlled by a parameter r. +Higher values of r result in larger classes of distributions with bounded region +of acceptance. (A distribution that has such a bounded region for some r also +has a bounded region for every r’ greater than r.) On the other hand the +acceptance probability decreases with increasing r. Moreover, round-off errors +are more likely and (for large values of r) might result in a chain with a +stationary distribution different from the target distribution. + + Method HITRO works optimal for distributions whose region of acceptance is +convex. This is in particular the case for all log-concave distributions when +we set r = ‘1’. For bounded but non-convex regions of acceptance convergence is +yet not guarenteed by mathematical theory. + +How To Use +.......... + +Method HITRO requires the PDF of the target distribution (derivatives are not +necessary). + + The acceptance region of the Ratio-of-Uniforms transformation must be +bounded. Its shape is controlled by parameter r. By default this parameter is +set to ‘1’ as this guarentees a convex region of acceptance when the PDF of the +given distribution is log-concave. It should only be set to a different +(higher!) value using ‘unur_vnrou_set_r’ if otherwise x_i (f(x))^(r/r d+1) were +not bounded for each coordinate. + + There are two variants of the HITRO sampler: +_coordinate direction sampling. [default]_ + The coordinates are updated cyclically. This can be seen as a Gibbs + sampler running on the acceptance region of the Ratio-of-Uniforms method. + This variant can be selected using ‘unur_hitro_set_variant_coordinate’. +_random direction sampling._ + In each step is a direction is sampled uniformly from the sphere. + + This variant can be selected using + ‘unur_hitro_set_variant_random_direction’. + + Notice that each iteration of the coordinate direction sampler is cheaper +than an iteration of the random direction sampler. + + Sampling uniformly from the line segment can be adjusted in several ways: + +_Adaptive line sampling vs. simple rejection._ + When adaptive line sampling is switched on, the covering line is shortened + whenever a point is rejected. However, when the region of acceptance is + not convex the line segment from which we have to sample might not be + connected. We found that the algorithm still works but at the time being + there is no formal proof that the generated Markov chain has the required + stationary distribution. + + Adaptive line sampling can switch on/off by means of the + ‘unur_hitro_set_use_adaptiveline’ call. + +_Bounding hyper-rectangle vs. "covering plate"._ + For computing the covering line we can use the bounding hyper-rectangle or + just its upper bound. The latter saves computing time during the setup and + when computing the covering during at each iteration step at the expense of + a longer covering line. When adaptive line sampling is used the total + generation time for the entire chain is shorter when only the "covering + plate" is used. + + _Notice:_ When coordinate sampling is used the entire bounding rectangle is + used. + + Using the entire bounding hyper-rectangle can be switched on/off by means + of the ‘unur_hitro_set_use_boundingrectangle’ call. + +_Deterministic vs. adaptive bounding hyper-rectangle._ + A bounding rectangle can be given by the ‘unur_vnrou_set_u’ and + ‘unur_vnrou_set_v’ calls. Otherwise, the minimal bounding rectangle is + computed automatically during the setup by means of a numerical algorithm. + However, this is (very) slow especially in higher dimensions and it might + happen that this algorithm (like any other numerical algorithm) does not + return a correct result. + + Alternatively the bounding rectangle can be computed adaptively. In the + latter case ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ can be used to + provide a starting rectangle which must be sufficiently small. Then both + endpoints of the covering line segment are always check whether they are + outside the acceptance region of the Ratio-of-Uniforms method. If they are + not, then the line segment and the ("bounding") rectangle are enlarged + using a factor that can be given using the + ‘unur_hitro_set_adaptive_multiplier’ call. + + Notice, that running this method in the adaptive rectangle mode requires + that the region of acceptance is convex when random directions are used, or + the given PDF is unimodal when coordinate direction sampling is used. + Moreover, it requires two additional calls to the PDF in each iteration + step of the chain. + + Using addaptive bounding rectangles can be switched on/off by means of the + ‘unur_hitro_set_use_adaptiverectangle’ call. + + The algorithm takes of a bounded rectangular domain given by a +‘unur_distr_cvec_set_domain_rect’ call, i.e. the PDF is set to zero for every x +outside the given domain. However, it is only the coordinate direction sampler +where the boundary values are directly used to get the endpoins of the coverline +line for the line sampling step. + + _Important:_ The bounding rectangle has to be provided for the function +PDF(x-center)! Notice that ‘center’ is the center of the given distribution, see +‘unur_distr_cvec_set_center’. If in doubt or if this value is not optimal, it +can be changed (overridden) by a ‘unur_distr_cvec_set_center’ call. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_hitro_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_hitro_set_variant_coordinate (UNUR_PAR* PARAMETERS) + Coordinate Direction Sampling: Sampling along the coordinate directions + (cyclic). + + _Notice:_ For this variant the entire bounding rectangle is always used + independent of the ‘unur_hitro_set_use_boundingrectangle’ call. + + This is the default. + + -- Function: int unur_hitro_set_variant_random_direction (UNUR_PAR* PARAMETERS) + Random Direction Sampling: Sampling along the random directions. + + -- Function: int unur_hitro_set_use_adaptiveline (UNUR_PAR* PARAMETERS, int + ADAPTIVE) + When ADAPTIVE is set to ‘TRUE’ adaptive line sampling is applied, otherwise + simple rejection is used. + + _Notice:_ When adaptive line sampling is switched off, the entire bounding + rectangle must be used since otherwise the sampling time can be arbitrarily + slow. + + _Warning:_ When adaptive line sampling is switched off, sampling can be + arbitrarily slow. In particular this happens when random direction + sampling is used for distributions with rectangular domains. Then the + algorithm can be trapped into a vertex (or even edge). + + Default is ‘TRUE’. + + -- Function: int unur_hitro_set_use_boundingrectangle (UNUR_PAR* PARAMETERS, + int RECTANGLE) + When RECTANGLE is set to ‘TRUE’ the entire bounding rectangle is used for + computing the covering line. Otherwise, only an upper bound for the + acceptance region is used. + + _Notice:_ When coordinate sampling is used the entire bounding rectangle + has is always used and this call has no effect. + + Default: ‘FALSE’ for random direction samplig, ‘TRUE’ for coordinate + direction sampling. + + -- Function: int unur_hitro_set_use_adaptiverectangle (UNUR_PAR* PARAMETERS, + int ADAPTIVE) + When ADAPTIVE is set to ‘FALSE’ the bounding rectangle is determined during + the setup. Either, it is computed automatically by a (slow) numerical + method, or it must be provided by ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ + calls. + + If ADAPTIVE is set to ‘TRUE’ the bounding rectangle is computed adaptively. + In this case the ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ calls can be + used to provide a starting rectangle. This should be sufficiently small. + If not given then we assume v_(max) = 1, + u_(min)=(-0.001,-0.001,...,-0.001), and u_(max)=(0.001,0.001,...,0.001). + Adaptive enlargements of the bounding hyperrectangle can be controlled set + setting an enlargement factor given by a + ‘unur_hitro_set_adaptive_multiplier’ call. + + Using adaptive computation of the bounding rectangle reduces the setup time + significantly (when it is not given by the user) at the expense of two + additional PDF evaluations during each iteration step. + + _Important:_ Using adaptive bounding rectangles requires that the region of + acceptance is convex when random directions are used, or a unimodal PDF + when coordinate direction sampling is used. + + Default: ‘FALSE’ for random direction samplig, ‘TRUE’ for coordinate + direction sampling. + + -- Function: int unur_hitro_set_r (UNUR_PAR* PARAMETERS, double R) + Sets the parameter R of the generalized multivariate ratio-of-uniforms + method. + + _Notice_: This parameter must satisfy R>0. + + Default: ‘1’. + + -- Function: int unur_hitro_set_v (UNUR_PAR* PARAMETERS, double VMAX) + Set upper boundary for bounding hyper-rectangle. If not set not set the + mode of the distribution is used. + + If adaptive bounding rectangles the value is used for the starting + rectangle. If not given (and the mode of the distribution is not known) + then VMAX=‘1e-3’ is used. + + If deterministic bounding rectangles these values are the given values are + used for the rectangle. If no value is given (and the mode of the + distribution is not known), the upper bound of the minimal bounding + hyper-rectangle is computed numerically (slow). + + Default: not set. + + -- Function: int unur_hitro_set_u (UNUR_PAR* PARAMETERS, const DOUBLE* UMIN, + const DOUBLE* UMAX) + Sets left and right boundaries of bounding hyper-rectangle. + + If adaptive bounding rectangles these values are used for the starting + rectangle. If not given then UMIN=‘{-b,-b,...,-b}’ and UMAX=‘{b,b,...,b}’ + with ‘b=1.e-3’ is used. + + If deterministic bounding rectangles these values are the given values are + used for the rectangle. If no values are given, the boundary of the + minimal bounding hyper-rectangle is computed numerically (slow). + + *Important*: The boundaries are those of the density shifted by the center + of the distribution, i.e., for the function PDF(x-center)! + + _Notice_: Computing the minimal bounding rectangle may fail under some + circumstances. Moreover, for multimodal distributions the bounds might be + too small as only local extrema are computed. Nevertheless, for + log-concave distributions it should work. + + Default: not set. + + -- Function: int unur_hitro_set_adaptive_multiplier (UNUR_PAR* PARAMETERS, + double FACTOR) + Adaptive enlargements of the bounding hyperrectangle can be controlled set + setting the enlargement FACTOR. This must be greater than 1. Values close + to 1 result in small adaptive steps and thus reduce the risk of too large + bounding rectangles. On the other hand many adaptive steps might be + necessary. + + _Notice:_ For practical reasons this call does not accept values for FACTOR + less than ‘1.0001’. If this value is UNUR_INFINITY this results in + infinite loops. + + Default: ‘1.1’ + + -- Function: int unur_hitro_set_startingpoint (UNUR_PAR* PARAMETERS, const + DOUBLE* X0) + Sets the starting point of the HITRO sampler in the original scale. X0 + must be a "typical" point of the given distribution. If such a "typical" + point is not known and a starting point is merely guessed, the first part + of the HITRO chain should be discarded (_burn-in_), e.g.\ by mean of the + ‘unur_hitro_set_burnin’ call. + + _Important:_ The PDF of the distribution must not vanish at the given point + X0. + + Default is the result of ‘unur_distr_cvec_get_center’ for the given + distribution object. + + -- Function: int unur_hitro_set_thinning (UNUR_PAR* PARAMETERS, int THINNING) + Sets the THINNING parameter. When THINNING is set to k then every k-th + point from the iteration is returned by the sampling algorithm. If + thinning has to be set such that each coordinate is updated when using + coordinate direction sampling, then THINNING should be ‘dim+1’ (or any + multiple of it) where ‘dim’ is the dimension of the distribution object. + + _Notice_: This parameter must satisfy THINNING>=1. + + Default: ‘1’. + + -- Function: int unur_hitro_set_burnin (UNUR_PAR* PARAMETERS, int BURNIN) + If a "typical" point for the target distribution is not known but merely + guessed, the first part of the HITRO chain should be discarded (_burn-in_). + This can be done during the initialization of the generator object. The + length of the burn-in can is then BURNIN. + + The thinning factor set by a ‘unur_hitro_set_thinning’ call has no effect + on the length of the burn-in, i.e., for the burn-in always a thinning + factor ‘1’ is used. + + _Notice_: This parameter must satisfy THINNING>=0. + + Default: ‘0’. + + -- Function: const double* unur_hitro_get_state (UNUR_GEN* GENERATOR) + -- Function: int unur_hitro_chg_state (UNUR_GEN* GENERATOR, const DOUBLE* + STATE) + Get and change the current state of the HITRO chain. + + _Notice:_ The state variable contains the point in the ‘dim+1’ dimensional + point in the (tansformed) region of acceptance of the Ratio-of-Uniforms + method. Its coordinate are stored in the following order: ‘state[] = {v, + u1, u2, ..., udim}’. + + If the state can only be changed if the given STATE is inside this region. + + -- Function: int unur_hitro_reset_state (UNUR_GEN* GENERATOR) + Reset state of chain to starting point. + + _Notice:_ Currently this function does not reset the generators for + conditional distributions. Thus it is not possible to get the same HITRO + chain even when the underlying uniform random number generator is reset. + +5.7 Methods for continuous empirical multivariate distributions +=============================================================== + +Overview of methods +------------------- + +Methods for continuous empirical multivariate distributions +sample with ‘unur_sample_vec’ + +VEMPK: Requires an observed sample. + +Example +------- + + /* ------------------------------------------------------------- */ + /* File: example_vemp.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* Example how to sample from an empirial continuous */ + /* multivariate distribution. */ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; + + /* 4 data points of dimension 2 */ + double data[] = { 1. ,1., /* 1st data point */ + -1.,1., /* 2nd data point */ + 1.,-1., /* 3rd data point */ + -1.,-1. }; /* 4th data point */ + + double result[2]; + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create a distribution object with dimension 2. */ + distr = unur_distr_cvemp_new( 2 ); + + /* Set empirical sample. */ + unur_distr_cvemp_set_data(distr, data, 4); + + /* Choose a method: VEMPK. */ + par = unur_vempk_new(distr); + + /* Use variance correction. */ + unur_vempk_set_varcor( par, 1 ); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + unur_sample_vec(gen, result); + printf("(%f,%f)\n", result[0], result[1]); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + +Example (String API) +-------------------- + +(not implemented) + +5.7.1 VEMPK – (Vector) EMPirical distribution with Kernel smoothing +------------------------------------------------------------------- + +Required: + observed sample +Speed: + Set-up: slow, Sampling: slow (depends on dimension) +Reinit: + not implemented +Reference: + [HLa00] [HLD04: Sect.12.2.1] + + VEMPK generates random variates from a multivariate empirical distribution +that is given by an observed sample. The idea is that simply choosing a random +point from the sample and to return it with some added noise results in a method +that has very nice properties, as it can be seen as sampling from a kernel +density estimate. Clearly we have to decide about the density of the noise +(called kernel) and about the covariance matrix of the noise. The mathematical +theory of kernel density estimation shows us that we are comparatively free in +choosing the kernel. It also supplies us with a simple formula to compute the +optimal standarddeviation of the noise, called bandwidth (or window width) of +the kernel. + + Currently only a Gaussian kernel with the same covariance matrix as the given +sample is implemented. However it is possible to choose between a variance +corrected version or those with optimal MISE. Additionally a smoothing factor +can be set to adjust the estimated density to non-bell-shaped data densities. + +How To Use +.......... + +VEMPK uses empirical distributions. The main parameter would be the choice if +of kernel density. However, currently only Gaussian kernels are supported. The +parameters for the density are computed by a simple but robust method. However, +it is possible to control its behavior by changing the smoothing factor. +Additionally, variance correction can be swithed on (at the price of suboptimal +MISE). + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_vempk_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_vempk_set_smoothing (UNUR_PAR* PARAMETERS, double + SMOOTHING) + -- Function: int unur_vempk_chg_smoothing (UNUR_GEN* GENERATOR, double + SMOOTHING) + Set and change the smoothing factor. The smoothing factor controlles how + “smooth” the resulting density estimation will be. A smoothing factor + equal to 0 results in naive resampling. A very large smoothing factor + (together with the variance correction) results in a density which is + approximately equal to the kernel. Default is 1 which results in a + smoothing parameter minimising the MISE (mean integrated squared error) if + the data are not too far away from normal. If a large smoothing factor is + used, then variance correction must be switched on. + + Default: ‘1’ + + -- Function: int unur_vempk_set_varcor (UNUR_PAR* PARAMETERS, int VARCOR) + -- Function: int unur_vempk_chg_varcor (UNUR_GEN* GENERATOR, int VARCOR) + Switch variance correction in generator on/off. If VARCOR is ‘TRUE’ then + the variance of the used density estimation is the same as the sample + variance. However this increases the MISE of the estimation a little bit. + + Default is ‘FALSE’. + +5.8 Methods for discrete univariate distributions +================================================= + +Overview of methods +------------------- + +Methods for discrete univariate distributions +sample with ‘unur_sample_discr’ + +method PMF PV mode sum other +DARI x x ~ T-concave +DAU [x] x +DEXT wrapper for external generator +DGT [x] x +DSROU x x x T-concave +DSS [x] x x +DSTD build-in standard distribution + +Example +------- + + /* ------------------------------------------------------------- */ + /* File: example_discr.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* Example how to sample from a discrete univariate distribution.*/ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; + double param = 0.3; + + double probvec[10] = {1.0, 2.0, 3.0, 4.0, 5.0,\ + 6.0, 7.0, 8.0, 4.0, 3.0}; + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr1, *distr2; /* distribution objects */ + UNUR_PAR *par1, *par2; /* parameter objects */ + UNUR_GEN *gen1, *gen2; /* generator objects */ + + /* First distribution: defined by PMF. */ + distr1 = unur_distr_geometric(¶m, 1); + unur_distr_discr_set_mode(distr1, 0); + + /* Choose a method: DARI. */ + par1 = unur_dari_new(distr1); + gen1 = unur_init(par1); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen1 == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Second distribution: defined by (finite) PV. */ + distr2 = unur_distr_discr_new(); + unur_distr_discr_set_pv(distr2, probvec, 10); + + /* Choose a method: DGT. */ + par2 = unur_dgt_new(distr2); + gen2 = unur_init(par2); + if (gen2 == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* print some random integers */ + for (i=0; i<10; i++){ + printf("number %d: %d\n", i*2, unur_sample_discr(gen1) ); + printf("number %d: %d\n", i*2+1, unur_sample_discr(gen2) ); + } + + /* Destroy all objects. */ + unur_distr_free(distr1); + unur_distr_free(distr2); + unur_free(gen1); + unur_free(gen2); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + +Example (String API) +-------------------- + + /* ------------------------------------------------------------- */ + /* File: example_discr_str.c */ + /* ------------------------------------------------------------- */ + /* String API. */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* Example how to sample from a discrete univariate distribution.*/ + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + + /* Declare UNURAN generator objects. */ + UNUR_GEN *gen1, *gen2; /* generator objects */ + + + /* First distribution: defined by PMF. */ + gen1 = unur_str2gen("geometric(0.3); mode=0 & method=dari"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen1 == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Second distribution: defined by (finite) PV. */ + gen2 = unur_str2gen( + "distr=discr; pv=(1,2,3,4,5,6,7,8,4,3) & method=dgt"); + if (gen2 == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* print some random integers */ + for (i=0; i<10; i++){ + printf("number %d: %d\n", i*2, unur_sample_discr(gen1) ); + printf("number %d: %d\n", i*2+1, unur_sample_discr(gen2) ); + } + + /* Destroy all objects. */ + unur_free(gen1); + unur_free(gen2); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + +5.8.1 DARI – Discrete Automatic Rejection Inversion +--------------------------------------------------- + +Required: + T-concave PMF, mode, approximate area +Speed: + Set-up: moderate, Sampling: fast +Reinit: + supported +Reference: + [HDa96] [HLD04: Sect.10.2; Alg.10.4] + + DARI is based on rejection inversion, which can be seen as an adaptation of +transformed density rejection to discrete distributions. The used +transformation is -1/sqrt(x) . + + DARI uses three almost optimal points for constructing the (continuous) hat. +Rejection is then done in horizontal direction. Rejection inversion uses only +one uniform random variate per trial. + + DARI has moderate set-up times (the PMF is evaluated nine times), and good +marginal speed, especially if an auxiliary array is used to store values during +generation. + + DARI works for all T_(-1/2) -concave distributions. It requires the PMF and +the location of the mode. Moreover the approximate sum over the PMF is used. +(If no sum is given for the distribution the algorithm assumes that it is +approximately 1.) The rejection constant is bounded from above by 4 for all +T-concave distributions. + +How To Use +.......... + +DARI works for discrete distribution object with given PMF. The sum over +probabilities should be approximately one. Otherwise it must be set by a +‘unur_distr_discr_set_pmfsum’ call to its (approximate) value. + + The size of an auxiliary table can be set by ‘unur_dari_set_tablesize’. The +expected number of evaluations can be reduced by switching the use of squeezes +by means of ‘unur_dari_set_squeeze’. It is possible to change the parameters +and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize +the generator object. Notice, that derived parameters like the mode must also +be (re-) set if the parameters or the domain has be changed. + + There exists a test mode that verifies whether the conditions for the method +are satisfied or not. It can be switched on by calling ‘unur_dari_set_verify’ +and ‘unur_dari_chg_verify’, respectively. Notice however that sampling is +(much) slower then. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_dari_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_dari_set_squeeze (UNUR_PAR* PARAMETERS, int SQUEEZE) + Turn utilization of the squeeze of the algorithm on/off. This squeeze does + not resamble the squeeze of the continuous TDR method. It was especially + designed for rejection inversion. + + The squeeze is not necessary if the size of the auxiliary table is big + enough (for the given distribution). Using a squeeze is suggested to speed + up the algorithm if the domain of the distribution is very big or if only + small samples are produced. + + Default: no squeeze. + + -- Function: int unur_dari_set_tablesize (UNUR_PAR* PARAMETERS, int SIZE) + Set the size for the auxiliary table, that stores constants computed during + generation. If SIZE is set to ‘0’ no table is used. The speed-up can be + impressive if the PMF is expensive to evaluate and the “main part of the + distribution” is concentrated in an interval shorter than the size of the + table. + + Default is ‘100’. + + -- Function: int unur_dari_set_cpfactor (UNUR_PAR* PARAMETERS, double + CP_FACTOR) + Set factor for position of the left and right construction point, resp. + The CP_FACTOR is used to find almost optimal construction points for the + hat function. The CP_FACTOR must be positive and should not exceed 2. + There is no need to change this factor in almost all situations. + + Default is ‘0.664’. + + -- Function: int unur_dari_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) + -- Function: int unur_dari_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the condition is + violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. + However notice that this might happen due to round-off errors for a few + values of x (less than 1%). + + Default is ‘FALSE’. + +5.8.2 DAU – (Discrete) Alias-Urn method +--------------------------------------- + +Required: + probability vector (PV) +Speed: + Set-up: slow (linear with the vector-length), Sampling: very fast +Reinit: + supported +Reference: + [WAa77] [HLD04: Sect.3.2] + + DAU samples from distributions with arbitrary but finite probability vectors +(PV) of length N. The algorithmus is based on an ingeneous method by A.J. Walker +and requires a table of size (at least) N. It needs one random numbers and only +one comparison for each generated random variate. The setup time for +constructing the tables is O(N). + + By default the probability vector is indexed starting at ‘0’. However this +can be changed in the distribution object by a ‘unur_distr_discr_set_domain’ +call. + + The method also works when no probability vector but a PMF is given. However +then additionally a bounded (not too large) domain must be given or the sum over +the PMF (see ‘unur_distr_discr_make_pv’ for details). + +How To Use +.......... + +Create an object for a discrete distribution either by setting a probability +vector or a PMF. The performance can be slightly influenced by setting the size +of the used table which can be changed by ‘unur_dau_set_urnfactor’. It is +possible to change the parameters and the domain of the chosen distribution and +run ‘unur_reinit’ to reinitialize the generator object. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_dau_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_dau_set_urnfactor (UNUR_PAR* PARAMETERS, double FACTOR) + Set size of urn table relative to length of the probability vector. It + must not be less than 1. Larger tables result in (slightly) faster + generation times but require a more expensive setup. However sizes larger + than 2 are not recommended. + + Default is ‘1’. + +5.8.3 DEXT – wrapper for Discrete EXTernal generators +----------------------------------------------------- + +Required: + routine for sampling discrete random variates +Speed: + depends on external generator +Reinit: + supported + + Method DEXT is a wrapper for external generators for discrete univariate +distributions. It allows the usage of external random variate generators within +the UNU.RAN framework. + +How To Use +.......... + +The following steps are required to use some external generator within the +UNU.RAN framework (some of these are optional): + + 1. Make an empty generator object using a ‘unur_dext_new’ call. The argument + DISTRIBUTION is optional and can be replaced by ‘NULL’. However, it is + required if you want to pass parameters of the generated distribution to + the external generator or for running some validation tests provided by + UNU.RAN. + + 2. Create an initialization routine of type ‘int (*init)(UNUR_GEN *gen)’ and + plug it into the generator object using the ‘unur_dext_set_init’ call. + Notice that the INIT routine must return ‘UNUR_SUCCESS’ when it has been + executed successfully and ‘UNUR_FAILURE’ otherwise. It is possible to get + the size of and the pointer to the array of parameters of the underlying + distribution object by the respective calls ‘unur_dext_get_ndistrparams’ + and ‘unur_dext_get_distrparams’. Parameters for the external generator + that are computed in the INIT routine can be stored in a single array or + structure which is available by the ‘unur_dext_get_params’ call. + + Using an INIT routine is optional and can be omitted. + + 3. Create a sampling routine of type ‘int (*sample)(UNUR_GEN *gen)’ and plug + it into the generator object using the ‘unur_dext_set_sample’ call. + + Uniform random numbers are provided by the ‘unur_sample_urng’ call. Do not + use your own implementation of a uniform random number generator directly. + If you want to use your own random number generator we recommend to use the + UNU.RAN interface (see *note Using uniform random number generators: + URNG.). + + The array or structure that contains parameters for the external generator + that are computed in the INIT routine are available using the + ‘unur_dext_get_params’ call. + + Using a SAMPLE routine is of course obligatory. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. The +INIT routine is then called again. + + Here is a short example that demonstrates the application of this method by +means of the geometric distribution: + + /* ------------------------------------------------------------- */ + /* File: example_dext.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + + /* This example shows how an external generator for the */ + /* geometric distribution can be used within the UNURAN */ + /* framework. */ + /* */ + /* Notice, that this example does not provide the simplest */ + /* solution. */ + + /* ------------------------------------------------------------- */ + /* Initialization routine. */ + /* */ + /* Here we simply read the parameter of the geometric */ + /* distribution and store it in an array for parameters of */ + /* the external generator. */ + /* [ Of course we could do this in the sampling routine as */ + /* and avoid the necessity of this initialization routine. ] */ + + int geometric_init (UNUR_GEN *gen) + { + /* Get pointer to parameters of geometric distribution */ + double *params = unur_dext_get_distrparams(gen); + + /* The parameter is the first entry (see manual) */ + double p = params[0]; + + /* Get array to store this parameter for external generator */ + double *genpar = unur_dext_get_params(gen, sizeof(double)); + genpar[0] = p; + + /* Executed successfully */ + return UNUR_SUCCESS; + } + + /* ------------------------------------------------------------- */ + /* Sampling routine. */ + /* */ + /* Contains the code for the external generator. */ + + int geometric_sample (UNUR_GEN *gen) + { + /* Get scale parameter */ + double *genpar = unur_dext_get_params(gen,0); + double p = genpar[0]; + + /* Sample a uniformly distributed random number */ + double U = unur_sample_urng(gen); + + /* Transform into geometrically distributed random variate */ + return ( (int) (log(U) / log(1.-p)) ); + } + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + int K; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use predefined geometric distribution with parameter 1/10 */ + double fpar[1] = { 0.1 }; + distr = unur_distr_geometric(fpar, 1); + + /* Use method DEXT */ + par = unur_dext_new(distr); + + /* Set initialization and sampling routines. */ + unur_dext_set_init(par, geometric_init); + unur_dext_set_sample(par, geometric_sample); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) { + K = unur_sample_discr(gen); + printf("%d\n",K); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_dext_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for new generator. + + -- Function: int unur_dext_set_init (UNUR_PAR* PARAMETERS, int (* + INIT)(UNUR_GEN* gen )) + Set initialization routine for external generator. Inside the + + _Important:_ The routine INIT must return ‘UNUR_SUCCESS’ when the generator + was initialized successfully and ‘UNUR_FAILURE’ otherwise. + + Parameters that are computed in the INIT routine can be stored in an array + or structure that is avaiable by means of the ‘unur_dext_get_params’ call. + Parameters of the underlying distribution object can be obtained by the + ‘unur_dext_get_distrparams’ call. + + -- Function: int unur_dext_set_sample (UNUR_PAR* PARAMETERS, int (* + SAMPLE)(UNUR_GEN* gen )) + Set sampling routine for external generator. + + _Important:_ Use ‘unur_sample_urng(gen)’ to get a uniform random number. + The pointer to the array or structure that contains the parameters that are + precomputed in the INIT routine are available by + ‘unur_dext_get_params(gen,0)’. Additionally one can use the + ‘unur_dext_get_distrparams’ call. + + -- Function: void* unur_dext_get_params (UNUR_GEN* GENERATOR, size_t SIZE) + Get pointer to memory block for storing parameters of external generator. + A memory block of size SIZE is automatically (re-) allocated if necessary + and the pointer to this block is stored in the GENERATOR object. If one + only needs the pointer to this memory block set SIZE to ‘0’. + + Notice, that SIZE is the size of the memory block and not the length of an + array. + + _Important:_ This rountine should only be used in the initialization and + sampling routine of the external generator. + + -- Function: double* unur_dext_get_distrparams (UNUR_GEN* GENERATOR) + -- Function: int unur_dext_get_ndistrparams (UNUR_GEN* GENERATOR) + Get size of and pointer to array of parameters of underlying distribution + in GENERATOR object. + + _Important:_ These rountines should only be used in the initialization and + sampling routine of the external generator. + +5.8.4 DGT – (Discrete) Guide Table method (indexed search) +---------------------------------------------------------- + +Required: + probability vector (PV) +Speed: + Set-up: slow (linear with the vector-length), Sampling: very fast +Reinit: + supported +Reference: + [CAa74] [HLD04: Sect.3.1.2] + + DGT samples from arbitrary but finite probability vectors. Random numbers +are generated by the inversion method, i.e., + + 1. Generate a random number U ~ U(0,1). + 2. Find smallest integer I such that F(I) = P(X<=I) >= U. + + Step (2) is the crucial step. Using sequential search requires O(E(X)) +comparisons, where E(X) is the expectation of the distribution. Indexed search, +however, uses a guide table to jump to some I’ <= I near I to find X in constant +time. Indeed the expected number of comparisons is reduced to 2, when the guide +table has the same size as the probability vector (this is the default). For +larger guide tables this number becomes smaller (but is always larger than 1), +for smaller tables it becomes larger. For the limit case of table size 1 the +algorithm simply does sequential search (but uses a more expensive setup then +method DSS (*note DSS::). On the other hand the setup time for guide table is +O(N), where N denotes the length of the probability vector (for size 1 no +preprocessing is required). Moreover, for very large guide tables memory +effects might even reduce the speed of the algorithm. So we do not recommend to +use guide tables that are more than three times larger than the given +probability vector. If only a few random numbers have to be generated, (much) +smaller table sizes are better. The size of the guide table relative to the +length of the given probability vector can be set by a +‘unur_dgt_set_guidefactor’ call. + + There exist two variants for the setup step which can be set by a +‘unur_dgt_set_variant’ call: Variants 1 and 2. Variant 2 is faster but more +sensitive to roundoff errors when the guide table is large. By default variant +2 is used for short probability vectors (N<1000) and variant 1 otherwise. + + By default the probability vector is indexed starting at ‘0’. However this +can be changed in the distribution object by a ‘unur_distr_discr_set_domain’ +call. + + The method also works when no probability vector but a PMF is given. +However, then additionally a bounded (not too large) domain must be given or the +sum over the PMF. In the latter case the domain of the distribution is trucated +(see ‘unur_distr_discr_make_pv’ for details). + +How To Use +.......... + +Create an object for a discrete distribution either by setting a probability +vector or a PMF. The performance can be slightly influenced by setting the size +of the used table which can be changed by ‘unur_dgt_set_guidefactor’. It is +possible to change the parameters and the domain of the chosen distribution and +run ‘unur_reinit’ to reinitialize the generator object. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_dgt_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_dgt_set_guidefactor (UNUR_PAR* PARAMETERS, double FACTOR) + Set size of guide table relative to length of PV. Larger guide tables + result in faster generation time but require a more expensive setup. Sizes + larger than 3 are not recommended. If the relative size is set to 0, + sequential search is used. However, this is not recommended, except in + exceptional cases, since method DSS (*note DSS::) is has almost no setup + and is thus faster (but requires the sum over the PV as input parameter). + + Default is ‘1’. + + -- Function: int unur_dgt_set_variant (UNUR_PAR* PARAMETERS, unsigned VARIANT) + Set variant for setup step. Possible values are ‘1’ or ‘2’. Variant ‘2’ + is faster but more sensitive to roundoff errors when the guide table is + large. By default variant ‘2’ is used for short probability vectors + (N<1000) and variant ‘1’ otherwise. + +5.8.5 DSROU – Discrete Simple Ratio-Of-Uniforms method +------------------------------------------------------ + +Required: + T-concave PMF, mode, sum over PMF +Speed: + Set-up: fast, Sampling: slow +Reinit: + supported +Reference: + [LJa01] [HLD04: Sect.10.3.2; Alg.10.6] + + DSROU is based on the ratio-of-uniforms method (*note Ratio-of-Uniforms::) +but uses universal inequalities for constructing a (universal) bounding +rectangle. It works for all T-concave distributions with T(x) = -1/sqrt(x) . + + The method requires the PMF, the (exact) location of the mode and the sum +over the given PDF. The rejection constant is 4 for all T-concave distributions. +Optionally the CDF at the mode can be given to increase the performance of the +algorithm. Then the rejection constant is reduced to 2. + +How To Use +.......... + +The method works for T-concave discrete distributions with given PMF. The sum +over of the PMF or an upper bound of this sum must be known. + + Optionally the CDF at the mode can be given to increase the performance using +‘unur_dsrou_set_cdfatmode’. However, this *must not* be called if the sum over +the PMF is replaced by an upper bound. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. + + If any of mode, CDF at mode, or the sum over the PMF has been changed, then +‘unur_reinit’ must be executed. (Otherwise the generator produces garbage). + + There exists a test mode that verifies whether the conditions for the method +are satisfied or not while sampling. It can be switched on or off by calling +‘unur_dsrou_set_verify’ and ‘unur_dsrou_chg_verify’, respectively. Notice +however that sampling is (a little bit) slower then. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_dsrou_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_dsrou_set_cdfatmode (UNUR_PAR* PARAMETERS, double FMODE) + Set CDF at mode. When set, the performance of the algorithm is increased + by factor 2. However, when the parameters of the distribution are changed + ‘unur_dsrou_chg_cdfatmode’ has to be used to update this value. Notice + that the algorithm detects a mode at the left boundary of the domain + automatically and it is not necessary to use this call for a monotonically + decreasing PMF. + + Default: not set. + + -- Function: int unur_dsrou_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) + -- Function: int unur_dsrou_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) + Turn verifying of algorithm while sampling on/off. If the condition + squeeze(x) <= PMF(x) <= hat(x) is violated for some x then ‘unur_errno’ is + set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due + to round-off errors for a few values of x (less than 1%). + + Default is ‘FALSE’. + + -- Function: int unur_dsrou_chg_cdfatmode (UNUR_GEN* GENERATOR, double FMODE) + Change CDF at mode of distribution. ‘unur_reinit’ must be executed before + sampling from the generator again. + +5.8.6 DSS – (Discrete) Sequential Search method +----------------------------------------------- + +Required: + probability vector (PV) and sum over PV; or probability mass function(PMF), + sum over PV and domain; or or cumulative distribution function (CDF) +Speed: + Set-up: fast, Sampling: very slow (linear in expectation) +Reinit: + supported +Reference: + [HLD04: Sect.3.1.1; Alg.3.1] + + DSS samples from arbitrary discrete distributions. Random numbers are +generated by the inversion method, i.e., + + 1. Generate a random number U ~ U(0,1). + 2. Find smallest integer I such that F(I) = P(X<=I) >= U. + + Step (2) is the crucial step. Using sequential search requires O(E(X)) +comparisons, where E(X) is the expectation of the distribution. Thus this +method is only recommended when only a few random variates from the given +distribution are required. Otherwise, table methods like DGT (*note DGT::) or +DAU (*note DAU::) are much faster. These methods also need not the sum over the +PMF (or PV) as input. On the other hand, however, these methods always compute +a table. + + DSS runs with the PV, the PMF, or the CDF of the distribution. It uses +actually uses the first one in this list (in this ordering) that could be found. + +How To Use +.......... + +It works with a discrete distribution object with contains at least the PV, the +PMF, or the CDF. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_dss_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + +5.8.7 DSTD – Discrete STandarD distributions +-------------------------------------------- + +Required: + standard distribution from UNU.RAN library (*note Standard distributions: + Stddist.) or discrete distribution with inverse CDF. +Speed: + Set-up: fast, Sampling: depends on distribution and generator +Reinit: + supported + + DSTD is a wrapper for special generators for discrete univariate standard +distributions. It only works for distributions in the UNU.RAN library of +standard distributions (*note Standard distributions: Stddist.) or for discrete +distributions where the inverse CDF is given. If a distribution object is +provided that is build from scratch, it must provide the inverse CDF. Then CSTD +implements the inversion method. Otherwise, the ‘NULL’ pointer is returned. + + For some distributions more than one special generator is possible. + +How To Use +.......... + +Create a distribution object for a standard distribution from the UNU.RAN +library (*note Standard distributions: Stddist.), or create a discrete +distribution object and set the function for the inverse CDF using +‘unur_distr_discr_set_invcdf’. For some distributions more than one special +generator (_variants_) is possible. These can be choosen by a +‘unur_dstd_set_variant’ call. For possible variants *Note Standard +distributions: Stddist. However the following are common to all distributions: + +‘UNUR_STDGEN_DEFAULT’ + the default generator. +‘UNUR_STDGEN_FAST’ + the fastest available special generator. +‘UNUR_STDGEN_INVERSION’ + the inversion method (if available). + + Notice that the variant ‘UNUR_STDGEN_FAST’ for a special generator might be +slower than one of the universal algorithms! Additional variants may exist for +particular distributions. + + Sampling from truncated distributions (which can be constructed by changing +the default domain of a distribution by means of ‘unur_distr_discr_set_domain’ +or unur_dstd_chg_truncated calls) is possible but requires the inversion method. +Moreover the CDF of the distribution must be implemented. + + It is possible to change the parameters and the domain of the chosen +distribution and run ‘unur_reinit’ to reinitialize the generator object. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_dstd_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for new generator. It requires a distribution + object for a discrete univariant distribution from the UNU.RAN library of + standard distributions (*note Standard distributions: Stddist.). + + Using a truncated distribution is allowed only if the inversion method is + available and selected by the ‘unur_dstd_set_variant’ call immediately + after creating the parameter object. Use a ‘unur_distr_discr_set_domain’ + call to get a truncated distribution. + + -- Function: int unur_dstd_set_variant (UNUR_PAR* PARAMETERS, unsigned VARIANT) + Set variant (special generator) for sampling from a given distribution. + For possible variants *note Standard distributions: Stddist. + + Common variants are ‘UNUR_STDGEN_DEFAULT’ for the default generator, + ‘UNUR_STDGEN_FAST’ for (one of the) fastest implemented special generators, + and ‘UNUR_STDGEN_INVERSION’ for the inversion method (if available). If + the selected variant number is not implemented, then an error code is + returned and the variant is not changed. + + -- Function: int unur_dstd_chg_truncated (UNUR_GEN* GENERATOR, int LEFT, int + RIGHT) + Change left and right border of the domain of the (truncated) distribution. + This is only possible if the inversion method is used. Otherwise this call + has no effect and an error code is returned. + + Notice that the given truncated domain must be a subset of the domain of + the given distribution. The generator always uses the intersection of the + domain of the distribution and the truncated domain given by this call. + + It is not required to run ‘unur_reinit’ after this call has been used. + + _Important:_ If the CDF is (almost) the same for LEFT and RIGHT and + (almost) equal to ‘0’ or ‘1’, then the truncated domain is not chanced and + the call returns an error code. + + _Notice:_ If the parameters of the distribution has been changed it is + recommended to set the truncated domain again, since the former call might + change the domain of the distribution but not update the values for the + boundaries of the truncated distribution. + +5.9 Methods for random matrices +=============================== + +Overview of methods +------------------- + +Methods for matrix distributions +sample with ‘unur_sample_matr’ + +MCORR: Distribution object for random correlation matrix. + +5.9.1 MCORR – Random CORRelation matrix +--------------------------------------- + +Required: + Distribution object for random correlation matrix +Speed: + Set-up: fast, Sampling: depends on dimension +Reinit: + supported +Reference: + [DLa86: Sect.6.1; p.605] [MOa84] + + MCORR generates a random correlation matrix (Pearson’s correlation). Two +methods are used: + + 1. When a random correlation matrix having given eigenvalues is sought, the + method of Marsaglia and Olkin [MOa84] is used. In this case, the + correlation matrix R is given as R=PDP' where D is a diagonal matrix + containing the eigenvalues and P is a random orthonormal matrix. In higher + dimensions, the rounding-errors introduced in the previous matrix + multiplications could lead to a non-symmetric correlation matrix. + Therefore the symmetric correlation matrix is computed as R=(PDP'+P'DP)/2 . + + 2. A matrix H is generated where all rows are independent random vectors of + unit length uniformly on a sphere. Then HH' is a correlation matrix (and + vice versa if HH' is a correlation matrix then the rows of H are random + vectors on a sphere). + + Notice that due to round-off errors the generated matrices might not be +positive definite in extremely rare cases (especially when the given eigenvalues +are amost 0). + + There are many other possibilites (distributions) of sampling the random rows +from a sphere. The chosen methods are simple but does not result in a uniform +distriubution of the random correlation matrices. + + It only works with distribution objects of random correlation matrices (*note +Random Correlation Matrix: correlation.). + +How To Use +.......... + +Create a distibution object for random correlation matrices by a +‘unur_distr_correlation’ call (*note Random Correlation Matrix: correlation.). + + When a correlation matrix with given eigenvalues should be generated, these +eigenvalues can be set by a ‘unur_mcorr_set_eigenvalues’ call. + + Otherwise, a faster algorithm is used that generates correlation matrices +with random eigenstructure. + + Notice that due to round-off errors, there is a (small) chance that the +resulting matrix is not positive definite for a Cholesky decomposition +algorithm, especially when the dimension of the distribution is high. + + It is possible to change the given eigenvalues using +‘unur_mcorr_chg_eigenvalues’ and run ‘unur_reinit’ to reinitialize the generator +object. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_mcorr_new (const UNUR_DISTR* DISTRIBUTION) + Get default parameters for generator. + + -- Function: int unur_mcorr_set_eigenvalues (UNUR_PAR* PAR, const DOUBLE* + EIGENVALUES) + Sets the (optional) eigenvalues of the correlation matrix. If set, then + the Marsaglia and Olkin algorithm will be used to generate random + correlation matrices with given eigenvalues. + + Important: the given eigenvalues of the correlation matrix must be strictly + positive and sum to the dimension of the matrix. If non-positive + eigenvalues are attempted, no eigenvalues are set and an error code is + returned. In case, that their sum is different from the dimension, an + implicit scaling to give the correct sum is performed. + + -- Function: int unur_mcorr_chg_eigenvalues (UNUR_GEN* GEN, const DOUBLE* + EIGENVALUES) + Change the eigenvalues of the correlation matrix. One must run + ‘unur_reinit’ to reinitialize the generator object then. + +5.10 Methods for uniform univariate distributions +================================================= + +5.10.1 UNIF – wrapper for UNIForm random number generator +--------------------------------------------------------- + +UNIF is a simple wrapper that makes it possible to use a uniform random number +generator as a UNU.RAN generator. There are no parameters for this method. + +How To Use +.......... + +Create a generator object with ‘NULL’ as argument. The created generator object +returns raw random numbers from the underlying uniform random number generator. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_unif_new (const UNUR_DISTR* DUMMY) + Get default parameters for generator. UNIF does not need a distribution + object. DUMMY is not used and can (should) be set to ‘NULL’. It is used + to keep the API consistent. + +5.11 Meta Methods for univariate distributions +============================================== + +Example +------- + + /* ------------------------------------------------------------- */ + /* File: example_mixt.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + /* Mixture of a Gaussian and a Cauchy distribution. */ + /* ------------------------------------------------------------- */ + + int main(void) + { + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *comp[2]; /* array of generator objects (components)*/ + UNUR_GEN *gen; /* generator object for mixture */ + + double prob[2]; /* array of probabilities */ + + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Create generators for components */ + distr = unur_distr_normal(NULL,0); /* Gaussian distribution */ + par = unur_pinv_new(distr); /* choose method PINV */ + comp[0] = unur_init(par); /* initialize */ + unur_distr_free(distr); /* free distribution obj. */ + + distr = unur_distr_cauchy(NULL,0); /* Cauchy distribution */ + par = unur_tdr_new(distr); /* choose method TDR */ + comp[1] = unur_init(par); /* initialize */ + unur_distr_free(distr); /* free distribution obj. */ + + /* Probabilities for components (need not sum to 1) */ + prob[0] = 0.4; + prob[1] = 0.3; + + /* Create mixture */ + par = unur_mixt_new(2,prob,comp); + + /* Initialize generator object */ + gen = unur_init(par); + + /* we do not need the components any more */ + for (i=0; i<2; i++) + unur_free(comp[i]); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + +Example (Inversion) +------------------- + + /* ------------------------------------------------------------- */ + /* File: example_mixt_inv.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header file. */ + #include + + /* ------------------------------------------------------------- */ + /* Mixture of truncated Gaussian on (-INFINITY,0] and */ + /* Exponential distribution on [0,INFINITY) */ + /* ------------------------------------------------------------- */ + + int main(void) + { + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *comp[2]; /* array of generator objects (components)*/ + UNUR_GEN *gen; /* generator object for mixture */ + + double prob[2]; /* array of probabilities */ + + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Create generators for components */ + distr = unur_distr_normal(NULL,0); /* Gaussian distribution */ + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,0); + par = unur_pinv_new(distr); /* choose method PINV */ + comp[0] = unur_init(par); /* initialize */ + unur_distr_free(distr); /* free distribution obj. */ + + distr = unur_distr_exponential(NULL,0); /* Exponential distr. */ + par = unur_pinv_new(distr); /* choose method PINV */ + comp[1] = unur_init(par); /* initialize */ + unur_distr_free(distr); /* free distribution obj. */ + + /* Probabilities for components (need not sum to 1) */ + prob[0] = 0.4; + prob[1] = 0.3; + + /* Create mixture */ + par = unur_mixt_new(2,prob,comp); + + /* We want to use inversion for the mixture as well. */ + /* (Thus the above order of the components is important!) */ + unur_mixt_set_useinversion(par,TRUE); + + /* Initialize generator object */ + gen = unur_init(par); + + /* we do not need the components any more */ + for (i=0; i<2; i++) + unur_free(comp[i]); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + + } /* end of main() */ + + /* ------------------------------------------------------------- */ + +5.11.1 MIXT – MIXTure of distributions +-------------------------------------- + +MIXT allows to sample from a mixture of univariate distributions. + + Let f_1,...,f_n be PDFs of various distributions called the components and +(p_1,...,p_n) be a probability vector. Then f(x) = p_1 * f_1(x) + ...+ p_n * +f_n(x) is the PDF of the so called mixture of these distributions. + + Method MIXT takes generator objects for the components and a probability +vector and creates a generator object for this mixture. + + The sampling part works as follows: + + 1. Generate an index J as the realisation of a discrete random variate with + the given probability vector. This is done by means of method DGT (*note + Guide Table method: DGT.). + 2. Generate a random variate X with PDF f_J. + + When the (interior of the) domains of the the components are disjoint then it +is possible to sample from the mixture by inversion, provided that the following +conditions are met: + + − The generator objects must use an inversion method for each component. + − The domains of the PDFs f_i must not overlap. + − The components must be ordered with respect to their domains. + +How To Use +.......... + +Create generator objects for the components of the mixture and store the +corresponding pointers in an array. Store all probabilities an a double array +of the same size. Create the parameter object for the generator of the mixture +distribution by means of ‘unur_mixt_new’. The components of the mixture can be +any continuous or discrete univariate distributions. This also includes +generators for empirical distributions and mixtures of distributions. In +particular, mixtures can also be defined recursively. + + _Remark:_ The components of the mixture can be continuous or discrete +distributions. The resulting mixture, however, is always a continuous +distribution and thus ‘unur_sample_cont’ must be used! + + The inversion method can be switched on by means of +‘unur_mixt_set_useinversion’ call. However, the conditions for this method must +then be met. Otherwise, initialization of the mixture object fails. + +Function reference +------------------ + + -- Function: UNUR_PAR* unur_mixt_new (int N, const DOUBLE* PROB, UNUR_GEN** + COMP) + Get default parameters for the generator for a mixture of the distributions + given in the array COMP (components) of length N. The probabilities are + given by PROB. + + The generators in COMP must be objects for (continuous or discrete) + univariate distributions + + -- Function: int unur_mixt_set_useinversion (UNUR_PAR* PARAMETERS, int USEINV) + If USEINV is ‘TRUE’, then the inversion method is used for sampling from + the mixture distribution. + + However, the following conditions must be satisfied: + + − The generator objects must use an inversion method for each component. + − The domains of the components must not overlap. + − The components must be ordered with respect to their domains. + + If one of these conditions is violated, then initialization of the mixture + object fails. + + Default is ‘FALSE’. + +6 Using uniform random number generators +**************************************** + +UNU.RAN is designed to work with many sources of (pseudo-) random numbers or low +discrepancy numbers (so called quasi-random numbers) for almost all tasks in +discrete event simulation, (quasi-) Monte Carlo integration or any other +stochastic methods. Hence UNU.RAN uses pointers to access uniform (pseudo-) +random number generators (URNG). + + Each UNU.RAN (non-uniform random variate) generator object has a pointer to a +URNG object. Thus each UNU.RAN generator object may have its own (independent) +URNG or several generator objects can share the same URNG. + + If no URNG is provided for a parameter or generator object a default +generator is used which is the same for all generators. This URNG is defined in +‘unuran_config.h’ at compile time and can be changed at runtime. + + UNU.RAN uses a unified interface for all sources of random numbers. +Unfortunately, the API for random number generators, like the ‘GSL’ (GNU +Scientific Library), Otmar Lendl’s ‘prng’ (Pseudo random number generators), or +a single function implemented by the user herself, are quite different. Hence +an object of type ‘UNUR_URNG’ is introduced to store the URNG. Thus it is +possible to handle different sources of such URNGs with the unified API. It is +inspired from similar to Pierre L’Ecuyers ‘RngStreams’ library: + + − seed the random number generator; + − get a uniform random number; + − reset the URNG; + − skip to the begining next substream; + − sample antithetic numbers; + − delete the URNG object. + + The routine to create a URNG depends on the chosen random number generator +(i.e. library). Nevertheless, there exist wrapper functions to simplify this +task. + + Currently the following sources of uniform random numbers are directly +supported (i.e., there exist wrapper functions). Of course other random number +generation libraries can be used. + + 1. ‘FVOID’ + + URNGs of type ‘double uniform(void *state)’. The argument STATE can be + simply ignored in the implementation of ‘uniform’ when a global state + variable is used. UNU.RAN contains some build-in URNGs of this type in + directory ‘src/uniform/’. + + 2. ‘PRNG’ + + URNGs from Otmar Lendl’s ‘prng’ library. It provides a very flexible way + to sample form arbitrary URNGs by means of an object oriented programing + paradigma. Similarly to the UNU.RAN library independent generator objects + can be build and used. + + This library has been developed by the pLab group at the university of + Salzburg (Austria, EU) and implemented by Otmar Lendl. It is available + from or from the pLab site at + . + + This interface must be compiled into UNU.RAN using the configure flag + ‘--with-urng-prng’. + + 3. ‘RNGSTREAM’ + + Pierre L’Ecuyer’s ‘RngStream’ library for multiple independent streams of + pseudo-random numbers. A GNU-style package is available from + . + + This interface must be compiled into UNU.RAN using the configure flag + ‘--with-urng-rngstream’. + + 4. ‘GSL’ + + URNG from the GNU Scientific Library (GSL). It is available from + . + + This interface must be compiled into UNU.RAN using the configure flag + ‘--with-urng-gsl’. + +How To Use +.......... + +Each UNU.RAN generator object has a pointer to a uniform (pseudo-) random number +generator (URNG). It can be set via the ‘unur_set_urng’ call. It is also +possible to read this pointer via ‘unur_get_urng’ or change the URNG for an +existing generator object by means of ‘unur_chg_urng’. It is important to note +that these calls only copy the pointer to the URNG object into the generator +object. + + If no URNG is provided for a parameter or generator object a default URNG is +used which is the same for all generators. This URNG is defined in +‘unuran_config.h’ at compile time. A pointer to this default URNG can be +obtained via ‘unur_get_default_urng’. Nevertheless, it is also possible to +change this default URNG by another one at runtime by means of the +‘unur_set_default_urng’ call. However, this only takes effect for new parameter +objects. + + Some generating methods provide the possibility of correlation induction. +For this feature a second auxiliary URNG is required. It can be set and changed +by ‘unur_set_urng_aux’ and ‘unur_chg_urng_aux’ calls, respectively. Since the +auxiliary URNG is by default the same as the main URNG, the auxiliary URNG must +be set after any ‘unur_set_urng’ or ‘unur_chg_urng’ call! Since in special +cases mixing of two URNG might cause problems, we supply a default auxiliary +generator that can be used by a ‘unur_use_urng_aux_default’ call (after the main +URNG has been set). This default auxiliary generator can be changed with +analogous calls as the (main) default uniform generator. + + Uniform random number generators form different sources have different +programming interfaces. Thus UNU.RAN stores all information about a particular +uniform random number generator in a structure of type ‘UNUR_URNG’. Before a +URNG can be used with UNU.RAN an appropriate object has to be created ba a +‘unur_urng_new’ call. This call takes two arguments: the pointer to the +sampling routine of the generator and a pointer to a possible argument that +stores the state of the generator. The function must be of type ‘double +(*sampleunif)(void *params)’, but functions without any argument also work. +Additionally one can set pointers to functions for reseting or jumping the +streams generated by the URNG by the corresponding ‘set’ calls. + + UNU.RAN provides a unified API to all sources of random numbers. Notice, +however, that not all functions work for all random number generators (as the +respective library has not implemented the corresponding feature). + + There are wrapper functions for some libraries of uniform random number +generators to simplify the task of creating a UNU.RAN object for URNGs. These +functions must be compiled into UNU.RAN using the corresponding configure flags +(see description of the respective interface below). + +Function reference +------------------ + +Set and get default uniform RNGs +-------------------------------- + + -- Function: UNUR_URNG* unur_get_default_urng (void) + Get the pointer to the default URNG. The default URNG is used by all + generators where no URNG was set explicitly by a ‘unur_set_urng’ call. + + -- Function: UNUR_URNG* unur_set_default_urng (UNUR_URNG* URNG_NEW) + Change the default URNG that is used for new parameter objects. It returns + the pointer to the old default URNG that has been used. + + -- Function: UNUR_URNG* unur_set_default_urng_aux (UNUR_URNG* URNG_NEW) + -- Function: UNUR_URNG* unur_get_default_urng_aux (void) + Analogous calls for default auxiliary generator. + +Set, change and get uniform RNGs in generator objects +----------------------------------------------------- + + -- Function: int unur_set_urng (UNUR_PAR* PARAMETERS, UNUR_URNG* URNG) + Use the URNG ‘urng’ for the new generator. This overrides the default + URNG. It also sets the auxiliary URNG to ‘urng’. + + _Important_: For multivariate distributions that use marginal distributions + this call does not work properly. It is then better first to create the + generator object (by a ‘unur_init’ call) and then change the URNG by means + of ‘unur_chg_urng’. + + -- Function: UNUR_URNG* unur_chg_urng (UNUR_GEN* GENERATOR, UNUR_URNG* URNG) + Change the URNG for the given generator. It returns the pointer to the old + URNG that has been used by the generator. It also changes the auxiliary + URNG to ‘urng’ and thus it overrides the last ‘unur_chg_urng_aux’ call. + + -- Function: UNUR_URNG* unur_get_urng (UNUR_GEN* GENERATOR) + Get the pointer to the URNG that is used by the GENERATOR. This is usefull + if two generators should share the same URNG. + + -- Function: int unur_set_urng_aux (UNUR_PAR* PARAMETERS, UNUR_URNG* URNG_AUX) + Use the auxiliary URNG ‘urng_aux’ for the new generator. (Default is the + default URNG or the URNG from the last ‘unur_set_urng’ call. Thus if the + auxiliary generator should be different to the main URNG, + ‘unur_set_urng_aux’ must be called after ‘unur_set_urng’. The auxiliary + URNG is used as second stream of uniform random number for correlation + induction. It is not possible to set an auxiliary URNG for a method that + does not need one. In this case an error code is returned. + + -- Function: int unur_use_urng_aux_default (UNUR_PAR* PARAMETERS) + Use the default auxiliary URNG. (It must be set after ‘unur_get_urng’. ) + It is not possible to set an auxiliary URNG for a method that does not use + one (i.e. the call returns an error code). + + -- Function: int unur_chgto_urng_aux_default (UNUR_GEN* GENERATOR) + Switch to default auxiliary URNG. (It must be set after ‘unur_get_urng’. ) + It is not possible to set an auxiliary URNG for a method that does not use + one (i.e. the call returns an error code). + + -- Function: UNUR_URNG* unur_chg_urng_aux (UNUR_GEN* GENERATOR, UNUR_URNG* + URNG_AUX) + Change the auxiliary URNG for the given GENERATOR. It returns the pointer + to the old auxiliary URNG that has been used by the generator. It has to + be called after each ‘unur_chg_urng’ when the auxiliary URNG should be + different from the main URNG. It is not possible to change the auxiliary + URNG for a method that does not use one (i.e. the call ‘NULL’). + + -- Function: UNUR_URNG* unur_get_urng_aux (UNUR_GEN* GENERATOR) + Get the pointer to the auxiliary URNG that is used by the GENERATOR. This + is usefull if two generators should share the same URNG. + +Handle uniform RNGs +------------------- + +_Notice:_ Some of the below function calls do not work for every source of +random numbers since not every library has implemented these features. + + -- Function: double unur_urng_sample (UNUR_URNG* URNG) + Get a uniform random number from URNG. If the ‘NULL’ pointer is given, the + default uniform generator is used. + + -- Function: double unur_sample_urng (UNUR_GEN* GEN) + Get a uniform random number from the underlying uniform random number + generator of generator GEN. If the ‘NULL’ pointer is given, the default + uniform generator is used. + + -- Function: int unur_urng_sample_array (UNUR_URNG* URNG, double* X, int DIM) + Set array X of length DIM with uniform random numbers sampled from + generator URNG. If URNG is the ‘NULL’ pointer, the default uniform + generator is used. + + _Important:_ If URNG is based on a point set generator (this is the case + for generators of low discrepance point sets as used in quasi-Monte Carlo + methods) it has a “natural dimension” s. In this case either only the + first s entries of X are filled (if s < DIM), or the first DIM coordinates + of the generated point are filled. + + The called returns the actual number of entries filled. In case of an + error ‘0’ is returned. + + -- Function: int unur_urng_reset (UNUR_URNG* URNG) + Reset URNG object. The routine tries two ways to reset the generator (in + this order): + + 1. It uses the reset function given by an ‘unur_urng_set_reset’ call. + + 2. It uses the seed given by the last ‘unur_urng_seed’ call (which + requires a seeding function given by a ‘unur_urng_set_seed’ call). + + If neither of the two methods work resetting of the generator is not + possible and an error code is returned. + + If the ‘NULL’ pointer is given, the default uniform generator is reset. + + -- Function: int unur_urng_sync (UNUR_URNG* URNG) + Jump into defined state ("sync") of the generator. This is useful when + point generators are used where the coordinates are sampled via + ‘unur_urng_sample’. Then this call can be used to jump to the first + coordinate of the next generated point. + + -- Function: int unur_urng_seed (UNUR_URNG* URNG, unsigned LONG SEED) + Set SEED for generator URNG. It returns an error code if this is not + possible for the given URNG. If the ‘NULL’ pointer is given, the default + uniform generator is seeded (if possible). + + _Notice_: Seeding should be done only once for a particular generator + (except for resetting it to the initial state). Expertise is required when + multiple seeds are used to get independent streams. Thus we recommend + appropriate libraries for this task, e.g. Pierre L’Ecuyer’s ‘RngStreams’ + package. For this library only a package seed can be set and thus the + ‘unur_urng_seed’ call will not have any effect to generators of this type. + Use ‘unur_urng_reset’ or ‘unur_urng_rngstream_new’ instead, depending + whether one wants to reset the stream or get a new stream that is + independent from the previous ones. + + -- Function: int unur_urng_anti (UNUR_URNG* URNG, int ANTI) + Switch to antithetic random numbers in URNG. It returns an error code if + this is not possible for the given URNG. + + If the ‘NULL’ pointer is given, the antithetic flag of the default uniform + generator is switched (if possible). + + -- Function: int unur_urng_nextsub (UNUR_URNG* URNG) + Jump to start of the next substream of URNG. It returns an error code if + this is not possible for the given URNG. + + If the ‘NULL’ pointer is given, the default uniform generator is set to the + start of the next substream (if possible). + + -- Function: int unur_urng_resetsub (UNUR_URNG* URNG) + Jump to start of the current substream of URNG. It returns an error code + if this is not possible for the given URNG. + + If the ‘NULL’ pointer is given, the default uniform generator is set to the + start of the current substream (if possible). + + -- Function: int unur_gen_sync (UNUR_GEN* GENERATOR) + -- Function: int unur_gen_seed (UNUR_GEN* GENERATOR, unsigned LONG SEED) + -- Function: int unur_gen_anti (UNUR_GEN* GENERATOR, int ANTI) + -- Function: int unur_gen_reset (UNUR_GEN* GENERATOR) + -- Function: int unur_gen_nextsub (UNUR_GEN* GENERATOR) + -- Function: int unur_gen_resetsub (UNUR_GEN* GENERATOR) + Analogous to ‘unur_urng_sync’, ‘unur_urng_seed’ , ‘unur_urng_anti’, + ‘unur_urng_reset’ , ‘unur_urng_nextsub’, and ‘unur_urng_resetsub’, but act + on the URNG object used by the GENERATOR object. + + _Warning:_ These calls should be used with care as it influences all + generator objects that share the same URNG object! + +API to create a new URNG object +------------------------------- + +_Notice:_ These functions are provided to built a UNUR_URNG object for a +particular external random number generator from scratch. For some libraries +that contain random number generators (like the GSL) there are special calls, +e.g. ‘unur_urng_gsl_new’, to get such an object. Then there is no need to +change the UNUR_URNG object as it already contains all available features. + + If you have a particular library for random number generators you can either +write wrapper function like those in ‘src/uniform/urng_gsl.c’ or write an email +to the authors of UNU.RAN to write it for you. + + -- Function: UNUR_URNG* unur_urng_new (double (* SAMPLEUNIF)(void* state ), + void* STATE) + Get a new URNG object. SAMPLEUNIF is a function to the uniform sampling + routine, STATE a pointer to its arguments which usually contains the state + variables of the generator. + + Functions SAMPLEUNIF with a different type for P or without an argument at + all also work. A typecast might be necessary to avoid compiler warnings or + error messages. + + For functions SAMPLEUNIF that does not have any argument should use ‘NULL’ + for STATE. + + _Important:_ SAMPLEUNIF must not be the ‘NULL’ pointer. + + There are appropriate calls that simplifies the task of creating URNG + objects for some libraries with uniform random number generators, see + below. + + -- Function: void unur_urng_free (UNUR_URNG* URNG) + Destroy URNG object. It returns an error code if this is not possible. + + If the ‘NULL’ is given, this function does nothing. + + _Warning:_ This call must be used with care. The URNG object must not be + used by any existing generator object! It is designed to work in + conjunction with the wrapper functions to create URNG objects for + generators of a particular library. Thus an object created by an + ‘unur_urng_prng_new’ call can be simply destroyed by an ‘unur_urng_free’ + call. + + -- Function: int unur_urng_set_sample_array (UNUR_URNG* URNG, unsigned int(* + SAMPLEARRAY)(void* state, double* X, int DIM )) + Set function to fill array X of length DIM with random numbers generated by + generator URNG (if available). + + -- Function: int unur_urng_set_sync (UNUR_URNG* URNG, void (* SYNC)(void* state + )) + Set function for jumping into a defined state (“sync”). + + -- Function: int unur_urng_set_seed (UNUR_URNG* URNG, void (* SETSEED)(void* + state, unsigned LONG SEED )) + Set function to seed generator URNG (if available). + + -- Function: int unur_urng_set_anti (UNUR_URNG* URNG, void (* SETANTI)(void* + state, int ANTI )) + Set function to switch the antithetic flag of generator URNG (if + available). + + -- Function: int unur_urng_set_reset (UNUR_URNG* URNG, void (* RESET)(void* + state )) + Set function for reseting the uniform random number generator URNG (if + available). + + -- Function: int unur_urng_set_nextsub (UNUR_URNG* URNG, void (* NEXTSUB)(void* + state )) + Set function that allows jumping to start of the next substream of URNG (if + available). + + -- Function: int unur_urng_set_resetsub (UNUR_URNG* URNG, void (* + RESETSUB)(void* state )) + Set function that allows jumping to start of the current substream of URNG + (if available). + + -- Function: int unur_urng_set_delete (UNUR_URNG* URNG, void (* FPDELETE)(void* + state )) + Set function for destroying URNG (if available). + +6.1 Simple interface for uniform random number generators +========================================================= + +Simple interface for URNGs of type ‘double uniform(void *state)’. + + UNU.RAN contains some build-in URNGs of this type: +‘unur_urng_MRG31k3p’ + Combined multiple recursive generator by Pierre L’Ecuyer and Renee Touzin. +‘unur_urng_fish’ + Linear congruential generator by Fishman and Moore. +‘unur_urng_mstd’ + Linear congruential generator "Minimal Standard" by Park and Miller. + + Notice, however, that these generators are provided as a fallback for the +case that no state-of-the-art uniform random number generators (e.g. *note +Pierre L’Ecuyer’s ‘Rngstream’ library: URNG-RNGSTREAM.) are used. + +How To Use +.......... + +Create an URNG object using ‘unur_urng_fvoid_new’. By this call a pointer to +the sampling routine and (optional) a pointer to a reset routine are copied into +the URNG object. Other functions, like seeding the URNG, switching to +antithetic random number, or jumping to next substream, can be added to the URNG +object by the respective calls, e.g. by ‘unur_urng_set_seed’. The following +routines are supported for URNG objects of this type: + + − ‘unur_urng_sample’ + − ‘unur_urng_sample_array’ + − ‘unur_urng_seed’ [optional] + − ‘unur_urng_reset’ [optional] + − ‘unur_urng_free’ + +Function reference +------------------ + + -- Function: UNUR_URNG* unur_urng_fvoid_new (double (* URAND)(void* state ), + void (* RESET)(void* state )) + Make a URNG object for a generator that consists of a single function call + URAND. + + If there is no RESET function use ‘NULL’ for the second argument. + +6.2 Interface to GSL uniform random number generators +===================================================== + +Interface to the uniform random number generators from the GNU Scientific +Library (GSL). Documentation and source code of this library is available from +. + + The interface to the GSL must be compiled into UNU.RAN using the configure +flag ‘--with-urng-gsl’. Notice that the GSL has to be installed before running +‘./configure’. + +How To Use +.......... + +When using this interface ‘unuran_urng_gsl.h’ must be included in the +corresponding C file, i.e., one must add the line + + #include + +Moreover, one must not forget to link the executable against ‘libgsl’. + + The following routines are supported for URNG objects of type GSL: + + − ‘unur_urng_sample’ + − ‘unur_urng_sample_array’ + − ‘unur_urng_seed’ + − ‘unur_urng_reset’ + − ‘unur_urng_free’ + + /* ------------------------------------------------------------- */ + /* File: example_gsl.c */ + /* ------------------------------------------------------------- */ + #ifdef UNURAN_SUPPORTS_GSL + /* ------------------------------------------------------------- */ + /* This example makes use of the GSL library for generating */ + /* uniform random numbers. */ + /* (see http://www.gnu.org/software/gsl/) */ + /* To compile this example you must have set */ + /* ./configure --with-urng-gsl */ + /* (Of course the executable has to be linked against the */ + /* GSL library.) */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header files. */ + #include + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng; /* uniform generator objects */ + + /* GNU Scientific Library only: */ + /* Make a object for uniform random number generator. */ + urng = unur_urng_gsl_new(gsl_rng_mt19937); + if (urng == NULL) exit (EXIT_FAILURE); + + /* Create a generator object using this URNG */ + distr = unur_distr_normal( NULL, 0 ); + par = unur_tdr_new(distr); + unur_set_urng( par, urng ); + gen = unur_init(par); + if (gen == NULL) exit (EXIT_FAILURE); + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* Destroy objects */ + unur_free(gen); + unur_urng_free(urng); + + exit (EXIT_SUCCESS); + } /* end of main() */ + + /* ------------------------------------------------------------- */ + #else + #include + #include + int main(void) { + printf("You must enable the GSL to run this example!\n\n"); + exit (77); /* exit code for automake check routines */ + } + #endif + /* ------------------------------------------------------------- */ + + +Function reference +------------------ + + -- Function: UNUR_URNG* unur_urng_gsl_new (const GSL_RNG_TYPE* URNGTYPE) + Make object for URNGs from the ‘GSL’ (GNU Scientific Library). URNGTYPE is + the type of the chosen generator as described in the GSL manual (see + Section Random Number Generation). This library is available from + . + + -- Function: UNUR_URNG* unur_urng_gslptr_new (gsl_rng* URNG) + Similar to ‘unur_urng_gsl_new’ but it uses a pointer to a generator object + as returned by ‘gsl_rng_alloc(rng_type)’; see ‘GSL’ manual for details. + + _Notice_: There is a subtle but important difference between these two + calls. When a generator object is created by a ‘unur_urng_gsl_new’ call, + then resetting of the generator works. When a generator object is created + by a ‘unur_urng_gslptr_new’ call, then resetting only works after a + ‘unur_urng_seed(urng,myseed)’ call. + +6.3 Interface to GSL generators for quasi-random points +======================================================= + +Interface to the generators for quasi-random points (also called low discrepancy +point sets) from the GNU Scientific Library (GSL). Documentation and source code +of this library is available from . + + The interface to the GSL must be compiled into UNU.RAN using the configure +flag ‘--with-urng-gsl’. Notice that the GSL has to be installed before running +‘./configure’. + +How To Use +.......... + +When using this interface ‘unuran_urng_gsl.h’ must be included in the +corresponding C file, i.e., one must add the line + + #include + +Moreover, one must not forget to link the executable against ‘libgsl’. + + The following routines are supported for URNG objects of this type: + + − ‘unur_urng_sample’ + − ‘unur_urng_sample_array’ + − ‘unur_urng_reset’ + − ‘unur_urng_sync’ + − ‘unur_urng_free’ + ‘unur_urng_sync’ is used to jump to the first coordinate of the next point +generated by the generator. + +Function reference +------------------ + + -- Function: UNUR_URNG* unur_urng_gslqrng_new (const GSL_QRNG_TYPE* QRNGTYPE, + unsigned INT DIM) + Make object for quasi-random point generators for dimension DIM from the + ‘GSL’ (GNU Scientific Library). QRNGTYPE is the type of the chosen + generator as described in the GSL manual (see section Quasi-Random + Sequences). This library is available from + . + +6.4 Interface to Otmar Lendl’s pseudo-random number generators +============================================================== + +URNGs from Otmar Lendl’s ‘prng’ library. It provides a very flexible way to +sample form arbitrary URNGs by means of an object oriented programing paradigma. +Similarly to the UNU.RAN library independent generator objects can be build and +used. + + This library has been developed by the pLab group at the university of +Salzburg (Austria, EU) and implemented by Otmar Lendl. It is available from + or from the pLab site at +. + + The interface to the PRNG library must be compiled into UNU.RAN using the +configure flag ‘--with-urng-prng’. Notice that the PRNG library has to be +installed before running ‘./configure’. + +How To Use +.......... + +When using this interface ‘unuran_urng_prng.h’ must be included in the +corresponding C file, i.e., one must add the line + + #include + +Moreover, one must not forget to link the executable against ‘libprng’. + + The following routines are supported for URNG objects of type PRNG: + + − ‘unur_urng_sample’ + − ‘unur_urng_sample_array’ + − ‘unur_urng_seed’ (availability depends on chosen PRNG generator!) + − ‘unur_urng_reset’ + − ‘unur_urng_free’ + +Function reference +------------------ + + -- Function: UNUR_URNG* unur_urng_prng_new (const CHAR* PRNGSTR) + Make object for URNGs from Otmar Lendl’s ‘prng’ package. PRNGSTR is a + string that contains the necessary information to create a uniform random + number generator. For the format of this string see the ‘prng’ user + manual. + + The ‘prng’ library provides a very flexible way to sample form arbitrary + URNGs by means of an object oriented programing paradigma. Similarly to + the UNU.RAN library independent generator objects can be build and used. + The library has been developed and implemented by Otmar Lendl as member of + the pLab group at the university of Salzburg (Austria, EU). + + It is available via anonymous ftp from or + from the pLab site at . + + -- Function: UNUR_URNG* unur_urng_prngptr_new (struct PRNG* URNG) + Similar to ‘unur_urng_prng_new’ but it uses a pointer to a generator object + as returned by ‘prng_new(prngstr)’; see ‘prng’ manual for details. + +6.5 Interface to L’Ecuyer’s RNGSTREAM random number generators +============================================================== + +URNGs from Pierre L’Ecuyer’s ‘RngStream’ library for multiple independent +streams of pseudo-random numbers. This library provides multiple independent +streams of pseudo-random numbers which itselves can be splitted into many +substreams. It is available from +. A GNU-style package +is available from . + + The interface to the RngStream library must be compiled into UNU.RAN using +the configure flag ‘--with-urng-rngstream’. Notice that the RngStream library +has to be installed before running ‘./configure’. + +How To Use +.......... + +When using this interface ‘unuran_urng_rngstream.h’ must be included in the +corresponding C file, i.e., one must add the line + + #include + +Moreover, one must not forget to link the executable against the ‘RngStream’ +library (i.e., when using the GNU-style package in UNIX like environments one +has to add ‘-lrngstreams’ when linking an executable). + + Notice that the ‘rngstream’ library uses a package seed, that means one +should seed the uniform random number generator only once in an application +using the routine ‘RngStream_SetPackageSeed’: + + unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; + RngStream_SetPackageSeed(seed); + +The following routines are supported for URNG objects of this type: + + − ‘unur_urng_sample’ + − ‘unur_urng_sample_array’ + − ‘unur_urng_reset’ + − ‘unur_urng_nextsub’ + − ‘unur_urng_resetsub’ + − ‘unur_urng_anti’ + − ‘unur_urng_free’ + +Function reference +------------------ + + -- Function: UNUR_URNG* unur_urng_rngstream_new (const CHAR* URNGSTR) + Make object for URNGs from Pierre L’Ecuyer’s ‘RngStream’ library. URNGSTR + is an arbitrary string to label a stream. It need not be unique. + + -- Function: UNUR_URNG* unur_urng_rngstreamptr_new (RngStream RNGSTREAM) + Similar to ‘unur_urng_rngstream_new’ but it uses a pointer to a generator + object as returned by ‘RngStream_CreateStream()’. + +6.6 Combine point set generator with random shifts +================================================== + +Generators of type RANDOMSHIFT combine a point set generator with generators to +apply random shifts as proposed in [CPa76] : + + 1. Sample and store a random vector S. + 2. Run a QMC simulation where S is added to each point of the generated + quasi-random point (mod 1). + 3. Repeat steps 1 and 2. + +How To Use +.......... + +Create a URNG object for a point set generator and a URNG object for a generator +to create shift vectors at random. The meta URNG object can then be created +using ‘unur_urng_randomshift_new’. Notice that only pointers to the two +underlying URNG generator objects are copied into the newly created meta +generator. Thus manipulating the meta URNG also changes the underlying URNGs +and vice versa. + + The following routines are supported for URNG objects of type RANDOMSHIFT: + + − ‘unur_urng_sample’ + − ‘unur_urng_sample_array’ + − ‘unur_urng_reset’ + − ‘unur_urng_sync’ + − ‘unur_urng_randomshift_nextshift’ + − ‘unur_urng_free’ + ‘unur_urng_sync’ is used to jump to the first coordinate of the next point +generated by the generator. ‘unur_urng_randomshift_nextshift’ allows to replace +the shift vector by another randomly chosen shift vector. + + _Important:_ ‘unur_urng_sync’ is only available if it is if it is implemented +for the underlying point set generator. + + _Important:_ ‘unur_urng_reset’ is only available if it is available for both +underlying generators. + +Function reference +------------------ + + -- Function: UNUR_URNG* unur_urng_randomshift_new (UNUR_URNG* QRNG, UNUR_URNG* + SRNG, int DIM) + Make object for URNG with randomly shifted point sets. QRNG is a generated + that generates point sets of dimension DIM. SRNG is a generated that + generates random numbers or vectors. + + _Notice:_ Only pointers to the respective objects QRNG and SRNG are copied + into the created meta generator. Thus manipulating the meta URNG also + changes the underlying URNGs and vice versa. + + -- Function: int unur_urng_randomshift_nextshift (UNUR_URNG* URNG) + Get the next (randomly chosen) vector for shifting the points set, and the + underlying point generator QRNG is reset. + +7 UNU.RAN Library of standard distributions +******************************************* + +Although it is not its primary target, many distributions are already +implemented in UNU.RAN. This section presents these available distributions and +their parameters. + + The syntax to get a distribuion object for distributions ‘’ is: + + -- --: UNUR_DISTR* unur_distr_ (double* PARAMS, int N_PARAMS) + PARAMS is an array of doubles of size N_PARAMS holding the parameters. + +E.g. to get an object for the gamma distribution (with shape parameter) use + + unur_distr_gamma( params, 1 ); + +Distributions may have default parameters with need not be given explicitely. +E.g. The gamma distribution has three parameters: the shape, scale and location +parameter. Only the (first) shape parameter is required. The others can be +omitted and are then set by default values. + + /* alpha = 5; default: beta = 1, gamma = 0 */ + double fpar[] = {5.}; + unur_distr_gamma( fpar, 1 ); + + /* alpha = 5, beta = 3; default: gamma = 0 */ + double fpar[] = {5., 3.}; + unur_distr_gamma( fpar, 2 ); + + /* alpha = 5, beta = 3, gamma = -2 + double fpar[] = {5., 3., -2.}; + unur_distr_gamma( fpar, 3 ); + + *Important:* Naturally the computational accuracy limits the possible +parameters. There shouldn’t be problems when the parameters of a distribution +are in a “reasonable” range but e.g. the normal distribution N(10^15,1) won’t +yield the desired results. (In this case it would be better generating N(0,1) +and _then_ transform the results.) +Of course computational inaccuracy is not specific to UNU.RAN and should always +be kept in mind when working with computers. + + _Important:_ The routines of the standard library are included for +non-uniform random variate generation and not to provide special functions for +statistical computations. + +Remark +------ + +The following keywords are used in the tables: +PDF + probability density function, with variable x. + +PMF + probability mass function, with variable k. + +constant + normalization constant for given PDF and PMF, resp. They must be + multiplied by constant to get the “real” PDF and PMF. + +CDF + gives information whether the CDF is implemented in UNU.RAN. + +domain + domain PDF and PMF, resp. + +parameters N_STD (N_TOTAL): list + list of parameters for distribution, where N_STD is the number of + parameters for the standard form of the distribution and N_TOTAL the total + number for the (non-standard form of the) distribution. LIST is the list + of parameters in the order as they are stored in the array of parameters. + Optional parameter that can be omitted are enclosed in square brackets + ‘[...]’. + + A detailed list of these parameters gives then the range of valid + parameters and defaults for optional parameters that are used when these + are omitted. + +reference + gives reference for distribution (*note Bibliography::). + +special generators + lists available special generators for the distribution. The first number + is the variant that to be set by ‘unur_cstd_set_variant’ and + ‘unur_dstd_set_variant’ call, respectively. If no variant is set the + default variant ‘DEF’ is used. In the table the respective abbreviations + ‘DEF’ and ‘INV’ are used for ‘UNUR_STDGEN_DEFAULT’ and + ‘UNUR_STDGEN_INVERSION’. Also the references for these methods are given + (*note Bibliography::). + + Notice that these generators might be slower than universal methods. + + If ‘DEF’ is ommited, the first entry is the default generator. + +7.1 UNU.RAN Library of continuous univariate distributions +========================================================== + +7.1.1 ‘F’ – F-distribution +-------------------------- + +PDF: + (x^(nu_1/2-1)) / (1+nu_1/nu_2 x)^((nu_1+nu_2)/2) + +constant: + (nu_1/nu_2)^(nu_1/2) / B(nu_1/2,nu_2/2) + +domain: + 0 < x < infinity + +parameters 2 (2): nu_1, nu_2 + No. name default + ‘[0]’ nu_1 > 0 (scale) + ‘[1]’ nu_2 > 0 (scale) +reference: + [JKBc95: Ch.27; p.322] + +7.1.2 ‘beta’ – Beta distribution +-------------------------------- + +PDF: + (x-a)^(p-1) * (b-x)^(q-1) + +constant: + 1 / (B(p,q) * (b-a)^(p+q-1)) + +domain: + a < x < b + +parameters 2 (4): p, q [, a, b ] + No. name default + ‘[0]’ p > 0 (scale) + ‘[1]’ q > 0 (scale) + ‘[2]’ a 0 (location, scale) + ‘[3]’ b > a 1 (location, scale) +reference: + [JKBc95: Ch.25; p.210] + +7.1.3 ‘cauchy’ – Cauchy distribution +------------------------------------ + +PDF: + 1/(1 + ((x-theta)/lambda)^2) + +constant: + 1/(pi * lambda) + +domain: + -infinity < x < infinity + +parameters 0 (2): [ theta [, lambda ] ] + No. name default + ‘[0]’ theta 0 (location) + ‘[1]’ lambda > 0 1 (scale) +reference: + [JKBb94: Ch.16; p.299] + +special generators: + ‘INV’ + Inversion method + +7.1.4 ‘chi’ – Chi distribution +------------------------------ + +PDF: + x^(nu-1) * exp( -x^2/2 ) + +constant: + 1 / (2^((nu/2)-1) * Gamma(nu/2)) + +domain: + 0 <= x < infinity + +parameters 1 (1): nu + No. name default + ‘[0]’ nu > 0 (shape) +reference: + [JKBb94: Ch.18; p.417] + +special generators: + ‘DEF’ + Ratio of Uniforms with shift (only for nu >= 1) [MJa87] + +7.1.5 ‘chisquare’ – Chisquare distribution +------------------------------------------ + +PDF: + x^((nu/2)-1) * exp( -x/2 ) + +constant: + 1 / (2^(nu/2) * Gamma(nu/2)) + +domain: + 0 <= x < infinity + +parameters 1 (1): nu + No. name default + ‘[0]’ nu > 0 (shape (degrees of + freedom)) +reference: + [JKBb94: Ch.18; p.416] + +7.1.6 ‘exponential’ – Exponential distribution +---------------------------------------------- + +PDF: + exp( -(x-theta)/sigma) + +constant: + 1/sigma + +domain: + theta <= x < infinity + +parameters 0 (2): [ sigma [, theta ] ] + No. name default + ‘[0]’ sigma > 0 1 (scale) + ‘[1]’ theta 0 (location) +reference: + [JKBb94: Ch.19; p.494] + +special generators: + ‘INV’ + Inversion method + +7.1.7 ‘extremeI’ – Extreme value type I (Gumbel-type) distribution +------------------------------------------------------------------ + +PDF: + exp( -exp( -(x-zeta)/theta ) - (x-zeta)/theta ) + +constant: + 1/theta + +domain: + -infinity < x 0 1 (scale) +reference: + [JKBc95: Ch.22; p.2] + +special generators: + ‘INV’ + Inversion method + +7.1.8 ‘extremeII’ – Extreme value type II (Frechet-type) distribution +--------------------------------------------------------------------- + +PDF: + exp( -((x-zeta)/theta)^(-k)) * ((x-zeta)/theta)^(-k-1) + +constant: + k/theta + +domain: + zeta < x 0 (shape) + ‘[1]’ zeta 0 (location) + ‘[2]’ theta > 0 1 (scale) +reference: + [JKBc95: Ch.22; p.2] + +special generators: + ‘INV’ + Inversion method + +7.1.9 ‘gamma’ – Gamma distribution +---------------------------------- + +PDF: + ((x-gamma)/beta)^(alpha-1) * exp( -(x-gamma)/beta ) + +constant: + 1 / (beta * Gamma(alpha)) + +domain: + gamma < x < infinity + +parameters 1 (3): alpha [, beta [, gamma ] ] + No. name default + ‘[0]’ alpha > 0 (shape) + ‘[1]’ beta > 0 1 (scale) + ‘[2]’ gamma 0 (location) +reference: + [JKBb94: Ch.17; p.337] + +special generators: + ‘DEF’ + Acceptance Rejection combined with Acceptance Complement [ADa74] + [ADa82] + ‘2’ + Rejection from log-logistic envelopes [CHa77] + +7.1.10 ‘gig’ – Generalized Inverse Gaussian distribution +-------------------------------------------------------- + +PDF: + x^(theta-1) * exp( -1/2 * omega * (x/eta + eta/x)) + +constant: + not implemented! + +CDF: + not implemented! + +domain: + 0 < x 0 (scale) + ‘[2]’ eta > 0 1 (shape) +reference: + [JKBb94: Ch.15; p.84] + +special generators: + ‘DEF’ + Ratio-of-Uniforms method [Dag89] + +7.1.11 ‘gig2’ – Generalized Inverse Gaussian distribution +--------------------------------------------------------- + +PDF: + x^(theta-1) * exp( -1/2 * (chi/x + psi*x)) + +constant: + not implemented! + +CDF: + not implemented! + +domain: + 0 < x 0 (shape) + ‘[2]’ chi > 0 (shape) +reference: + [JKBb94: Ch.15; p.84] + +7.1.12 ‘hyperbolic’ – Hyperbolic distribution +--------------------------------------------- + +PDF: + exp( -alpha * sqrt(delta^2 + (x - mu)^2) + beta*(x-mu) ) + +constant: + not implemented! + +CDF: + not implemented! + +domain: + -infinity < x |beta| (shape (tail)) + ‘[1]’ beta (shape (asymmetry)) + ‘[2]’ delta > 0 (scale) + ‘[3]’ mu (location) + +7.1.13 ‘ig’ – Inverse Gaussian distribution +------------------------------------------- + +PDF: + sqrt( lambda/2*pi*x^3 ) * exp( -(lambda*(x-mu)^2)/2*mu^2*x ) + +constant: + 1 + +CDF: + not implemented! + +domain: + 0 < x 0 (mean) + ‘[1]’ lambda > 0 (shape) +reference: + [JKBb94: Ch.15; p.259] + +7.1.14 ‘laplace’ – Laplace distribution +--------------------------------------- + +PDF: + exp( -|x-theta| / phi ) + +constant: + 1/(2 * phi) + +domain: + -infinity < x 0 1 (scale) +reference: + [JKBc95: Ch.24; p.164] + +special generators: + ‘INV’ + Inversion method + +7.1.15 ‘logistic’ – Logistic distribution +----------------------------------------- + +PDF: + exp(-(x-alpha)/beta) * (1 + exp(-(x-alpha)/beta))^(-2) + +constant: + 1/beta + +domain: + -infinity < x 0 1 (scale) +reference: + [JKBc95: Ch.23; p.115] + +special generators: + ‘INV’ + Inversion method + +7.1.16 ‘lognormal’ – Log-Normal distribution +-------------------------------------------- + +PDF: + 1/(x-theta) * exp( -(log(x-theta)-zeta)^2/(2 sigma^2) ) + +constant: + 1/(sigma * sqrt(2 pi)) + +domain: + theta <= x < infinity + +parameters 2 (3): zeta, sigma [, theta ] + No. name default + ‘[0]’ zeta (shape) + ‘[1]’ sigma > 0 (shape) + ‘[2]’ theta 0 (location) +reference: + [JKBb94: Ch.14; p. 208] + +7.1.17 ‘lomax’ – Lomax distribution (Pareto distribution of second kind) +------------------------------------------------------------------------ + +PDF: + (x+C)^(-(a+1)) + +constant: + a * C^a + +domain: + 0 <= x < infinity + +parameters 1 (2): a [, C ] + No. name default + ‘[0]’ a > 0 (shape) + ‘[1]’ C > 0 1 (scale) +reference: + [JKBb94: Ch.20; p.575] + +special generators: + ‘INV’ + Inversion method + +7.1.18 ‘normal’ – Normal distribution +------------------------------------- + +PDF: + exp( -1/2 * ((x-mu)/sigma)^2 ) + +constant: + 1 / (sigma * sqrt(2 pi)) + +domain: + -infinity < x < infinity + +parameters 0 (2): [ mu [, sigma ] ] + No. name default + ‘[0]’ mu 0 (location) + ‘[1]’ sigma > 0 1 (scale) +reference: + [JKBb94: Ch.13; p.80] + +special generators: + ‘DEF’ + ACR method (Acceptance-Complement Ratio) [HDa90] + ‘1’ + Box-Muller method [BMa58] + ‘2’ + Polar method with rejection [MGa62] + ‘3’ + Kindermann-Ramage method [KRa76] + ‘INV’ + Inversion method (slow) + +7.1.19 ‘pareto’ – Pareto distribution (of first kind) +----------------------------------------------------- + +PDF: + x^(-(a+1)) + +constant: + a * k^a + +domain: + k < x < infinity + +parameters 2 (2): k, a + No. name default + ‘[0]’ k > 0 (shape, location) + ‘[1]’ a > 0 (shape) +reference: + [JKBb94: Ch.20; p.574] + +special generators: + ‘INV’ + Inversion method + +7.1.20 ‘powerexponential’ – Powerexponential (Subbotin) distribution +-------------------------------------------------------------------- + +PDF: + exp( -|x|^tau ) + +constant: + 1 / (2 * Gamma(1+1/tau)) + +domain: + -infinity < x < infinity + +parameters 1 (1): tau + No. name default + ‘[0]’ tau > 0 (shape) +reference: + [JKBc95: Ch.24; p.195] + +special generators: + ‘DEF’ + Transformed density rejection (only for tau >= 1) [DLa86] + +7.1.21 ‘rayleigh’ – Rayleigh distribution +----------------------------------------- + +PDF: + x * exp( -1/2 * (x/sigma)^2 ) + +constant: + 1 / sigma^2 + +domain: + 0 <= x < infinity + +parameters 1 (1): sigma + No. name default + ‘[0]’ sigma > 0 (scale) +reference: + [JKBb94: Ch.18; p.456] + +7.1.22 ‘slash’ – Slash distribution +----------------------------------- + +PDF: + (1 - exp(-x^2/2)) / x^2 + +constant: + 1 / sqrt(2 pi) + +CDF: + not implemented! + +domain: + -infinity < x < infinity + +reference: + [JKBb94: Ch.12; p.63] + +special generators: + ‘DEF’ + Ratio of normal and uniform random variates + +7.1.23 ‘student’ – Student’s t distribution +------------------------------------------- + +PDF: + (1+t^2/nu)^(-(nu+1)/2) + +constant: + 1 / (sqrt(nu) * B(1/2,nu/2)) + +CDF: + not implemented! + +domain: + -infinity < x < infinity + +parameters 1 (1): nu + No. name default + ‘[0]’ nu > 0 (shape) +reference: + [JKBc95: Ch.28; p.362] + +7.1.24 ‘triangular’ – Triangular distribution +--------------------------------------------- + +PDF: + 2*x / H, for 0 <= x <= H + + 2*(1-x) / (1-H), for H <= x <= 1 + +constant: + 1 + +domain: + 0 <= x <= 1 + +parameters 0 (1): [ H ] + No. name default + ‘[0]’ H 0 <= H <= 1 1/2 (shape) +reference: + [JKBc95: Ch.26; p.297] + +special generators: + ‘INV’ + Inversion method + +7.1.25 ‘uniform’ – Uniform distribution +--------------------------------------- + +PDF: + 1 / (b-a) + +constant: + 1 + +domain: + a < x < b + +parameters 0 (2): [ a, b ] + No. name default + ‘[0]’ a 0 (location) + ‘[1]’ b > a 1 (location) +reference: + [JKBc95: Ch.26; p.276] + +special generators: + ‘INV’ + Inversion method + +7.1.26 ‘weibull’ – Weibull distribution +--------------------------------------- + +PDF: + ((x-zeta)/alpha)^(c-1) * exp( -((x-zeta)/alpha)^c ) + +constant: + c / alpha + +domain: + zeta < x < infinity + +parameters 1 (3): c [, alpha [, zeta ] ] + No. name default + ‘[0]’ c > 0 (shape) + ‘[1]’ alpha > 0 1 (scale) + ‘[2]’ zeta 0 (location) +reference: + [JKBb94: Ch.21; p.628] + +special generators: + ‘INV’ + Inversion method + +7.2 UNU.RAN Library of continuous multivariate distributions +============================================================ + +7.2.1 ‘copula’ – Copula (distribution with uniform marginals) +------------------------------------------------------------- + + ‘UNUR_DISTR *unur_distr_copula(int dim, const double *rankcorr)’ creates a +distribution object for a copula with DIM components. RANKCORR is an array of +size DIMxDIM and holds the rank correlation matrix (Spearman’s correlation), +where the rows of the matrix are stored consecutively in this array. The ‘NULL’ +pointer can be used instead the identity matrix. + + If COVAR is not a valid rank correlation matrix (i.e., not positive definite) +then no distribution object is created and ‘NULL’ is returned. + +7.2.2 ‘multicauchy’ – Multicauchy distribution +---------------------------------------------- + +PDF: + f(x) = 1 / ( 1 + (x-mu)^t . Sigma^(-1) . (x-mu) )^((dim+1)/2) + +constant: + Gamma((dim+1)/2) / ( pi^((dim+1)/2) * sqrt(det(Sigma)) ) + +domain: + -infinity^(dim) < x < infinity^(dim) + +parameters 0 (2): [ mu, Sigma ] + No. name default + ‘[0]’ mu (0,...,0) (location) + ‘[1]’ Sigma Symm, Pos. I (shape) + def. +special generators: + ‘DEF’ + Cholesky factor + +7.2.3 ‘multiexponential’ – Multiexponential distribution +-------------------------------------------------------- + +PDF: + f(x) = Prod_(i=0)^(i=dim-1) exp(-(dim-i) (x_(i)-x_(i-1) - + (theta_i-theta_(i-1)) ) / sigma_i); with x_(-1)=0 and theta_(i-1)=0 + +constant: + Prod_(i=0)^(i=dim-1) 1/sigma_i + +domain: + 0^(dim) <= x < infinity^(dim) + +parameters 0 (2): [ sigma, theta ] + No. name default + ‘[0]’ sigma (1,...,1) (shape) + ‘[1]’ theta (0,...,0) (location) + +7.2.4 ‘multinormal’ – Multinormal distribution +---------------------------------------------- + +PDF: + f(x) = exp( -1/2 * (x-mu)^t . Sigma^(-1) . (x-mu) ) + +constant: + 1 / ( (2 pi)^(dim/2) * sqrt(det(Sigma)) ) + +domain: + -infinity^(dim) < x < infinity^(dim) + +parameters 0 (2): [ mu, Sigma ] + No. name default + ‘[0]’ mu (0,...,0) (location) + ‘[1]’ Sigma Symm, Pos. I (shape) + def. +reference: + [KBJe00: Ch.45; p.105] + +7.2.5 ‘multistudent’ – Multistudent distribution +------------------------------------------------ + +PDF: + f(x) = 1 / ( 1 + (x-mu)^t . Sigma^(-1) . (x-mu) / m)^((dim+m)/2) ) + +constant: + Gamma((dim+m)/2) / ( Gamma(m/2) (m*pi)^(dim/2) * sqrt(det(Sigma)) ) + +domain: + -infinity^(dim) < x < infinity^(dim) + +parameters 0 (3): [ m, mu, Sigma ] + No. name default + ‘[0]’ m m>0 1 (location) + ‘[1]’ mu (0,...,0) (location) + ‘[2]’ Sigma Symm, Pos. I (shape) + def. + +7.3 UNU.RAN Library of discrete univariate distributions +======================================================== + +At the moment there are no CDFs implemented for discrete distribution. Thus +‘unur_distr_discr_upd_pmfsum’ does not work properly for truncated distribution. + +7.3.1 ‘binomial’ – Binomial distribution +---------------------------------------- + +PMF: + (n \choose k) * p^k * (1-p)^(n-k) + +constant: + 1 + +domain: + 0 <= k <= n + +parameters 2 (2): n, p + No. name default + ‘[0]’ n >= 1 (no. of elements) + ‘[1]’ p 0 < p < 1 (shape) +reference: + [JKKa92: Ch.3; p.105] + +special generators: + ‘DEF’ + Ratio of Uniforms/Inversion [STa89] + +7.3.2 ‘geometric’ – Geometric distribution +------------------------------------------ + +PMF: + p * (1-p)^k + +constant: + 1 + +domain: + 0 <= k < infinity + +parameters 1 (1): p + No. name default + ‘[0]’ p 0 < p < 1 (shape) +reference: + [JKKa92: Ch.5.2; p.201] + +special generators: + ‘INV’ + Inversion method + +7.3.3 ‘hypergeometric’ – Hypergeometric distribution +---------------------------------------------------- + +PMF: + (M \choose k) * (N-M \choose n-k) / (N \choose n) + +constant: + 1 + +domain: + max(0,n-N+M) <= k <= min(n,M) + +parameters 3 (3): N, M, n + No. name default + ‘[0]’ N >= 1 (no. of elements) + ‘[1]’ M 1 <= M <= N (shape) + ‘[2]’ n 1 <= n <= N (shape) +reference: + [JKKa92: Ch.6; p.237] + +special generators: + ‘DEF’ + Ratio of Uniforms/Inversion [STa89] + +7.3.4 ‘logarithmic’ – Logarithmic distribution +---------------------------------------------- + +PMF: + theta^k / k + +constant: + - log( 1.-theta); + +domain: + 1 <= k < infinity + +parameters 1 (1): theta + No. name default + ‘[0]’ theta 0 < theta < (shape) + 1 +reference: + [JKKa92: Ch.7; p.285] + +special generators: + ‘DEF’ + Inversion/Transformation [KAa81] + +7.3.5 ‘negativebinomial’ – Negative Binomial distribution +--------------------------------------------------------- + +PMF: + (k+r-1 \choose r-1) * p^r * (1-p)^k + +constant: + 1 + +domain: + 0 <= k < infinity + +parameters 2 (2): p, r + No. name default + ‘[0]’ p 0 < p < 1 (shape) + ‘[1]’ r > 0 (shape) +reference: + [JKKa92: Ch.5.1; p.200] + +7.3.6 ‘poisson’ – Poisson distribution +-------------------------------------- + +PMF: + theta^k / k! + +constant: + exp(theta) + +domain: + 0 <= k < infinity + +parameters 1 (1): theta + No. name default + ‘[0]’ theta > 0 (shape) +reference: + [JKKa92: Ch.4; p.151] + +special generators: + ‘DEF’ + Tabulated Inversion combined with Acceptance Complement [ADb82] + ‘2’ + Tabulated Inversion combined with Patchwork Rejection [ZHa94] + +7.4 UNU.RAN Library of random matrices +====================================== + +7.4.1 ‘correlation’ – Random correlation matrix +----------------------------------------------- + + ‘UNUR_DISTR *unur_distr_correlation( int n )’ creates a distribution object +for a random correlation matrix of N rows and columns. It can be used with +method MCORR (*note Random Correlation Matrix: MCORR.) to generate random +correlation matrices of the given size. + +8 Error handling and Debugging +****************************** + +UNU.RAN routines report an error whenever they cannot perform the requested +task. Additionally it is possible to get information about the generated +distribution of generator objects for debugging purposes. However, the latter +must be enabled when compiling and installing the library. (It is disabled by +default.) This chapter describes all necessary details: + + • Choose an output stream to for writing the requested information. + • Select a debugging level. + • Select an error handler. + • Write your own error handler. + • Get more information for a particular error code. + +8.1 Output streams +================== + +UNU.RAN uses a logfile for writing all error messages, warnings, and debugging +information onto an output stream. This stream can be set at runtime by the +‘unur_set_stream’ call. If no such stream is given by the user a default stream +is used by the library: all messages are written into the file ‘unuran.log’ in +the current working directory. The name of this logfile is defined by the macro +‘UNUR_LOG_FILE’ in ‘unuran_config.h’. (If UNU.RAN fails to open this file for +writing, ‘stderr’ is used instead.) + + To destinguish between messages for different objects each of these has its +own identifier which is composed by the name of the distribution obejct and +generator type, resp., followed by a dot and three digits. (If there are more +than 999 generators then the identifiers are not unique.) + + _Remark:_ Writting debugging information must be switched on at compile time +using the configure flag ‘--enable-logging’, see *note Debugging: Debug. + +Function reference +------------------ + + -- Function: FILE* unur_set_stream (FILE* NEW_STREAM) + This function sets a new file handler for the output stream, NEW_STREAM, + for the UNU.RAN library routines. The previous handler is returned (so + that you can restore it later). Note that the pointer to a user defined + file handler is stored in a static variable, so there can be only one + output stream handler per program. This function should be not be used in + multi-threaded programs except to set up a program-wide error handler from + a master thread. + + The ‘NULL’ pointer is not allowed. (If you want to disable logging of + debugging information use unur_set_default_debug(UNUR_DEBUG_OFF) instead. + If you want to disable error messages at all use + ‘unur_set_error_handler_off’. ) + + -- Function: FILE* unur_get_stream (void) + Get the file handle for the current output stream. It can be used to allow + applications to write additional information into the logfile. + +8.2 Debugging +============= + +The UNU.RAN library has several debugging levels which can be switched on/off by +debugging flags. This debugging feature must be enabled when building the +library using the ‘--enable-logging’ configure flag. + + The debugging levels range from print a short description of the created +generator object to a detailed description of hat functions and tracing the +sampling routines. The output is printed onto the debugging output stream +(*note Output streams: Output_streams.). + + The debugging flags can be set or changed by the respective calls +‘unur_set_debug’ and ‘unur_chg_debug’ independently for each generator. + + By default flag ‘UNUR_DEBUG_INIT’ (see below) is used. This default flags is +set by the macro ‘UNUR_DEBUGFLAG_DEFAULT’ in ‘unuran_config.h’ and can be +changed at runtime by a ‘unur_set_default_debug’ call. + + Off course these debugging flags depend on the chosen method. Since most of +these are merely for debugging the library itself, a description of the flags +are given in the corresponding source files of the method. Nevertheless, the +following flags can be used with all methods. + + Common debug flags: + +‘UNUR_DEBUG_OFF’ + switch off all debuging information +‘UNUR_DEBUG_ALL’ + all avaivable information +‘UNUR_DEBUG_INIT’ + parameters of generator object after initialization +‘UNUR_DEBUG_SETUP’ + data created at setup +‘UNUR_DEBUG_ADAPT’ + data created during adaptive steps +‘UNUR_DEBUG_SAMPLE’ + trace sampling + + Notice that these are flags which could be combined using the ‘|’ operator. + + Almost all routines check a given pointer before they read from or write to +the given address. This does not hold for time-critical routines like all +sampling routines. Thus you are responsible for checking a pointer that is +returned from a ‘unur_init’ call. However, it is possible to turn on checking +for invalid ‘NULL’ pointers even in such time-critical routines by building the +library using the ‘--enable-check-struct’ configure flag. + + Another debugging tool used in the library are magic cookies that validate a +given pointer. It produces an error whenever a given pointer points to an +object that is invalid in the context. The usage of magic cookies is also +switched on by the ‘--enable-check-struct’ configure flag. + +Function reference +------------------ + + -- Function: int unur_set_debug (UNUR_PAR* PARAMETERS, unsigned DEBUG) + Set debugging flags for generator. + + -- Function: int unur_chg_debug (UNUR_GEN* GENERATOR, unsigned DEBUG) + Change debugging flags for generator. + + -- Function: int unur_set_default_debug (unsigned DEBUG) + Change default debugging flag. + +8.3 Error reporting +=================== + +UNU.RAN routines report an error whenever they cannot perform the requested +task. For example, applying transformed density rejection to a distribution +that violates the T-concavity condition, or trying to set a parameter that is +out of range, result in an error message. It might also happen that the setup +fails for transformed density rejection for a T-concave distribution with some +extreme density function simply because of round-off errors that makes the +generation of a hat function numerically impossible. Situations like this may +happen when using black box algorithms and you should check the return values of +all routines. + + All ‘..._set_...’, and ‘..._chg_...’ calls return ‘UNUR_SUCCESS’ if they +could be executed successfully. Otherwise, some error codes are returned if it +was not possible to set or change the desired parameters, e.g. because the +given values are out of range, or simply because the set call does not work for +the chosen method. + + All routines that return a pointer to the requested object will return a +‘NULL’ pointer in case of error. (Thus you should always check the pointer to +avoid possible segmentation faults. Sampling routines usually do not check the +given pointer to the generator object.) + + The library distinguishes between two major classes of error: + +_(fatal) errors:_ + The library was not able to construct the requested object. + +_warnings:_ + Some problems encounters while constructing a generator object. The + routine has tried to solve the problem but the resulting object might not + be what you want. For example, chosing a special variant of a method does + not work and the initialization routine might switch to another variant. + Then the generator produces random variates of the requested distribution + but correlation induction is not possible. However, it also might happen + that changing the domain of a distribution has failed. Then the generator + produced random variates with too large/too small range, i.e. their + distribution is not correct. + + It is obvious from the example that this distinction between errors and +warning is rather crude and sometimes arbitrary. + + UNU.RAN routines use the global variable UNUR_ERRNO to report errors, +completely analogously to ERRNO in the ANSI C standard library. (However this +approach is not thread-safe. There can be only one instance of a global +variable per program. Different threads of execution may overwrite UNUR_ERRNO +simultaneously). Thus when an error occurs the caller of the routine can +examine the error code in UNUR_ERRNO to get more details about the reason why a +routine failed. You get a short description of the error by a +‘unur_get_strerror’ call. All the error code numbers have prefix ‘UNUR_ERR_’ +and expand to non-zero constant unsigned integer values. Error codes are +divided into six main groups, see *note Error codes: Errno. + + Alternatively, the variable UNUR_ERRNO can also read by a ‘unur_get_errno’ +call and can be reset by the ‘unur_reset_errno’ call (this is in particular +required for the Windows version of the library). + + Additionally, there exists a error handler (*note Error handlers: +Error_handlers.) that is invoked in case of an error. + + In addition to reporting errors by setting error codes in UNUR_ERRNO, the +library also has an error handler function. This function is called by other +library functions when they report an error, just before they return to the +caller (*note Error handlers: Error_handlers.). The default behavior of the +error handler is to print a short message: + + AROU.004: [error] arou.c:1500 - (generator) condition for method violated: + AROU.004: ..> PDF not unimodal + + The purpose of the error handler is to provide a function where a breakpoint +can be set that will catch library errors when running under the debugger. It +is not intended for use in production programs, which should handle any errors +using the return codes. + +Function reference +------------------ + + -- Variable: extern int unur_errno + Global variable for reporting diagnostics of error. + + -- Function: int unur_get_errno (void) + Get current value of global variable UNUR_ERRNO. + + -- Function: void unur_reset_errno (void) + Reset global variable UNUR_ERRNO to ‘UNUR_SUCCESS’ (i.e., no errors + occured). + + -- Function: const char* unur_get_strerror (const INT ERRNOCODE) + Get a short description for error code value. + +8.4 Error codes +=============== + +List of error codes +................... + + • Procedure executed successfully (no error) + ‘UNUR_SUCCESS (0x0u)’ + success (no error) + + • Errors that occurred while handling distribution objects. + ‘UNUR_ERR_DISTR_SET’ + set failed (invalid parameter). + ‘UNUR_ERR_DISTR_GET’ + get failed (parameter not set). + ‘UNUR_ERR_DISTR_NPARAMS’ + invalid number of parameters. + ‘UNUR_ERR_DISTR_DOMAIN’ + parameter(s) out of domain. + ‘UNUR_ERR_DISTR_GEN’ + invalid variant for special generator. + ‘UNUR_ERR_DISTR_REQUIRED’ + incomplete distribution object, entry missing. + ‘UNUR_ERR_DISTR_UNKNOWN’ + unknown distribution, cannot handle. + ‘UNUR_ERR_DISTR_INVALID’ + invalid distribution object. + ‘UNUR_ERR_DISTR_DATA’ + data are missing. + ‘UNUR_ERR_DISTR_PROP’ + desired property does not exist + + • Errors that occurred while handling parameter objects. + ‘UNUR_ERR_PAR_SET’ + set failed (invalid parameter) + ‘UNUR_ERR_PAR_VARIANT’ + invalid variant -> using default + ‘UNUR_ERR_PAR_INVALID’ + invalid parameter object + + • Errors that occurred while handling generator objects. + ‘UNUR_ERR_GEN’ + error with generator object. + ‘UNUR_ERR_GEN_DATA’ + (possibly) invalid data. + ‘UNUR_ERR_GEN_CONDITION’ + condition for method violated. + ‘UNUR_ERR_GEN_INVALID’ + invalid generator object. + ‘UNUR_ERR_GEN_SAMPLING’ + sampling error. + ‘UNUR_ERR_NO_REINIT’ + reinit routine not implemented. + ‘UNUR_ERR_NO_QUANTILE’ + quantile routine not implemented. + + • Errors that occurred while handling URNG objects. + ‘UNUR_ERR_URNG’ + generic error with URNG object. + ‘UNUR_ERR_URNG_MISS’ + missing functionality. + + • Errors that occurred while parsing strings. + ‘UNUR_ERR_STR’ + error in string. + ‘UNUR_ERR_STR_UNKNOWN’ + unknown keyword. + ‘UNUR_ERR_STR_SYNTAX’ + syntax error. + ‘UNUR_ERR_STR_INVALID’ + invalid parameter. + ‘UNUR_ERR_FSTR_SYNTAX’ + syntax error in function string. + ‘UNUR_ERR_FSTR_DERIV’ + cannot derivate function. + + • Other run time errors. + ‘UNUR_ERR_DOMAIN’ + argument out of domain. + ‘UNUR_ERR_ROUNDOFF’ + (serious) round-off error. + ‘UNUR_ERR_MALLOC’ + virtual memory exhausted. + ‘UNUR_ERR_NULL’ + invalid ‘NULL’ pointer. + ‘UNUR_ERR_COOKIE’ + invalid cookie. + ‘UNUR_ERR_GENERIC’ + generic error. + ‘UNUR_ERR_SILENT’ + silent error (no error message). + ‘UNUR_ERR_INF’ + infinity occured. + ‘UNUR_ERR_NAN’ + NaN occured. + ‘UNUR_ERR_COMPILE’ + Requested routine requires different compilation switches. + Recompilation of library necessary. + ‘UNUR_ERR_SHOULD_NOT_HAPPEN’ + Internal error, that should not happen. Please report this bug! + +8.5 Error handlers +================== + +The default behavior of the UNU.RAN error handler is to print a short message +onto the output stream, usually a logfile (*note Output streams: +Output_streams.), e.g., + + AROU.004: [error] arou.c:1500 - (generator) condition for method violated: + AROU.004: ..> PDF not unimodal + + This error handler can be switched off using the ‘unur_set_error_handler_off’ +call, or replace it by a new one. Thus it allows to set a breakpoint that will +catch library errors when running under the debugger. It also can be used to +redirect error messages when UNU.RAN is included in general purpose libraries or +in interactive programming environments. + + -- Data Type: UNUR_ERROR_HANDLER + + This is the type of UNU.RAN error handler functions. An error handler will + be passed six arguments which specify the identifier of the object where + the error occured (a string), the name of the source file in which it + occurred (also a string), the line number in that file (an integer), the + type of error (a string: ‘"error"’ or ‘"warning"’), the error number (an + integert), and the reason for the error (a string). The source file and + line number are set at compile time using the ‘__FILE__’ and ‘__LINE__’ + directives in the preprocessor. The error number can be translated into a + short description using a ‘unur_get_strerror’ call. An error handler + function returns type ‘void’. + + Error handler functions should be defined like this, + void my_handler( + const char *objid, + const char *file, + int line, + const char *errortype, + int unur_errno, + const char *reason ) + + To request the use of your own error handler you need the call +‘unur_set_error_handler’. + +Function reference +------------------ + + -- Function: UNUR_ERROR_HANDLER* unur_set_error_handler (UNUR_ERROR_HANDLER* + NEW_HANDLER) + This function sets a new error handler, NEW_HANDLER, for the UNU.RAN + library routines. The previous handler is returned (so that you can + restore it later). Note that the pointer to a user defined error handler + function is stored in a static variable, so there can be only one error + handler per program. This function should be not be used in multi-threaded + programs except to set up a program-wide error handler from a master + thread. + + To use the default behavior set the error handler to ‘NULL’. + + -- Function: UNUR_ERROR_HANDLER* unur_set_error_handler_off (void) + This function turns off the error handler by defining an error handler + which does nothing (except of setting UNUR_ERRNO. The previous handler is + returned (so that you can restore it later). + +9 Testing +********* + +The following routines can be used to test the performance of the implemented +generators and can be used to verify the implementions. They are declared in +‘unuran_tests.h’ which has to be included. + +Function reference +------------------ + + -- Function: void unur_run_tests (UNUR_PAR* PARAMETERS, unsigned TESTS, FILE* + OUT) + Run a battery of tests. The following tests are available (use ‘|’ to + combine these tests): + ‘UNUR_TEST_ALL’ + run all possible tests. + ‘UNUR_TEST_TIME’ + estimate generation times. + ‘UNUR_TEST_N_URNG’ + count number of uniform random numbers + ‘UNUR_TEST_N_PDF’ + count number of PDF calls + ‘UNUR_TEST_CHI2’ + run chi^2 test for goodness of fit + ‘UNUR_TEST_SAMPLE’ + print a small sample. + All these tests can be started individually (see below). + + -- Function: void unur_test_printsample (UNUR_GEN* GENERATOR, int N_ROWS, int + N_COLS, FILE* OUT) + Print a small sample with N_ROWS rows and N_COLS columns. OUT is the + output stream to which all results are written. + + -- Function: UNUR_GEN* unur_test_timing (UNUR_PAR* PARAMETERS, int + LOG10_SAMPLESIZE, double* TIME_SETUP, double* TIME_SAMPLE, int + VERBOSITY, FILE* OUT) + Timing. PARAMETERS is an parameter object for which setup time and + marginal generation times have to be measured. The results are written + into TIME_SETUP and TIME_SAMPLE, respectively. LOG10_SAMPLESIZE is the + common logarithm of the sample size that is used for timing. + + If VERBOSITY is ‘TRUE’ then a small table is printed to output stream OUT + with setup time, marginal generation time and average generation times for + generating 10, 100, ... random variates. All times are given in micro + seconds and relative to the generation times for the underlying uniform + random number (using the UNIF interface) and an exponential distributed + random variate using the inversion method. + + The created generator object is returned. If a generator object could not + be created successfully, then ‘NULL’ is returned. + + If VERBOSITY is ‘TRUE’ the result is written to the output stream OUT. + + Notice: All timing results are subject to heavy changes. Reruning timings + usually results in different results. Minor changes in the source code can + cause changes in such timings up to 25 percent. + + -- Function: double unur_test_timing_R (UNUR_PAR* PARAMETERS, const CHAR* + DISTRSTR, const CHAR* METHODSTR, double LOG10_SAMPLESIZE, double* + TIME_SETUP, double* TIME_MARGINAL) + Timing. PARAMETERS is an parameter object for which setup time and + marginal generation times have to be measured. The results are written + into TIME_SETUP and TIME_MARGINAL, respectively. LOG10_SAMPLESIZE is the + common logarithm of the sample size that is used for timing. + + Alternatively, one could provide the "parameter object" using strings + DISTRSTR and METHODSTR as used for ‘unur_makegen_ssu’. The results are + more accurate than those of function ‘unur_test_timing’ as the timings are + computed using linear regression with several timings for sample size 1 and + 10^LOG10_SAMPLESIZE. For each sample size total generation time (including + setup) is measured 10 times. Since the these timings can be influenced by + external effects (like disc sync or handling of interupts) the 2 fastest + and the 3 slowest timings are discarded. Intercept and slope for simple + linear regression are than stored and R^2 is returned. + + In case of an error ‘-100.’ is returned. + + Notice: All timing results are subject to heavy changes. Reruning timings + usually results in different results. Minor changes in the source code can + cause changes in such timings up to 25 percent. + + -- Function: double unur_test_timing_uniform (const UNUR_PAR* PARAMETERS, int + LOG10_SAMPLESIZE) + -- Function: double unur_test_timing_exponential (const UNUR_PAR* PARAMETERS, + int LOG10_SAMPLESIZE) + Marginal generation times for the underlying uniform random number (using + the UNIF interface) and an exponential distributed random variate using the + inversion method. These times are used in ‘unur_test_timing’ to compute + the relative timings results. + + -- Function: double unur_test_timing_total (const UNUR_PAR* PARAMETERS, int + SAMPLESIZE, double AVG_DURATION) + Timing. PARAMETERS is an parameter object for which average times a sample + of size SAMPLESIZE (including setup) are estimated. Thus sampling is + repeated and the median of these timings is returned (in micro seconds). + The number of iterations is computed automatically such that the total + amount of time necessary for the test ist approximately AVG_DURATION (given + in seconds). However, for very slow generator with expensive setup time + the time necessary for this test may be (much) larger. + + If an error occurs then ‘-1’ is returned. + + Notice: All timing results are subject to heavy changes. Reruning timings + usually results in different results. Minor changes in the source code can + cause changes in such timings up to 25 percent. + + -- Function: int unur_test_count_urn (UNUR_GEN* GENERATOR, int SAMPLESIZE, int + VERBOSITY, FILE* OUT) + Count used uniform random numbers. It returns the total number of uniform + random numbers required for a sample of non-uniform random variates of size + SAMPLESIZE. In case of an error ‘-1’ is returned. + + If VERBOSITY is ‘TRUE’ the result is written to the output stream OUT. + + _Notice:_ This test uses global variables to store counters. Thus it is + not thread save. + + -- Function: int unur_test_count_pdf (UNUR_GEN* GENERATOR, int SAMPLESIZE, int + VERBOSITY, FILE* OUT) + Count evaluations of PDF and similar functions. It returns the total + number of evaluations of all such functions required for a sample of + non-uniform random variates of size SAMPLESIZE. If VERBOSITY is ‘TRUE’ + then a more detailed report is printed to the output stream OUT. In case + of an error ‘-1’ is returned. This test is run on a copy of the given + generator object. + + _Notice:_ The printed numbers of evaluation should be interpreted with + care. For example, methods either use the PDF or the logPDF; if only the + logPDF is given, but a method needs the PDF then both the logPDF and the + PDF (a wrapper around the logPDF) are called and thus one call to the PDF + is counted twice. + + _Notice:_ This test uses global variables to store function pointers and + counters. Thus it is not thread save. + + -- Function: int unur_test_par_count_pdf (UNUR_PAR* PARAMETERS, int SAMPLESIZE, + int VERBOSITY, FILE* OUT) + Same as ‘unur_test_count_pdf’ except that it is run on a parameter object. + Thus it also prints the number of function evaluations for the setup. The + temporary created generator object is destroyed before the results are + returned. + + -- Function: double unur_test_chi2 (UNUR_GEN* GENERATOR, int INTERVALS, int + SAMPLESIZE, int CLASSMIN, int VERBOSITY, FILE* OUT) + Run a Chi^2 test with the GENERATOR. The resulting p-value is returned. + + It works with discrete und continuous univariate distributions. For the + latter the CDF of the distribution is required. + + INTERVALS is the number of intervals that is used for continuous univariate + distributions. SAMPLESIZE is the size of the sample that is used for + testing. If it is set to ‘0’ then a sample of size INTERVALS^2 is used + (bounded to some upper bound). + + CLASSMIN is the minimum number of expected entries per class. If a class + has to few entries then some classes are joined. + + VERBOSITY controls the output of the routine. If it is set to ‘1’ then the + result is written to the output stream OUT. If it is set to ‘2’ + additionally the list of expected and observed data is printed. If it is + set to ‘3’ then all generated numbers are printed. There is no output when + it is set to ‘0’. + + _Notice:_ For multivariate distributions the generated points are + transformed by the inverse of the Cholesky factor of the covariance matrix + and the mean vectors (if given for the underlying distribution). The + marginal distributions of the transformed vectors are then tested against + the marginal distribution given by a ‘unur_distr_cvec_set_marginals’ or + ‘unur_distr_cvec_set_marginal_array’ call. (Notice that these marginal + distributions are never set by default for any of the distributions + provided by UNU.RAN.) Then the Bonferroni corrected p-value of all these + tests is returned. However, the test may not be performed correctly if the + domain of the underlying distribution is truncated by a + ‘unur_distr_cvec_set_domain_rect’ call and the components of the + distribution are correlated (i.e. ‘unur_distr_cvec_set_covar’ is called + with the non-NULL argument). Then it almost surely will fail. + + -- Function: int unur_test_moments (UNUR_GEN* GENERATOR, double* MOMENTS, int + N_MOMENTS, int SAMPLESIZE, int VERBOSITY, FILE* OUT) + Computes the first N_MOMENTS central moments for a sample of size + SAMPLESIZE. The result is stored into the array MOMENTS. N_MOMENTS must + be an integer between ‘1’ and ‘4’. For multivariate distributions the + moments are stored consecutively for each dimension and the provided + MOMENTS-array must have a length of at least (N_MOMENTS+1) * DIM, where DIM + is the dimension of the multivariate distribution. The M’th moment for the + D’th dimension (0<=D + 0 1 2 3 4 5 + + This algorithm is so simple that inversion is certainly the method of choice +if the inverse CDF is available in closed form. This is the case e.g. for the +exponential and the Cauchy distribution. + + The inversion method also has other special advantages that make it even more +attractive for simulation purposes. It preserves the structural properties of +the underlying uniform pseudo-random number generator. Consequently it can be +used, e.g., for variance reduction techniques, it is easy to sample from +truncated distributions, from marginal distributions, and from order statistics. +Moreover, the quality of the generated random variables depends only on the +underlying uniform (pseudo-) random number generator. Another important +advantage of the inversion method is that we can easily characterize its +performance. To generate one random variate we always need exactly one uniform +variate and one evaluation of the inverse CDF. So its speed mainly depends on +the costs for evaluating the inverse CDF. Hence inversion is often considered as +the method of choice in the simulation literature. + + Unfortunately computing the inverse CDF is, for many important standard +distributions (e.g. for normal, student, gamma, and beta-distributions), +comparatively difficult and slow. Often no such routines are available in +standard programming libraries. Then numerical methods for inverting the CDF +are necessary, e.g. Newton’s method or (polynomial or rational) approximations +of the inverse CDF. Such procedures, however, have the disadvantage that they +are not exact and/or slow. UNU.RAN implements several methods: NINV (*note +NINV::), HINV (*note HINV::) and PINV (*note PINV::). + + For such approximate inversion methods the approximation error is important +for the quality of the generated point set. Let X=G^(-1)(U) denote the +approximate inverse CDF, and let F and F^(-1) be the exact CDF and inverse CDF +of the distribution, resp. There are three measures for the approximation +error: + +_u-error_ + is given by + uerror = |U-F(G^(-1)(U))| + + Goodness-of-fit tests like the Kolmogorov-Smirnov test or the chi-squared + test look at this type of error. We are also convinced that it is the most + suitable error measure for Monte Carlo simulations as pseudo-random numbers + and points of low discrepancy sets are located on a grid of restricted + resolution. + +_x-error_ + is given by + absolute xerror = |F^(-1)(U)-G^(-1)(U)| + + relative xerror = |F^(-1)(U)-G^(-1)(U)| * |F^(-1)(U)| + + The x-error measure the deviation of G^(-1)(U) from the exact result. This + measure is suitable when the inverse CDF is used as a quantile function in + some computations. The main problem with the x-error is that we have to + use the _absolute x-error_ for X=F^(-1)(U) close to zero and the _relative + x-error_ in the tails. + + We use the terms _u-resolution_ and _x-resolution_ as the maximal tolerated +u-error and x-error, resp. + + UNU.RAN allows to set u-resolution and x-resolution independently. Both +requirements must be fulfilled. We use the following strategy for checking +whether the precision goal is reached: + +_checking u-error:_ + The u-error must be slightly smaller than the given u-resolution: + |U-F(G^(-1)(U))| < 0.9 * uresolution. + + There is no necessity to consinder the relative u-error as we have 0 < U < + 1. + +_checking x-error:_ + We combine absoute and relative x-error and use the criterion + |F^(-1)(U)-G^(-1)(U)| < xresolution * (|G^(-1)(U)| + xresolution). + + *Remark:* It should be noted here that the criterion based on the u-error is +too stringent whereever the CDF is extremely steep (and thus the PDF has a pole +or a high and narrow peak). This is in particular a problem for distributions +with a pole (e.g., the gamma distribution with shape parameter less than 0.5). +On the other hand using a criterion based on the x-error causes problems +whereever the CDF is extremly flat. This is in particular the case in the (far) +tails of heavy-tailed distributions (e.g., for the Cauchy distribution). + +A.2 The Rejection Method +======================== + +The rejection method, often called _acceptance-rejection method_, has been +suggested by John von Neumann in 1951. Since then it has proven to be the most +flexible and most efficient method to generate variates from continuous +distributions. + + We explain the rejection principle first for the density f(x) = sin(x)/2 on +the interval (0, pi). To generate random variates from this distribution we also +can sample random points that are uniformly distributed in the region between +the graph of f(x) and the x-axis, i.e., the shaded region in the below figure. + + + ^ + | + +------------------------------**+***------------------------------+ + | o****./.\..**** o | + | **..../...\.....** | + | **...../.....\......** | + | **...../.........\......** | + | *....../...........\.......* o | + | o *....../..............\......* | + | **...../......X..........\......** | + | *....../...................\.......* o | + | *....../......................\......* | + | *...../.........................\......* | + | *..X../...........................\......* | + | *...../..................X...........\.....* | + | *..../.................................\.....* | + | *..../.................................X..\....* o | + | *..../........X.............................\....* | + | *.../.................................X.......\....* | + | *.../............................................\...* | + | *.../....................................X.........\...* | + | *../...........................X.....................\...* | + | *./............X.......................................\..* | + | o *./......................................................\.* | + | */.........................................................\.* | + | */.....................................................X......\* | + |*/......................................X.......................\*| + *---------------+---+--+-------+----++---+----++-+-------+---------*----> + + + In general this is not a trivial task but in this example we can easily use +the rejection trick: Sample a random point (X,Y) uniformly in the bounding +rectangle (0, pi)x(0,0.5). This is easy since each coordinate can be sampled +independently from the respective uniform distributions U(0, pi) and U(0,0.5). +Whenever the point falls into the shaded region below the graph (indicated by +dots in the figure), i.e., when Y < sin(X)/2, we accept it and return X as a +random variate from the distribution with density f(x). Otherwise we have to +reject the point (indicated by small circles in the figure), and try again. + + It is quite clear that this idea works for every distribution with a bounded +density on a bounded domain. Moreover, we can use this procedure with any +multiple of the density, i.e., with any positive bounded function with bounded +integral and it is not necessary to know the integral of this function. So we +use the term density in the sequel for any positive function with bounded +integral. + + From the figure we can conclude that the performance of a rejection algorithm +depends heavily on the area of the enveloping rectangle. Moreover, the method +does not work if the target distribution has infinite tails (or is unbounded). +Hence non-rectangular shaped regions for the envelopes are important and we have +to solve the problem of sampling points uniformly from such domains. Looking +again at the example above we notice that the x-coordinate of the random point +(X,Y) was sampled by inversion from the uniform distribution on the domain of +the given density. This motivates us to replace the density of the uniform +distribution by the (multiple of a) density h(x) of some other appropriate +distribution. We only have to take care that it is chosen such that it is +always an upper bound, i.e., h(x) >= f(x) for all x in the domain of the +distribution. To generate the pair (X,Y) we generate X from the distribution +with density proportional to h(x) and Y uniformly between 0 and h(X). The first +step (generate X ) is usually done by inversion (*note Inversion::). + + Thus the general rejection algorithm for a hat h(x) with inverse CDF H^(-1) +consists of the following steps: + 1. Generate a U(0,1) random number U. + 2. Set X to H^(-1)(U). + 3. Generate a U(0,1) random number V. + 4. Set Y to V h(X). + 5. If Y <= f(X) accept X as the random variate. + 6. Else try again. + + If the evaluation of the density f(x) is expensive (i.e., time consuming) it +is possible to use a simple lower bound of the density as so called _squeeze +function_ s(x) (the triangular shaped function in the above figure is an example +for such a squeeze). We can then accept X when Y <= s(X) and can thus often +save the evaluation of the density. + + We have seen so far that the rejection principle leads to short and simple +generation algorithms. The main practical problem to apply the rejection +algorithm is the search for a good fitting hat function and for squeezes. We do +not discuss these topics here as they are the heart of the different automatic +algorithms implemented in UNU.RAN. Information about the construction of hat and +squeeze can therefore be found in the descriptions of the methods. + + The performance characteristics of rejection algorithms mainly depend on the +fit of the hat and the squeeze. It is not difficult to prove that: + • The expected number of trials to generate one variate is the ratio between + the area below the hat and the area below the density. + • The expected number of evaluations of the density necessary to generate one + variate is equal to the ratio between the area below the hat and the area + below the density, when no squeeze is used. Otherwise, when a squeeze is + given it is equal to the ratio between the area between hat and squeeze and + the area below the hat. + • The ‘sqhratio’ (i.e., the ratio between the area below the squeeze and the + area below the hat) used in some of the UNU.RAN methods is easy to compute. + It is useful as its reciprocal is an upper bound for the expected number of + trials of the rejection algoritm. The expected number of evaluations of + the density is bounded by (1/sqhratio)-1. + +A.3 The Composition Method +========================== + +The composition method is an important principle to facilitate and speed up +random variate generation. The basic idea is simple. To generate random +variates with a given density we first split the domain of the density into +subintervals. Then we select one of these randomly with probabilities given by +the area below the density in the respective subintervals. Finally we generate +a random variate from the density of the selected part by inversion and return +it as random variate of the full distribution. + + Composition can be combined with rejection. Thus it is possible to decompose +the domain of the distribution into subintervals and to construct hat and +squeeze functions seperatly in every subinterval. The area below the hat must +be determined in every subinterval. Then the Composition rejection algorithm +contains the following steps: + + 1. Generate the index J of the subinterval as the realisation of a discrete + random variate with probabilities proportional to the area below the hat. + 2. Generate a random variate X proportional to the hat in interval J. + 3. Generate the U(0,f(X)) random number Y. + 4. If Y <= f(X) accept X as random variate. + 5. Else start again with generating the index J. + + The first step can be done in constant time (i.e., independent of the number +of chosen subintervals) by means of the indexed search method (*note +IndexedSearch::). + + It is possible to reduce the number of uniform random numbers required in the +above algorithm by recycling the random numbers used in Step 1 and additionally +by applying the principle of _immediate acceptance_. For details see [HLD04: +Sect. 3.1] . + +A.4 The Ratio-of-Uniforms Method +================================ + +The construction of an appropriate hat function for the given density is the +crucial step for constructing rejection algorithms. Equivalently we can try to +find an appropriate envelope for the region between the graph of the density and +the x-axis, such that we can easily sample uniformly distributed random points. +This task could become easier if we can find transformations that map the region +between the density and the axis into a region of more suitable shape (for +example into a bounded region). + + As a first example we consider the following simple algorithm for the Cauchy +distribution. + 1. Generate a U(-1,1) random number U and a U(0,1) random number V. + 2. If U^2 + V^2 <= 1 accept X=U/V as a Cauchy random variate. + 3. Else try again. + + It is possible to prove that the above algorithm indeed generates Cauchy +random variates. The fundamental principle behind this algorithm is the fact +that the region below the density is mapped by the transformation + (X,Y) -> (U,V)=(2 Xsqrt(Y),2 sqrt(Y)) + +into a half-disc in such a way that the ratio between the area of the image to +the area of the preimage is constant. This is due to the fact that that the +Jacobian of this transformation is constant. + + + ^ v + | + | + +---------------------------*-***********-*---------------------------+ + | *****.......|.......***** | + | ****............|............**** | + | **................|................** | + | **...................|...................** | + | *.....................|.....................* | + | *.......................|.......................* | + | *........................|.........................* | + | *..........................|..........................* | + | *...........................|...........................* | + | *............................|............................* | + | *.............................|.............................* | + | *..............................|..............................* | + | *...............................|...............................* | + | *...............................|................................* | + | *................................|................................* | + | *................................|................................* | + |*.................................|.................................*| + |*.................................|.................................*| + *..................................|..................................* + *..................................|..................................* + *..................................|..................................* +---*----------------------------------+----------------------------------*--> u + + + The above example is a special case of a more general principle, called the +_Ratio-of-uniforms (RoU) method_. It is based on the fact that for a random +variable X with density f(x) and some constant mu we can generate X from the +desired density by calculating X=U/V+ mu for a pair (U,V) uniformly distributed +in the set + A_f= { (u,v) : 0 < v <= sqrt(f(u/v+ mu)) } . + +For most distributions it is best to set the constant mu equal to the mode of +the distribution. For sampling random points uniformly distributed in A_f +rejection from a convenient enveloping region is used, usually the minimal +bounding rectangle, i.e., the smallest possible rectangle that contains A_f (see +the above figure). It is given by (u^-,u^+)x(0,v^+) where + v^+ = sup_(b_l + 0 1 2 3 4 5 + + + To realize this idea on a computer we have to use a search algorithm. For +the simplest version called _Sequential Search_ the CDF is computed on-the-fly +as sum of the probabilities p(k), since this is usually much cheaper than +computing the CDF directly. It is obvious that the basic form of the search +algorithm only works for discrete random variables with probability mass +functions p(k) for nonnegative k. The sequential search algorithm consists of +the following basic steps: + + 1. Generate a U(0,1) random number U. + 2. Set X to 0 and P to p(0). + 3. Do while U > P + 4. Set X to X+1 and P to P+p(X). + 5. Return X. + + With the exception of some very simple discrete distributions, sequential +search algorithms become very slow as the while-loop has to be repeated very +often. The expected number of iterations, i.e., the number of comparisons in +the while condition, is equal to the expectation of the distribution plus 1. It +can therefore become arbitrary large or even infinity if the tail of the +distribution is very heavy. Another serious problem can be critical round-off +errors due to summing up many probabilities p(k). To speed up the search +procedure it is best to use indexed search. + +A.6 Indexed Search (Guide Table Method) +======================================= + +The idea to speed up the sequential search algorithm is easy to understand. +Instead of starting always at 0 we store a table of size C with starting points +for our search. For this table we compute F^(-1)(U) for C equidistributed +values of U, i.e., for u_i = i/C, i=0,...,C-1. Such a table is called _guide +table_ or _hash table_. Then it is easy to prove that for every U in (0,1) the +guide table entry for k=floor(UC) is bounded by F^(-1)(U). This shows that we +can really start our sequential search procedure from the table entry for k and +the index k of the correct table entry can be found rapidly by means of the +truncation operation. + + The two main differences between _indexed search_ and _sequential search_ are +that we start searching at the number determined by the guide table, and that we +have to compute and store the cumulative probabilities in the setup as we have +to know the cumulative probability for the starting point of the search +algorithm. The rounding problems that can occur in the sequential search +algorithm can occur here as well. Compared to sequential search we have now the +obvious drawback of a slow setup. The computation of the cumulative +probabilities grows linear with the size of the domain of the distribution L. +What we gain is really high speed as the marginal execution time of the sampling +algorithm becomes very small. The expected number of comparisons is bounded by +1+L/C. This shows that there is a trade-off between speed and the size of the +guide table. Cache-effects in modern computers will however slow down the +speed-up for really large table sizes. Thus we recommend to use a guide table +that is about two times larger than the probability vector to obtain optimal +speed. + +Appendix B Glossary +******************* + +*CDF* + cumulative distribution function. + +*HR* + hazard rate (or failure rate). + +*inverse local concavity* + local concavity of inverse PDF f^(-1)(y) expressed in term of x = + f^(-1)(y). Is is given by ilc_f(x) = 1 + x f''(x) / f'(x) + +*local concavity* + maximum value of c such that PDF f(x) is T_c. Is is given by lc_f(x) = 1 - + f''(x) f(x) / f'(x)^2 + +*PDF* + probability density function. + +*dPDF* + derivative (gradient) of probability density function. + +*PMF* + probability mass function. + +*PV* + (finite) probability vector. + +*URNG* + uniform random number generator. + +*U(a,b)* + continuous uniform distribution on the interval (a,b). + +*T-concave* + a function f(x) is called T-convace if the transformed function T(f(x)) is + concave. We only deal with transformations T_c, where + ‘c = 0’ + T(x) = log(x) + ‘c = -0.5’ + T(x) = -1/sqrt(x) + ‘c != 0’ + T(x) = sign(x) * x^c + +*u-error* + for a given approximate inverse CDF X=G^(-1)(U) the u-error is given as + uerror = |U-F(G^(-1)(U))| + + where F denotes the exact CDF. Goodness-of-fit tests like the + Kolmogorov-Smirnov test or the chi-squared test look at this type of error. + See *note Inversion:: for more details. + +*u-resolution* + the maximal tolerated u-error for an approximate inverse CDF. + +*x-error* + for a given approximate inverse CDF X=G^(-1)(U) the x-error is given as + xerror = |F^(-1)(U)-G^(-1)(U)| + + where F^(-1) denotes the exact inverse CDF. The x-error measure the + deviation of G^(-1)(U) from the exact result. Notice that we have to + distinguish between _absolute_ and _relative_ x-error. In UNU.RAN we use + the absolute x-error near 0 and the relative x-error otherwise. See *note + Inversion:: for more details. + +*x-resolution* + the maximal tolerated x-error for an approximate inverse CDF. + +Appendix C Bibliography +*********************** + +Standard Distributions +---------------------- + +[JKKa92] + N.L. JOHNSON, S. KOTZ, AND A.W. KEMP (1992). Univariate Discrete + Distributions, 2nd edition, John Wiley & Sons, Inc., New York. + +[JKBb94] + N.L. JOHNSON, S. KOTZ, AND N. BALAKRISHNAN (1994). Continuous Univariate + Distributions, Volume 1, 2nd edition, John Wiley & Sons, Inc., New York. + +[JKBc95] + N.L. JOHNSON, S. KOTZ, AND N. BALAKRISHNAN (1995). Continuous Univariate + Distributions, Volume 2, 2nd edition, John Wiley & Sons, Inc., New York. + +[JKBd97] + N.L. JOHNSON, S. KOTZ, AND N. BALAKRISHNAN (1997). Discrete Multivariate + Distributions, John Wiley & Sons, Inc., New York. + +[KBJe00] + S. KOTZ, N. BALAKRISHNAN, AND N.L. JOHNSON (2000). Continuous Multivariate + Distributions, Volume 1: Models and Applications, John Wiley & Sons, Inc., + New York. + +Universal Methods – Surveys +--------------------------- + +[HLD04] + W. HÖRMANN, J. LEYDOLD, AND G. DERFLINGER (2004). Automatic Nonuniform + Random Variate Generation, Springer, Berlin. + +Universal Methods +----------------- + +[AJa93] + J.H. AHRENS (1993). Sampling from general distributions by suboptimal + division of domains, Grazer Math. Berichte 319, 30pp. + +[AJa95] + J.H. AHRENS (1995). An one-table method for sampling from continuous and + discrete distributions, Computing 54(2), pp. 127-146. + +[CAa74] + H.C. CHEN AND Y. ASAU (1974). On generating random variates from an + empirical distribution, AIIE Trans. 6, pp. 163-166. + +[DHLa08] + G. DERFLINGER, W. HÖRMANN, AND J. LEYDOLD (2008). Numerical inversion when + only the density function is known, Research Report Series of the + Department of Statistics and Mathematics 78, WU Wien, Augasse 2–6, A-1090 + Wien, Austria, . + +[DLa86] + L. DEVROYE (1986). Non-Uniform Random Variate Generation, Springer Verlag, + New York. + +[GWa92] + W.R. GILKS AND P. WILD (1992). Adaptive rejection sampling for Gibbs + sampling, Applied Statistics 41, pp. 337-348. + +[HWa95] + W. HÖRMANN (1995). A rejection technique for sampling from T-concave + distributions, ACM Trans. Math. Software 21(2), pp. 182-193. + +[HDa96] + W. HÖRMANN AND G. DERFLINGER (1996). Rejection-inversion to generate + variates from monotone discrete distributions, ACM TOMACS 6(3), 169-184. + +[HLa00] + W. HÖRMANN AND J. LEYDOLD (2000). Automatic random variate generation for + simulation input. In: J.A. Joines, R. Barton, P. Fishwick, K. Kang (eds.), + Proceedings of the 2000 Winter Simulation Conference, pp. 675-682. + +[HLa03] + W. HÖRMANN AND J. LEYDOLD (2003). Continuous Random Variate Generation by + Fast Numerical Inversion, ACM TOMACS 13(4), 347-362. + +[HLDa07] + W. HÖRMANN, J. LEYDOLD, AND G. DERFLINGER (2007). Automatic Random Variate + Generation for Unbounded Densities, ACM Trans. Model. Comput. Simul. + 17(4), pp.18. + +[KLPa05] + R. KARAWATZKI, J. LEYDOLD, AND K. PÖTZELBERGER (2005). Automatic Markov + chain Monte Carlo procedures for sampling from multivariate distributions, + Research Report Series of the Department of Statistics and Mathematics 27, + WU Wien, Augasse 2–6, A-1090 Wien, Austria, + . + +[LJa98] + J. LEYDOLD (1998). A Rejection Technique for Sampling from Log-Concave + Multivariate Distributions, ACM TOMACS 8(3), pp. 254-280. + +[LJa00] + J. LEYDOLD (2000). Automatic Sampling with the Ratio-of-Uniforms Method, + ACM Trans. Math. Software 26(1), pp. 78-98. + +[LJa01] + J. LEYDOLD (2001). A simple universal generator for continuous and + discrete univariate T-concave distributions, ACM Trans. Math. Software + 27(1), pp. 66-82. + +[LJa02] + J. LEYDOLD (2003). Short universal generators via generalized + ratio-of-uniforms method, Math. Comp. 72(243), pp. 1453-1471. + +[WGS91] + J.C. WAKEFIELD, A.E. GELFAND, AND A.F.M. SMITH (1992). Efficient + generation of random variates via the ratio-of-uniforms method, Statist. + Comput. 1(2), pp. 129-133. + +[WAa77] + A.J. WALKER (1977). An efficient method for generating discrete random + variables with general distributions, ACM Trans. Math. Software 3, pp. + 253-256. + +Special Generators +------------------ + +[ADa74] + J.H. AHRENS, U. DIETER (1974). Computer methods for sampling from gamma, + beta, Poisson and binomial distributions, Computing 12, 223-246. + +[ADa82] + J.H. AHRENS, U. DIETER (1982). Generating gamma variates by a modified + rejection technique, Communications of the ACM 25, 47-54. + +[ADb82] + J.H. AHRENS, U. DIETER (1982). Computer generation of Poisson deviates + from modified normal distributions, ACM Trans. Math. Software 8, 163-179. + +[BMa58] + G.E.P. BOX AND M.E. MULLER (1958). A note on the generation of random + normal deviates, Annals Math. Statist. 29, 610-611. + +[CHa77] + R.C.H. CHENG (1977). The Generation of Gamma Variables with Non-Integral + Shape Parameter, Appl. Statist. 26(1), 71-75. + +[Dag89] + J.S. DAGPUNAR (1989). An Easily Implemented Generalised Inverse Gaussian + Generator, Commun. Statist. Simul. 18(2), 703-710. + +[HDa90] + W. HÖRMANN AND G. DERFLINGER (1990). The ACR Method for generating normal + random variables, OR Spektrum 12, 181-185. + +[KAa81] + A.W. KEMP (1981). Efficient generation of logarithmically distributed + pseudo-random variables, Appl. Statist. 30, 249-253. + +[KRa76] + A.J. KINDERMAN AND J.G. RAMAGE (1976). Computer Generation of Normal + Random Variables, J. Am. Stat. Assoc. 71(356), 893 - 898. + +[MJa87] + J.F. MONAHAN (1987). An algorithm for generating chi random variables, ACM + Trans. Math. Software 13, 168-172. + +[MGa62] + G. MARSAGLIA (1962). Improving the Polar Method for Generating a Pair of + Random Variables, Boeing Sci. Res. Lab., Seattle, Washington. + +[MOa84] + G. MARSAGLIA AND I. OLKIN (1984). Generating Correlation Matrices, SIAM J. + Sci. Stat. Comput 5, 470-475. + +[STa89] + E. STADLOBER (1989). Sampling from Poisson, binomial and hypergeometric + distributions: ratio of uniforms as a simple and fast alternative, Bericht + 303, Math. Stat. Sektion, Forschungsgesellschaft Joanneum, Graz. + +[ZHa94] + H. ZECHNER (1994). Efficient sampling from continuous and discrete + unimodal distributions, Pd.D. Thesis, 156 pp., Technical University Graz, + Austria. + +Other references +---------------- + +[CPa76] + R. CRANLEY AND T.N.L. PATTERSON (1976). Randomization of number theoretic + methods for multiple integration, SIAM J. Num. Anal., Vol. 13, pp. + 904-914. + +[HJa61] + R. HOOKE AND T.A. JEEVES (1961). Direct Search Solution of Numerical and + Statistical Problems, Journal of the ACM, Vol. 8, April 1961, pp. + 212-229. + +Appendix D Function Index +************************* + +* Menu: + +* FALSE: Math. (line 12945) +* INT_MAX: Math. (line 12939) +* INT_MIN: Math. (line 12940) +* TRUE: Math. (line 12944) +* unur_arou_chg_verify: AROU. (line 5236) +* unur_arou_get_hatarea: AROU. (line 5202) +* unur_arou_get_sqhratio: AROU. (line 5198) +* unur_arou_get_squeezearea: AROU. (line 5206) +* unur_arou_new: AROU. (line 5159) +* unur_arou_set_cpoints: AROU. (line 5217) +* unur_arou_set_darsfactor: AROU. (line 5177) +* unur_arou_set_guidefactor: AROU. (line 5227) +* unur_arou_set_max_segments: AROU. (line 5210) +* unur_arou_set_max_sqhratio: AROU. (line 5187) +* unur_arou_set_pedantic: AROU. (line 5244) +* unur_arou_set_usecenter: AROU. (line 5224) +* unur_arou_set_usedars: AROU. (line 5162) +* unur_arou_set_verify: AROU. (line 5235) +* unur_ars_chg_reinit_ncpoints: ARS. (line 5365) +* unur_ars_chg_reinit_percentiles: ARS. (line 5349) +* unur_ars_chg_verify: ARS. (line 5380) +* unur_ars_eval_invcdfhat: ARS. (line 5411) +* unur_ars_get_loghatarea: ARS. (line 5407) +* unur_ars_new: ARS. (line 5328) +* unur_ars_set_cpoints: ARS. (line 5338) +* unur_ars_set_max_intervals: ARS. (line 5331) +* unur_ars_set_max_iter: ARS. (line 5373) +* unur_ars_set_pedantic: ARS. (line 5388) +* unur_ars_set_reinit_ncpoints: ARS. (line 5363) +* unur_ars_set_reinit_percentiles: ARS. (line 5347) +* unur_ars_set_verify: ARS. (line 5379) +* unur_auto_new: AUTO. (line 4893) +* unur_auto_set_logss: AUTO. (line 4896) +* unur_cext_get_distrparams: CEXT. (line 5637) +* unur_cext_get_ndistrparams: CEXT. (line 5638) +* unur_cext_get_params: CEXT. (line 5625) +* unur_cext_new: CEXT. (line 5600) +* unur_cext_set_init: CEXT. (line 5603) +* unur_cext_set_sample: CEXT. (line 5615) +* unur_chgto_urng_aux_default: URNG. (line 10804) +* unur_chg_debug: Debug. (line 12419) +* unur_chg_urng: URNG. (line 10781) +* unur_chg_urng_aux: URNG. (line 10809) +* unur_cstd_chg_truncated: CSTD. (line 5721) +* unur_cstd_new: CSTD. (line 5699) +* unur_cstd_set_variant: CSTD. (line 5711) +* unur_dari_chg_verify: DARI. (line 9699) +* unur_dari_new: DARI. (line 9665) +* unur_dari_set_cpfactor: DARI. (line 9689) +* unur_dari_set_squeeze: DARI. (line 9668) +* unur_dari_set_tablesize: DARI. (line 9680) +* unur_dari_set_verify: DARI. (line 9698) +* unur_dau_new: DAU. (line 9745) +* unur_dau_set_urnfactor: DAU. (line 9748) +* UNUR_DEBUG_ADAPT: Debug. (line 12394) +* UNUR_DEBUG_ADAPT <1>: Debug. (line 12395) +* UNUR_DEBUG_ALL: Debug. (line 12388) +* UNUR_DEBUG_ALL <1>: Debug. (line 12389) +* UNUR_DEBUG_INIT: Debug. (line 12390) +* UNUR_DEBUG_INIT <1>: Debug. (line 12391) +* UNUR_DEBUG_OFF: Debug. (line 12386) +* UNUR_DEBUG_OFF <1>: Debug. (line 12387) +* UNUR_DEBUG_SAMPLE: Debug. (line 12396) +* UNUR_DEBUG_SAMPLE <1>: Debug. (line 12397) +* UNUR_DEBUG_SETUP: Debug. (line 12392) +* UNUR_DEBUG_SETUP <1>: Debug. (line 12393) +* unur_dext_get_distrparams: DEXT. (line 9973) +* unur_dext_get_ndistrparams: DEXT. (line 9974) +* unur_dext_get_params: DEXT. (line 9961) +* unur_dext_new: DEXT. (line 9936) +* unur_dext_set_init: DEXT. (line 9939) +* unur_dext_set_sample: DEXT. (line 9951) +* unur_dgt_new: DGT. (line 10043) +* unur_dgt_set_guidefactor: DGT. (line 10046) +* unur_dgt_set_variant: DGT. (line 10056) +* unur_distr_: Stddist. (line 11381) +* unur_distr_beta: beta. (line 11490) +* unur_distr_binomial: binomial. (line 12162) +* unur_distr_cauchy: cauchy. (line 11511) +* unur_distr_cemp_get_data: CEMP. (line 3642) +* unur_distr_cemp_new: CEMP. (line 3620) +* unur_distr_cemp_read_data: CEMP. (line 3631) +* unur_distr_cemp_set_data: CEMP. (line 3627) +* unur_distr_cemp_set_hist: CEMP. (line 3650) +* unur_distr_cemp_set_hist_bins: CEMP. (line 3680) +* unur_distr_cemp_set_hist_domain: CEMP. (line 3675) +* unur_distr_cemp_set_hist_prob: CEMP. (line 3663) +* unur_distr_chi: chi. (line 11534) +* unur_distr_chisquare: chisquare. (line 11556) +* unur_distr_condi_get_condition: CONDI. (line 4301) +* unur_distr_condi_get_distribution: CONDI. (line 4309) +* unur_distr_condi_new: CONDI. (line 4252) +* unur_distr_condi_set_condition: CONDI. (line 4281) +* unur_distr_cont_eval_cdf: CONT. (line 3167) +* unur_distr_cont_eval_dlogpdf: CONT. (line 3194) +* unur_distr_cont_eval_dpdf: CONT. (line 3165) +* unur_distr_cont_eval_hr: CONT. (line 3367) +* unur_distr_cont_eval_invcdf: CONT. (line 3169) +* unur_distr_cont_eval_logcdf: CONT. (line 3196) +* unur_distr_cont_eval_logpdf: CONT. (line 3192) +* unur_distr_cont_eval_pdf: CONT. (line 3163) +* unur_distr_cont_get_cdf: CONT. (line 3154) +* unur_distr_cont_get_cdfstr: CONT. (line 3219) +* unur_distr_cont_get_center: CONT. (line 3431) +* unur_distr_cont_get_dlogpdf: CONT. (line 3188) +* unur_distr_cont_get_dlogpdfstr: CONT. (line 3292) +* unur_distr_cont_get_domain: CONT. (line 3317) +* unur_distr_cont_get_dpdf: CONT. (line 3152) +* unur_distr_cont_get_dpdfstr: CONT. (line 3218) +* unur_distr_cont_get_hr: CONT. (line 3360) +* unur_distr_cont_get_hrstr: CONT. (line 3384) +* unur_distr_cont_get_invcdf: CONT. (line 3156) +* unur_distr_cont_get_logcdf: CONT. (line 3190) +* unur_distr_cont_get_logcdfstr: CONT. (line 3296) +* unur_distr_cont_get_logpdf: CONT. (line 3186) +* unur_distr_cont_get_logpdfstr: CONT. (line 3290) +* unur_distr_cont_get_mode: CONT. (line 3411) +* unur_distr_cont_get_pdf: CONT. (line 3150) +* unur_distr_cont_get_pdfarea: CONT. (line 3457) +* unur_distr_cont_get_pdfparams: CONT. (line 3252) +* unur_distr_cont_get_pdfparams_vec: CONT. (line 3279) +* unur_distr_cont_get_pdfstr: CONT. (line 3217) +* unur_distr_cont_get_truncated: CONT. (line 3323) +* unur_distr_cont_new: CONT. (line 3098) +* unur_distr_cont_set_cdf: CONT. (line 3108) +* unur_distr_cont_set_cdfstr: CONT. (line 3211) +* unur_distr_cont_set_center: CONT. (line 3419) +* unur_distr_cont_set_dlogpdf: CONT. (line 3182) +* unur_distr_cont_set_domain: CONT. (line 3301) +* unur_distr_cont_set_dpdf: CONT. (line 3106) +* unur_distr_cont_set_hr: CONT. (line 3332) +* unur_distr_cont_set_hrstr: CONT. (line 3374) +* unur_distr_cont_set_invcdf: CONT. (line 3110) +* unur_distr_cont_set_logcdf: CONT. (line 3184) +* unur_distr_cont_set_logcdfstr: CONT. (line 3294) +* unur_distr_cont_set_logpdf: CONT. (line 3180) +* unur_distr_cont_set_logpdfstr: CONT. (line 3288) +* unur_distr_cont_set_mode: CONT. (line 3395) +* unur_distr_cont_set_pdf: CONT. (line 3104) +* unur_distr_cont_set_pdfarea: CONT. (line 3435) +* unur_distr_cont_set_pdfparams: CONT. (line 3225) +* unur_distr_cont_set_pdfparams_vec: CONT. (line 3260) +* unur_distr_cont_set_pdfstr: CONT. (line 3200) +* unur_distr_cont_upd_mode: CONT. (line 3404) +* unur_distr_cont_upd_pdfarea: CONT. (line 3444) +* unur_distr_copula: copula. (line 12066) +* unur_distr_corder_eval_cdf: CORDER. (line 3532) +* unur_distr_corder_eval_dpdf: CORDER. (line 3530) +* unur_distr_corder_eval_pdf: CORDER. (line 3528) +* unur_distr_corder_get_cdf: CORDER. (line 3520) +* unur_distr_corder_get_distribution: CORDER. (line 3493) +* unur_distr_corder_get_domain: CORDER. (line 3559) +* unur_distr_corder_get_dpdf: CORDER. (line 3518) +* unur_distr_corder_get_mode: CORDER. (line 3584) +* unur_distr_corder_get_pdf: CORDER. (line 3516) +* unur_distr_corder_get_pdfarea: CORDER. (line 3602) +* unur_distr_corder_get_pdfparams: CORDER. (line 3548) +* unur_distr_corder_get_rank: CORDER. (line 3506) +* unur_distr_corder_get_truncated: CORDER. (line 3564) +* unur_distr_corder_new: CORDER. (line 3477) +* unur_distr_corder_set_domain: CORDER. (line 3554) +* unur_distr_corder_set_mode: CORDER. (line 3575) +* unur_distr_corder_set_pdfarea: CORDER. (line 3588) +* unur_distr_corder_set_pdfparams: CORDER. (line 3543) +* unur_distr_corder_set_rank: CORDER. (line 3500) +* unur_distr_corder_upd_mode: CORDER. (line 3579) +* unur_distr_corder_upd_pdfarea: CORDER. (line 3593) +* unur_distr_correlation: correlation. (line 12300) +* unur_distr_cvec_eval_dlogpdf: CVEC. (line 3867) +* unur_distr_cvec_eval_dpdf: CVEC. (line 3829) +* unur_distr_cvec_eval_logpdf: CVEC. (line 3865) +* unur_distr_cvec_eval_pdf: CVEC. (line 3817) +* unur_distr_cvec_eval_pdlogpdf: CVEC. (line 3869) +* unur_distr_cvec_eval_pdpdf: CVEC. (line 3841) +* unur_distr_cvec_get_center: CVEC. (line 4192) +* unur_distr_cvec_get_cholesky: CVEC. (line 3957) +* unur_distr_cvec_get_covar: CVEC. (line 3955) +* unur_distr_cvec_get_covar_inv: CVEC. (line 3959) +* unur_distr_cvec_get_dlogpdf: CVEC. (line 3863) +* unur_distr_cvec_get_dpdf: CVEC. (line 3810) +* unur_distr_cvec_get_logpdf: CVEC. (line 3861) +* unur_distr_cvec_get_marginal: CVEC. (line 4047) +* unur_distr_cvec_get_mean: CVEC. (line 3886) +* unur_distr_cvec_get_mode: CVEC. (line 4165) +* unur_distr_cvec_get_pdf: CVEC. (line 3803) +* unur_distr_cvec_get_pdfparams: CVEC. (line 4077) +* unur_distr_cvec_get_pdfparams_vec: CVEC. (line 4114) +* unur_distr_cvec_get_pdfvol: CVEC. (line 4214) +* unur_distr_cvec_get_rankcorr: CVEC. (line 3996) +* unur_distr_cvec_get_rk_cholesky: CVEC. (line 3998) +* unur_distr_cvec_is_indomain: CVEC. (line 4143) +* unur_distr_cvec_new: CVEC. (line 3746) +* unur_distr_cvec_set_center: CVEC. (line 4175) +* unur_distr_cvec_set_covar: CVEC. (line 3894) +* unur_distr_cvec_set_covar_inv: CVEC. (line 3932) +* unur_distr_cvec_set_dlogpdf: CVEC. (line 3857) +* unur_distr_cvec_set_domain_rect: CVEC. (line 4123) +* unur_distr_cvec_set_dpdf: CVEC. (line 3772) +* unur_distr_cvec_set_logpdf: CVEC. (line 3855) +* unur_distr_cvec_set_marginals: CVEC. (line 4009) +* unur_distr_cvec_set_marginal_array: CVEC. (line 4016) +* unur_distr_cvec_set_marginal_list: CVEC. (line 4026) +* unur_distr_cvec_set_mean: CVEC. (line 3873) +* unur_distr_cvec_set_mode: CVEC. (line 4153) +* unur_distr_cvec_set_pdf: CVEC. (line 3757) +* unur_distr_cvec_set_pdfparams: CVEC. (line 4054) +* unur_distr_cvec_set_pdfparams_vec: CVEC. (line 4085) +* unur_distr_cvec_set_pdfvol: CVEC. (line 4200) +* unur_distr_cvec_set_pdlogpdf: CVEC. (line 3859) +* unur_distr_cvec_set_pdpdf: CVEC. (line 3788) +* unur_distr_cvec_set_rankcorr: CVEC. (line 3972) +* unur_distr_cvec_upd_mode: CVEC. (line 4159) +* unur_distr_cvec_upd_pdfvol: CVEC. (line 4205) +* unur_distr_cvemp_get_data: CVEMP. (line 4354) +* unur_distr_cvemp_new: CVEMP. (line 4324) +* unur_distr_cvemp_read_data: CVEMP. (line 4342) +* unur_distr_cvemp_set_data: CVEMP. (line 4334) +* unur_distr_discr_eval_cdf: DISCR. (line 4520) +* unur_distr_discr_eval_invcdf: DISCR. (line 4532) +* unur_distr_discr_eval_pmf: DISCR. (line 4518) +* unur_distr_discr_eval_pv: DISCR. (line 4516) +* unur_distr_discr_get_cdfstr: DISCR. (line 4558) +* unur_distr_discr_get_domain: DISCR. (line 4602) +* unur_distr_discr_get_mode: DISCR. (line 4625) +* unur_distr_discr_get_pmfparams: DISCR. (line 4583) +* unur_distr_discr_get_pmfstr: DISCR. (line 4557) +* unur_distr_discr_get_pmfsum: DISCR. (line 4654) +* unur_distr_discr_get_pv: DISCR. (line 4479) +* unur_distr_discr_make_pv: DISCR. (line 4458) +* unur_distr_discr_new: DISCR. (line 4426) +* unur_distr_discr_set_cdf: DISCR. (line 4488) +* unur_distr_discr_set_cdfstr: DISCR. (line 4552) +* unur_distr_discr_set_domain: DISCR. (line 4589) +* unur_distr_discr_set_invcdf: DISCR. (line 4510) +* unur_distr_discr_set_mode: DISCR. (line 4615) +* unur_distr_discr_set_pmf: DISCR. (line 4486) +* unur_distr_discr_set_pmfparams: DISCR. (line 4563) +* unur_distr_discr_set_pmfstr: DISCR. (line 4542) +* unur_distr_discr_set_pmfsum: DISCR. (line 4633) +* unur_distr_discr_set_pv: DISCR. (line 4442) +* unur_distr_discr_upd_mode: DISCR. (line 4618) +* unur_distr_discr_upd_pmfsum: DISCR. (line 4642) +* unur_distr_exponential: exponential. (line 11575) +* unur_distr_extremeI: extremeI. (line 11598) +* unur_distr_extremeII: extremeII. (line 11621) +* unur_distr_F: F. (line 11471) +* unur_distr_free: AllDistr. (line 2957) +* unur_distr_gamma: gamma. (line 11645) +* unur_distr_geometric: geometric. (line 12185) +* unur_distr_get_dim: AllDistr. (line 2968) +* unur_distr_get_extobj: AllDistr. (line 3032) +* unur_distr_get_name: AllDistr. (line 2962) +* unur_distr_get_type: AllDistr. (line 2978) +* unur_distr_gig: gig. (line 11672) +* unur_distr_gig2: gig2. (line 11699) +* unur_distr_hyperbolic: hyperbolic. (line 11722) +* unur_distr_hypergeometric: hypergeometric. (line 12207) +* unur_distr_ig: ig. (line 11744) +* unur_distr_is_cemp: AllDistr. (line 3001) +* unur_distr_is_cont: AllDistr. (line 2995) +* unur_distr_is_cvec: AllDistr. (line 2998) +* unur_distr_is_cvemp: AllDistr. (line 3005) +* unur_distr_is_discr: AllDistr. (line 3009) +* unur_distr_is_matr: AllDistr. (line 3012) +* unur_distr_laplace: laplace. (line 11766) +* unur_distr_logarithmic: logarithmic. (line 12231) +* unur_distr_logistic: logistic. (line 11789) +* unur_distr_lognormal: lognormal. (line 11812) +* unur_distr_lomax: lomax. (line 11832) +* unur_distr_matr_get_dim: MATR. (line 4387) +* unur_distr_matr_new: MATR. (line 4373) +* unur_distr_multicauchy: multicauchy. (line 12078) +* unur_distr_multiexponential: multiexponential. (line 12099) +* unur_distr_multinormal: multinormal. (line 12117) +* unur_distr_multistudent: multistudent. (line 12137) +* unur_distr_negativebinomial: negativebinomial. (line 12254) +* unur_distr_normal: normal. (line 11855) +* unur_distr_pareto: pareto. (line 11886) +* unur_distr_poisson: poisson. (line 12273) +* unur_distr_powerexponential: powerexponential. (line 11909) +* unur_distr_rayleigh: rayleigh. (line 11931) +* unur_distr_set_extobj: AllDistr. (line 3015) +* unur_distr_set_name: AllDistr. (line 2960) +* unur_distr_slash: slash. (line 11949) +* unur_distr_student: student. (line 11971) +* unur_distr_triangular: triangular. (line 11992) +* unur_distr_uniform: uniform. (line 12016) +* unur_distr_weibull: weibull. (line 12039) +* unur_dsrou_chg_cdfatmode: DSROU. (line 10129) +* unur_dsrou_chg_verify: DSROU. (line 10121) +* unur_dsrou_new: DSROU. (line 10107) +* unur_dsrou_set_cdfatmode: DSROU. (line 10110) +* unur_dsrou_set_verify: DSROU. (line 10120) +* unur_dss_new: DSS. (line 10175) +* unur_dstd_chg_truncated: DSTD. (line 10251) +* unur_dstd_new: DSTD. (line 10231) +* unur_dstd_set_variant: DSTD. (line 10241) +* unur_empk_chg_smoothing: EMPK. (line 8251) +* unur_empk_chg_varcor: EMPK. (line 8265) +* unur_empk_new: EMPK. (line 8190) +* unur_empk_set_beta: EMPK. (line 8240) +* unur_empk_set_kernel: EMPK. (line 8193) +* unur_empk_set_kernelgen: EMPK. (line 8215) +* unur_empk_set_positive: EMPK. (line 8272) +* unur_empk_set_smoothing: EMPK. (line 8249) +* unur_empk_set_varcor: EMPK. (line 8264) +* unur_empl_new: EMPL. (line 8319) +* unur_errno: Error_reporting. (line 12504) +* UNUR_ERR_COMPILE: Errno. (line 12611) +* UNUR_ERR_COOKIE: Errno. (line 12601) +* UNUR_ERR_DISTR_DATA: Errno. (line 12543) +* UNUR_ERR_DISTR_DOMAIN: Errno. (line 12533) +* UNUR_ERR_DISTR_GEN: Errno. (line 12535) +* UNUR_ERR_DISTR_GET: Errno. (line 12529) +* UNUR_ERR_DISTR_INVALID: Errno. (line 12541) +* UNUR_ERR_DISTR_NPARAMS: Errno. (line 12531) +* UNUR_ERR_DISTR_PROP: Errno. (line 12545) +* UNUR_ERR_DISTR_REQUIRED: Errno. (line 12537) +* UNUR_ERR_DISTR_SET: Errno. (line 12527) +* UNUR_ERR_DISTR_UNKNOWN: Errno. (line 12539) +* UNUR_ERR_DOMAIN: Errno. (line 12593) +* UNUR_ERR_FSTR_DERIV: Errno. (line 12589) +* UNUR_ERR_FSTR_SYNTAX: Errno. (line 12587) +* UNUR_ERR_GEN: Errno. (line 12557) +* UNUR_ERR_GENERIC: Errno. (line 12603) +* UNUR_ERR_GEN_CONDITION: Errno. (line 12561) +* UNUR_ERR_GEN_DATA: Errno. (line 12559) +* UNUR_ERR_GEN_INVALID: Errno. (line 12563) +* UNUR_ERR_GEN_SAMPLING: Errno. (line 12565) +* UNUR_ERR_INF: Errno. (line 12607) +* UNUR_ERR_MALLOC: Errno. (line 12597) +* UNUR_ERR_NAN: Errno. (line 12609) +* UNUR_ERR_NO_QUANTILE: Errno. (line 12569) +* UNUR_ERR_NO_REINIT: Errno. (line 12567) +* UNUR_ERR_NULL: Errno. (line 12599) +* UNUR_ERR_PAR_INVALID: Errno. (line 12553) +* UNUR_ERR_PAR_SET: Errno. (line 12549) +* UNUR_ERR_PAR_VARIANT: Errno. (line 12551) +* UNUR_ERR_ROUNDOFF: Errno. (line 12595) +* UNUR_ERR_SHOULD_NOT_HAPPEN: Errno. (line 12614) +* UNUR_ERR_SILENT: Errno. (line 12605) +* UNUR_ERR_STR: Errno. (line 12579) +* UNUR_ERR_STR_INVALID: Errno. (line 12585) +* UNUR_ERR_STR_SYNTAX: Errno. (line 12583) +* UNUR_ERR_STR_UNKNOWN: Errno. (line 12581) +* UNUR_ERR_URNG: Errno. (line 12573) +* UNUR_ERR_URNG_MISS: Errno. (line 12575) +* unur_free: Methods_all. (line 4784) +* unur_gen_anti: URNG. (line 10908) +* unur_gen_info: Methods_all. (line 4787) +* unur_gen_is_inversion: Methods_all. (line 4807) +* unur_gen_nextsub: URNG. (line 10910) +* unur_gen_reset: URNG. (line 10909) +* unur_gen_resetsub: URNG. (line 10911) +* unur_gen_seed: URNG. (line 10907) +* unur_gen_sync: URNG. (line 10906) +* unur_get_default_urng: URNG. (line 10757) +* unur_get_default_urng_aux: URNG. (line 10766) +* unur_get_dimension: Methods_all. (line 4796) +* unur_get_distr: Methods_all. (line 4811) +* unur_get_errno: Error_reporting. (line 12506) +* unur_get_genid: Methods_all. (line 4800) +* unur_get_method: Methods_all. (line 4803) +* unur_get_stream: Output_streams. (line 12356) +* unur_get_strerror: Error_reporting. (line 12513) +* unur_get_urng: URNG. (line 10786) +* unur_get_urng_aux: URNG. (line 10817) +* unur_gibbs_chg_state: GIBBS. (line 8936) +* unur_gibbs_get_state: GIBBS. (line 8935) +* unur_gibbs_new: GIBBS. (line 8871) +* unur_gibbs_reset_state: GIBBS. (line 8940) +* unur_gibbs_set_burnin: GIBBS. (line 8916) +* unur_gibbs_set_c: GIBBS. (line 8883) +* unur_gibbs_set_startingpoint: GIBBS. (line 8897) +* unur_gibbs_set_thinning: GIBBS. (line 8908) +* unur_gibbs_set_variant_coordinate: GIBBS. (line 8874) +* unur_gibbs_set_variant_random_direction: GIBBS. (line 8880) +* unur_hinv_chg_truncated: HINV. (line 5940) +* unur_hinv_estimate_error: HINV. (line 5963) +* unur_hinv_eval_approxinvcdf: HINV. (line 5930) +* unur_hinv_get_n_intervals: HINV. (line 5925) +* unur_hinv_new: HINV. (line 5835) +* unur_hinv_set_boundary: HINV. (line 5896) +* unur_hinv_set_cpoints: HINV. (line 5869) +* unur_hinv_set_guidefactor: HINV. (line 5908) +* unur_hinv_set_max_intervals: HINV. (line 5916) +* unur_hinv_set_order: HINV. (line 5838) +* unur_hinv_set_u_resolution: HINV. (line 5854) +* unur_hist_new: HIST. (line 8348) +* unur_hitro_chg_state: HITRO. (line 9279) +* unur_hitro_get_state: HITRO. (line 9278) +* unur_hitro_new: HITRO. (line 9110) +* unur_hitro_reset_state: HITRO. (line 9290) +* unur_hitro_set_adaptive_multiplier: HITRO. (line 9225) +* unur_hitro_set_burnin: HITRO. (line 9264) +* unur_hitro_set_r: HITRO. (line 9180) +* unur_hitro_set_startingpoint: HITRO. (line 9239) +* unur_hitro_set_thinning: HITRO. (line 9253) +* unur_hitro_set_u: HITRO. (line 9203) +* unur_hitro_set_use_adaptiveline: HITRO. (line 9125) +* unur_hitro_set_use_adaptiverectangle: HITRO. (line 9153) +* unur_hitro_set_use_boundingrectangle: HITRO. (line 9141) +* unur_hitro_set_v: HITRO. (line 9188) +* unur_hitro_set_variant_coordinate: HITRO. (line 9113) +* unur_hitro_set_variant_random_direction: HITRO. (line 9122) +* unur_hrb_chg_verify: HRB. (line 6028) +* unur_hrb_new: HRB. (line 6018) +* unur_hrb_set_upperbound: HRB. (line 6021) +* unur_hrb_set_verify: HRB. (line 6027) +* unur_hrd_chg_verify: HRD. (line 6079) +* unur_hrd_new: HRD. (line 6075) +* unur_hrd_set_verify: HRD. (line 6078) +* unur_hri_chg_verify: HRI. (line 6155) +* unur_hri_new: HRI. (line 6142) +* unur_hri_set_p0: HRI. (line 6145) +* unur_hri_set_verify: HRI. (line 6154) +* UNUR_INFINITY: Math. (line 12935) +* unur_init: Methods_all. (line 4705) +* unur_itdr_chg_verify: ITDR. (line 6290) +* unur_itdr_get_area: ITDR. (line 6278) +* unur_itdr_get_cp: ITDR. (line 6273) +* unur_itdr_get_ct: ITDR. (line 6274) +* unur_itdr_get_xi: ITDR. (line 6272) +* unur_itdr_new: ITDR. (line 6243) +* unur_itdr_set_cp: ITDR. (line 6254) +* unur_itdr_set_ct: ITDR. (line 6263) +* unur_itdr_set_verify: ITDR. (line 6281) +* unur_itdr_set_xi: ITDR. (line 6246) +* unur_makegen_dsu: StringAPI. (line 2035) +* unur_makegen_ssu: StringAPI. (line 2033) +* unur_mcorr_chg_eigenvalues: MCORR. (line 10360) +* unur_mcorr_new: MCORR. (line 10345) +* unur_mcorr_set_eigenvalues: MCORR. (line 10348) +* unur_mixt_new: MIXT. (line 10600) +* unur_mixt_set_useinversion: MIXT. (line 10609) +* unur_mvstd_new: MVSTD. (line 8399) +* unur_mvtdr_chg_verify: MVTDR. (line 8524) +* unur_mvtdr_get_hatvol: MVTDR. (line 8519) +* unur_mvtdr_get_ncones: MVTDR. (line 8515) +* unur_mvtdr_new: MVTDR. (line 8482) +* unur_mvtdr_set_boundsplitting: MVTDR. (line 8491) +* unur_mvtdr_set_maxcones: MVTDR. (line 8501) +* unur_mvtdr_set_stepsmin: MVTDR. (line 8485) +* unur_mvtdr_set_verify: MVTDR. (line 8523) +* unur_ninv_chg_max_iter: NINV. (line 6403) +* unur_ninv_chg_start: NINV. (line 6439) +* unur_ninv_chg_table: NINV. (line 6456) +* unur_ninv_chg_truncated: NINV. (line 6459) +* unur_ninv_chg_u_resolution: NINV. (line 6417) +* unur_ninv_chg_x_resolution: NINV. (line 6408) +* unur_ninv_eval_approxinvcdf: NINV. (line 6478) +* unur_ninv_new: NINV. (line 6384) +* unur_ninv_set_max_iter: NINV. (line 6402) +* unur_ninv_set_start: NINV. (line 6424) +* unur_ninv_set_table: NINV. (line 6443) +* unur_ninv_set_usebisect: NINV. (line 6398) +* unur_ninv_set_usenewton: NINV. (line 6391) +* unur_ninv_set_useregula: NINV. (line 6387) +* unur_ninv_set_u_resolution: NINV. (line 6415) +* unur_ninv_set_x_resolution: NINV. (line 6406) +* unur_norta_new: NORTA. (line 8595) +* unur_nrou_chg_verify: NROU. (line 6618) +* unur_nrou_new: NROU. (line 6568) +* unur_nrou_set_center: NROU. (line 6603) +* unur_nrou_set_r: NROU. (line 6596) +* unur_nrou_set_u: NROU. (line 6571) +* unur_nrou_set_v: NROU. (line 6587) +* unur_nrou_set_verify: NROU. (line 6609) +* unur_pinv_estimate_error: PINV. (line 6960) +* unur_pinv_eval_approxcdf: PINV. (line 6952) +* unur_pinv_eval_approxinvcdf: PINV. (line 6945) +* unur_pinv_get_n_intervals: PINV. (line 6930) +* unur_pinv_new: PINV. (line 6763) +* unur_pinv_set_boundary: PINV. (line 6889) +* unur_pinv_set_extra_testpoints: PINV. (line 6850) +* unur_pinv_set_keepcdf: PINV. (line 6934) +* unur_pinv_set_max_intervals: PINV. (line 6923) +* unur_pinv_set_order: PINV. (line 6766) +* unur_pinv_set_searchboundary: PINV. (line 6904) +* unur_pinv_set_smoothness: PINV. (line 6772) +* unur_pinv_set_usecdf: PINV. (line 6877) +* unur_pinv_set_usepdf: PINV. (line 6872) +* unur_pinv_set_use_upoints: PINV. (line 6863) +* unur_pinv_set_u_resolution: PINV. (line 6820) +* unur_quantile: Methods_all. (line 4765) +* unur_reinit: Methods_all. (line 4718) +* unur_reset_errno: Error_reporting. (line 12509) +* unur_run_tests: Testing. (line 12688) +* unur_sample_cont: Methods_all. (line 4749) +* unur_sample_discr: Methods_all. (line 4748) +* unur_sample_matr: Methods_all. (line 4751) +* unur_sample_urng: URNG. (line 10831) +* unur_sample_vec: Methods_all. (line 4750) +* unur_set_debug: Debug. (line 12416) +* unur_set_default_debug: Debug. (line 12422) +* unur_set_default_urng: URNG. (line 10761) +* unur_set_default_urng_aux: URNG. (line 10765) +* unur_set_error_handler: Error_handlers. (line 12661) +* unur_set_error_handler_off: Error_handlers. (line 12673) +* unur_set_stream: Output_streams. (line 12342) +* unur_set_urng: URNG. (line 10772) +* unur_set_urng_aux: URNG. (line 10790) +* unur_set_use_distr_privatecopy: Methods_all. (line 4824) +* unur_srou_chg_cdfatmode: SROU. (line 7126) +* unur_srou_chg_pdfatmode: SROU. (line 7130) +* unur_srou_chg_verify: SROU. (line 7118) +* unur_srou_new: SROU. (line 7060) +* unur_srou_set_cdfatmode: SROU. (line 7077) +* unur_srou_set_pdfatmode: SROU. (line 7084) +* unur_srou_set_r: SROU. (line 7063) +* unur_srou_set_usemirror: SROU. (line 7104) +* unur_srou_set_usesqueeze: SROU. (line 7093) +* unur_srou_set_verify: SROU. (line 7117) +* unur_ssr_chg_cdfatmode: SSR. (line 7239) +* unur_ssr_chg_pdfatmode: SSR. (line 7243) +* unur_ssr_chg_verify: SSR. (line 7231) +* unur_ssr_new: SSR. (line 7204) +* unur_ssr_set_cdfatmode: SSR. (line 7207) +* unur_ssr_set_pdfatmode: SSR. (line 7214) +* unur_ssr_set_usesqueeze: SSR. (line 7222) +* unur_ssr_set_verify: SSR. (line 7230) +* unur_str2distr: StringAPI. (line 2027) +* unur_str2gen: StringAPI. (line 2022) +* UNUR_SUCCESS (0x0u): Errno. (line 12523) +* unur_tabl_chg_truncated: TABL. (line 7507) +* unur_tabl_chg_verify: TABL. (line 7537) +* unur_tabl_get_hatarea: TABL. (line 7454) +* unur_tabl_get_n_intervals: TABL. (line 7469) +* unur_tabl_get_sqhratio: TABL. (line 7450) +* unur_tabl_get_squeezearea: TABL. (line 7458) +* unur_tabl_new: TABL. (line 7346) +* unur_tabl_set_areafraction: TABL. (line 7386) +* unur_tabl_set_boundary: TABL. (line 7498) +* unur_tabl_set_cpoints: TABL. (line 7360) +* unur_tabl_set_darsfactor: TABL. (line 7413) +* unur_tabl_set_guidefactor: TABL. (line 7490) +* unur_tabl_set_max_intervals: TABL. (line 7462) +* unur_tabl_set_max_sqhratio: TABL. (line 7436) +* unur_tabl_set_nstp: TABL. (line 7368) +* unur_tabl_set_pedantic: TABL. (line 7545) +* unur_tabl_set_slopes: TABL. (line 7472) +* unur_tabl_set_usedars: TABL. (line 7398) +* unur_tabl_set_useear: TABL. (line 7377) +* unur_tabl_set_variant_ia: TABL. (line 7349) +* unur_tabl_set_variant_splitmode: TABL. (line 7423) +* unur_tabl_set_verify: TABL. (line 7536) +* unur_tdr_chg_reinit_ncpoints: TDR. (line 7737) +* unur_tdr_chg_reinit_percentiles: TDR. (line 7721) +* unur_tdr_chg_truncated: TDR. (line 7745) +* unur_tdr_chg_verify: TDR. (line 7824) +* unur_tdr_eval_invcdfhat: TDR. (line 7851) +* unur_tdr_get_hatarea: TDR. (line 7787) +* unur_tdr_get_sqhratio: TDR. (line 7783) +* unur_tdr_get_squeezearea: TDR. (line 7791) +* unur_tdr_new: TDR. (line 7646) +* unur_tdr_set_c: TDR. (line 7649) +* unur_tdr_set_cpoints: TDR. (line 7711) +* unur_tdr_set_darsfactor: TDR. (line 7701) +* unur_tdr_set_guidefactor: TDR. (line 7816) +* unur_tdr_set_max_intervals: TDR. (line 7795) +* unur_tdr_set_max_sqhratio: TDR. (line 7772) +* unur_tdr_set_pedantic: TDR. (line 7832) +* unur_tdr_set_reinit_ncpoints: TDR. (line 7735) +* unur_tdr_set_reinit_percentiles: TDR. (line 7719) +* unur_tdr_set_usecenter: TDR. (line 7802) +* unur_tdr_set_usedars: TDR. (line 7667) +* unur_tdr_set_usemode: TDR. (line 7805) +* unur_tdr_set_variant_gw: TDR. (line 7655) +* unur_tdr_set_variant_ia: TDR. (line 7663) +* unur_tdr_set_variant_ps: TDR. (line 7659) +* unur_tdr_set_verify: TDR. (line 7823) +* unur_test_chi2: Testing. (line 12820) +* unur_test_correlation: Testing. (line 12868) +* unur_test_count_pdf: Testing. (line 12795) +* unur_test_count_urn: Testing. (line 12784) +* unur_test_moments: Testing. (line 12855) +* unur_test_par_count_pdf: Testing. (line 12813) +* unur_test_printsample: Testing. (line 12706) +* unur_test_quartiles: Testing. (line 12876) +* unur_test_timing: Testing. (line 12711) +* unur_test_timing_exponential: Testing. (line 12761) +* unur_test_timing_R: Testing. (line 12735) +* unur_test_timing_total: Testing. (line 12768) +* unur_test_timing_uniform: Testing. (line 12759) +* unur_test_u_error: Testing. (line 12894) +* unur_unif_new: UNIF. (line 10383) +* unur_urng_anti: URNG. (line 10885) +* unur_urng_free: URNG. (line 10951) +* unur_urng_fvoid_new: URNG-FVOID. (line 11036) +* unur_urng_gslptr_new: URNG-GSL. (line 11153) +* unur_urng_gslqrng_new: URNG-GSLQRNG. (line 11197) +* unur_urng_gsl_new: URNG-GSL. (line 11147) +* unur_urng_new: URNG. (line 10932) +* unur_urng_nextsub: URNG. (line 10892) +* unur_urng_prngptr_new: URNG-PRNG. (line 11258) +* unur_urng_prng_new: URNG-PRNG. (line 11243) +* unur_urng_randomshift_new: URNG-RANDOMSHIFT. (line 11358) +* unur_urng_randomshift_nextshift: URNG-RANDOMSHIFT. (line 11368) +* unur_urng_reset: URNG. (line 10850) +* unur_urng_resetsub: URNG. (line 10899) +* unur_urng_rngstreamptr_new: URNG-RNGSTREAM. (line 11312) +* unur_urng_rngstream_new: URNG-RNGSTREAM. (line 11308) +* unur_urng_sample: URNG. (line 10827) +* unur_urng_sample_array: URNG. (line 10836) +* unur_urng_seed: URNG. (line 10870) +* unur_urng_set_anti: URNG. (line 10976) +* unur_urng_set_delete: URNG. (line 10996) +* unur_urng_set_nextsub: URNG. (line 10986) +* unur_urng_set_reset: URNG. (line 10981) +* unur_urng_set_resetsub: URNG. (line 10991) +* unur_urng_set_sample_array: URNG. (line 10963) +* unur_urng_set_seed: URNG. (line 10972) +* unur_urng_set_sync: URNG. (line 10968) +* unur_urng_sync: URNG. (line 10864) +* unur_use_urng_aux_default: URNG. (line 10799) +* unur_utdr_chg_pdfatmode: UTDR. (line 7955) +* unur_utdr_chg_verify: UTDR. (line 7947) +* unur_utdr_new: UTDR. (line 7920) +* unur_utdr_set_cpfactor: UTDR. (line 7931) +* unur_utdr_set_deltafactor: UTDR. (line 7939) +* unur_utdr_set_pdfatmode: UTDR. (line 7923) +* unur_utdr_set_verify: UTDR. (line 7946) +* unur_vempk_chg_smoothing: VEMPK. (line 9438) +* unur_vempk_chg_varcor: VEMPK. (line 9452) +* unur_vempk_new: VEMPK. (line 9433) +* unur_vempk_set_smoothing: VEMPK. (line 9436) +* unur_vempk_set_varcor: VEMPK. (line 9451) +* unur_vnrou_chg_u: VNROU. (line 8710) +* unur_vnrou_chg_v: VNROU. (line 8721) +* unur_vnrou_chg_verify: VNROU. (line 8741) +* unur_vnrou_get_volumehat: VNROU. (line 8744) +* unur_vnrou_new: VNROU. (line 8691) +* unur_vnrou_set_r: VNROU. (line 8724) +* unur_vnrou_set_u: VNROU. (line 8694) +* unur_vnrou_set_v: VNROU. (line 8714) +* unur_vnrou_set_verify: VNROU. (line 8732) + diff --git a/vendor/unuran-1.11.0/doc/unuran_win32.info b/vendor/unuran-1.11.0/doc/unuran_win32.info new file mode 100644 index 0000000..9d1b4d5 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/unuran_win32.info @@ -0,0 +1,537 @@ +This is unuran_win32.info, produced by makeinfo version 7.0.3 from +unuran_win32.texi. + +Copyright © 2000–2007 Institut fuer Statistik, WU Wien. + +Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. +INFO-DIR-SECTION Scientific software +START-INFO-DIR-ENTRY +* unuran_win32: (unuran_win32). Using UNU.RAN with Microsoft Visual C +END-INFO-DIR-ENTRY + + +File: unuran_win32.info, Node: Top, Next: Installation, Up: (dir) + +Using UNU.RAN with Microsoft Visual C +************************************* + +* Menu: + +* Installation:: Installation of binary distribution +* URNG:: Uniform random number generator +* IDE:: Building your own project in Visual Studio +* CLI:: Building your own project on the command line +* Examples:: Two Examples + +This is the online-documentation of UNU.RAN. +Version: 1.11.0 +Date: 21 April 2023 + + This document describes how to use Microsoft Visual Studio to create +a C or C++ project and link the target with UNU.RAN. + + UNU.RAN (http://statmath.wu.ac.at/unuran) (Universal Non-Uniform +RAndom Number generator) is a collection of algorithms for generating +non-uniform pseudorandom variates as a library of C functions designed +and implemented by the ARVAG (http://statmath.wu.ac.at/arvag) (Automatic +Random VAriate Generation) project group in Vienna, and released under +the GNU Public License (GPL). + + This binary distribution also has support for Pierre L’Ecuyers +RngStreams (http://statmath.wu.ac.at/software/RngStreams) library. This +library is already compiled into the distributed DLL, the corresponding +header file is included in this package. + + The DLL is linked against the C run-time library ‘MSVCRT.lib’. Thus +the file ‘MSVCR80.DLL’ must be available at run time for applications +linked with UNU.RAN and ‘MSVCRT.lib’ (i.e., included in the envirenment +variate ‘PATH’). For details see the Microsoft Visual C++ +(http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx) manual. + + +File: unuran_win32.info, Node: Installation, Next: URNG, Prev: Top, Up: Top + +1 Installation of Binary Distribution +************************************* + + 1. Download unuran-1.11.0-win32.zip from the UNU.RAN download + (http://statmath.wu.ac.at/unuran/download.html) page. + + 2. Unpack unuran-1.11.0-win32.zip. It creates directory ‘unuran’ + which contains the following files: + + ‘unuran.h’ + Header file to be included in your application source file. + (Contains function prototypes, typedefs and macros.) + + ‘RngStream.h’ + ‘unuran_urng_rngstreams.h’ + Header files required for using the ‘RngStream’ library. + + ‘libunuran111.def’ + Module-definition file. (Declares all functions exported the + UNU.RAN library.) + + ‘libunuran111.dll’ + ‘libunuran111.dll.manifest’ + DLL (Dynamic link library) and its manifest file (must always + be located in the same directory). + + ‘libunuran111.lib’ + Import library file. + + ‘libunuran111.exp’ + Library export file. + + ‘unuran.pdf’ + UNU.RAN User Manual. + + ‘unuran_win32.pdf’ + Short description for building your own application using + UNU.RAN with Microsoft Visual C. + + ‘example1.c’ + ‘example2.c’ + Two example files. + + 3. _Optional:_ Move directory ‘unuran’ into an appropriate place, e.g. + ‘C:\unuran’ (or maybe the folder where you build your application). + + Throughout this document, the UNU.RAN installation folder is + referred to as ‘’. For example, if UNU.RAN has been + installed in the folder ‘C:\unuran’, references to + ‘\libunuran111.lib’ represent + ‘C:\unuran\libunuran111.lib’. + + 4. _Optional:_ Add ‘’ to the ‘PATH’ environment variable. + Thus your application can find the location of libunuran111.dll + when it is started. + + +File: unuran_win32.info, Node: URNG, Next: IDE, Prev: Installation, Up: Top + +2 Uniform Random Number Generator +********************************* + +This binary distribution uses Pierre L’Ecuyers RngStreams +(http://statmath.wu.ac.at/software/RngStreams) library as its default +uniform random number generator. This library uses a package seed. +Thus you should add the following piece of code at the beginning of your +application (at least before you call any of the UNU.RAN functions): + + unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; + RngStream_SetPackageSeed(seed); + +where ‘111u’, ..., ‘666u’ should be replaced by your seeds. + + +_Remark:_ UNU.RAN works with any source of uniform random numbers. We +refer to the UNU.RAN for details if you want to use your own uniform +random number generator instead of the ‘RngStreams’ library. + + +File: unuran_win32.info, Node: IDE, Next: CLI, Prev: URNG, Up: Top + +3 Building Your Own Project in Visual Studio +******************************************** + +_Note:_ The information below applies to the Visual C++ .NET 2005. + + + Let us assume that you want to build a target named ‘example.exe’ and +have: + + • a source file named ‘example.c’ which uses the C API of the UNU.RAN + library (or alternatively a C++ file ‘example.cpp’); + • a folder where this file is located and which we refer to as + ‘’. + + One way to build your project is to create a _Solution_ named +‘example.sln’ as described here. + + 1. Start Microsoft Visual Studio .NET 2005. + + 2. Build the ‘example.sln’ solution: + + From the ‘File’ menu, select ‘New’, and then ‘Project’. + + When the ‘New Project’ dialog box appears then + + − In the ‘Project Types’ pane, select ‘Visual C++ Win32 + Projects’. + − In the ‘Templates pane’, select the ‘Win32 Console Project’ + icon. + − Fill in the project name (‘example’). + − If necessary, correct the location of the project (to + ‘’). + − Click ‘OK’. + + When the Win32 Application Wizard appears then + + − Click on ‘Application Settings’. + − Select ‘Console Application’ as application type. + − Make sure that ‘Empty Project’ is checked in ‘Additional + Options’. + − Click ‘Finish’. + + This creates a solution, ‘example’, with a single project, + ‘example’. You can view the contents of the solution by selecting + ‘Solution Explorer’ in the ‘View’ menu. + + 3. Add your source file to the project. From the ‘Project’ menu, + choose ‘Add Existing Item’: + + − Move to folder ‘’ and select ‘example.c’. + − Click ‘Add’. + + 4. Set some options so that the project knows where to find the + UNU.RAN include files and the UNU.RAN libraries. + + − From the ‘Project’ menu, choose ‘example Properties’. The + ‘example Property Pages’ dialog box appears. + − In the ‘Configuration’ drop-down list, select ‘Release’. + − Select ‘C/C++’ in the ‘Configuration Properties’ tree. + − Select ‘General’. + − In the ‘Additional Include Directories’ field + . add directory ‘’; + . choose ‘No’ for ‘Detect 64-bit Portability Issues’. + − Select ‘Linker’ in the ‘Configuration Properties’ tree. + . Select ‘General’ and then select ‘Additional Library + Directories’. + . Add directory ‘’. + . Select ‘Input’ and then select ‘Additional + Dependencies’. Add library file ‘libunuran111.lib’. + − Click ‘OK’ to close the ‘example Property Pages’ dialog box. + + 5. Set the default project configuration. + + − From the ‘Build’ menu, select ‘Configuration Manager’. + − Select ‘Release’ in the ‘Active Solution Configuration’ + drop-down list. + − Click ‘Close’. + + 6. Finally, to build the project, from the ‘Build’ menu, select ‘Build + Solution’. + + After completion of the compiling and linking process, the target is +created. The full path of the executable is +‘\example\Release\example.exe’. Notice that, if you want to +run the ‘example.exe’ by clicking on it, you need to locate the DLL file +in the same directory or adjust the ‘PATH’ environment variable for the +DLL (*note Installation::). + + +File: unuran_win32.info, Node: CLI, Next: Examples, Prev: IDE, Up: Top + +4 Building Your Own Project on the Command Line +*********************************************** + +First you have to set the appropriate environment variables to enable +32-bit command-line builds by means of the ‘vcvars32.bat’ file: + + 1. At the command prompt, change to the ‘\bin’ subdirectory of your + Visual C++ installation. + + 2. Run ‘vcvars32.bat’ by typing ‘VCVARS32’. + + Then change to your application folder ‘’) that contains +your source file(s) (C or C++). Assume you have one C source file +‘example.c’. Then you can compile and link your executable by + + cl /O2 /W3 /MD /I example.c libunuran111.lib /link /LIBPATH: + + which creates the file ‘example.exe’. + + When you want to run ‘example’ then the location of the DLL +libunuran111.dll (and that of the C run-time library ‘msvcr80.dll’) have +to be included in the environment variable ‘PATH’ (or you need to locate +these DLLs in the same directory). + + +File: unuran_win32.info, Node: Examples, Next: Example1, Prev: CLI, Up: Top + +5 Two Examples +************** + +Here we give small examples. These show + + • How to seed the seed for the RngStreams + (http://statmath.wu.ac.at/software/RngStreams) library. + + • How to create an UNU.RAN generator for a given target distribution. + For more detailed information we refer to the UNU.RAN manual + (http://statmath.wu.ac.at/unuran/doc/unuran.html). + + • How to use an independent stream of uniform random numbers for one + of these UNU.RAN generators. + + • We demonstrate the usage of the easy to use String API. + + • We furthermore show the same example with the more flexible C API. + +* Menu: + +* Example1:: The String API +* Example2:: The C API + + +File: unuran_win32.info, Node: Example1, Next: Example2, Prev: Examples, Up: Examples + +5.1 The String API +================== + + /* ------------------------------------------------------------- */ + /* File: example1.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header files. */ + #include + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; int k; /* will hold the random number */ + + /* Declare UNU.RAN objects. */ + UNUR_GEN *gen1, *gen2, *gen3; /* generator objects */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng2; /* uniform RN generator object */ + + /* -- Optional: Set seed for RNGSTREAMS library -------------- */ + + /* The RNGSTREAMS library sets a package seed. */ + unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; + RngStream_SetPackageSeed(seed); + + /* -- Example 1 ---------------------------------------------- */ + /* Beta distribution with shape parameters 2 and 3. */ + /* Use method 'AUTO' (AUTOmatic). */ + + /* Create generator object. */ + gen1 = unur_str2gen("beta(2,3)"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen1' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen1 == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen1' to sample from */ + /* the target distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen1); + printf("%f\n",x); + } + + /* -- Example 2 ---------------------------------------------- */ + /* Student's t distribution with 3 degrees of freedom. */ + /* Use method 'TDR' (Transformed Density Rejection) with */ + /* "immediate acception" */ + gen2 = unur_str2gen("student(3) & method=TDR; variant_ia"); + if (gen2 == NULL) exit (EXIT_FAILURE); + + /* However, this time we use a (new) independent stream of */ + /* uniformrandom numbers. */ + urng2 = unur_urng_rngstream_new("urng2"); + unur_chg_urng( gen2, urng2 ); + + /* Draw a sample. */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen2); printf("%f\n",x); + } + + /* -- Example 3 ---------------------------------------------- */ + /* Discrete distribution with given probability vector. */ + /* Use method 'DGT' (Discrete Guide Table method). */ + gen3 = unur_str2gen("discr; pv=(0.5,1.5,1.0,0.3) & method=DGT"); + if (gen3 == NULL) exit (EXIT_FAILURE); + + /* we use the default URNG again. So there is nothing to do. */ + + /* Draw a sample. Notice that we get integers! */ + for (i=0; i<10; i++) { + k = unur_sample_discr(gen3); printf("%d\n",k); + } + + /* -- Call destructor ---------------------------------------- */ + /* When generators are not needed any they can be destroyed. */ + + unur_free(gen1); + unur_free(gen2); unur_urng_free(urng2); + unur_free(gen3); + + exit (EXIT_SUCCESS); + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + +File: unuran_win32.info, Node: Example2, Prev: Example1, Up: Examples + +5.2 The C API +============= + + /* ------------------------------------------------------------- */ + /* File: example2.c */ + /* ------------------------------------------------------------- */ + + /* Include UNURAN header files. */ + #include + #include + + /* ------------------------------------------------------------- */ + + int main(void) + { + int i; /* loop variable */ + double x; int k; /* will hold the random number */ + + /* Declare UNU.RAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen1, *gen2, *gen3; /* generator objects */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng2; /* uniform RN generator object */ + + /* -- Optional: Set seed for RNGSTREAMS library -------------- */ + + /* The RNGSTREAMS library sets a package seed. */ + unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; + RngStream_SetPackageSeed(seed); + + /* -- Example 1 ---------------------------------------------- */ + /* Beta distribution with shape parameters 2 and 3. */ + /* Use method 'AUTO' (AUTOmatic). */ + + /* Create distribution object. */ + { + double fparams[] = {2., 3.}; + distr = unur_distr_beta( fparams, 2 ); + } + + /* Choose a method: 'AUTO'. */ + par = unur_auto_new(distr); + + /* Create the generator object. */ + gen1 = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen1' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen1 == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen1' to sample from */ + /* the target distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen1); + printf("%f\n",x); + } + + /* -- Example 2 ---------------------------------------------- */ + /* Student's t distribution with 3 degrees of freedom. */ + /* Use method 'TDR' (Transformed Density Rejection) with */ + /* "immediate acception" */ + + /* Create distribution object. */ + { + double fparams[] = {3.}; + distr = unur_distr_student( fparams, 1 ); + } + + /* Choose a method: 'TDR'. */ + par = unur_tdr_new(distr); + /* ... and change to immediate acceptance. */ + unur_tdr_set_variant_ia(par); + + /* However, this time we use a (new) independent stream of */ + /* uniformrandom numbers. */ + urng2 = unur_urng_rngstream_new("urng2"); + unur_set_urng( par, urng2 ); + + /* Create the generator object. */ + gen2 = unur_init(par); + if (gen2 == NULL) exit (EXIT_FAILURE); + + /* Destroy distribution object. (We do not need it any more.) */ + unur_distr_free(distr); + + /* Draw a sample. */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen2); printf("%f\n",x); + } + + /* -- Example 3 ---------------------------------------------- */ + /* Discrete distribution with given probability vector. */ + /* Use method 'DGT' (Discrete Guide Table method). */ + + /* Create distribution object. */ + { + double probs[] = {0.5, 1.5, 1.0, 0.3}; + distr = unur_distr_discr_new(); + unur_distr_discr_set_pv(distr, probs, 4); + } + + /* Choose a method: 'DGT'. */ + par = unur_dgt_new(distr); + + /* we use the default URNG again. So there is nothing to do. */ + + /* Create the generator object. */ + gen3 = unur_init(par); + if (gen3 == NULL) exit (EXIT_FAILURE); + + /* Destroy distribution object. (We do not need it any more.) */ + unur_distr_free(distr); + + /* Draw a sample. Notice that we get integers! */ + for (i=0; i<10; i++) { + k = unur_sample_discr(gen3); printf("%d\n",k); + } + + /* -- Call destructor ---------------------------------------- */ + /* When generators are not needed any they can be destroyed. */ + + unur_free(gen1); + unur_free(gen2); unur_urng_free(urng2); + unur_free(gen3); + + exit (EXIT_SUCCESS); + } /* end of main() */ + + /* ------------------------------------------------------------- */ + + + +Tag Table: +Node: Top458 +Node: Installation2051 +Node: URNG4052 +Node: IDE4925 +Node: CLI8688 +Node: Examples9763 +Node: Example110535 +Node: Example214528 + +End Tag Table + + +Local Variables: +coding: utf-8 +End: diff --git a/vendor/unuran-1.11.0/doc/unuran_win32.texi b/vendor/unuran-1.11.0/doc/unuran_win32.texi new file mode 100644 index 0000000..a67f8b8 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/unuran_win32.texi @@ -0,0 +1,452 @@ +\input texinfo @c -*-texinfo-*- + +@c %**start of header +@setfilename unuran_win32.info +@settitle Using UNU.RAN with Microsoft Visual C +@iftex +@afourpaper +@end iftex +@footnotestyle end +@setchapternewpage odd +@c %**end of header + +@c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +@c +@c Some data about this software +@c + +@dircategory Scientific software +@direntry +* unuran_win32: (unuran_win32). Using UNU.RAN with Microsoft Visual C +@end direntry + +@c Version ... +@include version_win32.texi +@include unuran_win32_libname.texi + +@c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +@c +@c Copyright +@c + +@copying +@noindent +Copyright @copyright{} 2000--2007 Institut fuer Statistik, WU Wien. + +@noindent +Permission is granted to make and distribute verbatim +copies of this manual provided the copyright notice and +this permission notice are preserved on all copies. +@end copying + +@c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +@c +@c Titlepage ... +@c + +@titlepage +@title Using UNU.RAN with Microsoft Visual C +@subtitle UNU.RAN -- Universal Non-Uniform RANdom number generators +@subtitle Version @value{VERSION}, @value{UPDATED} + +@author Josef Leydold +@author Wolfgang H@"ormann +@author Engin Durmaz + +@page +@vskip 0pt plus 1filll +@insertcopying +@end titlepage + +@c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +@c +@c Table of contents +@c + +@contents + +@c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +@c +@c insert automatically generated documentation ... +@c + +@node TOP +@top Using UNU.RAN with Microsoft Visual C + +@menu +* Installation:: Installation of binary distribution +* URNG:: Uniform random number generator +* IDE:: Building your own project in Visual Studio +* CLI:: Building your own project on the command line +* Examples:: Two Examples +@end menu + +@ifinfo +@noindent +This is the online-documentation of UNU.RAN.@* +Version: @value{VERSION}@* +Date: @value{UPDATED} +@end ifinfo + +This document describes how to use Microsoft Visual Studio to +create a C or C++ project and link the target with UNU.RAN. + +@uref{http://statmath.wu.ac.at/unuran,UNU.RAN} +(Universal Non-Uniform RAndom Number generator) is +a collection of algorithms for generating non-uniform +pseudorandom variates as a library of C functions +designed and implemented by the +@uref{http://statmath.wu.ac.at/arvag,ARVAG} +(Automatic Random VAriate Generation) project group in Vienna, and +released under the GNU Public License (GPL). + +This binary distribution also has support for Pierre L'Ecuyers +@uref{http://statmath.wu.ac.at/software/RngStreams,RngStreams} +library. This library is already compiled into the distributed DLL, +the corresponding header file is included in this package. + +The DLL is linked against the C run-time library @file{MSVCRT.lib}. +Thus the file @file{MSVCR80.DLL} must be available at run time for +applications linked with UNU.RAN and @file{MSVCRT.lib} (i.e., included +in the envirenment variate @env{PATH}). +For details see the +@uref{http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx,Microsoft Visual C++} +manual. + +@c -------------------------------------------------------------------- + +@node Installation, URNG, TOP, TOP +@chapter Installation of Binary Distribution + +@enumerate +@item +Download @value{ZIPFILENAME} from the UNU.RAN +@uref{http://statmath.wu.ac.at/unuran/download.html,download} +page. + +@item +Unpack @value{ZIPFILENAME}. It creates directory @file{unuran} which +contains the following files: + +@table @file +@item unuran.h +Header file to be included in your application source file. +(Contains function prototypes, typedefs and macros.) + +@item RngStream.h +@itemx unuran_urng_rngstreams.h +Header files required for using the @file{RngStream} library. + +@item @value{LIBUNURAN}.def +Module-definition file. +(Declares all functions exported the UNU.RAN library.) + +@item @value{LIBUNURAN}.dll +@itemx @value{LIBUNURAN}.dll.manifest +DLL (Dynamic link library) and its manifest file (must always be +located in the same directory). + +@item @value{LIBUNURAN}.lib +Import library file. + +@item @value{LIBUNURAN}.exp +Library export file. + +@item unuran.pdf +UNU.RAN User Manual. + +@item unuran_win32.pdf +Short description for building your own application using UNU.RAN with +Microsoft Visual C. + +@item example1.c +@itemx example2.c +Two example files. +@end table + +@item +@emph{Optional:} +Move directory @file{unuran} into an appropriate place, e.g. +@file{C:\unuran} (or maybe the folder where you build your +application). + +Throughout this document, the UNU.RAN installation folder is referred +to as @file{}. +For example, if UNU.RAN has been installed in the folder +@file{C:\unuran}, references to +@file{\@value{LIBUNURAN}.lib} +represent @file{C:\unuran\@value{LIBUNURAN}.lib}. + +@item +@emph{Optional:} +Add @file{} to the @env{PATH} environment variable. +Thus your application can find the location of @value{LIBUNURAN}.dll +when it is started. +@end enumerate + + +@c -------------------------------------------------------------------- + +@node URNG, IDE, Installation, TOP +@chapter Uniform Random Number Generator + +This binary distribution uses Pierre L'Ecuyers +@uref{http://statmath.wu.ac.at/software/RngStreams,RngStreams} +library as its default uniform random number generator. +This library uses a package seed. Thus you should add the +following piece of code at the beginning of your application (at least +before you call any of the UNU.RAN functions): + +@example +unsigned long seed[] = @{111u, 222u, 333u, 444u, 555u, 666u@}; +RngStream_SetPackageSeed(seed); +@end example + +@noindent +where @code{111u}, @dots{}, @code{666u} should be replaced by your +seeds. + +@sp 1 +@noindent +@emph{Remark:} +UNU.RAN works with any source of uniform random numbers. +We refer to the UNU.RAN for details if you want to use your own +uniform random number generator instead of the @file{RngStreams} +library. + + +@c -------------------------------------------------------------------- + +@node IDE, CLI, URNG, TOP +@chapter Building Your Own Project in Visual Studio + +@emph{Note:} +The information below applies to the Visual C++ .NET 2005. + +@sp 1 + +Let us assume that you want to build a target named +@file{example.exe} and have: + +@itemize +@item +a source file named @file{example.c} which uses the C API of the +UNU.RAN library (or alternatively a C++ file @file{example.cpp}); +@item +a folder where this file is located and which we refer to as +@file{}. +@end itemize + +One way to build your project is to create a @emph{Solution} named +@file{example.sln} as described here. + +@enumerate +@item +Start Microsoft Visual Studio .NET 2005. + +@item +Build the @file{example.sln} solution: + +From the @file{File} menu, select @file{New}, and then +@file{Project}. + +When the @file{New Project} dialog box appears then + +@itemize @minus +@item +In the @file{Project Types} pane, select @file{Visual C++ Win32 Projects}. +@item +In the @file{Templates pane}, select the @file{Win32 Console Project} icon. +@item +Fill in the project name (@samp{example}). +@item +If necessary, correct the location of the project (to +@file{}). +@item +Click @file{OK}. +@end itemize + +When the Win32 Application Wizard appears then + +@itemize @minus +@item +Click on @file{Application Settings}. +@item +Select @file{Console Application} as application type. +@item +Make sure that @file{Empty Project} is checked in +@file{Additional Options}. +@item +Click @file{Finish}. +@end itemize + +This creates a solution, @file{example}, with a single project, +@file{example}. You can view the contents of the solution by selecting +@file{Solution Explorer} in the @file{View} menu. + +@item +Add your source file to the project. +From the @file{Project} menu, choose @file{Add Existing Item}: + +@itemize @minus +@item +Move to folder @file{} and select @file{example.c}. +@item +Click @file{Add}. +@end itemize + +@item +Set some options so that the project knows where to find the UNU.RAN +include files and the UNU.RAN libraries. + +@itemize @minus +@item +From the @file{Project} menu, choose @file{example Properties}. +The @file{example Property Pages} dialog box appears. +@item +In the @file{Configuration} drop-down list, select @file{Release}. +@item +Select @file{C/C++} in the @file{Configuration Properties} tree. +@item +Select @file{General}. +@item +In the @file{Additional Include Directories} field +@itemize . +@item +add directory @file{}; +@item +choose @file{No} for @file{Detect 64-bit Portability Issues}. +@end itemize +@item +Select @file{Linker} in the @file{Configuration Properties} tree. +@itemize . +@item +Select @file{General} and then select @file{Additional Library +Directories}. +@item +Add directory @file{}. +@item +Select @file{Input} and then select @file{Additional Dependencies}. +Add library file @file{@value{LIBUNURAN}.lib}. +@end itemize +@item +Click @file{OK} to close the @file{example Property Pages} dialog box. +@end itemize + +@item +Set the default project configuration. + +@itemize @minus +@item +From the @file{Build} menu, select @file{Configuration Manager}. +@item +Select @file{Release} in the @file{Active Solution Configuration} +drop-down list. +@item +Click @file{Close}. +@end itemize + +@item +Finally, to build the project, from the @file{Build} menu, select +@file{Build Solution}. + +@end enumerate + +After completion of the compiling and linking process, the target is +created. The full path of the executable is +@file{\example\Release\example.exe}. Notice that, if you +want to run the @file{example.exe} by clicking on it, you need to +locate the DLL file in the same directory or adjust the @env{PATH} +environment variable for the DLL (@pxref{Installation}). + + +@c -------------------------------------------------------------------- + +@node CLI, Examples, IDE, TOP +@chapter Building Your Own Project on the Command Line + +First you have to set the appropriate environment variables to enable +32-bit command-line builds by means of the @file{vcvars32.bat} file: + +@enumerate +@item +At the command prompt, change to the @file{\bin} subdirectory of your +Visual C++ installation. + +@item +Run @file{vcvars32.bat} by typing @code{VCVARS32}. +@end enumerate + +Then change to your application folder @file{}) that +contains your source file(s) (C or C++). +Assume you have one C source file @file{example.c}. Then you can +compile and link your executable by + +@example +cl /O2 /W3 /MD /I example.c @value{LIBUNURAN}.lib /link /LIBPATH: +@end example + +which creates the file @file{example.exe}. + +When you want to run @file{example} then the location of the DLL +@value{LIBUNURAN}.dll (and that of the C run-time library +@file{msvcr80.dll}) have to be included in the environment variable +@env{PATH} (or you need to locate these DLLs in the same directory). + + +@c -------------------------------------------------------------------- + +@node Examples, Example1, CLI, TOP +@chapter Two Examples + +Here we give small examples. These show + +@itemize +@item +How to seed the seed for the +@uref{http://statmath.wu.ac.at/software/RngStreams,RngStreams} +library. + +@item +How to create an UNU.RAN generator for a given target distribution. +For more detailed information we refer to the +@uref{http://statmath.wu.ac.at/unuran/doc/unuran.html,UNU.RAN manual}. + +@item +How to use an independent stream of uniform random numbers for one of +these UNU.RAN generators. + +@item +We demonstrate the usage of the easy to use String API. + +@item +We furthermore show the same example with the more flexible C API. +@end itemize + +@menu +* Example1:: The String API +* Example2:: The C API +@end menu + + +@c -------------------------------------------------------------------- + +@node Example1, Example2, Examples, Examples +@section The String API + +@smallexample +@include ref_example_win32_1.texi +@end smallexample + + +@c -------------------------------------------------------------------- + +@node Example2, , Example1, Examples +@section The C API + +@smallexample +@include ref_example_win32_2.texi +@end smallexample + +@c -------------------------------------------------------------------- +@bye diff --git a/vendor/unuran-1.11.0/doc/unuran_win32_libname.texi b/vendor/unuran-1.11.0/doc/unuran_win32_libname.texi new file mode 100644 index 0000000..7b67cff --- /dev/null +++ b/vendor/unuran-1.11.0/doc/unuran_win32_libname.texi @@ -0,0 +1,2 @@ +@set LIBUNURAN libunuran111 +@set ZIPFILENAME unuran-1.11.0-win32.zip diff --git a/vendor/unuran-1.11.0/doc/version.texi b/vendor/unuran-1.11.0/doc/version.texi new file mode 100644 index 0000000..885c611 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/version.texi @@ -0,0 +1,4 @@ +@set UPDATED 21 April 2023 +@set UPDATED-MONTH April 2023 +@set EDITION 1.11.0 +@set VERSION 1.11.0 diff --git a/vendor/unuran-1.11.0/doc/version_win32.texi b/vendor/unuran-1.11.0/doc/version_win32.texi new file mode 100644 index 0000000..885c611 --- /dev/null +++ b/vendor/unuran-1.11.0/doc/version_win32.texi @@ -0,0 +1,4 @@ +@set UPDATED 21 April 2023 +@set UPDATED-MONTH April 2023 +@set EDITION 1.11.0 +@set VERSION 1.11.0 diff --git a/vendor/unuran-1.11.0/examples/.deps/example0.Po b/vendor/unuran-1.11.0/examples/.deps/example0.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example0.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example0_str.Po b/vendor/unuran-1.11.0/examples/.deps/example0_str.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example0_str.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example1.Po b/vendor/unuran-1.11.0/examples/.deps/example1.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example1.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example1_str.Po b/vendor/unuran-1.11.0/examples/.deps/example1_str.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example1_str.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example2.Po b/vendor/unuran-1.11.0/examples/.deps/example2.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example2.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example2_str.Po b/vendor/unuran-1.11.0/examples/.deps/example2_str.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example2_str.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example3.Po b/vendor/unuran-1.11.0/examples/.deps/example3.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example3.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example3_str.Po b/vendor/unuran-1.11.0/examples/.deps/example3_str.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example3_str.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_FuncStr.Po b/vendor/unuran-1.11.0/examples/.deps/example_FuncStr.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_FuncStr.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_anti.Po b/vendor/unuran-1.11.0/examples/.deps/example_anti.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_anti.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_anti_str.Po b/vendor/unuran-1.11.0/examples/.deps/example_anti_str.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_anti_str.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_cext.Po b/vendor/unuran-1.11.0/examples/.deps/example_cext.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_cext.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_cont.Po b/vendor/unuran-1.11.0/examples/.deps/example_cont.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_cont.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_cont_str.Po b/vendor/unuran-1.11.0/examples/.deps/example_cont_str.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_cont_str.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_cpp.Po b/vendor/unuran-1.11.0/examples/.deps/example_cpp.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_cpp.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_dext.Po b/vendor/unuran-1.11.0/examples/.deps/example_dext.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_dext.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_discr.Po b/vendor/unuran-1.11.0/examples/.deps/example_discr.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_discr.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_discr_str.Po b/vendor/unuran-1.11.0/examples/.deps/example_discr_str.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_discr_str.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_emp.Po b/vendor/unuran-1.11.0/examples/.deps/example_emp.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_emp.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_emp_str.Po b/vendor/unuran-1.11.0/examples/.deps/example_emp_str.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_emp_str.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_errorhandler.Po b/vendor/unuran-1.11.0/examples/.deps/example_errorhandler.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_errorhandler.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_gsl.Po b/vendor/unuran-1.11.0/examples/.deps/example_gsl.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_gsl.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_mcorr.Po b/vendor/unuran-1.11.0/examples/.deps/example_mcorr.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_mcorr.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_mixt.Po b/vendor/unuran-1.11.0/examples/.deps/example_mixt.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_mixt.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_mixt_inv.Po b/vendor/unuran-1.11.0/examples/.deps/example_mixt_inv.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_mixt_inv.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_prng.Po b/vendor/unuran-1.11.0/examples/.deps/example_prng.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_prng.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_prng_str.Po b/vendor/unuran-1.11.0/examples/.deps/example_prng_str.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_prng_str.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_reinit.Po b/vendor/unuran-1.11.0/examples/.deps/example_reinit.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_reinit.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_rngstreams.Po b/vendor/unuran-1.11.0/examples/.deps/example_rngstreams.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_rngstreams.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/.deps/example_vemp.Po b/vendor/unuran-1.11.0/examples/.deps/example_vemp.Po new file mode 100644 index 0000000..9ce06a8 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/.deps/example_vemp.Po @@ -0,0 +1 @@ +# dummy diff --git a/vendor/unuran-1.11.0/examples/Makefile b/vendor/unuran-1.11.0/examples/Makefile new file mode 100644 index 0000000..371438b --- /dev/null +++ b/vendor/unuran-1.11.0/examples/Makefile @@ -0,0 +1,1642 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# examples/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/unuran +pkgincludedir = $(includedir)/unuran +pkglibdir = $(libdir)/unuran +pkglibexecdir = $(libexecdir)/unuran +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +check_PROGRAMS = $(am__EXEEXT_1) +TESTS = $(am__EXEEXT_1) +subdir = examples +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__EXEEXT_1 = example0$(EXEEXT) example0_str$(EXEEXT) \ + example1$(EXEEXT) example1_str$(EXEEXT) example2$(EXEEXT) \ + example2_str$(EXEEXT) example3$(EXEEXT) example3_str$(EXEEXT) \ + example_reinit$(EXEEXT) example_cext$(EXEEXT) \ + example_cont$(EXEEXT) example_cont_str$(EXEEXT) \ + example_dext$(EXEEXT) example_discr$(EXEEXT) \ + example_discr_str$(EXEEXT) example_emp$(EXEEXT) \ + example_emp_str$(EXEEXT) example_vemp$(EXEEXT) \ + example_FuncStr$(EXEEXT) example_mcorr$(EXEEXT) \ + example_mixt$(EXEEXT) example_mixt_inv$(EXEEXT) \ + example_cpp$(EXEEXT) example_gsl$(EXEEXT) \ + example_rngstreams$(EXEEXT) example_prng$(EXEEXT) \ + example_prng_str$(EXEEXT) example_anti$(EXEEXT) \ + example_anti_str$(EXEEXT) example_errorhandler$(EXEEXT) +example0_SOURCES = example0.c +example0_OBJECTS = example0.$(OBJEXT) +example0_LDADD = $(LDADD) +example0_DEPENDENCIES = $(top_builddir)/src/libunuran.la +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__v_lt_1 = +example0_str_SOURCES = example0_str.c +example0_str_OBJECTS = example0_str.$(OBJEXT) +example0_str_LDADD = $(LDADD) +example0_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example1_SOURCES = example1.c +example1_OBJECTS = example1.$(OBJEXT) +example1_LDADD = $(LDADD) +example1_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example1_str_SOURCES = example1_str.c +example1_str_OBJECTS = example1_str.$(OBJEXT) +example1_str_LDADD = $(LDADD) +example1_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example2_SOURCES = example2.c +example2_OBJECTS = example2.$(OBJEXT) +example2_LDADD = $(LDADD) +example2_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example2_str_SOURCES = example2_str.c +example2_str_OBJECTS = example2_str.$(OBJEXT) +example2_str_LDADD = $(LDADD) +example2_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example3_SOURCES = example3.c +example3_OBJECTS = example3.$(OBJEXT) +example3_LDADD = $(LDADD) +example3_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example3_str_SOURCES = example3_str.c +example3_str_OBJECTS = example3_str.$(OBJEXT) +example3_str_LDADD = $(LDADD) +example3_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_FuncStr_SOURCES = example_FuncStr.c +example_FuncStr_OBJECTS = example_FuncStr.$(OBJEXT) +example_FuncStr_LDADD = $(LDADD) +example_FuncStr_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_anti_SOURCES = example_anti.c +example_anti_OBJECTS = example_anti.$(OBJEXT) +example_anti_LDADD = $(LDADD) +example_anti_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_anti_str_SOURCES = example_anti_str.c +example_anti_str_OBJECTS = example_anti_str.$(OBJEXT) +example_anti_str_LDADD = $(LDADD) +example_anti_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_cext_SOURCES = example_cext.c +example_cext_OBJECTS = example_cext.$(OBJEXT) +example_cext_LDADD = $(LDADD) +example_cext_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_cont_SOURCES = example_cont.c +example_cont_OBJECTS = example_cont.$(OBJEXT) +example_cont_LDADD = $(LDADD) +example_cont_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_cont_str_SOURCES = example_cont_str.c +example_cont_str_OBJECTS = example_cont_str.$(OBJEXT) +example_cont_str_LDADD = $(LDADD) +example_cont_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la +am_example_cpp_OBJECTS = example_cpp.$(OBJEXT) +example_cpp_OBJECTS = $(am_example_cpp_OBJECTS) +example_cpp_LDADD = $(LDADD) +example_cpp_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_dext_SOURCES = example_dext.c +example_dext_OBJECTS = example_dext.$(OBJEXT) +example_dext_LDADD = $(LDADD) +example_dext_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_discr_SOURCES = example_discr.c +example_discr_OBJECTS = example_discr.$(OBJEXT) +example_discr_LDADD = $(LDADD) +example_discr_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_discr_str_SOURCES = example_discr_str.c +example_discr_str_OBJECTS = example_discr_str.$(OBJEXT) +example_discr_str_LDADD = $(LDADD) +example_discr_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_emp_SOURCES = example_emp.c +example_emp_OBJECTS = example_emp.$(OBJEXT) +example_emp_LDADD = $(LDADD) +example_emp_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_emp_str_SOURCES = example_emp_str.c +example_emp_str_OBJECTS = example_emp_str.$(OBJEXT) +example_emp_str_LDADD = $(LDADD) +example_emp_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_errorhandler_SOURCES = example_errorhandler.c +example_errorhandler_OBJECTS = example_errorhandler.$(OBJEXT) +example_errorhandler_LDADD = $(LDADD) +example_errorhandler_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_gsl_SOURCES = example_gsl.c +example_gsl_OBJECTS = example_gsl.$(OBJEXT) +example_gsl_LDADD = $(LDADD) +example_gsl_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_mcorr_SOURCES = example_mcorr.c +example_mcorr_OBJECTS = example_mcorr.$(OBJEXT) +example_mcorr_LDADD = $(LDADD) +example_mcorr_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_mixt_SOURCES = example_mixt.c +example_mixt_OBJECTS = example_mixt.$(OBJEXT) +example_mixt_LDADD = $(LDADD) +example_mixt_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_mixt_inv_SOURCES = example_mixt_inv.c +example_mixt_inv_OBJECTS = example_mixt_inv.$(OBJEXT) +example_mixt_inv_LDADD = $(LDADD) +example_mixt_inv_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_prng_SOURCES = example_prng.c +example_prng_OBJECTS = example_prng.$(OBJEXT) +example_prng_LDADD = $(LDADD) +example_prng_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_prng_str_SOURCES = example_prng_str.c +example_prng_str_OBJECTS = example_prng_str.$(OBJEXT) +example_prng_str_LDADD = $(LDADD) +example_prng_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_reinit_SOURCES = example_reinit.c +example_reinit_OBJECTS = example_reinit.$(OBJEXT) +example_reinit_LDADD = $(LDADD) +example_reinit_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_rngstreams_SOURCES = example_rngstreams.c +example_rngstreams_OBJECTS = example_rngstreams.$(OBJEXT) +example_rngstreams_LDADD = $(LDADD) +example_rngstreams_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_vemp_SOURCES = example_vemp.c +example_vemp_OBJECTS = example_vemp.$(OBJEXT) +example_vemp_LDADD = $(LDADD) +example_vemp_DEPENDENCIES = $(top_builddir)/src/libunuran.la +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I. -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/example0.Po \ + ./$(DEPDIR)/example0_str.Po ./$(DEPDIR)/example1.Po \ + ./$(DEPDIR)/example1_str.Po ./$(DEPDIR)/example2.Po \ + ./$(DEPDIR)/example2_str.Po ./$(DEPDIR)/example3.Po \ + ./$(DEPDIR)/example3_str.Po ./$(DEPDIR)/example_FuncStr.Po \ + ./$(DEPDIR)/example_anti.Po ./$(DEPDIR)/example_anti_str.Po \ + ./$(DEPDIR)/example_cext.Po ./$(DEPDIR)/example_cont.Po \ + ./$(DEPDIR)/example_cont_str.Po ./$(DEPDIR)/example_cpp.Po \ + ./$(DEPDIR)/example_dext.Po ./$(DEPDIR)/example_discr.Po \ + ./$(DEPDIR)/example_discr_str.Po ./$(DEPDIR)/example_emp.Po \ + ./$(DEPDIR)/example_emp_str.Po \ + ./$(DEPDIR)/example_errorhandler.Po ./$(DEPDIR)/example_gsl.Po \ + ./$(DEPDIR)/example_mcorr.Po ./$(DEPDIR)/example_mixt.Po \ + ./$(DEPDIR)/example_mixt_inv.Po ./$(DEPDIR)/example_prng.Po \ + ./$(DEPDIR)/example_prng_str.Po ./$(DEPDIR)/example_reinit.Po \ + ./$(DEPDIR)/example_rngstreams.Po ./$(DEPDIR)/example_vemp.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_$(V)) +am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY)) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_$(V)) +am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = example0.c example0_str.c example1.c example1_str.c \ + example2.c example2_str.c example3.c example3_str.c \ + example_FuncStr.c example_anti.c example_anti_str.c \ + example_cext.c example_cont.c example_cont_str.c \ + $(example_cpp_SOURCES) example_dext.c example_discr.c \ + example_discr_str.c example_emp.c example_emp_str.c \ + example_errorhandler.c example_gsl.c example_mcorr.c \ + example_mixt.c example_mixt_inv.c example_prng.c \ + example_prng_str.c example_reinit.c example_rngstreams.c \ + example_vemp.c +DIST_SOURCES = example0.c example0_str.c example1.c example1_str.c \ + example2.c example2_str.c example3.c example3_str.c \ + example_FuncStr.c example_anti.c example_anti_str.c \ + example_cext.c example_cont.c example_cont_str.c \ + $(example_cpp_SOURCES) example_dext.c example_discr.c \ + example_discr_str.c example_emp.c example_emp_str.c \ + example_errorhandler.c example_gsl.c example_mcorr.c \ + example_mixt.c example_mixt_inv.c example_prng.c \ + example_prng_str.c example_reinit.c example_rngstreams.c \ + example_vemp.c +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' +RECHECK_LOGS = $(TEST_LOGS) +AM_RECURSIVE_TARGETS = check recheck +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/autoconf/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/autoconf/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp \ + $(top_srcdir)/autoconf/test-driver +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_CFLAGS = -Wall -Wextra -Wshadow -Wstrict-prototypes +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf +AUTOHEADER = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader +AUTOMAKE = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -fPIC +CPP = gcc -E +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +FILECMD = file +GREP = /usr/bin/grep +HAVE_DIVIDE_BY_ZERO = +HAVE_IEEE_COMPARISONS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAINT = # +MAKEINFO = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = unuran +PACKAGE_BUGREPORT = unuran@statmath.wu.ac.at +PACKAGE_NAME = unuran +PACKAGE_STRING = unuran 1.11.0 +PACKAGE_TARNAME = unuran +PACKAGE_URL = +PACKAGE_VERSION = 1.11.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +UNURAN_LT_VERSION = 16:1:0 +UNURAN_SUPPORTS_GSL = +UNURAN_SUPPORTS_PRNG = +UNURAN_SUPPORTS_RNGSTREAM = +VERSION = 1.11.0 +abs_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/examples +abs_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/examples +abs_top_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +have_valgrind = false +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../ +top_builddir = .. +top_srcdir = .. +AM_CPPFLAGS = \ + $(UNURAN_SUPPORTS_GSL) \ + $(UNURAN_SUPPORTS_PRNG) \ + $(UNURAN_SUPPORTS_RNGSTREAM) \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/uniform + +AM_LDFLAGS = \ + -L$(top_builddir)/src + +LDADD = \ + $(top_builddir)/src/libunuran.la + +EXAMPLES = \ + example0 example0_str \ + example1 example1_str \ + example2 example2_str \ + example3 example3_str \ + example_reinit \ + example_cext \ + example_cont example_cont_str \ + example_dext \ + example_discr example_discr_str \ + example_emp example_emp_str \ + example_vemp \ + example_FuncStr \ + example_mcorr \ + example_mixt example_mixt_inv \ + example_cpp \ + example_gsl \ + example_rngstreams \ + example_prng example_prng_str \ + example_anti example_anti_str \ + example_errorhandler + +example_cpp_SOURCES = example_cpp.cpp + +# clean log files and backup files +CLEANFILES = \ + unuran.log \ + valgrind-* \ + *~ + + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .cpp .lo .log .o .obj .test .test$(EXEEXT) .trs +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign examples/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +example0$(EXEEXT): $(example0_OBJECTS) $(example0_DEPENDENCIES) $(EXTRA_example0_DEPENDENCIES) + @rm -f example0$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example0_OBJECTS) $(example0_LDADD) $(LIBS) + +example0_str$(EXEEXT): $(example0_str_OBJECTS) $(example0_str_DEPENDENCIES) $(EXTRA_example0_str_DEPENDENCIES) + @rm -f example0_str$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example0_str_OBJECTS) $(example0_str_LDADD) $(LIBS) + +example1$(EXEEXT): $(example1_OBJECTS) $(example1_DEPENDENCIES) $(EXTRA_example1_DEPENDENCIES) + @rm -f example1$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example1_OBJECTS) $(example1_LDADD) $(LIBS) + +example1_str$(EXEEXT): $(example1_str_OBJECTS) $(example1_str_DEPENDENCIES) $(EXTRA_example1_str_DEPENDENCIES) + @rm -f example1_str$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example1_str_OBJECTS) $(example1_str_LDADD) $(LIBS) + +example2$(EXEEXT): $(example2_OBJECTS) $(example2_DEPENDENCIES) $(EXTRA_example2_DEPENDENCIES) + @rm -f example2$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example2_OBJECTS) $(example2_LDADD) $(LIBS) + +example2_str$(EXEEXT): $(example2_str_OBJECTS) $(example2_str_DEPENDENCIES) $(EXTRA_example2_str_DEPENDENCIES) + @rm -f example2_str$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example2_str_OBJECTS) $(example2_str_LDADD) $(LIBS) + +example3$(EXEEXT): $(example3_OBJECTS) $(example3_DEPENDENCIES) $(EXTRA_example3_DEPENDENCIES) + @rm -f example3$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example3_OBJECTS) $(example3_LDADD) $(LIBS) + +example3_str$(EXEEXT): $(example3_str_OBJECTS) $(example3_str_DEPENDENCIES) $(EXTRA_example3_str_DEPENDENCIES) + @rm -f example3_str$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example3_str_OBJECTS) $(example3_str_LDADD) $(LIBS) + +example_FuncStr$(EXEEXT): $(example_FuncStr_OBJECTS) $(example_FuncStr_DEPENDENCIES) $(EXTRA_example_FuncStr_DEPENDENCIES) + @rm -f example_FuncStr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_FuncStr_OBJECTS) $(example_FuncStr_LDADD) $(LIBS) + +example_anti$(EXEEXT): $(example_anti_OBJECTS) $(example_anti_DEPENDENCIES) $(EXTRA_example_anti_DEPENDENCIES) + @rm -f example_anti$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_anti_OBJECTS) $(example_anti_LDADD) $(LIBS) + +example_anti_str$(EXEEXT): $(example_anti_str_OBJECTS) $(example_anti_str_DEPENDENCIES) $(EXTRA_example_anti_str_DEPENDENCIES) + @rm -f example_anti_str$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_anti_str_OBJECTS) $(example_anti_str_LDADD) $(LIBS) + +example_cext$(EXEEXT): $(example_cext_OBJECTS) $(example_cext_DEPENDENCIES) $(EXTRA_example_cext_DEPENDENCIES) + @rm -f example_cext$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_cext_OBJECTS) $(example_cext_LDADD) $(LIBS) + +example_cont$(EXEEXT): $(example_cont_OBJECTS) $(example_cont_DEPENDENCIES) $(EXTRA_example_cont_DEPENDENCIES) + @rm -f example_cont$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_cont_OBJECTS) $(example_cont_LDADD) $(LIBS) + +example_cont_str$(EXEEXT): $(example_cont_str_OBJECTS) $(example_cont_str_DEPENDENCIES) $(EXTRA_example_cont_str_DEPENDENCIES) + @rm -f example_cont_str$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_cont_str_OBJECTS) $(example_cont_str_LDADD) $(LIBS) + +example_cpp$(EXEEXT): $(example_cpp_OBJECTS) $(example_cpp_DEPENDENCIES) $(EXTRA_example_cpp_DEPENDENCIES) + @rm -f example_cpp$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(example_cpp_OBJECTS) $(example_cpp_LDADD) $(LIBS) + +example_dext$(EXEEXT): $(example_dext_OBJECTS) $(example_dext_DEPENDENCIES) $(EXTRA_example_dext_DEPENDENCIES) + @rm -f example_dext$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_dext_OBJECTS) $(example_dext_LDADD) $(LIBS) + +example_discr$(EXEEXT): $(example_discr_OBJECTS) $(example_discr_DEPENDENCIES) $(EXTRA_example_discr_DEPENDENCIES) + @rm -f example_discr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_discr_OBJECTS) $(example_discr_LDADD) $(LIBS) + +example_discr_str$(EXEEXT): $(example_discr_str_OBJECTS) $(example_discr_str_DEPENDENCIES) $(EXTRA_example_discr_str_DEPENDENCIES) + @rm -f example_discr_str$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_discr_str_OBJECTS) $(example_discr_str_LDADD) $(LIBS) + +example_emp$(EXEEXT): $(example_emp_OBJECTS) $(example_emp_DEPENDENCIES) $(EXTRA_example_emp_DEPENDENCIES) + @rm -f example_emp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_emp_OBJECTS) $(example_emp_LDADD) $(LIBS) + +example_emp_str$(EXEEXT): $(example_emp_str_OBJECTS) $(example_emp_str_DEPENDENCIES) $(EXTRA_example_emp_str_DEPENDENCIES) + @rm -f example_emp_str$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_emp_str_OBJECTS) $(example_emp_str_LDADD) $(LIBS) + +example_errorhandler$(EXEEXT): $(example_errorhandler_OBJECTS) $(example_errorhandler_DEPENDENCIES) $(EXTRA_example_errorhandler_DEPENDENCIES) + @rm -f example_errorhandler$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_errorhandler_OBJECTS) $(example_errorhandler_LDADD) $(LIBS) + +example_gsl$(EXEEXT): $(example_gsl_OBJECTS) $(example_gsl_DEPENDENCIES) $(EXTRA_example_gsl_DEPENDENCIES) + @rm -f example_gsl$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_gsl_OBJECTS) $(example_gsl_LDADD) $(LIBS) + +example_mcorr$(EXEEXT): $(example_mcorr_OBJECTS) $(example_mcorr_DEPENDENCIES) $(EXTRA_example_mcorr_DEPENDENCIES) + @rm -f example_mcorr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_mcorr_OBJECTS) $(example_mcorr_LDADD) $(LIBS) + +example_mixt$(EXEEXT): $(example_mixt_OBJECTS) $(example_mixt_DEPENDENCIES) $(EXTRA_example_mixt_DEPENDENCIES) + @rm -f example_mixt$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_mixt_OBJECTS) $(example_mixt_LDADD) $(LIBS) + +example_mixt_inv$(EXEEXT): $(example_mixt_inv_OBJECTS) $(example_mixt_inv_DEPENDENCIES) $(EXTRA_example_mixt_inv_DEPENDENCIES) + @rm -f example_mixt_inv$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_mixt_inv_OBJECTS) $(example_mixt_inv_LDADD) $(LIBS) + +example_prng$(EXEEXT): $(example_prng_OBJECTS) $(example_prng_DEPENDENCIES) $(EXTRA_example_prng_DEPENDENCIES) + @rm -f example_prng$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_prng_OBJECTS) $(example_prng_LDADD) $(LIBS) + +example_prng_str$(EXEEXT): $(example_prng_str_OBJECTS) $(example_prng_str_DEPENDENCIES) $(EXTRA_example_prng_str_DEPENDENCIES) + @rm -f example_prng_str$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_prng_str_OBJECTS) $(example_prng_str_LDADD) $(LIBS) + +example_reinit$(EXEEXT): $(example_reinit_OBJECTS) $(example_reinit_DEPENDENCIES) $(EXTRA_example_reinit_DEPENDENCIES) + @rm -f example_reinit$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_reinit_OBJECTS) $(example_reinit_LDADD) $(LIBS) + +example_rngstreams$(EXEEXT): $(example_rngstreams_OBJECTS) $(example_rngstreams_DEPENDENCIES) $(EXTRA_example_rngstreams_DEPENDENCIES) + @rm -f example_rngstreams$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_rngstreams_OBJECTS) $(example_rngstreams_LDADD) $(LIBS) + +example_vemp$(EXEEXT): $(example_vemp_OBJECTS) $(example_vemp_DEPENDENCIES) $(EXTRA_example_vemp_DEPENDENCIES) + @rm -f example_vemp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_vemp_OBJECTS) $(example_vemp_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/example0.Po # am--include-marker +include ./$(DEPDIR)/example0_str.Po # am--include-marker +include ./$(DEPDIR)/example1.Po # am--include-marker +include ./$(DEPDIR)/example1_str.Po # am--include-marker +include ./$(DEPDIR)/example2.Po # am--include-marker +include ./$(DEPDIR)/example2_str.Po # am--include-marker +include ./$(DEPDIR)/example3.Po # am--include-marker +include ./$(DEPDIR)/example3_str.Po # am--include-marker +include ./$(DEPDIR)/example_FuncStr.Po # am--include-marker +include ./$(DEPDIR)/example_anti.Po # am--include-marker +include ./$(DEPDIR)/example_anti_str.Po # am--include-marker +include ./$(DEPDIR)/example_cext.Po # am--include-marker +include ./$(DEPDIR)/example_cont.Po # am--include-marker +include ./$(DEPDIR)/example_cont_str.Po # am--include-marker +include ./$(DEPDIR)/example_cpp.Po # am--include-marker +include ./$(DEPDIR)/example_dext.Po # am--include-marker +include ./$(DEPDIR)/example_discr.Po # am--include-marker +include ./$(DEPDIR)/example_discr_str.Po # am--include-marker +include ./$(DEPDIR)/example_emp.Po # am--include-marker +include ./$(DEPDIR)/example_emp_str.Po # am--include-marker +include ./$(DEPDIR)/example_errorhandler.Po # am--include-marker +include ./$(DEPDIR)/example_gsl.Po # am--include-marker +include ./$(DEPDIR)/example_mcorr.Po # am--include-marker +include ./$(DEPDIR)/example_mixt.Po # am--include-marker +include ./$(DEPDIR)/example_mixt_inv.Po # am--include-marker +include ./$(DEPDIR)/example_prng.Po # am--include-marker +include ./$(DEPDIR)/example_prng_str.Po # am--include-marker +include ./$(DEPDIR)/example_reinit.Po # am--include-marker +include ./$(DEPDIR)/example_rngstreams.Po # am--include-marker +include ./$(DEPDIR)/example_vemp.Po # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ $< + +.c.obj: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: + $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +# $(AM_V_CC)source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $< + +.cpp.o: + $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CXX)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: + $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CXX)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: + $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +# $(AM_V_CXX)source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(AM_V_CXX_no)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: $(check_PROGRAMS) + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_PROGRAMS) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +example0.log: example0$(EXEEXT) + @p='example0$(EXEEXT)'; \ + b='example0'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example0_str.log: example0_str$(EXEEXT) + @p='example0_str$(EXEEXT)'; \ + b='example0_str'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example1.log: example1$(EXEEXT) + @p='example1$(EXEEXT)'; \ + b='example1'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example1_str.log: example1_str$(EXEEXT) + @p='example1_str$(EXEEXT)'; \ + b='example1_str'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example2.log: example2$(EXEEXT) + @p='example2$(EXEEXT)'; \ + b='example2'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example2_str.log: example2_str$(EXEEXT) + @p='example2_str$(EXEEXT)'; \ + b='example2_str'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example3.log: example3$(EXEEXT) + @p='example3$(EXEEXT)'; \ + b='example3'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example3_str.log: example3_str$(EXEEXT) + @p='example3_str$(EXEEXT)'; \ + b='example3_str'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_reinit.log: example_reinit$(EXEEXT) + @p='example_reinit$(EXEEXT)'; \ + b='example_reinit'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_cext.log: example_cext$(EXEEXT) + @p='example_cext$(EXEEXT)'; \ + b='example_cext'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_cont.log: example_cont$(EXEEXT) + @p='example_cont$(EXEEXT)'; \ + b='example_cont'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_cont_str.log: example_cont_str$(EXEEXT) + @p='example_cont_str$(EXEEXT)'; \ + b='example_cont_str'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_dext.log: example_dext$(EXEEXT) + @p='example_dext$(EXEEXT)'; \ + b='example_dext'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_discr.log: example_discr$(EXEEXT) + @p='example_discr$(EXEEXT)'; \ + b='example_discr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_discr_str.log: example_discr_str$(EXEEXT) + @p='example_discr_str$(EXEEXT)'; \ + b='example_discr_str'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_emp.log: example_emp$(EXEEXT) + @p='example_emp$(EXEEXT)'; \ + b='example_emp'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_emp_str.log: example_emp_str$(EXEEXT) + @p='example_emp_str$(EXEEXT)'; \ + b='example_emp_str'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_vemp.log: example_vemp$(EXEEXT) + @p='example_vemp$(EXEEXT)'; \ + b='example_vemp'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_FuncStr.log: example_FuncStr$(EXEEXT) + @p='example_FuncStr$(EXEEXT)'; \ + b='example_FuncStr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_mcorr.log: example_mcorr$(EXEEXT) + @p='example_mcorr$(EXEEXT)'; \ + b='example_mcorr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_mixt.log: example_mixt$(EXEEXT) + @p='example_mixt$(EXEEXT)'; \ + b='example_mixt'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_mixt_inv.log: example_mixt_inv$(EXEEXT) + @p='example_mixt_inv$(EXEEXT)'; \ + b='example_mixt_inv'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_cpp.log: example_cpp$(EXEEXT) + @p='example_cpp$(EXEEXT)'; \ + b='example_cpp'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_gsl.log: example_gsl$(EXEEXT) + @p='example_gsl$(EXEEXT)'; \ + b='example_gsl'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_rngstreams.log: example_rngstreams$(EXEEXT) + @p='example_rngstreams$(EXEEXT)'; \ + b='example_rngstreams'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_prng.log: example_prng$(EXEEXT) + @p='example_prng$(EXEEXT)'; \ + b='example_prng'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_prng_str.log: example_prng_str$(EXEEXT) + @p='example_prng_str$(EXEEXT)'; \ + b='example_prng_str'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_anti.log: example_anti$(EXEEXT) + @p='example_anti$(EXEEXT)'; \ + b='example_anti'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_anti_str.log: example_anti_str$(EXEEXT) + @p='example_anti_str$(EXEEXT)'; \ + b='example_anti_str'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_errorhandler.log: example_errorhandler$(EXEEXT) + @p='example_errorhandler$(EXEEXT)'; \ + b='example_errorhandler'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +#.test$(EXEEXT).log: +# @p='$<'; \ +# $(am__set_b); \ +# $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +# --log-file $$b.log --trs-file $$b.trs \ +# $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +# "$$tst" $(AM_TESTS_FD_REDIRECT) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/example0.Po + -rm -f ./$(DEPDIR)/example0_str.Po + -rm -f ./$(DEPDIR)/example1.Po + -rm -f ./$(DEPDIR)/example1_str.Po + -rm -f ./$(DEPDIR)/example2.Po + -rm -f ./$(DEPDIR)/example2_str.Po + -rm -f ./$(DEPDIR)/example3.Po + -rm -f ./$(DEPDIR)/example3_str.Po + -rm -f ./$(DEPDIR)/example_FuncStr.Po + -rm -f ./$(DEPDIR)/example_anti.Po + -rm -f ./$(DEPDIR)/example_anti_str.Po + -rm -f ./$(DEPDIR)/example_cext.Po + -rm -f ./$(DEPDIR)/example_cont.Po + -rm -f ./$(DEPDIR)/example_cont_str.Po + -rm -f ./$(DEPDIR)/example_cpp.Po + -rm -f ./$(DEPDIR)/example_dext.Po + -rm -f ./$(DEPDIR)/example_discr.Po + -rm -f ./$(DEPDIR)/example_discr_str.Po + -rm -f ./$(DEPDIR)/example_emp.Po + -rm -f ./$(DEPDIR)/example_emp_str.Po + -rm -f ./$(DEPDIR)/example_errorhandler.Po + -rm -f ./$(DEPDIR)/example_gsl.Po + -rm -f ./$(DEPDIR)/example_mcorr.Po + -rm -f ./$(DEPDIR)/example_mixt.Po + -rm -f ./$(DEPDIR)/example_mixt_inv.Po + -rm -f ./$(DEPDIR)/example_prng.Po + -rm -f ./$(DEPDIR)/example_prng_str.Po + -rm -f ./$(DEPDIR)/example_reinit.Po + -rm -f ./$(DEPDIR)/example_rngstreams.Po + -rm -f ./$(DEPDIR)/example_vemp.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/example0.Po + -rm -f ./$(DEPDIR)/example0_str.Po + -rm -f ./$(DEPDIR)/example1.Po + -rm -f ./$(DEPDIR)/example1_str.Po + -rm -f ./$(DEPDIR)/example2.Po + -rm -f ./$(DEPDIR)/example2_str.Po + -rm -f ./$(DEPDIR)/example3.Po + -rm -f ./$(DEPDIR)/example3_str.Po + -rm -f ./$(DEPDIR)/example_FuncStr.Po + -rm -f ./$(DEPDIR)/example_anti.Po + -rm -f ./$(DEPDIR)/example_anti_str.Po + -rm -f ./$(DEPDIR)/example_cext.Po + -rm -f ./$(DEPDIR)/example_cont.Po + -rm -f ./$(DEPDIR)/example_cont_str.Po + -rm -f ./$(DEPDIR)/example_cpp.Po + -rm -f ./$(DEPDIR)/example_dext.Po + -rm -f ./$(DEPDIR)/example_discr.Po + -rm -f ./$(DEPDIR)/example_discr_str.Po + -rm -f ./$(DEPDIR)/example_emp.Po + -rm -f ./$(DEPDIR)/example_emp_str.Po + -rm -f ./$(DEPDIR)/example_errorhandler.Po + -rm -f ./$(DEPDIR)/example_gsl.Po + -rm -f ./$(DEPDIR)/example_mcorr.Po + -rm -f ./$(DEPDIR)/example_mixt.Po + -rm -f ./$(DEPDIR)/example_mixt_inv.Po + -rm -f ./$(DEPDIR)/example_prng.Po + -rm -f ./$(DEPDIR)/example_prng_str.Po + -rm -f ./$(DEPDIR)/example_reinit.Po + -rm -f ./$(DEPDIR)/example_rngstreams.Po + -rm -f ./$(DEPDIR)/example_vemp.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ + check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + recheck tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# run tests with valgrind +#valgrind: $(check_PROGRAMS) +# @list='$(check_PROGRAMS)'; for p in $$list; do \ +# $(top_srcdir)/scripts/run_valgrind.sh ./$$p; \ +# done + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/examples/Makefile.am b/vendor/unuran-1.11.0/examples/Makefile.am new file mode 100644 index 0000000..fb6ce67 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/Makefile.am @@ -0,0 +1,60 @@ +## Process this file with automake to produce Makefile.in + +AM_CPPFLAGS = \ + $(UNURAN_SUPPORTS_GSL) \ + $(UNURAN_SUPPORTS_PRNG) \ + $(UNURAN_SUPPORTS_RNGSTREAM) \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/uniform + +AM_LDFLAGS = \ + -L$(top_builddir)/src + +LDADD = \ + $(top_builddir)/src/libunuran.la + +EXAMPLES = \ + example0 example0_str \ + example1 example1_str \ + example2 example2_str \ + example3 example3_str \ + example_reinit \ + example_cext \ + example_cont example_cont_str \ + example_dext \ + example_discr example_discr_str \ + example_emp example_emp_str \ + example_vemp \ + example_FuncStr \ + example_mcorr \ + example_mixt example_mixt_inv \ + example_cpp \ + example_gsl \ + example_rngstreams \ + example_prng example_prng_str \ + example_anti example_anti_str \ + example_errorhandler + +example_cpp_SOURCES = example_cpp.cpp + +check_PROGRAMS = $(EXAMPLES) + +TESTS = $(EXAMPLES) + +# run tests with valgrind +if HAVE_VALGRIND +valgrind: $(check_PROGRAMS) + @list='$(check_PROGRAMS)'; for p in $$list; do \ + $(top_srcdir)/scripts/run_valgrind.sh ./$$p; \ + done +endif + +# clean log files and backup files +CLEANFILES = \ + unuran.log \ + valgrind-* \ + *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/vendor/unuran-1.11.0/examples/Makefile.in b/vendor/unuran-1.11.0/examples/Makefile.in new file mode 100644 index 0000000..cede257 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/Makefile.in @@ -0,0 +1,1642 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +check_PROGRAMS = $(am__EXEEXT_1) +TESTS = $(am__EXEEXT_1) +subdir = examples +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__EXEEXT_1 = example0$(EXEEXT) example0_str$(EXEEXT) \ + example1$(EXEEXT) example1_str$(EXEEXT) example2$(EXEEXT) \ + example2_str$(EXEEXT) example3$(EXEEXT) example3_str$(EXEEXT) \ + example_reinit$(EXEEXT) example_cext$(EXEEXT) \ + example_cont$(EXEEXT) example_cont_str$(EXEEXT) \ + example_dext$(EXEEXT) example_discr$(EXEEXT) \ + example_discr_str$(EXEEXT) example_emp$(EXEEXT) \ + example_emp_str$(EXEEXT) example_vemp$(EXEEXT) \ + example_FuncStr$(EXEEXT) example_mcorr$(EXEEXT) \ + example_mixt$(EXEEXT) example_mixt_inv$(EXEEXT) \ + example_cpp$(EXEEXT) example_gsl$(EXEEXT) \ + example_rngstreams$(EXEEXT) example_prng$(EXEEXT) \ + example_prng_str$(EXEEXT) example_anti$(EXEEXT) \ + example_anti_str$(EXEEXT) example_errorhandler$(EXEEXT) +example0_SOURCES = example0.c +example0_OBJECTS = example0.$(OBJEXT) +example0_LDADD = $(LDADD) +example0_DEPENDENCIES = $(top_builddir)/src/libunuran.la +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +example0_str_SOURCES = example0_str.c +example0_str_OBJECTS = example0_str.$(OBJEXT) +example0_str_LDADD = $(LDADD) +example0_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example1_SOURCES = example1.c +example1_OBJECTS = example1.$(OBJEXT) +example1_LDADD = $(LDADD) +example1_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example1_str_SOURCES = example1_str.c +example1_str_OBJECTS = example1_str.$(OBJEXT) +example1_str_LDADD = $(LDADD) +example1_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example2_SOURCES = example2.c +example2_OBJECTS = example2.$(OBJEXT) +example2_LDADD = $(LDADD) +example2_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example2_str_SOURCES = example2_str.c +example2_str_OBJECTS = example2_str.$(OBJEXT) +example2_str_LDADD = $(LDADD) +example2_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example3_SOURCES = example3.c +example3_OBJECTS = example3.$(OBJEXT) +example3_LDADD = $(LDADD) +example3_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example3_str_SOURCES = example3_str.c +example3_str_OBJECTS = example3_str.$(OBJEXT) +example3_str_LDADD = $(LDADD) +example3_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_FuncStr_SOURCES = example_FuncStr.c +example_FuncStr_OBJECTS = example_FuncStr.$(OBJEXT) +example_FuncStr_LDADD = $(LDADD) +example_FuncStr_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_anti_SOURCES = example_anti.c +example_anti_OBJECTS = example_anti.$(OBJEXT) +example_anti_LDADD = $(LDADD) +example_anti_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_anti_str_SOURCES = example_anti_str.c +example_anti_str_OBJECTS = example_anti_str.$(OBJEXT) +example_anti_str_LDADD = $(LDADD) +example_anti_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_cext_SOURCES = example_cext.c +example_cext_OBJECTS = example_cext.$(OBJEXT) +example_cext_LDADD = $(LDADD) +example_cext_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_cont_SOURCES = example_cont.c +example_cont_OBJECTS = example_cont.$(OBJEXT) +example_cont_LDADD = $(LDADD) +example_cont_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_cont_str_SOURCES = example_cont_str.c +example_cont_str_OBJECTS = example_cont_str.$(OBJEXT) +example_cont_str_LDADD = $(LDADD) +example_cont_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la +am_example_cpp_OBJECTS = example_cpp.$(OBJEXT) +example_cpp_OBJECTS = $(am_example_cpp_OBJECTS) +example_cpp_LDADD = $(LDADD) +example_cpp_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_dext_SOURCES = example_dext.c +example_dext_OBJECTS = example_dext.$(OBJEXT) +example_dext_LDADD = $(LDADD) +example_dext_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_discr_SOURCES = example_discr.c +example_discr_OBJECTS = example_discr.$(OBJEXT) +example_discr_LDADD = $(LDADD) +example_discr_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_discr_str_SOURCES = example_discr_str.c +example_discr_str_OBJECTS = example_discr_str.$(OBJEXT) +example_discr_str_LDADD = $(LDADD) +example_discr_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_emp_SOURCES = example_emp.c +example_emp_OBJECTS = example_emp.$(OBJEXT) +example_emp_LDADD = $(LDADD) +example_emp_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_emp_str_SOURCES = example_emp_str.c +example_emp_str_OBJECTS = example_emp_str.$(OBJEXT) +example_emp_str_LDADD = $(LDADD) +example_emp_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_errorhandler_SOURCES = example_errorhandler.c +example_errorhandler_OBJECTS = example_errorhandler.$(OBJEXT) +example_errorhandler_LDADD = $(LDADD) +example_errorhandler_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_gsl_SOURCES = example_gsl.c +example_gsl_OBJECTS = example_gsl.$(OBJEXT) +example_gsl_LDADD = $(LDADD) +example_gsl_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_mcorr_SOURCES = example_mcorr.c +example_mcorr_OBJECTS = example_mcorr.$(OBJEXT) +example_mcorr_LDADD = $(LDADD) +example_mcorr_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_mixt_SOURCES = example_mixt.c +example_mixt_OBJECTS = example_mixt.$(OBJEXT) +example_mixt_LDADD = $(LDADD) +example_mixt_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_mixt_inv_SOURCES = example_mixt_inv.c +example_mixt_inv_OBJECTS = example_mixt_inv.$(OBJEXT) +example_mixt_inv_LDADD = $(LDADD) +example_mixt_inv_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_prng_SOURCES = example_prng.c +example_prng_OBJECTS = example_prng.$(OBJEXT) +example_prng_LDADD = $(LDADD) +example_prng_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_prng_str_SOURCES = example_prng_str.c +example_prng_str_OBJECTS = example_prng_str.$(OBJEXT) +example_prng_str_LDADD = $(LDADD) +example_prng_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_reinit_SOURCES = example_reinit.c +example_reinit_OBJECTS = example_reinit.$(OBJEXT) +example_reinit_LDADD = $(LDADD) +example_reinit_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_rngstreams_SOURCES = example_rngstreams.c +example_rngstreams_OBJECTS = example_rngstreams.$(OBJEXT) +example_rngstreams_LDADD = $(LDADD) +example_rngstreams_DEPENDENCIES = $(top_builddir)/src/libunuran.la +example_vemp_SOURCES = example_vemp.c +example_vemp_OBJECTS = example_vemp.$(OBJEXT) +example_vemp_LDADD = $(LDADD) +example_vemp_DEPENDENCIES = $(top_builddir)/src/libunuran.la +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/example0.Po \ + ./$(DEPDIR)/example0_str.Po ./$(DEPDIR)/example1.Po \ + ./$(DEPDIR)/example1_str.Po ./$(DEPDIR)/example2.Po \ + ./$(DEPDIR)/example2_str.Po ./$(DEPDIR)/example3.Po \ + ./$(DEPDIR)/example3_str.Po ./$(DEPDIR)/example_FuncStr.Po \ + ./$(DEPDIR)/example_anti.Po ./$(DEPDIR)/example_anti_str.Po \ + ./$(DEPDIR)/example_cext.Po ./$(DEPDIR)/example_cont.Po \ + ./$(DEPDIR)/example_cont_str.Po ./$(DEPDIR)/example_cpp.Po \ + ./$(DEPDIR)/example_dext.Po ./$(DEPDIR)/example_discr.Po \ + ./$(DEPDIR)/example_discr_str.Po ./$(DEPDIR)/example_emp.Po \ + ./$(DEPDIR)/example_emp_str.Po \ + ./$(DEPDIR)/example_errorhandler.Po ./$(DEPDIR)/example_gsl.Po \ + ./$(DEPDIR)/example_mcorr.Po ./$(DEPDIR)/example_mixt.Po \ + ./$(DEPDIR)/example_mixt_inv.Po ./$(DEPDIR)/example_prng.Po \ + ./$(DEPDIR)/example_prng_str.Po ./$(DEPDIR)/example_reinit.Po \ + ./$(DEPDIR)/example_rngstreams.Po ./$(DEPDIR)/example_vemp.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = example0.c example0_str.c example1.c example1_str.c \ + example2.c example2_str.c example3.c example3_str.c \ + example_FuncStr.c example_anti.c example_anti_str.c \ + example_cext.c example_cont.c example_cont_str.c \ + $(example_cpp_SOURCES) example_dext.c example_discr.c \ + example_discr_str.c example_emp.c example_emp_str.c \ + example_errorhandler.c example_gsl.c example_mcorr.c \ + example_mixt.c example_mixt_inv.c example_prng.c \ + example_prng_str.c example_reinit.c example_rngstreams.c \ + example_vemp.c +DIST_SOURCES = example0.c example0_str.c example1.c example1_str.c \ + example2.c example2_str.c example3.c example3_str.c \ + example_FuncStr.c example_anti.c example_anti_str.c \ + example_cext.c example_cont.c example_cont_str.c \ + $(example_cpp_SOURCES) example_dext.c example_discr.c \ + example_discr_str.c example_emp.c example_emp_str.c \ + example_errorhandler.c example_gsl.c example_mcorr.c \ + example_mixt.c example_mixt_inv.c example_prng.c \ + example_prng_str.c example_reinit.c example_rngstreams.c \ + example_vemp.c +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' +RECHECK_LOGS = $(TEST_LOGS) +AM_RECURSIVE_TARGETS = check recheck +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/autoconf/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/autoconf/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp \ + $(top_srcdir)/autoconf/test-driver +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ +UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ +UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ +UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_valgrind = @have_valgrind@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = \ + $(UNURAN_SUPPORTS_GSL) \ + $(UNURAN_SUPPORTS_PRNG) \ + $(UNURAN_SUPPORTS_RNGSTREAM) \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/uniform + +AM_LDFLAGS = \ + -L$(top_builddir)/src + +LDADD = \ + $(top_builddir)/src/libunuran.la + +EXAMPLES = \ + example0 example0_str \ + example1 example1_str \ + example2 example2_str \ + example3 example3_str \ + example_reinit \ + example_cext \ + example_cont example_cont_str \ + example_dext \ + example_discr example_discr_str \ + example_emp example_emp_str \ + example_vemp \ + example_FuncStr \ + example_mcorr \ + example_mixt example_mixt_inv \ + example_cpp \ + example_gsl \ + example_rngstreams \ + example_prng example_prng_str \ + example_anti example_anti_str \ + example_errorhandler + +example_cpp_SOURCES = example_cpp.cpp + +# clean log files and backup files +CLEANFILES = \ + unuran.log \ + valgrind-* \ + *~ + + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .cpp .lo .log .o .obj .test .test$(EXEEXT) .trs +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign examples/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +example0$(EXEEXT): $(example0_OBJECTS) $(example0_DEPENDENCIES) $(EXTRA_example0_DEPENDENCIES) + @rm -f example0$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example0_OBJECTS) $(example0_LDADD) $(LIBS) + +example0_str$(EXEEXT): $(example0_str_OBJECTS) $(example0_str_DEPENDENCIES) $(EXTRA_example0_str_DEPENDENCIES) + @rm -f example0_str$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example0_str_OBJECTS) $(example0_str_LDADD) $(LIBS) + +example1$(EXEEXT): $(example1_OBJECTS) $(example1_DEPENDENCIES) $(EXTRA_example1_DEPENDENCIES) + @rm -f example1$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example1_OBJECTS) $(example1_LDADD) $(LIBS) + +example1_str$(EXEEXT): $(example1_str_OBJECTS) $(example1_str_DEPENDENCIES) $(EXTRA_example1_str_DEPENDENCIES) + @rm -f example1_str$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example1_str_OBJECTS) $(example1_str_LDADD) $(LIBS) + +example2$(EXEEXT): $(example2_OBJECTS) $(example2_DEPENDENCIES) $(EXTRA_example2_DEPENDENCIES) + @rm -f example2$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example2_OBJECTS) $(example2_LDADD) $(LIBS) + +example2_str$(EXEEXT): $(example2_str_OBJECTS) $(example2_str_DEPENDENCIES) $(EXTRA_example2_str_DEPENDENCIES) + @rm -f example2_str$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example2_str_OBJECTS) $(example2_str_LDADD) $(LIBS) + +example3$(EXEEXT): $(example3_OBJECTS) $(example3_DEPENDENCIES) $(EXTRA_example3_DEPENDENCIES) + @rm -f example3$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example3_OBJECTS) $(example3_LDADD) $(LIBS) + +example3_str$(EXEEXT): $(example3_str_OBJECTS) $(example3_str_DEPENDENCIES) $(EXTRA_example3_str_DEPENDENCIES) + @rm -f example3_str$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example3_str_OBJECTS) $(example3_str_LDADD) $(LIBS) + +example_FuncStr$(EXEEXT): $(example_FuncStr_OBJECTS) $(example_FuncStr_DEPENDENCIES) $(EXTRA_example_FuncStr_DEPENDENCIES) + @rm -f example_FuncStr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_FuncStr_OBJECTS) $(example_FuncStr_LDADD) $(LIBS) + +example_anti$(EXEEXT): $(example_anti_OBJECTS) $(example_anti_DEPENDENCIES) $(EXTRA_example_anti_DEPENDENCIES) + @rm -f example_anti$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_anti_OBJECTS) $(example_anti_LDADD) $(LIBS) + +example_anti_str$(EXEEXT): $(example_anti_str_OBJECTS) $(example_anti_str_DEPENDENCIES) $(EXTRA_example_anti_str_DEPENDENCIES) + @rm -f example_anti_str$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_anti_str_OBJECTS) $(example_anti_str_LDADD) $(LIBS) + +example_cext$(EXEEXT): $(example_cext_OBJECTS) $(example_cext_DEPENDENCIES) $(EXTRA_example_cext_DEPENDENCIES) + @rm -f example_cext$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_cext_OBJECTS) $(example_cext_LDADD) $(LIBS) + +example_cont$(EXEEXT): $(example_cont_OBJECTS) $(example_cont_DEPENDENCIES) $(EXTRA_example_cont_DEPENDENCIES) + @rm -f example_cont$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_cont_OBJECTS) $(example_cont_LDADD) $(LIBS) + +example_cont_str$(EXEEXT): $(example_cont_str_OBJECTS) $(example_cont_str_DEPENDENCIES) $(EXTRA_example_cont_str_DEPENDENCIES) + @rm -f example_cont_str$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_cont_str_OBJECTS) $(example_cont_str_LDADD) $(LIBS) + +example_cpp$(EXEEXT): $(example_cpp_OBJECTS) $(example_cpp_DEPENDENCIES) $(EXTRA_example_cpp_DEPENDENCIES) + @rm -f example_cpp$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(example_cpp_OBJECTS) $(example_cpp_LDADD) $(LIBS) + +example_dext$(EXEEXT): $(example_dext_OBJECTS) $(example_dext_DEPENDENCIES) $(EXTRA_example_dext_DEPENDENCIES) + @rm -f example_dext$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_dext_OBJECTS) $(example_dext_LDADD) $(LIBS) + +example_discr$(EXEEXT): $(example_discr_OBJECTS) $(example_discr_DEPENDENCIES) $(EXTRA_example_discr_DEPENDENCIES) + @rm -f example_discr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_discr_OBJECTS) $(example_discr_LDADD) $(LIBS) + +example_discr_str$(EXEEXT): $(example_discr_str_OBJECTS) $(example_discr_str_DEPENDENCIES) $(EXTRA_example_discr_str_DEPENDENCIES) + @rm -f example_discr_str$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_discr_str_OBJECTS) $(example_discr_str_LDADD) $(LIBS) + +example_emp$(EXEEXT): $(example_emp_OBJECTS) $(example_emp_DEPENDENCIES) $(EXTRA_example_emp_DEPENDENCIES) + @rm -f example_emp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_emp_OBJECTS) $(example_emp_LDADD) $(LIBS) + +example_emp_str$(EXEEXT): $(example_emp_str_OBJECTS) $(example_emp_str_DEPENDENCIES) $(EXTRA_example_emp_str_DEPENDENCIES) + @rm -f example_emp_str$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_emp_str_OBJECTS) $(example_emp_str_LDADD) $(LIBS) + +example_errorhandler$(EXEEXT): $(example_errorhandler_OBJECTS) $(example_errorhandler_DEPENDENCIES) $(EXTRA_example_errorhandler_DEPENDENCIES) + @rm -f example_errorhandler$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_errorhandler_OBJECTS) $(example_errorhandler_LDADD) $(LIBS) + +example_gsl$(EXEEXT): $(example_gsl_OBJECTS) $(example_gsl_DEPENDENCIES) $(EXTRA_example_gsl_DEPENDENCIES) + @rm -f example_gsl$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_gsl_OBJECTS) $(example_gsl_LDADD) $(LIBS) + +example_mcorr$(EXEEXT): $(example_mcorr_OBJECTS) $(example_mcorr_DEPENDENCIES) $(EXTRA_example_mcorr_DEPENDENCIES) + @rm -f example_mcorr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_mcorr_OBJECTS) $(example_mcorr_LDADD) $(LIBS) + +example_mixt$(EXEEXT): $(example_mixt_OBJECTS) $(example_mixt_DEPENDENCIES) $(EXTRA_example_mixt_DEPENDENCIES) + @rm -f example_mixt$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_mixt_OBJECTS) $(example_mixt_LDADD) $(LIBS) + +example_mixt_inv$(EXEEXT): $(example_mixt_inv_OBJECTS) $(example_mixt_inv_DEPENDENCIES) $(EXTRA_example_mixt_inv_DEPENDENCIES) + @rm -f example_mixt_inv$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_mixt_inv_OBJECTS) $(example_mixt_inv_LDADD) $(LIBS) + +example_prng$(EXEEXT): $(example_prng_OBJECTS) $(example_prng_DEPENDENCIES) $(EXTRA_example_prng_DEPENDENCIES) + @rm -f example_prng$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_prng_OBJECTS) $(example_prng_LDADD) $(LIBS) + +example_prng_str$(EXEEXT): $(example_prng_str_OBJECTS) $(example_prng_str_DEPENDENCIES) $(EXTRA_example_prng_str_DEPENDENCIES) + @rm -f example_prng_str$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_prng_str_OBJECTS) $(example_prng_str_LDADD) $(LIBS) + +example_reinit$(EXEEXT): $(example_reinit_OBJECTS) $(example_reinit_DEPENDENCIES) $(EXTRA_example_reinit_DEPENDENCIES) + @rm -f example_reinit$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_reinit_OBJECTS) $(example_reinit_LDADD) $(LIBS) + +example_rngstreams$(EXEEXT): $(example_rngstreams_OBJECTS) $(example_rngstreams_DEPENDENCIES) $(EXTRA_example_rngstreams_DEPENDENCIES) + @rm -f example_rngstreams$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_rngstreams_OBJECTS) $(example_rngstreams_LDADD) $(LIBS) + +example_vemp$(EXEEXT): $(example_vemp_OBJECTS) $(example_vemp_DEPENDENCIES) $(EXTRA_example_vemp_DEPENDENCIES) + @rm -f example_vemp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(example_vemp_OBJECTS) $(example_vemp_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example0.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example0_str.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example1.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example1_str.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example2.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example2_str.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example3.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example3_str.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_FuncStr.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_anti.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_anti_str.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_cext.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_cont.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_cont_str.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_cpp.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_dext.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_discr.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_discr_str.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_emp.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_emp_str.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_errorhandler.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_gsl.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_mcorr.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_mixt.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_mixt_inv.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_prng.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_prng_str.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_reinit.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_rngstreams.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_vemp.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +.cpp.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: $(check_PROGRAMS) + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_PROGRAMS) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +example0.log: example0$(EXEEXT) + @p='example0$(EXEEXT)'; \ + b='example0'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example0_str.log: example0_str$(EXEEXT) + @p='example0_str$(EXEEXT)'; \ + b='example0_str'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example1.log: example1$(EXEEXT) + @p='example1$(EXEEXT)'; \ + b='example1'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example1_str.log: example1_str$(EXEEXT) + @p='example1_str$(EXEEXT)'; \ + b='example1_str'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example2.log: example2$(EXEEXT) + @p='example2$(EXEEXT)'; \ + b='example2'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example2_str.log: example2_str$(EXEEXT) + @p='example2_str$(EXEEXT)'; \ + b='example2_str'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example3.log: example3$(EXEEXT) + @p='example3$(EXEEXT)'; \ + b='example3'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example3_str.log: example3_str$(EXEEXT) + @p='example3_str$(EXEEXT)'; \ + b='example3_str'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_reinit.log: example_reinit$(EXEEXT) + @p='example_reinit$(EXEEXT)'; \ + b='example_reinit'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_cext.log: example_cext$(EXEEXT) + @p='example_cext$(EXEEXT)'; \ + b='example_cext'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_cont.log: example_cont$(EXEEXT) + @p='example_cont$(EXEEXT)'; \ + b='example_cont'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_cont_str.log: example_cont_str$(EXEEXT) + @p='example_cont_str$(EXEEXT)'; \ + b='example_cont_str'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_dext.log: example_dext$(EXEEXT) + @p='example_dext$(EXEEXT)'; \ + b='example_dext'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_discr.log: example_discr$(EXEEXT) + @p='example_discr$(EXEEXT)'; \ + b='example_discr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_discr_str.log: example_discr_str$(EXEEXT) + @p='example_discr_str$(EXEEXT)'; \ + b='example_discr_str'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_emp.log: example_emp$(EXEEXT) + @p='example_emp$(EXEEXT)'; \ + b='example_emp'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_emp_str.log: example_emp_str$(EXEEXT) + @p='example_emp_str$(EXEEXT)'; \ + b='example_emp_str'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_vemp.log: example_vemp$(EXEEXT) + @p='example_vemp$(EXEEXT)'; \ + b='example_vemp'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_FuncStr.log: example_FuncStr$(EXEEXT) + @p='example_FuncStr$(EXEEXT)'; \ + b='example_FuncStr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_mcorr.log: example_mcorr$(EXEEXT) + @p='example_mcorr$(EXEEXT)'; \ + b='example_mcorr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_mixt.log: example_mixt$(EXEEXT) + @p='example_mixt$(EXEEXT)'; \ + b='example_mixt'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_mixt_inv.log: example_mixt_inv$(EXEEXT) + @p='example_mixt_inv$(EXEEXT)'; \ + b='example_mixt_inv'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_cpp.log: example_cpp$(EXEEXT) + @p='example_cpp$(EXEEXT)'; \ + b='example_cpp'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_gsl.log: example_gsl$(EXEEXT) + @p='example_gsl$(EXEEXT)'; \ + b='example_gsl'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_rngstreams.log: example_rngstreams$(EXEEXT) + @p='example_rngstreams$(EXEEXT)'; \ + b='example_rngstreams'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_prng.log: example_prng$(EXEEXT) + @p='example_prng$(EXEEXT)'; \ + b='example_prng'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_prng_str.log: example_prng_str$(EXEEXT) + @p='example_prng_str$(EXEEXT)'; \ + b='example_prng_str'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_anti.log: example_anti$(EXEEXT) + @p='example_anti$(EXEEXT)'; \ + b='example_anti'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_anti_str.log: example_anti_str$(EXEEXT) + @p='example_anti_str$(EXEEXT)'; \ + b='example_anti_str'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +example_errorhandler.log: example_errorhandler$(EXEEXT) + @p='example_errorhandler$(EXEEXT)'; \ + b='example_errorhandler'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/example0.Po + -rm -f ./$(DEPDIR)/example0_str.Po + -rm -f ./$(DEPDIR)/example1.Po + -rm -f ./$(DEPDIR)/example1_str.Po + -rm -f ./$(DEPDIR)/example2.Po + -rm -f ./$(DEPDIR)/example2_str.Po + -rm -f ./$(DEPDIR)/example3.Po + -rm -f ./$(DEPDIR)/example3_str.Po + -rm -f ./$(DEPDIR)/example_FuncStr.Po + -rm -f ./$(DEPDIR)/example_anti.Po + -rm -f ./$(DEPDIR)/example_anti_str.Po + -rm -f ./$(DEPDIR)/example_cext.Po + -rm -f ./$(DEPDIR)/example_cont.Po + -rm -f ./$(DEPDIR)/example_cont_str.Po + -rm -f ./$(DEPDIR)/example_cpp.Po + -rm -f ./$(DEPDIR)/example_dext.Po + -rm -f ./$(DEPDIR)/example_discr.Po + -rm -f ./$(DEPDIR)/example_discr_str.Po + -rm -f ./$(DEPDIR)/example_emp.Po + -rm -f ./$(DEPDIR)/example_emp_str.Po + -rm -f ./$(DEPDIR)/example_errorhandler.Po + -rm -f ./$(DEPDIR)/example_gsl.Po + -rm -f ./$(DEPDIR)/example_mcorr.Po + -rm -f ./$(DEPDIR)/example_mixt.Po + -rm -f ./$(DEPDIR)/example_mixt_inv.Po + -rm -f ./$(DEPDIR)/example_prng.Po + -rm -f ./$(DEPDIR)/example_prng_str.Po + -rm -f ./$(DEPDIR)/example_reinit.Po + -rm -f ./$(DEPDIR)/example_rngstreams.Po + -rm -f ./$(DEPDIR)/example_vemp.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/example0.Po + -rm -f ./$(DEPDIR)/example0_str.Po + -rm -f ./$(DEPDIR)/example1.Po + -rm -f ./$(DEPDIR)/example1_str.Po + -rm -f ./$(DEPDIR)/example2.Po + -rm -f ./$(DEPDIR)/example2_str.Po + -rm -f ./$(DEPDIR)/example3.Po + -rm -f ./$(DEPDIR)/example3_str.Po + -rm -f ./$(DEPDIR)/example_FuncStr.Po + -rm -f ./$(DEPDIR)/example_anti.Po + -rm -f ./$(DEPDIR)/example_anti_str.Po + -rm -f ./$(DEPDIR)/example_cext.Po + -rm -f ./$(DEPDIR)/example_cont.Po + -rm -f ./$(DEPDIR)/example_cont_str.Po + -rm -f ./$(DEPDIR)/example_cpp.Po + -rm -f ./$(DEPDIR)/example_dext.Po + -rm -f ./$(DEPDIR)/example_discr.Po + -rm -f ./$(DEPDIR)/example_discr_str.Po + -rm -f ./$(DEPDIR)/example_emp.Po + -rm -f ./$(DEPDIR)/example_emp_str.Po + -rm -f ./$(DEPDIR)/example_errorhandler.Po + -rm -f ./$(DEPDIR)/example_gsl.Po + -rm -f ./$(DEPDIR)/example_mcorr.Po + -rm -f ./$(DEPDIR)/example_mixt.Po + -rm -f ./$(DEPDIR)/example_mixt_inv.Po + -rm -f ./$(DEPDIR)/example_prng.Po + -rm -f ./$(DEPDIR)/example_prng_str.Po + -rm -f ./$(DEPDIR)/example_reinit.Po + -rm -f ./$(DEPDIR)/example_rngstreams.Po + -rm -f ./$(DEPDIR)/example_vemp.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ + check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + recheck tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# run tests with valgrind +@HAVE_VALGRIND_TRUE@valgrind: $(check_PROGRAMS) +@HAVE_VALGRIND_TRUE@ @list='$(check_PROGRAMS)'; for p in $$list; do \ +@HAVE_VALGRIND_TRUE@ $(top_srcdir)/scripts/run_valgrind.sh ./$$p; \ +@HAVE_VALGRIND_TRUE@ done + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/examples/example0.c b/vendor/unuran-1.11.0/examples/example0.c new file mode 100644 index 0000000..f69b7b9 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example0.c @@ -0,0 +1,69 @@ +/* ------------------------------------------------------------- */ +/* File: example0.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use a predefined standard distribution: */ + /* Gaussian with mean zero and standard deviation 1. */ + /* Since this is the standard form of the distribution, */ + /* we need not give these parameters. */ + distr = unur_distr_normal(NULL, 0); + + /* Use method AUTO: */ + /* Let UNURAN select a suitable method for you. */ + par = unur_auto_new(distr); + + /* Now you can change some of the default settings for the */ + /* parameters of the chosen method. We don't do it here. */ + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ + diff --git a/vendor/unuran-1.11.0/examples/example0_str.c b/vendor/unuran-1.11.0/examples/example0_str.c new file mode 100644 index 0000000..e9ad98d --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example0_str.c @@ -0,0 +1,52 @@ +/* ------------------------------------------------------------- */ +/* File: example0_str.c */ +/* ------------------------------------------------------------- */ +/* String API. */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a predefined standard distribution: */ + /* Standard Gaussian distribution. */ + /* Use method AUTO: */ + /* Let UNURAN select a suitable method for you. */ + gen = unur_str2gen("normal()"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ + diff --git a/vendor/unuran-1.11.0/examples/example1.c b/vendor/unuran-1.11.0/examples/example1.c new file mode 100644 index 0000000..8bd2b57 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example1.c @@ -0,0 +1,70 @@ +/* ------------------------------------------------------------- */ +/* File: example1.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use a predefined standard distribution: */ + /* Gaussian with mean zero and standard deviation 1. */ + /* Since this is the standard form of the distribution, */ + /* we need not give these parameters. */ + distr = unur_distr_normal(NULL, 0); + + /* Choose a method: AROU. */ + /* For other (suitable) methods replace "arou" with the */ + /* respective name (in lower case letters). */ + par = unur_arou_new(distr); + + /* Now you can change some of the default settings for the */ + /* parameters of the chosen method. We don't do it here. */ + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ + diff --git a/vendor/unuran-1.11.0/examples/example1_str.c b/vendor/unuran-1.11.0/examples/example1_str.c new file mode 100644 index 0000000..fedd3ba --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example1_str.c @@ -0,0 +1,53 @@ +/* ------------------------------------------------------------- */ +/* File: example1_str.c */ +/* ------------------------------------------------------------- */ +/* String API. */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a predefined standard distribution: */ + /* Standard Gaussian distribution. */ + /* Choose a method: AROU. */ + /* For other (suitable) methods replace "arou" with the */ + /* respective name. */ + gen = unur_str2gen("normal() & method=arou"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ + diff --git a/vendor/unuran-1.11.0/examples/example2.c b/vendor/unuran-1.11.0/examples/example2.c new file mode 100644 index 0000000..1df5612 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example2.c @@ -0,0 +1,115 @@ +/* ------------------------------------------------------------- */ +/* File: example2.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* In this example we build a distribution object from scratch */ +/* and sample from this distribution. */ +/* */ +/* We use method TDR (Transformed Density Rejection) which */ +/* required a PDF and the derivative of the PDF. */ + +/* ------------------------------------------------------------- */ + +/* Define the PDF and dPDF of our distribution. */ +/* */ +/* Our distribution has the PDF */ +/* */ +/* / 1 - x*x if |x| <= 1 */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ + +/* The PDF of our distribution: */ +double mypdf( double x, const UNUR_DISTR *distr ) + /* The second argument (`distr') can be used for parameters */ + /* for the PDF. (We do not use parameters in our example.) */ +{ + if (fabs(x) >= 1.) + return 0.; + else + return (1.-x*x); +} /* end of mypdf() */ + +/* The derivative of the PDF of our distribution: */ +double mydpdf( double x, const UNUR_DISTR *distr ) +{ + if (fabs(x) >= 1.) + return 0.; + else + return (-2.*x); +} /* end of mydpdf() */ + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create a new distribution object from scratch. */ + /* It is a continuous distribution, and we need a PDF and the */ + /* derivative of the PDF. Moreover we set the domain. */ + + /* Get empty distribution object for a continuous distribution */ + distr = unur_distr_cont_new(); + + /* Assign the PDF and dPDF (defined above). */ + unur_distr_cont_set_pdf( distr, mypdf ); + unur_distr_cont_set_dpdf( distr, mydpdf ); + + /* Set the domain of the distribution (optional for TDR). */ + unur_distr_cont_set_domain( distr, -1., 1. ); + + /* Choose a method: TDR. */ + par = unur_tdr_new(distr); + + /* Now you can change some of the default settings for the */ + /* parameters of the chosen method. We don't do it here. */ + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ + + diff --git a/vendor/unuran-1.11.0/examples/example2_str.c b/vendor/unuran-1.11.0/examples/example2_str.c new file mode 100644 index 0000000..84ad7fd --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example2_str.c @@ -0,0 +1,65 @@ +/* ------------------------------------------------------------- */ +/* File: example2_str.c */ +/* ------------------------------------------------------------- */ +/* String API. */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* In this example we use a generic distribution object */ +/* and sample from this distribution. */ +/* */ +/* The PDF of our distribution is given by */ +/* */ +/* / 1 - x*x if |x| <= 1 */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ +/* We use method TDR (Transformed Density Rejection) which */ +/* required a PDF and the derivative of the PDF. */ + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a generic continuous distribution. */ + /* Choose a method: TDR. */ + gen = unur_str2gen( + "distr = cont; pdf=\"1-x*x\"; domain=(-1,1) & method=tdr"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ + + diff --git a/vendor/unuran-1.11.0/examples/example3.c b/vendor/unuran-1.11.0/examples/example3.c new file mode 100644 index 0000000..d22fc5b --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example3.c @@ -0,0 +1,86 @@ +/* ------------------------------------------------------------- */ +/* File: example3.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + double fparams[2]; /* array for parameters for distribution */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use a predefined standard distribution: */ + /* Gaussian with mean 2. and standard deviation 0.5. */ + fparams[0] = 2.; + fparams[1] = 0.5; + distr = unur_distr_normal( fparams, 2 ); + + /* Choose a method: TDR. */ + par = unur_tdr_new(distr); + + /* Change some of the default parameters. */ + + /* We want to use T(x)=log(x) for the transformation. */ + unur_tdr_set_c( par, 0. ); + + /* We want to have the variant with immediate acceptance. */ + unur_tdr_set_variant_ia( par ); + + /* We want to use 10 construction points for the setup */ + unur_tdr_set_cpoints ( par, 10, NULL ); + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* It is possible with method TDR to truncate the distribution */ + /* for an existing generator object ... */ + unur_tdr_chg_truncated( gen, -1., 0. ); + + /* ... and sample again. */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/examples/example3_str.c b/vendor/unuran-1.11.0/examples/example3_str.c new file mode 100644 index 0000000..c336c03 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example3_str.c @@ -0,0 +1,63 @@ +/* ------------------------------------------------------------- */ +/* File: example3_str.c */ +/* ------------------------------------------------------------- */ +/* String API. */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a predefined standard distribution: */ + /* Gaussian with mean 2. and standard deviation 0.5. */ + /* Choose a method: TDR with parameters */ + /* c = 0: use T(x)=log(x) for the transformation; */ + /* variant "immediate acceptance"; */ + /* number of construction points = 10. */ + gen = unur_str2gen( + "normal(2,0.5) & method=tdr; c=0.; variant_ia; cpoints=10"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* It is possible with method TDR to truncate the distribution */ + /* for an existing generator object ... */ + unur_tdr_chg_truncated( gen, -1., 0. ); + + /* ... and sample again. */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/examples/example_FuncStr.c b/vendor/unuran-1.11.0/examples/example_FuncStr.c new file mode 100644 index 0000000..281868b --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_FuncStr.c @@ -0,0 +1,39 @@ +/* ------------------------------------------------------------- */ +/* File: example_FuncStr.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* Example how to define the PDF for a continuous univariate */ +/* distribution using a function string. */ + +/* ------------------------------------------------------------- */ + +int main(void) +{ + UNUR_DISTR *distr; /* distribution object */ + char *pdfstr; + + /* Get empty distribution object for a continuous distribution */ + distr = unur_distr_cont_new(); + + /* Set PDF using function string */ + unur_distr_cont_set_pdfstr(distr,"1-x*x"); + unur_distr_cont_set_domain(distr,-1.,1.); + + /* Read function string from distribution object */ + pdfstr = unur_distr_cont_get_pdfstr(distr); + printf("functionstring: %s\n",pdfstr); + + /* Destroy distribution object and clear memory */ + unur_distr_free(distr); + free (pdfstr); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/examples/example_anti.c b/vendor/unuran-1.11.0/examples/example_anti.c new file mode 100644 index 0000000..ad60ac1 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_anti.c @@ -0,0 +1,153 @@ +/* ------------------------------------------------------------- */ +/* File: example_anti.c */ +/* ------------------------------------------------------------- */ +#ifdef UNURAN_SUPPORTS_PRNG +/* ------------------------------------------------------------- */ +/* This example makes use of the PRNG library for generating */ +/* uniform random numbers. */ +/* (see http://statmath.wu.ac.at/prng/) */ +/* To compile this example you must have set */ +/* ./configure --with-urng-prng */ +/* (Of course the executable has to be linked against the */ +/* PRNG library.) */ +/* ------------------------------------------------------------- */ + +/* Example how to sample from two streams of antithetic random */ +/* variates from Gaussian N(2,5) and Gamma(4) distribution, resp.*/ + +/* ------------------------------------------------------------- */ + +/* Include UNURAN header files. */ +#include +#include + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double xn, xg; /* will hold the random number */ + double fparams[2]; /* array for parameters for distribution */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen_normal, *gen_gamma; + /* generator objects */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng1, *urng2; /* uniform generator objects */ + + /* PRNG only: */ + /* Make a object for uniform random number generator. */ + /* For details see http://statmath.wu.ac.at/prng/. */ + + + /* The first generator: Gaussian N(2,5) */ + + /* uniform generator: We use the Mersenne Twister. */ + urng1 = unur_urng_prng_new("mt19937(1237)"); + if (urng1 == NULL) exit (EXIT_FAILURE); + + /* UNURAN generator object for N(2,5) */ + fparams[0] = 2.; + fparams[1] = 5.; + distr = unur_distr_normal( fparams, 2 ); + + /* Choose method TDR with variant PS. */ + par = unur_tdr_new( distr ); + unur_tdr_set_variant_ps( par ); + + /* Set uniform generator in parameter object. */ + unur_set_urng( par, urng1 ); + + /* Set auxilliary uniform random number generator. */ + /* We use the default generator. */ + unur_use_urng_aux_default( par ); + + /* Alternatively you can create and use your own auxilliary */ + /* uniform random number generator: */ + /* UNUR_URNG *urng_aux; */ + /* urng_aux = unur_urng_prng_new("tt800"); */ + /* if (urng_aux == NULL) exit (EXIT_FAILURE); */ + /* unur_set_urng_aux( par, urng_aux ); */ + + /* Create the generator object. */ + gen_normal = unur_init(par); + if (gen_normal == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Destroy distribution object (gen_normal has its own copy). */ + unur_distr_free(distr); + + + /* The second generator: Gamma(4) with antithetic variates. */ + + /* uniform generator: We use the Mersenne Twister. */ + urng2 = unur_urng_prng_new("anti(mt19937(1237))"); + if (urng2 == NULL) exit (EXIT_FAILURE); + + /* UNURAN generator object for gamma(4) */ + fparams[0] = 4.; + distr = unur_distr_gamma( fparams, 1 ); + + /* Choose method TDR with variant PS. */ + par = unur_tdr_new( distr ); + unur_tdr_set_variant_ps( par ); + + /* Set uniform generator in parameter object. */ + unur_set_urng( par, urng2 ); + + /* Set auxilliary uniform random number generator. */ + /* We use the default generator. */ + unur_use_urng_aux_default( par ); + + /* Alternatively you can create and use your own auxilliary */ + /* uniform random number generator (see above). */ + /* Notice that both generator objects gen_normal and */ + /* gen_gamma can share the same auxilliary URNG. */ + + /* Create the generator object. */ + gen_gamma = unur_init(par); + if (gen_gamma == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Destroy distribution object (gen_normal has its own copy). */ + unur_distr_free(distr); + + + /* Now we can sample pairs of negatively correlated random */ + /* variates. E.g.: */ + for (i=0; i<10; i++) { + xn = unur_sample_cont(gen_normal); + xg = unur_sample_cont(gen_gamma); + printf("%g, %g\n",xn,xg); + } + + + /* When you do not need the generator objects any more, you */ + /* can destroy it. */ + unur_free(gen_normal); + unur_free(gen_gamma); + + /* We also should destroy the uniform random number generators.*/ + unur_urng_free(urng1); + unur_urng_free(urng2); + + exit (EXIT_SUCCESS); +} /* end of main() */ + +/* ------------------------------------------------------------- */ +#else +#include +#include +int main(void) { + printf("You must enable the PRNG library to run this example!\n\n"); + exit (77); /* exit code for automake check routines */ +} +#endif +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/examples/example_anti_str.c b/vendor/unuran-1.11.0/examples/example_anti_str.c new file mode 100644 index 0000000..626c1e7 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_anti_str.c @@ -0,0 +1,92 @@ +/* ------------------------------------------------------------- */ +/* File: example_anti_str.c */ +/* ------------------------------------------------------------- */ +/* String API. */ +/* ------------------------------------------------------------- */ +#ifdef UNURAN_SUPPORTS_PRNG +/* ------------------------------------------------------------- */ +/* This example makes use of the PRNG library for generating */ +/* uniform random numbers. */ +/* (see http://statmath.wu.ac.at/prng/) */ +/* To compile this example you must have set */ +/* ./configure --with-urng-prng */ +/* (Of course the executable has to be linked against the */ +/* PRNG library.) */ +/* ------------------------------------------------------------- */ + +/* Example how to sample from two streams of antithetic random */ +/* variates from Gaussian N(2,5) and Gamma(4) distribution, resp.*/ + +/* ------------------------------------------------------------- */ + +/* Include UNURAN header files. */ +#include +#include + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double xn, xg; /* will hold the random number */ + + /* Declare UNURAN generator objects. */ + UNUR_GEN *gen_normal, *gen_gamma; + + /* PRNG only: */ + /* Make a object for uniform random number generator. */ + /* For details see http://statmath.wu.ac.at/prng/. */ + + /* Create the first generator: Gaussian N(2,5) */ + gen_normal = unur_str2gen("normal(2,5) & method=tdr; variant_ps & urng=mt19937(1237)"); + if (gen_normal == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + /* Set auxilliary uniform random number generator. */ + /* We use the default generator. */ + unur_chgto_urng_aux_default(gen_normal); + + /* The second generator: Gamma(4) with antithetic variates. */ + gen_gamma = unur_str2gen("gamma(4) & method=tdr; variant_ps & urng=anti(mt19937(1237))"); + if (gen_gamma == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + unur_chgto_urng_aux_default(gen_gamma); + + + /* Now we can sample pairs of negatively correlated random */ + /* variates. E.g.: */ + for (i=0; i<10; i++) { + xn = unur_sample_cont(gen_normal); + xg = unur_sample_cont(gen_gamma); + printf("%g, %g\n",xn,xg); + } + + + /* When you do not need the generator objects any more, you */ + /* can destroy it. */ + + /* But first we have to destroy the uniform random number */ + /* generators. */ + unur_urng_free(unur_get_urng(gen_normal)); + unur_urng_free(unur_get_urng(gen_gamma)); + + unur_free(gen_normal); + unur_free(gen_gamma); + + + exit (EXIT_SUCCESS); +} /* end of main() */ + +/* ------------------------------------------------------------- */ +#else +#include +#include +int main(void) { + printf("You must enable the PRNG library to run this example!\n\n"); + exit (77); /* exit code for automake check routines */ +} +#endif +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/examples/example_cext.c b/vendor/unuran-1.11.0/examples/example_cext.c new file mode 100644 index 0000000..b34a37b --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_cext.c @@ -0,0 +1,116 @@ +/* ------------------------------------------------------------- */ +/* File: example_cext.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* This example shows how an external generator for the */ +/* exponential distribution with one scale parameter can be */ +/* used within the UNURAN framework. */ +/* */ +/* Notice, that this example does not provide the simplest */ +/* solution. */ + +/* ------------------------------------------------------------- */ +/* Initialization routine. */ +/* */ +/* Here we simply read the scale parameter of the exponential */ +/* distribution and store it in an array for parameters of */ +/* the external generator. */ +/* [ Of course we could do this in the sampling routine as */ +/* and avoid the necessity of this initialization routine. ] */ + +int exponential_init (UNUR_GEN *gen) +{ + /* Get pointer to parameters of exponential distribution */ + double *params = unur_cext_get_distrparams(gen); + + /* The scale parameter is the first entry (see manual) */ + double lambda = (params) ? params[0] : 1.; + + /* Get array to store this parameter for external generator */ + double *genpar = unur_cext_get_params(gen, sizeof(double)); + genpar[0] = lambda; + + /* Executed successfully */ + return UNUR_SUCCESS; +} + +/* ------------------------------------------------------------- */ +/* Sampling routine. */ +/* */ +/* Contains the code for the external generator. */ + +double exponential_sample (UNUR_GEN *gen) +{ + /* Get scale parameter */ + double *genpar = unur_cext_get_params(gen,0); + double lambda = genpar[0]; + + /* Sample a uniformly distributed random number */ + double U = unur_sample_urng(gen); + + /* Transform into exponentially distributed random variate */ + return ( -log(1. - U) * lambda ); +} + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use predefined exponential distribution with scale param. 2 */ + double fpar[1] = { 2. }; + distr = unur_distr_exponential(fpar, 1); + + /* Use method CEXT */ + par = unur_cext_new(distr); + + /* Set initialization and sampling routines. */ + unur_cext_set_init(par, exponential_init); + unur_cext_set_sample(par, exponential_sample); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ + diff --git a/vendor/unuran-1.11.0/examples/example_cont.c b/vendor/unuran-1.11.0/examples/example_cont.c new file mode 100644 index 0000000..7947c4f --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_cont.c @@ -0,0 +1,114 @@ +/* ------------------------------------------------------------- */ +/* File: example_cont.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* Example how to sample from a continuous univariate */ +/* distribution. */ +/* */ +/* We build a distribution object from scratch and sample. */ + +/* ------------------------------------------------------------- */ + +/* Define the PDF and dPDF of our distribution. */ +/* */ +/* Our distribution has the PDF */ +/* */ +/* / 1 - x*x if |x| <= 1 */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ + +/* The PDF of our distribution: */ +double mypdf( double x, const UNUR_DISTR *distr ) + /* The second argument (`distr') can be used for parameters */ + /* for the PDF. (We do not use parameters in our example.) */ +{ + if (fabs(x) >= 1.) + return 0.; + else + return (1.-x*x); +} /* end of mypdf() */ + +/* The derivative of the PDF of our distribution: */ +double mydpdf( double x, const UNUR_DISTR *distr ) +{ + if (fabs(x) >= 1.) + return 0.; + else + return (-2.*x); +} /* end of mydpdf() */ + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create a new distribution object from scratch. */ + + /* Get empty distribution object for a continuous distribution */ + distr = unur_distr_cont_new(); + + /* Fill the distribution object -- the provided information */ + /* must fulfill the requirements of the method choosen below. */ + unur_distr_cont_set_pdf(distr, mypdf); /* PDF */ + unur_distr_cont_set_dpdf(distr, mydpdf); /* its derivative */ + unur_distr_cont_set_mode(distr, 0.); /* mode */ + unur_distr_cont_set_domain(distr, -1., 1.); /* domain */ + + /* Choose a method: TDR. */ + par = unur_tdr_new(distr); + + /* Set some parameters of the method TDR. */ + unur_tdr_set_variant_gw(par); + unur_tdr_set_max_sqhratio(par, 0.90); + unur_tdr_set_c(par, -0.5); + unur_tdr_set_max_intervals(par, 100); + unur_tdr_set_cpoints(par, 10, NULL); + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/examples/example_cont_str.c b/vendor/unuran-1.11.0/examples/example_cont_str.c new file mode 100644 index 0000000..ca801b6 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_cont_str.c @@ -0,0 +1,65 @@ +/* ------------------------------------------------------------- */ +/* File: example_cont_str.c */ +/* ------------------------------------------------------------- */ +/* String API. */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* Example how to sample from a continuous univariate */ +/* distribution. */ + +/* We use a generic distribution object and sample. */ +/* */ +/* The PDF of our distribution is given by */ +/* */ +/* / 1 - x*x if |x| <= 1 */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + /* Use a generic continuous distribution. */ + /* Choose a method: TDR. */ + gen = unur_str2gen( + "distr = cont; pdf=\"1-x*x\"; domain=(-1,1); mode=0. & \ + method=tdr; variant_gw; max_sqhratio=0.90; c=-0.5; \ + max_intervals=100; cpoints=10"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/examples/example_cpp.cpp b/vendor/unuran-1.11.0/examples/example_cpp.cpp new file mode 100644 index 0000000..8acc3e4 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_cpp.cpp @@ -0,0 +1,76 @@ +/* ------------------------------------------------------------- */ +/* File: example1.cpp */ +/* */ +/* This example simply shows that UNU.RAN can directly be used */ +/* with C++. */ +/* (Of course the example could be much less "C-stylish".) */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +#include + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use a predefined standard distribution: */ + /* Gaussian with mean zero and standard deviation 1. */ + /* Since this is the standard form of the distribution, */ + /* we need not give these parameters. */ + distr = unur_distr_normal(NULL, 0); + + /* Choose a method: AROU. */ + /* For other (suitable) methods replace "arou" with the */ + /* respective name (in lower case letters). */ + par = unur_arou_new(distr); + + /* Now you can change some of the default settings for the */ + /* parameters of the chosen method. We don't do it here. */ + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + std::cerr << "ERROR: cannot create generator object" << std::endl; + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + std::cout << "x(" << i << ") = " << x << std::endl; + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ + diff --git a/vendor/unuran-1.11.0/examples/example_dext.c b/vendor/unuran-1.11.0/examples/example_dext.c new file mode 100644 index 0000000..744c9b4 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_dext.c @@ -0,0 +1,116 @@ +/* ------------------------------------------------------------- */ +/* File: example_dext.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* This example shows how an external generator for the */ +/* geometric distribution can be used within the UNURAN */ +/* framework. */ +/* */ +/* Notice, that this example does not provide the simplest */ +/* solution. */ + +/* ------------------------------------------------------------- */ +/* Initialization routine. */ +/* */ +/* Here we simply read the parameter of the geometric */ +/* distribution and store it in an array for parameters of */ +/* the external generator. */ +/* [ Of course we could do this in the sampling routine as */ +/* and avoid the necessity of this initialization routine. ] */ + +int geometric_init (UNUR_GEN *gen) +{ + /* Get pointer to parameters of geometric distribution */ + double *params = unur_dext_get_distrparams(gen); + + /* The parameter is the first entry (see manual) */ + double p = params[0]; + + /* Get array to store this parameter for external generator */ + double *genpar = unur_dext_get_params(gen, sizeof(double)); + genpar[0] = p; + + /* Executed successfully */ + return UNUR_SUCCESS; +} + +/* ------------------------------------------------------------- */ +/* Sampling routine. */ +/* */ +/* Contains the code for the external generator. */ + +int geometric_sample (UNUR_GEN *gen) +{ + /* Get scale parameter */ + double *genpar = unur_dext_get_params(gen,0); + double p = genpar[0]; + + /* Sample a uniformly distributed random number */ + double U = unur_sample_urng(gen); + + /* Transform into geometrically distributed random variate */ + return ( (int) (log(U) / log(1.-p)) ); +} + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + int K; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Use predefined geometric distribution with parameter 1/10 */ + double fpar[1] = { 0.1 }; + distr = unur_distr_geometric(fpar, 1); + + /* Use method DEXT */ + par = unur_dext_new(distr); + + /* Set initialization and sampling routines. */ + unur_dext_set_init(par, geometric_init); + unur_dext_set_sample(par, geometric_sample); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the standard Gaussian distribution. */ + /* Eg.: */ + for (i=0; i<10; i++) { + K = unur_sample_discr(gen); + printf("%d\n",K); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ + diff --git a/vendor/unuran-1.11.0/examples/example_discr.c b/vendor/unuran-1.11.0/examples/example_discr.c new file mode 100644 index 0000000..4e181e2 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_discr.c @@ -0,0 +1,71 @@ +/* ------------------------------------------------------------- */ +/* File: example_discr.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* Example how to sample from a discrete univariate distribution.*/ + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; + double param = 0.3; + + double probvec[10] = {1.0, 2.0, 3.0, 4.0, 5.0,\ + 6.0, 7.0, 8.0, 4.0, 3.0}; + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr1, *distr2; /* distribution objects */ + UNUR_PAR *par1, *par2; /* parameter objects */ + UNUR_GEN *gen1, *gen2; /* generator objects */ + + /* First distribution: defined by PMF. */ + distr1 = unur_distr_geometric(¶m, 1); + unur_distr_discr_set_mode(distr1, 0); + + /* Choose a method: DARI. */ + par1 = unur_dari_new(distr1); + gen1 = unur_init(par1); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen1 == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Second distribution: defined by (finite) PV. */ + distr2 = unur_distr_discr_new(); + unur_distr_discr_set_pv(distr2, probvec, 10); + + /* Choose a method: DGT. */ + par2 = unur_dgt_new(distr2); + gen2 = unur_init(par2); + if (gen2 == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* print some random integers */ + for (i=0; i<10; i++){ + printf("number %d: %d\n", i*2, unur_sample_discr(gen1) ); + printf("number %d: %d\n", i*2+1, unur_sample_discr(gen2) ); + } + + /* Destroy all objects. */ + unur_distr_free(distr1); + unur_distr_free(distr2); + unur_free(gen1); + unur_free(gen2); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/examples/example_discr_str.c b/vendor/unuran-1.11.0/examples/example_discr_str.c new file mode 100644 index 0000000..77ed32d --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_discr_str.c @@ -0,0 +1,57 @@ +/* ------------------------------------------------------------- */ +/* File: example_discr_str.c */ +/* ------------------------------------------------------------- */ +/* String API. */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* Example how to sample from a discrete univariate distribution.*/ + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + + /* Declare UNURAN generator objects. */ + UNUR_GEN *gen1, *gen2; /* generator objects */ + + + /* First distribution: defined by PMF. */ + gen1 = unur_str2gen("geometric(0.3); mode=0 & method=dari"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen1 == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Second distribution: defined by (finite) PV. */ + gen2 = unur_str2gen( + "distr=discr; pv=(1,2,3,4,5,6,7,8,4,3) & method=dgt"); + if (gen2 == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* print some random integers */ + for (i=0; i<10; i++){ + printf("number %d: %d\n", i*2, unur_sample_discr(gen1) ); + printf("number %d: %d\n", i*2+1, unur_sample_discr(gen2) ); + } + + /* Destroy all objects. */ + unur_free(gen1); + unur_free(gen2); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/examples/example_emp.c b/vendor/unuran-1.11.0/examples/example_emp.c new file mode 100644 index 0000000..b8b30b0 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_emp.c @@ -0,0 +1,71 @@ +/* ------------------------------------------------------------- */ +/* File: example_emp.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* Example how to sample from an empirial continuous univariate */ +/* distribution. */ + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; + double x; + + /* data points */ + double data[15] = { -0.1, 0.05, -0.5, 0.08, 0.13,\ + -0.21,-0.44, -0.43, -0.33, -0.3, \ + 0.18, 0.2, -0.37, -0.29, -0.9 }; + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create a distribution object and set empirical sample. */ + distr = unur_distr_cemp_new(); + unur_distr_cemp_set_data(distr, data, 15); + + /* Choose a method: EMPK. */ + par = unur_empk_new(distr); + + /* Set smooting factor. */ + unur_empk_set_smoothing(par, 0.8); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/examples/example_emp_str.c b/vendor/unuran-1.11.0/examples/example_emp_str.c new file mode 100644 index 0000000..4a3cf8f --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_emp_str.c @@ -0,0 +1,55 @@ +/* ------------------------------------------------------------- */ +/* File: example_emp_str.c */ +/* ------------------------------------------------------------- */ +/* String API. */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* Example how to sample from an empirial continuous univariate */ +/* distribution. */ + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; + double x; + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Create the generator object. */ + gen = unur_str2gen("distr = cemp; \ + data=(-0.10, 0.05,-0.50, 0.08, 0.13, \ + -0.21,-0.44,-0.43,-0.33,-0.30, \ + 0.18, 0.20,-0.37,-0.29,-0.90) & \ + method=empk; smoothing=0.8"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/examples/example_errorhandler.c b/vendor/unuran-1.11.0/examples/example_errorhandler.c new file mode 100644 index 0000000..240dded --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_errorhandler.c @@ -0,0 +1,60 @@ +/* ------------------------------------------------------------- */ +/* File: example_errorhandler.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* Simple example of an error handler that simply prints a */ +/* message to stderr. */ + +/* ------------------------------------------------------------- */ + +void my_error_handler( + const char *objid, /* id/type of object */ + const char *file, /* source file name (__FILE__) */ + int line, /* source line number (__LINE__) */ + const char *errortype, /* "warning" or "error" */ + int errorcode, /* UNU.RAN error code */ + const char *reason /* short description of reason */ + ) +{ + FILE *LOG = stderr; + static int n = 0; + + fprintf(LOG,"\n"); + fprintf(LOG,"[[ %d ]] my_error_handler: [ %s ]\n",++n,errortype); + fprintf(LOG,"\tobject = %s\n",objid); + fprintf(LOG,"\tfile = %s\n",file); + fprintf(LOG,"\tline = %d\n",line); + fprintf(LOG,"\tcode = [%#x] %s\n",errorcode, + unur_get_strerror(errorcode)); + fprintf(LOG,"\treason = %s\n",reason); + fprintf(LOG,"\n"); + +} /* end of my_error_handler() */ + +/* ------------------------------------------------------------- */ + +int main(void) +{ + /* Declare UNURAN object. */ + UNUR_GEN *gen; /* generator object */ + + /* Declare a point to hold old error handler. */ + UNUR_ERROR_HANDLER *default_error_handler = NULL; + + /* Set new error handler. */ + default_error_handler = unur_set_error_handler( my_error_handler ); + + /* The following statement causes an error */ + gen = unur_str2gen("normal(0.,-1)"); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ + diff --git a/vendor/unuran-1.11.0/examples/example_gsl.c b/vendor/unuran-1.11.0/examples/example_gsl.c new file mode 100644 index 0000000..4833e32 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_gsl.c @@ -0,0 +1,71 @@ +/* ------------------------------------------------------------- */ +/* File: example_gsl.c */ +/* ------------------------------------------------------------- */ +#ifdef UNURAN_SUPPORTS_GSL +/* ------------------------------------------------------------- */ +/* This example makes use of the GSL library for generating */ +/* uniform random numbers. */ +/* (see http://www.gnu.org/software/gsl/) */ +/* To compile this example you must have set */ +/* ./configure --with-urng-gsl */ +/* (Of course the executable has to be linked against the */ +/* GSL library.) */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header files. */ +#include +#include + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng; /* uniform generator objects */ + + /* GNU Scientific Library only: */ + /* Make a object for uniform random number generator. */ + urng = unur_urng_gsl_new(gsl_rng_mt19937); + if (urng == NULL) exit (EXIT_FAILURE); + + /* Create a generator object using this URNG */ + distr = unur_distr_normal( NULL, 0 ); + par = unur_tdr_new(distr); + unur_set_urng( par, urng ); + gen = unur_init(par); + if (gen == NULL) exit (EXIT_FAILURE); + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* Destroy objects */ + unur_free(gen); + unur_urng_free(urng); + + exit (EXIT_SUCCESS); +} /* end of main() */ + +/* ------------------------------------------------------------- */ +#else +#include +#include +int main(void) { + printf("You must enable the GSL to run this example!\n\n"); + exit (77); /* exit code for automake check routines */ +} +#endif +/* ------------------------------------------------------------- */ + diff --git a/vendor/unuran-1.11.0/examples/example_mcorr.c b/vendor/unuran-1.11.0/examples/example_mcorr.c new file mode 100644 index 0000000..1e6f2cc --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_mcorr.c @@ -0,0 +1,66 @@ +/* ------------------------------------------------------------- */ +/* File: example_mcorr.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* Example how to generate random correlation matrices */ + +/* ------------------------------------------------------------- */ + +#define dim (4) + +int main(void) +{ + int i,j; + double M[dim*dim]; + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create a distribution object for random correlation matrix */ + distr = unur_distr_correlation( dim ); + + /* Choose a method: MCORR. */ + par = unur_mcorr_new(distr); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + unur_sample_matr(gen, M); + for (j=0; j + +/* ------------------------------------------------------------- */ +/* Mixture of a Gaussian and a Cauchy distribution. */ +/* ------------------------------------------------------------- */ + +int main(void) +{ + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *comp[2]; /* array of generator objects (components)*/ + UNUR_GEN *gen; /* generator object for mixture */ + + double prob[2]; /* array of probabilities */ + + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Create generators for components */ + distr = unur_distr_normal(NULL,0); /* Gaussian distribution */ + par = unur_pinv_new(distr); /* choose method PINV */ + comp[0] = unur_init(par); /* initialize */ + unur_distr_free(distr); /* free distribution obj. */ + + distr = unur_distr_cauchy(NULL,0); /* Cauchy distribution */ + par = unur_tdr_new(distr); /* choose method TDR */ + comp[1] = unur_init(par); /* initialize */ + unur_distr_free(distr); /* free distribution obj. */ + + /* Probabilities for components (need not sum to 1) */ + prob[0] = 0.4; + prob[1] = 0.3; + + /* Create mixture */ + par = unur_mixt_new(2,prob,comp); + + /* Initialize generator object */ + gen = unur_init(par); + + /* we do not need the components any more */ + for (i=0; i<2; i++) + unur_free(comp[i]); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/examples/example_mixt_inv.c b/vendor/unuran-1.11.0/examples/example_mixt_inv.c new file mode 100644 index 0000000..8bc7a12 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_mixt_inv.c @@ -0,0 +1,79 @@ +/* ------------------------------------------------------------- */ +/* File: example_mixt_inv.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ +/* Mixture of truncated Gaussian on (-INFINITY,0] and */ +/* Exponential distribution on [0,INFINITY) */ +/* ------------------------------------------------------------- */ + +int main(void) +{ + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *comp[2]; /* array of generator objects (components)*/ + UNUR_GEN *gen; /* generator object for mixture */ + + double prob[2]; /* array of probabilities */ + + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Create generators for components */ + distr = unur_distr_normal(NULL,0); /* Gaussian distribution */ + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,0); + par = unur_pinv_new(distr); /* choose method PINV */ + comp[0] = unur_init(par); /* initialize */ + unur_distr_free(distr); /* free distribution obj. */ + + distr = unur_distr_exponential(NULL,0); /* Exponential distr. */ + par = unur_pinv_new(distr); /* choose method PINV */ + comp[1] = unur_init(par); /* initialize */ + unur_distr_free(distr); /* free distribution obj. */ + + /* Probabilities for components (need not sum to 1) */ + prob[0] = 0.4; + prob[1] = 0.3; + + /* Create mixture */ + par = unur_mixt_new(2,prob,comp); + + /* We want to use inversion for the mixture as well. */ + /* (Thus the above order of the components is important!) */ + unur_mixt_set_useinversion(par,TRUE); + + /* Initialize generator object */ + gen = unur_init(par); + + /* we do not need the components any more */ + for (i=0; i<2; i++) + unur_free(comp[i]); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/examples/example_prng.c b/vendor/unuran-1.11.0/examples/example_prng.c new file mode 100644 index 0000000..454c73e --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_prng.c @@ -0,0 +1,113 @@ +/* ------------------------------------------------------------- */ +/* File: example_prng.c */ +/* ------------------------------------------------------------- */ +#ifdef UNURAN_SUPPORTS_PRNG +/* ------------------------------------------------------------- */ +/* This example makes use of the PRNG library for generating */ +/* uniform random numbers. */ +/* (see http://statmath.wu.ac.at/prng/) */ +/* To compile this example you must have set */ +/* ./configure --with-urng-prng */ +/* (Of course the executable has to be linked against the */ +/* PRNG library.) */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header files. */ +#include +#include + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double x; /* will hold the random number */ + double fparams[2]; /* array for parameters for distribution */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng1, *urng2; /* uniform generator objects */ + + /* PRNG only: */ + /* Make a object for uniform random number generator. */ + /* For details see http://statmath.wu.ac.at/prng/ */ + /* We use the Mersenne Twister. */ + urng1 = unur_urng_prng_new("mt19937(1237)"); + if (urng1 == NULL) exit (EXIT_FAILURE); + + /* Use a predefined standard distribution: */ + /* Beta with parameters 2 and 3. */ + fparams[0] = 2.; + fparams[1] = 3.; + distr = unur_distr_beta( fparams, 2 ); + + /* Choose a method: TDR. */ + par = unur_tdr_new(distr); + + /* Set uniform generator in parameter object */ + unur_set_urng( par, urng1 ); + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* Now we want to switch to a different uniform random number */ + /* generator. */ + /* Now we use an ICG (Inversive Congruental Generator). */ + urng2 = unur_urng_prng_new("icg(2147483647,1,1,0)"); + if (urng2 == NULL) exit (EXIT_FAILURE); + unur_chg_urng( gen, urng2 ); + + /* ... and sample again. */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + /* We also should destroy the uniform random number generators.*/ + unur_urng_free(urng1); + unur_urng_free(urng2); + + exit (EXIT_SUCCESS); +} /* end of main() */ + +/* ------------------------------------------------------------- */ +#else +#include +#include +int main(void) { + printf("You must enable the PRNG library to run this example!\n\n"); + exit (77); /* exit code for automake check routines */ +} +#endif +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/examples/example_prng_str.c b/vendor/unuran-1.11.0/examples/example_prng_str.c new file mode 100644 index 0000000..d52c851 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_prng_str.c @@ -0,0 +1,94 @@ +/* ------------------------------------------------------------- */ +/* File: example_prng_str.c */ +/* ------------------------------------------------------------- */ +/* String API. */ +/* ------------------------------------------------------------- */ +#ifdef UNURAN_SUPPORTS_PRNG +/* ------------------------------------------------------------- */ +/* This example makes use of the PRNG library for generating */ +/* uniform random numbers. */ +/* (see http://statmath.wu.ac.at/prng/) */ +/* To compile this example you must have set */ +/* ./configure --with-urng-prng */ +/* (Of course the executable has to be linked against the */ +/* PRNG library.) */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header files. */ +#include +#include + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Declare UNURAN generator object. */ + UNUR_GEN *gen; /* generator object */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng1, *urng2; /* uniform generator objects */ + + /* Create the generator object. */ + /* Use a predefined standard distribution: */ + /* Beta with parameters 2 and 3. */ + /* Choose a method: TDR. */ + /* Use the Mersenne Twister for unifrom random number */ + /* generator (requires PRNG library). */ + gen = unur_str2gen("beta(2,3) & method=tdr & urng = mt19937(1237)"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* Now we want to switch to a different uniform random number */ + /* generator. */ + /* Now we use an ICG (Inversive Congruental Generator). */ + urng2 = unur_urng_prng_new("icg(2147483647,1,1,0)"); + if (urng2 == NULL) exit (EXIT_FAILURE); + + /* Change uniform random number generator. */ + /* Notice however that we should save the pointer to uniform */ + /* random number generator in the generator object. */ + urng1 = unur_chg_urng( gen, urng2 ); + + /* ... and sample again. */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + /* We also should destroy the uniform random number generators.*/ + unur_urng_free(urng1); + unur_urng_free(urng2); + + exit (EXIT_SUCCESS); +} /* end of main() */ + +/* ------------------------------------------------------------- */ +#else +#include +#include +int main(void) { + printf("You must enable the PRNG library to run this example!\n\n"); + exit (77); /* exit code for automake check routines */ +} +#endif +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/examples/example_reinit.c b/vendor/unuran-1.11.0/examples/example_reinit.c new file mode 100644 index 0000000..3ba4f98 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_reinit.c @@ -0,0 +1,104 @@ +/* ------------------------------------------------------------- */ +/* File: example_reinit.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* In this example we show how the parameters of the underlying */ +/* distribution can be changed for an existing generator object. */ + +/* We use the GIG distribution with method CSTD. */ + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double x; /* will hold the random number */ + + /* Parameters of distribution. */ + double dparam[3] = {0.5, 1., 5.}; + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create initial GIG distribution object */ + distr = unur_distr_gig(dparam, 3); + + /* Choose a method: CSTD. */ + par = unur_cstd_new(distr); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* It is possible for method CSTD to change the parameters of */ + /* underlying distribution. However, we have to extract to */ + /* pointer to the distribution. Be carefull with this pointer! */ + distr = unur_get_distr(gen); + + /* Change the parameter(s). */ + dparam[2] = 0.001; + unur_distr_cont_set_pdfparams(distr,dparam,3); + + /* Do not forget to reinitialize the generator object. */ + /* Check the return code. */ + /* (and try to find a better error handling) */ + if (unur_reinit(gen) != UNUR_SUCCESS) { + fprintf(stderr, "ERROR: cannot reinitialize generator object\n"); + exit (EXIT_FAILURE); + } + + /* Draw a new sample. */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* Changing parameters can be repeated. */ + dparam[2] = 1000; + unur_distr_cont_set_pdfparams(distr,dparam,3); + if (unur_reinit(gen) != UNUR_SUCCESS) { + fprintf(stderr, "ERROR: cannot reinitialize generator object\n"); + exit (EXIT_FAILURE); + } + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ + + diff --git a/vendor/unuran-1.11.0/examples/example_rngstreams.c b/vendor/unuran-1.11.0/examples/example_rngstreams.c new file mode 100644 index 0000000..0c3e420 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_rngstreams.c @@ -0,0 +1,117 @@ +/* ------------------------------------------------------------- */ +/* File: example_rngstreams.c */ +/* ------------------------------------------------------------- */ +#ifdef UNURAN_SUPPORTS_RNGSTREAM +/* ------------------------------------------------------------- */ +/* This example makes use of the RNGSTREAM library for */ +/* for generating uniform random numbers. */ +/* (see http://statmath.wu.ac.at/software/RngStreams/) */ +/* To compile this example you must have set */ +/* ./configure --with-urng-rngstream */ +/* (Of course the executable has to be linked against the */ +/* RNGSTREAM library.) */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header files. */ +#include +#include + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double x; /* will hold the random number */ + double fparams[2]; /* array for parameters for distribution */ + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng1, *urng2; /* uniform generator objects */ + + /* The RNGSTREAMS library sets a package seed. */ + unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; + RngStream_SetPackageSeed(seed); + + /* RngStreams only: */ + /* Make a object for uniform random number generator. */ + /* For details see */ + /* http://statmath.wu.ac.at/software/RngStreams/ */ + urng1 = unur_urng_rngstream_new("urng-1"); + if (urng1 == NULL) exit (EXIT_FAILURE); + + /* Use a predefined standard distribution: */ + /* Beta with parameters 2 and 3. */ + fparams[0] = 2.; + fparams[1] = 3.; + distr = unur_distr_beta( fparams, 2 ); + + /* Choose a method: TDR. */ + par = unur_tdr_new(distr); + + /* Set uniform generator in parameter object */ + unur_set_urng( par, urng1 ); + + /* Create the generator object. */ + gen = unur_init(par); + + /* Notice that this call has also destroyed the parameter */ + /* object `par' as a side effect. */ + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* Now we want to switch to a different (independent) stream */ + /* of uniform random numbers. */ + urng2 = unur_urng_rngstream_new("urng-2"); + if (urng2 == NULL) exit (EXIT_FAILURE); + unur_chg_urng( gen, urng2 ); + + /* ... and sample again. */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen); + printf("%f\n",x); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + /* We also should destroy the uniform random number generators.*/ + unur_urng_free(urng1); + unur_urng_free(urng2); + + exit (EXIT_SUCCESS); +} /* end of main() */ + +/* ------------------------------------------------------------- */ +#else +#include +#include +int main(void) { + printf("You must enable the RNGSTREAM library to run this example!\n\n"); + exit (77); /* exit code for automake check routines */ +} +#endif +/* ------------------------------------------------------------- */ + diff --git a/vendor/unuran-1.11.0/examples/example_vemp.c b/vendor/unuran-1.11.0/examples/example_vemp.c new file mode 100644 index 0000000..24a7ac0 --- /dev/null +++ b/vendor/unuran-1.11.0/examples/example_vemp.c @@ -0,0 +1,75 @@ +/* ------------------------------------------------------------- */ +/* File: example_vemp.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header file. */ +#include + +/* ------------------------------------------------------------- */ + +/* Example how to sample from an empirial continuous */ +/* multivariate distribution. */ + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; + + /* 4 data points of dimension 2 */ + double data[] = { 1. ,1., /* 1st data point */ + -1.,1., /* 2nd data point */ + 1.,-1., /* 3rd data point */ + -1.,-1. }; /* 4th data point */ + + double result[2]; + + /* Declare the three UNURAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen; /* generator object */ + + /* Create a distribution object with dimension 2. */ + distr = unur_distr_cvemp_new( 2 ); + + /* Set empirical sample. */ + unur_distr_cvemp_set_data(distr, data, 4); + + /* Choose a method: VEMPK. */ + par = unur_vempk_new(distr); + + /* Use variance correction. */ + unur_vempk_set_varcor( par, 1 ); + + /* Create the generator object. */ + gen = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen' to sample from */ + /* the distribution. Eg.: */ + for (i=0; i<10; i++) { + unur_sample_vec(gen, result); + printf("(%f,%f)\n", result[0], result[1]); + } + + /* When you do not need the generator object any more, you */ + /* can destroy it. */ + unur_free(gen); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/experiments/.deps/make_timing_table.Po b/vendor/unuran-1.11.0/experiments/.deps/make_timing_table.Po new file mode 100644 index 0000000..3554ae5 --- /dev/null +++ b/vendor/unuran-1.11.0/experiments/.deps/make_timing_table.Po @@ -0,0 +1,161 @@ +make_timing_table.o: make_timing_table.c /usr/include/stdc-predef.h \ + ../config.h /usr/include/stdio.h \ + /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \ + /usr/include/features.h /usr/include/features-time64.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/bits/timesize.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/long-double.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h \ + /usr/lib/gcc/x86_64-linux-gnu/13/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/time64.h \ + /usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/__FILE.h \ + /usr/include/x86_64-linux-gnu/bits/types/FILE.h \ + /usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h \ + /usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h \ + /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \ + /usr/include/x86_64-linux-gnu/bits/floatn.h \ + /usr/include/x86_64-linux-gnu/bits/floatn-common.h /usr/include/stdlib.h \ + /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h \ + /usr/include/x86_64-linux-gnu/sys/types.h \ + /usr/include/x86_64-linux-gnu/bits/types/clock_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/clockid_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/time_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/timer_t.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-intn.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endianness.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/uintn-identity.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/types/sigset_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h \ + /usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \ + /usr/include/x86_64-linux-gnu/bits/thread-shared-types.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h \ + /usr/include/x86_64-linux-gnu/bits/atomic_wide_counter.h \ + /usr/include/x86_64-linux-gnu/bits/struct_mutex.h \ + /usr/include/x86_64-linux-gnu/bits/struct_rwlock.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h /usr/include/ctype.h \ + /usr/include/x86_64-linux-gnu/bits/types/locale_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/__locale_t.h \ + /usr/include/string.h /usr/include/strings.h /usr/include/unistd.h \ + /usr/include/x86_64-linux-gnu/bits/posix_opt.h \ + /usr/include/x86_64-linux-gnu/bits/environments.h \ + /usr/include/x86_64-linux-gnu/bits/confname.h \ + /usr/include/x86_64-linux-gnu/bits/getopt_posix.h \ + /usr/include/x86_64-linux-gnu/bits/getopt_core.h \ + /usr/include/x86_64-linux-gnu/bits/unistd_ext.h ../src/unuran.h \ + /usr/lib/gcc/x86_64-linux-gnu/13/include/limits.h \ + /usr/lib/gcc/x86_64-linux-gnu/13/include/syslimits.h \ + /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \ + /usr/include/x86_64-linux-gnu/bits/local_lim.h \ + /usr/include/linux/limits.h \ + /usr/include/x86_64-linux-gnu/bits/pthread_stack_min-dynamic.h \ + /usr/include/x86_64-linux-gnu/bits/pthread_stack_min.h \ + /usr/include/x86_64-linux-gnu/bits/posix2_lim.h /usr/include/math.h \ + /usr/include/x86_64-linux-gnu/bits/math-vector.h \ + /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \ + /usr/include/x86_64-linux-gnu/bits/flt-eval-method.h \ + /usr/include/x86_64-linux-gnu/bits/fp-logb.h \ + /usr/include/x86_64-linux-gnu/bits/fp-fast.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls.h \ + ../src/tests/unuran_tests.h +/usr/include/stdc-predef.h: +../config.h: +/usr/include/stdio.h: +/usr/include/x86_64-linux-gnu/bits/libc-header-start.h: +/usr/include/features.h: +/usr/include/features-time64.h: +/usr/include/x86_64-linux-gnu/bits/wordsize.h: +/usr/include/x86_64-linux-gnu/bits/timesize.h: +/usr/include/x86_64-linux-gnu/sys/cdefs.h: +/usr/include/x86_64-linux-gnu/bits/long-double.h: +/usr/include/x86_64-linux-gnu/gnu/stubs.h: +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: +/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h: +/usr/lib/gcc/x86_64-linux-gnu/13/include/stdarg.h: +/usr/include/x86_64-linux-gnu/bits/types.h: +/usr/include/x86_64-linux-gnu/bits/typesizes.h: +/usr/include/x86_64-linux-gnu/bits/time64.h: +/usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h: +/usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h: +/usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h: +/usr/include/x86_64-linux-gnu/bits/types/__FILE.h: +/usr/include/x86_64-linux-gnu/bits/types/FILE.h: +/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h: +/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h: +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: +/usr/include/x86_64-linux-gnu/bits/floatn.h: +/usr/include/x86_64-linux-gnu/bits/floatn-common.h: +/usr/include/stdlib.h: +/usr/include/x86_64-linux-gnu/bits/waitflags.h: +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: +/usr/include/x86_64-linux-gnu/sys/types.h: +/usr/include/x86_64-linux-gnu/bits/types/clock_t.h: +/usr/include/x86_64-linux-gnu/bits/types/clockid_t.h: +/usr/include/x86_64-linux-gnu/bits/types/time_t.h: +/usr/include/x86_64-linux-gnu/bits/types/timer_t.h: +/usr/include/x86_64-linux-gnu/bits/stdint-intn.h: +/usr/include/endian.h: +/usr/include/x86_64-linux-gnu/bits/endian.h: +/usr/include/x86_64-linux-gnu/bits/endianness.h: +/usr/include/x86_64-linux-gnu/bits/byteswap.h: +/usr/include/x86_64-linux-gnu/bits/uintn-identity.h: +/usr/include/x86_64-linux-gnu/sys/select.h: +/usr/include/x86_64-linux-gnu/bits/select.h: +/usr/include/x86_64-linux-gnu/bits/types/sigset_t.h: +/usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h: +/usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h: +/usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h: +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: +/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h: +/usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h: +/usr/include/x86_64-linux-gnu/bits/atomic_wide_counter.h: +/usr/include/x86_64-linux-gnu/bits/struct_mutex.h: +/usr/include/x86_64-linux-gnu/bits/struct_rwlock.h: +/usr/include/alloca.h: +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: +/usr/include/ctype.h: +/usr/include/x86_64-linux-gnu/bits/types/locale_t.h: +/usr/include/x86_64-linux-gnu/bits/types/__locale_t.h: +/usr/include/string.h: +/usr/include/strings.h: +/usr/include/unistd.h: +/usr/include/x86_64-linux-gnu/bits/posix_opt.h: +/usr/include/x86_64-linux-gnu/bits/environments.h: +/usr/include/x86_64-linux-gnu/bits/confname.h: +/usr/include/x86_64-linux-gnu/bits/getopt_posix.h: +/usr/include/x86_64-linux-gnu/bits/getopt_core.h: +/usr/include/x86_64-linux-gnu/bits/unistd_ext.h: +../src/unuran.h: +/usr/lib/gcc/x86_64-linux-gnu/13/include/limits.h: +/usr/lib/gcc/x86_64-linux-gnu/13/include/syslimits.h: +/usr/include/limits.h: +/usr/include/x86_64-linux-gnu/bits/posix1_lim.h: +/usr/include/x86_64-linux-gnu/bits/local_lim.h: +/usr/include/linux/limits.h: +/usr/include/x86_64-linux-gnu/bits/pthread_stack_min-dynamic.h: +/usr/include/x86_64-linux-gnu/bits/pthread_stack_min.h: +/usr/include/x86_64-linux-gnu/bits/posix2_lim.h: +/usr/include/math.h: +/usr/include/x86_64-linux-gnu/bits/math-vector.h: +/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h: +/usr/include/x86_64-linux-gnu/bits/flt-eval-method.h: +/usr/include/x86_64-linux-gnu/bits/fp-logb.h: +/usr/include/x86_64-linux-gnu/bits/fp-fast.h: +/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h: +/usr/include/x86_64-linux-gnu/bits/mathcalls.h: +../src/tests/unuran_tests.h: diff --git a/vendor/unuran-1.11.0/experiments/Makefile b/vendor/unuran-1.11.0/experiments/Makefile new file mode 100644 index 0000000..554f9d7 --- /dev/null +++ b/vendor/unuran-1.11.0/experiments/Makefile @@ -0,0 +1,632 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# experiments/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/unuran +pkgincludedir = $(includedir)/unuran +pkglibdir = $(libdir)/unuran +pkglibexecdir = $(libexecdir)/unuran +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +noinst_PROGRAMS = make_timing_table$(EXEEXT) +subdir = experiments +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +make_timing_table_SOURCES = make_timing_table.c +make_timing_table_OBJECTS = make_timing_table.$(OBJEXT) +make_timing_table_LDADD = $(LDADD) +make_timing_table_DEPENDENCIES = $(top_builddir)/src/libunuran.la +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I. -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/make_timing_table.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = make_timing_table.c +DIST_SOURCES = make_timing_table.c +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_CFLAGS = -Wall -Wextra -Wshadow -Wstrict-prototypes +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf +AUTOHEADER = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader +AUTOMAKE = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -fPIC +CPP = gcc -E +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +FILECMD = file +GREP = /usr/bin/grep +HAVE_DIVIDE_BY_ZERO = +HAVE_IEEE_COMPARISONS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAINT = # +MAKEINFO = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = unuran +PACKAGE_BUGREPORT = unuran@statmath.wu.ac.at +PACKAGE_NAME = unuran +PACKAGE_STRING = unuran 1.11.0 +PACKAGE_TARNAME = unuran +PACKAGE_URL = +PACKAGE_VERSION = 1.11.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +UNURAN_LT_VERSION = 16:1:0 +UNURAN_SUPPORTS_GSL = +UNURAN_SUPPORTS_PRNG = +UNURAN_SUPPORTS_RNGSTREAM = +VERSION = 1.11.0 +abs_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/experiments +abs_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/experiments +abs_top_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +have_valgrind = false +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../ +top_builddir = .. +top_srcdir = .. +AM_CPPFLAGS = \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/tests + +AM_LDFLAGS = \ + -L$(top_builddir)/src + +LDADD = \ + $(top_builddir)/src/libunuran.la + +EXTRA_DIST = \ + timings_chap_8.conf \ + timings_chap_10.conf + + +# clean backup files +CLEANFILES = \ + unuran.log \ + *~ + + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign experiments/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign experiments/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +make_timing_table$(EXEEXT): $(make_timing_table_OBJECTS) $(make_timing_table_DEPENDENCIES) $(EXTRA_make_timing_table_DEPENDENCIES) + @rm -f make_timing_table$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(make_timing_table_OBJECTS) $(make_timing_table_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/make_timing_table.Po # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ $< + +.c.obj: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: + $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +# $(AM_V_CC)source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/make_timing_table.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/make_timing_table.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/experiments/Makefile.am b/vendor/unuran-1.11.0/experiments/Makefile.am new file mode 100644 index 0000000..4a3bddc --- /dev/null +++ b/vendor/unuran-1.11.0/experiments/Makefile.am @@ -0,0 +1,27 @@ +## Process this file with automake to produce Makefile.in + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/tests + +AM_LDFLAGS = \ + -L$(top_builddir)/src + +LDADD = \ + $(top_builddir)/src/libunuran.la + +noinst_PROGRAMS = \ + make_timing_table + +EXTRA_DIST = \ + timings_chap_8.conf \ + timings_chap_10.conf + +# clean backup files +CLEANFILES = \ + unuran.log \ + *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/vendor/unuran-1.11.0/experiments/Makefile.in b/vendor/unuran-1.11.0/experiments/Makefile.in new file mode 100644 index 0000000..b6dc22a --- /dev/null +++ b/vendor/unuran-1.11.0/experiments/Makefile.in @@ -0,0 +1,632 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = make_timing_table$(EXEEXT) +subdir = experiments +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +make_timing_table_SOURCES = make_timing_table.c +make_timing_table_OBJECTS = make_timing_table.$(OBJEXT) +make_timing_table_LDADD = $(LDADD) +make_timing_table_DEPENDENCIES = $(top_builddir)/src/libunuran.la +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/make_timing_table.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = make_timing_table.c +DIST_SOURCES = make_timing_table.c +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ +UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ +UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ +UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_valgrind = @have_valgrind@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/tests + +AM_LDFLAGS = \ + -L$(top_builddir)/src + +LDADD = \ + $(top_builddir)/src/libunuran.la + +EXTRA_DIST = \ + timings_chap_8.conf \ + timings_chap_10.conf + + +# clean backup files +CLEANFILES = \ + unuran.log \ + *~ + + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign experiments/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign experiments/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +make_timing_table$(EXEEXT): $(make_timing_table_OBJECTS) $(make_timing_table_DEPENDENCIES) $(EXTRA_make_timing_table_DEPENDENCIES) + @rm -f make_timing_table$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(make_timing_table_OBJECTS) $(make_timing_table_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/make_timing_table.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/make_timing_table.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/make_timing_table.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/experiments/make_timing_table b/vendor/unuran-1.11.0/experiments/make_timing_table new file mode 100755 index 0000000..1b51b94 Binary files /dev/null and b/vendor/unuran-1.11.0/experiments/make_timing_table differ diff --git a/vendor/unuran-1.11.0/experiments/make_timing_table.c b/vendor/unuran-1.11.0/experiments/make_timing_table.c new file mode 100644 index 0000000..a902e42 --- /dev/null +++ b/vendor/unuran-1.11.0/experiments/make_timing_table.c @@ -0,0 +1,569 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: make_timing_table.c * + * * + * Create a table with timing results * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#ifdef HAVE_CONFIG_H +# include +#else +# error "config.h" required +#endif + +#include +#include +#include +#include + +#ifdef HAVE_UNISTD_H +# include +#endif + +#include +#include + +/* ------------------------------------------------------------------------- */ + +/* Program name */ +static const char *progname = "make_timing_table"; + +/*---------------------------------------------------------------------------*/ + +extern char *_unur_parser_prepare_string( const char *str ); + +/*---------------------------------------------------------------------------*/ + +/* print help */ +static void print_usage(void); + +/* get unit for relative timing */ +static double get_timing_unit(void); + +/* read config file */ +static int read_config_file ( const char *filename, + struct unur_slist *distr_str_list, + struct unur_slist *meth_str_list ); + +/* make distribution objects */ +static struct unur_slist *make_distr_list ( struct unur_slist *distr_str_list ); + +/* print legend for distributions and methods */ +static int print_legend ( struct unur_slist *distr_str_list, struct unur_slist *meth_str_list ); + +/* print legend for timings results */ +static int print_timing_legend ( int samplesize, double unit, int is_default ); + +/* print label for distribution and methods with index n*/ +static int print_label ( int n, int ltype ); + +#define LABEL_DISTR 'A' /* label used for distributions */ +#define LABEL_METH '1' /* label used for methods */ + +/* compute timings table */ +static double *compute_timings ( struct unur_slist *distr_str_list, struct unur_slist *meth_str_list, + int samplesize, double duration, double unit ); + +/* print timings table */ +static int print_timings ( double *timings, + struct unur_slist *distr_str_list, struct unur_slist *meth_str_list, + int rowentry ); + +#define ROW_DISTRIBUTION 1 /* print distributions on row, methods in columns */ +#define ROW_METHOD 2 /* print distributions on columns, methods in rows*/ + +/*---------------------------------------------------------------------------*/ +/* print usage */ + +void +print_usage(void) +{ + +#if HAVE_DECL_GETOPT + + fprintf(stderr,"\n%s [-D] [-n size] [-d time] conffile\n",progname); + fprintf(stderr,"\n"); + fprintf(stderr,"Compute average generation time (including setup) for a sampling.\n"); + fprintf(stderr,"\n"); + fprintf(stderr,"Arguments:\n"); + fprintf(stderr,"\t-D ... debug mode\n"); + fprintf(stderr,"\t-n size ... size of sample (default: 1000)\n"); + fprintf(stderr,"\t-d time ... duration for each test in sec. (default: 0.1)\n"); + fprintf(stderr,"\t-u unit ... timing unit in micro sec. (default: generation for exponential)\n"); + fprintf(stderr,"\t conffile ... file with list of distributions and methods\n"); + fprintf(stderr,"\n"); + +#else + + fprintf(stderr,"\n%s conffile [samplesize]\n",progname); + fprintf(stderr,"\n"); + fprintf(stderr,"Compute average generation time (including setup) for a sampling.\n"); + fprintf(stderr,"\n"); + fprintf(stderr,"Arguments:\n"); + fprintf(stderr,"\tconffile ... file with list of distributions and methods\n"); + fprintf(stderr,"\tsamplesize ... size of sample (default: 1000)\n"); + fprintf(stderr,"\n"); + +#endif + +} /* end of print_usage() */ + +/*****************************************************************************/ + +int main (int argc, char *argv[]) +{ + /* defaults */ + int debug = 0; /* debug mode (on/off) */ + int samplesize = 1000; /* size of samples */ + double duration = 0.1; /* duration in seconds for timing generation of a sample */ + double unit = -1.; /* timing unit in micro sec. (<= 0. --> use default) */ + char *conffile; /* name of configuration file */ + + struct unur_slist *distr_str_list; /* list of strings for distributions */ + struct unur_slist *meth_str_list; /* list of strings for methods */ + + double timing_unit; /* unit for timing result */ + double *time_0; + + /* ------------------------------------------------------------------------*/ + /* read parameters */ + +#if HAVE_DECL_GETOPT + + int c; + + while ((c = getopt(argc, argv, "Dd:n:u:")) != -1) { + switch (c) { + case 'D': /* debug */ + debug = 1; + break; + case 'd': /* duration */ + duration = atof(optarg); + break; + case 'n': /* sample size */ + samplesize = atoi(optarg); + break; + case 'u': /* sample size */ + unit = atof(optarg); + break; + case '?': /* Help Message */ + case 'h': + default: + print_usage(); exit (EXIT_FAILURE); + } + } + + /* name of configuration file */ + if (optind >= argc) { print_usage(); exit (EXIT_FAILURE); } + conffile = argv[optind]; + +#else + + /* name of configuration file */ + if (argc<2) { print_usage(); exit (EXIT_FAILURE); } + conffile = argv[1]; + + /* sample size */ + if (argc >= 3) + samplesize = atoi(argv[2]); + +#endif + + /* ------------------------------------------------------------------------*/ + + /* debugging and logging information */ + if (debug) + unur_set_default_debug(~0u); /* on */ + else + unur_set_default_debug(0u); /* off */ + + /* create lists for distributions and methods */ + distr_str_list = _unur_slist_new(); + meth_str_list = _unur_slist_new(); + + /* read config file */ + read_config_file(conffile, distr_str_list, meth_str_list); + + /* print legend */ + print_legend(distr_str_list,meth_str_list); + + /* get unit for relative timings */ + timing_unit = (unit <= 0.) ? get_timing_unit() : unit; + + /* make timings */ + time_0 = compute_timings(distr_str_list,meth_str_list,samplesize,duration,timing_unit); + + /* print timings */ + print_timing_legend(samplesize, timing_unit,((unit<= 0.)?TRUE:FALSE)); + print_timings(time_0,distr_str_list,meth_str_list,ROW_DISTRIBUTION); + print_timings(time_0,distr_str_list,meth_str_list,ROW_METHOD); + + /* free memory */ + _unur_slist_free(distr_str_list); + _unur_slist_free(meth_str_list); + free(time_0); + + exit (EXIT_SUCCESS); + +} /* end of main() */ + +/*---------------------------------------------------------------------------*/ + +double +get_timing_unit(void) + /* get unit for relative timings */ + /* (use generation of exponential random variate via inversion) */ +{ + UNUR_DISTR *distr; /* pointer to working distribution object */ + UNUR_PAR *par; /* pointer to working parameter object */ + static double timing_unit = -1.; /* timing result for basis of relative timings */ + + if (timing_unit < 0.) { + /* compute timing unit */ + distr = unur_distr_exponential(NULL,0); + par = unur_cstd_new(distr); + timing_unit = unur_test_timing_exponential(par, 6); + unur_par_free(par); + unur_distr_free(distr); + } + + return timing_unit; +} /* end of get_timing_unit() */ + +/*---------------------------------------------------------------------------*/ + +int +read_config_file ( const char *filename, + struct unur_slist *distr_str_list, struct unur_slist *meth_str_list ) + /* read config file */ +{ +#define LINELENGTH 10240 /* max length of lines allowed */ + + char line[LINELENGTH]; /* input buffer */ + char *str; /* pointer to working string */ + + FILE *fh; /* file handle for input stream */ + int line_no; /* counter for lines */ + + /* open the file with the data read-only */ + fh = fopen(filename, "r"); + if (fh == NULL) { + fprintf(stderr,"error: cannot open config file `%s'.\n",filename); + exit(EXIT_FAILURE); + } + + /* read lines until eof */ + line_no = 0; + while( fgets(line, LINELENGTH, fh) ) { + ++line_no; + + /* make a working copy of the line; */ + /* remove all white spaces and convert to lower case letters. */ + str = _unur_parser_prepare_string( line ); + + /* ignore all lines that do not start with a letter */ + if ( ! isalpha(str[0]) || str[0] == '#') { + free(str); + continue; + } + + /* store distribution object */ + if ( strncmp( str, "distr", (size_t)5)==0 ) { + _unur_slist_append(distr_str_list,str); + continue; + } + + /* store method (parameter object) */ + if ( strncmp( str, "method=", (size_t)7)==0 ) { + _unur_slist_append(meth_str_list,str); + continue; + } + + fprintf(stderr,"syntax error in line %d: %s\n",line_no,str); + exit (EXIT_FAILURE); + } + + /* close input stream */ + fclose(fh); + + /* check number of distributions and methods */ + if ( _unur_slist_length(distr_str_list) == 0 || + _unur_slist_length(meth_str_list) == 0 ) { + fprintf(stderr,"error: no distributions or methods given.\n"); + exit (EXIT_FAILURE); + } + + /* o.k. */ + return 1; + +#undef LINELENGTH + +} /* end of read_config_file() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_slist * +make_distr_list ( struct unur_slist *distr_str_list ) + /* make distribution objects */ +{ + struct unur_slist *distr_list; /* list of distributions */ + int n_distr; /* number of distributions */ + char *str; /* pointer to working string */ + UNUR_DISTR *distr; /* pointer to distribution object */ + int i; + + /* get number of distributions */ + n_distr = _unur_slist_length(distr_str_list); + + /* create lists for distributions and methods */ + distr_list = _unur_slist_new(); + + /* get all distribution objects */ + for (i=0; i\n",n_distr); + for (i=0; i\n",n_meth); + for (k=0; k\n"); + printf("Average generation times (including setup) for sample of size %d.\n",samplesize); + if (is_default) { + printf("Timings are relative to generation of exponential random variate\n"); + printf("using inversion within UNU.RAN environment\n"); + } + printf("(timing unit = %g microseconds)\n\n", unit); + return 1; +} /* end of print_timing_legend() */ + +/*---------------------------------------------------------------------------*/ + +int +print_label ( int n, int ltype ) + /* print label for distribution and methods with index n*/ +{ + switch(ltype) { + case 'a': + printf(" [%c]", 'a'+n); + break; + case 'A': + printf(" [%c]", 'A'+n); + break; + case '1': + default: + printf("[%02d]", 1+n); + break; + } + + return 1; +} /* end of print_label() */ + +/*---------------------------------------------------------------------------*/ + +double * +compute_timings ( struct unur_slist *distr_str_list, struct unur_slist *meth_str_list, + int samplesize, double duration, double timing_unit ) + /* compute timings table */ +{ + struct unur_slist *distr_list; /* list of distributions */ + int n_distr; /* number of distributions */ + int n_meth; /* number of methods */ + char *str; /* pointer to working string */ + UNUR_DISTR *distr; /* pointer to working distribution object */ + UNUR_PAR *par; /* pointer to working parameter object */ + int i,k; + struct unur_slist *mlist = NULL; /* list of allocated memory + blocks in running _unur_str2par() */ + double *timing; /* timing results */ + + /* get all distribution objects */ + distr_list = make_distr_list(distr_str_list); + + /* get number of distributions and methods */ + n_distr = _unur_slist_length(distr_str_list); + n_meth = _unur_slist_length(meth_str_list); + + /* allocate array for timings */ + timing = malloc(n_distr * n_meth * sizeof(double)); + + /* make timings */ + for (i=0; i\n"); + break; + case ROW_METHOD: + default: + /* print distributions on columns, methods in rows*/ + n_row = n_meth; + rltype = LABEL_METH; + n_col = n_distr; + cltype = LABEL_DISTR; + printf("\n"); + break; + } + + /* print table header */ + printf(" "); + for (row=0; row 0.) { + printf("%10.4g",timings[idx_time]); + } + else { + printf("%10s","--"); + } + } + printf("\n"); + } + printf("\n"); + + /* o.k. */ + return 1; +} /* end of print_timings() */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/experiments/timings_chap_10.conf b/vendor/unuran-1.11.0/experiments/timings_chap_10.conf new file mode 100644 index 0000000..9c16223 --- /dev/null +++ b/vendor/unuran-1.11.0/experiments/timings_chap_10.conf @@ -0,0 +1,48 @@ +# Timings for ARVAG, Chap. 8 +# -------------------------- +# +# Runtime approx (# distributions)x(# methods) +# + +# Distributions: +distr = discr; pmfsum=46.22619; pv=(0.4833,0.1034,0.1078,0.4275,0.449,0.164,0.1882,0.8197,0.05556,0.3701,0.2285,0.923,0.02765,0.8563,0.3065,0.6959,0.9116,0.8122,0.58,0.9536,0.415,0.6801,0.5578,0.8655,0.9317,0.5767,0.45,0.4381,0.4827,0.4127,0.2618,0.6184,0.4272,0.04263,0.03328,0.6954,0.3995,0.1863,0.7268,0.9995,0.4879,0.3741,0.1468,0.04585,0.07295,0.6941,0.589,0.1803,0.1412,0.1174,0.1391,0.7422,0.6585,0.7047,0.8773,0.1238,0.2313,0.662,0.844,0.4284,0.8317,0.4757,0.1172,0.4289,0.3438,0.1016,0.9704,0.3831,0.2708,0.4075,0.3814,0.2028,0.1296,0.2901,0.2423,0.4606,0.4711,0.5855,0.365,0.3367,0.2399,0.9235,0.521,0.9083,0.4081,0.4477,0.4038,0.4794,0.06433,0.3461,0.4334,0.09627,0.7935,0.9386,0.05207,0.8935,0.6639,0.6485,0.8098,0.4329) + +distr = discr; pmfsum=496.7561432; pv=(0.7472,0.9614,0.1895,0.947,0.2913,0.7556,0.103,0.995,0.9449,0.5864,0.3492,0.905,0.744,0.5745,0.3345,0.3965,0.4539,0.2156,0.03381,0.06004,0.6551,0.3588,0.7331,0.1497,0.9079,0.3974,0.5437,0.2026,0.6166,0.6418,0.4407,0.2077,0.6717,0.0554,0.09146,0.3027,0.9277,0.4809,0.7569,0.9062,0.4738,0.2653,0.7231,0.8462,0.8187,0.9065,0.99,0.6965,0.9108,0.5091,0.4463,0.4938,0.2942,0.8673,0.005628,0.2862,0.6225,0.8119,0.9142,0.9835,0.6948,0.331,0.1572,0.07726,0.221,0.06568,0.4341,0.2311,0.4024,0.1592,0.4442,0.5346,0.4916,0.65,0.9978,0.04076,0.1973,0.7828,0.9922,0.7546,0.5748,0.9709,0.07804,0.7711,0.88,0.6399,0.9208,0.6939,0.659,0.5742,0.4867,0.4628,0.2566,0.4151,0.04251,0.9282,0.7651,0.765,0.04467,0.8874,0.5677,0.9822,0.05246,0.1328,0.9929,0.01138,0.9744,0.3617,0.1129,0.3715,0.05362,0.6678,0.4539,0.7973,0.567,0.2051,0.1973,0.3822,0.5244,0.2769,0.4322,0.6172,0.4798,0.3895,0.8645,0.635,0.4273,0.2567,0.8716,0.6236,0.4529,0.895,0.7587,0.2521,0.3993,0.2272,0.3048,0.4548,0.8323,0.02217,0.1075,0.07261,0.3079,0.7453,0.6754,0.4554,0.8281,0.3558,0.8109,0.8204,0.4008,0.09905,0.9393,0.1969,0.9479,0.204,0.1806,0.9448,0.5486,0.9768,0.8758,0.4899,0.7163,0.9546,0.7683,0.4173,0.4084,0.2094,0.09292,0.9619,0.5803,0.8536,0.282,0.1415,0.1795,0.7545,0.3427,0.9446,0.2317,0.5505,0.1621,0.9999,0.683,0.5737,0.2862,0.5099,0.9667,0.6191,0.518,0.0926,0.5583,0.4097,0.425,0.1307,0.978,0.5561,0.143,0.9892,0.7984,0.8016,0.8003,0.04456,0.5668,0.2511,0.6383,0.04469,0.8837,0.6773,0.352,0.5348,0.917,0.05822,0.8341,0.4422,0.3587,0.6485,0.4091,0.3115,0.3807,0.09234,0.266,0.3223,0.5823,0.2908,0.4657,0.2778,0.01558,0.03969,0.8275,0.2331,0.1319,0.3624,0.4754,0.6983,0.2149,0.3041,0.6413,0.2561,0.8562,0.6557,0.2323,0.9446,0.4754,0.5633,0.9662,0.6223,0.8931,0.2726,0.5005,0.3446,0.8775,0.2329,0.6731,0.1115,0.7457,0.8705,0.1976,0.4132,0.5308,0.5664,0.5563,0.1571,0.6746,0.9107,0.324,0.2124,0.1992,0.3474,0.3577,0.5901,0.3061,0.07484,0.8572,0.2456,0.4285,0.842,0.1842,0.134,0.6829,0.9715,0.9865,0.7208,0.1521,0.4051,0.4303,0.5638,0.4775,0.4944,0.1063,0.3513,0.2783,0.147,0.7485,0.7612,0.9722,0.07213,0.8913,0.5156,0.5437,0.2302,0.7071,0.3816,0.8608,0.2587,0.7206,0.6608,0.7087,0.8536,0.2903,0.09699,0.2313,0.3592,0.1841,0.7457,0.9529,0.2123,0.4356,0.9845,0.9807,0.1401,0.5443,0.4688,0.437,0.91,0.8372,0.08725,0.5762,0.6513,0.1166,0.4265,0.8674,0.7977,0.8263,0.3295,0.6362,0.4384,0.6422,0.5838,0.6832,0.2261,0.2066,0.5993,0.7025,0.086,0.6624,0.1305,0.2655,0.176,0.8252,0.04326,0.6894,0.5247,0.7086,0.6168,0.8219,0.7271,0.8824,0.2873,0.1858,0.2886,0.2402,0.7034,0.5026,0.0625,0.03355,0.1041,0.8,0.9765,0.3712,0.9736,0.5345,0.8005,0.546,0.9303,0.8452,0.2758,0.8374,0.3136,0.02325,0.5487,0.955,0.0263,0.8375,0.2601,0.7148,0.3229,0.3349,0.1976,0.6813,0.2188,0.5349,0.2211,0.3101,0.2452,0.0003473,0.4206,0.7641,0.3149,0.1552,0.1448,0.9267,0.001311,0.1319,0.5961,0.9717,0.975,0.2944,0.336,0.2569,0.6522,0.9595,0.1385,0.5756,0.4334,0.4246,0.9174,0.2656,0.1882,0.4243,0.4968,0.5015,0.8733,0.2691,0.3521,0.5748,0.872,0.1372,0.756,0.603,0.897,0.8428,0.4199,0.3461,0.2448,0.8833,0.2815,0.7705,0.8115,0.4586,0.3641,0.505,0.6233,0.03434,0.8672,0.0035,0.75,0.7652,0.5152,0.4287,0.878,0.628,0.7592,0.8257,0.981,0.7853,0.3393,0.4796,0.7361,0.902,0.05779,0.709,0.9247,0.4434,0.6937,0.2041,0.3014,0.409,0.8265,0.2006,0.5514,0.6438,0.3113,0.7718,0.6735,0.01581,0.5521,0.9461,0.6925,0.2305,0.2129,0.4666,0.9564,0.3285,0.1551,0.7575,0.03174,0.8852,0.4614,0.5534,0.7303,0.4761,0.6349,0.3528,0.1789,0.8323,0.3235,0.581,0.5054,0.8165,0.7714,0.6349,0.8129,0.5859,0.5586,0.1683,0.8565,0.2574,0.4035,0.4108,0.8248,0.3722,0.9421,0.8574,0.09443,0.8961,0.3073,0.5046,0.9155,0.06382,0.9837,0.9236,0.4101,0.2473,0.2123,0.2887,0.5972,0.6614,0.6538,0.1203,0.7407,0.404,0.2503,0.7095,0.9159,0.03179,0.3081,0.8521,0.8214,0.1357,0.0008759,0.3476,0.9059,0.07186,0.01714,0.424,0.4958,0.8245,0.8048,0.1353,0.8987,0.1631,0.1511,0.015,0.158,0.7591,0.9008,0.3055,0.2422,0.7273,0.5926,0.4534,0.4207,0.5916,0.5917,0.1058,0.5148,0.5198,0.5746,0.6818,0.01894,0.6952,0.7698,0.5464,0.1203,0.5321,0.6187,0.5314,0.9622,0.773,0.718,0.2259,0.7201,0.04573,0.1253,0.7726,0.2994,0.4541,0.5336,0.6668,0.7846,0.9343,0.959,0.985,0.7657,0.2391,0.1892,0.4386,0.6454,0.707,0.5705,0.9071,0.6831,0.9339,0.8525,0.6812,0.963,0.8882,0.7271,0.9086,0.6637,0.4341,0.1935,0.2418,0.8791,0.4998,0.2346,0.2568,0.1134,0.2607,0.04536,0.8182,0.468,0.5537,0.4749,0.9111,0.7849,0.6198,0.6224,0.2299,0.8218,0.7316,0.8953,0.3213,0.1582,0.2975,0.7017,0.07945,0.2791,0.7977,0.4672,0.8226,0.1657,0.537,0.4218,0.004419,0.6977,0.9833,0.9469,0.09334,0.9128,0.3636,0.3245,0.8635,0.09094,0.632,0.4292,0.5422,0.9328,0.3346,0.7275,0.4627,0.6536,0.5369,0.2603,0.6401,0.4879,0.9998,0.8385,0.6357,0.7902,0.0165,0.8916,0.5423,0.8775,0.6529,0.5671,0.6789,0.7865,0.02092,0.1379,0.1367,0.8538,0.6864,0.4104,0.674,0.2001,0.1495,0.15,0.03386,0.7122,0.1497,0.3115,0.3982,0.922,0.1332,0.4199,0.8559,0.0445,0.4802,0.8528,0.177,0.258,0.4593,0.7149,0.0403,0.4042,0.7729,0.3045,0.3664,0.2041,0.6235,0.1544,0.3325,0.4919,0.4738,0.8429,0.9343,0.5699,0.3407,0.423,0.07843,0.5254,0.8604,0.5703,0.9014,0.2675,0.4011,0.8554,0.8611,0.8632,0.6282,0.5509,0.4948,0.6591,0.004726,0.3965,0.1623,0.1672,0.5309,0.5536,0.228,0.5973,0.1903,0.1306,0.1496,0.07185,0.3298,0.5603,0.2481,0.8044,0.9287,0.7049,0.387,0.9412,0.3005,0.1539,0.8922,0.282,0.2958,0.7574,0.7299,0.1148,0.7649,0.2038,0.5019,0.5175,0.5746,0.07328,0.3523,0.4457,0.2448,0.513,0.1042,0.6413,0.3161,0.8081,0.7172,0.7001,0.01557,0.6542,0.825,0.4181,0.7198,0.8967,0.09514,0.3033,0.9549,0.6929,0.5932,0.7858,0.3803,0.6196,0.2409,0.3401,0.1356,0.1066,0.1367,0.6988,0.8195,0.2985,0.4195,0.9987,0.8039,0.6443,0.5944,0.5806,0.08412,0.7476,0.4993,0.2773,0.1292,0.05468,0.906,0.4916,0.7488,0.435,0.6651,0.1515,0.6133,0.3284,0.5284,0.4526,0.7938,0.0299,0.1089,0.4539,0.9899,0.3856,0.5145,0.8733,0.9058,0.638,0.01521,0.5959,0.7766,0.5833,0.1092,0.1044,0.02772,0.1483,0.444,0.9529,0.4144,0.8198,0.9156,0.5003,0.6206,0.7899,0.8067,0.04638,0.6308,0.4044,0.2922,0.1731,0.725,0.7664,0.277,0.5771,0.9484,0.1831,0.1678,0.4728,0.9207,0.03485,0.7238,0.5199,0.5063,0.215,0.8082,0.01957,0.8856,0.4251,0.001493,0.9732,0.2549,0.0207,0.7093,0.8001,0.5299,0.2543,0.4324,0.2229,0.5814,0.0712,0.2646,0.7502,0.6607,0.03635,0.5408,0.2303,0.1544,0.8213,0.7326,0.2107,0.2688,0.3963,0.7311,0.2376,0.01396,0.3756,0.02181,0.4375,0.4841,0.1213,0.5894,0.2145,0.9027,0.05007,0.3249,0.4643,0.242,0.01372,0.7841,0.234,0.08753,0.1924,0.05146,0.02327,0.8187,0.7961,0.3203,0.7857,0.8047,0.4205,0.2985,0.3483,0.3206,0.2993,0.7091,0.1337,0.418,0.2492,0.3842,0.6694,0.176,0.2355,0.6001,0.4354,0.08845,0.0431,0.5486,0.4121,0.2697,0.247,0.2283,0.6264,0.465,0.8265,0.9298,0.2782,0.1443,0.5272,0.2207,0.1444,0.7264,0.278,0.8365,0.475,0.5504,0.04256,0.2364,0.03961,0.462,0.9995,0.6878,0.6275,0.1922,0.7525,0.4595,0.001042,0.7272,0.926,0.5297,0.7229,0.5829,0.3988,0.3089,0.5784,0.8565,0.1208,0.4724,0.1034,0.3061,0.07819,0.236,0.06382,0.8441,0.07872,0.5482,0.4364,0.6519,0.3263,0.08877,0.4353,0.9246,0.4002,0.5591,0.7124,0.3417,0.001461) + +distr = binomial(50,0.5) +distr = binomial(500,0.5) +distr = binomial(5000,0.5) + +distr = poisson(5) +distr = poisson(50) +distr = poisson(500) + +distr = hypergeometric(5000,500,50) +distr = hypergeometric(50000,5000,500) +distr = hypergeometric(500000,50000,5000) + +distr = logarithmic(0.01) +distr = logarithmic(0.5) +distr = logarithmic(0.99) + +# Methods: +method = dss + +method = dgt; guidefactor=0.2 +method = dgt; guidefactor=1 +method = dgt; guidefactor=4 + +method = dau; urnfactor=1 +method = dau; urnfactor=4 + +method = dari; squeeze=off; tablesize=100 +method = dari; squeeze=on; tablesize=100 +method = dari; squeeze=on; tablesize=0 +method = dari; squeeze=on; tablesize=1000 +method = dari; squeeze=off; tablesize=1000 + +method = dsrou +method = dsrou; cdfatmode=0.5 + + + diff --git a/vendor/unuran-1.11.0/experiments/timings_chap_8.conf b/vendor/unuran-1.11.0/experiments/timings_chap_8.conf new file mode 100644 index 0000000..f75160f --- /dev/null +++ b/vendor/unuran-1.11.0/experiments/timings_chap_8.conf @@ -0,0 +1,37 @@ +# Timings for ARVAG, Chap. 8 +# -------------------------- +# +# Runtime approx (# distributions)x(# methods) +# + +# Distributions: +distr = normal +distr = cauchy +distr = exponential +distr = gamma(3) +distr = beta(3,4) +distr = beta(30,40) +distr = cont; name="hyperbolic"; pdf="exp(-0.5*sqrt(1+x^2))"; pdfarea=3.31288224; mode=0. +distr = normal; domain=(0,0.5) +distr = powerexponential(3); orderstatistics=199,100; mode=0 + +# Methods: +method = tdr; variant_gw; c=0; cpoints=3; usedars; max_sqhratio=0.99; +method = tdr; variant_gw; c=-0.5; cpoints=3; usedars; max_sqhratio=0.99; +method = tdr; variant_ia; c=-0.5; cpoints=3; usedars; max_sqhratio=0.99; +method = tdr; variant_ps; c=-0.5; cpoints=3; usedars; max_sqhratio=0.99; +method = tdr; variant_ps; c=-0.5; cpoints=3; usedars; max_sqhratio=0.9; +method = tdr; variant_ps; c=-0.5; cpoints=3; usedars; max_sqhratio=0.5; +method = tdr; variant_ps; c=-0.5; cpoints=3; usedars=off; max_sqhratio=0.99; +method = utdr; +method = arou; cpoints=3; usedars; max_sqhratio=0.99; +method = tabl; usedars; nstp=5; max_intervals=10000; max_sqhratio=0.99; +method = tabl; usedars; nstp=5; areafraction=0.25; max_sqhratio=0.9; +method = srou +method = srou; cdfatmode=0.5; +method = srou; r=2; +method = ssr +method = ssr; cdfatmode=0.5; +method = ninv; useregula; +method = ninv; useregula; table=100; +method = hinv; order=3; u_resolution=1.e-9 diff --git a/vendor/unuran-1.11.0/libtool b/vendor/unuran-1.11.0/libtool new file mode 100755 index 0000000..85b73c4 --- /dev/null +++ b/vendor/unuran-1.11.0/libtool @@ -0,0 +1,12114 @@ +#! /bin/bash +# Generated automatically by config.status (unuran) 1.11.0 +# Libtool was configured on host wrdx: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + +# Copyright (C) 2014 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program or library that is built +# using GNU Libtool, you may include this file under the same +# distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +# The names of the tagged configurations supported by this script. +available_tags='CXX ' + +# Configured defaults for sys_lib_dlsearch_path munging. +: ${LT_SYS_LIBRARY_PATH=""} + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=2.4.7 +macro_revision=2.4.7 + +# Whether or not to build shared libraries. +build_libtool_libs=no + +# Whether or not to build static libraries. +build_old_libs=yes + +# What type of objects to build. +pic_mode=default + +# Whether or not to optimize for fast installation. +fast_install=needless + +# Shared archive member basename,for filename based shared library versioning on AIX. +shared_archive_member_spec= + +# Shell to use when invoking shell scripts. +SHELL="/bin/bash" + +# An echo program that protects backslashes. +ECHO="printf %s\\n" + +# The PATH separator for the build system. +PATH_SEPARATOR=":" + +# The host system. +host_alias= +host=x86_64-pc-linux-gnu +host_os=linux-gnu + +# The build system. +build_alias= +build=x86_64-pc-linux-gnu +build_os=linux-gnu + +# A sed program that does not truncate output. +SED="/usr/bin/sed" + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP="/usr/bin/grep" + +# An ERE matcher. +EGREP="/usr/bin/grep -E" + +# A literal string matcher. +FGREP="/usr/bin/grep -F" + +# A BSD- or MS-compatible name lister. +NM="/usr/bin/nm -B" + +# Whether we need soft or hard links. +LN_S="ln -s" + +# What is the maximum length of a command? +max_cmd_len=1572864 + +# Object file suffix (normally "o"). +objext=o + +# Executable file suffix (normally ""). +exeext= + +# whether the shell understands "unset". +lt_unset=unset + +# turn spaces into newlines. +SP2NL="tr \\040 \\012" + +# turn newlines into spaces. +NL2SP="tr \\015\\012 \\040\\040" + +# convert $build file names to $host format. +to_host_file_cmd=func_convert_file_noop + +# convert $build files to toolchain format. +to_tool_file_cmd=func_convert_file_noop + +# A file(cmd) program that detects file types. +FILECMD="file" + +# An object symbol dumper. +OBJDUMP="objdump" + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method="pass_all" + +# Command to use when deplibs_check_method = "file_magic". +file_magic_cmd="\$MAGIC_CMD" + +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob="" + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob="no" + +# DLL creation program. +DLLTOOL="false" + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd="printf %s\\n" + +# The archiver. +AR="ar" + +# Flags to create an archive (by configure). +lt_ar_flags=cr + +# Flags to create an archive. +AR_FLAGS=${ARFLAGS-"$lt_ar_flags"} + +# How to feed a file listing to the archiver. +archiver_list_spec="@" + +# A symbol stripping program. +STRIP="strip" + +# Commands used to install an old-style archive. +RANLIB="ranlib" +old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib" +old_postuninstall_cmds="" + +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=no + +# A C compiler. +LTCC="gcc" + +# LTCC compiler flags. +LTCFLAGS="-fPIC " + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe="/usr/bin/sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | /usr/bin/sed '/ __gnu_lto/d'" + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl="/usr/bin/sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'" + +# Transform the output of nm into a list of symbols to manually relocate. +global_symbol_to_import="" + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address="/usr/bin/sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p'" + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix="/usr/bin/sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(lib.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"lib\\1\", (void *) \\&\\1},/p'" + +# The name lister interface. +nm_interface="BSD nm" + +# Specify filename containing input files for $NM. +nm_file_list_spec="@" + +# The root where to search for dependent libraries,and where our libraries should be installed. +lt_sysroot= + +# Command to truncate a binary pipe. +lt_truncate_bin="/usr/bin/dd bs=4096 count=1" + +# The name of the directory that contains temporary libtool files. +objdir=.libs + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=file + +# Must we lock files when doing compilation? +need_locks="no" + +# Manifest tool. +MANIFEST_TOOL=":" + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL="" + +# Tool to change global to local symbols on Mac OS X. +NMEDIT="" + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO="" + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL="" + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64="" + +# Old archive suffix (normally "a"). +libext=a + +# Shared library suffix (normally ".so"). +shrext_cmds=".so" + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds="" + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" + +# Do we need the "lib" prefix for modules? +need_lib_prefix=no + +# Do we need a version for libraries? +need_version=no + +# Library versioning type. +version_type=linux + +# Shared library runtime path variable. +runpath_var=LD_RUN_PATH + +# Shared library path variable. +shlibpath_var=LD_LIBRARY_PATH + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=yes + +# Format of library name prefix. +libname_spec="lib\$name" + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec="\$libname\$release\$shared_ext\$versuffix \$libname\$release\$shared_ext\$major \$libname\$shared_ext" + +# The coded name of the library, if different from the real name. +soname_spec="\$libname\$release\$shared_ext\$major" + +# Permission mode override for installation of shared libraries. +install_override_mode="" + +# Command to use after installation of a shared archive. +postinstall_cmds="" + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds="" + +# Commands used to finish a libtool library installation in a directory. +finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval="" + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=yes + +# Compile-time system search path for libraries. +sys_lib_search_path_spec="/usr/lib/gcc/x86_64-linux-gnu/13 /usr/lib/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib " + +# Detected run-time system search path for libraries. +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/x86_64-linux-gnu/libfakeroot /usr/local/lib /usr/local/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu " + +# Explicit LT_SYS_LIBRARY_PATH set during ./configure time. +configure_time_lt_sys_library_path="" + +# Whether dlopen is supported. +dlopen_support=unknown + +# Whether dlopen of programs is supported. +dlopen_self=unknown + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=unknown + +# Commands to strip libraries. +old_striplib="strip --strip-debug" +striplib="strip --strip-unneeded" + + +# The linker used to build libraries. +LD="/usr/bin/ld -m elf_x86_64" + +# How to create reloadable object files. +reload_flag=" -r" +reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" + +# Commands used to build an old-style archive. +old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib" + +# A language specific compiler. +CC="gcc" + +# Is the compiler the GNU compiler? +with_gcc=yes + +# Compiler flag to turn off builtin functions. +no_builtin_flag=" -fno-builtin" + +# Additional compiler flags for building library objects. +pic_flag=" -fPIC -DPIC" + +# How to pass a linker flag through the compiler. +wl="-Wl," + +# Compiler flag to prevent dynamic linking. +link_static_flag="-static" + +# Does compiler simultaneously support -c and -o options? +compiler_c_o="yes" + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=yes + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=no + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec="\$wl--export-dynamic" + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive" + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object="no" + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds="" + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds="" + +# Commands used to build a shared archive. +archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname -o \$lib" +archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~ + cat \$export_symbols | \$SED -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~ + echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~ + \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname \$wl-version-script \$wl\$output_objdir/\$libname.ver -o \$lib" + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds="" +module_expsym_cmds="" + +# Whether we are building with GNU ld or not. +with_gnu_ld="yes" + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag="" + +# Flag that enforces no undefined symbols. +no_undefined_flag="" + +# Flag to hardcode $libdir into a binary during linking. +# This must work even if $libdir does not exist +hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir" + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator="" + +# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=no + +# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting $shlibpath_var if the +# library is relocated. +hardcode_direct_absolute=no + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=no + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=unsupported + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=no + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=no + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=unknown + +# Set to "yes" if exported symbols are required. +always_export_symbols=no + +# The commands to list exported symbols. +export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*" + +# Symbols that must always be exported. +include_expsyms="" + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds="" + +# Commands necessary for finishing linking programs. +postlink_cmds="" + +# Specify filename containing input files. +file_list_spec="" + +# How to hardcode a shared library path into an executable. +hardcode_action=immediate + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs="" + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects="" +postdep_objects="" +predeps="" +postdeps="" + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path="" + +# ### END LIBTOOL CONFIG + + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +#! /usr/bin/env sh +## DO NOT EDIT - This file generated from ./build-aux/ltmain.in +## by inline-source v2019-02-19.15 + +# libtool (GNU libtool) 2.4.7 +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996-2019, 2021-2022 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +PROGRAM=libtool +PACKAGE=libtool +VERSION=2.4.7 +package_revision=2.4.7 + + +## ------ ## +## Usage. ## +## ------ ## + +# Run './libtool --help' for help with using this script from the +# command line. + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# After configure completes, it has a better idea of some of the +# shell tools we need than the defaults used by the functions shared +# with bootstrap, so set those here where they can still be over- +# ridden by the user, but otherwise take precedence. + +: ${AUTOCONF="autoconf"} +: ${AUTOMAKE="automake"} + + +## -------------------------- ## +## Source external libraries. ## +## -------------------------- ## + +# Much of our low-level functionality needs to be sourced from external +# libraries, which are installed to $pkgauxdir. + +# Set a version string for this script. +scriptversion=2019-02-19.15; # UTC + +# General shell script boiler plate, and helper functions. +# Written by Gary V. Vaughan, 2004 + +# This is free software. There is NO warranty; not even for +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Copyright (C) 2004-2019, 2021 Bootstrap Authors +# +# This file is dual licensed under the terms of the MIT license +# , and GPL version 2 or later +# . You must apply one of +# these licenses when using or redistributing this software or any of +# the files within it. See the URLs above, or the file `LICENSE` +# included in the Bootstrap distribution for the full license texts. + +# Please report bugs or propose patches to: +# + + +## ------ ## +## Usage. ## +## ------ ## + +# Evaluate this file near the top of your script to gain access to +# the functions and variables defined here: +# +# . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh +# +# If you need to override any of the default environment variable +# settings, do that before evaluating this file. + + +## -------------------- ## +## Shell normalisation. ## +## -------------------- ## + +# Some shells need a little help to be as Bourne compatible as possible. +# Before doing anything else, make sure all that help has been provided! + +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac +fi + +# NLS nuisances: We save the old values in case they are required later. +_G_user_locale= +_G_safe_locale= +for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test set = \"\${$_G_var+set}\"; then + save_$_G_var=\$$_G_var + $_G_var=C + export $_G_var + _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" + _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" + fi" +done +# These NLS vars are set unconditionally (bootstrap issue #24). Unset those +# in case the environment reset is needed later and the $save_* variant is not +# defined (see the code above). +LC_ALL=C +LANGUAGE=C +export LANGUAGE LC_ALL + +# Make sure IFS has a sensible default +sp=' ' +nl=' +' +IFS="$sp $nl" + +# There are apparently some retarded systems that use ';' as a PATH separator! +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# func_unset VAR +# -------------- +# Portably unset VAR. +# In some shells, an 'unset VAR' statement leaves a non-zero return +# status if VAR is already unset, which might be problematic if the +# statement is used at the end of a function (thus poisoning its return +# value) or when 'set -e' is active (causing even a spurious abort of +# the script in this case). +func_unset () +{ + { eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; } +} + + +# Make sure CDPATH doesn't cause `cd` commands to output the target dir. +func_unset CDPATH + +# Make sure ${,E,F}GREP behave sanely. +func_unset GREP_OPTIONS + + +## ------------------------- ## +## Locate command utilities. ## +## ------------------------- ## + + +# func_executable_p FILE +# ---------------------- +# Check that FILE is an executable regular file. +func_executable_p () +{ + test -f "$1" && test -x "$1" +} + + +# func_path_progs PROGS_LIST CHECK_FUNC [PATH] +# -------------------------------------------- +# Search for either a program that responds to --version with output +# containing "GNU", or else returned by CHECK_FUNC otherwise, by +# trying all the directories in PATH with each of the elements of +# PROGS_LIST. +# +# CHECK_FUNC should accept the path to a candidate program, and +# set $func_check_prog_result if it truncates its output less than +# $_G_path_prog_max characters. +func_path_progs () +{ + _G_progs_list=$1 + _G_check_func=$2 + _G_PATH=${3-"$PATH"} + + _G_path_prog_max=0 + _G_path_prog_found=false + _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} + for _G_dir in $_G_PATH; do + IFS=$_G_save_IFS + test -z "$_G_dir" && _G_dir=. + for _G_prog_name in $_G_progs_list; do + for _exeext in '' .EXE; do + _G_path_prog=$_G_dir/$_G_prog_name$_exeext + func_executable_p "$_G_path_prog" || continue + case `"$_G_path_prog" --version 2>&1` in + *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; + *) $_G_check_func $_G_path_prog + func_path_progs_result=$func_check_prog_result + ;; + esac + $_G_path_prog_found && break 3 + done + done + done + IFS=$_G_save_IFS + test -z "$func_path_progs_result" && { + echo "no acceptable sed could be found in \$PATH" >&2 + exit 1 + } +} + + +# We want to be able to use the functions in this file before configure +# has figured out where the best binaries are kept, which means we have +# to search for them ourselves - except when the results are already set +# where we skip the searches. + +# Unless the user overrides by setting SED, search the path for either GNU +# sed, or the sed that truncates its output the least. +test -z "$SED" && { + _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for _G_i in 1 2 3 4 5 6 7; do + _G_sed_script=$_G_sed_script$nl$_G_sed_script + done + echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed + _G_sed_script= + + func_check_prog_sed () + { + _G_path_prog=$1 + + _G_count=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo '' >> conftest.nl + "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "sed gsed" func_check_prog_sed "$PATH:/usr/xpg4/bin" + rm -f conftest.sed + SED=$func_path_progs_result +} + + +# Unless the user overrides by setting GREP, search the path for either GNU +# grep, or the grep that truncates its output the least. +test -z "$GREP" && { + func_check_prog_grep () + { + _G_path_prog=$1 + + _G_count=0 + _G_path_prog_max=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo 'GREP' >> conftest.nl + "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "grep ggrep" func_check_prog_grep "$PATH:/usr/xpg4/bin" + GREP=$func_path_progs_result +} + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# All uppercase variable names are used for environment variables. These +# variables can be overridden by the user before calling a script that +# uses them if a suitable command of that name is not already available +# in the command search PATH. + +: ${CP="cp -f"} +: ${ECHO="printf %s\n"} +: ${EGREP="$GREP -E"} +: ${FGREP="$GREP -F"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} + + +## -------------------- ## +## Useful sed snippets. ## +## -------------------- ## + +sed_dirname='s|/[^/]*$||' +sed_basename='s|^.*/||' + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='s|\([`"$\\]\)|\\\1|g' + +# Same as above, but do not quote variable references. +sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' + +# Sed substitution that converts a w32 file name or path +# that contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + +# Re-'\' parameter expansions in output of sed_double_quote_subst that +# were '\'-ed in input to the same. If an odd number of '\' preceded a +# '$' in input to sed_double_quote_subst, that '$' was protected from +# expansion. Since each input '\' is now two '\'s, look for any number +# of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. +_G_bs='\\' +_G_bs2='\\\\' +_G_bs4='\\\\\\\\' +_G_dollar='\$' +sed_double_backslash="\ + s/$_G_bs4/&\\ +/g + s/^$_G_bs2$_G_dollar/$_G_bs&/ + s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g + s/\n//g" + +# require_check_ifs_backslash +# --------------------------- +# Check if we can use backslash as IFS='\' separator, and set +# $check_ifs_backshlash_broken to ':' or 'false'. +require_check_ifs_backslash=func_require_check_ifs_backslash +func_require_check_ifs_backslash () +{ + _G_save_IFS=$IFS + IFS='\' + _G_check_ifs_backshlash='a\\b' + for _G_i in $_G_check_ifs_backshlash + do + case $_G_i in + a) + check_ifs_backshlash_broken=false + ;; + '') + break + ;; + *) + check_ifs_backshlash_broken=: + break + ;; + esac + done + IFS=$_G_save_IFS + require_check_ifs_backslash=: +} + + +## ----------------- ## +## Global variables. ## +## ----------------- ## + +# Except for the global variables explicitly listed below, the following +# functions in the '^func_' namespace, and the '^require_' namespace +# variables initialised in the 'Resource management' section, sourcing +# this file will not pollute your global namespace with anything +# else. There's no portable way to scope variables in Bourne shell +# though, so actually running these functions will sometimes place +# results into a variable named after the function, and often use +# temporary variables in the '^_G_' namespace. If you are careful to +# avoid using those namespaces casually in your sourcing script, things +# should continue to work as you expect. And, of course, you can freely +# overwrite any of the functions or variables defined here before +# calling anything to customize them. + +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +# Allow overriding, eg assuming that you follow the convention of +# putting '$debug_cmd' at the start of all your functions, you can get +# bash to show function call trace with: +# +# debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name +debug_cmd=${debug_cmd-":"} +exit_cmd=: + +# By convention, finish your script with: +# +# exit $exit_status +# +# so that you can set exit_status to non-zero if you want to indicate +# something went wrong during execution without actually bailing out at +# the point of failure. +exit_status=$EXIT_SUCCESS + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath=$0 + +# The name of this program. +progname=`$ECHO "$progpath" |$SED "$sed_basename"` + +# Make sure we have an absolute progpath for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` + progdir=`cd "$progdir" && pwd` + progpath=$progdir/$progname + ;; + *) + _G_IFS=$IFS + IFS=${PATH_SEPARATOR-:} + for progdir in $PATH; do + IFS=$_G_IFS + test -x "$progdir/$progname" && break + done + IFS=$_G_IFS + test -n "$progdir" || progdir=`pwd` + progpath=$progdir/$progname + ;; +esac + + +## ----------------- ## +## Standard options. ## +## ----------------- ## + +# The following options affect the operation of the functions defined +# below, and should be set appropriately depending on run-time para- +# meters passed on the command line. + +opt_dry_run=false +opt_quiet=false +opt_verbose=false + +# Categories 'all' and 'none' are always available. Append any others +# you will pass as the first argument to func_warning from your own +# code. +warning_categories= + +# By default, display warnings according to 'opt_warning_types'. Set +# 'warning_func' to ':' to elide all warnings, or func_fatal_error to +# treat the next displayed warning as a fatal error. +warning_func=func_warn_and_continue + +# Set to 'all' to display all warnings, 'none' to suppress all +# warnings, or a space delimited list of some subset of +# 'warning_categories' to display only the listed warnings. +opt_warning_types=all + + +## -------------------- ## +## Resource management. ## +## -------------------- ## + +# This section contains definitions for functions that each ensure a +# particular resource (a file, or a non-empty configuration variable for +# example) is available, and if appropriate to extract default values +# from pertinent package files. Call them using their associated +# 'require_*' variable to ensure that they are executed, at most, once. +# +# It's entirely deliberate that calling these functions can set +# variables that don't obey the namespace limitations obeyed by the rest +# of this file, in order that that they be as useful as possible to +# callers. + + +# require_term_colors +# ------------------- +# Allow display of bold text on terminals that support it. +require_term_colors=func_require_term_colors +func_require_term_colors () +{ + $debug_cmd + + test -t 1 && { + # COLORTERM and USE_ANSI_COLORS environment variables take + # precedence, because most terminfo databases neglect to describe + # whether color sequences are supported. + test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} + + if test 1 = "$USE_ANSI_COLORS"; then + # Standard ANSI escape sequences + tc_reset='' + tc_bold=''; tc_standout='' + tc_red=''; tc_green='' + tc_blue=''; tc_cyan='' + else + # Otherwise trust the terminfo database after all. + test -n "`tput sgr0 2>/dev/null`" && { + tc_reset=`tput sgr0` + test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` + tc_standout=$tc_bold + test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` + test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` + test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` + test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` + test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` + } + fi + } + + require_term_colors=: +} + + +## ----------------- ## +## Function library. ## +## ----------------- ## + +# This section contains a variety of useful functions to call in your +# scripts. Take note of the portable wrappers for features provided by +# some modern shells, which will fall back to slower equivalents on +# less featureful shells. + + +# func_append VAR VALUE +# --------------------- +# Append VALUE onto the existing contents of VAR. + + # We should try to minimise forks, especially on Windows where they are + # unreasonably slow, so skip the feature probes when bash or zsh are + # being used: + if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then + : ${_G_HAVE_ARITH_OP="yes"} + : ${_G_HAVE_XSI_OPS="yes"} + # The += operator was introduced in bash 3.1 + case $BASH_VERSION in + [12].* | 3.0 | 3.0*) ;; + *) + : ${_G_HAVE_PLUSEQ_OP="yes"} + ;; + esac + fi + + # _G_HAVE_PLUSEQ_OP + # Can be empty, in which case the shell is probed, "yes" if += is + # useable or anything else if it does not work. + test -z "$_G_HAVE_PLUSEQ_OP" \ + && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ + && _G_HAVE_PLUSEQ_OP=yes + +if test yes = "$_G_HAVE_PLUSEQ_OP" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_append () + { + $debug_cmd + + eval "$1+=\$2" + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_append () + { + $debug_cmd + + eval "$1=\$$1\$2" + } +fi + + +# func_append_quoted VAR VALUE +# ---------------------------- +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +if test yes = "$_G_HAVE_PLUSEQ_OP"; then + eval 'func_append_quoted () + { + $debug_cmd + + func_quote_arg pretty "$2" + eval "$1+=\\ \$func_quote_arg_result" + }' +else + func_append_quoted () + { + $debug_cmd + + func_quote_arg pretty "$2" + eval "$1=\$$1\\ \$func_quote_arg_result" + } +fi + + +# func_append_uniq VAR VALUE +# -------------------------- +# Append unique VALUE onto the existing contents of VAR, assuming +# entries are delimited by the first character of VALUE. For example: +# +# func_append_uniq options " --another-option option-argument" +# +# will only append to $options if " --another-option option-argument " +# is not already present somewhere in $options already (note spaces at +# each end implied by leading space in second argument). +func_append_uniq () +{ + $debug_cmd + + eval _G_current_value='`$ECHO $'$1'`' + _G_delim=`expr "$2" : '\(.\)'` + + case $_G_delim$_G_current_value$_G_delim in + *"$2$_G_delim"*) ;; + *) func_append "$@" ;; + esac +} + + +# func_arith TERM... +# ------------------ +# Set func_arith_result to the result of evaluating TERMs. + test -z "$_G_HAVE_ARITH_OP" \ + && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ + && _G_HAVE_ARITH_OP=yes + +if test yes = "$_G_HAVE_ARITH_OP"; then + eval 'func_arith () + { + $debug_cmd + + func_arith_result=$(( $* )) + }' +else + func_arith () + { + $debug_cmd + + func_arith_result=`expr "$@"` + } +fi + + +# func_basename FILE +# ------------------ +# Set func_basename_result to FILE with everything up to and including +# the last / stripped. +if test yes = "$_G_HAVE_XSI_OPS"; then + # If this shell supports suffix pattern removal, then use it to avoid + # forking. Hide the definitions single quotes in case the shell chokes + # on unsupported syntax... + _b='func_basename_result=${1##*/}' + _d='case $1 in + */*) func_dirname_result=${1%/*}$2 ;; + * ) func_dirname_result=$3 ;; + esac' + +else + # ...otherwise fall back to using sed. + _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' + _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` + if test "X$func_dirname_result" = "X$1"; then + func_dirname_result=$3 + else + func_append func_dirname_result "$2" + fi' +fi + +eval 'func_basename () +{ + $debug_cmd + + '"$_b"' +}' + + +# func_dirname FILE APPEND NONDIR_REPLACEMENT +# ------------------------------------------- +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +eval 'func_dirname () +{ + $debug_cmd + + '"$_d"' +}' + + +# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT +# -------------------------------------------------------- +# Perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# For efficiency, we do not delegate to the functions above but instead +# duplicate the functionality here. +eval 'func_dirname_and_basename () +{ + $debug_cmd + + '"$_b"' + '"$_d"' +}' + + +# func_echo ARG... +# ---------------- +# Echo program name prefixed message. +func_echo () +{ + $debug_cmd + + _G_message=$* + + func_echo_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS + $ECHO "$progname: $_G_line" + done + IFS=$func_echo_IFS +} + + +# func_echo_all ARG... +# -------------------- +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + + +# func_echo_infix_1 INFIX ARG... +# ------------------------------ +# Echo program name, followed by INFIX on the first line, with any +# additional lines not showing INFIX. +func_echo_infix_1 () +{ + $debug_cmd + + $require_term_colors + + _G_infix=$1; shift + _G_indent=$_G_infix + _G_prefix="$progname: $_G_infix: " + _G_message=$* + + # Strip color escape sequences before counting printable length + for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" + do + test -n "$_G_tc" && { + _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` + _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` + } + done + _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes + + func_echo_infix_1_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_infix_1_IFS + $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 + _G_prefix=$_G_indent + done + IFS=$func_echo_infix_1_IFS +} + + +# func_error ARG... +# ----------------- +# Echo program name prefixed message to standard error. +func_error () +{ + $debug_cmd + + $require_term_colors + + func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 +} + + +# func_fatal_error ARG... +# ----------------------- +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + $debug_cmd + + func_error "$*" + exit $EXIT_FAILURE +} + + +# func_grep EXPRESSION FILENAME +# ----------------------------- +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $debug_cmd + + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_len STRING +# --------------- +# Set func_len_result to the length of STRING. STRING may not +# start with a hyphen. + test -z "$_G_HAVE_XSI_OPS" \ + && (eval 'x=a/b/c; + test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ + && _G_HAVE_XSI_OPS=yes + +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_len () + { + $debug_cmd + + func_len_result=${#1} + }' +else + func_len () + { + $debug_cmd + + func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` + } +fi + + +# func_mkdir_p DIRECTORY-PATH +# --------------------------- +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + $debug_cmd + + _G_directory_path=$1 + _G_dir_list= + + if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then + + # Protect directory names starting with '-' + case $_G_directory_path in + -*) _G_directory_path=./$_G_directory_path ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$_G_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + _G_dir_list=$_G_directory_path:$_G_dir_list + + # If the last portion added has no slash in it, the list is done + case $_G_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` + done + _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` + + func_mkdir_p_IFS=$IFS; IFS=: + for _G_dir in $_G_dir_list; do + IFS=$func_mkdir_p_IFS + # mkdir can fail with a 'File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$_G_dir" 2>/dev/null || : + done + IFS=$func_mkdir_p_IFS + + # Bail out if we (or some other process) failed to create a directory. + test -d "$_G_directory_path" || \ + func_fatal_error "Failed to create '$1'" + fi +} + + +# func_mktempdir [BASENAME] +# ------------------------- +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, BASENAME is the basename for that directory. +func_mktempdir () +{ + $debug_cmd + + _G_template=${TMPDIR-/tmp}/${1-$progname} + + if test : = "$opt_dry_run"; then + # Return a directory name, but don't create it in dry-run mode + _G_tmpdir=$_G_template-$$ + else + + # If mktemp works, use that first and foremost + _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` + + if test ! -d "$_G_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + _G_tmpdir=$_G_template-${RANDOM-0}$$ + + func_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$_G_tmpdir" + umask $func_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$_G_tmpdir" || \ + func_fatal_error "cannot create temporary directory '$_G_tmpdir'" + fi + + $ECHO "$_G_tmpdir" +} + + +# func_normal_abspath PATH +# ------------------------ +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +func_normal_abspath () +{ + $debug_cmd + + # These SED scripts presuppose an absolute path with a trailing slash. + _G_pathcar='s|^/\([^/]*\).*$|\1|' + _G_pathcdr='s|^/[^/]*||' + _G_removedotparts=':dotsl + s|/\./|/|g + t dotsl + s|/\.$|/|' + _G_collapseslashes='s|/\{1,\}|/|g' + _G_finalslash='s|/*$|/|' + + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` + while :; do + # Processed it all yet? + if test / = "$func_normal_abspath_tpath"; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result"; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + + +# func_notquiet ARG... +# -------------------- +# Echo program name prefixed message only when not in quiet mode. +func_notquiet () +{ + $debug_cmd + + $opt_quiet || func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + + +# func_relative_path SRCDIR DSTDIR +# -------------------------------- +# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. +func_relative_path () +{ + $debug_cmd + + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=$func_dirname_result + if test -z "$func_relative_path_tlibdir"; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test -n "$func_stripname_result"; then + func_append func_relative_path_result "/$func_stripname_result" + fi + + # Normalisation. If bindir is libdir, return '.' else relative path. + if test -n "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + fi + + test -n "$func_relative_path_result" || func_relative_path_result=. + + : +} + + +# func_quote_portable EVAL ARG +# ---------------------------- +# Internal function to portably implement func_quote_arg. Note that we still +# keep attention to performance here so we as much as possible try to avoid +# calling sed binary (so far O(N) complexity as long as func_append is O(1)). +func_quote_portable () +{ + $debug_cmd + + $require_check_ifs_backslash + + func_quote_portable_result=$2 + + # one-time-loop (easy break) + while true + do + if $1; then + func_quote_portable_result=`$ECHO "$2" | $SED \ + -e "$sed_double_quote_subst" -e "$sed_double_backslash"` + break + fi + + # Quote for eval. + case $func_quote_portable_result in + *[\\\`\"\$]*) + # Fallback to sed for $func_check_bs_ifs_broken=:, or when the string + # contains the shell wildcard characters. + case $check_ifs_backshlash_broken$func_quote_portable_result in + :*|*[\[\*\?]*) + func_quote_portable_result=`$ECHO "$func_quote_portable_result" \ + | $SED "$sed_quote_subst"` + break + ;; + esac + + func_quote_portable_old_IFS=$IFS + for _G_char in '\' '`' '"' '$' + do + # STATE($1) PREV($2) SEPARATOR($3) + set start "" "" + func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy + IFS=$_G_char + for _G_part in $func_quote_portable_result + do + case $1 in + quote) + func_append func_quote_portable_result "$3$2" + set quote "$_G_part" "\\$_G_char" + ;; + start) + set first "" "" + func_quote_portable_result= + ;; + first) + set quote "$_G_part" "" + ;; + esac + done + done + IFS=$func_quote_portable_old_IFS + ;; + *) ;; + esac + break + done + + func_quote_portable_unquoted_result=$func_quote_portable_result + case $func_quote_portable_result in + # double-quote args containing shell metacharacters to delay + # word splitting, command substitution and variable expansion + # for a subsequent eval. + # many bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_portable_result=\"$func_quote_portable_result\" + ;; + esac +} + + +# func_quotefast_eval ARG +# ----------------------- +# Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG', +# but optimized for speed. Result is stored in $func_quotefast_eval. +if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then + printf -v _GL_test_printf_tilde %q '~' + if test '\~' = "$_GL_test_printf_tilde"; then + func_quotefast_eval () + { + printf -v func_quotefast_eval_result %q "$1" + } + else + # Broken older Bash implementations. Make those faster too if possible. + func_quotefast_eval () + { + case $1 in + '~'*) + func_quote_portable false "$1" + func_quotefast_eval_result=$func_quote_portable_result + ;; + *) + printf -v func_quotefast_eval_result %q "$1" + ;; + esac + } + fi +else + func_quotefast_eval () + { + func_quote_portable false "$1" + func_quotefast_eval_result=$func_quote_portable_result + } +fi + + +# func_quote_arg MODEs ARG +# ------------------------ +# Quote one ARG to be evaled later. MODEs argument may contain zero or more +# specifiers listed below separated by ',' character. This function returns two +# values: +# i) func_quote_arg_result +# double-quoted (when needed), suitable for a subsequent eval +# ii) func_quote_arg_unquoted_result +# has all characters that are still active within double +# quotes backslashified. Available only if 'unquoted' is specified. +# +# Available modes: +# ---------------- +# 'eval' (default) +# - escape shell special characters +# 'expand' +# - the same as 'eval'; but do not quote variable references +# 'pretty' +# - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might +# be used later in func_quote to get output like: 'echo "a b"' instead +# of 'echo a\ b'. This is slower than default on some shells. +# 'unquoted' +# - produce also $func_quote_arg_unquoted_result which does not contain +# wrapping double-quotes. +# +# Examples for 'func_quote_arg pretty,unquoted string': +# +# string | *_result | *_unquoted_result +# ------------+-----------------------+------------------- +# " | \" | \" +# a b | "a b" | a b +# "a b" | "\"a b\"" | \"a b\" +# * | "*" | * +# z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\" +# +# Examples for 'func_quote_arg pretty,unquoted,expand string': +# +# string | *_result | *_unquoted_result +# --------------+---------------------+-------------------- +# z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\" +func_quote_arg () +{ + _G_quote_expand=false + case ,$1, in + *,expand,*) + _G_quote_expand=: + ;; + esac + + case ,$1, in + *,pretty,*|*,expand,*|*,unquoted,*) + func_quote_portable $_G_quote_expand "$2" + func_quote_arg_result=$func_quote_portable_result + func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result + ;; + *) + # Faster quote-for-eval for some shells. + func_quotefast_eval "$2" + func_quote_arg_result=$func_quotefast_eval_result + ;; + esac +} + + +# func_quote MODEs ARGs... +# ------------------------ +# Quote all ARGs to be evaled later and join them into single command. See +# func_quote_arg's description for more info. +func_quote () +{ + $debug_cmd + _G_func_quote_mode=$1 ; shift + func_quote_result= + while test 0 -lt $#; do + func_quote_arg "$_G_func_quote_mode" "$1" + if test -n "$func_quote_result"; then + func_append func_quote_result " $func_quote_arg_result" + else + func_append func_quote_result "$func_quote_arg_result" + fi + shift + done +} + + +# func_stripname PREFIX SUFFIX NAME +# --------------------------------- +# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_stripname () + { + $debug_cmd + + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary variable first. + func_stripname_result=$3 + func_stripname_result=${func_stripname_result#"$1"} + func_stripname_result=${func_stripname_result%"$2"} + }' +else + func_stripname () + { + $debug_cmd + + case $2 in + .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; + *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; + esac + } +fi + + +# func_show_eval CMD [FAIL_EXP] +# ----------------------------- +# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + $debug_cmd + + _G_cmd=$1 + _G_fail_exp=${2-':'} + + func_quote_arg pretty,expand "$_G_cmd" + eval "func_notquiet $func_quote_arg_result" + + $opt_dry_run || { + eval "$_G_cmd" + _G_status=$? + if test 0 -ne "$_G_status"; then + eval "(exit $_G_status); $_G_fail_exp" + fi + } +} + + +# func_show_eval_locale CMD [FAIL_EXP] +# ------------------------------------ +# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + $debug_cmd + + _G_cmd=$1 + _G_fail_exp=${2-':'} + + $opt_quiet || { + func_quote_arg expand,pretty "$_G_cmd" + eval "func_echo $func_quote_arg_result" + } + + $opt_dry_run || { + eval "$_G_user_locale + $_G_cmd" + _G_status=$? + eval "$_G_safe_locale" + if test 0 -ne "$_G_status"; then + eval "(exit $_G_status); $_G_fail_exp" + fi + } +} + + +# func_tr_sh +# ---------- +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + $debug_cmd + + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} + + +# func_verbose ARG... +# ------------------- +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $debug_cmd + + $opt_verbose && func_echo "$*" + + : +} + + +# func_warn_and_continue ARG... +# ----------------------------- +# Echo program name prefixed warning message to standard error. +func_warn_and_continue () +{ + $debug_cmd + + $require_term_colors + + func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 +} + + +# func_warning CATEGORY ARG... +# ---------------------------- +# Echo program name prefixed warning message to standard error. Warning +# messages can be filtered according to CATEGORY, where this function +# elides messages where CATEGORY is not listed in the global variable +# 'opt_warning_types'. +func_warning () +{ + $debug_cmd + + # CATEGORY must be in the warning_categories list! + case " $warning_categories " in + *" $1 "*) ;; + *) func_internal_error "invalid warning category '$1'" ;; + esac + + _G_category=$1 + shift + + case " $opt_warning_types " in + *" $_G_category "*) $warning_func ${1+"$@"} ;; + esac +} + + +# func_sort_ver VER1 VER2 +# ----------------------- +# 'sort -V' is not generally available. +# Note this deviates from the version comparison in automake +# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a +# but this should suffice as we won't be specifying old +# version formats or redundant trailing .0 in bootstrap.conf. +# If we did want full compatibility then we should probably +# use m4_version_compare from autoconf. +func_sort_ver () +{ + $debug_cmd + + printf '%s\n%s\n' "$1" "$2" \ + | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n +} + +# func_lt_ver PREV CURR +# --------------------- +# Return true if PREV and CURR are in the correct order according to +# func_sort_ver, otherwise false. Use it like this: +# +# func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." +func_lt_ver () +{ + $debug_cmd + + test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` +} + + +# Local variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-time-zone: "UTC" +# End: +#! /bin/sh + +# A portable, pluggable option parser for Bourne shell. +# Written by Gary V. Vaughan, 2010 + +# This is free software. There is NO warranty; not even for +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Copyright (C) 2010-2019, 2021 Bootstrap Authors +# +# This file is dual licensed under the terms of the MIT license +# , and GPL version 2 or later +# . You must apply one of +# these licenses when using or redistributing this software or any of +# the files within it. See the URLs above, or the file `LICENSE` +# included in the Bootstrap distribution for the full license texts. + +# Please report bugs or propose patches to: +# + +# Set a version string for this script. +scriptversion=2019-02-19.15; # UTC + + +## ------ ## +## Usage. ## +## ------ ## + +# This file is a library for parsing options in your shell scripts along +# with assorted other useful supporting features that you can make use +# of too. +# +# For the simplest scripts you might need only: +# +# #!/bin/sh +# . relative/path/to/funclib.sh +# . relative/path/to/options-parser +# scriptversion=1.0 +# func_options ${1+"$@"} +# eval set dummy "$func_options_result"; shift +# ...rest of your script... +# +# In order for the '--version' option to work, you will need to have a +# suitably formatted comment like the one at the top of this file +# starting with '# Written by ' and ending with '# Copyright'. +# +# For '-h' and '--help' to work, you will also need a one line +# description of your script's purpose in a comment directly above the +# '# Written by ' line, like the one at the top of this file. +# +# The default options also support '--debug', which will turn on shell +# execution tracing (see the comment above debug_cmd below for another +# use), and '--verbose' and the func_verbose function to allow your script +# to display verbose messages only when your user has specified +# '--verbose'. +# +# After sourcing this file, you can plug in processing for additional +# options by amending the variables from the 'Configuration' section +# below, and following the instructions in the 'Option parsing' +# section further down. + +## -------------- ## +## Configuration. ## +## -------------- ## + +# You should override these variables in your script after sourcing this +# file so that they reflect the customisations you have added to the +# option parser. + +# The usage line for option parsing errors and the start of '-h' and +# '--help' output messages. You can embed shell variables for delayed +# expansion at the time the message is displayed, but you will need to +# quote other shell meta-characters carefully to prevent them being +# expanded when the contents are evaled. +usage='$progpath [OPTION]...' + +# Short help message in response to '-h' and '--help'. Add to this or +# override it after sourcing this library to reflect the full set of +# options your script accepts. +usage_message="\ + --debug enable verbose shell tracing + -W, --warnings=CATEGORY + report the warnings falling in CATEGORY [all] + -v, --verbose verbosely report processing + --version print version information and exit + -h, --help print short or long help message and exit +" + +# Additional text appended to 'usage_message' in response to '--help'. +long_help_message=" +Warning categories include: + 'all' show all warnings + 'none' turn off all the warnings + 'error' warnings are treated as fatal errors" + +# Help message printed before fatal option parsing errors. +fatal_help="Try '\$progname --help' for more information." + + + +## ------------------------- ## +## Hook function management. ## +## ------------------------- ## + +# This section contains functions for adding, removing, and running hooks +# in the main code. A hook is just a list of function names that can be +# run in order later on. + +# func_hookable FUNC_NAME +# ----------------------- +# Declare that FUNC_NAME will run hooks added with +# 'func_add_hook FUNC_NAME ...'. +func_hookable () +{ + $debug_cmd + + func_append hookable_fns " $1" +} + + +# func_add_hook FUNC_NAME HOOK_FUNC +# --------------------------------- +# Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must +# first have been declared "hookable" by a call to 'func_hookable'. +func_add_hook () +{ + $debug_cmd + + case " $hookable_fns " in + *" $1 "*) ;; + *) func_fatal_error "'$1' does not accept hook functions." ;; + esac + + eval func_append ${1}_hooks '" $2"' +} + + +# func_remove_hook FUNC_NAME HOOK_FUNC +# ------------------------------------ +# Remove HOOK_FUNC from the list of hook functions to be called by +# FUNC_NAME. +func_remove_hook () +{ + $debug_cmd + + eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' +} + + +# func_propagate_result FUNC_NAME_A FUNC_NAME_B +# --------------------------------------------- +# If the *_result variable of FUNC_NAME_A _is set_, assign its value to +# *_result variable of FUNC_NAME_B. +func_propagate_result () +{ + $debug_cmd + + func_propagate_result_result=: + if eval "test \"\${${1}_result+set}\" = set" + then + eval "${2}_result=\$${1}_result" + else + func_propagate_result_result=false + fi +} + + +# func_run_hooks FUNC_NAME [ARG]... +# --------------------------------- +# Run all hook functions registered to FUNC_NAME. +# It's assumed that the list of hook functions contains nothing more +# than a whitespace-delimited list of legal shell function names, and +# no effort is wasted trying to catch shell meta-characters or preserve +# whitespace. +func_run_hooks () +{ + $debug_cmd + + case " $hookable_fns " in + *" $1 "*) ;; + *) func_fatal_error "'$1' does not support hook functions." ;; + esac + + eval _G_hook_fns=\$$1_hooks; shift + + for _G_hook in $_G_hook_fns; do + func_unset "${_G_hook}_result" + eval $_G_hook '${1+"$@"}' + func_propagate_result $_G_hook func_run_hooks + if $func_propagate_result_result; then + eval set dummy "$func_run_hooks_result"; shift + fi + done +} + + + +## --------------- ## +## Option parsing. ## +## --------------- ## + +# In order to add your own option parsing hooks, you must accept the +# full positional parameter list from your hook function. You may remove +# or edit any options that you action, and then pass back the remaining +# unprocessed options in '_result', escaped +# suitably for 'eval'. +# +# The '_result' variable is automatically unset +# before your hook gets called; for best performance, only set the +# *_result variable when necessary (i.e. don't call the 'func_quote' +# function unnecessarily because it can be an expensive operation on some +# machines). +# +# Like this: +# +# my_options_prep () +# { +# $debug_cmd +# +# # Extend the existing usage message. +# usage_message=$usage_message' +# -s, --silent don'\''t print informational messages +# ' +# # No change in '$@' (ignored completely by this hook). Leave +# # my_options_prep_result variable intact. +# } +# func_add_hook func_options_prep my_options_prep +# +# +# my_silent_option () +# { +# $debug_cmd +# +# args_changed=false +# +# # Note that, for efficiency, we parse as many options as we can +# # recognise in a loop before passing the remainder back to the +# # caller on the first unrecognised argument we encounter. +# while test $# -gt 0; do +# opt=$1; shift +# case $opt in +# --silent|-s) opt_silent=: +# args_changed=: +# ;; +# # Separate non-argument short options: +# -s*) func_split_short_opt "$_G_opt" +# set dummy "$func_split_short_opt_name" \ +# "-$func_split_short_opt_arg" ${1+"$@"} +# shift +# args_changed=: +# ;; +# *) # Make sure the first unrecognised option "$_G_opt" +# # is added back to "$@" in case we need it later, +# # if $args_changed was set to 'true'. +# set dummy "$_G_opt" ${1+"$@"}; shift; break ;; +# esac +# done +# +# # Only call 'func_quote' here if we processed at least one argument. +# if $args_changed; then +# func_quote eval ${1+"$@"} +# my_silent_option_result=$func_quote_result +# fi +# } +# func_add_hook func_parse_options my_silent_option +# +# +# my_option_validation () +# { +# $debug_cmd +# +# $opt_silent && $opt_verbose && func_fatal_help "\ +# '--silent' and '--verbose' options are mutually exclusive." +# } +# func_add_hook func_validate_options my_option_validation +# +# You'll also need to manually amend $usage_message to reflect the extra +# options you parse. It's preferable to append if you can, so that +# multiple option parsing hooks can be added safely. + + +# func_options_finish [ARG]... +# ---------------------------- +# Finishing the option parse loop (call 'func_options' hooks ATM). +func_options_finish () +{ + $debug_cmd + + func_run_hooks func_options ${1+"$@"} + func_propagate_result func_run_hooks func_options_finish +} + + +# func_options [ARG]... +# --------------------- +# All the functions called inside func_options are hookable. See the +# individual implementations for details. +func_hookable func_options +func_options () +{ + $debug_cmd + + _G_options_quoted=false + + for my_func in options_prep parse_options validate_options options_finish + do + func_unset func_${my_func}_result + func_unset func_run_hooks_result + eval func_$my_func '${1+"$@"}' + func_propagate_result func_$my_func func_options + if $func_propagate_result_result; then + eval set dummy "$func_options_result"; shift + _G_options_quoted=: + fi + done + + $_G_options_quoted || { + # As we (func_options) are top-level options-parser function and + # nobody quoted "$@" for us yet, we need to do it explicitly for + # caller. + func_quote eval ${1+"$@"} + func_options_result=$func_quote_result + } +} + + +# func_options_prep [ARG]... +# -------------------------- +# All initialisations required before starting the option parse loop. +# Note that when calling hook functions, we pass through the list of +# positional parameters. If a hook function modifies that list, and +# needs to propagate that back to rest of this script, then the complete +# modified list must be put in 'func_run_hooks_result' before returning. +func_hookable func_options_prep +func_options_prep () +{ + $debug_cmd + + # Option defaults: + opt_verbose=false + opt_warning_types= + + func_run_hooks func_options_prep ${1+"$@"} + func_propagate_result func_run_hooks func_options_prep +} + + +# func_parse_options [ARG]... +# --------------------------- +# The main option parsing loop. +func_hookable func_parse_options +func_parse_options () +{ + $debug_cmd + + _G_parse_options_requote=false + # this just eases exit handling + while test $# -gt 0; do + # Defer to hook functions for initial option parsing, so they + # get priority in the event of reusing an option name. + func_run_hooks func_parse_options ${1+"$@"} + func_propagate_result func_run_hooks func_parse_options + if $func_propagate_result_result; then + eval set dummy "$func_parse_options_result"; shift + # Even though we may have changed "$@", we passed the "$@" array + # down into the hook and it quoted it for us (because we are in + # this if-branch). No need to quote it again. + _G_parse_options_requote=false + fi + + # Break out of the loop if we already parsed every option. + test $# -gt 0 || break + + # We expect that one of the options parsed in this function matches + # and thus we remove _G_opt from "$@" and need to re-quote. + _G_match_parse_options=: + _G_opt=$1 + shift + case $_G_opt in + --debug|-x) debug_cmd='set -x' + func_echo "enabling shell trace mode" >&2 + $debug_cmd + ;; + + --no-warnings|--no-warning|--no-warn) + set dummy --warnings none ${1+"$@"} + shift + ;; + + --warnings|--warning|-W) + if test $# = 0 && func_missing_arg $_G_opt; then + _G_parse_options_requote=: + break + fi + case " $warning_categories $1" in + *" $1 "*) + # trailing space prevents matching last $1 above + func_append_uniq opt_warning_types " $1" + ;; + *all) + opt_warning_types=$warning_categories + ;; + *none) + opt_warning_types=none + warning_func=: + ;; + *error) + opt_warning_types=$warning_categories + warning_func=func_fatal_error + ;; + *) + func_fatal_error \ + "unsupported warning category: '$1'" + ;; + esac + shift + ;; + + --verbose|-v) opt_verbose=: ;; + --version) func_version ;; + -\?|-h) func_usage ;; + --help) func_help ;; + + # Separate optargs to long options (plugins may need this): + --*=*) func_split_equals "$_G_opt" + set dummy "$func_split_equals_lhs" \ + "$func_split_equals_rhs" ${1+"$@"} + shift + ;; + + # Separate optargs to short options: + -W*) + func_split_short_opt "$_G_opt" + set dummy "$func_split_short_opt_name" \ + "$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-v*|-x*) + func_split_short_opt "$_G_opt" + set dummy "$func_split_short_opt_name" \ + "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) _G_parse_options_requote=: ; break ;; + -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; + *) set dummy "$_G_opt" ${1+"$@"}; shift + _G_match_parse_options=false + break + ;; + esac + + if $_G_match_parse_options; then + _G_parse_options_requote=: + fi + done + + if $_G_parse_options_requote; then + # save modified positional parameters for caller + func_quote eval ${1+"$@"} + func_parse_options_result=$func_quote_result + fi +} + + +# func_validate_options [ARG]... +# ------------------------------ +# Perform any sanity checks on option settings and/or unconsumed +# arguments. +func_hookable func_validate_options +func_validate_options () +{ + $debug_cmd + + # Display all warnings if -W was not given. + test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" + + func_run_hooks func_validate_options ${1+"$@"} + func_propagate_result func_run_hooks func_validate_options + + # Bail if the options were screwed! + $exit_cmd $EXIT_FAILURE +} + + + +## ----------------- ## +## Helper functions. ## +## ----------------- ## + +# This section contains the helper functions used by the rest of the +# hookable option parser framework in ascii-betical order. + + +# func_fatal_help ARG... +# ---------------------- +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + $debug_cmd + + eval \$ECHO \""Usage: $usage"\" + eval \$ECHO \""$fatal_help"\" + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + + +# func_help +# --------- +# Echo long help message to standard output and exit. +func_help () +{ + $debug_cmd + + func_usage_message + $ECHO "$long_help_message" + exit 0 +} + + +# func_missing_arg ARGNAME +# ------------------------ +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + $debug_cmd + + func_error "Missing argument for '$1'." + exit_cmd=exit +} + + +# func_split_equals STRING +# ------------------------ +# Set func_split_equals_lhs and func_split_equals_rhs shell variables +# after splitting STRING at the '=' sign. +test -z "$_G_HAVE_XSI_OPS" \ + && (eval 'x=a/b/c; + test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ + && _G_HAVE_XSI_OPS=yes + +if test yes = "$_G_HAVE_XSI_OPS" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_split_equals () + { + $debug_cmd + + func_split_equals_lhs=${1%%=*} + func_split_equals_rhs=${1#*=} + if test "x$func_split_equals_lhs" = "x$1"; then + func_split_equals_rhs= + fi + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_split_equals () + { + $debug_cmd + + func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` + func_split_equals_rhs= + test "x$func_split_equals_lhs=" = "x$1" \ + || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` + } +fi #func_split_equals + + +# func_split_short_opt SHORTOPT +# ----------------------------- +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +if test yes = "$_G_HAVE_XSI_OPS" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_split_short_opt () + { + $debug_cmd + + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"} + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_split_short_opt () + { + $debug_cmd + + func_split_short_opt_name=`expr "x$1" : 'x\(-.\)'` + func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` + } +fi #func_split_short_opt + + +# func_usage +# ---------- +# Echo short help message to standard output and exit. +func_usage () +{ + $debug_cmd + + func_usage_message + $ECHO "Run '$progname --help |${PAGER-more}' for full usage" + exit 0 +} + + +# func_usage_message +# ------------------ +# Echo short help message to standard output. +func_usage_message () +{ + $debug_cmd + + eval \$ECHO \""Usage: $usage"\" + echo + $SED -n 's|^# || + /^Written by/{ + x;p;x + } + h + /^Written by/q' < "$progpath" + echo + eval \$ECHO \""$usage_message"\" +} + + +# func_version +# ------------ +# Echo version message to standard output and exit. +# The version message is extracted from the calling file's header +# comments, with leading '# ' stripped: +# 1. First display the progname and version +# 2. Followed by the header comment line matching /^# Written by / +# 3. Then a blank line followed by the first following line matching +# /^# Copyright / +# 4. Immediately followed by any lines between the previous matches, +# except lines preceding the intervening completely blank line. +# For example, see the header comments of this file. +func_version () +{ + $debug_cmd + + printf '%s\n' "$progname $scriptversion" + $SED -n ' + /^# Written by /!b + s|^# ||; p; n + + :fwd2blnk + /./ { + n + b fwd2blnk + } + p; n + + :holdwrnt + s|^# || + s|^# *$|| + /^Copyright /!{ + /./H + n + b holdwrnt + } + + s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| + G + s|\(\n\)\n*|\1|g + p; q' < "$progpath" + + exit $? +} + + +# Local variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-time-zone: "UTC" +# End: + +# Set a version string. +scriptversion='(GNU libtool) 2.4.7' + + +# func_echo ARG... +# ---------------- +# Libtool also displays the current mode in messages, so override +# funclib.sh func_echo with this custom definition. +func_echo () +{ + $debug_cmd + + _G_message=$* + + func_echo_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS + $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" + done + IFS=$func_echo_IFS +} + + +# func_warning ARG... +# ------------------- +# Libtool warnings are not categorized, so override funclib.sh +# func_warning with this simpler definition. +func_warning () +{ + $debug_cmd + + $warning_func ${1+"$@"} +} + + +## ---------------- ## +## Options parsing. ## +## ---------------- ## + +# Hook in the functions to make sure our own options are parsed during +# the option parsing loop. + +usage='$progpath [OPTION]... [MODE-ARG]...' + +# Short help message in response to '-h'. +usage_message="Options: + --config show all configuration variables + --debug enable verbose shell tracing + -n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --mode=MODE use operation mode MODE + --no-warnings equivalent to '-Wnone' + --preserve-dup-deps don't remove duplicate dependency libraries + --quiet, --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + -v, --verbose print more informational messages than default + --version print version information + -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] + -h, --help, --help-all print short, long, or detailed help message +" + +# Additional text appended to 'usage_message' in response to '--help'. +func_help () +{ + $debug_cmd + + func_usage_message + $ECHO "$long_help_message + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. When passed as first option, +'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. +Try '$progname --help --mode=MODE' for a more detailed description of MODE. + +When reporting a bug, please describe a test case to reproduce it and +include the following information: + + host-triplet: $host + shell: $SHELL + compiler: $LTCC + compiler flags: $LTCFLAGS + linker: $LD (gnu? $with_gnu_ld) + version: $progname (GNU libtool) 2.4.7 + automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` + autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` + +Report bugs to . +GNU libtool home page: . +General help using GNU software: ." + exit 0 +} + + +# func_lo2o OBJECT-NAME +# --------------------- +# Transform OBJECT-NAME from a '.lo' suffix to the platform specific +# object suffix. + +lo2o=s/\\.lo\$/.$objext/ +o2lo=s/\\.$objext\$/.lo/ + +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_lo2o () + { + case $1 in + *.lo) func_lo2o_result=${1%.lo}.$objext ;; + * ) func_lo2o_result=$1 ;; + esac + }' + + # func_xform LIBOBJ-OR-SOURCE + # --------------------------- + # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) + # suffix to a '.lo' libtool-object suffix. + eval 'func_xform () + { + func_xform_result=${1%.*}.lo + }' +else + # ...otherwise fall back to using sed. + func_lo2o () + { + func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` + } + + func_xform () + { + func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` + } +fi + + +# func_fatal_configuration ARG... +# ------------------------------- +# Echo program name prefixed message to standard error, followed by +# a configuration failure hint, and exit. +func_fatal_configuration () +{ + func_fatal_error ${1+"$@"} \ + "See the $PACKAGE documentation for more information." \ + "Fatal configuration error." +} + + +# func_config +# ----------- +# Display the configuration for all the tags in this script. +func_config () +{ + re_begincf='^# ### BEGIN LIBTOOL' + re_endcf='^# ### END LIBTOOL' + + # Default configuration. + $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" + + # Now print the configurations for the tags. + for tagname in $taglist; do + $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" + done + + exit $? +} + + +# func_features +# ------------- +# Display the features supported by this script. +func_features () +{ + echo "host: $host" + if test yes = "$build_libtool_libs"; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test yes = "$build_old_libs"; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + + exit $? +} + + +# func_enable_tag TAGNAME +# ----------------------- +# Verify that TAGNAME is valid, and either flag an error and exit, or +# enable the TAGNAME tag. We also add TAGNAME to the global $taglist +# variable here. +func_enable_tag () +{ + # Global variable: + tagname=$1 + + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf=/$re_begincf/,/$re_endcf/p + + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" + ;; + esac + + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; + *) + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + + +# func_check_version_match +# ------------------------ +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +# libtool_options_prep [ARG]... +# ----------------------------- +# Preparation for options parsed by libtool. +libtool_options_prep () +{ + $debug_mode + + # Option defaults: + opt_config=false + opt_dlopen= + opt_dry_run=false + opt_help=false + opt_mode= + opt_preserve_dup_deps=false + opt_quiet=false + + nonopt= + preserve_args= + + _G_rc_lt_options_prep=: + + # Shorthand for --mode=foo, only valid as the first argument + case $1 in + clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; + compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; + execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; + finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; + install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; + link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; + uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; + *) + _G_rc_lt_options_prep=false + ;; + esac + + if $_G_rc_lt_options_prep; then + # Pass back the list of options. + func_quote eval ${1+"$@"} + libtool_options_prep_result=$func_quote_result + fi +} +func_add_hook func_options_prep libtool_options_prep + + +# libtool_parse_options [ARG]... +# --------------------------------- +# Provide handling for libtool specific options. +libtool_parse_options () +{ + $debug_cmd + + _G_rc_lt_parse_options=false + + # Perform our own loop to consume as many options as possible in + # each iteration. + while test $# -gt 0; do + _G_match_lt_parse_options=: + _G_opt=$1 + shift + case $_G_opt in + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + + --config) func_config ;; + + --dlopen|-dlopen) + opt_dlopen="${opt_dlopen+$opt_dlopen +}$1" + shift + ;; + + --preserve-dup-deps) + opt_preserve_dup_deps=: ;; + + --features) func_features ;; + + --finish) set dummy --mode finish ${1+"$@"}; shift ;; + + --help) opt_help=: ;; + + --help-all) opt_help=': help-all' ;; + + --mode) test $# = 0 && func_missing_arg $_G_opt && break + opt_mode=$1 + case $1 in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $_G_opt" + exit_cmd=exit + break + ;; + esac + shift + ;; + + --no-silent|--no-quiet) + opt_quiet=false + func_append preserve_args " $_G_opt" + ;; + + --no-warnings|--no-warning|--no-warn) + opt_warning=false + func_append preserve_args " $_G_opt" + ;; + + --no-verbose) + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --silent|--quiet) + opt_quiet=: + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --tag) test $# = 0 && func_missing_arg $_G_opt && break + opt_tag=$1 + func_append preserve_args " $_G_opt $1" + func_enable_tag "$1" + shift + ;; + + --verbose|-v) opt_quiet=false + opt_verbose=: + func_append preserve_args " $_G_opt" + ;; + + # An option not handled by this hook function: + *) set dummy "$_G_opt" ${1+"$@"} ; shift + _G_match_lt_parse_options=false + break + ;; + esac + $_G_match_lt_parse_options && _G_rc_lt_parse_options=: + done + + if $_G_rc_lt_parse_options; then + # save modified positional parameters for caller + func_quote eval ${1+"$@"} + libtool_parse_options_result=$func_quote_result + fi +} +func_add_hook func_parse_options libtool_parse_options + + + +# libtool_validate_options [ARG]... +# --------------------------------- +# Perform any sanity checks on option settings and/or unconsumed +# arguments. +libtool_validate_options () +{ + # save first non-option argument + if test 0 -lt $#; then + nonopt=$1 + shift + fi + + # preserve --debug + test : = "$debug_cmd" || func_append preserve_args " --debug" + + case $host in + # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 + # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 + *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + + $opt_help || { + # Sanity checks first: + func_check_version_match + + test yes != "$build_libtool_libs" \ + && test yes != "$build_old_libs" \ + && func_fatal_configuration "not configured to build any kind of library" + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test execute != "$opt_mode"; then + func_error "unrecognized option '-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help=$help + help="Try '$progname --help --mode=$opt_mode' for more information." + } + + # Pass back the unparsed argument list + func_quote eval ${1+"$@"} + libtool_validate_options_result=$func_quote_result +} +func_add_hook func_validate_options libtool_validate_options + + +# Process options as early as possible so that --help and --version +# can return quickly. +func_options ${1+"$@"} +eval set dummy "$func_options_result"; shift + + + +## ----------- ## +## Main. ## +## ----------- ## + +magic='%%%MAGIC variable%%%' +magic_exe='%%%MAGIC EXE variable%%%' + +# Global variables. +extracted_archives= +extracted_serial=0 + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# func_generated_by_libtool +# True iff stdin has been generated by Libtool. This function is only +# a basic sanity check; it will hardly flush out determined imposters. +func_generated_by_libtool_p () +{ + $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_p file +# True iff FILE is a libtool '.la' library or '.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool '.la' library or '.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if 'file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case $lalib_p_line in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test yes = "$lalib_p" +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + test -f "$1" && + $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $debug_cmd + + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$sp$nl + eval cmd=\"$cmd\" + IFS=$save_ifs + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# 'FILE.' does not work on cygwin managed mounts. +func_source () +{ + $debug_cmd + + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result + ;; + esac +} + +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case $lt_sysroot:$1 in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result='='$func_stripname_result + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $debug_cmd + + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case "$@ " in + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with '--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=$1 + if test yes = "$build_libtool_libs"; then + write_lobj=\'$2\' + else + write_lobj=none + fi + + if test yes = "$build_old_libs"; then + write_oldobj=\'$3\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T </dev/null` + if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= + fi + fi +} +# end: func_convert_core_file_wine_to_w32 + + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $debug_cmd + + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result= + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result"; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi + fi + done + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $debug_cmd + + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $debug_cmd + + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 + + +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $debug_cmd + + if test -z "$2" && test -n "$1"; then + func_error "Could not determine host file name corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result=$1 + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $debug_cmd + + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " '$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result=$3 + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $debug_cmd + + case $4 in + $1 ) func_to_host_path_result=$3$func_to_host_path_result + ;; + esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep + + +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via '$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $debug_cmd + + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $debug_cmd + + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 + ;; + *) + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result + ;; + esac +} +# end func_to_tool_file + + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result=$1 +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result=$func_convert_core_msys_to_w32_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 + + +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 + + +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result=$func_convert_core_file_wine_to_w32_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 + + +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result=$func_cygpath_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin + + +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result=$func_cygpath_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via '$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $debug_cmd + + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd=func_convert_path_$func_stripname_result + fi +} + + +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $debug_cmd + + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path + + +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result=$1 +} +# end func_convert_path_noop + + +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result=$func_convert_core_msys_to_w32_result + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 + + +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 + + +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result=$func_convert_core_path_wine_to_w32_result + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_nix_to_w32 + + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result=$func_cygpath_result + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result=$func_cygpath_result + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_nix_to_cygwin + + +# func_dll_def_p FILE +# True iff FILE is a Windows DLL '.def' file. +# Keep in sync with _LT_DLL_DEF_P in libtool.m4 +func_dll_def_p () +{ + $debug_cmd + + func_dll_def_p_tmp=`$SED -n \ + -e 's/^[ ]*//' \ + -e '/^\(;.*\)*$/d' \ + -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ + -e q \ + "$1"` + test DEF = "$func_dll_def_p_tmp" +} + + +# func_mode_compile arg... +func_mode_compile () +{ + $debug_cmd + + # Get the compilation command and the source file. + base_compile= + srcfile=$nonopt # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + pie_flag= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg=$arg + arg_mode=normal + ;; + + target ) + libobj=$arg + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + test -n "$libobj" && \ + func_fatal_error "you cannot specify '-o' more than once" + arg_mode=target + continue + ;; + + -pie | -fpie | -fPIE) + func_append pie_flag " $arg" + continue + ;; + + -shared | -static | -prefer-pic | -prefer-non-pic) + func_append later " $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + lastarg= + save_ifs=$IFS; IFS=, + for arg in $args; do + IFS=$save_ifs + func_append_quoted lastarg "$arg" + done + IFS=$save_ifs + func_stripname ' ' '' "$lastarg" + lastarg=$func_stripname_result + + # Add the arguments to base_compile. + func_append base_compile " $lastarg" + continue + ;; + + *) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg=$srcfile + srcfile=$arg + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + func_append_quoted base_compile "$lastarg" + done # for arg + + case $arg_mode in + arg) + func_fatal_error "you must specify an argument for -Xcompile" + ;; + target) + func_fatal_error "you must specify a target with '-o'" + ;; + *) + # Get the name of the library object. + test -z "$libobj" && { + func_basename "$srcfile" + libobj=$func_basename_result + } + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + case $libobj in + *.[cCFSifmso] | \ + *.ada | *.adb | *.ads | *.asm | \ + *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ + *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) + func_xform "$libobj" + libobj=$func_xform_result + ;; + esac + + case $libobj in + *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; + *) + func_fatal_error "cannot determine name of library object from '$libobj'" + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -shared) + test yes = "$build_libtool_libs" \ + || func_fatal_configuration "cannot build a shared library" + build_old_libs=no + continue + ;; + + -static) + build_libtool_libs=no + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + func_quote_arg pretty "$libobj" + test "X$libobj" != "X$func_quote_arg_result" \ + && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && func_warning "libobj name '$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname=$func_basename_result + xdir=$func_dirname_result + lobj=$xdir$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test yes = "$build_old_libs"; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test no = "$compiler_c_o"; then + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext + lockfile=$output_obj.lock + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test yes = "$need_locks"; then + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + elif test warn = "$need_locks"; then + if test -f "$lockfile"; then + $ECHO "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + func_append removelist " $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + func_append removelist " $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result + func_quote_arg pretty "$srcfile" + qsrcfile=$func_quote_arg_result + + # Only build a PIC object if we are building libtool libraries. + if test yes = "$build_libtool_libs"; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test no != "$pic_mode"; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + func_append command " -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + if test warn = "$need_locks" && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test yes = "$suppress_opt"; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test yes = "$build_old_libs"; then + if test yes != "$pic_mode"; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test yes = "$compiler_c_o"; then + func_append command " -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + func_append command "$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + if test warn = "$need_locks" && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test no != "$need_locks"; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { + test compile = "$opt_mode" && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $opt_mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to build PIC objects only + -prefer-non-pic try to build non-PIC objects only + -shared do not build a '.o' file suitable for static linking + -static only build a '.o' file suitable for static linking + -Wc,FLAG + -Xcompiler FLAG pass FLAG directly to the compiler + +COMPILE-COMMAND is a command to be used in creating a 'standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix '.c' with the +library object suffix, '.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to '-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the '--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the 'install' or 'cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -bindir BINDIR specify path to binaries directory (for systems where + libraries must be found in the PATH setting at runtime) + -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE use a list of object files found in FILE to specify objects + -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + -Wc,FLAG + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wa,FLAG + -Xassembler FLAG pass linker-specific FLAG directly to the assembler + -Wl,FLAG + -Xlinker FLAG pass linker-specific FLAG directly to the linker + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) + +All other options (arguments beginning with '-') are ignored. + +Every other argument is treated as a filename. Files ending in '.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in '.la', then a libtool library is created, +only library objects ('.lo' files) may be specified, and '-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created +using 'ar' and 'ranlib', or on Windows using 'lib'. + +If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode '$opt_mode'" + ;; + esac + + echo + $ECHO "Try '$progname --help' for more information about other modes." +} + +# Now that we've collected a possible --mode arg, show help if necessary +if $opt_help; then + if test : = "$opt_help"; then + func_mode_help + else + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + func_mode_help + done + } | $SED -n '1p; 2,$s/^Usage:/ or: /p' + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + echo + func_mode_help + done + } | + $SED '1d + /^When reporting/,/^Report/{ + H + d + } + $x + /information about other modes/d + /more detailed .*MODE/d + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' + fi + exit $? +fi + + +# func_mode_execute arg... +func_mode_execute () +{ + $debug_cmd + + # The first argument is the command name. + cmd=$nonopt + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $opt_dlopen; do + test -f "$file" \ + || func_fatal_help "'$file' is not a file" + + dir= + case $file in + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "'$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "'$file' was not linked with '-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir=$func_dirname_result + + if test -f "$dir/$objdir/$dlname"; then + func_append dir "/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir=$func_dirname_result + ;; + + *) + func_warning "'-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir=$absdir + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic=$magic + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -* | *.la | *.lo ) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file=$progdir/$program + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file=$progdir/$program + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_append_quoted args "$file" + done + + if $opt_dry_run; then + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + echo "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + else + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd=\$cmd$args + fi +} + +test execute = "$opt_mode" && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $debug_cmd + + libs= + libdirs= + admincmds= + + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "'$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument '$opt'" + fi + done + + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi + + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and '=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || func_append admincmds " + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_quiet && exit $EXIT_SUCCESS + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the '-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the '$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the '$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the '$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" + fi + echo + + echo "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" + fi + exit $EXIT_SUCCESS +} + +test finish = "$opt_mode" && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $debug_cmd + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || + # Allow the use of GNU shtool's install command. + case $nonopt in *shtool*) :;; *) false;; esac + then + # Aesthetically quote it. + func_quote_arg pretty "$nonopt" + install_prog="$func_quote_arg_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_arg pretty "$arg" + func_append install_prog "$func_quote_arg_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=false + stripme= + no_mode=: + for arg + do + arg2= + if test -n "$dest"; then + func_append files " $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=: ;; + -f) + if $install_cp; then :; else + prev=$arg + fi + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + if test X-m = "X$prev" && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_arg pretty "$arg" + func_append install_prog " $func_quote_arg_result" + if test -n "$arg2"; then + func_quote_arg pretty "$arg2" + fi + func_append install_shared_prog " $func_quote_arg_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the '$prev' option requires an argument" + + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_arg pretty "$install_override_mode" + func_append install_shared_prog " -m $func_quote_arg_result" + fi + fi + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=: + if $isdir; then + destdir=$dest + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir=$func_dirname_result + destname=$func_basename_result + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "'$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "'$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic=$magic + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + func_append staticlibs " $file" + ;; + + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "'$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) func_append current_libdirs " $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) func_append future_libdirs " $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir=$func_dirname_result + func_append dir "$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking '$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname=$1 + shift + + srcname=$realname + test -n "$relink_command" && srcname=${realname}T + + # Install the shared library and build the symlinks. + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme=$stripme + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme= + ;; + esac + ;; + os2*) + case $realname in + *_dll.a) + tstripme= + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try 'ln -sf' first, because the 'ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib=$destdir/$realname + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name=$func_basename_result + instname=$dir/${name}i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && func_append staticlibs " $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile=$destdir/$destname + else + func_basename "$file" + destfile=$func_basename_result + destfile=$destdir/$destfile + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest=$destfile + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to '$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test yes = "$build_old_libs"; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile=$destdir/$destname + else + func_basename "$file" + destfile=$func_basename_result + destfile=$destdir/$destfile + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext= + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=.exe + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script '$wrapper'" + + finalize=: + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "'$lib' has not been installed in '$libdir'" + finalize=false + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test no = "$fast_install" && test -n "$relink_command"; then + $opt_dry_run || { + if $finalize; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file=$func_basename_result + outputname=$tmpdir/$file + # Replace the output file specification. + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_quiet || { + func_quote_arg expand,pretty "$relink_command" + eval "func_echo $func_quote_arg_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink '$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file=$outputname + else + func_warning "cannot relink '$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name=$func_basename_result + + # Set up the ranlib parameters. + oldlib=$destdir/$name + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $tool_oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run '$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test install = "$opt_mode" && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $debug_cmd + + my_outputname=$1 + my_originator=$2 + my_pic_p=${3-false} + my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms=${my_outputname}S.c + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist=$output_objdir/$my_outputname.nm + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + +/* External symbol declarations for the compiler. */\ +" + + if test yes = "$dlself"; then + func_verbose "generating symbol list for '$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from '$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols=$output_objdir/$outputname.exp + $opt_dry_run || { + $RM $export_symbols + eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from '$dlprefile'" + func_basename "$dlprefile" + name=$func_basename_result + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename= + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname"; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename=$func_basename_result + else + # no lafile. user explicitly requested -dlpreopen . + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename"; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + func_show_eval '$RM "${nlist}I"' + if test -n "$global_symbol_to_import"; then + eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' + fi + + echo >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +extern LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[];\ +" + + if test -s "$nlist"I; then + echo >> "$output_objdir/$my_dlsyms" "\ +static void lt_syminit(void) +{ + LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; + for (; symbol->name; ++symbol) + {" + $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" + echo >> "$output_objdir/$my_dlsyms" "\ + } +}" + fi + echo >> "$output_objdir/$my_dlsyms" "\ +LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{ {\"$my_originator\", (void *) 0}," + + if test -s "$nlist"I; then + echo >> "$output_objdir/$my_dlsyms" "\ + {\"@INIT@\", (void *) <_syminit}," + fi + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + echo >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + $my_pic_p && pic_flag_for_symtable=" $pic_flag" + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) func_append symtab_cflags " $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' + + # Transform the symbol file into the correct name. + symfileobj=$output_objdir/${my_outputname}S.$objext + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for '$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` + fi +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $debug_cmd + + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $debug_cmd + + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. +func_win32_libid () +{ + $debug_cmd + + win32_libid_type=unknown + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + case $nm_interface in + "MS dumpbin") + if func_cygming_ms_implib_p "$1" || + func_cygming_gnu_implib_p "$1" + then + win32_nmres=import + else + win32_nmres= + fi + ;; + *) + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | + $SED -n -e ' + 1,100{ + / I /{ + s|.*|import| + p + q + } + }'` + ;; + esac + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $debug_cmd + + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $debug_cmd + + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive that possess that section. Heuristic: eliminate + # all those that have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $debug_cmd + + if func_cygming_gnu_implib_p "$1"; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1"; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result= + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $debug_cmd + + f_ex_an_ar_dir=$1; shift + f_ex_an_ar_oldlib=$1 + if test yes = "$lock_old_archive_extraction"; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test yes = "$lock_old_archive_extraction"; then + $opt_dry_run || rm -f "$lockfile" + fi + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $debug_cmd + + my_gentop=$1; shift + my_oldlibs=${1+"$@"} + my_oldobjs= + my_xlib= + my_xabs= + my_xdir= + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib=$func_basename_result + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir=$my_gentop/$my_xlib_u + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + func_basename "$darwin_archive" + darwin_base_archive=$func_basename_result + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches; do + func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" + $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" + cd "unfat-$$/$darwin_base_archive-$darwin_arch" + func_extract_an_archive "`pwd`" "$darwin_base_archive" + cd "$darwin_curdir" + $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` + done + + func_extract_archives_result=$my_oldobjs +} + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory where it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=${1-no} + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + + func_quote_arg pretty "$ECHO" + qECHO=$func_quote_arg_result + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=$qECHO + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ that is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options that match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + case \" \$* \" in + *\\ --lt-*) + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done ;; + esac + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test yes = "$fast_install"; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + \$ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + # Export our shlibpath_var if we have one. + if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + + export $shlibpath_var +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + func_exec_program \${1+\"\$@\"} + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} + + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +#else +# include +# include +# ifdef __CYGWIN__ +# include +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + +/* declarations of non-ANSI functions */ +#if defined __MINGW32__ +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined __CYGWIN__ +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined other_platform || defined ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined _MSC_VER +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +#elif defined __MINGW32__ +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined __CYGWIN__ +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined other platforms ... */ +#endif + +#if defined PATH_MAX +# define LT_PATHMAX PATH_MAX +#elif defined MAXPATHLEN +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +/* path handling portability macros */ +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ + defined __OS2__ +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free (stale); stale = 0; } \ +} while (0) + +#if defined LT_DEBUGWRAPPER +static int lt_debug = 1; +#else +static int lt_debug = 0; +#endif + +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); +char **prepare_spawn (char **argv); +void lt_dump_script (FILE *f); +EOF + + cat <= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + size_t tmp_len; + char *concat_name; + + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined HAVE_DOS_BASED_FILE_SYSTEM + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined HAVE_DOS_BASED_FILE_SYSTEM + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = (size_t) (q - p); + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (STREQ (str, pat)) + *str = '\0'; + } + return str; +} + +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + +static void +lt_error_core (int exit_status, const char *file, + int line, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *file, int line, const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); + va_end (ap); +} + +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + +void +lt_setenv (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + size_t len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + size_t orig_value_len = strlen (orig_value); + size_t add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + size_t len = strlen (new_value); + while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[--len] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -n -e ' +s/^\(.\{79\}\)\(..*\)/\1\ +\2/ +h +s/\([\\"]\)/\\\1/g +s/$/\\n/ +s/\([^\n]*\).*/ fputs ("\1", f);/p +g +D' + cat <<"EOF" +} +EOF +} +# end: func_emit_cwrapperexe_src + +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $debug_cmd + + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + +# func_suncc_cstd_abi +# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! +# Several compiler flags select an ABI that is incompatible with the +# Cstd library. Avoid specifying it if any are in CXXFLAGS. +func_suncc_cstd_abi () +{ + $debug_cmd + + case " $compile_command " in + *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) + suncc_use_cstd_abi=no + ;; + *) + suncc_use_cstd_abi=yes + ;; + esac +} + +# func_mode_link arg... +func_mode_link () +{ + $debug_cmd + + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # what system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll that has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + bindir= + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + os2dllname= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=false + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module=$wl-single_module + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test yes != "$build_libtool_libs" \ + && func_fatal_configuration "cannot build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg=$1 + shift + func_quote_arg pretty,unquoted "$arg" + qarg=$func_quote_arg_unquoted_result + func_append libtool_args " $func_quote_arg_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + bindir) + bindir=$arg + prev= + continue + ;; + dlfiles|dlprefiles) + $preload || { + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=: + } + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test no = "$dlself"; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test dlprefiles = "$prev"; then + dlself=yes + elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test dlfiles = "$prev"; then + func_append dlfiles " $arg" + else + func_append dlprefiles " $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols=$arg + test -f "$arg" \ + || func_fatal_error "symbol file '$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex=$arg + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) func_append deplibs " $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir=$arg + prev= + continue + ;; + mllvm) + # Clang does not use LLVM to link, so we can simply discard any + # '-mllvm $arg' options when doing the link step. + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# func_append moreargs " $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test none = "$pic_object" && + test none = "$non_pic_object"; then + func_fatal_error "cannot find name of object for '$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + if test none != "$pic_object"; then + # Prepend the subdirectory the object is found in. + pic_object=$xdir$pic_object + + if test dlfiles = "$prev"; then + if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test dlprefiles = "$prev"; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg=$pic_object + fi + + # Non-PIC object. + if test none != "$non_pic_object"; then + # Prepend the subdirectory the object is found in. + non_pic_object=$xdir$non_pic_object + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test none = "$pic_object"; then + arg=$non_pic_object + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object=$pic_object + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "'$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file '$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + os2dllname) + os2dllname=$arg + prev= + continue + ;; + precious_regex) + precious_files_regex=$arg + prev= + continue + ;; + release) + release=-$arg + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test rpath = "$prev"; then + case "$rpath " in + *" $arg "*) ;; + *) func_append rpath " $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) func_append xrpath " $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds=$arg + prev= + continue + ;; + weak) + func_append weak_libs " $arg" + prev= + continue + ;; + xassembler) + func_append compiler_flags " -Xassembler $qarg" + prev= + func_append compile_command " -Xassembler $qarg" + func_append finalize_command " -Xassembler $qarg" + continue + ;; + xcclinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg=$arg + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "'-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -bindir) + prev=bindir + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test X-export-symbols = "X$arg"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between '-L' and '$1'" + else + func_fatal_error "need path for '-L' option" + fi + fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of '$dir'" + dir=$absdir + ;; + esac + case "$deplibs " in + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; + *) + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) func_append dllsearchpath ":$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test X-lc = "X$arg" || test X-lm = "X$arg"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test X-lc = "X$arg" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) + # Do not include libc due to us having libc/libc_r. + test X-lc = "X$arg" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + func_append deplibs " System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test X-lc = "X$arg" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test X-lc = "X$arg" && continue + ;; + esac + elif test X-lc_r = "X$arg"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + func_append deplibs " $arg" + continue + ;; + + -mllvm) + prev=mllvm + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + # Solaris ld rejects as of 11.4. Refer to Oracle bug 22985199. + -pthread) + case $host in + *solaris2*) ;; + *) + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + ;; + esac + continue + ;; + -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + + # As we are forced to pass -nostdlib to g++ during linking, the option + # -pthread{,s} is not in effect; add the -lpthread to $deplist + # explicitly to link correctly. + if test "$tagname" = CXX -a x"$with_gcc" = xyes; then + case "$arg" in + -pthread*) func_append deplibs " -lpthread" ;; + esac + fi + + continue + ;; + + -multi_module) + single_module=$wl-multi_module + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "'-no-install' is ignored for $host" + func_warning "assuming '-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -os2dllname) + prev=os2dllname + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs=$IFS; IFS=, + for flag in $args; do + IFS=$save_ifs + func_quote_arg pretty "$flag" + func_append arg " $func_quote_arg_result" + func_append compiler_flags " $func_quote_arg_result" + done + IFS=$save_ifs + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs=$IFS; IFS=, + for flag in $args; do + IFS=$save_ifs + func_quote_arg pretty "$flag" + func_append arg " $wl$func_quote_arg_result" + func_append compiler_flags " $wl$func_quote_arg_result" + func_append linker_flags " $func_quote_arg_result" + done + IFS=$save_ifs + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xassembler) + prev=xassembler + continue + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result + ;; + + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # -fstack-protector* stack protector flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + # -specs=* GCC specs files + # -stdlib=* select c++ std lib with clang + # -fsanitize=* Clang/GCC memory and address sanitizer + # -fuse-ld=* Linker select flags for GCC + # -Wa,* Pass flags directly to the assembler + # -Werror, -Werror=* Report (specified) warnings as errors + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ + -specs=*|-fsanitize=*|-fuse-ld=*|-Wa,*|-Werror|-Werror=*) + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result + func_append compile_command " $arg" + func_append finalize_command " $arg" + func_append compiler_flags " $arg" + continue + ;; + + -Z*) + if test os2 = "`expr $host : '.*\(os2\)'`"; then + # OS/2 uses -Zxxx to specify OS/2-specific options + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case $arg in + -Zlinker | -Zstack) + prev=xcompiler + ;; + esac + continue + else + # Otherwise treat like 'Some other compiler flag' below + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result + fi + ;; + + # Some other compiler flag. + -* | +*) + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result + ;; + + *.$objext) + # A standard object. + func_append objs " $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test none = "$pic_object" && + test none = "$non_pic_object"; then + func_fatal_error "cannot find name of object for '$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + test none = "$pic_object" || { + # Prepend the subdirectory the object is found in. + pic_object=$xdir$pic_object + + if test dlfiles = "$prev"; then + if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test dlprefiles = "$prev"; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg=$pic_object + } + + # Non-PIC object. + if test none != "$non_pic_object"; then + # Prepend the subdirectory the object is found in. + non_pic_object=$xdir$non_pic_object + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test none = "$pic_object"; then + arg=$non_pic_object + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object=$pic_object + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "'$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + func_append deplibs " $arg" + func_append old_deplibs " $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + func_resolve_sysroot "$arg" + if test dlfiles = "$prev"; then + # This library was specified with -dlopen. + func_append dlfiles " $func_resolve_sysroot_result" + prev= + elif test dlprefiles = "$prev"; then + # The library was specified with -dlpreopen. + func_append dlprefiles " $func_resolve_sysroot_result" + prev= + else + func_append deplibs " $func_resolve_sysroot_result" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the '$prevarg' option requires an argument" + + if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname=$func_basename_result + libobjs_save=$libobjs + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + # Definition is injected by LT_CONFIG during libtool generation. + func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" + + func_dirname "$output" "/" "" + output_objdir=$func_dirname_result$objdir + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_preserve_dup_deps; then + case "$libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append libs " $deplib" + done + + if test lib = "$linkmode"; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; + esac + func_append pre_post_deps " $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=false + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test lib,link = "$linkmode,$pass"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs=$tmp_deplibs + fi + + if test lib,link = "$linkmode,$pass" || + test prog,scan = "$linkmode,$pass"; then + libs=$deplibs + deplibs= + fi + if test prog = "$linkmode"; then + case $pass in + dlopen) libs=$dlfiles ;; + dlpreopen) libs=$dlprefiles ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + if test lib,dlpreopen = "$linkmode,$pass"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + func_resolve_sysroot "$lib" + case $lib in + *.la) func_source "$func_resolve_sysroot_result" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + func_basename "$deplib" + deplib_base=$func_basename_result + case " $weak_libs " in + *" $deplib_base "*) ;; + *) func_append deplibs " $deplib" ;; + esac + done + done + libs=$dlprefiles + fi + if test dlopen = "$pass"; then + # Collect dlpreopened libraries + save_deplibs=$deplibs + deplibs= + fi + + for deplib in $libs; do + lib= + found=false + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append compiler_flags " $deplib" + if test lib = "$linkmode"; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test lib != "$linkmode" && test prog != "$linkmode"; then + func_warning "'-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test lib = "$linkmode"; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib=$searchdir/lib$name$search_ext + if test -f "$lib"; then + if test .la = "$search_ext"; then + found=: + else + found=false + fi + break 2 + fi + done + done + if $found; then + # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll=$l + done + if test "X$ll" = "X$old_library"; then # only static version available + found=false + func_dirname "$lib" "" "." + ladir=$func_dirname_result + lib=$ladir/$old_library + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + else + # deplib doesn't seem to be a libtool library + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + ;; # -l + *.ltframework) + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test lib = "$linkmode"; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test conv = "$pass" && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + prog) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + continue + fi + if test scan = "$pass"; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + *) + func_warning "'-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test link = "$pass"; then + func_stripname '-R' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; + *.$libext) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=false + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=: + fi + ;; + pass_all) + valid_a_lib=: + ;; + esac + if $valid_a_lib; then + echo + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + else + echo + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." + fi + ;; + esac + continue + ;; + prog) + if test link != "$pass"; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + elif test prog = "$linkmode"; then + if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + func_append newdlprefiles " $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append newdlfiles " $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=: + continue + ;; + esac # case $deplib + + $found || test -f "$lib" \ + || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "'$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir=$func_dirname_result + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + if test lib,link = "$linkmode,$pass" || + test prog,scan = "$linkmode,$pass" || + { test prog != "$linkmode" && test lib != "$linkmode"; }; then + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" + fi + + if test conv = "$pass"; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for '$lib'" + fi + # It is a libtool convenience library, so add in its objects. + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" + elif test prog != "$linkmode" && test lib != "$linkmode"; then + func_fatal_error "'$lib' is not a convenience library" + fi + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + if test -n "$old_library" && + { test yes = "$prefer_static_libs" || + test built,no = "$prefer_static_libs,$installed"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib=$l + done + fi + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for '$lib'" + fi + + # This library was specified with -dlopen. + if test dlopen = "$pass"; then + test -z "$libdir" \ + && func_fatal_error "cannot -dlopen a convenience library: '$lib'" + if test -z "$dlname" || + test yes != "$dlopen_support" || + test no = "$build_libtool_libs" + then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + func_append dlprefiles " $lib $dependency_libs" + else + func_append newdlfiles " $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of '$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir=$ladir + fi + ;; + esac + func_basename "$lib" + laname=$func_basename_result + + # Find the relevant object directory and library name. + if test yes = "$installed"; then + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library '$lib' was moved." + dir=$ladir + absdir=$abs_ladir + libdir=$abs_ladir + else + dir=$lt_sysroot$libdir + absdir=$lt_sysroot$libdir + fi + test yes = "$hardcode_automatic" && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir=$ladir + absdir=$abs_ladir + # Remove this search path later + func_append notinst_path " $abs_ladir" + else + dir=$ladir/$objdir + absdir=$abs_ladir/$objdir + # Remove this search path later + func_append notinst_path " $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test dlpreopen = "$pass"; then + if test -z "$libdir" && test prog = "$linkmode"; then + func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" + fi + case $host in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test lib = "$linkmode"; then + deplibs="$dir/$old_library $deplibs" + elif test prog,link = "$linkmode,$pass"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test prog = "$linkmode" && test link != "$pass"; then + func_append newlib_search_path " $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=false + if test no != "$link_all_deplibs" || test -z "$library_names" || + test no = "$build_libtool_libs"; then + linkalldeplibs=: + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + esac + # Need to link against all dependency_libs? + if $linkalldeplibs; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test prog,link = "$linkmode,$pass"; then + if test -n "$library_names" && + { { test no = "$prefer_static_libs" || + test built,yes = "$prefer_static_libs,$installed"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then + # Make sure the rpath contains only unique directories. + case $temp_rpath: in + *"$absdir:"*) ;; + *) func_append temp_rpath "$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if $alldeplibs && + { test pass_all = "$deplibs_check_method" || + { test yes = "$build_libtool_libs" && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test built = "$use_static_libs" && test yes = "$installed"; then + use_static_libs=no + fi + if test -n "$library_names" && + { test no = "$use_static_libs" || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc* | *os2*) + # No point in relinking DLLs because paths are not encoded + func_append notinst_deplibs " $lib" + need_relink=no + ;; + *) + if test no = "$installed"; then + func_append notinst_deplibs " $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule= + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule=$dlpremoduletest + break + fi + done + if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then + echo + if test prog = "$linkmode"; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test lib = "$linkmode" && + test yes = "$hardcode_into_libs"; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname=$1 + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname=$dlname + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc* | *os2*) + func_arith $current - $age + major=$func_arith_result + versuffix=-$major + ;; + esac + eval soname=\"$soname_spec\" + else + soname=$realname + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot=$soname + func_basename "$soroot" + soname=$func_basename_result + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from '$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for '$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test prog = "$linkmode" || test relink != "$opt_mode"; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test no = "$hardcode_direct"; then + add=$dir/$linklib + case $host in + *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; + *-*-sysv4*uw2*) add_dir=-L$dir ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir=-L$dir ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we cannot + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library"; then + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" + else + add=$dir/$old_library + fi + elif test -n "$old_library"; then + add=$dir/$old_library + fi + fi + esac + elif test no = "$hardcode_minus_L"; then + case $host in + *-*-sunos*) add_shlibpath=$dir ;; + esac + add_dir=-L$dir + add=-l$name + elif test no = "$hardcode_shlibpath_var"; then + add_shlibpath=$dir + add=-l$name + else + lib_linked=no + fi + ;; + relink) + if test yes = "$hardcode_direct" && + test no = "$hardcode_direct_absolute"; then + add=$dir/$linklib + elif test yes = "$hardcode_minus_L"; then + add_dir=-L$absdir + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add=-l$name + elif test yes = "$hardcode_shlibpath_var"; then + add_shlibpath=$dir + add=-l$name + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test yes != "$lib_linked"; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; + esac + fi + if test prog = "$linkmode"; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test yes != "$hardcode_direct" && + test yes != "$hardcode_minus_L" && + test yes = "$hardcode_shlibpath_var"; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + fi + fi + fi + + if test prog = "$linkmode" || test relink = "$opt_mode"; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test yes = "$hardcode_direct" && + test no = "$hardcode_direct_absolute"; then + add=$libdir/$linklib + elif test yes = "$hardcode_minus_L"; then + add_dir=-L$libdir + add=-l$name + elif test yes = "$hardcode_shlibpath_var"; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + add=-l$name + elif test yes = "$hardcode_automatic"; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib"; then + add=$inst_prefix_dir$libdir/$linklib + else + add=$libdir/$linklib + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir=-L$libdir + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add=-l$name + fi + + if test prog = "$linkmode"; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test prog = "$linkmode"; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test unsupported != "$hardcode_direct"; then + test -n "$old_library" && linklib=$old_library + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test yes = "$build_libtool_libs"; then + # Not a shared library + if test pass_all != "$deplibs_check_method"; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + $ECHO "*** Warning: This system cannot link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test yes = "$module"; then + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using 'nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** 'nm' from GNU binutils and a full rebuild may help." + fi + if test no = "$build_old_libs"; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test lib = "$linkmode"; then + if test -n "$dependency_libs" && + { test yes != "$hardcode_into_libs" || + test yes = "$build_old_libs" || + test yes = "$link_static"; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) func_append xrpath " $temp_xrpath";; + esac;; + *) func_append temp_deplibs " $libdir";; + esac + done + dependency_libs=$temp_deplibs + fi + + func_append newlib_search_path " $absdir" + # Link against this library + test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; + esac + fi + func_append tmp_libs " $func_resolve_sysroot_result" + done + + if test no != "$link_all_deplibs"; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + path= + case $deplib in + -L*) path=$deplib ;; + *.la) + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result + func_dirname "$deplib" "" "." + dir=$func_dirname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of '$dir'" + absdir=$dir + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names"; then + for tmp in $deplibrary_names; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl"; then + depdepl=$absdir/$objdir/$depdepl + darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" + func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" + path= + fi + fi + ;; + *) + path=-L$absdir/$objdir + ;; + esac + else + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "'$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "'$deplib' seems to be moved" + + path=-L$absdir + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test link = "$pass"; then + if test prog = "$linkmode"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs=$newdependency_libs + if test dlpreopen = "$pass"; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test dlopen != "$pass"; then + test conv = "$pass" || { + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) func_append lib_search_path " $dir" ;; + esac + done + newlib_search_path= + } + + if test prog,link = "$linkmode,$pass"; then + vars="compile_deplibs finalize_deplibs" + else + vars=deplibs + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) func_append tmp_libs " $deplib" ;; + esac + ;; + *) func_append tmp_libs " $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + + # Add Sun CC postdeps if required: + test CXX = "$tagname" && { + case $host_os in + linux*) + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ C*) # Sun C++ 5.9 + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + + solaris*) + func_cc_basename "$CC" + case $func_cc_basename_result in + CC* | sunCC*) + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + esac + } + + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i= + ;; + esac + if test -n "$i"; then + func_append tmp_libs " $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test prog = "$linkmode"; then + dlfiles=$newdlfiles + fi + if test prog = "$linkmode" || test lib = "$linkmode"; then + dlprefiles=$newdlprefiles + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + func_warning "'-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "'-l' and '-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "'-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "'-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "'-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "'-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "'-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs=$output + func_append objs "$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form 'libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test no = "$module" \ + && func_fatal_help "libtool library '$output' must begin with 'lib'" + + if test no != "$need_lib_prefix"; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test pass_all != "$deplibs_check_method"; then + func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" + else + echo + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + func_append libobjs " $objs" + fi + fi + + test no = "$dlself" \ + || func_warning "'-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test 1 -lt "$#" \ + && func_warning "ignoring multiple '-rpath's for a libtool library" + + install_libdir=$1 + + oldlibs= + if test -z "$rpath"; then + if test yes = "$build_libtool_libs"; then + # Building a libtool convenience library. + # Some compilers have problems with a '.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "'-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "'-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs=$IFS; IFS=: + set dummy $vinfo 0 0 0 + shift + IFS=$save_ifs + + test -n "$7" && \ + func_fatal_help "too many parameters to '-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major=$1 + number_minor=$2 + number_revision=$3 + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # that has an extra 1 added just for fun + # + case $version_type in + # correct linux to gnu/linux during the next big refactor + darwin|freebsd-elf|linux|midnightbsd-elf|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age=$number_minor + revision=$number_revision + ;; + freebsd-aout|qnx|sunos) + current=$number_major + revision=$number_minor + age=0 + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age=$number_minor + revision=$number_minor + lt_irix_increment=no + ;; + esac + ;; + no) + current=$1 + revision=$2 + age=$3 + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT '$current' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION '$revision' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE '$age' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE '$age' is greater than the current interface number '$current'" + func_fatal_error "'$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + # On Darwin other compilers + case $CC in + nagfor*) + verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" + ;; + *) + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + esac + ;; + + freebsd-aout) + major=.$current + versuffix=.$current.$revision + ;; + + freebsd-elf | midnightbsd-elf) + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + ;; + + irix | nonstopux) + if test no = "$lt_irix_increment"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring=$verstring_prefix$major.$revision + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test 0 -ne "$loop"; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring=$verstring_prefix$major.$iface:$verstring + done + + # Before this point, $major must not contain '.'. + major=.$major + versuffix=$major.$revision + ;; + + linux) # correct to gnu/linux during the next big refactor + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=.$current.$age.$revision + verstring=$current.$age.$revision + + # Add in all the interfaces that we are compatible with. + loop=$age + while test 0 -ne "$loop"; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring=$verstring:$iface.0 + done + + # Make executables depend on our current version. + func_append verstring ":$current.0" + ;; + + qnx) + major=.$current + versuffix=.$current + ;; + + sco) + major=.$current + versuffix=.$current + ;; + + sunos) + major=.$current + versuffix=.$current.$revision + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 file systems. + func_arith $current - $age + major=$func_arith_result + versuffix=-$major + ;; + + *) + func_fatal_configuration "unknown library version type '$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring=0.0 + ;; + esac + if test no = "$need_version"; then + versuffix= + else + versuffix=.0.0 + fi + fi + + # Remove version info from name if versioning should be avoided + if test yes,no = "$avoid_version,$need_version"; then + major= + versuffix= + verstring= + fi + + # Check to see if the archive will have undefined symbols. + if test yes = "$allow_undefined"; then + if test unsupported = "$allow_undefined_flag"; then + if test yes = "$build_old_libs"; then + func_warning "undefined symbols not allowed in $host shared libraries; building static only" + build_libtool_libs=no + else + func_fatal_error "can't build $host shared library unless -no-undefined is specified" + fi + fi + else + # Don't allow undefined symbols. + allow_undefined_flag=$no_undefined_flag + fi + + fi + + func_generate_dlsyms "$libname" "$libname" : + func_append libobjs " $symfileobj" + test " " = "$libobjs" && libobjs= + + if test relink != "$opt_mode"; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) + if test -n "$precious_files_regex"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + func_append removelist " $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then + func_append oldlibs " $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles=$dlfiles + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) func_append dlfiles " $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles=$dlprefiles + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) func_append dlprefiles " $lib" ;; + esac + done + + if test yes = "$build_libtool_libs"; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + func_append deplibs " System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test yes = "$build_libtool_need_lc"; then + func_append deplibs " -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release= + versuffix= + major= + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib=$potent_lib + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | $SED 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; + *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib= + break 2 + fi + done + done + fi + if test -n "$a_deplib"; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib"; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + case " $predeps $postdeps " in + *" $a_deplib "*) + func_append newdeplibs " $a_deplib" + a_deplib= + ;; + esac + fi + if test -n "$a_deplib"; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib=$potent_lib # see symlink-check above in file_magic test + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib= + break 2 + fi + done + done + fi + if test -n "$a_deplib"; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib"; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs= + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + for i in $predeps $postdeps; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` + done + fi + case $tmp_deplibs in + *[!\ \ ]*) + echo + if test none = "$deplibs_check_method"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + ;; + esac + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + if test yes = "$droppeddeps"; then + if test yes = "$module"; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using 'nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** 'nm' from GNU binutils and a full rebuild may help." + fi + if test no = "$build_old_libs"; then + oldlibs=$output_objdir/$libname.$libext + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test no = "$allow_undefined"; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test no = "$build_old_libs"; then + oldlibs=$output_objdir/$libname.$libext + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + deplibs=$new_libs + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test yes = "$build_libtool_libs"; then + # Remove $wl instances when linking with ld. + # FIXME: should test the right _cmds variable. + case $archive_cmds in + *\$LD\ *) wl= ;; + esac + if test yes = "$hardcode_into_libs"; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath=$finalize_rpath + test relink = "$opt_mode" || rpath=$compile_rpath$rpath + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append dep_rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath=$finalize_shlibpath + test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname=$1 + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname=$realname + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib=$output_objdir/$realname + linknames= + for link + do + func_append linknames " $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols=$output_objdir/$libname.uexp + func_append delfiles " $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + func_dll_def_p "$export_symbols" || { + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols=$export_symbols + export_symbols= + always_export_symbols=yes + } + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for '$libname.la'" + export_symbols=$output_objdir/$libname.exp + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs=$IFS; IFS='~' + for cmd1 in $cmds; do + IFS=$save_ifs + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test yes = "$try_normal_branch" \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=$output_objdir/$output_la.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS=$save_ifs + if test -n "$export_symbols_regex" && test : != "$skipped_export"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols=$export_symbols + test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test : != "$skipped_export" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for '$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands, which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + func_append tmp_deplibs " $test_deplib" + ;; + esac + done + deplibs=$tmp_deplibs + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test yes = "$compiler_needs_object" && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + func_append linker_flags " $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test relink = "$opt_mode"; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test yes = "$module" && test -n "$module_cmds"; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test : != "$skipped_export" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + func_basename "$output" + output_la=$func_basename_result + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then + output=$output_objdir/$output_la.lnkscript + func_verbose "creating GNU ld script: $output" + echo 'INPUT (' > $output + for obj in $save_libobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result + elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then + output=$output_objdir/$output_la.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test yes = "$compiler_needs_object"; then + firstobj="$1 " + shift + fi + for obj + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-$k.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test -z "$objlist" || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test 1 -eq "$k"; then + # The first file doesn't have a previous command to add. + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" + else + # All subsequent reloadable object files will link in + # the last one created. + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-$k.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-$k.$objext + objlist=" $obj" + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds$reload_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + func_append delfiles " $output" + + else + output= + fi + + ${skipped_export-false} && { + func_verbose "generating symbol list for '$libname.la'" + export_symbols=$output_objdir/$libname.exp + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + } + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs=$IFS; IFS='~' + for cmd in $concat_cmds; do + IFS=$save_ifs + $opt_quiet || { + func_quote_arg expand,pretty "$cmd" + eval "func_echo $func_quote_arg_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS=$save_ifs + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + ${skipped_export-false} && { + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols=$export_symbols + test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for '$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands, which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + } + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test yes = "$module" && test -n "$module_cmds"; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs=$IFS; IFS='~' + for cmd in $cmds; do + IFS=$sp$nl + eval cmd=\"$cmd\" + IFS=$save_ifs + $opt_quiet || { + func_quote_arg expand,pretty "$cmd" + eval "func_echo $func_quote_arg_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS=$save_ifs + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test yes = "$module" || test yes = "$export_dynamic"; then + # On all known operating systems, these are identical. + dlname=$soname + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + func_warning "'-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "'-l' and '-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "'-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "'-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "'-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "'-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object '$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj=$output + ;; + esac + + # Delete the old objects. + $opt_dry_run || $RM $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # if reload_cmds runs $LD directly, get rid of -Wl from + # whole_archive_flag_spec and hope we can get by with turning comma + # into space. + case $reload_cmds in + *\$LD[\ \$]*) wl= ;; + esac + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` + reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags + else + gentop=$output_objdir/${obj}x + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # If we're not building shared, we need to use non_pic_objs + test yes = "$build_libtool_libs" || libobjs=$non_pic_objects + + # Create the old-style object. + reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs + + output=$obj + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + test yes = "$build_libtool_libs" || { + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + } + + if test -n "$pic_flag" || test default != "$pic_mode"; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output=$libobj + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "'-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "'-release' is ignored for programs" + + $preload \ + && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ + && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test CXX = "$tagname"; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + func_append compile_command " $wl-bind_at_load" + func_append finalize_command " $wl-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + compile_deplibs=$new_libs + + + func_append compile_command " $compile_deplibs" + func_append finalize_command " $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) func_append dllsearchpath ":$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath=$rpath + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) func_append finalize_perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath=$rpath + + if test -n "$libobjs" && test yes = "$build_old_libs"; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" false + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=: + case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=false + ;; + *cygwin* | *mingw* ) + test yes = "$build_libtool_libs" || wrappers_required=false + ;; + *) + if test no = "$need_relink" || test yes != "$build_libtool_libs"; then + wrappers_required=false + fi + ;; + esac + $wrappers_required || { + # Replace the output file specification. + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + link_command=$compile_command$compile_rpath + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.$objext"; then + func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' + fi + + exit $exit_status + } + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + func_append rpath "$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test yes = "$no_install"; then + # We don't need to create a wrapper script. + link_command=$compile_var$compile_command$compile_rpath + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + exit $EXIT_SUCCESS + fi + + case $hardcode_action,$fast_install in + relink,*) + # Fast installation is not supported + link_command=$compile_var$compile_command$compile_rpath + relink_command=$finalize_var$finalize_command$finalize_rpath + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "'$output' will be relinked during installation" + ;; + *,yes) + link_command=$finalize_var$compile_command$finalize_rpath + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` + ;; + *,no) + link_command=$compile_var$compile_command$compile_rpath + relink_command=$finalize_var$finalize_command$finalize_rpath + ;; + *,needless) + link_command=$finalize_var$compile_command$finalize_rpath + relink_command= + ;; + esac + + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_arg pretty "$var_value" + relink_command="$var=$func_quote_arg_result; export $var; $relink_command" + fi + done + func_quote eval cd "`pwd`" + func_quote_arg pretty,unquoted "($func_quote_result; $relink_command)" + relink_command=$func_quote_arg_unquoted_result + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource=$output_path/$objdir/lt-$output_name.c + cwrapper=$output_path/$output_name.exe + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host"; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + case $build_libtool_libs in + convenience) + oldobjs="$libobjs_save $symfileobj" + addlibs=$convenience + build_libtool_libs=no + ;; + module) + oldobjs=$libobjs_save + addlibs=$old_convenience + build_libtool_libs=no + ;; + *) + oldobjs="$old_deplibs $non_pic_objects" + $preload && test -f "$symfileobj" \ + && func_append oldobjs " $symfileobj" + addlibs=$old_convenience + ;; + esac + + if test -n "$addlibs"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $addlibs + func_append oldobjs " $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append oldobjs " $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + echo "copying selected object files to avoid basename conflicts..." + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase=$func_basename_result + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" + ;; + *) func_append oldobjs " $obj" ;; + esac + done + fi + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj"; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test -z "$oldobjs"; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test yes = "$build_old_libs" && old_library=$libname.$libext + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_arg pretty,unquoted "$var_value" + relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + func_quote eval cd "`pwd`" + relink_command="($func_quote_result; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + func_quote_arg pretty,unquoted "$relink_command" + relink_command=$func_quote_arg_unquoted_result + if test yes = "$hardcode_automatic"; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test yes = "$installed"; then + if test -z "$install_libdir"; then + break + fi + output=$output_objdir/${outputname}i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name=$func_basename_result + func_resolve_sysroot "$deplib" + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` + test -z "$libdir" && \ + func_fatal_error "'$deplib' is not a valid libtool archive" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" + ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" + ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" + ;; + *) func_append newdependency_libs " $deplib" ;; + esac + done + dependency_libs=$newdependency_libs + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name=$func_basename_result + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "'$lib' is not a valid libtool archive" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" + ;; + *) func_append newdlfiles " $lib" ;; + esac + done + dlfiles=$newdlfiles + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name=$func_basename_result + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "'$lib' is not a valid libtool archive" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" + ;; + esac + done + dlprefiles=$newdlprefiles + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlfiles " $abs" + done + dlfiles=$newdlfiles + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlprefiles " $abs" + done + dlprefiles=$newdlprefiles + fi + $RM $output + # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test -n "$bindir"; then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result/$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that cannot go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test no,yes = "$installed,$need_relink"; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +if test link = "$opt_mode" || test relink = "$opt_mode"; then + func_mode_link ${1+"$@"} +fi + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $debug_cmd + + RM=$nonopt + files= + rmforce=false + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic=$magic + + for arg + do + case $arg in + -f) func_append RM " $arg"; rmforce=: ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + for file in $files; do + func_dirname "$file" "" "." + dir=$func_dirname_result + if test . = "$dir"; then + odir=$objdir + else + odir=$dir/$objdir + fi + func_basename "$file" + name=$func_basename_result + test uninstall = "$opt_mode" && odir=$dir + + # Remember odir for removal later, being careful to avoid duplicates + if test clean = "$opt_mode"; then + case " $rmdirs " in + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif $rmforce; then + continue + fi + + rmfiles=$file + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + func_append rmfiles " $odir/$n" + done + test -n "$old_library" && func_append rmfiles " $odir/$old_library" + + case $opt_mode in + clean) + case " $library_names " in + *" $dlname "*) ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; + esac + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && test none != "$pic_object"; then + func_append rmfiles " $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && test none != "$non_pic_object"; then + func_append rmfiles " $dir/$non_pic_object" + fi + fi + ;; + + *) + if test clean = "$opt_mode"; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + func_append rmfiles " $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + func_append rmfiles " $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + func_append rmfiles " $odir/$name $odir/${name}S.$objext" + if test yes = "$fast_install" && test -n "$relink_command"; then + func_append rmfiles " $odir/lt-$name" + fi + if test "X$noexename" != "X$name"; then + func_append rmfiles " $odir/lt-$noexename.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + + # Try to remove the $objdir's in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then + func_mode_uninstall ${1+"$@"} +fi + +test -z "$opt_mode" && { + help=$generic_help + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode '$opt_mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# where we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: + +# ### BEGIN LIBTOOL TAG CONFIG: CXX + +# The linker used to build libraries. +LD="/usr/bin/ld -m elf_x86_64" + +# How to create reloadable object files. +reload_flag=" -r" +reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" + +# Commands used to build an old-style archive. +old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib" + +# A language specific compiler. +CC="g++" + +# Is the compiler the GNU compiler? +with_gcc=yes + +# Compiler flag to turn off builtin functions. +no_builtin_flag=" -fno-builtin" + +# Additional compiler flags for building library objects. +pic_flag=" -fPIC -DPIC" + +# How to pass a linker flag through the compiler. +wl="-Wl," + +# Compiler flag to prevent dynamic linking. +link_static_flag="-static" + +# Does compiler simultaneously support -c and -o options? +compiler_c_o="yes" + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=no + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=no + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec="\$wl--export-dynamic" + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive" + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object="no" + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds="" + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds="" + +# Commands used to build a shared archive. +archive_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \$wl-soname \$wl\$soname -o \$lib" +archive_expsym_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \$wl-soname \$wl\$soname \$wl-retain-symbols-file \$wl\$export_symbols -o \$lib" + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds="" +module_expsym_cmds="" + +# Whether we are building with GNU ld or not. +with_gnu_ld="yes" + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag="" + +# Flag that enforces no undefined symbols. +no_undefined_flag="" + +# Flag to hardcode $libdir into a binary during linking. +# This must work even if $libdir does not exist +hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir" + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator="" + +# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=no + +# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting $shlibpath_var if the +# library is relocated. +hardcode_direct_absolute=no + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=no + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=unsupported + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=no + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=no + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=unknown + +# Set to "yes" if exported symbols are required. +always_export_symbols=no + +# The commands to list exported symbols. +export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*" + +# Symbols that must always be exported. +include_expsyms="" + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds="" + +# Commands necessary for finishing linking programs. +postlink_cmds="" + +# Specify filename containing input files. +file_list_spec="" + +# How to hardcode a shared library path into an executable. +hardcode_action=immediate + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs="/usr/lib/gcc/x86_64-linux-gnu/13 /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu /usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /usr/lib/gcc/x86_64-linux-gnu/13/../../.." + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects="/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o" +postdep_objects="/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o" +predeps="" +postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s" + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path="-L/usr/lib/gcc/x86_64-linux-gnu/13 -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/13/../../.." + +# ### END LIBTOOL TAG CONFIG: CXX diff --git a/vendor/unuran-1.11.0/scripts/.deps/compute_machine_constants.Po b/vendor/unuran-1.11.0/scripts/.deps/compute_machine_constants.Po new file mode 100644 index 0000000..db56a99 --- /dev/null +++ b/vendor/unuran-1.11.0/scripts/.deps/compute_machine_constants.Po @@ -0,0 +1,121 @@ +compute_machine_constants.o: compute_machine_constants.c \ + /usr/include/stdc-predef.h \ + /usr/lib/gcc/x86_64-linux-gnu/13/include/float.h /usr/include/math.h \ + /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \ + /usr/include/features.h /usr/include/features-time64.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/bits/timesize.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/long-double.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/time64.h \ + /usr/include/x86_64-linux-gnu/bits/math-vector.h \ + /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \ + /usr/include/x86_64-linux-gnu/bits/floatn.h \ + /usr/include/x86_64-linux-gnu/bits/floatn-common.h \ + /usr/include/x86_64-linux-gnu/bits/flt-eval-method.h \ + /usr/include/x86_64-linux-gnu/bits/fp-logb.h \ + /usr/include/x86_64-linux-gnu/bits/fp-fast.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls.h /usr/include/stdlib.h \ + /usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h \ + /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h \ + /usr/include/x86_64-linux-gnu/sys/types.h \ + /usr/include/x86_64-linux-gnu/bits/types/clock_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/clockid_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/time_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/timer_t.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-intn.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endianness.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/uintn-identity.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/types/sigset_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h \ + /usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \ + /usr/include/x86_64-linux-gnu/bits/thread-shared-types.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h \ + /usr/include/x86_64-linux-gnu/bits/atomic_wide_counter.h \ + /usr/include/x86_64-linux-gnu/bits/struct_mutex.h \ + /usr/include/x86_64-linux-gnu/bits/struct_rwlock.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h /usr/include/stdio.h \ + /usr/lib/gcc/x86_64-linux-gnu/13/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/__FILE.h \ + /usr/include/x86_64-linux-gnu/bits/types/FILE.h \ + /usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h \ + /usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h \ + /usr/include/x86_64-linux-gnu/bits/stdio_lim.h +/usr/include/stdc-predef.h: +/usr/lib/gcc/x86_64-linux-gnu/13/include/float.h: +/usr/include/math.h: +/usr/include/x86_64-linux-gnu/bits/libc-header-start.h: +/usr/include/features.h: +/usr/include/features-time64.h: +/usr/include/x86_64-linux-gnu/bits/wordsize.h: +/usr/include/x86_64-linux-gnu/bits/timesize.h: +/usr/include/x86_64-linux-gnu/sys/cdefs.h: +/usr/include/x86_64-linux-gnu/bits/long-double.h: +/usr/include/x86_64-linux-gnu/gnu/stubs.h: +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: +/usr/include/x86_64-linux-gnu/bits/types.h: +/usr/include/x86_64-linux-gnu/bits/typesizes.h: +/usr/include/x86_64-linux-gnu/bits/time64.h: +/usr/include/x86_64-linux-gnu/bits/math-vector.h: +/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h: +/usr/include/x86_64-linux-gnu/bits/floatn.h: +/usr/include/x86_64-linux-gnu/bits/floatn-common.h: +/usr/include/x86_64-linux-gnu/bits/flt-eval-method.h: +/usr/include/x86_64-linux-gnu/bits/fp-logb.h: +/usr/include/x86_64-linux-gnu/bits/fp-fast.h: +/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h: +/usr/include/x86_64-linux-gnu/bits/mathcalls.h: +/usr/include/stdlib.h: +/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h: +/usr/include/x86_64-linux-gnu/bits/waitflags.h: +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: +/usr/include/x86_64-linux-gnu/sys/types.h: +/usr/include/x86_64-linux-gnu/bits/types/clock_t.h: +/usr/include/x86_64-linux-gnu/bits/types/clockid_t.h: +/usr/include/x86_64-linux-gnu/bits/types/time_t.h: +/usr/include/x86_64-linux-gnu/bits/types/timer_t.h: +/usr/include/x86_64-linux-gnu/bits/stdint-intn.h: +/usr/include/endian.h: +/usr/include/x86_64-linux-gnu/bits/endian.h: +/usr/include/x86_64-linux-gnu/bits/endianness.h: +/usr/include/x86_64-linux-gnu/bits/byteswap.h: +/usr/include/x86_64-linux-gnu/bits/uintn-identity.h: +/usr/include/x86_64-linux-gnu/sys/select.h: +/usr/include/x86_64-linux-gnu/bits/select.h: +/usr/include/x86_64-linux-gnu/bits/types/sigset_t.h: +/usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h: +/usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h: +/usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h: +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: +/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h: +/usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h: +/usr/include/x86_64-linux-gnu/bits/atomic_wide_counter.h: +/usr/include/x86_64-linux-gnu/bits/struct_mutex.h: +/usr/include/x86_64-linux-gnu/bits/struct_rwlock.h: +/usr/include/alloca.h: +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: +/usr/include/stdio.h: +/usr/lib/gcc/x86_64-linux-gnu/13/include/stdarg.h: +/usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h: +/usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h: +/usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h: +/usr/include/x86_64-linux-gnu/bits/types/__FILE.h: +/usr/include/x86_64-linux-gnu/bits/types/FILE.h: +/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h: +/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h: +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: diff --git a/vendor/unuran-1.11.0/scripts/Makefile b/vendor/unuran-1.11.0/scripts/Makefile new file mode 100644 index 0000000..d7cf385 --- /dev/null +++ b/vendor/unuran-1.11.0/scripts/Makefile @@ -0,0 +1,642 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# scripts/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/unuran +pkgincludedir = $(includedir)/unuran +pkglibdir = $(libdir)/unuran +pkglibexecdir = $(libexecdir)/unuran +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +noinst_PROGRAMS = compute_machine_constants$(EXEEXT) +subdir = scripts +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +compute_machine_constants_SOURCES = compute_machine_constants.c +compute_machine_constants_OBJECTS = \ + compute_machine_constants.$(OBJEXT) +compute_machine_constants_LDADD = $(LDADD) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I. -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/compute_machine_constants.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = compute_machine_constants.c +DIST_SOURCES = compute_machine_constants.c +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_CFLAGS = -Wall -Wextra -Wshadow -Wstrict-prototypes +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf +AUTOHEADER = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader +AUTOMAKE = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -fPIC +CPP = gcc -E +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +FILECMD = file +GREP = /usr/bin/grep +HAVE_DIVIDE_BY_ZERO = +HAVE_IEEE_COMPARISONS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAINT = # +MAKEINFO = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = unuran +PACKAGE_BUGREPORT = unuran@statmath.wu.ac.at +PACKAGE_NAME = unuran +PACKAGE_STRING = unuran 1.11.0 +PACKAGE_TARNAME = unuran +PACKAGE_URL = +PACKAGE_VERSION = 1.11.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +UNURAN_LT_VERSION = 16:1:0 +UNURAN_SUPPORTS_GSL = +UNURAN_SUPPORTS_PRNG = +UNURAN_SUPPORTS_RNGSTREAM = +VERSION = 1.11.0 +abs_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/scripts +abs_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/scripts +abs_top_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +have_valgrind = false +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../ +top_builddir = .. +top_srcdir = .. +EXTRA_DIST = \ + make_urng_header.pl \ + merge_h.pl \ + read_PDF.pl \ + remove_comments.pl \ + run_valgrind.sh \ +\ + win32/Makefile.win32 \ + win32/build.sh \ + win32/make_dll_def.pl \ + win32/example1.c \ + win32/example2.c + +noinst_HEADERS = \ + $(top_srcdir)/src/utils/unur_fp_const_source.h + + +# clean backup files +CLEANFILES = \ + *~ \ + win32/*~ + + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign scripts/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign scripts/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +compute_machine_constants$(EXEEXT): $(compute_machine_constants_OBJECTS) $(compute_machine_constants_DEPENDENCIES) $(EXTRA_compute_machine_constants_DEPENDENCIES) + @rm -f compute_machine_constants$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(compute_machine_constants_OBJECTS) $(compute_machine_constants_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/compute_machine_constants.Po # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ $< + +.c.obj: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: + $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +# $(AM_V_CC)source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/compute_machine_constants.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/compute_machine_constants.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# create files with floating point constants +$(top_srcdir)/src/utils/unur_fp_const_source.h: compute_machine_constants + test -f $(top_srcdir)/src/utils/unur_fp_const_source.h \ + || ./compute_machine_constants > $(top_srcdir)/src/utils/unur_fp_const_source.h + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/scripts/Makefile.am b/vendor/unuran-1.11.0/scripts/Makefile.am new file mode 100644 index 0000000..d38ed13 --- /dev/null +++ b/vendor/unuran-1.11.0/scripts/Makefile.am @@ -0,0 +1,33 @@ +## Process this file with automake to produce Makefile.in + +noinst_PROGRAMS = compute_machine_constants + +EXTRA_DIST = \ + make_urng_header.pl \ + merge_h.pl \ + read_PDF.pl \ + remove_comments.pl \ + run_valgrind.sh \ +\ + win32/Makefile.win32 \ + win32/build.sh \ + win32/make_dll_def.pl \ + win32/example1.c \ + win32/example2.c + +noinst_HEADERS = \ + $(top_srcdir)/src/utils/unur_fp_const_source.h + +# create files with floating point constants +$(top_srcdir)/src/utils/unur_fp_const_source.h: compute_machine_constants + test -f $(top_srcdir)/src/utils/unur_fp_const_source.h \ + || ./compute_machine_constants > $(top_srcdir)/src/utils/unur_fp_const_source.h + +# clean backup files +CLEANFILES = \ + *~ \ + win32/*~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/vendor/unuran-1.11.0/scripts/Makefile.in b/vendor/unuran-1.11.0/scripts/Makefile.in new file mode 100644 index 0000000..cfc871b --- /dev/null +++ b/vendor/unuran-1.11.0/scripts/Makefile.in @@ -0,0 +1,642 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = compute_machine_constants$(EXEEXT) +subdir = scripts +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +compute_machine_constants_SOURCES = compute_machine_constants.c +compute_machine_constants_OBJECTS = \ + compute_machine_constants.$(OBJEXT) +compute_machine_constants_LDADD = $(LDADD) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/compute_machine_constants.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = compute_machine_constants.c +DIST_SOURCES = compute_machine_constants.c +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ +UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ +UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ +UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_valgrind = @have_valgrind@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = \ + make_urng_header.pl \ + merge_h.pl \ + read_PDF.pl \ + remove_comments.pl \ + run_valgrind.sh \ +\ + win32/Makefile.win32 \ + win32/build.sh \ + win32/make_dll_def.pl \ + win32/example1.c \ + win32/example2.c + +noinst_HEADERS = \ + $(top_srcdir)/src/utils/unur_fp_const_source.h + + +# clean backup files +CLEANFILES = \ + *~ \ + win32/*~ + + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign scripts/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign scripts/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +compute_machine_constants$(EXEEXT): $(compute_machine_constants_OBJECTS) $(compute_machine_constants_DEPENDENCIES) $(EXTRA_compute_machine_constants_DEPENDENCIES) + @rm -f compute_machine_constants$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(compute_machine_constants_OBJECTS) $(compute_machine_constants_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compute_machine_constants.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/compute_machine_constants.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/compute_machine_constants.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# create files with floating point constants +$(top_srcdir)/src/utils/unur_fp_const_source.h: compute_machine_constants + test -f $(top_srcdir)/src/utils/unur_fp_const_source.h \ + || ./compute_machine_constants > $(top_srcdir)/src/utils/unur_fp_const_source.h + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/scripts/compute_machine_constants b/vendor/unuran-1.11.0/scripts/compute_machine_constants new file mode 100755 index 0000000..3b8fa63 Binary files /dev/null and b/vendor/unuran-1.11.0/scripts/compute_machine_constants differ diff --git a/vendor/unuran-1.11.0/scripts/compute_machine_constants.c b/vendor/unuran-1.11.0/scripts/compute_machine_constants.c new file mode 100644 index 0000000..6c1498a --- /dev/null +++ b/vendor/unuran-1.11.0/scripts/compute_machine_constants.c @@ -0,0 +1,111 @@ +/***************************************************************************** + * * + * unuran -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: compute_machine_constants.c * + * * + * Compute some machine constants and print to stdout * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include + +/*---------------------------------------------------------------------------*/ + +/** TODO: +#define MAXLGM 2.556348e305 +**/ + +/*---------------------------------------------------------------------------*/ + +int main(void) +{ + + printf("/** File automatically created by scripts/compute_machine_constants **/\n\n"); + + printf("/*****************************************************************************\n"); + printf(" * *\n"); + printf(" * unuran -- Universal Non-Uniform Random number generator *\n"); + printf(" * *\n"); + printf(" *****************************************************************************/\n"); + + printf("\n"); + + printf("/*---------------------------------------------------------------------------*/\n"); + printf("#ifndef UNUR_FP_CONST_SOURCE_H_SEEN\n"); + printf("#define UNUR_FP_CONST_SOURCE_H_SEEN\n"); + printf("/*---------------------------------------------------------------------------*/\n\n"); + + + /* Epsilon for comparision of two doubles: */ + /* Two doubles are considered equal if there relative difference is */ + /* less than UNUR_EPSILON (see file `./methods/source_fp.h' for details). */ + /* Use 100 times DBL_EPSILON. */ + + printf("/* maximal relative error when testing equality of two doubles */\n"); + printf("#define UNUR_EPSILON %.30g\n\n", 100.*DBL_EPSILON); + + + /* Square root of machine epsilon. It is used to compare two doubles */ + /* when round-off errors have to be considered */ + /* (see file `./methods/source_fp.h' for details). */ + + printf("/* square root of DBL_EPSILON */\n"); + printf("#define UNUR_SQRT_DBL_EPSILON %.30g\n\n", sqrt(DBL_EPSILON)); + + /* Log of machine epsilon. */ + /* Negative of least number x such that exp(x)-1. == exp(x) */ + + printf("/* log of DBL_EPSILON */\n"); + printf("#define UNUR_LOG_DBL_EPSILON %.30g\n\n", log(DBL_EPSILON)); + + /* Constants used by CEPHES functions */ + + printf("/* the machine roundoff error */\n"); + printf("#define MACHEP %.30g\n\n", DBL_EPSILON/2.); + + printf("/* largest argument for exp() */\n"); + printf("#define MAXLOG %.30g\n\n", log(DBL_MAX)); + + printf("/* smallest argument for exp() without underflow */\n"); + printf("#define MINLOG %.30g\n\n", log(DBL_MIN)); + + printf("/* the maximal number that pow(x,x-0.5) has no overflow */\n"); + printf("/* we use a (very) conservative portable bound */\n"); + printf("#define MAXSTIR %.30g\n\n", log(DBL_MAX) / log(log(DBL_MAX)) ); + + printf("/*---------------------------------------------------------------------------*/\n"); + printf("#endif /* UNUR_FP_CONST_SOURCE_H_SEEN */\n"); + printf("/*---------------------------------------------------------------------------*/\n"); + + exit (0); +} + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/scripts/make_urng_header.pl b/vendor/unuran-1.11.0/scripts/make_urng_header.pl new file mode 100755 index 0000000..fca53af --- /dev/null +++ b/vendor/unuran-1.11.0/scripts/make_urng_header.pl @@ -0,0 +1,134 @@ +#!/usr/bin/perl +############################################################################## +# # +# UNURAN -- Universal Non-Uniform Random number generator # +# # +############################################################################## +# # +# FILE: make_urng_header.pl # +# # +# Make header file for UNU.RAN wrapper functions for external URNGs # +# # +############################################################################## +# # +# Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold # +# Department of Statistics and Mathematics, WU Wien, Austria # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the # +# Free Software Foundation, Inc., # +# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA # +# # +############################################################################## + +use strict; + +my $DEBUG = 0; + +############################################################ + +sub usage { + my $progname = $0; + $progname =~ s#^.*/##g; + + print STDERR < [ ...] + +Create header file for wrappers for external URNGs + +EOM + + exit -1; +} + +############################################################ + +# year +my $year = 1900 + (localtime(time))[5]; + +# content of files +my $out = ''; + +# copyright statment +my $copyright = + "/*******************************************************************\\\n". + " * *\n". + " * UNU.RAN -- Universal Non-Uniform Random number generator *\n". + " * *\n". + " *******************************************************************\n". + " * Copyright (c) 2000-$year Wolfgang Hoermann and Josef Leydold *\n". + " * Department of Statistics and Mathematics, WU Wien, Austria *\n". + "\\*******************************************************************/\n"; + +my $CPP_header = + "#undef __BEGIN_DECLS\n". + "#undef __END_DECLS\n". + "#ifdef __cplusplus\n". + "# define __BEGIN_DECLS extern \"C\" {\n". + "# define __END_DECLS }\n". + "#else\n". + "# define __BEGIN_DECLS /* empty */\n". + "# define __END_DECLS /* empty */\n". + "#endif\n". + "\n". + "__BEGIN_DECLS\n\n"; + +my $CPP_bottom = + "__END_DECLS\n"; + +# marker +my $marker = ''; + +# read file name from argument list ... +while (my $file = shift) { + + # open file ... + open IN, $file or die "cannot open file $file\n"; + + # do we have to define a marker? + unless ($marker) { + $marker = "UNURAN_" . uc($file) . "_SEEN"; + $marker =~ s/\W/\_/g; + } + + # read file ... + my $content = ''; + while () { $content .= $_; } + close IN; + + # remove all comments and empty lines ... + $content =~ s {/\*.*?\*/} []gsx; + $content =~ s /\n\s*\n/\n/gsx; + + # remove ifdef ...H_SEEN + if ($content =~ /\#ifndef URNG_.*_H_SEEN/) { + $content =~ s {\#ifndef\s+URNG_.*_H_SEEN\s+\#define\s+URNG_.*_H_SEEN\s*\n} []gsx; + $content =~ s /\#endif\s+$//gsx; + } + + # add to output + $out .= $content; +} + +print $copyright . + $CPP_header . + "\#ifndef $marker\n" . + "\#define $marker\n" . + $out . + "\#endif /* $marker */\n" . + $CPP_bottom; + +# end +exit 0; + +############################################################ diff --git a/vendor/unuran-1.11.0/scripts/merge_h.pl b/vendor/unuran-1.11.0/scripts/merge_h.pl new file mode 100755 index 0000000..3b62a31 --- /dev/null +++ b/vendor/unuran-1.11.0/scripts/merge_h.pl @@ -0,0 +1,244 @@ +#!/usr/bin/perl +############################################################################## +# # +# UNURAN -- Universal Non-Uniform Random number generator # +# # +############################################################################## +# # +# FILE: merge_h.pl # +# # +# Read all UNU.RAN header files, strip comments and create single header # +# file 'unuran.h' # +# # +############################################################################## +# # +# Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold # +# Department of Statistics and Mathematics, WU Wien, Austria # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the # +# Free Software Foundation, Inc., # +# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA # +# # +############################################################################## + +use strict; + +my $DEBUG = 0; + +############################################################ +# constants + +my $DEP_file = ".dep-unuran_h"; + +############################################################ + +sub usage { + my $progname = $0; + $progname =~ s#^.*/##g; + + print STDERR < + +Scans and inserts all header files found in subtree +rooted at current working directory. +Other header files and those with names containing "config" +are ignored and just #included. +All comments and blank lines are removed. +The output is written on stdout. + +EOM + + exit -1; +} + +############################################################ + +# dependencies +my $DEP = "unuran.h: "; + +############################################################ + +sub h_file_header { + print <) { + chomp; + next unless /^.*\/+(.*\.h)$/; + next if /config/; + $header_files{$1} = $_; # store file and path of file +} +close FILES; + +# insert file header ... +h_file_header; + +# scan master file ... +scan_file ($master_file,0); + +# insert bottom of file +h_file_bottom; + +# write dependencies +open DEP, ">$DEP_file" or die "Cannot open file for writing: $DEP_file"; +print DEP "$DEP\n"; +close DEP; + +exit 0; + +############################################################ + +# scan given file ... +sub scan_file { + my $file = $_[0]; + my $level = $_[1]+1; + my $handle = new FileHandle; + + print STDERR "$file\n"; + + # open file ... + open $handle, $file or die "cannot find file $file\n"; + + # read file ... + my $content = ''; + while (<$handle>) { + $content .= $_; + } + close $handle; + + # remove all comments and empty lines ... + $content =~ s {/\*.*?\*/} []gsx; + $content =~ s /\n\s*\n/\n/gsx; + + # split into lines ... + my @lines = split /\n/, $content; + + foreach my $line (@lines) { + unless ($line =~ /^\#include\s+[<\"](.*)[>\"]/) { + print "$line\n"; + next; + } + + # have found a file to be included ... + my @tmp = split /\//, $1; + my $include_file = pop @tmp; + print STDERR "$include_file " if $DEBUG; + + # we do not include header files out of the subtree ... + unless (defined( $header_files{$include_file} ) ) { + print STDERR "file not found in subtree ... #include\n" if $DEBUG; + print "\n$line\n\n"; + next; + } + + # we include header files only once ... + if (defined( $header_included{$include_file} ) ) { + print STDERR "already included ... skip\n" if $DEBUG; + next; + } + + $header_included{$include_file} .= 1; + + # have found header file ... + print STDERR "to be inserted\n" if $DEBUG; + print "/*-----*/\n"; + print "/* <$level> `$include_file' */"; + + # add dependency + $DEP .= "$header_files{$include_file} "; + + # scan header file ... + scan_file ($header_files{$include_file},$level); + + print "/* end of `$include_file' */\n"; + print "/*-----*/\n"; + } + +} + +############################################################ + +############################################################ + diff --git a/vendor/unuran-1.11.0/scripts/read_PDF.pl b/vendor/unuran-1.11.0/scripts/read_PDF.pl new file mode 100644 index 0000000..c7390cc --- /dev/null +++ b/vendor/unuran-1.11.0/scripts/read_PDF.pl @@ -0,0 +1,506 @@ +############################################################################## +# # +# UNURAN -- Universal Non-Uniform Random number generator # +# # +############################################################################## +# # +# FILE: read_PDF.pl # +# # +# Subroutine read_PDFdata(): # +# # +# Read all UNU.RAN C files and extract information about PDFs of # +# distributions. The result is stored in an associate array and returned. # +# # +############################################################################## +# # +# Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold # +# Department of Statistics and Mathematics, WU Wien, Austria # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the # +# Free Software Foundation, Inc., # +# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA # +# # +############################################################################## + +use strict; +use File::Find; + +# ---------------------------------------------------------------- +# Global constants + +# Header file for UNU.RAN standard distributions +my $h_stddistr = "unur_distributions.h"; + +# List of distribution types +my %distr_types = + ( "CONT" => { "file_prefix" => "c", + "PDF_prefix" => "_unur_pdf_", + "PDF_type" => "double" }, + + "CVEC" => { "file_prefix" => "vc", + "PDF_prefix" => "-none-", + "PDF_type" => "-none-" }, + + "DISCR" => { "file_prefix" => "d", + "PDF_prefix" => "_unur_pmf_", + "PDF_type" => "double" }, + + "MATR" => { "file_prefix" => "m", + "PDF_prefix" => "-none-", + "PDF_type" => "-none-" } ); + +# ................................................................ +# List of files +my %file_list; + +# ................................................................ +# List of distributions +my $DISTR; + +# Description of data fields (with beta distribution as example) +# +# $DISTR->{"beta"} ... entries for distribution "beta" +# +# $DISTR->{"beta"}->{"=NAME"} ... name of distribution +# $DISTR->{"beta"}->{"=TYPE"} ... type of distribution (CONT|DISCR) +# $DISTR->{"beta"}->{"=FILE"} ... file name + path for C file +# $DISTR->{"beta"}->{"=ID"} ... id of distribution +# +# $DISTR->{"beta"}->{"=DOC"} ... documentation for distribution +# $DISTR->{"beta"}->{"=DOC"}->{"=PDF"} ... formula for PDF +# $DISTR->{"beta"}->{"=DOC"}->{"=CONST"} ... normalization constant for PDF +# $DISTR->{"beta"}->{"=DOC"}->{"=CDF"} ... formula for CDF +# $DISTR->{"beta"}->{"=DOC"}->{"=DOMAIN"} ... domain for PDF +# $DISTR->{"beta"}->{"=DOC"}->{"=FPARAM"} ... list of parameters with constraints +# Remark: There exist other fields which are not relevant here +# (see src/distributions/unur_distributions.h). +# +# $DISTR->{"beta"}->{"=PDF"} ... PDF of distribution +# $DISTR->{"beta"}->{"=PDF"}->{"=NAME"} ... name of PDF +# $DISTR->{"beta"}->{"=PDF"}->{"=RTYPE"} ... return type of PDF +# $DISTR->{"beta"}->{"=PDF"}->{"=ARGS"} ... list of arguments for PDF +# $DISTR->{"beta"}->{"=PDF"}->{"=N_PARAMS"} ... number of parameters for PDF +# $DISTR->{"beta"}->{"=PDF"}->{"=PARAMS"}[2] ... parameter #2 for PDF (starting at 0) +# $DISTR->{"beta"}->{"=PDF"}->{"=BODY"} ... function body of PDF +# $DISTR->{"beta"}->{"=PDF"}->{"=CONST"} ... macro expansion for (LOG)NORMCONSTANT +# $DISTR->{"beta"}->{"=PDF"}->{"=DISTR"} ... macro expansion for DISTR +# + +# ---------------------------------------------------------------- +# Read data for PDF from source code + +sub read_PDFdata { + +# Start the search for the files in these directories + my @Startdirs = @_; + +# ................................................................ +# List of files + find (\&find_files, @Startdirs); + +# ................................................................ +# Scan header file for UNU.RAN standard distributions +# and get a list of valid distributions + scan_stddistr( $file_list{$h_stddistr} ); + +# ................................................................ +# End. Return result + return $DISTR; + +} # end of read_PDFdata() + +# ---------------------------------------------------------------- +# +# Subroutines +# +# ---------------------------------------------------------------- + +# ---------------------------------------------------------------- +# Finds recursively all C- or H-files containing the relevant +# informations. + +sub find_files +{ + if ($File::Find::name =~ /(.*\/)?(.+\.[ch])$/ ) { + my $file_path = $File::Find::name; + my $file_name = $2; + $file_list{$file_name} = $file_path; + } +} # end of find_files() + + +# ---------------------------------------------------------------- +# Scan header file for UNU.RAN standard distributions + +sub scan_stddistr +{ + # header file for standard distributions + my $file = shift; + + # Read header file + open HFILE, $file or die "cannot open file \"$file\".\n"; + my $file_content; + while () { + chomp; + $_ =~ s/^\s*(.*)\s*$/$1/; + $file_content .= "$_\n"; + } + close HFILE; + + # Split into sections + my @sections = split /=EON/, $file_content; + + # Scan sections + foreach my $s (@sections) { + # Remove trailing part of sections + (my $dummy, $s) = split /=DISTR/, $s, 2; + next unless $s; + + # Get name of distribution + $s =~ s/(\w+)\s+(.+)\n//; + my $distr = $1; + $DISTR->{$distr}->{"=NAME"} = $2; + + # Scan distribution section + scan_distr($distr,$s); + + # Get type of distribution and path of distribution file + get_distr_file($distr); + + # Read distribution file + read_distr_file($distr); + } + +} # end of scan_h_stddistr() + +# ---------------------------------------------------------------- +# Scan distribution + +sub scan_distr +{ + # distribution + my $distr = $_[0]; + + # description of distribution + my $distr_text = $_[1]; + + # add =END TAG to text (for convenience) + $distr_text .= "\n=END"; + + # split into lines + my @lines = split /\n/, $distr_text; + + # scan all TAGs (node sections) + my $this_TAG = "=END"; # add =END tag to node TAG + + foreach my $l (@lines) { + # next TAG ? + if ($l =~ /^\s*(\/\*)?\s*(=[A-Z]+)\s*(.*)$/) { + # store next TAG + $this_TAG = $2; + # save rest of line + $l = $3; + } + + # append to stored lines + # (except for =END TAG) + unless ($this_TAG eq "=END") { + $DISTR->{$distr}->{"=DOC"}->{$this_TAG} .= $l."\n"; + } + } + +} # end of scan_distr() + +# ---------------------------------------------------------------- +# Get type of distribution and path of distribution file + +sub get_distr_file +{ + # distribution + my $distr = $_[0]; + + my $found = 0; + + foreach my $type (keys %distr_types) { + next unless $type; + my $file_name = $distr_types{$type}{"file_prefix"}."\_$distr\.c"; + if ($file_list{$file_name}) { + $found = 1; + $DISTR->{$distr}->{"=FILE"} = $file_list{$file_name}; + $DISTR->{$distr}->{"=TYPE"} = $type; + last; + } + } + + die "Cannot find file for $distr" unless $found; + +} # end of get_distr_file() + +# ---------------------------------------------------------------- +# Read distribution file + +sub read_distr_file +{ + # distribution + my $distr = $_[0]; + + # Read file + my $file = $DISTR->{$distr}->{"=FILE"}; + open CFILE, $file or die "cannot open file $file\n"; + my $file_content; + while () { + $file_content .= $_; + } + close CFILE; + + # Check distribution name + $file_content =~ /static\s+const\s+char\s+distr\_name\s*\[\s*\]\s*=\s*\"$distr\"/ + or die "$distr: distr_name inconsistent"; + + # Type of distribution + my $type = $DISTR->{$distr}->{"=TYPE"}; + + # Get PDF source + my $PDF_name; + unless ($distr_types{$type}{"PDF_prefix"} eq "-none-") { + $PDF_name = $distr_types{$type}{"PDF_prefix"}.$distr; + my $PDF_pattern = + "(int|double)\\s+" # $1: return type + .$PDF_name # name of function + ."\\s*\\(([^\\)]*)\\)\\s*" # $2: arguments of function + ."([^;])" # $3: first character (to distinguish from prototype) + ."(.*)" # $4: function body + ."\\/\\*\\s+end\\s+of\\s+$PDF_name"; # end of function marker + + $file_content =~ /$PDF_pattern/s + or die "cannot find PDF for $distr"; + + # Store data + $DISTR->{$distr}->{"=PDF"}->{"=NAME"} = $PDF_name; # name of PDF function + $DISTR->{$distr}->{"=PDF"}->{"=RTYPE"} = $1; # return type + $DISTR->{$distr}->{"=PDF"}->{"=ARGS"} = $2; # arguments for function + $DISTR->{$distr}->{"=PDF"}->{"=BODY"} = polish_C_code($3.$4); # function body + } + else { + $PDF_name = ""; + $DISTR->{$distr}->{"=PDF"}->{"=NAME"} = ""; + $DISTR->{$distr}->{"=PDF"}->{"=RTYPE"} = ""; + $DISTR->{$distr}->{"=PDF"}->{"=ARGS"} = ""; + $DISTR->{$distr}->{"=PDF"}->{"=BODY"} = ""; + } + + # Modify function arguments: + # remove DISTR from argument list + $DISTR->{$distr}->{"=PDF"}->{"=ARGS"} =~ + s /\,\s*(UNUR_DISTR|struct unur_distr)\s*\*\s*distr\s*//; + + # Get parameters for PDF + $file_content =~ s {/\*.*?\*/} []gsx; # remove all comments + my @lines = split /\n/, $file_content; + my $n_params = -1; + foreach my $l (@lines) { + next unless $l =~ /\#define\s+(\w+)\s+(.*)$/; + my $macro_name = $1; + my $macro_body = $2; + + if ($macro_body =~ /params\s*\[(\d)+\]/) { + $n_params = ($n_params < $1) ? $1 : $n_params; + $DISTR->{$distr}->{"=PDF"}->{"=PARAMS"}[$1] = $macro_name; + next; + } + + if ($macro_name =~ /(.*NORMCONSTANT)/) { + $DISTR->{$distr}->{"=PDF"}->{"=CONST"} = $macro_body; + next; + } + + if ($macro_name =~ /(DISTR)/) { + $DISTR->{$distr}->{"=PDF"}->{"=DISTR"} = $macro_body; + next; + } + } + + # Number of parameters for PDF + $DISTR->{$distr}->{"=PDF"}->{"=N_PARAMS"} = $n_params+1; + + # Id of distribution + $file_content =~ /distr\-\>id\s*=\s*(\w+)/ + or die "cannot find ID for $distr"; + $DISTR->{$distr}->{"=ID"} = $1; + +} # end of read_distr_file() + +# ---------------------------------------------------------------- +# Polish C code of function body + +sub polish_C_code { + my $code = $_[0]; + + # remove comments + $code =~ s {/\*.*?\*/} []gsx; + # remove enclosing brackets + $code =~ s /^\s*\{(.*)\}\s*$/$1/s; + # remove empty lines + $code =~ s /\n\s*\n/\n/gx; + $code =~ s /^\s*\n//; + # remove declaration of "params" + $code =~ s /.*(register)?\s+double\s*\*\s*params\W.*\n//; + # remove all `DISTR.' from body + $code =~ s /DISTR\.//g; + + # remove UNU.RAN-isms + + # expand _unur_iszero + while ($code =~ "_unur_iszero") { + $code = expand_unuris($code,"zero","==0.0"); + } + + # expand _unur_isone + while ($code =~ "_unur_isone") { + $code = expand_unuris($code,"one","==1.0"); + } + + # expand _unur_isfsame + while ($code =~ "_unur_isfsame") { + $code = expand_unurisfsame($code); + } + + # expand INFINITY + $code =~ s/(UNUR\_)?INFINITY/HUGE_VAL/g; + + return $code; + +} # end of polish_C_code() + +# ---------------------------------------------------------------- +# Expand _unur_is... functions + +sub expand_unuris +{ + my $code = $_[0]; + my $what = "_unur_is".$_[1]; + my $cmpstring = $_[2]; + + # split into part before UNU.RAN function name + # and part after name + my ($first,$second) = split /$what/, $code, 2; + + # split second part into argument of function call + # and part after function call + my ($arg,$remaining) = find_argument($second); + + # compile new string with UNU.RAN function call expanded (replaced) + $code = $first."((".$arg.")".$cmpstring.")".$remaining; + + return $code; +} # end of expand_unuris() + +# ................................................................ + +sub expand_unurisfsame +{ + my $code = $_[0]; + my $what = "_unur_isfsame"; + + # split into part before UNU.RAN function name + # and part after name + my ($first,$second) = split /$what/, $code, 2; + + # split second part into argument of function call + # and part after function call + my ($arg,$remaining) = find_argument($second); + + # split arguments + my (@args) = split /\,/, $arg; + die "Invalid number of arguments" unless $#args==1; + + # compile new string with UNU.RAN function call expanded (replaced) + $code = $first."((".$args[0].")==(".$args[1]."))".$remaining; + + return $code; +} # end of expand_unuris() + + +# ---------------------------------------------------------------- +# Find argument of function call (i.e. matching brackets) + +sub find_argument +{ + my $code = $_[0]; + + # remove leading blanks and check for starting '(' + $code =~ s/^\s+//; + die unless $code =~ /\(/; + + # find closing bracket ')' + my $open = 1; + my $idx = 1; + while ($open) { + ++$open if substr($code, $idx, 1) eq "("; + --$open if substr($code, $idx, 1) eq ")"; + ++$idx; + die "Cannot find closing bracket" if $idx > length($code); + } + my $arg = substr $code, 1, $idx-2; + my $remaining = substr $code, $idx; + + return ($arg, $remaining); + +} # end of find_argument() + +# ---------------------------------------------------------------- +# Print data on screen (for debugging) + +sub print_data +{ + # List of distributions + my $DISTR = $_[0]; + + foreach my $d (keys %{$DISTR}) { + print "-------------------------------------\n"; + print "distribution = \"$d\"\n"; + + print "NAME: ".$DISTR->{$d}->{"=NAME"}."\n"; + print "TYPE: ".$DISTR->{$d}->{"=TYPE"}."\n"; + print "ID : ".$DISTR->{$d}->{"=ID"}."\n"; + print "FILE: ".$DISTR->{$d}->{"=FILE"}."\n\n"; + + print "DOC: PDF : ".$DISTR->{$d}->{"=DOC"}->{"=PDF"}; + print "DOC: CONST : ".$DISTR->{$d}->{"=DOC"}->{"=CONST"}; + print "DOC: CDF : ".$DISTR->{$d}->{"=DOC"}->{"=CDF"}; + print "DOC: DOMAIN : ".$DISTR->{$d}->{"=DOC"}->{"=DOMAIN"}; + print "DOC: FPARAM :\n".$DISTR->{$d}->{"=DOC"}->{"=FPARAM"}."\n"; + + print "PDF: NAME : ".$DISTR->{$d}->{"=PDF"}->{"=NAME"}."\n"; + print "PDF: RTYPE : ".$DISTR->{$d}->{"=PDF"}->{"=RTYPE"}."\n"; + print "PDF: ARGS : ".$DISTR->{$d}->{"=PDF"}->{"=ARGS"}."\n"; + + print "PDF: PARAM : ".$DISTR->{$d}->{"=PDF"}->{"=N_PARAMS"}."\n"; + foreach my $i (0 .. $DISTR->{$d}->{"=PDF"}->{"=N_PARAMS"} - 1) { + print "\t[$i]: ".$DISTR->{$d}->{"=PDF"}->{"=PARAMS"}[$i]."\n" + } + + print "PDF: CONST : ".$DISTR->{$d}->{"=PDF"}->{"=CONST"}."\n"; + print "PDF: DISTR : ".$DISTR->{$d}->{"=PDF"}->{"=DISTR"}."\n"; + + print "PDF: BODY :\n".$DISTR->{$d}->{"=PDF"}->{"=BODY"}."\n"; + } + +} # end of print_data() + +# ---------------------------------------------------------------- +# End of file +return 1; + +# ---------------------------------------------------------------- diff --git a/vendor/unuran-1.11.0/scripts/remove_comments.pl b/vendor/unuran-1.11.0/scripts/remove_comments.pl new file mode 100755 index 0000000..a6b7591 --- /dev/null +++ b/vendor/unuran-1.11.0/scripts/remove_comments.pl @@ -0,0 +1,97 @@ +#!/usr/bin/perl +############################################################################## +# # +# UNURAN -- Universal Non-Uniform Random number generator # +# # +############################################################################## +# # +# FILE: remove_comments.pl # +# # +# Remove all comments and blank lines from given C source or header file # +# # +############################################################################## +# # +# Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold # +# Department of Statistics and Mathematics, WU Wien, Austria # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the # +# Free Software Foundation, Inc., # +# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA # +# # +############################################################################## + +use strict; + +my $DEBUG = 0; + +############################################################ + +sub usage { + my $progname = $0; + $progname =~ s#^.*/##g; + + print STDERR < + +Removes all comments and blank lines from C file + +EOM + + exit -1; +} + +############################################################ + +# year +my $year = 1900 + (localtime(time))[5]; + +# read file name from argument list ... +my $file = shift; +(usage and die) unless $file; +print "stripping $file ...\n"; + +# open file ... +open IN, $file or die "cannot open file $file\n"; + +# read file ... +my $content = ''; +while () { $content .= $_; } +close IN; + +# some comments must not be removed. +# so we first masks them +$content =~ s {/\*\s*FALLTHROUGH\s*\*/} [\@\@FALLTHROUGH\@\@]gsx; + +# remove all comments and empty lines ... +$content =~ s {/\*.*?\*/} []gsx; +$content =~ s /\n\s*\n/\n/gsx; + +# now unmask these special comments +$content =~ s {\@\@FALLTHROUGH\@\@} [/\* FALLTHROUGH \*/]gsx; + +# copyright statment +my $copyright = + "/* Copyright (c) 2000-$year Wolfgang Hoermann and Josef Leydold */\n" . + "/* Department of Statistics and Mathematics, WU Wien, Austria */\n"; + +# print into file +open OUT, ">$file"; +print OUT $copyright; +print OUT $content; +close OUT; + +# end +exit 0; + +############################################################ diff --git a/vendor/unuran-1.11.0/scripts/run_valgrind.sh b/vendor/unuran-1.11.0/scripts/run_valgrind.sh new file mode 100755 index 0000000..1c5efd0 --- /dev/null +++ b/vendor/unuran-1.11.0/scripts/run_valgrind.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# check arguments +test -z $1 && echo "Argument missing" && exit 1 + +test -f suppressions-valgrind && SUPPRESS="--suppressions=suppressions-valgrind" + +VALGRINDOPTIONS="-v --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=40 --show-reachable=yes --track-fds=yes $SUPPRESS" + +##VALGRINDOPTIONS="-v --stats=yes --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=40 --show-reachable=yes --track-fds=yes $SUPPRESS" + +PROG=`echo $1 | sed -e "s#\./##"` + +LOGFILENAME="valgrind-${PROG}" + +echo "run valgrind on ${PROG} ..." + +valgrind --log-file=${LOGFILENAME} ${VALGRINDOPTIONS} ./${PROG} + +echo ""; echo "Summary:"; echo "" +grep ERROR ${LOGFILENAME}* +grep lost ${LOGFILENAME}* +grep "All heap blocks were freed" ${LOGFILENAME}* +echo ""; echo "========================="; echo "" + +exit 0 diff --git a/vendor/unuran-1.11.0/scripts/win32/Makefile.win32 b/vendor/unuran-1.11.0/scripts/win32/Makefile.win32 new file mode 100644 index 0000000..605b8c5 --- /dev/null +++ b/vendor/unuran-1.11.0/scripts/win32/Makefile.win32 @@ -0,0 +1,184 @@ + +# --- Compiler and linker options ------------------------------------------- + +# VC Compiler flags +CFLAGS = -O1 -W3 -nologo -D_CRT_SECURE_NO_DEPRECATE -MD \ + -DHAVE_CONFIG_H -I./ -I./src/ -I./src/tests +CTESTFLAGS = -O2 -W3 -nologo -MD -I./ -I./src/ -I./src/tests + +# VC Linker flags +LINKFLAGS = -nologo -incremental:no -machine:IX86 + + +# --- Definitions ----------------------------------------------------------- + +# Where to find source files +TOP_SRCDIR := . +SCRIPTS_DIR=$(TOP_SRCDIR)/scripts +TESTS_DIR=$(TOP_SRCDIR)/tests + + +# Files for RngStreams libary +RNGSTREAM_SRC := $(TOP_SRCDIR)/src/uniform/RngStream.c +RNGSTREAM_H := $(TOP_SRCDIR)/src/uniform/RngStream.h +UNURAN_RNGSTREAM_H := $(TOP_SRCDIR)/src/uniform/unuran_urng_rngstreams.h +URNG_RNGSTREAM_H := $(TOP_SRCDIR)/src/uniform/urng_rngstreams.h + +RNGSTREAM_CFLAGS := $(shell test -z ${USE_RNGSTREAM} \ + || echo "-I./src/uniform -DUNURAN_HAS_RNGSTREAM -DUNURAN_SUPPORTS_RNGSTREAM -DUNUR_URNG_DEFAULT_RNGSTREAM" ) + + +# UNU.RAN version: major.minor +UNURAN_VERSION=$(shell \ + grep PACKAGE_VERSION $(TOP_SRCDIR)/config.h | \ + sed -e 's/.*_VERSION\s*\"\(.*\)\..*\"/\1/') + +# UNU.RAN library name +UNURAN_LIBNAME=libunuran$(shell echo $(UNURAN_VERSION) | sed 's/\.//') + + +# libUNURAN +UNURAN_SRC := $(wildcard $(TOP_SRCDIR)/src/*/*.c) +UNURAN_OBJ := $(UNURAN_SRC:.c=.obj) +UNURAN_H := $(TOP_SRCDIR)/src/unuran.h.in \ + $(TOP_SRCDIR)/src/tests/unuran_tests.h +UNURAN_SOURCE_H := $(wildcard $(TOP_SRCDIR)/src/*/*_source.h) + + +# DLL files +UNURAN_DEF=$(WINDIST_DIR)/$(UNURAN_LIBNAME).def +UNURAN_LIB=$(WINDIST_DIR)/$(UNURAN_LIBNAME).lib +UNURAN_DLL=$(WINDIST_DIR)/$(UNURAN_LIBNAME).dll + +# Header files for creating .DEF file +DEF_H := $(UNURAN_H) \ + $(shell test -z ${USE_PRIVATE} || echo "$(UNURAN_SOURCE_H)") \ + $(shell test -z ${USE_RNGSTREAM} || echo "$(UNURAN_RNGSTREAM_H)" ) + +INT=$(shell test -z ${USE_PRIVATE} || echo "-I") + + +# Examples +EXAMPLES_SRC := $(wildcard $(TOP_SRCDIR)/examples/*.c) \ + $(wildcard $(WINDIST_DIR)/example*.c) +EXAMPLES_OBJ := $(EXAMPLES_SRC:.c=.obj) +EXAMPLES_EXE := $(EXAMPLES_SRC:.c=.exe) + +# Test suite +UNURANTEST_SRC := $(wildcard $(TESTS_DIR)/testdistributions/*.c) \ + $(TESTS_DIR)/testroutines.c $(TESTS_DIR)/testcounter.c +UNURANTEST_OBJ := $(UNURANTEST_SRC:.c=.obj) + +TESTS_CONF := $(filter-out $(TESTS_DIR)/README.conf \ + $(TESTS_DIR)/t_deprecated%, \ + $(wildcard $(TESTS_DIR)/*.conf)) +TESTS_SRC := $(TESTS_CONF:.conf=.c) +TESTS_OBJ := $(TESTS_SRC:.c=.obj) +TESTS_EXE := $(TESTS_SRC:.c=.exe) + + +# Some special files: +# header file with constants for floating point arithmetic +FPCONST_H = $(TOP_SRCDIR)/src/utils/unur_fp_const_source.h + + +# --- Make DLL -------------------------------------------------------------- + +all: $(UNURAN_DLL) + + +# Create DLL +$(UNURAN_DLL): $(FPCONST_H) $(UNURAN_OBJ) $(UNURAN_DEF) + link $(LINKFLAGS) -DLL -out:$(UNURAN_DLL) \ + $(UNURAN_OBJ) -def:$(UNURAN_DEF) + +$(UNURAN_DEF): $(DEF_H) $(UNURAN_RNGSTREAM_H) + $(SCRIPTS_DIR)/win32/make_dll_def.pl -V $(UNURAN_VERSION) $(INT) \ + -L $(UNURAN_LIBNAME) $(DEF_H) > $(UNURAN_DEF) + +%.obj: %.c + $(CC) $(CFLAGS) $(RNGSTREAM_CFLAGS) -Fo$@ -c $< + +$(UNURAN_RNGSTREAM_H): $(URNG_RNGSTREAM_H) + $(SCRIPTS_DIR)/make_urng_header.pl \ + $(URNG_RNGSTREAM_H) > $(UNURAN_RNGSTREAM_H) + +$(FPCONST_H): $(SCRIPTS_DIR)/compute_machine_constants.exe + $(SCRIPTS_DIR)/compute_machine_constants.exe > $(FPCONST_H) + +$(SCRIPTS_DIR)/compute_machine_constants.exe: $(SCRIPTS_DIR)/compute_machine_constants.obj + $(LD) -nologo -Fe$(SCRIPTS_DIR)/compute_machine_constants.exe \ + $(SCRIPTS_DIR)/compute_machine_constants.obj + + +# --- Run tests ------------------------------------------------------------- + +# Compile, link and run examples +examples: $(EXAMPLES_EXE) + for f in $(EXAMPLES_EXE); do \ + echo "running $$f ..."; \ + eval $$f; \ + done + +$(EXAMPLES_EXE): $(EXAMPLES_OBJ) + $(LD) -nologo -O2 -W3 -Fe$@ $(@:.exe=.obj) $(UNURAN_LIB) + +$(EXAMPLES_OBJ): $(EXAMPLES_SRC) + $(CC) $(CFLAGS) $(RNGSTREAM_CFLAGS) -Fo$@ -c $(@:.obj=.c) + + +# Run test suite +check: $(UNURANTEST_OBJ) $(TESTS_EXE) + @for f in $(TESTS_EXE); do \ + echo "running $$f ..."; \ + eval $$f; \ + done + +$(TESTS_SRC): $(TESTS_CONF) + $(TESTS_DIR)/make_test_files.pl $(TOP_SRCDIR) $(@:.c=.conf) > $@ + +$(TESTS_EXE): $(TESTS_OBJ) $(UNURANTEST_OBJ) + $(LD) -nologo -Fe$@ $(@:.exe=.obj) $(UNURANTEST_OBJ) $(UNURAN_LIB) + +$(TESTS_OBJ): $(TESTS_SRC) + $(CC) $(CFLAGS) $(RNGSTREAM_CFLAGS) -Fo$@ -c $(@:.obj=.c) + + +# --- Create ZIP file ------------------------------------------------------ + +ZIPFILE := unuran-$(shell \ + grep PACKAGE_VERSION $(TOP_SRCDIR)/config.h | \ + sed -e 's/.*_VERSION\s*\"\(.*\)\"/\1/')-win32.zip + +UNURANWIN_DIR := unuran + +zip: + @echo "Create ZIP file '$(ZIPFILE)' ..." + test ! -d $(UNURANWIN_DIR) || rm -rf $(UNURANWIN_DIR) + test ! -f $(ZIPFILE) || rm -f $(ZIPFILE) + test -d $(WINDIST_DIR) && \ + mv $(WINDIST_DIR) $(UNURANWIN_DIR) && \ + zip -r $(ZIPFILE) $(UNURANWIN_DIR) && \ + rm -rf $(UNURANWIN_DIR) + + +# --- Clear working space -------------------------------------------------- + +# Remove created files +clean: + rm -rf $(WINDIST_DIR) + rm -rf $(UNURANWIN_DIR) + rm -f $(ZIPFILE) + rm -f $(UNURAN_OBJ) + rm -f $(SCRIPTS_DIR)/compute_machine_constants.exe + rm -f $(SCRIPTS_DIR)/compute_machine_constants.obj + rm -f $(EXAMPLES_OBJ) $(EXAMPLES_EXE) + rm -f $(TESTS_SRC) $(TESTS_OBJ) $(TESTS_EXE) + rm -f $(UNURANTEST_OBJ) + rm -f $(RNGSTREAM_SRC) $(RNGSTREAM_H) + rm -f t_*.log unuran.log + rm -f `find . -type f -name "*.manifest"` + + +.PHONY: check clean examples + diff --git a/vendor/unuran-1.11.0/scripts/win32/build.sh b/vendor/unuran-1.11.0/scripts/win32/build.sh new file mode 100755 index 0000000..248a00d --- /dev/null +++ b/vendor/unuran-1.11.0/scripts/win32/build.sh @@ -0,0 +1,179 @@ +#! sh + +# --- Default building flags ------------------------------------------------ + +UNURAN_CONFIGURE_FLAGS="--enable-maintainer-mode --disable-deprecated" + +# --- Synopsis -------------------------------------------------------------- + +function usage () { + echo "usage: build.sh [options] [--configure-options]" + echo "" + echo " options:" + echo " dist ....... create distributio (zip file)" + echo " rstream .... add Pierre L'Ecuyer's RngStreams package" + echo " examples ... run examples" + echo " check ...... run UNU.RAN tests" + echo " help ....... this message" + echo "" + echo " --configure-options:" + echo " see './configure --help'" + exit 1; +} + +# --- Setup environment ----------------------------------------------------- + +# Where to find MS Visual Studio 2005 compilers +export VSCYG='/cygdrive/c/Programme/Microsoft Visual Studio 8' +export VCWIN='C:\Programme\Microsoft Visual Studio 8\VC' + +# Add path to compiler +export PATH=${VSCYG}/VC/bin:${PATH} +export PATH=${VSCYG}/Common7/IDE:${PATH} + +# Add path to MSVC system header files +export INCLUDE="${VCWIN}\include;${INCLUDE}" +export INCLUDE="${VCWIN}\PlatformSDK\Include;${INCLUDE}" + +# Add path to MSVC libraries +export LIB="${VCWIN}\lib;${LIB}" +export LIB="${VCWIN}\PlatformSDK\Lib;${LIB}" + +# C prepsocessor, compiler and linker +export CPP="cl -E" +export CC="cl " +export CXXCPP="cl -E" +export CXX="cl " +export LD="cl " + +# directory for windows files +export WINDIST_DIR="unuran-win32" + +# add path to created DLL (for testing) +export PATH=`pwd`/${WINDIST_DIR}:${PATH} + + +# --- Read command line arguments ------------------------------------------- + +for arg in "$@"; do + case "${arg}" in + help) # Synopsis + usage + ;; + dist) # Create package + doc=true + zip=true + export USE_RNGSTREAM=true + ;; + rstream) # add RngStreams package + export USE_RNGSTREAM=true + ;; + examples) # Compile, link and run all examples + examples=true + ;; + check) # Compile, link and run all tests + check=true + export USE_PRIVATE=true + ;; + clean) # Remove all files created by this script + clean=true + ;; + --*) # ./configure option + UNURAN_CONFIGURE_FLAGS="${UNURAN_CONFIGURE_FLAGS} ${arg}" + ;; + *) + echo "Invalid argment '${arg}'" + usage + ;; + esac +done + + +# --- Check working directory ----------------------------------------------- + +# test whether the script is started from top source directory +if [[ ! -f ./configure.ac || -z `grep unuran ./configure.ac` ]]; then + echo "You must run this script from UNU.RAN top source directory"; + exit 1; +fi + +# test whether script start in cygwin environment +if [[ -z `uname | grep -i cygwin` ]]; then + echo "This scripts requires CYGWIN"; + exit 1; +fi + +# test whether config.h was created using the MSVC compiler +if [[ -f ./config.h && -f ./Makefile && -z `grep "CC = cl" ./Makefile` ]]; then + echo "config.h created with wrong CC; deleting ..." + make maintainer-clean +fi + +# --- Clear working directory ----------------------------------------------- + +if [[ "${clean}" ]]; then + make -f scripts/win32/Makefile.win32 clean; + echo "working space cleared"; + exit 0; +fi + +# --- Prepare UNU.RAN ------------------------------------------------------- + +# create 'config.h' and Makefiles using autotools +if [[ !( -f ./configure ) ]]; then + autoreconf -i + ./configure ${UNURAN_CONFIGURE_FLAGS} +fi + +if [[ !( -f ./config.h && -f ./Makefile) ]]; then + ./configure ${UNURAN_CONFIGURE_FLAGS} +fi + +# create directory for windows files +test -d "${WINDIST_DIR}" && rm -rf "${WINDIST_DIR}" +mkdir "${WINDIST_DIR}" + +# create all required UNU.RAN header files +(cd src/parser; make stringparser_lists.ch) +(cd src; make unuran.h; cp -v unuran.h ../${WINDIST_DIR}) +(cd src/uniform; make unuran_urng_rngstreams.h) + +# Do we use Rngstreams library? +if [[ -n "${USE_RNGSTREAM}" ]]; then + cp -v ../rngstreams/src/RngStream.[ch] ./src/uniform + cp -v ../rngstreams/src/RngStream.h ${WINDIST_DIR} + cp -v ./src/uniform/unuran_urng_rngstreams.h ${WINDIST_DIR} + cp -v ./scripts/win32/example*.c ${WINDIST_DIR} +else + rm -vf cp ./src/uniform/RngStream.* +fi + +# create doc +if [[ "${doc}" ]]; then + (cd doc; make pdf; cp -v *.pdf ../${WINDIST_DIR}); +fi + +# --- Create DLL ------------------------------------------------------------ + +make -f scripts/win32/Makefile.win32 + +# --- Compile, link and run all examples and test files + +if [[ "${examples}" ]]; then + make -f scripts/win32/Makefile.win32 examples; +fi + +if [[ ${check} ]]; then + make -f scripts/win32/Makefile.win32 check; +fi + +# --- Create ZIP file ------------------------------------------------------- + +if [[ ${zip} ]]; then + make -f scripts/win32/Makefile.win32 zip; +fi + +# --- Done ------------------------------------------------------------------ + +exit 0 + diff --git a/vendor/unuran-1.11.0/scripts/win32/example1.c b/vendor/unuran-1.11.0/scripts/win32/example1.c new file mode 100644 index 0000000..5e8b30f --- /dev/null +++ b/vendor/unuran-1.11.0/scripts/win32/example1.c @@ -0,0 +1,90 @@ +/* ------------------------------------------------------------- */ +/* File: example1.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header files. */ +#include +#include + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double x; int k; /* will hold the random number */ + + /* Declare UNU.RAN objects. */ + UNUR_GEN *gen1, *gen2, *gen3; /* generator objects */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng2; /* uniform RN generator object */ + + /* -- Optional: Set seed for RNGSTREAMS library -------------- */ + + /* The RNGSTREAMS library sets a package seed. */ + unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; + RngStream_SetPackageSeed(seed); + + /* -- Example 1 ---------------------------------------------- */ + /* Beta distribution with shape parameters 2 and 3. */ + /* Use method 'AUTO' (AUTOmatic). */ + + /* Create generator object. */ + gen1 = unur_str2gen("beta(2,3)"); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen1' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen1 == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* Now you can use the generator object `gen1' to sample from */ + /* the target distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen1); + printf("%f\n",x); + } + + /* -- Example 2 ---------------------------------------------- */ + /* Student's t distribution with 3 degrees of freedom. */ + /* Use method 'TDR' (Transformed Density Rejection) with */ + /* "immediate acception" */ + gen2 = unur_str2gen("student(3) & method=TDR; variant_ia"); + if (gen2 == NULL) exit (EXIT_FAILURE); + + /* However, this time we use a (new) independent stream of */ + /* uniformrandom numbers. */ + urng2 = unur_urng_rngstream_new("urng2"); + unur_chg_urng( gen2, urng2 ); + + /* Draw a sample. */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen2); printf("%f\n",x); + } + + /* -- Example 3 ---------------------------------------------- */ + /* Discrete distribution with given probability vector. */ + /* Use method 'DGT' (Discrete Guide Table method). */ + gen3 = unur_str2gen("discr; pv=(0.5,1.5,1.0,0.3) & method=DGT"); + if (gen3 == NULL) exit (EXIT_FAILURE); + + /* we use the default URNG again. So there is nothing to do. */ + + /* Draw a sample. Notice that we get integers! */ + for (i=0; i<10; i++) { + k = unur_sample_discr(gen3); printf("%d\n",k); + } + + /* -- Call destructor ---------------------------------------- */ + /* When generators are not needed any they can be destroyed. */ + + unur_free(gen1); + unur_free(gen2); unur_urng_free(urng2); + unur_free(gen3); + + exit (EXIT_SUCCESS); +} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/scripts/win32/example2.c b/vendor/unuran-1.11.0/scripts/win32/example2.c new file mode 100644 index 0000000..a847506 --- /dev/null +++ b/vendor/unuran-1.11.0/scripts/win32/example2.c @@ -0,0 +1,137 @@ +/* ------------------------------------------------------------- */ +/* File: example2.c */ +/* ------------------------------------------------------------- */ + +/* Include UNURAN header files. */ +#include +#include + +/* ------------------------------------------------------------- */ + +int main(void) +{ + int i; /* loop variable */ + double x; int k; /* will hold the random number */ + + /* Declare UNU.RAN objects. */ + UNUR_DISTR *distr; /* distribution object */ + UNUR_PAR *par; /* parameter object */ + UNUR_GEN *gen1, *gen2, *gen3; /* generator objects */ + + /* Declare objects for uniform random number generators. */ + UNUR_URNG *urng2; /* uniform RN generator object */ + + /* -- Optional: Set seed for RNGSTREAMS library -------------- */ + + /* The RNGSTREAMS library sets a package seed. */ + unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; + RngStream_SetPackageSeed(seed); + + /* -- Example 1 ---------------------------------------------- */ + /* Beta distribution with shape parameters 2 and 3. */ + /* Use method 'AUTO' (AUTOmatic). */ + + /* Create distribution object. */ + { + double fparams[] = {2., 3.}; + distr = unur_distr_beta( fparams, 2 ); + } + + /* Choose a method: 'AUTO'. */ + par = unur_auto_new(distr); + + /* Create the generator object. */ + gen1 = unur_init(par); + + /* It is important to check if the creation of the generator */ + /* object was successful. Otherwise `gen1' is the NULL pointer */ + /* and would cause a segmentation fault if used for sampling. */ + if (gen1 == NULL) { + fprintf(stderr, "ERROR: cannot create generator object\n"); + exit (EXIT_FAILURE); + } + + /* It is possible to reuse the distribution object to create */ + /* another generator object. If you do not need it any more, */ + /* it should be destroyed to free memory. */ + unur_distr_free(distr); + + /* Now you can use the generator object `gen1' to sample from */ + /* the target distribution. Eg.: */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen1); + printf("%f\n",x); + } + + /* -- Example 2 ---------------------------------------------- */ + /* Student's t distribution with 3 degrees of freedom. */ + /* Use method 'TDR' (Transformed Density Rejection) with */ + /* "immediate acception" */ + + /* Create distribution object. */ + { + double fparams[] = {3.}; + distr = unur_distr_student( fparams, 1 ); + } + + /* Choose a method: 'TDR'. */ + par = unur_tdr_new(distr); + /* ... and change to immediate acceptance. */ + unur_tdr_set_variant_ia(par); + + /* However, this time we use a (new) independent stream of */ + /* uniformrandom numbers. */ + urng2 = unur_urng_rngstream_new("urng2"); + unur_set_urng( par, urng2 ); + + /* Create the generator object. */ + gen2 = unur_init(par); + if (gen2 == NULL) exit (EXIT_FAILURE); + + /* Destroy distribution object. (We do not need it any more.) */ + unur_distr_free(distr); + + /* Draw a sample. */ + for (i=0; i<10; i++) { + x = unur_sample_cont(gen2); printf("%f\n",x); + } + + /* -- Example 3 ---------------------------------------------- */ + /* Discrete distribution with given probability vector. */ + /* Use method 'DGT' (Discrete Guide Table method). */ + + /* Create distribution object. */ + { + double probs[] = {0.5, 1.5, 1.0, 0.3}; + distr = unur_distr_discr_new(); + unur_distr_discr_set_pv(distr, probs, 4); + } + + /* Choose a method: 'DGT'. */ + par = unur_dgt_new(distr); + + /* we use the default URNG again. So there is nothing to do. */ + + /* Create the generator object. */ + gen3 = unur_init(par); + if (gen3 == NULL) exit (EXIT_FAILURE); + + /* Destroy distribution object. (We do not need it any more.) */ + unur_distr_free(distr); + + /* Draw a sample. Notice that we get integers! */ + for (i=0; i<10; i++) { + k = unur_sample_discr(gen3); printf("%d\n",k); + } + + /* -- Call destructor ---------------------------------------- */ + /* When generators are not needed any they can be destroyed. */ + + unur_free(gen1); + unur_free(gen2); unur_urng_free(urng2); + unur_free(gen3); + + exit (EXIT_SUCCESS); +} /* end of main() */ + +/* ------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/scripts/win32/make_dll_def.pl b/vendor/unuran-1.11.0/scripts/win32/make_dll_def.pl new file mode 100755 index 0000000..09a9cfe --- /dev/null +++ b/vendor/unuran-1.11.0/scripts/win32/make_dll_def.pl @@ -0,0 +1,250 @@ +#!/usr/bin/perl +############################################################################## +# # +# UNURAN -- Universal Non-Uniform Random number generator # +# # +############################################################################## +# # +# FILE: makedll_def.pl # +# # +# Read all UNU.RAN header files and create .def file for .dll # +# # +############################################################################## +# # +# Copyright (c) 2000-2007 Wolfgang Hoermann and Josef Leydold # +# Department of Statistics and Mathematics, WU Wien, Austria # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the # +# Free Software Foundation, Inc., # +# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA # +# # +############################################################################## + +use strict; +use Getopt::Std; + +my $DEBUG = 0; + +############################################################ +# constants + +my $DEP_file = ".dep-unuran_def"; + +############################################################ + +sub usage { + my $progname = $0; + $progname =~ s#^.*/##g; + + print STDERR <] [-L ] [-I] [ ... ] + +Scans and inserts all header files found in subtree +rooted at current working directory. +Other header files and those with names containing "config" +are ignored. +The function declaration and global variables are extracted +and .def file is created. + +Option '-V' can be used to set a library version number using +the format 'major.minor'. + +Option '-L' can be used to set a library name. + +Use option '-I' when also (some) internal functions should be exported. + +The output is written on stdout. + +EOM + + exit -1; +} + +############################################################ + +# dependencies +my $DEP = "unuran.def: "; + +############################################################ + +use FileHandle; + +############################################################ +# global variables + +# default name of library +my $Library = "unuran"; + +# DATA section (to be set manually!!) +my $DATA = ""; +# "\tunur_errno\tDATA\n"; +# "\tINFINITY\tDATA\n"; + +# EXPORTS section (functions; set automatically) +my $EXPORTS; +my @EXPORTS; + +############################################################ + +# read options +my %opts; +getopts('V:L:I', \%opts) or usage(); +my $Version = $opts{'V'}; +$Library = $opts{'L'} if $opts{'L'}; +my $INTERNAL = $opts{'I'}; + +# read master file name from argument list ... +my @master_files; +while ($_ = shift) { push @master_files, $_; } +(usage and die) unless @master_files; + +# header files in sub tree (except those containing "config") ... +# (files are stored in an associate array with key=filename and +# value=complete path of file.) +my %header_files; +# included header files ... +my %header_included; + +# search subtree for header files ... +open (FILES, "find . |"); +while () { + chomp; + next unless /^.*\/+(.*\.h)$/; + next if /config/; + $header_files{$1} = $_; # store file and path of file +} +close FILES; + +# scan master file(s) ... +foreach my $m (@master_files) { scan_file ($m); } + +# write file +print "LIBRARY $Library\n"; +print "VERSION $Version\n" if $Version; +print "EXPORTS\n"; +print $DATA; +foreach my $e (sort @EXPORTS) { $EXPORTS .= "\t$e\n"; } +print $EXPORTS; + +# write dependencies +#open DEP, ">$DEP_file" or die "Cannot open file for writing: $DEP_file"; +#print DEP "$DEP\n"; +#close DEP; + +exit 0; + +############################################################ + +# scan given file ... +sub scan_file { + my $file = $_[0]; + my $handle = new FileHandle; + + ## print STDERR "$file\n" if $DEBUG; + + # open file ... + open $handle, $file or die "cannot find file $file\n"; + + # read file ... + my $content = ''; + while (<$handle>) { + $content .= $_; + } + close $handle; + + # remove all comments and empty lines ... + $content =~ s {/\*.*?\*/} []gsx; + $content =~ s /\n\s*\n/\n/gsx; + + # split into lines ... + my @lines = split /\n/, $content; + + my $line; + foreach my $l (@lines) { + chomp($l); + if ($line =~ /^.*\\\s*$/) { + $line =~ s/\\\s*$//; + $line .= $l; + next; + } + $line = $l; + unless ($line =~ /^\#include\s+[<\"](.*)[>\"]/) { + # remove all blank lines + next if $line !~ /\w/; + # remove all (other) preprocessor directives + next if $line =~ /^\s*\#/; + # find all non-functions + next if $line !~ /\(.+/; + next if $line =~ /^\s*typedef\s+/; + # internal functions + unless ($INTERNAL) { + next if $line =~ /[\s\*]_unur/; + } + else { + # remove internal debugging routines + next if $line =~ /[\s\*]_unur_error_cookies/; + next if $line =~ /[\s\*]_unur_distr_\w+_debug/; + } + # line with isolated attribute statement + next if $line =~ /^\s*ATTRIBUTE__/; + # remove special symbols + next if $line =~ /_unur_is(zero|one|fsame)/; + # exported functions + $line =~ /.*?[\s\*]+(\w+)\s*\(/; + push @EXPORTS, $1; + next; + } + + # have found a file to be included ... + my @tmp = split /\//, $1; + my $include_file = pop @tmp; + print STDERR "$include_file " if $DEBUG; + + # we do not include header files out of the subtree ... + unless (defined( $header_files{$include_file} ) ) { + print STDERR "file not found in subtree ... skip\n" if $DEBUG; + next; + } + + # we do not include header files for deprecated calls + if ( $include_file =~ /deprecated/ ) { + print STDERR "deprecated ... skip\n" if $DEBUG; + next; + } + + # we include header files only once ... + if (defined( $header_included{$include_file} ) ) { + print STDERR "already included ... skip\n" if $DEBUG; + next; + } + + $header_included{$include_file} .= 1; + + # have found header file ... + print STDERR "to be inserted\n" if $DEBUG; + + # add dependency + $DEP .= "$header_files{$include_file} "; + + # scan header file ... + scan_file ($header_files{$include_file}); + + } + +} + +############################################################ + +############################################################ + diff --git a/vendor/unuran-1.11.0/src/.libs/libunuran.a b/vendor/unuran-1.11.0/src/.libs/libunuran.a new file mode 100644 index 0000000..904ea45 Binary files /dev/null and b/vendor/unuran-1.11.0/src/.libs/libunuran.a differ diff --git a/vendor/unuran-1.11.0/src/.libs/libunuran.lai b/vendor/unuran-1.11.0/src/.libs/libunuran.lai new file mode 100644 index 0000000..3b14580 --- /dev/null +++ b/vendor/unuran-1.11.0/src/.libs/libunuran.lai @@ -0,0 +1,41 @@ +# libunuran.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.7 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='' + +# Names of this library. +library_names='' + +# The name of the static archive. +old_library='libunuran.a' + +# Linker flags that cannot go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs=' -lm' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libunuran. +current=16 +age=0 +revision=1 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/home/wrdx/5_sem/pysatl-core/vendor/unuran-build/lib' diff --git a/vendor/unuran-1.11.0/src/Makefile b/vendor/unuran-1.11.0/src/Makefile new file mode 100644 index 0000000..71a6618 --- /dev/null +++ b/vendor/unuran-1.11.0/src/Makefile @@ -0,0 +1,823 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# src/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/unuran +pkgincludedir = $(includedir)/unuran +pkglibdir = $(libdir)/unuran +pkglibexecdir = $(libexecdir)/unuran +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +subdir = src +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \ + $(noinst_HEADERS) $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libunuran_la_DEPENDENCIES = $(SUBLIBS) +am_libunuran_la_OBJECTS = +libunuran_la_OBJECTS = $(am_libunuran_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__v_lt_1 = +libunuran_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libunuran_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I. -I$(top_builddir) +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libunuran_la_SOURCES) +DIST_SOURCES = $(libunuran_la_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(include_HEADERS) $(noinst_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in README +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_CFLAGS = -Wall -Wextra -Wshadow -Wstrict-prototypes +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf +AUTOHEADER = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader +AUTOMAKE = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -fPIC +CPP = gcc -E +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +FILECMD = file +GREP = /usr/bin/grep +HAVE_DIVIDE_BY_ZERO = +HAVE_IEEE_COMPARISONS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAINT = # +MAKEINFO = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = unuran +PACKAGE_BUGREPORT = unuran@statmath.wu.ac.at +PACKAGE_NAME = unuran +PACKAGE_STRING = unuran 1.11.0 +PACKAGE_TARNAME = unuran +PACKAGE_URL = +PACKAGE_VERSION = 1.11.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +UNURAN_LT_VERSION = 16:1:0 +UNURAN_SUPPORTS_GSL = +UNURAN_SUPPORTS_PRNG = +UNURAN_SUPPORTS_RNGSTREAM = +VERSION = 1.11.0 +abs_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src +abs_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src +abs_top_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +have_valgrind = false +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../ +top_builddir = .. +top_srcdir = .. +no_undefined = +#no_undefined = -no-undefined +SUBDIRS = \ + utils \ + methods \ + specfunct \ + distr \ + distributions \ + parser \ + tests \ + uniform \ + urng \ + . + +DIST_SUBDIRS = $(SUBDIRS) +SUBLIBS = \ + methods/libmethods.la \ + distr/libdistr.la \ + distributions/libdistributions.la \ + specfunct/libspecfunct.la \ + parser/libparser.la \ + tests/libtests.la \ + uniform/libuniform.la \ + urng/liburng.la \ + utils/libutils.la + +lib_LTLIBRARIES = libunuran.la +libunuran_la_SOURCES = +libunuran_la_LIBADD = $(SUBLIBS) +libunuran_la_LDFLAGS = -version-info $(UNURAN_LT_VERSION) $(no_undefined) +include_HEADERS = unuran.h +noinst_HEADERS = \ + unuran_config.h \ + unuran.h.in \ + unur_cookies.h \ + unur_source.h \ + unur_struct.h \ + unur_typedefs.h + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in \ + .dep-unuran_h \ + unuran.h + +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libunuran.la: $(libunuran_la_OBJECTS) $(libunuran_la_DEPENDENCIES) $(EXTRA_libunuran_la_DEPENDENCIES) + $(AM_V_CCLD)$(libunuran_la_LINK) -rpath $(libdir) $(libunuran_la_OBJECTS) $(libunuran_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-includeHEADERS + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libLTLIBRARIES \ + clean-libtool cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includeHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-includeHEADERS uninstall-libLTLIBRARIES + +.PRECIOUS: Makefile + + +# make unuran.h (process file unuran.h.in) +sinclude .dep-unuran_h +unuran.h: unuran.h.in + $(top_srcdir)/scripts/merge_h.pl $(top_srcdir)/src/unuran.h.in > unuran.h + sed -e "s#^unuran\.h\:#stringparser\.c\:#" .dep-unuran_h | sed -e "s#\./#\.\./#g" > ./parser/.dep-stringparser_c + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/Makefile.am b/vendor/unuran-1.11.0/src/Makefile.am new file mode 100644 index 0000000..1ba9f00 --- /dev/null +++ b/vendor/unuran-1.11.0/src/Makefile.am @@ -0,0 +1,64 @@ +## Process this file with automake to produce Makefile.in + +if HAVE_MINGW +no_undefined = -no-undefined +else +no_undefined = +endif + + +SUBDIRS = \ + utils \ + methods \ + specfunct \ + distr \ + distributions \ + parser \ + tests \ + uniform \ + urng \ + . + +DIST_SUBDIRS = $(SUBDIRS) + +SUBLIBS = \ + methods/libmethods.la \ + distr/libdistr.la \ + distributions/libdistributions.la \ + specfunct/libspecfunct.la \ + parser/libparser.la \ + tests/libtests.la \ + uniform/libuniform.la \ + urng/liburng.la \ + utils/libutils.la + +lib_LTLIBRARIES = libunuran.la +libunuran_la_SOURCES = +libunuran_la_LIBADD = $(SUBLIBS) +libunuran_la_LDFLAGS = -version-info $(UNURAN_LT_VERSION) $(no_undefined) + +include_HEADERS = unuran.h + +noinst_HEADERS = \ + unuran_config.h \ + unuran.h.in \ + unur_cookies.h \ + unur_source.h \ + unur_struct.h \ + unur_typedefs.h + + +# make unuran.h (process file unuran.h.in) +sinclude .dep-unuran_h +unuran.h: unuran.h.in + $(top_srcdir)/scripts/merge_h.pl $(top_srcdir)/src/unuran.h.in > unuran.h + sed -e "s#^unuran\.h\:#stringparser\.c\:#" .dep-unuran_h | sed -e "s#\./#\.\./#g" > ./parser/.dep-stringparser_c + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in \ + .dep-unuran_h \ + unuran.h diff --git a/vendor/unuran-1.11.0/src/Makefile.in b/vendor/unuran-1.11.0/src/Makefile.in new file mode 100644 index 0000000..1e0ed57 --- /dev/null +++ b/vendor/unuran-1.11.0/src/Makefile.in @@ -0,0 +1,823 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \ + $(noinst_HEADERS) $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libunuran_la_DEPENDENCIES = $(SUBLIBS) +am_libunuran_la_OBJECTS = +libunuran_la_OBJECTS = $(am_libunuran_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libunuran_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libunuran_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libunuran_la_SOURCES) +DIST_SOURCES = $(libunuran_la_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(include_HEADERS) $(noinst_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in README +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ +UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ +UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ +UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_valgrind = @have_valgrind@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +@HAVE_MINGW_FALSE@no_undefined = +@HAVE_MINGW_TRUE@no_undefined = -no-undefined +SUBDIRS = \ + utils \ + methods \ + specfunct \ + distr \ + distributions \ + parser \ + tests \ + uniform \ + urng \ + . + +DIST_SUBDIRS = $(SUBDIRS) +SUBLIBS = \ + methods/libmethods.la \ + distr/libdistr.la \ + distributions/libdistributions.la \ + specfunct/libspecfunct.la \ + parser/libparser.la \ + tests/libtests.la \ + uniform/libuniform.la \ + urng/liburng.la \ + utils/libutils.la + +lib_LTLIBRARIES = libunuran.la +libunuran_la_SOURCES = +libunuran_la_LIBADD = $(SUBLIBS) +libunuran_la_LDFLAGS = -version-info $(UNURAN_LT_VERSION) $(no_undefined) +include_HEADERS = unuran.h +noinst_HEADERS = \ + unuran_config.h \ + unuran.h.in \ + unur_cookies.h \ + unur_source.h \ + unur_struct.h \ + unur_typedefs.h + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in \ + .dep-unuran_h \ + unuran.h + +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libunuran.la: $(libunuran_la_OBJECTS) $(libunuran_la_DEPENDENCIES) $(EXTRA_libunuran_la_DEPENDENCIES) + $(AM_V_CCLD)$(libunuran_la_LINK) -rpath $(libdir) $(libunuran_la_OBJECTS) $(libunuran_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-includeHEADERS + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libLTLIBRARIES \ + clean-libtool cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includeHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-includeHEADERS uninstall-libLTLIBRARIES + +.PRECIOUS: Makefile + + +# make unuran.h (process file unuran.h.in) +sinclude .dep-unuran_h +unuran.h: unuran.h.in + $(top_srcdir)/scripts/merge_h.pl $(top_srcdir)/src/unuran.h.in > unuran.h + sed -e "s#^unuran\.h\:#stringparser\.c\:#" .dep-unuran_h | sed -e "s#\./#\.\./#g" > ./parser/.dep-stringparser_c + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/README b/vendor/unuran-1.11.0/src/README new file mode 100644 index 0000000..d205875 --- /dev/null +++ b/vendor/unuran-1.11.0/src/README @@ -0,0 +1,93 @@ +Naming conventions: + +*.c ... C source files +*.ch ... C source files #include'd in a *.c file +*.h ... header file +*_source.h ... header file only used for compiling library +*_struct.h ... header file for structure defintions (only used for compiling library) + +unur_*.h ... header files that are protected against multiple inclusion +unuran*.h ... header files to be installed + +-------------------------------------------------- +./: + +README ... this file +unuran.h ... main header file for UNU.RAN +unuran.h.in ... same as unuran.h but #include's are not expanded +unuran_config.h ... configuration file for library +unur_source.h ... main header file for compiling library (included in all sources!) +unur_cookies.h ... definition of magic cookies +unur_typedefs.h ... declaration of all objects used by UNU.RAN + +methods/ ... sources of methods +distr/ ... sources for generic distributions +distributions/ ... sources for standard distributions and special generators +utils/ ... sources for utilities +tests/ ... sources for various tests +uniform/ ... sources for simple uniform RNGs and wrapper for external RNGs +urng/ ... sources for interface to uniform RNGs + +-------------------------------------------------- +./utils/: + +debug.c ... debuging routines +debug.h +debug_source.h + +error.c ... warnings and error messages +error.h +error_source.h +unur_errno.h + +stream.c ... output streams +stream.h +stream_source.h + +slist.c ... handle simple lists +slist.h +slist_struct.h + +umalloc.c ... allocate memory +umalloc_source.h + +umath.c ... mathematics +umath.h +umath_source.h +unur_math_source.h + +unur_fp_source.h floating point arithmetic +unur_fp_const_source.h + + +-------------------------------------------------- +./methods/: + +unur_methods_source.h ... id's for methods + +x_gen.c ... handle generator objects + +-------------------------------------------------- +./distr/: + +-------------------------------------------------- +./distributions/: + +unur_distributions.h ... header file for standard distribution +unur_stddistr.h ... id's for standard distributions + +-------------------------------------------------- +./tests/: + +unuran_tests.h ... header file for test routines + +chi2test.c ... chi^2 test for goodness of fit +counturn.c ... count used uniform random numbers +printsample.c ... print a small sample into logfile +timing.c ... measure setup time and marginal generation time + +tests.c ... interface to start these tests + +-------------------------------------------------- +./uniform/: + diff --git a/vendor/unuran-1.11.0/src/distr/.libs/libdistr.a b/vendor/unuran-1.11.0/src/distr/.libs/libdistr.a new file mode 100644 index 0000000..da64567 Binary files /dev/null and b/vendor/unuran-1.11.0/src/distr/.libs/libdistr.a differ diff --git a/vendor/unuran-1.11.0/src/distr/Makefile b/vendor/unuran-1.11.0/src/distr/Makefile new file mode 100644 index 0000000..284ca23 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/Makefile @@ -0,0 +1,682 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# src/distr/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/unuran +pkgincludedir = $(includedir)/unuran +pkglibdir = $(libdir)/unuran +pkglibexecdir = $(libexecdir)/unuran +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +subdir = src/distr +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libdistr_la_LIBADD = +am__libdistr_la_SOURCES_DIST = deprecated_distr.c deprecated_distr.h \ + distr.c distr.h distr_info.c distr_struct.h distr_source.h \ + cont.c cont.h corder.c corder.h cxtrans.c cxtrans.h cemp.c \ + cemp.h cvec.c cvec.h condi.c condi.h cvemp.c cvemp.h discr.c \ + discr.h matr.c matr.h +#am__objects_1 = deprecated_distr.lo +am_libdistr_la_OBJECTS = $(am__objects_1) distr.lo distr_info.lo \ + cont.lo corder.lo cxtrans.lo cemp.lo cvec.lo condi.lo cvemp.lo \ + discr.lo matr.lo +libdistr_la_OBJECTS = $(am_libdistr_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I. -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/cemp.Plo ./$(DEPDIR)/condi.Plo \ + ./$(DEPDIR)/cont.Plo ./$(DEPDIR)/corder.Plo \ + ./$(DEPDIR)/cvec.Plo ./$(DEPDIR)/cvemp.Plo \ + ./$(DEPDIR)/cxtrans.Plo ./$(DEPDIR)/deprecated_distr.Plo \ + ./$(DEPDIR)/discr.Plo ./$(DEPDIR)/distr.Plo \ + ./$(DEPDIR)/distr_info.Plo ./$(DEPDIR)/matr.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libdistr_la_SOURCES) +DIST_SOURCES = $(am__libdistr_la_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_CFLAGS = -Wall -Wextra -Wshadow -Wstrict-prototypes +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf +AUTOHEADER = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader +AUTOMAKE = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -fPIC +CPP = gcc -E +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +FILECMD = file +GREP = /usr/bin/grep +HAVE_DIVIDE_BY_ZERO = +HAVE_IEEE_COMPARISONS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAINT = # +MAKEINFO = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = unuran +PACKAGE_BUGREPORT = unuran@statmath.wu.ac.at +PACKAGE_NAME = unuran +PACKAGE_STRING = unuran 1.11.0 +PACKAGE_TARNAME = unuran +PACKAGE_URL = +PACKAGE_VERSION = 1.11.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +UNURAN_LT_VERSION = 16:1:0 +UNURAN_SUPPORTS_GSL = +UNURAN_SUPPORTS_PRNG = +UNURAN_SUPPORTS_RNGSTREAM = +VERSION = 1.11.0 +abs_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src/distr +abs_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src/distr +abs_top_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +have_valgrind = false +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../../ +top_builddir = ../.. +top_srcdir = ../.. +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libdistr.la +DEPRECATED_FILES = + +# Files that contain deprecated routines +#DEPRECATED_FILES = deprecated_distr.c deprecated_distr.h +libdistr_la_SOURCES = \ + $(DEPRECATED_FILES) \ +\ + distr.c distr.h distr_info.c distr_struct.h distr_source.h \ + cont.c cont.h \ + corder.c corder.h \ + cxtrans.c cxtrans.h \ + cemp.c cemp.h \ + cvec.c cvec.h \ + condi.c condi.h \ + cvemp.c cvemp.h\ + discr.c discr.h \ + matr.c matr.h + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/distr/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/distr/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libdistr.la: $(libdistr_la_OBJECTS) $(libdistr_la_DEPENDENCIES) $(EXTRA_libdistr_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libdistr_la_OBJECTS) $(libdistr_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/cemp.Plo # am--include-marker +include ./$(DEPDIR)/condi.Plo # am--include-marker +include ./$(DEPDIR)/cont.Plo # am--include-marker +include ./$(DEPDIR)/corder.Plo # am--include-marker +include ./$(DEPDIR)/cvec.Plo # am--include-marker +include ./$(DEPDIR)/cvemp.Plo # am--include-marker +include ./$(DEPDIR)/cxtrans.Plo # am--include-marker +include ./$(DEPDIR)/deprecated_distr.Plo # am--include-marker +include ./$(DEPDIR)/discr.Plo # am--include-marker +include ./$(DEPDIR)/distr.Plo # am--include-marker +include ./$(DEPDIR)/distr_info.Plo # am--include-marker +include ./$(DEPDIR)/matr.Plo # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ $< + +.c.obj: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: + $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +# $(AM_V_CC)source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/cemp.Plo + -rm -f ./$(DEPDIR)/condi.Plo + -rm -f ./$(DEPDIR)/cont.Plo + -rm -f ./$(DEPDIR)/corder.Plo + -rm -f ./$(DEPDIR)/cvec.Plo + -rm -f ./$(DEPDIR)/cvemp.Plo + -rm -f ./$(DEPDIR)/cxtrans.Plo + -rm -f ./$(DEPDIR)/deprecated_distr.Plo + -rm -f ./$(DEPDIR)/discr.Plo + -rm -f ./$(DEPDIR)/distr.Plo + -rm -f ./$(DEPDIR)/distr_info.Plo + -rm -f ./$(DEPDIR)/matr.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/cemp.Plo + -rm -f ./$(DEPDIR)/condi.Plo + -rm -f ./$(DEPDIR)/cont.Plo + -rm -f ./$(DEPDIR)/corder.Plo + -rm -f ./$(DEPDIR)/cvec.Plo + -rm -f ./$(DEPDIR)/cvemp.Plo + -rm -f ./$(DEPDIR)/cxtrans.Plo + -rm -f ./$(DEPDIR)/deprecated_distr.Plo + -rm -f ./$(DEPDIR)/discr.Plo + -rm -f ./$(DEPDIR)/distr.Plo + -rm -f ./$(DEPDIR)/distr_info.Plo + -rm -f ./$(DEPDIR)/matr.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/distr/Makefile.am b/vendor/unuran-1.11.0/src/distr/Makefile.am new file mode 100644 index 0000000..64e86ea --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/Makefile.am @@ -0,0 +1,35 @@ +## Process this file with automake to produce Makefile.in + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libdistr.la + +# Files that contain deprecated routines +if ENABLE_DEPRECATED +DEPRECATED_FILES = deprecated_distr.c deprecated_distr.h +else +DEPRECATED_FILES = +endif + +libdistr_la_SOURCES = \ + $(DEPRECATED_FILES) \ +\ + distr.c distr.h distr_info.c distr_struct.h distr_source.h \ + cont.c cont.h \ + corder.c corder.h \ + cxtrans.c cxtrans.h \ + cemp.c cemp.h \ + cvec.c cvec.h \ + condi.c condi.h \ + cvemp.c cvemp.h\ + discr.c discr.h \ + matr.c matr.h + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + diff --git a/vendor/unuran-1.11.0/src/distr/Makefile.in b/vendor/unuran-1.11.0/src/distr/Makefile.in new file mode 100644 index 0000000..c6971bb --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/Makefile.in @@ -0,0 +1,682 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/distr +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libdistr_la_LIBADD = +am__libdistr_la_SOURCES_DIST = deprecated_distr.c deprecated_distr.h \ + distr.c distr.h distr_info.c distr_struct.h distr_source.h \ + cont.c cont.h corder.c corder.h cxtrans.c cxtrans.h cemp.c \ + cemp.h cvec.c cvec.h condi.c condi.h cvemp.c cvemp.h discr.c \ + discr.h matr.c matr.h +@ENABLE_DEPRECATED_TRUE@am__objects_1 = deprecated_distr.lo +am_libdistr_la_OBJECTS = $(am__objects_1) distr.lo distr_info.lo \ + cont.lo corder.lo cxtrans.lo cemp.lo cvec.lo condi.lo cvemp.lo \ + discr.lo matr.lo +libdistr_la_OBJECTS = $(am_libdistr_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/cemp.Plo ./$(DEPDIR)/condi.Plo \ + ./$(DEPDIR)/cont.Plo ./$(DEPDIR)/corder.Plo \ + ./$(DEPDIR)/cvec.Plo ./$(DEPDIR)/cvemp.Plo \ + ./$(DEPDIR)/cxtrans.Plo ./$(DEPDIR)/deprecated_distr.Plo \ + ./$(DEPDIR)/discr.Plo ./$(DEPDIR)/distr.Plo \ + ./$(DEPDIR)/distr_info.Plo ./$(DEPDIR)/matr.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libdistr_la_SOURCES) +DIST_SOURCES = $(am__libdistr_la_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ +UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ +UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ +UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_valgrind = @have_valgrind@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libdistr.la +@ENABLE_DEPRECATED_FALSE@DEPRECATED_FILES = + +# Files that contain deprecated routines +@ENABLE_DEPRECATED_TRUE@DEPRECATED_FILES = deprecated_distr.c deprecated_distr.h +libdistr_la_SOURCES = \ + $(DEPRECATED_FILES) \ +\ + distr.c distr.h distr_info.c distr_struct.h distr_source.h \ + cont.c cont.h \ + corder.c corder.h \ + cxtrans.c cxtrans.h \ + cemp.c cemp.h \ + cvec.c cvec.h \ + condi.c condi.h \ + cvemp.c cvemp.h\ + discr.c discr.h \ + matr.c matr.h + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/distr/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/distr/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libdistr.la: $(libdistr_la_OBJECTS) $(libdistr_la_DEPENDENCIES) $(EXTRA_libdistr_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libdistr_la_OBJECTS) $(libdistr_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cemp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/condi.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cont.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/corder.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cvec.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cvemp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxtrans.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deprecated_distr.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/discr.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/distr.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/distr_info.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matr.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/cemp.Plo + -rm -f ./$(DEPDIR)/condi.Plo + -rm -f ./$(DEPDIR)/cont.Plo + -rm -f ./$(DEPDIR)/corder.Plo + -rm -f ./$(DEPDIR)/cvec.Plo + -rm -f ./$(DEPDIR)/cvemp.Plo + -rm -f ./$(DEPDIR)/cxtrans.Plo + -rm -f ./$(DEPDIR)/deprecated_distr.Plo + -rm -f ./$(DEPDIR)/discr.Plo + -rm -f ./$(DEPDIR)/distr.Plo + -rm -f ./$(DEPDIR)/distr_info.Plo + -rm -f ./$(DEPDIR)/matr.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/cemp.Plo + -rm -f ./$(DEPDIR)/condi.Plo + -rm -f ./$(DEPDIR)/cont.Plo + -rm -f ./$(DEPDIR)/corder.Plo + -rm -f ./$(DEPDIR)/cvec.Plo + -rm -f ./$(DEPDIR)/cvemp.Plo + -rm -f ./$(DEPDIR)/cxtrans.Plo + -rm -f ./$(DEPDIR)/deprecated_distr.Plo + -rm -f ./$(DEPDIR)/discr.Plo + -rm -f ./$(DEPDIR)/distr.Plo + -rm -f ./$(DEPDIR)/distr_info.Plo + -rm -f ./$(DEPDIR)/matr.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/distr/cemp.c b/vendor/unuran-1.11.0/src/distr/cemp.c new file mode 100644 index 0000000..c503013 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/cemp.c @@ -0,0 +1,568 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: cemp.c * + * * + * manipulate empirical univariate continuous distribution objects * + * (i.e. samples) * + * * + * return: * + * UNUR_SUCCESS ... on success * + * error code ... on error * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include "distr_source.h" +#include "distr.h" +#include "cemp.h" + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cemp + +/*---------------------------------------------------------------------------*/ + +static void _unur_distr_cemp_free( struct unur_distr *distr ); + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** empirical univariate continuous distributions **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_cemp_new( void ) + /*----------------------------------------------------------------------*/ + /* create a new (empty) distribution object */ + /* type: empirical univariate continuous */ + /* */ + /* parameters: */ + /* none */ + /* */ + /* return: */ + /* pointer to distribution object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + register struct unur_distr *distr; + + /* get empty distribution object */ + distr = _unur_distr_generic_new(); + if (!distr) return NULL; + + /* set magic cookie */ + COOKIE_SET(distr,CK_DISTR_CEMP); + + /* set type of distribution */ + distr->type = UNUR_DISTR_CEMP; + + /* set id to generic distribution */ + distr->id = UNUR_DISTR_GENERIC; + + /* dimension of random vector */ + distr->dim = 1; /* univariant */ + + /* name for distribution */ + distr->name = "(empirical)"; + distr->name_str = NULL; + + /* destructor */ + distr->destroy = _unur_distr_cemp_free; + + /* clone */ + distr->clone = _unur_distr_cemp_clone; + + /* set defaults */ + + /* observed sample */ + DISTR.sample = NULL; /* sample */ + DISTR.n_sample = 0; /* sample size */ + + /* histogram */ + DISTR.n_hist = 0; /* number of bins */ + DISTR.hist_prob = NULL; /* probabilities for bins */ + DISTR.hist_bins = NULL; /* location of bins */ + DISTR.hmin = -UNUR_INFINITY; /* lower ... */ + DISTR.hmax = UNUR_INFINITY; /* ... and upper bound */ + DISTR.hist_bins = NULL; /* boundary between bins */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_cemp_new() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +_unur_distr_cemp_clone( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* copy (clone) distribution object */ + /* */ + /* parameters: */ + /* distr ... pointer to source distribution object */ + /* */ + /* return: */ + /* pointer to clone of distribution object */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE clone->data.cemp + + struct unur_distr *clone; + + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CEMP, NULL ); + + /* allocate memory */ + clone = _unur_xmalloc( sizeof(struct unur_distr) ); + + /* copy distribution object into clone */ + memcpy( clone, distr, sizeof( struct unur_distr ) ); + + /* copy data about sample into generator object (when there is one) */ + if (DISTR.sample) { + CLONE.sample = _unur_xmalloc( DISTR.n_sample * sizeof(double) ); + memcpy( CLONE.sample, DISTR.sample, DISTR.n_sample * sizeof(double) ); + } + + /* copy histogram into generator object (when there is one) */ + if (DISTR.hist_prob) { + CLONE.hist_prob = _unur_xmalloc( DISTR.n_hist * sizeof(double) ); + memcpy( CLONE.hist_prob, DISTR.hist_prob, DISTR.n_hist * sizeof(double) ); + } + if (DISTR.hist_bins) { + CLONE.hist_bins = _unur_xmalloc( (DISTR.n_hist+1) * sizeof(double) ); + memcpy( CLONE.hist_bins, DISTR.hist_bins, (DISTR.n_hist+1) * sizeof(double) ); + } + + /* copy user name for distribution */ + if (distr->name_str) { + size_t len = strlen(distr->name_str) + 1; + clone->name_str = _unur_xmalloc(len); + memcpy( clone->name_str, distr->name_str, len ); + clone->name = clone->name_str; + } + + return clone; + +#undef CLONE +} /* end of _unur_distr_cemp_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_distr_cemp_free( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* free distribution object */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( distr == NULL ) /* nothing to do */ + return; + + COOKIE_CHECK(distr,CK_DISTR_CEMP,RETURN_VOID); + + if (DISTR.sample) free( DISTR.sample ); + if (DISTR.hist_prob) free( DISTR.hist_prob ); + if (DISTR.hist_bins) free( DISTR.hist_bins ); + if (distr->name_str) free(distr->name_str); + + COOKIE_CLEAR(distr); + free( distr ); + +} /* end of unur_distr_cemp_free() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cemp_set_data( struct unur_distr *distr, const double *sample, int n_sample ) + /*----------------------------------------------------------------------*/ + /* set observed sample for distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* sample ... pointer to array of observations */ + /* n_sample ... number of observations (sample size) */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CEMP, UNUR_ERR_DISTR_INVALID ); + _unur_check_NULL( distr->name, sample, UNUR_ERR_NULL ); + + /* check new parameter for generator */ + if (n_sample <= 0) { + _unur_error(NULL,UNUR_ERR_DISTR_SET,"sample size"); + return UNUR_ERR_DISTR_SET; + } + + /* allocate memory for sample */ + DISTR.sample = _unur_xmalloc( n_sample * sizeof(double) ); + if (!DISTR.sample) return UNUR_ERR_MALLOC; + + /* copy observed sample */ + memcpy( DISTR.sample, sample, n_sample * sizeof(double) ); + DISTR.n_sample = n_sample; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_distr_cemp_set_data() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cemp_read_data( struct unur_distr *distr, const char *filename ) + /*----------------------------------------------------------------------*/ + /* Read data from file `filename'. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* filename ... name of data file */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CEMP, UNUR_ERR_DISTR_INVALID ); + + /* read data from file */ + DISTR.n_sample = _unur_read_data( filename, 1, &(DISTR.sample) ); + + /* o.k. ? */ + return (DISTR.n_sample > 0) ? UNUR_SUCCESS : UNUR_ERR_DISTR_DATA; + +} /* end of unur_distr_cemp_read_data() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cemp_get_data( const struct unur_distr *distr, const double **sample ) + /*----------------------------------------------------------------------*/ + /* get number of observations and set pointer to array observations */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* sample ... pointer to observed sampletor */ + /* */ + /* return: */ + /* sample size */ + /* */ + /* error: */ + /* return 0 */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, 0 ); + _unur_check_distr_object( distr, CEMP, 0 ); + + *sample = (DISTR.sample) ? DISTR.sample : NULL; + return DISTR.n_sample; + +} /* end of unur_distr_cemp_get_data() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cemp_set_hist( struct unur_distr *distr, const double *prob, + int n_prob, double xmin, double xmax ) + /*----------------------------------------------------------------------*/ + /* set histogram with bins of equal width for distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* prob ... pointer to array of distributions */ + /* n_prob ... number of bins */ + /* xmin ... lower bound of histogram */ + /* xmax ... upper bound of histogram */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int rcode; + + if ((rcode = unur_distr_cemp_set_hist_domain(distr, xmin, xmax)) != UNUR_SUCCESS) + return rcode; + + if ((rcode = unur_distr_cemp_set_hist_prob(distr, prob, n_prob)) != UNUR_SUCCESS) { + distr->set &= ~UNUR_DISTR_SET_DOMAIN; + return rcode; + } + + /* Remark: order of set calls is important (otherwise it might be possible */ + /* that the function is only computed partially. */ + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_cemp_set_hist() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cemp_set_hist_prob( struct unur_distr *distr, const double *prob, int n_prob ) + /*----------------------------------------------------------------------*/ + /* set probabilities of bins of histogram */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* prob ... pointer to array of distributions */ + /* n_prob ... number of bins */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CEMP, UNUR_ERR_DISTR_INVALID ); + _unur_check_NULL( distr->name, prob, UNUR_ERR_NULL ); + + /* check new parameter for generator */ + if (n_prob <= 0) { + _unur_error(NULL,UNUR_ERR_DISTR_SET,"histogram size"); + return UNUR_ERR_DISTR_SET; + } + + /* allocate memory for hist */ + DISTR.hist_prob = _unur_xmalloc( n_prob * sizeof(double) ); + if (!DISTR.hist_prob) return UNUR_ERR_MALLOC; + + /* copy probabilities */ + memcpy( DISTR.hist_prob, prob, n_prob * sizeof(double) ); + DISTR.n_hist = n_prob; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_distr_cemp_set_hist_prob() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cemp_set_hist_domain( struct unur_distr *distr, double xmin, double xmax ) + /*----------------------------------------------------------------------*/ + /* set domain of histogram with bins of equal width */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* xmin ... lower bound of histogram */ + /* xmax ... upper bound of histogram */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CEMP, UNUR_ERR_DISTR_INVALID ); + + /* check new parameter for generator */ + if (xmin >= xmax) { + _unur_error(NULL,UNUR_ERR_DISTR_SET,"histogram, min >= max"); + return UNUR_ERR_DISTR_SET; + } + if (!_unur_isfinite(xmin) || !_unur_isfinite(xmax)) { + _unur_error(NULL,UNUR_ERR_DISTR_SET,"histogram, unbounded domain"); + return UNUR_ERR_DISTR_SET; + } + + /* store boundaries of histogram */ + DISTR.hmin = xmin; + DISTR.hmax = xmax; + + /* changelog */ + distr->set |= UNUR_DISTR_SET_DOMAIN; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_distr_cemp_set_hist_domain() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cemp_set_hist_bins( struct unur_distr *distr, const double *bins, int n_bins ) + /*----------------------------------------------------------------------*/ + /* set locations of bins of histogram */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* bins ... pointer to array of boundaries between bins */ + /* n_bins ... number of bins */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CEMP, UNUR_ERR_DISTR_INVALID ); + _unur_check_NULL( distr->name, bins, UNUR_ERR_NULL ); + + /* check whether probabilities for bins are already set */ + if (DISTR.hist_prob == NULL) { + _unur_error(NULL,UNUR_ERR_DISTR_SET,"probabilities of histogram not set"); + return UNUR_ERR_DISTR_SET; + } + + /* check new parameter for generator */ + if (n_bins != (DISTR.n_hist+1)) { + _unur_error(NULL,UNUR_ERR_DISTR_SET,"histogram size"); + return UNUR_ERR_DISTR_SET; + } + + /* boundary points must be strictly monontonically increasing */ + for( i=1; iname,UNUR_ERR_DISTR_SET,"bins not strictly increasing"); + return UNUR_ERR_DISTR_SET; + } + + /* set boundary */ + if (unur_distr_cemp_set_hist_domain(distr, bins[0], bins[n_bins-1]) != UNUR_SUCCESS) + return UNUR_ERR_DISTR_SET; + + /* allocate memory for bins */ + DISTR.hist_bins = _unur_xmalloc( n_bins * sizeof(double) ); + if (!DISTR.hist_bins) return UNUR_ERR_MALLOC; + + /* copy bins */ + memcpy( DISTR.hist_bins, bins, n_bins * sizeof(double) ); + + /* changelog */ + distr->set |= UNUR_DISTR_SET_DOMAIN; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_distr_cemp_set_hist_bins() */ + +/*---------------------------------------------------------------------------*/ + + +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_distr_cemp_debug( const struct unur_distr *distr, const char *genid, unsigned printvector ) + /*----------------------------------------------------------------------*/ + /* write info about distribution into LOG file */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* genid ... pointer to generator id */ + /* printvector ... print observed sample if not 0 */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int i; + + /* check arguments */ + CHECK_NULL(distr,RETURN_VOID); + COOKIE_CHECK(distr,CK_DISTR_CEMP,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: distribution:\n",genid); + fprintf(LOG,"%s:\ttype = continuous univariate distribution (ie. a sample)\n",genid); + fprintf(LOG,"%s:\tname = %s\n",genid,distr->name); + + if (DISTR.n_sample>0) { + /* observed samples */ + fprintf(LOG,"%s:\tsample size = %d",genid,DISTR.n_sample); + if (printvector) { + for (i=0; i0) { + /* histogram */ + fprintf(LOG,"%s:\thistogram: #bins = %d, ",genid,DISTR.n_hist); + fprintf(LOG,"min = %g, max = %g", DISTR.hmin, DISTR.hmax); + if (DISTR.hist_bins) { + fprintf(LOG," (bins with different width)\n"); + if (printvector) { + fprintf(LOG,"%s:\t> bins (breaks) = ",genid); + for (i=0; i<=DISTR.n_hist; i++) { + if (i%10 == 0) + fprintf(LOG,"\n%s:\t",genid); + fprintf(LOG," %.5f",DISTR.hist_bins[i]); + } + fprintf(LOG,"\n%s:\n",genid); + } + } + else { + fprintf(LOG,", width = %g (equally spaced)\n", (DISTR.hmax-DISTR.hmin)/DISTR.n_hist); + } + if (printvector) { + fprintf(LOG,"%s:\t> bin probabilities = ",genid); + for (i=0; i +#include +#include +#include "distr.h" +#include "cont.h" +#include "condi.h" +#include "distr_source.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "conditional"; + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cvec /* underlying (base) distribution */ +#define CONDI condi->data.cont /* conditional distribution */ + +#define iK 0 /* index of variable to be variated */ +#define K (condi->data.cont.params[iK]) + +#define iPOSITION 0 /* condition (position of point) */ +#define iDIRECTION 1 /* direction of variation */ +#define iXARG 2 /* working array for storing point x */ +#define iGRADF 3 /* working array for storing grad of PDF */ + +#define POSITION (condi->data.cont.param_vecs[iPOSITION]) +#define DIRECTION (condi->data.cont.param_vecs[iDIRECTION]) +#define XARG (condi->data.cont.param_vecs[iXARG]) +#define GRADF (condi->data.cont.param_vecs[iGRADF]) + +/*---------------------------------------------------------------------------*/ + +/* function prototypes */ +static double _unur_pdf_condi( double x, const struct unur_distr *condi ); +static double _unur_dpdf_condi( double x, const struct unur_distr *condi ); + +static double _unur_logpdf_condi( double x, const struct unur_distr *condi ); +static double _unur_dlogpdf_condi( double x, const struct unur_distr *condi ); + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** univariate continuous conditional distribution of multivaraiate **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_condi_new( const struct unur_distr *distr, const double *pos, const double *dir, int k ) + /*----------------------------------------------------------------------*/ + /* Create an object for full conditional distribution . */ + /* either for k-th variable and the other variables fixed to pos; */ + /* or for pos + t*dir. */ + /* The first one is chosen when dir == NULL. */ + /* `distr' must be a pointer to a multivariate continuous distribution. */ + /* */ + /* parameters: */ + /* distr ... pointer to multivariate continuous distribution. */ + /* pos ... values for constant variables */ + /* dir ... direction (or NULL) */ + /* k ... variable (must be in range 0 ... dim-1) */ + /* */ + /* return: */ + /* pointer to conditional distribution object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_distr *condi; + double *ar; + + /* check arguments */ + _unur_check_NULL( distr_name, distr, NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CVEC) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CVEC,NULL); + + /* check parameters pos and k */ + _unur_check_NULL( distr_name, pos, NULL ); + if ( dir==NULL && (k<0 || k>=distr->dim)) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,"k < 0 or k >= dim"); + return NULL; + } + + /* get distribution object for generic continuous univariate distribution */ + condi = unur_distr_cont_new(); + if (!condi) return NULL; + + /* set id to distribution of conditional distribution */ + condi->id = UNUR_DISTR_CONDI; + + /* name of distribution */ + condi->name = distr_name; + + /* this is a derived distribution */ + /* clone base distribution ... */ + condi->base = _unur_distr_cvec_clone( distr ); + if (!condi->base) { _unur_distr_free(condi); return NULL; } + + /* set parameters for conditional distribution */ + CONDI.n_params = 1; /* one parameters: k */ + if ( unur_distr_condi_set_condition( condi, pos, dir, k ) != UNUR_SUCCESS ) { + _unur_distr_free(condi); return NULL; + } + + /* we need two working arrays for computing PDF and dPDF */ + /* we abuse parameter vectors for this purpose */ + ar = _unur_xmalloc( distr->dim * sizeof(double) ); + memset( ar, 0, distr->dim * sizeof(double) ); + if ( (unur_distr_cont_set_pdfparams_vec( condi, iXARG, ar, distr->dim ) != UNUR_SUCCESS) || + (unur_distr_cont_set_pdfparams_vec( condi, iGRADF, ar, distr->dim ) != UNUR_SUCCESS) ) { + _unur_distr_free(condi); free(ar); return NULL; + } + free(ar); + + /* pointer to PDF, its derivative, and CDF */ + if (DISTR.pdf) { + CONDI.pdf = _unur_pdf_condi; /* pointer to PDF */ + if (DISTR.dpdf) + CONDI.dpdf = _unur_dpdf_condi; /* derivative of PDF */ + } + + /* pointer to logPDF, its derivative */ + if (DISTR.logpdf) { + CONDI.logpdf = _unur_logpdf_condi; /* pointer to logPDF */ + if (DISTR.dlogpdf) + CONDI.dlogpdf = _unur_dlogpdf_condi; /* derivative of logPDF */ + } + + /* return pointer to object */ + return condi; + +} /* end of unur_distr_condi_new() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_condi_set_condition( struct unur_distr *condi, const double *pos, const double *dir, int k ) + /*----------------------------------------------------------------------*/ + /* Change values of fixed variables to pos and use k-th variable / */ + /* direction dir. */ + /* */ + /* parameters: */ + /* condi ... pointer to conditional distribution */ + /* pos ... values for constant variables */ + /* dir ... direction (or NULL) */ + /* k ... variable (must be in range 0 ... dim-1) */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int dim; + double *domain; + + /* check arguments */ + _unur_check_NULL( distr_name, condi, UNUR_ERR_NULL ); + _unur_check_distr_object( condi, CONT, UNUR_ERR_DISTR_INVALID ); + + /* check distribution */ + if (condi->id != UNUR_DISTR_CONDI) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); + return UNUR_ERR_DISTR_INVALID; } + COOKIE_CHECK(condi,CK_DISTR_CONT,UNUR_ERR_COOKIE); + + /* dimension of underlying distribution */ + dim = condi->base->dim; + + /* check parameters pos and k */ + _unur_check_NULL( condi->name, pos, UNUR_ERR_NULL ); + if ( dir== NULL && (k<0 || k>=dim)) { + _unur_error(condi->name,UNUR_ERR_DISTR_INVALID,"k < 0 or k >= dim"); + return UNUR_ERR_DISTR_INVALID; + } + + /* set parameters for conditional distribution */ + K = (double) k; + if ( unur_distr_cont_set_pdfparams_vec( condi, iPOSITION, pos, dim ) != UNUR_SUCCESS ) { + return UNUR_ERR_DISTR_INVALID; + } + + if ( unur_distr_cont_set_pdfparams_vec( condi, iDIRECTION, dir, dim ) != UNUR_SUCCESS ) { + return UNUR_ERR_DISTR_INVALID; + } + + /* set domain of conditional distribution */ + if ( (domain = condi->base->data.cvec.domainrect) != NULL ) { + if (dir == NULL) { + CONDI.trunc[0] = CONDI.domain[0] = domain[2*k]; + CONDI.trunc[1] = CONDI.domain[1] = domain[2*k+1]; + } + else { + /* arbitrary direction: we ignore given domain */ + CONDI.trunc[0] = CONDI.domain[0] = -UNUR_INFINITY; + CONDI.trunc[1] = CONDI.domain[1] = UNUR_INFINITY; + } + } + + /* changelog */ + condi->set &= ~UNUR_DISTR_SET_MODE; /* mode unknown */ + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_condi_set_condition() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_condi_get_condition( struct unur_distr *condi, const double **pos, const double **dir, int *k ) + /*----------------------------------------------------------------------*/ + /* Read values of fixed variables, variable k / direction dir. */ + /* */ + /* parameters: */ + /* condi ... pointer to conditional distribution */ + /* pos ... pointer to array to store constant variables */ + /* dir ... pointer to array to store direction */ + /* k ... pointer to store variable */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( distr_name, condi, UNUR_ERR_NULL ); + _unur_check_distr_object( condi, CONT, UNUR_ERR_DISTR_INVALID ); + + /* check distribution */ + if (condi->id != UNUR_DISTR_CONDI) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); + return UNUR_ERR_DISTR_INVALID; } + COOKIE_CHECK(condi,CK_DISTR_CONT,UNUR_ERR_COOKIE); + + /* position in vector */ + *k = (int) K; + + /* store pointer to values */ + *pos = POSITION; + + /* store pointer to direction */ + *dir = DIRECTION; + + /* return position */ + return UNUR_SUCCESS; +} /* end of unur_distr_condi_get_condition() */ + +/*---------------------------------------------------------------------------*/ + +const struct unur_distr * +unur_distr_condi_get_distribution( const struct unur_distr *condi ) + /*----------------------------------------------------------------------*/ + /* get pointer to distribution object for underlying distribution */ + /* */ + /* parameters: */ + /* condi ... pointer to conditional distribution object */ + /* */ + /* return: */ + /* pointer to underlying distribution */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( distr_name, condi, NULL ); + _unur_check_distr_object( condi, CONT, NULL ); + + /* check distribution */ + if (condi->id != UNUR_DISTR_CONDI) { + _unur_warning(distr_name,UNUR_ERR_DISTR_INVALID,""); + return NULL; + } + + return condi->base; +} /* end of unur_distr_condi_get_distribution() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** PDF, its derivative and CDF of conditional distribution **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_condi( double x, const struct unur_distr *condi ) + /* + PDF(x) = mvpdf(p(x)) + + mvpdf(.) ... PDF of underlying multivariate distribution + p(x) ... vector with x in k-th position and pos in all others + */ +{ + int dim = condi->base->dim; /* dimension of underlying distribution */ + int k = (int) K; /* position in vector */ + int i; + + /* set point for multivariate PDF */ + if (DIRECTION==NULL) { /* use k-th variable */ + memcpy(XARG, POSITION, dim * sizeof(double) ); + XARG[k] = x; + } + else { /* use direction vector */ + memcpy(XARG, POSITION, dim * sizeof(double) ); + for (i=0; ibase); + +} /* end of _unur_pdf_condi() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_condi( double x, const struct unur_distr *condi ) + /* + logPDF(x) = logmvpdf(p(x)) + + mvpdf(.) ... logPDF of underlying multivariate distribution + p(x) ... vector with x in k-th position and pos in all others + */ +{ + int dim = condi->base->dim; /* dimension of underlying distribution */ + int k = (int) K; /* position in vector */ + int i; + + /* set point for multivariate logPDF */ + if (DIRECTION==NULL) { /* use k-th variable */ + memcpy(XARG, POSITION, dim * sizeof(double) ); + XARG[k] = x; + } + else { /* use direction vector */ + memcpy(XARG, POSITION, dim * sizeof(double) ); + for (i=0; ibase); + +} /* end of _unur_logpdf_condi() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_condi( double x, const struct unur_distr *condi ) + /* + (dPDF/dxk)(x) = (grad mvpdf(p(x)))[k] + + mvpdf(.) ... PDF of underlying multivariate distribution + p(x) ... vector with x in k-th position and pos in all others + */ +{ + int dim = condi->base->dim; /* dimension of underlying distribution */ + int k = (int) K; /* position in vector */ + int i; + double df; + + if (DIRECTION==NULL) { /* use k-th variable */ + /* set point for multivariate PDF */ + memcpy(XARG, POSITION, dim * sizeof(double) ); + XARG[k] = x; + if (condi->base->data.cvec.pdpdf) { + /* we have a pointer to the partial derivative */ + df = _unur_cvec_pdPDF(XARG, k, condi->base); + } + else { + /* we do not have partial derivatives --> have to take coordinate from gradient */ + /* compute gradient */ + _unur_cvec_dPDF(GRADF, XARG, condi->base); + /* return k-th component */ + df = GRADF[k]; + } + } + + else { /* use direction vector */ + memcpy(XARG, POSITION, dim * sizeof(double) ); + for (i=0; ibase); + for (df=0.,i=0; ibase->dim; /* dimension of underlying distribution */ + int k = (int) K; /* position in vector */ + int i; + double df; + + if (DIRECTION==NULL) { /* use k-th variable */ + /* set point for multivariate logPDF */ + memcpy(XARG, POSITION, dim * sizeof(double) ); + XARG[k] = x; + if (condi->base->data.cvec.pdlogpdf) { + /* we have a pointer to the partial derivative */ + df = _unur_cvec_pdlogPDF(XARG, k, condi->base); + } + else { + /* we do not have partial derivatives --> have to take coordinate from gradient */ + /* compute gradient */ + _unur_cvec_dlogPDF(GRADF, XARG, condi->base); + /* return k-th component */ + df = GRADF[k]; + } + } + + else { /* use direction vector */ + memcpy(XARG, POSITION, dim * sizeof(double) ); + for (i=0; ibase); + for (df=0.,i=0; ibase,RETURN_VOID); + + LOG = unur_get_stream(); + + /* print data about conditional distribution */ + fprintf(LOG,"%s: distribution:\n",genid); + fprintf(LOG,"%s:\ttype = full conditional distribution of continuous multivariate distribution\n",genid); + fprintf(LOG,"%s:\tname = %s\n",genid,condi->name); + fprintf(LOG,"%s:\n",genid); + + /* number of the variable for which the conditional distribution + is to be shown */ + fprintf(LOG,"%s:\tcondition (at time of creation):\n",genid); + if (DIRECTION==NULL) { + fprintf(LOG,"%s:\tvariable = %d\n",genid,(int)(K)); + _unur_matrix_print_vector( condi->base->dim, POSITION, "\tpoint =", LOG, genid, "\t "); + } + else { + _unur_matrix_print_vector( condi->base->dim, DIRECTION, "\tdirection =", LOG, genid, "\t "); + _unur_matrix_print_vector( condi->base->dim, POSITION, "\tpoint =", LOG, genid, "\t "); + } + fprintf(LOG,"%s:\n",genid); + + /* domain */ + fprintf(LOG,"%s:\tdomain = (%g, %g)\n",genid,CONDI.domain[0],CONDI.domain[1]); + fprintf(LOG,"%s:\n",genid); + + /* print data about underlying distribution */ + fprintf(LOG,"%s: Underlying distribution:\n",genid); + _unur_distr_cvec_debug(condi->base, genid); + +} /* end of _unur_distr_condi_debug() */ +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distr/condi.h b/vendor/unuran-1.11.0/src/distr/condi.h new file mode 100644 index 0000000..e7f566b --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/condi.h @@ -0,0 +1,169 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: condi.h * + * * + * PURPOSE: * + * function prototypes for manipulating distribution objects of * + * id CONDI (continuous full conditional distribution) * + * type CONT (continuous univariate distribution) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/* + =NODEX CONDI Continuous univariate full conditional distribution + + =UP Distribution_objects [35] + + =DESCRIPTION + Full conditional distribution for a given continuous + multivariate distributiion. The condition is a position vector + and either a variable that is variated or a vector that + indicates the direction on which the random vector can variate. + + There is a subtle difference between using direction + vector and using the @var{k}-th variable. + When a direction vector is given the PDF of the conditional + distribution is defined by + @unurmath{f(t) = PDF(pos + t\cdot dir).} + When a variable is selected the full conditional distribution + with all other variables fixed is used. + + This is a special case of a continuous univariate distribution + and thus they have most of these parameters (with the exception + that functions cannot be changed). Additionally, + + @itemize @minus + @item there is a call to extract the underlying multivariate + distribution, + + @item and a call to handle the variables that are fixed and the + direction for changing the random vector. + + @end itemize + + This distibution type is primarily used for evaluation the + conditional distribution and its derivative (as required for, + e.g., the Gibbs sampler). The density is not normalized (i.e. does + not integrate to one). Mode and area are not available and it + does not make sense to use any call to set or change parameters + except the ones given below. + + =END +*/ + +/*---------------------------------------------------------------------------*/ + +/* + Routines for handling univariate continuous full conditional + distributions (CONDI). +*/ + +/* =ROUTINES */ + +UNUR_DISTR *unur_distr_condi_new( const UNUR_DISTR *distribution, const double *pos, const double *dir, int k ); +/* + Create an object for full conditional distribution for the given + @var{distribution}. The condition is given by a position vector + @var{pos} and either the @var{k}-th variable that is variated or + the vector @var{dir} that contains the direction on which the + random vector can variate. + + @var{distribution} must be a pointer to a multivariate continuous + distribution. + @var{pos} must be a pointer to an array of size @code{dim}, where + @code{dim} is the dimension of the underlying distribution object. + @var{dir} must be a pointer to an array if size @code{dim} or NULL. + @var{k} must be in the range @code{0, @dots{}, dim-1}. + If the @var{k}-th variable is used, @var{dir} must be set to NULL. + + @emph{Notice:} There is a subtle difference between using direction + vector @var{dir} and using the @var{k}-th variable. + When @var{dir} is given, the current position @var{pos} is mapped into + 0 of the conditional distribution and the derivative is taken from + the function PDF(@var{pos}+t*@var{dir}) w.r.t. @i{t}. + On the other hand, when the coordinate @var{k} is used (i.e., when + @var{dir} is set to NULL), the full conditional distribution of the + distribution is considered (as used for the Gibbs sampler). + In particular, the current point is just projected into the + one-dimensional subspace without mapping it into the point 0. + + @emph{Notice:} If a coordinate @var{k} is used, then the @var{k}-th + partial derivative is used if it as available. Otherwise the + gradient is computed and the @var{k}-th component is returned. + + The resulting generator object is of the same type as of a + unur_distr_cont_new() call. +*/ + +int unur_distr_condi_set_condition( struct unur_distr *distribution, const double *pos, const double *dir, int k ); +/* + Set/change condition for conditional @var{distribution}. + Change values of fixed variables to @var{pos} and use direction + @var{dir} or @var{k}-th variable of conditional @var{distribution}. + + @var{pos} must be a pointer to an array of size @code{dim}, where + @code{dim} is the dimension of the underlying distribution object. + @var{dir} must be a pointer to an array if size @code{dim} or NULL. + @var{k} must be in the range @code{0, @dots{}, dim-1}. + If the @var{k}-th variable is used, @var{dir} must be set to NULL. + + @emph{Notice:} There is a subtle difference between using direction + vector @var{dir} and using the @var{k}-th variable. + When @var{dir} is given, the current position @var{pos} is mapped into + 0 of the conditional distribution and the derivative is taken from + the function PDF(@var{pos}+t*@var{dir}) w.r.t. @i{t}. + On the other hand, when the coordinate @var{k} is used (i.e., when + @var{dir} is set to NULL), the full conditional distribution of the + distribution is considered (as used for the Gibbs sampler). + In particular, the current point is just projected into the + one-dimensional subspace without mapping it into the point 0. +*/ + +int unur_distr_condi_get_condition( struct unur_distr *distribution, const double **pos, const double **dir, int *k ); +/* + Get condition for conditional @var{distribution}. + The values for the fixed variables are stored in @var{pos}, which + must be a pointer to an array of size @code{dim}. + The condition is stored in @var{dir} and @var{k}, respectively. + + @emph{Important:} Do @strong{not} change the entries in @var{pos} + and @var{dir}! +*/ + +const UNUR_DISTR *unur_distr_condi_get_distribution( const UNUR_DISTR *distribution ); +/* + Get pointer to distribution object for underlying distribution. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distr/cont.c b/vendor/unuran-1.11.0/src/distr/cont.c new file mode 100644 index 0000000..352365f --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/cont.c @@ -0,0 +1,2536 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: cont.c * + * * + * manipulate univariate continuous distribution objects * + * * + * return: * + * UNUR_SUCCESS ... on success * + * error code ... on error * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include "distr_source.h" +#include "distr.h" +#include "cont.h" + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cont + +/* for derived distributions (e.g. order statistics): + data of underlying distributions */ +#define BASE distr->base->data.cont + +/*---------------------------------------------------------------------------*/ + +static double _unur_distr_cont_eval_pdf_tree( double x, const struct unur_distr *distr ); +static double _unur_distr_cont_eval_logpdf_tree( double x, const struct unur_distr *distr ); +static double _unur_distr_cont_eval_dpdf_tree( double x, const struct unur_distr *distr ); +static double _unur_distr_cont_eval_dlogpdf_tree( double x, const struct unur_distr *distr ); +/*---------------------------------------------------------------------------*/ +/* evaluate function tree for (derivative of) (log) PDF. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_distr_cont_eval_cdf_tree( double x, const struct unur_distr *distr ); +static double _unur_distr_cont_eval_logcdf_tree( double x, const struct unur_distr *distr ); +/*---------------------------------------------------------------------------*/ +/* evaluate function tree for (log) CDF. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_distr_cont_eval_hr_tree( double x, const struct unur_distr *distr ); +/*---------------------------------------------------------------------------*/ +/* evaluate function tree for HR. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_distr_cont_free( struct unur_distr *distr ); +/*---------------------------------------------------------------------------*/ +/* destroy distribution object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_distr_cont_find_mode( struct unur_distr *distr ); +/*---------------------------------------------------------------------------*/ +/* find mode of unimodal univariate PDF numerically */ +/*---------------------------------------------------------------------------*/ + +static double _unur_aux_pdf(double x, void *p); +/*---------------------------------------------------------------------------*/ +/* Auxiliary function used in the computation of the mode */ +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** univariate continuous distributions **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_cont_new( void ) + /*----------------------------------------------------------------------*/ + /* create a new (empty) distribution object */ + /* type: univariate continuous with given p.d.f. */ + /* */ + /* parameters: */ + /* none */ + /* */ + /* return: */ + /* pointer to distribution object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + register struct unur_distr *distr; + int i; + + /* get empty distribution object */ + distr = _unur_distr_generic_new(); + if (!distr) return NULL; + + /* set magic cookie */ + COOKIE_SET(distr,CK_DISTR_CONT); + + /* set type of distribution */ + distr->type = UNUR_DISTR_CONT; + + /* set id to generic distribution */ + distr->id = UNUR_DISTR_GENERIC; + + /* dimension of random vector */ + distr->dim = 1; /* univariant */ + + /* destructor */ + distr->destroy = _unur_distr_cont_free; + + /* clone */ + distr->clone = _unur_distr_cont_clone; + + /* set defaults */ + DISTR.pdf = NULL; /* pointer to PDF */ + DISTR.dpdf = NULL; /* pointer to derivative of PDF */ + DISTR.logpdf = NULL; /* pointer to logPDF */ + DISTR.dlogpdf = NULL; /* pointer to derivative of logPDF */ + DISTR.cdf = NULL; /* pointer to CDF */ + DISTR.logcdf = NULL; /* pointer to logCDF */ + DISTR.invcdf = NULL; /* pointer to inverse CDF */ + DISTR.hr = NULL; /* pointer to HR */ + + DISTR.init = NULL; /* pointer to special init routine */ + + /* initialize parameters of the p.d.f. */ + DISTR.n_params = 0; /* number of parameters of the pdf */ + for (i=0; idata.cont + + struct unur_distr *clone; + int i; + + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CONT, NULL ); + + /* allocate memory */ + clone = _unur_xmalloc( sizeof(struct unur_distr) ); + + /* copy distribution object into clone */ + memcpy( clone, distr, sizeof( struct unur_distr ) ); + + /* copy function trees into generator object (when there is one) */ + CLONE.pdftree = (DISTR.pdftree) ? _unur_fstr_dup_tree(DISTR.pdftree) : NULL; + CLONE.dpdftree = (DISTR.dpdftree) ? _unur_fstr_dup_tree(DISTR.dpdftree) : NULL; + CLONE.logpdftree = (DISTR.logpdftree) ? _unur_fstr_dup_tree(DISTR.logpdftree) : NULL; + CLONE.dlogpdftree = (DISTR.dlogpdftree) ? _unur_fstr_dup_tree(DISTR.dlogpdftree) : NULL; + CLONE.cdftree = (DISTR.cdftree) ? _unur_fstr_dup_tree(DISTR.cdftree) : NULL; + CLONE.logcdftree = (DISTR.logcdftree) ? _unur_fstr_dup_tree(DISTR.logcdftree) : NULL; + CLONE.hrtree = (DISTR.hrtree) ? _unur_fstr_dup_tree(DISTR.hrtree) : NULL; + + /* clone of parameter arrays */ + for (i=0; iname_str) { + size_t len = strlen(distr->name_str) + 1; + clone->name_str = _unur_xmalloc(len); + memcpy( clone->name_str, distr->name_str, len ); + clone->name = clone->name_str; + } + + /* for a derived distribution we also have to copy the underlying */ + /* distribution object */ + if (distr->base != NULL) { + clone->base = _unur_distr_clone(distr->base); + } + + return clone; + +#undef CLONE +} /* end of _unur_distr_cont_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_distr_cont_free( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* free distribution object */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + if( distr == NULL ) /* nothing to do */ + return; + _unur_check_distr_object( distr, CONT, RETURN_VOID ); + + /* parameter arrays */ + for (i=0; ibase) _unur_distr_free(distr->base); + + /* user name for distribution */ + if (distr->name_str) free(distr->name_str); + + COOKIE_CLEAR(distr); + free( distr ); +} /* end of _unur_distr_cont_free() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_set_pdf( struct unur_distr *distr, UNUR_FUNCT_CONT *pdf ) + /*----------------------------------------------------------------------*/ + /* set PDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* pdf ... pointer to PDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_NULL( distr->name, pdf, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + + /* we do not allow overwriting a pdf */ + if (DISTR.pdf != NULL || DISTR.logpdf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of PDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* for derived distributions (e.g. order statistics) not possible */ + if (distr->base) return UNUR_ERR_DISTR_INVALID; + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + DISTR.pdf = pdf; + return UNUR_SUCCESS; + +} /* end of unur_distr_cont_set_pdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_set_dpdf( struct unur_distr *distr, UNUR_FUNCT_CONT *dpdf ) + /*----------------------------------------------------------------------*/ + /* set derivative of PDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* dpdf ... pointer to derivative of PDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_NULL( distr->name, dpdf, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + + /* we do not allow overwriting a dpdf */ + if (DISTR.dpdf != NULL || DISTR.dlogpdf != NULL ) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of dPDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* for derived distributions (e.g. order statistics) not possible */ + if (distr->base) return UNUR_ERR_DISTR_INVALID; + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + DISTR.dpdf = dpdf; + return UNUR_SUCCESS; +} /* end of unur_distr_cont_set_dpdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_set_logpdf( struct unur_distr *distr, UNUR_FUNCT_CONT *logpdf ) + /*----------------------------------------------------------------------*/ + /* set logPDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* logpdf ... pointer to logPDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_NULL( distr->name, logpdf, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + + /* we do not allow overwriting a pdf */ + if (DISTR.pdf != NULL || DISTR.logpdf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of logPDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* for derived distributions (e.g. order statistics) not possible */ + if (distr->base) return UNUR_ERR_DISTR_INVALID; + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + DISTR.logpdf = logpdf; + DISTR.pdf = _unur_distr_cont_eval_pdf_from_logpdf; + + return UNUR_SUCCESS; + +} /* end of unur_distr_cont_set_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_distr_cont_eval_pdf_from_logpdf( double x, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate PDF of distribution at x */ + /* wrapper when only logPDF is given */ + /* */ + /* parameters: */ + /* x ... argument for pdf */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* PDF(x) */ + /*----------------------------------------------------------------------*/ +{ + if (DISTR.logpdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + } + + return exp(_unur_cont_logPDF(x,distr)); +} /* end of _unur_distr_cont_eval_pdf_from_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_set_dlogpdf( struct unur_distr *distr, UNUR_FUNCT_CONT *dlogpdf ) + /*----------------------------------------------------------------------*/ + /* set derivative of logPDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* dlogpdf ... pointer to derivative of logPDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_NULL( distr->name, dlogpdf, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + + /* we do not allow overwriting a dpdf */ + if (DISTR.dpdf != NULL || DISTR.dlogpdf != NULL ) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of dlogPDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* for derived distributions (e.g. order statistics) not possible */ + if (distr->base) return UNUR_ERR_DISTR_INVALID; + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + DISTR.dlogpdf = dlogpdf; + DISTR.dpdf = _unur_distr_cont_eval_dpdf_from_dlogpdf; + + return UNUR_SUCCESS; +} /* end of unur_distr_cont_set_dlogpdf() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_distr_cont_eval_dpdf_from_dlogpdf( double x, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate derivative of PDF of distribution at x */ + /* wrapper when only derivative of logPDF is given */ + /* */ + /* parameters: */ + /* x ... argument for dPDF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* dPDF(x) ... on success */ + /* UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ + if (DISTR.logpdf == NULL || DISTR.dlogpdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + } + + return exp(_unur_cont_logPDF(x,distr)) * _unur_cont_dlogPDF(x,distr); +} /* end of _unur_distr_cont_eval_dpdf_from_dlogpdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_set_cdf( struct unur_distr *distr, UNUR_FUNCT_CONT *cdf ) + /*----------------------------------------------------------------------*/ + /* set CDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* cdf ... pointer to CDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_NULL( distr->name, cdf,UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + + /* we do not allow overwriting a cdf */ + if (DISTR.cdf != NULL || DISTR.logcdf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of CDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* for derived distributions (e.g. order statistics) not possible */ + if (distr->base) return UNUR_ERR_DISTR_INVALID; + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + DISTR.cdf = cdf; + return UNUR_SUCCESS; +} /* end of unur_distr_cont_set_cdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_set_invcdf( struct unur_distr *distr, UNUR_FUNCT_CONT *invcdf ) + /*----------------------------------------------------------------------*/ + /* set inverse CDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* invcdf ... pointer to inverse CDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_NULL( distr->name, invcdf,UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + + /* we do not allow overwriting an inverse cdf */ + if (DISTR.invcdf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of inverse CDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* for derived distributions (e.g. order statistics) not possible */ + if (distr->base) return UNUR_ERR_DISTR_INVALID; + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + DISTR.invcdf = invcdf; + return UNUR_SUCCESS; +} /* end of unur_distr_cont_set_invcdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_set_logcdf( struct unur_distr *distr, UNUR_FUNCT_CONT *logcdf ) + /*----------------------------------------------------------------------*/ + /* set logCDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* logcdf ... pointer to logCDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_NULL( distr->name, logcdf, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + + /* we do not allow overwriting a cdf */ + if (DISTR.cdf != NULL || DISTR.logcdf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of logCDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* for derived distributions (e.g. order statistics) not possible */ + if (distr->base) return UNUR_ERR_DISTR_INVALID; + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + DISTR.logcdf = logcdf; + DISTR.cdf = _unur_distr_cont_eval_cdf_from_logcdf; + + return UNUR_SUCCESS; + +} /* end of unur_distr_cont_set_logcdf() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_distr_cont_eval_cdf_from_logcdf( double x, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate CDF of distribution at x */ + /* wrapper when only logCDF is given */ + /* */ + /* parameters: */ + /* x ... argument for cdf */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* CDF(x) */ + /*----------------------------------------------------------------------*/ +{ + if (DISTR.logcdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + } + + return exp(_unur_cont_logCDF(x,distr)); +} /* end of _unur_distr_cont_eval_cdf_from_logcdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_set_hr( struct unur_distr *distr, UNUR_FUNCT_CONT *hr ) + /*----------------------------------------------------------------------*/ + /* set HR of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* hr ... pointer to HR */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_NULL( distr->name, hr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + + /* we do not allow overwriting a cdf */ + if (DISTR.hr != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of HR not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* for derived distributions (e.g. order statistics) not possible */ + if (distr->base) return UNUR_ERR_DISTR_INVALID; + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + DISTR.hr = hr; + return UNUR_SUCCESS; +} /* end of unur_distr_cont_set_hr() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_set_pdfstr( struct unur_distr *distr, const char *pdfstr ) + /*----------------------------------------------------------------------*/ + /* set PDF and its derivative of distribution via a string interface */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* pdfstr ... string that describes function term of PDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + _unur_check_NULL( NULL, pdfstr, UNUR_ERR_NULL ); + + /* When the user calls unur_distr_cont_set_cdfstr() before this function */ + /* then the PDF and dPDF probably are already set and we get an error. */ + /* This might happen in particular for the String API. */ + /* To avoid confusion we remove these settings. */ + if ( DISTR.pdftree || DISTR.logpdftree ) { + if (DISTR.pdftree) _unur_fstr_free(DISTR.pdftree); + if (DISTR.dpdftree) _unur_fstr_free(DISTR.dpdftree); + if (DISTR.logpdftree) _unur_fstr_free(DISTR.logpdftree); + if (DISTR.dlogpdftree) _unur_fstr_free(DISTR.dlogpdftree); + DISTR.pdf = NULL; + DISTR.dpdf = NULL; + DISTR.logpdf = NULL; + DISTR.dlogpdf = NULL; + } + + /* we do not allow overwriting a PDF */ + if (DISTR.pdf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of PDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* for derived distributions (e.g. order statistics) not possible */ + if (distr->base) return UNUR_ERR_DISTR_INVALID; + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + /* parse PDF string */ + if ( (DISTR.pdftree = _unur_fstr2tree(pdfstr)) == NULL ) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Syntax error in function string"); + return UNUR_ERR_DISTR_SET; + } + DISTR.pdf = _unur_distr_cont_eval_pdf_tree; + + /* make derivative */ + if ( (DISTR.dpdftree = _unur_fstr_make_derivative(DISTR.pdftree)) == NULL ) + return UNUR_ERR_DISTR_DATA; + DISTR.dpdf = _unur_distr_cont_eval_dpdf_tree; + + return UNUR_SUCCESS; +} /* end of unur_distr_cont_set_pdfstr() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_set_logpdfstr( struct unur_distr *distr, const char *logpdfstr ) + /*----------------------------------------------------------------------*/ + /* set logPDF and its derivative of distribution via a string interface */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* logpdfstr ... string that describes function term of logPDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + _unur_check_NULL( NULL, logpdfstr, UNUR_ERR_NULL ); + + /* When the user calls unur_distr_cont_set_cdfstr() before this function */ + /* then the PDF and dPDF probably are already set and we get an error. */ + /* This might happen in particular for the String API. */ + /* To avoid confusion we remove these settings. */ + if ( DISTR.pdftree || DISTR.logpdftree ) { + if (DISTR.pdftree) _unur_fstr_free(DISTR.pdftree); + if (DISTR.dpdftree) _unur_fstr_free(DISTR.dpdftree); + if (DISTR.logpdftree) _unur_fstr_free(DISTR.logpdftree); + if (DISTR.dlogpdftree) _unur_fstr_free(DISTR.dlogpdftree); + DISTR.pdf = NULL; + DISTR.dpdf = NULL; + DISTR.logpdf = NULL; + DISTR.dlogpdf = NULL; + } + + /* we do not allow overwriting a PDF */ + if (DISTR.pdf != NULL || DISTR.logpdf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of logPDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* for derived distributions (e.g. order statistics) not possible */ + if (distr->base) return UNUR_ERR_DISTR_INVALID; + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + /* parse logPDF string */ + if ( (DISTR.logpdftree = _unur_fstr2tree(logpdfstr)) == NULL ) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Syntax error in function string"); + return UNUR_ERR_DISTR_SET; + } + DISTR.logpdf = _unur_distr_cont_eval_logpdf_tree; + DISTR.pdf = _unur_distr_cont_eval_pdf_from_logpdf; + + /* make derivative */ + if ( (DISTR.dlogpdftree = _unur_fstr_make_derivative(DISTR.logpdftree)) == NULL ) + return UNUR_ERR_DISTR_DATA; + DISTR.dlogpdf = _unur_distr_cont_eval_dlogpdf_tree; + DISTR.dpdf = _unur_distr_cont_eval_dpdf_from_dlogpdf; + + return UNUR_SUCCESS; +} /* end of unur_distr_cont_set_logpdfstr() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_set_cdfstr( struct unur_distr *distr, const char *cdfstr ) + /*----------------------------------------------------------------------*/ + /* set CDF of distribution via a string interface */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* cdfstr ... string that describes function term of CDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + _unur_check_NULL( NULL, cdfstr, UNUR_ERR_NULL ); + + /* we do not allow overwriting a CDF */ + if (DISTR.cdf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of CDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* for derived distributions (e.g. order statistics) not possible */ + if (distr->base) return UNUR_ERR_DISTR_INVALID; + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + /* parse string */ + if ( (DISTR.cdftree = _unur_fstr2tree(cdfstr)) == NULL ) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Syntax error in function string"); + return UNUR_ERR_DISTR_SET; + } + DISTR.cdf = _unur_distr_cont_eval_cdf_tree; + + /* make derivatives (if necessary) */ + /* We do not compute derivatives, if these strings are alreasy set by an */ + /* unur_distr_cont_set_pdfstr() or unur_distr_cont_set_logpdfstr() call. */ + /* We also do not return an error code if computation of derivatives */ + /* did not work. */ + if (DISTR.pdftree == NULL) + if ( (DISTR.pdftree = _unur_fstr_make_derivative(DISTR.cdftree)) != NULL ) + DISTR.pdf = _unur_distr_cont_eval_pdf_tree; + if (DISTR.dpdftree == NULL) + if ( (DISTR.dpdftree = _unur_fstr_make_derivative(DISTR.pdftree)) != NULL ) + DISTR.dpdf = _unur_distr_cont_eval_dpdf_tree; + + return UNUR_SUCCESS; +} /* end of unur_distr_cont_set_cdfstr() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_set_logcdfstr( struct unur_distr *distr, const char *logcdfstr ) + /*----------------------------------------------------------------------*/ + /* set logCDF and its derivative of distribution via a string interface */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* logcdfstr ... string that describes function term of logCDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + _unur_check_NULL( NULL, logcdfstr, UNUR_ERR_NULL ); + + /* we do not allow overwriting a CDF */ + if (DISTR.cdf != NULL || DISTR.logcdf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of logCDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* for derived distributions (e.g. order statistics) not possible */ + if (distr->base) return UNUR_ERR_DISTR_INVALID; + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + /* parse logCDF string */ + if ( (DISTR.logcdftree = _unur_fstr2tree(logcdfstr)) == NULL ) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Syntax error in function string"); + return UNUR_ERR_DISTR_SET; + } + DISTR.logcdf = _unur_distr_cont_eval_logcdf_tree; + DISTR.cdf = _unur_distr_cont_eval_cdf_from_logcdf; + + /* [ we do not make derivatives ] */ + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_cont_set_logcdfstr() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_set_hrstr( struct unur_distr *distr, const char *hrstr ) + /*----------------------------------------------------------------------*/ + /* set HR of distribution via a string interface */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* hrstr ... string that describes function term of CDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + _unur_check_NULL( NULL, hrstr, UNUR_ERR_NULL ); + + /* we do not allow overwriting a CDF */ + if (DISTR.hr != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of CDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* for derived distributions (e.g. order statistics) not possible */ + if (distr->base) return UNUR_ERR_DISTR_INVALID; + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + /* parse string */ + if ( (DISTR.hrtree = _unur_fstr2tree(hrstr)) == NULL ) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Syntax error in function string"); + return UNUR_ERR_DISTR_SET; + } + + /* set evaluation function */ + DISTR.hr = _unur_distr_cont_eval_hr_tree; + + return UNUR_SUCCESS; +} /* end of unur_distr_cont_set_hrstr() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_distr_cont_eval_pdf_tree( double x, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate function tree for PDF. */ + /* */ + /* parameters: */ + /* x ... argument for PDF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* PDF at x */ + /*----------------------------------------------------------------------*/ +{ + return ((DISTR.pdftree) ? _unur_fstr_eval_tree(DISTR.pdftree,x) : UNUR_INFINITY); +} /* end of _unur_distr_cont_eval_pdf_tree() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_distr_cont_eval_logpdf_tree( double x, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate function tree for logPDF. */ + /* */ + /* parameters: */ + /* x ... argument for logPDF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* logPDF at x */ + /*----------------------------------------------------------------------*/ +{ + return ((DISTR.logpdftree) ? _unur_fstr_eval_tree(DISTR.logpdftree,x) : UNUR_INFINITY); +} /* end of _unur_distr_cont_eval_logpdf_tree() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_distr_cont_eval_dpdf_tree( double x, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate function tree for derivative of PDF. */ + /* */ + /* parameters: */ + /* x ... argument for derivative of PDF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* derivative of PDF at x */ + /*----------------------------------------------------------------------*/ +{ + return ((DISTR.dpdftree) ? _unur_fstr_eval_tree(DISTR.dpdftree,x) : UNUR_INFINITY); +} /* end of _unur_distr_cont_eval_dpdf_tree() */ + +/*---------------------------------------------------------------------------*/ + + +double +_unur_distr_cont_eval_dlogpdf_tree( double x, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate function tree for derivative of logPDF. */ + /* */ + /* parameters: */ + /* x ... argument for derivative of logPDF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* derivative of logPDF at x */ + /*----------------------------------------------------------------------*/ +{ + return ((DISTR.dlogpdftree) ? _unur_fstr_eval_tree(DISTR.dlogpdftree,x) : UNUR_INFINITY); +} /* end of _unur_distr_cont_eval_dpdf_tree() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_distr_cont_eval_cdf_tree( double x, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate function tree for CDF. */ + /* */ + /* parameters: */ + /* x ... argument for CDF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* CDF at x */ + /*----------------------------------------------------------------------*/ +{ + return ((DISTR.cdftree) ? _unur_fstr_eval_tree(DISTR.cdftree,x) : UNUR_INFINITY); +} /* end of _unur_distr_cont_eval_cdf_tree() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_distr_cont_eval_logcdf_tree( double x, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate function tree for logCDF. */ + /* */ + /* parameters: */ + /* x ... argument for logCDF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* logCDF at x */ + /*----------------------------------------------------------------------*/ +{ + return ((DISTR.logcdftree) ? _unur_fstr_eval_tree(DISTR.logcdftree,x) : UNUR_INFINITY); +} /* end of _unur_distr_cont_eval_logcdf_tree() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_distr_cont_eval_hr_tree( double x, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate function tree for HR. */ + /* */ + /* parameters: */ + /* x ... argument for CDF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* CDF at x */ + /*----------------------------------------------------------------------*/ +{ + return ((DISTR.hrtree) ? _unur_fstr_eval_tree(DISTR.hrtree,x) : UNUR_INFINITY); +} /* end of _unur_distr_cont_eval_hr_tree() */ + +/*---------------------------------------------------------------------------*/ + +char * +unur_distr_cont_get_pdfstr( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get PDF string that is given via the string interface */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to resulting string. */ + /* */ + /* comment: */ + /* This string should be freed when it is not used any more. */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CONT, NULL ); + _unur_check_NULL( NULL, DISTR.pdftree, NULL ); + + /* make and return string */ + return _unur_fstr_tree2string(DISTR.pdftree,"x","PDF",TRUE); +} /* end of unur_distr_cont_get_pdfstr() */ + +/*---------------------------------------------------------------------------*/ + +char * +unur_distr_cont_get_dpdfstr( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get string for derivative of PDF that is given via string interface */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to resulting string. */ + /* */ + /* comment: */ + /* This string should be freed when it is not used any more. */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CONT, NULL ); + _unur_check_NULL( NULL, DISTR.dpdftree, NULL ); + + /* make and return string */ + return _unur_fstr_tree2string(DISTR.dpdftree,"x","dPDF",TRUE); +} /* end of unur_distr_cont_get_dpdfstr() */ + +/*---------------------------------------------------------------------------*/ + +char * +unur_distr_cont_get_logpdfstr( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get logPDF string that is given via the string interface */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to resulting string. */ + /* */ + /* comment: */ + /* This string should be freed when it is not used any more. */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CONT, NULL ); + _unur_check_NULL( NULL, DISTR.logpdftree, NULL ); + + /* make and return string */ + return _unur_fstr_tree2string(DISTR.logpdftree,"x","logPDF",TRUE); +} /* end of unur_distr_cont_get_logpdfstr() */ + +/*---------------------------------------------------------------------------*/ + +char * +unur_distr_cont_get_dlogpdfstr( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get string for derivative of logPDF that is given via string API */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to resulting string. */ + /* */ + /* comment: */ + /* This string should be freed when it is not used any more. */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CONT, NULL ); + _unur_check_NULL( NULL, DISTR.dlogpdftree, NULL ); + + /* make and return string */ + return _unur_fstr_tree2string(DISTR.dlogpdftree,"x","dlogPDF",TRUE); +} /* end of unur_distr_cont_get_dlogpdfstr() */ + +/*---------------------------------------------------------------------------*/ + +char * +unur_distr_cont_get_cdfstr( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get CDF string that is given via the string interface */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to resulting string. */ + /* */ + /* comment: */ + /* This string should be freed when it is not used any more. */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CONT, NULL ); + _unur_check_NULL( NULL, DISTR.cdftree, NULL ); + + /* make and return string */ + return _unur_fstr_tree2string(DISTR.cdftree,"x","CDF",TRUE); +} /* end of unur_distr_cont_get_cdfstr() */ + +/*---------------------------------------------------------------------------*/ + +char * +unur_distr_cont_get_logcdfstr( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get logCDF string that is given via the string interface */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to resulting string. */ + /* */ + /* comment: */ + /* This string should be freed when it is not used any more. */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CONT, NULL ); + _unur_check_NULL( NULL, DISTR.logcdftree, NULL ); + + /* make and return string */ + return _unur_fstr_tree2string(DISTR.logcdftree,"x","logCDF",TRUE); +} /* end of unur_distr_cont_get_logcdfstr() */ + +/*---------------------------------------------------------------------------*/ + +char * +unur_distr_cont_get_hrstr( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get HR string that is given via the string interface */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to resulting string. */ + /* */ + /* comment: */ + /* This string should be freed when it is not used any more. */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CONT, NULL ); + _unur_check_NULL( NULL, DISTR.hrtree, NULL ); + + /* make and return string */ + return _unur_fstr_tree2string(DISTR.hrtree,"x","HR",TRUE); +} /* end of unur_distr_cont_get_hrstr() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_FUNCT_CONT * +unur_distr_cont_get_pdf( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get pointer to PDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to PDF */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CONT, NULL ); + + return DISTR.pdf; +} /* end of unur_distr_cont_get_pdf() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_FUNCT_CONT * +unur_distr_cont_get_dpdf( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get pointer to derivative of PDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to derivative of PDF */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CONT, NULL ); + + return DISTR.dpdf; +} /* end of unur_distr_cont_get_dpdf() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_FUNCT_CONT * +unur_distr_cont_get_logpdf( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get pointer to logPDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to logPDF */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CONT, NULL ); + + return DISTR.logpdf; +} /* end of unur_distr_cont_get_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_FUNCT_CONT * +unur_distr_cont_get_dlogpdf( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get pointer to derivative of logPDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to derivative of logPDF */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CONT, NULL ); + + return DISTR.dlogpdf; +} /* end of unur_distr_cont_get_dlogpdf() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_FUNCT_CONT * +unur_distr_cont_get_cdf( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get pointer to CDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to CDF */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CONT, NULL ); + + return DISTR.cdf; +} /* end of unur_distr_cont_get_cdf() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_FUNCT_CONT * +unur_distr_cont_get_invcdf( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get pointer to inverse CDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to inverse CDF */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CONT, NULL ); + + return DISTR.invcdf; +} /* end of unur_distr_cont_get_invcdf() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_FUNCT_CONT * +unur_distr_cont_get_logcdf( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get pointer to logCDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to logCDF */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CONT, NULL ); + + return DISTR.logcdf; +} /* end of unur_distr_cont_get_logcdf() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_FUNCT_CONT * +unur_distr_cont_get_hr( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get pointer to HR of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to HR */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CONT, NULL ); + + return DISTR.hr; +} /* end of unur_distr_cont_get_hr() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_cont_eval_pdf( double x, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate PDF of distribution at x */ + /* */ + /* parameters: */ + /* x ... argument for pdf */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pdf(x) */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); + + if (DISTR.pdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + } + + return _unur_cont_PDF(x,distr); +} /* end of unur_distr_cont_eval_pdf() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_cont_eval_dpdf( double x, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate derivative of PDF of distribution at x */ + /* */ + /* parameters: */ + /* x ... argument for dpdf */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* (pdf(x))' */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); + + if (DISTR.dpdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + } + + return _unur_cont_dPDF(x,distr); +} /* end of unur_distr_cont_eval_dpdf() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_cont_eval_logpdf( double x, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate logPDF of distribution at x */ + /* */ + /* parameters: */ + /* x ... argument for logPDF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* logPDF(x) */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); + + if (DISTR.logpdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + } + + return _unur_cont_logPDF(x,distr); +} /* end of unur_distr_cont_eval_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_cont_eval_dlogpdf( double x, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate derivative of logPDF of distribution at x */ + /* */ + /* parameters: */ + /* x ... argument for dlogPDF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* (pdf(x))' */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); + + if (DISTR.dlogpdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + } + + return _unur_cont_dlogPDF(x,distr); +} /* end of unur_distr_cont_eval_dlogpdf() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_cont_eval_cdf( double x, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate CDF of distribution at x */ + /* */ + /* parameters: */ + /* x ... argument for CDF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* cdf(x) */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); + + if (DISTR.cdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + } + + return _unur_cont_CDF(x,distr); +} /* end of unur_distr_cont_eval_cdf() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_cont_eval_invcdf( double u, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate inverse CDF of distribution at u */ + /* */ + /* parameters: */ + /* u ... argument for inverse CDF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* invcdf(u) */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); + + if (DISTR.invcdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + } + + if (u<=0.) + return DISTR.domain[0]; + if (u>=1.) + return DISTR.domain[1]; + else + return _unur_cont_invCDF(u,distr); + +} /* end of unur_distr_cont_eval_invcdf() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_cont_eval_logcdf( double x, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate logCDF of distribution at x */ + /* */ + /* parameters: */ + /* x ... argument for logCDF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* logCDF(x) */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); + + if (DISTR.logcdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + } + + return _unur_cont_logCDF(x,distr); +} /* end of unur_distr_cont_eval_logcdf() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_cont_eval_hr( double x, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate HR of distribution at x */ + /* */ + /* parameters: */ + /* x ... argument for cdf */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* hr(x) */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); + + if (DISTR.hr == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + } + + return _unur_cont_HR(x,distr); +} /* end of unur_distr_cont_eval_hr() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_set_pdfparams( struct unur_distr *distr, const double *params, int n_params ) + /*----------------------------------------------------------------------*/ + /* set array of parameters for distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* params ... list of arguments */ + /* n_params ... number of arguments */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + if (n_params>0) _unur_check_NULL(distr->name,params,UNUR_ERR_NULL); + + /* first check number of new parameter for the distribution */ + if (n_params < 0 || n_params > UNUR_DISTR_MAXPARAMS ) { + _unur_error(NULL,UNUR_ERR_DISTR_NPARAMS,""); + return UNUR_ERR_DISTR_NPARAMS; + } + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + /* even if the set routine fails, the derived parameters are + marked as unknown. but this is o.k. since in this case something + has been wrong. */ + + /* use special routine for setting parameters + (if there is one) */ + + if (distr->base && BASE.set_params) + return (BASE.set_params(distr->base,params,n_params)); + + if (DISTR.set_params) + return (DISTR.set_params(distr,params,n_params)); + + /* otherwise simply copy parameters */ + + if (distr->base) { + BASE.n_params = n_params; + if (n_params) memcpy( BASE.params, params, n_params*sizeof(double) ); + } + + else { + DISTR.n_params = n_params; + if (n_params) memcpy( DISTR.params, params, n_params*sizeof(double) ); + } + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_cont_set_pdfparams() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_get_pdfparams( const struct unur_distr *distr, const double **params ) + /*----------------------------------------------------------------------*/ + /* get number of pdf parameters and sets pointer to array params[] of */ + /* parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* params ... pointer to list of arguments */ + /* */ + /* return: */ + /* number of pdf parameters */ + /* */ + /* error: */ + /* return 0 */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, 0 ); + _unur_check_distr_object( distr, CONT, 0 ); + + if (distr->base) { + /* for derived distributions (e.g. order statistics) + the parameters for the underlying distributions are returned */ + *params = (BASE.n_params) ? BASE.params : NULL; + return BASE.n_params; + } + else { + *params = (DISTR.n_params) ? DISTR.params : NULL; + return DISTR.n_params; + } + +} /* end of unur_distr_cont_get_pdfparams() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_set_pdfparams_vec( struct unur_distr *distr, int par, const double *param_vec, int n_param_vec ) + /*----------------------------------------------------------------------*/ + /* set vector array parameters for distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* par ... which parameter is set */ + /* param_vec ... parameter array with number `par' */ + /* n_param_vec ... length of parameter array */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + + /* check new parameter for distribution */ + if (par < 0 || par >= UNUR_DISTR_MAXPARAMS ) { + _unur_error(NULL,UNUR_ERR_DISTR_NPARAMS,"invalid parameter position"); + return UNUR_ERR_DISTR_NPARAMS; + } + + if (param_vec != NULL) { + /* allocate memory */ + DISTR.param_vecs[par] = _unur_xrealloc( DISTR.param_vecs[par], n_param_vec * sizeof(double) ); + /* copy parameters */ + memcpy( DISTR.param_vecs[par], param_vec, n_param_vec*sizeof(double) ); + /* set length of array */ + DISTR.n_param_vec[par] = n_param_vec; + } + else { + if (DISTR.param_vecs[par]) free(DISTR.param_vecs[par]); + DISTR.param_vecs[par] = NULL; + DISTR.n_param_vec[par] = 0; + } + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_cont_set_pdfparams_vec() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_get_pdfparams_vec( const struct unur_distr *distr, int par, const double **param_vecs ) + /*----------------------------------------------------------------------*/ + /* get number of PDF parameters and sets pointer to array params[] of */ + /* parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* par ... which parameter is read */ + /* params ... pointer to parameter array with number `par' */ + /* */ + /* return: */ + /* length of parameter array with number `par' */ + /* */ + /* error: */ + /* return 0 */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, 0 ); + _unur_check_distr_object( distr, CONT, 0 ); + + /* check new parameter for distribution */ + if (par < 0 || par >= UNUR_DISTR_MAXPARAMS ) { + _unur_error(NULL,UNUR_ERR_DISTR_NPARAMS,"invalid parameter position"); + *param_vecs = NULL; + return 0; + } + + *param_vecs = DISTR.param_vecs[par]; + + return (*param_vecs) ? DISTR.n_param_vec[par] : 0; +} /* end of unur_distr_cont_get_pdfparams_vec() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_set_domain( struct unur_distr *distr, double left, double right ) + /*----------------------------------------------------------------------*/ + /* set the left and right borders of the domain of the distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* the new boundary points may be +/- UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + int unsigned is_set = 0u; + + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + + /* check new parameter for distribution */ + if (left >= right) { + _unur_error(NULL,UNUR_ERR_DISTR_SET,"domain, left >= right"); + return UNUR_ERR_DISTR_SET; + } + +#if defined(R_UNURAN) + /* in Runuran we always set the domain, even if we just use the defaults */ + if (_unur_FP_same(left, DISTR.domain[0]) && + _unur_FP_same(right, DISTR.domain[1])) { + /* nothing to do */ + distr->set |= UNUR_DISTR_SET_DOMAIN; + return UNUR_SUCCESS; + } +#endif + + /* we have to deal with the mode */ + if ( distr->set & UNUR_DISTR_SET_MODE ) { + is_set |= UNUR_DISTR_SET_MODE; + /* mode has been set and new domain might be subset of old domain */ + /* we assume the density is unimodal and thus monotone on + either side of the mode!! */ + if ( DISTR.mode < left) DISTR.mode = left; + else if ( DISTR.mode > right) DISTR.mode = right; + } + + /* we have to deal with the mode */ + if ( distr->set & UNUR_DISTR_SET_CENTER ) { + is_set |= UNUR_DISTR_SET_CENTER; + if ( DISTR.center < left) DISTR.center = left; + else if ( DISTR.center > right) DISTR.center = right; + } + + /* store data */ + DISTR.trunc[0] = DISTR.domain[0] = left; + DISTR.trunc[1] = DISTR.domain[1] = right; + + /* changelog */ + distr->set |= UNUR_DISTR_SET_DOMAIN; + + /* if distr is an object for a standard distribution, this */ + /* is not the original domain of it. (not a "standard domain") */ + /* However, since we have changed the domain, we assume */ + /* that this is not a truncated distribution. */ + /* At last we have to mark all derived parameters as unknown. */ + distr->set &= ~(UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_TRUNCATED | + UNUR_DISTR_SET_MASK_DERIVED ); + distr->set |= is_set; + + if (distr->base) { + /* for derived distributions (e.g. order statistics) + we also set the domain for the underlying distribution */ + BASE.trunc[0] = BASE.domain[0] = left; + BASE.trunc[1] = BASE.domain[1] = right; + distr->base->set &= ~(UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_TRUNCATED | + UNUR_DISTR_SET_MASK_DERIVED ); + } + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_distr_cont_set_domain() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_get_domain( const struct unur_distr *distr, double *left, double *right ) + /*----------------------------------------------------------------------*/ + /* set the left and right borders of the domain of the distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* if no boundaries have been set +/- UNUR_INFINITY is returned. */ + /*----------------------------------------------------------------------*/ +{ + /* in case of error the boundaries are set to +/- UNUR_INFINITY */ + *left = -UNUR_INFINITY; + *right = UNUR_INFINITY; + + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + + /* o.k. */ + *left = DISTR.domain[0]; + *right = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of unur_distr_cont_get_domain() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_get_truncated( const struct unur_distr *distr, double *left, double *right ) + /*----------------------------------------------------------------------*/ + /* set the left and right borders of the truncated domain of the */ + /* distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* if no boundaries have been set +/- UNUR_INFINITY is returned. */ + /*----------------------------------------------------------------------*/ +{ + /* in case of error the boundaries are set to +/- UNUR_INFINITY */ + *left = -UNUR_INFINITY; + *right = UNUR_INFINITY; + + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + + /* o.k. */ + *left = (distr->set & UNUR_DISTR_SET_TRUNCATED) ? DISTR.trunc[0] : DISTR.domain[0]; + *right = (distr->set & UNUR_DISTR_SET_TRUNCATED) ? DISTR.trunc[1] : DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of unur_distr_cont_get_truncated() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_set_mode( struct unur_distr *distr, double mode ) + /*----------------------------------------------------------------------*/ + /* set mode of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* mode ... mode of p.d.f. */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + + /* check whether mode is inside the domain */ + if (mode < DISTR.domain[0] || mode > DISTR.domain[1]) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"mode not in domain"); + return UNUR_ERR_DISTR_SET; + } + + /* store data */ + DISTR.mode = mode; + + /* changelog */ + distr->set |= UNUR_DISTR_SET_MODE; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_cont_set_mode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_upd_mode( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* (re-) compute mode of distribution (if possible) */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + + if (DISTR.upd_mode == NULL) { + /* no function to compute mode available */ + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_ERR_DISTR_DATA; + } + + /* compute mode */ + if ((DISTR.upd_mode)(distr)==UNUR_SUCCESS) { + /* changelog */ + distr->set |= UNUR_DISTR_SET_MODE; + return UNUR_SUCCESS; + } + else { + /* computing of mode failed */ + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_ERR_DISTR_DATA; + } + +} /* end of unur_distr_cont_upd_mode() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_cont_get_mode( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get mode of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* mode of distribution */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); + + /* mode known ? */ + if ( !(distr->set & UNUR_DISTR_SET_MODE) ) { + /* try to compute mode */ + if (DISTR.upd_mode == NULL) { + /* no function to compute mode available */ + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"mode"); + return UNUR_INFINITY; + } + else { + /* compute mode */ + if (unur_distr_cont_upd_mode(distr)!=UNUR_SUCCESS) { + /* finding mode not successfully */ + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"mode"); + return UNUR_INFINITY; + } + } + } + + return DISTR.mode; + +} /* end of unur_distr_cont_get_mode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_set_center( struct unur_distr *distr, double center ) + /*----------------------------------------------------------------------*/ + /* set center of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* center ... center of PDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + + DISTR.center = center; + + /* changelog */ + distr->set |= UNUR_DISTR_SET_CENTER; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_cont_set_center() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_cont_get_center( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get center of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* center of distribution */ + /*----------------------------------------------------------------------*/ +{ + double center; + + /* check arguments */ + _unur_check_NULL( NULL, distr, 0. ); + _unur_check_distr_object( distr, CONT, 0. ); + + /* center given */ + if ( distr->set & UNUR_DISTR_SET_CENTER ) + center = DISTR.center; + + /* else try mode */ + else if ( distr->set & UNUR_DISTR_SET_MODE ) + center = DISTR.mode; + + /* else unknown: use default */ + else + center = 0.; + + /* return result 0 */ + return center; + +} /* end of unur_distr_cont_get_center() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_set_pdfarea( struct unur_distr *distr, double area ) + /*----------------------------------------------------------------------*/ + /* set area below p.d.f. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* area ... area below p.d.f. */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + + /* check new parameter for distribution */ + if (area <= 0.) { + _unur_error(NULL,UNUR_ERR_DISTR_SET,"pdf area <= 0"); + return UNUR_ERR_DISTR_SET; + } + + DISTR.area = area; + + /* changelog */ + distr->set |= UNUR_DISTR_SET_PDFAREA; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_distr_cont_set_pdfarea() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cont_upd_pdfarea( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* (re-) compute area below p.d.f. of distribution (if possible) */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + return _unur_distr_cont_upd_pdfarea(distr, FALSE); +} /* end of unur_distr_cont_upd_pdfarea() */ + +/*...........................................................................*/ + +int +_unur_distr_cont_upd_pdfarea( struct unur_distr *distr, int silent_check_updfunc ) + /*----------------------------------------------------------------------*/ + /* (re-) compute area below p.d.f. of distribution (if possible) */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* silent_check_updfunc ... whether a error message is shown */ + /* when the update does not exist */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(distr, UNUR_ERR_NULL); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + + if (DISTR.upd_area == NULL) { + /* no function to compute mode available */ + if (! silent_check_updfunc) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + } + return UNUR_ERR_DISTR_DATA; + } + + /* compute area */ + if (((DISTR.upd_area)(distr)!=UNUR_SUCCESS) || DISTR.area <= 0.) { + /* computing of area failed */ + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"upd area <= 0"); + DISTR.area = 1.; /* avoid possible floating point exceptions */ + distr->set &= ~UNUR_DISTR_SET_PDFAREA; + return UNUR_ERR_DISTR_SET; + } + + /* changelog */ + distr->set |= UNUR_DISTR_SET_PDFAREA; + + return UNUR_SUCCESS; +} /* end of _unur_distr_cont_upd_pdfarea() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_cont_get_pdfarea( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get area below p.d.f. of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* area below p.d.f. of distribution */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); + + /* area known ? */ + if ( !(distr->set & UNUR_DISTR_SET_PDFAREA) ) { + /* try to compute area */ + if ( unur_distr_cont_upd_pdfarea(distr) != UNUR_SUCCESS ) { + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"area"); + return UNUR_INFINITY; + } + } + + return DISTR.area; + +} /* end of unur_distr_cont_get_pdfarea() */ + +/*****************************************************************************/ + +double +_unur_aux_pdf(double x, void *p) + /*----------------------------------------------------------------------*/ + /* Auxiliary function used in the computation of the mode */ + /*----------------------------------------------------------------------*/ +{ + struct unur_distr *distr = p; + return (DISTR.pdf(x, distr)); +} + +/*---------------------------------------------------------------------------*/ + +int +_unur_distr_cont_find_mode( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ +{ + struct unur_funct_generic pdf; /* density function to be maximized */ + double mode; + + /* check arguments */ + CHECK_NULL( distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); + if (DISTR.pdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"PDF required for finding mode numerically"); + return UNUR_ERR_DISTR_DATA; + } + + /* set parameters of pdf */ + pdf.f = _unur_aux_pdf; + pdf.params = distr; + + /* compute mode; use DISTR.center as first guess */ + mode = _unur_util_find_max( pdf, DISTR.domain[0], DISTR.domain[1], DISTR.center ); + + /* check result */ + if (_unur_isfinite(mode)){ + /* mode successfully computed */ + DISTR.mode = mode; + /* changelog */ + distr->set |= UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_MODE_APPROX ; + /* o.k. */ + return UNUR_SUCCESS; + } + + else { + /* computing mode did not work */ + /* (we do not change mode entry in distribution object) */ + return UNUR_ERR_DISTR_DATA; + } + +} /* end of _unur_distr_cont_find_mode() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_distr_cont_find_center( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* search for an appropriate point for center. */ + /* if such a point is found, then it is stored in 'distr'. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ +#define PDF(x) _unur_cont_PDF((x),(distr)) /* call to PDF */ +#define logPDF(x) _unur_cont_logPDF((x),(distr)) /* call to logPDF */ + + double center, fc; /* given center and PDF at center */ + double x, fx; /* auxiliary point and PDF at point */ + int i,d; + + /* given center of distribution */ + center = DISTR.center; + fc = (DISTR.logpdf!=NULL) ? exp(logPDF(center)) : PDF(center); + + /* check given center */ + if (fc>0. && _unur_isfinite(fc)) return UNUR_SUCCESS; + + /* search */ + for (d=0; d<2; d++) { + /* left and right boundary of truncated domain, resp. */ + x = DISTR.trunc[d]; + + /* Do x and the given center differ? */ + if (_unur_FP_equal(center,x)) + continue; + + /* search from boundary towards given center */ + for (i=0; i<50; i++) { + x = _unur_arcmean(x,center); + fx = (DISTR.logpdf!=NULL) ? exp(logPDF(x)) : PDF(x); + + if (fx>0. && _unur_isfinite(fx)) { + /* successfull */ + DISTR.center = x; + /* changelog */ + distr->set |= UNUR_DISTR_SET_CENTER | UNUR_DISTR_SET_CENTER_APPROX ; + /* o.k. */ + return UNUR_SUCCESS; + } + } + } + + /* could not find appropriate point */ + return UNUR_FAILURE; + +#undef PDF +#undef logPDF +} /* end of _unur_distr_cont_find_center() */ + + +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_distr_cont_debug( const struct unur_distr *distr, const char *genid ) + /*----------------------------------------------------------------------*/ + /* write info about distribution into LOG file */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* genid ... pointer to generator id */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int i; + + /* check arguments */ + CHECK_NULL(distr,RETURN_VOID); + COOKIE_CHECK(distr,CK_DISTR_CONT,RETURN_VOID); + + LOG = unur_get_stream(); + + /* is this a derived distribution */ + if (distr->base) { + switch (distr->id) { + case UNUR_DISTR_CORDER: + _unur_distr_corder_debug(distr,genid); + return; + case UNUR_DISTR_CXTRANS: + _unur_distr_cxtrans_debug(distr,genid); + return; + case UNUR_DISTR_CONDI: + _unur_distr_condi_debug(distr,genid); + return; + default: + /* nothing to do */ + fprintf(LOG,"%s: derived distribution.\n",genid); + fprintf(LOG,"%s:\n",genid); + } + } + + fprintf(LOG,"%s: distribution:\n",genid); + fprintf(LOG,"%s:\ttype = continuous univariate distribution\n",genid); + fprintf(LOG,"%s:\tname = %s\n",genid,distr->name); + + fprintf(LOG,"%s:\tPDF with %d argument(s)\n",genid,DISTR.n_params); + for( i=0; iset & UNUR_DISTR_SET_MODE) + fprintf(LOG,"%s:\tmode = %g\n",genid,DISTR.mode); + else + fprintf(LOG,"%s:\tmode unknown\n",genid); + + fprintf(LOG,"%s:\tcenter = ",genid); + if (distr->set & UNUR_DISTR_SET_CENTER) + fprintf(LOG,"%g%s\n", DISTR.center, + (distr->set & UNUR_DISTR_SET_CENTER_APPROX) ? " [guess]" : ""); + else + fprintf(LOG,"%g [default]\n", unur_distr_cont_get_center(distr)); + + fprintf(LOG,"%s:\tdomain = (%g, %g)",genid,DISTR.domain[0],DISTR.domain[1]); + _unur_print_if_default(distr,UNUR_DISTR_SET_DOMAIN); + + fprintf(LOG,"\n%s:\tarea below p.d.f. = %g",genid,DISTR.area); + _unur_print_if_default(distr,UNUR_DISTR_SET_PDFAREA); + fprintf(LOG,"\n%s:\n",genid); + +} /* end of _unur_distr_cont_debug() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distr/cont.h b/vendor/unuran-1.11.0/src/distr/cont.h new file mode 100644 index 0000000..ddc75de --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/cont.h @@ -0,0 +1,603 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: cont.h * + * * + * PURPOSE: * + * function prototypes for manipulating distribution objects of * + * type CONT (continuous univariate distribution) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/* + =NODEX CONT Continuous univariate distributions + + =UP Distribution_objects [10] + + =DESCRIPTION + The calls in this section can be applied to continuous + univariate distributions. + + @itemize @minus + @item Create a @command{new} instance of a continuous univariate + distribution. + + @item Handle and evaluate + distribution function (CDF, @command{cdf}), + probability density function (PDF, @command{pdf}) and the + derivative of the density function (@command{dpdf}). + The following is important: + @itemize . + @item @command{pdf} need not be normalized, i.e., + any integrable nonnegative function can be used. + @item @command{dpdf} must the derivate of the function provided + as @command{pdf}. + @item @command{cdf} must be a distribution function, i.e. it + must be monotonically increasing with range [0,1]. + @item If @command{cdf} and @command{pdf} are used together for a + pariticular generation method, then @command{pdf} must be the + derivate of the @command{cdf}, i.e., it must be normalized. + @end itemize + + @item Handle and evaluate + the logarithm of the probability density function (logPDF, + @command{logpdf}) and the derivative of the logarithm of the + density function (@command{dlogpdf}). + + Some methods use the logarithm of the density if available. + + @item Set (and change) parameters (@command{pdfparams}) and the + area below the graph (@command{pdfarea}) of the given density. + + @item Set the @command{mode} (or pole) of the distribution. + + @item Set the @command{center} of the distribution. + It is used by some generation methods to adjust the parameters + of the generation algorithms to gain better performance. It can + be seens as the location of the ``central part'' of the + distribution. + + @item Some generation methods require the hazard rate + (@command{hr}) of the distribution instead of its @command{pdf}. + + @item Alternatively, @command{cdf}, @command{pdf}, @command{dpdf}, + and @command{hr} can be provided as @command{str}ings instead of + function pointers. + + @item Set the @command{domain} of the distribution. Notice that + the library also can handle truncated distributions, i.e., + distributions that are derived from (standard) distributions by + simply restricting its domain to a subset. However, there is a + subtle difference between changing the domain of a distribution + object by a unur_distr_cont_set_domain() call and changing the + (truncated) domain for an existing generator object. The domain + of the distribution object is used to create the generator + object with hats, squeezes, tables, etc. Whereas truncating the + domain of an existing generator object need not necessarily + require a recomputation of these data. Thus by a + @command{unur__chg_truncated} call (if available) the + sampling region is restricted to the subset of the domain of the + given distribution object. However, generation methods that + require a recreation of the generator object when the domain is + changed have a @command{unur__chg_domain} call instead. + For these calls there are of course no restrictions on the given + domain (i.e., it is possible to increase the domain of the + distribution) (@pxref{Methods}, for details). + + @end itemize + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* + Routines for handling univariate continuous distributions (CONT). +*/ + +/* =ROUTINES */ + +UNUR_DISTR *unur_distr_cont_new( void ); +/* + Create a new (empty) object for univariate continuous distribution. +*/ + +/* ==DOC + @subsubheading Essential parameters +*/ + +int unur_distr_cont_set_pdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *pdf ); +/* */ + +int unur_distr_cont_set_dpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *dpdf ); +/* */ + +int unur_distr_cont_set_cdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *cdf ); +/* */ + +int unur_distr_cont_set_invcdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *invcdf ); +/* + Set respective pointer to the probability density function (PDF), + the derivative of the probability density function (dPDF), the + cumulative distribution function (CDF), and the inverse CDF of the + @var{distribution}. + Each of these function pointers must be of type + @code{double funct(double x, const UNUR_DISTR *distr)}. + + Due to the fact that some of the methods do not require a + normalized PDF the following is important: + + @itemize @minus + @item + The given CDF must be the cumulative distribution function of + the (non-truncated) distribution. If a distribution from the + UNU.RAN library of standard distributions + (@pxref{Stddist,,Standard distributions}) + is truncated, there is no need to change the CDF. + + @item + If both the CDF and the PDF are used (for a method or for order + statistics), the PDF must be the derivative of the CDF. + If a truncated distribution for one of the standard distributions + from the UNU.RAN library of standard distributions is used, + there is no need to change the PDF. + + @item + If the area below the PDF is required for a given distribution + it must be given by the unur_distr_cont_set_pdfarea() call. + For a truncated distribution this must be of course the integral of + the PDF in the given truncated domain. + For distributions from the UNU.RAN library of standard + distributions this is done automatically by the + unur_distr_cont_upd_pdfarea() call. + + @end itemize + + It is important to note that all these functions must return a + result for all values of @var{x}. Eg., if the domain of a given + PDF is the interval [-1,1], then the given function must return + @code{0.0} for all points outside this interval. + In case of an overflow the PDF should return + @code{UNUR_INFINITY}. + + It is not possible to change such a function. Once the PDF or + CDF is set it cannot be overwritten. This also holds when the + logPDF is given or when the PDF + is given by the unur_distr_cont_set_pdfstr() or + unur_distr_cont_set_logpdfstr() call. + A new distribution object has to be used instead. +*/ + + +UNUR_FUNCT_CONT *unur_distr_cont_get_pdf( const UNUR_DISTR *distribution ); +/* */ + +UNUR_FUNCT_CONT *unur_distr_cont_get_dpdf( const UNUR_DISTR *distribution ); +/* */ + +UNUR_FUNCT_CONT *unur_distr_cont_get_cdf( const UNUR_DISTR *distribution ); +/* */ + +UNUR_FUNCT_CONT *unur_distr_cont_get_invcdf( const UNUR_DISTR *distribution ); +/* + Get the respective pointer to the PDF, the derivative of the + PDF, the CDF, and the inverse CDF of the @var{distribution}. The + pointer is of type @code{double funct(double x, const UNUR_DISTR *distr)}. + If the corresponding function is not available for the distribution, + the NULL pointer is returned. +*/ + +double unur_distr_cont_eval_pdf( double x, const UNUR_DISTR *distribution ); +/* */ + +double unur_distr_cont_eval_dpdf( double x, const UNUR_DISTR *distribution ); +/* */ + +double unur_distr_cont_eval_cdf( double x, const UNUR_DISTR *distribution ); +/* */ + +double unur_distr_cont_eval_invcdf( double u, const UNUR_DISTR *distribution ); +/* + Evaluate the PDF, derivative of the PDF, the CDF, and the inverse + CDF at @var{x} and @var{u},respectively. + Notice that @var{distribution} must not be the NULL pointer. + If the corresponding function is not available for the distribution, + @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_DATA}. + + @emph{IMPORTANT:} + In the case of a truncated standard distribution these calls always + return the respective values of the @emph{untruncated} distribution! +*/ + +int unur_distr_cont_set_logpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *logpdf ); +/* */ + +int unur_distr_cont_set_dlogpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *dlogpdf ); +/* */ + +int unur_distr_cont_set_logcdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *logcdf ); +/* */ + +UNUR_FUNCT_CONT *unur_distr_cont_get_logpdf( const UNUR_DISTR *distribution ); +/* */ + +UNUR_FUNCT_CONT *unur_distr_cont_get_dlogpdf( const UNUR_DISTR *distribution ); +/* */ + +UNUR_FUNCT_CONT *unur_distr_cont_get_logcdf( const UNUR_DISTR *distribution ); +/* */ + +double unur_distr_cont_eval_logpdf( double x, const UNUR_DISTR *distribution ); +/* */ + +double unur_distr_cont_eval_dlogpdf( double x, const UNUR_DISTR *distribution ); +/* */ + +double unur_distr_cont_eval_logcdf( double x, const UNUR_DISTR *distribution ); +/* + Analogous calls for the logarithm of the density distribution functions. +*/ + + +int unur_distr_cont_set_pdfstr( UNUR_DISTR *distribution, const char *pdfstr ); +/* + This function provides an alternative way to set a PDF and its + derivative of the @var{distribution}. + @var{pdfstr} is a character string that contains the formula + for the PDF, see @ref{StringFunct,,Function String}, for details. + The derivative of the given PDF is computed automatically. + See also the remarks for the unur_distr_cont_set_pdf() call. + + It is not possible to call this funtion twice or to call this + function after a unur_distr_cont_set_pdf() call. +*/ + +int unur_distr_cont_set_cdfstr( UNUR_DISTR *distribution, const char *cdfstr ); +/* + This function provides an alternative way to set a CDF; analogously + to the unur_distr_cont_set_pdfstr() call. + The PDF and its derivative of the given CDF are computed automatically. +*/ + +char *unur_distr_cont_get_pdfstr( const UNUR_DISTR *distribution ); +/* */ + +char *unur_distr_cont_get_dpdfstr( const UNUR_DISTR *distribution ); +/* */ + +char *unur_distr_cont_get_cdfstr( const UNUR_DISTR *distribution ); +/* + Get pointer to respective string for PDF, derivate of PDF, and CDF + of @var{distribution} that is given as string (instead of a + function pointer). + This call allocates memory to produce this string. It should be + freed when it is not used any more. +*/ + +int unur_distr_cont_set_pdfparams( UNUR_DISTR *distribution, const double *params, int n_params ); +/* + Sets array of parameters for @var{distribution}. There is an upper limit + for the number of parameters @code{n_params}. It is given by the + macro @code{UNUR_DISTR_MAXPARAMS} in @file{unuran_config.h}. (It is set to + 5 by default but can be changed to any appropriate nonnegative number.) + If @var{n_params} is negative or exceeds this limit no parameters + are copied into the distribution object and @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_NPARAMS}. + + For standard distributions from the UNU.RAN library the parameters + are checked. Moreover, the domain is updated automatically unless it + has been changed before by a unur_distr_cont_set_domain() call. + If the given parameters are invalid for the standard distribution, + then no parameters are set and an error code is returned. + Notice, that the given parameter list for such a distribution is + handled in the same way as in the corresponding @command{new} + calls, i.e. optional parameters for the PDF that are not present in + the given list are (re-)set to their default values. + + @strong{Important:} If the parameters of a distribution from the + UNU.RAN library of standard distributions + (@pxref{Stddist,,Standard distributions}) + are changed, then neither its mode nor the normalization + constant are updated. Please use the respective calls + unur_distr_cont_upd_mode() and unur_distr_cont_upd_pdfarea(). + Moreover, if the domain has been changed by a + unur_distr_cont_set_domain() it is not automatically updated, either. + Updating the normalization constant is in particular very important, + when the CDF of the distribution is used. +*/ + +int unur_distr_cont_get_pdfparams( const UNUR_DISTR *distribution, const double **params ); +/* + Get number of parameters of the PDF and set pointer @var{params} to + array of parameters. If no parameters are stored in the object, an + error code is returned and @code{params} is set to NULL. + + @emph{Important:} Do @strong{not} change the entries in @var{params}! +*/ + +int unur_distr_cont_set_pdfparams_vec( UNUR_DISTR *distribution, int par, const double *param_vec, int n_param_vec ); +/* + This function provides an interface for additional vector parameters for a + continuous @var{distribution}. + + It sets the parameter with number @var{par}. + @var{par} indicates directly which of the parameters is set and + must be a number between @code{0} and @code{UNUR_DISTR_MAXPARAMS}-1 + (the upper limit of possible parameters defined in + @file{unuran_config.h}; it is set to 5 but can be changed to any + appropriate nonnegative number.) + + The entries of a this parameter are given by the array @var{param_vec} + of size @var{n_param_vec}. + + If @var{param_vec} is NULL then the corresponding entry is cleared. + + If an error occurs no parameters are copied into the parameter + object @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. +*/ + +int unur_distr_cont_get_pdfparams_vec( const UNUR_DISTR *distribution, int par, const double **param_vecs ); +/* + Get parameter of the PDF with number @var{par}. + The pointer to the parameter array is stored in @var{param_vecs}, its + size is returned by the function. + If the requested parameter is not set, then an error code is returned + and @code{params} is set to NULL. + + @emph{Important:} Do @strong{not} change the entries in @var{param_vecs}! +*/ + +int unur_distr_cont_set_logpdfstr( UNUR_DISTR *distribution, const char *logpdfstr ); +/* */ + +char *unur_distr_cont_get_logpdfstr( const UNUR_DISTR *distribution ); +/* */ + +char *unur_distr_cont_get_dlogpdfstr( const UNUR_DISTR *distribution ); +/* */ + +int unur_distr_cont_set_logcdfstr( UNUR_DISTR *distribution, const char *logcdfstr ); +/* */ + +char *unur_distr_cont_get_logcdfstr( const UNUR_DISTR *distribution ); +/* + Analogous calls for the logarithm of the density and distribution functions. +*/ + + +int unur_distr_cont_set_domain( UNUR_DISTR *distribution, double left, double right ); +/* + Set the left and right borders of the domain of the + distribution. This can also be used to truncate an existing + distribution. For setting the boundary to @unurmath{\pm\infty} + use @code{+/- UNUR_INFINITY}. + If @var{right} is not strictly greater than @var{left} no domain + is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. + + @emph{Important:} For some technical reasons it is assumed that the density + is unimodal and thus monotone on either side of the mode! This is used in + the case when the given mode is outside of the original domain. Then the + mode is set to the corresponding boundary of the new domain. + If this result is not the desired it must be changed by using a + unur_distr_cont_set_mode() call (or a unur_distr_cont_upd_mode() + call). The same holds for the center of the distribution. +*/ + +int unur_distr_cont_get_domain( const UNUR_DISTR *distribution, double *left, double *right ); +/* + Get the left and right borders of the domain of the + distribution. If the domain is not set @code{+/- UNUR_INFINITY} is + assumed and returned. No error is reported in this case. +*/ + +int unur_distr_cont_get_truncated( const UNUR_DISTR *distribution, double *left, double *right ); +/* + Get the left and right borders of the (truncated) domain of the + distribution. For non-truncated distribution this call is + equivalent to the unur_distr_cont_get_domain() call. + + This call is only useful in connection with a unur_get_distr() call + to get the boundaries of the sampling region of a generator object. +*/ + +int unur_distr_cont_set_hr( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *hazard ); +/* + Set pointer to the hazard rate (HR) of the @var{distribution}. + + The @emph{hazard rate} (or failure rate) is a mathematical way of + describing aging. If the lifetime @i{X} is a random variable with + density @i{f(x)} and CDF @i{F(x)} the hazard rate @i{h(x)} + is defined as @i{h(x) = f(x) / (1-F(x))}. + In other words, @i{h(x)} represents the (conditional) rate of + failure of a unit that has survived up to time @i{x} with + probability @i{1-F(x)}. + The key distribution is the exponential distribution as it has + constant hazard rate of value 1. Hazard rates tending to infinity + describe distributions with sub-exponential tails whereas + distributions with hazard rates tending to zero have heavier tails + than the exponential distribution. + + It is important to note that all these functions must return a + result for all floats @i{x}. In case of an overflow the PDF should + return @code{UNUR_INFINITY}. + + @strong{Important}: Do not simply use @i{f(x) / (1-F(x))}, since + this is numerically very unstable and results in numerical noise + if @i{F(x)} is (very) close to 1. Moreover, if the density @i{f(x)} + is known a generation method that uses the density is more + appropriate. + + It is not possible to change such a function. Once the HR is set it + cannot be overwritten. This also holds when the HR is given by the + unur_distr_cont_set_hrstr() call. A new distribution object has to + be used instead. +*/ + +UNUR_FUNCT_CONT *unur_distr_cont_get_hr( const UNUR_DISTR *distribution ); +/* + Get the pointer to the hazard rate of the @var{distribution}. The + pointer is of type + @code{double funct(double x, const UNUR_DISTR *distr)}. + If the corresponding function is not available for the distribution, + the NULL pointer is returned. +*/ + +double unur_distr_cont_eval_hr( double x, const UNUR_DISTR *distribution ); +/* + Evaluate the hazard rate at @var{x}. + Notice that @var{distribution} must not be the NULL pointer. + If the corresponding function is not available for the distribution, + @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_DATA}. +*/ + +int unur_distr_cont_set_hrstr( UNUR_DISTR *distribution, const char *hrstr ); +/* + This function provides an alternative way to set a hazard rate and its + derivative of the @var{distribution}. + @var{hrstr} is a character string that contains the formula + for the HR, see @ref{StringFunct,,Function String}, for details. + See also the remarks for the unur_distr_cont_set_hr() call. + + It is not possible to call this funtion twice or to call this + function after a unur_distr_cont_set_hr() call. +*/ + +char *unur_distr_cont_get_hrstr( const UNUR_DISTR *distribution ); +/* + Get pointer to string for HR of @var{distribution} that is given + via the string interface. This call allocates memory to produce + this string. It should be freed when it is not used any more. +*/ + + +/* ==DOC + @subsubheading Derived parameters + + The following paramters @strong{must} be set whenever one of the essential + parameters has been set or changed (and the parameter is required + for the chosen method). +*/ + +int unur_distr_cont_set_mode( UNUR_DISTR *distribution, double mode ); +/* + Set mode of @var{distribution}. The @var{mode} must be contained in + the domain of @var{distribution}. Otherwise the mode is not set and + @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. + For distributions with unbounded density, this call is used to set + the pole of the PDF. Notice that the PDF should then return + @code{UNUR_INFINITY} at the pole. + Notice that the mode is adjusted when the domain is set, see the + remark for the unur_distr_cont_set_domain() call. +*/ + +int unur_distr_cont_upd_mode( UNUR_DISTR *distribution ); +/* + Recompute the mode of the @var{distribution}. This call works + properly for distribution objects from the UNU.RAN library of + standard distributions when the corresponding function is + available. Otherwise a (slow) numerical mode finder based on + Brent's algorithm is used. If it failes @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_DATA}. +*/ + +double unur_distr_cont_get_mode( UNUR_DISTR *distribution ); +/* + Get mode of @var{distribution}. If the mode is not marked as known, + unur_distr_cont_upd_mode() is called to compute the mode. If this + is not successful @code{UNUR_INFINITY} is returned and + @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. + (There is no difference between the case where no routine for + computing the mode is available and the case where no mode exists + for the distribution at all.) +*/ + +int unur_distr_cont_set_center( UNUR_DISTR *distribution, double center ); +/* + Set center of the @var{distribution}. The center is used by some + methods to shift the distribution in order to decrease numerical + round-off error. If not given explicitly a default is used. + + @emph{Important:} This call does not check whether the center is + contained in the given domain. + + Default: The mode, if set by a unur_distr_cont_set_mode() or + unur_distr_cont_upd_mode() call; otherwise @code{0}. +*/ + +double unur_distr_cont_get_center( const UNUR_DISTR *distribution ); +/* + Get center of the @var{distribution}. It always returns some point + as there always exists a default for the center, see + unur_distr_cont_set_center(). +*/ + +int unur_distr_cont_set_pdfarea( UNUR_DISTR *distribution, double area ); +/* + Set the area below the PDF. If @code{area} is non-positive, no + area is set and @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_SET}. + + For a distribution object created by the + UNU.RAN library of standard distributions you always should use + the unur_distr_cont_upd_pdfarea(). Otherwise there might be + ambiguous side-effects. +*/ + +int unur_distr_cont_upd_pdfarea( UNUR_DISTR *distribution ); +/* + Recompute the area below the PDF of the distribution. + It only works for distribution objects from the + UNU.RAN library of standard distributions when the + corresponding function is available. Otherwise @code{unur_errno} is + set to @code{UNUR_ERR_DISTR_DATA}. + + This call also sets the normalization constant such that the given + PDF is the derivative of a given CDF, i.e. the area is 1. + However, for truncated distributions the area is smaller than 1. + + The call does not work for distributions from the + UNU.RAN library of standard distributions with truncated + domain when the CDF is not available. +*/ + +double unur_distr_cont_get_pdfarea( UNUR_DISTR *distribution ); +/* + Get the area below the PDF of the distribution. If this area is + not known,@* unur_distr_cont_upd_pdfarea() is called to compute + it. If this is not successful @code{UNUR_INFINITY} is returned and + @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/distr/corder.c b/vendor/unuran-1.11.0/src/distr/corder.c new file mode 100644 index 0000000..a3a2585 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/corder.c @@ -0,0 +1,489 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: corder.c * + * * + * manipulate univariate continuous order statistics * + * * + * return: * + * UNUR_SUCCESS ... on success * + * error code ... on error * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include "distr.h" +#include "cont.h" +#include "corder.h" +#include "distr_source.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "order statistics"; + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cont /* underlying (base) distribution */ +#define OS os->data.cont /* order statistics */ +#define LOGNORMCONSTANT (os->data.cont.norm_constant) + +/*---------------------------------------------------------------------------*/ + +/* function prototypes */ +static double _unur_pdf_corder( double x, const struct unur_distr *os ); +static double _unur_dpdf_corder( double x, const struct unur_distr *os ); + +static double _unur_cdf_corder( double x, const struct unur_distr *os ); +static int _unur_upd_area_corder( struct unur_distr *os ); + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** univariate continuous order statistics **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_corder_new( const struct unur_distr *distr, int n, int k ) + /*----------------------------------------------------------------------*/ + /* Create an object for order statistics of for a */ + /* sample size n and rank k. */ + /* `distr' must be a pointer to a univariate continuous distribution. */ + /* */ + /* parameters: */ + /* distr ... pointer to univariate continuous distribution. */ + /* n ... sample size */ + /* k ... rank */ + /* */ + /* return: */ + /* pointer to distribution object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_distr *os; + + /* check arguments */ + _unur_check_NULL( distr_name,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + + if (distr->id == UNUR_DISTR_CORDER) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,"No order statistics of order statistics allowed"); + return NULL; + } + + /* check parameters n and k */ + if (n < 2 || k < 1 || k > n) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,"n < 2 or k < 1 or k > n"); + return NULL; + } + + /* get distribution object for generic continuous univariate distribution */ + os = unur_distr_cont_new(); + if (!os) return NULL; + + /* set id to distribution of order statistics */ + os->id = UNUR_DISTR_CORDER; + + /* name of distribution */ + os->name = distr_name; + + /* this is a derived distribution */ + /* clone base distribution ... */ + os->base = _unur_distr_cont_clone( distr ); + if (!os->base) { free(os); return NULL; } + + /* set parameters for order statistics */ + OS.n_params = 2; /* two parameters: n and k */ + OS.params[0] = (double) n; + OS.params[1] = (double) k; + + /* copy data */ + OS.area = DISTR.area; /* area below PDF (same as for distr) */ + OS.trunc[0] = OS.domain[0] = DISTR.domain[0]; /* left boundary of domain */ + OS.trunc[1] = OS.domain[1] = DISTR.domain[1]; /* right boundary of domain */ + + /* pointer to PDF, its derivative, and CDF */ + if (DISTR.cdf) { + OS.cdf = _unur_cdf_corder; /* pointer to CDF */ + if (DISTR.pdf) { + OS.pdf = _unur_pdf_corder; /* pointer to PDF */ + if (DISTR.dpdf) + OS.dpdf = _unur_dpdf_corder; /* derivative of PDF */ + } + } + + /* there is no necessity for a function that computes the area below PDF */ + OS.upd_area = _unur_upd_area_corder; + + /* parameters set */ + os->set = distr->set & ~UNUR_DISTR_SET_MODE; /* mode not derived from distr */ + + /* log of normalization constant */ + if (_unur_upd_area_corder(os)==UNUR_SUCCESS) + os->set |= UNUR_DISTR_SET_PDFAREA; + + /* return pointer to object */ + return os; + +} /* end of unur_distr_corder_new() */ + +/*---------------------------------------------------------------------------*/ + +const struct unur_distr * +unur_distr_corder_get_distribution( const struct unur_distr *os ) + /*----------------------------------------------------------------------*/ + /* get pointer to distribution object for underlying distribution */ + /* */ + /* parameters: */ + /* os ... pointer to order statistics */ + /* */ + /* return: */ + /* pointer to underlying distribution */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( distr_name, os, NULL ); + _unur_check_distr_object( os, CONT, NULL ); + + /* check distribution */ + if (os->id != UNUR_DISTR_CORDER) { + _unur_warning(distr_name,UNUR_ERR_DISTR_INVALID,""); + return NULL; + } + + return os->base; +} /* end of unur_distr_corder_get_distribution() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_corder_set_rank( struct unur_distr *os, int n, int k ) + /*----------------------------------------------------------------------*/ + /* change sample size n and rank k of order statistics. */ + /* */ + /* parameters: */ + /* os ... pointer to order statistics */ + /* n ... sample size */ + /* k ... rank */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( distr_name, os, UNUR_ERR_NULL ); + _unur_check_distr_object( os, CONT, UNUR_ERR_DISTR_INVALID ); + + /* check distribution */ + if (os->id != UNUR_DISTR_CORDER) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return UNUR_ERR_DISTR_INVALID; } + COOKIE_CHECK(os,CK_DISTR_CONT,UNUR_ERR_COOKIE); + + /* check parameters n and k */ + if (n < 2 || k < 1 || k > n) { + _unur_error(distr_name,UNUR_ERR_DISTR_SET,"n < 2 or k < 1 or k > n"); + return UNUR_ERR_DISTR_SET; + } + + /* changelog */ + os->set &= ~UNUR_DISTR_SET_MODE; /* mode unknown */ + + /* copy parameters */ + OS.params[0] = (double) n; + OS.params[1] = (double) k; + + /* log of normalization constant */ + _unur_upd_area_corder(os); + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_corder_set_rank() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_corder_get_rank( const struct unur_distr *os, int *n, int *k ) + /*----------------------------------------------------------------------*/ + /* get sample size n and rank k of order statistics. */ + /* */ + /* parameters: */ + /* os ... pointer to order statistics */ + /* n ... sample size */ + /* k ... rank */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( distr_name, os, UNUR_ERR_NULL ); + _unur_check_distr_object( os, CONT, UNUR_ERR_DISTR_INVALID ); + + /* check distribution */ + if (os->id != UNUR_DISTR_CORDER) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return UNUR_ERR_DISTR_INVALID; } + COOKIE_CHECK(os,CK_DISTR_CONT,UNUR_ERR_COOKIE); + + /* copy parameters */ + *n = (int)(OS.params[0] + 0.5); + *k = (int)(OS.params[1] + 0.5); + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_corder_get_rank() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** PDF, its derivative and CDF of order statistics **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_corder( double x, const struct unur_distr *os ) + /* + PDF(x) = b(F(x)) * f(x) + + b(.) ... PDF of beta(k,n-k+1) distribution + f(.) ... PDF of underlying distribution + F(.) ... CDF of underlying distribution + */ +{ + double Fx; /* CDF of underlying distribution at x */ + double fx; /* PDF of underlying distribution at x */ + double p,q; /* shape parameters for beta distribution */ + + /* check arguments */ + _unur_check_NULL( NULL, os, UNUR_INFINITY ); + _unur_check_distr_object( os, CONT, UNUR_INFINITY ); + CHECK_NULL( os->base, UNUR_INFINITY ); + _unur_check_distr_object( os->base, CONT, UNUR_INFINITY ); + CHECK_NULL( os->base->data.cont.cdf, UNUR_INFINITY ); + CHECK_NULL( os->base->data.cont.pdf, UNUR_INFINITY ); + + Fx = (*(os->base->data.cont.cdf)) (x, os->base); + fx = (*(os->base->data.cont.pdf)) (x, os->base); + + p = OS.params[1]; /* k */ + q = OS.params[0] - OS.params[1] + 1.; /* n-k+1 */ + + /* PDF(x) = b(F(x)) * f(x) */ + if (fx <= 0. || Fx <= 0. || Fx >= 1.) + return 0.; + else + return exp(log(fx) + (p-1.)*log(Fx) + (q-1.)*log(1.-Fx) - LOGNORMCONSTANT); + +} /* end of _unur_pdf_corder() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_corder( double x, const struct unur_distr *os ) + /* + PDF'(x) = b'(F(x)) * f(x)^2 + b(F(x)) * f'(x) + + b(.) ... PDF of beta(k,n-k+1) distribution + f(.) ... PDF of underlying distribution + F(.) ... CDF of underlying distribution + */ +{ + double Fx; /* CDF of underlying distribution at x */ + double fx; /* PDF of underlying distribution at x */ + double dfx; /* derivative of PDF of underlying distribution at x */ + double p,q; /* shape parameters for beta distribution */ + double dpdf; /* derivative of PDF of order statistics */ + double lFx, lFy; + + /* check arguments */ + _unur_check_NULL( NULL, os, UNUR_INFINITY ); + _unur_check_distr_object( os, CONT, UNUR_INFINITY ); + CHECK_NULL( os->base, UNUR_INFINITY ); + _unur_check_distr_object( os->base, CONT, UNUR_INFINITY ); + CHECK_NULL( os->base->data.cont.cdf, UNUR_INFINITY ); + CHECK_NULL( os->base->data.cont.pdf, UNUR_INFINITY ); + CHECK_NULL( os->base->data.cont.dpdf, UNUR_INFINITY ); + + Fx = (*(os->base->data.cont.cdf)) (x, os->base); + fx = (*(os->base->data.cont.pdf)) (x, os->base); + dfx = (*(os->base->data.cont.dpdf)) (x, os->base); + + p = OS.params[1]; /* k */ + q = OS.params[0] - OS.params[1] + 1.; /* n-k+1 */ + + if (fx <= 0. || Fx <= 0. || Fx >= 1.) + return 0.; + + /* else */ + + lFx = log(Fx); + lFy = log(1.-Fx); + + /* PDF'(x) = b'(F(x)) * f(x)^2 + b(F(x)) * f'(x) */ + dpdf = ( exp(2.*log(fx) + (p-2.)*lFx + (q-2.)*lFy - LOGNORMCONSTANT) + * ( (p-1.)*(1.-Fx) - (q-1.)*Fx )); + dpdf += exp((p-1.)*lFx + (q-1.)*lFy - LOGNORMCONSTANT) * dfx; + + return dpdf; +} /* end of _unur_dpdf_corder() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_corder( double x, const struct unur_distr *os ) + /* + CDF(x) = B(F(x)) + + B(.) ... CDF of beta(k,n-k+1) distribution + F(.) ... CDF of underlying distribution + */ +{ + double Fx; /* CDF of underlying distribution at x */ + double p,q; /* shape parameters for beta distribution */ + + /* check arguments */ + _unur_check_NULL( NULL, os, UNUR_INFINITY ); + _unur_check_distr_object( os, CONT, UNUR_INFINITY ); + CHECK_NULL( os->base, UNUR_INFINITY ); + _unur_check_distr_object( os->base, CONT, UNUR_INFINITY ); + CHECK_NULL( os->base->data.cont.cdf, UNUR_INFINITY ); + + Fx = (*(os->base->data.cont.cdf)) (x, os->base); + + p = OS.params[1]; /* k */ + q = OS.params[0] - OS.params[1] + 1.; /* n-k+1 */ + + /* CDF(x) = B(F(x)) */ + return _unur_SF_incomplete_beta(Fx,p,q); + +} /* end of _unur_cdf_corder() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_corder( UNUR_DISTR *os ) +{ + + /* log of normalization constant */ + /* LOGNORMCONSTANT = _unur_SF_ln_gamma(k) + _unur_SF_ln_gamma(n-k+1) - _unur_SF_ln_gamma(n+1); */ + LOGNORMCONSTANT = ( _unur_SF_ln_gamma(OS.params[1]) + + _unur_SF_ln_gamma(OS.params[0] - OS.params[1] + 1.) + - _unur_SF_ln_gamma(OS.params[0] + 1.) ); + + /* we assume that the PDF is the derivative of the given CDF ! */ + + /* standard distribution --> nothing to do */ + + if (!(os->set & UNUR_DISTR_SET_STDDOMAIN)) { + /* truncated distributions */ + if (OS.cdf == NULL) + /* no CDF */ + return UNUR_ERR_DISTR_REQUIRED; + + OS.area = (OS.domain[1] < UNUR_INFINITY) ? _unur_cdf_corder(OS.domain[1],os) : 1.; + OS.area -= (OS.domain[0] > -UNUR_INFINITY) ? _unur_cdf_corder(OS.domain[0],os) : 0.; + } + + return (OS.area > 0.) ? UNUR_SUCCESS : UNUR_ERR_DISTR_DATA; + +} /* end of _unur_upd_area_corder() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** debug **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_distr_corder_debug( const struct unur_distr *os, const char *genid ) + /*----------------------------------------------------------------------*/ + /* write info about distribution into LOG file */ + /* */ + /* parameters: */ + /* os ... pointer to order statistics */ + /* genid ... pointer to generator id */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(os,RETURN_VOID); + COOKIE_CHECK(os,CK_DISTR_CONT,RETURN_VOID); + CHECK_NULL(os->base,RETURN_VOID); + + LOG = unur_get_stream(); + + /* print data about order statistics */ + fprintf(LOG,"%s: distribution:\n",genid); + fprintf(LOG,"%s:\ttype = order statistics of continuous univariate distribution\n",genid); + fprintf(LOG,"%s:\tname = %s\n",genid,os->name); + fprintf(LOG,"%s:\tsample size\tn = %d\n",genid,(int)(OS.params[0]+0.5)); + fprintf(LOG,"%s:\trank\t\tk = %d\n",genid,(int)(OS.params[1]+0.5)); + fprintf(LOG,"%s:\n",genid); + + if (os->set & UNUR_DISTR_SET_MODE) + fprintf(LOG,"%s:\tmode = %g\n",genid,OS.mode); + else + fprintf(LOG,"%s:\tmode unknown\n",genid); + + fprintf(LOG,"%s:\tdomain = (%g, %g)",genid,OS.domain[0],OS.domain[1]); + _unur_print_if_default(os,UNUR_DISTR_SET_DOMAIN); + + fprintf(LOG,"\n%s:\tarea below PDF = %g",genid,OS.area); + _unur_print_if_default(os,UNUR_DISTR_SET_PDFAREA); + fprintf(LOG,"\n%s:\n",genid); + + /* print data about underlying distribution */ + fprintf(LOG,"%s: Underlying distribution:\n",genid); + _unur_distr_cont_debug(os->base, genid); + +} /* end of _unur_distr_corder_debug() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distr/corder.h b/vendor/unuran-1.11.0/src/distr/corder.h new file mode 100644 index 0000000..0f1b1b2 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/corder.h @@ -0,0 +1,281 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: corder.h * + * * + * PURPOSE: * + * function prototypes for manipulating distribution objects of * + * id CORDER (continuous order statistics) * + * type CONT (continuous univariate distribution) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/* + =NODEX CORDER Continuous univariate order statistics + + =UP Distribution_objects [15] + + =DESCRIPTION + These are special cases of a continuous univariate distributions + and thus they have most of these parameters (with the exception + that functions cannot be changed). Additionally, + + @itemize @minus + @item there is a call to extract the underlying distribution, + + @item and a call to handle the @command{rank} of the order + statistics. + + @end itemize + + =END +*/ + +/*---------------------------------------------------------------------------*/ + +/* + Routines for handling univariate continuous order statistics (CORDER). +*/ + +/* =ROUTINES */ + +UNUR_DISTR *unur_distr_corder_new( const UNUR_DISTR *distribution, int n, int k ); +/* + Create an object for order statistics of sample size + @var{n} and rank @var{k}. + @var{distribution} must be a pointer to a univariate continuous + distribution. + The resulting generator object is of the same type as of a + unur_distr_cont_new() call. + (However, it cannot be used to make an order statistics out of an + order statistics.) + + To have a PDF for the order statistics, the given distribution + object must contain a CDF and a PDF. Moreover, it is assumed that + the given PDF is the derivative of the given CDF. Otherwise the + area below the PDF of the order statistics is not computed correctly. + + @emph{Important:} There is no warning when the computed area below + the PDF of the order statistics is wrong. +*/ + + +const UNUR_DISTR *unur_distr_corder_get_distribution( const UNUR_DISTR *distribution ); +/* + Get pointer to distribution object for underlying distribution. +*/ + + + +/* ==DOC + @subsubheading Essential parameters +*/ + +int unur_distr_corder_set_rank( UNUR_DISTR *distribution, int n, int k ); +/* + Change sample size @var{n} and rank @var{k} of order statistics. + In case of invalid data, no parameters are changed. + The area below the PDF can be set to that of the underlying + distribution by a unur_distr_corder_upd_pdfarea() call. +*/ + +int unur_distr_corder_get_rank( const UNUR_DISTR *distribution, int *n, int *k ); +/* + Get sample size @var{n} and rank @var{k} of order statistics. + In case of error an error code is returned. +*/ + +/* ==DOC + Additionally most of the set and get calls for continuous + univariate distributions work. The most important exceptions are + that the PDF and CDF cannot be changed and + unur_distr_cont_upd_mode() uses in any way a (slow) numerical + method that might fail. +*/ + + +#define unur_distr_corder_get_pdf(distr) unur_distr_cont_get_pdf((distr)) +/* UNUR_FUNCT_CONT *unur_distr_corder_get_pdf( UNUR_DISTR *distribution ); */ + +#define unur_distr_corder_get_dpdf(distr) unur_distr_cont_get_dpdf((distr)) +/* UNUR_FUNCT_CONT *unur_distr_corder_get_dpdf( UNUR_DISTR *distribution ); */ + +#define unur_distr_corder_get_cdf(distr) unur_distr_cont_get_cdf((distr)) +/* UNUR_FUNCT_CONT *unur_distr_corder_get_cdf( UNUR_DISTR *distribution ); */ +/* + Get the respective pointer to the PDF, the derivative of the + PDF and the CDF of the distribution, respectively. The pointer is of type + @code{double funct(double x, UNUR_DISTR *distr)}. + If the corresponding function is not available for the distribution, + the NULL pointer is returned. + See also unur_distr_cont_get_pdf(). + (Macro) +*/ + +#define unur_distr_corder_eval_pdf(x,distr) unur_distr_cont_eval_pdf((x),(distr)) +/* double unur_distr_corder_eval_pdf( double x, UNUR_DISTR *distribution ); */ + +#define unur_distr_corder_eval_dpdf(x,distr) unur_distr_cont_eval_dpdf((x),(distr)) +/* double unur_distr_corder_eval_dpdf( double x, UNUR_DISTR *distribution ); */ + +#define unur_distr_corder_eval_cdf(x,distr) unur_distr_cont_eval_cdf((x),(distr)) +/* double unur_distr_corder_eval_cdf( double x, UNUR_DISTR *distribution ); */ +/* + Evaluate the PDF, derivative of the PDF. and the CDF, + respectively, at @var{x}. + Notice that @var{distribution} must not be the NULL pointer. + If the corresponding function is not available for the distribution, + @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_DATA}. + See also unur_distr_cont_eval_pdf(). + (Macro) + + @emph{IMPORTANT:} + In the case of a truncated standard distribution these calls always + return the respective values of the @emph{untruncated} distribution! +*/ + + +#define unur_distr_corder_set_pdfparams(distr,params,n) unur_distr_cont_set_pdfparams((distr),(params),(n)) +/* int unur_distr_corder_set_pdfparams(UNUR_DISTR *distribution,double *params,int n_params); */ +/* + Set array of parameters for underlying distribution. + See unur_distr_cont_set_pdfparams() for details. + (Macro) +*/ + +#define unur_distr_corder_get_pdfparams(distr,params) unur_distr_cont_get_pdfparams((distr),(params)) +/* int unur_distr_corder_get_pdfparams( UNUR_DISTR *distribution, double **params ); */ +/* + Get number of parameters of the PDF of the underlying distribution + and set pointer @var{params} to array of parameters. + See unur_distr_cont_get_pdfparams() for details. + (Macro) +*/ + + +#define unur_distr_corder_set_domain(distr,left,right) unur_distr_cont_set_domain((distr),(left),(right)) +/* int unur_distr_corder_set_domain( UNUR_DISTR *distribution, double left, double right ); */ +/* + Set the left and right borders of the domain of the + distribution. + See unur_distr_cont_set_domain() for details. + (Macro) +*/ + +#define unur_distr_corder_get_domain(distr,left,right) unur_distr_cont_get_domain((distr),(left),(right)) +/* int unur_distr_corder_get_domain( UNUR_DISTR *distribution, double *left, double *right ); */ +/* + Get the left and right borders of the domain of the + distribution. + See unur_distr_cont_get_domain() for details. + (Macro) +*/ + + +#define unur_distr_corder_get_truncated(distr,left,right) unur_distr_cont_get_truncated((distr),(left),(right)) +/* int unur_distr_corder_get_truncated( UNUR_DISTR *distribution, double *left, double *right ); */ +/* + Get the left and right borders of the (truncated) domain of the + distribution. + See unur_distr_cont_get_truncated() for details. + (Macro) +*/ + +/* ==DOC + @subsubheading Derived parameters + + The following paramters @strong{must} be set whenever one of the essential + parameters has been set or changed (and the parameter is required + for the chosen method). +*/ + +#define unur_distr_corder_set_mode(distr,mode) unur_distr_cont_set_mode((distr),(mode)) +/* int unur_distr_corder_set_mode( UNUR_DISTR *distribution, double mode ); */ +/* + Set mode of distribution. + See also unur_distr_corder_set_mode(). + (Macro) +*/ + +#define unur_distr_corder_upd_mode(distr) unur_distr_cont_upd_mode((distr)) +/* double unur_distr_corder_upd_mode( UNUR_DISTR *distribution ); */ +/* + Recompute the mode of the distribution numerically. Notice that + this routine is slow and might not work properly in every case. + See also unur_distr_cont_upd_mode() for further details. + (Macro) +*/ + +#define unur_distr_corder_get_mode(distr) unur_distr_cont_get_mode((distr)) +/* double unur_distr_corder_get_mode( UNUR_DISTR *distribution ); */ +/* + Get mode of distribution. + See unur_distr_cont_get_mode() for details. + (Macro) +*/ + + +#define unur_distr_corder_set_pdfarea(distr,area) unur_distr_cont_set_pdfarea((distr),(area)) +/* int unur_distr_corder_set_pdfarea( UNUR_DISTR *distribution, double area ); */ +/* + Set the area below the PDF. + See unur_distr_cont_set_pdfarea() for details. + (Macro) +*/ + + +#define unur_distr_corder_upd_pdfarea(distr) unur_distr_cont_upd_pdfarea((distr)) +/* double unur_distr_corder_upd_pdfarea( UNUR_DISTR *distribution ); */ +/* + Recompute the area below the PDF of the distribution. + It only works for order statistics for distribution objects from + the UNU.RAN library of standard distributions when the + corresponding function is available. + unur_distr_cont_upd_pdfarea() assumes that the PDF of the underlying + distribution is normalized, i.e. it is the derivative of its CDF. + Otherwise the computed area is wrong and there is @strong{no} warning + about this failure. + See unur_distr_cont_upd_pdfarea() for further details. + (Macro) +*/ + +#define unur_distr_corder_get_pdfarea(distr) unur_distr_cont_get_pdfarea((distr)) +/* double unur_distr_corder_get_pdfarea( UNUR_DISTR *distribution ); */ +/* + Get the area below the PDF of the distribution. + See unur_distr_cont_get_pdfarea() for details. + (Macro) +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distr/cvec.c b/vendor/unuran-1.11.0/src/distr/cvec.c new file mode 100644 index 0000000..5328b5c --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/cvec.c @@ -0,0 +1,2619 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: cvec.c * + * * + * manipulate multivariate continuous distribution objects * + * * + * return: * + * UNUR_SUCCESS ... on success * + * error code ... on error * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include "distr_source.h" +#include "distr.h" +#include "cvec.h" +#include +#include + +/*---------------------------------------------------------------------------*/ +/* copy and free marginal distributions */ + +static struct unur_distr **_unur_distr_cvec_marginals_clone ( struct unur_distr **marginals, int dim ); +static void _unur_distr_cvec_marginals_free ( struct unur_distr **marginals, int dim ); + +static void _unur_distr_cvec_free( struct unur_distr *distr ); + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cvec + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** mulitvariate continuous distributions **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_cvec_new( int dim ) + /*----------------------------------------------------------------------*/ + /* create a new (empty) distribution object */ + /* type: multivariate continuous with given PDF */ + /* */ + /* parameters: */ + /* dim ... number of components of random vector (dimension) */ + /* */ + /* return: */ + /* pointer to distribution object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + register struct unur_distr *distr; + int i; + + /* check dimension for new parameter for distribution */ + if (dim < 1) { + _unur_error(NULL,UNUR_ERR_DISTR_SET,"dimension < 1"); + return NULL; + } + + /* get empty distribution object */ + distr = _unur_distr_generic_new(); + if (!distr) return NULL; + + /* set magic cookie */ + COOKIE_SET(distr,CK_DISTR_CVEC); + + /* set type of distribution */ + distr->type = UNUR_DISTR_CVEC; + + /* set id to generic distribution */ + distr->id = UNUR_DISTR_GENERIC; + + /* dimension of random vector */ + distr->dim = dim; /* multivariant */ + + /* this is not a derived distribution */ + distr->base = NULL; + + /* destructor */ + distr->destroy = _unur_distr_cvec_free; + + /* clone */ + distr->clone = _unur_distr_cvec_clone; + + /* set defaults */ + DISTR.pdf = NULL; /* pointer to PDF */ + DISTR.dpdf = NULL; /* pointer to gradient of PDF */ + DISTR.pdpdf = NULL; /* pointer to partial derivative of PDF */ + DISTR.logpdf = NULL; /* pointer to logPDF */ + DISTR.dlogpdf = NULL; /* pointer to gradient of logPDF */ + DISTR.pdlogpdf = NULL; /* pointer to partial derivative of logPDF */ + DISTR.domainrect = NULL; /* (rectangular) domain of distribution [default: unbounded */ + DISTR.init = NULL; /* pointer to special init routine [default: none] */ + DISTR.mean = NULL; /* mean vector [default: not known] */ + DISTR.covar = NULL; /* covariance matrix [default: not known] */ + DISTR.cholesky = NULL; /* cholesky factor of cov. matrix [default: not computed] */ + DISTR.covar_inv = NULL; /* inverse covariance matrix [default: not computed] */ + DISTR.rankcorr = NULL; /* rank correlation [default: not known] */ + DISTR.rk_cholesky = NULL; /* cholesky factor of rank correlation [default: not computed] */ + DISTR.marginals = NULL; /* array of pointers to marginal distributions */ + DISTR.upd_mode = NULL; /* funct for computing mode */ + DISTR.upd_volume = NULL; /* funct for computing volume */ + +#ifdef USE_DEPRECATED_CODE + DISTR.stdmarginals = NULL; /* array of pointers to standardized marginal distributions */ +#endif + + /* initialize parameters of the p.d.f. */ + DISTR.n_params = 0; /* number of parameters of the pdf */ + for (i=0; idata.cvec + + struct unur_distr *clone; + int i; + + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CVEC, NULL ); + + /* allocate memory */ + clone = _unur_xmalloc( sizeof(struct unur_distr) ); + + /* copy distribution object into clone */ + memcpy( clone, distr, sizeof( struct unur_distr ) ); + + /* copy data about distribution */ + if (DISTR.domainrect) { + CLONE.domainrect = _unur_xmalloc( 2 * distr->dim * sizeof(double) ); + memcpy( CLONE.domainrect, DISTR.domainrect, 2 * distr->dim * sizeof(double) ); + } + + if (DISTR.mean) { + CLONE.mean = _unur_xmalloc( distr->dim * sizeof(double) ); + memcpy( CLONE.mean, DISTR.mean, distr->dim * sizeof(double) ); + } + + if (DISTR.covar) { + CLONE.covar = _unur_xmalloc( distr->dim * distr->dim * sizeof(double) ); + memcpy( CLONE.covar, DISTR.covar, distr->dim * distr->dim * sizeof(double) ); + } + + if (DISTR.cholesky) { + CLONE.cholesky = _unur_xmalloc( distr->dim * distr->dim * sizeof(double) ); + memcpy( CLONE.cholesky, DISTR.cholesky, distr->dim * distr->dim * sizeof(double) ); + } + + if (DISTR.covar_inv) { + CLONE.covar_inv = _unur_xmalloc( distr->dim * distr->dim * sizeof(double) ); + memcpy( CLONE.covar_inv, DISTR.covar_inv, distr->dim * distr->dim * sizeof(double) ); + } + + if (DISTR.rankcorr) { + CLONE.rankcorr = _unur_xmalloc( distr->dim * distr->dim * sizeof(double) ); + memcpy( CLONE.rankcorr, DISTR.rankcorr, distr->dim * distr->dim * sizeof(double) ); + } + + if (DISTR.rk_cholesky) { + CLONE.rk_cholesky = _unur_xmalloc( distr->dim * distr->dim * sizeof(double) ); + memcpy( CLONE.rk_cholesky, DISTR.rk_cholesky, distr->dim * distr->dim * sizeof(double) ); + } + + if (DISTR.mode) { + CLONE.mode = _unur_xmalloc( distr->dim * sizeof(double) ); + memcpy( CLONE.mode, DISTR.mode, distr->dim * sizeof(double) ); + } + + if (DISTR.center) { + CLONE.center = _unur_xmalloc( distr->dim * sizeof(double) ); + memcpy( CLONE.center, DISTR.center, distr->dim * sizeof(double) ); + } + + if (DISTR.marginals) + CLONE.marginals = _unur_distr_cvec_marginals_clone( DISTR.marginals, distr->dim ); + +#ifdef USE_DEPRECATED_CODE + if (DISTR.stdmarginals) + CLONE.stdmarginals = _unur_distr_cvec_marginals_clone( DISTR.stdmarginals, distr->dim ); +#endif + + /* clone of scalar parameters */ + CLONE.n_params = DISTR.n_params; + for (i=0; iname_str) { + size_t len = strlen(distr->name_str) + 1; + clone->name_str = _unur_xmalloc(len); + memcpy( clone->name_str, distr->name_str, len ); + clone->name = clone->name_str; + } + + return clone; + +#undef CLONE +} /* end of _unur_distr_cvec_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_distr_cvec_free( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* free distribution object */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + if( distr == NULL ) /* nothing to do */ + return; + + COOKIE_CHECK(distr,CK_DISTR_CVEC,RETURN_VOID); + + for (i=0; idim); + +#ifdef USE_DEPRECATED_CODE + if (DISTR.stdmarginals) + _unur_distr_cvec_marginals_free(DISTR.stdmarginals, distr->dim); +#endif + + /* user name for distribution */ + if (distr->name_str) free(distr->name_str); + + COOKIE_CLEAR(distr); + free( distr ); + +} /* end of unur_distr_cvec_free() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_pdf( struct unur_distr *distr, UNUR_FUNCT_CVEC *pdf ) + /*----------------------------------------------------------------------*/ + /* set PDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* pdf ... pointer to PDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_NULL( distr->name, pdf, UNUR_ERR_NULL); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + /* we do not allow overwriting a PDF */ + if (DISTR.pdf != NULL || DISTR.logpdf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of PDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + DISTR.pdf = pdf; + return UNUR_SUCCESS; + +} /* end of unur_distr_cvec_set_pdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_dpdf( struct unur_distr *distr, UNUR_VFUNCT_CVEC *dpdf ) + /*----------------------------------------------------------------------*/ + /* set gradient of PDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* dpdf ... pointer to gradient of PDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_NULL( distr->name, dpdf, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + /* we do not allow overwriting a dPDF */ + if (DISTR.dpdf != NULL || DISTR.dlogpdf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of dPDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + DISTR.dpdf = dpdf; + return UNUR_SUCCESS; +} /* end of unur_distr_cvec_set_dpdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_pdpdf( struct unur_distr *distr, UNUR_FUNCTD_CVEC *pdpdf ) + /*----------------------------------------------------------------------*/ + /* set PDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* pdpdf ... pointer to partial derivative of the PDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_NULL( distr->name, pdpdf, UNUR_ERR_NULL); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + /* we do not allow overwriting a pdPDF */ + if (DISTR.pdpdf != NULL || DISTR.pdlogpdf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of pdPDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + DISTR.pdpdf = pdpdf; + return UNUR_SUCCESS; + +} /* end of unur_distr_cvec_set_pdpdf() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_FUNCT_CVEC * +unur_distr_cvec_get_pdf( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get pointer to PDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to PDF */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CVEC, NULL ); + + return DISTR.pdf; +} /* end of unur_distr_cvec_get_pdf() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_VFUNCT_CVEC * +unur_distr_cvec_get_dpdf( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get pointer to gradient of PDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to gradient of PDF */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CVEC, NULL ); + + return DISTR.dpdf; +} /* end of unur_distr_cvec_get_dpdf() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_FUNCTD_CVEC * +unur_distr_cvec_get_pdpdf( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get pointer to partial derivative of PDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to partial derivative of PDF */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CVEC, NULL ); + + return DISTR.pdpdf; +} /* end of unur_distr_cvec_get_pdpdf() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_cvec_eval_pdf( const double *x, struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate PDF of distribution at x */ + /* */ + /* parameters: */ + /* x ... argument for pdf */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* PDF(x) */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, CVEC, UNUR_INFINITY ); + + if (DISTR.pdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + } + + return _unur_cvec_PDF(x,distr); +} /* end of unur_distr_cvec_eval_pdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_eval_dpdf( double *result, const double *x, struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate gradient of PDF of distribution at x */ + /* */ + /* parameters: */ + /* result ... to store grad (PDF(x)) */ + /* x ... argument for dPDF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + if (DISTR.dpdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_ERR_DISTR_DATA; + } + + return _unur_cvec_dPDF(result,x,distr); +} /* end of unur_distr_cvec_eval_dpdf() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_cvec_eval_pdpdf( const double *x, int coord, struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate partial derivative of PDF of distribution at x for */ + /* coordinate coord. */ + /* */ + /* parameters: */ + /* x ... argument for pdf */ + /* coord ... coordinate for partial derivative */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* dPDF(x) / d(coord) */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, CVEC, UNUR_INFINITY ); + + if (DISTR.pdpdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + } + + if (coord < 0 || coord >= distr->dim) { + _unur_error(distr->name,UNUR_ERR_DISTR_DOMAIN,"invalid coordinate"); + return UNUR_INFINITY; + } + + return _unur_cvec_pdPDF(x,coord,distr); +} /* end of unur_distr_cvec_eval_pdpdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_logpdf( struct unur_distr *distr, UNUR_FUNCT_CVEC *logpdf ) + /*----------------------------------------------------------------------*/ + /* set logPDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* logpdf ... pointer to logPDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_NULL( distr->name, logpdf, UNUR_ERR_NULL); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + /* we do not allow overwriting a PDF */ + if (DISTR.pdf != NULL || DISTR.logpdf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of logPDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + DISTR.logpdf = logpdf; + DISTR.pdf = _unur_distr_cvec_eval_pdf_from_logpdf; + + return UNUR_SUCCESS; + +} /* end of unur_distr_cvec_set_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_distr_cvec_eval_pdf_from_logpdf( const double *x, struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate PDF of distribution at x */ + /* wrapper when only logPDF is given */ + /* */ + /* parameters: */ + /* x ... argument for pdf */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* PDF(x) */ + /*----------------------------------------------------------------------*/ +{ + if (DISTR.logpdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + } + + return exp(_unur_cvec_logPDF(x,distr)); +} /* end of _unur_distr_cvec_eval_pdf_from_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_dlogpdf( struct unur_distr *distr, UNUR_VFUNCT_CVEC *dlogpdf ) + /*----------------------------------------------------------------------*/ + /* set gradient of logPDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* dlogpdf ... pointer to gradient of logPDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_NULL( distr->name, dlogpdf, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + /* we do not allow overwriting a dlogPDF */ + if (DISTR.dpdf != NULL || DISTR.dlogpdf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of dlogPDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + DISTR.dlogpdf = dlogpdf; + DISTR.dpdf = _unur_distr_cvec_eval_dpdf_from_dlogpdf; + + return UNUR_SUCCESS; +} /* end of _unur_distr_cvec_set_dlogpdf() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_distr_cvec_eval_dpdf_from_dlogpdf( double *result, const double *x, struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate gradient of PDF of distribution at x */ + /* wrapper when only gradient of logPDF is given */ + /* */ + /* parameters: */ + /* result ... to store grad (PDF(x)) */ + /* x ... argument for dPDF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int ret, i; + double fx; + + if (DISTR.logpdf == NULL || DISTR.dlogpdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_ERR_DISTR_DATA; + } + + fx = exp(unur_distr_cvec_eval_logpdf( x, distr )); + if (!_unur_isfinite(fx)) return UNUR_ERR_DISTR_DATA; + + ret = _unur_cvec_dlogPDF(result,x,distr); + for (i=0; idim; i++) + result[i] *= fx; + + return ret; +} /* end of _unur_distr_cvec_eval_dpdf_from_dlogpdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_pdlogpdf( struct unur_distr *distr, UNUR_FUNCTD_CVEC *pdlogpdf ) + /*----------------------------------------------------------------------*/ + /* set partial derivative of logPDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* pdlogpdf ... pointer to partial derivative of logPDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_NULL( distr->name, pdlogpdf, UNUR_ERR_NULL); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + /* we do not allow overwriting a PDF */ + if (DISTR.pdpdf != NULL || DISTR.pdlogpdf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of pdlogPDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + DISTR.pdlogpdf = pdlogpdf; + DISTR.pdpdf = _unur_distr_cvec_eval_pdpdf_from_pdlogpdf; + + return UNUR_SUCCESS; + +} /* end of unur_distr_cvec_set_pdlogpdf() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_distr_cvec_eval_pdpdf_from_pdlogpdf( const double *x, int coord, struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate partial derivative of PDF of distribution at x */ + /* wrapper when only logPDF is given */ + /* */ + /* parameters: */ + /* x ... argument for pdf */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* PDF(x) */ + /*----------------------------------------------------------------------*/ +{ + double fx; + + if (DISTR.logpdf == NULL || DISTR.pdlogpdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + } + + if (coord < 0 || coord >= distr->dim) { + _unur_error(distr->name,UNUR_ERR_DISTR_DOMAIN,"invalid coordinate"); + return UNUR_INFINITY; + } + + fx = exp(unur_distr_cvec_eval_logpdf( x, distr )); + if (!_unur_isfinite(fx)) return UNUR_INFINITY; + + return fx * _unur_cvec_pdlogPDF(x,coord,distr); +} /* end of _unur_distr_cvec_eval_pdpdf_from_pdlogpdf() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_FUNCT_CVEC * +unur_distr_cvec_get_logpdf( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get pointer to logPDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to logPDF */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CVEC, NULL ); + + return DISTR.logpdf; +} /* end of unur_distr_cvec_get_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_VFUNCT_CVEC * +unur_distr_cvec_get_dlogpdf( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get pointer to gradient of logPDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to gradient of logPDF */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CVEC, NULL ); + + return DISTR.dlogpdf; +} /* end of unur_distr_cvec_get_dlogpdf() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_FUNCTD_CVEC * +unur_distr_cvec_get_pdlogpdf( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get pointer to partial derivative of logPDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to partial derivative of logPDF */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CVEC, NULL ); + + return DISTR.pdlogpdf; +} /* end of unur_distr_cvec_get_pdlogpdf() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_cvec_eval_logpdf( const double *x, struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate logPDF of distribution at x */ + /* */ + /* parameters: */ + /* x ... argument for logpdf */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* logPDF(x) */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, CVEC, UNUR_INFINITY ); + + if (DISTR.logpdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + } + + return _unur_cvec_logPDF(x,distr); +} /* end of unur_distr_cvec_eval_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_eval_dlogpdf( double *result, const double *x, struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate gradient of logPDF of distribution at x */ + /* */ + /* parameters: */ + /* result ... to store grad (logPDF(x)) */ + /* x ... argument for dlogPDF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + if (DISTR.dlogpdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_ERR_DISTR_DATA; + } + + return _unur_cvec_dlogPDF(result,x,distr); +} /* end of unur_distr_cvec_eval_dlogpdf() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_cvec_eval_pdlogpdf( const double *x, int coord, struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate of partial derivative of logPDF of distribution at x */ + /* in direction coord */ + /* */ + /* parameters: */ + /* x ... argument for logpdf */ + /* coord ... coordinate for partial derivative */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* d logPDF(x) / d(coord) */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, CVEC, UNUR_INFINITY ); + + if (DISTR.pdlogpdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + } + + if (coord < 0 || coord >= distr->dim) { + _unur_error(distr->name,UNUR_ERR_DISTR_DOMAIN,"invalid coordinate"); + return UNUR_INFINITY; + } + + return _unur_cvec_pdlogPDF(x,coord,distr); +} /* end of unur_distr_cvec_eval_pdlogpdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_domain_rect( struct unur_distr *distr, const double *lowerleft, const double *upperright ) + /*----------------------------------------------------------------------*/ + /* Set rectangular domain */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* lowerleft ... lower left vertex of rectanlge */ + /* upperright ... upper right vertex of rectanlge */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + _unur_check_NULL( distr->name, lowerleft, UNUR_ERR_NULL ); + _unur_check_NULL( distr->name, upperright, UNUR_ERR_NULL ); + + /* check new parameter for distribution */ + for (i=0; idim; i++) { + if (!(lowerleft[i] < upperright[i] * (1.-UNUR_SQRT_DBL_EPSILON))) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"domain, left >= right"); + return UNUR_ERR_DISTR_SET; + } + } + + /* store data */ + DISTR.domainrect = _unur_xrealloc(DISTR.domainrect, 2 * distr->dim * sizeof(double)); + for (i=0; idim; i++) { + DISTR.domainrect[2*i] = lowerleft[i]; + DISTR.domainrect[2*i+1] = upperright[i]; + } + + /* changelog */ + distr->set |= UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_DOMAINBOUNDED; + /* we silently assume here that at least one of the given coordinates */ + /* is finite. */ + + /* we have to mark all derived parameters as unknown */ + distr->set &= ~(UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MASK_DERIVED ); + + if (distr->base) { + /* for derived distributions (e.g. order statistics) + we also have to mark derived parameters as unknown */ + distr->base->set &= ~(UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MASK_DERIVED ); + /* We only can set the domain of the base distribution if it */ + /* is of the same type as distr */ + if ( distr->base->type == UNUR_DISTR_CVEC ) { + if (unur_distr_cvec_set_domain_rect(distr->base, lowerleft, upperright)!=UNUR_SUCCESS) + return UNUR_ERR_DISTR_SET; + } + } + + /* o.k. */ + return UNUR_SUCCESS; +} /* end unur_distr_cvec_set_domain_rect() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_distr_cvec_has_boundeddomain( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* Check whether distr has a bounded domain */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* TRUE ... if domain is bounded */ + /* FALSE ... otherwise or in case of an error */ + /*----------------------------------------------------------------------*/ +{ + int i; + double *domain; + + /* check arguments */ + CHECK_NULL( distr, FALSE ); + COOKIE_CHECK(distr,CK_DISTR_CVEC,FALSE); + + if (! (distr->set & UNUR_DISTR_SET_DOMAINBOUNDED && + DISTR.domainrect)) + return FALSE; + + domain = DISTR.domainrect; + for (i=0; i < 2*distr->dim; i++) + if (!_unur_isfinite(domain[i])) + return FALSE; + + return TRUE; +} /* end of _unur_distr_cvec_has_boundeddomain() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_distr_cvec_is_indomain( const double *x, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* Check whether x falls into domain */ + /* */ + /* parameters: */ + /* x ... pointer to point */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* TRUE ... if x in domain */ + /* FALSE ... otherwise or in case of an error */ + /*----------------------------------------------------------------------*/ +{ + int i; + double *domain; + + /* check arguments */ + CHECK_NULL( distr, FALSE ); + COOKIE_CHECK(distr,CK_DISTR_CVEC,FALSE); + + domain = DISTR.domainrect; + if (domain==NULL) + /* unbounded domain */ + return TRUE; + + for (i=0; idim; i++) { + if (x[i] < domain[2*i] || x[i] > domain[2*i+1]) + return FALSE; + } + + return TRUE; +} /* end of _unur_distr_cvec_is_indomain() */ + +int +unur_distr_cvec_is_indomain( const double *x, const struct unur_distr *distr ) +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, FALSE ); + _unur_check_distr_object( distr, CVEC, FALSE ); + + return _unur_distr_cvec_is_indomain(x, distr); +} /* end of unur_distr_cvec_is_indomain() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_mean( struct unur_distr *distr, const double *mean ) + /*----------------------------------------------------------------------*/ + /* set mean vector of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* mean ... mean vector of distribution */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + /* we have to allocate memory first */ + if (DISTR.mean == NULL) + DISTR.mean = _unur_xmalloc( distr->dim * sizeof(double) ); + + if (mean) + /* mean vector given --> copy */ + memcpy( DISTR.mean, mean, distr->dim * sizeof(double) ); + + else /* mean == NULL --> use zero vector instead */ + for (i=0; idim; i++) + DISTR.mean[i] = 0.; + + /* changelog */ + distr->set |= UNUR_DISTR_SET_MEAN; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_cvec_set_mean() */ + +/*---------------------------------------------------------------------------*/ + +const double * +unur_distr_cvec_get_mean( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get mean vector of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to mean of distribution */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CVEC, NULL ); + + /* mean vector known ? */ + if ( !(distr->set & UNUR_DISTR_SET_MEAN) ) { + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"mean"); + return NULL; + } + + return DISTR.mean; + +} /* end of unur_distr_cvec_get_mean() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_covar( struct unur_distr *distr, const double *covar ) + /*----------------------------------------------------------------------*/ + /* set covariance matrix of distribution. */ + /* as a side effect it also computes its cholesky factor. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* covar ... covariance matrix of distribution */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ +#define idx(a,b) ((a)*dim+(b)) + + int i,j; + int dim; + + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + dim = distr->dim; + + /* mark as unknown */ + distr->set &= ~( UNUR_DISTR_SET_COVAR + | UNUR_DISTR_SET_COVAR_IDENT + | UNUR_DISTR_SET_CHOLESKY + | UNUR_DISTR_SET_COVAR_INV ); + + /* we have to allocate memory first */ + if (DISTR.covar == NULL) + DISTR.covar = _unur_xmalloc( dim * dim * sizeof(double) ); + if (DISTR.cholesky == NULL) + DISTR.cholesky = _unur_xmalloc( dim * dim * sizeof(double) ); + + /* if covar == NULL --> use identity matrix */ + if (covar==NULL) { + for (i=0; iset |= UNUR_DISTR_SET_COVAR_IDENT; + } + + /* covariance matrix given --> copy data */ + else { + + /* check covariance matrix: diagonal entries > 0 */ + for (i=0; iname ,UNUR_ERR_DISTR_DOMAIN,"variance <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* check for symmetry */ + for (i=0; iname ,UNUR_ERR_DISTR_DOMAIN, + "covariance matrix not symmetric"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy data */ + memcpy( DISTR.covar, covar, dim * dim * sizeof(double) ); + + /* compute Cholesky decomposition and check for positive definitness */ + if (_unur_matrix_cholesky_decomposition(dim, covar, DISTR.cholesky) != UNUR_SUCCESS) { + _unur_error(distr->name, UNUR_ERR_DISTR_DOMAIN, + "covariance matrix not positive definite"); + return UNUR_ERR_DISTR_DOMAIN; + } + + } + + /* changelog */ + distr->set |= UNUR_DISTR_SET_COVAR | UNUR_DISTR_SET_CHOLESKY; + + /* o.k. */ + return UNUR_SUCCESS; + +#undef idx +} /* end of unur_distr_cvec_set_covar() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_covar_inv( struct unur_distr *distr, const double *covar_inv ) + /*----------------------------------------------------------------------*/ + /* set inverse of covariance matrix of distribution. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* covar_inv ... inverse of covariance matrix of distribution */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ +#define idx(a,b) ((a)*dim+(b)) + + int i,j; + int dim; + + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + dim = distr->dim; + + /* mark as unknown */ + distr->set &= ~(UNUR_DISTR_SET_COVAR_INV); + + /* we have to allocate memory first */ + if (DISTR.covar_inv == NULL) + DISTR.covar_inv = _unur_xmalloc( dim * dim * sizeof(double) ); + + /* if covar_inv == NULL --> use identity matrix */ + if (covar_inv==NULL) + for (i=0; i copy data */ + else { + + /* check inverse of covariance matrix: diagonal entries > 0 */ + for (i=0; iname ,UNUR_ERR_DISTR_DOMAIN,"diagonals <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* check for symmetry */ + for (i=0; iname ,UNUR_ERR_DISTR_DOMAIN, + "inverse of covariance matrix not symmetric"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy data */ + memcpy( DISTR.covar_inv, covar_inv, dim * dim * sizeof(double) ); + + } + + /* changelog */ + distr->set |= UNUR_DISTR_SET_COVAR_INV; + + /* o.k. */ + return UNUR_SUCCESS; + +#undef idx +} /* end of unur_distr_cvec_set_covar_inv() */ + +/*---------------------------------------------------------------------------*/ + +const double * +unur_distr_cvec_get_covar( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get covariance matrix of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to covariance matrix of distribution */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CVEC, NULL ); + + /* covariance matrix known ? */ + if ( !(distr->set & UNUR_DISTR_SET_COVAR) ) { + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"covariance matrix"); + return NULL; + } + + return DISTR.covar; + +} /* end of unur_distr_cvec_get_covar() */ + +/*---------------------------------------------------------------------------*/ + +const double * +unur_distr_cvec_get_cholesky( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get cholesky factor of the covariance matrix of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to cholesky factor */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CVEC, NULL ); + + /* covariance matrix known ? */ + if ( !(distr->set & UNUR_DISTR_SET_CHOLESKY) ) { + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"covariance matrix"); + return NULL; + } + + return DISTR.cholesky; + +} /* end of unur_distr_cvec_get_covar_cholesky() */ + +/*---------------------------------------------------------------------------*/ + +const double * +unur_distr_cvec_get_covar_inv ( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get inverse covariance matrix of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to inverse of covariance matrix */ + /*----------------------------------------------------------------------*/ +{ + + double det; /* determinant of covariance matrix */ + int dim; + + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CVEC, NULL ); + + dim = distr->dim; + + /* covariance matrix known ? */ + if ( !(distr->set & UNUR_DISTR_SET_COVAR) ) { + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"covariance matrix not known"); + return NULL; + } + + /* allocate memory */ + if (DISTR.covar_inv == NULL) + DISTR.covar_inv = _unur_xmalloc( dim * dim * sizeof(double) ); + + if ( !(distr->set & UNUR_DISTR_SET_COVAR_INV) ) { + /* calculate inverse covariance matrix */ + if (_unur_matrix_invert_matrix(dim, DISTR.covar, DISTR.covar_inv, &det) != UNUR_SUCCESS) { + _unur_error(distr->name ,UNUR_ERR_DISTR_DOMAIN,"cannot compute inverse of covariance"); + return NULL; + } + } + + /* changelog */ + distr->set |= UNUR_DISTR_SET_COVAR_INV; + + return DISTR.covar_inv; + +} /* end of unur_distr_cvec_get_covar_inv() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_rankcorr( struct unur_distr *distr, const double *rankcorr ) + /*----------------------------------------------------------------------*/ + /* Set rank-correlation matrix of distribution. */ + /* The given matrix is checked for symmetry and positive definitness. */ + /* The diagonal entries must be equal to 1. */ + /* As a side effect it also computes its cholesky factor. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* rankcorr ... rankcorrelation matrix of distribution */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ +#define idx(a,b) ((a)*dim+(b)) + + int i,j; + int dim; + + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + dim = distr->dim; + + /* mark as unknown */ + distr->set &= ~(UNUR_DISTR_SET_RANKCORR | UNUR_DISTR_SET_RK_CHOLESKY); + + /* we have to allocate memory first */ + if (DISTR.rankcorr == NULL) + DISTR.rankcorr = _unur_xmalloc( dim * dim * sizeof(double) ); + if (DISTR.rk_cholesky == NULL) + DISTR.rk_cholesky = _unur_xmalloc( dim * dim * sizeof(double) ); + + /* if rankcorr == NULL --> use identity matrix */ + if (rankcorr==NULL) { + for (i=0; i copy data */ + else { + + /* check rankcorriance matrix: diagonal entries == 1 */ + for (i=0; iname ,UNUR_ERR_DISTR_DOMAIN,"diagonals != 1"); + return UNUR_ERR_DISTR_DOMAIN; + } + } + + /* check for symmetry */ + for (i=0; iname ,UNUR_ERR_DISTR_DOMAIN, + "rank-correlation matrix not symmetric"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy data */ + memcpy( DISTR.rankcorr, rankcorr, dim * dim * sizeof(double) ); + + /* compute Cholesky decomposition and check for positive definitness */ + if (_unur_matrix_cholesky_decomposition(dim, rankcorr, DISTR.rk_cholesky) != UNUR_SUCCESS) { + _unur_error(distr->name, UNUR_ERR_DISTR_DOMAIN, + "rankcorriance matrix not positive definite"); + return UNUR_ERR_DISTR_DOMAIN; + } + + } + + /* changelog */ + distr->set |= UNUR_DISTR_SET_RANKCORR | UNUR_DISTR_SET_RK_CHOLESKY; + + /* o.k. */ + return UNUR_SUCCESS; + +#undef idx +} /* end of unur_distr_cvec_set_rankcorr() */ + +/*---------------------------------------------------------------------------*/ + +const double * +unur_distr_cvec_get_rankcorr( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get rank-correlation matrix of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to rank-correlation matrix of distribution */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CVEC, NULL ); + + /* rankcorriance matrix known ? */ + if ( !(distr->set & UNUR_DISTR_SET_RANKCORR) ) { + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"rank-correlation matrix"); + return NULL; + } + + return DISTR.rankcorr; + +} /* end of unur_distr_cvec_get_rankcorr() */ + +/*---------------------------------------------------------------------------*/ + +const double * +unur_distr_cvec_get_rk_cholesky( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get cholesky factor of the rank correlation matrix of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to cholesky factor */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CVEC, NULL ); + + /* covariance matrix known ? */ + if ( !(distr->set & UNUR_DISTR_SET_RK_CHOLESKY) ) { + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"rank correlation matrix"); + return NULL; + } + + return DISTR.rk_cholesky; + +} /* end of unur_distr_cvec_get_rk_cholesky() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_marginals ( struct unur_distr *distr, struct unur_distr *marginal) + /*----------------------------------------------------------------------*/ + /* Copy marginal distribution into distribution object. */ + /* Only one local copy is made. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* marginal ... pointer to marginal distribution object */ + /* */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_distr *clone; + int i; + + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + _unur_check_NULL( distr->name, marginal, UNUR_ERR_NULL ); + _unur_check_distr_object( marginal, CONT, UNUR_ERR_DISTR_INVALID ); + + /* first we have to check whether there is already a list of marginal distributions */ + if (DISTR.marginals) + _unur_distr_cvec_marginals_free(DISTR.marginals, distr->dim); + + /* make copy of marginal distribution object */ + clone = _unur_distr_clone( marginal ); + + /* allocate memory for array */ + DISTR.marginals = _unur_xmalloc (distr->dim * sizeof(struct unur_distr *)); + + /* copy pointer */ + for (i=0; idim; i++) + DISTR.marginals[i] = clone; + + /* changelog */ + distr->set |= UNUR_DISTR_SET_MARGINAL; + + return UNUR_SUCCESS; +} /* end of unur_distr_cvec_set_marginals() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_marginal_array ( struct unur_distr *distr, struct unur_distr **marginals) + /*----------------------------------------------------------------------*/ + /* Copy marginal distributions into distribution object. */ + /* For each dimension a new copy is made even if the pointer in */ + /* the array marginals coincide. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* marginals ... pointer to array of marginal distribution objects */ + /* */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + _unur_check_NULL( distr->name, marginals, UNUR_ERR_NULL ); + + for (i=0; idim; i++) { + _unur_check_NULL( distr->name, *(marginals+i), UNUR_ERR_NULL ); + _unur_check_distr_object( *(marginals+i), CONT, UNUR_ERR_DISTR_INVALID ); + } + + /* first we have to check whether there is already a list of marginal distributions */ + if (DISTR.marginals) + _unur_distr_cvec_marginals_free(DISTR.marginals, distr->dim); + + /* allocate memory for array */ + DISTR.marginals = _unur_xmalloc (distr->dim * sizeof(struct unur_distr *)); + + /* make copy of marginal distribution objects */ + for (i=0; idim; i++) + DISTR.marginals[i] = _unur_distr_clone( *(marginals+i) ); + + /* changelog */ + distr->set |= UNUR_DISTR_SET_MARGINAL; + + return UNUR_SUCCESS; +} /* end of unur_distr_cvec_set_marginal_array() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_marginal_list ( struct unur_distr *distr, ... ) + /*----------------------------------------------------------------------*/ + /* Copy marginal distributions into distribution object. */ + /* For each dimenision there must be a pointer to a discribution object.*/ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* ... ... pointer to array of marginal distribution objects */ + /* */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* IMPORTANT: */ + /* All marginal distribution objects are destroyed after they have */ + /* been copied into the distribution object. */ + /*----------------------------------------------------------------------*/ +{ + int i; + int failed = FALSE; + struct unur_distr *marginal; + struct unur_distr **marginal_list; + va_list vargs; + + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + /* allocate memory for array */ + marginal_list = _unur_xmalloc (distr->dim * sizeof(struct unur_distr *)); + for (i=0; idim; i++) marginal_list[i] = NULL; + + /* make copy of marginal distribution objects */ + va_start(vargs, distr); + for (i=0; idim; i++) { + marginal = (struct unur_distr *) va_arg(vargs, struct unur_distr *); + if (marginal) { + marginal_list[i] = _unur_distr_clone( marginal ); + _unur_distr_free(marginal); + } + else { + failed = TRUE; + } + } + va_end(vargs); + + if (failed) { + /* some of the pointers are NULL pointers */ + _unur_distr_cvec_marginals_free(marginal_list, distr->dim); + _unur_error(distr->name ,UNUR_ERR_DISTR_SET,"marginals == NULL"); + return UNUR_ERR_DISTR_SET; + } + + /* copy list of marginal distributions. However, first we have to check */ + /* whether there is already a list of marginal distributions. */ + if (DISTR.marginals) + _unur_distr_cvec_marginals_free(DISTR.marginals, distr->dim); + + DISTR.marginals = marginal_list; + + /* changelog */ + distr->set |= UNUR_DISTR_SET_MARGINAL; + + return UNUR_SUCCESS; +} /* end of unur_distr_cvec_set_marginal_list() */ + +/*---------------------------------------------------------------------------*/ + +const struct unur_distr * +unur_distr_cvec_get_marginal( const struct unur_distr *distr, int n ) + /*----------------------------------------------------------------------*/ + /* Get pointer to marginal distribution object. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* n ... position of marginal distribution object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CVEC, NULL ); + + if (n<=0 || n > distr->dim) { + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"n not in 1 .. dim"); + return NULL; + } + + /* marginal distributions known ? */ + if ( !(distr->set & UNUR_DISTR_SET_MARGINAL) ) { + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"marginals"); + return NULL; + } + + _unur_check_NULL( distr->name, DISTR.marginals, NULL ); + + /* return marginal distribution object */ + return (DISTR.marginals[n-1]); +} /* end of unur_distr_cvec_get_marginal() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr ** +_unur_distr_cvec_marginals_clone ( struct unur_distr **marginals, int dim ) + /*----------------------------------------------------------------------*/ + /* copy (clone) list of marginal distribution objects */ + /* */ + /* parameters: */ + /* marginals ... pointer to list of marginal distribution objects */ + /* dim ... number of marginal distributions */ + /* */ + /* return: */ + /* pointer to clone of list of marginal distribution objects */ + /*----------------------------------------------------------------------*/ +{ + struct unur_distr **clone; + int i; + + _unur_check_NULL( NULL, marginals, NULL ); + + /* check dimension */ + if (dim < 1) { + _unur_error(NULL,UNUR_ERR_DISTR_SET,"dimension < 1"); + return NULL; + } + + /* allocate memory for array */ + clone = _unur_xmalloc (dim * sizeof(struct unur_distr *)); + + if (_unur_distr_cvec_marginals_are_equal(marginals, dim)) { + clone[0] = _unur_distr_clone( marginals[0] ); + for (i=1; iset & UNUR_DISTR_SET_MARGINAL) || marginal==NULL ) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,"marginals"); + return UNUR_ERR_DISTR_DATA; + } + + /* marginal distribution are equal ? */ + if (!_unur_distr_cvec_marginals_are_equal(DISTR.marginals,distr->dim)) { + /* nothing to do */ + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,"marginals not equal"); + return UNUR_ERR_DISTR_DATA; + } + + /* make copy of marginal distribution objects */ + for (i=1; idim; i++) + DISTR.marginals[i] = _unur_distr_clone( marginal ); + + return UNUR_SUCCESS; +} /* end of _unur_distr_cvec_duplicate_firstmarginal() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_pdfparams( struct unur_distr *distr, const double *params, int n_params ) + /*----------------------------------------------------------------------*/ + /* set array of parameters for distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* params ... list of arguments */ + /* n_params ... number of arguments */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_NULL( NULL, params, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + if (n_params>0) _unur_check_NULL(distr->name,params,UNUR_ERR_NULL); + + /* check number of new parameter for the distribution */ + if (n_params < 0 || n_params > UNUR_DISTR_MAXPARAMS ) { + _unur_error(distr->name,UNUR_ERR_DISTR_NPARAMS,""); + return UNUR_ERR_DISTR_NPARAMS; + } + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + DISTR.n_params = n_params; + if (n_params) memcpy( DISTR.params, params, n_params*sizeof(double) ); + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_cvec_set_pdfparams() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_get_pdfparams( const struct unur_distr *distr, const double **params ) + /*----------------------------------------------------------------------*/ + /* get number of pdf parameters and sets pointer to array params[] of */ + /* parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* params ... pointer to list of arguments */ + /* */ + /* return: */ + /* number of pdf parameters */ + /* */ + /* error: */ + /* return 0 */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, 0 ); + _unur_check_distr_object( distr, CVEC, 0 ); + + *params = (DISTR.n_params) ? DISTR.params : NULL; + return DISTR.n_params; + +} /* end of unur_distr_cvec_get_pdfparams() */ + + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_pdfparams_vec( struct unur_distr *distr, int par, const double *param_vec, int n_param_vec ) + /*----------------------------------------------------------------------*/ + /* set vector array parameters for distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* par ... which parameter is set */ + /* param_vec ... parameter array with number `par' */ + /* n_param_vec ... length of parameter array */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + /* check new parameter for distribution */ + if (par < 0 || par >= UNUR_DISTR_MAXPARAMS ) { + _unur_error(distr->name,UNUR_ERR_DISTR_NPARAMS,""); + return UNUR_ERR_DISTR_NPARAMS; + } + + + if (param_vec != NULL) { + /* allocate memory */ + DISTR.param_vecs[par] = _unur_xrealloc( DISTR.param_vecs[par], n_param_vec * sizeof(double) ); + /* copy parameters */ + memcpy( DISTR.param_vecs[par], param_vec, n_param_vec*sizeof(double) ); + /* set length of array */ + DISTR.n_param_vec[par] = n_param_vec; + } + else { + if (DISTR.param_vecs[par]) free(DISTR.param_vecs[par]); + DISTR.n_param_vec[par] = 0; + } + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_cvec_set_pdfparams_vec() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_get_pdfparams_vec( const struct unur_distr *distr, int par, const double **param_vecs ) + /*----------------------------------------------------------------------*/ + /* get number of PDF parameters and sets pointer to array params[] of */ + /* parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* par ... which parameter is read */ + /* params ... pointer to parameter array with number `par' */ + /* */ + /* return: */ + /* length of parameter array with number `par' */ + /* */ + /* error: */ + /* return 0 */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, 0 ); + _unur_check_distr_object( distr, CVEC, 0 ); + + /* check new parameter for distribution */ + if (par < 0 || par >= UNUR_DISTR_MAXPARAMS ) { + _unur_error(distr->name,UNUR_ERR_DISTR_NPARAMS,""); + *param_vecs = NULL; + return 0; + } + + *param_vecs = DISTR.param_vecs[par]; + + return (*param_vecs) ? DISTR.n_param_vec[par] : 0; +} /* end of unur_distr_cvec_get_pdfparams_vec() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_mode( struct unur_distr *distr, const double *mode ) + /*----------------------------------------------------------------------*/ + /* set mode of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* mode ... mode of PDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + /* we have to allocate memory first */ + if (DISTR.mode == NULL) + DISTR.mode = _unur_xmalloc( distr->dim * sizeof(double) ); + + if (mode) + /* mode vector given --> copy */ + memcpy( DISTR.mode, mode, distr->dim * sizeof(double) ); + + else /* mode == NULL --> use zero vector instead */ + for (i=0; idim; i++) + DISTR.mode[i] = 0.; + + /* changelog */ + distr->set |= UNUR_DISTR_SET_MODE; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_cvec_set_mode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_upd_mode( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* (re-) compute mode of distribution (if possible) */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + if (DISTR.upd_mode == NULL) { + /* no function to compute mode available */ + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_ERR_DISTR_DATA; + } + + /* compute mode */ + if ((DISTR.upd_mode)(distr)==UNUR_SUCCESS) { + /* changelog */ + distr->set |= UNUR_DISTR_SET_MODE; + return UNUR_SUCCESS; + } + else { + /* computing of mode failed */ + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_ERR_DISTR_DATA; + } + +} /* end of unur_distr_cvec_upd_mode() */ + +/*---------------------------------------------------------------------------*/ + +const double * +unur_distr_cvec_get_mode( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get mode of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to mode of distribution */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CVEC, NULL ); + + /* mode known ? */ + if ( !(distr->set & UNUR_DISTR_SET_MODE) ) { + /* try to compute mode */ + if (DISTR.upd_mode == NULL) { + /* no function to compute mode available */ + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"mode"); + return NULL; + } + else { + /* compute mode */ + if (unur_distr_cvec_upd_mode(distr)!=UNUR_SUCCESS) { + /* finding mode not successfully */ + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"mode"); + return NULL; + } + } + } + + return DISTR.mode; + +} /* end of unur_distr_cvec_get_mode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_center( struct unur_distr *distr, const double *center ) + /*----------------------------------------------------------------------*/ + /* set center of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* center ... center of PDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + /* we have to allocate memory first */ + if (DISTR.center == NULL) + DISTR.center = _unur_xmalloc( distr->dim * sizeof(double) ); + + if (center) + /* center vector given --> copy */ + memcpy( DISTR.center, center, distr->dim * sizeof(double) ); + + else /* center == NULL --> use zero vector instead */ + for (i=0; idim; i++) + DISTR.center[i] = 0.; + + /* changelog */ + distr->set |= UNUR_DISTR_SET_CENTER; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_cvec_set_center() */ + +/*---------------------------------------------------------------------------*/ + +const double * +unur_distr_cvec_get_center( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get center of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to center of distribution */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CVEC, NULL ); + + /* center given */ + if ( distr->set & UNUR_DISTR_SET_CENTER ) + return DISTR.center; + + /* else try mode */ + if ( distr->set & UNUR_DISTR_SET_MODE ) + return DISTR.mode; + + /* else try mean */ + if ( distr->set & UNUR_DISTR_SET_MEAN ) + return DISTR.mean; + + /* otherwise use (0,...,0) */ + if ( DISTR.center == NULL ) + DISTR.center = _unur_xmalloc( distr->dim * sizeof(double) ); + for (i=0; idim; i++) + DISTR.center[i] = 0.; + + return DISTR.center; + +} /* end of unur_distr_cvec_get_center() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_pdfvol( struct unur_distr *distr, double volume ) + /*----------------------------------------------------------------------*/ + /* set volume below PDF */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* volume ... volume below PDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + /* check new parameter for distribution */ + if (volume <= 0.) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"PDF volume <= 0"); + return UNUR_ERR_DISTR_SET; + } + + DISTR.volume = volume; + + /* changelog */ + distr->set |= UNUR_DISTR_SET_PDFVOLUME; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_distr_cvec_set_pdfvol() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_upd_pdfvol( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* (re-) compute volume below p.d.f. of distribution (if possible) */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + if (DISTR.upd_volume == NULL) { + /* no function to compute mode available */ + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_ERR_DISTR_DATA; + } + + /* compute area */ + if (((DISTR.upd_volume)(distr)!=UNUR_SUCCESS) || DISTR.volume <= 0.) { + /* computing of area failed */ + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"upd volume <= 0"); + DISTR.volume = 1.; /* avoid possible floating point exceptions */ + distr->set &= ~UNUR_DISTR_SET_PDFVOLUME; + return UNUR_ERR_DISTR_SET; + } + + /* changelog */ + distr->set |= UNUR_DISTR_SET_PDFVOLUME; + + return UNUR_SUCCESS; +} /* end of unur_distr_cvec_upd_pdfvol() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_cvec_get_pdfvol( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get volume below PDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* volume below PDF of distribution */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, CVEC, UNUR_INFINITY ); + + /* volume known ? */ + if ( !(distr->set & UNUR_DISTR_SET_PDFVOLUME) ) { + /* try to compute volume */ + if (DISTR.upd_volume == NULL) { + /* no function to compute area available */ + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"volume"); + return UNUR_INFINITY; + } + else { + /* compute area */ + unur_distr_cvec_upd_pdfvol( distr ); + } + } + + return DISTR.volume; + +} /* end of unur_distr_cvec_get_pdfvol() */ + +/*****************************************************************************/ +/* call PDFs and their derivatives */ +/* (internal functions. no checking for NULL pointer) */ + +double +_unur_cvec_PDF(const double *x, struct unur_distr *distr) +{ + if ( (distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) && + !_unur_distr_cvec_is_indomain(x, distr) ) + return 0.; + + return (*(distr->data.cvec.pdf)) (x,distr); +} + +int +_unur_cvec_dPDF(double *result, const double *x, struct unur_distr *distr) +{ + int d; + if ( (distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) && + !_unur_distr_cvec_is_indomain(x, distr) ) { + for (d=0; d < distr->dim; d++) result[d] = 0.; + return UNUR_SUCCESS; + } + + return (*(distr->data.cvec.dpdf)) (result,x,distr); +} + +double +_unur_cvec_pdPDF(const double *x, int coord, struct unur_distr *distr) +{ + if ( (distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) && + !_unur_distr_cvec_is_indomain(x, distr) ) + return 0.; + + return (*(distr->data.cvec.pdpdf)) (x,coord,distr); +} + +double +_unur_cvec_logPDF(const double *x, struct unur_distr *distr) +{ + if ( (distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) && + !_unur_distr_cvec_is_indomain(x, distr) ) + return -UNUR_INFINITY; + + return (*(distr->data.cvec.logpdf)) (x,distr); +} + +int +_unur_cvec_dlogPDF(double *result, const double *x, struct unur_distr *distr) +{ + int d; + if ( (distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) && + !_unur_distr_cvec_is_indomain(x, distr) ) { + for (d=0; d < distr->dim; d++) result[d] = 0.; + return UNUR_SUCCESS; + } + + return (*(distr->data.cvec.dlogpdf)) (result,x,distr); +} + +double +_unur_cvec_pdlogPDF(const double *x, int coord, struct unur_distr *distr) +{ + if ( (distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) && + !_unur_distr_cvec_is_indomain(x, distr) ) + return 0.; + + return (*(distr->data.cvec.pdlogpdf)) (x,coord,distr); +} + +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_distr_cvec_debug( const struct unur_distr *distr, const char *genid ) + /*----------------------------------------------------------------------*/ + /* write info about distribution into LOG file */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* genid ... pointer to generator id */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + double *mat; + + /* check arguments */ + CHECK_NULL(distr,RETURN_VOID); + COOKIE_CHECK(distr,CK_DISTR_CVEC,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: distribution:\n",genid); + fprintf(LOG,"%s:\ttype = continuous multivariate distribution\n",genid); + fprintf(LOG,"%s:\tname = %s\n",genid,distr->name); + + fprintf(LOG,"%s:\tdimension = %d\n",genid,distr->dim); + + fprintf(LOG,"%s:\tfunctions: ",genid); + if (DISTR.pdf) fprintf(LOG,"PDF "); + if (DISTR.logpdf) fprintf(LOG,"logPDF "); + if (DISTR.dpdf) fprintf(LOG,"dPDF "); + if (DISTR.dlogpdf) fprintf(LOG,"dlogPDF "); + if (DISTR.pdpdf) fprintf(LOG,"pdPDF "); + if (DISTR.pdlogpdf) fprintf(LOG,"pdlogPDF "); + fprintf(LOG,"\n%s:\n",genid); + + /* domain */ + fprintf(LOG,"%s:\tdomain = ",genid); + if (!(distr->set & UNUR_DISTR_SET_DOMAINBOUNDED)) { + fprintf(LOG,"unbounded\n"); + } + else { + if (DISTR.domainrect) { + double *domain = DISTR.domainrect; + int i; + fprintf(LOG,"rectangular\n"); + for (i=0; idim; i++) + fprintf(LOG,"%s:\t %c ( %g, %g)\n",genid, i?'x':' ', + domain[2*i], domain[2*i+1]); + } + } + fprintf(LOG,"%s:\n",genid); + + /* mode */ + mat = ((distr->set & UNUR_DISTR_SET_MODE) && DISTR.mode) ? DISTR.mode : NULL; + _unur_matrix_print_vector( distr->dim, mat, "\tmode =", LOG, genid, "\t "); + + /* mean vector */ + mat = ((distr->set & UNUR_DISTR_SET_MEAN) && DISTR.mean) ? DISTR.mean : NULL; + _unur_matrix_print_vector( distr->dim, mat, "\tmean vector =", LOG, genid, "\t "); + + /* center vector */ + if ((distr->set & UNUR_DISTR_SET_CENTER) && DISTR.center) + _unur_matrix_print_vector( distr->dim, DISTR.center, "\tcenter vector =", LOG, genid, "\t "); + else { + fprintf(LOG,"%s:\tcenter = mode [not given explicitly]\n",genid); + fprintf(LOG,"%s:\n",genid); + } + + /* covariance matrix */ + mat = ((distr->set & UNUR_DISTR_SET_COVAR) && DISTR.covar) ? DISTR.covar : NULL; + _unur_matrix_print_matrix( distr->dim, mat, "\tcovariance matrix =", LOG, genid, "\t "); + + /* inverse covariance matrix */ + /* mat = ((distr->set & UNUR_DISTR_SET_COVAR_INV) && DISTR.covar_inv) ? DISTR.covar_inv : NULL; */ + /* _unur_matrix_print_matrix( distr->dim, mat, "\tinverse covariance matrix =", LOG, genid, "\t "); */ + + /* cholesky factor of covariance matrix */ + mat = ((distr->set & UNUR_DISTR_SET_CHOLESKY) && DISTR.cholesky) ? DISTR.cholesky : NULL; + _unur_matrix_print_matrix( distr->dim, mat, "\tcholesky factor of covariance matrix =", LOG, genid, "\t "); + + /* rank correlation matrix */ + mat = ((distr->set & UNUR_DISTR_SET_RANKCORR) && DISTR.rankcorr) ? DISTR.rankcorr : NULL; + _unur_matrix_print_matrix( distr->dim, mat, "\trank correlation matrix =", LOG, genid, "\t "); + + /* cholesky factor of rank correlation matrix */ + mat = ((distr->set & UNUR_DISTR_SET_RK_CHOLESKY) && DISTR.rk_cholesky) ? DISTR.rk_cholesky : NULL; + _unur_matrix_print_matrix( distr->dim, mat, "\tcholesky factor of rank correlation matrix =", LOG, genid, "\t "); + + /* marginal distributions */ + fprintf(LOG,"%s:\tmarginal distributions:\n",genid); + if (distr->set & UNUR_DISTR_SET_MARGINAL) { + if (_unur_distr_cvec_marginals_are_equal(DISTR.marginals, distr->dim)) { + fprintf(LOG,"%s: all mariginals [1-%d]:\n",genid,distr->dim); + _unur_distr_cont_debug( DISTR.marginals[0], genid ); + } + else { + int i; + for (i=0; idim; i++) { + fprintf(LOG,"%s: mariginal [%d]:\n",genid,i+1); + _unur_distr_cont_debug( DISTR.marginals[i], genid ); + } + } + } + else { + fprintf(LOG,"%s:\t [unknown]\n",genid); + } + fprintf(LOG,"%s:\n",genid); + +#ifdef USE_DEPRECATED_CODE + /* standardized marginal distributions */ + fprintf(LOG,"%s:\tstandardized marginal distributions: [see also marginal distributions]\n",genid); + if (distr->set & UNUR_DISTR_SET_STDMARGINAL) { + if (_unur_distr_cvec_marginals_are_equal(DISTR.stdmarginals, distr->dim)) { + fprintf(LOG,"%s: all standardized mariginals [1-%d]:\n",genid,distr->dim); + _unur_distr_cont_debug( DISTR.stdmarginals[0], genid ); + } + else { + int i; + for (i=0; idim; i++) { + fprintf(LOG,"%s: mariginal [%d]:\n",genid,i+1); + _unur_distr_cont_debug( DISTR.stdmarginals[i], genid ); + } + } + } + else { + fprintf(LOG,"%s:\t [unknown]\n",genid); + } + fprintf(LOG,"%s:\n",genid); +#endif + +} /* end of _unur_distr_cvec_debug() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +#undef DISTR +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/distr/cvec.h b/vendor/unuran-1.11.0/src/distr/cvec.h new file mode 100644 index 0000000..c8236d4 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/cvec.h @@ -0,0 +1,733 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: cvec.h * + * * + * PURPOSE: * + * function prototypes for manipulating distribution objects of * + * type CVEC (continuous multivariate distribution) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/* + =NODEX CVEC Continuous multivariate distributions + + =UP Distribution_objects [30] + + =DESCRIPTION + The following calls handle multivariate distributions. + However, the requirements of particular generation methods is not + as unique as for univariate distributions. Moreover, random vector + generation methods are still under development. + The below functions are a first attempt to handle this situation. + + Notice that some of the parameters -- when given carelessly -- might + contradict to others. For example: Some methods require the + marginal distribution and some methods need a standardized form of + the marginal distributions, where the actual mean and variance is + stored in the mean vector and the covariance matrix, respectively. + + We also have to mention that some methods might abuse some of the + parameters. Please read the discription of the chosen sampling + method carfully. + + The following kind of calls exists: + + @itemize @minus + @item Create a @command{new} instance of a continuous multivariate + distribution; + + @item Handle and evaluate + probability density function (PDF, @command{pdf}) and the + gradient of the density function (@command{dpdf}). + The following is important: + @itemize . + @item @command{pdf} need not be normalized, i.e., + any integrable nonnegative function can be used. + @item @command{dpdf} must the derivate of the function provided + as @command{pdf}. + @end itemize + + @item Handle and evaluate + the logarithm of the probability density function (logPDF, + @command{logpdf}) and the gradient of the logarithm of the + density function (@command{dlogpdf}). + + Some methods use the logarithm of the density if available. + + @item Set (and change) parameters (@command{pdfparams}) and the + volume below the graph (@command{pdfvol}) of the given density. + + @item Set @command{mode} and @command{mean} of the distribution. + + @item Set the @command{center} of the distribution. + It is used by some generation methods to adjust the parameters + of the generation algorithms to gain better performance. It can + be seens as the location of the ``central part'' of the + distribution. + + @item Handle the @command{covar}iance matrix of the distribution and + its @command{cholesky} and @command{inv}verse matrices. + + @item Set the @command{rankcorr}elation matrix of the distribution. + + @item Deal with @command{marginal} distributions. + + @item Set domain of the distribution. + + @end itemize + + =END +*/ + +/*---------------------------------------------------------------------------*/ + +/* + Routines for handling multivariate continuous distributions (CVEC). +*/ + +/* =ROUTINES */ + +UNUR_DISTR *unur_distr_cvec_new( int dim ); +/* + Create a new (empty) object for multivariate continuous + distribution. @var{dim} is the number of components of the random + vector (i.e. its dimension). It is also possible to use dimension 1. + Notice, however, that this is treated as a distribution of random + vectors with only one component and not as a distribution of + real numbers. For the latter unur_distr_cont_new() should be used + to create an object for a univariate distribution. +*/ + +/* ==DOC + @subsubheading Essential parameters +*/ + +int unur_distr_cvec_set_pdf( UNUR_DISTR *distribution, UNUR_FUNCT_CVEC *pdf ); +/* + Set respective pointer to the PDF of the @var{distribution}. + This function must be of type + @code{double funct(const double *x, UNUR_DISTR *distr)}, + where @var{x} must be a pointer to a double array of appropriate + size (i.e. of the same size as given to the unur_distr_cvec_new() + call). + + It is not necessary that the given PDF is normalized, i.e. the + integral need not be 1. + Nevertheless the volume below the PDF can be provided by a + unur_distr_cvec_set_pdfvol() call. + + It is not possible to change the PDF. Once the PDF is set it cannot + be overwritten. This also holds when the logPDF is given. + A new distribution object has to be used instead. +*/ + +int unur_distr_cvec_set_dpdf( UNUR_DISTR *distribution, UNUR_VFUNCT_CVEC *dpdf ); +/* + Set pointer to the gradient of the PDF. The type of this function must be + @code{int funct(double *result, const double *x, UNUR_DISTR *distr)}, + where @var{result} and @var{x} must be pointers to double arrays of + appropriate size (i.e. of the same size as given to the + unur_distr_cvec_new() call). + The gradient of the PDF is stored in the array @var{result}. + The function should return an error code in case of an error and must + return @code{UNUR_SUCCESS} otherwise. + + The given function must be the gradient of the function + given by a unur_distr_cvec_set_pdf() call. + + It is not possible to change the gradient of the PDF. Once the dPDF + is set it cannot be overwritten. This also holds when the gradient + of the logPDF is given. + A new distribution object has to be used instead. +*/ + +int unur_distr_cvec_set_pdpdf( UNUR_DISTR *distribution, UNUR_FUNCTD_CVEC *pdpdf ); +/* + Set pointer to partial derivatives of the PDF. The type of this function must be + @code{double funct(const double *x, int coord, UNUR_DISTR *distr)}, + where @var{x} must be a pointer to a double array of appropriate + size (i.e. of the same size as given to the unur_distr_cvec_new() + call). @var{coord} is the coordinate for which the partial dervative should be + computed. + + Notice that @var{coord} must be an integer from @{0,@dots{},dim-1@}. + + It is not possible to change the partial derivative of the PDF. Once the pdPDF + is set it cannot be overwritten. This also holds when the partial derivative + of the logPDF is given. + A new distribution object has to be used instead. +*/ + +UNUR_FUNCT_CVEC *unur_distr_cvec_get_pdf( const UNUR_DISTR *distribution ); +/* + Get the pointer to the PDF of the @var{distribution}. The + pointer is of type + @code{double funct(const double *x, UNUR_DISTR *distr)}. + If the corresponding function is not available for the + @var{distribution}, the NULL pointer is returned. +*/ + +UNUR_VFUNCT_CVEC *unur_distr_cvec_get_dpdf( const UNUR_DISTR *distribution ); +/* + Get the pointer to the gradient of the PDF of the + @var{distribution}. The pointer is of type + @code{int double funct(double *result, const double *x, UNUR_DISTR *distr)}. + If the corresponding function is not available for the + @var{distribution}, the NULL pointer is returned. +*/ + +UNUR_FUNCTD_CVEC *unur_distr_cvec_get_pdpdf( const UNUR_DISTR *distribution ); +/* + Get the pointer to the partial derivative of the PDF of the @var{distribution}. + The pointer is of type + @code{double funct(const double *x, int coord, UNUR_DISTR *distr)}. + If the corresponding function is not available for the + @var{distribution}, the NULL pointer is returned. +*/ + +double unur_distr_cvec_eval_pdf( const double *x, UNUR_DISTR *distribution ); +/* + Evaluate the PDF of the @var{distribution} at @var{x}. + @var{x} must be a pointer to a double array of appropriate size + (i.e. of the same size as given to the unur_distr_cvec_new() call) + that contains the vector for which the function has to be evaluated. + + Notice that @var{distribution} must not be the NULL pointer. + If the corresponding function is not available for the + @var{distribution}, @code{UNUR_INFINITY} is returned and + @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. +*/ + +int unur_distr_cvec_eval_dpdf( double *result, const double *x, UNUR_DISTR *distribution ); +/* + Evaluate the gradient of the PDF of the @var{distribution} at + @var{x}. + The result is stored in the double array @var{result}. + Both @var{result} and @var{x} must be pointer to double arrays of + appropriate size (i.e. of the same size as given to the + unur_distr_cvec_new() call). + + Notice that @var{distribution} must not be the NULL pointer. + If the corresponding function is not available for the + @var{distribution}, an error code is returned and @code{unur_errno} + is set to @code{UNUR_ERR_DISTR_DATA} (@var{result} is left unmodified). +*/ + +double unur_distr_cvec_eval_pdpdf( const double *x, int coord, UNUR_DISTR *distribution ); +/* + Evaluate the partial derivative of the PDF of the @var{distribution} + at @var{x} for the coordinate @var{coord}. + @var{x} must be a pointer to a double array of appropriate size + (i.e. of the same size as given to the unur_distr_cvec_new() call) + that contains the vector for which the function has to be evaluated. + + Notice that @var{coord} must be an integer from @{0,@dots{},dim-1@}. + + Notice that @var{distribution} must not be the NULL pointer. + If the corresponding function is not available for the + @var{distribution}, @code{UNUR_INFINITY} is returned and + @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. +*/ + +int unur_distr_cvec_set_logpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CVEC *logpdf ); +/* */ + +int unur_distr_cvec_set_dlogpdf( UNUR_DISTR *distribution, UNUR_VFUNCT_CVEC *dlogpdf ); +/* */ + +int unur_distr_cvec_set_pdlogpdf( UNUR_DISTR *distribution, UNUR_FUNCTD_CVEC *pdlogpdf ); +/* */ + +UNUR_FUNCT_CVEC *unur_distr_cvec_get_logpdf( const UNUR_DISTR *distribution ); +/* */ + +UNUR_VFUNCT_CVEC *unur_distr_cvec_get_dlogpdf( const UNUR_DISTR *distribution ); +/* */ + +UNUR_FUNCTD_CVEC *unur_distr_cvec_get_pdlogpdf( const UNUR_DISTR *distribution ); +/* */ + +double unur_distr_cvec_eval_logpdf( const double *x, UNUR_DISTR *distribution ); +/* */ + +int unur_distr_cvec_eval_dlogpdf( double *result, const double *x, UNUR_DISTR *distribution ); +/* */ + +double unur_distr_cvec_eval_pdlogpdf( const double *x, int coord, UNUR_DISTR *distribution ); +/* + Analogous calls for the logarithm of the density function. +*/ + + +int unur_distr_cvec_set_mean( UNUR_DISTR *distribution, const double *mean ); +/* + Set mean vector for multivariate @var{distribution}. + @var{mean} must be a pointer to an array of size @code{dim}, where + @code{dim} is the dimension returned by unur_distr_get_dim(). + A NULL pointer for @var{mean} is interpreted as the zero + vector (0,@dots{},0). + + @strong{Important:} If the parameters of a distribution from the + UNU.RAN library of standard distributions + (@pxref{Stddist,,Standard distributions}) + are changed, then neither its mode nor the normalization + constant are updated. Please use the respective calls + unur_distr_cvec_upd_mode() and unur_distr_cvec_upd_pdfvol(). +*/ + +const double *unur_distr_cvec_get_mean( const UNUR_DISTR *distribution ); +/* + Get the mean vector of the @var{distribution}. The function returns a + pointer to an array of size @code{dim}. + If the mean vector is not marked as known the NULL pointer is + returned and @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_GET}. + + @emph{Important:} Do @strong{not} modify the array that holds the + mean vector! +*/ + +int unur_distr_cvec_set_covar( UNUR_DISTR *distribution, const double *covar ); +/* + Set covariance matrix for multivariate @var{distribution}. + @var{covar} must be a pointer to an array of size + @code{dim} x @code{dim}, where @code{dim} is the dimension returned + by unur_distr_get_dim(). The rows of the matrix have to be stored + consecutively in this array. + + @var{covar} must be a variance-covariance matrix of the + @var{distribution}, i.e. it must be symmetric and positive definit and + its diagonal entries (i.e. the variance of the components of the + random vector) must be strictly positive. + The Cholesky factor is computed (and stored) to verify the positive + definiteness condition. + Notice that the inverse of the given covariance matrix is + automatically computed when it is requested by some routine. + Notice that the computation of this inverse matrix is unstable in + case of high correlations and/or high dimensions. Thus it might + fail and methods that require this inverse cannot be used. + As an alternative the inverse of the covariance matrix can be + directly set by a unur_distr_cvec_set_covar_inv() call. + + A NULL pointer for @var{covar} is interpreted as the + identity matrix. + + @emph{Important:} This entry is abused in some methods which do not + require the covariance matrix. It is then used to perform some + transformation to obtain better performance. + + @emph{Important:} In case of an error (e.g. because @var{covar} is + not a valid covariance matrix) an error code is returned. + Moreover, the covariance matrix is not set and is marked as + unknown. A previously set covariance matrix is then no longer + available. + + @strong{Important:} If the parameters of a distribution from the + UNU.RAN library of standard distributions + (@pxref{Stddist,,Standard distributions}) + are changed, then neither its mode nor the normalization + constant are updated. Please use the respective calls + unur_distr_cvec_upd_mode() and unur_distr_cvec_upd_pdfvol(). + + @emph{Remark:} UNU.RAN does not check whether the an eventually + set covariance matrix and a rank-correlation matrix do not + contradict each other. +*/ + +int unur_distr_cvec_set_covar_inv( UNUR_DISTR *distribution, const double *covar_inv ); +/* + Set inverse of the covariance matrix for multivariate @var{distribution}. + @var{covar_inv} must be a pointer to an array of size + @code{dim} x @code{dim}, where @code{dim} is the dimension returned + by unur_distr_get_dim(). The rows of the matrix have to be stored + consecutively in this array. + + @var{covar_inv} must be symmetric and positive definit. Only the + symmetry of the matrix is checked. + + A NULL pointer for @var{covar_inv} is interpreted as the identity matrix. + + @emph{Important:} In case of an error (because @var{covar_inv} is + not symetric) an error code is returned. + Moreover, the inverse of the covariance matrix is not set and is + marked as unknown. A previously set inverse matrix is then no longer + available. + + @emph{Remark:} UNU.RAN does not check whether the given matrix is + positive definit. + + @emph{Remark:} UNU.RAN does not check whether the matrix + @var{covar_inv} is the inverse of the eventually set covariance + matrix. +*/ + + +const double *unur_distr_cvec_get_covar( const UNUR_DISTR *distribution ); +/* */ + +const double *unur_distr_cvec_get_cholesky( const UNUR_DISTR *distribution ); +/* */ + +const double *unur_distr_cvec_get_covar_inv( UNUR_DISTR *distribution ); +/* + Get covariance matrix of @var{distribution}, its Cholesky factor, + and its inverse, respectively. The function returns a + pointer to an array of size @code{dim} x @code{dim}. + The rows of the matrix are stored consecutively in this array. + If the requested matrix is not marked as known the NULL + pointer is returned and @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_GET}. + + @emph{Important:} Do @strong{not} modify the array that holds the + covariance matrix! + + @emph{Remark:} The inverse of the covariance matrix is computed + if it is not already stored. +*/ + +int unur_distr_cvec_set_rankcorr( UNUR_DISTR *distribution, const double *rankcorr ); +/* + Set rank-correlation matrix (Spearman's correlation) for + multivariate @var{distribution}. + @var{rankcorr} must be a pointer to an array of size + @code{dim} x @code{dim}, where @code{dim} is the dimension returned + by unur_distr_get_dim(). The rows of the matrix have to be stored + consecutively in this array. + + @var{rankcorr} must be a rank-correlation matrix of the + @var{distribution}, i.e. it must be symmetric and positive definite + and its diagonal entries must be equal to @code{1}. + + The Cholesky factor is computed (and stored) to verify the + positive definiteness condition. + + A NULL pointer for @var{rankcorr} is interpreted as the identity matrix. + + @emph{Important:} In case of an error (e.g. because @var{rankcorr} is + not a valid rank-correlation matrix) an error code is returned. + Moreover, the rank-correlation matrix is not set and is marked as + unknown. A previously set rank-correlation matrix is then no longer + available. + + @emph{Remark:} UNU.RAN does not check whether the an eventually + set covariance matrix and a rank-correlation matrix do not + contradict each other. +*/ + +const double *unur_distr_cvec_get_rankcorr( const UNUR_DISTR *distribution ); +/* */ + +const double *unur_distr_cvec_get_rk_cholesky( const UNUR_DISTR *distribution ); +/* + Get rank-correlation matrix and its cholesky factor, respectively, + of @var{distribution}. The function + returns a pointer to an array of size @code{dim} x @code{dim}. + The rows of the matrix are stored consecutively in this array. + If the requested matrix is not marked as known the NULL + pointer is returned and @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_GET}. + + @emph{Important:} Do @strong{not} modify the array that holds the + rank-correlation matrix! +*/ + +int unur_distr_cvec_set_marginals( UNUR_DISTR *distribution, UNUR_DISTR *marginal ); +/* + Sets marginal distributions of the given @var{distribution} to the + same @var{marginal} distribution object. The @var{marginal} + distribution must be an instance of a continuous univariate + distribution object. Notice that the marginal distribution is + copied into the @var{distribution} object. +*/ + +int unur_distr_cvec_set_marginal_array( UNUR_DISTR *distribution, UNUR_DISTR **marginals ); +/* + Analogously to the above unur_distr_cvec_set_marginals() call. + However, now an array @var{marginals} of the pointers to each of + the marginal distributions must be given. It @strong{must} be an + array of size @code{dim}, where @code{dim} is the dimension + returned by unur_distr_get_dim(). + + @emph{Notice}: Local copies for each of the entries are stored in + the @var{distribution} object. If some of these entries are + identical (i.e. contain the same pointer), then for each of these a + new copy is made. +*/ + +int unur_distr_cvec_set_marginal_list( UNUR_DISTR *distribution, ... ); +/* + Similar to the above unur_distr_cvec_set_marginal_array() call. + However, now the pointers to the particular marginal distributions + can be given as parameter and does not require an array of + pointers. Additionally the given distribution objects are + immediately destroyed. Thus calls like unur_distr_normal() can be + used as arguments. + (With unur_distr_cvec_set_marginal_array() the result of such call + has to be stored in a pointer since it has to be freed afterwarts + to avoid memory leaks!) + + The number of pointers to in the list of function arguments + @strong{must} be equal to the dimension of the @var{distribution}, + i.e. the dimension returned by unur_distr_get_dim(). + + If one of the given pointer to marginal distributions is the NULL + pointer then the marginal distributions of @var{distribution} are + not set (or previous settings are not changed) and an error code is + returned. + + @strong{Important:} All distribution objects given in the argument + list are destroyed! +*/ + +const UNUR_DISTR *unur_distr_cvec_get_marginal( const UNUR_DISTR *distribution, int n ); +/* + Get pointer to the @var{n}-th marginal distribution + object from the given multivariate @var{distribution}. + If this does not exist, NULL is returned. + The marginal distributions are enumerated from @code{1} + to @code{dim}, where @code{dim} is the dimension + returned by unur_distr_get_dim(). +*/ + +int unur_distr_cvec_set_pdfparams( UNUR_DISTR *distribution, const double *params, int n_params ); +/* + Sets array of parameters for @var{distribution}. There is an upper limit + for the number of parameters @code{n_params}. It is given by the + macro @code{UNUR_DISTR_MAXPARAMS} in @file{unuran_config.h}. (It is set to + 5 by default but can be changed to any appropriate nonnegative number.) + If @var{n_params} is negative or exceeds this limit no parameters + are copied into the distribution object and @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_NPARAMS}. + + For standard distributions from the UNU.RAN library the parameters + are checked. Moreover, the domain is updated automatically. + If the given parameters are invalid for the standard distribution, + then no parameters are set and an error code is returned. + Notice that the given parameter list for such a distribution is + handled in the same way as in the corresponding @command{new} + calls, i.e. optional parameters for the PDF that are not present in + the given list are (re-)set to their default values. + + @strong{Important:} If the parameters of a distribution from the + UNU.RAN library of standard distributions + (@pxref{Stddist,,Standard distributions}) + are changed, then neither its mode nor the normalization + constant are updated. Please use the respective calls + unur_distr_cvec_upd_mode() and unur_distr_cvec_upd_pdfvol(). +*/ + +int unur_distr_cvec_get_pdfparams( const UNUR_DISTR *distribution, const double **params ); +/* + Get number of parameters of the PDF and set pointer @var{params} to + array of parameters. If no parameters are stored in the object, an + error code is returned and @code{params} is set to NULL. + + @emph{Important:} Do @strong{not} change the entries in @var{params}! +*/ + + +int unur_distr_cvec_set_pdfparams_vec( UNUR_DISTR *distribution, int par, const double *param_vec, int n_params ); +/* + This function provides an interface for additional vector parameters for a + multivariate @var{distribution} besides mean vector and covariance + matrix which have their own calls. + + It sets the parameter with number @var{par}. + @var{par} indicates directly which of the parameters is set and + must be a number between @code{0} and @code{UNUR_DISTR_MAXPARAMS}-1 + (the upper limit of possible parameters defined in + @file{unuran_config.h}; it is set to 5 but can be changed to any + appropriate nonnegative number.) + + The entries of a this parameter are given by the array @var{param_vec} + of size @var{n_params}. Notice that using this interface an + An (@i{n} x @i{m})-matrix has to be stored in an array of length + @var{n_params} = @i{n} times @i{m}; where the rows of the matrix + are stored consecutively in this array. + + Due to great variety of possible parameters for a multivariate + @var{distribution} there is no simpler interface. + + If @var{param_vec} is NULL then the corresponding entry is cleared. + + @strong{Important:} If the parameters of a distribution from the + UNU.RAN library of standard distributions + (@pxref{Stddist,,Standard distributions}) + are changed, then neither its mode nor the normalization + constant are updated. Please use the respective calls + unur_distr_cvec_upd_mode() and unur_distr_cvec_upd_pdfvol(). + + If an error occurs no parameters are copied into the parameter + object @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. +*/ + +int unur_distr_cvec_get_pdfparams_vec( const UNUR_DISTR *distribution, int par, const double **param_vecs ); +/* + Get parameter of the PDF with number @var{par}. + The pointer to the parameter array is stored in @var{param_vecs}, its + size is returned by the function. + If the requested parameter is not set, then an error code is returned + and @code{params} is set to NULL. + + @emph{Important:} Do @strong{not} change the entries in @var{param_vecs}! +*/ + +int unur_distr_cvec_set_domain_rect( UNUR_DISTR *distribution, const double *lowerleft, const double *upperright ); +/* + Set rectangular domain for @var{distribution} with @var{lowerleft} + and @var{upperright} vertices. Both must be pointer to an + array of the size returned by unur_distr_get_dim(). + A NULL pointer is interpreted as the zero vector (0,@dots{},0). + For setting a coordinate of the boundary to @unurmath{\pm\infty} + use @code{+/- UNUR_INFINITY}. + The @var{lowerleft} vertex must be strictly smaller than + @var{upperright} in each component. Otherwise no domain + is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. + + By default the domain of a distribution is unbounded. Thus one can + use this call to truncate an existing distribution. + + @emph{Important:} Changing the domain of @var{distribution} + marks derived parameters like the mode or the center as unknown and + must be set @emph{after} changing the domain. This is important for + the already set (or default) value for the center does not + fall into the given domain. + Notice that calls of the PDF and derived functions return @code{0.} + when the parameter is not contained in the domain. +*/ + +int unur_distr_cvec_is_indomain( const double *x, const UNUR_DISTR *distribution ); +/* + Check whether @var{x} falls into the domain of @var{distribution}. +*/ + +/*---------------------------------------------------------------------------*/ + +/* ==DOC + @subsubheading Derived parameters + + The following paramters @strong{must} be set whenever one of the + essential parameters has been set or changed (and the parameter is + required for the chosen method). +*/ + +int unur_distr_cvec_set_mode( UNUR_DISTR *distribution, const double *mode ); +/* + Set mode of the @var{distribution}. @var{mode} must be a pointer to an + array of the size returned by unur_distr_get_dim(). + A NULL pointer for @var{mode} is interpreted as the zero + vector (0,@dots{},0). +*/ + +int unur_distr_cvec_upd_mode( UNUR_DISTR *distribution ); +/* + Recompute the mode of the @var{distribution}. This call works + properly for distribution objects from the UNU.RAN library of + standard distributions when the corresponding function is + available. If it failes @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_DATA}. +*/ + +const double *unur_distr_cvec_get_mode( UNUR_DISTR *distribution ); +/* + Get mode of the @var{distribution}. The function returns a pointer to + an array of the size returned by unur_distr_get_dim(). + If the mode is not marked as known the NULL pointer is returned and + @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. + (There is no difference between the case where no routine for + computing the mode is available and the case where no mode exists + for the @var{distribution} at all.) + + @emph{Important:} Do @strong{not} modify the array that holds the mode! +*/ + +int unur_distr_cvec_set_center( UNUR_DISTR *distribution, const double *center ); +/* + Set center of the @var{distribution}. @var{center} must be a pointer to an + array of the size returned by unur_distr_get_dim(). + A NULL pointer for @var{center} is interpreted as the zero + vector (0,@dots{},0). + + The center is used by some methods to shift the distribution in + order to decrease numerical round-off error. + If not given explicitly a default is used. + Moreover, it is used as starting point for several numerical search + algorithm (e.g. for the mode). Then @var{center} must be a pointer + where the call to the PDF returns a non-zero value. + In particular @var{center} must contained in the domain of the distribution. + + Default: The mode, if given by a unur_distr_cvec_set_mode() call; + else the mean, if given by a unur_distr_cvec_set_mean() call; + otherwise the null vector (0,@dots{},0). +*/ + +const double *unur_distr_cvec_get_center( UNUR_DISTR *distribution ); +/* + Get center of the @var{distribution}. The function returns a pointer to + an array of the size returned by unur_distr_get_dim(). + It always returns some point as there always exists a default for + the center, see unur_distr_cvec_set_center(). + + @emph{Important:} Do @strong{not} modify the array that holds the center! +*/ + +int unur_distr_cvec_set_pdfvol( UNUR_DISTR *distribution, double volume ); +/* + Set the volume below the PDF. If @var{vol} is non-positive, no + volume is set and @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_SET}. +*/ + +int unur_distr_cvec_upd_pdfvol( UNUR_DISTR *distribution ); +/* + Recompute the volume below the PDF of the distribution. + It only works for distribution objects from the + UNU.RAN library of standard distributions when the + corresponding function is available. Otherwise @code{unur_errno} is + set to @code{UNUR_ERR_DISTR_DATA}. + + This call also sets the normalization constant such that the given + PDF is the derivative of a given CDF, i.e. the volume is 1. +*/ + +double unur_distr_cvec_get_pdfvol( UNUR_DISTR *distribution ); +/* + Get the volume below the PDF of the @var{distribution}. If this volume is + not known,@* unur_distr_cont_upd_pdfarea() is called to compute + it. If this is not successful @code{UNUR_INFINITY} is returned and + @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/distr/cvemp.c b/vendor/unuran-1.11.0/src/distr/cvemp.c new file mode 100644 index 0000000..b30a551 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/cvemp.c @@ -0,0 +1,351 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: cvemp.c * + * * + * manipulate empirical multivariate continuous distribution objects * + * (i.e. samples) * + * * + * return: * + * UNUR_SUCCESS ... on success * + * error code ... on error * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include "distr_source.h" +#include "distr.h" +#include "cvemp.h" + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cvemp + +/*---------------------------------------------------------------------------*/ + +static void _unur_distr_cvemp_free( struct unur_distr *distr ); + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** empirical univariate continuous distributions **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_cvemp_new( int dim ) + /*----------------------------------------------------------------------*/ + /* create a new (empty) distribution object */ + /* type: empirical multivariate continuous */ + /* */ + /* parameters: */ + /* none */ + /* */ + /* return: */ + /* pointer to distribution object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + register struct unur_distr *distr; + + /* check dimension for new parameter for distribution */ + if (dim < 2) { + _unur_error(NULL,UNUR_ERR_DISTR_SET,"dimension < 2"); + return NULL; + } + + /* get empty distribution object */ + distr = _unur_distr_generic_new(); + if (!distr) return NULL; + + /* set magic cookie */ + COOKIE_SET(distr,CK_DISTR_CVEMP); + + /* set type of distribution */ + distr->type = UNUR_DISTR_CVEMP; + + /* set id to generic distribution */ + distr->id = UNUR_DISTR_GENERIC; + + /* dimension of random vector */ + distr->dim = dim; /* multivariant */ + + /* name for distribution */ + distr->name = "(empirical)"; + distr->name_str = NULL; + + /* destructor */ + distr->destroy = _unur_distr_cvemp_free; + + /* clone */ + distr->clone = _unur_distr_cvemp_clone; + + /* set defaults */ + + /* observed sample */ + DISTR.sample = NULL; /* sample */ + DISTR.n_sample = 0; /* sample size */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_cvemp_new() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +_unur_distr_cvemp_clone( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* copy (clone) distribution object */ + /* */ + /* parameters: */ + /* distr ... pointer to source distribution object */ + /* */ + /* return: */ + /* pointer to clone of distribution object */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE clone->data.cvemp + + struct unur_distr *clone; + + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CVEMP, NULL ); + + /* allocate memory */ + clone = _unur_xmalloc( sizeof(struct unur_distr) ); + + /* copy distribution object into clone */ + memcpy( clone, distr, sizeof( struct unur_distr ) ); + + /* copy data about sample into generator object (when there is one) */ + if (DISTR.sample) { + CLONE.sample = _unur_xmalloc( DISTR.n_sample * distr->dim * sizeof(double) ); + memcpy( CLONE.sample, DISTR.sample, DISTR.n_sample * distr->dim * sizeof(double) ); + } + + /* copy user name for distribution */ + if (distr->name_str) { + size_t len = strlen(distr->name_str) + 1; + clone->name_str = _unur_xmalloc(len); + memcpy( clone->name_str, distr->name_str, len ); + clone->name = clone->name_str; + } + + return clone; + +#undef CLONE +} /* end of _unur_distr_cvemp_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_distr_cvemp_free( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* free distribution object */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( distr == NULL ) /* nothing to do */ + return; + + COOKIE_CHECK(distr,CK_DISTR_CVEMP,RETURN_VOID); + + if (DISTR.sample) free( DISTR.sample ); + + /* user name for distribution */ + if (distr->name_str) free(distr->name_str); + + COOKIE_CLEAR(distr); + free( distr ); + +} /* end of unur_distr_cvemp_free() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvemp_set_data( struct unur_distr *distr, const double *sample, int n_sample ) + /*----------------------------------------------------------------------*/ + /* set observed sample for distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* sample ... pointer to array of observations */ + /* n_sample ... number of observations (sample size) */ + /* */ + /* sample must be an array of size dim x n_sample */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEMP, UNUR_ERR_DISTR_INVALID ); + _unur_check_NULL( distr->name, sample, UNUR_ERR_NULL ); + + /* check new parameter for generator */ + if (n_sample <= 0) { + _unur_error(NULL,UNUR_ERR_DISTR_SET,"sample size"); + return UNUR_ERR_DISTR_SET; + } + + /* allocate memory for sample */ + DISTR.sample = _unur_xmalloc( n_sample * distr->dim * sizeof(double) ); + if (!DISTR.sample) return UNUR_ERR_MALLOC; + + /* copy observed sample */ + memcpy( DISTR.sample, sample, n_sample * distr->dim * sizeof(double) ); + DISTR.n_sample = n_sample; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_cvemp_set_sample() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvemp_read_data( struct unur_distr *distr, const char *filename ) + /*----------------------------------------------------------------------*/ + /* Read data from file `filename'. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* filename ... name of data file */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEMP, UNUR_ERR_DISTR_INVALID ); + + /* read data from file */ + DISTR.n_sample = _unur_read_data( filename, distr->dim, &(DISTR.sample) ); + + /* o.k. ? */ + return (DISTR.n_sample > 0) ? UNUR_SUCCESS : UNUR_ERR_DISTR_DATA; + +} /* end of unur_distr_cvemp_read_data() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvemp_get_data( const struct unur_distr *distr, const double **sample ) + /*----------------------------------------------------------------------*/ + /* get number of observations and set pointer to array observations */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* sample ... pointer to observed sampletor */ + /* */ + /* return: */ + /* sample size */ + /* */ + /* error: */ + /* return 0 */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, 0 ); + _unur_check_distr_object( distr, CVEMP, 0 ); + + *sample = (DISTR.sample) ? DISTR.sample : NULL; + return DISTR.n_sample; + +} /* end of unur_distr_cvemp_get_sample() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_distr_cvemp_debug( const struct unur_distr *distr, const char *genid, unsigned printvector ) + /*----------------------------------------------------------------------*/ + /* write info about distribution into LOG file */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* genid ... pointer to generator id */ + /* printvector ... print observed sample if not 0 */ + /*----------------------------------------------------------------------*/ +{ +#define idx(k,l) (k * distr->dim + l) + + FILE *LOG; + int i,j; + + /* check arguments */ + CHECK_NULL(distr,RETURN_VOID); + COOKIE_CHECK(distr,CK_DISTR_CVEMP,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: distribution:\n",genid); + fprintf(LOG,"%s:\ttype = continuous multivariate distribution (ie. a sample)\n",genid); + fprintf(LOG,"%s:\tname = %s\n",genid,distr->name); + + fprintf(LOG,"%s:\tdimension = %d\n",genid,distr->dim); + + if (DISTR.n_sample>0) { + /* observed samples */ + fprintf(LOG,"%s:\tsample size = %d\n",genid,DISTR.n_sample); + if (printvector) { + for (i=0; idim; j++) + fprintf(LOG,", %.5f",DISTR.sample[idx(i,j)]); + fprintf(LOG,")\n"); + } + } + } + fprintf(LOG,"%s:\n",genid); + +#undef idx +} /* end of _unur_distr_cvemp_debug() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distr/cvemp.h b/vendor/unuran-1.11.0/src/distr/cvemp.h new file mode 100644 index 0000000..119b940 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/cvemp.h @@ -0,0 +1,119 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: cvemp.h * + * * + * PURPOSE: * + * function prototypes for manipulating distribution objects of * + * type CVEMP (continuous empirical multivariate distribution) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/* + =NODEX CVEMP Continuous empirical multivariate distributions + + =UP Distribution_objects [40] + + =DESCRIPTION + Empirical multivariate distributions are just lists of vectors + (with the same dimension). + Thus there are only calls to insert these data. + How these data are used to sample from the empirical distribution + depends from the chosen generation method. + + =END +*/ + +/*---------------------------------------------------------------------------*/ + +/* + Routines for handling empirical multivariate continuous distributions (VCEMP). +*/ + +/* =ROUTINES */ + +UNUR_DISTR *unur_distr_cvemp_new( int dim ); +/* + Create a new (empty) object for an empirical multivariate + continuous distribution. @var{dim} is the number of components of + the random vector (i.e. its dimension). It must be at least 2; + otherwise unur_distr_cemp_new() should be used to create an object + for an empirical univariate distribution. +*/ + +/* ==DOC + @subsubheading Essential parameters +*/ + +int unur_distr_cvemp_set_data( UNUR_DISTR *distribution, const double *sample, int n_sample ); +/* + Set observed sample for empirical @var{distribution}. + @var{sample} is an array of doubles of size + @code{dim} x @var{n_sample}, where + @code{dim} is the dimension of the @var{distribution} returned by + unur_distr_get_dim(). + The data points must be stored consecutively in @var{sample}, i.e., + data points (x1, y1), (x2, y2), @dots{} are given as an array + @{x1, y1, x2, y2, @dots{}@}. +*/ + +int unur_distr_cvemp_read_data( UNUR_DISTR *distribution, const char *filename ); +/* + Read data from file @file{filename}. + It reads the first @code{dim} numbers from each line, where + @code{dim} is the dimension of the @var{distribution} returned by + unur_distr_get_dim(). + Numbers are parsed by means of the C standard routine @command{strtod}. + Lines that do not start with @code{+}, @code{-}, @code{.}, or a + digit are ignored. (Beware of lines starting with a blank!) + + In case of an error (file cannot be opened, too few entries in a + line, invalid string for double in line) no data are copied into + the distribution object and an error code is returned. +*/ + +int unur_distr_cvemp_get_data( const UNUR_DISTR *distribution, const double **sample ); +/* + Get number of samples and set pointer @var{sample} to array of + observations. If no sample has been given, an error code + is returned and @var{sample} is set to NULL. + If successful @var{sample} points to an array of length + @code{dim} x @code{n_sample}, where + @code{dim} is the dimension of the distribution returned by + unur_distr_get_dim() and @code{n_sample} the return value of the + function. + + @emph{Important:} Do @strong{not} modify the array @var{sample}. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distr/cxtrans.c b/vendor/unuran-1.11.0/src/distr/cxtrans.c new file mode 100644 index 0000000..1ab630e --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/cxtrans.c @@ -0,0 +1,1069 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: cxtrans.c * + * * + * PURPOSE: * + * function prototypes for manipulating distribution objects of * + * id CXTRANS (continuous distribution of transformed RV) * + * type CONT (continuous univariate distribution) * + * * + * return: * + * UNUR_SUCCESS ... on success * + * error code ... on error * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include "distr.h" +#include "cxtrans.h" +#include "cont.h" +#include "distr_source.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "transformed RV"; + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cont /* underlying (base) distribution */ +#define CXT cxt->data.cont /* distribution of transformed RV */ + +#define BD_LEFT domain[0] /* left and ... */ +#define BD_RIGHT domain[1] /* ... right boundary of domain */ + +#define ALPHA params[0] /* parameter for transformation */ +#define MU params[1] /* relocation parameter for transformation */ +#define SIGMA params[2] /* rescaling parameter for transformation */ +#define logPDFPOLE params[3] /* logPDF at pole */ +#define dlogPDFPOLE params[4] /* derivative of logPDF at pole */ + +/*---------------------------------------------------------------------------*/ +/* function prototypes */ + +static int _unur_distr_cxtrans_compute_domain( struct unur_distr *cxt ); +/*---------------------------------------------------------------------------*/ +/* compute domain for transformed RV */ +/*---------------------------------------------------------------------------*/ + +/* prototypes for CDF, PDF and its derviative for transformed RV */ +static double _unur_cdf_cxtrans( double x, const struct unur_distr *cxt ); +static double _unur_pdf_cxtrans( double x, const struct unur_distr *cxt ); +static double _unur_logpdf_cxtrans( double x, const struct unur_distr *cxt ); +static double _unur_dpdf_cxtrans( double x, const struct unur_distr *cxt ); +static double _unur_dlogpdf_cxtrans( double x, const struct unur_distr *cxt ); + +static double _unur_pdf_at_pole( const struct unur_distr *cxt ); +static double _unur_dpdf_at_pole( const struct unur_distr *cxt ); + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** transformed univariate continuous random RV **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_cxtrans_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* Create an object for the distribution of a transformed RV */ + /* `distr' must be a pointer to a univariate continuous distribution. */ + /* */ + /* parameters: */ + /* distr ... pointer to univariate continuous distribution. */ + /* alpha ... parameter of power transformation */ + /* 0. -> logarithmic transformation */ + /* UNUR_INFINITY -> exponential transformation */ + /* */ + /* return: */ + /* pointer to distribution object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_distr *cxt; + + /* check arguments */ + _unur_check_NULL( distr_name,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + + /* get distribution object for generic continuous univariate distribution */ + cxt = unur_distr_cont_new(); + if (!cxt) return NULL; + + /* set id to distribution of order statistics */ + cxt->id = UNUR_DISTR_CXTRANS; + + /* name of distribution */ + cxt->name = distr_name; + + /* this is a derived distribution */ + /* clone base distribution ... */ + cxt->base = _unur_distr_cont_clone( distr ); + if (!cxt->base) { free(cxt); return NULL; } + + /* defaults: */ + CXT.n_params = 5; /* five parameters */ + CXT.ALPHA = 1.; /* parameter for transformation (default: identity) */ + CXT.MU = 0.; /* relocation parameter for transformation */ + CXT.SIGMA = 1.; /* rescaling parameter for transformation */ + + CXT.logPDFPOLE = -UNUR_INFINITY; /* logPDF at pole */ + CXT.dlogPDFPOLE = UNUR_INFINITY; /* derivative of logPDF at pole */ + + /* copy data */ + CXT.area = DISTR.area; /* area below PDF (same as for distr) */ + CXT.BD_LEFT = DISTR.BD_LEFT; /* boundaries of ... */ + CXT.BD_RIGHT = DISTR.BD_RIGHT; /* ... domain */ + CXT.mode = DISTR.mode; /* mode of distribution */ + + /* pointer to PDF, its derivative, and CDF */ + if (DISTR.cdf) CXT.cdf = _unur_cdf_cxtrans; /* pointer to CDF */ + if (DISTR.pdf) CXT.pdf = _unur_pdf_cxtrans; /* pointer to PDF */ + if (DISTR.logpdf) CXT.logpdf = _unur_logpdf_cxtrans; /* pointer to logPDF */ + if (DISTR.dpdf) CXT.dpdf = _unur_dpdf_cxtrans; /* derivative of PDF */ + if (DISTR.dlogpdf) CXT.dlogpdf = _unur_dlogpdf_cxtrans; /* derivative of logPDF */ + + /* parameters set */ + cxt->set = distr->set; + + /* return pointer to object */ + return cxt; + +} /* end of unur_distr_cxtrans_new() */ + +/*---------------------------------------------------------------------------*/ + +const struct unur_distr * +unur_distr_cxtrans_get_distribution( const struct unur_distr *cxt ) + /*----------------------------------------------------------------------*/ + /* get pointer to distribution object for underlying distribution */ + /* */ + /* parameters: */ + /* cxt ... pointer to distribution of transformed RV */ + /* */ + /* return: */ + /* pointer to underlying distribution */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( distr_name, cxt, NULL ); + _unur_check_distr_object( cxt, CONT, NULL ); + + /* check distribution */ + if (cxt->id != UNUR_DISTR_CXTRANS) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); + return NULL; + } + + return cxt->base; +} /* end of unur_distr_cxtrans_get_distribution() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cxtrans_set_alpha( struct unur_distr *cxt, double alpha ) + /*----------------------------------------------------------------------*/ + /* change parameter of transformation */ + /* */ + /* parameters: */ + /* cxt ... pointer to distribution of transformed RV */ + /* alpha ... parameter of power transformation */ + /* 0. -> logarithmic transformation */ + /* UNUR_INFINITY -> exponential transformation */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double alpha_bak; + + /* check arguments */ + _unur_check_NULL( distr_name, cxt, UNUR_ERR_NULL ); + _unur_check_distr_object( cxt, CONT, UNUR_ERR_DISTR_INVALID ); + + /* check distribution */ + if (cxt->id != UNUR_DISTR_CXTRANS) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return UNUR_ERR_DISTR_INVALID; } + CHECK_NULL( cxt->base, UNUR_ERR_NULL ); + + /* check parameter alpha */ + if (alpha < 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_SET,"alpha < 0"); + return UNUR_ERR_DISTR_SET; + } + + if (_unur_iszero(alpha) && cxt->base->data.cont.BD_LEFT < 0. ) { + /* logarithmic transformation */ + _unur_error(distr_name,UNUR_ERR_DISTR_SET,"invalid domain"); + return UNUR_ERR_DISTR_SET; + } + + /* copy parameters */ + alpha_bak = CXT.ALPHA; /* store old value of alpha */ + CXT.ALPHA = alpha; + + /* change domain of transformed RV */ + if (_unur_distr_cxtrans_compute_domain(cxt) != UNUR_SUCCESS) { + /* invalid alpha */ + CXT.ALPHA = alpha_bak; + return UNUR_ERR_DISTR_SET; + } + + /* changelog */ + cxt->set &= ~UNUR_DISTR_SET_MODE; /* mode unknown */ + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_cxtrans_set_alpha() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_cxtrans_get_alpha( const struct unur_distr *cxt ) + /*----------------------------------------------------------------------*/ + /* get parameter of transformation */ + /* */ + /* parameters: */ + /* cxt ... pointer to distribution of transformed RV */ + /* */ + /* return: */ + /* parameter alpha ... on success */ + /* -UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( distr_name, cxt, -UNUR_INFINITY ); + _unur_check_distr_object( cxt, CONT, -UNUR_INFINITY ); + + /* check distribution */ + if (cxt->id != UNUR_DISTR_CXTRANS) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return -UNUR_INFINITY; } + + /* o.k. */ + return CXT.ALPHA; +} /* end of unur_distr_cxtrans_get_alpha() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cxtrans_set_rescale( struct unur_distr *cxt, double mu, double sigma ) + /*----------------------------------------------------------------------*/ + /* change relocation and rescaling parameter */ + /* */ + /* parameters: */ + /* cxt ... pointer to distribution of transformed RV */ + /* mu ... relocation parameter */ + /* sigma ... rescaling parameter */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + + double mu_bak; + double sigma_bak; + + /* check arguments */ + _unur_check_NULL( distr_name, cxt, UNUR_ERR_NULL ); + _unur_check_distr_object( cxt, CONT, UNUR_ERR_DISTR_INVALID ); + + /* check distribution */ + if (cxt->id != UNUR_DISTR_CXTRANS) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return UNUR_ERR_DISTR_INVALID; } + CHECK_NULL( cxt->base, UNUR_ERR_NULL ); + + /* check parameter sigma */ + if (sigma <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_SET,"sigma <= 0"); + return UNUR_ERR_DISTR_SET; + } + + /* copy parameters */ + mu_bak = CXT.MU; + CXT.MU = mu; + sigma_bak = CXT.SIGMA; + CXT.SIGMA = sigma; + + /* change domain of transformed RV */ + if (_unur_distr_cxtrans_compute_domain(cxt) != UNUR_SUCCESS) { + /* invalid alpha */ + CXT.MU = mu_bak; + CXT.SIGMA = sigma_bak; + return UNUR_ERR_DISTR_SET; + } + + /* changelog */ + cxt->set &= ~UNUR_DISTR_SET_MODE; /* mode unknown */ + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_cxtrans_set_rescale() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_cxtrans_get_mu( const struct unur_distr *cxt ) + /*----------------------------------------------------------------------*/ + /* get relocation parameter */ + /* */ + /* parameters: */ + /* cxt ... pointer to distribution of transformed RV */ + /* */ + /* return: */ + /* parameter mu ... on success */ + /* -UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( distr_name, cxt, -UNUR_INFINITY ); + _unur_check_distr_object( cxt, CONT, -UNUR_INFINITY ); + + /* check distribution */ + if (cxt->id != UNUR_DISTR_CXTRANS) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return -UNUR_INFINITY; } + + /* o.k. */ + return CXT.MU; +} /* end of unur_distr_cxtrans_get_mu() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_cxtrans_get_sigma( const struct unur_distr *cxt ) + /*----------------------------------------------------------------------*/ + /* get rescaling parameter */ + /* */ + /* parameters: */ + /* cxt ... pointer to distribution of transformed RV */ + /* */ + /* return: */ + /* parameter sigma ... on success */ + /* -UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( distr_name, cxt, -UNUR_INFINITY ); + _unur_check_distr_object( cxt, CONT, -UNUR_INFINITY ); + + /* check distribution */ + if (cxt->id != UNUR_DISTR_CXTRANS) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return -UNUR_INFINITY; } + + /* o.k. */ + return CXT.SIGMA; +} /* end of unur_distr_cxtrans_get_sigma() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cxtrans_set_logpdfpole( struct unur_distr *cxt, double logpdfpole, double dlogpdfpole ) + /*----------------------------------------------------------------------*/ + /* set value for logarithm of PDF and its derivative at poles of the */ + /* underlying distribution */ + /* */ + /* parameters: */ + /* cxt ... pointer to distribution of transformed RV */ + /* logpdfpole ... value of logPDF at pole */ + /* dlogpdfpole ... value of derviate of logPDF at pole */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( distr_name, cxt, UNUR_ERR_NULL ); + _unur_check_distr_object( cxt, CONT, UNUR_ERR_DISTR_INVALID ); + + /* check distribution */ + if (cxt->id != UNUR_DISTR_CXTRANS) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return UNUR_ERR_DISTR_INVALID; } + + /* changelog */ + cxt->set |= UNUR_DISTR_SET_GENERIC; + + /* copy parameters */ + CXT.logPDFPOLE = logpdfpole; + CXT.dlogPDFPOLE = dlogpdfpole; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_distr_cxtrans_set_logpdfpole() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cxtrans_set_domain( struct unur_distr *cxt, double left, double right ) + /*----------------------------------------------------------------------*/ + /* set the left and right borders of the domain of the distribution */ + /* */ + /* parameters: */ + /* cxt ... pointer to distribution of transformed RV */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* the new boundary points may be +/- UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, cxt, UNUR_ERR_NULL ); + _unur_check_distr_object( cxt, CONT, UNUR_ERR_DISTR_INVALID ); + + /* check distribution */ + if (cxt->id != UNUR_DISTR_CXTRANS) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return UNUR_ERR_DISTR_INVALID; } + + if (_unur_isinf(CXT.ALPHA)==1) { + /* exponential transformation */ + if (left < CXT.MU) { + _unur_error(NULL,UNUR_ERR_DISTR_SET,"domain, left < 0"); + return UNUR_ERR_DISTR_SET; + } + } + + return unur_distr_cont_set_domain( cxt, left, right ); + +} /* end of unur_distr_cxtrans_set_domain() */ + +/*---------------------------------------------------------------------------*/ + +int _unur_distr_cxtrans_compute_domain( struct unur_distr *cxt ) + /*----------------------------------------------------------------------*/ + /* compute domain for transformed RV */ + /* */ + /* parameters: */ + /* cxt ... pointer to distribution of transformed RV */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double left, right; + double left_new, right_new; + double alpha; + + /* check arguments */ + CHECK_NULL( cxt, UNUR_ERR_NULL ); + CHECK_NULL( cxt->base, UNUR_ERR_NULL ); + + /* check distribution */ + if (cxt->id != UNUR_DISTR_CXTRANS) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return UNUR_ERR_DISTR_INVALID; } + + /* domain of underlying distribution */ + left = cxt->base->data.cont.BD_LEFT; + right = cxt->base->data.cont.BD_RIGHT; + + alpha = CXT.ALPHA; + + /* exponential transformation */ + if (_unur_isinf(alpha)==1) { + left_new = (_unur_isfinite(left)) ? exp(left) : 0.; + right_new = exp(right); + } + + /* logarithmic transformation */ + else if (_unur_iszero(alpha)) { + if (left < 0. ) { + _unur_error(distr_name,UNUR_ERR_DISTR_SET,"invalid domain"); + return UNUR_ERR_DISTR_SET; + } + left_new = (left<=0.) ? -UNUR_INFINITY : log(left); + right_new = log(right); + } + + /* power transformation */ + else if (alpha > 0.) { + left_new = (left>=0.) ? pow(left,alpha) : -pow(-left,alpha); + right_new = (right>=0.) ? pow(right,alpha) : -pow(-right,alpha); + } + + /* else: error */ + else { + _unur_error(distr_name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + } + + /* check for NaNs */ + if (_unur_isnan(left_new) || _unur_isnan(right_new)) { + _unur_error(distr_name,UNUR_ERR_DISTR_SET,"NaN in now domain boundaries"); + return UNUR_ERR_DISTR_SET; + } + + /* store new domain */ + /* also set boundary for truncated distributions */ + + CXT.trunc[0] = CXT.domain[0] = left_new; /* left boundary of domain */ + CXT.trunc[1] = CXT.domain[1] = right_new; /* right boundary of domain */ + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_distr_cxtrans_compute_domain() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** CDF, PDF, and its derivative of transformed RV **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#define CDF(x) ((*(cxt->base->data.cont.cdf)) ((x), cxt->base)) +#define PDF(x) ((*(cxt->base->data.cont.pdf)) ((x), cxt->base)) +#define logPDF(x) ((*(cxt->base->data.cont.logpdf)) ((x), cxt->base)) +#define dPDF(x) ((*(cxt->base->data.cont.dpdf)) ((x), cxt->base)) +#define dlogPDF(x) ((*(cxt->base->data.cont.dlogpdf))((x), cxt->base)) + +/* power transformation */ +#define POW(x) ((x>=0.) ? pow(x,1./alpha) : -pow(-x,1./alpha)) +#define dPOW(x) ( pow(fabs(x), 1./alpha-1.) / alpha ) /* alpha != 1. */ +#define dlogPOW(x) ( (1./alpha-1.)*log(fabs(x)) - log(alpha) ) +#define ddPOW(x) ( ((x>=0.)?(1.-alpha):(alpha-1.)) * (_unur_isfsame(alpha,0.5)?1.0:pow(fabs(x),1./alpha-2.)) / (alpha*alpha) ) + +/* rescale */ +#define rescale(x) (CXT.SIGMA * (x) + CXT.MU) +/* #define drescale(x) (CXT.SIGMA * (x)) */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_cxtrans( double x, const struct unur_distr *cxt ) + /* + CDF(x) = F(phi^{-1}(x)) + + F(.) ... CDF of underlying distribution + phi(.) ... transformation + */ +{ + double alpha, s, mu; + + /* check arguments */ + CHECK_NULL( cxt, UNUR_INFINITY ); + CHECK_NULL( cxt->base, UNUR_INFINITY ); + CHECK_NULL( cxt->base->data.cont.cdf, UNUR_INFINITY ); + + alpha = CXT.ALPHA; + s = CXT.SIGMA; + mu = CXT.MU; + + /* exponential transformation */ + if (_unur_isinf(alpha)==1) { + return ((x<=0.) ? 0. : CDF(s*log(x)+mu)); + } + + /* logarithmic transformation */ + if (_unur_iszero(alpha)) { + return CDF(s*exp(x)+mu); + } + + /* power transformation */ + if (alpha > 0.) { + return CDF(s*POW(x)+mu); + } + + /* else: error */ + _unur_error(distr_name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_INFINITY; + +} /* end of _unur_cdf_cxtrans() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_cxtrans( double x, const struct unur_distr *cxt ) + /* + PDF(x) = f(phi^{-1}(x))*(phi^{-1})'(x) + + f(.) ... PDF of underlying distribution + phi(.) ... transformation + */ +{ + double alpha, s, mu; + + /* check arguments */ + CHECK_NULL( cxt, UNUR_INFINITY ); + CHECK_NULL( cxt->base, UNUR_INFINITY ); + CHECK_NULL( cxt->base->data.cont.pdf, UNUR_INFINITY ); + + alpha = CXT.ALPHA; + s = CXT.SIGMA; + mu = CXT.MU; + + /* exponential transformation */ + if (_unur_isinf(alpha)==1) { + if (x<=0.) + return -UNUR_INFINITY; + else { + /* PDF(log(x))/x */ + double fx = PDF(s*log(x)+mu); + return (_unur_isfinite(fx) ? fx * s/x : _unur_pdf_at_pole(cxt)); + } + } + + /* logarithmic transformation */ + if (_unur_iszero(alpha)) { + /* PDF(exp(x)) * exp(x) */ + double ex = s * exp(x) + mu; + if (! _unur_isfinite(ex)) { + /* the PDF must be zero at +-infinity */ + return 0.; + } + else { + double fx = PDF(ex); + /* if PDF(ex) is not finite, we assume that it is a pole */ + return (_unur_isfinite(fx) ? fx * s*ex : _unur_pdf_at_pole(cxt)); + } + } + + /* identical transformation */ + if (_unur_isone(alpha)) { + double fx = PDF(s*x+mu); + return (_unur_isfinite(fx) ? s*fx : _unur_pdf_at_pole(cxt)); + } + + /* power transformation */ + if (alpha > 0.) { + double phix = s * POW(x) + mu; + if (! _unur_isfinite(phix)) { + /* the PDF must be zero at +-infinity */ + return 0.; + } + else { + double fx = PDF(phix); + if (_unur_isfinite(fx) && (!_unur_iszero(x) || alpha < 1.)) { + double fcx = fx * s * dPOW(x); + /* if f(phix) is finite but fx*dPOW(x) is not, */ + /* we assume that the PDF of the transformed variable is zero. */ + /* (This case is very unlikely to happen, but we should be */ + /* prepared for round-off error of the FPA.) */ + return (_unur_isfinite(fcx) ? fcx : 0.); + } + else + /* if PDF(phix) is not finite, we assume that it is a pole */ + return _unur_pdf_at_pole(cxt); + } + } + + /* else: error */ + _unur_error(distr_name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_INFINITY; + +} /* end of _unur_pdf_cxtrans() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_cxtrans( double x, const struct unur_distr *cxt ) + /* + logPDF(x) = logf(phi^{-1}(x)) + log((phi^{-1})'(x)) + + logf(.) ... logPDF of underlying distribution + phi(.) ... transformation + */ +{ + double alpha, s, logs, mu; + + /* check arguments */ + CHECK_NULL( cxt, UNUR_INFINITY ); + CHECK_NULL( cxt->base, UNUR_INFINITY ); + CHECK_NULL( cxt->base->data.cont.logpdf, UNUR_INFINITY ); + + alpha = CXT.ALPHA; + s = CXT.SIGMA; + mu = CXT.MU; + logs = log(CXT.SIGMA); + + /* exponential transformation */ + if (_unur_isinf(alpha)==1) { + if (x<=0.) + return -UNUR_INFINITY; + else { + /* logPDF(log(x))-log(x) */ + double logx = log(x); + double logfx = logPDF(s*logx+mu); + return (_unur_isfinite(logfx) ? (logfx - logx + logs) : CXT.logPDFPOLE); + } + } + + /* logarithmic transformation */ + if (_unur_iszero(alpha)) { + /* logPDF(exp(x)) + x */ + double ex = s * exp(x) + mu; + if (! _unur_isfinite(ex)) { + /* logPDF must be -infinity (the PDF must be zero) at +-infinity */ + return -UNUR_INFINITY; + } + else { + double logfx = logPDF(ex); + /* if logPDF(logx) is not finite, we assume that it is a pole */ + return (_unur_isfinite(logfx) ? (logfx + x + logs) : CXT.logPDFPOLE); + } + } + + /* identical transformation */ + if (_unur_isone(alpha)) { + double logfx = logPDF(s*x+mu); + return (_unur_isfinite(logfx) ? (logfx + logs) : CXT.logPDFPOLE); + } + + /* power transformation */ + if (alpha > 0.) { + double phix = s * POW(x) + mu; + if (! _unur_isfinite(phix)) { + /* logPDF must be -infinity (the PDF must be zero) at +-infinity */ + return -UNUR_INFINITY; + } + else { + double logfx = logPDF(phix); + if (_unur_isfinite(logfx) && (!_unur_iszero(x) || alpha < 1.)) { + double logfcx = logfx + logs + dlogPOW(x); + /* if logf(phix) is finite but logfx+dlogPOW(x) is not, */ + /* we assume that the PDF of the transformed variable is zero. */ + /* (This case is very unlikely to happen, but we should be */ + /* prepared for round-off error of the FPA.) */ + return (_unur_isfinite(logfcx) ? logfcx : -UNUR_INFINITY); + } + else + /* if PDF(phix) is not finite, we assume that it is a pole */ + return CXT.logPDFPOLE; + } + } + + /* else: error */ + _unur_error(distr_name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_INFINITY; + +} /* end of _unur_logpdf_cxtrans() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_cxtrans( double x, const struct unur_distr *cxt ) + /* + PDF(x) = f'(phi^{-1}(x))*((phi^{-1})'(x))^2 + + f(phi^{-1}(x))*(phi^{-1})''(x) + + f(.) ... PDF of underlying distribution + phi(.) ... transformation + */ +{ + double alpha, s, mu; + + /* check arguments */ + CHECK_NULL( cxt, UNUR_INFINITY ); + CHECK_NULL( cxt->base, UNUR_INFINITY ); + CHECK_NULL( cxt->base->data.cont.pdf, UNUR_INFINITY ); + CHECK_NULL( cxt->base->data.cont.dpdf, UNUR_INFINITY ); + + alpha = CXT.ALPHA; + s = CXT.SIGMA; + mu = CXT.MU; + + /* exponential transformation */ + if (_unur_isinf(alpha)==1) { + if (x<=0.) + return 0.; + else { + /* dPDF(log(x))/x^2 - PDF(log(x))/x^2 */ + double logx = s*log(x)+mu; + double fx = PDF(logx); + double dfx = dPDF(logx); + return (_unur_isfinite(fx) ? s*(s*dfx - fx)/(x*x) : _unur_dpdf_at_pole(cxt)); + } + } + + /* logarithmic transformation */ + if (_unur_iszero(alpha)) { + /* dPDF(exp(x)) * exp(2*x) + PDF(exp(x)) * exp(x) */ + double ex = s*exp(x)+mu; + if (! _unur_isfinite(ex)) { + /* dPDF must be zero at +-infinity */ + return 0.; + } + else { + double fx = PDF(ex); + double dfx = dPDF(ex); + double dfcx = s * (dfx * s*ex*ex + fx * ex); + /* if PDF(ex) is not finite, we assume that it is a pole */ + if (! _unur_isfinite(fx) ) return _unur_dpdf_at_pole(cxt); + /* if derivate of PDF(ex) is not finite (or NaN) we return +/- UNUR_INFINITY */ + if (! _unur_isfinite(dfcx) ) return (dfx>0 ? UNUR_INFINITY : -UNUR_INFINITY); + /* otherwise return computed value */ + return dfcx; + } + } + + /* identical transformation */ + if (_unur_isone(alpha)) { + double fx = PDF(s*x+mu); + double dfx = dPDF(s*x+mu); + return (_unur_isfinite(fx) ? s*dfx : _unur_dpdf_at_pole(cxt)); + } + + if (alpha > 0.) { + /* power transformation */ + double phix = s*POW(x)+mu; + if (! _unur_isfinite(phix)) { + /* dPDF must be zero at +-infinity */ + return 0.; + } + else { + double fx = PDF(phix); + double dfx = dPDF(phix); + double dphix = dPOW(x); + double ddphix = ddPOW(x); + if (_unur_isfinite(fx) && (!_unur_iszero(x) || alpha <= 0.5)) { + double dfcx = s*(dfx * s*dphix*dphix + fx * s*ddphix); + /* if f(phix) is finite but dfcx is not, we assume that dPDF */ + /* of the transformed variable is zero. */ + /* (This case is very unlikely to happen, but we should be */ + /* prepared for round-off error of the FPA.) */ + return (_unur_isfinite(dfcx) ? dfcx : 0.); + } + else + /* if PDF(phix) is not finite, we assume that it is a pole */ + return _unur_dpdf_at_pole(cxt); + } + } + + /* else: error */ + _unur_error(distr_name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_INFINITY; + +} /* end of _unur_dpdf_cxtrans() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dlogpdf_cxtrans( double x, const struct unur_distr *cxt ) + /* + PDF(x) = logf'(phi^{-1}(x)) * (phi^{-1})'(x) + + (phi^{-1})''(x) / (phi^{-1})'(x) + = logf'(phi^{-1}(x)) * (phi^{-1})'(x) + + (log(phi^{-1})'(x))' + + logf(.) ... logPDF of underlying distribution + phi(.) ... transformation + */ +{ + double alpha, s, mu; + + /* check arguments */ + CHECK_NULL( cxt, UNUR_INFINITY ); + CHECK_NULL( cxt->base, UNUR_INFINITY ); + CHECK_NULL( cxt->base->data.cont.logpdf, UNUR_INFINITY ); + CHECK_NULL( cxt->base->data.cont.dlogpdf, UNUR_INFINITY ); + + alpha = CXT.ALPHA; + s = CXT.SIGMA; + mu = CXT.MU; + + /* exponential transformation */ + if (_unur_isinf(alpha)==1) { + if (x<=0.) + return -UNUR_INFINITY; + else { + /* (dlogPDF(log(x)) - 1) / x */ + double logx = s*log(x)+mu; + double logfx = logPDF(logx); + double dlogfx = dlogPDF(logx); + /* if logPDF(logx) is not finite, we assume that it is a pole */ + return (_unur_isfinite(logfx) ? ((s*dlogfx-1)/x) : CXT.dlogPDFPOLE); + } + } + + /* logarithmic transformation */ + if (_unur_iszero(alpha)) { + /* dlogPDF(exp(x))*exp(x) + 1 */ + double ex = s*exp(x)+mu; + if (! _unur_isfinite(ex)) { + /* dlogPDF must be -/+ infinity at +/-infinity */ + return (x>1. ? -UNUR_INFINITY : UNUR_INFINITY); + } + else { + double logfx = logPDF(ex); + double dlogfx = dlogPDF(ex); + return (_unur_isfinite(logfx) ? s*dlogfx*ex + 1 : CXT.dlogPDFPOLE); + } + } + + /* identical transformation */ + if (_unur_isone(alpha)) { + double logfx = logPDF(x); + return (_unur_isfinite(logfx) ? s*dlogPDF(x) : CXT.dlogPDFPOLE); + } + + if (alpha > 0.) { + /* power transformation */ + double phix = s*POW(x)+mu; + if (! _unur_isfinite(phix)) { + /* dlogPDF must be -/+ infinity at +/-infinity */ + return ((x>1. || (x>-1. && x < 0.)) ? -UNUR_INFINITY : UNUR_INFINITY); + } + else { + double logfx = logPDF(phix); + if (_unur_isfinite(logfx) && (!_unur_iszero(x) || alpha <= 1.)) { + double dlogfcx = ((x>=0.)?1.:-1.) * (dlogPDF(phix) * s*dPOW(x) + (1./alpha-1.)/x); + if (! _unur_isfinite(dlogfcx)) { + /* if logf(phix) is finite but dlogfcx is not, we assume that dPDF */ + /* of the transformed variable is zero. */ + /* (This case is very unlikely to happen, but we should be */ + /* prepared for round-off error of the FPA.) */ + return ((x>1. || (x>-1. && x < 0.)) ? -UNUR_INFINITY : UNUR_INFINITY); + } + return dlogfcx; + } + else + /* if PDF(phix) is not finite, we assume that it is a pole */ + return CXT.dlogPDFPOLE; + } + } + + /* else: error */ + _unur_error(distr_name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_INFINITY; + +} /* end of _unur_dlogpdf_cxtrans() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_at_pole( const struct unur_distr *cxt ) + /* return PDF at pole using logPDF at pole */ +{ + return exp(CXT.logPDFPOLE); +} /* end of _unur_pdf_at_pole() */ + +/*---------------------------------------------------------------------------*/ +double +_unur_dpdf_at_pole( const struct unur_distr *cxt ) + /* return derivative of PDF at pole using derivative of logPDF at pole */ +{ + double fx = _unur_pdf_at_pole(cxt); + + if (! (_unur_isfinite(CXT.logPDFPOLE) && _unur_isfinite(fx)) ) + return UNUR_INFINITY; + else + return (fx * CXT.dlogPDFPOLE); +} /* end of _unur_dpdf_at_pole() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** debug **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_distr_cxtrans_debug( const struct unur_distr *cxt, const char *genid ) + /*----------------------------------------------------------------------*/ + /* write info about distribution into LOG file */ + /* */ + /* parameters: */ + /* cxt ... pointer to distribution of transformed RV */ + /* genid ... pointer to generator id */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(cxt,RETURN_VOID); + COOKIE_CHECK(cxt,CK_DISTR_CONT,RETURN_VOID); + CHECK_NULL(cxt->base,RETURN_VOID); + + LOG = unur_get_stream(); + + /* print data about distribution */ + fprintf(LOG,"%s: distribution:\n",genid); + fprintf(LOG,"%s:\ttype = continuous univariate distribution of transformed random variable\n",genid); + fprintf(LOG,"%s:\tname = %s\n",genid,cxt->name); + fprintf(LOG,"%s:\talpha = %g\t",genid,CXT.ALPHA); + if (_unur_isinf(CXT.ALPHA)==1) + fprintf(LOG,"[ exponential transformation: Y = exp(Z) ]\n"); + else if (_unur_iszero(CXT.ALPHA)) + fprintf(LOG,"[ logarithmic transformation: Y = log(Z) ]\n"); + else + fprintf(LOG,"[ power transformation: Y = Z^alpha ]\n"); + fprintf(LOG,"%s:\tmu = %g, sigma = %g\t[Z = (X-%g)/%g]\n",genid, CXT.MU, CXT.SIGMA, CXT.MU, CXT.SIGMA); + fprintf(LOG,"%s:\n",genid); + + fprintf(LOG,"%s:\tvalues used at pole of underlying distribution\n",genid); + fprintf(LOG,"%s:\t\tlogPDF = %g\t(PDF = %g)",genid, CXT.logPDFPOLE, _unur_pdf_at_pole(cxt)); + _unur_print_if_default(cxt,UNUR_DISTR_SET_GENERIC); + fprintf(LOG,"\n"); + fprintf(LOG,"%s:\t\tdlogPDF = %g\t(dPDF = %g)",genid, CXT.dlogPDFPOLE, _unur_dpdf_at_pole(cxt)); + _unur_print_if_default(cxt,UNUR_DISTR_SET_GENERIC); + fprintf(LOG,"\n"); + + if (cxt->set & UNUR_DISTR_SET_MODE) + fprintf(LOG,"%s:\tmode = %g\n",genid,CXT.mode); + else + fprintf(LOG,"%s:\tmode unknown\n",genid); + + fprintf(LOG,"%s:\tdomain = (%g, %g)",genid,CXT.BD_LEFT,CXT.BD_RIGHT); + _unur_print_if_default(cxt,UNUR_DISTR_SET_DOMAIN); + + fprintf(LOG,"\n%s:\tarea below PDF = %g",genid,CXT.area); + _unur_print_if_default(cxt,UNUR_DISTR_SET_PDFAREA); + fprintf(LOG,"\n%s:\n",genid); + + /* print data about underlying distribution */ + fprintf(LOG,"%s: Underlying distribution:\n",genid); + _unur_distr_cont_debug(cxt->base, genid); + +} /* end of _unur_distr_cxtrans_debug() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distr/cxtrans.h b/vendor/unuran-1.11.0/src/distr/cxtrans.h new file mode 100644 index 0000000..b163226 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/cxtrans.h @@ -0,0 +1,365 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: cxtrans.h * + * * + * PURPOSE: * + * function prototypes for manipulating distribution objects of * + * id CXTRANS (continuous distribution of transformed RV) * + * type CONT (continuous univariate distribution) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/* + =ExperimentalNODEX CXTRANS Continuous univariate distribution of transformed random variables + + =UP Distribution_objects [13] + + =DESCRIPTION + Given a continuous univariate distribution object for a random + variable @unurmath{X} with CDF @unurmath{F} and PDF @unurmath{f.} + Then it can be transformed into a continuous univariate + distribution object for @unurmath{Z=\phi(X)} for some strictly + monotonically increasing continuous transformation + @unurmath{\phi.} + Its respetive CDF and PDF are then given by + + @unurmathdisplay{G(z) = F(\phi^{-1}(z))} + + and + + @unurmathdisplay{g(z) = f(\phi^{-1}(z))\cdot(\phi^{-1})'(z)} + + Currently, only power transformations, logarithmic and + exponential transformation are supported. Additionally, + The random variable can be relocated and rescaled + ("standardized"): + + @unurmathdisplay{ + \phi(X) = \log(Z) \\ + \phi(X) = sign(Z) |Z|^\alpha \\ + \phi(X) = \exp(Z) } + + where + + @unurmathdisplay{ + Z = (X-\mu)/\sigma } + + @unurmath{\alpha} must be between 0 and @unurmath{\infty} where + the logarithmic transformation is implemented as special case + @unurmath{\alpha=0}, the exponential transformation as + @unurmath{\alpha=\infty} and the standardization procedure as + @unurmath{\alpha=1.} + Moreover, @unurmath{\sigma} must be strictly positive. + + One of the most important applications of these transformations + is to eliminate poles, i.e., where the PDF is not bounded from + above. The implementation of a PDF must return + @code{UNUR_INFINITY} at such points. + By default the value of the PDF @i{g} of the transformed density + is set to @code{0} for such points and its derivative dPDF to + @code{UNUR_INFINITY}. These figures can be changed to more + appropriate values. It must be again noted here that poles are + (only) detected/indicated as points where the PDF @i{f} returns + @code{UNUR_INFINITY}. + + Notice that for @unurmath{\alpha > 1} these transformations are + not defined at @unurmath{\mu.} It is difficult to check whether + there exists a continuous continuation for the density of the + transformed random variate at 0. Thus the above value for poles + is used at 0. + + The distribution objects of transformed random variates are + special cases of a continuous univariate distributions and thus + they have most of these parameters (with the exception that + functions cannot be changed). Additionally, + + @itemize @minus + @item there is a call to extract the underlying distribution, + + @item calls to handle the transformation. + + @end itemize + + Notice that by transformation @unurmath{\phi} the mode is + usually not known. The domain of the transformed random variate + is adjusted according to the transformation. + + =END +*/ + +/*---------------------------------------------------------------------------*/ + +/* + Routines for handling univariate continuous distributions of transformed + random variables +*/ + +/* =ROUTINES */ + +UNUR_DISTR *unur_distr_cxtrans_new( const UNUR_DISTR *distribution ); +/* + Create an object for the distribution of the transformed random + variate. @var{distribution} must be a pointer to a univariate + continuous distribution. + The resulting generator object is of the same type as of a + unur_distr_cont_new() call. + + To select a transformation the unur_distr_cxtrans_set_alpha() call + must be used. For the parameters for relocating and rescaling of the + random variate unur_distr_cxtrans_set_rescale() has to be used. + + Without one of these additional calls the identity transformation + is used, i.e. the random variate is not transformed at all. +*/ + +const UNUR_DISTR *unur_distr_cxtrans_get_distribution( const UNUR_DISTR *distribution ); +/* + Get pointer to distribution object for underlying distribution. +*/ + + + +/* ==DOC + @subsubheading Essential parameters +*/ + +int unur_distr_cxtrans_set_alpha( UNUR_DISTR *distribution, double alpha ); +/* + Change the parameter @var{alpha} for the power transformation. + One of the following transformations are possible: + + @multitable @columnfractions .25 .75 + @headitem @var{alpha} @tab Transformation + @item @code{UNUR_INFINITY} + @tab @unurmath{\phi(X)=\exp(Z)} + @item @code{0} + @tab @unurmath{\phi(X)=\log(Z)} + @item positive + @tab @unurmath{\phi(X) = sign(Z) |Z|^\alpha} + @end multitable + + where @unurmath{Z = (X-\mu)/\sigma.} + Negative values for @var{alpha} are not allowed. + + The relocating and rescaling parameters @unurmath{\mu} and + @unurmath{\sigma} can be set by the respective call + unur_distr_cxtrans_set_rescale(). + + Default: @code{1} (i.e., identity). +*/ + +int unur_distr_cxtrans_set_rescale( UNUR_DISTR *distribution, double mu, double sigma ); +/* + Change relocating and rescaling parameter. @var{sigma} must be + strictly positive. + + Default: @var{mu} = @code{0.} and @var{sigma} = @code{1.} (i.e., identity) + */ + +double unur_distr_cxtrans_get_alpha( const UNUR_DISTR *distribution ); +/* */ + +double unur_distr_cxtrans_get_mu( const UNUR_DISTR *distribution ); +/* */ + +double unur_distr_cxtrans_get_sigma( const UNUR_DISTR *distribution ); +/* + Get parameters @unurmath{\alpha,} @unurmath{\mu,} and + @unurmath{\sigma} for the power transformation, relocating and + rescaling of the random variate. +*/ + +int unur_distr_cxtrans_set_logpdfpole( UNUR_DISTR *distribution, double logpdfpole, double dlogpdfpole ); +/* + Set value for logarithm of PDF and its derivative that are used + whenever a pole of the underlying distribution is detected (i.e., + when the PDF of the underlying distribution returns UNUR_INFINITY). + + Default: @code{-UNUR_INFINITY} and @code{UNUR_INFINITY}, respectively. +*/ + + +/* ==DOC + Additionally most of the set and get calls for continuous + univariate distributions work. The most important exceptions are + that the PDF and CDF cannot be changed and + unur_distr_cont_upd_mode() uses in any way a (slow) numerical + method that might fail. +*/ + + +#define unur_distr_cxtrans_get_pdf(distr) unur_distr_cont_get_pdf((distr)) +/* UNUR_FUNCT_CONT *unur_distr_cxtrans_get_pdf( UNUR_DISTR *distribution ); */ + +#define unur_distr_cxtrans_get_dpdf(distr) unur_distr_cont_get_dpdf((distr)) +/* UNUR_FUNCT_CONT *unur_distr_cxtrans_get_dpdf( UNUR_DISTR *distribution ); */ + +#define unur_distr_cxtrans_get_cdf(distr) unur_distr_cont_get_cdf((distr)) +/* UNUR_FUNCT_CONT *unur_distr_cxtrans_get_cdf( UNUR_DISTR *distribution ); */ +/* + Get the respective pointer to the PDF, the derivative of the + PDF and the CDF of the distribution, respectively. The pointer is of type + @code{double funct(double x, UNUR_DISTR *distr)}. + If the corresponding function is not available for the distribution, + the NULL pointer is returned. + See also unur_distr_cont_get_pdf(). + (Macro) +*/ + +#define unur_distr_cxtrans_eval_pdf(x,distr) unur_distr_cont_eval_pdf((x),(distr)) +/* double unur_distr_cxtrans_eval_pdf( double x, UNUR_DISTR *distribution ); */ + +#define unur_distr_cxtrans_eval_dpdf(x,distr) unur_distr_cont_eval_dpdf((x),(distr)) +/* double unur_distr_cxtrans_eval_dpdf( double x, UNUR_DISTR *distribution ); */ + +#define unur_distr_cxtrans_eval_cdf(x,distr) unur_distr_cont_eval_cdf((x),(distr)) +/* double unur_distr_cxtrans_eval_cdf( double x, UNUR_DISTR *distribution ); */ +/* + Evaluate the PDF, derivative of the PDF. and the CDF, + respectively, at @var{x}. + Notice that @var{distribution} must not be the NULL pointer. + If the corresponding function is not available for the distribution, + @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_DATA}. + See also unur_distr_cont_eval_pdf(). + (Macro) + + @emph{IMPORTANT:} + In the case of a truncated standard distribution these calls always + return the respective values of the @emph{untruncated} distribution! +*/ + +int unur_distr_cxtrans_set_domain( UNUR_DISTR *distribution, double left, double right ); +/* + Set the left and right borders of the domain of the + distribution. When the exponential transformation is used + (i.e. @var{alpha} is set to @code{UNUR_INFINITY}), then the domain must be + a subset of positive numbers. + See unur_distr_cont_set_domain() for more details. + + @emph{Important:} + The domain of the transformed random variate may be different + from the domain of the underlying random variate. +*/ + +#define unur_distr_cxtrans_get_domain(distr,left,right) unur_distr_cont_get_domain((distr),(left),(right)) +/* int unur_distr_cxtrans_get_domain( UNUR_DISTR *distribution, double *left, double *right ); */ +/* + Get the left and right borders of the domain of the + distribution. + See unur_distr_cont_get_domain() for details. + (Macro) +*/ + + +#define unur_distr_cxtrans_get_truncated(distr,left,right) unur_distr_cont_get_truncated((distr),(left),(right)) +/* int unur_distr_cxtrans_get_truncated( UNUR_DISTR *distribution, double *left, double *right ); */ +/* + Get the left and right borders of the (truncated) domain of the + distribution. + See unur_distr_cont_get_truncated() for details. + (Macro) + + @emph{Important:} + The domain of the transformed random variate may be different + from the domain of the underlying random variate. +*/ + +/* ==DOC + @subsubheading Derived parameters + + The following paramters @strong{must} be set whenever one of the essential + parameters has been set or changed (and the parameter is required + for the chosen method). +*/ + +#define unur_distr_cxtrans_set_mode(distr,mode) unur_distr_cont_set_mode((distr),(mode)) +/* int unur_distr_cxtrans_set_mode( UNUR_DISTR *distribution, double mode ); */ +/* + Set mode of distribution. + See also unur_distr_cxtrans_set_mode(). + (Macro) +*/ + +#define unur_distr_cxtrans_upd_mode(distr) unur_distr_cont_upd_mode((distr)) +/* double unur_distr_cxtrans_upd_mode( UNUR_DISTR *distribution ); */ +/* + Recompute the mode of the distribution numerically. Notice that + this routine is slow and might not work properly in every case. + See also unur_distr_cont_upd_mode() for further details. + (Macro) +*/ + +#define unur_distr_cxtrans_get_mode(distr) unur_distr_cont_get_mode((distr)) +/* double unur_distr_cxtrans_get_mode( UNUR_DISTR *distribution ); */ +/* + Get mode of distribution. + See unur_distr_cont_get_mode() for details. + (Macro) +*/ + + +#define unur_distr_cxtrans_set_pdfarea(distr,area) unur_distr_cont_set_pdfarea((distr),(area)) +/* int unur_distr_cxtrans_set_pdfarea( UNUR_DISTR *distribution, double area ); */ +/* + Set the area below the PDF. + See unur_distr_cont_set_pdfarea() for details. + (Macro) +*/ + + +#define unur_distr_cxtrans_upd_pdfarea(distr) unur_distr_cont_upd_pdfarea((distr)) +/* double unur_distr_cxtrans_upd_pdfarea( UNUR_DISTR *distribution ); */ +/* + Recompute the area below the PDF of the distribution. + It only works for order statistics for distribution objects from + the UNU.RAN library of standard distributions when the + corresponding function is available. + unur_distr_cont_upd_pdfarea() assumes that the PDF of the underlying + distribution is normalized, i.e. it is the derivative of its CDF. + Otherwise the computed area is wrong and there is @strong{no} warning + about this failure. + See unur_distr_cont_upd_pdfarea() for further details. + (Macro) +*/ + +#define unur_distr_cxtrans_get_pdfarea(distr) unur_distr_cont_get_pdfarea((distr)) +/* double unur_distr_cxtrans_get_pdfarea( UNUR_DISTR *distribution ); */ +/* + Get the area below the PDF of the distribution. + See unur_distr_cont_get_pdfarea() for details. + (Macro) +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distr/deprecated_distr.c b/vendor/unuran-1.11.0/src/distr/deprecated_distr.c new file mode 100644 index 0000000..0af7699 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/deprecated_distr.c @@ -0,0 +1,296 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: deprecated_distr.c * + * * + * Deprecated routines * + * * + ***************************************************************************** + * * + * THESE ROUTINES SHOULD NOT BE USED ANY MORE! * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include "deprecated_distr.h" + +/*---------------------------------------------------------------------------*/ +#ifdef USE_DEPRECATED_CODE +/*---------------------------------------------------------------------------*/ + +static void _unur_distr_cvec_marginals_free ( struct unur_distr **marginals, int dim ); + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#define DISTR distr->data.cvec +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_stdmarginals ( struct unur_distr *distr, struct unur_distr *stdmarginal) + /*----------------------------------------------------------------------*/ + /* Copy standardized marginal distribution into distribution object. */ + /* Only one local copy is made. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* stdmarginal ... pointer to standardized marginal distrib. object */ + /* */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_distr *clone; + int i; + + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + _unur_check_NULL( distr->name, stdmarginal, UNUR_ERR_NULL ); + _unur_check_distr_object( stdmarginal, CONT, UNUR_ERR_DISTR_INVALID ); + + /* first we have to check whether there is already a list of marginal distributions */ + if (DISTR.stdmarginals) + _unur_distr_cvec_marginals_free(DISTR.stdmarginals, distr->dim); + + /* make copy of standardized marginal distribution object */ + clone = _unur_distr_clone( stdmarginal ); + + /* allocate memory for array */ + DISTR.stdmarginals = _unur_xmalloc (distr->dim * sizeof(struct unur_distr *)); + + /* copy pointer */ + for (i=0; idim; i++) + DISTR.stdmarginals[i] = clone; + + /* changelog */ + distr->set |= UNUR_DISTR_SET_STDMARGINAL; + + return UNUR_SUCCESS; +} /* end of unur_distr_cvec_set_stdmarginals() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_stdmarginal_array ( struct unur_distr *distr, struct unur_distr **stdmarginals) + /*----------------------------------------------------------------------*/ + /* Copy standardized marginal distributions into distribution object. */ + /* For each dimension a new copy is made even if the pointer in */ + /* the array stdmarginals coincide. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* stdmarginals ... pointer to array of std. marginal distr. objects */ + /* */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + _unur_check_NULL( distr->name, stdmarginals, UNUR_ERR_NULL ); + + for (i=0; idim; i++) { + _unur_check_NULL( distr->name, *(stdmarginals+i), UNUR_ERR_NULL ); + _unur_check_distr_object( *(stdmarginals+i), CONT, UNUR_ERR_DISTR_INVALID ); + } + + /* first we have to check whether there is already a list of marginal distributions */ + if (DISTR.stdmarginals) + _unur_distr_cvec_marginals_free(DISTR.stdmarginals, distr->dim); + + /* allocate memory for array */ + DISTR.stdmarginals = _unur_xmalloc (distr->dim * sizeof(struct unur_distr *)); + + /* make copy of standardized marginal distribution objects */ + for (i=0; idim; i++) + DISTR.stdmarginals[i] = _unur_distr_clone( *(stdmarginals+i) ); + + /* changelog */ + distr->set |= UNUR_DISTR_SET_STDMARGINAL; + + return UNUR_SUCCESS; +} /* end of unur_distr_cvec_set_stdmarginal_array() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_cvec_set_stdmarginal_list ( struct unur_distr *distr, ... ) + /*----------------------------------------------------------------------*/ + /* Copy standardized marginal distributions into distribution object. */ + /* For each dimenision there must be a pointer to a discribution object.*/ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* ... ... pointer to array of std. marginal distibution objects */ + /* */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* IMPORTANT: */ + /* All marginal distribution objects are destroyed after they have */ + /* been copied into the distribution object. */ + /*----------------------------------------------------------------------*/ +{ + int i; + int failed = FALSE; + struct unur_distr *stdmarginal; + struct unur_distr **stdmarginal_list; + va_list vargs; + + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); + + /* allocate memory for array */ + stdmarginal_list = _unur_xmalloc (distr->dim * sizeof(struct unur_distr *)); + for (i=0; idim; i++) stdmarginal_list[i] = NULL; + + /* make copy of standardized marginal distribution objects */ + va_start(vargs, distr); + for (i=0; idim; i++) { + stdmarginal = (struct unur_distr *) va_arg(vargs, struct unur_distr *); + if (stdmarginal) { + stdmarginal_list[i] = _unur_distr_clone( stdmarginal ); + _unur_distr_free(stdmarginal); + } + else { + failed = TRUE; + } + } + va_end(vargs); + + if (failed) { + /* some of the pointers are NULL pointers */ + _unur_distr_cvec_marginals_free(stdmarginal_list, distr->dim); + _unur_error(distr->name ,UNUR_ERR_DISTR_SET,"stdmarginals == NULL"); + return UNUR_ERR_DISTR_SET; + } + + /* copy list of marginal distributions. However, first we have to check */ + /* whether there is already a list of marginal distributions. */ + if (DISTR.stdmarginals) + _unur_distr_cvec_marginals_free(DISTR.stdmarginals, distr->dim); + + DISTR.stdmarginals = stdmarginal_list; + + /* changelog */ + distr->set |= UNUR_DISTR_SET_STDMARGINAL; + + return UNUR_SUCCESS; +} /* end of unur_distr_cvec_set_stdmarginal_list() */ + +/*---------------------------------------------------------------------------*/ + +const struct unur_distr * +unur_distr_cvec_get_stdmarginal( const struct unur_distr *distr, int n ) + /*----------------------------------------------------------------------*/ + /* Get pointer to standardized marginal distribution object. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* n ... position of standardized marginal distribution object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, CVEC, NULL ); + + if (n<=0 || n > distr->dim) { + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"n not in 1 .. dim"); + return NULL; + } + + /* mean vector known ? */ + if ( !(distr->set & UNUR_DISTR_SET_STDMARGINAL) ) { + _unur_warning(distr->name,UNUR_ERR_DISTR_GET,"std marginals"); + return NULL; + } + + _unur_check_NULL( distr->name, DISTR.stdmarginals, NULL ); + + /* return standarized marginal distribution object */ + return (DISTR.stdmarginals[n-1]); +} /* end of unur_distr_cvec_get_stdmarginal() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_distr_cvec_marginals_free ( struct unur_distr **marginals, int dim ) + /*----------------------------------------------------------------------*/ + /* free list of marginal distribution objects */ + /* */ + /* parameters: */ + /* marginals ... pointer to list of marginal distribution objects */ + /* dim ... number of marginal distributions */ + /* */ + /* return: */ + /* pointer to clone of list of marginal distribution objects */ + /*----------------------------------------------------------------------*/ +{ + int i; + + if (_unur_distr_cvec_marginals_are_equal(marginals,dim)) { + _unur_distr_free(marginals[0]); + } + + else { + for (i=0; i +#include +#include +#include "distr_source.h" +#include "distr.h" +#include "discr.h" + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.discr + +/*---------------------------------------------------------------------------*/ +/* Constants */ + +/* maximum size of domain for which the pmfsum is computed automatically */ +#define MAX_PMF_DOMAIN_FOR_UPD_PMFSUM (1000) + +/*---------------------------------------------------------------------------*/ + +static double _unur_distr_discr_eval_pmf_tree( int k, const struct unur_distr *distr ); +/*---------------------------------------------------------------------------*/ +/* evaluate function tree for PMF. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_distr_discr_eval_cdf_tree( int k, const struct unur_distr *distr ); +/*---------------------------------------------------------------------------*/ +/* evaluate function tree for CDF. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_distr_discr_free( struct unur_distr *distr ); +/*---------------------------------------------------------------------------*/ +/* destroy distribution object. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ + +static int _unur_distr_discr_find_mode( struct unur_distr *distr ); +/*---------------------------------------------------------------------------*/ +/* find mode of unimodal probability vector numerically by bisection. */ +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** univariate discrete distributions **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_discr_new( void ) + /*----------------------------------------------------------------------*/ + /* create a new (empty) distribution object */ + /* type: univariate discete */ + /* */ + /* parameters: */ + /* none */ + /* */ + /* return: */ + /* pointer to distribution object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + register struct unur_distr *distr; + register int i; + + /* get empty distribution object */ + distr = _unur_distr_generic_new(); + if (!distr) return NULL; + + /* set magic cookie */ + COOKIE_SET(distr,CK_DISTR_DISCR); + + /* set type of distribution */ + distr->type = UNUR_DISTR_DISCR; + + /* set id to generic distribution */ + distr->id = UNUR_DISTR_GENERIC; + + /* dimension of random vector */ + distr->dim = 1; /* univariant */ + + /* destructor */ + distr->destroy = _unur_distr_discr_free; + + /* clone */ + distr->clone = _unur_distr_discr_clone; + + /* set defaults */ + + /* finite probability vector */ + DISTR.pv = NULL; /* probability vector (PV) */ + DISTR.n_pv = 0; /* length of PV */ + + /* probability mass function */ + DISTR.pmf = NULL; /* pointer to PMF */ + DISTR.cdf = NULL; /* pointer to CDF */ + DISTR.invcdf = NULL; /* pointer to inverse CDF */ + + DISTR.init = NULL; /* pointer to special init routine */ + + DISTR.set_params= NULL; /* funct for setting parameters and domain*/ + + DISTR.n_params = 0; /* number of parameters of the pmf */ + /* initialize parameters of the PMF */ + for (i=0; idata.discr + + struct unur_distr *clone; + + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, DISCR, NULL ); + + /* allocate memory */ + clone = _unur_xmalloc( sizeof(struct unur_distr) ); + + /* copy distribution object into clone */ + memcpy( clone, distr, sizeof( struct unur_distr ) ); + + /* copy function trees into generator object (when there is one) */ + CLONE.pmftree = (DISTR.pmftree) ? _unur_fstr_dup_tree(DISTR.pmftree) : NULL; + CLONE.cdftree = (DISTR.cdftree) ? _unur_fstr_dup_tree(DISTR.cdftree) : NULL; + + /* copy probability vector into generator object (when there is one) */ + if (DISTR.pv) { + CLONE.pv = _unur_xmalloc( DISTR.n_pv * sizeof(double) ); + memcpy( CLONE.pv, DISTR.pv, DISTR.n_pv * sizeof(double) ); + } + + /* copy user name for distribution */ + if (distr->name_str) { + size_t len = strlen(distr->name_str) + 1; + clone->name_str = _unur_xmalloc(len); + memcpy( clone->name_str, distr->name_str, len ); + clone->name = clone->name_str; + } + + return clone; + +#undef CLONE +} /* end of _unur_distr_discr_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_distr_discr_free( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* free distribution object */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( distr == NULL ) /* nothing to do */ + return; + _unur_check_distr_object( distr, DISCR, RETURN_VOID ); + + if (DISTR.pmftree) _unur_fstr_free(DISTR.pmftree); + if (DISTR.cdftree) _unur_fstr_free(DISTR.cdftree); + + if (DISTR.pv) free( DISTR.pv ); + + /* user name for distribution */ + if (distr->name_str) free(distr->name_str); + + COOKIE_CLEAR(distr); + free( distr ); + +} /* end of unur_distr_discr_free() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_discr_set_pv( struct unur_distr *distr, const double *pv, int n_pv ) + /*----------------------------------------------------------------------*/ + /* set probability vector for distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* pv ... pointer to PV */ + /* n_pv ... length of PV */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); + + /* it is not possible to set a PV when a PMF is given. */ + if (DISTR.pmf != NULL || DISTR.cdf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"PMF/CDF given, cannot set PV"); + return UNUR_ERR_DISTR_SET; + } + + /* check new parameter for distribution */ + if (n_pv < 0) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"length of PV"); + return UNUR_ERR_DISTR_SET; + } + + /* n_pv must not be too large */ + if ( (DISTR.domain[0] > 0) && ((unsigned)DISTR.domain[0] + (unsigned)n_pv > INT_MAX) ) { + /* n_pv too large, causes overflow */ + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"length of PV too large, overflow"); + return UNUR_ERR_DISTR_SET; + } + DISTR.domain[1] = DISTR.domain[0] + n_pv - 1; + + /* we do not check non-negativity of p.v. + (it is cheaper to do it when unur_init() is called */ + + /* allocate memory for probability vector */ + DISTR.pv = _unur_xrealloc( DISTR.pv, n_pv * sizeof(double) ); + if (!DISTR.pv) return UNUR_ERR_MALLOC; + + /* copy probability vector */ + memcpy( DISTR.pv, pv, n_pv * sizeof(double) ); + DISTR.n_pv = n_pv; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_discr_set_pv() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_discr_make_pv( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* compute probability vector */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* length of probability vector */ + /* */ + /* error: */ + /* return 0 */ + /*----------------------------------------------------------------------*/ +{ + double *pv; /* pointer to probability vector */ + int n_pv; /* length of PV */ + double cdf, cdf_old; /* cumulated sum of PV */ + double thresh_cdf; /* threshold for truncating PV */ + int valid; /* whether cumputed PV is valid */ + int i; + + /* check arguments */ + _unur_check_NULL( NULL, distr, 0 ); + _unur_check_distr_object( distr, DISCR, 0 ); + + /* PMF or CDF required */ + if ( DISTR.pmf == NULL && DISTR.cdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"PMF or CDF"); + return 0; + } + + /* if there exists a PV, it has to be removed */ + if (DISTR.pv != NULL) { + free(DISTR.pv); DISTR.n_pv = 0; + } + + /* compute PV */ + + if ((unsigned)DISTR.domain[1] - (unsigned)DISTR.domain[0] < UNUR_MAX_AUTO_PV ) { + + /* first case: bounded domain */ + n_pv = DISTR.domain[1] - DISTR.domain[0] + 1; + pv = _unur_xmalloc( n_pv * sizeof(double) ); + if (DISTR.pmf) { + for (i=0; i= UNUR_MAX_AUTO_PV - 1) ) { + /* we can have a PV of length UNUR_MAX_AUTO_PV */ + size_alloc = MALLOC_SIZE; + max_alloc = UNUR_MAX_AUTO_PV; + } + else { /* length of PV must be shorter than UNUR_MAX_AUTO_PV */ + size_alloc = max_alloc = INT_MAX - DISTR.domain[0]; + } + + /* init counter */ + n_pv = 0; + pv = NULL; + valid = FALSE; /* created PV is empty yet and not valid */ + cdf = 0.; /* cumulated sum of PV */ + cdf_old = 0.; /* cumulated sum of PV in last iteration */ + /* threshold for truncating PV */ + thresh_cdf = (distr->set & UNUR_DISTR_SET_PMFSUM) ? (1.-1.e-8)*DISTR.sum : UNUR_INFINITY; + + /* compute PV */ + for (n_alloc = size_alloc; n_alloc <= max_alloc; n_alloc += size_alloc) { + pv = _unur_xrealloc( pv, n_alloc * sizeof(double) ); + + if (DISTR.pmf) { + for (i=0; i thresh_cdf) { valid = TRUE; break; } + } + } + else if (DISTR.cdf) { + for (i=0; i thresh_cdf) { valid = TRUE; break; } + } + } + if (cdf > thresh_cdf) break; + } + + if (distr->set & UNUR_DISTR_SET_PMFSUM) { + /* make a warning if computed PV might not be valid */ + if (valid != TRUE) + /* not successful */ + _unur_warning(distr->name,UNUR_ERR_DISTR_GET,"PV truncated"); + } + else { /* PMFSUM not known */ + /* assume we have the important part of distribution */ + valid = TRUE; + DISTR.sum = cdf; + distr->set |= UNUR_DISTR_SET_PMFSUM; + } + +#undef MALLOC_SIZE + } + + /* store vector */ + DISTR.pv = pv; + DISTR.n_pv = n_pv; + DISTR.domain[1] = DISTR.domain[0] + n_pv - 1; + + /* o.k. */ + return (valid) ? n_pv : -n_pv; +} /* end of unur_distr_discr_make_pv() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_discr_get_pv( const struct unur_distr *distr, const double **pv ) + /*----------------------------------------------------------------------*/ + /* get length of probability vector and set pointer to probability */ + /* vector */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* pv ... pointer to probability vector */ + /* */ + /* return: */ + /* length of probability vector */ + /* */ + /* error: */ + /* return 0 */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, 0 ); + _unur_check_distr_object( distr, DISCR, 0 ); + + *pv = (DISTR.pv) ? DISTR.pv : NULL; + return DISTR.n_pv; + +} /* end of unur_distr_discr_get_pv() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_discr_eval_pv( int k, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* returns the value of the probability vector at k or, if there is no */ + /* probability vector defined, evaluates the pmf */ + /* */ + /* parampeters: */ + /* k ... argument for probability vector of pmf */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pv[k] or pmf(k) */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, DISCR, UNUR_INFINITY ); + + if (DISTR.pv != NULL) { + /* use probability vector */ + if (k < DISTR.domain[0] || k > DISTR.domain[1]) + return 0.; + else + return (DISTR.pv[k-DISTR.domain[0]]); + } + + if (DISTR.pmf != NULL) { + /* use PMF */ + double px = _unur_discr_PMF(k,distr); + if (_unur_isnan(px)) { + _unur_warning(distr->name,UNUR_ERR_DISTR_DATA,"PMF returns NaN"); + return 0.; + } + else + return px; + } + + /* else: data missing */ + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + +} /* end of unur_distr_discr_eval_pv() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_discr_set_pmf( struct unur_distr *distr, UNUR_FUNCT_DISCR *pmf ) + /*----------------------------------------------------------------------*/ + /* set PMF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* pmf ... pointer to PMF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_NULL( distr->name, pmf, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); + + /* it is not possible to set both a PMF and a PV */ + if (DISTR.pv != NULL) { + _unur_warning(distr->name,UNUR_ERR_DISTR_SET,"delete exisiting PV"); + free(DISTR.pv); DISTR.n_pv = 0; + } + + /* we do not allow overwriting a PMF */ + if (DISTR.pmf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of PMF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, sum, etc. might be wrong now! */ + + DISTR.pmf = pmf; + return UNUR_SUCCESS; + +} /* end of unur_distr_discr_set_pmf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_discr_set_cdf( struct unur_distr *distr, UNUR_FUNCT_DISCR *cdf ) + /*----------------------------------------------------------------------*/ + /* set CDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* cdf ... pointer to CDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_NULL( distr->name, cdf, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); + + /* it is not possible to set both a CDF and a PV */ + if (DISTR.pv != NULL) { + _unur_warning(distr->name,UNUR_ERR_DISTR_SET,"delete exisiting PV"); + free(DISTR.pv); DISTR.n_pv = 0; + } + + /* we do not allow overwriting a CDF */ + if (DISTR.cdf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of CDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, sum, etc. might be wrong now! */ + + DISTR.cdf = cdf; + return UNUR_SUCCESS; +} /* end of unur_distr_discr_set_cdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_discr_set_invcdf( struct unur_distr *distr, UNUR_IFUNCT_DISCR *invcdf ) + /*----------------------------------------------------------------------*/ + /* set inverse CDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* invcdf ... pointer to inverse CDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_NULL( distr->name, invcdf,UNUR_ERR_NULL ); + _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); + + /* we do not allow overwriting an inverse cdf */ + if (DISTR.invcdf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of inverse CDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* for derived distributions (e.g. order statistics) not possible */ + if (distr->base) return UNUR_ERR_DISTR_INVALID; + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + DISTR.invcdf = invcdf; + return UNUR_SUCCESS; +} /* end of unur_distr_discr_set_invcdf() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_FUNCT_DISCR * +unur_distr_discr_get_pmf( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get pointer to PMF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to PMF */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, DISCR, NULL ); + + return DISTR.pmf; +} /* end of unur_distr_discr_get_pmf() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_FUNCT_DISCR * +unur_distr_discr_get_cdf( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get pointer to CDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to CDF */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, DISCR, NULL ); + + return DISTR.cdf; +} /* end of unur_distr_discr_get_cdf() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_IFUNCT_DISCR * +unur_distr_discr_get_invcdf( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get pointer to inverse CDF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to inverse CDF */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, DISCR, NULL ); + + return DISTR.invcdf; +} /* end of unur_distr_discr_get_invcdf() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_discr_eval_pmf( int k, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate PMF of distribution at k */ + /* */ + /* parameters: */ + /* k ... argument for pmf */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pmf(k) */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, DISCR, UNUR_INFINITY ); + + if (DISTR.pmf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + } + + return _unur_discr_PMF(k,distr); +} /* end of unur_distr_discr_eval_pmf() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_discr_eval_cdf( int k, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate CDF of distribution at k */ + /* */ + /* parameters: */ + /* k ... argument for CDF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* CDF(k) */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, DISCR, UNUR_INFINITY ); + + if (DISTR.cdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_INFINITY; + } + + return _unur_discr_CDF(k,distr); +} /* end of unur_distr_discr_eval_cdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_discr_eval_invcdf( double u, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate inverse CDF of distribution at u */ + /* */ + /* parameters: */ + /* u ... argument for inverse CDF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* invcdf(u) */ + /* INT_MAX ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, INT_MAX ); + _unur_check_distr_object( distr, DISCR, INT_MAX ); + + if (DISTR.invcdf == NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return INT_MAX; + } + + if (u<=0.) + return DISTR.domain[0]; + if (u>=1.) + return DISTR.domain[1]; + else + return _unur_discr_invCDF(u,distr); + +} /* end of unur_distr_discr_eval_invcdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_discr_set_pmfstr( struct unur_distr *distr, const char *pmfstr ) + /*----------------------------------------------------------------------*/ + /* set PMF of distribution via a string interface */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* pmfstr ... string that describes function term of PMF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); + _unur_check_NULL( NULL, pmfstr, UNUR_ERR_NULL ); + + /* it is not possible to set a PMF when a PV is given. */ + if (DISTR.pv != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"PV given, cannot set PMF"); + return UNUR_ERR_DISTR_SET; + } + + /* we do not allow overwriting a PMF */ + if (DISTR.pmf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of PMF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* for derived distributions (e.g. order statistics) not possible */ + if (distr->base) return UNUR_ERR_DISTR_DATA; + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + /* parse PMF string */ + if ( (DISTR.pmftree = _unur_fstr2tree(pmfstr)) == NULL ) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Syntax error in function string"); + return UNUR_ERR_DISTR_SET; + } + DISTR.pmf = _unur_distr_discr_eval_pmf_tree; + + return UNUR_SUCCESS; +} /* end of unur_distr_discr_set_pmfstr() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_discr_set_cdfstr( struct unur_distr *distr, const char *cdfstr ) + /*----------------------------------------------------------------------*/ + /* set CDF of distribution via a string interface */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* cdfstr ... string that describes function term of CDF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); + _unur_check_NULL( NULL, cdfstr, UNUR_ERR_NULL ); + + /* we do not allow overwriting a CDF */ + if (DISTR.cdf != NULL) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of CDF not allowed"); + return UNUR_ERR_DISTR_SET; + } + + /* for derived distributions (e.g. order statistics) not possible */ + if (distr->base) return UNUR_ERR_DISTR_DATA; + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + /* parse string */ + if ( (DISTR.cdftree = _unur_fstr2tree(cdfstr)) == NULL ) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Syntax error in function string"); + return UNUR_ERR_DISTR_SET; + } + + /* set evaluation function */ + DISTR.cdf = _unur_distr_discr_eval_cdf_tree; + + return UNUR_SUCCESS; +} /* end of unur_distr_discr_set_cdfstr() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_distr_discr_eval_pmf_tree( int k, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate function tree for PMF. */ + /* */ + /* parameters: */ + /* k ... argument for PMF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* PMF at k */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, DISCR, UNUR_INFINITY ); + + return ((DISTR.pmftree) ? _unur_fstr_eval_tree(DISTR.pmftree,(double)k) : 0.); +} /* end of _unur_distr_discr_eval_pmf_tree() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_distr_discr_eval_cdf_tree( int k, const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* evaluate function tree for CDF. */ + /* */ + /* parameters: */ + /* k ... argument for CDF */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* CDF at k */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, DISCR, UNUR_INFINITY ); + + return ((DISTR.cdftree) ? _unur_fstr_eval_tree(DISTR.cdftree,(double)k) : 0.); +} /* end of _unur_distr_discr_eval_cdf_tree() */ + +/*---------------------------------------------------------------------------*/ + +char * +unur_distr_discr_get_pmfstr( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get PMF string that is given via the string interface */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to resulting string. */ + /* */ + /* comment: */ + /* This string should be freed when it is not used any more. */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, DISCR, NULL ); + _unur_check_NULL( NULL, DISTR.pmftree, NULL ); + + /* make and return string */ + return _unur_fstr_tree2string(DISTR.pmftree,"x","PMF",TRUE); +} /* end of unur_distr_discr_get_pmfstr() */ + +/*---------------------------------------------------------------------------*/ + +char * +unur_distr_discr_get_cdfstr( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get CDF string that is given via the string interface */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to resulting string. */ + /* */ + /* comment: */ + /* This string should be freed when it is not used any more. */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, DISCR, NULL ); + _unur_check_NULL( NULL, DISTR.cdftree, NULL ); + + /* make and return string */ + return _unur_fstr_tree2string(DISTR.cdftree,"x","CDF",TRUE); +} /* end of unur_distr_discr_get_cdfstr() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_discr_set_pmfparams( struct unur_distr *distr, const double *params, int n_params ) + /*----------------------------------------------------------------------*/ + /* set array of parameters for distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* params ... list of arguments */ + /* n_params ... number of arguments */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); + if (n_params>0) _unur_check_NULL(distr->name, params, UNUR_ERR_NULL); + + /* first check number of new parameter for the distribution */ + if (n_params < 0 || n_params > UNUR_DISTR_MAXPARAMS ) { + _unur_error(NULL,UNUR_ERR_DISTR_NPARAMS,""); + return UNUR_ERR_DISTR_NPARAMS; + } + + /* changelog */ + distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; + /* derived parameters like mode, area, etc. might be wrong now! */ + + /* even if the set routine fails, the derived parameters are + marked as unknown. but this is o.k. since in this case something + has been wrong. */ + + /* use special routine for setting parameters + (if there is one) */ + + if (DISTR.set_params) + return (DISTR.set_params(distr,params,n_params)); + + /* otherwise simply copy parameters */ + + DISTR.n_params = n_params; + if (n_params) memcpy( DISTR.params, params, n_params*sizeof(double) ); + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_discr_set_pmfparams() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_discr_get_pmfparams( const struct unur_distr *distr, const double **params ) + /*----------------------------------------------------------------------*/ + /* get number of pmf parameters and sets pointer to array params[] of */ + /* parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* params ... pointer to list of arguments */ + /* */ + /* return: */ + /* number of pmf parameters */ + /* */ + /* error: */ + /* return 0 */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, 0 ); + _unur_check_distr_object( distr, DISCR, 0 ); + + *params = (DISTR.n_params) ? DISTR.params : NULL; + return DISTR.n_params; + +} /* end of unur_distr_discr_get_pmfparams() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_discr_set_domain( struct unur_distr *distr, int left, int right ) + /*----------------------------------------------------------------------*/ + /* set the left and right borders of the domain of the distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* INT_MIN and INT_MAX are interpreted as (minus) infinity */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); + + /* check new parameter for distribution */ + if (left >= right) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"domain, left >= right"); + return UNUR_ERR_DISTR_SET; + } + + /* store data */ + DISTR.trunc[0] = DISTR.domain[0] = left; + DISTR.trunc[1] = DISTR.domain[1] = (DISTR.pv == NULL) ? right : left+DISTR.n_pv-1; + + /* changelog */ + distr->set |= UNUR_DISTR_SET_DOMAIN; + + /* if distr is an object for a standard distribution, this */ + /* not the original domain of it. (not a "standard domain") */ + /* However, since we have changed the domain, we assume */ + /* that this is not a truncated distribution. */ + /* At last we have to mark all derived parameters as unknown */ + distr->set &= ~(UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_TRUNCATED | + UNUR_DISTR_SET_MASK_DERIVED ); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_distr_discr_set_domain() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_discr_get_domain( const struct unur_distr *distr, int *left, int *right ) + /*----------------------------------------------------------------------*/ + /* set the left and right borders of the domain of the distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* INT_MIN and INT_MAX are interpreted as (minus) infinity */ + /* if no boundaries have been set [INT_MIN, INT_MAX] is returned. */ + /*----------------------------------------------------------------------*/ +{ + /* in case of error the boundaries are set to +/- UNUR_INFINITY */ + *left = INT_MIN; + *right = INT_MAX; + + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); + + /* o.k. */ + *left = DISTR.domain[0]; + *right = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of unur_distr_discr_get_domain() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_discr_set_mode( struct unur_distr *distr, int mode ) + /*----------------------------------------------------------------------*/ + /* set mode of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* mode ... mode of PMF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); + + DISTR.mode = mode; + + /* changelog */ + distr->set |= UNUR_DISTR_SET_MODE; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_distr_discr_set_mode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_discr_upd_mode( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* (re-) compute mode of distribution (if possible) */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); + + if (DISTR.upd_mode == NULL) { + /* no function to compute mode available */ + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_ERR_DISTR_DATA; + } + + /* compute mode */ + if ((DISTR.upd_mode)(distr)==UNUR_SUCCESS) { + /* changelog */ + distr->set |= UNUR_DISTR_SET_MODE; + return UNUR_SUCCESS; + } + else { + /* computing of mode failed */ + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); + return UNUR_ERR_DISTR_DATA; + } + +} /* end of unur_distr_discr_upd_mode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_discr_get_mode( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get mode of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* mode of distribution */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, INT_MAX ); + _unur_check_distr_object( distr, DISCR, INT_MAX ); + + /* mode known ? */ + if ( !(distr->set & UNUR_DISTR_SET_MODE) ) { + /* try to compute mode */ + if (DISTR.upd_mode == NULL) { + /* no function to compute mode available */ + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"mode"); + return INT_MAX; + } + else { + /* compute mode */ + if (unur_distr_discr_upd_mode(distr)!=UNUR_SUCCESS) { + /* finding mode not successfully */ + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"mode"); + return INT_MAX; + } + } + } + + return DISTR.mode; + +} /* end of unur_distr_discr_get_mode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_discr_set_pmfsum( struct unur_distr *distr, double sum ) + /*----------------------------------------------------------------------*/ + /* set sum over PMF */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* sum ... sum over PMF */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); + + /* check new parameter for distribution */ + if (sum <= 0.) { + _unur_error(distr->name,UNUR_ERR_DISTR_SET,"pmf sum <= 0"); + return UNUR_ERR_DISTR_SET; + } + + DISTR.sum = sum; + + /* changelog */ + distr->set |= UNUR_DISTR_SET_PMFSUM; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_distr_discr_set_pmfsum() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_discr_upd_pmfsum( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* (re-) compute sum over PMF of distribution (if possible) */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double sum = 0.; + int k, left, right, length; + + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_SET ); + + /* changelog */ + distr->set |= UNUR_DISTR_SET_PMFSUM; + + if (DISTR.upd_sum != NULL) { + /* try function given by distribution */ + if ((DISTR.upd_sum)(distr)==UNUR_SUCCESS) + return UNUR_SUCCESS; + } + + /* no function to compute sum available */ + left = DISTR.domain[0]; + right = DISTR.domain[1]; + length = right - left; + /* remark: length < 0 if right-left overflows */ + + + if (DISTR.cdf != NULL) { + /* use CDF */ + if (left > INT_MIN) left -= 1; + DISTR.sum = _unur_discr_CDF(right,distr) - _unur_discr_CDF(left,distr); + return UNUR_SUCCESS; + } + + if (DISTR.pv != NULL) { + for (k = 0; k<= length; k++) + /* use probability vector */ + sum += DISTR.pv[k]; + DISTR.sum = sum; + return UNUR_SUCCESS; + } + + if (DISTR.pmf != NULL && length > 0 && length <= MAX_PMF_DOMAIN_FOR_UPD_PMFSUM) { + /* use PMF */ + for (k = left; k<= right; k++) + sum += _unur_discr_PMF(k,distr); + DISTR.sum = sum; + return UNUR_SUCCESS; + } + + /* error: data missing */ + distr->set &= ~UNUR_DISTR_SET_PMFSUM; + _unur_error(distr->name,UNUR_ERR_DISTR_DATA,"Cannot compute sum"); + return UNUR_ERR_DISTR_DATA; + +} /* end of unur_distr_discr_upd_pmfsum() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_distr_discr_get_pmfsum( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get sum over PMF of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* sum over PMF of distribution */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_INFINITY ); + _unur_check_distr_object( distr, DISCR, UNUR_INFINITY ); + + /* sum known ? */ + if ( !(distr->set & UNUR_DISTR_SET_PMFSUM) ) { + /* try to compute sum */ + if ( unur_distr_discr_upd_pmfsum(distr) != UNUR_SUCCESS ) { + _unur_error(distr->name,UNUR_ERR_DISTR_GET,"sum"); + return UNUR_INFINITY; + } + } + + return DISTR.sum; + +} /* end of unur_distr_discr_get_pmfsum() */ + +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_distr_discr_debug( const struct unur_distr *distr, const char *genid, unsigned printvector ) + /*----------------------------------------------------------------------*/ + /* write info about distribution into LOG file */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* genid ... pointer to generator id */ + /* printvector ... whether the probability vector (if given) */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int i; + + /* check arguments */ + CHECK_NULL(distr,RETURN_VOID); + COOKIE_CHECK(distr,CK_DISTR_DISCR,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: distribution:\n",genid); + fprintf(LOG,"%s:\ttype = discrete univariate distribution\n",genid); + fprintf(LOG,"%s:\tname = %s\n",genid,distr->name); + + if ( DISTR.pmf ) { + /* have probability mass function */ + fprintf(LOG,"%s:\tPMF with %d argument(s)\n",genid,DISTR.n_params); + for( i=0; i0) { + /* have probability vector */ + fprintf(LOG,"%s:\tprobability vector of length %d",genid,DISTR.n_pv); + if (printvector) { + for (i=0; i0) { + /* have probability vector */ + fprintf(LOG,"%s:\tdomain for pv = (%d, %d)",genid,DISTR.domain[0],DISTR.domain[0]-1+DISTR.n_pv); + _unur_print_if_default(distr,UNUR_DISTR_SET_DOMAIN); + fprintf(LOG,"\n%s:\n",genid); + } + + if (distr->set & UNUR_DISTR_SET_MODE) + fprintf(LOG,"%s:\tmode = %d\n",genid,DISTR.mode); + else + fprintf(LOG,"%s:\tmode unknown\n",genid); + + if (distr->set & UNUR_DISTR_SET_PMFSUM) + fprintf(LOG,"%s:\tsum over PMF = %g\n",genid,DISTR.sum); + else + fprintf(LOG,"%s:\tsum over PMF unknown\n",genid); + fprintf(LOG,"%s:\n",genid); + +} /* end of _unur_distr_discr_debug() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_distr_discr_find_mode(struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* find mode of a probability vector by bisection. */ + /* */ + /* Assumptions: PMF is unimodal, no "inflexion" ("saddle") points. */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ +#define N_TRIALS (100) + + int x[3]; /* bracket for mode x[0] < x[1] < x[2] */ + double fx[3]; /* PMF values at bracket points */ + int xnew; /* new point in iteration */ + double fxnew; /* PMF value at new point */ + int step; /* auxiliary variable for searching point */ + int this, other; /* side of bracket under consideration */ + int cutthis; /* which side of bracket should be cut */ + + const double r = (sqrt(5.)-1.)/2.; /* sectio aurea */ + + /* check arguments */ + CHECK_NULL( distr, UNUR_ERR_NULL ); + _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); + + /* left and right boundary point of bracket */ + x[0] = DISTR.domain[0]; + x[2] = DISTR.domain[1]; + fx[0] = unur_distr_discr_eval_pv(x[0], distr); + fx[2] = unur_distr_discr_eval_pv(x[2], distr); + + /* we assume for our algorithm that there are at least three points */ + if (x[2] <= x[0] + 1) { + /* we have one or two points only */ + DISTR.mode = (fx[0] <= fx[2]) ? x[2] : x[0]; + distr->set |= UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_MODE_APPROX ; + return UNUR_SUCCESS; + } + + /* --- middle point of bracket ------------------------------------------- */ + /* we have to find a middle point where the PMF is non-zero */ + + /* first trial: mean of boundary points */ + x[1] = (x[0]/2) + (x[2]/2); + if (x[1]<=x[0]) x[1]++; + if (x[1]>=x[2]) x[1]--; + fx[1] = unur_distr_discr_eval_pv(x[1], distr); + + /* second trial: start search from left boundary */ + if ( !(fx[1]>0.)) { + xnew = (DISTR.domain[0]!=INT_MIN) ? DISTR.domain[0] : 0; + for (step = 1; step < N_TRIALS; step++) { + xnew += step; + if (xnew >= DISTR.domain[1]) break; + if ((fxnew = unur_distr_discr_eval_pv(xnew,distr)) > 0.) { + x[1] = xnew; fx[1] = fxnew; break; + } + } + } + + /* third trial: start search from 0 */ + if ( !(fx[1]>0.) && DISTR.domain[0]!=0) { + xnew = 0; + for (step = 1; step < N_TRIALS; step++) { + xnew += step; + if (xnew >= DISTR.domain[1]) break; + if ((fxnew = unur_distr_discr_eval_pv(xnew,distr)) > 0.) { + x[1] = xnew; fx[1] = fxnew; break; + } + } + } + + /* forth trial: start search from right boundary */ + if ( !(fx[1]>0.) && DISTR.domain[1]!=INT_MAX) { + xnew = DISTR.domain[1]; + for (step = 1; step < N_TRIALS; step++) { + xnew -= step; + if (xnew <= DISTR.domain[0]) break; + if ((fxnew = unur_distr_discr_eval_pv(xnew,distr)) > 0.) { + x[1] = xnew; fx[1] = fxnew; break; + } + } + } + + if ( !(fx[1]>0.)) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA, + "find_mode(): no positive entry in PV found"); + return UNUR_ERR_DISTR_DATA; + } + if (fx[1]name,UNUR_ERR_DISTR_DATA, "find_mode(): PV not unimodal"); + return UNUR_ERR_DISTR_DATA; + } + + /* --- middle point of bracket found ------------------------------------- */ + + /* --- interate until maximum is found ----------------------------------- */ + + while (1) { + + /* fprintf(stderr,"x = %d, %d, %d\n",x[0],x[1],x[2]); */ + /* fprintf(stderr,"fx = %g, %g, %g\n",fx[0],fx[1],fx[2]); */ + + /* terminate */ + if (x[0]+1 >= x[1] && x[1] >= x[2]-1) { + DISTR.mode = (fx[0]>fx[2]) ? x[0] : x[2]; + if (fx[1]>DISTR.mode) DISTR.mode = x[1]; + distr->set |= UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_MODE_APPROX ; + return UNUR_SUCCESS; + } + + /* new point */ + xnew = (int) (r*x[0] + (1.-r)*x[2]); + if (xnew == x[0]) ++xnew; + if (xnew == x[2]) --xnew; + if (xnew == x[1]) xnew += (x[1]-1==x[0]) ? 1 : -1; + + /* side of bracket */ + if (xnew < x[1]) { + this = 0; other = 2; } /* l.h.s. of bracket */ + else { + this = 2; other = 0; } /* r.h.s. of bracket */ + + /* value at new point */ + fxnew = unur_distr_discr_eval_pv(xnew,distr); + if ( fxnew < fx[0] && fxnew < fx[2] ) { + _unur_error(distr->name,UNUR_ERR_DISTR_DATA, "find_mode(): PV not unimodal"); + return UNUR_ERR_DISTR_DATA; + } + + do { + + if (!_unur_FP_same(fxnew,fx[1])) { + cutthis = (fxnew > fx[1]) ? FALSE : TRUE; + break; + } + + /* else: fxnew == fx[1] */ + + if (fx[this] > fx[1]) { cutthis = FALSE; break; } + if (fx[other] > fx[1]) { cutthis = TRUE; break; } + + /* else: fx[0] < fxnew && fx[1] == fxnew && fx[2] < fxnew */ + + for (step = 1; step < N_TRIALS && xnew >= x[0] && xnew <= x[2]; step++) { + xnew += (this==0) ? -1 : 1; + fxnew = unur_distr_discr_eval_pv(xnew,distr); + if (_unur_FP_less(fxnew,fx[1])) { + DISTR.mode = x[1]; + distr->set |= UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_MODE_APPROX ; + return UNUR_SUCCESS; + } + } + + _unur_error(distr->name,UNUR_ERR_DISTR_DATA, "find_mode(): PV not unimodal"); + return UNUR_ERR_DISTR_DATA; + + } while (0); + + if (cutthis) { + x[this] = xnew; fx[this] = fxnew; + } + else { + x[other] = x[1]; fx[other] = fx[1]; + x[1] = xnew; fx[1] = fxnew; + } + + } /* --- end while(1) --- */ + + /* changelog */ + /* distr->set |= UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_MODE_APPROX ; */ + + /* o.k. */ + /* return UNUR_SUCCESS; */ + +} /* end of _unur_distr_discr_find_mode() */ + +/*---------------------------------------------------------------------------*/ +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distr/discr.h b/vendor/unuran-1.11.0/src/distr/discr.h new file mode 100644 index 0000000..82c608e --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/discr.h @@ -0,0 +1,426 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: discr.h * + * * + * PURPOSE: * + * function prototypes for manipulating distribution objects of * + * type DISCR (discrete univariate distribution) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/* + =NODEX DISCR Discrete univariate distributions + + =UP Distribution_objects [50] + + =DESCRIPTION + The calls in this section can be applied to discrete + univariate distributions. + + @itemize @minus + @item Create a @command{new} instance of a discrete univariate + distribution. + + @item Handle and evaluate + distribution function (CDF, @command{cdf}) and + probability mass function (PMF, @command{pmf}). + The following is important: + @itemize . + @item @command{pmf} need not be normalized, i.e., + any summable nonnegative function on the set of intergers can be + used. + @item @command{cdf} must be a distribution function, i.e. it + must be monotonically increasing with range [0,1]. + @item If @command{cdf} and @command{pdf} are used together for a + pariticular generation method, then @command{pmf} must be + normalized, i.e. it must sum to 1. + @end itemize + + @item Alternatively, @command{cdf} and @command{pdf} can be + provided as @command{str}ings instead of function pointers. + + @item Some generation methods require a (finite) probability + vector (PV, @command{pv}), i.e. an array of @code{double}s. + It can be automatically computed if the @command{pmf} is + given but @command{pv} is not. + + @item Set (and change) parameters (@command{pmfparams}) and the + total sum (@command{pmfsum}) of the given PMF or PV. + + @item Set the @command{mode} of the distribution. + + @item Set the @command{domain} of the distribution. + + @end itemize + + =END +*/ + +/*---------------------------------------------------------------------------*/ + +/* + Routines for handling univariate discrete distributions (DISCR). +*/ + +/* =ROUTINES */ + +UNUR_DISTR *unur_distr_discr_new( void ); +/* + Create a new (empty) object for a univariate discrete distribution. +*/ + + +/* ==DOC + @subsubheading Essential parameters + + There are two interfaces for discrete univariate distributions: + Either provide a (finite) probability vector (PV). + Or provide a probability mass function (PMF). For the latter + case there are also a couple of derived parameters that are not + required when a PV is given. + + It is not possible to set both a PMF and a PV directly. However, the + PV can be computed from the PMF (or the CDF if no PMF is available) + by means of a unur_distr_discr_make_pv() call. + If both the PV and the PMF are given in the distribution object it + depends on the generation method which of these is used. +*/ + +int unur_distr_discr_set_pv( UNUR_DISTR *distribution, const double *pv, int n_pv ); +/* + Set finite probability vector (PV) for the @var{distribution}. It is not + necessary that the entries in the given PV sum to 1. + @var{n_pv} must be positive. However, there is no testing + whether all entries in @var{pv} are non-negative. + + If no domain has been set, then the left boundary is set to + @code{0}, by default. If @var{n_pv} is too large, e.g. because + left boundary + @var{n_pv} exceeds the range of integers, + then the call fails. + + Notice that it is not possible to set both a PV and a PMF or CDF. + If the PMF or CDF is set first one cannot set the PV. + If the PMF or CDF is set first after a PV is set, the latter is + removed (and recomputed using unur_distr_discr_make_pv() when required). +*/ + +int unur_distr_discr_make_pv( UNUR_DISTR *distribution ); +/* + Compute a PV when a PMF or CDF is given. However, when the + domain is not given or is too large and the sum over the PMF is given + then the (right) tail of the @var{distribution} is chopped off such that + the probability for the tail region is less than 1.e-8. + If the sum over the PMF is not given a PV of maximal length is + computed. + + The maximal size of the created PV is bounded by the macro + @code{UNUR_MAX_AUTO_PV} that is defined in @file{unuran_config.h}. + + If successful, the length of the generated PV is returned. + If the sum over the PMF on the chopped tail is not neglible small + (i.e. greater than 1.e-8 or unknown) than the + negative of the length of the PV is returned and + @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. + + Notice that the left boundary of the PV is set to @code{0} by + default when a discrete distribution object is created from + scratch. + + If computing a PV fails for some reasons, an error code is returned and + @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. +*/ + +int unur_distr_discr_get_pv( const UNUR_DISTR *distribution, const double **pv ); +/* + Get length of PV of the @var{distribution} and set pointer + @var{pv} to array of probabilities. If no PV is given, + an error code is returned and @var{pv} is set to NULL.@* + (It does not call unur_distr_discr_make_pv()!) +*/ + +int unur_distr_discr_set_pmf( UNUR_DISTR *distribution, UNUR_FUNCT_DISCR *pmf ); +/* */ + +int unur_distr_discr_set_cdf( UNUR_DISTR *distribution, UNUR_FUNCT_DISCR *cdf ); +/* + Set respective pointer to the PMF and the CDF of the @var{distribution}. + These functions must be of type + @code{double funct(int k, const UNUR_DISTR *distr)}. + + It is important to note that all these functions must return a + result for all integers @var{k}. E.g., if the domain of a given + PMF is the interval @{1,2,3,@dots{},100@}, than the given function + must return @code{0.0} for all points outside this interval. + + The default domain for the PMF or CDF is [@code{0}, @code{INT_MAX}]. + The domain can be changed using a unur_distr_discr_set_domain() call. + + It is not possible to change such a function. Once the PMF or + CDF is set it cannot be overwritten. A new distribution object + has to be used instead. + + Notice that it is not possible to set both a PV and a PMF or CDF. + If the PMF or CDF is set first one cannot set the PV. + If the PMF or CDF is set first after a PV is set, the latter is + removed (and recomputed using unur_distr_discr_make_pv() when required). +*/ + +int unur_distr_discr_set_invcdf( UNUR_DISTR *distribution, UNUR_IFUNCT_DISCR *invcdf ); +/* + Set inverse CDF of the @var{distribution}. + @var{invcdf} must be a pointer must be of type + @code{int funct(double x, const UNUR_DISTR *distr)}, + i.e., it should return a @code{double}. +*/ + + +UNUR_FUNCT_DISCR *unur_distr_discr_get_pmf( const UNUR_DISTR *distribution ); +/* */ + +UNUR_FUNCT_DISCR *unur_distr_discr_get_cdf( const UNUR_DISTR *distribution ); +/* + Get the respective pointer to the PMF and the CDF of the + @var{distribution}. The pointer is of type + @code{double funct(int k, const UNUR_DISTR *distr)}. + If the corresponding function is not available for the @var{distribution}, + the NULL pointer is returned. +*/ + +UNUR_IFUNCT_DISCR *unur_distr_discr_get_invcdf( const UNUR_DISTR *distribution ); +/* + Get pointer to the inverse CDF of the @var{distribution}. + The pointer is of type + @code{int funct(double x, const UNUR_DISTR *distr)}. + If the corresponding function is not available for the distribution, + the NULL pointer is returned. +*/ + + +double unur_distr_discr_eval_pv(int k, const UNUR_DISTR *distribution ); +/* */ + +double unur_distr_discr_eval_pmf( int k, const UNUR_DISTR *distribution ); +/* */ + +double unur_distr_discr_eval_cdf( int k, const UNUR_DISTR *distribution ); +/* + Evaluate the PV, PMF, and the CDF, respectively, at k. + Notice that @var{distribution} must not be the NULL pointer. + If no PV is set for the @var{distribution}, then + unur_distr_discr_eval_pv() behaves like unur_distr_discr_eval_pmf(). + If the corresponding function is not available for the @var{distribution}, + @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_DATA}. + + @emph{IMPORTANT:} + In the case of a truncated standard distribution these calls always + return the respective values of the @emph{untruncated} distribution! +*/ + +int unur_distr_discr_eval_invcdf( double u, const UNUR_DISTR *distribution ); +/* + Evaluate the inverse CDF at @var{u}. + Notice that @var{distribution} must not be the NULL pointer. + If the corresponding function is not available for the distribution, + @code{INT_MAX} is returned and @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_DATA}. + + @emph{IMPORTANT:} + In the case of a truncated standard distribution these calls always + return the respective values of the @emph{untruncated} distribution! +*/ + + +int unur_distr_discr_set_pmfstr( UNUR_DISTR *distribution, const char *pmfstr ); +/* + This function provides an alternative way to set a PMF of the + @var{distribution}. + @var{pmfstr} is a character string that contains the formula + for the PMF, see @ref{StringFunct,,Function String}, for details. + See also the remarks for the unur_distr_discr_set_pmf() call. + + It is not possible to call this funtion twice or to call this + function after a unur_distr_discr_set_pmf() call. +*/ + +int unur_distr_discr_set_cdfstr( UNUR_DISTR *distribution, const char *cdfstr ); +/* + This function provides an alternative way to set a CDF; analogously + to the unur_distr_discr_set_pmfstr() call. +*/ + +char *unur_distr_discr_get_pmfstr( const UNUR_DISTR *distribution ); +/* */ + +char *unur_distr_discr_get_cdfstr( const UNUR_DISTR *distribution ); +/* + Get pointer to respective string for PMF and CDF + of @var{distribution} that is given via the string interface. + This call allocates memory to produce this string. It should be + freed when it is not used any more. +*/ + +int unur_distr_discr_set_pmfparams( UNUR_DISTR *distribution, const double *params, int n_params ); +/* + Set array of parameters for @var{distribution}. There is an upper limit + for the number of parameters @var{n_params}. It is given by the + macro @code{UNUR_DISTR_MAXPARAMS} in @file{unuran_config.h}. (It is set to + 5 but can be changed to any appropriate nonnegative number.) + If @var{n_params} is negative or exceeds this limit no parameters + are copied into the @var{distribution} object and @code{unur_errno} + is set to @code{UNUR_ERR_DISTR_NPARAMS}. + + + For standard distributions from the UNU.RAN library the parameters + are checked. Moreover, the domain is updated automatically unless it + has been changed before by a unur_distr_discr_set_domain() call. + If the given parameters are invalid for the standard distribution, + then no parameters are set and an error code is returned. + Notice that the given parameter list for such a distribution is + handled in the same way as in the corresponding @command{new} + calls, i.e. optional parameters for the PDF that are not present in + the given list are (re-)set to their default values. + + @emph{Important:} Integer parameter must be given as @code{double}s. +*/ + +int unur_distr_discr_get_pmfparams( const UNUR_DISTR *distribution, const double **params ); +/* + Get number of parameters of the PMF and set pointer + @var{params} to array of parameters. If no parameters are stored + in the object, an error code is returned and @code{params} is set to + NULL. +*/ + +int unur_distr_discr_set_domain( UNUR_DISTR *distribution, int left, int right ); +/* + Set the left and right borders of the domain of the + @var{distribution}. This can also be used to truncate an existing + distribution. For setting the boundary to @unurmath{\pm\infty} use + @code{INT_MIN} and @code{INT_MAX}, respectively. + If @var{right} is not strictly greater than @var{left} no domain + is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. + It is allowed to use this call to increase the domain. + If the PV of the discrete distribution is used, + than the right boudary is ignored (and internally set to + @var{left} + size of PV @math{- 1}). + Notice that @code{INT_MIN} and @code{INT_MAX} are interpreted as + (minus/plus) infinity. + + Default: [@code{0}, @code{INT_MAX}]. +*/ + +int unur_distr_discr_get_domain( const UNUR_DISTR *distribution, int *left, int *right ); +/* + Get the left and right borders of the domain of the + @var{distribution}. If the domain is not set explicitly + the interval [@code{INT_MIN}, @code{INT_MAX}] is assumed and returned. + When a PV is given then the domain is set automatically to + [@code{0},size of PV @math{- 1}]. +*/ + + +/* ==DOC + @subsubheading Derived parameters + + The following paramters @strong{must} be set whenever one of the essential + parameters has been set or changed (and the parameter is required + for the chosen method). +*/ + +int unur_distr_discr_set_mode( UNUR_DISTR *distribution, int mode ); +/* + Set mode of @var{distribution}. +*/ + +int unur_distr_discr_upd_mode( UNUR_DISTR *distribution ); +/* + Recompute the mode of the @var{distribution}. This call works properly + for distribution objects from the + UNU.RAN library of standard distributions + when the corresponding function is available. + Otherwise a (slow) numerical mode finder is used. It only works properly + for unimodal probability mass functions. If it failes + @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. +*/ + +int unur_distr_discr_get_mode( UNUR_DISTR *distribution ); +/* + Get mode of @var{distribution}. If the mode is not marked as known, + unur_distr_discr_upd_mode() is called to compute the mode. If this + is not successful @code{INT_MAX} is returned and + @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. + (There is no difference between the case where no routine for + computing the mode is available and the case where no mode exists + for the distribution at all.) +*/ + + +int unur_distr_discr_set_pmfsum( UNUR_DISTR *distribution, double sum ); +/* + Set the sum over the PMF. If @code{sum} is non-positive, no + sum is set and @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_SET}. + + For a distribution object created by the + UNU.RAN library of standard distributions you always should use + the unur_distr_discr_upd_pmfsum(). Otherwise there might be + ambiguous side-effects. +*/ + +int unur_distr_discr_upd_pmfsum( UNUR_DISTR *distribution ); +/* + Recompute the sum over the PMF of the @var{distribution}. + In most cases the normalization constant is recomputed and thus the + sum is 1. This call works for distribution objects from the UNU.RAN + library of standard distributions when the corresponding function + is available. When a PV, a PMF with finite domain, or a CDF is + given, a simple generic function which uses a naive summation loop + is used. If this computation is not possible, an error code is + returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. + + The call does not work for distributions from the + UNU.RAN library of standard distributions with truncated + domain when the CDF is not available. +*/ + +double unur_distr_discr_get_pmfsum( UNUR_DISTR *distribution ); +/* + Get the sum over the PMF of the @var{distribution}. If this sum is + not known, unur_distr_discr_upd_pmfsum() is called to compute + it. If this is not successful @code{UNUR_INFINITY} is returned and + @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distr/distr.c b/vendor/unuran-1.11.0/src/distr/distr.c new file mode 100644 index 0000000..0a0a447 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/distr.c @@ -0,0 +1,415 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: distr.c * + * * + * manipulate distribution objects * + * * + * PARAMETER: struct unur_distr * * + * * + * return: * + * UNUR_SUCCESS ... on success * + * error code ... on error * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include "distr.h" +#include "distr_source.h" + + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** routines for all distribution objects **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +_unur_distr_generic_new( void ) + /*----------------------------------------------------------------------*/ + /* generic creator for distribution object */ + /* */ + /* parameters: none */ + /* */ + /* return: */ + /* pointer empty distribution object */ + /* NULL in case of an error */ + /*----------------------------------------------------------------------*/ +{ + register struct unur_distr *distr; + + /* allocate structure */ + distr = _unur_xmalloc( sizeof(struct unur_distr) ); + if (!distr) return NULL; + + /* set type of distribution */ + distr->type = UNUR_DISTR_GENERIC; + + /* set id to generic distribution */ + distr->id = UNUR_DISTR_GENERIC; + + /* dimension of random vector */ + distr->dim = 1; /* assume univariant */ + + /* name of distribution */ + distr->name = "unknown"; + distr->name_str = NULL; + + /* this is not a derived distribution */ + distr->base = NULL; + + /* defaults */ + distr->destroy = NULL; /* destructor: not set */ + distr->clone = NULL; /* copy operator: not set */ + distr->extobj = NULL; /* pointer to external object: empty */ + distr->set = 0u; /* parameters: none set */ + + /* return pointer to object */ + return distr; + +} /* end of _unur_distr_generic_new() */ + +/*---------------------------------------------------------------------------*/ + +void +unur_distr_free( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* free distribution object */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /*----------------------------------------------------------------------*/ +{ + if (distr) _unur_distr_free( distr ); +} /* end of unur_distr_free() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_set_name( struct unur_distr *distr, const char *name ) + /*----------------------------------------------------------------------*/ + /* set name of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* name ... name of distribution */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + size_t len; + char *name_str; + + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + + /* allocate memory for storing string */ + len = strlen(name) + 1; + name_str = _unur_xrealloc(distr->name_str,len); + + /* copy string */ + memcpy( name_str, name, len ); + + /* store string in distribution object */ + distr->name_str = name_str; + distr->name = name_str; + + return UNUR_SUCCESS; +} /* end of unur_distr_set_name() */ + +/*---------------------------------------------------------------------------*/ + +const char * +unur_distr_get_name( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get name of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* name of distribution */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + + return distr->name; +} /* end of unur_distr_get_name() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_get_dim( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get number of components of random vector (i.e. its dimension) */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* dimension */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, 0 ); + + return distr->dim; +} /* end of unur_distr_get_dim() */ + +/*---------------------------------------------------------------------------*/ + +unsigned int +unur_distr_get_type( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get type of distribution */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* type of distribution */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, 0u ); + + return (distr->type); +} /* end of unur_distr_get_type() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_is_cont( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* TRUE if distribution is univariate continuous. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* TRUE ... if continuous distribution */ + /* FALSE ... otherwise (and in case of an error) */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, FALSE ); + + return ((distr->type == UNUR_DISTR_CONT) ? TRUE : FALSE); +} /* end of unur_distr_is_cont() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_is_cvec( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* TRUE if distribution is multivariate continuous. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* TRUE ... if multivariate continuous */ + /* FALSE ... otherwise (and in case of an error) */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, FALSE ); + + return ((distr->type == UNUR_DISTR_CVEC) ? TRUE : FALSE); +} /* end of unur_distr_is_cvec() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_is_cvemp( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* TRUE if distribution is empirical multivariate continuous. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* TRUE ... if empirical multivariate continuous */ + /* FALSE ... otherwise (and in case of an error) */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, FALSE ); + + return ((distr->type == UNUR_DISTR_CVEMP) ? TRUE : FALSE); +} /* end of unur_distr_is_cvemp() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_is_matr( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* TRUE if distribution is matrix distribution. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* TRUE ... if matrix distribution */ + /* FALSE ... otherwise (and in case of an error) */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, FALSE ); + + return ((distr->type == UNUR_DISTR_MATR) ? TRUE : FALSE); +} /* end of unur_distr_is_matr() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_is_discr( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* TRUE if distribution is univariate discrete. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* TREU ... if univariate discrete */ + /* FALSE ... otherwise (and in case of an error) */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, FALSE ); + + return ((distr->type == UNUR_DISTR_DISCR) ? TRUE : FALSE); +} /* end of unur_distr_is_discr() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_is_cemp( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* TRUE if distribution is empirical univariate continuous, */ + /* i.e. a sample. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* TRUE ... if univariate discrete */ + /* FALSE ... otherwise (and in case of an error) */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, FALSE ); + + return ((distr->type == UNUR_DISTR_CEMP) ? TRUE : FALSE); +} /* end of unur_distr_is_cemp() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_clone( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* copy (clone) distribution object */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to clone of distribution object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( "Clone", distr, NULL ); + _unur_check_NULL( "Clone", distr->clone, NULL ); + + return (distr->clone(distr)); +} /* end of unur_distr_clone() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_set_extobj( struct unur_distr *distr, const void *extobj ) + /*----------------------------------------------------------------------*/ + /* store a pointer to an external object */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* extobj ... pointer to external object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); + + /* store data */ + distr->extobj = extobj; + + return UNUR_SUCCESS; + +} /* end of unur_distr_set_extobj() */ + +/*---------------------------------------------------------------------------*/ + +const void * +unur_distr_get_extobj( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get the pointer to the external object */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* pointer to external object */ + /* (NULL if not is given) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + + return distr->extobj; +} /* unur_distr_get_extobj() */ + +/*---------------------------------------------------------------------------*/ + + diff --git a/vendor/unuran-1.11.0/src/distr/distr.h b/vendor/unuran-1.11.0/src/distr/distr.h new file mode 100644 index 0000000..f37c635 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/distr.h @@ -0,0 +1,323 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: distr.h * + * * + * PURPOSE: * + * function prototypes for manipulating distribution objects * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =NODEX Distribution_objects Handling distribution objects + + =UP TOP [30] + + =DESCRIPTION + Objects of type @code{UNUR_DISTR} are used for handling + distributions. All data about a distribution are stored in this + object. UNU.RAN provides functions that return instances of such + objects for standard distributions + (@pxref{Stddist,,Standard distributions}). + It is then possible to change these distribution objects by + various set calls. Moreover, it is possible to build a + distribution object entirely from scratch. For this purpose + there exists @command{unur_distr__new} calls that + return an empty object of this type for each object type + (eg. univariate contiuous) which can be filled with the + appropriate set calls. + + UNU.RAN distinguishes between several types of distributions, + each of which has its own sets of possible parameters (for + details see the corresponding sections): + @itemize @minus + @item continuous univariate distributions + @item continuous univariate order statistics + @item continuous empirical univariate distributions + @item continuous multivariate distributions + @item continuous empirical multivariate distributions + @item matrix distributions + @item discrete univariate distributions + @end itemize + + Notice that there are essential data about a distribution, + eg. the PDF, a list of (shape, scale, location) parameters for + the distribution, and the domain of (the possibly truncated) + distribution. And there exist parameters that are/can be + derived from these, eg. the mode of the distribution or the area + below the given PDF (which need not be normalized for many + methods). UNU.RAN keeps track of parameters which are + known. Thus if one of the essential parameters is changed all + derived parameters are marked as unknown and must be set again + if these are required for the chosen generation method. + Additionally to set calls there are calls for updating derived + parameters for objects provided by the UNU.RAN library of standard + distributions (one for each parameter to avoid computational + overhead since not all parameters are required for all generator + methods). + + All parameters of distribution objects can be read by + corresponding get calls. + + Every generator object has its own copy of a distribution object + which is accessible by a unur_get_distr() call. Thus the + parameter for this distribution can be read. However, + @strong{never} extract the distribution object out of a + generator object and run one of the set calls on it to modify + the distribution. (How should the poor generator object know + what has happend?) Instead there exist calls for each of the + generator methods that change particular parameters of the + internal copy of the distribution object. + + =HOWTOUSE + UNU.RAN collects all data required for a particular generation + method in a @emph{distribution object}. There are two ways to + get an instance of a distributions object: + @enumerate + @item + Build a distribtion from scratch, by means of + the corresponding @command{unur_distr__new} call, + where @command{} is the type of the distribution as + listed in the below subsections. + + @item + Use the corresponding @command{unur_distr__new} call + to get prebuild distribution from the UNU.RAN library of standard + distributions. + Here @command{} is the name of the + standard distribution in @ref{Stddist,,Standard distributions}. + @end enumerate + + In either cases the corresponding + @command{unur_distr__set_} calls to set the + necessary parameters @command{} (case 1), or + change the values of the standard distribution in case 2 (if + this makes sense for you). In the latter case @command{} + is the type to which the standard distribution belongs to. + These @command{set} calls return @code{UNUR_SUCCESS} when the + correspondig parameter has been set successfully. Otherwise an + error code is returned. + + The parameters of a distribution are divided into + @emph{essential} and @emph{derived} parameters. + + Notice, that there are some restrictions in setting parameters + to avoid possible confusions. + Changing essential parameters marks derived parameters as + @code{unknown}. Some of the parameters cannot be changed any + more when already set; some parameters block each others. + In such a case a new instance of a distribution object has to be + build. + + Additionally @command{unur_distr__upd_} calls can + be used for updating derived parameters for objects provided by + the UNU.RAN library of standard distributions. + + All parameters of a distribution object get be read by means of + @command{unur_distr__get_} calls. + + Every distribution object be identified by its @code{name} which + is a string of arbitrary characters provided by the user. For + standard distribution it is automatically set to + @command{} in the corresponding @command{new} call. It can + be changed to any other string. + + =EON +*/ + +/*---------------------------------------------------------------------------*/ + +/* + =NODEX AllDistr Functions for all kinds of distribution objects + + =UP Distribution_objects [05] + + =DESCRIPTION + The calls in this section can be applied to all distribution + objects. + + @itemize @minus + @item Destroy @command{free} an instance of a generator object. + + @item Ask for the @command{type} of a generator object. + + @item Ask for the @command{dimension} of a generator object. + + @item Deal with the @command{name} (identifier string) of a generator object. + @end itemize + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* types of distribtuions */ + +enum { + UNUR_DISTR_CONT = 0x010u, /* univariate continuous distribution */ + UNUR_DISTR_CEMP = 0x011u, /* empirical univ. cont. distr. (a sample) */ + UNUR_DISTR_CVEC = 0x110u, /* mulitvariate continuous distribution */ + UNUR_DISTR_CVEMP = 0x111u, /* empirical multiv. cont. distr. (sample) */ + UNUR_DISTR_MATR = 0x210u, /* matrix distribution */ + UNUR_DISTR_DISCR = 0x020u /* univariate discrete distribution */ +}; + +/*---------------------------------------------------------------------------*/ + +/* + Parameters common to all distributions. +*/ + +/* =ROUTINES */ + +void unur_distr_free( UNUR_DISTR *distribution ); +/* + Destroy the @var{distribution} object. +*/ + + +int unur_distr_set_name( UNUR_DISTR *distribution, const char *name ); +/* */ + +const char *unur_distr_get_name( const UNUR_DISTR *distribution ); +/* + Set and get @var{name} of @var{distribution}. The @var{name} can be + an arbitrary character string. It can be used to identify generator + objects for the user. It is used by UNU.RAN when printing + information of the distribution object into a log files. +*/ + + +int unur_distr_get_dim( const UNUR_DISTR *distribution ); +/* + Get number of components of a random vector (its dimension) the + @var{distribution}. + + For univariate distributions it returns dimension @code{1}. + + For matrix distributions it returns the number of components + (i.e., number of rows times number of columns). + When the respective numbers of rows and columns are needed use + unur_distr_matr_get_dim() instead. +*/ + + +unsigned int unur_distr_get_type( const UNUR_DISTR *distribution ); +/* + Get type of @var{distribution}. + Possible types are + @table @code + @item UNUR_DISTR_CONT + univariate continuous distribution + @item UNUR_DISTR_CEMP + empirical continuous univariate distribution (i.e. a sample) + @item UNUR_DISTR_CVEC + continuous mulitvariate distribution + @item UNUR_DISTR_CVEMP + empirical continuous multivariate distribution (i.e. a vector sample) + @item UNUR_DISTR_DISCR + discrete univariate distribution + @item UNUR_DISTR_MATR + matrix distribution + @end table + + Alternatively the @command{unur_distr_is_} + calls can be used. +*/ + +int unur_distr_is_cont( const UNUR_DISTR *distribution ); +/* + TRUE if @var{distribution} is a continuous univariate distribution. +*/ + +int unur_distr_is_cvec( const UNUR_DISTR *distribution ); +/* + TRUE if @var{distribution} is a continuous multivariate distribution. +*/ + +int unur_distr_is_cemp( const UNUR_DISTR *distribution ); +/* + TRUE if @var{distribution} is an empirical continuous univariate distribution, + i.e. a sample. +*/ + +int unur_distr_is_cvemp( const UNUR_DISTR *distribution ); +/* + TRUE if @var{distribution} is an empirical continuous multivariate + distribution. +*/ + +int unur_distr_is_discr( const UNUR_DISTR *distribution ); +/* + TRUE if @var{distribution} is a discrete univariate distribution. +*/ + +int unur_distr_is_matr( const UNUR_DISTR *distribution ); +/* + TRUE if @var{distribution} is a matrix distribution. +*/ + + +int unur_distr_set_extobj( UNUR_DISTR *distribution, const void *extobj ); +/* + Store a pointer to an external object. This might be usefull if + the PDF, PMF, CDF or other functions used to implement a particular + distribution a parameter set that cannot be stored as doubles + (e.g. pointers to some structure that holds information of the distribution). + + @strong{Important:} + When UNU.RAN copies this distribution object into the generator object, + then the address @var{extobj} that this pointer contains is simply copied. + Thus the generator holds an address of a non-private object! + Once the generator object has been created any change in the external + object might effect the generator object. + + @strong{Warning:} + External objects must be used with care. Once the generator object has been + created or the distribution object has been copied you @emph{must not} + destroy this external object. +*/ + +const void *unur_distr_get_extobj( const UNUR_DISTR *distribution ); +/* + Get the pointer to the external object. + + @emph{Important:} + Changing this object must be done with with extreme care. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ + +UNUR_DISTR *unur_distr_clone( const UNUR_DISTR *distr ); + +/*---------------------------------------------------------------------------*/ + + + diff --git a/vendor/unuran-1.11.0/src/distr/distr_info.c b/vendor/unuran-1.11.0/src/distr/distr_info.c new file mode 100644 index 0000000..00c8664 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/distr_info.c @@ -0,0 +1,176 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: distr_info.c * + * * + * create info strings for distribution objects * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2008 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include "distr.h" +#include "distr_source.h" + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_distr_info_typename( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* type and name of the given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + int n_params = 0; + double *params = NULL; + int i; + + /* name of distribution */ + _unur_string_append(info," name = %s", distr->name); + + /* parameters for UNU.RAN standard distributions */ + if (distr->id & UNUR_DISTR_STD) { + switch (distr->type) { + case UNUR_DISTR_CONT: + n_params = distr->data.cont.n_params; + params = distr->data.cont.params; + break; + case UNUR_DISTR_DISCR: + n_params = distr->data.discr.n_params; + params = distr->data.discr.params; + break; + } + + if (n_params > 0) { + for( i=0; iname,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + } + +} /* end of unur_distr_info_typename() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_distr_info_vector( struct unur_gen *gen, const double *vec, int n ) + /*----------------------------------------------------------------------*/ + /* create character string that contains given character vector */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* vec ... pointer to vector */ + /* n ... length vector */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + int i; + + if (n<1) return; + + _unur_string_append(info,"(%g",vec[0]); + for (i=1;idata.cvec + + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + double *domain; + int i; + + COOKIE_CHECK(distr,CK_DISTR_CVEC,RETURN_VOID); + + _unur_string_append(info," domain = "); + if (!(distr->set & UNUR_DISTR_SET_DOMAINBOUNDED)) { + _unur_string_append(info,"(-inf,inf)^%d [unbounded]\n",distr->dim); + } + else { + if (DISTR.domainrect) { + domain = DISTR.domainrect; + for (i=0; idim; i++) + _unur_string_append(info,"%s(%g,%g)", i?" x ":"", + domain[2*i], domain[2*i+1]); + _unur_string_append(info," [rectangular]\n"); + } + } + +#undef DISTR +} /* end of _unur_distr_cvec_info_domain() */ + +/*---------------------------------------------------------------------------*/ +#endif +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distr/distr_source.h b/vendor/unuran-1.11.0/src/distr/distr_source.h new file mode 100644 index 0000000..6c1f3dc --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/distr_source.h @@ -0,0 +1,238 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: distr_source.h * + * * + * PURPOSE: * + * defines macros and function prototypes for handling * + * distribution objects. * + * * + * USAGE: * + * only included in source_unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef UNUR_DISTR_SOURCE_H_SEEN +#define UNUR_DISTR_SOURCE_H_SEEN +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* indicate changed parameters */ + +/* essential parameters */ +#define UNUR_DISTR_SET_MASK_ESSENTIAL 0xffff0000u + +#define UNUR_DISTR_SET_DOMAIN 0x00010000u +#define UNUR_DISTR_SET_DOMAINBOUNDED 0x00020000u /* domain is bounded */ +#define UNUR_DISTR_SET_STDDOMAIN 0x00040000u /* domain not truncated (for standard distributions) */ +#define UNUR_DISTR_SET_TRUNCATED 0x00080000u /* truncated distribution, i.e. + the domain of the distribution has been + restricted AFTER initializing + the generator object */ + +#define UNUR_DISTR_SET_MEAN 0x01000000u /* mean (vector for multivariate distr.) */ +#define UNUR_DISTR_SET_COVAR 0x02000000u /* covariance matrix (for multivar. distr.) */ +#define UNUR_DISTR_SET_COVAR_INV 0x04000000u /* inverse of covariance matrix (for multivar. distr.) */ +#define UNUR_DISTR_SET_COVAR_IDENT 0x40000000u /* covariance matrix is identity matrix */ +#define UNUR_DISTR_SET_CHOLESKY 0x08000000u /* cholesky factor of covariance matrix (for multivar. distr.) */ +#define UNUR_DISTR_SET_RANKCORR 0x10000000u /* rank-correlation (for multivar. distr.) */ +#define UNUR_DISTR_SET_RK_CHOLESKY 0x20000000u /* cholesky factor of covariance matrix (for multivar. distr.) */ +#define UNUR_DISTR_SET_STDMARGINAL 0x00100000u /* standardized marginal distribution (for multivar. distr.) */ +#define UNUR_DISTR_SET_MARGINAL 0x00200000u /* marginal distribution (for multivar. distr.) */ + +#define UNUR_DISTR_SET_GENERIC 0x00080000u /* generic parameter (can be used for any purpose) */ + + +/* derived parameters */ +#define UNUR_DISTR_SET_MASK_DERIVED 0x0000ffffu + +#define UNUR_DISTR_SET_MODE 0x00000001u +#define UNUR_DISTR_SET_MODE_APPROX 0x00000020u /* flag for approximate computation of mode */ +#define UNUR_DISTR_SET_CENTER 0x00000002u +#define UNUR_DISTR_SET_CENTER_APPROX 0x00000040u /* flag for approximate computation of center */ +#define UNUR_DISTR_SET_PDFAREA 0x00000004u +#define UNUR_DISTR_SET_PMFSUM 0x00000008u +#define UNUR_DISTR_SET_PDFVOLUME 0x00000010u + +/*---------------------------------------------------------------------------*/ +/* call PDFs and CDFs */ +/* (no checking for NULL pointer !) */ + +#define _unur_cont_PDF(x,distr) ((*((distr)->data.cont.pdf)) ((x),(distr))) +#define _unur_cont_dPDF(x,distr) ((*((distr)->data.cont.dpdf))((x),(distr))) +#define _unur_cont_logPDF(x,distr) ((*((distr)->data.cont.logpdf)) ((x),(distr))) +#define _unur_cont_dlogPDF(x,distr) ((*((distr)->data.cont.dlogpdf))((x),(distr))) +#define _unur_cont_CDF(x,distr) ((*((distr)->data.cont.cdf)) ((x),(distr))) +#define _unur_cont_logCDF(x,distr) ((*((distr)->data.cont.logcdf)) ((x),(distr))) +#define _unur_cont_invCDF(u,distr) ((*((distr)->data.cont.invcdf)) ((u),(distr))) +#define _unur_cont_HR(x,distr) ((*((distr)->data.cont.hr)) ((x),(distr))) + +#define _unur_discr_PMF(x,distr) ((*((distr)->data.discr.pmf))((x),(distr))) +#define _unur_discr_CDF(x,distr) ((*((distr)->data.discr.cdf))((x),(distr))) +#define _unur_discr_invCDF(u,distr) ((int) (*((distr)->data.discr.invcdf)) ((u),(distr))) + +/* #define _unur_cvec_PDF(x,distr) ((*((distr)->data.cvec.pdf)) ((x),(distr))) */ +/* #define _unur_cvec_dPDF(r,x,distr) ((*((distr)->data.cvec.dpdf)) ((r),(x),(distr))) */ +/* #define _unur_cvec_pdPDF(x,c,distr) ((*((distr)->data.cvec.pdpdf)) ((x),(c),(distr))) */ +/* #define _unur_cvec_logPDF(x,distr) ((*((distr)->data.cvec.logpdf)) ((x),(distr))) */ +/* #define _unur_cvec_dlogPDF(r,x,distr) ((*((distr)->data.cvec.dlogpdf)) ((r),(x),(distr))) */ +/* #define _unur_cvec_pdlogPDF(x,c,distr) ((*((distr)->data.cvec.pdlogpdf)) ((x),(c),(distr))) */ + +double _unur_cvec_PDF(const double *x, struct unur_distr *distr); +int _unur_cvec_dPDF(double *result, const double *x, struct unur_distr *distr); +double _unur_cvec_pdPDF(const double *x, int coord, struct unur_distr *distr); +double _unur_cvec_logPDF(const double *x, struct unur_distr *distr); +int _unur_cvec_dlogPDF(double *result, const double *x, struct unur_distr *distr); +double _unur_cvec_pdlogPDF(const double *x, int coord, struct unur_distr *distr); + +/*---------------------------------------------------------------------------*/ +/* check for existance of function pointers */ + +#define _unur_cont_have_logPDF(distr) (((distr)->data.cont.logpdf==NULL)?FALSE:TRUE) +#define _unur_cont_have_dlogPDF(distr) (((distr)->data.cont.dlogpdf==NULL)?FALSE:TRUE) + +/*---------------------------------------------------------------------------*/ +/* wrapper functions for PDF when only logPDF is given */ + +double _unur_distr_cont_eval_pdf_from_logpdf( double x, const struct unur_distr *distr ); +double _unur_distr_cont_eval_dpdf_from_dlogpdf( double x, const struct unur_distr *distr ); +double _unur_distr_cont_eval_cdf_from_logcdf( double x, const struct unur_distr *distr ); + +double _unur_distr_cvec_eval_pdf_from_logpdf( const double *x, struct unur_distr *distr ); +int _unur_distr_cvec_eval_dpdf_from_dlogpdf( double *result, const double *x, struct unur_distr *distr ); +double _unur_distr_cvec_eval_pdpdf_from_pdlogpdf( const double *x, int coord, struct unur_distr *distr ); + +/*---------------------------------------------------------------------------*/ +/* generic creator for distribution objects */ + +struct unur_distr *_unur_distr_generic_new( void ); + +/*---------------------------------------------------------------------------*/ +/* make clone of distribution objects */ + +struct unur_distr *_unur_distr_cemp_clone ( const struct unur_distr *distr ); +struct unur_distr *_unur_distr_cont_clone ( const struct unur_distr *distr ); +struct unur_distr *_unur_distr_matr_clone ( const struct unur_distr *distr ); +struct unur_distr *_unur_distr_cvec_clone ( const struct unur_distr *distr ); +struct unur_distr *_unur_distr_cvemp_clone( const struct unur_distr *distr ); +struct unur_distr *_unur_distr_discr_clone( const struct unur_distr *distr ); + +#define _unur_distr_clone(distr) ((distr)->clone(distr)) + +/*---------------------------------------------------------------------------*/ +/* destroy distribution object */ +#define _unur_distr_free(distr) do {if (distr) (distr)->destroy(distr);} while(0) + +/*---------------------------------------------------------------------------*/ +/* debuging routines for distributions */ +#ifdef UNUR_ENABLE_LOGGING + +void _unur_distr_cont_debug( const UNUR_DISTR *distribution, const char *genid ); +/* write info about distribution into logfile */ + +void _unur_distr_corder_debug( const UNUR_DISTR *order_statistics, const char *genid ); +/* write info about distribution into logfile */ + +void _unur_distr_cxtrans_debug( const UNUR_DISTR *cxtrans, const char *genid ); +/* write info about distribution into logfile */ + +void _unur_distr_cemp_debug( const UNUR_DISTR *distribution, const char *genid, unsigned printvector ); +/* write info about distribution into logfile */ + +void _unur_distr_matr_debug( const UNUR_DISTR *distribution, const char *genid ); +/* write info about matrix distribution into logfile */ + +void _unur_distr_cvec_debug( const UNUR_DISTR *distribution, const char *genid ); +/* write info about distribution into logfile */ + +void _unur_distr_condi_debug( const UNUR_DISTR *distribution, const char *genid ); +/* write info about distribution into logfile */ + +void _unur_distr_cvemp_debug( const UNUR_DISTR *distribution, const char *genid, unsigned printvector ); +/* write info about distribution into logfile */ + +void _unur_distr_discr_debug( const UNUR_DISTR *distribution, const char *genid, unsigned printvector ); +/* write info about distribution into logfile */ + +#endif +/*---------------------------------------------------------------------------*/ +/* routines for creating info strings */ +#ifdef UNUR_ENABLE_INFO + +void _unur_distr_info_typename( struct unur_gen *gen ); +/* write string that contains type and name of given distribution object */ + +void _unur_distr_info_vector( struct unur_gen *gen, const double *vec, int n ); +/* write string that contains given vector */ + +void _unur_distr_cvec_info_domain( struct unur_gen *gen ); +/* create character string that contains domain */ + +#endif +/*---------------------------------------------------------------------------*/ +/* auxiliary routines */ + +int _unur_distr_cont_find_center( struct unur_distr *distr ); +/* search for an appropriate point for center. */ +/* if such a point is found, then it is stored in 'distr'. */ + + +/* test whether all marginals are equal or not (returns TRUE or FALSE) */ +/* for dimesion 1, TRUE is returned. */ +/* WARNING: There is no checking of arguments in this function! */ +int _unur_distr_cvec_marginals_are_equal( struct unur_distr **marginals, int dim ); + +/* Duplicate first marginal distribution in array of marginal */ +/* distributions into all other slots of this array */ +/* This is only executed when all entries in this array point to the */ +/* same distribution object, i.e. when all marginal distributions */ +/* are equal. */ +int _unur_distr_cvec_duplicate_firstmarginal( struct unur_distr *distribution ); + +/* test whether 'x' is the in domain of 'distribution' */ +int _unur_distr_cvec_is_indomain( const double *x, const struct unur_distr *distribution); + +/* check whether @var{distribution} has a bounded domain */ +int _unur_distr_cvec_has_boundeddomain( const struct unur_distr *distribution ); + +/* Same as unur_distr_cont_upd_pdfarea() */ +/* but may also silently check the existance of the update function. */ +int _unur_distr_cont_upd_pdfarea( struct unur_distr *distr, int silent_check_updfunc ); + +/*---------------------------------------------------------------------------*/ +/* check if parameter object is of correct type, return 0 otherwise */ + +#define _unur_check_distr_object( distr,distrtype, rcode ) \ + do { \ + if ((distr)->type != UNUR_DISTR_##distrtype) { \ + _unur_warning((distr)->name,UNUR_ERR_DISTR_INVALID,""); \ + return rcode; } \ + COOKIE_CHECK(distr,CK_DISTR_##distrtype,rcode); } while (0) + +/*---------------------------------------------------------------------------*/ +#endif /* UNUR_DISTR_SOURCE_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distr/distr_struct.h b/vendor/unuran-1.11.0/src/distr/distr_struct.h new file mode 100644 index 0000000..c41637e --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/distr_struct.h @@ -0,0 +1,248 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: distr_struct.h * + * * + * PURPOSE: * + * declares structures for distributions * + * * + * USAGE: * + * only included in unur_struct.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* define object for univariate continuous distribution */ + +struct unur_distr_cont { + + UNUR_FUNCT_CONT *pdf; /* pointer to PDF */ + UNUR_FUNCT_CONT *dpdf; /* pointer to derivative of PDF */ + UNUR_FUNCT_CONT *cdf; /* pointer to CDF */ + UNUR_FUNCT_CONT *invcdf; /* pointer to inverse of CDF */ + UNUR_FUNCT_CONT *logpdf; /* pointer to logPDF */ + UNUR_FUNCT_CONT *dlogpdf; /* pointer to derivative of logPDF */ + UNUR_FUNCT_CONT *logcdf; /* pointer to logCDF */ + UNUR_FUNCT_CONT *hr; /* pointer to hazard rate */ + + double norm_constant; /* (log of) normalization constant for PDF */ + + double params[UNUR_DISTR_MAXPARAMS]; /* parameters of the PDF */ + int n_params; /* number of parameters of the PDF */ + + double *param_vecs[UNUR_DISTR_MAXPARAMS]; /* parameter vectors */ + int n_param_vec[UNUR_DISTR_MAXPARAMS]; /* lengths of the parameter vecs */ + + double mode; /* location of mode */ + double center; /* location of center */ + double area; /* area below PDF */ + double domain[2]; /* boundary of domain */ + double trunc[2]; /* boundary of truncated domain */ + + struct ftreenode *pdftree; /* pointer to function tree for PDF */ + struct ftreenode *dpdftree; /* pointer to function tree for dPDF */ + struct ftreenode *logpdftree; /* pointer to function tree for logPDF */ + struct ftreenode *dlogpdftree;/* pointer to function tree for dlogPDF */ + struct ftreenode *cdftree; /* pointer to function tree for CDF */ + struct ftreenode *logcdftree; /* pointer to function tree for logCDF */ + struct ftreenode *hrtree; /* pointer to function tree for hazard rate */ + + int (*set_params)(struct unur_distr *distr, const double *params, int n_params ); + /* function for setting parameters and domain*/ + int (*upd_mode)(struct unur_distr *distr); + /* function for computing mode */ + int (*upd_area)(struct unur_distr *distr); + /* function for computing area */ + + int (*init)(struct unur_par *par,struct unur_gen *gen); + /* pointer to special init routine */ +}; + +/*---------------------------------------------------------------------------*/ +/* define object for multivariate continuous distribution */ + +struct unur_distr_cvec { + + UNUR_FUNCT_CVEC *pdf; /* pointer to PDF */ + UNUR_VFUNCT_CVEC *dpdf; /* pointer to gradient of PDF */ + UNUR_FUNCTD_CVEC *pdpdf; /* pointer to partial derivative of PDF */ + UNUR_FUNCT_CVEC *logpdf; /* pointer to logPDF */ + UNUR_VFUNCT_CVEC *dlogpdf; /* pointer to gradient of logPDF */ + UNUR_FUNCTD_CVEC *pdlogpdf; /* pointer to partial derivative of logPDF */ + + double *mean; /* mean vector of distribution */ + double *covar; /* covariance matrix of distribution */ + + double *cholesky; /* cholesky factor of covariance matrix */ + double *covar_inv; /* inverse of covariance matrix */ + + double *rankcorr; /* rank correlation matrix */ + double *rk_cholesky; /* cholesky factor of rank corr. matrix */ + + struct unur_distr **marginals; /* array of pointers to marginal distributions */ + + double params[UNUR_DISTR_MAXPARAMS]; /* parameters of the PDF */ + int n_params; /* number of parameters of the PDF */ + + double *param_vecs[UNUR_DISTR_MAXPARAMS]; /* parameter vectors */ + int n_param_vec[UNUR_DISTR_MAXPARAMS]; /* lengths of the parameter vecs */ + + double norm_constant; /* (log of) normalization constant for PDF */ + + double *mode; /* location of mode */ + double *center; /* location of center */ + double volume; /* volume below PDF */ + double *domainrect; /* (rectangular) domain of domain: + the lower left and the upper right vertices + are stored componentwise, i.e. + l[0], r[0], l[1], r[1], l[2], r[2], ... */ + +#ifdef USE_DEPRECATED_CODE + struct unur_distr **stdmarginals; /* array of pointers to standardized marginal distributions */ +#endif + + int (*upd_mode)(struct unur_distr *distr); + /* function for computing mode */ + int (*upd_volume)(struct unur_distr *distr); + /* function for computing volume */ + + int (*init)(struct unur_gen *gen); + /* pointer to special init routine */ +}; + +/*---------------------------------------------------------------------------*/ +/* define object for univariate discrete distribution */ + +struct unur_distr_discr { + /* (finite) probability vector */ + double *pv; /* pointer to probability vector */ + int n_pv; /* length of probability vector */ + + /* probability mass function */ + UNUR_FUNCT_DISCR *pmf; /* pointer to probability mass function */ + UNUR_FUNCT_DISCR *cdf; /* pointer to CDF */ + UNUR_IFUNCT_DISCR *invcdf; /* pointer to inverse of CDF */ + + double params[UNUR_DISTR_MAXPARAMS]; /* parameters of the PMF */ + int n_params; /* number of parameters of the PMF */ + + double norm_constant; /* (log of) normalization constant for PMF */ + + int mode; /* location of mode */ + double sum; /* sum over PMF */ + + int (*set_params)(struct unur_distr *distr, const double *params, int n_params ); + /* function for setting parameters and domain*/ + int (*upd_mode)(struct unur_distr *distr); + /* function for computing mode */ + int (*upd_sum)(struct unur_distr *distr); + /* function for computing sum */ + + /* other parameters */ + int domain[2]; /* boundary of domain */ + int trunc[2]; /* boundary of truncated domain */ + /** trunc[] not supported yet **/ + + struct ftreenode *pmftree; /* pointer to function tree for PMF */ + struct ftreenode *cdftree; /* pointer to function tree for CDF */ + + int (*init)(struct unur_par *par,struct unur_gen *gen); + /* pointer to special init routine */ +}; + +/*---------------------------------------------------------------------------*/ +/* define object for empirical univariate constinuous distribution */ +/* (given by empirical sample) */ + +struct unur_distr_cemp { + /* raw data */ + int n_sample; /* length of sample probability vector */ + double *sample; /* pointer to sample */ + /* histogram */ + int n_hist; /* number of bins in histogram */ + double *hist_prob; /* probabilities for bins */ + double hmin, hmax; /* lower and upper bound for histograms with + bins of equal length */ + double *hist_bins; /* boundary between bins (of different length) */ +}; + +/*---------------------------------------------------------------------------*/ +/* define object for empirical mulitvariate constinuous distribution */ +/* (given by empirical sample) */ + +struct unur_distr_cvemp { + double *sample; /* pointer to sample */ + int n_sample; /* length of sample probability vector */ +}; + +/*---------------------------------------------------------------------------*/ +/* define object for matrix distribution */ + +struct unur_distr_matr { + + int n_rows; /* number of rows */ + int n_cols; /* number of columns */ + + int (*init)(struct unur_par *par,struct unur_gen *gen); + /* pointer to special init routine */ +}; + +/*---------------------------------------------------------------------------*/ +/* define distribution object */ + +struct unur_distr { + union { + struct unur_distr_cont cont; /* univariate continuous distribution */ + struct unur_distr_matr matr; /* matrix distribution */ + struct unur_distr_cvec cvec; /* multivariate continuous distribution */ + struct unur_distr_discr discr; /* univariate discrete distribution */ + struct unur_distr_cemp cemp; /* empirical univ. cont. distr. (sample) */ + struct unur_distr_cvemp cvemp; /* empir. multiv. cont. distr. (sample) */ + } data; /* data for distribution */ + + unsigned type; /* type of distribution */ + unsigned id; /* identifier for distribution */ + const char *name; /* name of distribution */ + char *name_str; /* string for storing user name of distr */ + int dim; /* number of components of random vector */ + + unsigned set; /* indicate changed parameters */ + + const void *extobj; /* pointer to an object for additional data */ + + struct unur_distr *base; /* pointer to distribution object for + derived distribution + (e.g. order statistics) */ + + void (*destroy)(struct unur_distr *distr); /* pointer to destructor */ + struct unur_distr* (*clone)(const struct unur_distr *distr ); /* clone */ + +#ifdef UNUR_COOKIES + unsigned cookie; /* magic cookie */ +#endif +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distr/matr.c b/vendor/unuran-1.11.0/src/distr/matr.c new file mode 100644 index 0000000..96afef3 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/matr.c @@ -0,0 +1,264 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: matr.c * + * * + * manipulate matrix distribution objects * + * * + * return: * + * UNUR_SUCCESS ... on success * + * error code ... on error * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "distr_source.h" +#include "distr.h" +#include "matr.h" + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.matr + +/*---------------------------------------------------------------------------*/ + +static void _unur_distr_matr_free( struct unur_distr *distr ); + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** matrix distributions **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_matr_new( int n_rows, int n_cols ) + /*----------------------------------------------------------------------*/ + /* create a new (empty) distribution object */ + /* type: matrix distribution */ + /* */ + /* parameters: */ + /* n_rows ... number of rows of matrix */ + /* n_cols ... number of columns of matrix */ + /* */ + /* return: */ + /* pointer to distribution object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + register struct unur_distr *distr; + + /* check dimension for new parameter for distribution */ + if (n_rows < 1 || n_cols < 1) { + _unur_error(NULL,UNUR_ERR_DISTR_SET,"n_rows or n_cols < 1"); + return NULL; + } + + /* get empty distribution object */ + distr = _unur_distr_generic_new(); + if (!distr) return NULL; + + /* set magic cookie */ + COOKIE_SET(distr,CK_DISTR_MATR); + + /* set type of distribution */ + distr->type = UNUR_DISTR_MATR; + + /* set id to generic distribution */ + distr->id = UNUR_DISTR_GENERIC; + + /* dimension of random vector */ + DISTR.n_rows = n_rows; + DISTR.n_cols = n_cols; + distr->dim = n_rows * n_cols; + + /* destructor */ + distr->destroy = _unur_distr_matr_free; + + /* clone */ + distr->clone = _unur_distr_matr_clone; + + /* set defaults */ + DISTR.init = NULL; /* pointer to special init routine (default: none) */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_matr_new() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +_unur_distr_matr_clone( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* copy (clone) distribution object */ + /* */ + /* parameters: */ + /* distr ... pointer to source distribution object */ + /* */ + /* return: */ + /* pointer to clone of distribution object */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE clone->data.matr + + struct unur_distr *clone; + + /* check arguments */ + _unur_check_NULL( NULL, distr, NULL ); + _unur_check_distr_object( distr, MATR, NULL ); + + /* allocate memory */ + clone = _unur_xmalloc( sizeof(struct unur_distr) ); + + /* copy distribution object into clone */ + memcpy( clone, distr, sizeof( struct unur_distr ) ); + + /* copy data about distribution */ + + /* copy user name for distribution */ + if (distr->name_str) { + size_t len = strlen(distr->name_str) + 1; + clone->name_str = _unur_xmalloc(len); + memcpy( clone->name_str, distr->name_str, len ); + clone->name = clone->name_str; + } + + return clone; + +#undef CLONE +} /* end of _unur_distr_matr_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_distr_matr_free( struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* free distribution object */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( distr == NULL ) /* nothing to do */ + return; + + COOKIE_CHECK(distr,CK_DISTR_MATR,RETURN_VOID); + + /* user name for distribution */ + if (distr->name_str) free(distr->name_str); + + COOKIE_CLEAR(distr); + free( distr ); + +} /* end of unur_distr_matr_free() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_distr_matr_get_dim( const struct unur_distr *distr, int *n_rows, int *n_cols ) + /*----------------------------------------------------------------------*/ + /* get number of rows and columns of matrix */ + /* return total number of entries */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* n_rows ... to store number of rows */ + /* n_cols ... to store number of rows */ + /* */ + /* return: */ + /* total number of entries */ + /* */ + /* error: */ + /* return 0 */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, distr, 0 ); + _unur_check_distr_object( distr, MATR, 0 ); + CHECK_NULL( n_rows, 0 ); + CHECK_NULL( n_cols, 0 ); + + *n_rows = DISTR.n_rows; + *n_cols = DISTR.n_cols; + + return distr->dim; + +} /* end of unur_distr_matr_get_dim() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_distr_matr_debug( const struct unur_distr *distr, const char *genid ) + /*----------------------------------------------------------------------*/ + /* write info about distribution into LOG file */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* genid ... pointer to generator id */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(distr,RETURN_VOID); + COOKIE_CHECK(distr,CK_DISTR_MATR,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: distribution:\n",genid); + fprintf(LOG,"%s:\ttype = matrix distribution\n",genid); + fprintf(LOG,"%s:\tname = %s\n",genid,distr->name); + + fprintf(LOG,"%s:\tdimension = %d x %d (= %d)\n",genid,DISTR.n_rows,DISTR.n_cols,distr->dim); + + fprintf(LOG,"%s:\n",genid); + +} /* end of _unur_distr_matr_debug() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +#undef DISTR +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/distr/matr.h b/vendor/unuran-1.11.0/src/distr/matr.h new file mode 100644 index 0000000..ca9342c --- /dev/null +++ b/vendor/unuran-1.11.0/src/distr/matr.h @@ -0,0 +1,100 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: matr.h * + * * + * PURPOSE: * + * function prototypes for manipulating distribution objects of * + * type MATR (matrix distribution) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/* + =NODEX MATR MATRix distributions + + =UP Distribution_objects [45] + + =DESCRIPTION + Distributions for random matrices. Notice that UNU.RAN uses + arrays of @code{double}s to handle matrices. The rows of + the matrix are stored consecutively. + + =END +*/ + +/*---------------------------------------------------------------------------*/ + +/* + Routines for handling matrix distributions (MATR). +*/ + +/* =ROUTINES */ + +UNUR_DISTR *unur_distr_matr_new( int n_rows, int n_cols ); +/* + Create a new (empty) object for a matrix distribution. @var{n_rows} + and @var{n_cols} are the respective numbers of rows and columns of + the random matrix (i.e. its dimensions). It is also possible to + have only one number or rows and/or columns. + Notice, however, that this is treated as a distribution of random + matrices with only one row or column or component and not as a + distribution of vectors or real numbers. For the latter + unur_distr_cont_new() or unur_distr_cvec_new() should be + used to create an object for a univariate distribution and a + multivariate (vector) distribution, respectively. +*/ + +/* ==DOC + @subsubheading Essential parameters +*/ + +int unur_distr_matr_get_dim( const UNUR_DISTR *distribution, int *n_rows, int *n_cols ); +/* + Get number of rows and columns of random matrix (its dimension). + It returns the total number of components. If successfull + @code{UNUR_SUCCESS} is returned. +*/ + +/* =END */ + + +/*---------------------------------------------------------------------------*/ + +/* not implemented: */ +/* DOC + @subsubheading Derived parameters + + The following paramters @strong{must} be set whenever one of the + essential parameters has been set or changed (and the parameter is + required for the chosen method). +*/ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/.libs/libdistributions.a b/vendor/unuran-1.11.0/src/distributions/.libs/libdistributions.a new file mode 100644 index 0000000..c2ac7c3 Binary files /dev/null and b/vendor/unuran-1.11.0/src/distributions/.libs/libdistributions.a differ diff --git a/vendor/unuran-1.11.0/src/distributions/Makefile b/vendor/unuran-1.11.0/src/distributions/Makefile new file mode 100644 index 0000000..97438fc --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/Makefile @@ -0,0 +1,894 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# src/distributions/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/unuran +pkgincludedir = $(includedir)/unuran +pkglibdir = $(libdir)/unuran +pkglibexecdir = $(libexecdir)/unuran +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +subdir = src/distributions +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libdistributions_la_LIBADD = +am_libdistributions_la_OBJECTS = c_beta.lo c_beta_gen.lo c_burr.lo \ + c_cauchy.lo c_chi.lo c_chi_gen.lo c_chisquare.lo \ + c_exponential.lo c_exponential_gen.lo c_extremeI.lo \ + c_extremeII.lo c_F.lo c_gamma.lo c_gamma_gen.lo c_ghyp.lo \ + c_gig.lo c_gig_gen.lo c_gig2.lo c_hyperbolic.lo c_ig.lo \ + c_laplace.lo c_logistic.lo c_lognormal.lo c_lomax.lo \ + c_meixner.lo c_normal.lo c_normal_gen.lo c_pareto.lo \ + c_powerexponential.lo c_powerexponential_gen.lo c_rayleigh.lo \ + c_slash.lo c_slash_gen.lo c_student.lo c_student_gen.lo \ + c_triangular.lo c_uniform.lo c_vg.lo c_weibull.lo \ + d_binomial.lo d_binomial_gen.lo d_geometric.lo \ + d_hypergeometric.lo d_hypergeometric_gen.lo d_logarithmic.lo \ + d_logarithmic_gen.lo d_negativebinomial.lo d_poisson.lo \ + d_poisson_gen.lo d_zipf.lo d_zipf_gen.lo m_correlation.lo \ + vc_copula.lo vc_multicauchy.lo vc_multiexponential.lo \ + vc_multinormal.lo vc_multinormal_gen.lo vc_multistudent.lo +libdistributions_la_OBJECTS = $(am_libdistributions_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I. -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/c_F.Plo ./$(DEPDIR)/c_beta.Plo \ + ./$(DEPDIR)/c_beta_gen.Plo ./$(DEPDIR)/c_burr.Plo \ + ./$(DEPDIR)/c_cauchy.Plo ./$(DEPDIR)/c_chi.Plo \ + ./$(DEPDIR)/c_chi_gen.Plo ./$(DEPDIR)/c_chisquare.Plo \ + ./$(DEPDIR)/c_exponential.Plo \ + ./$(DEPDIR)/c_exponential_gen.Plo ./$(DEPDIR)/c_extremeI.Plo \ + ./$(DEPDIR)/c_extremeII.Plo ./$(DEPDIR)/c_gamma.Plo \ + ./$(DEPDIR)/c_gamma_gen.Plo ./$(DEPDIR)/c_ghyp.Plo \ + ./$(DEPDIR)/c_gig.Plo ./$(DEPDIR)/c_gig2.Plo \ + ./$(DEPDIR)/c_gig_gen.Plo ./$(DEPDIR)/c_hyperbolic.Plo \ + ./$(DEPDIR)/c_ig.Plo ./$(DEPDIR)/c_laplace.Plo \ + ./$(DEPDIR)/c_logistic.Plo ./$(DEPDIR)/c_lognormal.Plo \ + ./$(DEPDIR)/c_lomax.Plo ./$(DEPDIR)/c_meixner.Plo \ + ./$(DEPDIR)/c_normal.Plo ./$(DEPDIR)/c_normal_gen.Plo \ + ./$(DEPDIR)/c_pareto.Plo ./$(DEPDIR)/c_powerexponential.Plo \ + ./$(DEPDIR)/c_powerexponential_gen.Plo \ + ./$(DEPDIR)/c_rayleigh.Plo ./$(DEPDIR)/c_slash.Plo \ + ./$(DEPDIR)/c_slash_gen.Plo ./$(DEPDIR)/c_student.Plo \ + ./$(DEPDIR)/c_student_gen.Plo ./$(DEPDIR)/c_triangular.Plo \ + ./$(DEPDIR)/c_uniform.Plo ./$(DEPDIR)/c_vg.Plo \ + ./$(DEPDIR)/c_weibull.Plo ./$(DEPDIR)/d_binomial.Plo \ + ./$(DEPDIR)/d_binomial_gen.Plo ./$(DEPDIR)/d_geometric.Plo \ + ./$(DEPDIR)/d_hypergeometric.Plo \ + ./$(DEPDIR)/d_hypergeometric_gen.Plo \ + ./$(DEPDIR)/d_logarithmic.Plo \ + ./$(DEPDIR)/d_logarithmic_gen.Plo \ + ./$(DEPDIR)/d_negativebinomial.Plo ./$(DEPDIR)/d_poisson.Plo \ + ./$(DEPDIR)/d_poisson_gen.Plo ./$(DEPDIR)/d_zipf.Plo \ + ./$(DEPDIR)/d_zipf_gen.Plo ./$(DEPDIR)/m_correlation.Plo \ + ./$(DEPDIR)/vc_copula.Plo ./$(DEPDIR)/vc_multicauchy.Plo \ + ./$(DEPDIR)/vc_multiexponential.Plo \ + ./$(DEPDIR)/vc_multinormal.Plo \ + ./$(DEPDIR)/vc_multinormal_gen.Plo \ + ./$(DEPDIR)/vc_multistudent.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libdistributions_la_SOURCES) +DIST_SOURCES = $(libdistributions_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp \ + README +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_CFLAGS = -Wall -Wextra -Wshadow -Wstrict-prototypes +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf +AUTOHEADER = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader +AUTOMAKE = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -fPIC +CPP = gcc -E +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +FILECMD = file +GREP = /usr/bin/grep +HAVE_DIVIDE_BY_ZERO = +HAVE_IEEE_COMPARISONS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAINT = # +MAKEINFO = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = unuran +PACKAGE_BUGREPORT = unuran@statmath.wu.ac.at +PACKAGE_NAME = unuran +PACKAGE_STRING = unuran 1.11.0 +PACKAGE_TARNAME = unuran +PACKAGE_URL = +PACKAGE_VERSION = 1.11.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +UNURAN_LT_VERSION = 16:1:0 +UNURAN_SUPPORTS_GSL = +UNURAN_SUPPORTS_PRNG = +UNURAN_SUPPORTS_RNGSTREAM = +VERSION = 1.11.0 +abs_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src/distributions +abs_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src/distributions +abs_top_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +have_valgrind = false +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../../ +top_builddir = ../.. +top_srcdir = ../.. +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libdistributions.la +libdistributions_la_SOURCES = \ + c_beta.c c_beta_gen.c \ + c_burr.c \ + c_cauchy.c \ + c_chi.c c_chi_gen.c \ + c_chisquare.c \ + c_exponential.c c_exponential_gen.c \ + c_extremeI.c \ + c_extremeII.c \ + c_F.c \ + c_gamma.c c_gamma_gen.c \ + c_ghyp.c \ + c_gig.c c_gig_gen.c \ + c_gig2.c \ + c_hyperbolic.c \ + c_ig.c \ + c_laplace.c \ + c_logistic.c \ + c_lognormal.c \ + c_lomax.c \ + c_meixner.c \ + c_normal.c c_normal_gen.c \ + c_pareto.c \ + c_powerexponential.c c_powerexponential_gen.c \ + c_rayleigh.c \ + c_slash.c c_slash_gen.c \ + c_student.c c_student_gen.c \ + c_triangular.c \ + c_uniform.c \ + c_vg.c \ + c_weibull.c \ + d_binomial.c d_binomial_gen.c \ + d_geometric.c \ + d_hypergeometric.c d_hypergeometric_gen.c \ + d_logarithmic.c d_logarithmic_gen.c \ + d_negativebinomial.c \ + d_poisson.c d_poisson_gen.c \ + d_zipf.c d_zipf_gen.c \ + m_correlation.c \ + vc_copula.c \ + vc_multicauchy.c \ + vc_multiexponential.c \ + vc_multinormal.c vc_multinormal_gen.c \ + vc_multistudent.c + +noinst_HEADERS = \ + unur_distributions.h \ + unur_distributions_source.h \ + unur_stddistr.h + +EXTRA_DIST = \ + README + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/distributions/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/distributions/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libdistributions.la: $(libdistributions_la_OBJECTS) $(libdistributions_la_DEPENDENCIES) $(EXTRA_libdistributions_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libdistributions_la_OBJECTS) $(libdistributions_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/c_F.Plo # am--include-marker +include ./$(DEPDIR)/c_beta.Plo # am--include-marker +include ./$(DEPDIR)/c_beta_gen.Plo # am--include-marker +include ./$(DEPDIR)/c_burr.Plo # am--include-marker +include ./$(DEPDIR)/c_cauchy.Plo # am--include-marker +include ./$(DEPDIR)/c_chi.Plo # am--include-marker +include ./$(DEPDIR)/c_chi_gen.Plo # am--include-marker +include ./$(DEPDIR)/c_chisquare.Plo # am--include-marker +include ./$(DEPDIR)/c_exponential.Plo # am--include-marker +include ./$(DEPDIR)/c_exponential_gen.Plo # am--include-marker +include ./$(DEPDIR)/c_extremeI.Plo # am--include-marker +include ./$(DEPDIR)/c_extremeII.Plo # am--include-marker +include ./$(DEPDIR)/c_gamma.Plo # am--include-marker +include ./$(DEPDIR)/c_gamma_gen.Plo # am--include-marker +include ./$(DEPDIR)/c_ghyp.Plo # am--include-marker +include ./$(DEPDIR)/c_gig.Plo # am--include-marker +include ./$(DEPDIR)/c_gig2.Plo # am--include-marker +include ./$(DEPDIR)/c_gig_gen.Plo # am--include-marker +include ./$(DEPDIR)/c_hyperbolic.Plo # am--include-marker +include ./$(DEPDIR)/c_ig.Plo # am--include-marker +include ./$(DEPDIR)/c_laplace.Plo # am--include-marker +include ./$(DEPDIR)/c_logistic.Plo # am--include-marker +include ./$(DEPDIR)/c_lognormal.Plo # am--include-marker +include ./$(DEPDIR)/c_lomax.Plo # am--include-marker +include ./$(DEPDIR)/c_meixner.Plo # am--include-marker +include ./$(DEPDIR)/c_normal.Plo # am--include-marker +include ./$(DEPDIR)/c_normal_gen.Plo # am--include-marker +include ./$(DEPDIR)/c_pareto.Plo # am--include-marker +include ./$(DEPDIR)/c_powerexponential.Plo # am--include-marker +include ./$(DEPDIR)/c_powerexponential_gen.Plo # am--include-marker +include ./$(DEPDIR)/c_rayleigh.Plo # am--include-marker +include ./$(DEPDIR)/c_slash.Plo # am--include-marker +include ./$(DEPDIR)/c_slash_gen.Plo # am--include-marker +include ./$(DEPDIR)/c_student.Plo # am--include-marker +include ./$(DEPDIR)/c_student_gen.Plo # am--include-marker +include ./$(DEPDIR)/c_triangular.Plo # am--include-marker +include ./$(DEPDIR)/c_uniform.Plo # am--include-marker +include ./$(DEPDIR)/c_vg.Plo # am--include-marker +include ./$(DEPDIR)/c_weibull.Plo # am--include-marker +include ./$(DEPDIR)/d_binomial.Plo # am--include-marker +include ./$(DEPDIR)/d_binomial_gen.Plo # am--include-marker +include ./$(DEPDIR)/d_geometric.Plo # am--include-marker +include ./$(DEPDIR)/d_hypergeometric.Plo # am--include-marker +include ./$(DEPDIR)/d_hypergeometric_gen.Plo # am--include-marker +include ./$(DEPDIR)/d_logarithmic.Plo # am--include-marker +include ./$(DEPDIR)/d_logarithmic_gen.Plo # am--include-marker +include ./$(DEPDIR)/d_negativebinomial.Plo # am--include-marker +include ./$(DEPDIR)/d_poisson.Plo # am--include-marker +include ./$(DEPDIR)/d_poisson_gen.Plo # am--include-marker +include ./$(DEPDIR)/d_zipf.Plo # am--include-marker +include ./$(DEPDIR)/d_zipf_gen.Plo # am--include-marker +include ./$(DEPDIR)/m_correlation.Plo # am--include-marker +include ./$(DEPDIR)/vc_copula.Plo # am--include-marker +include ./$(DEPDIR)/vc_multicauchy.Plo # am--include-marker +include ./$(DEPDIR)/vc_multiexponential.Plo # am--include-marker +include ./$(DEPDIR)/vc_multinormal.Plo # am--include-marker +include ./$(DEPDIR)/vc_multinormal_gen.Plo # am--include-marker +include ./$(DEPDIR)/vc_multistudent.Plo # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ $< + +.c.obj: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: + $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +# $(AM_V_CC)source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/c_F.Plo + -rm -f ./$(DEPDIR)/c_beta.Plo + -rm -f ./$(DEPDIR)/c_beta_gen.Plo + -rm -f ./$(DEPDIR)/c_burr.Plo + -rm -f ./$(DEPDIR)/c_cauchy.Plo + -rm -f ./$(DEPDIR)/c_chi.Plo + -rm -f ./$(DEPDIR)/c_chi_gen.Plo + -rm -f ./$(DEPDIR)/c_chisquare.Plo + -rm -f ./$(DEPDIR)/c_exponential.Plo + -rm -f ./$(DEPDIR)/c_exponential_gen.Plo + -rm -f ./$(DEPDIR)/c_extremeI.Plo + -rm -f ./$(DEPDIR)/c_extremeII.Plo + -rm -f ./$(DEPDIR)/c_gamma.Plo + -rm -f ./$(DEPDIR)/c_gamma_gen.Plo + -rm -f ./$(DEPDIR)/c_ghyp.Plo + -rm -f ./$(DEPDIR)/c_gig.Plo + -rm -f ./$(DEPDIR)/c_gig2.Plo + -rm -f ./$(DEPDIR)/c_gig_gen.Plo + -rm -f ./$(DEPDIR)/c_hyperbolic.Plo + -rm -f ./$(DEPDIR)/c_ig.Plo + -rm -f ./$(DEPDIR)/c_laplace.Plo + -rm -f ./$(DEPDIR)/c_logistic.Plo + -rm -f ./$(DEPDIR)/c_lognormal.Plo + -rm -f ./$(DEPDIR)/c_lomax.Plo + -rm -f ./$(DEPDIR)/c_meixner.Plo + -rm -f ./$(DEPDIR)/c_normal.Plo + -rm -f ./$(DEPDIR)/c_normal_gen.Plo + -rm -f ./$(DEPDIR)/c_pareto.Plo + -rm -f ./$(DEPDIR)/c_powerexponential.Plo + -rm -f ./$(DEPDIR)/c_powerexponential_gen.Plo + -rm -f ./$(DEPDIR)/c_rayleigh.Plo + -rm -f ./$(DEPDIR)/c_slash.Plo + -rm -f ./$(DEPDIR)/c_slash_gen.Plo + -rm -f ./$(DEPDIR)/c_student.Plo + -rm -f ./$(DEPDIR)/c_student_gen.Plo + -rm -f ./$(DEPDIR)/c_triangular.Plo + -rm -f ./$(DEPDIR)/c_uniform.Plo + -rm -f ./$(DEPDIR)/c_vg.Plo + -rm -f ./$(DEPDIR)/c_weibull.Plo + -rm -f ./$(DEPDIR)/d_binomial.Plo + -rm -f ./$(DEPDIR)/d_binomial_gen.Plo + -rm -f ./$(DEPDIR)/d_geometric.Plo + -rm -f ./$(DEPDIR)/d_hypergeometric.Plo + -rm -f ./$(DEPDIR)/d_hypergeometric_gen.Plo + -rm -f ./$(DEPDIR)/d_logarithmic.Plo + -rm -f ./$(DEPDIR)/d_logarithmic_gen.Plo + -rm -f ./$(DEPDIR)/d_negativebinomial.Plo + -rm -f ./$(DEPDIR)/d_poisson.Plo + -rm -f ./$(DEPDIR)/d_poisson_gen.Plo + -rm -f ./$(DEPDIR)/d_zipf.Plo + -rm -f ./$(DEPDIR)/d_zipf_gen.Plo + -rm -f ./$(DEPDIR)/m_correlation.Plo + -rm -f ./$(DEPDIR)/vc_copula.Plo + -rm -f ./$(DEPDIR)/vc_multicauchy.Plo + -rm -f ./$(DEPDIR)/vc_multiexponential.Plo + -rm -f ./$(DEPDIR)/vc_multinormal.Plo + -rm -f ./$(DEPDIR)/vc_multinormal_gen.Plo + -rm -f ./$(DEPDIR)/vc_multistudent.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/c_F.Plo + -rm -f ./$(DEPDIR)/c_beta.Plo + -rm -f ./$(DEPDIR)/c_beta_gen.Plo + -rm -f ./$(DEPDIR)/c_burr.Plo + -rm -f ./$(DEPDIR)/c_cauchy.Plo + -rm -f ./$(DEPDIR)/c_chi.Plo + -rm -f ./$(DEPDIR)/c_chi_gen.Plo + -rm -f ./$(DEPDIR)/c_chisquare.Plo + -rm -f ./$(DEPDIR)/c_exponential.Plo + -rm -f ./$(DEPDIR)/c_exponential_gen.Plo + -rm -f ./$(DEPDIR)/c_extremeI.Plo + -rm -f ./$(DEPDIR)/c_extremeII.Plo + -rm -f ./$(DEPDIR)/c_gamma.Plo + -rm -f ./$(DEPDIR)/c_gamma_gen.Plo + -rm -f ./$(DEPDIR)/c_ghyp.Plo + -rm -f ./$(DEPDIR)/c_gig.Plo + -rm -f ./$(DEPDIR)/c_gig2.Plo + -rm -f ./$(DEPDIR)/c_gig_gen.Plo + -rm -f ./$(DEPDIR)/c_hyperbolic.Plo + -rm -f ./$(DEPDIR)/c_ig.Plo + -rm -f ./$(DEPDIR)/c_laplace.Plo + -rm -f ./$(DEPDIR)/c_logistic.Plo + -rm -f ./$(DEPDIR)/c_lognormal.Plo + -rm -f ./$(DEPDIR)/c_lomax.Plo + -rm -f ./$(DEPDIR)/c_meixner.Plo + -rm -f ./$(DEPDIR)/c_normal.Plo + -rm -f ./$(DEPDIR)/c_normal_gen.Plo + -rm -f ./$(DEPDIR)/c_pareto.Plo + -rm -f ./$(DEPDIR)/c_powerexponential.Plo + -rm -f ./$(DEPDIR)/c_powerexponential_gen.Plo + -rm -f ./$(DEPDIR)/c_rayleigh.Plo + -rm -f ./$(DEPDIR)/c_slash.Plo + -rm -f ./$(DEPDIR)/c_slash_gen.Plo + -rm -f ./$(DEPDIR)/c_student.Plo + -rm -f ./$(DEPDIR)/c_student_gen.Plo + -rm -f ./$(DEPDIR)/c_triangular.Plo + -rm -f ./$(DEPDIR)/c_uniform.Plo + -rm -f ./$(DEPDIR)/c_vg.Plo + -rm -f ./$(DEPDIR)/c_weibull.Plo + -rm -f ./$(DEPDIR)/d_binomial.Plo + -rm -f ./$(DEPDIR)/d_binomial_gen.Plo + -rm -f ./$(DEPDIR)/d_geometric.Plo + -rm -f ./$(DEPDIR)/d_hypergeometric.Plo + -rm -f ./$(DEPDIR)/d_hypergeometric_gen.Plo + -rm -f ./$(DEPDIR)/d_logarithmic.Plo + -rm -f ./$(DEPDIR)/d_logarithmic_gen.Plo + -rm -f ./$(DEPDIR)/d_negativebinomial.Plo + -rm -f ./$(DEPDIR)/d_poisson.Plo + -rm -f ./$(DEPDIR)/d_poisson_gen.Plo + -rm -f ./$(DEPDIR)/d_zipf.Plo + -rm -f ./$(DEPDIR)/d_zipf_gen.Plo + -rm -f ./$(DEPDIR)/m_correlation.Plo + -rm -f ./$(DEPDIR)/vc_copula.Plo + -rm -f ./$(DEPDIR)/vc_multicauchy.Plo + -rm -f ./$(DEPDIR)/vc_multiexponential.Plo + -rm -f ./$(DEPDIR)/vc_multinormal.Plo + -rm -f ./$(DEPDIR)/vc_multinormal_gen.Plo + -rm -f ./$(DEPDIR)/vc_multistudent.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/distributions/Makefile.am b/vendor/unuran-1.11.0/src/distributions/Makefile.am new file mode 100644 index 0000000..8c2a29e --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/Makefile.am @@ -0,0 +1,66 @@ +## Process this file with automake to produce Makefile.in + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libdistributions.la + +libdistributions_la_SOURCES = \ + c_beta.c c_beta_gen.c \ + c_burr.c \ + c_cauchy.c \ + c_chi.c c_chi_gen.c \ + c_chisquare.c \ + c_exponential.c c_exponential_gen.c \ + c_extremeI.c \ + c_extremeII.c \ + c_F.c \ + c_gamma.c c_gamma_gen.c \ + c_ghyp.c \ + c_gig.c c_gig_gen.c \ + c_gig2.c \ + c_hyperbolic.c \ + c_ig.c \ + c_laplace.c \ + c_logistic.c \ + c_lognormal.c \ + c_lomax.c \ + c_meixner.c \ + c_normal.c c_normal_gen.c \ + c_pareto.c \ + c_powerexponential.c c_powerexponential_gen.c \ + c_rayleigh.c \ + c_slash.c c_slash_gen.c \ + c_student.c c_student_gen.c \ + c_triangular.c \ + c_uniform.c \ + c_vg.c \ + c_weibull.c \ + d_binomial.c d_binomial_gen.c \ + d_geometric.c \ + d_hypergeometric.c d_hypergeometric_gen.c \ + d_logarithmic.c d_logarithmic_gen.c \ + d_negativebinomial.c \ + d_poisson.c d_poisson_gen.c \ + d_zipf.c d_zipf_gen.c \ + m_correlation.c \ + vc_copula.c \ + vc_multicauchy.c \ + vc_multiexponential.c \ + vc_multinormal.c vc_multinormal_gen.c \ + vc_multistudent.c + +noinst_HEADERS = \ + unur_distributions.h \ + unur_distributions_source.h \ + unur_stddistr.h + +EXTRA_DIST = \ + README + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/vendor/unuran-1.11.0/src/distributions/Makefile.in b/vendor/unuran-1.11.0/src/distributions/Makefile.in new file mode 100644 index 0000000..fbf8da3 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/Makefile.in @@ -0,0 +1,894 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/distributions +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libdistributions_la_LIBADD = +am_libdistributions_la_OBJECTS = c_beta.lo c_beta_gen.lo c_burr.lo \ + c_cauchy.lo c_chi.lo c_chi_gen.lo c_chisquare.lo \ + c_exponential.lo c_exponential_gen.lo c_extremeI.lo \ + c_extremeII.lo c_F.lo c_gamma.lo c_gamma_gen.lo c_ghyp.lo \ + c_gig.lo c_gig_gen.lo c_gig2.lo c_hyperbolic.lo c_ig.lo \ + c_laplace.lo c_logistic.lo c_lognormal.lo c_lomax.lo \ + c_meixner.lo c_normal.lo c_normal_gen.lo c_pareto.lo \ + c_powerexponential.lo c_powerexponential_gen.lo c_rayleigh.lo \ + c_slash.lo c_slash_gen.lo c_student.lo c_student_gen.lo \ + c_triangular.lo c_uniform.lo c_vg.lo c_weibull.lo \ + d_binomial.lo d_binomial_gen.lo d_geometric.lo \ + d_hypergeometric.lo d_hypergeometric_gen.lo d_logarithmic.lo \ + d_logarithmic_gen.lo d_negativebinomial.lo d_poisson.lo \ + d_poisson_gen.lo d_zipf.lo d_zipf_gen.lo m_correlation.lo \ + vc_copula.lo vc_multicauchy.lo vc_multiexponential.lo \ + vc_multinormal.lo vc_multinormal_gen.lo vc_multistudent.lo +libdistributions_la_OBJECTS = $(am_libdistributions_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/c_F.Plo ./$(DEPDIR)/c_beta.Plo \ + ./$(DEPDIR)/c_beta_gen.Plo ./$(DEPDIR)/c_burr.Plo \ + ./$(DEPDIR)/c_cauchy.Plo ./$(DEPDIR)/c_chi.Plo \ + ./$(DEPDIR)/c_chi_gen.Plo ./$(DEPDIR)/c_chisquare.Plo \ + ./$(DEPDIR)/c_exponential.Plo \ + ./$(DEPDIR)/c_exponential_gen.Plo ./$(DEPDIR)/c_extremeI.Plo \ + ./$(DEPDIR)/c_extremeII.Plo ./$(DEPDIR)/c_gamma.Plo \ + ./$(DEPDIR)/c_gamma_gen.Plo ./$(DEPDIR)/c_ghyp.Plo \ + ./$(DEPDIR)/c_gig.Plo ./$(DEPDIR)/c_gig2.Plo \ + ./$(DEPDIR)/c_gig_gen.Plo ./$(DEPDIR)/c_hyperbolic.Plo \ + ./$(DEPDIR)/c_ig.Plo ./$(DEPDIR)/c_laplace.Plo \ + ./$(DEPDIR)/c_logistic.Plo ./$(DEPDIR)/c_lognormal.Plo \ + ./$(DEPDIR)/c_lomax.Plo ./$(DEPDIR)/c_meixner.Plo \ + ./$(DEPDIR)/c_normal.Plo ./$(DEPDIR)/c_normal_gen.Plo \ + ./$(DEPDIR)/c_pareto.Plo ./$(DEPDIR)/c_powerexponential.Plo \ + ./$(DEPDIR)/c_powerexponential_gen.Plo \ + ./$(DEPDIR)/c_rayleigh.Plo ./$(DEPDIR)/c_slash.Plo \ + ./$(DEPDIR)/c_slash_gen.Plo ./$(DEPDIR)/c_student.Plo \ + ./$(DEPDIR)/c_student_gen.Plo ./$(DEPDIR)/c_triangular.Plo \ + ./$(DEPDIR)/c_uniform.Plo ./$(DEPDIR)/c_vg.Plo \ + ./$(DEPDIR)/c_weibull.Plo ./$(DEPDIR)/d_binomial.Plo \ + ./$(DEPDIR)/d_binomial_gen.Plo ./$(DEPDIR)/d_geometric.Plo \ + ./$(DEPDIR)/d_hypergeometric.Plo \ + ./$(DEPDIR)/d_hypergeometric_gen.Plo \ + ./$(DEPDIR)/d_logarithmic.Plo \ + ./$(DEPDIR)/d_logarithmic_gen.Plo \ + ./$(DEPDIR)/d_negativebinomial.Plo ./$(DEPDIR)/d_poisson.Plo \ + ./$(DEPDIR)/d_poisson_gen.Plo ./$(DEPDIR)/d_zipf.Plo \ + ./$(DEPDIR)/d_zipf_gen.Plo ./$(DEPDIR)/m_correlation.Plo \ + ./$(DEPDIR)/vc_copula.Plo ./$(DEPDIR)/vc_multicauchy.Plo \ + ./$(DEPDIR)/vc_multiexponential.Plo \ + ./$(DEPDIR)/vc_multinormal.Plo \ + ./$(DEPDIR)/vc_multinormal_gen.Plo \ + ./$(DEPDIR)/vc_multistudent.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libdistributions_la_SOURCES) +DIST_SOURCES = $(libdistributions_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp \ + README +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ +UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ +UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ +UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_valgrind = @have_valgrind@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libdistributions.la +libdistributions_la_SOURCES = \ + c_beta.c c_beta_gen.c \ + c_burr.c \ + c_cauchy.c \ + c_chi.c c_chi_gen.c \ + c_chisquare.c \ + c_exponential.c c_exponential_gen.c \ + c_extremeI.c \ + c_extremeII.c \ + c_F.c \ + c_gamma.c c_gamma_gen.c \ + c_ghyp.c \ + c_gig.c c_gig_gen.c \ + c_gig2.c \ + c_hyperbolic.c \ + c_ig.c \ + c_laplace.c \ + c_logistic.c \ + c_lognormal.c \ + c_lomax.c \ + c_meixner.c \ + c_normal.c c_normal_gen.c \ + c_pareto.c \ + c_powerexponential.c c_powerexponential_gen.c \ + c_rayleigh.c \ + c_slash.c c_slash_gen.c \ + c_student.c c_student_gen.c \ + c_triangular.c \ + c_uniform.c \ + c_vg.c \ + c_weibull.c \ + d_binomial.c d_binomial_gen.c \ + d_geometric.c \ + d_hypergeometric.c d_hypergeometric_gen.c \ + d_logarithmic.c d_logarithmic_gen.c \ + d_negativebinomial.c \ + d_poisson.c d_poisson_gen.c \ + d_zipf.c d_zipf_gen.c \ + m_correlation.c \ + vc_copula.c \ + vc_multicauchy.c \ + vc_multiexponential.c \ + vc_multinormal.c vc_multinormal_gen.c \ + vc_multistudent.c + +noinst_HEADERS = \ + unur_distributions.h \ + unur_distributions_source.h \ + unur_stddistr.h + +EXTRA_DIST = \ + README + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/distributions/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/distributions/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libdistributions.la: $(libdistributions_la_OBJECTS) $(libdistributions_la_DEPENDENCIES) $(EXTRA_libdistributions_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libdistributions_la_OBJECTS) $(libdistributions_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_F.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_beta.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_beta_gen.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_burr.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_cauchy.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_chi.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_chi_gen.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_chisquare.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_exponential.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_exponential_gen.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_extremeI.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_extremeII.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_gamma.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_gamma_gen.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_ghyp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_gig.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_gig2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_gig_gen.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_hyperbolic.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_ig.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_laplace.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_logistic.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_lognormal.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_lomax.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_meixner.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_normal.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_normal_gen.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_pareto.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_powerexponential.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_powerexponential_gen.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_rayleigh.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_slash.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_slash_gen.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_student.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_student_gen.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_triangular.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_uniform.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_vg.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_weibull.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_binomial.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_binomial_gen.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_geometric.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_hypergeometric.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_hypergeometric_gen.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_logarithmic.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_logarithmic_gen.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_negativebinomial.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_poisson.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_poisson_gen.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_zipf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_zipf_gen.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_correlation.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_copula.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_multicauchy.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_multiexponential.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_multinormal.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_multinormal_gen.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_multistudent.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/c_F.Plo + -rm -f ./$(DEPDIR)/c_beta.Plo + -rm -f ./$(DEPDIR)/c_beta_gen.Plo + -rm -f ./$(DEPDIR)/c_burr.Plo + -rm -f ./$(DEPDIR)/c_cauchy.Plo + -rm -f ./$(DEPDIR)/c_chi.Plo + -rm -f ./$(DEPDIR)/c_chi_gen.Plo + -rm -f ./$(DEPDIR)/c_chisquare.Plo + -rm -f ./$(DEPDIR)/c_exponential.Plo + -rm -f ./$(DEPDIR)/c_exponential_gen.Plo + -rm -f ./$(DEPDIR)/c_extremeI.Plo + -rm -f ./$(DEPDIR)/c_extremeII.Plo + -rm -f ./$(DEPDIR)/c_gamma.Plo + -rm -f ./$(DEPDIR)/c_gamma_gen.Plo + -rm -f ./$(DEPDIR)/c_ghyp.Plo + -rm -f ./$(DEPDIR)/c_gig.Plo + -rm -f ./$(DEPDIR)/c_gig2.Plo + -rm -f ./$(DEPDIR)/c_gig_gen.Plo + -rm -f ./$(DEPDIR)/c_hyperbolic.Plo + -rm -f ./$(DEPDIR)/c_ig.Plo + -rm -f ./$(DEPDIR)/c_laplace.Plo + -rm -f ./$(DEPDIR)/c_logistic.Plo + -rm -f ./$(DEPDIR)/c_lognormal.Plo + -rm -f ./$(DEPDIR)/c_lomax.Plo + -rm -f ./$(DEPDIR)/c_meixner.Plo + -rm -f ./$(DEPDIR)/c_normal.Plo + -rm -f ./$(DEPDIR)/c_normal_gen.Plo + -rm -f ./$(DEPDIR)/c_pareto.Plo + -rm -f ./$(DEPDIR)/c_powerexponential.Plo + -rm -f ./$(DEPDIR)/c_powerexponential_gen.Plo + -rm -f ./$(DEPDIR)/c_rayleigh.Plo + -rm -f ./$(DEPDIR)/c_slash.Plo + -rm -f ./$(DEPDIR)/c_slash_gen.Plo + -rm -f ./$(DEPDIR)/c_student.Plo + -rm -f ./$(DEPDIR)/c_student_gen.Plo + -rm -f ./$(DEPDIR)/c_triangular.Plo + -rm -f ./$(DEPDIR)/c_uniform.Plo + -rm -f ./$(DEPDIR)/c_vg.Plo + -rm -f ./$(DEPDIR)/c_weibull.Plo + -rm -f ./$(DEPDIR)/d_binomial.Plo + -rm -f ./$(DEPDIR)/d_binomial_gen.Plo + -rm -f ./$(DEPDIR)/d_geometric.Plo + -rm -f ./$(DEPDIR)/d_hypergeometric.Plo + -rm -f ./$(DEPDIR)/d_hypergeometric_gen.Plo + -rm -f ./$(DEPDIR)/d_logarithmic.Plo + -rm -f ./$(DEPDIR)/d_logarithmic_gen.Plo + -rm -f ./$(DEPDIR)/d_negativebinomial.Plo + -rm -f ./$(DEPDIR)/d_poisson.Plo + -rm -f ./$(DEPDIR)/d_poisson_gen.Plo + -rm -f ./$(DEPDIR)/d_zipf.Plo + -rm -f ./$(DEPDIR)/d_zipf_gen.Plo + -rm -f ./$(DEPDIR)/m_correlation.Plo + -rm -f ./$(DEPDIR)/vc_copula.Plo + -rm -f ./$(DEPDIR)/vc_multicauchy.Plo + -rm -f ./$(DEPDIR)/vc_multiexponential.Plo + -rm -f ./$(DEPDIR)/vc_multinormal.Plo + -rm -f ./$(DEPDIR)/vc_multinormal_gen.Plo + -rm -f ./$(DEPDIR)/vc_multistudent.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/c_F.Plo + -rm -f ./$(DEPDIR)/c_beta.Plo + -rm -f ./$(DEPDIR)/c_beta_gen.Plo + -rm -f ./$(DEPDIR)/c_burr.Plo + -rm -f ./$(DEPDIR)/c_cauchy.Plo + -rm -f ./$(DEPDIR)/c_chi.Plo + -rm -f ./$(DEPDIR)/c_chi_gen.Plo + -rm -f ./$(DEPDIR)/c_chisquare.Plo + -rm -f ./$(DEPDIR)/c_exponential.Plo + -rm -f ./$(DEPDIR)/c_exponential_gen.Plo + -rm -f ./$(DEPDIR)/c_extremeI.Plo + -rm -f ./$(DEPDIR)/c_extremeII.Plo + -rm -f ./$(DEPDIR)/c_gamma.Plo + -rm -f ./$(DEPDIR)/c_gamma_gen.Plo + -rm -f ./$(DEPDIR)/c_ghyp.Plo + -rm -f ./$(DEPDIR)/c_gig.Plo + -rm -f ./$(DEPDIR)/c_gig2.Plo + -rm -f ./$(DEPDIR)/c_gig_gen.Plo + -rm -f ./$(DEPDIR)/c_hyperbolic.Plo + -rm -f ./$(DEPDIR)/c_ig.Plo + -rm -f ./$(DEPDIR)/c_laplace.Plo + -rm -f ./$(DEPDIR)/c_logistic.Plo + -rm -f ./$(DEPDIR)/c_lognormal.Plo + -rm -f ./$(DEPDIR)/c_lomax.Plo + -rm -f ./$(DEPDIR)/c_meixner.Plo + -rm -f ./$(DEPDIR)/c_normal.Plo + -rm -f ./$(DEPDIR)/c_normal_gen.Plo + -rm -f ./$(DEPDIR)/c_pareto.Plo + -rm -f ./$(DEPDIR)/c_powerexponential.Plo + -rm -f ./$(DEPDIR)/c_powerexponential_gen.Plo + -rm -f ./$(DEPDIR)/c_rayleigh.Plo + -rm -f ./$(DEPDIR)/c_slash.Plo + -rm -f ./$(DEPDIR)/c_slash_gen.Plo + -rm -f ./$(DEPDIR)/c_student.Plo + -rm -f ./$(DEPDIR)/c_student_gen.Plo + -rm -f ./$(DEPDIR)/c_triangular.Plo + -rm -f ./$(DEPDIR)/c_uniform.Plo + -rm -f ./$(DEPDIR)/c_vg.Plo + -rm -f ./$(DEPDIR)/c_weibull.Plo + -rm -f ./$(DEPDIR)/d_binomial.Plo + -rm -f ./$(DEPDIR)/d_binomial_gen.Plo + -rm -f ./$(DEPDIR)/d_geometric.Plo + -rm -f ./$(DEPDIR)/d_hypergeometric.Plo + -rm -f ./$(DEPDIR)/d_hypergeometric_gen.Plo + -rm -f ./$(DEPDIR)/d_logarithmic.Plo + -rm -f ./$(DEPDIR)/d_logarithmic_gen.Plo + -rm -f ./$(DEPDIR)/d_negativebinomial.Plo + -rm -f ./$(DEPDIR)/d_poisson.Plo + -rm -f ./$(DEPDIR)/d_poisson_gen.Plo + -rm -f ./$(DEPDIR)/d_zipf.Plo + -rm -f ./$(DEPDIR)/d_zipf_gen.Plo + -rm -f ./$(DEPDIR)/m_correlation.Plo + -rm -f ./$(DEPDIR)/vc_copula.Plo + -rm -f ./$(DEPDIR)/vc_multicauchy.Plo + -rm -f ./$(DEPDIR)/vc_multiexponential.Plo + -rm -f ./$(DEPDIR)/vc_multinormal.Plo + -rm -f ./$(DEPDIR)/vc_multinormal_gen.Plo + -rm -f ./$(DEPDIR)/vc_multistudent.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/distributions/README b/vendor/unuran-1.11.0/src/distributions/README new file mode 100644 index 0000000..19959f3 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/README @@ -0,0 +1,33 @@ +# +# The PDF and PMF codes in this directory are parsed by a perl script +# to be used for a code generator. To make this parser as simple as +# possible the following coding rules must be satisfied: +# +# (1) The PDF subroutine must end with the sequence that matches the +# regular expression: +# /\\/\\*\\s+end\\s+of\\s+$PDF_name/ +# where $PDF_name is the name of the PDF function. +# E.g.: if the PDF function is _unur_pdf_gamma we must have +# +# double _unur_pdf_gamma( double x, const UNUR_DISTR *distr ) +# { +# .... +# } /* end of _unur_pdf_gamma() */ +# +# (2) The first argument must be named `x' for PDFs and `k' for PMFs. +# +# (3) Only use single commands for `if' blocks; do not use braces. +# +# (4) `if' statements must be on a separate line; the `if' command +# must be on the next line (comment lines and empty lines are +# allowed). +# +# (5) Do not use ?: statements. +# +# +# Remark: +# These rules need not be satisfied any other routine (e.g. dPDF, CDF, ...). +# + + + diff --git a/vendor/unuran-1.11.0/src/distributions/c_F.c b/vendor/unuran-1.11.0/src/distributions/c_F.c new file mode 100644 index 0000000..606ebed --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_F.c @@ -0,0 +1,371 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_F.c * + * * + * REFERENCES: * + * * + * [3] N.L. Johnson, S. Kotz, and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 2, 2nd edition * + * John Wiley & Sons, Inc., New York, 1995 * + * * + ***************************************************************************** + * * + * distr: F distribution [3; ch.27, p.332] * + * * + * pdf: f(x) = (x^{{nu_1}/2-1}) / ((1+nu_1/nu_2 x)^{(nu_1+nu_2)/2}) * + * domain: 0 < x < infinity * + * constant: \frac{(nu_1/nu_2)^{{nu_1}/2}/Beta({nu_1}/2,{nu_2}/2) * + * * + * parameters: * + * 0: nu_1 > 0 ... shape (degrees of freedom) * + * 1: nu_2 > 0 ... shape (degrees of freedom) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "F"; + +/*---------------------------------------------------------------------------*/ +/* parameters */ +#define nua params[0] +#define nub params[1] + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cont +#define LOGNORMCONSTANT (distr->data.cont.norm_constant) + +/*---------------------------------------------------------------------------*/ +/* function prototypes */ +static double _unur_pdf_F( double x, const UNUR_DISTR *distr ); +static double _unur_logpdf_F( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_F( double x, const UNUR_DISTR *distr ); +static double _unur_dlogpdf_F( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_F( double x, const UNUR_DISTR *distr ); +#ifdef _unur_SF_invcdf_F +static double _unur_invcdf_F( double x, const UNUR_DISTR *distr ); +#endif + +static int _unur_upd_mode_F( UNUR_DISTR *distr ); +static int _unur_upd_area_F( UNUR_DISTR *distr ); +inline static double _unur_lognormconstant_F( const double *params, int n_params ); +static int _unur_set_params_F( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_F(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (x < 0.) + /* out of support */ + return 0.; + + else if (_unur_iszero(x)) { + if (nua < 2.) + return UNUR_INFINITY; + else if (_unur_isfsame(nua,2.)) + return exp(-LOGNORMCONSTANT); + else + return 0.; + } + + else + return exp ((nua/2. - 1.)*log(x) - 0.5*(nua + nub)*log(1. + x * nua / nub) - LOGNORMCONSTANT); + +} /* end of _unur_pdf_F() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_F(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (x < 0.) + /* out of support */ + return -UNUR_INFINITY; + + else if (_unur_iszero(x)) { + if (nua < 2.) + return UNUR_INFINITY; + else if (_unur_isfsame(nub,2.)) + return -LOGNORMCONSTANT; + else + return -UNUR_INFINITY; + } + + else + return ((nua/2. - 1.)*log(x) - 0.5*(nua + nub)*log(1. + x * nua / nub) - LOGNORMCONSTANT); + +} /* end of _unur_logpdf_F() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_F(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (x < 0.) + /* out of support */ + return 0.; + + else if (_unur_iszero(x)) { + if (nua < 2.) + return -UNUR_INFINITY; + else if (_unur_isfsame(nub,2.)) + return -(2.+nub)/nub * exp(-LOGNORMCONSTANT); + else + return 0.; + } + + else + return _unur_pdf_F(x,distr) * _unur_dlogpdf_F(x,distr); + +} /* end of _unur_dpdf_F() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dlogpdf_F(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (x < 0.) + /* out of support */ + return 0.; + + else if (_unur_iszero(x)) { + if (nua < 2.) + return -UNUR_INFINITY; + else if (_unur_isfsame(nub,2.)) + return -(2.+nub)/nub; + else + return UNUR_INFINITY; + } + + else + return ((nua/2.-1.)/x - nua*(nua+nub)/(2.*nub)/(1.+x*nua/nub)); + +} /* end of _unur_dlogpdf_F() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_F(double x, const UNUR_DISTR *distr) +{ +#ifdef _unur_SF_cdf_F + return _unur_SF_cdf_F(x,DISTR.nua,DISTR.nub); +#else + const double *params = DISTR.params; + + if (x <= 0.) + /* out of support of p.d.f. */ + return 0.; + + if (nua * x > nub) + return 1. - _unur_SF_incomplete_beta(nub / (nub + nua * x), nub/2., nua/2.); + else + return _unur_SF_incomplete_beta(nua * x / (nub + nua * x), nua/2., nub/2.); +#endif +} /* end of _unur_cdf_chisquare() */ + +/*---------------------------------------------------------------------------*/ + +#ifdef _unur_SF_invcdf_F +double +_unur_invcdf_F(double x, const UNUR_DISTR *distr) +{ + return _unur_SF_invcdf_F(x,DISTR.nua,DISTR.nub); +} /* end of _unur_invcdf_F() */ +#endif + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_F( UNUR_DISTR *distr ) +{ + if (DISTR.nua >= 2.) + DISTR.mode = ((DISTR.nua - 2.) * DISTR.nub) / (DISTR.nua * (DISTR.nub + 2.)); + else + DISTR.mode = 0.; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_F() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_F( UNUR_DISTR *distr ) +{ + /* log of normalization constant */ + LOGNORMCONSTANT = _unur_lognormconstant_F(DISTR.params,DISTR.n_params); + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_F( DISTR.domain[1],distr) + - _unur_cdf_F( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; + +} /* end of _unur_upd_area_F() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_lognormconstant_F(const double *params, int n_params ATTRIBUTE__UNUSED) +{ + /* log( Beta(nu1/2, nu2/2) ) - (nu1/2) * log(nu1 / nu2) */ + return ((_unur_SF_ln_gamma(nua/2.) + _unur_SF_ln_gamma(nub/2.) - _unur_SF_ln_gamma((nua+nub)/2.)) + - 0.5 * nua * log(nua/nub)); +} /* end of _unur_lognormconstant_F() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_F( UNUR_DISTR *distr, const double *params, int n_params ) +{ + + /* check number of parameters for distribution */ + if (n_params < 2) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 2) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 2; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameters nu1 and nu2 */ + if (nua <= 0. || nub <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"nu <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.nua = nua; + DISTR.nub = nub; + + /* copy optional parameters: none */ + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = 0.; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_F() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_F( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_F; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = NULL; + + /* functions */ + DISTR.pdf = _unur_pdf_F; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_F; /* pointer to logPDF */ + DISTR.dpdf = _unur_dpdf_F; /* pointer to derivative of PDF */ + DISTR.dlogpdf = _unur_dlogpdf_F; /* pointer to derivative of logPDF */ + DISTR.cdf = _unur_cdf_F; /* pointer to CDF */ +#ifdef _unur_SF_invcdf_student + DISTR.invcdf = _unur_invcdf_F; /* pointer to inverse CDF */ +#endif + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_PDFAREA | + UNUR_DISTR_SET_MODE ); + + /* set parameters for distribution */ + if (_unur_set_params_F(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* log of normalization constant */ + LOGNORMCONSTANT = _unur_lognormconstant_F(DISTR.params,DISTR.n_params); + + /* mode and area below p.d.f. */ + _unur_upd_mode_F( distr ); + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_F; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_F; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_F; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_F() */ + +/*---------------------------------------------------------------------------*/ +#undef nu1 +#undef nu2 +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_beta.c b/vendor/unuran-1.11.0/src/distributions/c_beta.c new file mode 100644 index 0000000..c66c5bc --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_beta.c @@ -0,0 +1,482 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_beta.c * + * * + * REFERENCES: * + * * + * [3] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 2, 2nd edition * + * John Wiley & Sons, Inc., New York, 1995 * + * * + ***************************************************************************** + * * + * distr: Beta distribution [3; ch.25, p.210] * + * * + * pdf: f(x) = (x-a)^(p-1) * (b-x)^(q-1) * + * domain: a < x < b * + * constant: 1 / ( Beta(p,q) * (b-a)^(p+q-1) ) * + * * + * parameters: 4 * + * 0: p > 0 ... shape * + * 1: q > 0 ... shape * + * 2: a (0) ... location * + * 3: b >a (1) ... location * + * * + ***************************************************************************** + * * + * standard form * + * * + * pdf: f(x) = x^(p-1) * (1-x)^(q-1) * + * domain: 0 < x < 1 * + * constant: 1 / Beta(p,q) * + * * + * parameters: 2 * + * 0: p > 0 ... shape * + * 1: q > 0 ... shape * + * * + * 2: a = 0 * + * 3: b = 1 * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "beta"; + +/*---------------------------------------------------------------------------*/ +/* parameters */ +#define p params[0] +#define q params[1] +#define a params[2] +#define b params[3] + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cont +#define LOGNORMCONSTANT (distr->data.cont.norm_constant) + +/*---------------------------------------------------------------------------*/ + +/* function prototypes */ +static double _unur_pdf_beta( double x, const UNUR_DISTR *distr ); +static double _unur_logpdf_beta( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_beta( double x, const UNUR_DISTR *distr ); +static double _unur_dlogpdf_beta( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_beta( double x, const UNUR_DISTR *distr ); +#ifdef _unur_SF_invcdf_beta +static double _unur_invcdf_beta( double x, const UNUR_DISTR *distr ); +#endif + +static int _unur_upd_mode_beta( UNUR_DISTR *distr ); +static int _unur_upd_area_beta( UNUR_DISTR *distr ); +inline static double _unur_lognormconstant_beta( const double *params, int n_params ); +static int _unur_set_params_beta( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_beta(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 2) + /* standardize */ + x = (x-a) / (b-a); + + /* standard form */ + + if (x > 0. && x < 1.) + return exp((p-1.)*log(x) + (q-1.)*log(1.-x) - LOGNORMCONSTANT); + + if ((_unur_iszero(x) && _unur_isone(p)) || (_unur_isone(x) && _unur_isone(q))) + return exp(-LOGNORMCONSTANT); + + if ((_unur_iszero(x) && p<1.) || (_unur_isone(x) && q<1.)) + return UNUR_INFINITY; + + /* out of support */ + return 0.; + +} /* end of _unur_pdf_beta() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_beta(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 2) + /* standardize */ + x = (x-a) / (b-a); + + /* standard form */ + + if (x > 0. && x < 1.) + return ((p-1.)*log(x) + (q-1.)*log(1.-x) - LOGNORMCONSTANT); + + if ((_unur_iszero(x) && _unur_isone(p)) + || (_unur_isone(x) && _unur_isone(q))) + return (-LOGNORMCONSTANT); + + if ((_unur_iszero(x) && p<1.) || (_unur_isone(x) && q<1.)) + return UNUR_INFINITY; + + /* out of support */ + return -UNUR_INFINITY; + +} /* end of _unur_logpdf_beta() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_beta(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 2) { + /* standardize */ + x = (x-a) / (b-a); + } + + /* standard form */ + + if (x > 0. && x < 1.) + return (exp((p-2.)*log(x) + (q-2.)*log(1.-x) - LOGNORMCONSTANT) * ( (p-1.)*(1.-x) - (q-1.)*x ) / (b-a) ); + + if (_unur_iszero(x) && _unur_isone(p)) + return (1.-q)*exp(-LOGNORMCONSTANT)/(b-a); + + if (_unur_iszero(x) && _unur_isfsame(p,2.)) + return exp(-LOGNORMCONSTANT)/(b-a); + + if (_unur_iszero(x) && p<2.) + return (p>1. ? UNUR_INFINITY : -UNUR_INFINITY); + + /* if (_unur_iszero(x) && p>2.) */ + /* return 0.; */ + + if (_unur_isone(x) && _unur_isone(q)) + return (p-1.)*exp(-LOGNORMCONSTANT)/(b-a); + + if (_unur_isone(x) && _unur_isfsame(q,2.)) + return -exp(-LOGNORMCONSTANT)/(b-a); + + if (_unur_isone(x) && q<2.) + return (q>1. ? -UNUR_INFINITY : UNUR_INFINITY); + + /* if (_unur_isone(x) && q>2.) */ + /* return 0.; */ + + /* out of support */ + return 0.; + +} /* end of _unur_dpdf_beta() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dlogpdf_beta(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 2) { + /* standardize */ + x = (x-a) / (b-a); + } + + /* standard form */ + + if (x > 0. && x < 1.) + return (((p-1.)/x - (q-1.)/(1.-x)) / (b-a)); + + if (_unur_iszero(x) && p<1.) + return -UNUR_INFINITY; + + if (_unur_iszero(x) && _unur_isone(p)) + return (-(q-1.)/((1.-x)*(b-a))); + + if (_unur_iszero(x) && p>1.) + return UNUR_INFINITY; + + if (_unur_isone(x) && q<1.) + return UNUR_INFINITY; + + if (_unur_isone(x) && _unur_isone(q)) + return ((p-1.)/(b-a)); + + if (_unur_isone(x) && q>1.) + return -UNUR_INFINITY; + + /* out of support */ + return 0.; + +} /* end of _unur_dlogpdf_beta() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_beta(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 2) + /* standardize */ + x = (x-a) / (b-a); + + /* standard form */ + + /* out of support of p.d.f.? */ + if (x <= 0.) return 0.; + if (x >= 1.) return 1.; + + return _unur_SF_incomplete_beta(x,p,q); + +} /* end of _unur_cdf_beta() */ + +/*---------------------------------------------------------------------------*/ + +#ifdef _unur_SF_invcdf_beta + +double +_unur_invcdf_beta(double x, const UNUR_DISTR *distr) +{ + const double *params = DISTR.params; + + if (DISTR.n_params == 2) + return _unur_SF_invcdf_beta(x,p,q); + else + return (a + _unur_SF_invcdf_beta(x,p,q))*(b-a); + +} /* end of _unur_invcdf_beta() */ +#endif + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_beta( UNUR_DISTR *distr ) +{ + register double *params = DISTR.params; + + if (p <= 1. && q > 1.) + DISTR.mode = 0.; /* left limit of domain */ + + else if (p > 1. && q <= 1.) + DISTR.mode = 1.; /* right limit of domain */ + + else if (p > 1. && q > 1.) + DISTR.mode = (p - 1.) / (p + q - 2.); + + else { + /* p.d.f. is not unimodal */ + DISTR.mode = UNUR_INFINITY; + return UNUR_ERR_DISTR_PROP; + } + + if (DISTR.n_params > 2) + DISTR.mode = DISTR.mode * (b - a) + a; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_beta() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_beta( UNUR_DISTR *distr ) +{ + /* log of normalization constant */ + LOGNORMCONSTANT = _unur_lognormconstant_beta(DISTR.params,DISTR.n_params); + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_beta( DISTR.domain[1],distr) + - _unur_cdf_beta( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; + +} /* end of _unur_upd_area_beta() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_lognormconstant_beta(const double *params, int n_params) +{ + if (n_params > 2) + /* non-standard form */ + /* log( Beta(p,q) * (b-a) ) */ + return (_unur_SF_ln_gamma(p) + _unur_SF_ln_gamma(q) - _unur_SF_ln_gamma(p+q) + log(b-a) ); + + else + /* standard form */ + /* log( Beta(p,q) ) */ + return (_unur_SF_ln_gamma(p) + _unur_SF_ln_gamma(q) - _unur_SF_ln_gamma(p+q)); + +} /* end of _unur_lognormconstant_beta() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_beta( UNUR_DISTR *distr, const double *params, int n_params ) +{ + + /* check number of parameters for distribution */ + if (n_params < 2) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params == 3) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,""); + n_params = 2; } + if (n_params > 4) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 4; } + CHECK_NULL(params,UNUR_ERR_NULL); + + + /* check parameters p and q */ + if (p <= 0. || q <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"p <= 0 or q <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* check parameters a and b */ + if (n_params > 2 && a >= b) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"a >= b"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.p = p; + DISTR.q = q; + + /* copy optional parameters */ + if (n_params > 2) { + DISTR.a = a; + DISTR.b = b; + } + else { /* or use defaults */ + DISTR.a = 0.; /* default for a */ + DISTR.b = 1.; /* default for b */ + } + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = DISTR.a; /* left boundary */ + DISTR.domain[1] = DISTR.b; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_beta() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_beta( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_BETA; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = _unur_stdgen_beta_init; + + /* functions */ + DISTR.pdf = _unur_pdf_beta; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_beta; /* pointer to logPDF */ + DISTR.dpdf = _unur_dpdf_beta; /* pointer to derivative of PDF */ + DISTR.dlogpdf = _unur_dlogpdf_beta; /* pointer to derivative of logPDF */ + DISTR.cdf = _unur_cdf_beta; /* pointer to CDF */ +#ifdef _unur_SF_invcdf_beta + DISTR.invcdf = _unur_invcdf_beta; /* pointer to inverse CDF */ +#endif + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_PDFAREA | + UNUR_DISTR_SET_MODE ); + + /* set parameters for distribution */ + if (_unur_set_params_beta(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* log of normalization constant */ + LOGNORMCONSTANT = _unur_lognormconstant_beta(DISTR.params,DISTR.n_params); + + /* mode and area below p.d.f. */ + _unur_upd_mode_beta( distr ); + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_beta; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_beta; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_beta; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_beta() */ + +/*---------------------------------------------------------------------------*/ +#undef p +#undef q +#undef a +#undef b +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_beta_gen.c b/vendor/unuran-1.11.0/src/distributions/c_beta_gen.c new file mode 100644 index 0000000..34f2f6f --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_beta_gen.c @@ -0,0 +1,924 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_beta_gen.c * + * * + * Special generators for Beta distribution * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions_source.h" + +/*---------------------------------------------------------------------------*/ +/* init routines for special generators */ + +inline static int beta_bc_init( struct unur_gen *gen ); +inline static int beta_bb_init( struct unur_gen *gen ); + +inline static int beta_b00_init( struct unur_gen *gen ); +inline static int beta_b01_init( struct unur_gen *gen ); +inline static int beta_b1prs_init( struct unur_gen *gen ); + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ + +/* #define MAX_gen_params (22) maximal number of parameters for generator */ + +#define p (DISTR.params[0]) /* shape parameter */ +#define q (DISTR.params[1]) /* shape parameter */ +#define a (DISTR.params[2]) /* left boundary */ +#define b (DISTR.params[3]) /* right boundary */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Inititialize **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_beta_init( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize special generator for gamma distribution. */ + /* if gen == NULL then only check existance of variant. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* one of par and gen must not be the NULL pointer */ + switch ((par) ? par->variant : gen->variant) { + + case 0: /* DEFAULT */ + case 1: /* Rejection with log-logistic envelopes */ + if (gen==NULL) return UNUR_SUCCESS; /* test existence only */ + if (p>1. && q>1.) { + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_beta_bb ); + return beta_bb_init( gen ); + } + else { + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_beta_bc ); + return beta_bc_init( gen ); + } + + case 2: /* Stratified Rejection/Patchwork Rejection */ + if (gen==NULL) return UNUR_SUCCESS; /* test existence only */ + if (p > 1. && q > 1.) { + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_beta_b1prs ); + return beta_b1prs_init( gen ); + } + else if (p < 1. && q < 1.) { + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_beta_b00 ); + return beta_b00_init( gen ); + } + else if (_unur_isone(p) || _unur_isone(q)) { /* p==1 || q==1 */ + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_beta_binv ); + return UNUR_SUCCESS; + } + else { /* (p > 1 && q < 1) || (p < 1 && q > 1) */ + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_beta_b01 ); + return beta_b01_init( gen ); + } + + default: /* no such generator */ + return UNUR_FAILURE; + + } + +} /* end of _unur_stdgen_beta_init() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Special generators **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Beta Distribution: Acceptance/Rejection from log-logistic hats for the * + * beta prime distribution * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from the Beta distribution with * + * parameters p,q (p > 0, q > 0). * + * It combines algorithms bb (p > 1, q > 1) and * + * bc (p <= 1 or q <= 1). * + * * + * REFERENCE : - R.C.H. Cheng (1978): Generating beta variates with * + * nonintegral shape parameters, * + * Communications of the ACM 21, 317-322. * + * * + * ROUTINES: - bb ... Beta generator for p > 1, q > 1 * + * - bc ... Beta generator for p <= 1 or q <= 1 * + * * + * Implemented by E. Stadlober, R. Kremer, 1990 * + ***************************************************************************** + * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#define GEN_N_PARAMS (8) +#define am (GEN->gen_param[0]) +#define bm (GEN->gen_param[1]) +#define al (GEN->gen_param[2]) +#define alnam (GEN->gen_param[3]) +#define be (GEN->gen_param[4]) +#define si (GEN->gen_param[5]) +#define rk1 (GEN->gen_param[6]) +#define rk2 (GEN->gen_param[7]) +/*---------------------------------------------------------------------------*/ + +inline static int +beta_bc_init( struct unur_gen *gen ) + /* p <= 1. || q <= 1. */ +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + + /* -X- setup code -X- */ + am = (p > q) ? p : q; + bm = (p < q) ? p : q; + al = am + bm; + alnam = al * log(al/am) - 1.386294361; + be = 1.0 / bm; + si = 1.0 + am - bm; + rk1 = si * (0.013888889 + 0.041666667 * bm) / (am * be - 0.77777778); + rk2 = 0.25 + (0.5 + 0.25 / si) * bm; + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of beta_bc_init() */ + +double +_unur_stdgen_sample_beta_bc( struct unur_gen *gen ) + /* p <= 1. || q <= 1. */ +{ + /* -X- generator code -X- */ + double X; + double u1,u2,v,w,y,z; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + while (1) { + /* Step 1 */ + u1 = uniform(); + u2 = uniform(); + + if (u1 < 0.5) { + /* Step 2 */ + y = u1 * u2; + z = u1 * y; + + if ((0.25 * u2 - y + z) >= rk1) + continue; /* goto 1 */ + + /* Step 5 */ + v = be * log(u1 / (1.0 - u1)); + if (v > 80.0) { + if (alnam < log(z)) + continue; + X = (_unur_FP_same(am,p)) ? 1.0 : 0.0; + break; + } + else { + w = am * exp(v); + if ((al * (log(al / (bm + w)) + v) - 1.386294361) < log(z)) + continue; /* goto 1 */ + + /* Step 6_a */ + X = (!_unur_FP_same(am,p)) ? bm / (bm + w) : w / (bm + w); + break; + } + } + + else { + /* Step 3 */ + z = u1 * u1 * u2; + if (z < 0.25) { + /* Step 5 */ + v = be * log(u1 / (1.0 - u1)); + if (v > 80.0) { + X = (_unur_FP_same(am,p)) ? 1.0 : 0.0; + break; + } + + w = am * exp(v); + X = (!_unur_FP_same(am,p)) ? bm / (bm + w) : w / (bm + w); + break; + } + else { + if (z >= rk2) + continue; + v = be * log(u1 / (1.0 - u1)); + if ( v > 80.0) { + if (alnam < log(z)) + continue; + X = (_unur_FP_same(am,p)) ? 1.0 : 0.0; + break; + } + w = am * exp(v); + if ((al * (log(al / (bm + w)) + v) - 1.386294361) < log(z)) + continue; /* goto 1 */ + + /* Step 6_b */ + X = (!_unur_FP_same(am,p))? bm / (bm + w) : w / (bm + w); + break; + } + } + } + + /* -X- end of generator code -X- */ + + return ((DISTR.n_params==2) ? X : a + (b-a) * X); + +} /* end of _unur_stdgen_sample_beta_bc() */ + +/*---------------------------------------------------------------------------*/ +#undef GEN_N_PARAMS +#undef am +#undef bm +#undef al +#undef alnam +#undef be +#undef si +#undef rk1 +#undef rk2 +/*---------------------------------------------------------------------------*/ +#define GEN_N_PARAMS (5) +#define am (GEN->gen_param[0]) +#define bm (GEN->gen_param[1]) +#define al (GEN->gen_param[2]) +#define be (GEN->gen_param[3]) +#define ga (GEN->gen_param[4]) +/*---------------------------------------------------------------------------*/ + +inline static int +beta_bb_init( struct unur_gen *gen ) + /* p > 1. && q > 1. */ +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + + /* -X- setup code -X- */ + am = (p < q) ? p : q; + bm = (p > q) ? p : q; + al = am + bm; + be = sqrt((al - 2.0)/(2.0 * p * q - al)); + ga = am + 1.0 / be; + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of beta_bb_init() */ + +double +_unur_stdgen_sample_beta_bb( struct unur_gen *gen ) + /* p > 1. && q > 1. */ +{ + /* -X- generator code -X- */ + double X; + double u1,u2,v,w,z,r,s,t; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + while (1) { + /* Step 1 */ + u1 = uniform(); + u2 = uniform(); + v = be * log(u1 / (1.0 - u1)); + w = am * exp(v); + z = u1 * u1 * u2; + r = ga * v - 1.386294361; + s = am + r - w; + + /* Step 2 */ + if (s + 2.609437912 < 5.0 * z) { + /* Step 3 */ + t = log(z); + if (s < t) + /* Step 4 */ + if (r + al * log(al/(bm + w)) < t) + continue; + } + + /* Step 5 */ + X = (_unur_FP_same(am,p)) ? w / (bm + w) : bm / (bm + w); + break; + } + /* -X- end of generator code -X- */ + + return ((DISTR.n_params==2) ? X : a + (b-a) * X); + +} /* end of _unur_stdgen_sample_beta_bb() */ + +/*---------------------------------------------------------------------------*/ +#undef GEN_N_PARAMS +#undef am +#undef bm +#undef al +#undef be +#undef ga +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Beta Distribution: Stratified Rejection/Patchwork Rejection * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from the Beta distribution with * + * parameters p,q (p > 0, q > 0). * + * * + * REFERENCES: - H. Sakasegawa (1983): Stratified rejection and squeeze * + * method for generating beta random numbers, * + * Ann. Inst. Statist. Math. 35 B, 291-302. * + * - H. Zechner, E. Stadlober (1993): Generating beta variates * + * via patchwork rejection, Computing 50, 1-18. * + * * + * ROUTINES: - b00 ... Beta generator for p < 1, q < 1 * + * - b01 ... Beta generator for p < 1 < q or p > 1 > q * + * - b1prs ... Beta generator for p > 1, q > 1 * + * * + * Implemented by H. Zechner and F. Niederl, July 1994 * + ***************************************************************************** + * * + * For parameters p < 1 , q < 1 and p < 1 < q or q < 1 < p the * + * stratified rejection methods b00 and b01 of Sakasegawa are used. Both * + * procedures employ suitable two-part power functions from which samples * + * can be obtained by inversion. * + * If p > 1, q > 1 (unimodal case) the patchwork rejection method b1prs * + * of Zechner/Stadlober is utilized: The area below the density function * + * f(x) in its body is rearranged by certain point reflections. Within a * + * large center interval variates are sampled efficiently by rejection * + * from uniform hats. Rectangular immediate acceptance regions speed up * + * the generation. The remaining tails are covered by exponential * + * functions. * + * If (p-1)(q-1) = 0 sampling is done by inversion if either p or q are * + * not equal to one. If p = q = 1 a uniform random variate is delivered. * + * * + ***************************************************************************** + * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#define GEN_N_PARAMS (8) +#define p_ (GEN->gen_param[0]) +#define q_ (GEN->gen_param[1]) +#define c (GEN->gen_param[2]) +#define t (GEN->gen_param[3]) +#define fp (GEN->gen_param[4]) +#define fq (GEN->gen_param[5]) +#define p1 (GEN->gen_param[6]) +#define p2 (GEN->gen_param[7]) +/*---------------------------------------------------------------------------*/ + +inline static int +beta_b00_init( struct unur_gen *gen ) + /* p < 1. && q < 1. */ +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + + /* -X- setup code -X- */ + p_ = p - 1.; + q_ = q - 1.; + c = (q * q_) / (p * p_); /* q(1-q) / p(1-p) */ + t = _unur_FP_same(c,1.) ? 0.5 : (1. - sqrt(c))/(1. - c); /* t = t_opt */ + fp = exp(p_ * log(t)); + fq = exp(q_ * log(1. - t)); /* f(t) = fa * fb */ + + p1 = t/p; /* 0 < X < t */ + p2 = (1. - t)/q + p1; /* t < X < 1 */ + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of beta_b00_init() */ + +double +_unur_stdgen_sample_beta_b00( struct unur_gen *gen ) + /* p < 1. && q < 1. */ +{ + /* -X- generator code -X- */ + double U, V, X, Z; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + while (1) { + U = uniform() * p2; + if (U <= p1) { /* X < t */ + Z = exp(log(U/p1) / p); + X = t * Z; + /* squeeze accept: L(x) = 1 + (1 - q)x */ + V = uniform() * fq; + if (V <= 1. - q_ * X) + break; + /* squeeze reject: U(x) = 1 + ((1 - t)^(q-1) - 1)/t * x */ + if (V <= 1. + (fq - 1.) * Z) { + /* quotient accept: quot(x) = (1 - x)^(q-1) / fq */ + if (log(V) <= q_ * log(1. - X)) + break; + } + } + else { /* X > t */ + Z = exp( log( (U-p1)/(p2-p1) ) / q); + X = 1. - (1. - t)*Z; + /* squeeze accept: L(x) = 1 + (1 - p)(1 - x) */ + V = uniform() * fp; + if (V <= 1.0 - p_*(1. - X)) + break; + /* squeeze reject: U(x) = 1 + (t^(p-1) - 1)/(1 - t) * (1 - x) */ + if (V <= 1.0 + (fp - 1.) * Z) { + /* quotient accept: quot(x) = x^(p-1) / fp */ + if (log(V) <= p_ * log(X)) + break; + } + } + } + /* -X- end of generator code -X- */ + + return ((DISTR.n_params==2) ? X : a + (b-a) * X); + +} /* end of _unur_stdgen_sample_beta_b00() */ + +/*---------------------------------------------------------------------------*/ +#undef GEN_N_PARAMS +#undef p_ +#undef q_ +#undef c +#undef t +#undef fp +#undef fq +#undef p1 +#undef p2 +/*---------------------------------------------------------------------------*/ +#define GEN_N_PARAMS (11) +#define pint (GEN->gen_param[0]) +#define qint (GEN->gen_param[1]) +#define p_ (GEN->gen_param[2]) +#define q_ (GEN->gen_param[3]) +#define t (GEN->gen_param[4]) +#define fp (GEN->gen_param[5]) +#define fq (GEN->gen_param[6]) +#define ml (GEN->gen_param[7]) +#define mu (GEN->gen_param[8]) +#define p1 (GEN->gen_param[9]) +#define p2 (GEN->gen_param[10]) +/*---------------------------------------------------------------------------*/ + +inline static int +beta_b01_init( struct unur_gen *gen ) + /* p < 1. < q || p > 1. > q */ +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + + /* -X- setup code -X- */ + /* internal use of p and q */ + if (p>q) { + /* swap p and q */ + pint = q; + qint = p; + } + else { + pint = p; + qint = q; + } + + p_ = pint - 1.; + q_ = qint - 1.; + t = p_/(pint - qint); /* one step Newton * start value t */ + fq = exp((q_ - 1.) * log(1. - t)); + fp = pint - (pint + q_) * t; + t -= (t - (1. - fp) * (1. - t) * fq / qint) / (1. - fp*fq); + fp = exp(p_ * log(t)); + fq = exp(q_ * log(1. - t)); /* f(t) = fa * fb */ + if (q_ <= 1.0) { + ml = (1. - fq) / t; /* ml = -m1 */ + mu = q_ * t; /* mu = -m2 * t */ + } + else { + ml = q_; + mu = 1. - fq; + } + p1 = t/pint; /* 0 < X < t */ + p2 = fq * (1. - t)/qint + p1; /* t < X < 1 */ + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of beta_b01_init() */ + +double +_unur_stdgen_sample_beta_b01( struct unur_gen *gen ) + /* p < 1. < q || p > 1. > q */ +{ + /* -X- generator code -X- */ + double U, V, X, Z; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + while (1) { + U = uniform() * p2; + if (U <= p1) { /* X < t */ + Z = exp( log(U/p1) / pint); + X = t * Z; + /* squeeze accept: L(x) = 1 + m1*x, ml = -m1 */ + V = uniform(); + if (V <= 1. - ml * X) + break; + /* squeeze reject: U(x) = 1 + m2*x, mu = -m2 * t */ + if (V <= 1. - mu * Z) + /* quotient accept: quot(x) = (1 - x)^(q-1) */ + if (log(V) <= q_ * log(1. - X)) + break; + } + else { /* X > t */ + Z = exp( log((U-p1)/(p2-p1)) / qint); + X = 1. - (1. - t) * Z; + /* squeeze accept: L(x) = 1 + (1 - p)(1 - x) */ + V = uniform() * fp; + if (V <= 1. - p_ * (1. - X)) + break; + /* squeeze reject: U(x) = 1 + (t^(p-1) - 1)/(1 - t) * (1 - x) */ + if (V <= 1. + (fp - 1.) * Z) + /* quotient accept: quot(x) = (x)^(p-1) / fp */ + if (log(V) <= p_ * log(X)) + break; + } + } + if (p>q) + /* p and q has been swapped */ + X = 1. - X; + /* -X- end of generator code -X- */ + + return ((DISTR.n_params==2) ? X : a + (b-a) * X); + +} /* end of _unur_stdgen_sample_beta_b01() */ + +/*---------------------------------------------------------------------------*/ +#undef GEN_N_PARAMS +#undef pint +#undef qint +#undef p_ +#undef q_ +#undef t +#undef fp +#undef fq +#undef ml +#undef mu +#undef p1 +#undef p2 +/*---------------------------------------------------------------------------*/ +#define GEN_N_PARAMS (22) +#define p_ (GEN->gen_param[0]) +#define q_ (GEN->gen_param[1]) +#define s (GEN->gen_param[2]) +#define m (GEN->gen_param[3]) +#define D (GEN->gen_param[4]) +#define Dl (GEN->gen_param[5]) +#define x1 (GEN->gen_param[6]) +#define x2 (GEN->gen_param[7]) +#define x4 (GEN->gen_param[8]) +#define x5 (GEN->gen_param[9]) +#define f1 (GEN->gen_param[10]) +#define f2 (GEN->gen_param[11]) +#define f4 (GEN->gen_param[12]) +#define f5 (GEN->gen_param[13]) +#define ll (GEN->gen_param[14]) +#define lr (GEN->gen_param[15]) +#define z2 (GEN->gen_param[16]) +#define z4 (GEN->gen_param[17]) +#define p1 (GEN->gen_param[18]) +#define p2 (GEN->gen_param[19]) +#define p3 (GEN->gen_param[20]) +#define p4 (GEN->gen_param[21]) +/*---------------------------------------------------------------------------*/ + +inline static int +beta_b1prs_init( struct unur_gen *gen ) + /* p > 1. && q > 1. */ +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + + /* -X- setup code -X- */ + p_ = p - 1.0; + q_ = q - 1.0; + s = p_ + q_; + m = p_ / s; + + if (p_ > 1. || q_ > 1.) + D = sqrt(m * (1. - m) / (s - 1.)); + + if (p_ <= 1.) { + x2 = Dl = m * 0.5; + x1 = z2 = f1 = ll = 0.; + } + else { + x2 = m - D; + x1 = x2 - D; + z2 = x2 * (1. - (1. - x2)/(s * D)); + if (x1 <= 0. || (s - 6.) * x2 - p_ + 3. > 0.) { + x1 = z2; x2 = (x1 + m) * 0.5; + Dl = m - x2; + } + else { + Dl = D; + } + f1 = exp( p_ * log(x1/m) + q_ * log((1. - x1)/(1. - m)) ); + ll = x1 * (1.0 - x1) / (s * (m - x1)); /* z1 = x1 - ll */ + } + f2 = exp( p_ * log(x2/m) + q_ * log((1. - x2)/(1. - m)) ); + + if (q_ <= 1.) { + D = (1. - m) * 0.5; + x4 = 1. - D; + x5 = z4 = 1.; + f5 = lr = 0.; + } + else { + x4 = m + D; + x5 = x4 + D; + z4 = x4 * (1. + (1. - x4)/(s * D)); + if (x5 >= 1. || (s - 6.) * x4 - p_ + 3. < 0.) { + x5 = z4; + x4 = (m + x5) * 0.5; + D = x4 - m; + } + f5 = exp( p_ * log(x5/m) + q_ * log((1. - x5)/(1. - m)) ); + lr = x5 * (1. - x5) / (s * (x5 - m)); /* z5 = x5 + lr */ + } + f4 = exp( p_ * log(x4/m) + q_ * log((1. - x4)/(1. - m)) ); + + p1 = f2 * (Dl + Dl); /* x1 < X < m */ + p2 = f4 * (D + D) + p1; /* m < X < x5 */ + p3 = f1 * ll + p2; /* X < x1 */ + p4 = f5 * lr + p3; /* x5 < X */ + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of beta_b1prs_init() */ + +double +_unur_stdgen_sample_beta_b1prs( struct unur_gen *gen ) + /* p > 1. && q > 1. */ +{ + /* -X- generator code -X- */ + double U, V, W, X, Y; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + while (1) { + U = uniform() * p4; + if (U <= p1) { + /* immediate accept: x2 < X < m, - f(x2) < W < 0 */ + W = U/Dl - f2; + if (W <= 0.) { + X = m - U/f2; + break; + } + /* immediate accept: x1 < X < x2, 0 < W < f(x1) */ + if (W <= f1) { + X = x2 - W/f1 * Dl; + break; + } + /* candidates for acceptance-rejection-test */ + U = uniform(); + V = Dl * U; + X = x2 - V; + Y = x2 + V; + /* squeeze accept: L(x) = f(x2) (x - z2) / (x2 - z2) */ + if (W * (x2 - z2) <= f2 * (X - z2)) + break; + V = f2 + f2 - W; + if (V < 1.) { + /* squeeze accept: L(x) = f(x2) + (1 - f(x2))(x - x2)/(m - x2) */ + if (V <= f2 + (1. - f2) * U) { + X = Y; + break; + } + /* quotient accept: x2 < Y < m, W >= 2f2 - f(Y) */ + if (V <= exp( p_ * log(Y/m) + q_ * log((1. - Y)/(1. - m)) ) ) { + X = Y; + break; + } + } + } + else + if (U <= p2) { + U -= p1; + /* immediate accept: m < X < x4, - f(x4) < W < 0 */ + W = U/D - f4; + if (W <= 0.) { + X = m + U/f4; + break; + } + /* immediate accept: x4 < X < x5, 0 < W < f(x5) */ + if (W <= f5) { + X = x4 + W/f5 * D; + break; + } + /* candidates for acceptance-rejection-test */ + U = uniform(); + V = D * U; + X = x4 + V; + Y = x4 - V; + /* squeeze accept: L(x) = f(x4) (z4 - x) / (z4 - x4) */ + if (W * (z4 - x4) <= f4 * (z4 - X)) + break; + V = f4 + f4 - W; + if (V < 1.) { + /* squeeze accept: L(x) = f(x4) + (1 - f(x4))(x4 - x)/(x4 - m) */ + if (V <= f4 + (1.0 - f4) * U) { + X = Y; + break; + } + /* quotient accept: m < Y < x4, W >= 2f4 - f(Y) */ + if (V <= exp( p_ * log(Y/m) + q_ * log((1. - Y)/(1. - m)) ) ) { + X = Y; + break; + } + } + } + else + if (U <= p3) { /* X < x1 */ + U = (U - p2)/(p3 - p2); + Y = log(U); + X = x1 + ll * Y; + if (X <= 0.) /* X > 0!! */ + continue; + W = U * uniform(); + /* squeeze accept: L(x) = f(x1) (x - z1) / (x1 - z1) */ + /* z1 = x1 - ll, W <= 1 + (X - x1)/ll */ + if (W <= 1. + Y) + break; + W *= f1; + } + else { /* x5 < X */ + U = (U - p3)/(p4 - p3); + Y = log(U); + X = x5 - lr * Y; + if (X >= 1.) /* X < 1!! */ + continue; + W = U * uniform(); + /* squeeze accept: L(x) = f(x5) (z5 - x) / (z5 - x5) */ + /* z5 = x5 + lr, W <= 1 + (x5 - X)/lr */ + if (W <= 1. + Y) + break; + W *= f5; + } + /* density accept: f(x) = (x/m)^(p_) ((1 - x)/(1 - m))^(q_) */ + if (log(W) <= p_ * log(X/m) + q_ * log((1. - X)/(1. - m))) + break; + } + /* -X- end of generator code -X- */ + + return ((DISTR.n_params==2) ? X : a + (b-a) * X); + +} /* end of _unur_stdgen_sample_beta_b1prs() */ + +/*---------------------------------------------------------------------------*/ +#undef GEN_N_PARAMS +#undef p_ +#undef q_ +#undef s +#undef m +#undef D +#undef Dl +#undef x1 +#undef x2 +#undef x4 +#undef x5 +#undef f1 +#undef f2 +#undef f4 +#undef f5 +#undef ll +#undef lr +#undef z2 +#undef z4 +#undef p1 +#undef p2 +#undef p3 +#undef p4 +/*---------------------------------------------------------------------------*/ +double +_unur_stdgen_sample_beta_binv( struct unur_gen *gen ) + /* p == 1. || q == 1. */ +{ + /* -X- generator code -X- */ + double X; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + if (_unur_isone(p) && _unur_isone(q)) { + X = uniform(); + } + else if (_unur_isone(p)) { + X = 1. - pow(1.-uniform(), 1/q); + } + else { /* _unur_isone(q) */ + X = pow(uniform(), 1/p); + } + + /* -X- end of generator code -X- */ + + return ((DISTR.n_params==2) ? X : a + (b-a) * X); + +} /* end of _unur_stdgen_sample_beta_binv() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_burr.c b/vendor/unuran-1.11.0/src/distributions/c_burr.c new file mode 100644 index 0000000..7665a74 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_burr.c @@ -0,0 +1,569 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_burr.c * + * * + * REFERENCES: * + * * + * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 1, 2nd edition * + * John Wiley & Sons, Inc., New York, 1994 * + * * + ***************************************************************************** + * * + * Burr family of distributions [2; ch.12, p.54] * + * * + * first parameter must be type of distribution (1 ... 12)! * + * * + *...........................................................................* + * * + * distr: Burr distribution Type I * + * first parameter is 1 * + * * + * cdf: F(x) = x * + * pdf: f(x) = 1 * + * domain: 0 <= x <= 1 * + * constant: 1 * + * * + * parameters: none * + * * + *...........................................................................* + * * + * distr: Burr distribution Type II * + * first parameter is 2 * + * * + * cdf: F(x) = (exp(-x) + 1)^(-k) * + * pdf: f(x) = k * exp(-x) * (exp(-x)+1)^(-k-1) * + * domain: -infinity < x < infinity * + * constant: 1 * + * * + * parameters: 1 * + * 0: k > 0 * + * * + *...........................................................................* + * * + * distr: Burr distribution Type III * + * first parameter is 3 * + * * + * cdf: F(x) = (x^(-c)+1)^(-k) * + * pdf: f(x) = c * k * x^(-c-1) * (x^(-c) + 1)^(-k-1) * + * domain: 0 < x < infinity * + * constant: 1 * + * * + * parameters: 2 * + * 0: k > 0 * + * 1: c > 0 * + * * + *...........................................................................* + * * + * distr: Burr distribution Type IV * + * first parameter is 4 * + * * + * cdf: F(x) = (((c-x)/x)^(1/c) + 1)^(-k) * + * pdf: f(x) = * + * domain: 0 < x < c * + * constant: 1 * + * * + * parameters: 2 * + * 0: k > 0 * + * 1: c > 0 * + * * + *...........................................................................* + * * + * distr: Burr distribution Type V * + * first parameter is 5 * + * * + * cdf: F(x) = (c * exp(-tan(x)) + 1)^(-k) * + * pdf: f(x) = * + * domain: -pi/2 < x < pi/2 * + * constant: * + * * + * parameters: 2 * + * 0: k > 0 * + * 1: c > 0 * + * * + *...........................................................................* + * * + * distr: Burr distribution Type VI * + * first parameter is 6 * + * * + * cdf: F(x) = (c * exp(-k*sinh(x)) + 1)^(-k) * + * pdf: f(x) = * + * domain: -infinity < x < infinity * + * constant: * + * * + * parameters: 2 * + * 0: k > 0 * + * 1: c > 0 * + * * + *...........................................................................* + * * + * distr: Burr distribution Type VII * + * first parameter is 7 * + * * + * cdf: F(x) = 2^(-k) * (1 + tanh(x))^k * + * pdf: f(x) = * + * domain: -infinity < x < infinity * + * constant: * + * * + * parameters: * + * 0: k > 0 * + * 1: c > 0 * + * * + *...........................................................................* + * * + * distr: Burr distribution Type VIII * + * first parameter is 8 * + * * + * cdf: F(x) = (2/pi * arctan(exp(x)))^k * + * pdf: f(x) = * + * domain: -infinity < x < infinity * + * constant: * + * * + * parameters: 1 * + * 0: k > 0 * + * * + *...........................................................................* + * * + * distr: Burr distribution Type IX * + * first parameter is 9 * + * * + * cdf: F(x) = 1 - 2 / (2 + c * ((1+exp(x))^k - 1)) * + * pdf: f(x) = * + * domain: -infinity < x < infinity * + * constant: * + * * + * parameters: 2 * + * 0: k > 0 * + * 1: c > 0 * + * * + *...........................................................................* + * * + * distr: Burr distribution Type X * + * first parameter is 10 * + * * + * cdf: F(x) = (1 - exp(-x^2))^k * + * pdf: f(x) = * + * domain: 0 < x < infinity * + * constant: * + * * + * parameters: 1 * + * 0: k > 0 * + * * + *...........................................................................* + * * + * distr: Burr distribution Type XI * + * first parameter is 11 * + * * + * cdf: F(x) = (x - 1/(2*pi) * sin( 2*pi*x))^k * + * pdf: f(x) = * + * domain: 0 < x < 1 * + * constant: * + * * + * parameters: * + * 0: k > 0 * + * * + *...........................................................................* + * * + * distr: Burr distribution Type XII * + * first parameter is 12 * + * * + * cdf: F(x) = 1 - (1 + x^c)^(-k) * + * pdf: f(x) = * + * domain: 0 < x < infinity * + * constant: * + * * + * parameters: * + * 0: k > 0 * + * 1: c > 0 * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006, 2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ +static const char distr_name[] = "burr"; + +/* parameters */ +#define burr_type params[0] +#define k params[1] +#define c params[2] + +#define DISTR distr->data.cont +/* #define NORMCONSTANT (distr->data.cont.norm_constant) */ + +/* function prototypes */ +/* static double _unur_pdf_burr(double x, const UNUR_DISTR *distr); */ +/* static double _unur_dpdf_burr(double x, const UNUR_DISTR *distr); */ +static double _unur_cdf_burr(double x, const UNUR_DISTR *distr); +static double _unur_invcdf_burr(double u, const UNUR_DISTR *distr); + +/* static int _unur_upd_mode_burr( UNUR_DISTR *distr ); */ +/* static int _unur_upd_area_burr( UNUR_DISTR *distr ); */ +static int _unur_set_params_burr( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_burr( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + switch ((int) (burr_type + 0.5)) { + + case 1: /* Type I: F(x) = x */ + if (x<=0.) + return 0.; + if (x>=1.) + return 1.; + return x; + + case 2: /* Type II: F(x) = (exp(-x) + 1)^(-k) */ + return pow(exp(-x) + 1., -k); + + case 3: /* Type III: F(x) = (x^(-c)+1)^(-k) */ + if (x<=0.) + return 0.; + return pow( pow(x, -c) + 1., -k); + + case 4: /* Type IV: F(x) = (((c-x)/x)^(1/c) + 1)^(-k) */ + if (x<=0.) + return 0.; + if (x>=c) + return 1.; + return pow( pow( (c-x)/x, 1/c ) + 1., -k); + + case 5: /* Type V: F(x) = (c * exp(-tan(x)) + 1)^(-k) */ + if (x<=-M_PI/2.) + return 0.; + if (x>= M_PI/2.) + return 1.; + return pow( c * exp(-tan(x)) + 1., -k ); + + case 6: /* Type VI: F(x) = (c * exp(-k*sinh(x)) + 1)^(-k) */ + return pow( c * exp(-k*sinh(x)) + 1., -k ); + + case 7: /* Type VII: F(x) = 2^(-k) * (1 + tanh(x))^k */ + return pow( (1. + tanh(x))/2, k ); + + case 8: /* Type VIII:F(x) = (2/pi * arctan(exp(x)))^k */ + return pow( 2./M_PI * atan(exp(x)), k ); + + case 9: /* Type IX: F(x) = 1 - 2 / (2 + c * ((1+exp(x))^k - 1)) */ + return (1. - 2. / (2. + c * (pow(1.+exp(x), k) - 1.))); + + case 10: /* Type X: F(x) = (1 - exp(-x^2))^k */ + if (x<=0.) return 0.; + return pow( 1. - exp(-x*x), k ); + + case 11: /* Type XI: F(x) = (x - 1/(2*pi) * sin(2*pi*x))^k */ + if (x<=0.) + return 0.; + if (x>=1.) + return 1.; + return pow( x - 1./(2.*M_PI) * sin( 2. * M_PI * x), k ); + + case 12: /* Type XII: F(x) = 1 - (1 + x^c)^(-k) */ + if (x<=0.) + return 0.; + return (1. - pow( 1 + pow(x, c), -k ) ); + + default: + _unur_error(distr_name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_INFINITY; + } + +} /* end of _unur_cdf_burr() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_invcdf_burr( double U, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + double Y; + + switch (distr->id) { + + case UNUR_DISTR_BURR_I: + return U; + + case UNUR_DISTR_BURR_II: + Y = exp( -log(U)/k ); /* U^(-1/k) */ + return ( -log( Y - 1. ) ); + + case UNUR_DISTR_BURR_III: + Y = exp( -log(U)/k ); /* U^(-1/k) */ + return ( exp( -log( Y - 1. )/c ) ); + + case UNUR_DISTR_BURR_IV: + Y = exp( -log(U)/k ); /* U^(-1/k) */ + Y = exp( c * log( Y - 1. )) + 1.; + return (c/Y); + + case UNUR_DISTR_BURR_V: + Y = exp( -log(U)/k ); /* U^(-1/k) */ + return atan( -log( (Y - 1.) / c ) ); + + case UNUR_DISTR_BURR_VI: + Y = exp( -log(U)/k ); /* U^(-1/k) */ + Y = -log( (Y - 1.) / c)/k; + return log( Y + sqrt(Y * Y +1.)); + + case UNUR_DISTR_BURR_VII: + Y = exp( log(U)/k ); /* U^(1/k) */ + return ( log(2. * Y / (2. - 2.*Y)) / 2. ); + + case UNUR_DISTR_BURR_VIII: + Y = exp( log(U)/k ); /* U^(1/k) */ + return ( log( tan( Y * M_PI/2. ) ) ); + + case UNUR_DISTR_BURR_IX: + Y = 1. + 2. * U / (c * (1.-U)); + return log( exp( log(Y) / k) - 1. ); + + case UNUR_DISTR_BURR_X: + Y = exp( log(U)/k ); /* U^(1/k) */ + return ( sqrt( -log( 1. - Y ) ) ); + + case UNUR_DISTR_BURR_XII: + Y = exp( -log(1-U)/k ); /* (1-U)^(-1/k) */ + return ( exp( log( Y - 1.) / c) ); + + case UNUR_DISTR_BURR_XI: + default: + _unur_error(distr_name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_INFINITY; + } + +} /* end of _unur_invcdf_burr() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_burr( UNUR_DISTR *distr, const double *params, int n_params ) +{ + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check number of parameters for == 3 */ + switch (distr->id) { + case UNUR_DISTR_BURR_I: + if (n_params > 1) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 1; + } + break; + + case UNUR_DISTR_BURR_II: + case UNUR_DISTR_BURR_VII: + case UNUR_DISTR_BURR_VIII: + case UNUR_DISTR_BURR_X: + case UNUR_DISTR_BURR_XI: + if (n_params < 2) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); + return UNUR_ERR_DISTR_NPARAMS; + } + if (n_params > 2) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 2; + } + break; + + case UNUR_DISTR_BURR_III: + case UNUR_DISTR_BURR_IV: + case UNUR_DISTR_BURR_V: + case UNUR_DISTR_BURR_VI: + case UNUR_DISTR_BURR_IX: + case UNUR_DISTR_BURR_XII: + if (n_params < 3) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); + return UNUR_ERR_DISTR_NPARAMS; + } + if (n_params > 3) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 3; + } + break; + + default: + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"unkown type"); + return UNUR_ERR_DISTR_NPARAMS; + } + + /* check parameters */ + if (k <= 0. || (c <= 0. && n_params == 3) ) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"k <= 0 || c <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters */ + DISTR.burr_type = burr_type; + switch (n_params) { + case 3: + DISTR.c = c; + /* FALLTHROUGH */ + case 2: + DISTR.k = k; + /* FALLTHROUGH */ + default: + break; + } + + /* number of arguments */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + + switch (distr->id) { + case UNUR_DISTR_BURR_I: + DISTR.domain[0] = 0.; /* left boundary */ + DISTR.domain[1] = 1.; /* right boundary */ + break; + case UNUR_DISTR_BURR_III: + DISTR.domain[0] = 0.; /* left boundary */ + break; + case UNUR_DISTR_BURR_IV: + DISTR.domain[0] = 0.; /* left boundary */ + DISTR.domain[1] = DISTR.c; /* right boundary */ + break; + case UNUR_DISTR_BURR_V: + DISTR.domain[0] = -M_PI/2.; /* left boundary */ + DISTR.domain[1] = M_PI/2.; /* right boundary */ + break; + case UNUR_DISTR_BURR_X: + DISTR.domain[0] = 0.; /* left boundary */ + break; + case UNUR_DISTR_BURR_XI: + DISTR.domain[0] = 0.; /* left boundary */ + DISTR.domain[1] = 1.; /* right boundary */ + break; + case UNUR_DISTR_BURR_XII: + DISTR.domain[0] = 0.; /* left boundary */ + break; + } + } + + /* pointer to inverse CDF */ + DISTR.invcdf = ( (distr->id != UNUR_DISTR_BURR_XI) + ? _unur_invcdf_burr : NULL ); + + return UNUR_SUCCESS; +} /* end of _unur_set_params_burr() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_burr( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + if (n_params < 1) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); + return NULL; + } + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* get type of distribution and + set distribution id */ + switch ((int) (burr_type + 0.5)) { + case 1: distr->id = UNUR_DISTR_BURR_I; break; + case 2: distr->id = UNUR_DISTR_BURR_II; break; + case 3: distr->id = UNUR_DISTR_BURR_III; break; + case 4: distr->id = UNUR_DISTR_BURR_IV; break; + case 5: distr->id = UNUR_DISTR_BURR_V; break; + case 6: distr->id = UNUR_DISTR_BURR_VI; break; + case 7: distr->id = UNUR_DISTR_BURR_VII; break; + case 8: distr->id = UNUR_DISTR_BURR_VIII; break; + case 9: distr->id = UNUR_DISTR_BURR_IX; break; + case 10: distr->id = UNUR_DISTR_BURR_X; break; + case 11: distr->id = UNUR_DISTR_BURR_XI; break; + case 12: distr->id = UNUR_DISTR_BURR_XII; break; + default: + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"type < 1 || type > 12"); + free( distr ); return NULL; + } + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = _unur_stdgen_burr_init; */ + + /* functions */ + /* DISTR.pdf = _unur_pdf_burr; pointer to PDF */ + /* DISTR.dpdf = _unur_dpdf_burr; pointer to derivative of PDF */ + DISTR.cdf = _unur_cdf_burr; /* pointer to CDF */ + DISTR.invcdf = _unur_invcdf_burr; /* pointer to inverse CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN ); + /* UNUR_DISTR_SET_MODE | */ + /* UNUR_DISTR_SET_PDFAREA ); */ + + /* set parameters for distribution */ + if (_unur_set_params_burr(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* normalization constant: none */ + + /* mode and area below p.d.f. */ + /* DISTR.mode = 0.; */ + /* DISTR.area = 1.; */ + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_burr; + + /* function for updating derived parameters */ + /* DISTR.upd_mode = _unur_upd_mode_burr; funct for computing mode */ + /* DISTR.upd_area = _unur_upd_area_burr; funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_burr() */ + +/*---------------------------------------------------------------------------*/ +#undef burr_type +#undef k +#undef c +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_cauchy.c b/vendor/unuran-1.11.0/src/distributions/c_cauchy.c new file mode 100644 index 0000000..ab4f922 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_cauchy.c @@ -0,0 +1,334 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_cauchy.c * + * * + * REFERENCES: * + * * + * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 1, 2nd edition * + * John Wiley & Sons, Inc., New York, 1994 * + * * + ***************************************************************************** + * * + * distr: Cauchy distribution [2; ch.16, p.299] * + * * + * pdf: f(x) = 1./( 1 + ((x-theta)/lambda)^2 ) * + * domain: -infinity < x < infinity * + * constant: 1 / (pi * lambda) * + * * + * parameters: * + * 0: theta ... location * + * 1: lambda > 0 ... scale * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "cauchy"; + +/* parameters */ +#define theta params[0] +#define lambda params[1] + +#define DISTR distr->data.cont +#define NORMCONSTANT (distr->data.cont.norm_constant) + +/* function prototypes */ +static double _unur_pdf_cauchy( double x, const UNUR_DISTR *distr ); +static double _unur_logpdf_cauchy( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_cauchy( double x, const UNUR_DISTR *distr ); +static double _unur_dlogpdf_cauchy( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_cauchy( double x, const UNUR_DISTR *distr ); +static double _unur_invcdf_cauchy( double u, const UNUR_DISTR *distr ); + +static int _unur_upd_mode_cauchy( UNUR_DISTR *distr ); +static int _unur_upd_area_cauchy( UNUR_DISTR *distr ); +static int _unur_set_params_cauchy( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_cauchy(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 0) + /* standardize */ + x = (x - theta) / lambda; + + /* standard form */ + + return (1./((1+x*x)*NORMCONSTANT)); + +} /* end of _unur_pdf_cauchy() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_cauchy(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 0) + /* standardize */ + x = (x - theta) / lambda; + + /* standard form */ + + return (-log1p(x*x)-log(NORMCONSTANT)); + +} /* end of _unur_logpdf_cauchy() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_cauchy(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 0) + /* standardize */ + x = (x - theta) / lambda; + + /* standard form */ + + return ( -2.*x/(lambda*(1.+x*x)*(1.+x*x)*NORMCONSTANT) ); + +} /* end of _unur_dpdf_cauchy() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dlogpdf_cauchy(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 0) + /* standardize */ + x = (x - theta) / lambda; + + /* standard form */ + + return -2.*x/(lambda*(1.+x*x)); + +} /* end of _unur_dlogpdf_cauchy() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_cauchy(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + register double Fx; + + if (DISTR.n_params > 0) + /* standardize */ + x = (x - theta) / lambda; + + /* standard form */ + Fx = 0.5 + atan(x)/M_PI; + + /* correct round off error of atan() */ + if (Fx<0.) Fx = 0.; + if (Fx>1.) Fx = 1.; + + return Fx; + +} /* end of _unur_cdf_cauchy() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_invcdf_cauchy(double u, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + double X; + + X = tan( M_PI * (u - 0.5) ); + return ((DISTR.n_params==0) ? X : theta + lambda * X ); +} /* end of _unur_invcdf_cauchy() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_cauchy( UNUR_DISTR *distr ) +{ + DISTR.mode = DISTR.theta; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_cauchy() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_cauchy( UNUR_DISTR *distr ) +{ + /* normalization constant */ + NORMCONSTANT = M_PI * DISTR.lambda; + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_cauchy( DISTR.domain[1],distr) + - _unur_cdf_cauchy( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; + +} /* end of _unur_upd_area_cauchy() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_cauchy( UNUR_DISTR *distr, const double *params, int n_params ) +{ + + /* check number of parameters for distribution */ + if (n_params < 0) n_params = 0; + if (n_params > 2) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 2; } + if (n_params > 0) + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter lambda */ + if (n_params == 2 && lambda <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"lambda <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form: none */ + + /* default parameters */ + DISTR.theta = 0.; + DISTR.lambda = 1.; + + /* copy optional parameters */ + switch (n_params) { + case 2: + DISTR.lambda = lambda; + /* FALLTHROUGH */ + case 1: + DISTR.theta = theta; + n_params = 2; /* number of parameters for non-standard form */ + /* FALLTHROUGH */ + default: + break; + } + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_cauchy() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_cauchy( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_CAUCHY; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = _unur_stdgen_cauchy_init; */ + + /* functions */ + DISTR.pdf = _unur_pdf_cauchy; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_cauchy; /* pointer to logPDF */ + DISTR.dpdf = _unur_dpdf_cauchy; /* pointer to derivative of PDF */ + DISTR.dlogpdf = _unur_dlogpdf_cauchy; /* pointer to derivative of logPDF */ + DISTR.cdf = _unur_cdf_cauchy; /* pointer to CDF */ + DISTR.invcdf = _unur_invcdf_cauchy; /* pointer to inverse CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MODE | + UNUR_DISTR_SET_PDFAREA ); + + /* set parameters for distribution */ + if (_unur_set_params_cauchy(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* normalization constant */ + NORMCONSTANT = M_PI * DISTR.lambda; + + /* mode and area below p.d.f. */ + DISTR.mode = DISTR.theta; + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_cauchy; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_cauchy; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_cauchy; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_cauchy() */ + +/*---------------------------------------------------------------------------*/ +#undef theta +#undef lambda +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_chi.c b/vendor/unuran-1.11.0/src/distributions/c_chi.c new file mode 100644 index 0000000..f7069e7 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_chi.c @@ -0,0 +1,255 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_chi.c * + * * + * REFERENCES: * + * * + * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 1, 2nd edition * + * John Wiley & Sons, Inc., New York, 1994 * + * * + ***************************************************************************** + * * + * distr: Chi distribution [2; ch.18, p.417] * + * (Do not confuse with Chi^2 distribution!) * + * * + * pdf: f(x) = x^(nu-1) * exp( -x^2/2 ) * + * domain: 0 <= x < infinity * + * constant: 1 / (2^((nu/2)-1) * Gamma(nu/2)) * + * * + * parameters: * + * 0: nu > 0 ... shape (degrees of freedom) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "chi"; + +/*---------------------------------------------------------------------------*/ +/* parameters */ +#define nu params[0] + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cont +#define LOGNORMCONSTANT (distr->data.cont.norm_constant) + +/*---------------------------------------------------------------------------*/ +/* function prototypes */ +static double _unur_pdf_chi( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_chi( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_chi( double x, const UNUR_DISTR *distr ); + +static int _unur_upd_mode_chi( UNUR_DISTR *distr ); +static int _unur_upd_area_chi( UNUR_DISTR *distr ); +static int _unur_set_params_chi( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_chi(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (x <= 0.) + /* out of support */ + return 0.; + + return (exp( log(x)*(nu - 1.) -x*x/2. - LOGNORMCONSTANT )); + +} /* end of _unur_pdf_chi() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_chi(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (x <= 0.) + /* out of support */ + return 0.; + + return ( exp(log(x)*(nu - 2.)-x*x/2. - LOGNORMCONSTANT) * (nu - 1. - x*x) ); +} /* end of _unur_dpdf_chi() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_chi(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (x <= 0.) + /* out of support of p.d.f. */ + return 0.; + + return _unur_SF_incomplete_gamma(x*x/2.,nu/2.); +} /* end of _unur_cdf_chi() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_chi( UNUR_DISTR *distr ) +{ + DISTR.mode = (DISTR.nu >= 1.) ? sqrt(DISTR.nu - 1.) : 0.; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_chi() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_chi( UNUR_DISTR *distr ) +{ + /* normalization constant */ + LOGNORMCONSTANT = _unur_SF_ln_gamma(DISTR.nu/2.) + M_LN2 * (DISTR.nu/2. - 1.); + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_chi( DISTR.domain[1],distr) + - _unur_cdf_chi( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; +} /* end of _unur_upd_area_chi() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_chi( UNUR_DISTR *distr, const double *params, int n_params ) +{ + + /* check number of parameters for distribution */ + if (n_params < 1) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 1) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 1; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter nu */ + if (nu <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"nu <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.nu = nu; + + /* copy optional parameters: none */ + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = 0.; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_chi() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_chi( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_CHI; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = _unur_stdgen_chi_init; + + /* functions */ + DISTR.pdf = _unur_pdf_chi; /* pointer to PDF */ + DISTR.dpdf = _unur_dpdf_chi; /* pointer to derivative of PDF */ + DISTR.cdf = _unur_cdf_chi; /* pointer to CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_PDFAREA | + UNUR_DISTR_SET_MODE ); + + /* set parameters for distribution */ + if (_unur_set_params_chi(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* log of normalization constant */ + LOGNORMCONSTANT = _unur_SF_ln_gamma(DISTR.nu/2.) + M_LN2 * (DISTR.nu/2. - 1.); + + /* mode and area below p.d.f. */ + DISTR.mode = (DISTR.nu >= 1.) ? sqrt(DISTR.nu - 1.) : 0.; + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_chi; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_chi; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_chi; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_chi() */ + +/*---------------------------------------------------------------------------*/ +#undef nu +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_chi_gen.c b/vendor/unuran-1.11.0/src/distributions/c_chi_gen.c new file mode 100644 index 0000000..26132aa --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_chi_gen.c @@ -0,0 +1,243 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_chi_gen.c * + * * + * Special generators for Chi distribution * + * (Do not confuse with Chi^2 distribution!) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions_source.h" + +/*---------------------------------------------------------------------------*/ +/* init routines for special generators */ + +inline static int chi_chru_init( struct unur_gen *gen ); + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +/* #define MAX_gen_params (4) maximal number of parameters for generator */ + +#define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ + +#define nu (DISTR.params[0]) /* shape (degrees of freedom) */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Inititialize **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_chi_init( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize special generator for chi distribution */ + /* if gen == NULL then only check existance of variant. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* one of par and gen must not be the NULL pointer */ + switch ((par) ? par->variant : gen->variant) { + + case 0: /* DEFAULT */ + case 1: /* Ratio of Uniforms with shift */ + { /* check parameters of distribution */ + double d_nu = (par) ? par->distr->data.cont.params[0] : nu; + if (d_nu < 1.) { + _unur_error(NULL,UNUR_ERR_GEN_CONDITION,""); + return UNUR_ERR_GEN_CONDITION; + } + } + + /* nu >= 1 !!!! */ + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_chi_chru ); + return chi_chru_init( gen ); + + default: /* no such generator */ + return UNUR_FAILURE; + } + +} /* end of _unur_stdgen_chi_init() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Special generators **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Chi Distribution: Ratio of Uniforms with shift * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from the Chi distribution with * + * parameters nu >= 1. * + * * + * REFERENCE : - J.F. Monahan (1987): An algorithm for generating chi random * + * variables, ACM Trans. Math. Software 13, 168-172. * + * * + * Implemented by R. Kremer, 1990 * + ***************************************************************************** + * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#define GEN_N_PARAMS (4) +#define b (GEN->gen_param[0]) +#define vm (GEN->gen_param[1]) +#define vp (GEN->gen_param[2]) +#define vd (GEN->gen_param[3]) +/*---------------------------------------------------------------------------*/ + +inline static int +chi_chru_init( struct unur_gen *gen ) +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + + /* -X- setup code -X- */ + if (nu < 1.) { + _unur_error(NULL,UNUR_ERR_GEN_CONDITION,""); + return UNUR_ERR_GEN_CONDITION; + } + + if (_unur_isone(nu)) + /* no setup step required */ + return UNUR_SUCCESS; + + /* else nu > 1 */ + b = sqrt(nu - 1.); + vm = - 0.6065306597 * (1. - 0.25 / (b * b + 1.)); + vm = (-b > vm) ? -b : vm; + vp = 0.6065306597 * (0.7071067812 + b) / (0.5 + b); + vd = vp - vm; + + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of chi_chru_init() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_stdgen_sample_chi_chru( struct unur_gen *gen ) +{ + /* -X- generator code -X- */ + double u,v,z,zz,r; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + if (_unur_isone(nu)) { + while (1) { + u = uniform(); + v = uniform() * 0.857763884960707; + z = v / u; + if (z < 0) continue; + zz = z * z; + r = 2.5 - zz; + if (z < 0.) + r = r + zz * z / (3. * z); + if (u < r * 0.3894003915) + break; + if (zz > (1.036961043 / u + 1.4)) + continue; + if (2 * log(u) < (- zz * 0.5 )) + break; + } + } + + else { /* nu > 1 */ + while (1) { + u = uniform(); + v = uniform() * vd + vm; + z = v / u; + if (z < -b) + continue; + zz = z * z; + r = 2.5 - zz; + if (z < 0.0) + r = r + zz * z / (3.0 * (z + b)); + if (u < r * 0.3894003915) { + z += b; + break; + } + if (zz > (1.036961043 / u + 1.4)) + continue; + if (2. * log(u) < (log(1.0 + z / b) * b * b - zz * 0.5 - z * b)) { + z += b; + break; + } + } + } + /* -X- end of generator code -X- */ + + return z; + +} /* end of _unur_stdgen_sample_chi_chru() */ + +/*---------------------------------------------------------------------------*/ +#undef GEN_N_PARAMS +#undef b +#undef vm +#undef vp +#undef vd +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_chisquare.c b/vendor/unuran-1.11.0/src/distributions/c_chisquare.c new file mode 100644 index 0000000..83ab956 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_chisquare.c @@ -0,0 +1,282 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_chisquare.c * + * * + * REFERENCES: * + * * + * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 1, 2nd edition * + * John Wiley & Sons, Inc., New York, 1994 * + * * + ***************************************************************************** + * * + * distr: Chisquare distribution [2; ch.18, p.416] * + * * + * pdf: f(x) = x^((nu/2)-1) * exp( -x/2 ) * + * domain: 0 <= x < infinity * + * constant: 1 / (2^(nu/2) * Gamma(nu/2)) * + * * + * parameters: * + * 0: nu > 0 ... shape (degrees of freedom) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "chisquare"; + +/*---------------------------------------------------------------------------*/ +/* parameters */ +#define nu params[0] + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cont +#define LOGNORMCONSTANT (distr->data.cont.norm_constant) + +/*---------------------------------------------------------------------------*/ +/* function prototypes */ +static double _unur_pdf_chisquare( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_chisquare( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_chisquare( double x, const UNUR_DISTR *distr ); +#ifdef _unur_SF_invcdf_gamma +static double _unur_invcdf_chisquare( double x, const UNUR_DISTR *distr ); +#endif + +static int _unur_upd_mode_chisquare( UNUR_DISTR *distr ); +static int _unur_upd_area_chisquare( UNUR_DISTR *distr ); +static int _unur_set_params_chisquare( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_chisquare(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (x <= 0.) + /* out of support */ + return 0.; + + if (_unur_isfsame(nu,2.)) + return exp(-x/2. - LOGNORMCONSTANT); + + return exp( log(x) * (nu/2. - 1.) - x/2. - LOGNORMCONSTANT ); + +} /* end of _unur_pdf_chisquare() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_chisquare(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (x <= 0.) + /* out of support */ + return 0.; + + if (_unur_isfsame(nu,2.)) + return ( -exp(-x/2. - LOGNORMCONSTANT) / 2. ); + + return ( exp( log(x) * (nu/2. - 2.) - x/2. - LOGNORMCONSTANT) * (nu - 2. - x)/2. ); + +} /* end of _unur_dpdf_chisquare() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_chisquare(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (x <= 0.) + /* out of support of p.d.f. */ + return 0.; + + return _unur_SF_incomplete_gamma(x/2.,nu/2.); +} /* end of _unur_cdf_chisquare() */ + +/*---------------------------------------------------------------------------*/ + +#ifdef _unur_SF_invcdf_gamma + +double +_unur_invcdf_chisquare( double x, const UNUR_DISTR *distr ) +{ + const double *params = DISTR.params; + + return _unur_SF_invcdf_gamma(x, 0.5*nu, 2.); +} /* end of _unur_invcdf_chisquare() */ + +#endif + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_chisquare( UNUR_DISTR *distr ) +{ + DISTR.mode = (DISTR.nu >= 2.) ? (DISTR.nu - 2.) : 0.; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_chisquare() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_chisquare( UNUR_DISTR *distr ) +{ + /* normalization constant */ + LOGNORMCONSTANT = _unur_SF_ln_gamma(DISTR.nu/2.) + M_LN2 * (DISTR.nu/2.); + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_chisquare( DISTR.domain[1],distr) + - _unur_cdf_chisquare( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; + +} /* end of _unur_upd_area_chisquare() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_chisquare( UNUR_DISTR *distr, const double *params, int n_params ) +{ + + /* check number of parameters for distribution */ + if (n_params < 1) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 1) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 1; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter nu */ + if (nu <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"nu <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.nu = nu; + + /* copy optional parameters: none */ + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = 0.; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_chisquare() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_chisquare( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_CHISQUARE; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = NULL; + + /* functions */ + DISTR.pdf = _unur_pdf_chisquare; /* pointer to PDF */ + DISTR.dpdf = _unur_dpdf_chisquare; /* pointer to derivative of PDF */ + DISTR.cdf = _unur_cdf_chisquare; /* pointer to CDF */ +#ifdef _unur_SF_invcdf_gamma + DISTR.invcdf = _unur_invcdf_chisquare; /* pointer to inverse CDF */ +#endif + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_PDFAREA | + UNUR_DISTR_SET_MODE ); + + /* set parameters for distribution */ + if (_unur_set_params_chisquare(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* log of normalization constant */ + LOGNORMCONSTANT = _unur_SF_ln_gamma(DISTR.nu/2.) + M_LN2 * (DISTR.nu/2.); + + /* mode and area below p.d.f. */ + DISTR.mode = (DISTR.nu >= 2.) ? (DISTR.nu - 2.) : 0.; + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_chisquare; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_chisquare; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_chisquare; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_chisquare() */ + +/*---------------------------------------------------------------------------*/ +#undef nu +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_exponential.c b/vendor/unuran-1.11.0/src/distributions/c_exponential.c new file mode 100644 index 0000000..519c040 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_exponential.c @@ -0,0 +1,338 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_exponential.c * + * * + * REFERENCES: * + * * + * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 1, 2nd edition * + * John Wiley & Sons, Inc., New York, 1994 * + * * + ***************************************************************************** + * * + * distr: Exponential distribution [2; ch.19, p.494] * + * * + * pdf: f(x) = exp( - (x-theta)/sigma ) * + * domain: x >= theta * + * constant: 1 / sigma * + * * + * parameters: * + * 0: sigma > 0 (1) ... scale * + * 1: theta (0) ... location * + * * + ***************************************************************************** + * * + * standard form * + * * + * pdf: f(x) = exp(-x) * + * domain: x >= 0 * + * * + * parameters: * + * none * + * * + * 0: sigma = 1 * + * 1: theta = 0 * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ +static const char distr_name[] = "exponential"; + +/* parameters */ +#define sigma params[0] +#define theta params[1] + +#define DISTR distr->data.cont +#define LOGNORMCONSTANT (distr->data.cont.norm_constant) + +/* function prototypes */ +static double _unur_pdf_exponential( double x, const UNUR_DISTR *distr ); +static double _unur_logpdf_exponential( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_exponential( double x, const UNUR_DISTR *distr ); +static double _unur_dlogpdf_exponential( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_exponential( double x, const UNUR_DISTR *distr ); +static double _unur_invcdf_exponential( double u, const UNUR_DISTR *distr ); + +static int _unur_upd_mode_exponential( UNUR_DISTR *distr ); +static int _unur_upd_area_exponential( UNUR_DISTR *distr ); +static int _unur_set_params_exponential( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_exponential( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 0) + /* standardize */ + x = (x - theta) / sigma; + + /* standard form */ + return ( (x<0.) ? 0. : exp(-x - LOGNORMCONSTANT) ); + +} /* end of _unur_pdf_exponential() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_exponential( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 0) + /* standardize */ + x = (x - theta) / sigma; + + /* standard form */ + return ( (x<0.) ? -UNUR_INFINITY : (-x - LOGNORMCONSTANT) ); + +} /* end of _unur_logpdf_exponential() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_exponential( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 0) + /* standardize */ + x = (x - theta) / sigma; + + /* standard form */ + return ( (x<0.) ? 0. : -exp(-x - 2.*LOGNORMCONSTANT) ); + +} /* end of _unur_dpdf_exponential() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dlogpdf_exponential( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 0) + /* standardize */ + x = (x - theta) / sigma; + + /* standard form */ + return ( (x<0.) ? 0. : -1./sigma ); + +} /* end of _unur_dlogpdf_exponential() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_exponential( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 0) + /* standardize */ + x = (x - theta) / sigma; + + /* standard form */ + + return ( (x<0.) ? 0. : 1.-exp(-x) ); + +} /* end of _unur_cdf_exponential() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_invcdf_exponential( double U, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + double X; + + X = - log( 1. - U ); + return ((DISTR.n_params==0) ? X : theta + sigma * X); +} /* end of _unur_invcdf_exponential() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_exponential( UNUR_DISTR *distr ) +{ + DISTR.mode = DISTR.theta; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_exponential() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_exponential( UNUR_DISTR *distr ) +{ + /* log of normalization constant */ + LOGNORMCONSTANT = log(DISTR.sigma); + + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_exponential( DISTR.domain[1],distr) + - _unur_cdf_exponential( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; + +} /* end of _unur_upd_area_exponential() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_exponential( UNUR_DISTR *distr, const double *params, int n_params ) +{ + + /* check number of parameters for distribution */ + if (n_params < 0) n_params = 0; + if (n_params > 2) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 2; } + if (n_params > 0) + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter sigma */ + if (n_params > 0 && sigma <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"sigma <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form: none */ + + /* default parameters */ + DISTR.sigma = 1.; + DISTR.theta = 0.; + + /* copy optional parameters */ + switch (n_params) { + case 2: + DISTR.theta = theta; + /* FALLTHROUGH */ + case 1: + DISTR.sigma = sigma; + n_params = 2; /* number of parameters for non-standard form */ + /* FALLTHROUGH */ + default: + break; + } + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + /* domain */ + DISTR.domain[0] = DISTR.theta; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_exponential() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_exponential( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_EXPONENTIAL; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = _unur_stdgen_exponential_init; + + /* functions */ + DISTR.pdf = _unur_pdf_exponential; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_exponential; /* pointer to logPDF */ + DISTR.dpdf = _unur_dpdf_exponential; /* pointer to derivative of PDF */ + DISTR.dlogpdf = _unur_dlogpdf_exponential; /* pointer to derivative of logPDF */ + DISTR.cdf = _unur_cdf_exponential; /* pointer to CDF */ + DISTR.invcdf = _unur_invcdf_exponential; /* pointer to inverse CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MODE | + UNUR_DISTR_SET_PDFAREA ); + + /* set parameters for distribution */ + if (_unur_set_params_exponential(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* log of normalization constant */ + LOGNORMCONSTANT = log(DISTR.sigma); + + /* mode and area below p.d.f. */ + DISTR.mode = DISTR.theta; /* theta */ + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_exponential; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_exponential; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_exponential; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_exponential() */ + +/*---------------------------------------------------------------------------*/ +#undef sigma +#undef theta +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_exponential_gen.c b/vendor/unuran-1.11.0/src/distributions/c_exponential_gen.c new file mode 100644 index 0000000..f73f6d6 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_exponential_gen.c @@ -0,0 +1,144 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_exponential_gen.c * + * * + * Special generators for Exponential distribution * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/***************************************************************************** + * We use the marginal generation time for inversion from the * + * exponential distribution as time unit for timings. * + * Thus we do not use the inverse CDF but have the particular method * + * implemented. * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions_source.h" + +/*---------------------------------------------------------------------------*/ +/* Prototypes for special generators */ + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ + +#define sigma (DISTR.params[0]) /* scale */ +#define theta (DISTR.params[1]) /* location */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Inititialize **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_exponential_init( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize special generator for exponential distribution */ + /* if gen == NULL then only check existance of variant. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* one of par and gen must not be the NULL pointer */ + switch ((par) ? par->variant : gen->variant) { + + case 0: /* DEFAULT */ + case UNUR_STDGEN_INVERSION: /* inversion method */ + if (gen) GEN->is_inversion = TRUE; + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_exponential_inv); + /** Remark: We use sampling from exponential distribution as timing unit **/ + /* _unur_cstd_set_sampling_routine(gen, _unur_cstd_sample_inv); */ + return UNUR_SUCCESS; + + default: /* no such generator */ + if (gen) _unur_warning(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_FAILURE; + } + +} /* end of _unur_stdgen_exponential_init() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Special generators **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +double _unur_stdgen_sample_exponential_inv( struct unur_gen *gen ) + /* Inversion method */ +{ + /* -X- generator code -X- */ + double U,X; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + /* sample from uniform random number generator */ + U = GEN->Umin + uniform() * (GEN->Umax-GEN->Umin); + + /* transform to random variate */ + X = - log( 1. - U ); + + /* -X- end of generator code -X- */ + + return ((DISTR.n_params==0) ? X : theta + sigma * X); + +} /* end of _unur_stdgen_sample_exponential_inv() */ + +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +#undef sigma +#undef theta +/*---------------------------------------------------------------------------*/ + + diff --git a/vendor/unuran-1.11.0/src/distributions/c_extremeI.c b/vendor/unuran-1.11.0/src/distributions/c_extremeI.c new file mode 100644 index 0000000..0170778 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_extremeI.c @@ -0,0 +1,320 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_extremeI.c * + * * + * REFERENCES: * + * * + * [3] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 2, 2nd edition * + * John Wiley & Sons, Inc., New York, 1995 * + * * + ***************************************************************************** + * * + * distr: Extreme value type I distribution [3; ch.22, p.2] * + * (also Gumbel-type distribution) * + * * + * * + * Type I (also Gumbel-type distribution) * + * * + * cdf: F(x) = exp( -exp( -(x-zeta)/theta ) ) * + * pdf: f(x) = exp( -exp( -(x-zeta)/theta ) - (x-zeta)/theta ) * + * domain: -infinity < x 0 (1) ... scale * + * * + *...........................................................................* + * * + * Standard Form: * + * * + * cdf: F(x) = exp( -exp(-x) ) * + * pdf: f(x) = exp( -exp(-x) - x ) * + * domain: -infinity < x +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "extremeI"; + +/* parameters */ +#define zeta params[0] /* location */ +#define theta params[1] /* scale */ + +#define DISTR distr->data.cont +#define LOGNORMCONSTANT (distr->data.cont.norm_constant) + +/* function prototypes */ +static double _unur_pdf_extremeI( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_extremeI( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_extremeI( double x, const UNUR_DISTR *distr ); +static double _unur_invcdf_extremeI( double u, const UNUR_DISTR *distr ); + +static int _unur_upd_mode_extremeI( UNUR_DISTR *distr ); +static int _unur_upd_area_extremeI( UNUR_DISTR *distr ); +static int _unur_set_params_extremeI( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_extremeI( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 0) + /* standardize */ + x = (x - zeta) / theta; + + /* standard form */ + + return ( exp( -exp(-x) - x - LOGNORMCONSTANT) ); + +} /* end of _unur_pdf_extremeI() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_extremeI( double x, const UNUR_DISTR *distr ) +{ + register double factor = 1.; + register double expx; + register const double *params = DISTR.params; + + if (DISTR.n_params > 0) { + /* standardize */ + factor = 1. / (theta * theta); + x = (x - zeta) / theta; + } + + /* standard form */ + + expx = exp(-x); + return ( exp( -expx - x ) * (expx - 1.) * factor ); + +} /* end of unur_dpdf_extremeI() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_extremeI( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 0) + /* standardize */ + x = (x - zeta) / theta; + + /* standard form */ + + return exp( -exp( -x) ); + +} /* end of _unur_cdf_extremeI() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_invcdf_extremeI( double U, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + double X; + + X = -log( -log(U) ); + return ((DISTR.n_params==0) ? X : zeta + theta * X ); +} /* end of _unur_invcdf_extremeI() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_extremeI( UNUR_DISTR *distr ) +{ + DISTR.mode = DISTR.zeta; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_extremeI() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_extremeI( UNUR_DISTR *distr ) +{ + /* log of normalization constant */ + LOGNORMCONSTANT = log(DISTR.theta); + + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_extremeI( DISTR.domain[1],distr) + - _unur_cdf_extremeI( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; + +} /* end of _unur_upd_area_extremeI() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_extremeI( UNUR_DISTR *distr, const double *params, int n_params ) +{ + + /* check number of parameters for distribution */ + if (n_params < 0) n_params = 0; + if (n_params > 2) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 2; } + if (n_params > 0) + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter theta */ + if (n_params == 2 && theta <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"theta <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form: none */ + + /* default parameters */ + DISTR.zeta = 0.; + DISTR.theta = 1.; + + /* copy optional parameters */ + switch (n_params) { + case 2: + DISTR.theta = theta; + /* FALLTHROUGH */ + case 1: + DISTR.zeta = zeta; + n_params = 2; /* number of parameters for non-standard form */ + /* FALLTHROUGH */ + default: + break; + } + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_extremeI() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_extremeI( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_EXTREME_I; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = _unur_stdgen_extremeI_init; */ + + /* functions */ + DISTR.pdf = _unur_pdf_extremeI; /* pointer to PDF */ + DISTR.dpdf = _unur_dpdf_extremeI; /* pointer to derivative of PDF */ + DISTR.cdf = _unur_cdf_extremeI; /* pointer to CDF */ + DISTR.invcdf = _unur_invcdf_extremeI; /* pointer to inverse CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MODE | + UNUR_DISTR_SET_PDFAREA ); + + /* set parameters for distribution */ + if (_unur_set_params_extremeI(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* log of normalization constant */ + LOGNORMCONSTANT = log(DISTR.theta); + + /* domain */ + DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + + /* mode and area below p.d.f. */ + DISTR.mode = DISTR.zeta; + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_extremeI; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_extremeI; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_extremeI; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_extremeI() */ + +/*---------------------------------------------------------------------------*/ +#undef c +#undef alpha +#undef zeta +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_extremeII.c b/vendor/unuran-1.11.0/src/distributions/c_extremeII.c new file mode 100644 index 0000000..4896d8d --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_extremeII.c @@ -0,0 +1,337 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_extremeII.c * + * * + * REFERENCES: * + * * + * [3] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 2, 2nd edition * + * John Wiley & Sons, Inc., New York, 1995 * + * * + ***************************************************************************** + * * + * distr: Extreme value type II distribution [3; ch.22, p.2] * + * (also Frechet-type distribution) * + * * + * * + * Type II (also Frechet-type distribution) * + * * + * cdf: F(x) = exp( -((x-zeta)/theta)^(-k) ) * + * pdf: f(x) = exp( -((x-zeta)/theta)^(-k)) * ((x-zeta)/theta)^(-k-1) * + * domain: zeta < x 0 ... shape * + * 1: zeta (0) ... location * + * 2: theta > 0 (1) ... scale * + * * + *...........................................................................* + * * + * Standard Form: * + * * + * cdf: F(x) = exp( -x^(-k) ) * + * pdf: f(x) = exp( -x^(-k) ) * x^(-k-1) * + * domain: 0 < x +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "extremeII"; + +/* parameters */ +#define k params[0] /* shape */ +#define zeta params[1] /* location */ +#define theta params[2] /* scale */ + +#define DISTR distr->data.cont +#define LOGNORMCONSTANT (distr->data.cont.norm_constant) + +/* function prototypes */ +static double _unur_pdf_extremeII( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_extremeII( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_extremeII( double x, const UNUR_DISTR *distr ); +static double _unur_invcdf_extremeII( double u, const UNUR_DISTR *distr ); + +static int _unur_upd_mode_extremeII( UNUR_DISTR *distr ); +static int _unur_upd_area_extremeII( UNUR_DISTR *distr ); +static int _unur_set_params_extremeII( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_extremeII( double x, const UNUR_DISTR *distr ) +{ + register double xk; + register const double *params = DISTR.params; + + if (DISTR.n_params > 1) + /* standardize */ + x = (x - zeta) / theta; + + /* standard form */ + + if (x<=0.) + return 0.; + + xk = pow( x, -k - 1.); + return ( exp( -xk * x - LOGNORMCONSTANT) * xk * k ); + +} /* end of _unur_pdf_extremeII() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_extremeII( double x, const UNUR_DISTR *distr ) +{ + register double factor = 1.; + register double xk; + register const double *params = DISTR.params; + + if (DISTR.n_params > 1) { + /* standardize */ + factor = 1. / (theta * theta); + x = (x - zeta) / theta; + } + + /* standard form */ + + if (x<=0.) + return 0.; + + xk = pow(x, k); + return (- factor * exp(-1./xk) * k * (xk + k*(xk - 1.)) / pow(x,2. + 2.*k)) ; + +} /* end of unur_dpdf_extremeII() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_extremeII( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 1) + /* standardize */ + x = (x - zeta) / theta; + + /* standard form */ + + if (x<=0.) + return 0.; + + return ( exp( -pow( x, -k ) ) ); + +} /* end of _unur_cdf_extremeII() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_invcdf_extremeII( double U, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + double X; + + X = exp( -log( -log(U) )/k ); + return ((DISTR.n_params==1) ? X : zeta + theta * X ); +} /* end of _unur_invcdf_extremeII() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_extremeII( UNUR_DISTR *distr ) +{ + DISTR.mode = DISTR.zeta + pow( DISTR.k/(DISTR.k+1.), 1/DISTR.k ) * DISTR.theta; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_extremeII() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_extremeII( UNUR_DISTR *distr ) +{ + /* log of normalization constant */ + LOGNORMCONSTANT = log(DISTR.theta); + + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_extremeII( DISTR.domain[1],distr) + - _unur_cdf_extremeII( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; + +} /* end of _unur_upd_area_extremeII() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_extremeII( UNUR_DISTR *distr, const double *params, int n_params ) +{ + + /* check number of parameters for distribution */ + if (n_params < 1) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 3) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 3; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter k */ + if (k <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"k <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* check parameter theta */ + if (n_params > 2 && theta <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"theta <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.k = k; + + /* default parameters */ + DISTR.zeta = 0.; + DISTR.theta = 1.; + + /* copy optional parameters */ + switch (n_params) { + case 3: + DISTR.theta = theta; + /* FALLTHROUGH */ + case 2: + DISTR.zeta = zeta; + n_params = 3; /* number of parameters for non-standard form */ + /* FALLTHROUGH */ + default: + break; + } + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = DISTR.zeta; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_extremeII() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_extremeII( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_EXTREME_II; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = _unur_stdgen_extremeII_init; */ + + /* functions */ + DISTR.pdf = _unur_pdf_extremeII; /* pointer to PDF */ + DISTR.dpdf = _unur_dpdf_extremeII; /* pointer to derivative of PDF */ + DISTR.cdf = _unur_cdf_extremeII; /* pointer to CDF */ + DISTR.invcdf = _unur_invcdf_extremeII; /* pointer to inverse CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MODE | + UNUR_DISTR_SET_PDFAREA ); + + /* set parameters for distribution */ + if (_unur_set_params_extremeII(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* log of normalization constant */ + LOGNORMCONSTANT = log(DISTR.theta); + + /* mode and area below p.d.f. */ + DISTR.mode = DISTR.zeta + pow( DISTR.k/(DISTR.k+1.), 1/DISTR.k ) * DISTR.theta; + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_extremeII; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_extremeII; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_extremeII; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_extremeII() */ + +/*---------------------------------------------------------------------------*/ +#undef c +#undef alpha +#undef zeta +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_gamma.c b/vendor/unuran-1.11.0/src/distributions/c_gamma.c new file mode 100644 index 0000000..cfbc5bb --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_gamma.c @@ -0,0 +1,451 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_gamma.c * + * * + * REFERENCES: * + * * + * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 1, 2nd edition * + * John Wiley & Sons, Inc., New York, 1994 * + * * + ***************************************************************************** + * * + * distr: Gamma distribution [2; ch.17, p.337] * + * * + * pdf: f(x) = ((x-gamma)/beta)^(alpha-1) * exp( -(x-gamma)/beta ) * + * domain: x > gamma * + * constant: 1 / (beta * Gamma(alpha)) * + * * + * parameters: * + * 0: alpha > 0 ... shape * + * 1: beta > 0 (1) ... scale * + * 2: gamma (0) ... location * + * * + ***************************************************************************** + * * + * standard form * + * * + * pdf: f(x) = x^(alpha-1) * exp(-x) * + * domain: x > 0 * + * constant: Gamma(alpha) * + * * + * parameters: * + * 0: alpha > 0 ... shape * + * * + * 1: beta = 1 * + * 2: gamma = 0 * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "gamma"; + +/*---------------------------------------------------------------------------*/ +/* parameters */ +#define alpha params[0] /* shape */ +#define beta params[1] /* scale */ +#define gamma params[2] /* location */ + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cont +#define LOGNORMCONSTANT (distr->data.cont.norm_constant) + +/*---------------------------------------------------------------------------*/ +/* function prototypes */ +static double _unur_pdf_gamma( double x, const UNUR_DISTR *distr ); +static double _unur_logpdf_gamma( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_gamma( double x, const UNUR_DISTR *distr ); +static double _unur_dlogpdf_gamma( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_gamma( double x, const UNUR_DISTR *distr ); +#ifdef _unur_SF_invcdf_gamma +static double _unur_invcdf_gamma( double x, const UNUR_DISTR *distr ); +#endif + +static int _unur_upd_mode_gamma( UNUR_DISTR *distr ); +static int _unur_upd_area_gamma( UNUR_DISTR *distr ); +static double _unur_lognormconstant_gamma(const double *params, int n_params); +static int _unur_set_params_gamma( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_gamma( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 1) + /* standardize */ + x = (x-gamma) / beta; + + /* standard form */ + + if (_unur_isone(alpha) && x >= 0.) + return exp( -x - LOGNORMCONSTANT); + + if (x > 0.) + /* pow(x,alpha-1.) * exp(-x) */ + return exp( (alpha-1.)*log(x) - x - LOGNORMCONSTANT); + + if (_unur_iszero(x)) + return (alpha>1. ? 0. : UNUR_INFINITY); + + /* out of domain */ + return 0.; + +} /* end of _unur_pdf_gamma() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_gamma( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 1) + /* standardize */ + x = (x-gamma) / beta; + + /* standard form */ + + if (_unur_isone(alpha) && x >= 0.) + return ( -x - LOGNORMCONSTANT); + + if (x > 0.) + return ( (alpha-1.)*log(x) - x - LOGNORMCONSTANT); + + if (_unur_iszero(x)) + return (alpha>1. ? -UNUR_INFINITY : UNUR_INFINITY); + + /* out of domain */ + return -UNUR_INFINITY; + +} /* end of _unur_logpdf_gamma() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_gamma( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 1) + /* standardize */ + x = (x-gamma) / beta; + + /* standard form */ + + if (_unur_isone(alpha) && x>=0) + return( -exp(-x - LOGNORMCONSTANT) / beta ); + + if (x > 0.) + return ( exp( log(x) * (alpha-2.) - x - LOGNORMCONSTANT) * ((alpha-1.) -x) / beta ); + + if (_unur_iszero(x) && alpha < 2.) + return (alpha>1. ? UNUR_INFINITY : -UNUR_INFINITY); + + /* out of domain */ + return 0.; + +} /* end of _unur_dpdf_gamma() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dlogpdf_gamma( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 1) + /* standardize */ + x = (x-gamma) / beta; + + /* standard form */ + + if (_unur_isone(alpha) && x >= 0.) + return -1./beta; + + if (x > 0.) + return ((alpha-1.)/x - 1)/beta; + + if (_unur_iszero(x)) + return (alpha>1. ? UNUR_INFINITY : -UNUR_INFINITY); + + /* out of domain */ + return 0.; + +} /* end of _unur_dlogpdf_gamma() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_gamma( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 1) + /* standardize */ + x = (x-gamma) / beta; + + /* standard form */ + + if (x <= 0.) + return 0.; + + if (_unur_isinf(x)==1) + return 1.; + + return _unur_SF_incomplete_gamma(x,alpha); + +} /* end of _unur_cdf_gamma() */ + +/*---------------------------------------------------------------------------*/ + +#ifdef _unur_SF_invcdf_gamma + +double +_unur_invcdf_gamma( double x, const UNUR_DISTR *distr ) +{ + const double *params = DISTR.params; + + if (DISTR.n_params == 1) + return _unur_SF_invcdf_gamma(x, alpha, 1.); + else + return (gamma + _unur_SF_invcdf_gamma(x, alpha, beta)); + +} /* end of _unur_invcdf_gamma() */ + +#endif + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_gamma( UNUR_DISTR *distr ) +{ + register double *params = DISTR.params; + + DISTR.mode = (alpha >= 1.) ? (alpha - 1.) : 0.; + + if (DISTR.n_params > 1) + /* de-standardize */ + DISTR.mode = DISTR.mode * beta + gamma; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + /* for shape parameters less than 1 we also should set */ + /* the center of the distribution to some value > 0. */ + if (alpha < 1.) { + double center = alpha * beta + gamma; + center = _unur_max(center,DISTR.domain[0]); + center = _unur_min(center,DISTR.domain[1]); + unur_distr_cont_set_center(distr,center); + } + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_gamma() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_gamma( UNUR_DISTR *distr ) +{ + /* log of normalization constant */ + LOGNORMCONSTANT = _unur_lognormconstant_gamma(DISTR.params,DISTR.n_params); + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_gamma( DISTR.domain[1],distr) + - _unur_cdf_gamma( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; + +} /* end of _unur_upd_area_gamma() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_lognormconstant_gamma( const double *params, int n_params ) +{ + if (n_params > 1) + /* non-standard form */ + return ( _unur_SF_ln_gamma(alpha) + log(beta) ); + + else + /* standard form */ + return (_unur_SF_ln_gamma(alpha)); + +} /* end of _unur_lognormconstant_gamma() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_gamma( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 1) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 3) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 3; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter alpha */ + if (alpha <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"alpha <= 0."); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* check parameter beta */ + if (n_params > 1 && beta <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"beta <= 0."); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.alpha = alpha; + + /* default parameters */ + DISTR.beta = 1.; + DISTR.gamma = 0.; + + /* copy optional parameters */ + switch (n_params) { + case 3: + DISTR.gamma = gamma; + /* FALLTHROUGH */ + case 2: + DISTR.beta = beta; + n_params = 3; /* number of parameters for non-standard form */ + /* FALLTHROUGH */ + default: + break; + } + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = DISTR.gamma; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_gamma() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Make distribution object **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_gamma( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_GAMMA; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = _unur_stdgen_gamma_init; + + /* functions */ + DISTR.pdf = _unur_pdf_gamma; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_gamma; /* pointer to logPDF */ + DISTR.dpdf = _unur_dpdf_gamma; /* pointer to derivative of PDF */ + DISTR.dlogpdf = _unur_dlogpdf_gamma; /* pointer to derivative of logPDF */ + DISTR.cdf = _unur_cdf_gamma; /* pointer to CDF */ +#ifdef _unur_SF_invcdf_gamma + DISTR.invcdf = _unur_invcdf_gamma; /* pointer to inverse CDF */ +#endif + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_PDFAREA | + UNUR_DISTR_SET_MODE ); + + /* set parameters for distribution */ + if (_unur_set_params_gamma(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* log of normalization constant */ + LOGNORMCONSTANT = _unur_lognormconstant_gamma(DISTR.params,DISTR.n_params); + + /* mode and area below p.d.f. */ + _unur_upd_mode_gamma( distr ); + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_gamma; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_gamma; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_gamma; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_gamma() */ + +/*---------------------------------------------------------------------------*/ +#undef alpha +#undef beta +#undef gamma +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_gamma_gen.c b/vendor/unuran-1.11.0/src/distributions/c_gamma_gen.c new file mode 100644 index 0000000..ce25cd5 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_gamma_gen.c @@ -0,0 +1,513 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_gamma_gen.c * + * * + * Special generators for Gamma distribution * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_distributions_source.h" +#include "unur_distributions.h" + +/*---------------------------------------------------------------------------*/ +/* init routines for special generators */ + +inline static int gamma_gll_init( struct unur_gen *gen ); +inline static int gamma_gs_init( struct unur_gen *gen ); +inline static int gamma_gd_init( struct unur_gen *gen ); + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +/* #define MAX_gen_params (8) maximal number of parameters for generator */ + +#define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ + +#define alpha (DISTR.params[0]) /* shape */ +#define beta (DISTR.params[1]) /* scale */ +#define gamma (DISTR.params[2]) /* location */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Inititialize **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_gamma_init( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize special generator for gamma distribution */ + /* if gen == NULL then only check existance of variant. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* one of par and gen must not be the NULL pointer */ + switch ((par) ? par->variant : gen->variant) { + + case 0: /* DEFAULT */ + case 1: /* Acceptance Rejection combined with Acceptance Complement */ + if (gen==NULL) return UNUR_SUCCESS; /* test existence only */ + if (alpha < 1.) { + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_gamma_gs ); + return gamma_gs_init( gen ); + } + else { + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_gamma_gd ); + return gamma_gd_init( gen ); + + } + + case 2: /* Rejection with log-logistic envelopes */ + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_gamma_gll ); + return gamma_gll_init( gen ); + + default: /* no such generator */ + return UNUR_FAILURE; + } + +} /* end of _unur_stdgen_gamma_init() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Special generators **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Gamma Distribution: Rejection from log-logistic envelopes * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from the * + * Gamma distribution with parameter a. * + * * + * REFERENCE: - R.C.H. Cheng (1977): The Generation of Gamma Variables * + * with Non-Integral Shape Parameter, * + * Appl. Statist. 26(1), 71-75 * + * * + * Implemented by Ralf Kremer * + ***************************************************************************** + * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#define GEN_N_PARAMS (3) +#define aa GEN->gen_param[0] +#define bb GEN->gen_param[1] +#define cc GEN->gen_param[2] +/*---------------------------------------------------------------------------*/ + +inline static int +gamma_gll_init( struct unur_gen *gen ) +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + + /* -X- setup code -X- */ + aa = (alpha > 1.0) ? sqrt(alpha + alpha - 1.0) : alpha; + bb = alpha - 1.386294361; + cc = alpha + aa; + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of gamma_gll_init() */ + +double +_unur_stdgen_sample_gamma_gll( struct unur_gen *gen ) +{ + /* -X- generator code -X- */ + double X; + double u1,u2,v,r,z; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + while (1) { + u1 = uniform(); + u2 = uniform(); + v = log(u1 / (1.0 - u1)) / aa; + X = alpha * exp(v); + r = bb + cc * v - X; + z = u1 * u1 * u2; + if (r + 2.504077397 >= 4.5 * z) break; + if (r >= log(z)) break; + } + /* -X- end of generator code -X- */ + + return ((DISTR.n_params==1) ? X : gamma + beta * X ); + +} /* end of _unur_stdgen_sample_gamma_gll() */ + +/*---------------------------------------------------------------------------*/ +#undef GEN_N_PARAMS +#undef aa +#undef bb +#undef cc +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Gamma Distribution: Acceptance Rejection combined with * + * Acceptance Complement * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from the Gamma distribution with * + * parameter alpha > 0. * + * Acceptance Rejection gs for alpha < 1, * + * Acceptance Complement gd for alpha >= 1. * + * * + * REFERENCE: - J.H. Ahrens, U. Dieter (1974): Computer methods for * + * sampling from gamma, beta, Poisson and binomial * + * distributions, Computing 12, 223-246. * + * - J.H. Ahrens, U. Dieter (1982): Generating gamma variates * + * by a modified rejection technique, * + * Communications of the ACM 25, 47-54. * + * * + * Implemented by G. Thallinger and E. Stadlober, August 1990 * + ***************************************************************************** + * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#define GEN_N_PARAMS (1) +#define b GEN->gen_param[0] +/*---------------------------------------------------------------------------*/ + +inline static int +gamma_gs_init( struct unur_gen *gen ) + /* CASE alpha < 1: Acceptance rejection algorithm gs */ +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + + /* -X- setup code -X- */ + b = 1. + 0.36788794412 * alpha; /* Step 1 */ + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of gamma_gs_init() */ + +double +_unur_stdgen_sample_gamma_gs( struct unur_gen *gen ) +{ + /* -X- generator code -X- */ + double X, p; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + while (1) { + p = b * uniform(); + if (p <= 1.) { /* Step 2. Case gds <= 1 */ + X = exp(log(p) / alpha); + if ( log(uniform()) <= -X) + break; + } + else { /* Step 3. Case gds > 1 */ + X = - log ((b - p) / alpha); + if ( log(uniform()) <= ((alpha - 1.) * log(X))) + break; + } + } + /* -X- end of generator code -X- */ + + return ((DISTR.n_params==1) ? X : gamma + beta * X ); + +} /* end of _unur_stdgen_sample_gamma_gs() */ + +/*---------------------------------------------------------------------------*/ +#undef GEN_N_PARAMS +#undef b +/*---------------------------------------------------------------------------*/ +#define GEN_N_PARAMS (8) +#define ss GEN->gen_param[0] +#define s GEN->gen_param[1] +#define d GEN->gen_param[2] +#define r GEN->gen_param[3] +#define q0 GEN->gen_param[4] +#define b GEN->gen_param[5] +#define c GEN->gen_param[6] +#define si GEN->gen_param[7] + +#define q1 0.0416666664 +#define q2 0.0208333723 +#define q3 0.0079849875 +#define q4 0.0015746717 +#define q5 -0.0003349403 +#define q6 0.0003340332 +#define q7 0.0006053049 +#define q8 -0.0004701849 +#define q9 0.0001710320 +#define a1 0.333333333 +#define a2 -0.249999949 +#define a3 0.199999867 +#define a4 -0.166677482 +#define a5 0.142873973 +#define a6 -0.124385581 +#define a7 0.110368310 +#define a8 -0.112750886 +#define a9 0.104089866 +#define e1 1.000000000 +#define e2 0.499999994 +#define e3 0.166666848 +#define e4 0.041664508 +#define e5 0.008345522 +#define e6 0.001353826 +#define e7 0.000247453 +/*---------------------------------------------------------------------------*/ +#define NORMAL gen->gen_aux /* pointer to normal variate generator */ +/*---------------------------------------------------------------------------*/ + +inline static int +gamma_gd_init( struct unur_gen *gen ) + /* CASE alpha >= 1: Acceptance complement algorithm gd */ +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + + /* -X- setup code -X- */ + /* Step 1. Preparations */ + ss = alpha - 0.5; + s = sqrt(ss); + d = 5.656854249 - 12. * s; + + /* Step 4. Set-up for hat case */ + r = 1. / alpha; + q0 = ((((((((q9 * r + q8) * r + q7) * r + q6) * r + q5) * r + q4) * + r + q3) * r + q2) * r + q1) * r; + if (alpha > 3.686) { + if (alpha > 13.022) { + b = 1.77; + si = 0.75; + c = 0.1515 / s; + } + else { + b = 1.654 + 0.0076 * ss; + si = 1.68 / s + 0.275; + c = 0.062 / s + 0.024; + } + } + else { + b = 0.463 + s - 0.178 * ss; + si = 1.235; + c = 0.195 / s - 0.079 + 0.016 * s; + } + + /* make a normal variate generator (use default special generator) */ + if (NORMAL==NULL) { + struct unur_distr *distr = unur_distr_normal(NULL,0); + struct unur_par *par = unur_cstd_new( distr ); + NORMAL = (par) ? _unur_init(par) : NULL; + _unur_check_NULL( NULL, NORMAL, UNUR_ERR_NULL ); + /* need same uniform random number generator as slash generator */ + NORMAL->urng = gen->urng; + /* copy debugging flags */ + NORMAL->debug = gen->debug; + /* we do not need the distribution object any more */ + _unur_distr_free( distr ); + } + /* else we are in the re-init mode + --> there is no necessity to make the generator object again */ + + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of gamma_gd_init() */ + +double +_unur_stdgen_sample_gamma_gd( struct unur_gen *gen ) +{ + /* -X- generator code -X- */ + double U,X,E; + double q,sign_U,t,v,w,x; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + do { + + /* Step 2. Normal deviate */ + t = _unur_sample_cont(NORMAL); + x = s + 0.5 * t; + X = x * x; + if (t >= 0.) + break; /* Immediate acceptance */ + + /* Step 3. Uniform random number */ + U = uniform(); + if (d * U <= t * t * t) + break; /* Squeeze acceptance */ + + /* Step 5. Calculation of q */ + if (x > 0.) { + /* Step 6. */ + v = t / (s + s); + if (fabs(v) > 0.25) + q = q0 - s * t + 0.25 * t * t + (ss + ss) * log(1. + v); + else + q = q0 + 0.5 * t * t * ((((((((a9 * v + a8) * v + a7) * v + a6) * + v + a5) * v + a4) * v + a3) * v + a2) * v + a1) * v; + /* Step 7. Quotient acceptance */ + if (log(1. - U) <= q) + break; + } + + /* Step 8. Double exponential deviate t */ + while (1) { + do { + E = -log( uniform() ); + U = uniform(); + U = U + U - 1.; + sign_U = (U > 0) ? 1. : -1.; + t = b + (E * si) * sign_U; + } while (t <= -0.71874483771719); /* Step 9. Rejection of t */ + + /* Step 10. New q(t) */ + v = t / (s + s); + if (fabs(v) > 0.25) + q = q0 - s * t + 0.25 * t * t + (ss + ss) * log(1. + v); + else + q = q0 + 0.5 * t * t * ((((((((a9 * v + a8) * v + a7) * v + a6) * + v + a5) * v + a4) * v + a3) * v + a2) * v + a1) * v; + + /* Step 11. */ + if (q <= 0.) + continue; + + if (q > 0.5) + w = exp(q) - 1.; + else + w = ((((((e7 * q + e6) * q + e5) * q + e4) * q + e3) * q + e2) * + q + e1) * q; + + /* Step 12. Hat acceptance */ + if ( c * U * sign_U <= w * exp(E - 0.5 * t * t)) { + x = s + 0.5 * t; + X = x * x; + break; + } + } + + } while (0); + + /* -X- end of generator code -X- */ + + return ((DISTR.n_params==1) ? X : gamma + beta * X ); + +} /* end of _unur_stdgen_sample_gamma_gd() */ + +/*---------------------------------------------------------------------------*/ +#undef GEN_N_PARAMS +#undef ss +#undef s +#undef d +#undef r +#undef q0 +#undef b +#undef c +#undef si + +#undef q1 +#undef q2 +#undef q3 +#undef q4 +#undef q5 +#undef q6 +#undef q7 +#undef q8 +#undef q9 +#undef a1 +#undef a2 +#undef a3 +#undef a4 +#undef a5 +#undef a6 +#undef a7 +#undef a8 +#undef a9 +#undef e1 +#undef e2 +#undef e3 +#undef e4 +#undef e5 +#undef e6 +#undef e7 +/*---------------------------------------------------------------------------*/ +#undef NORMAL +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_ghyp.c b/vendor/unuran-1.11.0/src/distributions/c_ghyp.c new file mode 100644 index 0000000..15f8504 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_ghyp.c @@ -0,0 +1,384 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_ghyp.c * + * * + * REFERENCES: * + * * + ***************************************************************************** + * * + * distr: Generalized hyperbolic distribution * + * * + * pdf: f(x) = (delta^2+(x-mu)^2)^(1/2*(lambda-1/2)) * exp(beta*(x-mu)) * + * * K_{lambda-1/2}(alpha*sqrt(delta^2+(x-mu)^2)) * + * * + * domain: infinity < x < infinity * + * * + * constant: ( (gamma/delta)^lambda ) * + * / ( sqrt(2*pi) * alpha^(lambda-1/2) * K_{lambda}(delta*gamma) ) + * * + * [gamma = sqrt(alpha^2 - beta^2) ] * + * [K_theta(.) ... modified Bessel function of second kind] * + * * + * parameters: 4 * + * 0 : lambda ... shape * + * 1 : alpha >|beta| ... shape * + * 2 : beta ... shape (asymmetry) * + * 3 : delta > 0 ... scale * + * 4 : mu ... location * + * * + ***************************************************************************** + * * + * We use the Rmath library for computing the Bessel function K_n. * + * * + ***************************************************************************** + * * + * Copyright (c) 2009-2012 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "ghyp"; + +/* parameters */ +#define lambda params[0] /* shape */ +#define alpha params[1] /* shape */ +#define beta params[2] /* shape (asymmetry) */ +#define delta params[3] /* scale */ +#define mu params[4] /* location */ + +#define DISTR distr->data.cont +#define LOGNORMCONSTANT (distr->data.cont.norm_constant) + +/* function prototypes */ +#ifdef _unur_SF_bessel_k +static double _unur_pdf_ghyp( double x, const UNUR_DISTR *distr ); +static double _unur_logpdf_ghyp( double x, const UNUR_DISTR *distr ); +static double _unur_normconstant_ghyp( const double *params, int n_params ); +/* static double _unur_dpdf_ghyp( double x, const UNUR_DISTR *distr ); */ +/* static double _unur_cdf_ghyp( double x, const UNUR_DISTR *distr ); */ +#endif + +static int _unur_upd_center_ghyp( UNUR_DISTR *distr ); +static int _unur_set_params_ghyp( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +#ifdef _unur_SF_bessel_k +double +_unur_pdf_ghyp(double x, const UNUR_DISTR *distr) +{ + /* f(x) = (delta^2+(x-mu)^2)^(1/2*(lambda-1/2)) * exp(beta*(x-mu)) */ + /* * K_{lambda-1/2}(alpha*sqrt(delta^2+(x-mu)^2)) */ + + return exp(_unur_logpdf_ghyp(x,distr)); +} /* end of _unur_pdf_ghyp() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_ghyp(double x, const UNUR_DISTR *distr) +{ + /* f(x) = (delta^2+(x-mu)^2)^(1/2*(lambda-1/2)) * exp(beta*(x-mu)) */ + /* * K_{lambda-1/2}(alpha*sqrt(delta^2+(x-mu)^2)) */ + + register const double *params = DISTR.params; + double res = 0.; /* result of computation */ + double nu = lambda - 0.5; /* order of modified Bessel function K() */ + double y; /* auxiliary variable */ + + y = sqrt(delta*delta + (x-mu)*(x-mu)); + + /* Using nu and y we find: + * f(x) = y^nu * exp(beta*(x-mu) * K_nu(alpha*y) + * and + * log(f(x)) = nu*log(y) + beta*(x-mu) + log(K_nu(alpha*y) + */ + + /* see also c_vg.c */ + + do { + + if (y>0.) { + /* first simply compute Bessel K_nu and compute logarithm. */ + double besk; + + /* we currently use two algorithms based on our experiences + * with the functions in the Rmath library. + * (Maybe we could change this when we link against + * other libraries.) + */ + if (nu < 100) + /* the "standard implementation" using log(bessel_k) */ + besk = _unur_SF_ln_bessel_k(alpha*y, nu); + else + /* an algorithm for large nu */ + besk = _unur_SF_bessel_k_nuasympt(alpha*y, nu, TRUE, FALSE); + + /* there can be numerical problems with the Bessel function K_nu. */ + if (_unur_isfinite(besk) && besk < MAXLOG - 20.0) { + /* o.k. */ + res = LOGNORMCONSTANT + besk + nu*log(y) + beta*(x-mu); + break; + } + } + + /* Case: numerical problems with Bessel function K_nu. */ + + if (y < 1.0) { + /* Case: Bessel function K_nu overflows for small values of y. + * The following code is inspired by gsl_sf_bessel_lnKnu_e() from + * the GSL (GNU Scientific Library). + */ + + res = LOGNORMCONSTANT + beta*(x-mu); + res += -M_LN2 + _unur_SF_ln_gamma(nu) + nu*log(2./alpha); + + if (nu > 1.0) { + double xi = 0.25*(alpha*y)*(alpha*y); + double sum = 1.0 - xi/(nu-1.0); + if(nu > 2.0) sum += (xi/(nu-1.0)) * (xi/(nu-2.0)); + res += log(sum); + } + } + + else { + /* Case: Bessel function K_nu underflows for very large values of y + * and we get NaN. + * However, then the PDF of the Generalized Hyperbolic distribution is 0. + */ + res = -UNUR_INFINITY; + } + } while(0); + + /* see also c_vg.c */ + + return res; + +} /* end of _unur_logpdf_ghyp() */ + + /* + Remark: a few references + + NIST Digital Library of Mathematical Functions + + http://dlmf.nist.gov/10.27.E3 + K_{-nu}(z) = K_nu(z) + + http://dlmf.nist.gov/10.32.E10 + K_nu(z) = 0.5*(0.5*z)^nu * \int_0^\infty exp(-t-z^2/(4*t)) * t^(-nu-1) dt + + This implies + K_nu(z) = K_{-nu}(z) + = 0.5*(0.5*z)^(-nu) * \int_0^\infty exp(-t-z^2/(4*t)) * t^(nu-1) dt + <= 0.5*(0.5*z)^(-nu) * \int_0^\infty exp(-t) * t^(nu-1) dt + = 0.5*(0.5*z)^(-nu) * Gamma(z) + + http://dlmf.nist.gov/10.30.E2 + K_nu(z) ~ 0.5*Gamma(nu)*(0.5*z)^(-nu) for z->0 + */ + +#endif + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_center_ghyp( UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + /* we simply use parameter 'mu' */ + DISTR.center = mu; + + /* an alternative approach would be the mean of the distribution: */ + /* double gamma = sqrt(alpha*alpha-beta*beta); */ + /* DISTR.center = ( mu */ + /* + ( delta*beta * bessel_k( delta*gamma, lambda+1, 1) ) */ + /* / ( gamma * bessel_k( delta*gamma, lambda, 1) ) ); */ + + /* center must be in domain */ + if (DISTR.center < DISTR.domain[0]) + DISTR.center = DISTR.domain[0]; + else if (DISTR.center > DISTR.domain[1]) + DISTR.center = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_center_ghyp() */ + +/*---------------------------------------------------------------------------*/ + +#ifdef _unur_SF_bessel_k +double +_unur_normconstant_ghyp(const double *params ATTRIBUTE__UNUSED, int n_params ATTRIBUTE__UNUSED) +{ + double gamm = sqrt(alpha*alpha-beta*beta); + + /* ( (gamm/delta)^lambda ) / ( sqrt(2*pi) * alpha^(lambda-1/2) * K_{lambda}(delta*gamm) ) */ + + double logconst = -0.5*(M_LNPI+M_LN2) + lambda * log(gamm/delta); + logconst -= (lambda-0.5) * log(alpha); + + if (lambda < 50) + /* threshold value 50 is selected by experiments */ + logconst -= _unur_SF_ln_bessel_k( delta*gamm, lambda ); + else + logconst -= _unur_SF_bessel_k_nuasympt( delta*gamm, lambda, TRUE, FALSE ); + + return logconst; +} /* end of _unur_normconstant_ghyp() */ +#endif + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_ghyp( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 5) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 5) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 5; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter omega */ + if (delta <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"delta <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + if (alpha <= fabs(beta)) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"alpha <= |beta|"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.lambda = lambda; + DISTR.alpha = alpha; + DISTR.beta = beta; + DISTR.delta = delta; + DISTR.mu = mu; + + /* default parameters: none */ + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_ghyp() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_ghyp( const double *params, int n_params) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_GHYP; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = _unur_stdgen_ghyp_init; */ + + /* functions */ +#ifdef _unur_SF_bessel_k + DISTR.pdf = _unur_pdf_ghyp; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_ghyp; /* pointer to log-PDF */ +#endif + + /* indicate which parameters are set */ +#ifdef _unur_SF_bessel_k + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_CENTER | + UNUR_DISTR_SET_PDFAREA ); +#else + distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN ); +#endif + + /* set parameters for distribution */ + if (_unur_set_params_ghyp(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* normalization constant */ +#ifdef _unur_SF_bessel_k + LOGNORMCONSTANT = _unur_normconstant_ghyp(DISTR.params,DISTR.n_params); +#else + LOGNORMCONSTANT = 0.; +#endif + + /* we need the center of the distribution */ + if (_unur_upd_center_ghyp(distr)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* mode and area below p.d.f. */ + /* DISTR.mode = ? */ +#ifdef _unur_SF_bessel_k + DISTR.area = 1; +#endif + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_ghyp; + + /* function for updating derived parameters */ + /* DISTR.upd_mode = _unur_upd_mode_ghyp; /\* funct for computing mode *\/ */ + /* DISTR.upd_area = _unur_upd_area_ghyp; funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_ghyp() */ + +/*---------------------------------------------------------------------------*/ +#undef mu +#undef alpha +#undef beta +#undef delta +#undef lambda +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_gig.c b/vendor/unuran-1.11.0/src/distributions/c_gig.c new file mode 100644 index 0000000..5b97c05 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_gig.c @@ -0,0 +1,342 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_gig.c * + * * + * REFERENCES: * + * * + * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 1, 2nd edition * + * John Wiley & Sons, Inc., New York, 1994 * + * * + ***************************************************************************** + * * + * distr: Generalized Inverse Gaussian (GIG) distribution [2; ch.15, p.284] * + * * + * pdf: f(x) = x^(theta-1) * exp( -1/2 * omega * (x/eta + eta/x)) * + * domain: 0 < x < infinity * + * constant: 1 / (2 * eta^theta K_theta(omega)) * + * [K_theta(.) ... modified Bessel function of third kind] * + * K_theta(x) = 1/2 * int_-inf^inf cosh(theta*u) * exp(-x*cosh(u)) du * + * * + * inf * + * - * + * 1 | * + * K_theta(omega) = - | cosh(theta*u) * exp(-omega*cosh(u)) du * + * 2 | * + * - * + * -inf * + * * + * * + * parameters: 3 * + * 0: theta ... shape * + * 1: omega > 0 ... scale * + * 2: eta > 0 (1) ... shape * + * * + ***************************************************************************** + * * + * Reparametrization from "gig2": * + * omega = sqrt(psi*chi) * + * eta = sqrt(chi/psi) * + * * + ***************************************************************************** + * * + * Standard form: * + * * + * pdf: f(x) = x^(theta-1) * exp( -1/2 * omega * (x + 1/x)) * + * domain: 0 < x < infinity * + * constant: 2 * K_theta(omega) * + * * + * parameters: 2 * + * 0: theta ... shape * + * 1: omega > 0 ... scale * + * * + * 2: eta = 1 * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2012 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "gig"; + +/* parameters */ +#define theta params[0] /* shape */ +#define omega params[1] /* scale */ +#define eta params[2] /* shape */ + +#define DISTR distr->data.cont +#define LOGNORMCONSTANT (distr->data.cont.norm_constant) + +/* function prototypes */ +static double _unur_pdf_gig( double x, const UNUR_DISTR *distr ); +static double _unur_logpdf_gig( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_gig( double x, const UNUR_DISTR *distr ); +static double _unur_dlogpdf_gig( double x, const UNUR_DISTR *distr ); +/* static double _unur_cdf_gig( double x, const UNUR_DISTR *distr ); */ + +static int _unur_upd_mode_gig( UNUR_DISTR *distr ); +#ifdef _unur_SF_bessel_k +static double _unur_lognormconstant_gig( const double *params, int n_params ); +#endif +static int _unur_set_params_gig( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_gig(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (x <= 0.) + /* out of support */ + return 0.; + + return (exp( LOGNORMCONSTANT + (theta-1.) * log(x) - 0.5 * omega * (x/eta + eta/x) )); + +} /* end of _unur_pdf_gig() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_gig(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (x <= 0.) + /* out of support */ + return -UNUR_INFINITY; + + return ( LOGNORMCONSTANT + (theta-1.) * log(x) - 0.5 * omega * (x/eta + eta/x) ); + +} /* end of _unur_logpdf_gig() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_gig(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (x <= 0.) + /* out of support */ + return 0.; + + return ( exp( LOGNORMCONSTANT + (theta-3.) * log(x) - 0.5 * omega * (x/eta + eta/x) ) + * (eta*eta*omega + 2.*eta*(theta-1.)*x - omega*x*x) / (2*eta) ); + +} /* end of _unur_dpdf_gig() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dlogpdf_gig(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (x <= 0.) + /* out of support */ + return 0.; + + return ( -0.5*(omega*(1/eta - eta/(x*x))) + (theta-1.)/x ); + +} /* end of _unur_dlogpdf_gig() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_gig( UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (theta >= 1.) { + /* mode of PDF(x) */ + DISTR.mode = + eta * (sqrt(omega*omega + (theta-1.)*(theta-1.)) + (theta-1.))/omega; + } + else { + /* reciprocal of mode of PDF(1/x) */ + DISTR.mode = + eta * omega / (sqrt((1.-theta)*(1.-theta) + omega*omega)+(1.-theta)); + } + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_gig() */ + +/*---------------------------------------------------------------------------*/ + +#ifdef _unur_SF_bessel_k +double +_unur_lognormconstant_gig(const double *params, int n_params ATTRIBUTE__UNUSED) +{ + double logconst = -M_LN2 - theta*log(eta); + + if (theta < 50) + /* threshold value 50 is selected by experiments */ + logconst -= _unur_SF_ln_bessel_k(omega, theta); + else + logconst -= _unur_SF_bessel_k_nuasympt(omega, theta, TRUE, FALSE); + + return logconst; +} /* end of _unur_normconstant_gig() */ +#endif + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_gig( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 2) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 3) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 3; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter omega */ + if (omega <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"omega <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* check parameter eta */ + if (n_params == 3 && eta <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"eta <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + + /* copy parameters for standard form */ + DISTR.theta = theta; + DISTR.omega = omega; + + /* default parameters */ + DISTR.eta = 1.; + + /* copy optional parameters */ + if (n_params > 2) + DISTR.eta = eta; + n_params = 3; + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = 0.; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_gig() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_gig( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_GIG; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = _unur_stdgen_gig_init; + + /* functions */ + DISTR.pdf = _unur_pdf_gig; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_gig; /* pointer to logPDF */ + DISTR.dpdf = _unur_dpdf_gig; /* pointer to derivative of PDF */ + DISTR.dlogpdf = _unur_dlogpdf_gig; /* pointer to derivative of logPDF */ + DISTR.cdf = NULL; /* _unur_cdf_gig; pointer to CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | +#ifdef _unur_SF_bessel_k + UNUR_DISTR_SET_PDFAREA | +#endif + UNUR_DISTR_SET_MODE ); + + /* set parameters for distribution */ + if (_unur_set_params_gig(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* log of normalization constant */ +#ifdef _unur_SF_bessel_k + LOGNORMCONSTANT = _unur_lognormconstant_gig(DISTR.params,DISTR.n_params); +#else + LOGNORMCONSTANT = 0.; +#endif + + /* mode and area below p.d.f. */ + _unur_upd_mode_gig(distr); +#ifdef _unur_SF_bessel_k + DISTR.area = 1.; +#endif + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_gig; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_gig; /* funct for computing mode */ + /* DISTR.upd_area = _unur_upd_area_gig; funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_gig() */ + +/*---------------------------------------------------------------------------*/ +#undef theta +#undef omega +#undef eta +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_gig2.c b/vendor/unuran-1.11.0/src/distributions/c_gig2.c new file mode 100644 index 0000000..caba059 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_gig2.c @@ -0,0 +1,375 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_gig2.c * + * * + * REFERENCES: * + * * + * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 1, 2nd edition * + * John Wiley & Sons, Inc., New York, 1994 * + * * + ***************************************************************************** + * * + * distr: Generalized Inverse Gaussian (GIG) distribution [2; ch.15, p.284] * + * * + * Alternative parametrization. * + * * + * pdf: f(x) = x^(theta-1) * exp( -1/2 * (chi/x + psi*x)) * + * domain: 0 < x < infinity * + * constant: (psi/chi)^(theta/2) / (2*K_theta(sqrt(psi*chi))) * + * [K_theta(.) ... modified Bessel function of third kind] * + * K_theta(x) = 1/2 * int_-inf^inf cosh(theta*u) * exp(-x*cosh(u)) du * + * * + * inf * + * - * + * 1 | * + * K_theta(omega) = - | cosh(theta*u) * exp(-omega*cosh(u)) du * + * 2 | * + * - * + * -inf * + * * + * * + * parameters: 3 * + * 0: theta ... shape * + * 1: psi > 0 ... shape * + * 2: chi > 0 ... shape * + * * + ***************************************************************************** + * * + * Reparametrization towards "gig": * + * omega = sqrt(psi*chi) * + * eta = sqrt(chi/psi) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2012 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +#ifdef USE_EXPERIMENTAL_CODE +#include +#endif + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "gig2"; + +/* parameters */ +#define theta params[0] /* shape */ +#define psi params[1] /* shape */ +#define chi params[2] /* shape */ + +#define DISTR distr->data.cont +#define NORMCONSTANT (distr->data.cont.norm_constant) + +/* function prototypes */ +static double _unur_pdf_gig2( double x, const UNUR_DISTR *distr ); +static double _unur_logpdf_gig2( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_gig2( double x, const UNUR_DISTR *distr ); +static double _unur_dlogpdf_gig2( double x, const UNUR_DISTR *distr ); +#ifdef USE_EXPERIMENTAL_CODE +static double _unur_cdf_gig2( double x, const UNUR_DISTR *distr ); +#endif + +static int _unur_upd_mode_gig2( UNUR_DISTR *distr ); +static double _unur_normconstant_gig2( const double *params, int n_params ); +static int _unur_set_params_gig2( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_gig2(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (x <= 0.) + /* out of support */ + return 0.; + + return (NORMCONSTANT * exp( (theta-1.) * log(x) - 0.5 * (chi/x + psi*x) )); + +} /* end of _unur_pdf_gig2() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_gig2(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (x <= 0.) + /* out of support */ + return -UNUR_INFINITY; + + return ( (theta-1.) * log(x) - 0.5 * (chi/x + psi*x) + log(NORMCONSTANT) ); + +} /* end of _unur_logpdf_gig2() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_gig2(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (x <= 0.) + /* out of support */ + return 0.; + + return ( NORMCONSTANT * 0.5 * exp( (theta-3.) * log(x) - (chi + psi*x*x)/(2*x) ) + * (chi - x*(2 - 2*theta + psi*x)) ); + +} /* end of _unur_dpdf_gig2() */ + + +/*---------------------------------------------------------------------------*/ + +double +_unur_dlogpdf_gig2(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if (x <= 0.) + /* out of support */ + return 0.; + + return ( -0.5*(psi - chi/(x*x)) + (theta-1.)/x + log(NORMCONSTANT) ) ; + +} /* end of _unur_dlogpdf_gig2() */ + +/*---------------------------------------------------------------------------*/ + +#ifdef USE_EXPERIMENTAL_CODE + +#ifndef _unur_SF_bessel_k +#error run ./configure with flag --with-Rmath +#endif + +double +_unur_cdf_gig2(double x, const UNUR_DISTR *distr) +{ + double epsabs = 1.e-13; + double epsrel = 1.e-13; + double result, abserr; + size_t limit = 1000; + gsl_integration_workspace *work; + + if (x <= 0.) + /* out of support */ + return 0.; + + /* use GSL function */ + work = gsl_integration_workspace_alloc (limit); + gsl_function F; + F.function = _unur_pdf_gig2; + F.params = distr; + + gsl_integration_qag (&F, 0, x, epsabs, epsrel, limit, /* key = */ GSL_INTEG_GAUSS61, + work, &result, &abserr); + + /* The integration rule is determined by the value of 'key', + * which should be chosen from the following symbolic names, + * + * GSL_INTEG_GAUSS15 (key = 1) + * GSL_INTEG_GAUSS21 (key = 2) + * GSL_INTEG_GAUSS31 (key = 3) + * GSL_INTEG_GAUSS41 (key = 4) + * GSL_INTEG_GAUSS51 (key = 5) + * GSL_INTEG_GAUSS61 (key = 6) + */ + + gsl_integration_workspace_free (work); + + return result; + +} /* end of _unur_cdf_gig2() */ + +#endif + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_gig2( UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (theta >= 1.) { + /* Use mode of pdf(x) */ + DISTR.mode = + ((theta-1.)+sqrt((theta-1.)*(theta-1.) + psi*chi)) / psi; + } + else { /* theta < 1. */ + /* Use reciprocal of mode of pdf(1/x) */ + DISTR.mode = chi / + ((1.-theta)+sqrt((1.-theta)*(1.-theta) + psi*chi)); + } + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_gig2() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_normconstant_gig2(const double *params ATTRIBUTE__UNUSED, int n_params ATTRIBUTE__UNUSED) +{ +#ifdef _unur_SF_bessel_k + + /* + * constant: (psi/chi)^(theta/2) / (2*K_theta(sqrt(psi*chi))) + */ + + return ( pow(psi/chi, theta/2.) / (2. * _unur_SF_bessel_k(sqrt(psi*chi),theta)) ); +#else + return 1.; +#endif +} /* end of _unur_normconstant_gig2() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_gig2( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 3) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); + return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 3) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 3; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter omega */ + if (psi <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"psi <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* check parameter eta */ + if (chi <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"chi <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + + /* copy parameters for standard form */ + DISTR.theta = theta; + DISTR.psi = psi; + DISTR.chi = chi; + + /* default parameters: none */ + + /* copy optional parameters: none */ + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = 0.; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_gig2() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_gig2( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_GIG2; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = _unur_stdgen_gig2_init; */ + + /* functions */ + DISTR.pdf = _unur_pdf_gig2; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_gig2; /* pointer to logPDF */ + DISTR.dpdf = _unur_dpdf_gig2; /* pointer to derivative of PDF */ + DISTR.dlogpdf = _unur_dlogpdf_gig2; /* pointer to derivative of logPDF */ +#ifdef USE_EXPERIMENTAL_CODE + DISTR.cdf = _unur_cdf_gig2; /* pointer to CDF */ +#endif + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MODE ); + /* UNUR_DISTR_SET_PDFAREA ); */ + + /* set parameters for distribution */ + if (_unur_set_params_gig2(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* normalization constant */ + NORMCONSTANT = _unur_normconstant_gig2(DISTR.params,DISTR.n_params); + + /* mode and area below p.d.f. */ + _unur_upd_mode_gig2(distr); + /* DISTR.area = ? */ + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_gig2; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_gig2; /* funct for computing mode */ + /* DISTR.upd_area = _unur_upd_area_gig2; funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_gig2() */ + +/*---------------------------------------------------------------------------*/ +#undef theta +#undef psi +#undef chi +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_gig_gen.c b/vendor/unuran-1.11.0/src/distributions/c_gig_gen.c new file mode 100644 index 0000000..ef3f6b6 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_gig_gen.c @@ -0,0 +1,287 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_gig_gen.c * + * * + * Special generators for GIG distribution * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions_source.h" + +/*---------------------------------------------------------------------------*/ +/* init routines for special generators */ + +inline static int gig_gigru_init( struct unur_gen *gen ); + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ + +/* #define MAX_gen_params (10) maximal number of parameters for generator */ + +#define theta (DISTR.params[0]) /* shape */ +#define omega (DISTR.params[1]) /* scale */ +#define eta (DISTR.params[2]) /* shape */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Inititialize **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_gig_init( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize special generator for gig distribution */ + /* if gen == NULL then only check existance of variant. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* one of par and gen must not be the NULL pointer */ + switch ((par) ? par->variant : gen->variant) { + + case 0: /* DEFAULT */ + case 1: /* Ratio of Uniforms */ + if (par!=NULL && par->distr->data.cont.params[0] <= 0.) { /* theta <= 0 */ + _unur_error(NULL,UNUR_ERR_GEN_CONDITION,""); + return UNUR_ERR_GEN_CONDITION; + } + /* theta > 0 ! */ + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_gig_gigru ); + return gig_gigru_init( gen ); + + default: /* no such generator */ + return UNUR_FAILURE; + } + +} /* end of _unur_stdgen_gig_init() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Special generators **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Generalized Inverse Gaussian (GIG) Distribution: Ratio of Uniforms * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from the reparameterized * + * Generalized Inverse Gaussian distribution with parameters * + * theta > 0 and omega > 0 using Ratio of Uniforms method * + * without shift for theta <= 1 and omega <= 1 and shift at * + * mode m otherwise. * + * * + * REFERENCE: - J.S. Dagpunar (1989): An easily implemented generalized * + * inverse Gaussian generator, * + * Commun. Statist. Simul. 18(2), 703-710. * + * * + * Implemented by R. Kremer, 1990 * + * Revised by F. Niederl, August 1992 * + ***************************************************************************** + * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#define GEN_N_PARAMS (10) +#define m (GEN->gen_param[0]) +#define linvmax (GEN->gen_param[1]) +#define vminus (GEN->gen_param[2]) +#define vdiff (GEN->gen_param[3]) +#define b2 (GEN->gen_param[4]) +#define hm12 (GEN->gen_param[5]) +#define a (GEN->gen_param[6]) +#define d (GEN->gen_param[7]) +#define e (GEN->gen_param[8]) +#define c (GEN->gen_param[9]) +/*---------------------------------------------------------------------------*/ +static const double drittel = 0.3333333333333333; /* 1/3 */ +static const double pdrittel = 0.037037037037037; /* 1/27 */ +/*---------------------------------------------------------------------------*/ + +inline static int +gig_gigru_init( struct unur_gen *gen ) +{ + double r,s,t,p,q,xeta,fi,fak,yy1,yy2,max,invy1,invy2,vplus,hm1,xm,ym; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + + /* -X- setup code -X- */ + if (theta <= 0) { + _unur_error(NULL,UNUR_ERR_GEN_CONDITION,""); + return UNUR_ERR_GEN_CONDITION; + } + + if (theta<=1. && omega<=1.) { + /* NO SHIFT m */ + e = omega * omega; + + d = theta + 1.; + ym = (-d + sqrt(d*d + e))/omega; + + d = theta - 1.; + xm = (d + sqrt(d*d + e))/omega; + + d = 0.5 * d; + e = -0.25 * omega; + r = xm + 1./xm; + s = xm*ym; + /* a = vplus/uplus */ + a = exp(-0.5*theta*log(s) + 0.5*log(xm/ym) - e*(r - ym - 1.0/ym)); + /* c = 1/log{sqrt[hx(xm)]} */ + c = -d * log(xm) - e * r; + /* vminus = 0 */ + + /* initialize remaining (unused) variables */ + hm12 = b2 = vdiff = vminus = linvmax = m = 0.; + } + else { + /* SHIFT BY m */ + hm1 = theta - 1.; + hm12 = hm1 * 0.5; + b2 = omega * 0.25; + m = (hm1 + sqrt(hm1*hm1 + omega*omega))/omega; /* Modus */ + max = exp(hm12 * log(m) - b2 * (m + (1./m))); /* sqrt[hx(m)] */ + linvmax = log(1.0/max); + + /* Find the points x1,x2 (-->invy1,invy2) where + the hat function touches the density f(x) */ + r = (6.*m + 2.*theta*m - omega*m*m + omega)/(4.*m*m); + s = (1. + theta - omega*m)/(2.*m*m); + t = omega/(-4.*m*m); + p = (3.*s - r*r) * drittel; + q = (2.*r*r*r) * pdrittel - (r*s) * drittel + t; + xeta = sqrt(-(p*p*p)*pdrittel); + fi = acos(-q/(2.*xeta)); + fak = 2.*exp(log(xeta)*drittel); + yy1 = fak * cos(fi*drittel) - r*drittel; + yy2 = fak * cos(fi*drittel + 2.*drittel*M_PI) - r*drittel; + invy1 = 1./yy1; + invy2 = 1./yy2; + + vplus = exp(linvmax + log(invy1) + hm12*log(invy1 + m) + - b2*(invy1 + m + 1./(invy1 + m))); + vminus = -exp(linvmax + log(-invy2) + hm12 * log(invy2 + m) + - b2*(invy2 + m + 1./(invy2 + m))); + vdiff = vplus - vminus; + /* uplus = 1 */ + + /* initialize remaining (unused) variables */ + c = e = d = a = 0.; + } + + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of gig_gigru_init() */ + +double +_unur_stdgen_sample_gig_gigru( struct unur_gen *gen ) +{ + double U,V,X,Z; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + /* -X- generator code -X- */ + if (theta<=1. && omega<=1.) { + /* NO SHIFT m */ + do { + U = uniform(); /* U(0,1) */ + V = uniform(); /* U(0,1) */ + X = a*(V/U); + } /* Acceptance/Rejection */ + while (((log(U)) > (d*log(X) + e*(X + 1./X) + c))); + } + else { + /* SHIFT BY m */ + do { + do { + U = uniform(); /* U(0,1) */ + V = vminus + uniform() * vdiff; /* U(v-,v+) */ + Z = V/U; + } while (Z < (-m)); + X = Z + m; + } /* Acceptance/Rejection */ + while ((log(U) > (linvmax + hm12 * log(X) - b2 * (X + 1./X)))); + } + + /* -X- end of generator code -X- */ + + return ((DISTR.n_params==2) ? X : eta * X ); + +} /* end of _unur_stdgen_sample_gig_gigru() */ + +/*---------------------------------------------------------------------------*/ +#undef GEN_N_PARAMS +#undef m +#undef linvmax +#undef vminus +#undef vdiff +#undef b2 +#undef hm12 +#undef a +#undef d +#undef e +#undef c +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_hyperbolic.c b/vendor/unuran-1.11.0/src/distributions/c_hyperbolic.c new file mode 100644 index 0000000..f18839c --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_hyperbolic.c @@ -0,0 +1,266 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_hyperbolic.c * + * * + * REFERENCES: * + * * + ***************************************************************************** + * * + * distr: Hyperbolic distribution * + * * + * pdf: f(x) = exp( -alpha * sqrt(delta^2 + (x - mu)^2) + beta*(x-mu) ) * + * domain: infinity < x < infinity * + * constant: gamma / (2 * alpha * delta * K_1(delta * gamma) * + * [gamma = sqrt(alpha^2 - beta^2) ] * + * [K_theta(.) ... modified Bessel function of second (third) kind] * + * * + * parameters: 4 * + * 0 : alpha >|beta| ... shape (tail) * + * 1 : beta ... shape (asymmetry) * + * 2 : delta > 0 ... scale * + * 3 : mu ... location * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2012 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "hyperbolic"; + +/* parameters */ +#define alpha params[0] /* shape (tail) */ +#define beta params[1] /* shape (asymmetry) */ +#define delta params[2] /* scale */ +#define mu params[3] /* location */ + +#define DISTR distr->data.cont +#define NORMCONSTANT (distr->data.cont.norm_constant) + +/* function prototypes */ +static double _unur_pdf_hyperbolic( double x, const UNUR_DISTR *distr ); +static double _unur_logpdf_hyperbolic( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_hyperbolic( double x, const UNUR_DISTR *distr ); +static double _unur_dlogpdf_hyperbolic( double x, const UNUR_DISTR *distr ); +/* static double _unur_cdf_hyperbolic( double x, const UNUR_DISTR *distr ); */ + +static int _unur_upd_mode_hyperbolic( UNUR_DISTR *distr ); +static double _unur_normconstant_hyperbolic( const double *params, int n_params ); +static int _unur_set_params_hyperbolic( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_hyperbolic(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + return (NORMCONSTANT * exp(-alpha * sqrt(delta*delta + (x-mu)*(x-mu)) + beta*(x-mu) ) ); +} /* end of _unur_pdf_hyperbolic() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_hyperbolic(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + return (-alpha * sqrt(delta*delta + (x-mu)*(x-mu)) + beta*(x-mu) + log(NORMCONSTANT) ); +} /* end of _unur_logpdf_hyperbolic() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_hyperbolic(double x, const UNUR_DISTR *distr) +{ + return (NORMCONSTANT * _unur_pdf_hyperbolic(x,distr) * _unur_dlogpdf_hyperbolic(x,distr)); +} /* end of _unur_dpdf_hyperbolic() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dlogpdf_hyperbolic(double x, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + return (beta - (alpha*(x-mu))/sqrt(delta*delta + (x-mu)*(x-mu)) + log(NORMCONSTANT)); +} /* end of _unur_dlogpdf_hyperbolic() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_hyperbolic( UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + DISTR.mode = + mu + delta*beta / sqrt(alpha*alpha - beta*beta); + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_hyperbolic() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_normconstant_hyperbolic(const double *params ATTRIBUTE__UNUSED, int n_params ATTRIBUTE__UNUSED) +{ +#ifdef _unur_SF_bessel_k + double gamm = sqrt(alpha*alpha-beta*beta); + + /* + * constant: gamma / (2 * alpha * delta * K_1(delta * gamma) * + * [gamma = sqrt(alpha^2 - beta^2) ] * + * [K_theta(.) ... modified Bessel function of second kind] * + */ + + return ( gamm / ( 2 * alpha * delta * _unur_SF_bessel_k(delta*gamm, 1) ) ); +#else + return 1.; +#endif +} /* end of _unur_normconstant_hyperbolic() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_hyperbolic( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 4) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 4) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 4; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter omega */ + if (delta <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"delta <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + if (alpha <= fabs(beta)) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"alpha <= |beta|"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.mu = mu; + DISTR.alpha = alpha; + DISTR.beta = beta; + DISTR.delta = delta; + + /* default parameters: none */ + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_hyperbolic() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_hyperbolic( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_HYPERBOLIC; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = _unur_stdgen_hyperbolic_init; */ + + /* functions */ + DISTR.pdf = _unur_pdf_hyperbolic; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_hyperbolic; /* pointer to logPDF */ + DISTR.dpdf = _unur_dpdf_hyperbolic; /* pointer to derivative of PDF */ + DISTR.dlogpdf = _unur_dlogpdf_hyperbolic; /* pointer to derivative of logPDF */ + DISTR.cdf = NULL; /* _unur_cdf_hyperbolic; pointer to CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MODE ); + /* UNUR_DISTR_SET_PDFAREA ); */ + + /* set parameters for distribution */ + if (_unur_set_params_hyperbolic(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* normalization constant */ + NORMCONSTANT = _unur_normconstant_hyperbolic(DISTR.params,DISTR.n_params); + + /* mode and area below p.d.f. */ + _unur_upd_mode_hyperbolic(distr); + /* DISTR.area = ? */ + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_hyperbolic; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_hyperbolic; /* funct for computing mode */ + /* DISTR.upd_area = _unur_upd_area_hyperbolic; funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_hyperbolic() */ + +/*---------------------------------------------------------------------------*/ +#undef mu +#undef alpha +#undef beta +#undef delta +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_ig.c b/vendor/unuran-1.11.0/src/distributions/c_ig.c new file mode 100644 index 0000000..98141eb --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_ig.c @@ -0,0 +1,323 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_ig.c * + * * + * REFERENCES: * + * * + * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 1, 2nd edition * + * John Wiley & Sons, Inc., New York, 1994 * + * * + ***************************************************************************** + * * + * distr: Inverse Gaussian (Wald) distribution [2; ch.15, p.259] * + * * + * pdf: f(x) = sqrt( lambda/(2*pi*x^3) ) * + * * exp( -lambda*(x-mu)^2 / (2*mu^2*x) ) * + * domain: 0 < x < infinity * + * constant: 1 * + * * + * parameters: * + * 0: mu > 0 ... shape (mean) * + * 1: lambda > 0 ... shape * + * * + ***************************************************************************** + * * + * Copyright (c) 2009-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "ig"; + +/*---------------------------------------------------------------------------*/ +/* parameters */ +#define mu params[0] +#define lambda params[1] + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cont +#define LOGNORMCONSTANT (distr->data.cont.norm_constant) + +/*---------------------------------------------------------------------------*/ +/* function prototypes */ +static double _unur_pdf_ig( double x, const UNUR_DISTR *distr ); +static double _unur_logpdf_ig( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_ig( double x, const UNUR_DISTR *distr ); +static double _unur_dlogpdf_ig( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_ig( double x, const UNUR_DISTR *distr ); + +static int _unur_upd_mode_ig( UNUR_DISTR *distr ); +static int _unur_upd_area_ig( UNUR_DISTR *distr ); +static int _unur_set_params_ig( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_ig( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (x<=0.) + return 0.; + + else + return + ( sqrt(lambda/(2*M_PI*x*x*x)) * exp( -lambda*(x-mu)*(x-mu) / (2*mu*mu*x) ) ); +} /* end of _unur_pdf_ig() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_ig( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (x<0.) + return -UNUR_INFINITY; + + else + return ( 0.5* log ( lambda/(2*M_PI*x*x*x) ) + -lambda*(x-mu)*(x-mu) / (2*mu*mu*x) ); +} /* end of _unur_logpdf_ig() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_ig( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + double res; + + if (x<=0.) + return 0.; + + /* else */ + res = -exp( -lambda*(x-mu)*(x-mu) / (2*mu*mu*x) ); + res *= sqrt(lambda / (x*x*x)); + res *= (3*mu*mu*x + lambda*(-mu*mu + x*x)); + res /= 2*mu*mu*sqrt(2*M_PI)*x*x; + + return res; + +} /* end of _unur_dpdf_ig() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dlogpdf_ig( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (x<=0.) + return 0.; + + else + return + (0.5 * lambda*(-1./(mu*mu) + 1./(x*x)) - 3./x); + +} /* end of _unur_dlogpdf_ig() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_ig( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + +#define Phi(x) (_unur_SF_cdf_normal(x)) + + if (x<=0.) + return 0.; + + return + ( Phi(sqrt(lambda/x)*(x/mu-1.)) + + exp(2*lambda/mu) * Phi(-sqrt(lambda/x)*(x/mu+1.)) ); + +#undef Phi +} /* end of _unur_cdf_ig() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_ig( UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + DISTR.mode = + (-3.*mu*mu + mu*sqrt(4.*lambda*lambda + 9*mu*mu))/(2*lambda); + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_ig() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_ig( UNUR_DISTR *distr ) +{ + /* log of normalization constant */ + LOGNORMCONSTANT = 0.; + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_ig( DISTR.domain[1],distr) + - _unur_cdf_ig( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; +} /* end of _unur_upd_area_ig() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_ig( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + /* check new parameter for generator */ + if (n_params < 2) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 2) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 2; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter a */ + if (mu <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"mu <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + if (lambda <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"lambda <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.mu = mu; + DISTR.lambda = lambda; + + /* default parameters: none */ + /* copy optional parameters: none */ + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = 0.; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_ig() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Make distribution object **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_ig( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_IG; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = NULL; /* _unur_stdgen_ig_init */ + + /* functions */ + DISTR.pdf = _unur_pdf_ig; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_ig; /* pointer to logPDF */ + DISTR.dpdf = _unur_dpdf_ig; /* pointer to derivative of PDF */ + DISTR.dlogpdf = _unur_dlogpdf_ig; /* pointer to derivative of logPDF */ + DISTR.cdf = _unur_cdf_ig; /* pointer to CDF */ + /* DISTR.invcdf = _unur_invcdf_ig; pointer to inverse CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MODE | + UNUR_DISTR_SET_PDFAREA ); + + /* set parameters for distribution */ + if (_unur_set_params_ig(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* log of normalization constant */ + LOGNORMCONSTANT = 0; + + /* mode and area below p.d.f. */ + _unur_upd_mode_ig(distr); + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_ig; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_ig; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_ig; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_ig() */ + +/*---------------------------------------------------------------------------*/ +#undef mu +#undef lambda +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_laplace.c b/vendor/unuran-1.11.0/src/distributions/c_laplace.c new file mode 100644 index 0000000..54fcf42 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_laplace.c @@ -0,0 +1,317 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_laplace.c * + * * + * REFERENCES: * + * * + * [3] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 2, 2nd edition * + * John Wiley & Sons, Inc., New York, 1995 * + * * + ***************************************************************************** + * * + * Laplace distribution [3; ch.24, p.164] * + * * + * pdf: f(x) = exp(- abs(x-theta) / phi ) * + * domain: -infinity < x < infinity * + * constant: 1 / (2 * phi) * + * * + * parameters: * + * 0: theta ... location * + * 1: phi > 0 ... scale * + * * + ***************************************************************************** + * * + * standard form * + * * + * pdf: f(x) = exp(- abs(x)) * + * domain: -infinity < x < infinity * + * constant: 2 * + * * + * parameters: none * + * * + * 0: theta = 0 ... location * + * 1: phi = 1 ... scale * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ +static const char distr_name[] = "laplace"; + +/* parameters */ +#define theta params[0] +#define phi params[1] + +#define DISTR distr->data.cont +/* #define NORMCONSTANT (distr->data.cont.norm_constant) */ + +/* function prototypes */ +static double _unur_pdf_laplace( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_laplace( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_laplace( double x, const UNUR_DISTR *distr ); +static double _unur_invcdf_laplace( double u, const UNUR_DISTR *distr ); +static double _unur_logpdf_laplace( double x, const UNUR_DISTR *distr ); +static double _unur_dlogpdf_laplace( double x, const UNUR_DISTR *distr ); + +static int _unur_upd_mode_laplace( UNUR_DISTR *distr ); +static int _unur_upd_area_laplace( UNUR_DISTR *distr ); +static int _unur_set_params_laplace( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_laplace( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (xtheta) ? (x-theta)/phi : (theta-x)/phi; + + if (_unur_iszero(z)) /* derivative is not defined, but ... */ + return 0.; /* a tangent parallel to x-axis is possible. */ + + return ( ((x>theta) ? -exp(-z)/phi : exp(-z)/phi) / (2.*phi) ); +} /* end of unur_dpdf_laplace() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dlogpdf_laplace( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + return ( (xtheta) ? 1.-0.5 * exp(-z) : 0.5*exp(z) ); +} /* end of _unur_cdf_laplace() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_invcdf_laplace( double U, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + double X; + + U *= 2.; + X = (U>1.) ? -log(2.-U) : log(U); + return ((DISTR.n_params==0) ? X : theta + phi * X ); +} /* end of _unur_invcdf_laplace() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_laplace( UNUR_DISTR *distr ) +{ + DISTR.mode = DISTR.theta; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_laplace() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_laplace( UNUR_DISTR *distr ) +{ + /* normalization constant: none */ + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_laplace( DISTR.domain[1],distr) + - _unur_cdf_laplace( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; + +} /* end of _unur_upd_area_laplace() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_laplace( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 0) n_params = 0; + if (n_params > 2) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 2; } + if (n_params > 0) + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter phi */ + if (n_params == 2 && phi <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"phi <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form: none */ + + /* default parameters */ + DISTR.theta = 0.; + DISTR.phi = 1.; + + /* copy optional parameters */ + switch (n_params) { + case 2: + DISTR.phi = phi; + /* FALLTHROUGH */ + case 1: + DISTR.theta = theta; + /* FALLTHROUGH */ + default: + n_params = 2; /* number of parameters for non-standard form */ + } + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_laplace() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_laplace( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_LAPLACE; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = _unur_stdgen_laplace_init; */ + + /* functions */ + DISTR.pdf = _unur_pdf_laplace; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_laplace; /* pointer to logPDF */ + DISTR.dpdf = _unur_dpdf_laplace; /* pointer to derivative of PDF */ + DISTR.dlogpdf = _unur_dlogpdf_laplace; /* pointer to deriv. of logPDF */ + DISTR.cdf = _unur_cdf_laplace; /* pointer to CDF */ + DISTR.invcdf = _unur_invcdf_laplace; /* pointer to inverse CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_PDFAREA | + UNUR_DISTR_SET_MODE ); + + /* set parameters for distribution */ + if (_unur_set_params_laplace(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* normalization constant: none */ + + /* mode and area below p.d.f. */ + DISTR.mode = DISTR.theta; + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_laplace; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_laplace; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_laplace; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_laplace() */ + +/*---------------------------------------------------------------------------*/ +#undef theta +#undef phi +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_logistic.c b/vendor/unuran-1.11.0/src/distributions/c_logistic.c new file mode 100644 index 0000000..07daaa4 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_logistic.c @@ -0,0 +1,315 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_logistic.c * + * * + * REFERENCES: * + * * + * [3] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 2, 2nd edition * + * John Wiley & Sons, Inc., New York, 1995 * + * * + ***************************************************************************** + * * + * distr: Logistic distribution [3; ch.23, p.115] * + * * + * pdf: f(x) = exp(-(x-alpha)/beta) * (1 + exp(-(x-alpha)/beta))^(-2) * + * cdf: F(x) = (1 + exp(-(x-alpha)/beta))^(-1) * + * domain: infinity < x < infinity * + * constant: 1 / beta * + * * + * parameters: 2 * + * 0: alpha (0) ... location * + * 1: beta > 0 (1) ... scale * + * * + ***************************************************************************** + * * + * standard form * + * * + * pdf: f(x) = exp(-x) * (1 + exp(-x))^(-2) * + * cdf: F(x) = (1 + exp(-x))^(-1) * + * domain: infinity < x < infinity * + * constant: 1 * + * * + * parameters: none * + * * + * 0: alpha = 0 * + * 1: beta = 1 * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ +static const char distr_name[] = "logistic"; + +/* parameters */ +#define alpha params[0] +#define beta params[1] + +#define DISTR distr->data.cont +#define NORMCONSTANT (distr->data.cont.norm_constant) + +/* function prototypes */ +static double _unur_pdf_logistic( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_logistic( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_logistic( double x, const UNUR_DISTR *distr ); +static double _unur_invcdf_logistic( double u, const UNUR_DISTR *distr ); + +static int _unur_upd_mode_logistic( UNUR_DISTR *distr ); +static int _unur_upd_area_logistic( UNUR_DISTR *distr ); +static int _unur_set_params_logistic( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_logistic( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + register double ex; + + if (DISTR.n_params > 0) + /* standardize */ + x = (x - alpha) / beta; + + /* standard form */ + + ex = exp( -fabs(x) ); + + return (NORMCONSTANT * ex / ((1. + ex) * (1. + ex))); + +} /* end of _unur_pdf_logistic() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_logistic( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + register double factor = 1.; + register double ex; + + if (DISTR.n_params > 0) { + /* standardize */ + factor = 1. / beta; + x = (x - alpha) / beta; + } + + /* standard form */ + + ex = exp(-fabs(x)); + if (x<0) + factor = -factor; + + return (factor * NORMCONSTANT * ex * (ex - 1.) / ((1.+ex)*(1.+ex)*(1.+ex))); + +} /* end of unur_dpdf_logistic() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_logistic( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 0) + /* standardize */ + x = (x - alpha) / beta; + + /* standard form */ + + return ( 1. / (1. + exp(-x)) ); + +} /* end of _unur_cdf_logistic() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_invcdf_logistic( double U, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + double X; + + X = -log(1./U - 1.); + return ((DISTR.n_params==0) ? X : alpha + beta * X ); +} /* end of _unur_invcdf_logistic() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_logistic( UNUR_DISTR *distr ) +{ + DISTR.mode = DISTR.alpha; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_logistic() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_logistic( UNUR_DISTR *distr ) +{ + /* normalization constant */ + NORMCONSTANT = 1. / DISTR.beta; + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_logistic( DISTR.domain[1],distr) + - _unur_cdf_logistic( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; + +} /* end of _unur_upd_area_logistic() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_logistic( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 0) n_params = 0; + if (n_params > 2) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 2; } + if (n_params > 0) + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter sigma */ + if (n_params > 1 && beta <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"beta <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form: none */ + + /* default parameters */ + DISTR.alpha = 0.; + DISTR.beta = 1.; + + /* copy optional parameters */ + /* copy parameters */ + switch (n_params) { + case 2: + DISTR.beta = beta; + /* FALLTHROUGH */ + case 1: + DISTR.alpha = alpha; + n_params = 2; /* number of parameters for non-standard form */ + /* FALLTHROUGH */ + default: + break; + } + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_logistic() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_logistic( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_LOGISTIC; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = _unur_stdgen_logistic_init; */ + + /* functions */ + DISTR.pdf = _unur_pdf_logistic; /* pointer to PDF */ + DISTR.dpdf = _unur_dpdf_logistic; /* pointer to derivative of PDF */ + DISTR.cdf = _unur_cdf_logistic; /* pointer to CDF */ + DISTR.invcdf = _unur_invcdf_logistic; /* pointer to inverse CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MODE | + UNUR_DISTR_SET_PDFAREA ); + + /* set parameters for distribution */ + if (_unur_set_params_logistic(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_logistic; + + /* normalization constant */ + NORMCONSTANT = 1. / DISTR.beta; + + /* mode and area below p.d.f. */ + DISTR.mode = DISTR.alpha; + DISTR.area = 1.; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_logistic; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_logistic; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_logistic() */ + +/*---------------------------------------------------------------------------*/ +#undef alpha +#undef beta +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_lognormal.c b/vendor/unuran-1.11.0/src/distributions/c_lognormal.c new file mode 100644 index 0000000..2ffafeb --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_lognormal.c @@ -0,0 +1,260 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_lognormal.c * + * * + * REFERENCES: * + * * + * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 1, 2nd edition * + * John Wiley & Sons, Inc., New York, 1994 * + * * + ***************************************************************************** + * * + * distr: Lognormal distribution [2; ch.14, p.207] * + * * + * pdf: f(x) = 1/(x-theta) * exp( -(log(x-theta)-zeta)^2/(2 sigma^2) )* + * domain: x > theta * + * constant: 1 / (sigma * sqrt(2*pi)) * + * * + * parameters: * + * 0: zeta * + * 1: sigma > 0 * + * 2: theta ... location * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ +static const char distr_name[] = "lognormal"; + +/* parameters */ +#define zeta params[0] +#define sigma params[1] +#define theta params[2] + +#define DISTR distr->data.cont +#define NORMCONSTANT (distr->data.cont.norm_constant) + +/* function prototypes */ +static double _unur_pdf_lognormal( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_lognormal( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_lognormal( double x, const UNUR_DISTR *distr ); +static double _unur_invcdf_lognormal( double x, const UNUR_DISTR *distr ); + +static int _unur_upd_mode_lognormal( UNUR_DISTR *distr ); +static int _unur_set_params_lognormal( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_lognormal( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + register double z; + + if (x <= theta) + return 0.; + + z = log(x-theta)-zeta; + return ( 1./(x-theta) * exp( -z*z/(2.*sigma*sigma) ) / NORMCONSTANT ); +} /* end of _unur_pdf_lognormal() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_lognormal( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + register double z, sigmasqu; + + if (x <= theta) + return 0.; + + z = log(x-theta)-zeta; + sigmasqu = sigma * sigma; + + return ( 1/((x-theta)*(x-theta)) * exp( -z*z/(2*sigmasqu) ) * (1.+z/sigmasqu) / NORMCONSTANT ); +} /* end of _unur_dpdf_lognormal() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_lognormal( double x, const UNUR_DISTR *distr ) +{ + const double *params = DISTR.params; + double z; + + if (x <= theta) + return 0.; + + z = (log(x-theta)-zeta) / sigma; + return _unur_SF_cdf_normal(z); +} /* end of _unur_cdf_lognormal() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_invcdf_lognormal( double x, const UNUR_DISTR *distr ) +{ + const double *params = DISTR.params; + + return (theta + exp( _unur_SF_invcdf_normal(x) * sigma + zeta)); +} /* end of _unur_invcdf_lognormal() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_lognormal( UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + DISTR.mode = + exp(-sigma*sigma) * ( exp(zeta) + theta*exp(sigma*sigma) ); + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_lognormal() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_lognormal( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 2) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 3) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 3; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter sigma */ + if (sigma <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"sigma <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.zeta = zeta; + DISTR.sigma = sigma; + + /* default parameters */ + DISTR.theta = 0.; /* default for theta */ + + /* copy optional parameters */ + if (n_params == 3) + DISTR.theta = theta; + + /* store total number of parameters */ + DISTR.n_params = 3; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = DISTR.theta; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_lognormal() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_lognormal( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_LOGNORMAL; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = _unur_stdgen_lognormal_init; */ + + /* functions */ + DISTR.pdf = _unur_pdf_lognormal; /* pointer to PDF */ + DISTR.dpdf = _unur_dpdf_lognormal; /* pointer to derivative of PDF */ + DISTR.cdf = _unur_cdf_lognormal; /* pointer to CDF */ + DISTR.invcdf = _unur_invcdf_lognormal; /* pointer to inverse CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MODE | + UNUR_DISTR_SET_PDFAREA ); + + + /* set parameters for distribution */ + if (_unur_set_params_lognormal(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* normalization constant */ + NORMCONSTANT = DISTR.sigma * sqrt(2.*M_PI); + + /* mode and area below p.d.f. */ + _unur_upd_mode_lognormal(distr); + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_lognormal; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_lognormal; /* funct for computing mode */ + /* DISTR.upd_area = _unur_upd_area_lognormal; funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_lognormal() */ + +/*---------------------------------------------------------------------------*/ +#undef zeta +#undef sigma +#undef theta +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_lomax.c b/vendor/unuran-1.11.0/src/distributions/c_lomax.c new file mode 100644 index 0000000..e5ac461 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_lomax.c @@ -0,0 +1,267 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_lomax.c * + * * + * REFERENCES: * + * * + * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 1, 2nd edition * + * John Wiley & Sons, Inc., New York, 1994 * + * * + ***************************************************************************** + * * + * distr: Lomax distribution (Pareto distr. of second kind) [2; ch.20, p.575]* + * * + * pdf: f(x) = (x+C)^(-(a+1)) * + * domain: x >= 0 * + * constant: a * C^a * + * * + * parameters: * + * 0: a > 0 ... shape * + * 1: C > 0 ... location * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ +static const char distr_name[] = "lomax"; + +/* parameters */ +#define a params[0] +#define C params[1] + +#define DISTR distr->data.cont +#define NORMCONSTANT (distr->data.cont.norm_constant) + +/* function prototypes */ +static double _unur_pdf_lomax( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_lomax( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_lomax( double x, const UNUR_DISTR *distr ); +static double _unur_invcdf_lomax( double u, const UNUR_DISTR *distr ); + +static int _unur_upd_mode_lomax( UNUR_DISTR *distr ); +static int _unur_upd_area_lomax( UNUR_DISTR *distr ); +static int _unur_set_params_lomax( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_lomax( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + if (x<0.) + return 0.; + /* else */ + return ( pow(x+C,-(a+1.)) * NORMCONSTANT ); + +/* return ( (x<0.) ? 0. : pow(x+C,-(a+1.)) * NORMCONSTANT ); */ +} /* end of _unur_pdf_lomax() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_lomax( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + return ( (x<0.) ? 0. : -(a+1.) * pow(x+C,-(a+2.)) * NORMCONSTANT ); +} /* end of _unur_dpdf_lomax() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_lomax( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + return ( (x<0.) ? 0. : 1. - pow((C/(x+C)),a) ); +} /* end of _unur_cdf_lomax() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_invcdf_lomax( double U, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + double X; + + X = C * ( pow(1-U, -1/a) - 1. ); + return X; +} /* end of _unur_invcdf_lomax() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_lomax( UNUR_DISTR *distr ) +{ + DISTR.mode = 0.; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_lomax() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_lomax( UNUR_DISTR *distr ) +{ + /* normalization constant */ + NORMCONSTANT = DISTR.a * pow(DISTR.C,DISTR.a); + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_lomax( DISTR.domain[1],distr) + - _unur_cdf_lomax( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; + +} /* end of _unur_upd_area_lomax() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_lomax( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 1) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 2) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 2; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter a */ + if (a <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"a <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* check parameter C */ + if (n_params > 1 && C <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"C <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.a = a; + + /* default parameters */ + DISTR.C = 1.; + + /* copy optional parameters */ + if (n_params == 2) + DISTR.C = C; + + /* store total number of parameters */ + DISTR.n_params = 2; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = 0; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_lomax() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_lomax( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_LOMAX; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = _unur_stdgen_lomax_init; */ + + /* functions */ + DISTR.pdf = _unur_pdf_lomax; /* pointer to PDF */ + DISTR.dpdf = _unur_dpdf_lomax; /* pointer to derivative of PDF */ + DISTR.cdf = _unur_cdf_lomax; /* pointer to CDF */ + DISTR.invcdf = _unur_invcdf_lomax; /* pointer to inverse CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MODE | + UNUR_DISTR_SET_PDFAREA ); + + /* set parameters for distribution */ + if (_unur_set_params_lomax(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* normalization constant */ + NORMCONSTANT = DISTR.a * pow(DISTR.C,DISTR.a); + + /* mode and area below p.d.f. */ + DISTR.mode = 0.; + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_lomax; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_lomax; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_lomax; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_lomax() */ + +/*---------------------------------------------------------------------------*/ +#undef a +#undef C +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_meixner.c b/vendor/unuran-1.11.0/src/distributions/c_meixner.c new file mode 100644 index 0000000..357552b --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_meixner.c @@ -0,0 +1,252 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_meixner.c * + * * + * REFERENCES: * + * * + ***************************************************************************** + * * + * distr: Meixner distribution * + * * + * pdf: f(x) = exp(beta*(x-mu)/alpha) * |Gamma(delta+ i*(x-mu)/alpha)|^2 * + * * + * domain: infinity < x < infinity * + * * + * constant: (2*cos(beta/2))^(2*delta) / (2*alpha*pi*Gamma(2*delta)) * + * * + * parameters: 4 * + * 0 : alpha > 0 ... scale * + * 1 : beta ... shape (asymmetry) in [-pi,pi] * + * 2 : delta >0 ... shape * + * 3 : mu ... location * + * * + ***************************************************************************** + * * + * Copyright (c) 2011-2012 Wolfgang Hoermann and Josef Leydold * + * Institute for Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "meixner"; + +/* parameters */ +#define alpha params[0] /* scale */ +#define beta params[1] /* shape (asymmetry) */ +#define delta params[2] /* shape */ +#define mu params[3] /* location */ + +#define DISTR distr->data.cont +#define LOGNORMCONSTANT (distr->data.cont.norm_constant) + +/* function prototypes */ +static double _unur_pdf_meixner( double x, const UNUR_DISTR *distr ); +static double _unur_logpdf_meixner( double x, const UNUR_DISTR *distr ); +/* static double _unur_dpdf_meixner( double x, const UNUR_DISTR *distr ); */ +/* static double _unur_cdf_meixner( double x, const UNUR_DISTR *distr ); */ + +static int _unur_upd_center_meixner( UNUR_DISTR *distr ); +static double _unur_lognormconstant_meixner( const double *params, int n_params ); +static int _unur_set_params_meixner( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_meixner(double x, const UNUR_DISTR *distr) +{ + /* Original implementation by Kemal Dingic */ + /* f(x) = exp(beta*(x-mu)/alpha) * |Gamma(delta+ i*(x-mu)/alpha)|^2 */ + + return exp(_unur_logpdf_meixner(x,distr)); +} /* end of _unur_pdf_meixner() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_meixner(double x, const UNUR_DISTR *distr) +{ + const double *params = DISTR.params; + double res; /* result of computation */ + double y; /* auxiliary variables */ + + y = (x-mu) / alpha; + res = LOGNORMCONSTANT + beta*y + 2*_unur_SF_Relcgamma(delta, y); + + return res; +} /* end of _unur_logpdf_meixner() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_center_meixner( UNUR_DISTR *distr ) +{ + const double *params = DISTR.params; + + /* we simply use parameter 'mu' */ + DISTR.center = mu; + + /* an alternative approach would be the mean of the distribution: */ + /* DISTR.center = mu + alpha*delta*tan(beta/2); */ + + /* center must be in domain */ + if (DISTR.center < DISTR.domain[0]) + DISTR.center = DISTR.domain[0]; + else if (DISTR.center > DISTR.domain[1]) + DISTR.center = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_center_meixner() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_lognormconstant_meixner(const double *params, int n_params ATTRIBUTE__UNUSED) +{ + /* + (2*cos(beta/2))^(2*delta) / (2*alpha*pi*Gamma(2*delta)) + */ + + return ( 2.*delta*log(2.*cos(beta/2.)) + - (log(2.*alpha*M_PI) + _unur_SF_ln_gamma(2.*delta))); +} /* end of _unur_normconstant_meixner() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_meixner( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 4) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 4) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 4; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter omega */ + if (alpha <= 0. || delta <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"alpha or delta <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + if (fabs(beta) >= M_PI) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"beta not in (-PI,PI)"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.alpha = alpha; + DISTR.beta = beta; + DISTR.delta = delta; + DISTR.mu = mu; + + /* default parameters: none */ + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_meixner() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_meixner( const double *params, int n_params) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_MEIXNER; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = _unur_stdgen_meixner_init; */ + + /* functions */ + DISTR.pdf = _unur_pdf_meixner; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_meixner; /* pointer to logPDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_CENTER | + UNUR_DISTR_SET_PDFAREA ); + + /* set parameters for distribution */ + if (_unur_set_params_meixner(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* normalization constant */ + LOGNORMCONSTANT = _unur_lognormconstant_meixner(DISTR.params,DISTR.n_params); + + /* we need the center of the distribution */ + if (_unur_upd_center_meixner(distr)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* mode and area below p.d.f. */ + /* DISTR.mode = ? */ + DISTR.area = 1; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_meixner; + + /* function for updating derived parameters */ + /* DISTR.upd_mode = _unur_upd_mode_meixner; /\* funct for computing mode *\/ */ + /* DISTR.upd_area = _unur_upd_area_meixner; /\* funct for computing area *\/ */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_meixner() */ + +/*---------------------------------------------------------------------------*/ +#undef alpha +#undef beta +#undef delta +#undef mu +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_normal.c b/vendor/unuran-1.11.0/src/distributions/c_normal.c new file mode 100644 index 0000000..c32fa9d --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_normal.c @@ -0,0 +1,354 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_normal.c * + * * + * REFERENCES: * + * * + * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 1, 2nd edition * + * John Wiley & Sons, Inc., New York, 1994 * + * * + ***************************************************************************** + * * + * distr: Normal (Gaussian) distribution [2; ch.13, p.80] * + * * + * pdf: f(x) = exp( -1/2 * ((x-mu)/sigma)^2 ) * + * domain: -infinity < x < infinity * + * constant: 1 / (sigma * sqrt(2 pi)) * + * * + * parameters: * + * 0: mu (0.) ... location * + * 1: sigma > 0 (1.) ... scale * + * * + ***************************************************************************** + * * + * standard form * + * * + * pdf: f(x) = exp( - x^2 / 2) * + * domain: -infinity < x < infinity * + * constant: 1/sqrt(2 pi) * + * * + * parameters: * + * none * + * * + * 0: mu = 0. * + * 1: sigma = 1. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "normal"; + +/*---------------------------------------------------------------------------*/ +/* parameters */ +#define mu params[0] +#define sigma params[1] + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cont +#define LOGNORMCONSTANT (distr->data.cont.norm_constant) + +/*---------------------------------------------------------------------------*/ +/* function prototypes */ +static double _unur_pdf_normal( double x, const UNUR_DISTR *distr ); +static double _unur_logpdf_normal( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_normal( double x, const UNUR_DISTR *distr ); +static double _unur_dlogpdf_normal( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_normal( double x, const UNUR_DISTR *distr ); +static double _unur_invcdf_normal( double u, const UNUR_DISTR *distr ); + +static int _unur_upd_mode_normal( UNUR_DISTR *distr ); +static int _unur_upd_area_normal( UNUR_DISTR *distr ); +static int _unur_set_params_normal( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_normal( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 0) + /* standardize */ + x = (x - mu) / sigma; + + /* standard form */ + + return exp(-x*x/2. + LOGNORMCONSTANT); + +} /* end of _unur_pdf_normal() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_normal( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 0) + /* standardize */ + x = (x - mu) / sigma; + + /* standard form */ + + return (-x*x/2. + LOGNORMCONSTANT); + +} /* end of _unur_logpdf_normal() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_normal( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 0) { + /* standardize */ + x = (x - mu) / sigma; + } + + /* standard form */ + + return ( -x * exp(-x*x/2. + LOGNORMCONSTANT) / sigma ); + +} /* end of _unur_dpdf_normal() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dlogpdf_normal( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 0) + /* non-standard form */ + return (mu - x)/(sigma*sigma); + + else + /* standard form */ + return (-x); + +} /* end of _unur_dlogpdf_normal() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_normal( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 0) + /* standardize */ + x = (x - mu) / sigma; + + /* standard form */ + + return _unur_SF_cdf_normal(x); + +} /* end of _unur_cdf_normal() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_invcdf_normal( double u, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + double X; + + X = _unur_SF_invcdf_normal(u); + return ((DISTR.n_params==0) ? X : mu + sigma * X ); + +} /* end of _unur_invcdf_normal() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_normal( UNUR_DISTR *distr ) +{ + DISTR.mode = DISTR.mu; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_normal() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_normal( UNUR_DISTR *distr ) +{ + /* log of normalization constant */ + LOGNORMCONSTANT = - log(M_SQRTPI * M_SQRT2 * DISTR.sigma); + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_normal( DISTR.domain[1],distr) + - _unur_cdf_normal( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; +} /* end of _unur_upd_area_normal() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_normal( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 0) n_params = 0; + if (n_params > 2) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 2; } + if (n_params > 0) + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter sigma */ + if (n_params > 1 && sigma <= 0.) { + _unur_error(distr_name ,UNUR_ERR_DISTR_DOMAIN,"sigma <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form: none */ + + /* default parameters */ + DISTR.mu = 0.; + DISTR.sigma = 1.; + + /* copy optional parameters */ + switch (n_params) { + case 2: + DISTR.sigma = sigma; + /* FALLTHROUGH */ + case 1: + DISTR.mu = mu; + n_params = 2; /* number of parameters for non-standard form */ + /* FALLTHROUGH */ + default: + break; + } + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_normal() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Make distribution object **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_normal( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_NORMAL; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = _unur_stdgen_normal_init; + + /* functions */ + DISTR.pdf = _unur_pdf_normal; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_normal; /* pointer to logPDF */ + DISTR.dpdf = _unur_dpdf_normal; /* pointer to derivative of PDF */ + DISTR.dlogpdf = _unur_dlogpdf_normal; /* pointer to derivative of logPDF */ + DISTR.cdf = _unur_cdf_normal; /* pointer to CDF */ + DISTR.invcdf = _unur_invcdf_normal; /* pointer to inverse CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MODE | + UNUR_DISTR_SET_PDFAREA ); + + /* set parameters for distribution */ + if (_unur_set_params_normal(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* log of normalization constant */ + LOGNORMCONSTANT = - log(M_SQRTPI * M_SQRT2 * DISTR.sigma); + + /* mode and area below p.d.f. */ + DISTR.mode = DISTR.mu; + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_normal; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_normal; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_normal; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_normal() */ + +/*---------------------------------------------------------------------------*/ +#undef mu +#undef sigma +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_normal_gen.c b/vendor/unuran-1.11.0/src/distributions/c_normal_gen.c new file mode 100644 index 0000000..36adc9a --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_normal_gen.c @@ -0,0 +1,709 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_normal_gen.c * + * * + * Special generators for Normal distribution * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions_source.h" + +/*---------------------------------------------------------------------------*/ +/* init routines for special generators */ + +inline static int normal_bm_init( struct unur_gen *gen ); +inline static int normal_pol_init( struct unur_gen *gen ); + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ + +/* #define MAX_gen_params 1 maximal number of parameters for generator */ + +#define mu (DISTR.params[0]) /* location */ +#define sigma (DISTR.params[1]) /* scale */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Inititialize **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_normal_init( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize special generator for normal distribution */ + /* if gen == NULL then only check existance of variant. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* one of par and gen must not be the NULL pointer */ + switch ((par) ? par->variant : gen->variant) { + + case 1: /* Box-Muller method */ + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_normal_bm ); + return normal_bm_init( gen ); + + case 2: /* Polarmethod with rejection */ + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_normal_pol ); + return normal_pol_init( gen ); + + case 3: /* Kindermann-Ramage method */ + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_normal_kr ); + return UNUR_SUCCESS; + + case 0: /* DEFAULT */ + case 4: /* Acceptance-complement ratio */ + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_normal_acr ); + return UNUR_SUCCESS; + + case 5: /* "Naive" ratio-of-uniforms */ + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_normal_nquo ); + return UNUR_SUCCESS; + + case 6: /* Ratio-of-uniforms with squeeze */ + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_normal_quo ); + return UNUR_SUCCESS; + + case 7: /* Ratio-of-uniforms with quadratic bounding curves */ + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_normal_leva ); + return UNUR_SUCCESS; + + case 99: /* infamous sum-of-12-uniforms method. DO NOT USE */ + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_normal_sum ); + return UNUR_SUCCESS; + + default: /* no such generator */ + return UNUR_FAILURE; + } + +} /* end of _unur_stdgen_normal_init() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Special generators **/ +/** **/ +/*****************************************************************************/ + +/***************************************************************************** + * * + * Normal Distribution: Sinus-Cosinus or Box/Muller Method * + * * + ***************************************************************************** + * * + * This method is based on the transformation * + * x = sqrt(-2 ln(u)) cos(2pi*v), y = sqrt(-2 ln(u)) sin(2pi*v) * + * which converts two independent (0,1)-Uniforms u and v to two * + * independent standard Normal variates x and y. * + * * + * FUNCTION: - samples a random number from the * + * standard Normal distribution N(0,1). * + * * + * REFERENCE: - G.E.P. Box, M.E. Muller (1958): * + * A note on the generation of random normal deviates, * + * Annals Math. Statist. 29, 610-611. * + * * + * Implemented by W. Hoermann, April 1992 * + ***************************************************************************** + * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * + *****************************************************************************/ + +#define GEN_N_PARAMS (1) +#define Xstore GEN->gen_param[0] +#define flag GEN->flag + +int +normal_bm_init( struct unur_gen *gen ) +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + + /* -X- setup code -X- */ + Xstore = 0.; + flag = 1; + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of normal_bm_init() */ + +double +_unur_stdgen_sample_normal_bm( struct unur_gen *gen ) +{ + /* -X- generator code -X- */ + double X; + double u,v,s; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + do { + flag = -flag; + if (flag > 0) { X = Xstore; break; } + + u = uniform(); + v = uniform(); + s = sqrt(-2.0 * log(u)); + Xstore = s * sin(2 * M_PI * v); + X = s * cos(2 * M_PI * v); + } while(0); + /* -X- end of generator code -X- */ + + return ((DISTR.n_params==0) ? X : mu + sigma * X ); + +} /* end of _unur_stdgen_sample_normal_bm() */ + +#undef GEN_N_PARAMS +#undef Xstore +#undef flag + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Normal Distribution: Polarmethod with rejection * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from the standard * + * Normal distribution N(0,1). * + * * + * REFERENCE: - G. Marsaglia (1962): Improving the Polar Method for * + * Generating a Pair of Random Variables, * + * Boeing Sci. Res. Lab., Seattle, Washington. * + * * + * Implemented by W. Hoermann, April 1992 * + ***************************************************************************** + * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * + *****************************************************************************/ + +#define GEN_N_PARAMS (1) +#define Xstore GEN->gen_param[0] +#define flag GEN->flag + +int +normal_pol_init( struct unur_gen *gen ) +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + + /* -X- setup code -X- */ + Xstore = 0.; + flag = 1; + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of normal_pol_init() */ + +double +_unur_stdgen_sample_normal_pol( struct unur_gen *gen ) +{ + /* -X- generator code -X- */ + double X; + double s,x,y,tmp; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + do { + flag = -flag; + if (flag > 0) { X = Xstore; break; } + + while(1) { + x = 2. * uniform() - 1.; + y = 2. * uniform() - 1.; + s = x*x + y*y; + if( s < 1. ) { + tmp = sqrt( -2. * log(s) / s ); + Xstore = y * tmp; + X = x * tmp; + break; + } + } + } while(0); + /* -X- end of generator code -X- */ + + return ((DISTR.n_params==0) ? X : mu + sigma * X ); + +} /* end of _unur_stdgen_sample_normal_pol() */ + +#undef GEN_N_PARAMS +#undef Xstore +#undef flag + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Normal Distribution: "Naive" Ratio of uniforms * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from the * + * standard Normal distribution N(0,1). * + * * + * REFERENCE: - A.J. Kindermann, F.J.Monahan (1977): Computing generation * + * of random variables using the ratio of uniform deviates, * + * ACM TOMS 3(3), 257-260 * + * * + ***************************************************************************** + * UNURAN (c) 2000 W. Hoermann & J. Leydold, Institut f. Statistik, WU Wien * + *****************************************************************************/ + +double +_unur_stdgen_sample_normal_nquo( struct unur_gen *gen ) +{ + /* -X- generator code -X- */ + double X; + double u,v; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + while (1) { + u = uniform(); + if (_unur_iszero(u)) u = 1.; + v = (uniform() - 0.5) * 0.857763885 * 2; + X = v/u; + if (X*X <= -4. * log(u)) + break; + } + /* -X- end of generator code -X- */ + + return ((DISTR.n_params==0) ? X : mu + sigma * X ); + +} /* end of _unur_stdgen_sample_normal_nquo() */ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Normal Distribution: Ratio of uniforms with squeeze * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from the * + * standard Normal distribution N(0,1). * + * * + * REFERENCE: - L. Barabesi (1993): Random variate generation * + * by using the ratio-of-uniforms method, p. 133 * + * * + ***************************************************************************** + * UNURAN (c) 2000 W. Hoermann & J. Leydold, Institut f. Statistik, WU Wien * + *****************************************************************************/ + +double +_unur_stdgen_sample_normal_quo( struct unur_gen *gen ) +{ + /* -X- generator code -X- */ + double X; + double r,w; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + while (1) { + r = uniform(); + X = (2.101083837941101 * uniform() - 1.050541918970551) / sqrt(r); + w = X * X; + if (4. - 4.186837275258269 * r < w) { + if (1.5/r - 0.920558458320164 < w) + continue; + if (-3.*log(r) < w ) + continue; + } + break; + } + /* -X- end of generator code -X- */ + + return ((DISTR.n_params==0) ? X : mu + sigma * X ); + +} /* end of _unur_stdgen_sample_normal_quo() */ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Normal Distribution: Ratio of uniforms with quadratic bounding curves * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from the * + * standard Normal distribution N(0,1). * + * * + * REFERENCE: - J.L. Leva (1992): * + * Algorithm 712; a normal random number generator, * + * ACM TOMS 18(4), 454-455 * + * * + ***************************************************************************** + * UNURAN (c) 2000 W. Hoermann & J. Leydold, Institut f. Statistik, WU Wien * + *****************************************************************************/ + +double +_unur_stdgen_sample_normal_leva( struct unur_gen *gen ) +{ + /* -X- generator code -X- */ +#define S 0.449871 +#define T -0.386595 +#define A 0.19600 +#define B 0.25472 +#define RA 0.27597 +#define RB 0.27846 + + double X; + double u,v,x,y,q; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + while (1) { + u = uniform(); + v = uniform(); + v = 1.7156 * (v - 0.5); + x = u - S; + y = fabs(v) - T; + q = x * x + y * (A * y - B * x); + X = v/u; + if( q < RA ) break; + if( q > RB ) continue; + if (v*v > -4.*log(u)*u*u) continue; + break; + } + +#undef S +#undef T +#undef A +#undef B +#undef RA +#undef RB + /* -X- end of generator code -X- */ + + return ((DISTR.n_params==0) ? X : mu + sigma * X ); + +} /* end of _unur_stdgen_sample_normal_leva() */ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Normal Distribution: Kindermann-Ramage (patchwork) method * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from the * + * standard Normal distribution N(0,1). * + * * + * REFERENCE: - Kinderman A.J., Ramage J.G. (1976): * + * Computer Generation of Normal Random Variables, * + * J. Am. Stat. Assoc. 71(356), 893 - 898. * + * * + * - Tirler G., Dalgaard P., Hoermann W., and Leydold J. (2004): * + * An Error in the {Kinderman-Ramage} Method and How to Fix It,* + * Comp. Stat. Data Anal. 47(3), 433 - 440. * + * * + * Remark: This is the fixed version of the algorithm. * + * * + ***************************************************************************** + * UNURAN (c) 2000 W. Hoermann & J. Leydold, Institut f. Statistik, WU Wien * + *****************************************************************************/ + +double +_unur_stdgen_sample_normal_kr( struct unur_gen *gen ) +{ + /* -X- generator code -X- */ +#define XI 2.216035867166471 +#define PIhochK 0.3989422804 + + double U, V, W, X; + double t, z; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + U = uniform(); + + if (U < 0.884070402298758) { + V = uniform(); + X = XI * (1.131131635444180 * U + V - 1.); + } + + else if (U >= 0.973310954173898) { + do { + V = uniform(); + W = uniform(); + if (_unur_iszero(W)) { t=0.; continue; } + t = XI * XI/2. - log(W); + } while ( (V*V*t) > (XI*XI/2.) ); + X = (U < 0.986655477086949) ? pow(2*t,0.5) : -pow(2*t,0.5); + } + + else if (U>=0.958720824790463) { + do { + V = uniform(); + W = uniform(); + z = V - W; + t = XI - 0.630834801921960 * _unur_min(V,W); + } while (_unur_max(V,W) > 0.755591531667601 && + 0.034240503750111 * fabs(z) > (PIhochK * exp(t*t/(-2.)) - 0.180025191068563*(XI-fabs(t))) ); + X = (z<0) ? t : -t; + } + + else if (U>=0.911312780288703) { + do { + V = uniform(); + W = uniform(); + z = V - W; + t = 0.479727404222441 + 1.105473661022070 * _unur_min(V,W); + } while (_unur_max(V,W) > 0.872834976671790 && + 0.049264496373128*fabs(z) > (PIhochK * exp(t*t/(-2)) -0.180025191068563*(XI-fabs(t))) ); + X = (z<0) ? t : -t; + } + + else { + do { + V = uniform(); + W = uniform(); + z = V - W; + t = 0.479727404222441 - 0.595507138015940 * _unur_min(V,W); + /* + * The following line rejects negative values for t + * (the KR algorithm only generates random variates from + * the half-normal distribution). + * However, it is missing in the original algorithm as + * compiled in the paper. + */ + if (t<=0.) continue; + } while (_unur_max(V,W)>0.805777924423817 && + 0.053377549506886*fabs(z) > (PIhochK * exp(t*t/(-2)) -0.180025191068563*(XI-fabs(t))) ); + X = (z<0) ? t : -t; + } + +#undef XI +#undef PIhochK + /* -X- end of generator code -X- */ + + return ((DISTR.n_params==0) ? X : mu + sigma * X ); + +} /* end of _unur_stdgen_sample_normal_kr() */ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Normal Distribution: Acceptance-complement ratio * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from the * + * standard Normal distribution N(0,1). * + * * + * REFERENCE: - W. Hoermann and G. Derflinger (1990): * + * The ACR Methodfor generating normal random variables, * + * OR Spektrum 12 (1990), 181-185. * + * * + ***************************************************************************** + * UNURAN (c) 2000 W. Hoermann & J. Leydold, Institut f. Statistik, WU Wien * + *****************************************************************************/ + +double +_unur_stdgen_sample_normal_acr( struct unur_gen *gen ) +{ + /* -X- generator code -X- */ +#define c1 1.448242853 +#define c2 3.307147487 +#define c3 1.46754004 +#define d1 1.036467755 +#define d2 5.295844968 +#define d3 3.631288474 +#define hm 0.483941449 +#define zm 0.107981933 +#define hp 4.132731354 +#define zp 18.52161694 +#define phln 0.4515827053 +#define hm1 0.516058551 +#define hp1 3.132731354 +#define hzm 0.375959516 +#define hzmp 0.591923442 +/*zhm 0.967882898*/ + +#define as 0.8853395638 +#define bs 0.2452635696 +#define cs 0.2770276848 +#define b 0.5029324303 +#define x0 0.4571828819 +#define ym 0.187308492 +#define s 0.7270572718 +#define t 0.03895759111 + + double X; + double rn,x,y,z; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + do { + y = uniform(); + + if (y>hm1) { + X = hp*y-hp1; break; } + + else if (y0) ? (1+rn) : (-1+rn); + break; + } + + else if (y0) ? 2-rn : -2-rn; + if ((c1-y)*(c3+fabs(z))0) + rn = 2+y/x; + else { + x = 1-x; + y = ym-y; + rn = -(2+y/x); + } + if ((y-as+x)*(cs+x)+bs<0) { + X = rn; break; } + else if (y= k * + * constant: a * k^a * + * * + * parameters: * + * 0: k > 0 ... location, shape * + * 1: a > 0 ... shape * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ +static const char distr_name[] = "pareto"; + +/* parameters */ +#define k params[0] +#define a params[1] + +#define DISTR distr->data.cont +/* #define NORMCONSTANT (distr->data.cont.norm_constant) */ + +/* function prototypes */ +static double _unur_pdf_pareto( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_pareto( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_pareto( double x, const UNUR_DISTR *distr ); +static double _unur_invcdf_pareto( double u, const UNUR_DISTR *distr ); + +static int _unur_upd_mode_pareto( UNUR_DISTR *distr ); +static int _unur_upd_area_pareto( UNUR_DISTR *distr ); +static int _unur_set_params_pareto( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_pareto( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + if (x DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_pareto() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_pareto( UNUR_DISTR *distr ) +{ + /* normalization constant: none */ + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_pareto( DISTR.domain[1],distr) + - _unur_cdf_pareto( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; + +} /* end of _unur_upd_area_pareto() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_pareto( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + /* check new parameter for generator */ + if (n_params < 2) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 2) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 2; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter k */ + if (k <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"k <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* check parameter a */ + if (a <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"a <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.k = k; + DISTR.a = a; + + /* default parameters: none */ + /* copy optional parameters: none */ + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = DISTR.k; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_pareto() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_pareto( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_PARETO; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = _unur_stdgen_pareto_init; */ + + /* functions */ + DISTR.pdf = _unur_pdf_pareto; /* pointer to PDF */ + DISTR.dpdf = _unur_dpdf_pareto; /* pointer to derivative of PDF */ + DISTR.cdf = _unur_cdf_pareto; /* pointer to CDF */ + DISTR.invcdf = _unur_invcdf_pareto; /* pointer to inverse CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MODE | + UNUR_DISTR_SET_PDFAREA ); + + /* set parameters for distribution */ + if (_unur_set_params_pareto(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* normalization constant: none */ + + /* mode and area below p.d.f. */ + DISTR.mode = DISTR.k; + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_pareto; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_pareto; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_pareto; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_pareto() */ + +/*---------------------------------------------------------------------------*/ +#undef k +#undef a +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_powerexponential.c b/vendor/unuran-1.11.0/src/distributions/c_powerexponential.c new file mode 100644 index 0000000..d190faa --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_powerexponential.c @@ -0,0 +1,283 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_powerexponential.c * + * * + * REFERENCES: * + * * + * [3] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 2, 2nd edition * + * John Wiley & Sons, Inc., New York, 1995 * + * * + ***************************************************************************** + * * + * distr: power-exponential distribution * + * (also called Subbotin distribution) * + * * + * (see also [3; ch.24, p.195] for a different definition; * + * also called Subbotin distribution) * + * * + * pdf: exp(-abs(x)^tau) * + * domain: -infinity < x < infinity * + * constant: 1 / (2 * Gamma(1+1/tau)) * + * * + * parameters: 1 * + * 0: tau > 0 ... shape * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "powerexponential"; + +/*---------------------------------------------------------------------------*/ +/* parameters */ +#define tau params[0] + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cont +#define LOGNORMCONSTANT (distr->data.cont.norm_constant) + +/*---------------------------------------------------------------------------*/ +/* function prototypes */ +static double _unur_pdf_powerexponential( double x, const UNUR_DISTR *distr ); +static double _unur_logpdf_powerexponential( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_powerexponential( double x, const UNUR_DISTR *distr ); +static double _unur_dlogpdf_powerexponential( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_powerexponential( double x, const UNUR_DISTR *distr ); + +static int _unur_upd_mode_powerexponential( UNUR_DISTR *distr ); +static int _unur_upd_area_powerexponential( UNUR_DISTR *distr ); +static int _unur_set_params_powerexponential( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_powerexponential( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + return exp( - pow( fabs(x), tau ) - LOGNORMCONSTANT); +} /* end of _unur_pdf_powerexponential() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_powerexponential( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + return ( - pow( fabs(x), tau ) - LOGNORMCONSTANT); +} /* end of _unur_logpdf_powerexponential() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_powerexponential( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + register double tmp; + + if (_unur_iszero(x)) /* derivative may not be defined, but ... */ + return 0.; /* a tangent parallel to x-axis is possible. */ + + tmp = exp( -pow(fabs(x),tau) - LOGNORMCONSTANT + (tau-1.)*log(fabs(x)) ) * tau; + + /* sign ! */ + return ( (x<0.) ? tmp : -tmp ); +} /* end of _unur_dpdf_powerexponential() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dlogpdf_powerexponential( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (_unur_iszero(x)) /* derivative may not be defined, but ... */ + return 0.; /* a tangent parallel to x-axis is possible. */ + + /* sign ! */ + return (x<0. ? 1. : -1.) * (tau-1.)* pow(fabs(x), tau-1.); +} /* end of _unur_dlogpdf_powerexponential() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_powerexponential( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + register double cdf; + + /* compute cdf(abs(x)) - cdf(0) */ + cdf = _unur_SF_incomplete_gamma(pow(fabs(x),tau),1./tau) / 2.; + return ((x<0.) ? 0.5 - cdf : 0.5 + cdf); + +} /* end of _unur_cdf_powerexponential() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_powerexponential( UNUR_DISTR *distr ) +{ + DISTR.mode = 0; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_powerexponential() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_powerexponential( UNUR_DISTR *distr ) +{ + /* log of normalization constant */ + LOGNORMCONSTANT = _unur_SF_ln_gamma(1. + 1./DISTR.tau) + M_LN2; + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_powerexponential( DISTR.domain[1],distr) + - _unur_cdf_powerexponential( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; +} /* end of _unur_upd_area_powerexponential() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_powerexponential( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 1) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 1) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 1; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter tau */ + if (tau <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"tau <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.tau = tau; + + /* default parameters: none */ + /* copy optional parameters: none */ + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_powerexponential() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_powerexponential( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_POWEREXPONENTIAL; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = _unur_stdgen_powerexponential_init; + + /* functions */ + DISTR.pdf = _unur_pdf_powerexponential; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_powerexponential; /* pointer to logPDF */ + DISTR.dpdf = _unur_dpdf_powerexponential; /* pointer to derivative of PDF */ + DISTR.dlogpdf = _unur_dlogpdf_powerexponential; /* pointer to derivative of logPDF */ + DISTR.cdf = _unur_cdf_powerexponential; /* pointer to CDF */ + DISTR.cdf = _unur_cdf_powerexponential; /* pointer to CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_PDFAREA | + UNUR_DISTR_SET_MODE ); + + /* set parameters for distribution */ + if (_unur_set_params_powerexponential(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* log of normalization constant */ + LOGNORMCONSTANT = _unur_SF_ln_gamma(1. + 1./DISTR.tau) + M_LN2; + + /* mode and area below p.d.f. */ + DISTR.mode = 0; + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_powerexponential; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_powerexponential; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_powerexponential; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_powerexponential() */ + +/*---------------------------------------------------------------------------*/ +#undef tau +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_powerexponential_gen.c b/vendor/unuran-1.11.0/src/distributions/c_powerexponential_gen.c new file mode 100644 index 0000000..897bca8 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_powerexponential_gen.c @@ -0,0 +1,202 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_powerexponential_gen.c * + * * + * Special generators for Power-exponential distribution * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions_source.h" + +/*---------------------------------------------------------------------------*/ +/* init routines for special generators */ + +inline static int powerexponential_epd_init( struct unur_gen *gen ); + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +/* #define MAX_gen_params (2) maximal number of parameters for generator */ + +#define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ + +/*---------------------------------------------------------------------------*/ +#define tau (DISTR.params[0]) /* shape */ +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Inititialize **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_powerexponential_init( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize special generator for power-exponential distribution */ + /* if gen == NULL then only check existance of variant. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* one of par and gen must not be the NULL pointer */ + switch ((par) ? par->variant : gen->variant) { + + case 0: /* DEFAULT */ + case 1: /* Transformed density rejection */ + { /* check parameters of distribution */ + double d_tau = (par) ? par->distr->data.cont.params[0] : tau; + if (d_tau < 1.) { + _unur_error(NULL,UNUR_ERR_GEN_CONDITION,""); + return UNUR_ERR_GEN_CONDITION; + } + } + + /* tau >= 1 !!!! */ + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_powerexponential_epd ); + return powerexponential_epd_init( gen ); + + default: /* no such generator */ + return UNUR_FAILURE; + } + +} /* end of _unur_stdgen_powerexponential_init() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Special generators **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Powerexponential Distribution: Transformed density rejection * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from the Power-exponential * + * distribution with parameter tau >= 1 by using the * + * non-universal rejection method for logconcave densities. * + * * + * REFERENCE: - L. Devroye (1986): Non-Uniform Random Variate Generation, * + * Springer Verlag, New York. * + * * + * Implemented by K. Lehner, 1990 * + * Revised by F. Niederl, August 1992 * + ***************************************************************************** + * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#define GEN_N_PARAMS (2) +#define s GEN->gen_param[0] +#define sm1 GEN->gen_param[1] +/*---------------------------------------------------------------------------*/ + +inline static int +powerexponential_epd_init( struct unur_gen *gen ) +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + + /* -X- setup code -X- */ + s = 1. / tau; + sm1 = 1. - s; + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of powerexponential_epd_init() */ + +double +_unur_stdgen_sample_powerexponential_epd( struct unur_gen *gen ) +{ + /* -X- generator code -X- */ + double U,u1,V,X,y; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + do { + U = 2. * uniform() - 1.; /* U(-1.0/1.0) */ + u1 = fabs(U); /* u1=|u| */ + V = uniform(); /* U(0/1) */ + + if (u1 <= sm1) + /* Uniform hat-function for x <= (1-1/tau) */ + X = u1; + else { + /* Exponential hat-function for x > (1-1/tau) */ + y = tau * (1. - u1); /* U(0/1) */ + X = sm1 - s * log(y); + V *= y; + } + } while (log(V) > -exp(log(X)*tau)); /* Acceptance/Rejection */ + + /* Random sign */ + if (U > 0.) + X = -X; + + /* -X- end of generator code -X- */ + + return X; + +} /* end of _unur_stdgen_sample_powerexponential_epd() */ + +/*---------------------------------------------------------------------------*/ +#undef GEN_N_PARAMS +#undef s +#undef sm1 +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_rayleigh.c b/vendor/unuran-1.11.0/src/distributions/c_rayleigh.c new file mode 100644 index 0000000..0a9700d --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_rayleigh.c @@ -0,0 +1,244 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_rayleigh.c * + * * + * REFERENCES: * + * * + * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 1, 2nd edition * + * John Wiley & Sons, Inc., New York, 1994 * + * * + ***************************************************************************** + * * + * distr: Rayleigh distribution [2; ch.18, p.456] * + * * + * pdf: f(x) = x * exp( -1/2 * (x/sigma)^2 ) * + * domain: 0 <= x < infinity * + * constant: 1 / sigma^2 * + * * + * parameters: 1 * + * 0: sigma > 0 ... scale * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ +static const char distr_name[] = "rayleigh"; + +/* parameters */ +#define sigma params[0] + +#define DISTR distr->data.cont +#define LOGNORMCONSTANT (distr->data.cont.norm_constant) + +/* function prototypes */ +static double _unur_pdf_rayleigh( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_rayleigh( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_rayleigh( double x, const UNUR_DISTR *distr ); + +static int _unur_upd_mode_rayleigh( UNUR_DISTR *distr ); +static int _unur_upd_area_rayleigh( UNUR_DISTR *distr ); +static int _unur_set_params_rayleigh( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_rayleigh( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (x<=0.) + return 0.; + + /* else */ + return (x * exp(-x*x/(2.*sigma*sigma) - LOGNORMCONSTANT ) ); + +} /* end of _unur_pdf_rayleigh() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_rayleigh( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + register double z; + + z = x*x/(sigma*sigma); + return ( (x<=0.) ? 0. : exp(-z/2 - LOGNORMCONSTANT) * (1-z) ); +} /* end of _unur_dpdf_rayleigh() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_rayleigh( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + return ( (x<=0.) ? 0. : 1. - exp(-x*x/(2.*sigma*sigma)) ); +} /* end of _unur_cdf_rayleigh() */ + +/*---------------------------------------------------------------------------*/ + + +int +_unur_upd_mode_rayleigh( UNUR_DISTR *distr ) +{ + DISTR.mode = DISTR.sigma; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_rayleigh() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_rayleigh( UNUR_DISTR *distr ) +{ + /* log of normalization constant */ + LOGNORMCONSTANT = 2. * log(DISTR.sigma); + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_rayleigh( DISTR.domain[1],distr) + - _unur_cdf_rayleigh( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; + +} /* end of _unur_upd_area_rayleigh() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_rayleigh( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 1) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 1) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 1; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter sigma */ + if (sigma <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"sigma <= 0."); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.sigma = sigma; + + /* default parameters: none */ + /* copy optional parameters: none */ + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = 0.; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_rayleigh() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_rayleigh( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_RAYLEIGH; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = NULL; /* _unur_stdgen_rayleigh_init; */ + + /* functions */ + DISTR.pdf = _unur_pdf_rayleigh; /* pointer to PDF */ + DISTR.dpdf = _unur_dpdf_rayleigh; /* pointer to derivative of PDF */ + DISTR.cdf = _unur_cdf_rayleigh; /* pointer to CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MODE | + UNUR_DISTR_SET_PDFAREA ); + + /* set parameters for distribution */ + if (_unur_set_params_rayleigh(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* log of normalization constant */ + LOGNORMCONSTANT = 2. * log(DISTR.sigma); + + /* mode and area below p.d.f. */ + DISTR.mode = DISTR.sigma; + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_rayleigh; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_rayleigh; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_rayleigh; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_rayleigh() */ + +/*---------------------------------------------------------------------------*/ +#undef sigma +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_slash.c b/vendor/unuran-1.11.0/src/distributions/c_slash.c new file mode 100644 index 0000000..65fcb62 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_slash.c @@ -0,0 +1,200 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_slash.c * + * * + * REFERENCES: * + * * + * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 1, 2nd edition * + * John Wiley & Sons, Inc., New York, 1994 * + * * + ***************************************************************************** + * * + * distr: Slash distribution [2; ch.12, p.63] * + * * + * pdf: f(x) = (1 - exp(-x^2/2)) / x^2 for x != 0 * + * pdf: f(x) = 1 / 2 for x == 0 * + * domain: -infinity < x < infinity * + * constant: 1 / sqrt(2 * pi) * + * * + * parameters: none * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "slash"; + +/* parameters */ +/* none */ + +#define DISTR distr->data.cont +#define NORMCONSTANT (distr->data.cont.norm_constant) + +/* function prototypes */ +static double _unur_pdf_slash( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_slash( double x, const UNUR_DISTR *distr ); +/* static double _unur_cdf_slash( double x, const UNUR_DISTR *distr ); */ + +static int _unur_upd_mode_slash( UNUR_DISTR *distr ); +static int _unur_set_params_slash( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_slash(double x, const UNUR_DISTR *distr) +{ + if (_unur_iszero(x)) + return (0.5 * NORMCONSTANT); + else + return ((1. - exp(-x*x/2.)) / (x*x) * NORMCONSTANT); +} /* end of _unur_pdf_slash() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_slash(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + register double xsq = x * x; + + if (_unur_iszero(x)) + return 0.; + else + return (NORMCONSTANT * ((-2. + exp(-xsq/2.) * (2. + xsq)) / (xsq * x))); + +} /* end of _unur_dpdf_slash() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_slash( UNUR_DISTR *distr ) +{ + DISTR.mode = 0.; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_slash() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_slash( UNUR_DISTR *distr, const double *params ATTRIBUTE__UNUSED, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params > 0) + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + + /* copy parameters for standard form: none */ + /* default parameters: none */ + /* copy optional parameters: none */ + + /* store number of parameters */ + DISTR.n_params = 0; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_slash() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_slash( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_SLASH; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = _unur_stdgen_slash_init; + + /* functions */ + DISTR.pdf = _unur_pdf_slash; /* pointer to PDF */ + DISTR.dpdf = _unur_dpdf_slash; /* pointer to derivative of PDF */ + /* DISTR.cdf = _unur_cdf_slash; pointer to CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MODE | + UNUR_DISTR_SET_PDFAREA ); + + /* set parameters for distribution */ + if (_unur_set_params_slash(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* normalization constant */ + NORMCONSTANT = 1. / (M_SQRT2 * M_SQRTPI); + + /* mode and area below p.d.f. */ + DISTR.mode = 0.; + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_slash; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_slash; /* funct for computing mode */ + /* DISTR.upd_area = _unur_upd_area_slash; funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_slash() */ + +/*---------------------------------------------------------------------------*/ +#undef nu +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_slash_gen.c b/vendor/unuran-1.11.0/src/distributions/c_slash_gen.c new file mode 100644 index 0000000..a38b6b3 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_slash_gen.c @@ -0,0 +1,173 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_slash_gen.c * + * * + * Special generators for Slash distribution * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_distributions_source.h" +#include "unur_distributions.h" + +/*---------------------------------------------------------------------------*/ +/* init routines for special generators */ + +inline static int slash_slash_init( struct unur_gen *gen ); + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Inititialize **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_slash_init( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize special generator for Slash distribution */ + /* if gen == NULL then only check existance of variant. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* one of par and gen must not be the NULL pointer */ + switch ((par) ? par->variant : gen->variant) { + + case 0: /* DEFAULT */ + case 1: /* Ratio of normal and uniform random variates */ + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_slash_slash ); + return slash_slash_init( gen ); + + default: /* no such generator */ + return UNUR_FAILURE; + } + +} /* end of _unur_stdgen_slash_init() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Special generators **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Slash Distribution: Z/U (Z from N(0,1), U from U(0,1)) * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from the Slash distribution. * + * * + * Implemented by R. Kremer, 1990 * + ***************************************************************************** + * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#define NORMAL gen->gen_aux /* pointer to normal variate generator */ +/*---------------------------------------------------------------------------*/ + +inline static int +slash_slash_init( struct unur_gen *gen ) +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); + + /* -X- setup code -X- */ + + /* make a normal variate generator (use default special generator) */ + if (NORMAL==NULL) { + struct unur_distr *distr = unur_distr_normal(NULL,0); + struct unur_par *par = unur_cstd_new( distr ); + NORMAL = (par) ? _unur_init(par) : NULL; + _unur_check_NULL( NULL, NORMAL, UNUR_ERR_NULL ); + /* need same uniform random number generator as slash generator */ + NORMAL->urng = gen->urng; + /* copy debugging flags */ + NORMAL->debug = gen->debug; + /* we do not need the distribution object any more */ + _unur_distr_free( distr ); + } + /* else we are in the re-init mode + --> there is no necessity to make the generator object again */ + + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of slash_slash_init() */ + +double +_unur_stdgen_sample_slash_slash( struct unur_gen *gen ) +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + /* -X- generator code -X- */ + return (_unur_sample_cont(NORMAL) / uniform()); + /* -X- end of generator code -X- */ + +} /* end of _unur_stdgen_sample_slash_slash() */ + +/*---------------------------------------------------------------------------*/ +#undef NORMAL +/*---------------------------------------------------------------------------*/ + + + + diff --git a/vendor/unuran-1.11.0/src/distributions/c_student.c b/vendor/unuran-1.11.0/src/distributions/c_student.c new file mode 100644 index 0000000..bb4f788 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_student.c @@ -0,0 +1,279 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_student.c * + * * + * REFERENCES: * + * * + * [3] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 2, 2nd edition * + * John Wiley & Sons, Inc., New York, 1995 * + * * + ***************************************************************************** + * * + * distr: Student distribution or t-distribution [3; ch. 28; p. 362] * + * * + * pdf: f(x) = ( 1 + (x^2)/nu )^(-(nu+1)/2) * + * domain: -infinity < x < infintiy * + * constant: 1 / (sqrt(nu) * Beta(1/2,nu/2)) * + * = 1 / (sqrt(pi*nu) * Gamma(nu/2) / Gamma((nu+1)/2)) * + * * + * parameters: 1 * + * 0: nu > 0 ... shape * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "student"; + +/*---------------------------------------------------------------------------*/ +/* parameters */ +#define nu params[0] + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cont +#define NORMCONSTANT (distr->data.cont.norm_constant) + +/*---------------------------------------------------------------------------*/ +/* function prototypes */ +static double _unur_pdf_student( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_student( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_student( double x, const UNUR_DISTR *distr ); +#ifdef _unur_SF_invcdf_student +static double _unur_invcdf_student( double x, const UNUR_DISTR *distr ); +#endif + +static int _unur_upd_mode_student( UNUR_DISTR *distr ); +static int _unur_upd_area_student( UNUR_DISTR *distr ); +static double _unur_normconstant_student(const double *params, int n_params); +static int _unur_set_params_student( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_student( double x, const UNUR_DISTR *distr ) +{ + const double *params = DISTR.params; + return pow( (1. + x*x/nu), (-nu-1.)*0.5 ) / NORMCONSTANT; +} /* end of _unur_pdf_student() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_student( double x, const UNUR_DISTR *distr ) +{ + const double *params = DISTR.params; + return ( (-nu-1.)*x/nu * pow( (1. + x*x/nu), (-nu-3.)*0.5 ) / NORMCONSTANT ); +} /* end of _unur_dpdf_student() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_student(double x, const UNUR_DISTR *distr) +{ +#ifdef _unur_SF_cdf_student + return _unur_SF_cdf_student(x,DISTR.nu); +#else + const double *params = DISTR.params; + double xx; + + if (_unur_iszero(nu)) + return 0.; /* maybe we could return the Heaviside step-function here ... */ + + xx=1./(1.+x*x/nu); + if (x>0) + return 1-0.5*_unur_SF_incomplete_beta(xx,0.5*nu,0.5)/_unur_SF_incomplete_beta(1.,0.5*nu,0.5); + else + return 0.5*_unur_SF_incomplete_beta(xx,0.5*nu,0.5)/_unur_SF_incomplete_beta(1.,0.5*nu,0.5); +#endif +} /* end of _unur_cdf_student() */ + +/*---------------------------------------------------------------------------*/ + +#ifdef _unur_SF_invcdf_student +double +_unur_invcdf_student(double x, const UNUR_DISTR *distr) +{ + return _unur_SF_invcdf_student(x,DISTR.nu); +} /* end of _unur_invcdf_student() */ +#endif + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_student( UNUR_DISTR *distr ) +{ + DISTR.mode = 0.; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_student() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_student( UNUR_DISTR *distr ) +{ + /* normalization constant */ + NORMCONSTANT = _unur_normconstant_student(DISTR.params,DISTR.n_params); + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_student( DISTR.domain[1],distr) + - _unur_cdf_student( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; +} /* end of _unur_upd_area_student() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_normconstant_student( const double *params, int n_params ATTRIBUTE__UNUSED ) +{ + return( sqrt(M_PI * nu) * exp(_unur_SF_ln_gamma(0.5*nu) - _unur_SF_ln_gamma(0.5*(nu+1.))) ); +} /* end of _unur_normconstant_student() */ + + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_student( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 1) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 1) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 1; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter nu */ + if (nu <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"nu <= 0."); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.nu = nu; + + /* default parameters: none */ + /* copy optional parameters:none */ + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_student() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_student( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_STUDENT; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = _unur_stdgen_student_init; + + /* functions */ + DISTR.pdf = _unur_pdf_student; /* pointer to PDF */ + DISTR.dpdf = _unur_dpdf_student; /* pointer to derivative of PDF */ + DISTR.cdf = _unur_cdf_student; /* pointer to CDF */ +#ifdef _unur_SF_invcdf_student + DISTR.invcdf = _unur_invcdf_student; /* pointer to inverse CDF */ +#endif + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_PDFAREA | + UNUR_DISTR_SET_MODE ); + + /* set parameters for distribution */ + if (_unur_set_params_student(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* normalization constant */ + NORMCONSTANT = _unur_normconstant_student(DISTR.params,DISTR.n_params); + + /* mode and area below p.d.f. */ + DISTR.mode = 0.; + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_student; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_student; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_student; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_student() */ + +/*---------------------------------------------------------------------------*/ +#undef nu +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_student_gen.c b/vendor/unuran-1.11.0/src/distributions/c_student_gen.c new file mode 100644 index 0000000..4e50558 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_student_gen.c @@ -0,0 +1,262 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_student_gen.c * + * * + * Special generators for Student's t distribution * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions_source.h" + +/*---------------------------------------------------------------------------*/ +/* init routines for special generators */ + +inline static int student_trouo_init( struct unur_gen *gen ); + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +/* #define MAX_gen_params (6) maximal number of parameters for generator */ + +#define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ + +#define nu (DISTR.params[0]) /* shape (degrees of freedom) */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Inititialize **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_student_init( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize special generator for Student's distribution */ + /* if gen == NULL then only check existance of variant. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* one of par and gen must not be the NULL pointer */ + switch ((par) ? par->variant : gen->variant) { + + case 0: /* DEFAULT */ + case 1: /* Polar Method */ + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_student_tpol ); + return UNUR_SUCCESS; + + case 2: /* Ratio of Uniforms */ + if (par!=NULL && par->distr->data.cont.params[0] < 1.) { /* nu < 1 */ + _unur_error(NULL,UNUR_ERR_GEN_CONDITION,""); + return UNUR_ERR_GEN_CONDITION; + } + /* nu >= 1 !!!! */ + _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_student_trouo ); + return student_trouo_init( gen ); + + default: /* no such generator */ + return UNUR_FAILURE; + } + +} /* end of _unur_stdgen_chi_init() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Special generators **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Student's t Distribution: Polar Method * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from Student's t distribution with * + * parameters nu > 0. * + * * + * REFERENCE: - R.W. Bailey (1994): Polar generation of random variates * + * with the t-distribution, * + * Mathematics of Computation 62, 779-781. * + * * + * Implemented by F. Niederl, 1994 * + ***************************************************************************** + * * + * The polar method of Box/Muller for generating Normal variates is adapted * + * to the Student-t distribution. The two generated variates are not * + * independent and the expected no. of uniforms per variate is 2.5464. * + * * + ***************************************************************************** + * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * + *****************************************************************************/ + +double +_unur_stdgen_sample_student_tpol( struct unur_gen *gen ) +{ + /* -X- generator code -X- */ + double u,v,w; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + do { + u = 2. * uniform() - 1.; + v = 2. * uniform() - 1.; + w = u * u + v * v; + } while (w > 1.); + + return(u * sqrt( nu * ( exp(- 2. / nu * log(w)) - 1.) / w)); + /* -X- end of generator code -X- */ +} /* end of _unur_stdgen_sample_student_tpol() */ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Student's t Distribution: Ratio of Uniforms * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from Student's t distribution with * + * parameters nu >= 1. * + * * + * REFERENCE: - A.J. Kinderman, J.F. Monahan (1980): * + * New methods for generating Student's t and gamma variables, * + * Computing 25, 369-377. * + * * + * Implemented by R. Kremer, 1990 * + ***************************************************************************** + * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#define GEN_N_PARAMS (6) +#define c (GEN->gen_param[0]) +#define e (GEN->gen_param[1]) +#define p (GEN->gen_param[2]) +#define q (GEN->gen_param[3]) +#define r (GEN->gen_param[4]) +#define vm (GEN->gen_param[5]) +/*---------------------------------------------------------------------------*/ + +inline static int +student_trouo_init( struct unur_gen *gen ) +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + + /* -X- setup code -X- */ + if (nu < 1.) { + _unur_error(NULL,UNUR_ERR_GEN_CONDITION,""); + return UNUR_ERR_GEN_CONDITION; + } + + r = 1. / nu; + p = 1. / (1. + r); + q = -0.25 * (nu + 1.); + c = 4. * pow(p, q); + e = 16. / c; + vm = (nu>1.0) ? sqrt(p+p) * pow( (1.-r)*p, 0.25*(nu-1.) ) : 1.; + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of student_trouo_init() */ + +double +_unur_stdgen_sample_student_trouo( struct unur_gen *gen ) +{ + /* -X- generator code -X- */ + double tru,u,v; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + while (1) { + + /* step 1 */ + u = uniform(); + + /* step 2 */ + v = uniform(); + v = vm * (v + v - 1.); + tru = v / u; + + /* step 3 */ + if ( c * u <= 5. - tru * tru) + break; + if (nu >= 3.) + if (u * (tru * tru + 3.) >= e) + continue; /* goto 1 */ /* step 4 */ + if ( u <= pow(1. + tru * tru * r, q)) + break; + } + + return tru; + +} /* end of _unur_stdgen_sample_student_trouo() */ + +/*---------------------------------------------------------------------------*/ +#undef GEN_N_PARAMS +#undef c +#undef e +#undef p +#undef q +#undef r +#undef vm +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_triangular.c b/vendor/unuran-1.11.0/src/distributions/c_triangular.c new file mode 100644 index 0000000..96242de --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_triangular.c @@ -0,0 +1,282 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_triangular.c * + * * + * REFERENCES: * + * * + * [3] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 2, 2nd edition * + * John Wiley & Sons, Inc., New York, 1995 * + * * + ***************************************************************************** + * * + * distr: Triangular distribution [3; ch.26, p.297] * + * * + * pdf: f(x) = 2*x / H for 0 <= x <= H * + * pdf: f(x) = 2*(1-x) / (1-H) for H <= x <= 1 * + * domain: 0 <= x <= 1 * + * constant: 1 * + * * + * parameters: 1 * + * 0: H (0 <= H <= 1) ... shape * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ +static const char distr_name[] = "triangular"; + +/* parameters */ +#define H params[0] /* shape */ + +#define DISTR distr->data.cont +/* #define NORMCONSTANT (distr->data.cont.norm_constant) */ + +/* function prototypes */ +static double _unur_pdf_triangular( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_triangular( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_triangular( double x, const UNUR_DISTR *distr ); +static double _unur_invcdf_triangular( double u, const UNUR_DISTR *distr ); + +static int _unur_upd_mode_triangular( UNUR_DISTR *distr ); +static int _unur_upd_area_triangular( UNUR_DISTR *distr ); +static int _unur_set_params_triangular( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_triangular( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (x <= 0.) + return 0.; + if (x <= H) + return (2.*x/H); + if (x < 1.) + return (2.*(1.-x)/(1.-H)); + /* otherwise */ + return 0.; +} /* end of _unur_pdf_triangular() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_triangular( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (x < 0.) + return 0.; + if (x <= H && H > 0.) + return (2./H); + if (x <= 1.&& H < 1.) + return (-2./(1.-H)); + /* otherwise */ + return 0.; +} /* end of unur_dpdf_triangular() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_triangular( double x, const UNUR_DISTR *distr ) +{ + const double *params = DISTR.params; + double Fx; + + if (x <= 0.) + return 0.; + if (x <= H) + return (x*x/H); + if (x < 1.) { + if ((Fx = ((H + x * (x-2.))/(H-1.))) < 1.) + return Fx; + } + /* otherwise */ + return 1.; +} /* end of _unur_cdf_triangular() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_invcdf_triangular( double U, const UNUR_DISTR *distr ) +{ + const double *params = DISTR.params; + double tmp,X; + + if (U<=H) { + X = sqrt(H*U); + } + else { + tmp = (1.-H)*(1.-U); + X = (tmp>0.) ? (1.-sqrt(tmp)) : 1.; + } + return X; +} /* end of _unur_invcdf_triangular() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_triangular( UNUR_DISTR *distr ) +{ + DISTR.mode = DISTR.H; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_triangular() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_triangular( UNUR_DISTR *distr ) +{ + /* normalization constant: none */ + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_triangular( DISTR.domain[1],distr) + - _unur_cdf_triangular( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; + +} /* end of _unur_upd_area_triangular() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_triangular( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 0) n_params = 0; + if (n_params > 1) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 1; } + if (n_params > 0) + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter H */ + if (n_params > 0 && (H < 0. || H > 1.)) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"H < 0 || H > 1"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form: none */ + + /* default parameters */ + DISTR.H = 0.5; /* default is symmetric triangular distribution */ + + /* copy optional parameters */ + if (n_params == 1) + DISTR.H = H; + + /* store total number of parameters */ + DISTR.n_params = 1; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = 0.; /* left boundary */ + DISTR.domain[1] = 1.; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_triangular() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_triangular( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_TRIANGULAR; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = _unur_stdgen_triangular_init; */ + + /* functions */ + DISTR.pdf = _unur_pdf_triangular; /* pointer to PDF */ + DISTR.dpdf = _unur_dpdf_triangular; /* pointer to derivative of PDF */ + DISTR.cdf = _unur_cdf_triangular; /* pointer to CDF */ + DISTR.invcdf = _unur_invcdf_triangular; /* pointer to inverse CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MODE | + UNUR_DISTR_SET_PDFAREA ); + + /* set parameters for distribution */ + if (_unur_set_params_triangular(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* mode and area below p.d.f. */ + DISTR.mode = DISTR.H; + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_triangular; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_triangular; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_triangular; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_triangular() */ + +/*---------------------------------------------------------------------------*/ +#undef theta +#undef phi +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_uniform.c b/vendor/unuran-1.11.0/src/distributions/c_uniform.c new file mode 100644 index 0000000..ecca2d8 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_uniform.c @@ -0,0 +1,295 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_uniform.c * + * * + * REFERENCES: * + * * + * [3] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 2, 2nd edition * + * John Wiley & Sons, Inc., New York, 1995 * + * * + ***************************************************************************** + * * + * distr: Uniform distribution [3; ch.26, p.276] * + * * + * pdf: f(x) = 1 / (b-a) * + * domain: a <= x <= b * + * constant: 1 * + * * + * parameters: * + * 0: a ... location * + * 1: b (>a) ... location * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ +static const char distr_name[] = "uniform"; + +/* parameters */ +#define a params[0] +#define b params[1] + +#define DISTR distr->data.cont +/* #define NORMCONSTANT (distr->data.cont.norm_constant) */ + +/* function prototypes */ +static double _unur_pdf_uniform( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_uniform( double x, const UNUR_DISTR *distr ); +static double _unur_logpdf_uniform( double x, const UNUR_DISTR *distr ); +static double _unur_dlogpdf_uniform( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_uniform( double x, const UNUR_DISTR *distr ); +static double _unur_invcdf_uniform( double u, const UNUR_DISTR *distr ); + +static int _unur_upd_mode_uniform( UNUR_DISTR *distr ); +static int _unur_upd_area_uniform( UNUR_DISTR *distr ); +static int _unur_set_params_uniform( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_uniform( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (x < a || x > b) + return 0.; + /* else */ + return 1./(b-a); + + /* return ((x < a || x > b) ? 0. : 1./(b-a)); */ +} /* end of _unur_pdf_uniform() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_uniform( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (x < a || x > b) + return -UNUR_INFINITY; + /* else */ + return -log(b-a); + +} /* end of _unur_logpdf_uniform() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_uniform( double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED ) +{ + return 0.; +} /* end of _unur_dpdf_uniform() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dlogpdf_uniform( double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED ) +{ + return 0.; +} /* end of _unur_dlogpdf_uniform() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_uniform( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + /* standardize */ + x = (x-a) / (b-a); + + if (x<=0.) + return 0.; + if (x>=1.) + return 1.; + return x; + +} /* end of _unur_cdf_uniform() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_invcdf_uniform( double U, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + double X; + + X = (DISTR.n_params==0) ? U : a + U * (b - a); + return X; +} /* end of _unur_invcdf_uniform() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_uniform( UNUR_DISTR *distr ) +{ + DISTR.mode = (DISTR.a + DISTR.b) / 2.; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_uniform() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_uniform( UNUR_DISTR *distr ) +{ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_uniform( DISTR.domain[1],distr) + - _unur_cdf_uniform( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; + +} /* end of _unur_upd_area_uniform() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_uniform( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 0) n_params = 0; + if (n_params == 1) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 2) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 2; } + if (n_params > 0) + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameters a and b */ + if (n_params == 2 && (a >= b)) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"a >= b"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form: none */ + + /* default parameters */ + DISTR.a = 0.; + DISTR.b = 1.; + + /* copy optional parameters */ + if (n_params == 2) { + DISTR.a = a; + DISTR.b = b; + } + + /* store total number of parameters */ + DISTR.n_params = 2; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = DISTR.a; /* left boundary */ + DISTR.domain[1] = DISTR.b; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_uniform() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_uniform( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_UNIFORM; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = _unur_stdgen_uniform_init; */ + + /* functions */ + DISTR.pdf = _unur_pdf_uniform; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_uniform; /* pointer to logPDF */ + DISTR.dpdf = _unur_dpdf_uniform; /* pointer to derivative of PDF */ + DISTR.dlogpdf = _unur_dlogpdf_uniform; /* pointer to deriv. of logPDF */ + DISTR.cdf = _unur_cdf_uniform; /* pointer to CDF */ + DISTR.invcdf = _unur_invcdf_uniform; /* pointer to inverse CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_MODE | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_PDFAREA ); + + /* set parameters for distribution */ + if (_unur_set_params_uniform(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* normalization constant: none */ + + /* mode and area below p.d.f. */ + DISTR.mode = (DISTR.a + DISTR.b) / 2.; + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_uniform; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_uniform; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_uniform; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_uniform() */ + +/*---------------------------------------------------------------------------*/ +#undef a +#undef b +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_vg.c b/vendor/unuran-1.11.0/src/distributions/c_vg.c new file mode 100644 index 0000000..52621d5 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_vg.c @@ -0,0 +1,354 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_vg.c * + * * + * REFERENCES: * + * * + ***************************************************************************** + * * + * distr: Variance gamma distribution * + * * + * pdf: f(x) = |x-mu|^(lambda-1/2) * exp(beta*(x-mu)) * + * * K_{lambda-1/2}(alpha*|x-mu|)} * + * * + * domain: infinity < x < infinity * + * * + * constant: (alpha^2 - beta^2)^lambda * + * / (sqrt(pi) * (2*alpha)^(lambda-1/2) * Gamma(lambda)) * + * * + * [K_theta(.) ... modified Bessel function of second kind] * + * * + * parameters: 4 * + * 0 : lambda > 0 ... shape * + * 1 : alpha >|beta| ... shape * + * 2 : beta ... shape (asymmetry) * + * 3 : mu ... location * + * * + ***************************************************************************** + * * + * We use the Rmath library for computing the Bessel function K_n. * + * * + ***************************************************************************** + * * + * Copyright (c) 2011-2012 Wolfgang Hoermann and Josef Leydold * + * Institute for Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "vg"; + +/* parameters */ +#define lambda params[0] /* shape */ +#define alpha params[1] /* shape */ +#define beta params[2] /* shape (asymmetry) */ +#define mu params[3] /* location */ + +#define DISTR distr->data.cont +#define LOGNORMCONSTANT (distr->data.cont.norm_constant) + +/* function prototypes */ +#ifdef _unur_SF_bessel_k +static double _unur_pdf_vg( double x, const UNUR_DISTR *distr ); +static double _unur_logpdf_vg( double x, const UNUR_DISTR *distr ); +/* static double _unur_dpdf_vg( double x, const UNUR_DISTR *distr ); */ +/* static double _unur_cdf_vg( double x, const UNUR_DISTR *distr ); */ +#endif + +static int _unur_upd_center_vg( UNUR_DISTR *distr ); +static double _unur_lognormconstant_vg( const double *params, int n_params ); +static int _unur_set_params_vg( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +#ifdef _unur_SF_bessel_k +double +_unur_pdf_vg(double x, const UNUR_DISTR *distr) +{ + /* Original implementation by Kemal Dingic */ + /* f(x) = |x-mu|^(lambda-1/2) * exp(beta*(x-mu)) * K_{lambda-1/2}(alpha*|x-mu|)} */ + + return exp(_unur_logpdf_vg(x,distr)); +} /* end of _unur_pdf_vg() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_vg(double x, const UNUR_DISTR *distr) +{ + /* Original implementation by Kemal Dingic */ + /* f(x) = |x-mu|^(lambda-1/2) * exp(beta*(x-mu)) * K_{lambda-1/2}(alpha*|x-mu|) */ + + const double *params = DISTR.params; + double nu = lambda - 0.5; /* order of modified Bessel function K() */ + double res; /* result of computation */ + double y, absy; /* auxiliary variables */ + + y = x - mu; + absy = fabs(y); + + /* Using nu and y we find: + * f(x) = |y|^nu * exp(beta*y) * K_nu(alpha*|y|) + * and + * log(f(x)) = nu*log(|y|)+ beta*y + log(K_nu(alpha*|y|) + */ + + do { + if (absy>0) { + /* first simply compute Bessel K_nu and compute logarithm. */ + double besk; + + /* we currently use two algorithms based on our experiences + * with the functions in the Rmath library. + * (Maybe we could change this when we link against + * other libraries.) + */ + if (nu < 100) + /* the "standard implementation" using log(bessel_k) */ + besk = _unur_SF_ln_bessel_k(alpha*absy, nu); + else + /* an algorithm for large nu */ + besk = _unur_SF_bessel_k_nuasympt(alpha*absy, nu, TRUE, FALSE); + + /* there can be numerical problems with the Bessel function K_nu. */ + if (_unur_isfinite(besk) && besk < MAXLOG - 20.0) { + /* o.k. */ + res = LOGNORMCONSTANT + besk + log(absy)*nu + beta*y; + break; + } + } + + /* Case: numerical problems with Bessel function K_nu. */ + + if (absy < 1.0) { + /* Case: Bessel function K_nu overflows for small values of y. + * The following code is inspired by gsl_sf_bessel_lnKnu_e() from + * the GSL (GNU Scientific Library). + */ + + res = LOGNORMCONSTANT + beta*y; + res += -M_LN2 + _unur_SF_ln_gamma(nu) + nu*log(2./alpha); + + if (nu > 1.0) { + double xi = 0.25*(alpha*absy)*(alpha*absy); + double sum = 1.0 - xi/(nu-1.0); + if(nu > 2.0) sum += (xi/(nu-1.0)) * (xi/(nu-2.0)); + res += log(sum); + } + } + + else { + /* Case: Bessel function K_nu underflows for very large values of y + * and we get NaN. + * However, then the PDF of the Variance Gamma distribution is 0. + */ + res = -UNUR_INFINITY; + } + + } while(0); + + /* + Remark: a few references + + NIST Digital Library of Mathematical Functions + + http://dlmf.nist.gov/10.27.E3 + K_{-nu}(z) = K_nu(z) + + http://dlmf.nist.gov/10.32.E10 + K_nu(z) = 0.5*(0.5*z)^nu * \int_0^\infty exp(-t-z^2/(4*t)) * t^(-nu-1) dt + + This implies + K_nu(z) = K_{-nu}(z) + = 0.5*(0.5*z)^(-nu) * \int_0^\infty exp(-t-z^2/(4*t)) * t^(nu-1) dt + <= 0.5*(0.5*z)^(-nu) * \int_0^\infty exp(-t) * t^(nu-1) dt + = 0.5*(0.5*z)^(-nu) * Gamma(z) + + http://dlmf.nist.gov/10.30.E2 + K_nu(z) ~ 0.5*Gamma(nu)*(0.5*z)^(-nu) for z->0 + */ + + return res; +} /* end of _unur_logpdf_vg() */ +#endif + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_center_vg( UNUR_DISTR *distr ) +{ + const double *params = DISTR.params; + + /* we use the mean of the distribution: */ + double gam = sqrt(alpha*alpha-beta*beta); + DISTR.center = mu + 2*beta*lambda / (gam*gam); + + /* there is some change of overflow. then we simply use 'mu' */ + if (!_unur_isfinite(DISTR.center)) + DISTR.center = mu; + + /* center must be in domain */ + if (DISTR.center < DISTR.domain[0]) + DISTR.center = DISTR.domain[0]; + else if (DISTR.center > DISTR.domain[1]) + DISTR.center = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_center_vg() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_lognormconstant_vg(const double *params, int n_params ATTRIBUTE__UNUSED) +{ + /* + (alpha^2 - beta^2)^lambda + / (sqrt(pi) * (2*alpha)^(lambda-1/2) * Gamma(lambda)) + */ + + return (lambda*log(alpha*alpha - beta*beta) - 0.5*M_LNPI + - (lambda-0.5)*log(2*alpha) - _unur_SF_ln_gamma(lambda)); +} /* end of _unur_normconstant_vg() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_vg( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 4) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 4) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 4; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter omega */ + if (lambda <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"lambda <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + if (alpha <= fabs(beta)) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"alpha <= |beta|"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.lambda = lambda; + DISTR.alpha = alpha; + DISTR.beta = beta; + DISTR.mu = mu; + + /* default parameters: none */ + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_vg() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_vg( const double *params, int n_params) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_VG; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = _unur_stdgen_vg_init; */ + + /* functions */ +#ifdef _unur_SF_bessel_k + DISTR.pdf = _unur_pdf_vg; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_vg; /* pointer to log-PDF */ +#endif + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_CENTER | + UNUR_DISTR_SET_PDFAREA ); + + /* set parameters for distribution */ + if (_unur_set_params_vg(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* normalization constant */ + LOGNORMCONSTANT = _unur_lognormconstant_vg(DISTR.params,DISTR.n_params); + + /* we need the center of the distribution */ + if (_unur_upd_center_vg(distr)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* mode and area below p.d.f. */ + /* DISTR.mode = ? */ + DISTR.area = 1; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_vg; + + /* function for updating derived parameters */ + /* DISTR.upd_mode = _unur_upd_mode_vg; /\* funct for computing mode *\/ */ + /* DISTR.upd_area = _unur_upd_area_vg; /\* funct for computing area *\/ */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_vg() */ + +/*---------------------------------------------------------------------------*/ +#undef mu +#undef alpha +#undef beta +#undef lambda +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/c_weibull.c b/vendor/unuran-1.11.0/src/distributions/c_weibull.c new file mode 100644 index 0000000..1b06369 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/c_weibull.c @@ -0,0 +1,339 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: c_weibull.c * + * * + * REFERENCES: * + * * + * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 1, 2nd edition * + * John Wiley & Sons, Inc., New York, 1994 * + * * + ***************************************************************************** + * * + * distr: Weibull distribution [2; ch.21, p.628] * + * * + * pdf: f(x) = ((x-zeta)/alpha)^(c-1) * exp(-((x-zeta)/alpha)^c) * + * domain: zeta < x < infinity * + * constant: c / alpha * + * * + * parameters: 3 * + * 0: c > 0 ... shape * + * 1: alpha > 0 (1) ... scale * + * 2: zeta (0) ... location * + * * + ***************************************************************************** + * * + * standard form * + * * + * pdf: f(x) = x^(c-1) * exp(-x^c) * + * domain: 0 < x < infinity * + * constant: c * + * * + * parameters: 1 * + * 0: c >0 ... shape * + * * + * 1: alpha = 1 * + * 2: zeta = 0 * + * * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ +static const char distr_name[] = "weibull"; + +/* parameters */ +#define c params[0] +#define alpha params[1] +#define zeta params[2] + +#define DISTR distr->data.cont +#define NORMCONSTANT (distr->data.cont.norm_constant) + +/* function prototypes */ +static double _unur_pdf_weibull( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_weibull( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_weibull( double x, const UNUR_DISTR *distr ); +static double _unur_invcdf_weibull( double u, const UNUR_DISTR *distr ); + +static int _unur_upd_mode_weibull( UNUR_DISTR *distr ); +static int _unur_upd_area_weibull( UNUR_DISTR *distr ); +static int _unur_set_params_weibull( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_weibull( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 1) + /* standardize */ + x = (x - zeta) / alpha; + + /* standard form */ + + if (x < 0.) + return 0.; + + if (_unur_iszero(x) && _unur_isone(c)) + return NORMCONSTANT; + + if (_unur_iszero(x) && !_unur_isone(c)) + return 0.; + + /* else */ + return (exp (-pow (x, c) + (c-1.) * log (x)) * NORMCONSTANT); + +} /* end of _unur_pdf_weibull() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_weibull( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + register double factor = 1.; + register double xc; + + if (DISTR.n_params > 1) { + /* standardize */ + factor = 1. / alpha; + x = (x - zeta) / alpha; + } + + /* standard form */ + + if (x < 0.) + return 0.; + + if (_unur_iszero(x) && _unur_isone(c)) + return 0.; + + /* else */ + xc = -pow (x, c); + return (exp (xc + (c-2.) * log (x)) * (-1. - c * (-xc-1.)) * NORMCONSTANT * factor); + +} /* end of unur_dpdf_weibull() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_weibull( double x, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + + if (DISTR.n_params > 1) + /* standardize */ + x = (x - zeta) / alpha; + + /* standard form */ + + if (x <= 0.) + return 0.; + + /* else */ + return (1. - exp(-pow (x, c))); + +} /* end of _unur_cdf_weibull() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_invcdf_weibull( double U, const UNUR_DISTR *distr ) +{ + register const double *params = DISTR.params; + double X; + + X = pow( -log(1.-U), 1./c ); + return ((DISTR.n_params==1) ? X : zeta + alpha * X ); +} /* end of _unur_invcdf_weibull() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_weibull( UNUR_DISTR *distr ) +{ + DISTR.mode = (DISTR.c<=1.) ? 0. : DISTR.alpha * pow((DISTR.c - 1.)/DISTR.c, 1./DISTR.c) + DISTR.zeta; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_weibull() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_weibull( UNUR_DISTR *distr ) +{ + /* normalization constant */ + NORMCONSTANT = DISTR.c / DISTR.alpha; + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.area = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.area = ( _unur_cdf_weibull( DISTR.domain[1],distr) + - _unur_cdf_weibull( DISTR.domain[0],distr) ); + return UNUR_SUCCESS; + +} /* end of _unur_upd_area_weibull() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_weibull( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 1) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 3) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 3; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter c */ + if (c <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"c <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* check parameter alpha */ + if (n_params > 1 && alpha <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"alpha <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.c = c; + + /* default parameters */ + DISTR.alpha = 1.; + DISTR.zeta = 0.; + + /* copy optional parameters */ + switch (n_params) { + case 3: + DISTR.zeta = zeta; + /* FALLTHROUGH */ + case 2: + DISTR.alpha = alpha; + n_params = 3; /* number of parameters for non-standard form */ + /* FALLTHROUGH */ + default: + break; + } + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = DISTR.zeta; /* left boundary */ + DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_weibull() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_weibull( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_WEIBULL; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = _unur_stdgen_weibull_init; */ + + /* functions */ + DISTR.pdf = _unur_pdf_weibull; /* pointer to PDF */ + DISTR.dpdf = _unur_dpdf_weibull; /* pointer to derivative of PDF */ + DISTR.cdf = _unur_cdf_weibull; /* pointer to CDF */ + DISTR.invcdf = _unur_invcdf_weibull; /* pointer to inverse CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MODE | + UNUR_DISTR_SET_PDFAREA ); + + /* set parameters for distribution */ + if (_unur_set_params_weibull(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* normalization constant */ + NORMCONSTANT = DISTR.c / DISTR.alpha; + + /* mode and area below p.d.f. */ + DISTR.mode = (DISTR.c<=1.) ? 0. : DISTR.alpha * pow((DISTR.c - 1.)/DISTR.c, 1./DISTR.c) + DISTR.zeta; + DISTR.area = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_weibull; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_weibull; /* funct for computing mode */ + DISTR.upd_area = _unur_upd_area_weibull; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_weibull() */ + +/*---------------------------------------------------------------------------*/ +#undef c +#undef alpha +#undef zeta +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/d_binomial.c b/vendor/unuran-1.11.0/src/distributions/d_binomial.c new file mode 100644 index 0000000..97375da --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/d_binomial.c @@ -0,0 +1,277 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: d_binomial.c * + * * + * REFERENCES: * + * * + * [1] N.L. Johnson, S. Kotz and A.W. Kemp * + * Univariate Discrete Distributions, * + * 2nd edition * + * John Wiley & Sons, Inc., New York, 1992 * + * * + ***************************************************************************** + * * + * distr: Binomial distribution [1; ch.3, p.105] * + * * + * pmf: p(k) = (n \choose k) * p^k * (1-p)^(n-k) * + * domain: 0 <= k <= n * + * constant: 1 * + * * + * parameters: * + * 0: n >= 1 * + * 1: 0 < p < 1 * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "binomial"; + +/*---------------------------------------------------------------------------*/ +/* parameters */ +#define n params[0] +#define p params[1] + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.discr +/* #define LOGNORMCONSTANT (distr->data.discr.norm_constant) */ + +/*---------------------------------------------------------------------------*/ +/* function prototypes */ +static double _unur_pmf_binomial( int k, const UNUR_DISTR *distr ); +static double _unur_cdf_binomial( int k, const UNUR_DISTR *distr ); +#ifdef _unur_SF_invcdf_binomial +static int _unur_invcdf_binomial( double u, const UNUR_DISTR *distr ); +#endif + +static int _unur_upd_mode_binomial( UNUR_DISTR *distr ); +static int _unur_upd_sum_binomial( UNUR_DISTR *distr ); +static int _unur_set_params_binomial( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pmf_binomial(int k, const UNUR_DISTR *distr) +{ + const double *params = DISTR.params; + + if ( k<0 || k>(n+0.5) ) + return 0.; + + else + return exp( k * log(p) + (n-k) * log(1.-p) + + _unur_SF_ln_factorial(n) - _unur_SF_ln_factorial(k) - _unur_SF_ln_factorial(n-k) ) ; + +} /* end of _unur_pmf_binomial() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_binomial(int k, const UNUR_DISTR *distr) +{ + const double *params = DISTR.params; + + if (k<0) + return 0.; + + if (k==0) + return exp(n*(log(1.-p))); + + if(k>(n-0.5)) + return 1.; + + /* else */ + return(_unur_SF_incomplete_beta(1.-p, n-k, k+1.)); + +} /* end of _unur_cdf_binomial() */ + +/*---------------------------------------------------------------------------*/ +#ifdef _unur_SF_invcdf_binomial + +int +_unur_invcdf_binomial(double u, const UNUR_DISTR *distr) +{ + const double *params = DISTR.params; + double x; + + x = _unur_SF_invcdf_binomial(u,n,p); + return ((x>=INT_MAX) ? INT_MAX : ((int) x)); +} /* end of _unur_invcdf_binomial() */ + +#endif +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_binomial( UNUR_DISTR *distr ) +{ + DISTR.mode = (int) ((DISTR.n + 1) * DISTR.p); + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_binomial() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_sum_binomial( UNUR_DISTR *distr ) +{ + /* log of normalization constant: none */ + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.sum = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.sum = ( _unur_cdf_binomial( DISTR.domain[1],distr) + - _unur_cdf_binomial( DISTR.domain[0]-1,distr) ); + return UNUR_SUCCESS; + +} /* end of _unur_upd_sum_binomial() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_binomial( UNUR_DISTR *distr, const double *params, int n_params ) +{ + int nh; + + /* check number of parameters for distribution */ + if (n_params < 2) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 2) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 2; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameters */ + if (p <= 0. || p >= 1. || n <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"p <= 0 || p >= 1 || n <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + + /* round parameter n */ + nh = (int)(n+0.5); + if(fabs(nh-n)>0.001) + _unur_warning(distr_name,UNUR_ERR_DISTR_DOMAIN,"n was rounded to the closest integer value"); + DISTR.n = nh; + DISTR.p = p; + + /* default parameters: none */ + /* copy optional parameters: none */ + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain: [0, n] */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = 0; /* left boundary */ + DISTR.domain[1] = nh; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_binomial() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_binomial( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_discr_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_BINOMIAL; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = _unur_stdgen_binomial_init; + + /* functions */ + DISTR.pmf = _unur_pmf_binomial; /* pointer to PMF */ + DISTR.cdf = _unur_cdf_binomial; /* pointer to CDF */ +#ifdef _unur_SF_invcdf_binomial + DISTR.invcdf = _unur_invcdf_binomial; /* pointer to inverse CDF */ +#endif + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_PMFSUM | + UNUR_DISTR_SET_MODE ); + + /* set parameters for distribution */ + if (_unur_set_params_binomial(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* log of normalization constant: none */ + + /* mode and sum over PMF */ + DISTR.mode = (int) ((DISTR.n + 1) * DISTR.p); + DISTR.sum = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_binomial; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_binomial; /* funct for computing mode */ + DISTR.upd_sum = _unur_upd_sum_binomial; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_binomial() */ + +/*---------------------------------------------------------------------------*/ +#undef p +#undef r +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/d_binomial_gen.c b/vendor/unuran-1.11.0/src/distributions/d_binomial_gen.c new file mode 100644 index 0000000..6e5787e --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/d_binomial_gen.c @@ -0,0 +1,332 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: d_binomial_gen.c * + * * + * Special generators for Binomial distribution * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include /* for the definition of `UNUR_STDGEN_INVERSION' */ +#include +#include "unur_distributions_source.h" + +/*---------------------------------------------------------------------------*/ +/* init routines for special generators */ + +inline static int binomial_bruec_init( struct unur_gen *gen ); +static int _unur_stdgen_sample_binomial_bruec( struct unur_gen *gen ); + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define PAR ((struct unur_dstd_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_dstd_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.discr /* data for distribution in generator object */ + +#define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ + +/* #define MAX_gen_params (11) maximal number of parameters for generator */ +/* #define MAX_gen_iparams (3) maximal number of integer param. for gen. */ + +/* parameters */ +#define par_n (DISTR.params[0]) +#define par_p (DISTR.params[1]) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Inititialize **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_binomial_init( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize special generator for Binomial distribution */ + /* if gen == NULL then only check existance of variant. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* one of par and gen must not be the NULL pointer */ + switch ((par) ? par->variant : gen->variant) { + + case 0: /* DEFAULT */ + case 1: /* Ratio of Uniforms/Inversion */ + if (gen==NULL) return UNUR_SUCCESS; /* test existence only */ + _unur_dstd_set_sampling_routine(gen, _unur_stdgen_sample_binomial_bruec ); + return binomial_bruec_init( gen ); + + default: /* no such generator */ + return UNUR_FAILURE; + } + +} /* end of _unur_stdgen_binomial_init() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Special generators **/ +/** **/ +/*****************************************************************************/ + +#define flogfak(k) _unur_SF_ln_factorial(k) + +/***************************************************************************** + * * + * Binomial Distribution - Ratio of Uniforms/Inversion * + * * + ***************************************************************************** + * * + * Ratio of Uniforms method combined with Inversion for sampling from * + * Binomial distributions with parameters n (number of trials) and * + * p (probability of success). * + * For min(n*p,n*(1-p)) < 5 the Inversion method is applied: * + * The random numbers are generated via sequential search, starting at the * + * lowest index k=0. The cumulative probabilities are avoided by using the * + * technique of chop-down. * + * For min(n*p,n*(1-p)) >=5 Ratio of Uniforms is employed: * + * A table mountain hat function h(x) with optimal scale parameter s for * + * fixed location parameter a = mu+1/2 is used. If the candidate k is * + * near the mode and k>29 (respectively n-k > 29) f(k) is computed * + * recursively starting at the mode m. The algorithm is valid for * + * np > 0, n > =1, p <= 0.5. For p > 0.5, p is replaced by 1-p and * + * k is replaced by n-k. * + * * + ***************************************************************************** + * * + * FUNCTION: - bruec samples a random number from the Binomial * + * distribution with parameters n and p . It is valid for * + * n * min(p,1-p) > 0. * + * * + * REFERENCE: - E. Stadlober (1989): Sampling from Poisson, binomial and * + * hypergeometric distributions: ratio of uniforms as a * + * simple and fast alternative, * + * Bericht 303, Math. Stat. Sektion, Forschungsgesellschaft * + * Joanneum, Graz. * + * * + * Implemented by R.Kremer 1990, revised by P.Busswald, July 1992 * + ***************************************************************************** + * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#define GEN_N_IPARAMS (3) +#define GEN_N_PARAMS (10) + +#define p (DISTR.params[1]) +#define n (GEN->gen_iparam[0]) + +#define b (GEN->gen_iparam[1]) +#define m (GEN->gen_iparam[2]) + +#define par (GEN->gen_param[0]) +#define q1 (GEN->gen_param[1]) +#define np (GEN->gen_param[2]) +#define a (GEN->gen_param[3]) +#define h (GEN->gen_param[4]) +#define g (GEN->gen_param[5]) +#define r (GEN->gen_param[6]) +#define t (GEN->gen_param[7]) +#define r1 (GEN->gen_param[8]) +#define p0 (GEN->gen_param[9]) +/*---------------------------------------------------------------------------*/ + +int +binomial_bruec_init( struct unur_gen *gen ) +{ + int bh,k1; + double c,x; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_DSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + if (GEN->gen_iparam == NULL || GEN->n_gen_iparam != GEN_N_IPARAMS) { + GEN->n_gen_iparam = GEN_N_IPARAMS; + GEN->gen_iparam = _unur_xrealloc(GEN->gen_iparam, GEN->n_gen_iparam * sizeof(int)); + } + + /* convert integer parameters that are stored in an array of type 'double' */ + /* into those of type 'int' and store it in working array GEN->gen_iparam. */ + n = (int) par_n; + + /* -X- setup code -X- */ + + par = _unur_min(p, 1.-p); + q1 = 1.0 - par; + np = n*par; /*np=min(n*p,n*(1-p))*/ + + if (np < 5) { + p0 = exp(n*log(q1)); /* Set-up for Inversion */ + bh = (int)(np + 10.0*sqrt(np*q1)); + b = _unur_min(n,bh); /* safety-bound */ + + /* initialize (unused) variables */ + m = 0; + r1 = t = r = g = h = a = 0.; + } + + else { /* Set-up for Ratio of Uniforms */ + m = (int)(np + par); /* mode */ + a = np + 0.5; /* shift parameter */ + c = sqrt(2.0 * a * q1); + r = par/q1; + t = (n+1) * r; + r1 = log(r); + bh = (int)(a + 7.0*c); + b = _unur_min(n,bh); /* safety-bound */ + g = flogfak(m) + flogfak(n-m); /* binomial const. */ + k1 = (int)(a-c); + x = (a-k1-1.0)/(a-k1); + if((n-k1)*par*x*x > (k1+1)*q1) + k1++; /* h=2*s */ + h = (a-k1) * exp(.5*((k1-m)*r1+g-flogfak(k1)-flogfak(n-k1))+M_LN2); + + /* initialize (unused) variables */ + p0 = 0.; + } + + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of binomial_bruec_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_sample_binomial_bruec( struct unur_gen *gen ) +{ + /* -X- generator code -X- */ + + int i,k; + double u,f,x,lf; + + /* check arguments */ + CHECK_NULL(gen,INT_MAX); + COOKIE_CHECK(gen,CK_DSTD_GEN,INT_MAX); + + if (np<5) { + /* Inversion/Chop-down */ + + double pk; + + k = 0; + pk = p0; + u = uniform(); + while (u>pk) { + ++k; + if (k>b) { + u = uniform(); + k = 0; + pk=p0; + } + else { + u -= pk; + pk=(double)(((n-k+1)*par*pk)/(k*q1)); + } + } + return ((p>0.5) ? n-k:k); + } + + /* Ratio of Uniforms */ + for (;;) { + do { + u = uniform(); + x = a+h*(uniform()-0.5)/u; + } while (x < 0 || ((k=(int)x) > b)); /* check, if k is valed candidate */ + + if ((abs(m-k)<=15) && ((k>29)||(n-k>29)) ) { + f = 1.0; /* compute f(k) recursively */ + if (m 0.5) ? n-k : k); + + /* -X- end of generator code -X- */ + +} /* end of _unur_stdgen_sample_binomial_bruec() */ + +/*---------------------------------------------------------------------------*/ +#undef GEN_N_IPARAMS +#undef GEN_N_PARAMS + +#undef p +#undef n + +#undef m +#undef b + +#undef par +#undef q1 +#undef np +#undef al +#undef h +#undef g +#undef r +#undef t +#undef r1 +#undef p0 + +#undef par_n +#undef par_p + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/d_geometric.c b/vendor/unuran-1.11.0/src/distributions/d_geometric.c new file mode 100644 index 0000000..5ec863c --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/d_geometric.c @@ -0,0 +1,239 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: d_geometric.c * + * * + * REFERENCES: * + * * + * [1] N.L. Johnson, S. Kotz and A.W. Kemp * + * Univariate Discrete Distributions, * + * 2nd edition * + * John Wiley & Sons, Inc., New York, 1992 * + * * + ***************************************************************************** + * * + * distr: Geometric distribution [1; ch.5.2, p.201] * + * * + * pmf: p(k) = p * (1-p)^k * + * domain: 0 <= k < infinity * + * constant: 1 * + * * + * parameters: * + * 0: 0 < p < 1 ... shape * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "geometric"; + +/* parameters */ +#define p params[0] + +#define DISTR distr->data.discr +/* #define NORMCONSTANT (distr->data.discr.norm_constant) */ + +/*---------------------------------------------------------------------------*/ + +/* function prototypes */ +static double _unur_pmf_geometric( int k, const UNUR_DISTR *distr ); +static double _unur_cdf_geometric( int k, const UNUR_DISTR *distr ); +static int _unur_invcdf_geometric( double u, const UNUR_DISTR *distr ); + +static int _unur_upd_mode_geometric( UNUR_DISTR *distr ); +static int _unur_upd_sum_geometric( UNUR_DISTR *distr ); +static int _unur_set_params_geometric( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pmf_geometric(int k, const UNUR_DISTR *distr) +{ + return ((k<0) ? 0. : DISTR.p * pow( 1. - DISTR.p, (double)k )); +} /* end of _unur_pmf_geometric() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_geometric(int k, const UNUR_DISTR *distr) +{ + return ((k<0) ? 0. : (1. - pow(1. - DISTR.p, k+1.)) ); +} /* end of _unur_cdf_geometric() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_invcdf_geometric(double u, const UNUR_DISTR *distr) +{ + double x; + + if (_unur_isone(DISTR.p)) + return 0; + + /* else */ + x = ceil(log1p(-u) / log1p(-DISTR.p) - 1.); + + return ((x>=INT_MAX) ? INT_MAX : ((int) x)); +} /* end of _unur_invcdf_geometric() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_geometric( UNUR_DISTR *distr ) +{ + DISTR.mode = 0; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0] || DISTR.mode > DISTR.domain[1]) + DISTR.mode = (DISTR.domain[0]<0) ? 0 : DISTR.domain[0]; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_geometric() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_sum_geometric( UNUR_DISTR *distr ) +{ + /* normalization constant: none */ + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.sum = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.sum = ( _unur_cdf_geometric( DISTR.domain[1],distr) + - _unur_cdf_geometric( DISTR.domain[0]-1,distr) ); + return UNUR_SUCCESS; + +} /* end of _unur_upd_sum_geometric() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_geometric( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 1) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 1) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 1; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter p */ + if (p <= 0. || p >= 1.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"p <= 0 || p >= 1"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.p = p; + + /* default parameters: none */ + /* copy optional parameters: none */ + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain: [0,inifinity] */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = 0; /* left boundary */ + DISTR.domain[1] = INT_MAX; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_geometric() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_geometric( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_discr_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_GEOMETRIC; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = _unur_stdgen_geometric_init; */ + + /* functions */ + DISTR.pmf = _unur_pmf_geometric; /* pointer to PMF */ + DISTR.cdf = _unur_cdf_geometric; /* pointer to CDF */ + DISTR.invcdf = _unur_invcdf_geometric; /* pointer to invsere of CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MODE | + UNUR_DISTR_SET_PMFSUM ); + + /* set parameters for distribution */ + if (_unur_set_params_geometric(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* log of normalization constant: none */ + + /* mode and sum over PMF */ + DISTR.mode = 0; + DISTR.sum = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_geometric; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_geometric; /* funct for computing mode */ + DISTR.upd_sum = _unur_upd_sum_geometric; /* funct for computing sum */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_geometric() */ + +/*---------------------------------------------------------------------------*/ +#undef p +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/d_hypergeometric.c b/vendor/unuran-1.11.0/src/distributions/d_hypergeometric.c new file mode 100644 index 0000000..8f32ca5 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/d_hypergeometric.c @@ -0,0 +1,291 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: d_hypergeometric.c * + * * + * REFERENCES: * + * * + * [1] N.L. Johnson, S. Kotz and A.W. Kemp * + * Univariate Discrete Distributions, * + * 2nd edition * + * John Wiley & Sons, Inc., New York, 1992 * + * * + ***************************************************************************** + * * + * distr: Hypergeometric distribution [1; ch.6, p.237] * + * * + * pmf: p(k) = (M \choose k) * (N-M \choose n-k) / (N \choose n) * + * domain: max(0,n-N+M) <= k <= min(n,M) * + * constant: 1 * + * * + * parameters: * + * 0: N >= M * + * 1: M >= 1 * + * 2: n n >= 1 * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "hypergeometric"; + +/*---------------------------------------------------------------------------*/ +/* parameters */ +#define N params[0] +#define M params[1] +#define n params[2] + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.discr +#define LOGNORMCONSTANT (distr->data.discr.norm_constant) + +/*---------------------------------------------------------------------------*/ +/* function prototypes */ +static double _unur_pmf_hypergeometric( int k, const UNUR_DISTR *distr ); +#ifdef _unur_SF_cdf_hypergeometric +static double _unur_cdf_hypergeometric( int k, const UNUR_DISTR *distr ); +#endif +#ifdef _unur_SF_invcdf_hypergeometric +static int _unur_invcdf_hypergeometric( double u, const UNUR_DISTR *distr ); +#endif + +static int _unur_upd_mode_hypergeometric( UNUR_DISTR *distr ); +static int _unur_upd_sum_hypergeometric( UNUR_DISTR *distr ); +static int _unur_set_params_hypergeometric( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pmf_hypergeometric(int k, const UNUR_DISTR *distr) +{ + register const double *params = DISTR.params; + + if ( k < _unur_max(0,(n-N+M-0.5)) || k > _unur_min(n,M)+0.5 ) + return 0.; + + else + return exp( LOGNORMCONSTANT - _unur_SF_ln_factorial(k) - _unur_SF_ln_factorial(M-k) - + _unur_SF_ln_factorial(n-k) - _unur_SF_ln_factorial(N-M-n+k) ); + +} /* end of _unur_pmf_hypergeometric() */ + +/*---------------------------------------------------------------------------*/ +#ifdef _unur_SF_cdf_hypergeometric + +double +_unur_cdf_hypergeometric(int k, const UNUR_DISTR *distr) +{ + const double *params = DISTR.params; + + return _unur_SF_cdf_hypergeometric(k,N,M,n); +} /* end of _unur_cdf_hypergeometric() */ + +#endif +/*---------------------------------------------------------------------------*/ +#ifdef _unur_SF_invcdf_hypergeometric + +int +_unur_invcdf_hypergeometric(double u, const UNUR_DISTR *distr) +{ + const double *params = DISTR.params; + double x; + + x = _unur_SF_invcdf_hypergeometric(u,N,M,n); + return ((x>=INT_MAX) ? INT_MAX : ((int) x)); +} /* end of _unur_invcdf_hypergeometric() */ + +#endif +/*---------------------------------------------------------------------------*/ +int +_unur_upd_mode_hypergeometric( UNUR_DISTR *distr ) +{ + DISTR.mode = (int) ( (DISTR.n + 1) * (DISTR.M + 1.) / (DISTR.N + 2.) ); + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_hypergeometric() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_sum_hypergeometric( UNUR_DISTR *distr ) +{ + register double *params = DISTR.params; + + /* log of normalization constant: none */ + LOGNORMCONSTANT = _unur_SF_ln_factorial(M) + _unur_SF_ln_factorial(N-M) + _unur_SF_ln_factorial(n) + + _unur_SF_ln_factorial(N-n) - _unur_SF_ln_factorial(N); + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.sum = 1.; + return UNUR_SUCCESS; + } + +#ifdef _unur_SF_cdf_hypergeometric + /* else */ + DISTR.sum = ( _unur_cdf_hypergeometric( DISTR.domain[1],distr) + - _unur_cdf_hypergeometric( DISTR.domain[0]-1,distr) ); + return UNUR_SUCCESS; +#else + return UNUR_ERR_DISTR_REQUIRED; +#endif + +} /* end of _unur_upd_sum_hypergeometric() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_hypergeometric( UNUR_DISTR *distr, const double *params, int n_params ) +{ + int nh; + + /* check number of parameters for distribution */ + if (n_params < 3) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 3) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 3; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameters */ + if (M <= 0. || N <=0. || n <= 0. || n >= N || M >= N ) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"M, N, n must be > 0 and n0.001) + _unur_warning(distr_name,UNUR_ERR_DISTR_DOMAIN,"n was rounded to the closest integer value"); + DISTR.N = nh; + + nh = (int)(M+0.5); + if(fabs(nh-M)>0.001) + _unur_warning(distr_name,UNUR_ERR_DISTR_DOMAIN,"n was rounded to the closest integer value"); + DISTR.M = nh; + + nh = (int)(n+0.5); + if(fabs(nh-n)>0.001) + _unur_warning(distr_name,UNUR_ERR_DISTR_DOMAIN,"n was rounded to the closest integer value"); + DISTR.n = nh; + + /* default parameters: none */ + /* copy optional parameters: none */ + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = (int) (_unur_max(0,(DISTR.n - DISTR.N + DISTR.M + 0.5))); /* left boundary */ + DISTR.domain[1] = (int) (_unur_min(DISTR.n, DISTR.M) + 0.5); /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_hypergeometric() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_hypergeometric( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_discr_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_HYPERGEOMETRIC; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = _unur_stdgen_hypergeometric_init; + + /* functions */ + DISTR.pmf = _unur_pmf_hypergeometric; /* pointer to PMF */ +#ifdef _unur_SF_cdf_hypergeometric + DISTR.cdf = _unur_cdf_hypergeometric; /* pointer to CDF */ +#endif +#ifdef _unur_SF_invcdf_hypergeometric + DISTR.invcdf = _unur_invcdf_hypergeometric; /* pointer to inverse CDF */ +#endif + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_PMFSUM | + UNUR_DISTR_SET_MODE ); + + /* set parameters for distribution */ + if (_unur_set_params_hypergeometric(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* log of normalization constant */ + _unur_upd_sum_hypergeometric( distr ); + + /* mode and sum over PMF */ + _unur_upd_mode_hypergeometric(distr); + DISTR.sum = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_hypergeometric; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_hypergeometric; /* funct for computing mode */ + DISTR.upd_sum = _unur_upd_sum_hypergeometric; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_hypergeometric() */ + +/*---------------------------------------------------------------------------*/ +#undef N +#undef M +#undef n +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/d_hypergeometric_gen.c b/vendor/unuran-1.11.0/src/distributions/d_hypergeometric_gen.c new file mode 100644 index 0000000..29ea107 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/d_hypergeometric_gen.c @@ -0,0 +1,381 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: d_hypergeometric_gen.c * + * * + * Special generators for Hypergeometric distribution * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include /* for the definition of `UNUR_STDGEN_INVERSION' */ +#include +#include "unur_distributions_source.h" + +/*---------------------------------------------------------------------------*/ +/* init routines for special generators */ + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define PAR ((struct unur_dstd_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_dstd_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.discr /* data for distribution in generator object */ + +#define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ + +/* #define MAX_gen_params (8) maximal number of parameters for generator */ +/* #define MAX_gen_iparams (9) maximal number of integer parameters for generator */ + +/* parameters */ +#define par_N (DISTR.params[0]) +#define par_M (DISTR.params[1]) +#define par_n (DISTR.params[2]) + +/*---------------------------------------------------------------------------*/ +/* init routines for special generators */ + +inline static int hypergeometric_hruec_init( struct unur_gen *gen ); +static int _unur_stdgen_sample_hypergeometric_hruec( struct unur_gen *gen ); +inline static int h_util(int N_, int M_, int n_, int k_); + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Inititialize **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_hypergeometric_init( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize special generator for Hypergeometric distribution */ + /* if gen == NULL then only check existance of variant. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* one of par and gen must not be the NULL pointer */ + switch ((par) ? par->variant : gen->variant) { + + case 0: /* DEFAULT */ + case 1: /* HRUEC method */ + _unur_dstd_set_sampling_routine(gen, _unur_stdgen_sample_hypergeometric_hruec ); + return hypergeometric_hruec_init( gen ); + + default: /* no such generator */ + return UNUR_FAILURE; + } + +} /* end of _unur_stdgen_hypergeometric_init() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Special generators **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Hypergeometric Distribution - Ratio of Uniforms/Inversion * + * * + ***************************************************************************** + * * + * Ratio of Uniforms combined with Inversion for sampling from * + * Hypergeometric distributions with parameters N, M and n. The algorithm * + * is valid for M <= N/2, n <= N/2. Otherwise parameters (at the beginning * + * of the algorithm) and random numbers k are adapted in function h_util(). * + * For mode m < 5 Inversion is applied: * + * The random numbers are generated via sequential search, starting at the * + * lowest index k=0. The cumulative probabilities are avoided by using the * + * technique of chop-down. * + * For mode m >=5 Ratio of Uniforms is employed: A table mountain hat * + * function h(x) with optimal scale parameter s for fixed location * + * parameter a = mu+1/2 is used. * + * If the mode m <= 20 and the candidate k is near the mode f(k) is * + * computed recursively starting at the mode m. * + * * + ***************************************************************************** + * * + * FUNCTION: - hruec samples a random number from the Hypergeometric * + * distribution with parameters N (number of red and * + * black balls), M (number of red balls) and n (number of * + * trials) valid for N >= 2, M,n <= N. * + * REFERENCE: - E. Stadlober (1989): Sampling from Poisson, binomial and * + * hypergeometric distributions: ratio of uniforms as a * + * simple and fast alternative, * + * Bericht 303, Math. Stat. Sektion, * + * Forschungsgesellschaft Joanneum, Graz. * + * * + * Implemented by R.Kremer 1990, revised by P.Busswald, July 1992 * + ***************************************************************************** + * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * + *****************************************************************************/ + +#define flogfak(k) (_unur_SF_ln_factorial(k)) +#define delta(k) (flogfak(k)+flogfak(Mc-k)+flogfak(nc-k)+flogfak(NMn+k)) + +/*---------------------------------------------------------------------------*/ +#define GEN_N_IPARAMS (9) +#define GEN_N_PARAMS (8) + +#define N (GEN->gen_iparam[0]) +#define M (GEN->gen_iparam[1]) +#define n (GEN->gen_iparam[2]) + +#define b (GEN->gen_iparam[3]) +#define m (GEN->gen_iparam[4]) +#define NMn (GEN->gen_iparam[5]) +#define Mc (GEN->gen_iparam[6]) +#define nc (GEN->gen_iparam[7]) +#define N_half (GEN->gen_iparam[8]) + +#define NMnp (GEN->gen_param[0]) +#define Np (GEN->gen_param[1]) +#define Mp (GEN->gen_param[2]) +#define np (GEN->gen_param[3]) +#define g (GEN->gen_param[4]) +#define a (GEN->gen_param[5]) +#define h (GEN->gen_param[6]) +#define p0 (GEN->gen_param[7]) + +/*---------------------------------------------------------------------------*/ + +int +hypergeometric_hruec_init( struct unur_gen *gen ) +{ + int k1,bh; + double x,p,q,c,my; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_DSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + if (GEN->gen_iparam == NULL || GEN->n_gen_iparam != GEN_N_IPARAMS) { + GEN->n_gen_iparam = GEN_N_IPARAMS; + GEN->gen_iparam = _unur_xrealloc(GEN->gen_iparam, GEN->n_gen_iparam * sizeof(int)); + } + + /* convert integer parameters that are stored in an array of type 'double' */ + /* into those of type 'int' and store it in working array GEN->gen_iparam. */ + N = (int) par_N; + M = (int) par_M; + n = (int) par_n; + + /* -X- setup code -X- */ + + N_half = N/2; /* Preparations of the parameters */ + Mc = (M<=N_half) ? M : N-M; /* if M<=N/2, M is replaced by N-M */ + nc = (n<=N_half) ? n : N-n; /* if n<=N/2, n is replaced by n-M */ + + /* Set-up */ + Np = (double) N; + Mp = (double) Mc; + np = (double) nc; + + NMn = N - Mc - nc; + NMnp = Np - Mp - np; + p = Mp / Np; + q = 1.0 - p; + my = np * p; + bh = _unur_min(nc,Mc); + m = (int) ((np+1.0)*(Mp+1.0)/(Np+2.0)); /* mode */ + + if (m < 5) { + /* Set-up for Inversion */ + c = my + 10.0*sqrt(my*q*(1.0-np/Np)); + b = _unur_min(bh,(int)c); /* safety-bound */ + p0 = exp(flogfak(N-Mc)+flogfak(N-nc)-flogfak(NMn)-flogfak(N)); + + /* initialize (unused) variables */ + h = a = g = 0.; + } + + else { + /* Set-up for Ratio of Uniforms */ + a = my+0.5; + c = sqrt(2.0*a*q*(1.0-np/Np)); + b = _unur_min(bh,(int)(a+7.0*c)); /* safety-bound */ + g = delta(m); + k1 = (int)(a-c); + x = (a-k1-1.0)/(a-k1); + if((np-k1)*(p-(double)k1/Np)*x*x > (k1+1)*(q-(np-k1-1.0)/Np)) + k1++; + h = (a-k1)*exp(0.5*(g-delta(k1))+M_LN2); /* h=2*s */ + + /* initialize (unused) variables */ + p0 = 0.; + } + + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of hypergeometric_hruec_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_sample_hypergeometric_hruec( struct unur_gen *gen ) +{ + int k,i; + double x,u,f,lf; + + /* check arguments */ + CHECK_NULL(gen,INT_MAX); + COOKIE_CHECK(gen,CK_DSTD_GEN,INT_MAX); + + /* -X- generator code -X- */ + + if (m<5) { /* Inversion/Chop-down */ + double pk; + + k = 0; + pk = p0; + u = uniform(); + while (u>pk) { + ++k; + if (k>b) { + u = uniform(); + k = 0; + pk = p0; + } + else { + u -= pk; + pk *= ((Mp-k+1.0)*(np-k+1.0)) / ((double)k*(NMnp+k)); + } + } + + return (h_util(N,M,n,k)); + } + + for (;;) { /* Ratio of Uniforms */ + do { + u = uniform(); + x = a + h*(uniform()-0.5) / u; + } while (x < 0 || ((k=(int)x) > b)); /* check, if k is valid candidate */ + + if (m <= 20 || abs(m-k) <= 15) { /* compute f(k) recursively */ + f = 1.0; + if (m +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "logarithmic"; + +/* parameters */ +#define theta params[0] + +#define DISTR distr->data.discr +#define NORMCONSTANT (distr->data.discr.norm_constant) + +/*---------------------------------------------------------------------------*/ + +/* no CDF for distribution */ +#undef HAVE_CDF + +/*---------------------------------------------------------------------------*/ + +/* function prototypes */ +static double _unur_pmf_logarithmic( int k, const UNUR_DISTR *distr ); +#ifdef HAVE_CDF +static double _unur_cdf_logarithmic( int k, const UNUR_DISTR *distr ); +#endif + +static int _unur_upd_mode_logarithmic( UNUR_DISTR *distr ); +static int _unur_upd_sum_logarithmic( UNUR_DISTR *distr ); +static int _unur_set_params_logarithmic( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pmf_logarithmic(int k, const UNUR_DISTR *distr) +{ + return ((k<1) ? 0. : pow( DISTR.theta, (double)k ) / k * NORMCONSTANT); +} /* end of _unur_pmf_logarithmic() */ + +/*---------------------------------------------------------------------------*/ + +#ifdef HAVE_CDF + +double +_unur_cdf_logarithmic(int k, const UNUR_DISTR *distr) +{ + /** TODO: CDF **/ + return 0.; +} /* end of _unur_cdf_logarithmic() */ + +#endif + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_logarithmic( UNUR_DISTR *distr ) +{ + DISTR.mode = 1; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_logarithmic() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_sum_logarithmic( UNUR_DISTR *distr ) +{ + /* normalization constant */ + NORMCONSTANT = -1. / log( 1.-DISTR.theta); + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.sum = 1.; + return UNUR_SUCCESS; + } + +#ifdef HAVE_CDF + /* else */ + DISTR.sum = ( _unur_cdf_logarithmic( DISTR.domain[1],distr) + - _unur_cdf_logarithmic( DISTR.domain[0]-1,distr) ); + return UNUR_SUCCESS; +#else + return UNUR_ERR_DISTR_REQUIRED; +#endif + +} /* end of _unur_upd_sum_logarithmic() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_logarithmic( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 1) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 1) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 1; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter theta */ + if (theta <= 0. || theta >= 1.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"theta <= 0 || theta >= 1"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.theta = theta; + + /* default parameters: none */ + /* copy optional parameters: none */ + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain: [1, infinity] */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = 1; /* left boundary */ + DISTR.domain[1] = INT_MAX; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_logarithmic() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_logarithmic( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_discr_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_LOGARITHMIC; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = _unur_stdgen_logarithmic_init; + + /* functions */ + DISTR.pmf = _unur_pmf_logarithmic; /* pointer to PMF */ +#ifdef HAVE_CDF + DISTR.cdf = _unur_cdf_logarithmic; /* pointer to CDF */ +#endif + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MODE | + UNUR_DISTR_SET_PMFSUM ); + + /* set parameters for distribution */ + if (_unur_set_params_logarithmic(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* normalization constant */ + NORMCONSTANT = -1. / log( 1.-DISTR.theta); + + /* mode and sum over PMF */ + DISTR.mode = 1; + DISTR.sum = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_logarithmic; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_logarithmic; /* funct for computing mode */ + DISTR.upd_sum = _unur_upd_sum_logarithmic; /* funct for computing sum */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_logarithmic() */ + +/*---------------------------------------------------------------------------*/ +#undef theta +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/d_logarithmic_gen.c b/vendor/unuran-1.11.0/src/distributions/d_logarithmic_gen.c new file mode 100644 index 0000000..bec89f7 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/d_logarithmic_gen.c @@ -0,0 +1,228 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: d_logarithmic_gen.c * + * * + * Special generators for Logarithmic distribution * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include /* for the definition of `UNUR_STDGEN_INVERSION' */ +#include +#include "unur_distributions_source.h" + +/*---------------------------------------------------------------------------*/ +/* init routines for special generators */ + +inline static int logarithmic_lsk_init( struct unur_gen *gen ); + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define PAR ((struct unur_dstd_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_dstd_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.discr /* data for distribution in generator object */ + +#define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ + +/* #define MAX_gen_params 2 maximal number of parameters for generator */ + +/* parameters */ +#define theta (DISTR.params[0]) /* shape */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Inititialize **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_logarithmic_init( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize special generator for Logarithmic distribution */ + /* if gen == NULL then only check existance of variant. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* one of par and gen must not be the NULL pointer */ + switch ((par) ? par->variant : gen->variant) { + + case 0: /* DEFAULT */ + case 1: /* Inversion/Transformation */ + _unur_dstd_set_sampling_routine(gen, _unur_stdgen_sample_logarithmic_lsk ); + return logarithmic_lsk_init( gen ); + + default: /* no such generator */ + return UNUR_FAILURE; + } + +} /* end of _unur_stdgen_logarithmic_init() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Special generators **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Logarithmic Distribution: Inversion/Transformation * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from the Logarithmic distribution * + * with parameter 0 < theta < 1. * + * * + * REFERENCE: - A.W. Kemp (1981): Efficient generation of logarithmically * + * distributed pseudo-random variables, * + * Appl. Statist. 30, 249-253. * + * * + * Implemented by R.Kremer 1990, revised by P.Busswald, July 1992 * + ***************************************************************************** + * * + * The algorithm combines Inversion and Transformation. * + * It is based on the following fact: A random variable X from the * + * Logarithmic distribution has the property that X for fixed Y = y is * + * Geometric distributed with * + * (*) P(X=x|Y=y) = (1-y) * y^(x-1) * + * where Y has distribution function F(y) = ln(1-y) / ln(1-p). * + * So first random numbers y are generated by simple Inversion, then * + * k = (int)(1+ln(u) / ln(y)) is a Geometric random number and because of * + * (*) a Logarithmic one. * + * To speed up the algorithm squeezes are used as well as the fact, that * + * many of the random numbers are 1 or 2 (depending on special * + * circumstances). * + * On an IBM/PC 486 optimal performance is achieved, if for p<0.97 simple * + * inversion is used and otherwise the transformation. * + * On an IBM/PC 286 inversion should be restricted to p<0.90. * + * * + ***************************************************************************** + * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#define GEN_N_PARAMS (2) +#define t (GEN->gen_param[0]) +#define h (GEN->gen_param[1]) + +#define theta_limit 0.97 +/* theta < theta_limit --> Inversion + theta >= theta_limit --> Transformation */ +/*---------------------------------------------------------------------------*/ + +inline static int +logarithmic_lsk_init( struct unur_gen *gen ) +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_DSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + t = 0.; h = 0.; /* initialize variables */ + } + + /* -X- setup code -X- */ + if (theta < theta_limit) + t = -theta / log(1.0 - theta); + else + h=log(1.0 - theta); + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of logarithmic_lsk_init() */ + + +int +_unur_stdgen_sample_logarithmic_lsk( struct unur_gen *gen ) +{ + /* -X- generator code -X- */ + double U, V, p, q; + int K; + + /* check arguments */ + CHECK_NULL(gen,INT_MAX); + COOKIE_CHECK(gen,CK_DSTD_GEN,INT_MAX); + + U = uniform(); + + if (theta < theta_limit) { + /* Inversion/Chop-down */ + K = 1; + p = t; + while (U > p) { + U -= p; + K++; + p *= theta * (K - 1.)/((double) K); + } + return K; + } + + else { + /* Transformation */ + if (U > theta) + return 1; + + V = uniform(); + q = 1. - exp(V * h); + if ( U <= q * q) { + K = 1 + (int)(log(U)/log(q)); + return K; + } + + return ((U > q) ? 1 : 2); + } + + /* -X- end of generator code -X- */ + +} /* end of _unur_stdgen_sample_logarithmic_lsk() */ + +/*---------------------------------------------------------------------------*/ +#undef GEN_N_PARAMS +#undef t +#undef h +#undef theta_limit +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/d_negativebinomial.c b/vendor/unuran-1.11.0/src/distributions/d_negativebinomial.c new file mode 100644 index 0000000..c1b5a79 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/d_negativebinomial.c @@ -0,0 +1,284 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: d_negativebinomial.c * + * * + * REFERENCES: * + * * + * [1] N.L. Johnson, S. Kotz and A.W. Kemp * + * Univariate Discrete Distributions, * + * 2nd edition * + * John Wiley & Sons, Inc., New York, 1992 * + * * + ***************************************************************************** + * * + * distr: Negative Binomial distribution [1; ch.5.1, p.200] * + * * + * pmf: p(k) = (k+r-1 \choose r-1) * p^r * (1-p)^k * + * domain: 0 <= k < infinity * + * constant: 1 * + * * + * parameters: * + * 0: 0 < p < 1 * + * 1: r > 0 * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "negativebinomial"; + +/*---------------------------------------------------------------------------*/ +/* parameters */ +#define p params[0] +#define r params[1] + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.discr +#define LOGNORMCONSTANT (distr->data.discr.norm_constant) + +/*---------------------------------------------------------------------------*/ +/* function prototypes */ + +static double _unur_pmf_negativebinomial( int k, const UNUR_DISTR *distr ); +#ifdef _unur_SF_cdf_negativebinomial +static double _unur_cdf_negativebinomial( int k, const UNUR_DISTR *distr ); +#endif +#ifdef _unur_SF_invcdf_negativebinomial +static int _unur_invcdf_negativebinomial( double u, const UNUR_DISTR *distr ); +#endif + +static int _unur_upd_mode_negativebinomial( UNUR_DISTR *distr ); +static int _unur_upd_sum_negativebinomial( UNUR_DISTR *distr ); +static int _unur_set_params_negativebinomial( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pmf_negativebinomial(int k, const UNUR_DISTR *distr) +{ + const double *params = DISTR.params; + + if (k<0) + return 0.; + + else + return exp( k*log(1-p) + + _unur_SF_ln_gamma(k+r) - _unur_SF_ln_gamma(k+1.) - LOGNORMCONSTANT ) ; + +} /* end of _unur_pmf_negativebinomial() */ + +/*---------------------------------------------------------------------------*/ +#ifdef _unur_SF_cdf_negativebinomial + +double +_unur_cdf_negativebinomial(int k, const UNUR_DISTR *distr) +{ + const double *params = DISTR.params; + + if (k<0) + return 0.; + + else + return _unur_SF_cdf_negativebinomial(k,r,p); + +} /* end of _unur_cdf_negativebinomial() */ + +#endif +/*---------------------------------------------------------------------------*/ +#ifdef _unur_SF_invcdf_negativebinomial + +int +_unur_invcdf_negativebinomial(double u, const UNUR_DISTR *distr) +{ + const double *params = DISTR.params; + double x; + + x = _unur_SF_invcdf_negativebinomial(u,r,p); + return ((x>=INT_MAX) ? INT_MAX : ((int) x)); +} /* end of _unur_invcdf_negativebinomial() */ + +#endif +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_negativebinomial( UNUR_DISTR *distr ) +{ + if (DISTR.r > 1.) { + /* mode = floor( (r-1) * (1-p) / p ) */ + /* (we add a guard against round-off errors */ + DISTR.mode = (int) ((1.+UNUR_EPSILON) * (DISTR.r - 1.) * (1. - DISTR.p) / DISTR.p); + } + else { /* r <= 1. */ + DISTR.mode = 0; + } + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_negativebinomial() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_sum_negativebinomial( UNUR_DISTR *distr ) +{ + /* log of normalization constant */ + LOGNORMCONSTANT = - DISTR.r * log(DISTR.p) + _unur_SF_ln_gamma(DISTR.r); + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.sum = 1.; + return UNUR_SUCCESS; + } + +#ifdef _unur_SF_cdf_negativebinomial + /* else */ + DISTR.sum = ( _unur_cdf_negativebinomial( DISTR.domain[1],distr) + - _unur_cdf_negativebinomial( DISTR.domain[0]-1,distr) ); + return UNUR_SUCCESS; +#else + return UNUR_ERR_DISTR_REQUIRED; +#endif + +} /* end of _unur_upd_sum_negativebinomial() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_negativebinomial( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 2) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 2) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 2; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameters */ + if (p <= 0. || p >= 1. || r <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"p <= 0 || p >= 1 || r <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.p = p; + DISTR.r = r; + + /* default parameters: none */ + /* copy optional parameters: none */ + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain: [0, infinity] */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = 0; /* left boundary */ + DISTR.domain[1] = INT_MAX; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_negativebinomial() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_negativebinomial( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_discr_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_NEGATIVEBINOMIAL; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = _unur_stdgen_negativebinomial_init; */ + + /* functions */ + DISTR.pmf = _unur_pmf_negativebinomial; /* pointer to PMF */ +#ifdef _unur_SF_cdf_negativebinomial + DISTR.cdf = _unur_cdf_negativebinomial; /* pointer to CDF */ +#endif +#ifdef _unur_SF_invcdf_negativebinomial + DISTR.invcdf = _unur_invcdf_negativebinomial; /* pointer to inverse CDF */ +#endif + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_PMFSUM | + UNUR_DISTR_SET_MODE ); + + /* set parameters for distribution */ + if (_unur_set_params_negativebinomial(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* log of normalization constant */ + _unur_upd_sum_negativebinomial( distr ); + + /* mode and sum over PMF */ + _unur_upd_mode_negativebinomial(distr); + DISTR.sum = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_negativebinomial; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_negativebinomial; /* funct for computing mode */ + DISTR.upd_sum = _unur_upd_sum_negativebinomial; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_negativebinomial() */ + +/*---------------------------------------------------------------------------*/ +#undef p +#undef r +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/d_poisson.c b/vendor/unuran-1.11.0/src/distributions/d_poisson.c new file mode 100644 index 0000000..5fe8821 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/d_poisson.c @@ -0,0 +1,248 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: d_poisson.c * + * * + * REFERENCES: * + * * + * [1] N.L. Johnson, S. Kotz and A.W. Kemp * + * Univariate Discrete Distributions, * + * 2nd edition * + * John Wiley & Sons, Inc., New York, 1992 * + * * + ***************************************************************************** + * * + * distr: Poisson distribution [1; ch.4, p.151] * + * * + * pmf: p(k) = theta^k / k! * + * domain: 0 <= k < infinity * + * constant: exp( -theta ) * + * * + * parameters: * + * 0: theta > 0 ... shape * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "poisson"; + +/* parameters */ +#define theta params[0] + +#define DISTR distr->data.discr +/* #define LOGNORMCONSTANT (distr->data.discr.norm_constant) */ + +/*---------------------------------------------------------------------------*/ + +/* function prototypes */ +static double _unur_pmf_poisson( int k, const UNUR_DISTR *distr ); +static double _unur_cdf_poisson( int k, const UNUR_DISTR *distr ); +#ifdef _unur_SF_invcdf_binomial +static int _unur_invcdf_poisson( double u, const UNUR_DISTR *distr ); +#endif + +static int _unur_upd_mode_poisson( UNUR_DISTR *distr ); +static int _unur_upd_sum_poisson( UNUR_DISTR *distr ); +static int _unur_set_params_poisson( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pmf_poisson(int k, const UNUR_DISTR *distr) +{ + if (k>=0) + return exp( -DISTR.theta + k * log(DISTR.theta) - _unur_SF_ln_factorial(k) ); + else + return 0.; +} /* end of _unur_pmf_poisson() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_poisson(int k, const UNUR_DISTR *distr) +{ + if (k>=0) + return (1.-_unur_SF_incomplete_gamma(DISTR.theta,k+1.)); + else + return 0.; +} /* end of _unur_cdf_poisson() */ + +/*---------------------------------------------------------------------------*/ +#ifdef _unur_SF_invcdf_poisson + +int +_unur_invcdf_poisson(double u, const UNUR_DISTR *distr) +{ + const double *params = DISTR.params; + double x; + + x = _unur_SF_invcdf_poisson(u,theta); + return ((x>=INT_MAX) ? INT_MAX : ((int) x)); +} /* end of _unur_invcdf_poisson() */ + +#endif +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_poisson( UNUR_DISTR *distr ) +{ + DISTR.mode = (int) DISTR.theta; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_poisson() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_sum_poisson( UNUR_DISTR *distr ) +{ + /* log normalization constant: none */ + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.sum = 1.; + return UNUR_SUCCESS; + } + + /* else */ + DISTR.sum = ( _unur_cdf_poisson( DISTR.domain[1],distr) + - _unur_cdf_poisson( DISTR.domain[0]-1,distr) ); + return UNUR_SUCCESS; +} /* end of _unur_upd_sum_poisson() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_poisson( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 1) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 1) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 1; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter theta */ + if (theta <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"theta <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.theta = theta; + + /* default parameters: none */ + /* copy optional parameters: none */ + + /* store number of parameters */ + DISTR.n_params = n_params; + + /* set (standard) domain: [0, inifinty] */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = 0; /* left boundary */ + DISTR.domain[1] = INT_MAX; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_poisson() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_poisson( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_discr_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_POISSON; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = _unur_stdgen_poisson_init; + + /* functions */ + DISTR.pmf = _unur_pmf_poisson; /* pointer to PMF */ + DISTR.cdf = _unur_cdf_poisson; /* pointer to CDF */ +#ifdef _unur_SF_invcdf_poisson + DISTR.invcdf = _unur_invcdf_poisson; /* pointer to inverse CDF */ +#endif + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_PMFSUM | + UNUR_DISTR_SET_MODE ); + + /* set parameters for distribution */ + if (_unur_set_params_poisson(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* log normalization constant: none */ + + /* mode and sum over PMF */ + DISTR.mode = (int) DISTR.theta; + DISTR.sum = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_poisson; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_poisson; /* funct for computing mode */ + DISTR.upd_sum = _unur_upd_sum_poisson; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_poisson() */ + +/*---------------------------------------------------------------------------*/ +#undef theta +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/d_poisson_gen.c b/vendor/unuran-1.11.0/src/distributions/d_poisson_gen.c new file mode 100644 index 0000000..5657995 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/d_poisson_gen.c @@ -0,0 +1,767 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: d_poisson_gen.c * + * * + * Special generators for Poisson distribution * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include /* for the definition of `UNUR_STDGEN_INVERSION' */ +#include +#include +#include +#include "unur_distributions_source.h" +#include "unur_distributions.h" + +/*---------------------------------------------------------------------------*/ +/* init routines for special generators */ + +inline static int poisson_pdtabl_init( struct unur_gen *gen ); +inline static int poisson_pdac_init( struct unur_gen *gen ); +inline static int poisson_pprsc_init( struct unur_gen *gen ); + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define PAR ((struct unur_dstd_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_dstd_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.discr /* data for distribution in generator object */ + +#define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ + +/* #define MAX_gen_params (39) maximal number of parameters for generator */ +/* #define MAX_gen_iparams (5) maximal number of integer param. for gen. */ + +/* parameters */ +#define theta (DISTR.params[0]) /* shape */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Inititialize **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_poisson_init( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize special generator for Poisson distribution */ + /* if gen == NULL then only check existance of variant. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* one of par and gen must not be the NULL pointer */ + switch ((par) ? par->variant : gen->variant) { + + case 0: /* DEFAULT */ + case 1: /* Tabulated Inversion combined with Acceptance Complement */ + if (gen==NULL) return UNUR_SUCCESS; /* test existence only */ + if (theta < 10.) { + /* CASE B: Tabulated Inversion */ + _unur_dstd_set_sampling_routine(gen, _unur_stdgen_sample_poisson_pdtabl ); + return poisson_pdtabl_init( gen ); + } + else { /* theta >= 10. */ + /* CASE A: acceptance complement */ + _unur_dstd_set_sampling_routine(gen, _unur_stdgen_sample_poisson_pdac ); + return poisson_pdac_init( gen ); + } + + case 2: /* Tabulated Inversion combined with Patchwork Rejection */ + if (gen==NULL) return UNUR_SUCCESS; /* test existence only */ + if (theta < 10.) { + /* CASE: Tabulated Inversion --> same as case 1 !! */ + _unur_dstd_set_sampling_routine(gen, _unur_stdgen_sample_poisson_pdtabl ); + return poisson_pdtabl_init( gen ); + } + else { /* theta >= 10. */ + /* CASE: Patchwork Rejection */ + _unur_dstd_set_sampling_routine(gen, _unur_stdgen_sample_poisson_pprsc ); + return poisson_pprsc_init( gen ); + } + + /** WinRand routine `pruec' (Ratio of Uniforms/Inversion) not implemented **/ + + default: /* no such generator */ + return UNUR_FAILURE; + } + +} /* end of _unur_stdgen_poisson_init() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Special generators **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Poisson Distribution: Tabulated Inversion combined with * + * Acceptance Complement * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from the Poisson distribution with * + * parameter theta > 0. * + * Tabulated Inversion for theta < 10 * + * Acceptance Complement for theta >= 10. * + * * + * REFERENCE: - J.H. Ahrens, U. Dieter (1982): Computer generation of * + * Poisson deviates from modified normal distributions, * + * ACM Trans. Math. Software 8, 163-179. * + * * + * Implemented by R. Kremer, August 1990 * + * Revised by E. Stadlober, April 1992 * + ***************************************************************************** + * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#define GEN_N_IPARAMS (2) +#define GEN_N_PARAMS (39) + +#define m (GEN->gen_iparam[0]) +#define ll (GEN->gen_iparam[1]) + +#define p0 (GEN->gen_param[0]) +#define q (GEN->gen_param[1]) +#define p (GEN->gen_param[2]) +#define pp ((GEN->gen_param)+3) /* array of length 36 */ +/*---------------------------------------------------------------------------*/ + +int +poisson_pdtabl_init( struct unur_gen *gen ) + /* theta < 10: Tabulated inversion */ +{ + int i; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_DSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + if (GEN->gen_iparam == NULL || GEN->n_gen_iparam != GEN_N_IPARAMS) { + GEN->n_gen_iparam = GEN_N_IPARAMS; + GEN->gen_iparam = _unur_xrealloc(GEN->gen_iparam, GEN->n_gen_iparam * sizeof(int)); + } + + /* -X- setup code -X- */ + m = (theta > 1.) ? ((int) theta) : 1; + ll = 0; + p0 = q = p = exp(-theta); + for (i=0; i<36; i++) pp[i]=0.; + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of poisson_pdtabl_init() */ + +int +_unur_stdgen_sample_poisson_pdtabl( struct unur_gen *gen ) + /* theta < 10: Tabulated inversion */ +{ + /* -X- generator code -X- */ + double U; + int K,i; + + /* check arguments */ + CHECK_NULL(gen,INT_MAX); + COOKIE_CHECK(gen,CK_DSTD_GEN,INT_MAX); + + while (1) { + U = uniform(); /* Step U. Uniform sample */ + K = 0; + if (U <= p0) + return K; + + /* Step T. Table comparison */ + if (ll != 0) { + i = (U > 0.458) ? _unur_min(ll,m) : 1; + for (K = i; K <=ll; K++) + if (U <= pp[K]) + return K; + if (ll == 35) continue; + } + + /* Step C. Creation of new prob. */ + for (K = ll +1; K <= 35; K++) { + p *= theta / (double)K; + q += p; + pp[K] = q; + if (U <= q) { + ll = K; + return K; + } + } + ll = 35; + } + + /* -X- end of generator code -X- */ + +} /* end of _unur_stdgen_sample_poisson_pdtabl() */ + +/*---------------------------------------------------------------------------*/ +#undef GEN_N_IPARAMS +#undef GEN_N_PARAMS + +#undef m +#undef ll +#undef p0 +#undef q +#undef p +#undef pp +/*---------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ +#define GEN_N_IPARAMS (1) +#define GEN_N_PARAMS (10) + +#define l (GEN->gen_iparam[0]) + +#define s (GEN->gen_param[0]) +#define d (GEN->gen_param[1]) +#define omega (GEN->gen_param[2]) +#define b1 (GEN->gen_param[3]) +#define b2 (GEN->gen_param[4]) +#define c (GEN->gen_param[5]) +#define c0 (GEN->gen_param[6]) +#define c1 (GEN->gen_param[7]) +#define c2 (GEN->gen_param[8]) +#define c3 (GEN->gen_param[9]) + +#define NORMAL gen->gen_aux /* pointer to normal variate generator */ +/*---------------------------------------------------------------------------*/ + +int +poisson_pdac_init( struct unur_gen *gen ) + /* Theta >= 10: acceptance complement */ +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_DSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + if (GEN->gen_iparam == NULL || GEN->n_gen_iparam != GEN_N_IPARAMS) { + GEN->n_gen_iparam = GEN_N_IPARAMS; + GEN->gen_iparam = _unur_xrealloc(GEN->gen_iparam, GEN->n_gen_iparam * sizeof(int)); + } + + /* -X- setup code -X- */ + + /* make a normal variate generator (use default special generator) */ + if (NORMAL==NULL) { + struct unur_distr *distr = unur_distr_normal(NULL,0); + struct unur_par *par = unur_cstd_new( distr ); + NORMAL = (par) ? _unur_init(par) : NULL; + _unur_check_NULL( NULL, NORMAL, UNUR_ERR_NULL ); + /* need same uniform random number generator as slash generator */ + NORMAL->urng = gen->urng; + /* copy debugging flags */ + NORMAL->debug = gen->debug; + /* we do not need the distribution object any more */ + _unur_distr_free( distr ); + } + /* else we are in the re-init mode + --> there is no necessity to make the generator object again */ + + s = sqrt(theta); + d = 6. * theta * theta; + l = (int)(theta - 1.1484); + + /* Step P. Preparations for steps Q and H */ + omega = 0.3989423 / s; + b1 = 0.416666666667e-1 / theta; + b2 = 0.3 * b1 * b1; + c3 = 0.1428571 * b1 * b2; + c2 = b2 - 15.0 * c3; + c1 = b1 - 6.0 * b2 + 45.0 * c3; + c0 = 1.0 - b1 + 3.0 * b2 - 15.0 * c3; + c = 0.1069 / theta; + + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of poisson_pdac_init() */ + +/*---------------------------------------------------------------------------*/ +#define a0 -0.5000000002 +#define a1 0.3333333343 +#define a2 -0.2499998565 +#define a3 0.1999997049 +#define a4 -0.1666848753 +#define a5 0.1428833286 +#define a6 -0.1241963125 +#define a7 0.1101687109 +#define a8 -0.1142650302 +#define a9 0.1055093006 +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_sample_poisson_pdac( struct unur_gen *gen ) + /* Theta >= 10: acceptance complement */ +{ + /* -X- generator code -X- */ + /* factorial for 0 <= k <= 9 */ + static const int fac[] = {1,1,2,6,24,120,720,5040,40320,362880}; + + double t,g,theta_k; + double gx,gy,px,py,x,xx,delta,v; + int sign; + + double E, U; + int K; + + /* check arguments */ + CHECK_NULL(gen,INT_MAX); + COOKIE_CHECK(gen,CK_DSTD_GEN,INT_MAX); + + /* Step N. Normal sample */ + t = _unur_sample_cont(NORMAL); + g = theta + s * t; + + if (g >= 0.) { + K = (int) g; + /* Step I. Immediate acceptance */ + if (K >= l) + return K; + /* Step S. Squeeze acceptance */ + U = uniform(); + theta_k = theta - K; + if (d * U >= theta_k * theta_k * theta_k) + return K; + + /* FUNCTION F */ + if (K < 10) { + px = -theta; + py = exp(K * log(theta)) / fac[K]; + } + else { /* k >= 10 */ + delta = 0.83333333333e-1 / (double)K; + delta = delta - 4.8 * delta*delta*delta * (1.-1./(3.5*K*K)); + v = (theta_k) / (double)K; + if (fabs(v) > 0.25) + px = K * log(1. + v) - theta_k - delta; + else { + px = K * v * v; + px *= ((((((((a9*v+a8)*v+a7)*v+a6)*v+a5)*v+ + a4)*v+a3)*v+a2)*v+a1)*v+a0; + px -= delta; + } + py = 0.3989422804 / sqrt((double)K); + } + x = (0.5 - theta_k) / s; + xx = x * x; + gx = -0.5 * xx; + gy = omega * (((c3 * xx + c2) * xx + c1) * xx + c0); + /* end FUNCTION F */ + + /* Step Q. Quotient acceptance */ + if (gy * (1.0 - U) <= py * exp(px - gx)) + return K; + } + + /* Step E. Double exponential sample */ + while (1) { + do { + E = - log(uniform()); + U = uniform(); + U = U + U - 1.; + sign = (U < 0.) ? -1 : 1; + t = 1.8 + E * sign; + } while (t <= -0.6744); + K = (int)(theta + s * t); + theta_k = theta - K; + + /* FUNCTION F */ + if (K < 10) { + px = -theta; + py = exp(K * log(theta)) / fac[K]; + } + else { /* k >= 10 */ + delta = 0.83333333333e-1 / (double)K; + delta = delta - 4.8*delta*delta*delta*(1.0-1.0/(3.5*K*K)); + v = (theta_k) / (double)K; + if (fabs(v) > 0.25) + px = K * log(1. + v) - theta_k - delta; + else { + px = K * v * v; + px *= ((((((((a9*v+a8)*v+a7)*v+a6)*v+a5)*v+ + a4)*v+a3)*v+a2)*v+a1)*v+a0; + px -= delta; + } + py = 0.3989422804 / sqrt((double)K); + } + x = (0.5 - theta_k) / s; + xx = x * x; + gx = -0.5 * xx; + gy = omega * (((c3 * xx + c2) * xx + c1) * xx + c0); + /* end FUNCTION F */ + + /* Step H. Hat acceptance */ + if (c * sign * U <= py * exp(px + E) - gy * exp(gx + E)) + return K; + } + + /* -X- end of generator code -X- */ + +} /* end of _unur_stdgen_sample_poisson_pdac() */ + +/*---------------------------------------------------------------------------*/ +#undef a0 +#undef a1 +#undef a2 +#undef a3 +#undef a4 +#undef a5 +#undef a6 +#undef a7 +#undef a8 +#undef a9 + +#undef GEN_N_IPARAMS +#undef GEN_N_PARAMS + +#undef l +#undef s +#undef d +#undef omega +#undef b1 +#undef b2 +#undef c +#undef c0 +#undef c1 +#undef c2 +#undef c3 + +#undef NORMAL +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Poisson Distribution: Tabulated Inversion combined with * + * Patchwork Rejection * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from the Poisson distribution with * + * parameter theta > 0. * + * Tabulated Inversion for theta < 10 * + * Patchwork Rejection for theta >= 10. * + * * + * REFERENCE: - H. Zechner (1994): Efficient sampling from continuous and * + * discrete unimodal distributions, * + * Pd.D. Thesis, 156 pp., Technical University Graz, Austria. * + * * + * Implemented by H. Zechner, January 1994 * + * Revised by F. Niederl, July 1994 * + ***************************************************************************** + * * + * Patchwork Rejection: * + * The area below the histogram function f(x) is rearranged in its body by * + * certain point reflections. Within a large center interval variates are * + * sampled efficiently by rejection from uniform hats. Rectangular immediate * + * acceptance regions speed up the generation. The remaining tails are * + * covered by exponential functions. * + * * + ***************************************************************************** + * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +inline static double f(int k, double l_nu, double c_pm) +{ + return exp(k * l_nu - _unur_SF_ln_factorial(k) - c_pm); +} + +/*---------------------------------------------------------------------------*/ +#define GEN_N_IPARAMS (5) +#define GEN_N_PARAMS (20) + +#define m (GEN->gen_iparam[0]) +#define k2 (GEN->gen_iparam[1]) +#define k4 (GEN->gen_iparam[2]) +#define k1 (GEN->gen_iparam[3]) +#define k5 (GEN->gen_iparam[4]) + +#define dl (GEN->gen_param[0]) +#define dr (GEN->gen_param[1]) +#define r1 (GEN->gen_param[2]) +#define r2 (GEN->gen_param[3]) +#define r4 (GEN->gen_param[4]) +#define r5 (GEN->gen_param[5]) +#define ll (GEN->gen_param[6]) +#define lr (GEN->gen_param[7]) +#define l_theta (GEN->gen_param[8]) +#define c_pm (GEN->gen_param[9]) +#define f2 (GEN->gen_param[10]) +#define f4 (GEN->gen_param[11]) +#define f1 (GEN->gen_param[12]) +#define f5 (GEN->gen_param[13]) +#define p1 (GEN->gen_param[14]) +#define p2 (GEN->gen_param[15]) +#define p3 (GEN->gen_param[16]) +#define p4 (GEN->gen_param[17]) +#define p5 (GEN->gen_param[18]) +#define p6 (GEN->gen_param[19]) +/*---------------------------------------------------------------------------*/ + +int +poisson_pprsc_init( struct unur_gen *gen ) + /* theta < 10: Tabulated inversion */ +{ + double Ds; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_DSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + if (GEN->gen_iparam == NULL || GEN->n_gen_iparam != GEN_N_IPARAMS) { + GEN->n_gen_iparam = GEN_N_IPARAMS; + GEN->gen_iparam = _unur_xrealloc(GEN->gen_iparam, GEN->n_gen_iparam * sizeof(int)); + } + + /* -X- setup code -X- */ + + /* approximate deviation of reflection points k2, k4 from theta - 1/2 */ + Ds = sqrt(theta + 0.25); + + /* mode m, reflection points k2 and k4, and points k1 and k5, which */ + /* delimit the centre region of h(x) */ + m = (int) theta; + k2 = (int) (theta + 0.5 - Ds); + k4 = (int) (theta - 0.5 + Ds); + k1 = k2 + k2 - m + 1; + k5 = k4 + k4 - m; + + /* range width of the critical left and right centre region */ + dl = (double) (k2 - k1); + dr = (double) (k5 - k4); + + /* recurrence constants r(k) = p(k)/p(k-1) at k = k1, k2, k4+1, k5+1 */ + r1 = theta / (double) k1; + r2 = theta / (double) k2; + r4 = theta / (double)(k4 + 1); + r5 = theta / (double)(k5 + 1); + + /* reciprocal values of the scale parameters of expon. tail envelopes */ + ll = log(r1); /* expon. tail left */ + lr = -log(r5); /* expon. tail right*/ + + /* Poisson constants, necessary for computing function values f(k) */ + l_theta = log(theta); + c_pm = m * l_theta - _unur_SF_ln_factorial(m); + + /* function values f(k) = p(k)/p(m) at k = k2, k4, k1, k5 */ + f2 = f(k2, l_theta, c_pm); + f4 = f(k4, l_theta, c_pm); + f1 = f(k1, l_theta, c_pm); + f5 = f(k5, l_theta, c_pm); + + /* area of the two centre and the two exponential tail regions */ + /* area of the two immediate acceptance regions between k2, k4 */ + p1 = f2 * (dl + 1.); /* immed. left */ + p2 = f2 * dl + p1; /* centre left */ + p3 = f4 * (dr + 1.) + p2; /* immed. right */ + p4 = f4 * dr + p3; /* centre right */ + p5 = f1 / ll + p4; /* expon. tail left */ + p6 = f5 / lr + p5; /* expon. tail right*/ + /* -X- end of setup code -X- */ + + return UNUR_SUCCESS; + +} /* end of poisson_pprsc_init() */ + +int +_unur_stdgen_sample_poisson_pprsc( struct unur_gen *gen ) + /* theta >= 10: Patchwork Rejection */ +{ + /* -X- generator code -X- */ + int Dk, X, Y; + double U, V, W; + + while (1) { + + /* generate uniform number U -- U(0, p6) */ + U = uniform() * p6; + + /* case distinction corresponding to U */ + if (U < p2) { + /* centre left */ + + /* immediate acceptance region R2 = [k2, m) *[0, f2), X = k2, ... m-1 */ + V = U - p1; + if (V < 0.) + return (k2 + (int)(U/f2)); + + /* immediate acceptance region R1 = [k1, k2)*[0, f1), X = k1, ... k2-1 */ + W = V / dl; + if (W < f1) + return (k1 + (int)(V/f1)); + + /* computation of candidate X < k2, and its counterpart Y > k2 */ + /* either squeeze-acceptance of X or acceptance-rejection of Y */ + Dk = (int)(dl * uniform()) + 1; + if (W <= f2 - Dk * (f2 - f2/r2)) + /* quick accept of */ + return (k2 - Dk); /* X = k2 - Dk */ + if ((V = f2 + f2 - W) < 1.) { + /* quick reject of Y*/ + Y = k2 + Dk; + if (V <= f2 + Dk * (1. - f2)/(dl + 1.)) + /* quick accept of */ + return Y; /* Y = k2 + Dk */ + if (V <= f(Y, l_theta, c_pm)) + /* final accept of Y*/ + return Y; + } + X = k2 - Dk; + } + + else if (U < p4) { + /* centre right */ + + /* immediate acceptance region R3 = [m, k4+1)*[0, f4), X = m, ... k4 */ + (V = U - p3); + if (V < 0.) + return (k4 - (int)((U - p2)/f4)); + + /* immediate acceptance region R4 = [k4+1, k5+1)*[0, f5) */ + W = V / dr; + if (W < f5 ) + return (k5 - (int)(V/f5)); + + /* computation of candidate X > k4, and its counterpart Y < k4 */ + /* either squeeze-acceptance of X or acceptance-rejection of Y */ + Dk = (int)(dr * uniform()) + 1; + if (W <= f4 - Dk * (f4 - f4*r4)) + /* quick accept of */ + return(k4 + Dk); /* X = k4 + Dk */ + if ((V = f4 + f4 - W) < 1.0) { + /* quick reject of Y*/ + Y = k4 - Dk; + if (V <= f4 + Dk * (1.0 - f4)/ dr) + /* quick accept of */ + return Y; /* Y = k4 - Dk */ + if (V <= f(Y, l_theta, c_pm)) + return Y; /* final accept of Y*/ + } + X = k4 + Dk; + } + + else { + W = uniform(); + if (U < p5) { + /* expon. tail left */ + Dk = (int)(1. - log(W)/ll); + X = k1 - Dk; + if (X < 0) + continue; /* 0 <= X <= k1 - 1 */ + W *= (U - p4) * ll; /* W -- U(0, h(x)) */ + if (W <= f1 - Dk * (f1 - f1/r1)) + return X; /* quick accept of X*/ + } + else { + /* expon. tail right*/ + Dk = (int)(1. - log(W)/lr); + X = k5 + Dk; /* X >= k5 + 1 */ + W *= (U - p5) * lr; /* W -- U(0, h(x)) */ + if (W <= f5 - Dk * (f5 - f5*r5)) + return X; /* quick accept of X*/ + } + } + + /* acceptance-rejection test of candidate X from the original area */ + /* test, whether W <= f(k), with W = U*h(x) and U -- U(0, 1) */ + /* log f(X) = (X - m)*log(theta) - log X! + log m! */ + if (log(W) <= X * l_theta - _unur_SF_ln_factorial(X) - c_pm) + return X; + + } + + /* -X- end of generator code -X- */ + +} /* end of _unur_stdgen_sample_poisson_pprsc() */ + +/*---------------------------------------------------------------------------*/ +#undef GEN_N_IPARAMS +#undef GEN_N_PARAMS + +#undef m +#undef k2 +#undef k4 +#undef k1 +#undef k5 + +#undef dl +#undef dr +#undef r1 +#undef r2 +#undef r4 +#undef r5 +#undef ll +#undef lr +#undef l_theta +#undef c_pm +#undef f2 +#undef f4 +#undef f1 +#undef f5 +#undef p1 +#undef p2 +#undef p3 +#undef p4 +#undef p5 +#undef p6 +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/d_zipf.c b/vendor/unuran-1.11.0/src/distributions/d_zipf.c new file mode 100644 index 0000000..5dc08f3 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/d_zipf.c @@ -0,0 +1,268 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: d_zipf.c * + * * + * REFERENCES: * + * * + * [1] N.L. Johnson, S. Kotz and A.W. Kemp * + * Univariate Discrete Distributions, * + * 2nd edition * + * John Wiley & Sons, Inc., New York, 1992 * + * * + ***************************************************************************** + * * + * distr: Zipf distribution (or Zeta distribution) [1; ch.11.20, p.465] * + * * + * pmf: p(k) = (k + tau)^(-(rho+1)) * + * domain: 1 <= k < infinity * + * constant: 1 / sum_k=1^infinity (k+tau)^(rho+1) * + * [ zeta(a) = sum_1^infinity (x^a) ... Riemann zeta function ] * + * * + * parameters: * + * 0: rho > 0 ... shape * + * 1: tau >= 0 * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "zipf"; + +/* parameters */ +#define rho params[0] +#define tau params[1] + +#define DISTR distr->data.discr +/* #define NORMCONSTANT (distr->data.discr.norm_constant) */ + +/*---------------------------------------------------------------------------*/ +/* no CDF */ +#undef HAVE_CDF + +/* no normalization constant */ +#undef HAVE_SUM + +/*---------------------------------------------------------------------------*/ + +/* function prototypes */ +static double _unur_pmf_zipf( int k, const UNUR_DISTR *distr ); +#ifdef HAVE_CDF +static double _unur_cdf_zipf( int k, const UNUR_DISTR *distr ); +#endif + +static int _unur_upd_mode_zipf( UNUR_DISTR *distr ); +#ifdef HAVE_SUM +static int _unur_upd_sum_zipf( UNUR_DISTR *distr ); +#endif +static int _unur_set_params_zipf( UNUR_DISTR *distr, const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pmf_zipf(int k, const UNUR_DISTR *distr) +{ + return ((k<1) ? 0. : exp( log(k + DISTR.tau) * (-DISTR.rho - 1.) ) ); +} /* end of _unur_pmf_zipf() */ + +/*---------------------------------------------------------------------------*/ + +#ifdef HAVE_CDF + +double +_unur_cdf_zipf(int k, const UNUR_DISTR *distr) +{ + /** TODO: CDF **/ + return ((k<1) ? 0. : 1.); +} /* end of _unur_cdf_zipf() */ + +#endif + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_zipf( UNUR_DISTR *distr ) +{ + DISTR.mode = 1; + + /* mode must be in domain */ + if (DISTR.mode < DISTR.domain[0]) + DISTR.mode = DISTR.domain[0]; + else if (DISTR.mode > DISTR.domain[1]) + DISTR.mode = DISTR.domain[1]; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_zipf() */ + +/*---------------------------------------------------------------------------*/ + +#ifdef HAVE_SUM + +int +_unur_upd_sum_zipf( UNUR_DISTR *distr ) +{ + /* log normalization constant */ + /** TODO: sum **/ + + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.sum = 1.; + return UNUR_SUCCESS; + } + +#ifdef HAVE_CDF + /* else */ + DISTR.sum = ( _unur_cdf_zipf( DISTR.domain[1],distr) + - _unur_cdf_zipf( DISTR.domain[0]-1,distr) ); + return UNUR_SUCCESS; +#else + return UNUR_ERR_DISTR_REQUIRED; +#endif + +} /* end of _unur_upd_sum_zipf() */ + +#endif + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_zipf( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params < 1) { + _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } + if (n_params > 2) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); + n_params = 2; } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameter rho */ + if (rho <= 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"rho <= 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* check parameter tau */ + if (n_params > 1 && tau < 0.) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"tau < 0"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* copy parameters for standard form */ + DISTR.rho = rho; + + /* default parameters */ + DISTR.tau = 0.; + + /* copy optional parameters */ + if (n_params == 2) + DISTR.tau = tau; + + /* store total number of parameters */ + DISTR.n_params = 2; + + /* set (standard) domain: [1, infinity] */ + if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { + DISTR.domain[0] = 1; /* left boundary */ + DISTR.domain[1] = INT_MAX; /* right boundary */ + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_zipf() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_zipf( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_discr_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_ZIPF; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = _unur_stdgen_zipf_init; + + /* functions */ + DISTR.pmf = _unur_pmf_zipf; /* pointer to PMF */ +#ifdef HAVE_CDF + DISTR.cdf = _unur_cdf_zipf; /* pointer to CDF */ +#endif + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | +#ifdef HAVE_SUM + UNUR_DISTR_SET_PMFSUM | +#endif + UNUR_DISTR_SET_MODE ); + + /* set parameters for distribution */ + if (_unur_set_params_zipf(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); + return NULL; + } + + /* log of normalization constant */ + + /* mode and sum over PMF */ + DISTR.mode = 1; + DISTR.sum = 1.; + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_zipf; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_zipf; /* funct for computing mode */ +#ifdef HAVE_SUM + DISTR.upd_sum = _unur_upd_sum_zipf; /* funct for computing area */ +#endif + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_zipf() */ + +/*---------------------------------------------------------------------------*/ +#undef rho +#undef tau +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/d_zipf_gen.c b/vendor/unuran-1.11.0/src/distributions/d_zipf_gen.c new file mode 100644 index 0000000..15db204 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/d_zipf_gen.c @@ -0,0 +1,211 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: d_zipf_gen.c * + * * + * Special generators for Zipf (or Zeta) distribution * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include /* for the definition of `UNUR_STDGEN_INVERSION' */ +#include +#include "unur_distributions_source.h" + +/*---------------------------------------------------------------------------*/ +/* init routines for special generators */ + +inline static int zipf_zet_init( struct unur_gen *gen ); + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define PAR ((struct unur_dstd_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_dstd_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.discr /* data for distribution in generator object */ + +#define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ + +/* #define MAX_gen_params 2 maximal number of parameters for generator */ + +/* parameters */ +#define rho (DISTR.params[0]) /* shape */ +#define tau (DISTR.params[1]) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Inititialize **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_zipf_init( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize special generator for Zipf distribution */ + /* if gen == NULL then only check existance of variant. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* one of par and gen must not be the NULL pointer */ + switch ((par) ? par->variant : gen->variant) { + + case 0: /* DEFAULT */ + case 1: /* Acceptance Rejection */ + _unur_dstd_set_sampling_routine(gen, _unur_stdgen_sample_zipf_zet ); + return zipf_zet_init( gen ); + + default: /* no such generator */ + return UNUR_FAILURE; + } + +} /* end of _unur_stdgen_zipf_init() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Special generators **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Zipf Distribution: Acceptance Rejection * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from the Zipf distribution with * + * parameters rho > 0 and tau >= 0. * + * * + * REFERENCE : - J. Dagpunar (1988): Principles of Random Variate Generation,* + * Clarendon Press, Oxford. * + * * + * Implemented by P. Busswald, September 1992 * + ***************************************************************************** + * * + * To sample from the Zipf (or Zeta) distribution with parameters rho and * + * tau it suffices to sample variates x from the distribution with density * + * function * + * f(x) = B * {[x+0.5]+tau}^(-(1+rho)) ( x > 0.5 ) * + * and then deliver k=[x+0.5]. * + * 1/B = Sum[(j+tau)^-(rho+1)] (j=1,2,...) converges for rho >= 0.5. * + * It is not necessary to compute B, because variates x are generated by * + * acceptance rejection using density function * + * g(x) = rho * (c+0.5)^rho * (c+x)^-(rho+1). * + * Integer overflow is possible, when roh is small (rho <= .5) and tau * + * large. In this case a new sample is generated. * + * If rho and tau satisfy the inequality * + * rho > 0.14 + tau * 1.85e-8 + 0.02 * ln(tau) * + * the percentage of overflow is less than 1%, so that the result is * + * reliable. * + * If either rho > 100 or k > 10000 numerical problems in computing the * + * theoretical moments arise, therefore rho<=100 and k<=10000 are * + * recommended. * + * * + ***************************************************************************** + * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#define GEN_N_PARAMS (2) +#define c (GEN->gen_param[0]) +#define d (GEN->gen_param[1]) +/*---------------------------------------------------------------------------*/ + +inline static int +zipf_zet_init( struct unur_gen *gen ) +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_DSTD_GEN,UNUR_ERR_COOKIE); + + if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { + GEN->n_gen_param = GEN_N_PARAMS; + GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); + } + + /* -X- setup code -X- */ + if (rho= (double) INT_MAX); + K = (long int) (X+0.5); + E = -log(V); + } while ( E < (1.+rho) * log( (K+tau)/(X+c)) - d ); + /* -X- end of generator code -X- */ + + return K; + +} /* end of _unur_stdgen_sample_zipf_zet() */ + +/*---------------------------------------------------------------------------*/ +#undef GEN_N_PARAMS +#undef c +#undef d +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/m_correlation.c b/vendor/unuran-1.11.0/src/distributions/m_correlation.c new file mode 100644 index 0000000..c9405c2 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/m_correlation.c @@ -0,0 +1,102 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: m_correlation.c * + * * + * Random correlation matrix * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "correlation"; + +/*---------------------------------------------------------------------------*/ +/* parameters */ + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.matr + +/*---------------------------------------------------------------------------*/ +/* function prototypes */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Make distribution object **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_correlation( int n ) +{ + struct unur_distr *distr; + + /* get new (empty) distribution object */ + distr = unur_distr_matr_new(n,n); + + /* check new parameter for generator */ + if (distr == NULL) { + /* error: n < 2 */ + return NULL; + } + + /* set distribution id */ + distr->id = UNUR_DISTR_MCORRELATION; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = NULL; + + /* functions */ + + /* indicate which parameters are set (additional to mean and covariance) */ + /* distr->set |= 0; */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_correlation() */ + +/*---------------------------------------------------------------------------*/ +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/unur_distributions.h b/vendor/unuran-1.11.0/src/distributions/unur_distributions.h new file mode 100644 index 0000000..e459a24 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/unur_distributions.h @@ -0,0 +1,784 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unur_distributions.h * + * * + * PURPOSE: * + * defines macros and function prototypes for PDF, CDF, etc. * + * of distribtions. * + * * + * REFERENCES: * + * * + * [1] N.L. Johnson, S. Kotz, and A.W. Kemp * + * Univariate Discrete Distributions, * + * 2nd edition * + * John Wiley & Sons, Inc., New York, 1992 * + * * + * [2] N.L. Johnson, S. Kotz, and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 1, 2nd edition * + * John Wiley & Sons, Inc., New York, 1994 * + * * + * [3] N.L. Johnson, S. Kotz, and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 2, 2nd edition * + * John Wiley & Sons, Inc., New York, 1995 * + * * + * [4] N.L. Johnson, S. Kotz, and N. Balakrishnan * + * Discrete Multivariate Distributions, * + * John Wiley & Sons, Inc., New York, 1997 * + * * + * [5] S. Kotz, N. Balakrishnan, and N.L. Johnson * + * Continuous Multivariate Distributions, * + * Volume 1: Models and Applications * + * John Wiley & Sons, Inc., New York, 2000 * + * * + * [0] S. Kotz and N.L. Johnson * + * Encyclopedia of Statistical Sciences * + * Volumes 1-9 * + * John Wiley & Sons, Inc., New York, 1982-1988 * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef UNURAN_DISTRIBUTIONS_H_SEEN +#define UNURAN_DISTRIBUTIONS_H_SEEN +/*---------------------------------------------------------------------------*/ + +#include + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Continuous univariate distributions * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Beta distribution [3; ch.25, p.210] */ +/* + =DISTR beta Beta distribution + =UP Stddist_CONT + =REF [JKBc95: Ch.25, p.210] + =PDF (x-a)^{p-1} * (b-x)^{q-1} + =CONST 1 / (B(p,q) * (b-a)^{p+q-1}) + =DOMAIN a < x < b + =FPARAM 0 : p : > 0 : : scale : + 1 : q : > 0 : : scale : + [2] : a : : 0 : location, scale : + [3] : b : > a : 1 : location, scale : + =EON +*/ +UNUR_DISTR *unur_distr_beta(const double *params, int n_params); +/** TODO: STDGEN **/ + +/*---------------------------------------------------------------------------*/ +/* Burr family of distributions [2; ch.12, p.54] */ +UNUR_DISTR *unur_distr_burr(const double *params, int n_params); +/** under construction **/ + +/* FIXME */ + +/*---------------------------------------------------------------------------*/ +/* Cauchy distribution [2; ch.16, p.299] */ +/* + =DISTR cauchy Cauchy distribution + =UP Stddist_CONT + =REF [JKBb94: Ch.16, p.299] + =PDF 1/(1 + ((x-theta)/lambda)^2) + =CONST 1/(pi * lambda) + =DOMAIN -infinity < x < infinity + =FPARAM [0] : theta : : 0 : location : + [[1]] : lambda : > 0 : 1 : scale : + =STDGEN INV Inversion method + =EON +*/ +UNUR_DISTR *unur_distr_cauchy(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Chi distribution [2; ch.18, p.417] */ +/* + =DISTR chi Chi distribution + =UP Stddist_CONT + =REF [JKBb94: Ch.18, p.417] + =PDF x^{nu-1} * exp( -x^2/2 ) + =CONST 1 / (2^{(nu/2)-1} * Gamma(nu/2)) + =DOMAIN 0 <= x < infinity + =FPARAM 0 : nu : > 0 : : shape : + =STDGEN DEF Ratio of Uniforms with shift (only for @tex $nu >= 1$@end tex) [MJa87] + =EON +*/ +UNUR_DISTR *unur_distr_chi(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Chisquare distribution [2; ch.18, p.416] */ +/* + =DISTR chisquare Chisquare distribution + =UP Stddist_CONT + =REF [JKBb94: Ch.18, p.416] + =PDF x^{(nu/2)-1} * exp( -x/2 ) + =CONST 1 / (2^{nu/2} * Gamma(nu/2)) + =DOMAIN 0 <= x < infinity + =FPARAM 0 : nu : > 0 : : shape (degrees of freedom) : + =EON +*/ +UNUR_DISTR *unur_distr_chisquare(const double *params, int n_params); +/** TODO: STDGEN **/ + +/*---------------------------------------------------------------------------*/ +/* Erlang distribution */ +/* not implemented */ + +/*---------------------------------------------------------------------------*/ +/* Exponential distribution [2; ch.19, p.494] */ +/* + =DISTR exponential Exponential distribution + =UP Stddist_CONT + =REF [JKBb94: Ch.19, p.494] + =PDF exp( -(x-theta)/sigma) + =CONST 1/sigma + =DOMAIN theta <= x < infinity + =FPARAM [0] : sigma : > 0 : 1 : scale : + [[1]] : theta : : 0 : location : + =STDGEN INV Inversion method + =EON +*/ +UNUR_DISTR *unur_distr_exponential(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Extreme value type I distribution [3; ch.22, p.2] */ +/* + =DISTR extremeI Extreme value type I (Gumbel-type) distribution + =UP Stddist_CONT + =REF [JKBc95: Ch.22, p.2] + =PDF exp( -exp( -\frac{x-zeta}{theta} ) - \frac{x-zeta}{theta} ) + =CONST 1/theta + =DOMAIN -infinity < x 0 : 1 : scale : + =STDGEN INV Inversion method + =EON +*/ +UNUR_DISTR *unur_distr_extremeI(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Extreme value type II distribution [3; ch.22, p.2] */ +/* + =DISTR extremeII Extreme value type II (Frechet-type) distribution + =UP Stddist_CONT + =REF [JKBc95: Ch.22, p.2] + =PDF exp( -(\frac{x-zeta}{theta})^{-k}) * (\frac{x-zeta}{theta})^{-k-1} + =CONST k/theta + =DOMAIN zeta < x 0 : : shape : + [1] : zeta : : 0 : location : + [[2]] : theta : > 0 : 1 : scale : + =STDGEN INV Inversion method + =EON +*/ +UNUR_DISTR *unur_distr_extremeII(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* F distribution [3; ch.27, p.332] */ +/* + =DISTR F F-distribution + =UP Stddist_CONT + =REF [JKBc95: Ch.27, p.322] + =PDF (x^{nu_1/2-1}) / (1+nu_1/nu_2 x)^{(nu_1+nu_2)/2} + =CONST (nu_1/nu_2)^{nu_1/2} / B(nu_1/2,nu_2/2) + =DOMAIN 0 < x < infinity + =FPARAM 0 : nu_1 : > 0 : : scale : + 1 : nu_2 : > 0 : : scale : + =EON +*/ +UNUR_DISTR *unur_distr_F(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Gamma distribution [2; ch.17, p.337] */ +/* + =DISTR gamma Gamma distribution + =UP Stddist_CONT + =REF [JKBb94: Ch.17, p.337] + =PDF (\frac{x-gamma}{beta})^{alpha-1} * exp( -\frac{x-gamma}{beta} ) + =CONST 1 / (beta * Gamma(alpha)) + =DOMAIN gamma < x < infinity + =FPARAM 0 : alpha : > 0 : : shape : + [1] : beta : > 0 : 1 : scale : + [[2]] : gamma : : 0 : location : + =STDGEN DEF Acceptance Rejection combined with Acceptance Complement [ADa74] [ADa82] + 2 Rejection from log-logistic envelopes [CHa77] + =EON +*/ +UNUR_DISTR *unur_distr_gamma(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Generalized hyperbolic distribution */ + +/* Only pdf is implemented when macro 'HAVE_LIBRMATH' is defined! */ +UNUR_DISTR *unur_distr_ghyp(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Generalized inverse Gaussian distribution [2; ch.15, p.284] */ +/* + =DISTR gig Generalized Inverse Gaussian distribution + =UP Stddist_CONT + =REF [JKBb94: Ch.15, p.84] + =PDF x^{theta-1} * exp( -\frac{1}{2} * omega * (\frac{x}{eta} + \frac{eta}{x})) + =CONST @text{not implemented!} + =CDF @text{not implemented!} + =DOMAIN 0 < x 0 : : scale : + [2] : eta : > 0 : 1 : shape : + =STDGEN DEF Ratio-of-Uniforms method [Dag89] + =EON +*/ +UNUR_DISTR *unur_distr_gig(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Generalized inverse Gaussian distribution [2; ch.15, p.284] */ +/* (Alternative parametrization.) */ +/* + =DISTR gig2 Generalized Inverse Gaussian distribution + =UP Stddist_CONT + =REF [JKBb94: Ch.15, p.84] + =PDF x^{theta-1} * exp( -\frac{1}{2} * (\frac{chi}{x} + psi*x)) + =CONST @text{not implemented!} + =CDF @text{not implemented!} + =DOMAIN 0 < x 0 : : shape : + 2 : chi : > 0 : : shape : + =EON +*/ +/** TODO: STDGEN **/ +UNUR_DISTR *unur_distr_gig2(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Hyperbolic distribution */ +/* + =DISTR hyperbolic Hyperbolic distribution + =UP Stddist_CONT + =PDF exp( -alpha * sqrt{delta^2 + (x - mu)^2} + beta*(x-mu) ) + =CONST @text{not implemented!} + =CDF @text{not implemented!} + =DOMAIN -infinity < x |beta| : : shape (tail) : + 1 : beta : : : shape (asymmetry): + 2 : delta : > 0 : : scale : + 3 : mu : : : location : + =EON + */ +UNUR_DISTR *unur_distr_hyperbolic(const double *params, int n_params); +/** TODO: STDGEN **/ + +/*---------------------------------------------------------------------------*/ +/* Inverse Gaussian (Wald) distribution [2; ch.15, p.259] */ +/* + =DISTR ig Inverse Gaussian distribution + =UP Stddist_CONT + =REF [JKBb94: Ch.15, p.259] + =PDF sqrt{ \frac{lambda}{2*pi*x^3} } * exp( -\frac{lambda*(x-mu)^2}{2*mu^2*x} ) + =CONST 1 + =CDF @text{not implemented!} + =DOMAIN 0 < x 0 : : mean : + 1 : lambda : > 0 : : shape : + =EON + */ +UNUR_DISTR *unur_distr_ig(const double *params, int n_params); +/** TODO: STDGEN **/ + +/*---------------------------------------------------------------------------*/ +/* Laplace distribution [3; ch.24, p.164] */ +/* + =DISTR laplace Laplace distribution + =UP Stddist_CONT + =REF [JKBc95: Ch.24, p.164] + =PDF exp( -|x-theta| / phi ) + =CONST 1/(2 * phi) + =DOMAIN -infinity < x 0 : 1 : scale : + =STDGEN INV Inversion method + =EON +*/ +UNUR_DISTR *unur_distr_laplace(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Logistic distribution [3; ch.23, p.115] */ +/* + =DISTR logistic Logistic distribution + =UP Stddist_CONT + =REF [JKBc95: Ch.23, p.115] + =PDF exp(-\frac{x-alpha}{beta}) * (1 + exp(-\frac{x-alpha}{beta}))^{-2} + =CONST 1/beta + =DOMAIN -infinity < x 0 : 1 : scale : + =STDGEN INV Inversion method + =EON +*/ +UNUR_DISTR *unur_distr_logistic(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Lognormal distribution [2; ch.14, p.208] */ +/* + =DISTR lognormal Log-Normal distribution + =UP Stddist_CONT + =REF [JKBb94: Ch.14, p. 208] + =PDF 1/(x-theta) * exp( -(log(x-theta)-zeta)^2/(2 sigma^2) ) + =CONST 1/(sigma * sqrt{2 pi}) + =DOMAIN theta <= x < infinity + =FPARAM 0 : zeta : : : shape : + 1 : sigma : > 0 : : shape : + [2] : theta : : 0 : location : + =EON +*/ +UNUR_DISTR *unur_distr_lognormal(const double *params, int n_params); +/** TODO: STDGEN **/ + +/*---------------------------------------------------------------------------*/ +/* Lomax distribution (Pareto distr. of second kind) [2; ch.20, p.575] */ +/* + =DISTR lomax Lomax distribution (Pareto distribution of second kind) + =UP Stddist_CONT + =REF [JKBb94: Ch.20, p.575] + =PDF (x+C)^{-(a+1)} + =CONST a * C^a + =DOMAIN 0 <= x < infinity + =FPARAM 0 : a : > 0 : : shape : + [1] : C : > 0 : 1 : scale : + =STDGEN INV Inversion method + =EON +*/ +UNUR_DISTR *unur_distr_lomax(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Meixner distribution */ + +/* Only pdf is implemented when macro 'HAVE_LIBRMATH' is defined! */ +UNUR_DISTR *unur_distr_meixner(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Normal distribution [2; ch.13, p.80] */ +/* + =DISTR normal Normal distribution + =UP Stddist_CONT + =REF [JKBb94: Ch.13, p.80] + =PDF exp( -\frac{1}{2} * (\frac{x-mu}{sigma})^2 ) + =CONST 1 / (sigma * sqrt{2 pi}) + =DOMAIN -infinity < x < infinity + =FPARAM [0] : mu : : 0 : location : + [[1]] : sigma : > 0 : 1 : scale : + =STDGEN DEF ACR method (Acceptance-Complement Ratio) [HDa90] + 1 Box-Muller method [BMa58] + 2 Polar method with rejection [MGa62] + 3 Kindermann-Ramage method [KRa76] + INV Inversion method (slow) + =EON +*/ +UNUR_DISTR *unur_distr_normal( const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ +/* Pareto distribution (of first kind) [2; ch.20, p.574] */ +/* + =DISTR pareto Pareto distribution (of first kind) + =UP Stddist_CONT + =REF [JKBb94: Ch.20, p.574] + =PDF x^{-(a+1)} + =CONST a * k^a + =DOMAIN k < x < infinity + =FPARAM 0 : k : > 0 : : shape, location : + 1 : a : > 0 : : shape : + =STDGEN INV Inversion method + =EON +*/ +UNUR_DISTR *unur_distr_pareto( const double *params, int n_params ); + +/*---------------------------------------------------------------------------*/ +/* Pearson VI distribution */ +/* not implemented */ + +/*---------------------------------------------------------------------------*/ +/* Perks distribution */ +/* not implemented */ + +/*---------------------------------------------------------------------------*/ +/* Planck distribution */ +/* not implemented **/ + +/*---------------------------------------------------------------------------*/ +/* Power-exponential (Subbotin) distribution [3; ch.24, p.195] */ +/* + =DISTR powerexponential Powerexponential (Subbotin) distribution + =UP Stddist_CONT + =REF [JKBc95: Ch.24, p.195] + =PDF exp( -|x|^tau ) + =CONST 1 / (2 * Gamma(1+1/tau)) + =DOMAIN -infinity < x < infinity + =FPARAM 0 : tau : > 0 : : shape : + =STDGEN DEF Transformed density rejection (only for @tex $tau >= 1$@end tex) [DLa86] + =EON +*/ +UNUR_DISTR *unur_distr_powerexponential(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Rayleigh distribution [2; ch.18, p.456] */ +/* + =DISTR rayleigh Rayleigh distribution + =UP Stddist_CONT + =REF [JKBb94: Ch.18, p.456] + =PDF x * exp( -1/2 * (\frac{x}{sigma})^2 ) + =CONST 1 / sigma^2 + =DOMAIN 0 <= x < infinity + =FPARAM 0 : sigma : > 0 : : scale : + =EON +*/ +UNUR_DISTR *unur_distr_rayleigh(const double *params, int n_params); +/** TODO: STDGEN **/ + +/*---------------------------------------------------------------------------*/ +/* Slash distribution [2; ch.12, p.63] */ +/* + =DISTR slash Slash distribution + =UP Stddist_CONT + =REF [JKBb94: Ch.12, p.63] + =PDF (1 - exp(-x^2/2)) / x^2 + =CONST 1 / sqrt{2 pi} + =CDF @text{not implemented!} + =DOMAIN -infinity < x < infinity + =STDGEN DEF Ratio of normal and uniform random variates + =EON +*/ +UNUR_DISTR *unur_distr_slash(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Student's t distribution [3; ch. 28; p. 362] */ +/* + =DISTR student Student's t distribution + =UP Stddist_CONT + =REF [JKBc95: Ch.28, p.362] + =PDF (1+\frac{t^2}{nu})^{-(nu+1)/2} + =CONST 1 / (sqrt{nu} * B(1/2,nu/2)) + =CDF @text{not implemented!} + =DOMAIN -infinity < x < infinity + =FPARAM 0 : nu : > 0 : : shape : + =EON +*/ +UNUR_DISTR *unur_distr_student(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Triangular distribution [3; ch.26, p.297] */ +/* + =DISTR triangular Triangular distribution + =UP Stddist_CONT + =REF [JKBc95: Ch.26, p.297] + =PDF 2*x / H, \hbox{ for } 0 <= x <= H \hfill\break + 2*(1-x) / (1-H), \hbox{ for } H <= x <= 1 + =CONST 1 + =DOMAIN 0 <= x <= 1 + =FPARAM [0] : H : 0 <= H <= 1 : 1/2 : shape : + =STDGEN INV Inversion method + =EON +*/ +UNUR_DISTR *unur_distr_triangular(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Uniform distribution [3; ch.26, p.276] */ +/* + =DISTR uniform Uniform distribution + =UP Stddist_CONT + =REF [JKBc95: Ch.26, p.276] + =PDF 1 / (b-a) + =CONST 1 + =DOMAIN a < x < b + =FPARAM [0] : a : : 0 : location : + [1] : b : > a : 1 : location : + =STDGEN INV Inversion method + =EON +*/ +UNUR_DISTR *unur_distr_uniform(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Variance Gamma distribution */ + +/* Only pdf is implemented when macro 'HAVE_LIBRMATH' is defined! */ +UNUR_DISTR *unur_distr_vg(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Weibull distribution [2; ch.21, p.628] */ +/* + =DISTR weibull Weibull distribution + =UP Stddist_CONT + =REF [JKBb94: Ch.21, p.628] + =PDF (\frac{x-zeta}{alpha})^{c-1} * exp( -(\frac{x-zeta}{alpha})^c ) + =CONST c / alpha + =DOMAIN zeta < x < infinity + =FPARAM 0 : c : > 0 : : shape : + [1] : alpha : > 0 : 1 : scale : + [[2]] : zeta : : 0 : location : + =STDGEN INV Inversion method + =EON +*/ +UNUR_DISTR *unur_distr_weibull(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Continuous multivariate distributions * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Multinormal distribution [5; ch.45, p.105] */ +/* + =DISTR multinormal Multinormal distribution + =UP Stddist_CVEC + =REF [KBJe00: Ch.45, p.105] + =PDF f(x) = exp( -1/2 * (x-mu)^t . Sigma^{-1} . (x-mu) ) + =CONST 1 / ( (2 pi)^{dim/2} * sqrt{det(Sigma)} ) + =DOMAIN -infinity^{dim} < x < infinity^{dim} + =FPARAM [0] : mu : : (0,@dots{},0) : location : + [1] : Sigma : Symm, Pos. def. : I : shape : + =EON +*/ +UNUR_DISTR *unur_distr_multinormal(int dim, const double *mean, const double *covar); + +/*---------------------------------------------------------------------------*/ +/* Multicauchy distribution [5; ch.45, p.219] */ +/* + =DISTR multicauchy Multicauchy distribution + =UP Stddist_CVEC + =PDF f(x) = 1 / ( 1 + (x-mu)^t . Sigma^{-1} . (x-mu) )^{(dim+1)/2} + =CONST Gamma((dim+1)/2) / ( pi^{(dim+1)/2} * sqrt{det(Sigma)} ) + =DOMAIN -infinity^{dim} < x < infinity^{dim} + =FPARAM [0] : mu : : (0,@dots{},0) : location : + [1] : Sigma : Symm, Pos. def. : I : shape : + =STDGEN DEF Cholesky factor + =EON +*/ +UNUR_DISTR *unur_distr_multicauchy(int dim, const double *mean, const double *covar); + + +/*---------------------------------------------------------------------------*/ +/* Multistudent distribution */ +/* + =DISTR multistudent Multistudent distribution + =UP Stddist_CVEC + =PDF f(x) = 1 / ( 1 + (x-mu)^t . Sigma^{-1} . (x-mu) / m)^{(dim+m)/2} ) + =CONST Gamma((dim+m)/2) / ( Gamma(m/2) (m*pi)^{dim/2} * sqrt{det(Sigma)} ) + =DOMAIN -infinity^{dim} < x < infinity^{dim} + =FPARAM [0] : m : m>0 : 1 : location : + [1] : mu : : (0,@dots{},0) : location : + [2] : Sigma : Symm, Pos. def. : I : shape : + =EON +*/ +UNUR_DISTR *unur_distr_multistudent(int dim, double nu, const double *mean, const double *covar); + + + +/*---------------------------------------------------------------------------*/ +/* Multiexponential distribution */ +/* + =DISTR multiexponential Multiexponential distribution + =UP Stddist_CVEC + =PDF f(x) = Prod_{i=0}^{i=dim-1} exp(-(dim-i) (x_{i}-x_{i-1} - (theta_i-theta_{i-1}) ) / sigma_i); + with x_{-1}=0 and theta_{i-1}=0 + =CONST Prod_{i=0}^{i=dim-1} 1/sigma_i + =DOMAIN 0^{dim} <= x < infinity^{dim} + =FPARAM [0] : sigma : : (1,@dots{},1) : shape : + [1] : theta : : (0,@dots{},0) : location : + =EON +*/ +UNUR_DISTR *unur_distr_multiexponential(int dim, const double *sigma, const double *theta); + + +/*---------------------------------------------------------------------------*/ +/* Copula */ +/* + =DISTR copula Copula (distribution with uniform marginals) + =UP Stddist_CVEC + + =DESCRIPTION + @code{UNUR_DISTR *unur_distr_copula(int dim, const double *rankcorr)} + creates a distribution object for a copula with @var{dim} components. + @var{rankcorr} is an array of size @var{dim}x@var{dim} and holds the + rank correlation matrix (Spearman's correlation), where the rows of + the matrix are stored consecutively in this array. The NULL pointer + can be used instead the identity matrix. + + If @var{covar} is not a valid rank correlation matrix (i.e., not positive + definite) then no distribution object is created and NULL is returned. + =EON +*/ +UNUR_DISTR *unur_distr_copula(int dim, const double *rankcorr); + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Continuous matrix distributions * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Random correlation matrix */ +UNUR_DISTR *unur_distr_correlation( int n ); +/* + =DISTR correlation Random correlation matrix + =UP Stddist_MATR + + =DESCRIPTION + @code{UNUR_DISTR *unur_distr_correlation( int n )} + creates a distribution object for a random correlation matrix of + @var{n} rows and columns. It can be used with method MCORR + (@pxref{MCORR,,Random Correlation Matrix}) to + generate random correlation matrices of the given size. + + =EON +*/ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Discrete univariate distributions * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Binomial distribution [1; ch.3, p.105] */ +/* + =DISTR binomial Binomial distribution + =UP Stddist_DISCR + =REF [JKKa92: Ch.3, p.105] + =PMF {n \choose k} * p^k * (1-p)^{n-k} + =CONST 1 + =DOMAIN 0 <= k <= n + =FPARAM 0 : n : >= 1 : : no. of elements : + 1 : p : 0 < p < 1 : : shape : + =STDGEN DEF Ratio of Uniforms/Inversion [STa89] + =EON +*/ +UNUR_DISTR *unur_distr_binomial(const double *params, int n_params); +/** No CDF !!! **/ + +/*---------------------------------------------------------------------------*/ +/* Geometric distribution [1; ch.5.2, p.201] */ +/* + =DISTR geometric Geometric distribution + =UP Stddist_DISCR + =REF [JKKa92: Ch.5.2, p.201] + =PMF p * (1-p)^k + =CONST 1 + =DOMAIN 0 <= k < infinity + =FPARAM 0 : p : 0 < p < 1 : : shape : + =STDGEN INV Inversion method + =EON +*/ +UNUR_DISTR *unur_distr_geometric(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Hypergeometric distribution [1; ch.6, p.237] */ +/* + =DISTR hypergeometric Hypergeometric distribution + =UP Stddist_DISCR + =REF [JKKa92: Ch.6, p.237] + =PMF {M \choose k} * {N-M \choose n-k} / {N \choose n} + =CONST 1 + =DOMAIN max(0,n-N+M) <= k <= min(n,M) + =FPARAM 0 : N : >= 1 : : no. of elements : + 1 : M : 1 <= M <= N : : shape : + 2 : n : 1 <= n <= N : : shape : + =STDGEN DEF Ratio of Uniforms/Inversion [STa89] + =EON +*/ +UNUR_DISTR *unur_distr_hypergeometric(const double *params, int n_params); +/** No CDF !!! **/ + +/*---------------------------------------------------------------------------*/ +/* Logarithmic distribution [1; ch.7, p.285] */ +/* + =DISTR logarithmic Logarithmic distribution + =UP Stddist_DISCR + =REF [JKKa92: Ch.7, p.285] + =PMF theta^k / k + =CONST - log( 1.-theta); + =DOMAIN 1 <= k < infinity + =FPARAM 0 : theta : 0 < theta < 1 : : shape : + =STDGEN DEF Inversion/Transformation [KAa81] + =EON +*/ +UNUR_DISTR *unur_distr_logarithmic(const double *params, int n_params); +/** No CDF !!! **/ + +/*---------------------------------------------------------------------------*/ +/* Negative Binomial distribution [1; ch.5.1, p.200] */ +/* + =DISTR negativebinomial Negative Binomial distribution + =UP Stddist_DISCR + =REF [JKKa92: Ch.5.1, p.200] + =PMF {k+r-1 \choose r-1} * p^r * (1-p)^k + =CONST 1 + =DOMAIN 0 <= k < infinity + =FPARAM 0 : p : 0 < p < 1 : : shape : + 1 : r : > 0 : : shape : + =EON +*/ +UNUR_DISTR *unur_distr_negativebinomial(const double *params, int n_params); +/** No CDF !!! **/ +/** TODO: STDGEN **/ + +/*---------------------------------------------------------------------------*/ +/* Poisson distribution [1; ch.4, p.151] */ +/* + =DISTR poisson Poisson distribution + =UP Stddist_DISCR + =REF [JKKa92: Ch.4, p.151] + =PMF theta^k / k! + =CONST exp(theta) + =DOMAIN 0 <= k < infinity + =FPARAM 0 : theta : > 0 : : shape : + =STDGEN DEF Tabulated Inversion combined with Acceptance Complement [ADb82] + 2 Tabulated Inversion combined with Patchwork Rejection [ZHa94] + =EON +*/ +UNUR_DISTR *unur_distr_poisson(const double *params, int n_params); +/** No CDF !!! **/ + +/*---------------------------------------------------------------------------*/ +/* Zipf (or Zeta) distribution [1; ch.11.20, p.465] */ +UNUR_DISTR *unur_distr_zipf(const double *params, int n_params); +/** No CDF !!! **/ +/** TODO: STDGEN **/ + +/*---------------------------------------------------------------------------*/ +#endif /* UNURAN_DISTRIBUTIONS_H_SEEN */ +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/distributions/unur_distributions_source.h b/vendor/unuran-1.11.0/src/distributions/unur_distributions_source.h new file mode 100644 index 0000000..c6e7eed --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/unur_distributions_source.h @@ -0,0 +1,496 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unur_distribution_source.h * + * * + * PURPOSE: * + * defines macros and prototypes for special generators * + * of distribtions. * + * * + * * + * NAMING SCHEME: * + * Includes all distribution source files. * + * (Not all of these function exist for every distribution!) * + * * + * double _unur_pdf_(double x, UNUR_DISTR *distr) * + * ... value of PDF at x * + * double _unur_dpdf_(double x, UNUR_DISTR *distr) * + * ... value of derivative of PDF at x * + * double _unur_cdf_(double x, UNUR_DISTR *distr) * + * ... value of CDF at x * + * double _unur_mode_(double *params, int n_params) * + * ... mode of distribution * + * double _unur_normconstant_(double *params, int n_params) * + * ... normalization constant of PDF * + * double _unur_lognormconstant_(double *params, int n_params) * + * ... log of normalization constant of PDF * + * int _unur_stdgen__init( * + * UNUR_PAR *parameters, UNUR_GEN *generator) * + * ... initialize new (special) generator for distribution * + * double unur_stdgen_sample__(UNUR_GEN *generator) * + * ... call (special) generator for distribution * + * * + * double x ... argument of PDF * + * double* params ... parameter list for PDF * + * int n_params ... number of parameters (length of array) * + * * + * UNUR_DISTR* distr ... pointer to distribution object * + * UNUR_PAR* parameters ... pointer to paraters of generator * + * UNUR_GEN* generator ... pointer to generator object * + * * + * * + * REFERENCES: * + * * + * [1] N.L. Johnson, S. Kotz, and A.W. Kemp * + * Univariate Discrete Distributions, * + * 2nd edition * + * John Wiley & Sons, Inc., New York, 1992 * + * * + * [2] N.L. Johnson, S. Kotz, and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 1, 2nd edition * + * John Wiley & Sons, Inc., New York, 1994 * + * * + * [3] N.L. Johnson, S. Kotz, and N. Balakrishnan * + * Continuous Univariate Distributions, * + * Volume 2, 2nd edition * + * John Wiley & Sons, Inc., New York, 1995 * + * * + * [4] N.L. Johnson, S. Kotz, and N. Balakrishnan * + * Discrete Multivariate Distributions, * + * John Wiley & Sons, Inc., New York, 1997 * + * * + * [5] S. Kotz, N. Balakrishnan, and N.L. Johnson * + * Continuous Multivariate Distributions, * + * Volume 1: Models and Applications * + * John Wiley & Sons, Inc., New York, 2000 * + * * + * [0] S. Kotz and N.L. Johnson * + * Encyclopedia of Statistical Sciences * + * Volumes 1-9 * + * John Wiley & Sons, Inc., New York, 1982-1988 * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef UNUR_DISTRIBUTIONS_SOURCE_H_SEEN +#define UNUR_DISTRIBUTIONS_SOURCE_H_SEEN +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Continuous univariate distributions * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Beta distribution [3; ch.25, p.210] */ + +/* initialize special generator */ +int _unur_stdgen_beta_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + +/* Acceptance/Rejection from log-logistic hats */ +double _unur_stdgen_sample_beta_bb( UNUR_GEN *generator ); +double _unur_stdgen_sample_beta_bc( UNUR_GEN *generator ); + +/* Stratified Rejection/Patchwork Rejection */ +double _unur_stdgen_sample_beta_b00( UNUR_GEN *generator ); +double _unur_stdgen_sample_beta_b01( UNUR_GEN *generator ); +double _unur_stdgen_sample_beta_b1prs( UNUR_GEN *generator ); +double _unur_stdgen_sample_beta_binv( UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Burr family of distributions [2; ch.12, p.54] */ + +/* initialize special generator */ +int _unur_stdgen_burr_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Cauchy distribution [2; ch.16, p.299] */ + +/* initialize special generator */ +int _unur_stdgen_cauchy_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Chi distribution [2; ch.18, p.417] */ + +/* initialize special generator */ +int _unur_stdgen_chi_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + +/* Ratio of Uniforms with shift */ +double _unur_stdgen_sample_chi_chru( UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Chisquare distribution [2; ch.18, p.416] */ + + +/*---------------------------------------------------------------------------*/ +/* Erlang distribution */ + + +/*---------------------------------------------------------------------------*/ +/* Exponential distribution [2; ch.19, p.494] */ + +/* initialize special generator */ +int _unur_stdgen_exponential_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + +/* Inversion method */ +double _unur_stdgen_sample_exponential_inv( UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Extreme value type I distribution [3; ch.22, p.2] */ + +/* initialize special generator */ +int _unur_stdgen_extremeI_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Extreme value type II distribution [3; ch.22, p.2] */ + +/* initialize special generator */ +int _unur_stdgen_extremeII_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* F distribution [3; ch.27, p.332] */ + + +/*---------------------------------------------------------------------------*/ +/* Gamma distribution [2; ch.17, p.337] */ + +/* initialize special generator */ +int _unur_stdgen_gamma_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + +/* Rejection with log-logistic envelopes */ +double _unur_stdgen_sample_gamma_gll( UNUR_GEN *generator ); + +/* Acceptance Rejection combined with Acceptance Complement */ +double _unur_stdgen_sample_gamma_gs( UNUR_GEN *generator ); +double _unur_stdgen_sample_gamma_gd( UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Generalized hyperbolic distribution */ + + +/*---------------------------------------------------------------------------*/ +/* Generalized inverse Gaussian distribution [2; ch.15, p.284] */ + +/* initialize special generator */ +int _unur_stdgen_gig_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + +/* Ratio of Uniforms */ +double _unur_stdgen_sample_gig_gigru( UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Inverse Gaussian (Wald) distribution [2; ch.15, p.259] */ + + +/*---------------------------------------------------------------------------*/ +/* Laplace distribution [3; ch.24, p.164] */ + +/* initialize special generator */ +int _unur_stdgen_laplace_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Logistic distribution [3; ch.23, p.115] */ + +/* initialize special generator */ +int _unur_stdgen_logistic_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Lognormal distribution [2; ch.14, p.208] */ + + +/*---------------------------------------------------------------------------*/ +/* Lomax distribution (Pareto distr. of second kind) [2; ch.20, p.575] */ + +/* initialize special generator */ +int _unur_stdgen_lomax_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Meixner distribution */ + + +/*---------------------------------------------------------------------------*/ +/* Normal distribution [2; ch.13, p.80] */ + +/* initialize special generator */ +int _unur_stdgen_normal_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + +/* Box-Muller method */ +double _unur_stdgen_sample_normal_bm( UNUR_GEN *generator ); + +/* Polarmethod with rejection */ +double _unur_stdgen_sample_normal_pol( UNUR_GEN *generator ); + +/* Ratio-of-uniforms method with squeeze */ +double _unur_stdgen_sample_normal_quo( UNUR_GEN *generator ); + +/* "Naive" ratio-of-uniforms method */ +double _unur_stdgen_sample_normal_nquo( UNUR_GEN *generator ); + +/* Ratio-of-uniforms method with quadratic bounding curves */ +double _unur_stdgen_sample_normal_leva( UNUR_GEN *generator ); + +/* Kindermann-Ramage method */ +double _unur_stdgen_sample_normal_kr( UNUR_GEN *generator ); + +/* Acceptance-complement ratio */ +double _unur_stdgen_sample_normal_acr( UNUR_GEN *generator ); + +/* infamous sum-of-12-uniforms method. NEVER use it!! */ +double _unur_stdgen_sample_normal_sum( UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Pareto distribution (of first kind) [2; ch.20, p.574] */ + +/* initialize special generator */ +int _unur_stdgen_pareto_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Pearson VI distribution */ + + +/*---------------------------------------------------------------------------*/ +/* Perks distribution */ + + +/*---------------------------------------------------------------------------*/ +/* Planck distribution */ + + +/*---------------------------------------------------------------------------*/ +/* Power-exponential (Subbotin) distribution [3; ch.24, p.195] */ + +/* initialize special generator */ +int _unur_stdgen_powerexponential_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + +/* rejection method for logconcave densities */ +double _unur_stdgen_sample_powerexponential_epd( UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Rayleigh distribution [2; ch.18, p.456] */ + + +/*---------------------------------------------------------------------------*/ +/* Snedecor's F distribution */ + + +/*---------------------------------------------------------------------------*/ +/* Student's t distribution [3; ch. 28; p. 362] */ + +/* initialize special generator */ +int _unur_stdgen_student_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + +/* Polar Method */ +double _unur_stdgen_sample_student_tpol( UNUR_GEN *generator ); + +/* Ratio of Uniforms */ +double _unur_stdgen_sample_student_trouo( UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Slash distribution [2; ch.12, p.63] */ + +/* initialize special generator */ +int _unur_stdgen_slash_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + +/* Ratio of normal and uniform random variates */ +double _unur_stdgen_sample_slash_slash( UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Triangular distribution [3; ch.26, p.297] */ + +/* initialize special generator */ +int _unur_stdgen_triangular_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Uniform distribution [3; ch.26, p.276] */ + +/* initialize special generator */ +int _unur_stdgen_uniform_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Variance Gamma distribution */ + +/*---------------------------------------------------------------------------*/ +/* Weibull distribution [2; ch.21, p.628] */ + +/* initialize special generator */ +int _unur_stdgen_weibull_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Continuous multivariate distributions * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Multinormal distribution [5; ch.45, p.107] */ + +/* initialize special generator */ +int _unur_stdgen_multinormal_init( UNUR_GEN *generator ); + +/* Cholesky decomposition of covariance matrix */ +int _unur_stdgen_sample_multinormal_cholesky( UNUR_GEN *generator, double *X ); + +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Continuous matrix distributions * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Random correlation matrix */ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Discrete univariate distributions * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Binomial distribution [1; ch.3, p.105] */ + +/* initialize special generator */ +int _unur_stdgen_binomial_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Geometric distribution [1; ch.5.2, p.201] */ + +/* initialize special generator */ +int _unur_stdgen_geometric_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + +/* Inversion */ +int _unur_stdgen_sample_geometric_inv( UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Hypergometric distribution [1; ch.6, p.237] */ + +/* initialize special generator */ +int _unur_stdgen_hypergeometric_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Logarithmic distribution [1; ch.7, p.285] */ + +/* initialize special generator */ +int _unur_stdgen_logarithmic_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + +/* Acceptance Rejection */ +int _unur_stdgen_sample_logarithmic_lsk( UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Negative Binomial distribution [1; ch.5.1, p.200] */ + +/* initialize special generator */ +/* int _unur_stdgen_negativebinomial_init( UNUR_PAR *parameters, UNUR_GEN *generator ); */ + +/* Compound method */ +/* int _unur_stdgen_sample_negativebinomial_nbp( UNUR_GEN *generator ); */ + + +/*---------------------------------------------------------------------------*/ +/* Poisson distribution [1; ch.4, p.151] */ + +/* initialize special generator */ +int _unur_stdgen_poisson_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + +/* Tabulated Inversion combined with Acceptance Complement */ +int _unur_stdgen_sample_poisson_pdtabl( UNUR_GEN *generator ); +int _unur_stdgen_sample_poisson_pdac( UNUR_GEN *generator ); + +/* Tabulated Inversion combined with Patchwork Rejection */ +/* int _unur_stdgen_sample_poisson_pdtabl( UNUR_GEN *generator ); */ +int _unur_stdgen_sample_poisson_pprsc( UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ +/* Zipf (or Zeta) distribution [1; ch.11.20, p.465] */ + +/* initialize special generator */ +int _unur_stdgen_zipf_init( UNUR_PAR *parameters, UNUR_GEN *generator ); + +/* Acceptance Rejection */ +int _unur_stdgen_sample_zipf_zet( UNUR_GEN *generator ); + + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Macros * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* set routine for sampling */ +#define _unur_cstd_set_sampling_routine(gen,routine) \ + do { \ + if ((gen)==NULL) return UNUR_SUCCESS; /* test existence only */ \ + (gen)->sample.cont = (routine); /* set pointer */ \ + ((struct unur_cstd_gen*)gen->datap)->sample_routine_name = #routine; /* set routine name */ \ + } while (0) + + +#define _unur_dstd_set_sampling_routine(gen,routine) \ + do { \ + if ((gen)==NULL) return UNUR_SUCCESS; /* test existence only */ \ + (gen)->sample.discr = (routine); /* set pointer */ \ + ((struct unur_dstd_gen*)gen->datap)->sample_routine_name = #routine; /* set routine name */ \ + } while (0) + +/*---------------------------------------------------------------------------*/ +#endif /* UNUR_DISTRIBUTIONS_SOURCE_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/unur_stddistr.h b/vendor/unuran-1.11.0/src/distributions/unur_stddistr.h new file mode 100644 index 0000000..b744242 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/unur_stddistr.h @@ -0,0 +1,121 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unur_stddistr.h * + * * + * PURPOSE: * + * defines identifiers for standard distributions * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef UNUR_STDDISTR_H_SEEN +#define UNUR_STDDISTR_H_SEEN +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* indentifiers for standard distributions */ + +#define UNUR_DISTR_STD (0x00000001u) /* flag for UNU.RAN standard distribution */ + +enum { + UNUR_DISTR_GENERIC = 0x00000000u, + + UNUR_DISTR_CORDER = 0x00000010u, /* order statistics */ + UNUR_DISTR_CXTRANS = 0x00000020u, /* distribution of transformed RV */ + UNUR_DISTR_CONDI = 0x00000030u, /* full conditional distribution */ + + /** pdf cdf mode area gen doc */ + UNUR_DISTR_BETA = 0x00000101u, /* X X X X X . */ + UNUR_DISTR_CAUCHY = 0x00000201u, /* X X X X X . */ + UNUR_DISTR_CHI = 0x00000301u, /* X X X X X . */ + UNUR_DISTR_CHISQUARE = 0x00000401u, /* X X X X . . */ + UNUR_DISTR_EPANECHNIKOV = 0x00000501u, /* . . . . . . */ + UNUR_DISTR_EXPONENTIAL = 0x00000601u, /* X X X X X . */ + UNUR_DISTR_EXTREME_I = 0x00000701u, /* X X X X X . */ + UNUR_DISTR_EXTREME_II = 0x00000801u, /* X X X X X . */ + UNUR_DISTR_F = 0x00000901u, /* X X X X X . */ + UNUR_DISTR_GAMMA = 0x00000a01u, /* X X X X X . */ + UNUR_DISTR_GHYP = 0x00002401u, /* X . . . . . */ + UNUR_DISTR_GIG = 0x00000b01u, /* X . X . X . */ + UNUR_DISTR_GIG2 = 0x00002201u, /* X . X . X . */ + UNUR_DISTR_HYPERBOLIC = 0x00002301u, /* X . X . . . */ + UNUR_DISTR_IG = 0x00002101u, /* X X X . . . */ + UNUR_DISTR_LAPLACE = 0x00000c01u, /* X X X X X . */ + UNUR_DISTR_LOGISTIC = 0x00000d01u, /* X X X X X . */ + UNUR_DISTR_LOGNORMAL = 0x00000e01u, /* X X . X . . */ + UNUR_DISTR_LOMAX = 0x00000f01u, /* X X X X . . */ + UNUR_DISTR_MEIXNER = 0x00002601u, /* X . . X . . */ + UNUR_DISTR_NORMAL = 0x00001001u, /* X X X X X . */ + UNUR_DISTR_GAUSSIAN = 0x00001001u, /* same as NORMAL */ + UNUR_DISTR_PARETO = 0x00001101u, /* X X X X . . */ + UNUR_DISTR_POWEREXPONENTIAL = 0x00001201u, /* X X X X X . */ + UNUR_DISTR_RAYLEIGH = 0x00001301u, /* X X X X . . */ + UNUR_DISTR_SLASH = 0x00001401u, /* X . X X X . */ + UNUR_DISTR_STUDENT = 0x00001501u, /* X (X) X X X . */ + UNUR_DISTR_TRIANGULAR = 0x00001601u, /* X X X X X . */ + UNUR_DISTR_UNIFORM = 0x00002001u, /* X X X X . . */ + UNUR_DISTR_BOXCAR = 0x00002001u, /* same as UNIFORM */ + UNUR_DISTR_VG = 0x00002501u, /* X . . . . . */ + UNUR_DISTR_WEIBULL = 0x00001801u, /* X X X X X . */ + + UNUR_DISTR_BURR_I = 0x0000b001u, /* . X . . X . */ + UNUR_DISTR_BURR_II = 0x0000b101u, /* . X . . X . */ + UNUR_DISTR_BURR_III = 0x0000b201u, /* . X . . X . */ + UNUR_DISTR_BURR_IV = 0x0000b301u, /* . X . . X . */ + UNUR_DISTR_BURR_V = 0x0000b401u, /* . X . . X . */ + UNUR_DISTR_BURR_VI = 0x0000b501u, /* . X . . X . */ + UNUR_DISTR_BURR_VII = 0x0000b601u, /* . X . . X . */ + UNUR_DISTR_BURR_VIII = 0x0000b701u, /* . X . . X . */ + UNUR_DISTR_BURR_IX = 0x0000b801u, /* . X . . X . */ + UNUR_DISTR_BURR_X = 0x0000b901u, /* . X . . X . */ + UNUR_DISTR_BURR_XI = 0x0000ba01u, /* . X . . . . */ + UNUR_DISTR_BURR_XII = 0x0000bb01u, /* . X . . X . */ + + /** pmf cdf mode sum gen doc */ + UNUR_DISTR_BINOMIAL = 0x00010001u, /* . . . . . . */ + UNUR_DISTR_GEOMETRIC = 0x00020001u, /* X X X X X . */ + UNUR_DISTR_HYPERGEOMETRIC = 0x00030001u, /* . . . . . . */ + UNUR_DISTR_LOGARITHMIC = 0x00040001u, /* X . X X X . */ + UNUR_DISTR_NEGATIVEBINOMIAL = 0x00050001u, /* X . X X X . */ + UNUR_DISTR_POISSON = 0x00060001u, /* X X X X X . */ + UNUR_DISTR_ZIPF = 0x00070001u, /* X . X . X . */ + + /** pdf doc */ + UNUR_DISTR_MCAUCHY = 0x01000001u, /* X . */ + UNUR_DISTR_MNORMAL = 0x02000001u, /* X . */ + UNUR_DISTR_MSTUDENT = 0x03000001u, /* X . */ + UNUR_DISTR_MEXPONENTIAL = 0x04000001u, /* X . */ + UNUR_DISTR_COPULA = 0x05000001u, /* . . */ + + /** */ + UNUR_DISTR_MCORRELATION = 0x10000001u /* */ + +}; + +/*---------------------------------------------------------------------------*/ +#endif /* UNUR_STDDISTR_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/vc_copula.c b/vendor/unuran-1.11.0/src/distributions/vc_copula.c new file mode 100644 index 0000000..d905264 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/vc_copula.c @@ -0,0 +1,174 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: vc_copula.c * + * * + * REFERENCES: * + * * + ***************************************************************************** + * * + * distr: Copula * + * * + * domain: (0,1)^(dim) * + * * + * parameters: * + * 0: rankcorr ... rank correlation matrix (identity matrix) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +/* #include */ +#include "unur_distributions.h" +#include "unur_distributions_source.h" +/* #include "unur_stddistr.h" */ + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "copula"; + +/*---------------------------------------------------------------------------*/ +/* parameters */ + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cvec +/* #define LOGNORMCONSTANT (distr->data.cvec.norm_constant) */ + +/*---------------------------------------------------------------------------*/ +/* function prototypes */ + +/* static double _unur_pdf_copula( const double *x, UNUR_DISTR *distr ); */ +/* static double _unur_logpdf_copula( const double *x, UNUR_DISTR *distr ); */ +/* static int _unur_dlogpdf_copula( double *result, const double *x, UNUR_DISTR *distr ); */ +/** TODO: + static int _unur_upd_mode_copula( UNUR_DISTR *distr ); + static int _unur_upd_area_copula( UNUR_DISTR *distr ); +**/ + +/*---------------------------------------------------------------------------*/ + +/* double */ +/* _unur_pdf_copula( const double *x, UNUR_DISTR *distr ) */ +/* { */ +/* return 1; */ +/* } /\* end of _unur_pdf_copula() *\/ */ + +/*---------------------------------------------------------------------------*/ + +/* int */ +/* _unur_dpdf_copula( double *result, const double *x, UNUR_DISTR *distr ) */ +/* { */ +/* return UNUR_SUCCESS; */ +/* } /\* end of _unur_dlogpdf_copula() *\/ */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Make distribution object **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_copula( int dim, const double *rankcorr ) +/* + @code{UNUR_DISTR *unur_distr_copula(int dim, const double *rankcorr)} + creates a distribution object for a copula with @var{dim} components. + @var{rankcorr} is an array of size @var{dim}x@var{dim} and holds the + rank correlation matrix (Spearman's correlation), where the rows of + the matrix are stored consecutively in this array. The NULL pointer + can be used instead the identity matrix. + + If @var{covar} is not a valid rank correlation matrix (i.e., not positive + definite) then no distribution object is created and NULL is returned. +*/ +{ + struct unur_distr *distr; + struct unur_distr *marginal; + + /* get new (empty) distribution object */ + distr = unur_distr_cvec_new(dim); + + /* check new parameter for generator */ + if (distr == NULL) { + /* error: dim < 1 */ + return NULL; + } + + /* set distribution id */ + distr->id = UNUR_DISTR_COPULA; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = NULL; + + /* copy (and check) parameters */ + if ( unur_distr_cvec_set_rankcorr(distr,rankcorr)!=UNUR_SUCCESS ) { + unur_distr_free( distr ); + return NULL; + } + + /* functions: none */ + + /* set marginal distributions */ + marginal = unur_distr_uniform(NULL,0); + unur_distr_cvec_set_marginals(distr,marginal); + unur_distr_free(marginal); + + /* copy other parameters of distribution */ + /* none */ + + /* number of other parameters */ + /* DISTR.n_params = 0; ... default */ + + /* domain */ + + /* normalization constant */ + + /* mode */ + + /* volume below p.d.f. */ + + /* indicate which parameters are set (additional to mean and covariance) */ + distr->set |= ( 0 ); + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_copula() */ + +/*---------------------------------------------------------------------------*/ +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/vc_multicauchy.c b/vendor/unuran-1.11.0/src/distributions/vc_multicauchy.c new file mode 100644 index 0000000..f272b37 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/vc_multicauchy.c @@ -0,0 +1,398 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: vc_multicauchy.c * + * * + * REFERENCES: * + * * + * [5] S. Kotz, N. Balakrishnan, and N.L. Johnson * + * Continuous Multivariate Distributions, * + * Volume 1: Models and Applications * + * John Wiley & Sons, Inc., New York, 2000 * + ***************************************************************************** + * * + * distr: Multivariate Cauchy distribution [5; ch.45, p.219] * + * * + * pdf: f(x) = 1 / ( 1 + (x-mu)^t . Sigma^-1 . (x-mu) )^(dim+1)/2 * + * domain: Reals^(dim) * + * constant: Gamma((dim+1)/2) / ( pi^((dim+1)/2) * sqrt(det(Sigma)) ) * + * * + * parameters: * + * 0: mean ... mu (default : 0-vector) * + * 1: "covar" ... Sigma (default : identity matrix) * + * * + ***************************************************************************** + * * + * standard form * + * * + * pdf: f(x) = 1 / ( 1 + x^t . x )^(dim+1)/2 * + * domain: Reals^(dim) * + * constant: Gamma((dim+1)/2) / pi^((dim+1)/2) * + * * + * parameters: * + * none * + * * + * mean = (0,...,0) ... 0-vector * + * covar = identity matrix * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +#ifdef USE_DEPRECATED_CODE +# include +#endif + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "multicauchy"; + +/*---------------------------------------------------------------------------*/ +/* parameters */ + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cvec +#define LOGNORMCONSTANT (distr->data.cvec.norm_constant) + +/*---------------------------------------------------------------------------*/ +/* function prototypes */ + +static double _unur_pdf_multicauchy( const double *x, UNUR_DISTR *distr ); +static double _unur_logpdf_multicauchy( const double *x, UNUR_DISTR *distr ); +static int _unur_dlogpdf_multicauchy( double *result, const double *x, UNUR_DISTR *distr ); +static double _unur_pdlogpdf_multicauchy( const double *x, int coord, UNUR_DISTR *distr ); + +static int _unur_upd_mode_multicauchy( UNUR_DISTR *distr ); +static int _unur_upd_volume_multicauchy( UNUR_DISTR *distr ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_multicauchy( const double *x, UNUR_DISTR *distr ) +{ + return exp( _unur_logpdf_multicauchy( x, distr ) ); +} /* end of _unur_pdf_multicauchy() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_multicauchy( const double *x, UNUR_DISTR *distr ) +{ +#define idx(a,b) ((a)*dim+(b)) + + int i,j, dim; + double *mean; + const double *covar_inv; + + double xx; /* argument used in the evaluation of exp(-xx/2) */ + double cx; /* element of multiplication of covariance matrix and x */ + + dim = distr->dim; + + if (DISTR.mean == NULL) { + if (DISTR.covar != NULL) { + _unur_warning(distr->name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + } + /* standard form */ + xx=0.; + for (i=0; idim; + mean = DISTR.mean; + + /* get inverse of covariance matrix */ + covar_inv = unur_distr_cvec_get_covar_inv(distr); + if (covar_inv==NULL) + /* inverse of covariance matrix not available */ + return UNUR_FAILURE; + + /* calculating (x-mean)' Sigma^-1 (x-mean) */ + xx=0.; + for (i=0; idim; + double *mean = DISTR.mean; + + /* check arguments */ + if (coord < 0 || coord >= dim) { + _unur_warning(distr->name,UNUR_ERR_DISTR_DOMAIN,"invalid coordinate"); + return UNUR_INFINITY; + } + + /* get inverse of covariance matrix */ + covar_inv = unur_distr_cvec_get_covar_inv(distr); + if (covar_inv==NULL) + /* inverse of covariance matrix not available */ + return UNUR_INFINITY; + + /* calculating (x-mean)' Sigma^-1 (x-mean) */ + xx=0.; + for (i=0; idim * sizeof(double) ); + memcpy( DISTR.mode, DISTR.mean, distr->dim * sizeof(double) ); + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_multicauchy() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_volume_multicauchy( UNUR_DISTR *distr ) +{ + /* TODO: checking for modified domain */ + + double det_covar; + + /* log of normalization constant */ + det_covar = (DISTR.covar == NULL) + ? 1. : _unur_matrix_determinant(distr->dim, DISTR.covar); + LOGNORMCONSTANT = _unur_SF_ln_gamma((distr->dim+1)/2.) + - ( (distr->dim+1) * log(M_PI) + log(det_covar) ) / 2.; + + return UNUR_SUCCESS; +} /* end of _unur_upd_volume_multicauchy() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Make distribution object **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_multicauchy( int dim, const double *mean, const double *covar ) +/* + @code{UNUR_DISTR *unur_distr_multicauchy(int dim, const double *mean, const double *covar)} + creates a distribution object for the multivariate Cauchy distribution with + @var{dim} components. @var{mean} is an array of size @var{dim}. + A NULL pointer for @var{mean} is interpreted as the zero + vector (0,@dots{},0). + @var{covar} is an array of size @var{dim}x@var{dim} and holds the + covariance matrix, where the rows of the matrix are stored + consecutively in this array. The NULL pointer can be used + instead the identity matrix. + If @var{covar} is not a valid covariance matrix (i.e., not positive + definite) then no distribution object is created and NULL is returned. + + For standard form of the distribution use the null vector for @var{mean} and + the identity matrix for @var{covar}. +*/ +{ + struct unur_distr *distr; + double det_covar; /* determinant of covariance matrix */ + + /* get new (empty) distribution object */ + distr = unur_distr_cvec_new(dim); + + /* check new parameter for generator */ + if (distr == NULL) { + /* error: dim < 1 */ + return NULL; + } + + /* set distribution id */ + distr->id = UNUR_DISTR_MCAUCHY; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = NULL; + + /* copy (and check) parameters */ + if ((unur_distr_cvec_set_mean(distr,mean)!=UNUR_SUCCESS) || + (unur_distr_cvec_set_covar(distr,covar)!=UNUR_SUCCESS) ) { + unur_distr_free( distr ); + return NULL; + } + + /* functions */ + DISTR.pdf = _unur_pdf_multicauchy; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_multicauchy; /* pointer to logPDF */ + DISTR.dpdf = _unur_distr_cvec_eval_dpdf_from_dlogpdf; /* pointer to gradient of PDF */ + DISTR.dlogpdf = _unur_dlogpdf_multicauchy; /* pointer to gradient of logPDF */ + DISTR.pdpdf = _unur_distr_cvec_eval_pdpdf_from_pdlogpdf; /* pointer to part. deriv. of PDF */ + DISTR.pdlogpdf = _unur_pdlogpdf_multicauchy; /* pointer to partial derivative of logPDF */ + +#ifdef USE_DEPRECATED_CODE + /* set standardized marginal distributions */ + { + struct unur_distr *stdmarginal = unur_distr_cauchy(NULL,0); + unur_distr_cvec_set_stdmarginals(distr,stdmarginal); + unur_distr_free(stdmarginal); + } +#endif + + /* copy other parameters of distribution */ + /* none */ + + /* number of other parameters */ + /* DISTR.n_params = 0; ... default */ + + /* domain */ + + /* log of normalization constant */ + /* constant: Gamma((dim+1)/2) / ( pi^((dim+1)/2) * sqrt(det(Sigma)) ) */ + det_covar = (DISTR.covar == NULL) ? 1. : _unur_matrix_determinant(dim, DISTR.covar); + LOGNORMCONSTANT = _unur_SF_ln_gamma((distr->dim+1)/2.) + - ( (distr->dim+1) * log(M_PI) + log(det_covar) ) / 2.; + + /* mode */ + DISTR.mode = _unur_xmalloc( distr->dim * sizeof(double) ); + memcpy( DISTR.mode, DISTR.mean, distr->dim * sizeof(double) ); + + /* volume below p.d.f. */ + DISTR.volume = 1.; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_multicauchy; /* funct for computing mode */ + DISTR.upd_volume = _unur_upd_volume_multicauchy; /* funct for computing volume */ + + /* indicate which parameters are set (additional to mean and covariance) */ + distr->set |= ( UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_PDFVOLUME | + UNUR_DISTR_SET_MODE ); + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_multicauchy() */ + +/*---------------------------------------------------------------------------*/ +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/vc_multiexponential.c b/vendor/unuran-1.11.0/src/distributions/vc_multiexponential.c new file mode 100644 index 0000000..b229755 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/vc_multiexponential.c @@ -0,0 +1,386 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: vc_multiexponential.c * + * * + ***************************************************************************** + * * + * distr: Multiexponential distribution * + * * + * REFERENCES: * + * * + * [5] S. Kotz, N. Balakrishnan, and N.L. Johnson * + * Continuous Multivariate Distributions, * + * Volume 1: Models and Applications * + * John Wiley & Sons, Inc., New York, 2000 * + * * + * John E. Freund * + * A Bivariate Extension of the Exponential Distribution * + * Journal of the American Statistical Association, * + * Vol. 56, p971-977 (1961) * + * * + * Asit P. Basu, Kai Sun * + * Multivariate Exponential Distributions with Constant Failure Rates * + * Journal of Multivariate Analysis, * + * Vol. 61, p159-169 (1997) * + * * + * * + * pdf: f(x) = Prod_{i=0}^{i=dim-1} * + * exp(-(dim-i) (x_{i}-x_{i-1} - (theta_i-theta_{i-1}) ) / sigma_i) * + * with x_{-1}=0 and theta_{-1}=0 * + * domain: [0, inf)^(dim) * + * constant: Prod_{i=0}^{i=dim-1} 1/sigma_i * + * * + * * + * parameters: * + * 0: sigma ... scale parameter (default : (1,1,...,1)-vector) * + * 1: theta ... location parameter (default : (0,0,...,0)-vector) * + * * + ***************************************************************************** + * * + * standard form * + * * + * pdf: f(x) = exp( - Sum_{i_0}^{i=dim-1} (dim-i) (x_{i}-x{i-1}) ) * + * domain: [0, inf)^(dim) * + * * + * parameters: * + * none * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "multiexponential"; + +/*---------------------------------------------------------------------------*/ +/* parameters */ +#define INDEX_SIGMA 0 +#define INDEX_THETA 1 + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cvec +#define LOGNORMCONSTANT (distr->data.cvec.norm_constant) + +/*---------------------------------------------------------------------------*/ +/* function prototypes */ + +static double _unur_pdf_multiexponential( const double *x, UNUR_DISTR *distr ); +static double _unur_logpdf_multiexponential( const double *x, UNUR_DISTR *distr ); +static int _unur_dlogpdf_multiexponential( double *result, const double *x, UNUR_DISTR *distr ); + +static int _unur_set_params_multiexponential( UNUR_DISTR *distr, const double *sigma, const double *theta ); +static int _unur_upd_mode_multiexponential( UNUR_DISTR *distr ); +static int _unur_upd_volume_multiexponential( UNUR_DISTR *distr ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_multiexponential( const double *x, UNUR_DISTR *distr ) +{ + double flog; + flog=_unur_logpdf_multiexponential( x, distr ); + if (_unur_isfinite(flog)) /* && flog <= log(DBL_MAX) */ + return exp( flog ); + + return 0.; +} /* end of _unur_pdf_multiexponential() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_multiexponential( const double *x, UNUR_DISTR *distr ) +{ + int i, dim; + + double dx, sum; /* arguments used in the evaluation of the density */ + double *sigma, *theta; + + dim = distr->dim ; + + dx=0.; + sum=0.; + + sigma = DISTR.param_vecs[INDEX_SIGMA]; + theta = DISTR.param_vecs[INDEX_THETA]; + + /* TODO : reconsider logic concerning NULL pointers ? */ + if ( sigma==NULL || theta==NULL ) { + /* standard form */ + for (i=0; i UNUR_EPSILON here */ + dx /= sigma[i]; + sum -= (dim-i) * dx; + } + } + + return ( sum + LOGNORMCONSTANT); + +} /* end of _unur_logpdf_multiexponential() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_dlogpdf_multiexponential( double *result, const double *x, UNUR_DISTR *distr ) +{ + int i, dim; + + double dx, fx1, fx2; + double *xx; + + dim = distr->dim; + + /* working array */ + xx=malloc(dim*sizeof(double)); + + /* calculation of the dlogpdf components */ + dx=1e7*UNUR_EPSILON; /* should work for the exponential distribution */ + + for (i=0; idim * sizeof(double)); + for (i=0; idim; i++) default_sigma[i]=1.; + unur_distr_cvec_set_pdfparams_vec( distr, INDEX_SIGMA, default_sigma, distr->dim ); + if (default_sigma) free(default_sigma); + } + else { + /* check parameter sigma */ + for (i=0; idim; i++) { + if ( sigma[i] <= UNUR_EPSILON ) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"sigma is too low"); + return UNUR_ERR_DISTR_DOMAIN; + } + } + unur_distr_cvec_set_pdfparams_vec( distr, INDEX_SIGMA, sigma, distr->dim ); + } + + /* copy the theta parameters into their parameter vectors */ + if(theta==NULL) { + /* initializing vector with default values */ + default_theta = _unur_xmalloc(distr->dim * sizeof(double) ); + for (i=0; idim; i++) default_theta[i]=0.; + unur_distr_cvec_set_pdfparams_vec( distr, INDEX_THETA, default_theta, distr->dim ); + if (default_theta) free(default_theta); + } + else { + unur_distr_cvec_set_pdfparams_vec( distr, INDEX_THETA, theta, distr->dim ); + } + + /* store number of parameters */ + DISTR.n_params = 0; /* we have only vector parameter here ... */ + + return UNUR_SUCCESS; +} /* end of _unur_set_params_multiexponential() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_mode_multiexponential( UNUR_DISTR *distr ) +{ + /* TODO: checking if mode is inside domain */ + int i; + + if (DISTR.mode == NULL) + DISTR.mode = _unur_xmalloc( distr->dim * sizeof(double) ); + for (i=0; idim; i++) DISTR.mode[i]=0.; + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_multiexponential() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_volume_multiexponential( UNUR_DISTR *distr ) +{ + /* TODO: checking for modified domain */ + int i; + double sumsigma = 0.; + + for (i=0; idim; i++) { + sumsigma += DISTR.param_vecs[INDEX_SIGMA][i]; + } + LOGNORMCONSTANT = - 1. / sumsigma; + + return UNUR_SUCCESS; +} /* end of _unur_upd_volume_multiexponential() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Make distribution object **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_multiexponential( int dim, const double *sigma, const double *theta ) +/* + @code{UNUR_DISTR *unur_distr_multiexponential(int dim, const double *sigma, const double *theta)} + creates a distribution object for the linear multivariate exponential distribution + with @var{dim} components. + @var{sigma} (the scale parameter) is an array of size @var{dim} and each element must be strictly > 0. + @var{theta} (the location parameter) is an array of size @var{dim}. + A NULL pointer for @var{sigma} OR @var{theta} chooses the standard form, where + the scale parameter is (1,@dots{},1) and the location parameter is (0,@dots,0). +*/ +{ + struct unur_distr *distr; + struct unur_distr **marginal; + + int i; + double sumsigma; /* used in the calculation of LOGNORMCONSTANT */ + double alpha; + + /* get new (empty) distribution object */ + distr = unur_distr_cvec_new(dim); + + /* check new parameter for generator */ + if (distr == NULL) { + /* error: dim < 1 */ + return NULL; + } + + /* set distribution id */ + distr->id = UNUR_DISTR_MEXPONENTIAL; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = NULL; + + /* functions */ + DISTR.pdf = _unur_pdf_multiexponential; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_multiexponential; /* pointer to logPDF */ + DISTR.dpdf = _unur_distr_cvec_eval_dpdf_from_dlogpdf; /* pointer to gradient of PDF */ + DISTR.dlogpdf = _unur_dlogpdf_multiexponential; /* pointer to gradient of logPDF */ + DISTR.pdpdf = _unur_distr_cvec_eval_pdpdf_from_pdlogpdf; /* pointer to part. deriv. of PDF */ + /*DISTR.pdlogpdf = _unur_pdlogpdf_multiexponential;*/ /* pointer to partial derivative of logPDF */ + + /* set standardized marginal distributions */ + marginal = malloc(distr->dim * sizeof(struct unur_distr*)); + for (i=0; idim; i++) { + alpha = i+1.; /* shape parameter */ + marginal[i] = unur_distr_gamma(&alpha, 1); + } + unur_distr_cvec_set_marginal_array(distr, marginal); + + /* free memory allocated to the marginal array */ + for (i=0; idim; i++) + if (marginal[i]) _unur_distr_free(marginal[i]); + if (marginal) free(marginal); + + /* set parameters for distribution */ + if (_unur_set_params_multiexponential(distr, sigma, theta)!=UNUR_SUCCESS) { + _unur_distr_free(distr); return NULL; + } + + /* domain */ + + /* log of normalization constant */ + /* constant: Prod_{i=0}^{i=dim-1} 1/sigma_i */ + + sumsigma = 0.; + for (i=0; idim; i++) { + sumsigma += DISTR.param_vecs[INDEX_SIGMA][i]; + } + LOGNORMCONSTANT = - 1. / sumsigma; + + /* mode */ + DISTR.mode = _unur_xmalloc(distr->dim * sizeof(double) ); + for (i=0; idim; i++) DISTR.mode[i]=0.; + + /* volume below p.d.f. */ + DISTR.volume = 1.; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_multiexponential; /* funct for computing mode */ + DISTR.upd_volume = _unur_upd_volume_multiexponential; /* funct for computing volume */ + + /* indicate which parameters are set (additional to mean and covariance) */ + distr->set |= ( UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_PDFVOLUME | + UNUR_DISTR_SET_MODE ); + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_multiexponential() */ + +/*---------------------------------------------------------------------------*/ +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/vc_multinormal.c b/vendor/unuran-1.11.0/src/distributions/vc_multinormal.c new file mode 100644 index 0000000..93f2bf4 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/vc_multinormal.c @@ -0,0 +1,369 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: vc_multinormal.c * + * * + * REFERENCES: * + * * + * [5] S. Kotz, N. Balakrishnan, and N.L. Johnson * + * Continuous Multivariate Distributions, * + * Volume 1: Models and Applications * + * John Wiley & Sons, Inc., New York, 2000 * + * * + ***************************************************************************** + * * + * distr: Multinormal distribution [5; ch.45, p.107] * + * * + * pdf: f(x) = exp( -1/2 * (x-mu)^t . Sigma^(-1) . (x-mu) ) * + * domain: Reals^(dim) * + * constant: 1 / ( (2 pi)^(dim/2) * sqrt(det(Sigma)) ) * + * * + * parameters: * + * 0: mean ... mu (0-vector) * + * 1: covar ... Sigma (identity matrix) * + * * + ***************************************************************************** + * * + * standard form * + * * + * pdf: f(x) = exp( -1/2 * x^t . x ) * + * domain: Reals^(dim) * + * constant: 1/(2 pi)^(dim/2) * + * * + * parameters: * + * none * + * * + * mean = (0,...,0) ... 0-vector * + * covar = identity matrix * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +#ifdef USE_DEPRECATED_CODE +# include +#endif + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "multinormal"; + +/*---------------------------------------------------------------------------*/ +/* parameters */ + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cvec +#define LOGNORMCONSTANT (distr->data.cvec.norm_constant) + +/*---------------------------------------------------------------------------*/ +/* function prototypes */ + +static double _unur_pdf_multinormal( const double *x, UNUR_DISTR *distr ); +static double _unur_logpdf_multinormal( const double *x, UNUR_DISTR *distr ); +static int _unur_dlogpdf_multinormal( double *result, const double *x, UNUR_DISTR *distr ); +static double _unur_pdlogpdf_multinormal( const double *x, int coord, UNUR_DISTR *distr ); + +static int _unur_upd_mode_multinormal( UNUR_DISTR *distr ); +static int _unur_upd_volume_multinormal( UNUR_DISTR *distr ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_multinormal( const double *x, UNUR_DISTR *distr ) +{ + return exp( _unur_logpdf_multinormal( x, distr ) ); +} /* end of _unur_pdf_multinormal() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_multinormal( const double *x, UNUR_DISTR *distr ) +{ +#define idx(a,b) ((a)*dim+(b)) + + int i,j, dim; + double *mean; + const double *covar_inv; + + double xx; /* argument used in the evaluation of exp(-xx/2) */ + double cx; /* element of multiplication of covariance matrix and x */ + + dim = distr->dim; + + if (DISTR.mean == NULL) { + if (DISTR.covar != NULL) { + _unur_warning(distr->name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + } + /* standard form */ + xx=0.; + for (i=0; idim; + mean = DISTR.mean; + + /* get inverse of covariance matrix */ + covar_inv = unur_distr_cvec_get_covar_inv(distr); + if (covar_inv==NULL) + /* inverse of covariance matrix not available */ + return UNUR_FAILURE; + + for (i=0; idim; + mean = DISTR.mean; + + /* check arguments */ + if (coord < 0 || coord >= dim) { + _unur_warning(distr->name,UNUR_ERR_DISTR_DOMAIN,"invalid coordinate"); + return UNUR_INFINITY; + } + + /* get inverse of covariance matrix */ + covar_inv = unur_distr_cvec_get_covar_inv(distr); + if (covar_inv==NULL) + /* inverse of covariance matrix not available */ + return UNUR_INFINITY; + + result = 0.; + for (j=0; jdim * sizeof(double) ); + memcpy( DISTR.mode, DISTR.mean, distr->dim * sizeof(double) ); + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_multinormal() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_volume_multinormal( UNUR_DISTR *distr ) +{ + /* TODO: checking for modified domain */ + + double det_covar; + + /* log of normalization constant */ + det_covar = (DISTR.covar == NULL) + ? 1. : _unur_matrix_determinant(distr->dim, DISTR.covar); + LOGNORMCONSTANT = - ( distr->dim * log(2 * M_PI) + log(det_covar) ) / 2.; + + return UNUR_SUCCESS; +} /* end of _unur_upd_volume_multinormal() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Make distribution object **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_multinormal( int dim, const double *mean, const double *covar ) + +/* + @code{UNUR_DISTR *unur_distr_multinormal(int dim, const double *mean, const double *covar)} + creates a distribution object for the multinormal distribution with + @var{dim} components. @var{mean} is an array of size @var{dim}. + A NULL pointer for @var{mean} is interpreted as the zero + vector (0,@dots{},0). + @var{covar} is an array of size @var{dim}x@var{dim} and holds the + covariance matrix, where the rows of the matrix are stored + consecutively in this array. The NULL pointer can be used + instead the identity matrix. + If @var{covar} is not a valid covariance matrix (i.e., not positive + definite) then no distribution object is created and NULL is returned. + + For standard form of the distribution use the null vector for @var{mean} and + the identity matrix for @var{covar}. +*/ + +{ + struct unur_distr *distr; + double det_covar; /* determinant of covariance matrix */ + + /* get new (empty) distribution object */ + distr = unur_distr_cvec_new(dim); + + /* check new parameter for generator */ + if (distr == NULL) { + /* error: dim < 1 */ + return NULL; + } + + /* set distribution id */ + distr->id = UNUR_DISTR_MNORMAL; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = _unur_stdgen_multinormal_init; + + /* copy (and check) parameters */ + if ((unur_distr_cvec_set_mean(distr,mean)!=UNUR_SUCCESS) || + (unur_distr_cvec_set_covar(distr,covar)!=UNUR_SUCCESS) ) { + unur_distr_free( distr ); + return NULL; + } + + /* functions */ + DISTR.pdf = _unur_pdf_multinormal; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_multinormal; /* pointer to logPDF */ + DISTR.dpdf = _unur_distr_cvec_eval_dpdf_from_dlogpdf; /* pointer to gradient of PDF */ + DISTR.dlogpdf = _unur_dlogpdf_multinormal; /* pointer to gradient of logPDF */ + DISTR.pdpdf = _unur_distr_cvec_eval_pdpdf_from_pdlogpdf; /* pointer to part. deriv. of PDF */ + DISTR.pdlogpdf = _unur_pdlogpdf_multinormal; /* pointer to partial derivative of logPDF */ + +#ifdef USE_DEPRECATED_CODE + { + /* set standardized marginal distributions */ + struct unur_distr *stdmarginal = unur_distr_normal(NULL,0); + unur_distr_cvec_set_stdmarginals(distr,stdmarginal); + unur_distr_free(stdmarginal); + } +#endif + + /* copy other parameters of distribution */ + /* none */ + + /* number of other parameters */ + /* DISTR.n_params = 0; ... default */ + + /* domain */ + + /* log of normalization constant */ + det_covar = (DISTR.covar == NULL) ? 1. : _unur_matrix_determinant(dim, DISTR.covar); + LOGNORMCONSTANT = - ( distr->dim * log(2 * M_PI) + log(det_covar) ) / 2.; + + /* mode */ + DISTR.mode = _unur_xmalloc( distr->dim * sizeof(double) ); + memcpy( DISTR.mode, DISTR.mean, distr->dim * sizeof(double) ); + + /* volume below p.d.f. */ + DISTR.volume = 1.; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_multinormal; /* funct for computing mode */ + DISTR.upd_volume = _unur_upd_volume_multinormal; /* funct for computing volume */ + + /* indicate which parameters are set (additional to mean and covariance) */ + distr->set |= ( UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_PDFVOLUME | + UNUR_DISTR_SET_MODE ); + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_multinormal() */ + +/*---------------------------------------------------------------------------*/ +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/vc_multinormal_gen.c b/vendor/unuran-1.11.0/src/distributions/vc_multinormal_gen.c new file mode 100644 index 0000000..4965148 --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/vc_multinormal_gen.c @@ -0,0 +1,195 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: vc_multinormal_gen.c * + * * + * Special generators for MultiNormal distribution * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2007 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" + +/*---------------------------------------------------------------------------*/ +/* init routines for special generators */ + +static int _unur_stdgen_init_multinormal_cholesky( struct unur_gen *gen ); + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define PAR ((struct unur_mvstd_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_mvstd_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cvec /* data for distribution in generator object */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Inititialize **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_multinormal_init( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize special generator for multinormal distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check parameters */ + /* the generator does not work correctly when the domain has been truncated*/ + if ( gen->distr->set & UNUR_DISTR_SET_DOMAINBOUNDED ) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"truncated domain not allowed"); + return UNUR_FAILURE; + } + + /* set sampling routine */ + gen->sample.cvec = _unur_stdgen_sample_multinormal_cholesky; + + /* set routine name */ + GEN->sample_routine_name = "_unur_stdgen_sample_multinormal_cholesky"; + + /* run special init routine */ + return _unur_stdgen_init_multinormal_cholesky(gen); +} /* end of _unur_stdgen_multinormal_init() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Special generators **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * MultiNormal Distribution: Cholesky decomposition * + * * + ***************************************************************************** + * * + * FUNCTION: - samples a random number from the * + * MultiNormal distribution N(mu,sigma). * + * * + ***************************************************************************** + * UNURAN (c) 2007 W. Hoermann & J. Leydold, Institut f. Statistik, WU Wien * + *****************************************************************************/ + +#define NORMAL gen->gen_aux /* pointer to normal variate generator */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_init_multinormal_cholesky( struct unur_gen *gen ) +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_MVSTD_GEN,UNUR_ERR_COOKIE); + + /* we do not allow truncated multinormal distributions. */ + /* [ currently checked in routine _unur_mvstd_check_par() ] */ + + /* make a normal variate generator */ + if (NORMAL==NULL) { + /* make generator object */ + struct unur_distr *distr = unur_distr_normal(NULL,0); + NORMAL = unur_init( unur_cstd_new( distr ) ); + _unur_check_NULL( gen->genid, NORMAL, UNUR_ERR_NULL ); + /* use same uniform random number generator */ + NORMAL->urng = gen->urng; + /* copy debugging flags */ + NORMAL->debug = gen->debug; + /* we do not need the distribution object any more */ + _unur_distr_free( distr ); + } + /* else we are in the re-init mode + --> there is no necessity to make the generator object again */ + + return UNUR_SUCCESS; +} /* end of _unur_stdgen_init_multinormal_cholesky() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_stdgen_sample_multinormal_cholesky( struct unur_gen *gen, double *X ) +{ +#define idx(a,b) ((a)*dim+(b)) + int j,k; + + int dim = gen->distr->dim; /* dimension of distribution */ + double *L = DISTR.cholesky; /* cholesky factor of covariance matrix */ + double *mean = DISTR.mean; /* mean (mode) of distribution */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_MVSTD_GEN,UNUR_ERR_COOKIE); + + /* generate random vector with independent components */ + for (j=0; j=0; k--) { + X[k] *= L[idx(k,k)]; + for (j=k-1; j>=0; j--) + X[k] += X[j] * L[idx(k,j)]; + X[k] += mean[k]; + } + + return UNUR_SUCCESS; + +#undef idx +} /* end of _unur_stdgen_sample_multinormal_cholesky() */ + +/*---------------------------------------------------------------------------*/ +#undef NORMAL +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/distributions/vc_multistudent.c b/vendor/unuran-1.11.0/src/distributions/vc_multistudent.c new file mode 100644 index 0000000..85ef3dd --- /dev/null +++ b/vendor/unuran-1.11.0/src/distributions/vc_multistudent.c @@ -0,0 +1,413 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: vc_multistudent.c * + * * + ***************************************************************************** + * * + * distr: Multivariate Student distribution [5; ch.45, p.219] * + * * + * pdf: f(x) = 1 / ( 1 + (x-mu)^t . Sigma^-1 . (x-mu) / m)^(dim+m)/2 )* + * domain: Reals^(dim) * + * constant: Gamma((dim+m)/2) * + * / ( Gamma(m/2) (m*pi)^(dim/2) * sqrt(det(Sigma)) ) * + * * + * parameters: * + * 0: d.f. ... m (default : 1) * + * 1: mean ... mu (default : 0-vector) * + * 2: "covar" ... Sigma (default : identity matrix) * + * * + ***************************************************************************** + * * + * standard form * + * * + * pdf: f(x) = 1 / ( 1 + x^t . x )^(dim+m)/2 * + * domain: Reals^(dim) * + * * + * parameters: * + * * + * d.f. = m * + * mean = (0,...,0) ... 0-vector * + * covar = identity matrix * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_distributions.h" +#include "unur_distributions_source.h" +#include "unur_stddistr.h" + +#ifdef USE_DEPRECATED_CODE +# include +#endif + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "multistudent"; + +/*---------------------------------------------------------------------------*/ +/* parameters */ +#define nu params[0] + +/*---------------------------------------------------------------------------*/ + +#define DISTR distr->data.cvec +#define LOGNORMCONSTANT (distr->data.cvec.norm_constant) + +/*---------------------------------------------------------------------------*/ +/* function prototypes */ + +static double _unur_pdf_multistudent( const double *x, UNUR_DISTR *distr ); +static double _unur_logpdf_multistudent( const double *x, UNUR_DISTR *distr ); +static int _unur_dlogpdf_multistudent( double *result, const double *x, UNUR_DISTR *distr ); +static double _unur_pdlogpdf_multistudent( const double *x, int coord, UNUR_DISTR *distr ); + +static int _unur_set_params_multistudent( UNUR_DISTR *distr, double df ); +static int _unur_upd_mode_multistudent( UNUR_DISTR *distr ); +static int _unur_upd_volume_multistudent( UNUR_DISTR *distr ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_multistudent( const double *x, UNUR_DISTR *distr ) +{ + return exp( _unur_logpdf_multistudent( x, distr ) ); +} /* end of _unur_pdf_multistudent() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_multistudent( const double *x, UNUR_DISTR *distr ) +{ +#define idx(a,b) ((a)*dim+(b)) + + int i,j, dim; + double *mean; + const double *covar_inv; + + double xx; /* argument used in the evaluation of exp(-xx/2) */ + double cx; /* element of multiplication of covariance matrix and x */ + + dim = distr->dim; + + if (DISTR.mean == NULL) { + if (DISTR.covar != NULL) { + _unur_warning(distr->name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + } + /* standard form */ + xx=0.; + for (i=0; idim; + mean = DISTR.mean; + + /* get inverse of covariance matrix */ + covar_inv = unur_distr_cvec_get_covar_inv(distr); + if (covar_inv==NULL) + /* inverse of covariance matrix not available */ + return UNUR_FAILURE; + + /* calculating (x-mean)' Sigma^-1 (x-mean) */ + xx=0.; + for (i=0; idim; + double *mean = DISTR.mean; + + /* check arguments */ + if (coord < 0 || coord >= dim) { + _unur_warning(distr->name,UNUR_ERR_DISTR_DOMAIN,"invalid coordinate"); + return UNUR_INFINITY; + } + + /* get inverse of covariance matrix */ + covar_inv = unur_distr_cvec_get_covar_inv(distr); + if (covar_inv==NULL) + /* inverse of covariance matrix not available */ + return UNUR_INFINITY; + + /* calculating (x-mean)' Sigma^-1 (x-mean) */ + xx=0.; + for (i=0; idim * sizeof(double) ); + memcpy( DISTR.mode, DISTR.mean, distr->dim * sizeof(double) ); + + return UNUR_SUCCESS; +} /* end of _unur_upd_mode_multistudent() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_volume_multistudent( UNUR_DISTR *distr ) +{ + /* TODO: checking for modified domain */ + + double det_covar; + + /* log of normalization constant */ + det_covar = (DISTR.covar == NULL) + ? 1. : _unur_matrix_determinant(distr->dim, DISTR.covar); + LOGNORMCONSTANT = _unur_SF_ln_gamma((distr->dim+DISTR.nu)/2.) + - _unur_SF_ln_gamma(DISTR.nu/2.) + - ( distr->dim * log(DISTR.nu*M_PI) + log(det_covar) ) / 2.; + + return UNUR_SUCCESS; +} /* end of _unur_upd_volume_multistudent() */ + +/*****************************************************************************/ +/** **/ +/** Make distribution object **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_multistudent( int dim, double df, const double *mean, const double *covar ) +/* + @code{UNUR_DISTR *unur_distr_multistudent(int dim, const double nu, const double *mean, const double *covar)} + creates a distribution object for the multivariate Student t-distribution with + @var{dim} components and @var{nu} degrees of freedom. + @var{mean} is an array of size @var{dim}. + A NULL pointer for @var{mean} is interpreted as the zero + vector (0,@dots{},0). + @var{covar} is an array of size @var{dim}x@var{dim} and holds the + covariance matrix, where the rows of the matrix are stored + consecutively in this array. The NULL pointer can be used + instead the identity matrix. + If @var{covar} is not a valid covariance matrix (i.e., not positive + definite) then no distribution object is created and NULL is returned. + + For standard form of the distribution use the null vector for @var{mean} and + the identity matrix for @var{covar}. +*/ +{ + struct unur_distr *distr; + double det_covar; /* determinant of covariance matrix */ + + /* get new (empty) distribution object */ + distr = unur_distr_cvec_new(dim); + + /* check new parameter for generator */ + if (distr == NULL) { + /* error: dim < 1 */ + return NULL; + } + + /* set distribution id */ + distr->id = UNUR_DISTR_MSTUDENT; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = NULL; + + /* copy (and check) parameters */ + if ( (_unur_set_params_multistudent(distr, df)!=UNUR_SUCCESS) || + (unur_distr_cvec_set_mean(distr,mean)!=UNUR_SUCCESS) || + (unur_distr_cvec_set_covar(distr,covar)!=UNUR_SUCCESS) ) { + unur_distr_free( distr ); + return NULL; + } + + /* functions */ + DISTR.pdf = _unur_pdf_multistudent; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_multistudent; /* pointer to logPDF */ + DISTR.dpdf = _unur_distr_cvec_eval_dpdf_from_dlogpdf; /* pointer to gradient of PDF */ + DISTR.dlogpdf = _unur_dlogpdf_multistudent; /* pointer to gradient of logPDF */ + DISTR.pdpdf = _unur_distr_cvec_eval_pdpdf_from_pdlogpdf; /* pointer to part. deriv. of PDF */ + DISTR.pdlogpdf = _unur_pdlogpdf_multistudent; /* pointer to partial derivative of logPDF */ + +#ifdef USE_DEPRECATED_CODE + /* set standardized marginal distributions */ + { + struct unur_distr *stdmarginal = unur_distr_student(&df,1); + unur_distr_cvec_set_stdmarginals(distr,stdmarginal); + unur_distr_free(stdmarginal); + } +#endif + + /* domain */ + + /* log of normalization constant */ + /* constant: Gamma((dim+1)/2) / ( pi^((dim+1)/2) * sqrt(det(Sigma)) ) */ + + /* constant: Gamma((dim+df)/2) */ + /* / ( Gamma(df/2) (df*pi)^(dim/2) * sqrt(det(Sigma)) ) */ + det_covar = (DISTR.covar == NULL) ? 1. : _unur_matrix_determinant(dim, DISTR.covar); + LOGNORMCONSTANT = _unur_SF_ln_gamma((distr->dim+df)/2.) - _unur_SF_ln_gamma(df/2.) + - ( distr->dim * log(df*M_PI) + log(det_covar) ) / 2.; + + /* mode */ + DISTR.mode = _unur_xmalloc( distr->dim * sizeof(double) ); + memcpy( DISTR.mode, DISTR.mean, distr->dim * sizeof(double) ); + + /* volume below p.d.f. */ + DISTR.volume = 1.; + + /* function for updating derived parameters */ + DISTR.upd_mode = _unur_upd_mode_multistudent; /* funct for computing mode */ + DISTR.upd_volume = _unur_upd_volume_multistudent; /* funct for computing volume */ + + /* indicate which parameters are set (additional to mean and covariance) */ + distr->set |= ( UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_PDFVOLUME | + UNUR_DISTR_SET_MODE ); + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_multistudent() */ + +/*---------------------------------------------------------------------------*/ +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/.libs/libmethods.a b/vendor/unuran-1.11.0/src/methods/.libs/libmethods.a new file mode 100644 index 0000000..dd303a7 Binary files /dev/null and b/vendor/unuran-1.11.0/src/methods/.libs/libmethods.a differ diff --git a/vendor/unuran-1.11.0/src/methods/Makefile b/vendor/unuran-1.11.0/src/methods/Makefile new file mode 100644 index 0000000..e612fb4 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/Makefile @@ -0,0 +1,865 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# src/methods/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/unuran +pkgincludedir = $(includedir)/unuran +pkglibdir = $(libdir)/unuran +pkglibexecdir = $(libexecdir)/unuran +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +subdir = src/methods +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libmethods_la_LIBADD = +am__libmethods_la_SOURCES_DIST = deprecated_methods.c \ + deprecated_methods.h deprecated_tdrgw.h deprecated_vmt.c \ + deprecated_vmt.h deprecated_vmt_struct.h x_gen.c x_gen.h \ + x_gen_struct.h x_gen_source.h auto.c auto.h auto_struct.h \ + arou.c arou.h arou_struct.h ars.c ars.h ars_struct.h cext.c \ + cext.h cext_struct.h cstd.c cstd.h cstd_struct.h dari.c dari.h \ + dari_struct.h dau.c dau.h dau_struct.h dext.c dext.h \ + dext_struct.h dgt.c dgt.h dgt_struct.h dsrou.c dsrou.h \ + dsrou_struct.h dss.c dss.h dss_struct.h dstd.c dstd.h \ + dstd_struct.h empk.c empk.h empk_struct.h empl.c empl.h \ + empl_struct.h gibbs.c gibbs.h gibbs_struct.h hinv.c hinv.h \ + hinv_struct.h hist.c hist.h hist_struct.h hitro.c hitro.h \ + hitro_struct.h hrb.c hrb.h hrb_struct.h hrd.c hrd.h \ + hrd_struct.h hri.c hri.h hri_struct.h itdr.c itdr.h \ + itdr_struct.h mcorr.c mcorr.h mcorr_struct.h mixt.c mixt.h \ + mixt_struct.h mvstd.c mvstd.h mvstd_struct.h mvtdr.c mvtdr.h \ + mvtdr_struct.h mvtdr_newset.ch mvtdr_init.ch mvtdr_sample.ch \ + mvtdr_info.ch mvtdr_debug.ch ninv.c ninv.h ninv_struct.h \ + ninv_newset.ch ninv_init.ch ninv_sample.ch ninv_newton.ch \ + ninv_regula.ch ninv_debug.ch ninv_info.ch norta.c norta.h \ + norta_struct.h nrou.c nrou.h nrou_struct.h pinv.c pinv.h \ + pinv_struct.h pinv_newset.ch pinv_init.ch pinv_sample.ch \ + pinv_prep.ch pinv_newton.ch pinv_debug.ch pinv_info.ch srou.c \ + srou.h srou_struct.h ssr.c ssr.h ssr_struct.h tabl.c tabl.h \ + tabl_struct.h tabl_newset.ch tabl_init.ch tabl_sample.ch \ + tabl_debug.ch tabl_info.ch tdr.c tdr.h tdr_struct.h \ + tdr_newset.ch tdr_init.ch tdr_gw_init.ch tdr_ps_init.ch \ + tdr_sample.ch tdr_gw_sample.ch tdr_ps_sample.ch \ + tdr_ia_sample.ch tdr_debug.ch tdr_gw_debug.ch tdr_ps_debug.ch \ + tdr_info.ch unif.c unif.h unif_struct.h utdr.c utdr.h \ + utdr_struct.h vempk.c vempk.h vempk_struct.h vnrou.c vnrou.h \ + vnrou_struct.h +#am__objects_1 = deprecated_methods.lo \ +# deprecated_vmt.lo +am_libmethods_la_OBJECTS = $(am__objects_1) x_gen.lo auto.lo arou.lo \ + ars.lo cext.lo cstd.lo dari.lo dau.lo dext.lo dgt.lo dsrou.lo \ + dss.lo dstd.lo empk.lo empl.lo gibbs.lo hinv.lo hist.lo \ + hitro.lo hrb.lo hrd.lo hri.lo itdr.lo mcorr.lo mixt.lo \ + mvstd.lo mvtdr.lo ninv.lo norta.lo nrou.lo pinv.lo srou.lo \ + ssr.lo tabl.lo tdr.lo unif.lo utdr.lo vempk.lo vnrou.lo +libmethods_la_OBJECTS = $(am_libmethods_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I. -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/arou.Plo ./$(DEPDIR)/ars.Plo \ + ./$(DEPDIR)/auto.Plo ./$(DEPDIR)/cext.Plo ./$(DEPDIR)/cstd.Plo \ + ./$(DEPDIR)/dari.Plo ./$(DEPDIR)/dau.Plo \ + ./$(DEPDIR)/deprecated_methods.Plo \ + ./$(DEPDIR)/deprecated_vmt.Plo ./$(DEPDIR)/dext.Plo \ + ./$(DEPDIR)/dgt.Plo ./$(DEPDIR)/dsrou.Plo ./$(DEPDIR)/dss.Plo \ + ./$(DEPDIR)/dstd.Plo ./$(DEPDIR)/empk.Plo ./$(DEPDIR)/empl.Plo \ + ./$(DEPDIR)/gibbs.Plo ./$(DEPDIR)/hinv.Plo \ + ./$(DEPDIR)/hist.Plo ./$(DEPDIR)/hitro.Plo ./$(DEPDIR)/hrb.Plo \ + ./$(DEPDIR)/hrd.Plo ./$(DEPDIR)/hri.Plo ./$(DEPDIR)/itdr.Plo \ + ./$(DEPDIR)/mcorr.Plo ./$(DEPDIR)/mixt.Plo \ + ./$(DEPDIR)/mvstd.Plo ./$(DEPDIR)/mvtdr.Plo \ + ./$(DEPDIR)/ninv.Plo ./$(DEPDIR)/norta.Plo \ + ./$(DEPDIR)/nrou.Plo ./$(DEPDIR)/pinv.Plo ./$(DEPDIR)/srou.Plo \ + ./$(DEPDIR)/ssr.Plo ./$(DEPDIR)/tabl.Plo ./$(DEPDIR)/tdr.Plo \ + ./$(DEPDIR)/unif.Plo ./$(DEPDIR)/utdr.Plo \ + ./$(DEPDIR)/vempk.Plo ./$(DEPDIR)/vnrou.Plo \ + ./$(DEPDIR)/x_gen.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libmethods_la_SOURCES) +DIST_SOURCES = $(am__libmethods_la_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_CFLAGS = -Wall -Wextra -Wshadow -Wstrict-prototypes +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf +AUTOHEADER = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader +AUTOMAKE = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -fPIC +CPP = gcc -E +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +FILECMD = file +GREP = /usr/bin/grep +HAVE_DIVIDE_BY_ZERO = +HAVE_IEEE_COMPARISONS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAINT = # +MAKEINFO = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = unuran +PACKAGE_BUGREPORT = unuran@statmath.wu.ac.at +PACKAGE_NAME = unuran +PACKAGE_STRING = unuran 1.11.0 +PACKAGE_TARNAME = unuran +PACKAGE_URL = +PACKAGE_VERSION = 1.11.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +UNURAN_LT_VERSION = 16:1:0 +UNURAN_SUPPORTS_GSL = +UNURAN_SUPPORTS_PRNG = +UNURAN_SUPPORTS_RNGSTREAM = +VERSION = 1.11.0 +abs_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src/methods +abs_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src/methods +abs_top_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +have_valgrind = false +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../../ +top_builddir = ../.. +top_srcdir = ../.. +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libmethods.la +DEPRECATED_FILES = + +# Files that contain deprecated routines +#DEPRECATED_FILES = \ +# deprecated_methods.c deprecated_methods.h \ +# deprecated_tdrgw.h \ +# deprecated_vmt.c deprecated_vmt.h deprecated_vmt_struct.h + +libmethods_la_SOURCES = \ + $(DEPRECATED_FILES) \ +\ + x_gen.c x_gen.h x_gen_struct.h x_gen_source.h \ +\ + auto.c auto.h auto_struct.h \ + arou.c arou.h arou_struct.h \ + ars.c ars.h ars_struct.h \ + cext.c cext.h cext_struct.h \ + cstd.c cstd.h cstd_struct.h \ + dari.c dari.h dari_struct.h \ + dau.c dau.h dau_struct.h \ + dext.c dext.h dext_struct.h \ + dgt.c dgt.h dgt_struct.h \ + dsrou.c dsrou.h dsrou_struct.h \ + dss.c dss.h dss_struct.h \ + dstd.c dstd.h dstd_struct.h \ + empk.c empk.h empk_struct.h \ + empl.c empl.h empl_struct.h \ + gibbs.c gibbs.h gibbs_struct.h \ + hinv.c hinv.h hinv_struct.h \ + hist.c hist.h hist_struct.h \ + hitro.c hitro.h hitro_struct.h \ + hrb.c hrb.h hrb_struct.h \ + hrd.c hrd.h hrd_struct.h \ + hri.c hri.h hri_struct.h \ + itdr.c itdr.h itdr_struct.h \ + mcorr.c mcorr.h mcorr_struct.h \ + mixt.c mixt.h mixt_struct.h \ + mvstd.c mvstd.h mvstd_struct.h \ + mvtdr.c mvtdr.h mvtdr_struct.h \ + mvtdr_newset.ch mvtdr_init.ch mvtdr_sample.ch \ + mvtdr_info.ch mvtdr_debug.ch \ + ninv.c ninv.h ninv_struct.h \ + ninv_newset.ch ninv_init.ch ninv_sample.ch \ + ninv_newton.ch ninv_regula.ch \ + ninv_debug.ch ninv_info.ch \ + norta.c norta.h norta_struct.h \ + nrou.c nrou.h nrou_struct.h \ + pinv.c pinv.h pinv_struct.h \ + pinv_newset.ch pinv_init.ch pinv_sample.ch \ + pinv_prep.ch pinv_newton.ch \ + pinv_debug.ch pinv_info.ch \ + srou.c srou.h srou_struct.h \ + ssr.c ssr.h ssr_struct.h \ + tabl.c tabl.h tabl_struct.h tabl_newset.ch \ + tabl_init.ch tabl_sample.ch tabl_debug.ch tabl_info.ch \ + tdr.c tdr.h tdr_struct.h tdr_newset.ch \ + tdr_init.ch tdr_gw_init.ch tdr_ps_init.ch \ + tdr_sample.ch tdr_gw_sample.ch tdr_ps_sample.ch tdr_ia_sample.ch \ + tdr_debug.ch tdr_gw_debug.ch tdr_ps_debug.ch tdr_info.ch \ + unif.c unif.h unif_struct.h \ + utdr.c utdr.h utdr_struct.h \ + vempk.c vempk.h vempk_struct.h \ + vnrou.c vnrou.h vnrou_struct.h + +noinst_HEADERS = \ + unur_methods.h \ + unur_methods_source.h + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/methods/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/methods/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libmethods.la: $(libmethods_la_OBJECTS) $(libmethods_la_DEPENDENCIES) $(EXTRA_libmethods_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libmethods_la_OBJECTS) $(libmethods_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/arou.Plo # am--include-marker +include ./$(DEPDIR)/ars.Plo # am--include-marker +include ./$(DEPDIR)/auto.Plo # am--include-marker +include ./$(DEPDIR)/cext.Plo # am--include-marker +include ./$(DEPDIR)/cstd.Plo # am--include-marker +include ./$(DEPDIR)/dari.Plo # am--include-marker +include ./$(DEPDIR)/dau.Plo # am--include-marker +include ./$(DEPDIR)/deprecated_methods.Plo # am--include-marker +include ./$(DEPDIR)/deprecated_vmt.Plo # am--include-marker +include ./$(DEPDIR)/dext.Plo # am--include-marker +include ./$(DEPDIR)/dgt.Plo # am--include-marker +include ./$(DEPDIR)/dsrou.Plo # am--include-marker +include ./$(DEPDIR)/dss.Plo # am--include-marker +include ./$(DEPDIR)/dstd.Plo # am--include-marker +include ./$(DEPDIR)/empk.Plo # am--include-marker +include ./$(DEPDIR)/empl.Plo # am--include-marker +include ./$(DEPDIR)/gibbs.Plo # am--include-marker +include ./$(DEPDIR)/hinv.Plo # am--include-marker +include ./$(DEPDIR)/hist.Plo # am--include-marker +include ./$(DEPDIR)/hitro.Plo # am--include-marker +include ./$(DEPDIR)/hrb.Plo # am--include-marker +include ./$(DEPDIR)/hrd.Plo # am--include-marker +include ./$(DEPDIR)/hri.Plo # am--include-marker +include ./$(DEPDIR)/itdr.Plo # am--include-marker +include ./$(DEPDIR)/mcorr.Plo # am--include-marker +include ./$(DEPDIR)/mixt.Plo # am--include-marker +include ./$(DEPDIR)/mvstd.Plo # am--include-marker +include ./$(DEPDIR)/mvtdr.Plo # am--include-marker +include ./$(DEPDIR)/ninv.Plo # am--include-marker +include ./$(DEPDIR)/norta.Plo # am--include-marker +include ./$(DEPDIR)/nrou.Plo # am--include-marker +include ./$(DEPDIR)/pinv.Plo # am--include-marker +include ./$(DEPDIR)/srou.Plo # am--include-marker +include ./$(DEPDIR)/ssr.Plo # am--include-marker +include ./$(DEPDIR)/tabl.Plo # am--include-marker +include ./$(DEPDIR)/tdr.Plo # am--include-marker +include ./$(DEPDIR)/unif.Plo # am--include-marker +include ./$(DEPDIR)/utdr.Plo # am--include-marker +include ./$(DEPDIR)/vempk.Plo # am--include-marker +include ./$(DEPDIR)/vnrou.Plo # am--include-marker +include ./$(DEPDIR)/x_gen.Plo # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ $< + +.c.obj: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: + $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +# $(AM_V_CC)source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/arou.Plo + -rm -f ./$(DEPDIR)/ars.Plo + -rm -f ./$(DEPDIR)/auto.Plo + -rm -f ./$(DEPDIR)/cext.Plo + -rm -f ./$(DEPDIR)/cstd.Plo + -rm -f ./$(DEPDIR)/dari.Plo + -rm -f ./$(DEPDIR)/dau.Plo + -rm -f ./$(DEPDIR)/deprecated_methods.Plo + -rm -f ./$(DEPDIR)/deprecated_vmt.Plo + -rm -f ./$(DEPDIR)/dext.Plo + -rm -f ./$(DEPDIR)/dgt.Plo + -rm -f ./$(DEPDIR)/dsrou.Plo + -rm -f ./$(DEPDIR)/dss.Plo + -rm -f ./$(DEPDIR)/dstd.Plo + -rm -f ./$(DEPDIR)/empk.Plo + -rm -f ./$(DEPDIR)/empl.Plo + -rm -f ./$(DEPDIR)/gibbs.Plo + -rm -f ./$(DEPDIR)/hinv.Plo + -rm -f ./$(DEPDIR)/hist.Plo + -rm -f ./$(DEPDIR)/hitro.Plo + -rm -f ./$(DEPDIR)/hrb.Plo + -rm -f ./$(DEPDIR)/hrd.Plo + -rm -f ./$(DEPDIR)/hri.Plo + -rm -f ./$(DEPDIR)/itdr.Plo + -rm -f ./$(DEPDIR)/mcorr.Plo + -rm -f ./$(DEPDIR)/mixt.Plo + -rm -f ./$(DEPDIR)/mvstd.Plo + -rm -f ./$(DEPDIR)/mvtdr.Plo + -rm -f ./$(DEPDIR)/ninv.Plo + -rm -f ./$(DEPDIR)/norta.Plo + -rm -f ./$(DEPDIR)/nrou.Plo + -rm -f ./$(DEPDIR)/pinv.Plo + -rm -f ./$(DEPDIR)/srou.Plo + -rm -f ./$(DEPDIR)/ssr.Plo + -rm -f ./$(DEPDIR)/tabl.Plo + -rm -f ./$(DEPDIR)/tdr.Plo + -rm -f ./$(DEPDIR)/unif.Plo + -rm -f ./$(DEPDIR)/utdr.Plo + -rm -f ./$(DEPDIR)/vempk.Plo + -rm -f ./$(DEPDIR)/vnrou.Plo + -rm -f ./$(DEPDIR)/x_gen.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/arou.Plo + -rm -f ./$(DEPDIR)/ars.Plo + -rm -f ./$(DEPDIR)/auto.Plo + -rm -f ./$(DEPDIR)/cext.Plo + -rm -f ./$(DEPDIR)/cstd.Plo + -rm -f ./$(DEPDIR)/dari.Plo + -rm -f ./$(DEPDIR)/dau.Plo + -rm -f ./$(DEPDIR)/deprecated_methods.Plo + -rm -f ./$(DEPDIR)/deprecated_vmt.Plo + -rm -f ./$(DEPDIR)/dext.Plo + -rm -f ./$(DEPDIR)/dgt.Plo + -rm -f ./$(DEPDIR)/dsrou.Plo + -rm -f ./$(DEPDIR)/dss.Plo + -rm -f ./$(DEPDIR)/dstd.Plo + -rm -f ./$(DEPDIR)/empk.Plo + -rm -f ./$(DEPDIR)/empl.Plo + -rm -f ./$(DEPDIR)/gibbs.Plo + -rm -f ./$(DEPDIR)/hinv.Plo + -rm -f ./$(DEPDIR)/hist.Plo + -rm -f ./$(DEPDIR)/hitro.Plo + -rm -f ./$(DEPDIR)/hrb.Plo + -rm -f ./$(DEPDIR)/hrd.Plo + -rm -f ./$(DEPDIR)/hri.Plo + -rm -f ./$(DEPDIR)/itdr.Plo + -rm -f ./$(DEPDIR)/mcorr.Plo + -rm -f ./$(DEPDIR)/mixt.Plo + -rm -f ./$(DEPDIR)/mvstd.Plo + -rm -f ./$(DEPDIR)/mvtdr.Plo + -rm -f ./$(DEPDIR)/ninv.Plo + -rm -f ./$(DEPDIR)/norta.Plo + -rm -f ./$(DEPDIR)/nrou.Plo + -rm -f ./$(DEPDIR)/pinv.Plo + -rm -f ./$(DEPDIR)/srou.Plo + -rm -f ./$(DEPDIR)/ssr.Plo + -rm -f ./$(DEPDIR)/tabl.Plo + -rm -f ./$(DEPDIR)/tdr.Plo + -rm -f ./$(DEPDIR)/unif.Plo + -rm -f ./$(DEPDIR)/utdr.Plo + -rm -f ./$(DEPDIR)/vempk.Plo + -rm -f ./$(DEPDIR)/vnrou.Plo + -rm -f ./$(DEPDIR)/x_gen.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/methods/Makefile.am b/vendor/unuran-1.11.0/src/methods/Makefile.am new file mode 100644 index 0000000..c631f4d --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/Makefile.am @@ -0,0 +1,85 @@ +## Process this file with automake to produce Makefile.in + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libmethods.la + +# Files that contain deprecated routines +if ENABLE_DEPRECATED +DEPRECATED_FILES = \ + deprecated_methods.c deprecated_methods.h \ + deprecated_tdrgw.h \ + deprecated_vmt.c deprecated_vmt.h deprecated_vmt_struct.h +else +DEPRECATED_FILES = +endif + + +libmethods_la_SOURCES = \ + $(DEPRECATED_FILES) \ +\ + x_gen.c x_gen.h x_gen_struct.h x_gen_source.h \ +\ + auto.c auto.h auto_struct.h \ + arou.c arou.h arou_struct.h \ + ars.c ars.h ars_struct.h \ + cext.c cext.h cext_struct.h \ + cstd.c cstd.h cstd_struct.h \ + dari.c dari.h dari_struct.h \ + dau.c dau.h dau_struct.h \ + dext.c dext.h dext_struct.h \ + dgt.c dgt.h dgt_struct.h \ + dsrou.c dsrou.h dsrou_struct.h \ + dss.c dss.h dss_struct.h \ + dstd.c dstd.h dstd_struct.h \ + empk.c empk.h empk_struct.h \ + empl.c empl.h empl_struct.h \ + gibbs.c gibbs.h gibbs_struct.h \ + hinv.c hinv.h hinv_struct.h \ + hist.c hist.h hist_struct.h \ + hitro.c hitro.h hitro_struct.h \ + hrb.c hrb.h hrb_struct.h \ + hrd.c hrd.h hrd_struct.h \ + hri.c hri.h hri_struct.h \ + itdr.c itdr.h itdr_struct.h \ + mcorr.c mcorr.h mcorr_struct.h \ + mixt.c mixt.h mixt_struct.h \ + mvstd.c mvstd.h mvstd_struct.h \ + mvtdr.c mvtdr.h mvtdr_struct.h \ + mvtdr_newset.ch mvtdr_init.ch mvtdr_sample.ch \ + mvtdr_info.ch mvtdr_debug.ch \ + ninv.c ninv.h ninv_struct.h \ + ninv_newset.ch ninv_init.ch ninv_sample.ch \ + ninv_newton.ch ninv_regula.ch \ + ninv_debug.ch ninv_info.ch \ + norta.c norta.h norta_struct.h \ + nrou.c nrou.h nrou_struct.h \ + pinv.c pinv.h pinv_struct.h \ + pinv_newset.ch pinv_init.ch pinv_sample.ch \ + pinv_prep.ch pinv_newton.ch \ + pinv_debug.ch pinv_info.ch \ + srou.c srou.h srou_struct.h \ + ssr.c ssr.h ssr_struct.h \ + tabl.c tabl.h tabl_struct.h tabl_newset.ch \ + tabl_init.ch tabl_sample.ch tabl_debug.ch tabl_info.ch \ + tdr.c tdr.h tdr_struct.h tdr_newset.ch \ + tdr_init.ch tdr_gw_init.ch tdr_ps_init.ch \ + tdr_sample.ch tdr_gw_sample.ch tdr_ps_sample.ch tdr_ia_sample.ch \ + tdr_debug.ch tdr_gw_debug.ch tdr_ps_debug.ch tdr_info.ch \ + unif.c unif.h unif_struct.h \ + utdr.c utdr.h utdr_struct.h \ + vempk.c vempk.h vempk_struct.h \ + vnrou.c vnrou.h vnrou_struct.h + +noinst_HEADERS = \ + unur_methods.h \ + unur_methods_source.h + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + diff --git a/vendor/unuran-1.11.0/src/methods/Makefile.in b/vendor/unuran-1.11.0/src/methods/Makefile.in new file mode 100644 index 0000000..48eced4 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/Makefile.in @@ -0,0 +1,865 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/methods +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libmethods_la_LIBADD = +am__libmethods_la_SOURCES_DIST = deprecated_methods.c \ + deprecated_methods.h deprecated_tdrgw.h deprecated_vmt.c \ + deprecated_vmt.h deprecated_vmt_struct.h x_gen.c x_gen.h \ + x_gen_struct.h x_gen_source.h auto.c auto.h auto_struct.h \ + arou.c arou.h arou_struct.h ars.c ars.h ars_struct.h cext.c \ + cext.h cext_struct.h cstd.c cstd.h cstd_struct.h dari.c dari.h \ + dari_struct.h dau.c dau.h dau_struct.h dext.c dext.h \ + dext_struct.h dgt.c dgt.h dgt_struct.h dsrou.c dsrou.h \ + dsrou_struct.h dss.c dss.h dss_struct.h dstd.c dstd.h \ + dstd_struct.h empk.c empk.h empk_struct.h empl.c empl.h \ + empl_struct.h gibbs.c gibbs.h gibbs_struct.h hinv.c hinv.h \ + hinv_struct.h hist.c hist.h hist_struct.h hitro.c hitro.h \ + hitro_struct.h hrb.c hrb.h hrb_struct.h hrd.c hrd.h \ + hrd_struct.h hri.c hri.h hri_struct.h itdr.c itdr.h \ + itdr_struct.h mcorr.c mcorr.h mcorr_struct.h mixt.c mixt.h \ + mixt_struct.h mvstd.c mvstd.h mvstd_struct.h mvtdr.c mvtdr.h \ + mvtdr_struct.h mvtdr_newset.ch mvtdr_init.ch mvtdr_sample.ch \ + mvtdr_info.ch mvtdr_debug.ch ninv.c ninv.h ninv_struct.h \ + ninv_newset.ch ninv_init.ch ninv_sample.ch ninv_newton.ch \ + ninv_regula.ch ninv_debug.ch ninv_info.ch norta.c norta.h \ + norta_struct.h nrou.c nrou.h nrou_struct.h pinv.c pinv.h \ + pinv_struct.h pinv_newset.ch pinv_init.ch pinv_sample.ch \ + pinv_prep.ch pinv_newton.ch pinv_debug.ch pinv_info.ch srou.c \ + srou.h srou_struct.h ssr.c ssr.h ssr_struct.h tabl.c tabl.h \ + tabl_struct.h tabl_newset.ch tabl_init.ch tabl_sample.ch \ + tabl_debug.ch tabl_info.ch tdr.c tdr.h tdr_struct.h \ + tdr_newset.ch tdr_init.ch tdr_gw_init.ch tdr_ps_init.ch \ + tdr_sample.ch tdr_gw_sample.ch tdr_ps_sample.ch \ + tdr_ia_sample.ch tdr_debug.ch tdr_gw_debug.ch tdr_ps_debug.ch \ + tdr_info.ch unif.c unif.h unif_struct.h utdr.c utdr.h \ + utdr_struct.h vempk.c vempk.h vempk_struct.h vnrou.c vnrou.h \ + vnrou_struct.h +@ENABLE_DEPRECATED_TRUE@am__objects_1 = deprecated_methods.lo \ +@ENABLE_DEPRECATED_TRUE@ deprecated_vmt.lo +am_libmethods_la_OBJECTS = $(am__objects_1) x_gen.lo auto.lo arou.lo \ + ars.lo cext.lo cstd.lo dari.lo dau.lo dext.lo dgt.lo dsrou.lo \ + dss.lo dstd.lo empk.lo empl.lo gibbs.lo hinv.lo hist.lo \ + hitro.lo hrb.lo hrd.lo hri.lo itdr.lo mcorr.lo mixt.lo \ + mvstd.lo mvtdr.lo ninv.lo norta.lo nrou.lo pinv.lo srou.lo \ + ssr.lo tabl.lo tdr.lo unif.lo utdr.lo vempk.lo vnrou.lo +libmethods_la_OBJECTS = $(am_libmethods_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/arou.Plo ./$(DEPDIR)/ars.Plo \ + ./$(DEPDIR)/auto.Plo ./$(DEPDIR)/cext.Plo ./$(DEPDIR)/cstd.Plo \ + ./$(DEPDIR)/dari.Plo ./$(DEPDIR)/dau.Plo \ + ./$(DEPDIR)/deprecated_methods.Plo \ + ./$(DEPDIR)/deprecated_vmt.Plo ./$(DEPDIR)/dext.Plo \ + ./$(DEPDIR)/dgt.Plo ./$(DEPDIR)/dsrou.Plo ./$(DEPDIR)/dss.Plo \ + ./$(DEPDIR)/dstd.Plo ./$(DEPDIR)/empk.Plo ./$(DEPDIR)/empl.Plo \ + ./$(DEPDIR)/gibbs.Plo ./$(DEPDIR)/hinv.Plo \ + ./$(DEPDIR)/hist.Plo ./$(DEPDIR)/hitro.Plo ./$(DEPDIR)/hrb.Plo \ + ./$(DEPDIR)/hrd.Plo ./$(DEPDIR)/hri.Plo ./$(DEPDIR)/itdr.Plo \ + ./$(DEPDIR)/mcorr.Plo ./$(DEPDIR)/mixt.Plo \ + ./$(DEPDIR)/mvstd.Plo ./$(DEPDIR)/mvtdr.Plo \ + ./$(DEPDIR)/ninv.Plo ./$(DEPDIR)/norta.Plo \ + ./$(DEPDIR)/nrou.Plo ./$(DEPDIR)/pinv.Plo ./$(DEPDIR)/srou.Plo \ + ./$(DEPDIR)/ssr.Plo ./$(DEPDIR)/tabl.Plo ./$(DEPDIR)/tdr.Plo \ + ./$(DEPDIR)/unif.Plo ./$(DEPDIR)/utdr.Plo \ + ./$(DEPDIR)/vempk.Plo ./$(DEPDIR)/vnrou.Plo \ + ./$(DEPDIR)/x_gen.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libmethods_la_SOURCES) +DIST_SOURCES = $(am__libmethods_la_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ +UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ +UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ +UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_valgrind = @have_valgrind@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libmethods.la +@ENABLE_DEPRECATED_FALSE@DEPRECATED_FILES = + +# Files that contain deprecated routines +@ENABLE_DEPRECATED_TRUE@DEPRECATED_FILES = \ +@ENABLE_DEPRECATED_TRUE@ deprecated_methods.c deprecated_methods.h \ +@ENABLE_DEPRECATED_TRUE@ deprecated_tdrgw.h \ +@ENABLE_DEPRECATED_TRUE@ deprecated_vmt.c deprecated_vmt.h deprecated_vmt_struct.h + +libmethods_la_SOURCES = \ + $(DEPRECATED_FILES) \ +\ + x_gen.c x_gen.h x_gen_struct.h x_gen_source.h \ +\ + auto.c auto.h auto_struct.h \ + arou.c arou.h arou_struct.h \ + ars.c ars.h ars_struct.h \ + cext.c cext.h cext_struct.h \ + cstd.c cstd.h cstd_struct.h \ + dari.c dari.h dari_struct.h \ + dau.c dau.h dau_struct.h \ + dext.c dext.h dext_struct.h \ + dgt.c dgt.h dgt_struct.h \ + dsrou.c dsrou.h dsrou_struct.h \ + dss.c dss.h dss_struct.h \ + dstd.c dstd.h dstd_struct.h \ + empk.c empk.h empk_struct.h \ + empl.c empl.h empl_struct.h \ + gibbs.c gibbs.h gibbs_struct.h \ + hinv.c hinv.h hinv_struct.h \ + hist.c hist.h hist_struct.h \ + hitro.c hitro.h hitro_struct.h \ + hrb.c hrb.h hrb_struct.h \ + hrd.c hrd.h hrd_struct.h \ + hri.c hri.h hri_struct.h \ + itdr.c itdr.h itdr_struct.h \ + mcorr.c mcorr.h mcorr_struct.h \ + mixt.c mixt.h mixt_struct.h \ + mvstd.c mvstd.h mvstd_struct.h \ + mvtdr.c mvtdr.h mvtdr_struct.h \ + mvtdr_newset.ch mvtdr_init.ch mvtdr_sample.ch \ + mvtdr_info.ch mvtdr_debug.ch \ + ninv.c ninv.h ninv_struct.h \ + ninv_newset.ch ninv_init.ch ninv_sample.ch \ + ninv_newton.ch ninv_regula.ch \ + ninv_debug.ch ninv_info.ch \ + norta.c norta.h norta_struct.h \ + nrou.c nrou.h nrou_struct.h \ + pinv.c pinv.h pinv_struct.h \ + pinv_newset.ch pinv_init.ch pinv_sample.ch \ + pinv_prep.ch pinv_newton.ch \ + pinv_debug.ch pinv_info.ch \ + srou.c srou.h srou_struct.h \ + ssr.c ssr.h ssr_struct.h \ + tabl.c tabl.h tabl_struct.h tabl_newset.ch \ + tabl_init.ch tabl_sample.ch tabl_debug.ch tabl_info.ch \ + tdr.c tdr.h tdr_struct.h tdr_newset.ch \ + tdr_init.ch tdr_gw_init.ch tdr_ps_init.ch \ + tdr_sample.ch tdr_gw_sample.ch tdr_ps_sample.ch tdr_ia_sample.ch \ + tdr_debug.ch tdr_gw_debug.ch tdr_ps_debug.ch tdr_info.ch \ + unif.c unif.h unif_struct.h \ + utdr.c utdr.h utdr_struct.h \ + vempk.c vempk.h vempk_struct.h \ + vnrou.c vnrou.h vnrou_struct.h + +noinst_HEADERS = \ + unur_methods.h \ + unur_methods_source.h + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/methods/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/methods/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libmethods.la: $(libmethods_la_OBJECTS) $(libmethods_la_DEPENDENCIES) $(EXTRA_libmethods_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libmethods_la_OBJECTS) $(libmethods_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arou.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ars.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auto.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cext.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cstd.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dari.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dau.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deprecated_methods.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deprecated_vmt.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dext.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dgt.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dsrou.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dss.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dstd.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/empk.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/empl.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gibbs.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hinv.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hist.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hitro.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hrb.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hrd.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hri.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/itdr.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mcorr.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mixt.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mvstd.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mvtdr.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ninv.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/norta.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nrou.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pinv.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/srou.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssr.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tabl.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdr.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unif.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utdr.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vempk.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vnrou.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_gen.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/arou.Plo + -rm -f ./$(DEPDIR)/ars.Plo + -rm -f ./$(DEPDIR)/auto.Plo + -rm -f ./$(DEPDIR)/cext.Plo + -rm -f ./$(DEPDIR)/cstd.Plo + -rm -f ./$(DEPDIR)/dari.Plo + -rm -f ./$(DEPDIR)/dau.Plo + -rm -f ./$(DEPDIR)/deprecated_methods.Plo + -rm -f ./$(DEPDIR)/deprecated_vmt.Plo + -rm -f ./$(DEPDIR)/dext.Plo + -rm -f ./$(DEPDIR)/dgt.Plo + -rm -f ./$(DEPDIR)/dsrou.Plo + -rm -f ./$(DEPDIR)/dss.Plo + -rm -f ./$(DEPDIR)/dstd.Plo + -rm -f ./$(DEPDIR)/empk.Plo + -rm -f ./$(DEPDIR)/empl.Plo + -rm -f ./$(DEPDIR)/gibbs.Plo + -rm -f ./$(DEPDIR)/hinv.Plo + -rm -f ./$(DEPDIR)/hist.Plo + -rm -f ./$(DEPDIR)/hitro.Plo + -rm -f ./$(DEPDIR)/hrb.Plo + -rm -f ./$(DEPDIR)/hrd.Plo + -rm -f ./$(DEPDIR)/hri.Plo + -rm -f ./$(DEPDIR)/itdr.Plo + -rm -f ./$(DEPDIR)/mcorr.Plo + -rm -f ./$(DEPDIR)/mixt.Plo + -rm -f ./$(DEPDIR)/mvstd.Plo + -rm -f ./$(DEPDIR)/mvtdr.Plo + -rm -f ./$(DEPDIR)/ninv.Plo + -rm -f ./$(DEPDIR)/norta.Plo + -rm -f ./$(DEPDIR)/nrou.Plo + -rm -f ./$(DEPDIR)/pinv.Plo + -rm -f ./$(DEPDIR)/srou.Plo + -rm -f ./$(DEPDIR)/ssr.Plo + -rm -f ./$(DEPDIR)/tabl.Plo + -rm -f ./$(DEPDIR)/tdr.Plo + -rm -f ./$(DEPDIR)/unif.Plo + -rm -f ./$(DEPDIR)/utdr.Plo + -rm -f ./$(DEPDIR)/vempk.Plo + -rm -f ./$(DEPDIR)/vnrou.Plo + -rm -f ./$(DEPDIR)/x_gen.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/arou.Plo + -rm -f ./$(DEPDIR)/ars.Plo + -rm -f ./$(DEPDIR)/auto.Plo + -rm -f ./$(DEPDIR)/cext.Plo + -rm -f ./$(DEPDIR)/cstd.Plo + -rm -f ./$(DEPDIR)/dari.Plo + -rm -f ./$(DEPDIR)/dau.Plo + -rm -f ./$(DEPDIR)/deprecated_methods.Plo + -rm -f ./$(DEPDIR)/deprecated_vmt.Plo + -rm -f ./$(DEPDIR)/dext.Plo + -rm -f ./$(DEPDIR)/dgt.Plo + -rm -f ./$(DEPDIR)/dsrou.Plo + -rm -f ./$(DEPDIR)/dss.Plo + -rm -f ./$(DEPDIR)/dstd.Plo + -rm -f ./$(DEPDIR)/empk.Plo + -rm -f ./$(DEPDIR)/empl.Plo + -rm -f ./$(DEPDIR)/gibbs.Plo + -rm -f ./$(DEPDIR)/hinv.Plo + -rm -f ./$(DEPDIR)/hist.Plo + -rm -f ./$(DEPDIR)/hitro.Plo + -rm -f ./$(DEPDIR)/hrb.Plo + -rm -f ./$(DEPDIR)/hrd.Plo + -rm -f ./$(DEPDIR)/hri.Plo + -rm -f ./$(DEPDIR)/itdr.Plo + -rm -f ./$(DEPDIR)/mcorr.Plo + -rm -f ./$(DEPDIR)/mixt.Plo + -rm -f ./$(DEPDIR)/mvstd.Plo + -rm -f ./$(DEPDIR)/mvtdr.Plo + -rm -f ./$(DEPDIR)/ninv.Plo + -rm -f ./$(DEPDIR)/norta.Plo + -rm -f ./$(DEPDIR)/nrou.Plo + -rm -f ./$(DEPDIR)/pinv.Plo + -rm -f ./$(DEPDIR)/srou.Plo + -rm -f ./$(DEPDIR)/ssr.Plo + -rm -f ./$(DEPDIR)/tabl.Plo + -rm -f ./$(DEPDIR)/tdr.Plo + -rm -f ./$(DEPDIR)/unif.Plo + -rm -f ./$(DEPDIR)/utdr.Plo + -rm -f ./$(DEPDIR)/vempk.Plo + -rm -f ./$(DEPDIR)/vnrou.Plo + -rm -f ./$(DEPDIR)/x_gen.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/methods/arou.c b/vendor/unuran-1.11.0/src/methods/arou.c new file mode 100644 index 0000000..d35f337 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/arou.c @@ -0,0 +1,2914 @@ +/***************************************************************************** + * * + * unuran -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: arou.h * + * * + * TYPE: continuous univariate random variate * + * METHOD: ratio-of-uniforms with enveloping polygon * + * * + * DESCRIPTION: * + * Given PDF of a T-concave distribution; * + * produce a value x consistent with its density * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Leydold J. (2000): Automatic Sampling with the ratio-of-uniforms * + * method, ACM TOMS, forthcoming * + * * + * [2] Kinderman, A.J. and Monahan, F.J. (1977): Computer generation of * + * random variables using the ratio of uniform deviates, * + * ACM Trans. Math. Software 3(3), pp. 257--260. * + * * + ***************************************************************************** + * * + * The ratio-of-uniforms method introduced in [2] is a flexible method that * + * is based on the following theorem: * + * * + * THEOREM: * + * Let X be a random variable with density function f(x) = g(x) / G, * + * where g(x) is a positive integrable function with support (x_0,x_1) * + * not necessarily finite and G = integral g(x) dx. * + * If (V,U) is uniformly distributed in * + * A = {(v,u): 0 < u <= sqrt(g(v/u)), x_0 < v/u < x_1}, * + * then X = V/U has probability density function f(x). * + * * + * Generating point (V,U) uniformly distributed in A is done by rejection * + * from an enveloping region, usually from the minimal bounding rectangle. * + * * + * The implemented algorithm uses the fact, that for many distribtions, * + * A is convex. Then we easily can construct an enveloping polygon by means * + * of tangent lines and a squeeze region by means of secants. * + * The resulting algorithm is very fast, since we can sample from the * + * squeeze region with immedate acceptance (thus only one uniform random * + * number is necessary). The region between envelope and squeeze consists * + * of triangles and can be made arbitrarily small (see [1] for details). * + * * + * Distributions with a convex set A are characterized by the following * + * theorem that shows a connection to transformed density rejection TDR. * + * * + * THEOREM: * + * A is convex if and only if g is T-concave with transformation * + * T(x) = -1/sqrt(x), i.e., -1/sqrt(g(x)) is a concave function. * + * * + *...........................................................................* + * * + * The region A is divided into segments, that contain the origin. Each * + * segments consist of an inner triangle (the squeeze region) and the * + * outer triangle (the region between envelope and squeeze). We have to * + * compute the areas of these triangles. * + * * + * To generate from the distribution we have to sample from a discrete * + * random variate with probability vector proportional to these areas to get * + * one of these triangles (inner or outer). We use indexed search (or guide * + * tables) to perform this task ([1], see also description of DIS). * + * When we have an inner triangle (squeeze), we reuse the uniform random * + * variate to get a point (v,u) uniformly distributed on the edge opposite * + * to the origin and return the ratio x = v/u (Thus generation from the * + * squeeze region is equivalent to the inversion method.) * + * When whe have an outer triangle, we have to sample a point (v,u) * + * uniformly distributed in this triangle. If u <= g(v/u) then return the * + * ratio x = v/u, otherwise reject. * + * * + *...........................................................................* + * * + * Algorithm AROU * + * * + * [Required] * + * PDF f(x), construction points c_1,...,c_n * + * * + * [Setup] * + * 1: Construct inner triangles S_i^s and outer triangles S_i^o * + * 2: Foreach triangle Do * + * 3: Compute respective areas A_i^s and A_i^o. * + * * + * [Generate] * + * 4: Generate I proportional to (A_1^s, A_1^o; A_2^s, A_2^o; ...). * + * 5: If inner triangle S_i^s Then * + * 6: Compute point (v,u) on edge (Reuse u.r.n. from 4). * + * 7: Return v/u. * + * 8: Else * + * 9: Generate point (V,U) uniformly distributed in outer triangle S_i^o.* + * 10: If u <= f(v/u) Return V/U. * + * 11: Goto 4. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "arou.h" +#include "arou_struct.h" + +/*---------------------------------------------------------------------------*/ +/* Variants */ + +#define AROU_VARFLAG_VERIFY 0x01u /* flag for verifying mode */ +#define AROU_VARFLAG_USECENTER 0x02u /* flag whether center is used as cpoint or not */ +#define AROU_VARFLAG_PEDANTIC 0x04u /* whether pedantic checking is used */ +#define AROU_VARFLAG_USEDARS 0x10u /* whether DARS is used in setup or not */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define AROU_DEBUG_SEGMENTS 0x00000010u /* print list of segments */ +#define AROU_DEBUG_SPLIT 0x00010000u /* trace splitting of segments */ +#define AROU_DEBUG_DARS 0x00020000u + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define AROU_SET_CENTER 0x001u +#define AROU_SET_STP 0x002u +#define AROU_SET_N_STP 0x004u +#define AROU_SET_GUIDEFACTOR 0x010u +#define AROU_SET_MAX_SQHRATIO 0x020u +#define AROU_SET_MAX_SEGS 0x040u +#define AROU_SET_USE_DARS 0x100u +#define AROU_SET_DARS_FACTOR 0x200u + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "AROU" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_arou_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_arou_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_arou_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_arou_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_arou_sample( struct unur_gen *gen ); +static double _unur_arou_sample_check( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static int _unur_arou_get_starting_cpoints( struct unur_par *par, struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* create list of construction points for starting segments. */ +/* if user has not provided such points compute these by means of the */ +/* "equi-angle rule". */ +/*---------------------------------------------------------------------------*/ + +static int _unur_arou_get_starting_segments( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* compute segments from given starting construction points. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_arou_compute_x( double v, double u ); +/*---------------------------------------------------------------------------*/ +/* compute point x from (v,u) tuple. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_arou_run_dars( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* run derandomized adaptive rejection sampling. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_arou_segment *_unur_arou_segment_new( struct unur_gen *gen, double x, double fx ); +/*---------------------------------------------------------------------------*/ +/* make a new segment with left construction point x = v/u. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_arou_segment_parameter( struct unur_gen *gen, struct unur_arou_segment *seg ); +/*---------------------------------------------------------------------------*/ +/* compute all necessary data for segment. */ +/* return: */ +/* UNUR_SUCCESS ... on success */ +/* UNUR_ERR_SILENT ... do not add this construction point */ +/* UNUR_ERR_INF ... if area = UNUR_INFINITY */ +/* other error code ... error (PDF not T-concave) */ +/*---------------------------------------------------------------------------*/ + +static int _unur_arou_segment_split( struct unur_gen *gen, struct unur_arou_segment *seg_old, double x, double fx ); +/*---------------------------------------------------------------------------*/ +/* split a segment at point (direction) x. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_arou_make_guide_table( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* make a guide table for indexed search. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_arou_segment_arcmean( struct unur_arou_segment *seg ); +/*---------------------------------------------------------------------------*/ +/* compute the "arcmean" of the two construction points of a segement. */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_arou_debug_init( const struct unur_par *par, const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_arou_debug_dars_start( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print header before runniung derandomized adaptive rejection sampling. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_arou_debug_dars( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has run derandomized adaptive rejection sampling. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_arou_debug_free( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print before generater is destroyed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_arou_debug_segments( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print data for segments. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_arou_debug_split_start( const struct unur_gen *gen, + const struct unur_arou_segment *seg, + double x, double fx ); +static void _unur_arou_debug_split_stop( const struct unur_gen *gen, + const struct unur_arou_segment *seg_left, + const struct unur_arou_segment *seg_right ); +/*---------------------------------------------------------------------------*/ +/* print before and after a segment has been split (not / successfully). */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_arou_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cont /* data for distribution object */ + +#define PAR ((struct unur_arou_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_arou_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define BD_LEFT domain[0] /* left boundary of domain of distribution */ +#define BD_RIGHT domain[1] /* right boundary of domain of distribution */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +#define PDF(x) _unur_cont_PDF((x),(gen->distr)) /* call to PDF */ +#define dPDF(x) _unur_cont_dPDF((x),(gen->distr)) /* call to derivative of PDF */ + +/*---------------------------------------------------------------------------*/ + +#define _unur_arou_getSAMPLE(gen) \ + ( ((gen)->variant & AROU_VARFLAG_VERIFY) \ + ? _unur_arou_sample_check : _unur_arou_sample ) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_arou_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL(GENTYPE,distr,NULL); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + + if (DISTR_IN.pdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); return NULL; + } + if (DISTR_IN.dpdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"derivative of PDF"); return NULL; } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_arou_par) ); + COOKIE_SET(par,CK_AROU_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->guide_factor = 2.; /* size of guide table / number of intervals */ + PAR->darsfactor = 0.99; /* factor for (derandomized) ARS. + do not add a new construction point in a segment, + where abiguous region is too small, i.e. if + area / (|S^e\S^s|/number of segments) < darsfactor */ + + PAR->starting_cpoints = NULL; /* pointer to array of starting points */ + PAR->n_starting_cpoints = 30; /* number of starting points */ + PAR->max_segs = 100; /* maximum number of segments */ + PAR->max_ratio = 0.99; /* do not add construction points if + ratio r_n = |P^s| / |P^e| > max_ratio */ + + par->method = UNUR_METH_AROU; /* method */ + par->variant = ( AROU_VARFLAG_USECENTER | + AROU_VARFLAG_USEDARS ); /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = par->urng; /* no special auxilliary URNG */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_arou_init; + + return par; + +} /* end of unur_arou_new() */ + +/*****************************************************************************/ + +int +unur_arou_set_usedars( struct unur_par *par, int usedars ) + /*----------------------------------------------------------------------*/ + /* set flag for using DARS (derandomized adaptive rejection sampling). */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* usedars ... 0 = do not use, !0 = use DARS */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* using not using DARS is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, AROU ); + + /* we use a bit in variant */ + par->variant = (usedars) ? (par->variant | AROU_VARFLAG_USEDARS) : (par->variant & (~AROU_VARFLAG_USEDARS)); + + /* changelog */ + par->set |= AROU_SET_USE_DARS; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_arou_set_usedars() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_arou_set_darsfactor( struct unur_par *par, double factor ) + /*----------------------------------------------------------------------*/ + /* set factor for derandomized adaptive rejection sampling */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* factor ... parameter for DARS */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, AROU ); + + /* check new parameter for generator */ + if (factor < 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"DARS factor < 0"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->darsfactor = factor; + + /* changelog */ + par->set |= AROU_SET_DARS_FACTOR; + + return UNUR_SUCCESS; + +} /* end of unur_arou_set_darsfactor() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_arou_set_cpoints( struct unur_par *par, int n_stp, const double *stp ) + /*----------------------------------------------------------------------*/ + /* set construction points for envelope */ + /* and/or its number for initialization */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* n_stp ... number of starting points */ + /* stp ... pointer to array of starting points */ + /* (NULL for changing only the number of default points) */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, AROU ); + + /* check starting construction points */ + /* we always use the boundary points as additional starting points, + so we do not count these here! */ + if (n_stp < 0 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of starting points < 0"); + return UNUR_ERR_PAR_SET; + } + + if (stp) + /* starting points must be strictly monontonically increasing */ + for( i=1; istarting_cpoints = stp; + PAR->n_starting_cpoints = n_stp; + + /* changelog */ + par->set |= AROU_SET_N_STP | ((stp) ? AROU_SET_STP : 0); + + return UNUR_SUCCESS; + +} /* end of unur_arou_set_cpoints() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_arou_set_guidefactor( struct unur_par *par, double factor ) + /*----------------------------------------------------------------------*/ + /* set factor for relative size of guide table */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* factor ... relative size of table */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, AROU ); + + /* check new parameter for generator */ + if (factor < 0) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"guide table size < 0"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->guide_factor = factor; + + /* changelog */ + par->set |= AROU_SET_GUIDEFACTOR; + + return UNUR_SUCCESS; + +} /* end of unur_arou_set_guidefactor() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_arou_set_max_sqhratio( struct unur_par *par, double max_ratio ) + /*----------------------------------------------------------------------*/ + /* set bound for ratio A(squeeze) / A(hat) */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* max_ratio ... upper bound for ratio to add a new construction point*/ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, AROU ); + + /* check new parameter for generator */ + if (max_ratio < 0. || max_ratio > 1. ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"ratio A(squeeze)/A(hat) not in [0,1]"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->max_ratio = max_ratio; + + /* changelog */ + par->set |= AROU_SET_MAX_SQHRATIO; + + return UNUR_SUCCESS; + +} /* end of unur_arou_set_max_sqhratio() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_arou_get_sqhratio( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get ratio A(squeeze) / A(hat) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* ratio ... on success */ + /* UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + _unur_check_gen_object( gen, AROU, UNUR_INFINITY ); + + return (GEN->Asqueeze / GEN->Atotal); + +} /* end of unur_arou_get_sqhratio() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_arou_get_hatarea( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get area below hat */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* area ... on success */ + /* UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + _unur_check_gen_object( gen, AROU, UNUR_INFINITY ); + + return GEN->Atotal; + +} /* end of unur_arou_get_hatarea() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_arou_get_squeezearea( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get area below squeeze */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* area ... on success */ + /* UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + _unur_check_gen_object( gen, AROU, UNUR_INFINITY ); + + return GEN->Asqueeze; + +} /* end of unur_arou_get_squeezearea() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_arou_set_max_segments( struct unur_par *par, int max_segs ) + /*----------------------------------------------------------------------*/ + /* set maximum number of segments */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* max_segs ... maximum number of segments */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, AROU ); + + /* check new parameter for generator */ + if (max_segs < 1 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"maximum number of segments < 1"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->max_segs = max_segs; + + /* changelog */ + par->set |= AROU_SET_MAX_SEGS; + + return UNUR_SUCCESS; + +} /* end of unur_arou_set_max_segments() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_arou_set_usecenter( struct unur_par *par, int usecenter ) + /*----------------------------------------------------------------------*/ + /* set flag for using center as construction point */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* usecenter ... 0 = do not use, !0 = use */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* using center as construction point is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, AROU ); + + /* we use a bit in variant */ + par->variant = (usecenter) ? (par->variant | AROU_VARFLAG_USECENTER) : (par->variant & (~AROU_VARFLAG_USECENTER)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_arou_set_usecenter() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_arou_set_verify( struct unur_par *par, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, AROU ); + + /* we use a bit in variant */ + par->variant = (verify) ? (par->variant | AROU_VARFLAG_VERIFY) : (par->variant & (~AROU_VARFLAG_VERIFY)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_arou_set_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_arou_chg_verify( struct unur_gen *gen, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, AROU, UNUR_ERR_GEN_INVALID ); + + /* we must not change this switch when sampling has been disabled by + using a pointer to the error producing routine */ + if (SAMPLE == _unur_sample_cont_error) + return UNUR_FAILURE; + + if (verify) + /* turn verify mode on */ + gen->variant |= AROU_VARFLAG_VERIFY; + else + /* turn verify mode off */ + gen->variant &= ~AROU_VARFLAG_VERIFY; + + SAMPLE = _unur_arou_getSAMPLE(gen); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_arou_chg_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_arou_set_pedantic( struct unur_par *par, int pedantic ) + /*----------------------------------------------------------------------*/ + /* turn pedantic mode on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* pedantic ... 0 = no pedantic mode, !0 = use pedantic mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* pedantic is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, AROU ); + + /* we use a bit in variant */ + par->variant = (pedantic) ? (par->variant | AROU_VARFLAG_PEDANTIC) : (par->variant & (~AROU_VARFLAG_PEDANTIC)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_arou_set_pedantic() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_arou_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + int i,k; + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_AROU ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_AROU_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_arou_create(par); + if (!gen) { _unur_par_free(par); return NULL; } + + /* get starting points */ + if (_unur_arou_get_starting_cpoints(par,gen)!=UNUR_SUCCESS ) { +#ifdef UNUR_ENABLE_LOGGING + if (gen->debug) _unur_arou_debug_init(par,gen); +#endif + _unur_par_free(par); _unur_arou_free(gen); + return NULL; + } + + /* compute segments for given starting points */ + if ( _unur_arou_get_starting_segments(gen)!=UNUR_SUCCESS ) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave"); +#ifdef UNUR_ENABLE_LOGGING + if (gen->debug) _unur_arou_debug_init(par,gen); +#endif + _unur_par_free(par); _unur_arou_free(gen); + return NULL; + } + + /* we have to update the maximal number of segments, + if the user wants more starting points. */ + if (GEN->n_segs > GEN->max_segs) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"maximal number of segments too small. increase."); + GEN->max_segs = GEN->n_segs; + } + + if (gen->variant & AROU_VARFLAG_USEDARS) { + /* run derandomized adaptive rejection sampling (DARS) */ + +#ifdef UNUR_ENABLE_LOGGING + if (gen->debug & AROU_DEBUG_DARS) { + /* make initial guide table (only necessary for writing debug info) */ + _unur_arou_make_guide_table(gen); + /* write info into LOG file */ + _unur_arou_debug_init(par,gen); + _unur_arou_debug_dars_start(gen); + } +#endif + + for (i=0; i<3; i++) { + /* we make several tries */ + + /* run DARS */ + if ( _unur_arou_run_dars(gen)!=UNUR_SUCCESS ) { + _unur_par_free(par); _unur_arou_free(gen); + return NULL; + } + + /* make initial guide table */ + _unur_arou_make_guide_table(gen); + + /* check if DARS was completed */ + if (GEN->n_segs < GEN->max_segs) { + /* ran ARS instead */ + for (k=0; k<5; k++) + _unur_sample_cont(gen); + } + else + break; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) { + if (gen->debug & AROU_DEBUG_DARS) + _unur_arou_debug_dars(gen); + else + _unur_arou_debug_init(par,gen); + } +#endif + } + + else { /* do not run DARS */ + /* make initial guide table */ + _unur_arou_make_guide_table(gen); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_arou_debug_init(par,gen); +#endif + + } + + /* free parameters */ + _unur_par_free(par); + + /* is there any envelope at all ? */ + if (GEN->Atotal <= 0. || !_unur_isfinite(GEN->Atotal)) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"bad construction points"); + _unur_arou_free(gen); + return NULL; + } + + /* o.k. */ + return gen; + +} /* end of _unur_arou_init() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_arou_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_AROU_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_arou_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_AROU_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_arou_getSAMPLE(gen); + gen->destroy = _unur_arou_free; + gen->clone = _unur_arou_clone; + + /* set all pointers to NULL */ + GEN->seg = NULL; + GEN->n_segs = 0; + GEN->guide = NULL; + GEN->guide_size = 0; + GEN->Atotal = 0.; + GEN->Asqueeze = 0.; + + /* copy some parameters into generator object */ + GEN->guide_factor = PAR->guide_factor; /* relative size of guide tables */ + + /* bounds for adding construction points */ + GEN->max_segs = PAR->max_segs; /* maximum number of segments */ +#ifdef UNUR_ENABLE_INFO + GEN->max_segs_info = PAR->max_segs; /* ... for info string */ +#endif + GEN->max_ratio = PAR->max_ratio; + GEN->darsfactor = PAR->darsfactor; + + /* get center */ + if ( (gen->distr->set & UNUR_DISTR_SET_CENTER) || + (gen->distr->set & UNUR_DISTR_SET_MODE) ) { + GEN->center = unur_distr_cont_get_center(gen->distr); + /* center must be in domain */ + GEN->center = _unur_max(GEN->center,DISTR.BD_LEFT); + GEN->center = _unur_min(GEN->center,DISTR.BD_RIGHT); + gen->set |= AROU_SET_CENTER; + } + else { + GEN->center = 0.; + /* we cannot use the center as construction point */ + gen->variant &= ~AROU_VARFLAG_USECENTER; + } + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_arou_info; +#endif + + /* return pointer to (almost empty) generator object */ + return(gen); + +} /* end of _unur_arou_create() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_arou_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_arou_gen*)clone->datap) + + struct unur_gen *clone; + struct unur_arou_segment *seg,*next, *clone_seg, *clone_prev; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_AROU_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* copy linked list of segments */ + clone_seg = NULL; + clone_prev = NULL; + for (seg = GEN->seg; seg != NULL; seg = next) { + /* copy segment */ + clone_seg = _unur_xmalloc( sizeof(struct unur_arou_segment) ); + memcpy( clone_seg, seg, sizeof(struct unur_arou_segment) ); + if (clone_prev == NULL) { + /* starting point of linked list */ + CLONE->seg = clone_seg; + } + else { + /* insert into linked list */ + clone_prev->next = clone_seg; + clone_prev->rtp = clone_seg->ltp; + clone_prev->drtp = clone_seg->dltp; + } + /* next step */ + next = seg->next; + clone_prev = clone_seg; + } + /* terminate linked list */ + if (clone_seg) clone_seg->next = NULL; + + /* make new guide table */ + CLONE->guide = NULL; + _unur_arou_make_guide_table(clone); + + /* finished clone */ + return clone; + +#undef CLONE +} /* end of _unur_arou_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_arou_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_AROU ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_AROU_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* write info into LOG file */ +#ifdef UNUR_ENABLE_LOGGING + if (gen->debug) _unur_arou_debug_free(gen); +#endif + + /* free linked list of segments */ + { + struct unur_arou_segment *seg,*next; + for (seg = GEN->seg; seg != NULL; seg = next) { + next = seg->next; + free(seg); + } + } + + /* free other memory not stored in list */ + if (GEN->guide) free(GEN->guide); + + _unur_generic_free(gen); + +} /* end of _unur_arou_free() */ + +/*****************************************************************************/ + +double +_unur_arou_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + /** TODO: check uniform random number: u != 0 and u != 1 ?? **/ + + UNUR_URNG *urng; /* pointer to uniform random number generator */ + struct unur_arou_segment *seg; + int result_split; + double R,R1,R2,R3,tmp,x,fx,u; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_AROU_GEN,UNUR_INFINITY); + + /* main URNG */ + urng = gen->urng; + + while (1) { + + /* sample from U(0,1) */ + R = _unur_call_urng(urng); + + /* look up in guide table and search for segment */ + seg = GEN->guide[(int) (R * GEN->guide_size)]; + R *= GEN->Atotal; + while (seg->Acum < R) { + seg = seg->next; + } + COOKIE_CHECK(seg,CK_AROU_SEG,UNUR_INFINITY); + + /* reuse of uniform random number */ + R = seg->Acum - R; + + /* inside or outside squeeze */ + if (R < seg->Ain) { + /* inside */ + /* reuse of random number. */ + /* We can avoid R = (seg->Ain - R) / seg->Ain */ + return( ( seg->Ain * seg->rtp[0] + R * (seg->ltp[0] - seg->rtp[0]) ) / + ( seg->Ain * seg->rtp[1] + R * (seg->ltp[1] - seg->rtp[1]) ) ); + } + + else { + /* outside */ + + /* from now on we use the auxilliary generator + (it can be the same as the main generator) */ + urng = gen->urng_aux; + + /* three uniform random numbers with R1 + R2 + R3 = 1 */ + R1 = (R - seg->Ain) / seg->Aout; /* reuse of random number (good ?? ) */ + R2 = _unur_call_urng(urng); + if (R1>R2) { tmp = R1; R1=R2; R2=tmp; } /* swap */ + R3 = 1.-R2; + R2 -= R1; + + /* point (v,u) and ratio x = v/u */ + u = seg->ltp[1]*R1 + seg->rtp[1]*R2 + seg->mid[1]*R3; + x = (seg->ltp[0]*R1 + seg->rtp[0]*R2 + seg->mid[0]*R3) / u; + + /* density at x */ + fx = PDF(x); + + /* being outside the squeeze is bad. improve the situation! */ + if (GEN->n_segs < GEN->max_segs) { + if (GEN->max_ratio * GEN->Atotal > GEN->Asqueeze) { + result_split = _unur_arou_segment_split(gen,seg,x,fx); + if ( !(result_split == UNUR_SUCCESS || result_split == UNUR_ERR_SILENT) ) { + /* condition for PDF is violated! */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,""); + if (gen->variant & AROU_VARFLAG_PEDANTIC) { + /* replace sampling routine by dummy routine that just returns UNUR_INFINITY */ + SAMPLE = _unur_sample_cont_error; + return UNUR_INFINITY; + } + } + else { + /* splitting successful --> update guide table */ + _unur_arou_make_guide_table(gen); + } + } + else + /* no more construction points (avoid too many second if statements above) */ + GEN->max_segs = GEN->n_segs; + } + + /* if inside region of acceptance, return ratio x */ + if (u*u <= fx) + return x; + } + } +} /* end of _unur_arou_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_arou_sample_check( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator and verify that method can be used */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + /** TODO: check uniform random number: u != 0 and u != 1 ?? **/ + + UNUR_URNG *urng; /* pointer to uniform random number generator */ + struct unur_arou_segment *seg; + int result_split; + double R,R1,R2,R3,tmp,x,fx,u,sqx,a; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_AROU_GEN,UNUR_INFINITY); + + /* main URNG */ + urng = gen->urng; + + while (1) { + + /* sample from U(0,1) */ + R = _unur_call_urng(urng); + + /* look up in guide table and search for segment */ + seg = GEN->guide[(int) (R * GEN->guide_size)]; + R *= GEN->Atotal; + while (seg->Acum < R) { + seg = seg->next; + } + COOKIE_CHECK(seg,CK_AROU_SEG,UNUR_INFINITY); + + /* reuse of uniform random number */ + R = seg->Acum - R; + + /* inside or outside squeeze */ + if (R < seg->Ain) { + /* inside */ + /* reuse of random number. */ + /* We can avoid R = (seg->Ain - R) / seg->Ain */ + x = ( ( seg->Ain * seg->rtp[0] + R * (seg->ltp[0] - seg->rtp[0]) ) / + ( seg->Ain * seg->rtp[1] + R * (seg->ltp[1] - seg->rtp[1]) ) ); + + /* density at x */ + fx = PDF(x); + + /* compute value of squeeze at x, i.e., we have to solve + a*ltp[0] + (1-a)*rtp[0] == a*ltp[1] + (1-a)*rtp[1] */ + a = ( (seg->rtp[0] - x * seg->rtp[1]) / + (seg->rtp[0] - seg->ltp[0] + x * (seg->ltp[1] - seg->rtp[1])) ); + sqx = a * seg->ltp[1] + (1.-a) * seg->rtp[1]; + + /* test for T-concavity */ + if (sqx*sqx > fx * (1.+UNUR_EPSILON)) + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave."); + + return x; + } + + else { + /* outside */ + + /* from now on we use the auxilliary generator + (it can be the same as the main generator) */ + urng = gen->urng_aux; + + /* three uniform random numbers with R1 + R2 + R3 = 1 */ + R1 = (R - seg->Ain) / seg->Aout; /* reuse of random number (good ?? ) */ + R2 = _unur_call_urng(urng); + if (R1>R2) { tmp = R1; R1=R2; R2=tmp; } /* swap */ + R3 = 1.-R2; + R2 -= R1; + + /* point (v,u) and ratio x = v/u */ + u = seg->ltp[1]*R1 + seg->rtp[1]*R2 + seg->mid[1]*R3; + x = (seg->ltp[0]*R1 + seg->rtp[0]*R2 + seg->mid[0]*R3) / u; + + /* density at x */ + fx = PDF(x); + + /* compute value of squeeze at x, i.e., we have to solve + a*ltp[0] + (1-a)*rtp[0] == a*ltp[1] + (1-a)*rtp[1] */ + a = ( (seg->rtp[0] - x * seg->rtp[1]) / + (seg->rtp[0] - seg->ltp[0] + x * (seg->ltp[1] - seg->rtp[1])) ); + sqx = a * seg->ltp[1] + (1.-a) * seg->rtp[1]; + + /* test for T-concavity */ + if (sqx*sqx > fx) + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave."); + + /* being outside the squeeze is bad. improve the situation! */ + if (GEN->n_segs < GEN->max_segs) { + if (GEN->max_ratio * GEN->Atotal > GEN->Asqueeze) { + result_split = _unur_arou_segment_split(gen,seg,x,fx); + if ( !(result_split == UNUR_SUCCESS || result_split == UNUR_ERR_SILENT) ) { + /* condition for PDF is violated! */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,""); + if (gen->variant & AROU_VARFLAG_PEDANTIC) { + /* replace sampling routine by dummy routine that just returns UNUR_INFINITY */ + SAMPLE = _unur_sample_cont_error; + return UNUR_INFINITY; + } + } + else { + /* splitting successful --> update guide table */ + _unur_arou_make_guide_table(gen); + } + } + else + /* no more construction points (avoid to many second if statement above */ + GEN->max_segs = GEN->n_segs; + } + + /* if inside region of acceptance, return ratio x */ + if (u*u <= fx) + return x; + } + } + +} /* end of _unur_arou_sample_check() */ + + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_arou_get_starting_cpoints( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* list of construction points for starting segments. */ + /* if not provided as arguments compute these */ + /* by means of the "equi-angle rule". */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_arou_segment *seg, *seg_new; + double left_angle, right_angle, diff_angle, angle; + double x, x_last, fx, fx_last; + int i, use_center, is_increasing; /* is_center,*/ + + /* check arguments */ + CHECK_NULL(par,UNUR_ERR_NULL); COOKIE_CHECK(par,CK_AROU_PAR,UNUR_ERR_COOKIE); + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_AROU_GEN,UNUR_ERR_COOKIE); + + /* initialize boolean */ + /* is_center = FALSE; */ + + /* use center as construction point ? */ + use_center = (gen->variant & AROU_VARFLAG_USECENTER) ? TRUE : FALSE; + + /* reset counter of segments */ + GEN->n_segs = 0; + + /* prepare for computing construction points */ + if (!PAR->starting_cpoints) { + /* move center into x = 0 */ + /* angles of boundary of domain */ + left_angle = ( DISTR.BD_LEFT <= -UNUR_INFINITY ) ? -M_PI/2. : atan(DISTR.BD_LEFT - GEN->center); + right_angle = ( DISTR.BD_RIGHT >= UNUR_INFINITY ) ? M_PI/2. : atan(DISTR.BD_RIGHT - GEN->center); + /* we use equal distances between the angles of the cpoints */ + /* and the boundary points */ + diff_angle = (right_angle-left_angle) / (PAR->n_starting_cpoints + 1); + angle = left_angle; + } + else + diff_angle = angle = 0.; /* we do not need these variables in this case */ + + /* the left boundary point */ + x = x_last = DISTR.BD_LEFT; + fx = fx_last = (x <= -UNUR_INFINITY) ? 0. : PDF(x); + seg = GEN->seg = _unur_arou_segment_new( gen, x, fx ); + if (seg == NULL) return UNUR_ERR_GEN_CONDITION; /* case of error */ + is_increasing = 1; /* assume PDF(x) is increasing for the first construction points */ + + /* now all the other points */ + for( i=0; i<=PAR->n_starting_cpoints; i++ ) { + + /* starting point */ + if (i < PAR->n_starting_cpoints) { + if (PAR->starting_cpoints) { + /* construction points provided by user */ + x = PAR->starting_cpoints[i]; + /* check starting point */ + if (x <= DISTR.BD_LEFT || x >= DISTR.BD_RIGHT) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"starting point out of domain"); + continue; + } + if (x<=x_last) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"starting points not increasing -> skip"); + continue; + } + } + else { + /* compute construction points by means of "equidistance" rule */ + angle += diff_angle; + x = tan( angle ) + GEN->center; + } + } + else { + /* the very last segment. it is rather a "virtual" segment to store + the right vertex of the last segment, i.e., the right boundary point. */ + x = DISTR.BD_RIGHT; + } + + /* insert center ? */ + if (use_center && x >= GEN->center) { + use_center = FALSE; /* we use the center only once (of course) */ + /* is_center = TRUE; /\* the next construction point is the center *\/ */ + if (x>GEN->center) { + x = GEN->center; /* use the center now ... */ + --i; /* and push the orignal starting point back on stack */ + if (!PAR->starting_cpoints) + angle -= diff_angle; /* we have to compute the starting point in this case */ + } + /* else: x == GEN->center --> nothing to do */ + } + /* else */ + /* is_center = FALSE; */ + + /* value of PDF at starting point */ + fx = (x >= UNUR_INFINITY) ? 0. : PDF(x); + + /* check value of PDF at starting point */ + if (!is_increasing && fx > fx_last) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not unimodal"); + return UNUR_ERR_GEN_CONDITION; + } + + if (fx <= 0. && fx_last <= 0.) { + /* we do not need two such points */ + if (is_increasing) { + /* PDF is still increasing, i.e., constant 0 til now */ + if (in_starting_cpoints) { + /* and it is not the right boundary. + otherwise the PDF is constant 0 on all construction points. + then we need both boundary points. */ + /* we only have to change tangent line v/u = x, + everything else remains unchanged */ + seg->dltp[0] = -1.; + seg->dltp[1] = x; + /* seg->dltp[0] = -1; seg->dltp[2] = 0.; not changed */ + x_last = x; + continue; /* next construction point */ + } + } + else + /* there should be no more points with PDF(x) > 0 */ + break; + } + + /* need a new segment */ + seg_new = _unur_arou_segment_new( gen, x, fx ); + if (seg_new == NULL) { + /* case of error */ + seg->next = NULL; /* derminate list (for listing in debugging mode) */ + return UNUR_ERR_GEN_CONDITION; + } + + /* append to linked list */ + seg->next =seg_new; + seg->rtp = seg_new->ltp; + seg->drtp = seg_new->dltp; + + /* next step */ + seg = seg_new; + + /* PDF still increasing ? */ + if (is_increasing && fx < fx_last) + is_increasing = 0; + + /* store last computed values */ + x_last = x; + fx_last = fx; + } + + /* we have left the loop with the right boundary of the support of PDF + make shure that we will never use seg for sampling. */ + seg->Ain = seg->Aout = 0.; + seg->Acum = UNUR_INFINITY; + seg->next = NULL; /* terminate list */ + --(GEN->n_segs); /* we do not count this segment */ + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_arou_get_starting_cpoints() */ + +/*****************************************************************************/ + +int +_unur_arou_get_starting_segments( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* compute segments for starting points */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ +#define MAX_IT (1000) /* maximal number of iterations to avoid + infinite loop in case of numerical errors */ + + struct unur_arou_segment *seg, *seg_new, *seg_tmp; + double x,fx; /* construction point, value of PDF at x */ + int n_it = 0; /* counter for number of iterations */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_AROU_GEN,UNUR_ERR_COOKIE); + + /* compute paramters for all segments */ + for( seg=GEN->seg; seg->next != NULL; ) { + + /* compute parameters for semgent */ + switch (_unur_arou_segment_parameter(gen, seg)) { + case UNUR_SUCCESS: /* computation of parameters for segment successful */ + /* skip to next segment. */ + seg = seg->next; + continue; + case UNUR_ERR_SILENT: /* construction points too close */ + /* we have to remove this last segment from list */ + /* (the last construction point in the list is a boundary point. + thus we might change the domain of the distribution. + however, we only cut off a piece that is beyond the precesion + of the floating point arithmetic.) */ + if (seg->next != NULL) { + seg_tmp = seg->next; + seg->next = seg->next->next; + seg->rtp = seg->next->ltp; + seg->drtp = seg->next->dltp; + free(seg_tmp); + --(GEN->n_segs); + } + else { /* seg->next==NULL */ + /* last (virtuel) interval in list. + make shure that we will never use this segment */ + seg->Ain = seg->Aout = 0.; + seg->Acum = UNUR_INFINITY; + } + continue; + case UNUR_ERR_INF: /* segment unbounded */ + /* split segment */ + break; + default: /* PDF not T-concave */ + return UNUR_ERR_GEN_CONDITION; + } + + /* next iteration step */ + ++n_it; + + if (n_it > MAX_IT) { + /* maximal number of iterations exceeded */ + /* assume PDF not T-concave */ + return UNUR_ERR_GEN_CONDITION; + } + + /* area in segment infinite. insert new construction point. */ + x = _unur_arou_segment_arcmean(seg); /* use mean point in segment */ + + /* value of PDF at x */ + fx = PDF(x); + if (fx < 0.) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF < 0"); + return UNUR_ERR_GEN_DATA; + } + + /* add a new segment, but check if we had to used too many segments */ + if (GEN->n_segs >= GEN->max_segs) { + /* we do not want to create too many segments */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot create bounded envelope!"); + return UNUR_ERR_GEN_CONDITION; + } + seg_new = _unur_arou_segment_new( gen, x, fx ); + if (seg_new == NULL) return UNUR_ERR_GEN_CONDITION; /* case of error */ + + /* insert into linked list */ + seg_new->next = seg->next; + seg->next = seg_new; + + /* right vertices */ + seg_new->rtp = seg->rtp; + seg_new->drtp = seg->drtp; + seg->rtp = seg_new->ltp; + seg->drtp = seg_new->dltp; + + } + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_arou_get_starting_segments() */ + +/*****************************************************************************/ + +struct unur_arou_segment * +_unur_arou_segment_new( struct unur_gen *gen, double x, double fx ) + /*----------------------------------------------------------------------*/ + /* get new segment and compute left construction point at x. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* x ... left point of new segment */ + /* fx ... value of PDF at x */ + /* */ + /* return: */ + /* pointer to new segment */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_arou_segment *seg; + double u,v,dfx; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_AROU_GEN,NULL); + + /* first check fx */ + if (fx<0.) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) < 0."); + return NULL; + } + if (_unur_FP_is_infinity(fx)) { + /* over flow */ + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) overflow"); + return NULL; + } + + /* we need a new segment */ + seg = _unur_xmalloc( sizeof(struct unur_arou_segment) ); + seg->next = NULL; /* add eol marker */ + ++(GEN->n_segs); /* increment counter for segments */ + COOKIE_SET(seg,CK_AROU_SEG); + + /* initialize some entries in seg */ + seg->Ain = seg->Aout = seg->Acum = 0.; + seg->mid[0] = seg->mid[1] = 0.; + + /* make left construction point in segment */ + + /* case: x out of support */ + if ( _unur_iszero(fx) ) { + seg->ltp[0] = 0.; /* vertex == origin */ + seg->ltp[1] = 0.; + if (x <= -UNUR_INFINITY || x >= UNUR_INFINITY ) { + /* tangent line == line u = 0 (i.e., v-axis) */ + seg->dltp[0] = 0.; /* dv */ + seg->dltp[1] = 1.; /* du */ + seg->dltp[2] = 0.; /* v * dv + u * du */ + } + else { + /* tangent line == line v/u = x */ + seg->dltp[0] = -1.; /* dv */ + seg->dltp[1] = x; /* du */ + seg->dltp[2] = 0.; /* v * dv + u * du */ + } + return seg; + } + + /* case: x in support */ + /* boundary point */ + u = sqrt( fx ); + v = x * u; + seg->ltp[0] = v; + seg->ltp[1] = u; + + /* tangent line at tp */ + + /* compute derivative of PDF at tp x */ + dfx = dPDF(x); + + /* subcase: derivative bounded + use derivative for tangent line */ + if ( dfx > -UNUR_INFINITY && dfx < UNUR_INFINITY ) { + seg->dltp[0] = -dfx / u; /* dv */ /** TODO: possible overflow **/ + seg->dltp[1] = 2 * u + dfx * x / u; /* du */ /** TODO: possible overflow **/ + seg->dltp[2] = seg->dltp[0] * v + seg->dltp[1] * u; + return seg; + } + + /* subcase: derivative unbounded. + use straight line through origin and vertex */ + seg->dltp[0] = -u; /* dv */ + seg->dltp[1] = v; /* du */ + seg->dltp[2] = 0.; + + return seg; + +} /* end of _unur_arou_segment_new() */ + +/*****************************************************************************/ + +/* maximal distance of intersection point from origin + compared to distance of construction points to origin */ +#define MAX_NORM_OF_INTERSECTION_POINT 1.e6 + +/*---------------------------------------------------------------------------*/ + +int +_unur_arou_segment_parameter( struct unur_gen *gen, struct unur_arou_segment *seg ) + /*----------------------------------------------------------------------*/ + /* compute all parameters for a segment. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* seg ... pointer to segment */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* UNUR_ERR_SILENT ... do not add this construction point */ + /* UNUR_ERR_INF ... if area = UNUR_INFINITY */ + /* other error code ... error (PDF not T-concave) */ + /*----------------------------------------------------------------------*/ +{ + double coeff_det, cramer_det[2]; + double norm_vertex; /* sum of 1-norms of vertices */ + double diff_tangents; /* difference between coefficients of tangents */ + double det_bound; /* bound for determinant for Cramer's rule */ + double tmp_a, tmp_b; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_AROU_GEN,UNUR_ERR_COOKIE); + CHECK_NULL(seg,UNUR_ERR_NULL); COOKIE_CHECK(seg,CK_AROU_SEG,UNUR_ERR_COOKIE); + + /* sum of 1-norms of vertices */ + norm_vertex = fabs(seg->ltp[0]) + fabs(seg->ltp[1]) + fabs(seg->rtp[0]) + fabs(seg->rtp[1]); + + /* area inside the squeeze */ + seg->Ain = (seg->ltp[1] * seg->rtp[0] - seg->ltp[0] * seg->rtp[1]) / 2.; + + /* due to our ordering of construction points, seg->Ain must be >= 0 ! */ + if( seg->Ain < 0. ) { + /* this could happen by round-off errors when the segment has angle extremely + close to 0. Check this. */ + if (fabs(seg->Ain) < 1.e-8 * norm_vertex) { + seg->Ain = seg->Aout = 0.; + } + else { + /* This should not happen: + non-ascending ordering of construction points */ + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + } + return UNUR_ERR_SILENT; + } + + /* we use Cramer's rule to compute intersection of tangent lines. + (well, we could save one multiplication otherwise) */ + coeff_det = seg->dltp[0] * seg->drtp[1] - seg->dltp[1] * seg->drtp[0]; + cramer_det[0] = seg->dltp[2] * seg->drtp[1] - seg->dltp[1] * seg->drtp[2]; + cramer_det[1] = seg->dltp[0] * seg->drtp[2] - seg->dltp[2] * seg->drtp[0]; + + /* we there are two possibilities for singular coefficent matrix: + + either the outer triangle is unlimited. + then the two tangents are distinct but parallel and + the corresponding linear equation has no solution, i.e. + coeff_det == 0 but cramer_det[0] != 0 or cramer_det[1] != 0. + + or the outer triangle degenerates to a line segment and has area 0. + then the two tangents are equal and + the corresponding linear equation has a nonunique solution, i.e. + coeff_det == cramer_det[0] == cramer_det[1] == 0. + */ + + /* we to not allow that the outer triangles becomes too large. + so if the 1-norm of intersection point is too large compared + to norm_vertex we assume that this triangle is unbounded. + we thus avoid numerical errors. + (we use the 1-norm here since it much easier to handle.) + + However, this might also happen due to roundoff errors, + when the real position is extremely close to the secant. + But at least we are on the save side. + We only make an exception when coeff_det == 0, since otherwise there + might be some problems with distributions like U(1,2). + */ + det_bound = fabs(coeff_det) * norm_vertex * MAX_NORM_OF_INTERSECTION_POINT; + + /* difference between coefficents of tangents */ + diff_tangents = ( fabs(seg->dltp[0] - seg->drtp[0]) + fabs(seg->dltp[1] - seg->drtp[1]) + + fabs(seg->dltp[2] - seg->drtp[2]) ); + + /* case: intersection point exists and is unique */ + if (!_unur_iszero(coeff_det) && !_unur_iszero(diff_tangents)) { + + /* first check whether we can compute the intersection point */ + if ( fabs(cramer_det[0]) > det_bound || fabs(cramer_det[1]) > det_bound ) { + /* case: triangle is assumed to be unbounded */ + /* _unur_warning(gen->genid,UNUR_ERR_GENERIC,"outer triangle assumed unbounded 1"); */ + seg->Aout = UNUR_INFINITY; + return UNUR_ERR_INF; + } + + /* compute intersection point */ + seg->mid[0] = cramer_det[0] / coeff_det; + seg->mid[1] = cramer_det[1] / coeff_det; + + /* area outside the squeeze */ + seg->Aout = ( (seg->ltp[0] - seg->mid[0]) * (seg->rtp[1] - seg->mid[1]) + - (seg->ltp[1] - seg->mid[1]) * (seg->rtp[0] - seg->mid[0])) / 2.; + + /* due to our ordering of construction points, seg->Aout must be >= 0 + for a regular triangle. + Thus if seg->Aout < 0, then the intersection point of tangents is on + the WRONG side of the secant through vertices of segment, + i.e. the "triangle" outside the squeeze region is unbounded. + + However this might also happen due to roundoff errors when + the real position is extremely close to the secant. + We can distinguish between these two case by means of the u-coordinate + of the intersection point. If it is on the wrong side of the secant, + then we have seg->mid[1] < 0 (Otherwise we have either a round-off error + or the PDF is not T-concave.) */ + if( seg->mid[1] < 0. ) { + /* _unur_warning(gen->genid,UNUR_ERR_GENERIC,"outer triangle unbounded 2"); */ + seg->Aout = UNUR_INFINITY; + return UNUR_ERR_INF; + } + + /* at last check result. + we must have: + (*) seg->Aout > 0 + (*) intersection point right of left construction point + (*) intersection point left of right construction point */ + if ( seg->Aout > 0. ) { + tmp_a = seg->mid[0] * seg->ltp[1]; + tmp_b = seg->ltp[0] * seg->mid[1]; + if ( ! _unur_FP_less(tmp_a, tmp_b) ) { + tmp_a = seg->mid[0] * seg->rtp[1]; + tmp_b = seg->rtp[0] * seg->mid[1]; + if ( ! _unur_FP_greater(tmp_a, tmp_b) ) + /* everything o.k. */ + return UNUR_SUCCESS; + } + } + + /* there are two cases why the above check failed: + (1) the PDF is not T-concave + (2) small roundoff errors. + */ + + if ( !_unur_iszero(seg->ltp[1]) && !_unur_iszero(seg->rtp[1]) ) { + tmp_a = seg->ltp[0] * seg->rtp[1]; + tmp_b = seg->rtp[0] * seg->ltp[1]; + if ( _unur_FP_equal(tmp_a, tmp_b) ) { + /* we assume that left construction point = right construction point */ + /* (construction points are too close) */ + seg->Ain = seg->Aout = 0.; + return UNUR_ERR_SILENT; + } + } + + /* _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave"); */ + + /* The outer area is unbounded (this might happen if the given PDF + is not T-concave or due to round off errors. + We assume round off errors. If the PDF is not T-concave we + will exceed any bound for the number of segments. */ + + /* However due to round off errors, Aout might have become < 0 + when the boundary of region is (almost) a straight line + and the area outside squeeze should be (almost) zero. */ + + if (!(fabs(seg->Aout) < fabs(seg->Ain) * UNUR_EPSILON)) { + seg->Aout = UNUR_INFINITY; + return UNUR_ERR_INF; + } + /* else we assume round-off errors and set Aout = 0. + i.e. go to the remaining case below */ + } + + /* remaining case: triangle degenerates to a line segment, i.e. + intersection point exists but is not unique */ + + /* boundary of region is (almost) a straight line + and area outside squeeze is (almost) zero. + use middle point as intersection point and + set area outside the squeeze to 0. + */ + /* _unur_warning(gen->genid,UNUR_ERR_GENERIC,"outer triangle is line"); */ + seg->mid[0] = 0.5 * (seg->ltp[0] + seg->rtp[0]); + seg->mid[1] = 0.5 * (seg->ltp[1] + seg->rtp[1]); + seg->Aout = 0.; + + /* now it should be o.k. */ + return UNUR_SUCCESS; + +} /* end if _unur_arou_segment_parameter() */ + +/*---------------------------------------------------------------------------*/ + +#undef MAX_NORM_INTERSECTION + +/*****************************************************************************/ + +int +_unur_arou_segment_split( struct unur_gen *gen, struct unur_arou_segment *seg_oldl, double x, double fx ) + /*----------------------------------------------------------------------*/ + /* insert new segment */ + /* old segment -> left hand side */ + /* new segment -> right hand side */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* seg_oldl ... pointer to segment */ + /* x ... left point of new segment */ + /* fx ... value of PDF at x */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* UNUR_ERR_SILENT ... if no intervals are splitted */ + /* other error codes ... on error */ + /* 1 ... if successful */ + /* 0 ... if */ + /* -1 ... error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_arou_segment *seg_newr; /* pointer to newly created segment */ + struct unur_arou_segment seg_bak; /* space for saving data of segment */ + double Adiff; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_AROU_GEN,UNUR_ERR_COOKIE); + CHECK_NULL(seg_oldl,UNUR_ERR_NULL); COOKIE_CHECK(seg_oldl,CK_AROU_SEG,UNUR_ERR_COOKIE); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & AROU_DEBUG_SPLIT) + _unur_arou_debug_split_start( gen,seg_oldl,x,fx ); +#endif + + /* we only add a new construction point, if the relative area is large enough */ + if (GEN->n_segs * seg_oldl->Aout / (GEN->Atotal - GEN->Asqueeze) < GEN->darsfactor ) + return UNUR_SUCCESS; + + /* check for data error */ + if (fx < 0.) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) < 0.!"); + return UNUR_ERR_GEN_DATA; + } + + /* backup data */ + memcpy(&seg_bak, seg_oldl, sizeof(struct unur_arou_segment)); + + /* PDF at x is 0. */ + if (fx <= 0.) { + if (seg_oldl->rtp[1] <= 0. && seg_oldl->rtp[0] <= 0. ) { + /* just chop off the right part of segment */ + /* we only have to change tangent line v/u = x + at the right hand vertex */ + seg_oldl->drtp[1] = x; /* du */ + } + else if (seg_oldl->ltp[1] <= 0. && seg_oldl->ltp[0] <= 0. ) { + /* just chop off the left part of segment */ + /* we only have to change tangent line v/u = x + at the left hand vertex */ + seg_oldl->dltp[1] = x; /* du */ + } + else { + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + } + + /* parameters of new segment */ + if( _unur_arou_segment_parameter(gen,seg_oldl)!=UNUR_SUCCESS ) { + /* PDF not T-concave or area in segment not bounded */ + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"Cannot chop segment at given point"); + /* error --> restore the old segment */ + memcpy(seg_oldl, &seg_bak, sizeof(struct unur_arou_segment)); + return UNUR_ERR_SILENT; + } + + /* for _unur_arou_debug_split_stop only */ + seg_newr = seg_oldl; + } + + else { /* fx > 0 */ + + /* need new segment */ + seg_newr = _unur_arou_segment_new(gen,x,fx); + if (seg_newr == NULL) return UNUR_ERR_GEN_DATA; /* case of error */ + + /* link into list */ + seg_newr->next = seg_oldl->next; + seg_oldl->next = seg_newr; + + /* right vertices */ + seg_newr->rtp = seg_oldl->rtp; + seg_newr->drtp = seg_oldl->drtp; + seg_oldl->rtp = seg_newr->ltp; + seg_oldl->drtp = seg_newr->dltp; + + /* parameters of new segments */ + if( _unur_arou_segment_parameter(gen,seg_oldl)!=UNUR_SUCCESS || + /* PDF not T-concave or */ + _unur_arou_segment_parameter(gen,seg_newr)!=UNUR_SUCCESS + /* area in segment not bounded */ ) { + + /* new construction point not suitable --> do not add */ + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"Cannot split segment at given point."); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & AROU_DEBUG_SPLIT) + _unur_arou_debug_split_stop( gen,seg_oldl,seg_newr ); +#endif + + /* restore the old segment */ + memcpy(seg_oldl, &seg_bak, sizeof(struct unur_arou_segment)); + + /* decrement counter for segments and free unused segment */ + if (seg_newr) { + --(GEN->n_segs); + free( seg_newr ); + } + + return UNUR_ERR_SILENT; + } + } + + /* successful */ + + /* update total area below hat and squeeze */ + Adiff = - seg_bak.Ain + seg_oldl->Ain + ((seg_newr!=seg_oldl) ? seg_newr->Ain : 0. ); + GEN->Asqueeze += Adiff; + Adiff += - seg_bak.Aout + seg_oldl->Aout + ((seg_newr!=seg_oldl) ? seg_newr->Aout : 0. ); + GEN->Atotal += Adiff; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & AROU_DEBUG_SPLIT) + _unur_arou_debug_split_stop( gen,seg_oldl,seg_newr ); +#endif + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_arou_segment_split() */ + + +/*****************************************************************************/ + +double +_unur_arou_compute_x( double v, double u ) + /*----------------------------------------------------------------------*/ + /* compute point x from (v,u) tuple. */ + /* */ + /* parameters: */ + /* v ... numerator */ + /* u ... denominator */ + /* */ + /* return: */ + /* point x of (x,y) tuple */ + /* */ + /* remark: */ + /* if (v,u)=(0,0) then x is set to UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + if (!_unur_iszero(u)) return v/u; + else if (v<0.) return -UNUR_INFINITY; + else return UNUR_INFINITY; +} /* end of _unur_arou_compute_x() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_arou_run_dars( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* run derandomized adaptive rejection sampling. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_arou_segment *seg, *seg_next; + double Atot, Asqueezetot; /* total area below hat and squeeze, resp. */ + double Alimit; /* threshhold value for splitting interval */ + int n_splitted = 1; /* count splitted intervals */ + int splitted; /* result of splitting routine */ + double xl, xr; /* boundary of interval */ + double xsp, fxsp; /* splitting point in interval */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_AROU_GEN,UNUR_ERR_COOKIE); + + /* there is no need to run DARS when the DARS factor is UNUR_INFINITY */ + if (_unur_FP_is_infinity(GEN->darsfactor)) + return UNUR_SUCCESS; + + /* first we need the total areas below hat and squeeze. + (This is only necessary, when _unur_arou_make_guide_table() has not been + called!) */ + Atot = 0.; /* area below hat */ + Asqueezetot = 0.; /* area below squeeze */ + for (seg = GEN->seg; seg != NULL; seg = seg->next ) { + COOKIE_CHECK(seg,CK_AROU_SEG,UNUR_ERR_COOKIE); + Asqueezetot += seg->Ain; + Atot += seg->Ain + seg->Aout; + } + GEN->Atotal = Atot; + GEN->Asqueeze = Asqueezetot; + + /* now split intervals */ + while ( (GEN->max_ratio * GEN->Atotal > GEN->Asqueeze) && + (GEN->n_segs < GEN->max_segs) ) { + + /* compute threshhold value. every interval with area between + hat and squeeze greater than this value will be splitted. */ + if (GEN->n_segs > 1) + Alimit = GEN->darsfactor * ( (GEN->Atotal - GEN->Asqueeze) / GEN->n_segs ); + else + /* we split every interval if there are only one interval */ + Alimit = 0.; + + /* reset counter for splitted intervals */ + n_splitted = 0; + + /* for all intervals do ... */ + for (seg = GEN->seg; seg->next != NULL; seg = seg->next ) { + COOKIE_CHECK(seg,CK_AROU_SEG,UNUR_ERR_COOKIE); + + /* do not exceed the maximum number of intervals */ + if (GEN->n_segs >= GEN->max_segs) + break; + + /* we skip over all intervals where the area between hat and + squeeze does not exceed the threshhold value. */ + if (seg->Aout <= Alimit) + continue; /* goto next interval */ + + /* store pointer to next interval */ + seg_next = seg->next; + + /* boundary of interval */ + xl = _unur_arou_compute_x(seg->ltp[0],seg->ltp[1]); + xr = _unur_arou_compute_x(seg->rtp[0],seg->rtp[1]); + if (xl>xr) xl = -UNUR_INFINITY; /* (0,0) is mapped to INF instead of -INF */ + + /* However ... */ + if ( _unur_FP_is_minus_infinity(xl) + && _unur_FP_same(seg->dltp[0],-1.) && _unur_iszero(seg->dltp[2]) ) + /* boundary of domain given by tangent */ + xl = seg->dltp[1]; + + if ( _unur_FP_is_infinity(xr) + && _unur_FP_same(seg->drtp[0],-1.) && _unur_iszero(seg->drtp[2]) ) + /* boundary of domain given by tangent */ + xr = seg->drtp[1]; + + /* get splitting point (arc-mean rule) */ + xsp = _unur_arcmean(xl,xr); + + /* value of PDF at splitting point */ + fxsp = PDF(xsp); + + /* now split interval at given point */ + splitted = _unur_arou_segment_split(gen, seg, xsp, fxsp); + + if (splitted == UNUR_SUCCESS) { + /* splitting successful */ + ++n_splitted; + + /* If we have chopped off the left or right tail, + we can simply continue with seg->next. + Otherwise, if we have split the segment, then + seg->next points to the newly created segment + and there is no need to split this in this loop; + thus we skip seg->next and continue we seg->next->next. + we can distinguish between these two cases by comparing + the stored pointer seg_next with seg->next. */ + if (seg->next != seg_next) + seg = seg->next; + } + else if (splitted != UNUR_ERR_SILENT) { + /* some serious error occurred */ + /* condition for PDF is violated! */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,""); + return UNUR_ERR_GEN_CONDITION; + } + /* else: could not split construction points: too close (?) */ + } + + if (n_splitted == 0) { + /* we are not successful in splitting any inteval. + abort to avoid endless loop */ + _unur_warning(gen->genid,UNUR_ERR_GENERIC,"DARS aborted: no intervals could be splitted."); + break; + } + } + + /* ratio between squeeze and hat o.k. ? */ + if ( GEN->max_ratio * GEN->Atotal > GEN->Asqueeze ) { + if ( GEN->n_segs >= GEN->max_segs ) + _unur_warning(gen->genid,UNUR_ERR_GENERIC,"DARS aborted: maximum number of intervals exceeded."); + _unur_warning(gen->genid,UNUR_ERR_GENERIC,"hat/squeeze ratio too small."); + } + else { + /* no more construction points */ + GEN->max_segs = GEN->n_segs; + } + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_arou_run_dars() */ + +/*****************************************************************************/ + +int +_unur_arou_make_guide_table( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* make a guide table for indexed search */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_arou_segment *seg; + double Acum, Aincum, Astep; + int max_guide_size; + int j; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_AROU_GEN,UNUR_ERR_COOKIE); + + /* allocate blocks for guide table (if necessary). + (we allocate blocks for maximal guide table.) */ + if (!GEN->guide) { + max_guide_size = (GEN->guide_factor > 0.) ? ((int)(GEN->max_segs * GEN->guide_factor)) : 1; + if (max_guide_size <= 0) max_guide_size = 1; /* protect against overflow */ + GEN->guide = _unur_xmalloc( max_guide_size * sizeof(struct unur_arou_segment*) ); + } + + /* first we need cumulated areas in segments */ + Acum = 0.; /* area in enveloping polygon */ + Aincum = 0.; /* area in squeeze */ + for (seg = GEN->seg; seg != NULL; seg = seg->next ) { + COOKIE_CHECK(seg,CK_AROU_SEG,UNUR_ERR_COOKIE); + Acum += seg->Ain + seg->Aout; + Aincum += seg->Ain; + seg->Acum = Acum; + } + + /* total area below hat */ + GEN->Atotal = Acum; + GEN->Asqueeze = Aincum; + + /* actual size of guide table */ + GEN->guide_size = (int)(GEN->n_segs * GEN->guide_factor); + /* we do not vary the relative size of the guide table, + since it has very little influence on speed */ + + /* make table (use variant 2; see dgt.c) */ + Astep = GEN->Atotal / GEN->guide_size; + Acum=0.; + for( j=0, seg=GEN->seg; j < GEN->guide_size; j++ ) { + COOKIE_CHECK(seg,CK_AROU_SEG,UNUR_ERR_COOKIE); + while( seg->Acum < Acum ) + if( seg->next != NULL ) /* skip to next segment if it exists */ + seg = seg->next; + else { + _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF,"guide table"); + break; + } + GEN->guide[j] = seg; + Acum += Astep; + } + + /* if there has been an round off error, we have to complete the guide table */ + for( ; jguide_size ;j++ ) + GEN->guide[j] = seg; + + return UNUR_SUCCESS; +} /* end of _unur_arou_make_guide_table() */ + +/*****************************************************************************/ + +double +_unur_arou_segment_arcmean( struct unur_arou_segment *seg ) + /*----------------------------------------------------------------------*/ + /* compute "arctan mean" of two numbers expressed as v/u, u>=0 */ + /* */ + /* parameters: */ + /* seg ... pointer to segment */ + /* */ + /* return: */ + /* mean */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /* */ + /* comment: */ + /* "arctan mean" = tan(0.5*(arctan(x0)+arctan(x1))) */ + /* */ + /* a combination of arithmetical mean (for x0 and x1 close to 0) */ + /* and the harmonic mean (for |x0| and |x1| large). */ + /*----------------------------------------------------------------------*/ +{ + double xl, xr; + + /* check arguments */ + CHECK_NULL(seg,UNUR_INFINITY); COOKIE_CHECK(seg,CK_AROU_SEG,UNUR_INFINITY); + + /* if u != 0 ... x is stored in tp (= v/u) */ + /* else ... x is stored in tangent dltp */ + xl = (seg->ltp[1] > 0.) ? (seg->ltp[0] / seg->ltp[1]) : + ( _unur_iszero(seg->dltp[0]) ? -UNUR_INFINITY : (seg->dltp[1]) ); + + xr = (seg->rtp[1] > 0.) ? (seg->rtp[0] / seg->rtp[1]) : + ( _unur_iszero(seg->drtp[0]) ? UNUR_INFINITY : (seg->drtp[1]) ); + + return _unur_arcmean(xl,xr); + +} /* end of _unur_arou_segment_arcmean() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_arou_debug_init( const struct unur_par *par, const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator after setup into LOG file */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int i; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_AROU_GEN,RETURN_VOID); + CHECK_NULL(par,RETURN_VOID); COOKIE_CHECK(par,CK_AROU_PAR,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = ratio-of-uniforms method with enveloping polygon\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cont_debug( gen->distr, gen->genid ); + + fprintf(LOG,"%s: sampling routine = _unur_arou_sample",gen->genid); + if (gen->variant & AROU_VARFLAG_VERIFY) + fprintf(LOG,"_check()\n"); + else + fprintf(LOG,"()\n"); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: center = %g",gen->genid,GEN->center); + _unur_print_if_default(gen,AROU_SET_CENTER); + if (gen->variant & AROU_VARFLAG_USECENTER) + fprintf(LOG,"\n%s: use center as construction point",gen->genid); + fprintf(LOG,"\n%s:\n",gen->genid); + + fprintf(LOG,"%s: maximum number of segments = %d",gen->genid,GEN->max_segs); + _unur_print_if_default(gen,AROU_SET_MAX_SEGS); + fprintf(LOG,"\n%s: bound for ratio Asqueeze / Atotal = %g%%",gen->genid,GEN->max_ratio*100.); + _unur_print_if_default(gen,AROU_SET_MAX_SQHRATIO); + fprintf(LOG,"\n%s:\n",gen->genid); + + if (gen->variant & AROU_VARFLAG_USEDARS) { + fprintf(LOG,"%s: Derandomized ARS enabled ",gen->genid); + _unur_print_if_default(gen,AROU_SET_USE_DARS); + fprintf(LOG,"\n%s:\tDARS factor = %g",gen->genid,GEN->darsfactor); + _unur_print_if_default(gen,AROU_SET_DARS_FACTOR); + } + else { + fprintf(LOG,"%s: Derandomized ARS disabled ",gen->genid); + _unur_print_if_default(gen,AROU_SET_USE_DARS); + } + fprintf(LOG,"\n%s:\n",gen->genid); + + fprintf(LOG,"%s: sampling from list of segments: indexed search (guide table method)\n",gen->genid); + fprintf(LOG,"%s: relative guide table size = %g%%",gen->genid,100.*GEN->guide_factor); + _unur_print_if_default(gen,AROU_SET_GUIDEFACTOR); + fprintf(LOG,"\n%s:\n",gen->genid); + + fprintf(LOG,"%s: number of starting points = %d",gen->genid,PAR->n_starting_cpoints); + _unur_print_if_default(gen,AROU_SET_N_STP); + fprintf(LOG,"\n%s: starting points:",gen->genid); + if (gen->set & AROU_SET_STP) + for (i=0; in_starting_cpoints; i++) { + if (i%5==0) fprintf(LOG,"\n%s:\t",gen->genid); + fprintf(LOG," %#g,",PAR->starting_cpoints[i]); + } + else + fprintf(LOG," use \"equidistribution\" rule [default]"); + fprintf(LOG,"\n%s:\n",gen->genid); + + _unur_arou_debug_segments(gen); + + fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_arou_debug_init() */ + +/*****************************************************************************/ + +void +_unur_arou_debug_dars_start( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* print header before runniung DARS into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_AROU_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: DARS started **********************\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: DARS factor = %g",gen->genid,GEN->darsfactor); + _unur_print_if_default(gen,AROU_SET_DARS_FACTOR); + fprintf(LOG,"\n%s:\n",gen->genid); + + fflush(LOG); +} /* end of _unur_arou_debug_dars_start() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_arou_debug_dars( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* print infor after generator has run DARS into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_AROU_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: DARS finished **********************\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + _unur_arou_debug_segments(gen); + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: DARS completed **********************\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); +} /* end of _unur_arou_debug_dars() */ + +/*****************************************************************************/ + +void +_unur_arou_debug_free( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator before destroying into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_AROU_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: GENERATOR destroyed **********************\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + _unur_arou_debug_segments(gen); + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_arou_debug_free() */ + +/*****************************************************************************/ + +void +_unur_arou_debug_segments( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write list of segments into LOGfile */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + struct unur_arou_segment *seg; + double sAin, sAout, Atotal; + int i; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_AROU_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:Segments: %d\n",gen->genid,GEN->n_segs); + if ((gen->debug & AROU_DEBUG_SEGMENTS) && GEN->seg != NULL) { + fprintf(LOG,"%s: Nr.\t left touching point\t\t intersection point\t\t tangent at left touching point\n",gen->genid); + for (seg = GEN->seg, i=0; seg->next!=NULL; seg=seg->next, i++) { + COOKIE_CHECK(seg,CK_AROU_SEG,RETURN_VOID); + fprintf(LOG,"%s:[%3d]: (%-12.6g,%-12.6g) (%-12.6g,%-12.6g) (%-12.6g,%-12.6g,%-12.6g)\n", gen->genid, i, + seg->ltp[0],seg->ltp[1], + seg->mid[0],seg->mid[1], + seg->dltp[0],seg->dltp[1],seg->dltp[2]); + } + COOKIE_CHECK(seg,CK_AROU_SEG,RETURN_VOID); + fprintf(LOG,"%s:[...]: (%-12.6g,%-12.6g)\n", gen->genid,seg->ltp[0],seg->ltp[1]); + } + fprintf(LOG,"%s:\n",gen->genid); + + if (GEN->Atotal <= 0.) { + fprintf(LOG,"%s: Construction of enveloping polygon not successful\n",gen->genid); + fprintf(LOG,"%s: Areas may be meaningless !!!!!!!!!!!!!!!!!!!!!!!!\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + Atotal = -1.; /* to avoid floating point exceptions */ + } + else { + Atotal = GEN->Atotal; + } + + /* print and sum areas inside and outside of squeeze */ + if ((gen->debug & AROU_DEBUG_SEGMENTS) && GEN->seg != NULL) { + fprintf(LOG,"%s:Areas in segments:\n",gen->genid); + fprintf(LOG,"%s: Nr.\t inside squeeze\t\t outside squeeze\t total segment\t\tcumulated\n",gen->genid); + sAin = sAout = 0.; + for (seg = GEN->seg, i=0; seg->next!=NULL; seg=seg->next, i++) { + COOKIE_CHECK(seg,CK_AROU_SEG,RETURN_VOID); + sAin += seg->Ain; + sAout += seg->Aout; + fprintf(LOG,"%s:[%3d]: %-12.6g(%6.3f%%) | %-12.6g(%6.3f%%) | %-12.6g(%6.3f%%) | %-12.6g(%6.3f%%)\n", + gen->genid,i, + seg->Ain, seg->Ain * 100. / Atotal, + seg->Aout, seg->Aout * 100. / Atotal, + seg->Ain + seg->Aout, (seg->Ain + seg->Aout) * 100. / Atotal, + seg->Acum, seg->Acum * 100. / Atotal); + } + fprintf(LOG,"%s:\t---------- --------- | ---------- --------- | ---------- --------- +\n",gen->genid); + fprintf(LOG,"%s: Sum : %-12.6g(%6.3f%%) | %-12.6g(%6.3f%%) | %-11.6g(%6.3f%%)\n", + gen->genid, + sAin, sAin * 100./Atotal, + sAout, sAout * 100./Atotal, + sAin + sAout, (sAin + sAout) * 100./Atotal); + fprintf(LOG,"%s:\n",gen->genid); + } + + /* summary of areas */ + fprintf(LOG,"%s: A(squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, + GEN->Asqueeze, GEN->Asqueeze * 100./Atotal); + fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, + GEN->Atotal - GEN->Asqueeze, (Atotal - GEN->Asqueeze) * 100./Atotal); + fprintf(LOG,"%s: A(total) = %-12.6g\n",gen->genid, Atotal); + + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_arou_debug_segments() */ + +/*****************************************************************************/ + +void +_unur_arou_debug_split_start( const struct unur_gen *gen, + const struct unur_arou_segment *seg, + double x, double fx ) + /*----------------------------------------------------------------------*/ + /* write info about splitting segment */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* seg ... pointer to segment */ + /* x ... split at this point */ + /* fx ... value of PDF at x */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_AROU_GEN,RETURN_VOID); + CHECK_NULL(seg,RETURN_VOID); COOKIE_CHECK(seg,CK_AROU_SEG,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: split segment at x = %g \t\tf(x) = %g\n",gen->genid,x,fx); + fprintf(LOG,"%s: old segment:\n",gen->genid); + + fprintf(LOG,"%s: left construction point = (%-12.6g,%-12.6g)\t x = v/u = %-12.6g\tf(x) = %-12.6g\n", + gen->genid, seg->ltp[0], seg->ltp[1], seg->ltp[0]/seg->ltp[1], sqrt(seg->ltp[1]) ); + + fprintf(LOG,"%s: intersection point = (%-12.6g,%-12.6g)\t x = v/u = %-12.6g\n", + gen->genid, seg->mid[0], seg->mid[1], seg->mid[0]/seg->mid[1]); + + fprintf(LOG,"%s: right construction point = (%-12.6g,%-12.6g)\t x = v/u = %-12.6g\tf(x) = %-12.6g\n", + gen->genid, seg->rtp[0], seg->rtp[1], seg->rtp[0]/seg->rtp[1], sqrt(seg->rtp[1]) ); + + fprintf(LOG,"%s: A(squeeze) = %-12.6g\t(%6.3f%%)\n",gen->genid, + seg->Ain, seg->Ain * 100./GEN->Atotal); + fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g\t(%6.3f%%)\n",gen->genid, + seg->Aout, seg->Aout * 100./GEN->Atotal); + fprintf(LOG,"%s: A(hat) = %-12.6g\t(%6.3f%%)\n",gen->genid, + (seg->Ain + seg->Aout), (seg->Ain +seg->Aout) * 100./GEN->Atotal); + + fflush(LOG); + +} /* end of _unur_arou_debug_split_start() */ + +/*****************************************************************************/ + +void +_unur_arou_debug_split_stop( const struct unur_gen *gen, + const struct unur_arou_segment *seg_left, + const struct unur_arou_segment *seg_right ) + /*----------------------------------------------------------------------*/ + /* write info about new splitted segments */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv_left ... pointer to new left hand segment */ + /* iv_right ... pointer to new right hand segment */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int chopped; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_AROU_GEN,RETURN_VOID); + CHECK_NULL(seg_left,RETURN_VOID); COOKIE_CHECK(seg_left,CK_AROU_SEG,RETURN_VOID); + CHECK_NULL(seg_right,RETURN_VOID); COOKIE_CHECK(seg_right,CK_AROU_SEG,RETURN_VOID); + + LOG = unur_get_stream(); + + /* whether segment was split or just chopped */ + chopped = (seg_left==seg_right) ? 1 : 0; + + if (chopped) + fprintf(LOG,"%s: new segment (chopped):\n",gen->genid); + else + fprintf(LOG,"%s: new segments:\n",gen->genid); + + fprintf(LOG,"%s: left construction point = (%-12.6g,%-12.6g)\t x = v/u = %-12.6g\tf(x) = %-12.6g\n", + gen->genid, seg_left->ltp[0], seg_left->ltp[1], seg_left->ltp[0]/seg_left->ltp[1], sqrt(seg_left->ltp[1]) ); + + fprintf(LOG,"%s: intersection point = (%-12.6g,%-12.6g)\t x = v/u = %-12.6g\n", + gen->genid, seg_left->mid[0], seg_left->mid[1], seg_left->mid[0]/seg_left->mid[1] ); + + if (chopped) { + fprintf(LOG,"%s: right construction point = (%-12.6g,%-12.6g)\t x = v/u = %-12.6g\tf(x) = %-12.6g\n", + gen->genid, seg_left->rtp[0], seg_left->rtp[1], seg_left->rtp[0]/seg_left->rtp[1], sqrt(seg_left->rtp[1]) ); + } + else { + fprintf(LOG,"%s: middle construction point = (%-12.6g,%-12.6g)\t x = v/u = %-12.6g\tf(x) = %-12.6g\n", + gen->genid, seg_left->rtp[0], seg_left->rtp[1], seg_left->rtp[0]/seg_left->rtp[1], sqrt(seg_left->rtp[1]) ); + + fprintf(LOG,"%s: intersection point = (%-12.6g,%-12.6g)\t x = v/u = %-12.6g\n", + gen->genid, seg_right->mid[0], seg_right->mid[1], seg_right->mid[0]/seg_right->mid[1] ); + + fprintf(LOG,"%s: right construction point = (%-12.6g,%-12.6g)\t x = v/u = %-12.6g\tf(x) = %-12.6g\n", + gen->genid, seg_right->rtp[0], seg_right->rtp[1], seg_right->rtp[0]/seg_right->rtp[1], sqrt(seg_right->rtp[1]) ); + } + + if (!chopped) { + fprintf(LOG,"%s: left segment:\n",gen->genid); + fprintf(LOG,"%s: A(squeeze) = %-12.6g\t(%6.3f%%)\n",gen->genid, + seg_left->Ain, seg_left->Ain * 100./GEN->Atotal); + fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g\t(%6.3f%%)\n",gen->genid, + seg_left->Aout, seg_left->Aout * 100./GEN->Atotal); + fprintf(LOG,"%s: A(hat) = %-12.6g\t(%6.3f%%)\n",gen->genid, + (seg_left->Ain + seg_left->Aout), (seg_left->Ain +seg_left->Aout) * 100./GEN->Atotal); + + fprintf(LOG,"%s: right segment:\n",gen->genid); + fprintf(LOG,"%s: A(squeeze) = %-12.6g\t(%6.3f%%)\n",gen->genid, + seg_right->Ain, seg_right->Ain * 100./GEN->Atotal); + fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g\t(%6.3f%%)\n",gen->genid, + seg_right->Aout, seg_right->Aout * 100./GEN->Atotal); + fprintf(LOG,"%s: A(hat) = %-12.6g\t(%6.3f%%)\n",gen->genid, + (seg_right->Ain + seg_right->Aout), (seg_right->Ain +seg_right->Aout) * 100./GEN->Atotal); + } + + fprintf(LOG,"%s: total areas:\n",gen->genid); + fprintf(LOG,"%s: A(squeeze) = %-12.6g\t(%6.3f%%)\n",gen->genid, + GEN->Asqueeze, GEN->Asqueeze * 100./GEN->Atotal); + fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g\t(%6.3f%%)\n",gen->genid, + GEN->Atotal - GEN->Asqueeze, (GEN->Atotal - GEN->Asqueeze) * 100./GEN->Atotal); + fprintf(LOG,"%s: A(total) = %-12.6g\n",gen->genid, GEN->Atotal); + + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_arou_debug_split_stop() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_arou_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = PDF dPDF\n"); + _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info," center = %g", unur_distr_cont_get_center(distr)); + if ( !(distr->set & UNUR_DISTR_SET_CENTER) ) { + if ( distr->set & UNUR_DISTR_SET_MODE ) + _unur_string_append(info," [= mode]\n"); + else + _unur_string_append(info," [default]\n"); + } + else { + _unur_string_append(info,"\n"); + } + + + if (help) { + if ( !(distr->set & (UNUR_DISTR_SET_CENTER | UNUR_DISTR_SET_MODE )) ) + _unur_string_append(info,"\n[ Hint: %s ]\n", + "You may provide a point near the mode as \"center\"."); + } + _unur_string_append(info,"\n"); + + /* method */ + _unur_string_append(info,"method: AROU (Automatic Ratio-Of-Uniforms)\n"); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," area(hat) = %g\n", GEN->Atotal); + + _unur_string_append(info," rejection constant "); + if (distr->set & UNUR_DISTR_SET_PDFAREA) + _unur_string_append(info,"= %g\n", GEN->Atotal/(0.5*DISTR.area)); + else + _unur_string_append(info,"<= %g\n", GEN->Atotal/GEN->Asqueeze); + + _unur_string_append(info," area ratio squeeze/hat = %g\n", + GEN->Asqueeze/GEN->Atotal); + + _unur_string_append(info," # segments = %d\n", GEN->n_segs); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + + _unur_string_append(info," max_sqhratio = %g %s\n", GEN->max_ratio, + (gen->set & AROU_SET_MAX_SQHRATIO) ? "" : "[default]"); + _unur_string_append(info," max_segments = %d %s\n", GEN->max_segs_info, + (gen->set & AROU_SET_MAX_SEGS) ? "" : "[default]"); + + if (gen->variant & AROU_VARFLAG_VERIFY) + _unur_string_append(info," verify = on\n"); + + if (gen->variant & AROU_VARFLAG_PEDANTIC) + _unur_string_append(info," pedantic = on\n"); + + /* Not displayed: + int unur_arou_set_usedars( UNUR_PAR *parameters, int usedars ); + int unur_arou_set_darsfactor( UNUR_PAR *parameters, double factor ); + int unur_arou_set_cpoints( UNUR_PAR *parameters, int n_stp, const double *stp ); + int unur_arou_set_usecenter( UNUR_PAR *parameters, int usecenter ); + int unur_arou_set_guidefactor( UNUR_PAR *parameters, double factor ); + */ + _unur_string_append(info,"\n"); + } + + /* Hints */ + if (help) { + if ( !(gen->set & AROU_SET_MAX_SQHRATIO) ) + _unur_string_append(info,"[ Hint: %s ]\n", + "You can set \"max_sqhratio\" closer to 1 to decrease rejection constant." ); + if (GEN->Asqueeze/GEN->Atotal < GEN->max_ratio) + _unur_string_append(info,"[ Hint: %s ]\n", + "You should increase \"max_segments\" to obtain the desired rejection constant." ); + _unur_string_append(info,"\n"); + } + +} /* end of _unur_arou_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/arou.h b/vendor/unuran-1.11.0/src/methods/arou.h new file mode 100644 index 0000000..3df43d1 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/arou.h @@ -0,0 +1,245 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: arou.h * + * * + * PURPOSE: * + * function prototypes for method AROU * + * (Adaptive Ratio-Of-Uniforms) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD AROU Automatic Ratio-Of-Uniforms method + + =UP Methods_for_CONT + + =REQUIRED T-concave PDF, dPDF + + =OPTIONAL mode + + =SPEED Set-up: slow, Sampling: fast + + =REINIT not implemented + + =REF [LJa00] + + =DESCRIPTION + AROU is a variant of the ratio-of-uniforms method that uses the + fact that the transformed region is convex for many distributions. + It works for all T-concave distributions with T(x) = -1/sqrt(x). + + It is possible to use this method for correlation induction by + setting an auxiliary uniform random number generator via the + unur_set_urng_aux() call. (Notice that this must be done after a + possible unur_set_urng() call.) + When an auxiliary generator is used then the number of used + uniform random numbers that is used up for one generated random + variate is constant and equal to 1. + + There exists a test mode that verifies whether the conditions for + the method are satisfied or not while sampling. It can be + switched on by calling unur_arou_set_verify() and + unur_arou_chg_verify(), respectively. + Notice however that sampling is (much) slower then. + + For densities with modes not close to 0 it is suggested to set + either the mode or the center of the distribution by the + unur_distr_cont_set_mode() or unur_distr_cont_set_center() call. + The latter is the approximate location of the mode or the mean + of the distribution. This location provides some information + about the main part of the PDF and is used to avoid numerical + problems. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_arou_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_arou_set_usedars( UNUR_PAR *parameters, int usedars ); +/* + If @var{usedars} is set to TRUE, ``derandomized adaptive rejection + sampling'' (DARS) is used in setup. + Segments where the area between hat and squeeze is too + large compared to the average area between hat and squeeze + over all intervals are split. + This procedure is repeated until the ratio between area below squeeze + and area below hat exceeds the bound given by + unur_arou_set_max_sqhratio() call or the maximum number of segments is + reached. Moreover, it also aborts when no more segments can be + found for splitting. + + Segments are split such that the angle of the segments are halved + (corresponds to arc-mean rule of method TDR (@pxref{TDR})). + + Default is TRUE. +*/ + +int unur_arou_set_darsfactor( UNUR_PAR *parameters, double factor ); +/* + Set factor for ``derandomized adaptive rejection sampling''. + This factor is used to determine the segments that are ``too + large'', that is, all segments where the area between squeeze and + hat is larger than @var{factor} times the average area over all + intervals between squeeze and hat. + Notice that all segments are split when @var{factor} is set to + @code{0.}, and that there is no splitting at all when @var{factor} + is set to @code{UNUR_INFINITY}. + + Default is @code{0.99}. There is no need to change this parameter. +*/ + +int unur_arou_set_max_sqhratio( UNUR_PAR *parameters, double max_ratio ); +/* + Set upper bound for the + ratio (area inside squeeze) / (area inside envelope). + It must be a number between 0 and 1. + When the ratio exceeds the given number no further construction + points are inserted via adaptive rejection sampling. + Use @code{0} if no construction points should be added after the + setup. + Use @code{1} if adding new construction points should not be + stopped until the maximum number of construction points is reached. + + Default is @code{0.99}. +*/ + +double unur_arou_get_sqhratio( const UNUR_GEN *generator ); +/* + Get the current ratio (area inside squeeze) / (area inside envelope) + for the generator. + (In case of an error @code{UNUR_INFINITY} is returned.) +*/ + +double unur_arou_get_hatarea( const UNUR_GEN *generator ); +/* + Get the area below the hat for the generator. + (In case of an error @code{UNUR_INFINITY} is returned.) +*/ + +double unur_arou_get_squeezearea( const UNUR_GEN *generator ); +/* + Get the area below the squeeze for the generator. + (In case of an error @code{UNUR_INFINITY} is returned.) +*/ + + +int unur_arou_set_max_segments( UNUR_PAR *parameters, int max_segs ); +/* + Set maximum number of segements. + No construction points are added @emph{after} the setup when the + number of segments succeeds @var{max_segs}. + + Default is @code{100}. +*/ + + +int unur_arou_set_cpoints( UNUR_PAR *parameters, int n_stp, const double *stp ); +/* + Set construction points for enveloping polygon. + If @var{stp} is NULL, then a heuristical rule of thumb is used to + get @var{n_stp} construction points. + This is the default behavior when this routine is not called. + The (default) number of construction points is @code{30}, then. +*/ + + +int unur_arou_set_usecenter( UNUR_PAR *parameters, int usecenter ); +/* + Use the center as construction point. + Default is TRUE. +*/ + + +int unur_arou_set_guidefactor( UNUR_PAR *parameters, double factor ); +/* + Set factor for relative size of the guide table for indexed search + (see also method DGT @ref{DGT}). It must be greater than or equal + to @code{0}. + When set to @code{0}, then sequential search is used. + + Default is @code{2}. +*/ + + +int unur_arou_set_verify( UNUR_PAR *parameters, int verify ); +/* */ + +int unur_arou_chg_verify( UNUR_GEN *generator, int verify ); +/* + Turn verifying of algorithm while sampling on/off. + If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is + violated for some @i{x} then @code{unur_errno} is set to + @code{UNUR_ERR_GEN_CONDITION}. However notice that this might + happen due to round-off errors for a few values of + @i{x} (less than 1%). + + Default is FALSE. +*/ + + +int unur_arou_set_pedantic( UNUR_PAR *parameters, int pedantic ); +/* + Sometimes it might happen that unur_init() has been executed + successfully. But when additional construction points are added by + adaptive rejection sampling, the algorithm detects that the + PDF is not T-concave. + + With @var{pedantic} being TRUE, the + sampling routine is then exchanged by a routine that simply returns + @code{UNUR_INFINITY}. Otherwise the new point is not added to the + list of construction points. At least the hat function remains + T-concave. + + Setting @var{pedantic} to FALSE allows sampling from a + distribution which is ``almost'' T-concave and small errors are + tolerated. However it might happen that the hat function cannot be + improved significantly. When the hat function that has been + constructed by the unur_init() call is extremely large then it + might happen that the generation times are extremely high + (even hours are possible in extremely rare cases). + + Default is FALSE. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ + + + diff --git a/vendor/unuran-1.11.0/src/methods/arou_struct.h b/vendor/unuran-1.11.0/src/methods/arou_struct.h new file mode 100644 index 0000000..2b4f4b5 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/arou_struct.h @@ -0,0 +1,96 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: arou_struct.h * + * * + * PURPOSE: * + * declares structures for method AROU * + * (Adaptive Ratio-Of-Uniforms) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_arou_par { + + double guide_factor; /* relative size of guide table */ + double bound_for_adding; /* lower bound for relative area */ + double max_ratio; /* limit for ratio r_n = |P^s| / |P^e| */ + int n_starting_cpoints; /* number of construction points at start */ + const double *starting_cpoints; /* pointer to array of starting points */ + int max_segs; /* maximum number of segments */ + double darsfactor; /* factor for (derandomized) ARS */ +}; + +/*---------------------------------------------------------------------------*/ +/* store data for segments */ + +struct unur_arou_segment { + double Acum; /* cumulated sum of areas */ + double Ain; /* area of segment inside of squeeze */ + double Aout; /* area of segment outside of squeeze */ + + double ltp[2]; /* coordinates of left tp point in segment */ + double dltp[3]; /* tanget line of region at left touching point: + dltp[0]*u + dltp[1]*v == dltp[2] */ + double mid[2]; /* coordinates of middle (outer) vertex of segment */ + double *rtp; /* pointer to coordinates of right tp in segment + (stored in next segment) */ + double *drtp; /* pointer to tangent line at right tp */ + + struct unur_arou_segment *next; /* pointer to next segment in list */ + +#ifdef UNUR_COOKIES + unsigned cookie; /* magic cookie */ +#endif +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_arou_gen { + + double Atotal; /* area of enveloping polygon */ + double Asqueeze; /* area of squeeze polygon */ + + double max_ratio; /* limit for ratio r_n = |P^s| / |P^e| */ + + struct unur_arou_segment **guide; /* pointer to guide table */ + int guide_size; /* size of guide table */ + double guide_factor; /* relative size of guide table */ + + struct unur_arou_segment *seg; /* pointer to linked list of segments */ + int n_segs; /* number of construction points */ + int max_segs; /* maximum number of segments */ + double darsfactor; /* factor for (derandomized) ARS */ + double center; /* (approximate) location of mode */ +#ifdef UNUR_ENABLE_INFO + int max_segs_info; /* maximum number of segments (as given) */ +#endif +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/ars.c b/vendor/unuran-1.11.0/src/methods/ars.c new file mode 100644 index 0000000..91d2686 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/ars.c @@ -0,0 +1,2885 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: ars.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: adaptive rejection sampling (Gilks & Wild) * + * * + * DESCRIPTION: * + * Given logPDF of a log-concave distribution * + * produce a value x consistent with its density * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES and DESCRIPTION: * + * * + * This is special implementation of the TDR method that requires the * + * logPDF of a distribution and uses solely adaptive rejection sampling * + * for finding constrution points as proposed by Gilks & Wild (1992). * + * * + * See tdr.c for further information. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Store intersection point in structure when defined. */ + +#ifdef DEBUG_STORE_IP +# undef DEBUG_STORE_IP +#endif + +/* #define DEBUG_STORE_IP 1 */ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "ars.h" +#include "ars_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Constants */ + +/*---------------------------------------------------------------------------*/ +/* Variants */ + +#define ARS_VARFLAG_VERIFY 0x0100u /* flag for verifying mode */ +#define ARS_VARFLAG_PEDANTIC 0x0800u /* whether pedantic checking is used */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define ARS_DEBUG_REINIT 0x00000002u /* print parameters after reinit */ +#define ARS_DEBUG_IV 0x00000010u +#define ARS_DEBUG_SPLIT 0x00010000u + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define ARS_SET_CPOINTS 0x001u +#define ARS_SET_N_CPOINTS 0x002u +#define ARS_SET_PERCENTILES 0x004u +#define ARS_SET_N_PERCENTILES 0x008u +#define ARS_SET_RETRY_NCPOINTS 0x010u +#define ARS_SET_MAX_IVS 0x020u +#define ARS_SET_MAX_ITER 0x040u /* maximum number of iterations */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "ARS" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_ars_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_ars_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_ars_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_ars_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_ars_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_ars_sample( struct unur_gen *generator ); +static double _unur_ars_sample_check( struct unur_gen *generator ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static int _unur_ars_starting_cpoints( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* create list of construction points for starting segments. */ +/* if user has not provided such points compute these by means of the */ +/* "equi-angle rule". */ +/*---------------------------------------------------------------------------*/ + +static int _unur_ars_starting_intervals( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* compute intervals from given starting construction points. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_ars_interval_parameter( struct unur_gen *gen, struct unur_ars_interval *iv ); +/*---------------------------------------------------------------------------*/ +/* compute all necessary data for interval. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_ars_interval *_unur_ars_interval_new( struct unur_gen *gen, + double x, double logfx ); +/*---------------------------------------------------------------------------*/ +/* make a new interval with left construction point x. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_ars_tangent_intersection_point( struct unur_gen *gen, + struct unur_ars_interval *iv, double *ipt ); +/*---------------------------------------------------------------------------*/ +/* compute cutting point of interval into left and right part. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_ars_interval_logarea( struct unur_gen *gen, struct unur_ars_interval *iv, + double slope, double x ); +/*---------------------------------------------------------------------------*/ +/* compute log of area below piece of hat or squeeze in interval. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_ars_interval_split( struct unur_gen *gen, + struct unur_ars_interval *iv_old, double x, double logfx ); +/*---------------------------------------------------------------------------*/ +/* split am interval point x. return 0 if not successful. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_ars_improve_hat( struct unur_gen *gen, struct unur_ars_interval *iv, + double x, double logfx); +/*---------------------------------------------------------------------------*/ +/* improve hat function by splitting interval */ +/*---------------------------------------------------------------------------*/ + +static int _unur_ars_make_area_table( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* make table of areas and compute largest area for rescaling. */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_ars_debug_init_start( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after (almost empty generator) object has been created. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_ars_debug_init_finished( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_ars_debug_reinit_start( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print before reinitialization of generator starts. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_ars_debug_reinit_retry( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print before second trial of reinitialization of generator starts. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_ars_debug_reinit_finished( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been reinitialized. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_ars_debug_free( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print before generater is destroyed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_ars_debug_intervals( const struct unur_gen *gen, const char *header, int print_areas ); +/*---------------------------------------------------------------------------*/ +/* print data for intervals */ +/*---------------------------------------------------------------------------*/ + +static void _unur_ars_debug_split_start( const struct unur_gen *gen, + const struct unur_ars_interval *iv, + double x, double logfx ); +static void _unur_ars_debug_split_stop( const struct unur_gen *gen, + const struct unur_ars_interval *iv_left, + const struct unur_ars_interval *iv_right ); +/*---------------------------------------------------------------------------*/ +/* print before and after an interval has been split (not / successfully). */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_ars_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cont /* data for distribution object */ + +#define PAR ((struct unur_ars_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_ars_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define BD_LEFT domain[0] /* left boundary of domain of distribution */ +#define BD_RIGHT domain[1] /* right boundary of domain of distribution */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +#define logPDF(x) _unur_cont_logPDF((x),(gen->distr)) /* call to logPDF */ +#define dlogPDF(x) _unur_cont_dlogPDF((x),(gen->distr)) /* call to derivative of log PDF */ + +/* areas in intervaled relative to maximal area */ +#define scaled_logarea(iv) ((iv)->logAhat - GEN->logAmax) +#define scaled_area(iv) (exp(scaled_logarea(iv))) + +/* log of function rescaled relative to maximal area */ +#define rescaled_logf(logf) ((logf) - GEN->logAmax) + +/*---------------------------------------------------------------------------*/ + +#define _unur_ars_getSAMPLE(gen) \ + ( ((gen)->variant & ARS_VARFLAG_VERIFY) \ + ? _unur_ars_sample_check : _unur_ars_sample ) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_ars_new( const struct unur_distr* distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + + if (DISTR_IN.logpdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"logPDF"); return NULL; } + if (DISTR_IN.dlogpdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"derivative of logPDF"); return NULL; } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_ars_par) ); + COOKIE_SET(par,CK_ARS_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->starting_cpoints = NULL; /* pointer to array of starting points */ + PAR->n_starting_cpoints = 2; /* number of starting points */ + PAR->percentiles = NULL; /* pointer to array of percentiles */ + PAR->n_percentiles = 2; /* number of percentiles */ + PAR->retry_ncpoints = 30; /* number of cpoints for second trial of reinit */ + PAR->max_ivs = 200; /* maximum number of intervals */ + PAR->max_iter = 10000; /* maximum number of iterations */ + + par->method = UNUR_METH_ARS; /* method */ + par->variant = 0u; /* default variant */ + + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default URNG */ + par->urng_aux = par->urng; /* no special auxilliary URNG */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_ars_init; + + return par; + +} /* end of unur_ars_new() */ + +/*****************************************************************************/ + +int +unur_ars_set_max_intervals( struct unur_par *par, int max_ivs ) + /*----------------------------------------------------------------------*/ + /* set maximum number of intervals */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* max_ivs ... maximum number of intervals */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, ARS ); + + /* check new parameter for generator */ + if (max_ivs < 1 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"maximum number of intervals < 1"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->max_ivs = max_ivs; + + /* changelog */ + par->set |= ARS_SET_MAX_IVS; + + return UNUR_SUCCESS; + +} /* end of unur_ars_set_max_intervals() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ars_set_cpoints( struct unur_par *par, int n_cpoints, const double *cpoints ) + /*----------------------------------------------------------------------*/ + /* set construction points for hat function */ + /* and/or its number for initialization */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* n_cpoints ... number of starting construction points */ + /* cpoints ... pointer to array of starting construction points */ + /* (NULL for changing only the number of default points)*/ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, ARS ); + + /* check starting construction points */ + if (n_cpoints < 2 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of starting points < 2. using defaults"); + n_cpoints = 2; + cpoints = NULL; + } + + if (cpoints) + /* starting points must be strictly monontonically increasing */ + for( i=1; istarting_cpoints = cpoints; + PAR->n_starting_cpoints = n_cpoints; + + /* changelog */ + par->set |= ARS_SET_N_CPOINTS | ((cpoints) ? ARS_SET_CPOINTS : 0); + + return UNUR_SUCCESS; + +} /* end of unur_ars_set_cpoints() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ars_set_reinit_percentiles( struct unur_par *par, int n_percentiles, const double *percentiles ) + /*----------------------------------------------------------------------*/ + /* set percentiles for construction points for hat function */ + /* and/or its number for re-initialization */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator */ + /* n_percentiles ... number of percentiles */ + /* percentiles ... pointer to array of percentiles */ + /* (NULL for using a rule of thumb) */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, ARS ); + + /* check given percentiles */ + if (n_percentiles < 2 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of percentiles < 2. using defaults"); + n_percentiles = 2; + percentiles = NULL; + } + + if (n_percentiles > 100 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of percentiles > 100. using 100"); + n_percentiles = 100; + } + + if (percentiles) { + /* percentiles must be strictly monontonically increasing */ + for( i=1; i 0.99) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"percentiles out of range"); + return UNUR_ERR_PAR_SET; + } + } + } + + /* store date */ + PAR->percentiles = percentiles; + PAR->n_percentiles = n_percentiles; + + /* changelog */ + par->set |= ARS_SET_N_PERCENTILES | ((percentiles) ? ARS_SET_PERCENTILES : 0); + + return UNUR_SUCCESS; + +} /* end of unur_ars_set_reinit_percentiles() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ars_chg_reinit_percentiles( struct unur_gen *gen, int n_percentiles, const double *percentiles ) + /*----------------------------------------------------------------------*/ + /* change percentiles for construction points for hat function */ + /* and/or its number for re-initialization */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* n_percentiles ... number of percentiles */ + /* percentiles ... pointer to array of percentiles */ + /* (NULL for using a rule of thumb) */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, ARS, UNUR_ERR_GEN_INVALID ); + + /* check given percentiles */ + if (n_percentiles < 2 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of percentiles < 2. using defaults"); + n_percentiles = 2; + percentiles = NULL; + } + + if (n_percentiles > 100 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of percentiles > 100. using 100"); + n_percentiles = 100; + } + + if (percentiles) { + /* percentiles must be strictly monontonically increasing */ + for( i=1; i 0.99) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"percentiles out of range"); + return UNUR_ERR_PAR_SET; + } + } + } + + /* store date */ + GEN->n_percentiles = n_percentiles; + GEN->percentiles = _unur_xrealloc( GEN->percentiles, n_percentiles * sizeof(double) ); + if (percentiles) { + memcpy( GEN->percentiles, percentiles, n_percentiles * sizeof(double) ); + } + else { + if (n_percentiles == 2) { + GEN->percentiles[0] = 0.25; + GEN->percentiles[1] = 0.75; + } + else { + for (i=0; ipercentiles[i] = (i + 1.) / (n_percentiles + 1.); + } + } + + /* changelog */ + gen->set |= ARS_SET_N_PERCENTILES | ((percentiles) ? ARS_SET_PERCENTILES : 0); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_ars_chg_reinit_percentiles() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ars_set_reinit_ncpoints( struct unur_par *par, int ncpoints ) + /*----------------------------------------------------------------------*/ + /* set number of construction points for second trial of reinit */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator */ + /* ncpoints ... number of construction points */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, ARS ); + + /* check number */ + if (ncpoints < 10 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of construction points < 10"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->retry_ncpoints = ncpoints; + + /* changelog */ + par->set |= ARS_SET_RETRY_NCPOINTS; + + return UNUR_SUCCESS; + +} /* end of unur_ars_set_reinit_ncpoints() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ars_chg_reinit_ncpoints( struct unur_gen *gen, int ncpoints ) + /*----------------------------------------------------------------------*/ + /* change number of construction points for second trial of reinit */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* ncpoints ... number of construction points */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, ARS, UNUR_ERR_GEN_INVALID ); + + /* check number */ + if (ncpoints < 10 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of construction points < 10"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + GEN->retry_ncpoints = ncpoints; + + /* changelog */ + gen->set |= ARS_SET_RETRY_NCPOINTS; + + return UNUR_SUCCESS; + +} /* end of unur_ars_chg_reinit_ncpoints() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ars_set_max_iter( struct unur_par *par, int max_iter ) + /*----------------------------------------------------------------------*/ + /* set maximum number of iterations */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* max_iter ... maximum number of iterations */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, ARS ); + + /* check new parameter for generator */ + if (max_iter < 1) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"maximum number of iterations"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->max_iter = max_iter; + + /* changelog */ + par->set |= ARS_SET_MAX_ITER; + + return UNUR_SUCCESS; + +} /* end of unur_ars_set_max_iter() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ars_set_verify( struct unur_par *par, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, ARS ); + + /* we use a bit in variant */ + par->variant = (verify) ? (par->variant | ARS_VARFLAG_VERIFY) : (par->variant & (~ARS_VARFLAG_VERIFY)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_ars_set_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ars_chg_verify( struct unur_gen *gen, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, ARS, UNUR_ERR_GEN_INVALID ); + + /* we must not change this switch when sampling has been disabled by + using a pointer to the error producing routine */ + if (SAMPLE == _unur_sample_cont_error) + return UNUR_FAILURE; + + /* we use a bit in variant */ + gen->variant = (verify) + ? (gen->variant | ARS_VARFLAG_VERIFY) + : (gen->variant & (~ARS_VARFLAG_VERIFY)); + + /* sampling routines */ + SAMPLE = _unur_ars_getSAMPLE(gen); + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_ars_chg_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ars_set_pedantic( struct unur_par *par, int pedantic ) + /*----------------------------------------------------------------------*/ + /* turn pedantic mode on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* pedantic ... 0 = no pedantic mode, !0 = use pedantic mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* pedantic is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, ARS ); + + /* we use a bit in variant */ + par->variant = (pedantic) ? (par->variant | ARS_VARFLAG_PEDANTIC) : (par->variant & (~ARS_VARFLAG_PEDANTIC)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_ars_set_pedantic() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_ars_get_loghatarea( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get log of area below hat */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* area ... on success */ + /* UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + _unur_check_gen_object( gen, ARS, UNUR_INFINITY ); + + return log(GEN->Atotal) + GEN->logAmax; + +} /* end of unur_ars_get_loghatarea() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_ars_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; +/* int i,k; */ + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_ARS ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_ARS_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_ars_create(par); + _unur_par_free(par); + if (!gen) return NULL; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_ars_debug_init_start(gen); +#endif + + /* get starting points */ + if (_unur_ars_starting_cpoints(gen)!=UNUR_SUCCESS) { + _unur_ars_free(gen); return NULL; + } + + /* compute intervals for given starting points */ + if (_unur_ars_starting_intervals(gen)!=UNUR_SUCCESS) { + _unur_ars_free(gen); return NULL; + } + + /* update maximal number of intervals */ + if (GEN->n_ivs > GEN->max_ivs) { + GEN->max_ivs = GEN->n_ivs; + } + + /* make initial table of areas */ + _unur_ars_make_area_table(gen); + + /* is there any hat at all ? */ + if (GEN->Atotal <= 0. || !_unur_isfinite(GEN->Atotal)) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"bad construction points."); + _unur_ars_free(gen); + return NULL; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_ars_debug_init_finished(gen); +#endif + + /* creation of generator object successfull */ + gen->status = UNUR_SUCCESS; + + /* o.k. */ + return gen; + +} /* end of _unur_ars_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_ars_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_ars_interval *iv,*next; + double *bak_cpoints; + int bak_n_cpoints; + int i; + int n_trials; + + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, ARS, UNUR_ERR_GEN_INVALID ); + + /* first trial */ + n_trials = 1; + + /* which construction points should be used ? */ + if (gen->set & ARS_SET_N_PERCENTILES) { + if (GEN->starting_cpoints==NULL || (GEN->n_starting_cpoints != GEN->n_percentiles)) { + GEN->n_starting_cpoints = GEN->n_percentiles; + GEN->starting_cpoints = _unur_xrealloc( GEN->starting_cpoints, GEN->n_percentiles * sizeof(double)); + } + for (i=0; in_percentiles; i++) { + GEN->starting_cpoints[i] = unur_ars_eval_invcdfhat( gen, GEN->percentiles[i] ); + if (!_unur_isfinite(GEN->starting_cpoints[i])) + /* we cannot use these starting points --> skip to second trial immediately */ + n_trials = 2; + } + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & ARS_DEBUG_REINIT) + _unur_ars_debug_reinit_start(gen); +#endif + + /* make backup of cpoints */ + bak_n_cpoints = GEN->n_starting_cpoints; + bak_cpoints = GEN->starting_cpoints; + + for (;; ++n_trials) { + /* free linked list of intervals */ + for (iv = GEN->iv; iv != NULL; iv = next) { + next = iv->next; + free(iv); + } + GEN->iv = NULL; + GEN->n_ivs = 0; + GEN->Atotal = 0.; + GEN->logAmax = 0.; + + if (n_trials > 2) { + /* we have done our best */ + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"bad construction points for reinit"); + GEN->n_starting_cpoints = bak_n_cpoints; + GEN->starting_cpoints = bak_cpoints; + return UNUR_FAILURE; + } + + if (n_trials > 1) { + /* second trial */ + GEN->n_starting_cpoints = GEN->retry_ncpoints; + GEN->starting_cpoints = NULL; +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & ARS_DEBUG_REINIT) + _unur_ars_debug_reinit_retry(gen); +#endif + } + + /* get starting points */ + if (_unur_ars_starting_cpoints(gen)!=UNUR_SUCCESS) + continue; + + /* compute intervals for given starting points */ + if (_unur_ars_starting_intervals(gen)!=UNUR_SUCCESS) + continue; + + /* update maximal number of intervals */ + if (GEN->n_ivs > GEN->max_ivs) + GEN->max_ivs = GEN->n_ivs; + + /* make table of areas */ + _unur_ars_make_area_table(gen); + + /* is there any hat at all ? */ + if (GEN->Atotal <= 0.) + continue; + + /* reinit successful */ + break; + + } + + /* clean up */ + if (n_trials > 1) { + GEN->n_starting_cpoints = bak_n_cpoints; + GEN->starting_cpoints = bak_cpoints; + } + + /* (re)set sampling routine */ + SAMPLE = _unur_ars_getSAMPLE(gen); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & ARS_DEBUG_REINIT) + _unur_ars_debug_reinit_finished(gen); +#endif + + return UNUR_SUCCESS; +} /* end of _unur_ars_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_ars_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_ARS_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_ars_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_ARS_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_ars_getSAMPLE(gen); + gen->destroy = _unur_ars_free; + gen->clone = _unur_ars_clone; + gen->reinit = _unur_ars_reinit; + + /* set all pointers to NULL */ + GEN->iv = NULL; + GEN->n_ivs = 0; + GEN->percentiles = NULL; + GEN->Atotal = 0.; + GEN->logAmax = 0.; + + /* copy starting points */ + GEN->n_starting_cpoints = PAR->n_starting_cpoints; + if (PAR->starting_cpoints) { + GEN->starting_cpoints = _unur_xmalloc( PAR->n_starting_cpoints * sizeof(double) ); + memcpy( GEN->starting_cpoints, PAR->starting_cpoints, PAR->n_starting_cpoints * sizeof(double) ); + } + else { + GEN->starting_cpoints = NULL; + } + + /* copy percentiles */ + if (gen->set & ARS_SET_N_PERCENTILES) + unur_ars_chg_reinit_percentiles( gen, PAR->n_percentiles, PAR->percentiles ); + + /* copy all other parameters */ + GEN->retry_ncpoints = PAR->retry_ncpoints; /* number of cpoints for second trial of reinit */ + + /* bounds for adding construction points */ + GEN->max_ivs = _unur_max(2*PAR->n_starting_cpoints,PAR->max_ivs); /* maximum number of intervals */ + + /* bound for number of repetitions of rejection loop */ + GEN->max_iter = PAR->max_iter; + + /* copy variant */ + gen->variant = par->variant; + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_ars_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_ars_create() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_ars_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_ars_gen*)clone->datap) + + struct unur_gen *clone; + struct unur_ars_interval *iv, *clone_iv, *clone_prev; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_ARS_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* copy linked list of intervals */ + clone_iv = NULL; + clone_prev = NULL; + for (iv = GEN->iv; iv != NULL; iv = iv->next) { + /* copy segment */ + clone_iv = _unur_xmalloc( sizeof(struct unur_ars_interval) ); + memcpy( clone_iv, iv, sizeof(struct unur_ars_interval) ); + if (clone_prev == NULL) { + /* starting point of linked list */ + CLONE->iv = clone_iv; + } + else { + /* insert into linked list */ + clone_prev->next = clone_iv; + } + /* next step */ + clone_prev = clone_iv; + } + /* terminate linked list */ + if (clone_iv) clone_iv->next = NULL; + + /* copy starting points */ + if (GEN->starting_cpoints) { + CLONE->starting_cpoints = _unur_xmalloc( GEN->n_starting_cpoints * sizeof(double) ); + memcpy( CLONE->starting_cpoints, GEN->starting_cpoints, GEN->n_starting_cpoints * sizeof(double) ); + } + + /* copy percentiles */ + if (GEN->percentiles) { + CLONE->percentiles = _unur_xmalloc( GEN->n_percentiles * sizeof(double) ); + memcpy( CLONE->percentiles, GEN->percentiles, GEN->n_percentiles * sizeof(double) ); + } + + /* finished clone */ + return clone; + +#undef CLONE +} /* end of _unur_ars_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_ars_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_ARS ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_ars_debug_free(gen); +#endif + + /* free linked list of intervals */ + { + struct unur_ars_interval *iv,*next; + for (iv = GEN->iv; iv != NULL; iv = next) { + next = iv->next; + free(iv); + } + } + + /* free list of starting points */ + if (GEN->starting_cpoints) + free (GEN->starting_cpoints); + + /* free list of percentiles */ + if (GEN->percentiles) + free (GEN->percentiles); + + /* free other memory not stored in list */ + _unur_generic_free(gen); + +} /* end of _unur_ars_free() */ + +/*****************************************************************************/ + +double +_unur_ars_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator (original variant by Gilks & Wild) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /* */ + /*======================================================================*/ + /* comment: */ + /* x ... random point */ + /* x0 ... left construction point in interval */ + /* x1 ... right construction point in interval */ + /* f ... PDF */ + /* Tf ... transformed PDF */ + /* dTf ... derivative of transformed PDF */ + /* sq ... slope of squeeze in interval */ + /* */ + /*----------------------------------------------------------------------*/ + /* if (Tf)'(x0) == 0: */ + /* X = x0 + U / f(x0) */ + /* U ~ U(0,area below hat) */ + /* */ + /* squeeze(x) = f(x0) * exp(sq * (x-x0)) */ + /* */ + /* left hat(x) = f(x0) * exp( (Tf)'(x0) * (x-x0) ) */ + /* generation: */ + /* X = x0 + 1/(Tf)'(x0) * \log( (Tf)'(x0)/f(x0) * U + 1 ) */ + /* U ~ U(0,area below left hat) */ + /* */ + /* right hat(x) = f(x1) * exp( (Tf)'(x1) * (x-x1) ) */ + /* generation: */ + /* X = x1 + 1/(Tf)'(x1) * \log( (Tf)'(x1)/f(x1) * U + 1 ) */ + /* U ~ U(- area below right hat,0) */ + /*----------------------------------------------------------------------*/ +{ + struct unur_ars_interval *iv, *cp; + double U, logV; /* (log of) uniform random number */ + double X; /* generated point */ + double logfx, logsqx, loghx; /* log of density, squeeze, and hat at X */ + double x0, logfx0, dlogfx0, fx0; /* construction point and logPDF at x0 */ + int n_trials; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_ARS_GEN,UNUR_INFINITY); + + if (GEN->iv == NULL) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"empty generator object"); + return UNUR_INFINITY; + } + + for (n_trials=0; n_trialsmax_iter; ++n_trials) { + + /* sample from U(0,1) */ + U = _unur_call_urng(gen->urng); + + /* evaluate inverse of hat CDF */ + + /* find interval by sequential search */ + /* Remark: there is no need for a guide table as we only generate one point! */ + iv = GEN->iv; + U *= GEN->Atotal; + while (iv->Acum < U) { + iv = iv->next; + } + + /* reuse of uniform random number */ + U -= iv->Acum; /* result: U in (-A_hat, 0) */ + + /* l.h.s. or r.h.s. of hat */ + if (-U < (scaled_area(iv) * iv->Ahatr_fract)) { /* right */ + cp = iv->next; + /* U unchanged */ + } + else { /* left */ + cp = iv; + U += scaled_area(iv); + } + + /* PDF at x0 */ + x0 = cp->x; + logfx0 = cp->logfx; + dlogfx0 = cp->dlogfx; + fx0 = exp(rescaled_logf(logfx0)); + + /* random variate */ + if (_unur_iszero(dlogfx0)) + X = x0 + U / fx0; + else { + double t = dlogfx0 * U / fx0; + if (fabs(t) > 1.e-6) + X = x0 + log(t + 1.) * U / (fx0 * t); + /* x = x0 + log(t + 1.) / dlogfx0; is cheaper but numerical unstable */ + else if (fabs(t) > 1.e-8) + /* use Taylor series */ + X = x0 + U / fx0 * (1 - t/2. + t*t/3.); + else + X = x0 + U / fx0 * (1 - t/2.); + } + + /* log of hat at x */ + loghx = rescaled_logf(logfx0) + dlogfx0*(X - x0); + + /* log of a random point between 0 and hat at x */ + logV = log(_unur_call_urng(gen->urng)) + loghx; + + /* log of spueeze at x */ + logsqx = rescaled_logf(iv->logfx) + iv->sq*(X - iv->x); + + /* below squeeze ? */ + if (logV <= logsqx) + return X; + + /* log of PDF at x */ + logfx = logPDF(X); + + /* below PDF ? */ + if (logV <= rescaled_logf(logfx)) + return X; + + /* being above PDF is bad. improve the situation! */ + if (GEN->n_ivs < GEN->max_ivs) { + /* first check for valid values of X and logf(X) */ + if (! (_unur_isfinite(X) && _unur_isfinite(logfx)) ) { + X = _unur_arcmean(iv->x,iv->next->x); /* use mean point in interval */ + logfx = logPDF(X); + } + if ( (_unur_ars_improve_hat( gen, iv, X, logfx) != UNUR_SUCCESS) + && (gen->variant & ARS_VARFLAG_PEDANTIC) ) + return UNUR_INFINITY; + } + + /* else reject and try again */ + + } + + /* number of trials exceeded */ + _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING,"max number of iterations exceeded"); + return UNUR_INFINITY; + +} /* end of _unur_ars_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_ars_sample_check( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator and verify results */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + struct unur_ars_interval *iv, *cp; + double U, logV; /* (log of) uniform random number */ + double X; /* generated point */ + double logfx, logsqx, loghx; /* log of density, squeeze, and hat at X */ + double x0, logfx0, dlogfx0, fx0; /* construction point and logPDF at x0 */ + int n_trials; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_ARS_GEN,UNUR_INFINITY); + + if (GEN->iv == NULL) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"empty generator object"); + return UNUR_INFINITY; + } + + for (n_trials=0; n_trialsmax_iter; ++n_trials) { + + /* sample from U(0,1) */ + U = _unur_call_urng(gen->urng); + + /* evaluate inverse of hat CDF */ + + /* find interval by sequential search */ + /* Remark: there is no need for a guide table as we only generate one point! */ + iv = GEN->iv; + U *= GEN->Atotal; + while (iv->Acum < U) { + iv = iv->next; + } + + /* reuse of uniform random number */ + U -= iv->Acum; /* result: U in (-A_hat, 0) */ + + /* l.h.s. or r.h.s. of hat */ + if (-U < (scaled_area(iv) * iv->Ahatr_fract)) { /* right */ + cp = iv->next; + /* U unchanged */ + } + else { /* left */ + cp = iv; + U += scaled_area(iv); + } + + /* PDF at x0 */ + x0 = cp->x; + logfx0 = cp->logfx; + dlogfx0 = cp->dlogfx; + fx0 = exp(rescaled_logf(logfx0)); + + /* random variate */ + if (_unur_iszero(dlogfx0)) + X = x0 + U / fx0; + else { + double t = dlogfx0 * U / fx0; + if (fabs(t) > 1.e-6) + X = x0 + log(t + 1.) * U / (fx0 * t); + /* x = x0 + log(t + 1.) / dlogfx0; is cheaper but numerical unstable */ + else if (fabs(t) > 1.e-8) + /* use Taylor series */ + X = x0 + U / fx0 * (1 - t/2. + t*t/3.); + else + X = x0 + U / fx0 * (1 - t/2.); + } + + /* log of hat at x */ + loghx = rescaled_logf(logfx0) + dlogfx0*(X - x0); + + /* log of spueeze at x */ + logsqx = rescaled_logf(iv->logfx) + iv->sq*(X - iv->x); + + /* log of PDF at x */ + logfx = logPDF(X); + + /* check result */ + if (X < DISTR.BD_LEFT || X > DISTR.BD_RIGHT) { + _unur_warning(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,"generated point out of domain"); + } + if (_unur_FP_greater(rescaled_logf(logfx), loghx)) { + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF > hat. Not log-concave!"); + } + if (_unur_FP_less(rescaled_logf(logfx), logsqx)) { + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF < squeeze. Not log-concave!"); + } + + /* log of a random point between 0 and hat at x */ + logV = log(_unur_call_urng(gen->urng)) + loghx; + + /* below squeeze ? */ + if (logV <= logsqx) + return X; + + /* below PDF ? */ + if (logV <= rescaled_logf(logfx)) + return X; + + /* being above PDF is bad. improve the situation! */ + if (GEN->n_ivs < GEN->max_ivs) { + /* first check for valid values of X and logf(X) */ + if (! (_unur_isfinite(X) && _unur_isfinite(logfx)) ) { + X = _unur_arcmean(iv->x,iv->next->x); /* use mean point in interval */ + logfx = logPDF(X); + } + if ( (_unur_ars_improve_hat( gen, iv, X, logfx) != UNUR_SUCCESS) + && (gen->variant & ARS_VARFLAG_PEDANTIC) ) + return UNUR_INFINITY; + } + + /* reject and try again */ + + } + + /* number of trials exceeded */ + _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING,"max number of iterations exceeded"); + return UNUR_INFINITY; + +} /* end of _unur_ars_sample_check() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_ars_eval_invcdfhat( const struct unur_gen *gen, double U ) + /*----------------------------------------------------------------------*/ + /* evaluate the inverse of the hat CDF at u */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* U ... argument for inverse CDF (0<=U<=1, no validation!) */ + /* */ + /* return: */ + /* inverse of hat CDF. */ + /*----------------------------------------------------------------------*/ +{ + struct unur_ars_interval *iv, *cp; + double X; /* generated point */ + double x0, logfx0, dlogfx0, fx0; /* construction point and logPDF at x0 */ + + + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + if ( gen->method != UNUR_METH_ARS ) { + _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); + return UNUR_INFINITY; + } + COOKIE_CHECK(gen,CK_ARS_GEN,UNUR_INFINITY); + + if ( U<0. || U>1.) { + _unur_warning(gen->genid,UNUR_ERR_DOMAIN,"argument u not in [0,1]"); + } + + if (GEN->iv == NULL) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"empty generator object"); + return UNUR_INFINITY; + } + + /* validate argument */ + if (U<=0.) return DISTR.domain[0]; + if (U>=1.) return DISTR.domain[1]; + + /* find interval by sequential search */ + /* Remark: there is no need for a guide table as we only generate one point! */ + iv = GEN->iv; + U *= GEN->Atotal; + while (iv->Acum < U) { + iv = iv->next; + } + + /* rescale U: U in (-A_hat, 0) */ + U -= iv->Acum; + + /* l.h.s. or r.h.s. of hat */ + if (-U < (scaled_area(iv) * iv->Ahatr_fract)) { /* right */ + cp = iv->next; + /* U unchanged */ + } + else { /* left */ + cp = iv; + U += scaled_area(iv); + } + + /* PDF at x0 */ + x0 = cp->x; + logfx0 = cp->logfx; + dlogfx0 = cp->dlogfx; + fx0 = exp(rescaled_logf(logfx0)); + + /* X = H^{-1}(U) in interval*/ + if (_unur_iszero(dlogfx0)) + X = x0 + U / fx0; + else { + double t = dlogfx0 * U / fx0; + if (fabs(t) > 1.e-6) + X = x0 + log(t + 1.) * U / (fx0 * t); + /* x = x0 + log(t + 1.) / dlogfx0; is cheaper but numerical unstable */ + else if (fabs(t) > 1.e-8) + /* use Taylor series */ + X = x0 + U / fx0 * (1 - t/2. + t*t/3.); + else + X = x0 + U / fx0 * (1 - t/2.); + } + + return X; + +} /* end of unur_ars_eval_invcdfhat() */ + + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_ars_improve_hat( struct unur_gen *gen, struct unur_ars_interval *iv, + double x, double logfx ) + /*----------------------------------------------------------------------*/ + /* improve hat function by splitting interval */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval that has to be split */ + /* x ... splitting point */ + /* logfx ... value of logPDF at splitting point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... improving hat successful */ + /* others ... error: PDF not monotone in interval */ + /*----------------------------------------------------------------------*/ +{ + int result; + + /* add construction point */ + result = _unur_ars_interval_split(gen, iv, x, logfx); + if (result!=UNUR_SUCCESS && result!=UNUR_ERR_SILENT) { + /* condition for PDF is violated! */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,""); + if (gen->variant & ARS_VARFLAG_PEDANTIC) { + /* replace sampling routine by dummy routine that just returns UNUR_INFINITY */ + SAMPLE = _unur_sample_cont_error; + return UNUR_ERR_GEN_CONDITION; + } + } + + /* splitting successful --> update table of areas */ + _unur_ars_make_area_table(gen); + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_ars_improve_hat() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_ars_starting_cpoints( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* list of construction points for starting intervals. */ + /* if not provided as arguments compute these */ + /* by means of the "equiangular rule" from AROU. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_ars_interval *iv; + double left_angle, right_angle, diff_angle, angle; + double x, logfx, logfx_last; + int is_increasing; + int i; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_ARS_GEN,UNUR_ERR_COOKIE); + + /* reset counter of intervals */ + GEN->n_ivs = 0; + + /* prepare for computing construction points */ + if (!GEN->starting_cpoints) { + /* angles of boundary of domain */ + left_angle = _unur_FP_is_minus_infinity(DISTR.BD_LEFT) ? -M_PI/2. : atan(DISTR.BD_LEFT); + right_angle = _unur_FP_is_infinity(DISTR.BD_RIGHT) ? M_PI/2. : atan(DISTR.BD_RIGHT); + /* we use equal distances between the angles of the cpoints */ + /* and the boundary points */ + diff_angle = (right_angle-left_angle) / (GEN->n_starting_cpoints + 1); + angle = left_angle; + } + else + diff_angle = angle = 0.; /* we do not need these variables in this case */ + + /* the left boundary point */ + x = DISTR.BD_LEFT; + is_increasing = TRUE; + + logfx = logfx_last = _unur_isfinite(x) ? logPDF(x) : -UNUR_INFINITY; + iv = GEN->iv = _unur_ars_interval_new( gen, x, logfx ); + if (iv == NULL) return UNUR_ERR_GEN_DATA; /* logPDF(x) overflow */ + + /* now all the other points */ + for( i=0; i<=GEN->n_starting_cpoints; i++ ) { + + /* construction point */ + if (i < GEN->n_starting_cpoints) { + if (GEN->starting_cpoints) { + /* construction points provided by user */ + x = GEN->starting_cpoints[i]; + /* check starting point */ + if (x < DISTR.BD_LEFT || x > DISTR.BD_RIGHT) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"starting point out of domain"); + continue; + } + } + else { + /* compute construction points by means of "equiangular rule" */ + angle += diff_angle; + x = tan( angle ); + } + } + else { + /* the very last interval. it is rather a "virtual" interval to store + the right vertex of the last interval, i.e., the right boundary point. */ + x = DISTR.BD_RIGHT; + } + + /** TODO: check if two construction points are too close ?? + check if a point is too close to mode ?? */ + + /* value of PDF at starting point */ + logfx = _unur_isfinite(x) ? logPDF(x) : -UNUR_INFINITY; + + /* check value of PDF at starting point */ + if (!is_increasing && logfx > logfx_last * (1.+DBL_EPSILON)) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not unimodal!"); + return UNUR_ERR_GEN_CONDITION; + } + + /* check whether we are outside of support of PDF */ + if (!_unur_isfinite(logfx) && !_unur_isfinite(logfx_last) ) { + /* we do not need two such point */ + if (is_increasing) { + /* PDF is still increasing, i.e., constant 0 til now */ + if (in_starting_cpoints) { + /* and it is not the right boundary. + otherwise the PDF is constant 0 on all construction points. + then we need both boundary points. */ + iv->x = x; /* we only have to change x, everything else remains unchanged */ + continue; /* next construction point */ + } + } + else + /* there should be no more points with logPDF(x) > -UNUR_INFINITY */ + break; + } + + /* need a new interval */ + iv->next = _unur_ars_interval_new( gen, x, logfx ); + if (iv->next == NULL) return UNUR_ERR_GEN_DATA; /* logPDF(x) overflow */ + + /* skip pointer to current interval */ + iv = iv->next; + + /* PDF still increasing ? */ + if (is_increasing && logfx < logfx_last) + is_increasing = FALSE; + + /* store last computed values */ + logfx_last = logfx; + + } + + /* we have left the loop with the right boundary of the support of PDF + make shure that we will never use iv for sampling. */ + iv->logAhat = -UNUR_INFINITY; + iv->Ahatr_fract = iv->sq = 0.; + iv->Acum = UNUR_INFINITY; +#ifdef DEBUG_STORE_IP + iv->ip = iv->x; +#endif + iv->next = NULL; /* terminate list */ + --(GEN->n_ivs); /* we do not count the terminating interval */ + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_ars_starting_cpoints() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_ars_starting_intervals( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* compute intervals for starting points */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_ars_interval *iv, *iv_new, *iv_tmp; + double x, logfx; /* construction point, value of logPDF at x */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_ARS_GEN,UNUR_ERR_COOKIE); + CHECK_NULL(GEN->iv,UNUR_ERR_NULL); COOKIE_CHECK(GEN->iv,CK_ARS_IV,UNUR_ERR_COOKIE); + + /* compute paramters for all intervals */ + for( iv=GEN->iv; iv->next != NULL; ) { + + /* compute parameters for interval */ + switch (_unur_ars_interval_parameter(gen, iv)) { + case UNUR_SUCCESS: /* computation of parameters for interval successful */ + /* skip to next interval */ + iv = iv->next; + continue; + case UNUR_ERR_INF: /* interval unbounded */ + /* split interval */ + break; + case UNUR_ERR_SILENT: /* construction points too close */ + /* we have to remove this last interval from list */ + /* (the last construction point in the list is a boundary point. + thus we might change the domain of the distribution. + however, we only cut off a piece that is beyond the precesion + of the floating point arithmetic.) */ + iv_tmp = iv->next; + iv->next = iv->next->next; + free(iv_tmp); + --(GEN->n_ivs); + + if (iv->next==NULL) { + /* last (virtuel) interval in list. + make sure that we will never use this segment */ + iv->logAhat = -UNUR_INFINITY; + iv->Ahatr_fract = iv->sq = 0.; + iv->Acum = UNUR_INFINITY; + } + continue; + default: /* PDF not T-concave */ + return UNUR_ERR_GEN_CONDITION; + } + + /* area below hat infinite. + insert new construction point. */ + x = _unur_arcmean(iv->x,iv->next->x); /* use mean point in interval */ + + /* value of logPDF at x */ + logfx = logPDF(x); + + /* add a new interval, but check if we had to used too many intervals */ + if (GEN->n_ivs >= GEN->max_ivs) { + /* we do not want to create too many intervals */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot create bounded hat!"); + return UNUR_ERR_GEN_CONDITION; + } + iv_new = _unur_ars_interval_new( gen, x, logfx ); + if (iv_new == NULL) return UNUR_ERR_GEN_DATA; /* logPDF(x) overflow */ + + + /* if fx is 0, then we can cut off the tail of the distribution + (since it must be T-concave) */ + if (!_unur_isfinite(logfx) ) { + + if (!_unur_isfinite(iv->logfx) ) { + /* cut off left tail */ + iv_new->next = iv->next; + free(iv); + --(GEN->n_ivs); + GEN->iv = iv_new; + iv = iv_new; + } + + else if (!_unur_isfinite(iv->next->logfx) ) { + /* cut off right tail */ + free(iv->next); + --(GEN->n_ivs); + iv->next = iv_new; + } + + else { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave!"); + free(iv_new); + return UNUR_ERR_GEN_CONDITION; + } + } + + else { + /* insert new interval into linked list */ + iv_new->next = iv->next; + iv->next = iv_new; + } + + } + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_ars_starting_intervals() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_ars_interval * +_unur_ars_interval_new( struct unur_gen *gen, double x, double logfx ) + /*----------------------------------------------------------------------*/ + /* get new interval and compute left construction point at x. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* x ... left point of new interval */ + /* logfx ... value of logPDF at x */ + /* */ + /* return: */ + /* pointer to new interval */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_ars_interval *iv; +/* double dfx; */ + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_ARS_GEN,NULL); + + /* first check logfx */ + if (!(logfx < UNUR_INFINITY)) { + /* overflow */ + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"logPDF(x) overflow"); + return NULL; + } + + /* we need a new segment */ + iv = _unur_xmalloc( sizeof(struct unur_ars_interval) ); + iv->next = NULL; /* add eol marker */ + ++(GEN->n_ivs); /* increment counter for intervals */ + COOKIE_SET(iv,CK_ARS_IV); + + /* avoid uninitialized variables */ + iv->logAhat = -UNUR_INFINITY; + iv->Acum = iv->Ahatr_fract = 0.; + iv->sq = 0.; +#ifdef DEBUG_STORE_IP + iv->ip = 0.; +#endif + + /* make left construction point in interval */ + iv->x = x; /* point x */ + iv->logfx = logfx; /* value of logPDF at x */ + + /* derivative of transformed density */ + iv->dlogfx = _unur_isfinite(logfx) ? dlogPDF(x) : UNUR_INFINITY; + + /* the program requires dlogPDF > -UNUR_INFINITY */ + if ( !(iv->dlogfx > -UNUR_INFINITY)) + iv->dlogfx = UNUR_INFINITY; + + return iv; + +} /* end of _unur_ars_interval_new() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_ars_interval_parameter( struct unur_gen *gen, struct unur_ars_interval *iv ) + /*----------------------------------------------------------------------*/ + /* compute intersection point of tangents and */ + /* the area below the hat (Gilks & Wild variant) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... if successful */ + /* UNUR_ERR_SILENT ... do not add this construction point */ + /* UNUR_ERR_INF ... area = UNUR_INFINITY */ + /* others ... error (PDF not T-concave) */ + /*----------------------------------------------------------------------*/ +{ + double logAhatl, logAhatr; /* log of areas below hat at l.h.s. and r.h.s. + of intersection point, resp. */ + + double ip = 0.; /* intersection point of tangents */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_ARS_GEN,UNUR_ERR_COOKIE); + CHECK_NULL(iv,UNUR_ERR_NULL); COOKIE_CHECK(iv,CK_ARS_IV,UNUR_ERR_COOKIE); + + /* check interval on the right side of iv */ + CHECK_NULL(iv->next,UNUR_ERR_NULL); COOKIE_CHECK(iv->next,CK_ARS_IV,UNUR_ERR_COOKIE); + + /* get intersection point of tangents. + used to partition interval into left hand part (construction point of tangent + on the left hand boundary) and right hand part (construction point of tangent + on the left hand boundary). */ + if ( _unur_ars_tangent_intersection_point(gen,iv,&ip)!=UNUR_SUCCESS ) + return UNUR_ERR_GEN_CONDITION; + +#ifdef DEBUG_STORE_IP + iv->ip = ip; +#endif + + /* squeeze and area below squeeze */ + if (_unur_isfinite(iv->logfx) && _unur_isfinite(iv->next->dlogfx) ) { + + /* we do not compute the slope when the construction points + are too close. at least 8 significant digits should remain. */ + if (_unur_FP_approx(iv->x, iv->next->x) ) + return UNUR_ERR_SILENT; /* construction points too close */ + + /* slope of transformed squeeze */ + iv->sq = (iv->next->logfx - iv->logfx) / (iv->next->x - iv->x); + + /* check squeeze */ + /* we have to take care about round off error. + the following accepts PDFs with might be a little bit not T_concave */ + if ( ( (iv->sq > iv->dlogfx && (!_unur_FP_approx(iv->sq,iv->dlogfx)) ) || + (iv->sq < iv->next->dlogfx && (!_unur_FP_approx(iv->sq,iv->next->dlogfx)) ) ) + && iv->next->dlogfx < UNUR_INFINITY ) { + + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"Squeeze too steep/flat. PDF not T-concave!"); + return UNUR_ERR_GEN_CONDITION; + } + } + + else { /* no squeeze */ + iv->sq = -UNUR_INFINITY; + } + + /* volume below hat */ + logAhatl = _unur_ars_interval_logarea( gen, iv, iv->dlogfx, ip); + logAhatr = _unur_ars_interval_logarea( gen, iv->next, iv->next->dlogfx, ip); + + /* areas below head unbounded ? */ + if (! (logAhatl < UNUR_INFINITY && logAhatr < UNUR_INFINITY) ) + return UNUR_ERR_INF; + + /* total area */ + iv->logAhat = (logAhatl > logAhatr) + ? logAhatl+log(1+exp(logAhatr-logAhatl)) + : logAhatr+log(1+exp(logAhatl-logAhatr)) ; /* = log( Ahatr + Ahatl ) */ + + iv->Ahatr_fract = 1./(1.+exp(logAhatl-logAhatr)); /* = Ahatr / (Ahatr + Ahatl) */ + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_ars_interval_parameter() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_ars_interval_split( struct unur_gen *gen, struct unur_ars_interval *iv_oldl, double x, double logfx ) + /*----------------------------------------------------------------------*/ + /* split interval iv_oldl into two intervals at point x */ + /* old interval -> left hand side */ + /* new interval -> right hand side */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv_oldl ... pointer to interval */ + /* x ... left point of new segment */ + /* logfx ... value of logPDF at x */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... if successful */ + /* UNUR_ERR_SILENT ... if no intervals are splitted */ + /* others ... error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_ars_interval *iv_newr; /* pointer to new interval */ + struct unur_ars_interval iv_bak; /* space for backing up data of interval */ + int success, success_r; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_ARS_GEN,UNUR_ERR_COOKIE); + CHECK_NULL(iv_oldl,UNUR_ERR_NULL); COOKIE_CHECK(iv_oldl,CK_ARS_IV,UNUR_ERR_COOKIE); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & ARS_DEBUG_SPLIT) + _unur_ars_debug_split_start( gen,iv_oldl,x,logfx ); +#endif + + /* the splitting point must be inside the interval */ + if (x < iv_oldl->x || x > iv_oldl->next->x) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"splitting point not in interval!"); + return UNUR_ERR_SILENT; + } + + /* back up data */ + memcpy(&iv_bak, iv_oldl, sizeof(struct unur_ars_interval)); + + /* check if the new interval is completely outside the support of PDF */ + if (!_unur_isfinite(logfx)) { + + /* one of the two boundary points must be 0, too! */ + if (!_unur_isfinite(iv_oldl->logfx)) { + /* chop off left part (it's out of support) */ + iv_oldl->x = x; + } + else if (!_unur_isfinite(iv_oldl->next->logfx)) { + /* chop off right part (it's out of support) */ + iv_oldl->next->x = x; + } + else { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not log-concave"); + return UNUR_ERR_GEN_CONDITION; + } + + /* compute parameters for chopped interval */ + success = _unur_ars_interval_parameter(gen, iv_oldl); + + /* we did not add a new interval */ + iv_newr = NULL; + } + + else { + + /* we need a new interval */ + iv_newr = _unur_ars_interval_new( gen, x, logfx ); + if (iv_newr == NULL) { + /* logPDF(x) overflow */ + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + } + + /* insert into linked list */ + iv_newr->next = iv_oldl->next; + iv_oldl->next = iv_newr; + + /* compute parameters for interval */ + success = _unur_ars_interval_parameter(gen, iv_oldl); + success_r = _unur_ars_interval_parameter(gen, iv_newr); + + /* worst of success and success_r */ + if (success_r!=UNUR_SUCCESS) + if ((success_r!=UNUR_ERR_SILENT&&success_r!=UNUR_ERR_INF) || + (success==UNUR_SUCCESS||success==UNUR_ERR_SILENT||success==UNUR_ERR_INF)) + success = success_r; + } + + /* successfull ? */ + if (success!=UNUR_SUCCESS) { + /* cannot split interval at given point */ + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"Cannot split interval at given point."); + if (success!=UNUR_ERR_SILENT && success!=UNUR_ERR_INF) + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not log-concave"); + + /* the case of unbounded hat is treated as round-off error for + very steep tangents. so we simply do not add this construction point. */ + + /* restore old interval */ + memcpy(iv_oldl, &iv_bak, sizeof(struct unur_ars_interval)); + + /* decrement counter for intervals and free unused interval */ + if (iv_newr) { + --(GEN->n_ivs); + free( iv_newr ); + } + + return ( (success!=UNUR_ERR_SILENT && success!=UNUR_ERR_INF) + ? UNUR_ERR_GEN_CONDITION : UNUR_SUCCESS ); + } + + /* successful */ + +#ifdef UNUR_ENABLE_LOGGING + if (gen->debug & ARS_DEBUG_SPLIT) { + /* update total area below hat and squeeze */ + GEN->Atotal = ( GEN->Atotal - scaled_area(&iv_bak) + scaled_area(iv_oldl) + ((iv_newr) ? scaled_area(iv_newr) : 0.) ); + /* write info into LOG file */ + _unur_ars_debug_split_stop( gen,iv_oldl,iv_newr ); + } +#endif + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_ars_interval_split() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_ars_tangent_intersection_point( struct unur_gen *gen, struct unur_ars_interval *iv, double *ipt ) + /*----------------------------------------------------------------------*/ + /* compute cutting point of interval into left and right part. */ + /* (1) use intersection point of tangents of transformed hat. */ + /* (2) use mean point if (1) is unstable due to roundoff errors. */ + /* (3) use boundary point which is closer to the mode. this is */ + /* important when the transformed tagents are extremely steep. */ + /* (This might cause a serious roundoff error while sampling.) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval */ + /* ipt ... pointer to intersection point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_ARS_GEN,UNUR_ERR_COOKIE); + CHECK_NULL(iv,UNUR_ERR_NULL); COOKIE_CHECK(iv,CK_ARS_IV,UNUR_ERR_COOKIE); + + /* + case: there is no tangent at one of the boundary points of the interval + (then the slope is UNUR_INFINITY) + or + case: the tangents are too steep (--> case (3)) + */ + if ( iv->dlogfx > 1.e+140 ) { + *ipt = iv->x; /* intersection point = left boundary of interval */ + return UNUR_SUCCESS; + } + if ( iv->next->dlogfx < -1.e+140 || _unur_FP_is_infinity(iv->next->dlogfx)) { + *ipt = iv->next->x; /* intersection point = right boundary of interval */ + return UNUR_SUCCESS; + } + /** TODO: 1.e+140 (= sqrt(DBL_MAX) / 1.e15) is arbitrary **/ + + /* test for T-concavity */ + if ( _unur_FP_less( iv->dlogfx, iv->next->dlogfx ) ) { + + /* it might happen because of round-off errors + that iv->next->dTfx is almost zero although it should be large. + thus we ignore this case. */ + if ( fabs(iv->dlogfx) < DBL_EPSILON * fabs(iv->next->dlogfx) ) { + *ipt = iv->x; /* intersection point = left boundary of interval */ + iv->dlogfx = UNUR_INFINITY; + return UNUR_SUCCESS; + } + else if ( fabs(iv->next->dlogfx) < DBL_EPSILON * fabs(iv->dlogfx) ) { + *ipt = iv->next->x; /* intersection point = right boundary of interval */ + iv->next->dlogfx = UNUR_INFINITY; + return UNUR_SUCCESS; + } + else { + if (_unur_FP_approx(iv->dlogfx, iv->next->dlogfx)) { + /* use mean point */ + *ipt = 0.5 * (iv->x + iv->next->x); + return UNUR_SUCCESS; + } + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"dTfx0 < dTfx1 (x0next->logfx > iv->x + iv->dlogfx*(iv->next->x - iv->x)) { */ + /* _unur_warning(gen->genid,UNUR_ERR_INIT,"tangent below PDF, not log-concave!"); */ + /* return UNUR_ERR_INIT; */ + /* } */ + + /* case (2): computing intersection of tangents is unstable */ + if (_unur_FP_approx(iv->dlogfx, iv->next->dlogfx)) { + /* use mean point */ + *ipt = 0.5 * (iv->x + iv->next->x); + return UNUR_SUCCESS; + } + + /* case (1): compute intersection point of tangents (regular case) */ + *ipt = ( (iv->next->logfx - iv->logfx - iv->next->dlogfx * iv->next->x + iv->dlogfx * iv->x) / + (iv->dlogfx - iv->next->dlogfx) ); + + /* check position of intersection point */ + if (_unur_FP_less(*ipt, iv->x) || _unur_FP_greater(*ipt, iv->next->x)) + /* intersection point of tangents not in interval. + This is mostly the case for numerical reasons. + Thus we use the center of the interval instead. + if the PDF not T-concave, it will catched at a later + point when we compare slope of tangents and squeeze. */ + *ipt = 0.5 * (iv->x + iv->next->x); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_ars_tangent_intersection_point() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_ars_interval_logarea( struct unur_gen *gen ATTRIBUTE__UNUSED, + struct unur_ars_interval *iv, double slope, double x ) + /*---------------------------------------------------------------------------*/ + /* compute log of area below piece of hat or squeeze in */ + /* interval [iv->x,x] or [x,iv->x] */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval that stores construction point of tangent */ + /* slope ... slope of tangent or secant of transformed PDF */ + /* x ... boundary of integration domain */ + /* */ + /* return: */ + /* log of area */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /* */ + /* comment: */ + /* x0 ... construction point of tangent (= iv->x) */ + /* */ + /* area = | \int_{x0}^x \exp(Tf(x0) + slope*(t-x0)) dt | */ + /* = f(x0) * |x - x0| if slope = 0 */ + /* = | f(x0)/slope * (\exp(slope*(x-x0))-1) | if slope != 0 */ + /* */ + /*---------------------------------------------------------------------------*/ +{ + double x0, logfx0; + double logxdiff; + double t, logt; + + /* check arguments */ + CHECK_NULL(iv,UNUR_INFINITY); COOKIE_CHECK(iv,CK_ARS_IV,UNUR_INFINITY); + + /* length of interval > 0 ? */ + if (_unur_FP_same(x, iv->x)) + return -UNUR_INFINITY; + + /* if the construction point is at infinity, we cannot compute an area. + (in this case we should have x == iv->x == UNUR_INFINITY). */ + if (!_unur_isfinite(iv->x)) + return UNUR_INFINITY; + + /* unbounded? */ + if ( !_unur_isfinite(slope) || + (_unur_FP_is_minus_infinity(x) && slope<=0.) || + (_unur_FP_is_infinity(x) && slope>=0.) ) /* we have set (Tf)'(x) = UNUR_INFINITY, if f(x)=0 */ + return UNUR_INFINITY; + + /* construction point x0 of tangent and log of PDF at x0 */ + x0 = iv->x; + logfx0 = iv->logfx; + + /* log of |x - x=| */ + logxdiff = log(fabs(x - x0)); + + /* case: hat/squeeze constant --> area = f(x0) * |x - x0| */ + if (_unur_iszero(slope)) + return (_unur_isfinite(x) ? logfx0 + logxdiff : UNUR_INFINITY); + + /* case: domain unbounded --> area = f(x0) / |slope| */ + if (!_unur_isfinite(x)) + return (logfx0 - log(fabs(slope))); + + /* case bounded domain --> area = | f(x0)/slope * (\exp(slope*(x-x0))-1) | */ + /* have to deal with numerical problems when x \approx x0 */ + t = slope * (x - x0); + logt = log(fabs(slope)) + logxdiff; + + if (fabs(t) > 1.e-6) { + if (t > MAXLOG / 10.) + return ( logfx0 + logxdiff + t - logt ); + else + return ( logfx0 + logxdiff + log( fabs(exp(t) - 1.) ) - log(fabs(t)) ); + } + + else /* use Taylor series */ + return (logfx0 + logxdiff + log1p(t/2. + t*t/6.)); + +} /* end of _unur_ars_interval_logarea() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_ars_make_area_table( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* make table of areas and compute largest area for rescaling */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_ars_interval *iv; + double Acum; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_ARS_GEN,UNUR_ERR_COOKIE); + + /* first we need the maximum area in intervals as scaling factor */ + GEN->logAmax = -UNUR_INFINITY; + for (iv = GEN->iv; iv != NULL; iv = iv->next ) { + COOKIE_CHECK(iv,CK_ARS_IV,UNUR_ERR_COOKIE); + if (GEN->logAmax < iv->logAhat) + GEN->logAmax = iv->logAhat; + } + + /* cumulated areas in intervals */ + Acum = 0.; /* area below hat */ + for (iv = GEN->iv; iv != NULL; iv = iv->next ) { + COOKIE_CHECK(iv,CK_ARS_IV,UNUR_ERR_COOKIE); + Acum += scaled_area(iv); + iv->Acum = Acum; + } + + /* total area below hat */ + GEN->Atotal = Acum; + + return UNUR_SUCCESS; +} /* end of _unur_ars_make_area_table() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_ars_debug_init_start( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* print after (almost empty generator) object has been created. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int i; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = ARS (Adaptive Rejection Sampling)\n",gen->genid); + fprintf(LOG,"%s: transformation T_c(x) = log(x)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + if (gen->distr_is_privatecopy) + fprintf(LOG,"%s: use private copy of distribution object\n",gen->genid); + else + fprintf(LOG,"%s: use pointer to external distribution object (dangerous!)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cont_debug( gen->distr, gen->genid ); + + fprintf(LOG,"%s: sampling routine = _unur_ars_sample",gen->genid); + if (gen->variant & ARS_VARFLAG_VERIFY) + fprintf(LOG,"_check()\n"); + else + fprintf(LOG,"()\n"); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: maximum number of intervals = %d",gen->genid,GEN->max_ivs); + _unur_print_if_default(gen,ARS_SET_MAX_IVS); + fprintf(LOG,"\n"); + + fprintf(LOG,"%s: maximum number of iterations = %d",gen->genid,GEN->max_iter); + _unur_print_if_default(gen,ARS_SET_MAX_ITER); + fprintf(LOG,"\n%s:\n",gen->genid); + + fprintf(LOG,"%s: number of starting points = %d",gen->genid,GEN->n_starting_cpoints); + _unur_print_if_default(gen,ARS_SET_N_CPOINTS); + fprintf(LOG,"\n%s: starting points:",gen->genid); + if (gen->set & ARS_SET_CPOINTS) + for (i=0; in_starting_cpoints; i++) { + if (i%5==0) fprintf(LOG,"\n%s:\t",gen->genid); + fprintf(LOG," %#g,",GEN->starting_cpoints[i]); + } + else + fprintf(LOG," use \"equidistribution\" rule [default]"); + fprintf(LOG,"\n%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_ars_debug_init_start() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_ars_debug_init_finished( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator after setup into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + _unur_ars_debug_intervals(gen,"INIT completed",TRUE); + + fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_ars_debug_init_finished() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_ars_debug_reinit_start( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator before reinitialization into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + int i; + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: *** Re-Initialize generator object ***\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + if (gen->set & ARS_SET_N_PERCENTILES) { + fprintf(LOG,"%s: use percentiles of old hat as starting points for new hat:",gen->genid); + for (i=0; in_percentiles; i++) { + if (i%5==0) fprintf(LOG,"\n%s:\t",gen->genid); + fprintf(LOG," %#g,",GEN->percentiles[i]); + } + fprintf(LOG,"\n%s: starting points:",gen->genid); + for (i=0; in_starting_cpoints; i++) { + if (i%5==0) fprintf(LOG,"\n%s:\t",gen->genid); + fprintf(LOG," %#g,",GEN->starting_cpoints[i]); + } + fprintf(LOG,"\n"); + } + else { + fprintf(LOG,"%s: use starting points given at init\n",gen->genid); + } + + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_ars_debug_reinit_start() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_ars_debug_reinit_retry( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator before second trial of reinitialization */ + /* into LOG file. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: *** Re-Initialize failed --> second trial ***\n",gen->genid); + fprintf(LOG,"%s: use equal-area-rule with %d points\n",gen->genid,GEN->retry_ncpoints); + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_ars_debug_reinit_retry() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_ars_debug_reinit_finished( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator after reinitialization into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + _unur_ars_debug_intervals(gen," *** Generator reinitialized ***",TRUE); + + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_ars_debug_reinit_finished() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_ars_debug_intervals( const struct unur_gen *gen, const char *header, int print_areas ) + /*----------------------------------------------------------------------*/ + /* write list of intervals into LOG file (orig. variant by Gilks & Wild)*/ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* header ... header for table */ + /* print_areas ... whether table of areas should be printed */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + struct unur_ars_interval *iv; + double Ahat, Ahatl, Ahatr; + double sAhatl, sAhatr, Atotal, logAmax; + int i; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + if (header) fprintf(LOG,"%s:%s\n",gen->genid,header); + + fprintf(LOG,"%s:Intervals: %d\n",gen->genid,GEN->n_ivs); + if (GEN->iv) { + if (gen->debug & ARS_DEBUG_IV) { +#ifdef DEBUG_STORE_IP + fprintf(LOG,"%s: Nr. tp ip logf(tp) dlogf(tp) squeeze\n",gen->genid); + for (iv = GEN->iv, i=0; iv->next!=NULL; iv=iv->next, i++) { + COOKIE_CHECK(iv,CK_ARS_IV,RETURN_VOID); + fprintf(LOG,"%s:[%3d]: %#12.6g %#12.6g %#12.6g %#12.6g %#12.6g\n", gen->genid, i, + iv->x, iv->ip, iv->logfx, iv->dlogfx, iv->sq); + } +#else + fprintf(LOG,"%s: Nr. tp logf(tp) dlogf(tp) squeeze\n",gen->genid); + for (iv = GEN->iv, i=0; iv->next!=NULL; iv=iv->next, i++) { + COOKIE_CHECK(iv,CK_ARS_IV,RETURN_VOID); + fprintf(LOG,"%s:[%3d]: %#12.6g %#12.6g %#12.6g %#12.6g\n", gen->genid, i, + iv->x, iv->logfx, iv->dlogfx, iv->sq); + } +#endif + COOKIE_CHECK(iv,CK_ARS_IV,RETURN_VOID); + fprintf(LOG,"%s:[...]: %#12.6g %#12.6g %#12.6g\n", gen->genid, + iv->x, iv->logfx, iv->dlogfx); + } + fprintf(LOG,"%s:\n",gen->genid); + } + else + fprintf(LOG,"%s: No intervals !\n",gen->genid); + + if (!print_areas || GEN->Atotal <= 0.) return; + + /* print and sum areas below squeeze and hat */ + Atotal = GEN->Atotal; + logAmax = GEN->logAmax; + if (gen->debug & ARS_DEBUG_IV) { + fprintf(LOG,"%s:Areas in intervals relative to maximum:\t[ log(A_max) = %g ]\n",gen->genid, logAmax); + fprintf(LOG,"%s: Nr.\tbelow hat (left and right)\t\t cumulated\n",gen->genid); + sAhatl = sAhatr = 0.; + if (GEN->iv) { + for (iv = GEN->iv, i=0; iv->next!=NULL; iv=iv->next, i++) { + COOKIE_CHECK(iv,CK_ARS_IV,RETURN_VOID); + Ahat = scaled_area(iv); + sAhatr += Ahatr = Ahat * iv->Ahatr_fract; + sAhatl += Ahatl = Ahat - Ahatr; + fprintf(LOG,"%s:[%3d]: %-12.6g+ %-12.6g(%6.3f%%) | %-12.6g(%6.3f%%)\n", + gen->genid,i, + Ahatl, Ahatr, Ahat * 100. / Atotal, + iv->Acum, iv->Acum * 100. / Atotal); + } + fprintf(LOG,"%s: ------------------------ --------- +\n",gen->genid); + fprintf(LOG,"%s: Sum : %-12.6g (%6.3f%%)\n",gen->genid, + sAhatl+sAhatr, (sAhatl+sAhatr) * 100. / Atotal); + fprintf(LOG,"%s:\n",gen->genid); + } + } + + /* summary of areas */ + fprintf(LOG,"%s: A(total) = %-12.6g\n",gen->genid, GEN->Atotal); + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_ars_debug_intervals() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_ars_debug_free( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator before destroying into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + if (gen->status == UNUR_SUCCESS) { + fprintf(LOG,"%s: GENERATOR destroyed **********************\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + _unur_ars_debug_intervals(gen,NULL,TRUE); + } + else { + fprintf(LOG,"%s: initialization of GENERATOR failed **********************\n",gen->genid); + _unur_ars_debug_intervals(gen,"Intervals after failure:",FALSE); + } + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_ars_debug_free() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_ars_debug_split_start( const struct unur_gen *gen, + const struct unur_ars_interval *iv, + double x, double logfx ) + /*----------------------------------------------------------------------*/ + /* write info about splitting interval */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval */ + /* x ... split at this point */ + /* logfx ... value of logPDF at x */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + double Ahat; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); + CHECK_NULL(iv,RETURN_VOID); COOKIE_CHECK(iv,CK_ARS_IV,RETURN_VOID); + + LOG = unur_get_stream(); + + Ahat = scaled_area(iv); + + fprintf(LOG,"%s: split interval at x = %g \t\tlogf(x) = %g\n",gen->genid,x,logfx); + fprintf(LOG,"%s: old interval:\n",gen->genid); + fprintf(LOG,"%s: left construction point = %-12.6g\tlogf(x) = %-12.6g\n",gen->genid,iv->x,iv->logfx); + fprintf(LOG,"%s: right construction point = %-12.6g\tlogf(x) = %-12.6g\n",gen->genid,iv->next->x,iv->next->logfx); + fprintf(LOG,"%s: A(hat) = %-12.6g + %-12.6g(%6.3f%%)\t[ relative to A_max ]\n",gen->genid, + Ahat * (1.-iv->Ahatr_fract), Ahat * iv->Ahatr_fract, Ahat*100./GEN->Atotal); + + fflush(LOG); + +} /* end of _unur_ars_debug_split_start() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_ars_debug_split_stop( const struct unur_gen *gen, + const struct unur_ars_interval *iv_left, + const struct unur_ars_interval *iv_right ) + /*----------------------------------------------------------------------*/ + /* write info about new splitted intervals */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv_left ... pointer to new left hand interval */ + /* iv_right ... pointer to new right hand interval */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + double Ahat; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); + CHECK_NULL(iv_left,RETURN_VOID); COOKIE_CHECK(iv_left,CK_ARS_IV,RETURN_VOID); + + if (iv_right == NULL) iv_right = iv_left; + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: inserted point:\n",gen->genid); + fprintf(LOG,"%s: x = %g, logf(x) = %g, dlogf(x) = %g, squeeze = %g:\n", + gen->genid, iv_right->x, iv_right->logfx, iv_right->dlogfx, iv_right->sq); + fprintf(LOG,"%s: new intervals:\n",gen->genid); + fprintf(LOG,"%s: left construction point = %g\n",gen->genid, iv_left->x); + if (iv_left != iv_right) + fprintf(LOG,"%s: middle construction point = %g\n",gen->genid, iv_right->x); + fprintf(LOG,"%s: right construction point = %g\n",gen->genid, iv_right->next->x); + + fprintf(LOG,"%s: left interval:\n",gen->genid); + Ahat = scaled_area(iv_left); + fprintf(LOG,"%s: A(hat) = %-12.6g + %-12.6g(%6.3f%%)\t[ relative to A_max ]\n",gen->genid, + Ahat * (1.-iv_left->Ahatr_fract), Ahat * iv_left->Ahatr_fract, + Ahat * 100./GEN->Atotal); + + if (iv_left == iv_right) + fprintf(LOG,"%s: interval chopped.\n",gen->genid); + else { + fprintf(LOG,"%s: right interval:\n",gen->genid); + Ahat = scaled_area(iv_right); + fprintf(LOG,"%s: A(hat) = %-12.6g + %-12.6g(%6.3f%%)\t[ relative to A_max ]\n",gen->genid, + Ahat * (1.-iv_right->Ahatr_fract), Ahat * iv_right->Ahatr_fract, + Ahat * 100./GEN->Atotal); + } + + fprintf(LOG,"%s: total areas:\n",gen->genid); + fprintf(LOG,"%s: A(total) = %-12.6g\n",gen->genid, GEN->Atotal); + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_ars_debug_split_stop() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_ars_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + int samplesize = 10000; + int n_ivs_bak; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = logPDF dlogPDF\n"); + _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info,"\n"); + + /* method */ + _unur_string_append(info,"method: ARS (Adaptive Rejection Sampling)\n"); + _unur_string_append(info," T_c(x) = log(x) ... c = 0\n"); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," area(hat) = %g [ log = %g ]\n", + GEN->Atotal*exp(GEN->logAmax), log(GEN->Atotal) + GEN->logAmax); + _unur_string_append(info," rejection constant "); + if (distr->set & UNUR_DISTR_SET_PDFAREA) + _unur_string_append(info,"= %g\n", GEN->Atotal*exp(GEN->logAmax)/DISTR.area); + else { + n_ivs_bak = GEN->n_ivs; + GEN->n_ivs = GEN->max_ivs+1; + _unur_string_append(info,"= %.3f [approx.]\n", + unur_test_count_urn(gen,samplesize,0,NULL)/(2.*samplesize)); + GEN->n_ivs = n_ivs_bak; + } + _unur_string_append(info," # intervals = %d\n", GEN->n_ivs); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + _unur_string_append(info," cpoints = %d %s\n", GEN->n_starting_cpoints, + (gen->set & ARS_SET_N_CPOINTS) ? "" : "[default]"); + + if (gen->variant & ARS_VARFLAG_VERIFY) + _unur_string_append(info," verify = on\n"); + + if (gen->variant & ARS_VARFLAG_PEDANTIC) + _unur_string_append(info," pedantic = on\n"); + _unur_string_append(info,"\n"); + + /* Not displayed: + int unur_ars_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); + int unur_ars_set_cpoints( UNUR_PAR *parameters, int n_cpoints, const double *cpoints ); + int unur_ars_set_reinit_percentiles( UNUR_PAR *parameters, int n_percentiles, const double *percentiles ); + int unur_ars_set_reinit_ncpoints( UNUR_PAR *parameters, int ncpoints ); + */ + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_ars_info() */ + +/*---------------------------------------------------------------------------*/ +#endif +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/ars.h b/vendor/unuran-1.11.0/src/methods/ars.h new file mode 100644 index 0000000..9a59af3 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/ars.h @@ -0,0 +1,244 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: ars.h * + * * + * PURPOSE: * + * function prototypes for method ARS * + * (Adaptive Rejection Sampling - Gilks & Wild) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD ARS Adaptive Rejection Sampling + + =UP Methods_for_CONT + + =REQUIRED concave logPDF, derivative of logPDF + + =OPTIONAL mode + + =SPEED Set-up: fast, Sampling: slow + + =REINIT supported + + =REF [GWa92] [HLD04: Cha.4] + + =DESCRIPTION + ARS is an acceptance/rejection method that uses the concavity + of the log-density function to construct hat function and + squeezes automatically. + It is very similar to method TDR (@pxref{TDR}) with variant GW, + parameter @code{c = 0}, and DARS switched off. + Moreover, method ARS requires the logPDF and its derivative + dlogPDF to run. On the other hand, it is designed to draw only a + (very) small samples and it is much more robust against + densities with very large or small areas below the PDF as + it occurs, for example, in conditional distributions of + (high dimensional) multivariate distributions. + Additionally, it can be re-initialized when the underlying + distribution has been modified. + Thus it is well suited for Gibbs sampling. + + Notice, that method ARS is a restricted version of TDR. If the + full functionally of Transformed Density Rejection is needed use + method @ref{TDR}. + + =HOWTOUSE + Method ARS is designed for distributions with log-concave + densities. To use this method you need a distribution object + with the logarithm of the PDF and its derivative given. + + The number of construction points as well as a set of such + points can be provided using unur_ars_set_cpoints(). + Notice that addition construction points are added by means of + adaptive rejection sampling until the maximal number of + intervals given by unur_ars_set_max_intervals() is reached. + + A generated distribution object can be reinitialized using the + unur_reinit() call. When unur_reinit() is called construction + points for the new generator are necessary. There are two options: + Either the same construction points as for the initial generator + (given by a unur_ars_set_cpoints() call) are used (this is the + default), or percentiles of the old hat function can be used. + This can be set or changed using unur_ars_set_reinit_percentiles() + and unur_ars_chg_reinit_percentiles(). + This feature is usefull when the underlying distribution object + is only moderately changed. (An example is Gibbs sampling with + small correlations.) + + There exists a test mode that verifies whether the conditions for + the method are satisfied or not. It can be switched on by calling + unur_ars_set_verify() and unur_ars_chg_verify(), respectively. + Notice however that sampling is (much) slower then. + + Method ARS aborts after a given number of iterations and return + UNUR_INFINITY to prevent (almost) infinite loops. This might + happen when the starting hat is much too large and it is not + possible to insert new construction points due to severe + numerical errors or (more likely) the given PDF is not + log-concave. This maximum number of iterations can be set by + means of a unur_ars_set_max_iter() call. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_ars_new( const UNUR_DISTR* distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_ars_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); +/* + Set maximum number of intervals. + No construction points are added after the setup when the number of + intervals suceeds @var{max_ivs}. + It is increased automatically to twice the number of construction + points if this is larger. + + Default is @code{200}. +*/ + +int unur_ars_set_cpoints( UNUR_PAR *parameters, int n_cpoints, const double *cpoints ); +/* + Set construction points for the hat function. If @var{cpoints} is + NULL then a heuristic rule of thumb is used to get @var{n_cpoints} + construction points. This is the default behavior. + @var{n_cpoints} should be at least @code{2}, otherwise defaults are used. + + The default number of construction points is 2. +*/ + +int unur_ars_set_reinit_percentiles( UNUR_PAR *parameters, int n_percentiles, const double *percentiles ); +/* */ + +int unur_ars_chg_reinit_percentiles( UNUR_GEN *generator, int n_percentiles, const double *percentiles ); +/* + By default, when the @var{generator} object is reinitialized, it + used the same construction points as for the initialization + procedure. + Often the underlying distribution object has been changed only + moderately. For example, the full conditional distribution of a + multivariate distribution. + In this case it might be more appropriate to use + percentilesm of the hat function for the last (unchanged) + distribution. @var{percentiles} must then be a pointer to an + ordered array of numbers between @code{0.01} and @code{0.99}. + If @var{percentiles} is NULL, then a heuristic rule of thumb is + used to get @var{n_percentiles} values for these percentiles. + Notice that @var{n_percentiles} must be at least @code{2}, + otherwise defaults are used. + (Then the first and third quartiles are used by default.) +*/ + +int unur_ars_set_reinit_ncpoints( UNUR_PAR *parameters, int ncpoints ); +/* */ + +int unur_ars_chg_reinit_ncpoints( UNUR_GEN *generator, int ncpoints ); +/* + When reinit fails with the given construction points or the percentiles + of the old hat function, another trial is undertaken with @var{ncpoints} + construction points. @var{ncpoints} must be at least @code{10}. + + Default: @code{30} + */ + +int unur_ars_set_max_iter( UNUR_PAR *parameters, int max_iter ); +/* + The rejection loop stops after @var{max_iter} iterations and return + UNUR_INFINITY. + + Default: @code{10000} +*/ + +int unur_ars_set_verify( UNUR_PAR *parameters, int verify ); +/* */ + +int unur_ars_chg_verify( UNUR_GEN *generator, int verify ); +/* + Turn verifying of algorithm while sampling on/off. + If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is + violated for some @i{x} then @code{unur_errno} is set to + @code{UNUR_ERR_GEN_CONDITION}. However notice that this might + happen due to round-off errors for a few values of + @i{x} (less than 1%). + + Default is FALSE. +*/ + +int unur_ars_set_pedantic( UNUR_PAR *parameters, int pedantic ); +/* + Sometimes it might happen that unur_init() has been executed + successfully. But when additional construction points are added by + adaptive rejection sampling, the algorithm detects that the + PDF is not log-concave. + + With @var{pedantic} being TRUE, the + sampling routine is exchanged by a routine that simply returns + @code{UNUR_INFINITY}. Otherwise the new point is not added to the + list of construction points. At least the hat function remains + log-concave. + + Setting @var{pedantic} to FALSE allows sampling from a + distribution which is ``almost'' log-concave and small errors are + tolerated. However it might happen that the hat function cannot be + improved significantly. When the hat functions that has been + constructed by the unur_init() call is extremely large then it + might happen that the generation times are extremely high + (even hours are possible in extremely rare cases). + + Default is FALSE. +*/ + +double unur_ars_get_loghatarea( const UNUR_GEN *generator ); +/* + Get the logarithm of area below the hat for the generator. + (In case of an error @code{UNUR_INFINITY} is returned.) +*/ + +double unur_ars_eval_invcdfhat( const UNUR_GEN *generator, double u ); +/* + Evaluate the inverse of the CDF of the hat distribution at @var{u}. + + If @var{u} is out of the domain [0,1] then @code{unur_errno} is set + to @code{UNUR_ERR_DOMAIN} and the respective bound of + the domain of the distribution are returned (which is + @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of + unbounded domains). +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/ars_struct.h b/vendor/unuran-1.11.0/src/methods/ars_struct.h new file mode 100644 index 0000000..ffcdf58 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/ars_struct.h @@ -0,0 +1,95 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: ars_struct.h * + * * + * PURPOSE: * + * declares structures for method ARS * + * (Adaptive Rejection Sampling - Gilks & Wild) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_ars_par { + + const double *starting_cpoints; /* pointer to array of starting points */ + int n_starting_cpoints; /* number of construction points at start */ + const double *percentiles; /* percentiles of hat for c. points of new hat */ + int n_percentiles; /* number of percentiles */ + int retry_ncpoints; /* number of cpoints for second trial of reinit */ + + int max_ivs; /* maximum number of intervals */ + int max_iter; /* maximum number of iterations */ +}; + +/*---------------------------------------------------------------------------*/ +/* store data for segments */ + +struct unur_ars_interval { + + double x; /* (left hand side) construction point (cp) */ + double logfx; /* value of logPDF at cp */ + double dlogfx; /* derivative of logPDF at cp */ + double sq; /* slope of transformed squeeze in interval */ + + double Acum; /* cumulated area of intervals */ + double logAhat; /* log of area below hat */ + double Ahatr_fract; /* fraction of area below hat on r.h.s. */ + + struct unur_ars_interval *next; /* pointer to next interval in list */ + +#ifdef DEBUG_STORE_IP + double ip; /* intersection point between two tangents */ +#endif +#ifdef UNUR_COOKIES + unsigned cookie; /* magic cookie */ +#endif +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_ars_gen { + + double Atotal; /* area below hat */ + double logAmax; /* log of maximum area in intervals */ + + struct unur_ars_interval *iv; /* pointer to linked list of intervals */ + int n_ivs; /* number of intervals */ + int max_ivs; /* maximum number of intervals */ + int max_iter; /* maximum number of iterations */ + + double *starting_cpoints; /* pointer to array of starting points */ + int n_starting_cpoints; /* number of construction points at start */ + + double *percentiles; /* percentiles of hat for c. points of new hat */ + int n_percentiles; /* number of percentiles */ + int retry_ncpoints; /* number of cpoints for second trial of reinit */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/auto.c b/vendor/unuran-1.11.0/src/methods/auto.c new file mode 100644 index 0000000..185cfcd --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/auto.c @@ -0,0 +1,457 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: auto.c * + * * + * selects a method for a given distribution object AUTOmatically * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "x_gen.h" +#include "auto.h" +#include "auto_struct.h" + +#include "cstd.h" +#include "dari.h" +#include "dgt.h" +#include "dstd.h" +#include "empk.h" +#include "hist.h" +#include "mvstd.h" +#include "tdr.h" +#include "vempk.h" + +/*---------------------------------------------------------------------------*/ +/* Variants: none */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define AUTO_SET_LOGSS 0x001u + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "AUTO" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_auto_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_init_cont( struct unur_par *par ); +static struct unur_gen *_unur_init_cvec( struct unur_par *par ); +static struct unur_gen *_unur_init_discr( struct unur_par *par ); +static struct unur_gen *_unur_init_cemp( struct unur_par *par ); +static struct unur_gen *_unur_init_cvemp( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize generator object for detected distribution type. */ +/*---------------------------------------------------------------------------*/ + +/* static struct unur_gen *_unur_auto_create( struct unur_par *par ); */ +/* static double _unur_auto_sample( struct unur_gen *gen ); */ +/* static void _unur_auto_free( struct unur_gen *gen); */ +/*---------------------------------------------------------------------------*/ +/* no such functions! */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define PAR ((struct unur_auto_par*)par->datap) /* data for parameter object */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_auto_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... dummy pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /* */ + /* comment: */ + /* for testing. */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL(GENTYPE,distr,NULL); + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_auto_par) ); + COOKIE_SET(par,CK_AUTO_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + par->method = UNUR_METH_AUTO; /* method and default variant */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = par->urng; /* no special auxilliary URNG */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_auto_init; + + return par; + +} /* end of unur_auto_new() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_auto_set_logss( UNUR_PAR *par, int logss ) + /*----------------------------------------------------------------------*/ + /* set common logarithm of sample size */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* logss ... common logarithm of sample size */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, AUTO ); + + if (logss < 0 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"log < 0"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->logss = logss; + + /* changelog */ + par->set |= AUTO_SET_LOGSS; + + return UNUR_SUCCESS; + +} /* end of unur_auto_set_logss() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_auto_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_AUTO ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_AUTO_PAR,NULL); + + /* get distribution type */ + switch (par->distr->type) { + case UNUR_DISTR_CONT: + gen = _unur_init_cont( par ); + break; + case UNUR_DISTR_CVEC: + gen = _unur_init_cvec( par ); + break; + case UNUR_DISTR_DISCR: + gen = _unur_init_discr( par ); + break; + case UNUR_DISTR_CEMP: + gen = _unur_init_cemp( par ); + break; + case UNUR_DISTR_CVEMP: + gen = _unur_init_cvemp( par ); + break; + default: + _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + gen = NULL; + break; + } + + /* copy URNGs and debugging flags */ + if (gen) { + gen->urng = par->urng; + gen->urng_aux = par->urng_aux; + gen->debug = par->debug; + } + + /* free parameters */ + _unur_par_free(par); + + return gen; + +} /* end of _unur_auto_init() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Initialize generator object for detected distribution type **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_init_cont( struct unur_par *par_auto ) + /*----------------------------------------------------------------------*/ + /* initialize new generator for distribution type CONT */ + /* */ + /* parameters: */ + /* par_auto ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + struct unur_gen *gen; + + do { + /* 1st choice: TDR */ + par = unur_tdr_new(par_auto->distr); + gen = unur_init(par); + if (gen) break; + + /* 2nd choice: CSTD */ + par = unur_cstd_new(par_auto->distr); + gen = unur_init(par); + if (gen) break; + + } while (0); + + return gen; +} /* end of _unur_init_cont() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_init_cvec( struct unur_par *par_auto ) + /*----------------------------------------------------------------------*/ + /* initialize new generator for distribution type CVEC */ + /* */ + /* parameters: */ + /* par_auto ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + struct unur_gen *gen; + + /* Choose a method: MVSTD */ + par = unur_mvstd_new(par_auto->distr); + + /* Create generator object */ + gen = unur_init(par); + + return gen; +} /* end of _unur_init_cvec() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_init_discr( struct unur_par *par_auto ) + /*----------------------------------------------------------------------*/ + /* initialize new generator for distribution type DISCR */ + /* */ + /* parameters: */ + /* par_auto ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + struct unur_gen *gen; + + do { + /* 1st choice: DGT */ + if (par_auto->distr->data.discr.pv != NULL) { + par = unur_dgt_new(par_auto->distr); + gen = unur_init(par); + if (gen) break; + } + + /* 2nd choice: DARI */ + if (par_auto->distr->data.discr.pmf != NULL) { + par = unur_dari_new(par_auto->distr); + gen = unur_init(par); + if (gen) break; + /* try again with DGT (in this case we have to compute the PV) */ + par = unur_dgt_new(par_auto->distr); + gen = unur_init(par); + if (gen) break; + } + + /* 3rd choice: DSTD */ + par = unur_dstd_new(par_auto->distr); + gen = unur_init(par); + if (gen) break; + + } while (0); + + return gen; +} /* end of _unur_init_discr() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_init_cemp( struct unur_par *par_auto ) + /*----------------------------------------------------------------------*/ + /* initialize new generator for distribution type CEMP */ + /* */ + /* parameters: */ + /* par_auto ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + struct unur_gen *gen; + + do { + /* 1st choice: EMPK [requires raw data] */ + par = unur_empk_new(par_auto->distr); + gen = unur_init(par); + if (gen) break; + + /* 2nd choice: HIST [requires histogram] */ + par = unur_hist_new(par_auto->distr); + gen = unur_init(par); + if (gen) break; + + } while(0); + + return gen; +} /* end of _unur_init_cemp() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_init_cvemp( struct unur_par *par_auto ) + /*----------------------------------------------------------------------*/ + /* initialize new generator for distribution type CVEMP */ + /* */ + /* parameters: */ + /* par_auto ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + struct unur_gen *gen; + + /* Choose a method: VEMPK */ + par = unur_vempk_new(par_auto->distr); + + /* Create generator object */ + gen = unur_init(par); + + return gen; +} /* end of _unur_init_cvemp() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +/** None **/ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/auto.h b/vendor/unuran-1.11.0/src/methods/auto.h new file mode 100644 index 0000000..e8d7fc4 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/auto.h @@ -0,0 +1,95 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: auto.h * + * * + * PURPOSE: * + * function prototypes for method AUTO * + * (selects a method for a given distribution object AUTOmatically) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD AUTO Select method automatically + + =UP Methods [05] + + =REINIT not implemented + + =DESCRIPTION + AUTO selects a an appropriate method for the given distribution + object automatically. There are no parameters for this method, + yet. But it is planned to give some parameter to describe the + task for which the random variate generator is used for and thus + make the choice of the generating method more appropriate. + Notice that the required sampling routine for the generator + object depends on the type of the given distribution object. + + The chosen method also depends on the sample size for which the + generator object will be used. If only a few random variates + the order of magnitude of the sample size should be set via a + unur_auto_set_logss() call. + + IMPORTANT: This is an experimental version and the method chosen + may change in future releases of UNU.RAN. + + For an example see @ref{Example_0,As short as possible,Example: As short as possible}. + + =HOWTOUSE + Create a generator object for the given distribution object. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_auto_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_auto_set_logss( UNUR_PAR *parameters, int logss ); +/* + Set the order of magnitude for the size of the sample that will be + generated by the generator, i.e., the the common logarithm of the + sample size. + + Default is 10. + + Notice: This feature will be used in future releases of UNU.RAN only. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/auto_struct.h b/vendor/unuran-1.11.0/src/methods/auto_struct.h new file mode 100644 index 0000000..d4f8b8d --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/auto_struct.h @@ -0,0 +1,49 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unif_struct.h * + * * + * PURPOSE: * + * declares structures for method AUTO * + * (selects a method for a given distribution object AUTOmatically) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_auto_par { + int logss; /* logarithm of sample size */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_auto_gen { + int dummy; /* there is no generator object */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/cext.c b/vendor/unuran-1.11.0/src/methods/cext.c new file mode 100644 index 0000000..cc497f7 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/cext.c @@ -0,0 +1,679 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: cext.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: wrapper for external generator * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * CEXT is a wrapper that allows to use external generators within the * + * framework of UNURAN. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "cext.h" +#include "cext_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Variants: none */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "CEXT" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_cext_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_cext_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_cext_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_cext_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_cext_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* There are sampling routines, since every distribution has its own. */ +/* Sampling routines are defined in ../distributions/ for each distributions.*/ +/* double _unur_cext_sample( UNUR_GEN *gen ); does not exist! */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_cext_debug_init( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_cext_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cont /* data for distribution object */ + +#define PAR ((struct unur_cext_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_cext_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_cext_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object (can be NULL!) */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check distribution */ + if (distr != NULL) { + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_cext_par) ); + COOKIE_SET(par,CK_CEXT_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->init = NULL; /* pointer to initialization routine for external generator */ + PAR->sample = NULL; /* pointer to sampling routine for external generator */ + + par->method = UNUR_METH_CEXT; /* method */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for initializing generator */ + par->init = _unur_cext_init; + + return par; + +} /* end of unur_cext_new() */ + +/*****************************************************************************/ + +int +unur_cext_set_init( struct unur_par *par, int (*init)(struct unur_gen *gen) ) + /*----------------------------------------------------------------------*/ + /* set initialization routine for external generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* init ... pointer to initialization routine for external generator */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, CEXT ); + + /* store date */ + PAR->init = init; + + return UNUR_SUCCESS; + +} /* end if unur_cext_set_init() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_cext_set_sample( struct unur_par *par, double (*sample)(struct unur_gen *gen) ) + /*----------------------------------------------------------------------*/ + /* set sampling routine for external generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* sample ... pointer to sampling routine for external generator */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_NULL( GENTYPE, sample, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, CEXT ); + + /* store date */ + PAR->sample = sample; + + return UNUR_SUCCESS; + +} /* end if unur_cext_set_sample() */ + +/*---------------------------------------------------------------------------*/ + +void * +unur_cext_get_params( struct unur_gen *gen, size_t size ) + /*----------------------------------------------------------------------*/ + /* Get pointer to memory block for storing parameters of external */ + /* generator. The memory block is (re-) allocated if necessary. */ + /* If size is set 0, then only the pointer stored in the generator */ + /* object is returned. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* size ... size if the memory block */ + /* */ + /* return: */ + /* pointer to memory block that contains parameters */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, NULL ); + COOKIE_CHECK(gen, CK_CEXT_GEN, NULL); + + /* Is it really necessary to check the method? No! */ + /* if ( gen->method != UNUR_METH_CEXT ) { */ + /* _unur_error((gen)->genid,UNUR_ERR_GEN_INVALID,""); */ + /* return NULL; */ + /* } */ + + if (size && size != GEN->size_param) { + /* allocate memory block */ + GEN->param = _unur_xrealloc(GEN->param, size); + GEN->size_param = size; + } + + return GEN->param; +} /* end of unur_cext_get_params() */ + + +/*---------------------------------------------------------------------------*/ + +double * +unur_cext_get_distrparams( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Get pointer to array of parameters of underlying distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to double array */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + CHECK_NULL(gen, NULL); + COOKIE_CHECK(gen, CK_CEXT_GEN, NULL); + + return DISTR.params; +} /* end of unur_cext_get_distrparams() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_cext_get_ndistrparams( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Get size of array of parameters of underlying distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* length of double array */ + /* */ + /* error: */ + /* return 0 */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + CHECK_NULL(gen, 0); + COOKIE_CHECK(gen, CK_CEXT_GEN, 0); + + return DISTR.n_params; +} /* end of unur_cext_get_ndistrparams() */ + +/*---------------------------------------------------------------------------*/ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_cext_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_CEXT ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; + } + COOKIE_CHECK(par,CK_CEXT_PAR,NULL); + + /* we need a sampling routine */ + if (PAR->sample == NULL) { + _unur_error(GENTYPE,UNUR_ERR_GEN_CONDITION,"sampling routine missing"); + return NULL; + } + + /* create a new empty generator object */ + gen = _unur_cext_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* run special init routine for external generator */ + if (GEN->init != NULL) { + if (GEN->init(gen) != UNUR_SUCCESS) { + /* init failed --> could not find a sampling routine */ + _unur_error(GENTYPE,UNUR_FAILURE,"init for external generator failed"); + _unur_cext_free(gen); return NULL; + } + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_cext_debug_init(gen); +#endif + + /* o.k. */ + return gen; + +} /* end of _unur_cext_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_cext_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* run special init routine for external generator */ + if (GEN->init != NULL) { + if (GEN->init(gen) != UNUR_SUCCESS) { + /* init failed --> could not find a sampling routine */ + _unur_error(GENTYPE,UNUR_FAILURE,"init for external generator failed"); + return UNUR_FAILURE; + } + } + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_cext_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_cext_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + struct unur_distr *distr = NULL; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_CEXT_PAR,NULL); + + /* need a distribution object */ + if (par->distr == NULL) + par->distr = distr = unur_distr_cont_new(); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_cext_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_CEXT_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = PAR->sample; /* will be set in _unur_cext_init() */ + gen->destroy = _unur_cext_free; + gen->clone = _unur_cext_clone; + gen->reinit = _unur_cext_reinit; + + /* copy data */ + GEN->init = PAR->init; + GEN->sample = PAR->sample; + + /* defaults */ + GEN->param = NULL; /* parameters for the generator */ + GEN->size_param = 0; /* size of parameter object */ + + /* clean up */ + if (distr) _unur_distr_free(distr); + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_cext_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_cext_create() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_cext_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_cext_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_CEXT_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* copy parameters for special generators */ + if (GEN->param) { + CLONE->param = _unur_xmalloc( GEN->size_param ); + memcpy( CLONE->param, GEN->param, GEN->size_param ); + } + + return clone; + +#undef CLONE +} /* end of _unur_cext_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_cext_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* magic cookies */ + COOKIE_CHECK(gen,CK_CEXT_GEN,RETURN_VOID); + + /* check input */ + if ( gen->method != UNUR_METH_CEXT ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; + } + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + if (GEN->param) free(GEN->param); + + _unur_generic_free(gen); + +} /* end of _unur_cext_free() */ + +/*****************************************************************************/ + +/** + double _unur_cext_sample( struct unur_gen *gen ) {} + Does not exists !!! + Sampling routines are set by user via unur_cext_set_sample(). +**/ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_cext_debug_init( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_CEXT_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = wrapper for external generator\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + /* distribution */ + _unur_distr_cont_debug( gen->distr, gen->genid ); + +} /* end of _unur_cext_info_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_cext_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + int samplesize = 10000; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info,"\n"); + + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + + /* method */ + _unur_string_append(info,"method: CEXT (wrapper for Continuous EXTernal generators)\n"); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," E [#urn] = %.2f [approx.]\n", + unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize)); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters: none\n"); + _unur_string_append(info,"\n"); + /* Not displayed: + int unur_dext_set_init( UNUR_PAR *parameters, int (*init)(UNUR_GEN *gen) ); + int unur_dext_set_sample( UNUR_PAR *parameters, int (*sample)(UNUR_GEN *gen) ); + */ + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_cext_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/cext.h b/vendor/unuran-1.11.0/src/methods/cext.h new file mode 100644 index 0000000..d09ff9e --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/cext.h @@ -0,0 +1,185 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: cext.h * + * * + * PURPOSE: * + * function prototypes for method CEXT * + * (wrapper for Continuous EXTernal generators) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD CEXT wrapper for Continuous EXTernal generators + + =UP Methods_for_CONT + + =REQUIRED routine for sampling continuous random variates + + =SPEED depends on external generator + + =REINIT supported + + =DESCRIPTION + Method CEXT is a wrapper for external generators for continuous + univariate distributions. It allows the usage of external + random variate generators within the UNU.RAN framework. + + =HOWTOUSE + The following steps are required to use some external generator + within the UNU.RAN framework (some of these are optional): + + @enumerate + @item + Make an empty generator object using a unur_cext_new() call. + The argument @var{distribution} is optional and can be replaced + by NULL. However, it is required if you want to pass + parameters of the generated distribution to the external + generator or for running some validation tests provided by + UNU.RAN. + + @item + Create an initialization routine of type + @code{int (*init)(UNUR_GEN *gen)} and plug it into the generator + object using the unur_cext_set_init() call. Notice that the + @var{init} routine must return @code{UNUR_SUCCESS} when it has + been executed successfully and @code{UNUR_FAILURE} otherwise. + It is possible to get the size of and the pointer to the array + of parameters of the underlying distribution object by the + respective calls unur_cext_get_ndistrparams() and + unur_cext_get_distrparams(). + Parameters for the external generator that are computed in the + @var{init} routine can be stored in a single array or structure + which is available by the unur_cext_get_params() call. + + Using an @var{init} routine is optional and can be omitted. + + @item + Create a sampling routine of type + @code{double (*sample)(UNUR_GEN *gen)} and plug it into the + generator object using the unur_cext_set_sample() call. + + Uniform random numbers are provided by the unur_sample_urng() + call. Do not use your own implementation of a uniform random + number generator directly. If you want to use your own random + number generator we recommend to use the UNU.RAN interface (see + @pxref{URNG,,Using uniform random number generators}). + + The array or structure that contains parameters for the external + generator that are computed in the @var{init} routine are + available using the unur_cext_get_params() call. + + Using a @var{sample} routine is of course obligatory. + @end enumerate + + It is possible to change the parameters and the domain of the + chosen distribution and run unur_reinit() to reinitialize the + generator object. The @var{init} routine is then called again. + + Here is a short example that demonstrates the application of + this method by means of the exponential distribution: + + @smallexample + @include ref_example_cext.texi + @end smallexample + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_cext_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for new generator. +*/ + +/*...........................................................................*/ + +int unur_cext_set_init( UNUR_PAR *parameters, int (*init)(UNUR_GEN *gen) ); +/* + Set initialization routine for external generator. Inside the + + @emph{Important:} The routine @var{init} must return + @code{UNUR_SUCCESS} when the generator was initialized successfully + and @code{UNUR_FAILURE} otherwise. + + Parameters that are computed in the @var{init} routine can be + stored in an array or structure that is avaiable by means of the + unur_cext_get_params() call. Parameters of the underlying + distribution object can be obtained by the + unur_cext_get_distrparams() call. +*/ + +int unur_cext_set_sample( UNUR_PAR *parameters, double (*sample)(UNUR_GEN *gen) ); +/* + Set sampling routine for external generator. + + @emph{Important:} + Use @code{unur_sample_urng(gen)} to get a uniform random number. + The pointer to the array or structure that contains the parameters + that are precomputed in the @var{init} routine are available by + @code{unur_cext_get_params(gen,0)}. + Additionally one can use the unur_cext_get_distrparams() call. +*/ + +void *unur_cext_get_params( UNUR_GEN *generator, size_t size ); +/* + Get pointer to memory block for storing parameters of external + generator. A memory block of size @var{size} is automatically (re-) + allocated if necessary and the pointer to this block is stored in + the @var{generator} object. If one only needs the pointer to this + memory block set @var{size} to @code{0}. + + Notice, that @var{size} is the size of the memory block and not the + length of an array. + + @emph{Important:} This rountine should only be used in the + initialization and sampling routine of the external generator. +*/ + +double *unur_cext_get_distrparams( UNUR_GEN *generator ); +/* */ + +int unur_cext_get_ndistrparams( UNUR_GEN *generator ); +/* + Get size of and pointer to array of parameters of underlying + distribution in @var{generator} object. + + @emph{Important:} These rountines should only be used in the + initialization and sampling routine of the external generator. +*/ + +/*...........................................................................*/ + + +/* =END */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/cext_struct.h b/vendor/unuran-1.11.0/src/methods/cext_struct.h new file mode 100644 index 0000000..5a7db2c --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/cext_struct.h @@ -0,0 +1,54 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: cext_struct.h * + * * + * PURPOSE: * + * declares structures for method CEXT * + * (wrapper for Continuous EXTernal generators) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_cext_par { /* data for external generator */ + int (*init) (UNUR_GEN *gen); /* pointer to initialization routine */ + double (*sample)(UNUR_GEN *gen); /* pointer to sampling routine */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_cext_gen { + int (*init) (UNUR_GEN *gen); /* pointer to initialization routine */ + double (*sample)(UNUR_GEN *gen); /* pointer to sampling routine */ + + void *param; /* parameters for the generator */ + size_t size_param; /* size of parameter object */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/cstd.c b/vendor/unuran-1.11.0/src/methods/cstd.c new file mode 100644 index 0000000..a88d8a9 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/cstd.c @@ -0,0 +1,1027 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: cstd.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: generators for standard distribution * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * CSTD is a wrapper for special generator for Continuous univariate * + * STandarD distributions. It only works for distributions in the UNURAN * + * library of distributions or those continuous distributions that have * + * the inverse CDF implemented. Otherwise it refuses to work. * + * * + * It calls the initialization routine provided by the distribution object. * + * This routine has to do all setup steps for the special generator. * + * If no such routine is given (i.e. distr->init==NULL) or when it does not * + * implement the inversion method then the inverse CDF stored in the * + * distribution object (if available) is used. * + * If neither is available, then unur_cstd_new() does not work and the * + * NULL pointer is returned instead of the pointer to a parameter object. * + * * + * Notice that using a truncated distribution (this can be constructed by * + * changing the default domain of a distribution by means of an * + * unur_distr_cont_set_domain() call) is only allowed if the inversion * + * method is used. Otherwise no parameter object is returned by the * + * unur_cstd_new() call. * + * * + * Variants (different algorithms for the same distribution) are possible * + * and can be selected by unsigned integers using the * + * unur_cstd_set_variant() call. * + * For possible variants see the generator files for each distribution in * + * the distributions directory. However the following are common to all * + * distributions: * + * * + * UNUR_STDGEN_DEFAULT ... the default generator * + * UNUR_STDGEN_INVERSION ... the inversion method (if available) * + * UNUR_STDGEN_FAST ... the fasted available special generator * + * * + * unur_cstd_set_variant() return 0 if a variant is not implemented, and 1 * + * otherwise. In the first case the selected variant is not changed. * + * * + * The domain of a (truncated) distribution can be changed without building * + * a new generator object by means of the unur_cstd_chg_truncated() call. * + * Notice that this only works when the inversion method is used. Otherwise * + * nothing happens to the domain and an error message is produced. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "cstd.h" +#include "cstd_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Variants: none */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define CSTD_DEBUG_GEN 0x00000005u /* print constants for generator */ +#define CSTD_DEBUG_REINIT 0x00000010u /* print params of distr after reinit */ +#define CSTD_DEBUG_CHG 0x00001000u /* print changed params of distr */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define CSTD_SET_VARIANT 0x01u + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "CSTD" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_cstd_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_cstd_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_cstd_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_cstd_check_par( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_cstd_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_cstd_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* There are no sampling routines, since every distribution has its own. */ +/* Sampling routines are defined in ../distributions/ for each distributions.*/ +/* double _unur_cstd_sample( UNUR_GEN *gen ); does not exist! */ +/*---------------------------------------------------------------------------*/ + +static double _unur_cstd_sample_inv( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Generic inversion method. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_cstd_inversion_init( struct unur_par *par, struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Initialize special generator for inversion method. */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_cstd_debug_init( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_cstd_debug_chg_pdfparams( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print new (changed) parameters of distribution */ +/*---------------------------------------------------------------------------*/ + +static void _unur_cstd_debug_chg_truncated( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print new (changed) domain of (truncated) distribution */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_cstd_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cont /* data for distribution object */ + +#define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +#define CDF(x) _unur_cont_CDF((x),(gen->distr)) /* call to CDF */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_cstd_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL(GENTYPE,distr,NULL); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + + if (DISTR_IN.init == NULL && DISTR_IN.invcdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"init() for special generators or inverse CDF"); + return NULL; + } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_cstd_par) ); + COOKIE_SET(par,CK_CSTD_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + par->method = UNUR_METH_CSTD; /* method */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* indicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for initializing generator */ + par->init = _unur_cstd_init; + + return par; + +} /* end of unur_cstd_new() */ + +/*****************************************************************************/ + +int +unur_cstd_set_variant( struct unur_par *par, unsigned variant ) + /*----------------------------------------------------------------------*/ + /* set variant of method */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* variant ... indicator for variant */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + unsigned old_variant; + + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_NULL( GENTYPE, par->distr, UNUR_ERR_NULL ); + _unur_check_par_object( par, CSTD ); + + /* store date */ + old_variant = par->variant; + par->variant = variant; + + /* check variant. run special init routine only in test mode */ + if ( (par->DISTR_IN.init == NULL || par->DISTR_IN.init(par,NULL)!=UNUR_SUCCESS) && + _unur_cstd_inversion_init(par,NULL)!=UNUR_SUCCESS ) { + /* variant not valid */ + _unur_warning(GENTYPE,UNUR_ERR_PAR_VARIANT,""); + par->variant = old_variant; + return UNUR_ERR_PAR_VARIANT; + } + + /* changelog */ + par->set |= CSTD_SET_VARIANT; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end if unur_cstd_set_variant() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_cstd_chg_truncated( struct unur_gen *gen, double left, double right ) + /*----------------------------------------------------------------------*/ + /* change the left and right borders of the domain of the */ + /* (truncated) distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* the new boundary points may be +/- UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double Umin, Umax; + + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, CSTD, UNUR_ERR_GEN_INVALID ); + + /* domain can only be changed for inversion method! */ + if ( ! GEN->is_inversion ) { + /* this is not the inversion method */ + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"truncated domain for non inversion method"); + return UNUR_ERR_GEN_DATA; + } + + /* CDF required ! */ + if (DISTR.cdf == NULL) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"truncated domain, CDF required"); + return UNUR_ERR_GEN_DATA; + } + + /* check new parameter for generator */ + /* (the truncated domain must be a subset of the domain) */ + if (left < DISTR.domain[0]) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain too large"); + left = DISTR.domain[0]; + } + if (right > DISTR.domain[1]) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain too large"); + right = DISTR.domain[1]; + } + + if (left >= right) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"domain, left >= right"); + return UNUR_ERR_DISTR_SET; + } + + /* compute umin and umax */ + Umin = (left > -UNUR_INFINITY) ? CDF(left) : 0.; + Umax = (right < UNUR_INFINITY) ? CDF(right) : 1.; + + /* check result */ + if (Umin > Umax) { + /* this is a serios error that should not happen */ + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + } + + if (_unur_FP_equal(Umin,Umax)) { + /* CDF values very close */ + _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values very close"); + if (_unur_iszero(Umin) || _unur_FP_same(Umax,1.)) { + /* this is very bad */ + _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values at boundary points too close"); + return UNUR_ERR_DISTR_SET; + } + } + + + /* copy new boundaries into generator object */ + DISTR.trunc[0] = left; + DISTR.trunc[1] = right; + GEN->Umin = Umin; + GEN->Umax = Umax; + + /* changelog */ + gen->distr->set |= UNUR_DISTR_SET_TRUNCATED; + + /* indicate that we have a truncated distribution. + (do not have the standard domain any more) */ + gen->distr->set &= ~UNUR_DISTR_SET_STDDOMAIN; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & CSTD_DEBUG_CHG) + _unur_cstd_debug_chg_truncated( gen ); +#endif + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_cstd_chg_truncated() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_cstd_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_CSTD ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; + } + COOKIE_CHECK(par,CK_CSTD_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_cstd_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* run special init routine for generator */ + GEN->is_inversion = FALSE; /* reset flag for inversion method */ + if ( (DISTR.init == NULL || DISTR.init(NULL,gen)!=UNUR_SUCCESS) && + _unur_cstd_inversion_init(NULL,gen)!=UNUR_SUCCESS ) { + /* init failed --> could not find a sampling routine */ + _unur_error(GENTYPE,UNUR_ERR_GEN_DATA,"variant for special generator"); + _unur_cstd_free(gen); return NULL; + } + + /* check parameters */ + if (_unur_cstd_check_par(gen) != UNUR_SUCCESS) { + _unur_cstd_free(gen); return NULL; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_cstd_debug_init(gen); +#endif + + /* o.k. */ + return gen; + +} /* end of _unur_cstd_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_cstd_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int rcode; + + /* run special init routine for generator */ + GEN->is_inversion = FALSE; /* reset flag for inversion method */ + if ( (DISTR.init == NULL || DISTR.init(NULL,gen)!=UNUR_SUCCESS) && + _unur_cstd_inversion_init(NULL,gen)!=UNUR_SUCCESS ) { + /* init failed --> could not find a sampling routine */ + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"parameters"); + return UNUR_ERR_GEN_DATA; + } + + /* check parameters */ + if ( (rcode = _unur_cstd_check_par(gen)) != UNUR_SUCCESS) + return rcode; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & CSTD_DEBUG_REINIT) + _unur_cstd_debug_chg_pdfparams( gen ); +#endif + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_cstd_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_cstd_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_CSTD_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_cstd_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_CSTD_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = NULL; /* will be set in _unur_cstd_init() */ + gen->destroy = _unur_cstd_free; + gen->clone = _unur_cstd_clone; + gen->reinit = _unur_cstd_reinit; + + /* defaults */ + GEN->gen_param = NULL; /* parameters for the generator */ + GEN->n_gen_param = 0; /* (computed in special GEN->init() */ + GEN->is_inversion = FALSE; /* method not based on inversion */ + GEN->sample_routine_name = NULL ; /* name of sampling routine */ + + /* copy some parameters into generator object */ + GEN->Umin = 0.; /* cdf at left boundary of domain */ + GEN->Umax = 1.; /* cdf at right boundary of domain */ + + /* GEN->is_inversion is set in _unur_cstd_inversion_init() */ + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_cstd_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_cstd_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_cstd_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* domain valid for special generator ?? */ + if (!(gen->distr->set & UNUR_DISTR_SET_STDDOMAIN)) { + /* domain has been modified */ + gen->distr->set &= UNUR_DISTR_SET_TRUNCATED; + DISTR.trunc[0] = DISTR.domain[0]; + DISTR.trunc[1] = DISTR.domain[1]; + + if ( ! GEN->is_inversion ) { + /* this is not the inversion method */ + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"domain changed for non inversion method"); + return UNUR_ERR_GEN_DATA; + } + + if (DISTR.cdf == NULL) { + /* using a truncated distribution requires a CDF */ + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"domain changed, CDF required"); + return UNUR_ERR_GEN_DATA; + } + + /* compute Umin and Umax */ + GEN->Umin = (DISTR.trunc[0] > -UNUR_INFINITY) ? CDF(DISTR.trunc[0]) : 0.; + GEN->Umax = (DISTR.trunc[1] < UNUR_INFINITY) ? CDF(DISTR.trunc[1]) : 1.; + } + + return UNUR_SUCCESS; +} /* end of _unur_cstd_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_cstd_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_cstd_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_CSTD_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* copy parameters for special generators */ + if (GEN->gen_param) { + CLONE->gen_param = _unur_xmalloc( GEN->n_gen_param * sizeof(double) ); + memcpy( CLONE->gen_param, GEN->gen_param, GEN->n_gen_param * sizeof(double) ); + } + + return clone; + +#undef CLONE +} /* end of _unur_cstd_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_cstd_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* magic cookies */ + COOKIE_CHECK(gen,CK_CSTD_GEN,RETURN_VOID); + + /* check input */ + if ( gen->method != UNUR_METH_CSTD ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; + } + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + if (GEN->gen_param) free(GEN->gen_param); + + _unur_generic_free(gen); + +} /* end of _unur_cstd_free() */ + +/*****************************************************************************/ + +/** + double _unur_cstd_sample( struct unur_gen *gen ) {} + Does not exists !!! + Sampling routines are defined in ../distributions/ for each distributions. +**/ + +/*****************************************************************************/ + +double +_unur_cstd_sample_inv( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* generic inversion method. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U; + + if (!DISTR.invcdf) return UNUR_INFINITY; + + /* sample from uniform random number generator */ + while (_unur_iszero(U = GEN->Umin + _unur_call_urng(gen->urng) * (GEN->Umax-GEN->Umin))); + + /* compute inverse CDF */ + return (DISTR.invcdf(U,gen->distr)); + +} /* _unur_cstd_sample_inv() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_cstd_eval_invcdf( const struct unur_gen *gen, double u ) + /*----------------------------------------------------------------------*/ + /* evaluate inverse CDF at u. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* u ... argument for inverse CDF (0<=u<=1, no validation!) */ + /* */ + /* return: */ + /* double (inverse CDF) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double x; + + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + if ( gen->method != UNUR_METH_CSTD ) { + _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); + return UNUR_INFINITY; + } + COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); + + if (!DISTR.invcdf) { + /* no inverse CDF available */ + _unur_error(gen->genid,UNUR_ERR_NO_QUANTILE,"inversion CDF required"); + return UNUR_INFINITY; + } + + if ( ! (u>0. && u<1.)) { + if ( ! (u>=0. && u<=1.)) { + _unur_warning(gen->genid,UNUR_ERR_DOMAIN,"U not in [0,1]"); + } + if (u<=0.) return DISTR.trunc[0]; + if (u>=1.) return DISTR.trunc[1]; + return u; /* = NaN */ + } + + /* rescale given u */ + u = GEN->Umin + u * (GEN->Umax - GEN->Umin); + + /* compute inverse CDF */ + x = DISTR.invcdf(u,gen->distr); + + /* validate range */ + if (xDISTR.trunc[1]) x = DISTR.trunc[1]; + + return x; + +} /* end of unur_cstd_eval_invcdf() */ + + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_cstd_inversion_init( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize special generator for inversion method */ + /* when inverse CDF is available for the distribution. */ + /* if gen == NULL then only check existance of variant. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* one of par and gen must not be the NULL pointer */ + switch ((par) ? par->variant : gen->variant) { + + case 0: /* DEFAULT */ + case UNUR_STDGEN_INVERSION: /* inversion method */ + if (gen) { + if (DISTR.invcdf) { + GEN->is_inversion = TRUE; + _unur_cstd_set_sampling_routine(gen,_unur_cstd_sample_inv); + return UNUR_SUCCESS; + } + } + else { + if ((par->distr->data.cont).invcdf) { + return UNUR_SUCCESS; + } + } + + /* FALLTHROUGH */ + default: /* no such generator */ + if (gen) _unur_warning(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_FAILURE; + } + +} /* end of _unur_cstd_inversion_init() */ + +/*---------------------------------------------------------------------------*/ + + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_cstd_debug_init( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int i; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_CSTD_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = generator for standard distribution\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + /* distribution */ + _unur_distr_cont_debug( gen->distr, gen->genid ); + + /* sampling routine */ + fprintf(LOG,"%s: sampling routine = ",gen->genid); + if (GEN->sample_routine_name) + fprintf(LOG,"%s()",GEN->sample_routine_name); + else + fprintf(LOG,"(Unknown)"); + if (GEN->is_inversion) + fprintf(LOG," (Inversion)"); + fprintf(LOG,"\n%s:\n",gen->genid); + + /* table of precomputed constants for special generators */ + if (gen->debug & CSTD_DEBUG_GEN) { + fprintf(LOG,"%s: precomputed constants for routine: ",gen->genid); + if (GEN->gen_param) { + fprintf(LOG,"%d\n",GEN->n_gen_param); + for (i=0; i < GEN->n_gen_param; i++) + fprintf(LOG,"%s:\t[%d] = %g\n",gen->genid,i,GEN->gen_param[i]); + } + else { + fprintf(LOG,"none\n"); + } + fprintf(LOG,"%s:\n",gen->genid); + } + + /* truncated domain ? */ + if (!(gen->distr->set & UNUR_DISTR_SET_STDDOMAIN)) { + fprintf(LOG,"%s: domain has been changed. U in (%g,%g)\n",gen->genid,GEN->Umin,GEN->Umax); + fprintf(LOG,"%s:\n",gen->genid); + } + + fflush(LOG); + +} /* end of _unur_cstd_debug_init() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_cstd_debug_chg_pdfparams( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* print new (changed) parameters of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int i; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_CSTD_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: parameters of distribution changed:\n",gen->genid); + for( i=0; igenid,i,DISTR.params[i]); + if (gen->distr->set & UNUR_DISTR_SET_TRUNCATED) + fprintf(LOG,"%s:\tU in (%g,%g)\n",gen->genid,GEN->Umin,GEN->Umax); + +} /* end of _unur_cstd_debug_chg_pdfparams() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_cstd_debug_chg_truncated( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* print new (changed) domain of (truncated) distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_CSTD_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: domain of truncated distribution changed:\n",gen->genid); + fprintf(LOG,"%s:\tdomain = (%g, %g)\n",gen->genid, DISTR.trunc[0], DISTR.trunc[1]); + fprintf(LOG,"%s:\tU in (%g,%g)\n",gen->genid,GEN->Umin,GEN->Umax); + +} /* end of _unur_cstd_debug_chg_truncated() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_cstd_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + int samplesize = 10000; + int i; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info,"\n"); + + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + + /* method */ + _unur_string_append(info,"method: CSTD (special generator for Continuous STandarD distribution)\n"); + _unur_string_append(info," variant = %d %s\n", gen->variant, + (GEN->is_inversion)?"[implements inversion method]" : ""); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," E [#urn] = %.2f [approx.]\n", + unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize)); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + _unur_string_append(info," variant = %d %s\n", gen->variant, + (gen->set & CSTD_SET_VARIANT) ? "" : "[default]"); + _unur_string_append(info,"\n"); + } + + /* tables */ + if (help) { + _unur_string_append(info,"table of precomputed constants: "); + if (GEN->gen_param) { + _unur_string_append(info,"%d\n",GEN->n_gen_param); + for (i=0; i < GEN->n_gen_param; i++) + _unur_string_append(info," [%d] = %g\n",i,GEN->gen_param[i]); + } + else { + _unur_string_append(info,"none\n"); + } + _unur_string_append(info,"\n"); + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_cstd_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/cstd.h b/vendor/unuran-1.11.0/src/methods/cstd.h new file mode 100644 index 0000000..ac64a5a --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/cstd.h @@ -0,0 +1,192 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: cstd.h * + * * + * PURPOSE: * + * function prototypes for method CSTD * + * (wrapper for special generators for * + * Continuous STanDard distributions) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD CSTD Continuous STandarD distributions + + =UP Methods_for_CONT + + =REQUIRED standard distribution from UNU.RAN library + (@pxref{Stddist,,Standard distributions}) or continuous + distribution with inverse CDF. + + =SPEED Set-up: fast, Sampling: depends on distribution and generator + + =REINIT supported + + =DESCRIPTION + CSTD is a wrapper for special generators for continuous + univariate standard distributions. It only works for + distributions in the UNU.RAN library of standard distributions + (@pxref{Stddist,,Standard distributions}) + or for continuous distributions where the inverse CDF is given. + If a distribution object is provided that is build from scratch, + it must provide the inverse CDF. Then CSTD implements the + inversion method. Otherwise, the NULL pointer is returned. + + For some distributions more than one special generator + is possible. + + =HOWTOUSE + Create a distribution object for a standard distribution + from the UNU.RAN library + (@pxref{Stddist,,Standard distributions}), + or create a continuous distribution object and set the function + for the inverse CDF using unur_distr_cont_set_invcdf(). + For some distributions more than one special generator + (@emph{variants}) is possible. These can be choosen by a + unur_cstd_set_variant() call. For possible variants + @pxref{Stddist,,Standard distributions}. + However the following are common to all distributions: + + @table @code + @item UNUR_STDGEN_DEFAULT + the default generator. + @item UNUR_STDGEN_FAST + the fastest available special generator. + @item UNUR_STDGEN_INVERSION + the inversion method (if available). + @end table + + Notice that the variant @code{UNUR_STDGEN_FAST} for a special + generator may be slower than one of the universal algorithms! + Additional variants may exist for particular distributions. + + Sampling from truncated distributions (which can be constructed by + changing the default domain of a distribution by means of + unur_distr_cont_set_domain() or unur_cstd_chg_truncated() calls) + is possible but requires the inversion method. Moreover the CDF + of the distribution must be implemented. + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Common variants for all special generators */ + +#define UNUR_STDGEN_DEFAULT 0 /* default algorithm (don't change 0!)*/ +#define UNUR_STDGEN_INVERSION (~0u) /* inversion method */ +#define UNUR_STDGEN_FAST (0) /* fastest algorithm */ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_cstd_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for new generator. It requires a distribution object + for a continuous univariant distribution from the + UNU.RAN library of standard distributions + (@pxref{Stddist,,Standard distributions}). + + Using a truncated distribution is allowed only if the inversion method + is available and selected by the unur_cstd_set_variant() call immediately + after creating the parameter object. + Use a unur_distr_cont_set_domain() call to get a truncated distribution. + To change the domain of a (truncated) distribution of a generator use the + unur_cstd_chg_truncated() call. +*/ + +/*...........................................................................*/ + +int unur_cstd_set_variant( UNUR_PAR *parameters, unsigned variant ); +/* + Set variant (special generator) for sampling from a given distribution. + For possible variants + @pxref{Stddist,,Standard distributions}. + + Common variants are @code{UNUR_STDGEN_DEFAULT} for the default generator, + @code{UNUR_STDGEN_FAST} for (one of the) fastest implemented + special generators, and @code{UNUR_STDGEN_INVERSION} for the + inversion method (if available). + If the selected variant number is not implemented, then an error code is + returned and the variant is not changed. +*/ + +/*...........................................................................*/ + +int unur_cstd_chg_truncated( UNUR_GEN *generator, double left, double right ); +/* + Change left and right border of the domain of the (truncated) distribution. + This is only possible if the inversion method is used. + Otherwise this call has no effect and an error code is returned. + + Notice that the given truncated domain must be a subset of the + domain of the given distribution. The generator always uses the + intersection of the domain of the distribution and the truncated + domain given by this call. + + It is not required to run unur_reinit() after this call has been used. + + @emph{Important:} If the CDF is (almost) the same for @var{left} and + @var{right} and (almost) equal to @code{0} or @code{1}, then the truncated + domain is not chanced and the call returns an error code. + + @emph{Notice:} If the parameters of the distribution has been changed + it is recommended to set the truncated domain again, since the + former call might change the domain of the distribution but not + update the values for the boundaries of the truncated + distribution. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ + +/* Yet not documented! */ + +double unur_cstd_eval_invcdf( const UNUR_GEN *generator, double u ); +/* + Evaluate inverse CDF at @var{u}. However, this requires that + @var{generator} implements an inversion method. + If @var{u} is out of the domain [0,1] then @code{unur_errno} is set + to @code{UNUR_ERR_DOMAIN} and the respective bound of + the domain of the distribution are returned (which is + @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of + unbounded domains). + + @emph{Notice}: When the domain has been truncated by a + unur_cstd_chg_truncated() call then the inverse CDF of the + truncated distribution is returned. +*/ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/methods/cstd_struct.h b/vendor/unuran-1.11.0/src/methods/cstd_struct.h new file mode 100644 index 0000000..9b1a38c --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/cstd_struct.h @@ -0,0 +1,59 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: cstd_struct.h * + * * + * PURPOSE: * + * declares structures for method CSTD * + * (wrapper for special generators for * + * Continuous STanDard distributions) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_cstd_par { + int dummy; /* no special parameters */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_cstd_gen { + double *gen_param; /* parameters for the generator */ + int n_gen_param; /* number of parameters for the generator */ + + int flag; /* sometimes it is convenient to have a flag */ + + double Umin; /* cdf at left boundary of domain */ + double Umax; /* cdf at right boundary of domain */ + + int is_inversion; /* indicate whether method is inversion method */ + const char *sample_routine_name; /* name of sampling routine */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/dari.c b/vendor/unuran-1.11.0/src/methods/dari.c new file mode 100644 index 0000000..e8cf2e9 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dari.c @@ -0,0 +1,1264 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dari.c * + * * + * TYPE: discrete univariate random variate * + * METHOD: discrete automatic rejection inversion * + * * + * DESCRIPTION: * + * Given PMF of a T(-1/2)-concave distribution; * + * produce a value x consistent with its PMF. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Hoermann W. and G.Derflinger (1997): * + * An automatic generator for a large class of discrete unimodal * + * distributions, in A.R. Kaylan and A. Lehmann, ESM 97, pp 139-144 * + * * + * [2] Hoermann W. and G.Derflinger (1996): * + * Rejection-inversion to generate variates from monotone discrete * + * distributions, ACM TOMACS 6(3), 169-184 * + * * + ***************************************************************************** + * * + * ..... beschreibung .... * + * * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "dari.h" +#include "dari_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Variants */ + +#define DARI_VARFLAG_VERIFY 0x01u /* flag for verifying mode */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define DARI_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define DARI_SET_CFACTOR 0x001u +#define DARI_SET_TABLESIZE 0x002u + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "DARI" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dari_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dari_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dari_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dari_check_par( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dari_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_dari_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dari_sample( struct unur_gen *gen ); +static int _unur_dari_sample_check( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dari_hat( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* compute hat. */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_dari_debug_init( struct unur_gen *gen, const char *status ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_dari_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.discr /* data for distribution object */ + +#define PAR ((struct unur_dari_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_dari_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.discr /* data for distribution in generator object */ + +#define BD_LEFT domain[0] /* left boundary of domain of distribution */ +#define BD_RIGHT domain[1] /* right boundary of domain of distribution */ + +#define SAMPLE gen->sample.discr /* pointer to sampling routine */ + +#define PMF(x) _unur_discr_PMF((x),(gen->distr)) /* call to PMF */ + +/*---------------------------------------------------------------------------*/ + +#define T(x) (-1./sqrt(x)) /* transformation for PMF */ +#define F(x) (-1./(x)) /* anti-derivative of inverse transformation */ +#define FM(x) (-1./(x)) /* inverse of anti-derivative */ +#define N0 (GEN->n[0]) /* first position in table */ + +/*---------------------------------------------------------------------------*/ + +#define _unur_dari_getSAMPLE(gen) \ + ( ((gen)->variant & DARI_VARFLAG_VERIFY) \ + ? _unur_dari_sample_check : _unur_dari_sample ) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_dari_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /* */ + /* comment: */ + /* if the sum over the PMF is not close to 1 it is necessary to */ + /* set pmf_sum to an approximate value of its sum (+/- 30 % is ok). */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_DISCR) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_DISCR,NULL); + + if (DISTR_IN.pmf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PMF"); + return NULL; + } + + if (DISTR_IN.domain[0] < 0) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_PROP,"domain contains negative numbers"); + return NULL; + } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_dari_par) ); + COOKIE_SET(par,CK_DARI_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->c_factor = 0.664; + /* optimal value for the normal distribution, which is good for all */ + /* bell-shaped densities. The minimax approach for that transformation */ + /* has c_factor = 2. */ + + PAR->squeeze = 0; /* no squeezes by default as squeezes slow down the */ + /* sampling for most distributions if PAR->size is big enough. Squeeze is */ + /* important for the speed only when small samples are required or when */ + /* the domain of the distribution is very big. (much bigger than PAR->size) */ + + PAR->size = 100; /*size of table that stores the "rejection point" for */ + /* all integers close to the mode when needed the first time while */ + /* sampling; can speed up the generation considerably. */ + + par->method = UNUR_METH_DARI; /* method */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_dari_init; + + return par; + +} /* end of unur_dari_new() */ + +/*****************************************************************************/ + +int +unur_dari_set_cpfactor( struct unur_par *par, double cpfactor ) + /*----------------------------------------------------------------------*/ + /* set factor for position of left and right construction point */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* cfactor ... factor */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, DARI ); + + /* check new parameter for generator */ + /** TODO: welche werte fuer c sind zulaessig / sinnvoll ? + zulaessig ist jedes c>0, man koennte damit falsche Flaechenangaben kompensieren. + Wenn sum genau bekannt ist, ist ein c > 2 (2 ist der minimax approach) so weit + ich weiss nie sinnvoll. Ich denke aber, das sollte man besser nicht prinzipiell + verbieten, hoechstens eine warnung.**/ + if (cpfactor <= 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"cp-factor <= 0"); + return UNUR_ERR_PAR_SET; + } + + if (cpfactor > 2.1) + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"cp-factor > 2 not recommended. skip"); + + /* store date */ + PAR->c_factor = cpfactor; + + /* changelog */ + par->set |= DARI_SET_CFACTOR; + + return UNUR_SUCCESS; + +} /* end of unur_dari_set_cpfactor() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dari_set_squeeze( struct unur_par *par, int squeeze ) + /*----------------------------------------------------------------------*/ + /* turn on/off using squeezes */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* squeeze ... 0 = no squeeze, !0 = use squeeze */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, DARI ); + + /* store data */ + PAR->squeeze = squeeze; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_dari_set_squeeze() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dari_set_tablesize( struct unur_par *par, int size ) + /*----------------------------------------------------------------------*/ + /* set size of table */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* size ... table size */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, DARI ); + + /* check parameter */ + if (size < 0) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"invalid table size"); + return UNUR_ERR_PAR_SET; + } + + /* store data */ + PAR->size = size; + + /* changelog */ + par->set |= DARI_SET_TABLESIZE; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_dari_set_tablesize() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dari_set_verify( struct unur_par *par, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, DARI ); + + /* we use a bit in variant */ + par->variant = (verify) ? (par->variant | DARI_VARFLAG_VERIFY) : (par->variant & (~DARI_VARFLAG_VERIFY)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_dari_set_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dari_chg_verify( struct unur_gen *gen, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, DARI, UNUR_ERR_GEN_INVALID ); + + /* we must not change this switch when sampling has been disabled by + using a pointer to the error producing routine */ + if (SAMPLE == _unur_sample_discr_error) + return UNUR_FAILURE; + + if (verify) + /* turn verify mode on */ + gen->variant |= DARI_VARFLAG_VERIFY; + else + /* turn verify mode off */ + gen->variant &= ~DARI_VARFLAG_VERIFY; + + SAMPLE = _unur_dari_getSAMPLE(gen); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_dari_chg_verify() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_dari_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + _unur_check_NULL( GENTYPE, par, NULL ); + + /* check input */ + if ( par->method != UNUR_METH_DARI ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_DARI_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_dari_create(par); + + /* free parameters */ + _unur_par_free(par); + + if (!gen) return NULL; + + /* check parameters */ + if (_unur_dari_check_par(gen) != UNUR_SUCCESS) { + _unur_dari_free(gen); return NULL; + } + + /* create hat and squeeze (setup procedure) */ + if ( _unur_dari_hat(gen)!=UNUR_SUCCESS ) { + /* error */ + _unur_dari_free(gen); return NULL; + } + + /* hat successfully created */ +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_dari_debug_init(gen,"INIT completed"); +#endif + + /* o.k. */ + return gen; + +} /* end of _unur_dari_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_dari_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int result; + + /* check parameters */ + if ( (result = _unur_dari_check_par(gen)) != UNUR_SUCCESS) + return result; + + /* compute hat */ + if ( (result = _unur_dari_hat( gen )) != UNUR_SUCCESS) + return result; + + /* (re)set sampling routine */ + SAMPLE = _unur_dari_getSAMPLE(gen); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & DARI_DEBUG_REINIT) + _unur_dari_debug_init(gen,"REINIT completed"); +#endif + + /* hat successfully created */ + return UNUR_SUCCESS; +} /* end of _unur_dari_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_dari_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_DARI_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_dari_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_DARI_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_dari_getSAMPLE(gen); + gen->destroy = _unur_dari_free; + gen->clone = _unur_dari_clone; + gen->reinit = _unur_dari_reinit; + + /* copy some parameters into generator object */ + GEN->squeeze = PAR->squeeze; /* squeeze yes/no? */ + GEN->c_factor = PAR->c_factor; /* constant for choice of design point */ + + /* size of auxiliary table; 0 for none + it cannot be larger than the given domain (avoid overflow) */ + if ((unsigned)DISTR.BD_RIGHT - (unsigned)DISTR.BD_LEFT < INT_MAX) + GEN->size = _unur_min(PAR->size,DISTR.BD_RIGHT-DISTR.BD_LEFT+1); + else /* length of interval > INT_MAX */ + GEN->size = PAR->size; + + /* allocate */ + GEN->hp = (GEN->size > 0) ? _unur_xmalloc( GEN->size * sizeof(double) ) : NULL; + GEN->hb = (GEN->size > 0) ? _unur_xmalloc( GEN->size * sizeof(char) ) : NULL; + + /* initialize parameters */ + GEN->vt=0.; /* total volume below hat */ + GEN->vc=0.; /* volume below center part */ + GEN->vcr=0.; /* volume center and right together */ + + GEN->xsq[0]=0.; /* value necessary for the squeeze computation */ + GEN->xsq[1]=0.; /* value necessary for the squeeze computation */ + GEN->y[0]=0.; /* value of the transformed density in points of contact */ + GEN->y[1]=0.; /* value of the transformed density in points of contact */ + GEN->ys[0]=0.; /* the slope of the transformed hat */ + GEN->ys[1]=0.; /* the slope of the transformed hat */ + GEN->ac[0]=0.; /* left and right starting point of the uniform hat + in the center */ + GEN->ac[1]=0.; /* left and right starting point of the uniform hat + in the center */ + + GEN->pm=0.; /* mode probability */ + GEN->Hat[0]=0.; /* point where the hat starts for the left and + the right tail */ + GEN->Hat[1]=0.; /* point where the hat starts for the left and + the right tail */ + + GEN->m=0; /* mode */ + GEN->x[0]=0; /* points of contact left and right of the mode */ + GEN->x[1]=0; /* points of contact left and right of the mode */ + GEN->s[0]=0; /* first and last integer of the center part */ + GEN->s[1]=0; /* first and last integer of the center part */ + GEN->n[0]=0; /* contains the first and the last i + for which values are stored in table */ + GEN->n[1]=0; /* contains the first and the last i + for which values are stored in table */ + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_dari_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_dari_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_dari_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check for required data: mode */ + if (!(gen->distr->set & UNUR_DISTR_SET_MODE)) { + _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode: try finding it (numerically)"); + if (unur_distr_discr_upd_mode( gen->distr )!=UNUR_SUCCESS) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode"); + return UNUR_ERR_DISTR_REQUIRED; + } + } + + /* check mode. we assume unimodality + since otherwise the PMF would not be T-concave! */ + if (DISTR.BD_LEFT > DISTR.mode) + DISTR.mode = DISTR.BD_LEFT; + else if (DISTR.BD_RIGHT < DISTR.mode) + DISTR.mode = DISTR.BD_RIGHT; + + /* check for required data: sum over PMF */ + if (!(gen->distr->set & UNUR_DISTR_SET_PMFSUM)) + if (unur_distr_discr_upd_pmfsum(gen->distr)!=UNUR_SUCCESS) + _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"sum over PMF; use default"); + + /* sum must not be zero */ + if (DISTR.sum <= 0.) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"sum <= 0"); + return UNUR_ERR_GEN_DATA; + } + + return UNUR_SUCCESS; +} /* end of _unur_dari_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_dari_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_dari_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_DARI_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* copy additional data */ + if (GEN->size > 0) { + CLONE->hp = _unur_xmalloc( GEN->size * sizeof(double) ); + memcpy( CLONE->hp, GEN->hp, GEN->size * sizeof(double) ); + CLONE->hb = _unur_xmalloc( GEN->size * sizeof(char) ); + memcpy( CLONE->hb, GEN->hb, GEN->size * sizeof(char) ); + } + + return clone; + +#undef CLONE +} /* end of _unur_dari_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_dari_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_DARI ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_DARI_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free two auxiliary tables */ + if (GEN->hp) free(GEN->hp); + if (GEN->hb) free(GEN->hb); + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_dari_free() */ + +/*****************************************************************************/ + +int +_unur_dari_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return INT_MAX */ + /*----------------------------------------------------------------------*/ +{ + double U, h; + double X = 0.; + int k,i; + static const int sign[2] = {-1,1}; + + /* check arguments */ + CHECK_NULL(gen,INT_MAX); COOKIE_CHECK(gen,CK_DARI_GEN,INT_MAX); + + /* step 1.0 */ + while (1) { + U = _unur_call_urng(gen->urng) * GEN->vt; + + /* step 1.1 */ + if (U<=GEN->vc) { + X = U * (GEN->ac[1]-GEN->ac[0]) / GEN->vc + GEN->ac[0]; + k = (int)(X+0.5); + i = (km) ? 0 : 1; + if (GEN->squeeze && sign[i]*(GEN->ac[i]-GEN->s[i]) > sign[i]*(X-k)) + return k; + if (sign[i]*k <= sign[i]*GEN->n[i]) { + if (!GEN->hb[k-N0]) { + GEN->hp[k-N0] = 0.5 - PMF(k)/GEN->pm; + GEN->hb[k-N0] = 1; + } + h = GEN->hp[k-N0]; + } + else { + h = 0.5-PMF(k)/GEN->pm; + } + if (h <= sign[i]*(k-X)) + return k; + } + + /*step 1.2*/ + else { + if (U<= GEN->vcr) { + i = 1; + U -= GEN->vc; + } + else { + i = 0; + U -= GEN->vcr; + } + + U = GEN->Hat[i] + sign[i]*U; + X = GEN->x[i] + (FM(U*GEN->ys[i])-GEN->y[i]) / GEN->ys[i]; + k = (int)(X+0.5); + + if (GEN->squeeze && (sign[i]*k <= sign[i]*GEN->x[i]+1) && (GEN->xsq[i] <= sign[i]*(X-k))) + return k; + + if (sign[i]*k <= sign[i]*GEN->n[i]) { + if (!GEN->hb[k-N0]) { + GEN->hp[k-N0] = sign[i] * F(GEN->y[i]+GEN->ys[i]*(k+sign[i]*0.5-GEN->x[i])) / GEN->ys[i] - PMF(k); + GEN->hb[k-N0] = 1; + } + h = GEN->hp[k-N0]; + } + else { + h = sign[i] * F(GEN->y[i]+GEN->ys[i]*(k+sign[i]*0.5-GEN->x[i])) / GEN->ys[i]-PMF(k); + } + if (sign[i]*U >= h) + return k; + } + } +} /* end of _unur_dari_sample() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_dari_sample_check( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return INT_MAX */ + /*----------------------------------------------------------------------*/ +{ + double U, h; + double X = 0.; + double hkm05; + int k,i; + static const int sign[2] = {-1,1}; + + /* check arguments */ + CHECK_NULL(gen,INT_MAX); COOKIE_CHECK(gen,CK_DARI_GEN,INT_MAX); + + /* step 1.0 */ + while (1) { + U = _unur_call_urng(gen->urng) * GEN->vt; + + /* step 1.1 */ + if (U <= GEN->vc) { + X = U * (GEN->ac[1]-GEN->ac[0]) / GEN->vc + GEN->ac[0]; + k = (int)(X+0.5); + i = (km) ? 0 : 1; + if (GEN->squeeze && sign[i]*(GEN->ac[i]-GEN->s[i]) > sign[i]*(X-k)) + return k; + if (sign[i]*k <= sign[i]*GEN->n[i]) { + if (!GEN->hb[k-N0]) { + GEN->hp[k-N0] = 0.5 - PMF(k)/GEN->pm; + GEN->hb[k-N0] = 1; + } + h = GEN->hp[k-N0]; + /* CHECKING HAT */ + if (h+UNUR_EPSILON*100.<-0.5) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, + "PMF(i) > hat(i) for centerpart"); + _unur_log_printf(gen->genid,__FILE__,__LINE__, + "i %d PMF(x) %.20e hat(x) %.20e", k,PMF(k),GEN->pm ); + } + /* end CHECKING HAT */ + } + else { + h = 0.5 - PMF(k)/GEN->pm; + /* CHECKING HAT */ + /* here UNUR_EPSILON can be too small for distributions that + have two neighbouring hats. */ + if (h+UNUR_EPSILON*100.<-0.5) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, + "PMF(i) > hat(i) for centerpart"); + _unur_log_printf(gen->genid,__FILE__,__LINE__, + "i %d PMF(x) %.20e hat(x) %.20e", k,PMF(k),GEN->pm ); + } + /* end CHECKING HAT */ + } + if (h <= sign[i]*(k-X)) + return k; + } + + /*step 1.2*/ + else { + if (U<= GEN->vcr) { + i = 1; + U -= GEN->vc; + } + else { + i = 0; + U -= GEN->vcr; + } + + U = GEN->Hat[i] + sign[i]*U; + X = GEN->x[i] + (FM(U*GEN->ys[i])-GEN->y[i]) / GEN->ys[i]; + k = (int)(X+0.5); + /* this is for a very rare case that for k of the tail closest to + the mode an x value farer away than 0.5 is generated. */ + if(k==GEN->s[i]) + k += sign[i]; + + if (GEN->squeeze && (sign[i]*k <= sign[i]*GEN->x[i]+1) && (GEN->xsq[i] <= sign[i]*(X-k))) + return k; + + if (sign[i]*k <= sign[i]*GEN->n[i]) { + if(!GEN->hb[k-N0]) { + GEN->hp[k-N0] = sign[i] * F(GEN->y[i]+GEN->ys[i]*(k+sign[i]*0.5-GEN->x[i])) / GEN->ys[i] - PMF(k); + + /* CHECKING HAT: (only necessary if(k!=GEN->s+1) as for the border + the hat is by construction correct) + tests if Hat too low i.e.: (H(k+0.5)- p_k < H(k-0.5)) */ + if(k != GEN->s[i]+sign[i]) { + hkm05 = sign[i] * F(GEN->y[i]+GEN->ys[i]*(k-sign[i]*0.5-GEN->x[i])) / GEN->ys[i]; + if (GEN->hp[k-N0]+UNUR_EPSILON < hkm05) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, + "for tailpart hat too low, ie hp[k] < H(k-0.5)"); + _unur_log_printf(gen->genid,__FILE__,__LINE__, + "k %d hp %.20e H(k-0.5) %.20e ", k,GEN->hp[k-N0],hkm05 ); + } + } + GEN->hb[k-N0] = 1; + } + h = GEN->hp[k-N0]; + } + else { + h = sign[i] * F(GEN->y[i]+GEN->ys[i]*(k+sign[i]*0.5-GEN->x[i])) / GEN->ys[i] - PMF(k); + /* CHECKING HAT:(only necessary if(k!=GEN->s+1) as for the border + the hat is by construction correct) + tests if Hat too low i.e.: (H(k+0.5)-p_k < H(k-1/2)) */ + hkm05 = sign[i] * F(GEN->y[i]+GEN->ys[i]*(k-sign[i]*0.5-GEN->x[i])) / GEN->ys[i]; + if(k != GEN->s[i]+sign[i]) { + if (h+UNUR_EPSILON < hkm05) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, + "PMF(i) > hat(i) for tailpart"); + _unur_log_printf(gen->genid,__FILE__,__LINE__, + "k %d h %.20e H(k-0.5) %.20e ", k,h,hkm05 ); + } + } + } + if (sign[i]*U >= h) + return k; + } + } + +} /* end of _unur_dari_sample_check() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_dari_hat( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* compute hat */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int sign[2] = {-1,1}; + int b[2], d, i, j; + double v[2], at[2]; + double t0 = 1.; + int setup = 1; + int rep = 1; + + /* check arguments */ + CHECK_NULL( gen, UNUR_ERR_NULL ); + COOKIE_CHECK( gen, CK_DARI_GEN, UNUR_ERR_COOKIE ); + + /* Step 0: setup */ + GEN->m = DISTR.mode; + b[0] = DISTR.BD_LEFT; + b[1] = DISTR.BD_RIGHT; + GEN->pm = PMF(GEN->m); + d = _unur_max(2, (int)( GEN->c_factor/(GEN->pm/DISTR.sum))); + + /* check mode */ + if (_unur_iszero(GEN->pm)) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PMF(mode)=0"); + return UNUR_ERR_GEN_DATA; + } + + /* step 0.1 */ + do { + for(i=0; i<=1; i++) { + GEN->x[i] = GEN->m + sign[i] * d; + if (sign[i]*GEN->x[i]+1 > sign[i]*b[i]) { + v[i] = 0; + GEN->s[i] = b[i]; + } + else { + GEN->y[i] = T( PMF(GEN->x[i]) ); + GEN->ys[i] = sign[i] * (T( PMF(GEN->x[i]+sign[i])) - GEN->y[i]); + if (GEN->ys[i]*sign[i] > -DBL_EPSILON) { + setup = -setup; /* indicate that the hat is not ok */ + i = 1; + } + else { + GEN->s[i] = (int)(0.5+GEN->x[i]+(T(GEN->pm)-GEN->y[i])/GEN->ys[i]); + GEN->Hat[i] = ( F(GEN->y[i]+GEN->ys[i]*(GEN->s[i]+sign[i]*1.5-GEN->x[i])) / + GEN->ys[i]-sign[i]*PMF(GEN->s[i]+sign[i]) ); + at[i] = GEN->x[i] + (FM(GEN->ys[i]*GEN->Hat[i])-GEN->y[i]) / GEN->ys[i]; + if(GEN->squeeze) + GEN->xsq[i] = sign[i]*(at[i]-(GEN->s[i]+sign[i])); + v[i] = sign[i]*(F(GEN->y[i]+GEN->ys[i]*(b[i]+sign[i]*0.5-GEN->x[i]))/ + GEN->ys[i]-F(GEN->y[i]+GEN->ys[i]*(at[i]-GEN->x[i]))/GEN->ys[i]); + } + } + if (setup>0) + GEN->ac[i] = GEN->s[i] + sign[i]*(PMF(GEN->s[i])/GEN->pm-0.5); + } + + /* step 0.2 */ + if(setup>0) { + GEN->vc = GEN->pm*(GEN->ac[1]-GEN->ac[0]); + GEN->vt = GEN->vc+v[0]+v[1]; + GEN->vcr = GEN->vc+v[1]; + + /* step 0.3 */ + GEN->n[0] = _unur_max(b[0],GEN->m - GEN->size/2); + GEN->n[1] = GEN->n[0] + GEN->size - 1; + if (GEN->n[1] > b[1]) { + GEN->n[1] = b[1]; + GEN->n[0] = GEN->n[1]- GEN->size + 1; + } + /* initialize table */ + for (j=0; jsize; j++) + GEN->hb[j] = 0; + } + + /* setup == 1 first try, up to now ok, ==2 second try, up to now ok */ + /* setup == -1 first try, not ok, == -2 second try, not ok */ + + if (setup == 1 || setup == -1) { + t0= 2. * DISTR.sum; + if (setup==1 && GEN->vt<=t0) + rep=0; + else { + setup = 2; + d = (int) (t0 / GEN->pm); + } + } + else + rep=0; + } while(rep); + + if (setup == -2 || GEN->vt > 100.*t0 || !(GEN->vt > 0.)) { +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) + _unur_dari_debug_init(gen,"RE/INIT failed try again"); +#endif + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"Area below hat too large or zero!! possible reasons: PDF, mode or area below PMF wrong; or PMF not T-concave"); + return UNUR_ERR_GEN_DATA; + } + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_dari_hat() */ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_dari_debug_init( struct unur_gen *gen, const char *status ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* status ... status of re/init routine */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int i; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DARI_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = discrete univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = dari (discrete automatic rejection inversion)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_discr_debug( gen->distr, gen->genid, FALSE ); + + fprintf(LOG,"%s: sampling routine = _unur_dari_sample",gen->genid); + if (gen->variant & DARI_VARFLAG_VERIFY) + fprintf(LOG,"_check()\n"); + else + fprintf(LOG,"()\n"); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: Data for hat and squeeze:\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s:area below hat: total %f center: %f, left tail %f, right tail %f\n", gen->genid, + GEN->vt, GEN->vc, GEN->vt-GEN->vcr, GEN->vcr-GEN->vc); + fprintf(LOG,"%s: mode %d and mode probability %f\n",gen->genid, GEN->m, GEN->pm); + for(i=0;i<=1;i++) { + fprintf(LOG,"%s:i=%d: x=%d; Hat=%f; ac=%f; s=%d;\n", gen->genid, + i, GEN->x[i], GEN->Hat[i], GEN->ac[i], GEN->s[i]); + fprintf(LOG,"%s:i=%d: xsq=%f; y=%f; ys=%f; n:=%d (for aux.table)\n", gen->genid, + i, GEN->xsq[i], GEN->y[i], GEN->ys[i], GEN->n[i]); + } + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: %s ************\n",gen->genid, status ); + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_dari_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_dari_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + int samplesize = 10000; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = PMF\n"); + _unur_string_append(info," domain = (%d, %d)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info," mode = %d %s\n", DISTR.mode, + (distr->set & UNUR_DISTR_SET_MODE_APPROX) ? "[numeric.]" : ""); + _unur_string_append(info," sum(PMF) = %g %s\n", DISTR.sum, + (distr->set & UNUR_DISTR_SET_PMFSUM) ? "" : "[unknown]"); + _unur_string_append(info,"\n"); + + if (help) { + if ( distr->set & UNUR_DISTR_SET_MODE_APPROX ) + _unur_string_append(info,"[ Hint: %s ]\n", + "You may provide the \"mode\"."); + if (!(distr->set & UNUR_DISTR_SET_PMFSUM)) + _unur_string_append(info,"[ Hint: %s ]\n", + "You may provide the \"pmfsum\"."); + _unur_string_append(info,"\n"); + } + + /* method */ + _unur_string_append(info,"method: DARI (Discrete Automatic Rejection Inversion)\n"); + if (GEN->size == 0) + _unur_string_append(info," no table\n"); + else + _unur_string_append(info," use table of size %d\n", GEN->size); + if (GEN->squeeze) + _unur_string_append(info," use squeeze\n"); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," sum(hat) = %g\n",GEN->vt); + _unur_string_append(info," rejection constant "); + if (distr->set & UNUR_DISTR_SET_PMFSUM) + _unur_string_append(info,"= %g\n", GEN->vt/DISTR.sum); + else + _unur_string_append(info,"= %.2f [approx.]\n", + unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize)); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + _unur_string_append(info," tablesize = %d %s\n", GEN->size, + (gen->set & DARI_SET_TABLESIZE) ? "" : "[default]"); + if (GEN->squeeze) + _unur_string_append(info," squeeze = on\n"); + + if (gen->set & DARI_SET_CFACTOR) + _unur_string_append(info," cpfactor = %g\n", GEN->c_factor); + + if (gen->variant & DARI_VARFLAG_VERIFY) + _unur_string_append(info," verify = on\n"); + + _unur_string_append(info,"\n"); + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_dari_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/dari.h b/vendor/unuran-1.11.0/src/methods/dari.h new file mode 100644 index 0000000..9fe80eb --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dari.h @@ -0,0 +1,164 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dari.h * + * * + * PURPOSE: * + * function prototypes for method DARI * + * (discrete automatic rejection inversion) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD DARI Discrete Automatic Rejection Inversion + + =UP Methods_for_DISCR + + =REQUIRED T-concave PMF, mode, approximate area + + =SPEED Set-up: moderate, Sampling: fast + + =REINIT supported + + =REF [HDa96] [HLD04: Sect.10.2, Alg.10.4] + + =DESCRIPTION + DARI is based on rejection inversion, which can be seen as an + adaptation of transformed density rejection to discrete + distributions. The used transformation is @unurmath{-1/\sqrt{x}}. + + DARI uses three almost optimal points for constructing the + (continuous) hat. Rejection is then done in horizontal + direction. Rejection inversion uses only one uniform random + variate per trial. + + DARI has moderate set-up times (the PMF is evaluated nine + times), and good marginal speed, especially if an auxiliary + array is used to store values during generation. + + DARI works for all @unurmath{T_{-1/2}}-concave distributions. It requires the PMF + and the location of the mode. Moreover the approximate sum over the PMF + is used. (If no sum is given for the distribution the algorithm + assumes that it is approximately 1.) + The rejection constant is bounded from above by 4 for all @i{T}-concave + distributions. + + =HOWTOUSE + DARI works for discrete distribution object with given PMF. + The sum over probabilities should be approximately + one. Otherwise it must be set by a unur_distr_discr_set_pmfsum() + call to its (approximate) value. + + The size of an auxiliary table can be set by unur_dari_set_tablesize(). + The expected number of evaluations can be reduced by switching + the use of squeezes by means of unur_dari_set_squeeze(). + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + Notice, that derived parameters like the mode must also be (re-) set + if the parameters or the domain has be changed. + + There exists a test mode that verifies whether the conditions for + the method are satisfied or not. It can be switched on by calling + unur_dari_set_verify() and unur_dari_chg_verify(), respectively. + Notice however that sampling is (much) slower then. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +UNUR_PAR *unur_dari_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_dari_set_squeeze( UNUR_PAR *parameters, int squeeze ); +/* + Turn utilization of the squeeze of the algorithm on/off. + This squeeze does not resamble the squeeze of the continuous TDR + method. It was especially designed for rejection inversion. + + The squeeze is not necessary if the size of the auxiliary table is + big enough (for the given distribution). + Using a squeeze is suggested to speed up the algorithm if the + domain of the distribution is very big or if only small samples are + produced. + + Default: no squeeze. +*/ + +int unur_dari_set_tablesize( UNUR_PAR *parameters, int size ); +/* + Set the size for the auxiliary table, that stores constants + computed during generation. + If @var{size} is set to @code{0} no table is used. + The speed-up can be impressive if the PMF is expensive to + evaluate and the ``main part of the distribution'' is concentrated + in an interval shorter than the size of the table. + + Default is @code{100}. +*/ + +int unur_dari_set_cpfactor( UNUR_PAR *parameters, double cp_factor ); +/* + Set factor for position of the left and right construction point, + resp. + The @var{cp_factor} is used to find almost optimal construction + points for the hat function. + The @var{cp_factor} must be positive and should not exceed 2. + There is no need to change this factor in almost all situations. + + Default is @code{0.664}. +*/ + +int unur_dari_set_verify( UNUR_PAR *parameters, int verify ); +/* */ + +int unur_dari_chg_verify( UNUR_GEN *generator, int verify ); +/* + Turn verifying of algorithm while sampling on/off. + If the condition is violated for some @i{x} then @code{unur_errno} + is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this + might happen due to round-off errors for a few values of + @i{x} (less than 1%). + + Default is FALSE. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/dari_struct.h b/vendor/unuran-1.11.0/src/methods/dari_struct.h new file mode 100644 index 0000000..e5cf809 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dari_struct.h @@ -0,0 +1,78 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dari_struct.h * + * * + * PURPOSE: * + * declares structures for method DARI * + * ((Discrete) Alias-Urn) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_dari_par { + int squeeze; /* should the squeeze be used + 0.. no squeeze, 1..squeeze */ + int size; /* size of table for speeding up generation */ + double c_factor; /* constant for choosing the design points */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_dari_gen { + double vt; /* total volume below hat */ + double vc; /* volume below center part */ + double vcr; /* volume center and right together */ + + double xsq[2]; /* value necesary for the squeeze computation */ + double y[2]; /* value of the transformed density in points of contact */ + double ys[2]; /* the slope of the transformed hat */ + double ac[2]; /* left and right starting point of the uniform hat + in the center */ + + double pm; /* mode probability */ + double Hat[2]; /* point where the hat starts for the left and + the right tail */ + double c_factor; /* constant for choosing the design points */ + + int m; /* mode */ + int x[2]; /* points of contact left and right of the mode */ + int s[2]; /* first and last integer of the center part */ + int n[2]; /* contains the first and the last i + for which values are stored in table */ + int size; /* size of the auxiliary tables */ + int squeeze; /* use squeeze yes/no */ + + double *hp; /* pointer to double array of length size */ + char *hb; /* pointer to boolean array of length size */ +}; + +/*---------------------------------------------------------------------------*/ + + diff --git a/vendor/unuran-1.11.0/src/methods/dau.c b/vendor/unuran-1.11.0/src/methods/dau.c new file mode 100644 index 0000000..b95a311 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dau.c @@ -0,0 +1,932 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dau.c * + * * + * TYPE: discrete univariate random variate * + * METHOD: alias and alias-urn method * + * * + * DESCRIPTION: * + * Given N discrete events with different probabilities P[k] * + * produce a value k consistent with its probability. * + * * + * REQUIRED: pointer to probability vector * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Walker, A. J. (1974): New fast method for generating discrete * + * random numbers with arbitrary frequency distributions, * + * Electron. Lett. 10, pp. 127-128 * + * * + * [2] Walker, A. J. (1977): An efficient method for generating discrete * + * random variables with general distributions, * + * ACM Trans. Math. Software 3, pp. 253-256 * + * * + * [3] Kronmal, R. A. and Peterson, A. V. (1979): On the alias method for * + * generating random variables from a discrete distribution, * + * Amer. Statist. 33(4), pp. 214-218 * + * * + * [4] Peterson, A. V. and Kronmal, R. A. (1982): On mixture methods for * + * the computer generation of random variables, * + * Amer. Statist. 36(3), pp. 184-191 * + * * + * SUMMARY: * + * [5] Devroye, L. (1986): Non-Uniform Random Variate Generation, New-York * + * * + * [6] Knuth, D. E. (1997): The Art of Computer Programming, * + * Volume 2 (Seminumerical algorithms), 3rd edition, * + * Addison-Wesley (1997), p.120 * + * * + * SEE ALSO: * + * [7] Zaman, A. (1996), Generation of Random Numbers from an Arbitrary * + * Unimodal Density by Cutting Corners, unpublished manuskript * + * available at http://chenab.lums.edu.pk/~arifz/ * + * * + ***************************************************************************** + * * + * This algorithmus is based on [1,2]. It is an ingeneous method for * + * generating random variates with finite probability vector which requires * + * a table of size N and needs only one comparision. * + * * + * Walker's algorithm does some preprocessing, and provides two array: * + * floating point Q[k] and integer J[k]. A value k is chosen from 0..N-1 * + * with equal likelihood, and then a uniform random number u is compared to * + * Q[k]. If it is less than Q[k], then k is returned. Otherwise, J[k] is * + * returned. * + * The method has been generalized in [4] to the "alias-urn" method that * + * works in the exactly same way but uses a larger table of aliases. * + * * + * The original algorithm needs 2 uniform random numbers. By reusing only * + * one is necessary (see [6]). * + * * + * Walker's original paper describes an O(N^2) algorithm for setting * + * up the Q and J arrays. It had been improved in e.g. [3]. * + * This implementation uses Marsaglia's "Robin Hood algorithm" (see [7]): * + * This O(N) algorithm goes through all the p_k's and decides if they are * + * are "poor" or "rich" according to whether they are less than or greater * + * than (>=) the mean value 1 (For convienience we normalize the p_k's, * + * s.t. there sum N instead of 1.). The indices to the poors and the richs * + * are put in separate stacks, and then we work through the stacks together. * + * We take from the next rich on the stack and give to the poor, s.t. it * + * has the average value, and then it is popped from the stack of poors and * + * stored in the tables Q and J. * + * (Walker always wanted to pair up the poorest with the richest.) * + * This reduces the size of the rich and even might become poor, i.e., * + * it is popped from the stack of richs and pushed on the stack of poors. * + * Since the size of the the two stacks together is <= N, we use one array * + * and store the poors on the beginning and the richs at the and of an * + * array of size N. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "dau.h" +#include "dau_struct.h" + +/*---------------------------------------------------------------------------*/ +/* Variants: none */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define DAU_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ +#define DAU_DEBUG_PRINTVECTOR 0x00000100u +#define DAU_DEBUG_TABLE 0x00000200u + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define DAU_SET_URNFACTOR 0x01u + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "DAU" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dau_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dau_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dau_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dau_check_par( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dau_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_dau_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dau_sample( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dau_create_tables( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* create (allocate) tables for alias method */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dau_make_urntable( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* create table for alias method */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_dau_debug_init( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_dau_debug_table( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print data for alias table. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_dau_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.discr /* data for distribution object */ + +#define PAR ((struct unur_dau_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_dau_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.discr /* data for distribution in generator object */ + +#define SAMPLE gen->sample.discr /* pointer to sampling routine */ + +/*---------------------------------------------------------------------------*/ + +#define _unur_dau_getSAMPLE(gen) (_unur_dau_sample) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_dau_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL(GENTYPE,distr,NULL); + + /* check distribution */ + if (distr->type != UNUR_DISTR_DISCR) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_DISCR,NULL); + + if (DISTR_IN.pv == NULL) { + /* There is no PV try to compute it. */ + if ( DISTR_IN.pmf + && ( (((unsigned)DISTR_IN.domain[1] - (unsigned)DISTR_IN.domain[0]) < UNUR_MAX_AUTO_PV) + || ( (distr->set & UNUR_DISTR_SET_PMFSUM) && DISTR_IN.domain[0] > INT_MIN ) ) ) { + /* However this requires a PMF and either a bounded domain */ + /* or the sum over the PMF. */ + _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PV. Try to compute it."); + } + else { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PV"); return NULL; + } + } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_dau_par) ); + COOKIE_SET(par,CK_DAU_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->urn_factor = 1.; /* use same size for table */ + + par->method = UNUR_METH_DAU; /* method */ + par->variant = 0u; /* default variant (no other variants) */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_dau_init; + + return par; + +} /* end of unur_dau_new() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dau_set_urnfactor( struct unur_par *par, double factor ) + /*----------------------------------------------------------------------*/ + /* set factor for relative size of urn */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* factor ... relative size of urn */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, DAU ); + + /* check new parameter for generator */ + if (factor < 1.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"relative urn size < 1."); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->urn_factor = factor; + + /* changelog */ + par->set |= DAU_SET_URNFACTOR; + + return UNUR_SUCCESS; + +} /* end of unur_dau_set_urnfactor() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_dau_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_DAU ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_DAU_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_dau_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* check parameters */ + if ( _unur_dau_check_par(gen) != UNUR_SUCCESS ) { + _unur_dau_free(gen); return NULL; + } + + /* compute table */ + if ( (_unur_dau_create_tables(gen) != UNUR_SUCCESS) || + (_unur_dau_make_urntable(gen) != UNUR_SUCCESS) ) { + _unur_dau_free(gen); return NULL; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_dau_debug_init(gen); +#endif + + return gen; + +} /* end of _unur_dau_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_dau_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int rcode; + + /* check parameters */ + if ( (rcode = _unur_dau_check_par(gen)) != UNUR_SUCCESS) + return rcode; + + /* compute table */ + if ( ((rcode = _unur_dau_create_tables(gen)) != UNUR_SUCCESS) || + ((rcode = _unur_dau_make_urntable(gen)) != UNUR_SUCCESS) ) { + return rcode; + } + + /* (re)set sampling routine */ + SAMPLE = _unur_dau_getSAMPLE(gen); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & DAU_DEBUG_REINIT) _unur_dau_debug_init(gen); +#endif + + return UNUR_SUCCESS; +} /* end of _unur_dau_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_dau_create( struct unur_par *par) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_DAU_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_dau_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_DAU_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_dau_getSAMPLE(gen); + gen->destroy = _unur_dau_free; + gen->clone = _unur_dau_clone; + gen->reinit = _unur_dau_reinit; + + /* copy parameters */ + GEN->urn_factor = PAR->urn_factor; /* relative length of table */ + + /* initialize parameters */ + GEN->len = 0; /* length of probability vector */ + GEN->urn_size = 0; + GEN->jx = NULL; + GEN->qx = NULL; + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_dau_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_dau_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_dau_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* we need a PV */ + if (DISTR.pv == NULL) { + /* try to compute PV */ + if (unur_distr_discr_make_pv( gen->distr ) <= 0) { + /* not successful */ + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PV"); + return UNUR_ERR_DISTR_REQUIRED; + } + } + + return UNUR_SUCCESS; +} /* end of _unur_dau_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_dau_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_dau_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_DAU_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* copy data for generator */ + CLONE->jx = _unur_xmalloc( GEN->urn_size * sizeof(int) ); + memcpy( CLONE->jx, GEN->jx, GEN->urn_size * sizeof(int) ); + CLONE->qx = _unur_xmalloc( GEN->urn_size * sizeof(double) ); + memcpy( CLONE->qx, GEN->qx, GEN->urn_size * sizeof(double) ); + + return clone; + +#undef CLONE +} /* end of _unur_dau_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_dau_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_DAU ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_DAU_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free two auxiliary tables */ + if (GEN->jx) free(GEN->jx); + if (GEN->qx) free(GEN->qx); + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_dau_free() */ + +/*****************************************************************************/ + +int +_unur_dau_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* integer (sample from random variate) */ + /* */ + /* error: */ + /* return INT_MAX */ + /*----------------------------------------------------------------------*/ +{ + int iu; + double u; + + /* check arguments */ + CHECK_NULL(gen,INT_MAX); COOKIE_CHECK(gen,CK_DAU_GEN,INT_MAX); + + /* sample from U(0,urn_size) */ + u = _unur_call_urng(gen->urng); + u *= GEN->urn_size; + iu = (int) u; + + /* immediate return ? */ + if (iu >= GEN->len) return (GEN->jx[iu] + DISTR.domain[0]); + + /* else choose number or its alias at random */ + u -= iu; /* reuse of random number */ + + return (((u <= GEN->qx[iu]) ? iu : GEN->jx[iu] ) + DISTR.domain[0]); + +} /* end of _unur_dau_sample() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_dau_create_tables( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* allocate memory for tables */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* length of probability vector */ + GEN->len = DISTR.n_pv; + + /* size of table */ + GEN->urn_size = (int)(GEN->len * GEN->urn_factor); + if (GEN->urn_size < GEN->len) + /* do not use a table that is smaller then length of probability vector */ + GEN->urn_size = GEN->len; + + /* allocate memory for the tables */ + GEN->jx = _unur_xrealloc( GEN->jx, GEN->urn_size * sizeof(int) ); + GEN->qx = _unur_xrealloc( GEN->qx, GEN->urn_size * sizeof(double) ); + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_dau_create_tables() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_dau_make_urntable( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* create table for alias method using the Robin Hood algorithm */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int *begin, *poor, *rich; /* list of (rich and poor) strips */ + int *npoor; /* next poor on stack */ + double *pv; /* pointer to probability vector */ + int n_pv; /* length of probability vector */ + double sum, ratio; + int i; /* aux variable */ + + /* probability vector */ + pv = DISTR.pv; + n_pv = DISTR.n_pv; + + /* compute sum of all probabilities */ + for( sum=0, i=0; igenid,UNUR_ERR_GEN_DATA,"probability < 0"); + return UNUR_ERR_GEN_DATA; + } + } + + /* make list of poor and rich strips */ + begin = _unur_xmalloc( (GEN->urn_size+2) * sizeof(int) ); + poor = begin; /* poor strips are stored at the beginning ... */ + rich = begin + GEN->urn_size + 1; /* ... rich strips at the end of the list */ + + /* copy probability vector; scale so that it sums to GEN->urn_size and */ + /* find rich and poor strips at start */ + ratio = GEN->urn_size / sum; + for( i=0; iqx[i] = pv[i] * ratio; /* probability rescaled */ + if (GEN->qx[i] >= 1.) { /* rich strip */ + *rich = i; /* add to list ... */ + --rich; /* and update pointer */ + GEN->jx[i] = i; /* init donor (itself) */ + } + else { /* poor strip */ + *poor = i; /* add to list */ + ++poor; /* update pointer */ + /* it is not necessary to mark donor */ + } + } + + /* all other (additional) strips own nothing yet */ + for( ; iurn_size; i++ ) { + GEN->qx[i] = 0.; + *poor = i; + ++poor; + } + + /* there must be at least one rich strip */ + if (rich == begin + GEN->urn_size + 1 ) { + /* this must not happen: + no rich strips found for Robin Hood algorithm. */ + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + free (begin); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + } + + /* rich must point to the first rich strip yet */ + ++rich; + + /* now make the "squared histogram" with Robin Hood algorithm (Marsaglia) */ + while (poor != begin) { + if (rich > begin + GEN->urn_size + 1) { + /* there might be something wrong; assume a neglectable round off error */ + break; + } + + npoor = poor - 1; /* take next poor from stack */ + GEN->jx[*npoor] = *rich; /* store the donor */ + GEN->qx[*rich] -= 1. - GEN->qx[*npoor]; /* update rich */ + + /* rich might has given too much, so it is poor then */ + if (GEN->qx[*rich] < 1.) { + *npoor = *rich; /* exchange noveau-poor with former poor in list */ + ++rich; /* remove it from list of rich */ + } + else + --poor; /* remove poor from list */ + } + + /* if there has been an round off error, we have to complete the table */ + if (poor != begin) { + sum = 0.; /* we estimate the round off error */ + while (poor != begin) { + npoor = poor - 1; /* take next poor from stack */ + sum += 1. - GEN->qx[*npoor]; + GEN->jx[*npoor] = *npoor; /* mark donor as "not valid" */ + GEN->qx[*npoor] = 1.; /* set probability to 1 (we assume that it is very close to one) */ + --poor; /* remove from list */ + } + if (fabs(sum) > UNUR_SQRT_DBL_EPSILON) + /* sum of deviations very large */ + _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF,"squared histogram"); + } + + /* free list of strips */ + free(begin); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_dau_make_urntable() */ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_dau_debug_init( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DAU_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = discrete univariate random variate\n",gen->genid); + fprintf(LOG,"%s: method = alias and alias-urn method\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_discr_debug( gen->distr,gen->genid,(gen->debug & DAU_DEBUG_PRINTVECTOR)); + + fprintf(LOG,"%s: sampling routine = _unur_dau_sample()\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: length of probability vector = %d\n",gen->genid,GEN->len); + fprintf(LOG,"%s: size of urn table = %d (rel. = %g%%", + gen->genid,GEN->urn_size,100.*GEN->urn_factor); + _unur_print_if_default(gen,DAU_SET_URNFACTOR); + if (GEN->urn_size == GEN->len) + fprintf(LOG,") (--> alias method)\n"); + else + fprintf(LOG,") (--> alias-urn method)\n"); + fprintf(LOG,"%s:\n",gen->genid); + + if (gen->debug & DAU_DEBUG_TABLE) { + _unur_dau_debug_table(gen); + fprintf(LOG,"%s:\n",gen->genid); + } + +} /* end of _unur_dau_debug_init() */ + +/*---------------------------------------------------------------------------*/ + +#define HIST_WIDTH 40 /* width of histogram for printing alias table */ + +void +_unur_dau_debug_table( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* print alias table into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int i, j, m; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DAU_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + /* print head of table */ + fprintf(LOG,"%s: alias table:\n", gen->genid); + fprintf(LOG,"%s:\n", gen->genid); + fprintf(LOG,"%s: ratio donor/acceptor",gen->genid); + for (i=0; iurn_size; i++){ + m = HIST_WIDTH * GEN->qx[i] + 0.5; + fprintf(LOG,"%s:[%4d]: ", gen->genid,i); + + /* illustrate ratio donor/acceptor graphically */ + for (j=0; jjx[i]); /* name donor */ + fprintf(LOG," %6.3f%%\n", GEN->qx[i]*100); /* cut point */ + } + +} /* end of _unur_dau_debug_table() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_dau_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = PV [length=%d%s]\n", + DISTR.domain[1]-DISTR.domain[0]+1, + (DISTR.pmf==NULL) ? "" : ", created from PMF"); + _unur_string_append(info," domain = (%d, %d)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info,"\n"); + + /* method */ + _unur_string_append(info,"method: DAU (Alias-Urn)\n"); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," E [#look-ups] = %g\n", 1+1./GEN->urn_factor); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + _unur_string_append(info," urnfactor = %g %s\n", GEN->urn_factor, + (gen->set & DAU_SET_URNFACTOR) ? "" : "[default]"); + _unur_string_append(info,"\n"); + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_dau_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/dau.h b/vendor/unuran-1.11.0/src/methods/dau.h new file mode 100644 index 0000000..a237aa2 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dau.h @@ -0,0 +1,114 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dau.h * + * * + * PURPOSE: * + * function prototypes for method DAU * + * ((Discrete) Alias-Urn) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD DAU (Discrete) Alias-Urn method + + =UP Methods_for_DISCR + + =REQUIRED probability vector (PV) + + =SPEED Set-up: slow (linear with the vector-length), Sampling: very fast + + =REINIT supported + + =REF [WAa77] [HLD04: Sect.3.2] + + =DESCRIPTION + DAU samples from distributions with arbitrary but finite + probability vectors (PV) of length @i{N}. + The algorithmus is based on an ingeneous method by A.J. Walker + and requires a table of size (at least) @i{N}. + It needs one random numbers and only one comparison for each + generated random variate. The setup time for constructing the + tables is @i{O(N)}. + + By default the probability vector is indexed starting at + @code{0}. However this can be changed in the distribution object by + a unur_distr_discr_set_domain() call. + + The method also works when no probability vector but a PMF is + given. However then additionally a bounded (not too large) domain + must be given or the sum over the PMF (see + unur_distr_discr_make_pv() for details). + + =HOWTOUSE + Create an object for a discrete distribution either by setting a + probability vector or a PMF. The performance can be slightly + influenced by setting the size of the used table which can be + changed by unur_dau_set_urnfactor(). + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_dau_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_dau_set_urnfactor( UNUR_PAR *parameters, double factor ); +/* + Set size of urn table relative to length of the probability + vector. It must not be less than 1. Larger tables result in + (slightly) faster generation times but require a more expensive + setup. However sizes larger than 2 are not recommended. + + Default is @code{1}. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ + + + + + + + + + + diff --git a/vendor/unuran-1.11.0/src/methods/dau_struct.h b/vendor/unuran-1.11.0/src/methods/dau_struct.h new file mode 100644 index 0000000..29fd678 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dau_struct.h @@ -0,0 +1,55 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dau_struct.h * + * * + * PURPOSE: * + * declares structures for method DAU * + * ((Discrete) Alias-Urn) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_dau_par { + double urn_factor; /* relative length of table for alias-urn method */ + /* (DEFAULT = 1 --> alias method) */ + /* length of table = urn_factor * len */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_dau_gen { + int len; /* length of probability vector */ + int urn_size; /* size of table for alias-urn method */ + double *qx; /* pointer to cut points for strips */ + int *jx; /* pointer to donor */ + double urn_factor; /* relative length of table for alias-urn method */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/deprecated_methods.c b/vendor/unuran-1.11.0/src/methods/deprecated_methods.c new file mode 100644 index 0000000..acf8e05 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/deprecated_methods.c @@ -0,0 +1,1346 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: deprecated_methods.c * + * * + * Deprecated routines * + * * + ***************************************************************************** + * * + * THESE ROUTINES SHOULD NOT BE USED ANY MORE! * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "utdr_struct.h" +#include "x_gen.h" +#include "deprecated_methods.h" + +/*---------------------------------------------------------------------------*/ +#ifdef USE_DEPRECATED_CODE +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "deprecated" /* type of generator */ + +#define BD_LEFT domain[0] /* left boundary of domain of distribution */ +#define BD_RIGHT domain[1] /* right boundary of domain of distribution */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +int +unur_cstd_chg_pdfparams( struct unur_gen *gen, double *params, int n_params ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change array of parameters for distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* params ... list of arguments */ + /* n_params ... number of arguments */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* IMPORTANT: The given parameters are not checked against domain */ + /* errors (in opposition to the unur__new() call). */ + /* */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, CSTD, UNUR_ERR_GEN_INVALID ); + if (n_params>0) CHECK_NULL(params, UNUR_ERR_NULL); + + /* set new parameters in distribution object */ + if (unur_distr_cont_set_pdfparams(gen->distr, params,n_params)!=UNUR_SUCCESS) + return UNUR_ERR_DISTR_SET; + + /* reinit */ + return gen->reinit(gen); +} /* end of unur_cstd_chg_pdfparams() */ + +/*****************************************************************************/ + +#define DISTR gen->distr->data.discr /* data for distribution in generator object */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dari_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, DARI, UNUR_ERR_GEN_INVALID ); + + return gen->reinit(gen); +} /* end of unur_dari_reinit() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dari_chg_pmfparams( struct unur_gen *gen, double *params, int n_params ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change array of parameters for distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* params ... list of arguments */ + /* n_params ... number of arguments */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* IMPORTANT: The given parameters are not checked against domain */ + /* errors (in opposition to the unur__new() call). */ + /* */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, DARI, UNUR_ERR_GEN_INVALID ); + + /* set new parameters in distribution object */ + return unur_distr_discr_set_pmfparams(gen->distr,params,n_params); + +} /* end of unur_dari_chg_pmfparams() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dari_chg_domain( struct unur_gen *gen, int left, int right ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change the left and right borders of the domain of the distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* INT_MIN and INT_MAX are interpreted as (minus) infinity. */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, DARI, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (left >= right) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"domain, left >= right"); + return UNUR_ERR_DISTR_SET; + } + + /* copy new boundaries into generator object */ + DISTR.BD_LEFT = left; + DISTR.BD_RIGHT = right; + + /* changelog */ + gen->distr->set |= UNUR_DISTR_SET_DOMAIN; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ +#endif + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_dari_chg_domain() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dari_chg_mode( struct unur_gen *gen, int mode ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change mode of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* mode ... mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, DARI, UNUR_ERR_GEN_INVALID ); + + /* copy parameters */ + DISTR.mode = mode; + + /* changelog */ + gen->distr->set |= UNUR_DISTR_SET_MODE; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_dari_chg_mode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dari_upd_mode( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* recompute mode of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, DARI, UNUR_ERR_GEN_INVALID ); + + return unur_distr_discr_upd_mode( gen->distr ); +} /* end of unur_dari_upd_mode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dari_chg_pmfsum( struct unur_gen *gen, double sum ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change sum over PMF of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* sum ... sum */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, DARI, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (sum <= 0.) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"sum <= 0"); + return UNUR_ERR_DISTR_SET; + } + + /* copy parameters */ + DISTR.sum = sum; + + /* no changelog required */ + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_dari_chg_pmfsum() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dari_upd_pmfsum( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* recompute sum over PMF of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, DARI, UNUR_ERR_GEN_INVALID ); + + return unur_distr_discr_upd_pmfsum( gen->distr ); +} /* end of unur_dari_upd_pmfsum() */ + +/*---------------------------------------------------------------------------*/ + +#undef DISTR + +/*****************************************************************************/ + +#define DISTR gen->distr->data.discr /* data for distribution in generator object */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dsrou_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, DSROU, UNUR_ERR_GEN_DATA ); + + return gen->reinit(gen); +} /* end of unur_dsrou_reinit() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dsrou_chg_pmfparams( struct unur_gen *gen, double *params, int n_params ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change array of parameters for distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* params ... list of arguments */ + /* n_params ... number of arguments */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* IMPORTANT: The given parameters are not checked against domain */ + /* errors (in opposition to the unur__new() call). */ + /* */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, DSROU, UNUR_ERR_GEN_INVALID ); + + /* set new parameters in distribution object */ + return unur_distr_discr_set_pmfparams(gen->distr,params,n_params); + +} /* end of unur_dsrou_chg_pmfparams() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dsrou_chg_mode( struct unur_gen *gen, int mode ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change mode of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* mode ... mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, DSROU, UNUR_ERR_GEN_INVALID ); + + /* copy parameters */ + DISTR.mode = mode; + + /* no changelog required */ + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_dsrou_chg_mode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dsrou_upd_mode( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* recompute mode of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, DSROU, UNUR_ERR_GEN_INVALID ); + + return unur_distr_discr_upd_mode( gen->distr ); +} /* end of unur_dsrou_upd_mode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dsrou_chg_domain( struct unur_gen *gen, int left, int right ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change the left and right borders of the domain of the distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, DSROU, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (left >= right) { + _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"domain, left >= right"); + return UNUR_ERR_DISTR_SET; + } + + /* copy new boundaries into generator object */ + DISTR.BD_LEFT = left; + DISTR.BD_RIGHT = right; + + /* changelog */ + gen->distr->set &= ~(UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MASK_DERIVED ); + gen->distr->set |= UNUR_DISTR_SET_DOMAIN; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ +#endif + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_dsrou_chg_domain() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dsrou_chg_pmfsum( struct unur_gen *gen, double sum ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change sum over PMF of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* sum ... sum */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, DSROU, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (sum <= 0.) { + _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"sum <= 0"); + return UNUR_ERR_DISTR_SET; + } + + /* copy parameters */ + DISTR.sum = sum; + + /* no changelog required */ + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_dsrou_chg_pmfsum() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dsrou_upd_pmfsum( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* recompute sum over PMF of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, DSROU, UNUR_ERR_GEN_INVALID ); + + return unur_distr_discr_upd_pmfsum( gen->distr ); +} /* end of unur_dsrou_upd_pmfsum() */ + +/*---------------------------------------------------------------------------*/ + +#undef DISTR + +/*****************************************************************************/ + +int +unur_dstd_chg_pmfparams( struct unur_gen *gen, double *params, int n_params ) + /*----------------------------------------------------------------------*/ + /* change array of parameters for distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* params ... list of arguments */ + /* n_params ... number of arguments */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, DSTD, UNUR_ERR_GEN_INVALID ); + if (n_params>0) CHECK_NULL(params, UNUR_ERR_NULL); + + /* set new parameters in distribution object */ + if (unur_distr_discr_set_pmfparams(gen->distr,params,n_params)!=UNUR_SUCCESS) + return UNUR_ERR_GEN_DATA; + + /* reinit */ + return gen->reinit(gen); + +} /* end of unur_dstd_chg_pmfparams() */ + +/*****************************************************************************/ + +int +unur_ninv_chg_pdfparams( struct unur_gen *gen, double *params, int n_params ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change array of parameters for distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* params ... list of arguments */ + /* n_params ... number of arguments */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(gen, UNUR_ERR_NULL); + _unur_check_gen_object( gen, NINV, UNUR_ERR_GEN_INVALID ); + if (n_params>0) CHECK_NULL(params, UNUR_ERR_NULL); + + /* set new parameters in distribution object */ + if (unur_distr_cont_set_pdfparams(gen->distr,params,n_params)!=UNUR_SUCCESS) + return UNUR_ERR_GEN_DATA; + + /* reinit */ + return gen->reinit(gen); +} /* end of unur_ninv_chg_pdfparams() */ + +/*****************************************************************************/ + +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +/*---------------------------------------------------------------------------*/ + +int +unur_srou_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); + + return gen->reinit(gen); +} /* end of unur_srou_reinit() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_srou_chg_pdfparams( struct unur_gen *gen, double *params, int n_params ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change array of parameters for distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* params ... list of arguments */ + /* n_params ... number of arguments */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* IMPORTANT: The given parameters are not checked against domain */ + /* errors (in opposition to the unur__new() call). */ + /* */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); + + /* set new parameters in distribution object */ + return unur_distr_cont_set_pdfparams(gen->distr,params,n_params); + +} /* end of unur_srou_chg_pdfparams() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_srou_chg_mode( struct unur_gen *gen, double mode ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change mode of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* mode ... mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); + + /* copy parameters */ + DISTR.mode = mode; + + /* no changelog required */ + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_srou_chg_mode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_srou_upd_mode( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* recompute mode of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); + + return unur_distr_cont_upd_mode( gen->distr ); +} /* end of unur_srou_upd_mode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_srou_chg_domain( struct unur_gen *gen, double left, double right ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change the left and right borders of the domain of the distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* comment: */ + /* the new boundary points may be +/- UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (left >= right) { + _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"domain, left >= right"); + return UNUR_ERR_DISTR_SET; + } + + /* copy new boundaries into generator object */ + DISTR.BD_LEFT = left; + DISTR.BD_RIGHT = right; + + /* changelog */ + gen->distr->set &= ~(UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MASK_DERIVED ); + gen->distr->set |= UNUR_DISTR_SET_DOMAIN; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ +#endif + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_srou_chg_domain() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_srou_chg_pdfarea( struct unur_gen *gen, double area ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change area below PDF of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* area ... area */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (area <= 0.) { + _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"area <= 0"); + return UNUR_ERR_DISTR_SET; + } + + /* copy parameters */ + DISTR.area = area; + + /* no changelog required */ + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_srou_chg_pdfarea() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_srou_upd_pdfarea( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* recompute area below PDF of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); + + return unur_distr_cont_upd_pdfarea( gen->distr ); +} /* end of unur_srou_upd_pdfarea() */ + +/*---------------------------------------------------------------------------*/ + +#undef DISTR + +/*****************************************************************************/ + +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ssr_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); + + return gen->reinit(gen); +} /* end of unur_ssr_reinit() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ssr_chg_pdfparams( struct unur_gen *gen, double *params, int n_params ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change array of parameters for distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* params ... list of arguments */ + /* n_params ... number of arguments */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* IMPORTANT: The given parameters are not checked against domain */ + /* errors (in opposition to the unur__new() call). */ + /* */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); + + /* set new parameters in distribution object */ + return unur_distr_cont_set_pdfparams( gen->distr, params,n_params ); + +} /* end of unur_ssr_chg_pdfparams() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ssr_chg_mode( struct unur_gen *gen, double mode ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change mode of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* mode ... mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); + + /* copy parameters */ + DISTR.mode = mode; + + /* no changelog required */ + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_ssr_chg_mode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ssr_upd_mode( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* recompute mode of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); + + return unur_distr_cont_upd_mode( gen->distr ); +} /* end of unur_ssr_upd_mode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ssr_chg_domain( struct unur_gen *gen, double left, double right ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change the left and right borders of the domain of the distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* comment: */ + /* the new boundary points may be +/- UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (left >= right) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"domain, left >= right"); + return UNUR_ERR_DISTR_SET; + } + + /* copy new boundaries into generator object */ + DISTR.BD_LEFT = left; + DISTR.BD_RIGHT = right; + + /* changelog */ + gen->distr->set &= ~(UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MASK_DERIVED ); + gen->distr->set |= UNUR_DISTR_SET_DOMAIN; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ +#endif + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_ssr_chg_domain() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ssr_chg_pdfarea( struct unur_gen *gen, double area ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change area below PDF of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* area ... area */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (area <= 0.) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"area <= 0"); + return UNUR_ERR_DISTR_SET; + } + + /* copy parameters */ + DISTR.area = area; + + /* no changelog required */ + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_ssr_chg_pdfarea() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ssr_upd_pdfarea( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* recompute area below PDF of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); + + return unur_distr_cont_upd_pdfarea( gen->distr ); +} /* end of unur_ssr_upd_pdfarea() */ + + +/*---------------------------------------------------------------------------*/ + +#undef DISTR + +/*****************************************************************************/ + +int +unur_tdr_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE,gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, TDR, UNUR_ERR_GEN_INVALID ); + + return gen->reinit(gen); +} /* end of unur_tdr_reinit() */ + +/*****************************************************************************/ + +int +unur_tdrgw_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* Remark: method TDRGW has been renamed into ARS! */ + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE,gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, ARS, UNUR_ERR_GEN_INVALID ); + + return gen->reinit(gen); +} /* end of unur_tdrgw_reinit() */ + +/*****************************************************************************/ + +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ +#define GEN ((struct unur_utdr_gen*)gen->datap) /* data for generator object */ + +/*---------------------------------------------------------------------------*/ + +int +unur_utdr_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE,gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, UTDR, UNUR_ERR_GEN_INVALID ); + + return gen->reinit(gen); +} /* end of unur_utdr_reinit() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_utdr_chg_pdfparams( struct unur_gen *gen, double *params, int n_params ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change array of parameters for distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* params ... list of arguments */ + /* n_params ... number of arguments */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* IMPORTANT: The given parameters are not checked against domain */ + /* errors (in opposition to the unur__new() call). */ + /* */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, UTDR, UNUR_ERR_GEN_INVALID ); + + /* set new parameters in distribution object */ + return unur_distr_cont_set_pdfparams( gen->distr, params,n_params ); + +} /* end of unur_utdr_chg_pdfparams() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_utdr_chg_domain( struct unur_gen *gen, double left, double right ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change the left and right borders of the domain of the distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* comment: */ + /* the new boundary points may be +/- UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, UTDR, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (left >= right) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"domain, left >= right"); + return UNUR_ERR_DISTR_SET; + } + + /* copy new boundaries into generator object */ + DISTR.BD_LEFT = left; + DISTR.BD_RIGHT = right; + GEN->il = left; + GEN->ir = right; + + /* changelog */ + gen->distr->set |= UNUR_DISTR_SET_DOMAIN; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ +#endif + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_utdr_chg_domain() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_utdr_chg_mode( struct unur_gen *gen, double mode ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change mode of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* mode ... mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, UTDR, UNUR_ERR_GEN_INVALID ); + + /* copy parameters */ + DISTR.mode = mode; + + /* no changelog required */ + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_utdr_chg_mode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_utdr_upd_mode( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* recompute mode of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, UTDR, UNUR_ERR_GEN_INVALID ); + + return unur_distr_cont_upd_mode( gen->distr ); +} /* end of unur_utdr_upd_mode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_utdr_chg_pdfarea( struct unur_gen *gen, double area ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* change area below PDF of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* area ... area */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, UTDR, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (area <= 0.) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"area <= 0"); + return UNUR_ERR_DISTR_SET; + } + + /* copy parameters */ + DISTR.area = area; + + /* no changelog required */ + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_utdr_chg_pdfarea() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_utdr_upd_pdfarea( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Deprecated call! */ + /*----------------------------------------------------------------------*/ + /* recompute area below PDF of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, UTDR, UNUR_ERR_GEN_INVALID ); + + return unur_distr_cont_upd_pdfarea( gen->distr ); +} /* end of unur_utdr_upd_pdfarea() */ + +/*---------------------------------------------------------------------------*/ + +#undef DISTR +#undef GEN + +/*****************************************************************************/ +#endif /* USE_DEPRECATED_CODE */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/deprecated_methods.h b/vendor/unuran-1.11.0/src/methods/deprecated_methods.h new file mode 100644 index 0000000..8eb65d1 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/deprecated_methods.h @@ -0,0 +1,509 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: deprecated_methods.h * + * * + * PURPOSE: * + * function prototypes and macros for deprecated routines * + * * + ***************************************************************************** + * * + * THESE ROUTINES SHOULD NOT BE USED ANY MORE! * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef UNUR_DEPRECATED_METHODS_H_SEEN +#define UNUR_DEPRECATED_METHODS_H_SEEN +/*---------------------------------------------------------------------------*/ + +int unur_cstd_chg_pdfparams( UNUR_GEN *generator, double *params, int n_params ); +/* + Change array of parameters of the distribution in a given generator + object. If the given parameters are invalid for the distribution, + no parameters are set. + Notice that optional parameters are (re-)set to their default values if + not given for UNURAN standard distributions. +*/ + +/*---------------------------------------------------------------------------*/ + +int unur_dari_reinit( UNUR_GEN *generator ); +/* + Update an existing generator object after the distribution has been + modified. It must be executed whenever the parameters or the domain + of the distributions has been changed (see below). + It is faster than destroying the existing object and building + a new one from scratch. + If reinitialization has been successful @code{UNUR_SUCCESS} is returned, + in case of a failure an error code is returned. +*/ + +int unur_dari_chg_pmfparams( UNUR_GEN *generator, double *params, int n_params ); +/* + Change array of parameters of the distribution in a given generator + object. Notice that this call simply copies the parameters into + the generator object. Thus if fewer parameters are provided then + the remaining parameters are left unchanged. + + unur_dari_reinit() must be executed before sampling from the + generator again. + + @emph{Important:} The given parameters are not checked against + domain errors; in opposition to the @command{unur__new} calls. +*/ + +int unur_dari_chg_domain( UNUR_GEN *generator, int left, int right ); +/* + Change the left and right border of the domain of the + (truncated) distribution. + If the mode changes when the domain of the (truncated) distribution is + changed, then a correspondig unur_dari_chg_mode() call is required. + (There is no domain checking as in the unur_init() call.) + Use @code{INT_MIN} and @code{INT_MAX} for (minus) infinity. + + unur_dari_reinit() must be executed before sampling from the + generator again. +*/ + +int unur_dari_chg_mode( UNUR_GEN *generator, int mode ); +/* + Change mode of distribution. + unur_dari_reinit() must be executed before sampling from the + generator again. +*/ + + +int unur_dari_upd_mode( UNUR_GEN *generator ); +/* + Recompute the mode of the distribution. This call only works well + when a distribution object from the UNURAN library of standard + distributions is used + (@pxref{Stddist,,Standard distributions}). + Otherwise a (slow) numerical mode finder is called. + If no mode can be found, then an error code is returnded and + @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. + + unur_dari_reinit() must be executed before sampling from the + generator again. +*/ + +int unur_dari_chg_pmfsum( UNUR_GEN *generator, double sum ); +/* + Change sum over the PMF of distribution. + unur_dari_reinit() must be executed before sampling from the + generator again. +*/ + +int unur_dari_upd_pmfsum( UNUR_GEN *generator ); +/* + Recompute sum over the PMF of the distribution. + It only works when a distribution objects from the + UNURAN library of standard distributions is used + (@pxref{Stddist,,Standard distributions}). + Otherwise an error code is returned and @code{unur_errno} + is set to @code{UNUR_ERR_DISTR_DATA}. + + unur_dari_reinit() must be executed before sampling from the + generator again. +*/ + +/*---------------------------------------------------------------------------*/ + +int unur_dsrou_reinit( UNUR_GEN *generator ); +/* + Update an existing generator object after the distribution has been + modified. It must be executed whenever the parameters or the domain + of the distribution have been changed (see below). + It is faster than destroying the existing object and building + a new one from scratch. + If reinitialization has been successful @code{UNUR_SUCCESS} is returned, + in case of a failure an error code is returned. +*/ + +int unur_dsrou_chg_pmfparams( UNUR_GEN *generator, double *params, int n_params ); +/* + Change array of parameters of the distribution in a given generator + object. + + For standard distributions from the UNURAN library the parameters + are checked. It these are invalid, then an error code is + returned. Moreover the domain is updated automatically unless it + has been changed before by a unur_distr_discr_set_domain() call. + Notice that optional parameters are (re-)set to their default + values if not given for UNURAN standard distributions. + + For other distributions @var{params} is simply copied into to + distribution object. It is only checked that @var{n_params} does + not exceed the maximum number of parameters allowed. + Then an error code is returned and @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_NPARAMS}. +*/ + +int unur_dsrou_chg_domain( UNUR_GEN *generator, int left, int right ); +/* + Change left and right border of the domain of the + (truncated) distribution. + If the mode changes when the domain of the (truncated) distribution is + changed, then a correspondig unur_dsrou_chg_mode() is required. + (There is no checking whether the domain is set or not as in the + unur_init() call.) +*/ + +int unur_dsrou_chg_mode( UNUR_GEN *generator, int mode ); +/* + Change mode of distribution. + unur_dsrou_reinit() must be executed before sampling from the + generator again. +*/ + +int unur_dsrou_upd_mode( UNUR_GEN *generator ); +/* + Recompute the mode of the distribution. + See unur_distr_cont_upd_mode() for more details. + + unur_dsrou_reinit() must be executed before sampling from the + generator again. +*/ + +int unur_dsrou_chg_pmfsum( UNUR_GEN *generator, double sum ); +/* + Change sum over PMF of distribution. + unur_dsrou_reinit() must be executed before sampling from the + generator again. +*/ + +int unur_dsrou_upd_pmfsum( UNUR_GEN *generator ); +/* + Recompute the sum over the the PMF of the distribution. + It only works when a distribution objects from the + UNURAN library of standard distributions is used + (@pxref{Stddist,,Standard distributions}). + Otherwise @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. + + unur_dsrou_reinit() must be executed before sampling from the + generator again. +*/ + +/*---------------------------------------------------------------------------*/ + +int unur_dstd_chg_pmfparams( UNUR_GEN *gen, double *params, int n_params ); +/* + Change array of parameters of the distribution in a given generator + object. If the given parameters are invalid for the distribution, + no parameters are set. + Notice that optional parameters are (re-)set to their default values if + not given for UNURAN standard distributions. + + @emph{Important:} Integer parameter must be given as doubles. +*/ + +/*---------------------------------------------------------------------------*/ + +int unur_ninv_chg_pdfparams(UNUR_GEN *generator, double *params, int n_params); +/* + Change array of parameters of the distribution in a given generator + object. + + For standard distributions from the UNURAN library the parameters + are checked. It these are invalid, then an error code is + returned. Moreover the domain is updated automatically unless it + has been changed before by a unur_distr_discr_set_domain() call. + Notice that optional parameters are (re-)set to their default + values if not given for UNURAN standard distributions. + + For other distributions @var{params} is simply copied into to + distribution object. It is only checked that @var{n_params} does + not exceed the maximum number of parameters allowed. + Then an error code is returned and @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_NPARAMS}. +*/ + +/*---------------------------------------------------------------------------*/ + +int unur_srou_reinit( UNUR_GEN *generator ); +/* + Update an existing generator object after the distribution has been + modified. It must be executed whenever the parameters or the domain + of the distributions have been changed (see below). + It is faster than destroying the existing object and building + a new one from scratch. + If reinitialization has been successful @code{UNUR_SUCCESS} is returned, + in case of a failure an error code is returned. +*/ + +int unur_srou_chg_pdfparams( UNUR_GEN *generator, double *params, int n_params ); +/* + Change array of parameters of the distribution in a given generator + object. + + For standard distributions from the UNURAN library the parameters + are checked. It these are invalid, then an error code is + returned. Moreover the domain is updated automatically unless it + has been changed before by a unur_distr_discr_set_domain() call. + Notice that optional parameters are (re-)set to their default + values if not given for UNURAN standard distributions. + + For other distributions @var{params} is simply copied into to + distribution object. It is only checked that @var{n_params} does + not exceed the maximum number of parameters allowed. + Then an error code is returned and @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_NPARAMS}. +*/ + +int unur_srou_chg_domain( UNUR_GEN *generator, double left, double right ); +/* + Change left and right border of the domain of the + (truncated) distribution. + If the mode changes when the domain of the (truncated) distribution is + changed, then a correspondig unur_srou_chg_mode() is required. + (There is no checking whether the domain is set or not as in the + unur_init() call.) +*/ + +int unur_srou_chg_mode( UNUR_GEN *generator, double mode ); +/* + Change mode of distribution. + unur_srou_reinit() must be executed before sampling from the + generator again. +*/ + +int unur_srou_upd_mode( UNUR_GEN *generator ); +/* + Recompute the mode of the distribution. + See unur_distr_cont_upd_mode() for more details. + + unur_srou_reinit() must be executed before sampling from the + generator again. +*/ + +int unur_srou_chg_pdfarea( UNUR_GEN *generator, double area ); +/* + Change area below PDF of distribution. + unur_srou_reinit() must be executed before sampling from the + generator again. +*/ + +int unur_srou_upd_pdfarea( UNUR_GEN *generator ); +/* + Recompute the area below the PDF of the distribution. + It only works when a distribution objects from the + UNURAN library of standard distributions is used + (@pxref{Stddist,,Standard distributions}). + Otherwise @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. + + unur_srou_reinit() must be executed before sampling from the + generator again. +*/ + +/*---------------------------------------------------------------------------*/ + +int unur_ssr_reinit( UNUR_GEN *generator ); +/* + Update an existing generator object after the distribution has been + modified. It must be executed whenever the parameters or the domain + of the distribution has been changed (see below). + It is faster than destroying the existing object and build + a new one from scratch. + If reinitialization has been successful @code{UNUR_SUCCESS} is returned, + in case of a failure an error code is returned. +*/ + +int unur_ssr_chg_pdfparams( UNUR_GEN *generator, double *params, int n_params ); +/* + Change array of parameters of the distribution in a given generator + object. + + For standard distributions from the UNURAN library the parameters + are checked. It these are invalid, then an error code is + returned. Moreover the domain is updated automatically unless it + has been changed before by a unur_distr_discr_set_domain() call. + Notice that optional parameters are (re-)set to their default + values if not given for UNURAN standard distributions. + + For other distributions @var{params} is simply copied into to + distribution object. It is only checked that @var{n_params} does + not exceed the maximum number of parameters allowed. + Then an error code is returned and @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_NPARAMS}. +*/ + +int unur_ssr_chg_domain( UNUR_GEN *generator, double left, double right ); +/* + Change left and right border of the domain of the distribution. + If the mode changes when the domain of the distribution is + changed, then a correspondig unur_ssr_chg_mode() is required. + (There is no domain checking as in the unur_init() call.) +*/ + +int unur_ssr_chg_mode( UNUR_GEN *generator, double mode ); +/* + Change mode of distribution. + unur_ssr_reinit() must be executed before sampling from the + generator again. +*/ + +int unur_ssr_upd_mode( UNUR_GEN *generator ); +/* + Recompute the mode of the distribution. + See unur_distr_cont_upd_mode() for more details. + + unur_ssr_reinit() must be executed before sampling from the + generator again. +*/ + +int unur_ssr_chg_pdfarea( UNUR_GEN *generator, double area ); +/* + Change area below PDF of distribution. + unur_ssr_reinit() must be executed before sampling from the + generator again. +*/ + +int unur_ssr_upd_pdfarea( UNUR_GEN *generator ); +/* + Recompute the area below the PDF of the distribution. + It only works when a distribution objects from the + UNURAN library of standard distributions is used + (@pxref{Stddist,,Standard distributions}). + Otherwise @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. + + unur_ssr_reinit() must be executed before sampling from the + generator again. +*/ + +/*---------------------------------------------------------------------------*/ + +int unur_tdr_reinit( UNUR_GEN *generator ); +/* + Update an existing generator object after the distribution has been + modified. It must be executed whenever the parameters of the + distribution has been changed. + It is faster than destroying the existing object and build + a new one from scratch. + If reinitialization has been successful @code{UNUR_SUCCESS} is + returned. In case of a failure an error code is returned. Then + @var{generator} cannot be used before another successful reinit + (with proper parameters for the underlying distribution). +*/ + +/*---------------------------------------------------------------------------*/ + +int unur_tdrgw_reinit( UNUR_GEN *generator ); +/* + Update an existing generator object after the distribution has been + modified. It must be executed whenever the parameters of the + distribution has been changed. + It is faster than destroying the existing object and build + a new one from scratch. + If reinitialization has been successful @code{UNUR_SUCCESS} is + returned. In case of a failure an error code is returned. Then + @var{generator} cannot be used before another successful reinit + (with proper parameters for the underlying distribution). +*/ + +/*---------------------------------------------------------------------------*/ + +int unur_utdr_reinit( UNUR_GEN *generator ); +/* + Update an existing generator object after the distribution has been + modified. It must be executed whenever the parameters or the domain + of the distributions has been changed (see below). + It is faster than destroying the existing object and building + a new one from scratch. + If reinitialization has been successful @code{UNUR_SUCCESS} is returned, + in case of a failure an error code is returned. + + @emph{Important:} Do not use the @var{generator} object for + sampling after a failed reinit, since otherwise it may produce + garbage. +*/ + +int unur_utdr_chg_pdfparams( UNUR_GEN *generator, double *params, int n_params ); +/* + Change array of parameters of the distribution in a given generator + object. + + For standard distributions from the UNURAN library the parameters + are checked. It these are invalid, then an error code is + returned. Moreover the domain is updated automatically unless it + has been changed before by a unur_distr_discr_set_domain() call. + Notice that optional parameters are (re-)set to their default + values if not given for UNURAN standard distributions. + + For other distributions @var{params} is simply copied into to + distribution object. It is only checked that @var{n_params} does + not exceed the maximum number of parameters allowed. + Then an error code is returned and @code{unur_errno} is set to + @code{UNUR_ERR_DISTR_NPARAMS}. +*/ + +int unur_utdr_chg_domain( UNUR_GEN *generator, double left, double right ); +/* + Change left and right border of the domain of the + (truncated) distribution. + If the mode changes when the domain of the (truncated) distribution is + changed, then a correspondig unur_utdr_chg_mode() is required. + (There is no domain checking as in the unur_init() call.) +*/ + +int unur_utdr_chg_mode( UNUR_GEN *generator, double mode ); +/* + Change mode of distribution. + unur_utdr_reinit() must be executed before sampling from the + generator again. +*/ + +int unur_utdr_upd_mode( UNUR_GEN *generator ); +/* + Recompute the mode of the distribution. + See unur_distr_cont_upd_mode() for more details. + + unur_srou_reinit() must be executed before sampling from the + generator again. +*/ + +int unur_utdr_chg_pdfarea( UNUR_GEN *generator, double area ); +/* + Change area below PDF of distribution. + unur_utdr_reinit() must be executed before sampling from the + generator again. +*/ + +int unur_utdr_upd_pdfarea( UNUR_GEN *generator ); +/* + Recompute the area below the PDF of the distribution. + It only works when a distribution objects from the + UNURAN library of standard distributions is used + (@pxref{Stddist,,Standard distributions}). + Otherwise @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. + + unur_srou_reinit() must be executed before sampling from the + generator again. +*/ + +/*---------------------------------------------------------------------------*/ +#endif /* UNUR_DEPRECATED_METHODS_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/deprecated_tdrgw.h b/vendor/unuran-1.11.0/src/methods/deprecated_tdrgw.h new file mode 100644 index 0000000..94d88da --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/deprecated_tdrgw.h @@ -0,0 +1,109 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tdrgw.h * + * * + * PURPOSE: * + * function prototypes for method TDRGW * + * (Transformed Density Rejection - Gilks & Wild variant) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * THIS METHOD HAS BEEN RENAMED TO 'ARS'. * + * THE CORRESPONDING ROUTINES SHOULD NOT BE USED ANY MORE! * + * * + * Please simply replace 'tdrgw' by 'ars' to get the new function names. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =deprecatedMETHOD TDRGW Transformed Density Rejection - Gilks&Wild variant + + =UP Methods_for_CONT + + =REQUIRED concave logPDF, derivative of logPDF + + =OPTIONAL mode + + =SPEED Set-up: fast, Sampling: slow + + =REINIT supported + + =REF [GWa92] [HLD04: Cha.4] + + =DESCRIPTION + Same as method ARS. + Please simply replace 'tdrgw' by 'ars' to get the new function names. + + =HOWTOUSE + Same as method ARS. + Please simply replace 'tdrgw' by 'ars' to get the new function names. + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +#define unur_tdrgw_new( distr ) \ + (unur_ars_new( distr )) + +#define unur_tdrgw_set_max_intervals( par,max_ivs ) \ + (unur_ars_set_max_intervals( (par),(max_ivs) )) + +#define unur_tdrgw_set_cpoints( par,n_cpoints,cpoints ) \ + (unur_ars_set_cpoints( (par),(n_cpoints),(cpoints) )) + +#define unur_tdrgw_set_reinit_percentiles( par,n_percentiles,percentiles ) \ + (unur_ars_set_reinit_percentiles( (par),(n_percentiles),(percentiles) )) + +#define unur_tdrgw_chg_reinit_percentiles( gen,n_percentiles,percentiles ) \ + (unur_ars_chg_reinit_percentiles( (gen),(n_percentiles),(percentiles) )) + +#define unur_tdrgw_set_reinit_ncpoints( par,ncpoints ) \ + (unur_ars_set_reinit_ncpoints( (par),(ncpoints) )) + +#define unur_tdrgw_chg_reinit_ncpoints( gen,ncpoints ) \ + (unur_ars_chg_reinit_ncpoints( (gen),(ncpoints) )) + +#define unur_tdrgw_set_verify( par,verify ) \ + (unur_ars_set_verify( (par),(verify) )) + +#define unur_tdrgw_chg_verify( gen,verify ) \ + (unur_ars_chg_verify( (gen),(verify) )) + +#define unur_tdrgw_set_pedantic( par,pedantic ) \ + (unur_ars_set_pedantic( (par),(pedantic) )) + +#define unur_tdrgw_get_loghatarea( gen ) \ + (unur_ars_get_loghatarea( gen )) + +#define unur_tdrgw_eval_invcdfhat( gen,u ) \ + (unur_ars_eval_invcdfhat( (gen),(u) )) + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/deprecated_vmt.c b/vendor/unuran-1.11.0/src/methods/deprecated_vmt.c new file mode 100644 index 0000000..4e8c2c9 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/deprecated_vmt.c @@ -0,0 +1,573 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: deprecated_vmt.h * + * * + * TYPE: continuous multivariate random variate * + * METHOD: generated random vector with independent components with * + * given marginal distribution and use linear transformation * + * of vector. * + * * + * DESCRIPTION: * + * multivariate distribution with given mean vector and * + * covariance matrix. * + * * + ***************************************************************************** + * * + * THIS METHOD AND THE CORRESPONDING ROUTINES SHOULD NOT BE USED ANY MORE! * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Devroye, L. (1986): Non-Uniform Random Variate Generation, New-York * + * * + * [2] Hoermann, W., J. Leydold, and G. Derflinger (2004): * + * Automatic Nonuniform Random Variate Generation, Springer, Berlin. * + * * + ***************************************************************************** + * * + * VMT generates random vectors for distributions with given mean * + * vector mu and covariance matrix Sigma. It produces random vectors * + * of the form X = L Y + mu, where L is the Cholesky factor of Sigma, * + * i.e. L L^t = Sigma, and Y has independent components of the same * + * distribution with mean 0 and standard deviation 1. * + * * + * See [2], Sect.11.1.6, Alg.11.3. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen.h" +#include "x_gen_source.h" +#include "auto.h" +#include "deprecated_vmt.h" +#include "deprecated_vmt_struct.h" + +/*---------------------------------------------------------------------------*/ +#ifdef USE_DEPRECATED_CODE +/*---------------------------------------------------------------------------*/ +/* Variants */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define VMT_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "VMT" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_vmt_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_vmt_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_vmt_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_vmt_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_vmt_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_vmt_sample_cvec( struct unur_gen *gen, double *vec ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static int _unur_vmt_make_marginal_gen( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* make generators for marginal distributions */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_vmt_debug_init( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cvec /* data for distribution object */ + +#define PAR ((struct unur_vmt_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_vmt_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cvec /* data for distribution in generator object */ + +#define SAMPLE gen->sample.cvec /* pointer to sampling routine */ + +/*---------------------------------------------------------------------------*/ + +#define _unur_vmt_getSAMPLE(gen) ( _unur_vmt_sample_cvec ) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_vmt_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CVEC) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CVEC,NULL); + + if (!(distr->set & UNUR_DISTR_SET_MEAN)) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mean"); return NULL; } + if (!(distr->set & UNUR_DISTR_SET_COVAR)) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"covariance matrix"); + return NULL; } + if (!(distr->set & UNUR_DISTR_SET_STDMARGINAL)) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"standardized marginals"); + return NULL; } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_vmt_par) ); + COOKIE_SET(par,CK_VMT_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + par->method = UNUR_METH_VMT ; /* method */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_vmt_init; + + return par; + +} /* end of unur_vmt_new() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_vmt_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + _unur_check_NULL( GENTYPE,par,NULL ); + + /* check input */ + if ( par->method != UNUR_METH_VMT ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_VMT_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_vmt_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* initialize generators for marginal distribution */ + if (_unur_vmt_make_marginal_gen(gen) != UNUR_SUCCESS) { + _unur_vmt_free(gen); return NULL; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_vmt_debug_init(gen); +#endif + + /* o.k. */ + return gen; + +} /* end of _unur_vmt_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_vmt_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* (re)set sampling routine */ + SAMPLE = _unur_vmt_getSAMPLE(gen); + + /* free list of (old) marginal generators */ + if (gen->gen_aux_list) + _unur_gen_list_free( gen->gen_aux_list, gen->n_gen_aux_list ); + + /* initialize generators for marginal distribution */ + return _unur_vmt_make_marginal_gen(gen); +} /* end of _unur_vmt_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_vmt_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_VMT_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_vmt_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_VMT_GEN); + + /* dimension of distribution */ + GEN->dim = gen->distr->dim; + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_vmt_getSAMPLE(gen); + gen->destroy = _unur_vmt_free; + gen->clone = _unur_vmt_clone; + gen->reinit = _unur_vmt_reinit; + + /* cholesky factor of covariance matrix */ + GEN->cholesky = DISTR.cholesky; + + /* initialize pointer */ + GEN->marginalgen_list = NULL; + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_vmt_create() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_vmt_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_vmt_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_VMT_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* cholesky factor of covariance matrix */ + CLONE->cholesky = clone->distr->data.cvec.cholesky; + + /* marginal generators are (also) stored as auxiliary generator */ + /* which has already been cloned by generic_clone. */ + CLONE->marginalgen_list = clone->gen_aux_list; + + return clone; + +#undef CLONE +} /* end of _unur_vmt_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_vmt_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_VMT ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_VMT_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + _unur_generic_free(gen); + +} /* end of _unur_vmt_free() */ + +/*****************************************************************************/ + +int +_unur_vmt_sample_cvec( struct unur_gen *gen, double *vec ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* vec ... random vector (result) */ + /*----------------------------------------------------------------------*/ +{ +#define idx(a,b) (a*GEN->dim+b) + int j,k; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_VMT_GEN,UNUR_ERR_COOKIE); + + while (1) { + + /* generate random vector with independent components */ + for (j=0; jdim; j++) + vec[j] = unur_sample_cont(GEN->marginalgen_list[j]); + + /* + transform to desired covariance structure: + X = L.Y + mu + where + L ... cholesky factor of the covariance matrix + Y ... vector with indenpent components (generated above) + mu ... mean vector + (notice that L is a lower triangular matrix) + */ + for (k=GEN->dim-1; k>=0; k--) { + vec[k] *= GEN->cholesky[idx(k,k)]; + for (j=k-1; j>=0; j--) + vec[k] += vec[j] * GEN->cholesky[idx(k,j)]; + vec[k] += DISTR.mean[k]; + } + + if ( !(gen->distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) || + _unur_distr_cvec_is_indomain( vec, gen->distr) ) + return UNUR_SUCCESS; + } + +#undef idx +} /* end of _unur_vmt_sample_cvec() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_vmt_make_marginal_gen( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* make generators for marginal distributions */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + if (_unur_distr_cvec_marginals_are_equal(DISTR.stdmarginals, GEN->dim)) { + /* we can use the same generator object for all marginal distributions */ + struct unur_gen *marginalgen = unur_init( unur_auto_new( DISTR.stdmarginals[0] ) ); + if (marginalgen) { + gen->gen_aux_list = _unur_gen_list_set(marginalgen,GEN->dim); + gen->n_gen_aux_list = GEN->dim; + } + } + + else { + int i,j; + int failed = FALSE; + struct unur_gen **marginalgens = _unur_xmalloc( GEN->dim * sizeof(struct unur_gen*) ); + for (i=0; idim; i++) { + marginalgens[i] = unur_init( unur_auto_new( DISTR.stdmarginals[i] ) ); + if (marginalgens[i]==NULL) { + failed=TRUE; break; + } + } + if (failed) { + for (j=0; jgen_aux_list = marginalgens; + gen->n_gen_aux_list = GEN->dim; + } + } + + /* the marginal generator is an auxiliary generator for method VMT, of course */ + GEN->marginalgen_list = gen->gen_aux_list; + + /* verify initialization of marginal generators */ + if (GEN->marginalgen_list == NULL) { + _unur_error(gen->genid,UNUR_ERR_GENERIC,"init of marginal generators failed"); + return UNUR_FAILURE; + } + + return UNUR_SUCCESS; +} /* end of _unur_vmt_make_marginal_gen() */ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_vmt_debug_init( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + int i; + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_VMT_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous multivariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = VMT (Vector Matrix Transformation)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cvec_debug( gen->distr, gen->genid ); + + fprintf(LOG,"%s: generators for standardized marginal distributions = \n",gen->genid); + fprintf(LOG,"%s:\t",gen->genid); + for (i=0; idim; i++) + fprintf(LOG,"[%s] ", GEN->marginalgen_list[i]->genid); + fprintf(LOG,"\n%s:\n",gen->genid); + + fprintf(LOG,"%s: sampling routine = _unur_vmt_sample_cvec()\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); + +} /* end of _unur_vmt_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ +#endif /* USE_DEPRECATED_CODE */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/deprecated_vmt.h b/vendor/unuran-1.11.0/src/methods/deprecated_vmt.h new file mode 100644 index 0000000..70dbcf6 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/deprecated_vmt.h @@ -0,0 +1,119 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: deprecated_vmt.h * + * * + * PURPOSE: * + * function prototypes for method VMT * + * (Vector Matrix Transformation) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * THIS METHOD AND THE CORRESPONDING ROUTINES SHOULD NOT BE USED ANY MORE! * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =deprecatedMETHOD VMT Vector Matrix Transformation + + =UP Methods_for_CVEC + + =REQUIRED mean vector, covariance matrix, standardized marginal distributions + + =SPEED Set-up: slow, + Sampling: depends on dimension + + =REINIT supported + + =REF [HLD04: Sect.11.1.6, Alg.11.3.] + + =DESCRIPTION + VMT generates random vectors for distributions with given mean + vector mu and covariance matrix @unurmath{Sigma.} It produces random vectors + of the form @unurmath{X = L Y + mu,} where @unurmath{L} is the + Cholesky factor of Sigma, i.e. @unurmath{L L^t = Sigma,} and + @unurmath{Y} has independent components of the same + distribution with mean 0 and standard deviation 1. + + The method VMT has been implemented especially to sample from a + multinormal distribution. Nevertheless, it can also be used (or + abused) for other distributions. However, notice that the given + standardized marginal distributions are not checked; i.e. + if the given distributions do not have mean 0 and variance 1 + then @unurmath{mu} and @unurmath{Sigma} are not the mean vector + and covariance matrix, respectively, of the resulting + distribution. + + @strong{Important:} Notice that except for the multinormal + distribution the given marginal distribution are distorted by + the transformation using the Cholesky matrix. Thus for other + (non-multinormal) distributions this method should only be used + when everything else fails and some approximate results which + might even be not entirely correct are better than no results. + A much better method is the NORTA (NORmal To Anything) method, + see @ref{NORTA}. + + =HOWTOUSE + Create a multivariate generator object, set mean vector and + covariance matrix by means of the unur_distr_cvec_set_mean() and + unur_distr_cvec_set_covar() call. Set standard marginal + distributions using unur_distr_cvec_set_stdmarginals() , + unur_distr_cvec_set_stdmarginal_array() , or + unur_distr_cvec_set_stdmarginal_list(). + (Do not use the corresponding calls for the (non-standard) + marginal distributions). + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + + The method can also be used with multivariate distribution with + a truncated domain, i.e., where the domain has been set by a + unur_distr_cvec_set_domain_rect() call. However, it then uses a + simple rejection method that can have extremely poor rejection + constant especially when dimension is (even moderately) high. + + There are no optional parameters for this method. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_vmt_new( const UNUR_DISTR *distribution ); +/* + Get parameters for generator. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ + + diff --git a/vendor/unuran-1.11.0/src/methods/deprecated_vmt_struct.h b/vendor/unuran-1.11.0/src/methods/deprecated_vmt_struct.h new file mode 100644 index 0000000..9cd1c6a --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/deprecated_vmt_struct.h @@ -0,0 +1,56 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: deprecated_vmt_struct.h * + * * + * PURPOSE: * + * declares structures for method VMT * + * (Vector Matrix Transformation) * + * * + ***************************************************************************** + * * + * THIS METHOD AND THE CORRESPONDING ROUTINES SHOULD NOT BE USED ANY MORE! * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_vmt_par { + int dummy; +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_vmt_gen { + struct unur_gen **marginalgen_list; /* list of generators for marginal distributions */ + double *cholesky; /* cholesky factor of covariance matrix */ + int dim; /* dimension of distribution */ +}; + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/methods/dext.c b/vendor/unuran-1.11.0/src/methods/dext.c new file mode 100644 index 0000000..e87a1f4 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dext.c @@ -0,0 +1,680 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dext.c * + * * + * TYPE: discrete univariate random variate * + * METHOD: wrapper for external generator * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * DEXT is a wrapper that allows to use external generators within the * + * framework of UNURAN. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "dext.h" +#include "dext_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Variants: none */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "DEXT" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dext_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dext_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dext_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dext_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_dext_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* There are sampling routines, since every distribution has its own. */ +/* Sampling routines are defined in ../distributions/ for each distributions.*/ +/* double _unur_dext_sample( UNUR_GEN *gen ); does not exist! */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_dext_debug_init( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_dext_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.discr /* data for distribution object */ + +#define PAR ((struct unur_dext_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_dext_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.discr /* data for distribution in generator object */ + +#define SAMPLE gen->sample.discr /* pointer to sampling routine */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_dext_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object (can be NULL!) */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check distribution */ + if (distr != NULL) { + if (distr->type != UNUR_DISTR_DISCR) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_DISCR,NULL); + } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_dext_par) ); + COOKIE_SET(par,CK_DEXT_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->init = NULL; /* pointer to initialization routine for external generator */ + PAR->sample = NULL; /* pointer to sampling routine for external generator */ + + par->method = UNUR_METH_DEXT; /* method */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for initializing generator */ + par->init = _unur_dext_init; + + return par; + +} /* end of unur_dext_new() */ + +/*****************************************************************************/ + +int +unur_dext_set_init( struct unur_par *par, int (*init)(struct unur_gen *gen) ) + /*----------------------------------------------------------------------*/ + /* set initialization routine for external generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* init ... pointer to initialization routine for external generator */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, DEXT ); + + /* store date */ + PAR->init = init; + + return UNUR_SUCCESS; + +} /* end if unur_dext_set_init() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dext_set_sample( struct unur_par *par, int (*sample)(struct unur_gen *gen) ) + /*----------------------------------------------------------------------*/ + /* set sampling routine for external generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* sample ... pointer to sampling routine for external generator */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_NULL( GENTYPE, sample, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, DEXT ); + + /* store date */ + PAR->sample = sample; + + return UNUR_SUCCESS; + +} /* end if unur_dext_set_sample() */ + +/*---------------------------------------------------------------------------*/ + +void * +unur_dext_get_params( struct unur_gen *gen, size_t size ) + /*----------------------------------------------------------------------*/ + /* Get pointer to memory block for storing parameters of external */ + /* generator. The memory block is (re-) allocated if necessary. */ + /* If size is set 0, then only the pointer stored in the generator */ + /* object is returned. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* size ... size if the memory block */ + /* */ + /* return: */ + /* pointer to memory block that contains parameters */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, NULL ); + COOKIE_CHECK(gen, CK_DEXT_GEN, NULL); + + /* Is it really necessary to check the method? No! */ + /* if ( gen->method != UNUR_METH_DEXT ) { */ + /* _unur_error((gen)->genid,UNUR_ERR_GEN_INVALID,""); */ + /* return NULL; */ + /* } */ + + if (size && size != GEN->size_param) { + /* allocate memory block */ + GEN->param = _unur_xrealloc(GEN->param, size); + GEN->size_param = size; + } + + return GEN->param; +} /* end of unur_dext_get_params() */ + + +/*---------------------------------------------------------------------------*/ + +double * +unur_dext_get_distrparams( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Get pointer to array of parameters of underlying distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to double array */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + CHECK_NULL(gen, NULL); + COOKIE_CHECK(gen, CK_DEXT_GEN, NULL); + + return DISTR.params; +} /* end of unur_dext_get_distrparams() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dext_get_ndistrparams( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Get size of array of parameters of underlying distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* length of double array */ + /* */ + /* error: */ + /* return 0 */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + CHECK_NULL(gen, 0); + COOKIE_CHECK(gen, CK_DEXT_GEN, 0); + + return DISTR.n_params; +} /* end of unur_dext_get_ndistrparams() */ + +/*---------------------------------------------------------------------------*/ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_dext_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_DEXT ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; + } + COOKIE_CHECK(par,CK_DEXT_PAR,NULL); + + /* we need a sampling routine */ + if (PAR->sample == NULL) { + _unur_error(GENTYPE,UNUR_ERR_GEN_CONDITION,"sampling routine missing"); + return NULL; + } + + /* create a new empty generator object */ + gen = _unur_dext_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* run special init routine for external generator */ + if (GEN->init != NULL) { + if (GEN->init(gen) != UNUR_SUCCESS) { + /* init failed --> could not find a sampling routine */ + _unur_error(GENTYPE,UNUR_FAILURE,"init for external generator failed"); + _unur_dext_free(gen); return NULL; + } + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_dext_debug_init(gen); +#endif + + /* o.k. */ + return gen; + +} /* end of _unur_dext_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_dext_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* run special init routine for external generator */ + if (GEN->init != NULL) { + if (GEN->init(gen) != UNUR_SUCCESS) { + /* init failed --> could not find a sampling routine */ + _unur_error(GENTYPE,UNUR_FAILURE,"init for external generator failed"); + return UNUR_FAILURE; + } + } + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_dext_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_dext_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + struct unur_distr *distr = NULL; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_DEXT_PAR,NULL); + + /* need a distribution object */ + if (par->distr == NULL) + par->distr = distr = unur_distr_discr_new(); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_dext_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_DEXT_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = PAR->sample; /* will be set in _unur_dext_init() */ + gen->destroy = _unur_dext_free; + gen->clone = _unur_dext_clone; + gen->reinit = _unur_dext_reinit; + + /* copy data */ + GEN->init = PAR->init; + GEN->sample = PAR->sample; + + /* defaults */ + GEN->param = NULL; /* parameters for the generator */ + GEN->size_param = 0; /* size of parameter object */ + + /* clean up */ + if (distr) _unur_distr_free(distr); + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_dext_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_dext_create() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_dext_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_dext_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_DEXT_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* copy parameters for special generators */ + if (GEN->param) { + CLONE->param = _unur_xmalloc( GEN->size_param ); + memcpy( CLONE->param, GEN->param, GEN->size_param ); + } + + return clone; + +#undef CLONE +} /* end of _unur_dext_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_dext_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* magic cookies */ + COOKIE_CHECK(gen,CK_DEXT_GEN,RETURN_VOID); + + /* check input */ + if ( gen->method != UNUR_METH_DEXT ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; + } + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + if (GEN->param) free(GEN->param); + + _unur_generic_free(gen); + +} /* end of _unur_dext_free() */ + +/*****************************************************************************/ + +/** + double _unur_dext_sample( struct unur_gen *gen ) {} + Does not exists !!! + Sampling routines are set by user via unur_dext_set_sample(). +**/ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_dext_debug_init( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DEXT_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = discrete univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = wrapper for external generator\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + /* distribution */ + _unur_distr_discr_debug( gen->distr, gen->genid, FALSE ); + +} /* end of _unur_dext_info_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_dext_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + int samplesize = 10000; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," domain = (%d, %d)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info,"\n"); + + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + + /* method */ + _unur_string_append(info,"method: DEXT (wrapper for Discrete EXTernal generators)\n"); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," E [#urn] = %.2f [approx.]\n", + unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize)); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters: none\n"); + _unur_string_append(info,"\n"); + /* Not displayed: + int unur_dext_set_init( UNUR_PAR *parameters, int (*init)(UNUR_GEN *gen) ); + int unur_dext_set_sample( UNUR_PAR *parameters, int (*sample)(UNUR_GEN *gen) ); + */ + } + + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_dext_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/dext.h b/vendor/unuran-1.11.0/src/methods/dext.h new file mode 100644 index 0000000..d380d63 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dext.h @@ -0,0 +1,185 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dext.h * + * * + * PURPOSE: * + * function prototypes for method DEXT * + * (wrapper for Continuous EXTernal generators) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD DEXT wrapper for Discrete EXTernal generators + + =UP Methods_for_DISCR + + =REQUIRED routine for sampling discrete random variates + + =SPEED depends on external generator + + =REINIT supported + + =DESCRIPTION + Method DEXT is a wrapper for external generators for discrete + univariate distributions. It allows the usage of external + random variate generators within the UNU.RAN framework. + + =HOWTOUSE + The following steps are required to use some external generator + within the UNU.RAN framework (some of these are optional): + + @enumerate + @item + Make an empty generator object using a unur_dext_new() call. + The argument @var{distribution} is optional and can be replaced + by NULL. However, it is required if you want to pass + parameters of the generated distribution to the external + generator or for running some validation tests provided by + UNU.RAN. + + @item + Create an initialization routine of type + @code{int (*init)(UNUR_GEN *gen)} and plug it into the generator + object using the unur_dext_set_init() call. Notice that the + @var{init} routine must return @code{UNUR_SUCCESS} when it has + been executed successfully and @code{UNUR_FAILURE} otherwise. + It is possible to get the size of and the pointer to the array + of parameters of the underlying distribution object by the + respective calls unur_dext_get_ndistrparams() and + unur_dext_get_distrparams(). + Parameters for the external generator that are computed in the + @var{init} routine can be stored in a single array or structure + which is available by the unur_dext_get_params() call. + + Using an @var{init} routine is optional and can be omitted. + + @item + Create a sampling routine of type + @code{int (*sample)(UNUR_GEN *gen)} and plug it into the + generator object using the unur_dext_set_sample() call. + + Uniform random numbers are provided by the unur_sample_urng() + call. Do not use your own implementation of a uniform random + number generator directly. If you want to use your own random + number generator we recommend to use the UNU.RAN interface (see + @pxref{URNG,,Using uniform random number generators}). + + The array or structure that contains parameters for the external + generator that are computed in the @var{init} routine are + available using the unur_dext_get_params() call. + + Using a @var{sample} routine is of course obligatory. + @end enumerate + + It is possible to change the parameters and the domain of the + chosen distribution and run unur_reinit() to reinitialize the + generator object. The @var{init} routine is then called again. + + Here is a short example that demonstrates the application of + this method by means of the geometric distribution: + + @smallexample + @include ref_example_dext.texi + @end smallexample + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_dext_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for new generator. +*/ + +/*...........................................................................*/ + +int unur_dext_set_init( UNUR_PAR *parameters, int (*init)(UNUR_GEN *gen) ); +/* + Set initialization routine for external generator. Inside the + + @emph{Important:} The routine @var{init} must return + @code{UNUR_SUCCESS} when the generator was initialized successfully + and @code{UNUR_FAILURE} otherwise. + + Parameters that are computed in the @var{init} routine can be + stored in an array or structure that is avaiable by means of the + unur_dext_get_params() call. Parameters of the underlying + distribution object can be obtained by the + unur_dext_get_distrparams() call. +*/ + +int unur_dext_set_sample( UNUR_PAR *parameters, int (*sample)(UNUR_GEN *gen) ); +/* + Set sampling routine for external generator. + + @emph{Important:} + Use @code{unur_sample_urng(gen)} to get a uniform random number. + The pointer to the array or structure that contains the parameters + that are precomputed in the @var{init} routine are available by + @code{unur_dext_get_params(gen,0)}. + Additionally one can use the unur_dext_get_distrparams() call. +*/ + +void *unur_dext_get_params( UNUR_GEN *generator, size_t size ); +/* + Get pointer to memory block for storing parameters of external + generator. A memory block of size @var{size} is automatically (re-) + allocated if necessary and the pointer to this block is stored in + the @var{generator} object. If one only needs the pointer to this + memory block set @var{size} to @code{0}. + + Notice, that @var{size} is the size of the memory block and not the + length of an array. + + @emph{Important:} This rountine should only be used in the + initialization and sampling routine of the external generator. +*/ + +double *unur_dext_get_distrparams( UNUR_GEN *generator ); +/* */ + +int unur_dext_get_ndistrparams( UNUR_GEN *generator ); +/* + Get size of and pointer to array of parameters of underlying + distribution in @var{generator} object. + + @emph{Important:} These rountines should only be used in the + initialization and sampling routine of the external generator. +*/ + +/*...........................................................................*/ + + +/* =END */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/dext_struct.h b/vendor/unuran-1.11.0/src/methods/dext_struct.h new file mode 100644 index 0000000..158a7fb --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dext_struct.h @@ -0,0 +1,54 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dext_struct.h * + * * + * PURPOSE: * + * declares structures for method DEXT * + * (wrapper for Discrete EXTernal generators) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_dext_par { /* data for external generator */ + int (*init) (UNUR_GEN *gen); /* pointer to initialization routine */ + int (*sample)(UNUR_GEN *gen); /* pointer to sampling routine */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_dext_gen { + int (*init) (UNUR_GEN *gen); /* pointer to initialization routine */ + int (*sample)(UNUR_GEN *gen); /* pointer to sampling routine */ + + void *param; /* parameters for the generator */ + size_t size_param; /* size of parameter object */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/dgt.c b/vendor/unuran-1.11.0/src/methods/dgt.c new file mode 100644 index 0000000..89e9e7c --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dgt.c @@ -0,0 +1,997 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dgt.c * + * * + * TYPE: discrete univariate random variate * + * METHOD: guide table (indexed search) * + * * + * DESCRIPTION: * + * Given N discrete events with different probabilities P[k] * + * produce a value k consistent with its probability. * + * * + * REQUIRED: pointer to probability vector * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2009 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Chen, H. C. and Asau, Y. (1974): On generating random variates * + * from an empirical distribution, AIIE Trans. 6, pp. 163-166 * + * * + * SUMMARY: * + * [2] Devroye, L. (1986): Non-Uniform Random Variate Generation, New-York * + * * + ***************************************************************************** + * * + * This method a varient of the inversion method, i.e. * + * * + * (1) Generate a random number U ~ U(0,1). * + * (2) Find largest integer I such that F(I) = P(X<=I) <= U. * + * * + * Step (2) is the crucial step. Using sequential search requires O(N) * + * comparisons. Indexed search however uses a guide table to jump to some * + * I' <= I near I. In a preprossing step (0,1) is partitioned into N * + * equal intervals and P(X<=I) <= (k-1)/N is solved for all k=1,...,N, * + * and the solutions are stored in a table (guide table). Setup this * + * table can be done in O(N). [2] has shown that the expected number of * + * of comparisons is at most 2. * + * * + * In the current implementation we use a variant that allows a different * + * size for the guide table. Bigger guide tables reduce the expected * + * number of comparisions but needs more memory and need more setup time. * + * On the other hand, the guide table can be made arbitrarily small to * + * save memory and setup time. Indeed, for size = 1 we have sequential * + * search again that requires no preprocessing. * + * * + ***************************************************************************** + * * + * VARIANTS: * + * * + * We have three variants for the setup procedure: * + * * + * 1 ... compute (k-1)/N for each k=1,...,N * + * 2 ... compute (k-1)/N by summing up 1/N * + * 0 ... use 1 for large N and 2 for small N (default) * + * * + * variant 2 is faster but is more sensitive to roundoff errors when * + * N is large. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "dgt.h" +#include "dgt_struct.h" + +/*---------------------------------------------------------------------------*/ +/* Variants */ + +#define DGT_VARFLAG_DIV 0x01u /* compute guide table by division n/k */ +#define DGT_VARFLAG_ADD 0x02u /* compute guide table by adding */ + +#define DGT_VAR_THRESHOLD 1000 /* above this value: use variant 1, else 2 */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define DGT_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ +#define DGT_DEBUG_PRINTVECTOR 0x00000100u +#define DGT_DEBUG_TABLE 0x00000200u + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define DGT_SET_GUIDEFACTOR 0x010u +#define DGT_SET_VARIANT 0x020u + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "DGT" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dgt_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dgt_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dgt_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dgt_check_par( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dgt_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_dgt_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dgt_sample( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dgt_create_tables( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* create (allocate) tables */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dgt_make_guidetable( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* create table for indexed search */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_dgt_debug_init( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_dgt_debug_table( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print data for guide table. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_dgt_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.discr /* data for distribution object */ + +#define PAR ((struct unur_dgt_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_dgt_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.discr /* data for distribution in generator object */ + +#define SAMPLE gen->sample.discr /* pointer to sampling routine */ + +/*---------------------------------------------------------------------------*/ + +#define _unur_dgt_getSAMPLE(gen) (_unur_dgt_sample) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_dgt_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_DISCR) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_DISCR,NULL); + + if (DISTR_IN.pv == NULL) { + /* There is no PV try to compute it. */ + if ( DISTR_IN.pmf + && ( (((unsigned)DISTR_IN.domain[1] - (unsigned)DISTR_IN.domain[0]) < UNUR_MAX_AUTO_PV) + || ( (distr->set & UNUR_DISTR_SET_PMFSUM) && DISTR_IN.domain[0] > INT_MIN ) ) ) { + /* However this requires a PMF and either a bounded domain */ + /* or the sum over the PMF. */ + _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PV. Try to compute it."); + } + else { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PV"); return NULL; + } + } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_dgt_par) ); + COOKIE_SET(par,CK_DGT_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->guide_factor = 1.; /* use same size for guide table */ + + par->method = UNUR_METH_DGT; /* method */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_dgt_init; + + return par; + +} /* end of unur_dgt_new() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dgt_set_variant( struct unur_par *par, unsigned variant ) + /*----------------------------------------------------------------------*/ + /* set variant of method */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* variant ... indicator for variant */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, DGT ); + + /* check new parameter for generator */ + if (variant != DGT_VARFLAG_ADD && variant != DGT_VARFLAG_DIV) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_VARIANT,""); + return UNUR_ERR_PAR_VARIANT; + } + + /* changelog */ + par->set |= DGT_SET_VARIANT; + + par->variant = variant; + + return UNUR_SUCCESS; +} /* end of unur_dgt_set_variant() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dgt_set_guidefactor( struct unur_par *par, double factor ) + /*----------------------------------------------------------------------*/ + /* set factor for relative size of guide table */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* factor ... relative size of table */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, DGT ); + + /* check new parameter for generator */ + if (factor < 0) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"relative table size < 0"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->guide_factor = factor; + + /* changelog */ + par->set |= DGT_SET_GUIDEFACTOR; + + return UNUR_SUCCESS; + +} /* end of unur_dgt_set_guidefactor() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_dgt_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; /* pointer to generator object */ + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_DGT ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_DGT_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_dgt_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* check parameters */ + if ( _unur_dgt_check_par(gen) != UNUR_SUCCESS ) { + _unur_dgt_free(gen); return NULL; + } + + /* compute guide table */ + if ( (_unur_dgt_create_tables(gen) != UNUR_SUCCESS) || + (_unur_dgt_make_guidetable(gen) != UNUR_SUCCESS) ) { + _unur_dgt_free(gen); return NULL; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_dgt_debug_init(gen); +#endif + + return gen; +} /* end of _unur_dgt_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_dgt_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int rcode; + + /* check parameters */ + if ( (rcode = _unur_dgt_check_par(gen)) != UNUR_SUCCESS) + return rcode; + + /* compute table */ + if ( ((rcode = _unur_dgt_create_tables(gen)) != UNUR_SUCCESS) || + ((rcode = _unur_dgt_make_guidetable(gen)) != UNUR_SUCCESS) ) { + return rcode; + } + + /* (re)set sampling routine */ + SAMPLE = _unur_dgt_getSAMPLE(gen); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & DGT_DEBUG_REINIT) _unur_dgt_debug_init(gen); +#endif + + return UNUR_SUCCESS; +} /* end of _unur_dgt_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_dgt_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; /* pointer to generator object */ + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_DGT_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_dgt_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_DGT_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_dgt_getSAMPLE(gen); + gen->destroy = _unur_dgt_free; + gen->clone = _unur_dgt_clone; + gen->reinit = _unur_dgt_reinit; + + /* copy some parameters into generator object */ + GEN->guide_factor = PAR->guide_factor; + + /* set all pointers to NULL */ + GEN->cumpv = NULL; + GEN->guide_table = NULL; + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_dgt_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_dgt_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_dgt_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* we need a PV */ + if (DISTR.pv == NULL) { + /* try to compute PV */ + if (unur_distr_discr_make_pv( gen->distr ) <= 0) { + /* not successful */ + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PV"); + return UNUR_ERR_DISTR_REQUIRED; + } + } + + /* default variant? */ + if (gen->variant == 0) /* default variant */ + gen->variant = (DISTR.n_pv > DGT_VAR_THRESHOLD) + ? DGT_VARFLAG_DIV : DGT_VARFLAG_ADD; + + return UNUR_SUCCESS; +} /* end of _unur_dgt_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_dgt_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_dgt_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_DGT_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* copy data for distribution */ + CLONE->cumpv = _unur_xmalloc( DISTR.n_pv * sizeof(double) ); + memcpy( CLONE->cumpv, GEN->cumpv, DISTR.n_pv * sizeof(double) ); + CLONE->guide_table = _unur_xmalloc( GEN->guide_size * sizeof(int) ); + memcpy( CLONE->guide_table, GEN->guide_table, GEN->guide_size * sizeof(int) ); + + return clone; + +#undef CLONE +} /* end of _unur_dgt_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_dgt_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + + /* check arguments */ + if (!gen) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_DGT ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_DGT_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free two auxiliary tables */ + if (GEN->guide_table) free(GEN->guide_table); + if (GEN->cumpv) free(GEN->cumpv); + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_dgt_free() */ + +/*****************************************************************************/ + +int +_unur_dgt_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* integer (sample from random variate) */ + /* */ + /* error: */ + /* return INT_MAX */ + /*----------------------------------------------------------------------*/ +{ + int j; + double u; + + /* check arguments */ + CHECK_NULL(gen,INT_MAX); COOKIE_CHECK(gen,CK_DGT_GEN,INT_MAX); + + /* sample from U(0,1) */ + u = _unur_call_urng(gen->urng); + + /* look up in guide table ... */ + j = GEN->guide_table[(int)(u * GEN->guide_size)]; + /* ... and search */ + u *= GEN->sum; + while (GEN->cumpv[j] < u) j++; + + return (j + DISTR.domain[0]); + +} /* end of _unur_dgt_sample() */ + + +/*---------------------------------------------------------------------------*/ + +int +unur_dgt_eval_invcdf_recycle( const struct unur_gen *gen, double u, double *recycle ) + /*----------------------------------------------------------------------*/ + /* evaluate inverse CDF at u. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* u ... argument for inverse CDF (0<=u<=1) */ + /* recycle ... if not NULL then store recycled 'u' */ + /* */ + /* return: */ + /* integer (inverse CDF) */ + /* */ + /* error: */ + /* return INT_MAX */ + /*----------------------------------------------------------------------*/ +{ + int j; + + /* set default */ + if (recycle) *recycle = 0.; + + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, INT_MAX ); + if ( gen->method != UNUR_METH_DGT ) { + _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); + return INT_MAX; + } + COOKIE_CHECK(gen,CK_DGT_GEN,INT_MAX); + + /* check range of u */ + if ( ! (u>0. && u<1.)) { + if ( ! (u>=0. && u<=1.)) { + _unur_warning(gen->genid,UNUR_ERR_DOMAIN,"U not in [0,1]"); + } + if (u<=0.) return DISTR.domain[0]; + if (u>=1.) return DISTR.domain[1]; + return INT_MAX; /* u == NaN */ + } + + /* look up in guide table ... */ + j = GEN->guide_table[(int)(u * GEN->guide_size)]; + /* ... and search */ + u *= GEN->sum; + while (GEN->cumpv[j] < u) j++; + + if (recycle) { + *recycle = 1. - (GEN->cumpv[j] - u) / DISTR.pv[j]; + } + + j+=DISTR.domain[0]; + + /* validate range */ + if (jDISTR.domain[1]) j = DISTR.domain[1]; + + return j; + +} /* end of unur_dgt_eval_invcdf_recycle() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dgt_eval_invcdf( const struct unur_gen *gen, double u ) + /*----------------------------------------------------------------------*/ + /* evaluate inverse CDF at u. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* u ... argument for inverse CDF (0<=u<=1) */ + /* */ + /* return: */ + /* integer (inverse CDF) */ + /* */ + /* error: */ + /* return INT_MAX */ + /*----------------------------------------------------------------------*/ +{ + return unur_dgt_eval_invcdf_recycle(gen,u,NULL); +} /* end of unur_dgt_eval_invcdf() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_dgt_create_tables( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* create (allocate) tables */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* size of guide table */ + GEN->guide_size = (int)( DISTR.n_pv * GEN->guide_factor); + if (GEN->guide_size <= 0) + /* do not use a guide table whenever params->guide_factor is 0 or less */ + GEN->guide_size = 1; + + /* allocation for cummulated probabilities */ + GEN->cumpv = _unur_xrealloc( GEN->cumpv, DISTR.n_pv * sizeof(double) ); + + /* allocate memory for the guide table */ + GEN->guide_table = _unur_xrealloc( GEN->guide_table, GEN->guide_size * sizeof(int) ); + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_dgt_create_tables() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_dgt_make_guidetable( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* create guide table */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double *pv; /* pointer to probability vector */ + int n_pv; /* length of probability vector */ + double pvh; /* aux variable for computing cumulated sums */ + double gstep; /* step size when computing guide table */ + int i,j; + + /* probability vector */ + pv = DISTR.pv; + n_pv = DISTR.n_pv; + + /* computation of cumulated probabilities */ + for( i=0, pvh=0.; icumpv[i] = ( pvh += pv[i] ); + /* ... and check probability vector */ + if (pv[i] < 0.) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"probability < 0"); + return UNUR_ERR_GEN_DATA; + } + } + GEN->sum = GEN->cumpv[n_pv-1]; + + /* computation of guide-table */ + + if (gen->variant == DGT_VARFLAG_DIV) { + GEN->guide_table[0] = 0; + for( j=1, i=0; jguide_size ;j++ ) { + while( GEN->cumpv[i]/GEN->sum < ((double)j)/GEN->guide_size ) + i++; + if (i >= n_pv) { + _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF,"guide table"); + break; + } + GEN->guide_table[j]=i; + } + } + + else { /* gen->variant == DGT_VARFLAG_ADD */ + gstep = GEN->sum / GEN->guide_size; + pvh = 0.; + for( j=0, i=0; jguide_size ;j++ ) { + while (GEN->cumpv[i] < pvh) + i++; + if (i >= n_pv) { + _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF,"guide table"); + break; + } + GEN->guide_table[j] = i; + pvh += gstep; + } + } + + /* if there has been an round off error, we have to complete the guide table */ + for( ; jguide_size ;j++ ) + GEN->guide_table[j] = n_pv - 1; + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_dgt_make_guidetable() */ + + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_dgt_debug_init( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DGT_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = discrete univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = indexed search (guide table)\n",gen->genid); + + fprintf(LOG,"%s: variant = %u ",gen->genid,gen->variant); + _unur_print_if_default(gen,DGT_SET_VARIANT); + fprintf(LOG,"\n%s:\n",gen->genid); + + _unur_distr_discr_debug( gen->distr,gen->genid,(gen->debug & DGT_DEBUG_PRINTVECTOR)); + + fprintf(LOG,"%s: sampling routine = _unur_dgt_sample()\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: length of probability vector = %d\n",gen->genid,DISTR.n_pv); + fprintf(LOG,"%s: length of guide table = %d (rel. = %g%%", + gen->genid,GEN->guide_size,100.*GEN->guide_factor); + _unur_print_if_default(gen,DGT_SET_GUIDEFACTOR); + if (GEN->guide_size == 1) + fprintf(LOG,") \t (-->sequential search"); + fprintf(LOG,")\n%s:\n",gen->genid); + + fprintf(LOG,"%s: sum over PMF (as computed) = %#-20.16g\n",gen->genid,GEN->sum); + + if (gen->debug & DGT_DEBUG_TABLE) + _unur_dgt_debug_table(gen); + +} /* end of _unur_dgt_debug_init() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_dgt_debug_table( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write guide table into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int i,j,m; + int n_asts; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DGT_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: guide table:\n", gen->genid); + fprintf(LOG,"%s:\n", gen->genid); + n_asts = 0; + for (i=0; iguide_size; i++){ + fprintf(LOG,"%s: [%5d] -> %5d ", gen->genid, i, GEN->guide_table[i]); + /* print row of asterisks */ + if (i == GEN->guide_size-1) + j = GEN->guide_size - GEN->guide_table[i]; + else + j = GEN->guide_table[i+1] - GEN->guide_table[i] + 1; + for (m=0; mgenid); + fprintf(LOG,"%s: expected number of comparisons = %g\n",gen->genid, + ((double)n_asts)/GEN->guide_size); + fprintf(LOG,"%s:\n", gen->genid); + + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_dgt_debug_table() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_dgt_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = PV [length=%d%s]\n", + DISTR.domain[1]-DISTR.domain[0]+1, + (DISTR.pmf==NULL) ? "" : ", created from PMF"); + _unur_string_append(info," domain = (%d, %d)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info,"\n"); + + /* method */ + _unur_string_append(info,"method: DGT (Guide Table)\n"); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," E [#look-ups] = %g\n", 1+1./GEN->guide_factor); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + _unur_string_append(info," guidefactor = %g %s\n", GEN->guide_factor, + (gen->set & DGT_SET_GUIDEFACTOR) ? "" : "[default]"); + if (gen->set & DGT_SET_VARIANT) + _unur_string_append(info," variant = %d\n", gen->variant); + _unur_string_append(info,"\n"); + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_dgt_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/dgt.h b/vendor/unuran-1.11.0/src/methods/dgt.h new file mode 100644 index 0000000..400eb3a --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dgt.h @@ -0,0 +1,168 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dgt.h * + * * + * PURPOSE: * + * function prototypes for method DGT * + * ((Discrete) Guide Table method (indexed search)) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD DGT (Discrete) Guide Table method (indexed search) + + =UP Methods_for_DISCR + + =REQUIRED probability vector (PV) + + =SPEED Set-up: slow (linear with the vector-length), Sampling: very fast + + =REINIT supported + + =REF [CAa74] [HLD04: Sect.3.1.2] + + =DESCRIPTION + DGT samples from arbitrary but finite probability vectors. Random + numbers are generated by the inversion method, i.e., + + @enumerate + @item + Generate a random number U ~ U(0,1). + @item + Find smallest integer I such that F(I) = P(X<=I) >= U. + @end enumerate + + Step (2) is the crucial step. Using sequential search requires + @i{O(E(X))} comparisons, where @i{E(X)} is the expectation of + the distribution. Indexed search, however, uses a guide table to + jump to some @i{I'} <= @i{I} near @i{I} to find @i{X} in constant + time. Indeed the expected number of comparisons is reduced to 2, + when the guide table has the same size as the probability vector + (this is the default). For larger guide tables this number + becomes smaller (but is always larger than 1), for smaller + tables it becomes larger. For the limit case of table size 1 the + algorithm simply does sequential search (but uses a more expensive + setup then method DSS (@pxref{DSS}). On the other hand the + setup time for guide table is @i{O(N)}, where @i{N} denotes the + length of the probability vector (for size 1 no preprocessing is + required). Moreover, for very large guide tables memory effects might + even reduce the speed of the algorithm. So we do not recommend to + use guide tables that are more than three times larger than the + given probability vector. If only a few random numbers have to be + generated, (much) smaller table sizes are better. + The size of the guide table relative to the length of the given + probability vector can be set by a unur_dgt_set_guidefactor() call. + + There exist two variants for the setup step which can be set by a + unur_dgt_set_variant() call: Variants 1 and 2. + Variant 2 is faster but more sensitive to roundoff errors when the + guide table is large. By default variant 2 is used for short + probability vectors (@i{N}<1000) and variant 1 otherwise. + + By default the probability vector is indexed starting at + @code{0}. However this can be changed in the distribution object by + a unur_distr_discr_set_domain() call. + + The method also works when no probability vector but a PMF is + given. However, then additionally a bounded (not too large) domain + must be given or the sum over the PMF. In the latter case the + domain of the distribution is trucated (see + unur_distr_discr_make_pv() for details). + + =HOWTOUSE + Create an object for a discrete distribution either by setting a + probability vector or a PMF. The performance can be slightly + influenced by setting the size of the used table which can be + changed by unur_dgt_set_guidefactor(). + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_dgt_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_dgt_set_guidefactor( UNUR_PAR *parameters, double factor ); +/* + Set size of guide table relative to length of PV. + Larger guide tables result in faster generation time but require a + more expensive setup. Sizes larger than 3 are not recommended. + If the relative size is set to 0, sequential search is used. + However, this is not recommended, except in exceptional cases, since + method DSS (@pxref{DSS}) is has almost no setup and is thus faster + (but requires the sum over the PV as input parameter). + + Default is @code{1}. +*/ + +int unur_dgt_set_variant( UNUR_PAR *parameters, unsigned variant ); +/* + Set variant for setup step. Possible values are @code{1} or + @code{2}. + Variant @code{2} is faster but more sensitive to roundoff errors + when the guide table is large. + By default variant @code{2} is used for short probability + vectors (@i{N}<1000) and variant @code{1} otherwise. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ + +/** NOT IN MANUAL **/ +int unur_dgt_eval_invcdf_recycle( const UNUR_GEN *generator, double u, double *recycle ); +/* + Compute the @var{U} quantile of the discrete distribution in + @var{generator}, i.e., the smallest integer I such that P(X<=I) >= U. + If @var{u} is out of the domain (0,1) then @code{unur_errno} is set + to @code{UNUR_ERR_DOMAIN} and the respective bound of + the domain of the distribution are returned. + + If @var{recycle} is not NULL then @var{u} is recycled, i.e., + the value of [ P(X<=I) - U] / [ P(X<=I) - P(X<=I-1) ] + is stored in @var{recycle}. +*/ + +int unur_dgt_eval_invcdf( const UNUR_GEN *generator, double u ); +/* + Short for unur_dgt_eval_invcdf_recycle( generator, u, NULL). + */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/dgt_struct.h b/vendor/unuran-1.11.0/src/methods/dgt_struct.h new file mode 100644 index 0000000..0e5128f --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dgt_struct.h @@ -0,0 +1,55 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dgt_struct.h * + * * + * PURPOSE: * + * declares structures for method DGT * + * (Discrete Guide Table (indexed search)) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_dgt_par { + double guide_factor; /* relative length of guide table. (DEFAULT = 1) */ + /* length of guide table = guide_factor * len */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_dgt_gen { + double sum; /* sum of all probabilities = cumpv[len-1] */ + double *cumpv; /* pointer to the vector of cumulated probabilities */ + int *guide_table; /* pointer to guide table */ + int guide_size; /* length of guide table */ + double guide_factor; /* relative length of guide table. (DEFAULT = 1) */ + /* length of guide table = guide_factor * len */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/dsrou.c b/vendor/unuran-1.11.0/src/methods/dsrou.c new file mode 100644 index 0000000..520c83d --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dsrou.c @@ -0,0 +1,1013 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dsrou.c * + * * + * TYPE: discrete univariate random variate * + * METHOD: discrete simple universal method (ratio-of-uniforms method) * + * * + * DESCRIPTION: * + * Given PMF and mode of a T_{-1/2}-concave distribution * + * produce a value X consistent with its PMF * + * * + * REQUIRED: * + * pointer to the mass function * + * mode of distribution * + * sum over PMF * + * * + * OPTIONAL: * + * CDF at mode * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Leydold J. (2001): A simple universal generator for continuous and * + * discrete univariate T-concave distributions, * + * ACM Trans. Math. Software 27(1), pp. 66--82. * + * * + * [2] Kinderman, A.J. and Monahan, F.J. (1977): Computer generation of * + * random variables using the ratio of uniform deviates, * + * ACM Trans. Math. Software 3(3), pp. 257--260. * + * * + ***************************************************************************** + * * + * The ratio-of-uniforms method introduced in [2] is a flexible method that * + * is based on the following theorem: * + * * + * THEOREM: * + * Let X be a random variable with density function f(x) = g(x) / G, * + * where g(x) is a positive integrable function with support (x_0,x_1) * + * not necessarily finite and G = integral g(x) dx. * + * If (V,U) is uniformly distributed in * + * A = {(v,u): 0 < u <= sqrt(g(v/u)), x_0 < v/u < x_1}, * + * then X = V/U has probability density function f(x). * + * * + * Generating point (V,U) uniformly distributed in A is done by rejection * + * from an enveloping region, usually from the minimal bounding rectangle. * + * * + * For discrete random variates the continuous PDF * + * PDF(x) = PMF(floor(x)) * + * is used. * + * * + * The implemented algorithm uses the fact, that for many distributions, * + * the polygon having the "spikes" of A as its verticeds is convex. * + * Then we can find the follow bounding rectangles: * + * (For simplicity we have assumed that the sum over the PMF is 1) * + * * + * Define * + * R = {(v,u): -1/u_l <= v <= 0, 0 <= u <= u_l} \cup * + * {(v,u): 0 <= v <= 1/u_r, 0 <= u <= u_r} * + * Q = {(v,u): v_l <= v <= 0, 0 <= u <= u_l} \cup * + * {(v,u): 0 <= v <= v_r, 0 <= u <= u_r} * + * where * + * u_l = sqrt(PMF(mode-1)), u_r = sqrt(PMF(mode)), * + * v_l = -F(mode-1)/u_l, v_r = (1-F(mode-1))/u_r * + * Then * + * A subset R subset Q * + * * + * Thus we can use R to generate whenever the CDF F(mode-1) at the mode * + * is known, and Q otherwise. * + * Notice, that the rection constant is 2 in the first case and 4 and the * + * latter. * + * * + * Distributions with a convex set A are characterized by the following * + * theorem that shows a connection to transformed density rejection TDR. * + * * + * THEOREM: * + * A is convex if and only if g is T-concave with transformation * + * T(x) = -1/sqrt(x), i.e., -1/sqrt(g(x)) is a concave function. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "dsrou.h" +#include "dsrou_struct.h" + +/*---------------------------------------------------------------------------*/ +/* Variants: */ + +#define DSROU_VARFLAG_VERIFY 0x002u /* run verify mode */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define DSROU_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define DSROU_SET_CDFMODE 0x001u /* CDF at mode is known */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "DSROU" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dsrou_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dsrou_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dsrou_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dsrou_check_par( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dsrou_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_dsrou_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dsrou_sample( struct unur_gen *gen ); +static int _unur_dsrou_sample_check( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dsrou_rectangle( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* compute universal bounding rectangle. */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ +static void _unur_dsrou_debug_init( const struct unur_gen *gen, int is_reinit ); + +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_dsrou_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.discr /* data for distribution object */ + +#define PAR ((struct unur_dsrou_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_dsrou_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.discr /* data for distribution in generator object */ + +#define BD_LEFT domain[0] /* left boundary of domain of distribution */ +#define BD_RIGHT domain[1] /* right boundary of domain of distribution */ + +#define SAMPLE gen->sample.discr /* pointer to sampling routine */ + +#define PMF(x) _unur_discr_PMF((x),(gen->distr)) /* call to PMF */ + +/*---------------------------------------------------------------------------*/ + +#define _unur_dsrou_getSAMPLE(gen) \ + ( ((gen)->variant & DSROU_VARFLAG_VERIFY) \ + ? _unur_dsrou_sample_check : _unur_dsrou_sample ) + +/*---------------------------------------------------------------------------*/ +/* constants */ + +#define SQRT2 (M_SQRT2) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_dsrou_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_DISCR) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_DISCR,NULL); + + if (DISTR_IN.pmf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PMF"); + return NULL; + } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_dsrou_par) ); + COOKIE_SET(par,CK_DSROU_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->Fmode = -1.; /* CDF at mode (unknown yet) */ + + par->method = UNUR_METH_DSROU; /* method and default variant */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_dsrou_init; + + return par; + +} /* end of unur_dsrou_new() */ + +/*****************************************************************************/ + +int +unur_dsrou_set_cdfatmode( struct unur_par *par, double Fmode ) + /*----------------------------------------------------------------------*/ + /* set value of cdf at mode */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* Fmode ... CDF at mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, DSROU ); + + /* check new parameter for generator */ + if (Fmode < 0. || Fmode > 1.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"CDF(mode)"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->Fmode = Fmode; + + /* changelog */ + par->set |= DSROU_SET_CDFMODE; + + return UNUR_SUCCESS; + +} /* end of unur_dsrou_set_cdfatmode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dsrou_set_verify( struct unur_par *par, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, DSROU ); + + /* we use a bit in variant */ + par->variant = (verify) ? (par->variant | DSROU_VARFLAG_VERIFY) : (par->variant & (~DSROU_VARFLAG_VERIFY)); + + /* o.k. */ + return UNUR_ERR_NULL; +} /* end of unur_dsrou_set_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dsrou_chg_verify( struct unur_gen *gen, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, DSROU, UNUR_ERR_GEN_INVALID ); + + /* we must not change this switch when sampling has been disabled by + using a pointer to the error producing routine */ + if (SAMPLE == _unur_sample_discr_error) + return UNUR_FAILURE; + + if (verify) + /* turn verify mode on */ + gen->variant |= DSROU_VARFLAG_VERIFY; + else + /* turn verify mode off */ + gen->variant &= ~DSROU_VARFLAG_VERIFY; + + SAMPLE = _unur_dsrou_getSAMPLE(gen); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_dsrou_chg_verify() */ + +/*****************************************************************************/ + +int +unur_dsrou_chg_cdfatmode( struct unur_gen *gen, double Fmode ) + /*----------------------------------------------------------------------*/ + /* change value of cdf at mode */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* Fmode ... CDF at mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, DSROU, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (Fmode < 0. || Fmode > 1.) { + _unur_warning(gen->genid,UNUR_ERR_PAR_SET,"CDF(mode)"); + return UNUR_ERR_PAR_SET; + } + + /* copy parameters */ + GEN->Fmode = Fmode; + + /* changelog */ + gen->set |= DSROU_SET_CDFMODE; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_dsrou_chg_cdfatmode() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_dsrou_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* params ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_DSROU ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_DSROU_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_dsrou_create(par); + + /* free parameters */ + _unur_par_free(par); + + if (!gen) return NULL; + + /* check parameters */ + if (_unur_dsrou_check_par(gen) != UNUR_SUCCESS) { + _unur_dsrou_free(gen); return NULL; + } + + /* compute universal bounding rectangle */ + if ( _unur_dsrou_rectangle(gen)!=UNUR_SUCCESS ) { + _unur_dsrou_free(gen); return NULL; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_dsrou_debug_init(gen, FALSE); +#endif + + return gen; + +} /* end of _unur_dsrou_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_dsrou_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int result; + + /* check parameters */ + if ( (result = _unur_dsrou_check_par(gen)) != UNUR_SUCCESS) + return result; + + /* compute universal bounding rectangle */ + if ( (result = _unur_dsrou_rectangle(gen)) != UNUR_SUCCESS) + return result; + + /* (re)set sampling routine */ + SAMPLE = _unur_dsrou_getSAMPLE(gen); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & DSROU_DEBUG_REINIT) _unur_dsrou_debug_init(gen,TRUE); +#endif + + return UNUR_SUCCESS; +} /* end of _unur_dsrou_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_dsrou_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_DSROU_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_dsrou_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_DSROU_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_dsrou_getSAMPLE(gen); + gen->destroy = _unur_dsrou_free; + gen->clone = _unur_dsrou_clone; + gen->reinit = _unur_dsrou_reinit; + + /* copy some parameters into generator object */ + GEN->Fmode = PAR->Fmode; /* CDF at mode */ + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_dsrou_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_dsrou_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_dsrou_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check for required data: mode */ + if (!(gen->distr->set & UNUR_DISTR_SET_MODE)) { + _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode: try finding it (numerically)"); + if (unur_distr_discr_upd_mode(gen->distr)!=UNUR_SUCCESS) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode"); + return UNUR_ERR_DISTR_REQUIRED; + } + } + + /* check for required data: sum over PMF */ + if (!(gen->distr->set & UNUR_DISTR_SET_PMFSUM)) + if (unur_distr_discr_upd_pmfsum(gen->distr)!=UNUR_SUCCESS) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"sum over PMF"); + return UNUR_ERR_DISTR_REQUIRED; + } + + /* mode must be in domain */ + if ( (DISTR.mode < DISTR.BD_LEFT) || + (DISTR.mode > DISTR.BD_RIGHT) ) { + /* there is something wrong. + assume: user has change domain without changing mode. + but then, she probably has not updated area and is to large */ + _unur_warning(GENTYPE,UNUR_ERR_GEN_DATA,"area and/or CDF at mode"); + DISTR.mode = _unur_max(DISTR.mode,DISTR.BD_LEFT); + DISTR.mode = _unur_min(DISTR.mode,DISTR.BD_RIGHT); + } + + return UNUR_SUCCESS; +} /* end of _unur_dsrou_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_dsrou_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_dsrou_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_DSROU_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + return clone; + +#undef CLONE +} /* end of _unur_dsrou_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_dsrou_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_DSROU ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_DSROU_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_dsrou_free() */ + +/*****************************************************************************/ + +int +_unur_dsrou_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* int (sample from random variate) */ + /* */ + /* error: */ + /* return INT_MAX */ + /*----------------------------------------------------------------------*/ +{ + double U,V,X; + int I; + + /* check arguments */ + CHECK_NULL(gen,INT_MAX); COOKIE_CHECK(gen,CK_DSROU_GEN,INT_MAX); + + while (1) { + /* generate point uniformly in union of rectangles */ + V = GEN->al + _unur_call_urng(gen->urng) * (GEN->ar - GEN->al); + V /= (V<0.) ? GEN->ul : GEN->ur; /* if ul==0. then al==0. and thus V>=0. */ + + while ( _unur_iszero(U = _unur_call_urng(gen->urng))); + U *= (V<0.) ? GEN->ul : GEN->ur; + + /* ratio */ + X = floor(V/U) + DISTR.mode; + + /* inside domain ? */ + if ( (X < DISTR.BD_LEFT) || (X > DISTR.BD_RIGHT) ) + continue; + + /* convert to int */ + I = (int) X; + + /* accept or reject */ + if (U*U <= PMF(I)) + return I; + } +} /* end of _unur_dsrou_sample() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_dsrou_sample_check( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator and verify that method can be used */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* int (sample from random variate) */ + /* */ + /* error: */ + /* return INT_MAX */ + /*----------------------------------------------------------------------*/ +{ + double U,V,pI,VI,X; + double um2, vl, vr; + int I; + + /* check arguments */ + CHECK_NULL(gen,INT_MAX); COOKIE_CHECK(gen,CK_DSROU_GEN,INT_MAX); + + while (1) { + /* generate point uniformly in union of rectangles */ + V = GEN->al + _unur_call_urng(gen->urng) * (GEN->ar - GEN->al); + V /= (V<0.) ? GEN->ul : GEN->ur; + + while ( _unur_iszero(U = _unur_call_urng(gen->urng))); + U *= (V<0.) ? GEN->ul : GEN->ur; + + /* ratios */ + X = floor(V/U) + DISTR.mode; + + /* inside domain ? */ + if ( (X < DISTR.BD_LEFT) || (X > DISTR.BD_RIGHT) ) + continue; + + /* convert to int */ + I = (int) X; + + /* values of PMF and v-coordinate of point */ + pI = PMF(I); + VI = V/U * sqrt(pI); + + /* values of boundary of rectangle */ + /* (avoid roundoff error with FP registers) */ + um2 = (2.+4.*DBL_EPSILON) * ((V<0) ? GEN->ul*GEN->ul : GEN->ur*GEN->ur); + vl = (GEN->ul>0.) ? (1.+UNUR_EPSILON) * GEN->al/GEN->ul : 0.; + vr = (1.+UNUR_EPSILON) * GEN->ar/GEN->ur; + + /* check hat */ + if ( pI > um2 || VI < vl || VI > vr ) { + /* printf("pI = %g < %g VI = %g < %g < %g\n", */ + /* pI, ur2, vl, VI, vr); */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PMF(x) > hat(x)"); + } + + /* accept or reject */ + if (U*U <= pI) + return I; + } +} /* end of _unur_dsrou_sample_check() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_dsrou_rectangle( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* compute universal bounding rectangle */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double pm, pbm; /* PMF at mode and mode-1 */ + + /* check arguments */ + CHECK_NULL( gen, UNUR_ERR_NULL ); + COOKIE_CHECK( gen,CK_DSROU_GEN, UNUR_ERR_COOKIE ); + + /* compute PMF at mode and mode-1 */ + pm = PMF(DISTR.mode); + pbm = (DISTR.mode-1 < DISTR.BD_LEFT) ? 0. : PMF(DISTR.mode-1); + + /* pm and pbm must be positive */ + if (pm <= 0. || pbm < 0.) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PMF(mode) <= 0."); + return UNUR_ERR_GEN_DATA; + } + + /* heights of rectangles */ + GEN->ul = sqrt(pbm); + GEN->ur = sqrt(pm); + + /* areas of rectangle */ + if (_unur_iszero(GEN->ul)) { + /* PMF monotonically decreasing */ + GEN->al = 0.; + GEN->ar = DISTR.sum; + } + else if (gen->set & DSROU_SET_CDFMODE) { + /* CDF at mode known */ + GEN->al = -(GEN->Fmode * DISTR.sum)+pm; + GEN->ar = DISTR.sum + GEN->al; + } + else { + GEN->al = -(DISTR.sum - pm); + GEN->ar = DISTR.sum; + } + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_dsrou_rectangle() */ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +static void +_unur_dsrou_debug_init( const struct unur_gen *gen, int is_reinit ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* is_reinit ... if TRUE the generator has been reinitialized */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DSROU_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + if (!is_reinit) { + fprintf(LOG,"%s: type = discrete univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = dsrou (discrete simple universal ratio-of-uniforms)\n",gen->genid); + } + else + fprintf(LOG,"%s: reinit!\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_discr_debug( gen->distr, gen->genid, FALSE ); + + fprintf(LOG,"%s: sampling routine = _unur_dsrou_sample",gen->genid); + if (gen->variant & DSROU_VARFLAG_VERIFY) + fprintf(LOG,"_check"); + fprintf(LOG,"()\n%s:\n",gen->genid); + + if (gen->set & DSROU_SET_CDFMODE) + fprintf(LOG,"%s: CDF(mode) = %g\n",gen->genid,GEN->Fmode); + else + fprintf(LOG,"%s: CDF(mode) unknown\n",gen->genid); + + fprintf(LOG,"%s: no (universal) squeeze\n",gen->genid); + fprintf(LOG,"%s: no mirror principle\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: Rectangles:\n",gen->genid); + if (GEN->ul > 0.) + fprintf(LOG,"%s: left upper point = (%g,%g) \tarea = %g (%5.2f%%)\n", + gen->genid,GEN->al/GEN->ul,GEN->ul,fabs(GEN->al),100.*fabs(GEN->al)/(-GEN->al+GEN->ar)); + else + fprintf(LOG,"%s: left upper point = (0,0) \tarea = 0 (0.00%%)\n",gen->genid); + + fprintf(LOG,"%s: right upper point = (%g,%g) \tarea = %g (%5.2f%%)\n", + gen->genid,GEN->ar/GEN->ur,GEN->ur,GEN->ar,100.*GEN->ar/(-GEN->al+GEN->ar)); + + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_dsrou_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_dsrou_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = PMF\n"); + _unur_string_append(info," domain = (%d, %d)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info," mode = %d %s\n", DISTR.mode, + (distr->set & UNUR_DISTR_SET_MODE_APPROX) ? "[numeric.]" : ""); + _unur_string_append(info," sum(PMF) = %g\n", DISTR.sum); + if (gen->set & DSROU_SET_CDFMODE) + _unur_string_append(info," F(mode) = %g\n", GEN->Fmode); + else + _unur_string_append(info," F(mode) = [unknown]\n"); + _unur_string_append(info,"\n"); + + if (help) { + if ( distr->set & UNUR_DISTR_SET_MODE_APPROX ) + _unur_string_append(info,"[ Hint: %s ]\n", + "You may provide the \"mode\""); + _unur_string_append(info,"\n"); + } + + /* method */ + _unur_string_append(info,"method: DSROU (Discrete Simple Ratio-Of-Uniforms)\n"); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + + _unur_string_append(info," enveloping rectangle = (%g,%g) x (%g,%g) [left]\n", + (GEN->ul > 0.)?GEN->al/GEN->ul:0., 0., + 0., (GEN->ul > 0.)?GEN->ul:0.); + _unur_string_append(info," (%g,%g) x (%g,%g) [right]\n", + 0.,GEN->ar/GEN->ur, 0., GEN->ur); + + _unur_string_append(info," area(hat) = %g + %g = %g\n", + fabs(GEN->al), GEN->ar, -GEN->al+GEN->ar); + + _unur_string_append(info," rejection constant = %g\n", + 2. * (-GEN->al+GEN->ar) / DISTR.sum); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + if (gen->set & DSROU_SET_CDFMODE) + _unur_string_append(info," cdfatmode = %g\n", GEN->Fmode); + else + _unur_string_append(info," cdfatmode = [not set]\n"); + + if (gen->variant & DSROU_VARFLAG_VERIFY) + _unur_string_append(info," verify = on\n"); + + _unur_string_append(info,"\n"); + } + + /* Hints */ + if (help) { + if ( !(gen->set & DSROU_SET_CDFMODE)) + _unur_string_append(info,"[ Hint: %s ]\n", + "You can set \"cdfatmode\" to reduce the rejection constant."); + _unur_string_append(info,"\n"); + } + +} /* end of _unur_dsrou_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/dsrou.h b/vendor/unuran-1.11.0/src/methods/dsrou.h new file mode 100644 index 0000000..665caee --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dsrou.h @@ -0,0 +1,140 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dsrou.h * + * * + * PURPOSE: * + * function prototypes for method DSROU * + * (Discrete, Simple universal generator, Ratio-Of-Uniforms method) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD DSROU Discrete Simple Ratio-Of-Uniforms method + + =UP Methods_for_DISCR + + =REQUIRED T-concave PMF, mode, sum over PMF + + =SPEED Set-up: fast, Sampling: slow + + =REINIT supported + + =REF [LJa01] [HLD04: Sect.10.3.2, Alg.10.6] + + =DESCRIPTION + DSROU is based on the ratio-of-uniforms method + (@pxref{Ratio-of-Uniforms}) but uses universal + inequalities for constructing a (universal) bounding rectangle. + It works for all @i{T}-concave distributions with + @unurmath{T(x) = -1/\sqrt{x}}. + + The method requires the PMF, the (exact) location of the mode + and the sum over the given PDF. The rejection constant is 4 for + all @i{T}-concave distributions. Optionally the CDF at the mode + can be given to increase the performance of the algorithm. Then + the rejection constant is reduced to 2. + + =HOWTOUSE + The method works for @i{T}-concave discrete distributions with + given PMF. The sum over of the PMF or an upper bound of this sum + must be known. + + Optionally the CDF at the mode can be given to increase the + performance using unur_dsrou_set_cdfatmode(). + However, this @strong{must not} be called if the sum over the + PMF is replaced by an upper bound. + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + + If any of mode, CDF at mode, or the sum over the PMF has been + changed, then unur_reinit() must be executed. + (Otherwise the generator produces garbage). + + There exists a test mode that verifies whether the conditions + for the method are satisfied or not while sampling. It can be + switched on or off by calling unur_dsrou_set_verify() and + unur_dsrou_chg_verify(), respectively. + Notice however that sampling is (a little bit) slower then. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_dsrou_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_dsrou_set_cdfatmode( UNUR_PAR *parameters, double Fmode ); +/* + Set CDF at mode. + When set, the performance of the algorithm is increased by factor 2. + However, when the parameters of the distribution are changed + unur_dsrou_chg_cdfatmode() has to be used to update this value. + Notice that the algorithm detects a mode at the left boundary of + the domain automatically and it is not necessary to use this call + for a monotonically decreasing PMF. + + Default: not set. +*/ + +int unur_dsrou_set_verify( UNUR_PAR *parameters, int verify ); +/* */ + +int unur_dsrou_chg_verify( UNUR_GEN *generator, int verify ); +/* + Turn verifying of algorithm while sampling on/off. + If the condition squeeze(@i{x}) <= PMF(@i{x}) <= hat(@i{x}) is + violated for some @i{x} then @code{unur_errno} is set to + @code{UNUR_ERR_GEN_CONDITION}. However notice that this might + happen due to round-off errors for a few values of + @i{x} (less than 1%). + + Default is FALSE. +*/ + +/*...........................................................................*/ + +int unur_dsrou_chg_cdfatmode( UNUR_GEN *generator, double Fmode ); +/* + Change CDF at mode of distribution. + unur_reinit() must be executed before sampling from the + generator again. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/dsrou_struct.h b/vendor/unuran-1.11.0/src/methods/dsrou_struct.h new file mode 100644 index 0000000..b69b60e --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dsrou_struct.h @@ -0,0 +1,51 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dsrou_struct.h * + * * + * PURPOSE: * + * declares structures for method DSROU * + * (Discrete Simple universal generator, Ratio-Of-Uniforms method) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_dsrou_par { + double Fmode; /* cdf at mode */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_dsrou_gen { + double ul, ur; /* height of rectangles */ + double al, ar; /* area of rectangles */ + double Fmode; /* cdf at mode */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/dss.c b/vendor/unuran-1.11.0/src/methods/dss.c new file mode 100644 index 0000000..02d1fea --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dss.c @@ -0,0 +1,635 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dss.c * + * * + * TYPE: discrete univariate random variate * + * METHOD: sequential search * + * * + * DESCRIPTION: * + * Given PV or PMF together with sum over PV or PMF, * + * or the VDF, * + * * + * REQUIRED: pointer to probability vector, sum over PV * + * pointer to PMF, sum over PMF * + * pointer to CDF * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * SUMMARY: * + * [1] Devroye, L. (1986): Non-Uniform Random Variate Generation, New-York * + * * + ***************************************************************************** + * * + * This method a varient of the inversion method, i.e. * + * * + * (1) Generate a random number U ~ U(0,1). * + * (2) Find largest integer I such that F(I) = P(X<=I) <= U. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "dss.h" +#include "dss_struct.h" + +/*---------------------------------------------------------------------------*/ +/* Variants */ + +#define DSS_VARIANT_NONE 0x000u /* invalid data */ +#define DSS_VARIANT_PV 0x001u /* use PV */ +#define DSS_VARIANT_PMF 0x002u /* use PMF */ +#define DSS_VARIANT_CDF 0x004u /* use CDF */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define DSS_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ +#define DSS_DEBUG_PRINTVECTOR 0x00000100u + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "DSS" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dss_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dss_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dss_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dss_check_par( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dss_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_dss_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dss_sample( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_dss_debug_init( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_dss_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.discr /* data for distribution object */ + +#define PAR ((struct unur_dss_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_dss_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.discr /* data for distribution in generator object */ + +#define SAMPLE gen->sample.discr /* pointer to sampling routine */ + +#define PMF(x) _unur_discr_PMF((x),(gen->distr)) /* call to PMF */ +#define CDF(x) _unur_discr_CDF((x),(gen->distr)) /* call to CDF */ + +/*---------------------------------------------------------------------------*/ + +#define _unur_dss_getSAMPLE(gen) (_unur_dss_sample) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_dss_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + unsigned variant = DSS_VARIANT_NONE; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_DISCR) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_DISCR,NULL); + + if (DISTR_IN.pv && (distr->set & UNUR_DISTR_SET_PMFSUM)) + variant = DSS_VARIANT_PV; + else if (DISTR_IN.pmf && (distr->set & UNUR_DISTR_SET_PMFSUM)) + variant = DSS_VARIANT_PMF; + else if (DISTR_IN.cdf) + variant = DSS_VARIANT_CDF; + + if (variant == DSS_VARIANT_NONE) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PV+sum, PMF+sum, or CDF"); + return NULL; + } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_dss_par) ); + COOKIE_SET(par,CK_DSS_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + par->method = UNUR_METH_DSS; /* method */ + par->variant = variant; /* variant of method */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_dss_init; + + return par; + +} /* end of unur_dss_new() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_dss_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; /* pointer to generator object */ + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_DSS ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_DSS_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_dss_create(par); + _unur_par_free(par); + if (!gen) return NULL; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_dss_debug_init(gen); +#endif + + return gen; +} /* end of _unur_dss_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_dss_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int rcode; + + /* check parameters */ + if ( (rcode = _unur_dss_check_par(gen)) != UNUR_SUCCESS) + return rcode; + + /* (re)set sampling routine */ + SAMPLE = _unur_dss_getSAMPLE(gen); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & DSS_DEBUG_REINIT) _unur_dss_debug_init(gen); +#endif + + return UNUR_SUCCESS; +} /* end of _unur_dss_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_dss_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; /* pointer to generator object */ + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_DSS_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_dss_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_DSS_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_dss_getSAMPLE(gen); + gen->destroy = _unur_dss_free; + gen->clone = _unur_dss_clone; + gen->reinit = _unur_dss_reinit; + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_dss_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_dss_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_dss_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + switch(gen->variant) { + case DSS_VARIANT_PV: + if (DISTR.pv != NULL) break; + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PV"); + return UNUR_ERR_DISTR_REQUIRED; + + case DSS_VARIANT_PMF: + if (DISTR.pmf != NULL) break; + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PMF"); + return UNUR_ERR_DISTR_REQUIRED; + + case DSS_VARIANT_CDF: + if (DISTR.cdf != NULL) return UNUR_SUCCESS; + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"CDF"); + return UNUR_ERR_DISTR_REQUIRED; + + default: + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + } + + /* additionally check for required data: sum over PMF */ + if (!(gen->distr->set & UNUR_DISTR_SET_PMFSUM)) + if (unur_distr_discr_upd_pmfsum(gen->distr)!=UNUR_SUCCESS) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"sum over PMF"); + return UNUR_ERR_DISTR_REQUIRED; + } + + return UNUR_SUCCESS; +} /* end of _unur_dss_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_dss_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_dss_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_DSS_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + return clone; + +#undef CLONE +} /* end of _unur_dss_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_dss_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + + /* check arguments */ + if (!gen) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_DSS ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_DSS_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_dss_free() */ + +/*****************************************************************************/ + +int +_unur_dss_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* integer (sample from random variate) */ + /* */ + /* error: */ + /* return INT_MAX */ + /*----------------------------------------------------------------------*/ +{ + int J; + double U; + double sum; + + /* check arguments */ + CHECK_NULL(gen,INT_MAX); COOKIE_CHECK(gen,CK_DSS_GEN,INT_MAX); + + switch(gen->variant) { + case DSS_VARIANT_PV: + U = DISTR.sum * _unur_call_urng(gen->urng); + sum = 0.; + for (J=0; J= U) break; + } + return (J + DISTR.domain[0]); + + case DSS_VARIANT_PMF: + U = DISTR.sum * _unur_call_urng(gen->urng); + sum = 0.; + for (J=DISTR.domain[0]; J<=DISTR.domain[1]; J++) { + sum += PMF(J); + if (sum >= U) break; + } + return J; + + case DSS_VARIANT_CDF: + U = _unur_call_urng(gen->urng); + for (J=DISTR.domain[0]; J<=DISTR.domain[1]; J++) { + if (CDF(J) >= U) break; + } + return J; + + default: + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return INT_MAX; + } + +} /* end of _unur_dss_sample() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_dss_debug_init( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DSS_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = discrete univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = sequential search\n",gen->genid); + + _unur_distr_discr_debug( gen->distr,gen->genid,(gen->debug & DSS_DEBUG_PRINTVECTOR)); + + fprintf(LOG,"%s: sampling routine = _unur_dss_sample()\n",gen->genid); + fprintf(LOG,"%s: variant = ",gen->genid); + switch(gen->variant) { + case DSS_VARIANT_PV: + fprintf(LOG,"use PV\n"); break; + case DSS_VARIANT_PMF: + fprintf(LOG,"use PMF\n"); break; + case DSS_VARIANT_CDF: + fprintf(LOG,"use CDF\n"); break; + default: + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + } + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_dss_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_dss_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + switch(gen->variant) { + case DSS_VARIANT_PV: + _unur_string_append(info," functions = PV [length=%d]\n",DISTR.domain[1]-DISTR.domain[0]+1); + break; + case DSS_VARIANT_PMF: + _unur_string_append(info," functions = PMF\n"); + break; + case DSS_VARIANT_CDF: + _unur_string_append(info," functions = CDF\n"); + break; + } + _unur_string_append(info," domain = (%d, %d)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info,"\n"); + + /* method */ + _unur_string_append(info,"method: DSS (Simple Sequential Search)\n"); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics: slow\n"); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters: none\n"); + _unur_string_append(info,"\n"); + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_dss_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/dss.h b/vendor/unuran-1.11.0/src/methods/dss.h new file mode 100644 index 0000000..a5ade6e --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dss.h @@ -0,0 +1,99 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dss.h * + * * + * PURPOSE: * + * function prototypes for method DSS * + * ((Discrete) Sequential Search (guide table)) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD DSS (Discrete) Sequential Search method + + =UP Methods_for_DISCR + + =REQUIRED probability vector (PV) and sum over PV; or + probability mass function(PMF), sum over PV and domain; or + or cumulative distribution function (CDF) + + =SPEED Set-up: fast, Sampling: very slow (linear in expectation) + + =REINIT supported + + =REF [HLD04: Sect.3.1.1, Alg.3.1] + + =DESCRIPTION + DSS samples from arbitrary discrete distributions. + Random numbers are generated by the inversion method, i.e., + + @enumerate + @item + Generate a random number U ~ U(0,1). + @item + Find smallest integer I such that F(I) = P(X<=I) >= U. + @end enumerate + + Step (2) is the crucial step. Using sequential search requires + @i{O(E(X))} comparisons, where @i{E(X)} is the expectation of + the distribution. Thus this method is only recommended when only + a few random variates from the given distribution are required. + Otherwise, table methods like DGT (@pxref{DGT}) or DAU (@pxref{DAU}) + are much faster. These methods also need not the sum over the + PMF (or PV) as input. On the other hand, however, these methods + always compute a table. + + DSS runs with the PV, the PMF, or the CDF of the distribution. + It uses actually uses the first one in this list (in this + ordering) that could be found. + + =HOWTOUSE + It works with a discrete distribution object with contains at + least the PV, the PMF, or the CDF. + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_dss_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/dss_struct.h b/vendor/unuran-1.11.0/src/methods/dss_struct.h new file mode 100644 index 0000000..265e84a --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dss_struct.h @@ -0,0 +1,49 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dss_struct.h * + * * + * PURPOSE: * + * declares structures for method DSS * + * (Discrete Sequential Search) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_dss_par { + int dummy; +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_dss_gen { + int dummy; +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/dstd.c b/vendor/unuran-1.11.0/src/methods/dstd.c new file mode 100644 index 0000000..c41307f --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dstd.c @@ -0,0 +1,1053 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dstd.c * + * * + * TYPE: discrete univariate random variate * + * METHOD: generators for standard distribution * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * DSTD is a wrapper for special generator for Discrete univariate * + * STandarD distributions. It only works for distributions in the UNURAN * + * library of distributions or those discrete distributions that have * + * the inverse CDF implemented. Otherwise it refuses to work. * + * * + * It calls the initialization routine provided by the distribution object. * + * This routine has to do all setup steps for the special generator. * + * If no such routine is given (i.e. distr->init==NULL) or when it does not * + * implement the inversion method then the inverse CDF stored in the * + * distribution object (if available) is used. * + * If neither is available, then unur_dstd_new() does not work and the * + * NULL pointer is returned instead of the pointer to a parameter object. * + * * + * Notice that using a truncated distribution (this can be constructed by * + * changing the default domain of a distribution by means of an * + * unur_distr_discr_set_domain() call) is only allowed if the inversion * + * method is used. Otherwise no parameter object is returned by the * + * unur_dstd_new() call. * + * * + * Variants (different algorithms for the same distribution) are possible * + * and can be selected by unsigned integers using the * + * unur_dstd_set_variant() call. * + * For possible variants see the generator files for each distribution in * + * the distributions directory. However the following are common to all * + * distributions: * + * * + * UNUR_STDGEN_DEFAULT ... the default generator * + * UNUR_STDGEN_INVERSION ... the inversion method (if available) * + * UNUR_STDGEN_FAST ... the fasted available special generator * + * * + * unur_dstd_set_variant() return 0 if a variant is not implemented, and 1 * + * otherwise. In the first case the selected variant is not changed. * + * * + * The domain of a (truncated) distribution can be changed without building * + * a new generator object by means of the unur_dstd_chg_truncated() call. * + * Notice that this only works when the inversion method is used. Otherwise * + * nothing happens to the domain and an error message is produced. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "cstd.h" /* required for UNUR_STDGEN_* macros */ +#include "dstd.h" +#include "dstd_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Variants: none */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define DSTD_DEBUG_GEN 0x00000005u /* print constants for generator */ +#define DSTD_DEBUG_REINIT 0x00000010u /* print params of distr after reinit */ +#define DSTD_DEBUG_CHG 0x00001000u /* print changed params of distr */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define DSTD_SET_VARIANT 0x01u + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "DSTD" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dstd_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dstd_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dstd_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dstd_check_par( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_dstd_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_dstd_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* There are no sampling routines, since every distribution has its own. */ +/* Sampling routines are defined in ../distributions/ for each distributions.*/ +/* double _unur_dstd_sample( UNUR_GEN *gen ); does not exist! */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dstd_sample_inv( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Generic inversion method. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_dstd_inversion_init( struct unur_par *par, struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Initialize special generator for inversion method. */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_dstd_debug_init( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_dstd_debug_chg_pmfparams( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print new (changed) parameters of distribution */ +/*---------------------------------------------------------------------------*/ + +static void _unur_dstd_debug_chg_truncated( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print new (changed) domain of (truncated) distribution */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_dstd_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.discr /* data for distribution object */ + +#define PAR ((struct unur_dstd_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_dstd_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.discr /* data for distribution in generator object */ + +#define SAMPLE gen->sample.discr /* pointer to sampling routine */ + +#define CDF(x) _unur_discr_CDF((x),(gen->distr)) /* call to CDF */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_dstd_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL(GENTYPE,distr,NULL); + + /* check distribution */ + if (distr->type != UNUR_DISTR_DISCR) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_DISCR,NULL); + + if (DISTR_IN.init == NULL && DISTR_IN.invcdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"init() for special generators or inverse CDF"); + return NULL; + } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_dstd_par) ); + COOKIE_SET(par,CK_DSTD_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + par->method = UNUR_METH_DSTD; /* method */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* indicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for initializing generator */ + par->init = _unur_dstd_init; + + return par; + +} /* end of unur_dstd_new() */ + +/*****************************************************************************/ + +int +unur_dstd_set_variant( struct unur_par *par, unsigned variant ) + /*----------------------------------------------------------------------*/ + /* set variant of method */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* variant ... indicator for variant */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + unsigned old_variant; + + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_NULL( GENTYPE, par->distr, UNUR_ERR_NULL ); + _unur_check_par_object( par, DSTD ); + + /* store date */ + old_variant = par->variant; + par->variant = variant; + + /* check variant. run special init routine only in test mode */ + if ( (par->DISTR_IN.init == NULL || par->DISTR_IN.init(par,NULL)!=UNUR_SUCCESS) && + _unur_dstd_inversion_init(par,NULL)!=UNUR_SUCCESS ) { + /* variant not valid */ + _unur_warning(GENTYPE,UNUR_ERR_PAR_VARIANT,""); + par->variant = old_variant; + return UNUR_ERR_PAR_VARIANT; + } + + /* changelog */ + par->set |= DSTD_SET_VARIANT; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_dstd_set_variant() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dstd_chg_truncated( struct unur_gen *gen, int left, int right ) + /*----------------------------------------------------------------------*/ + /* change the left and right borders of the domain of the */ + /* (truncated) distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* the new boundary points may be +/- UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double Umin, Umax; + + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, DSTD, UNUR_ERR_GEN_INVALID ); + + /* domain can only be changed for inversion method! */ + if ( ! GEN->is_inversion ) { + /* this is not the inversion method */ + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"truncated domain for non-inversion method"); + return UNUR_ERR_GEN_DATA; + } + + /* CDF required ! */ + if (DISTR.cdf == NULL) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"truncated domain, CDF required"); + return UNUR_ERR_GEN_DATA; + } + + /* check new parameter for generator */ + /* (the truncated domain must be a subset of the domain) */ + if (left < DISTR.domain[0]) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain too large"); + left = DISTR.domain[0]; + } + if (right > DISTR.domain[1]) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain too large"); + right = DISTR.domain[1]; + } + + if (left >= right) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"domain, left >= right"); + return UNUR_ERR_DISTR_SET; + } + + /* compute umin and umax */ + Umin = (left <= INT_MIN) ? 0. : CDF(left-1); + Umax = CDF(right); + + /* check result */ + if (Umin > Umax) { + /* this is a serios error that should not happen */ + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + } + + if (_unur_FP_equal(Umin,Umax)) { + /* CDF values very close */ + _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values very close"); + if (_unur_iszero(Umin) || _unur_FP_same(Umax,1.)) { + /* this is very bad */ + _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values at boundary points too close"); + return UNUR_ERR_DISTR_SET; + } + } + + + /* copy new boundaries into generator object */ + DISTR.trunc[0] = left; + DISTR.trunc[1] = right; + GEN->Umin = Umin; + GEN->Umax = Umax; + + /* changelog */ + gen->distr->set |= UNUR_DISTR_SET_TRUNCATED; + + /* indicate that we have a truncated distribution. + (do not have the standard domain any more) */ + gen->distr->set &= ~UNUR_DISTR_SET_STDDOMAIN; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & DSTD_DEBUG_CHG) + _unur_dstd_debug_chg_truncated( gen ); +#endif + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_dstd_chg_truncated() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_dstd_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_DSTD ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; + } + COOKIE_CHECK(par,CK_DSTD_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_dstd_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* run special init routine for generator */ + GEN->is_inversion = FALSE; /* reset flag for inversion method */ + if ( (DISTR.init == NULL || DISTR.init(NULL,gen)!=UNUR_SUCCESS) && + _unur_dstd_inversion_init(NULL,gen)!=UNUR_SUCCESS ) { + /* init failed --> could not find a sampling routine */ + _unur_error(GENTYPE,UNUR_ERR_GEN_DATA,"variant for special generator"); + _unur_dstd_free(gen); return NULL; + } + + /* check parameters */ + if (_unur_dstd_check_par(gen) != UNUR_SUCCESS) { + _unur_dstd_free(gen); return NULL; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_dstd_debug_init(gen); +#endif + + /* o.k. */ + return gen; + +} /* end of _unur_dstd_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_dstd_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int rcode; + + /* run special init routine for generator */ + GEN->is_inversion = FALSE; /* reset flag for inversion method */ + if ( (DISTR.init == NULL || DISTR.init(NULL,gen)!=UNUR_SUCCESS) && + _unur_dstd_inversion_init(NULL,gen)!=UNUR_SUCCESS ) { + /* init failed --> could not find a sampling routine */ + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"parameters"); + return UNUR_ERR_GEN_DATA; + } + + /* check parameters */ + if ( (rcode = _unur_dstd_check_par(gen)) != UNUR_SUCCESS) + return rcode; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & DSTD_DEBUG_REINIT) + _unur_dstd_debug_chg_pmfparams( gen ); +#endif + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_dstd_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_dstd_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_DSTD_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_dstd_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_DSTD_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = NULL; /* will be set in _unur_dstd_init() */ + gen->destroy = _unur_dstd_free; + gen->clone = _unur_dstd_clone; + gen->reinit = _unur_dstd_reinit; + + /* defaults */ + GEN->gen_param = NULL; /* parameters for the generator */ + GEN->n_gen_param = 0; /* (computed in special GEN->init() */ + GEN->gen_iparam = NULL; /* array for integer parameters */ + GEN->n_gen_iparam = 0; + GEN->is_inversion = FALSE; /* method not based on inversion */ + GEN->sample_routine_name = NULL ; /* name of sampling routine */ + + /* copy some parameters into generator object */ + GEN->Umin = 0.; /* cdf at left boundary of domain */ + GEN->Umax = 1.; /* cdf at right boundary of domain */ + + /* GEN->is_inversion is set in _unur_dstd_inversion_init() */ + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_dstd_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_dstd_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_dstd_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* domain valid for special generator ?? */ + if (!(gen->distr->set & UNUR_DISTR_SET_STDDOMAIN)) { + /* domain has been modified */ + gen->distr->set &= UNUR_DISTR_SET_TRUNCATED; + DISTR.trunc[0] = DISTR.domain[0]; + DISTR.trunc[1] = DISTR.domain[1]; + + if ( ! GEN->is_inversion ) { + /* this is not the inversion method */ + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"domain changed for non inversion method"); + return UNUR_ERR_GEN_DATA; + } + + if (DISTR.cdf == NULL) { + /* using a truncated distribution requires a CDF */ + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"domain changed, CDF required"); + return UNUR_ERR_GEN_DATA; + } + + /* compute Umin and Umax */ + GEN->Umin = (DISTR.trunc[0] <= INT_MIN) ? 0. : CDF(DISTR.trunc[0]-1); + GEN->Umax = CDF(DISTR.trunc[1]); + } + + return UNUR_SUCCESS; +} /* end of _unur_dstd_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_dstd_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_dstd_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_DSTD_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* copy parameters for special generators */ + if (GEN->gen_param) { + CLONE->gen_param = _unur_xmalloc( GEN->n_gen_param * sizeof(double) ); + memcpy( CLONE->gen_param, GEN->gen_param, GEN->n_gen_param * sizeof(double) ); + } + if (GEN->gen_iparam) { + CLONE->gen_iparam = _unur_xmalloc( GEN->n_gen_iparam * sizeof(int) ); + memcpy( CLONE->gen_iparam, GEN->gen_iparam, GEN->n_gen_iparam * sizeof(int) ); + } + + return clone; + +#undef CLONE +} /* end of _unur_dstd_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_dstd_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* magic cookies */ + COOKIE_CHECK(gen,CK_DSTD_GEN,RETURN_VOID); + + /* check input */ + if ( gen->method != UNUR_METH_DSTD ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; + } + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + if (GEN->gen_param) free(GEN->gen_param); + if (GEN->gen_iparam) free(GEN->gen_iparam); + + _unur_generic_free(gen); +} /* end of _unur_dstd_free() */ + +/*****************************************************************************/ + +/** + double _unur_dstd_sample( struct unur_gen *gen ) {} + Does not exists !!! + Sampling routines are defined in ../distributions/ for each distributions. +**/ + +/*****************************************************************************/ + +int +_unur_dstd_sample_inv( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* generic inversion method. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return INT_MAX */ + /*----------------------------------------------------------------------*/ +{ + double U; + + if (!DISTR.invcdf) return INT_MAX; + + /* sample from uniform random number generator */ + while (_unur_iszero(U = GEN->Umin + _unur_call_urng(gen->urng) * (GEN->Umax-GEN->Umin))); + + /* compute inverse CDF */ + return ((int) DISTR.invcdf(U,gen->distr)); + +} /* _unur_dstd_sample_inv() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_dstd_eval_invcdf( const struct unur_gen *gen, double u ) + /*----------------------------------------------------------------------*/ + /* evaluate inverse CDF at u. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* u ... argument for inverse CDF (0<=u<=1, no validation!) */ + /* */ + /* return: */ + /* int (inverse CDF) */ + /* */ + /* error: */ + /* return INT_MAX */ + /*----------------------------------------------------------------------*/ +{ + int k; + + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, INT_MAX ); + if ( gen->method != UNUR_METH_DSTD ) { + _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); + return INT_MAX; + } + COOKIE_CHECK(gen,CK_DSTD_GEN,INT_MAX); + + if (!DISTR.invcdf) { + /* no inverse CDF available */ + _unur_error(gen->genid,UNUR_ERR_NO_QUANTILE,"inversion CDF required"); + return INT_MAX; + } + + if ( ! (u>0. && u<1.)) { + if ( ! (u>=0. && u<=1.)) { + _unur_warning(gen->genid,UNUR_ERR_DOMAIN,"U not in [0,1]"); + } + if (u<=0.) return DISTR.trunc[0]; + if (u>=1.) return DISTR.trunc[1]; + return INT_MAX; /* u == NaN */ + } + + /* rescale given u */ + u = GEN->Umin + u * (GEN->Umax - GEN->Umin); + + /* compute inverse CDF */ + k = DISTR.invcdf(u,gen->distr); + + /* validate range */ + if (kDISTR.trunc[1]) k = DISTR.trunc[1]; + + return k; + +} /* end of unur_dstd_eval_invcdf() */ + + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_dstd_inversion_init( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize special generator for inversion method */ + /* when inverse CDF is available for the distribution. */ + /* if gen == NULL then only check existance of variant. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* one of par and gen must not be the NULL pointer */ + switch ((par) ? par->variant : gen->variant) { + + case 0: /* DEFAULT */ + case UNUR_STDGEN_INVERSION: /* inversion method */ + if (gen) { + if (DISTR.invcdf) { + GEN->is_inversion = TRUE; + _unur_dstd_set_sampling_routine(gen,_unur_dstd_sample_inv); + return UNUR_SUCCESS; + } + } + else { + if ((par->distr->data.discr).invcdf) { + return UNUR_SUCCESS; + } + } + + /* FALLTHROUGH */ + default: /* no such generator */ + if (gen) _unur_warning(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_FAILURE; + } + +} /* end of _unur_dstd_inversion_init() */ + +/*---------------------------------------------------------------------------*/ + + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_dstd_debug_init( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int i; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DSTD_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = discrete univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = generator for standard distribution\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + /* distribution */ + _unur_distr_discr_debug( gen->distr, gen->genid, FALSE ); + + /* sampling routine */ + fprintf(LOG,"%s: sampling routine = ",gen->genid); + if (GEN->sample_routine_name) + fprintf(LOG,"%s()",GEN->sample_routine_name); + else + fprintf(LOG,"(Unknown)"); + if (GEN->is_inversion) + fprintf(LOG," (Inversion)"); + fprintf(LOG,"\n%s:\n",gen->genid); + + /* table of precomputed constants for special generators */ + if (gen->debug & DSTD_DEBUG_GEN) { + fprintf(LOG,"%s: precomputed double constants for routine: ",gen->genid); + if (GEN->gen_param) { + fprintf(LOG,"%d\n",GEN->n_gen_param); + for (i=0; i < GEN->n_gen_param; i++) + fprintf(LOG,"%s:\t[%d] = %g\n",gen->genid,i,GEN->gen_param[i]); + } + else { + fprintf(LOG,"none\n"); + } + + fprintf(LOG,"%s: precomputed integer constants for routine: ",gen->genid); + if (GEN->gen_iparam) { + fprintf(LOG,"%d\n",GEN->n_gen_iparam); + for (i=0; i < GEN->n_gen_iparam; i++) + fprintf(LOG,"%s:\t[%d] = %d\n",gen->genid,i,GEN->gen_iparam[i]); + } + else { + fprintf(LOG,"none\n"); + } + fprintf(LOG,"%s:\n",gen->genid); + } + + /* truncated domain ? */ + if (!(gen->distr->set & UNUR_DISTR_SET_STDDOMAIN)) { + fprintf(LOG,"%s: domain has been changed. U in (%g,%g)\n",gen->genid,GEN->Umin,GEN->Umax); + fprintf(LOG,"%s:\n",gen->genid); + } + + fflush(LOG); + +} /* end of _unur_dstd_debug_init() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_dstd_debug_chg_pmfparams( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* print new (changed) parameters of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int i; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DSTD_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: parameters of distribution changed:\n",gen->genid); + for( i=0; igenid,i,DISTR.params[i]); + +} /* end of _unur_dstd_debug_chg_pmfparams() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_dstd_debug_chg_truncated( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* print new (changed) domain of (truncated) distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DSTD_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: domain of truncated distribution changed:\n",gen->genid); + fprintf(LOG,"%s:\tdomain = (%d, %d)\n",gen->genid, DISTR.trunc[0], DISTR.trunc[1]); + fprintf(LOG,"%s:\tU in (%g,%g)\n",gen->genid,GEN->Umin,GEN->Umax); + +} /* end of _unur_dstd_debug_chg_truncated() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_dstd_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + int samplesize = 10000; + int i; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," domain = (%d, %d)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info,"\n"); + + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + + /* method */ + _unur_string_append(info,"method: DSTD (special generator for Discrete STandarD distribution)\n"); + _unur_string_append(info," variant = %d %s\n", gen->variant, + (GEN->is_inversion)?"[implements inversion method]" : ""); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," E [#urn] = %.2f [approx.]\n", + unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize)); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + _unur_string_append(info," variant = %d %s\n", gen->variant, + (gen->set & DSTD_SET_VARIANT) ? "" : "[default]"); + _unur_string_append(info,"\n"); + } + + /* tables */ + if (help) { + _unur_string_append(info,"table of precomputed double constants: "); + if (GEN->gen_param) { + _unur_string_append(info,"%d\n",GEN->n_gen_param); + for (i=0; i < GEN->n_gen_param; i++) + _unur_string_append(info," [%d] = %g\n",i,GEN->gen_param[i]); + } + else { + _unur_string_append(info,"none\n"); + } + + _unur_string_append(info,"table of precomputed integer constants: "); + if (GEN->gen_iparam) { + _unur_string_append(info,"%d\n",GEN->n_gen_iparam); + for (i=0; i < GEN->n_gen_iparam; i++) + _unur_string_append(info," [%d] = %d\n",i,GEN->gen_iparam[i]); + } + else { + _unur_string_append(info,"none\n"); + } + + _unur_string_append(info,"\n"); + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_dstd_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/dstd.h b/vendor/unuran-1.11.0/src/methods/dstd.h new file mode 100644 index 0000000..98a0465 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dstd.h @@ -0,0 +1,188 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dstd.h * + * * + * PURPOSE: * + * function prototypes for method DSTD * + * (wrapper for special generators for * + * Discrete STanDard distributions) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD DSTD Discrete STandarD distributions + + =UP Methods_for_DISCR + + =REQUIRED standard distribution from UNU.RAN library + (@pxref{Stddist,,Standard distributions}) or discrete + distribution with inverse CDF. + + =SPEED Set-up: fast, Sampling: depends on distribution and generator + + =REINIT supported + + =DESCRIPTION + DSTD is a wrapper for special generators for discrete univariate + standard distributions. It only works for distributions in the + UNU.RAN library of standard distributions + (@pxref{Stddist,,Standard distributions}) + or for discrete distributions where the inverse CDF is given. + If a distribution object is provided that is build from scratch, + it must provide the inverse CDF. Then CSTD implements the + inversion method. Otherwise, the NULL pointer is returned. + + For some distributions more than one special generator + is possible. + + =HOWTOUSE + Create a distribution object for a standard distribution + from the UNU.RAN library + (@pxref{Stddist,,Standard distributions}), + or create a discrete distribution object and set the function + for the inverse CDF using unur_distr_discr_set_invcdf(). + For some distributions more than one special generator + (@emph{variants}) is possible. These can be choosen by a + unur_dstd_set_variant() call. For possible variants + @xref{Stddist,,Standard distributions}. + However the following are common to all distributions: + + @table @code + @item UNUR_STDGEN_DEFAULT + the default generator. + @item UNUR_STDGEN_FAST + the fastest available special generator. + @item UNUR_STDGEN_INVERSION + the inversion method (if available). + @end table + + Notice that the variant @code{UNUR_STDGEN_FAST} for a special + generator might be slower than one of the universal algorithms! + Additional variants may exist for particular distributions. + + Sampling from truncated distributions (which can be constructed by + changing the default domain of a distribution by means of + unur_distr_discr_set_domain() or unur_dstd_chg_truncated calls) + is possible but requires the inversion method. Moreover the CDF + of the distribution must be implemented. + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* + =ROUTINES +*/ + +UNUR_PAR *unur_dstd_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for new generator. It requires a distribution object + for a discrete univariant distribution from the + UNU.RAN library of standard distributions + (@pxref{Stddist,,Standard distributions}). + + Using a truncated distribution is allowed only if the inversion method + is available and selected by the unur_dstd_set_variant() call immediately + after creating the parameter object. + Use a unur_distr_discr_set_domain() call to get a truncated + distribution. +*/ + +/*...........................................................................*/ + +int unur_dstd_set_variant( UNUR_PAR *parameters, unsigned variant ); +/* + Set variant (special generator) for sampling from a given distribution. + For possible variants + @pxref{Stddist,,Standard distributions}. + + Common variants are @code{UNUR_STDGEN_DEFAULT} for the default generator, + @code{UNUR_STDGEN_FAST} for (one of the) fastest implemented + special generators, and @code{UNUR_STDGEN_INVERSION} for the + inversion method (if available). + If the selected variant number is not implemented, then an error code is + returned and the variant is not changed. +*/ + +/*...........................................................................*/ + +int unur_dstd_chg_truncated( UNUR_GEN *generator, int left, int right ); +/* + Change left and right border of the domain of the (truncated) distribution. + This is only possible if the inversion method is used. + Otherwise this call has no effect and an error code is returned. + + Notice that the given truncated domain must be a subset of the + domain of the given distribution. The generator always uses the + intersection of the domain of the distribution and the truncated + domain given by this call. + + It is not required to run unur_reinit() after this call has been used. + + @emph{Important:} If the CDF is (almost) the same for @var{left} and + @var{right} and (almost) equal to @code{0} or @code{1}, then the truncated + domain is not chanced and the call returns an error code. + + @emph{Notice:} If the parameters of the distribution has been changed + it is recommended to set the truncated domain again, since the + former call might change the domain of the distribution but not + update the values for the boundaries of the truncated + distribution. +*/ + +/* + =END +*/ + +/*---------------------------------------------------------------------------*/ + +/* Yet not documented! */ + +int unur_dstd_eval_invcdf( const UNUR_GEN *generator, double u ); +/* + Evaluate inverse CDF at @var{u}. However, this requires that + @var{generator} implements an inversion method. + If @var{u} is out of the domain [0,1] then @code{unur_errno} is set + to @code{UNUR_ERR_DOMAIN} and the respective bound of + the domain of the distribution are returned (which is + @code{INT_MIN} or @code{INT_MAX} in the case of + unbounded domains). + + @emph{Notice}: When the domain has been truncated by a + unur_dstd_chg_truncated() call then the inverse CDF of the + truncated distribution is returned. +*/ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/dstd_struct.h b/vendor/unuran-1.11.0/src/methods/dstd_struct.h new file mode 100644 index 0000000..69c16b6 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/dstd_struct.h @@ -0,0 +1,59 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: dstd_struct.h * + * * + * PURPOSE: * + * declares structures for method DSTD * + * (wrapper for special generators for * + * Discrete STanDard distributions) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_dstd_par { + int dummy; /* no special parameters */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_dstd_gen { + double *gen_param; /* parameters for the generator */ + int n_gen_param; /* number of parameters for the generator */ + + int *gen_iparam; /* integer parameters for generator */ + int n_gen_iparam; /* number of integer parameters for the generator */ + + double Umin; /* cdf at left boundary of domain */ + double Umax; /* cdf at right boundary of domain */ + int is_inversion; /* indicate whether method is inversion method */ + const char *sample_routine_name; /* name of sampling routine */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/empk.c b/vendor/unuran-1.11.0/src/methods/empk.c new file mode 100644 index 0000000..38d2e78 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/empk.c @@ -0,0 +1,1307 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: empk.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: generate from kernel estimation * + * * + * DESCRIPTION: * + * Given observed sample. * + * Produce a value x consistent with this sample * + * * + * REQUIRED: * + * pointer to sample * + * alpha factor (is required if a kernel is given) * + * * + * OPTIONAL: * + * kernel * + * smoothing factor * + * beta factor * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * * + * [1] Devroye, L. and Gyorfi, L. (1985): Nonparametric Density * + * Estimation: The $L_1$ View. New-York: John Wiley. * + * * + * [2] Devroye, L. (1986): Non-Uniform Random Variate Generation. (p. 765) * + * New York: Springer-Verlag. * + * * + * [3] Hoermann, W. and Leydold, J. (2000): Automatic random variate * + * generation for simulation input. Proceedings of the 2000 Winter * + * Simulation Conference. (??? eds.) * + * * + * [4] Silverman, B. (1986): Density Estimation for Statistics and * + * Data Analysis. London: Chapman and Hall. * + * * + ***************************************************************************** + * * + * The method here is based on the fact that it is very easy to generate * + * random variates that have as density the kernel density estimate of a * + * given sample: It is enough to randomly select a point from the given * + * sample and return it together with some additive noise (see [1], [2] * + * [3] and [4]). Note that it is not necessary to compute the density * + * estimate itself! In fact it is much easier to generate variates from * + * the density estimate than to compute the estimate itself! * + * * + * For kernel density estimation we have to choose the kernel function * + * (this is for us the density of the noise) and the smoothing parameter * + * (i.e. the scale parameter of the kernel variate.) There is a lot * + * of theory discussing the optimal smoothing parameter for density * + * estimation. As we are mainly interested in a simple formula we * + * use the formula explained in [4] p.46-47 that is minimizing the * + * asymptotically MISE (mean integrated squared error) for a given * + * kernel. We have the danger of oversmoothing the data if they are * + * non-normal. Especially for multimodal distributions we get a better * + * bandwidth if we replace the sample's stdev s in the formula by the * + * minimum of s and the interquartilsrange R divided through 1.34. * + * * + * bwidth_opt = alpha * beta * min(s,R/1.34) * n^(-1/5) * + * * + * If we assume normal data we have to take beta = 1.364, which * + * is the default value of beta for the library. * + * To make it easy for the user to choose the bwidth as a fraction * + * of the bwidth_opt explained above we introduced the parameter * + * smoothing_factor and compute: * + * * + * bwidth= bwidth_opt * smoothing_factor * + * * + * Alpha is a constant only depending on the kernel K(t) and can be * + * computed as * + * * + * alpha(K) = Var(K)^(-2/5){ \int K(t)^2 dt}^(1/5) * + * * + *...........................................................................* + * * + * Algorithm EMPK: * + * * + * [Input] * + * Sample X(i) for i=1,2,..,n * + * * + * [Generate] * + * 1: Generate a random variate I uniformly distributed on {1, 2,...,n} * + * 2: Generate a random variate W from the distribution with density K(t) * + * 3: Return X(I) + bwidth * W * + * * + *...........................................................................* + * * + * As kernel we can take any unimodal density symmetric around 0 that has * + * finite variance. Regarding the asymptotic MISE the so called * + * Epanechnikov (or Bartlett) kernel (K(x) = 3/4(1-x^2) |x|<=1) * + * is optimal, but several others have almost the same efficiency. * + * From a statistical point of view it may be attractive to add * + * Gaussian noise. If we are interested in the speed of the sampling * + * procedure it is of course fastest to use the rectangular (or Boxcar) * + * kernel as this means uniform noise. * + * * + * The mean of the empirical distribution is equal to the sample mean. * + * One disadvantage of this method lies in the fact that the variance of * + * the empirical distribution generated by the kernel method is always * + * higher than the sample standard-deviation s. As pointed out in [4] * + * it is not difficult to correct this error. For the variance * + * corrected version we have to compute the mean mux and the * + * standardeviation s of the sample and we have to know the Variance of * + * the kernel V(K). Then we can replace step (3) of the algorithm above * + * by: * + * * + * 3': Return mux +(X(I) - mux + bwidth * W)/(1+bwidth^2 V(K)/s^2)^(1/2) * + * * + * We can turn on or off variance correction with the function * + * * + * unur_empk_set_varcor(); * + * * + * We also have problems with this method if we want to generate only * + * positive random variates, as due to the added noise it can happen * + * that the generated variate is negative, even if all values of the * + * observed sample are positive. One simple possibility to get around * + * this problem is the so called mirroring principle. If the generated * + * variate X is negative we simply return -X. * + * * + * We can turn on or off the mirroring with the function * + * * + * unur_empk_set_positive(); * + * * + * It is not difficult to see that the mirroring principle is * + * disturbing the variance correction, which can no longer guarantee * + * that the variance of the generated distribution is equal to the * + * sample variance. * + * The mirroring principle is also spoiling the nice property that the * + * mean of the generated distribution is equal to the sample mean. Both * + * problems are only of practical relevance if a high proportion of the * + * sample is close to 0. There are no simple methods to get around these * + * problems. It is a well-known fact that kernel density estimation * + * performs poor around a point of discontinuity of the density! There * + * are special kernels suggested in the literature to cope with this * + * problem but they are not easily applicable to our algorithm. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen.h" +#include "x_gen_source.h" +#include "arou.h" +#include "cstd.h" +#include "empk.h" +#include "empk_struct.h" + +/*---------------------------------------------------------------------------*/ +/* Variants: */ + +#define EMPK_VARFLAG_VARCOR 0x001u /* use variance correction */ +#define EMPK_VARFLAG_POSITIVE 0x002u /* only positive values */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define EMPK_DEBUG_PRINTDATA 0x00000100u + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define EMPK_SET_KERNEL 0x010u /* kernel density */ +#define EMPK_SET_KERNGEN 0x020u /* generator for kernel */ +#define EMPK_SET_KERNELVAR 0x001u /* variance of kernel */ +#define EMPK_SET_ALPHA 0x002u /* alpha factor */ +#define EMPK_SET_BETA 0x004u /* beta factor */ +#define EMPK_SET_SMOOTHING 0x008u /* smoothing factor */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "EMPK" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_empk_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_empk_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_empk_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_empk_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_empk_sample( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +inline static int _unur_empk_comp_stddev( double *data, int n_data, + double *mean, double *stddev); +/*---------------------------------------------------------------------------*/ +/* compute mean and standard deviation of data. */ +/*---------------------------------------------------------------------------*/ + +inline static double _unur_empk_comp_iqrtrange( double *data, int n_data ); +/*---------------------------------------------------------------------------*/ +/* compute interquartile range. */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_empk_debug_init( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_empk_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cemp /* data for distribution object */ + +#define PAR ((struct unur_empk_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_empk_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cemp /* data for distribution in generator object */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +/*---------------------------------------------------------------------------*/ +/* constants */ + +/*---------------------------------------------------------------------------*/ + +#define SQU(a) ((a)*(a)) + +/*---------------------------------------------------------------------------*/ + +/* compare two doubles (needed for sorting) */ +inline static int +compare_doubles (const void *a, const void *b) +{ + const double *da = (const double *) a; + const double *db = (const double *) b; + return (*da > *db) - (*da < *db); +} + +/*---------------------------------------------------------------------------*/ + +#define _unur_empk_getSAMPLE(gen) (_unur_empk_sample) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_empk_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CEMP) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CEMP,NULL); + + if (DISTR_IN.sample == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"observed sample"); return NULL; } + if (DISTR_IN.n_sample < 2) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"number of observed sample"); return NULL; } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_empk_par) ); + COOKIE_SET(par,CK_EMPK_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->kernvar = 1.; /* variance of used kernel, only used if varcor == 1 */ + PAR->alpha = 0.7763884; /* alpha for Gaussian kernel, efficiency = 0.951 */ + PAR->beta = 1.3637439; /* optimal BETA if data follow normal distribution */ + PAR->smoothing = 1.; /* determines how "smooth" the estimated density will be */ + + /* kernel */ + PAR->kerngen = NULL; /* random variate generator for kernel (by user) */ + PAR->kernel = NULL; /* random variate generator for kernel (internal) */ + + par->method = UNUR_METH_EMPK; /* method */ + par->variant = 0u; /* default variant */ + + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_empk_init; + + return par; + +} /* end of unur_empk_new() */ + +/*****************************************************************************/ + +int +unur_empk_set_kernel( struct unur_par *par, unsigned kernel) + /*----------------------------------------------------------------------*/ + /* set standard kernel and start kernel generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* kernel ... identifier for standard kernel */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + UNUR_DISTR *kerndist; + double fpar[4]; + + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, EMPK ); + + /* It is not possible to call unur_empk_set_kernel() twice. */ + if (par->set & EMPK_SET_KERNEL) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"Cannot overwrite kernel"); + return UNUR_ERR_PAR_SET; + } + + /* check for standard distribution and set data */ + switch (kernel) { + case UNUR_DISTR_EPANECHNIKOV: + /* Epanechnikov (or Bartlett) kernel. efficiency 1.000 + minimizes asymptotic MISE. + PDF: f(x)=3/4 (1-x^2) for -1kernel = unur_init( unur_arou_new ( kerndist ) ); + PAR->alpha = 1.718771928; + PAR->kernvar = 0.2; + unur_distr_free( kerndist ); + break; + + case UNUR_DISTR_GAUSSIAN: + /* Gaussian (normal) kernel. efficiency = 0.951 */ + kerndist = unur_distr_normal( NULL, 0 ); + PAR->kernel = unur_init( unur_cstd_new ( kerndist ) ); + PAR->alpha = 0.7763884; + PAR->kernvar = 1.; + unur_distr_free( kerndist ); + break; + + case UNUR_DISTR_BOXCAR: + /* Boxcar (uniform, rectangular) kernel. efficiency = 0.930 */ + fpar[0] = -1.; + fpar[1] = 1.; + kerndist = unur_distr_uniform( fpar, 2 ); + PAR->kernel = unur_init( unur_cstd_new ( kerndist ) ); + PAR->alpha = 1.351; + PAR->kernvar = 1./3.; + unur_distr_free( kerndist ); + break; + + case UNUR_DISTR_STUDENT: + /* t3 kernel (Student's distribution with 3 degrees of freedom). + efficiency = 0.679 */ + fpar[0] = 3.; + kerndist = unur_distr_student( fpar, 1 ); + PAR->kernel = unur_init( unur_cstd_new ( kerndist ) ); + PAR->alpha = 0.48263; + PAR->kernvar = 3.; + unur_distr_free( kerndist ); + break; + + case UNUR_DISTR_LOGISTIC: + /* logistic kernel. efficiency = efficiency = 0.887 */ + kerndist = unur_distr_logistic( NULL, 0 ); + PAR->kernel = unur_init( unur_cstd_new ( kerndist ) ); + PAR->alpha = 0.434; + PAR->kernvar = 3.289868133696; /* Pi^2/3 */ + unur_distr_free( kerndist ); + break; + + default: + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"Unknown kernel. make it manually"); + return UNUR_ERR_PAR_SET; + } + + /* generation of kernel successful ? */ + if (PAR->kernel == NULL) { + _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,"Could not initialize kernel generator"); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + } + + /* changelog */ + par->set &= ~EMPK_SET_KERNGEN; /* just for the case that ..._set_kerngen() has been called */ + par->set |= EMPK_SET_KERNEL | EMPK_SET_ALPHA | EMPK_SET_KERNELVAR; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_empk_set_kernel() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_empk_set_kernelgen( struct unur_par *par, const struct unur_gen *kernelgen, + double alpha, double kernelvar ) + /*----------------------------------------------------------------------*/ + /* set generator for kernel distribution */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* kernelgen ... generator object that holds the kernel */ + /* alpha ... parameter depending on kernel */ + /* kernelvar ... variance of kernel */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_NULL( GENTYPE, kernelgen, UNUR_ERR_NULL ); + _unur_check_par_object( par, EMPK ); + + /* It is not possible to run this function after a + unur_empk_set_kernel() call. */ + if (par->set & EMPK_SET_KERNEL) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"Cannot overwrite kernel"); + return UNUR_ERR_PAR_SET; + } + /* check kernel distribution */ + if ( (kernelgen->method & UNUR_MASK_TYPE) != UNUR_METH_CONT ) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); + return UNUR_ERR_DISTR_INVALID; + } + + /* check new parameter for generator */ + if (alpha <= 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"alpha <= 0"); + return UNUR_ERR_PAR_SET; + } + + /* set kernel distribution */ + PAR->kerngen = kernelgen; + + /* store alpha factor */ + PAR->alpha = alpha; + + /* changelog */ + par->set |= EMPK_SET_KERNGEN | EMPK_SET_ALPHA; + + /* set kernel variance */ + PAR->kernvar = kernelvar; + + if (kernelvar > 0.) + par->set |= EMPK_SET_KERNELVAR; + else + /* variance correction disabled */ + par->set &= ~EMPK_SET_KERNELVAR; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_empk_set_kernelgen() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_empk_set_beta( struct unur_par *par, double beta ) + /*----------------------------------------------------------------------*/ + /* set beta factor */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* beta ... parameter depending on sample */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, EMPK ); + + /* check new parameter for generator */ + if (beta <= 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"beta <= 0"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->beta = beta; + + /* changelog */ + par->set |= EMPK_SET_BETA; + + return UNUR_SUCCESS; + +} /* end of unur_empk_set_beta() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_empk_set_smoothing( struct unur_par *par, double smoothing ) + /*----------------------------------------------------------------------*/ + /* set smoothing factor */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* smoothing ... smoothing factor */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, EMPK ); + + /* check new parameter for generator */ + if (smoothing < 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"smoothing factor < 0"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->smoothing = smoothing; + + /* changelog */ + par->set |= EMPK_SET_SMOOTHING; + + return UNUR_SUCCESS; + +} /* end of unur_empk_set_smoothing() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_empk_chg_smoothing( struct unur_gen *gen, double smoothing ) + /*----------------------------------------------------------------------*/ + /* change smoothing factor */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* smoothing ... smoothing factor */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, EMPK, UNUR_ERR_GEN_INVALID ); + + /* no changelog required */ + + /* check new parameter for generator */ + if (smoothing < 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"smoothing factor < 0"); + return UNUR_ERR_PAR_SET; + } + + /* recompute band width */ + GEN->bwidth = smoothing * GEN->bwidth_opt; + + /* recompute constant for variance corrected version */ + GEN->sconst = 1./sqrt(1. + GEN->kernvar * SQU( GEN->bwidth/GEN->stddev_observ ) ); + + /* store smoothing factor */ + GEN->smoothing = smoothing; + + /* changelog */ + gen->set |= EMPK_SET_SMOOTHING; + + return UNUR_SUCCESS; + +} /* end of unur_empk_chg_smoothing() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_empk_set_varcor( struct unur_par *par, int varcor ) + /*----------------------------------------------------------------------*/ + /* turn variance correction on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* varcor ... 0 = no variance correction, !0 = variance correction */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* variance correction is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, EMPK ); + + /* we do not know yet if the kernel variance known */ + + /* we use a bit in variant */ + par->variant = (varcor) + ? (par->variant | EMPK_VARFLAG_VARCOR) + : (par->variant & (~EMPK_VARFLAG_VARCOR)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_empk_set_varcor() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_empk_chg_varcor( struct unur_gen *gen, int varcor ) + /*----------------------------------------------------------------------*/ + /* turn variance correction on/off */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* varcor ... 0 = no variance correction, !0 = variance correction */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, EMPK, UNUR_ERR_GEN_INVALID ); + + /* kernel variance known ? */ + if (! (gen->set & EMPK_SET_KERNELVAR) ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"variance correction disabled"); + return UNUR_ERR_PAR_SET; + } + + /* no changelog required */ + + /* we use a bit in variant */ + gen->variant = (varcor) + ? (gen->variant | EMPK_VARFLAG_VARCOR) + : (gen->variant & (~EMPK_VARFLAG_VARCOR)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_empk_chg_varcor() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_empk_set_positive( struct unur_par *par, int positive ) + /*----------------------------------------------------------------------*/ + /* turn mirroring (produces positive random numbers only) on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* positive ... 0 = no mirroring, !0 = mirroring */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no mirroring is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, EMPK ); + + /* we use a bit in variant */ + par->variant = (positive) + ? (par->variant | EMPK_VARFLAG_POSITIVE) + : (par->variant & (~EMPK_VARFLAG_POSITIVE)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_empk_set_positive() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_empk_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + double iqrtrange; /* interquartile range of data */ + double sigma; /* estimation (guess) for "real" standard deviation + of observed data. */ + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_EMPK ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_EMPK_PAR,NULL); + + /* check kernel generator */ + if ( PAR->kerngen==NULL && PAR->kernel == NULL) { + /* no kernel given. use default kernel */ + if ( unur_empk_set_kernel( par, UNUR_DISTR_GAUSSIAN )!=UNUR_SUCCESS ) { + /* cannot make kernel generator (should not happen!) */ + _unur_par_free(par); return NULL; + } + } + + /* create a new empty generator object */ + gen = _unur_empk_create(par); + if (!gen) { _unur_par_free(par); return NULL; } + + /* if variance correction is used, the variance of the kernel + must be known and positive */ + if( (gen->variant & EMPK_VARFLAG_VARCOR) && + !( (gen->set & EMPK_SET_KERNELVAR) && GEN->kernvar > 0. )) { + _unur_warning(GENTYPE,UNUR_ERR_GEN_DATA,"variance correction disabled"); + gen->variant &= ~EMPK_SET_KERNELVAR; + } + + /* set uniform random number generator */ + GEN->kerngen->urng = par->urng; + + /* copy debugging flags */ + GEN->kerngen->debug = par->debug; + + /* the observed data */ + + /* sort entries */ + /** TODO: this sort can be removed after we have implemented a new + version of the function iqrtrange, that does not depend on sorting **/ + qsort( GEN->observ, (size_t)GEN->n_observ, sizeof(double), compare_doubles); + + /* compute mean and standard deviation of observed sample */ + _unur_empk_comp_stddev( GEN->observ, GEN->n_observ, &(GEN->mean_observ), &(GEN->stddev_observ) ); + + /* compute interquartile range of the sample */ + iqrtrange = _unur_empk_comp_iqrtrange( GEN->observ, GEN->n_observ ); + + /* get an estimation (guess) of the "real" standard deviation of + the observed data. + For normal distributed data it is 1.34 times the interquartile range. + If this is greater than the observed standard deviation we use that + instead of. */ + sigma = iqrtrange / 1.34; + if (GEN->stddev_observ < sigma) sigma = GEN->stddev_observ; + + /* compute band width (also called window width) */ + GEN->bwidth_opt = GEN->alpha * GEN->beta * sigma / exp(0.2 * log((double)GEN->n_observ)); + GEN->bwidth = GEN->smoothing * GEN->bwidth_opt; + + /* compute constant for variance corrected version */ + GEN->sconst = 1./sqrt(1. + GEN->kernvar * SQU( GEN->bwidth/GEN->stddev_observ ) ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_empk_debug_init(gen); +#endif + + /* free parameters */ + _unur_par_free(par); + + return gen; + +} /* end of _unur_empk_init() */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen * +_unur_empk_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_EMPK_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_empk_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_EMPK_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_empk_getSAMPLE(gen); + gen->destroy = _unur_empk_free; + gen->clone = _unur_empk_clone; + + /* copy observed data into generator object */ + GEN->observ = DISTR.sample; /* observations in distribution object */ + GEN->n_observ = DISTR.n_sample; /* sample size */ + + /* copy some parameters into generator object */ + GEN->smoothing = PAR->smoothing; /* smoothing factor */ + GEN->alpha = PAR->alpha; /* parameter for kernel width */ + GEN->beta = PAR->beta; /* parameter for kernel width */ + + /* copy kernel generator into generator object */ + if (PAR->kerngen) + /* kernel provided by user */ + GEN->kerngen = _unur_gen_clone(PAR->kerngen); + else + /* kernel from UNURAN list of kernels */ + GEN->kerngen = PAR->kernel; + + /* variance of kernel */ + GEN->kernvar = PAR->kernvar; + + /* the kernel is an auxilliary generator for method EMPK, of course */ + gen->gen_aux = GEN->kerngen; + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_empk_info; +#endif + +/* RETURN pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_empk_create() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_empk_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_empk_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_EMPK_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* copy observed data into generator object */ + CLONE->observ = clone->distr->data.cemp.sample; /* observations in distribution object */ + + /* kernel generator is (also) stored as auxiliary generator */ + /* which has already been cloned by generic_clone. */ + CLONE->kerngen = clone->gen_aux; + + return clone; + +#undef CLONE +} /* end of _unur_empk_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_empk_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_EMPK ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_EMPK_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_empk_free() */ + +/*****************************************************************************/ + +double +_unur_empk_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U,K,X; + int j; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_EMPK_GEN,UNUR_INFINITY); + + /* select uniformly one of the observations */ + U = _unur_call_urng(gen->urng) * GEN->n_observ; + j = (int) (U); + + /** TODO: recycle uniform random variate?? + maybe for Boxcar (Uniform) Kernel. **/ + /* U -= j; u is now a "recycled" U(0,1) random variate, aber wie weiter verwenden, ? */ + + /* sample from kernel distribution */ + K = unur_sample_cont( GEN->kerngen ); + + if (gen->variant & EMPK_VARFLAG_VARCOR) + /* use variance correction */ + X = GEN->mean_observ + (GEN->observ[j] - GEN->mean_observ + GEN->bwidth * K) * GEN->sconst; + else + /* no variance correction */ + X = GEN->observ[j] + GEN->bwidth * K; + + if (gen->variant & EMPK_VARFLAG_POSITIVE) + /* use mirroring to avoid non-positive numbers */ + X = (X<0.) ? -X : X; + + return X; + +} /* end of _unur_empk_sample() */ + + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_empk_comp_stddev( double *data, int n_data, double *mean, double *stddev) + /*----------------------------------------------------------------------*/ + /* compute mean and standard deviation of data */ + /* */ + /* parameters: */ + /* data ... pointer to array of data */ + /* n_data ... number of data points */ + /* mean ... pointer to store mean */ + /* stddev ... pointer to store stddev */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* REFERENCES: */ + /* [1] Spicer C.C. (1972): Algorithm AS 52: Calculation of Power Sums */ + /* of Deviations about the mean, */ + /* Applied Statistics 21(2), pp. 226-227. */ + /*----------------------------------------------------------------------*/ +{ + double xsqu_sum; /* sum of x[i]^2 */ + double dx; + int n; + + if (n_data < 2) + /* cannot compute standard deviation */ + return 0; + + /* initialize counters */ + *mean = 0.; + xsqu_sum = 0.; + + /* compute sums */ + for (n=1; n <= n_data; n++) { + dx = (data[n-1] - *mean) / n; + xsqu_sum += n * (n - 1.) * dx * dx; + *mean += dx; + } + + /* compute standard deviation */ + *stddev = sqrt( xsqu_sum / (n_data - 1.)); + + return UNUR_SUCCESS; +} /* end of _unur_empk_comp_stddev() */ + +/*---------------------------------------------------------------------------*/ + +/** TODO: implement a new version of interquartilsrang that does not depend + on sorting. (Only important if we want to use really large samples) **/ +double +_unur_empk_comp_iqrtrange( double *data, int n ) + /*----------------------------------------------------------------------*/ + /* compute interquartile range of sorted data (in ascending order) */ + /* */ + /* parameters: */ + /* data ... pointer to array of data */ + /* n ... number of data points */ + /* */ + /* return: */ + /* interquartile range */ + /*----------------------------------------------------------------------*/ +{ + double lowerqrt,upperqrt; /* lower and upper quartile */ + int j; + + /* data must be sorted in ascending order */ + + j = n/2; + + if (j % 2) { + lowerqrt = data[(j+1)/2-1]; + upperqrt = data[n-(j+1)/2]; + } + else { + lowerqrt = (data[j/2-1] + data[j/2+1-1])/2.; + upperqrt = (data[n-j/2] + data[n-j/2-1])/2.; + } + + return (upperqrt - lowerqrt); + +} /* end of _unur_empk_comp_iqrange() */ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +static void +_unur_empk_debug_init( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_EMPK_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = EMPK (EMPirical distribution with Kernel smoothing)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cemp_debug( gen->distr, gen->genid, (gen->debug & EMPK_DEBUG_PRINTDATA)); + + fprintf(LOG,"%s: sampling routine = _unur_empk_sample()\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: smoothing factor = %g",gen->genid, GEN->smoothing); + _unur_print_if_default(gen,EMPK_SET_SMOOTHING); fprintf(LOG,"\n"); + if (gen->variant & EMPK_VARFLAG_POSITIVE) + fprintf(LOG,"%s: positive random variable only; use mirroring \n",gen->genid); + + if (gen->variant & EMPK_VARFLAG_VARCOR) + fprintf(LOG,"%s: use variance correction\n",gen->genid); + else + fprintf(LOG,"%s: no variance correction\n",gen->genid); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: Kernel:\n",gen->genid); + + fprintf(LOG,"%s: type = %s ",gen->genid,GEN->kerngen->distr->name); + if (gen->set & EMPK_SET_KERNGEN) + fprintf(LOG,"[kernel generator set]\n"); + else if (gen->set & EMPK_SET_KERNEL) + fprintf(LOG,"[standard kernel]\n"); + else + fprintf(LOG,"[default kernel]\n"); + + fprintf(LOG,"%s: window width = %g\t(opt = %g)\n",gen->genid, GEN->bwidth, GEN->bwidth_opt); + fprintf(LOG,"%s: alpha = %g",gen->genid, GEN->alpha); + _unur_print_if_default(gen,EMPK_SET_ALPHA); fprintf(LOG,"\n"); + if (gen->variant & EMPK_VARFLAG_VARCOR) { + fprintf(LOG,"%s: kernel variance = %g",gen->genid, GEN->kernvar); + _unur_print_if_default(gen,EMPK_SET_KERNELVAR); fprintf(LOG,"\n"); + fprintf(LOG,"%s: variance correction factor = %g\n",gen->genid, GEN->sconst); + } + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: Data:\n",gen->genid); + fprintf(LOG,"%s: beta = %g",gen->genid, GEN->beta); + _unur_print_if_default(gen,EMPK_SET_BETA); fprintf(LOG,"\n"); + fprintf(LOG,"%s: mean (data) = %g\n",gen->genid, GEN->mean_observ); + fprintf(LOG,"%s: stddev (data) = %g\n",gen->genid, GEN->stddev_observ); + + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_empk_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_empk_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = DATA [length=%d]\n", GEN->n_observ); + _unur_string_append(info,"\n"); + + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + + /* method */ + _unur_string_append(info,"method: EMPK (EMPirical distribution with Kernel smoothing)\n"); + + _unur_string_append(info," kernel type = %s (alpha=%g) ", GEN->kerngen->distr->name, GEN->alpha); + if (gen->set & EMPK_SET_KERNGEN) + _unur_string_append(info,"[kernel generator set]\n"); + else if (gen->set & EMPK_SET_KERNEL) + _unur_string_append(info,"[standard kernel]\n"); + else + _unur_string_append(info,"[default kernel]\n"); + + _unur_string_append(info," window width = %g (opt = %g)\n", GEN->bwidth, GEN->bwidth_opt); + + _unur_string_append(info," smoothing factor = %g\n", GEN->smoothing); + + if (gen->variant & EMPK_VARFLAG_POSITIVE) + _unur_string_append(info," positive random variable only; use mirroring\n"); + + if (gen->variant & EMPK_VARFLAG_VARCOR) + _unur_string_append(info," variance correction factor = %g\n", GEN->sconst); + else + _unur_string_append(info," no variance correction\n"); + _unur_string_append(info,"\n"); + + /* performance */ + /* _unur_string_append(info,"performance characteristics:\n"); */ + /* _unur_string_append(info,"\n"); */ + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + _unur_string_append(info," smoothing = %g %s\n", GEN->smoothing, + (gen->set & EMPK_SET_SMOOTHING) ? "" : "[default]"); + + if (gen->set & EMPK_SET_BETA) + _unur_string_append(info," beta = %g\n", GEN->beta); + + if (gen->variant & EMPK_VARFLAG_VARCOR) + _unur_string_append(info," varcor = on\n"); + + if (gen->variant & EMPK_VARFLAG_POSITIVE) + _unur_string_append(info," positive = on\n"); + + _unur_string_append(info,"\n"); + + /* Not displayed: + int unur_empk_set_kernel( UNUR_PAR *parameters, unsigned kernel); + int unur_empk_set_kernelgen( UNUR_PAR *parameters, const UNUR_GEN *kernelgen, double alpha, double kernelvar ); + */ + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_empk_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/empk.h b/vendor/unuran-1.11.0/src/methods/empk.h new file mode 100644 index 0000000..0639d57 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/empk.h @@ -0,0 +1,265 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: empk.h * + * * + * PURPOSE: * + * function prototypes for method EMPK * + * (EMPirical distribution with Kernel smoothing) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD EMPK EMPirical distribution with Kernel smoothing + + =UP Methods_for_CEMP + + =REQUIRED observed sample + + =SPEED Set-up: slow (as sample is sorted), + Sampling: fast (depends on kernel) + + =REINIT not implemented + + =REF [HLa00] [HLD04: Sect.12.1.2] + + =DESCRIPTION + EMPK generates random variates from an empirical distribution that is + given by an observed sample. The idea is that simply choosing a random + point from the sample and to return it with some added noise results + in a method that has very nice properties, as it can be seen as sampling + from a kernel density estimate. If the underlying distribution is + continuous, especially the fine structur of the resulting empirical + distribution is much better than using only resampling without noise. + + Clearly we have to decide about the density of the noise (called kernel) + and about the standard deviation of the noise. + The mathematical theory of kernel density estimation shows us that we + are comparatively free in choosing the kernel. It also supplies us with + a simple formula to compute the optimal standarddeviation of the noise, + called bandwidth (or window width) of the kernel. + + The variance of the estimated density is slightly larger than + that of the observed sample. However, this can be easily + corrected if required. + + There is also a correction (mirroring technique) for + distributions with non-negative support. + + A simple robust reference method is implemented to find a good + standard deviation of the noise (i.e. the bandwidth of + kernel density estimation). For some cases + (e.g. densities with two or more sharp distinct peaks) there + kernel density estimation can be adjusted by changing the + smoothness factor and the so called beta factor. + + =HOWTOUSE + EMPK uses empirical distributions. The main parameter is the + choice if of kernel density. The most important kernels can be + set by unur_empk_set_kernel(). Additionally generators for other + kernels can be used by using unur_empk_set_kernelgen() instead. + Additionally variance correction and a correction for + non-negative variates can be switched on. + + The two other parameters (smoothing factor and beta factor) are + only useful for people knowing the theory of kernel density + estimation. It is not necessary to change them if + the true underlying distribution is somehow comparable with a + bell-shaped curve, even skewed or with some not too sharp extra peaks. + In all these cases the simple robust reference method implemented to + find a good standard deviation of the noise (i.e. the bandwidth of + kernel density estimation) should give sensible results. + However, it might be necessary to overwrite this automatic method + to find the bandwidth eg. when resampling from data with + two or more sharp distinct peaks. Then the distribution has nearly + discrete components as well and our automatic method may + easily choose too large a bandwidth which results in an + empirical distribution which is oversmoothed (i.e. it has + lower peaks than the original distribution). Then it + is recommended to decrease the bandwidth using the + unur_empk_set_smoothing() call. A smoothing factor of @code{1} + is the default. A smoothing factor of @code{0} leads to naive + resampling of the data. Thus an appropriate value between these + extremes should be choosen. We recommend to consult a reference + on kernel smoothing when doing so; but it is not a simple problem + to determine an optimal bandwidth for distributions with sharp peaks. + + In general, for most applications it is perfectly ok to use the + default values offered. Unless you have some knowledge on + density estimation we do not recommend to change anything. + There are two exceptions: + + @enumerate A + @item + In the case that the unknown underlying distribution is not continuous + but discrete you should "turn off" the adding of the noise by setting: + + @example + unur_empk_set_smoothing(par, 0.) + @end example + + @item + In the case that you are especially + interested in a fast sampling algorithm use the call + @example + unur_empk_set_kernel(par, UNUR_DISTR_BOXCAR); + @end example + to change the used noise distribution from the default Gaussian + distribution to the uniform distribution. + @end enumerate + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_empk_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_empk_set_kernel( UNUR_PAR *parameters, unsigned kernel); +/* + Select one of the supported kernel distributions. Currently the following + kernels are supported: + + @table @code + @item UNUR_DISTR_GAUSSIAN + Gaussian (normal) kernel + @item UNUR_DISTR_EPANECHNIKOV + Epanechnikov kernel + @item UNUR_DISTR_BOXCAR + Boxcar (uniform, rectangular) kernel + @item UNUR_DISTR_STUDENT + t3 kernel (Student's distribution with 3 degrees of freedom) + @item UNUR_DISTR_LOGISTIC + logistic kernel + @end table + + For other kernels (including kernels with Student's distribution + with other than 3 degrees of freedom) use the + unur_empk_set_kernelgen() call. + + It is not possible to call unur_empk_set_kernel() twice. + + Default is the Gaussian kernel. +*/ + +int unur_empk_set_kernelgen( UNUR_PAR *parameters, const UNUR_GEN *kernelgen, double alpha, double kernelvar ); +/* + Set generator for the kernel used for density estimation. + + @var{alpha} is used to compute the optimal bandwidth from the point of + view of minimizing the mean integrated square error (MISE). + It depends on the kernel K and is given by + @example + alpha(K) = Var(K)^(-2/5)@{ \int K(t)^2 dt@}^(1/5) + @end example + For standard kernels (see above) alpha is computed by the algorithm. + + @var{kernvar} is the variance of the used kernel. It is only required + for the variance corrected version of density estimation (which is + used by default); otherwise it is ignored. + If @var{kernelvar} is nonpositive, variance correction is disabled. + For standard kernels (see above) @var{kernvar} is computed by the + algorithm. + + It is not possible to call unur_empk_set_kernelgen() after a standard kernel + has been selected by a unur_empk_set_kernel() call. + + Notice that the uniform random number generator of the kernel + generator is overwritten during the unur_init() call and at each + unur_chg_urng() call with the uniform generator used for the empirical + distribution. + + Default is the Gaussian kernel. +*/ + +int unur_empk_set_beta( UNUR_PAR *parameters, double beta ); +/* + @var{beta} is used to compute the optimal bandwidth from the point + of view of minimizing the mean integrated square error (MISE). + @var{beta} depends on the (unknown) distribution of the sampled data + points. + By default Gaussian distribution is assumed for the sample + (@var{beta} = 1.3637439). There is no requirement to change + @var{beta}. + + Default: @code{1.3637439} +*/ + +int unur_empk_set_smoothing( UNUR_PAR *parameters, double smoothing ); +/* */ + +int unur_empk_chg_smoothing( UNUR_GEN *generator, double smoothing ); +/* + Set and change the smoothing factor. + The smoothing factor controlles how ``smooth'' the resulting density + estimation will be. A smoothing factor equal to @code{0} results in naive + resampling. A very large smoothing factor (together with the + variance correction) results in a density which is approximately + equal to the kernel. + Default is 1 which results in a smoothing parameter minimising + the MISE (mean integrated squared error) if the data are not too + far away from normal. If a large smoothing factor is used, then + variance correction must be switched on. + + Default: @code{1} +*/ + +int unur_empk_set_varcor( UNUR_PAR *parameters, int varcor ); +/* */ + +int unur_empk_chg_varcor( UNUR_GEN *generator, int varcor ); +/* + Switch variance correction in generator on/off. + If @var{varcor} is TRUE then the variance of the used + density estimation is the same as the sample variance. However this + increases the MISE of the estimation a little bit. + + Default is FALSE. +*/ + +int unur_empk_set_positive( UNUR_PAR *parameters, int positive ); +/* + If @var{positive} is TRUE then only nonnegative random variates are + generated. This is done by means of a mirroring technique. + + Default is FALSE. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/methods/empk_struct.h b/vendor/unuran-1.11.0/src/methods/empk_struct.h new file mode 100644 index 0000000..c486774 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/empk_struct.h @@ -0,0 +1,86 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: empk_struct.h * + * * + * PURPOSE: * + * declares structures for method EMPK * + * (EMPirical distribution with Kernel smoothing) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_empk_par { + /* the observed sample is stored in the distribution object */ + + const UNUR_GEN *kerngen; /* random variate generator for kernel + (given by user) */ + UNUR_GEN *kernel; /* random variate generator for kernel + (provided by UNURAN) */ + + double alpha; /* alpha is used to compute the optimal bandwidth from + the point of view of minimizing the mean integrated + square error (MISE). + alfa depends on the type of kernel being used. */ + + double beta; /* beta is used to compute the optimal bandwidth from + the point of view of minimizing the mean integrated + square error (MISE). + beta depends on the (unknown) distribution of the + sampled data points. Thus its value contains some + guess on this distribution. */ + + double smoothing; /* determines how "smooth" the estimated density will be */ + + double kernvar; /* variance of used kernel, only used if varcor == 1 */ + +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_empk_gen { + double *observ; /* pointer to the array of the observations */ + int n_observ; /* number of observations */ + + UNUR_GEN *kerngen; /* random variate generator for kernel */ + + double smoothing; /* determines how "smooth" the estimated density will be */ + double kernvar; /* variance of used kernel, only used if varcor == 1 */ + + double bwidth; /* bandwidth for kernel density estimation */ + double bwidth_opt; /* optimal bandwith for kernel density estimation */ + double mean_observ; /* mean of observed data */ + double stddev_observ; /* standard deviation of oberved data */ + double sconst; /* constant used for variance corrected version + of kernel method */ + double alpha; /* parameter for kernel width */ + double beta; /* parameter for kernel width */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/empl.c b/vendor/unuran-1.11.0/src/methods/empl.c new file mode 100644 index 0000000..d60a2c8 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/empl.c @@ -0,0 +1,521 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: empl.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: generate from empirical CDF with linear interpolation * + * * + * DESCRIPTION: * + * Given observed sample. * + * Produce a value x consistent with this sample * + * * + * REQUIRED: * + * pointer to sample * + * * + * OPTIONAL: * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * * + * [1] Law, A.M. and Kelton, D. (2000): Simulation Modeling and Analysis. * + * New York: McGraw-Hill. * + * * + * [2] Bratley, P., Fox, B.L., and Schrage E.L. (1987): A Guide to * + * Simulation. New York: Springer-Verlag. * + * * + * [3] Hoermann, W. and Leydold, J. (2000): Automatic random variate * + * generation for simulation input. Proceedings of the 2000 Winter * + * Simulation Conference. (??? eds.) * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "empl.h" +#include "empl_struct.h" + +/*---------------------------------------------------------------------------*/ +/* Variants: */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define EMPL_DEBUG_PRINTDATA 0x00000100u + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "EMPL" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_empl_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_empl_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_empl_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_empl_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_empl_sample( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ +static void _unur_empl_debug_init( const struct unur_gen *gen ); + +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_empl_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cemp /* data for distribution object */ + +#define PAR ((struct unur_empl_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_empl_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cemp /* data for distribution in generator object */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +/*---------------------------------------------------------------------------*/ +/* constants */ + +/*---------------------------------------------------------------------------*/ + +/* compare two doubles (needed for sorting) */ +inline static int +compare_doubles (const void *a, const void *b) +{ + const double *da = (const double *) a; + const double *db = (const double *) b; + return (*da > *db) - (*da < *db); +} + +/*---------------------------------------------------------------------------*/ + +#define _unur_empl_getSAMPLE(gen) (_unur_empl_sample) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_empl_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CEMP) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CEMP,NULL); + + if (DISTR_IN.sample == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"observed sample"); return NULL; } + if (DISTR_IN.n_sample < 2) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"number of observed sample"); return NULL; } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_empl_par) ); + COOKIE_SET(par,CK_EMPL_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + + par->method = UNUR_METH_EMPL; /* method */ + par->variant = 0u; /* default variant */ + + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_empl_init; + + return par; + +} /* end of unur_empl_new() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_empl_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_EMPL ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_EMPL_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_empl_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* the observed data */ + + /* sort entries */ + qsort( GEN->observ, (size_t)GEN->n_observ, sizeof(double), compare_doubles); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_empl_debug_init(gen); +#endif + + return gen; + +} /* end of _unur_empl_init() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_empl_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_EMPL_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_empl_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_EMPL_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_empl_getSAMPLE(gen); + gen->destroy = _unur_empl_free; + gen->clone = _unur_empl_clone; + + /* copy observed data into generator object */ + GEN->observ = DISTR.sample; /* observations in distribution object */ + GEN->n_observ = DISTR.n_sample; /* sample size */ + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_empl_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_empl_create() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_empl_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_empl_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_EMPL_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* copy observed data into generator object */ + CLONE->observ = clone->distr->data.cemp.sample; /* observations in distribution object */ + + return clone; + +#undef CLONE +} /* end of _unur_empl_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_empl_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_EMPL ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_EMPL_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_empl_free() */ + +/*****************************************************************************/ + +double +_unur_empl_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U,X; + int J; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_EMPL_GEN,UNUR_INFINITY); + + /* select uniformly an interval */ + U = _unur_call_urng(gen->urng) * (GEN->n_observ-1); + J = (int) (U); + + /* linear CDF between obeservation points */ + X = GEN->observ[J] + (U-J)*(GEN->observ[J+1] - GEN->observ[J]); + + return X; + +} /* end of _unur_empl_sample() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +static void +_unur_empl_debug_init( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_EMPL_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = EMPL (EMPirical distribution with Linear interpolation)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cemp_debug( gen->distr, gen->genid, (gen->debug & EMPL_DEBUG_PRINTDATA)); + + fprintf(LOG,"%s: sampling routine = _unur_empl_sample()\n",gen->genid); + + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_empl_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_empl_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = DATA [length=%d]\n", GEN->n_observ); + _unur_string_append(info,"\n"); + + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + + /* method */ + _unur_string_append(info,"method: EMPL (EMPirical distribution with Linear interpolation)\n"); + _unur_string_append(info,"\n"); + + /* performance */ + /* _unur_string_append(info,"performance characteristics:\n"); */ + /* _unur_string_append(info,"\n"); */ + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters: none\n"); + _unur_string_append(info,"\n"); + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_empl_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/empl.h b/vendor/unuran-1.11.0/src/methods/empl.h new file mode 100644 index 0000000..6b511ae --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/empl.h @@ -0,0 +1,100 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: empl.h * + * * + * PURPOSE: * + * function prototypes for method EMPD * + * (EMPirical distribution with Linear interpolation) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD EMPL EMPirical distribution with Linear interpolation + + =UP Methods_for_CEMP + + =REQUIRED observed sample + + =SPEED Set-up: slow (as sample is sorted), + Sampling: very fast (inversion) + + =REINIT not implemented + + =REF [HLa00] [HLD04: Sect.12.1.3] + + =DESCRIPTION + EMPL generates random variates from an empirical distribution + that is given by an observed sample. This is done by linear + interpolation of the empirical CDF. Although this + method is suggested in the books of Law and Kelton (2000) and + Bratly, Fox, and Schrage (1987) we do not recommend this method at + all since it has many theoretical drawbacks: + The variance of empirical distribution function does not + coincide with the variance of the given sample. Moreover, + when the sample increases the empirical density function + does not converge to the density of the underlying random + variate. Notice that the range of the generated point set is + always given by the range of the given sample. + + This method is provided in UNU.RAN for the sake of + completeness. We always recommend to use method EMPK + (@pxref{EMPK,,EMPirical distribution with Kernel smoothing}). + + If the data seem to be far away from having a bell shaped + histogram, then we think that naive resampling is still better + than linear interpolation. + + =HOWTOUSE + EMPL creates and samples from an empiral distribution by linear + interpolation of the empirical CDF. There are no parameters to + set. + + @noindent + @emph{Important}: We do not recommend to use this method! Use + method EMPK + (@pxref{EMPK,,EMPirical distribution with Kernel smoothing}) + instead. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_empl_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/empl_struct.h b/vendor/unuran-1.11.0/src/methods/empl_struct.h new file mode 100644 index 0000000..660dea2 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/empl_struct.h @@ -0,0 +1,53 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: empl_struct.h * + * * + * PURPOSE: * + * declares structures for method EMPL * + * (EMPirical distribution with Linear interpolation) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_empl_par { + /* the observed sample is stored in the distribution object */ + int dummy; +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_empl_gen { + double *observ; /* pointer to the array of the observations */ + int n_observ; /* number of observations */ +}; + +/*---------------------------------------------------------------------------*/ + + diff --git a/vendor/unuran-1.11.0/src/methods/gibbs.c b/vendor/unuran-1.11.0/src/methods/gibbs.c new file mode 100644 index 0000000..6e03651 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/gibbs.c @@ -0,0 +1,1468 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: gibbs.c * + * * + * TYPE: continuous multivariate random variate * + * METHOD: Gibbs sampler using full conditional distributions. * + * * + * DESCRIPTION: * + * Given PDF * + * Produce a value x consistent with its density * + * * + * REQUIRED: * + * pointer to the density function and its derivatives * + * * + * OPTIONAL: * + * mode of the density * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen.h" +#include "x_gen_source.h" +#include "arou.h" +#include "ars.h" +#include "tdr.h" + +#include "gibbs.h" +#include "gibbs_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Variants */ + +#define GIBBS_VARMASK_VARIANT 0x000fu /* indicates variant */ +#define GIBBS_VARIANT_COORD 0x0001u /* coordinate sampler */ +#define GIBBS_VARIANT_RANDOMDIR 0x0002u /* random direction sampler */ + +#define GIBBS_VARMASK_T 0x00f0u /* indicates transformation */ +#define GIBBS_VAR_T_SQRT 0x0010u /* T(x) = -1/sqrt(x) */ +#define GIBBS_VAR_T_LOG 0x0020u /* T(x) = log(x) */ +#define GIBBS_VAR_T_POW 0x0030u /* T(x) = -x^c */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define GIBBS_DEBUG_CONDI 0x01000000u + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define GIBBS_SET_C 0x001u /* set parameter for transformation T */ +#define GIBBS_SET_X0 0x002u /* set starting point */ +#define GIBBS_SET_THINNING 0x004u /* set thinning factor */ +#define GIBBS_SET_BURNIN 0x008u /* set length of burn-in */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "GIBBS" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_gibbs_init( struct unur_par *par ); +static int _unur_gibbs_coord_init( struct unur_gen *gen ); +static int _unur_gibbs_randomdir_init( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_gibbs_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_gibbs_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_gibbs_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_gibbs_coord_sample_cvec( struct unur_gen *gen, double *vec ); +static int _unur_gibbs_randomdir_sample_cvec( struct unur_gen *gen, double *vec ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_gibbs_normalgen( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* create a normal random variate generator */ +/*---------------------------------------------------------------------------*/ + +static void _unur_gibbs_random_unitvector( struct unur_gen *gen, double *direction ); +/*---------------------------------------------------------------------------*/ +/* generate a random direction vector */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_gibbs_debug_init_start( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print before init of generator starts. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_gibbs_debug_init_condi( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print list of conditional generators. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_gibbs_debug_burnin_failed( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after burnin has failed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_gibbs_debug_init_finished( const struct unur_gen *gen, int success ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_gibbs_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cvec /* data for distribution object */ + +#define PAR ((struct unur_gibbs_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_gibbs_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cvec /* data for distribution in generator object */ + +#define SAMPLE gen->sample.cvec /* pointer to sampling routine */ + +/* generators for conditional distributions */ +#define GEN_CONDI gen->gen_aux_list + +/* an auxiliary generator for standard normal variates */ +#define GEN_NORMAL gen->gen_aux + +/*---------------------------------------------------------------------------*/ + +static UNUR_SAMPLING_ROUTINE_CVEC * +_unur_gibbs_getSAMPLE( struct unur_gen *gen ) +{ + switch (gen->variant & GIBBS_VARMASK_VARIANT) { + case GIBBS_VARIANT_RANDOMDIR: + return _unur_gibbs_randomdir_sample_cvec; + case GIBBS_VARIANT_COORD: + default: + return _unur_gibbs_coord_sample_cvec; + } +} /* end of _unur_gibbs_getSAMPLE() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_gibbs_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CVEC) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CVEC,NULL); + + if (DISTR_IN.logpdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"logPDF"); + return NULL; + } + if (DISTR_IN.dlogpdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"dlogPDF"); + return NULL; + } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_gibbs_par) ); + COOKIE_SET(par,CK_GIBBS_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->c_T = 0.; /* parameter for transformation (-1. <= c < 0.) */ + + par->method = UNUR_METH_GIBBS ; /* method */ + par->variant = GIBBS_VARIANT_COORD; /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + PAR->thinning = 1; /* thinning factor */ + PAR->burnin = 0; /* length of burn-in for chain */ + PAR->x0 = NULL; /* starting point of chain, default is 0 */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_gibbs_init; + + return par; + +} /* end of unur_gibbs_new() */ + +/*****************************************************************************/ + +int +unur_gibbs_set_variant_coordinate( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* Coordinate Sampler : */ + /* Sampling along the coordinate directions (cyclic). */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, GIBBS ); + + /* we use a bit in variant */ + par->variant = (par->variant & ~GIBBS_VARMASK_VARIANT) | GIBBS_VARIANT_COORD; + + /* ok */ + return UNUR_SUCCESS; +} /* end of unur_gibbs_set_variant_coordinate() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_gibbs_set_variant_random_direction( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* Random Direction Sampler : */ + /* Sampling along the random directions. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, GIBBS ); + + /* we use a bit in variant */ + par->variant = (par->variant & ~GIBBS_VARMASK_VARIANT) | GIBBS_VARIANT_RANDOMDIR; + + /* ok */ + return UNUR_SUCCESS; +} /* end of unur_gibbs_set_variant_coordinate() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_gibbs_set_c( struct unur_par *par, double c ) + /*----------------------------------------------------------------------*/ + /* set parameter c for transformation T_c used for sampling from */ + /* conditional distributions */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* c ... parameter c */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, GIBBS ); + + /* check new parameter for generator */ + if (c > 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"c > 0"); + return UNUR_ERR_PAR_SET; + } + /** TODO: ... **/ + /* if (c <= -1.) { */ + /* _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"c <= -1 only if domain is bounded. Use `TABL' method then."); */ + /* return 0; */ + /* } */ + /** TODO: ... **/ + if (c < -0.5) { + _unur_error(GENTYPE,UNUR_ERR_PAR_SET,"c < -0.5 not implemented yet"); + return UNUR_ERR_PAR_SET; + } + if (!_unur_iszero(c) && c > -0.5) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"-0.5 < c < 0 not recommended. using c = -0.5 instead."); + c = -0.5; + } + + /* store date */ + PAR->c_T = c; + + /* changelog */ + par->set |= GIBBS_SET_C; + + return UNUR_SUCCESS; + +} /* end of unur_gibbs_set_c() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_gibbs_set_startingpoint( struct unur_par *par, const double *x0) + /*----------------------------------------------------------------------*/ + /* set starting point for chain */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* x0 ... starting point of chain */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, GIBBS ); + + /* store data */ + PAR->x0 = x0; + + /* changelog */ + par->set |= GIBBS_SET_X0; + + /* ok */ + return UNUR_SUCCESS; +} /* end of unur_gibbs_set_startingpoint() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_gibbs_set_thinning( struct unur_par *par, int thinning ) + /*----------------------------------------------------------------------*/ + /* set thinning factor for chain */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* thinning ... thinning factor */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, GIBBS ); + + /* check new parameter for generator */ + if (thinning < 1) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"thinning < 1"); + return UNUR_ERR_PAR_SET; + } + + /* store data */ + PAR->thinning = thinning; + + /* changelog */ + par->set |= GIBBS_SET_THINNING; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_gibbs_set_thinning() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_gibbs_set_burnin( struct unur_par *par, int burnin ) + /*----------------------------------------------------------------------*/ + /* set length of burn-in for chain */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* burnin ... length of burn-in */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, GIBBS ); + + /* check new parameter for generator */ + if (burnin < 0) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"burnin < 0"); + return UNUR_ERR_PAR_SET; + } + + /* store data */ + PAR->burnin = burnin; + + /* changelog */ + par->set |= GIBBS_SET_BURNIN; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_gibbs_set_burnin() */ + +/*---------------------------------------------------------------------------*/ + +const double * +unur_gibbs_get_state( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get current state of the Gibbs chain */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to chain ... on success */ + /* NULL ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, NULL ); + if (gen->method != UNUR_METH_GIBBS) { + _unur_error(gen->genid, UNUR_ERR_GEN_INVALID,""); + return NULL; + } + + return GEN->state; +} /* end of unur_gibbs_get_state() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_gibbs_chg_state( struct unur_gen *gen, const double *state ) + /*----------------------------------------------------------------------*/ + /* chg current state of the Gibbs chain */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* state ... new state of chain */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, GIBBS, UNUR_ERR_GEN_INVALID ); + _unur_check_NULL( gen->genid, state, UNUR_ERR_NULL ); + + /* copy state */ + memcpy( GEN->state, state, GEN->dim * sizeof(double)); + + return UNUR_SUCCESS; +} /* end of unur_gibbs_chg_state() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_gibbs_reset_state( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* reset current state of the Gibbs chain to starting point */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, GIBBS, UNUR_ERR_GEN_INVALID ); + + /* copy state */ + memcpy( GEN->state, GEN->x0, GEN->dim * sizeof(double)); + + if (gen->variant & GIBBS_VARIANT_COORD) + GEN->coord = (GEN->dim)-1; + + return UNUR_SUCCESS; +} /* end of unur_gibbs_reset_state() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_gibbs_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + _unur_check_NULL( GENTYPE,par,NULL ); + + /* check input */ + if ( par->method != UNUR_METH_GIBBS ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_GIBBS_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_gibbs_create(par); + _unur_par_free(par); + if (!gen) return NULL; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_gibbs_debug_init_start(gen); +#endif + + /* make generators for conditional distributions */ + switch (gen->variant & GIBBS_VARMASK_VARIANT) { + case GIBBS_VARIANT_COORD: /* --- coordinate direction sampling --- */ + if (_unur_gibbs_coord_init(gen)!=UNUR_SUCCESS) { + _unur_gibbs_free(gen); return NULL; + } + break; + case GIBBS_VARIANT_RANDOMDIR: /* --- random direction sampling --- */ + if (_unur_gibbs_randomdir_init(gen)!=UNUR_SUCCESS) { + _unur_gibbs_free(gen); return NULL; + } + break; + default: + _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + _unur_gibbs_free(gen); return NULL; + } + +#ifdef UNUR_ENABLE_LOGGING + if (gen->debug) _unur_gibbs_debug_init_condi(gen); +#endif + + /* run burn-in */ + if (GEN->burnin > 0 ) { + int thinning, burnin; + double *X; + + /* allocate memory for random vector */ + X = _unur_xmalloc( GEN->dim * sizeof(double) ); + + /* store thinning factor; we use 1 for burn-in */ + thinning = GEN->thinning; + GEN->thinning = 1; + + for (burnin = GEN->burnin; burnin>0; --burnin) { + if ( _unur_sample_vec(gen,X) != UNUR_SUCCESS ) { +#ifdef UNUR_ENABLE_LOGGING + _unur_gibbs_debug_burnin_failed(gen); + if (gen->debug) _unur_gibbs_debug_init_finished(gen,FALSE); +#endif + _unur_gibbs_free(gen); free (X); return NULL; + } + } + + /* restore thinning factor */ + GEN->thinning = thinning; + /* free memory for random vector */ + free (X); + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_gibbs_debug_init_finished(gen,TRUE); +#endif + + /* o.k. */ + return gen; + +} /* end of _unur_gibbs_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_gibbs_coord_init( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize new generator for coordinate sampler */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par_condi; + struct unur_gen *gen_condi; + int i; + int errorcode = UNUR_SUCCESS; + + /* conditional distribution object */ + GEN->distr_condi = unur_distr_condi_new( gen->distr, GEN->state, NULL, 0); + + for (i=0; idim; i++) { + + if ( (errorcode=unur_distr_condi_set_condition(GEN->distr_condi,GEN->state,NULL,i)) + != UNUR_SUCCESS ) + break; + + /* make parameter object */ + switch( gen->variant & GIBBS_VARMASK_T ) { + case GIBBS_VAR_T_LOG: + /* use more robust method ARS for T = log */ + par_condi = unur_ars_new(GEN->distr_condi); + unur_ars_set_reinit_percentiles(par_condi,2,NULL); + break; + + case GIBBS_VAR_T_SQRT: + /* we only have method TDR for T = -1/sqrt */ + par_condi = unur_tdr_new(GEN->distr_condi); + unur_tdr_set_reinit_percentiles(par_condi,2,NULL); + unur_tdr_set_c(par_condi,-0.5); + unur_tdr_set_usedars(par_condi,FALSE); + unur_tdr_set_variant_gw(par_condi); + break; + + case GIBBS_VAR_T_POW: + default: + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + } + + /* we do not need a private copy since otherwise we cannot update the generator object */ + unur_set_use_distr_privatecopy( par_condi, FALSE ); + /* debugging messages from the conditional generator should be rare */ + /* otherwise the size if the LOG file explodes */ + unur_set_debug( par_condi, (gen->debug&GIBBS_DEBUG_CONDI)?gen->debug:(gen->debug?1u:0u)); + + /* we use the same URNG for all auxiliary generators */ + unur_set_urng( par_condi, gen->urng ); + + /* init generator object for sampling from conditional distributions */ + gen_condi = unur_init(par_condi); + + if (gen_condi == NULL) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, + "Cannot create generator for conditional distributions"); +#ifdef UNUR_ENABLE_LOGGING + if (gen->debug) _unur_gibbs_debug_init_finished(gen,FALSE); +#endif + errorcode = UNUR_ERR_GEN_CONDITION; + break; + } + + /* store pointer to generator of conditional distribution */ + GEN_CONDI[i] = gen_condi; + + if (i==0 && DISTR.domainrect==NULL) { + /* when the domain is not bounded by a rectangle we only */ + /* need a clone for each dimension (except the first one) */ + for (i=1; idim; i++) + GEN_CONDI[i] = unur_gen_clone(gen_condi); + break; + } + } + + return errorcode; +} /* end of _unur_gibbs_coord_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_gibbs_randomdir_init( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize new generator for random direction sampler */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par_condi; + struct unur_gen *gen_condi; + + /* we need an auxiliary generator for normal random variates */ + GEN_NORMAL = _unur_gibbs_normalgen( gen ); + if ( GEN_NORMAL == NULL ) return UNUR_FAILURE; + + /* conditional distribution object */ + _unur_gibbs_random_unitvector( gen, GEN->direction ); + GEN->distr_condi = unur_distr_condi_new( gen->distr, GEN->state, GEN->direction, 0); + + /* make parameter object */ + switch( gen->variant & GIBBS_VARMASK_T ) { + case GIBBS_VAR_T_LOG: + /* use more robust method ARS for T = log */ + par_condi = unur_ars_new(GEN->distr_condi); + unur_ars_set_reinit_percentiles(par_condi,2,NULL); + break; + + case GIBBS_VAR_T_SQRT: + /* we only have method TDR for T = -1/sqrt */ + par_condi = unur_tdr_new(GEN->distr_condi); + unur_tdr_set_reinit_percentiles(par_condi,2,NULL); + unur_tdr_set_c(par_condi,-0.5); + unur_tdr_set_usedars(par_condi,FALSE); + break; + + case GIBBS_VAR_T_POW: + default: + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + } + + /* we do not need a private copy since otherwise we cannot update the generator object */ + unur_set_use_distr_privatecopy( par_condi, FALSE ); + /* debugging messages from the conditional generator should be rare */ + /* otherwise the size if the LOG file explodes */ + unur_set_debug( par_condi, (gen->debug&GIBBS_DEBUG_CONDI)?gen->debug:(gen->debug?1u:0u)); + + /* we use the same URNG for all auxiliary generators */ + unur_set_urng( par_condi, gen->urng ); + + /* init generator object for sampling from conditional distributions */ + gen_condi = unur_init(par_condi); + + if (gen_condi == NULL) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, + "Cannot create generator for conditional distributions"); +#ifdef UNUR_ENABLE_LOGGING + if (gen->debug) _unur_gibbs_debug_init_finished(gen,FALSE); +#endif + return UNUR_ERR_GEN_CONDITION; + } + + /* store generator in structure. we only need one such generator */ + *GEN_CONDI = gen_condi; + + return UNUR_SUCCESS; +} /* end of _unur_gibbs_randomdir_init() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_gibbs_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + int i; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_GIBBS_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_gibbs_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_GIBBS_GEN); + + /* dimension of distribution */ + GEN->dim = gen->distr->dim; + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* which transformation for conditional distributions */ + if ( _unur_iszero(PAR->c_T) ) + par->variant = (par->variant & (~GIBBS_VARMASK_T)) | GIBBS_VAR_T_LOG; + else if (_unur_FP_same(PAR->c_T, -0.5)) + par->variant = (par->variant & (~GIBBS_VARMASK_T)) | GIBBS_VAR_T_SQRT; + else + par->variant = (par->variant & (~GIBBS_VARMASK_T)) | GIBBS_VAR_T_POW; + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_gibbs_getSAMPLE(gen); + gen->destroy = _unur_gibbs_free; + gen->clone = _unur_gibbs_clone; + + /* variant of sampling method */ + gen->variant = par->variant; + + /* copy parameters into generator object */ + GEN->thinning = PAR->thinning; /* thinning factor */ + GEN->burnin = PAR->burnin; /* length of burnin */ + GEN->c_T = PAR->c_T; /* parameter for transformation */ + + /* allocate memory for state */ + GEN->state = _unur_xmalloc( GEN->dim * sizeof(double)); + GEN->x0 = _unur_xmalloc( GEN->dim * sizeof(double)); + if (PAR->x0 == NULL) + PAR->x0 = unur_distr_cvec_get_center(gen->distr); + memcpy( GEN->state, PAR->x0, GEN->dim * sizeof(double)); + memcpy( GEN->x0, PAR->x0, GEN->dim * sizeof(double)); + + /* generator(s) for conditional distributions */ + GEN->distr_condi = NULL; + GEN_CONDI = _unur_xmalloc( GEN->dim * sizeof(struct unur_gen *) ); + gen->n_gen_aux_list = GEN->dim; /* size of array GEN_CONDI */ + for (i=0; idim; i++) GEN_CONDI[i] = NULL; + + /* allocate memory for random direction */ + GEN->direction = _unur_xmalloc( GEN->dim * sizeof(double)); + + /* defaults */ + GEN->coord = (GEN->dim)-1; /* current coordinate of GIBBS chain. + we want to start with coordinate 0. */ + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_gibbs_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_gibbs_create() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_gibbs_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_gibbs_gen*)clone->datap) +#define CLONE_CONDI clone->gen_aux_list + + int i; + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_GIBBS_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* copy state */ + CLONE->state = _unur_xmalloc( GEN->dim * sizeof(double)); + memcpy( CLONE->state, GEN->state, GEN->dim * sizeof(double)); + CLONE->x0 = _unur_xmalloc( GEN->dim * sizeof(double)); + memcpy( CLONE->x0, GEN->x0, GEN->dim * sizeof(double)); + + /* copy generators for conditional distributions */ + if (GEN->distr_condi) CLONE->distr_condi = _unur_distr_clone( GEN->distr_condi ); + + /* GEN_CONDI is cloned by _unur_generic_clone */ + /* however, these use a pointer to GEN->distr which must be updated, too */ + if (CLONE_CONDI) { + for (i=0; idim; i++) + if (CLONE_CONDI[i]) + CLONE_CONDI[i]->distr = CLONE->distr_condi; + } + + /* allocate memory for random direction */ + CLONE->direction = _unur_xmalloc( GEN->dim * sizeof(double)); + + return clone; + +#undef CLONE +#undef CLONE_CONDI +} /* end of _unur_gibbs_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_gibbs_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_GIBBS ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_GIBBS_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free vectors */ + if (GEN->state) free (GEN->state); + if (GEN->x0) free (GEN->x0); + if (GEN->direction) free (GEN->direction); + + /* free conditional distribution object */ + if (GEN->distr_condi) _unur_distr_free (GEN->distr_condi); + + /* GEN_CONDI is freed by _unur_generic_free */ + + _unur_generic_free(gen); + +} /* end of _unur_gibbs_free() */ + +/*****************************************************************************/ + +int +_unur_gibbs_coord_sample_cvec( struct unur_gen *gen, double *vec ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* vec ... random vector (result) */ + /*----------------------------------------------------------------------*/ +{ + double X; + int thinning; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_GIBBS_GEN,UNUR_ERR_COOKIE); + + for (thinning = GEN->thinning; thinning > 0; --thinning) { + + /* update coordinate direction */ + GEN->coord = (GEN->coord + 1) % GEN->dim; + + /* check state of chain */ + if (!_unur_isfinite(GEN->state[GEN->coord])) + /* there has been a fatal error during the last sampling from + the conditional distribution. This probably has been caused + by improper target distribution for which the method + does not work (i.e., it is not T-concave). + */ + continue; + + /* update conditional distribution */ + unur_distr_condi_set_condition( GEN->distr_condi, GEN->state, NULL, GEN->coord); + + /* reinit generator object */ + if (unur_reinit(GEN_CONDI[GEN->coord]) == UNUR_SUCCESS) { + + /* sample from distribution */ + X = unur_sample_cont(GEN_CONDI[GEN->coord]); + + if (_unur_isfinite(X)) { + /* update state */ + GEN->state[GEN->coord] = X; + continue; + } + } + + /* ERROR: reset to starting point */ + _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING,"reset chain"); + unur_gibbs_reset_state(gen); + return UNUR_FAILURE; + + } + + /* copy current state into given vector */ + memcpy(vec, GEN->state, GEN->dim * sizeof(double)); + + return UNUR_SUCCESS; + +} /* end of _unur_gibbs_coord_sample_cvec() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_gibbs_randomdir_sample_cvec( struct unur_gen *gen, double *vec ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* vec ... random vector (result) */ + /*----------------------------------------------------------------------*/ +{ + int i; + double X; + int thinning; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_GIBBS_GEN,UNUR_ERR_COOKIE); + + for (thinning = GEN->thinning; thinning > 0; --thinning) { + + /* check state of chain */ + if (!_unur_isfinite(GEN->state[0])) + /* there has been a fatal error during the last sampling from + the conditional distribution. This probably has been caused + by improper target distribution for which the method + does not work (i.e., it is not T-concave). + */ + break; + + /* new random direction */ + _unur_gibbs_random_unitvector( gen, GEN->direction ); + + /* update conditional distribution */ + unur_distr_condi_set_condition( GEN->distr_condi, GEN->state, GEN->direction, 0); + + /* reinit generator object */ + if (unur_reinit(*GEN_CONDI) == UNUR_SUCCESS) { + + /* sample from distribution */ + X = unur_sample_cont(*GEN_CONDI); + + if (_unur_isfinite(X)) { + /* update state */ + for (i=0; idim; i++) + GEN->state[i] += X * GEN->direction[i]; + continue; + } + } + + /* ERROR: reset to starting point */ + _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING,"reset chain"); + unur_gibbs_reset_state(gen); + return UNUR_FAILURE; + + } + + /* copy current state into given vector */ + memcpy(vec, GEN->state, GEN->dim * sizeof(double)); + + return UNUR_SUCCESS; + +} /* end of _unur_gibbs_randomdir_sample_cvec() */ + + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_gibbs_normalgen( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* create a normal random variate generator */ + /* */ + /* parameters: */ + /* gen ... pointer to GIBBS generator object */ + /* */ + /* */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *normalgen; + struct unur_distr *normaldistr = unur_distr_normal(NULL,0); + struct unur_par *normalpar = unur_arou_new( normaldistr ); + + unur_arou_set_usedars( normalpar, TRUE ); + normalgen = unur_init( normalpar ); + _unur_distr_free( normaldistr ); + if (normalgen == NULL) { + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN, + "Cannot create aux Gaussian generator"); + return NULL; + } + + /* uniform random number generator and debugging flags */ + normalgen->urng = gen->urng; + normalgen->debug = gen->debug; + + return normalgen; + +} /* end of _unur_gibbs_normalgen() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_gibbs_random_unitvector( struct unur_gen *gen, double *direction ) + /*----------------------------------------------------------------------*/ + /* generate a random direction vector */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* direction ... random vector (result) */ + /*----------------------------------------------------------------------*/ +{ + int i; + + do { + for (i=0; idim; i++) + direction[i] = unur_sample_cont(GEN_NORMAL); + /* normalize direction vector */ + _unur_vector_normalize(GEN->dim, direction); + + /* there is an extremely small change that direction is the null before + normalizing. In this case non of its coordinates are finite. */ + } while (!_unur_isfinite(direction[0])); + +} /* end of _unur_gibbs_random_unitvector() */ + + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_gibbs_debug_init_start( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_GIBBS_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous multivariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = GIBBS (Markov Chain - GIBBS sampler)\n",gen->genid); + fprintf(LOG,"%s: variant = ",gen->genid); + switch (gen->variant & GIBBS_VARMASK_VARIANT) { + case GIBBS_VARIANT_COORD: + fprintf(LOG,"coordinate sampling (original Gibbs sampler) [default]\n"); break; + case GIBBS_VARIANT_RANDOMDIR: + fprintf(LOG,"random directions\n"); break; + } + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: transformation T_c(x) for TDR method = ",gen->genid); + switch( gen->variant & GIBBS_VARMASK_T ) { + case GIBBS_VAR_T_LOG: + fprintf(LOG,"log(x) ... c = 0"); break; + case GIBBS_VAR_T_SQRT: + fprintf(LOG,"-1/sqrt(x) ... c = -1/2"); break; + case GIBBS_VAR_T_POW: + fprintf(LOG,"-x^(%g) ... c = %g",GEN->c_T,GEN->c_T); break; + } + _unur_print_if_default(gen,GIBBS_SET_C); + fprintf(LOG,"\n%s:\n",gen->genid); + + _unur_distr_cvec_debug( gen->distr, gen->genid ); + + switch (gen->variant & GIBBS_VARMASK_VARIANT) { + case GIBBS_VARIANT_COORD: + fprintf(LOG,"%s: sampling routine = _unur_gibbs_coord_sample()\n",gen->genid); + break; + case GIBBS_VARIANT_RANDOMDIR: + fprintf(LOG,"%s: sampling routine = _unur_gibbs_randomdir_sample()\n",gen->genid); + break; + } + + fprintf(LOG,"%s: thinning = %d",gen->genid,GEN->thinning); + _unur_print_if_default(gen,GIBBS_SET_THINNING); + fprintf(LOG,"\n%s: burn-in = %d",gen->genid,GEN->burnin); + _unur_print_if_default(gen,GIBBS_SET_BURNIN); + fprintf(LOG,"\n%s:\n",gen->genid); + _unur_matrix_print_vector( GEN->dim, GEN->x0, "starting point = ", LOG, gen->genid, "\t "); + + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_gibbs_debug_init_start() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_gibbs_debug_init_finished( const struct unur_gen *gen, int success ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* success ... whether init has failed or not */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_GIBBS_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + if (success) + fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); + else + fprintf(LOG,"%s: INIT failed **********************\n",gen->genid); + +} /* end of _unur_gibbs_debug_init_finished() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_gibbs_debug_burnin_failed( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info after burnin has failed */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_GIBBS_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: Burn-in failed --> INIT failed **********************\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_gibbs_debug_burnin_failed() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_gibbs_debug_init_condi( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write list of conditional generators into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + int i; + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_GIBBS_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + switch (gen->variant & GIBBS_VARMASK_VARIANT) { + case GIBBS_VARIANT_COORD: + fprintf(LOG,"%s: generators for full conditional distributions = \n",gen->genid); + fprintf(LOG,"%s:\t",gen->genid); + for (i=0; idim; i++) + fprintf(LOG,"[%s] ", GEN_CONDI[i]->genid); + fprintf(LOG,"\n%s:\n",gen->genid); + break; + case GIBBS_VARIANT_RANDOMDIR: + fprintf(LOG,"%s: generators for full conditional distributions = [%s]\n",gen->genid, + GEN_CONDI[0]->genid); + fprintf(LOG,"%s: generator for random directions = [%s]\n",gen->genid, + GEN_NORMAL->genid); + fprintf(LOG,"%s:\n",gen->genid); + break; + } + +} /* end of _unur_gibbs_debug_init_condi() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_gibbs_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + int samplesize = 10000; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," dimension = %d\n",GEN->dim); + _unur_string_append(info," functions = PDF dPDF\n"); + _unur_distr_cvec_info_domain(gen); + _unur_string_append(info," center = "); + _unur_distr_info_vector( gen, unur_distr_cvec_get_center(gen->distr), GEN->dim); + if ( !(distr->set & UNUR_DISTR_SET_CENTER) ) { + if ( distr->set & UNUR_DISTR_SET_MODE ) + _unur_string_append(info," [= mode]"); + else + _unur_string_append(info," [default]"); + } + _unur_string_append(info,"\n\n"); + + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + + /* method */ + _unur_string_append(info,"method: GIBBS (GIBBS sampler [MCMC])\n"); + _unur_string_append(info," variant = %s\n", + ((gen->variant & GIBBS_VARMASK_VARIANT)==GIBBS_VARIANT_COORD) + ? "coordinate sampling [default]" : "random direction sampling"); + + /* used transformation */ + _unur_string_append(info," T_c(x) = "); + switch( gen->variant & GIBBS_VARMASK_T ) { + case GIBBS_VAR_T_LOG: + _unur_string_append(info,"log(x) ... c = 0\n"); break; + case GIBBS_VAR_T_SQRT: + _unur_string_append(info,"-1/sqrt(x) ... c = -1/2\n"); break; + case GIBBS_VAR_T_POW: + _unur_string_append(info,"-x^(%g) ... c = %g\n",GEN->c_T,GEN->c_T); break; + } + + _unur_string_append(info," thinning = %d\n", GEN->thinning); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," rejection constant = %.2f [approx.]\n", + unur_test_count_urn(gen,samplesize,0,NULL)/(2.*samplesize)); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + + switch (gen->variant & GIBBS_VARMASK_VARIANT) { + case GIBBS_VARIANT_COORD: + _unur_string_append(info," variant_coordinate [default]\n"); break; + case GIBBS_VARIANT_RANDOMDIR: + _unur_string_append(info," variant_random_direction\n"); break; + } + + _unur_string_append(info," c = %g %s\n", GEN->c_T, + (gen->set & GIBBS_SET_C) ? "" : "[default]"); + _unur_string_append(info," thinning = %d %s\n", GEN->thinning, + (gen->set & GIBBS_SET_THINNING) ? "" : "[default]"); + _unur_string_append(info," burnin = %d %s\n", GEN->burnin, + (gen->set & GIBBS_SET_THINNING) ? "" : "[default]"); + + _unur_string_append(info,"\n"); + + /* Not displayed: + int unur_gibbs_set_startingpoint( UNUR_PAR *parameters, const double *x0 ); + */ + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_gibbs_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/gibbs.h b/vendor/unuran-1.11.0/src/methods/gibbs.h new file mode 100644 index 0000000..d5eff95 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/gibbs.h @@ -0,0 +1,277 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: gibbs.h * + * * + * PURPOSE: * + * function prototypes for method GIBBS * + * (Markov Chain - GIBBS sampler) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD GIBBS Markov Chain - GIBBS sampler + + =UP MCMC_Methods_for_CVEC + + =REQUIRED T-concave logPDF, derivatives of logPDF + + =SPEED Set-up: fast, Sampling: moderate + + =REINIT not implemented + + =REF [HLD04: Sect.14.1.2] + + =DESCRIPTION + Method GIBBS implements a Gibbs sampler for a multivariate + distribution with given joint density and its gradient. + When running such a Markov chain all coordinates are updated + cyclically using full conditional distributions. After each step + the state of the chain is returned (i.e., a random point is + returned whenever a single coordinate has been updated). + It is also possible to return only points after all coordinates + have been updated by "thinning" the chain. + Moreover, to reduce autocorrelation this thinning factor can be + any integer. Notice, however, that the sampling time for a chain + of given length is increased by the same factor, too. + + GIBBS also provides a variant of the Gibbs sampler where in + each step a point from the full conditional distribution along + some random direction is sampled. This direction is chosen + uniformly from the sphere in each step. + This method is also known as Hit-and-Run algorithm for + non-uniform distributions. + + Our experiences shows that the original Gibbs sampler with + sampling along coordinate axes is superior to random direction + sampling as long as the correlations between the components of + the random vector are not too high. + + For both variants transformed density rejection (see methods + @pxref{TDR} and @pxref{ARS}) is used to + sample from the full conditional distributions. In opposition to + the univariate case, it is important that the factor @code{c} is + as large as possible. I.e., for a log-concave density @code{c} + must be set to @code{0.}, since otherwise numerical underflow + might stop the algorithm. + + @emph{Important:} GIBBS does not generate independent random + points. The starting point of the Gibbs chain must be in a + "typical" region of the target distribution. If such a point is + not known or would be too expensive, then the first part of the + chain should be discarded (burn-in of the chain). + + =HOWTOUSE + For using the GIBBS method UNU.RAN needs the logarithm of the + PDF of the multivariate joint distribution and its gradient or + partial derivatives. + + It provides two variants: + @table @emph + @item coordinate direction sampling (Gibbs sampling) [default] + The coordinates are updated cyclically. + It requires the partial derivatives of the (logarithm of the) + PDF of the target distribution, + see unur_distr_cvec_set_pdlogpdf(). + Otherwise, the gradient of the logPDF + (see unur_distr_cvec_set_dlogpdf()) + is used, which is more expensive. + + This variant can be selected using + unur_gibbs_set_variant_coordinate(). + + @item random direction sampling (nonuniform Hit-and-Run algorithm) + In each step is a direction is sampled uniformly from the sphere + and the next point in the chain is sampled from the full + conditional distribution along this direction. + + It requires the gradient of the logPDF and thus each step is + more expensive than each step for coordinate direction sampling. + + This variant can be selected using + unur_gibbs_set_variant_random_direction(). + @end table + + It is important that the @code{c} parameter for the TDR method + is as large as possible. For logconcave distribution it must be + set to @code{0}, since otherwise numerical underflow can cause + the algorithm to stop. + + The starting point of the Gibbs chain must be "typical" for the + target distribution. If such a point is not known or would be + too expensive, then the first part of the chain should be + discarded (burn-in of the chain). When using the + unur_gibbs_set_burnin() call this is done during the setup + of the Gibbs sampler object. + + In case of a fatal error in the generator for conditional + distributions the methods generates points that contain + UNUR_INFINITY. + + @strong{Warning:} The algorithm requires that all full + conditionals for the given distribution object are + @i{T}-concave. However, this property is not checked. + If this property is not satisfied, then generation from the + conditional distributions becomes (very) slow and might fail or + (even worse) produces random vectors from an incorrect + distribution. + When using unur_gibbs_set_burnin() then the setup already + might fail. Thus when in doubt whether GIBBS can be used for + the targent distribution it is a good idea to use a burn-in for + checking. + + @emph{Remark:} It might happen (very rarely) that the chain + becomes stuck due to numerical errors. (This is in particular the + case when the given PDF does not fulfill the condition of this + method.) + When this happens during burn-in then the setup is aborted + (i.e. it fails). Otherwise the chain restarts again from its + starting point. + + @strong{Warning:} Be carefull with debugging flags. If it + contains flag @code{0x01000000u} it produces a lot of output for + each step in the algorithm. + (This flag is switched of in the default debugging flags). + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_gibbs_new( const UNUR_DISTR *distribution ); + +/*...........................................................................*/ + +int unur_gibbs_set_variant_coordinate( UNUR_PAR *parameters ); +/* + Coordinate Direction Sampling: + Sampling along the coordinate directions (cyclic). + + This is the default. +*/ + +int unur_gibbs_set_variant_random_direction( UNUR_PAR *parameters ); +/* + Random Direction Sampling: + Sampling along the random directions. +*/ + +int unur_gibbs_set_c( UNUR_PAR *parameters, double c ); +/* + Set parameter @var{c} for transformation @unurmath{T} of the + transformed density rejection method. + Currently only values between @code{0} and @code{-0.5} are + allowed. If @code{c} is between @code{0} and @code{-0.5} it is set + to @code{-0.5}. + + For @var{c} @code{=0} (for logconcave densities) method ARS + (@pxref{ARS}) is used which is very robust against badly + normalized PDFs. For other values method TDR (@pxref{TDR}) is used. + + The value for @var{c} should be as large as possible to avoid + fatal numerical underflows. Thus for log-concave distributions + @var{c} must be set to @code{0.} + + Default is @code{0}. +*/ + + +int unur_gibbs_set_startingpoint( UNUR_PAR *parameters, const double *x0 ); +/* + Sets the starting point of the Gibbs sampler. @var{x0} must be + a "typical" point of the given distribution. + If such a "typical" point is not known and a starting point is + merely guessed, the first part of the Gibbs chain should be + discarded (@emph{burn-in}), e.g.\ by mean of the + unur_gibbs_set_burnin() call. + + Default is the result of unur_distr_cvec_get_center() for the + given distribution object. +*/ + +int unur_gibbs_set_thinning( UNUR_PAR *parameters, int thinning ); +/* + Sets the @var{thinning} parameter. When @var{thinning} is set to + @i{k} then every @i{k}-th point from the iteration is returned by + the sampling algorithm. + + @emph{Notice}: This parameter must satisfy @var{thinning}>=1. + + Default: @code{1}. +*/ + +int unur_gibbs_set_burnin( UNUR_PAR *parameters, int burnin ); +/* + If a "typical" point for the target distribution is not known but + merely guessed, the first part of the Gibbs chain should be + discarded (@emph{burn-in}). This can be done during the + initialization of the generator object. + The length of the burn-in can is then @var{burnin}. + + When method GIBBS is not applicable for the target distribution + then the initialization already might fail during the burn-in. + Thus this reduces the risk of running a generator that returns + UNUR_INFINITY cased by some fatal error during sampling. + + The thinning factor set by a unur_gibbs_set_thinning() call has + no effect on the length of the burn-in, i.e., for the burn-in + always a thinning factor @code{1} is used. + + @emph{Notice}: This parameter must satisfy @var{thinning}>=0. + + Default: @code{0}. +*/ + +/*...........................................................................*/ + +const double *unur_gibbs_get_state( UNUR_GEN *generator ); +/* */ + +int unur_gibbs_chg_state( UNUR_GEN *generator, const double *state ); +/* + Get and change the current state of the Gibbs chain. +*/ + +int unur_gibbs_reset_state( UNUR_GEN *generator ); +/* + Reset state of chain to starting point. + + @emph{Notice:} Currently this function does not reset + the generators for conditional distributions. Thus it is not + possible to get the same Gibbs chain even when the underlying + uniform random number generator is reset. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ + + diff --git a/vendor/unuran-1.11.0/src/methods/gibbs_struct.h b/vendor/unuran-1.11.0/src/methods/gibbs_struct.h new file mode 100644 index 0000000..e30859d --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/gibbs_struct.h @@ -0,0 +1,65 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: gibbs_struct.h * + * * + * PURPOSE: * + * declares structures for method GIBBS * + * (Markov Chain - GIBBS sampler) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_gibbs_par { + int thinning; /* thinning factor for generated chain */ + int burnin; /* length of burn-in for chain */ + double c_T; /* parameter c for transformation T_c */ + const double *x0; /* starting point of chain */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_gibbs_gen { + int dim; /* dimension of distribution */ + int thinning; /* thinning factor for generated chain */ + double c_T; /* parameter c for transformation T_c */ + + double *state; /* state of chain / current point */ + + struct unur_distr *distr_condi; /* conditional distribution */ + + int coord; /* current coordinate used for GIBBS chain */ + double *direction; /* working array for random direction */ + + int burnin; /* length of burn-in for chain */ + double *x0; /* starting point of chain */ +}; + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/methods/hinv.c b/vendor/unuran-1.11.0/src/methods/hinv.c new file mode 100644 index 0000000..655a602 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/hinv.c @@ -0,0 +1,2118 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: hinv.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: Hermite interpolation based INVersion of CDF * + * * + * DESCRIPTION: * + * * + * REQUIRED: * + * pointer to the CDF * + * * + * OPTIONAL: * + * pointer to PDF and dPDF * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] W. Hrmann and J. Leydold: * + * Continuous Random Variate Generation by Fast Numerical Inversion, * + * ACM Trans. Model. Comput. Simul. 13(4), pp. 347-362 (2003) * + * * + * [2] W. Hrmann, J. Leydold, and G. Derflinger: * + * Automatic Nonuniform Random Variate Generation, * + * Springer-Verlag, Berlin Heidelberg (2004) * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "hinv.h" +#include "hinv_struct.h" + +/*---------------------------------------------------------------------------*/ +/* Constants */ + +#define HINV_MAX_ITER (300) +/* Maximal number of iterations for finding the boundary of the */ +/* computational interval, i.e. where CDF(x) is close to 0 and 1, resp. */ + +#define HINV_MAX_U_LENGTH (0.05) +/* Maximal value for |u_i - u_{i-1}|. If for an interval this value is */ +/* larger then it is splitted (independently of its u-error). */ + +#define HINV_TAILCUTOFF_FACTOR (0.1) +#define HINV_TAILCUTOFF_MIN (1.e-10) +/* For unbounded domains the tails has to be cut off. We use the given */ +/* u-resolution for finding the cut points. (The probability for each of the */ +/* chopped regions should be less than */ +/* HINV_TAILCUTOFF_FACTOR * u-resolution.) */ +/* However, it should not be greater than some threshold value, given by */ +/* HINV_TAILCUTOFF_MIN which reflects the precision of the used stream of */ +/* uniform pseudo-random numbers (typically about 2^32). */ +/* However, for computational reasons we use a value that is at least twice */ +/* the machine epsilon for the right hand boundary. */ + +#define HINV_UERROR_CORRECTION (1.-HINV_TAILCUTOFF_FACTOR) +/* HINV tries to create an approximation of the inverse CDF where the */ +/* U-error is bounded by the given u-resolution. However, the error caused */ +/* by cutting off the tails introduces some additional errors which must be */ +/* corrected. Thus the upper bound for the pure approximation error by */ +/* Hermite interpolation is set to HINV_UERROR_CORRECTION * u-resolution */ +/* The correction factor should not exceed (1-HINV_TAILCUTOFF_FACTOR). */ + +#define HINV_XDEVIATION (0.05) +/* Used for splitting intervals. When the u-error is estimated for an */ +/* interval then the CDF is evaluated in the approximate center of the */ +/* u-interval. This could be used as splitting point of the interval. */ +/* However, this might result in slow convergence. A much more stable */ +/* point is the center of the x-interval. However, this requires an */ +/* additional evalution of the CDF. */ +/* Thus we use the following rule: If CDF(approx. center of u-int) is */ +/* close to the center of the x-interval use the first, otherwise use the */ +/* latter. HINV_XDEVIATION is the threshold value for relative distance */ +/* between these two points. */ +/* As a rule-of-thumb larger values of HINV_XDEVIATION result in more */ +/* intervals but less evaluations of the CDF (until there are too many */ +/* intervals). */ + +/*---------------------------------------------------------------------------*/ +/* Variants: none */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define HINV_DEBUG_REINIT 0x00000002u /* print parameters after reinit */ +#define HINV_DEBUG_TABLE 0x00000010u /* print table */ +#define HINV_DEBUG_CHG 0x00001000u /* print changed parameters */ +#define HINV_DEBUG_SAMPLE 0x01000000u /* trace sampling */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define HINV_SET_ORDER 0x001u /* order of polynomial */ +#define HINV_SET_U_RESOLUTION 0x002u /* maximal error in u */ +#define HINV_SET_STP 0x004u /* starting design points */ +#define HINV_SET_BOUNDARY 0x008u /* boundary of computational region */ +#define HINV_SET_GUIDEFACTOR 0x010u /* relative size of guide table */ +#define HINV_SET_MAX_IVS 0x020u /* maximal number of intervals */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "HINV" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_hinv_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_hinv_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_hinv_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_hinv_check_par( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_hinv_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hinv_free( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_hinv_sample( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static double _unur_hinv_eval_approxinvcdf( const struct unur_gen *gen, double u ); +/*---------------------------------------------------------------------------*/ +/* evaluate Hermite interpolation of inverse CDF at u. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_hinv_find_boundary( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* find boundary of computational interval */ +/*---------------------------------------------------------------------------*/ + +static int _unur_hinv_create_table( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* create the table with splines */ +/*---------------------------------------------------------------------------*/ + +static struct unur_hinv_interval *_unur_hinv_interval_new( struct unur_gen *gen, double p, double u ); +/*---------------------------------------------------------------------------*/ +/* make a new interval with node (u=F(p),p). */ +/*---------------------------------------------------------------------------*/ + +static struct unur_hinv_interval *_unur_hinv_interval_adapt( struct unur_gen *gen, + struct unur_hinv_interval *iv, + int *error_count_shortinterval ); +/*---------------------------------------------------------------------------*/ +/* check parameters in interval and split or truncate where necessary. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_hinv_interval_is_monotone( struct unur_gen *gen, struct unur_hinv_interval *iv ); +/*---------------------------------------------------------------------------*/ +/* check whether the given interval is monotone. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_hinv_interval_parameter( struct unur_gen *gen, struct unur_hinv_interval *iv ); +/*---------------------------------------------------------------------------*/ +/* compute all parameter for interval (spline coefficients). */ +/*---------------------------------------------------------------------------*/ + +static double _unur_hinv_eval_polynomial( double x, double *coeff, int order ); +/*---------------------------------------------------------------------------*/ +/* evaluate polynomial. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_hinv_list_to_array( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy list of intervals into double array. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_hinv_make_guide_table( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* make a guide table for indexed search. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_hinv_CDF( const struct unur_gen *gen, double x ); +/*---------------------------------------------------------------------------*/ +/* compute CDF of truncated distribution. */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hinv_debug_init( const struct unur_gen *gen, int ok); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hinv_debug_intervals( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print starting points or table for algorithms into LOG file. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hinv_debug_chg_truncated( const struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* trace changes of the truncated domain. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_hinv_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cont /* data for distribution object */ + +#define PAR ((struct unur_hinv_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_hinv_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +/* CDF, PDF, and dPDF are rescaled such that the CDF is a "real" CDF with */ +/* u (range) in (0,1) on the interval (DISTR.domain[0], DISTR.domain[1]). */ +/* call to CDF: */ +#define CDF(x) (_unur_hinv_CDF((gen),(x))) +/* --> ((_unur_cont_CDF((x),(gen->distr))-GEN->CDFmin)/(GEN->CDFmax-GEN->CDFmin)) */ + +/* call to PDF: */ +#define PDF(x) (_unur_cont_PDF((x),(gen->distr))/(GEN->CDFmax-GEN->CDFmin)) + +/* call to derivative of PDF: */ +#define dPDF(x) (_unur_cont_dPDF((x),(gen->distr))/(GEN->CDFmax-GEN->CDFmin)) + +/*---------------------------------------------------------------------------*/ + +#define _unur_hinv_getSAMPLE(gen) (_unur_hinv_sample) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_hinv_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + + if (DISTR_IN.cdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"CDF"); return NULL; } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_hinv_par) ); + COOKIE_SET(par,CK_HINV_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->order = (DISTR_IN.pdf) ? 3 : 1; /* order of polynomial */ + PAR->u_resolution = 1.0e-10; /* maximal error allowed in u-direction */ + PAR->guide_factor = 1.; /* size of guide table / number of intervals */ + PAR->bleft = -1.e20; /* left border of the computational domain */ + PAR->bright = 1.e20; /* right border of the computational domain */ + PAR->max_ivs = 1000000; /* maximal number of intervals */ + PAR->stp = NULL; /* starting nodes */ + PAR->n_stp = 0; /* number of starting nodes */ + + par->method = UNUR_METH_HINV; /* method */ + par->variant = 0u; /* default variant */ + + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_hinv_init; + + return par; + +} /* end of unur_hinv_new() */ + +/*****************************************************************************/ + +int +unur_hinv_set_order( struct unur_par *par, int order) + /*----------------------------------------------------------------------*/ + /* Set order of Hermite interpolation. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* order ... order of interpolation polynome */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HINV ); + + /* check new parameter for generator */ + if (order!=1 && order!=3 && order!=5) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"order"); + return UNUR_ERR_PAR_SET; + } + + if (order > 1 && par->distr->data.cont.pdf == NULL) { + _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); + return UNUR_ERR_DISTR_REQUIRED; + } + + if (order > 3 && par->distr->data.cont.dpdf == NULL) { + _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"dPDF"); + return UNUR_ERR_DISTR_REQUIRED; + } + + /* store date */ + PAR->order = order; + + /* changelog */ + par->set |= HINV_SET_ORDER; + + return UNUR_SUCCESS; + +} /* end of unur_hinv_set_order() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hinv_set_u_resolution( struct unur_par *par, double u_resolution ) + /*----------------------------------------------------------------------*/ + /* set maximal relative error in x */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object*/ + /* u_resolution ... maximal error in u */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HINV ); + + /* check new parameter for generator */ + if (u_resolution > 1.e-2) { + /* this is obviously an error */ + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"u-resolution"); + return UNUR_ERR_PAR_SET; + } + if (u_resolution < 5.*DBL_EPSILON ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"u-resolution"); + u_resolution = 5.*DBL_EPSILON; + } + if (u_resolution < UNUR_EPSILON) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"u-resolution so small that problems may occur"); + } + + /* store date */ + PAR->u_resolution = u_resolution; + + /* changelog */ + par->set |= HINV_SET_U_RESOLUTION; + + return UNUR_SUCCESS; + +} /* end of unur_hinv_set_u_resolutuion() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hinv_set_cpoints( struct unur_par *par, const double *stp, int n_stp ) + /*----------------------------------------------------------------------*/ + /* set starting construction points (nodes) for Hermite interpolation. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* stp ... pointer to array of starting points */ + /* n_stp ... number of starting points */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HINV ); + + /* check starting construction points */ + if (n_stp < 1 || stp==NULL) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of starting points < 1"); + return UNUR_ERR_PAR_SET; + } + + /* starting points must be strictly monontonically increasing */ + for( i=1; istp = stp; + PAR->n_stp = n_stp; + + /* changelog */ + par->set |= HINV_SET_STP; + + return UNUR_SUCCESS; + +} /* end of unur_hinv_set_cpoints() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hinv_set_boundary( struct unur_par *par, double left, double right ) + /*----------------------------------------------------------------------*/ + /* set left and right boundary of computation interval */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* new boundary points must not be +/- UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HINV ); + + /* check new parameter for generator */ + if (left >= right) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"domain"); + return UNUR_ERR_PAR_SET; + } + if (left <= -UNUR_INFINITY || right >= UNUR_INFINITY) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"domain (+/- UNUR_INFINITY not allowed)"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->bleft = left; + PAR->bright = right; + + /* changelog */ + par->set |= HINV_SET_BOUNDARY; + + return UNUR_SUCCESS; + +} /* end of unur_hinv_set_boundary() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hinv_set_guidefactor( struct unur_par *par, double factor ) + /*----------------------------------------------------------------------*/ + /* set factor for relative size of guide table */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* factor ... relative size of table */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HINV ); + + /* check new parameter for generator */ + if (factor < 0) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"guide table size < 0"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->guide_factor = factor; + + /* changelog */ + par->set |= HINV_SET_GUIDEFACTOR; + + return UNUR_SUCCESS; + +} /* end of unur_hinv_set_guidefactor() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hinv_set_max_intervals( struct unur_par *par, int max_ivs ) + /*----------------------------------------------------------------------*/ + /* set maximum number of intervals */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* max_ivs ... maximum number of intervals */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, HINV ); + + /* check new parameter for generator */ + if (max_ivs < 1000 ) { + /* it does not make sense to set this parameter too small */ + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"maximum number of intervals < 1000"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->max_ivs = max_ivs; + + /* changelog */ + par->set |= HINV_SET_MAX_IVS; + + return UNUR_SUCCESS; + +} /* end of unur_hinv_set_max_intervals() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hinv_get_n_intervals( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get number of intervals (or more precisely the number of nodes) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* number of intervals ... on success */ + /* 0 ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, 0 ); + _unur_check_gen_object( gen, HINV, 0 ); + return GEN->N; +} /* end of unur_hinv_get_n_intervals() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hinv_chg_truncated( struct unur_gen *gen, double left, double right ) + /*----------------------------------------------------------------------*/ + /* change the left and right borders of the domain of the distribution */ + /* the new domain should not exceed the original domain given by */ + /* unur_distr_cont_set_domain(). Otherwise it is truncated. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* the new boundary points may be +/- UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double Umin, Umax, Uminbound, Umaxbound; + + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object(gen, HINV, UNUR_ERR_GEN_INVALID); + + /* the truncated domain must be a subset of (computational) domain */ + if (left < GEN->bleft) { + _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"domain, increase left boundary"); + left = GEN->bleft; + } + if (right > GEN->bright) { + _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"domain, decrease right boundary"); + right = GEN->bright; + } + + /* the truncated domain must have non-empty intersection */ + if (!_unur_FP_less(left,right)) { + _unur_error(gen->genid,UNUR_ERR_DISTR_SET,"domain, left >= right"); + return UNUR_ERR_DISTR_SET; + } + + /* compute Uminbound and Umaxbound using the u-value of the first and + the last design point. */ + /* this setting of Uminbound and Umaxbound guarantees that in the + sampling algorithm U is always in a range where a table + is available for the inverse CDF. + So this is a safe guard against segfault for U=0. or U=1. */ + Uminbound = _unur_max(0.,GEN->intervals[0]); + Umaxbound = _unur_min(1.,GEN->intervals[(GEN->N-1)*(GEN->order+2)]); + + /* set bounds of U -- in respect to given bounds */ + Umin = (left > -UNUR_INFINITY) ? CDF(left) : 0.; + Umax = (right < UNUR_INFINITY) ? CDF(right) : 1.; + + /* check result */ + if (Umin > Umax) { + /* this is a serios error that should not happen */ + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + } + + if (_unur_FP_equal(Umin,Umax)) { + /* CDF values very close */ + _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values very close"); + if (_unur_iszero(Umin) || _unur_FP_same(Umax,1.)) { + /* this is very bad */ + _unur_error(gen->genid,UNUR_ERR_DISTR_SET,"CDF values at boundary points too close"); + return UNUR_ERR_DISTR_SET; + } + } + + /* copy new boundaries into generator object */ + DISTR.trunc[0] = left; + DISTR.trunc[1] = right; + GEN->Umin = _unur_max(Umin, Uminbound); + GEN->Umax = _unur_min(Umax, Umaxbound); + + /* changelog */ + gen->distr->set |= UNUR_DISTR_SET_TRUNCATED; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & HINV_DEBUG_CHG) + _unur_hinv_debug_chg_truncated( gen ); +#endif + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_hinv_chg_truncated() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_hinv_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* params pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + _unur_check_NULL( GENTYPE,par,NULL ); + + /* check input */ + if ( par->method != UNUR_METH_HINV ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_HINV_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_hinv_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* check parameters */ + if (_unur_hinv_check_par(gen) != UNUR_SUCCESS) { + _unur_hinv_free(gen); return NULL; + } + + /* compute splines */ + if (_unur_hinv_create_table(gen)!=UNUR_SUCCESS) { + /* make entry in LOG file */ +#ifdef UNUR_ENABLE_LOGGING + if (gen->debug) { + _unur_hinv_list_to_array( gen ); + _unur_hinv_debug_init(gen,FALSE); + } +#endif + _unur_hinv_free(gen); return NULL; + } + + /* copy linked list into array */ + _unur_hinv_list_to_array( gen ); + + /* adjust minimal and maximal U value */ + GEN->Umin = _unur_max(0.,GEN->intervals[0]); + GEN->Umax = _unur_min(1.,GEN->intervals[(GEN->N-1)*(GEN->order+2)]); + + /* this setting of Umin and Umax guarantees that in the + sampling algorithm U is always in a range where a table + is available for the inverse CDF. + So this is a safe guard against segfault for U=0. or U=1. */ + + /* These values for Umin and Umax are only changed in + unur_hinv_chg_truncated(). */ + + /* make guide table */ + _unur_hinv_make_guide_table(gen); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_hinv_debug_init(gen,TRUE); +#endif + + /* we do not use 'stp' any more. since it contains a pointer to + an array outside the generator object. thus we set the pointer + to NULL + */ + GEN->stp = NULL; + GEN->n_stp = 0; + + /* o.k. */ + return gen; + +} /* end of _unur_hinv_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_hinv_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int rcode; + + /* check parameters */ + if ( (rcode = _unur_hinv_check_par(gen)) != UNUR_SUCCESS) + return rcode; + + /* compute splines */ + if ( (rcode = _unur_hinv_create_table(gen)) != UNUR_SUCCESS) + return rcode; + + /* copy linked list into array */ + _unur_hinv_list_to_array( gen ); + + /* adjust minimal and maximal U value */ + GEN->Umin = _unur_max(0.,GEN->intervals[0]); + GEN->Umax = _unur_min(1.,GEN->intervals[(GEN->N-1)*(GEN->order+2)]); + + /* (re)set sampling routine */ + SAMPLE = _unur_hinv_getSAMPLE(gen); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & HINV_DEBUG_REINIT) _unur_hinv_debug_init(gen,TRUE); +#endif + + /* make guide table */ + _unur_hinv_make_guide_table(gen); + + return UNUR_SUCCESS; +} /* end of _unur_hinv_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_hinv_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_HINV_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_hinv_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_HINV_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_hinv_getSAMPLE(gen); + gen->destroy = _unur_hinv_free; + gen->clone = _unur_hinv_clone; + gen->reinit = _unur_hinv_reinit; + + /* copy parameters into generator object */ + GEN->order = PAR->order; /* order of polynomial */ + GEN->u_resolution = PAR->u_resolution; /* maximal error in u-direction */ + GEN->guide_factor = PAR->guide_factor; /* relative size of guide tables */ + GEN->bleft_par = PAR->bleft; /* border of computational domain */ + GEN->bright_par = PAR->bright; + GEN->max_ivs = PAR->max_ivs; /* maximum number of intervals */ + GEN->stp = PAR->stp; /* pointer to array of starting points */ + GEN->n_stp = PAR->n_stp; /* number of construction points */ + + /* default values */ + GEN->tailcutoff_left = -1.; /* no cut-off by default */ + GEN->tailcutoff_right = 10.; + + /* initialize variables */ + GEN->bleft = GEN->bleft_par; + GEN->bright = GEN->bright_par; + GEN->Umin = 0.; + GEN->Umax = 1.; + GEN->N = 0; + GEN->iv = NULL; + GEN->intervals = NULL; + GEN->guide_size = 0; + GEN->guide = NULL; + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_hinv_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_hinv_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_hinv_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double tailcutoff; + + /* default tail cut-off points */ + tailcutoff = _unur_min(HINV_TAILCUTOFF_MIN, HINV_TAILCUTOFF_FACTOR * GEN->u_resolution); + tailcutoff = _unur_max(tailcutoff, 2*DBL_EPSILON); + + /* computational domain as given by user */ + GEN->bleft = GEN->bleft_par; + GEN->bright = GEN->bright_par; + + /* domain not truncated at init */ + DISTR.trunc[0] = DISTR.domain[0]; + DISTR.trunc[1] = DISTR.domain[1]; + + /* set bounds of U -- in respect to given bounds */ + GEN->CDFmin = (DISTR.domain[0] > -UNUR_INFINITY) ? _unur_cont_CDF((DISTR.domain[0]),(gen->distr)) : 0.; + GEN->CDFmax = (DISTR.domain[1] < UNUR_INFINITY) ? _unur_cont_CDF((DISTR.domain[1]),(gen->distr)) : 1.; + + if (!_unur_FP_less(GEN->CDFmin,GEN->CDFmax)) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"CDF not increasing"); + return UNUR_ERR_GEN_DATA; + } + + /* cut points for tails */ + if (DISTR.domain[0] <= -UNUR_INFINITY || + (DISTR.pdf!=NULL && _unur_cont_PDF((DISTR.domain[0]),(gen->distr))<=0.) ) { + GEN->tailcutoff_left = tailcutoff; + } + if (DISTR.domain[1] >= UNUR_INFINITY || + (DISTR.pdf!=NULL && _unur_cont_PDF((DISTR.domain[1]),(gen->distr))<=0.) ) { + GEN->tailcutoff_right = 1.- tailcutoff; + } + + return UNUR_SUCCESS; +} /* end of _unur_hinv_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_hinv_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_hinv_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_HINV_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* copy tables for generator object */ + CLONE->intervals = _unur_xmalloc( GEN->N*(GEN->order+2) * sizeof(double) ); + memcpy( CLONE->intervals, GEN->intervals, GEN->N*(GEN->order+2) * sizeof(double) ); + CLONE->guide = _unur_xmalloc( GEN->guide_size * sizeof(int) ); + memcpy( CLONE->guide, GEN->guide, GEN->guide_size * sizeof(int) ); + + return clone; + +#undef CLONE +} /* end of _unur_hinv_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_hinv_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_HINV ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_HINV_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free linked list of intervals */ + if (GEN->iv) { + struct unur_hinv_interval *iv,*next; + for (iv = GEN->iv; iv != NULL; iv = next) { + next = iv->next; + free(iv); + } + } + + /* free tables */ + if (GEN->intervals) free (GEN->intervals); + if (GEN->guide) free (GEN->guide); + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_hinv_free() */ + +/*****************************************************************************/ + +double +_unur_hinv_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U,X; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_HINV_GEN,UNUR_INFINITY); + + /* sample from U( Umin, Umax ) */ + U = GEN->Umin + _unur_call_urng(gen->urng) * (GEN->Umax - GEN->Umin); + + /* compute inverse CDF */ + X = _unur_hinv_eval_approxinvcdf(gen,U); + + if (XDISTR.trunc[1]) return DISTR.trunc[1]; + + return X; + +} /* end of _unur_hinv_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_hinv_eval_approxinvcdf( const struct unur_gen *gen, double u ) + /*----------------------------------------------------------------------*/ + /* evaluate Hermite interpolation of inverse CDF at u */ + /* (internal call) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* u ... argument for inverse CDF (0<=u<=1, no validation!) */ + /* */ + /* return: */ + /* double (approximate inverse CDF) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_HINV_GEN,UNUR_INFINITY); + + /* look up in guide table and search for interval */ + i = GEN->guide[(int) (GEN->guide_size*u)]; + while (u > GEN->intervals[i+GEN->order+2]) + i += GEN->order+2; + + /* rescale uniform random number */ + u = (u-GEN->intervals[i])/(GEN->intervals[i+GEN->order+2] - GEN->intervals[i]); + + /* evaluate polynome */ + return _unur_hinv_eval_polynomial( u, GEN->intervals+i+1, GEN->order ); + +} /* end of _unur_hinv_eval_approxinvcdf() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_hinv_eval_approxinvcdf( const struct unur_gen *gen, double u ) + /*----------------------------------------------------------------------*/ + /* evaluate Hermite interpolation of inverse CDF at u */ + /* (user call) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* u ... argument for inverse CDF (0<=u<=1) */ + /* */ + /* return: */ + /* double (approximate inverse CDF) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double x; + + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + if ( gen->method != UNUR_METH_HINV ) { + _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); + return UNUR_INFINITY; + } + COOKIE_CHECK(gen,CK_HINV_GEN,UNUR_INFINITY); + + if ( ! (u>0. && u<1.)) { + if ( ! (u>=0. && u<=1.)) { + _unur_warning(gen->genid,UNUR_ERR_DOMAIN,"U not in [0,1]"); + } + if (u<=0.) return DISTR.trunc[0]; + if (u>=1.) return DISTR.trunc[1]; + return u; /* = NaN */ + } + + /* rescale given u */ + u = GEN->Umin + u * (GEN->Umax - GEN->Umin); + + /* compute inverse CDF */ + x = _unur_hinv_eval_approxinvcdf(gen,u); + + /* validate range */ + if (xDISTR.trunc[1]) x = DISTR.trunc[1]; + + return x; + +} /* end of unur_hinv_eval_approxinvcdf() */ + +/*****************************************************************************/ + +int +unur_hinv_estimate_error( const UNUR_GEN *gen, int samplesize, double *max_error, double *MAE ) + /*----------------------------------------------------------------------*/ + /* Estimate maximal u-error and mean absolute error (MAE) by means of */ + /* Monte-Carlo simulation. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* samplesize ... sample size for Monte Carlo simulation */ + /* max_error ... pointer to double for storing maximal u-error */ + /* MAE ... pointer to double for storing MA u-error */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL(GENTYPE, gen, UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_HINV_GEN,UNUR_ERR_COOKIE); + + /* run test */ + unur_test_u_error(gen, max_error, MAE, 1.e-20, samplesize, + FALSE, FALSE, FALSE, NULL); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_hinv_estimate_error() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_hinv_find_boundary( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* find boundary of computational interval */ + /* */ + /* parameters: */ + /* gen ... pointer generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double x,u; + int i; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_HINV_GEN,UNUR_ERR_COOKIE); + + /* reset counter for intervals */ + GEN->N = 0; + + /* boundary of the computational domain must not exceed domain of distribution */ + if (GEN->bleft < DISTR.domain[0]) GEN->bleft = DISTR.domain[0]; + if (GEN->bright > DISTR.domain[1]) GEN->bright = DISTR.domain[1]; + + /* find left boundary point */ + for (x = GEN->bleft, i=0; ibleft = x; + u = CDF(GEN->bleft); + + /* everything fine ? */ + if (u <= GEN->tailcutoff_left || GEN->tailcutoff_left < 0.) + break; + + /* otherwise ... */ + if (DISTR.domain[0] <= -UNUR_INFINITY) { + /* domain not bounded from below */ + x = (GEN->bleft > -1.) ? -1. : 10.*GEN->bleft; + if (! _unur_isfinite(x) ) + i = HINV_MAX_ITER; + } + + else { + /* domain bounded from below */ + x = _unur_arcmean(GEN->bleft, DISTR.domain[0]); + if (_unur_FP_equal(x,DISTR.domain[0])) + i = HINV_MAX_ITER; + } + } + + /* computation successful ? */ + if (i >= HINV_MAX_ITER) + _unur_warning(gen->genid,UNUR_ERR_DISTR_PROP,"cannot find l.h.s. of domain"); + + /* make l.h.s. starting interval */ + GEN->iv = _unur_hinv_interval_new(gen,GEN->bleft,u); + if (GEN->iv == NULL) return UNUR_ERR_GEN_DATA; + + + /* find right boundary point */ + for (x = GEN->bright, i=0; ibright = x; + u = CDF(GEN->bright); + + /* everything fine ? */ + if (u >= GEN->tailcutoff_right || GEN->tailcutoff_right > 1.1) + break; + + /* otherwise ... */ + if (DISTR.domain[1] >= UNUR_INFINITY) { + /* domain not bounded from above */ + x = (GEN->bright < 1.) ? 1. : 10.*GEN->bright; + if (! _unur_isfinite(x) ) + i = HINV_MAX_ITER; + } + + else { + /* domain bounded from below */ + x = _unur_arcmean(GEN->bright, DISTR.domain[1]); + if (_unur_FP_equal(x,DISTR.domain[1])) + i = HINV_MAX_ITER; + } + } + + /* computation successful ? */ + if (i >= HINV_MAX_ITER) + _unur_warning(gen->genid,UNUR_ERR_DISTR_PROP,"cannot find r.h.s. of domain"); + + /* make r.h.s. starting intervals */ + GEN->iv->next = _unur_hinv_interval_new(gen,GEN->bright,u); + if (GEN->iv->next == NULL) return UNUR_ERR_GEN_DATA; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_hinv_find_boundary() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_hinv_create_table( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* create a table of splines */ + /* */ + /* parameters: */ + /* gen ... pointer generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_hinv_interval *iv, *iv_new; + int i, error_count_shortinterval=0; + double Fx; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_HINV_GEN,UNUR_ERR_COOKIE); + + /* find boundary point of computational interval */ + if (_unur_hinv_find_boundary(gen) != UNUR_SUCCESS) + return UNUR_ERR_GEN_DATA; + + /* use starting design points of given */ + if (GEN->stp) { + iv = GEN->iv; + for (i=0; in_stp; i++) { + if (!_unur_FP_greater(GEN->stp[i],GEN->bleft)) continue; /* skip */ + if (!_unur_FP_less(GEN->stp[i],GEN->bright)) break; /* no more points */ + + Fx = CDF(GEN->stp[i]); + iv_new = _unur_hinv_interval_new(gen,GEN->stp[i],Fx); + if (iv_new == NULL) return UNUR_ERR_GEN_DATA; + iv_new->next = iv->next; + iv->next = iv_new; + iv = iv_new; + + if (Fx > GEN->tailcutoff_right) + /* there is no need to add another starting point in the r.h. tail */ + break; + } + } + + else /* mode - if known - is inserted as "default design point" */ + if( (gen->distr->set & UNUR_DISTR_SET_MODE) && + _unur_FP_greater(DISTR.mode, GEN->bleft) && + _unur_FP_less(DISTR.mode, GEN->bright) ) { + iv = GEN->iv; + iv_new = _unur_hinv_interval_new(gen,DISTR.mode,CDF(DISTR.mode)); + if (iv_new == NULL) return UNUR_ERR_GEN_DATA; + iv_new->next = iv->next; + iv->next = iv_new; + } + + /* now split intervals where approximation error is too large */ + for (iv=GEN->iv; iv->next!=NULL; ) { + COOKIE_CHECK(iv,CK_HINV_IV,UNUR_ERR_COOKIE); + if (GEN->N >= GEN->max_ivs) { + /* emergency break */ + _unur_error(GENTYPE,UNUR_ERR_GEN_CONDITION,"too many intervals"); + return UNUR_ERR_GEN_CONDITION; + } + iv = _unur_hinv_interval_adapt(gen,iv, &error_count_shortinterval); + if (iv == NULL) return UNUR_ERR_GEN_DATA; + } + + /* last interval is only used to store right boundary */ + iv->spline[0] = iv->p; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_hinv_create_table() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_hinv_interval * +_unur_hinv_interval_new( struct unur_gen *gen, double p, double u ) + /*----------------------------------------------------------------------*/ + /* make a new interval with node (u=F(p),p). */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* p ... left design point of new interval */ + /* u ... value of CDF at p, u=CDF(p) */ + /* */ + /* return: */ + /* pointer to new interval */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_hinv_interval *iv; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_HINV_GEN,NULL); + + /* first check u */ + if (u<0.) { + if (u < -UNUR_SQRT_DBL_EPSILON) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"CDF(x) < 0."); + return NULL; + } + else { /* round off error */ + u = 0.; + } + } + if (u>1.) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"CDF(x) > 1."); + return NULL; + } + + /* we need new interval */ + iv = _unur_xmalloc( sizeof(struct unur_hinv_interval) ); + COOKIE_SET(iv,CK_HINV_IV); + + /* compute and store data */ + switch (GEN->order) { + case 5: + iv->df = dPDF(p); + /* FALLTHROUGH */ + case 3: + iv->f = PDF(p); + /* FALLTHROUGH */ + case 1: + iv->p = p; + iv->u = u; + break; + default: + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + free(iv); + return NULL; + } + + iv->next = NULL; /* add eol marker */ + ++(GEN->N); /* increment counter for intervals */ + + /* o.k. */ + return iv; + +} /* end of _unur_hinv_interval_new() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_hinv_interval * +_unur_hinv_interval_adapt( struct unur_gen *gen, struct unur_hinv_interval *iv, + int *error_count_shortinterval ) + /*----------------------------------------------------------------------*/ + /* check parameters in interval and split or truncate where necessary. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval */ + /* error_count_shortinterval ... pointer to errorcount to supress too */ + /* many error messages */ + /* */ + /* return: */ + /* iv ... if splitted */ + /* iv->next ... if interval was o.k. */ + /*----------------------------------------------------------------------*/ +{ + double p_new; /* new design point */ + struct unur_hinv_interval *iv_new, *iv_tmp; + double x, Fx; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_HINV_GEN,NULL); + CHECK_NULL(iv,NULL); COOKIE_CHECK(iv,CK_HINV_IV,NULL); + CHECK_NULL(iv->next,NULL); COOKIE_CHECK(iv->next,CK_HINV_IV,NULL); + + /* 1st check: right most interval (of at least 2) + with CDF greater than GEN->tailcutoff_right */ + + iv_tmp = iv->next->next; + if(iv_tmp && iv->next->u > GEN->tailcutoff_right) { + /* chop off right hand tail */ + free (iv_tmp); + iv->next->next = NULL; + GEN->N--; + /* update right boundary */ + GEN->bright = iv->next->p; + return iv; + } + + /* 2nd check: is the left most interval (of at least 2) + with CDF less than GEN->tailcutoff_left */ + + if (iv==GEN->iv && iv->next->next && iv->next->u < GEN->tailcutoff_left) { + /* chop off left hand tail */ + iv_tmp = GEN->iv; + GEN->iv = iv->next; + free (iv_tmp); + GEN->N--; + /* update left boundary */ + GEN->bleft = GEN->iv->p; + return GEN->iv; + } + + /* center of x-interval as splitting point */ + p_new = 0.5 * (iv->next->p + iv->p); + + /* we do not split an interval if is too close */ + /* changing the below FP_equal to FP_same can strongly increase the number of + intervals needed and may slightly decrease the MAError. In both cases the + required u-precision is not reached due to numerical problems with very steep CDF*/ + if (_unur_FP_equal(p_new,iv->p) || _unur_FP_equal(p_new,iv->next->p)) { + if(!(*error_count_shortinterval)){ + _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF, + "one or more intervals very short; possibly due to numerical problems with a pole or very flat tail"); + (*error_count_shortinterval)++; + } + /* skip to next interval */ + _unur_hinv_interval_parameter(gen,iv); + return iv->next; + } + + /* 3rd check: |u_i - u_{i-1}| must not exceed threshold value */ + /* 4th check: monotonicity */ + + if ( (iv->next->u - iv->u > HINV_MAX_U_LENGTH) || + (! _unur_hinv_interval_is_monotone(gen,iv)) ) { + /* insert new interval into linked list */ + iv_new = _unur_hinv_interval_new(gen,p_new,CDF(p_new)); + if (iv_new == NULL) return NULL; + iv_new->next = iv->next; + iv->next = iv_new; + return iv; + } + + /* compute coefficients for spline (only necessary if monotone) */ + _unur_hinv_interval_parameter(gen,iv); + + /* 5th check: error in u-direction */ + + /* compute approximate value for inverse CDF in center of interval */ + x = _unur_hinv_eval_polynomial( 0.5, iv->spline, GEN->order ); + Fx = CDF(x); + + /* check for FP errors */ + if (_unur_isnan(x)) { + _unur_error(gen->genid,UNUR_ERR_ROUNDOFF, + "NaN occured; possibly due to numerical problems with a pole or very flat tail"); + return NULL; + } + + /* check error */ + if (!(fabs(Fx - 0.5*(iv->next->u + iv->u)) < (GEN->u_resolution * HINV_UERROR_CORRECTION))) { + /* error in u-direction too large */ + /* if possible we use the point x instead of p_new */ + if(fabs(p_new-x)< HINV_XDEVIATION * (iv->next->p - iv->p)) + iv_new = _unur_hinv_interval_new(gen,x,Fx); + else + iv_new = _unur_hinv_interval_new(gen,p_new,CDF(p_new)); + if (iv_new == NULL) return NULL; + iv_new->next = iv->next; + iv->next = iv_new; + return iv; + } + + /* interval o.k. */ + return iv->next; + +} /* end of _unur_hinv_interval_adapt() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_hinv_interval_is_monotone( struct unur_gen *gen, struct unur_hinv_interval *iv ) + /*----------------------------------------------------------------------*/ + /* check whether the given interval is monotone. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval */ + /* */ + /* return: */ + /* TRUE ... if monotone */ + /* FALSE ... otherwise */ + /*----------------------------------------------------------------------*/ +{ + double bound; + + switch (GEN->order) { + case 5: + /* the monotone check is in the moment only implemented for order 3 + as approximation we use the same check for order 5 */ + case 3: + /* we skip the test if computing the bound has too many round-off errors */ + if (_unur_iszero(iv->u) || _unur_FP_approx(iv->u,iv->next->u)) + return TRUE; + /* difference quotient */ + bound = 3.*(iv->next->p - iv->p)/(iv->next->u - iv->u); + return (1./iv->next->f > bound || 1./iv->f > bound) ? FALSE : TRUE; + case 1: + /* linear interpolation is always monotone */ + default: /* we assume that we have checked GEN->order very often till now */ + return TRUE; + } + +} /* end of _unur_hinv_interval_is_monotone() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_hinv_interval_parameter( struct unur_gen *gen, struct unur_hinv_interval *iv ) + /*----------------------------------------------------------------------*/ + /* compute all parameter for interval (spline coefficients). */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double delta_u, delta_p; + double f1, fs0, fs1, fss0, fss1; + + delta_u = iv->next->u - iv->u; + delta_p = iv->next->p - iv->p; + + switch (GEN->order) { + + case 5: /* quintic Hermite interpolation */ + if (iv->f > 0. && iv->next->f > 0. && + iv->df < UNUR_INFINITY && iv->df > -UNUR_INFINITY && + iv->next->df < UNUR_INFINITY && iv->next->df > -UNUR_INFINITY ) { + f1 = delta_p; + fs0 = delta_u / iv->f; + fs1 = delta_u / iv->next->f; + fss0 = -delta_u * delta_u * iv->df / (iv->f * iv->f * iv->f); + fss1 = -delta_u * delta_u * iv->next->df / (iv->next->f * iv->next->f * iv->next->f); + + iv->spline[0] = iv->p; + iv->spline[1] = fs0; + iv->spline[2] = 0.5*fss0; + iv->spline[3] = 10.*f1 - 6.*fs0 - 4.*fs1 - 1.5*fss0 + 0.5*fss1; + iv->spline[4] = -15.*f1 + 8.*fs0 + 7.*fs1 + 1.5*fss0 - fss1; + iv->spline[5] = 6.*f1 - 3.*fs0 - 3.*fs1 - 0.5*fss0 + 0.5*fss1; + return UNUR_SUCCESS; + } + else { + /* cannot use quintic interpolation in interval; use cubic instead */ + iv->spline[4] = 0.; + iv->spline[5] = 0.; + } + /* FALLTHROUGH */ + + case 3: /* cubic Hermite interpolation */ + if (iv->f > 0. && iv->next->f > 0.) { + iv->spline[0] = iv->p; + iv->spline[1] = delta_u / iv->f; + iv->spline[2] = 3.* delta_p - delta_u * (2./iv->f + 1./iv->next->f); + iv->spline[3] = -2.* delta_p + delta_u * (1./iv->f + 1./iv->next->f); + return UNUR_SUCCESS; + } + else { + /* cannot use cubic interpolation in interval; use linear instead */ + iv->spline[2] = 0.; + iv->spline[3] = 0.; + } + /* FALLTHROUGH */ + + case 1: /* linear interpolation */ + iv->spline[0] = iv->p; + iv->spline[1] = delta_p; + return UNUR_SUCCESS; + + default: + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + } + +} /* end of _unur_hinv_interval_parameter() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_hinv_eval_polynomial( double x, double *coeff, int order ) + /*----------------------------------------------------------------------*/ + /* evaluate polynomial using Horner scheme. */ + /* */ + /* parameters: */ + /* x ... argument */ + /* coeff ... coefficients of polynomial (increasing order) */ + /* order ... order of polynomial */ + /* */ + /* return: */ + /* value of spline at u */ + /*----------------------------------------------------------------------*/ +{ + int i; + double poly; + + poly = coeff[order]; + for (i=order-1; i>=0; i--) + poly = x*poly + coeff[i]; + + return poly; +} /* end of _unur_hinv_eval_polynomial() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_hinv_list_to_array( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy list of intervals into double array. */ + /* the linked list is freed. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + struct unur_hinv_interval *iv, *next; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_HINV_GEN,UNUR_ERR_COOKIE); + + /* allocate memory */ + GEN->intervals = + _unur_xrealloc( GEN->intervals, GEN->N*(GEN->order+2)*sizeof(double) ); + + i = 0; + for (iv=GEN->iv; iv!=NULL; iv=next) { + /* copy */ + GEN->intervals[i] = iv->u; + memcpy( GEN->intervals+(i+1), &(iv->spline), (GEN->order+1)*sizeof(double) ); + i += GEN->order+2; + /* and free linked list */ + next = iv->next; + free(iv); + } + + /* linked list is now empty */ + GEN->iv = NULL; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_hinv_list_to_array() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_hinv_make_guide_table( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* make a guide table for indexed search */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i,j, imax; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_HINV_GEN,UNUR_ERR_COOKIE); + + /* allocate blocks for guide table (if necessary). + (we allocate blocks for maximal guide table.) */ + GEN->guide_size = (int) (GEN->N * GEN->guide_factor); + if (GEN->guide_size <= 0) GEN->guide_size = 1; + GEN->guide = _unur_xrealloc( GEN->guide, GEN->guide_size * sizeof(int) ); + + imax = (GEN->N-2) * (GEN->order+2); + + /* u value at end of interval */ +# define u(i) (GEN->intervals[(i)+GEN->order+2]) + + i = 0; + GEN->guide[0] = 0; + for( j=1; jguide_size ;j++ ) { + while( u(i) < (j/(double)GEN->guide_size) && i <= imax) + i += GEN->order+2; + if (i > imax) break; + GEN->guide[j]=i; + } + +# undef u + + /* check i */ + i = _unur_min(i,imax); + + /* if there has been an round off error, we have to complete the guide table */ + for( ; jguide_size ;j++ ) + GEN->guide[j] = i; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_hinv_make_guide_table() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_hinv_CDF( const struct unur_gen *gen, double x ) + /*----------------------------------------------------------------------*/ + /* Compute CDF of truncated distribution. */ + /* The CDF is rescaled such that the CDF is a "real" CDF with */ + /* range u is [0,1] in the interval (DISTR.domain[0], DISTR.domain[1]). */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* x ... argument for CDF */ + /*----------------------------------------------------------------------*/ +{ + double u; + + /* check for boundaries */ + if (x<=DISTR.domain[0]) return 0.; + if (x>=DISTR.domain[1]) return 1.; + + /* compute rescaled CDF */ + u = (_unur_cont_CDF(x,gen->distr) - GEN->CDFmin) / (GEN->CDFmax - GEN->CDFmin); + + /* we have to protect us against round-off errors. */ + /* thus we allow results that are a little bit too large. */ + if (u>1. && _unur_FP_equal(u,1.)) + u = 1.; + + /* Remark: We do not change u if it is too large since then we assume that */ + /* the given CDF is incorrect. */ + + return u; +} /* end of _unur_hinv_CDF() */ + + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_hinv_debug_init( const struct unur_gen *gen, int ok ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* ok ... exitcode of init call */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int i; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HINV_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = HINV (Hermite approximation of INVerse CDF)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cont_debug( gen->distr, gen->genid ); + + fprintf(LOG,"%s: sampling routine = _unur_hinv_sample\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: order of polynomial = %d",gen->genid,GEN->order); + _unur_print_if_default(gen,HINV_SET_ORDER); + + fprintf(LOG,"\n%s: u-resolution = %g",gen->genid,GEN->u_resolution); + _unur_print_if_default(gen,HINV_SET_U_RESOLUTION); + fprintf(LOG,"\n%s: tail cut-off points = ",gen->genid); + if (GEN->tailcutoff_left < 0.) fprintf(LOG,"none, "); + else fprintf(LOG,"%g, ",GEN->tailcutoff_left); + if (GEN->tailcutoff_right > 1.) fprintf(LOG,"none\n"); + else fprintf(LOG,"1.-%g\n",1.-GEN->tailcutoff_right); + + fprintf(LOG,"%s: domain of computation = [%g,%g]\n",gen->genid,GEN->bleft,GEN->bright); + fprintf(LOG,"%s:\tU in (%g,%g)\n",gen->genid,GEN->Umin,GEN->Umax); + fprintf(LOG,"%s:\n",gen->genid); + + if (GEN->stp && gen->set & HINV_SET_STP) { + fprintf(LOG,"%s: starting points: (%d)",gen->genid,GEN->n_stp); + for (i=0; in_stp; i++) { + if (i%5==0) fprintf(LOG,"\n%s:\t",gen->genid); + fprintf(LOG," %#g,",GEN->stp[i]); + } + fprintf(LOG,"\n%s:\n",gen->genid); + } + + fprintf(LOG,"%s: sampling from list of intervals: indexed search (guide table method)\n",gen->genid); + fprintf(LOG,"%s: relative guide table size = %g%%",gen->genid,100.*GEN->guide_factor); + _unur_print_if_default(gen,HINV_SET_GUIDEFACTOR); + fprintf(LOG,"\n%s:\n",gen->genid); + + _unur_hinv_debug_intervals(gen); + + fprintf(LOG,"%s: initialization %s\n",gen->genid,((ok)?"successful":"failed")); + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_hinv_debug_init() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_hinv_debug_intervals( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* print table of intervals into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + int i,n; + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HINV_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: Intervals: %d\n",gen->genid,GEN->N-1); + + if (gen->debug & HINV_DEBUG_TABLE) { + fprintf(LOG,"%s: Nr. u=CDF(p) p=spline[0] spline[1] ...\n",gen->genid); + for (n=0; nN-1; n++) { + i = n*(GEN->order+2); + fprintf(LOG,"%s:[%4d]: %#12.6g %#12.6g %#12.6g", gen->genid, n, + GEN->intervals[i], GEN->intervals[i+1], GEN->intervals[i+2]); + if (GEN->order>1) + fprintf(LOG," %#12.6g %#12.6g", GEN->intervals[i+3], GEN->intervals[i+4]); + if (GEN->order>3) + fprintf(LOG," %#12.6g %#12.6g", GEN->intervals[i+5], GEN->intervals[i+6]); + fprintf(LOG,"\n"); + } + /* the following might cause troubles when creating the tables fails. */ + /* so we remove it. */ + /* i = n*(GEN->order+2); */ + /* fprintf(LOG,"%s:[%4d]: %#12.6g %#12.6g (right boundary)\n", gen->genid, n, */ + /* GEN->intervals[i], GEN->intervals[i+1] ); */ + } + + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_hinv_debug_intervals() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_hinv_debug_chg_truncated( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* print new (changed) domain of (truncated) distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HINV_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: domain of (truncated) distribution changed:\n",gen->genid); + fprintf(LOG,"%s:\tdomain = (%g, %g)\n",gen->genid, DISTR.trunc[0], DISTR.trunc[1]); + fprintf(LOG,"%s:\tU in (%g,%g)\n",gen->genid,GEN->Umin,GEN->Umax); + +} /* end of _unur_hinv_debug_chg_truncated() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_hinv_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = CDF"); + if (GEN->order > 1) + _unur_string_append(info," PDF"); + if (GEN->order > 3) + _unur_string_append(info," dPDF"); + _unur_string_append(info,"\n"); + _unur_string_append(info," domain = (%g, %g)", DISTR.trunc[0],DISTR.trunc[1]); + if (gen->distr->set & UNUR_DISTR_SET_TRUNCATED) { + _unur_string_append(info," [truncated from (%g, %g)]", DISTR.domain[0],DISTR.domain[1]); + } + _unur_string_append(info,"\n"); + + if (distr->set & UNUR_DISTR_SET_MODE) { + _unur_string_append(info," mode = %g\n", DISTR.mode); + } + + if (help) + if (! (distr->set & UNUR_DISTR_SET_MODE) ) + _unur_string_append(info,"\n[ Hint: %s ]\n", + "You may set the \"mode\" of the distribution in case of a high peak"); + + _unur_string_append(info,"\n"); + + /* method */ + _unur_string_append(info,"method: HINV (Hermite approximation of INVerse CDF)\n"); + _unur_string_append(info," order of polynomial = %d\n", GEN->order); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," truncated domain = (%g,%g)\n",GEN->bleft,GEN->bright); + _unur_string_append(info," Prob(Xtailcutoff_left)); + _unur_string_append(info," Prob(X>domain) = %g\n", _unur_max(0,1.-GEN->tailcutoff_right)); + { + double max_error=1.; double MAE=1.; + unur_hinv_estimate_error( gen, 10000, &max_error, &MAE ); + _unur_string_append(info," u-error <= %g (mean = %g)\n", max_error, MAE); + } + + _unur_string_append(info," # intervals = %d\n", GEN->N-1); + _unur_string_append(info,"\n"); + + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + _unur_string_append(info," order = %d %s\n", GEN->order, + (gen->set & HINV_SET_ORDER) ? "" : "[default]"); + + _unur_string_append(info," u_resolution = %g %s\n", GEN->u_resolution, + (gen->set & HINV_SET_U_RESOLUTION) ? "" : "[default]"); + + if (gen->set & HINV_SET_MAX_IVS) + _unur_string_append(info," max_intervals = %d\n", GEN->max_ivs); + + _unur_string_append(info," boundary = (%g,%g) %s\n", GEN->bleft, GEN->bright, + (gen->set & HINV_SET_BOUNDARY) ? "" : "[computed]"); + + _unur_string_append(info,"\n"); + /* Not displayed: + int unur_hinv_set_cpoints( UNUR_PAR *parameters, const double *stp, int n_stp ); + int unur_hinv_set_guidefactor( UNUR_PAR *parameters, double factor ); + */ + } + + + /* Hints */ + if (help) { + if ( GEN->order < 5 ) + _unur_string_append(info,"[ Hint: %s ]\n", + "You can set \"order=5\" to decrease #intervals"); + if (! (gen->set & HINV_SET_U_RESOLUTION) ) + _unur_string_append(info,"[ Hint: %s\n\t%s ]\n", + "You can decrease the u-error by decreasing \"u_resolution\".", + "(it is bounded by the machine epsilon, however.)"); + _unur_string_append(info,"\n"); + } + +} /* end of _unur_tdr_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/hinv.h b/vendor/unuran-1.11.0/src/methods/hinv.h new file mode 100644 index 0000000..5d0057e --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/hinv.h @@ -0,0 +1,325 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: hinv.h * + * * + * PURPOSE: * + * function prototypes for method HINV * + * (Hermite interpolation based INVersion of CDF) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD HINV Hermite interpolation based INVersion of CDF + + =UP Methods_for_CONT + + =REQUIRED CDF + + =OPTIONAL PDF, dPDF + + =REF [HLa03] [HLD04: Sect.7.2, Alg.7.1] + + =SPEED Set-up: (very) slow, Sampling: (very) fast + + =REINIT supported + + =DESCRIPTION + HINV is a variant of numerical inversion, where the inverse CDF + is approximated using Hermite interpolation, i.e., the interval + [0,1] is split into several intervals and in each interval the + inverse CDF is approximated by polynomials constructed by means + of values of the CDF and PDF at interval boundaries. This makes + it possible to improve the accuracy by splitting a particular + interval without recomputations in unaffected intervals. Three + types of splines are implemented: linear, cubic, and quintic + interpolation. For linear interpolation only the CDF is + required. Cubic interpolation also requires PDF and quintic + interpolation PDF and its derivative. + + These splines have to be computed in a setup step. However, it + only works for distributions with bounded domain; for + distributions with unbounded domain the tails are chopped off + such that the probability for the tail regions is small compared + to the given u-resolution. + + The method is not exact, as it only produces random variates of + the approximated distribution. Nevertheless, the maximal + numerical error in "u-direction" (i.e. |U-CDF(X)|, for + X = "approximate inverse CDF"(U) |U-CDF(X)|) can be set to the + required resolution (within machine precision). + Notice that very small values of the u-resolution are possible + but may increase the cost for the setup step. + + As the possible maximal error is only estimated in the setup it + may be necessary to set some special design points for computing + the Hermite interpolation to guarantee that the maximal u-error + can not be bigger than desired. Such points are points where the + density is not differentiable or has a local extremum. Notice + that there is no necessity to do so. However, if you do not + provide these points to the algorithm there might be a small + chance that the approximation error is larger than the given + u-resolution, or that the required number of intervals is larger + than necessary. + + =HOWTOUSE + HINV works for continuous univariate distribution objects with + given CDF and (optional) PDF. It uses Hermite interpolation of + order 1, 3 [default] or 5. The order can be set by means of + unur_hinv_set_order(). + + For distributions with unbounded domains the tails are chopped + off such that the probability for the tail regions is small + compared to the given u-resulution. For finding these cut points + the algorithm starts with the region @code{[-1.e20,1.e20]}. For + the exceptional case where this might be too small (or one knows + this region and wants to avoid this search heuristics) it can be + directly set via a unur_hinv_set_boundary() call. + + It is possible to use this method for generating from truncated + distributions. It even can be changed for an existing generator + object by an unur_hinv_chg_truncated() call. + + This method is not exact, as it only produces random variates of + the approximated distribution. Nevertheless, the numerical error + in "u-direction" (i.e. |U-CDF(X)|, for + X = "approximate inverse CDF"(U) |U-CDF(X)|) can be controlled + by means of unur_hinv_set_u_resolution(). + + The possible maximal error is only estimated in the setup. Thus + it might be necessary to set some special design points for + computing the Hermite interpolation to guarantee that the + maximal u-error can not be bigger than desired. Such points + (e.g. extremal points of the PDF, points with infinite + derivative) can be set using using the + unur_hinv_set_cpoints() call. + If the mode for a unimodal distribution is set in the distribution + object this mode is automatically used as design-point if the + unur_hinv_set_cpoints() call is not used. + + As already mentioned the maximal error of this approximation is + only estimated. If this error is crucial for an application we + recommend to compute this error using unur_hinv_estimate_error() + which runs a small Monte Carlo simulation. + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + The values given by the last unur_hinv_chg_truncated() call will be + then changed to the values of the domain of the underlying distribution + object. Moreover, starting construction points (nodes) that are given by + a unur_hinv_set_cpoints() call are ignored when unur_reinit() is + called. + It is important to note that for a distribution from the + UNU.RAN library of standard distributions + (@pxref{Stddist,,Standard distributions}) + the normalization constant has to be updated using the + unur_distr_cont_upd_pdfarea() call whenever its parameters have been + changed by means of a unur_distr_cont_set_pdfparams() call. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* + =ROUTINES +*/ + + +UNUR_PAR *unur_hinv_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_hinv_set_order( UNUR_PAR *parameters, int order); +/* + Set order of Hermite interpolation. Valid orders are + @code{1}, @code{3}, and @code{5}. + Notice that @var{order} greater than @code{1} requires the density + of the distribution, and @var{order} greater than @code{3} even + requires the derivative of the density. Using @var{order} @code{1} + results for most distributions in a huge number of intervals + and is therefore not recommended. If the maximal error in + u-direction is very small (say smaller than @code{1.e-10}), + @var{order} @code{5} is recommended as it leads to considerably + fewer design points, as long there are no poles or heavy tails. + + @emph{Remark:} When the target distribution has poles or (very) heavy + tails @var{order} @code{5} (i.e., quintic interpolation) is + numerically less stable and more sensitive to round-off errors than + @var{order} @code{3} (i.e., cubic interpolation). + + Default is @code{3} if the density is given and @code{1} otherwise. +*/ + +int unur_hinv_set_u_resolution( UNUR_PAR *parameters, double u_resolution); +/* + Set maximal error in u-direction. However, the given u-error must not + be smaller than machine epsilon (@code{DBL_EPSILON}) and should not be + too close to this value. As the resolution of most uniform random + number sources is 2^(-32) = @code{2.3e-10}, a value of @code{1.e-10} + leads to an inversion algorithm that could be called exact. For most + simulations slightly bigger values for the maximal error are enough + as well. + + Remark: The u-error might become larger than @var{u_resolution} due + to rescaling of floating point numbers when the domain of the + distribution is truncated by a unur_hinv_chg_truncated() call. + + Default is @code{1.e-10}. +*/ + +int unur_hinv_set_cpoints( UNUR_PAR *parameters, const double *stp, int n_stp ); +/* + Set starting construction points (nodes) for Hermite interpolation. + + As the possible maximal error is only estimated in the setup + it may be necessary to set some special design points for + computing the Hermite interpolation to guarantee that the + maximal u-error can not be bigger than desired. We suggest to + include as special design points all local extrema of the density, + all points where the density is not differentiable, and isolated + points inside of the domain with density 0. + If there is an interval with density constant equal to 0 inside of + the given domain of the density, both endpoints of this interval + should be included as special design points. Notice that there is no + necessity to do so. However, if these points are not provided to + the algorithm the approximation error might be larger than the + given u-resolution, or the required number of intervals could be + larger than necessary. + + @emph{Important}: Notice that the given points must be in + increasing order and they must be disjoint. + + @emph{Important}: The boundary point of the computational region + must not be given in this list! + Points outside the boundary of the computational region are ignored. + + Default is for unimodal densities - if known - the mode of the + density, if it is not equal to the border of the domain. +*/ + +int unur_hinv_set_boundary( UNUR_PAR *parameters, double left, double right ); +/* + Set the left and right boundary of the computational interval. + Of course @code{+/- UNUR_INFINITY} is not allowed. + If the CDF at @var{left} and @var{right} is not close to the + respective values @code{0.} and @code{1.} then this interval is + increased by a (rather slow) search algorithm. + + @emph{Important}: This call does not change the domain of the + given distribution itself. But it restricts the domain for the + resulting random variates. + + Default is @code{1.e20}. +*/ + +int unur_hinv_set_guidefactor( UNUR_PAR *parameters, double factor ); +/* + Set factor for relative size of the guide table for indexed search + (see also method DGT @ref{DGT}). It must be greater than or equal + to @code{0}. + When set to @code{0}, then sequential search is used. + + Default is @code{1}. +*/ + +int unur_hinv_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); +/* + Set maximum number of intervals. No generator object is created if + the necessary number of intervals for the Hermite interpolation + exceeds @var{max_ivs}. It is used to prevent the algorithm to eat up + all memory for very badly shaped CDFs. + + Default is @code{1000000} (1.e6). +*/ + +int unur_hinv_get_n_intervals( const UNUR_GEN *generator ); +/* + Get number of nodes (design points) used for Hermite interpolation in + the generator object. The number of intervals is the number of + nodes minus 1. + It returns an error code in case of an error. +*/ + +double unur_hinv_eval_approxinvcdf( const UNUR_GEN *generator, double u ); +/* + Evaluate Hermite interpolation of inverse CDF at @var{u}. + If @var{u} is out of the domain [0,1] then @code{unur_errno} is set + to @code{UNUR_ERR_DOMAIN} and the respective bound of + the domain of the distribution are returned (which is + @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of + unbounded domains). + + @emph{Notice}: When the domain has been truncated by a + unur_hinv_chg_truncated() call then the inverse CDF of the + truncated distribution is returned. +*/ + +int unur_hinv_chg_truncated( UNUR_GEN *generator, double left, double right ); +/* + Changes the borders of the domain of the (truncated) distribution. + + Notice that the given truncated domain must be a subset of the + domain of the given distribution. The generator always uses the + intersection of the domain of the distribution and the truncated + domain given by this call. The tables of splines are not recomputed. + Thus it might happen that the relative error for the generated variates + from the truncated distribution is greater than the bound for the + non-truncated distribution. This call also fails when the CDF values + of the boundary points are too close, i.e. when only a few different + floating point numbers would be computed due to round-off errors + with floating point arithmetic. + + Remark: The u-error might become larger than the @var{u_resolution} + given by a unur_hinv_set_u_resolution() call due to rescaling of + floating point numbers when the domain of the distribution is + truncated. + + When failed an error code is returned. + + @emph{Important}: Always check the return code since the domain is + not changed in case of an error. +*/ + +int unur_hinv_estimate_error( const UNUR_GEN *generator, int samplesize, double *max_error, double *MAE ); +/* + Estimate maximal u-error and mean absolute error (MAE) for + @var{generator} by means of a (quasi-) Monte-Carlo simulation with + sample size @var{samplesize}. + The results are stored in @var{max_error} and @var{MAE}, respectively. + + It returns @code{UNUR_SUCCESS} if successful. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/hinv_struct.h b/vendor/unuran-1.11.0/src/methods/hinv_struct.h new file mode 100644 index 0000000..20202e8 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/hinv_struct.h @@ -0,0 +1,128 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: hinv_struct.h * + * * + * PURPOSE: * + * declares structures for method HINV * + * (Hermite interpolation based INVersion of CDF) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_hinv_par { + int order; /* order of interpolating polynomial */ + double u_resolution; /* maximal error in u */ + double guide_factor; /* relative size of guide table */ + double bleft; /* left border of the computational domain */ + double bright; /* right border of the computational domain */ + const double *stp; /* pointer to array of starting points */ + int n_stp; /* number of construction points at start */ + int max_ivs; /* maximum number of intervals */ +}; + +/*---------------------------------------------------------------------------*/ +/* store information about splines */ + +#define UNUR_HINV_MAX_ORDER (5) + +struct unur_hinv_interval { + double spline[UNUR_HINV_MAX_ORDER+1]; /* coefficients of spline */ + double p; /* left design point (node) in interval */ + double u; /* CDF at node p (u=CDF(p)) */ + double f; /* PDF at node p (u=CDF(p)) */ + double df; /* derivative of PDF at node p (u=CDF(p)) */ + + struct unur_hinv_interval *next; /* pointer to next element in list */ + +#ifdef UNUR_COOKIES + unsigned cookie; /* magic cookie */ +#endif +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_hinv_gen { + int order; /* order of interpolating polynomial */ + + int N; /* total number of division points = #intervals+1 */ + double *intervals; /* pointer to array for storing data for intervals + in blocks of size order+2: + [0] ... u_{i-1} = CDF at left design point + [1] ... p_{i-1} = left design point = spline[0] + [2]-[order+1] ... spline[1] - spline[order] + size of the array = N * (2+order) */ + + int *guide; /* pointer to guide table */ + int guide_size; /* size of guide table */ + double guide_factor; /* relative size of guide table */ + + double Umin, Umax; /* bounds for iid random variable in respect to + the given (truncated) domain of the distr. */ + double CDFmin, CDFmax; /* CDF-bounds of domain */ + double u_resolution; /* maximal error in u */ + double bleft; /* left border of the computational domain */ + double bright; /* right border of the computational domain */ + + struct unur_hinv_interval *iv; /* linked list of splines (only used in setup) */ + double tailcutoff_left; /* cut point for left hand tail (u-value) */ + double tailcutoff_right;/* cut point for right hand tail (u-value) */ + int max_ivs; /* maximum number of intervals */ + const double *stp; /* pointer to array of starting points */ + int n_stp; /* number of construction points at start */ + double bleft_par; /* border of the computational domain as ... */ + double bright_par; /* ... given by user */ +}; + + +/*---------------------------------------------------------------------------*/ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/unuran-1.11.0/src/methods/hist.c b/vendor/unuran-1.11.0/src/methods/hist.c new file mode 100644 index 0000000..b16c62d --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/hist.c @@ -0,0 +1,620 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: hist.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: generate from histogram * + * * + * DESCRIPTION: * + * Given histogram of observed sample. * + * Produce a value x consistent with this histogram (use inversion) * + * * + * REQUIRED: * + * pointer to histogram * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "hist.h" +#include "hist_struct.h" + +/*---------------------------------------------------------------------------*/ +/* Variants: none */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define HIST_DEBUG_PRINTHIST 0x00000100u + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "HIST" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_hist_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_hist_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_hist_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hist_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_hist_sample( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static int _unur_hist_create_tables( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* create (allocate) tables */ +/*---------------------------------------------------------------------------*/ + +static int _unur_hist_make_guidetable( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* create table for indexed search */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ +static void _unur_hist_debug_init( const struct unur_gen *gen ); + +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_hist_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cemp /* data for distribution object */ + +#define PAR ((struct unur_hist_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_hist_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cemp /* data for distribution in generator object */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +/*---------------------------------------------------------------------------*/ +/* constants */ + +/*---------------------------------------------------------------------------*/ + +#define _unur_hist_getSAMPLE(gen) (_unur_hist_sample) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_hist_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CEMP) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CEMP,NULL); + + if (DISTR_IN.hist_prob == NULL || !(distr->set & UNUR_DISTR_SET_DOMAIN)) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"histogram"); return NULL; } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_hist_par) ); + COOKIE_SET(par,CK_HIST_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + par->method = UNUR_METH_HIST; /* method */ + par->variant = 0u; /* default variant */ + + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_hist_init; + + return par; + +} /* end of unur_hist_new() */ + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_hist_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_HIST ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_HIST_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_hist_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* compute guide table */ + if ( (_unur_hist_create_tables(gen) != UNUR_SUCCESS) || + (_unur_hist_make_guidetable(gen) != UNUR_SUCCESS) ) { + _unur_hist_free(gen); return NULL; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_hist_debug_init(gen); +#endif + + return gen; + +} /* end of _unur_hist_init() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_hist_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_HIST_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_hist_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_HIST_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_hist_getSAMPLE(gen); + gen->destroy = _unur_hist_free; + gen->clone = _unur_hist_clone; + + /* make sure that the domain coincides with bin data */ + if (DISTR.hist_bins) { + DISTR.hmin = DISTR.hist_bins[0]; + DISTR.hmax = DISTR.hist_bins[DISTR.n_hist]; + } + + /* copy observed data into generator object */ + GEN->n_hist = DISTR.n_hist; /* size of histogram */ + GEN->prob = DISTR.hist_prob; /* probabilities of bins */ + GEN->hmin = DISTR.hmin; /* lower ... */ + GEN->hmax = DISTR.hmax; /* ... and upper bound */ + GEN->hwidth = (DISTR.hmax - DISTR.hmin) / DISTR.n_hist; + GEN->bins = (DISTR.hist_bins) ? DISTR.hist_bins : NULL; + + /* set all pointers to NULL */ + GEN->sum = 0.; + GEN->cumpv = NULL; + GEN->guide_table = NULL; + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_hist_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_hist_create() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_hist_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_hist_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_HIST_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* copy histrogram into generator object */ + CLONE->prob = clone->distr->data.cemp.hist_prob; /* probabilities of bins */ + CLONE->bins = clone->distr->data.cemp.hist_bins; /* location of bins */ + + /* copy data for distribution */ + CLONE->cumpv = _unur_xmalloc( GEN->n_hist * sizeof(double) ); + memcpy( CLONE->cumpv, GEN->cumpv, GEN->n_hist * sizeof(double) ); + CLONE->guide_table = _unur_xmalloc( GEN->n_hist * sizeof(int) ); + memcpy( CLONE->guide_table, GEN->guide_table, GEN->n_hist * sizeof(int) ); + + return clone; + +#undef CLONE +} /* end of _unur_hist_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_hist_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_HIST ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_HIST_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free two auxiliary tables */ + if (GEN->guide_table) free(GEN->guide_table); + if (GEN->cumpv) free(GEN->cumpv); + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_hist_free() */ + +/*****************************************************************************/ + +double +_unur_hist_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U; + int J; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_HIST_GEN,UNUR_INFINITY); + + /* sample from U(0,1) */ + U = _unur_call_urng(gen->urng); + + /* look up in guide table ... */ + J = GEN->guide_table[(int)(U * GEN->n_hist)]; + /* ... and search */ + U *= GEN->sum; + while (GEN->cumpv[J] < U) J++; + + /* reuse of uniform random number: U ~ U(0,1) */ + U = (U - (J ? GEN->cumpv[J-1] : 0.)) / GEN->prob[J]; + + /* sample uniformly from bin */ + if (GEN->bins) + return (U * GEN->bins[J+1] + (1.-U) * GEN->bins[J]); + else + return (GEN->hmin + (U+J)*GEN->hwidth); + +} /* end of _unur_hist_sample() */ + + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_hist_create_tables( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* create (allocate) tables */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* allocation for cummulated probabilities */ + GEN->cumpv = _unur_xrealloc( GEN->cumpv, GEN->n_hist * sizeof(double) ); + + /* allocate memory for the guide table */ + GEN->guide_table = _unur_xrealloc( GEN->guide_table, GEN->n_hist * sizeof(int) ); + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_hist_create_tables() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_hist_make_guidetable( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* create guide table */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double *pv; /* pointer to probability vector */ + int n_pv; /* length of probability vector */ + double pvh; /* aux variable for computing cumulated sums */ + double gstep; /* step size when computing guide table */ + int i,j; + + /* probability vector */ + pv = GEN->prob; + n_pv = GEN->n_hist; + + /* computation of cumulated probabilities */ + for( i=0, pvh=0.; icumpv[i] = ( pvh += pv[i] ); + /* ... and check probability vector */ + if (pv[i] < 0.) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"probability < 0"); + return UNUR_ERR_GEN_DATA; + } + } + GEN->sum = GEN->cumpv[n_pv-1]; + + /* computation of guide-table */ + gstep = GEN->sum / GEN->n_hist; + pvh = 0.; + for( j=0, i=0; jn_hist;j++ ) { + while (GEN->cumpv[i] < pvh) + i++; + if (i >= n_pv) { + _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF,"guide table"); + break; + } + GEN->guide_table[j] = i; + pvh += gstep; + } + + /* if there has been an round off error, we have to complete the guide table */ + for( ; jn_hist; j++ ) + GEN->guide_table[j] = n_pv - 1; + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_hist_make_urntable() */ + + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_hist_debug_init( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HIST_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = HIST (HISTogram of empirical distribution)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cemp_debug( gen->distr, gen->genid, (gen->debug & HIST_DEBUG_PRINTHIST)); + + fprintf(LOG,"%s: sampling routine = _unur_hist_sample()\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_hist_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_hist_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = DATA [histogram of size=%d]\n", DISTR.n_hist); + _unur_string_append(info,"\n"); + + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + + /* method */ + _unur_string_append(info,"method: HIST (HISTogram of empirical distribution)\n"); + _unur_string_append(info,"\n"); + + /* performance */ + /* _unur_string_append(info,"performance characteristics:\n"); */ + /* _unur_string_append(info,"\n"); */ + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters: none\n"); + _unur_string_append(info,"\n"); + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_hist_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/hist.h b/vendor/unuran-1.11.0/src/methods/hist.h new file mode 100644 index 0000000..722a762 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/hist.h @@ -0,0 +1,81 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: hist.h * + * * + * PURPOSE: * + * function prototypes for method HIST * + * (HISTogram of empirical distribution) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD HIST HISTogramm of empirical distribution + + =UP Methods_for_CEMP + + =REQUIRED histogram + + =SPEED Set-up: moderate, + Sampling: fast + + =REINIT not implemented + + =DESCRIPTION + Method HIST generates random variates from an empirical distribution + that is given as histogram. Sampling is done using the inversion + method. + + If observed (raw) data are provided we recommend method EMPK + (@pxref{EMPK,,EMPirical distribution with Kernel smoothing}) + instead of compting a histogram as this reduces information. + + =HOWTOUSE + Method HIST uses empirical distributions that are given as a + histgram. There are no optional parameters. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_hist_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/methods/hist_struct.h b/vendor/unuran-1.11.0/src/methods/hist_struct.h new file mode 100644 index 0000000..cba2cf1 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/hist_struct.h @@ -0,0 +1,59 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: hist_struct.h * + * * + * PURPOSE: * + * declares structures for method HIST * + * (HISTogram of empirical distribution) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_hist_par { + /* the histogram is stored in the distribution object */ + int dummy; +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_hist_gen { + int n_hist; /* number of bins in histogram */ + double *prob; /* probabilities for bins */ + double *bins; /* location of bins (when different width) */ + double hmin, hmax; /* lower and upper bound for histogram */ + double hwidth; /* width of bins (when equal width) */ + double sum; /* sum of all probabilities = cumpv[len-1] */ + double *cumpv; /* pointer to the vector of cumulated probabilities */ + int *guide_table; /* pointer to guide table */ +}; + +/*---------------------------------------------------------------------------*/ + + diff --git a/vendor/unuran-1.11.0/src/methods/hitro.c b/vendor/unuran-1.11.0/src/methods/hitro.c new file mode 100644 index 0000000..a85f2a4 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/hitro.c @@ -0,0 +1,1912 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: hitro.c * + * * + * TYPE: continuous multivariate random variate * + * METHOD: HITRO sampler using full conditional distributions. * + * * + * DESCRIPTION: * + * Given PDF * + * Produce a value x consistent with its density * + * * + * REQUIRED: * + * pointer to the density function and its derivatives * + * * + * OPTIONAL: * + * mode of the density * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "arou.h" +#include "x_gen.h" +#include "x_gen_source.h" + +#include "hitro.h" +#include "hitro_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + + +/*---------------------------------------------------------------------------*/ +/* Constants */ + +/* minimum value for multiplier (same number also appears in error message) */ +#define HITRO_MIN_MULTIPLIER (1.0001) + +/* starting value for u and v bounds when not provided by user */ +#define HITRO_START_UVMIN (1.e-3) + +/* increase size of adaptive bounding rectangle by this factor */ +#define HITRO_DEFAULT_ADAPTIVE_MULTIPLIER (1.1) + +/*---------------------------------------------------------------------------*/ +/* Variants */ + +#define HITRO_VARMASK_VARIANT 0x000fu /* indicates variant */ +#define HITRO_VARIANT_COORD 0x0001u /* coordinate sampler */ +#define HITRO_VARIANT_RANDOMDIR 0x0002u /* random direction sampler */ + +#define HITRO_VARFLAG_ADAPTLINE 0x0010u /* use adaptive line sampling */ +#define HITRO_VARFLAG_ADAPTRECT 0x0020u /* use adaptive bounding rectangle */ +#define HITRO_VARFLAG_BOUNDRECT 0x0040u /* use entire bounding rectangle */ +#define HITRO_VARFLAG_BOUNDDOMAIN 0x0080u /* use bounded domain (if given) */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define HITRO_SET_R 0x0001u /* set parameter r */ +#define HITRO_SET_X0 0x0002u /* set starting point */ +#define HITRO_SET_THINNING 0x0004u /* set thinning factor */ +#define HITRO_SET_BURNIN 0x0008u /* set length of burn-in */ +#define HITRO_SET_U 0x0010u /* set u-boundaries of bounding rectangles */ +#define HITRO_SET_V 0x0020u /* set upper v-bound of bounding rectangles */ + +#define HITRO_SET_ADAPTLINE 0x0100u /* set adaptive line sampling */ +#define HITRO_SET_ADAPTRECT 0x0200u /* set adaptive bounding rectangle */ +#define HITRO_SET_BOUNDRECT 0x0400u /* set entire bounding rectangle */ +#define HITRO_SET_ADAPTMULT 0x0800u /* set multiplier for adaptive rectangles */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "HITRO" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_hitro_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_hitro_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_hitro_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hitro_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_hitro_coord_sample_cvec( struct unur_gen *gen, double *vec ); +static int _unur_hitro_randomdir_sample_cvec( struct unur_gen *gen, double *vec ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static int _unur_hitro_rectangle( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* compute (minimal) bounding rectangle. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hitro_xy_to_vu( const struct unur_gen *gen, const double *x, double y, double *vu ); +static void _unur_hitro_vu_to_x( const struct unur_gen *gen, const double *vu, double *x ); +/*---------------------------------------------------------------------------*/ +/* transforming between coordinates xy in original scale and */ +/* coordinates vu in Ratio-of-Unforms scale. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_hitro_xv_to_u( const struct unur_gen *gen, double x, double v, int k ); +/*---------------------------------------------------------------------------*/ +/* transform point where we are given the v-coordinate (in RoU scale) */ +/* and the k-th x-coordinate (in xy scale). */ +/*---------------------------------------------------------------------------*/ + +static int _unur_hitro_vu_is_inside_region( const struct unur_gen *gen, const double *vu ); +/*---------------------------------------------------------------------------*/ +/* check whether point with vu-coordinates is inside acceptance region */ +/* of RoU method. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_hitro_normalgen( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* create a normal random variate generator */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hitro_random_unitvector( struct unur_gen *gen, double *direction ); +/*---------------------------------------------------------------------------*/ +/* generate a random direction vector */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hitro_debug_init_start( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print before init of generator starts. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hitro_debug_init_finished( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hitro_debug_free( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print before generater is destroyed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_hitro_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cvec /* data for distribution object */ + +#define PAR ((struct unur_hitro_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_hitro_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cvec /* data for distribution in generator object */ +#define SAMPLE gen->sample.cvec /* pointer to sampling routine */ + +#define PDF(x) _unur_cvec_PDF((x),(gen->distr)) /* call to PDF */ + +/* an auxiliary generator for standard normal variates */ +#define GEN_NORMAL gen->gen_aux + +/*---------------------------------------------------------------------------*/ + +static UNUR_SAMPLING_ROUTINE_CVEC * +_unur_hitro_getSAMPLE( struct unur_gen *gen ) +{ + switch (gen->variant & HITRO_VARMASK_VARIANT) { + case HITRO_VARIANT_COORD: + return _unur_hitro_coord_sample_cvec; + case HITRO_VARIANT_RANDOMDIR: + default: + return _unur_hitro_randomdir_sample_cvec; + } +} /* end of _unur_hitro_getSAMPLE() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_hitro_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CVEC) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CVEC,NULL); + + if (DISTR_IN.pdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); + return NULL; + } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_hitro_par) ); + COOKIE_SET(par,CK_HITRO_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + par->method = UNUR_METH_HITRO ; /* method */ + par->variant = ( HITRO_VARIANT_COORD | /* default variant */ + HITRO_VARFLAG_ADAPTLINE ); /* see also _unur_hitro_init() */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + PAR->r = 1.; /* parameter r */ + PAR->thinning = 1; /* thinning factor */ + PAR->burnin = 0; /* length of burn-in for chain */ + PAR->x0 = NULL; /* starting point of chain, default is 0 */ + PAR->adaptive_mult = HITRO_DEFAULT_ADAPTIVE_MULTIPLIER; /* multiplier for adaptive rectangles */ + + PAR->vmax = -1.; /* v-boundary of bounding rectangle (unknown) */ + PAR->umin = NULL; /* u-boundary of bounding rectangle (unknown) */ + PAR->umax = NULL; /* u-boundary of bounding rectangle (unknown) */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_hitro_init; + + return par; + +} /* end of unur_hitro_new() */ + +/*****************************************************************************/ + +int +unur_hitro_set_variant_coordinate( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* Coordinate Sampler : */ + /* Sampling along the coordinate directions (cyclic). */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HITRO ); + + /* we use a bit in variant */ + par->variant = (par->variant & ~HITRO_VARMASK_VARIANT) | HITRO_VARIANT_COORD; + + /* ok */ + return UNUR_SUCCESS; +} /* end of unur_hitro_set_variant_coordinate() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hitro_set_variant_random_direction( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* Random Direction Sampler : */ + /* Sampling along the random directions. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HITRO ); + + /* we use a bit in variant */ + par->variant = (par->variant & ~HITRO_VARMASK_VARIANT) | HITRO_VARIANT_RANDOMDIR; + + /* ok */ + return UNUR_SUCCESS; +} /* end of unur_hitro_set_variant_coordinate() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hitro_set_use_adaptiveline( struct unur_par *par, int adaptive ) + /*----------------------------------------------------------------------*/ + /* Enable/Disable adaptive line sampling */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* adaptive ... whether adaptive line sampling is enabled */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HITRO ); + + /* we use a bit in variant */ + par->variant = (adaptive) + ? (par->variant | HITRO_VARFLAG_ADAPTLINE) + : (par->variant & (~HITRO_VARFLAG_ADAPTLINE)); + + /* changelog */ + par->set |= HITRO_SET_ADAPTLINE; + + /* ok */ + return UNUR_SUCCESS; +} /* end of unur_hitro_set_use_adaptiveline() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hitro_set_use_adaptiverectangle( struct unur_par *par, int adaptive ) + /*----------------------------------------------------------------------*/ + /* Enable/Disable adaptive bounding rectangle */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* adaptive ... whether adaptive rectangle is enabled */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HITRO ); + + /* we use a bit in variant */ + par->variant = (adaptive) + ? (par->variant | HITRO_VARFLAG_ADAPTRECT) + : (par->variant & (~HITRO_VARFLAG_ADAPTRECT)); + + /* changelog */ + par->set |= HITRO_SET_ADAPTRECT; + + /* ok */ + return UNUR_SUCCESS; +} /* end of unur_hitro_set_use_adaptiverectangle() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hitro_set_use_boundingrectangle( struct unur_par *par, int rectangle ) + /*----------------------------------------------------------------------*/ + /* Whether to use entire bounding rectangle or just upper bound */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* rectangle ... whether using entire bounding rectangle is enabled */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HITRO ); + + /* we use a bit in variant */ + par->variant = (rectangle) + ? (par->variant | HITRO_VARFLAG_BOUNDRECT) + : (par->variant & (~HITRO_VARFLAG_BOUNDRECT)); + + /* changelog */ + par->set |= HITRO_SET_BOUNDRECT; + + /* ok */ + return UNUR_SUCCESS; +} /* end of unur_hitro_set_use_adaptiverectangle() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hitro_set_r( struct unur_par *par, double r ) + /*----------------------------------------------------------------------*/ + /* set parameter r for ratio-of-uniforms */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* r ... parameter r */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HITRO ); + + /* check new parameter for generator */ + if (r <= 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"r <= 0"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->r = r; + + /* changelog */ + par->set |= HITRO_SET_R; + + return UNUR_SUCCESS; + +} /* end of unur_hitro_set_r() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hitro_set_u( struct unur_par *par, const double *umin, const double *umax ) + /*----------------------------------------------------------------------*/ + /* u-boundaries for bounding rectangle */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* umin ... lower left boundary of rectangle */ + /* umax ... upper right boundary of rectangle */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int d; + + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HITRO ); + _unur_check_NULL( GENTYPE, umin, UNUR_ERR_NULL ); + _unur_check_NULL( GENTYPE, umax, UNUR_ERR_NULL ); + + /* check new parameter for generator */ + for (d = 0; d < par->distr->dim; d++) { + if (!_unur_FP_greater(umax[d],umin[d])) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"umax <= umin"); + return UNUR_ERR_PAR_SET; + } + if (! (_unur_isfinite(umax[d]) && _unur_isfinite(umin[d])) ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"rectangle not bounded"); + return UNUR_ERR_PAR_SET; + } + } + + /* set values */ + PAR->umin = umin; + PAR->umax = umax; + + /* changelog */ + par->set |= HITRO_SET_U; + + /* ok */ + return UNUR_SUCCESS; + +} /* end of unur_hitro_set_u() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hitro_set_v( struct unur_par *par, double vmax ) + /*----------------------------------------------------------------------*/ + /* upper v-bound for bounding rectangle */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* vmax ... upper bound of rectangle */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HITRO ); + + /* check new parameter for generator */ + if (vmax <= 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"vmax <= 0"); + return UNUR_ERR_PAR_SET; + } + if (! _unur_isfinite(vmax) ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"rectangle not bounded"); + return UNUR_ERR_PAR_SET; + } + + /* store values */ + PAR->vmax = vmax; + + /* changelog */ + par->set |= HITRO_SET_V; + + /* ok */ + return UNUR_SUCCESS; + +} /* end of unur_hitro_set_v() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hitro_set_adaptive_multiplier( struct unur_par *par, double factor ) + /*----------------------------------------------------------------------*/ + /* set multiplier for adaptive rectangles */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* factor ... multiplier */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HITRO ); + + /* check new parameter for generator */ + if (factor < HITRO_MIN_MULTIPLIER) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"multiplier too small (<= 1.0001)"); + return UNUR_ERR_PAR_SET; + } + + /* store data */ + PAR->adaptive_mult = factor; + + /* changelog */ + par->set |= HITRO_SET_ADAPTMULT; + + /* ok */ + return UNUR_SUCCESS; + +} /* end of unur_hitro_set_adaptive_multiplier() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hitro_set_startingpoint( struct unur_par *par, const double *x0) + /*----------------------------------------------------------------------*/ + /* set starting point for chain */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* x0 ... starting point of chain */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HITRO ); + + /* store data */ + PAR->x0 = x0; + + /* changelog */ + par->set |= HITRO_SET_X0; + + /* ok */ + return UNUR_SUCCESS; +} /* end of unur_hitro_set_startingpoint() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hitro_set_thinning( struct unur_par *par, int thinning ) + /*----------------------------------------------------------------------*/ + /* set thinning factor for chain */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* thinning ... thinning factor */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HITRO ); + + /* check new parameter for generator */ + if (thinning < 1) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"thinning < 1"); + return UNUR_ERR_PAR_SET; + } + + /* store data */ + PAR->thinning = thinning; + + /* changelog */ + par->set |= HITRO_SET_THINNING; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_hitro_set_thinning() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hitro_set_burnin( struct unur_par *par, int burnin ) + /*----------------------------------------------------------------------*/ + /* set length of burn-in for chain */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* burnin ... length of burn-in */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HITRO ); + + /* check new parameter for generator */ + if (burnin < 0) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"burnin < 0"); + return UNUR_ERR_PAR_SET; + } + + /* store data */ + PAR->burnin = burnin; + + /* changelog */ + par->set |= HITRO_SET_BURNIN; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_hitro_set_burnin() */ + +/*---------------------------------------------------------------------------*/ + +const double * +unur_hitro_get_state( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get current state of the HITRO chain */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to chain ... on success */ + /* NULL ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, NULL ); + if (gen->method != UNUR_METH_HITRO) { + _unur_error(gen->genid, UNUR_ERR_GEN_INVALID,""); + return NULL; + } + + return GEN->state; +} /* end of unur_hitro_get_state() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hitro_chg_state( struct unur_gen *gen, const double *state ) + /*----------------------------------------------------------------------*/ + /* chg current state of the HITRO chain */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* state ... new state of chain */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, HITRO, UNUR_ERR_GEN_INVALID ); + _unur_check_NULL( gen->genid, state, UNUR_ERR_NULL ); + + /* check input */ + if ( ! _unur_hitro_vu_is_inside_region(gen,state) ) { + _unur_warning(gen->genid,UNUR_ERR_PAR_SET,"invalid state"); + return UNUR_ERR_PAR_SET; + } + + /* copy state */ + memcpy( GEN->state, state, GEN->dim * sizeof(double)); + + return UNUR_SUCCESS; +} /* end of unur_hitro_chg_state() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hitro_reset_state( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* reset current state of the HITRO chain to starting point */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, HITRO, UNUR_ERR_GEN_INVALID ); + + /* copy state */ + memcpy( GEN->state, GEN->x0, GEN->dim * sizeof(double)); + + /* set state to start from */ + _unur_hitro_xy_to_vu(gen, GEN->x0, GEN->fx0/2., GEN->state ); + memcpy( GEN->vu, GEN->state, (GEN->dim + 1) * sizeof(double) ); + GEN->vumax[0] = pow(GEN->fx0, 1./(GEN->r * GEN->dim + 1.)) * (1. + DBL_EPSILON); + + if (gen->variant & HITRO_VARIANT_COORD) GEN->coord = 0; + + return UNUR_SUCCESS; +} /* end of unur_hitro_reset_state() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_hitro_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + _unur_check_NULL( GENTYPE,par,NULL ); + + /* check input */ + if ( par->method != UNUR_METH_HITRO ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_HITRO_PAR,NULL); + + /* check variant flags */ + /* ( we assume here that + par->variant & (HITRO_VARFLAG_ADAPTRECT | HITRO_VARFLAG_BOUNDRECT) + are set to 0 in unur_hitro_new() + */ + if ( par->variant & HITRO_VARIANT_COORD ) { + /* coordinate direction sampling; not all variants are allowed */ + + if (_unur_distr_cvec_has_boundeddomain(par->distr)) + /* we must have a bounded rectangular domain ... */ + par->variant |= HITRO_VARFLAG_BOUNDDOMAIN; + else + /* ... or a bounding rectangle for acceptance region */ + par->variant |= HITRO_VARFLAG_BOUNDRECT; + + /* we do not override the flag set by user for adaptive rectangle */ + if (!(par->set & HITRO_SET_ADAPTRECT) ) + par->variant |= HITRO_VARFLAG_ADAPTRECT; + } + + /* create a new empty generator object */ + gen = _unur_hitro_create(par); + _unur_par_free(par); + if (!gen) return NULL; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_hitro_debug_init_start(gen); +#endif + + /* we need a starting point for our chain */ + GEN->fx0 = PDF(GEN->x0); + if ( (GEN->fx0 / 2.) <= 0.) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"x0 not in support of PDF"); + _unur_hitro_free(gen); return NULL; + } + /* set state to start from */ + _unur_hitro_xy_to_vu(gen, GEN->x0, GEN->fx0/2., GEN->state ); + memcpy( GEN->vu, GEN->state, (GEN->dim + 1) * sizeof(double) ); + GEN->vumax[0] = pow(GEN->fx0, 1./(GEN->r * GEN->dim + 1.)) * (1. + DBL_EPSILON); + + /* routines for sampling and destroying generator */ + if (gen->variant & HITRO_VARIANT_RANDOMDIR ) { + /* we need an auxiliary generator for normal random variates */ + GEN_NORMAL = _unur_hitro_normalgen( gen ); + if ( GEN_NORMAL == NULL ) { + _unur_hitro_free(gen); return NULL; + } + } + + /* computing required data about bounding rectangle */ + if ( !(gen->variant & HITRO_VARFLAG_ADAPTRECT) ) + if (_unur_hitro_rectangle(gen) != UNUR_SUCCESS ) { + _unur_hitro_free(gen); return NULL; + } + /* else + we use an adaptive bounding rectangle --> nothing to do here */ + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_hitro_debug_init_finished(gen); +#endif + + /* run burn-in */ + if (GEN->burnin > 0 ) { + int thinning, burnin; + double *X; + + /* allocate memory for random vector */ + X = _unur_xmalloc( GEN->dim * sizeof(double) ); + + /* store thinning factor; we use 1 for burn-in */ + thinning = GEN->thinning; + GEN->thinning = 1; + + for (burnin = GEN->burnin; burnin>0; --burnin) + _unur_sample_vec(gen,X); + + /* restore thinning factor */ + GEN->thinning = thinning; + /* free memory for random vector */ + free (X); + } + + /* creation of generator object successfull */ + gen->status = UNUR_SUCCESS; + + /* o.k. */ + return gen; + +} /* end of _unur_hitro_init() */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen * +_unur_hitro_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + int i; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_HITRO_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_hitro_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_HITRO_GEN); + + /* dimension of distribution */ + GEN->dim = gen->distr->dim; + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_hitro_getSAMPLE(gen); + gen->destroy = _unur_hitro_free; + gen->clone = _unur_hitro_clone; + + /* variant of sampling method */ + gen->variant = par->variant; + + /* copy parameters into generator object */ + GEN->thinning = PAR->thinning; /* thinning factor */ + GEN->burnin = PAR->burnin; /* length of burnin */ + GEN->r = PAR->r; /* parameter r for RoU */ + GEN->adaptive_mult = PAR->adaptive_mult; /* multiplier for adaptive rectangles */ + + /* get center of the distribution */ + GEN->center = unur_distr_cvec_get_center(gen->distr); + + /* store starting point / get default starting point */ + GEN->x0 = _unur_xmalloc( GEN->dim * sizeof(double)); + if (PAR->x0 == NULL) + PAR->x0 = unur_distr_cvec_get_center(gen->distr); + memcpy( GEN->x0, PAR->x0, GEN->dim * sizeof(double)); + + /* bounding rectangle */ + GEN->vumin = _unur_xmalloc( (GEN->dim+1) * sizeof(double) ); + GEN->vumax = _unur_xmalloc( (GEN->dim+1) * sizeof(double) ); + /* bounding rectangle v-coordinate */ + GEN->vumin[0] = 0.; + GEN->vumax[0] = (PAR->vmax > 0.) ? PAR->vmax : HITRO_START_UVMIN; + /* lower left and upper right vertex of bounding rectangle in u-hyperplane */ + if (gen->variant & HITRO_VARFLAG_BOUNDRECT) { + if (PAR->umin && PAR->umax) { + memcpy (GEN->vumin+1, PAR->umin, GEN->dim * sizeof(double) ); + memcpy (GEN->vumax+1, PAR->umax, GEN->dim * sizeof(double) ); + } + else { + for (i=1; idim+1; i++) GEN->vumin[i] = -HITRO_START_UVMIN; + for (i=1; idim+1; i++) GEN->vumax[i] = HITRO_START_UVMIN; + } + } + /* else: we do not need the u-bounds */ + + /* initialize remaining pointers */ + GEN->state = _unur_xmalloc( (1 + GEN->dim) * sizeof(double) ); + GEN->x = _unur_xmalloc( GEN->dim * sizeof(double) ); + GEN->vu = _unur_xmalloc( (1 + GEN->dim) * sizeof(double) ); + + /* allocate memory for random direction */ + GEN->direction = _unur_xmalloc( (1 + GEN->dim) * sizeof(double)); + + /* defaults */ + GEN->coord = 0; /* current coordinate of HITRO chain. */ + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_hitro_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_hitro_create() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_hitro_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_hitro_gen*)clone->datap) + +/* int i; */ + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_HITRO_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* get center of the distribution */ + CLONE->center = unur_distr_cvec_get_center(clone->distr); + + /* copy state */ + if (GEN->state) { + CLONE->state = _unur_xmalloc( (1 + GEN->dim) * sizeof(double) ); + memcpy( CLONE->state, GEN->state, (1 + GEN->dim) * sizeof(double) ); + } + if (GEN->vumin) { + CLONE->vumin = _unur_xmalloc( (GEN->dim+1) * sizeof(double) ); + memcpy( CLONE->vumin, GEN->vumin, (GEN->dim+1) * sizeof(double) ); + } + if (GEN->vumax) { + CLONE->vumax = _unur_xmalloc( (GEN->dim+1) * sizeof(double) ); + memcpy( CLONE->vumax, GEN->vumax, (GEN->dim+1) * sizeof(double) ); + } + + /* copy starting points */ + if (GEN->x0) { + CLONE->x0 = _unur_xmalloc( GEN->dim * sizeof(double)); + memcpy( CLONE->x0, GEN->x0, GEN->dim * sizeof(double)); + } + + /* working array */ + if (GEN->x) { + CLONE->x = _unur_xmalloc( GEN->dim * sizeof(double) ); + memcpy( CLONE->x, GEN->x, GEN->dim * sizeof(double) ); + } + if (GEN->vu) { + CLONE->vu = _unur_xmalloc( (1 + GEN->dim) * sizeof(double) ); + memcpy( CLONE->vu, GEN->vu, (1 + GEN->dim) * sizeof(double) ); + } + if (GEN->direction) { + CLONE->direction = _unur_xmalloc( (1 + GEN->dim) * sizeof(double)); + memcpy( CLONE->direction, GEN->direction, (1 + GEN->dim) * sizeof(double)); + } + + return clone; + +#undef CLONE +} /* end of _unur_hitro_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_hitro_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_HITRO ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_HITRO_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_hitro_debug_free(gen); +#endif + + /* free vectors */ + if (GEN->state) free (GEN->state); + if (GEN->x0) free (GEN->x0); + if (GEN->x) free (GEN->x); + if (GEN->vu) free (GEN->vu); + if (GEN->direction) free (GEN->direction); + if (GEN->vumin) free (GEN->vumin); + if (GEN->vumax) free (GEN->vumax); + + _unur_generic_free(gen); + +} /* end of _unur_hitro_free() */ + +/*****************************************************************************/ + +int +_unur_hitro_coord_sample_cvec( struct unur_gen *gen, double *vec ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* vec ... random vector (result) */ + /*----------------------------------------------------------------------*/ +{ + int thinning; + double lmin, lmax, lmid; /* l.h.s., r.h.s. endpoint and midpoint of line segment */ + double *vuaux; /* pointer to auxiliary working array */ + int coord; /* direction */ + double U; /* uniform random number */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_HITRO_GEN,UNUR_ERR_COOKIE); + + /* pointer to auxiliary working array */ + vuaux = GEN->vu; + + for (thinning = GEN->thinning; thinning > 0; --thinning) { + + /* update coordinate direction */ + coord = GEN->coord = (GEN->coord + 1) % (GEN->dim + 1); + + /* --- l.h.s. and r.h.s. endpoints of line segment --- */ + if (! (gen->variant & HITRO_VARFLAG_BOUNDDOMAIN) || coord == 0) { + /* no bounded domain or v coordinate */ + lmin = GEN->vumin[coord]; + lmax = GEN->vumax[coord]; + } + else { + /* bounded domain; we look at one of the u-coordinates */ + int k = coord-1; + double *domain = DISTR.domainrect; + lmin = _unur_hitro_xv_to_u(gen, domain[2*k], vuaux[0], k ); + lmax = _unur_hitro_xv_to_u(gen, domain[2*k+1], vuaux[0], k ); + if (gen->variant & HITRO_VARFLAG_BOUNDRECT) { + /* we also have a bounded domain; look whether this leads to shorter intervals */ + lmin = _unur_max(lmin,GEN->vumin[coord]); + lmax = _unur_min(lmax,GEN->vumax[coord]); + } + } + + /* --- adaptive bounding rectangle --- */ + if ( gen->variant & HITRO_VARFLAG_ADAPTRECT ) { + lmid = 0.5 * (lmin + lmax); + /* check whether endpoint is outside of region */ + vuaux[coord] = lmax; + while ( _unur_hitro_vu_is_inside_region(gen,vuaux) ) { + lmax = lmid + (lmax-lmid) * GEN->adaptive_mult; + GEN->vumax[coord] = vuaux[coord] = lmax; + } + vuaux[coord] = lmin; + /* no update of lmin in case of coord == 0 since v-coordinate always > 0 */ + while ( coord!=0 && _unur_hitro_vu_is_inside_region(gen,vuaux) ) { + lmin = lmid + (lmin-lmid) * GEN->adaptive_mult; + GEN->vumin[coord] = vuaux[coord] = lmin; + } + } + + /* --- new coordinate for next point --- */ + while (1) { + U = _unur_call_urng(gen->urng); + vuaux[coord] = U * lmin + (1.-U) * lmax; + if (_unur_hitro_vu_is_inside_region(gen,vuaux) ) + break; + + /* --- adaptive line sampling --- */ + if ( gen->variant & HITRO_VARFLAG_ADAPTLINE ) { + if (GEN->state[coord] < vuaux[coord]) + lmax = vuaux[coord]; + else + lmin = vuaux[coord]; + } + } + + /* store new state */ + GEN->state[coord] = vuaux[coord]; + } + + /* transform current state into point in original scale */ + _unur_hitro_vu_to_x( gen, GEN->state, vec ); + + return UNUR_SUCCESS; + +} /* end of _unur_hitro_coord_sample_cvec() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_hitro_randomdir_sample_cvec( struct unur_gen *gen, double *vec ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* vec ... random vector (result) */ + /*----------------------------------------------------------------------*/ +{ +#define new_point(ll) { int j; for (j=0;jstate[j]+(ll)*GEN->direction[j]; } + + int thinning; + int i, d, k; + double lambda, lb[2]; /* line segments, endpoints */ + double *vuaux; /* pointer to auxiliary working array */ + double U; + int update; + int dim = GEN->dim; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_HITRO_GEN,UNUR_ERR_COOKIE); + + /* entire bounding rectangle or just covering plate ? */ + d = (gen->variant & HITRO_VARFLAG_BOUNDRECT) ? dim+1 : 1; + + /* pointer to auxiliary working array */ + vuaux = GEN->vu; + + for (thinning = GEN->thinning; thinning > 0; --thinning) { + + /* new random direction */ + _unur_hitro_random_unitvector( gen, GEN->direction ); + + /* --- l.h.s. and r.h.s. endpoint of line segment --- */ + lb[1] = UNUR_INFINITY; + lb[0] = -UNUR_INFINITY; + for (i=0; ivumin[i] - GEN->state[i]) / GEN->direction[i]; + if (lambda>0 && lambdalb[0]) lb[0] = lambda; + lambda = (GEN->vumax[i] - GEN->state[i]) / GEN->direction[i]; + if (lambda>0 && lambdalb[0]) lb[0] = lambda; + } + if (! (_unur_isfinite(lb[0]) && _unur_isfinite(lb[1])) ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"line segment not bounded, try again"); + continue; + } + + /* --- adaptive bounding rectangle --- */ + if ( gen->variant & HITRO_VARFLAG_ADAPTRECT ) { + /* check whether endpoint is outside of region */ + for (k=0; k<2; k++) { + update = FALSE; + while (1) { + new_point(lb[k]); + if (! _unur_hitro_vu_is_inside_region(gen,vuaux) ) + break; + update = TRUE; + lb[k] *= GEN->adaptive_mult; + } + if (update) { + /* we have to update vumin and vmax */ + new_point(lb[k]); + for (i=0; ivumin[i] && i!=0) GEN->vumin[i] = vuaux[i]; + if (vuaux[i] > GEN->vumax[i]) GEN->vumax[i] = vuaux[i]; + /* remark: vmin is always 0 */ + } + } + } + } + + /* --- new coordinate for next point --- */ + while (1) { + U = _unur_call_urng(gen->urng); + lambda = U * lb[0] + (1.-U) * lb[1]; + new_point(lambda); + if (_unur_hitro_vu_is_inside_region(gen,vuaux) ) + break; + + /* --- adaptive line sampling --- */ + if ( gen->variant & HITRO_VARFLAG_ADAPTLINE ) { + if (lambda < 0) lb[0] = lambda; + else lb[1] = lambda; + } + } + + /* store new state */ + memcpy( GEN->state, vuaux, (dim+1)*sizeof(double) ); + } + + /* transform current state into point in original scale */ + _unur_hitro_vu_to_x( gen, GEN->state, vec ); + + return UNUR_SUCCESS; + +#undef new_point + +} /* end of _unur_hitro_randomdir_sample_cvec() */ + + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_hitro_rectangle( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* compute bounding rectangle */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + + int d; /* index used in dimension loops (0 <= d < dim) */ + struct MROU_RECTANGLE *rr; + + /* check arguments */ + CHECK_NULL( gen, UNUR_ERR_NULL ); + COOKIE_CHECK( gen,CK_HITRO_GEN, UNUR_ERR_COOKIE ); + + /* Boundary rectangle is already set ? */ + if ((gen->set & HITRO_SET_U) && (gen->set & HITRO_SET_V)) + return UNUR_SUCCESS; + + /* Allocating and filling mrou_rectangle struct */ + rr = _unur_mrou_rectangle_new(); + + rr->distr = gen->distr; + rr->dim = GEN->dim; + rr->umin = GEN->vumin+1; + rr->umax = GEN->vumax+1; + rr->r = GEN->r; + rr->center = GEN->center; + rr->genid = gen->genid; + rr->bounding_rectangle = + ( (gen->variant & HITRO_VARFLAG_BOUNDRECT) && !(gen->set & HITRO_SET_U) ) + ? 1 : 0; + + /* calculate bounding rectangle */ + if ( _unur_mrou_rectangle_compute(rr) != UNUR_SUCCESS ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"Cannot compute bounding rectangle, try adaptive"); + gen->variant &= HITRO_VARFLAG_ADAPTRECT; + free(rr); return UNUR_ERR_GEN_CONDITION; + } + + if (!(gen->set & HITRO_SET_V)) { + /* user has not provided any upper bound for v */ + GEN->vumax[0] = rr->vmax; + } + + if (rr->bounding_rectangle) { + /* user has not provided required bounds for u */ + for (d=0; ddim; d++) GEN->vumin[d+1] = rr->umin[d]; + for (d=0; ddim; d++) GEN->vumax[d+1] = rr->umax[d]; + } + + /* free working space */ + free(rr); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_hitro_rectangle() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_hitro_xv_to_u( const struct unur_gen *gen, double x, double v, int k ) + /*----------------------------------------------------------------------*/ + /* transform point where we are given the v-coordinate (in RoU scale) */ + /* and the k-th x-coordinate (in xy scale) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* x ... x coordinates of point (in original scale) */ + /* v ... v coordinate of point (in RoU scale) */ + /* k ... index of coordinate */ + /*----------------------------------------------------------------------*/ +{ + if (_unur_isone(GEN->r)) + return (x - GEN->center[k]) * v; + else + return (x - GEN->center[k]) * pow(v,GEN->r) ; +} /* end of _unur_hitro_x_to_u() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_hitro_xy_to_vu( const struct unur_gen *gen, const double *x, double y, double *vu ) + /*----------------------------------------------------------------------*/ + /* transform point with coordinates xy in the original scale into */ + /* point in RoU-scale with coordinates vu. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* x ... x coordinates of point */ + /* y ... y coordinate of point */ + /* vu ... coordinates of transformed point */ + /*----------------------------------------------------------------------*/ +{ + int d; + double v; + double *u = vu+1; + + vu[0] = v = pow(y, 1./(GEN->r * GEN->dim + 1.)); + + if (_unur_isone(GEN->r)) + for (d=0; ddim; d++) u[d] = (x[d] - GEN->center[d]) * v; + else + for (d=0; ddim; d++) u[d] = (x[d] - GEN->center[d]) * pow(v,GEN->r) ; + +} /* end of _unur_hitro_xy_to_vu() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_hitro_vu_to_x( const struct unur_gen *gen, const double *vu, double *x ) + /*----------------------------------------------------------------------*/ + /* transform point with coordinates vu in RoU-scale into original */ + /* scale with coordinates xy. The y coordinate is not of interest here */ + /* and thus omitted. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* vu ... coordinates of transformed point */ + /* x ... x coordinates of point */ + /*----------------------------------------------------------------------*/ +{ + int d; + double v = vu[0]; + const double *u = vu+1; + + if (v<=0.) { + /* we are outside of the domain --> return 0 */ + for (d=0; ddim; d++) x[d] = 0.; + return; + } + + if (_unur_isone(GEN->r)) + for (d=0; ddim; d++) x[d] = u[d]/v + GEN->center[d]; + else + for (d=0; ddim; d++) x[d] = u[d]/pow(v,GEN->r) + GEN->center[d]; + +} /* end of _unur_hitro_vu_to_x() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_hitro_vu_is_inside_region( const struct unur_gen *gen, const double *vu ) + /*----------------------------------------------------------------------*/ + /* check whether point is inside RoU acceptance region */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* vu ... point in uv space */ + /*----------------------------------------------------------------------*/ +{ + double y; + + /* v-coordinate */ + double v = vu[0]; + + /* transform into original scale */ + _unur_hitro_vu_to_x( gen, vu, GEN->x ); + + /* PDF at x */ + y = PDF(GEN->x); + + /* we are outside of domain if x is not in support of PDF or */ + /* v is non-positive. */ + if (y <= 0. || v <= 0.) return FALSE; + + /* now check whether point is in region below PDF */ + return ( (v < pow(y,1./(GEN->r * GEN->dim + 1.))) ? TRUE : FALSE ); + +} /* end of _unur_hitro_vu_is_inside_region() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_hitro_normalgen( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* create a normal random variate generator */ + /* */ + /* parameters: */ + /* gen ... pointer to HITRO generator object */ + /* */ + /* */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *normalgen; + struct unur_distr *normaldistr = unur_distr_normal(NULL,0); + struct unur_par *normalpar = unur_arou_new( normaldistr ); + + unur_arou_set_usedars( normalpar, TRUE ); + normalgen = unur_init( normalpar ); + _unur_distr_free( normaldistr ); + if (normalgen == NULL) { + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN, + "Cannot create aux Gaussian generator"); + return NULL; + } + + /* uniform random number generator and debugging flags */ + normalgen->urng = gen->urng; + normalgen->debug = gen->debug; + + return normalgen; + +} /* end of _unur_hitro_normalgen() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_hitro_random_unitvector( struct unur_gen *gen, double *direction ) + /*----------------------------------------------------------------------*/ + /* generate a random direction vector */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* direction ... random vector (result) */ + /*----------------------------------------------------------------------*/ +{ + int i; + + do { + for (i=0; idim+1; i++) + direction[i] = unur_sample_cont(GEN_NORMAL); + /* normalize direction vector */ + _unur_vector_normalize(GEN->dim+1, direction); + + /* there is an extremely small change that direction is the null before + normalizing. In this case non of its coordinates are finite. */ + } while (!_unur_isfinite(direction[0])); + +} /* end of _unur_hitro_random_unitvector() */ + + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_hitro_debug_init_start( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HITRO_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous multivariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = HITRO (Markov Chain - HITRO sampler)\n",gen->genid); + fprintf(LOG,"%s: variant = ",gen->genid); + switch (gen->variant & HITRO_VARMASK_VARIANT) { + case HITRO_VARIANT_COORD: + fprintf(LOG,"coordinate sampling [default]\n"); break; + case HITRO_VARIANT_RANDOMDIR: + fprintf(LOG,"random direction sampling\n"); break; + } + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: r = %g",gen->genid, GEN->r); + _unur_print_if_default(gen,HITRO_SET_R); + fprintf(LOG,"\n%s: adaptive line sampling: %s",gen->genid, + (gen->variant&HITRO_VARFLAG_ADAPTLINE)?"on":"off"); + _unur_print_if_default(gen,HITRO_SET_ADAPTLINE); + fprintf(LOG,"\n%s: use entire bounding rectangle: %s",gen->genid, + (gen->variant&HITRO_VARFLAG_BOUNDRECT)?"on":"off"); + _unur_print_if_default(gen,HITRO_SET_BOUNDRECT); + fprintf(LOG,"\n%s: adaptive bounding rectangle: %s",gen->genid, + (gen->variant&HITRO_VARFLAG_ADAPTRECT)?"on":"off"); + _unur_print_if_default(gen,HITRO_SET_ADAPTRECT); + if (gen->variant&HITRO_VARFLAG_ADAPTRECT) { + fprintf(LOG,"\n%s:\tmultiplier = %g",gen->genid,GEN->adaptive_mult); + _unur_print_if_default(gen,HITRO_SET_ADAPTMULT); + } + fprintf(LOG,"\n%s: use domain of distribution: %s\n",gen->genid, + (gen->variant&HITRO_VARFLAG_BOUNDDOMAIN)?"on":"off"); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cvec_debug( gen->distr, gen->genid ); + + switch (gen->variant & HITRO_VARMASK_VARIANT) { + case HITRO_VARIANT_COORD: + fprintf(LOG,"%s: sampling routine = _unur_hitro_coord_sample_cvec()\n",gen->genid); + break; + case HITRO_VARIANT_RANDOMDIR: + fprintf(LOG,"%s: sampling routine = _unur_hitro_randomdir_sample_cvec()\n",gen->genid); + break; + } + + fprintf(LOG,"%s: thinning = %d",gen->genid,GEN->thinning); + _unur_print_if_default(gen,HITRO_SET_THINNING); + fprintf(LOG,"\n%s: burn-in = %d",gen->genid,GEN->burnin); + _unur_print_if_default(gen,HITRO_SET_BURNIN); + fprintf(LOG,"\n%s:\n",gen->genid); + _unur_matrix_print_vector( GEN->dim, GEN->x0, "starting point = ", LOG, gen->genid, "\t "); + + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_hitro_debug_init_start() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_hitro_debug_init_finished( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HITRO_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + if (gen->variant & HITRO_VARFLAG_BOUNDRECT) { + fprintf(LOG,"%s: bounding rectangle%s:\n",gen->genid, + (gen->variant & HITRO_VARFLAG_ADAPTRECT) ? " [start for adaptive rectangle]" : "" ); + fprintf(LOG,"%s: vmax = %g\n",gen->genid, GEN->vumax[0]); + _unur_matrix_print_vector( GEN->dim, GEN->vumin+1, "umin =", LOG, gen->genid, "\t "); + _unur_matrix_print_vector( GEN->dim, GEN->vumax+1, "umax =", LOG, gen->genid, "\t "); + } + else { + fprintf(LOG,"%s: upper bound vmax = %g %s\n",gen->genid, GEN->vumax[0], + (gen->variant & HITRO_VARFLAG_ADAPTRECT) ? "[start for adaptive bound]" : "" ); + } + + _unur_matrix_print_vector( GEN->dim+1, GEN->state, "starting state = ", LOG, gen->genid, "\t "); + + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_hitro_debug_init_finished() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_hitro_debug_free( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HITRO_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + if (gen->status == UNUR_SUCCESS) { + fprintf(LOG,"%s: GENERATOR destroyed **********************\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + } + else { + fprintf(LOG,"%s: initialization of GENERATOR failed **********************\n",gen->genid); + } + fprintf(LOG,"%s:\n",gen->genid); + + if (gen->variant & HITRO_VARFLAG_BOUNDRECT) { + fprintf(LOG,"%s: bounding rectangle%s:\n",gen->genid, + (gen->variant & HITRO_VARFLAG_ADAPTRECT) ? " [adaptive]" : "" ); + fprintf(LOG,"%s: vmax = %g\n",gen->genid, GEN->vumax[0]); + _unur_matrix_print_vector( GEN->dim, GEN->vumin+1, "umin =", LOG, gen->genid, "\t "); + _unur_matrix_print_vector( GEN->dim, GEN->vumax+1, "umax =", LOG, gen->genid, "\t "); + } + else { + fprintf(LOG,"%s: upper bound vmax = %g %s\n",gen->genid, GEN->vumax[0], + (gen->variant & HITRO_VARFLAG_ADAPTRECT) ? "[adaptive]" : "" ); + } + + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_hitro_debug_free() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_hitro_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + int samplesize = 10000; + int i; + double rc; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," dimension = %d\n",GEN->dim); + _unur_string_append(info," functions = PDF\n"); + _unur_distr_cvec_info_domain(gen); + + if ( distr->set & UNUR_DISTR_SET_MODE ) { + _unur_string_append(info," mode = "); + _unur_distr_info_vector( gen, DISTR.mode, GEN->dim); + } + _unur_string_append(info,"\n"); + + _unur_string_append(info," center = "); + _unur_distr_info_vector( gen, GEN->center, GEN->dim); + if ( !(distr->set & UNUR_DISTR_SET_CENTER) ) { + if ( distr->set & UNUR_DISTR_SET_MODE ) + _unur_string_append(info," [= mode]"); + else + _unur_string_append(info," [default]"); + } + _unur_string_append(info,"\n\n"); + + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + + /* method */ + _unur_string_append(info,"method: HITRO (HIT-and-run sampler with Ratio-Of-uniforms [MCMC])\n"); + _unur_string_append(info," variant = %s\n", + ((gen->variant & HITRO_VARMASK_VARIANT)==HITRO_VARIANT_COORD) + ? "coordinate sampling [default]" : "random direction sampling"); + + _unur_string_append(info," r = %g\n", GEN->r); + _unur_string_append(info," thinning = %d\n", GEN->thinning); + + _unur_string_append(info," adaptive line sampling = %s\n", + (gen->variant&HITRO_VARFLAG_ADAPTLINE)?"on":"off"); + + _unur_string_append(info," use entire bounding rectangle = %s\n", + (gen->variant&HITRO_VARFLAG_BOUNDRECT)?"on":"off"); + + if (gen->variant&HITRO_VARFLAG_ADAPTRECT) + _unur_string_append(info," adaptive bounding rectangle = on [multiplier = %g]\n", + GEN->adaptive_mult); + else + _unur_string_append(info," adaptive bounding rectangle = off\n"); + + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + + rc = unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize); + + if (gen->variant & HITRO_VARFLAG_BOUNDRECT) { + _unur_string_append(info," bounding rectangle %s= ", + (gen->variant & HITRO_VARFLAG_ADAPTRECT) ? "[adaptive] " : "" ); + for (i=0; idim; i++) + _unur_string_append(info,"%s(%g,%g)", i?"x":"", GEN->vumin[i+1], GEN->vumax[i+1]); + _unur_string_append(info," x (0,%g)\n", GEN->vumax[0]); + } + else { + _unur_string_append(info," upper bound vmax = %g %s\n", GEN->vumax[0], + (gen->variant & HITRO_VARFLAG_ADAPTRECT) ? "[adaptive]" : "" ); + } + + _unur_string_append(info," rejection constant = %.2f [approx.]\n", rc); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + + switch (gen->variant & HITRO_VARMASK_VARIANT) { + case HITRO_VARIANT_COORD: + _unur_string_append(info," variant_coordinate [default]\n"); break; + case HITRO_VARIANT_RANDOMDIR: + _unur_string_append(info," variant_random_direction\n"); break; + } + + _unur_string_append(info," r = %g %s\n", GEN->r, + (gen->set & HITRO_SET_R) ? "" : "[default]"); + + _unur_string_append(info," adaptiveline = %s %s\n", + (gen->variant&HITRO_VARFLAG_ADAPTLINE)?"on":"off", + (gen->set & HITRO_SET_ADAPTLINE) ? "" : "[default]"); + + _unur_string_append(info," boundingrectangle = %s %s\n", + (gen->variant&HITRO_VARFLAG_BOUNDRECT)?"on":"off", + (gen->set & HITRO_SET_BOUNDRECT) ? "" : "[default]"); + + _unur_string_append(info," adaptiverectangle = %s %s\n", + (gen->variant&HITRO_VARFLAG_ADAPTRECT)?"on":"off", + (gen->set & HITRO_SET_ADAPTRECT) ? "" : "[default]"); + + if (gen->variant&HITRO_VARFLAG_ADAPTRECT) + _unur_string_append(info," adaptive_multiplier = %g %s\n", + GEN->adaptive_mult, + (gen->set & HITRO_SET_ADAPTMULT) ? "" : "[default]"); + + _unur_string_append(info," thinning = %d %s\n", GEN->thinning, + (gen->set & HITRO_SET_THINNING) ? "" : "[default]"); + _unur_string_append(info," burnin = %d %s\n", GEN->burnin, + (gen->set & HITRO_SET_THINNING) ? "" : "[default]"); + + _unur_string_append(info,"\n"); + + /* Not displayed: + int unur_hitro_set_v( UNUR_PAR *parameters, double vmax ); + int unur_hitro_set_u( UNUR_PAR *parameters, const double *umin, const double *umax ); + int unur_hitro_set_startingpoint( UNUR_PAR *parameters, const double *x0 ); + */ + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_hitro_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/hitro.h b/vendor/unuran-1.11.0/src/methods/hitro.h new file mode 100644 index 0000000..65c8f78 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/hitro.h @@ -0,0 +1,484 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: hitro.h * + * * + * PURPOSE: * + * function prototypes for method HITRO * + * (Markov Chain - HIT-and-run sampler with Ratio-Of-uniforms) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD HITRO Markov Chain - HIT-and-run sampler with Ratio-Of-uniforms + + =UP MCMC_Methods_for_CVEC + + =REQUIRED PDF + + =OPTIONAL mode, center, bounding rectangle for acceptance region + + =REF [KLPa05] + + =SPEED Set-up: fast, Sampling: fast + + =REINIT not implemented + + =DESCRIPTION + HITRO is an implementation of a hit-and-run sampler that runs on + the acceptance region of the multivariate ratio-of-uniforms + method, see @ref{Ratio-of-Uniforms}. + + The Ratio-of-Uniforms transforms the region below the density + into some region that we call "region of acceptance" in the + following. The minimal bounding hyperrectangle of this region + is given by + + @unurmathdisplay{ + v^+ = \sup\limits_{x} (f(x))^{1/r\,d+1}, \\ + u^-_i = \inf\limits_{x_i} (x_i-\mu_i) (f(x))^{r/r\,d+1}, \\ + u^+_i = \sup\limits_{x_i} (x_i-\mu_i) (f(x))^{r/r\,d+1}, } + + where @i{d} denotes the dimension of the distribution; + @unurmath{x_i} is the @i{i}-th coordinate of point @i{x}; + @unurmath{\mu_i} is the @i{i}-th coordinate of the center + @unurmath{\mu} of the distribution, i.e., a point in the + "main region" of the distribution. + Using the center is important, since otherwise the acceptance + region can become a very long and skinny ellipsoid along a + diagonal of the (huge) bounding rectangle. + + For each step of the Hit-and-Run algorithm we have to choose + some direction. This direction together with the current point + of the chain determines a straight line. Then a point is sampled + uniformly on intersection of this line and the region of + acceptance. This is done by rejection from a uniform distribution + on a line segment that covers it. + Depending of the chosen variant the endpoints of this covering + line are computed either by means of a (not necessary minimal) + bounding hyper-rectangle, or just the "covering plate" of the + bounding hyper-rectangle. + + The required bounds of the hyper-rectable can be given directly + by the user. Otherwise, these are computed automatically by + means of a numerical routine by Hooke and Jeeves + @unurbibref{HJa61} called direct search (see + @file{src/utils/hooke.c} for further references and details). + However, this expensive computation can be avoided by determine + these bounds "on the fly" by the following adaptive algorithm: + Start with some (small) hyper-rectangle and enlarge it whenever + the endpoints of the covering line segment are not contained in + the acceptance region of the Ratio-of-Unfiorms method. + This approach works reliable as long as the region of acceptance + is convex. + + The performance of the uniform sampling from the line segment is + much improved if the covering line is adjusted (shortened) + whenever a point is rejected (adaptive sampling). This technique + reduces the expected number of iterations enormously. + + Method HITRO requires that the region of acceptance of the + Ratio-of-Uniforms method is bounded. The shape of this region + can be controlled by a parameter @i{r}. Higher values of @i{r} + result in larger classes of distributions with bounded region + of acceptance. (A distribution that has such a bounded region for + some @i{r} also has a bounded region for every @i{r'} greater + than @i{r}.) On the other hand the acceptance probability + decreases with increasing @i{r}. Moreover, round-off errors are + more likely and (for large values of @i{r}) might result in a + chain with a stationary distribution different from the target + distribution. + + Method HITRO works optimal for distributions whose region of + acceptance is convex. This is in particular the case for all + log-concave distributions when we set @i{r} = @code{1}. + For bounded but non-convex regions of acceptance convergence is + yet not guarenteed by mathematical theory. + + + =HOWTOUSE + Method HITRO requires the PDF of the target distribution + (derivatives are not necessary). + + The acceptance region of the Ratio-of-Uniforms transformation + must be bounded. Its shape is controlled by parameter @i{r}. + By default this parameter is set to @code{1} as this guarentees + a convex region of acceptance when the PDF of the given + distribution is log-concave. It should only be set to a + different (higher!) value using unur_vnrou_set_r() if otherwise + @unurmath{x_i\,(f(x))^{r/r\,d+1}} were not + bounded for each coordinate. + + There are two variants of the HITRO sampler: + @table @emph + @item coordinate direction sampling. [default] + The coordinates are updated cyclically. + This can be seen as a Gibbs sampler running on the acceptance + region of the Ratio-of-Uniforms method. + This variant can be selected using + unur_hitro_set_variant_coordinate(). + + @item random direction sampling. + In each step is a direction is sampled uniformly from the + sphere. + + This variant can be selected using + unur_hitro_set_variant_random_direction(). + @end table + + Notice that each iteration of the coordinate direction sampler is + cheaper than an iteration of the random direction sampler. + + Sampling uniformly from the line segment can be adjusted in + several ways: + + @table @emph + @item Adaptive line sampling vs. simple rejection. + When adaptive line sampling is switched on, the covering line is + shortened whenever a point is rejected. However, when the region + of acceptance is not convex the line segment from which we have + to sample might not be connected. We found that the algorithm + still works but at the time being there is no formal proof that + the generated Markov chain has the required stationary + distribution. + + Adaptive line sampling can switch on/off by means of the + unur_hitro_set_use_adaptiveline() call. + + @item Bounding hyper-rectangle vs. "covering plate". + For computing the covering line we can use the bounding + hyper-rectangle or just its upper bound. + The latter saves computing time during the setup and + when computing the covering during at each iteration step + at the expense of a longer covering line. When adaptive line + sampling is used the total generation time for the entire chain + is shorter when only the "covering plate" is used. + + @emph{Notice:} When coordinate sampling is used the entire + bounding rectangle is used. + + Using the entire bounding hyper-rectangle can be switched on/off + by means of the unur_hitro_set_use_boundingrectangle() call. + + @item Deterministic vs. adaptive bounding hyper-rectangle. + A bounding rectangle can be given by the + unur_vnrou_set_u() and unur_vnrou_set_v() calls. + Otherwise, the minimal bounding rectangle is computed + automatically during the setup by means of a numerical + algorithm. However, this is (very) slow especially in higher + dimensions and it might happen that this algorithm (like + any other numerical algorithm) does not return a correct result. + + Alternatively the bounding rectangle can be computed + adaptively. In the latter case unur_vnrou_set_u() and + unur_vnrou_set_v() can be used to provide a starting rectangle + which must be sufficiently small. + Then both endpoints of the covering line segment are always + check whether they are outside the acceptance region of the + Ratio-of-Uniforms method. If they are not, then the line segment + and the ("bounding") rectangle are enlarged using a factor that + can be given using the unur_hitro_set_adaptive_multiplier() call. + + Notice, that running this method in the adaptive rectangle + mode requires that the region of acceptance is convex when random + directions are used, or the given PDF is unimodal when + coordinate direction sampling is used. + Moreover, it requires two additional calls to the PDF in each + iteration step of the chain. + + Using addaptive bounding rectangles can be switched on/off + by means of the unur_hitro_set_use_adaptiverectangle() call. + + @end table + + The algorithm takes of a bounded rectangular domain given by a + unur_distr_cvec_set_domain_rect() call, i.e. the PDF is set to + zero for every @i{x} outside the given domain. + However, it is only the coordinate direction sampler where the + boundary values are directly used to get the endpoins of the + coverline line for the line sampling step. + + + @emph{Important:} The bounding rectangle has to be + provided for the function @unurmath{PDF(x-center)!} + Notice that @code{center} is the center of the given + distribution, see unur_distr_cvec_set_center(). + If in doubt or if this value is not optimal, it can be changed + (overridden) by a unur_distr_cvec_set_center() call. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_hitro_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_hitro_set_variant_coordinate( UNUR_PAR *parameters ); +/* + Coordinate Direction Sampling: + Sampling along the coordinate directions (cyclic). + + @emph{Notice:} For this variant the entire bounding rectangle is + always used independent of the + unur_hitro_set_use_boundingrectangle() call. + + This is the default. +*/ + +int unur_hitro_set_variant_random_direction( UNUR_PAR *parameters ); +/* + Random Direction Sampling: + Sampling along the random directions. +*/ + +int unur_hitro_set_use_adaptiveline( UNUR_PAR *parameters, int adaptive ); +/* + When @var{adaptive} is set to TRUE adaptive line sampling is + applied, otherwise simple rejection is used. + + @emph{Notice:} When adaptive line sampling is switched off, + the entire bounding rectangle must be used since otherwise the + sampling time can be arbitrarily slow. + + @emph{Warning:} When adaptive line sampling is switched off, + sampling can be arbitrarily slow. In particular this happens + when random direction sampling is used for distributions with + rectangular domains. Then the algorithm can be trapped into + a vertex (or even edge). + + Default is TRUE. +*/ + +int unur_hitro_set_use_boundingrectangle( UNUR_PAR *parameters, int rectangle ); +/* + When @var{rectangle} is set to TRUE the entire bounding rectangle is used + for computing the covering line. Otherwise, only an upper bound for the + acceptance region is used. + + @emph{Notice:} When coordinate sampling is used the entire + bounding rectangle has is always used and this call has no effect. + + Default: FALSE for random direction samplig, TRUE for coordinate + direction sampling. +*/ + +int unur_hitro_set_use_adaptiverectangle( UNUR_PAR *parameters, int adaptive ); +/* + When @var{adaptive} is set to FALSE the bounding rectangle is + determined during the setup. Either, it is computed automatically by + a (slow) numerical method, or it must be provided by + unur_vnrou_set_u() and unur_vnrou_set_v() calls. + + If @var{adaptive} is set to TRUE the bounding rectangle is computed + adaptively. In this case the unur_vnrou_set_u() and + unur_vnrou_set_v() calls can be used to provide a starting + rectangle. This should be sufficiently small. + If not given then we assume @unurmath{v_{max} = 1,} + @unurmath{u_{min}=(-0.001,-0.001,\ldots,-0.001),} and + @unurmath{u_{max}=(0.001,0.001,\ldots,0.001).} + Adaptive enlargements of the bounding hyperrectangle can be + controlled set setting an enlargement factor given + by a unur_hitro_set_adaptive_multiplier() call. + + Using adaptive computation of the bounding rectangle reduces the + setup time significantly (when it is not given by the user) at the + expense of two additional PDF evaluations during each iteration + step. + + @emph{Important:} Using adaptive bounding rectangles requires that + the region of acceptance is convex when random directions are used, + or a unimodal PDF when coordinate direction sampling is used. + + Default: FALSE for random direction samplig, TRUE for coordinate + direction sampling. +*/ + +/*...........................................................................*/ + +int unur_hitro_set_r( UNUR_PAR *parameters, double r ); +/* + Sets the parameter @var{r} of the generalized multivariate + ratio-of-uniforms method. + + @emph{Notice}: This parameter must satisfy @var{r}>0. + + Default: @code{1}. +*/ + +int unur_hitro_set_v( UNUR_PAR *parameters, double vmax ); +/* + Set upper boundary for bounding hyper-rectangle. + If not set not set the mode of the distribution is used. + + If adaptive bounding rectangles the value is used for the + starting rectangle. If not given (and the mode of the distribution + is not known) then @var{vmax}=@code{1e-3} is used. + + If deterministic bounding rectangles these values are the given + values are used for the rectangle. If no value is given + (and the mode of the distribution is not known), the upper + bound of the minimal bounding hyper-rectangle is computed + numerically (slow). + + Default: not set. +*/ + +int unur_hitro_set_u( UNUR_PAR *parameters, const double *umin, const double *umax ); +/* + Sets left and right boundaries of bounding hyper-rectangle. + + If adaptive bounding rectangles these values are used for the + starting rectangle. If not given then + @var{umin}=@code{@{-b,-b,@dots{},-b@}} and + @var{umax}=@code{@{b,b,@dots{},b@}} with @code{b=1.e-3} is used. + + If deterministic bounding rectangles these values are the given + values are used for the rectangle. If no values are given, the + boundary of the minimal bounding hyper-rectangle is computed + numerically (slow). + + @strong{Important}: The boundaries are those of the density shifted + by the center of the distribution, i.e., for the + function @unurmath{PDF(x-center)!} + + @emph{Notice}: Computing the minimal bounding rectangle may fail + under some circumstances. Moreover, for multimodal distributions + the bounds might be too small as only local extrema are computed. + Nevertheless, for log-concave distributions it should work. + + Default: not set. +*/ + +int unur_hitro_set_adaptive_multiplier( UNUR_PAR *parameters, double factor ); +/* + Adaptive enlargements of the bounding hyperrectangle can be + controlled set setting the enlargement @var{factor}. + This must be greater than 1. Values close to 1 result in small + adaptive steps and thus reduce the risk of too large bounding + rectangles. On the other hand many adaptive steps might be + necessary. + + @emph{Notice:} For practical reasons this call does not accept + values for @var{factor} less than @code{1.0001}. If this value is + UNUR_INFINITY this results in infinite loops. + + Default: @code{1.1} +*/ + +/*...........................................................................*/ + +int unur_hitro_set_startingpoint( UNUR_PAR *parameters, const double *x0 ); +/* + Sets the starting point of the HITRO sampler in the original + scale. @var{x0} must be a "typical" point of the given distribution. + If such a "typical" point is not known and a starting point is + merely guessed, the first part of the HITRO chain should be + discarded (@emph{burn-in}), e.g.\ by mean of the + unur_hitro_set_burnin() call. + + @emph{Important:} The PDF of the distribution must not vanish at + the given point @var{x0}. + + Default is the result of unur_distr_cvec_get_center() for the + given distribution object. +*/ + +int unur_hitro_set_thinning( UNUR_PAR *parameters, int thinning ); +/* + Sets the @var{thinning} parameter. When @var{thinning} is set to + @i{k} then every @i{k}-th point from the iteration is returned by + the sampling algorithm. + If thinning has to be set such that each coordinate is updated + when using coordinate direction sampling, then @var{thinning} + should be @code{dim+1} (or any multiple of it) where + @code{dim} is the dimension of the distribution object. + + @emph{Notice}: This parameter must satisfy @var{thinning}>=1. + + Default: @code{1}. +*/ + +int unur_hitro_set_burnin( UNUR_PAR *parameters, int burnin ); +/* + If a "typical" point for the target distribution is not known but + merely guessed, the first part of the HITRO chain should be + discarded (@emph{burn-in}). This can be done during the + initialization of the generator object. + The length of the burn-in can is then @var{burnin}. + + The thinning factor set by a unur_hitro_set_thinning() call has + no effect on the length of the burn-in, i.e., for the burn-in + always a thinning factor @code{1} is used. + + @emph{Notice}: This parameter must satisfy @var{thinning}>=0. + + Default: @code{0}. +*/ + +/*...........................................................................*/ + +const double *unur_hitro_get_state( UNUR_GEN *generator ); +/* */ + +int unur_hitro_chg_state( UNUR_GEN *generator, const double *state ); +/* + Get and change the current state of the HITRO chain. + + @emph{Notice:} The state variable contains the point in the + @code{dim+1} dimensional point in the (tansformed) region of + acceptance of the Ratio-of-Uniforms method. Its coordinate + are stored in the following order: + @code{state[] = @{v, u1, u2, @dots{}, udim@}}. + + If the state can only be changed if the given @var{state} is inside + this region. +*/ + +int unur_hitro_reset_state( UNUR_GEN *generator ); +/* + Reset state of chain to starting point. + + @emph{Notice:} Currently this function does not reset + the generators for conditional distributions. Thus it is not + possible to get the same HITRO chain even when the underlying + uniform random number generator is reset. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/methods/hitro_struct.h b/vendor/unuran-1.11.0/src/methods/hitro_struct.h new file mode 100644 index 0000000..e20e385 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/hitro_struct.h @@ -0,0 +1,79 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: hitro_struct.h * + * * + * PURPOSE: * + * declares structures for method HITRO * + * (Markov Chain - HIT-and-run sampler with Ratio-Of-uniforms) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_hitro_par { + double r; /* r-parameter of HITRO method */ + int thinning; /* thinning factor for generated chain */ + int burnin; /* length of burn-in for chain */ + double adaptive_mult; /* multiplier for adaptive rectangle */ + double vmax; /* bounding rectangle v-coordinate */ + const double *umin, *umax; /* bounding rectangle u-coordinates */ + const double *x0; /* starting point of chain */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_hitro_gen { + int dim; /* dimension of distribution */ + int thinning; /* thinning factor for generated chain */ + double r; /* r-parameter of HITRO method */ + + double *state; /* state of chain / current point. + the state is a point in the acceptance region + of the RoU-method in vu-hyperplane. + the coordinates are stored in the following order: + state = {v, u_1, u_2, ... u_n} */ + + int coord; /* current coordinate used for HITRO chain */ + double *direction; /* working array for random direction */ + + double *vu; /* working point in RoU scale */ + double *vumin, *vumax; /* vertices of bounding rectangles (vu-coordinates) + (see 'state' variable for location of v and + u-coordinates.) */ + + double *x; /* working point in the original scale */ + const double *center; /* center of distribution */ + + double adaptive_mult; /* multiplier for adaptive rectangles */ + int burnin; /* length of burn-in for chain */ + double *x0; /* starting point of chain */ + double fx0; /* PDF at starting point of chain */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/hrb.c b/vendor/unuran-1.11.0/src/methods/hrb.c new file mode 100644 index 0000000..cafd2a3 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/hrb.c @@ -0,0 +1,849 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: hrb.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: Hazard Rate Bounded * + * * + * DESCRIPTION: * + * * + * REQUIRED: * + * pointer to the hazard rate * + * * + * OPTIONAL: * + * upper bound for hazard rate * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * * + * Evrim Ozgul (2002): The generation of random variates with a given * + * hazard rate, M.Sc. thesis, Department of Industrial Engineering, * + * Bogazici University, Istanbul. * + * * + ***************************************************************************** + * * + * Rejection from majorizing constant hazard rate (exponential * + * distribution); constant thinning. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "hrb.h" +#include "hrb_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Constants */ + +/* abort sampling after this number of iterations and return UNUR_INFINITY */ +#define HRB_EMERGENCY_BREAK (100000) + +/*---------------------------------------------------------------------------*/ +/* Variants: */ + +#define HRB_VARFLAG_VERIFY 0x01u /* flag for verifying mode */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define HRB_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ +#define HRB_DEBUG_SAMPLE 0x01000000u /* trace sampling + (only if verify mode is on) */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define HRB_SET_UPPERBOUND 0x001u /* set upper bound for hazard rate */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "HRB" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_hrb_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_hrb_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_hrb_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_hrb_check_par( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_hrb_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hrb_free( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_hrb_sample( struct unur_gen *gen ); +static double _unur_hrb_sample_check( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hrb_debug_init( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hrb_debug_sample( const struct unur_gen *gen, double x, int i ); +/*---------------------------------------------------------------------------*/ +/* trace sampling. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_hrb_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cont /* data for distribution object */ + +#define PAR ((struct unur_hrb_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_hrb_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +#define HR(x) _unur_cont_HR((x),(gen->distr)) /* call to hazard rate */ + +/*---------------------------------------------------------------------------*/ + +#define _unur_hrb_getSAMPLE(gen) \ + ( ((gen)->variant & HRB_VARFLAG_VERIFY) \ + ? _unur_hrb_sample_check : _unur_hrb_sample ) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_hrb_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + + if (DISTR_IN.hr == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"HR"); return NULL; } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_hrb_par) ); + COOKIE_SET(par,CK_HRB_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->upper_bound = UNUR_INFINITY; /* upper bound for hazard rate (not set yet) */ + + par->method = UNUR_METH_HRB; /* method */ + par->variant = 0u; /* default variant */ + + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_hrb_init; + + return par; + +} /* end of unur_hrb_new() */ + +/*****************************************************************************/ + +int +unur_hrb_set_upperbound( struct unur_par *par, double upperbound ) + /*----------------------------------------------------------------------*/ + /* set upper bound for hazard rate */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* upperbound ... upper bound for hazard rate */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HRB ); + + /* check new parameter for generator */ + if (upperbound <= 0. || _unur_FP_is_infinity(upperbound)) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"bound for hazard rate"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->upper_bound = upperbound; + + /* changelog */ + par->set |= HRB_SET_UPPERBOUND; + + return UNUR_SUCCESS; + +} /* end of unur_hrb_set_upperbound() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hrb_set_verify( struct unur_par *par, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HRB ); + + /* we use a bit in variant */ + par->variant = (verify) ? (par->variant | HRB_VARFLAG_VERIFY) : (par->variant & (~HRB_VARFLAG_VERIFY)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_hrb_set_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hrb_chg_verify( struct unur_gen *gen, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, HRB, UNUR_ERR_GEN_INVALID ); + + /* we must not change this switch when sampling has been disabled by + using a pointer to the error producing routine */ + if (SAMPLE == _unur_sample_cont_error) + return UNUR_FAILURE; + + /* we use a bit in variant */ + gen->variant = (verify) + ? (gen->variant | HRB_VARFLAG_VERIFY) + : (gen->variant & (~HRB_VARFLAG_VERIFY)); + + /* sampling routine */ + SAMPLE = _unur_hrb_getSAMPLE(gen); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_hrb_chg_verify() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_hrb_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* params pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + _unur_check_NULL( GENTYPE,par,NULL ); + + /* check input */ + if ( par->method != UNUR_METH_HRB ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_HRB_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_hrb_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* check parameters */ + if (_unur_hrb_check_par(gen) != UNUR_SUCCESS) { + _unur_hrb_free(gen); return NULL; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_hrb_debug_init(gen); +#endif + + return gen; + +} /* end of _unur_hrb_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_hrb_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int rcode; + + /* check parameters */ + if ( (rcode = _unur_hrb_check_par(gen)) != UNUR_SUCCESS) + return rcode; + + /* (re)set sampling routine */ + SAMPLE = _unur_hrb_getSAMPLE(gen); + + /* nothing to do */ + return UNUR_SUCCESS; +} /* end of _unur_hrb_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_hrb_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_HRB_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_hrb_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_HRB_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_hrb_getSAMPLE(gen); + gen->destroy = _unur_hrb_free; + gen->clone = _unur_hrb_clone; + gen->reinit = _unur_hrb_reinit; + + /* copy parameters into generator object */ + GEN->upper_bound = PAR->upper_bound; /* upper bound for hazard rate */ + + /* default values */ + + /* initialize variables */ + GEN->left_border = 0.; /* left border of domain */ + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_hrb_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_hrb_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_hrb_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + + /* check for required data: upper bound for hazard rate */ + if (!(gen->set & HRB_SET_UPPERBOUND)) { + GEN->upper_bound = HR(GEN->left_border); + if (GEN->upper_bound <= 0. || _unur_FP_is_infinity(GEN->upper_bound)) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"no valid upper bound for HR at left boundary"); + return UNUR_ERR_GEN_CONDITION; + } + } + + /* set left border and check domain */ + if (DISTR.domain[0] < 0.) DISTR.domain[0] = 0.; + if (DISTR.domain[1] < UNUR_INFINITY) DISTR.domain[1] = UNUR_INFINITY; + GEN->left_border = DISTR.domain[0]; + + return UNUR_SUCCESS; +} /* end of _unur_hrb_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_hrb_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_hrb_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_HRB_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + return clone; + +#undef CLONE +} /* end of _unur_hrb_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_hrb_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_HRB ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_HRB_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_hrb_free() */ + +/*****************************************************************************/ + +double +_unur_hrb_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U,V,E,X; + double lambda; + int i; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_HRB_GEN,UNUR_INFINITY); + + /* parameter for majorizing hazard rate */ + lambda = GEN->upper_bound; + + /* starting point */ + X = GEN->left_border; + + for(i=1;;i++) { + /* sample from U(0,1) */ + while ( _unur_iszero(U = 1.-_unur_call_urng(gen->urng)) ); + + /* sample from exponential distribution with scale parameter lambda */ + E = -log(U) / lambda; + + /* Remark: by this construction E is monotically increasing with + the uniform random number generated by the _unur_call_urng() call */ + + /* next step */ + X += E; + + /* reject or accept */ + V = lambda * _unur_call_urng(gen->urng); + if( V <= HR(X) ) return X; + + if (i > HRB_EMERGENCY_BREAK) { + /* emergency break */ + _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING,"maximum number of iterations exceeded"); + return X; + } + + } + +} /* end of _unur_hrb_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_hrb_sample_check( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator (verify mode) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U,V,E,X,hrx; + double lambda; + int i; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_HRB_GEN,UNUR_INFINITY); + + /* parameter for majorizing hazard rate */ + lambda = GEN->upper_bound; + + /* starting point */ + X = GEN->left_border; + + for(i=1;;i++) { + /* sample from U(0,1) */ + while ( _unur_iszero(U = 1.-_unur_call_urng(gen->urng)) ); + + /* sample from exponential distribution with scale parameter lambda */ + E = -log(U) / lambda; + + /* Remark: by this construction E is monotically increasing with + the uniform random number generated by the _unur_call_urng() call */ + + /* next step */ + X += E; + + /* hazard rate at generated point */ + hrx = HR(X); + + /* verify upper bound */ + if ( (1.+UNUR_EPSILON) * lambda < hrx ) + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"upper bound not valid"); + + /* reject or accept */ + V = lambda * _unur_call_urng(gen->urng); + if( V <= hrx ) { +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & HRB_DEBUG_SAMPLE) + _unur_hrb_debug_sample( gen, X, i ); +#endif + return X; + } + + if (i > HRB_EMERGENCY_BREAK) { + /* emergency break */ + _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING,"maximum number of iterations exceeded"); + return X; + } + + } + +} /* end of _unur_hrb_sample_check() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_hrb_debug_init( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HRB_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = HRB (Hazard Rate Bounded)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cont_debug( gen->distr, gen->genid ); + + fprintf(LOG,"%s: sampling routine = _unur_hrb_sample",gen->genid); + if (gen->variant & HRB_VARFLAG_VERIFY) + fprintf(LOG,"_check()\n"); + else + fprintf(LOG,"()\n"); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: upper bound for hazard rate = %g",gen->genid,GEN->upper_bound); + _unur_print_if_default(gen,HRB_SET_UPPERBOUND); + fprintf(LOG,"\n"); + + fprintf(LOG,"%s:\n",gen->genid); + + + fflush(LOG); + +} /* end of _unur_hrb_debug_init() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_hrb_debug_sample( const struct unur_gen *gen, double x, int i ) + /*----------------------------------------------------------------------*/ + /* write info about generated point into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* x ... generated point */ + /* i ... number of iterations */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HRB_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: X = %g\t #iterations = %d\n",gen->genid,x,i); + +} /* end of _unur_hrb_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_hrb_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + int samplesize = 10000; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = HR\n"); + _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info,"\n"); + + /* method */ + _unur_string_append(info,"method: HRB (Hazard Rate Bounded)\n"); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," E[#iterations] = %.2f [approx.]\n", + unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize)); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + _unur_string_append(info," upperbound = %g %s\n", GEN->upper_bound, + (gen->set & HRB_SET_UPPERBOUND) ? "" : "[default]"); + + if (gen->variant & HRB_VARFLAG_VERIFY) + _unur_string_append(info," verify = on\n"); + + _unur_string_append(info,"\n"); + } + + /* Hints */ + if (help) { + if ( !(gen->set & HRB_SET_UPPERBOUND)) + _unur_string_append(info,"[ Hint: %s ]\n", + "You should set \"upperbound\" for the given hazard rate."); + _unur_string_append(info,"\n"); + } + +} /* end of _unur_hrb_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/hrb.h b/vendor/unuran-1.11.0/src/methods/hrb.h new file mode 100644 index 0000000..cfd13d5 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/hrb.h @@ -0,0 +1,120 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: hrb.h * + * * + * PURPOSE: * + * function prototypes for method HRB * + * (Hazard Rate Bounded) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD HRB Hazard Rate Bounded + + =UP Methods_for_CONT + + =REQUIRED bounded hazard rate + + =OPTIONAL upper bound for hazard rate + + =SPEED Set-up: fast, Sampling: slow + + =REINIT supported + + =REF [HLD04: Sect.9.1.4, Alg.9.4] + + =DESCRIPTION + Generates random variate with given hazard rate which must be + bounded from above. It uses the thinning method with a constant + dominating hazard function. + + =HOWTOUSE + HRB requires a hazard function for a continuous distribution + together with an upper bound. The latter has to be set using the + unur_hrb_set_upperbound() call. If no such upper bound is given + it is assumed that the upper bound can be achieved by evaluating + the hazard rate at the left hand boundary of the domain of the + distribution. Notice, however, that for decreasing hazard rate + the method HRD (@pxref{HRD,,Hazard Rate Decreasing}) is much + faster and thus the prefered method. + + It is important to note that the domain of the distribution can + be set via a unur_distr_cont_set_domain() call. + However, the left border must not be negative. Otherwise it is + set to @code{0}. This is also the default if no domain is + given at all. For computational reasons the right border is + always set to @code{UNUR_INFINITY} independently of the given + domain. Thus for domains bounded from right the function for + computing the hazard rate should return @code{UNUR_INFINITY} + right of this domain. + + For distributions with increasing hazard rate method HRI + (@pxref{HRI,,Hazard Rate Increasing}) is required. + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + Notice, that the upper bound given by the unur_hrb_set_upperbound() call + cannot be changed and must be valid for the changed distribution. + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_hrb_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_hrb_set_upperbound( UNUR_PAR *parameters, double upperbound ); +/* + Set upper bound for hazard rate. If this call is not used it is + assumed that the the maximum of the hazard rate is achieved at the + left hand boundary of the domain of the distribution. +*/ + +int unur_hrb_set_verify( UNUR_PAR *parameters, int verify ); +/* */ + +int unur_hrb_chg_verify( UNUR_GEN *generator, int verify ); +/* + Turn verifying of algorithm while sampling on/off. + If the hazard rate is not bounded by the given bound, then + @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. + + Default is FALSE. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/hrb_struct.h b/vendor/unuran-1.11.0/src/methods/hrb_struct.h new file mode 100644 index 0000000..0027cbd --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/hrb_struct.h @@ -0,0 +1,74 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: hrb_struct.h * + * * + * PURPOSE: * + * declares structures for method HRB * + * (Hazard Rate Bounded) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_hrb_par { + double upper_bound; /* upper bound for hazard rate */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_hrb_gen { + double upper_bound; /* upper bound for hazard rate */ + double left_border; /* left border of domain */ +}; + +/*---------------------------------------------------------------------------*/ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/unuran-1.11.0/src/methods/hrd.c b/vendor/unuran-1.11.0/src/methods/hrd.c new file mode 100644 index 0000000..15e4197 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/hrd.c @@ -0,0 +1,800 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: hrd.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: Hazard Rate Decreasing * + * * + * DESCRIPTION: * + * Rejection with dynamic thinning. * + * * + * REQUIRED: * + * pointer to the hazard rate * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * * + * Evrim Ozgul (2002): The generation of random variates with a given * + * hazard rate, M.Sc. thesis, Department of Industrial Engineering, * + * Bogazici University, Istanbul. * + * * + ***************************************************************************** + * * + * Rejection from majorizing hazard rate using dynamic thinning. * + * This means that rejection from a constant hazard rate is used. * + * When a point Xi is generated but rejected a new constant majorizing * + * hazard rate with value HR(Xi) starting at Xi is used. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "hrd.h" +#include "hrd_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Constants */ + +/*---------------------------------------------------------------------------*/ +/* Variants: */ + +#define HRD_VARFLAG_VERIFY 0x01u /* flag for verifying mode */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define HRD_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ +#define HRD_DEBUG_SAMPLE 0x01000000u /* trace sampling + (only if verify mode is on) */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "HRD" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_hrd_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_hrd_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_hrd_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_hrd_check_par( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_hrd_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hrd_free( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_hrd_sample( struct unur_gen *gen ); +static double _unur_hrd_sample_check( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hrd_debug_init( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hrd_debug_sample( const struct unur_gen *gen, double x, int i ); +/*---------------------------------------------------------------------------*/ +/* trace sampling. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_hrd_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cont /* data for distribution object */ + +#define PAR ((struct unur_hrd_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_hrd_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +#define HR(x) _unur_cont_HR((x),(gen->distr)) /* call to hazard rate */ + +/*---------------------------------------------------------------------------*/ + +#define _unur_hrd_getSAMPLE(gen) \ + ( ((gen)->variant & HRD_VARFLAG_VERIFY) \ + ? _unur_hrd_sample_check : _unur_hrd_sample ) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_hrd_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + + if (DISTR_IN.hr == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"HR"); return NULL; } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_hrd_par) ); + COOKIE_SET(par,CK_HRD_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + + par->method = UNUR_METH_HRD; /* method */ + par->variant = 0u; /* default variant */ + + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_hrd_init; + + return par; + +} /* end of unur_hrd_new() */ + +/*****************************************************************************/ + +int +unur_hrd_set_verify( struct unur_par *par, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HRD ); + + /* we use a bit in variant */ + par->variant = (verify) ? (par->variant | HRD_VARFLAG_VERIFY) : (par->variant & (~HRD_VARFLAG_VERIFY)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_hrd_set_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hrd_chg_verify( struct unur_gen *gen, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, HRD, UNUR_ERR_GEN_INVALID ); + + /* we must not change this switch when sampling has been disabled by + using a pointer to the error producing routine */ + if (SAMPLE == _unur_sample_cont_error) + return UNUR_FAILURE; + + /* we use a bit in variant */ + gen->variant = (verify) + ? (gen->variant | HRD_VARFLAG_VERIFY) + : (gen->variant & (~HRD_VARFLAG_VERIFY)); + + /* sampling routine */ + SAMPLE = _unur_hrd_getSAMPLE(gen); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_hrd_chg_verify() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_hrd_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* params pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + _unur_check_NULL( GENTYPE,par,NULL ); + + /* check input */ + if ( par->method != UNUR_METH_HRD ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_HRD_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_hrd_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* check parameters */ + if (_unur_hrd_check_par(gen) != UNUR_SUCCESS) { + _unur_hrd_free(gen); return NULL; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_hrd_debug_init(gen); +#endif + + return gen; + +} /* end of _unur_hrd_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_hrd_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int rcode; + + /* check parameters */ + if ( (rcode = _unur_hrd_check_par(gen)) != UNUR_SUCCESS) + return rcode; + + /* (re)set sampling routine */ + SAMPLE = _unur_hrd_getSAMPLE(gen); + + /* nothing to do */ + return UNUR_SUCCESS; +} /* end of _unur_hrd_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_hrd_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_HRD_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_hrd_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_HRD_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_hrd_getSAMPLE(gen); + gen->destroy = _unur_hrd_free; + gen->clone = _unur_hrd_clone; + gen->reinit = _unur_hrd_reinit; + + /* default values */ + + /* initialize variables */ + GEN->left_border = 0.; /* left border of domain */ + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_hrd_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_hrd_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_hrd_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* set left border and check domain */ + if (DISTR.domain[0] < 0.) DISTR.domain[0] = 0.; + if (DISTR.domain[1] < UNUR_INFINITY) DISTR.domain[1] = UNUR_INFINITY; + GEN->left_border = DISTR.domain[0]; + + /* compute upper bound for hazard rate (at left border) */ + GEN->upper_bound = HR(GEN->left_border); + if (GEN->upper_bound <= 0. || _unur_FP_is_infinity(GEN->upper_bound)) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"no valid upper bound for HR at left boundary"); + return UNUR_ERR_GEN_CONDITION; + } + + return UNUR_SUCCESS; +} /* end of _unur_hrd_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_hrd_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_hrd_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_HRD_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + return clone; + +#undef CLONE +} /* end of _unur_hrd_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_hrd_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_HRD ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_HRD_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_hrd_free() */ + +/*****************************************************************************/ + +double +_unur_hrd_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U,V,E,X,hrx; + double lambda; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_HRD_GEN,UNUR_INFINITY); + + /* parameter for majorizing hazard rate */ + lambda = GEN->upper_bound; + + /* starting point */ + X = GEN->left_border; + + for(;;) { + /* sample from U(0,1) */ + while ( _unur_iszero(U = 1.-_unur_call_urng(gen->urng)) ); + + /* sample from exponential distribution with scale parameter lambda */ + E = -log(U) / lambda; + + /* Remark: by this construction E is monotically increasing with + the uniform random number generated by the _unur_call_urng() call */ + + /* next step */ + X += E; + + /* hazard rate at generated point */ + hrx = HR(X); + + /* reject or accept */ + V = lambda * _unur_call_urng(gen->urng); + if( V <= hrx ) + return X; /* accept */ + + /* else: reject */ + + /* update majorizing hazard rate */ + if (hrx > 0.) + lambda = hrx; + else { + /* the given function is not a hazard rate */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"HR not valid"); + return UNUR_INFINITY; + } + } + +} /* end of _unur_hrd_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_hrd_sample_check( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator (verify mode) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U,V,E,X,hrx; + double lambda; + int i; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_HRD_GEN,UNUR_INFINITY); + + /* parameter for majorizing hazard rate */ + lambda = GEN->upper_bound; + + /* starting point */ + X = GEN->left_border; + + for(i=1;;i++) { + /* sample from U(0,1) */ + while ( _unur_iszero(U = 1.-_unur_call_urng(gen->urng)) ); + + /* sample from exponential distribution with scale parameter lambda */ + E = -log(U) / lambda; + + /* Remark: by this construction E is monotically increasing with + the uniform random number generated by the _unur_call_urng() call */ + + /* next step */ + X += E; + + /* hazard rate at generated point */ + hrx = HR(X); + + /* verify upper bound */ + if ( (1.+UNUR_EPSILON) * lambda < hrx ) + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"HR not decreasing"); + + /* reject or accept */ + V = lambda * _unur_call_urng(gen->urng); + if( V <= hrx ) { +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & HRD_DEBUG_SAMPLE) + _unur_hrd_debug_sample( gen, X, i ); +#endif + return X; + } + + /* else: reject */ + + /* update majorizing hazard rate */ + if (hrx > 0.) + lambda = hrx; + else { + /* the given function is not a hazard rate */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"HR not valid"); + return UNUR_INFINITY; + } + } + +} /* end of _unur_hrd_sample_check() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_hrd_debug_init( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HRD_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = HRD (Hazard Rate Decreasing)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cont_debug( gen->distr, gen->genid ); + + fprintf(LOG,"%s: sampling routine = _unur_hrd_sample",gen->genid); + if (gen->variant & HRD_VARFLAG_VERIFY) + fprintf(LOG,"_check()\n"); + else + fprintf(LOG,"()\n"); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_hrd_debug_init() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_hrd_debug_sample( const struct unur_gen *gen, double x, int i ) + /*----------------------------------------------------------------------*/ + /* write info about generated point into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* x ... generated point */ + /* i ... number of iterations */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HRD_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: X = %g\t #iterations = %d\n",gen->genid,x,i); + +} /* end of _unur_hrd_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_hrd_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + int samplesize = 10000; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = HR\n"); + _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info,"\n"); + + /* method */ + _unur_string_append(info,"method: HRD (Hazard Rate Decreasing)\n"); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," E[#iterations] = %.2f [approx.]\n", + unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize)); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + if (gen->variant & HRD_VARFLAG_VERIFY) + _unur_string_append(info," verify = on\n"); + _unur_string_append(info,"\n"); + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_hrd_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/hrd.h b/vendor/unuran-1.11.0/src/methods/hrd.h new file mode 100644 index 0000000..3b9d123 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/hrd.h @@ -0,0 +1,107 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: hrd.h * + * * + * PURPOSE: * + * function prototypes for method HRD * + * (Hazard Rate Decreasing) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD HRD Hazard Rate Decreasing + + =UP Methods_for_CONT + + =REQUIRED decreasing (non-increasing) hazard rate + + =SPEED Set-up: fast, Sampling: slow + + =REF [HLD04: Sect.9.1.5, Alg.9.5] + + =REINIT supported + + =DESCRIPTION + Generates random variate with given non-increasing hazard rate. + It is necessary that the distribution object contains this + hazard rate. Decreasing hazard rate implies that the + corresponding PDF of the distribution has heavier tails than the + exponential distribution (which has constant hazard rate). + + =HOWTOUSE + HRD requires a hazard function for a continuous distribution + with non-increasing hazard rate. There are no parameters for + this method. + + It is important to note that the domain of the distribution can + be set via a unur_distr_cont_set_domain() call. However, only + the left hand boundary is used. For computational reasons the + right hand boundary is always reset to @code{UNUR_INFINITY}. + If no domain is given by the user then the left hand boundary is + set to @code{0}. + + For distributions which do not have decreasing hazard rates but + are bounded from above use method HRB + (@pxref{HRB,,Hazard Rate Bounded}). + For distributions with increasing hazard rate method HRI + (@pxref{HRI,,Hazard Rate Increasing}) is required. + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_hrd_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_hrd_set_verify( UNUR_PAR *parameters, int verify ); +/* */ + +int unur_hrd_chg_verify( UNUR_GEN *generator, int verify ); +/* + Turn verifying of algorithm while sampling on/off. + If the hazard rate is not bounded by the given bound, then + @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. + + Default is FALSE. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/hrd_struct.h b/vendor/unuran-1.11.0/src/methods/hrd_struct.h new file mode 100644 index 0000000..2c7b4ce --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/hrd_struct.h @@ -0,0 +1,74 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: hrd_struct.h * + * * + * PURPOSE: * + * declares structures for method HRD * + * (Hazard Rate Decreasing) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_hrd_par { + int dummy; +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_hrd_gen { + double upper_bound; /* upper bound for hazard rate */ + double left_border; /* left border of domain */ +}; + +/*---------------------------------------------------------------------------*/ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/unuran-1.11.0/src/methods/hri.c b/vendor/unuran-1.11.0/src/methods/hri.c new file mode 100644 index 0000000..71e3b39 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/hri.c @@ -0,0 +1,1027 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: hri.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: Hazard Rate Increasing * + * * + * DESCRIPTION: * + * Rejection with dynamic thinning. * + * * + * REQUIRED: * + * pointer to the hazard rate * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * * + * Evrim Ozgul (2002): The generation of random variates with a given * + * hazard rate, M.Sc. thesis, Department of Industrial Engineering, * + * Bogazici University, Istanbul. * + * * + ***************************************************************************** + * * + * Dynamic composition method with rejection from piecewise constant * + * majorizing hazard rate. * + * * + *****************************************************************************/ + +/* DYNAMIC COMPOSITION METHOD FOR IHR */ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "hri.h" +#include "hri_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Constants */ + +/* abort sampling after this number of iterations and return UNUR_INFINITY */ +#define HRI_EMERGENCY_BREAK (10000) + +/*---------------------------------------------------------------------------*/ +/* Variants: */ + +#define HRI_VARFLAG_VERIFY 0x01u /* flag for verifying mode */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define HRB_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ +#define HRI_DEBUG_SAMPLE 0x01000000u /* trace sampling + (only if verify mode is on) */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define HRI_SET_P0 0x001u + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "HRI" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_hri_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_hri_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_hri_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_hri_check_par( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_hri_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hri_free( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_hri_sample( struct unur_gen *gen ); +static double _unur_hri_sample_check( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hri_debug_init( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_hri_debug_sample( const struct unur_gen *gen, + double x, double p1, int i0, int i1 ); +/*---------------------------------------------------------------------------*/ +/* trace sampling. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_hri_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cont /* data for distribution object */ + +#define PAR ((struct unur_hri_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_hri_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +#define HR(x) _unur_cont_HR((x),(gen->distr)) /* call to hazard rate */ + +/*---------------------------------------------------------------------------*/ + +#define _unur_hri_getSAMPLE(gen) \ + ( ((gen)->variant & HRI_VARFLAG_VERIFY) \ + ? _unur_hri_sample_check : _unur_hri_sample ) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_hri_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + + if (DISTR_IN.hr == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"HR"); return NULL; } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_hri_par) ); + COOKIE_SET(par,CK_HRI_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->p0 = 1.; /* design point */ + + par->method = UNUR_METH_HRI; /* method */ + par->variant = 0u; /* default variant */ + + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_hri_init; + + return par; + +} /* end of unur_hri_new() */ + +/*****************************************************************************/ + +int +unur_hri_set_p0( struct unur_par *par, double p0 ) + /*----------------------------------------------------------------------*/ + /* set design point for algorithm */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* p0 ... design point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HRI ); + + if (p0 <= par->distr->data.cont.domain[0]) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"p0 <= left boundary"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->p0 = p0; + + /* changelog */ + par->set |= HRI_SET_P0; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_hri_set_p0() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hri_set_verify( struct unur_par *par, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, HRI ); + + /* we use a bit in variant */ + par->variant = (verify) ? (par->variant | HRI_VARFLAG_VERIFY) : (par->variant & (~HRI_VARFLAG_VERIFY)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_hri_set_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_hri_chg_verify( struct unur_gen *gen, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, HRI, UNUR_ERR_GEN_INVALID ); + + /* we must not change this switch when sampling has been disabled by + using a pointer to the error producing routine */ + if (SAMPLE == _unur_sample_cont_error) + return UNUR_FAILURE; + + /* we use a bit in variant */ + gen->variant = (verify) + ? (gen->variant | HRI_VARFLAG_VERIFY) + : (gen->variant & (~HRI_VARFLAG_VERIFY)); + + /* sampling routine */ + SAMPLE = _unur_hri_getSAMPLE(gen); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_hri_chg_verify() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_hri_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* params pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + _unur_check_NULL( GENTYPE,par,NULL ); + + /* check input */ + if ( par->method != UNUR_METH_HRI ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_HRI_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_hri_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* check parameters */ + if (_unur_hri_check_par(gen) != UNUR_SUCCESS) { + _unur_hri_free(gen); return NULL; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_hri_debug_init(gen); +#endif + + return gen; + +} /* end of _unur_hri_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_hri_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int rcode; + + /* check parameters */ + if ( (rcode = _unur_hri_check_par(gen)) != UNUR_SUCCESS) + return rcode; + + /* (re)set sampling routine */ + SAMPLE = _unur_hri_getSAMPLE(gen); + + /* nothing to do */ + return UNUR_SUCCESS; +} /* end of _unur_hri_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_hri_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_HRI_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_hri_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_HRI_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_hri_getSAMPLE(gen); + gen->destroy = _unur_hri_free; + gen->clone = _unur_hri_clone; + gen->reinit = _unur_hri_reinit; + + /* copy parameters into generator object */ + GEN->p0 = PAR->p0; /* design (splitting) point */ + + /* default values */ + GEN->left_border = 0.; /* left border of domain */ + GEN->hrp0 = 0.; /* hazard rate at p0 */ + + /* initialize variables */ + GEN->left_border = 0.; /* left border of domain */ + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_hri_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_hri_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_hri_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + + /* set left border and check domain */ + if (DISTR.domain[0] < 0.) DISTR.domain[0] = 0.; + if (DISTR.domain[1] < UNUR_INFINITY) DISTR.domain[1] = UNUR_INFINITY; + GEN->left_border = DISTR.domain[0]; + + /* check design point */ + if (gen->set & HRI_SET_P0) { + if (GEN->p0 <= GEN->left_border) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"p0 <= left boundary"); + GEN->p0 = GEN->left_border + 1.; + } + } + else { + /* p0 not set */ + GEN->p0 = GEN->left_border + 1.; + } + + /* compute hazard rate at construction point */ + GEN->hrp0 = HR(GEN->p0); + if (GEN->hrp0 <= 0. || _unur_FP_is_infinity(GEN->hrp0)) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"design point p0 not valid"); + return UNUR_ERR_GEN_CONDITION; + } + + return UNUR_SUCCESS; +} /* end of _unur_hri_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_hri_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_hri_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_HRI_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + return clone; + +#undef CLONE +} /* end of _unur_hri_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_hri_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_HRI ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_HRI_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_hri_free() */ + +/*****************************************************************************/ + +double +_unur_hri_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U, V, E, X, hrx1; + double lambda0, p1, lambda1; + int i0 = 0; + int i1 = 0; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_HRI_GEN,UNUR_INFINITY); + + /* + ------------------- + 1st thinning loop + ------------------- + */ + + /* parameter for majorizing hazard rate of first component */ + lambda0 = GEN->hrp0; + + /* starting point */ + X = GEN->left_border; + + for(i0=1;;i0++) { + /* sample from U(0,1) */ + while ( _unur_iszero(U = 1.-_unur_call_urng(gen->urng)) ); + + /* sample from exponential distribution with scale parameter lambda */ + E = -log(U) / lambda0; + + /* Remark: by this construction E is monotically increasing with + the uniform random number generated by the _unur_call_urng() call */ + + /* next step */ + X += E; + + /* hazard rate at generated point */ + hrx1 = HR(X); + + /* reject or accept */ + V = lambda0 * _unur_call_urng(gen->urng); + + if( V <= hrx1 ) + /* accept */ + break; + + if (i0>HRI_EMERGENCY_BREAK) { + /* emergency break */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"abort computation"); + return UNUR_INFINITY; + } + + } + + /* accept point if not larger than design (split) point */ + if (X <= GEN->p0) + return X; + + /* + ------------------- + 2nd thinning loop + ------------------- + */ + + /* parameter for majorizing hazard rate of first component */ + lambda1 = hrx1 - lambda0; + + /* check parameter */ + if (lambda1 <= 0.) + /* hazard rate not strictly increasing. + assume hazard rate satisfies condition (i.e. increasing), + and this hazard rate constant between p0 and X. + */ + return X; + + /* starting point */ + p1 = X; + X = GEN->p0; + + for(i1=1;;i1++) { + /* sample from U(0,1) */ + while ( _unur_iszero(U = 1.-_unur_call_urng(gen->urng)) ); + + /* sample from exponential distribution with scale parameter lambda */ + E = -log(U) / lambda1; + + /* next step */ + X += E; + + /* reject or accept */ + V = lambda0 + lambda1 * _unur_call_urng(gen->urng); + + /* squeeze */ + if (V <= GEN->hrp0) + /* we use hazard rate at design point p0 as squeeze (since HR increasing) */ + break; + + /* hazard rate at generated point */ + if (V <= HR(X)) + break; + + if (i1>HRI_EMERGENCY_BREAK) { + /* emergency break */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"abort computation"); + return UNUR_INFINITY; + } + } + + return ((X <= p1) ? X : p1); + +} /* end of _unur_hri_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_hri_sample_check( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator (verify mode) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U, V, E, X, hrx, hrx1; + double lambda0, p1, lambda1; + int i0 = 0; + int i1 = 0; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_HRI_GEN,UNUR_INFINITY); + + /* + ------------------- + 1st thinning loop + ------------------- + */ + + /* parameter for majorizing hazard rate of first component */ + lambda0 = GEN->hrp0; + + /* starting point */ + X = GEN->left_border; + + for(i0=1;;i0++) { + /* sample from U(0,1) */ + while ( _unur_iszero(U = 1.-_unur_call_urng(gen->urng)) ); + + /* sample from exponential distribution with scale parameter lambda */ + E = -log(U) / lambda0; + + /* Remark: by this construction E is monotically increasing with + the uniform random number generated by the _unur_call_urng() call */ + + /* next step */ + X += E; + + /* hazard rate at generated point */ + hrx1 = HR(X); + + /* reject or accept */ + V = lambda0 * _unur_call_urng(gen->urng); + + /* verify majorizing hazard rate */ + if ( (X <= GEN->p0 && (1.+UNUR_EPSILON) * lambda0 < hrx1 ) || + (X >= GEN->p0 && (1.-UNUR_EPSILON) * lambda0 > hrx1 ) ) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"HR not increasing"); + } + + if( V <= hrx1 ) + /* accept */ + break; + + if (i0>HRI_EMERGENCY_BREAK) { + /* emergency break */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"abort computation"); + return UNUR_INFINITY; + } + + } + + /* accept point if not larger than design (split) point */ + if (X <= GEN->p0) { +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & HRI_DEBUG_SAMPLE) + _unur_hri_debug_sample( gen, X, X, i0, 0 ); +#endif + return X; + } + + /* + ------------------- + 2nd thinning loop + ------------------- + */ + + /* parameter for majorizing hazard rate of first component */ + lambda1 = hrx1 - lambda0; + + /* check parameter */ + if (lambda1 <= 0.) { + /* hazard rate not strictly increasing. + assume hazard rate satisfies condition (i.e. increasing), + and this hazard rate constant between p0 and X. + */ +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & HRI_DEBUG_SAMPLE) + _unur_hri_debug_sample( gen, X, X, i0, 0 ); +#endif + return X; + } + + /* starting point */ + p1 = X; + X = GEN->p0; + + for(i1=1;;i1++) { + /* sample from U(0,1) */ + while ( _unur_iszero(U = 1.-_unur_call_urng(gen->urng)) ); + + /* sample from exponential distribution with scale parameter lambda */ + E = -log(U) / lambda1; + + /* next step */ + X += E; + + /* reject or accept */ + V = lambda0 + lambda1 * _unur_call_urng(gen->urng); + + /* hazard rate at generated point */ + hrx = HR(X); + + /* verify majorizing hazard rate */ + if ( (X <= p1 && (1.+UNUR_EPSILON) * (lambda0+lambda1) < hrx ) || + (X >= p1 && (1.-UNUR_EPSILON) * (lambda0+lambda1) > hrx ) ) + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"HR not increasing"); + + /* squeeze */ + if (V <= GEN->hrp0) + /* we use hazard rate at design point p0 as squeeze (since HR increasing) */ + break; + + /* hazard rate at generated point */ + if (V <= hrx) + break; + + if (i1>HRI_EMERGENCY_BREAK) { + /* emergency break */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"abort computation"); + return UNUR_INFINITY; + } + + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & HRI_DEBUG_SAMPLE) + _unur_hri_debug_sample( gen, X, p1, i0, i1 ); +#endif + + return ((X <= p1) ? X : p1); + +} /* end of _unur_hri_sample_check() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_hri_debug_init( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HRI_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = HRI (Hazard Rate Increasing)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cont_debug( gen->distr, gen->genid ); + + fprintf(LOG,"%s: sampling routine = _unur_hri_sample",gen->genid); + if (gen->variant & HRI_VARFLAG_VERIFY) + fprintf(LOG,"_check()\n"); + else + fprintf(LOG,"()\n"); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: design point p0 = %g (HR(p0)=%g)",gen->genid,GEN->p0,GEN->hrp0); + _unur_print_if_default(gen,HRI_SET_P0); + fprintf(LOG,"\n%s: left boundary = %g\n",gen->genid,GEN->left_border); + + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_hri_debug_init() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_hri_debug_sample( const struct unur_gen *gen, + double x, double p1, int i0, int i1 ) + /*----------------------------------------------------------------------*/ + /* write info about generated point into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* x ... generated point */ + /* p1 ... point generated at first thing loop */ + /* i0 ... number of iterations in first thinning loop */ + /* i1 ... number of iterations in second thinning loop */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HRI_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: X = %g\t(p1=%g)\t#iterations = %d + %d = %d",gen->genid, + x, p1, i0, i1, i0+i1); + if (i1) + fprintf(LOG," 2nd loop\n"); + else + fprintf(LOG,"\n"); + +} /* end of _unur_hri_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_hri_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + int samplesize = 10000; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = HR\n"); + _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info,"\n"); + + /* method */ + _unur_string_append(info,"method: HRI (Hazard Rate Increasing)\n"); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," E[#iterations] = %.2f [approx.]\n", + unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize)); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + _unur_string_append(info," p0 = %g %s\n", GEN->p0, + (gen->set & HRI_SET_P0) ? "" : "[default]"); + if (gen->variant & HRI_VARFLAG_VERIFY) + _unur_string_append(info," verify = on\n"); + _unur_string_append(info,"\n"); + } + + /* Hints */ + if (help) { + if ( !(gen->set & HRI_SET_P0)) + _unur_string_append(info,"[ Hint: %s ]\n", + "You can set the design point \"p0\" to increase performance."); + _unur_string_append(info,"\n"); + } + +} /* end of _unur_hri_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/hri.h b/vendor/unuran-1.11.0/src/methods/hri.h new file mode 100644 index 0000000..43583de --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/hri.h @@ -0,0 +1,139 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: hri.h * + * * + * PURPOSE: * + * function prototypes for method HRI * + * (Hazard Rate Increasing) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD HRI Hazard Rate Increasing + + =UP Methods_for_CONT + + =REQUIRED increasing (non-decreasing) hazard rate + + =SPEED Set-up: fast, Sampling: slow + + =REINIT supported + + =REF [HLD04: Sect.9.1.6, Alg.9.6] + + =DESCRIPTION + Generates random variate with given non-increasing hazard rate. + It is necessary that the distribution object contains this hazard rate. + Increasing hazard rate implies that the corresponding PDF of the + distribution has heavier tails than the exponential distribution + (which has constant hazard rate). + + The method uses a decomposition of the hazard rate into a main + part which is constant for all @i{x} beyond some point @i{p0} + and a remaining part. From both of these parts points are + sampled using the thinning method and the minimum of both is + returned. Sampling from the first part is easier as we have a + constant dominating hazard rate. Thus @i{p0} should be large. On + the other hand, if @i{p0} is large than the thinning algorithm + needs many iteration. Thus the performance of the the algorithm + deponds on the choice of @i{p0}. We found that values close to + the expectation of the generated distribution result in good + performance. + + =HOWTOUSE + HRI requires a hazard function for a continuous distribution + with non-decreasing hazard rate. + The parameter @i{p0} should be set to a value close to the + expectation of the required distribution using + unur_hri_set_p0(). If performance is crucial one may try other + values as well. + + It is important to note that the domain of the distribution can + be set via a unur_distr_cont_set_domain() call. However, only + the left hand boundary is used. For computational reasons the + right hand boundary is always reset to @code{UNUR_INFINITY}. + If no domain is given by the user then the left hand boundary is + set to @code{0}. + + For distributions with decreasing hazard rate method HRD + (@pxref{HRI,,Hazard Rate Decreasing}) is required. + For distributions which do not have increasing or decreasing + hazard rates but are bounded from above use method HRB + (@pxref{HRB,,Hazard Rate Bounded}). + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + + + Notice, that the upper bound given by the unur_hrb_set_upperbound() call + cannot be changed and must be valid for the changed distribution. + Notice that the parameter @i{p0} which has been set by a unur_hri_set_p0() + call cannot be changed and must be valid for the changed distribution. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_hri_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_hri_set_p0( UNUR_PAR *parameters, double p0 ); +/* + Set design point for algorithm. It is used to split the domain of the + distribution. Values for @var{p0} close to the expectation of the + distribution results in a relatively good performance of the algorithm. + It is important that the hazard rate at this point must be greater + than @code{0} and less than @code{UNUR_INFINITY}. + + Default: left boundary of domain + @code{1.} +*/ + +int unur_hri_set_verify( UNUR_PAR *parameters, int verify ); +/* */ + +int unur_hri_chg_verify( UNUR_GEN *generator, int verify ); +/* + Turn verifying of algorithm while sampling on/off. + If the hazard rate is not bounded by the given bound, then + @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. + + Default is FALSE. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/hri_struct.h b/vendor/unuran-1.11.0/src/methods/hri_struct.h new file mode 100644 index 0000000..c622ca7 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/hri_struct.h @@ -0,0 +1,75 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: hri_struct.h * + * * + * PURPOSE: * + * declares structures for method HRI * + * (Hazard Rate Increasing) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_hri_par { + double p0; /* design (splitting) point */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_hri_gen { + double p0; /* design (splitting) point */ + double left_border; /* left border of domain */ + double hrp0; /* hazard rate at p0 */ +}; + +/*---------------------------------------------------------------------------*/ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/unuran-1.11.0/src/methods/itdr.c b/vendor/unuran-1.11.0/src/methods/itdr.c new file mode 100644 index 0000000..a6e30db --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/itdr.c @@ -0,0 +1,1692 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: itdr.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: inverse transformed density rejection * + * * + * DESCRIPTION: * + * Given PDF and pole. * + * Produce a value x consistent with its density. * + * * + * REQUIRED: * + * pointer to the density function * + * location of pole * + * * + * OPTIONAL: * + * splitting point between pole and tail region * + * c-value for pole and tail region, repectively * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * * + * [1] W. Hoermann, J. Leydold, and G. Derflinger (2007): * + * ACM Trans. Model. Comput. Simul. 17(4), pp.18. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "itdr.h" +#include "itdr_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Constants: */ + +/* maximum value for parameter c */ +/* (if this value is changed, then also change the value in the WARNING */ +/* message in the set calls unur_itdr_set_cp() and unur_itdr_set_cp()! ) */ +#define C_MAX (-0.1) + +/* relative distance for computing derivatives numerically */ +/* (1.e-6 yieldes better results than 1.e-8 when compared with exact values) */ +#define DX (1.e-6) + +/* point near pole for estimating lim_{x->plole} ilc(x) */ +/* the point x_i * NEAR_POLE is used */ +#define NEAR_POLE (1.e-8) + +/* precision when computing intersection points. */ +/* since the performance is not very sensitive to the accuracy of the result */ +/* this value need not be very small. */ +#define RESOLUTION_XI (1.e-5) + +/*---------------------------------------------------------------------------*/ +/* Variants: */ + +#define ITDR_VARFLAG_VERIFY 0x001u /* run verify mode */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define ITDR_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define ITDR_SET_XI 0x001u /* set intersection point */ +#define ITDR_SET_CP 0x002u /* set c-value for pole region */ +#define ITDR_SET_CT 0x004u /* set c-value for tail region */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "ITDR" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_itdr_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_itdr_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_itdr_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_itdr_check_par( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_itdr_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_itdr_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_itdr_sample( struct unur_gen *gen ); +static double _unur_itdr_sample_check( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_itdr_get_hat( struct unur_gen *gen ); +static int _unur_itdr_get_hat_pole( struct unur_gen *gen ); +static int _unur_itdr_get_hat_tail( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* construct hat function */ +/*---------------------------------------------------------------------------*/ + +static double _unur_itdr_lc( struct unur_gen *gen, double x ); +/*---------------------------------------------------------------------------*/ +/* compute local concavity at x */ +/*---------------------------------------------------------------------------*/ + +static double _unur_itdr_ilc( struct unur_gen *gen, double x ); +/*---------------------------------------------------------------------------*/ +/* compute inverse local concavity at x */ +/*---------------------------------------------------------------------------*/ + +static double _unur_itdr_find_xt( struct unur_gen *gen, double b ); +/*---------------------------------------------------------------------------*/ +/* solves equation (x-b)*f'(x)+f(x)=0, where f is PDF of distribution */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ +static void _unur_itdr_debug_init( const struct unur_gen *gen, int error ); + +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_itdr_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cont /* data for distribution object */ + +#define PAR ((struct unur_itdr_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_itdr_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define BD_LEFT domain[0] /* left boundary of domain of distribution */ +#define BD_RIGHT domain[1] /* right boundary of domain of distribution */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +/* the hat is computed for density PDF(sign*(x-pole)). Thus we have to */ +/* transform the internal x value back to the original scale before the PDF */ +/* is evaluated or the generated value is returned. */ +/* likewise, all x values for the PDF given by the user has to transformed */ +/* into the internal scale. */ +/* transformation: internal scale --> original scale */ +#define I2O(x) ( GEN->sign*(x) + GEN->pole ) +/* transformation: original scale --> internal scale */ +#define O2I(x) ( GEN->sign * ((x)-GEN->pole) ) + +/* call to PDF and its derivative in internal scale */ +#define PDF(x) ( _unur_cont_PDF(I2O(x), gen->distr) ) +#define dPDF(x) ( GEN->sign * _unur_cont_dPDF(I2O(x), gen->distr) ) + +/* call to PDF and its derivative in original scale */ +#define PDFo(x) ( _unur_cont_PDF((x), gen->distr) ) +#define dPDFo(x) ( _unur_cont_dPDF((x), gen->distr) ) + + + +#define logPDF(x) ( _unur_cont_logPDF(I2O(x), gen->distr) ) /* call to logPDF */ +#define dlogPDF(x) ( GEN->sign * _unur_cont_dlogPDF(I2O(x), gen->distr) ) /* call to derivative of log PDF */ + +#define logPDFo(x) ( _unur_cont_logPDF((x), gen->distr) ) /* call to logPDF */ +#define dlogPDFo(x) ( _unur_cont_dlogPDF((x), gen->distr) ) /* call to derivative of log PDF */ + + +/*---------------------------------------------------------------------------*/ +/* transformations */ + +/* T_c(x) */ +#define T(c,x) ( -pow((x), (c)) ) +#define DT(c,x) ( -(c)*pow((x), ((c)-1.)) ) +#define TI(c,x) ( pow(-(x), 1./(c)) ) +#define FT(c,x) ( -pow(-(x), ((c)+1.)/(c))*((c)/((c)+1.)) ) +#define FTI(c,x) ( -pow(-(x)*((c)+1.)/(c), (c)/((c)+1.)) ) + +/* logarithm of inverse transformation */ +#define logTI(c,x) ( -log(-(x)) / (c) ) + +/* special case: T_{-1/2}(x) ["square root transformation"] */ +#define TsI(c,x) ( 1./((x)*(x)) ) +#define FTs(c,x) ( -1./(x) ) +#define FTsI(c,x) ( -1./(x) ) + +/*---------------------------------------------------------------------------*/ + +#define _unur_itdr_getSAMPLE(gen) \ + ( ((gen)->variant & ITDR_VARFLAG_VERIFY) \ + ? _unur_itdr_sample_check : _unur_itdr_sample ) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_itdr_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + + if (DISTR_IN.pdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); + return NULL; + } + + if (DISTR_IN.dpdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"dPDF"); + return NULL; + } + + if (!(distr->set & UNUR_DISTR_SET_MODE)) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode (pole)"); + return NULL; + } + + if ( ! (_unur_isfinite(DISTR_IN.mode) && + (_unur_FP_equal(DISTR_IN.mode,DISTR_IN.domain[0]) || + _unur_FP_equal(DISTR_IN.mode,DISTR_IN.domain[1]))) ) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_PROP,"pole not on boundary of domain"); + return NULL; + } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_itdr_par) ); + COOKIE_SET(par,CK_ITDR_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->xi = UNUR_INFINITY; /* intersection point lc(x)=ilc(x) */ + PAR->cp = UNUR_INFINITY; /* c-value for pole region (unknown) */ + PAR->ct = UNUR_INFINITY; /* c-value for tail region (unknown) */ + + par->method = UNUR_METH_ITDR; /* method and default variant */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_itdr_init; + + return par; + +} /* end of unur_itdr_new() */ + +/*****************************************************************************/ + +int +unur_itdr_set_xi( struct unur_par *par, double xi ) + /*----------------------------------------------------------------------*/ + /* Sets intersection point xi where lc(x) = ilc(x) */ + /* */ + /* parameters: */ + /* xi ... intersection point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, ITDR ); + + /* check new parameter for generator */ + if (xi <= par->distr->data.cont.BD_LEFT || + xi >= par->distr->data.cont.BD_RIGHT) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"xi out of domain"); + return UNUR_ERR_PAR_SET; + } + + /* store value */ + PAR->xi = xi; + + /* changelog */ + par->set |= ITDR_SET_XI; + + return UNUR_SUCCESS; +} /* end of unur_itdr_set_bx() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_itdr_set_cp( struct unur_par *par, double cp ) + /*----------------------------------------------------------------------*/ + /* Sets c-value for transformation T for inverse density in pole region */ + /* */ + /* parameters: */ + /* cp ... c-value for pole region */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, ITDR ); + + /* check new parameter for generator */ + if ( cp > C_MAX || cp <= -1. ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"cp > -0.1 or <= -1"); + return UNUR_ERR_PAR_SET; + } + + /* store value */ + PAR->cp = cp; + + /* changelog */ + par->set |= ITDR_SET_CP; + + return UNUR_SUCCESS; +} /* end of unur_itdr_set_cp() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_itdr_set_ct( struct unur_par *par, double ct ) + /*----------------------------------------------------------------------*/ + /* Sets c-value for transformation T for density in tail region */ + /* */ + /* parameters: */ + /* ct ... c-value for tail region */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double range; + + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, ITDR ); + + /* check new parameter for generator */ + range = ( par->distr->data.cont.BD_RIGHT + - par->distr->data.cont.BD_LEFT ); + if ( ct > C_MAX || (ct <= -1. && !_unur_isfinite(range)) ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"ct > -0.1 or <= -1"); + return UNUR_ERR_PAR_SET; + } + + /* store value */ + PAR->ct = ct; + + /* changelog */ + par->set |= ITDR_SET_CT; + + return UNUR_SUCCESS; +} /* end of unur_itdr_set_ct() */ + +/*---------------------------------------------------------------------------*/ + +double unur_itdr_get_xi( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get intersection point xi */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* xi ... on success */ + /* UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + _unur_check_gen_object( gen, ITDR, UNUR_INFINITY ); + + return GEN->xi; +} /* end of unur_itdr_get_xi() */ + +/*---------------------------------------------------------------------------*/ + +double unur_itdr_get_cp( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get intersection c-value for pole region */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* cp ... on success */ + /* UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + _unur_check_gen_object( gen, ITDR, UNUR_INFINITY ); + + return GEN->cp; +} /* end of unur_itdr_get_cp() */ + +/*---------------------------------------------------------------------------*/ + +double unur_itdr_get_ct( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get intersection c-value for tail region */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* ct ... on success */ + /* UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + _unur_check_gen_object( gen, ITDR, UNUR_INFINITY ); + + return GEN->ct; +} /* end of unur_itdr_get_ct() */ + +/*---------------------------------------------------------------------------*/ + +double unur_itdr_get_area( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get area below hat */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* area ... on success */ + /* UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + _unur_check_gen_object( gen, ITDR, UNUR_INFINITY ); + + return GEN->Atot; +} /* end of unur_itdr_get_area() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_itdr_set_verify( struct unur_par *par, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, ITDR ); + + /* we use a bit in variant */ + par->variant = (verify) + ? (par->variant | ITDR_VARFLAG_VERIFY) + : (par->variant & (~ITDR_VARFLAG_VERIFY)); + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_itdr_set_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_itdr_chg_verify( struct unur_gen *gen, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, ITDR, UNUR_ERR_GEN_INVALID ); + + /* we must not change this switch when sampling has been disabled by + using a pointer to the error producing routine */ + if (SAMPLE == _unur_sample_cont_error) + return UNUR_FAILURE; + + if (verify) + /* turn verify mode on */ + gen->variant |= ITDR_VARFLAG_VERIFY; + else + /* turn verify mode off */ + gen->variant &= ~ITDR_VARFLAG_VERIFY; + + SAMPLE = _unur_itdr_getSAMPLE(gen); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_itdr_chg_verify() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_itdr_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* params ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_ITDR ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_ITDR_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_itdr_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* check parameters */ + if (_unur_itdr_check_par(gen) != UNUR_SUCCESS) { + _unur_itdr_free(gen); return NULL; + } + + /* create hat function */ + if (_unur_itdr_get_hat(gen) != UNUR_SUCCESS) { +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_itdr_debug_init(gen,UNUR_FAILURE); +#endif + _unur_itdr_free(gen); return NULL; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_itdr_debug_init(gen,UNUR_SUCCESS); +#endif + + return gen; + +} /* end of _unur_itdr_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_itdr_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int rcode; + + /* we do not use the given values for when we run reinit */ + gen->set &= ~(ITDR_SET_XI | ITDR_SET_CP | ITDR_SET_CT); + + /* check parameters */ + if ( (rcode = _unur_itdr_check_par(gen)) != UNUR_SUCCESS) + return rcode; + + /* create hat function */ + rcode = _unur_itdr_get_hat(gen); + + /* (re)set sampling routine */ + SAMPLE = _unur_itdr_getSAMPLE(gen); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & ITDR_DEBUG_REINIT) + _unur_itdr_debug_init(gen,rcode); +#endif + + return rcode; +} /* end of _unur_itdr_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_itdr_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_ITDR_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_itdr_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_ITDR_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_itdr_getSAMPLE(gen); + gen->destroy = _unur_itdr_free; + gen->clone = _unur_itdr_clone; + gen->reinit = _unur_itdr_reinit; + + /* copy data from distribution into generator object*/ + GEN->pole = DISTR.mode; /* location of pole */ + + /* copy some parameters into generator object */ + GEN->xi = PAR->xi; /* intersection point lc(x)=ilc(x) */ + GEN->cp = PAR->cp; /* c-value for pole region */ + GEN->ct = PAR->ct; /* c-value for tail region */ + + /* initialize values */ + GEN->bx = UNUR_INFINITY; /* splitting point betw. pole and tail */ + GEN->xp = UNUR_INFINITY; /* design point in pole region */ + GEN->xt = UNUR_INFINITY; /* design point in tail region */ + GEN->alphap = UNUR_INFINITY; /* parameters for hat in pole region */ + GEN->betap = UNUR_INFINITY; + GEN->Tfxt = UNUR_INFINITY; /* parameters for hat in tail region */ + GEN->dTfxt = UNUR_INFINITY; /* parameters for hat in tail region */ + GEN->by = UNUR_INFINITY; /* hat of pole region at bx */ + GEN->Ap = UNUR_INFINITY; /* areas in upper pole region */ + GEN->Ac = UNUR_INFINITY; /* areas in central region */ + GEN->At = UNUR_INFINITY; /* areas in tail region */ + GEN->Atot = UNUR_INFINITY; /* total area below hat */ + GEN->sy = 0.; /* squeeze for central region */ + GEN->sign = 1.; /* region: +1 .. (-oo,0], -1 .. [0,oo) */ + GEN->bd_right = UNUR_INFINITY;/* right boundary of shifted domain */ + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_itdr_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_itdr_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_itdr_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + + /* copy data from distribution into generator object*/ + GEN->pole = DISTR.mode; /* location of pole */ + + /* estimate sign of region: +1 ... (-oo,0], -1 ... [0,oo) */ + do { + if (_unur_isfinite(DISTR.BD_LEFT) && !_unur_isfinite(DISTR.BD_RIGHT)) { + GEN->sign = 1.; + if (dPDFo(DISTR.BD_LEFT) <= 0.) break; + } + if (!_unur_isfinite(DISTR.BD_LEFT) && _unur_isfinite(DISTR.BD_RIGHT)) { + GEN->sign = -1.; + if (dPDFo(DISTR.BD_RIGHT) >= 0.) break; + } + if (_unur_isfinite(DISTR.BD_LEFT) && _unur_isfinite(DISTR.BD_RIGHT)) { + GEN->sign = (PDFo(DISTR.BD_LEFT)>=PDFo(DISTR.BD_RIGHT)) ? 1. : -1.; + if ( GEN->sign*dPDFo(DISTR.BD_LEFT) <= 0. && + GEN->sign*dPDFo(DISTR.BD_RIGHT) <= 0. ) + break; + } + /* else */ + _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"cannot compute sign of region"); + return UNUR_ERR_DISTR_PROP; + } while (1); + + /* right boundary of shifted domain */ + GEN->bd_right = ( (GEN->sign > 0) + ? DISTR.BD_RIGHT - GEN->pole + : GEN->pole - DISTR.BD_LEFT ); + + return UNUR_SUCCESS; +} /* end of _unur_itdr_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_itdr_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_itdr_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_ITDR_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + return clone; + +#undef CLONE +} /* end of _unur_itdr_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_itdr_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_ITDR ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_ITDR_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_itdr_free() */ + +/*****************************************************************************/ + +double +_unur_itdr_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U, V, X, Y; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_ITDR_GEN,UNUR_INFINITY); + + while (1) { + /* generate point uniformly on (0,Atot) */ + U = _unur_call_urng(gen->urng) * GEN->Atot; + + /* generate pair (X,Y) below hat */ + + if (U < GEN->Ap) { + /* upper pole region */ + V = _unur_call_urng(gen->urng) * GEN->Ap; + if (_unur_isfsame(GEN->cp, -0.5)) { + /* square root transformation */ + Y = ( FTsI(GEN->cp, GEN->betap*V + FTs(GEN->cp,GEN->alphap+GEN->betap*GEN->by)) + - GEN->alphap ) / GEN->betap; + X = U * TsI(GEN->cp, GEN->alphap+GEN->betap*Y) / GEN->Ap; + } + else { + /* general T_c transformation */ + Y = ( FTI(GEN->cp, GEN->betap*V + FT(GEN->cp,GEN->alphap+GEN->betap*GEN->by)) + - GEN->alphap ) / GEN->betap; + X = U * TI(GEN->cp, GEN->alphap+GEN->betap*Y) / GEN->Ap; + } + } + + else if ((U -= GEN->Ap) < GEN->Ac) { + /* central region */ + X = U * GEN->bx / GEN->Ac; + Y = _unur_call_urng(gen->urng) * GEN->by; + if (Y <= GEN->sy) + /* squeeze acceptance */ + return (I2O(X)); + } + + else { + /* tail region */ + U -= GEN->Ac; + if (_unur_isfsame(GEN->ct, -0.5)) { + /* square root transformation */ + X = GEN->xt + (FTsI(GEN->ct, + GEN->dTfxt*U + + FTs(GEN->ct, + GEN->Tfxt + GEN->dTfxt*(GEN->bx-GEN->xt)) + ) + - GEN->Tfxt) / GEN->dTfxt; + Y = ( _unur_call_urng(gen->urng) + * TsI(GEN->ct, GEN->Tfxt + GEN->dTfxt*(X - GEN->xt))); + } + else { + /* general T_c transformation */ + X = GEN->xt + (FTI(GEN->ct, + GEN->dTfxt*U + + FT(GEN->ct, + GEN->Tfxt + GEN->dTfxt*(GEN->bx-GEN->xt)) + ) + - GEN->Tfxt) / GEN->dTfxt; + Y = ( _unur_call_urng(gen->urng) + * TI(GEN->ct, GEN->Tfxt + GEN->dTfxt*(X - GEN->xt))); + } + } + + /* transform back into original scale */ + X = I2O(X); + + /* accept or reject */ + if (Y <= PDFo(X)) + return X; + } + +} /* end of _unur_itdr_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_itdr_sample_check( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator and verify that method can be used */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ +#define ht(x) ( TI(GEN->ct, GEN->Tfxt + GEN->dTfxt*((x)-GEN->xt)) ) +#define hp(x) ( (T(GEN->cp,(x)) - GEN->alphap) / GEN->betap ) + + double U, V, X, Y; + double fx, hx, sqx; /* values of PDF, hat and squeeze at x */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_ITDR_GEN,UNUR_INFINITY); + + while (1) { + /* generate point uniformly on (0,Atot) */ + U = _unur_call_urng(gen->urng) * GEN->Atot; + + /* generate pair (X,Y) below hat */ + + if (U < GEN->Ap) { + /* upper pole region */ + V = _unur_call_urng(gen->urng) * GEN->Ap; + if (_unur_isfsame(GEN->cp, -0.5)) { + /* square root transformation */ + Y = ( FTsI(GEN->cp, GEN->betap*V + FTs(GEN->cp,GEN->alphap+GEN->betap*GEN->by)) + - GEN->alphap ) / GEN->betap; + X = U * TsI(GEN->cp, GEN->alphap+GEN->betap*Y) / GEN->Ap; + } + else { + /* general T_c transformation */ + Y = ( FTI(GEN->cp, GEN->betap*V + FT(GEN->cp,GEN->alphap+GEN->betap*GEN->by)) + - GEN->alphap ) / GEN->betap; + X = U * TI(GEN->cp, GEN->alphap+GEN->betap*Y) / GEN->Ap; + } + hx = hp(X); + sqx = 0.; + } + + else if ((U -= GEN->Ap) < GEN->Ac) { + /* central region */ + X = U * GEN->bx / GEN->Ac; + Y = _unur_call_urng(gen->urng) * GEN->by; + hx = hp(X); + sqx = GEN->sy; + /* no squeeze acceptance in verify mode */ + /* [ if (Y <= GEN->sy) return (I2O(X)); ] */ + } + + else { + /* tail region */ + U -= GEN->Ac; + if (_unur_isfsame(GEN->ct, -0.5)) { + /* square root transformation */ + X = GEN->xt + (FTsI(GEN->ct, + GEN->dTfxt*U + + FTs(GEN->ct, + GEN->Tfxt + GEN->dTfxt*(GEN->bx-GEN->xt)) + ) + - GEN->Tfxt) / GEN->dTfxt; + Y = ( _unur_call_urng(gen->urng) + * TsI(GEN->ct, GEN->Tfxt + GEN->dTfxt*(X - GEN->xt))); + } + else { + /* general T_c transformation */ + X = GEN->xt + (FTI(GEN->ct, + GEN->dTfxt*U + + FT(GEN->ct, + GEN->Tfxt + GEN->dTfxt*(GEN->bx-GEN->xt)) + ) + - GEN->Tfxt) / GEN->dTfxt; + Y = ( _unur_call_urng(gen->urng) + * TI(GEN->ct, GEN->Tfxt + GEN->dTfxt*(X - GEN->xt))); + } + hx = ht(X); + sqx = 0.; + } + + /* transform back into original scale */ + X = I2O(X); + + /* compute PDF at x */ + fx = PDFo(X); + + /* verify hat and squeeze function */ + if ( (1.+UNUR_EPSILON) * hx < fx ) + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) > hat(x)"); + + if ( (1.-UNUR_EPSILON) * sqx > fx ) + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) < squeeze(x)"); + + /* accept or reject */ + if (Y <= PDFo(X)) + return X; + } + +#undef ht +#undef hp +} /* end of _unur_itdr_sample_check() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_itdr_get_hat( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* construct hat function */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_ITDR_GEN,UNUR_ERR_COOKIE); + + /* Get candidate for bx */ + if (gen->set & ITDR_SET_XI) { + /* bx set user; have to shift by pole */ + GEN->bx = O2I(GEN->xi); + } + else { + /* compute intersection point of local concavity and inverse lc */ + GEN->bx = _unur_itdr_find_xt( gen, 0. ); + GEN->xi = I2O(GEN->bx); + if (!_unur_isfinite(GEN->bx)) { + _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"cannot compute bx"); + return UNUR_ERR_DISTR_PROP; + } + } + + /* pole region */ + if (_unur_itdr_get_hat_pole(gen) != UNUR_SUCCESS) + return UNUR_ERR_DISTR_PROP; + + /* tail region */ + if (_unur_FP_equal(GEN->bx, GEN->bd_right)) { + GEN->At = 0.; + } + else { + if (_unur_itdr_get_hat_tail(gen) != UNUR_SUCCESS) + return UNUR_ERR_DISTR_PROP; + } + + /* total area below hat */ + GEN->Atot = GEN->Ap + GEN->Ac + GEN->At; + + return UNUR_SUCCESS; +} /* end of _unur_itdr_get_hat() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_itdr_get_hat_pole( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* construct hat function in pole region */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ +#define hp(x) ( (T(cp,(x)) - GEN->alphap) / GEN->betap ) + + double cp, xp; + double pdf_bx; + double near_pole, ilc_near_pole, pdf_near_pole, logpdf_near_pole; + double ilc_bx = -UNUR_INFINITY; + + /* get cp */ + if (gen->set & ITDR_SET_CP) { + /* cp set by user */ + cp = GEN->cp; + } + else { + ilc_bx = _unur_itdr_ilc(gen, GEN->bx); + near_pole = GEN->bx*NEAR_POLE + fabs(GEN->pole)*DBL_EPSILON; + ilc_near_pole = (DISTR.logpdf) + ? logPDF(near_pole) / log(near_pole) + : log(PDF(near_pole)) / log(near_pole); + cp = ilc_near_pole; + if (cp > C_MAX) cp = C_MAX; + if (cp <= -1.) { + _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"cannot compute hat for pole: cp"); + return UNUR_ERR_DISTR_PROP; + } + GEN->cp = cp; + } + if (cp < -0.5) + GEN->bx = _unur_min(2.*GEN->bx, GEN->bd_right); + + /* compute PDF at check points */ + pdf_bx = PDF(GEN->bx); + near_pole = fabs(GEN->pole)*DBL_EPSILON; + if (near_pole < 1.e-100) near_pole = 1.e-100; + pdf_near_pole = logpdf_near_pole = UNUR_INFINITY; + while (1) { + /* we have to search for a point with PDF(x) < UNUR_INFINITY */ + if (DISTR.logpdf) { + logpdf_near_pole = logPDF(near_pole); + if (_unur_isfinite(logpdf_near_pole)) + break; + } + else { + pdf_near_pole = PDF(near_pole); + if (_unur_isfinite(pdf_near_pole)) + break; + } + near_pole *= 1000.; + if (!_unur_isfinite(near_pole)) { + _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"cannot compute hat for pole: cp"); + return UNUR_ERR_DISTR_PROP; + } + } + + /* get design point xp */ + while (1) { + xp = GEN->bx * pow(1.+cp, -1./cp); + if ( !(xp > 0. && xp < GEN->bx) ) { + _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"cannot compute hat for pole: xp"); + return UNUR_ERR_DISTR_PROP; + } + + /* parameters for hat */ + GEN->betap = DT(cp,xp) / dPDF(xp); + GEN->alphap = T(cp,xp) - GEN->betap * PDF(xp); + + /* check hat */ + if ( hp(GEN->bx) < pdf_bx || + (DISTR.logpdf && _unur_FP_less(log(hp(near_pole)), logpdf_near_pole)) || + (DISTR.logpdf==NULL && _unur_FP_less(hp(near_pole), pdf_near_pole)) ) { + if (gen->set & ITDR_SET_CP) { + _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"inverse pdf not T_cp concave"); + return UNUR_ERR_DISTR_PROP; + } + /* try new value for cp */ + GEN->cp = cp = 0.9*cp-0.1; + if (cp < ilc_bx) { + /* we try ilc at bx first before we use an even smaller value for cp */ + GEN->cp = cp = ilc_bx; + ilc_bx = -UNUR_INFINITY; + } + if (cp < -0.999) { + _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"cannot compute hat for pole: cp"); + return UNUR_ERR_DISTR_PROP; + } + } + else break; + } + GEN->xp = xp; + + /* hat at intersection point */ + GEN->by = hp(GEN->bx); + + /* area below hat */ + GEN->Ap = -FT(cp, GEN->alphap + GEN->betap * GEN->by) / GEN->betap; + GEN->Ac = GEN->by * GEN->bx; + + /* add squeeze for central region */ + GEN->sy = PDF(GEN->bx); + + return UNUR_SUCCESS; + +#undef hp +} /* end of _unur_itdr_get_hat_pole() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_itdr_get_hat_tail( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* construct hat function in tail region */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ +#define ht(x) ( TI(ct, GEN->Tfxt + GEN->dTfxt*((x)-xt)) ) +#define loght(x) ( TI(ct, GEN->Tfxt + GEN->dTfxt*((x)-xt)) ) + + double ct, xt; + double lc_bx, lc_inf; + double br; + double bx = GEN->bx; + + /* get design point xt */ + GEN->xt = xt = _unur_itdr_find_xt( gen, bx ); + + /* get ct */ + if (gen->set & ITDR_SET_CT) { + /* ct set by user */ + ct = GEN->ct; + } + else { + /* first try: use point between bx and xt */ + ct = _unur_itdr_lc(gen, 0.5*(bx + xt)); + /* check local concavity at right boundary */ + if ( _unur_isfinite(GEN->bd_right)) + lc_inf = _unur_itdr_lc(gen, GEN->bd_right); + else { /* right boundary = infinity */ + if (DISTR.logpdf) { + lc_inf = log(1.e100) / logPDF(1.e100); + /* we need lim x->oo log(x) / log(f(x)) */ + /* however, this convergence is very slow. */ + /* so we add -0.1 to be on the save side. */ + lc_inf += -0.01; + } + else { + lc_inf = log(1.e10*bx) / log(PDF(1.e10*bx)); + /* we need lim x->oo log(x) / log(f(x)) */ + /* however, this convergence is very slow. */ + /* so we add -0.1 to be on the save side. */ + lc_inf += -0.05; + } + } + if (lc_inf < ct) ct = lc_inf; + + /* ct should not be too close to 0. */ + if (ct > C_MAX) ct = C_MAX; + if (ct <= -1.) { + _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"cannot compute hat for tail: ct"); + return UNUR_ERR_DISTR_PROP; + } + GEN->ct = ct; + } + + /* compute and check parameters for hat */ + lc_bx = _unur_itdr_lc(gen, bx); + while (1) { + /* parameters for hat */ + GEN->Tfxt = T(ct, PDF(xt)); + GEN->dTfxt = DT(ct, PDF(xt)) * dPDF(xt); + + /* check hat */ + br = 1000.*bx; /* "very large x" */ + if (br > GEN->bd_right) br = GEN->bd_right; + + if ( ((GEN->Tfxt + GEN->dTfxt*(bx-xt)) >= 0.) || + (DISTR.logpdf && (_unur_FP_less(loght(br),logPDF(br)) || + _unur_FP_less(loght(bx), logPDF(bx)) )) || + (DISTR.logpdf==NULL && (_unur_FP_less(ht(br),PDF(br)) || + _unur_FP_less(ht(bx), PDF(bx)) )) ) { + if (gen->set & ITDR_SET_CT) { + _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"pdf not T_ct concave"); + return UNUR_ERR_DISTR_PROP; + } + /* try new value for ct */ + ct = 0.5*(ct + lc_bx); + if (ct > GEN->ct || ct < -0.999 || _unur_FP_approx(ct,lc_bx)) { + /* new ct value is even larger or too small or its time to stop */ + _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"cannot compute hat for tail: ct"); + return UNUR_ERR_DISTR_PROP; + } + GEN->ct = ct; + } + else + break; + } + + /* area below hat */ + GEN->At = (!_unur_isfinite(GEN->bd_right)) ? 0. + : FT(ct, GEN->Tfxt + GEN->dTfxt * (GEN->bd_right - xt)) / GEN->dTfxt; + GEN->At += -FT(ct, GEN->Tfxt + GEN->dTfxt * (GEN->bx - xt)) / GEN->dTfxt; + + return UNUR_SUCCESS; + +#undef ht +#undef loght +} /* end of _unur_itdr_get_hat_tail() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_itdr_lc( struct unur_gen *gen, double x ) + /*----------------------------------------------------------------------*/ + /* compute local concavity at x */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* x ... point x */ + /* */ + /* return: */ + /* local concavity */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double dx, f, df, ddf; + + if (DISTR.dlogpdf == NULL) { + /* use PDF */ + + f = PDF(x); + df = dPDF(x); + + dx = x * DX + fabs(GEN->pole) * UNUR_SQRT_DBL_EPSILON; + if (x-dx <= 0.) dx = x; + if (x+dx > GEN->bd_right) + ddf = (dPDF(x)-dPDF(x-dx))/dx; + else + ddf = (dPDF(x+dx)-dPDF(x-dx))/(2.*dx); + + return 1. - ddf*f/(df*df); + } + + else { + /* use logarithm of PDF */ + + dx = x * DX + fabs(GEN->pole) * UNUR_SQRT_DBL_EPSILON; + if (x-dx <= 0.) dx = x; + + if (x+dx > GEN->bd_right) + return (1./dlogPDF(x) - 1./dlogPDF(x-dx))/dx; + else + return (1./dlogPDF(x+dx) - 1./dlogPDF(x-dx))/(2.*dx); + } + +} /* end of _unur_itdr_lc() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_itdr_ilc( struct unur_gen *gen, double x ) + /*----------------------------------------------------------------------*/ + /* compute inverse local concavity at x */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* x ... point x */ + /* */ + /* return: */ + /* inverse local concavity */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + + if (DISTR.dlogpdf == NULL) { + /* use PDF */ + double dx, df, ddf; + + df = dPDF(x); + + dx = x * DX + fabs(GEN->pole) * UNUR_SQRT_DBL_EPSILON; + if (x-dx <= 0.) dx = x; + + if (x+dx > GEN->bd_right) + ddf = (dPDF(x)-dPDF(x-dx))/dx; + else + ddf = (dPDF(x+dx)-dPDF(x-dx))/(2.*dx); + + return 1.+x*ddf/(df); + } + + else { + /* use logarithm of PDF */ + double dx, dlf, ddlf; + + dlf = dlogPDF(x); + + dx = x * DX + fabs(GEN->pole) * UNUR_SQRT_DBL_EPSILON; + if (x-dx <= 0.) dx = x; + + if (x+dx > GEN->bd_right) + ddlf = (dlogPDF(x)-dlogPDF(x-dx))/dx; + else + ddlf = (dlogPDF(x+dx)-dlogPDF(x-dx))/(2.*dx); + + return 1.+x*(dlf + ddlf/dlf); + } + +} /* end of _unur_itdr_ilc() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_itdr_find_xt( struct unur_gen *gen, double b ) + /*----------------------------------------------------------------------*/ + /* solves equation (x-b)*f'(x)+f(x)=0, where f is PDF of distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* startx ... starting point for finding x */ + /* */ + /* return: */ + /* solution xi */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + /* function for finding root */ +#define FKT(x) ( DISTR.dlogpdf \ + ? (1./((x)-b) + dlogPDF(x)) \ + : (((x)-b)*dPDF(x) + PDF(x)) ) + + double xl, xu; /* lower and upper boundary of bracket */ + double xn; /* new guess for root */ + + /* check parameter */ + if (b < 0.) return UNUR_INFINITY; + + /* find appropriate starting value */ + xl = b + _unur_max(1., (fabs(GEN->pole)+b)*UNUR_SQRT_DBL_EPSILON); + if (xl > GEN->bd_right) xl = GEN->bd_right; + while (!_unur_isfinite(FKT(xl)) || _unur_iszero(PDF(xl)) ) { + xl = 0.5*(xl + b); + if (!_unur_isfinite(xl) || _unur_FP_same(xl,b)) return UNUR_INFINITY; + } + xu = xl; + + /* check upper value xu */ + if (_unur_FP_greater(xu,GEN->bd_right)) return GEN->bd_right; + + /* find bracket for root */ + if (FKT(xl)>0.) { + do { + xl = xu; + xu += xu - b; + if (!_unur_isfinite(xu) || xu < (1.+2.*DBL_EPSILON)*xl) + /* unable to proceed --> break to avoid infinite loop */ + return UNUR_INFINITY; + if (xu >= GEN->bd_right) + /* we have reached right boundary */ + return GEN->bd_right; + } while(FKT(xu) > 0.); + } + else { /* FKT(xl)<=0. */ + do { + xu = xl; + xl = 0.5*(xl + b); + if (!_unur_isfinite(xl)) return UNUR_INFINITY; + } while(FKT(xl) < 0.); + } + + /* use bisection to find root */ + while(xu > (1.+RESOLUTION_XI)*xl) { + xn = 0.5*(xl+xu); + if(FKT(xn)>0.) + xl = xn; + else + xu = xn; + } + + /* return point */ + return 0.5*(xl+xu); + +#undef FKT +} /* end of _unur_itdr_find_xt() */ + + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_itdr_debug_init( const struct unur_gen *gen, int error ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* error ... error code of hat generation */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ITDR_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = itdr (inverse transformed density rejection)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cont_debug( gen->distr, gen->genid ); + + fprintf(LOG,"%s: sampling routine = _unur_itdr_sample",gen->genid); + if (gen->variant & ITDR_VARFLAG_VERIFY) fprintf(LOG,"_check"); + fprintf(LOG,"()\n%s:\n",gen->genid); + + /* parameters */ + fprintf(LOG,"%s: sign = %g\n",gen->genid, GEN->sign); + fprintf(LOG,"%s: pole = %g\n",gen->genid, GEN->pole); + fprintf(LOG,"%s: bd_right = %g\n",gen->genid, GEN->bd_right); + fprintf(LOG,"%s: xi = %g",gen->genid, GEN->xi); + fprintf(LOG,"%s\n", (gen->set & ITDR_SET_XI) ? "" : " [computed]"); + fprintf(LOG,"%s: bx = %g\n",gen->genid, GEN->bx); + + fprintf(LOG,"%s: pole region:\n",gen->genid); + fprintf(LOG,"%s:\tcp = %g",gen->genid, GEN->cp); + fprintf(LOG,"%s\n", (gen->set & ITDR_SET_CP) ? "" : " [computed]"); + fprintf(LOG,"%s:\txp = %g\n",gen->genid, GEN->xp); + fprintf(LOG,"%s:\talphap = %g, betap = %g\n",gen->genid, GEN->alphap, GEN->betap); + fprintf(LOG,"%s:\tby = %g\n",gen->genid, GEN->by); + fprintf(LOG,"%s:\tsy = %g\n",gen->genid, GEN->sy); + + fprintf(LOG,"%s: tail region:\n",gen->genid); + fprintf(LOG,"%s:\tct = %g",gen->genid, GEN->ct); + fprintf(LOG,"%s\n", (gen->set & ITDR_SET_CT) ? "" : " [computed]"); + fprintf(LOG,"%s:\txt = %g\n",gen->genid, GEN->xt); + fprintf(LOG,"%s:\tTfxt = %g, dTfxt = %g\n",gen->genid, GEN->Tfxt, GEN->dTfxt); + + fprintf(LOG,"%s: Area = %g + %g + %g = %g\n",gen->genid, + GEN->Ap, GEN->Ac, GEN->At, GEN->Atot); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: **** INIT %s ***\n",gen->genid, + (error==UNUR_SUCCESS) ? "successful" : "failed" ); + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_itdr_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_itdr_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + int samplesize = 10000; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = PDF dPDF\n"); + _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info," pole/mode = %g\n", DISTR.mode); + _unur_string_append(info,"\n"); + + /* method */ + _unur_string_append(info,"method: ITDR (Inverse Transformed Density Rejection -- 2 point method)\n"); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," area(hat) = %g [ = %g + %g + %g ]\n", + GEN->Atot, GEN->Ap, GEN->Ac, GEN->At); + _unur_string_append(info," rejection constant = "); + if (distr->set & UNUR_DISTR_SET_PDFAREA) + _unur_string_append(info,"%g\n", GEN->Atot/DISTR.area); + else + _unur_string_append(info,"%.2f [approx. ]\n", + unur_test_count_urn(gen,samplesize,0,NULL)/(2.*samplesize)); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + _unur_string_append(info," cp = %g %s\n", GEN->cp, + (gen->set & ITDR_SET_CP) ? "" : " [computed]"); + _unur_string_append(info," ct = %g %s\n", GEN->cp, + (gen->set & ITDR_SET_CT) ? "" : " [computed]"); + _unur_string_append(info," xi = %g %s\n", GEN->xi, + (gen->set & ITDR_SET_XI) ? "" : " [computed]"); + if (gen->variant & ITDR_VARFLAG_VERIFY) + _unur_string_append(info," verify = on\n"); + _unur_string_append(info,"\n"); + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_itdr_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/itdr.h b/vendor/unuran-1.11.0/src/methods/itdr.h new file mode 100644 index 0000000..1839561 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/itdr.h @@ -0,0 +1,224 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: itdr.h * + * * + * PURPOSE: * + * function prototypes for method ITDR * + * (Inverse Transformed Density Rejection) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD ITDR Inverse Transformed Density Rejection + + =UP Methods_for_CONT + + =REQUIRED monotone PDF, dPDF, pole + + =OPTIONAL splitting point between pole and tail region, c-values + + =SPEED Set-up: moderate, Sampling: moderate + + =REINIT supported + + =REF [HLDa07] + + =DESCRIPTION + ITDR is an acceptance/rejection method that works for monotone + densities. It is especially designed for PDFs with a single + pole. It uses different hat functions for the pole region and + for the tail region. For the tail region @emph{Transformed Density + Rejection} with a single construction point is used. + For the pole region a variant called @emph{Inverse Transformed + Density Rejection} is used. The optimal splitting point between + the two regions and the respective maximum local concavity and + inverse local concavity (@pxref{Glossary}) that guarantee valid + hat functions for each regions are estimated. + This splitting point is set to the intersection point of local + concavity and inverse local concavity. + However, it is assumed that both, the local concavity and the + inverse local concavity do not have a local minimum in the + interior of the domain (which is the case for all standard + distributions with a single pole). + In other cases (or when the built-in search routines do not + compute non-optimal values) one can provide the splitting point, + and the @i{c}-values. + + =HOWTOUSE + Method ITDR requires a distribution object with given PDF + and its derivative and the location of the pole (or mode). + The PDF must be monotone and may contain a pole. + It must be set via the unur_distr_cont_set_pdf() and + unur_distr_cont_set_dpdf() calls. The PDF should return + UNUR_INFINITY for the pole. Alternatively, one can also + set the logarithm of the PDF and its derivative via the + unur_distr_cont_set_logpdf() and unur_distr_cont_set_dlogpdf() + calls. This is in especially useful since then the setup and + search routines are numerically more stable. Moreover, for many + distributions computing the logarithm of the PDF is less + expensive then computing the PDF directly. + + The pole of the distribution is given by a + unur_distr_cont_set_mode() call. Notice that distributions with + ``heavy'' poles may have numerical problems caused by the + resultion of the floating point numbers used by computers. + While the minimal distance between two different floating point + numbers is about @code{1.e-320} near @code{0.} it increases + to @code{1.e-16} near @code{1.} Thus any random variate + generator implemented on a digital computer in fact draws samples + from a discrete distribution that approximates the desired + continuous distribution. For distributions with ``heavy'' poles + not at 0 this approximation may be too crude and thus every + goodness-of-fit test will fail. + Besides this theoretic problem that cannot be resolved we + have to take into consideration that round-off errors occur more + frequently when we have PDFs with poles far away from + @code{0.} Method ITDR tries to handles this situation as good as + possible by moving the pole into @code{0.} + Thus do not use a wrapper for your PDF that hides this shift + since the information about the resolution of the floating point + numbers near the pole gets lost. + + Method ITDR uses different hats for the pole region and for the + tail region. The splitting point between these two regions, the + optimal @i{c}-value and design points for constructing the hats + using Transformed Density Rejection are computed automatically. + (The results of these computations can be read using the + respective calls unur_itdr_get_xi(), unur_itdr_get_cp(), and + unur_itdr_get_ct() for the intersection point between local + concavity and inverse local concavity, the @i{c}-value for the + pole and the tail region.) + However, one can also analyze the local concavity and inverse + local concavity set the corresponding values using + unur_itdr_set_xi(), unur_itdr_set_cp(), and + unur_itdr_set_ct() calls. + Notice, that @i{c}-values greater than -1/2 can be set to + @code{-0.5}. Although this results in smaller acceptance + probabities sampling from the hat distribution is much faster + than for other values of @i{c}. Depending on the expenses of + evaluating the PDF the resulting algorithm is usually faster. + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + However, the values given by unur_itdr_set_xi(), unur_itdr_set_cp(), + or unur_itdr_set_ct() calls are then ignored when unur_reinit() is + called. + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_itdr_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_itdr_set_xi( UNUR_PAR *parameters, double xi ); +/* + Sets points where local concavity and inverse local concavity + are (almost) equal. It is used to estimate the respective c-values + for pole region and hat regions and to determine the splitting point @i{bx} + between pole and tail region. + If no such point is provided it will be computed automatically. + + Default: not set. +*/ + +int unur_itdr_set_cp( UNUR_PAR *parameters, double cp ); +/* + Sets parameter @var{cp} for transformation T for inverse + density in pole region. + It must be at most 0 and greater than -1. + A value of @code{-0.5} is treated separately and usually results in + faster marginal generation time (at the expense of smaller + acceptance probabilities. + If no @var{cp}-value is given it is estimated automatically. + + Default: not set. +*/ + +int unur_itdr_set_ct( UNUR_PAR *parameters, double ct ); +/* + Sets parameter @var{ct} for transformation T for + density in tail region. + It must be at most 0. For densities with unbounded domain + it must be greater than -1. + A value of @code{-0.5} is treated separately and usually results in + faster marginal generation time (at the expense of smaller + acceptance probabilities. + If no @var{ct}-value is given it is estimated automatically. + + Default: not set. +*/ + +double unur_itdr_get_xi( UNUR_GEN *generator ); +/* */ + +double unur_itdr_get_cp( UNUR_GEN *generator ); +/* */ + +double unur_itdr_get_ct( UNUR_GEN *generator ); +/* + Get intersection point @var{xi}, and c-values @var{cp} and @var{ct}, + respectively. + (In case of an error @code{UNUR_INFINITY} is returned.) +*/ + +double unur_itdr_get_area( UNUR_GEN *generator ); +/* + Get area below hat. + (In case of an error @code{UNUR_INFINITY} is returned.) +*/ + +int unur_itdr_set_verify( UNUR_PAR *parameters, int verify ); +/* + Turn verifying of algorithm while sampling on/off. + + If the condition @unurmath{PDF(x) \leq hat(x)} is + violated for some @i{x} then @code{unur_errno} is set to + @code{UNUR_ERR_GEN_CONDITION}. However, notice that this might + happen due to round-off errors for a few values of + @i{x} (less than 1%). + + Default is FALSE. +*/ + +int unur_itdr_chg_verify( UNUR_GEN *generator, int verify ); +/* + Change the verifying of algorithm while sampling on/off. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/itdr_struct.h b/vendor/unuran-1.11.0/src/methods/itdr_struct.h new file mode 100644 index 0000000..62db56d --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/itdr_struct.h @@ -0,0 +1,62 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: itdr_struct.h * + * * + * PURPOSE: * + * declares structures for method ITDR * + * (Inverse Transformed Density Rejection) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_itdr_par { + double xi; /* intersection point lc(x)=ilc(x) */ + double cp, ct; /* c-value for pole and tail region, resp. */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_itdr_gen { + double bx; /* splitting point between pole and tail region */ + double Atot; /* total area below hat */ + double Ap, Ac, At; /* areas in upper pole, center, and tail region */ + double cp, xp; /* c-value and design point for pole region */ + double alphap, betap; /* parameters for hat in pole region */ + double by; /* hat of pole region at bx */ + double sy; /* PDF(bx) = squeeze for central region */ + double ct, xt; /* c-value and design point for tail region */ + double Tfxt, dTfxt; /* parameters for hat in tail region */ + double pole; /* location of pole */ + double bd_right; /* right boundary of shifted domain */ + double sign; /* region: +1 ... (-oo,0], -1 ... [0,oo) */ + double xi; /* intersection point lc(x)=ilc(x) */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/mcorr.c b/vendor/unuran-1.11.0/src/methods/mcorr.c new file mode 100644 index 0000000..75645aa --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/mcorr.c @@ -0,0 +1,950 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: mcorr.c * + * * + * TYPE: random matrix * + * METHOD: Matrix -- COORelation matrix * + * * + * DESCRIPTION: * + * random correlation matrix. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Devroye, L. (1986): Non-Uniform Random Variate Generation, * + * New-York, Sect.6.1, p.605. * + * * + * [2] Marsaglia, G. and I. Olkin (1984): * + * Generating Correlation Matrices. * + * SIAM J. Sci. Stat. Comput 5, 470-475. * + * * + ***************************************************************************** + * * + * Methods MCORR generates random correlation matrices. * + * It implements two algorithms: * + * * + * (1) HH: Generate a random matrix H where all rows are independent and * + * uniformly distributed on the sphere and returns HH'; see ref. [1]. * + * * + * (2) eigen: The algorithm by Marsaglia and Olkin [2] generates a * + * correlation at random with a given set of eigenvalues. * + * * + * MCORR uses Algorithm (2) when the set of eigenvalues is given; and * + * Algorithm (1) otherwise. + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen.h" +#include "x_gen_source.h" +#include "arou.h" +#include "mcorr.h" +#include "mcorr_struct.h" + +/*---------------------------------------------------------------------------*/ +/* Variants */ + +#define MCORR_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define MCORR_SET_EIGENVALUES 0x001u /* set eigenvalues of corr-matrix */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "MCORR" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_mcorr_init( struct unur_par *par ); +static int _unur_mcorr_init_HH( struct unur_gen *gen ); +static int _unur_mcorr_init_eigen( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_mcorr_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_mcorr_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_mcorr_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_mcorr_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ +static int _unur_mcorr_sample_matr_HH( struct unur_gen *gen, double *mat ); +/* Algorithm (1) */ +static int _unur_mcorr_sample_matr_eigen( struct unur_gen *gen, double *mat ); +/* Algorithm (2) */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_mcorr_debug_init( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_mcorr_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.matr /* data for distribution object */ + +#define PAR ((struct unur_mcorr_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_mcorr_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.matr /* data for distribution in generator object */ + +#define SAMPLE gen->sample.matr /* pointer to sampling routine */ + +/*---------------------------------------------------------------------------*/ +#define NORMAL gen->gen_aux /* pointer to normal variate generator */ +/*---------------------------------------------------------------------------*/ + +#define _unur_mcorr_getSAMPLE(gen) \ + ( ((gen)->set & MCORR_SET_EIGENVALUES) \ + ? _unur_mcorr_sample_matr_eigen : _unur_mcorr_sample_matr_HH ) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_mcorr_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if ( !(distr->type == UNUR_DISTR_MATR && + distr->id == UNUR_DISTR_MCORRELATION) ) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_MATR,NULL); + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_mcorr_par) ); + COOKIE_SET(par,CK_MCORR_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + par->method = UNUR_METH_MCORR; /* method */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* number of rows and columns (dimension of distribution). */ + /* do not confuse with distr->dim which is the size of */ + /* the array that stores the matrix. */ + PAR->dim = distr->data.matr.n_rows; + + PAR->eigenvalues = NULL; /* (optional) eigenvalues of correlation matrix */ + + /* routine for starting generator */ + par->init = _unur_mcorr_init; + + return par; + +} /* end of unur_mcorr_new() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_mcorr_set_eigenvalues( UNUR_PAR *par, const double *eigenvalues ) + /*----------------------------------------------------------------------*/ + /* sets the (optional) eigenvalues of the correlation matrix */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, MCORR ); + _unur_check_NULL( GENTYPE, eigenvalues, UNUR_ERR_NULL ); + + /* check for eigenvalues */ + for (i=0; idim; i++) + if (eigenvalues[i] <= 0.) { + _unur_error(GENTYPE, UNUR_ERR_PAR_SET,"eigenvalue <= 0"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->eigenvalues = eigenvalues; + + /* changelog */ + par->set |= MCORR_SET_EIGENVALUES; + + return UNUR_SUCCESS; +} /* unur_mcorr_set_eigenvalues() */ + + +/*---------------------------------------------------------------------------*/ + +int +unur_mcorr_chg_eigenvalues( UNUR_GEN *gen, const double *eigenvalues ) + /*----------------------------------------------------------------------*/ + /* change the (optional) eigenvalues of the correlation matrix */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, MCORR, UNUR_ERR_GEN_INVALID ); + _unur_check_NULL( GENTYPE, eigenvalues, UNUR_ERR_NULL ); + + /* check for eigenvalues */ + for (i=0; idim; i++) + if (eigenvalues[i] <= 0.) { + _unur_error(GENTYPE, UNUR_ERR_PAR_SET,"eigenvalue <= 0"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + if (GEN->eigenvalues == NULL) + GEN->eigenvalues = _unur_xmalloc(GEN->dim * sizeof(double)); + memcpy(GEN->eigenvalues, eigenvalues, GEN->dim * sizeof(double)); + + /* changelog */ + gen->set |= MCORR_SET_EIGENVALUES; + + return UNUR_SUCCESS; +} /* unur_mcorr_chg_eigenvalues() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_mcorr_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + _unur_check_NULL( GENTYPE,par,NULL ); + + /* check input */ + if ( par->method != UNUR_METH_MCORR ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_MCORR_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_mcorr_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* run special initialize routines */ + if (gen->set && MCORR_SET_EIGENVALUES) { + if (_unur_mcorr_init_eigen(gen) != UNUR_SUCCESS) { + _unur_mcorr_free(gen); return NULL; + } + } + else { + if (_unur_mcorr_init_HH(gen) != UNUR_SUCCESS) { + _unur_mcorr_free(gen); return NULL; + } + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_mcorr_debug_init(gen); +#endif + + /* o.k. */ + return gen; + +} /* end of _unur_mcorr_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_mcorr_init_HH( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize generator for Algorithm (1) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* we need a generator for standard normal distributons */ + + if (NORMAL==NULL) { + struct unur_distr *normaldistr = unur_distr_normal(NULL,0); + struct unur_par *normalpar = unur_arou_new( normaldistr ); + + unur_arou_set_usedars( normalpar, TRUE ); + NORMAL = unur_init( normalpar ); + _unur_distr_free( normaldistr ); + if (NORMAL == NULL) { + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,"Cannot create aux Gaussian generator"); + return UNUR_FAILURE; + } + /* need same uniform random number generator and debugging flags */ + NORMAL->urng = gen->urng; + NORMAL->debug = gen->debug; + } + + return UNUR_SUCCESS; + +} /* end of _unur_mcorr_init_HH() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_mcorr_init_eigen( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* initialize generator for Algorithm (2) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + double sum_eigenvalues = 0.; + + /* allocate working array */ + GEN->M = _unur_xrealloc(GEN->M, (5*GEN->dim + 2*GEN->dim*GEN->dim)*sizeof(double)); + + /* we have to normalize the eigenvalues: */ + /* sum(eigenvalues) == dim */ + + /* check for eigenvalues */ + for (i=0; idim; i++) { + if (GEN->eigenvalues[i] <= 0.) { + _unur_error(GENTYPE, UNUR_ERR_SHOULD_NOT_HAPPEN,"eigenvalue <= 0"); + return UNUR_FAILURE; + } + sum_eigenvalues += GEN->eigenvalues[i]; + } + + /* scaling values */ + if (!_unur_FP_equal(sum_eigenvalues, (double) GEN->dim)) + _unur_warning(GENTYPE, UNUR_ERR_GENERIC,"scaling sum(eigenvalues) -> dim"); + for (i=0; idim; i++) + GEN->eigenvalues[i] *= GEN->dim / sum_eigenvalues; + + return UNUR_SUCCESS; + +} /* end of _unur_mcorr_init_eigen() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_mcorr_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* (re)set sampling routine */ + SAMPLE = _unur_mcorr_getSAMPLE(gen); + + /* run special initialize routines */ + if (gen->set && MCORR_SET_EIGENVALUES) + return _unur_mcorr_init_eigen(gen); + else + return _unur_mcorr_init_HH(gen); + +} /* end of _unur_mcorr_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_mcorr_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_MCORR_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_mcorr_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_MCORR_GEN); + + /* number of rows and columns (dimension of distribution). */ + /* do not confuse with distr->dim which is the size of */ + /* the array that stores the matrix. */ + GEN->dim = DISTR.n_rows; + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_mcorr_getSAMPLE(gen); + gen->destroy = _unur_mcorr_free; + gen->clone = _unur_mcorr_clone; + gen->reinit = _unur_mcorr_reinit; + + /* initialize pointers */ + GEN->M = NULL; + GEN->H = NULL; + GEN->eigenvalues = NULL; + + /* copy optional eigenvalues of the correlation matrix */ + if (gen->set && MCORR_SET_EIGENVALUES) { + GEN->eigenvalues = _unur_xmalloc(GEN->dim * sizeof(double)); + memcpy(GEN->eigenvalues, PAR->eigenvalues, GEN->dim * sizeof(double)); + } + + /* allocate working array */ + if (gen->set && MCORR_SET_EIGENVALUES) { + GEN->M = _unur_xmalloc((5*GEN->dim + 2*GEN->dim*GEN->dim) * sizeof(double)); + } + else { + GEN->H = _unur_xmalloc(GEN->dim * GEN->dim * sizeof(double)); + } + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_mcorr_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_mcorr_create() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_mcorr_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_mcorr_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_MCORR_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* allocate new working array */ + if (GEN->M) + CLONE->M = _unur_xmalloc((5*GEN->dim + 2*GEN->dim*GEN->dim) * sizeof(double)); + if (GEN->H) + CLONE->H = _unur_xmalloc(GEN->dim * GEN->dim * sizeof(double)); + + /* copy optional eigenvalues */ + if (GEN->eigenvalues) { + CLONE->eigenvalues = _unur_xmalloc(GEN->dim * sizeof(double)); + memcpy(CLONE->eigenvalues, GEN->eigenvalues, GEN->dim * sizeof(double)); + } + + return clone; + +#undef CLONE +} /* end of _unur_mcorr_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_mcorr_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_MCORR ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_MCORR_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + if (GEN->eigenvalues) free(GEN->eigenvalues); + if (GEN->H) free(GEN->H); + if (GEN->M) free(GEN->M); + + _unur_generic_free(gen); + +} /* end of _unur_mcorr_free() */ + +/*****************************************************************************/ + +int +_unur_mcorr_sample_matr_HH( struct unur_gen *gen, double *mat ) + /*----------------------------------------------------------------------*/ + /* sample from generator - Algorithm (1) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* mat ... random matrix (result) */ + /*----------------------------------------------------------------------*/ +{ +#define idx(a,b) ((a)*(GEN->dim)+(b)) + int i,j,k; + double sum, norm, x; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_MCORR_GEN,UNUR_ERR_COOKIE); + CHECK_NULL(mat,UNUR_ERR_NULL); + + /* generate rows vectors of matrix H uniformly distributed in the unit sphere */ + /** TODO: sum != 0 and all columns must be independent **/ + + for (i=0; idim; i++) { + sum=0.; + for (j=0; jdim; j++) { + x = _unur_sample_cont(NORMAL); + GEN->H[idx(i,j)] = x; + sum += x * x; + } + norm = sqrt(sum); + for (j=0; jdim; j++) GEN->H[idx(i,j)] /= norm; + } + + /* Compute HH' */ + for (i=0; idim; i++) + for (j=0; jdim; j++) { + if (jdim; k++) + sum += GEN->H[idx(i,k)]*GEN->H[idx(j,k)]; + mat[idx(i,j)] = sum; + } + } + + return UNUR_SUCCESS; +#undef idx +} /* end of _unur_mcorr_sample_matr_HH() */ + +/*--------------------------------------------------------------------------*/ + +int +_unur_mcorr_sample_matr_eigen( struct unur_gen *gen, double *mat ) + /*----------------------------------------------------------------------*/ + /* sample from generator - Algorithm (2) */ + /* (eigenvalues given, Marsaglia-Olkin method) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* mat ... random matrix (result) */ + /*----------------------------------------------------------------------*/ +{ +#define idx(a,b) ((a)*dim+(b)) + int i,j,k, dim; + double *E, *P; + double *x, *y, *z, *w, *r; /* misc vectors used in the marsaglia-olkin method */ + double a, b, c, e, e2; + int s; /* random sign +-1 */ + + /* check parameters */ + CHECK_NULL(gen, UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_MCORR_GEN,UNUR_ERR_COOKIE); + CHECK_NULL(mat, UNUR_ERR_NULL); + + dim = GEN->dim; + + if (dim<1) { + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,"dimension < 1"); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + } + + /* initialization steps */ + /* setting working arrays */ + x = GEN->M + (0*dim); + y = GEN->M + (1*dim); + z = GEN->M + (2*dim); + w = GEN->M + (3*dim); + r = GEN->M + (4*dim); + E = GEN->M + (5*dim); + P = GEN->M + (5*dim+dim*dim); + + /* initially E is an identity matrix */ + for (i=0; iurng); + /* x = E*w */ + for (i=0; ieigenvalues[i])*x[i]*x[i]; + + /* check if all eigenvalues are ~1 */ + if (fabs(a)genid, UNUR_ERR_GEN_CONDITION,"all eigenvalues are ~1 -> identity matrix"); + + return UNUR_ERR_GEN_CONDITION; + } + + do { + + /* z is a random vector */ + for (i=0; iurng); + + /* y = E*z */ + for (i=0; ieigenvalues[i])*x[i]*y[i]; + c += (1-GEN->eigenvalues[i])*y[i]*y[i]; + } + + /* e^2 = b^2 - a*c */ + e2 = b*b - a*c; + + } while (e2<0); + + e=sqrt(e2); + + + /* random sign */ + s = ( _unur_call_urng(gen->urng) >.5) ? 1: -1 ; + + /* r=x*(b+s*e)/a - y */ + for (i=0; iurng) >.5) ? 1: -1 ; + + /* pk=s*r/norm(r) */ + _unur_vector_normalize(dim, r); + for (i=0; iurng); + + /* x = E*w */ + for (i=0; ieigenvalues[k] * P[idx(j,k)]; + } + } + } + + /* symmetrization (necessary due to rounding-errors) */ + for (i=0; igenid); + fprintf(LOG,"%s: type = random matrix\n",gen->genid); + fprintf(LOG,"%s: method = MCORR (Matrix - CORRELATION matrix)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_matr_debug( gen->distr, gen->genid ); + + /* eigenvalues */ + if (gen->set && MCORR_SET_EIGENVALUES) + _unur_matrix_print_vector( GEN->dim, GEN->eigenvalues, "eigenvalues =", LOG, gen->genid, "\t "); + + if (gen->set && MCORR_SET_EIGENVALUES) + fprintf(LOG,"%s: sampling routine = _unur_mcorr_sample_matr_eigen()\n",gen->genid); + else + fprintf(LOG,"%s: sampling routine = _unur_mcorr_sample_matr_HH()\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_mcorr_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_mcorr_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," dimension = %d x %d (= %d)\n", + DISTR.n_rows, DISTR.n_cols, gen->distr->dim); + + if (gen->set && MCORR_SET_EIGENVALUES) { + _unur_string_append(info," eigenvalues = "); + _unur_distr_info_vector( gen, GEN->eigenvalues, GEN->dim); + _unur_string_append(info,"\n"); + } + _unur_string_append(info,"\n"); + + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + + /* method */ + _unur_string_append(info,"method: MCORR (Random CORRelation matrix)\n"); + if (gen->set && MCORR_SET_EIGENVALUES) + _unur_string_append(info," generate correlation matrix with given eigenvalues\n"); + _unur_string_append(info,"\n"); + + /* performance */ + /* _unur_string_append(info,"performance characteristics:\n"); */ + /* _unur_string_append(info,"\n"); */ + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters: \n"); + if (gen->set && MCORR_SET_EIGENVALUES) { + _unur_string_append(info," eigenvalues = "); + _unur_distr_info_vector( gen, GEN->eigenvalues, GEN->dim); + _unur_string_append(info,"\n"); + } + _unur_string_append(info,"\n"); + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_mcorr_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/mcorr.h b/vendor/unuran-1.11.0/src/methods/mcorr.h new file mode 100644 index 0000000..cb4a10e --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/mcorr.h @@ -0,0 +1,150 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: mcorr.h * + * * + * PURPOSE: * + * function prototypes for method MCORR * + * (Matrix - CORRelation matrix) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD MCORR Random CORRelation matrix + + =UP Methods_for_MATR + + =REQUIRED Distribution object for random correlation matrix + + =OPTIONAL + + =SPEED Set-up: fast, + Sampling: depends on dimension + + =REINIT supported + + =REF [DLa86: Sect.6.1; p.605] [MOa84] + + =DESCRIPTION + MCORR generates a random correlation matrix + (Pearson's correlation). + Two methods are used: + + @enumerate + @item + When a random correlation matrix having given eigenvalues is + sought, the method of Marsaglia and Olkin [MOa84] is used. + In this case, the correlation matrix @unurmath{R} + is given as @unurmath{R=PDP'} where @unurmath{D} is a diagonal + matrix containing the eigenvalues and @unurmath{P} is a random + orthonormal matrix. In higher dimensions, the rounding-errors + introduced in the previous matrix multiplications could lead + to a non-symmetric correlation matrix. Therefore the symmetric + correlation matrix is computed as @unurmath{R=(PDP'+P'DP)/2}. + + @item + A matrix @unurmath{H} is generated where all rows are + independent random vectors of unit length uniformly on a sphere. + Then @unurmath{HH'} is a correlation matrix (and vice versa if + @unurmath{HH'} is a correlation matrix then the rows of + @unurmath{H} are random vectors on a sphere). + + @end enumerate + + Notice that due to round-off errors the generated matrices might + not be positive definite in extremely rare cases + (especially when the given eigenvalues are amost 0). + + There are many other possibilites (distributions) of sampling + the random rows from a sphere. The chosen methods are simple but + does not result in a uniform distriubution of the random + correlation matrices. + + It only works with distribution objects of random correlation + matrices (@pxref{correlation,,Random Correlation Matrix}). + + =HOWTOUSE + Create a distibution object for random correlation matrices by a + @code{unur_distr_correlation} call + (@pxref{correlation,,Random Correlation Matrix}). + + When a correlation matrix with given eigenvalues should be + generated, these eigenvalues can be set by a + unur_mcorr_set_eigenvalues() call. + + Otherwise, a faster algorithm is used that generates + correlation matrices with random eigenstructure. + + Notice that due to round-off errors, + there is a (small) chance that the resulting matrix is + not positive definite for a Cholesky decomposition algorithm, + especially when the dimension of the distribution is high. + + It is possible to change the given eigenvalues using + unur_mcorr_chg_eigenvalues() and run unur_reinit() to + reinitialize the generator object. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_mcorr_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +int unur_mcorr_set_eigenvalues( UNUR_PAR *par, const double *eigenvalues ); +/* + Sets the (optional) eigenvalues of the correlation matrix. + If set, then the Marsaglia and Olkin algorithm will be used + to generate random correlation matrices with given eigenvalues. + + Important: the given eigenvalues of the correlation matrix must be + strictly positive and sum to the dimension of the matrix. + If non-positive eigenvalues are attempted, no eigenvalues are set + and an error code is returned. + In case, that their sum is different from the dimension, an implicit + scaling to give the correct sum is performed. +*/ + +int unur_mcorr_chg_eigenvalues( UNUR_GEN *gen, const double *eigenvalues ); +/* + Change the eigenvalues of the correlation matrix. + One must run unur_reinit() to reinitialize the generator + object then. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ + + diff --git a/vendor/unuran-1.11.0/src/methods/mcorr_struct.h b/vendor/unuran-1.11.0/src/methods/mcorr_struct.h new file mode 100644 index 0000000..56cff23 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/mcorr_struct.h @@ -0,0 +1,54 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: mcorr_struct.h * + * * + * PURPOSE: * + * declares structures for method MCORR * + * (Matrix -- CORRelation matrix) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_mcorr_par { + int dim; /* dimension (number of rows and columns) of matrix */ + const double *eigenvalues; /* optional eigenvalues of correlation matrix */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_mcorr_gen { + int dim; /* dimension (number of rows and columns) of matrix */ + double *H; /* working array */ + double *M; /* working array */ + double *eigenvalues; /* optional eigenvalues of the correlation matrix */ +}; + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/methods/mixt.c b/vendor/unuran-1.11.0/src/methods/mixt.c new file mode 100644 index 0000000..877e255 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/mixt.c @@ -0,0 +1,904 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: mixt.c * + * * + * TYPE: (continuous) univariate random variate * + * METHOD: mixture of distributions (meta method) * + * * + * DESCRIPTION: * + * Given an array of components and array of probabilities * + * produce a value X consistent with the mixture distribution * + * * + * REQUIRED: * + * pointers to generators of components * + * array of probabilities * + * * + ***************************************************************************** + * * + * Copyright (c) 2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen.h" +#include "x_gen_source.h" +#include "dgt.h" +#include "dgt_struct.h" +#include "mixt.h" +#include "mixt_struct.h" + +/*---------------------------------------------------------------------------*/ +/* Variants: */ + +#define MIXT_VARFLAG_INVERSION 0x004u /* use inversion method (if possible) */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define MIXT_SET_USEINVERSION 0x001u /* use inverion method */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "MIXT" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_mixt_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_mixt_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_mixt_check_par( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_mixt_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_mixt_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_mixt_sample( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static double _unur_mixt_sample_inv( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator by inversion */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_mixt_indexgen( const double *prob, int n_prob ); +/*---------------------------------------------------------------------------*/ +/* create generator for index. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_mixt_get_boundary( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* compute boundary of mixture and check for overlapping domains. */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_mixt_debug_init( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_mixt_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define PAR ((struct unur_mixt_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_mixt_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +#define BD_LEFT domain[0] /* left boundary of domain of distribution */ +#define BD_RIGHT domain[1] /* right boundary of domain of distribution */ + +/* shortcuts for auxiliary generators */ +#define INDEX gen_aux + +#define PROB gen_aux->distr->data.discr.pv +#define COMP gen_aux_list +#define N_COMP n_gen_aux_list + +/*---------------------------------------------------------------------------*/ + +#define _unur_mixt_getSAMPLE(gen) \ + ( ((gen)->variant & MIXT_VARFLAG_INVERSION) \ + ? _unur_mixt_sample_inv : _unur_mixt_sample ) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_mixt_new( int n, const double *prob, struct unur_gen **comp ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* n ... number of components */ + /* prob ... probabilities for components */ + /* comp ... array of pointers to components (generators) */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE, prob, NULL ); + _unur_check_NULL( GENTYPE, comp, NULL ); + if (n<1) { _unur_error(GENTYPE,UNUR_ERR_DISTR_DOMAIN,"n < 1"); return NULL; } + /* checking type of generator objects in 'comp' is delayed to init */ + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_mixt_par) ); + COOKIE_SET(par,CK_MIXT_PAR); + + /* copy input */ + par->distr = NULL; /* pointer to distribution object */ + + /* copy data */ + PAR->n_comp = n; /* number of components */ + PAR->prob = prob; /* probabilities for components */ + PAR->comp = comp; /* array of pointers to components (generators) */ + + /* set default values */ + par->method = UNUR_METH_MIXT; /* method and default variant */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_mixt_init; + + return par; + +} /* end of unur_mixt_new() */ + +/*****************************************************************************/ + +int +unur_mixt_set_useinversion( struct unur_par *par, int useinversion ) + /*----------------------------------------------------------------------*/ + /* set flag for using inversion method (default: off) */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* useinversion ... !0 = try inversion method, 0 = no inversion */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no squeeze is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, MIXT ); + + /* we use a bit in 'variant' */ + par->variant = (useinversion) + ? (par->variant | MIXT_VARFLAG_INVERSION) + : (par->variant & (~MIXT_VARFLAG_INVERSION)); + + /* changelog */ + par->set |= MIXT_SET_USEINVERSION; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_mixt_set_useinversion() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_mixt_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* params pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + int i; + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_MIXT ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_MIXT_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_mixt_create(par); + if (!gen) { _unur_par_free(par); return NULL; } + + /* probabilities */ + gen->INDEX = _unur_mixt_indexgen(PAR->prob,PAR->n_comp); + + /* components */ + gen->N_COMP = PAR->n_comp; /* number of components */ + gen->COMP = _unur_xmalloc( gen->N_COMP * sizeof(struct unur_gen *)); + for (i=0; iN_COMP; i++) + gen->COMP[i] = unur_gen_clone(PAR->comp[i]); + + /* free parameters */ + _unur_par_free(par); + + /* check parameters */ + if (_unur_mixt_check_par(gen) != UNUR_SUCCESS) { + _unur_mixt_free(gen); return NULL; + } + + /* compute boundary of mixture and check for overlapping domains */ + if ( _unur_mixt_get_boundary(gen) != UNUR_SUCCESS ) { + _unur_mixt_free(gen); return NULL; + } + + /* set name of distribution */ + unur_distr_set_name(gen->distr, "(mixture)"); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_mixt_debug_init(gen); +#endif + + return gen; +} /* end of _unur_mixt_init() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_mixt_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_MIXT_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_mixt_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_MIXT_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* object 'par' does not contain a distribution object */ + /* so we create one. */ + gen->distr = unur_distr_cont_new(); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_mixt_getSAMPLE(gen); + gen->destroy = _unur_mixt_free; + gen->clone = _unur_mixt_clone; + gen->reinit = NULL; /* reinit not implemented ! */ + + /* copy some parameters into generator object */ + GEN->is_inversion = (gen->variant & MIXT_VARFLAG_INVERSION) ? TRUE : FALSE; + + /* initialize parameters: none */ + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_mixt_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_mixt_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_mixt_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + int type; + + /* check probabilities */ + if (gen->INDEX == NULL) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"invalid probabilities"); + return UNUR_ERR_GEN_DATA; + } + + /* check generator objects */ + for (i=0; iN_COMP; i++) { + + /* generators must not be NULL */ + if (gen->COMP[i] == NULL) { + _unur_error(gen->genid,UNUR_ERR_NULL,"component is NULL"); + return UNUR_ERR_NULL; + } + + /* all generators must sample from univariate distributions */ + type = gen->COMP[i]->method & UNUR_MASK_TYPE; + if ( type != UNUR_METH_DISCR && + type != UNUR_METH_CONT && + type != UNUR_METH_CEMP ) { + _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,"component not univariate"); + return UNUR_ERR_GEN_INVALID; + } + + /* we only can use inversion method if all generators use inversion method */ + if (GEN->is_inversion && (! unur_gen_is_inversion (gen->COMP[i]))) { + _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,"component does not implement inversion"); + return UNUR_ERR_GEN_INVALID; + } + } + + return UNUR_SUCCESS; +} /* end of _unur_mixt_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_mixt_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_mixt_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_MIXT_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + return clone; + +#undef CLONE +} /* end of _unur_mixt_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_mixt_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_MIXT ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_MIXT_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_mixt_free() */ + +/*****************************************************************************/ + +double +_unur_mixt_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *comp; + int J; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_MIXT_GEN,UNUR_INFINITY); + + /* sample index */ + J = unur_sample_discr(gen->INDEX); + + /* get component */ + comp = gen->COMP[J]; + + /* sample from selected component */ + switch(comp->method & UNUR_MASK_TYPE) { + case UNUR_METH_DISCR: + return ((double) comp->sample.discr(comp)); + case UNUR_METH_CONT: + case UNUR_METH_CEMP: + default: + return (comp->sample.cont(comp)); + } + +} /* end of _unur_mixt_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_mixt_sample_inv( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator by inversion */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U, recycle; + int J; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_MIXT_GEN,UNUR_INFINITY); + + /* sample index */ + U = _unur_call_urng(gen->urng); + J =unur_dgt_eval_invcdf_recycle( gen->INDEX, U, &recycle ); + + /* the resolution of recycle is less than that of U. */ + /* the values 0. and 1. may be result in UNUR_INFINITY. */ + /* thus we make a small perturbation in this case. */ + if (_unur_iszero(recycle)) recycle = DBL_MIN; + if (_unur_isone(recycle)) recycle = 1. - DBL_EPSILON; + + /* sample from component */ + return unur_quantile(gen->COMP[J], recycle); + +} /* end of _unur_mixt_sample_inv() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_mixt_eval_invcdf( const struct unur_gen *gen, double u ) + /*----------------------------------------------------------------------*/ + /* evaluate inverse CDF at u. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* u ... argument for inverse CDF */ + /* */ + /* return: */ + /* double (inverse CDF) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double recycle; + int J; + + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + if ( ! (gen->method == UNUR_METH_MIXT && GEN->is_inversion) ) { + _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); + return UNUR_INFINITY; + } + COOKIE_CHECK(gen,CK_MIXT_GEN,UNUR_INFINITY); + + if ( ! (u>0. && u<1.)) { + if ( ! (u>=0. && u<=1.)) { + _unur_warning(gen->genid,UNUR_ERR_DOMAIN,"U not in [0,1]"); + } + if (u<=0.) return DISTR.domain[0]; + if (u>=1.) return DISTR.domain[1]; + return u; /* = NaN */ + } + + /* get index */ + J =unur_dgt_eval_invcdf_recycle( gen->INDEX, u, &recycle ); + + /* the resolution of recycle is less than that of U. */ + /* the values 0. and 1. may be result in UNUR_INFINITY. */ + /* thus we make a small perturbation in this case. */ + if (_unur_iszero(recycle)) recycle = DBL_MIN; + if (_unur_isone(recycle)) recycle = 1. - DBL_EPSILON; + + /* get from component */ + return unur_quantile(gen->COMP[J], recycle); + +} /* end of unur_mixt_eval_invcdf() */ + + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_mixt_indexgen( const double *prob, int n_prob ) +/*---------------------------------------------------------------------------*/ +/* create generator for index using method DGT. */ +/* */ +/* parameters: */ +/* prob ... probability vector */ +/* n_prob ... length of probability vector */ +/* */ +/* return: */ +/* pointer to generator object */ +/* */ +/* error: */ +/* return NULL */ +/*---------------------------------------------------------------------------*/ +{ + struct unur_distr *distr; + struct unur_par *par; + struct unur_gen *igen; + + /* create generator */ + distr = unur_distr_discr_new(); + unur_distr_discr_set_pv(distr, prob, n_prob); + par = unur_dgt_new(distr); + igen = unur_init(par); + + /* clear working space */ + unur_distr_free(distr); + + return igen; + +} /* end of _unur_mixt_indexgen() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_mixt_get_boundary( struct unur_gen *gen ) +/*---------------------------------------------------------------------------*/ +/* compute boundary of mixture and check for overlapping domains. */ +/* */ +/* parameters: */ +/* gen ... pointer to generator object */ +/* */ +/* return: */ +/* UNUR_SUCCESS ... when everything is o.k. */ +/* UNUR_NULL ... when a component is NULL (which should not happen) */ +/* UNUR_ERR_GEN_INVALID .. if domains of components overlap or not ordered */ +/*---------------------------------------------------------------------------*/ +{ + int i; + int overlap = FALSE; + double comp_left, comp_right; + double bd_left, bd_right; + struct unur_gen *comp; + + /* initialize boundary values for mixture */ + bd_left = UNUR_INFINITY; + bd_right = -UNUR_INFINITY; + + for (i=0; iN_COMP; i++) { + comp = gen->COMP[i]; + + /* comp has already been check. but we want to be on the safe side. */ + CHECK_NULL(comp,UNUR_ERR_NULL); + + /* domain of component [i] */ + switch (comp->method & UNUR_MASK_TYPE) { + case UNUR_METH_CONT: + comp_left = comp->distr->data.cont.BD_LEFT; + comp_right = comp->distr->data.cont.BD_RIGHT; + break; + + case UNUR_METH_DISCR: + comp_left = (double) (comp->distr->data.discr.BD_LEFT); + comp_right = (double) (comp->distr->data.discr.BD_RIGHT); + break; + + default: + /* cannot estimate boundary */ + comp_left = -UNUR_INFINITY; + comp_right = UNUR_INFINITY; + } + + /* check for overlapping domains */ + if ( _unur_FP_less(comp_left,bd_right) ) + overlap = TRUE; + + /* update domain of mixture */ + bd_left = _unur_min(bd_left, comp_left); + bd_right = _unur_max(bd_right, comp_right); + } + + /* overlap or unordered domains? */ + if (GEN->is_inversion && overlap) { + _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,"domains of components overlap or are unsorted"); + return UNUR_ERR_GEN_INVALID; + } + + /* store boundary */ + unur_distr_cont_set_domain(gen->distr, bd_left, bd_right); + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_mixt_get_boundary() */ + + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_mixt_debug_init( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + struct unur_gen *comp; + int i; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_MIXT_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = MIXT (MIXTure of distributions -- meta method)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cont_debug( gen->distr, gen->genid ); + + fprintf(LOG,"%s: sampling routine = _unur_mixt_sample",gen->genid); + if (GEN->is_inversion) fprintf(LOG,"_inv"); + fprintf(LOG,"()\n%s:\n",gen->genid); + + fprintf(LOG,"%s: use inversion = %s",gen->genid, + (GEN->is_inversion) ? "on" : "off"); + _unur_print_if_default(gen,MIXT_SET_USEINVERSION); + fprintf(LOG,"\n%s:\n",gen->genid); + + /* probabilities */ + fprintf(LOG,"%s: probabilities (%d) = \n",gen->genid, gen->N_COMP); + fprintf(LOG,"%s: %g",gen->genid, (gen->PROB)[0]); + for (i=1; iN_COMP; i++) + fprintf(LOG,", %g", (gen->PROB)[i]); + fprintf(LOG,"\n%s:\n",gen->genid); + + /* components */ + fprintf(LOG,"%s: components (%d):\n",gen->genid, gen->N_COMP); + for (i=0; iN_COMP; i++) { + comp = gen->COMP[i]; + fprintf(LOG,"%s: [%d]: %s\n",gen->genid, i, comp->genid); + fprintf(LOG,"%s:\t type = ",gen->genid); + switch (comp->distr->type) { + case UNUR_DISTR_CONT: + case UNUR_DISTR_CEMP: + fprintf(LOG,"continuous\n"); + break; + case UNUR_DISTR_DISCR: + fprintf(LOG,"discrete\n"); + break; + default: + fprintf(LOG,"[unknown]\n"); + } + fprintf(LOG,"%s:\t name = %s\n",gen->genid, comp->distr->name); + } + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_mixt_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_mixt_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_gen *comp; + int i; + double sum; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info," # components = %d\n", gen->N_COMP); + + if (help) { + sum = ((struct unur_dgt_gen*)gen->INDEX->datap)->sum; + _unur_string_append(info," probabilities = (%g", gen->PROB[0] / sum); + for (i=1; iN_COMP; i++) + _unur_string_append(info,", %g", gen->PROB[i] / sum); + _unur_string_append(info,")\n"); + + _unur_string_append(info," components = \n"); + for (i=0; iN_COMP; i++) { + comp = gen->COMP[i]; + _unur_string_append(info,"\t[%d] %s - ",i, comp->genid); + switch (comp->distr->type) { + case UNUR_DISTR_CONT: + case UNUR_DISTR_CEMP: + _unur_string_append(info,"continuous"); + break; + case UNUR_DISTR_DISCR: + _unur_string_append(info,"discrete"); + break; + default: + _unur_string_append(info,"[unknown]"); + } + _unur_string_append(info,": %s\n",comp->distr->name); + } + } + _unur_string_append(info,"\n"); + + /* method */ + _unur_string_append(info,"method: MIXT (MIXTure of distributions -- meta method)\n"); + _unur_string_append(info," select component = method DGT\n"); + _unur_string_append(info," inversion method = %s\n", + (GEN->is_inversion) ? "TRUE" : "FALSE"); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics: depends on components\n"); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + _unur_string_append(info," useinversion = "); + if (gen->variant & MIXT_VARFLAG_INVERSION) + _unur_string_append(info,"on\n"); + else + _unur_string_append(info,"off [default]\n"); + } + +} /* end of _unur_mixt_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/mixt.h b/vendor/unuran-1.11.0/src/methods/mixt.h new file mode 100644 index 0000000..c732efc --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/mixt.h @@ -0,0 +1,169 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: mixt.h * + * * + * PURPOSE: * + * function prototypes for meta method MIXT * + * (MIXTure of distributions) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD MIXT MIXTure of distributions + + =UP Meta_Methods + + =SPEED Set-up: fast, Sampling: depends on components + + =REINIT not implemented + + =DESCRIPTION + MIXT allows to sample from a mixture of univariate + distributions. + + Let @unurmath{f_1,\ldots,f_n} be PDFs of various distributions + called the components and @unurmath{(p_1,\ldots,p_n)} be a + probability vector. Then + @unurmath{f(x) = p_1\cdot f_1(x) + \ldots + p_n\cdot f_n(x)} + is the PDF of the so called mixture of these distributions. + + Method MIXT takes generator objects for the components and + a probability vector and creates a generator object for + this mixture. + + The sampling part works as follows: + + @enumerate + @item + Generate an index @i{J} as the realisation of a discrete + random variate with the given probability vector. + This is done by means of method DGT + (@pxref{DGT,Guide Table method}). + @item + Generate a random variate @i{X} with PDF @unurmath{f_J.} + @end enumerate + + When the (interior of the) domains of the the components are + disjoint then it is possible to sample from the mixture by + inversion, provided that the following conditions are met: + + @itemize @minus + @item + The generator objects must use an inversion method for each + component. + @item + The domains of the PDFs @unurmath{f_i} must not overlap. + @item + The components must be ordered with respect to their domains. + @end itemize + + =HOWTOUSE + Create generator objects for the components of the mixture and + store the corresponding pointers in an array. + Store all probabilities an a double array of the same size. + Create the parameter object for the generator of the mixture + distribution by means of unur_mixt_new(). + + The components of the mixture can be any continuous or discrete + univariate distributions. This also includes generators for + empirical distributions and mixtures of distributions. + In particular, mixtures can also be defined recursively. + + @emph{Remark:} + The components of the mixture can be continuous or discrete + distributions. The resulting mixture, however, is always a + continuous distribution and thus unur_sample_cont() must be used! + + The inversion method can be switched on by means of + unur_mixt_set_useinversion() call. + However, the conditions for this method must then be met. + Otherwise, initialization of the mixture object fails. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_mixt_new( int n, const double *prob, UNUR_GEN **comp ); +/* + Get default parameters for the generator for a mixture of the + distributions given in the array @var{comp} (components) of length + @var{n}. The probabilities are given by @var{prob}. + + The generators in @var{comp} must be objects for (continuous or + discrete) univariate distributions +*/ + +/*...........................................................................*/ + +int unur_mixt_set_useinversion( UNUR_PAR *parameters, int useinv ); +/* + If @var{useinv} is TRUE, then the inversion method is used for + sampling from the mixture distribution. + + However, the following conditions must be satisfied: + + @itemize @minus + @item + The generator objects must use an inversion method for each + component. + @item + The domains of the components must not overlap. + @item + The components must be ordered with respect to their domains. + @end itemize + + If one of these conditions is violated, then initialization of the + mixture object fails. + + Default is FALSE. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ + +/* Yet not documented! */ + +double unur_mixt_eval_invcdf( const UNUR_GEN *generator, double u ); +/* + Evaluate inverse CDF at @var{u}. However, this requires that + @var{generator} implements an inversion method. + If @var{u} is out of the domain [0,1] then @code{unur_errno} is set + to @code{UNUR_ERR_DOMAIN} and the respective bound of + the domain of the distribution are returned (which is + @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of + unbounded domains). +*/ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/mixt_struct.h b/vendor/unuran-1.11.0/src/methods/mixt_struct.h new file mode 100644 index 0000000..a5450fd --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/mixt_struct.h @@ -0,0 +1,54 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: mixt_struct.h * + * * + * PURPOSE: * + * declares structures for meta method MIXT * + * (MIXTure of distributions) * + * * + ***************************************************************************** + * * + * Copyright (c) 2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_mixt_par { + int n_comp; /* number of components */ + const double *prob; /* probabilities (weights) for components */ + struct unur_gen **comp; /* array of pointers to components */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_mixt_gen { + int is_inversion; /* whether inversion is used */ + + /* components are stored in slot 'gen_aux_list' */ + /* probabilities are stored in slot 'gen_aux' as generator with method DGT */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/mvstd.c b/vendor/unuran-1.11.0/src/methods/mvstd.c new file mode 100644 index 0000000..8609316 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/mvstd.c @@ -0,0 +1,577 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: mvstd.c * + * * + * TYPE: multivariate continuous random variate * + * METHOD: generators for standard distribution * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2007 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * MVSTD is a wrapper for special generator for MultiVariate continuous * + * STandarD distributions. It only works for distributions in the UNURAN * + * library of distributions and will refuse to work otherwise. * + * (In detail it rejects a distribution if its id is equal to DISTR_GENERIC, * + * the id inserted my the unur_distr_cvec_new() call.) * + * * + * It calls the initialzation routine provided by the distribution object. * + * This routine has to do all setup steps for the special generator. * + * If no such routine is given, i.e. distr->init==NULL, then * + * unur_mvstd_new() does not work and the NULL pointer is returned instead * + * of the pointer to a parameter object. * + * * + * Notice that using a truncated distribution (this can be constructed by * + * changing the default domain of a distribution by means of an * + * unur_distr_cvec_set_domain_rect() call) is not possible. * + * method is used. Otherwise no parameter object is returned by the * + * unur_cstd_new() call. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "mvstd.h" +#include "mvstd_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Variants: none */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define MVSTD_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "MVSTD" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_mvstd_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_mvstd_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_mvstd_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_mvstd_check_par( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_mvstd_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_mvstd_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* There are sampling routines, since every distribution has its own. */ +/* Sampling routines are defined in ../distributions/ for each distributions.*/ +/* double _unur_mvstd_sample( UNUR_GEN *gen ); does not exist! */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_mvstd_debug_init( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_mvstd_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cvec /* data for distribution object */ + +#define PAR ((struct unur_mvstd_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_mvstd_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cvec /* data for distribution in generator object */ + +#define SAMPLE gen->sample.cvec /* pointer to sampling routine */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_mvstd_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL(GENTYPE,distr,NULL); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CVEC) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CVEC,NULL); + + if (distr->id == UNUR_DISTR_GENERIC) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,"standard distribution"); + return NULL; + } + if (DISTR_IN.init == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"init() for special generators"); + return NULL; + } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_mvstd_par) ); + COOKIE_SET(par,CK_MVSTD_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + par->method = UNUR_METH_MVSTD; /* method */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* indicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for initializing generator */ + par->init = _unur_mvstd_init; + + return par; + +} /* end of unur_mvstd_new() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_mvstd_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); + /* check for required data: initializing routine for special generator */ + if (par->DISTR_IN.init == NULL) { + _unur_error(GENTYPE,UNUR_ERR_NULL,""); + return NULL; + } + + /* check input */ + if ( par->method != UNUR_METH_MVSTD ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; + } + COOKIE_CHECK(par,CK_MVSTD_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_mvstd_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* run special init routine for generator */ + if ( DISTR.init(gen)!=UNUR_SUCCESS ) { + /* init failed --> could not find a sampling routine */ + _unur_error(GENTYPE,UNUR_ERR_GEN_DATA,"variant for special generator"); + _unur_mvstd_free(gen); return NULL; + } + + /* check parameters */ + if (_unur_mvstd_check_par(gen) != UNUR_SUCCESS) { + _unur_mvstd_free(gen); return NULL; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_mvstd_debug_init(gen); +#endif + + /* o.k. */ + return gen; + +} /* end of _unur_mvstd_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_mvstd_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* run special init routine for generator */ + if ( DISTR.init(gen)!=UNUR_SUCCESS ) { + /* init failed --> could not find a sampling routine */ + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"parameters"); + return UNUR_ERR_GEN_DATA; + } + + /* check parameters */ + return _unur_mvstd_check_par(gen); +} /* end of _unur_mvstd_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_mvstd_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_MVSTD_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_mvstd_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_MVSTD_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = NULL; /* will be set in _unur_mvstd_init() */ + gen->destroy = _unur_mvstd_free; + gen->clone = _unur_mvstd_clone; + gen->reinit = _unur_mvstd_reinit; + + /* defaults */ + GEN->sample_routine_name = NULL ; /* name of sampling routine */ + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_mvstd_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_mvstd_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_mvstd_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* we do not allow truncated multinormal distributions */ + if (gen->distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"truncated domain"); + return UNUR_ERR_GEN_CONDITION; + } + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_mvstd_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_mvstd_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_mvstd_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_MVSTD_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + return clone; + +#undef CLONE +} /* end of _unur_mvstd_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_mvstd_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* magic cookies */ + COOKIE_CHECK(gen,CK_MVSTD_GEN,RETURN_VOID); + + /* check input */ + if ( gen->method != UNUR_METH_MVSTD ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; + } + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_mvstd_free() */ + +/*****************************************************************************/ + +/** + double _unur_mvstd_sample( struct unur_gen *gen ) {} + Does not exists !!! + Sampling routines are defined in ../distributions/ for each distributions. +**/ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_mvstd_debug_init( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_MVSTD_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous multivariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = generator for standard distribution\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + /* distribution */ + _unur_distr_cvec_debug( gen->distr, gen->genid ); + + /* sampling routine */ + fprintf(LOG,"%s: sampling routine = ",gen->genid); + if (GEN->sample_routine_name) + fprintf(LOG,"%s()\n",GEN->sample_routine_name); + else + fprintf(LOG,"(Unknown)\n"); + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_mvstd_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_mvstd_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + int dim = gen->distr->dim; + int samplesize = 10000; + double E_urn; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," dimension = %d\n",dim); + _unur_distr_cvec_info_domain(gen); + _unur_string_append(info,"\n\n"); + + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + + /* method */ + _unur_string_append(info,"method: MVSTD (special generator for MultiVariate continuous STandarD distribution)\n"); + /* _unur_string_append(info," variant = %d\n", gen->variant); */ + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + + E_urn = unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize); + _unur_string_append(info," E [#urn] = %.2f x %d = %.2f [approx.]\n", + E_urn / dim, dim, E_urn); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters: none\n"); + /* _unur_string_append(info," variant = %d %s\n", gen->variant, */ + /* (gen->set & MVSTD_SET_VARIANT) ? "" : "[default]"); */ + _unur_string_append(info,"\n"); + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_mvstd_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/mvstd.h b/vendor/unuran-1.11.0/src/methods/mvstd.h new file mode 100644 index 0000000..f43450e --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/mvstd.h @@ -0,0 +1,89 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: mvstd.h * + * * + * PURPOSE: * + * function prototypes for method MVSTD * + * (wrapper for special generators for * + * MultiVariate continuous STandarD distributions) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2007 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD MVSTD MultiVariate continuous STandarD distributions + + =UP Methods_for_CVEC + + =REQUIRED standard distribution from UNU.RAN library + (@pxref{Stddist,,Standard distributions}). + + =SPEED depends on distribution and generator + + =REINIT supported + + =DESCRIPTION + MVSTD is a wrapper for special generators for multivariate + continuous standard distributions. It only works for + distributions in the UNU.RAN library of standard distributions + (@pxref{Stddist,,Standard distributions}). + If a distribution object is provided that is build from scratch, + or if no special generator for the given standard distribution is + provided, the NULL pointer is returned. + + =HOWTOUSE + Create a distribution object for a standard distribution + from the UNU.RAN library (@pxref{Stddist,,Standard distributions}). + + Sampling from truncated distributions (which can be constructed by + changing the default domain of a distribution by means of + unur_distr_cvec_set_domain_rect() call) is not possible. + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_mvstd_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for new generator. It requires a distribution object + for a multivariate continuous distribution from the + UNU.RAN library of standard distributions + (@pxref{Stddist,,Standard distributions}). + Using a truncated distribution is not possible. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/mvstd_struct.h b/vendor/unuran-1.11.0/src/methods/mvstd_struct.h new file mode 100644 index 0000000..5fd6d1d --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/mvstd_struct.h @@ -0,0 +1,54 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: mvstd_struct.h * + * * + * PURPOSE: * + * declares structures for method MVSTD * + * (wrapper for special generators for * + * MultiVariate continuous STandarD distributions) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2007 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_mvstd_par { + int dummy; /* no special parameters */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_mvstd_gen { + const char *sample_routine_name; /* name of sampling routine */ + /* Currently, there is no need to store constants and parameter for */ + /* special generators. So it is not implemented yet. */ + /* (When added, do not forget to initialize, copy and free corresponding */ + /* pointers!) */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/mvtdr.c b/vendor/unuran-1.11.0/src/methods/mvtdr.c new file mode 100644 index 0000000..535a9fd --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/mvtdr.c @@ -0,0 +1,334 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: mvtdr.c * + * * + * TYPE: continuous multivariate random variate * + * METHOD: multivariate transformed density rejection * + * * + * DESCRIPTION: * + * Given (logarithm of the) PDF of a log-concave distribution; * + * produce a value x consistent with its density. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2007 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Leydold, J. (1998): A Rejection Technique for Sampling from * + * Log-Concave Multivariate Distributions, * + * ACM TOMACS 8(3), pp. 254-280. * + * * + * [2] Hoermann, W., J. Leydold, and G. Derflinger (2004): * + * Automatic Nonuniform Random Variate Generation, Springer, Berlin. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen.h" +#include "x_gen_source.h" +#include "tdr.h" +#include "mvtdr.h" +#include "mvtdr_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Constants */ + +/* relative size of guide table compared to number of cones */ +#define GUIDE_TABLE_SIZE 1 + +/* find proper touching point using Brent's algorithm: */ +/* acceptable tolerance for Brent's algorithm */ +#define FIND_TP_TOL 0.001 + +/* fine tuning of generator: */ +/* a number is considered to be zero if abs is below */ +/* TOLERANCE * PDF(center) / dim */ +#define TOLERANCE (1.e-8) + +/* gamma variate generator (using method TDR) */ +#define MVTDR_TDR_SQH_RATIO (0.95) + +/*---------------------------------------------------------------------------*/ +/* Variants */ + +#define MVTDR_VARFLAG_VERIFY 0x01u /* flag for verifying hat */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define MVTDR_DEBUG_VERTEX 0x00000010u /* print list of vertices */ +#define MVTDR_DEBUG_CONE 0x00000020u /* print list of conesces */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define MVTDR_SET_STEPSMIN 0x001u /* min number of triangulation steps */ +#define MVTDR_SET_MAXCONES 0x002u /* max number of cones */ +#define MVTDR_SET_BOUNDSPLITTING 0x004u /* bound for splitting cones */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "MVTDR" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_mvtdr_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_mvtdr_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_mvtdr_sample_cvec( struct unur_gen *gen, double *vec ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static void _unur_mvtdr_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_mvtdr_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_mvtdr_simplex_sample( const struct unur_gen *gen, double *U ); +/*---------------------------------------------------------------------------*/ +/* sample point uniformly on standard simplex. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_mvtdr_gammagen( struct unur_gen *gen, double alpha ); +/*---------------------------------------------------------------------------*/ +/* create a gamma random variate generator with shape parameter alpha. */ +/*---------------------------------------------------------------------------*/ + + +/*****************************************************************************/ +/* Hat. */ +/*****************************************************************************/ + +static int _unur_mvtdr_create_hat( struct unur_gen *gen ); +/* compute cones and hat function */ + + +/*****************************************************************************/ +/* CONES. */ +/*****************************************************************************/ + +static int _unur_mvtdr_initial_cones( struct unur_gen *gen ); +/* get initial cones */ + +static CONE *_unur_mvtdr_cone_new( struct unur_gen *gen ); +/* get new (empty) vertex object */ + +static int _unur_mvtdr_cone_center( struct unur_gen *gen, CONE *c ); +/* computer center of cone */ + +static int _unur_mvtdr_cone_params( struct unur_gen *gen, CONE *c ); +/* compute parameters for hat for a cone (expect touching point and volume below hat) */ + +static double _unur_mvtdr_cone_logH( struct unur_gen *gen, CONE *c ); +/* calculate log of volume below hat for given touching point */ + +static int _unur_mvtdr_cone_split( struct unur_gen *gen, CONE *c, int step ); +/* split a cone */ + +static int _unur_mvtdr_triangulate( struct unur_gen *gen, int step, int all); +/* make one triangulation step */ + +static int _unur_mvtdr_cone_height( struct unur_gen *gen, CONE *c ); +/* calculate height of pyramid (cone) */ + +static int _unur_mvtdr_max_gamma( struct unur_gen *gen ); +/* compute upper bound for gamma variates */ + +/*****************************************************************************/ +/* optimal distance for touching points */ +/*****************************************************************************/ + +static double _unur_mvtdr_tp_min_aux(double t, void *p); +/* auxiliary function to be used with _unur_util_brent(). */ + +static double _unur_mvtdr_tp_min( double t, void *p ); +/* wrapper for _unur_mvtdr_cone_hatvolume(); + sets cone->tp; + funtion that must be minimized for optimal touching point */ + +static int _unur_mvtdr_tp_find( struct unur_gen *gen, CONE *c ); +/* find optimal touching point for cone */ + +static int _unur_mvtdr_tp_search( struct unur_gen *gen, TP_ARG *a ); +/* search for proper touching point */ + +static int _unur_mvtdr_tp_bracket( struct unur_gen *gen, TP_ARG *a ); +/* search for proper bracket of minimum of tp_f2min() */ + +/*****************************************************************************/ +/* VERTICES. */ +/*****************************************************************************/ + +static int _unur_mvtdr_initial_vertices( struct unur_gen *gen ); +/* get vertices of initial cones */ + +static VERTEX *_unur_mvtdr_vertex_new( struct unur_gen *gen ); +/* get new (empty) vertex object */ + +static int _unur_mvtdr_number_vertices( struct unur_gen *gen, int level ); +/* number of vertices in given triangulation level */ + +static VERTEX *_unur_mvtdr_vertex_on_edge( struct unur_gen *gen, VERTEX **vl ); +/* compute new vertex on edge */ + + +/*****************************************************************************/ +/* hash table for storing EDGES. */ +/*****************************************************************************/ + +static int _unur_mvtdr_etable_new( struct unur_gen *gen, int size ); +/* make new hash table */ + +static void _unur_mvtdr_etable_free( struct unur_gen *gen ); +/* free hash table */ + +static VERTEX *_unur_mvtdr_etable_find_or_insert( struct unur_gen *gen, VERTEX **vidx ); +/* find or insert entry in hash table, return pointer to vertex */ + +/*****************************************************************************/ + +static int _unur_mvtdr_make_guide_table( struct unur_gen *gen ); +/* create guide table */ + + +/*****************************************************************************/ +/* Debug. */ +/*****************************************************************************/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_mvtdr_debug_init_start( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after (almost empty generator) object has been created. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_mvtdr_debug_init_finished( const struct unur_gen *gen, int successful ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_mvtdr_debug_vertices( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print list of vertices. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_mvtdr_debug_cones( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print list of cones. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_mvtdr_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cvec /* data for distribution object */ + +#define PAR ((struct unur_mvtdr_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_mvtdr_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cvec /* data for distribution in generator object */ + +#define SAMPLE gen->sample.cvec /* pointer to sampling routine */ + +#define PDF(x) _unur_cvec_PDF((x),(gen->distr)) /* call to PDF */ +#define logPDF(x) _unur_cvec_logPDF((x),(gen->distr)) /* call to logPDF */ +#define dPDF(r,x) _unur_cvec_dPDF((r),(x),(gen->distr)) /* call to dPDF */ +#define dlogPDF(r,x) _unur_cvec_dlogPDF((r),(x),(gen->distr)) /* call to dlogPDF */ + +/* an auxiliary generator for gamma variates */ +#define GEN_GAMMA gen->gen_aux + +/*---------------------------------------------------------------------------*/ +/* Transformation */ + +/* this version supports T(x) = log(x) only */ +#define T(x) (log(x)) /* transformation function */ +#define T_deriv(x) (1./(x)) /* first derivative of transform funtion */ +#define T_inv(x) (exp(x)) /* inverse of transform function */ + +/*---------------------------------------------------------------------------*/ +/* return codes for _unur_mvtdr_tp_bracket() */ + +#define TP_LEFT 1 /* minimum in left point */ +#define TP_MIDDLE 2 /* minimum in middle point */ +#define TP_RIGHT 3 /* minimum in right point */ +#define TP_BRACKET 4 /* bracket found */ + +/*---------------------------------------------------------------------------*/ +/* since there is only file scope or program code, we abuse the */ +/* #include directive. */ + +/** Public: User Interface (API) **/ +#include "mvtdr_newset.ch" + +/** Private **/ +#include "mvtdr_init.ch" +#include "mvtdr_sample.ch" +#include "mvtdr_debug.ch" +#include "mvtdr_info.ch" + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/mvtdr.h b/vendor/unuran-1.11.0/src/methods/mvtdr.h new file mode 100644 index 0000000..e67becf --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/mvtdr.h @@ -0,0 +1,209 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: mvtdr.h * + * * + * PURPOSE: * + * function prototypes for method MVTDR * + * (Multi-Variate Transformed Density Rejection) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD MVTDR Multi-Variate Transformed Density Rejection + + =UP Methods_for_CVEC + + =REQUIRED log-concave (log)PDF, gradient of (log)PDF + + =OPTIONAL mode + + =SPEED Set-up: slow, + Sampling: depends on dimension + + =REINIT not implemented + + =REF [HLD04: Sect.11.3.4, Alg.11.15.] [LJa98] + + =DESCRIPTION + MVTDR a multivariate version of the Transformed Density Rection + (@pxref{TDR}) that works for log-concave densities. + For this method the domain of the distribution is partitioned + into cones with the mode (or the center) of the distribution as + their (common) vertex. The hat function is then constructed as + tangent planes of the transformed density in each of these + cones. The respective construction points lie on the central + lines in the cones through the vertex. The point is chosen such + that the hat is minimal among all such points (see the given + references for more details). + + The cones are created by starting with the orthants of the reals + space. These are then iteratively split when the volume below + the hat in such cones is too large. Thus an increasing number of + cones results in a better fitting hat function. + Notice however, that the required number of cones increases + exponentially with the number of dimension. + Moreover, due to the construction the rejection does not + converge to 1 and remains strictly larger than 1. + + For distributions with bounded domains the cones are cut to + pyramids that cover the domain. + + =HOWTOUSE + Create a multivariate generator object that contains the PDF and + its gradient. This object also should contain the mode of the + distribution (or a point nearby should be provided as center of + the distribution). + + The method has three parameter to adjust the method for the given + distribution: + + @table @code + @item stepsmin + Minimal number of iterations for splitting cones. + Notice that we start with 2^dim initial cones and that we arrive + at 2^(dim+stepsmin) cones after these splits. So this number + must be set with care. It can be set by a + unur_mvtdr_set_stepsmin() call. + + @item boundsplitting + Cones where the volume below the hat is relatively large + (i.e. larger than the average volume over all cones times + @code{boundsplitting} are further split. + This parameter can set via a unur_mvtdr_set_boundsplitting() call. + + @item maxcones + The maximum number of generated cones. When this number is + reached, the initialization routine is stopped. Notice that the + rejection constant can be still prohibitive large. + This parameter can set via a unur_mvtdr_set_maxcones() call. + + @end table + + Setting of these parameter can be quite tricky. The default + settings lead to hat functions where the volume below the hat is + similar in each cone. However, there might be some problems with + distributions with higher correlations, since then too few cones + are created. Then it might be necessary to increase the values + for @code{stepsmin} and @code{maxcones} and to set + @code{boundsplitting} to @code{0}. + + The number of cones and the total volume below the hat can be + controlled using the respective calls unur_mvtdr_get_ncones() and + unur_mvtdr_get_hatvol(). Notice, that the rejection constant is + bounded from below by some figure (larger than 1) that depends + on the dimension. + + Unfortunately, the algorithm cannot detect the quality of the + constructed hat. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_mvtdr_new( const UNUR_DISTR *distribution ); +/* + Get parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_mvtdr_set_stepsmin( UNUR_PAR *parameters, int stepsmin ); +/* + Set minimum number of triangulation step for each starting cone. + @var{stepsmin} must be nonnegative. + + Default: @code{5}. +*/ + +int unur_mvtdr_set_boundsplitting( UNUR_PAR *parameters, double boundsplitting ); +/* + Set bound for splitting cones. All cones are split which have a + volume below the hat that is greater than @var{bound_splitting} times + the average over all volumes. However, the number given by the + unur_mvtdr_set_maxcones() is not exceeded. + Notice that the later number is always reached + if @var{bound_splitting} is less than 1. + + Default: @code{1.5} +*/ + +int unur_mvtdr_set_maxcones( UNUR_PAR *parameters, int maxcones ); +/* + Set maximum number of cones. + + Notice that this number is always increased to + @unurmath{2^{dim+stepsmin}} where @i{dim} is the dimension of the + distribution object and @i{stepsmin} the given mimimum number of + triangulation steps. + + Notice: For higher dimensions and/or higher correlations between the + coordinates of the random vector the required number of cones can + be very high. A too small maximum number of cones can lead to + a very high rejection constant. + + Default: @code{10000}. +*/ + +int unur_mvtdr_get_ncones( const UNUR_GEN *generator ); +/* + Get the number of cones used for the hat function of the + @var{generator}. + (In case of an error @code{0} is returned.) +*/ + +double unur_mvtdr_get_hatvol( const UNUR_GEN *generator ); +/* + Get the volume below the hat for the @var{generator}. + (In case of an error @code{UNUR_INFINITY} is returned.) +*/ + +int unur_mvtdr_set_verify( UNUR_PAR *parameters, int verify ); +/* */ + +int unur_mvtdr_chg_verify( UNUR_GEN *generator, int verify ); +/* + Turn verifying of algorithm while sampling on/off. + If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is + violated for some @i{x} then @code{unur_errno} is set to + @code{UNUR_ERR_GEN_CONDITION}. However notice that this might + happen due to round-off errors for a few values of + @i{x} (less than 1%). + + Default is FALSE. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ + + diff --git a/vendor/unuran-1.11.0/src/methods/mvtdr_debug.ch b/vendor/unuran-1.11.0/src/methods/mvtdr_debug.ch new file mode 100644 index 0000000..cbe3c2c --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/mvtdr_debug.ch @@ -0,0 +1,215 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: mvtdr_debug.c * + * * + * TYPE: continuous multivariate random variate * + * METHOD: multivariate transformed density rejection * + * * + * DESCRIPTION: * + * Given (logarithm of the) PDF of a log-concave distribution; * + * produce a value x consistent with its density. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_mvtdr_debug_init_start( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_MVTDR_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous multivariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = MVTDR (Multi-Variate Transformed Density Rejection)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cvec_debug( gen->distr, gen->genid ); + + fprintf(LOG,"%s: sampling routine = _unur_mvtdr_sample_cvec()\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: PDF(center) = %g\n",gen->genid, GEN->pdfcenter); + fprintf(LOG,"%s: bound for splitting cones = %g * mean volume\n",gen->genid,GEN->bound_splitting); + fprintf(LOG,"%s: maximum number of cones = %d\n",gen->genid,GEN->max_cones); + + fprintf(LOG,"%s:\n",gen->genid); + fflush(LOG); + +} /* end of _unur_mvtdr_debug_init_start() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_mvtdr_debug_init_finished( const struct unur_gen *gen, int successful ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* successful ... whether creation of was succesfull */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_MVTDR_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + if (!successful) { + fprintf(LOG,"%s: initialization of GENERATOR failed **********************\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + } + + /* gamma variates */ + fprintf(LOG,"%s: upper bound for gamma variates = %g\n",gen->genid,GEN->max_gamma); + + /* triangulation steps */ + fprintf(LOG,"%s: minimum triangulation level = %d\n",gen->genid,GEN->steps_min); + fprintf(LOG,"%s: maximum triangulation level = %d\n",gen->genid,GEN->n_steps); + + /* number of vertices and cones */ + fprintf(LOG,"%s: number of cones = %d\n",gen->genid,GEN->n_cone); + fprintf(LOG,"%s: number of vertices = %d\n",gen->genid,GEN->n_vertex); + + /* volume below hat */ + fprintf(LOG,"%s: volume below hat = %g",gen->genid,GEN->Htot); + if (gen->distr->set & UNUR_DISTR_SET_PDFVOLUME) + fprintf(LOG,"\t[ hat/pdf ratio = %g ]",GEN->Htot/DISTR.volume); + fprintf(LOG,"\n"); + + if (gen->debug & MVTDR_DEBUG_VERTEX) + _unur_mvtdr_debug_vertices(gen); + + if (gen->debug & MVTDR_DEBUG_CONE) + _unur_mvtdr_debug_cones(gen); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); + fflush(LOG); + +} /* end of _unur_mvtdr_debug_init_finished() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_mvtdr_debug_vertices( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* print list of vertices */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + VERTEX *vt; + int i; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_MVTDR_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: List of vertices: %d\n",gen->genid,GEN->n_vertex); + + for (vt = GEN->vertex; vt != NULL; vt = vt->next) { + fprintf(LOG,"%s: [%4d] = ( %g",gen->genid,vt->index,vt->coord[0]); + for (i=1; idim; i++) + fprintf(LOG,", %g",vt->coord[i]); + fprintf(LOG," )\n"); + } + + fprintf(LOG,"%s:\n",gen->genid); + fflush(LOG); + +} /* end of _unur_mvtdr_debug_vertices() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_mvtdr_debug_cones( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* print list of cones. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + CONE *c; + int i,n; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_MVTDR_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: List of cones: %d\n",gen->genid,GEN->n_cone); + + for (c = GEN->cone,n=0; c != NULL; c = c->next, n++) { + fprintf(LOG,"%s: [%4d|%2d] = { %d", gen->genid, n, c->level, (c->v[0])->index); + for (i=1; idim; i++) + fprintf(LOG,", %d",(c->v[i])->index); + fprintf(LOG," }\n"); + fprintf(LOG,"%s:\tgv = ( %g", gen->genid, c->gv[0]); + for (i=1; idim; i++) + fprintf(LOG,", %g", c->gv[i]); + fprintf(LOG," )\n"); + fprintf(LOG,"%s:\tHi = %g\t[ %g%% ]\n", gen->genid, c->Hi, 100.*c->Hi/GEN->Htot); + fprintf(LOG,"%s:\ttp = %g\n", gen->genid, c->tp); + fprintf(LOG,"%s:\tf(tp) = %g\n", gen->genid, exp(c->Tfp)); + fprintf(LOG,"%s:\theight = %g\n", gen->genid, c->height); + } + + fprintf(LOG,"%s:\n",gen->genid); + fflush(LOG); + +} /* end of _unur_mvtdr_debug_cones() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/mvtdr_info.ch b/vendor/unuran-1.11.0/src/methods/mvtdr_info.ch new file mode 100644 index 0000000..e896350 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/mvtdr_info.ch @@ -0,0 +1,161 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: mvtdr_info.c * + * * + * TYPE: continuous multivariate random variate * + * METHOD: multivariate transformed density rejection * + * * + * DESCRIPTION: * + * Given (logarithm of the) PDF of a log-concave distribution; * + * produce a value x consistent with its density. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +/*****************************************************************************/ +/** Info string **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_mvtdr_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + int samplesize = 10000; + double rc; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," dimension = %d\n",GEN->dim); + _unur_string_append(info," functions = PDF dPDF\n"); + _unur_distr_cvec_info_domain(gen); + + if ( distr->set & UNUR_DISTR_SET_MODE ) { + _unur_string_append(info," mode = "); + _unur_distr_info_vector( gen, DISTR.mode, GEN->dim); + } + _unur_string_append(info,"\n"); + + _unur_string_append(info," center = "); + _unur_distr_info_vector( gen, GEN->center, GEN->dim); + if ( !(distr->set & UNUR_DISTR_SET_CENTER) ) { + if ( distr->set & UNUR_DISTR_SET_MODE ) + _unur_string_append(info," [= mode]"); + else + _unur_string_append(info," [default]"); + } + _unur_string_append(info,"\n\n"); + + if (help) { + if ( !(distr->set & UNUR_DISTR_SET_MODE) ) + _unur_string_append(info,"[ Hint: %s ]\n", + "You can set the mode to improve the rejection constant."); + _unur_string_append(info,"\n"); + } + + /* method */ + _unur_string_append(info,"method: MVTDR (Multi-Variate Transformed Density Rejection)\n"); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," volume(hat) = %g\n", GEN->Htot); + + _unur_string_append(info," rejection constant "); + if (distr->set & UNUR_DISTR_SET_PDFVOLUME) { + _unur_string_append(info,"= %g\n", GEN->Htot / DISTR.volume); + } + else { + rc = unur_test_count_urn(gen,samplesize,0,NULL)/((1.+GEN->dim)*samplesize); + _unur_string_append(info,"= %.2f [approx.]\n", rc); + } + + _unur_string_append(info," # cones = %d\n", GEN->n_cone); + _unur_string_append(info," # vertices = %d\n", GEN->n_vertex); + if (GEN->steps_min == GEN->n_steps) + _unur_string_append(info," triangulation levels = %d\n", GEN->n_steps); + else + _unur_string_append(info," triangulation levels = %d-%d\n", GEN->steps_min, GEN->n_steps); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + + _unur_string_append(info," stepsmin = %d %s\n", GEN->steps_min, + (gen->set & MVTDR_SET_STEPSMIN) ? "" : "[default]"); + + _unur_string_append(info," maxcones = %d %s\n", GEN->max_cones, + (gen->set & MVTDR_SET_MAXCONES) ? "" : "[default]"); + + _unur_string_append(info," boundsplitting = %g %s\n", GEN->bound_splitting, + (gen->set & MVTDR_SET_BOUNDSPLITTING) ? "" : "[default]"); + + if (gen->variant & MVTDR_VARFLAG_VERIFY) + _unur_string_append(info," verify = on\n"); + + _unur_string_append(info,"\n"); + } + + /* Hints */ + if (help) { + if ( !(gen->set & MVTDR_SET_STEPSMIN) ) + _unur_string_append(info,"[ Hint: %s ]\n", + "You can increase \"stepsmin\" to improve the rejection constant." ); + if (GEN->max_cones <= GEN->n_cone) + _unur_string_append(info,"[ Hint: %s ]\n", + "You can increase \"maxcones\" to improve the rejection constant." ); + if ( !(gen->set & MVTDR_SET_BOUNDSPLITTING) ) + _unur_string_append(info,"[ Hint: %s ]\n", + "You can change \"boundsplitting\" to change the creating of the hat function." ); + _unur_string_append(info,"\n"); + } + +} /* end of _unur_mvtdr_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/mvtdr_init.ch b/vendor/unuran-1.11.0/src/methods/mvtdr_init.ch new file mode 100644 index 0000000..7dfa192 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/mvtdr_init.ch @@ -0,0 +1,1928 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: mvtdr_init.c * + * * + * TYPE: continuous multivariate random variate * + * METHOD: multivariate transformed density rejection * + * * + * DESCRIPTION: * + * Given (logarithm of the) PDF of a log-concave distribution; * + * produce a value x consistent with its density. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2007 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +/*****************************************************************************/ +/** Initialzation: Create Hat **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_mvtdr_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + _unur_check_NULL( GENTYPE,par,NULL ); + + /* check input */ + if ( par->method != UNUR_METH_MVTDR ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_MVTDR_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_mvtdr_create(par); + + /* free parameters */ + _unur_par_free(par); + + /* check generator object */ + if (!gen) return NULL; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_mvtdr_debug_init_start(gen); +#endif + + /* check data */ + if (!(GEN->pdfcenter > 0.)) { + _unur_error(gen->genid,UNUR_ERR_DISTR_DOMAIN,"center out of support of PDF"); + _unur_mvtdr_free(gen); return NULL; + } + + /* make hat function */ + if(_unur_mvtdr_create_hat(gen) != UNUR_SUCCESS) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot create hat"); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_mvtdr_debug_init_finished(gen, FALSE); +#endif + _unur_mvtdr_free(gen); return NULL; + } + + /* compute upper bound for gamma variates */ + _unur_mvtdr_max_gamma(gen); + + /* we need an auxiliary generator for gamma random variates */ + GEN_GAMMA = _unur_mvtdr_gammagen( gen, (double)(GEN->dim) ); + if ( GEN_GAMMA == NULL ) { + _unur_mvtdr_free(gen); return NULL; } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_mvtdr_debug_init_finished(gen, TRUE); +#endif + + /* o.k. */ + return gen; + +} /* end of _unur_mvtdr_init() */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen * +_unur_mvtdr_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_MVTDR_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_mvtdr_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_MVTDR_GEN); + + /* dimension of distribution */ + GEN->dim = gen->distr->dim; + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_mvtdr_sample_cvec; + gen->destroy = _unur_mvtdr_free; + gen->clone = _unur_mvtdr_clone; + + /* initialize counter and check given parameters */ + GEN->n_steps = 0; /* no triangulation steps yet */ + GEN->steps_min = _unur_max( 0, PAR->steps_min ); /* minimum number of triangulation steps */ + /* check maximal number of cones */ + if ( (1 << (GEN->dim + GEN->steps_min)) > PAR->max_cones) { + /* WARNING( "number of cones raised to 2^(dim + T_STEPS_MIN)" ); */ + PAR->max_cones = 1 << (GEN->dim + GEN->steps_min); + } + GEN->max_gamma = UNUR_INFINITY; /* upper bound for gamma variaties */ + + /* initialize pointers to lists */ + GEN->cone = NULL; + GEN->last_cone = NULL; + GEN->n_cone = 0; /* number cones */ + GEN->max_cones = PAR->max_cones; /* maximum number of cones */ + GEN->bound_splitting = PAR->bound_splitting; /* bound for splitting cones */ + + GEN->vertex = NULL; + GEN->last_vertex = NULL; + GEN->n_vertex = 0; /* maximum number of vertices */ + + GEN->etable = NULL; /* pointer to edge table */ + GEN->etable_size = 0; /* size of edge table */ + + GEN->guide = NULL; + GEN->guide_size = 0; + + /* initialize working arrays: */ + /* point on simples */ + GEN->S = malloc( GEN->dim * sizeof(double) ); + /* vector g (direction of sweeping plane) */ + GEN->g = malloc( GEN->dim * sizeof(double) ); + /* coordinates of touching point of hat */ + GEN->tp_coord = malloc( GEN->dim * sizeof(double) ); + /* coordinates of touching point of hat moved into center */ + GEN->tp_mcoord = malloc( GEN->dim * sizeof(double) ); + /* gradient of transformed density at tp */ + GEN->tp_Tgrad = malloc( GEN->dim * sizeof(double) ); + + if (GEN->S==NULL || GEN->g==NULL || GEN->tp_coord==NULL || + GEN->tp_mcoord==NULL || GEN->tp_Tgrad==NULL) { + _unur_error(gen->genid,UNUR_ERR_MALLOC,""); + _unur_mvtdr_free(gen); return NULL; + } + + /* get center of the distribution and its PDF */ + GEN->center = unur_distr_cvec_get_center(gen->distr); + GEN->pdfcenter = PDF(GEN->center); + + /* whether we have set a domain for the distribution */ + GEN->has_domain = (gen->distr->set & UNUR_DISTR_SET_DOMAIN) ? TRUE : FALSE; + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_mvtdr_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_mvtdr_create() */ + +/*****************************************************************************/ + +struct unur_gen * +_unur_mvtdr_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_mvtdr_gen*)clone->datap) + + struct unur_gen *clone; + int error = FALSE; + size_t size; + VERTEX *vt, **vtindex; + CONE *c; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_MVTDR_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* copy data */ + CLONE->center = unur_distr_cvec_get_center(clone->distr); + + /* working arrays */ + size = GEN->dim * sizeof(double); + CLONE->S = malloc(size); + CLONE->g = malloc(size); + CLONE->tp_coord = malloc(size); + CLONE->tp_mcoord = malloc(size); + CLONE->tp_Tgrad = malloc(size); + vtindex = malloc(GEN->n_vertex * sizeof (VERTEX *)); + + if (CLONE->S==NULL || CLONE->g==NULL || CLONE->tp_coord==NULL || + CLONE->tp_mcoord==NULL || CLONE->tp_Tgrad==NULL || vtindex==NULL) { + _unur_error(gen->genid,UNUR_ERR_MALLOC,""); + if (vtindex) free (vtindex); + _unur_mvtdr_free(clone); return NULL; + } + + /* copy data */ + if (GEN->S) memcpy( CLONE->S, GEN->S, size ); + if (GEN->g) memcpy( CLONE->g, GEN->g, size ); + if (GEN->tp_coord) memcpy( CLONE->tp_coord, GEN->tp_coord, size ); + if (GEN->tp_mcoord) memcpy( CLONE->tp_mcoord, GEN->tp_mcoord, size ); + if (GEN->tp_Tgrad) memcpy( CLONE->tp_Tgrad, GEN->tp_Tgrad, size ); + + /* clear lists in clone */ + CLONE->vertex = NULL; CLONE->n_vertex = 0; + CLONE->cone = NULL; CLONE->n_cone = 0; + CLONE->guide = NULL; + + /* copy list of vertices */ + for (vt = GEN->vertex; vt != NULL; vt = vt->next) { + VERTEX *vtc = _unur_mvtdr_vertex_new( clone ); + if (vtc == NULL) { + error = TRUE; break; } + memcpy(vtc->coord, vt->coord, size); + vtc->index = vt->index; + vtindex[vt->index] = vtc; + } + + /* copy list of cones */ + for (c = GEN->cone; c != NULL && !error; c = c->next) { + CONE *cc, *cc_next; + VERTEX **v; + double *center, *gv; + int i; + cc = _unur_mvtdr_cone_new( clone ); + if (cc == NULL) { + error = TRUE; break; } + cc_next = cc->next; + center = cc->center; + gv = cc->gv; + v = cc->v; + memcpy(cc,c,sizeof(CONE)); + memcpy(center, c->center, size); + memcpy(gv, c->gv, size); + for (i=0; idim; i++) + v[i] = vtindex[(c->v[i])->index]; + cc->next = cc_next; + cc->center = center; + cc->gv = gv; + cc->v = v; + } + + /* make new guide table */ + if (_unur_mvtdr_make_guide_table(clone) != UNUR_SUCCESS) + error = TRUE; + + /* clear auxiliary array */ + free (vtindex); + + if (error == TRUE) { + _unur_mvtdr_free(clone); return NULL; + } + + return clone; + +#undef CLONE +} /* end of _unur_mvtdr_clone() */ + +/*****************************************************************************/ + +void +_unur_mvtdr_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + VERTEX *vt, *vt_next; + CONE *c, *c_next; + + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_MVTDR ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_MVTDR_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* clear lists: */ + + /* hash table for edges */ + _unur_mvtdr_etable_free(gen); + + /* linked list of vertices */ + for (vt = GEN->vertex; vt != NULL; vt = vt_next) { + vt_next = vt->next; + free (vt->coord); /* coordinates of vertex */ + free (vt); + } + + /* linked list of cones */ + for (c = GEN->cone; c != NULL; c = c_next) { + c_next = c->next; + free (c->v); /* list of vertices of the cone */ + free (c->center); /* barycenter of cone */ + free (c->gv); /* for all vertices v */ + free (c); + } + + /* guide table */ + if (GEN->guide) free (GEN->guide); + + /* working arrays */ + if (GEN->S) free (GEN->S); + if (GEN->g) free (GEN->g); + if (GEN->tp_coord) free (GEN->tp_coord); + if (GEN->tp_mcoord) free (GEN->tp_mcoord); + if (GEN->tp_Tgrad) free (GEN->tp_Tgrad); + + _unur_generic_free(gen); + +} /* end of _unur_mvtdr_free() */ + +/*****************************************************************************/ + +struct unur_gen * +_unur_mvtdr_gammagen( struct unur_gen *gen, double alpha ) + /*----------------------------------------------------------------------*/ + /* create a gamma random variate generator with shape parameter alpha. */ + /* */ + /* parameters: */ + /* gen ... pointer to MVTDR generator object */ + /* alpha ... shape parameter */ + /* */ + /* return: */ + /* pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + struct unur_distr *gammadistr; + struct unur_par *gammapar; + struct unur_gen *gammagen; + double shape; + + /* make generator object */ + shape = alpha; + gammadistr = unur_distr_gamma(&shape,1); + if (_unur_isfinite(GEN->max_gamma)) { + unur_distr_cont_set_domain(gammadistr,0.,GEN->max_gamma); + } + gammapar = unur_tdr_new( gammadistr ); + unur_tdr_set_usedars( gammapar, TRUE ); + unur_tdr_set_max_sqhratio( gammapar, MVTDR_TDR_SQH_RATIO); + if (! GEN->has_domain) { + /* we do not need a truncated gamma distribution. */ + /* hence we can use immediate acceptance. */ + unur_tdr_set_variant_ia( gammapar ); + } + gammagen = unur_init( gammapar ); + _unur_distr_free( gammadistr ); + + /* check result */ + if (gammagen == NULL) { + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN, + "Cannot create aux Gamma generator"); + return NULL; + } + + /* uniform random number generator and debugging flags */ + gammagen->urng = gen->urng; + gammagen->debug = gen->debug; + + return gammagen; + +} /* end of _unur_mvtdr_gammagen() */ + + +/*****************************************************************************/ +/* */ +/* Hat. */ +/* */ +/*****************************************************************************/ + +int +_unur_mvtdr_create_hat( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* create hat function. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int step; /* triangulation steps */ + double Hi_bound; /* lower bound on Hi for splitting cone */ + CONE *c; + int n_splitted; + + /* vertices of initial cones */ + if( _unur_mvtdr_initial_vertices(gen) != UNUR_SUCCESS ) + return UNUR_FAILURE; + + /* initial cones */ + if( _unur_mvtdr_initial_cones(gen) != UNUR_SUCCESS ) + return UNUR_FAILURE; + + /* execute minimal number of triangulation steps */ + for( step = 1; step <= GEN->steps_min; step++ ) { + if (_unur_mvtdr_triangulate(gen,step,TRUE) < 0) + return UNUR_FAILURE; + } + + /* compute optimal distance of touching points and volume Hi */ + for( c = GEN->cone; c != NULL; c = c->next ) + _unur_mvtdr_tp_find (gen,c); + + /* cones with invalid hats (or too large volumes) must be split */ + while( _unur_mvtdr_triangulate(gen,step,FALSE) > 0 ) { + if (GEN->n_cone > GEN->max_cones) + return UNUR_FAILURE; + step++; + } + + /* maximum number of triangulations yet */ + GEN->n_steps = step-1; + + /* compute cumulated volumes in all cones */ + GEN->Htot = 0.; /* accumulated sum of volumes */ + for( c=GEN->cone; c!=NULL; c=c->next ) { + /* volume below hat */ + GEN->Htot += c->Hi; /* volume below hat */ + c->Hsum = GEN->Htot; /* accumulated sum of volumes */ + } + + /* split until stopping criterion in reached */ + while (1) { + + /* bound for splitting cones */ + /* do until all cones have approx same hat volumes */ + Hi_bound = GEN->bound_splitting * GEN->Htot / GEN->n_cone; + + /* and now check all the cones again */ + GEN->Htot = 0.; + n_splitted = 0; + for( c=GEN->cone; c!=NULL; c=c->next ) { /* all cones */ + while( Hi_bound < c->Hi && GEN->n_cone < GEN->max_cones ) { + /* we (must) split the cone again */ + if (_unur_mvtdr_cone_split(gen,c,c->level+1) != UNUR_SUCCESS) + return UNUR_FAILURE; + ++n_splitted; + /* and compute optimal touching point */ + _unur_mvtdr_tp_find (gen,c); + _unur_mvtdr_tp_find (gen,GEN->last_cone); + } + GEN->Htot += c->Hi; /* volume below hat */ + c->Hsum = GEN->Htot; /* accumulated sum of volumes */ + if( c == GEN->last_cone ) break; + } + + /* stop when maximal number of cones is reached or no cones are split */ + if (!n_splitted || GEN->n_cone >= GEN->max_cones) break; + } + + /* create guide table for finding cones */ + if (_unur_mvtdr_make_guide_table(gen) != UNUR_SUCCESS) + return UNUR_FAILURE; + + /* we do not need the hash table generated in triangulate() cone any more */ + if (GEN->dim > 2) + _unur_mvtdr_etable_free(gen); + + return UNUR_SUCCESS; + +} /* end of _unur_mvtdr_create_hat() */ + + +/*****************************************************************************/ +/* */ +/* CONES. */ +/* */ +/*****************************************************************************/ + +int +_unur_mvtdr_initial_cones( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get initial cones */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i,j,k; + CONE *c; + int max_c; /* maximum number of cones */ + VERTEX *vt; + VERTEX **ivtl; /* list of initial vertices */ + int dim = GEN->dim; + + int error = FALSE; + int have_negative_index = FALSE; + int cone_out_of_domain; + + /* make array of initial vertices */ + ivtl = malloc(2 * dim * sizeof(VERTEX*)); + if( ivtl==NULL ) { + _unur_error(gen->genid,UNUR_ERR_MALLOC,""); return UNUR_ERR_MALLOC; + } + for (vt = GEN->vertex, i=0; i < 2*GEN->dim && vt!=NULL; vt = vt->next, i++) { + if (vt->index<0) have_negative_index = TRUE; + ivtl[i] = vt; + } + + /* we have (at most) 2^dim initial cones */ + max_c = 1 << dim; + + /* we need vertices, index, volume for each cone */ + for( k=0; k>i)&1) && ivtl[i]->index < 0) || + ( ((k>>i)&1) && ivtl[i+dim]->index < 0) ) { + cone_out_of_domain = TRUE; break; + } + } + if (cone_out_of_domain) /* cone is not inside domain --> skip */ + continue; + } + + /* get new (empty) cone object */ + c = _unur_mvtdr_cone_new(gen); + if (c==NULL) { error = TRUE; break; } + + /* this is level 0 of triangulation */ + c->level = 0; + + /* each cone is incident to 'dim' edges. */ + /* The i-th edge of the cone is either GEN->v[i] or GEN->v[dim+i], */ + /* (the latter is equal to (-1)*(GEN->v[i])). */ + /* The indices of the vertices must be in ascending order. */ + j = 0; + for( i=0; i < dim; i++ ) + if (!((k>>i)&1)) (c->v)[j++] = ivtl[i]; + for( i=0; i < dim && j < dim; i++ ) + if ( ((k>>i)&1)) (c->v)[j++] = ivtl[i + dim]; + + /* determinant and volume of triangle * ((dim-1)!) */ + c->logdetf = 0.; + + /* touching point not known yet */ + c->tp = -1.; /* > 0. if and only if tp is computed !! */ + } + + /* free list of initial vertices */ + free (ivtl); + + if (error==TRUE) return UNUR_ERR_MALLOC; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_mvtdr_initial_cones() */ + +/*---------------------------------------------------------------------------*/ + +CONE * +_unur_mvtdr_cone_new( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* allocate new cone and append it to linked list of all cones. */ + /* increment counter for cones. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to newly allocated cone */ + /*----------------------------------------------------------------------*/ +{ + CONE *c; + + /* allocate memory */ + c = malloc(sizeof(CONE)); + if (c==NULL) { + _unur_error(gen->genid,UNUR_ERR_MALLOC,""); return NULL; } + + /* insert into list of cones */ + if (GEN->cone == NULL) + GEN->last_cone = GEN->cone = c; + else + GEN->last_cone = GEN->last_cone->next = c; + c->next = NULL; + + /* list of vertices of the cone */ + c->v = malloc( GEN->dim * sizeof(VERTEX *)); + + /* barycenter of cone */ + c->center = malloc( GEN->dim * sizeof(double)); + + /* for all vertices v */ + c->gv = malloc( GEN->dim * sizeof(double)); + + if (c->v==NULL || c->center==NULL || c->gv==NULL) { + _unur_error(gen->genid,UNUR_ERR_MALLOC,""); return NULL; } + + /* the cone is unbounded when created */ + c->height = UNUR_INFINITY; + + /* mark as invalid */ + c->tp = -1.; + c->Hi = UNUR_INFINITY; + + /* and update counter */ + ++(GEN->n_cone); + + /* return pointer to next vertex */ + return c; + +} /* end of _unur_mvtdr_cone_new() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_mvtdr_cone_center( struct unur_gen *gen, CONE *c ) + /*----------------------------------------------------------------------*/ + /* computer center of cone and normalize the corresponding vector */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* c ... cone for which center has to be computed */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i,k; + double norm; + int dim = GEN->dim; + + /* compute sum of all vertices and square of its norm */ + norm = 0.; + for( i=0; icenter[i] = 0.; + for( k=0; kcenter[i] += (c->v[k])->coord[i]; /* dim * barycenter */ + norm += c->center[i] * c->center[i]; /* norm ^2 */ + } + + /* norm --> 1 */ + norm = sqrt(norm); + for( i=0; icenter[i] /= norm; + + return UNUR_SUCCESS; + +} /* end of _unur_mvtdr_cone_center() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_mvtdr_cone_params( struct unur_gen *gen, CONE *c ) + /*----------------------------------------------------------------------*/ + /* compute parameters for hat for a cone */ + /* (expect touching point and volume below hat) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* c ... cone for which parameters have to be computed */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double Tf,f; /* (transformed) density */ + double Tderf; /* T'(f(x)) */ + int i; /* aux variable */ + int dim = GEN->dim; /* dimension */ + + double *g = GEN->g; /* Vector g (direction of sweeping plane) */ + double *coord = GEN->tp_coord; /* coordinates of touching point */ + double *mcoord = GEN->tp_mcoord; /* coordinates of touching point moved into center */ + double *Tgrad = GEN->tp_Tgrad; /* gradient of transformed density */ + + /* we consider values for the PDF and of derivated numbers that are + too small as equal 0: */ + double tolerance = TOLERANCE * GEN->pdfcenter / dim; + + /* coordinates of touching point */ + for( i=0; itp * c->center[i]; + mcoord[i] = coord[i] + GEN->center[i]; + } + + /* density at construction point */ + if( DISTR.logpdf != NULL ) { + c->Tfp = Tf = logPDF(mcoord); + if (! _unur_isfinite(Tf)) + return UNUR_ERR_DISTR_DOMAIN; + } + else { + f = PDF(mcoord); + /* check density */ + if( f < tolerance ) + /* assume f = 0. */ + return UNUR_ERR_DISTR_DOMAIN; + /* transformed density */ + c->Tfp = Tf = T(f); + } + + /* gradient of logPDF */ + if( DISTR.dlogpdf != NULL ) { + /* gradient of logPDF available */ + dlogPDF(Tgrad,mcoord); + } + else { + /* grad( T(f(x) ) = T'(f(x)) * grad(f(x)) */ + dPDF(Tgrad,mcoord); + Tderf = T_deriv(exp(Tf)); + for( i=0; ialpha = Tf - _unur_vector_scalar_product(dim,Tgrad,coord); + c->beta = _unur_vector_norm(dim,Tgrad); + + /* |Tgrad| must not be too small */ + if( c->beta < tolerance ) + return UNUR_FAILURE; + + /* vector g = - grad(T(f)) / |grad(T(f))| */ + for( i=0; ibeta; + + /* for each vertex v of cone and */ + /* parameter a1 for volume of cone */ + c->logai = c->logdetf; + for( i=0; igv[i] = _unur_vector_scalar_product(dim,g,(c->v[i])->coord); /* */ + if( c->gv[i] < tolerance ) + /* too small: would result in severe numerical errors */ + return UNUR_FAILURE; + else + c->logai -= log(c->gv[i]); + } + + /* this is expensive for calculation for every touching point !!! */ + /* Maybe we only perform this computation when at the very end */ + /* and use height=UNUR_INFINITY for finding construction points. */ + if (_unur_mvtdr_cone_height(gen,c) != UNUR_SUCCESS) + return UNUR_FAILURE; + + /* return error code */ + return UNUR_SUCCESS; + +} /* end of _unur_mvtdr_cone_params() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_mvtdr_cone_logH( struct unur_gen *gen, CONE *c ) + /*----------------------------------------------------------------------*/ + /* calculate log of volume below hat for given touching point. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* c ... cone for which volume below hat has to be computed */ + /* */ + /* return: */ + /* success ... logarithm of volume below hat */ + /* PDF(tp)==0 ... -UNUR_INFINITY */ + /* error(hat unbounded?) ... +UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double logH; + + /* compute parameters for cone */ + switch ( _unur_mvtdr_cone_params(gen,c) ) { + case UNUR_SUCCESS: + break; + case UNUR_ERR_DISTR_DOMAIN: + /* construction point out of support */ + return -UNUR_INFINITY; + default: + /* something is wrong: beta = 0 and/or <= 0 */ + return UNUR_INFINITY; + } + + /* compute log of volume below hat */ + logH = c->alpha - GEN->dim * log(c->beta) + c->logai; + + if (_unur_isfinite(c->height)) { + /* there is a change to the paper, eq.(15): */ + /* 'logai' does not contain '(dim-1)!' . */ + /* thus we have to modify eq.(31) accordingly. */ + /* Remark: this is a rather expensive computation. */ + /* It could be omitted if 'c->beta*c->height' is */ + /* large (not too small). */ + if (c->height < 1.e-50) + return -UNUR_INFINITY; + else + logH += log(_unur_SF_incomplete_gamma(c->beta*c->height,(double)GEN->dim)); + } + + /* check for numerical errors (alpha or beta too small) */ + return (_unur_isfinite(logH)) ? logH : UNUR_INFINITY; + +} /* end of _unur_mvtdr_cone_logH() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_mvtdr_cone_split( struct unur_gen *gen, CONE *c, int step ) + /*----------------------------------------------------------------------*/ + /* split a cone along "oldest" edge */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* c ... cone which has to be split */ + /* step ... triangulation level */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + CONE *newc; /* new cone */ + VERTEX *newv; /* new vertex */ + int dim = GEN->dim; /* dimension */ + int i; + + if (dim == 2) + /* there is only one edge in this cone */ + newv = _unur_mvtdr_vertex_on_edge(gen,c->v); + else + /* find "oldest" edge, read center of edge from table (or computer) */ + newv = _unur_mvtdr_etable_find_or_insert(gen,c->v); + if (newv==NULL) return UNUR_FAILURE; + + /* construct two new cones */ + + /* first cone */ + newc = _unur_mvtdr_cone_new(gen); /* new cone */ + if (newc==NULL) return UNUR_ERR_MALLOC; + newc->level = step; /* triangulation level */ + for (i=0; iv[i] = c->v[i+1]; /* copy list of vertices to new cone */ + newc->v[dim-1] = newv; /* add new vertex */ + newc->logdetf = c->logdetf - log(2.*newv->norm); /* log of det of spanning vectors */ + newc->tp = c->tp; /* distance of touching point remains unchanged */ + + /* second cone */ + c->level = step; /* triangulation level */ + for (i=0; iv[i+1] = c->v[i+2]; /* shift list of vertices */ + (c->v)[dim-1] = newv; /* add new vertex */ + c->logdetf = newc->logdetf; /* the determinant */ + + /* store maximal triangulation level for debugging */ + GEN->n_steps = _unur_max(GEN->n_steps, step); + + return UNUR_SUCCESS; + +} /* end of _unur_mvtdr_cone_split() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_mvtdr_triangulate( struct unur_gen *gen, int step, int all ) + /*----------------------------------------------------------------------*/ + /* make one triangulation step */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* step ... level of triangulation steps */ + /* all ... whether all (TRUE) cones have to be split */ + /* or only those cones where volumes are too big */ + /* */ + /* return: */ + /* number of new cones */ + /* -1 in case of error */ + /*----------------------------------------------------------------------*/ +{ + int k,nc; + CONE *c; + int dim = GEN->dim; /* dimension */ + + if (dim > 2) { + /* We need a hash table for storing the edges. */ + /* size of table = maximum number of vertices in current triangulation cycle. */ + /* only required at begining of new tiangulation iteration, i.e. step = dim-1. */ + /* length of cycle dim-1. */ + /* only necessary if dim > 2 */ + if( step % (dim-1) == 1 ) + if( _unur_mvtdr_etable_new(gen, _unur_mvtdr_number_vertices(gen, (step/(dim-1)+1)*(dim-1) )) + != UNUR_SUCCESS ) + return -1; + } + + /* number of cones before triangulation */ + nc = GEN->n_cone; + + /* triangulate every cone */ + for( k=0, c=GEN->cone; ktp < 0. ) { + if (_unur_mvtdr_cone_split(gen,c,step) != UNUR_SUCCESS) + return -1; + _unur_mvtdr_tp_find (gen,c); + _unur_mvtdr_tp_find (gen,GEN->last_cone); + } + /* next cone */ + c = c->next; + } + + /* return number of new cones */ + return (GEN->n_cone - nc); + +} /* end of _unur_mvtdr_triangulate() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_mvtdr_cone_height( struct unur_gen *gen, CONE *c ) + /*----------------------------------------------------------------------*/ + /* calculate height of pyramid (cone) using simplex algorithm */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* c ... cone for which we compute height */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* working array for simplex tableau: double A[N+1][N+1]; */ +#define A(i,j) (AA[(dim+1)*(i)+(j)]) + double *AA; + int dim = GEN->dim; + + /* coordinates of lower left and upper right vertices of domain */ +#define ll(i) (domain[2*(i)] - GEN->center[(i)]) +#define ur(i) (domain[2*(i)+1] - GEN->center[(i)]) + double *domain; + + int i,j,row,ipc,ipr; + double pc,pr,ratio; + double sgn; + + /* bounded domain ? */ + if (! GEN->has_domain) + /* nothing to do (c->height is set to INIFINITY at creating time) */ + return UNUR_SUCCESS; + + /* get rectangular domain */ + if (DISTR.domainrect == NULL) { + _unur_error(gen->genid,UNUR_ERR_DISTR_DOMAIN,"no domain given"); + return UNUR_ERR_DISTR_DOMAIN; + } + domain = DISTR.domainrect; + + /* allocate memory for simplex tableau */ + AA = _unur_xmalloc( (dim+1)*(dim+1)*sizeof(double) ); + + /* set initial matrix for simplex algorithm */ + for( i=0, row=0; iv[j])->coord[i] > 0. ) { + sgn = +1.; break; + } + if( (c->v[j])->coord[i] < 0. ) { + sgn = -1.; break; + } + } + /* check sign */ + if (_unur_iszero(sgn)) continue; + + /* coefficients of inequalities */ + for( j=0; jv[j])->coord[i]; + A(row,dim) = (sgn > 0.) ? ur(i) : -(ll(i)); + row++; + } + + /* objective function */ + for( j=0; jgv[j]); + A(row,dim) = 0.; + + /* find maximum */ + while( 1 ) { + + /* pivot column */ + for( j=0,pc=0.,ipc=-1; jheight = A(row,dim); + break; + } + + /* find pivot row */ + for( i=0,pr=-1.,ipr=-1; i ratio ) { + ipr = i; + pr = ratio; + } + } + + /* unbounded ? */ + if( ipr == -1 ) { + c->height = UNUR_INFINITY; + break; + } + + /* make pivot step */ + /* the rest */ + for( i=0; i<=row; i++ ) + if( i!= ipr ) + for( j=0; jheight)) c->height = UNUR_INFINITY; + + /* o.k. */ + return UNUR_SUCCESS; + +#undef A +#undef ll +#undef ur +} /* end of _unur_mvtdr_cone_height() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_mvtdr_max_gamma( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* compute upper bound for gamma variates */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double max, tmp; + CONE *c; + + if (!GEN->has_domain) { + GEN->max_gamma = UNUR_INFINITY; + } + else { + max = 0.; + for (c = GEN->cone; c != NULL; c = c->next) { + tmp = c->height * c->beta; + max = _unur_max(max, tmp); + } + GEN->max_gamma = (max > 0.) ? max : UNUR_INFINITY; + } + + return UNUR_SUCCESS; +} /* end of _unur_mvtdr_max_gamma() */ + + +/*****************************************************************************/ +/* */ +/* Optimal distance for touching points */ +/* */ +/*****************************************************************************/ + +double +_unur_mvtdr_tp_min (double t, void *p ) + /*----------------------------------------------------------------------*/ + /* volume function. */ + /* */ + /* parameters: */ + /* t ... location of touching point */ + /* p ... pointer to arguments of volume functions */ + /* */ + /* return: */ + /* logarithm of the volume below the hat */ + /*----------------------------------------------------------------------*/ +{ + /* unpack arguments */ + TP_ARG *a = p; + /* set new construction point for hat */ + (a->c)->tp = a->t = t; + /* compute volume below hat in cone and return result */ + a->logH = _unur_mvtdr_cone_logH (a->gen, a->c); + + /* status of result */ + switch (_unur_isinf(a->logH)) { + case -1: + a->logH = UNUR_INFINITY; + a->status = MVTDR_CONE_DOMAIN; + break; + case 1: + a->status = MVTDR_CONE_INVALID; + break; + case 0: + default: + a->status = MVTDR_CONE_OK; + } + + if( a->status != MVTDR_CONE_OK ) + /* we mark this case by setting tp = -1 */ + (a->c)->tp = -1.; + + return a->logH; +} /* end of _unur_mvtdr_tp_min() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_mvtdr_tp_min_aux(double t, void *p) + /*----------------------------------------------------------------------*/ + /* auxiliary function to be used with _unur_util_brent(). */ + /* _unur_util_brent() maximizes functions, so we need the negative */ + /* of the volume function. */ + /* */ + /* parameters: */ + /* t ... location of touching point */ + /* p ... pointer to arguments of volume functions */ + /* */ + /* return: */ + /* negative of logarithm of the volume below the hat */ + /*----------------------------------------------------------------------*/ +{ + return (- _unur_mvtdr_tp_min(t, p) ); +} + +/*---------------------------------------------------------------------------*/ + +int +_unur_mvtdr_tp_find( struct unur_gen *gen, CONE *c ) + /*----------------------------------------------------------------------*/ + /* find optimal touching point for cone using Brent's method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* c ... cone for which touching point has to be computed */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_funct_generic tpaux; + TP_ARG a[3]; /* left, middle and right point of bracket for Brent algorithm */ + int i; + + /* compute center */ + _unur_mvtdr_cone_center(gen,c); + + /* pack arguments for finding minimum */ + for (i=0; i<3; i++) { a[i].c = c; a[i].gen = gen; } + + /* find proper touching point */ + switch (_unur_mvtdr_tp_search(gen,a)) { + case UNUR_SUCCESS: + break; + case UNUR_ERR_DISTR_DOMAIN: + /* cone not in support of PDF */ + c->tp = 0.; + c->Hi = 0.; + c->height = 0.; + return UNUR_ERR_DISTR_DOMAIN; + case UNUR_FAILURE: + default: + /* no proper point found */ + return UNUR_FAILURE; + } + + /* find "bracket" for Brent's algorithm */ + switch( _unur_mvtdr_tp_bracket(gen,a) ) { /* searching for intervall that contains minimum */ + case TP_BRACKET: /* bracket found */ + /* make auxiliary function for Brent's algorithms */ + tpaux.f = _unur_mvtdr_tp_min_aux; + tpaux.params = a+1; + c->tp = _unur_util_brent( tpaux, a[0].t, a[2].t, a[1].t, FIND_TP_TOL); + c->Hi = exp(a[1].logH); + break; /* c->tp already set by tp_min() */ + case TP_LEFT: /* minimum in left point */ + c->tp = a[0].t; + c->Hi = exp(a[0].logH); + break; + case TP_MIDDLE: /* minimum in middle point */ + _unur_mvtdr_tp_min(a[1].t, a+1); /* calculate volume function */ + c->Hi = exp(a[1].logH); + break; + case TP_RIGHT: /* minimum in right point */ + c->tp = a[2].t; + c->Hi = exp(a[2].logH); + break; + default: /* no proper touching point found */ + c->tp = -1.; + return UNUR_FAILURE; + } + + return UNUR_SUCCESS; + +} /* end of _unur_mvtdr_tp_find() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_mvtdr_tp_search( struct unur_gen *gen ATTRIBUTE__UNUSED, TP_ARG *a ) + /*----------------------------------------------------------------------*/ + /* search for proper touching point. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* a ... arguments for function that should be minimized */ + /* a[0], a[1], a[2] ... left, middle and right point of */ + /* bracket used for Brent's algorithm, */ + /* see _unur_util_brent(). */ + /* the result is stored in a[1]. */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ +#define N_STEPS (10) /* max number of steps for finding proper touching point */ + + int i; /* aux counter */ + int is_unbounded_cone = FALSE; /* boolean */ + double start = 1.; /* starting point for search routine */ + + /** search from 0 --> 1 (towards infinity) **/ + + /* initialize boundary of intervall */ + a[0].t = 0.; /* x[0] must >= 0. */ + a[1].t = start; /* starting point for searching proper touching point */ + a[2].t = -1.; /* not known. marked by setting to -1. */ + + for( i=1; i <= N_STEPS; i++ ) { + _unur_mvtdr_tp_min(a[1].t, a+1); /* calculate volume function */ + + if (a[1].status == MVTDR_CONE_OK) { + return UNUR_SUCCESS; + } + else if (a[1].status == MVTDR_CONE_DOMAIN) { + /* touching point out of domain */ + break; + } + else { + /* not a proper touching point */ + is_unbounded_cone = TRUE; + a[0].t = a[1].t; + a[1].t *= 2.; + } + } + + /** search from 1 --> 0 **/ + + /* initialize boundary of intervall */ + a[0].t = 0.; /* x[0] must >= 0. */ + a[1].t = start/2.; /* starting point for searching proper touching point */ + a[2].t = 1.; /* t[2] must >= t[1]. */ + + for( i=0;; i++ ) { + _unur_mvtdr_tp_min(a[1].t, a+1); /* calculate volume function */ + + if (a[1].status == MVTDR_CONE_OK) { + return UNUR_SUCCESS; + } + else if (a[1].status == MVTDR_CONE_DOMAIN) { + /* touching point out of domain */ + if (a[1].t < 1.e-20 ) { + /* the bound 1.e-20 is rather arbirary */ + return (is_unbounded_cone) ? UNUR_FAILURE : UNUR_ERR_DISTR_DOMAIN; + } + a[2].t = a[1].t; + a[1].t /= 10.; + } + else { + if (i > N_STEPS) { + /* no proper touching point found */ + /* --> giving up and split cone before next try */ + return UNUR_FAILURE; + } + is_unbounded_cone = TRUE; + a[2].t = a[1].t; + a[1].t /= 2.; + } + } + + /* no proper touching point found */ + /* return UNUR_FAILURE; */ + +#undef N_STEPS +} /* end of _unur_mvtdr_tp_search() */ + +/*-----------------------------------------------------------------*/ + +int +_unur_mvtdr_tp_bracket( struct unur_gen *gen ATTRIBUTE__UNUSED, TP_ARG *a ) + /*----------------------------------------------------------------------*/ + /* search for proper bracket for Brent's algorithm */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* a ... arguments for function that should be minimized */ + /* a[0], a[1], a[2] ... left, middle and right point of */ + /* bracket used for Brent's algorithm, */ + /* see _unur_util_brent(). */ + /* */ + /* return: */ + /* TP_LEFT ... minimum in left point */ + /* TP_MIDDLE ... use middle point */ + /* TP_RIGHT ... minimum in right point */ + /* TP_BRACKET ... bracket found */ + /*----------------------------------------------------------------------*/ +{ +#define N_STEPS (10) /* max number of steps for finding bracket */ + + int i; /* aux variable */ + double tleft, tright; /* left boundary of searching region */ + + /** left point of intervall **/ + + /* initialize boundary of searching region and set starting point */ + tleft = a[0].t; + a[0].t = a[1].t / 2.; + + /* search */ + for( i=1; i <= _unur_max(1,N_STEPS); i++ ) { + _unur_mvtdr_tp_min(a[0].t, a); /* volume function */ + + if( a[0].status != MVTDR_CONE_OK ) { + /* a[0] not a proper touching point */ + tleft = a[0].t; /* change boundary of searching region */ + a[0].t += (a[1].t - a[0].t) / 2.; /* try another one */ + } + + else if( a[0].logH <= a[1].logH ) { + /* a[0] is proper touching point, but ... */ + a[2].t = a[1].t; a[2].logH = a[1].logH; a[2].status = MVTDR_CONE_OK; + a[1].t = a[0].t; a[1].logH = a[0].logH; a[1].status = MVTDR_CONE_OK; + a[0].t = tleft + (a[0].t - tleft)*0.5; + } + else /* all right: a[0].logH > a[1].logH */ + break; + } + + /* search successful ? */ + if( a[0].status != MVTDR_CONE_OK ) + /* no proper touching point on left side --> use middle point */ + return TP_MIDDLE; + if( a[0].logH <= a[1].logH ) + /* vol(left) <= vol(middle) */ + return TP_LEFT; + + /** right point of intervall **/ + + /* initialize a[2] if necessary */ + if( a[2].t < 0. ) + a[2].t = 1.1 * a[1].t; + tright = -1.; /* no right boundary known yet */ + tleft = a[1].t; + + /* search */ + for( i=1; i <= _unur_max(1,N_STEPS); i++ ) { + _unur_mvtdr_tp_min(a[2].t, a+2); /* volume function */ + if( a[2].status != MVTDR_CONE_OK ) { + /* a[2] not a proper touching point */ + tright = a[2].t; + a[2].t = (tleft + a[2].t) * 0.5; /* try another one */ + } + else if( a[2].logH <= a[1].logH ) { + /* move right */ + tleft = a[2].t; + a[2].t = (tright < 0.) ? a[2].t * 2. : (tright + a[2].t) * 0.5; + } + else /* all right: vol(right) > vol(middle) */ + break; + } + + /* search successful ? */ + if( a[2].status != MVTDR_CONE_OK ) + /* no proper touching point on right side --> use middle point */ + return TP_MIDDLE; + if( a[2].logH <= a[1].logH ) + /* f(right) <= f(middle) */ + return TP_RIGHT; + + /* we have found a bracket */ + return TP_BRACKET; + +#undef N_STEPS +} /* end of _unur_mvtdr_tp_bracket() */ + +/*****************************************************************************/ +/* */ +/* VERTICES. */ +/* */ +/*****************************************************************************/ + +int +_unur_mvtdr_initial_vertices( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get vertices of initial cones. */ + /* these are the vertices (0,...,0,+/- 1, 0, ..., 0). */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + VERTEX *vt; + int i,k; + double d; + double *domain; + + /* get rectangular domain */ + domain = ( (GEN->has_domain && DISTR.domainrect != NULL) + ? DISTR.domainrect : NULL ); + + /* unit vectors e_k and -e_k */ + for ( d=1.; d > -2.; d -= 2.) { + /* '+'-sign and '-'-sign */ + for( k=0; kdim; k++ ) { + vt = _unur_mvtdr_vertex_new(gen); + if (vt==NULL) return UNUR_FAILURE; + + for( i=0; idim; i++ ) { + /* coordinates */ + (vt->coord)[i] = (i==k) ? d : 0.; + } + /* all vectors have norm 1. */ + vt->norm = 1.; + + /* vertices outside domain of PDF get a negative index */ + if ( domain ) { + if ( (d<0 && _unur_FP_equal(GEN->center[k],domain[2*k])) || + (d>0 && _unur_FP_equal(GEN->center[k],domain[2*k+1])) ) + vt->index = -vt->index -1; + } + } + } + + return UNUR_SUCCESS; + +} /* end of _unur_mvtdr_initial_vertices() */ + +/*---------------------------------------------------------------------------*/ + +VERTEX * +_unur_mvtdr_vertex_new( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* allocate new vertex and append it to linked list of all vertices. */ + /* increment counter for vertices. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to newly allocated vertex */ + /*----------------------------------------------------------------------*/ +{ + VERTEX *v; + + /* allocate memory */ + v = malloc(sizeof(VERTEX)); + if (v==NULL) { + _unur_error(gen->genid,UNUR_ERR_MALLOC,""); return NULL; } + + /* insert into list of cones */ + if (GEN->vertex == NULL) { + GEN->last_vertex = GEN->vertex = v; + } + else { + GEN->last_vertex = GEN->last_vertex->next = v; + } + v->next = NULL; + + /* coordinates of vertex */ + v->coord = malloc(GEN->dim * sizeof(double)); + if (v->coord==NULL) { + _unur_error(gen->genid,UNUR_ERR_MALLOC,""); return NULL; } + + /* index of vertex */ + v->index = GEN->n_vertex; + /* and update counter */ + ++(GEN->n_vertex); + + /* return pointer to next vertex */ + return GEN->last_vertex; + +} /* end of _unur_mvtdr_vertex_new() */ + +/*---------------------------------------------------------------------------*/ + +VERTEX * +_unur_mvtdr_vertex_on_edge( struct unur_gen *gen, VERTEX **vl ) + /*----------------------------------------------------------------------*/ + /* compute new vertex on edge (i.e., its barycenter) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* vl ... arraqy of the two end vertices of the edge. */ + /* */ + /* return: */ + /* pointer to new vertex */ + /*----------------------------------------------------------------------*/ +{ + int i; + VERTEX *newv; /* pointer to new vertex */ + + /* get an empty vertex */ + newv = _unur_mvtdr_vertex_new(gen); + if (newv==NULL) return NULL; + + /* barycenter of edge */ + for( i=0; idim; i++ ) + newv->coord[i] = + 0.5 * ( ((vl[0])->coord)[i] + ((vl[1])->coord)[i] ); + + /* norm */ + newv->norm = _unur_vector_norm(GEN->dim, newv->coord); + + /* norm --> 1 */ + for( i=0; idim; i++ ) + newv->coord[i] /= newv->norm; + + return newv; + +} /* end of _unur_mvtdr_vertex_on_edge() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_mvtdr_number_vertices( struct unur_gen *gen, int level ) + /*----------------------------------------------------------------------*/ + /* calculate (approximate) number of vertices in a given triangulation */ + /* level (when all initial cones are splitted). */ + /* These numbers are used for the size of the hash table for edges. */ + /* (WARNING! The numbers are found by computer experiments.) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* level ... number of triangulation steps */ + /* */ + /* return: */ + /* number of vertices */ + /* */ + /* error: */ + /* return -1 */ + /*----------------------------------------------------------------------*/ +{ + if (level < 0 || GEN->dim < 2) { + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return -1; /** errorcode **/ + } + + switch (GEN->dim) { + + case 2: { + return (1 << (level+2)); + } + case 3: { + static int nv[]={ 6, 13, 18, 40, 66,142,258,538,1026,2098,4098,8290,16386,32962,65538,131458,262146}; + return nv[_unur_min(level,16)]; + } + case 4: { + static int nv[]={ 8, 19, 25, 32, 80,128,192,456, 824,1408,3120,5968,11008,23264,45600, 87552}; + return nv[_unur_min(level,15)]; + } + case 5: { + static int nv[]={10, 26, 33, 41, 50,140,220,321, 450,1186,2158,3636, 5890,13970,27130}; + return nv[_unur_min(level,14)]; + } + case 6: { + static int nv[]={12, 34, 42, 51, 61, 72,224,348, 501, 681, 912,2660, 4896, 8254}; + return nv[_unur_min(level,13)]; + } + case 7: { + static int nv[]={14, 43, 52, 62, 73, 85, 98,336, 518, 743, 985,1289, 1666}; + return nv[_unur_min(level,12)]; + } + case 8: { + static int nv[]={16, 53, 63, 74, 86, 99,113,128, 480, 736,1059}; + return nv[_unur_min(level,10)]; + } + case 9: { + static int nv[]={18, 64, 75, 87,100,114,129,145, 162, 660}; + return nv[_unur_min(level,9)]; + } + case 10: { + static int nv[]={20, 76, 88,101,115,130,146,163, 181, 200}; + return nv[_unur_min(level,9)]; + } + case 11: { + static int nv[]={22, 89,102,116,131,147,164,182, 201, 221, 242}; + return nv[_unur_min(level,10)]; + } + default: { /* dim >= 12 */ + static int nv[]={24,103,117,132,148,165,183,202, 222, 243, 265, 288}; + return nv[_unur_min(level,11)]; + } + } + +} /* end of _unur_mvtdr_number_vertices() */ + + +/*****************************************************************************/ +/* */ +/* hash table for storing EDGES. */ +/* */ +/*****************************************************************************/ + +/* hash function for edge table */ +#define _unur_mvtdr_etable_hash(x,y) ( (3*((x)+(y))/2) % GEN->etable_size ) + +/*---------------------------------------------------------------------------*/ + +int +_unur_mvtdr_etable_new( struct unur_gen *gen, int size ) + /*----------------------------------------------------------------------*/ + /* make a new hash table. */ + /* destroy old table if it exists. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* size ... size of hash table */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int n; + + /* first clear hash table (if necessary) */ + _unur_mvtdr_etable_free(gen); + + /* set size of edge table */ + GEN->etable_size = size; + + /* make root */ + GEN->etable = _unur_xmalloc( size * sizeof(E_TABLE*) ); + if (GEN->etable==NULL) { + _unur_error(gen->genid,UNUR_ERR_MALLOC,""); return UNUR_ERR_MALLOC; } + + /* initialize table */ + for (n = 0; n< size; n++) + GEN->etable[n] = NULL; + + return UNUR_SUCCESS; + +} /* end of _unur_mvtdr_etable_new() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_mvtdr_etable_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* free hash table. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + int i; + E_TABLE *et, *et_next; + + if( GEN->etable == NULL ) + /* nothing to do */ + return; + + /* clear all branches */ + for( i=0; ietable_size; i++ ) { + /* free branch in table (linked list) */ + for (et = GEN->etable[i]; et != NULL; et = et_next) { + et_next = et->next; + free (et); + } + } + + /* clear root */ + free( GEN->etable ); + GEN->etable = NULL; + GEN->etable_size = 0; + +} /* end if _unur_mvtdr_etable_free() */ + +/*---------------------------------------------------------------------------*/ + +VERTEX * +_unur_mvtdr_etable_find_or_insert( struct unur_gen *gen, VERTEX **vidx ) + /*----------------------------------------------------------------------*/ + /* search for an edge in the hash table. */ + /* the edge is given by its end vertices vidx[0] and vidx[1]. */ + /* (if vidx is an ordered array of the vertices of a cone then this */ + /* edge is the "oldest" edge of that cone (i.e., the end vertices have */ + /* the smallest indices of all vertices of the cone.) */ + /* */ + /* if the edge is found, a pointer to the vertex that corresponds to */ + /* the barycenter of the edge. */ + /* */ + /* if the edge is not found in the table, it is created and inserted */ + /* into the table, the barycenter is computed. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* vidx ... array of pointers to vertices */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + E_TABLE *pet, *pet_last; /* table entry */ + int idx[2]; /* store indices */ + int hidx; /* hash number */ + + /* check pointer */ + CHECK_NULL(GEN->etable,NULL); + + /* hash number */ + idx[0] = vidx[0]->index; + idx[1] = vidx[1]->index; + hidx = _unur_mvtdr_etable_hash(idx[0],idx[1]); + + /* get branch of hash table */ + pet = pet_last = *(GEN->etable + hidx); + + /* now find entry in branch */ + while( pet != NULL ) { + if( pet->index[0] == idx[0] && pet->index[1] == idx[1] ) + break; /* found ! */ + pet_last = pet; + pet = pet->next; + } + + if( pet == NULL ) { + /* we have not found the index */ + + /* new entry in hash table */ + pet = malloc( sizeof(E_TABLE) ); + if (pet==NULL) { + _unur_error(gen->genid,UNUR_ERR_MALLOC,""); return NULL; } + + pet->next = NULL; + if (pet_last == NULL) + *(GEN->etable + hidx) = pet; + else + pet_last->next = pet; + + /* insert data of new edge */ + /* indices of incident vertices */ + pet->index[0] = idx[0]; + pet->index[1] = idx[1]; + + /* compute new vertex */ + pet->vertex = _unur_mvtdr_vertex_on_edge(gen,vidx); + } + + /* return pointer to (new) edge */ + return pet->vertex; + +} /* end of _unur_mvtdr_etable_find_or_insert() */ + +/*****************************************************************************/ + +int +_unur_mvtdr_make_guide_table( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* create guide table. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int j; + CONE *c; + + /* memory for the guide table */ + GEN->guide_size = GEN->n_cone * GUIDE_TABLE_SIZE; + GEN->guide = malloc (GEN->guide_size * sizeof(CONE*)); + if (GEN->guide==NULL) { + _unur_error(gen->genid,UNUR_ERR_MALLOC,""); return UNUR_ERR_MALLOC; } + /* initialize table */ + for( j = 0; j < GEN->guide_size ; j++ ) + GEN->guide[j] = NULL; + + /* make table */ + for( c=GEN->cone, j=0; c!=NULL && jguide_size; j++ ) { + while( c->Hsum / GEN->Htot < (double) j / GEN->guide_size ) + c=c->next; + (GEN->guide)[j] = c; + if( c == GEN->last_cone ) break; + } + + /* is there an error ? */ + if( jguide_size ) + /* this should not happen */ + for( ; jguide_size; j++ ) + (GEN->guide)[j] = GEN->last_cone; + + return UNUR_SUCCESS; + +} /* end of _unur_mvtdr_make_guide_table() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/mvtdr_newset.ch b/vendor/unuran-1.11.0/src/methods/mvtdr_newset.ch new file mode 100644 index 0000000..4c89a68 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/mvtdr_newset.ch @@ -0,0 +1,331 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: mvtdr_newset.c * + * * + * TYPE: continuous multivariate random variate * + * METHOD: multivariate transformed density rejection * + * * + * DESCRIPTION: * + * Given (logarithm of the) PDF of a log-concave distribution; * + * produce a value x consistent with its density. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_mvtdr_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CVEC) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CVEC,NULL); + + if (distr->dim < 2) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_PROP,"dim < 2"); return NULL; } + + if ( ! ((DISTR_IN.pdf && DISTR_IN.dpdf) || (DISTR_IN.logpdf && DISTR_IN.dlogpdf)) ) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"d/(log)PDF"); + return NULL; + } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_mvtdr_par) ); + COOKIE_SET(par,CK_MVTDR_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + par->method = UNUR_METH_MVTDR ; /* method */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_mvtdr_init; + + /* set default values */ + /* minimum number of triangulation steps */ + PAR->steps_min = 5; + + /* maximum number of cones (at least 2^(dim+T_STEPS_MIN) */ + PAR->max_cones = 10000; + + /* bound for splitting cones */ + PAR->bound_splitting = 1.5; + + /** TODO !! **/ + /* move mode to boundary if |mode - boundary| / length < MODE_TO_BOUNDARY */ + /* PAR->mode_to_boundary = 0.01; */ + + return par; + +} /* end of unur_mvtdr_new() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_mvtdr_set_stepsmin( struct unur_par *par, int stepsmin ) + /*----------------------------------------------------------------------*/ + /* set minimum number of triangulation step for each starting cone */ + /* */ + /* parameters: */ + /* par ... pointer to parameter object */ + /* stepsmin ... minimum number of triangulation steps */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, MVTDR ); + + /* check new parameter for generator */ + if (stepsmin < 0) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"stepsmin < 0"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->steps_min = stepsmin; + + /* changelog */ + par->set |= MVTDR_SET_STEPSMIN; + + return UNUR_SUCCESS; + +} /* end of unur_mvtdr_set_stepsmin() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_mvtdr_set_boundsplitting( UNUR_PAR *par, double boundsplitting ) + /*----------------------------------------------------------------------*/ + /* set bound for splitting cones. all cones are splitted when the */ + /* volume below the hat is greater than boundsplitting times the */ + /* average volume over all cones. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter object */ + /* boundsplitting ... maximum number of cones */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, MVTDR ); + + /* check new parameter for generator */ + + /* store date */ + PAR->bound_splitting = boundsplitting; + + /* changelog */ + par->set |= MVTDR_SET_BOUNDSPLITTING; + + return UNUR_SUCCESS; + +} /* end of unur_mvtdr_set_boundsplitting() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_mvtdr_set_maxcones( struct unur_par *par, int maxcones ) + /*----------------------------------------------------------------------*/ + /* set maximum number of cones */ + /* (this number is always increased to 2^(dim+stepsmin) ) */ + /* */ + /* parameters: */ + /* par ... pointer to parameter object */ + /* maxcones ... maximum number of cones */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, MVTDR ); + + /* check new parameter for generator */ + /* none here: it is always increased to 2^(dim+stepsmin) during init */ + + /* store date */ + PAR->max_cones = maxcones; + + /* changelog */ + par->set |= MVTDR_SET_MAXCONES; + + return UNUR_SUCCESS; + +} /* end of unur_mvtdr_set_maxcones() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_mvtdr_get_ncones( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get number of cones */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* number of cones ... on success */ + /* 0 ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, 0 ); + _unur_check_gen_object( gen, MVTDR, 0 ); + + return GEN->n_cone; +} /* end of unur_mvtdr_get_ncones() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_mvtdr_get_hatvol( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get volume below hat */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* volume ... on success */ + /* UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + _unur_check_gen_object( gen, MVTDR, UNUR_INFINITY ); + + return GEN->Htot; +} /* end of unur_mvtdr_get_hatvol() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_mvtdr_set_verify( struct unur_par *par, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + + /* check input */ + _unur_check_par_object( par, MVTDR ); + + /* we use a bit in variant */ + par->variant = (verify) ? (par->variant | MVTDR_VARFLAG_VERIFY) : (par->variant & (~MVTDR_VARFLAG_VERIFY)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_mvtdr_set_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_mvtdr_chg_verify( struct unur_gen *gen, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, MVTDR, UNUR_ERR_GEN_INVALID ); + + /* we must not change this switch when sampling has been disabled by + using a pointer to the error producing routine */ + if (SAMPLE == _unur_sample_cvec_error) + return UNUR_FAILURE; + + /* we use a bit in variant */ + gen->variant = (verify) + ? (gen->variant | MVTDR_VARFLAG_VERIFY) + : (gen->variant & (~MVTDR_VARFLAG_VERIFY)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_mvtdr_chg_verify() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/mvtdr_sample.ch b/vendor/unuran-1.11.0/src/methods/mvtdr_sample.ch new file mode 100644 index 0000000..f79c46f --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/mvtdr_sample.ch @@ -0,0 +1,189 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: mvtdr_sample.c * + * * + * TYPE: continuous multivariate random variate * + * METHOD: multivariate transformed density rejection * + * * + * DESCRIPTION: * + * Given (logarithm of the) PDF of a log-concave distribution; * + * produce a value x consistent with its density. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +/*****************************************************************************/ +/** Sampling **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_mvtdr_sample_cvec( struct unur_gen *gen, double *rpoint ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* vec ... random vector (result) */ + /*----------------------------------------------------------------------*/ +{ + CONE *c; /* cone for generating point */ + double gx; /* distance of random point */ + double U; /* uniformly distributed random number */ + double f, h; /* value of density and hat at random point */ + int i,j; + + double *S = GEN->S; /* working array for storing point on simples */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_MVTDR_GEN,UNUR_ERR_COOKIE); + + /* loop until random point is accepted */ + while( 1 ) { + + /*.......................................................................*/ + /** find a cone **/ + + U = _unur_call_urng(gen->urng); /* sample from uniform distribution */ + + /* look up in guide table and search for cone */ + c = (GEN->guide)[(int) (U * GEN->guide_size)]; + U *= GEN->Htot; + while (c->next!=NULL && c->Hsum < U) + c = c->next; + + /*.......................................................................*/ + /** get random point and distance of hyper plane **/ + + /* get x value for marginal distribution of hat --> hyperplane */ + if (GEN->has_domain) + /* update domain of gamma distribution */ + /* remark: this is rather expensive */ + unur_tdr_chg_truncated(GEN_GAMMA, 0., c->beta * c->height ); + gx = unur_sample_cont(GEN_GAMMA) / (c->beta); + + /* nonnegative uniform random numbers with sum u_i = 1 */ + _unur_mvtdr_simplex_sample(gen, S); + + /* move point into center */ + for( i=0; idim; i++ ) rpoint[i] = GEN->center[i]; + + /* calculate random point on chosen hyper-plane */ + for( j=0; jdim; j++ ) { + double x = gx * S[j] / c->gv[j]; + for( i=0; idim; i++ ) + rpoint[i] += x * (c->v[j])->coord[i]; + } + + /*.......................................................................*/ + /** accept or reject **/ + + f = PDF(rpoint); /* density */ + h = T_inv( c->alpha - c->beta * gx ); /* hat */ + + /* verify hat function */ + if ( (gen->variant & MVTDR_VARFLAG_VERIFY) && + ((1.+UNUR_EPSILON) * h < f ) ) + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) > hat(x)"); + + /* accept point */ + if( _unur_call_urng(gen->urng) * h <= f ) + return UNUR_SUCCESS; + } + +} /* end of _unur_mvtdr_sample_cvec() */ + +/*-----------------------------------------------------------------*/ + +int +_unur_mvtdr_simplex_sample( const struct unur_gen *gen, double *U ) + /*----------------------------------------------------------------------*/ + /* sample point uniformly on standard simplex */ + /* point in standard simplex 0 <= u[0] <= ... <= u[dim-2] <= 1 */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* U ... array for storing result */ + /*----------------------------------------------------------------------*/ +{ + int dim = GEN->dim; + + /*................................................................*/ + if (dim == 2) { + U[0] = _unur_call_urng(gen->urng); + U[1] = 1. - U[0]; + return UNUR_SUCCESS; + } + /*................................................................*/ + if (dim == 3) { + U[0] = _unur_call_urng(gen->urng); + U[1] = _unur_call_urng(gen->urng); + if( U[0] > U[1] ) { + U[2] = U[0]; U[0] = U[1]; U[1] = U[2]; + } + U[2] = 1. - U[1]; + U[1] = U[1] - U[0]; + return UNUR_SUCCESS; + } + /*................................................................*/ + if (dim >3) { + int i,j; + double U_aux; + + /* generate dim-1 numbers */ + for( i=0; iurng); + + /* sort numbers (insertion sort) */ + /** TODO!! replace by exp random variates!! **/ + for( i=1; i0 && U[j-1] > U_aux; j-- ) + U[j] = U[j-1]; + U[j] = U_aux; + } + + /* transform to affine coordinates */ + U[dim-1] = 1.; + for( i=dim-1; i>0; i-- ) + U[i] -= U[i-1]; + + return UNUR_SUCCESS; + } + /*................................................................*/ + /* else --> make error message!! */ + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_FAILURE; + +} /* end of _unur_mvtdr_simplex_sample() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/mvtdr_struct.h b/vendor/unuran-1.11.0/src/methods/mvtdr_struct.h new file mode 100644 index 0000000..4d05602 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/mvtdr_struct.h @@ -0,0 +1,144 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: mvtdr_struct.h * + * * + * PURPOSE: * + * declares structures for method MVTDR * + * (Multi-Variate Transformed Density Rejection) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_mvtdr_par { + + int max_cones; /* maximum number of cones (at least 2^(N+T_STEPS_MIN) */ + int steps_min; /* minimum number of triangulation steps */ + double bound_splitting; /* bound for splitting cones */ + +/* #if MODE == 1 */ +/* double mode_to_boundary; /\* move mode to boundary if |mode - boundary| / length < MODE_TO_BOUNDARY *\/ */ +/* #endif */ + +}; + + +/*---------------------------------------------------------------------------*/ + +typedef struct s_vertex /* -- data for one vertex ---------------- */ +{ + struct s_vertex *next; /* pointer to next vertex in list */ + int index; /* index of vertex */ + double *coord; /* coordinates of spanning vector(norm = 1), "vertex" */ + double norm; /* norm of vertex */ +} VERTEX; + + +typedef struct s_cone /* -- a cone ----------------------------- */ +{ + struct s_cone *next; /* pointer to next cone in list */ + int level; /* level of triangulation */ + VERTEX **v; /* list of vertices of the cone */ + double *center; /* barycenter of cone */ + double logdetf; /* log determinant -log((dim-1)!) for cone */ + double alpha; /* parameter alpha for hat function */ + double beta; /* parameter alpha for hat function */ + double *gv; /* for all vertices v */ + double logai; /* (log of) coefficient for marginal density */ + double tp; /* coordinate of touching point */ + double Hi; /* volume under hat in cone */ + double Hsum; /* accumulated sum of volumes */ + double Tfp; /* value of transformed density at touching point */ + double height; /* height of pyramid */ +} CONE; + +typedef struct s_edge_table /* -- hash table for edges --------------- */ +{ + int index[2]; /* index of incident vertices */ + VERTEX *vertex; /* index of corresponding vertex (=barycenter) */ + struct s_edge_table *next; /* next entry in list */ +} E_TABLE; + + +typedef struct s_tp_arg /* -- argument for tp function ----------- */ +{ + double t; /* touching point */ + double logH; /* log of volume below hat */ + CONE *c; /* parameters */ + UNUR_GEN *gen; /* pointer to MVTDR generator object */ + int status; /* status of cone parameters */ +} TP_ARG; + + +enum { /* -- possible status of cone paramters -- */ + MVTDR_CONE_OK = 0x000, /* cone is ready to use */ + MVTDR_CONE_DOMAIN = 0x001, /* touching point out of support of PDF */ + MVTDR_CONE_INVALID = 0x002 /* parameters invalid (Hi not finite?) */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_mvtdr_gen { + int dim; /* dimension of distribution */ + int has_domain; /* whether the domain of distribution has given domain */ + double max_gamma; /* upper bound for gamma variaties */ + + const double *center; /* center of distribution */ + + CONE *cone; /* root of list of cones */ + CONE *last_cone; /* pointer to last cone in list */ + int n_cone; /* number of cones */ + int max_cones; /* maximum number of cones */ + double bound_splitting; /* bound for splitting cones */ + + VERTEX *vertex; /* root of list of vertices */ + VERTEX *last_vertex; /* pointer to last vertex in list */ + int n_vertex; /* number of vertices */ + + E_TABLE **etable; /* pointer to edge table */ + int etable_size; /* size of edge table */ + + CONE **guide; /* pointer to guide table */ + int guide_size; /* size of guide table */ + + double *S; /* working array for storing point on simples */ + double *g; /* working array for vector g (direction of sweeping plane) */ + double *tp_coord; /* working array for storing coordinates of touching point of hat */ + double *tp_mcoord; /* working array for storing coordinates of touching point of hat moved into center */ + double *tp_Tgrad; /* working array for storing gradient of transformed density at tp */ + + double Htot; /* total volume below hat */ + int steps_min; /* minimum number of triangulation steps */ + int n_steps; /* (highest) number of triangulation steps */ + + double pdfcenter; /* PDF at center */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/ninv.c b/vendor/unuran-1.11.0/src/methods/ninv.c new file mode 100644 index 0000000..30019a8 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/ninv.c @@ -0,0 +1,338 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: ninv.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: numerical inversion of cumulative distribution function * + * * + * DESCRIPTION: * + * * + * REQUIRED: * + * pointer to the CDF * + * newton's method: additional pointer to the PDF * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Neumaier A. (to be published): * + * Introduction to numerical analysis, * + * Cambridge University Press. * + * * + * [2] Dahlquist, G. and Bj{\"o}rck, {\AA} (2008): * + * Numerical methods in scientific computing, Vol 1., * + * SIAM, Philadelphia, PA. * + * * + * [3] Brent, R. (1973): * + * Algorithms for Minimizing without Derivatives, * + * Prentice-Hall, Englewood Cliffs, NJ. * + * Republished by Dover Publications, Mineola, NY, 2002. * + * * + ***************************************************************************** + * * + * Numerical inversion is a method for generating random variables * + * using the CDF (and in case of newton's method the PDF). * + * * + * THEOREM: * + * Let X be a random variable with CDF F(x). * + * Then the F(X) are uniformly distributed. * + * * + * COROLLARY: * + * Starting with uniformly distributed random variables U, * + * the F^(-1)(U) have F(x) as CDF. * + * * + * Starting with an U, the task is to find a X fulfilling: * + * F(X) - U = 0. * + * * + * Numerical algorithms to find zeros that are used in NINV are variants of * + * newton's method (damped newton to guarantee improvement) and * + * the regula falsi ( stabilized regula falsi preserving sign change; at * + * first an interval with sign change is determined). * + * * + * In both cases it is possible to specify the maximal number of * + * iterations, a desired accuracy in X and starting values for the * + * algorithms. * + * Instead of starting values it is also possible to use a table * + * containing suitable starting values. * + * If neither the table nor explicit starting values are used, * + * NINV chooses as starting values: * + * newton's method: x: CDF(x) = 0.5 * + * regula falsi: x1,x2: CDF(x1) = 1 - CDF(x2) = 0.05 * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "ninv.h" +#include "ninv_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Constants */ + +/* Starting interval for Regula Falsi includes this percentage of all */ +/* univariate random numbers (must be > 0. and < 1.) */ +#define INTERVAL_COVERS (0.5) + +/*---------------------------------------------------------------------------*/ +/* Variants: none */ + +#define NINV_VARFLAG_NEWTON 0x1u /* use Newton's method */ +#define NINV_VARFLAG_REGULA 0x2u /* use regula falsi [default] */ +#define NINV_VARFLAG_BISECT 0x4u /* use bisection method */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define NINV_DEBUG_REINIT 0x00000002u /* print parameters after reinit */ +#define NINV_DEBUG_TABLE 0x00000010u /* print table */ +#define NINV_DEBUG_CHG 0x00001000u /* print changed parameters */ +#define NINV_DEBUG_SAMPLE 0x01000000u /* trace sampling */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define NINV_SET_MAX_ITER 0x001u /* number of maximal iterations */ +#define NINV_SET_X_RESOLUTION 0x002u /* maximal tolerated relative x-error */ +#define NINV_SET_U_RESOLUTION 0x004u /* maximal tolerated (abs.) u-error */ +#define NINV_SET_START 0x008u /* intervals at start (left/right) */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "NINV" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +/*........................*/ +/* file: ninv_newset.ch */ +/*........................*/ + +/* See ninv.h for 'new', 'set', and 'get' calls. */ + + +/*......................*/ +/* file: ninv_init.ch */ +/*......................*/ + +static struct unur_gen *_unur_ninv_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_ninv_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_ninv_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_ninv_check_par( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_ninv_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_ninv_free( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_ninv_create_table( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* create the table with starting points */ +/*---------------------------------------------------------------------------*/ + +static int _unur_ninv_compute_start( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* get starting points for numerical inversion */ +/*---------------------------------------------------------------------------*/ + + +/*........................*/ +/* file: ninv_sample.ch */ +/*........................*/ + +static double _unur_ninv_sample_newton( struct unur_gen *gen ); +static double _unur_ninv_sample_regula( struct unur_gen *gen ); +static double _unur_ninv_sample_bisect( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + + +/*........................*/ +/* file: ninv_newton.ch */ +/*........................*/ + +static double _unur_ninv_newton( const struct unur_gen *gen, double u); +/*---------------------------------------------------------------------------*/ +/* algorithm: newton method */ +/*---------------------------------------------------------------------------*/ + + +/*........................*/ +/* file: ninv_regula.ch */ +/*........................*/ + +static double _unur_ninv_regula( const struct unur_gen *gen, double u ); +/*---------------------------------------------------------------------------*/ +/* algorithm: regula falsi */ +/*---------------------------------------------------------------------------*/ + +static double _unur_ninv_bisect( const struct unur_gen *gen, double u ); +/*---------------------------------------------------------------------------*/ +/* algorithm: bisection method */ +/*---------------------------------------------------------------------------*/ + +static int _unur_ninv_bracket( const struct unur_gen *gen, double u, + double *xl, double *fl, double *xu, double *fu ); +/*---------------------------------------------------------------------------*/ +/* find a bracket (enclosing interval) for root of CDF(x)-u. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_ninv_accuracy( const struct unur_gen *gen, + double x_resol, double u_resol, + double x0, double f0, double x1, double f1 ); +/*---------------------------------------------------------------------------*/ +/* check accuracy goal for approximate root. */ +/*---------------------------------------------------------------------------*/ + + +/*.......................*/ +/* file: ninv_debug.ch */ +/*.......................*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_ninv_debug_init( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_ninv_debug_start( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print starting points or table for algorithms into LOG file */ +/*---------------------------------------------------------------------------*/ + +static void _unur_ninv_debug_sample( const struct unur_gen *gen, + double u, double x, double fx, int iter ); +/*---------------------------------------------------------------------------*/ +/* trace sampling. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_ninv_debug_chg_truncated( const struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* trace changes of the truncated domain. */ +/*---------------------------------------------------------------------------*/ +#endif + + +/*......................*/ +/* file: pinv_info.ch */ +/*......................*/ + +#ifdef UNUR_ENABLE_INFO +static void _unur_ninv_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cont /* data for distribution object */ + +#define PAR ((struct unur_ninv_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_ninv_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +#define PDF(x) _unur_cont_PDF((x),(gen->distr)) /* call to PDF */ +#define CDF(x) _unur_cont_CDF((x),(gen->distr)) /* call to CDF */ + +/*---------------------------------------------------------------------------*/ + +static UNUR_SAMPLING_ROUTINE_CONT * +_unur_ninv_getSAMPLE( struct unur_gen *gen ) +{ + switch (gen->variant) { + case NINV_VARFLAG_NEWTON: + return _unur_ninv_sample_newton; + case NINV_VARFLAG_BISECT: + return _unur_ninv_sample_bisect; + case NINV_VARFLAG_REGULA: + default: + return _unur_ninv_sample_regula; + } +} /* end of _unur_ninv_getSAMPLE() */ + +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +/* since there is only file scope or program code, we abuse the */ +/* #include directive. */ + +/** Public: User Interface (API) **/ +#include "ninv_newset.ch" + +/** Private **/ +#include "ninv_init.ch" +#include "ninv_sample.ch" +#include "ninv_newton.ch" +#include "ninv_regula.ch" +#include "ninv_debug.ch" +#include "ninv_info.ch" + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/ninv.h b/vendor/unuran-1.11.0/src/methods/ninv.h new file mode 100644 index 0000000..4d5930e --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/ninv.h @@ -0,0 +1,309 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: ninv.h * + * * + * PURPOSE: * + * function prototypes for method NINV * + * (Numerical INVersion of cumulative distribution function) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2009 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD NINV Numerical INVersion + + =UP Methods_for_CONT + + =REQUIRED CDF + + =OPTIONAL PDF + + =SPEED Set-up: optional, Sampling: (very) slow + + =REINIT supported + + =DESCRIPTION + NINV implementations of some methods for numerical inversion: + Newton's method, regula falsi (combined with interval + bisectioning), and bisection method. + Regula falsi and bisection method require only the CDF while + Newton's method also requires the PDF. + To speed up marginal generation times a table with suitable + starting points can be created during the setup. + The performance of the algorithm can adjusted by the desired + accuracy of the method. + It is possible to use this method for generating from truncated + distributions. The truncated domain can be changed for an + existing generator object. + + =HOWTOUSE + Method NINV generates random variates by numerical + inversion and requires a continuous univariate distribution + objects with given CDF. Three variants are available: + + @itemize @minus + @item Regula falsi [default] + @item Newton's method + @item Interval bisectioning + @end itemize + + Newton's method additionally requires the PDF of the + distribution and cannot be used otherwise (NINV automatically + switches to regula falsi then). + Default algorithm is regula falsi. It is slightly slower but + numerically much more stable than Newton's algorithm. + Interval bisectioning is the slowest method and should only be + considered as a last resort when the other methods fails. + + It is possible to draw samples from truncated distributions. + The truncated domain can even be changed for an existing generator + object by an unur_ninv_chg_truncated() call. + + Marginal generation times can be sped up by means of a table + with suitable starting points which can be created during the + setup. Using such a table can be switched on by means of a + unur_ninv_set_table() call where the table size is given as a + parameter. The table is still useful when the (truncated) domain + is changed often, since it is computed for the + domain of the given distribution. (It is not possible to enlarge + this domain.) If it is necessary to recalculate the table during + sampling, the command unur_ninv_chg_table() can be used. + As a rule of thumb using such a table is appropriate when the + number of generated points exceeds the table size by a factor of + 100. + + The default number of iterations of NINV should be enough for all + reasonable cases. Nevertheless, it is possible to adjust the maximal + number of iterations with the commands + unur_ninv_set_max_iter() and unur_ninv_chg_max_iter(). + In particular this might be necessary when the PDF has a pole or + the distribution has extremely heavy tails. + + It is also possible to set/change the accuracy of the method + (which also heavily influencies the generation time). + We use two measures for the approximation error which can be + used independently: x-error and u-error + (@pxref{Inversion} for more details). + It is possible to set the maximal tolerated error using + with unur_ninv_set_x_resolution() and + with unur_ninv_set_u_resolution(), resp., and change it with the + respective calls unur_ninv_chg_x_resolution() and + unur_ninv_chg_x_resolution(). + The algorithm tries to satisfy @emph{both} accuracy goals (and + raises an error flag it this fails). + One of these accuracy checks can be disabled by setting the + accuracy goal to a negative value. + + NINV tries to use proper starting values for both the regula + falsi and bisection method, and for Newton's method. Of course + the user might have more knowledge about the properties of the + target distribution and is able to share his wisdom with NINV + using the respective commands + unur_ninv_set_start() and unur_ninv_chg_start(). + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + The values given by the last unur_ninv_chg_truncated() call will be + then changed to the values of the domain of the underlying distribution + object. It is important to note that for a distribution from the + UNU.RAN library of standard distributions + (@pxref{Stddist,,Standard distributions}) + the normalization constant has to be updated using the + unur_distr_cont_upd_pdfarea() call whenever its parameters have been + changed by means of a unur_distr_cont_set_pdfparams() call. + + It might happen that NINV aborts unur_sample_cont() without + computing the correct value (because the maximal number + iterations has been exceeded). Then the last approximate value + for @i{x} is returned (with might be fairly false) and + @code{unur_error} is set to @code{UNUR_ERR_GEN_SAMPLING}. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* + =ROUTINES +*/ + + +UNUR_PAR *unur_ninv_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_ninv_set_useregula( UNUR_PAR *parameters ); +/* + Switch to regula falsi combined with interval bisectioning. + (This the default.) +*/ + +int unur_ninv_set_usenewton( UNUR_PAR *parameters ); +/* + Switch to Newton's method. + Notice that it is numerically less stable than regula falsi. + It it is not possible to invert the CDF for a particular uniform random + number @i{U} when calling unur_sample_cont(), @code{unur_error} is set + to @code{UNUR_ERR_GEN_SAMPLING}. + Thus it is recommended to check @code{unur_error} before + using the result of the sampling routine. +*/ + +int unur_ninv_set_usebisect( UNUR_PAR *parameters ); +/* + Switch to bisection method. This is a slow algorithm and should + only be used as a last resort. +*/ + +int unur_ninv_set_max_iter( UNUR_PAR *parameters, int max_iter ); +/* */ + +int unur_ninv_chg_max_iter(UNUR_GEN *generator, int max_iter); +/* + Set and change number of maximal iterations. + Default is @code{100}. +*/ + + +int unur_ninv_set_x_resolution( UNUR_PAR *parameters, double x_resolution); +/* */ + +int unur_ninv_chg_x_resolution(UNUR_GEN *generator, double x_resolution); +/* + Set and change the maximal tolerated relative x-error. + If @var{x_resolution} is negative then checking of the x-error is + disabled. + + Default is @code{1.e-8}. +*/ + +int unur_ninv_set_u_resolution( UNUR_PAR *parameters, double u_resolution); +/* */ + +int unur_ninv_chg_u_resolution(UNUR_GEN *generator, double u_resolution); +/* + Set and change the maximal tolerated (abolute) u-error. + If @var{u_resolution} is negative then checking of the u-error is + disabled. + + Default is @code{-1} (disabled). +*/ + +int unur_ninv_set_start( UNUR_PAR *parameters, double left, double right); +/* + Set starting points. + If not set, suitable values are chosen automatically. + + @multitable @columnfractions 0.2 0.2 0.6 + @item Newton: @tab @var{left}: @tab starting point + @item Regula falsi: @tab @var{left}, @var{right}: @tab boundary of starting interval + @end multitable + + If the starting points are not set then the follwing points are used by + default: + @multitable @columnfractions 0.2 0.2 0.6 + @item Newton: @tab @var{left}: @tab CDF(@var{left}) = 0.5 + @item Regula falsi: @tab @var{left}: @tab CDF(@var{left}) = 0.1 + @item @tab @var{right}: @tab CDF(@var{right}) = 0.9 + @end multitable + + If @var{left} == @var{right}, then UNU.RAN always uses the default + starting points! +*/ + +int unur_ninv_chg_start(UNUR_GEN *gen, double left, double right); +/* + Change the starting points for numerical inversion. + If left==right, then UNU.RAN uses the default starting points + (see unur_ninv_set_start()). +*/ + +int unur_ninv_set_table(UNUR_PAR *parameters, int no_of_points); +/* + Generates a table with @var{no_of_points} points containing + suitable starting values for the iteration. The value of + @var{no_of_points} must be at least 10 (otherwise it will be set + to 10 automatically). + + The table points are chosen such that the CDF at these points + form an equidistance sequence in the interval (0,1). + + If a table is used, then the starting points given by + unur_ninv_set_start() are ignored. + + No table is used by default. + */ + +int unur_ninv_chg_table(UNUR_GEN *gen, int no_of_points); +/* + Recomputes a table as described in unur_ninv_set_table(). +*/ + + +int unur_ninv_chg_truncated(UNUR_GEN *gen, double left, double right); +/* + Changes the borders of the domain of the (truncated) distribution. + + Notice that the given truncated domain must be a subset of the + domain of the given distribution. The generator always uses the + intersection of the domain of the distribution and the truncated + domain given by this call. + Moreover the starting point(s) will not be changed. + + @emph{Important:} If the CDF is (almost) the same for @var{left} and + @var{right} and (almost) equal to @code{0} or @code{1}, then the truncated + domain is @emph{not} chanced and the call returns an error code. + + @emph{Notice:} If the parameters of the distribution has been changed by a + unur_distr_cont_set_pdfparams() call it is recommended to set the + truncated domain again, since the former call might change the + domain of the distribution but not update the values for the + boundaries of the truncated distribution. +*/ + +double unur_ninv_eval_approxinvcdf( const UNUR_GEN *generator, double u ); +/* + Get approximate approximate value of inverse CDF at @var{u}. + If @var{u} is out of the domain [0,1] then @code{unur_errno} is set + to @code{UNUR_ERR_DOMAIN} and the respective bound of + the domain of the distribution are returned (which is + @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of + unbounded domains). + + @emph{Notice}: This function always evaluates the inverse CDF of + the given distribution. A call to unur_ninv_chg_truncated() call + has no effect. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/ninv_debug.ch b/vendor/unuran-1.11.0/src/methods/ninv_debug.ch new file mode 100644 index 0000000..3b87c61 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/ninv_debug.ch @@ -0,0 +1,170 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: ninv_debug.ch * + * * + * Routines for printing debugging information. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2009 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_ninv_debug_init( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_NINV_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = ninv (numerical inversion of CDF)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cont_debug( gen->distr, gen->genid ); + + fprintf(LOG,"%s: sampling routine = _unur_ninv_sample",gen->genid); + switch (gen->variant) { + case NINV_VARFLAG_NEWTON: + fprintf(LOG,"_newton\n"); + break; + case NINV_VARFLAG_BISECT: + fprintf(LOG,"_bisect\n"); + break; + case NINV_VARFLAG_REGULA: default: + fprintf(LOG,"_regula\n"); + break; + } + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: u-resolution = ",gen->genid); + if (GEN->u_resolution < 0.) + fprintf(LOG,"[disabled]"); + else + fprintf(LOG,"%g",GEN->u_resolution); + _unur_print_if_default(gen,NINV_SET_U_RESOLUTION); + + fprintf(LOG,"\n%s: x-resolution = ",gen->genid); + if (GEN->x_resolution < 0.) + fprintf(LOG,"[disabled]"); + else + fprintf(LOG,"%g",GEN->x_resolution); + _unur_print_if_default(gen,NINV_SET_X_RESOLUTION); + + fprintf(LOG,"\n%s:\n",gen->genid); + + _unur_ninv_debug_start(gen); + + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_ninv_debug_init() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_ninv_debug_start( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* print starting points or table for algorithms into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int i; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_NINV_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + if (GEN->table_on) { + fprintf(LOG,"%s: use table (size = %d)\n",gen->genid,GEN->table_size); + if (gen->debug & NINV_DEBUG_TABLE) + for (i=0; itable_size; i++) + fprintf(LOG,"%s:\tx = %12.6g, F(x) = %10.8f\n",gen->genid,GEN->table[i],GEN->f_table[i]); + } + else { /* no table */ + fprintf(LOG,"%s: starting points:\n",gen->genid); + fprintf(LOG,"%s:\ts[0] = %12.6g, F(x) = %10.8f\n",gen->genid,GEN->s[0],GEN->CDFs[0]); + if (! (gen->variant & NINV_VARFLAG_NEWTON)) + fprintf(LOG,"%s:\ts[1] = %12.6g, F(x) = %10.8f\n",gen->genid,GEN->s[1],GEN->CDFs[1]); + } + + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_ninv_debug_start() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_ninv_debug_sample( const struct unur_gen *gen, double u, double x, double fx, int iter ) + /*----------------------------------------------------------------------*/ + /* trace sampling (regula falsi) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_NINV_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: u = %8.6f,\t x = %8.6g\t(cdf(x)-u = %8.2g)\t -- %2d iterations [%d]\n", + gen->genid,u,x,fx,iter,GEN->max_iter); + +} /* end of _unur_ninv_debug_sample_regula() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_ninv_debug_chg_truncated( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* print new (changed) domain of (truncated) distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_NINV_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: domain of (truncated) distribution changed:\n",gen->genid); + fprintf(LOG,"%s:\tdomain = (%g, %g)\n",gen->genid, DISTR.trunc[0], DISTR.trunc[1]); + fprintf(LOG,"%s:\tU in (%g,%g)\n",gen->genid,GEN->Umin,GEN->Umax); + +} /* end of _unur_ninv_debug_chg_truncated() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/ninv_info.ch b/vendor/unuran-1.11.0/src/methods/ninv_info.ch new file mode 100644 index 0000000..1b9cf96 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/ninv_info.ch @@ -0,0 +1,157 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: ninv_info.ch * + * * + * Routines for creating info strings. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2009 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_ninv_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + double n_iter; + int samplesize = 10000; + + int use_newton = (gen->variant==NINV_VARFLAG_NEWTON) ? TRUE : FALSE; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = CDF"); + if (use_newton) + _unur_string_append(info," PDF"); + _unur_string_append(info,"\n"); + _unur_string_append(info," domain = (%g, %g)", DISTR.trunc[0],DISTR.trunc[1]); + if (gen->distr->set & UNUR_DISTR_SET_TRUNCATED) { + _unur_string_append(info," [truncated from (%g, %g)]", DISTR.domain[0],DISTR.domain[1]); + } + _unur_string_append(info,"\n\n"); + + /* method */ + _unur_string_append(info,"method: NINV (Numerical INVersion)\n"); + switch (gen->variant) { + case NINV_VARFLAG_NEWTON: + _unur_string_append(info," Newton method\n"); + break; + case NINV_VARFLAG_BISECT: + _unur_string_append(info," Bisection method\n"); + break; + case NINV_VARFLAG_REGULA: default: + _unur_string_append(info," Regula falsi\n"); + break; + } + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + n_iter = unur_test_count_pdf(gen,samplesize,FALSE,NULL)/(2.*samplesize); + if (!use_newton) n_iter *= 2.; + _unur_string_append(info," average number of iterations = %.2f [approx.]\n", n_iter); + + if (gen->set & NINV_SET_U_RESOLUTION) { + if (DISTR.cdf) { + double max_error=1.; double MAE=1.; + unur_test_u_error(gen, &max_error, &MAE, 1.e-20, 1000, + FALSE, FALSE, FALSE, NULL); + _unur_string_append(info," u-error <= %g (mean = %g) [rough estimate]\n", max_error, MAE); + } + else { + _unur_string_append(info," u-error NA [requires CDF]\n"); + } + _unur_string_append(info, " [ u-resolution = %g ]\n",GEN->u_resolution); + } + + if (GEN->table_on) { + _unur_string_append(info," starting points = table of size %d\n", GEN->table_size); + } + else { + _unur_string_append(info," starting points = "); + if (use_newton) { + _unur_string_append(info,"%g (CDF = %g) %s\n", GEN->s[0], GEN->CDFs[0], + (gen->set & NINV_SET_START) ? "" : "[default]"); + } + else { + _unur_string_append(info,"%g, %g (CDF = %g, %g) %s\n", + GEN->s[0],GEN->s[1], GEN->CDFs[0],GEN->CDFs[1], + (gen->set & NINV_SET_START) ? "" : "[default]"); + } + } + _unur_string_append(info,"\n"); + + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + switch (gen->variant) { + case NINV_VARFLAG_NEWTON: + _unur_string_append(info," usenewton\n"); + break; + case NINV_VARFLAG_BISECT: + _unur_string_append(info," usebisect\n"); + break; + case NINV_VARFLAG_REGULA: default: + _unur_string_append(info," useregula [default]\n"); + break; + } + + _unur_string_append(info," u_resolution = %g %s %s\n", GEN->u_resolution, + (GEN->u_resolution > 0.) ? "" : "[disabled]", + (gen->set & NINV_SET_U_RESOLUTION) ? "" : "[default]"); + + _unur_string_append(info," x_resolution = %g %s %s\n", GEN->x_resolution, + (GEN->x_resolution > 0.) ? "" : "[disabled]", + (gen->set & NINV_SET_X_RESOLUTION) ? "" : "[default]"); + + _unur_string_append(info," max_iter = %d %s\n", GEN->max_iter, + (gen->set & NINV_SET_MAX_ITER) ? "" : "[default]"); + + /* Not displayed: + int unur_ninv_set_start( UNUR_PAR *parameters, double left, double right); + int unur_ninv_set_table(UNUR_PAR *parameters, int no_of_points); + */ + _unur_string_append(info,"\n"); + } + + + /* Hints */ + if (help) { + if (! (gen->set & NINV_SET_X_RESOLUTION) ) + _unur_string_append(info,"[ Hint: %s ]\n", + "You can increase accuracy by decreasing \"x_resolution\"."); + if (! (gen->set & NINV_SET_MAX_ITER) ) + _unur_string_append(info,"[ Hint: %s ]\n", + "You can increase \"max_iter\" if you encounter problems with accuracy."); + _unur_string_append(info,"\n"); + } + +} /* end of _unur_tdr_info() */ + + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/ninv_init.ch b/vendor/unuran-1.11.0/src/methods/ninv_init.ch new file mode 100644 index 0000000..ab86403 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/ninv_init.ch @@ -0,0 +1,478 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: ninv_init.ch * + * * + * Routines for initialization and deletion of generator objects. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2009 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_ninv_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* params pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + _unur_check_NULL( GENTYPE,par,NULL ); + + /* check input */ + if ( par->method != UNUR_METH_NINV ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_NINV_PAR,NULL); + + /* check variant */ + if (par->variant == NINV_VARFLAG_NEWTON && ! par->DISTR_IN.pdf) { + _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); + par->variant = NINV_VARFLAG_REGULA; /* use regula falsi instead */ + } + + /* create a new empty generator object */ + gen = _unur_ninv_create(par); + _unur_par_free(par); + if (!gen) { return NULL; } + + /* check parameters */ + if (_unur_ninv_check_par(gen) != UNUR_SUCCESS) { + _unur_ninv_free(gen); return NULL; + } + + /* compute starting points for numerical inversion */ + if (GEN->table_on) { + /* use a table */ + if (_unur_ninv_create_table(gen)!=UNUR_SUCCESS) { + _unur_ninv_free(gen); return NULL; + } + } + else { + /* use given points or percentiles */ + if (_unur_ninv_compute_start(gen)!=UNUR_SUCCESS) { + _unur_ninv_free(gen); return NULL; + } + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_ninv_debug_init(gen); +#endif + + return gen; + +} /* end of _unur_ninv_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_ninv_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int rcode; + + /* check parameters */ + if ( (rcode = _unur_ninv_check_par(gen)) != UNUR_SUCCESS) + return rcode; + + /* compute normalization constant for standard distribution */ + if (DISTR.upd_area != NULL) + if ((DISTR.upd_area)(gen->distr)!=UNUR_SUCCESS) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"cannot compute normalization constant"); + return UNUR_ERR_GEN_DATA; + } + + /* regenerate table */ + if (GEN->table != NULL) + rcode = _unur_ninv_create_table(gen); + + else /* or compute starting points */ + rcode = unur_ninv_chg_start( gen, 0., 0. ); + + /* (re)set sampling routine */ + SAMPLE = _unur_ninv_getSAMPLE(gen); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & NINV_DEBUG_REINIT) { + _unur_distr_cont_debug( gen->distr, gen->genid ); + if (rcode==UNUR_SUCCESS) _unur_ninv_debug_start( gen ); + } +#endif + + return UNUR_SUCCESS; +} /* end of _unur_ninv_reinit() */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen * +_unur_ninv_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_NINV_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_ninv_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_NINV_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_ninv_getSAMPLE(gen); + gen->destroy = _unur_ninv_free; + gen->clone = _unur_ninv_clone; + gen->reinit = _unur_ninv_reinit; + + /* copy parameters into generator object */ + GEN->max_iter = PAR->max_iter; /* maximal number of iterations */ + GEN->x_resolution = PAR->x_resolution; /* maximal tolerated relative x-error */ + GEN->u_resolution = PAR->u_resolution; /* maximal tolerated u-error */ + GEN->table_on = PAR->table_on; /* useage of table for starting points */ + GEN->table_size = PAR->table_size; /* number of points for table */ + GEN->s[0] = PAR->s[0]; /* starting points */ + GEN->s[1] = PAR->s[1]; + + /* init pointer */ + GEN->table = NULL; + GEN->f_table = NULL; + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_ninv_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_ninv_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_ninv_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* checking x-error or checking u-error must be enabled */ + if ( GEN->x_resolution < 0. && GEN->u_resolution < 0. ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"both x-resolution and u-resolution negativ. using defaults."); + GEN->x_resolution = 1.e-8; + } + + /* domain not truncated at init */ + DISTR.trunc[0] = DISTR.domain[0]; + DISTR.trunc[1] = DISTR.domain[1]; + + /* set bounds of U -- in respect to given bounds */ + GEN->CDFmin = GEN->Umin = (DISTR.trunc[0] > -UNUR_INFINITY) ? CDF(DISTR.trunc[0]) : 0.; + GEN->CDFmax = GEN->Umax = (DISTR.trunc[1] < UNUR_INFINITY) ? CDF(DISTR.trunc[1]) : 1.; + + if (_unur_FP_greater(GEN->CDFmin, GEN->CDFmax)) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"CDF not increasing"); + return UNUR_ERR_GEN_DATA; + } + + return UNUR_SUCCESS; +} /* end of _unur_ninv_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_ninv_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_ninv_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_NINV_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* copy additional data for generator object */ + if (GEN->table) { + CLONE->table = _unur_xmalloc( GEN->table_size * sizeof(double) ); + memcpy( CLONE->table, GEN->table, GEN->table_size * sizeof(double) ); + CLONE->f_table = _unur_xmalloc( GEN->table_size * sizeof(double) ); + memcpy( CLONE->f_table, GEN->f_table, GEN->table_size * sizeof(double) ); + } + + return clone; + +#undef CLONE +} /* end of _unur_ninv_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_ninv_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_NINV ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_NINV_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free tables */ + if (GEN->table) free(GEN->table); + if (GEN->f_table) free(GEN->f_table); + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_ninv_free() */ + + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_ninv_create_table( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* create a table for starting points and a table with */ + /* the corresponding function values */ + /* */ + /* parameters: */ + /* gen ... pointer generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + double x; + int table_size = GEN->table_size; + + /* check arguments */ + CHECK_NULL(gen, UNUR_ERR_NULL); + _unur_check_gen_object(gen, NINV, UNUR_ERR_GEN_INVALID); + + GEN->table = _unur_xrealloc( GEN->table, table_size * sizeof(double)); + GEN->f_table = _unur_xrealloc( GEN->f_table, table_size * sizeof(double)); + + /* get arbitrary points */ + GEN->s[0] = _unur_max( DISTR.domain[0], -10.); + GEN->s[1] = _unur_min( DISTR.domain[1], GEN->s[0]+20. ); + GEN->CDFs[0] = CDF(GEN->s[0]); + GEN->CDFs[1] = CDF(GEN->s[1]); + + /* table can't be used to calculate itself */ + GEN->table_on = FALSE; + + /* calculation of the tables */ + + /* left and right boundary */ + GEN->table[0] = DISTR.domain[0]; + GEN->f_table[0] = GEN->CDFmin; /* CDF(DISTR.domain[0]) */ + GEN->table[table_size-1] = DISTR.domain[1]; + GEN->f_table[table_size-1] = GEN->CDFmax; /* CDF(DISTR.domain[1]) */ + + /* all the other points. we compute these points from boundary to center */ + for (i=1; iCDFmin + i * (GEN->CDFmax - GEN->CDFmin) / (table_size-1.); + GEN->table[i] = _unur_ninv_regula(gen,x); + GEN->f_table[i] = CDF(GEN->table[i]); + + x = GEN->CDFmin + (table_size-i-1) * (GEN->CDFmax - GEN->CDFmin) / (table_size-1.); + GEN->table[table_size-1-i] = _unur_ninv_regula(gen,x); + GEN->f_table[table_size-1-i] = CDF(GEN->table[table_size-1-i]); + + /* set new starting points for computing table points in next step */ + if (GEN->table[i] > -UNUR_INFINITY) { + GEN->s[0] = GEN->table[i]; + GEN->CDFs[0] = GEN->f_table[i]; + } + if (GEN->table[table_size-1-i] < UNUR_INFINITY) { + GEN->s[1] = GEN->table[table_size-1-i]; + GEN->CDFs[1] = GEN->f_table[table_size-1-i]; + } + + } /* end of for() */ + + /* the median point (only if table_size is odd) */ + if (table_size & 1) { + x = GEN->CDFmin + (table_size/2) * (GEN->CDFmax - GEN->CDFmin) / (table_size-1.); + GEN->table[table_size/2] = _unur_ninv_regula(gen,x); + GEN->f_table[table_size/2] = CDF(GEN->table[table_size/2]); + } + + /* calculation of tables finished */ + + GEN->table_on = TRUE; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_ninv_create_table() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_ninv_compute_start( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* compute starting points for numerical inversion. */ + /* use 5% percentiles. */ + /* */ + /* parameters: */ + /* gen ... pointer generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double u; + + /* check arguments */ + CHECK_NULL(gen, UNUR_ERR_NULL); + _unur_check_gen_object(gen, NINV, UNUR_ERR_GEN_INVALID); + + if( GEN->table_on ) + /* we have a table --> nothing to do */ + return UNUR_SUCCESS; + + if( !_unur_FP_same(GEN->s[0],GEN->s[1]) ) { + /* use given starting points (indicated by s[0] != s[1]) --> nothing to do */ + GEN->CDFs[0] = CDF(GEN->s[0]); + GEN->CDFs[1] = CDF(GEN->s[1]); + return UNUR_SUCCESS; + } + + switch (gen->variant) { + + case NINV_VARFLAG_BISECT: + case NINV_VARFLAG_REGULA: + + /* get arbitrary points */ + GEN->s[0] = _unur_max( DISTR.domain[0], -10.); + GEN->s[1] = _unur_min( DISTR.domain[1], GEN->s[0]+20. ); + GEN->CDFs[0] = CDF(GEN->s[0]); + GEN->CDFs[1] = CDF(GEN->s[1]); + + /* left percentile */ + u = GEN->CDFmin + 0.5*(1.-INTERVAL_COVERS)*(GEN->CDFmax-GEN->CDFmin); + GEN->s[0] = _unur_ninv_regula(gen,u); + GEN->CDFs[0] = CDF(GEN->s[0]); + + /* right percentile */ + GEN->s[1] = _unur_min( DISTR.domain[1], GEN->s[0]+20. ); + u = GEN->CDFmin + 0.5*(1.+INTERVAL_COVERS)*(GEN->CDFmax-GEN->CDFmin); + GEN->s[1] = _unur_ninv_regula(gen,u); + GEN->CDFs[1] = CDF(GEN->s[1]); + + break; /* case REGULA end */ + + case NINV_VARFLAG_NEWTON: + + /* get arbitrary points */ + GEN->s[0] = _unur_max( DISTR.domain[0], -9.987655 ); + GEN->s[1] = _unur_min( DISTR.domain[1], GEN->s[0]+20. ); + GEN->CDFs[0] = CDF(GEN->s[0]); + GEN->CDFs[1] = CDF(GEN->s[1]); + + /* median */ + u = 0.5 * (GEN->CDFmin + GEN->CDFmax); + GEN->s[0] = _unur_ninv_regula(gen, u); /* reglua more stable */ + GEN->CDFs[0] = CDF(GEN->s[0]); + + break; /* case NEWTON end */ + + default: + + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + + } /* end of switch */ + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_ninv_compute_start() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/ninv_newset.ch b/vendor/unuran-1.11.0/src/methods/ninv_newset.ch new file mode 100644 index 0000000..ae0661b --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/ninv_newset.ch @@ -0,0 +1,632 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: ninv_newset.ch * + * * + * Routines for creating and changing parameter objects. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2009 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_ninv_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + + if (DISTR_IN.cdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"CDF"); return NULL; } + + /* if default variant is Newton's method, then we also need the PDF ! */ + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_ninv_par) ); + COOKIE_SET(par,CK_NINV_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->max_iter = 100; /* maximal number of iterations */ + PAR->x_resolution = 1.0e-8; /* maximal tolerated relative x-error */ + PAR->u_resolution = -1.; /* maximal tolerated u-error -- DISABLED */ + + /* starting points for numerical inversion */ + PAR->s[0] = 0.0; /* regula falsi: left boundary of starting interval + newton: starting point */ + PAR->s[1] = 0.0; /* regula falsi: right boundary of starting interval + newton: not used */ + /* If s1 and s2 are equal a defaults are used, see below */ + + PAR->table_on = FALSE; /* Do not use a table for starting points + by default. */ + + par->method = UNUR_METH_NINV; /* method and default variant */ + par->variant = NINV_VARFLAG_REGULA; /* Use regula falsi as default + method */ + + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_ninv_init; + + return par; + +} /* end of unur_ninv_new() */ + +/*****************************************************************************/ + +int +unur_ninv_set_usenewton( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* use Newton's method */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, NINV ); + + /* check new parameter for generator */ + if (! par->DISTR_IN.pdf) { + _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); + par->variant = NINV_VARFLAG_REGULA; /* use regula falsi instead */ + return UNUR_ERR_DISTR_REQUIRED; + } + + /* store date */ + par->variant = NINV_VARFLAG_NEWTON; + + return UNUR_SUCCESS; + +} /* end of unur_ninv_set_usenewton() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ninv_set_useregula( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* use regula falsi */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, NINV ); + + /* store date */ + par->variant = NINV_VARFLAG_REGULA; + + return UNUR_SUCCESS; + +} /* end of unur_ninv_set_useregula() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ninv_set_usebisect( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* use bisection method */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, NINV ); + + /* store date */ + par->variant = NINV_VARFLAG_BISECT; + + return UNUR_SUCCESS; + +} /* end of unur_ninv_set_usebisect() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ninv_set_max_iter( struct unur_par *par, int max_iter ) + /*----------------------------------------------------------------------*/ + /* set number of maximal iterations */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* max_iter ... number of maximal iterations */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, NINV ); + + /* check new parameter for generator */ + if (max_iter < 1) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"maximal iterations"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->max_iter = max_iter; + + /* changelog */ + par->set |= NINV_SET_MAX_ITER; + + return UNUR_SUCCESS; + +} /* end of unur_ninv_set_max_iter() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ninv_chg_max_iter( struct unur_gen *gen, int max_iter ) + /*----------------------------------------------------------------------*/ + /* change number of maximal iterations */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* max_iter ... number of maximal iterations */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(gen, UNUR_ERR_NULL); + _unur_check_gen_object( gen, NINV, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (max_iter < 1) { + _unur_warning(gen->genid, UNUR_ERR_PAR_SET, "maximal iterations"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + GEN->max_iter = max_iter; + + /* changelog */ + gen->set |= NINV_SET_MAX_ITER; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_ninv_chg_max_iter() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ninv_set_x_resolution( struct unur_par *par, double x_resolution ) + /*----------------------------------------------------------------------*/ + /* set maximal tolerated relative x-error */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object*/ + /* x_resolution ... x-error */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, NINV ); + + /* check new parameter for generator */ + if (x_resolution > 0. && x_resolution < 2.*DBL_EPSILON) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"x-resolution too small"); + x_resolution = 2.*DBL_EPSILON; + } + + /* store date */ + PAR->x_resolution = x_resolution; + + /* changelog */ + par->set |= NINV_SET_X_RESOLUTION; + + return UNUR_SUCCESS; + +} /* end of unur_ninv_set_x_resolutuion() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ninv_chg_x_resolution( struct unur_gen *gen, double x_resolution ) + /*----------------------------------------------------------------------*/ + /* set maximal tolerated relative x-error */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* x_resolution ... x-error */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(gen, UNUR_ERR_NULL); + _unur_check_gen_object( gen, NINV, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (x_resolution > 0. && x_resolution < DBL_EPSILON) { + _unur_warning(gen->genid,UNUR_ERR_PAR_SET,"x-resolution too small"); + x_resolution = 2.*DBL_EPSILON; + } + + /* store date */ + GEN->x_resolution = x_resolution; + + /* changelog */ + gen->set |= NINV_SET_X_RESOLUTION; + + return UNUR_SUCCESS; + +} /* end of unur_ninv_chg_x_resolutuion() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ninv_set_u_resolution( struct unur_par *par, double u_resolution ) + /*----------------------------------------------------------------------*/ + /* set maximal tolerated u-error */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object*/ + /* u_resolution ... u-error */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, NINV ); + + /* check new parameter for generator */ + if (u_resolution > 0. && u_resolution < 5*DBL_EPSILON) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"u-resolution too small"); + u_resolution = 1.e-15; + } + + /* store date */ + PAR->u_resolution = u_resolution; + + /* changelog */ + par->set |= NINV_SET_U_RESOLUTION; + + return UNUR_SUCCESS; + +} /* end of unur_ninv_set_u_resolutuion() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ninv_chg_u_resolution( struct unur_gen *gen, double u_resolution ) + /*----------------------------------------------------------------------*/ + /* set maximal tolerated u-error */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* u_resolution ... u-error */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(gen, UNUR_ERR_NULL); + _unur_check_gen_object( gen, NINV, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (u_resolution > 0. && u_resolution < 5*DBL_EPSILON) { + _unur_warning(gen->genid,UNUR_ERR_PAR_SET,"u-resolution too small"); + u_resolution = 1.e-15; + } + + /* store date */ + GEN->u_resolution = u_resolution; + + /* changelog */ + gen->set |= NINV_SET_U_RESOLUTION; + + return UNUR_SUCCESS; + +} /* end of unur_ninv_chg_u_resolutuion() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ninv_set_start( struct unur_par *par, double s1, double s2 ) + /*----------------------------------------------------------------------*/ + /* set starting points. */ + /* Newton: s1 starting point */ + /* other methods: s1, s2 boundary of starting interval */ + /* arguments that are not used by method are ignored. */ + /* */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* s1 ... left starting point */ + /* s2 ... right starting point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, NINV ); + + /* store date */ + if ( s1 <= s2 ) { + PAR->s[0] = s1; + PAR->s[1] = s2; + } + else { + PAR->s[0] = s2; + PAR->s[1] = s1; + } + + /* changelog */ + par->set |= NINV_SET_START; + + return UNUR_SUCCESS; + +} /* end of unur_ninv_set_start() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ninv_chg_start( struct unur_gen *gen, double s1, double s2 ) + /*----------------------------------------------------------------------*/ + /* set starting points. */ + /* Newton: s1 starting point */ + /* regular falsi: s1, s2 boundary of starting interval */ + /* arguments that are used by method are ignored. */ + /* */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* s1 ... left starting point */ + /* s2 ... right starting point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(gen, UNUR_ERR_NULL); + _unur_check_gen_object( gen, NINV, UNUR_ERR_GEN_INVALID ); + + /* store date */ + if ( s1 <= s2 ) { + GEN->s[0] = s1; + GEN->s[1] = s2; + } + else { + GEN->s[0] = s2; + GEN->s[1] = s1; + } + + /* disable table (we now want to use only two starting points) */ + GEN->table_on = FALSE; + + /* compute these points */ + _unur_ninv_compute_start(gen); + /* this call should not fail */ + + /* changelog */ + gen->set |= NINV_SET_START; + + return UNUR_SUCCESS; + +} /* end of unur_ninv_chg_start() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ninv_set_table( struct unur_par *par, int tbl_pnts ) + /*----------------------------------------------------------------------*/ + /* if used, a table is generated to find better startig points */ + /* the function unur_ninv_set_start() is overruled */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* tbl_pnts ... number of table points */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, NINV ); + + PAR->table_size = (tbl_pnts >= 10) ? tbl_pnts : 10; + PAR->table_on = TRUE; + + return UNUR_SUCCESS; + +} /* end of unur_ninv_set_table() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ninv_chg_table( struct unur_gen *gen, int tbl_pnts ) + /*----------------------------------------------------------------------*/ + /* if used, a table is generated to find better startig points */ + /* set somewhere else will be ignored */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* tbl_pnts ... number of table points */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int result; + + /* check arguments */ + CHECK_NULL(gen, UNUR_ERR_NULL); + _unur_check_gen_object( gen, NINV, UNUR_ERR_GEN_INVALID ); + + /* free(GEN->table); not freed, because realloc() is used */ + /* free(GEN->f_table); not freed, because realloc() is used */ + GEN->table_size = (tbl_pnts >= 10) ? tbl_pnts : 10; + + result = _unur_ninv_create_table(gen); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & NINV_DEBUG_CHG) + if (result==UNUR_SUCCESS) _unur_ninv_debug_start( gen ); +#endif + + return result; + +} /* end of unur_ninv_chg_table() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ninv_chg_truncated( struct unur_gen *gen, double left, double right ) + /*----------------------------------------------------------------------*/ + /* change the left and right borders of the domain of the distribution */ + /* the new domain should not exceed the original domain given by */ + /* unur_distr_cont_set_domain(). Otherwise it is truncated. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* comment: */ + /* the new boundary points may be +/- UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double Umin, Umax; + + /* check arguments */ + CHECK_NULL(gen, UNUR_ERR_NULL); + _unur_check_gen_object( gen, NINV, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + /* (the truncated domain must be a subset of the domain) */ + if (left < DISTR.domain[0]) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain too large"); + left = DISTR.domain[0]; + } + if (right > DISTR.domain[1]) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain too large"); + right = DISTR.domain[1]; + } + + if (left >= right) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"domain, left >= right"); + return UNUR_ERR_DISTR_SET; + } + + /* set bounds of U -- in respect to given bounds */ + Umin = (left > -UNUR_INFINITY) ? CDF(left) : 0.; + Umax = (right < UNUR_INFINITY) ? CDF(right) : 1.; + + /* check result */ + if (Umin > Umax) { + /* this is a serios error that should not happen */ + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + } + + if (_unur_FP_equal(Umin,Umax)) { + /* CDF values very close */ + _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values very close"); + if (_unur_iszero(Umin) || _unur_FP_same(Umax,1.)) { + /* this is very bad */ + _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values at boundary points too close"); + return UNUR_ERR_DISTR_SET; + } + } + + /* copy new boundaries into generator object */ + DISTR.trunc[0] = left; + DISTR.trunc[1] = right; + GEN->Umin = Umin; + GEN->Umax = Umax; + + /* changelog */ + gen->distr->set |= UNUR_DISTR_SET_TRUNCATED; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & NINV_DEBUG_CHG) + _unur_ninv_debug_chg_truncated( gen ); +#endif + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_ninv_chg_truncated() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/ninv_newton.ch b/vendor/unuran-1.11.0/src/methods/ninv_newton.ch new file mode 100644 index 0000000..0eeddae --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/ninv_newton.ch @@ -0,0 +1,286 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: ninv_newton.ch * + * * + * Routines for Newton's root finding algorithm. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2009 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Neumaier A. (to be published): Introduction to numerical analysis, * + * Cambridge University Press * + * * + ***************************************************************************** + * * + * For a given U find X with F(X) - U = 0. * + * * + * Method: damped Newton method. * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Newton method **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Constants */ + +/* maximal number of steps to leave flat region */ +#define MAX_FLAT_COUNT (40) + +/*---------------------------------------------------------------------------*/ + +double +_unur_ninv_newton( const struct unur_gen *gen, double U ) + /*----------------------------------------------------------------------*/ + /* sample from generator (use Newton's method) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* U ... random number (uniform distribution) */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double x; /* point for netwon-iteration */ + double fx; /* cdf at x */ + double dfx; /* pdf at x */ + double fxabs; /* absolute valuo of fx */ + double xtmp, fxtmp; /* temprary variables for x and fx */ + double xold; /* remember last values for stopping criterion */ + double fxtmpabs; /* fabs of fxtmp */ + double damp; /* damping factor */ + double step; /* helps to escape from flat regions of the cdf */ + int i; /* counter for for-loop, index */ + int flat_count; /* counter of steps in flat region */ + double rel_u_resolution; /* relative u resolution */ + int x_goal, u_goal; /* whether precision goal is reached */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_NINV_GEN,UNUR_INFINITY); + + /* compute relative u resolution */ + rel_u_resolution = ( (GEN->u_resolution > 0.) ? + (GEN->Umax - GEN->Umin) * GEN->u_resolution : + UNUR_INFINITY ); + + /* -- 1. initialize starting interval -- */ + + if (GEN->table_on) { + /* -- 1a. use table -- */ + + /* 0 <= i <= table_size-2 */ + if ( _unur_FP_same(GEN->CDFmin,GEN->CDFmax) ) { + /* CDF values in table too close, so we use median point since */ + /* there is no difference between CDF values. */ + i = GEN->table_size/2; + } + else { + i = (int) ( GEN->table_size * (U - GEN->CDFmin) / (GEN->CDFmax - GEN->CDFmin) ); + if (i<0) i = 0; + else if (i > GEN->table_size - 2) i = GEN->table_size - 2; + } + + if (_unur_FP_is_infinity(GEN->table[i+1])) { + x = GEN->table[i]; + fx = GEN->f_table[i]; + } + else { + x = GEN->table[i+1]; + fx = GEN->f_table[i+1]; + } + + } + + else { + /* 1b. -- no table available -- */ + x = GEN->s[0]; + fx = GEN->CDFs[0]; + } + + /* -- 1c. check for boundary of truncated domain -- */ + + if ( x < DISTR.trunc[0] ){ + x = DISTR.trunc[0]; + fx = GEN->Umin; /* = CDF(x) */ + } + else if ( x > DISTR.trunc[1] ){ + x = DISTR.trunc[1]; + fx = GEN->Umax; /* = CDF(x) */ + } + + /* -- 1z. compute values for starting point -- */ + + fx -= U; + dfx = PDF(x); + fxabs = fabs(fx); + xold = x; /* there is no old value yet */ + + damp = 2.; /* to be halved at least once */ + step = 1.; + + /* -- 2. Newton iteration -- */ + + for (i=0; i < GEN->max_iter; i++) { + + flat_count = 0; + while (_unur_iszero(dfx)) { /* function flat at x */ + /* printf("step: %g, x: %g, fx: %g, dfx: %g\n",step, x, fx, dfx); */ + + if (_unur_iszero(fx)) /* exact hit -> leave while-loop */ + break; + + if (fx > 0.) { /* try another x */ + xtmp = x - step; + xtmp = _unur_max( xtmp, DISTR.domain[0] ); + } + else { + xtmp = x + step; + xtmp = _unur_min( xtmp, DISTR.domain[1] ); + } + + fxtmp = CDF(xtmp) - U; + fxtmpabs = fabs(fxtmp); + + if ( fxtmpabs < fxabs ) { /* improvement, update x */ + /* printf("fxabs: %g tmpabs: %g\n", fxabs, fxtmpabs); */ + step = 1.; /* set back stepsize */ + x = xtmp; + fx = fxtmp; + } + else if ( fxtmp*fx < 0. ) { /* step was too large, don't update x */ + step /= 2.; + } + else { /* step was too short, update x */ + step *= 2.; + x = xtmp; + fx = fxtmp; + } + + dfx = PDF(x); + fxabs = fabs(fx); + + if (flat_count < MAX_FLAT_COUNT) + flat_count++; + else { + _unur_error(gen->genid,UNUR_ERR_GEN_SAMPLING, + "Newton's method cannot leave flat region"); + x = _unur_max( x, DISTR.trunc[0]); + x = _unur_min( x, DISTR.trunc[1]); + return x; + } + } /* end of while-loop, (leaving flat region) */ + + step = 1.; /* set back stepsize */ + + if (_unur_iszero(fx)) /* exact hit -> finished */ + break; + + + if (_unur_isfinite(dfx)) { + do { /* newton-step (damped if nececcary) */ + damp /= 2.; + xtmp = x - damp * fx/dfx; + /* make sure that new point is inside (truncated) domain */ + xtmp = _unur_min( xtmp, DISTR.trunc[1] ); + xtmp = _unur_max( xtmp, DISTR.trunc[0] ); + fxtmp = CDF(xtmp) - U; + } while (fabs(fxtmp) > fxabs * (1.+UNUR_SQRT_DBL_EPSILON)); /* no improvement */ + } + else { + /* we cannot use Newton's rule if the derivative is not finite. */ + /* this happens when we hit a pole of the PDF. */ + /* use a bisection step instead. */ + xtmp = 0.5*(x + xold); + fxtmp = CDF(xtmp) - U; + } + + /* updation variables according to newton-step */ + damp = 2.; /* set back factor for damping */ + xold = x; /* remember last value of x */ + x = xtmp; /* update x */ + fx = fxtmp; /* update function value at x */ + dfx = PDF(x); /* update derivative sof fx at x */ + fxabs = fabs(fx); /* update absolute value of fx */ + + /* -- 2z. check stopping criterions -- */ + + if ( GEN->x_resolution > 0. ) { + /* check x-error */ + /* we use a combination of absolute and relative x-error: */ + /* x-error < x-resolution * fabs(x) + x-resolution^2 */ + if ( _unur_iszero(fx) || /* exact hit */ + fabs(x-xold) < GEN->x_resolution * (fabs(x) + GEN->x_resolution) ) { + x_goal = TRUE; + } + else + x_goal = FALSE; + } + else { + /* no check */ + x_goal = TRUE; + } + + if ( GEN->u_resolution > 0. ) { + /* check u-error */ + /* (we use a slightly smaller maximal tolerated error than given by user) */ + if ( fabs(fx) < 0.9 * rel_u_resolution ) { /* relative u resolution */ + u_goal = TRUE; + } + else if ( _unur_FP_same(xold, x) ) { + /* sharp peak or pole */ + _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING, + "sharp peak or pole: accuracy goal in u cannot be reached"); + u_goal = TRUE; + } + else + u_goal = FALSE; + + } + else { + u_goal = TRUE; + } + + /* goal reached ? */ + if (x_goal && u_goal) + /*finished*/ + break; + } /* end of for-loop (MAXITER reached -> finished) */ + + + if (i >= GEN->max_iter) + _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING, + "max number of iterations exceeded: accuracy goal might not be reached"); + + /* make sure that result is within boundaries of (truncated) domain */ + x = _unur_max( x, DISTR.trunc[0]); + x = _unur_min( x, DISTR.trunc[1]); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file (in case error) */ + if (gen->debug & NINV_DEBUG_SAMPLE) + _unur_ninv_debug_sample(gen, U, x, fx, i); +#endif + + return x; + +} /* end of _unur_ninv_sample_newton() */ + +/*---------------------------------------------------------------------------*/ + +#undef MAX_FLAT_COUNT + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/ninv_regula.ch b/vendor/unuran-1.11.0/src/methods/ninv_regula.ch new file mode 100644 index 0000000..d7bd95c --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/ninv_regula.ch @@ -0,0 +1,512 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: ninv_regula.ch * + * * + * Routines for regula falsi root finding algorithm. c * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2009 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + ***************************************************************************** + * * + + * * + ***************************************************************************** + * * + * For a given U find X with F(X) - U = 0. * + * * + * Method: stabilized regula falsi preserving sign change; * + * bisection if slow convergence is detected. * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Regula falsi **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Constants */ + +/* maximum number of steps to find sign change in Regula Falsi */ +#define MAX_STEPS (100) + +/* STEPFAC* (s[1]-s[0]) is used as first step length for finding sign change */ +#define STEPFAC (0.4) + +/* for #steps > I_CHANGE_TO_BISEC Regula Falsi is always replaced by bisection*/ +#define I_CHANGE_TO_BISEC (50) + +/*---------------------------------------------------------------------------*/ + +double +_unur_ninv_regula( const struct unur_gen *gen, double u ) + /*---------------------------------------------------------------------*/ + /* algorithm: regula falsi with bisection steps */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* u ... random number (uniform distribution) */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /* */ + /* Remark: */ + /* The routine computes the root of CDF(x)-u */ + /* */ + /* Reference: */ + /* [1] Neumaier A. (to be published): */ + /* Introduction to numerical analysis, */ + /* Cambridge University Press */ + /*---------------------------------------------------------------------*/ +{ + double x1, x2, a, xtmp;/* points for regular falsi */ + double f1, f2,fa, ftmp;/* function values at x1, x2, xtmp */ + double length; /* oriented length of the interval with sign change*/ + double lengthabs; /* absolute length of interval */ + double lengthsgn; /* orientation of the Intervalls */ + double dx; /* RF-stepsize */ + int count_nosc = 0; /* counter for "no sign change occured" */ + int i; /* loop variable, index */ + double min_step_size; /* minimal step size for regula falsi */ + double rel_u_resolution; /* relative u resolution */ + + /* check arguments */ + CHECK_NULL(gen, UNUR_INFINITY); COOKIE_CHECK(gen, CK_NINV_GEN, UNUR_INFINITY); + + /* compute relative u resolution */ + rel_u_resolution = ( (GEN->u_resolution > 0.) ? + (GEN->Umax - GEN->Umin) * GEN->u_resolution : + UNUR_INFINITY ); + + /* -- 1. + 2. find bracket -- */ + + if ( _unur_ninv_bracket( gen, u, &x1, &f1, &x2, &f2 ) + != UNUR_SUCCESS ) + return x2; + + /* sign changes always within [a, x2] */ + a = x1; fa = f1; + + /* -- 3. secant step, preserve sign change -- */ + + /* secant step, preserve sign change */ + for (i=0; TRUE; i++) { + + /* -- 3a. check sign of f1 and f2 -- */ + + if ( f1*f2 < 0.) { + /* sign change found */ + count_nosc = 0; /* reset counter */ + /* f2 always less (better), otherwise exchange */ + if ( fabs(f1) < fabs(f2) ) { + xtmp = x1; ftmp = f1; + x1 = x2; f1 = f2; + x2 = xtmp; f2 = ftmp; + } + /* sign changes within [a, x2] */ + a = x1; fa = f1; + } + else { + /* increment counter for "no sign change occured" */ + count_nosc++; + /* must not update 'a' */ + } + + /* length of enclosing bracket */ + length = x2 - a; /* oriented length */ + lengthabs = fabs(length); /* absolute length */ + lengthsgn = (length < 0.) ? -1. : 1.; + + /* -- 3b. check stopping criterion -- */ + + /* check accuracy goal */ + if (_unur_ninv_accuracy( gen, GEN->x_resolution, rel_u_resolution, + x2, f2, a, fa )) + break; + + if (i >= GEN->max_iter) + /* maximum number of iterations reached --> abort */ + break; + + /* -- 3c. try secant step -- */ + + /* step size: secant or bisection step */ + dx = (_unur_FP_same(f1,f2)) ? length/2. : f2*(x2-x1)/(f2-f1) ; + + /* minimal step size */ + if (GEN->u_resolution < 0.) + /* we only look at the x-error, so we do not need shorter steps */ + min_step_size = fabs(x2) * GEN->x_resolution; + else + min_step_size = lengthabs * DBL_EPSILON; + + if ( fabs(dx) < min_step_size ) { + dx = lengthsgn * 0.99 * min_step_size; + + while ( x2 == x2 - dx ){ /* dx too small */ + if ( dx != 2.*dx) /* near limit of calculations */ + dx = 2.*dx; + else + dx = length/2.; /* bisection step */ + } + } + + /* bisection step if: */ + /* no sign change || step leads out of interval */ + if ( count_nosc > 1 || i > I_CHANGE_TO_BISEC || + (lengthabs-GEN->x_resolution*fabs(x2))/(dx*lengthsgn) <= 1. ) + dx = length/2.; /* bisection step */ + + /* -- 3c. update point -- */ + x1 = x2; f1 = f2; + x2 = x2-dx; f2 = CDF(x2) - u; + + } /* end of for-loop */ + + if (i >= GEN->max_iter) + _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING, + "max number of iterations exceeded: accuracy goal might not be reached"); + + /* ensure location within given (truncated) domain */ + x2 = _unur_max( x2, DISTR.trunc[0]); + x2 = _unur_min( x2, DISTR.trunc[1]); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file (in case error) */ + if (gen->debug & NINV_DEBUG_SAMPLE) + _unur_ninv_debug_sample( gen,u,x2,f2,i ); +#endif + + /* finished */ + return x2; + +} /* end of _unur_ninv_regula() */ + +/*****************************************************************************/ +/** Bisection method **/ +/*****************************************************************************/ + +double +_unur_ninv_bisect( const struct unur_gen *gen, double u ) + /*---------------------------------------------------------------------*/ + /* algorithm: bisection method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* u ... random number (uniform distribution) */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /* */ + /* Remark: */ + /* The routine computes the root of CDF(x)-u */ + /* */ + /* References: */ + /* [2] Dahlquist, G. and Bj{\"o}rck, {\AA} (2008): */ + /* Numerical methods in scientific computing, Vol 1., */ + /* SIAM, Philadelphia, PA. */ + /*---------------------------------------------------------------------*/ +{ + double x1, x2, mid=0.; /* boundary points and mid point of bracket */ + double f1, f2, fmid; /* function values at x1, x2, and mid */ + int i; /* loop variable, number of iterations */ + double rel_u_resolution; /* relative u resolution */ + + /* check arguments */ + CHECK_NULL(gen, UNUR_INFINITY); COOKIE_CHECK(gen, CK_NINV_GEN, UNUR_INFINITY); + + /* compute relative u resolution */ + rel_u_resolution = ( (GEN->u_resolution > 0.) ? + (GEN->Umax - GEN->Umin) * GEN->u_resolution : + UNUR_INFINITY ); + + /* -- 1. + 2. find bracket -- */ + + if ( _unur_ninv_bracket( gen, u, &x1, &f1, &x2, &f2 ) + != UNUR_SUCCESS ) + return x2; + + /* -- 3. bisection steps */ + for (i=0; imax_iter; i++) { + /* compute new point */ + mid = x1 + (x2-x1)/2.; + fmid = CDF(mid) - u; + + /* update point */ + if (f1*fmid <= 0) { + /* keep left endpoint x1 */ + x2 = mid; f2 = fmid; + /* check accuracy goal */ + if (_unur_ninv_accuracy( gen, GEN->x_resolution, rel_u_resolution, + mid, fmid, x1, f1 )) + break; + } + else { + /* keep right endpoint x2 */ + x1 = mid; f1 = fmid; + /* check accuracy goal */ + if (_unur_ninv_accuracy( gen, GEN->x_resolution, rel_u_resolution, + mid, fmid, x2, f2 )) + break; + } + } + + if (i >= GEN->max_iter) + _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING, + "max number of iterations exceeded: accuracy goal might not be reached"); + + /* the text book algorithms usually add one more step: */ + /* mid = x1 + (x2-x1)/2.; */ + /* however, this causes problems when the maximal tolerated u-error */ + /* has to be ensured! */ + + /* ensure location within given (truncated) domain */ + mid = _unur_max( mid, DISTR.trunc[0]); + mid = _unur_min( mid, DISTR.trunc[1]); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file (in case error) */ + if (gen->debug & NINV_DEBUG_SAMPLE) + _unur_ninv_debug_sample( gen,u,mid,CDF(mid)-u,i ); +#endif + + /* finished */ + return mid; + +} /* end of _unur_ninv_bisect() */ + + +/*****************************************************************************/ +/** Auxiliary routines **/ +/*****************************************************************************/ + +int +_unur_ninv_bracket( const struct unur_gen *gen, double u, + double *xl, double *fl, double *xu, double *fu ) + /*----------------------------------------------------------------------*/ + /* find a bracket (enclosing interval) for root of CDF(x)-u. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* u ... random number (uniform distribution) */ + /* xl, xu ... store lower and upper boundary of bracket */ + /* fl, fu ... store values of CDF(x)-u at xl and xu, resp. */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* error: */ + /* *fu is set to "best" result */ + /*----------------------------------------------------------------------*/ +{ + int i; /* loop variable, index */ + double x1, x2, xtmp; /* points for bracket */ + double f1, f2; /* function values at x1, x2 */ + double step; /* enlarges interval til sign change found */ + int step_count; /* counts number of steps finding sign change */ + + /* -- 1. initialize starting interval -- */ + + if (GEN->table_on) { + /* -- 1a. use table -- */ + + /* 0 <= i <= table_size-2 */ + if ( _unur_FP_same(GEN->CDFmin, GEN->CDFmax) ) { + /* CDF values in table too close, so we use median point since */ + /* there is no difference between CDF values. */ + i = GEN->table_size/2; + } + else { + i = (int) ( GEN->table_size * (u - GEN->CDFmin) / (GEN->CDFmax - GEN->CDFmin) ); + if (i<0) i = 0; + else if (i > GEN->table_size - 2) i = GEN->table_size - 2; + } + + /* set starting point for regular falsi */ + if ( ! _unur_FP_is_minus_infinity(GEN->table[i]) ){ + x1 = GEN->table[i]; + f1 = GEN->f_table[i]; + } + else{ + x1 = GEN->table[i+1] + (GEN->table[i+1] - GEN->table[i+2]); + f1 = CDF(x1); + } + + if( ! _unur_FP_is_infinity(GEN->table[i+1]) ){ + x2 = GEN->table[i+1]; + f2 = GEN->f_table[i+1]; + } + else{ + x2 = GEN->table[i] + (GEN->table[i] - GEN->table[i-1]); + f2 = CDF(x2); + } + } + + else { + /* 1b. -- no table available -- */ + x1 = GEN->s[0]; /* left boudary of interval */ + f1 = GEN->CDFs[0]; + x2 = GEN->s[1]; /* right boudary of interval*/ + f2 = GEN->CDFs[1]; + } + + /* -- 1c. check for ordering of starting points -- */ + + if ( x1 >= x2 ) { + xtmp = x1; + x1 = x2; f1 = f2; + x2 = xtmp + fabs(xtmp)*DBL_EPSILON; + f2 = CDF(x2); + } + + /* -- 1d. check for boundary of truncated domain -- */ + + /* in case of truncated domain there might be better starting points */ + /* ! no problems with UNUR_INFINITY ! */ + if ( x1 < DISTR.trunc[0] || x1 >= DISTR.trunc[1] ){ + x1 = DISTR.trunc[0]; + f1 = GEN->Umin; /* = CDF(x1) */ + } + if ( x2 > DISTR.trunc[1] || x2 <= DISTR.trunc[0] ){ + x2 = DISTR.trunc[1]; + f2 = GEN->Umax; /* = CDF(x2) */ + } + + /* -- 1z. compute function values at interval boundaries -- */ + f1 -= u; f2 -= u; + + /* -- 2. search for enclosing bracket (interval where f changes signs) -- */ + + step = (GEN->s[1]-GEN->s[0]) * STEPFAC; + step_count = 0; + while ( f1*f2 > 0. ) { + /* interval too small -> make it bigger ( + 2^n * gap ) -- */ + if ( f1 > 0. ) { /* lower boundary too big */ + x2 = x1; + f2 = f1; + x1 -= step; + f1 = CDF(x1) - u; + } + else { /* upper boundary too small */ + x1 = x2; + f1 = f2; + x2 += step; + f2 = CDF(x2) - u; + } + + /* increase step width */ + if (step_count < MAX_STEPS) { + ++step_count; + step *= 2.; + /* safe guard for the case where (GEN->s[1]-GEN->s[0]) is very small*/ + if( step_count > 20 && step < 1.) step = 1.; + } + else { + _unur_error(gen->genid,UNUR_ERR_GEN_SAMPLING, + "Regula Falsi cannot find interval with sign change"); + *xu = (f1>0.) ? DISTR.trunc[0] : DISTR.trunc[1]; + return UNUR_ERR_GEN_SAMPLING; + } + } + + /* o.k. */ + *xl = x1; *xu = x2; + *fl = f1; *fu = f2; + + return UNUR_SUCCESS; + +} /* end of _unur_ninv_bracket() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_ninv_accuracy( const struct unur_gen *gen, + double x_resol, double u_resol, + double x0, double f0, double x1, double f1 ) + /*----------------------------------------------------------------------*/ + /* check accuracy goal for approximate root. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* x_resol ... maximal tolerated x-error */ + /* u_resol ... maximal tolerated u-error */ + /* x0 ... approximate point to be checked */ + /* f0 ... function value at x0 */ + /* x1 ... second boundary point of bracket */ + /* (i.e., function must change sign in interval [x0,x1]) */ + /* f1 ... function value at x1 */ + /* */ + /* return: */ + /* TRUE ... if accuracy goal is reached */ + /* FALSE ... otherwise */ + /*----------------------------------------------------------------------*/ +{ + int x_goal, u_goal; /* whether precision goal is reached */ + + if ( x_resol > 0. ) { + /* check x-error */ + /* we use a combination of absolute and relative x-error: */ + /* x-error < x-resolution * fabs(x) + x-resolution^2 */ + if ( _unur_iszero(f0) || /* exact hit */ + fabs(x1-x0) < x_resol * (fabs(x0) + x_resol) ) { + x_goal = TRUE; + } + else if ( _unur_FP_same(f0,f1) ) { + /* flat region */ + _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING, + "flat region: accuracy goal in x cannot be reached"); + x_goal = TRUE; + } + else + x_goal = FALSE; + } + else { + /* no check */ + x_goal = TRUE; + } + + if ( GEN->u_resolution > 0. ) { + /* check u-error */ + /* (we use a slightly smaller maximal tolerated error than given by user) */ + if (fabs(f0) < 0.9 * u_resol) { + u_goal = TRUE; + } + else if ( _unur_FP_same(x0,x1) ) { + /* sharp peak or pole */ + _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING, + "sharp peak or pole: accuracy goal in u cannot be reached"); + u_goal = TRUE; + } + else + u_goal = FALSE; + } + else { + u_goal = TRUE; + } + + /* return result */ + return (x_goal && u_goal); + +} /* end of _unur_ninv_accuracy() */ + +/*---------------------------------------------------------------------------*/ + +#undef MAX_STEPS +#undef STEPFAC +#undef I_CHANGE_TO_BISEC + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/methods/ninv_sample.ch b/vendor/unuran-1.11.0/src/methods/ninv_sample.ch new file mode 100644 index 0000000..c3e8440 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/ninv_sample.ch @@ -0,0 +1,134 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: ninv_sample.ch * + * * + * Sampling routines. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2009 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Sampling routines **/ +/*****************************************************************************/ + +double +_unur_ninv_sample_newton( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator (use newtons method) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /*----------------------------------------------------------------------*/ +{ + return _unur_ninv_newton( gen, + GEN->Umin + (_unur_call_urng(gen->urng)) * (GEN->Umax - GEN->Umin) ); +} + +/*---------------------------------------------------------------------------*/ + +double +_unur_ninv_sample_regula( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator (use regula falsi) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /*----------------------------------------------------------------------*/ +{ + return _unur_ninv_regula( gen, + GEN->Umin + (_unur_call_urng(gen->urng)) * (GEN->Umax - GEN->Umin) ); +} /* end of _unur_ninv_sample_regula() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_ninv_sample_bisect( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator (use bisection method) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /*----------------------------------------------------------------------*/ +{ + return _unur_ninv_bisect( gen, + GEN->Umin + (_unur_call_urng(gen->urng)) * (GEN->Umax - GEN->Umin) ); +} /* end of _unur_ninv_sample_bisect() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_ninv_eval_approxinvcdf( const struct unur_gen *gen, double u ) + /*----------------------------------------------------------------------*/ + /* get approximate value of inverse CDF at u approximately */ + /* (user call) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* u ... argument for inverse CDF (0<=u<=1) */ + /* */ + /* return: */ + /* double (approximate inverse CDF) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double x; + + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + if ( gen->method != UNUR_METH_NINV ) { + _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); + return UNUR_INFINITY; + } + COOKIE_CHECK(gen,CK_NINV_GEN,UNUR_INFINITY); + + if ( ! (u>0. && u<1.)) { + if ( ! (u>=0. && u<=1.)) { + _unur_warning(gen->genid,UNUR_ERR_DOMAIN,"U not in [0,1]"); + } + if (u<=0.) return DISTR.domain[0]; + if (u>=1.) return DISTR.domain[1]; + return u; /* = NaN */ + } + + /* compute inverse CDF */ + switch (gen->variant) { + case NINV_VARFLAG_NEWTON: + x = _unur_ninv_newton(gen,u); + break; + case NINV_VARFLAG_BISECT: + x = _unur_ninv_bisect(gen,u); + break; + case NINV_VARFLAG_REGULA: + default: + x = _unur_ninv_regula(gen,u); + break; + } + + /* validate range */ + if (xDISTR.domain[1]) x = DISTR.domain[1]; + + return x; + +} /* end of unur_hinv_eval_approxinvcdf() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/ninv_struct.h b/vendor/unuran-1.11.0/src/methods/ninv_struct.h new file mode 100644 index 0000000..1502bb9 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/ninv_struct.h @@ -0,0 +1,89 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: ninv_struct.h * + * * + * PURPOSE: * + * declares structures for method NINV * + * (Numerical INVersion of cumulative distribution function) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_ninv_par { + int max_iter; /* maximal number of iterations */ + double x_resolution; /* maximal tolerated relative x-error */ + double u_resolution; /* maximal tolerated (absolute) u-error */ + double s[2]; /* interval boundaries at start (left/right) */ + int table_on; /* if TRUE a table for starting points is used */ + int table_size; /* size of table */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_ninv_gen { + int max_iter; /* maximal number of iterations */ + double x_resolution; /* maximal tolerated relative x-error */ + double u_resolution; /* maximal tolerated (absolute) u-error */ + double *table; /* table with possible starting values for NINV */ + double *f_table; /* function values of points stored in table */ + int table_on; /* if TRUE a table for starting points is used */ + int table_size; /* size of table */ + double Umin, Umax; /* bounds for iid random variable in respect to + the given (truncated) domain of the distr. */ + double CDFmin, CDFmax; /* CDF-bounds of domain */ + double s[2]; /* interval boundaries at start (left/right) ...*/ + double CDFs[2]; /* ... and their CDF-values */ +}; + +/*---------------------------------------------------------------------------*/ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/unuran-1.11.0/src/methods/norta.c b/vendor/unuran-1.11.0/src/methods/norta.c new file mode 100644 index 0000000..4803933 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/norta.c @@ -0,0 +1,1004 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: norta.c * + * * + * TYPE: continuous multivariate random variate * + * METHOD: generates random vector with given covariance matrix and * + * given marginal distribution. * + * * + * DESCRIPTION: * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Hoermann, W., J. Leydold, and G. Derflinger (2004): * + * Automatic Nonuniform Random Variate Generation, Springer, Berlin. * + * * + * [2] Gosh, S. (????): Eigenvector Correction method * + * * + ***************************************************************************** + * * + * NORTA (NORmal to anything) is a model to get random vectors with * + * given marginal distributions and rank correlation. (Notice that this * + * does not uniquely define the multivariate distribution.) * + * * + * In the NORTA model multinormal random variates with the given * + * rank (Spearman's) correlations are generated. For this task the rank * + * correlations are transformed into the corresponding * + * (Pearson) correlation matrix and the VMT method is used to sample from * + * the resulting multinormal distribution (by means of the Cholesky * + * decomposition of the covariance matrix). * + * In a second step the (standard normal distributed) marginal variates * + * are transformed by means of the CDF of the normal distribution to get * + * uniform marginals. The resulting random vectors then have uniform * + * marginals and the desired rank correlation between its components. * + * Such a random vector is called 'copula'. * + * * + * By means of the inverse CDF the uniform marginals are transformed into * + * the target marginal distributions. This transformation does not change * + * the rank correlation. * + * * + * It can happen that the desired rank correlation matrix is not feasible, * + * i.e., it cannot occur as rank correlation matrix of a multinormal * + * distribution. For this case we use Gosh's "eigenvector correction * + * method" [2]. In this case a spectral decomposition of the corresponding * + * (Pearson) correlation matrix is carried out. If there are some * + * non-positive eigenvalues (i.e. this matrix is not a true correlation * + * matrix) then these are set to a small value and a new (positive * + * definite) correlation matrix is created and used. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen.h" +#include "x_gen_source.h" +#include "cstd.h" +#include "hinv.h" +#include "ninv.h" +#include "pinv.h" +#include "mvstd.h" +#include "norta.h" +#include "norta_struct.h" + +/*---------------------------------------------------------------------------*/ +/* Constants */ + +/* smallest eigenvalue allowed for correlation matrix */ +#define UNUR_NORTA_MIN_EIGENVALUE (1.e-10) + +/*---------------------------------------------------------------------------*/ +/* Variants */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define NORTA_DEBUG_SIGMA_Y 0x00000010u /* print sigma_y for normal */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "NORTA" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_norta_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_norta_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_norta_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_norta_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_norta_sample_cvec( struct unur_gen *gen, double *vec ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static int _unur_norta_nortu_setup( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Compute parameter for NORTU (normal to uniform). */ +/*---------------------------------------------------------------------------*/ + +static int _unur_norta_make_correlationmatrix( int dim, double *M); +/*---------------------------------------------------------------------------*/ +/* make correlation matrix by transforming symmetric positive definit matrix */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_norta_make_marginalgen( const struct unur_gen *gen, + const struct unur_distr *marginal ); +/*---------------------------------------------------------------------------*/ +/* make generator for marginal distribution */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_norta_debug_init( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_norta_debug_sigma_y( const struct unur_gen *gen, + const double *sigma_y, + const char *comment ); +/*---------------------------------------------------------------------------*/ +/* print sigma_y of corresponding normal distribution. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_norta_debug_eigensystem( const struct unur_gen *gen, + const double *eigenvalues, + const double *eigenvectors ); +/*---------------------------------------------------------------------------*/ +/* print eigensystem of sigma_y. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_norta_debug_nmgenerator( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print genid of multinormal generator. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_norta_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cvec /* data for distribution object */ + +#define PAR ((struct unur_norta_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_norta_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cvec /* data for distribution in generator object */ + +#define SAMPLE gen->sample.cvec /* pointer to sampling routine */ + +#define MNORMAL gen->gen_aux /* pointer to multinormal generator */ + +/*---------------------------------------------------------------------------*/ + +#define _unur_norta_getSAMPLE(gen) (_unur_norta_sample_cvec) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_norta_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CVEC) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); + return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CVEC,NULL); + + if (!(distr->set & UNUR_DISTR_SET_RANKCORR)) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"rank correlation matrix"); + return NULL; } + + if (!(distr->set & UNUR_DISTR_SET_MARGINAL)) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"marginals"); + return NULL; } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_norta_par) ); + COOKIE_SET(par,CK_NORTA_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + par->method = UNUR_METH_NORTA ; /* method */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_norta_init; + + return par; + +} /* end of unur_norta_new() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_norta_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + _unur_check_NULL( GENTYPE,par,NULL ); + + /* check input */ + if ( par->method != UNUR_METH_NORTA ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_NORTA_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_norta_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* check for truncated domain */ + if ( gen->distr->set & UNUR_DISTR_SET_DOMAINBOUNDED ) { + if ( DISTR.domainrect == NULL ) { + /* cannot handle non-rectangular domain */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot handle non-rectangular domain"); + _unur_norta_free(gen); return NULL; + } + else { /* rectangular domain */ + if (_unur_distr_cvec_marginals_are_equal(DISTR.marginals, GEN->dim)) { + /* we have to handle these equal marginal distributions independently */ + if ( _unur_distr_cvec_duplicate_firstmarginal(gen->distr) != UNUR_SUCCESS ) { + _unur_norta_free(gen); return NULL; + } + } + } + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_norta_debug_init(gen); +#endif + + /* compute parameters for NORTU (normal to uniform) */ + if (_unur_norta_nortu_setup(gen) != UNUR_SUCCESS) { + _unur_norta_free(gen); return NULL; + } + + /* distribution object for standard normal distribution */ + GEN->normaldistr = unur_distr_normal(NULL,0); + + if (gen->distr->id != UNUR_DISTR_COPULA) { + /* we have to initialize generator for marginal distributions */ + + if (_unur_distr_cvec_marginals_are_equal(DISTR.marginals, GEN->dim)) { + /* we can use the same generator object for all marginal distribuitons */ + struct unur_gen *marginalgen = _unur_norta_make_marginalgen( gen, DISTR.marginals[0] ); + if (marginalgen) + GEN->marginalgen_list = _unur_gen_list_set(marginalgen,GEN->dim); + } + + else { + /* we need different generator objects for all marginal distribuitons */ + int i,j; + int failed = FALSE; + struct unur_gen **marginalgens = _unur_xmalloc( GEN->dim * sizeof(struct unur_gen*) ); + + /* check for truncated domain */ + if ( gen->distr->set & UNUR_DISTR_SET_DOMAINBOUNDED ) { + /* set domains for each marginal distribution */ + for (i=0; idim && !failed; i++) { + if ( (unur_distr_cont_set_domain(DISTR.marginals[i], + DISTR.domainrect[2*i], DISTR.domainrect[2*i+1])) + != UNUR_SUCCESS) { + failed = TRUE; break; + } + } + } + + /* create generator for each marginal distribution */ + for (i=0; idim && !failed; i++) { + marginalgens[i] = _unur_norta_make_marginalgen( gen, DISTR.marginals[i] ); + if (marginalgens[i]==NULL) { + failed=TRUE; break; + } + } + + /* check creating of generators */ + if (failed) { + for (j=0; jmarginalgen_list = marginalgens; + } + + /* verify initialization of marginal generators */ + if (GEN->marginalgen_list == NULL) { + _unur_error(gen->genid,UNUR_ERR_GENERIC,"init of marginal generators failed"); + _unur_norta_free(gen); + return NULL; + } + } + + /* o.k. */ + return gen; + +} /* end of _unur_norta_init() */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen * +_unur_norta_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_NORTA_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_norta_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_NORTA_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_norta_getSAMPLE(gen); + gen->destroy = _unur_norta_free; + gen->clone = _unur_norta_clone; + + /* dimension of distribution */ + GEN->dim = gen->distr->dim; + + /* allocate array for auxiliary copula */ + GEN->copula = _unur_xmalloc(sizeof(double)*GEN->dim); + + /* initialize pointer */ + MNORMAL = NULL; + GEN->normaldistr = NULL; + GEN->marginalgen_list = NULL; + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_norta_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_norta_create() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_norta_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_norta_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_NORTA_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* allocate array for auxiliary copula */ + CLONE->copula = _unur_xmalloc(sizeof(double)*GEN->dim); + + /* clone marginal distribution */ + CLONE->normaldistr = _unur_distr_clone(GEN->normaldistr); + + /* marginal generators */ + if (GEN->marginalgen_list) + CLONE->marginalgen_list = _unur_gen_list_clone( GEN->marginalgen_list, GEN->dim ); + + return clone; + +#undef CLONE +} /* end of _unur_norta_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_norta_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_NORTA ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_NORTA_GEN,RETURN_VOID); + + /* free auxiliary arrays */ + if (GEN->copula) free (GEN->copula); + + /* free normal distribution object */ + if (GEN->normaldistr) _unur_distr_free (GEN->normaldistr); + + /* free marginal generators */ + if (GEN->marginalgen_list) + _unur_gen_list_free( GEN->marginalgen_list, GEN->dim); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + _unur_generic_free(gen); + +} /* end of _unur_norta_free() */ + +/*****************************************************************************/ + +int +_unur_norta_sample_cvec( struct unur_gen *gen, double *vec ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* vec ... random vector (result) */ + /*----------------------------------------------------------------------*/ +{ +#define idx(a,b) ((a)*GEN->dim+(b)) + int j; + double *u; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_NORTA_GEN,UNUR_ERR_COOKIE); + + /* pointer to auxiliary array of uniforms */ + u = GEN->copula; + + /* sample from multinormal distribution */ + _unur_sample_vec(MNORMAL,u); + + /* make copula */ + for (j=0; jdim; j++) + vec[j] = unur_distr_cont_eval_cdf( u[j], GEN->normaldistr ); + + if (gen->distr->id == UNUR_DISTR_COPULA) + /* we want to have a normal copula --> just return data */ + return UNUR_SUCCESS; + + /* else non-uniform marginals */ + for (j=0; jdim; j++) { + /* call marginal generator (using this U-value) */ + vec[j] = unur_quantile(GEN->marginalgen_list[j], vec[j]); + } + + return UNUR_SUCCESS; + +#undef idx +} /* end of _unur_norta_sample_cvec() */ + + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_norta_nortu_setup( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Compute parameter for NORTU (Normal to uniform) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS if computed successfully */ + /* error code otherwise */ + /*----------------------------------------------------------------------*/ +{ +#define idx(a,b) ((a)*dim+(b)) + + int dim = GEN->dim; /* dimension of distribution */ + double *sigma_y; /* correlation matrix for corresponding normal distr. */ + double *eigenvalues; /* eigenvalues of sigma_y */ + double *eigenvectors; /* eigenvectors of sigma_y */ + int eigenvalues_positive; /* boolean indicating whether all eigenvalues are + strictly positive */ + struct unur_distr *mn_distr; /* multinormal distribution */ + struct unur_gen *mn_gen; /* generator for multinormal distribution */ + int i,j; + + /* setup correlation matrix for corresponding normal distribution */ + sigma_y = _unur_xmalloc(dim * dim * sizeof(double)); + for(i=0; idebug & NORTA_DEBUG_SIGMA_Y) + _unur_norta_debug_sigma_y( gen, sigma_y, "NORTU setup:" ); +#endif + + /* compute eigenvectors and eigenvalues of sigma_y */ + eigenvalues = _unur_xmalloc(dim * sizeof(double)); + eigenvectors = _unur_xmalloc(dim * dim * sizeof(double)); + if (_unur_matrix_eigensystem(dim, sigma_y, eigenvalues, eigenvectors) != UNUR_SUCCESS) { + _unur_error(GENTYPE,UNUR_ERR_GEN_DATA,"cannot compute eigenvalues for given sigma_y"); + free(sigma_y); free(eigenvalues); free(eigenvectors); + return UNUR_ERR_GEN_DATA; + } + +#ifdef UNUR_ENABLE_LOGGING + if (gen->debug & NORTA_DEBUG_SIGMA_Y) + _unur_norta_debug_eigensystem( gen, eigenvalues, eigenvectors ); +#endif + + /* check if all eigenvalues are positive */ + /* otherwise set to small values close to 0 */ + eigenvalues_positive = TRUE; + for(i=0; i corrected matrix"); +#ifdef UNUR_ENABLE_LOGGING + if (gen->debug & NORTA_DEBUG_SIGMA_Y) + _unur_norta_debug_sigma_y( gen, sigma_y, "\tEigenvalues < 0 --> correction required" ); +#endif + } + + /* clear working arrays */ + free(eigenvalues); + free(eigenvectors); + + /* make generator for multinormal distribution */ + mn_distr = unur_distr_multinormal(dim, NULL, sigma_y); + mn_gen = NULL; + if (mn_distr) { + mn_gen = unur_init(unur_mvstd_new(mn_distr)); + _unur_distr_free(mn_distr); + } + if (mn_gen == NULL) { + _unur_error(GENTYPE,UNUR_ERR_GEN_DATA,"(corrected) sigma_y not positive definit"); + free(sigma_y); + return UNUR_ERR_GEN_DATA; + } + MNORMAL = mn_gen; + /* need same uniform random number generator as NORTA generator */ + MNORMAL->urng = gen->urng; + /* copy debugging flags */ + MNORMAL->debug = gen->debug; + +#ifdef UNUR_ENABLE_LOGGING + if (gen->debug & NORTA_DEBUG_SIGMA_Y) + _unur_norta_debug_nmgenerator( gen ); +#endif + + /* clear working arrays */ + free(sigma_y); + + return UNUR_SUCCESS; + +#undef idx +} /* end of _unur_norta_nortu_setup() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_norta_make_correlationmatrix( int dim, double *M) + /*----------------------------------------------------------------------*/ + /* make correlation matrix by transforming symmetric positive definit */ + /* matrix. */ + /* */ + /* There is no checking whether M fulfills the conditions! */ + /* */ + /* parameters: */ + /* dim ... dimension of matrix M */ + /* M ... symmetric square matrix */ + /*----------------------------------------------------------------------*/ +{ +#define idx(a,b) ((a)*dim+(b)) + + int i,j; + + /* diagonal is used to store the roots of the diagonal elements */ + for (i=0; itype != UNUR_DISTR_CONT) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(marginal,CK_DISTR_CONT,NULL); + + /* try PINV, CSTD+Inversion, HINV, and NINV */ + do { + /* PINV (Polynomial interpolation based INVersion of CDF) */ + par = unur_pinv_new( marginal ); + if ( (marginalgen = _unur_init(par)) != NULL ) + break; + + /* CSTD + inversion */ + par = unur_cstd_new( marginal ); + if (unur_cstd_set_variant( par, UNUR_STDGEN_INVERSION)==UNUR_SUCCESS) { + marginalgen = _unur_init(par); + break; + } + else { + _unur_par_free(par); + } + + /* HINV (Hermite interpolation based INVersion of CDF) */ + par = unur_hinv_new( marginal ); + if ( (marginalgen = _unur_init(par)) != NULL ) + break; + + /* NINV (Numerical inversion with regula falsi */ + par = unur_ninv_new( marginal ); + unur_ninv_set_table( par, 100 ); + if ( (marginalgen = _unur_init(par)) != NULL ) + break; + + /* no inversion method avaiblable */ + _unur_error(gen->genid,UNUR_ERR_DISTR_REQUIRED,"data for (numerical) inversion of marginal missing"); + return NULL; + + } while (1); + + /* set debugging flags */ + marginalgen->debug = gen->debug; + + /* return generator object */ + return marginalgen; + +} /* end of _unur_norta_make_marginalgen() */ + + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_norta_debug_init( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ +/* int i; */ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_NORTA_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous multivariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = NORTA (Vector Matrix Transformation)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cvec_debug( gen->distr, gen->genid ); + +} /* end of _unur_norta_debug_init() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_norta_debug_sigma_y( const struct unur_gen *gen, + const double *sigma_y, + const char *comment ) + /*----------------------------------------------------------------------*/ + /* print sigma_y of corresponding normal distribution. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* sigma_y ... pointer to correlation matrix */ + /* comment ... additional string printed */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_NORTA_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: %s\n",gen->genid,comment); + fprintf(LOG,"%s:\n",gen->genid); + _unur_matrix_print_matrix( GEN->dim, sigma_y, "\tsigma_y =", + LOG, gen->genid, "\t "); + +} /* end of _unur_norta_debug_sigma_y() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_norta_debug_eigensystem( const struct unur_gen *gen, + const double *eigenvalues, + const double *eigenvectors ) + /*----------------------------------------------------------------------*/ + /* print eigensystem of sigma_y. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* eigenvalues ... eigenvalues */ + /* eigenvectors ... eigenvalues */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_NORTA_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + _unur_matrix_print_vector( GEN->dim, eigenvalues, + "\teigenvalues of sigma_y =", + LOG, gen->genid, "\t "); + _unur_matrix_print_matrix( GEN->dim, eigenvectors, + "\teigenvectors of sigma_y [rows] =", + LOG, gen->genid, "\t "); + +} /* end of _unur_norta_debug_eigensystem() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_norta_debug_nmgenerator( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* print genid of multinormal generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_NORTA_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: generator for multinormal auxiliary distribution = %s\n", gen->genid, + MNORMAL->genid ); + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_norta_debug_nmgenerator() */ + +/*---------------------------------------------------------------------------*/ +#endif /* UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_norta_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + int i; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," dimension = %d\n",GEN->dim); + _unur_string_append(info," functions = MARGINAL distributions\n"); + + _unur_string_append(info," marginals ="); + for (i=0; idim; i++) + _unur_string_append(info," %s", distr->data.cvec.marginals[i]->name); + _unur_string_append(info,"\n\n"); + + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + + /* method */ + _unur_string_append(info,"method: NORTA (NORmal To Anything)\n"); + _unur_string_append(info,"\n"); + + /* performance */ + /* _unur_string_append(info,"performance characteristics:\n"); */ + /* _unur_string_append(info,"\n"); */ + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters: none\n"); + _unur_string_append(info,"\n"); + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_norta_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/norta.h b/vendor/unuran-1.11.0/src/methods/norta.h new file mode 100644 index 0000000..cd6f152 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/norta.h @@ -0,0 +1,124 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: norta.h * + * * + * PURPOSE: * + * function prototypes for method NORTA * + * (NORmal To Anything) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD NORTA NORmal To Anything + + =UP Methods_for_CVEC + + =REQUIRED rank correlation matrix, marginal distributions + + =SPEED Set-up: slow, + Sampling: depends on dimension + + =REINIT not implemented + + =REF [HLD04: Sect.12.5.2, Alg.12.11.] + + =DESCRIPTION + NORTA (NORmal to anything) is a model to get random vectors with + given marginal distributions and rank correlation. + + @strong{Important:} Notice that marginal distribution and (rank) + correlation structure do not uniquely define a multivariate + distribution. Thus there are many other (more or less sensible) + models. + + In the NORTA model multinormal random variates with the given + (Spearman's) rank correlations are generated. + In a second step the (standard normal distributed) marginal variates + are transformed by means of the CDF of the normal distribution to get + uniform marginals. The resulting random vectors have uniform + marginals and the desired rank correlation between its components. + Such a random vector is called 'copula'. + + By means of the inverse CDF the uniform marginals are then + transformed into the target marginal distributions. This + transformation does not change the rank correlation. + + For the generation of the multinormal distribution the + (Spearman's) rank correlation matrix is transformed into the + corresponding (Pearson) correlation matrix. Samples from the + resulting multinormal distribution are generated by means of the + Cholesky decomposition of the covariance matrix. + + It can happen that the desired rank correlation matrix is not + feasible, i.e., it cannot occur as rank correlation matrix of a + multinormal distribution. The resulting "covariance" matrix is + not positive definite. In this case an eigenvector correction + method is used. Then all non-positive eigenvalues are set to a + small positive value and hence the rank correlation matrix of the + generated random vectors is "close" to the desired matrix. + + =HOWTOUSE + Create a multivariate generator object and set marginal + distributions using unur_distr_cvec_set_marginals(), + unur_distr_cvec_set_marginal_array(), or + unur_distr_cvec_set_marginal_list(). + (Do not use the corresponding calls for the standard + marginal distributions). + + When the domain of the multivariate distribution is set by of a + unur_distr_cvec_set_domain_rect() call then the domain of each + of the marginal distributions is truncated by the respective + coordinates of the given rectangle. + + If copulae are required (i.e. multivariate distributions with + uniform marginals) such a generator object can be created by + means of unur_distr_copula() . + + There are no optional parameters for this method. + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_norta_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + + +/* =END */ +/*---------------------------------------------------------------------------*/ + + diff --git a/vendor/unuran-1.11.0/src/methods/norta_struct.h b/vendor/unuran-1.11.0/src/methods/norta_struct.h new file mode 100644 index 0000000..c8ece51 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/norta_struct.h @@ -0,0 +1,57 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: norta_struct.h * + * * + * PURPOSE: * + * declares structures for method NORTA * + * (NORmal To Anything) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_norta_par { + int dummy; +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_norta_gen { + int dim; /* dimension of distribution */ + double *copula; /* pointer to intermediate copula */ + struct unur_distr *normaldistr; /* standard normal distribution */ + struct unur_gen **marginalgen_list; /* list of generators for marginal distributions */ + + /* Remark: We use gen->gen_aux to store the pointer to the */ + /* multinormal generator. */ + /* It is accessed via the macro 'MNORMAL'. */ +}; + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/methods/nrou.c b/vendor/unuran-1.11.0/src/methods/nrou.c new file mode 100644 index 0000000..33cf217 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/nrou.c @@ -0,0 +1,1158 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: nrou.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: naive ratio-of-uniforms method * + * * + * DESCRIPTION: * + * Given PDF and (optionally) a bounding rectangle for the acceptance * + * region. * + * Produce a value x consistent with its density * + * The bounding rectangle is computed numerically if it is not given. * + * * + * REQUIRED: * + * pointer to the density function * + * OPTIONAL: * + * mode of the density * + * bounding rectangle of acceptance region * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Kinderman, A.J. and Monahan, F.J. (1977): Computer generation of * + * random variables using the ratio of uniform deviates, * + * ACM Trans. Math. Software 3(3), pp. 257--260. * + * * + * [2] Hoermann, W., Leydold J., and Derflinger, G. (2004): * + * Automatic non-uniform random variate generation, Springer, Berlin. * + * Section 2.4, Algorithm 2.9 (RoU), p.35 * + * * + ***************************************************************************** + * * + * The ratio-of-uniforms method introduced in [1] is a flexible method that * + * is based on the following theorem: * + * * + * THEOREM: * + * Let X be a random variable with density function f(x) = g(x) / G, * + * where g(x) is a positive integrable function with support (x_0,x_1) * + * not necessarily finite and G = integral g(x) dx. * + * If (U,V) is uniformly distributed in * + * A = {(u,v): 0 < v <= sqrt(g(u/v)), x_0 < u/v < x_1}, * + * then X = V/U has probability density function f(x). * + * * + * Generating point (U,V) uniformly distributed in A is done by rejection * + * from an enveloping region, usually from the minimal bounding rectangle. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "nrou.h" +#include "nrou_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Constants: */ + +/* Scaling factor for the computed minimum bounding rectangle. */ +/* The computed rectangle (0, vmax)x(umin[d], umax[d]) is scaled by this */ +/* factor, i.e. : */ +/* vmax = vmax * ( 1+ NROU_RECT_SCALING) */ +/* umin = umin - (umax-umin)*NROU_RECT_SCALING/2. */ +/* umax = umax + (umax-umin)*NROU_RECT_SCALING/2. */ +#define NROU_RECT_SCALING (1.e-4) + +/* The minimum bounding rectangle is computed by an numerical search */ +/* algorithm. In case of unbounded domain we need a very large bound */ +/* number as starting point: */ +#define BD_MAX (DBL_MAX/1000.) + +/*---------------------------------------------------------------------------*/ +/* Variants: */ + +#define NROU_VARFLAG_VERIFY 0x002u /* run verify mode */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define NROU_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define NROU_SET_U 0x001u /* set u values of bounding rectangle */ +#define NROU_SET_V 0x002u /* set v values of bounding rectangle */ +#define NROU_SET_CENTER 0x004u /* set center of distribution */ +#define NROU_SET_R 0x008u /* set r-parameter */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "NROU" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_nrou_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_nrou_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_nrou_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_nrou_check_par( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_nrou_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_nrou_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_nrou_sample( struct unur_gen *gen ); +static double _unur_nrou_sample_check( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_aux_bound_umax(double x, void *p); +static double _unur_aux_bound_umin(double x, void *p); +/*---------------------------------------------------------------------------*/ +/* auxiliary functions to be used in the calculation of umin/umax */ +/*---------------------------------------------------------------------------*/ + +static int _unur_nrou_rectangle( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* compute (minimal) bounding rectangle. */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ +static void _unur_nrou_debug_init( const struct unur_gen *gen ); + +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_nrou_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cont /* data for distribution object */ + +#define PAR ((struct unur_nrou_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_nrou_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define BD_LEFT domain[0] /* left boundary of domain of distribution */ +#define BD_RIGHT domain[1] /* right boundary of domain of distribution */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +#define PDF(x) _unur_cont_PDF((x),(gen->distr)) /* call to PDF */ + +/*---------------------------------------------------------------------------*/ + +#define _unur_nrou_getSAMPLE(gen) \ + ( ((gen)->variant & NROU_VARFLAG_VERIFY) \ + ? _unur_nrou_sample_check : _unur_nrou_sample ) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_nrou_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + + if (DISTR_IN.pdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); + return NULL; + } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_nrou_par) ); + COOKIE_SET(par,CK_NROU_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->umin = 0.; /* u-boundary of bounding rectangle (unknown) */ + PAR->umax = 0.; /* u-boundary of bounding rectangle (unknown) */ + PAR->vmax = 0.; /* v-boundary of bounding rectangle (unknown) */ + PAR->center = 0.; /* center of distribution (default: 0) */ + PAR->r = 1.; /* r-parameter of the generalized method */ + + par->method = UNUR_METH_NROU; /* method and default variant */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_nrou_init; + + return par; + +} /* end of unur_nrou_new() */ + +/*****************************************************************************/ + +int +unur_nrou_set_u( struct unur_par *par, double umin, double umax ) + /*----------------------------------------------------------------------*/ + /* Sets left and right u-boundary of bounding rectangle. */ + /* */ + /* parameters: */ + /* umin ... left boundary of rectangle */ + /* umax ... right boundary of rectangle */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, NROU ); + + /* check new parameter for generator */ + if (!_unur_FP_greater(umax,umin)) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"umax <= umin"); + return UNUR_ERR_PAR_SET; + } + + /* store values */ + PAR->umin = umin; + PAR->umax = umax; + + /* changelog */ + par->set |= NROU_SET_U; + + return UNUR_SUCCESS; + +} /* end of unur_nrou_set_u() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_nrou_set_v( struct unur_par *par, double vmax ) + /*----------------------------------------------------------------------*/ + /* Sets upper v-boundary of bounding rectangle. */ + /* */ + /* parameters: */ + /* vmax ... upper boundary of rectangle */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, NROU ); + + /* check new parameter for generator */ + if (vmax <= 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"vmax <= 0"); + return UNUR_ERR_PAR_SET; + } + + /* store values */ + PAR->vmax = vmax; + + /* changelog */ + par->set |= NROU_SET_V; + + return UNUR_SUCCESS; + +} /* end of unur_nrou_set_v() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_nrou_set_center( struct unur_par *par, double center ) + /*----------------------------------------------------------------------*/ + /* Set the center (approximate mode) of the PDF. */ + /* */ + /* parameters: */ + /* center ... center of distribution */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, NROU ); + + /* store data */ + PAR->center = center; + + /* changelog */ + par->set |= NROU_SET_CENTER; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_nrou_set_center() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_nrou_set_r( struct unur_par *par, double r ) + /*----------------------------------------------------------------------*/ + /* Sets r-parameter of the generalized ratio-of-uniforms method */ + /* */ + /* parameters: */ + /* r ... r-parameter */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, NROU ); + + /* check new parameter for generator */ + if (r <= 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"r<=0"); + return UNUR_ERR_PAR_SET; + } + + /* store values */ + PAR->r = r; + + /* changelog */ + par->set |= NROU_SET_R; + + return UNUR_SUCCESS; + +} /* end of unur_nrou_set_r() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_nrou_set_verify( struct unur_par *par, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, NROU ); + + /* we use a bit in variant */ + par->variant = (verify) ? (par->variant | NROU_VARFLAG_VERIFY) : (par->variant & (~NROU_VARFLAG_VERIFY)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_nrou_set_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_nrou_chg_verify( struct unur_gen *gen, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, NROU, UNUR_ERR_GEN_INVALID ); + + /* we must not change this switch when sampling has been disabled by + using a pointer to the error producing routine */ + if (SAMPLE == _unur_sample_cont_error) + return UNUR_FAILURE; + + if (verify) + /* turn verify mode on */ + gen->variant |= NROU_VARFLAG_VERIFY; + else + /* turn verify mode off */ + gen->variant &= ~NROU_VARFLAG_VERIFY; + + SAMPLE = _unur_nrou_getSAMPLE(gen); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_nrou_chg_verify() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_nrou_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* params ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_NROU ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_NROU_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_nrou_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* check parameters */ + if (_unur_nrou_check_par(gen) != UNUR_SUCCESS) { + _unur_nrou_free(gen); return NULL; + } + + /* compute bounding rectangle */ + if (_unur_nrou_rectangle(gen)!=UNUR_SUCCESS) { + _unur_error(gen->genid , UNUR_ERR_GEN_CONDITION, "Cannot compute bounding rectangle"); + _unur_nrou_free(gen); return NULL; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_nrou_debug_init(gen); +#endif + + return gen; + +} /* end of _unur_nrou_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_nrou_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int rcode; + + /* mark U and V as unknown */ + gen->set &= ~(NROU_SET_V | NROU_SET_U); + + /* check parameters */ + if ( (rcode = _unur_nrou_check_par(gen)) != UNUR_SUCCESS) + return rcode; + + /* (re)set sampling routine */ + SAMPLE = _unur_nrou_getSAMPLE(gen); + + /* compute bounding rectangle */ + return _unur_nrou_rectangle(gen); +} /* end of _unur_nrou_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_nrou_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_NROU_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_nrou_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_NROU_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_nrou_getSAMPLE(gen); + gen->destroy = _unur_nrou_free; + gen->clone = _unur_nrou_clone; + gen->reinit = _unur_nrou_reinit; + + /* copy some parameters into generator object */ + GEN->umin = PAR->umin; /* left u-boundary of bounding rectangle */ + GEN->umax = PAR->umax; /* right u-boundary of bounding rectangle */ + GEN->vmax = PAR->vmax; /* upper v-boundary of bounding rectangle */ + GEN->center = PAR->center; /* center of distribution */ + GEN->r = PAR->r; /* r-parameter of the generalized rou-method */ + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_nrou_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_nrou_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_nrou_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + + /* check for required data: center */ + if (!(gen->set & NROU_SET_CENTER)) + /* center not set via unur_nrou_set_center */ + /* use center of distribution instead. */ + GEN->center = unur_distr_cont_get_center(gen->distr) ; + + return UNUR_SUCCESS; +} /* end of _unur_nrou_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_nrou_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_nrou_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_NROU_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + return clone; + +#undef CLONE +} /* end of _unur_nrou_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_nrou_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_NROU ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_NROU_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_nrou_free() */ + +/*****************************************************************************/ + +double +_unur_nrou_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U,V,X; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_NROU_GEN,UNUR_INFINITY); + + while (1) { + /* generate point uniformly on rectangle */ + while ( _unur_iszero(V = _unur_call_urng(gen->urng)) ); + V *= GEN->vmax; + U = GEN->umin + _unur_call_urng(gen->urng) * (GEN->umax - GEN->umin); + + /* compute X */ + if (_unur_isone(GEN->r)) + X = U/V + GEN->center; + else + X = U/pow(V,GEN->r) + GEN->center; + + /* inside domain ? */ + if ( (X < DISTR.BD_LEFT) || (X > DISTR.BD_RIGHT) ) + continue; + + /* accept or reject */ + if (_unur_isone(GEN->r)) { + /* normal rou-method with square-root */ + if (V*V <= PDF(X)) + return X; + } + else { + /* generalized rou-method with pow-function */ + if (V <= pow(PDF(X), 1./(1.+GEN->r)) ) + return X; + } + } + +} /* end of _unur_nrou_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_nrou_sample_check( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator and verify that method can be used */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U,V,X,fx,sfx,xfx; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_NROU_GEN,UNUR_INFINITY); + + while (1) { + /* generate point uniformly on rectangle */ + while ( _unur_iszero(V = _unur_call_urng(gen->urng)) ); + V *= GEN->vmax; + U = GEN->umin + _unur_call_urng(gen->urng) * (GEN->umax - GEN->umin); + + /* compute x */ + if (_unur_isone(GEN->r)) + X = U/V + GEN->center; + else + X = U/pow(V,GEN->r) + GEN->center; + + /* inside domain ? */ + if ( (X < DISTR.BD_LEFT) || (X > DISTR.BD_RIGHT) ) + continue; + + /* evaluate PDF */ + fx = PDF(X); + + /* a point on the boundary of the region of acceptance + has the coordinates ( (X-center) * (fx)^(r/(1+r)), (fx)^(1/(1+r)) ). */ + if (_unur_isone(GEN->r)) { + /* normal rou-method with square-root */ + sfx = sqrt(fx); + xfx = (X-GEN->center) * sfx; + } + else { + /* generalized rou-method with pow-function */ + sfx = pow(fx, 1./(1.+GEN->r)); + xfx = (X-GEN->center) * pow(fx, GEN->r/(1.+GEN->r)); + } + + /* check hat */ + if ( ( sfx > (1.+DBL_EPSILON) * GEN->vmax ) /* avoid roundoff error with FP registers */ + || (xfx < (1.+UNUR_EPSILON) * GEN->umin) + || (xfx > (1.+UNUR_EPSILON) * GEN->umax) ) + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) > hat(x)"); + + /* accept or reject */ + if (_unur_isone(GEN->r)) { + /* normal rou-method with square-root */ + if (V*V <= PDF(X)) + return X; + } + else { + /* generalized rou-method with pow-function */ + if (V <= pow(PDF(X), 1./(1.+GEN->r)) ) + return X; + } + } + +} /* end of _unur_nrou_sample_check() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +double +_unur_aux_bound_umax(double x, void *p) + /*----------------------------------------------------------------------*/ + /* Auxiliary function used in the computation of the bounding rectangle */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + gen = p; /* typecast from void* to unur_gen* */ + + if (_unur_isone(GEN->r)) + return (x-GEN->center) * sqrt( _unur_cont_PDF((x),(gen->distr)) ); + + else + return (x-GEN->center) * pow( _unur_cont_PDF((x),(gen->distr)), + GEN->r / (1.+ GEN->r) ); +} + +/*---------------------------------------------------------------------------*/ + +double +_unur_aux_bound_umin(double x, void *p) + /*----------------------------------------------------------------------*/ + /* Auxiliary function used in the computation of the bounding rectangle */ + /*----------------------------------------------------------------------*/ +{ + return (- _unur_aux_bound_umax(x,p)) ; +} + +/*---------------------------------------------------------------------------*/ + +int +_unur_nrou_rectangle( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* compute universal bounding rectangle */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_funct_generic faux; /* function to be minimized/maximized */ + double mode; /* position of the distribution mode */ + double x, cx, sx, bx; /* parameters to be used in min/max search */ + + /* check arguments */ + CHECK_NULL( gen, UNUR_ERR_NULL ); + COOKIE_CHECK( gen,CK_NROU_GEN, UNUR_ERR_COOKIE ); + + /* boundary rectangle is already set */ + if ((gen->set & NROU_SET_U) && (gen->set & NROU_SET_V)) { + return UNUR_SUCCESS; + } + + /* starting point in min/max algorithm */ + cx=GEN->center; + + /* --------------------------------------------------------------------- */ + + /* calculation of vmax */ + if (!(gen->set & NROU_SET_V)) { + /* user has not provided any upper bound for v */ + + /* get (optional) mode if present or find it numerically */ + mode = unur_distr_cont_get_mode(gen->distr); + + if (!_unur_isfinite(mode)) + return UNUR_ERR_GENERIC; + + /* setting vmax to be (f(mode))^(1/(1+r)) */ + GEN->vmax = pow(PDF(mode), 1./(1.+GEN->r)); + + /* additional scaling of boundary rectangle */ + GEN->vmax = GEN->vmax * ( 1. + NROU_RECT_SCALING); + + /* check for bounded rectangle */ + if (! _unur_isfinite(GEN->vmax)) { + _unur_error(gen->genid , UNUR_ERR_GENERIC, "vmax not finite"); + return UNUR_ERR_GENERIC; + } + + } + + /* --------------------------------------------------------------------- */ + + /* calculation of umin and umax */ + if (!(gen->set & NROU_SET_U)) { + + /* umin: */ + faux.f = (UNUR_FUNCT_GENERIC*) _unur_aux_bound_umin; + faux.params = gen; + + /* calculating start point for extremum search routine */ + sx = _unur_isfinite(DISTR.BD_LEFT) ? (cx+DISTR.BD_LEFT)/2. : (cx-1.); + bx = _unur_isfinite(DISTR.BD_LEFT) ? DISTR.BD_LEFT : (-BD_MAX); + + x = (_unur_FP_same(DISTR.BD_LEFT,cx)) + ? cx : _unur_util_find_max(faux, bx, cx, sx); + + while (!_unur_isfinite(x) && (fabs(bx) >= UNUR_EPSILON) ) { + /* _unur_util_find_max() could not yet find a suitable extremum */ + /* trying with a sequence of intervals with decreasing length */ + bx = bx/10.; sx = bx/2.; + x = _unur_util_find_max(faux, bx, cx, sx); + } + /* umin */ + GEN->umin = -faux.f(x,faux.params); + + /* and now, an analogue calculation for umax */ + + faux.f = (UNUR_FUNCT_GENERIC*) _unur_aux_bound_umax; + faux.params = gen; + + /* calculating start point for extremum search routine */ + sx = _unur_isfinite(DISTR.BD_RIGHT) ? (cx+DISTR.BD_RIGHT)/2. : (cx+1.); + bx = _unur_isfinite(DISTR.BD_RIGHT) ? DISTR.BD_RIGHT : BD_MAX; + + x = (_unur_FP_same(DISTR.BD_RIGHT,cx)) + ? cx: _unur_util_find_max(faux, cx, bx, sx); + + while (!_unur_isfinite(x) && (fabs(bx) >= UNUR_EPSILON) ) { + /* _unur_util_find_max() could not yet find a suitable extremum */ + /* trying with a sequence of intervals with decreasing length */ + bx = bx/10.; sx = bx/2.; + x = _unur_util_find_max(faux, cx, bx, sx); + } + /* umax */ + GEN->umax = faux.f(x,faux.params); + + /* additional scaling of boundary rectangle */ + GEN->umin = GEN->umin - (GEN->umax-GEN->umin)*NROU_RECT_SCALING/2.; + GEN->umax = GEN->umax + (GEN->umax-GEN->umin)*NROU_RECT_SCALING/2.; + + /* check for bounded rectangle */ + if (! (_unur_isfinite(GEN->umin) && _unur_isfinite(GEN->umax))) { + _unur_error(gen->genid , UNUR_ERR_GENERIC, "umin or umax not finite"); + return UNUR_ERR_GENERIC; + } + + } + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_nrou_rectangle() */ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_nrou_debug_init( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_NROU_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = nrou (naive ratio-of-uniforms)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cont_debug( gen->distr, gen->genid ); + + fprintf(LOG,"%s: sampling routine = _unur_nrou_sample",gen->genid); + if (gen->variant & NROU_VARFLAG_VERIFY) fprintf(LOG,"_check"); + fprintf(LOG,"()\n%s:\n",gen->genid); + + /* parameters */ + fprintf(LOG,"%s: r-parameter = %g",gen->genid, GEN->r); + _unur_print_if_default(gen,NROU_SET_R); + fprintf(LOG,"\n%s:\n",gen->genid); + + /* center */ + fprintf(LOG,"%s: center = %g\n",gen->genid,GEN->center); + fprintf(LOG,"%s:\n",gen->genid); + + /* bounding rectangle */ + fprintf(LOG,"%s: Rectangle:\n",gen->genid); + fprintf(LOG,"%s: left upper point = (%g,%g)\n",gen->genid,GEN->umin,GEN->vmax); + fprintf(LOG,"%s: right upper point = (%g,%g)\n",gen->genid,GEN->umax,GEN->vmax); + + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_nrou_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_nrou_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + int samplesize = 10000; + double harea; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = PDF\n"); + _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info," center = %g", unur_distr_cont_get_center(distr)); + if ( !(distr->set & UNUR_DISTR_SET_CENTER) ) { + if ( distr->set & UNUR_DISTR_SET_MODE ) + _unur_string_append(info," [= mode]\n"); + else + _unur_string_append(info," [default]\n"); + } + else { + _unur_string_append(info,"\n"); + } + + if (help) { + if ( distr->set & UNUR_DISTR_SET_MODE_APPROX ) + _unur_string_append(info,"\n[ Hint: %s\n\t%s ]\n", + "You may provide the \"mode\" or at least", + "the \"center\" (a point near the mode)."); + } + _unur_string_append(info,"\n"); + + /* method */ + _unur_string_append(info,"method: NROU (Naive Ratio-Of-Uniforms)\n"); + _unur_string_append(info," r = %g\n\n", GEN->r); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," bounding rectangle = (%g,%g) x (%g,%g)\n", + GEN->umin,GEN->umax, 0.,GEN->vmax); + harea = (GEN->umax - GEN->umin) * GEN->vmax; + _unur_string_append(info," area(hat) = %g\n", harea); + _unur_string_append(info," rejection constant "); + if (distr->set & UNUR_DISTR_SET_PDFAREA) + _unur_string_append(info,"= %g\n", 2. * harea / DISTR.area); + else + _unur_string_append(info,"= %.2f [approx.]\n", + unur_test_count_urn(gen,samplesize,0,NULL)/(2.*samplesize)); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + _unur_string_append(info," r = %g %s\n", GEN->r, + (gen->set & NROU_SET_R) ? "" : "[default]"); + _unur_string_append(info," center = %g %s\n",GEN->center, + (gen->set & NROU_SET_CENTER) ? "" : "[default]"); + _unur_string_append(info," v = %g %s\n", GEN->vmax, + (gen->set & NROU_SET_V) ? "" : "[numeric.]"); + _unur_string_append(info," u = (%g, %g) %s\n", GEN->umin,GEN->umax, + (gen->set & NROU_SET_U) ? "" : "[numeric.]"); + if (gen->variant & NROU_VARFLAG_VERIFY) + _unur_string_append(info," verify = on\n"); + _unur_string_append(info,"\n"); + } + + /* Hints */ + if (help) { + if ( !(gen->set & NROU_SET_V) ) + _unur_string_append(info,"[ Hint: %s ]\n", + "You can set \"v\" to avoid numerical estimate." ); + if ( !(gen->set & NROU_SET_U) ) + _unur_string_append(info,"[ Hint: %s ]\n", + "You can set \"u\" to avoid slow (and inexact) numerical estimates." ); + _unur_string_append(info,"\n"); + } + +} /* end of _unur_nrou_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/nrou.h b/vendor/unuran-1.11.0/src/methods/nrou.h new file mode 100644 index 0000000..cff1de9 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/nrou.h @@ -0,0 +1,213 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: nrou.h * + * * + * PURPOSE: * + * function prototypes for method NROU * + * (Naive Ratio-Of-Uniforms method) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD NROU Naive Ratio-Of-Uniforms method + + =UP Methods_for_CONT + + =REQUIRED PDF + + =OPTIONAL mode, center, bounding rectangle for acceptance region + + =SPEED Set-up: slow or fast, Sampling: moderate + + =REINIT supported + + =REF [HLD04: Sect.2.4 and Sect.6.4] + + =DESCRIPTION + NROU is an implementation of the (generalized) ratio-of-uniforms + method which uses (minimal) bounding rectangles, see + @ref{Ratio-of-Uniforms}. It uses a positive control parameter + @i{r} for adjusting the algorithm to the given distribution to + improve performance and/or to make this method applicable. + Larger values of @i{r} increase the class of distributions + for which the method works at the expense of a higher rejection + constant. For computational reasons @i{r=1} should be used if + possible (this is the default). + Moreover, this implementation uses the center @unurmath{\mu} of + the distribution (see unur_distr_cont_get_center() for + details of its default values). + + For the special case with @unurmath{r=1} the coordinates of the + minimal bounding rectangles are given by + + @unurmathdisplay{ + v^+ = \sup\limits_{x} \sqrt{PDF(x)}, \\ + u^- = \inf\limits_{x} (x-\mu) \sqrt{PDF(x)}, \\ + u^+ = \sup\limits_{x} (x-\mu) \sqrt{PDF(x)}, } + + where @unurmath{\mu} is the center of the distribution. + For other values of @i{r} we have + + @unurmathdisplay{ + v^+ = \sup\limits_{x} (PDF(x))^{1/(r+1)}, \\ + u^- = \inf\limits_{x} (x-\mu) (PDF(x))^{r/(r+1)}, \\ + u^+ = \sup\limits_{x} (x-\mu) (PDF(x))^{r/(r+1)}. } + + These bounds can be given directly. Otherwise they are computed + automatically by means of a (slow) numerical routine. + Of course this routine can fail, especially when this rectangle + is not bounded. + + It is important to note that the algorithm works with + @unurmath{PDF(x-\mu)} instead of @unurmath{PDF(x).} + This is important as otherwise the acceptance region can become + a very long and skinny ellipsoid along a diagonal of the (huge) + bounding rectangle. + + =HOWTOUSE + For using the NROU method UNU.RAN needs the PDF of the + distribution. Additionally, the parameter @i{r} can be set via + a unur_vnrou_set_r() call. Notice that the acceptance + probability decreases when @i{r} is increased. On the other + hand is is more unlikely that the bounding rectangle does not + exist if @i{r} is small. + + A bounding rectangle can be given by the + unur_vnrou_set_u() and unur_vnrou_set_v() calls. + + @emph{Important:} The bounding rectangle has to be + provided for the function @unurmath{PDF(x-center)!} + Notice that @code{center} is the center of the given + distribution, see unur_distr_cont_set_center(). + If in doubt or if this value is not optimal, it can be changed + (overridden) by a unur_nrou_set_center() call. + + If the coordinates of the bounding rectangle are not provided by + the user then the minimal bounding rectangle is computed + automatically. + + By means of unur_vnrou_set_verify() and unur_vnrou_chg_verify() + one can run the sampling algorithm in a checking mode, i.e., in + every cycle of the rejection loop it is checked whether the used + rectangle indeed enclosed the acceptance region of the + distribution. When in doubt (e.g., when it is not clear whether + the numerical routine has worked correctly) this can be used to + run a small Monte Carlo study. + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + Notice, that derived parameters like the mode must also be (re-) set + if the parameters or the domain has be changed. + Notice, however, that then the values that has been set by + unur_vnrou_set_u() and unur_vnrou_set_v() calls are removed and + the coordinates of the bounding box are computed numerically. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_nrou_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_nrou_set_u( UNUR_PAR *parameters, double umin, double umax ); +/* + Sets left and right boundary of bounding rectangle. + If no values are given, the boundary of the minimal bounding + rectangle is computed numerically. + + @emph{Notice}: Computing the minimal bounding rectangle may fail + under some circumstances. Moreover, for multimodal distributions + the bounds might be too small as only local extrema are computed. + Nevertheless, for @unurmath{T_c}-concave distributions with + @unurmath{c=-1/2} it should work. + + @emph{Important:} The bounding rectangle that has to be + provided is for the function @unurmath{PDF(x-center)!} + + Default: not set. +*/ + +int unur_nrou_set_v( UNUR_PAR *parameters, double vmax ); +/* + Set upper boundary for bounding rectangle. If this value is not + given then @unurmath{\sqrt{PDF(mode)}} is used instead. + + @emph{Notice}: When the mode is not given for the distribution + object, then it will be computed numerically. + + Default: not set. +*/ + +int unur_nrou_set_r( UNUR_PAR *parameters, double r ); +/* + Sets the parameter @var{r} of the generalized ratio-of-uniforms + method. + + @emph{Notice}: This parameter must satisfy @var{r}>0. + + Default: @code{1}. +*/ + +int unur_nrou_set_center( UNUR_PAR *parameters, double center ); +/* + Set the center @unurmath{\mu} of the PDF. + If not set the center of the given distribution object is used. + + Default: see unur_distr_cont_set_center(). +*/ + +int unur_nrou_set_verify( UNUR_PAR *parameters, int verify ); +/* + Turn verifying of algorithm while sampling on/off. + + If the condition @unurmath{PDF(x) \leq hat(x)} is + violated for some @i{x} then @code{unur_errno} is set to + @code{UNUR_ERR_GEN_CONDITION}. However, notice that this might + happen due to round-off errors for a few values of + @i{x} (less than 1%). + + Default is FALSE. +*/ + +int unur_nrou_chg_verify( UNUR_GEN *generator, int verify ); +/* + Change the verifying of algorithm while sampling on/off. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/nrou_struct.h b/vendor/unuran-1.11.0/src/methods/nrou_struct.h new file mode 100644 index 0000000..202d5af --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/nrou_struct.h @@ -0,0 +1,55 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: nrou_struct.h * + * * + * PURPOSE: * + * declares structures for method NROU * + * (Naive Ratio-Of-Uniforms method) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_nrou_par { + double umin, umax; /* u boundary for bounding rectangle */ + double vmax; /* v boundary for bounding rectangle */ + double center; /* center of distribution */ + double r; /* r-parameter */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_nrou_gen { + double umin, umax; /* u boundary for bounding rectangle */ + double vmax; /* v boundary for bounding rectangle */ + double center; /* center of distribution */ + double r; /* r-parameter */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/pinv.c b/vendor/unuran-1.11.0/src/methods/pinv.c new file mode 100644 index 0000000..6c86f1d --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/pinv.c @@ -0,0 +1,554 @@ +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: pinv.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: Polynomial interpolation based INVersion of CDF * + * * + * DESCRIPTION: * + * Compute values of CDF incrementally and interpolate resulting points * + * by polynomials. * + * * + * Integration: adaptive Gauss-Lobatto integration with 5 points * + * Interpolation: Newton recursion for interpolating polynomial * + * * + * REQUIRED: * + * pointer to the PDF, center of distribution * + * * + * OPTIONAL: * + * pointer to CDF, pointer to derivative of PDF * + * * + ***************************************************************************** + * * + * Copyright (c) 2008-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * * + * [1] Derflinger, Gerhard, H{\"o}rmann, Wolfgang, and Leydold, Josef: * + * Random Variate Generation by Numerical Inversion when only the * + * Density Is Known. ACM Trans. Model. Comput. Simul. (2010), * + * to appear. * + * See also Research Report Series of the Department of * + * Statistics and Mathematics at WU Vienna, No. 90, June 2009. * + * http://epub.wu.ac.at/, oai:epub.wu-wien.ac.at:epub-wu-01_f41 * + * * + * [2] H{\"o}rmann, Wolfgang and Leydold, Josef: * + * Continuous Random Variate Generation by Fast Numerical Inversion, * + * ACM Trans. Model. Comput. Simul. 13(4), pp. 347--362, 2003. * + * * + ***************************************************************************** + * * + * Method PINV combines numerical integration with interpolation of the * + * inverse CDF. * + * * + * 1. Preprocessing: * + * * + * 1a. Estimate computationally relevant domain (support) of PDF * + * (finite interval where PDF is above some threshold value). * + * _unur_pinv_relevant_support() * + * _unur_pinv_searchborder() * + * * + * 1b. Compute area below PDF over relevant domain approximately. * + * _unur_pinv_approx_pdfarea() * + * * + * 1c. Compute computational domain where inverse CDF is approximated * + * (interval where we safely can compute coefficients of * + * interpolating polynomial). * + * _unur_pinv_computational_domain() * + * _unur_pinv_cut() * + * _unur_pinv_cut_bisect() * + * _unur_pinv_cut_CDF() * + * * + * 1d. Compute area below PDF over relevant domain with requested * + * accuracy and store subinterval boundaries and corresponding * + * from adaptive integration. * + * _unur_pinv_pdfarea() * + * * + * 2. Interpolation: * + * * + * 2a. Compute coefficients for interpolating polynomial for * + * fixed (sub-) interval. * + * _unur_pinv_newton_create() * + * _unur_pinv_chebyshev_points() * + * _unur_pinv_newton_cpoints() * + * * + * 2b. Evaluate interpolating polynomial. * + * _unur_pinv_newton_eval() * + * * + * 2c. Estimate approximation error for given interpolating polynomial. * + * _unur_pinv_newton_maxerror() * + * _unur_pinv_newton_testpoints() * + * _unur_pinv_cubic_hermite_monotone() * + * * + * * + * Currently the following methods are implemented: * + * * + * Quadrature (Integration): * + * Adaptive Gauss-Lobatto integration with 5 points. * + * see utils/lobatto.c * + * * + * Interpolation: * + * Newton recursion for coefficients of polynomial * + * ("Newton interpolation"). * + * * + * Hermite interpolation [2] (as the limit case with double and * + * tripple nodes). * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/* enable additional code for development */ +/* #define PINV_DEVEL */ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "pinv.h" +#include "pinv_struct.h" + + +/*---------------------------------------------------------------------------*/ +/* Constants */ + +/* -- Global parameters */ +#define MAX_ORDER (17) +/* Maximum order of Newton interpolation polynomial */ + +#define PINV_UERROR_CORRECTION (0.9) +/* PINV tries to create an approximation of the inverse CDF where the */ +/* U-error is bounded by the given u-resolution. However, the error caused */ +/* by cutting off the tails introduces some additional errors which must be */ +/* corrected. Thus the upper bound for the pure approximation error of the */ +/* interpolation is set to PINV_UERROR_CORRECTION * u-resolution. */ + +#define PINV_DEFAULT_MAX_IVS (10000) +/* Default for maximum number of subintervals */ + +/* -- Gauss-Lobatto integration */ + +#define PINV_MAX_LOBATTO_IVS (20001) +/* Maximum number of subintervals for adaptive Gauss-Lobatto integration. */ +/* We keep this number fixed (independent of the maximum number of */ +/* subintervals for Newton interpolation), since the number of these */ +/* subintervals does neither depend on the order of the interpolating */ +/* polynomial nor on the requested u-resolution. */ +/* */ +/* Remark: This parameter MUST NOT be smaller than 2 !! */ + +/* -- 1. Preprocessing */ + +#define PINV_PDFLLIM (1.e-13) +/* Threshold value used for finding the boundary of the computational */ +/* domain. When starting the search at some point x0 then the search stops */ +/* when a point x is found where PDF(x) approx. PDF(x0) * PINV_PDFLLIM. */ + +#define PINV_UERROR_AREA_APPROX (1.e-5) +/* Tolerated relative area when computing the area below the PDF */ +/* approximately in Step 1b. */ + +#define PINV_TAILCUTOFF_FACTOR (0.05) +#define PINV_TAILCUTOFF_MAX (1.e-10) +/* For unbounded domains the tails has to be cut off. We use the given */ +/* u-resolution for finding the cut points. (The probability for each of the */ +/* chopped regions should be less than */ +/* HINV_TAILCUTOFF_FACTOR * u-resolution.) */ +/* However, the tail probabilities should not be greater than some threshold */ +/* value, given by PINV_TAILCUTOFF_MAX which reflects the precision of the */ +/* used stream of uniform pseudo-random numbers (typically about 2^32). */ +/* However, for computational reasons we use a value that is at least twice */ +/* the machine epsilon for the right hand boundary. */ + +/* -- 2. Newton interpolation */ + +#define PINV_UTOL_CORRECTION (0.05) +/* We use a smaller tolerance when computing the Gauss-Lobatto integral for */ +/* the PDF between construction points of the Newton polynomial. */ + +#define PINV_MAX_ITER_IVS (10 * GEN->max_ivs) +/* maximum number of iterations for computing intervals for Newtwon */ +/* interpolation polynomials. Obviously it should be larger than the maximum */ +/* number of intervals (or the latter can be reduced). */ + +#define PINV_GUIDE_FACTOR (1) +/* relative size of guide table for finding the subinterval corresponding */ +/* to the given U-value. */ + + +/*---------------------------------------------------------------------------*/ +/* Variants */ + +#define PINV_VARIANT_PDF 0x0010u /* use PDF and Lobatto integration + [ if not present, use CDF ] */ +#define PINV_VARIANT_UPOINTS 0x0040u /* use Chebyshev points in u scale */ +#define PINV_VARIANT_KEEPCDF 0x0080u /* keep table for integration */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define PINV_DEBUG_REINIT 0x00000002u /* print parameters after reinit */ +#define PINV_DEBUG_TABLE 0x00000010u /* print table */ +#define PINV_DEBUG_SEARCHBD 0x00010000u /* trace search boundary */ +#define PINV_DEBUG_ITABLE 0x00020000u /* print table of integral values */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define PINV_SET_ORDER 0x0001u /* order of polynomial */ +#define PINV_SET_ORDER_COR 0x1000u /* ... corrected */ +#define PINV_SET_SMOOTH 0x0002u /* smoothness of interpolant */ +#define PINV_SET_SMOOTH_COR 0x2000u /* ... corrected */ +#define PINV_SET_U_RESOLUTION 0x0004u /* maximal error in u */ +#define PINV_SET_UPOINTS 0x0008u /* use Chebyshev points in u scale */ +#define PINV_SET_BOUNDARY 0x0010u /* boundary of computational region */ +#define PINV_SET_SEARCHBOUNDARY 0x0020u /* search for boundary */ +#define PINV_SET_VARIANT 0x0040u /* variant of algorithm */ +#define PINV_SET_MAX_IVS 0x0080u /* maximum number of subintervals */ +#define PINV_SET_KEEPCDF 0x0100u /* keep table for integration */ +#define PINV_SET_N_EXTRA_TP 0x4000u /* number of extra test points */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "PINV" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +/*........................*/ +/* file: pinv_newset.ch */ +/*........................*/ + +/* See pinv.h for 'new', 'set', and 'get' calls. */ + + +/*......................*/ +/* file: pinv_init.ch */ +/*......................*/ + +static struct unur_gen *_unur_pinv_init (struct unur_par *par); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +/* static int _unur_pinv_reinit (struct unur_gen *gen); */ +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_pinv_create (struct unur_par *par); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_pinv_check_par (struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_pinv_clone (const struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_pinv_free (struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_pinv_make_guide_table (struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* make a guide table for indexed search. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_pinv_eval_PDF (double x, struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* call to PDF. */ +/*---------------------------------------------------------------------------*/ + + +/*........................*/ +/* file: pinv_sample.ch */ +/*........................*/ + +static double _unur_pinv_sample (struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static double _unur_pinv_eval_approxinvcdf (const struct unur_gen *gen, double u); +/*---------------------------------------------------------------------------*/ +/* evaluate interpolation of inverse CDF at u. */ +/*---------------------------------------------------------------------------*/ + +/* declared in pinv.h: */ +/* double unur_pinv_eval_approxinvcdf (const struct unur_gen *gen, double u); */ +/* int unur_pinv_estimate_error (const UNUR_GEN *gen, int samplesize, double *max_error, double *MAE); */ + + +/*......................*/ +/* file: pinv_prep.ch */ +/*......................*/ + +static int _unur_pinv_preprocessing (struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* 1. Find computational domain and compute PDF area. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_pinv_relevant_support (struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* 1a. Estimate computationally relevant domain (support) of PDF */ +/* (finite interval where PDF is above some threshold value). */ +/*---------------------------------------------------------------------------*/ + +static double _unur_pinv_searchborder (struct unur_gen *gen, double x0, double bound, + double *dom, int *search); +/*---------------------------------------------------------------------------*/ +/* [1a.] find left or right hand border of relevant domain. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_pinv_approx_pdfarea (struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* 1b. Compute area below PDF over relevant domain approximately. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_pinv_pdfarea (struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* 1d. Compute area below PDF with requested accuracy and */ +/* store intermediate results from adaptive integration. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_pinv_computational_domain (struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* 1c. Compute computational domain where inverse CDF is approximated */ +/* (interval where we safely can compute coefficients of */ +/* interpolating polynomial). */ +/*---------------------------------------------------------------------------*/ + +static double _unur_pinv_cut (struct unur_gen *gen, double w, double dw, double crit); +/*---------------------------------------------------------------------------*/ +/* [1c.] calculate cut-off points for computational domain of distribution. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_pinv_cut_bisect (struct unur_gen *gen, double x0, double x1); +/*---------------------------------------------------------------------------*/ +/* [1c.] calculate cut-off points as boudary of bounded support of PDF. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_pinv_computational_domain_CDF (struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* 1c. Compute computational domain where inverse CDF is approximated */ +/* (interval where we safely can compute coefficients of */ +/* interpolating polynomial). */ +/* Use CDF. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_pinv_cut_CDF( struct unur_gen *gen, double dom, double x0, double ul, double uu ); +/*---------------------------------------------------------------------------*/ +/* [1c.] calculate cut-off points for computational domain of distribution */ +/* using CDF. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_pinv_Udiff (struct unur_gen *gen, double x, double h, double *fx); +/*---------------------------------------------------------------------------*/ +/* compute difference CDF(x+h)-CDF(x) (approximately), where CDF is the */ +/* integral of the given (quasi-) density. */ +/*---------------------------------------------------------------------------*/ + + +/*........................*/ +/* file: pinv_newton.ch */ +/*........................*/ + +static int _unur_pinv_create_table( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* create table for Newton interpolation */ +/*---------------------------------------------------------------------------*/ + +static int _unur_pinv_chebyshev_points (double *pt, int order, int smooth); +/*---------------------------------------------------------------------------*/ +/* [2a.] Compute Chebyshev points. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_pinv_newton_cpoints (double *xval, int order, struct unur_pinv_interval *iv, + double h, double *chebyshev, int smooth, int use_upoints); +/*---------------------------------------------------------------------------*/ +/* [2a.] Compute points for construct interpolating polynomial. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_pinv_newton_create (struct unur_gen *gen, struct unur_pinv_interval *iv, + double *xval, int smooth); +/*---------------------------------------------------------------------------*/ +/* 2a. Compute coefficients for Newton interpolation. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_pinv_linear_create (struct unur_gen *gen, struct unur_pinv_interval *iv, + double *xval); +/*---------------------------------------------------------------------------*/ +/* [2a.] Compute coefficients for linear interpolation. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_pinv_newton_eval (double q, double *ui, double *zi, int order); +/*---------------------------------------------------------------------------*/ +/* 2b. evaluate Newton polynomial. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_pinv_newton_maxerror (struct unur_gen *gen, struct unur_pinv_interval *iv, double *xval); +static double _unur_pinv_linear_maxerror (struct unur_gen *gen, struct unur_pinv_interval *iv); +static double _unur_pinv_maxerror_extra (struct unur_gen *gen, struct unur_pinv_interval *iv, double *xval); +/*---------------------------------------------------------------------------*/ +/* 2c. estimate maximal error of Newton interpolation in subinterval */ +/*---------------------------------------------------------------------------*/ + +static int _unur_pinv_newton_testpoints (double *utest, double ui[], int order); +/*---------------------------------------------------------------------------*/ +/* [2c.] calculate the local maxima of the interpolation polynomial */ +/*---------------------------------------------------------------------------*/ + +static int _unur_pinv_cubic_hermite_is_monotone(struct unur_gen *gen, double *ui, double *zi, double *xval); +/*---------------------------------------------------------------------------*/ +/* [2c.] check monotonicity of cubic Hermite interpolation */ +/*---------------------------------------------------------------------------*/ + +static int _unur_pinv_interval( struct unur_gen *gen, int i, double x, double cdfx ); +/*---------------------------------------------------------------------------*/ +/* make a new interval i with left boundary point x and CDF(x). */ +/*---------------------------------------------------------------------------*/ + +static int _unur_pinv_lastinterval( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* update size of array and set all uninitialized values to 0. */ +/*---------------------------------------------------------------------------*/ + + +/*.......................*/ +/* file: pinv_debug.ch */ +/*.......................*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_pinv_debug_init_start (const struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* print before setup starts. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_pinv_debug_init (const struct unur_gen *gen, int ok); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_pinv_debug_relevant_support (const struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* print relevant domain */ +/*---------------------------------------------------------------------------*/ + +static void _unur_pinv_debug_pdfarea (const struct unur_gen *gen, int approx); +/*---------------------------------------------------------------------------*/ +/* print estimated area below PDF */ +/*---------------------------------------------------------------------------*/ + +static void _unur_pinv_debug_computational_domain (const struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* print computational domain */ +/*---------------------------------------------------------------------------*/ + +static void _unur_pinv_debug_intervals (const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print starting points or table for algorithms into LOG file. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_pinv_debug_create_table (const struct unur_gen *gen, + int iter, int n_incr_h, int n_decr_h, + int n_use_linear); +/*---------------------------------------------------------------------------*/ +/* print data that have been collected while creating polynomials. */ +/*---------------------------------------------------------------------------*/ +#endif + + +/*......................*/ +/* file: pinv_info.ch */ +/*......................*/ + +#ifdef UNUR_ENABLE_INFO +static void _unur_pinv_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cont /* data for distribution object */ + +#define PAR ((struct unur_pinv_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_pinv_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +#define PDF(x) (_unur_pinv_eval_PDF((x),(gen))) /* call to PDF */ +#define dPDF(x) (_unur_cont_dPDF((x),(gen->distr))) /* call to derivate of PDF */ +#define CDF(x) (_unur_cont_CDF((x),(gen->distr))) /* call to CDF */ + +/*---------------------------------------------------------------------------*/ + +#define _unur_pinv_getSAMPLE(gen) (_unur_pinv_sample) + +/*---------------------------------------------------------------------------*/ + + + +/*---------------------------------------------------------------------------*/ +/* since there is only file scope or program code, we abuse the */ +/* #include directive. */ + +/** Public: User Interface (API) **/ +#include "pinv_newset.ch" + +/** Private **/ +#include "pinv_init.ch" +#include "pinv_sample.ch" +#include "pinv_prep.ch" +#include "pinv_newton.ch" +#include "pinv_debug.ch" +#include "pinv_info.ch" + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/pinv.h b/vendor/unuran-1.11.0/src/methods/pinv.h new file mode 100644 index 0000000..b745c82 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/pinv.h @@ -0,0 +1,499 @@ +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: pinv.h * + * * + * PURPOSE: * + * function prototypes for method PINV * + * (Polynomial interpolation based INVersion of CDF) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2008-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD PINV Polynomial interpolation based INVersion of CDF + + =UP Methods_for_CONT + + =REQUIRED PDF + + =OPTIONAL domain, center, CDF, derivative of PDF + + =REF [DHLa08] + + =SPEED Set-up: (very) slow, Sampling: (very) fast + + =REINIT not implemented + + =DESCRIPTION + PINV is a variant of numerical inversion, where the inverse CDF + is approximated using Newton's interpolating formula. + The interval [0,1] is split into several subintervals. In each + of these the inverse CDF is constructed at nodes + @unurmath{(CDF(x),x)} for some points @i{x} in this subinterval. + If the PDF is given, then the CDF is computed numerically + from the given PDF using adaptive Gauss-Lobatto + integration with 5 points. Subintervals are split until the + requested accuracy goal is reached. + + The method is not exact, as it only produces random variates of + the approximated distribution. Nevertheless, the maximal + tolerated approximation error can be set to be the resolution + (but of course is bounded by the machine precision). + We use the u-error @unurmath{|U-CDF(X)|} to measure the error + for @i{X} = "approximate inverse CDF"(@i{U}). + Notice that very small values of the u-resolution are possible + but increase the cost for the setup step. + We call the maximal tolerated u-error the @emph{u-resolution} of + the algorithm in the sequel. + + Both the order of the interpolating polynomial and the + u-resolution can be selected. + + The interpolating polynomials have to be computed in a setup + step. However, it only works for distributions with bounded + domain; for distributions with unbounded domain the tails are + cut off such that the probability for the tail regions is + small compared to the given u-resolution. + + The construction of the interpolation polynomial only works when + the PDF is unimodal or when the PDF does not vanish between two + modes. + + There are some restrictions for the given distribution: + @itemize + @item + The support of the distribution (i.e., the region where the PDF + is strictly positive) must be connected. In practice this means, + that the region where PDF is "not too small" must be connected. + Unimodal densities satisfy this condition. + If this condition is violated then the domain of the + distribution might be truncated. + @item + When the PDF is integrated numerically, then the given PDF must + be continuous and should be smooth. + @item + The PDF must be bounded. + @item + The algorithm has problems when the distribution has heavy tails + (as then the inverse CDF becomes very steep at 0 or 1) + and the requested u-resolution is very small. + E.g., the Cauchy distribution is likely to show this problem + when the requested u-resolution is less then @code{1.e-12}. + @end itemize + Regions with very small PDF values or heavy tails might lead to + an abortion of the set-up or (even worse) the approximation + error might become larger than requested, since the (computation of the) + interpolating polynomial becomes numerically unstable. + + @emph{Remark:} + We also have implemented experimental variants. + However, we observed that these variants are more sensitive to + round-off errors, especially in the right hand tail and we + @emph{do not recommend} their usage unless there are severe + reasons. + + @itemize @minus + @item + Use a function that implements the CDF instead of numerical + integration of the PDF. + + @item + Use Hermite interpolation instead of Newton interpolation. + Thus the first (and second) derivative of the interpolating + polynomial coincides with that of the inverse CDF. + Consequently the interpolant is also (twice) differentiable even + at the interval boundaries. + This variant can be seen as limiting case of Newton + interpolation with double (or triple) points as nodes. + + We have used a @emph{smoothness} parameter to control this + feature. However, besides numerical problems we observed that + this variant requires more intervals and thus larger setup times + and higher memory consumptions. + @end itemize + + + =HOWTOUSE + PINV works for continuous univariate distribution objects with + given PDF. The corresponding distribution object should contain a + typical point of the distribution, i.e., a point where the PDF + is not too small, e.g., (a point near) the mode. + However, it is important that the center is @strong{not} the + pole of the distribution (or a point too close to the pole). + It can be set using a unur_distr_cont_set_center() or + a unur_distr_cont_set_mode() call. If neither is set, or if the + given center cannot be used, then a simple search routine tries + to find an appropriate point for the center. + + It is recommended that the domain of the distribution with + bounded domain is specified using a unur_distr_cont_set_domain() + call. Otherwise, the boundary is searched numerically which + might be rather expensive, especially when this boundary point + is @code{0}. + + The inverse CDF is interpolated using Newton polynomials. + The order of this polynomial can be set by means of a + unur_pinv_set_order() call. + + The smoothness of the interpolant at interval boundaries can be + controlled using a unur_pinv_set_smoothness() call. + Then Hermite interpolation instead of Newton interpolation is + used. (The former can be seen as a limiting case of Newton + interpolation with double (or triple) points.) + However, using higher smoothness is @emph{not recommended} + unless differentiability at the interval boundaries is + important. + + For distributions with unbounded domains the tails are cut + off such that the probability for the tail regions is small + compared to the given u-resolution. For finding these cut points + the algorithm starts with the region @code{[-1.e100,1.e100]}. For + the exceptional case where this does not work these starting + points can be changed via a unur_pinv_set_boundary() call. + + This method is not exact, as it only produces random variates of + the approximated distribution. Nevertheless, the numerical error + in "u-direction" (i.e., |U-CDF(X)|, for + X = "approximate inverse CDF"(U) |U-CDF(X)|) can be controlled + by means of unur_pinv_set_u_resolution(). + However, the maximal error of this approximation is only + estimated. For very small u-resolutions the actual approximation + error might be (slightly) larger than the requested u-resolution. + (Of course the size of this value depends on the given PDF.) + If this error is crucial for an application we recommend to + compute this error using unur_pinv_estimate_error() which runs a + small Monte Carlo simulation. + It is also possible to improve the error estimate during setup + by means of unur_pinv_set_extra_testpoints(). + See also the documentation for function + unur_pinv_set_u_resolution() and the remark given there. + + The number of required subintervals heavily depends on the order + of the interpolating polynomial and the requested u-resolution: + it increases when order or u-resolution are decreased. + It can be checked using a unur_pinv_get_n_intervals() call. + The maximum number of such subintervals is fixed but can be + increased using a unur_pinv_set_max_intervals() call. + If this maximum number is too small then the set-up aborts with + a corresponding error message. + + It is also possible to use the CDF of the distribution instead + of the PDF. Then the distribution object must contain a pointer + to the CDF. Moreover, this variant of the algorithm has to be + switched on using an unur_pinv_set_usecdf() call. + Notice, however, that the setup for this variant is numerically + less stable than using integration of the PDF (the default + variant). Thus using the CDF is @emph{not recommended}. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* + =ROUTINES +*/ + + +UNUR_PAR *unur_pinv_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_pinv_set_order( UNUR_PAR *parameters, int order); +/* + Set order of interpolation. Valid orders are between @code{3} and + @code{17}. Higher orders result in fewer intervals for the + approximations. + + Default: @code{5}. +*/ + +int unur_pinv_set_smoothness( UNUR_PAR *parameters, int smoothness); +/* + Set smoothness of interpolant. By construction the interpolant is + piecewise polynomial and thus smooth on each of the intervals + where these polynomials are constructed. At the interval + boundaries, however, it usually not be differentiable. + Method PINV also implements variants of Newton interpolation where + the first (or second) derivative of the interpolating + polynomial coincides with the respective derivative of the inverse + CDF at the nodes. The the interpolant is (twice) differentiable + even at the interval boundaries. + These variants can be seen as limiting case of Newton interpolation + with double (or triple) points as nodes and are known as Hermite + interpolation. + + Possible values for @var{smoothness}: + + @multitable @columnfractions .1 .25 .60 + @headitem Value @tab Effect @tab Requirements + @item @code{0} + @tab continuous + @tab requires PDF (or CDF) + + @item @code{1} + @tab differentiable + @tab requires PDF (optional: CDF), @* + order of polynomial must be odd + + @item @code{2} + @tab twice differentiable + @tab requires PDF and its derivative (optional: CDF), @* + order must be 5, 8, 11, 14 or 17 + @end multitable + + If the order of the polynomial does not satisfy the given + condition, then it is increased to the next larger possible value. + + @emph{Remark:} + A higher smoothness parameter usually results in a higher number of + intervals and thus a higher setup time and memory consumption. + We also observed that higher smoothness parameters make the + algorithm more sensible for round-off error. Then the setup fails. + + @emph{Remark:} + If the interpolating polynomial cannot be constructed for the + requested smoothness on a particular interval, + then the smoothness parameter is reduced for that interval. + + @emph{Remark:} + For order @code{3} and smoothness @code{1} (cubic Hermite + interpolation) monotonicity is guaranteed by checking a simple + monotonicity condition for the coefficients of the polynomials. + + @emph{Remark:} + Using @var{smoothness} larger than @code{0} is + @emph{not recommended} unless differentiability at the interval + boundaries is important for ones application. + + Default: @code{0}. +*/ + +int unur_pinv_set_u_resolution( UNUR_PAR *parameters, double u_resolution); +/* + Set maximal tolerated u-error. Values of @var{u_resolution} must + at least @code{1.e-15} and @code{1.e-5} at most. + Notice that the resolution of most uniform random number sources is + @unurmath{2^{-32}} = @code{2.3e-10}. Thus a value of @code{1.e-10} + leads to an inversion algorithm that could be called exact. For most + simulations slightly bigger values for the maximal error are enough + as well. + + Smaller values for @var{u_resolution} increase the number of + subinterval that are necessary for the approximation of the inverse + CDF. For very small values (less then @code{1.e-12}) this number + might exceed the maximum number of such intervals. However, this + number can be increased using a unur_pinv_set_max_intervals() call. + + @emph{Remark:} + We ran many experiments and found that the observed u-error was + always smaller than the given @var{u_resolution} whenever this + value was @code{1.e-12}. For values smaller than @code{1e-13} the + maximal observed u-error was slightly larger. One use @code{1.e-15} + if best approximation is required. However, then the actual u-error + can be as large as @code{1.e-14}. + + Consider calling unur_pinv_set_extra_testpoints() in order to + reduce the risk of larger approximation errors. + + @strong{Warning!} + These figures are based on our experiments (with some tolerance + added to be on the safe side). There is no guarantee for these error + estimates for a particular distribution. + + Default is @code{1.e-10}. +*/ + +int unur_pinv_set_extra_testpoints( UNUR_PAR *parameters, int n_points); +/* + During setup method PINV checks the current u-error by means of + carefully selected test points and improves the approximation where + necessary. However, it nevertheless may happen, that the + maximal approximation error is larger than estimated in some + interval (which usually is hit with a very small probability). + This estimate can be improved by using extra test points + which can be added by means of this call. + However, this increases the setup time considerably. + Note that these additional points are selected equidistributed + in each subinterval. + + Default is @code{0} (i.e., no additional test points are used). +*/ + +int unur_pinv_set_use_upoints( UNUR_PAR *parameters, int use_upoints ); +/* + If @var{use_upoints} is TRUE, then the nodes of the interpolating + polynomial are constructed by means of Chebyshev points in u-scale + not in x-scale. This results is a better approximation but almost + doubles the number of PDF or CDF evaluations during the setup. + (This is an experimental feature.) + + Default: FALSE +*/ + +int unur_pinv_set_usepdf( UNUR_PAR *parameters ); +/* + Use PDF (if available) to compute approximate inverse CDF. + + This is the default. +*/ + +int unur_pinv_set_usecdf( UNUR_PAR *parameters ); +/* + Use CDF (if available) to compute approximate inverse CDF. + This variant is intend for running experiments with method PINV. + + @emph{Remark:} + We ran many experiments and found that for small values of the + given @var{u_resolution} (less than @code{1.e-12}) the setup fails + for distributions with heavy tails. We found that using the PDF + (instead of the CDF) is numerically more stable. + This is especially the case when the smoothness parameter is set + to @code{1} or @code{2}. + + Using the CDF is @strong{not recommended}. +*/ + +int unur_pinv_set_boundary( UNUR_PAR *parameters, double left, double right ); +/* + Set @var{left} and @var{right} point for finding the cut-off points + for the "computational domain", i.e., the domain that covers the + essential part of the distribution. + The cut-off points are computed such that the tail probabilities + are smaller than given by unur_pinv_set_u_resolution(). + It is usually safe to use a large interval. + However, @code{+/- UNUR_INFINITY} is not allowed. + + @emph{Important}: This call does not change the domain of the + given distribution itself. But it restricts the domain for the + resulting random variates. + + Default: intersection of @code{[-1.e100,+1.e100]} and the given + domain of the distribution. +*/ + +int unur_pinv_set_searchboundary( UNUR_PAR *parameters, int left, int right ); +/* + If @var{left} or @var{right} is set to FALSE then the respective + boundary as given by a unur_pinv_set_boundary() call is used + without any further computations. + However, these boundary points might cause numerical problems + during the setup when PDF returns @code{0} ``almost everywhere''. + If set to TRUE (the default) then the computational interval is + shortened to a more sensible region by means of a search algorithm. + Switching off this search is useful, e.g., for the Gamma(2) + distribution where the left border @code{0} is fixed and finite. + + @emph{Remark:} + The searching algorithm assumes that the support of the distribution + is connected. + + @emph{Remark:} + Do not set this parameter to FALSE except when searching for + cut-off points fails and one wants to try with precomputed values. + + Default: TRUE. +*/ + +int unur_pinv_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); +/* + Set maximum number of intervals. @var{max_ivs} must be at least + @code{100} and at most @code{1000000}. + + Default is @code{10000}. +*/ + +int unur_pinv_get_n_intervals( const UNUR_GEN *generator ); +/* + Get number of intervals used for interpolation in + the generator object. + It returns @code{0} in case of an error. +*/ + +int unur_pinv_set_keepcdf( UNUR_PAR *parameters, int keepcdf); +/* + If the PDF is given, then the CDF is computed numerically + from the given PDF using adaptive Gauss-Lobatto integration. + Thus a table of CDF points is stored to keep the number of + evaluations of the PDF minimal. Usually this table is discarded + when the setup is completed. + If @var{keepcdf} is TRUE, then this table is kept and can be used + to compute the CDF of the underlying distribution by means of + function unur_pinv_eval_approxcdf(). + This option is ignored when unur_pinv_set_usecdf() is called. + + Default: FALSE +*/ + +double unur_pinv_eval_approxinvcdf( const UNUR_GEN *generator, double u ); +/* + Evaluate interpolation of inverse CDF at @var{u}. + If @var{u} is out of the domain (0,1) then @code{unur_errno} is set + to @code{UNUR_ERR_DOMAIN} and the respective bound of + the domain of the distribution are returned (which is + @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of + unbounded domains). +*/ + +double unur_pinv_eval_approxcdf( const UNUR_GEN *generator, double x ); +/* + Evaluate (approximate) CDF at @var{x}. If the PDF of the + distribution is given, then adaptive Gauss-Lobatto integration is + used to compute the CDF. + If the PDF is used to create the generator object, then the + table of integral values must not removed at the end of setup and thus + unur_pinv_set_keepcdf() must be called. +*/ + +int unur_pinv_estimate_error( const UNUR_GEN *generator, int samplesize, double *max_error, double *MAE ); +/* + Estimate maximal u-error and mean absolute error (MAE) for @var{generator} + by means of Monte-Carlo simulation with sample size @var{samplesize}. + The results are stored in @var{max_error} and @var{MAE}, respectively. + + It returns @code{UNUR_SUCCESS} if successful. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ + +/* + Remark: + PINV needs a first guess for the area below the PDF. This value can + be set using the unur_distr_cont_set_pdfarea() call. Otherwise + @code{1} is used. + There is no necessity to set this area unless it differs from 1 by + several orders of magnitude. +*/ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/pinv_debug.ch b/vendor/unuran-1.11.0/src/methods/pinv_debug.ch new file mode 100644 index 0000000..0acae50 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/pinv_debug.ch @@ -0,0 +1,292 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: pinv_debug.c * + * * + * Routines for printing debugging information. * + * * + ***************************************************************************** + * * + * Copyright (c) 2008 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_pinv_debug_init_start( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG filebefore setup starts. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_PINV_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = PINV (Polynomial interpolation based INVerse CDF)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cont_debug( gen->distr, gen->genid ); + + fprintf(LOG,"%s: sampling routine = _unur_pinv_sample\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: order of polynomial = %d",gen->genid,GEN->order); + _unur_print_if_default(gen,PINV_SET_ORDER); + if(gen->set & PINV_SET_ORDER_COR) fprintf(LOG," [corrected]"); + fprintf(LOG,"\n%s: smoothness = %d",gen->genid,GEN->smooth); + _unur_print_if_default(gen,PINV_SET_SMOOTH); + if(gen->set & PINV_SET_SMOOTH_COR) fprintf(LOG," [corrected]"); + fprintf(LOG,"\n%s: u-resolution = %g",gen->genid,GEN->u_resolution); + _unur_print_if_default(gen,PINV_SET_U_RESOLUTION); + fprintf(LOG,"\n%s: # extra test points = %d",gen->genid,GEN->n_extra_testpoints); + _unur_print_if_default(gen,PINV_SET_N_EXTRA_TP); + fprintf(LOG,"\n%s: maximum number of subintervals = %d",gen->genid,GEN->max_ivs); + _unur_print_if_default(gen,PINV_SET_MAX_IVS); + + fprintf(LOG,"\n%s: variant = ",gen->genid); + if (gen->variant & PINV_VARIANT_PDF) + fprintf(LOG,"use PDF + Lobatto integration"); + else + fprintf(LOG,"use CDF"); + _unur_print_if_default(gen,PINV_SET_VARIANT); + fprintf(LOG,"\n"); + + fprintf(LOG,"%s: use Chebyshev points in %s scale",gen->genid, + (gen->variant & PINV_VARIANT_UPOINTS) ? "u" : "x"); + _unur_print_if_default(gen,PINV_SET_UPOINTS); + fprintf(LOG,"\n"); + + fprintf(LOG,"%s: keep table of CDF values = %s",gen->genid, + (gen->variant & PINV_VARIANT_KEEPCDF) ? "on" : "off"); + _unur_print_if_default(gen,PINV_SET_KEEPCDF); + fprintf(LOG,"\n"); + + fprintf(LOG,"%s:\n",gen->genid); + fflush(LOG); +} /* end of _unur_pinv_debug_init_start() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_pinv_debug_init( const struct unur_gen *gen, int ok ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* ok ... exitcode of init call */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_PINV_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: domain of computation = [%g,%g]\n",gen->genid, GEN->bleft,GEN->bright); + fprintf(LOG,"%s: Umin = 0 [fixed], Umax = %18.16g",gen->genid, GEN->Umax); + if (_unur_FP_approx(GEN->Umax,1.)) + fprintf(LOG,", 1-Umax = %g",1.-GEN->Umax); + fprintf(LOG,"\n%s:\n",gen->genid); + + fprintf(LOG,"%s: # Intervals = %d\n",gen->genid,GEN->n_ivs); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_pinv_debug_intervals(gen); + + fprintf(LOG,"%s: initialization %s\n",gen->genid,((ok)?"successful":"*** FAILED ***")); + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_pinv_debug_init() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_pinv_debug_relevant_support (const struct unur_gen *gen) + /*----------------------------------------------------------------------*/ + /* print relevant domain */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_PINV_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: search for boundaries: left = %s, right = %s\n",gen->genid, + GEN->sleft ? "TRUE" : "FALSE", GEN->sright ? "TRUE" : "FALSE"); + fprintf(LOG,"%s: relevant domain = (%g,%g) [i.e. where PDF > threshold]\n",gen->genid, + GEN->bleft,GEN->bright); + fprintf(LOG,"%s: possible support of distribution = (%g,%g)\n",gen->genid, + GEN->dleft,GEN->dright); + + fprintf(LOG,"%s:\n",gen->genid); + fflush(LOG); + +} /* end of _unur_pinv_debug_relevant_support() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_pinv_debug_pdfarea (const struct unur_gen *gen, int approx) + /*----------------------------------------------------------------------*/ + /* print estimated area below PDF */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* approx ... whether this is an approximate value or accurat up to */ + /* requested tolerance */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_PINV_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: area below PDF %s = %19.16g\n",gen->genid, + approx ? "(approx.)" : "(accurate)", GEN->area); + + if (GEN->aCDF) + _unur_lobatto_debug_table(GEN->aCDF, gen, (gen->debug & PINV_DEBUG_ITABLE)); + + fprintf(LOG,"%s:\n",gen->genid); + fflush(LOG); +} /* end of _unur_pinv_debug_pdfarea() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_pinv_debug_computational_domain (const struct unur_gen *gen) + /*----------------------------------------------------------------------*/ + /* print computational domain */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_PINV_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: computational domain = (%g,%g)\n",gen->genid, + GEN->bleft,GEN->bright); + + fprintf(LOG,"%s:\n",gen->genid); + fflush(LOG); + +} /* end of _unur_pinv_debug_computational_domain() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_pinv_debug_intervals( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* print table of intervals into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + int n, j; + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_PINV_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + if (gen->debug & PINV_DEBUG_TABLE) { + + for (n=0; n<=GEN->n_ivs; n++) { + fprintf(LOG,"%s: [%3d] xi = %.16g, cdfi = %.14g\n",gen->genid, + n, GEN->iv[n].xi, GEN->iv[n].cdfi); + + /* coefficients for constructing Newton interpolation */ + fprintf(LOG,"%s:\tui = %.16g",gen->genid, GEN->iv[n].ui[0]); + for (j=1; jorder; j++) + fprintf(LOG,", %.14g",GEN->iv[n].ui[j]); + + fprintf(LOG,"\n%s:\tzi = %.16g",gen->genid, GEN->iv[n].zi[0]); + for (j=1; jorder; j++) + fprintf(LOG,", %.16g",GEN->iv[n].zi[j]); + + fprintf(LOG,"\n"); + } + + } + + fprintf(LOG,"%s:\n",gen->genid); + fflush(LOG); + +} /* end of _unur_pinv_debug_intervals() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_pinv_debug_create_table (const struct unur_gen *gen, + int iter, int n_incr_h, int n_decr_h, int n_use_linear) + /*----------------------------------------------------------------------*/ + /* print data that have been collected while creating polynomials. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iter ... total number of iterations */ + /* n_incr_h ... number of steps where h is increased */ + /* n_decr_h ... number of steps where h is decreased */ + /* n_use_linear .. number of steps where linear interpolation is used */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_PINV_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: Create interpolating polynomials:\n",gen->genid); + fprintf(LOG,"%s:\t# iterations = %d\n",gen->genid,iter); + fprintf(LOG,"%s:\t# step size increased = %d (%g%%)\n",gen->genid,n_incr_h,(100.*n_incr_h)/iter); + fprintf(LOG,"%s:\t# step size decreased = %d (%g%%)\n",gen->genid,n_decr_h,(100.*n_decr_h)/iter); + fprintf(LOG,"%s:\t# linear = %d (%g%%)\n",gen->genid,n_use_linear,(100.*n_use_linear)/iter); + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); +} /* end of _unur_pinv_debug_create_table() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/pinv_info.ch b/vendor/unuran-1.11.0/src/methods/pinv_info.ch new file mode 100644 index 0000000..7eace2b --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/pinv_info.ch @@ -0,0 +1,162 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: pinv_info.c * + * * + * Routines for creating info strings. * + * * + ***************************************************************************** + * * + * Copyright (c) 2008 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_pinv_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = %s\n", + (gen->variant & PINV_VARIANT_PDF) ? "PDF" : "CDF"); + _unur_string_append(info," domain = (%g, %g)\n", DISTR.trunc[0],DISTR.trunc[1]); + _unur_string_append(info," center = %g", unur_distr_cont_get_center(distr)); + if (distr->set & UNUR_DISTR_SET_CENTER) + _unur_string_append(info, (distr->set & UNUR_DISTR_SET_CENTER_APPROX) + ? " [guess]\n" : "\n"); + else + _unur_string_append(info,(distr->set & UNUR_DISTR_SET_MODE ) + ? " [= mode]\n" : " [default]\n"); + + if (help) { + if ( !(distr->set & (UNUR_DISTR_SET_CENTER | UNUR_DISTR_SET_MODE )) ) + _unur_string_append(info,"\n[ Hint: %s ]\n", + "You may provide a point near the mode as \"center\"."); + } + _unur_string_append(info,"\n"); + + + /* method */ + _unur_string_append(info,"method: PINV (Polynomial interpolation based INVerse CDF)\n"); + _unur_string_append(info," order of polynomial = %d\n", GEN->order); + _unur_string_append(info," smoothness = %d ", GEN->smooth); + switch (GEN->smooth) { + case 0: _unur_string_append(info,"[continuous]\n"); break; + case 1: _unur_string_append(info,"[differentiable]\n"); break; + case 2: _unur_string_append(info,"[twice differentiable]\n"); break; + } + if (gen->variant & PINV_VARIANT_PDF) + _unur_string_append(info," use PDF + Lobatto integration %s\n", + (gen->set & PINV_SET_VARIANT) ? "" : "[default]"); + else + _unur_string_append(info," use CDF %s\n", + (gen->set & PINV_SET_VARIANT) ? "" : "[default]"); + if (gen->variant & PINV_VARIANT_UPOINTS) + _unur_string_append(info," Chebyshev points in u scale\n"); + _unur_string_append(info,"\n"); + + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," truncated domain = (%g,%g)\n",GEN->bleft,GEN->bright); + /* _unur_string_append(info," Prob(Xtailcutoff_left)); */ + /* _unur_string_append(info," Prob(X>domain) = %g\n", _unur_max(0,1.-GEN->tailcutoff_right)); */ + if (DISTR.cdf) { + double max_error=1.; double MAE=1.; + unur_pinv_estimate_error( gen, 10000, &max_error, &MAE ); + _unur_string_append(info," u-error <= %g (mean = %g)\n", max_error, MAE); + } + else { + _unur_string_append(info," u-error NA [requires CDF]\n"); + } + _unur_string_append(info, " [ u-resolution = %g ]\n",GEN->u_resolution); + + _unur_string_append(info," area below PDF = %18.17g\n", GEN->area); + _unur_string_append(info," # intervals = %d\n", GEN->n_ivs); + if (gen->variant & PINV_VARIANT_KEEPCDF) + _unur_string_append(info," # CDF table size = %d\n", _unur_lobatto_size_table(GEN->aCDF)); + + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + + _unur_string_append(info," order = %d ", GEN->order); + if (!(gen->set & PINV_SET_ORDER)) + _unur_string_append(info,"[default]"); + if (gen->set & PINV_SET_ORDER_COR) + _unur_string_append(info,"[corrected]"); + _unur_string_append(info,"\n"); + + _unur_string_append(info," smoothness = %d ", GEN->smooth); + if (!(gen->set & PINV_SET_SMOOTH)) + _unur_string_append(info,"[default]"); + if (gen->set & PINV_SET_SMOOTH_COR) + _unur_string_append(info,"[corrected]"); + _unur_string_append(info,"\n"); + + _unur_string_append(info," u_resolution = %g %s\n", GEN->u_resolution, + (gen->set & PINV_SET_U_RESOLUTION) ? "" : "[default]"); + + _unur_string_append(info," use_upoints = %s %s\n", + (gen->variant & PINV_VARIANT_UPOINTS) ? "TRUE" : "FALSE", + (gen->set & PINV_SET_UPOINTS) ? "" : "[default]"); + + _unur_string_append(info," boundary = (%g,%g) %s\n", GEN->bleft_par, GEN->bright_par, + (gen->set & PINV_SET_BOUNDARY) ? "" : "[default]"); + + _unur_string_append(info," search for boundary: left=%s, right=%s %s\n", + (GEN->sleft ? "TRUE":"FALSE"), (GEN->sright ? "TRUE":"FALSE"), + (gen->set & PINV_SET_BOUNDARY) ? "" : "[default]"); + + _unur_string_append(info," maximum number of interval = %d %s\n", GEN->max_ivs, + (gen->set & PINV_SET_MAX_IVS) ? "" : "[default]"); + + _unur_string_append(info," keep table of CDF values = %s %s\n", + (gen->variant & PINV_VARIANT_KEEPCDF) ? "TRUE" : "FALSE", + (gen->set & PINV_SET_KEEPCDF) ? "" : "[default]"); + + _unur_string_append(info,"\n"); + } + + + /* Hints */ + if (help) { + if ( GEN->order < MAX_ORDER ) + _unur_string_append(info,"[ Hint: %s ]\n", + "You can increase \"order\" to decrease #intervals"); + if (! (gen->set & PINV_SET_U_RESOLUTION) ) + _unur_string_append(info,"[ Hint: %s\n\t%s ]\n", + "You can decrease the u-error by decreasing \"u_resolution\".", + "(it is bounded by the machine epsilon, however.)"); + _unur_string_append(info,"\n"); + } + +} /* end of _unur_pinv_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/pinv_init.ch b/vendor/unuran-1.11.0/src/methods/pinv_init.ch new file mode 100644 index 0000000..0c46187 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/pinv_init.ch @@ -0,0 +1,521 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: pinv_init.c * + * * + * Routines for initialization and deletion of generator objects. * + * * + ***************************************************************************** + * * + * Copyright (c) 2008-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_pinv_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* params pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + _unur_check_NULL( GENTYPE,par,NULL ); + + /* check input */ + if ( par->method != UNUR_METH_PINV ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_PINV_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_pinv_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* check parameters */ + if (_unur_pinv_check_par(gen) != UNUR_SUCCESS) { + _unur_pinv_free(gen); return NULL; + } + + /* compute rescaling factor for PDF */ + /* (only used when logPDF is given) */ + /* Disabled! */ + /* We found that it is not such a good idea. */ + /* if (DISTR.logpdf != NULL && (gen->variant & PINV_VARIANT_PDF) ) { */ + /* double lfc = UNUR_UNUR_INFINITY; */ + + /* /\* use mode if available *\/ */ + /* if ( (gen->distr->set & UNUR_DISTR_SET_MODE) && */ + /* !_unur_FP_less(DISTR.mode,DISTR.domain[0]) && */ + /* !_unur_FP_greater(DISTR.mode,DISTR.domain[1]) ) { */ + /* lfc = (DISTR.logpdf)(DISTR.mode,gen->distr); */ + /* } */ + + /* /\* use center otherwise (or if logPDF(mode)==UNUR_INFINITY) *\/ */ + /* if (!_unur_isfinite(lfc)) */ + /* lfc = (DISTR.logpdf)(DISTR.center,gen->distr); */ + + /* /\* rescaling results in more evaluations of the logPDF, *\/ */ + /* /\* when the logPDF is approximately 0. *\/ */ + /* /\* so we only rescale the logPDF when it is too small. *\/ */ + /* if (lfc < -3.) */ + /* GEN->logPDFconstant = lfc; */ + /* } */ + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_pinv_debug_init_start(gen); +#endif + + /* 1. Preprocessing: */ + /* find interval for computing Newton interpolation */ + if (_unur_pinv_preprocessing(gen) != UNUR_SUCCESS) { + /* preprocessing failed */ +#ifdef UNUR_ENABLE_LOGGING + if (gen->debug) _unur_pinv_debug_init(gen,FALSE); +#endif + _unur_pinv_free(gen); return NULL; + } + + /* 2. Interpolation: */ + /* compute table for Newton interpolation */ + if (_unur_pinv_create_table(gen) != UNUR_SUCCESS) { +#ifdef UNUR_ENABLE_LOGGING + if (gen->debug) _unur_pinv_debug_init(gen,FALSE); +#endif + _unur_pinv_free(gen); return NULL; + } + + /* we do not need the table with CDF values any more. */ + /* thus we may free the allocated memory. */ + if (! (gen->variant & PINV_VARIANT_KEEPCDF)) + _unur_lobatto_free(&(GEN->aCDF)); + + /* make guide table */ + _unur_pinv_make_guide_table(gen); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_pinv_debug_init(gen,TRUE); +#endif + + /* o.k. */ + return gen; + +} /* end of _unur_pinv_init() */ + +/*---------------------------------------------------------------------------*/ + +/* int */ +/* _unur_pinv_reinit( struct unur_gen *gen ) */ +/* /\*----------------------------------------------------------------------*\/ */ +/* /\* re-initialize (existing) generator. *\/ */ +/* /\* *\/ */ +/* /\* parameters: *\/ */ +/* /\* gen ... pointer to generator object *\/ */ +/* /\* *\/ */ +/* /\* return: *\/ */ +/* /\* UNUR_SUCCESS ... on success *\/ */ +/* /\* error code ... on error *\/ */ +/* /\*----------------------------------------------------------------------*\/ */ +/* { */ +/* int rcode; */ + +/* /\* check parameters *\/ */ +/* if ( (rcode = _unur_pinv_check_par(gen)) != UNUR_SUCCESS) */ +/* return rcode; */ + +/* return UNUR_SUCCESS; */ +/* } /\* end of _unur_pinv_reinit() *\/ */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_pinv_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_PINV_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_pinv_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_PINV_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_pinv_getSAMPLE(gen); + gen->destroy = _unur_pinv_free; + gen->clone = _unur_pinv_clone; + /* gen->reinit = _unur_pinv_reinit; */ + + /* copy parameters into generator object */ + GEN->order = PAR->order; /* order of polynomial */ + GEN->smooth = PAR->smooth; /* smoothness parameter */ + GEN->u_resolution = PAR->u_resolution; /* maximal error in u-direction */ + GEN->n_extra_testpoints = PAR->n_extra_testpoints; /* number of extra test points for error estimate */ + GEN->bleft_par = PAR->bleft; /* border of computational domain */ + GEN->bright_par = PAR->bright; + GEN->sleft = PAR->sleft; /* whether to search for boundary */ + GEN->sright = PAR->sright; + GEN->max_ivs = PAR->max_ivs; /* maximum number of subintervals */ + + /* initialize variables */ + GEN->bleft = GEN->bleft_par; + GEN->bright = GEN->bright_par; + GEN->dleft = -UNUR_INFINITY; + GEN->dright = UNUR_INFINITY; + GEN->Umax = 1.; + GEN->iv = NULL; + GEN->n_ivs = -1; /* -1 indicates that there are no intervals at all */ + GEN->guide_size = 0; + GEN->guide = NULL; + GEN->area = DISTR.area; /* we use the value in the distribution object as first guess */ + /* GEN->logPDFconstant = 0.; rescaling constant for logPDF: Disabled */ + GEN->aCDF = NULL; /* pointer to approximate CDF */ + + /* allocate maximal array of intervals */ + /* [ Maybe we could move this into _unur_pinv_interval() ] */ + GEN->iv = _unur_xmalloc(GEN->max_ivs * sizeof(struct unur_pinv_interval) ); + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_pinv_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_pinv_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_pinv_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* smoothness parameter */ + switch (GEN->smooth) { + case 2: + if (GEN->order < 5) { + _unur_warning(gen->genid,UNUR_ERR_GENERIC,"order must be >= 5 when smoothness = 2"); + GEN->order = 5; + gen->set |= PINV_SET_ORDER_COR; + } + if (GEN->order % 3 != 2) { + _unur_warning(gen->genid,UNUR_ERR_GENERIC,"order must be 2 mod 3 when smoothness = 2"); + GEN->order = 2 + 3 * (GEN->order / 3); + gen->set |= PINV_SET_ORDER_COR; + } + + if (DISTR.pdf == NULL || DISTR.dpdf == NULL) { + _unur_warning(gen->genid,UNUR_ERR_DISTR_REQUIRED,"PDF and dPDF required for smoothness = 2 --> try smoothness=1 instead"); + GEN->smooth = 1; + gen->set |= PINV_SET_SMOOTH_COR; + } + else { + break; + } + + case 1: + if (GEN->order % 2 != 1) { + _unur_warning(gen->genid,UNUR_ERR_GENERIC,"order must be odd when smoothness = 1"); + GEN->order += 1; + gen->set |= PINV_SET_ORDER_COR; + } + if (DISTR.pdf == NULL) { + _unur_warning(gen->genid,UNUR_ERR_DISTR_REQUIRED,"PDF required --> use smoothness=0 instead"); + GEN->smooth = 0; + gen->set |= PINV_SET_SMOOTH_COR; + } + else { + break; + } + + case 0: + break; + + default: + _unur_warning(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,"smoothness must be 0, 1, or 2"); + GEN->smooth = 0; /* use default */ + } + + /* points for searching computational domain */ + GEN->bleft = _unur_max(GEN->bleft_par,DISTR.domain[0]); + GEN->bright = _unur_min(GEN->bright_par,DISTR.domain[1]); + + /* domain not truncated at init */ + DISTR.trunc[0] = DISTR.domain[0]; + DISTR.trunc[1] = DISTR.domain[1]; + + /* domain of distribution (used when x with PDF(x)=0 are found) */ + GEN->dleft = DISTR.domain[0]; + GEN->dright = DISTR.domain[1]; + + /* center of distribution */ + DISTR.center = unur_distr_cont_get_center(gen->distr); + if (DISTR.center < GEN->dleft || DISTR.center > GEN->dright) { + _unur_warning(gen->genid,UNUR_ERR_GENERIC, + "center moved into domain of distribution"); + DISTR.center = _unur_max(DISTR.center,GEN->dleft); + DISTR.center = _unur_min(DISTR.center,GEN->dright); + } + + /* check center of distribution */ + if ( (gen->variant & PINV_VARIANT_PDF ) && + /* (_unur_pinv_search_center(gen) != UNUR_SUCCESS) ) { */ + (_unur_distr_cont_find_center(gen->distr) != UNUR_SUCCESS) ) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, + "PDF(center) <= 0."); + return UNUR_ERR_GEN_CONDITION; + } + + /* there is no table of CDF values when the CDF is given */ + if (! (gen->variant & PINV_VARIANT_PDF)) + gen->variant &= ~PINV_VARIANT_KEEPCDF; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_pinv_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_pinv_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_pinv_gen*)clone->datap) + + struct unur_gen *clone; + int i; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_PINV_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* we do not need the table with CDF values */ + CLONE->aCDF = NULL; + + /* copy coefficients for Newton polynomial */ + CLONE->iv = _unur_xmalloc((GEN->n_ivs+1) * sizeof(struct unur_pinv_interval) ); + memcpy( CLONE->iv, GEN->iv, (GEN->n_ivs+1) * sizeof(struct unur_pinv_interval) ); + + for(i=0; i<=GEN->n_ivs; i++) { + CLONE->iv[i].ui = _unur_xmalloc( GEN->order * sizeof(double) ); + CLONE->iv[i].zi = _unur_xmalloc( GEN->order * sizeof(double) ); + memcpy( CLONE->iv[i].ui, GEN->iv[i].ui, GEN->order * sizeof(double) ); + memcpy( CLONE->iv[i].zi, GEN->iv[i].zi, GEN->order * sizeof(double) ); + } + + /* copy guide table */ + CLONE->guide = _unur_xmalloc( GEN->guide_size * sizeof(int) ); + memcpy( CLONE->guide, GEN->guide, GEN->guide_size * sizeof(int) ); + + return clone; + +#undef CLONE +} /* end of _unur_pinv_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_pinv_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_PINV ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_PINV_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free guide table */ + if (GEN->guide) free (GEN->guide); + + /* free array for subintervals of adaptive Gauss-Lobatto integration */ + _unur_lobatto_free(&(GEN->aCDF)); + + /* free tables of coefficients of interpolating polynomials */ + if (GEN->iv) { + for(i=0; i<=GEN->n_ivs; i++){ + free(GEN->iv[i].ui); + free(GEN->iv[i].zi); + } + free (GEN->iv); + } + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_pinv_free() */ + +/*****************************************************************************/ + +int +_unur_pinv_make_guide_table (struct unur_gen *gen) + /*----------------------------------------------------------------------*/ + /* make a guide table for indexed search */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i,j, imax; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_ERR_COOKIE); + + /* allocate blocks for guide table (if necessary). + (we allocate blocks for maximal guide table.) */ + GEN->guide_size = (int) (GEN->n_ivs * PINV_GUIDE_FACTOR); + if (GEN->guide_size <= 0) GEN->guide_size = 1; + GEN->guide = _unur_xrealloc( GEN->guide, GEN->guide_size * sizeof(int) ); + + /* maximum index for array of data */ + imax = GEN->n_ivs; + + /* create guide table */ + i = 0; + GEN->guide[0] = 0; + for( j=1; jguide_size ;j++ ) { + while(GEN->iv[i+1].cdfi/GEN->Umax < j/(double)GEN->guide_size && i < imax) + i++; + if (i >= imax) break; + GEN->guide[j]=i; + } + + /* check i */ + i = _unur_min(i,imax); + + /* if there has been an round off error, we have to complete the guide table */ + for( ; jguide_size ;j++ ) + GEN->guide[j] = i; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_pinv_make_guide_table() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_pinv_eval_PDF (double x, struct unur_gen *gen) + /*----------------------------------------------------------------------*/ + /* call to PDF. */ + /* if PDF(x) == UNUR_INFINITY (i.e., x is a pole of the PDF) */ + /* we compute PDF(x+dx) for a small dx instead. */ + /* */ + /* parameters: */ + /* x ... argument of PDF */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* PDF at x */ + /*----------------------------------------------------------------------*/ +{ + struct unur_distr *distr = gen->distr; + double fx, dx; + int i; + + for (i=1; i<=2; i++) { + /* we try two times: */ + /* one time for given x, the second time for x+dx. */ + + /* compute PDF(x) */ + if (DISTR.logpdf != NULL) { + fx = exp((DISTR.logpdf)(x,distr)); + /* scaling factor Disabled! */ + /* fx = exp((DISTR.logpdf)(x,distr) - GEN->logPDFconstant); */ + } + else + fx = (DISTR.pdf)(x,distr); + + /* check for pole (i.e., PDF(x)==UNUR_INFINITY) */ + if (fx >= UNUR_INFINITY) { + /* pole at x --> move x slightly */ + dx = 2.*fabs(x)*DBL_EPSILON; + dx = _unur_max(dx,2.*DBL_MIN); + x += ((x - GEN->bleft) < (GEN->bright - x)) ? dx : -dx; + } + + else /* not a pole */ + break; + } + + return fx; +} /* end of _unur_pinv_eval_PDF() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/pinv_newset.ch b/vendor/unuran-1.11.0/src/methods/pinv_newset.ch new file mode 100644 index 0000000..6989654 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/pinv_newset.ch @@ -0,0 +1,507 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: pinv_newset.c * + * * + * Routines for creating and changing parameter objects. * + * * + ***************************************************************************** + * * + * Copyright (c) 2008 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_pinv_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + + if (DISTR_IN.pdf == NULL && DISTR_IN.cdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF or CDF"); return NULL; } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_pinv_par) ); + COOKIE_SET(par,CK_PINV_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->order = 5L; /* order of polynomial */ + PAR->smooth = 0L; /* smoothness parameter */ + PAR->u_resolution = 1.0e-10; /* maximal error allowed in u-direction */ + PAR->bleft = -1.e100; /* left border of the computational domain */ + PAR->bright = 1.e100; /* right border of the computational domain */ + PAR->sleft = TRUE; /* whether to search for left boundary */ + PAR->sright = TRUE; /* whether to search for right boundary */ + PAR->max_ivs = PINV_DEFAULT_MAX_IVS; /* maximum number of subintervals */ + PAR->n_extra_testpoints = 0L; /* number of extra test points for error estimate */ + + par->method = UNUR_METH_PINV; /* method */ + par->variant = 0u; /* default variant: */ + if (DISTR_IN.pdf != NULL) + par->variant |= PINV_VARIANT_PDF; /* use PDF */ + /* else: use CDF */ + + par->set = 0u; /* indicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_pinv_init; + + return par; + +} /* end of unur_pinv_new() */ + +/*****************************************************************************/ + +int +unur_pinv_set_order( struct unur_par *par, int order) + /*----------------------------------------------------------------------*/ + /* Set order of Hermite interpolation. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* order ... order of interpolation polynome */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, PINV ); + + /* check new parameter for generator */ + if (order<3 || order>MAX_ORDER) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"order <3 or >17"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->order = order; + + /* changelog */ + par->set |= PINV_SET_ORDER; + + return UNUR_SUCCESS; + +} /* end of unur_pinv_set_order() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_pinv_set_smoothness( struct unur_par *par, int smooth) + /*----------------------------------------------------------------------*/ + /* set smoothness of interpolation polynomial. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* smooth ... smoothness parameter */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, PINV ); + + /* check new parameter for generator */ + if (smooth < 0L || smooth > 2L) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"smoothness must be 0, 1, or 2"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->smooth = smooth; + + /* changelog */ + par->set |= PINV_SET_SMOOTH; + + return UNUR_SUCCESS; + +} /* end of unur_pinv_set_smoothness() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_pinv_set_u_resolution( struct unur_par *par, double u_resolution ) + /*----------------------------------------------------------------------*/ + /* set maximal relative error in x */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object*/ + /* u_resolution ... maximal error in u */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, PINV ); + + /* check new parameter for generator */ + if (u_resolution > 1.001e-5) { + /* this is obviously an error */ + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"u-resolution too large --> use 1.e-5 instead"); + u_resolution = 1.e-5; + } + if (u_resolution < 0.999e-15 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"u-resolution too small --> use 1.e-15 instead"); + u_resolution = 1.e-15; + } + + /* store date */ + PAR->u_resolution = u_resolution; + + /* changelog */ + par->set |= PINV_SET_U_RESOLUTION; + + return UNUR_SUCCESS; + +} /* end of unur_pinv_set_u_resolutuion() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_pinv_set_extra_testpoints( struct unur_par *par, int n_points) + /*----------------------------------------------------------------------*/ + /* set number of additional test points for error estimate */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* n_points ... number of test points */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, PINV ); + + /* check new parameter for generator */ + if (n_points < 0) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of extra test point < 0"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->n_extra_testpoints = n_points; + + /* changelog */ + par->set |= PINV_SET_N_EXTRA_TP; + + return UNUR_SUCCESS; + +} /* end of unur_pinv_set_extra_testpoints() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_pinv_set_use_upoints( struct unur_par *par, int use_upoints ) + /*----------------------------------------------------------------------*/ + /* if TRUE, use Chebyshev points in u-scale. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* use_upoints ... boolean */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, PINV ); + + /* store variant */ + if (use_upoints) + par->variant |= PINV_VARIANT_UPOINTS; + else + par->variant &= ~PINV_VARIANT_UPOINTS; + + /* changelog */ + par->set |= PINV_SET_UPOINTS; + + return UNUR_SUCCESS; + +} /* end of unur_pinv_set_use_upoints() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_pinv_set_usepdf( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* Use PDF (if available) to compute approximate inverse CDF. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, PINV ); + + /* check function pointer */ + if (par->distr->data.cont.pdf == NULL) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF missing"); + return UNUR_ERR_PAR_SET; + } + + /* store variant (set USE_PDF flag) */ + par->variant |= PINV_VARIANT_PDF; + + /* changelog */ + par->set |= PINV_SET_VARIANT; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_pinv_set_usepdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_pinv_set_usecdf( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* Use CDF (if available) to compute approximate inverse CDF. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, PINV ); + + /* check function pointer */ + if (par->distr->data.cont.cdf == NULL) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"CDF missing"); + return UNUR_ERR_PAR_SET; + } + + /* store variant (remove USE_PDF flag) */ + par->variant &= ~PINV_VARIANT_PDF; + + /* changelog */ + par->set |= PINV_SET_VARIANT; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_pinv_set_usecdf() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_pinv_set_boundary( struct unur_par *par, double left, double right ) + /*----------------------------------------------------------------------*/ + /* set left and right boundary of computation interval */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* new boundary points must not be +/- UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, PINV ); + + /* check new parameter for generator */ + if (!_unur_FP_less(left,right)) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"domain"); + return UNUR_ERR_PAR_SET; + } + if (! (_unur_isfinite(left) && _unur_isfinite(right)) ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"domain (+/- UNUR_INFINITY not allowed)"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->bleft = left; + PAR->bright = right; + + /* changelog */ + par->set |= PINV_SET_BOUNDARY; + + return UNUR_SUCCESS; + +} /* end of unur_pinv_set_boundary() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_pinv_set_searchboundary( struct unur_par *par, int left, int right ) + /*----------------------------------------------------------------------*/ + /* set flag for boundary searching algorithm */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* left ... whether to search for left boundary point */ + /* right ... whether to search for right boundary point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, PINV ); + + /* store date */ + PAR->sleft = (left) ? TRUE : FALSE; + PAR->sright = (right) ? TRUE : FALSE; + + /* changelog */ + par->set |= PINV_SET_SEARCHBOUNDARY; + + return UNUR_SUCCESS; + +} /* end of unur_pinv_set_searchboundary() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_pinv_set_max_intervals( struct unur_par *par, int max_ivs ) + /*----------------------------------------------------------------------*/ + /* set maximum number of intervals */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* max_ivs ... maximum number of intervals */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, PINV ); + + /* check new parameter for generator */ + if (max_ivs < 100 || max_ivs > 1000000) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"maximum number of intervals < 100 or > 1000000"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->max_ivs = max_ivs; + + /* changelog */ + par->set |= PINV_SET_MAX_IVS; + + return UNUR_SUCCESS; + +} /* end of unur_pinv_set_max_intervals() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_pinv_get_n_intervals( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get number of intervals (or more precisely the number of nodes) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* number of intervals ... on success */ + /* 0 ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, 0 ); + _unur_check_gen_object( gen, PINV, 0 ); + return GEN->n_ivs; +} /* end of unur_pinv_get_n_intervals() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_pinv_set_keepcdf( struct unur_par *par, int keepcdf) + /*----------------------------------------------------------------------*/ + /* if TRUE, use do not discard table for integration. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* keepcdf ... boolean */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, PINV ); + + /* store variant */ + if (keepcdf) + par->variant |= PINV_VARIANT_KEEPCDF; + else + par->variant &= ~PINV_VARIANT_KEEPCDF; + + /* changelog */ + par->set |= PINV_SET_KEEPCDF; + + return UNUR_SUCCESS; + +} /* end of unur_pinv_set_keepcdf() */ + +/*****************************************************************************/ diff --git a/vendor/unuran-1.11.0/src/methods/pinv_newton.ch b/vendor/unuran-1.11.0/src/methods/pinv_newton.ch new file mode 100644 index 0000000..c200d63 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/pinv_newton.ch @@ -0,0 +1,977 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: pinv_newton.c * + * * + * Routines for Newton interpolating polynomial. * + * * + ***************************************************************************** + * * + * Copyright (c) 2008-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Compute coefficients for Newton polynomial **/ +/*****************************************************************************/ + +int +_unur_pinv_create_table( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Create table for Newton interpolation. */ + /* The computational domain must be already computed / given. */ + /* */ + /* parameters: */ + /* gen ... pointer generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double utol; /* tolerated maximum U-error */ + double maxerror; /* maximum U-error in a particular interval */ + double h; /* step size / length of intervals */ + int i; /* number of interval at work */ + int iter; /* number of iterations */ + int cont; /* whether we have to continue or loop */ + + int smooth; /* local smoothness parameter */ + int use_linear; /* whether we use linear interpolation instead of polynomials */ + int right_bd; /* whether we have reach right boundary */ + int use_upoints; /* whether we use Chebyshev points in u-scale */ + + double chebyshev[3][MAX_ORDER+1]; /* Chebyshev points */ + double xval[MAX_ORDER+1]; /* x-values for construction points for Newton polynomial */ + + int n_decr_h = 0; /* number of steps where h is decreased */ + int n_incr_h = 0; /* number of steps where h is increased */ + int n_use_linear = 0; /* number of steps where linear interpolation is used */ + + + /* check arguments */ + COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_ERR_COOKIE); + + /* tolerated U-error */ + utol = GEN->u_resolution * GEN->area * PINV_UERROR_CORRECTION; + + /* initialize step size for subintervals */ + h = (GEN->bright-GEN->bleft)/128.; + + /* initialize array of intervals: starting interval */ + if (_unur_pinv_interval( gen, 0, GEN->bleft, 0.) != UNUR_SUCCESS) + return UNUR_ERR_GEN_CONDITION; + + /* compute construction points for Chebyshev points */ + for (smooth=0; smooth<=GEN->smooth; ++smooth) + _unur_pinv_chebyshev_points(chebyshev[smooth],GEN->order,smooth); + + /* initialize counter and control variables */ + i = 0; /* start at interval 0 ;-) */ + cont = TRUE; /* there is at least one iteration */ + use_linear = FALSE; /* do not use linear interpolation; use polynomial */ + + use_upoints = FALSE; /* do not use Chebyshev points in u-scale. + * we use this variable to toggle between + * Chebyshev points in x-scale and u-scale. */ + + /* compute intervals and coefficients of Newton polynomials */ + for (iter=0; cont ; iter++) { + + /* check number of iterations */ + if (iter >= PINV_MAX_ITER_IVS) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, + "maximum number of iterations exceeded"); + return UNUR_ERR_GEN_CONDITION; + } + + /* right boundary reached ? */ + if(!_unur_FP_less(GEN->iv[i].xi+h,GEN->bright)) { + if (! (GEN->iv[i].xi+h < GEN->bright)) { + h = GEN->bright - GEN->iv[i].xi; + } + cont = FALSE; /* we probably can stop after this iteration */ + right_bd = TRUE; /* we have reached right boundary */ + } + else { + right_bd = FALSE; + } + + /** --- compute interpolating polynomial --- **/ + + /* set local smoothness parameter */ + smooth = GEN->smooth; + + /* we do not use linar interpolation unless everything else fails */ + use_linear = FALSE; + + switch (smooth) { + + case 2: + _unur_pinv_newton_cpoints(xval, GEN->order, GEN->iv+i, h, chebyshev[smooth], smooth, use_upoints); + if (_unur_pinv_newton_create(gen,GEN->iv+i,xval,smooth) == UNUR_SUCCESS) + break; + + /* failed: try less smooth interpolation */ + smooth = 1; + /* FALLTHROUGH */ + + case 1: + if (GEN->order % 2 == 1) { + /* order must be odd when smoothness equals 1 */ + _unur_pinv_newton_cpoints(xval, GEN->order, GEN->iv+i, h, chebyshev[smooth], smooth, use_upoints); + if (_unur_pinv_newton_create(gen,GEN->iv+i,xval,smooth) == UNUR_SUCCESS) + break; + } + + /* failed: try less smooth interpolation */ + smooth = 0; + /* FALLTHROUGH */ + + case 0: + default: + /* compute Newton interpolation polynomial */ + _unur_pinv_newton_cpoints(xval, GEN->order, GEN->iv+i, h, chebyshev[smooth], smooth, use_upoints); + if (_unur_pinv_newton_create(gen,GEN->iv+i,xval,smooth) == UNUR_SUCCESS) + break; + + /* failed: try linear interpolation */ + /* FALLTHROUGH */ + + case -1: + /* area below PDF = 0 or serious round-off errors */ + /* --> try linear interpolation */ + use_linear = TRUE; + } + + if (use_linear) { + + /* use linear interpolation */ + ++n_use_linear; + + if (_unur_pinv_linear_create(gen,GEN->iv+i,xval) != UNUR_SUCCESS) { + + /* area below PDF == 0. */ + if (i==0) { /* left boundary (first interval) */ + /* cut left boundary */ + GEN->bleft = GEN->iv[i].xi + h; + GEN->iv[i].xi = GEN->bleft; + continue; /* outer loop */ + } + else if (right_bd) { /* right boudary */ + GEN->bright = GEN->iv[i].xi; + cont = FALSE; + break; /* outer loop */ + } + else { + /* -- no idea what to do now --> abort */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, + "PDF too close to 0 on relevant part of domain --> abort"); + return UNUR_ERR_GEN_CONDITION; + } + } + } + + /** --- check u-error for interpolating polynomial --- **/ + + /* estimate error of Newton interpolation */ + if (use_linear) { + maxerror = _unur_pinv_linear_maxerror(gen,&(GEN->iv[i])); + } + else { + maxerror = _unur_pinv_newton_maxerror(gen,&(GEN->iv[i]),xval); + } + + if (!(maxerror <= utol)) { + /* error too large: reduce step size */ + h *= (maxerror > 4.*utol) ? 0.81 : 0.9; + cont = TRUE; /* we need another iteration */ + ++n_decr_h; + use_upoints = FALSE; + continue; + } + + /* error is below threshold */ + + if (gen->variant & PINV_VARIANT_UPOINTS) { + /* compute polynomial again with (approximate) Chebyshev points in u-scale */ + if (!use_upoints && !use_linear ) { + use_upoints = TRUE; + cont = TRUE; + continue; + } + use_upoints = FALSE; + } + + /* error is below threshold --> continue with next interval */ + + /* create next interval */ + if ( _unur_pinv_interval( gen, i+1, GEN->iv[i].xi+h, + GEN->iv[i].cdfi +(GEN->iv)[i].ui[GEN->order-1]) + /* cdfi holds CDF value at the left border of the interval, */ + /* ui[order-1] holds area below PDF in interval, i.e. CDF(right) - CDF(left) */ + != UNUR_SUCCESS ) + return UNUR_ERR_GEN_CONDITION; + + /* increase step size for very small errors */ + if (maxerror < 0.3*utol) { + h *= (maxerror < 0.1*utol) ? 2. : 1.2; + ++n_incr_h; + } + + /* continue with next interval */ + i++; + } + + /* update size of array (finish list) */ + _unur_pinv_lastinterval(gen); + + /* set range for uniform random numbers */ + /* Umin = 0, Umax depends on area below PDF, tail cut-off points and round-off errors */ + GEN->Umax = GEN->iv[GEN->n_ivs].cdfi; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & PINV_DEBUG_SEARCHBD) + _unur_pinv_debug_create_table(gen,iter,n_incr_h,n_decr_h,n_use_linear); +#endif + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_pinv_create_table() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_pinv_chebyshev_points (double *pt, int order, int smooth) + /*----------------------------------------------------------------------*/ + /* [2a.] Compute Chebyshev points. */ + /* */ + /* parameters: */ + /* pt ... pointer to array of size (order+1) for storing points */ + /* order ... order of polynomial */ + /* smooth ... smoothness parameter */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ + /* Chebyshev points rescaled such that the first and last point is */ + /* moved into 0 and 1, resp. */ + /* We need (order+1) points for a polynomial of given 'order'. */ + /* For smooth interpolant we need multiple points: */ + /* smooth == 0: single points */ + /* smooth == 1: double points */ + /* smooth == 2: tripple points */ + /*----------------------------------------------------------------------*/ +{ + int i,k; + + int n_pt = (order+1)/(smooth+1); /* number of points */ + double phi = M_PI*0.5/n_pt; /* constant for computing Chebyshev points */ + + pt[0] = 0.; + for (i=1; i<=order; i++) { + k = i / (smooth+1); + if (kui[order-1]; + for(k=0; k<=order; k++) + xval[k] = (k % (smooth+1)) + ? xval[k-1] + : iv->xi + _unur_pinv_newton_eval(hu * chebyshev[k], iv->ui, iv->zi, order); + } + + else { + /* use Chebyshev points in x-scale. */ + for(k=0; k<=order; k++) { + xval[k] = (k % (smooth+1)) + ? xval[k-1] + : iv->xi + h * chebyshev[k]; + } + } + + return UNUR_SUCCESS; +} /* end of _unur_pinv_newton_cpoints() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_pinv_newton_create (struct unur_gen *gen, struct unur_pinv_interval *iv, + double *xval, int smooth) + /*----------------------------------------------------------------------*/ + /* 2a. Compute coefficients for Newton interpolation within a */ + /* subinterval of the domain of the distribution. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to current interval */ + /* xval ... x-values for constructing polynomial */ + /* smooth ... smoothness parameter */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double fx = -1.; /* PDF at x (-1. --> PDF unknown) */ + double *ui = iv->ui; /* u-values for Newton interpolation */ + double *zi = iv->zi; /* coefficients of Newton interpolation */ + double xi, dxi; /* boundary and length of i-th subinterval */ + double area; /* integral of PDF over subinterval */ + int i,k; /* auxiliary variables */ + + /* check arguments */ + COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_FAILURE); + COOKIE_CHECK(iv,CK_PINV_IV,UNUR_FAILURE); + + /* compute coefficients of interpolating polynomial */ + + /* first step: + * compute values u_i of nodes and first differences, i.e., + * ( CDF^{-1}(u[i]) - CDF^{-1}(u[i-1]) ) / (u[i] - u[i-1]) + * = (x[i] - x[i-1]) / (u[i] - u[i-1]) + */ + for(i=0; iorder; i++) { + + /* left boundary and length of subinterval for integration */ + xi = xval[i]; + + if (smooth < 1L || !_unur_FP_same(xval[i],xval[i+1])) { + /* use differences */ + dxi = xval[i+1]-xval[i]; + + /* compute integral of PDF in interval (xi,xi+dxi) */ + area = _unur_pinv_Udiff(gen, xi, dxi, &fx); + + if (_unur_iszero(area)) { + return UNUR_ERR_SILENT; + } + + /* construction points for interpolating polynomial for CDF^{-1} */ + ui[i] = (i>0) ? (ui[i-1]+area) : area; + /* divided differences of values of CDF^{-1} */ + zi[i] = dxi/area; + } + else { + /* use derivative: + * [F^{-1}(u)]' = 1/f(x) where x=F^{-1}(u) + */ + ui[i] = (i>0) ? ui[i-1] : 0.; + zi[i] = 1./PDF(xi); + } + } + /* Remark: ui[GEN->order-1] is the probability of the interval */ + + /* compute second divided differences. */ + /* k = 1; */ + for(i=GEN->order-1; i>=1; i--) { + if (smooth < 2L || !_unur_FP_same(zi[i],zi[i-1])) { + /* use differences */ + zi[i] = (i>1) + ? (zi[i]-zi[i-1]) / (ui[i]-ui[i-2]) + : (zi[1]-zi[0]) / ui[1]; + } + else { /* smooth >= 2L */ + /* use second derivative: + * [F^{-1}(u)]" = -f'(x) / f(x)^3 where x=F^{-1}(u) + */ + /* however, this requires the derivative of the PDF */ + zi[i] = (DISTR.dpdf != NULL) ? (-0.5 * dPDF(xval[i]) * pow(zi[i],3)) : UNUR_INFINITY; + } + } + + /* compute all other divided differences. */ + for(k=2; korder; k++) { + for(i=GEN->order-1; i>k; i--) { + zi[i] = (zi[i]-zi[i-1]) / (ui[i]-ui[i-(k+1)]); + } + zi[k] = (zi[k]-zi[k-1]) / ui[k]; + } + + /* check result */ + for (i=0; iorder; i++) { + if (!_unur_isfinite(zi[i])) { + return UNUR_ERR_SILENT; + } + } + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_pinv_newton_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_pinv_linear_create (struct unur_gen *gen, struct unur_pinv_interval *iv, + double *xval) + /*----------------------------------------------------------------------*/ + /* [2a.] Compute coefficients for linear interpolation within a */ + /* subinterval of the domain of the distribution. */ + /* The coefficients are stored in the array for Newton interpolation */ + /* of order GEN->order where the coefficients of the higher order terms */ + /* are set to 0. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to current interval */ + /* xval ... x-values for constructing polynomial as used for */ + /* _unur_pinv_newton_create */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double *ui = iv->ui; /* u-values for Newton interpolation */ + double *zi = iv->zi; /* coefficients of Newton interpolation */ + double x0, x1; /* lower and upper boundary point of interval */ + double area; /* integral of PDF over subinterval */ + int i; /* auxiliary variable */ + + /* boundary of interval */ + x0 = xval[0]; + x1 = xval[GEN->order]; + + /* set all coefficents of the Newton polynomial to 0. */ + for (i=0; iorder; i++) { + ui[i] = zi[i] = 0.; + } + + /* area below PDF */ + area = _unur_pinv_Udiff(gen, x0, x1-x0, NULL); + + /* zi[0] contains the slope of the polynomial */ + zi[0] = (x1 - x0) / area; + + /* ui[GEN->order-1] stores the probability of the interval */ + ui[GEN->order-1] = area; + + /* check result */ + if (!_unur_isfinite(zi[0])) + return UNUR_ERR_GEN_CONDITION; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_pinv_linear_create() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_pinv_newton_eval ( double q, double *ui, double *zi, int order ) + /*----------------------------------------------------------------------*/ + /* 2b. evaluate Newton interpolation polynomial using Horner scheme. */ + /* */ + /* parameters: */ + /* q ... argument */ + /* ui ... coefficients of polynomial (increasing order) */ + /* zi ... coefficients of polynomial (increasing order) */ + /* order ... order of polynomial */ + /* */ + /* return: */ + /* value of interpolating polynomial at u=q */ + /*----------------------------------------------------------------------*/ +{ + int k; + double chi; + + chi = zi[order-1]; + for (k=order-2; k>=0; k--) + chi = chi*(q-ui[k])+zi[k]; + + return (chi*q); +} /* end of _unur_pinv_newton_eval() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_pinv_newton_maxerror (struct unur_gen *gen, struct unur_pinv_interval *iv, double *xval) + /*----------------------------------------------------------------------*/ + /* 2c. Estimate maximal error of Newton interpolation in subinterval. */ + /* In addition it makes a simple check for monotonicity of the */ + /* inverse CDF. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to current interval */ + /* xval ... x-values for constructing polynomial */ + /* */ + /* return: */ + /* estimated maximal u-error, or */ + /* >1000 whenever the inverse CDF is not monotone */ + /*----------------------------------------------------------------------*/ +{ + double x0 = iv->xi; /* left boundary point of interval */ + double *ui = iv->ui; /* u-values for Newton interpolation */ + double *zi = iv->zi; /* coefficient of Newton interpolation */ + + double maxerror = 0.; /* maximum error */ + double uerror; /* error for given U value */ + double x; /* x = CDF^{-1}(U) */ + double u; /* u = CDF(x) */ + + double testu[MAX_ORDER]; /* array of U values for testing */ + int i; /* aux variable */ + + /* check arguments */ + COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_FAILURE); + COOKIE_CHECK(iv,CK_PINV_IV,UNUR_FAILURE); + + /* get U values for test (points with maximal worst case error) */ + _unur_pinv_newton_testpoints(testu,ui,GEN->order); + + /* calculate the max u-error at the test points */ + for(i=0; iorder; i++) { + + if (_unur_FP_is_infinity(testu[i])) { + /* there is no need to run the test at such a point */ + continue; + } + + /* inverse CDF for U test point */ + x = _unur_pinv_newton_eval(testu[i], ui, zi, GEN->order); + + /* check for monotonicity (non-linear case) */ + if (! (xval[i] <= x0+x && x0+x <= xval[i+1]) ) + if (! _unur_FP_same(xval[i], xval[i+1])) + /* not monotone */ + return DBL_MAX; + + /* estimate CDF for interpolated x value */ + if (i==0 || xval==NULL) + u = _unur_pinv_Udiff(gen, x0, x, NULL); + else + u = ui[i-1] + _unur_pinv_Udiff(gen, xval[i], x+x0-xval[i], NULL); + + /* check u-value */ + if (!_unur_isfinite(u)) + return UNUR_INFINITY; + + /* compute u-error */ + uerror = fabs(u - testu[i]); + + /* update maximal error */ + if (uerror>maxerror) maxerror = uerror; + } + + /* we have an analytical test for cubic Hermite interpolation */ + if (GEN->order == 3 && GEN->smooth==1 && xval!=NULL && + ! _unur_pinv_cubic_hermite_is_monotone(gen,ui,zi,xval)) + /* not monotone */ + return 1003.; + + /* compute u-error at extra test points */ + if (GEN->n_extra_testpoints > 0) { + uerror = _unur_pinv_maxerror_extra(gen, iv, xval); + if (uerror>maxerror) maxerror = uerror; + } + + /* return maximal observed u-error */ + return maxerror; +} /* end of _unur_pinv_newton_maxerror() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_pinv_maxerror_extra (struct unur_gen *gen, struct unur_pinv_interval *iv, double *xval) + /*----------------------------------------------------------------------*/ + /* 2c. Estimate maximal error of Newton interpolation in subinterval. */ + /* In addition it makes a simple check for monotonicity of the */ + /* inverse CDF. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to current interval */ + /* xval ... x-values for constructing polynomial */ + /* */ + /* return: */ + /* estimated maximal u-error, or */ + /* >1000 whenever the inverse CDF is not monotone */ + /*----------------------------------------------------------------------*/ +{ + double x0 = iv->xi; /* left boundary point of interval */ + double *ui = iv->ui; /* u-values for Newton interpolation */ + double *zi = iv->zi; /* coefficient of Newton interpolation */ + + double maxerror = 0.; /* maximum error */ + double uerror; /* error for given U value */ + double x; /* x = CDF^{-1}(U) */ + double u; /* u = CDF(x) */ + + int i,j; /* aux variables */ + + /* for generating equidistributed points */ + double u0, du; + int n_testu; + double testu; + + /* check arguments */ + COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_FAILURE); + COOKIE_CHECK(iv,CK_PINV_IV,UNUR_FAILURE); + + /* calculate the max u-error in subinterval */ + for(i=0; iorder; i++) { + + /* check for subintervals of length 0 */ + if ( (i==0 && _unur_iszero(ui[0])) || + (i>0 && _unur_FP_same(ui[i-1],ui[i])) ) { + /* nothing to do */ + continue; + } + + /* we use equidistributed points */ + n_testu = GEN->n_extra_testpoints; + u0 = (i==0) ? 0. : ui[i-1]; + du = (ui[i] - u0) / (n_testu + 1.); + + /* check for each of the equidistributed points */ + for(j=1; j < n_testu; j++) { + + /* test ppint */ + testu = u0 + j * du; + + /* inverse CDF for U test point */ + x = _unur_pinv_newton_eval(testu, ui, zi, GEN->order); + + /* estimate CDF for interpolated x value */ + u = u0 + _unur_pinv_Udiff(gen, xval[i], x+x0-xval[i], NULL); + + /* check u-value */ + if (!_unur_isfinite(u)) + return UNUR_INFINITY; + + /* compute u-error */ + uerror = fabs(u - testu); + + /* update maximal error */ + if (uerror>maxerror) maxerror = uerror; + } + } + + /* return maximal observed u-error */ + return maxerror; + +} /* end of _unur_pinv_maxerror_extra() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_pinv_linear_maxerror (struct unur_gen *gen, struct unur_pinv_interval *iv) + /*----------------------------------------------------------------------*/ + /* 2c. Estimate maximal error of _linear_ interpolation in subinterval. */ + /* In addition it makes a simple check for monotonicity of the */ + /* inverse CDF. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to current interval */ + /* */ + /* return: */ + /* estimated maximal u-error, or */ + /* >1000 whenever the inverse CDF is not monotone */ + /*----------------------------------------------------------------------*/ +{ + double x0 = iv->xi; /* left boundary point of interval */ + double *ui = iv->ui; /* u-values for Newton interpolation */ + double *zi = iv->zi; /* coefficient of Newton interpolation */ + + double maxerror = 0.; /* maximum error */ + double uerror; /* error for given U value */ + double du, tu; /* points (in u-scale) for estimating u-error */ + double x; /* x = CDF^{-1}(U) */ + double u; /* u = CDF(x) */ + + int i; /* aux variable */ + + /* check arguments */ + COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_FAILURE); + COOKIE_CHECK(iv,CK_PINV_IV,UNUR_FAILURE); + + /* check for monotonicity (linear case) */ + if (zi[0] < 0.) { + /* not monotone */ + return 1001.; + } + + /* get distance between test points for test */ + /* we use equidistributed points */ + du = ui[(GEN->order)-1] / (GEN->order+1); /* distance between points */ + + /* calculate the max u-error at the test points */ + for(i=0; iorder; i++) { + + /* test point */ + tu = (i+0.5) * du; + + /* inverse CDF for U test point */ + x = _unur_pinv_newton_eval(tu, ui, zi, GEN->order); + + /* estimate CDF for interpolated x value */ + /* if (i==0 || xval==NULL) */ + u = _unur_pinv_Udiff(gen, x0, x, NULL); + /* else */ + /* u = ui[i-1] + _unur_pinv_Udiff(gen, xval[i], x+x0-xval[i], NULL); */ + + /* check u-value */ + if (!_unur_isfinite(u)) + return UNUR_INFINITY; + + /* compute u-error */ + uerror = fabs(u - tu); + + /* update maximal error */ + if (uerror>maxerror) maxerror = uerror; + } + + /* return maximal observed u-error */ + return maxerror; +} /* end of _unur_pinv_linear_maxerror() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_pinv_newton_testpoints (double *utest, double *ui, int order) + /*----------------------------------------------------------------------*/ + /* [2c.] calculates the local maxima of the polynomial. */ + /* used as control points for error estimate. */ + /* */ + /* parameters: */ + /* utest ... pointer to array for storing control points */ + /* ui ... u-values of interpolation */ + /* order ... order of interpolation polynomial */ + /* */ + /* return: */ + /* u-values of control points in the array utest */ + /* */ + /* remark: */ + /* a test point is set to INFINITY if there is no need to use */ + /* the corresponding point */ + /*----------------------------------------------------------------------*/ +{ + int k,j,i; + double sum, qsum,x; + + /* compute approximate maxima of error polynomial */ + for(k=0; k0 && _unur_FP_same(ui[k-1],ui[k])) ) { + /* utest[k] = ui[k]; */ + /* there is no u-error at the nodes of the Newton interpolation */ + utest[k] = UNUR_INFINITY; + continue; + } + + /* first approximation: use mean of consecuting construction points */ + x = (k>0) ? 0.5*(ui[k-1]+ui[k]) : 0.5*ui[k]; + + /* make two iterations for root finding */ + for(j=1; j<=2; j++) { + sum = 1./x; + qsum = sum*sum; + for(i=0; i= GEN->max_ivs) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, + "maximum number of intervals exceeded"); + return UNUR_ERR_GEN_CONDITION; + } + + /* set values */ + iv = GEN->iv+i; /* pointer to interval */ + iv->xi = x; /* left boundary of interval */ + iv->cdfi = cdfx; /* CDF at left boundary */ + COOKIE_SET(iv,CK_PINV_IV); + + /* allocate space for coefficients for Newton interpolation */ + iv->ui = _unur_xmalloc( GEN->order * sizeof(double) ); + iv->zi = _unur_xmalloc( GEN->order * sizeof(double) ); + + /* update size of array (number of intervals) */ + GEN->n_ivs = i; + + /* set bookmark in table of integral values */ + _unur_lobatto_find_linear(GEN->aCDF,x); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_pinv_interval() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_pinv_lastinterval( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* update size of array and set all uninitialized values to 0. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double *ui, *zi; + int i; + + /* pointer to last interval */ + struct unur_pinv_interval *last_iv = GEN->iv + GEN->n_ivs; + ui = last_iv->ui; + zi = last_iv->zi; + + /* update size of array */ + GEN->iv = _unur_xrealloc( GEN->iv, (GEN->n_ivs+1) * sizeof(struct unur_pinv_interval) ); + + /* set all entries ui and zi in very last interval to 0 */ + for (i=0; iorder; i++) { + ui[i] = 0.; + zi[i] = 0.; + } + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_pinv_lastinterval() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/pinv_prep.ch b/vendor/unuran-1.11.0/src/methods/pinv_prep.ch new file mode 100644 index 0000000..dd52fa9 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/pinv_prep.ch @@ -0,0 +1,912 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: pinv_prep.c * + * * + * Routines for preprocessing steps. * + * * + ***************************************************************************** + * * + * Copyright (c) 2008-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Preprocessing **/ +/*****************************************************************************/ + +int +_unur_pinv_preprocessing (struct unur_gen *gen) + /*----------------------------------------------------------------------*/ + /* 1. Find computational domain and compute PDF area. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double area_approx; + + if (gen->variant & PINV_VARIANT_PDF) { + /* 1a. Estimate computationally relevant domain (support) of PDF */ + if (_unur_pinv_relevant_support(gen) != UNUR_SUCCESS) + return UNUR_FAILURE; + + /* 1b. Compute area below PDF over relevant domain approximately. */ + if (_unur_pinv_approx_pdfarea(gen) != UNUR_SUCCESS) + return UNUR_FAILURE; + area_approx = GEN->area; /* store for checking domain */ + + /* 1c. Compute computational domain where inverse CDF is approximated */ + if (_unur_pinv_computational_domain(gen) != UNUR_SUCCESS) + return UNUR_FAILURE; + + /* 1d. Compute area below PDF with requested accuracy and */ + /* store intermediate results from adaptive integration. */ + if (_unur_pinv_pdfarea(gen) != UNUR_SUCCESS) + return UNUR_FAILURE; + + /* check area below PDF: it should not be (much) smaller than the approximate one */ + if (GEN->area < 0.99 * area_approx) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"integration of pdf: numerical problems with cut-off points of computational domain"); + return UNUR_FAILURE; + } + } + + else { /* use CDF */ + + /* 1c. Compute computational domain where inverse CDF is approximated */ + if (_unur_pinv_computational_domain_CDF(gen) != UNUR_SUCCESS) + return UNUR_FAILURE; + } + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_pinv_preprocessing() */ + + +/*****************************************************************************/ +/** Preprocessing when PDF is given **/ +/*****************************************************************************/ + +int +_unur_pinv_relevant_support ( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* 1a. Estimate computationally relevant domain (support) of PDF */ + /* (finite interval where PDF is above some threshold value). */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double fb; + + /* check PDF at boudary */ + if(GEN->sleft) { + /* compute PDF at boundary */ + fb = PDF(GEN->dleft); + if (fb > 1.e-20 && fb < 1.e300) { + /* PDF does neither vanish nor is it infinity: */ + /* use boundary of given domain of distribution for */ + /* computational domain. */ + GEN->bleft = GEN->dleft; + /* there is no need for further searching */ + GEN->sleft = FALSE; + } + /** FIXME: throw error if fb is not finite! **/ + } + + /* same for right hand boundary */ + if(GEN->sright) { + fb = PDF(GEN->dright); + if (fb > 1.e-20 && fb < 1.e300) { + GEN->bright = GEN->dright; + GEN->sright = FALSE; + } + } + + /* search for interval of computational relevance (if required) */ + if(GEN->sleft) { + GEN->bleft = _unur_pinv_searchborder(gen, DISTR.center, GEN->bleft, + &(GEN->dleft), &(GEN->sleft) ); + if (!_unur_isfinite(GEN->bleft)) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"Cannot get left boundary of relevant domain."); + return UNUR_ERR_GEN_CONDITION; + } + } + + if(GEN->sright) { + GEN->bright = _unur_pinv_searchborder(gen, DISTR.center, GEN->bright, + &(GEN->dright), &(GEN->sright) ); + if (!_unur_isfinite(GEN->bright)) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"Cannot get right boundary of relevant domain."); + return UNUR_ERR_GEN_CONDITION; + } + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & PINV_DEBUG_SEARCHBD) + _unur_pinv_debug_relevant_support(gen); +#endif + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_pinv_relevant_support() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_pinv_searchborder (struct unur_gen *gen, double x0, double bound, + double *dom, int *search) + /*----------------------------------------------------------------------*/ + /* [1a.] Find left or right hand border of relevant domain. */ + /* */ + /* Calculate domain of computational relevant region. */ + /* Start at 'x0' and search towards 'bound'. */ + /* The boundary points of this domain are approximately given as */ + /* PDF(x0) * PINV_PDFLLIM */ + /* */ + /* As a side effect the support of the distribution is shrinked if */ + /* points with PDF(x)=0 are found. */ + /* If in addition a discontinuity is detected then the exact position */ + /* (up to machine precision) of the boundary of the support of the PDF */ + /* is located via interval bisection. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* x0 ... starting point for searching boudary */ + /* PDF(x0) must not be too small */ + /* bound ... stop searching at this point */ + /* dom ... pointer to boundary of domain / support of distribution */ + /* search ... pointer to boolean that indicates whether we have to */ + /* search for cut-off points. The boolean is set to FALSE */ + /* if a discontinuity is found at the boundary. */ + /* */ + /* return: */ + /* boundary point */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double x; /* current and previous searching point */ + double xs, xl; /* point where PDF is less than and larger than threshold */ + double fx; /* PDF at x */ + double fs, fl; /* PDF at xs and xl */ + double fllim; /* threshold value */ + double fulim; /* threshold for detecting discontinuity at boundary */ + + /* threshold value where we stop searching */ + fllim = PDF(x0) * PINV_PDFLLIM; + fulim = 1.e4 * fllim; + + /* we already have checked PDF(center). but who knowns. */ + if (fllim <= 0.) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(center) too small"); + return UNUR_INFINITY; + } + + /* starting point */ + xl = x0; + fl = UNUR_INFINITY; + x = _unur_arcmean(x0,bound); + + /* find points where PDF values bracket threshold: */ + /* fs = PDF(xs) <= fllim <= PDF(xl) = fl */ + while ( (fx=PDF(x)) > fllim ) { + if (_unur_FP_same(x,bound)) + return bound; + xl = x; fl = fx; + x = _unur_arcmean(x,bound); + } + xs = x; fs = fx; + + /* check sign */ + if (fx < 0.) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) < 0"); + return UNUR_INFINITY; + } + + /* decrease length of bracket if necessary */ + while (!_unur_FP_same(xs,xl)) { + + /* truncate domain if possible */ + if (_unur_iszero(fs)) { + *dom = xs; + } + + /* new point */ + x = xs/2. + xl/2.; + fx = PDF(x); + + if (fx < 0.) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) < 0"); + return UNUR_INFINITY; + } + + /* check PDF at new point */ + if (fx < fllim) { + /* update bracket */ + xs = x; fs = fx; + } + else { + if (fl > fulim) { + /* assume discontinuity at boundary -> update bracket */ + xl = x; fl = fx; + } + else { + /* assume smooth PDF -> stop and return point */ + return x; + } + } + } + + /* since we have already found boundary point, we can use this */ + /* for the tail cut-off point. Thus we switch off further searching. */ + *search = FALSE; + + /* return point */ + return xl; + +} /* end of _unur_pinv_searchborder() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_pinv_approx_pdfarea (struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* 1b. Compute area below PDF over relevant domain approximately. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* Remark: */ + /* The user can also provide the area below the PDF. */ + /* However, then we probably need not method PINV */ + /*----------------------------------------------------------------------*/ +{ + double tol; /* tolerated integration error */ + int i; /* number of trials */ + int res = UNUR_SUCCESS; /* exit code of subroutine */ + + /* we might need two trials */ + for (i=1; i<=2; i++) { + + /* we only need a rough approximation of the area below the PDF. */ + /* for the tolerated absolute integration error we assume that */ + /* it is not "too far" from 1 or the value provides by the user */ + /* (if given), respectively. */ + tol = PINV_UERROR_AREA_APPROX * GEN->area; + + /* check center of distribution */ + DISTR.center = _unur_max(DISTR.center, GEN->bleft); + DISTR.center = _unur_min(DISTR.center, GEN->bright); + + /* compute area approximately */ + GEN->area = + _unur_lobatto_adaptive(_unur_pinv_eval_PDF, gen, + GEN->bleft, DISTR.center - GEN->bleft, tol, NULL); + if (_unur_isfinite(GEN->area)) + GEN->area += + _unur_lobatto_adaptive(_unur_pinv_eval_PDF, gen, + DISTR.center, GEN->bright - DISTR.center, tol, NULL); + + /* check estimated area */ + if ( !_unur_isfinite(GEN->area) || _unur_iszero(GEN->area) ) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot approximate area below PDF"); + res = UNUR_FAILURE; + break; + } + + /* The tolerated integration error is relative to the PDF area. + * For the first trial we have used area=1 (or the value given by the user) + * as a first guess. + * However, we have to check whether this guess is large enough, + * since otherwise the relative integration error is too large. + */ + if (GEN->area > 1.e-2) { + /* relative integration error is sufficiently small */ + break; + } + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & PINV_DEBUG_SEARCHBD) + _unur_pinv_debug_pdfarea(gen,TRUE); +#endif + + return res; + +} /* end of _unur_pinv_approx_pdfarea() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_pinv_pdfarea (struct unur_gen *gen) + /*----------------------------------------------------------------------*/ + /* 1d. Compute area below PDF with requested accuracy and */ + /* store intermediate results from adaptive integration. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* Remark: */ + /* The user can also provide the area below the PDF. */ + /* However, then we probably need not method PINV */ + /*----------------------------------------------------------------------*/ +{ + double tol; /* tolerated integration error */ + + /* the tolerated U-error depends on the given u-resolution. */ + /* however, we have to make some adjustments for integration error */ + /* in order to achieve the desired precison goal. */ + tol = GEN->u_resolution * GEN->area * PINV_UERROR_CORRECTION * PINV_UTOL_CORRECTION; + + /* check center of distribution */ + DISTR.center = _unur_max(DISTR.center, GEN->bleft); + DISTR.center = _unur_min(DISTR.center, GEN->bright); + + /* create object that contains approximate CDF */ + GEN->aCDF = _unur_lobatto_init(_unur_pinv_eval_PDF, gen, + GEN->bleft, DISTR.center, GEN->bright, + tol, NULL, PINV_MAX_LOBATTO_IVS); + + /* retrieve area below the PDF */ + GEN->area = _unur_lobatto_integral(GEN->aCDF); + + /* check estimated area */ + if ( !_unur_isfinite(GEN->area) || _unur_iszero(GEN->area) ) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot compute area below PDF"); + return UNUR_FAILURE; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & PINV_DEBUG_SEARCHBD) + _unur_pinv_debug_pdfarea(gen,FALSE); +#endif + + return UNUR_SUCCESS; + +} /* end of _unur_pinv_pdfarea() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_pinv_computational_domain (struct unur_gen *gen) + /*----------------------------------------------------------------------*/ + /* 1c. Compute computational domain where inverse CDF is approximated */ + /* (interval where we safely can compute coefficients of */ + /* interpolating polynomial). */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double tailcut_error; /* threshold values for cut-off points */ + double range; /* length of current working domain */ + + /* parameters for tail cut-off points: maximal area in tails */ + /* We use the given U-reslution * PINV_TAILCUTOFF_FACTOR * PDFarea. */ + tailcut_error = GEN->u_resolution * PINV_TAILCUTOFF_FACTOR; + tailcut_error = _unur_min( tailcut_error, PINV_TAILCUTOFF_MAX ); + tailcut_error = _unur_max( tailcut_error, 2*DBL_EPSILON ); + tailcut_error *= GEN->area * PINV_UERROR_CORRECTION; + + /* length of current working domain */ + range = GEN->bright-GEN->bleft; + + /* compute cut-off points for tails */ + if(GEN->sleft) { + GEN->bleft = _unur_pinv_cut( gen, GEN->bleft, -range, tailcut_error); + if ( !_unur_isfinite(GEN->bleft) ) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot find left boundary for computational domain"); + return UNUR_FAILURE; + } + } + + if(GEN->sright) { + GEN->bright = _unur_pinv_cut( gen, GEN->bright, range, tailcut_error); + if ( !_unur_isfinite(GEN->bright) ) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot find right boundary for computational domain"); + return UNUR_FAILURE; + } + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & PINV_DEBUG_SEARCHBD) + _unur_pinv_debug_computational_domain(gen); +#endif + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_pinv_computational_domain() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_pinv_cut( struct unur_gen *gen, double w, double dw, double crit ) + /*----------------------------------------------------------------------*/ + /* [1c.] Calculate cut-off points for computational domain of */ + /* distribution. */ + /* The area outside the cut-off point is given by 'crit'. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* w ... starting point for searching cut-off point */ + /* dw ... initial step size for searching, */ + /* sign of dw gives searching direction: */ + /* dw < 0 ... left hand side cut-off point */ + /* dw > 0 ... right hand side cut-off point */ + /* crit ... u-error criterium for tail cut-off */ + /* */ + /* return: */ + /* cut-off point */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double fl,fx,fr; /* value of PDF at x-dx, x, and x+dx */ + double x = w; /* current point */ + double dx; /* step length for calculation of derivative and local concavity */ + double xnew; /* new point in iteration */ + + double df; /* estimate for derivative of PDF at x */ + double lc; /* estimate for local concavity of PDF at x */ + double area; /* estimate for tail probability */ + + int i,j; /* auxiliary variables */ + + /* check length of interval */ + if (_unur_iszero(fabs(dw))) return w; + + /* starting point and step size for search */ + x = w; + fx = PDF(x); + +#ifdef PINV_DEVEL + _unur_log_debug("%s: Find cut-off points on %s hand side near %g:\n", + gen->genid, (dw>0)?"right":"left", x); +#endif + + /* iteratively search for cut-off point with tail probability approximately 'crit'ical value */ + for (i=1; i<100; i++) { + +#ifdef PINV_DEVEL + _unur_log_debug("%s: (% 2d): x=%g, fx=%g\n", gen->genid, i, x, fx); +#endif + + /* -- we need step size 'dx' for computing derivative 'df' and local concavity 'lc' -- */ + + /* first try */ + dx = (fabs(dw) + fabs(x-w)) * 1.e-3; + + /* check boundary of domain */ + if (x-dx < GEN->dleft) dx = x - GEN->dleft; + if (x+dx > GEN->dright) dx = GEN->dright - x; + + /* now let us try to find non-zero points for the PDF */ + for (j=1;;j++) { + + /* decrease step size */ + dx = dx/2.; + + /* check length and protect against infinite loops */ + if (dx < 128.*DBL_EPSILON*fabs(dw)) { + /* we are too close to the boundary. So we just return the last value. */ +#ifdef PINV_DEVEL + _unur_log_debug("%s:\tclose to the boundary: dx=%g, dw=%g --> return %g\n", + gen->genid, dx, dw, x); +#endif + return x; + } + + /* compute PDF values */ + fl = PDF(x-dx); + fr = PDF(x+dx); + + /* check values */ + if (! (_unur_iszero(fl) || _unur_iszero(fx) ||_unur_iszero(fr)) ) + break; + } + + /* -- compute paramters -- */ + + /* derivative */ + df = (fr-fl)/(2.*dx); + + /* local concavity */ + lc = fl/(fl-fx)+fr/(fr-fx) - 1; + + /* estimate for tail probability (Gerhard's formula) */ + area = fabs(fx*fx / ((lc+1.) * df)); + +#ifdef PINV_DEVEL + _unur_log_debug("%s:\tdx=%g, fl=%g, fr=%g, df=%g\n", gen->genid, dx,fl,fr,df); + _unur_log_debug("%s:\tlc = fl/(fl-fx)+fr/(fr-fx) - 1 = %g\n", gen->genid, lc); + _unur_log_debug("%s:\tarea = |fx^2/((lc+1.)*df)| = %g\n", gen->genid, area); +#endif + + /* check for invalid derivative */ + if (! _unur_isfinite(df)) { + /* df too large --> we cannot compute the next point */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, + "numerical problems with cut-off point, PDF too steep"); + return UNUR_INFINITY; + } + if ( ((dw>0)?1.:-1.) * df > 0.) { + /* f increasing towards boundary in [fl,fr]. */ + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF increasing towards boundary"); + /* Let us try boundary point */ + xnew = (dw>0) ? GEN->dright : GEN->dleft; + return _unur_pinv_cut_bisect(gen, x, xnew); + } + + /* check for invalid area */ + if (_unur_isnan(area)) { + /* When the PDF is extremely flat than NaN might occur. There are two possibilities: + * (1) We are far away from the center. Then the tail probabilty is almost 0. + * (2) PDF(X) is still quite large. Then the tail probability cannot be estimated. + * We assume (1). + */ + _unur_warning(gen->genid,UNUR_ERR_NAN,"tail probability gives NaN --> assume 0."); +#ifdef PINV_DEVEL + _unur_log_debug("%s:\treturn %g\n",gen->genid, x); +#endif + return x; + } + + /* check accuracy of computation */ + if (fabs(area/crit-1.) < 1.e-4) { +#ifdef PINV_DEVEL + _unur_log_debug("%s:\taccuracy goal reached --> return %g\n",gen->genid, x); +#endif + return x; + } + + /* compute next point */ + if (_unur_iszero(lc)) { + xnew = x + fx/df * log(crit*fabs(df)/(fx*fx)); + } + else { + xnew = x + fx/(lc*df) * ( pow(crit*fabs(df)*(lc+1.)/(fx*fx),lc/(lc+1.)) - 1.); + } + + /* check new point */ + if (! _unur_isfinite(xnew)) { + /* try smaller step topwards boundary */ + xnew = (dw > 0) ? _unur_arcmean(x,GEN->dright) : _unur_arcmean(x,GEN->dleft); + } + + /* check whether new point is inside domain */ + if (xnew < GEN->dleft || xnew > GEN->dright) { + /* boundary exceeded */ + if ( (dw > 0 && xnew < GEN->dleft) || + (dw < 0 && xnew > GEN->dright) ) { + /* we are on the wrong side --> abort */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, + "numerical problems with cut-off point, out of domain"); + return UNUR_INFINITY; + } + else { + /* boundary exceeded into search direction */ + xnew = (xnew < GEN->dleft) ? GEN->dleft : GEN->dright; +#ifdef PINV_DEVEL + _unur_log_debug("%s:\tboundary exceeded --> return boundary %g\n",gen->genid, xnew); +#endif + return _unur_pinv_cut_bisect(gen, x, xnew); + } + } + + /* PDF at new point */ + fx = PDF(xnew); + + /* check support of PDF */ + if (_unur_iszero(fx)) + return _unur_pinv_cut_bisect(gen, x, xnew); + + /* update point */ + x = xnew; + } + + /* maximum number of iterations exceeded */ +#ifdef PINV_DEVEL + _unur_log_debug("%s:\tmaximum number of iterations exceeded --> return %g\n",gen->genid, x); +#endif + return x; + +} /* end of _unur_pinv_cut() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_pinv_cut_bisect (struct unur_gen *gen, double x0, double x1) + /*----------------------------------------------------------------------*/ + /* [1c.] Calculate cut-off points as boudary of bounded support of PDF. */ + /* Thus be use bisection method. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* x0 ... point in support of PDF */ + /* x1 ... point outside of support of PDF */ + /* */ + /* return: */ + /* cut-off point */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double x,fx; + + /* check starting points */ + if (! (_unur_isfinite(x0) && _unur_isfinite(x1)) ) + return UNUR_INFINITY; + + /* check sign of PDF */ + x = x1; + fx = PDF(x); + if (fx > 0.) return x; + +#ifdef PINV_DEVEL + _unur_log_debug("%s:\tpoint out of support --> find boundary by bisectioning\n",gen->genid); +#endif + + /* interval bisectioning */ + while ( !_unur_FP_equal(x0,x1) ) { + x = _unur_arcmean(x0,x1); + fx = PDF(x); + if (fx > 0.) + x0 = x; + else + x1 = x; + } + +#ifdef PINV_DEVEL + _unur_log_debug("%s:\treturn boundary of support = %g\n",gen->genid,x); +#endif + + return x; +} /* end of _unur_pinv_cut_bisect() */ + + +/*****************************************************************************/ +/** Preprocessing when CDF is given **/ +/*****************************************************************************/ + +int +_unur_pinv_computational_domain_CDF (struct unur_gen *gen) + /*----------------------------------------------------------------------*/ + /* 1c. Compute computational domain where inverse CDF is approximated */ + /* (interval where we safely can compute coefficients of */ + /* interpolating polynomial). */ + /* Use CDF. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double tailcut_error; /* threshold values for cut-off points */ + double fl, fr; + + /* first we have to chech the domain of the distribution */ + fl = CDF(DISTR.domain[0]); + fr = CDF(DISTR.domain[1]); + if (_unur_FP_approx(fl,fr)) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"truncated domain too narrow"); + return UNUR_FAILURE; + } + + /* parameters for tail cut-off points: maximal area in tails */ + /* We use the given U-reslution * PINV_TAILCUTOFF_FACTOR * PDFarea. */ + tailcut_error = GEN->u_resolution * PINV_TAILCUTOFF_FACTOR; + tailcut_error = _unur_min( tailcut_error, PINV_TAILCUTOFF_MAX ); + tailcut_error = _unur_max( tailcut_error, 2*DBL_EPSILON ); + tailcut_error *= GEN->area * PINV_UERROR_CORRECTION; + + /* compute cut-off points for tails */ + if(GEN->sleft) { + GEN->bleft = _unur_pinv_cut_CDF( gen, GEN->dleft, DISTR.center, 0.5*tailcut_error, tailcut_error); + if ( !_unur_isfinite(GEN->bleft) ) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot find left boundary for computational domain"); + return UNUR_FAILURE; + } + } + + if(GEN->sright) { + GEN->bright = _unur_pinv_cut_CDF( gen, GEN->dright, DISTR.center, 1.-tailcut_error, 1.-0.5*tailcut_error); + if ( !_unur_isfinite(GEN->bright) ) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot find right boundary for computational domain"); + return UNUR_FAILURE; + } + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & PINV_DEBUG_SEARCHBD) + _unur_pinv_debug_computational_domain(gen); +#endif + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_pinv_computational_domain_CDF() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_pinv_cut_CDF( struct unur_gen *gen, double dom, double x0, double ul, double uu ) + /*----------------------------------------------------------------------*/ + /* [1c.] Calculate cut-off points for computational domain of */ + /* distribution using CDF. */ + /* The area outside the cut-off point is within the interval ul and uu. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* dom ... boundary of domain / support of distribution */ + /* x0 ... starting point for searching cut-off point */ + /* ul ... lower u-error criterium for tail cut off */ + /* uu ... upper u-error criterium for tail cut off */ + /* */ + /* return: */ + /* cut-off point */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double x; /* current and previous searching point */ + double xs, xl; /* point where CDF is less than and larger than threshold */ + double fx; /* CDF at x */ + double f0, fdom; /* CDF at x0 and dom */ + double dx; /* step size for searching for relevant point */ + + /* check length of interval */ + if (_unur_FP_same(x0,dom)) + return x0; + + /* check u-error (protect against u-values too close to 1) */ + if (1.-ul < 4*DBL_EPSILON) ul = 1. - 4*DBL_EPSILON; + if (1.-uu < 2*DBL_EPSILON) ul = 1. - 2*DBL_EPSILON; + + /* starting point */ + x = x0; + f0 = CDF(x0); + fdom = CDF(dom); + + /* check for starting point */ + if (_unur_iszero(f0)) { + for (dx=0.1; f0ul; dx*=10.) { + dom = x0; fdom = f0; + x0 -= dx; + f0 = CDF(x0); + if (!_unur_isfinite(x0)) + return UNUR_INFINITY; + } + } + + /* find points where CDF values bracket threshold critical u values */ + if ( (f0 < ul && fdom < ul) || (f0 > uu && fdom > uu) ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"CDF too small/large on given domain"); + return dom; + } + if (f0 >= ul && f0 <= uu) { + /* we already have reached our goal */ + return x0; + } + if ( (x0 < dom && _unur_FP_greater(f0,fdom)) || + (x0 > dom && _unur_FP_less(f0,fdom)) ) { + /* there is something wrong */ + return UNUR_INFINITY; + } + + /* bracket */ + if (x0 > dom) { + xs = dom; + xl = x0; + } + else { + xs = x0; + xl = dom; + } + x = x0; + + /* decrease length of bracket */ + while (!_unur_FP_same(xs,xl)) { + + /* new point */ + x = _unur_arcmean(xs,xl); + fx = CDF(x); + + /* check result */ + if (fx >= ul && fx <= uu) { + return x; + } + + /* update bracket */ + if (fx < ul) { + xs = x; + } + else { + xl = x; + } + } + + return x; + +} /* end of _unur_pinv_cut_CDF() */ + + +/*****************************************************************************/ + +double +_unur_pinv_Udiff (struct unur_gen *gen, double x, double h, double *fx) + /*----------------------------------------------------------------------*/ + /* Compute difference CDF(x+h)-CDF(x) (approximately), where CDF is */ + /* the integral of the given (quasi-) density. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* x ... left boundary point of interval */ + /* h ... length of interval */ + /* fx ... PDF(x) (ignored if NULL or *fx<0) */ + /* set *fx <- PDF(x+h) */ + /* */ + /* return: */ + /* (approximate) difference CDF(x+h) - CDF(x) */ + /* */ + /* store: */ + /* if (fx!=NULL) */ + /* *fx = PDF(x+h) if computed in _unur_lobatto_eval_diff */ + /* *fx = -1. (=unknown) otherwise */ + /*----------------------------------------------------------------------*/ +{ + if (gen->variant & PINV_VARIANT_PDF) + return _unur_lobatto_eval_diff(GEN->aCDF, x, h, fx); + else /* use CDF */ + return CDF(x+h) - CDF(x); + +} /* end of _unur_pinv_Udiff() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/pinv_sample.ch b/vendor/unuran-1.11.0/src/methods/pinv_sample.ch new file mode 100644 index 0000000..855f981 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/pinv_sample.ch @@ -0,0 +1,228 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: pinv_sample.c * + * * + * Sampling routines. * + * * + ***************************************************************************** + * * + * Copyright (c) 2008 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Sampling routines **/ +/*****************************************************************************/ + +double +_unur_pinv_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U,X; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_INFINITY); + + /* sample from U(0,1) */ + U = _unur_call_urng(gen->urng); + + /* compute inverse CDF */ + X = _unur_pinv_eval_approxinvcdf(gen,U); + + if (XDISTR.trunc[1]) return DISTR.trunc[1]; + + return X; + +} /* end of _unur_pinv_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_pinv_eval_approxinvcdf( const struct unur_gen *gen, double u ) + /*----------------------------------------------------------------------*/ + /* evaluate polynomial interpolation of inverse CDF at u */ + /* (internal call) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* u ... argument for inverse CDF (0<=u<=1, no validation!) */ + /* */ + /* return: */ + /* double (approximate inverse CDF) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + int i; + double x,un; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_INFINITY); + + /* rescale for range (0, Umax) */ + un = u * GEN->Umax; + + /* look up in guide table and search for interval */ + i = GEN->guide[(int)(u * GEN->guide_size)]; + while (GEN->iv[i+1].cdfi < un) + i++; + + /* rescale for range (0, CDF(right)-CDF(left) for interval */ + un -= GEN->iv[i].cdfi; + + /* evaluate polynomial */ + x = _unur_pinv_newton_eval(un, GEN->iv[i].ui, GEN->iv[i].zi, GEN->order); + + /* return point (add left boundary point to x) */ + return (GEN->iv)[i].xi + x; + +} /* end of _unur_pinv_eval_approxinvcdf() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_pinv_eval_approxinvcdf( const struct unur_gen *gen, double u ) + /*----------------------------------------------------------------------*/ + /* evaluate polynomial interpolation of inverse CDF at u */ + /* (user call) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* u ... argument for inverse CDF (0<=u<=1) */ + /* */ + /* return: */ + /* double (approximate inverse CDF) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double x; + + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + if ( gen->method != UNUR_METH_PINV ) { + _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); + return UNUR_INFINITY; + } + COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_INFINITY); + + if ( ! (u>0. && u<1.)) { + if ( ! (u>=0. && u<=1.)) { + _unur_warning(gen->genid,UNUR_ERR_DOMAIN,"U not in [0,1]"); + } + if (u<=0.) return DISTR.domain[0]; + if (u>=1.) return DISTR.domain[1]; + return u; /* = NaN */ + } + + /* compute inverse CDF */ + x = _unur_pinv_eval_approxinvcdf(gen,u); + + /* validate range */ + if (xDISTR.domain[1]) x = DISTR.domain[1]; + + return x; + +} /* end of unur_pinv_eval_approxinvcdf() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_pinv_eval_approxcdf( const struct unur_gen *gen, double x ) + /*----------------------------------------------------------------------*/ + /* evaluate (approximate) CDF at x. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* x ... argument for CDF */ + /* */ + /* return: */ + /* double (approximate CDF) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + if ( gen->method != UNUR_METH_PINV ) { + _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); + return UNUR_INFINITY; + } + COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_INFINITY); + + /* we need the table of CDF values */ + if ( (gen->variant & PINV_VARIANT_PDF) && GEN->aCDF == NULL) { + _unur_error(gen->genid,UNUR_ERR_GENERIC,"'keepcdf' not set"); + return UNUR_INFINITY; + } + + /* argument inside domain ? */ + if (x <= DISTR.domain[0]) return 0.; + if (x >= DISTR.domain[1]) return 1.; + + /* compute CDF */ + if (gen->variant & PINV_VARIANT_PDF) { + /* case: PDF given */ + return _unur_lobatto_eval_CDF(GEN->aCDF,x); + } + else { + /* case: CDF given */ + return (CDF(x)); + } + +} /* end of unur_pinv_eval_approxcdf() */ + +/*****************************************************************************/ + +int +unur_pinv_estimate_error( const UNUR_GEN *gen, int samplesize, double *max_error, double *MAE ) + /*----------------------------------------------------------------------*/ + /* Estimate maximal u-error and mean absolute error (MAE) by means of */ + /* Monte-Carlo simulation. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* samplesize ... sample size for Monte Carlo simulation */ + /* max_error ... pointer to double for storing maximal u-error */ + /* MAE ... pointer to double for storing MA u-error */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL(GENTYPE, gen, UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_ERR_COOKIE); + + /* run test */ + unur_test_u_error(gen, max_error, MAE, 1.e-20, samplesize, + FALSE, FALSE, FALSE, NULL); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_pinv_estimate_error() */ + +/*****************************************************************************/ diff --git a/vendor/unuran-1.11.0/src/methods/pinv_struct.h b/vendor/unuran-1.11.0/src/methods/pinv_struct.h new file mode 100644 index 0000000..f8ba610 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/pinv_struct.h @@ -0,0 +1,102 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: pinv_struct.h * + * * + * PURPOSE: * + * declares structures for method PINV * + * (Polynomial interpolation based INVersion of CDF) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_pinv_par { + int order; /* order of interpolating polynomial */ + int smooth; /* smoothness parameter */ + double u_resolution; /* maximal error in u */ + double bleft; /* left boundary of the computational domain */ + double bright; /* right boundary of the computational domain */ + int sleft; /* whether to search for left boundary point */ + int sright; /* whether to search for right boundary point */ + int max_ivs; /* maximum number of subintervals */ + int n_extra_testpoints; /* number of extra test points for error estimate */ +}; + +/*---------------------------------------------------------------------------*/ +/* store information about splines */ + +struct unur_pinv_interval { + double *ui; /* points for constructing Newton interpolation */ + double *zi; /* coefficients of Newton polynomial */ + double xi; /* left point of interval */ + double cdfi; /* CDF at left point of interval */ + +#ifdef UNUR_COOKIES + unsigned cookie; /* magic cookie */ +#endif +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_pinv_gen { + int order; /* order of interpolating polynomial */ + + int *guide; /* pointer to guide table */ + int guide_size; /* size of guide table */ + + double Umax; /* upper bound for uniform random variable U + [ Umin = 0. ] */ + + double u_resolution; /* maximal error in u */ + int n_extra_testpoints; /* number of extra test points for error estimate */ + int smooth; /* smoothness parameter */ + double bleft; /* left border of the computational domain */ + double bright; /* right border of the computational domain */ + + struct unur_pinv_interval *iv; /* list of intervals */ + int n_ivs; /* number of subintervals */ + int max_ivs; /* maximum number of subintervals */ + + + double bleft_par; /* border of the computational domain as ... */ + double bright_par; /* ... given by user */ + + double dleft; /* left and right boundary of domain / support */ + double dright; /* of distribution */ + + int sleft; /* whether to search for left boundary point */ + int sright; /* whether to search for right boundary point */ + + double area; /* approximate area below PDF */ + /* double logPDFconstant; rescaling constant for logPDF: Disabled! */ + + struct unur_lobatto_table *aCDF; /* polynomial approximation of CDF */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/srou.c b/vendor/unuran-1.11.0/src/methods/srou.c new file mode 100644 index 0000000..fe49a9b --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/srou.c @@ -0,0 +1,1631 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: srou.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: simple universal method (ratio-of-uniforms method) * + * * + * DESCRIPTION: * + * Given PDF and mode of a T_{-1/2}-concave distribution * + * produce a value x consistent with its density * + * * + * REQUIRED: * + * pointer to the density function * + * mode of the density * + * area below PDF * + * OPTIONAL: * + * CDF at mode * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Leydold J. (2001): A simple universal generator for continuous and * + * discrete univariate T-concave distributions, * + * ACM Trans. Math. Software 27(1), pp. 66--82. * + * * + * [2] Kinderman, A.J. and Monahan, F.J. (1977): Computer generation of * + * random variables using the ratio of uniform deviates, * + * ACM Trans. Math. Software 3(3), pp. 257--260. * + * * + * [3] Leydold J. (2002): Short universal generators via generalized * + * ratio-of-uniforms method, Preprint. * + * * + * [4] Wakefield J. C., Gelfand A. E., and Smith A. F. M. (1991): * + * Efficient generation of random variates via the ratio-of-uniforms * + * method, Statist. Comput. 1(2), pp. 129--133. * + * * + ***************************************************************************** + * * + * The ratio-of-uniforms method introduced in [2] is a flexible method that * + * is based on the following theorem: * + * * + * THEOREM: * + * Let X be a random variable with density function f(x) = g(x) / G, * + * where g(x) is a positive integrable function with support (x_0,x_1) * + * not necessarily finite and G = integral g(x) dx. * + * If (V,U) is uniformly distributed in * + * A = {(v,u): 0 < u <= sqrt(g(v/u)), x_0 < v/u < x_1}, * + * then X = V/U has probability density function f(x). * + * * + * Generating point (V,U) uniformly distributed in A is done by rejection * + * from an enveloping region, usually from the minimal bounding rectangle. * + * * + * The implemented algorithm uses the fact, that for many distribtions, * + * A is convex. Then we easily can construct an enveloping rectangle. * + * Define * + * R = {(v,u): v_l <= v <= v_r, 0 <= u <= u_m}, * + * Q = {(v,u): -v_m <= v <= v_m, 0 <= u <= u_m}, * + * where * + * u_m = sqrt(f(mode)), v_m = (\int f dx) / u_m * + * v_l = -F(\mode) v_m, v_r = (1-F(mode)) v_m * + * Then * + * A subset R subset Q * + * * + * Thus we can use R to generate whenever the CDF F(mode) at the mode * + * is known, and Q otherwise. * + * Notice, that the rection constant is 2 in the first case and 4 and the * + * latter. * + * * + * If F(mode) it known, it is even possible to get an universal squeeze * + * (see [1] for details). However its usage is only recommended when * + * the PDF is (very) expensive. * + * * + * When F(mode) is not known the mirror principle can be used. i.e., make * + * an enveloping rectangle for f(x)+f(-x). It reduces the rejection constant * + * to 2 * sqrt(2) at the expense of more evaluations of the PDF. * + * Its usage is only recommended when the generation time for the underlying * + * uniform prng is extreme large. * + * * + * Distributions with a convex set A are characterized by the following * + * theorem that shows a connection to transformed density rejection TDR. * + * * + * THEOREM: * + * A is convex if and only if g is T-concave with transformation * + * T(x) = -1/sqrt(x), i.e., -1/sqrt(g(x)) is a concave function. * + * * + ***************************************************************************** + * * + * The theory for r!=1 is described in [3]. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "srou.h" +#include "srou_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Variants: */ + +#define SROU_VARFLAG_VERIFY 0x002u /* run verify mode */ +#define SROU_VARFLAG_SQUEEZE 0x004u /* use universal squeeze if possible */ +#define SROU_VARFLAG_MIRROR 0x008u /* use mirror principle */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define SROU_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define SROU_SET_R 0x001u /* parameter r for power transform. */ +#define SROU_SET_CDFMODE 0x002u /* CDF at mode is known */ +#define SROU_SET_PDFMODE 0x004u /* PDF at mode is set */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "SROU" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_srou_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_srou_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_srou_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_srou_check_par( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_srou_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_srou_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_srou_sample( struct unur_gen *gen ); +static double _unur_srou_sample_mirror( struct unur_gen *gen ); +static double _unur_srou_sample_check( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator (case r=1). */ +/*---------------------------------------------------------------------------*/ + +static double _unur_gsrou_sample( struct unur_gen *gen ); +static double _unur_gsrou_sample_check( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator (case r>1). */ +/*---------------------------------------------------------------------------*/ + +static int _unur_srou_rectangle( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* compute universal bounding rectangle (case r=1). */ +/*---------------------------------------------------------------------------*/ + +static int _unur_gsrou_envelope( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* compute parameters for universal bounding envelope (case r>1). */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_srou_debug_init( const struct unur_gen *gen, int is_reinit ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_srou_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cont /* data for distribution object */ + +#define PAR ((struct unur_srou_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_srou_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define BD_LEFT domain[0] /* left boundary of domain of distribution */ +#define BD_RIGHT domain[1] /* right boundary of domain of distribution */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +#define PDF(x) _unur_cont_PDF((x),(gen->distr)) /* call to PDF */ + +/*---------------------------------------------------------------------------*/ + +static UNUR_SAMPLING_ROUTINE_CONT * +_unur_srou_getSAMPLE( struct unur_gen *gen ) +{ + if (gen->variant & SROU_VARFLAG_VERIFY) + return (gen->set & SROU_SET_R) ? _unur_gsrou_sample_check : _unur_srou_sample_check; + else { + if (gen->set & SROU_SET_R) + return _unur_gsrou_sample; + else + return (gen->variant & SROU_VARFLAG_MIRROR) ? _unur_srou_sample_mirror : _unur_srou_sample; + } +} /* end of _unur_srou_getSAMPLE() */ + +/*---------------------------------------------------------------------------*/ +/* constants */ + +#define SQRT2 (M_SQRT2) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_srou_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + + if (DISTR_IN.pdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); + return NULL; + } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_srou_par) ); + COOKIE_SET(par,CK_SROU_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->r = 1.; /* parameter for power transformation */ + PAR->Fmode = -1.; /* CDF at mode (unknown yet ) */ + PAR->um = -1.; /* (square) root of PDF at mode (unknown) */ + + par->method = UNUR_METH_SROU; /* method and default variant */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_srou_init; + + return par; + +} /* end of unur_srou_new() */ + +/*****************************************************************************/ + +int +unur_srou_set_r( struct unur_par *par, double r ) + /*----------------------------------------------------------------------*/ + /* set parameter r for power transformation */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* r ... parameter r */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, SROU ); + + /* check new parameter for generator */ + if (r < 1.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"r < 1"); + return UNUR_ERR_PAR_SET; + } + + if (_unur_isone(r)) { + /* simple version, same as R is not set */ + PAR->r = r; + par->set &= ~SROU_SET_R; + } + else { + /* for computational reasons r should be at least 1.01 */ + if (r<1.01) r = 1.01; + PAR->r = r; + par->set |= SROU_SET_R; + } + + /* we have to reset the marker for the PDF at the mode */ + par->set &= ~SROU_SET_PDFMODE; + + return UNUR_SUCCESS; + +} /* end of unur_srou_set_r() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_srou_set_cdfatmode( struct unur_par *par, double Fmode ) + /*----------------------------------------------------------------------*/ + /* set value of cdf at mode */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* Fmode ... cdf at mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, SROU ); + + /* check new parameter for generator */ + if (Fmode < 0. || Fmode > 1.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"CDF(mode)"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->Fmode = Fmode; + + /* changelog */ + par->set |= SROU_SET_CDFMODE; + + return UNUR_SUCCESS; + +} /* end of unur_srou_set_cdfatmode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_srou_set_pdfatmode( UNUR_PAR *par, double fmode ) + /*----------------------------------------------------------------------*/ + /* Set pdf at mode. if set the PDF at the mode is never changed. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* fmode ... PDF at mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, SROU ); + + /* check new parameter for generator */ + if (fmode <= 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode)"); + return UNUR_ERR_PAR_SET; + } + if (!_unur_isfinite(fmode)) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode) overflow"); + return UNUR_ERR_PAR_SET; + } + + /* store date ((square) root of fmode) */ + PAR->um = (par->set & SROU_SET_R) ? pow(fmode,1./(PAR->r+1.)) : sqrt(fmode); + + /* changelog */ + par->set |= SROU_SET_PDFMODE; + + return UNUR_SUCCESS; + +} /* end of unur_srou_set_pdfatmode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_srou_set_verify( struct unur_par *par, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, SROU ); + + /* we use a bit in variant */ + par->variant = (verify) ? (par->variant | SROU_VARFLAG_VERIFY) : (par->variant & (~SROU_VARFLAG_VERIFY)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_srou_set_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_srou_chg_verify( struct unur_gen *gen, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); + + /* we must not change this switch when sampling has been disabled by + using a pointer to the error producing routine */ + if (SAMPLE == _unur_sample_cont_error) + return UNUR_FAILURE; + + if (verify) + /* turn verify mode on */ + gen->variant |= SROU_VARFLAG_VERIFY; + else + /* turn verify mode off */ + gen->variant &= ~SROU_VARFLAG_VERIFY; + + SAMPLE = _unur_srou_getSAMPLE(gen); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_srou_chg_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_srou_set_usesqueeze( struct unur_par *par, int usesqueeze ) + /*----------------------------------------------------------------------*/ + /* set flag for using universal squeeze (default: off) */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* usesqueeze ... 0 = no squeeze, !0 = use squeeze */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no squeeze is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, SROU ); + + /* we use a bit in variant */ + par->variant = (usesqueeze) ? (par->variant | SROU_VARFLAG_SQUEEZE) : (par->variant & (~SROU_VARFLAG_SQUEEZE)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_srou_set_usesqueeze() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_srou_set_usemirror( struct unur_par *par, int usemirror ) + /*----------------------------------------------------------------------*/ + /* set flag for using mirror principle (default: off) */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* usemirror ... 0 = no mirror princ., !0 = use mirror principle */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* do not use mirror principle is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, SROU ); + + /* we use a bit in variant */ + par->variant = (usemirror) ? (par->variant | SROU_VARFLAG_MIRROR) : (par->variant & (~SROU_VARFLAG_MIRROR)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_srou_set_usemirror() */ + +/*****************************************************************************/ + +int +unur_srou_chg_cdfatmode( struct unur_gen *gen, double Fmode ) + /*----------------------------------------------------------------------*/ + /* change value of cdf at mode */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* Fmode ... cdf at mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (Fmode < 0. || Fmode > 1.) { + _unur_warning(gen->genid,UNUR_ERR_PAR_SET,"CDF(mode)"); + return UNUR_ERR_PAR_SET; + } + + /* copy parameters */ + GEN->Fmode = Fmode; + + /* changelog */ + gen->set |= SROU_SET_CDFMODE; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_srou_chg_cdfatmode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_srou_chg_pdfatmode( struct unur_gen *gen, double fmode ) + /*----------------------------------------------------------------------*/ + /* change value of PDF at mode */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* fmode ... PDF at mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (fmode <= 0.) { + _unur_warning(gen->genid,UNUR_ERR_PAR_SET,"PDF(mode)"); + return UNUR_ERR_PAR_SET; + } + if (!_unur_isfinite(fmode)) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode) overflow"); + return UNUR_ERR_PAR_SET; + } + + /* store date ((square) root of fmode) */ + GEN->um = (gen->set & SROU_SET_R) ? pow(fmode,1./(GEN->r+1.)) : sqrt(fmode); + + /* changelog */ + gen->set |= SROU_SET_PDFMODE; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_srou_chg_pdfatmode() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_srou_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* params ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + int rcode; + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_SROU ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_SROU_PAR,NULL); + + /* there are no squeezes and no mirrir principle when r is changed */ + if (par->set & SROU_SET_R) { + par->variant &= ~SROU_VARFLAG_MIRROR; + par->variant &= ~SROU_VARFLAG_SQUEEZE; + } + + if (par->set & SROU_SET_CDFMODE) + /* cdf at mode known --> + thus it does not make sense to use the mirror principle */ + par->variant &= ~SROU_VARFLAG_MIRROR; + else + /* cdf at mode unknown --> + thus we cannot use universal squeeze */ + par->variant &= ~SROU_VARFLAG_SQUEEZE; + + /* create a new empty generator object */ + gen = _unur_srou_create(par); + + /* free parameters */ + _unur_par_free(par); + + if (!gen) return NULL; + + /* check parameters */ + if (_unur_srou_check_par(gen) != UNUR_SUCCESS) { + _unur_srou_free(gen); return NULL; + } + + /* compute universal bounding envelope */ + if (gen->set & SROU_SET_R) + rcode = _unur_gsrou_envelope( gen ); + else + rcode = _unur_srou_rectangle( gen ); + + if (rcode!=UNUR_SUCCESS) { + /* error */ + _unur_srou_free(gen); return NULL; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_srou_debug_init(gen, FALSE); +#endif + + return gen; + +} /* end of _unur_srou_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_srou_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int rcode; + + /* check parameters */ + if ( (rcode = _unur_srou_check_par(gen)) != UNUR_SUCCESS) + return rcode; + + /* compute universal bounding envelope */ + if (gen->set & SROU_SET_R) + rcode = _unur_gsrou_envelope( gen ); + else + rcode = _unur_srou_rectangle( gen ); + + /* (re)set sampling routine */ + SAMPLE = _unur_srou_getSAMPLE(gen); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & SROU_DEBUG_REINIT) _unur_srou_debug_init(gen,TRUE); +#endif + + return rcode; +} /* end of _unur_srou_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_srou_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_SROU_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_srou_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_SROU_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_srou_getSAMPLE(gen); + gen->destroy = _unur_srou_free; + gen->clone = _unur_srou_clone; + gen->reinit = _unur_srou_reinit; + + /* copy some parameters into generator object */ + GEN->r = PAR->r; /* parameter for power transformation */ + GEN->Fmode = PAR->Fmode; /* CDF at mode */ + GEN->um = PAR->um; /* square root of PDF at mode */ + + /* initialize variables */ + GEN->vl = GEN->vr = 0.; + GEN->xl = GEN->xr = 0.; + GEN->p = 0.; + GEN->a = GEN->b = 0.; + GEN->log_ab = 0.; + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_srou_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_srou_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_srou_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check for required data: mode */ + if (!(gen->distr->set & UNUR_DISTR_SET_MODE)) { + _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode: try finding it (numerically)"); + if (unur_distr_cont_upd_mode(gen->distr)!=UNUR_SUCCESS) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode"); + return UNUR_ERR_DISTR_REQUIRED; + } + } + + /* check for required data: area */ + if (!(gen->distr->set & UNUR_DISTR_SET_PDFAREA)) { + if (unur_distr_cont_upd_pdfarea(gen->distr)!=UNUR_SUCCESS) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"area below PDF"); + return UNUR_ERR_DISTR_REQUIRED; + } + } + + /* mode must be in domain */ + if ( (DISTR.mode < DISTR.BD_LEFT) || + (DISTR.mode > DISTR.BD_RIGHT) ) { + /* there is something wrong. + assume: user has change domain without changing mode. + but then, she probably has not updated area and is to large */ + _unur_warning(GENTYPE,UNUR_ERR_GEN_DATA,"area and/or CDF at mode"); + DISTR.mode = _unur_max(DISTR.mode,DISTR.BD_LEFT); + DISTR.mode = _unur_min(DISTR.mode,DISTR.BD_RIGHT); + } + + return UNUR_SUCCESS; +} /* end of _unur_srou_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_srou_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_srou_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_SROU_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + return clone; + +#undef CLONE +} /* end of _unur_srou_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_srou_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_SROU ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_SROU_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_srou_free() */ + +/*****************************************************************************/ + +double +_unur_srou_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U,V,X,x,xx; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_SROU_GEN,UNUR_INFINITY); + + while (1) { + /* generate point uniformly on rectangle */ + while ( _unur_iszero(U = _unur_call_urng(gen->urng)) ); + U *= GEN->um; + V = GEN->vl + _unur_call_urng(gen->urng) * (GEN->vr - GEN->vl); + + /* ratio */ + X = V/U; + + /* compute x */ + x = X + DISTR.mode; + + /* inside domain ? */ + if ( (x < DISTR.BD_LEFT) || (x > DISTR.BD_RIGHT) ) + continue; + + /* evaluate squeeze */ + if ( (gen->variant & SROU_VARFLAG_SQUEEZE) && + (X >= GEN->xl) && + (X <= GEN->xr ) && + (U < GEN->um) ) { + xx = V / (GEN->um - U); + if ( (xx >= GEN->xl) && (xx <= GEN->xr ) ) + return x; + } + + /* accept or reject */ + if (U*U <= PDF(x)) + return x; + } + +} /* end of _unur_srou_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_srou_sample_mirror( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator, use mirror principle */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U,V,X,x,fx,fnx,uu; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_SROU_GEN,UNUR_INFINITY); + + while (1) { + /* generate point uniformly on rectangle */ + while ( _unur_iszero(U = _unur_call_urng(gen->urng)) ); + U *= GEN->um * SQRT2; + V = 2. * (_unur_call_urng(gen->urng) - 0.5) * GEN->vr; + /* vr = vm when the CDF at the mode is not known */ + + /* ratio */ + X = V/U; + + /* evaluate PDF */ + x = X + DISTR.mode; + fx = (x < DISTR.BD_LEFT || x > DISTR.BD_RIGHT) ? 0. : PDF(x); + uu = U * U; + + /* accept or reject */ + if (uu <= fx) + return x; + + /* try mirrored PDF */ + x = -X + DISTR.mode; + fnx = (x < DISTR.BD_LEFT || x > DISTR.BD_RIGHT) ? 0. : PDF(x); + if (uu <= fx + fnx) + return x; + } + +} /* end of _unur_srou_sample_mirror() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_srou_sample_check( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator and verify that method can be used */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U,uu,V,X,x,nx,fx,sfx,fnx,xfx,xfnx,xx; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_SROU_GEN,UNUR_INFINITY); + + if (gen->variant & SROU_VARFLAG_MIRROR) { + /* use mirror principle */ + + while (1) { + /* generate point uniformly on rectangle */ + while ( _unur_iszero(U = _unur_call_urng(gen->urng)) ); + U *= GEN->um * SQRT2; + V = 2. * (_unur_call_urng(gen->urng) - 0.5) * GEN->vr; + /* vr = vm when the CDF at the mode is not known */ + + /* ratio */ + X = V/U; + + /* x values */ + x = X + DISTR.mode; + nx = -X + DISTR.mode; + + /* evaluate PDF */ + fx = (x < DISTR.BD_LEFT || x > DISTR.BD_RIGHT) ? 0. : PDF(x); + fnx = (nx < DISTR.BD_LEFT || nx > DISTR.BD_RIGHT) ? 0. : PDF(nx); + uu = U * U; + + /* check hat */ + xfx = (x - DISTR.mode) * sqrt(fx); + xfnx = (nx - DISTR.mode) * sqrt(fnx); + + if ( ((2.+4.*DBL_EPSILON) * GEN->um*GEN->um < fx + fnx) /* avoid roundoff error with FP registers */ + || (xfx < (1.+UNUR_EPSILON) * GEN->vl) + || (xfx > (1.+UNUR_EPSILON) * GEN->vr) + || (xfnx < (1.+UNUR_EPSILON) * GEN->vl) + || (xfnx > (1.+UNUR_EPSILON) * GEN->vr) ) + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) > hat(x)"); + + /* accept or reject */ + if (uu <= fx) + return x; + + /* try mirrored PDF */ + if (uu <= fx + fnx) + return nx; + } + } + + else { /* do not use mirror principle */ + + while (1) { + /* generate point uniformly on rectangle */ + while ( _unur_iszero(U = _unur_call_urng(gen->urng)) ); + U *= GEN->um; + V = GEN->vl + _unur_call_urng(gen->urng) * (GEN->vr - GEN->vl); + + /* ratio */ + X = V/U; + + /* compute x */ + x = X + DISTR.mode; + + /* inside domain ? */ + if ( (x < DISTR.BD_LEFT) || (x > DISTR.BD_RIGHT) ) + continue; + + /* evaluate PDF */ + fx = PDF(x); + + /* the point on the boundary of the region of acceptance + in direction X = V/U has the coordinates + ( X * sqrt(fx), sqrt(fx) ). */ + sfx = sqrt(fx); + xfx = X * sfx; + + /* check hat */ + if ( ( sfx > (1.+DBL_EPSILON) * GEN->um ) /* avoid roundoff error with FP registers */ + || (xfx < (1.+UNUR_EPSILON) * GEN->vl) + || (xfx > (1.+UNUR_EPSILON) * GEN->vr) ) + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) > hat(x)"); + + /* evaluate and check squeeze */ + if ( (gen->variant & SROU_VARFLAG_SQUEEZE) && + (X >= GEN->xl) && + (X <= GEN->xr ) && + (U < GEN->um) ) { + + /* check squeeze */ + xx = xfx / (GEN->um - sfx); + if ( (xx > (1.-UNUR_EPSILON) * GEN->xl) && + (xx < (1.-UNUR_EPSILON) * GEN->xr) ) + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) < squeeze(x)"); + + /* squeeze acceptance */ + xx = V / (GEN->um - U); + if ( (xx >= GEN->xl) && (xx <= GEN->xr ) ) + return x; + } + + /* accept or reject */ + if (U*U <= PDF(x)) + return x; + } + } + +} /* end of _unur_srou_sample_check() */ + +/*****************************************************************************/ + +double +_unur_gsrou_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U,Ur,V,W,X,Z; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_SROU_GEN,UNUR_INFINITY); + + while (1) { + W = GEN->log_ab *_unur_call_urng(gen->urng); + Z = GEN->vl + _unur_call_urng(gen->urng) * (GEN->vr - GEN->vl); + U = (exp(-W)-1.) * GEN->a/GEN->b; + V = -Z/(GEN->a + GEN->b*U); + U *= GEN->um; + Ur = pow(U,GEN->r); + X = V/Ur + DISTR.mode; + + /* inside domain ? */ + if ( (X < DISTR.BD_LEFT) || (X > DISTR.BD_RIGHT) ) + continue; + + /* accept or reject */ + if (Ur*U <= PDF(X)) + return X; + } + +} /* end of _unur_gsrou_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_gsrou_sample_check( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator and verify that method can be used */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U,Ur,V,W,X,x,Z; + double fx,uf,vf,vhl,vhr; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_SROU_GEN,UNUR_INFINITY); + + while (1) { + + W = GEN->log_ab *_unur_call_urng(gen->urng); + Z = GEN->vl + _unur_call_urng(gen->urng) * (GEN->vr - GEN->vl); + U = (exp(-W)-1.) * GEN->a/GEN->b; + V = -Z/(GEN->a + GEN->b*U); + U *= GEN->um; + Ur = pow(U,GEN->r); + X = V/Ur; + + /* compute x */ + x = X + DISTR.mode; + /* inside domain ? */ + if ( (x < DISTR.BD_LEFT) || (x > DISTR.BD_RIGHT) ) + continue; + + /* evaluate density */ + fx = PDF(x); + + /* the point on the boundary of the region of acceptance + in direction X = V/U^r has the coordinates + ( (x-mode) * (fx)^(r/(r+1)), sqrt[r+1](fx) ). */ + uf = pow(fx,1./(GEN->r+1)); + vf = X * pow(fx,GEN->r/(GEN->r+1.)); + + /* the corresponding point on boundary of the enveloping region */ + /* with same u-coordinate. */ + vhl = - GEN->vl /(GEN->a + GEN->b*(uf/GEN->um)); + vhr = - GEN->vr /(GEN->a + GEN->b*(uf/GEN->um)); + + /* check hat */ + if ( ( uf > (1.+DBL_EPSILON) * GEN->um ) /* avoid roundoff error with FP registers */ + || (vf < (1.+UNUR_EPSILON) * vhl ) + || (vf > (1.+UNUR_EPSILON) * vhr ) ) + { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) > hat(x)"); + } + + /* accept or reject */ + if (Ur*U <= fx) + return x; + } + +} /* end of _unur_gsrou_sample_check() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_srou_rectangle( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* compute universal bounding rectangle */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double vm, fm; /* width of rectangle, PDF at mode */ + + /* check arguments */ + CHECK_NULL( gen, UNUR_ERR_NULL ); + COOKIE_CHECK( gen,CK_SROU_GEN, UNUR_ERR_COOKIE ); + + /* compute PDF at mode (if not given by user) */ + if (!(gen->set & SROU_SET_PDFMODE)) { + fm = PDF(DISTR.mode); + /* fm must be positive */ + if (fm <= 0.) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(mode) <= 0."); + return UNUR_ERR_GEN_DATA; + } + if (!_unur_isfinite(fm)) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode) overflow"); + return UNUR_ERR_PAR_SET; + } + GEN->um = sqrt(fm); /* height of rectangle */ + } + + /* width of rectangle */ + vm = DISTR.area / GEN->um; + + if (gen->set & SROU_SET_CDFMODE) { + /* cdf at mode known */ + GEN->vl = -GEN->Fmode * vm; + GEN->vr = vm + GEN->vl; + GEN->xl = GEN->vl/GEN->um; + GEN->xr = GEN->vr/GEN->um; + } + else { + /* cdf at mode unknown */ + GEN->vl = -vm; + GEN->vr = vm; + GEN->xl = GEN->vl/GEN->um; + GEN->xr = GEN->vr/GEN->um; + /* we cannot use universal squeeze */ + gen->variant &= ~SROU_VARFLAG_SQUEEZE; + } + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_srou_rectangle() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_gsrou_envelope( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* compute parameters for universal bounding envelope. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double fm; /* PDF at mode */ + double vm; /* maximal width of envelope */ + double pr; /* p^r */ + + double p; /* short cuts */ + double r = GEN->r; + + /* check arguments */ + CHECK_NULL( gen, UNUR_ERR_NULL ); + COOKIE_CHECK( gen, CK_SROU_GEN, UNUR_ERR_COOKIE ); + + if (!(gen->set & SROU_SET_PDFMODE)) { + /* compute PDF at mode */ + fm = PDF(DISTR.mode); + /* fm must be positive */ + if (fm <= 0.) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(mode) <= 0."); + return UNUR_ERR_GEN_DATA; + } + if (!_unur_isfinite(fm)) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode) overflow"); + return UNUR_ERR_PAR_SET; + } + GEN->um = pow(fm,1./(r+1.)); /* height of envelope */ + } + + /* maximal width of envelope */ + vm = DISTR.area / (GEN->r*GEN->um); + + if (gen->set & SROU_SET_CDFMODE) { + /* cdf at mode known */ + GEN->vl = -GEN->Fmode * vm; + GEN->vr = vm + GEN->vl; + } + else { + /* cdf at mode unknown */ + GEN->vl = -vm; + GEN->vr = vm; + } + + /* construction point for bounding curve */ + GEN->p = p = 1. - 2.187/pow(r + 5 - 1.28/r, 0.9460 ); + pr = pow(p,r); + + /* parameters for bounding envelope */ + GEN->b = (1. - r * pr/p + (r-1.)*pr) / ((pr-1.)*(pr-1)); + GEN->a = -(p-1.)/(pr-1.) - p * GEN->b; + GEN->log_ab = log(GEN->a/(GEN->a+GEN->b)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_gsrou_envelope() */ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_srou_debug_init( const struct unur_gen *gen, int is_reinit ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* is_reinit ... if TRUE the generator has been reinitialized */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_SROU_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + if (!is_reinit) { + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = srou (simple universal ratio-of-uniforms)\n",gen->genid); + } + else + fprintf(LOG,"%s: reinit!\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cont_debug( gen->distr, gen->genid ); + + if (gen->set & SROU_SET_R) { + fprintf(LOG,"%s: Generalized version: r = %g\n",gen->genid,GEN->r); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: sampling routine = _unur_gsrou_sample",gen->genid); + if (gen->variant & SROU_VARFLAG_VERIFY) + fprintf(LOG,"_check"); + fprintf(LOG,"()\n%s:\n",gen->genid); + } + else { + fprintf(LOG,"%s: Simple version (r = 1) [default]\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: sampling routine = _unur_srou_sample",gen->genid); + if (gen->variant & SROU_VARFLAG_VERIFY) + fprintf(LOG,"_check"); + else if (gen->variant & SROU_VARFLAG_MIRROR) + fprintf(LOG,"_mirror"); + fprintf(LOG,"()\n%s:\n",gen->genid); + } + + if (gen->set & SROU_SET_CDFMODE) + fprintf(LOG,"%s: F(mode) = %g\n",gen->genid,GEN->Fmode); + else + fprintf(LOG,"%s: F(mode) unknown\n",gen->genid); + + if (gen->variant & SROU_VARFLAG_SQUEEZE) + fprintf(LOG,"%s: use universal squeeze\n",gen->genid); + else + fprintf(LOG,"%s: no (universal) squeeze\n",gen->genid); + + if (gen->variant & SROU_VARFLAG_MIRROR) + fprintf(LOG,"%s: use mirror principle\n",gen->genid); + + fprintf(LOG,"%s:\n",gen->genid); + + if (gen->set & SROU_SET_R) { + fprintf(LOG,"%s: Enveloping region:\n",gen->genid); + fprintf(LOG,"%s: um = %g\n",gen->genid,GEN->um); + fprintf(LOG,"%s: vl = %g\n",gen->genid,GEN->vl); + fprintf(LOG,"%s: vr = %g\n",gen->genid,GEN->vr); + fprintf(LOG,"%s: p = %g\n",gen->genid,GEN->p); + fprintf(LOG,"%s: a = %g\n",gen->genid,GEN->a); + fprintf(LOG,"%s: b = %g\n",gen->genid,GEN->b); + } + else { + fprintf(LOG,"%s: Rectangle:\n",gen->genid); + fprintf(LOG,"%s: left upper point = (%g,%g)\n",gen->genid,GEN->vl,GEN->um); + fprintf(LOG,"%s: right upper point = (%g,%g)\n",gen->genid,GEN->vr,GEN->um); + } + + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_srou_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_srou_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + int samplesize = 10000; + double h_area, rc; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = PDF\n"); + _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info," mode = %g %s\n", DISTR.mode, + (distr->set & UNUR_DISTR_SET_MODE_APPROX) ? "[numeric.]" : ""); + _unur_string_append(info," area(PDF) = %g\n", DISTR.area); + if (gen->set & SROU_SET_CDFMODE) + _unur_string_append(info," F(mode) = %g\n", GEN->Fmode); + else + _unur_string_append(info," F(mode) = [unknown]\n"); + + if (help) { + if ( distr->set & UNUR_DISTR_SET_MODE_APPROX ) + _unur_string_append(info,"\n[ Hint: %s ]\n", + "You may provide the \"mode\""); + } + _unur_string_append(info,"\n"); + + /* method */ + _unur_string_append(info,"method: SROU (Simple Ratio-Of-Uniforms)\n"); + _unur_string_append(info," r = %g %s\n", GEN->r, + (gen->set & SROU_SET_R) ? "[generalized version]" : ""); + if (gen->set & SROU_SET_CDFMODE) + _unur_string_append(info," use CDF at mode\n"); + if (gen->variant & SROU_VARFLAG_SQUEEZE) + _unur_string_append(info," use squeeze\n"); + if (gen->variant & SROU_VARFLAG_MIRROR) + _unur_string_append(info," use mirror principle\n"); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + if (gen->set & SROU_SET_R) { + rc = unur_test_count_urn(gen,samplesize,0,NULL)/(2.*samplesize); + _unur_string_append(info," enveloping rectangle = (%g,%g) x (%g,%g)\n", + GEN->vl,GEN->vr, 0.,GEN->um); + _unur_string_append(info," rejection constant = %.2f [approx.]\n", rc); + } + else { + _unur_string_append(info," bounding rectangle = (%g,%g) x (%g,%g)\n", + GEN->vl,GEN->vr, 0.,GEN->um); + h_area = (GEN->vr - GEN->vl) * GEN->um; + _unur_string_append(info," area(hat) = %g\n", h_area); + if (gen->set & SROU_SET_CDFMODE) + rc = 2.; + else + rc = (gen->variant & SROU_VARFLAG_MIRROR) ? 2.829 : 4.; + + _unur_string_append(info," rejection constant = %g\n", rc); + } + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + _unur_string_append(info," r = %g %s\n", GEN->r, + (gen->set & SROU_SET_R) ? "" : "[default]"); + if (gen->set & SROU_SET_CDFMODE) + _unur_string_append(info," cdfatmode = %g\n", GEN->Fmode); + else + _unur_string_append(info," cdfatmode = [not set]\n"); + + if (gen->variant & SROU_VARFLAG_SQUEEZE) + _unur_string_append(info," usesqueeze\n"); + + if (gen->variant & SROU_VARFLAG_MIRROR) + _unur_string_append(info," usemirror\n"); + + if (gen->variant & SROU_VARFLAG_VERIFY) + _unur_string_append(info," verify = on\n"); + + _unur_string_append(info,"\n"); + + /* Not displayed: + int unur_srou_set_pdfatmode( UNUR_PAR *parameters, double fmode ); + */ + } + + + /* Hints */ + if (help) { + if ( !(gen->set & SROU_SET_CDFMODE)) + _unur_string_append(info,"[ Hint: %s ]\n", + "You can set \"cdfatmode\" to reduce the rejection constant."); + _unur_string_append(info,"\n"); + } + +} /* end of _unur_srou_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/srou.h b/vendor/unuran-1.11.0/src/methods/srou.h new file mode 100644 index 0000000..161bd25 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/srou.h @@ -0,0 +1,267 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: srou.h * + * * + * PURPOSE: * + * function prototypes for method SROU * + * (Simple universal generator, ratio-of-uniforms method) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD SROU Simple Ratio-Of-Uniforms method + + =UP Methods_for_CONT + + =REQUIRED T-concave PDF, mode, area + + =SPEED Set-up: fast, Sampling: slow + + =REINIT supported + + =REF [LJa01] [LJa02] [HLD04: Sect.6.3.1, Sect.6.3.2, Sect.6.4.1, Alg.6.4, Alg.6.5, Alg.6.7] + + =DESCRIPTION + SROU is based on the ratio-of-uniforms method + (@pxref{Ratio-of-Uniforms}) that uses universal inequalities for + constructing a (universal) bounding rectangle. + It works for all @i{T}-concave distributions, including + log-concave and @i{T}-concave distributions with + @unurmath{T(x) = -1/\sqrt{x}.} + + Moreover an (optional) parameter @code{r} can be given, to + adjust the generator to the given distribution. This parameter + is strongly related to the parameter @code{c} for transformed + density rejection (@pxref{TDR}) via the formula + @i{c = -r/(r+1)}. The rejection constant increases with higher + values for @code{r}. On the other hand, the given density must + be @unurmath{T_c}-concave for the corresponding @i{c}. + The default setting for @code{r} is 1 which results in a very + simple code. (For other settings, sampling uniformly from the + acceptance region is more complicated.) + + Optionally the CDF at the mode can be given to increase the + performance of the algorithm. Then the rejection constant is + reduced by 1/2 and (if @code{r=1}) even a universal squeeze can + (but need not be) used. + A way to increase the performance of the algorithm when the + CDF at the mode is not provided is the usage of the mirror + principle (only if @code{r=1}). However, using squeezes and using + the mirror principle is only recommended when the PDF is + expensive to compute. + + The exact location of the mode and/or the area below the PDF can + be replace by appropriate bounds. Then the algorithm still works + but has larger rejection constants. + + =HOWTOUSE + SROU works for any continuous univariate distribution object with + given @unurmath{T_c}-concave PDF with @unurmath{c<1,}) + mode and area below PDF. Optional the CDF at the mode + can be given to increase the performance of the algorithm by + means of the unur_srou_set_cdfatmode() call. Additionally + squeezes can be used and switched on via + unur_srou_set_usesqueeze() (only if @code{r=1}). + A way to increase the performance of the algorithm when the + CDF at the mode is not provided is the usage of the mirror + principle which can be swithced on by means of a + unur_srou_set_usemirror() call (only if @code{r=1}) . + However using squeezes and using + the mirror principle is only recommended when the PDF is + expensive to compute. + + The parameter @code{r} can be given, to adjust the generator to + the given distribution. This parameter is strongly related + parameter @code{c} for transformed density rejection via the + formula @i{c = -r/(r+1)}. + The parameter @code{r} can be any value larger than or equal to + 1. Values less then 1 are automatically set to 1. + The rejection constant depends on the chosen parameter + @code{r} but not on the particular distribution. It is 4 for + @code{r} equal to 1 and higher for higher values of @code{r}. + It is important to note that different algorithms for different + values of @code{r}: If @code{r} equal to 1 this is much faster + than the algorithm for @code{r} greater than 1. + The default setting for @code{r} is 1. + + If the (exact) area below the PDF is not known, then an upper + bound can be used instead (which of course increases the rejection + constant). But then the squeeze flag must not be set and + unur_srou_set_cdfatmode() must not be used. + + If the exact location of the mode is not known, then use the + approximate location and provide the (exact) value of the PDF at + the mode by means of the unur_srou_set_pdfatmode() call. But then + unur_srou_set_cdfatmode() must not be used. Notice, that a (slow) + numerical mode finder will be used if no mode is given at all. + It is even possible to give an upper bound for the PDF only. + However, then the (upper bound for the) area below the PDF has to be + multiplied by the ratio between the upper bound and the lower bound of + the PDF at the mode. Again setting the squeeze flag and using + unur_srou_set_cdfatmode() is not allowed. + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + Notice, that derived parameters like the mode must also be (re-) set + if the parameters or the domain has be changed. + Moreover, if the PDF at the mode has been provided by a + unur_srou_set_pdfatmode() call, additionally + unur_srou_chg_pdfatmode() must be used (otherwise this call is + not necessary since then this figure is computed directly from + the PDF). + + There exists a test mode that verifies whether the conditions + for the method are satisfied or not while sampling. It can be + switched on by calling unur_srou_set_verify() and + unur_srou_chg_verify(), respectively. Notice however that + sampling is (a little bit) slower then. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_srou_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_srou_set_r( UNUR_PAR *parameters, double r ); +/* + Set parameter @var{r} for transformation. + Only values greater than or equal to 1 are allowed. + The performance of the generator decreases when @var{r} is + increased. On the other hand @var{r} must not be set to small, + since the given density must be T_c-concave for + @i{c = -r/(r+1)}. + + @emph{Notice:} If @var{r} is set to @code{1} a simpler and much + faster algorithm is used then for @var{r} greater than one. + + For computational reasons values of @var{r} that are greater than + @code{1} but less than @code{1.01} are always set to @code{1.01}. + + Default is @code{1}. +*/ + +int unur_srou_set_cdfatmode( UNUR_PAR *parameters, double Fmode ); +/* + Set CDF at mode. + When set, the performance of the algorithm is increased by factor 2. + However, when the parameters of the distribution are changed + unur_srou_chg_cdfatmode() has to be used to update this value. + + Default: not set. +*/ + +int unur_srou_set_pdfatmode( UNUR_PAR *parameters, double fmode ); +/* + Set pdf at mode. + When set, the PDF at the mode is never changed. + This is to avoid additional computations, when the PDF does not + change when parameters of the distributions vary. + It is only useful when the PDF at the mode does not change with + changing parameters of the distribution. + + @emph{IMPORTANT:} + This call has to be executed after a possible call of + unur_srou_set_r(). + + Default: not set. +*/ + +int unur_srou_set_usesqueeze( UNUR_PAR *parameters, int usesqueeze ); +/* + Set flag for using universal squeeze (default: off). + Using squeezes is only useful when the evaluation of the PDF is + (extremely) expensive. + Using squeezes is automatically disabled when the CDF at the mode + is not given (then no universal squeezes exist). + + Squeezes can only be used if @code{r=1}. + + Default is FALSE. +*/ + +int unur_srou_set_usemirror( UNUR_PAR *parameters, int usemirror ); +/* + Set flag for using mirror principle (default: off). + Using the mirror principle is only useful when the CDF at the + mode is not known and the evaluation of the PDF is rather cheap compared + to the marginal generation time of the underlying uniform random + number generator. + It is automatically disabled when the CDF at the mode is given. + (Then there is no necessity to use the mirror principle. However disabling + is only done during the initialization step but not at a re-initialization + step.) + + The mirror principle can only be used if @code{r=1}. + + Default is FALSE. +*/ + +int unur_srou_set_verify( UNUR_PAR *parameters, int verify ); +/* */ + +int unur_srou_chg_verify( UNUR_GEN *generator, int verify ); +/* + Turn verifying of algorithm while sampling on/off. + If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is + violated for some @i{x} then @code{unur_errno} is set to + @code{UNUR_ERR_GEN_CONDITION}. However notice that this might + happen due to round-off errors for a few values of + @i{x} (less than 1%). + + Default is FALSE. +*/ + +/*...........................................................................*/ + +int unur_srou_chg_cdfatmode( UNUR_GEN *generator, double Fmode ); +/* + Change CDF at mode of distribution. + unur_reinit() must be executed before sampling from the + generator again. +*/ + +int unur_srou_chg_pdfatmode( UNUR_GEN *generator, double fmode ); +/* + Change PDF at mode of distribution. + unur_reinit() must be executed before sampling from the + generator again. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/srou_struct.h b/vendor/unuran-1.11.0/src/methods/srou_struct.h new file mode 100644 index 0000000..216add0 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/srou_struct.h @@ -0,0 +1,60 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: srou_struct.h * + * * + * PURPOSE: * + * declares structures for method SROU * + * (Simple universal generator, Ratio-Of-Uniforms method) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_srou_par { + double r; /* parameter for power transformation */ + double Fmode; /* cdf at mode */ + double um; /* square root of pdf at mode */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_srou_gen { + double um; /* height of rectangle: square root of f(mode) */ + double vl, vr; /* left and right boundary of rectangle */ + double xl, xr; /* ratios vl/um and vr/um */ + double Fmode; /* cdf at mode */ + + /* parameters for generalized SROU */ + double r; /* parameter for power transformation */ + double p; /* construction point for bounding curve */ + double a, b; /* parameters for bounding curve */ + double log_ab; /* parameter for bounding curve */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/ssr.c b/vendor/unuran-1.11.0/src/methods/ssr.c new file mode 100644 index 0000000..08d4252 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/ssr.c @@ -0,0 +1,1201 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: ssr.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: rejection with universal bounds * + * * + * DESCRIPTION: * + * Given PDF and mode of a T_{-1/2}-concave distribution * + * produce a value x consistent with its density * + * * + * REQUIRED: * + * pointer to the density function * + * mode of the density * + * area below PDF * + * OPTIONAL: * + * CDF at mode * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Leydold J. (2001): A simple universal generator for continuous and * + * discrete univariate T-concave distributions, * + * ACM Trans. Math. Software 27(1), pp. 66--82. * + * * + * [2] Hoermann W. (1995): A rejection technique for sampling from * + * T-concave distributions, ACM TOMS 21, p. 182-193 * + * * + ***************************************************************************** + * * + * This algorithm is based on transformed density rejection (see [2]), were * + * universal upper and lower bounds are used. These are derived via the * + * ratio-of-uniforms method. See [1] for details and a description of the * + * algorithm. It works for any distribution, where -1/sqrt(PDF(x)) is * + * concave. This includes all log-concave distributions. * + * * + * (The mirror principle has not been implemented.) * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "ssr.h" +#include "ssr_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Variants: none */ + +#define SSR_VARFLAG_VERIFY 0x002u /* run verify mode */ +#define SSR_VARFLAG_SQUEEZE 0x004u /* use universal squeeze if possible */ + +#define SSR_VARFLAG_MIRROR 0x008u /* use mirror principle */ +/* not implemented yet! */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define SSR_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define SSR_SET_CDFMODE 0x001u /* CDF at mode is known */ +#define SSR_SET_PDFMODE 0x002u /* PDF at mode is set */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "SSR" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_ssr_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_ssr_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_ssr_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_ssr_check_par( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_ssr_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_ssr_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_ssr_sample( struct unur_gen *gen ); +static double _unur_ssr_sample_check( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static int _unur_ssr_hat( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* compute universal hat. */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_ssr_debug_init( const struct unur_gen *gen, int is_reinit ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_ssr_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cont /* data for distribution object */ + +#define PAR ((struct unur_ssr_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_ssr_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define BD_LEFT domain[0] /* left boundary of domain of distribution */ +#define BD_RIGHT domain[1] /* right boundary of domain of distribution */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +#define PDF(x) _unur_cont_PDF((x),(gen->distr)) /* call to PDF */ + +/*---------------------------------------------------------------------------*/ + +#define _unur_ssr_getSAMPLE(gen) \ + ( ((gen)->variant & SSR_VARFLAG_VERIFY) \ + ? _unur_ssr_sample_check : _unur_ssr_sample ) + +/*---------------------------------------------------------------------------*/ +/* constants */ + +#define SQRT2 1.4142135623731 + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_ssr_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + + if (DISTR_IN.pdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); + return NULL; + } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_ssr_par) ); + COOKIE_SET(par,CK_SSR_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->Fmode = -1.; /* CDF at mode (unknown yet) */ + PAR->fm = -1.; /* PDF at mode (unknown) */ + PAR->um = -1.; /* square of PDF at mode (unknown) */ + + par->method = UNUR_METH_SSR; /* method and default variant */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_ssr_init; + + return par; + +} /* end of unur_ssr_new() */ + +/*****************************************************************************/ + +int +unur_ssr_set_cdfatmode( struct unur_par *par, double Fmode ) + /*----------------------------------------------------------------------*/ + /* set cdf at mode */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* Fmode ... CDF at mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, SSR ); + + /* check new parameter for generator */ + if (Fmode < 0. || Fmode > 1.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"CDF(mode)"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->Fmode = Fmode; + + /* changelog */ + par->set |= SSR_SET_CDFMODE; + + return UNUR_SUCCESS; + +} /* end of unur_ssr_set_cdfatmode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ssr_set_pdfatmode( UNUR_PAR *par, double fmode ) + /*----------------------------------------------------------------------*/ + /* Set PDF at mode. if set the PDF at the mode is never changed. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* fmode ... PDF at mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, SSR ); + + /* check new parameter for generator */ + if (fmode <= 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode)"); + return UNUR_ERR_PAR_SET; + } + if (!_unur_isfinite(fmode)) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode) overflow"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->fm = fmode; + PAR->um = sqrt(fmode); + + /* changelog */ + par->set |= SSR_SET_PDFMODE; + + return UNUR_SUCCESS; + +} /* end of unur_ssr_set_pdfatmode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ssr_set_verify( struct unur_par *par, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, SSR ); + + /* we use a bit in variant */ + par->variant = (verify) ? (par->variant | SSR_VARFLAG_VERIFY) : (par->variant & (~SSR_VARFLAG_VERIFY)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_ssr_set_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ssr_chg_verify( struct unur_gen *gen, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); + + /* we must not change this switch when sampling has been disabled by + using a pointer to the error producing routine */ + if (SAMPLE == _unur_sample_cont_error) + return UNUR_FAILURE; + + if (verify) + /* turn verify mode on */ + gen->variant |= SSR_VARFLAG_VERIFY; + else + /* turn verify mode off */ + gen->variant &= ~SSR_VARFLAG_VERIFY; + + SAMPLE = _unur_ssr_getSAMPLE(gen); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_ssr_chg_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ssr_set_usesqueeze( struct unur_par *par, int usesqueeze ) + /*----------------------------------------------------------------------*/ + /* set flag for using universal squeeze (default: off) */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* usesqueeze ... 0 = no squeeze, !0 = use squeeze */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no squeeze is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, SSR ); + + /* we use a bit in variant */ + par->variant = (usesqueeze) + ? (par->variant | SSR_VARFLAG_SQUEEZE) + : (par->variant & (~SSR_VARFLAG_SQUEEZE)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_ssr_set_usesqueeze() */ + +/*****************************************************************************/ + +int +unur_ssr_chg_cdfatmode( struct unur_gen *gen, double Fmode ) + /*----------------------------------------------------------------------*/ + /* change value of CDF at mode */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* Fmode ... CDF at mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (Fmode < 0. || Fmode > 1.) { + _unur_warning(gen->genid,UNUR_ERR_PAR_SET,"CDF(mode)"); + return UNUR_ERR_PAR_SET; + } + + /* copy parameters */ + GEN->Fmode = Fmode; + + /* changelog */ + gen->set |= SSR_SET_CDFMODE; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_ssr_chg_cdfatmode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_ssr_chg_pdfatmode( struct unur_gen *gen, double fmode ) + /*----------------------------------------------------------------------*/ + /* change value of PDF at mode */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* fmode ... PDF at mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (fmode <= 0.) { + _unur_warning(gen->genid,UNUR_ERR_PAR_SET,"PDF(mode)"); + return UNUR_ERR_PAR_SET; + } + if (!_unur_isfinite(fmode)) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode) overflow"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + GEN->fm = fmode; + GEN->um = sqrt(fmode); + + /* changelog */ + gen->set |= SSR_SET_PDFMODE; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_ssr_chg_pdfatmode() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_ssr_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* params pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_SSR ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_SSR_PAR,NULL); + + if (! (par->set & SSR_SET_CDFMODE)) + /* cdf at mode unknown --> + thus we cannot use universal squeeze */ + par->variant &= ~SSR_VARFLAG_SQUEEZE; + + /* create a new empty generator object */ + gen = _unur_ssr_create(par); + + /* free parameters */ + _unur_par_free(par); + + if (!gen) return NULL; + + /* check parameters */ + if (_unur_ssr_check_par(gen) != UNUR_SUCCESS) { + _unur_ssr_free(gen); return NULL; + } + + /* compute universal bounding rectangle */ + if (_unur_ssr_hat(gen)!=UNUR_SUCCESS) { + _unur_ssr_free(gen); return NULL; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_ssr_debug_init(gen, FALSE); +#endif + + return gen; +} /* end of _unur_ssr_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_ssr_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int rcode; + + /* check parameters */ + if ( (rcode = _unur_ssr_check_par(gen)) != UNUR_SUCCESS) + return rcode; + + /* compute universal bounding rectangle */ + rcode = _unur_ssr_hat( gen ); + + /* (re)set sampling routine */ + SAMPLE = _unur_ssr_getSAMPLE(gen); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & SSR_DEBUG_REINIT) _unur_ssr_debug_init(gen,TRUE); +#endif + + return rcode; +} /* end of _unur_ssr_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_ssr_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_SSR_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_ssr_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_SSR_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_ssr_getSAMPLE(gen); + gen->destroy = _unur_ssr_free; + gen->clone = _unur_ssr_clone; + gen->reinit = _unur_ssr_reinit; + + /* copy some parameters into generator object */ + GEN->Fmode = PAR->Fmode; /* CDF at mode */ + GEN->fm = PAR->fm; /* PDF at mode */ + GEN->um = PAR->um; /* square root of PDF at mode */ + + /* initialize parameters */ + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_ssr_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_ssr_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_ssr_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check for required data: mode */ + if (!(gen->distr->set & UNUR_DISTR_SET_MODE)) { + _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode: try finding it (numerically)"); + if (unur_distr_cont_upd_mode(gen->distr)!=UNUR_SUCCESS) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode"); + return UNUR_ERR_DISTR_REQUIRED; + } + } + + /* check for required data: area */ + if (!(gen->distr->set & UNUR_DISTR_SET_PDFAREA)) { + if (unur_distr_cont_upd_pdfarea(gen->distr)!=UNUR_SUCCESS) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"area below PDF"); + return UNUR_ERR_DISTR_REQUIRED; + } + } + + /* mode must be in domain */ + if ( (DISTR.mode < DISTR.BD_LEFT) || + (DISTR.mode > DISTR.BD_RIGHT) ) { + /* there is something wrong. + assume: user has change domain without changing mode. + but then, she probably has not updated area and is to large */ + _unur_warning(GENTYPE,UNUR_ERR_GEN_DATA,"area and/or CDF at mode"); + DISTR.mode = _unur_max(DISTR.mode,DISTR.BD_LEFT); + DISTR.mode = _unur_min(DISTR.mode,DISTR.BD_RIGHT); + } + + return UNUR_SUCCESS; +} /* end of _unur_ssr_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_ssr_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_ssr_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_SSR_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + return clone; + +#undef CLONE +} /* end of _unur_ssr_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_ssr_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_SSR ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_SSR_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_ssr_free() */ + +/*****************************************************************************/ + +double +_unur_ssr_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U,V,X,xx,y; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_SSR_GEN,UNUR_INFINITY); + + while (1) { + /* uniform ~U(0,1) */ + while ( _unur_iszero(U = GEN->Aleft + _unur_call_urng(gen->urng) * GEN->Ain) ); + + if (U < GEN->al) { /* first part */ + X = - GEN->vl * GEN->vl / U; + y = (U / GEN->vl); + y = y*y; + } + else if (U <= GEN->ar) { /* second part */ + X = GEN->xl + (U-GEN->al)/GEN->fm; + y = GEN->fm; + } + else { /* third part */ + X = GEN->vr * GEN->vr / (GEN->um * GEN->vr - (U-GEN->ar)); + y = (GEN->A - U) / GEN->vr; + y = y*y; + } + + /* accept or reject */ + V = _unur_call_urng(gen->urng); + y *= V; + + /* evaluate squeeze */ + if (gen->variant & SSR_VARFLAG_SQUEEZE) { + xx = 2 * X; + if ( xx >= GEN->xl && xx <= GEN->xr && y <= GEN->fm/4. ) + return (X + DISTR.mode); + } + + /* Compute X */ + X += DISTR.mode; + + /* evaluate PDF */ + if (y <= PDF(X)) + return X; + } + +} /* end of _unur_ssr_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_ssr_sample_check( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator and verify that method can be used */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double U,V,X,xx,fx,y; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_SSR_GEN,UNUR_INFINITY); + + while (1) { + /* uniform ~U(0,1) */ + while ( _unur_iszero(U = GEN->Aleft + _unur_call_urng(gen->urng) * GEN->Ain) ); + + if (U < GEN->al) { /* first part */ + X = - GEN->vl * GEN->vl / U; + y = (U / GEN->vl); + y = y*y; + } + else if (U <= GEN->ar) { /* second part */ + X = GEN->xl + (U-GEN->al)/GEN->fm; + y = GEN->fm; + } + else { /* third part */ + X = GEN->vr * GEN->vr / (GEN->um * GEN->vr - (U-GEN->ar)); + y = (GEN->A - U) / GEN->vr; + y = y*y; + } + + /* compute PDF at x */ + fx = PDF(X + DISTR.mode); + + /* verify hat function */ + if ( (1.+UNUR_EPSILON) * y < fx ) + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) > hat(x)"); + + /* accept or reject */ + V = _unur_call_urng(gen->urng); + y *= V; + + /* evaluate and check squeeze */ + if (gen->variant & SSR_VARFLAG_SQUEEZE) { + xx = 2 * X; + if ( xx >= GEN->xl && xx <= GEN->xr ) { + /* check squeeze */ + if ( fx < (1.-UNUR_EPSILON) * GEN->fm/4. ) + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) < squeeze(x)"); + /* evaluate squeeze */ + if ( y <= GEN->fm/4. ) + return (X + DISTR.mode); + } + } + + /* Compute X */ + X += DISTR.mode; + + /* evaluate PDF */ + if (y <= fx) + return X; + } + +} /* end of _unur_ssr_sample_check() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_ssr_hat( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* compute universal hat */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double vm, fm; /* width of rectangle, PDF at mode */ + double left,right; + + /* check arguments */ + CHECK_NULL( gen, UNUR_ERR_NULL ); + COOKIE_CHECK( gen,CK_SSR_GEN, UNUR_ERR_COOKIE ); + + /* compute PDF at mode (if not given by user) */ + if (!(gen->set & SSR_SET_PDFMODE)) { + fm = PDF(DISTR.mode); + /* fm must be positive */ + if (fm <= 0.) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"PDF(mode) <= 0."); + return UNUR_ERR_GEN_DATA; + } + if (!_unur_isfinite(fm)) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode) overflow"); + return UNUR_ERR_PAR_SET; + } + GEN->fm = fm; /* PDF at mode */ + GEN->um = sqrt(fm); /* square root of PDF at mode */ + } + + /* compute parameters */ + vm = DISTR.area / GEN->um; + + if (gen->set & SSR_SET_CDFMODE) { + /* cdf at mode known */ + GEN->vl = -GEN->Fmode * vm; + GEN->vr = vm + GEN->vl; + GEN->xl = GEN->vl/GEN->um; + GEN->xr = GEN->vr/GEN->um; + GEN->A = 2 * DISTR.area; + GEN->al = (DISTR.BD_LEFT < DISTR.mode) ? (GEN->Fmode * DISTR.area) : 0.; + GEN->ar = (DISTR.BD_RIGHT > DISTR.mode) ? (GEN->al + DISTR.area) : GEN->A; + /* Compute areas below hat in left tails and inside domain of PDF */ + if ( (DISTR.BD_LEFT > -UNUR_INFINITY) && + (DISTR.BD_LEFT < DISTR.mode) ) + GEN->Aleft = GEN->vl * GEN->vl / (DISTR.mode - DISTR.BD_LEFT); + else + GEN->Aleft = 0.; + + if ( (DISTR.BD_RIGHT < UNUR_INFINITY) && + (DISTR.BD_RIGHT > DISTR.mode) ) + GEN->Ain = GEN->A - GEN->vr * GEN->vr / (DISTR.BD_RIGHT - DISTR.mode); + else + GEN->Ain = GEN->A; + GEN->Ain -= GEN->Aleft; + } + + else { + /* cdf at mode unknown */ + GEN->vl = -vm; + GEN->vr = vm; + GEN->xl = GEN->vl/GEN->um; + GEN->xr = GEN->vr/GEN->um; + GEN->A = 4 * DISTR.area; + GEN->al = DISTR.area; + GEN->ar = 3 * DISTR.area; + /* Compute areas below hat in left tails and inside domain of PDF */ + if (DISTR.BD_LEFT > -UNUR_INFINITY) { + left = DISTR.BD_LEFT - DISTR.mode; + GEN->Aleft = (GEN->xl > left) + ? (GEN->vl * GEN->vl / (-left)) + : (GEN->al + GEN->fm * (left - GEN->xl)); + } + else + GEN->Aleft = 0.; + + if (DISTR.BD_RIGHT < UNUR_INFINITY) { + right = DISTR.BD_RIGHT - DISTR.mode; + GEN->Ain = (GEN->xr < right) + ? (GEN->A - GEN->vr * GEN->vr / right) + : (GEN->ar - GEN->fm * (GEN->xr - right)); + } + else + GEN->Ain = GEN->A; + GEN->Ain -= GEN->Aleft; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ +#endif + + return UNUR_SUCCESS; +} /* end of _unur_ssr_hat() */ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +static void +_unur_ssr_debug_init( const struct unur_gen *gen, int is_reinit ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* is_reinit ... if TRUE the generator has been reinitialized */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_SSR_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + if (!is_reinit) { + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = ssr (simple universal transformed density rection)\n",gen->genid); + } + else + fprintf(LOG,"%s: reinit!\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cont_debug( gen->distr, gen->genid ); + + fprintf(LOG,"%s: sampling routine = _unur_ssr_sample",gen->genid); + if (gen->variant & SSR_VARFLAG_VERIFY) + fprintf(LOG,"_check"); + /* else if (gen->variant & SSR_VARFLAG_MIRROR) not implemented */ + /* fprintf(LOG,"_mirror"); */ + fprintf(LOG,"()\n%s:\n",gen->genid); + + if (gen->set & SSR_SET_CDFMODE) + fprintf(LOG,"%s: CDF at mode = %g\n",gen->genid,GEN->Fmode); + else + fprintf(LOG,"%s: CDF at mode unknown\n",gen->genid); + + if (gen->variant & SSR_VARFLAG_SQUEEZE) + fprintf(LOG,"%s: use universal squeeze\n",gen->genid); + else + fprintf(LOG,"%s: no (universal) squeeze\n",gen->genid); + + /* if (gen->variant & SSR_VARFLAG_MIRROR) */ + /* fprintf(LOG,"%s: use mirror principle\n",gen->genid); */ + + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: parts:\n",gen->genid); + fprintf(LOG,"%s:\txl = %g\n",gen->genid,GEN->xl); + fprintf(LOG,"%s:\txr = %g\n",gen->genid,GEN->xr); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: PDF at mode:\n",gen->genid); + fprintf(LOG,"%s:\tfm = %g\n",gen->genid,GEN->fm); + fprintf(LOG,"%s:\tum = %g\n",gen->genid,GEN->um); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: areas:\n",gen->genid); + fprintf(LOG,"%s:\t al = %g\n",gen->genid,GEN->al); + fprintf(LOG,"%s:\t ar = %g\n",gen->genid,GEN->ar); + fprintf(LOG,"%s:\t Aleft = %g\n",gen->genid,GEN->Aleft); + fprintf(LOG,"%s:\t Ain = %g\n",gen->genid,GEN->Ain); + fprintf(LOG,"%s:\tAtotal = %g\n",gen->genid,GEN->A); + + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_ssr_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_ssr_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + int samplesize = 10000; + double rc, rc_approx; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = PDF\n"); + _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info," mode = %g %s\n", DISTR.mode, + (distr->set & UNUR_DISTR_SET_MODE_APPROX) ? "[numeric.]" : ""); + _unur_string_append(info," area(PDF) = %g\n", DISTR.area); + if (gen->set & SSR_SET_CDFMODE) + _unur_string_append(info," F(mode) = %g\n", GEN->Fmode); + else + _unur_string_append(info," F(mode) = [unknown]\n"); + + if (help) { + if ( distr->set & UNUR_DISTR_SET_MODE_APPROX ) + _unur_string_append(info,"\n[ Hint: %s ]\n", + "You may provide the \"mode\""); + } + _unur_string_append(info,"\n"); + + /* method */ + _unur_string_append(info,"method: SSR (Simple Setup Rejection)\n"); + if (gen->set & SSR_SET_CDFMODE) + _unur_string_append(info," use CDF at mode\n"); + if (gen->variant & SSR_VARFLAG_SQUEEZE) + _unur_string_append(info," use squeeze\n"); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + rc = (gen->set & SSR_SET_CDFMODE) ? 2. : 4.; + if (_unur_isfinite(DISTR.BD_RIGHT) || _unur_isfinite(DISTR.BD_LEFT)) { + rc_approx = unur_test_count_urn(gen,samplesize,0,NULL)/(2.*samplesize); + _unur_string_append(info," rejection constant <= %g [approx. = %.2f]\n", rc,rc_approx); + } + else { + _unur_string_append(info," rejection constant = %g\n", rc); + } + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + if (gen->set & SSR_SET_CDFMODE) + _unur_string_append(info," cdfatmode = %g\n", GEN->Fmode); + else + _unur_string_append(info," cdfatmode = [not set]\n"); + + if (gen->variant & SSR_VARFLAG_SQUEEZE) + _unur_string_append(info," usesqueeze\n"); + + if (gen->variant & SSR_VARFLAG_VERIFY) + _unur_string_append(info," verify = on\n"); + + _unur_string_append(info,"\n"); + + /* Not displayed: + int unur_ssr_set_pdfatmode( UNUR_PAR *parameters, double fmode ); + */ + } + + /* Hints */ + if (help) { + if ( !(gen->set & SSR_SET_CDFMODE)) + _unur_string_append(info,"[ Hint: %s ]\n", + "You can set \"cdfatmode\" to reduce the rejection constant."); + _unur_string_append(info,"\n"); + } + +} /* end of _unur_ssr_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/ssr.h b/vendor/unuran-1.11.0/src/methods/ssr.h new file mode 100644 index 0000000..593bf12 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/ssr.h @@ -0,0 +1,197 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: ssr.h * + * * + * PURPOSE: * + * function prototypes for method SSR * + * (Simple Setup, Rejection with universal bounds) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD SSR Simple Setup Rejection + + =UP Methods_for_CONT + + =REQUIRED T-concave PDF, mode, area + + =SPEED Set-up: fast, Sampling: slow + + =REINIT supported + + =REF [LJa01] [HLD04: Sect.6.3.3, Alg.6.6] + + =DESCRIPTION + SSR is an acceptance/rejection method that uses universal + inequalities for constructing (universal) hats and squeezes + (@pxref{Rejection}). + It works for all @i{T}-concave distributions with + @unurmath{T(x) = -1/\sqrt{x}.} + + It requires the PDF, the (exact) location of the mode and the + area below the given PDF. The rejection constant is 4 for all + @i{T}-concave distributions with unbounded domain and is less + than 4 when the domain is bounded. Optionally the CDF at the + mode can be given to increase the performance of the algorithm. + Then the rejection constant is at most 2 and a universal squeeze + can (but need not be) used. However, using squeezes is not + recommended unless the evaluation of the PDF is expensive. + + The exact location of the mode and/or the area below the PDF can + be replace by appropriate bounds. Then the algorithm still works + but has larger rejection constants. + + =HOWTOUSE + SSR works for any continuous univariate distribution object with + given @i{T}-concave PDF (with @unurmath{T(x) = -1/\sqrt{x},)} + mode and area below PDF. Optional the CDF at the mode + can be given to increase the performance of the algorithm by + means of the unur_ssr_set_cdfatmode() call. Additionally + squeezes can be used and switched on via + unur_ssr_set_usesqueeze(). + + If the (exact) area below the PDF is not known, then an upper + bound can be used instead (which of course increases the rejection + constant). But then the squeeze flag must not be set and + unur_ssr_set_cdfatmode() must not be used. + + If the exact location of the mode is not known, then use the + approximate location and provide the (exact) value of the PDF at + the mode by means of the unur_ssr_set_pdfatmode() call. But then + unur_ssr_set_cdfatmode() must not be used. Notice, that a (slow) + numerical mode finder will be used if no mode is given at all. + It is even possible to give an upper bound for the PDF only. + However, then the (upper bound for the) area below the PDF has to be + multiplied by the ratio between the upper bound and the lower bound of + the PDF at the mode. Again setting the squeeze flag and using + unur_ssr_set_cdfatmode() is not allowed. + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + Notice, that derived parameters like the mode must also be (re-) set + if the parameters or the domain has be changed. + Moreover, if the PDF at the mode has been provided by a + unur_ssr_set_pdfatmode() call, additionally + unur_ssr_chg_pdfatmode() must be used (otherwise this call is + not necessary since then this figure is computed directly from + the PDF). + + @emph{Important:} + If any of mode, PDF or CDF at the mode, or the area below the mode + has been changed, then unur_reinit() must be executed. + (Otherwise the generator produces garbage). + + There exists a test mode that verifies whether the conditions for + the method are satisfied or not while sampling. It can be + switched on/off by calling unur_ssr_set_verify() and + unur_ssr_chg_verify(), respectively. + Notice, however, that sampling is (a little bit) slower then. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_ssr_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_ssr_set_cdfatmode( UNUR_PAR *parameters, double Fmode ); +/* + Set CDF at mode. + When set, the performance of the algorithm is increased by factor 2. + However, when the parameters of the distribution are changed + unur_ssr_chg_cdfatmode() has to be used to update this value. + + Default: not set. +*/ + +int unur_ssr_set_pdfatmode( UNUR_PAR *parameters, double fmode ); +/* + Set pdf at mode. + When set, the PDF at the mode is never changed. + This is to avoid additional computations, when the PDF does not + change when parameters of the distributions vary. + It is only useful when the PDF at the mode does not change with + changing parameters for the distribution. + + Default: not set. +*/ + +int unur_ssr_set_usesqueeze( UNUR_PAR *parameters, int usesqueeze ); +/* + Set flag for using universal squeeze (default: off). + Using squeezes is only useful when the evaluation of the PDF is + (extremely) expensive. + Using squeezes is automatically disabled when the CDF at the mode + is not given (then no universal squeezes exist). + + Default is FALSE. +*/ + +int unur_ssr_set_verify( UNUR_PAR *parameters, int verify ); +/* */ + +int unur_ssr_chg_verify( UNUR_GEN *generator, int verify ); +/* + Turn verifying of algorithm while sampling on/off. + If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is + violated for some @i{x} then @code{unur_errno} is set to + @code{UNUR_ERR_GEN_CONDITION}. However notice that this might + happen due to round-off errors for a few values of + @i{x} (less than 1%). + + Default is FALSE. +*/ + +/*...........................................................................*/ + +int unur_ssr_chg_cdfatmode( UNUR_GEN *generator, double Fmode ); +/* + Change CDF at mode of distribution. + unur_reinit() must be executed before sampling from the + generator again. +*/ + +int unur_ssr_chg_pdfatmode( UNUR_GEN *generator, double fmode ); +/* + Change PDF at mode of distribution. + unur_reinit() must be executed before sampling from the + generator again. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/ssr_struct.h b/vendor/unuran-1.11.0/src/methods/ssr_struct.h new file mode 100644 index 0000000..158b80e --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/ssr_struct.h @@ -0,0 +1,58 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: ssr_struct.h * + * * + * PURPOSE: * + * declares structures for method SSR * + * (Simple Setup, Rejection with universal bounds) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_ssr_par { + double Fmode; /* cdf at mode */ + double fm; /* pdf at mode */ + double um; /* sqrt of pdf at mode */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_ssr_gen { + double fm; /* pdf at mode */ + double um; /* sqrt of pdf at mode */ + double vl, vr; /* parameters for hat function */ + double xl, xr; /* partition points of hat */ + double al, ar; /* areas below hat in first and secont part */ + double A; /* area below hat */ + double Aleft, Ain; /* areas below hat in left tails and inside domain of pdf */ + double Fmode; /* cdf at mode */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/tabl.c b/vendor/unuran-1.11.0/src/methods/tabl.c new file mode 100644 index 0000000..42f89bd --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tabl.c @@ -0,0 +1,319 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tabl.h * + * * + * TYPE: continuous univariate random variate * + * METHOD: rejection form piecewise constant hat * + * (Ahren's table method) * + * * + * DESCRIPTION: * + * Given PDF of a unimodal distribution * + * produce random variate X with its density * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Ahrens J. H. (1993): Sampling from general distributions by * + * suboptimal division of domains, * + * Grazer Math. Berichte 319, 30pp. * + * * + * [2] Ahrens J. H. (1995): An one-table method for sampling from * + * continuous and discrete distributions, * + * Computing 54(2), pp. 127-146 * + * * + * [3] Hoermann, W., Leydold J., and Derflinger, G. (2004): * + * Automatic non-uniform random variate generation, Springer, Berlin. * + * Section 2.4, Algorithm 2.9 (RoU), p.35 * + * * + * SEE ALSO: * + * [4] Gilks, W. R. and Wild, P. (1992): * + * Adaptive rejection sampling for Gibbs sampling, * + * Applied Statistics 41, pp. 337-348 * + * * + * [5] Zaman, A. (1996), Generation of Random Numbers from an Arbitrary * + * Unimodal Density by Cutting Corners, unpublished manuskript * + * available at http://chenab.lums.edu.pk/~arifz/ * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "tabl.h" +#include "tabl_struct.h" + +/*---------------------------------------------------------------------------*/ +/* Constants */ + +#define TABL_DEFAULT_COMPUTATION_LIMIT 1.e20 +/* + The domain has to be finite for method TABL. + Thus the domain has to be truncated where the regions (tails) that are + chopped off must not of "computational relevance". + By default the points for chopping of the tails are +/- this figure. +*/ + +#define TABL_N_RETRY_DARS 5 +#define TABL_N_RUN_ARS 10 +/* + Sometimes DARS fails then we need random splitting points for the intervals, + i.e. we have to run ARS a few times an continue (retry) with DARS. + These figures give the number of retries and the number of sampling using + ARS, respectively. +*/ + +/*---------------------------------------------------------------------------*/ +/* Variants */ + +/* how to sample from genertor object */ +#define TABL_VARMASK_VARIANT 0x000fu /* indicates which variant */ +#define TABL_VARIANT_IA 0x0001u /* use immediate acceptance */ + +#define TABL_VARIANT_FAST 0x0002u /* use single array for data + (not implemented) */ + +/* indicate how to split interval */ +#define TABL_VARMASK_SPLIT 0x00f0u /* split at computation convergence of hat */ +#define TABL_VARFLAG_SPLIT_POINT 0x0010u /* sampled point none slowest */ +#define TABL_VARFLAG_SPLIT_MEAN 0x0020u /* mean point slower better */ +#define TABL_VARFLAG_SPLIT_ARC 0x0040u /* "arcmean" very slow very good for almost unbounded domain */ + +/* indicate if starting intervals have to be split */ +#define TABL_VARFLAG_USEEAR 0x0100u /* use equal area rule (SPLIT A in [1]) */ +#define TABL_VARFLAG_USEDARS 0x0200u /* use main subdivisions (SPLIT B in [1]) + (= derandomized ARS) */ +#define TABL_VARFLAG_PEDANTIC 0x0400u /* whether pedantic checking is used */ +#define TABL_VARFLAG_VERIFY 0x0800u /* flag for verifying mode */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define TABL_DEBUG_IV 0x00000100u /* show intervals */ +#define TABL_DEBUG_IV_START 0x00000200u /* show starting intervals */ +#define TABL_DEBUG_EAR 0x00000400u /* show intervals after EAR */ +#define TABL_DEBUG_DARS 0x00000800u /* indicate DARS in LOG file */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define TABL_SET_GUIDEFACTOR 0x0001u +#define TABL_SET_SLOPES 0x0004u +#define TABL_SET_AREAFRACTION 0x0008u +#define TABL_SET_MAX_IVS 0x0010u +#define TABL_SET_MAX_SQHRATIO 0x0020u +#define TABL_SET_N_STP 0x0040u +#define TABL_SET_STP 0x0080u +#define TABL_SET_BOUNDARY 0x0100u +#define TABL_SET_USE_EAR 0x0200u +#define TABL_SET_USE_DARS 0x0400u +#define TABL_SET_DARS_FACTOR 0x0800u + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "TABL" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_tabl_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_tabl_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_tabl_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_tabl_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_tabl_rh_sample( struct unur_gen *gen ); +static double _unur_tabl_rh_sample_check( struct unur_gen *gen ); +static double _unur_tabl_ia_sample( struct unur_gen *gen ); +static double _unur_tabl_ia_sample_check( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static int _unur_tabl_get_intervals_from_slopes( struct unur_par *par, struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* compute starting intervals from slopes */ +/*---------------------------------------------------------------------------*/ + +static int _unur_tabl_get_intervals_from_cpoints( struct unur_par *par, struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* compute starting intervals from given cpoints */ +/*---------------------------------------------------------------------------*/ + +static int _unur_tabl_compute_intervals( struct unur_par *par, struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* compute all intervals (by splitting starting intervals/slopes) */ +/*---------------------------------------------------------------------------*/ + +static struct unur_tabl_interval * +_unur_tabl_run_equalarearule( struct unur_par *par, struct unur_gen *gen, struct unur_tabl_interval *iv_slope ); +/*---------------------------------------------------------------------------*/ +/* split starting intervals according to [1] */ +/* SPLIT A (equal areas rule) */ +/*---------------------------------------------------------------------------*/ + +static int _unur_tabl_run_dars( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* run derandomized adaptive rejection sampling. */ +/* (split starting intervals according to [1] SPLIT B, */ +/* but instead of the iteration in [1] use "arcmean". */ +/*---------------------------------------------------------------------------*/ + +static int +_unur_tabl_split_interval( struct unur_gen *gen, struct unur_tabl_interval *iv, + double x, double fx, unsigned split_mode ); +/*---------------------------------------------------------------------------*/ +/* split interval (replace old one by two new ones in same place) */ +/*---------------------------------------------------------------------------*/ + +static int +_unur_tabl_improve_hat( struct unur_gen *gen, struct unur_tabl_interval *iv, + double x, double fx ); +/*---------------------------------------------------------------------------*/ +/* improve hat function by splitting interval */ +/*---------------------------------------------------------------------------*/ + +static int _unur_tabl_make_guide_table( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* make a guide table for indexed search. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_tabl_eval_cdfhat( struct unur_gen *gen, double x ); +/*---------------------------------------------------------------------------*/ +/* evaluate CDF of hat at x. */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_tabl_debug_init_start( const struct unur_par *par, const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after (almost empty generator) object has been created. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_tabl_debug_init_finished( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_tabl_debug_dars_start( const struct unur_par *par, const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print header before runniung derandomized adaptive rejection sampling. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_tabl_debug_free( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print before generater is destroyed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_tabl_debug_intervals( const struct unur_gen *gen, const char *header, int print_areas ); +/*---------------------------------------------------------------------------*/ +/* print data for intervals. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_tabl_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cont /* data for distribution object */ + +#define PAR ((struct unur_tabl_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_tabl_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define BD_LEFT domain[0] /* left boundary of domain of distribution */ +#define BD_RIGHT domain[1] /* right boundary of domain of distribution */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +#define PDF(x) _unur_cont_PDF((x),(gen->distr)) /* call to PDF */ + +/*---------------------------------------------------------------------------*/ + +static UNUR_SAMPLING_ROUTINE_CONT * +_unur_tabl_getSAMPLE( struct unur_gen *gen ) +{ + if (gen->variant & TABL_VARIANT_IA) + /* immediate acceptance */ + return (gen->variant & TABL_VARFLAG_VERIFY) + ? _unur_tabl_ia_sample_check + : _unur_tabl_ia_sample; + else + /* "classical" acceptance/rejection method */ + return (gen->variant & TABL_VARFLAG_VERIFY) + ? _unur_tabl_rh_sample_check + : _unur_tabl_rh_sample; +} /* end of _unur_tabl_getSAMPLE() */ + +/*---------------------------------------------------------------------------*/ +/* since there is only file scope or program code, we abuse the */ +/* #include directive. */ + +/** Public: User Interface (API) **/ +#include "tabl_newset.ch" + +/** Private **/ +#include "tabl_init.ch" +#include "tabl_sample.ch" +#include "tabl_debug.ch" +#include "tabl_info.ch" + +/* #include "tabl_fast.ch" ... not implemented (only experimental code) */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/tabl.h b/vendor/unuran-1.11.0/src/methods/tabl.h new file mode 100644 index 0000000..7d513bf --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tabl.h @@ -0,0 +1,444 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tabl.h * + * * + * PURPOSE: * + * function prototypes for method TABL * + * (Ahren's TABLe method: piecewise constant hat) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD TABL a TABLe method with piecewise constant hats + + =UP Methods_for_CONT + + =REQUIRED PDF, all local extrema, cut-off values for the tails + + =OPTIONAL approximate area + + =SPEED Set-up: (very) slow, Sampling: fast + + =REINIT not implemented + + =REF [AJa93] [AJa95] [HLD04: Cha.5.1] + + =ABSTRACT Large tables necessary for heavy tailed distributions + + =DESCRIPTION + TABL (called Ahrens method in @unurbibref{HLD04}) + is an acceptance/rejection method (@pxref{Rejection}) that uses + a decomposition of the domain of the distribution into many + short subintervals. Inside of these subintervals constant hat + and squeeze functions are utilized. Thus it is easy to use the + idea of immediate acceptance for points below the squeeze. This + reduces the expected number of uniform random numbers per + generated random variate to less than two. Using a large number + of subintervals only little more than one random number is + necessary on average. Thus this method becomes very fast. + + Due to the constant hat function this method only works for + distributions with bounded domains. Thus for unbounded domains + the left and right tails have to be cut off. This is no problem + when the probability of falling into these tail regions is + beyond computational relevance (e.g. smaller than @code{1.e-12}). + + For easy construction of hat and squeeze functions it is necessary + to know the regions of monotonicity (called @emph{slopes}) or + equivalently all local maxima and minima of the density. + The main problem for this method in the setup is the choice of the + subintervals. A simple and close to optimal approach is the + "equal area rule" @unurbibref{HLD04: Cha.5.1}. There the subintervals are + selected such that the area below the hat is the same for + each subinterval which can be realized with a simple recursion. + If more subintervals are necessary it is possible to split + either randomly chosen intervals (adaptive rejection sampling, ARS) + or those intervals, where the ratio between squeeze and hat is + smallest. This version of the setup is called derandomized ARS + (DARS). With the default settings TABL is first calculating + approximately 30 subintervals with the equal area rule. Then + DARS is used till the desired fit of the hat is reached. + + A convenient measure to control the quality of the fit of hat + and squeeze is the ratio (area below squeeze)/(area below hat) + called @code{sqhratio} which must be smaller or equal to one. + The expected number of iterations in the rejection algorithm + is known to be smaller than 1/sqhratio and the expected number + of evaluations of the density is bounded by @code{1/sqhratio - 1}. + So values of the sqhratio close to one (e.g. @code{0.95} or + @code{0.99}) lead to many subintervals. Thus a better fitting + hat is constructed and the sampling algorithm becomes fast; on + the other hand large tables are needed and the setup is very + slow. For moderate values of sqhratio (e.g. @code{0.9} or + @code{0.8}) the sampling is slower but the required tables are + smaller and the setup is not so slow. + + It follows from the above explanations that TABL is always + requiring a slow setup and that it is not very well suited for + heavy-tailed distributions. + + =HOWTOUSE + + For using the TABL method UNU.RAN needs a bounded interval to + which the generated variates can be restricted and information + about all local extrema of the distribution. For unimodal + densities it is sufficient to provide the mode of the + distribution. For the case of a built-in unimodal distribution + with bounded domain all these information is present in the + distribution object and thus no extra input is necessary (see + example_TABL1 below). + + For a built-in unimodal distribution with unbounded domain we + should specify the cut-off values for the tails. This can be + done with the unur_tabl_set_boundary() call (see example_TABL2 + below). For the case that we do not set these boundaries the + default values of @code{+/- 1.e20} are used. We can see in + example_TABL1 that this still works fine for many standard + distributions. + + For the case of a multimodal distribution we have to set the + regions of monotonicity (called slopes) explicitly using the + unur_tabl_set_slopes() command (see example_TABL3 below). + + To controll the fit of the hat and the size of the tables and + thus the speed of the setup and the sampling it is most + convenient to use the unur_tabl_set_max_sqhratio() call. The + default is @code{0.9} which is a sensible value for most + distributions and applications. If very large samples of a + distribution are required or the evaluation of a density is very + slow it may be useful to increase the sqhratio to + eg. @code{0.95} or even @code{0.99}. With the + unur_tabl_get_sqhratio() call we can check which sqhratio was + really reached. If that value is below the desired value it is + necessary to increase the maximal number of subintervals, which + defaults to @code{1000}, using the unur_tabl_set_max_intervals() call. + The unur_tabl_get_n_intervals() call can be used to find out the + number of subintervals the setup calculated. + + It is also possible to set the number of intervals and their + respective boundaries by means of the unur_tabl_set_cpoints() + call. + + It is also possible to use method TABL for correlation induction + (variance reduction) by setting of an auxiliary uniform random + number generator via the unur_set_urng_aux() call. (Notice that + this must be done after a possible unur_set_urng() call.) + However, this only works when immediate acceptance is switched + off by a unur_tabl_set_variant_ia() call. + + =END + +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_tabl_new( const UNUR_DISTR* distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_tabl_set_variant_ia( UNUR_PAR *parameters, int use_ia ); +/* + Use immediate acceptance when @var{use_ia} is set to TRUE. + This technique requires less uniform. If it is set to FALSE, + ``classical'' acceptance/rejection from hat distribution + is used. + + @emph{Notice:} Auxiliary uniform random number generators for + correlation induction (variance reduction) can only be used when + ``classical'' acceptance/rejection is used. + + Default: TRUE. +*/ + +int unur_tabl_set_cpoints( UNUR_PAR *parameters, int n_cpoints, const double *cpoints ); +/* + Set construction points for the hat function. If @var{stp} is NULL + than a heuristic rule of thumb is used to get @var{n_stp} + construction points. This is the default behavior. + + The default number of construction points is @code{30}. +*/ + +int unur_tabl_set_nstp( UNUR_PAR *parameters, int n_stp ); +/* + Set number of construction points for the hat function. @var{n_stp} + must be greater than zero. After the setup there are about + @var{n_stp} construction points. However it might be larger when a + small fraction is given by the unur_tabl_set_areafraction() call. + It also might be smaller for some variants. + + Default is @code{30}. +*/ + +int unur_tabl_set_useear( UNUR_PAR *parameters, int useear ); +/* + If @var{useear} is set to TRUE, the ``equal area rule'' is used, + the given slopes are partitioned in such a way that the area below + the hat function in each subinterval (``stripe'') has the same + area (except the last the last interval which can be smaller). + The area can be set by means of the unur_tabl_set_areafraction() + call. + + Default is TRUE. +*/ + +int unur_tabl_set_areafraction( UNUR_PAR *parameters, double fraction ); +/* + Set parameter for the equal area rule. During the setup a piecewise + constant hat is constructed, such that the area below each of these + pieces (strips) is the same and equal to the (given) area below the + PDF times @var{fraction} (which must be greater than + zero). + + @emph{Important:} If the area below the PDF is not set in the + distribution object, then 1 is assumed. + + Default is @code{0.1}. +*/ + +int unur_tabl_set_usedars( UNUR_PAR *parameters, int usedars ); +/* + If @var{usedars} is set to TRUE, ``derandomized adaptive rejection + sampling'' (DARS) is used in the setup. + Intervals, where the area between hat and squeeze is too + large compared to the average area between hat and squeeze + over all intervals, are split. + This procedure is repeated until the ratio between squeeze and hat + exceeds the bound given by unur_tabl_set_max_sqhratio() call or the + maximum number of intervals is reached. Moreover, it also aborts + when no more intervals can be found for splitting. + + For finding splitting points the arc-mean rule (a mixture of + arithmetic mean and harmonic mean) is used. + + Default is TRUE. +*/ + +int unur_tabl_set_darsfactor( UNUR_PAR *parameters, double factor ); +/* + Set factor for ``derandomized adaptive rejection sampling''. + This factor is used to determine the segments that are ``too + large'', that is, all segments where the area between squeeze and + hat is larger than @var{factor} times the average area over all + intervals between squeeze and hat. + Notice that all segments are split when @var{factor} is set to + @code{0.}, and that there is no splitting at all when @var{factor} + is set to @code{UNUR_INFINITY}. + + Default is @code{0.99}. There is no need to change this parameter. +*/ + +int unur_tabl_set_variant_splitmode( UNUR_PAR *parameters, unsigned splitmode ); +/* + There are three variants for adaptive rejection sampling. These + differ in the way how an interval is split: + @table @r + @item splitmode @code{1} + use the generated point to split the interval. + @item splitmode @code{2} + use the mean point of the interval. + @item splitmode @code{3} + use the arcmean point; + suggested for distributions with heavy tails. + + @end table + Default is splitmode @code{2}. +*/ + +int unur_tabl_set_max_sqhratio( UNUR_PAR *parameters, double max_ratio ); +/* + Set upper bound for the + ratio (area below squeeze) / (area below hat). + It must be a number between 0 and 1. + When the ratio exceeds the given number no further construction + points are inserted via DARS in the setup. + + For the case of ARS (unur_tabl_set_usedars() must be set to FALSE): + Use @code{0} if no construction points should be added after the setup. + Use @code{1} if added new construction points should not be stopped + until the maximum number of construction points is reached. + If @var{max_ratio} is close to one, many construction points are used. + + Default is @code{0.9}. +*/ + +double unur_tabl_get_sqhratio( const UNUR_GEN *generator ); +/* + Get the current ratio (area below squeeze) / (area below hat) + for the generator. + (In case of an error @code{UNUR_INFINITY} is returned.) +*/ + +double unur_tabl_get_hatarea( const UNUR_GEN *generator ); +/* + Get the area below the hat for the generator. + (In case of an error @code{UNUR_INFINITY} is returned.) +*/ + +double unur_tabl_get_squeezearea( const UNUR_GEN *generator ); +/* + Get the area below the squeeze for the generator. + (In case of an error @code{UNUR_INFINITY} is returned.) +*/ + +int unur_tabl_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); +/* + Set maximum number of intervals. + No construction points are added in or after the setup when the + number of intervals suceeds @var{max_ivs}. + + Default is @code{1000}. +*/ + +int unur_tabl_get_n_intervals( const UNUR_GEN *generator ); +/* + Get the current number of intervals. + (In case of an error 0 is returned.) +*/ + +int unur_tabl_set_slopes( UNUR_PAR *parameters, const double *slopes, int n_slopes ); +/* + Set slopes for the PDF. + A slope is an interval [a,b] or [b,a] where the PDF is + monotone and PDF(a) >= PDF(b). + The list of slopes is given by an array @var{slopes} where each + consecutive tuple (i.e. @code{(slopes[0], slopes[1])}, + @code{(slopes[2], slopes[3])}, etc.) defines one slope. + Slopes must be sorted (i.e. both @code{slopes[0]} and + @code{slopes[1]} must not be greater than any entry of the slope + @code{(slopes[2], slopes[3])}, etc.) + and must not be overlapping. Otherwise no slopes are set and + @var{unur_errno} is set to @code{UNUR_ERR_PAR_SET}. + + @emph{Notice:} @var{n_slopes} is the number of slopes (and not the + length of the array @var{slopes}). + + @emph{Notice} that setting slopes resets the given domain for the + distribution. However, in case of a standard distribution the area + below the PDF is not updated. +*/ + +int unur_tabl_set_guidefactor( UNUR_PAR *parameters, double factor ); +/* + Set factor for relative size of the guide table for indexed search + (see also method DGT @ref{DGT}). It must be greater than or equal + to @code{0}. + When set to @code{0}, then sequential search is used. + + Default is @code{1}. +*/ + +int unur_tabl_set_boundary( UNUR_PAR *parameters, double left, double right ); +/* + Set the left and right boundary of the computation interval. + The piecewise hat is only constructed inside this interval. The + probability outside of this region must not be of + computational relevance. + Of course @code{+/- UNUR_INFINITY} is not allowed. + + Default is @code{-1.e20,1.e20}. +*/ + +int unur_tabl_chg_truncated(UNUR_GEN *gen, double left, double right); +/* + Change the borders of the domain of the (truncated) distribution. + + Notice that the given truncated domain must be a subset of the + domain of the given distribution. The generator always uses the + intersection of the domain of the distribution and the truncated + domain given by this call. The hat function will not be changed. + + @emph{Important:} + The ratio between the area below the hat and the area below the + squeeze changes when the sampling region is restricted. In particalur + it becomes (very) large when sampling from the (far) tail of the + distribution. Then it is better to create a generator object for the + tail of distribution only. + + @emph{Important:} + This call does not work for variant @code{IA} (immediate + acceptance). In this case UNU.RAN switches @emph{automatically} to + variant @code{RH} (use ``classical'' acceptance/rejection from hat + distribution) and does revert to the variant originally set by the + user. + + @emph{Important:} + It is not a good idea to use adaptave rejection sampling while + sampling from a domain that is a strict subset of the domain that + has been used to construct the hat. + For that reason adaptive adding of construction points is + @emph{automatically disabled} by this call. + + @emph{Important:} If the CDF of the hat is (almost) the same + for @var{left} and @var{right} and (almost) equal to @code{0} or + @code{1}, then the truncated domain is not changed and the call + returns an error code. +*/ + +int unur_tabl_set_verify( UNUR_PAR *parameters, int verify ); +/* */ + +int unur_tabl_chg_verify( UNUR_GEN *generator, int verify ); +/* + Turn verifying of algorithm while sampling on/off. + If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is + violated for some @i{x} then @code{unur_errno} is set to + @code{UNUR_ERR_GEN_CONDITION}. However notice that this might + happen due to round-off errors for a few values of + @i{x} (less than 1%). + + Default is FALSE. +*/ + +int unur_tabl_set_pedantic( UNUR_PAR *parameters, int pedantic ); +/* + Sometimes it might happen that unur_init() has been executed + successfully. But when additional construction points are added by + adaptive rejection sampling, the algorithm detects that the + PDF is not monotone in the given slopes. + + With @var{pedantic} being TRUE, the sampling routine is exchanged + by a routine that simply returns @code{UNUR_INFINITY} indicating an + error. + + Default is FALSE. +*/ + + + +/* =END */ +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/methods/tabl_debug.ch b/vendor/unuran-1.11.0/src/methods/tabl_debug.ch new file mode 100644 index 0000000..889d0fa --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tabl_debug.ch @@ -0,0 +1,343 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tabl_debug.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: rejection form piecewise constant hat * + * (Ahren's table method) * + * * + * DESCRIPTION: * + * Given PDF of a unimodal distribution * + * produce random variate X with its density * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +#define empty_line() fprintf(LOG,"%s:\n",gen->genid); + +/*---------------------------------------------------------------------------*/ + +void +_unur_tabl_debug_init_start( const struct unur_par *par, const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator after setup into LOG file */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int i; + + /* check arguments */ + CHECK_NULL(par,RETURN_VOID); COOKIE_CHECK(par,CK_TABL_PAR,RETURN_VOID); + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TABL_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + empty_line(); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = rejection from piecewise constant hat\n",gen->genid); + fprintf(LOG,"%s: variant = ",gen->genid); + if (gen->variant & TABL_VARIANT_IA) + fprintf(LOG,"immediate acceptance ... IA\n"); + else + fprintf(LOG,"acceptance/rejection ... RH\n"); + empty_line(); + + _unur_distr_cont_debug( gen->distr, gen->genid ); + + fprintf(LOG,"%s: sampling routine = _unur_tabl_",gen->genid); + if (gen->variant & TABL_VARIANT_IA) + fprintf(LOG,"ia"); + else + fprintf(LOG,"rh"); + if (gen->variant & TABL_VARFLAG_VERIFY) + fprintf(LOG,"_sample_check()\n"); + else + fprintf(LOG,"_sample()\n"); + + fprintf(LOG,"%s: computation interval = (%g, %g)\n",gen->genid,GEN->bleft,GEN->bright); + + fprintf(LOG,"%s: maximum number of intervals = %d",gen->genid,GEN->max_ivs); + _unur_print_if_default(gen,TABL_SET_MAX_IVS); + fprintf(LOG,"\n"); + + if (gen->variant & TABL_VARFLAG_USEEAR) { + fprintf(LOG,"%s: use equal area rule\n",gen->genid); + fprintf(LOG,"%s:\tarea fraction for equal area rule = %g ",gen->genid,PAR->area_fract); + _unur_print_if_default(par,TABL_SET_AREAFRACTION); + fprintf(LOG,"\n"); + } + + if (gen->variant & TABL_VARFLAG_USEDARS) { + fprintf(LOG,"%s: Derandomized ARS enabled ",gen->genid); + _unur_print_if_default(gen,TABL_SET_USE_DARS); + fprintf(LOG,"\n%s:\tDARS factor = %g",gen->genid,GEN->darsfactor); + _unur_print_if_default(gen,TABL_SET_DARS_FACTOR); + } + else { + fprintf(LOG,"%s: Derandomized ARS disabled ",gen->genid); + _unur_print_if_default(gen,TABL_SET_USE_DARS); + } + fprintf(LOG,"\n"); + + fprintf(LOG,"%s: bound for ratio Atotal / Asqueeze = %g%%",gen->genid,GEN->max_ratio*100.); + _unur_print_if_default(gen,TABL_SET_MAX_SQHRATIO); + fprintf(LOG,"\n"); + + fprintf(LOG,"%s: split intervals at ",gen->genid); + switch( gen->variant & TABL_VARMASK_SPLIT ) { + case TABL_VARFLAG_SPLIT_MEAN: + fprintf(LOG,"mean point"); + break; + case TABL_VARFLAG_SPLIT_ARC: + fprintf(LOG,"\"arcmean\" point"); + break; + case TABL_VARFLAG_SPLIT_POINT: + default: + fprintf(LOG,"sample point"); + break; + } + fprintf(LOG," when using adaptive sampling.\n"); + empty_line(); + + fprintf(LOG,"%s: sampling from list of intervals: indexed search (guide table method)\n",gen->genid); + fprintf(LOG,"%s: relative guide table size = %g%%",gen->genid,100.*GEN->guide_factor); + _unur_print_if_default(gen,TABL_SET_GUIDEFACTOR); + fprintf(LOG,"\n"); + empty_line(); + + if (par->set & TABL_SET_SLOPES) { + fprintf(LOG,"%s: slopes = %d\n",gen->genid,PAR->n_slopes); + for (i=0; in_slopes; i++) { + if ( PAR->slopes[2*i] > PAR->slopes[2*i+1] ) + fprintf(LOG,"%s: (+) ",gen->genid); + else + fprintf(LOG,"%s: (-) ",gen->genid); + fprintf(LOG,"< %#g, %#g >\n", PAR->slopes[2*i], PAR->slopes[2*i+1] ); + } + } + else + fprintf(LOG,"%s: no slopes given. compute from domain and mode.\n",gen->genid); + + if (PAR->cpoints != NULL) { + fprintf(LOG,"%s: cpoints for slopes (%d):\n",gen->genid,PAR->n_cpoints); + fprintf(LOG,"%s:\t %g",gen->genid,(PAR->cpoints)[0]); + for (i=1; in_cpoints; i++) + fprintf(LOG,", %g",(PAR->cpoints)[i]); + fprintf(LOG,"\n"); + } + + fprintf(LOG,"%s: number of starting intervals (approx.) = %d",gen->genid,PAR->n_stp); + _unur_print_if_default(par,TABL_SET_N_STP); + fprintf(LOG,"\n"); + empty_line(); + +} /* end of _unur_tabl_debug_init_start() */ + +/*****************************************************************************/ + +void +_unur_tabl_debug_init_finished( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator after setup into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TABL_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + _unur_tabl_debug_intervals(gen,"INIT completed",TRUE); + + fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); + empty_line(); + +} /* end of _unur_tabl_debug_init_finished() */ + +/*****************************************************************************/ + +void +_unur_tabl_debug_dars_start( const struct unur_par *par, const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* print header before runniung DARS into LOG file */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TABL_GEN,RETURN_VOID); + CHECK_NULL(par,RETURN_VOID); COOKIE_CHECK(par,CK_TABL_PAR,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: DARS started **********************\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: DARS factor = %g",gen->genid,GEN->darsfactor); + _unur_print_if_default(par,TABL_SET_DARS_FACTOR); + fprintf(LOG,"\n%s:\n",gen->genid); + + fflush(LOG); +} /* end of _unur_tabl_debug_dars_start() */ + +/*****************************************************************************/ + +void +_unur_tabl_debug_free( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator before destroying into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TABL_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + empty_line(); + if (gen->status == UNUR_SUCCESS) { + fprintf(LOG,"%s: GENERATOR destroyed **********************\n",gen->genid); + empty_line(); + _unur_tabl_debug_intervals(gen,NULL,TRUE); + } + else { + fprintf(LOG,"%s: initialization of GENERATOR failed **********************\n",gen->genid); + } + empty_line(); + + fflush(LOG); + +} /* end of _unur_tabl_debug_free() */ + +/*****************************************************************************/ + +void +_unur_tabl_debug_intervals( const struct unur_gen *gen, const char *header, int print_areas ) + /*----------------------------------------------------------------------*/ + /* write list of intervals into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* header ... header for table */ + /* print_areas ... whether table of areas should be printed */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + struct unur_tabl_interval *iv; + double sAsqueeze, Atotal; + int i; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TABL_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + if (header) + fprintf(LOG,"%s: %s\n",gen->genid,header); + + fprintf(LOG,"%s: intervals = %d\n",gen->genid,GEN->n_ivs); + if (gen->debug & TABL_DEBUG_IV) { + fprintf(LOG,"%s: < max , min > f(max) f(min) \n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + for (iv = GEN->iv, i=0; iv!=NULL; iv=iv->next, i++) { + COOKIE_CHECK(iv,CK_TABL_IV,RETURN_VOID); + fprintf(LOG,"%s:[%3d]: (%s) < %#-12.6g, %#-12.6g> | %#-12.6g %#-12.6g \n", + gen->genid, i, (iv->xmin <= iv->xmax)?"+":"-", + iv->xmax, iv->xmin, iv->fmax, iv->fmin); + } + empty_line(); + } + + if (!print_areas) return; + + if (GEN->Atotal <= 0.) { + fprintf(LOG,"%s: Construction of hat function not successful\n",gen->genid); + fprintf(LOG,"%s: Areas may be meaningless !!!!!!!!!!!!!!!!!!\n",gen->genid); + empty_line(); + Atotal = -1.; /* to avoid floating point exceptions */ + } + else { + Atotal = GEN->Atotal; + } + + /* print and sum areas below squeeze and hat */ + if (gen->debug & TABL_DEBUG_IV) { + fprintf(LOG,"%s:Areas in intervals:\n",gen->genid); + fprintf(LOG,"%s: Nr.\t below squeeze\t\t below hat\t\t cumulated\n",gen->genid); + empty_line(); + sAsqueeze = 0.; + for (iv = GEN->iv, i=0; iv!=NULL; iv=iv->next, i++) { + COOKIE_CHECK(iv,CK_TABL_IV,RETURN_VOID); + sAsqueeze += iv->Asqueeze; + fprintf(LOG,"%s:[%3d]: %-12.6g(%6.3f%%) | %-12.6g(%6.3f%%) | %-12.6g(%6.3f%%)\n", + gen->genid,i, + iv->Asqueeze, iv->Asqueeze * 100. / Atotal, + iv->Ahat, iv->Ahat * 100. / Atotal, + iv->Acum, iv->Acum * 100. / Atotal); + } + fprintf(LOG,"%s: ---------- --------- + ---------- --------- +\n",gen->genid); + fprintf(LOG,"%s: Sum : %-12.6g(%6.3f%%) %-12.6g(100%%)\n",gen->genid, + sAsqueeze, sAsqueeze * 100. / Atotal, Atotal); + empty_line(); + } + + /* summary of areas */ + fprintf(LOG,"%s: A(squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, + GEN->Asqueeze, GEN->Asqueeze * 100./Atotal); + fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, + Atotal - GEN->Asqueeze, (Atotal - GEN->Asqueeze) * 100./Atotal); + fprintf(LOG,"%s: A(total) = %-12.6g\n",gen->genid, Atotal); + + empty_line(); + +} /* end of _unur_tabl_debug_intervals */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/tabl_info.ch b/vendor/unuran-1.11.0/src/methods/tabl_info.ch new file mode 100644 index 0000000..785ec62 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tabl_info.ch @@ -0,0 +1,157 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tabl_info.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: rejection form piecewise constant hat * + * (Ahren's table method) * + * * + * DESCRIPTION: * + * Routines for creating info strings. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_tabl_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = PDF\n"); + _unur_string_append(info," domain = (%g, %g)", DISTR.trunc[0],DISTR.trunc[1]); + if (gen->distr->set & UNUR_DISTR_SET_TRUNCATED) { + _unur_string_append(info," [truncated from (%g, %g)]", DISTR.domain[0],DISTR.domain[1]); + } + _unur_string_append(info,"\n"); + _unur_string_append(info," mode = %g %s\n", unur_distr_cont_get_mode(distr), + (distr->set & UNUR_DISTR_SET_MODE_APPROX) ? "[numeric.]" : ""); + _unur_string_append(info," area(PDF) = "); + if (gen->distr->set & UNUR_DISTR_SET_PDFAREA) + _unur_string_append(info,"%g\n", DISTR.area); + else + _unur_string_append(info,"[not set: use 1.0]\n"); + _unur_string_append(info,"\n"); + + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + + /* method */ + _unur_string_append(info,"method: TABL (Ahrens' TABLe Method)\n"); + _unur_string_append(info," variant = "); + if (gen->variant & TABL_VARIANT_IA) + _unur_string_append(info,"immediate acceptance [ia = on]\n"); + else + _unur_string_append(info,"acceptance/rejection [ia = off]\n"); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," area(hat) = %g\n", GEN->Atotal); + + _unur_string_append(info," rejection constant "); + if (distr->set & UNUR_DISTR_SET_PDFAREA) + _unur_string_append(info,"= %g\n", GEN->Atotal/DISTR.area); + else + _unur_string_append(info,"<= %g\n", GEN->Atotal/GEN->Asqueeze); + + _unur_string_append(info," area ratio squeeze/hat = %g\n", + GEN->Asqueeze/GEN->Atotal); + + _unur_string_append(info," # intervals = %d\n", GEN->n_ivs); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + if (gen->variant & TABL_VARIANT_IA) + _unur_string_append(info," variant_ia = on [default]\n"); + else + _unur_string_append(info," variant_ia = off\n"); + + _unur_string_append(info," max_sqhratio = %g %s\n", GEN->max_ratio, + (gen->set & TABL_SET_MAX_SQHRATIO) ? "" : "[default]"); + + _unur_string_append(info," max_intervals = %d %s\n", GEN->max_ivs_info, + (gen->set & TABL_SET_MAX_IVS) ? "" : "[default]"); + + if (gen->variant & TABL_VARFLAG_VERIFY) + _unur_string_append(info," verify = on\n"); + + if (gen->variant & TABL_VARFLAG_PEDANTIC) + _unur_string_append(info," pedantic = on\n"); + + _unur_string_append(info,"\n"); + + /* Not displayed: + int unur_tabl_set_cpoints( UNUR_PAR *parameters, int n_cpoints, const double *cpoints ); + int unur_tabl_set_nstp( UNUR_PAR *parameters, int n_stp ); + int unur_tabl_set_useear( UNUR_PAR *parameters, int useear ); + int unur_tabl_set_areafraction( UNUR_PAR *parameters, double fraction ); + int unur_tabl_set_usedars( UNUR_PAR *parameters, int usedars ); + int unur_tabl_set_darsfactor( UNUR_PAR *parameters, double factor ); + int unur_tabl_set_variant_splitmode( UNUR_PAR *parameters, unsigned splitmode ); + int unur_tabl_set_slopes( UNUR_PAR *parameters, const double *slopes, int n_slopes ); + int unur_tabl_set_guidefactor( UNUR_PAR *parameters, double factor ); + int unur_tabl_set_boundary( UNUR_PAR *parameters, double left, double right ); + */ + } + + /* Hints */ + if (help) { + if ( !(gen->set & TABL_SET_MAX_SQHRATIO) ) + _unur_string_append(info,"[ Hint: %s ]\n", + "You can set \"max_sqhratio\" closer to 1 to decrease rejection constant." ); + if (GEN->Asqueeze/GEN->Atotal < GEN->max_ratio) + _unur_string_append(info,"[ Hint: %s ]\n", + "You should increase \"max_intervals\" to obtain the desired rejection constant." ); + _unur_string_append(info,"\n"); + } + +} /* end of _unur_tabl_info() */ + +/*---------------------------------------------------------------------------*/ +#endif +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/tabl_init.ch b/vendor/unuran-1.11.0/src/methods/tabl_init.ch new file mode 100644 index 0000000..7c60fdf --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tabl_init.ch @@ -0,0 +1,1113 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tabl_init.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: rejection form piecewise constant hat * + * (Ahren's table method) * + * * + * DESCRIPTION: * + * Given PDF of a unimodal distribution * + * produce random variate X with its density * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_tabl_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* params pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_TABL ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_TABL_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_tabl_create(par); + if (!gen) { _unur_par_free(par); return NULL; } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_tabl_debug_init_start(par,gen); +#endif + + /* make starting intervals */ + do { + + /* (1) use slopes if given, otherwise + (2) use construction points if given, otherwise + (3) use mode if available, otherwise + (s) stop (no generator object can be created) + */ + + /* (1) use slopes if given */ + if (PAR->n_slopes > 0) { + if (_unur_tabl_get_intervals_from_slopes(par,gen)!=UNUR_SUCCESS) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"Cannot make hat function"); + _unur_par_free(par); _unur_tabl_free(gen); return NULL; + } + break; + } + + /* (2) use construction points if given */ + + if (PAR->cpoints == NULL) { + if (! ( (par->distr->set & UNUR_DISTR_SET_MODE) && + unur_tabl_set_cpoints(par,1,&(DISTR.mode)) == UNUR_SUCCESS) ) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"Cannot compute slopes"); + _unur_par_free(par); _unur_tabl_free(gen); return NULL; + } + } + + /* now there should be construnctions points */ + if (PAR->cpoints != NULL) { + if (_unur_tabl_get_intervals_from_cpoints(par,gen)!=UNUR_SUCCESS) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"Cannot make hat function"); + _unur_par_free(par); _unur_tabl_free(gen); return NULL; + } + break; + } + + /* one of the above cases should have happened */ + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + _unur_par_free(par); _unur_tabl_free(gen); return NULL; + + } while(0); + +#ifdef UNUR_ENABLE_LOGGING + /* print starting intervals */ + if (gen->debug & TABL_DEBUG_IV_START) _unur_tabl_debug_intervals(gen,"starting intervals:",FALSE); +#endif + + /* update number of slopes */ + PAR->n_slopes = GEN->n_ivs; + + /* split starting intervals / slopes */ + if (_unur_tabl_compute_intervals(par,gen) != UNUR_SUCCESS) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"Cannot split intervals"); + _unur_par_free(par); _unur_tabl_free(gen); return NULL; + } + + /* make initial guide table */ + if (_unur_tabl_make_guide_table(gen) != UNUR_SUCCESS) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot create guide table"); + _unur_par_free(par); _unur_tabl_free(gen); return NULL; + } + + /* creation of generator object successfull */ + gen->status = UNUR_SUCCESS; + +#ifdef UNUR_ENABLE_LOGGING + if (gen->debug) _unur_tabl_debug_init_finished(gen); +#endif + + /* free parameters */ + _unur_par_free(par); + + return gen; + +} /* end of _unur_tabl_init() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_tabl_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_TABL_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_tabl_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_TABL_GEN); + + /* check for required data: area */ + if (!(gen->distr->set & UNUR_DISTR_SET_PDFAREA)) + if (_unur_distr_cont_upd_pdfarea(gen->distr, TRUE)!=UNUR_SUCCESS) + _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"area below PDF, use default instead"); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling, cloning and destroying generator */ + SAMPLE = _unur_tabl_getSAMPLE(gen); + gen->destroy = _unur_tabl_free; + gen->clone = _unur_tabl_clone; + + /* set all pointers to NULL */ + GEN->Atotal = 0.; + GEN->Asqueeze = 0.; + GEN->guide = NULL; + GEN->guide_size = 0; + GEN->iv = NULL; + GEN->n_ivs = 0; + + /* the boundaries for our computation limits are intersection of the */ + /* domain of the distribution and the given computation boundaries. */ + if (par->distr->set & UNUR_DISTR_SET_DOMAIN) { + PAR->bleft = _unur_max(PAR->bleft, DISTR.BD_LEFT); + PAR->bright = _unur_min(PAR->bright,DISTR.BD_RIGHT); + } + GEN->bleft = PAR->bleft; /* left boundary of domain */ + GEN->bright = PAR->bright; /* right boundary of domain */ + + /* set (default) boundaries for U */ + GEN->Umin = 0.; + GEN->Umax = 1.; + + /* relative size of guide tables */ + GEN->guide_factor = PAR->guide_factor; + + /* bounds for adding construction points */ + GEN->max_ivs = PAR->max_ivs; /* maximum number of intervals */ +#ifdef UNUR_ENABLE_INFO + GEN->max_ivs_info = PAR->max_ivs; /* ... for info string */ +#endif + GEN->max_ratio = PAR->max_ratio; /* bound for ratio Atotal / Asqueeze */ + GEN->darsfactor = PAR->darsfactor; + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_tabl_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_tabl_create() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_tabl_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_tabl_gen*)clone->datap) + + struct unur_gen *clone; + struct unur_tabl_interval *iv,*next, *clone_iv, *clone_prev; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_TABL_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* copy linked list of intervals */ + clone_iv = NULL; + clone_prev = NULL; + for (iv = GEN->iv; iv != NULL; iv = next) { + /* copy segment */ + clone_iv = _unur_xmalloc( sizeof(struct unur_tabl_interval) ); + memcpy( clone_iv, iv, sizeof(struct unur_tabl_interval) ); + if (clone_prev == NULL) { + /* starting point of linked list */ + CLONE->iv = clone_iv; + } + else { + /* insert into linked list */ + clone_prev->next = clone_iv; + } + /* next step */ + next = iv->next; + clone_prev = clone_iv; + } + /* terminate linked list */ + if (clone_iv) clone_iv->next = NULL; + + /* make new guide table */ + CLONE->guide = NULL; + if (_unur_tabl_make_guide_table(clone) != UNUR_SUCCESS) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot create guide table"); + /* There is no chance to run out of this error! */ + /* however, this should never happen. */ + } + + /* finished clone */ + return clone; + +#undef CLONE +} /* end of _unur_tabl_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_tabl_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_TABL ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_TABL_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_tabl_debug_free(gen); +#endif + + /* free linked list of intervals */ + { + struct unur_tabl_interval *iv,*next; + for (iv = GEN->iv; iv != NULL; iv = next) { + next = iv->next; + free(iv); + } + } + + /* free tables */ + if (GEN->guide) free(GEN->guide); + + /* free other memory */ + _unur_generic_free(gen); + +} /* end of _unur_tabl_free() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_tabl_get_intervals_from_slopes( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* compute starting intervals, slopes are given by user. */ + /* estimate domain when not given. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter list */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* a slope is an interval [a,b] or [b,a] such that */ + /* PDF(a) >= PDF(b) */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tabl_interval *iv; + double xmax, xmin; + double sl, sr; + int i; + + /* check arguments */ + CHECK_NULL(par,UNUR_ERR_NULL); COOKIE_CHECK(par,CK_TABL_PAR,UNUR_ERR_COOKIE); + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_ERR_COOKIE); + + /* init counter of intervals */ + GEN->n_ivs = 0; + iv = GEN->iv = NULL; + + /* boundary of computational interval are reset by boundaries of slopes */ + GEN->bleft = UNUR_INFINITY; + GEN->bright = -UNUR_INFINITY; + + /* compute initial intervals */ + for ( i=0; i < 2*PAR->n_slopes; i+=2 ) { + + /* max and min of PDF in interval */ + xmax = PAR->slopes[i]; + xmin = PAR->slopes[i+1]; + + /* check whether boundaries of slopes are inside computational region */ + if (xmax > xmin) { /* increasing slope */ + sl = xmin; sr = xmax; } + else { /* decreasing slope */ + sl = xmax; sr = xmin; } + + if (_unur_FP_greater(DISTR.BD_LEFT,sr)) continue; /* slope not in domain */ + if (_unur_FP_less(DISTR.BD_RIGHT,sl)) continue; /* slope not in domain */ + if (_unur_FP_greater(DISTR.BD_LEFT,sl)) { + /* chop slope (parts of slope not in domain) */ + if (xmax > xmin) xmin = DISTR.BD_LEFT; else xmax = DISTR.BD_LEFT; } + if (_unur_FP_less(DISTR.BD_RIGHT,sr)) { + /* chop slope (parts of slope not in domain) */ + if (xmax < xmin) xmin = DISTR.BD_RIGHT; else xmax = DISTR.BD_RIGHT; } + + /* get a new interval and link into list */ + if (GEN->iv==NULL) /* the first interval */ + iv = GEN->iv = _unur_xmalloc(sizeof(struct unur_tabl_interval)); + else /* all the other intervals */ + iv = iv->next = _unur_xmalloc(sizeof(struct unur_tabl_interval)); + ++(GEN->n_ivs); + COOKIE_SET(iv,CK_TABL_IV); + + /* max and min of PDF in interval */ + iv->xmax = xmax; + iv->fmax = PDF(iv->xmax); + iv->xmin = xmin; + iv->fmin = PDF(iv->xmin); + + /* check for overflow */ + if (! (_unur_isfinite(iv->fmax) && _unur_isfinite(iv->fmin) + && iv->fmax >= 0. && iv->fmin >= 0.) ) { + /* overflow */ + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) overflow"); + iv->next = NULL; /* terminate list (freeing list) */ + return UNUR_ERR_GEN_DATA; + } + + /* check slopes (but only give a warning) */ + if (_unur_FP_less(iv->fmax,iv->fmin)) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"PDF discontinuous or slope not monotone"); + } + + /* we assume that the PDF is discontinuous at the boundary + of the slope. Thus we cannot use squezzes in the interval + on the "lower" end of the slope. */ + iv->fmin = 0.; + + /* area of slope */ + iv->Ahat = fabs(xmax - xmin) * iv->fmax; + iv->Asqueeze = fabs(xmax - xmin) * iv->fmin; + iv->Acum = 0.; + + /* estimate domain */ + if (xmax > xmin) { + /* increasing slope */ + GEN->bleft = _unur_min(GEN->bleft,xmin); + GEN->bright = _unur_max(GEN->bright,xmax); + } + else { + /* decreasing slope */ + GEN->bleft = _unur_min(GEN->bleft,xmax); + GEN->bright = _unur_max(GEN->bright,xmin); + } + } + + /* check whether we have added slopes */ + if (GEN->iv==NULL) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"invalid slopes"); + return UNUR_ERR_GEN_DATA; + } + + /* terminate list */ + iv->next = NULL; + + /* reset area below distribution */ + gen->distr->set &= ~UNUR_DISTR_SET_PDFAREA; + _unur_distr_cont_upd_pdfarea( gen->distr, TRUE ); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_tabl_get_intervals_from_slopes() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_tabl_get_intervals_from_cpoints( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* compute starting intervals, cpoints are given by user. */ + /* (it is assumed that the PDF is continuous) */ + /* */ + /* parameters: */ + /* par ... pointer to parameter list */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tabl_interval *iv; + double sl, sr; /* boundary of slopes */ + double fl, fr; /* PDF at boundary points */ + double cp; /* construction point */ + int i; + + /* check arguments */ + CHECK_NULL(par,UNUR_ERR_NULL); COOKIE_CHECK(par,CK_TABL_PAR,UNUR_ERR_COOKIE); + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_ERR_COOKIE); + + /* init counter of intervals */ + GEN->n_ivs = 0; + iv = GEN->iv = NULL; + + /* the left boudary of computational domain */ + sr = GEN->bleft; + fr = PDF(sr); + + for (i=0; i<=PAR->n_cpoints; i++) { + + if (i < PAR->n_cpoints) { + /* the next point in list */ + cp = PAR->cpoints[i]; + /* check whether we are inside domain */ + if (! _unur_FP_less(GEN->bleft,cp)) + continue; /* skip to next point */ + if (! _unur_FP_greater(GEN->bright,cp)) { + /* there are no other cpoints since these should be sorted */ + i = (PAR->n_cpoints)-1; /* skip to end of list */ + continue; + } + } + + else { /* we have looped over all points in list */ + /* add right boundary of computational domain */ + cp = GEN->bright; + } + + /* make compute points (assume continuity) */ + sl = sr; fl = fr; + sr = cp; fr = PDF(sr); + + /* get a new interval and link into list */ + if (GEN->iv==NULL) /* the first interval */ + iv = GEN->iv = _unur_xmalloc(sizeof(struct unur_tabl_interval)); + else /* all the other intervals */ + iv = iv->next = _unur_xmalloc(sizeof(struct unur_tabl_interval)); + ++(GEN->n_ivs); + COOKIE_SET(iv,CK_TABL_IV); + + /* check for overflow */ + if (! (_unur_isfinite(fr) && _unur_isfinite(fl) + && fr >= 0. && fl >= 0.) ) { + /* overflow */ + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) overflow"); + iv->next = NULL; /* terminate list (freeing list) */ + return UNUR_ERR_GEN_DATA; + } + /* remark: for simplicity of code, GEN->iv should not be NULL. + Thus we have allocated 'iv' before this check. */ + + /* max and min of PDF in interval */ + if (fr > fl) { + /* increasing slope */ + iv->xmax = sr; iv->fmax = fr; + iv->xmin = sl; iv->fmin = fl; + } + else { + /* decreasing slope */ + iv->xmax = sl; iv->fmax = fl; + iv->xmin = sr; iv->fmin = fr; + } + + /* area of slope */ + iv->Ahat = fabs(sr - sl) * iv->fmax; + iv->Asqueeze = fabs(sr - sl) * iv->fmin; + iv->Acum = 0.; + } + + /* check whether we have added slopes */ + if (GEN->iv==NULL) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"invalid slopes"); + return UNUR_ERR_GEN_DATA; + } + + /* terminate list */ + iv->next = NULL; + + /* reset domain of distribution */ + DISTR.trunc[0] = DISTR.BD_LEFT = GEN->bleft; + DISTR.trunc[1] = DISTR.BD_RIGHT = GEN->bright; + + /* reset area below distribution */ + gen->distr->set &= ~UNUR_DISTR_SET_PDFAREA; + _unur_distr_cont_upd_pdfarea( gen->distr, TRUE ); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_tabl_get_intervals_from_cpoints() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_tabl_compute_intervals( struct unur_par *par, struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* compute all intervals (by splitting starting intervals/slopes) */ + /* */ + /* parameters: */ + /* par ... pointer to parameter list */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tabl_interval *iv; + int i,k; + + /* check arguments */ + CHECK_NULL(par,UNUR_ERR_NULL); COOKIE_CHECK(par,CK_TABL_PAR,UNUR_ERR_COOKIE); + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_ERR_COOKIE); + + /* split interval following [1], split A (equal area rule) */ + if (par->variant & TABL_VARFLAG_USEEAR) { + for (iv = GEN->iv; iv != NULL; iv = iv->next ) { + COOKIE_CHECK(iv,CK_TABL_IV,UNUR_ERR_COOKIE); + iv = _unur_tabl_run_equalarearule( par, gen, iv ); + if (iv == NULL) return UNUR_ERR_GEN_DATA; + } +#ifdef UNUR_ENABLE_LOGGING + /* print intervals after equal area rule has been applied intervals have been created */ + if (gen->debug & TABL_DEBUG_IV_START) _unur_tabl_debug_intervals(gen,"equal area rule applied:",FALSE); +#endif + } + + if (par->variant & TABL_VARFLAG_USEDARS) { + /* run derandomized adaptive rejection sampling (DARS) */ + +#ifdef UNUR_ENABLE_LOGGING + if (gen->debug & TABL_DEBUG_DARS) _unur_tabl_debug_dars_start(par,gen); +#endif + + for (i=0; in_ivs >= GEN->max_ivs) + break; + + /* else run ARS instead */ + + /* first we have to make an initial gudie table */ + if (_unur_tabl_make_guide_table(gen) != UNUR_SUCCESS) + return UNUR_ERR_GEN_CONDITION; + + for (k=0; kn_ivs >= GEN->max_ivs) + /* maximal number of intervals reached */ + return NULL; + + iv = iv_slope; /* pointer to actual interval */ + iv_last = iv_slope; /* pointer to last interval in list */ + /* (maximal) area of bar (= hat in one interval) */ + bar_area = DISTR.area * PAR->area_fract; + + while (_unur_FP_greater(iv->Ahat, bar_area)) { + + /* increasing or decreasing slope */ + slope = (iv->xmax > iv->xmin) ? 1. : -1.; + + /* compute splitting point: + slope == +1 --> move from right to left + slope == -1 --> move from left to right */ + x = iv->xmax - slope * bar_area / iv->fmax; + + /* compute PDF */ + fx = PDF(x); + + /* check for overflow */ + if (! (_unur_isfinite(fx) && fx >= 0.)) { + /* overflow */ + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) overflow"); + return NULL; + } + + /* now split interval at x */ + switch (_unur_tabl_split_interval( gen, iv, x, fx, TABL_VARFLAG_SPLIT_POINT )) { + case UNUR_SUCCESS: /* splitting succesful */ + if (slope > 0.) { + if (iv_last == iv_slope) + iv_last = iv->next; + } + else { /* slope < 0 */ + iv = iv->next; break; + } + break; + case UNUR_ERR_SILENT: /* interval chopped */ + break; /* nothing to do */ + default: /* error (slope not monotonically increasing) */ + return NULL; + } + + /* check number of intervals */ + if (GEN->n_ivs >= GEN->max_ivs) { + /* maximal number of intervals reached */ + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"split A stopped, maximal number of intervals reached."); + break; + } + } + + /* pointer to last interval */ + return ((iv->xmax > iv->xmin) ? iv_last : iv); + +} /* end of _unur_tabl_run_equalarearule() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_tabl_run_dars( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* run derandomized adaptive rejection sampling. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tabl_interval *iv; + double Atot, Asqueezetot; /* total area below hat and squeeze, resp. */ + double Alimit; /* threshhold value for splitting interval */ + int n_splitted = 1; /* count splitted intervals */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_ERR_COOKIE); + + /* there is no need to run DARS when the DARS factor is UNUR_INFINITY */ + if (_unur_FP_is_infinity(GEN->darsfactor)) + return UNUR_SUCCESS; + + /* first we need the total areas below hat and squeeze. + (This is only necessary, when _unur_arou_make_guide_table() has not been + called!) */ + Atot = 0.; /* area below hat */ + Asqueezetot = 0.; /* area below squeeze */ + for (iv = GEN->iv; iv != NULL; iv = iv->next ) { + COOKIE_CHECK(iv,CK_TABL_IV,UNUR_ERR_COOKIE); + Atot += iv->Ahat; + Asqueezetot += iv->Asqueeze; + } + GEN->Atotal = Atot; + GEN->Asqueeze = Asqueezetot; + + /* now split intervals */ + while ( (GEN->max_ratio * GEN->Atotal > GEN->Asqueeze) && + (GEN->n_ivs < GEN->max_ivs) ) { + + /* compute threshhold value. every interval with area between + hat and squeeze greater than this value will be splitted. */ + if (GEN->n_ivs > 1) + Alimit = GEN->darsfactor * ( (GEN->Atotal - GEN->Asqueeze) / GEN->n_ivs ); + else + /* we split every interval if there are only one interval */ + Alimit = 0.; + + /* reset counter for splitted intervals */ + n_splitted = 0; + + /* for all intervals do ... */ + for (iv = GEN->iv; iv != NULL; iv = iv->next ) { + COOKIE_CHECK(iv,CK_TABL_IV,UNUR_ERR_COOKIE); + + /* do not exceed the maximum number of intervals */ + if (GEN->n_ivs >= GEN->max_ivs) + break; + + /* we skip over all intervals where the area between hat and + squeeze does not exceed the threshhold value. */ + if ((iv->Ahat - iv->Asqueeze) <= Alimit) + continue; /* goto next interval */ + + switch (_unur_tabl_split_interval( gen, iv, 0., 0., TABL_VARFLAG_SPLIT_ARC )) { + case UNUR_SUCCESS: /* splitting succesful */ + case UNUR_ERR_SILENT: /* interval chopped */ + ++n_splitted; + break; /* nothing to do */ + default: /* error (slope not monotonically decreasing) */ + return UNUR_ERR_GEN_DATA; + } + } + + if (n_splitted == 0) { + /* we are not successful in splitting any inteval. + abort to avoid endless loop */ + _unur_warning(gen->genid,UNUR_ERR_GENERIC,"DARS aborted: no intervals could be splitted."); + break; + } + } + + /* ratio between squeeze and hat o.k. ? */ + if ( GEN->max_ratio * GEN->Atotal > GEN->Asqueeze ) { + if ( GEN->n_ivs >= GEN->max_ivs ) + _unur_warning(gen->genid,UNUR_ERR_GENERIC,"DARS aborted: maximum number of intervals exceeded."); + _unur_warning(gen->genid,UNUR_ERR_GENERIC,"hat/squeeze ratio too small."); + } + else { + /* no more construction points */ + GEN->max_ivs = GEN->n_ivs; + } + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_tabl_run_dars() */ + +/*****************************************************************************/ + +int +_unur_tabl_split_interval( struct unur_gen *gen, + struct unur_tabl_interval *iv_old, + double x, double fx, + unsigned split_mode ) + /*----------------------------------------------------------------------*/ + /* split interval (replace old one by two new ones in same place) */ + /* new interval is inserted immedately after old one. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv_old ... pointer to interval that has to be split */ + /* x ... splitting point */ + /* fx ... value of PDF at splitting point */ + /* split_mode ... how to split interval */ + /* TABL_VARFLAG_SPLIT_POINT: split at given point x */ + /* TABL_VARFLAG_SPLIT_MEAN: at mean point of interval */ + /* TABL_VARFLAG_SPLIT_ARC: at arc mean point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... splitting successful */ + /* UNUR_ERR_SILENT ... interval chopped off domain */ + /* (not part of support of PDF) */ + /* others ... error: PDF not monotone in interval */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tabl_interval *iv_new; + double A_hat_old, A_squ_old; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_ERR_COOKIE); + CHECK_NULL(iv_old,UNUR_ERR_NULL); COOKIE_CHECK(iv_old,CK_TABL_IV,UNUR_ERR_COOKIE); + + /* There are three possibilities for the splitting point: + (1) use x and avoid computation of PDF(x). + (2) use middle of interval. converges faster in many cases. + (3) use "arc_mean" of interval. + converges faster when domain is almost unbounded. */ + switch( split_mode ) { + case TABL_VARFLAG_SPLIT_POINT: /* (1) */ + /* nothing to do (default) */ + break; + case TABL_VARFLAG_SPLIT_MEAN: /* (2) */ + x = 0.5 * (iv_old->xmin + iv_old->xmax); + fx = PDF(x); + break; + case TABL_VARFLAG_SPLIT_ARC: /* (3) */ + x = _unur_arcmean(iv_old->xmin, iv_old->xmax); + fx = PDF(x); + break; + default: + /* this should not happen: + Invalid variant, use default n*/ + _unur_warning(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + break; + } + + /* check for overflow */ + if (! (_unur_isfinite(fx) && fx >= 0.)) { + /* overflow */ + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) overflow"); + return UNUR_ERR_GEN_DATA; + } + + /* check for monotonicity */ + if (_unur_FP_greater(fx,iv_old->fmax) || _unur_FP_less(fx,iv_old->fmin)) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF not monotone in slope"); + return UNUR_ERR_GEN_DATA; + } + + /* store areas of old interval */ + A_hat_old = iv_old->Ahat; + A_squ_old = iv_old->Asqueeze; + + /* check if the new interval is completely outside the support of PDF */ + if (fx <= 0.) { + /* check montonicity */ + if (iv_old->fmin > 0.) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not monotone in slope"); + return UNUR_ERR_GEN_CONDITION; + } + + /* chop off part out of support */ + iv_old->xmin = x; + + /* compute new area in interval */ + iv_old->Ahat = fabs(iv_old->xmax - iv_old->xmin) * iv_old->fmax; + /* iv_old->Asqueeze remains 0 */ + + /* update total area */ + GEN->Atotal += iv_old->Ahat - A_hat_old; + /* GEN->Asqueeze remains unchanged */ + + /* check result */ + if (!_unur_isfinite(GEN->Atotal)) { + /* we have decreased the hat, thus ... */ + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_ERR_INF; + } + + /* interval chopped but not split */ + return UNUR_ERR_SILENT; + } + + /* we need a new interval */ + iv_new = _unur_xmalloc(sizeof(struct unur_tabl_interval)); + ++(GEN->n_ivs); + COOKIE_SET(iv_new,CK_TABL_IV); + + /* iv_new SHOULD have the same slope as iv_old */ + + /* we have to distinguish between two cases: + PDF is increasing (slope = +1) or + PDF is decreasing (slope = -1). */ + + if (iv_old->xmax > iv_old->xmin) { + /* increasing slope */ + /* (x) The iv_new inherits the maximum of iv_old. + iv_old keeps the minimum. + (x) The splitting point is the minimum of iv_new and + the maximum of iv_old. + */ + iv_new->xmax = iv_old->xmax; + iv_new->fmax = iv_old->fmax; + iv_old->xmax = iv_new->xmin = x; + iv_old->fmax = iv_new->fmin = fx; + } + else { + /* decreasing slope */ + /* (x) The iv_new inherits the minimum of iv_old. + iv_old keeps the maximum. + (x) The splitting point is the maximum of iv_new and + the minimum of iv_old. + */ + iv_new->xmin = iv_old->xmin; + iv_new->fmin = iv_old->fmin; + iv_old->xmin = iv_new->xmax = x; + iv_old->fmin = iv_new->fmax = fx; + } + + /* compute the areas in both intervals */ + iv_new->Ahat = fabs(iv_new->xmax - iv_new->xmin) * iv_new->fmax; + iv_new->Asqueeze = fabs(iv_new->xmax - iv_new->xmin) * iv_new->fmin; + iv_old->Ahat = fabs(iv_old->xmax - iv_old->xmin) * iv_old->fmax; + iv_old->Asqueeze = fabs(iv_old->xmax - iv_old->xmin) * iv_old->fmin; + + /* update total areas */ + GEN->Atotal += iv_old->Ahat + iv_new->Ahat - A_hat_old; + GEN->Asqueeze += iv_old->Asqueeze + iv_new->Asqueeze - A_squ_old; + + /* insert iv_new into linked list of intervals. + iv_old is stored on the left hand side of iv_new. */ + iv_new->next = iv_old->next; + iv_old->next = iv_new; + + /* check result */ + if (! (_unur_isfinite(GEN->Atotal) && _unur_isfinite(GEN->Asqueeze)) ) { + _unur_error(gen->genid,UNUR_ERR_INF,"hat unbounded"); + return UNUR_ERR_INF; + } + + /* splitting successful */ + return UNUR_SUCCESS; + +} /* end of _unur_tabl_split_interval() */ + +/*****************************************************************************/ + +int +_unur_tabl_make_guide_table( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* make a guide table for indexed search */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* 1 (--> successful) */ + /* */ + /* error: */ + /* return 0. */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tabl_interval *iv; + double Acum, Asqueezecum, Astep; + int max_guide_size; + int j; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_ERR_COOKIE); + + /* allocate blocks for guide table (if necessary). + (we allocate blocks for maximal guide table.) */ + if (!GEN->guide) { + max_guide_size = (GEN->guide_factor > 0.) ? ((int)(GEN->max_ivs * GEN->guide_factor)) : 1; + if (max_guide_size <= 0) max_guide_size = 1; /* protect against overflow */ + GEN->guide = _unur_xmalloc( max_guide_size * sizeof(struct unur_tabl_interval*) ); + } + + /* first we need the cumulated areas of rectangles */ + Acum = 0.; /* area below hat */ + Asqueezecum = 0.; /* area below squeeze */ + for (iv = GEN->iv; iv != NULL; iv = iv->next ) { + COOKIE_CHECK(iv,CK_TABL_IV,UNUR_ERR_COOKIE); + Acum += iv->Ahat; + Asqueezecum += iv->Asqueeze; + iv->Acum = Acum; + } + + /* total area below hat */ + GEN->Atotal = Acum; + GEN->Asqueeze = Asqueezecum; + + /* actual size of guide table */ + GEN->guide_size = GEN->n_ivs; + + /* make table (use variant 2; see dis.c) */ + Astep = GEN->Atotal / GEN->guide_size; + Acum=0.; + for( j=0, iv=GEN->iv; j < GEN->guide_size; j++ ) { + COOKIE_CHECK(iv,CK_TABL_IV,UNUR_ERR_COOKIE); + while( iv->Acum < Acum ) + if( iv->next != NULL ) /* skip to next segment if it exists */ + iv = iv->next; + else { + _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF,"guide table"); + break; + } + GEN->guide[j] = iv; + Acum += Astep; + } + + /* if there has been an round off error, we have to complete the guide table */ + for( ; jguide_size ;j++ ) + GEN->guide[j] = iv; + + /* check table */ + if (! (_unur_isfinite(GEN->Atotal) && _unur_isfinite(GEN->Asqueeze) + && GEN->Atotal > 0. + && (!_unur_FP_less(GEN->Atotal,DISTR.area) || !(gen->distr->set & UNUR_DISTR_SET_PDFAREA)) ) + ) { + /* in this case the guide table is corrupted and completely worthless. */ + /* this error is unlikely to happen. for this rare case the check is */ + /* done at the end to have the table at least filled with numbers */ + /* and thus avoid infinite loops in the sampling routines. */ + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"sum of areas not valid"); + return UNUR_ERR_GEN_DATA; + } + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_tabl_make_guide_table() */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/methods/tabl_newset.ch b/vendor/unuran-1.11.0/src/methods/tabl_newset.ch new file mode 100644 index 0000000..d911aea --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tabl_newset.ch @@ -0,0 +1,996 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tabl_newset.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: rejection form piecewise constant hat * + * (Ahren's table method) * + * * + * DESCRIPTION: * + * Given PDF of a unimodal distribution * + * produce random variate X with its density * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_tabl_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + + if (DISTR_IN.pdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); return NULL; } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_tabl_par) ); + COOKIE_SET(par,CK_TABL_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->slopes = NULL; /* pointer to slopes of PDF */ + PAR->n_slopes = 0; /* number of slopes */ + + PAR->n_stp = 30; /* number of starting points */ + + PAR->cpoints = NULL; /* pointer to array of starting points */ + PAR->n_cpoints = 0; /* number of starting points */ + + PAR->area_fract = 0.1; /* parameter for equal area rule (default from [1] ) */ + + PAR->max_ivs = 1000; /* maximum number of intervals */ + PAR->max_ratio = 0.90; /* bound for ratio Atotal / Asqueeze */ + + PAR->guide_factor = 1.; /* guide table has same size as array of intervals */ + + PAR->darsfactor = 0.99; /* factor for (derandomized) ARS. + do not add a new construction point in a interval + where abiguous region is too small */ + + /* default boundary of compution area */ + PAR->bleft = -TABL_DEFAULT_COMPUTATION_LIMIT; + PAR->bright = TABL_DEFAULT_COMPUTATION_LIMIT; + + par->method = UNUR_METH_TABL; /* indicate method */ + par->variant = (TABL_VARFLAG_SPLIT_MEAN | /* variant: split at arc_mean */ + TABL_VARIANT_IA | /* use immediate acceptance */ + TABL_VARFLAG_USEEAR | /* run EAR (SPLIT A) on slopes */ + TABL_VARFLAG_USEDARS ); /* run DARS (SPLIT B) on slopes */ + + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = par->urng; /* no special auxilliary URNG */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_tabl_init; + + return par; + +} /* end of unur_tabl_new() */ + +/*****************************************************************************/ + +int +unur_tabl_set_variant_ia( struct unur_par *par, int use_ia ) + /*----------------------------------------------------------------------*/ + /* Switch to immediate acceptance */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* use_ia ... whether immediate acceptance is used */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TABL ); + + /* we use a bit in variant */ + par->variant = (use_ia) ? (par->variant | TABL_VARIANT_IA) : (par->variant & (~TABL_VARIANT_IA)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_tabl_set_variant_ia() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tabl_set_useear( struct unur_par *par, int useear ) + /*----------------------------------------------------------------------*/ + /* set flag for using EAS (equal area rule). */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* useear ... 0 = do not use, 1 = use EAS */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* using using EAS is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TABL ); + + /* we use a bit in variant */ + if (useear) + par->variant |= TABL_VARFLAG_USEEAR; + else + par->variant &= ~TABL_VARFLAG_USEEAR; + + /* changelog */ + par->set |= TABL_SET_USE_EAR; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_tabl_set_useeas() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tabl_set_usedars( struct unur_par *par, int usedars ) + /*----------------------------------------------------------------------*/ + /* set flag for using DARS (derandomized adaptive rejection sampling). */ + /* additionally the rule for splitting intervals can be set. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* usedars ... 0 = do not use, 1 = use DARS */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* using using DARS is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TABL ); + + /* we use a bit in variant */ + if (usedars) + par->variant |= TABL_VARFLAG_USEDARS; + else + par->variant &= ~TABL_VARFLAG_USEDARS; + + /* changelog */ + par->set |= TABL_SET_USE_DARS; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_tabl_set_usedars() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tabl_set_darsfactor( struct unur_par *par, double factor ) + /*----------------------------------------------------------------------*/ + /* set factor for derandomized adaptive rejection sampling */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* factor ... parameter for DARS */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TABL ); + + /* check new parameter for generator */ + if (factor < 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"DARS factor < 0"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->darsfactor = factor; + + /* changelog */ + par->set |= TABL_SET_DARS_FACTOR; + + return UNUR_SUCCESS; + +} /* end of unur_tabl_set_darsfactor() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tabl_set_variant_splitmode( struct unur_par *par, unsigned splitmode ) + /*----------------------------------------------------------------------*/ + /* set setup variant for adaptive rejection sampling */ + /* */ + /* There are three variants for adaptive rejection sampling. These */ + /* differ in the way how an interval is split: */ + /* splitmode 1: use the generated point to split the interval. */ + /* splitmode 2: use the mean point of the interval. */ + /* splitmode 3: use the arcmean point. */ + /* Default is splitmode 3. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* splitmode ... indicator for variant */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TABL ); + + /* store date */ + par->variant &= ~TABL_VARMASK_SPLIT; + switch (splitmode) { + case 1: + par->variant |= TABL_VARFLAG_SPLIT_POINT; + return UNUR_SUCCESS; + case 2: + par->variant |= TABL_VARFLAG_SPLIT_MEAN; + return UNUR_SUCCESS; + case 3: + par->variant |= TABL_VARFLAG_SPLIT_ARC; + return UNUR_SUCCESS; + default: + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"invalid variant"); + return UNUR_ERR_PAR_SET; + } +} /* end if unur_tabl_set_variant_splitmode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tabl_set_max_sqhratio( struct unur_par *par, double max_ratio ) + /*----------------------------------------------------------------------*/ + /* set bound for ratio A(squeeze) / A(hat) */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* max_ratio ... upper bound for ratio to add a new construction point*/ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TABL ); + + /* check new parameter for generator */ + if (max_ratio < 0. || max_ratio > 1. ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"ratio A(squeeze)/A(hat) not in [0,1]"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->max_ratio = max_ratio; + + /* changelog */ + par->set |= TABL_SET_MAX_SQHRATIO; + + return UNUR_SUCCESS; + +} /* end of unur_tabl_set_max_sqhratio() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_tabl_get_sqhratio( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get ratio A(squeeze) / A(hat) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* ratio ... on success */ + /* UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + _unur_check_gen_object( gen, TABL, UNUR_INFINITY ); + + return (GEN->Asqueeze / GEN->Atotal); + +} /* end of unur_tabl_get_sqhratio() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_tabl_get_hatarea( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get area below hat */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* area ... on success */ + /* UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + _unur_check_gen_object( gen, TABL, UNUR_INFINITY ); + + return GEN->Atotal; + +} /* end of unur_tabl_get_hatarea() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_tabl_get_squeezearea( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get area below squeeze */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* area ... on success */ + /* UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + _unur_check_gen_object( gen, TABL, UNUR_INFINITY ); + + return GEN->Asqueeze; + +} /* end of unur_tabl_get_squeezearea() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tabl_set_max_intervals( struct unur_par *par, int max_ivs ) + /*----------------------------------------------------------------------*/ + /* set maximum number of intervals */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* max_ivs ... maximum number of intervals */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TABL ); + + /* check new parameter for generator */ + if (max_ivs < 1 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"maximum number of intervals < 1"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->max_ivs = max_ivs; + + /* changelog */ + par->set |= TABL_SET_MAX_IVS; + + return UNUR_SUCCESS; + +} /* end of unur_tabl_set_max_intervals() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tabl_get_n_intervals( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get current number of intervals */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* number of intervals ... on success */ + /* 0 ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, 0 ); + _unur_check_gen_object( gen, TABL, 0 ); + + return GEN->n_ivs; + +} /* end of unur_tabl_get_n_intervals() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tabl_set_areafraction( struct unur_par *par, double fraction ) + /*----------------------------------------------------------------------*/ + /* set parameter for equal area rule */ + /* (each bar has size fraction * area below PDF) */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* fraction ... fraction of area for bar */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TABL ); + + /* check new parameter for generator */ + if (fraction <= 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"area factor <= 0"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->area_fract = fraction; + + /* changelog */ + par->set |= TABL_SET_AREAFRACTION; + + return UNUR_SUCCESS; + +} /* end of unur_tabl_set_areafraction() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tabl_set_cpoints( struct unur_par *par, int n_cpoints, const double *cpoints ) + /*----------------------------------------------------------------------*/ + /* set construction points for slopes of PDF */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* n_cpoints ... number of points for constructing slopes */ + /* cpoints ... pointer to array of points for constructing slopes */ + /* (NULL for changing only the number of default points)*/ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TABL ); + + /* check starting construction points */ + /* we always use the boundary points as additional starting points, + so we do not count these here! */ + if (n_cpoints <= 0 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of starting points <= 0"); + return UNUR_ERR_PAR_SET; + } + + if (cpoints) + /* starting points must be strictly monontonically increasing */ + for( i=1; icpoints = cpoints; + PAR->n_cpoints = n_cpoints; + } + else { + /* to avoid segfaults which might be caused by a different use of + ... _set_cpoints() compared to methods AROU and TDR we + set n_stp in this case */ + PAR->n_stp = n_cpoints; + /* changelog */ + par->set |= TABL_SET_N_STP; + } + + return UNUR_SUCCESS; + +} /* end of unur_tabl_set_cpoints() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tabl_set_nstp( struct unur_par *par, int n_stp ) + /*----------------------------------------------------------------------*/ + /* */ + /* set number of construction points for hat at initialization */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* n_stp ... number of starting points */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TABL ); + + /* check starting construction points */ + /* we always use the boundary points as additional starting points, + so we do not count these here! */ + if (n_stp < 0 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of starting points < 0"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->n_stp = n_stp; + + /* changelog */ + par->set |= TABL_SET_N_STP; + + return UNUR_SUCCESS; + +} /* end of unur_tabl_set_nstp() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tabl_set_slopes( struct unur_par *par, const double *slopes, int n_slopes ) + /*----------------------------------------------------------------------*/ + /* set slopes of PDF */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* slopes ... pointer to list of slopes */ + /* n_slopes ... number of slopes */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* a slope is an interval [a,b] or [b,a] */ + /* such that PDF(a) >= PDF(b). */ + /* slopes must be decreasing, non-overlapping and sorted */ + /*----------------------------------------------------------------------*/ +{ + int i; + double lmax,rmin,rmax; + + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TABL ); + + /* check new parameter for generator */ + if( n_slopes <= 0 ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_SET,"number of slopes <= 0"); + return UNUR_ERR_PAR_SET; + } + + /* check slopes */ + lmax = -UNUR_INFINITY; + for( i=0; islopes = slopes; + PAR->n_slopes = n_slopes; + + /* changelog */ + par->set |= TABL_SET_SLOPES; + + return UNUR_SUCCESS; + +} /* end of unur_tabl_set_slopes() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tabl_set_guidefactor( struct unur_par *par, double factor ) + /*----------------------------------------------------------------------*/ + /* set factor for relative size of guide table */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* factor ... relative size of table */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TABL ); + + /* check new parameter for generator */ + if (factor < 0) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"guide table size < 0"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->guide_factor = factor; + + /* changelog */ + par->set |= TABL_SET_GUIDEFACTOR; + + return UNUR_SUCCESS; + +} /* end of unur_tabl_set_guidefactor() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tabl_set_boundary( struct unur_par *par, double left, double right ) + /*----------------------------------------------------------------------*/ + /* set left and right boundary of computation interval */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* new boundary points must not be +/- UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TABL ); + + /* check new parameter for generator */ + if (left >= right) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"domain"); + return UNUR_ERR_PAR_SET; + } + if (left <= -UNUR_INFINITY || right >= UNUR_INFINITY) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"domain (+/- UNUR_INFINITY not allowed)"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->bleft = left; + PAR->bright = right; + + /* changelog */ + par->set |= TABL_SET_BOUNDARY; + + return UNUR_SUCCESS; + +} /* end of unur_tabl_set_boundary() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tabl_set_verify( struct unur_par *par, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TABL ); + + /* we use a bit in variant */ + par->variant = (verify) ? (par->variant | TABL_VARFLAG_VERIFY) : (par->variant & (~TABL_VARFLAG_VERIFY)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_tabl_set_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tabl_chg_verify( struct unur_gen *gen, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, TABL, UNUR_ERR_GEN_INVALID ); + + /* we must not change this switch when sampling has been disabled by + using a pointer to the error producing routine */ + if (SAMPLE == _unur_sample_cont_error) + return UNUR_FAILURE; + + /* we use a bit in variant */ + gen->variant = (verify) + ? (gen->variant | TABL_VARFLAG_VERIFY) + : (gen->variant & (~TABL_VARFLAG_VERIFY)); + + /* sampling routines */ + SAMPLE = _unur_tabl_getSAMPLE(gen); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_tabl_chg_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tabl_set_pedantic( struct unur_par *par, int pedantic ) + /*----------------------------------------------------------------------*/ + /* turn pedantic mode on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* pedantic ... 0 = no pedantic mode, !0 = use pedantic mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* pedantic is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TABL ); + + /* we use a bit in variant */ + par->variant = (pedantic) ? (par->variant | TABL_VARFLAG_PEDANTIC) : (par->variant & (~TABL_VARFLAG_PEDANTIC)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_tabl_set_pedantic() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tabl_chg_truncated( struct unur_gen *gen, double left, double right ) + /*----------------------------------------------------------------------*/ + /* change the left and right borders of the domain of the distribution */ + /* the new domain should not exceed the original domain given by */ + /* unur_distr_cont_set_domain(). Otherwise it is truncated. */ + /* */ + /* This call does not work for variant IA (immediate acceptance). */ + /* In this case it switches to variant RH!! */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double Umin, Umax; + + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, TABL, UNUR_ERR_GEN_INVALID ); + + /* we have to disable adaptive rejection sampling */ + if (GEN->max_ivs > GEN->n_ivs) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"adaptive rejection sampling disabled for truncated distribution"); + GEN->max_ivs = GEN->n_ivs; + } + + /* we cannot use immadate acceptance (IA), switch to variant PS instead */ + if (gen->variant & TABL_VARIANT_IA) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"cannot use IA for truncated distribution, switch to RH"); + /* change variante flag */ + gen->variant &= ~TABL_VARIANT_IA; + /* change sampling routine */ + SAMPLE = (gen->variant & TABL_VARFLAG_VERIFY) ? _unur_tabl_rh_sample_check : _unur_tabl_rh_sample; + } + + /* check new parameter for generator */ + /* (the truncated domain must be a subset of the domain) */ + if (left < DISTR.domain[0]) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain not subset of domain"); + left = DISTR.domain[0]; + } + if (right > DISTR.domain[1]) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain not subset of domain"); + right = DISTR.domain[1]; + } + + if (left >= right) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"domain, left >= right"); + return UNUR_ERR_DISTR_SET; + } + + /* compute CDF at x (with respect to given domain of distribution) */ + Umin = _unur_tabl_eval_cdfhat(gen,left); + Umax = _unur_tabl_eval_cdfhat(gen,right); + + /* check result */ + if (Umin > Umax) { + /* this is a serios error that should not happen */ + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + } + + if (_unur_FP_equal(Umin,Umax)) { + /* CDF values very close */ + _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values very close"); + if (_unur_iszero(Umin) || _unur_FP_same(Umax,1.)) { + /* this is very bad */ + _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values at boundary points too close"); + return UNUR_ERR_DISTR_SET; + } + } + + /* set bounds for truncated domain and for U (CDF) */ + DISTR.trunc[0] = left; + DISTR.trunc[1] = right; + GEN->Umin = Umin; + GEN->Umax = Umax; + + /* changelog */ + gen->distr->set |= UNUR_DISTR_SET_TRUNCATED; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ +#endif + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_tabl_chg_truncated() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_tabl_eval_cdfhat( struct unur_gen *gen, double x ) + /*----------------------------------------------------------------------*/ + /* evaluate CDF of hat at x (i.e. \int_{-\infty}^x hat(t) dt) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* x ... point at which hat(x) has to be computed */ + /* */ + /* return: */ + /* CDF of hat(x) or */ + /* UNUR_INFINITY in case of error */ + /* */ + /* Important: */ + /* If gen is a generator object for variant IA (immediate acceptance) */ + /* then it is treated like variant RH ("classical" rejection)! */ + /* This is necessary since variant IA is not a pure rejection */ + /* algorithm, but a composition method. */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tabl_interval *iv; + double Aint = 0.; + double cdf; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_INFINITY); + + /* the easy case: left and right boundary of domain */ + if (x <= DISTR.domain[0]) return 0.; + if (x >= DISTR.domain[1]) return 1.; + + /* find interval (sequential search) */ + for (iv = GEN->iv; iv->next!=NULL; iv=iv->next) { + COOKIE_CHECK(iv,CK_TABL_IV,UNUR_INFINITY); + if (xxmin || xxmax) break; + Aint = iv->Acum; /* area of bars to the l.h.s. of x */ + if (iv->next == NULL) /* right boundary of domain */ + return 1.; + } + + /* add area in interval that contains x */ + Aint += iv->fmax * ((iv->xmin > iv->xmax) ? (x - iv->xmax) : (x - iv->xmin)); + + /* normalize to one (and mind round-off errors) */ + cdf = Aint / GEN->Atotal; + return ((cdf > 1.) ? 1. : cdf); + +} /* end of _unur_tabl_eval_cdfhat() */ + +/*****************************************************************************/ diff --git a/vendor/unuran-1.11.0/src/methods/tabl_sample.ch b/vendor/unuran-1.11.0/src/methods/tabl_sample.ch new file mode 100644 index 0000000..8a78431 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tabl_sample.ch @@ -0,0 +1,404 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tabl_sample.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: rejection form piecewise constant hat * + * (Ahren's table method) * + * * + * DESCRIPTION: * + * Given PDF of a unimodal distribution * + * produce random variate X with its density * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +double +_unur_tabl_rh_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* (use "classical" acceptance/rejection) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng; /* pointer to uniform random number generator */ + struct unur_tabl_interval *iv; + double U,X,fx,V; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_INFINITY); + + /* main URNG */ + urng = gen->urng; + + while(1) { + + /* sample from U( Umin, Umax ) */ + U = GEN->Umin + _unur_call_urng(urng) * (GEN->Umax - GEN->Umin); + + /* look up in guide table and search for interval */ + iv = GEN->guide[(int) (U * GEN->guide_size)]; + U *= GEN->Atotal; + while (iv->Acum < U) + iv = iv->next; + + COOKIE_CHECK(iv,CK_TABL_IV,UNUR_INFINITY); + + /* reuse of uniform random number + (generation of hat should be by inversion) */ + U = (iv->xmax >= iv->xmin) ? (iv->Acum - U) : (U - iv->Acum + iv->Ahat); + /* U in (0,Ahat) or (-Ahat,0) */ + + /* sample from hat distribution in interval */ + X = iv->xmax + U * (iv->xmin - iv->xmax)/iv->Ahat; + + /* accept or reject */ + V = _unur_call_urng(urng) * iv->fmax; /* a random point between 0 and hat at x */ + + /* below squeeze ? */ + if (V <= iv->fmin) + return X; + + /* value of PDF at x */ + fx = PDF(X); + + /* being above squeeze is bad. split interval. */ + if (GEN->n_ivs < GEN->max_ivs) { + if ( (_unur_tabl_improve_hat( gen, iv, X, fx ) != UNUR_SUCCESS) + && (gen->variant & TABL_VARFLAG_PEDANTIC) ) + return UNUR_INFINITY; + } + + /* below hat */ + if (V <= fx) + return X; + + /* else reject and try again */ + + /* use the auxilliary generator the next time + (it can be the same as the main generator) */ + urng = gen->urng_aux; + + } + +} /* end of _unur_tabl_rh_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_tabl_rh_sample_check( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator and verify that method can be used */ + /* (use "classical" acceptance/rejection) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng; /* pointer to uniform random number generator */ + struct unur_tabl_interval *iv; + double U,X,fx,V; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_INFINITY); + + /* main URNG */ + urng = gen->urng; + + while(1) { + + /* sample from U( Umin, Umax ) */ + U = GEN->Umin + _unur_call_urng(urng) * (GEN->Umax - GEN->Umin); + + /* look up in guide table and search for interval */ + iv = GEN->guide[(int) (U * GEN->guide_size)]; + U *= GEN->Atotal; + while (iv->Acum < U) + iv = iv->next; + + COOKIE_CHECK(iv,CK_TABL_IV,UNUR_INFINITY); + + /* reuse of uniform random number + (generation of squeeze should be inversion) */ + U = (iv->xmax >= iv->xmin) ? (iv->Acum - U) : (U - iv->Acum + iv->Ahat); + /* U in (0,Ahat) or (-Ahat,0) */ + + /* sample from hat distribution in interval */ + X = iv->xmax + U * (iv->xmin - iv->xmax)/iv->Ahat; + + /* accept or reject */ + V = _unur_call_urng(urng) * iv->fmax; /* a random point between 0 and hat at x */ + + /* value of PDF at x */ + fx = PDF(X); + + /* test whether PDF is monotone */ + if (_unur_FP_greater(fx,iv->fmax)) + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF > hat. PDF not monotone in interval"); + if (_unur_FP_less(fx,iv->fmin)) + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF < squeeze. PDF not monotone in interval"); + + /* below squeeze ? */ + if (V <= iv->fmin) + return X; + + /* being above squeeze is bad. split interval. */ + if (GEN->n_ivs < GEN->max_ivs) { + if ( (_unur_tabl_improve_hat( gen, iv, X, fx ) != UNUR_SUCCESS) + && (gen->variant & TABL_VARFLAG_PEDANTIC) ) + return UNUR_INFINITY; + } + + /* below hat */ + if (V <= fx) + return X; + + /* else reject and try again */ + + /* use the auxilliary generator the next time + (it can be the same as the main generator) */ + urng = gen->urng_aux; + + } + +} /* end of _unur_tabl_rh_sample_check() */ + +/*****************************************************************************/ + +double +_unur_tabl_ia_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* (use immediate acceptance) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tabl_interval *iv; + double U,X,fx; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_INFINITY); + + while(1) { + + /* sample from U(0,1) */ + U = _unur_call_urng(gen->urng); + + /* look up in guide table and search for interval */ + iv = GEN->guide[(int) (U * GEN->guide_size)]; + U *= GEN->Atotal; + while (iv->Acum < U) + iv = iv->next; + + COOKIE_CHECK(iv,CK_TABL_IV,UNUR_INFINITY); + + /* reuse of uniform random number + (generation from squeeze should be inversion) */ + U = (iv->xmax <= iv->xmin) ? (iv->Acum - U) : (iv->Ahat + U - iv->Acum); + + if( U < iv->Asqueeze ) { + /* below squeeze */ + return( iv->xmax + (iv->Asqueeze-U) * (iv->xmin - iv->xmax)/iv->Asqueeze ); + } + + else { + /* between spueeze and hat --> have to valuate PDF */ + X = iv->xmax + (U-iv->Asqueeze) * (iv->xmin - iv->xmax)/(iv->Ahat - iv->Asqueeze); + fx = PDF(X); + + /* being above squeeze is bad. split interval. */ + if (GEN->n_ivs < GEN->max_ivs) { + if ( (_unur_tabl_improve_hat( gen, iv, X, fx ) != UNUR_SUCCESS) + && (gen->variant & TABL_VARFLAG_PEDANTIC) ) + return UNUR_INFINITY; + } + + /* now accept or reject */ + U = _unur_call_urng(gen->urng); + if (fx >= U * (iv->fmax - iv->fmin) + iv->fmin) + return X; + } + } + +} /* end of _unur_tabl_ia_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_tabl_ia_sample_check( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator and verify that method can be used */ + /* (use immediate acceptance) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tabl_interval *iv; + double U,X,fx; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_INFINITY); + + while(1) { + + /* sample from U(0,1) */ + U = _unur_call_urng(gen->urng); + + /* look up in guide table and search for interval */ + iv = GEN->guide[(int) (U * GEN->guide_size)]; + U *= GEN->Atotal; + while (iv->Acum < U) + iv = iv->next; + + COOKIE_CHECK(iv,CK_TABL_IV,UNUR_INFINITY); + + /* reuse of uniform random number + (generation of squeeze should be inversion) */ + U = (iv->xmax <= iv->xmin) ? (iv->Acum - U) : (iv->Ahat + U - iv->Acum); + + if( U <= iv->Asqueeze ) { + /* below squeeze */ + X = iv->xmax + (iv->Asqueeze-U) * (iv->xmin - iv->xmax)/iv->Asqueeze; + /* test whether PDF is monotone */ + fx = PDF(X); + if (_unur_FP_greater(fx,iv->fmax)) + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF > hat. PDF not monotone in interval"); + if (_unur_FP_less(fx,iv->fmin)) + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF < squeeze. PDF not monotone in interval"); + /* at last return number */ + return X; + } + + else { + /* between spueeze and hat --> have to valuate PDF */ + X = iv->xmax + (U-iv->Asqueeze) * (iv->xmin - iv->xmax)/(iv->Ahat - iv->Asqueeze); + fx = PDF(X); + + /* test whether PDF is monotone */ + if (_unur_FP_greater(fx,iv->fmax)) + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF > hat. PDF not monotone in interval"); + if (_unur_FP_less(fx,iv->fmin)) + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF < squeeze. PDF not monotone in interval"); + + /* being above squeeze is bad. split interval. */ + if (GEN->n_ivs < GEN->max_ivs) { + if ( (_unur_tabl_improve_hat( gen, iv, X, fx ) != UNUR_SUCCESS) + && (gen->variant & TABL_VARFLAG_PEDANTIC) ) + return UNUR_INFINITY; + } + + /* now accept or reject */ + U = _unur_call_urng(gen->urng); + if (fx >= U * (iv->fmax - iv->fmin) + iv->fmin) + return X; + } + } +} /* end of _unur_tabl_ia_sample_check() */ + +/*****************************************************************************/ + +int +_unur_tabl_improve_hat( struct unur_gen *gen, struct unur_tabl_interval *iv, + double x, double fx) + /*----------------------------------------------------------------------*/ + /* improve hat function and by splitting interval */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval that has to be split */ + /* x ... splitting point */ + /* fx ... value of PDF at splitting point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... improving hat successful */ + /* others ... error: PDF not monotone in interval */ + /*----------------------------------------------------------------------*/ +{ + int result; + + /* is there any reason to improve hat ? */ + if (! (GEN->max_ratio * GEN->Atotal > GEN->Asqueeze) ) { + /* no more construction points (avoid calling this function any more) */ + GEN->max_ivs = GEN->n_ivs; + return UNUR_SUCCESS; + } + + /* add construction point */ + result = _unur_tabl_split_interval( gen, iv, x, fx,(gen->variant & TABL_VARMASK_SPLIT)); + if (! (result == UNUR_SUCCESS || result == UNUR_ERR_SILENT) ) { + /* condition for PDF is violated! */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,""); + /* replace sampling routine by dummy routine that just returns UNUR_INFINITY */ + SAMPLE = _unur_sample_cont_error; + return UNUR_ERR_GEN_CONDITION; + } + + /* update guide table */ + /** TODO: it is not necessary to update the guide table every time. + But then (1) some additional bookkeeping is required and + (2) the guide table method requires a acc./rej. step. **/ + if ( _unur_tabl_make_guide_table(gen) != UNUR_SUCCESS) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot create guide table"); + /* replace sampling routine by dummy routine that just returns UNUR_INFINITY */ + SAMPLE = _unur_sample_cont_error; + return UNUR_ERR_GEN_CONDITION; + } + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_tabl_improve_hat() */ + +/*****************************************************************************/ + diff --git a/vendor/unuran-1.11.0/src/methods/tabl_struct.h b/vendor/unuran-1.11.0/src/methods/tabl_struct.h new file mode 100644 index 0000000..477d222 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tabl_struct.h @@ -0,0 +1,106 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tabl_struct.h * + * * + * PURPOSE: * + * declares structures for method TABL * + * (Ahren's TABLe method: piecewise constant hat) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_tabl_par { + + const double *slopes; /* slopes , i.e.\ f(a_i) >= f(b_i) */ + int n_slopes; /* number of slopes */ + double bleft; /* left border of the domain */ + double bright; /* right border of the domain */ + + int max_ivs; /* maximum number of intervals */ + double max_ratio; /* limit for ratio r_n = A(squeeze) / A(hat) */ + + const double *cpoints; /* pointer to array of points for constr. slopes */ + int n_cpoints; /* number of points for constructing slopes */ + int n_stp; /* number of points for hat for start */ + double area_fract; /* parameter for equal area rule */ + double darsfactor; /* factor for (derandomized) ARS */ + + double guide_factor; /* relative size of guide table */ +}; + +/*---------------------------------------------------------------------------*/ +/* storing information about generator */ + +struct unur_tabl_interval { + + double xmax; /* maximum of pdf in interval */ + double fmax; /* maximal value of pdf in interval */ + double xmin; /* minimum of pdf in interval */ + double fmin; /* minimal value of pdf in interval */ + + double Ahat; /* area of total bar (below hat) */ + double Asqueeze; /* area of bar below squeeze */ + double Acum; /* cumulated area of bars */ + + struct unur_tabl_interval *next; /* pointer to next element in list */ + +#ifdef UNUR_COOKIES + unsigned cookie; /* magic cookie */ +#endif +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_tabl_gen { + double Atotal; /* total area below hat */ + double Asqueeze; /* area of squeeze polygon */ + + double bleft; /* left boundary of domain */ + double bright; /* right boundary of domain */ + + struct unur_tabl_interval **guide; /* pointer to guide table */ + int guide_size; /* size of guide table */ + double guide_factor; /* relative size of guide table */ + + double Umin, Umax; /* bounds for iid random variable in respect to + the given (truncated) domain of the distr.*/ + + struct unur_tabl_interval *iv; /* pointer to linked list of intervals */ + int n_ivs; /* number of intervals */ + int max_ivs; /* maximum number of intervals */ + double max_ratio; /* limit for ratio r_n = A(squeeze) / A(hat) */ + + double darsfactor; /* factor for (derandomized) ARS */ +#ifdef UNUR_ENABLE_INFO + int max_ivs_info; /* maximum number of intervals (as given) */ +#endif +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/tdr.c b/vendor/unuran-1.11.0/src/methods/tdr.c new file mode 100644 index 0000000..677f453 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tdr.c @@ -0,0 +1,673 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tdr.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: transformed density rejection * + * * + * DESCRIPTION: * + * Given PDF of a T-concave distribution * + * produce a value x consistent with its density * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Hoermann W. (1995): A rejection technique for sampling from * + * T-concave distributions, ACM TOMS 21, p. 182-193 * + * * + * [2] Chen, H. C. and Asau, Y. (1974): On generating random variates * + * from an empirical distribution, AIIE Trans. 6, pp. 163-166 * + * * + * [3] Gilks, W. R. and Wild, P. (1992): Adaptive rejection sampling * + * for Gibbs sampling, Applied Statistics 41, pp. 337-348 * + * * + * [4] Evans, M. and Swartz, T. (1998): Random variable generation * + * using concavity properties of transformed densities, * + * Journal of Computational and Graphical Statistics 7(4), pp. 514-528 * + * * + * [5] Derflinger, G. and Hoermann, W. (1999): The optimal selection of * + * hat functions for rejection algorithms, preprint * + * * + * [6] Leydold, J. (1999): Automatic Sampling with the ratio-of-uniforms * + * method, preprint, 15pp. * + * * + * [7] Leydold, J and Hoermann, W. (2001): ?????, preprint * + * * + ***************************************************************************** + + ***************************************************************************** + * Variant GW (Gilks & Wild) * + ***************************************************************************** + * * + * Transformed density rejection (see [1,3,4]) is an acceptance/rejection * + * technique that uses the fact, that the probability density function f(x) * + * for many distribution is T-concave, to construct a hat function. * + * That is, there exists a transformation T(x), such that T(f(x)) is * + * concave. Then it is easy to construct a majorizing or hat function Th(x) * + * for the transformed density T(F(x)) by the pointwise minima of several * + * tangents. Transforming this back into the original scale gives the * + * hat h(x) = T^(-1)(Th(x)). Squeezes can be constructed by secants. * + * * + * However, transformation T(x) has to satisfy (see [1]): * + * * + * (1) T(f(x)) is concave. * + * (2) T is differentiable. * + * (3) T is strictly monotonically increasing (i.e., T'(x) > 0), * + * which implies that T^(-1) exists. * + * (4) the area below the hat is finite. * + * (5) it is easy to generate from the hat distribution. * + * * + * We use a family T_c(x) of distribution defined by (see [1]): * + * * + * c | T_c(x) * + * ---------+--------------- * + * 0 | log(x) * + * -1/2 | -1/sqrt(x) * + * -1 * + * .** / **. * + * * / *... * + * * / * .... * + * construction * / squeeze * ... * + * point X * ... * + * * * .... * + * * * ... * + * * * .. * + * . . * + * .* * * + * .* * * + * . * + * . * * * + * . * * * + * . * + * . * transformed PDF * * + * transformed . * + * hat . * * * + * . * + * . * * * + * . * + * . * * * + * . * + * . * * * + * . * + * * * * + * * + * * + * * * * + * * + * * + * * + *...........................................................................* + * * + * figure 2: density with hat and squeeze * + * T(x) = log(x) * + * PDF(x) = exp(-x^2) * + * * + * .. * + * . . * + * . . * + * . . * + * . ***. * + * . ** ** * + * . * X * + * .* /|* * + * .* / |* . * + * .* / | * . * + * .* / | * . * + * * / | * .. * + * * / | * . * + * * / | * .. * + * * /squeeze | * . * + * construction * / | * .. * + * point --- X/ | * .. * + * *| | * .. * + * *| | * .. * + * * | | * .. * + * * | | * ... * + * * | | * .. * + * .* | | * * + * .* | | * * + * .* | | * * + * . * | | * * + * . * | | * * + * hat .. * | | * * + * . * | | * * + * .. * PDF | | * * + * ... * | | * * + * ... ** | | ** * + * . ** | | ** * + * **** | | **** * + * --**--------+---------X---------+---X-----+---------+--------**---> * + * -3 -2 -1 0 1 2 3 * + * * + * * + *...........................................................................* + * * + * To generate from the hat distribution we have to partition the domain * + * of the PDF by means of the construction points of the tangents into * + * several intervals. Each interval has to be divided into two parts * + * according to the tangent line that defines the hat function. * + * Although the interval can be divided at any point in the interval, * + * the best possible splitting point obviously is the intersection point * + * of respective the tangents at the left and right construction point of * + * the interval. However there are two cases when this choice is not * + * appropriate: (1) The computation of this point is unstable. Then we use * + * the mean point of the interval. (2) One of the two construction points * + * is very much greater (or smaller) than the other one. Since we generate * + * points by adding or subtracting a random number to the construction * + * point, it then happens, that we have the difference of two large numbers, * + * which results in serious roundoff error. Then it is better to choose the * + * intersection point such that we have only one interval with the point * + * nearer to the origin as the only construction point. * + * (This procedure is a little bit different from [1] or [3], but the author * + * of this program finds the implemented version more convenient.) Then we * + * have to compute the area below the hat for each of the two parts of the * + * interval i (A_l^i for the left hand part, A_r^i for the right hand part) * + * for each interval. Then we have to sample from a discrete random variate * + * with probability vector proportional to (A_l^0,A_r^0; A_l^1,A_r^1; ...; * + * A_l^n,A_r^n) to get one of the intervals. We use indexed search (or * + * guide tables) to perform this task ([2], see also description of DIS). * + * Then we can sample from the hat distribution in this part of the * + * interval by inversion. Notice that we can use reuse the uniform random * + * number from the first step (i.e., sampling an interval) for this second * + * step without danger. The whole generation can be seen as inversion from * + * the hat distribution. * + * * + *...........................................................................* + * * + * Algorithm TDR * + * * + * [Required] * + * PDF f(x), transformation T(x), construction points c_1,...,c_n * + * * + * [Setup] * + * 1: Construct hat h(x) and squeeze s(x). * + * 2: Foreach Interval (c_i,c_{i+1}) Do * + * 3: Compute areas A_l^i, A_r^i, A_squeeze. * + * * + * [Generate] * + * 4: Generate I proportional to (A_l^1,A_r^1; ...). * + * 5: Generate X with PDF proportional to h|I. * + * 6: Generate U ~ U(0,1). * + * 7: If U * h(x) <= min(f(c_i),f(c_{i+1})) Return X. * + * 8: If U * h(x) <= s(X) Return X. * + * 9: If U * h(x) <= f(X) Return X. * + * 10: Goto 4. * + * * + *...........................................................................* + * * + * There are several alternatives for the choice of the construction points * + * * + * (1) Adaptive rejection sampling: * + * Use two points on both sides of the mode of the PDF (provided * + * that the hat has finite area). * + * Whenever the PDF has to be evaluated in step 8, add a new * + * construction point at X. * + * * + * (2) Optimal construction points: * + * [5] have show an asymptotic formula for optimal construction points, * + * i.e., with minimiza the ration Ahat/Asqueeze for a given number of * + * points. Although this formula is only valid for infinitely many * + * construction points, it works very well even for 3 or 4 points. * + * * + * [1] gives a formula for three optimal construction points. * + * * + * (3) Empirical formulas: * + * [6] uses points c_i, such that arctan(c_i) are equidistributed. * + * ("equiangular rule"). * + * In most cases it has turned out as an acceptable good choice. * + * (We made one change to [6]: If the mode is known, all points are * + * moved, such the mode becomes the center of these points.) * + * * + * This implementation uses (3) to get good points for the start and adds * + * additional construction points by means of method (1). * + * (The number of starting points and the maximum number of points can * + * be set for each generator.) * + * * + *...........................................................................* + * * + * Implementation details: * + * * + * (1) If possible the boundary points of the domain are used as * + * construction points. (So do not include these in a list of starting * + * points.) As a consequence 0 starting points are allowed. * + * * + * (2) To make use of the automatic generation of starting points call * + * `unur_set_cpoints() with the NULL pointer as the last argument * + * and the number of construction points (besides the boundary points * + * and the mode) as its third argument. * + * * + * (3) If the mode is given, we use a tangent with slope 0 at this point; * + * even when this does not result in the best possible hat (e.g. for * + * the exponential distribution). * + * * + * (4) Starting points and the mode outside the domain are ignored. * + * * + * (5) If the given starting points does not result in a hat with finite * + * area, the program tries to find some proper additional construction * + * points by splitting interval with infinite area. (Here we use the * + * "equiangular rule" again.) * + * * + * (6) The use of the additional "fast" squeeze in step 7 is due to a * + * suggestion of G. Derflinger. It speeds up the generation about 20 % * + * when many construction points are used. * + * * + ***************************************************************************** + + ***************************************************************************** + * Variant PS (Proportional Squeezes) * + ***************************************************************************** + * * + * The original algorithm can be modified in the following way: * + * Use squeezes that are proportional to the hat function in each of the * + * intervals. This decreases the marginal generation times; * + * see [7] for details. * + * * + * Technical remarks: * + * The boundary points of the intervals are now the intersection points * + * of the tangents to the transformed density. However we have used the * + * same structure for an interval as in variant GW. To have a similar * + * code we have stored the left boundary of an interval together with the * + * construction point. Thus the right boundary point is stored in the * + * interval structure in the list of intervals. * + * We also have added an empty interval structure in this list that just * + * marks the right boundary of the domain of the PDF. * + * * + ***************************************************************************** + + ***************************************************************************** + * Variant IA (Immedate Acceptance) * + ***************************************************************************** + * * + * IA is a composition method that uses squeezes that are proportional to * + * the hat function in each of the intervals (as in PS). We immediately * + * accept all points below the squeeze and use an acceptance/rejection * + * technique only we fall in the region between hat and squeeze. It works * + * very well since it is easy to generate points in this region (in * + * opposition to variant GW). * + * * + * For technical details see variant PS. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "tdr.h" +#include "tdr_struct.h" + +/*---------------------------------------------------------------------------*/ +/* Constants */ + +/*---------------------------------------------------------------------------*/ +/* Variants */ + +#define TDR_VARMASK_T 0x000fu /* indicates transformation */ +#define TDR_VAR_T_SQRT 0x0001u /* T(x) = -1/sqrt(x) */ +#define TDR_VAR_T_LOG 0x0002u /* T(x) = log(x) */ +#define TDR_VAR_T_POW 0x0003u /* T(x) = -x^c */ + +#define TDR_VARMASK_VARIANT 0x00f0u /* indicates which variant */ +#define TDR_VARIANT_GW 0x0010u /* original variant (Gilks&Wild) */ +#define TDR_VARIANT_PS 0x0020u /* use proportional squeeze */ +#define TDR_VARIANT_IA 0x0030u /* use immediate acceptance + (requires prop. squeeze) */ + +#define TDR_VARFLAG_VERIFY 0x0100u /* flag for verifying mode */ +#define TDR_VARFLAG_USECENTER 0x0200u /* whether center is used as cpoint or not */ +#define TDR_VARFLAG_USEMODE 0x0400u /* whether mode is used as cpoint or not */ +#define TDR_VARFLAG_PEDANTIC 0x0800u /* whether pedantic checking is used */ +#define TDR_VARFLAG_USEDARS 0x1000u /* whether DARS is used in setup or not */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define TDR_DEBUG_IV 0x00000010u +#define TDR_DEBUG_SPLIT 0x00010000u +#define TDR_DEBUG_DARS 0x00020000u +#define TDR_DEBUG_SAMPLE 0x01000000u +#define TDR_DEBUG_REINIT 0x00000020u /* print parameters after reinit */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define TDR_SET_CENTER 0x1000u +#define TDR_SET_STP 0x0001u +#define TDR_SET_N_STP 0x0002u +#define TDR_SET_PERCENTILES 0x0004u +#define TDR_SET_N_PERCENTILES 0x0008u +#define TDR_SET_RETRY_NCPOINTS 0x0010u +#define TDR_SET_GUIDEFACTOR 0x0020u +#define TDR_SET_C 0x0040u +#define TDR_SET_MAX_SQHRATIO 0x0080u +#define TDR_SET_MAX_IVS 0x0100u +#define TDR_SET_USE_DARS 0x0200u +#define TDR_SET_DARS_FACTOR 0x0400u + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "TDR" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_tdr_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_tdr_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_tdr_make_gen( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Make generator object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_tdr_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_tdr_gw_sample( struct unur_gen *generator ); +static double _unur_tdr_gw_sample_check( struct unur_gen *generator ); +static double _unur_tdr_ps_sample( struct unur_gen *generator ); +static double _unur_tdr_ps_sample_check( struct unur_gen *generator ); +static double _unur_tdr_ia_sample( struct unur_gen *generator ); +static double _unur_tdr_ia_sample_check( struct unur_gen *generator ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static double _unur_tdr_gw_eval_invcdfhat( const struct unur_gen *generator, double u, + double *hx, double *fx, double *sqx, + struct unur_tdr_interval **iv, + struct unur_tdr_interval **cpt ); +static double _unur_tdr_ps_eval_invcdfhat( const struct unur_gen *generator, double u, + double *hx, double *fx, double *sqx, + struct unur_tdr_interval **iv ); +/*---------------------------------------------------------------------------*/ +/* auxiliary routines to evaluate the inverse of the hat CDF. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_tdr_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_tdr_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_tdr_starting_cpoints( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* create list of construction points for starting segments. */ +/* if user has not provided such points compute these by means of the */ +/* "equi-angle rule". */ +/*---------------------------------------------------------------------------*/ + +static int _unur_tdr_starting_intervals( struct unur_gen *gen ); +static int _unur_tdr_gw_starting_intervals( struct unur_gen *gen ); +static int _unur_tdr_ps_starting_intervals( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* compute intervals from given starting construction points. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_tdr_run_dars( struct unur_gen *gen ); +static int _unur_tdr_gw_dars( struct unur_gen *gen ); +static int _unur_tdr_ps_dars( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* run derandomized adaptive rejection sampling. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_tdr_gw_interval_parameter( struct unur_gen *gen, struct unur_tdr_interval *iv ); +static int _unur_tdr_ps_interval_parameter( struct unur_gen *gen, struct unur_tdr_interval *iv ); +/*---------------------------------------------------------------------------*/ +/* compute all necessary data for interval. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_tdr_interval *_unur_tdr_interval_new( struct unur_gen *gen, + double x, double fx, int is_mode ); +/*---------------------------------------------------------------------------*/ +/* make a new segment with left construction point x. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_tdr_tangent_intersection_point( struct unur_gen *gen, + struct unur_tdr_interval *iv, double *ipt ); +/*---------------------------------------------------------------------------*/ +/* compute cutting point of interval into left and right part. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_tdr_interval_area( struct unur_gen *gen, struct unur_tdr_interval *iv, + double slope, double x ); +/*---------------------------------------------------------------------------*/ +/* compute area below piece of hat or squeeze in interval. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_tdr_interval_xxarea( struct unur_gen *gen, struct unur_tdr_interval *iv, + double slope, double x ); +/*---------------------------------------------------------------------------*/ +/* compute the interal of x times hat or squeeze ("expected value"). */ +/*---------------------------------------------------------------------------*/ + +static double _unur_tdr_eval_intervalhat( struct unur_gen *gen, + struct unur_tdr_interval *iv, double x ); +/*---------------------------------------------------------------------------*/ +/* evaluate hat at x in interval. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_tdr_eval_cdfhat( struct unur_gen *gen, double x ); +/*---------------------------------------------------------------------------*/ +/* evaluate CDF of hat at x. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_tdr_gw_interval_split( struct unur_gen *gen, + struct unur_tdr_interval *iv_old, double x, double fx ); +static int _unur_tdr_ps_interval_split( struct unur_gen *gen, + struct unur_tdr_interval *iv_old, double x, double fx ); +/*---------------------------------------------------------------------------*/ +/* split am interval point x. return 0 if not successful. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_tdr_gw_improve_hat( struct unur_gen *gen, struct unur_tdr_interval *iv, + double x, double fx); +static int _unur_tdr_ps_improve_hat( struct unur_gen *gen, struct unur_tdr_interval *iv, + double x, double fx); +/*---------------------------------------------------------------------------*/ +/* improve hat function by splitting interval */ +/*---------------------------------------------------------------------------*/ + +static int _unur_tdr_make_guide_table( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* make a guide table for indexed search. */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_tdr_debug_init_start( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after (almost empty generator) object has been created. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_tdr_debug_init_finished( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_tdr_debug_dars_start( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print header before runniung derandomized adaptive rejection sampling. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_tdr_debug_dars_finished( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has run derandomized adaptive rejection sampling. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_tdr_debug_reinit_start( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print before reinitialization of generator starts. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_tdr_debug_reinit_retry( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print before second trial of reinitialization of generator starts. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_tdr_debug_reinit_finished( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been reinitialized. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_tdr_debug_free( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print before generater is destroyed. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_tdr_debug_intervals( const struct unur_gen *gen, const char *header, int print_areas ); +static void _unur_tdr_gw_debug_intervals( const struct unur_gen *gen, int print_areas ); +static void _unur_tdr_ps_debug_intervals( const struct unur_gen *gen, int print_areas ); +/*---------------------------------------------------------------------------*/ +/* print data for intervals */ +/*---------------------------------------------------------------------------*/ + +static void _unur_tdr_gw_debug_sample( const struct unur_gen *gen, + const struct unur_tdr_interval *iv, + const struct unur_tdr_interval *pt, + double x, double fx, double hx, double sqx ); +static void _unur_tdr_ps_debug_sample( const struct unur_gen *gen, + const struct unur_tdr_interval *iv, + double x, double fx, double hx, double sqx ); +/*---------------------------------------------------------------------------*/ +/* print data while sampling from generators. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_tdr_gw_debug_split_start( const struct unur_gen *gen, + const struct unur_tdr_interval *iv, + double x, double fx ); +static void _unur_tdr_gw_debug_split_stop( const struct unur_gen *gen, + const struct unur_tdr_interval *iv_left, + const struct unur_tdr_interval *iv_right ); +static void _unur_tdr_ps_debug_split_start( const struct unur_gen *gen, + const struct unur_tdr_interval *iv_left, + const struct unur_tdr_interval *iv_right, + double x, double fx ); +static void _unur_tdr_ps_debug_split_stop( const struct unur_gen *gen, + const struct unur_tdr_interval *iv_left, + const struct unur_tdr_interval *iv_middle, + const struct unur_tdr_interval *iv_right ); +/*---------------------------------------------------------------------------*/ +/* print before and after an interval has been split (not / successfully). */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_tdr_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cont /* data for distribution object */ + +#define PAR ((struct unur_tdr_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_tdr_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define BD_LEFT domain[0] /* left boundary of domain of distribution */ +#define BD_RIGHT domain[1] /* right boundary of domain of distribution */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +#define PDF(x) _unur_cont_PDF((x),(gen->distr)) /* call to PDF */ +#define dPDF(x) _unur_cont_dPDF((x),(gen->distr)) /* call to derivative of PDF */ +#define logPDF(x) _unur_cont_logPDF((x),(gen->distr)) /* call to logPDF */ +#define dlogPDF(x) _unur_cont_dlogPDF((x),(gen->distr)) /* call to derivative of log PDF */ + +/*---------------------------------------------------------------------------*/ + +static UNUR_SAMPLING_ROUTINE_CONT * +_unur_tdr_getSAMPLE( struct unur_gen *gen ) +{ + switch (gen->variant & TDR_VARMASK_VARIANT) { + case TDR_VARIANT_GW: /* original variant (Gilks&Wild) */ + return (gen->variant & TDR_VARFLAG_VERIFY) ? _unur_tdr_gw_sample_check : _unur_tdr_gw_sample; + case TDR_VARIANT_IA: /* immediate acceptance */ + return (gen->variant & TDR_VARFLAG_VERIFY) ? _unur_tdr_ia_sample_check : _unur_tdr_ia_sample; + case TDR_VARIANT_PS: /* proportional squeeze */ + default: + return (gen->variant & TDR_VARFLAG_VERIFY) ? _unur_tdr_ps_sample_check : _unur_tdr_ps_sample; + } +} /* end of _unur_tdr_getSAMPLE() */ + +/*---------------------------------------------------------------------------*/ +/* since there is only file scope or program code, we abuse the */ +/* #include directive. */ + +/** Public: User Interface (API) **/ +#include "tdr_newset.ch" + +/** Private **/ +#include "tdr_init.ch" +#include "tdr_sample.ch" +#include "tdr_debug.ch" +#include "tdr_info.ch" + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/tdr.h b/vendor/unuran-1.11.0/src/methods/tdr.h new file mode 100644 index 0000000..c77e8b9 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tdr.h @@ -0,0 +1,474 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tdr.h * + * * + * PURPOSE: * + * function prototypes for method TDR * + * (Transformed Density Rejection) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD TDR Transformed Density Rejection + + =UP Methods_for_CONT + + =REQUIRED T-concave PDF, dPDF + + =OPTIONAL mode + + =SPEED Set-up: slow, Sampling: fast + + =REINIT supported + + =REF [GWa92] [HWa95] [HLD04: Cha.4] + + =DESCRIPTION + TDR is an acceptance/rejection method that uses the concavity of a + transformed density to construct hat function and squeezes + automatically. Such PDFs are called T-concave. Currently the + following transformations are implemented and can be selected by + setting their @code{c}-values by a unur_tdr_set_c() call: + + @table @code + @item c = 0 + T(x) = log(x) + @item c = -0.5 + T(x) = -1/sqrt(x) @ @ @ @ @ (Default) + @end table + + In future releases the transformations T(x) = -(x)^c will be + available for any c with 0 > c > -1. + Notice that if a PDF is T-concave for a c then it also T-concave + for every c'genid); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = transformed density rejection\n",gen->genid); + fprintf(LOG,"%s: variant = ",gen->genid); + switch (gen->variant & TDR_VARMASK_VARIANT) { + case TDR_VARIANT_GW: + fprintf(LOG,"original (Gilks & Wild) ... GW\n"); break; + case TDR_VARIANT_PS: + fprintf(LOG,"proportional squeeze ... PS\n"); break; + case TDR_VARIANT_IA: + fprintf(LOG,"immediate acceptance ... IA\n"); break; + } + fprintf(LOG,"%s: transformation T_c(x) = ",gen->genid); + switch( gen->variant & TDR_VARMASK_T ) { + case TDR_VAR_T_LOG: + fprintf(LOG,"log(x) ... c = 0"); break; + case TDR_VAR_T_SQRT: + fprintf(LOG,"-1/sqrt(x) ... c = -1/2"); break; + case TDR_VAR_T_POW: + fprintf(LOG,"-x^(%g) ... c = %g",GEN->c_T,GEN->c_T); break; + } + _unur_print_if_default(gen,TDR_SET_C); + fprintf(LOG,"\n%s:\n",gen->genid); + + if (gen->distr_is_privatecopy) + fprintf(LOG,"%s: use private copy of distribution object\n",gen->genid); + else + fprintf(LOG,"%s: use pointer to external distribution object (dangerous!)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cont_debug( gen->distr, gen->genid ); + + fprintf(LOG,"%s: sampling routine = _unur_tdr_",gen->genid); + switch (gen->variant & TDR_VARMASK_VARIANT) { + case TDR_VARIANT_GW: + fprintf(LOG,"gw"); break; + case TDR_VARIANT_PS: + fprintf(LOG,"ps"); break; + case TDR_VARIANT_IA: + fprintf(LOG,"ia"); break; + } + if (gen->variant & TDR_VARFLAG_VERIFY) + fprintf(LOG,"_sample_check()\n"); + else + fprintf(LOG,"_sample()\n"); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: center = %g",gen->genid,GEN->center); + _unur_print_if_default(gen,TDR_SET_CENTER); + if (gen->variant & TDR_VARFLAG_USEMODE) + fprintf(LOG,"\n%s: use mode as construction point",gen->genid); + else if (gen->variant & TDR_VARFLAG_USECENTER) + fprintf(LOG,"\n%s: use center as construction point",gen->genid); + fprintf(LOG,"\n%s:\n",gen->genid); + + fprintf(LOG,"%s: maximum number of intervals = %d",gen->genid,GEN->max_ivs); + _unur_print_if_default(gen,TDR_SET_MAX_IVS); + fprintf(LOG,"\n%s: bound for ratio Asqueeze / Atotal = %g%%",gen->genid,GEN->max_ratio*100.); + _unur_print_if_default(gen,TDR_SET_MAX_SQHRATIO); + fprintf(LOG,"\n%s:\n",gen->genid); + + if (gen->variant & TDR_VARFLAG_USEDARS) { + fprintf(LOG,"%s: Derandomized ARS enabled ",gen->genid); + _unur_print_if_default(gen,TDR_SET_USE_DARS); + fprintf(LOG,"\n%s:\tDARS factor = %g",gen->genid,GEN->darsfactor); + _unur_print_if_default(gen,TDR_SET_DARS_FACTOR); + fprintf(LOG,"\n%s:\tDARS rule %d",gen->genid,GEN->darsrule); + _unur_print_if_default(gen,TDR_SET_USE_DARS); + } + else { + fprintf(LOG,"%s: Derandomized ARS disabled ",gen->genid); + _unur_print_if_default(gen,TDR_SET_USE_DARS); + } + fprintf(LOG,"\n%s:\n",gen->genid); + + fprintf(LOG,"%s: sampling from list of intervals: indexed search (guide table method)\n",gen->genid); + fprintf(LOG,"%s: relative guide table size = %g%%",gen->genid,100.*GEN->guide_factor); + _unur_print_if_default(gen,TDR_SET_GUIDEFACTOR); + fprintf(LOG,"\n%s:\n",gen->genid); + + fprintf(LOG,"%s: number of starting points = %d",gen->genid,GEN->n_starting_cpoints); + _unur_print_if_default(gen,TDR_SET_N_STP); + fprintf(LOG,"\n%s: starting points:",gen->genid); + if (gen->set & TDR_SET_STP) + for (i=0; in_starting_cpoints; i++) { + if (i%5==0) fprintf(LOG,"\n%s:\t",gen->genid); + fprintf(LOG," %#g,",GEN->starting_cpoints[i]); + } + else + fprintf(LOG," use \"equidistribution\" rule [default]"); + fprintf(LOG,"\n%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_tdr_debug_init_start() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_tdr_debug_init_finished( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator after setup into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + _unur_tdr_debug_intervals(gen,"INIT completed",TRUE); + + fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_tdr_debug_init_finished() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_tdr_debug_dars_start( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* print header before runniung DARS into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + if (gen->debug & TDR_DEBUG_IV) + _unur_tdr_debug_intervals(gen,"Starting Intervals:",TRUE); + fprintf(LOG,"%s: DARS started **********************\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: DARS factor = %g",gen->genid,GEN->darsfactor); + _unur_print_if_default(gen,TDR_SET_DARS_FACTOR); + fprintf(LOG,"\n%s: DARS rule %d",gen->genid,GEN->darsrule); + _unur_print_if_default(gen,TDR_SET_USE_DARS); + fprintf(LOG,"\n%s:\n",gen->genid); + + fflush(LOG); +} /* end of _unur_tdr_debug_dars_start() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_tdr_debug_dars_finished( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* print infor after generator has run DARS into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: DARS finished **********************\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); +} /* end of _unur_tdr_debug_dars_finished() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_tdr_debug_reinit_start( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator before reinitialization into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + int i; + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: *** Re-Initialize generator object ***\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + if (gen->set & TDR_SET_N_PERCENTILES) { + fprintf(LOG,"%s: use percentiles of old hat as starting points for new hat:",gen->genid); + for (i=0; in_percentiles; i++) { + if (i%5==0) fprintf(LOG,"\n%s:\t",gen->genid); + fprintf(LOG," %#g,",GEN->percentiles[i]); + } + fprintf(LOG,"\n%s: starting points:",gen->genid); + for (i=0; in_starting_cpoints; i++) { + if (i%5==0) fprintf(LOG,"\n%s:\t",gen->genid); + fprintf(LOG," %#g,",GEN->starting_cpoints[i]); + } + fprintf(LOG,"\n"); + } + else { + fprintf(LOG,"%s: use starting points given at init\n",gen->genid); + } + + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_tdr_debug_reinit_start() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_tdr_debug_reinit_retry( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator before second trial of reinitialization */ + /* into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: *** Re-Initialize failed --> second trial ***\n",gen->genid); + fprintf(LOG,"%s: use equal-area-rule with %d points\n",gen->genid,GEN->retry_ncpoints); + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_tdr_debug_reinit_retry() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_tdr_debug_reinit_finished( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator after reinitialization into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + _unur_tdr_debug_intervals(gen,"*** Generator reinitialized ***",TRUE); + + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_tdr_debug_reinit_finished() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_tdr_debug_free( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator before destroying into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + if (gen->status == UNUR_SUCCESS) { + fprintf(LOG,"%s: GENERATOR destroyed **********************\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + _unur_tdr_debug_intervals(gen,NULL,TRUE); + } + else { + fprintf(LOG,"%s: initialization of GENERATOR failed **********************\n",gen->genid); + _unur_tdr_debug_intervals(gen,"Intervals after failure:",FALSE); + } + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_tdr_debug_free() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_tdr_debug_intervals( const struct unur_gen *gen, const char *header, int print_areas ) + /*----------------------------------------------------------------------*/ + /* write list of intervals into LOG file(orig. variant by Gilks & Wild) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* header ... header for table */ + /* print_areas ... whether table of areas should be printed */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + if (header) fprintf(LOG,"%s:%s\n",gen->genid,header); + + switch (gen->variant & TDR_VARMASK_VARIANT) { + case TDR_VARIANT_GW: /* original variant (Gilks&Wild) */ + _unur_tdr_gw_debug_intervals(gen,print_areas); + return; + case TDR_VARIANT_PS: /* proportional squeeze */ + case TDR_VARIANT_IA: /* immediate acceptance */ + _unur_tdr_ps_debug_intervals(gen,print_areas); + return; + default: + _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return; + } +} /* end of _unur_tdr_debug_intervals() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + + diff --git a/vendor/unuran-1.11.0/src/methods/tdr_gw_debug.ch b/vendor/unuran-1.11.0/src/methods/tdr_gw_debug.ch new file mode 100644 index 0000000..368bf97 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tdr_gw_debug.ch @@ -0,0 +1,291 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tdr_gw_debug.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: transformed density rejection * + * * + * DESCRIPTION: * + * Debugging routines for variant of Gilks and Wild. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +void +_unur_tdr_gw_debug_intervals( const struct unur_gen *gen, int print_areas ) + /*----------------------------------------------------------------------*/ + /* write list of intervals into LOG file(orig. variant by Gilks & Wild) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* print_areas ... whether table of areas should be printed */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + struct unur_tdr_interval *iv; + double sAsqueeze, sAhatl, sAhatr, Atotal; + int i; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:Intervals: %d\n",gen->genid,GEN->n_ivs); + if (GEN->iv) { + if (gen->debug & TDR_DEBUG_IV) { + fprintf(LOG,"%s: Nr. tp ip f(tp) T(f(tp)) d(T(f(tp))) squeeze\n",gen->genid); + for (iv = GEN->iv, i=0; iv->next!=NULL; iv=iv->next, i++) { + COOKIE_CHECK(iv,CK_TDR_IV,RETURN_VOID); + fprintf(LOG,"%s:[%3d]: %#12.6g %#12.6g %#12.6g %#12.6g %#12.6g %#12.6g\n", gen->genid, i, + iv->x, iv->ip, iv->fx, iv->Tfx, iv->dTfx, iv->sq); + } + COOKIE_CHECK(iv,CK_TDR_IV,RETURN_VOID); + fprintf(LOG,"%s:[...]: %#12.6g %#12.6g %#12.6g %#12.6g\n", gen->genid, + iv->x, iv->fx, iv->Tfx, iv->dTfx); + } + fprintf(LOG,"%s:\n",gen->genid); + } + else + fprintf(LOG,"%s: No intervals !\n",gen->genid); + + if (!print_areas || GEN->Atotal <= 0.) return; + + /* print and sum areas below squeeze and hat */ + Atotal = GEN->Atotal; + if (gen->debug & TDR_DEBUG_IV) { + fprintf(LOG,"%s:Areas in intervals:\n",gen->genid); + fprintf(LOG,"%s: Nr.\tbelow squeeze\t\t below hat (left and right)\t\t cumulated\n",gen->genid); + sAsqueeze = sAhatl = sAhatr = 0.; + if (GEN->iv) { + for (iv = GEN->iv, i=0; iv->next!=NULL; iv=iv->next, i++) { + COOKIE_CHECK(iv,CK_TDR_IV,RETURN_VOID); + sAsqueeze += iv->Asqueeze; + sAhatl += iv->Ahat - iv->Ahatr; + sAhatr += iv->Ahatr; + fprintf(LOG,"%s:[%3d]: %-12.6g(%6.3f%%) | %-12.6g+ %-12.6g(%6.3f%%) | %-12.6g(%6.3f%%)\n", + gen->genid,i, + iv->Asqueeze, iv->Asqueeze * 100. / Atotal, + iv->Ahat-iv->Ahatr, iv->Ahatr, iv->Ahat * 100. / Atotal, + iv->Acum, iv->Acum * 100. / Atotal); + } + fprintf(LOG,"%s: ---------- --------- | ------------------------ --------- +\n",gen->genid); + fprintf(LOG,"%s: Sum : %-12.6g(%6.3f%%) %-12.6g (%6.3f%%)\n",gen->genid, + sAsqueeze, sAsqueeze * 100. / Atotal, + sAhatl+sAhatr, (sAhatl+sAhatr) * 100. / Atotal); + fprintf(LOG,"%s:\n",gen->genid); + } + } + + /* summary of areas */ + fprintf(LOG,"%s: A(squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, + GEN->Asqueeze, GEN->Asqueeze * 100./Atotal); + fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, + Atotal - GEN->Asqueeze, (Atotal - GEN->Asqueeze) * 100./Atotal); + fprintf(LOG,"%s: A(total) = %-12.6g\n",gen->genid, Atotal); + + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_tdr_gw_debug_intervals() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_tdr_gw_debug_sample( const struct unur_gen *gen, + const struct unur_tdr_interval *iv, + const struct unur_tdr_interval *pt, + double x, double fx, double hx, double sqx ) + /*----------------------------------------------------------------------*/ + /* write info about generated point */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval */ + /* pt ... pointer to interval that stores construction point */ + /* x ... generated point */ + /* fx ... value of PDF at x */ + /* hx ... value of hat at x */ + /* sqx ... value of squeeze at x */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); + CHECK_NULL(iv,RETURN_VOID); COOKIE_CHECK(iv,CK_TDR_IV,RETURN_VOID); + CHECK_NULL(pt,RETURN_VOID); COOKIE_CHECK(pt,CK_TDR_IV,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + if (iv == pt) + fprintf(LOG,"%s: point generated in left part:\n",gen->genid); + else + fprintf(LOG,"%s: point generated in right part:\n",gen->genid); + + fprintf(LOG,"%s: construction point: x0 = %g\n",gen->genid,pt->x); + fprintf(LOG,"%s: transformed hat Th(x) = %g + %g * (x - %g)\n",gen->genid,pt->Tfx,pt->dTfx,pt->x); + fprintf(LOG,"%s: transformed squeeze Ts(x) = %g + %g * (x - %g)\n",gen->genid,iv->Tfx,iv->sq,iv->x); + fprintf(LOG,"%s: generated point: x = %g\n",gen->genid,x); + fprintf(LOG,"%s: h(x) = %.20g\n",gen->genid,hx); + fprintf(LOG,"%s: f(x) = %.20g\n",gen->genid,fx); + fprintf(LOG,"%s: s(x) = %.20g\n",gen->genid,sqx); + fprintf(LOG,"%s: hat: x - x0 = %g",gen->genid,x-pt->x); + if (x < pt->x && iv == pt) fprintf(LOG," <-- error\n"); + else fprintf(LOG,"\n"); + fprintf(LOG,"%s: h(x) - f(x) = %g",gen->genid,hx-fx); + if (hxgenid,x-iv->x); + if (x > pt->x && iv != pt) fprintf(LOG," <-- error\n"); + else fprintf(LOG,"\n"); + fprintf(LOG,"%s: f(x) - s(x) = %g",gen->genid,fx-sqx); + if (fxgenid); + + fflush(LOG); + +} /* end of _unur_tdr_gw_debug_sample() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_tdr_gw_debug_split_start( const struct unur_gen *gen, + const struct unur_tdr_interval *iv, + double x, double fx ) + /*----------------------------------------------------------------------*/ + /* write info about splitting interval */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval */ + /* x ... split at this point */ + /* fx ... value of PDF at x */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); + CHECK_NULL(iv,RETURN_VOID); COOKIE_CHECK(iv,CK_TDR_IV,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: split interval at x = %g \t\tf(x) = %g\n",gen->genid,x,fx); + fprintf(LOG,"%s: old interval:\n",gen->genid); + fprintf(LOG,"%s: left construction point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv->x,iv->fx); + fprintf(LOG,"%s: right construction point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv->next->x,iv->next->fx); + fprintf(LOG,"%s: A(squeeze) = %-12.6g\t\t(%6.3f%%)\n",gen->genid, + iv->Asqueeze,iv->Asqueeze*100./GEN->Atotal); + fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g\t\t(%6.3f%%)\n",gen->genid, + (iv->Ahat - iv->Asqueeze),(iv->Ahat - iv->Asqueeze)*100./GEN->Atotal); + fprintf(LOG,"%s: A(hat) = %-12.6g + %-12.6g(%6.3f%%)\n",gen->genid, + iv->Ahat - iv->Ahatr, iv->Ahatr, iv->Ahat*100./GEN->Atotal); + + fflush(LOG); + +} /* end of _unur_tdr_gw_debug_split_start() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_tdr_gw_debug_split_stop( const struct unur_gen *gen, + const struct unur_tdr_interval *iv_left, + const struct unur_tdr_interval *iv_right ) + /*----------------------------------------------------------------------*/ + /* write info about new splitted intervals */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv_left ... pointer to new left hand interval */ + /* iv_right ... pointer to new right hand interval */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); + CHECK_NULL(iv_left,RETURN_VOID); COOKIE_CHECK(iv_left,CK_TDR_IV,RETURN_VOID); + + if (iv_right == NULL) iv_right = iv_left; + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: inserted point:\n",gen->genid); + fprintf(LOG,"%s: x = %g, f(x) = %g, Tf(x)=%g, dTf(x) = %g, squeeze = %g:\n", + gen->genid, iv_right->x, iv_right->fx, iv_right->Tfx, iv_right->dTfx, iv_right->sq); + fprintf(LOG,"%s: new intervals:\n",gen->genid); + fprintf(LOG,"%s: left construction point = %g\n",gen->genid, iv_left->x); + if (iv_left != iv_right) + fprintf(LOG,"%s: middle construction point = %g\n",gen->genid, iv_right->x); + fprintf(LOG,"%s: right construction point = %g\n",gen->genid, iv_right->next->x); + + fprintf(LOG,"%s: left interval:\n",gen->genid); + fprintf(LOG,"%s: A(squeeze) = %-12.6g\t\t(%6.3f%%)\n",gen->genid, + iv_left->Asqueeze, + iv_left->Asqueeze*100./GEN->Atotal); + fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g\t\t(%6.3f%%)\n",gen->genid, + (iv_left->Ahat - iv_left->Asqueeze), + (iv_left->Ahat - iv_left->Asqueeze) * 100./GEN->Atotal); + fprintf(LOG,"%s: A(hat) = %-12.6g + %-12.6g(%6.3f%%)\n",gen->genid, + iv_left->Ahat - iv_left->Ahatr, + iv_left->Ahatr, + iv_left->Ahat * 100./GEN->Atotal); + + if (iv_left == iv_right) + fprintf(LOG,"%s: interval chopped.\n",gen->genid); + else { + fprintf(LOG,"%s: right interval:\n",gen->genid); + fprintf(LOG,"%s: A(squeeze) = %-12.6g\t\t(%6.3f%%)\n",gen->genid, + iv_right->Asqueeze, + iv_right->Asqueeze*100./GEN->Atotal); + fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g\t\t(%6.3f%%)\n",gen->genid, + (iv_right->Ahat - iv_right->Asqueeze), + (iv_right->Ahat - iv_right->Asqueeze) * 100./GEN->Atotal); + fprintf(LOG,"%s: A(hat) = %-12.6g + %-12.6g(%6.3f%%)\n",gen->genid, + iv_right->Ahat - iv_right->Ahatr, + iv_right->Ahatr, + iv_right->Ahat * 100./GEN->Atotal); + } + + fprintf(LOG,"%s: total areas:\n",gen->genid); + fprintf(LOG,"%s: A(squeeze) = %-12.6g\t\t(%6.3f%%)\n",gen->genid, + GEN->Asqueeze, GEN->Asqueeze * 100./GEN->Atotal); + fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g\t\t(%6.3f%%)\n",gen->genid, + GEN->Atotal - GEN->Asqueeze, (GEN->Atotal - GEN->Asqueeze) * 100./GEN->Atotal); + fprintf(LOG,"%s: A(total) = %-12.6g\n",gen->genid, GEN->Atotal); + + fprintf(LOG,"%s:\n",gen->genid); + + fflush(LOG); + +} /* end of _unur_tdr_gw_debug_split_stop() */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/methods/tdr_gw_init.ch b/vendor/unuran-1.11.0/src/methods/tdr_gw_init.ch new file mode 100644 index 0000000..f9cd431 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tdr_gw_init.ch @@ -0,0 +1,591 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tdr_gw_init.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: transformed density rejection * + * * + * DESCRIPTION: * + * Initializing routines for variant of Gilks and Wild. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_tdr_gw_starting_intervals( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* compute intervals for starting points */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tdr_interval *iv, *iv_new, *iv_tmp; + double x,fx; /* construction point, value of PDF at x */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); + CHECK_NULL(GEN->iv,UNUR_ERR_NULL); COOKIE_CHECK(GEN->iv,CK_TDR_IV,UNUR_ERR_COOKIE); + + /* compute paramters for all intervals */ + for( iv=GEN->iv; iv->next != NULL; ) { + + /* compute parameters for interval */ + switch (_unur_tdr_gw_interval_parameter(gen, iv)) { + case UNUR_SUCCESS: /* computation of parameters for interval successful */ + /* skip to next interval */ + iv = iv->next; + continue; + case UNUR_ERR_INF: /* interval unbounded */ + /* split interval */ + break; + case UNUR_ERR_SILENT: /* construction points too close */ + /* we have to remove this last interval from list */ + /* (the last construction point in the list is a boundary point. + thus we might change the domain of the distribution. + however, we only cut off a piece that is beyond the precesion + of the floating point arithmetic.) */ + iv_tmp = iv->next; + iv->next = iv->next->next; + free(iv_tmp); + --(GEN->n_ivs); + + if (iv->next==NULL) { + /* last (virtuel) interval in list. + make shure that we will never use this segment */ + iv->Asqueeze = iv->Ahat = iv->Ahatr = iv->sq = 0.; + iv->Acum = UNUR_INFINITY; + } + else + /* we need a pointer to the previous entry in the list */ + iv->next->prev = iv; + continue; + default: /* PDF not T-concave */ + return UNUR_ERR_GEN_CONDITION; + } + + /* area below hat infinite. + insert new construction point. */ + x = _unur_arcmean(iv->x,iv->next->x); /* use mean point in interval */ + + /* value of PDF at x */ + fx = PDF(x); + + /* add a new interval, but check if we had to used too many intervals */ + if (GEN->n_ivs >= GEN->max_ivs) { + /* we do not want to create too many intervals */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot create bounded hat!"); + return UNUR_ERR_GEN_CONDITION; + } + iv_new = _unur_tdr_interval_new( gen, x, fx, FALSE ); + if (iv_new == NULL) return UNUR_ERR_GEN_DATA; /* PDF(x) < 0 or overflow !! */ + + + /* if fx is 0, then we can cut off the tail of the distribution + (since it must be T-concave) */ + if (fx <= 0.) { + if (iv->fx <= 0.) { + /* cut off left tail */ + iv_new->next = iv->next; + free(iv); + --(GEN->n_ivs); + GEN->iv = iv_new; + iv_new->prev = NULL; + /* compute the parameters for the new left part */ + iv = iv_new; + } + else if (iv->next->fx <= 0.) { + /* cut off right tail */ + free(iv->next); + --(GEN->n_ivs); + iv->next = iv_new; + iv_new->prev = iv; + /* compute the paramters for the new part */ + /* (nothing to do here) */ + } + else { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave!"); + free(iv_new); + return UNUR_ERR_GEN_CONDITION; + } + } + + else { + /* insert new interval into linked list */ + iv_new->prev = iv; + iv_new->next = iv->next; + iv->next->prev = iv_new; + iv->next = iv_new; + } + } + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_tdr_gw_starting_intervals() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_tdr_gw_dars( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* run derandomized adaptive rejection sampling (Gilks&Wild) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tdr_interval *iv, *iv_next; + double Alimit; /* threshhold value for splitting interval */ + double x0, x1; /* boundary of interval */ + double xsp, fxsp; /* splitting point in interval */ + double xAhatl, xAhatr, xAsqueeze; + int rule; /* id for splitting rule that has been applied */ + int n_splitted; /* count splitted intervals */ + int splitted; /* result of splitting routine */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); + + /* now split intervals */ + while ( (GEN->max_ratio * GEN->Atotal > GEN->Asqueeze) && + (GEN->n_ivs < GEN->max_ivs) ) { + + /* compute threshhold value. every interval with area between + hat and squeeze greater than this value will be splitted. */ + if (GEN->n_ivs > 1) + Alimit = GEN->darsfactor * ( (GEN->Atotal - GEN->Asqueeze) / GEN->n_ivs ); + else + /* we split every interval if there are only one interval */ + Alimit = 0.; + + /* reset counter for splitted intervals */ + n_splitted = 0; + + /* for all intervals do ... */ + for (iv = GEN->iv; iv->next != NULL; iv = iv->next ) { + COOKIE_CHECK(iv,CK_TDR_IV,UNUR_ERR_COOKIE); + + /* do not exceed the maximum number of intervals */ + if (GEN->n_ivs >= GEN->max_ivs) + break; + + /* we skip over all intervals where the area between hat and + squeeze does not exceed the threshhold value. */ + if ((iv->Ahat - iv->Asqueeze) <= Alimit) + continue; /* goto next interval */ + + /* store pointer to next interval */ + iv_next = iv->next; + + /* boundary of interval */ + x0 = iv->x; + x1 = iv->next->x; + + /* get splitting point */ + for (rule = GEN->darsrule; rule <= 3; rule++) { + switch (rule) { + case 1: /* rule 1: expected value */ + + if ( _unur_FP_is_minus_infinity(x0) || + _unur_FP_is_infinity(x1) || + _unur_FP_approx(x0,x1) ) + /* we do not use the expected value in case of unbounded intervals */ + continue; /* try next rule */ + + /* l.h.s. hat */ + xAhatl = _unur_tdr_interval_xxarea( gen, iv, iv->dTfx, iv->ip); + /* r.h.s. hat */ + xAhatr = _unur_tdr_interval_xxarea( gen, iv->next, iv->next->dTfx, iv->ip); + /* squeeze */ + if (iv->Asqueeze > 0.) + /* always integrate from point with greater value of transformed density + to the other point */ + xAsqueeze = (iv->Tfx > iv->next->Tfx) + ? _unur_tdr_interval_xxarea( gen, iv, iv->sq, x1) + : _unur_tdr_interval_xxarea( gen, iv->next, iv->sq, x0); + else /* there is no squeeze */ + xAsqueeze = 0.; + + /* check results */ + if (! (_unur_isfinite(xAhatl) && _unur_isfinite(xAhatr) && _unur_isfinite(xAsqueeze)) + || _unur_FP_equal(iv->Ahat,iv->Asqueeze) ) + continue; /* try next rule */ + + /* compute expected value */ + xsp = (xAhatl+xAhatr-xAsqueeze) / (iv->Ahat - iv->Asqueeze); + break; + + case 2: /* rule 2: arcmean */ + xsp = _unur_arcmean(x0,x1); + break; + + case 3: /* rule 3: mean */ + if (_unur_FP_is_minus_infinity(x0) || _unur_FP_is_infinity(x1)) + /* no arithmetic mean for unbounded intervals */ + continue; /* try next rule */ + xsp = 0.5 * (x0 + x1); + break; + + default: /* this should not happen */ + continue; + } + + /* value of PDF at splitting point */ + fxsp = PDF(xsp); + + /* now split interval at given point */ + splitted = _unur_tdr_gw_interval_split(gen, iv, xsp, fxsp); + + if (splitted==UNUR_SUCCESS || splitted==UNUR_ERR_INF) { + /* splitting successful */ + if (splitted==UNUR_SUCCESS) ++n_splitted; + /* otherwise the area below the hat was not bounded */ + + /* now depending on the location of xps in the interval iv, + iv points to the left of the two new intervals, + or to the right of the two new intervals. + For the first case we have to move the pointer to the + new right interval. Then iv will be moved to the next + old interval in the list by the for loop. + We can distinguish between these two cases by looking + at the iv->next pointer and compare it the pointer in the + old unsplitted interval. */ + if (iv->next != iv_next) + iv = iv->next; + /* no more splitting points in this interval */ + break; + } + else if (splitted!=UNUR_ERR_SILENT) { + /* some serious error occurred */ + /* condition for PDF is violated! */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,""); + return UNUR_ERR_GEN_CONDITION; + } + /* else: could not split construction points */ + } + } + + if (n_splitted == 0) { + /* we are not successful in splitting any inteval. + abort to avoid endless loop */ + _unur_warning(gen->genid,UNUR_ERR_GENERIC,"DARS aborted: no intervals could be splitted."); + break; + } + } + + /* ratio between squeeze and hat o.k. ? */ + if ( GEN->max_ratio * GEN->Atotal > GEN->Asqueeze ) { + if ( GEN->n_ivs >= GEN->max_ivs ) + _unur_warning(gen->genid,UNUR_ERR_GENERIC,"DARS aborted: maximum number of intervals exceeded."); + _unur_warning(gen->genid,UNUR_ERR_GENERIC,"hat/squeeze ratio too small."); + } + else { + /* no more construction points */ + GEN->max_ivs = GEN->n_ivs; + } + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_tdr_gw_dars() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_tdr_gw_interval_parameter( struct unur_gen *gen, struct unur_tdr_interval *iv ) + /*----------------------------------------------------------------------*/ + /* compute intersection point of tangents and */ + /* the area below the hat (Gilks & Wild variant) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... if successful */ + /* UNUR_ERR_SILENT ... do not add this construction point */ + /* UNUR_ERR_INF ... area = UNUR_INFINITY */ + /* others ... error (PDF not T-concave) */ + /*----------------------------------------------------------------------*/ +{ + double Ahatl; /* area below hat at left side of intersection point */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); + CHECK_NULL(iv,UNUR_ERR_NULL); COOKIE_CHECK(iv,CK_TDR_IV,UNUR_ERR_COOKIE); + + /* check interval on the right side of iv */ + CHECK_NULL(iv->next,UNUR_ERR_NULL); COOKIE_CHECK(iv->next,CK_TDR_IV,UNUR_ERR_COOKIE); + + /* get intersection point of tangents. + used to partition interval into left hand part (construction point of tangent + on the left hand boundary) and right hand part (construction point of tangent + on the left hand boundary). */ + if ( _unur_tdr_tangent_intersection_point(gen,iv,&(iv->ip))!=UNUR_SUCCESS ) + return UNUR_ERR_GEN_CONDITION; + + /* squeeze and area below squeeze */ + if (iv->Tfx > -UNUR_INFINITY && iv->next->Tfx > -UNUR_INFINITY) { + + /* we do not compute the slope when the construction points + are too close. at least 8 significant digits should remain. */ + if (_unur_FP_approx(iv->x, iv->next->x) ) + return UNUR_ERR_SILENT; /* construction points too close */ + + /* slope of transformed squeeze */ + iv->sq = (iv->next->Tfx - iv->Tfx) / (iv->next->x - iv->x); + + /* check squeeze */ + /* we have to take care about round off error. + the following accepts PDFs with might be a little bit not T_concave */ + if ( ( (iv->sq > iv->dTfx && (!_unur_FP_approx(iv->sq,iv->dTfx)) ) || + (iv->sq < iv->next->dTfx && (!_unur_FP_approx(iv->sq,iv->next->dTfx)) ) ) + && iv->next->dTfx < UNUR_INFINITY ) { + /* There are big troubles when the density is extremely small. + Then round-off errors may cancel out all significant figures and + 0 remains. Thus we simply ignore all violations when the + slope of the squeeze or tangent is 0. */ + if ( !_unur_iszero(iv->sq) && !_unur_iszero(iv->dTfx) && !_unur_iszero(iv->next->dTfx) ) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"Squeeze too steep/flat. PDF not T-concave!"); + return UNUR_ERR_GEN_CONDITION; + } + } + + /* volume below squeeze */ + /* always integrate from point with greater value of transformed density + to the other point */ + iv->Asqueeze = (iv->Tfx > iv->next->Tfx) + ? _unur_tdr_interval_area( gen, iv, iv->sq, iv->next->x) + : _unur_tdr_interval_area( gen, iv->next, iv->sq, iv->x); + + /* check for fatal numerical errors */ + if (!_unur_isfinite(iv->Asqueeze)) + iv->Asqueeze = 0.; + + } + else { /* no squeeze */ + iv->sq = 0.; + iv->Asqueeze = 0.; + } + + /* volume below hat */ + Ahatl = _unur_tdr_interval_area( gen, iv, iv->dTfx, iv->ip); + iv->Ahatr = _unur_tdr_interval_area( gen, iv->next, iv->next->dTfx, iv->ip); + + /* areas below head unbounded ? */ + if (! (_unur_isfinite(Ahatl) && _unur_isfinite(iv->Ahatr)) ) + return UNUR_ERR_INF; + + /* total area */ + iv->Ahat = iv->Ahatr + Ahatl; + + /* check area */ + /* we cannot be more accurate than in the `check squeeze' section */ + if ( iv->Asqueeze > iv->Ahat && !(_unur_FP_approx(iv->Asqueeze, iv->Ahat)) ) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"A(squeeze) > A(hat). PDF not T-concave!"); + return UNUR_ERR_GEN_CONDITION; + } + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_tdr_gw_interval_parameter() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_tdr_gw_interval_split( struct unur_gen *gen, struct unur_tdr_interval *iv_oldl, double x, double fx ) + /*----------------------------------------------------------------------*/ + /* split interval iv_oldl into two intervals at point x */ + /* old interval -> left hand side */ + /* new interval -> right hand side */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv_oldl ... pointer to interval */ + /* x ... left point of new segment */ + /* fx ... value of PDF at x */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... if successful */ + /* UNUR_ERR_SILENT ... if no intervals are splitted */ + /* others ... error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tdr_interval *iv_newr; /* pointer to new interval */ + struct unur_tdr_interval iv_bak; /* space for backing up data of interval */ + int success, success_r; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); + CHECK_NULL(iv_oldl,UNUR_ERR_NULL); COOKIE_CHECK(iv_oldl,CK_TDR_IV,UNUR_ERR_COOKIE); + + /* we cannot split point when x is not finite (NaN or Infinity) */ + if (!_unur_isfinite(x)) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"splitting point not finite (skipped)"); + return UNUR_ERR_SILENT; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & TDR_DEBUG_SPLIT) + _unur_tdr_gw_debug_split_start( gen,iv_oldl,x,fx ); +#endif + + /* the splitting point must be inside the interval */ + if (x < iv_oldl->x || x > iv_oldl->next->x) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"splitting point not in interval!"); + return UNUR_ERR_SILENT; + } + + /* we only add a new construction point, if the relative area is large enough */ + if ( (GEN->n_ivs * (iv_oldl->Ahat - iv_oldl->Asqueeze) / (GEN->Atotal - GEN->Asqueeze)) + < GEN->bound_for_adding) + return UNUR_ERR_SILENT; + + /* check for data error */ + if (fx < 0.) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) < 0.!"); + return UNUR_ERR_GEN_DATA; + } + + /* back up data */ + memcpy(&iv_bak, iv_oldl, sizeof(struct unur_tdr_interval)); + + /* check if the new interval is completely outside the support of PDF */ + if (fx <= 0.) { + + /* one of the two boundary points must be 0, too! */ + if (iv_oldl->fx <= 0.) { + /* chop off left part (it's out of support) */ + iv_oldl->x = x; + } + else if (iv_oldl->next->fx <= 0.) { + /* chop off right part (it's out of support) */ + iv_oldl->next->x = x; + } + else { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave"); + return UNUR_ERR_GEN_CONDITION; + } + + /* compute parameters for chopped interval */ + success = _unur_tdr_gw_interval_parameter(gen, iv_oldl); + + /* we did not add a new interval */ + iv_newr = NULL; + } + + else { + + /* we need a new interval */ + iv_newr = _unur_tdr_interval_new( gen, x, fx, FALSE ); + if (iv_newr == NULL) { + /* PDF(x) < 0 or overflow !! */ + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + } + + /* insert into linked list */ + iv_newr->prev = iv_oldl; + iv_newr->next = iv_oldl->next; + iv_oldl->next->prev = iv_newr; + iv_oldl->next = iv_newr; + + /* compute parameters for interval */ + success = _unur_tdr_gw_interval_parameter(gen, iv_oldl); + success_r = _unur_tdr_gw_interval_parameter(gen, iv_newr); + + /* worst of success and success_r */ + if (success_r!=UNUR_SUCCESS) + if ((success_r!=UNUR_ERR_SILENT&&success_r!=UNUR_ERR_INF) || + (success==UNUR_SUCCESS||success==UNUR_ERR_SILENT||success==UNUR_ERR_INF)) + success = success_r; + } + + /* successfull ? */ + if (success!=UNUR_SUCCESS) { + /* cannot split interval at given point */ + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"Cannot split interval at given point."); + if (success!=UNUR_ERR_SILENT && success!=UNUR_ERR_INF) + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave"); + + /* the case of unbounded hat is treated as round-off error for + very steep tangents. so we simply do not add this construction point. */ + + /* restore old interval */ + memcpy(iv_oldl, &iv_bak, sizeof(struct unur_tdr_interval)); + /* remove from linked list; remaines to restore prev pointer in next interval */ + if (iv_oldl->next) + iv_oldl->next->prev = iv_oldl; + + /* decrement counter for intervals and free unused interval */ + if (iv_newr) { + --(GEN->n_ivs); + free( iv_newr ); + } + + return success; + } + + /* successful */ + + /* update total area below hat and squeeze */ + GEN->Atotal = ( GEN->Atotal - iv_bak.Ahat + + iv_oldl->Ahat + ((iv_newr) ? iv_newr->Ahat : 0.) ); + GEN->Asqueeze = ( GEN->Asqueeze - iv_bak.Asqueeze + + iv_oldl->Asqueeze + ((iv_newr) ? iv_newr->Asqueeze : 0. ) ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & TDR_DEBUG_SPLIT) + _unur_tdr_gw_debug_split_stop( gen,iv_oldl,iv_newr ); +#endif + + /* when using inside Gibbs sampler Atotal might be 0 */ + if (GEN->Atotal <= 1.e10 * DBL_MIN) { + _unur_error(gen->genid,UNUR_ERR_ROUNDOFF,"error below hat (almost) 0"); + return UNUR_ERR_ROUNDOFF; + } + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_tdr_gw_interval_split() */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/methods/tdr_gw_sample.ch b/vendor/unuran-1.11.0/src/methods/tdr_gw_sample.ch new file mode 100644 index 0000000..40ba918 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tdr_gw_sample.ch @@ -0,0 +1,550 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tdr_gw_sample.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: transformed density rejection * + * * + * DESCRIPTION: * + * Sampling routines for variant of Gilks and Wild. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Sampling routines **/ +/*****************************************************************************/ + +double +_unur_tdr_gw_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator (original variant by Gilks & Wild) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /* */ + /*======================================================================*/ + /* comment: */ + /* x ... random point */ + /* x0 ... left construction point in interval */ + /* x1 ... right construction point in interval */ + /* f ... PDF */ + /* Tf ... transformed PDF */ + /* dTf ... derivative of transformed PDF */ + /* sq ... slope of squeeze in interval */ + /* */ + /*----------------------------------------------------------------------*/ + /* if (Tf)'(x0) == 0: */ + /* X = x0 + U / f(x0) */ + /* U ~ U(0,area below hat) */ + /* */ + /*----------------------------------------------------------------------*/ + /* log(x): */ + /* squeeze(x) = f(x0) * exp(sq * (x-x0)) */ + /* */ + /* left hat(x) = f(x0) * exp( (Tf)'(x0) * (x-x0) ) */ + /* generation: */ + /* X = x0 + 1/(Tf)'(x0) * \log( (Tf)'(x0)/f(x0) * U + 1 ) */ + /* U ~ U(0,area below left hat) */ + /* */ + /* right hat(x) = f(x1) * exp( (Tf)'(x1) * (x-x1) ) */ + /* generation: */ + /* X = x1 + 1/(Tf)'(x1) * \log( (Tf)'(x1)/f(x1) * U + 1 ) */ + /* U ~ U(- area below right hat,0) */ + /*----------------------------------------------------------------------*/ + /* T(x) = -1/sqrt(x): */ + /* */ + /* squeeze(x) = 1 / (Tf(x0) + sq * (x-x0))^2 */ + /* */ + /* left hat(x) = 1 / (Tf(x0) + (Tf)'(x0) * (x-x0))^2 */ + /* generation: */ + /* X = x0 + (Tf(x0)^2 * U) / (1 - Tf(x0) * (Tf)'(x0) * U) */ + /* U ~ U(0,area below left hat) */ + /* */ + /* right hat(x) = 1 / (Tf(x1) + (Tf)'(x1) * (x-x1))^2 */ + /* generation: */ + /* X = x1 + (Tf(x1)^2 * U) / (1 - Tf(x1) * (Tf)'(x1) * U) */ + /* U ~ U(- area below right hat,0) */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng; /* pointer to uniform random number generator */ + struct unur_tdr_interval *iv, *pt; + double U, V; /* uniform random number */ + double X; /* generated point */ + double fx, sqx, hx; /* values of density, squeeze, and hat at X */ + double Tsqx, Thx; /* values of transformed squeeze and hat at X */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); + + if (GEN->iv == NULL) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"empty generator object"); + return UNUR_INFINITY; + } + + /* main URNG */ + urng = gen->urng; + + while (1) { + + /* sample from U( Umin, Umax ) */ + U = GEN->Umin + _unur_call_urng(urng) * (GEN->Umax - GEN->Umin); + + /* look up in guide table and search for segment */ + iv = GEN->guide[(int) (U * GEN->guide_size)]; + U *= GEN->Atotal; + while (iv->Acum < U) { + iv = iv->next; + } + + /* reuse of uniform random number */ + U -= iv->Acum; /* result: U in (-A_hat, 0) */ + + /* left or right side of hat */ + if (-U < iv->Ahatr) { /* right */ + pt = iv->next; + /* u unchanged */ + } + else { /* left */ + pt = iv; + U += iv->Ahat; + } + + /* we have three different types of transformations */ + switch (gen->variant & TDR_VARMASK_T) { + + case TDR_VAR_T_LOG: + /* random variate */ + if (_unur_iszero(pt->dTfx)) + X = pt->x + U / pt->fx; + else + { + double t = pt->dTfx * U / pt->fx; + if (fabs(t) > 1.e-6) + X = pt->x + log(t + 1.) * U / (pt->fx * t); + /* x = pt->x + log(t + 1.) / pt->dTfx; is cheaper but numerical unstable */ + else if (fabs(t) > 1.e-8) + /* use Taylor series */ + X = pt->x + U / pt->fx * (1 - t/2. + t*t/3.); + else + X = pt->x + U / pt->fx * (1 - t/2.); + } + + /* accept or reject */ + hx = pt->fx * exp(pt->dTfx*(X - pt->x)); /* value of hat at x */ + V = _unur_call_urng(urng) * hx; /* a random point between 0 and hat at x */ + + /* below mininum of density in interval ? */ + if (V <= iv->fx && V <= iv->next->fx) + return X; + + /* below squeeze ? */ + sqx = (iv->Asqueeze > 0.) ? iv->fx * exp(iv->sq*(X - iv->x)) : 0.; /* value of squeeze at x */ + if (V <= sqx) + return X; + + break; + + case TDR_VAR_T_SQRT: + /* random variate */ + if (_unur_iszero(pt->dTfx)) + X = pt->x + U /pt->fx; + else { + /* it would be less expensive to use: + X = pt->x + pt->Tfx/pt->dTfx * (1. - 1./(1. + pt->dTfx * pt->Tfx * U) ) + however, this is unstable for small pt->dTfx */ + X = pt->x + (pt->Tfx*pt->Tfx*U) / (1.-pt->Tfx*pt->dTfx*U); + /* It cannot happen, that the denominator becomes 0 ! */ + } + + /* accept or reject */ + Thx = pt->Tfx + pt->dTfx * (X - pt->x); /* transformed hat at x */ + hx = 1./(Thx*Thx); + V = _unur_call_urng(urng) * hx; /* a random point between 0 and hat at x */ + + /* below mininum of density in interval ? */ + if (V <= iv->fx && V <= iv->next->fx) + return X; + + /* below squeeze ? */ + Tsqx = (iv->Asqueeze > 0.) ? (iv->Tfx + iv->sq * (X - iv->x)) : -UNUR_INFINITY; /* transformed squeeze at x */ + sqx = (iv->Asqueeze > 0.) ? 1./(Tsqx*Tsqx) : 0.; + if (V <= sqx) + return X; + + break; + + case TDR_VAR_T_POW: + /** TODO **/ + + default: + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_INFINITY; + + } /* end switch */ + + /* value of PDF at x */ + fx = PDF(X); + /** TODO: for the changing parameter case it would be better + not to added the new construction point when we accept + the generated point! **/ + + /* being above squeeze is bad. improve the situation! */ + if (GEN->n_ivs < GEN->max_ivs) { + if ( (_unur_tdr_gw_improve_hat( gen, iv, X, fx) != UNUR_SUCCESS) + && (gen->variant & TDR_VARFLAG_PEDANTIC) ) + return UNUR_INFINITY; + } + + if (V <= fx) + /* between PDF and squeeze */ + return X; + + /* else reject and try again */ + + /* use the auxilliary generator the next time + (it can be the same as the main generator) */ + urng = gen->urng_aux; + + } + +} /* end of _unur_tdr_gw_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_tdr_gw_sample_check( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator and verify results */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng; /* pointer to uniform random number generator */ + struct unur_tdr_interval *iv, *pt; + double U, V; /* uniform random number */ + double X; /* generated point */ + double fx, sqx, hx; /* value of density, squeeze, and hat at X */ +#ifdef UNUR_ENABLE_LOGGING + int error = 0; /* indicates error */ +#endif + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); + + if (GEN->iv == NULL) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"empty generator object"); + return UNUR_INFINITY; + } + + /* main URNG */ + urng = gen->urng; + + while (1) { + + /* sample from U( Umin, Umax ) */ + U = GEN->Umin + _unur_call_urng(urng) * (GEN->Umax - GEN->Umin); + + /* evaluate inverse of hat CDF */ + X = _unur_tdr_gw_eval_invcdfhat( gen, U, &hx, &fx, &sqx, &iv, &pt ); + + /* check result */ + if (X < DISTR.BD_LEFT || X > DISTR.BD_RIGHT) { + _unur_warning(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,"generated point out of domain"); +#ifdef UNUR_ENABLE_LOGGING + error = 1; +#endif + } + if (_unur_FP_greater(fx,hx)) { + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF > hat. Not T-concave!"); +#ifdef UNUR_ENABLE_LOGGING + error = 1; +#endif + } + if (_unur_FP_less(fx,sqx)) { + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF < squeeze. Not T-concave!"); +#ifdef UNUR_ENABLE_LOGGING + error = 1; +#endif + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file (in case error) */ + if (error && (gen->debug & TDR_DEBUG_SAMPLE)) + _unur_tdr_gw_debug_sample( gen, iv, pt, X, fx, hx, sqx ); +#endif + + /* accept or reject */ + V = _unur_call_urng(urng) * hx; /* a random point between 0 and hat at X */ + + /* below mininum of density in interval ? */ + if (V <= iv->fx && V <= iv->next->fx) + return X; + + /* below squeeze ? */ + if (V <= sqx) + return X; + + /* being above squeeze is bad. improve the situation! */ + if (GEN->n_ivs < GEN->max_ivs) { + if ( (_unur_tdr_gw_improve_hat( gen, iv, X, fx) != UNUR_SUCCESS) + && (gen->variant & TDR_VARFLAG_PEDANTIC) ) + return UNUR_INFINITY; + } + + if (V <= fx) + /* between PDF and squeeze */ + return X; + + /* reject and try again */ + + /* use the auxilliary generator the next time + (it can be the same as the main generator) */ + urng = gen->urng_aux; + + } + +} /* end of _unur_tdr_gw_sample_check() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_tdr_gw_eval_invcdfhat( const struct unur_gen *gen, double U, + double *hx, double *fx, double *sqx, + struct unur_tdr_interval **ivl, + struct unur_tdr_interval **cpt ) + /*----------------------------------------------------------------------*/ + /* evaluate the inverse of the hat CDF at u */ + /* (original variant by Gilks & Wild) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* U ... argument for inverse CDF (0<=U<=1, no validation!) */ + /* hx ... pointer for storing hat at sampled X */ + /* fx ... pointer for storing squeeze at sampled X */ + /* sqx ... pointer for storing density at sampled X */ + /* ivl ... pointer to interval for hat */ + /* cpt ... pointer to interval where hat construction point is stored */ + /* */ + /* return: */ + /* inverse hat CDF. */ + /* */ + /* values of hat, density, squeeze (computation is suppressed if */ + /* corresponding pointer is NULL). */ + /* */ + /* ivl and cpt can be NULL. then no pointers are stored. */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tdr_interval *iv, *pt; /* pointer to intervals */ + double X; /* inverse of hat CDF at U */ + double Tsqx, Thx; /* transformed hat and squeeze */ + double t; /* aux variable */ + + /** -1- Compute inverse of hat CDF at U **/ + + /* look up in guide table and search for interval */ + iv = GEN->guide[(int) (U * GEN->guide_size)]; + U *= GEN->Atotal; + while (iv->Acum < U) { + iv = iv->next; + } + + /* transform u such that u in (-A_hat, 0) */ + /* (reuse of uniform random number) */ + U -= iv->Acum; + + /* left or right hand side of hat */ + if (-U < iv->Ahatr) { /* r.h.s. */ + pt = iv->next; + /* U unchanged */ + } + else { /* l.h.s. */ + pt = iv; + U += iv->Ahat; + } + + /* we have three different types of transformations */ + switch (gen->variant & TDR_VARMASK_T) { + + case TDR_VAR_T_LOG: + /* inverse of CDF (random variate) */ + if (_unur_iszero(pt->dTfx)) + X = pt->x + U / pt->fx; + else { + t = pt->dTfx * U / pt->fx; + if (fabs(t) > 1.e-6) + X = pt->x + log(t + 1.) * U / (pt->fx * t); + /* x = pt->x + log(t + 1.) / pt->dTfx; is cheaper but numerical unstable */ + else if (fabs(t) > 1.e-8) + /* use Taylor series */ + X = pt->x + U / pt->fx * (1 - t/2. + t*t/3.); + else + X = pt->x + U / pt->fx * (1 - t/2.); + } + break; + + case TDR_VAR_T_SQRT: + /* inverse of CDF (random variate) */ + if (_unur_iszero(pt->dTfx)) + X = pt->x + U / (pt->fx); + else { + /* it would be less expensive to use: + X = pt->x + pt->Tfx/(pt->dTfx) * (1. - 1./(1. + pt->dTfx * pt->Tfx * U) ) + however, this is unstable for small pt->dTfx */ + X = pt->x + (pt->Tfx*(pt->Tfx)*U) / (1.-(pt->Tfx)*(pt->dTfx)*U); + /* It cannot happen, that the denominator becomes 0 ! */ + } + break; + + case TDR_VAR_T_POW: + /** TODO **/ + + default: + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + X = UNUR_INFINITY; + + } /* end switch */ + + /** -2- Evaluate hat at X **/ + + if (hx != NULL) { + switch (gen->variant & TDR_VARMASK_T) { + case TDR_VAR_T_LOG: + *hx = pt->fx * exp(pt->dTfx*(X - pt->x)); + break; + case TDR_VAR_T_SQRT: + Thx = pt->Tfx + pt->dTfx * (X - pt->x); /* transformed hat at x */ + *hx = 1./(Thx*Thx); + break; + case TDR_VAR_T_POW: + /** TODO **/ + default: + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + *hx = UNUR_INFINITY; + } + } + + /** -3- Evaluate density at X **/ + if (fx != NULL) { + *fx = PDF(X); + } + + /** -4- Evaluate squeeze at X **/ + if (sqx != NULL) { + switch (gen->variant & TDR_VARMASK_T) { + case TDR_VAR_T_LOG: + *sqx = (iv->Asqueeze > 0.) ? iv->fx * exp(iv->sq*(X - iv->x)) : 0.; + break; + case TDR_VAR_T_SQRT: + if (iv->Asqueeze > 0.) { + Tsqx = iv->Tfx + iv->sq * (X - iv->x); + *sqx = 1./(Tsqx*Tsqx); + } + else + *sqx = 0.; + break; + case TDR_VAR_T_POW: + /** TODO **/ + default: /* this should not happen */ + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + *sqx = 0.; + } + } + + + /* store interval pointer */ + if (ivl) *ivl = iv; + if (cpt) *cpt = pt; + + /* o.k. */ + return X; + +} /* end of _unur_tdr_gw_eval_invcdfhat() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_tdr_gw_improve_hat( struct unur_gen *gen, struct unur_tdr_interval *iv, + double x, double fx ) + /*----------------------------------------------------------------------*/ + /* improve hat function by splitting interval */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval that has to be split */ + /* x ... splitting point */ + /* fx ... value of PDF at splitting point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... improving hat successful */ + /* others ... error: PDF not monotone in interval */ + /*----------------------------------------------------------------------*/ +{ + int result; + + /* is there any reason to improve hat ? */ + if (! (GEN->max_ratio * GEN->Atotal > GEN->Asqueeze) ) { + /* no more construction points (avoid calling this function any more) */ + GEN->max_ivs = GEN->n_ivs; + return UNUR_SUCCESS; + } + + /* add construction point */ + result = _unur_tdr_gw_interval_split(gen, iv, x, fx); + if (result!=UNUR_SUCCESS && result!=UNUR_ERR_SILENT && result!=UNUR_ERR_INF) { + /* condition for PDF is violated! */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,""); + if (gen->variant & TDR_VARFLAG_PEDANTIC || result == UNUR_ERR_ROUNDOFF) { + /* replace sampling routine by dummy routine that just returns UNUR_INFINITY */ + SAMPLE = _unur_sample_cont_error; + return UNUR_ERR_GEN_CONDITION; + } + } + + /* splitting successful --> update guide table */ + /** TODO: it is not necessary to update the guide table every time. + But then (1) some additional bookkeeping is required and + (2) the guide table method requires a acc./rej. step. **/ + _unur_tdr_make_guide_table(gen); + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_tdr_gw_improve_hat() */ + +/*****************************************************************************/ diff --git a/vendor/unuran-1.11.0/src/methods/tdr_ia_sample.ch b/vendor/unuran-1.11.0/src/methods/tdr_ia_sample.ch new file mode 100644 index 0000000..d8a0e01 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tdr_ia_sample.ch @@ -0,0 +1,406 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tdr_ia_sample.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: transformed density rejection * + * * + * DESCRIPTION: * + * Sampling routines for variant with proportional squeezes and * + * immediate acceptance. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Sampling routines **/ +/*****************************************************************************/ + +double +_unur_tdr_ia_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator (immediate acceptance) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /* */ + /*======================================================================*/ + /* comment: */ + /* x ... random point */ + /* x0 ... left construction point in interval */ + /* x1 ... right construction point in interval */ + /* f ... PDF */ + /* Tf ... transformed PDF */ + /* dTf ... derivative of transformed PDF */ + /* sq ... slope of squeeze in interval */ + /* */ + /*----------------------------------------------------------------------*/ + /* if (Tf)'(x0) == 0: */ + /* X = x0 + U / f(x0) */ + /* U ~ U(0,area below hat) */ + /* */ + /*----------------------------------------------------------------------*/ + /* log(x): */ + /* */ + /* hat(x) = f(x0) * exp( (Tf)'(x0) * (x-x0) ) */ + /* generation: */ + /* X = x0 + 1/(Tf)'(x0) * \log( (Tf)'(x0)/f(x0) * U + 1 ) */ + /* U ~ U(-area below left hat, area below left hat) */ + /* */ + /*----------------------------------------------------------------------*/ + /* T(x) = -1/sqrt(x): */ + /* */ + /* hat(x) = 1 / (Tf(x0) + (Tf)'(x0) * (x-x0))^2 */ + /* generation: */ + /* X = x0 + (Tf(x0)^2 * U) / (1 - Tf(x0) * (Tf)'(x0) * U) */ + /* U ~ U(-area below left hat, area below left hat) */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng; /* pointer to uniform random number generator */ + struct unur_tdr_interval *iv; + int use_ia; + double U, V, X; + double fx, hx, Thx; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); + + if (GEN->iv == NULL) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"empty generator object"); + return UNUR_INFINITY; + } + + /* main URNG */ + urng = gen->urng; + + while (1) { + + /* sample from U(0,1) */ + U = _unur_call_urng(urng); + + /* look up in guide table and search for segment */ + iv = GEN->guide[(int) (U * GEN->guide_size)]; + U *= GEN->Atotal; + while (iv->Acum < U) { + iv = iv->next; + } + + /* reuse of uniform random number */ + U -= iv->Acum; /* result: U in (-A_hat,0) */ + + /* check for region of immediate acceptance */ + if (U >= - iv->sq * iv->Ahat) { + /* region of immediate acceptance */ + U /= iv->sq; + use_ia = 1; + } + else { + /* rejection from region between hat and squeeze */ + U = (U + iv->sq * iv->Ahat) / (1. - iv->sq); + use_ia = 0; + } + /* result: U in (-A_hat,0) */ + + /* U in (-A_hatl, A_hatr) */ + U += iv->Ahatr; + + /* generate from hat distribution */ + switch (gen->variant & TDR_VARMASK_T) { + + case TDR_VAR_T_LOG: + if (_unur_iszero(iv->dTfx)) + X = iv->x + U / iv->fx; + else { + double t = iv->dTfx * U / iv->fx; + if (fabs(t) > 1.e-6) + /* x = iv->x + log(t + 1.) / iv->dTfx; is cheaper but numerical unstable */ + X = iv->x + log(t + 1.) * U / (iv->fx * t); + else if (fabs(t) > 1.e-8) + /* use Taylor series */ + X = iv->x + U / iv->fx * (1 - t/2. + t*t/3.); + else + X = iv->x + U / iv->fx * (1 - t/2.); + } + break; + + case TDR_VAR_T_SQRT: + if (_unur_iszero(iv->dTfx)) + X = iv->x + U /iv->fx; + else { + U *= iv->Tfx; /* avoid one multiplication */ + X = iv->x + (iv->Tfx * U) / (1. - iv->dTfx * U); + /* It cannot happen, that the denominator becomes 0 ! */ + } + break; + + case TDR_VAR_T_POW: + /** TODO **/ + return 1.; + break; + + default: + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return 1.; + + } /* end switch */ + + /* immedate acceptance */ + if (use_ia) + return X; + + /* evaluate hat at X */ + switch (gen->variant & TDR_VARMASK_T) { + case TDR_VAR_T_LOG: + hx = iv->fx * exp(iv->dTfx*(X - iv->x)); break; + case TDR_VAR_T_SQRT: + Thx = iv->Tfx + iv->dTfx * (X - iv->x); /* transformed hat at X */ + hx = 1./(Thx*Thx); break; + case TDR_VAR_T_POW: + default: + /** TODO **/ + return 1.; + } /* end switch */ + + /* from now on we use the auxilliary generator + (it can be the same as the main generator) */ + urng = gen->urng_aux; + + /* rejection from region between hat and (proportional) squeeze */ + V = _unur_call_urng(urng); + + /* get uniform random number between squeeze(X) and hat(X) */ + V = (iv->sq + (1 - iv->sq) * V) * hx; + + /* evaluate PDF at X */ + fx = PDF(X); + + /* main rejection */ + if (V <= fx) + return X; + + /* being above squeeze is bad. improve the situation! */ + if (GEN->n_ivs < GEN->max_ivs) { + if ( (_unur_tdr_ps_improve_hat( gen, iv, X, fx) != UNUR_SUCCESS) + && (gen->variant & TDR_VARFLAG_PEDANTIC) ) + return UNUR_INFINITY; + } + + /* else reject and try again */ + } + +} /* end of _unur_tdr_ia_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_tdr_ia_sample_check( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator and verify results (immediate acceptance) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /* */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng; /* pointer to uniform random number generator */ + struct unur_tdr_interval *iv; + int use_ia; + double U, V, X; + double fx, hx, Thx, sqx; +#ifdef UNUR_ENABLE_LOGGING + int error = 0; +#endif + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); + + if (GEN->iv == NULL) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"empty generator object"); + return UNUR_INFINITY; + } + + /* main URNG */ + urng = gen->urng; + + while (1) { + + /* sample from U(0,1) */ + U = _unur_call_urng(urng); + + /* look up in guide table and search for segment */ + iv = GEN->guide[(int) (U * GEN->guide_size)]; + U *= GEN->Atotal; + while (iv->Acum < U) { + iv = iv->next; + } + + /* reuse of uniform random number */ + U -= iv->Acum; /* result: U in (-A_hat,0) */ + + /* check for region of immediate acceptance */ + if (U >= - iv->sq * iv->Ahat) { + /* region of immediate acceptance */ + U /= iv->sq; + use_ia = 1; + } + else { + /* rejection from region between hat and squeeze */ + U = (U + iv->sq * iv->Ahat) / (1. - iv->sq); + use_ia = 0; + } + /* result: U in (-A_hat,0) */ + + /* U in (-A_hatl, A_hatr) */ + U += iv->Ahatr; + + /* generate from hat distribution */ + switch (gen->variant & TDR_VARMASK_T) { + + case TDR_VAR_T_LOG: + if (_unur_iszero(iv->dTfx)) + X = iv->x + U / iv->fx; + else { + double t = iv->dTfx * U / iv->fx; + if (fabs(t) > 1.e-6) + /* x = iv->x + log(t + 1.) / iv->dTfx; is cheaper but numerical unstable */ + X = iv->x + log(t + 1.) * U / (iv->fx * t); + else if (fabs(t) > 1.e-8) + /* use Taylor series */ + X = iv->x + U / iv->fx * (1 - t/2. + t*t/3.); + else + X = iv->x + U / iv->fx * (1 - t/2.); + } + break; + + case TDR_VAR_T_SQRT: + if (_unur_iszero(iv->dTfx)) + X = iv->x + U /iv->fx; + else { + U *= iv->Tfx; /* avoid one multiplication */ + X = iv->x + (iv->Tfx * U) / (1. - iv->dTfx * U); + /* It cannot happen, that the denominator becomes 0 ! */ + } + break; + + case TDR_VAR_T_POW: + /** TODO **/ + return 1.; + break; + + default: + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return 1.; + + } /* end switch */ + + /* evaluate hat at X */ + switch (gen->variant & TDR_VARMASK_T) { + case TDR_VAR_T_LOG: + hx = iv->fx * exp(iv->dTfx*(X - iv->x)); break; + case TDR_VAR_T_SQRT: + Thx = iv->Tfx + iv->dTfx * (X - iv->x); /* transformed hat at X */ + hx = 1./(Thx*Thx); break; + case TDR_VAR_T_POW: + default: + /** TODO **/ + return 1.; + } /* end switch */ + + /* evaluate PDF at X */ + fx = PDF(X); + + /* evaluate squeeze */ + sqx = iv->sq*hx; + + /* check result */ + if (_unur_FP_less(X, DISTR.BD_LEFT) || _unur_FP_greater(X, DISTR.BD_RIGHT) ) { + _unur_warning(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,"generated point out of domain"); +#ifdef UNUR_ENABLE_LOGGING + error = 1; +#endif + } + if (_unur_FP_greater(fx, hx)) { + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF > hat. Not T-concave!"); +#ifdef UNUR_ENABLE_LOGGING + error = 1; +#endif + } + if (_unur_FP_less(fx, sqx)) { + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF < squeeze. Not T-concave!"); +#ifdef UNUR_ENABLE_LOGGING + error = 1; +#endif + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file (in case error) */ + if (error && (gen->debug & TDR_DEBUG_SAMPLE)) + _unur_tdr_ps_debug_sample( gen, iv, X, fx, hx, sqx ); +#endif + + /* immedate acceptance */ + if (use_ia) + return X; + + /* from now on we use the auxilliary generator + (it can be the same as the main generator) */ + urng = gen->urng_aux; + + /* rejection from region between hat and (proportional) squeeze */ + V = _unur_call_urng(urng); + + /* get uniform random number between squeeze(X) and hat(X) */ + V = (iv->sq + (1 - iv->sq) * V) * hx; + + /* main rejection */ + if (V <= fx) + return X; + + /* being above squeeze is bad. improve the situation! */ + if (GEN->n_ivs < GEN->max_ivs) { + if ( (_unur_tdr_ps_improve_hat( gen, iv, X, fx) != UNUR_SUCCESS) + && (gen->variant & TDR_VARFLAG_PEDANTIC) ) + return UNUR_INFINITY; + } + + /* else reject and try again */ + } + +} /* end of _unur_tdr_ia_sample_check() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/tdr_info.ch b/vendor/unuran-1.11.0/src/methods/tdr_info.ch new file mode 100644 index 0000000..53efc16 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tdr_info.ch @@ -0,0 +1,184 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tdr_info.ch * + * * + * TYPE: continuous univariate random variate * + * METHOD: transformed density rejection * + * * + * DESCRIPTION: * + * Routines for creating info strings. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_tdr_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = PDF dPDF\n"); + _unur_string_append(info," domain = (%g, %g)", DISTR.trunc[0],DISTR.trunc[1]); + if (gen->distr->set & UNUR_DISTR_SET_TRUNCATED) { + _unur_string_append(info," [truncated from (%g, %g)]", DISTR.domain[0],DISTR.domain[1]); + } + _unur_string_append(info,"\n"); + _unur_string_append(info," center = %g", unur_distr_cont_get_center(distr)); + if ( !(distr->set & UNUR_DISTR_SET_CENTER) ) { + if ( distr->set & UNUR_DISTR_SET_MODE ) + _unur_string_append(info," [= mode]\n"); + else + _unur_string_append(info," [default]\n"); + } + else { + _unur_string_append(info,"\n"); + } + + if (help) { + if ( !(distr->set & (UNUR_DISTR_SET_CENTER | UNUR_DISTR_SET_MODE )) ) + _unur_string_append(info,"\n[ Hint: %s ]\n", + "You may provide a point near the mode as \"center\"."); + } + _unur_string_append(info,"\n"); + + /* method */ + _unur_string_append(info,"method: TDR (Transformed Density Rejection)\n"); + _unur_string_append(info," variant = "); + switch (gen->variant & TDR_VARMASK_VARIANT) { + case TDR_VARIANT_GW: + _unur_string_append(info,"GW (original Gilks & Wild)\n"); break; + case TDR_VARIANT_PS: + _unur_string_append(info,"PS (proportional squeeze)\n"); break; + case TDR_VARIANT_IA: + _unur_string_append(info,"IA (immediate acceptance)\n"); break; + } + /* used transformation */ + _unur_string_append(info," T_c(x) = "); + switch( gen->variant & TDR_VARMASK_T ) { + case TDR_VAR_T_LOG: + _unur_string_append(info,"log(x) ... c = 0\n"); break; + case TDR_VAR_T_SQRT: + _unur_string_append(info,"-1/sqrt(x) ... c = -1/2\n"); break; + case TDR_VAR_T_POW: + _unur_string_append(info,"-x^(%g) ... c = %g\n",GEN->c_T,GEN->c_T); break; + } + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," area(hat) = %g\n", GEN->Atotal); + + _unur_string_append(info," rejection constant "); + if (distr->set & UNUR_DISTR_SET_PDFAREA) + _unur_string_append(info,"= %g\n", GEN->Atotal/DISTR.area); + else + _unur_string_append(info,"<= %g\n", GEN->Atotal/GEN->Asqueeze); + + _unur_string_append(info," area ratio squeeze/hat = %g\n", + GEN->Asqueeze/GEN->Atotal); + + _unur_string_append(info," # intervals = %d\n", GEN->n_ivs); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + switch (gen->variant & TDR_VARMASK_VARIANT) { + case TDR_VARIANT_GW: + _unur_string_append(info," variant_gw = on\n"); break; + case TDR_VARIANT_PS: + _unur_string_append(info," variant_ps = on [default]\n"); break; + case TDR_VARIANT_IA: + _unur_string_append(info," variant_ia = on\n"); break; + } + + _unur_string_append(info," c = %g %s\n", GEN->c_T, + (gen->set & TDR_SET_C) ? "" : "[default]"); + + _unur_string_append(info," max_sqhratio = %g %s\n", GEN->max_ratio, + (gen->set & TDR_SET_MAX_SQHRATIO) ? "" : "[default]"); + + _unur_string_append(info," max_intervals = %d %s\n", GEN->max_ivs_info, + (gen->set & TDR_SET_MAX_IVS) ? "" : "[default]"); + + if (gen->variant & TDR_VARFLAG_VERIFY) + _unur_string_append(info," verify = on\n"); + + if (gen->variant & TDR_VARFLAG_PEDANTIC) + _unur_string_append(info," pedantic = on\n"); + + _unur_string_append(info,"\n"); + + /* Not displayed: + int unur_tdr_set_usedars( UNUR_PAR *parameters, int usedars ); + int unur_tdr_set_darsfactor( UNUR_PAR *parameters, double factor ); + int unur_tdr_set_cpoints( UNUR_PAR *parameters, int n_stp, const double *stp ); + int unur_tdr_set_reinit_percentiles( UNUR_PAR *parameters, int n_percentiles, const double *percentiles ); + int unur_tdr_set_reinit_ncpoints( UNUR_PAR *parameters, int ncpoints ); + int unur_tdr_set_usecenter( UNUR_PAR *parameters, int usecenter ); + int unur_tdr_set_usemode( UNUR_PAR *parameters, int usemode ); + int unur_tdr_set_guidefactor( UNUR_PAR *parameters, double factor ); + */ + } + + + /* Hints */ + if (help) { + if ( (gen->variant & TDR_VARMASK_VARIANT) != TDR_VARIANT_IA) + _unur_string_append(info,"[ Hint: %s ]\n", + "You may use \"variant_ia\" for faster generation times."); + if ( !(gen->set & TDR_SET_MAX_SQHRATIO) ) + _unur_string_append(info,"[ Hint: %s ]\n", + "You can set \"max_sqhratio\" closer to 1 to decrease rejection constant." ); + if (GEN->Asqueeze/GEN->Atotal < GEN->max_ratio) + _unur_string_append(info,"[ Hint: %s ]\n", + "You should increase \"max_intervals\" to obtain the desired rejection constant." ); + _unur_string_append(info,"\n"); + } + +} /* end of _unur_tdr_info() */ + +/*---------------------------------------------------------------------------*/ +#endif +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/tdr_init.ch b/vendor/unuran-1.11.0/src/methods/tdr_init.ch new file mode 100644 index 0000000..495f91f --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tdr_init.ch @@ -0,0 +1,1448 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tdr_init.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: transformed density rejection * + * * + * DESCRIPTION: * + * Given PDF of a T-concave distribution * + * produce a value x consistent with its density * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include "tdr_gw_init.ch" +#include "tdr_ps_init.ch" + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_tdr_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_TDR ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_TDR_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_tdr_create(par); + if (!gen) { _unur_par_free(par); return NULL; } + + /* free parameters */ + _unur_par_free(par); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_tdr_debug_init_start(gen); +#endif + + /* set-up the generator */ + if (_unur_tdr_make_gen( gen ) != UNUR_SUCCESS) { + _unur_tdr_free(gen); return NULL; + } + + /* is there any hat at all ? */ + if (GEN->Atotal <= 0. || !_unur_isfinite(GEN->Atotal)) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"bad construction points."); + _unur_tdr_free(gen); + return NULL; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_tdr_debug_init_finished(gen); +#endif + + /* creation of generator object successfull */ + gen->status = UNUR_SUCCESS; + + /* o.k. */ + return gen; + +} /* end of _unur_tdr_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_tdr_make_gen( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* make generator object */ + /* */ + /* parameters: */ + /* gen ... pointer (almost) empty generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* remark: */ + /* on success: gen points to the ready-to-use generator object */ + /* on error: gen should not be used at all */ + /*----------------------------------------------------------------------*/ +{ + int i,k; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); + + /* get starting points */ + if (_unur_tdr_starting_cpoints(gen)!=UNUR_SUCCESS) return UNUR_FAILURE; + + /* compute intervals for given starting points */ + if (_unur_tdr_starting_intervals(gen)!=UNUR_SUCCESS) return UNUR_FAILURE; + + /* update maximal number of intervals */ + if (GEN->n_ivs > GEN->max_ivs) GEN->max_ivs = GEN->n_ivs; + + if (gen->variant & TDR_VARFLAG_USEDARS) { + /* run derandomized adaptive rejection sampling (DARS) */ + +#ifdef UNUR_ENABLE_LOGGING + if (gen->debug & TDR_DEBUG_DARS) { + /* make initial guide table (only necessary for writing debug info) */ + _unur_tdr_make_guide_table(gen); + /* write info into LOG file */ + _unur_tdr_debug_dars_start(gen); + } +#endif + + for (i=0; i<3; i++) { + /* we make several tries */ + + /* run DARS */ + if (_unur_tdr_run_dars(gen)!=UNUR_SUCCESS) return UNUR_FAILURE; + + /* make initial guide table */ + _unur_tdr_make_guide_table(gen); + + /* check if DARS was completed */ + if (GEN->n_ivs < GEN->max_ivs) { + /* ran ARS instead */ + for (k=0; k<5; k++) + _unur_sample_cont(gen); + } + else + break; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_tdr_debug_dars_finished(gen); +#endif + } + + else { /* do not run DARS */ + /* make initial guide table */ + _unur_tdr_make_guide_table(gen); + } + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end _unur_tdr_make_gen() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_tdr_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_TDR_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_tdr_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_TDR_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* which transformation */ + if (_unur_iszero(PAR->c_T)) + gen->variant = (gen->variant & (~TDR_VARMASK_T)) | TDR_VAR_T_LOG; + else if (_unur_FP_same(PAR->c_T, -0.5)) + gen->variant = (gen->variant & (~TDR_VARMASK_T)) | TDR_VAR_T_SQRT; + else + gen->variant = (gen->variant & (~TDR_VARMASK_T)) | TDR_VAR_T_POW; + + /** TODO: remove this **/ + if ((gen->variant & TDR_VARMASK_T) == TDR_VAR_T_POW) { + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,"c != 0. and c != -0.5 not implemented!"); + _unur_generic_free(gen); + return NULL; + } + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_tdr_getSAMPLE(gen); + gen->destroy = _unur_tdr_free; + gen->clone = _unur_tdr_clone; + gen->reinit = _unur_tdr_reinit; + + /* set all pointers to NULL */ + GEN->guide = NULL; + GEN->guide_size = 0; + GEN->iv = NULL; + GEN->n_ivs = 0; + GEN->Atotal = 0.; + GEN->Asqueeze = 0.; + + /* copy some parameters into generator object */ + GEN->guide_factor = PAR->guide_factor; /* relative size of guide tables */ + GEN->c_T = PAR->c_T; /* parameter for transformation */ + GEN->darsfactor = PAR->darsfactor; /* factor for derandomized ARS */ + GEN->darsrule = PAR->darsrule; /* rule for finding splitting points in DARS */ + + /* bounds for adding construction points */ + GEN->max_ivs = _unur_max(2*PAR->n_starting_cpoints,PAR->max_ivs); /* maximum number of intervals */ +#ifdef UNUR_ENABLE_INFO + GEN->max_ivs_info = PAR->max_ivs; /* ... for info string */ +#endif + GEN->max_ratio = PAR->max_ratio; /* bound for ratio Atotal / Asqueeze */ + GEN->bound_for_adding = PAR->bound_for_adding; + + /* get center */ + if ( (gen->distr->set & UNUR_DISTR_SET_CENTER) || + (gen->distr->set & UNUR_DISTR_SET_MODE) ) { + GEN->center = unur_distr_cont_get_center(gen->distr); + /* center must be in domain */ + GEN->center = _unur_max(GEN->center,DISTR.BD_LEFT); + GEN->center = _unur_min(GEN->center,DISTR.BD_RIGHT); + gen->set |= TDR_SET_CENTER; + } + else { + GEN->center = 0.; + /* we cannot use the center as construction point */ + gen->variant &= ~TDR_VARFLAG_USECENTER; + } + + /* mode known and in given domain ?? */ + if ( !(gen->distr->set & UNUR_DISTR_SET_MODE) + || (DISTR.mode < DISTR.BD_LEFT) + || (DISTR.mode > DISTR.BD_RIGHT)) + /* we cannot use the mode as construction point */ + gen->variant = gen->variant & (~TDR_VARFLAG_USEMODE); + + /* copy starting points */ + GEN->n_starting_cpoints = PAR->n_starting_cpoints; + if (PAR->starting_cpoints) { + GEN->starting_cpoints = _unur_xmalloc( PAR->n_starting_cpoints * sizeof(double) ); + memcpy( GEN->starting_cpoints, PAR->starting_cpoints, PAR->n_starting_cpoints * sizeof(double) ); + } + else { + GEN->starting_cpoints = NULL; + } + + /* copy percentiles */ + GEN->percentiles = NULL; + if (gen->set & TDR_SET_N_PERCENTILES) + unur_tdr_chg_reinit_percentiles( gen, PAR->n_percentiles, PAR->percentiles ); + + /* copy all other parameters */ + GEN->retry_ncpoints = PAR->retry_ncpoints; /* number of cpoints for second trial of reinit */ + + /* set (default) boundaries for U */ + GEN->Umin = 0.; + GEN->Umax = 1.; + + /* set default for DARS */ + if (!(gen->set & TDR_SET_USE_DARS) && !PAR->starting_cpoints) + /* no starting points given by user + --> enable derandomized ARS */ + gen->variant |= TDR_VARFLAG_USEDARS; + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_tdr_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_tdr_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_tdr_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tdr_interval *iv,*next; + double *bak_cpoints; + int bak_n_cpoints; + int i; + int n_trials; + + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, TDR, UNUR_ERR_GEN_INVALID ); + + /* first trial */ + n_trials = 1; + + /* which construction points should be used ? */ + if (gen->set & TDR_SET_N_PERCENTILES) { + if (GEN->starting_cpoints==NULL || (GEN->n_starting_cpoints != GEN->n_percentiles)) { + GEN->n_starting_cpoints = GEN->n_percentiles; + GEN->starting_cpoints = _unur_xrealloc( GEN->starting_cpoints, GEN->n_percentiles * sizeof(double)); + } + for (i=0; in_percentiles; i++) { + GEN->starting_cpoints[i] = unur_tdr_eval_invcdfhat( gen, GEN->percentiles[i], NULL, NULL, NULL ); + if (!_unur_isfinite(GEN->starting_cpoints[i])) + /* we cannot use these starting points --> skip to second trial immediately */ + n_trials = 2; + } + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & TDR_DEBUG_REINIT) + _unur_tdr_debug_reinit_start(gen); +#endif + + /* make backup of cpoints */ + bak_n_cpoints = GEN->n_starting_cpoints; + bak_cpoints = GEN->starting_cpoints; + + for (;; ++n_trials) { + /* free linked list of intervals */ + for (iv = GEN->iv; iv != NULL; iv = next) { + next = iv->next; + free(iv); + } + GEN->iv = NULL; + GEN->n_ivs = 0; + GEN->Atotal = 0.; + GEN->Asqueeze = 0.; + + if (n_trials > 2) { + /* we have done our best */ + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"bad construction points for reinit"); + GEN->n_starting_cpoints = bak_n_cpoints; + GEN->starting_cpoints = bak_cpoints; + return UNUR_FAILURE; + } + + if (n_trials > 1) { + /* second trial */ + GEN->n_starting_cpoints = GEN->retry_ncpoints; + GEN->starting_cpoints = NULL; +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & TDR_DEBUG_REINIT) + _unur_tdr_debug_reinit_retry(gen); +#endif + } + + /* set-up the generator */ + if (_unur_tdr_make_gen( gen ) != UNUR_SUCCESS) + continue; + + /* is there any hat at all ? */ + if (GEN->Atotal <= 0.) + continue; + + /* reinit successful */ + break; + + } + + /* clean up */ + if (n_trials > 1) { + GEN->n_starting_cpoints = bak_n_cpoints; + GEN->starting_cpoints = bak_cpoints; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & TDR_DEBUG_REINIT) + if (gen->debug) _unur_tdr_debug_reinit_finished(gen); +#endif + + /* (re)set sampling routine */ + SAMPLE = _unur_tdr_getSAMPLE(gen); + + return UNUR_SUCCESS; +} /* end of _unur_tdr_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_tdr_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_tdr_gen*)clone->datap) + + struct unur_gen *clone; + struct unur_tdr_interval *iv,*next, *clone_iv, *clone_prev; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_TDR_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* copy linked list of intervals */ + clone_iv = NULL; + clone_prev = NULL; + for (iv = GEN->iv; iv != NULL; iv = next) { + /* copy segment */ + clone_iv = _unur_xmalloc( sizeof(struct unur_tdr_interval) ); + memcpy( clone_iv, iv, sizeof(struct unur_tdr_interval) ); + if (clone_prev == NULL) { + /* starting point of linked list */ + CLONE->iv = clone_iv; + clone_iv->prev = NULL; + } + else { + /* insert into linked list */ + clone_prev->next = clone_iv; + clone_iv->prev = clone_prev; + } + /* next step */ + next = iv->next; + clone_prev = clone_iv; + } + /* terminate linked list */ + if (clone_iv) clone_iv->next = NULL; + + /* copy starting points */ + if (GEN->starting_cpoints) { + CLONE->starting_cpoints = _unur_xmalloc( GEN->n_starting_cpoints * sizeof(double) ); + memcpy( CLONE->starting_cpoints, GEN->starting_cpoints, GEN->n_starting_cpoints * sizeof(double) ); + } + + /* copy percentiles */ + if (GEN->percentiles) { + CLONE->percentiles = _unur_xmalloc( GEN->n_percentiles * sizeof(double) ); + memcpy( CLONE->percentiles, GEN->percentiles, GEN->n_percentiles * sizeof(double) ); + } + + /* make new guide table */ + CLONE->guide = NULL; + _unur_tdr_make_guide_table(clone); + + /* finished clone */ + return clone; + +#undef CLONE +} /* end of _unur_tdr_clone() */ + +/*****************************************************************************/ + +void +_unur_tdr_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_TDR ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_tdr_debug_free(gen); +#endif + + /* free linked list of intervals */ + { + struct unur_tdr_interval *iv,*next; + for (iv = GEN->iv; iv != NULL; iv = next) { + next = iv->next; + free(iv); + } + } + + /* free list of starting points */ + if (GEN->starting_cpoints) + free (GEN->starting_cpoints); + + /* free list of percentiles */ + if (GEN->percentiles) + free (GEN->percentiles); + + /* free table */ + if (GEN->guide) free(GEN->guide); + + /* free other memory not stored in list */ + _unur_generic_free(gen); + +} /* end of _unur_tdr_free() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_tdr_starting_cpoints( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* list of construction points for starting intervals. */ + /* if not provided as arguments compute these */ + /* by means of the "equiangular rule" from AROU. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tdr_interval *iv; + double left_angle, right_angle, diff_angle, angle; + double x, fx, fx_last; + int use_center, use_mode, is_mode, was_mode; + int i, is_increasing; + double extra_cpoint; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); + + /* use mode as construction point ? */ + use_mode = (gen->variant & TDR_VARFLAG_USEMODE) ? TRUE : FALSE; + + /* use center as construction point ? */ + use_center = (!use_mode && (gen->variant & TDR_VARFLAG_USECENTER)) ? TRUE : FALSE; + + /* add extra construction point */ + /* (use either mode or center or none) */ + extra_cpoint = use_mode ? DISTR.mode : (use_center ? GEN->center : 0. ); + + /* reset counter of intervals */ + GEN->n_ivs = 0; + + /* prepare for computing construction points */ + if (!GEN->starting_cpoints) { + /* move center into x = 0 */ + /* angles of boundary of domain */ + left_angle = _unur_FP_is_minus_infinity(DISTR.BD_LEFT) ? -M_PI/2. : atan(DISTR.BD_LEFT - GEN->center); + right_angle = _unur_FP_is_infinity(DISTR.BD_RIGHT) ? M_PI/2. : atan(DISTR.BD_RIGHT - GEN->center); + /* we use equal distances between the angles of the cpoints */ + /* and the boundary points */ + diff_angle = (right_angle-left_angle) / (GEN->n_starting_cpoints + 1); + angle = left_angle; + } + else + diff_angle = angle = 0.; /* we do not need these variables in this case */ + + /* the left boundary point */ + x = DISTR.BD_LEFT; + if (use_mode && DISTR.mode <= x) { + /* this is the mode of the distribution */ + is_mode = TRUE; + use_mode = FALSE; /* do not use the mode again */ + is_increasing = FALSE; + } + else if (use_center && GEN->center <= x) { + is_mode = FALSE; + use_center = FALSE; /* do not use the center again */ + is_increasing = TRUE; /* the center may be left of (unknown) mode */ + } + else { + is_mode = FALSE; + is_increasing = TRUE; + } + + fx = fx_last = _unur_FP_is_minus_infinity(x) ? 0. : PDF(x); + iv = GEN->iv = _unur_tdr_interval_new( gen, x, fx, is_mode ); + if (iv == NULL) return UNUR_ERR_GEN_DATA; /* PDF(x) < 0 or overflow !! */ + + /* terminate beginning of list */ + iv->prev = NULL; + + /* now all the other points */ + for( i=0; i<=GEN->n_starting_cpoints; i++ ) { + was_mode = is_mode; + + /* construction point */ + if (i < GEN->n_starting_cpoints) { + if (GEN->starting_cpoints) { + /* construction points provided by user */ + x = GEN->starting_cpoints[i]; + /* check starting point */ + if (x < DISTR.BD_LEFT || x > DISTR.BD_RIGHT) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"starting point out of domain"); + continue; + } + } + else { + /* compute construction points by means of "equiangular rule" */ + angle += diff_angle; + x = tan( angle ) + GEN->center; + } + } + else { + /* the very last interval. it is rather a "virtual" interval to store + the right vertex of the last interval, i.e., the right boundary point. */ + x = DISTR.BD_RIGHT; + } + + /* insert mode or center ? */ + if ((use_mode || use_center) && x >= extra_cpoint) { + is_mode = use_mode; /* the next construction point is the mode */ + use_center = use_mode = FALSE; /* we use the mode only once (of course) */ + if (x>extra_cpoint) { + x = extra_cpoint; /* use the mode now ... */ + --i; /* and push the orignal starting point back on stack */ + if (!GEN->starting_cpoints) + angle -= diff_angle; /* we have to compute the starting point in this case */ + } + /* else: x == extra_cpoint --> nothing to do */ + } + else + is_mode = FALSE; + + /** TODO: check if two construction points are too close ?? + check if a point is too close to mode ?? */ + + /* value of PDF at starting point */ + fx = _unur_FP_is_infinity(x) ? 0. : PDF(x); + + /* check value of PDF at starting point */ + if (!is_increasing && fx > fx_last * (1.+DBL_EPSILON)) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not unimodal!"); + return UNUR_ERR_GEN_CONDITION; + } + if (is_mode && fx < fx_last * (1.-DBL_EPSILON)) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"mode -> ignore"); + continue; + } + if (was_mode && fx > fx_last * (1.+DBL_EPSILON)) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"mode"); + return UNUR_ERR_GEN_DATA; + } + + if (fx <= 0. && fx_last <= 0.) { + /* we do not need two such point */ + if (is_increasing) { + /* PDF is still increasing, i.e., constant 0 til now */ + if (in_starting_cpoints) { + /* and it is not the right boundary. + otherwise the PDF is constant 0 on all construction points. + then we need both boundary points. */ + iv->x = x; /* we only have to change x, everything else remains unchanged */ + continue; /* next construction point */ + } + } + else + /* there should be no more points with PDF(x) > 0 */ + break; + } + + /* need a new interval */ + iv->next = _unur_tdr_interval_new( gen, x, fx, is_mode ); + if (iv->next == NULL) return UNUR_ERR_GEN_DATA; /* PDF(x) < 0 or overflow !! */ + + /* link into list and skip pointer to current interval */ + iv->next->prev = iv; + iv = iv->next; + + /* PDF still increasing ? */ + if (is_increasing && fx < fx_last) + is_increasing = 0; + + /* store last computed values */ + fx_last = fx; + + } + + /* we have left the loop with the right boundary of the support of PDF + make shure that we will never use iv for sampling. */ + iv->Asqueeze = iv->Ahat = iv->Ahatr = iv->sq = 0.; + iv->Acum = UNUR_INFINITY; + iv->ip = iv->x; + iv->fip = iv->fx; + iv->next = NULL; /* terminate list */ + --(GEN->n_ivs); /* we do not count this interval */ + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_tdr_starting_cpoints() */ + +/*****************************************************************************/ + +int +_unur_tdr_starting_intervals( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* compute intervals for starting points */ + /* */ + /* parameters: */ + /* par ... pointer to parameter list */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + switch (gen->variant & TDR_VARMASK_VARIANT) { + case TDR_VARIANT_GW: /* original variant (Gilks&Wild) */ + return _unur_tdr_gw_starting_intervals(gen); + case TDR_VARIANT_PS: /* proportional squeeze */ + case TDR_VARIANT_IA: /* immediate acceptance */ + return _unur_tdr_ps_starting_intervals(gen); + default: + _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + } +} /* end of _unur_tdr_starting_intervals() */ + +/*****************************************************************************/ + +int +_unur_tdr_run_dars( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* run derandomized adaptive rejection sampling. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tdr_interval *iv; + double Atot, Asqueezetot; /* total area below hat and squeeze, resp. */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); + + /* there is no need to run DARS when the DARS factor is UNUR_INFINITY */ + if (_unur_FP_is_infinity(GEN->darsfactor)) + return UNUR_SUCCESS; + + /* first we need the total areas below hat and squeeze. + (This is only necessary, when _unur_tdr_make_guide_table() has not been + called!) */ + Atot = 0.; /* area below hat */ + Asqueezetot = 0.; /* area below squeeze */ + for (iv = GEN->iv; iv != NULL; iv = iv->next ) { + COOKIE_CHECK(iv,CK_TDR_IV,UNUR_ERR_COOKIE); + Atot += iv->Ahat; + Asqueezetot += iv->Asqueeze; + } + + GEN->Atotal = Atot; + GEN->Asqueeze = Asqueezetot; + + /* now run DARS for different variants */ + switch (gen->variant & TDR_VARMASK_VARIANT) { + case TDR_VARIANT_GW: /* original variant (Gilks&Wild) */ + return _unur_tdr_gw_dars(gen); + case TDR_VARIANT_PS: /* proportional squeeze */ + case TDR_VARIANT_IA: /* immediate acceptance */ + return _unur_tdr_ps_dars(gen); + default: + _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + } + +} /* end of _unur_tdr_run_dars() */ + +/*****************************************************************************/ + +struct unur_tdr_interval * +_unur_tdr_interval_new( struct unur_gen *gen, double x, double fx, int is_mode ) + /*----------------------------------------------------------------------*/ + /* get new interval and compute left construction point at x. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* x ... left point of new interval */ + /* fx ... value of PDF at x */ + /* is_mode ... if TRUE, x is a mode of the PDF */ + /* */ + /* return: */ + /* pointer to new interval */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tdr_interval *iv; + double dfx; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_TDR_GEN,NULL); + + /* first check fx */ + if (fx<0.) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) < 0.!"); + return NULL; + } + if (_unur_FP_is_infinity(fx)) { + /* over flow */ + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) overflow"); + return NULL; + } + + /* we need a new segment */ + iv = _unur_xmalloc( sizeof(struct unur_tdr_interval) ); + iv->next = NULL; /* add eol marker */ + ++(GEN->n_ivs); /* increment counter for intervals */ + COOKIE_SET(iv,CK_TDR_IV); + + /* avoid uninitialized variables */ + iv->Acum = iv->Ahat = iv->Ahatr = iv->Asqueeze = 0.; + iv->ip = iv->fip = iv->sq = 0.; + + /* make left construction point in interval */ + iv->x = x; /* point x */ + iv->fx = fx; /* value of PDF at x */ + + if (fx<=0.) { /* --> -UNUR_INFINITY */ + iv->Tfx = -UNUR_INFINITY; /* transformed density */ + iv->dTfx = UNUR_INFINITY; /* derivative of transformed density */ + return iv; + } + + switch( gen->variant & TDR_VARMASK_T ) { + case TDR_VAR_T_LOG: + /* transformed density */ + iv->Tfx = log(fx); + /* derivative of transformed density */ + if (is_mode) { + /* we can set dPDF(x) = 0. for the mode */ + iv->dTfx = 0.; break; + } + if (_unur_cont_have_dlogPDF(gen->distr)) { + iv->dTfx = dlogPDF(x); break; + } + else { + dfx = dPDF(x); + if (_unur_iszero(dfx)) + iv->dTfx = 0.; + else + iv->dTfx = (1./fx * dfx); /* possible overflow ? */ + } + break; + + case TDR_VAR_T_SQRT: + /* transformed density */ + iv->Tfx = -1./sqrt(fx); + /* derivative of transformed density */ + if (is_mode) { + /* we can set dPDF(x) = 0. for the mode */ + iv->dTfx = 0.; break; } + if (_unur_cont_have_dlogPDF(gen->distr)) { + iv->dTfx = -0.5 * iv->Tfx * dlogPDF(x); + break; + } + else { + dfx = dPDF(x); + if (_unur_iszero(dfx)) + iv->dTfx = 0.; + else + iv->dTfx = (dfx<0.) ? -exp( -M_LN2 - 1.5*log(fx) + log(-dfx)) + : exp( -M_LN2 - 1.5*log(fx) + log(dfx)); + } + break; + + case TDR_VAR_T_POW: + /** TODO **/ + /* iv->Tfx = -pow(fx,GEN->c_T); */ + /* iv->dTfx = 0.; */ + break; + } + + /* the program requires dTfx > -UNUR_INFINITY */ + if ( !(iv->dTfx > -UNUR_INFINITY)) + iv->dTfx = UNUR_INFINITY; + + return iv; + +} /* end of _unur_tdr_interval_new() */ + +/*****************************************************************************/ + +int +_unur_tdr_tangent_intersection_point( struct unur_gen *gen, struct unur_tdr_interval *iv, double *ipt ) + /*----------------------------------------------------------------------*/ + /* compute cutting point of interval into left and right part. */ + /* (1) use intersection point of tangents of transformed hat. */ + /* (2) use mean point if (1) is unstable due to roundoff errors. */ + /* (3) use boundary point which is closer to the mode. this is */ + /* important when the transformed tagents are extremely steep. */ + /* (This might cause a serious roundoff error while sampling.) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval */ + /* ipt ... pointer to intersection point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); + CHECK_NULL(iv,UNUR_ERR_NULL); COOKIE_CHECK(iv,CK_TDR_IV,UNUR_ERR_COOKIE); + + /* + case: there is no tangent at one of the boundary points of the interval + (then the slope is UNUR_INFINITY) + or + case: the tangents are too steep (--> case (3)) + */ + if ( iv->dTfx > 1.e+140 ) { + *ipt = iv->x; /* intersection point = left boundary of interval */ + return UNUR_SUCCESS; + } + if ( iv->next->dTfx < -1.e+140 || _unur_FP_is_infinity(iv->next->dTfx)) { + *ipt = iv->next->x; /* intersection point = right boundary of interval */ + return UNUR_SUCCESS; + } + /** TODO: 1.e+140 (= sqrt(DBL_MAX) / 1.e15) is arbitrary **/ + + /* test for T-concavity */ + if ( _unur_FP_less( iv->dTfx, iv->next->dTfx ) ) { + + /* it might happen because of round-off errors + that iv->next->dTfx is almost zero although it should be large. + thus we ignore this case. */ + if ( fabs(iv->dTfx) < DBL_EPSILON * fabs(iv->next->dTfx) ) { + *ipt = iv->x; /* intersection point = left boundary of interval */ + iv->dTfx = UNUR_INFINITY; + return UNUR_SUCCESS; + } + else if ( fabs(iv->next->dTfx) < DBL_EPSILON * fabs(iv->dTfx) ) { + *ipt = iv->next->x; /* intersection point = right boundary of interval */ + iv->next->dTfx = UNUR_INFINITY; + return UNUR_SUCCESS; + } + else { +/* fprintf(stdout,"\ndTfx0 = %g < %g = dTfx1 (x0 = %g, x1 = %g)\n", */ +/* iv->dTfx,iv->next->dTfx,iv->x,iv->next->x); */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"dTfx0 < dTfx1 (x0next->Tfx > iv->x + iv->dTfx*(iv->next->x - iv->x)) { */ + /* _unur_warning(gen->genid,UNUR_ERR_INIT,"tangent below PDF not T-concave!"); */ + /* return UNUR_ERR_INIT; */ + /* } */ + + /* case (2): computing intersection of tangents is unstable */ + if (_unur_FP_approx(iv->dTfx, iv->next->dTfx)) { + /* use mean point */ + *ipt = 0.5 * (iv->x + iv->next->x); + return UNUR_SUCCESS; + } + + /* case (1): compute intersection point of tangents (regular case) */ + *ipt = ( (iv->next->Tfx - iv->Tfx - iv->next->dTfx * iv->next->x + iv->dTfx * iv->x) / + (iv->dTfx - iv->next->dTfx) ); + + /* check position of intersection point */ + if (_unur_FP_less(*ipt, iv->x) || _unur_FP_greater(*ipt, iv->next->x)) + /* intersection point of tangents not in interval. + This is mostly the case for numerical reasons. + Thus we is the center of the interval instead. + if the PDF not T-concave, it will catched at a later + point when we compare slope of tangents and squeeze. */ + *ipt = 0.5 * (iv->x + iv->next->x); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_tdr_tangent_intersection_point() */ + +/*****************************************************************************/ + +double +_unur_tdr_interval_area( struct unur_gen *gen, struct unur_tdr_interval *iv, double slope, double x ) + /*---------------------------------------------------------------------------*/ + /* compute area below piece of hat or squeeze in */ + /* interval [iv->x,x] or [x,iv->x] */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval that stores construction point of tangent */ + /* slope ... slope of tangent or secant of transformed PDF */ + /* x ... boundary of integration domain */ + /* */ + /* return: */ + /* area */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /* */ + /* comment: */ + /* x0 ... construction point of tangent (= iv->x) */ + /* */ + /* log(x) */ + /* area = | \int_{x0}^x \exp(Tf(x0) + slope*(t-x0)) dt | */ + /* = f(x0) * |x - x0| if slope = 0 */ + /* = | f(x0)/slope * (\exp(slope*(x-x0))-1) | if slope != 0 */ + /* */ + /* -1/sqrt(x) */ + /* area = | \int_{x0}^x 1/(Tf(x0) + slope*(t-x0))^2 dt | */ + /* = f(x0) * |x - x0| if slope = 0 */ + /* = infinity if T(f(x)) >= 0 */ + /* = | (x-x0) / (Tf(x0)*(Tf(x0)+slope*(x-x0))) | otherwise */ + /* */ + /*---------------------------------------------------------------------------*/ +{ + double area = 0.; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); + CHECK_NULL(iv,UNUR_INFINITY); COOKIE_CHECK(iv,CK_TDR_IV,UNUR_INFINITY); + + /* if the construction point is at infinity, we cannot compute an area. + (in this case we should have x == iv->x == UNUR_INFINITY). */ + if (_unur_FP_is_infinity(iv->x) || _unur_FP_is_minus_infinity(iv->x)) + return 0.; + + /* length of interval > 0 ? */ + if (_unur_FP_same(x, iv->x)) + return 0.; + + /* unbounded? */ + if ( _unur_FP_is_infinity(slope) || + (_unur_FP_is_minus_infinity(x) && slope<=0.) || + (_unur_FP_is_infinity(x) && slope>=0.) ) /* we have set (Tf)'(x) = UNUR_INFINITY, if f(x)=0 */ + return UNUR_INFINITY; + + switch( gen->variant & TDR_VARMASK_T ) { + + case TDR_VAR_T_LOG: /* T(x) = log(x) */ + + if (!_unur_iszero(slope)) { + if (_unur_FP_is_infinity(x) || _unur_FP_is_minus_infinity(x)) + area = iv->fx / slope; + else { + double t = slope * (x - iv->x); + if (fabs(t) > 1.e-6) { + if (t > MAXLOG / 10.) { + double xdiff = (x>iv->x) ? x - iv->x : iv->x - x; + area = exp( log(iv->fx) + log(xdiff) + t - log(t) ); + } + else { + area = iv->fx * (x - iv->x) * ( exp(t) - 1. ) / t; + } + } + else if (fabs(t) > 1.e-8) + /* use Taylor series */ + area = iv->fx * (x - iv->x) * (1. + t/2. + t*t/6.); + else + area = iv->fx * (x - iv->x) * (1. + t/2.); + } + } + else { /* hat/squeeze almost constant */ + if (_unur_FP_is_infinity(x) || _unur_FP_is_minus_infinity(x)) + return UNUR_INFINITY; + else + area = iv->fx * (x - iv->x); + } + break; + + case TDR_VAR_T_SQRT: /* T(x) = -1./sqrt(x) */ + + if (!_unur_iszero(slope)) { + if (_unur_FP_is_infinity(x) || _unur_FP_is_minus_infinity(x)) + area = 1. / ( iv->Tfx * slope ); + else { + /* compute value of transformed hat at integration boundary */ + double hx = iv->Tfx + slope * (x - iv->x); + /* the transformed hat must always be below the x-axis. + otherwise the area below the hat in unbounded. */ + if (hx>=0.) + return UNUR_INFINITY; + else + area = (x - iv->x) / ( iv->Tfx * hx ); + } + } + else { /* hat/squeeze almost constant */ + if (_unur_FP_is_infinity(x) || _unur_FP_is_minus_infinity(x)) + return UNUR_INFINITY; + else + area = iv->fx * (x - iv->x); + } + break; + + case TDR_VAR_T_POW: /* T(x) = -x^c */ + /** TODO **/ + break; + } + + return ( (area<0.) ? -area : area ); + +} /* end of _unur_tdr_interval_area() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_tdr_interval_xxarea( struct unur_gen *gen, struct unur_tdr_interval *iv, double slope, double x ) + /*---------------------------------------------------------------------------*/ + /* compute the interal of x times hat or squeeze ("expected value") in */ + /* interval [iv->x,x] or [x,iv->x] */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval that stores construction point of tangent */ + /* slope ... slope of tangent or secant of transformed PDF */ + /* x ... boundary of integration domain */ + /* */ + /* return: */ + /* "expected value" */ + /* (to get the real expected value, it must be divided by the area below */ + /* the function (hat or squeeze).) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /* */ + /* comment: */ + /* x0 ... construction point of tangent (= iv->x) */ + /* */ + /* log(x) */ + /* ev = \int_{x0}^x t * \exp(Tf(x0) + slope*(t-x0)) dt */ + /* = 0.5 * f(x0) * (x^2 - x0^2) if slope = 0 */ + /* = f(x0)/slope^2 * (\exp(slope*(x-x0))*(slope*x-1) - (slope*x0-1)) */ + /* if slope != 0 */ + /* */ + /* -1/sqrt(x) */ + /* ev = \int_{x0}^x t / (Tf(x0) + slope*(t-x0))^2 dt */ + /* = 0.5 * f(x0) * (x^2 - x0^2) if slope = 0 */ + /* = infinity if T(f(x)) >= 0 or |x| = infinity */ + /* = x0 / (slope*Tf(x0)) - x / (slope*u) + log(u/Tf(x0)) / slope^2 */ + /* where u = Tf(x0) + slope*(x-x0) otherwise */ + /* */ + /* To get the right sign we have to return sign(x-x0) * ev. */ + /* */ + /*---------------------------------------------------------------------------*/ +{ + double ev = 0.; + double hx,u; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); + CHECK_NULL(iv,UNUR_INFINITY); COOKIE_CHECK(iv,CK_TDR_IV,UNUR_INFINITY); + + /* if the construction point is at infinity, we cannot compute the integral + (in this case we should have x == iv->x == UNUR_INFINITY). */ + if (_unur_FP_is_infinity(iv->x) || _unur_FP_is_minus_infinity(iv->x)) + return 0.; + + /* length of interval > 0 ? */ + if (_unur_FP_same(x, iv->x)) + return 0.; + + /* unbounded? */ + if ( _unur_FP_is_infinity(slope) || + (_unur_FP_is_minus_infinity(x) && slope<=0.) || + (_unur_FP_is_infinity(x) && slope>=0.) ) /* we have set (Tf)'(x) = UNUR_INFINITY, if f(x)=0 */ + return UNUR_INFINITY; + + + switch( gen->variant & TDR_VARMASK_T ) { + + case TDR_VAR_T_LOG: /* T(x) = log(x) */ + if (_unur_FP_is_infinity(x) || _unur_FP_is_minus_infinity(x)) { + ev = iv->fx / (slope*slope) * (1-slope*iv->x); + } + else { + u = (x-iv->x) * slope; + + if (fabs(u) > 1.e-6) { + ev = iv->fx / (slope*slope) * (exp(u)*(slope*x-1.) - slope*iv->x + 1.); + } + else { + /* use Taylor series */ + /* constant term */ + ev = 0.5 * (x+iv->x); + if (fabs(u) > 0) { + /* 1st order expansion */ + ev += 1./6. * (2.*x+iv->x) * u; + /* 2nd order expansion */ + ev += 1./24. * (3.*x+iv->x) * u * u; + } + ev *= iv->fx * (x-iv->x); + } + } + break; + + case TDR_VAR_T_SQRT: /* T(x) = -1./sqrt(x) */ + if (_unur_FP_is_infinity(x) || _unur_FP_is_minus_infinity(x)) + /* the integral becomes UNUR_INFINITY */ + return UNUR_INFINITY; + + /* compute value of transformed hat at integration boundary */ + hx = iv->Tfx + slope * (x - iv->x); + + if (hx >= 0.) + /* the transformed hat must always be below the x-axis. + otherwise the area below the hat in unbounded. */ + return UNUR_INFINITY; + + u = (x-iv->x) * slope / iv->Tfx; + + if (fabs(u) > 1.e-6) { + ev = ( iv->x / (slope * iv->Tfx) - x / (slope * hx) + + log( hx / iv->Tfx ) / (slope*slope) ); + } + else { + /* use Taylor series */ + /* constant term */ + ev = 0.5 * (x+iv->x); + if (fabs(u) > 0) { + /* 1st order expansion */ + ev -= 1./3. * (2.*x+iv->x) * u; + /* 2nd order expansion */ + ev += 1./4. * (3.*x+iv->x) * u * u; + } + ev *= iv->fx * (x-iv->x); + } + break; + + case TDR_VAR_T_POW: /* T(x) = -x^c */ + /** TODO **/ + break; + } + + return ((x>iv->x) ? ev : -ev); + +} /* end of _unur_tdr_interval_xxarea() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_tdr_eval_intervalhat( struct unur_gen *gen, struct unur_tdr_interval *iv, double x ) + /*----------------------------------------------------------------------*/ + /* evaluate hat at x in interval. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval that stores constr. point of tangent */ + /* x ... point at which hat(x) has to be computed */ + /* */ + /* return: */ + /* hat(x) or */ + /* 0. if x is not finite or */ + /* UNUR_INFINITY the hat cannot be computed */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /* */ + /* comment: */ + /* x0 ... construction point of tangent (= iv->x) */ + /* */ + /* log(x) */ + /* hat(x) = f(x0) * exp( Tf'(x0)(x - x_0) ) */ + /* */ + /* 1/sqrt(x) */ + /* hat(x) = 1/(Tf(x0) + Tf'(x0)(x - x_0))^2 */ + /* */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); + CHECK_NULL(iv,UNUR_INFINITY); COOKIE_CHECK(iv,CK_TDR_IV,UNUR_INFINITY); + + /* we cannot compute the hat at x if any of the parameters are not finite */ + if ( _unur_FP_is_minus_infinity(iv->Tfx) || _unur_FP_is_infinity(iv->dTfx) ) + return UNUR_INFINITY; + + /* at +/- infinity the hat should be 0 (or infinity) */ + if ( _unur_FP_is_infinity(x) || _unur_FP_is_minus_infinity(x) || + _unur_FP_is_infinity(iv->x) || _unur_FP_is_minus_infinity(iv->x) ) + return 0.; + + /* now evaluate hat at x */ + switch( gen->variant & TDR_VARMASK_T ) { + + case TDR_VAR_T_LOG: + /* T(x) = log(x) */ + return (iv->fx * exp( iv->dTfx * (x - iv->x) )); + + case TDR_VAR_T_SQRT: + /* T(x) = -1./sqrt(x) */ + { + /* compute value of transformed hat at x */ + double hx = iv->Tfx + iv->dTfx * (x - iv->x); + /* hx must be less than 0 ! */ + return ((hx<0.) ? 1./(hx*hx) : UNUR_INFINITY); + } + + case TDR_VAR_T_POW: + /* T(x) = -1./x^c */ + /** TODO **/ + return UNUR_INFINITY; + + default: + _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_INFINITY; + } + +} /* end of _unur_tdr_eval_intervalhat() */ + +/*****************************************************************************/ + +int +_unur_tdr_make_guide_table( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* make a guide table for indexed search */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tdr_interval *iv; + double Acum, Asqueezecum, Astep; + int max_guide_size; + int j; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); + + /* allocate blocks for guide table (if necessary). + (we allocate blocks for maximal guide table.) */ + if (!GEN->guide) { + max_guide_size = (GEN->guide_factor > 0.) ? ((int)(GEN->max_ivs * GEN->guide_factor)) : 1; + if (max_guide_size <= 0) max_guide_size = 1; /* protect against overflow */ + GEN->guide = _unur_xmalloc( max_guide_size * sizeof(struct unur_tdr_interval*) ); + } + + /* first we need cumulated areas in intervals */ + Acum = 0.; /* area below hat */ + Asqueezecum = 0.; /* area below squeeze */ + for (iv = GEN->iv; iv != NULL; iv = iv->next ) { + COOKIE_CHECK(iv,CK_TDR_IV,UNUR_ERR_COOKIE); + Acum += iv->Ahat; + Asqueezecum += iv->Asqueeze; + iv->Acum = Acum; + } + + /* total area below hat */ + GEN->Atotal = Acum; + GEN->Asqueeze = Asqueezecum; + + /* actual size of guide table */ + GEN->guide_size = (int)(GEN->n_ivs * GEN->guide_factor); + /* we do not vary the relative size of the guide table, + since it has very little influence on speed */ + + /* make table (use variant 2; see dis.c) */ + Astep = GEN->Atotal / GEN->guide_size; + Acum=0.; + for( j=0, iv=GEN->iv; j < GEN->guide_size; j++ ) { + COOKIE_CHECK(iv,CK_TDR_IV,UNUR_ERR_COOKIE); + while( iv->Acum < Acum ) + iv = iv->next; + if( iv->next == NULL ) { /* this is the last virtual intervall --> do not use */ + _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF,"guide table"); + break; + } + GEN->guide[j] = iv; + Acum += Astep; + } + + /* if there has been an round off error, we have to complete the guide table */ + for( ; jguide_size ;j++ ) + GEN->guide[j] = iv; + + return UNUR_SUCCESS; +} /* end of _unur_tdr_make_guide_table() */ + +/*****************************************************************************/ + diff --git a/vendor/unuran-1.11.0/src/methods/tdr_newset.ch b/vendor/unuran-1.11.0/src/methods/tdr_newset.ch new file mode 100644 index 0000000..ee02f8c --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tdr_newset.ch @@ -0,0 +1,1177 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tdr_newset.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: transformed density rejection * + * * + * DESCRIPTION: * + * Given PDF of a T-concave distribution * + * produce a value x consistent with its density * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_tdr_new( const struct unur_distr* distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + + if (DISTR_IN.pdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); return NULL; } + if (DISTR_IN.dpdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"derivative of PDF"); return NULL; } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_tdr_par) ); + COOKIE_SET(par,CK_TDR_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->guide_factor = 2.; /* size of guide table / number of intervals */ + + PAR->c_T = -0.5; /* parameter for transformation (-1. <= c < 0.) */ + + PAR->starting_cpoints = NULL; /* pointer to array of starting points */ + PAR->n_starting_cpoints = 30; /* number of starting points */ + PAR->percentiles = NULL; /* pointer to array of percentiles */ + PAR->n_percentiles = 2; /* number of percentiles */ + PAR->retry_ncpoints = 50; /* number of cpoints for second trial of reinit */ + PAR->max_ivs = 100; /* maximum number of intervals */ + PAR->max_ratio = 0.99; /* bound for ratio Atotal / Asqueeze */ + PAR->bound_for_adding = 0.5; /* do not add a new construction point in an interval, + where ambigous region is too small, i.e. if + area / ((A_hat - A_squeeze)/number of segments) < bound_for_adding */ + PAR->darsfactor = 0.99; /* factor for derandomized ARS */ + PAR->darsrule = 1; /* rule for finding splitting points in DARS */ + + par->method = UNUR_METH_TDR; /* method */ + par->variant = ( TDR_VARFLAG_USECENTER | /* default variant */ + TDR_VARFLAG_USEMODE | + TDR_VARIANT_PS ); + + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default URNG */ + par->urng_aux = par->urng; /* no special auxilliary URNG */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for initializing generator */ + par->init = _unur_tdr_init; + + return par; + +} /* end of unur_tdr_new() */ + +/*****************************************************************************/ + +int +unur_tdr_set_cpoints( struct unur_par *par, int n_stp, const double *stp ) + /*----------------------------------------------------------------------*/ + /* set construction points for hat function */ + /* and/or its number for initialization */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* n_stp ... number of starting points */ + /* stp ... pointer to array of starting points */ + /* (NULL for changing only the number of default points) */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TDR ); + + /* check starting construction points */ + /* we always use the boundary points as additional starting points, + so we do not count these here! */ + if (n_stp < 0 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of starting points < 0"); + return UNUR_ERR_PAR_SET; + } + + if (stp) + /* starting points must be strictly monontonically increasing */ + for( i=1; istarting_cpoints = stp; + PAR->n_starting_cpoints = n_stp; + + /* changelog */ + par->set |= TDR_SET_N_STP | ((stp) ? TDR_SET_STP : 0); + + return UNUR_SUCCESS; + +} /* end of unur_tdr_set_cpoints() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tdr_set_reinit_percentiles( struct unur_par *par, int n_percentiles, const double *percentiles ) + /*----------------------------------------------------------------------*/ + /* set percentiles for construction points for hat function */ + /* and/or its number for re-initialization */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator */ + /* n_percentiles ... number of percentiles */ + /* percentiles ... pointer to array of percentiles */ + /* (NULL for using a rule of thumb) */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TDR ); + + /* check given percentiles */ + if (n_percentiles < 2 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of percentiles < 2. using defaults"); + n_percentiles = 2; + percentiles = NULL; + } + + if (n_percentiles > 100 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of percentiles > 100. using 100"); + n_percentiles = 100; + } + + if (percentiles) { + /* percentiles must be strictly monontonically increasing */ + for( i=1; i 0.99) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"percentiles out of range"); + return UNUR_ERR_PAR_SET; + } + } + } + + /* store date */ + PAR->percentiles = percentiles; + PAR->n_percentiles = n_percentiles; + + /* changelog */ + par->set |= TDR_SET_N_PERCENTILES | ((percentiles) ? TDR_SET_PERCENTILES : 0); + + return UNUR_SUCCESS; + +} /* end of unur_tdr_set_reinit_percentiles() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tdr_chg_reinit_percentiles( struct unur_gen *gen, int n_percentiles, const double *percentiles ) + /*----------------------------------------------------------------------*/ + /* change percentiles for construction points for hat function */ + /* and/or its number for re-initialization */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* n_percentiles ... number of percentiles */ + /* percentiles ... pointer to array of percentiles */ + /* (NULL for using a rule of thumb) */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, TDR, UNUR_ERR_GEN_INVALID ); + + /* check given percentiles */ + if (n_percentiles < 2 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of percentiles < 2. using defaults"); + n_percentiles = 2; + percentiles = NULL; + } + + if (n_percentiles > 100 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of percentiles > 100. using 100"); + n_percentiles = 100; + } + + if (percentiles) { + /* percentiles must be strictly monontonically increasing */ + for( i=1; i 0.99) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"percentiles out of range"); + return UNUR_ERR_PAR_SET; + } + } + } + + /* store date */ + GEN->n_percentiles = n_percentiles; + GEN->percentiles = _unur_xrealloc( GEN->percentiles, n_percentiles * sizeof(double) ); + if (percentiles) { + memcpy( GEN->percentiles, percentiles, n_percentiles * sizeof(double) ); + } + else { + if (n_percentiles == 2) { + GEN->percentiles[0] = 0.25; + GEN->percentiles[1] = 0.75; + } + else { + for (i=0; ipercentiles[i] = (i + 1.) / (n_percentiles + 1.); + } + } + + /* changelog */ + gen->set |= TDR_SET_N_PERCENTILES | ((percentiles) ? TDR_SET_PERCENTILES : 0); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_tdr_chg_reinit_percentiles() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tdr_set_reinit_ncpoints( struct unur_par *par, int ncpoints ) + /*----------------------------------------------------------------------*/ + /* set number of construction points for second trial of reinit */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator */ + /* ncpoints ... number of construction points */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TDR ); + + /* check number */ + if (ncpoints < 10 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of construction points < 10"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->retry_ncpoints = ncpoints; + + /* changelog */ + par->set |= TDR_SET_RETRY_NCPOINTS; + + return UNUR_SUCCESS; + +} /* end of unur_tdr_set_reinit_ncpoints() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tdr_chg_reinit_ncpoints( struct unur_gen *gen, int ncpoints ) + /*----------------------------------------------------------------------*/ + /* change number of construction points for second trial of reinit */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* ncpoints ... number of construction points */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, TDR, UNUR_ERR_GEN_INVALID ); + + /* check number */ + if (ncpoints < 10 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of construction points < 10"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + GEN->retry_ncpoints = ncpoints; + + /* changelog */ + gen->set |= TDR_SET_RETRY_NCPOINTS; + + return UNUR_SUCCESS; + +} /* end of unur_tdr_chg_reinit_ncpoints() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tdr_set_guidefactor( struct unur_par *par, double factor ) + /*----------------------------------------------------------------------*/ + /* set factor for relative size of guide table */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* factor ... relative size of table */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TDR ); + + /* check new parameter for generator */ + if (factor < 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"guide table size < 0"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->guide_factor = factor; + + /* changelog */ + par->set |= TDR_SET_GUIDEFACTOR; + + return UNUR_SUCCESS; + +} /* end of unur_tdr_set_guidefactor() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tdr_set_max_sqhratio( struct unur_par *par, double max_ratio ) + /*----------------------------------------------------------------------*/ + /* set bound for ratio A(squeeze) / A(hat) */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* max_ratio ... upper bound for ratio to add a new construction point*/ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TDR ); + + /* check new parameter for generator */ + if (max_ratio < 0. || max_ratio > 1.+DBL_EPSILON ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"ratio A(squeeze)/A(hat) not in [0,1]"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->max_ratio = max_ratio; + + /* changelog */ + par->set |= TDR_SET_MAX_SQHRATIO; + + return UNUR_SUCCESS; + +} /* end of unur_tdr_set_max_sqhratio() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_tdr_get_sqhratio( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get ratio A(squeeze) / A(hat) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* ratio ... on success */ + /* UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + _unur_check_gen_object( gen, TDR, UNUR_INFINITY ); + + return (GEN->Asqueeze / GEN->Atotal); + +} /* end of unur_tdr_get_sqhratio() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_tdr_get_hatarea( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get area below hat */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* area ... on success */ + /* UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + _unur_check_gen_object( gen, TDR, UNUR_INFINITY ); + + return GEN->Atotal; + +} /* end of unur_tdr_get_hatarea() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_tdr_get_squeezearea( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get area below squeeze */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* area ... on success */ + /* UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + _unur_check_gen_object( gen, TDR, UNUR_INFINITY ); + + return GEN->Asqueeze; + +} /* end of unur_tdr_get_squeezearea() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tdr_set_max_intervals( struct unur_par *par, int max_ivs ) + /*----------------------------------------------------------------------*/ + /* set maximum number of intervals */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* max_ivs ... maximum number of intervals */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TDR ); + + /* check new parameter for generator */ + if (max_ivs < 1 ) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"maximum number of intervals < 1"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->max_ivs = max_ivs; + + /* changelog */ + par->set |= TDR_SET_MAX_IVS; + + return UNUR_SUCCESS; + +} /* end of unur_tdr_set_max_intervals() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_tdr_is_ARS_running( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check whether more points will be added by adaptive rejection */ + /* sampling */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* TRUE ... if ARS is still running. */ + /* FALSE ... otherwise. */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, FALSE ); + _unur_check_gen_object( gen, TDR, FALSE ); + + return (GEN->n_ivs < GEN->max_ivs) ? TRUE : FALSE; +} /* end of _unur_tdr_is_ARS_running() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tdr_set_usecenter( struct unur_par *par, int usecenter ) + /*----------------------------------------------------------------------*/ + /* set flag for using center as construction point */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* usecenter ... 0 = do not use, !0 = use */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* using center as construction point is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TDR ); + + /* we use a bit in variant */ + par->variant = (usecenter) ? (par->variant | TDR_VARFLAG_USECENTER) : (par->variant & (~TDR_VARFLAG_USECENTER)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_tdr_set_usecenter() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tdr_set_usemode( struct unur_par *par, int usemode ) + /*----------------------------------------------------------------------*/ + /* set flag for using (exact) mode as construction point */ + /* (this overwrites "use_center"!) */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* usemode ... 0 = do not use, !0 = use */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* using mode as construction point is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TDR ); + + /* we use a bit in variant */ + par->variant = (usemode) ? (par->variant | TDR_VARFLAG_USEMODE) : (par->variant & (~TDR_VARFLAG_USEMODE)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_tdr_set_usemode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tdr_set_variant_gw( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* use original variant with squeezes as proposed by Gilks & Wild */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TDR ); + + /* we use a bit in variant */ + par->variant = (par->variant & ~TDR_VARMASK_VARIANT) | TDR_VARIANT_GW; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_tdr_set_variant_gw() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tdr_set_variant_ps( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* Use squeezes proportional to the hat function */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TDR ); + + /* we use a bit in variant */ + par->variant = (par->variant & ~TDR_VARMASK_VARIANT) | TDR_VARIANT_PS; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_tdr_set_variant_ps() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tdr_set_variant_ia( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* Use squeezes proportional to the hat function together with a */ + /* composition method that required less uniform random numbers. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TDR ); + + /* we use a bit in variant */ + par->variant = (par->variant & ~TDR_VARMASK_VARIANT) | TDR_VARIANT_IA; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_tdr_set_variant_ia() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tdr_set_usedars( struct unur_par *par, int usedars ) + /*----------------------------------------------------------------------*/ + /* set flag for using DARS (derandomized adaptive rejection sampling). */ + /* additionally the rule for splitting intervals can be set. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* usedars ... 0 = do not use, 1-3 = use DARS with given rule */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* using not using DARS is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TDR ); + + /* check new parameter for generator */ + if (usedars < 0 || usedars > 3) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"invalid rule for DARS"); + return UNUR_ERR_PAR_SET; + } + + /* set rule for DARS */ + PAR->darsrule = usedars; + + /* we use a bit in variant */ + par->variant = (usedars) ? (par->variant | TDR_VARFLAG_USEDARS) : (par->variant & (~TDR_VARFLAG_USEDARS)); + + /* changelog */ + par->set |= TDR_SET_USE_DARS; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_tdr_set_usedars() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tdr_set_darsfactor( struct unur_par *par, double factor ) + /*----------------------------------------------------------------------*/ + /* set factor for derandomized adaptive rejection sampling */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* factor ... parameter for DARS */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TDR ); + + /* check new parameter for generator */ + if (factor < 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"DARS factor < 0"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->darsfactor = factor; + + /* changelog */ + par->set |= TDR_SET_DARS_FACTOR; + + return UNUR_SUCCESS; + +} /* end of unur_tdr_set_darsfactor() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tdr_set_c( struct unur_par *par, double c ) + /*----------------------------------------------------------------------*/ + /* set parameter c for transformation T_c */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* c ... parameter c */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TDR ); + + /* check new parameter for generator */ + if (c > 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"c > 0"); + return UNUR_ERR_PAR_SET; + } + /** TODO: ... **/ +/* if (c <= -1.) { */ +/* _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"c <= -1 only if domain is bounded. Use `TABL' method then."); */ +/* return 0; */ +/* } */ + /** TODO: ... **/ + if (c < -0.5) { + _unur_error(GENTYPE,UNUR_ERR_PAR_SET,"c < -0.5 not implemented yet"); + return UNUR_ERR_PAR_SET; + } + if (!_unur_iszero(c) && c > -0.5) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"-0.5 < c < 0 not recommended. using c = -0.5 instead."); + c = -0.5; + } + + /* store date */ + PAR->c_T = c; + + /* changelog */ + par->set |= TDR_SET_C; + + return UNUR_SUCCESS; + +} /* end of unur_tdr_set_c() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tdr_set_verify( struct unur_par *par, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TDR ); + + /* we use a bit in variant */ + par->variant = (verify) ? (par->variant | TDR_VARFLAG_VERIFY) : (par->variant & (~TDR_VARFLAG_VERIFY)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_tdr_set_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tdr_chg_verify( struct unur_gen *gen, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, TDR, UNUR_ERR_GEN_INVALID ); + + /* we must not change this switch when sampling has been disabled by + using a pointer to the error producing routine */ + if (SAMPLE == _unur_sample_cont_error) + return UNUR_FAILURE; + + /* we use a bit in variant */ + gen->variant = (verify) + ? (gen->variant | TDR_VARFLAG_VERIFY) + : (gen->variant & (~TDR_VARFLAG_VERIFY)); + + /* sampling routines */ + SAMPLE = _unur_tdr_getSAMPLE(gen); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_tdr_chg_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tdr_set_pedantic( struct unur_par *par, int pedantic ) + /*----------------------------------------------------------------------*/ + /* turn pedantic mode on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* pedantic ... 0 = no pedantic mode, !0 = use pedantic mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* pedantic is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, TDR ); + + /* we use a bit in variant */ + par->variant = (pedantic) ? (par->variant | TDR_VARFLAG_PEDANTIC) : (par->variant & (~TDR_VARFLAG_PEDANTIC)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_tdr_set_pedantic() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_tdr_chg_truncated( struct unur_gen *gen, double left, double right ) + /*----------------------------------------------------------------------*/ + /* change the left and right borders of the domain of the distribution */ + /* the new domain should not exceed the original domain given by */ + /* unur_distr_cont_set_domain(). Otherwise it is truncated. */ + /* */ + /* This call does not work for variant IA (immediate acceptance). */ + /* In this case it switches to variant PS!! */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* left ... left boundary point */ + /* right ... right boundary point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* the new boundary points may be +/- UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double Umin, Umax; + + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, TDR, UNUR_ERR_GEN_INVALID ); + + /* we have to disable adaptive rejection sampling */ + if (GEN->max_ivs > GEN->n_ivs) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"adaptive rejection sampling disabled for truncated distribution"); + GEN->max_ivs = GEN->n_ivs; + } + + /* we cannot use immadate acceptance (IA), switch to variant PS instead */ + if ((gen->variant & TDR_VARMASK_VARIANT) == TDR_VARIANT_IA) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"cannot use IA for truncated distribution, switch to PS"); + /* change variante flag */ + gen->variant = (gen->variant & ~TDR_VARMASK_VARIANT) | TDR_VARIANT_PS; + /* change sampling routine */ + SAMPLE = (gen->variant & TDR_VARFLAG_VERIFY) ? _unur_tdr_ps_sample_check : _unur_tdr_ps_sample; + } + + /* check new parameter for generator */ + /* (the truncated domain must be a subset of the domain) */ + if (left < DISTR.domain[0]) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain not subset of domain"); + left = DISTR.domain[0]; + } + if (right > DISTR.domain[1]) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain not subset of domain"); + right = DISTR.domain[1]; + } + + if (left >= right) { + _unur_warning(NULL,UNUR_ERR_DISTR_SET,"domain, left >= right"); + return UNUR_ERR_DISTR_SET; + } + + /* compute CDF at x (with respect to given domain of distribution) */ + Umin = _unur_tdr_eval_cdfhat(gen,left); + Umax = (right < DISTR.domain[1]) ? _unur_tdr_eval_cdfhat(gen,right) : 1.; + + /* check result */ + if (Umin > Umax) { + /* this is a serios error that should not happen */ + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_ERR_SHOULD_NOT_HAPPEN; + } + + if (_unur_FP_equal(Umin,Umax)) { + /* CDF values very close */ + _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values very close"); + if (_unur_iszero(Umin) || _unur_FP_same(Umax,1.)) { + /* this is very bad */ + _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values at boundary points too close"); + return UNUR_ERR_DISTR_SET; + } + } + + /* set bounds for truncated domain and for U (CDF) */ + DISTR.trunc[0] = left; + DISTR.trunc[1] = right; + GEN->Umin = Umin; + GEN->Umax = Umax; + + /* changelog */ + gen->distr->set |= UNUR_DISTR_SET_TRUNCATED; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ +#endif + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_tdr_chg_truncated() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_tdr_eval_cdfhat( struct unur_gen *gen, double x ) + /*----------------------------------------------------------------------*/ + /* evaluate CDF of hat at x (i.e. \int_{-\infty}^x hat(t) dt) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* x ... point at which hat(x) has to be computed */ + /* */ + /* return: */ + /* CDF of hat(x) or */ + /* UNUR_INFINITY in case of error */ + /* */ + /* Important: */ + /* If gen is a generator object for variant IA (immediate acceptance) */ + /* then it is treated like variant PS (proportional squeeze)! */ + /* This is necessary since variant IA is not a pure rejection */ + /* algorithm, but a composition method. */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tdr_interval *iv; + double Aint; + double cdf; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); + + /* the easy case: left and right boundary of domain */ + if (x <= DISTR.domain[0]) return 0.; + if (x >= DISTR.domain[1]) return 1.; + + /* there are differencies between variant GW and variant PS */ + switch (gen->variant & TDR_VARMASK_VARIANT) { + + case TDR_VARIANT_GW: /* original variant (Gilks&Wild) */ + + /* find interval (sequential search) */ + for (iv = GEN->iv; iv->next!=NULL; iv=iv->next) { + COOKIE_CHECK(iv,CK_TDR_IV,UNUR_INFINITY); + /* iv->x is left construction point of interval */ + if (x < iv->next->x) break; + } + + if (iv->next == NULL) + /* right boundary of domain */ + return 1.; + + /* now iv->x < x <= iv->next->x */ + + /* compute are below hat between construction point of tangent and x. */ + /* we have to cases on either side of the intersection point. */ + + if (x < iv->ip) { + /* left h.s. of intersection point */ + Aint = _unur_tdr_interval_area( gen, iv, iv->dTfx, x); + if (!_unur_isfinite(Aint)) { + /* this should not happen */ + Aint = 0.; + } + /* Notice: iv->prev->Acum == iv->Acum - iv->Ahat; */ + cdf = (iv->prev) ? iv->prev->Acum + Aint : Aint; + } + else { + /* right h.s. of intersection point */ + Aint = _unur_tdr_interval_area( gen, iv->next, iv->next->dTfx, x); + if (!_unur_isfinite(Aint)) { + /* this should not happen */ + Aint = 0.; + } + cdf = iv->Acum - Aint; + if (cdf < 0.) return 0.; + } + + /* normalize to one (and mind round-off errors) */ + cdf /= GEN->Atotal; + return ((cdf > 1.) ? 1. : cdf); + + + case TDR_VARIANT_IA: /* immediate acceptance */ + /* See comment above */ + + case TDR_VARIANT_PS: /* proportional squeeze */ + + /* find interval (sequential search) */ + for (iv = GEN->iv; iv->next!=NULL; iv=iv->next) { + COOKIE_CHECK(iv,CK_TDR_IV,UNUR_INFINITY); + if (x <= iv->next->ip) break; + } + if (iv->next == NULL) + /* right boundary of domain */ + return 1.; + + /* now iv->ip < x <= iv->next->ip */ + + /* area below hat between construction point and x */ + Aint = _unur_tdr_interval_area( gen, iv, iv->dTfx, x); + if (!_unur_isfinite(Aint)) { + /* this should not happen */ + Aint = 0.; + } + + /* compute CDF of hat */ + cdf = ((x>iv->x) ? Aint : -Aint) + iv->Acum - iv->Ahatr; + + /* normalize to one (and mind round-off errors) */ + if (cdf < 0.) return 0.; + cdf /= GEN->Atotal; + return ((cdf > 1.) ? 1. : cdf); + + default: + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_INFINITY; + } + +} /* end of _unur_tdr_eval_cdfhat() */ + +/*****************************************************************************/ + diff --git a/vendor/unuran-1.11.0/src/methods/tdr_ps_debug.ch b/vendor/unuran-1.11.0/src/methods/tdr_ps_debug.ch new file mode 100644 index 0000000..e25cb58 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tdr_ps_debug.ch @@ -0,0 +1,319 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tdr_ps_debug.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: transformed density rejection * + * * + * DESCRIPTION: * + * Debugging routines for variant with proportional squeezes. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +void +_unur_tdr_ps_debug_intervals( const struct unur_gen *gen, int print_areas ) + /*----------------------------------------------------------------------*/ + /* write list of intervals into LOG file(proportional squeezes) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* print_areas ... whether table of areas should be printed */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + struct unur_tdr_interval *iv; + double sAsqueeze, sAhatl, sAhatr, Atotal; + int i; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:Intervals: %d\n",gen->genid,GEN->n_ivs); + if (GEN->iv) { + if (gen->debug & TDR_DEBUG_IV) { + fprintf(LOG,"%s: Nr. left ip tp f(tp) T(f(tp)) d(T(f(tp))) f(ip) squ. ratio\n",gen->genid); + for (iv=GEN->iv,i=0; iv->next; iv=iv->next, i++) { + COOKIE_CHECK(iv,CK_TDR_IV,RETURN_VOID); + fprintf(LOG,"%s:[%3d]:%#12.6g %#12.6g %#12.6g %#12.6g %#12.6g %#12.6g %#12.6g\n", gen->genid, i, + iv->ip, iv->x, iv->fx, iv->Tfx, iv->dTfx, iv->fip, iv->sq); + } + COOKIE_CHECK(iv,CK_TDR_IV,RETURN_VOID); + fprintf(LOG,"%s:[...]:%#12.6g\t\t\t\t\t\t %#12.6g\n", gen->genid, + iv->ip, iv->fip); + } + fprintf(LOG,"%s:\n",gen->genid); + } + else + fprintf(LOG,"%s: No intervals !\n",gen->genid); + + if (!print_areas || GEN->Atotal <= 0.) return; + + /* print and sum areas below squeeze and hat */ + Atotal = GEN->Atotal; + if (gen->debug & TDR_DEBUG_IV) { + fprintf(LOG,"%s:Areas in intervals:\n",gen->genid); + fprintf(LOG,"%s: Nr.\tbelow squeeze\t\t below hat (left and right)\t\t cumulated\n",gen->genid); + sAsqueeze = sAhatl = sAhatr = 0.; + if (GEN->iv) { + for (iv=GEN->iv,i=0; iv->next; iv=iv->next, i++) { + COOKIE_CHECK(iv,CK_TDR_IV,RETURN_VOID); + sAsqueeze += iv->Asqueeze; + sAhatl += iv->Ahat - iv->Ahatr; + sAhatr += iv->Ahatr; + fprintf(LOG,"%s:[%3d]: %-12.6g(%6.3f%%) | %-12.6g+ %-12.6g(%6.3f%%) | %-12.6g(%6.3f%%)\n", + gen->genid,i, + iv->Asqueeze, iv->Asqueeze * 100. / Atotal, + iv->Ahat-iv->Ahatr, iv->Ahatr, iv->Ahat * 100. / Atotal, + iv->Acum, iv->Acum * 100. / Atotal); + } + fprintf(LOG,"%s: ---------- --------- | ------------------------ --------- +\n",gen->genid); + fprintf(LOG,"%s: Sum : %-12.6g(%6.3f%%) %-12.6g (%6.3f%%)\n",gen->genid, + sAsqueeze, sAsqueeze * 100. / Atotal, + sAhatl+sAhatr, (sAhatl+sAhatr) * 100. / Atotal); + fprintf(LOG,"%s:\n",gen->genid); + } + } + + /* summary of areas */ + fprintf(LOG,"%s: A(squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, + GEN->Asqueeze, GEN->Asqueeze * 100./Atotal); + fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, + Atotal - GEN->Asqueeze, (Atotal - GEN->Asqueeze) * 100./Atotal); + fprintf(LOG,"%s: A(total) = %-12.6g\n",gen->genid, Atotal); + + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_tdr_ps_debug_intervals() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_tdr_ps_debug_sample( const struct unur_gen *gen, + const struct unur_tdr_interval *iv, + double x, double fx, double hx, double sqx ) + /*----------------------------------------------------------------------*/ + /* write info about generated point */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval */ + /* x ... generated point */ + /* fx ... value of PDF at x */ + /* hx ... value of hat at x */ + /* sqx ... value of squeeze at x */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); + CHECK_NULL(iv,RETURN_VOID); COOKIE_CHECK(iv,CK_TDR_IV,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: construction point: x0 = %g\n",gen->genid,iv->x); + fprintf(LOG,"%s: transformed hat Th(x) = %g + %g * (x - %g)\n",gen->genid,iv->Tfx,iv->dTfx,iv->x); + fprintf(LOG,"%s: squeeze ratio = %g\n",gen->genid,iv->sq); + fprintf(LOG,"%s: generated point: x = %g\n",gen->genid,x); + fprintf(LOG,"%s: h(x) = %.20g\n",gen->genid,hx); + fprintf(LOG,"%s: f(x) = %.20g\n",gen->genid,fx); + fprintf(LOG,"%s: s(x) = %.20g\n",gen->genid,sqx); + + fprintf(LOG,"%s: h(x) - f(x) = %g",gen->genid,hx-fx); + if (hxgenid,fx-sqx); + if (fxgenid); + + fflush(LOG); + +} /* end of _unur_tdr_ps_debug_sample() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_tdr_ps_debug_split_start( const struct unur_gen *gen, + const struct unur_tdr_interval *iv_left, + const struct unur_tdr_interval *iv_right, + double x, double fx ) + /*----------------------------------------------------------------------*/ + /* write info about new splitted intervals */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv_left ... pointer to new left hand interval */ + /* iv_right ... pointer to new right hand interval */ + /* x ... split at this point */ + /* fx ... value of PDF at x */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: split interval at x = %g \t\tf(x) = %g\n",gen->genid,x,fx); + fprintf(LOG,"%s: old intervals:\n",gen->genid); + if (iv_left) { + fprintf(LOG,"%s: left boundary point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_left->ip,iv_left->fip); + fprintf(LOG,"%s: left construction point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_left->x,iv_left->fx); + } + fprintf(LOG,"%s: middle boundary point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_right->ip,iv_right->fip); + if (iv_right->next) { + fprintf(LOG,"%s: right construction point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_right->x,iv_right->fx); + fprintf(LOG,"%s: right boundary point = %-12.6g\tf(x) = %-12.6g\n",gen->genid, + iv_right->next->ip,iv_right->next->fip); + } + + fprintf(LOG,"%s: A(squeeze) =\n",gen->genid); + if (iv_left) + fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, + iv_left->Asqueeze,iv_left->Asqueeze*100./GEN->Atotal); + if (iv_right->next) + fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, + iv_right->Asqueeze,iv_right->Asqueeze*100./GEN->Atotal); + + fprintf(LOG,"%s: A(hat\\squeeze) =\n",gen->genid); + if (iv_left) + fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, + (iv_left->Ahat - iv_left->Asqueeze),(iv_left->Ahat - iv_left->Asqueeze)*100./GEN->Atotal); + if (iv_right->next) + fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, + (iv_right->Ahat - iv_right->Asqueeze),(iv_right->Ahat - iv_right->Asqueeze)*100./GEN->Atotal); + + fprintf(LOG,"%s: A(hat) =\n",gen->genid); + if (iv_left) + fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, + iv_left->Ahat, iv_left->Ahat*100./GEN->Atotal); + if (iv_right->next) + fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, + iv_right->Ahat, iv_right->Ahat*100./GEN->Atotal); + + fflush(LOG); + +} /* end of _unur_tdr_ps_debug_split_start() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_tdr_ps_debug_split_stop( const struct unur_gen *gen, + const struct unur_tdr_interval *iv_left, + const struct unur_tdr_interval *iv_middle, + const struct unur_tdr_interval *iv_right ) + /*----------------------------------------------------------------------*/ + /* write info about new splitted intervals */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv_left ... pointer to new left hand interval */ + /* iv_middle ... pointer to new middle interval */ + /* iv_right ... pointer to new right hand interval */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: new intervals:\n",gen->genid); + + if (iv_left) { + fprintf(LOG,"%s: left boundary point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_left->ip,iv_left->fip); + fprintf(LOG,"%s: left construction point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_left->x,iv_left->fx); + } + if (iv_middle) { + fprintf(LOG,"%s: middle boundary point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_middle->ip,iv_middle->fip); + fprintf(LOG,"%s: middle construction point= %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_middle->x,iv_middle->fx); + } + fprintf(LOG,"%s: middle boundary point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_right->ip,iv_right->fip); + if (iv_right->next) { + fprintf(LOG,"%s: right construction point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_right->x,iv_right->fx); + fprintf(LOG,"%s: right boundary point = %-12.6g\tf(x) = %-12.6g\n",gen->genid, + iv_right->next->ip,iv_right->next->fip); + } + + fprintf(LOG,"%s: A(squeeze) =\n",gen->genid); + if (iv_left) + fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, + iv_left->Asqueeze,iv_left->Asqueeze*100./GEN->Atotal); + if (iv_middle) + fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, + iv_middle->Asqueeze,iv_middle->Asqueeze*100./GEN->Atotal); + if (iv_right->next) + fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, + iv_right->Asqueeze,iv_right->Asqueeze*100./GEN->Atotal); + + fprintf(LOG,"%s: A(hat\\squeeze) =\n",gen->genid); + if (iv_left) + fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, + (iv_left->Ahat - iv_left->Asqueeze),(iv_left->Ahat - iv_left->Asqueeze)*100./GEN->Atotal); + if (iv_middle) + fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, + (iv_middle->Ahat - iv_middle->Asqueeze),(iv_middle->Ahat - iv_middle->Asqueeze)*100./GEN->Atotal); + if (iv_right->next) + fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, + (iv_right->Ahat - iv_right->Asqueeze),(iv_right->Ahat - iv_right->Asqueeze)*100./GEN->Atotal); + + fprintf(LOG,"%s: A(hat) =\n",gen->genid); + if (iv_left) + fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, + iv_left->Ahat, iv_left->Ahat*100./GEN->Atotal); + if (iv_middle) + fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, + iv_middle->Ahat, iv_middle->Ahat*100./GEN->Atotal); + if (iv_right->next) + fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, + iv_right->Ahat, iv_right->Ahat*100./GEN->Atotal); + + fprintf(LOG,"%s: total areas:\n",gen->genid); + fprintf(LOG,"%s: A(squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, + GEN->Asqueeze, GEN->Asqueeze * 100./GEN->Atotal); + fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, + GEN->Atotal - GEN->Asqueeze, (GEN->Atotal - GEN->Asqueeze) * 100./GEN->Atotal); + fprintf(LOG,"%s: A(total) = %-12.6g\n",gen->genid, GEN->Atotal); + + fprintf(LOG,"%s:\n",gen->genid); + + + fflush(LOG); + +} /* end of _unur_tdr_ps_debug_split_stop() */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/methods/tdr_ps_init.ch b/vendor/unuran-1.11.0/src/methods/tdr_ps_init.ch new file mode 100644 index 0000000..959cf57 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tdr_ps_init.ch @@ -0,0 +1,799 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tdr_ps_init.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: transformed density rejection * + * * + * DESCRIPTION: * + * Initializing routines for variant with proportional squeezes. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_tdr_ps_starting_intervals( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* compute intervals for starting points */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tdr_interval *iv, *iv_new, *iv_tmp; + double x,fx; /* construction point, value of PDF at x */ + double lb, flb; /* left boundary point of domain of PDF */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); + CHECK_NULL(GEN->iv,UNUR_ERR_NULL); COOKIE_CHECK(GEN->iv,CK_TDR_IV,UNUR_ERR_COOKIE); + + /* first interval in list */ + iv = GEN->iv; + + /* the left boundary of the domain: + iv->x in the first interval is always the left boundary of + the domain of the PDF */ + lb = iv->x; + flb = iv->fx; + + /* there is no use for a point iv->x that is not used as a + construction point in variants PS and IA. + (In variant GW it is used to store the left boundary of the domain + of the PDF) + Thus we remove it from the list. At such points the slope of the + tangents to the transformed density is set to UNUR_INFINITY. */ + if (_unur_FP_is_infinity(iv->dTfx)) { + GEN->iv = iv->next; + GEN->iv->prev = NULL; + free (iv); + --(GEN->n_ivs); + iv = GEN->iv; + } + + /* set left boundary: + it is stored in iv->ip in the first interval */ + iv->ip = lb; + iv->fip = flb; + + /* compute paramters for all intervals */ + while (iv) { + if (iv->next == NULL) { + /* the last interval in the list*/ + + /* analogously to variant GW we want to have a last virtual + (stopping) interval, that simply stores the right boundary + point and guaranties that the loop in indexed search stops + on an existing interval. + However in the case where iv->x is used as construction point + we have to add such an interval. */ + if (!_unur_FP_is_infinity(iv->dTfx)) { + /* get interval */ + iv->next = iv_new = _unur_tdr_interval_new( gen, iv->x, 0., FALSE ); + if (iv_new == NULL) return UNUR_ERR_GEN_DATA; /* PDF(x) < 0 or overflow !! */ + /* link into list */ + iv_new->prev = iv; + /* copy right boundary of domain */ + iv_new->ip = iv->x; + iv_new->fip = iv->fx; + /* make shure that we will never use this interval for sampling. */ + iv->next->Asqueeze = iv->next->Ahat = iv->next->Ahatr = 0.; + iv->Acum = UNUR_INFINITY; + iv->next-> sq = 0.; + /* we even have to to some additional work */ + } + else + /* nothing to do any more */ + break; + + } + + /* compute parameters for interval */ + switch (_unur_tdr_ps_interval_parameter(gen, iv)) { + case UNUR_SUCCESS: /* computation of parameters for interval successful */ + /* skip to next interval */ + iv = iv->next; + continue; + case UNUR_ERR_INF: /* interval unbounded */ + /* split interval */ + break; + case UNUR_ERR_SILENT: /* construction points too close */ + /* we have to remove this last interval from list */ + /* (the last construction point in the list is a boundary point. + thus we might change the domain of the distribution. + however, we only cut off a piece that is beyond the precesion + of the floating point arithmetic.) */ + iv_tmp = iv->next; + iv->next = iv->next->next; + free(iv_tmp); + --(GEN->n_ivs); + + if (iv->next==NULL) { + /* last (virtuel) interval in list. + make shure that we will never use this segment */ + iv->Asqueeze = iv->Ahat = iv->Ahatr = iv->sq = 0.; + iv->Acum = UNUR_INFINITY; + } + else + /* we need a pointer to the previous entry in the list */ + iv->next->prev = iv; + continue; + default: /* PDF not T-concave */ + return UNUR_ERR_GEN_CONDITION; + } + + /* check if we had to used too many intervals */ + if (GEN->n_ivs >= GEN->max_ivs) { + /* we do not want to create too many intervals */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot create bounded hat!"); + return UNUR_ERR_GEN_CONDITION; + } + + /* area below hat infinite --> insert new construction point. + We have to find out on which side of the construction point + the area of the hat is unbounded. */ + if (iv->Ahatr >= UNUR_INFINITY) { + /* right hand side */ + + /* iv should never be the last (virtual) interval */ + CHECK_NULL(iv->next,0); + + /* use mean point between the construction point and the right + boundary of the interval. + (The right boundary point might be a better choice + but cannot be used in every case.) */ + x = _unur_arcmean(iv->x,iv->next->ip); + fx = PDF(x); + + iv_new = _unur_tdr_interval_new( gen, x, fx, FALSE ); + if (iv_new == NULL) return UNUR_ERR_GEN_DATA; /* PDF(x) < 0 or overflow !! */ + + /* if fx is 0, then we can cut off the tail of the distribution + (since it must be T-concave) */ + if (fx <= 0.) { + if (iv->next->fx > 0.) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave!"); + free(iv_new); + return UNUR_ERR_GEN_CONDITION; + } + + /* cut off right tail */ + free(iv->next); + --(GEN->n_ivs); + iv->next = iv_new; + iv_new->prev = iv; + + } + + else { + /* insert the new interval into the linked list after the old one. */ + iv_new->prev = iv; + iv_new->next = iv->next; + iv->next->prev = iv_new; + iv->next = iv_new; + } + /* the old interval has to be recomputed. */ + + } + + else { + /* left hand side */ + + x = _unur_arcmean(iv->ip,iv->x); + fx = PDF(x); + + iv_new = _unur_tdr_interval_new( gen, x, fx, FALSE ); + if (iv_new == NULL) return UNUR_ERR_GEN_DATA; /* PDF(x) < 0 or overflow !! */ + + + /* if fx is 0, then we can cut off the tail of the distribution + (since it must be T-concave) */ + if (fx <= 0.) { + if (iv->fx > 0.) { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave!"); + free(iv_new); + return UNUR_ERR_GEN_CONDITION; + } + + /* cut off left tail */ + iv_new->next = iv->next; + iv_new->prev = iv->prev; + iv_new->ip = iv->ip; + iv_new->fip = iv->fip; + --(GEN->n_ivs); + GEN->iv = iv_new; + /* continue with this new interval */ + free(iv); + iv = iv_new; + } + + else { + + if (iv->prev) { + /* insert new interval in just before the old unbounded one */ + iv_tmp = iv->prev; + iv_new->prev = iv->prev; + iv_new->next = iv; + iv->prev->next = iv_new; + iv->prev = iv_new; + + /* make sure that _unur_arcmean(iv->ip,iv->x) is never out of range */ + iv_new->ip = iv->ip; + + /* continue with the interval before the old one + (neccessary since it will change too). */ + iv = iv_tmp; + } + else { /* iv->prev == NULL */ + /* insert new interval as first entry in list */ + iv_new->ip = iv->ip; + iv_new->fip = iv->fip; + iv_new->prev = NULL; + iv_new->next = iv; + iv->prev = iv_new; + GEN->iv = iv_new; + + /* continue with this new interval */ + iv = iv_new; + } + } + } + } + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_tdr_ps_starting_intervals() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_tdr_ps_dars( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* run derandomized adaptive rejection sampling (Gilks&Wild) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tdr_interval *iv, *iv_next; + double Adiff; /* area between hat and squeeze */ + double Alimit; /* threshhold value for splitting interval */ + double squeeze_gw; /* slope of squeeze in variant GW */ + double Asqueeze_gw; /* area below squeeze in variant GW */ + double Ahat_gw; /* area below hat in variant GW */ + double x0, x1; /* boundary of interval */ + double xsp, fxsp; /* splitting point in interval */ + double xAhatl, xAhatr, xAsqueeze_gw; + int rule; /* id for splitting rule that has been applied */ + int n_splitted; /* count splitted intervals */ + int splitted; /* result of splitting routine */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); + + /* split intervals */ + while ( (GEN->max_ratio * GEN->Atotal > GEN->Asqueeze) && + (GEN->n_ivs < GEN->max_ivs) ) { + + /* compute threshhold value. every interval with area between + hat and squeeze greater than this value will be splitted. */ + if (GEN->n_ivs > 1) + Alimit = GEN->darsfactor * ( (GEN->Atotal - GEN->Asqueeze) / GEN->n_ivs ); + else + /* we split every interval if there are only one interval */ + Alimit = 0.; + + /* reset counter for splitted intervals */ + n_splitted = 0; + + /* for all intervals do ... */ + for (iv = GEN->iv; iv != NULL; iv = iv->next ) { + COOKIE_CHECK(iv,CK_TDR_IV,UNUR_ERR_COOKIE); + + /* do not exceed the maximum number of intervals */ + if (GEN->n_ivs >= GEN->max_ivs) + break; + + /* boundary of interval: + in opposition to GW the construction point is in the middle of + an interval. The boundary points are the intersection points of + the tangents. Notice that it does not make sense to have a + splitting point near the construction point in the middle of + the interval. + Thus we use the same intervals as in GW, i.e., the intervals + between the construction points. However, now we have to + compute some data and the first and last interval has to + be treated differently. + */ + if (iv==GEN->iv) { + /* the first interval */ + x0 = iv->ip; /* left boundary of interval */ + x1 = iv->x; /* right boundary of interval */ + Adiff = iv->Ahat - iv->Ahatr; /* area below hat */ + Adiff *= 1. - iv->sq; /* area between hat and squeeze */ + } + else { + /* all the other intervals: + we use the intervals between the preceeding construction point + and the construction point in the given interval for + finding a splitting point. */ + x0 = iv->prev->x; /* left boundary of interval */ + x1 = iv->x; /* right boundary of interval */ + /* area between hat and squeeze. + (notice: we habe two parts in two intervals.) */ + Adiff = ( (1. - iv->prev->sq) * iv->prev->Ahatr + + (1. - iv->sq) * (iv->Ahat - iv->Ahatr) ); + } + + /* we skip over all intervals where the area between hat and + squeeze does not exceed the threshhold value. */ + if (Adiff <= Alimit) + continue; /* goto next interval */ + + /* get splitting point */ + for (rule = GEN->darsrule; rule <= 3; rule++) { + switch (rule) { + case 1: /* rule 1: expected value */ + + if ( _unur_FP_is_minus_infinity(x0) || + _unur_FP_is_infinity(x1) || + _unur_FP_approx(x0,x1) ) + /* we do not use the expected value in case of unbounded intervals */ + continue; /* try next rule */ + + /* l.h.s. hat */ + xAhatl = ( (iv->prev == NULL) ? 0. : + _unur_tdr_interval_xxarea( gen, iv->prev, iv->prev->dTfx, iv->ip) ); + /* r.h.s. hat */ + xAhatr = _unur_tdr_interval_xxarea( gen, iv, iv->dTfx, iv->ip); + + /* area below hat */ + Ahat_gw = ( ((iv->prev == NULL) ? 0. : iv->prev->Ahatr) + + (iv->Ahat - iv->Ahatr) ); + + /* squeeze */ + if (iv->Asqueeze > 0. && iv->prev != NULL) { + /* slope of transformed squeeze for variant GW */ + squeeze_gw = (iv->Tfx - iv->prev->Tfx) / (iv->x - iv->prev->x); + + /* always integrate from point with greater value of transformed density + to the other point */ + xAsqueeze_gw = (iv->Tfx > iv->prev->Tfx) + ? _unur_tdr_interval_xxarea( gen, iv, squeeze_gw, iv->prev->x) + : _unur_tdr_interval_xxarea( gen, iv->prev, squeeze_gw, iv->x); + Asqueeze_gw = (iv->Tfx > iv->prev->Tfx) + ? _unur_tdr_interval_area( gen, iv, squeeze_gw, iv->prev->x) + : _unur_tdr_interval_area( gen, iv->prev, squeeze_gw, iv->x); + + /* check for fatal numerical errors */ + if (!_unur_isfinite(Asqueeze_gw)) Asqueeze_gw = 0.; + + } + else { /* there is no squeeze */ + xAsqueeze_gw = 0.; + Asqueeze_gw = 0.; + } + + /* check results */ + if (! (_unur_isfinite(xAhatl) && _unur_isfinite(xAhatr) && _unur_isfinite(xAsqueeze_gw)) + || _unur_FP_equal(Ahat_gw,Asqueeze_gw) ) + continue; /* try next rule */ + + /* compute expected value */ + xsp = (xAhatl+xAhatr-xAsqueeze_gw) / (Ahat_gw - Asqueeze_gw); + break; + + case 2: /* rule 2: arcmean */ + xsp = _unur_arcmean(x0,x1); + break; + + case 3: /* rule 3: mean */ + if (_unur_FP_is_minus_infinity(x0) || _unur_FP_is_infinity(x1)) + /* no arithmetic mean for unbounded intervals */ + continue; /* try next rule */ + xsp = 0.5 * (x0 + x1); + break; + + default: /* this should not happen */ + continue; + } + + /* value of PDF at splitting point */ + fxsp = PDF(xsp); + + /* store pointer to next interval */ + iv_next = iv->next; + + /* now split interval at given point. + we have to take care that xsp might be either in + interval iv or in its preceeding interval, depending + whether xsp is less than iv->ip or not. */ + + splitted = _unur_tdr_ps_interval_split(gen, ((xspip)?iv->prev:iv), xsp, fxsp); + + if (splitted==UNUR_SUCCESS || splitted==UNUR_ERR_INF) { + /* splitting successful */ + if (splitted==UNUR_SUCCESS) ++n_splitted; + /* otherwise the area below the hat was not bounded */ + + /* now depending on the location of xps in the interval iv, + iv points to the left of the two new intervals, + or to the right of the two new intervals. + For the first case we have to move the pointer to the + new right interval. Then iv will be moved to the next + old interval in the list by the for loop. + We can distinguish between these two cases by looking + at the iv->next pointer and compare it the pointer in the + old unsplitted interval. */ + if (iv->next != iv_next) + iv = iv->next; + /* no more splitting points in this interval */ + break; + } + else if (splitted!=UNUR_ERR_SILENT) { + /* some serious error occurred */ + /* condition for PDF is violated! */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,""); + return UNUR_ERR_GEN_CONDITION; + } + /* else: could not split construction points: too close (?) */ + } + } + + if (n_splitted == 0) { + /* we are not successful in splitting any inteval. + abort to avoid endless loop */ + _unur_warning(gen->genid,UNUR_ERR_GENERIC,"DARS aborted: no intervals could be splitted."); + break; + } + } + + /* ratio between squeeze and hat o.k. ? */ + if ( GEN->max_ratio * GEN->Atotal > GEN->Asqueeze ) { + if ( GEN->n_ivs >= GEN->max_ivs ) + _unur_warning(gen->genid,UNUR_ERR_GENERIC,"DARS aborted: maximum number of intervals exceeded."); + _unur_warning(gen->genid,UNUR_ERR_GENERIC,"hat/squeeze ratio too small."); + } + else { + /* no more construction points */ + GEN->max_ivs = GEN->n_ivs; + } + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_tdr_ps_dars() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_tdr_ps_interval_parameter( struct unur_gen *gen, struct unur_tdr_interval *iv ) + /*----------------------------------------------------------------------*/ + /* compute intersection point of tangents and */ + /* the area below the hat (proportional squeezes) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... if successful */ + /* UNUR_ERR_SILENT ... do not add this construction point */ + /* UNUR_ERR_INF ... area = UNUR_INFINITY */ + /* others ... error (PDF not T-concave) */ + /*----------------------------------------------------------------------*/ +{ + double Ahatl; /* area below hat at left side of intersection point */ + double hxl, hxr; /* value of hat at left and right point of interval */ + double sq; /* ration PDF(x) / hat(x) */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); + CHECK_NULL(iv,UNUR_ERR_NULL); COOKIE_CHECK(iv,CK_TDR_IV,UNUR_ERR_COOKIE); + + /* get intersection point of tangents. it is used as boundaries of intervals. + it is stored together with the right hand (i.e. next) construction point. */ + if (_unur_tdr_tangent_intersection_point(gen,iv,&(iv->next->ip))!=UNUR_SUCCESS) + return UNUR_ERR_GEN_CONDITION; + /* value of PDF at intersection point */ + iv->next->fip = _unur_FP_is_infinity(iv->next->ip) ? 0. : PDF(iv->next->ip); + + /* volume below hat */ + Ahatl = _unur_tdr_interval_area( gen, iv, iv->dTfx, iv->ip); + iv->Ahatr = _unur_tdr_interval_area( gen, iv, iv->dTfx, iv->next->ip); + + /* areas below head unbounded ? */ + if (! (_unur_isfinite(Ahatl) && _unur_isfinite(iv->Ahatr)) ) + return UNUR_ERR_INF; + + /* total area */ + iv->Ahat = iv->Ahatr + Ahatl; + + /* compute squeeze: + squeeze ration = min_{boundary points} PDF(x) / hat(x) */ + + /* left boundary point */ + hxl = _unur_tdr_eval_intervalhat(gen,iv,iv->ip); + if (_unur_FP_greater(iv->fip, hxl) ) { + /* PDF(x) > hat(x); this should not happen */ + if ( (iv->fip < 1.e-50) || _unur_FP_approx(iv->fip, hxl)) { + /* hat(x) and PDF(x) are approximatly the same, or extremely small. + assume round-off error */ + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"hat(x) might be < PDF(x)"); + } + else { + /* we really have PDF(x) > hat(x); we do not assume a round-off error */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"hat(x) < PDF(x)"); + return UNUR_ERR_GEN_CONDITION; + } + } + iv->sq = (_unur_FP_is_infinity(hxl) || hxl <= 0.) ? 0. : iv->fip / hxl; + + /* right boundary point */ + hxr = _unur_tdr_eval_intervalhat(gen,iv,iv->next->ip); + if (_unur_FP_greater(iv->next->fip, hxr)) { + /* PDF(x) > hat(x); this should not happen */ + if ((iv->next->fip < 1.e-50) || _unur_FP_approx(iv->next->fip, hxr)) { + /* hat(x) and PDF(x) are approximatly the same, or extremely small. + assume round-off error */ + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"hat(x) might be < PDF(x)"); + } + else { + /* we really have PDF(x) > hat(x); we do not assume a round-off error */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"hat(x) < PDF(x)"); + return UNUR_ERR_GEN_CONDITION; + } + } + sq = (_unur_FP_is_infinity(hxr) || hxr <= 0.) ? 0. : iv->next->fip / hxr; + + /* squeeze */ + if (iv->sq > sq) iv->sq = sq; + + /* area below squeeze */ + iv->Asqueeze = iv->Ahat * iv->sq; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_tdr_ps_interval_parameter() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_tdr_ps_interval_split( struct unur_gen *gen, struct unur_tdr_interval *iv, double x, double fx ) + /*----------------------------------------------------------------------*/ + /* split interval iv into two intervals at point x */ + /* old interval -> left hand side */ + /* new interval -> right hand side */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval */ + /* x ... left point of new segment */ + /* fx ... value of PDF at x */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... if successful */ + /* UNUR_ERR_SILENT ... if no intervals are splitted */ + /* others ... error */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tdr_interval *oldl, *oldr; /* pointer to old intervals (left, right) */ + struct unur_tdr_interval *iv_new; /* pointer to new interval */ + struct unur_tdr_interval oldl_bak, oldr_bak; /* space for backing up data of interval */ + int success, success_r; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); + CHECK_NULL(iv,UNUR_ERR_NULL); COOKIE_CHECK(iv,CK_TDR_IV,UNUR_ERR_COOKIE); + + /* we cannot split point when x is not finite (NaN or Infinity) */ + if (!_unur_isfinite(x)) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"splitting point not finite (skipped)"); + return UNUR_ERR_SILENT; + } + + /* we only add a new construction point, if the relative area is large enough */ + if ( (GEN->n_ivs * (iv->Ahat - iv->Asqueeze) / (GEN->Atotal - GEN->Asqueeze)) + < GEN->bound_for_adding) + return UNUR_ERR_SILENT; + + /* the splitting point must be inside the interval */ + if (x < iv->ip || x > iv->next->ip) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"splitting point not in interval!"); + return UNUR_ERR_SILENT; + } + + /* check for data error */ + if (fx < 0.) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) < 0.!"); + return UNUR_ERR_GEN_DATA; + } + + /* which side of construction point */ + if (x < iv->x) { + /* left hand side */ + oldl = iv->prev; + oldr = iv; + } + else { + /* right hand side */ + oldl = iv; + oldr = iv->next; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & TDR_DEBUG_SPLIT) + _unur_tdr_ps_debug_split_start( gen,oldl,oldr,x,fx ); +#endif + + /* back up data */ + if (oldl) memcpy(&oldl_bak, oldl, sizeof(struct unur_tdr_interval)); + memcpy(&oldr_bak, oldr, sizeof(struct unur_tdr_interval)); + + /* check if the new interval is completely outside the support of PDF */ + if (fx <= 0.) { + + /* one of the two boundary points must be 0, too! */ + if (oldr->fip <= 0. && oldl==NULL) { + /* chop off left part (it's out of support) */ + oldr->ip = x; + oldr->fip = 0.; + } + else if (oldr->fip <= 0. && oldr->next==NULL) { + /* chop off right part (it's out of support) */ + oldr->x = x; + oldr->ip = x; + oldr->fip = 0.; + } + else { + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave"); + return UNUR_ERR_GEN_CONDITION; + } + + /* we do not add a new interval */ + iv_new = NULL; + } + + else { + + /* we need a new interval */ + iv_new = _unur_tdr_interval_new( gen, x, fx, FALSE ); + if (iv_new == NULL) { + /* PDF(x) < 0 or overflow !! */ + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return -1; + } + + /* insert into linked list */ + iv_new->prev = oldl; + iv_new->next = oldr; + oldr->prev = iv_new; + if (oldl) oldl->next = iv_new; + + } + + /* compute parameters for intervals */ + success = UNUR_SUCCESS; + /* left hand interval */ + if (oldl) { + success = _unur_tdr_ps_interval_parameter(gen, oldl); + } + if( iv_new ) { + /* middle (newly created) interval) */ + if (!oldl) { + /* we have to copy the left intersection point from the + right hand interval */ + iv_new->ip = oldr->ip; + iv_new->fip = oldr->fip; + } + success_r = _unur_tdr_ps_interval_parameter(gen, iv_new); + /* worst of success and success_r */ + if (success_r!=UNUR_SUCCESS) + if ((success_r!=UNUR_ERR_SILENT&&success_r!=UNUR_ERR_INF) || + (success==UNUR_SUCCESS||success==UNUR_ERR_SILENT||success==UNUR_ERR_INF)) + success = success_r; + } + if ( oldr->next ) { + /* right hand interval */ + success_r = _unur_tdr_ps_interval_parameter(gen, oldr); + if (success_r!=UNUR_SUCCESS) + if ((success_r!=UNUR_ERR_SILENT&&success_r!=UNUR_ERR_INF) || + (success==UNUR_SUCCESS||success==UNUR_ERR_SILENT||success==UNUR_ERR_INF)) + success = success_r; + } + + /* successfull ? */ + if (success!=UNUR_SUCCESS) { + /* cannot split interval at given point */ + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"Cannot split interval at given point."); + if (success!=UNUR_ERR_SILENT && success!=UNUR_ERR_INF) + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave"); + + /* the case of unbounded hat is treated as round-off error for + very steep tangents. so we simply do not add this construction point. */ + + /* restore old interval */ + if (oldl) memcpy(oldl, &oldl_bak, sizeof(struct unur_tdr_interval)); + memcpy(oldr, &oldr_bak, sizeof(struct unur_tdr_interval)); + /* remove from linked list; remaines to restore prev pointer in next interval */ + oldr->prev = oldl; + if (oldl) oldl->next = oldr; + + /* decrement counter for intervals and free unused interval */ + if (iv_new) { + --(GEN->n_ivs); + free( iv_new ); + } + + return success; + } + + /* successful */ + + /* we have update the pointer to the list */ + if (oldl == NULL && iv_new) + /* new first entry */ + GEN->iv = iv_new; + + /* update total area below hat and squeeze */ + GEN->Atotal = ( GEN->Atotal + (oldr->Ahat - oldr_bak.Ahat) + + ((oldl) ? (oldl->Ahat - oldl_bak.Ahat) : 0.) + + ((iv_new) ? iv_new->Ahat : 0.) ); + GEN->Asqueeze = ( GEN->Asqueeze + (oldr->Asqueeze - oldr_bak.Asqueeze) + + ((oldl) ? (oldl->Asqueeze - oldl_bak.Asqueeze) : 0.) + + ((iv_new) ? iv_new->Asqueeze : 0.) ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & TDR_DEBUG_SPLIT) + _unur_tdr_ps_debug_split_stop( gen,oldl,iv_new,oldr ); +#endif + + /* when using inside Gibbs sampler Atotal might be 0 */ + if (GEN->Atotal <= 1.e10 * DBL_MIN) { + _unur_error(gen->genid,UNUR_ERR_ROUNDOFF,"error below hat (almost) 0"); + return UNUR_ERR_ROUNDOFF; + } + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_tdr_ps_interval_split() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/tdr_ps_sample.ch b/vendor/unuran-1.11.0/src/methods/tdr_ps_sample.ch new file mode 100644 index 0000000..c1f0a65 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tdr_ps_sample.ch @@ -0,0 +1,479 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tdr_ps_sample.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: transformed density rejection * + * * + * DESCRIPTION: * + * Sampling routines for variant with proportional squeezes. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Sampling routines **/ +/*****************************************************************************/ + +double +_unur_tdr_ps_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator (proportional squeeze) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /* */ + /*======================================================================*/ + /* comment: */ + /* x ... random point */ + /* x0 ... left construction point in interval */ + /* x1 ... right construction point in interval */ + /* f ... PDF */ + /* Tf ... transformed PDF */ + /* dTf ... derivative of transformed PDF */ + /* sq ... slope of squeeze in interval */ + /* */ + /*----------------------------------------------------------------------*/ + /* if (Tf)'(x0) == 0: */ + /* X = x0 + U / f(x0) */ + /* U ~ U(0,area below hat) */ + /* */ + /*----------------------------------------------------------------------*/ + /* log(x): */ + /* */ + /* hat(x) = f(x0) * exp( (Tf)'(x0) * (x-x0) ) */ + /* generation: */ + /* X = x0 + 1/(Tf)'(x0) * \log( (Tf)'(x0)/f(x0) * U + 1 ) */ + /* U ~ U(-area below left hat, area below left hat) */ + /* */ + /*----------------------------------------------------------------------*/ + /* T(x) = -1/sqrt(x): */ + /* */ + /* hat(x) = 1 / (Tf(x0) + (Tf)'(x0) * (x-x0))^2 */ + /* generation: */ + /* X = x0 + (Tf(x0)^2 * U) / (1 - Tf(x0) * (Tf)'(x0) * U) */ + /* U ~ U(-area below left hat, area below left hat) */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng; /* pointer to uniform random number generator */ + struct unur_tdr_interval *iv; + double U, V; /* uniform random number */ + double X; /* generated point */ + double fx; /* value of density at X */ + double Thx; /* value of transformed hat at X */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); + + if (GEN->iv == NULL) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"empty generator object"); + return UNUR_INFINITY; + } + + /* main URNG */ + urng = gen->urng; + + while (1) { + + /* sample from U( Umin, Umax ) */ + U = GEN->Umin + _unur_call_urng(urng) * (GEN->Umax - GEN->Umin); + + /* look up in guide table and search for segment */ + iv = GEN->guide[(int) (U * GEN->guide_size)]; + U *= GEN->Atotal; + while (iv->Acum < U) { + iv = iv->next; + } + + /* reuse of uniform random number */ + U -= iv->Acum - iv->Ahatr; /* result: U in (-A_hatl, A_hatr) */ + + /* generate from hat distribution */ + switch (gen->variant & TDR_VARMASK_T) { + + case TDR_VAR_T_LOG: + if (_unur_iszero(iv->dTfx)) + X = iv->x + U / iv->fx; + else { + double t = iv->dTfx * U / iv->fx; + if (fabs(t) > 1.e-6) + /* x = iv->x + log(t + 1.) / iv->dTfx; is cheaper but numerical unstable */ + X = iv->x + log(t + 1.) * U / (iv->fx * t); + else if (fabs(t) > 1.e-8) + /* use Taylor series */ + X = iv->x + U / iv->fx * (1 - t/2. + t*t/3.); + else + X = iv->x + U / iv->fx * (1 - t/2.); + } + break; + + case TDR_VAR_T_SQRT: + if (_unur_iszero(iv->dTfx)) + X = iv->x + U / iv->fx; + else { + /* it would be less expensive to use: + X = iv->x + iv->Tfx/iv->dTfx * (1. - 1./(1. + iv->dTfx * iv->Tfx * U) ) + however, this is unstable for small iv->dTfx */ + X = iv->x + (iv->Tfx*iv->Tfx*U) / (1.-iv->Tfx*iv->dTfx*U); + /* It cannot happen, that the denominator becomes 0 ! */ + } + break; + + case TDR_VAR_T_POW: + /** TODO **/ + + default: + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_INFINITY; + + } /* end switch */ + + /* accept or reject */ + V = _unur_call_urng(urng); + + /* squeeze rejection */ + if (V <= iv->sq) + return X; + + /* evaluate hat at X: + get uniform random number between 0 and hat(X) */ + switch (gen->variant & TDR_VARMASK_T) { + case TDR_VAR_T_LOG: + V *= iv->fx * exp(iv->dTfx*(X - iv->x)); break; + case TDR_VAR_T_SQRT: + Thx = iv->Tfx + iv->dTfx * (X - iv->x); /* transformed hat at X */ + V *= 1./(Thx*Thx); break; + case TDR_VAR_T_POW: + /** TODO **/ + default: + return UNUR_INFINITY; + } /* end switch */ + + /* evaluate PDF at X */ + fx = PDF(X); + + /* main rejection */ + if (V <= fx) + return X; + + /* being above squeeze is bad. improve the situation! */ + if (GEN->n_ivs < GEN->max_ivs) { + if ( (_unur_tdr_ps_improve_hat( gen, iv, X, fx) != UNUR_SUCCESS) + && (gen->variant & TDR_VARFLAG_PEDANTIC) ) + return UNUR_INFINITY; + } + + /* else reject and try again */ + + /* use the auxilliary generator the next time + (it can be the same as the main generator) */ + urng = gen->urng_aux; + + } + +} /* end of _unur_tdr_ps_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_tdr_ps_sample_check( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator and verify results (proportional squeeze) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng; /* pointer to uniform random number generator */ + struct unur_tdr_interval *iv; + double U, V; /* uniform random number */ + double X; /* generated point */ + double fx, sqx, hx; /* values of density, squeeze, and hat at X */ + int squeeze_rejection = FALSE; /* indicates squeeze rejection */ +#ifdef UNUR_ENABLE_LOGGING + int error = 0; /* indicates error */ +#endif + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); + + if (GEN->iv == NULL) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"empty generator object"); + return UNUR_INFINITY; + } + + /* main URNG */ + urng = gen->urng; + + while (1) { + + /* sample from U( Umin, Umax ) */ + U = GEN->Umin + _unur_call_urng(urng) * (GEN->Umax - GEN->Umin); + + /* evaluate inverse of hat CDF */ + X = _unur_tdr_ps_eval_invcdfhat( gen, U, &hx, &fx, &sqx, &iv ); + + /* accept or reject */ + V = _unur_call_urng(urng); + + /* squeeze rejection */ + if (V <= iv->sq) + squeeze_rejection = TRUE; + + /* get uniform random number between 0 and hat(X) */ + V *= hx; + + /* check result */ + if (_unur_FP_less(X, DISTR.BD_LEFT) || _unur_FP_greater(X, DISTR.BD_RIGHT) ) { + _unur_warning(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,"generated point out of domain"); +#ifdef UNUR_ENABLE_LOGGING + error = 1; +#endif + } + if (_unur_FP_greater(fx, hx)) { + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF > hat. Not T-concave!"); +#ifdef UNUR_ENABLE_LOGGING + error = 1; +#endif + } + if (_unur_FP_less(fx, sqx)) { + _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF < squeeze. Not T-concave!"); +#ifdef UNUR_ENABLE_LOGGING + error = 1; +#endif + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file (in case error) */ + if (error && (gen->debug & TDR_DEBUG_SAMPLE)) + _unur_tdr_ps_debug_sample( gen, iv, X, fx, hx, sqx ); +#endif + + /* squeeze rejection */ + if (squeeze_rejection) + return X; + + /* main rejection */ + if (V <= fx) + return X; + + /* being above squeeze is bad. improve the situation! */ + if (GEN->n_ivs < GEN->max_ivs) { + if ( (_unur_tdr_ps_improve_hat( gen, iv, X, fx) != UNUR_SUCCESS) + && (gen->variant & TDR_VARFLAG_PEDANTIC) ) + return UNUR_INFINITY; + } + + /* else reject and try again */ + + /* use the auxilliary generator the next time + (it can be the same as the main generator) */ + urng = gen->urng_aux; + + } +} /* end of _unur_tdr_ps_sample_check() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_tdr_ps_eval_invcdfhat( const struct unur_gen *gen, double U, + double *hx, double *fx, double *sqx, + struct unur_tdr_interval **ivl ) + /*----------------------------------------------------------------------*/ + /* evaluate the inverse of the hat CDF at u */ + /* (original variant by Gilks & Wild) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* U ... argument for inverse CDF (0<=U<=1, no validation!) */ + /* hx ... pointer for storing hat at sampled X */ + /* fx ... pointer for storing squeeze at sampled X */ + /* sqx ... pointer for storing density at sampled X */ + /* ivl ... pointer to interval for hat */ + /* */ + /* return: */ + /* inverse hat CDF. */ + /* */ + /* values of hat, density, squeeze (computation is suppressed if */ + /* corresponding pointer is NULL). */ + /* */ + /* ivl can be NULL. then no pointer is stored. */ + /*----------------------------------------------------------------------*/ +{ + struct unur_tdr_interval *iv; /* pointer to intervals */ + double X; /* inverse of hat CDF at U */ + double Thx; /* transformed squeeze */ + double t; /* aux variable */ + + /** -1- Compute inverse of hat CDF at U **/ + + /* look up in guide table and search for segment */ + iv = GEN->guide[(int) (U * GEN->guide_size)]; + U *= GEN->Atotal; + while (iv->Acum < U) { + iv = iv->next; + } + + /* transform u such that u in (-A_hatl, A_hatr) */ + /* (reuse of uniform random number) */ + U -= iv->Acum - iv->Ahatr; + + /* inverse of CDF (random variate) */ + switch (gen->variant & TDR_VARMASK_T) { + + case TDR_VAR_T_LOG: + if (_unur_iszero(iv->dTfx)) + X = iv->x + U / iv->fx; + else { + t = iv->dTfx * U / iv->fx; + if (fabs(t) > 1.e-6) + /* x = iv->x + log(t + 1.) / iv->dTfx; is cheaper but numerical unstable */ + X = iv->x + log(t + 1.) * U / (iv->fx * t); + else if (fabs(t) > 1.e-8) + /* use Taylor series */ + X = iv->x + U / iv->fx * (1 - t/2. + t*t/3.); + else + X = iv->x + U / iv->fx * (1 - t/2.); + } + break; + + case TDR_VAR_T_SQRT: + if (_unur_iszero(iv->dTfx)) + X = iv->x + U / iv->fx; + else { + /* it would be less expensive to use: + X = iv->x + iv->Tfx/iv->dTfx * (1. - 1./(1. + iv->dTfx * iv->Tfx * U) ) + however, this is unstable for small iv->dTfx */ + X = iv->x + (iv->Tfx*iv->Tfx*U) / (1.-iv->Tfx*iv->dTfx*U); + /* It cannot happen, that the denominator becomes 0 ! */ + } + break; + + case TDR_VAR_T_POW: + /** TODO **/ + + default: + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_INFINITY; + + } /* end switch */ + + /** -2- Evaluate hat at X **/ + if (hx != NULL) + switch (gen->variant & TDR_VARMASK_T) { + case TDR_VAR_T_LOG: + *hx = iv->fx * exp(iv->dTfx*(X - iv->x)); + break; + case TDR_VAR_T_SQRT: + Thx = iv->Tfx + iv->dTfx * (X - iv->x); /* transformed hat at X */ + *hx = 1./(Thx*Thx); + break; + case TDR_VAR_T_POW: + /** TODO **/ + default: + *hx = UNUR_INFINITY; + } /* end switch */ + + /** -3- Evaluate density at X **/ + if (fx != NULL) { + *fx = PDF(X); + } + + /** -4- Evaluate squeeze at X **/ + if (sqx != NULL && hx != NULL) { + *sqx = *hx * iv->sq; + } + + /* store interval pointer */ + if (ivl) *ivl = iv; + + return X; +} /* end of _unur_tdr_ps_eval_invcdfhat() */ + + +/*---------------------------------------------------------------------------*/ + +int +_unur_tdr_ps_improve_hat( struct unur_gen *gen, struct unur_tdr_interval *iv, + double x, double fx ) + /*----------------------------------------------------------------------*/ + /* improve hat function by splitting interval */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* iv ... pointer to interval that has to be split */ + /* x ... splitting point */ + /* fx ... value of PDF at splitting point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... improving hat successful */ + /* others ... error: PDF not monotone in interval */ + /*----------------------------------------------------------------------*/ +{ + int result; + + /* is there any reason to improve hat ? */ + if (! (GEN->max_ratio * GEN->Atotal > GEN->Asqueeze) ) { + /* no more construction points (avoid calling this function any more) */ + GEN->max_ivs = GEN->n_ivs; + return UNUR_SUCCESS; + } + + /* add construction point */ + result = _unur_tdr_ps_interval_split(gen, iv, x, fx); + if (result!=UNUR_SUCCESS && result!=UNUR_ERR_SILENT && result!=UNUR_ERR_INF) { + /* condition for PDF is violated! */ + _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,""); + if (gen->variant & TDR_VARFLAG_PEDANTIC || result == UNUR_ERR_ROUNDOFF) { + /* replace sampling routine by dummy routine that just returns UNUR_INFINITY */ + SAMPLE = _unur_sample_cont_error; + return UNUR_ERR_GEN_CONDITION; + } + } + + /* splitting successful --> update guide table */ + /** TODO: it is not necessary to update the guide table every time. + But then (1) some additional bookkeeping is required and + (2) the guide table method requires a acc./rej. step. **/ + _unur_tdr_make_guide_table(gen); + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of _unur_tdr_ps_improve_hat() */ + +/*****************************************************************************/ diff --git a/vendor/unuran-1.11.0/src/methods/tdr_sample.ch b/vendor/unuran-1.11.0/src/methods/tdr_sample.ch new file mode 100644 index 0000000..ad3983d --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tdr_sample.ch @@ -0,0 +1,107 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tdr_sample.c * + * * + * TYPE: continuous univariate random variate * + * METHOD: transformed density rejection * + * * + * DESCRIPTION: * + * Given PDF of a T-concave distribution * + * produce a value x consistent with its density * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*****************************************************************************/ +/** Sampling routines **/ +/*****************************************************************************/ + +#include "tdr_gw_sample.ch" +#include "tdr_ia_sample.ch" +#include "tdr_ps_sample.ch" + +/*---------------------------------------------------------------------------*/ + +double +unur_tdr_eval_invcdfhat( const struct unur_gen *gen, double u, + double *hx, double *fx, double *sqx ) + /*----------------------------------------------------------------------*/ + /* evaluate inverse CDF of hat at u */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* u ... argument for inverse CDF (0<=u<=1) */ + /* hx ... pointer for storing hat at sampled X */ + /* fx ... pointer for storing squeeze at sampled X */ + /* sqx ... pointer for storing density at sampled X */ + /* */ + /* return: */ + /* inverse hat CDF. */ + /* */ + /* values of hat, density, squeeze (computation is suppressed if */ + /* corresponding pointer is NULL). */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + if ( gen->method != UNUR_METH_TDR ) { + _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); + return UNUR_INFINITY; + } + COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); + + if (GEN->iv == NULL) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"empty generator object"); + return UNUR_INFINITY; + } + + if ( u<0. || u>1.) { + _unur_warning(gen->genid,UNUR_ERR_DOMAIN,"argument u not in [0,1]"); + } + + /* validate argument */ + if (u<=0.) return DISTR.domain[0]; + if (u>=1.) return DISTR.domain[1]; + + /* compute inverse CDF */ + /* sampling routines */ + switch (gen->variant & TDR_VARMASK_VARIANT) { + case TDR_VARIANT_GW: /* original variant (Gilks&Wild) */ + return _unur_tdr_gw_eval_invcdfhat(gen,u,hx,fx,sqx,NULL,NULL); + case TDR_VARIANT_IA: /* immediate acceptance */ + /* this does not make to much sense, since IA is not + a pure rejection method. Nevertheless, we treat + it in the same way as variant PS. */ + case TDR_VARIANT_PS: /* proportional squeeze */ + return _unur_tdr_ps_eval_invcdfhat(gen,u,hx,fx,sqx,NULL); + default: + _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_INFINITY; + } + +} /* end of unur_tdr_eval_invcdfhat() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/tdr_struct.h b/vendor/unuran-1.11.0/src/methods/tdr_struct.h new file mode 100644 index 0000000..160d5c1 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/tdr_struct.h @@ -0,0 +1,123 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: tdr_struct.h * + * * + * PURPOSE: * + * declares structures for method TDR * + * (Transformed Density Rejection) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_tdr_par { + + double guide_factor; /* relative size of guide table */ + + const double *starting_cpoints; /* pointer to array of starting points */ + int n_starting_cpoints; /* number of construction points at start */ + + const double *percentiles; /* percentiles of hat for c. points of new hat */ + int n_percentiles; /* number of percentiles */ + int retry_ncpoints; /* number of cpoints for second trial of reinit */ + + int max_ivs; /* maximum number of intervals */ + double max_ratio; /* bound for ratio r_n = Atotal / Asqueeze */ + double bound_for_adding; /* lower bound for relative area */ + + double c_T; /* parameter c for transformation T_c */ + double darsfactor; /* factor for derandomized ARS */ + int darsrule; /* rule for finding splitting points in DARS */ +}; + +/*---------------------------------------------------------------------------*/ +/* store data for segments */ + +struct unur_tdr_interval { + + double x; /* (left) construction point (cp) */ + double fx; /* value of PDF at cp */ + double Tfx; /* value of transformed PDF at cp */ + double dTfx; /* derivative of transformed PDF at cp */ + double sq; /* slope of transformed squeeze in interval */ + double ip; /* intersection point between two tangents */ + double fip; /* value of PDF at ip (for PS and IA only) */ + + double Acum; /* cumulated area of intervals */ + double Ahat; /* area below hat */ + double Ahatr; /* area below hat on right side */ + double Asqueeze; /* area squeeze */ + + struct unur_tdr_interval *next; /* pointer to next interval in list */ + struct unur_tdr_interval *prev; /* pointer to previous interval in list + (for PS and IA only) */ + +#ifdef UNUR_COOKIES + unsigned cookie; /* magic cookie */ +#endif +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_tdr_gen { + + double Atotal; /* area below hat */ + double Asqueeze; /* area below squeeze */ + + double c_T; /* parameter c for transformation T_c */ + double Umin, Umax; /* bounds for iid random variable in respect to + the given (truncated) domain of the distr.*/ + + struct unur_tdr_interval *iv; /* pointer to linked list of intervals */ + int n_ivs; /* number of intervals */ + int max_ivs; /* maximum number of intervals */ + double max_ratio; /* bound for ratio r_n = Atotal / Asqueeze */ + double bound_for_adding; /* lower bound for relative area */ + + struct unur_tdr_interval **guide; /* pointer to guide table */ + int guide_size; /* size of guide table */ + double guide_factor; /* relative size of guide table */ + + double center; /* approximate location of mode */ + + double *starting_cpoints; /* pointer to array of starting points */ + int n_starting_cpoints; /* number of construction points at start */ + + double *percentiles; /* percentiles of hat for c. points of new hat */ + int n_percentiles; /* number of percentiles */ + int retry_ncpoints; /* number of cpoints for second trial of reinit */ + + double darsfactor; /* factor for derandomized ARS */ + int darsrule; /* rule for finding splitting points in DARS */ +#ifdef UNUR_ENABLE_INFO + int max_ivs_info; /* maximum number of intervals (as given) */ +#endif +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/unif.c b/vendor/unuran-1.11.0/src/methods/unif.c new file mode 100644 index 0000000..2c863f6 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/unif.c @@ -0,0 +1,415 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unif.c * + * * + * dummy generator, produces uniform random numbers in UNURAN framework * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "unif.h" +#include "unif_struct.h" + +/*---------------------------------------------------------------------------*/ +/* Variants: none */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "UNIF" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_unif_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_unif_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_unif_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_unif_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_unif_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_unif_sample( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_INFO +static void _unur_unif_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define PAR ((struct unur_unif_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_unif_gen*)gen->datap) /* data for generator object */ +#define SAMPLE gen->sample.cont + +/*---------------------------------------------------------------------------*/ + +#define _unur_unif_getSAMPLE(gen) ( _unur_unif_sample ) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_unif_new( const struct unur_distr *distr_dummy ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr_dummy ... pointer to a distribution object */ + /* it may be NULL. */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /* */ + /* comment: */ + /* for testing. */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check distribution */ + if (distr_dummy != NULL) { + /* we do not need this the distribution at all. */ + /* but if it is provided it must be a continuous distribution. */ + if (distr_dummy->type != UNUR_DISTR_CONT) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr_dummy,CK_DISTR_CONT,NULL); + } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_unif_par) ); + COOKIE_SET(par,CK_UNIF_PAR); + + /* copy input */ + par->distr = distr_dummy; /* pointer to distribution object */ + + /* set default values */ + par->method = UNUR_METH_UNIF; /* method and default variant */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_unif_init; + + return par; + +} /* end of unur_unif_new() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_unif_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* params pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_UNIF ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_UNIF_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_unif_create(par); + + /* free parameters */ + _unur_par_free(par); + + return gen; + +} /* end of _unur_unif_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_unif_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* (re)set sampling routine */ + SAMPLE = _unur_unif_getSAMPLE(gen); + + /* nothing sensible to do */ + return UNUR_SUCCESS; +} /* end of _unur_utdr_reinit() */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen * +_unur_unif_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); + COOKIE_CHECK(par,CK_UNIF_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_unif_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_UNIF_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_unif_getSAMPLE(gen); + gen->destroy = _unur_unif_free; + gen->clone = _unur_unif_clone; + gen->reinit = _unur_unif_reinit; + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_unif_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_unif_create() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_unif_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_UNIF_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + return clone; +} /* end of _unur_unif_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_unif_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_UNIF ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_UNIF_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_unif_free() */ + +/*****************************************************************************/ + +double +_unur_unif_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); + COOKIE_CHECK(gen,CK_UNIF_GEN,UNUR_INFINITY); + + /* sample uniform random number */ + return _unur_call_urng(gen->urng); + +} /* end of _unur_unif_sample() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +/** None **/ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_unif_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution: uniform (0,1)\n\n"); + + /* method */ + _unur_string_append(info,"method: UNIF (wrapper for UNIForm random number generator)\n\n"); + + /* Hints */ + if (help) { + _unur_string_append(info,"[Remark: allows using uniform random number generator in UNU.RAN framework]\n"); + } + +} /* end of _unur_unif_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/unif.h b/vendor/unuran-1.11.0/src/methods/unif.h new file mode 100644 index 0000000..ebdb819 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/unif.h @@ -0,0 +1,85 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unif.h * + * * + * PURPOSE: * + * function prototypes for method UNIF * + * (passes UNIForm random numbers through UNU.RAN framework; * + * for testing only) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD UNIF wrapper for UNIForm random number generator + + =UP Methods_for_UNID + + =REINIT supported + + =DESCRIPTION + UNIF is a simple wrapper that makes it possible to use a uniform + random number generator as a UNU.RAN generator. There are no + parameters for this method. + + =HOWTOUSE + Create a generator object with NULL as argument. The created generator + object returns raw random numbers from the underlying uniform + random number generator. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_unif_new( const UNUR_DISTR *dummy ); +/* + Get default parameters for generator. + UNIF does not need a distribution object. @var{dummy} is not used and + can (should) be set to NULL. It is used to keep the API consistent. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ + + + + + + + + + + + + diff --git a/vendor/unuran-1.11.0/src/methods/unif_struct.h b/vendor/unuran-1.11.0/src/methods/unif_struct.h new file mode 100644 index 0000000..673ea30 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/unif_struct.h @@ -0,0 +1,46 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unif_struct.h * + * * + * PURPOSE: * + * declares structures for method UNIF * + * (passes UNIForm random numbers through UNURAN framework; * + * for testing only) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_unif_par { int dummy; }; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_unif_gen { int dummy; }; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/unur_methods.h b/vendor/unuran-1.11.0/src/methods/unur_methods.h new file mode 100644 index 0000000..7af80ff --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/unur_methods.h @@ -0,0 +1,128 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unur_methods.h * + * * + * PURPOSE: * + * defines bitmasks to identify used method in generator objects * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef UNUR_METHODS_H_SEEN +#define UNUR_METHODS_H_SEEN +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Bitmask to indicate methods **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* bitmasks */ + +#define UNUR_MASK_TYPE 0xff000000u /* indicate type of method */ + +/* discrete distributions */ +#define UNUR_METH_DISCR 0x01000000u + +#define UNUR_METH_DARI 0x01000001u +#define UNUR_METH_DAU 0x01000002u +#define UNUR_METH_DGT 0x01000003u +#define UNUR_METH_DSROU 0x01000004u +#define UNUR_METH_DSS 0x01000005u + +/* continuous distributions */ +#define UNUR_METH_CONT 0x02000000u + +#define UNUR_METH_AROU 0x02000100u +#define UNUR_METH_ARS 0x02000d00u +#define UNUR_METH_HINV 0x02000200u +#define UNUR_METH_HRB 0x02000300u +#define UNUR_METH_HRD 0x02000400u +#define UNUR_METH_HRI 0x02000500u +#define UNUR_METH_ITDR 0x02000800u +#define UNUR_METH_NINV 0x02000600u +#define UNUR_METH_NROU 0x02000700u +#define UNUR_METH_PINV 0x02001000u +#define UNUR_METH_SROU 0x02000900u +#define UNUR_METH_SSR 0x02000a00u +#define UNUR_METH_TABL 0x02000b00u +#define UNUR_METH_TDR 0x02000c00u +#define UNUR_METH_UNIF 0x02000e00u +#define UNUR_METH_UTDR 0x02000f00u + +/* univariate continuous empirical distributions */ +#define UNUR_METH_CEMP 0x04000000u + +#define UNUR_METH_EMPK 0x04001100u +#define UNUR_METH_EMPL 0x04001200u +#define UNUR_METH_HIST 0x04001300u + +/* multivariate continuous distributions */ +#define UNUR_METH_VEC 0x08000000u + +#define UNUR_METH_MVTDR 0x08010000u +#define UNUR_METH_VMT 0x08020000u +#define UNUR_METH_VNROU 0x08030000u +#define UNUR_METH_VAROU 0x08040000u +#define UNUR_METH_NORTA 0x08050000u + +#define UNUR_METH_GIBBS 0x08060000u +#define UNUR_METH_HITRO 0x08070000u +#define UNUR_METH_BALL 0x08080000u +#define UNUR_METH_WALK 0x08090000u + +/* multivariate continuous empirical distributions */ +#define UNUR_METH_CVEMP 0x10000000u + +#define UNUR_METH_VEMPK 0x10010000u + +/* random matrices */ +#define UNUR_METH_MAT 0x20000000u + +#define UNUR_METH_MCORR 0x20010000u + +/* generators for standard distributions */ +#define UNUR_METH_CSTD 0x0200f100u /* is of type UNUR_METH_CONT !! */ +#define UNUR_METH_DSTD 0x0100f200u /* is of type UNUR_METH_DISCR !! */ +#define UNUR_METH_MVSTD 0x0800f300u /* is of type UNUR_METH_CVEC !! */ + +/* meta distributions */ +#define UNUR_METH_MIXT 0x0200e100u /* univariate continuous */ + +/* wrapper for external generators */ +#define UNUR_METH_CEXT 0x0200f400u /* is of type UNUR_METH_CONT !! */ +#define UNUR_METH_DEXT 0x0100f500u /* is of type UNUR_METH_DISCR !! */ + +/* automatically selected generator */ +#define UNUR_METH_AUTO 0x00a00000u /* can be any type of distribution */ + +/* to indicate unknown type */ +#define UNUR_METH_UNKNOWN 0xff000000u + +/*---------------------------------------------------------------------------*/ +#endif /* UNUR_METHODS_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/unur_methods_source.h b/vendor/unuran-1.11.0/src/methods/unur_methods_source.h new file mode 100644 index 0000000..9ba8c45 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/unur_methods_source.h @@ -0,0 +1,70 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unur_methods_source.h * + * * + * PURPOSE: * + * defines macros for checking method in generator objects. * + * the bitmasks are defined in file unur_methods.h. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef UNUR_METHODS_SOURCE_H_SEEN +#define UNUR_METHODS_SOURCE_H_SEEN +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Bitmask to indicate methods **/ +/*****************************************************************************/ + +#include + +/*****************************************************************************/ +/** Macros **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* check if parameter object is of correct type, return 0 otherwise */ + +#define _unur_check_par_object( par,type ) \ + if ( (par)->method != UNUR_METH_##type ) { \ + _unur_error(#type,UNUR_ERR_PAR_INVALID,""); \ + return (UNUR_ERR_PAR_INVALID); } \ + COOKIE_CHECK((par),CK_##type##_PAR,UNUR_ERR_COOKIE) + +/*---------------------------------------------------------------------------*/ +/* check if generator object is of correct type, return 0 otherwise */ + +#define _unur_check_gen_object( gen,type,rval ) \ + if ( (gen)->method != UNUR_METH_##type ) { \ + _unur_error((gen)->genid,UNUR_ERR_GEN_INVALID,""); \ + return rval; } \ + COOKIE_CHECK((gen),CK_##type##_GEN,UNUR_ERR_COOKIE) + +/*---------------------------------------------------------------------------*/ +#endif /* UNUR_METHODS_SOURCE_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/utdr.c b/vendor/unuran-1.11.0/src/methods/utdr.c new file mode 100644 index 0000000..55dd5d5 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/utdr.c @@ -0,0 +1,1348 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: utdr.h * + * * + * TYPE: continuous univariate random variate * + * METHOD: transformed density rejection with three points of contact * + * T(x) = -1/sqrt(x) (T_c with c= -1/2) * + * * + * DESCRIPTION: * + * Given PDF and mode of a T-concave distribution * + * produce a value x consistent with its density * + * * + * REQUIRED: pointer to the density, mode of the density * + * * + * PARAMETERS: * + * double il, ir ... left and right boundary of domain * + * (default: +/- UNUR_INFINITY) * + * double pdf_area ... area below PDF (need not be 1) * + * (default: 1.) * + * double *pdf_param ... parameters of PDF * + * (default: NULL) * + * int n_pdf_param ... number of parameters of PDF * + * (default: 0) * + * double c_factor ... constant for choosing the constr. points * + * (default: 0.664) * + * double delta_factor ... constant for approx. first derivative * + * (default: 0.00001) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Hoermann W. (1995): A rejection technique for sampling from * + * T-concave distributions, ACM TOMS 21, p. 182-193 * + * (see Algorithm UTDR) * + * * + ***************************************************************************** + * * + * ..... beschreibung .... * + * * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "utdr.h" +#include "utdr_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Variants */ + +#define UTDR_VARFLAG_VERIFY 0x01u /* flag for verifying mode */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define UTDR_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define UTDR_SET_CPFACTOR 0x001u +#define UTDR_SET_DELTA 0x002u +#define UTDR_SET_PDFMODE 0x004u /* PDF at mode is set */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "UTDR" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_utdr_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_utdr_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_utdr_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_utdr_check_par( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Check parameters of given distribution and method */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_utdr_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_utdr_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_utdr_sample( struct unur_gen *generator ); +static double _unur_utdr_sample_check( struct unur_gen *generator ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static int _unur_utdr_hat( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* compute hat and squeezes. */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_utdr_debug_init( const struct unur_gen *gen, + double ttly, double ttlys, double ttry, double ttrys, + double cfac, int setupok, double c ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_utdr_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cont /* data for distribution object */ + +#define PAR ((struct unur_utdr_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_utdr_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cont /* data for distribution in generator object */ + +#define BD_LEFT domain[0] /* left boundary of domain of distribution */ +#define BD_RIGHT domain[1] /* right boundary of domain of distribution */ + +#define SAMPLE gen->sample.cont /* pointer to sampling routine */ + +#define PDF(x) _unur_cont_PDF((x),(gen->distr)) /* call to PDF */ + +/*---------------------------------------------------------------------------*/ + +#define _unur_utdr_getSAMPLE(gen) \ + ( ((gen)->variant & UTDR_VARFLAG_VERIFY) \ + ? _unur_utdr_sample_check : _unur_utdr_sample ) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_utdr_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /* */ + /* comment: */ + /* if the area below the PDF is not close to 1 it is necessary to */ + /* set pdf_area to an approximate value of its area (+/- 30 % is ok). */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + + if (DISTR_IN.pdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); + return NULL; + } + + /**TODOWH: + Kann man eigentlich einen bound fuer die area auch + im Distribution-objekt eingeben????? + so dass es klar ist, dass da nur ein bound ist? + + JL: ich habe ich SSR die moeglichkeit eingebaut, dass nur eine + obere schranke eingegeben wurde. dass einzige problem dabei ist, + dass dann der squeeze nicht mehr verwendet werden kann. + man kann aber die verwendung des squeezes (der eigentlich nur bei + sehr teuren dichten etwas bringt, mittels + int unur_ssr_set_usesqueeze( UNUR_PAR *parameters, int usesqueeze ); + abschalten. + + waere das ein brauchbarer weg fuer Dich? + + alternativ koennten wir auch ein unur_distr_set_approx_pdfarea() + einbauen. die unterscheidung zwischen exactem wert und naehrung kann + man mittels set-flag machen. (irgendwie ist mir bis jetzt nie die idee + gekommen, dass so zu machen.) ist das so besser? + **/ + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_utdr_par) ); + COOKIE_SET(par,CK_UTDR_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->c_factor = 0.664; + /* optimal value for the normal distribution, which is good for + all bell-shaped densities. The minimax approach for that + transformation has c_factor=2. */ + PAR->delta_factor = 0.00001; + /* constant for choosing delta to replace the tangent. + default should not be changed if used doubles have at least + 10 decimal digits precision. */ + + PAR->fm = -1.; /* PDF at mode (unknown) */ + PAR->hm = -1.; /* square of PDF at mode (unknown) */ + + par->method = UNUR_METH_UTDR; /* method */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_utdr_init; + + return par; + +} /* end of unur_utdr_new() */ + +/*****************************************************************************/ + +int +unur_utdr_set_pdfatmode( UNUR_PAR *par, double fmode ) + /*----------------------------------------------------------------------*/ + /* Set PDF at mode. if set, the PDF at the mode is never changed. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* fmode ... PDF at mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, UTDR ); + + /* check new parameter for generator */ + if (fmode <= 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode)"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->fm = fmode; /* PDF at mode */ + PAR->hm = -1./sqrt(fmode); /* transformed PDF at mode */ + + /* changelog */ + par->set |= UTDR_SET_PDFMODE; + + return UNUR_SUCCESS; + +} /* end of unur_utdr_set_pdfatmode() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_utdr_set_cpfactor( struct unur_par *par, double cp_factor ) + /*----------------------------------------------------------------------*/ + /* set factor for position of left and right construction point */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* cp_factor ... factor */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, UTDR ); + + /* check new parameter for generator */ + /** TODO: welche werte fuer c sind zulaessig / sinnvoll ? + zulaessig ist jedes c>0, man koennte damit falsche Flaechenangaben kompensieren. + Wenn area genau bekannt ist, ist ein c > 2 (2 ist der minimax approach) so weit + ich weiss nie sinnvoll. Ich denke aber, das sollte man besser nicht prinzipiell + verbieten, hoechstens eine warnung.**/ + if (cp_factor <= 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"cp-factor <= 0"); + return UNUR_ERR_PAR_SET; + } + + if (cp_factor > 2.1) + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"cp-factor > 2 not recommended. skip"); + + /* store date */ + PAR->c_factor = cp_factor; + + /* changelog */ + par->set |= UTDR_SET_CPFACTOR; + + return UNUR_SUCCESS; + +} /* end of unur_utdr_set_cpfactor() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_utdr_set_deltafactor( struct unur_par *par, double delta ) + /*----------------------------------------------------------------------*/ + /* set factor for replacing tangents by secants */ + /* (which then are move above the transformed density) */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* delta ... delta-factor */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, UTDR ); + + /* check new parameter for generator */ + /** TODO: welche werte fuer delta sind zulaessig / sinnvoll ? + von einem rein numerischen Gesichtspunkt kann man sagen: Delta_factor + soll nicht kleiner sein als sqrt(epsilon) (mit epsilon meine ich die + kleinste Zahl die einen Unterschied zwischen 1 und 1+epsilon erkennen + laesst). Dann ist garantiert, dass wir durch Ausloeschung nicht mehr + als die haelfte der mantisse verlieren + Von Algorithmus ueberlegungen her sollte delta>=xl*deltafactor sicher + nicht groesser sein als ein Bruchteil (wohl hoechstens 1/10) zwischen + mode und Design-punkt, weil sonst die Anahmewahrscheinlichkeit schlechter + wird. Das ergibt sicher probleme fuer Dichten wo der mode sehr gross + und der skale-parameter im Vergleich dazu klein ist. + Ich habe den Algorithmus so geaendert, dass er, falls es dieses + Problem gibt, eine (roundoff-problem) Warnung ausspuckt, und als + Delta 1/100*|designpoint-mode| nimmt Empirisch habe ich dafuer + festgestellt, dass damit die Flaeche unterm Hut Kaum mehr als 1% + zunimmt und das ist ja nicht schlimm**/ + if (delta <= 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"delta <= 0"); + return UNUR_ERR_PAR_SET; + } + if (delta > 0.1) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"delta must be small"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->delta_factor = delta; + + /* changelog */ + par->set |= UTDR_SET_DELTA; + + return UNUR_SUCCESS; + +} /* end of unur_utdr_set_delta() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_utdr_set_verify( struct unur_par *par, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, UTDR ); + + /* we use a bit in variant */ + par->variant = (verify) ? (par->variant | UTDR_VARFLAG_VERIFY) : (par->variant & (~UTDR_VARFLAG_VERIFY)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_utdr_set_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_utdr_chg_verify( struct unur_gen *gen, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, UTDR, UNUR_ERR_GEN_INVALID ); + + /* we must not change this switch when sampling has been disabled by + using a pointer to the error producing routine */ + if (SAMPLE == _unur_sample_cont_error) + return UNUR_FAILURE; + + if (verify) + /* turn verify mode on */ + gen->variant |= UTDR_VARFLAG_VERIFY; + else + /* turn verify mode off */ + gen->variant &= ~UTDR_VARFLAG_VERIFY; + + SAMPLE = _unur_utdr_getSAMPLE(gen); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_utdr_chg_verify() */ + +/*****************************************************************************/ + +int +unur_utdr_chg_pdfatmode( struct unur_gen *gen, double fmode ) + /*----------------------------------------------------------------------*/ + /* change value of PDF at mode */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* fmode ... PDF at mode */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, UTDR, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (fmode <= 0.) { + _unur_warning(gen->genid,UNUR_ERR_PAR_SET,"PDF(mode)"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + GEN->fm = fmode; /* PDF at mode */ + GEN->hm = -1./sqrt(fmode); /* transformed PDF at mode */ + + /* changelog */ + gen->set |= UTDR_SET_PDFMODE; + + /* o.k. */ + return UNUR_SUCCESS; +} /* end of unur_utdr_chg_pdfatmode() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_utdr_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + _unur_check_NULL( GENTYPE,par,NULL ); + + /* check input */ + if ( par->method != UNUR_METH_UTDR ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_UTDR_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_utdr_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* check parameters */ + if (_unur_utdr_check_par(gen) != UNUR_SUCCESS) { + _unur_utdr_free(gen); return NULL; + } + + /* create hat and squeeze (setup procedure) */ + if ( _unur_utdr_hat(gen)!=UNUR_SUCCESS ) { + _unur_utdr_free(gen); return NULL; + } + + /* hat successfully created */ + return gen; + +} /* end of _unur_utdr_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_utdr_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int rcode; + + /* check parameters */ + if ( (rcode = _unur_utdr_check_par(gen)) != UNUR_SUCCESS) + return rcode; + + /* update left and right boundary for algorithm */ + GEN->il = DISTR.BD_LEFT; + GEN->ir = DISTR.BD_RIGHT; + + /* (re)set sampling routine */ + SAMPLE = _unur_utdr_getSAMPLE(gen); + + /* compute universal bounding rectangle */ + return _unur_utdr_hat( gen ); +} /* end of _unur_utdr_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_utdr_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_UTDR_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_utdr_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_UTDR_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_utdr_getSAMPLE(gen); + gen->destroy = _unur_utdr_free; + gen->clone = _unur_utdr_clone; + gen->reinit = _unur_utdr_reinit; + + /* copy some parameters into generator object */ + GEN->il = DISTR.BD_LEFT; /* left boundary of domain */ + GEN->ir = DISTR.BD_RIGHT; /* right boundary of domain */ + GEN->fm = PAR->fm; /* PDF at mode */ + GEN->hm = PAR->hm; /* square root of PDF at mode */ + GEN->c_factor = PAR->c_factor; + GEN->delta_factor = PAR->delta_factor; + + /* initialize parameters */ + /** TODO !!! **/ + /** ist das wirklich so noetig ?? **/ + GEN->vollc = 0.; + GEN->volcompl = 0.; + GEN->voll = 0.; + GEN->al = 0.; + GEN->ar = 0.; + GEN->col = 0.; + GEN->cor = 0.; + GEN->sal = 0.; + GEN->sar = 0.; + GEN->bl = 0.; + GEN->br = 0.; + GEN->ttlx = 0.; + GEN->ttrx = 0.; + GEN->brblvolc = 0.; + GEN->drar = 0.; + GEN->dlal = 0.; + GEN->ooar2 = 0.; + GEN->ooal2 = 0.; + /* constants of the hat and for generation*/ + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_utdr_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_utdr_create() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_utdr_check_par( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check parameters of given distribution and method */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + + /* check for required data: mode */ + if (!(gen->distr->set & UNUR_DISTR_SET_MODE)) { + _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode: try finding it (numerically)"); + if (unur_distr_cont_upd_mode(gen->distr)!=UNUR_SUCCESS) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode"); + return UNUR_ERR_DISTR_REQUIRED; + } + } + + /* check for required data: area */ + if (!(gen->distr->set & UNUR_DISTR_SET_PDFAREA)) { + if (unur_distr_cont_upd_pdfarea(gen->distr)!=UNUR_SUCCESS) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"area below PDF"); + return UNUR_ERR_DISTR_REQUIRED; + } + } + + /* mode must be in domain */ + if ( (DISTR.mode < DISTR.BD_LEFT) || + (DISTR.mode > DISTR.BD_RIGHT) ) { + /* there is something wrong. + assume: user has change domain without changing mode. + but then, she probably has not updated area and is to large */ + _unur_warning(GENTYPE,UNUR_ERR_GEN_DATA,"area and/or CDF at mode"); + DISTR.mode = _unur_max(DISTR.mode,DISTR.BD_LEFT); + DISTR.mode = _unur_min(DISTR.mode,DISTR.BD_RIGHT); + } + + return UNUR_SUCCESS; +} /* end of _unur_utdr_check_par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_utdr_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_utdr_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_UTDR_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + return clone; + +#undef CLONE +} /* end of _unur_utdr_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_utdr_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_UTDR ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_UTDR_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + _unur_generic_free(gen); + +} /* end of _unur_utdr_free() */ + +/*****************************************************************************/ + +double +_unur_utdr_sample( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double u,v,x,help,linx; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_UTDR_GEN,UNUR_INFINITY); + + while (1) { + /*2*/ + u = _unur_call_urng(gen->urng) * GEN->volcompl; + /*2.1*/ + if (u <= GEN->voll) { + u = GEN->voll-u; /*added to ensure inversion for the hat-generation*/ + x = -GEN->dlal+GEN->ooal2/(u-GEN->col); + help = GEN->al*(u-GEN->col); + linx = help*help; + } + else { + if (u <= GEN->vollc) { + x = (u-GEN->voll) * GEN->brblvolc + GEN->bl; + linx = GEN->fm; + } + else { + x = - GEN->drar - GEN->ooar2 / (u-GEN->vollc - GEN->cor); + help = GEN->ar * (u-GEN->vollc - GEN->cor); + linx = help*help; + } + } + /*2.2*/ + v = _unur_call_urng(gen->urng) * linx; + /*2.3*/ + if (x= GEN->ttlx) { + help = GEN->hm - (DISTR.mode - x) * GEN->sal; + if (v * help * help <= 1.) return x; + } + } + else { + if (x <= GEN->ttrx) { + help = GEN->hm - (DISTR.mode - x) * GEN->sar; + if (v * help * help <= 1.) return x; + } + } + if (v <= PDF(x)) return x; + } + +} /* end of _unur_utdr_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_utdr_sample_check( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* double (sample from random variate) */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double u,v,x,help,linx,pdfx,squeezex; + + /* check arguments */ + CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_UTDR_GEN,UNUR_INFINITY); + + while (1) { + /*2*/ + u = _unur_call_urng(gen->urng) * GEN->volcompl; + /*2.1*/ + if (u <= GEN->voll) { + u = GEN->voll-u; /* added to ensure inversion for the hat-generation */ + x = -GEN->dlal+GEN->ooal2/(u-GEN->col); + help = GEN->al*(u-GEN->col); + linx = help*help; + } + else { + if (u <= GEN->vollc) { + x = (u-GEN->voll) * GEN->brblvolc + GEN->bl; + linx = GEN->fm; + } + else { + x = - GEN->drar - GEN->ooar2 / (u-GEN->vollc - GEN->cor); + help = GEN->ar * (u-GEN->vollc - GEN->cor); + linx = help*help; + } + } + /*2.2*/ + v = _unur_call_urng(gen->urng) * linx; + /*2.3*/ + squeezex=0.; + if (x= GEN->ttlx) { + help = GEN->hm - (DISTR.mode - x) * GEN->sal; + squeezex=1./(help*help); + /* if (v * help * help <= 1.) return x;*/ + } + } + else { + if (x <= GEN->ttrx) { + help = GEN->hm - (DISTR.mode - x) * GEN->sar; + squeezex=1./(help*help); + /* if (v * help * help <= 1.) return x; */ + } + } + /*evaluate density-function*/ + pdfx=PDF(x); + + /* verify hat function */ + if(_unur_FP_less(linx,pdfx)) + { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) > hat(x)"); + _unur_log_printf(gen->genid,__FILE__,__LINE__,"x %e PDF(x) %e hat(x) %e squeeze(x) %e", \ + x,pdfx,linx,squeezex ); + } + /* verify squeeze function */ + if(_unur_FP_less(pdfx,squeezex)) + { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) < squeeze(x)"); + _unur_log_printf(gen->genid,__FILE__,__LINE__,"x %e PDF(x) %e hat(x) %e squeeze(x) %e", \ + x,pdfx,linx,squeezex ); + } + if (v <= PDF(x)) return x; + } + +} /* end of _unur_utdr_sample_check() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +/** TODO gibts da schon eine UNURAN constante? ich hab sie nicht gefunden!! **/ +#define SMALL_VAL 1.e-50 +/** JL: was soll die leisten? + wenn sie gebraucht wird, wuerde ich sie mit einer entsprenden beschreibung + in unuran_config.h stellen. +**/ + +int +_unur_utdr_hat( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* compute hat and squeeze */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double fm; + + int setupok=1; + double c,cfac,volc,volr,ttly,ttlys,ttry,ttrys,dl,dr,delta,delta1,delta2,pdfx; + + /* check arguments */ + CHECK_NULL( gen, UNUR_ERR_NULL ); + COOKIE_CHECK( gen, CK_UTDR_GEN, UNUR_ERR_COOKIE ); + + /* compute PDF at mode (if not given by user) */ + if (!(gen->set & UTDR_SET_PDFMODE)) { + fm = PDF(DISTR.mode); + /* fm must be positive */ + if (fm <= 0.) { + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"PDF(mode) <= 0."); + return UNUR_ERR_GEN_DATA; + } + /* step 1.0 of algorithm UTDR */ + GEN->fm = fm; /* PDF at mode */ + GEN->hm = -1/sqrt(fm); /* transformed PDF at mode */ + } + + /** TODO: inititialisieren notwendig ?? **/ + + /** ich habe diese variablen initialisiert, weil ich auf einem + alpha rechner eine flaoting exception bei der ersten verwendung + von ttry oder ttrys bekommen habe. + das ist keine IEEE 764 architektur. + es stand dann ttry irgend ein bitmuster, dass keiner regulaeren + zahl entsprochen hat und daher die FPE versucht hat + (in eine if abfrage !!) + das zeigt, das da ttry tatsaechlich nicht initialiesiert verwendet + wurde. das sollte man sauberer programmieren. + **/ + + ttry = 0.; + ttrys = 0.; + ttly = 0.; + ttlys = 0.; + dl = 0.; + dr = 0.; + volr = 0.; + + /* start of the set-up procedure */ + + /* step 1.0 of algorithm UTDR */ + /* see above or in unur_utdr_set_pdfatmode() */ + + do { + + /* 1.1 */ + cfac = (setupok) ? GEN->c_factor : 2.; /* gibt es hier nur zwei varianten ?? ja*/ + c = cfac * DISTR.area/GEN->fm; + setupok=1; + + GEN->ttlx = DISTR.mode - c; + GEN->ttrx = DISTR.mode + c; + + /* 1.2 */ + /** TODO: kann man das nicht loeschen ?? **/ + if (/*GEN->il > -UNUR_INFINITY &&*/ GEN->ttlx < GEN->il) { + /* this is the case of no left tail*/ + GEN->bl = GEN->il; + GEN->al = 0.; + GEN->voll = 0.; + if (GEN->il < DISTR.mode) { + /* if the left domain border is left of the mode we set ttlx + only to use it for the squeeze*/ + GEN->ttlx = DISTR.mode + (GEN->il - DISTR.mode) * 0.6; + pdfx=PDF(GEN->ttlx); + if (pdfx > SMALL_VAL) + GEN->sal = (GEN->hm + 1./sqrt(pdfx)) / (DISTR.mode - GEN->ttlx); + else + GEN->ttlx = DISTR.mode; + /* pdfx is too small. We set ttlx=mode that no squeeze is used */ + } + } + else { + ttlys = PDF(GEN->ttlx); + if (ttlys < SMALL_VAL) { + /* in this case we cut off the left tail*/ + GEN->il = GEN->ttlx; + GEN->bl = GEN->il; + GEN->al = 0.; + GEN->voll = 0.; + GEN->ttlx=DISTR.mode; + /* pdfx is too small. We set ttlx=mode that no squeeze is used */ + } + else { + ttlys = -1./sqrt(ttlys); + GEN->sal = (GEN->hm - ttlys) / (DISTR.mode - GEN->ttlx); + + /* delta1> 0 as -ttlys>0 und sal >0; */ + delta2 = ( GEN->sal > 0. ) ? -ttlys/GEN->sal : -ttlys; + delta1 = fabs(GEN->ttlx); + delta = GEN->delta_factor * ((delta1<=delta2) ? delta2 : delta1); + if (delta > c * 0.01) { + delta = UNUR_SQRT_DBL_EPSILON * ((delta1<=delta2) ? delta2 : delta1); + /* Using sqrt(DBL_EPSILON) as delta_factor guarantees that not more than + half of the precision will be lost when computing the slope GEN->al */ + if (delta > c * 0.01) { + delta = c * 0.01; + /* delta is forced to be c * 0.01 although this can + result in numerical inaccuracies when computing + the slope GEN->al. Therefore a warning is + issued */ + _unur_warning(gen->genid,UNUR_ERR_GEN_DATA, + "Delta larger than c/100!!, perhaps you can use a mode closer to 0 to remove this problem?"); + } + } + + ttly = -1./sqrt(PDF(GEN->ttlx+delta)); + GEN->al = (ttly-ttlys)/delta; + + if (GEN->al <= 0.) + /* setupok==0 means that this setup is quitted and set-up is restarted + with different value for cfac */ + setupok = 0; + else { + GEN->bl = GEN->ttlx + (GEN->hm - ttly)/GEN->al; + dl = ttly - GEN->al * GEN->ttlx; + GEN->voll = -1./(GEN->al * GEN->hm); + GEN->col = GEN->voll; + if (GEN->il > -UNUR_INFINITY) + GEN->voll += 1./(GEN->al * (GEN->al * GEN->il + dl)); + } + } + } + + /* 1.3 */ + if(setupok) { + if (/*GEN->ir < UNUR_INFINITY &&*/ GEN->ttrx > GEN->ir) { + /* this is the case of no right tail */ + GEN->br = GEN->ir; + GEN->ar = 0.; + volr = 0.; + if (GEN->ir > DISTR.mode) { + /* if the right domain border is right of the mode we set ttrx + only to use it for the squeeze */ + GEN->ttrx = DISTR.mode + (GEN->ir - DISTR.mode) * 0.6; + pdfx = PDF(GEN->ttrx); + if (pdfx > SMALL_VAL) + GEN->sar = (GEN->hm + 1./sqrt(PDF(GEN->ttrx))) / (DISTR.mode - GEN->ttrx); + else + GEN->ttrx = DISTR.mode; + /* pdfx is too small. We set ttrx=mode that no squeeze is used */ + } + } + else { + ttrys = PDF(GEN->ttrx); + if (ttrys < SMALL_VAL){ + /* in this case we cut off the right tail */ + GEN->ir = GEN->ttrx; + GEN->br = GEN->ir; + GEN->ar = 0.; + volr = 0.; + GEN->ttrx = DISTR.mode; + /* pdfx is too small. We set ttrx=mode that no squeeze is used */ + } + else { + ttrys= -1./sqrt(ttrys); + /* see 1.2. for explanations */ + GEN->sar = (GEN->hm - ttrys) / (DISTR.mode - GEN->ttrx); + /* delta is positive, da ttrys<0 und sar <0 */ + delta2 = (GEN->sar<0.) ? ttrys/GEN->sar : -ttrys; + delta1 = fabs(GEN->ttrx); + delta = GEN->delta_factor * ((delta1<=delta2) ? delta2 : delta1); + if (delta > c*0.01) { + delta = UNUR_SQRT_DBL_EPSILON * ((delta1<=delta2) ? delta2 : delta1); + /* Using sqrt(DBL_EPSILON) as delta_factor guarantees that not more than + have of the precision will be lost when computing the slope GEN->al */ + if (delta > c*0.01) { + delta=c*0.01; + /* delta is forced to be c*0.01 allthough this can result in numerical + inaccuracies when computing the slope GEN->al. Therefore a warning is + issued*/ + _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF, + "Delta larger than c/100!!, perhaps you can use a mode closer to 0 to remove this problem?"); + } + } + + ttry = -1./sqrt(PDF(GEN->ttrx-delta)); + GEN->ar = (ttrys - ttry)/delta; + if (GEN->ar >= 0.) + /* setupok==0 means that this setup is quitted and set-up is + restarted with different value for cfac */ + setupok = 0; + else { + GEN->br = GEN->ttrx + (GEN->hm - ttry) / GEN->ar; + dr = ttry - GEN->ar * GEN->ttrx; + volr = 1./(GEN->ar * GEN->hm); + GEN->cor = volr; + if (GEN->ir < UNUR_INFINITY) + volr -= 1./(GEN->ar * (GEN->ar * GEN->ir + dr)); + } + } + } + } + + /* 1.4 */ + if(setupok) { + volc = (GEN->br - GEN->bl) * GEN->fm; + GEN->vollc = GEN->voll + volc; + GEN->volcompl = GEN->vollc + volr; + if (volc>0.) + GEN->brblvolc = (GEN->br - GEN->bl)/volc; + if (!_unur_iszero(GEN->ar)) { + GEN->drar = dr/GEN->ar; + GEN->ooar2 = 1./(GEN->ar*GEN->ar); + } + if (!_unur_iszero(GEN->al)) { + GEN->dlal = dl/GEN->al; + GEN->ooal2 = 1./(GEN->al*GEN->al); + } + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_utdr_debug_init(gen,ttly,ttlys,ttry,ttrys,cfac,setupok,c); +#endif + + if (!_unur_isfsame(cfac,2.)) { + if(setupok) + if (GEN->volcompl > 4. * DISTR.area || GEN->volcompl < 0.5 * DISTR.area) + setupok=0; + } + else { + if (setupok==0 || GEN->volcompl > 8. * DISTR.area || GEN->volcompl < 0.5 * DISTR.area) { + _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"; Area below hat too large or zero!! possible reasons: PDF, mode or area below PDF wrong; density not T-concave\n"); + return 0; + } + } + + } while (!setupok); + + return UNUR_SUCCESS; + +} /* end of _unur_utdr_hat() */ + +#undef SMALL_VAL + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +static void +_unur_utdr_debug_init( const struct unur_gen *gen, + double ttly, double ttlys, double ttry, double ttrys, + double cfac, int setupok, double c ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_UTDR_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = utdr(transformed density rejection with 3 points of contact)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cont_debug( gen->distr, gen->genid ); + + fprintf(LOG,"%s: sampling routine = _unur_utdr_sample",gen->genid); + if (gen->variant & UTDR_VARFLAG_VERIFY) + fprintf(LOG,"_check()\n"); + else + fprintf(LOG,"()\n"); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: Data for hat and squeeze:\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s:\tc_factor=%e delta_factor=%e real c=%e\n",gen->genid,GEN->c_factor,GEN->delta_factor,c); + fprintf(LOG,"%s:\ttlx=%e bl=%e mode=%e\n",gen->genid,GEN->ttlx,GEN->bl,DISTR.mode); + fprintf(LOG,"%s:\tbr=%e trx=%e\n",gen->genid,GEN->br,GEN->ttrx); + fprintf(LOG,"%s:\ttly=%e tlys=%e al=%e \n",gen->genid,ttly,ttlys,GEN->al); + fprintf(LOG,"%s:\ttry=%e trys=%e ar=%e \n",gen->genid,ttry,ttrys,GEN->ar); + fprintf(LOG,"%s:\tcfac=%e setupok=%d volcompl=%e pdf_area=%e\n",gen->genid,cfac,setupok,GEN->volcompl,DISTR.area); + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); + +} /* end of _unur_utdr_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_utdr_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + int samplesize = 10000; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," functions = PDF\n"); + _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); + _unur_string_append(info," mode = %g %s\n", unur_distr_cont_get_mode(distr), + (distr->set & UNUR_DISTR_SET_MODE_APPROX) ? "[numeric.]" : ""); + _unur_string_append(info," area(PDF) = %g\n", DISTR.area); + _unur_string_append(info,"\n"); + + /* method */ + _unur_string_append(info,"method: UTDR (Universal Transformed Density Rejection -- 3 point method)\n"); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + _unur_string_append(info," rejection constant = %.2f [approx.]\n", + unur_test_count_urn(gen,samplesize,0,NULL)/(2.*samplesize)); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + _unur_string_append(info," deltafactor = %g %s\n", GEN->delta_factor, + (gen->set & UTDR_SET_DELTA) ? "" : "[default]"); + + if (gen->set & UTDR_SET_PDFMODE) + _unur_string_append(info," pdfatmode = %g\n", GEN->fm); + + if (gen->set & UTDR_SET_CPFACTOR) + _unur_string_append(info," cpfactor = %g\n", GEN->c_factor); + + if (gen->variant & UTDR_VARFLAG_VERIFY) + _unur_string_append(info," verify = on\n"); + + _unur_string_append(info,"\n"); + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_utdr_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/utdr.h b/vendor/unuran-1.11.0/src/methods/utdr.h new file mode 100644 index 0000000..3c22e64 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/utdr.h @@ -0,0 +1,164 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: utdr.h * + * * + * PURPOSE: * + * function prototypes for method UTDR * + * (Universal Transformed Density Rejection; 3-point method) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD UTDR Universal Transformed Density Rejection + + =UP Methods_for_CONT + + =REQUIRED T-concave PDF, mode, approximate area + + =SPEED Set-up: moderate, Sampling: Moderate + + =REINIT supported + + =REF [HWa95] [HLD04: Sect.4.5.4, Alg.4.4] + + =DESCRIPTION + UTDR is based on the transformed density rejection and uses + three almost optimal points for constructing hat and squeezes. + It works for all @i{T}-concave distributions with + @unurmath{T(x) = -1/\sqrt(x).} + + It requires the PDF and the (exact) location of the mode. + Notice that if no mode is given at all, a (slow) numerical mode + finder will be used. + Moreover the approximate area below the given PDF is used. + (If no area is given for the distribution the algorithm assumes that it + is approximately 1.) + The rejection constant is bounded from above by 4 + for all @i{T}-concave distributions. + + =HOWTOUSE + UTDR works for any continuous univariate distribution object with + given @i{T}-concave PDF (with @unurmath{T(x) = -1/\sqrt{x},)} + mode and approximate area below PDF. + + When the PDF does not change at the mode for varying parameters, then + this value can be set with unur_utdr_set_pdfatmode() to avoid some + computations. Since this value will not be updated any more when the + parameters of the distribution are changed, + the unur_utdr_chg_pdfatmode() call is necessary to do this manually. + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + Notice, that derived parameters like the mode must also be (re-) set + if the parameters or the domain has be changed. + Moreover, if the PDF at the mode has been provided by a + unur_utdr_set_pdfatmode() call, additionally + unur_utdr_chg_pdfatmode() must be used (otherwise this call is + not necessary since then this figure is computed directly from + the PDF). + + There exists a test mode that verifies whether the conditions for + the method are satisfied or not. It can be switched on by calling + unur_utdr_set_verify() and unur_utdr_chg_verify(), respectively. + Notice however that sampling is slower then. + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_utdr_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_utdr_set_pdfatmode( UNUR_PAR *parameters, double fmode ); +/* + Set pdf at mode. + When set, the PDF at the mode is never changed. + This is to avoid additional computations, when the PDF does not + change when parameters of the distributions vary. + It is only useful when the PDF at the mode does not change with + changing parameters for the distribution. + + Default: not set. +*/ + +int unur_utdr_set_cpfactor( UNUR_PAR *parameters, double cp_factor ); +/* + Set factor for position of left and right construction point. + The @var{cp_factor} is used to find almost optimal construction + points for the hat function. + There is no need to change this factor in almost all situations. + + Default is @code{0.664}. +*/ + +int unur_utdr_set_deltafactor( UNUR_PAR *parameters, double delta ); +/* + Set factor for replacing tangents by secants. + higher factors increase the rejection constant but reduces the risk of + serious round-off errors. + There is no need to change this factor it almost all situations. + + Default is @code{1.e-5}. +*/ + +int unur_utdr_set_verify( UNUR_PAR *parameters, int verify ); +/* */ + +int unur_utdr_chg_verify( UNUR_GEN *generator, int verify ); +/* + Turn verifying of algorithm while sampling on/off. + If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is + violated for some @i{x} then @code{unur_errno} is set to + @code{UNUR_ERR_GEN_CONDITION}. However notice that this might + happen due to round-off errors for a few values of + @i{x} (less than 1%). + + Default is FALSE. +*/ + +/*...........................................................................*/ + +int unur_utdr_chg_pdfatmode( UNUR_GEN *generator, double fmode ); +/* + Change PDF at mode of distribution. + unur_reinit() must be executed before sampling from the + generator again. +*/ + +/* =END */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/utdr_struct.h b/vendor/unuran-1.11.0/src/methods/utdr_struct.h new file mode 100644 index 0000000..4236d89 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/utdr_struct.h @@ -0,0 +1,62 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: utdr_struct.h * + * * + * PURPOSE: * + * declares structures for method UTDR * + * (Universal Transformed Density Rejection; 3-point method) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_utdr_par { + double fm; /* PDF at mode */ + double hm; /* transformed PDF at mode */ + double c_factor; /* constant for choosing the design points */ + double delta_factor; /* delta to replace the tangent */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_utdr_gen { + double il; /* left border of the domain */ + double ir; /* right border of the domain */ + double fm; /* PDF at mode */ + double hm; /* transformed PDF at mode */ + + double vollc,volcompl,voll, + al,ar,col,cor,sal,sar,bl,br,ttlx,ttrx, + brblvolc,drar,dlal,ooar2,ooal2;/* constants of the hat and for generation*/ + + double c_factor; /* constant for choosing the design points */ + double delta_factor; /* delta to replace the tangent */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/vempk.c b/vendor/unuran-1.11.0/src/methods/vempk.c new file mode 100644 index 0000000..f76db23 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/vempk.c @@ -0,0 +1,910 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: vempk.c * + * * + * TYPE: continuous multivariate random variate * + * METHOD: generate from kernel estimation * + * * + * DESCRIPTION: * + * Given observed sample. * + * Produce a vector x consistent with this sample * + * * + * REQUIRED: * + * pointer to sample * + * * + * OPTIONAL: * + * smoothing factor * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * * + * [1] Devroye, L. and Gyorfi, L. (1985): Nonparametric Density * + * Estimation: The $L_1$ View. New-York: John Wiley. * + * * + * [2] Devroye, L. (1986): Non-Uniform Random Variate Generation. (p. 765) * + * New York: Springer-Verlag. * + * * + * [3] Hoermann, W. and Leydold, J. (2000): Automatic random variate * + * generation for simulation input. Proceedings of the 2000 Winter * + * Simulation Conference. (??? eds.) * + * * + * [4] Silverman, B. (1986): Density Estimation for Statistics and * + * Data Analysis. London: Chapman and Hall. * + * * + ***************************************************************************** + * * + * The method here is based on the fact that it is very easy to generate * + * random variates that have as density the kernel density estimate of a * + * given sample: It is enough to randomly select a point from the given * + * sample and return it together with some additive noise (see [1], [2] * + * [3] and [4]). Note that it is not necessary to compute the density * + * estimate itself! In fact it is much easier to generate variates from * + * the density estimate than to compute the estimate itself! * + * * + * For kernel density estimation we have to choose the kernel function * + * (this is for us the density of the noise) and the smoothing parameter * + * (i.e. the scale parameter of the kernel variate.) There is a lot * + * of theory discussing the optimal smoothing parameter for density * + * estimation. As we are mainly interested in a simple formula we * + * use the formula explained in [4] p.46-47 that is minimizing the * + * asymptotically MISE (mean integrated squared error) for a given * + * kernel. We have the danger of oversmoothing the data if they are * + * non-normal. Especially for multimodal distributions we get a better * + * bandwidth if we replace the sample's stdev s in the formula by the * + * minimum of s and the interquartilsrange R divided through 1.34. * + * * + * bwidth_opt = ???????????????????? * + * * + * Currently only Gaussian kernels with the same covariance matrix as the * + * given sample are implemented. * + * * + *...........................................................................* + * * + * Algorithm VEMPK: * + * * + * [Input] * + * Sample X(i) for i=1,2,..,n * + * * + * [Generate] * + * 1: Generate a random variate I uniformly distributed on {1, 2,...,n} * + * 2: Generate a random variate W from the distribution with density K(t) * + * 3: Return X(I) + bwidth * W * + * * + *...........................................................................* + * * + * The mean of the empirical distribution is equal to the sample mean. * + * One disadvantage of this method lies in the fact that the variance of * + * the empirical distribution generated by the kernel method is always * + * higher than the sample standard-deviation s. As pointed out in [4] * + * it is not difficult to correct this error. For the variance * + * corrected version we have to compute the mean mux and the * + * covariance matrix of the sample and we have to know the covariance * + * matrix of the kernel V(K). Then we can replace step (3) of the * + * algorithm above by: * + * * + * 3': Return ?????????????? * + * * + * We can turn on or off variance correction with the function * + * * + * unur_vempk_set_varcor(); * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen.h" +#include "x_gen_source.h" +#include "mvstd.h" +#include "vempk.h" +#include "vempk_struct.h" + +/*---------------------------------------------------------------------------*/ +/* Variants: */ + +#define VEMPK_VARFLAG_VARCOR 0x001u /* use variance correction */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define VEMPK_DEBUG_PRINTDATA 0x00000100u + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define VEMPK_SET_SMOOTHING 0x008u /* smoothing factor */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "VEMPK" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_vempk_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_vempk_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_vempk_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_vempk_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_vempk_sample_cvec( struct unur_gen *gen, double *result ); +/*---------------------------------------------------------------------------*/ +/* sample from generator */ +/*---------------------------------------------------------------------------*/ + +static int compute_mean_covar( double *data, int n_data, int dim, double *xbar, double *S ); +/*---------------------------------------------------------------------------*/ +/* compute mean vector xbar and covariance matrix S of data. */ +/*---------------------------------------------------------------------------*/ + +/* inline static double _unur_empk_comp_iqrtrange( double *data, int n_data ); */ +/*---------------------------------------------------------------------------*/ +/* compute interquartile range. */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_vempk_debug_init( const struct unur_par *par, const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_vempk_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cvemp /* data for distribution object */ + +#define PAR ((struct unur_vempk_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_vempk_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cvemp /* data for distribution in generator object */ + +#define SAMPLE gen->sample.cvec /* pointer to sampling routine */ + +/*---------------------------------------------------------------------------*/ + +#define _unur_vempk_getSAMPLE(gen) ( _unur_vempk_sample_cvec ) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_vempk_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CVEMP) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CVEMP,NULL); + + if (DISTR_IN.sample == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"observed sample"); return NULL; } + if (DISTR_IN.n_sample < 2) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"size of observed sample"); return NULL; } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_vempk_par) ); + COOKIE_SET(par,CK_VEMPK_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->smoothing = 1.; /* determines how "smooth" the estimated density will be */ + + par->method = UNUR_METH_VEMPK; /* method */ + par->variant = 0u; /* default variant */ + + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_vempk_init; + + return par; + +} /* end of unur_vempk_new() */ + +/*****************************************************************************/ + +int +unur_vempk_set_smoothing( struct unur_par *par, double smoothing ) + /*----------------------------------------------------------------------*/ + /* set smoothing factor */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* smoothing ... smoothing factor */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, VEMPK ); + + /* check new parameter for generator */ + if (smoothing < 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"smoothing factor < 0"); + return UNUR_ERR_PAR_SET; + } + + /* store date */ + PAR->smoothing = smoothing; + + /* changelog */ + par->set |= VEMPK_SET_SMOOTHING; + + return UNUR_SUCCESS; + +} /* end of unur_vempk_set_smoothing() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_vempk_chg_smoothing( struct unur_gen *gen, double smoothing ) + /*----------------------------------------------------------------------*/ + /* change smoothing factor */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* smoothing ... smoothing factor */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, VEMPK, UNUR_ERR_GEN_INVALID ); + + /* no changelog required */ + + /* check new parameter for generator */ + if (smoothing < 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"smoothing factor < 0"); + return UNUR_ERR_PAR_SET; + } + + /* store smoothing factor */ + GEN->smoothing = smoothing; + + /* recompute band width */ + GEN->hact = GEN->hopt * GEN->smoothing; + + /* recompute constant for variance corrected version */ + GEN->corfac = 1./sqrt( 1. + GEN->hact * GEN->hact); + + /* changelog */ + gen->set |= VEMPK_SET_SMOOTHING; + + return UNUR_SUCCESS; + +} /* end of unur_vempk_chg_smoothing() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_vempk_set_varcor( struct unur_par *par, int varcor ) + /*----------------------------------------------------------------------*/ + /* turn variance correction on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* varcor ... 0 = no variance correction, !0 = variance correction */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* variance correction is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, VEMPK ); + + /* we use a bit in variant */ + par->variant = (varcor) + ? (par->variant | VEMPK_VARFLAG_VARCOR) + : (par->variant & (~VEMPK_VARFLAG_VARCOR)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_vempk_set_varcor() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_vempk_chg_varcor( struct unur_gen *gen, int varcor ) + /*----------------------------------------------------------------------*/ + /* turn variance correction on/off */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* varcor ... 0 = no variance correction, !0 = variance correction */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, VEMPK, UNUR_ERR_GEN_INVALID ); + + /* no changelog required */ + + /* we use a bit in variant */ + gen->variant = (varcor) + ? (gen->variant | VEMPK_VARFLAG_VARCOR) + : (gen->variant & (~VEMPK_VARFLAG_VARCOR)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_vempk_chg_varcor() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_vempk_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + double *S; /* covariance matrix of sample */ + UNUR_DISTR *kernel_distr; /* kernel distribution */ + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_VEMPK ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_VEMPK_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_vempk_create(par); + if (!gen) { _unur_par_free(par); return NULL; } + + /* compute mean vector and covariance matrix of sample */ + GEN->xbar = _unur_xmalloc( GEN->dim * sizeof(double) ); + S = _unur_xmalloc( GEN->dim * GEN->dim * sizeof(double) ); + compute_mean_covar( DISTR.sample, DISTR.n_sample, GEN->dim, GEN->xbar, S ); + + /* make a distribution object for multinormal distribution */ + kernel_distr = unur_distr_multinormal( GEN->dim, NULL, S ); + + /* create kernel generator */ + GEN->kerngen = unur_init( unur_mvstd_new( kernel_distr ) ); + if (GEN->kerngen==NULL) { + _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + _unur_par_free (par); free (S); _unur_vempk_free(gen); + return NULL; + } + + /* set uniform random number generator */ + GEN->kerngen->urng = par->urng; + + /* copy debugging flags */ + GEN->kerngen->debug = par->debug; + + /* the kernel is an auxiliary generator for method VEMPK, of course */ + gen->gen_aux = GEN->kerngen; + + /* compute bandwith: + Silverman (1986), p.86, formular 4.14 for normal kernel */ + GEN->hopt = (exp((1./(GEN->dim+4.))*log(4./(GEN->dim+2.)))* + exp(-1./(GEN->dim+4.) *log((double)GEN->n_observ))); + + /* hopt is optimal for the multi-normal distribution + as it is oversmoothing especially multimodal distributions */ + + /* compute used band width */ + GEN->hact = GEN->hopt * GEN->smoothing; + + /* compute constant for variance corrected version */ + GEN->corfac = 1./sqrt(1. + GEN->hact * GEN->hact); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_vempk_debug_init(par,gen); +#endif + + /* free parameters */ + _unur_par_free(par); + + /* we do not need mu and S any more */ + free(S); + unur_distr_free(kernel_distr); + + return gen; + +} /* end of _unur_vempk_init() */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen * +_unur_vempk_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_VEMPK_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_vempk_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_VEMPK_GEN); + + /* dimension of distribution */ + GEN->dim = gen->distr->dim; + + /* copy observed data into generator object */ + GEN->observ = DISTR.sample; /* observations in distribution object */ + GEN->n_observ = DISTR.n_sample; /* sample size */ + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_vempk_getSAMPLE(gen); + gen->destroy = _unur_vempk_free; + gen->clone = _unur_vempk_clone; + + /* copy some parameters into generator object */ + GEN->smoothing = PAR->smoothing; /* smoothing factor */ + + /* initialize pointer */ + GEN->kerngen = NULL; /* generator for kernel distribution */ + GEN->xbar = NULL; /* mean vector of sample */ + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_vempk_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_vempk_create() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_vempk_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_vempk_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_VEMPK_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* copy additional data for generator object */ + CLONE->observ = clone->distr->data.cvemp.sample; /* observations in distribution object */ + + if (GEN->xbar) { + CLONE->xbar = _unur_xmalloc( GEN->dim * sizeof(double) ); + memcpy( CLONE->xbar, GEN->xbar, GEN->dim * sizeof(double) ); + } + + /* kernel generator is (also) stored as auxiliary generator */ + /* which has already been cloned by generic_clone. */ + CLONE->kerngen = clone->gen_aux; + + return clone; + +#undef CLONE +} /* end of _unur_vempk_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_vempk_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_VEMPK ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_VEMPK_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + if (GEN->xbar) free( GEN->xbar ); + + _unur_generic_free(gen); + +} /* end of _unur_vempk_free() */ + +/*****************************************************************************/ + +int +_unur_vempk_sample_cvec( struct unur_gen *gen, double *result ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* result ... random vector (result) */ + /*----------------------------------------------------------------------*/ +{ + #define idx(a,b) (a*GEN->dim+b) + double U; + int j,k; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_VEMPK_GEN,UNUR_ERR_COOKIE); + + /* select uniformly one of the observations */ + U = _unur_call_urng(gen->urng) * GEN->n_observ; + j = (int) (U); + + /* sample from kernel distribution */ + unur_sample_vec( GEN->kerngen, result ); + + if (gen->variant & VEMPK_VARFLAG_VARCOR) + /* use variance correction */ + for (k=0; kdim; k++) + result[k] = GEN->xbar[k] + (GEN->observ[idx(j,k)] - GEN->xbar[k] + result[k]*GEN->hact) * GEN->corfac; + + else + /* no variance correction */ + for (k=0; kdim; k++) + result[k] = GEN->hact * result[k] + GEN->observ[idx(j,k)]; + + return UNUR_SUCCESS; +#undef idx +} /* end of _unur_vempk_sample() */ + + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +compute_mean_covar( double *data, int n_data, int dim, + double *xbar, double *S ) + /*----------------------------------------------------------------------*/ + /* compute mean vector xbar and covariance matrix S of data */ + /* */ + /* parameters: */ + /* data ... pointer to array of data */ + /* n_data ... number of data points */ + /* xbar ... pointer to store mean vector */ + /* S ... pointer to store covariance matrix */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ +#define idx(a,b) (a*dim+b) + + int i,j,k; + double *x; + + /* allocate working array */ + x = malloc(dim*sizeof(double)); + + /* initialization */ + + for(j=0; j=0; j--) + for (k=0; k<=j; k++) { + S[idx(j,k)] /= (n_data-1); + if (k!=j) + S[idx(k,j)] = S[idx(j,k)]; /* covariance matrix must be symmetric */ + } + + /* free working array */ + free(x); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* compute_mean_covar() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +static void +_unur_vempk_debug_init( const struct unur_par *par, const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int i; + + /* check arguments */ + CHECK_NULL(par,RETURN_VOID); COOKIE_CHECK(par,CK_VEMPK_PAR,RETURN_VOID); + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_VEMPK_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = VEMPK ((Vector) EMPirical distribution with Kernel smoothing)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s:\n",gen->genid); + _unur_distr_cvemp_debug( gen->distr, gen->genid, (gen->debug & VEMPK_DEBUG_PRINTDATA)); + + fprintf(LOG,"%s:\tmean vector =\n",gen->genid); + fprintf(LOG,"%s:\t ( %g",gen->genid,GEN->xbar[0]); + for (i=1; idim; i++) + fprintf(LOG,", %g",GEN->xbar[i]); + fprintf(LOG,")\n%s:\n",gen->genid); + + fprintf(LOG,"%s:\tcovariance matrix = [see %s]\n",gen->genid, GEN->kerngen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: sampling routine = _unur_vempk_sample_cvec()\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + fprintf(LOG,"%s: smoothing factor = %g",gen->genid, PAR->smoothing); + _unur_print_if_default(par,VEMPK_SET_SMOOTHING); fprintf(LOG,"\n"); + fprintf(LOG,"%s:\n",gen->genid); + + + fprintf(LOG,"%s: bandwith hopt = %g\n",gen->genid, GEN->hopt); + fprintf(LOG,"%s: (used) hact = %g\n",gen->genid, GEN->hact); + fprintf(LOG,"%s:\n",gen->genid); + + if (gen->variant & VEMPK_VARFLAG_VARCOR) { + fprintf(LOG,"%s: use variance correction\n",gen->genid); + fprintf(LOG,"%s:\tcorrection factor = %g\n",gen->genid, GEN->corfac); + } + else + fprintf(LOG,"%s: no variance correction\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_vempk_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_vempk_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," dimension = %d\n",GEN->dim); + _unur_string_append(info," functions = DATA [length=%d]\n", GEN->n_observ); + _unur_string_append(info,"\n"); + + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + + /* method */ + _unur_string_append(info,"method: VEMPK (EMPirical distribution with Kernel smoothing)\n"); + + _unur_string_append(info," kernel type = multinormal\n"); + _unur_string_append(info," smoothing factor = %g\n", GEN->smoothing); + _unur_string_append(info," bandwith = %g\n", GEN->hact); + + if (gen->variant & VEMPK_VARFLAG_VARCOR) + _unur_string_append(info," variance correction factor = %g\n", GEN->corfac); + else + _unur_string_append(info," no variance correction\n"); + _unur_string_append(info,"\n"); + + /* performance */ + /* _unur_string_append(info,"performance characteristics:\n"); */ + /* _unur_string_append(info,"\n"); */ + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + _unur_string_append(info," smoothing = %g %s\n", GEN->smoothing, + (gen->set & VEMPK_SET_SMOOTHING) ? "" : "[default]"); + if (gen->variant & VEMPK_VARFLAG_VARCOR) + _unur_string_append(info," varcor = on\n"); + _unur_string_append(info,"\n"); + } + + /* Hints */ + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + +} /* end of _unur_vempk_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/vempk.h b/vendor/unuran-1.11.0/src/methods/vempk.h new file mode 100644 index 0000000..f55682c --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/vempk.h @@ -0,0 +1,134 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: vempk.h * + * * + * PURPOSE: * + * function prototypes for method VEMPK * + * ((Vector) EMPirical distribution with Kernel smoothing) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD VEMPK (Vector) EMPirical distribution with Kernel smoothing + + =UP Methods_for_CVEMP + + =REQUIRED observed sample + + =SPEED Set-up: slow, + Sampling: slow (depends on dimension) + + =REINIT not implemented + + =REF [HLa00] [HLD04: Sect.12.2.1] + + =DESCRIPTION + VEMPK generates random variates from a multivariate empirical + distribution that is given by an observed sample. The idea is + that simply choosing a random point from the sample and to + return it with some added noise results in a method that has + very nice properties, as it can be seen as sampling from a + kernel density estimate. + Clearly we have to decide about the density of the noise (called kernel) + and about the covariance matrix of the noise. + The mathematical theory of kernel density estimation shows us that we + are comparatively free in choosing the kernel. + It also supplies us with a simple formula to compute the optimal + standarddeviation of the noise, called bandwidth (or window + width) of the kernel. + + Currently only a Gaussian kernel with the same covariance matrix + as the given sample is implemented. + However it is possible to choose between a variance corrected + version or those with optimal MISE. + Additionally a smoothing factor can be set to adjust the + estimated density to non-bell-shaped data densities. + + =HOWTOUSE + VEMPK uses empirical distributions. The main parameter would be + the choice if of kernel density. However, currently only + Gaussian kernels are supported. The parameters for the density + are computed by a simple but robust method. However, it is + possible to control its behavior by changing the smoothing + factor. + Additionally, variance correction can be swithed on (at the + price of suboptimal MISE). + + =END + +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_vempk_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_vempk_set_smoothing( UNUR_PAR *parameters, double smoothing ); +/* */ + +int unur_vempk_chg_smoothing( UNUR_GEN *generator, double smoothing ); +/* + Set and change the smoothing factor. + The smoothing factor controlles how ``smooth'' the resulting density + estimation will be. A smoothing factor equal to 0 results in naive + resampling. A very large smoothing factor (together with the + variance correction) results in a density which is approximately + equal to the kernel. + Default is 1 which results in a smoothing parameter minimising + the MISE (mean integrated squared error) if the data are not too + far away from normal. If a large smoothing factor is used, then + variance correction must be switched on. + + Default: @code{1} +*/ + +int unur_vempk_set_varcor( UNUR_PAR *parameters, int varcor ); +/* */ + +int unur_vempk_chg_varcor( UNUR_GEN *generator, int varcor ); +/* + Switch variance correction in generator on/off. + If @var{varcor} is TRUE then the variance of the used + density estimation is the same as the sample variance. However this + increases the MISE of the estimation a little bit. + + Default is FALSE. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/vempk_struct.h b/vendor/unuran-1.11.0/src/methods/vempk_struct.h new file mode 100644 index 0000000..ff13ee0 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/vempk_struct.h @@ -0,0 +1,62 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: vempk_struct.h * + * * + * PURPOSE: * + * declares structures for method VEMPK * + * ((Vector) EMPirical distribution with Kernel smoothing) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_vempk_par { + /* the observed sample is stored in the distribution object */ + double smoothing; /* determines how "smooth" the estimated density will be */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_vempk_gen { + double *observ; /* pointer to the array of the observations */ + int n_observ; /* number of observations */ + int dim; /* dimension of distribution */ + + UNUR_GEN *kerngen; /* random variate generator for kernel */ + + double smoothing; /* determines how "smooth" the estimated density will be */ + + double hopt; /* for bandwidth selection */ + double hact; /* actually used value for bandwith */ + double corfac; /* correction for variance correction */ + double *xbar; /* mean vector of sample, for variance correction */ +}; + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/methods/vnrou.c b/vendor/unuran-1.11.0/src/methods/vnrou.c new file mode 100644 index 0000000..0a549d8 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/vnrou.c @@ -0,0 +1,1119 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: vnrou.c * + * * + * TYPE: continuous multivariate random variate * + * METHOD: naive ratio-of-uniforms method * + * * + * DESCRIPTION: * + * Given PDF and (optionally) a bounding rectangle for the acceptance * + * region. * + * Produce a value x consistent with its density * + * The bounding rectangle is computed numerically if it is not given. * + * * + * REQUIRED: * + * pointer to the density function * + * OPTIONAL: * + * mode of the density * + * bounding rectangle of acceptance region * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Wakefield J.C., Gelfand A.E., Smith A.F.M. * + * Efficient generation of random variates via the ratio-of-uniforms * + * method. * + * Statistics and Computing (1991) 1, pp (129-133) * + * * + * [2] Hoermann, W., Leydold J., and Derflinger, G. (2004): * + * Automatic non-uniform random variate generation, Springer, Berlin. * + * Section 2.4, Algorithm 2.9 (RoU), p.35 * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen_source.h" +#include "vnrou.h" +#include "vnrou_struct.h" + +#ifdef UNUR_ENABLE_INFO +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Variants: */ + +#define VNROU_VARFLAG_VERIFY 0x002u /* run verify mode */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +#define VNROU_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +#define VNROU_SET_U 0x001u /* set u values of bounding rectangle */ +#define VNROU_SET_V 0x002u /* set v values of bounding rectangle */ +#define VNROU_SET_R 0x008u /* set r-parameter */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "VNROU" /* type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_vnrou_init( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* Initialize new generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_vnrou_reinit( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* Reinitialize generator. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_vnrou_create( struct unur_par *par ); +/*---------------------------------------------------------------------------*/ +/* create new (almost empty) generator object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_gen *_unur_vnrou_clone( const struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_vnrou_free( struct unur_gen *gen); +/*---------------------------------------------------------------------------*/ +/* destroy generator object. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_vnrou_sample_cvec( struct unur_gen *gen, double *vec ); +static int _unur_vnrou_sample_check( struct unur_gen *gen, double *vec ); +/*---------------------------------------------------------------------------*/ +/* sample from generator. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_vnrou_rectangle( struct unur_gen *gen ); +/*---------------------------------------------------------------------------*/ +/* compute (minimal) bounding rectangle. */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ +static void _unur_vnrou_debug_init( const struct unur_gen *gen ); + +/*---------------------------------------------------------------------------*/ +/* print after generator has been initialized has completed. */ +/*---------------------------------------------------------------------------*/ +#endif + +#ifdef UNUR_ENABLE_INFO +static void _unur_vnrou_info( struct unur_gen *gen, int help ); +/*---------------------------------------------------------------------------*/ +/* create info string. */ +/*---------------------------------------------------------------------------*/ +#endif + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define DISTR_IN distr->data.cvec /* data for distribution object */ + +#define PAR ((struct unur_vnrou_par*)par->datap) /* data for parameter object */ +#define GEN ((struct unur_vnrou_gen*)gen->datap) /* data for generator object */ +#define DISTR gen->distr->data.cvec /* data for distribution in generator object */ +#define SAMPLE gen->sample.cvec /* pointer to sampling routine */ +#define PDF(x) _unur_cvec_PDF((x),(gen->distr)) /* call to PDF */ + +/*---------------------------------------------------------------------------*/ + +#define _unur_vnrou_getSAMPLE(gen) \ + ( ((gen)->variant & VNROU_VARFLAG_VERIFY) \ + ? _unur_vnrou_sample_check : _unur_vnrou_sample_cvec ) + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Public: User Interface (API) **/ +/*****************************************************************************/ + +struct unur_par * +unur_vnrou_new( const struct unur_distr *distr ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par; + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CVEC) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CVEC,NULL); + + if (DISTR_IN.pdf == NULL) { + _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); + return NULL; + } + + /* allocate structure */ + par = _unur_par_new( sizeof(struct unur_vnrou_par) ); + COOKIE_SET(par,CK_VNROU_PAR); + + /* copy input */ + par->distr = distr; /* pointer to distribution object */ + + /* set default values */ + PAR->r = 1.; /* r-parameter of the generalized method */ + PAR->vmax = 0.; /* v-boundary of bounding rectangle (unknown) */ + PAR->umin = NULL; /* u-boundary of bounding rectangle (unknown) */ + PAR->umax = NULL; /* u-boundary of bounding rectangle (unknown) */ + par->method = UNUR_METH_VNROU; /* method and default variant */ + par->variant = 0u; /* default variant */ + par->set = 0u; /* inidicate default parameters */ + par->urng = unur_get_default_urng(); /* use default urng */ + par->urng_aux = NULL; /* no auxilliary URNG required */ + par->debug = _unur_default_debugflag; /* set default debugging flags */ + + /* routine for starting generator */ + par->init = _unur_vnrou_init; + + return par; + +} /* end of unur_vnrou_new() */ + +/*****************************************************************************/ + +int +unur_vnrou_set_u( struct unur_par *par, double *umin, double *umax ) + /*----------------------------------------------------------------------*/ + /* Sets left and right u-boundary of bounding rectangle. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* umin ... left boundary of rectangle */ + /* umax ... right boundary of rectangle */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int d; /* index used in dimension loops (0 <= d < dim) */ + + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, VNROU ); + _unur_check_NULL( GENTYPE, umin, UNUR_ERR_NULL ); + _unur_check_NULL( GENTYPE, umax, UNUR_ERR_NULL ); + + /* check new parameter for generator */ + for (d=0; ddistr->dim; d++) { + if (!_unur_FP_greater(umax[d],umin[d])) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"umax <= umin"); + return UNUR_ERR_PAR_SET; + } + } + + /* set values */ + PAR->umin = umin; + PAR->umax = umax; + + /* changelog */ + par->set |= VNROU_SET_U; + + return UNUR_SUCCESS; + +} /* end of unur_vnrou_set_u() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_vnrou_chg_u( struct unur_gen *gen, double *umin, double *umax ) + /*----------------------------------------------------------------------*/ + /* Sets left and right u-boundary of bounding rectangle. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* umin ... left boundary of rectangle */ + /* umax ... right boundary of rectangle */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int d; /* index used in dimension loops (0 <= d < dim) */ + + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, VNROU, UNUR_ERR_GEN_INVALID ); + _unur_check_NULL( GENTYPE, umin, UNUR_ERR_NULL ); + _unur_check_NULL( GENTYPE, umax, UNUR_ERR_NULL ); + + /* check new parameter for generator */ + for (d=0; ddim; d++) { + if (!_unur_FP_greater(umax[d],umin[d])) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"umax <= umin"); + return UNUR_ERR_PAR_SET; + } + } + + /* set values */ + memcpy(GEN->umin, umin, GEN->dim * sizeof(double)); + memcpy(GEN->umax, umax, GEN->dim * sizeof(double)); + + /* changelog */ + gen->set |= VNROU_SET_U; + + return UNUR_SUCCESS; + +} /* end of unur_vnrou_chg_u() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_vnrou_set_v( struct unur_par *par, double vmax ) + /*----------------------------------------------------------------------*/ + /* Sets upper v-boundary of bounding rectangle. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* vmax ... upper boundary of rectangle */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, VNROU ); + + /* check new parameter for generator */ + if (vmax <= 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"vmax <= 0"); + return UNUR_ERR_PAR_SET; + } + + /* store values */ + PAR->vmax = vmax; + + /* changelog */ + par->set |= VNROU_SET_V; + + return UNUR_SUCCESS; + +} /* end of unur_vnrou_set_v() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_vnrou_chg_v( struct unur_gen *gen, double vmax ) + /*----------------------------------------------------------------------*/ + /* Sets upper v-boundary of bounding rectangle. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* vmax ... upper boundary of rectangle */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, VNROU, UNUR_ERR_GEN_INVALID ); + + /* check new parameter for generator */ + if (vmax <= 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"vmax <= 0"); + return UNUR_ERR_PAR_SET; + } + + /* store values */ + GEN->vmax = vmax; + + /* changelog */ + gen->set |= VNROU_SET_V; + + return UNUR_SUCCESS; + +} /* end of unur_vnrou_chg_v() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_vnrou_set_r( struct unur_par *par, double r ) + /*----------------------------------------------------------------------*/ + /* Set the r-parameter for the generalized ratio-of-uniforms method. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* r ... r-parameter */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, VNROU ); + + /* check new parameter for generator */ + if (r <= 0.) { + _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"r<=0"); + return UNUR_ERR_PAR_SET; + } + + /* store data */ + PAR->r = r; + + /* changelog */ + par->set |= VNROU_SET_R; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_vnrou_set_r() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_vnrou_set_verify( struct unur_par *par, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); + _unur_check_par_object( par, VNROU ); + + /* we use a bit in variant */ + par->variant = (verify) ? (par->variant | VNROU_VARFLAG_VERIFY) : (par->variant & (~VNROU_VARFLAG_VERIFY)); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_vnrou_set_verify() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_vnrou_chg_verify( struct unur_gen *gen, int verify ) + /*----------------------------------------------------------------------*/ + /* turn verifying of algorithm while sampling on/off */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* verify ... 0 = no verifying, !0 = verifying */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* comment: */ + /* no verifying is the default */ + /*----------------------------------------------------------------------*/ +{ + /* check input */ + _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); + _unur_check_gen_object( gen, VNROU, UNUR_ERR_GEN_INVALID ); + + /* we must not change this switch when sampling has been disabled by + using a pointer to the error producing routine */ + if (SAMPLE == _unur_sample_cvec_error) + return UNUR_FAILURE; + + if (verify) + /* turn verify bounding rectangle on */ + gen->variant |= VNROU_VARFLAG_VERIFY; + else + /* turn verify bounding rectangle off */ + gen->variant &= ~VNROU_VARFLAG_VERIFY; + + SAMPLE = _unur_vnrou_getSAMPLE(gen); + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of unur_vnrou_chg_verify() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_vnrou_get_volumehat( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* Get the volume of below the hat. */ + /* For normalized densities, i.e. when the volume below PDF is 1, */ + /* this value equals the rejection constant for the vnrou method. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /*----------------------------------------------------------------------*/ +{ + double vol; + int d; + + /* check arguments */ + _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); + _unur_check_gen_object( gen, VNROU, UNUR_INFINITY ); + + /* compute volume of bounding rectangle */ + vol = GEN->vmax; + for (d=0; ddim; d++) { + vol *= (GEN->umax[d]-GEN->umin[d]); + } + /* compute volume of corresponding hat function */ + vol *= (GEN->r*GEN->dim+1); + + /* return result */ + return vol; +} /* end of unur_vnrou_get_volumehat() */ + + +/*****************************************************************************/ +/** Private **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_vnrou_init( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* initialize new generator */ + /* */ + /* parameters: */ + /* params ... pointer to paramters for building generator object */ + /* */ + /* return: */ + /* pointer to generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); + + /* check input */ + if ( par->method != UNUR_METH_VNROU ) { + _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); + return NULL; } + COOKIE_CHECK(par,CK_VNROU_PAR,NULL); + + /* create a new empty generator object */ + gen = _unur_vnrou_create(par); + _unur_par_free(par); + if (!gen) return NULL; + + /* compute bounding rectangle */ + if (_unur_vnrou_rectangle(gen)!=UNUR_SUCCESS) { + _unur_vnrou_free(gen); return NULL; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug) _unur_vnrou_debug_init(gen); +#endif + + return gen; + +} /* end of _unur_vnrou_init() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_vnrou_reinit( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* re-initialize (existing) generator. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int rcode; + + /* compute bounding rectangle */ + if ( (rcode = _unur_vnrou_rectangle(gen))!=UNUR_SUCCESS) { + return rcode; + } + + /* (re)set sampling routine */ + SAMPLE = _unur_vnrou_getSAMPLE(gen); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (gen->debug & VNROU_DEBUG_REINIT) _unur_vnrou_debug_init(gen); +#endif + + return UNUR_SUCCESS; +} /* end of _unur_vnrou_reinit() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_vnrou_create( struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* allocate memory for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* pointer to (empty) generator object with default settings */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* check arguments */ + CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_VNROU_PAR,NULL); + + /* create new generic generator object */ + gen = _unur_generic_create( par, sizeof(struct unur_vnrou_gen) ); + + /* magic cookies */ + COOKIE_SET(gen,CK_VNROU_GEN); + + /* set generator identifier */ + gen->genid = _unur_set_genid(GENTYPE); + + /* routines for sampling and destroying generator */ + SAMPLE = _unur_vnrou_getSAMPLE(gen); + gen->destroy = _unur_vnrou_free; + gen->clone = _unur_vnrou_clone; + gen->reinit = _unur_vnrou_reinit; + + /* copy parameters into generator object */ + GEN->dim = gen->distr->dim; /* dimension */ + GEN->r = PAR->r; /* r-parameter of the vnrou method */ + GEN->vmax = PAR->vmax; /* upper v-boundary of bounding rectangle */ + + /* allocate memory for u-boundary arrays */ + GEN->umin = _unur_xmalloc( GEN->dim * sizeof(double)); /* bounding rectangle */ + GEN->umax = _unur_xmalloc( GEN->dim * sizeof(double)); /* bounding rectangle */ + + if (PAR->umin != NULL) memcpy(GEN->umin, PAR->umin, GEN->dim * sizeof(double)); + if (PAR->umax != NULL) memcpy(GEN->umax, PAR->umax, GEN->dim * sizeof(double)); + + /* get center of the distribution */ + GEN->center = unur_distr_cvec_get_center(gen->distr); + +#ifdef UNUR_ENABLE_INFO + /* set function for creating info string */ + gen->info = _unur_vnrou_info; +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_vnrou_create() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_vnrou_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#define CLONE ((struct unur_vnrou_gen*)clone->datap) + + struct unur_gen *clone; + + /* check arguments */ + CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_VNROU_GEN,NULL); + + /* create generic clone */ + clone = _unur_generic_clone( gen, GENTYPE ); + + /* allocate memory for u-arrays */ + CLONE->umin = _unur_xmalloc( GEN->dim * sizeof(double)); + CLONE->umax = _unur_xmalloc( GEN->dim * sizeof(double)); + + /* copy parameters into clone object */ + memcpy(CLONE->umin, GEN->umin, GEN->dim * sizeof(double)); + memcpy(CLONE->umax, GEN->umax, GEN->dim * sizeof(double)); + + /* copy data */ + CLONE->center = unur_distr_cvec_get_center(clone->distr); + + return clone; + +#undef CLONE +} /* end of _unur_vnrou_clone() */ + +/*****************************************************************************/ + +int +_unur_vnrou_sample_cvec( struct unur_gen *gen, double *vec ) + /*----------------------------------------------------------------------*/ + /* sample from generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* vec ... random vector (result) */ + /*----------------------------------------------------------------------*/ +{ + double U, V; + int d, dim; /* index used in dimension loops (0 <= d < dim) */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_VNROU_GEN,UNUR_ERR_COOKIE); + + dim = GEN->dim; + + while (1) { + + /* generate point uniformly on rectangle */ + while ( _unur_iszero(V = _unur_call_urng(gen->urng)) ); + V *= GEN->vmax; + for (d=0; dumin[d] + _unur_call_urng(gen->urng) * (GEN->umax[d] - GEN->umin[d]); + vec[d] = U/pow(V,GEN->r) + GEN->center[d]; + } + + /* X[] inside domain ? */ + + /* accept or reject */ + if (V <= pow(PDF(vec),1./(GEN->r * dim + 1.))) + return UNUR_SUCCESS; + } + +} /* end of _unur_vnrou_sample() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_vnrou_sample_check( struct unur_gen *gen, double *vec ) + /*----------------------------------------------------------------------*/ + /* sample from generator and verify that method can be used */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* vec ... random sample vector (return) */ + /*----------------------------------------------------------------------*/ +{ + double U, V; + int d, dim; /* index used in dimension loops (0 <= d < dim) */ + int hat_error; + + double fx,sfx,xfx; + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + COOKIE_CHECK(gen,CK_VNROU_GEN,UNUR_ERR_COOKIE); + + dim = GEN->dim; + + while (1) { + /* generate point uniformly on rectangle */ + while ( _unur_iszero(V = _unur_call_urng(gen->urng)) ); + V *= GEN->vmax; + for (d=0; dumin[d] + _unur_call_urng(gen->urng) * (GEN->umax[d] - GEN->umin[d]); + vec[d] = U/pow(V,GEN->r) + GEN->center[d]; + } + + /* X[] inside domain ? */ + + /* evaluate PDF */ + fx = PDF(vec); + + /* a point on the boundary of the region of acceptance + has the coordinates ( (vec[]-center[]) * (fx)^(r/r*dim+1)), fx^(1/r*dim+1) ). */ + sfx = pow( fx, 1./(GEN->r * dim+1.) ); + /* check hat */ + hat_error=0; + if ( sfx > (1.+DBL_EPSILON) * GEN->vmax ) hat_error++; + + sfx = pow( fx, GEN->r/(GEN->r * dim + 1.) ); + for (d=0; dcenter[d]) * sfx; + if ( (xfx < (1.+UNUR_EPSILON) * GEN->umin[d]) + || (xfx > (1.+UNUR_EPSILON) * GEN->umax[d])) + hat_error++; + } + + if (hat_error>0) _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) > hat(x)"); + + /* accept or reject */ + if (V <= pow(PDF(vec),1./( GEN->r * dim + 1.))) + return UNUR_SUCCESS; + } + +} /* end of _unur_vnrou_sample_check() */ + +/*****************************************************************************/ + +void +_unur_vnrou_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if( !gen ) /* nothing to do */ + return; + + /* check input */ + if ( gen->method != UNUR_METH_VNROU ) { + _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); + return; } + COOKIE_CHECK(gen,CK_VNROU_GEN,RETURN_VOID); + + /* we cannot use this generator object any more */ + SAMPLE = NULL; /* make sure to show up a programming error */ + + /* free memory */ + if (GEN->umin) free(GEN->umin); + if (GEN->umax) free(GEN->umax); + _unur_generic_free(gen); + +} /* end of _unur_vnrou_free() */ + +/*****************************************************************************/ +/** Auxilliary Routines **/ +/*****************************************************************************/ + +int +_unur_vnrou_rectangle( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* compute universal bounding rectangle */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + + int d; /* index used in dimension loops (0 <= d < dim) */ + struct MROU_RECTANGLE *rr; + int rectangle_compute; + + /* check arguments */ + CHECK_NULL( gen, UNUR_ERR_NULL ); + COOKIE_CHECK( gen,CK_VNROU_GEN, UNUR_ERR_COOKIE ); + + /* Boundary rectangle is already set */ + if ((gen->set & VNROU_SET_U) && (gen->set & VNROU_SET_V)) { + return UNUR_SUCCESS; + } + + /* Allocating and filling mrou_rectangle struct */ + rr = _unur_mrou_rectangle_new(); + + rr->distr = gen->distr; + rr->dim = GEN->dim; + rr->umin = GEN->umin; + rr->umax = GEN->umax; + rr->r = GEN->r; + rr->center = GEN->center; + rr->genid = gen->genid; + + /* calculate bounding rectangle */ + rectangle_compute = _unur_mrou_rectangle_compute(rr); + + if (!(gen->set & VNROU_SET_V)) { + /* user has not provided any upper bound for v */ + GEN->vmax = rr->vmax; + } + + if (!(gen->set & VNROU_SET_U)) { + /* user has not provided any bounds for u */ + for (d=0; ddim; d++) { + GEN->umin[d] = rr->umin[d]; + GEN->umax[d] = rr->umax[d]; + } + } + + free(rr); + + if (rectangle_compute != UNUR_SUCCESS) + return UNUR_ERR_INF; + + /* o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_vnrou_rectangle() */ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_vnrou_debug_init( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* write info about generator into LOG file */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int d, dim; /* index used in dimension loops (0 <= d < dim) */ + double vol; + + /* check arguments */ + CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_VNROU_GEN,RETURN_VOID); + + LOG = unur_get_stream(); + dim = GEN->dim; + + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s: type = continuous multivariate random variates\n",gen->genid); + fprintf(LOG,"%s: method = vnrou (naive ratio-of-uniforms)\n",gen->genid); + fprintf(LOG,"%s:\n",gen->genid); + + _unur_distr_cvec_debug( gen->distr, gen->genid ); + + fprintf(LOG,"%s: sampling routine = _unur_vnrou_sample",gen->genid); + if (gen->variant & VNROU_VARFLAG_VERIFY) fprintf(LOG,"_check"); + fprintf(LOG,"()\n%s:\n",gen->genid); + + /* parameters */ + fprintf(LOG,"%s: r-parameter = %g",gen->genid, GEN->r); + _unur_print_if_default(gen,VNROU_SET_R); + fprintf(LOG,"\n%s:\n",gen->genid); + + /* print center */ + _unur_matrix_print_vector( GEN->dim, GEN->center, "center =", LOG, gen->genid, "\t "); + + /* print bounding rectangle */ + fprintf(LOG,"%s: Rectangle:",gen->genid); + if (!((gen->set & VNROU_SET_U) && (gen->set & VNROU_SET_V))) + fprintf(LOG,"\t[computed]"); + else + fprintf(LOG,"\t[input]"); + fprintf(LOG,"\n"); + + vol = GEN->vmax; + fprintf(LOG,"%s:\tvmax = %g\n",gen->genid, GEN->vmax); + for (d=0; dumax[d]-GEN->umin[d]); + fprintf(LOG,"%s:\tumin[%d],umax[%d] = (%g,%g)\n",gen->genid, + d, d, GEN->umin[d], GEN->umax[d]); + } + fprintf(LOG,"%s:\n",gen->genid); + fprintf(LOG,"%s:\tvolume = %g\t(hat = %g)\n",gen->genid, vol, vol*(GEN->r*GEN->dim+1)); + fprintf(LOG,"%s:\n",gen->genid); + +} /* end of _unur_vnrou_debug_init() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_INFO +/*---------------------------------------------------------------------------*/ + +void +_unur_vnrou_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* create character string that contains information about the */ + /* given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *info = gen->infostr; + struct unur_distr *distr = gen->distr; + int samplesize = 10000; + int i; + double hvol; + + /* generator ID */ + _unur_string_append(info,"generator ID: %s\n\n", gen->genid); + + /* distribution */ + _unur_string_append(info,"distribution:\n"); + _unur_distr_info_typename(gen); + _unur_string_append(info," dimension = %d\n",GEN->dim); + _unur_string_append(info," functions = PDF\n"); + _unur_distr_cvec_info_domain(gen); + + if ( distr->set & UNUR_DISTR_SET_MODE ) { + _unur_string_append(info," mode = "); + _unur_distr_info_vector( gen, DISTR.mode, GEN->dim); + } + _unur_string_append(info,"\n"); + + _unur_string_append(info," center = "); + _unur_distr_info_vector( gen, GEN->center, GEN->dim); + if ( !(distr->set & UNUR_DISTR_SET_CENTER) ) { + if ( distr->set & UNUR_DISTR_SET_MODE ) + _unur_string_append(info," [= mode]"); + else + _unur_string_append(info," [default]"); + } + _unur_string_append(info,"\n\n"); + + /* if (help) { */ + /* _unur_string_append(info,"\n"); */ + /* } */ + + /* method */ + _unur_string_append(info,"method: VNROU (Naive Ratio-Of-Uniforms)\n"); + _unur_string_append(info," r = %g\n", GEN->r); + _unur_string_append(info,"\n"); + + /* performance */ + _unur_string_append(info,"performance characteristics:\n"); + + _unur_string_append(info," bounding rectangle = "); + for (i=0; idim; i++) + _unur_string_append(info,"%s(%g,%g)", i?"x":"", GEN->umin[i], GEN->umax[i]); + _unur_string_append(info," x (0,%g)\n", GEN->vmax); + + hvol = GEN->vmax; + for (i=0; idim; i++) + hvol *= GEN->umax[i] - GEN->umin[i]; + _unur_string_append(info," volume(hat) = %g\n", hvol); + + _unur_string_append(info," rejection constant "); + if ((distr->set & UNUR_DISTR_SET_PDFVOLUME) && _unur_isone(GEN->r)) + _unur_string_append(info,"= %g\n", (GEN->dim + 1.) * hvol / DISTR.volume); + else + _unur_string_append(info,"= %.2f [approx.]\n", + unur_test_count_urn(gen,samplesize,0,NULL)/((1.+GEN->dim)*samplesize)); + _unur_string_append(info,"\n"); + + /* parameters */ + if (help) { + _unur_string_append(info,"parameters:\n"); + + _unur_string_append(info," r = %g %s\n", GEN->r, + (gen->set & VNROU_SET_R) ? "" : "[default]"); + + _unur_string_append(info," v = %g %s\n", GEN->vmax, + (gen->set & VNROU_SET_V) ? "" : "[numeric.]"); + + _unur_string_append(info," u = "); + _unur_distr_info_vector( gen, GEN->umin, GEN->dim); + _unur_string_append(info," -- "); + _unur_distr_info_vector( gen, GEN->umax, GEN->dim); + _unur_string_append(info,"%s\n",(gen->set & VNROU_SET_U) ? "" : " [numeric.]"); + + if (gen->variant & VNROU_VARFLAG_VERIFY) + _unur_string_append(info," verify = on\n"); + + _unur_string_append(info,"\n"); + } + + /* Hints */ + if (help) { + if ( !(gen->set & VNROU_SET_V) ) + _unur_string_append(info,"[ Hint: %s ]\n", + "You can set \"v\" to avoid numerical estimate." ); + if ( !(gen->set & VNROU_SET_U) ) + _unur_string_append(info,"[ Hint: %s ]\n", + "You can set \"u\" to avoid slow (and inexact) numerical estimates." ); + _unur_string_append(info,"\n"); + } + +} /* end of _unur_vnrou_info() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_INFO */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/vnrou.h b/vendor/unuran-1.11.0/src/methods/vnrou.h new file mode 100644 index 0000000..6ce604f --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/vnrou.h @@ -0,0 +1,241 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: vnrou.h * + * * + * PURPOSE: * + * function prototypes for method VNROU * + * (Vector Naive Ratio-Of-Uniforms method) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/* + =METHOD VNROU Multivariate Naive Ratio-Of-Uniforms method + + =UP Methods_for_CVEC + + =REQUIRED PDF + + =OPTIONAL mode, center, bounding rectangle for acceptance region + + =SPEED Set-up: fast or slow, Sampling: slow + + =REINIT supported + + =REF [WGS91] + + =DESCRIPTION + VNROU is an implementation of the multivariate + ratio-of-uniforms method which uses a (minimal) bounding + hyper-rectangle, see also @ref{Ratio-of-Uniforms}. It uses an + additional parameter @i{r} that can be used for adjusting the + algorithm to the given distribution to improve performance + and/or to make this method applicable. Larger values of + @i{r} increase the class of distributions for which the + method works at the expense of higher rejection + constants. Moreover, this implementation uses the center + @unurmath{\mu} of the distribution (which is set to the mode or + mean by default, see unur_distr_cvec_get_center() for details of + its default values). + + The minimal bounding has then the coordinates + + @unurmathdisplay{ + v^+ = \sup\limits_{x} (f(x))^{1/r\,d+1}, \\ + u^-_i = \inf\limits_{x_i} (x_i-\mu_i) (f(x))^{r/r\,d+1}, \\ + u^+_i = \sup\limits_{x_i} (x_i-\mu_i) (f(x))^{r/r\,d+1}, } + + where @unurmath{x_i} is the @i{i}-th coordinate of point @i{x}; + @unurmath{\mu_i} is the @i{i}-th coordinate of the center + @unurmath{\mu.} + @unurmath{d} denotes the dimension of the distribution. + These bounds can either be given directly, or are computed + automatically by means of an numerical routine + by Hooke and Jeeves @unurbibref{HJa61} called direct search + (see @file{src/utils/hooke.c} for further references and + details). Of course this algorithm can fail, especially when + this rectangle is not bounded. + + It is important to note that the algorithm works with + @unurmath{PDF(x-center)} instead of + @unurmath{PDF(x),} i.e. the bounding rectangle has to be + provided for @unurmath{PDF(x-center).} + This is important as otherwise the acceptance region can become + a very long and skinny ellipsoid along a diagonal of the (huge) + bounding rectangle. + + VNROU is based on the rejection method (@pxref{Rejection}), + and it is important to note that the acceptance probability + decreases exponentially with dimension. Thus even for moderately + many dimensions (e.g. 5) the number of repetitions to get one + random vector can be prohibitively large and the algorithm seems + to stay in an infinite loop. + + =HOWTOUSE + For using the VNROU method UNU.RAN needs the PDF of the + distribution. Additionally, the parameter @i{r} can be set via + a unur_vnrou_set_r() call. Notice that the acceptance + probability decreases when @i{r} is increased. On the other + hand is is more unlikely that the bounding rectangle does not + exist if @i{r} is small. + + A bounding rectangle can be given by the + unur_vnrou_set_u() and unur_vnrou_set_v() calls. + + @emph{Important:} The bounding rectangle has to be + provided for the function @unurmath{PDF(x-center)!} + Notice that @code{center} is the center of the given + distribution, see unur_distr_cvec_set_center(). + If in doubt or if this value is not optimal, it can be changed + (overridden) by a unur_distr_cvec_set_center() call. + + If the coordinates of the bounding rectangle are not provided by + the user then the minimal bounding rectangle is computed + automatically. + + By means of unur_vnrou_set_verify() and unur_vnrou_chg_verify() + one can run the sampling algorithm in a checking mode, i.e., in + every cycle of the rejection loop it is checked whether the used + rectangle indeed enclosed the acceptance region of the + distribution. When in doubt (e.g., when it is not clear whether + the numerical routine has worked correctly) this can be used to + run a small Monte Carlo study. + + @strong{Important:} + The rejection constant (i.e. the expected number of iterations + for generationg one random vector) can be extremely high, in + particular when the dimension is 4 or higher. + Then the algorithm will perform almost infinite loops. + Thus it is recommended to read the volume below the hat function + by means of the unur_vnrou_get_volumehat() call. The returned + number divided by the volume below the PDF (which is 1 in case + of a normalized PDF) gives the rejection constant. + + It is possible to change the parameters and the domain of the chosen + distribution and run unur_reinit() to reinitialize the generator object. + Notice, that the coordinates of a bounding rectangle given by + unur_vnrou_set_u() and unur_vnrou_set_v() calls are used also + when the generator is reused. These can be changed by means of + unur_vnrou_chg_u() and unur_vnrou_chg_v() calls. + (If no such coordinates have been given, then they are computed + numerically during the reinitialization proceedure.) + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_PAR *unur_vnrou_new( const UNUR_DISTR *distribution ); +/* + Get default parameters for generator. +*/ + +/*...........................................................................*/ + +int unur_vnrou_set_u( UNUR_PAR *parameters, double *umin, double *umax ); +/* + Sets left and right boundaries of bounding hyper-rectangle. + If no values are given, the boundary of the minimal bounding + hyper-rectangle is computed numerically. + + @strong{Important}: The boundaries are those of the density shifted + by the center of the distribution, i.e., for the + function @unurmath{PDF(x-center)!} + + @emph{Notice}: Computing the minimal bounding rectangle may fail + under some circumstances. Moreover, for multimodal distributions + the bounds might be too small as only local extrema are computed. + Nevertheless, for log-concave distributions it should work. + + Default: not set (i.e. computed automatically) +*/ + +int unur_vnrou_chg_u( UNUR_GEN *generator, double *umin, double *umax ); +/* + Change left and right boundaries of bounding hyper-rectangle. +*/ + +int unur_vnrou_set_v( UNUR_PAR *parameters, double vmax ); +/* + Set upper boundary for bounding hyper-rectangle. + If no values are given, the density at the mode is evaluated. + If no mode is given for the distribution it is computed + numerically (and might fail). + + Default: not set (i.e. computed automatically) +*/ + +int unur_vnrou_chg_v( UNUR_GEN *generator, double vmax ); +/* + Change upper boundary for bounding hyper-rectangle. +*/ + +int unur_vnrou_set_r( UNUR_PAR *parameters, double r ); +/* + Sets the parameter @var{r} of the generalized multivariate + ratio-of-uniforms method. + + @emph{Notice}: This parameter must satisfy @var{r}>0. + + Default: @code{1}. +*/ + +int unur_vnrou_set_verify( UNUR_PAR *parameters, int verify ); +/* + Turn verifying of algorithm while sampling on/off. + + If the condition PDF(@i{x}) <= hat(@i{x}) is + violated for some @i{x} then @code{unur_errno} is set to + @code{UNUR_ERR_GEN_CONDITION}. However notice that this might + happen due to round-off errors for a few values of + @i{x} (less than 1%). + + Default is FALSE. +*/ + +int unur_vnrou_chg_verify( UNUR_GEN *generator, int verify ); +/* + Change the verifying of algorithm while sampling on/off. +*/ + +double unur_vnrou_get_volumehat( const UNUR_GEN *generator ); +/* + Get the volume of below the hat. + For normalized densities, i.e. when the volume below PDF is 1, + this value equals the rejection constant for the vnrou method. + + In case of an error UNUR_INFINITY is returned. +*/ + + +/* =END */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/vnrou_struct.h b/vendor/unuran-1.11.0/src/methods/vnrou_struct.h new file mode 100644 index 0000000..5a13de6 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/vnrou_struct.h @@ -0,0 +1,56 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: vnrou_struct.h * + * * + * PURPOSE: * + * declares structures for method VNROU * + * (Vector Naive Ratio Of Uniforms) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Information for constructing the generator */ + +struct unur_vnrou_par { + double r; /* r-parameter of the vnrou method */ + double *umin, *umax; /* boundary rectangle u-coordinates */ + double vmax; /* boundary rectangle v-coordinate */ +}; + +/*---------------------------------------------------------------------------*/ +/* The generator object */ + +struct unur_vnrou_gen { + int dim; /* dimension of distribution */ + double r; /* r-parameter of the vnrou method */ + double *umin, *umax; /* boundary rectangle u-coordinates */ + double vmax; /* boundary rectangle v-coordinate */ + const double *center; /* center of distribution */ +}; + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/methods/x_gen.c b/vendor/unuran-1.11.0/src/methods/x_gen.c new file mode 100644 index 0000000..2d2c5ee --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/x_gen.c @@ -0,0 +1,827 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: x_gen.c * + * * + * miscelleanous routines for manipulation generator objects * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "unur_methods_source.h" +#include "x_gen.h" +#include "x_gen_source.h" + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Call Init, Sampling, and Free functions **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen *unur_init( struct unur_par *par ) +{ + _unur_check_NULL(NULL,par,NULL); + return (par->init(par)); +} /* end of unur_init() */ + +/*---------------------------------------------------------------------------*/ + +int unur_reinit( struct unur_gen *gen ) +{ + int status = UNUR_SUCCESS; + _unur_check_NULL(NULL,gen,UNUR_ERR_NULL); + + if (gen->reinit) { + status = gen->reinit(gen); + if (status == UNUR_SUCCESS) return status; + } + else { + _unur_error(gen->genid,UNUR_ERR_NO_REINIT,""); + status = UNUR_ERR_NO_REINIT; + } + + /* error: change sampling routine */ + switch (gen->method & UNUR_MASK_TYPE) { + case UNUR_METH_DISCR: + gen->sample.discr = _unur_sample_discr_error; + break; + case UNUR_METH_CONT: + case UNUR_METH_CEMP: + gen->sample.cont = _unur_sample_cont_error; + break; + case UNUR_METH_VEC: + case UNUR_METH_CVEMP: + gen->sample.cvec = _unur_sample_cvec_error; + break; + case UNUR_METH_MAT: + gen->sample.matr = _unur_sample_matr_error; + break; + default: + _unur_error("reinit",UNUR_ERR_SHOULD_NOT_HAPPEN,""); + } + + return status; +} /* end of unur_reinit() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_sample_discr( struct unur_gen *gen ) +{ + CHECK_NULL(gen,0); + return (gen->sample.discr(gen)); +} /* end of unur_sample_discr() */ + +double +unur_sample_cont( struct unur_gen *gen ) +{ + CHECK_NULL(gen,UNUR_INFINITY); + return (gen->sample.cont(gen)); +} /* end of unur_sample_cont() */ + +int +unur_sample_vec( struct unur_gen *gen, double *vector ) +{ + CHECK_NULL(gen,UNUR_ERR_NULL); + return (gen->sample.cvec(gen,vector)); +} /* end of unur_sample_vec() */ + +int +unur_sample_matr( struct unur_gen *gen, double *matrix ) +{ + CHECK_NULL(gen,UNUR_ERR_NULL); + return (gen->sample.matr(gen,matrix)); +} /* end of unur_sample_matr() */ + +/*---------------------------------------------------------------------------*/ +/* Estimate quantiles */ + +double +unur_quantile ( struct unur_gen *gen, double U ) +{ + /* check arguments */ + CHECK_NULL(gen,FALSE); + + /* Remark: + * We DO NOT check the argument U here + * (i.e. whether 0<=U<=1 holds) + */ + switch (gen->method) { + case UNUR_METH_HINV: + return unur_hinv_eval_approxinvcdf(gen,U); + + case UNUR_METH_NINV: + return unur_ninv_eval_approxinvcdf(gen,U); + + case UNUR_METH_PINV: + return unur_pinv_eval_approxinvcdf(gen,U); + + case UNUR_METH_CSTD: + if (((struct unur_cstd_gen*)gen->datap)->is_inversion) + return unur_cstd_eval_invcdf(gen,U); + break; + + case UNUR_METH_MIXT: + if (((struct unur_mixt_gen*)gen->datap)->is_inversion) + return unur_mixt_eval_invcdf(gen,U); + break; + + case UNUR_METH_DGT: + return ((double) unur_dgt_eval_invcdf(gen,U)); + + case UNUR_METH_DSTD: + if (((struct unur_dstd_gen*)gen->datap)->is_inversion) + return unur_dstd_eval_invcdf(gen,U); + break; + } + + /* default: */ + _unur_error(gen->genid,UNUR_ERR_NO_QUANTILE,""); + return UNUR_INFINITY; + +} /* end of unur_quantile() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_gen_is_inversion ( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* check for type of generator object */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + if (gen==NULL) return FALSE; + + switch (gen->method) { + case UNUR_METH_HINV: + case UNUR_METH_NINV: + case UNUR_METH_PINV: + case UNUR_METH_DGT: + return TRUE; + + case UNUR_METH_CSTD: + return (((struct unur_cstd_gen*)gen->datap)->is_inversion); + + case UNUR_METH_MIXT: + return (((struct unur_mixt_gen*)gen->datap)->is_inversion); + + default: + return FALSE; + } +} /* end of unur_gen_is_inversion() */ + +/*---------------------------------------------------------------------------*/ +/* aux routines when no sampling routine is available */ + +int +_unur_sample_discr_error( struct unur_gen *gen ATTRIBUTE__UNUSED ) +{ + unur_errno = UNUR_ERR_GEN_CONDITION; + return 0; +} /* end of _unur_sample_discr_error() */ + +double +_unur_sample_cont_error( struct unur_gen *gen ATTRIBUTE__UNUSED ) +{ + unur_errno = UNUR_ERR_GEN_CONDITION; + return UNUR_INFINITY; +} /* end of _unur_sample_cont_error() */ + +int +_unur_sample_cvec_error( struct unur_gen *gen, double *vec ) +{ + int d; + unur_errno = UNUR_ERR_GEN_CONDITION; + for (d=0; d<(gen->distr->dim); d++) vec[d] = UNUR_INFINITY; + return UNUR_FAILURE; +} /* end of _unur_sample_cvec_error() */ + +int +_unur_sample_matr_error( struct unur_gen *gen, double *mat ) +{ + int n_rows, n_cols, dim, j; + + unur_errno = UNUR_ERR_GEN_CONDITION; + unur_distr_matr_get_dim(gen->distr, &n_rows, &n_cols ); + dim = n_rows * n_cols; + for (j=0; jdestroy(gen); +} /* end of unur_free() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Get data about generator object **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +const char * +unur_gen_info( struct unur_gen *gen, int help ) + /*----------------------------------------------------------------------*/ + /* return pointer to character string that contains information about */ + /* the given generator object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* help ... whether to print additional comments */ + /* */ + /* return: */ + /* pointer to character string */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +#ifdef UNUR_ENABLE_INFO + + /* check arguments */ + _unur_check_NULL("",gen,NULL); + + if (gen->info) { + /* prepare generator object for creating info string */ + if (gen->infostr == NULL) + /* either allocate memory block */ + gen->infostr = _unur_string_new(); + else + /* or clear string object (i.e. reset pointer) */ + _unur_string_clear(gen->infostr); + + /* create info string */ + gen->info((struct unur_gen*) gen, help); + + /* return info string */ + return gen->infostr->text; + } + else { + return NULL; + } +#else + + return "INFO string not enable"; + +#endif +} /* end of unur_gen_info() */ +/*---------------------------------------------------------------------------*/ + +int +unur_get_dimension( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get dimension of generator for multivariate distribution */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* dimension of distribution */ + /* */ + /* error: */ + /* return 0 */ + /*----------------------------------------------------------------------*/ +{ + return ((gen) ? gen->distr->dim : 0); +} /* end of unur_get_dimension() */ + +/*---------------------------------------------------------------------------*/ + +const char * +unur_get_genid( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get generator id */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to generator id */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + return ((gen) ? gen->genid : NULL); +} /* end of unur_get_genid() */ + +/*---------------------------------------------------------------------------*/ + +unsigned int +unur_get_method( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get identifier for generating method. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* ID for method (see unur_method.h) */ + /* */ + /* error: */ + /* return 0U */ + /*----------------------------------------------------------------------*/ +{ + return ((gen) ? gen->method : 0U); +} /* end of unur_get_method() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_get_distr( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get pointer to distribution object from generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to distribution object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + return ((gen) ? gen->distr : NULL); +} /* end of unur_get_distr() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_set_use_distr_privatecopy( struct unur_par *par, int use_privatecopy ) + /*----------------------------------------------------------------------*/ + /* Set flag whether the generator object should make a private copy or */ + /* just stores the pointer to the distribution object */ + /* */ + /* parameters: */ + /* par ... pointer to parameter object */ + /* use_privatecopy ... TRUE = use private copy */ + /* FALSE = store pointer to given distr. object */ + /* */ + /* return: */ + /* pointer to distribution object */ + /* */ + /* error: */ + /* return NULL */ + /* */ + /* WARNING! */ + /* Using a pointer to the external distribution object instead of a */ + /* private copy must be applied with EXTREME CARE! */ + /* When the distrubtion object is changed or freed then the generator */ + /* object does not work any more, might case a segmentation fault, or */ + /* (even worse) produces garbage. */ + /* On the other hand, when the generator object is initialized or used */ + /* to draw a random sampling the distribution object may be changed. */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL("",par,UNUR_ERR_NULL); + + par->distr_is_privatecopy = use_privatecopy; + return UNUR_SUCCESS; +} /* end of unur_set_use_distr_privatecopy() */ + + +/*****************************************************************************/ +/** **/ +/** Copy (clone) generator object **/ +/** **/ +/*****************************************************************************/ + +struct unur_gen * +unur_gen_clone( const struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( "Clone", gen, NULL ); + _unur_check_NULL( "Clone", gen->clone, NULL ); + + return (gen->clone(gen)); +} /* end of unur_gen_clone() */ + + +/*****************************************************************************/ +/** **/ +/** Create and free parameter objects **/ +/** **/ +/*****************************************************************************/ + +struct unur_par * +_unur_par_new( size_t s) + /*----------------------------------------------------------------------*/ + /* create new parameter object */ + /* */ + /* parameters: */ + /* s ... size of data structure */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par = _unur_xmalloc( sizeof(struct unur_par) ); + par->datap = _unur_xmalloc(s); + par->s_datap = s; + + /* set defaults for distribution object */ + par->distr_is_privatecopy = TRUE; /* use private copy of distribution object */ + + return par; +} /* end of _unur_par_new() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_par * +_unur_par_clone( const struct unur_par *par ) + /*----------------------------------------------------------------------*/ + /* copy parameter object */ + /* */ + /* parameters: */ + /* par ... pointer to parameter object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *clone; + + _unur_check_NULL("clone", par, NULL); + + clone = _unur_xmalloc( sizeof(struct unur_par) ); + memcpy (clone, par, sizeof(struct unur_par)); + + clone->datap = _unur_xmalloc(par->s_datap); + memcpy (clone->datap, par->datap, par->s_datap); + + return clone; +} /* end of unur_par_free() */ + +/*---------------------------------------------------------------------------*/ + +void +unur_par_free( struct unur_par *par) + /*----------------------------------------------------------------------*/ + /* free parameter object */ + /* */ + /* parameters: */ + /* par ... pointer to parameter object */ + /*----------------------------------------------------------------------*/ +{ + _unur_check_NULL("free", par, RETURN_VOID ); + _unur_par_free(par); +} /* end of unur_par_free() */ + +/*****************************************************************************/ +/** **/ +/** Create, copy (clone) and free generator objects **/ +/** **/ +/*****************************************************************************/ + +struct unur_gen * +_unur_generic_create( struct unur_par *par, size_t s ) + /*----------------------------------------------------------------------*/ + /* create new generic generator object */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* s ... size of data structure */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + + /* allocate memory for generator object */ + gen = _unur_xmalloc( sizeof(struct unur_gen) ); + gen->datap = _unur_xmalloc(s); + gen->s_datap = s; + + /* copy distribution object into generator object */ + gen->distr_is_privatecopy = par->distr_is_privatecopy; + if (gen->distr_is_privatecopy) + gen->distr = (par->distr) ? _unur_distr_clone(par->distr) : NULL; + else + gen->distr = (struct unur_distr *) par->distr; + + /* initialize function pointers */ + gen->destroy = NULL; /* destructor */ + gen->clone = NULL; /* clone generator */ + gen->reinit = NULL; /* reinit routine */ + + /* copy some parameters into generator object */ + gen->method = par->method; /* indicates method and variant */ + gen->variant = par->variant; /* indicates variant */ + gen->set = par->set; /* indicates parameter settings */ + gen->debug = par->debug; /* debuging flags */ + gen->urng = par->urng; /* pointer to urng */ + gen->urng_aux = par->urng_aux; /* pointer to auxilliary URNG */ + + gen->gen_aux = NULL; /* no auxilliary generator objects */ + gen->gen_aux_list = NULL; /* no auxilliary generator objects */ + gen->n_gen_aux_list = 0; + + /* status of generator object */ + gen->status = UNUR_FAILURE; /* not successfully created yet */ + +#ifdef UNUR_ENABLE_INFO + gen->infostr = NULL; /* pointer to info string */ + gen->info = NULL; /* routine that return info string */ +#endif + + /* return pointer to (almost empty) generator object */ + return gen; + +} /* end of _unur_generic_create() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +_unur_generic_clone( const struct unur_gen *gen, const char *type ) + /*----------------------------------------------------------------------*/ + /* copy (clone) generic generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* type ... type of generator (string) */ + /* */ + /* return: */ + /* pointer to clone of generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *clone; + + /* allocate memory for generator object and copy main part */ + clone = _unur_xmalloc( sizeof(struct unur_gen) ); + memcpy( clone, gen, sizeof(struct unur_gen) ); + clone->datap = _unur_xmalloc(gen->s_datap); + memcpy (clone->datap, gen->datap, gen->s_datap); + + /* set generator identifier */ + clone->genid = _unur_set_genid(type); + +#ifdef UNUR_ENABLE_INFO + /* do not copy pointer to info string */ + clone->infostr = NULL; +#endif + + /* copy distribution object into generator object */ + clone->distr_is_privatecopy = gen->distr_is_privatecopy; + if (clone->distr_is_privatecopy) + clone->distr = (gen->distr) ? _unur_distr_clone(gen->distr) : NULL; + else + clone->distr = gen->distr; + + /* auxiliary generators */ + if (gen->gen_aux) + clone->gen_aux = _unur_gen_clone( gen->gen_aux ); + if (gen->gen_aux_list && gen->n_gen_aux_list) { + clone->gen_aux_list = _unur_gen_list_clone( gen->gen_aux_list, gen->n_gen_aux_list ); + clone->n_gen_aux_list = gen->n_gen_aux_list; + } + + /* finished clone */ + return clone; +} /* _unur_generic_clone() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_generic_free( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* deallocate generator object */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /*----------------------------------------------------------------------*/ +{ + if (gen->gen_aux) + _unur_free(gen->gen_aux); + + if (gen->gen_aux_list && gen->n_gen_aux_list) + _unur_gen_list_free( gen->gen_aux_list, gen->n_gen_aux_list ); + + if (gen->distr_is_privatecopy && gen->distr) + _unur_distr_free( gen->distr ); + + _unur_free_genid(gen); + COOKIE_CLEAR(gen); + free(gen->datap); + +#ifdef UNUR_ENABLE_INFO + /* free pointer to info string */ + if (gen->infostr) _unur_string_free(gen->infostr); +#endif + + free(gen); +} /* end of _unur_generic_free() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Set and copy (clone) arrays of auxiliary generators **/ +/** **/ +/*****************************************************************************/ + +struct unur_gen ** +_unur_gen_list_set( struct unur_gen *gen, int n_gen_list ) + /*----------------------------------------------------------------------*/ + /* set all entries in list to same generator object 'gen' */ + /* */ + /* IMPORTANT: Be careful when using this call. When the resulting array */ + /* is stored in some multivariate generator object then 'gen' */ + /* _must not_ be used any more after this call! */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* n_gen_list ... length of array of generator objects */ + /* */ + /* return: */ + /* pointer to list of generator objects */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen **gen_list; + int i; + + /* check arguments */ + _unur_check_NULL( "gen_list_set", gen, NULL ); + + if (n_gen_list < 1) { + _unur_error("gen_list_set",UNUR_ERR_PAR_SET,"dimension < 1"); + return NULL; + } + + /* allocate memory for array */ + gen_list = _unur_xmalloc (n_gen_list * sizeof(struct unur_gen *)); + + /* copy pointer */ + for (i=0; i 1 && gen_list[0] == gen_list[1]) { + clone_list[0] = _unur_gen_clone( gen_list[0] ); + for (i=0; i1) ? 1 : 0; + imax = (gen_list[0] == gen_list[i2]) ? 1 : n_gen_list; + for (i=0; i_new} calls use a + @code{const} qualifier for the distribution argument. + However, if @var{use_privatecopy} is set to FALSE this qualifier is + discarded and the distribution might be changed. + + @strong{Important!} + If @var{use_localcopy} is set to FALSE and the corresponding + distribution object is changed then one must run unur_reinit() + on the generator object. + (Notice that currently not all generation methods support + reinitialization.) + + Default: @var{use_privatecopy} is TRUE. + +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ + +UNUR_GEN *unur_gen_clone( const UNUR_GEN *gen ); +void unur_par_free( UNUR_PAR *par); + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/x_gen_source.h b/vendor/unuran-1.11.0/src/methods/x_gen_source.h new file mode 100644 index 0000000..8a7c2b7 --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/x_gen_source.h @@ -0,0 +1,107 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: x_gen_source.h * + * * + * PURPOSE: * + * defines macros and function prototypes for handling * + * generator objects. * + * * + * USAGE: * + * only included in source_unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Invoke generators (macros to avoid function calls) */ + +#define _unur_init(par) (par)->init(par) + +#define _unur_sample_discr(gen) (gen)->sample.discr(gen) +#define _unur_sample_cont(gen) (gen)->sample.cont(gen) +#define _unur_sample_vec(gen,vector) (gen)->sample.cvec(gen,vector) + +#define _unur_free(gen) do {if(gen) (gen)->destroy(gen);} while(0) + +/*---------------------------------------------------------------------------*/ +/* get type of transformation method */ + +#define _unur_gen_is_discr(gen) ( ((gen)->distr->type == UNUR_DISTR_DISCR) ? 1 : 0 ) +#define _unur_gen_is_cont(gen) ( ((gen)->distr->type == UNUR_DISTR_CONT) ? 1 : 0 ) +#define _unur_gen_is_vec(gen) ( ((gen)->distr->type == UNUR_DISTR_CVEC) ? 1 : 0 ) + +/*---------------------------------------------------------------------------*/ +/* aux routine when no sampling routine is available */ + +int _unur_sample_discr_error( struct unur_gen *gen ); +double _unur_sample_cont_error( struct unur_gen *gen ); +int _unur_sample_cvec_error( struct unur_gen *gen, double *vec ); +int _unur_sample_matr_error( struct unur_gen *gen, double *mat ); + +/*---------------------------------------------------------------------------*/ +/* create, copy and free parameter object */ + +/* create an empty parameter object with data structure of size 's' */ +struct unur_par *_unur_par_new( size_t s ); + +struct unur_par *_unur_par_clone( const struct unur_par *par ); + +/* free memory allocated by parameter obejct */ +#define _unur_par_free(par) do {free((par)->datap); free(par);} while(0) + +/*---------------------------------------------------------------------------*/ +/* create (new) generic generator object */ + +struct unur_gen *_unur_generic_create( struct unur_par *par, size_t s ); + +/*---------------------------------------------------------------------------*/ +/* copy (clone) generator objects */ + +struct unur_gen *_unur_generic_clone( const struct unur_gen *gen, const char *type ); + +#define _unur_gen_clone(gen) ((gen)->clone(gen)) + +/*---------------------------------------------------------------------------*/ +/* free generic generator object */ + +void _unur_generic_free( struct unur_gen *gen ); + +/*---------------------------------------------------------------------------*/ +/* set and clone arrays of generator objects */ + +struct unur_gen **_unur_gen_list_set( struct unur_gen *gen, int n_gen_list ); +/* set all entries in list to same generator object */ +/* IMPORTANT: Be careful when using this call. When the resulting array */ +/* is stored in some multivariate generator object then 'gen' _must not_ */ +/* be used any more after this call! */ + +struct unur_gen **_unur_gen_list_clone( struct unur_gen **gen_list, int n_gen_list ); +/* clone list of generator objects */ + +void _unur_gen_list_free( struct unur_gen **gen_list, int n_gen_list ); +/* free list of generator objects */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/methods/x_gen_struct.h b/vendor/unuran-1.11.0/src/methods/x_gen_struct.h new file mode 100644 index 0000000..ca8e4ef --- /dev/null +++ b/vendor/unuran-1.11.0/src/methods/x_gen_struct.h @@ -0,0 +1,156 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: x_gen_struct.h * + * * + * PURPOSE: * + * declares structures for parameter and generator objects. * + * * + * USAGE: * + * only included in unur_struct.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* types for sampling routines */ + +/* for univariate continuous distribution */ +typedef double UNUR_SAMPLING_ROUTINE_CONT(struct unur_gen *gen); + +/* for univariate discrete distribution */ +typedef int UNUR_SAMPLING_ROUTINE_DISCR(struct unur_gen *gen); + +/* for multivariate continuous distribution */ +typedef int UNUR_SAMPLING_ROUTINE_CVEC(struct unur_gen *gen, double *vec); + + +/*---------------------------------------------------------------------------*/ +/* parameter objects */ + +struct unur_par { + void *datap; /* pointer to data for method */ + size_t s_datap; /* size of data structure */ + + struct unur_gen* (*init)(struct unur_par *par); + + unsigned method; /* indicates method and generator to be used */ + unsigned variant; /* indicates variant of method */ + unsigned set; /* stores which parameters have been changed */ + + UNUR_URNG *urng; /* pointer to uniform random number generator */ + UNUR_URNG *urng_aux; /* pointer to second (auxiliary) uniform RNG */ + + const struct unur_distr *distr; /* pointer to distribution object */ + int distr_is_privatecopy; /* whether the distribution object has to be + copied into the generator object (TRUE) or + just the pointer to the given (external) + distribution object (FALSE). + + Notice: The UNU.RAN design assumes that the + generator object keeps its own private copy. + However, in some cases it can be useful + to avoid making this copy, e.g. when only + a single random variate is required. + + HOWEVER, this must be used with extreme CARE! + + When the distrubtion object is changed or + freed then the generator object does not work + any more or (even worse) produces garbage. + */ + + unsigned debug; /* debugging flags */ +#ifdef UNUR_COOKIES + unsigned cookie; /* magic cookie */ +#endif +}; + + +/*---------------------------------------------------------------------------*/ +/* generator objects */ + +struct unur_gen { + void *datap; /* pointer to data for method */ + + union { + UNUR_SAMPLING_ROUTINE_CONT *cont; + UNUR_SAMPLING_ROUTINE_DISCR *discr; + UNUR_SAMPLING_ROUTINE_CVEC *cvec; + UNUR_SAMPLING_ROUTINE_CVEC *matr; + } sample; /* pointer to sampling routine */ + + UNUR_URNG *urng; /* pointer to uniform random number generator */ + UNUR_URNG *urng_aux; /* pointer to second (auxiliary) uniform RNG */ + + struct unur_distr *distr; /* distribution object */ + int distr_is_privatecopy; /* whether the distribution object was + copied into the generator object (TRUE) or + just the pointer to the given (external) + distribution object (FALSE). + + Notice: The UNU.RAN design assumes that the + generator object keeps its own private copy. + However, in some cases it can be useful + to avoid making this copy, e.g. when only + a single random variate is required. + + HOWEVER, this must be used with extreme CARE! + + When the distrubtion object is changed or + freed then the generator object does not work + any more or (even worse) produces garbage. + */ + + + unsigned method; /* indicates method and generator to be used */ + unsigned variant; /* indicates variant of method */ + unsigned set; /* stores which parameters have been changed */ + unsigned status; /* status of generator object */ + + char *genid; /* identifier for generator */ + + struct unur_gen *gen_aux; /* pointer to auxiliary generator object */ + struct unur_gen **gen_aux_list; /* list of pointers to auxiliary generator objects */ + int n_gen_aux_list; /* length of this list */ + + size_t s_datap; /* size of data structure */ + unsigned debug; /* debugging flags */ + + void (*destroy)(struct unur_gen *gen); /* pointer to destructor */ + struct unur_gen* (*clone)(const struct unur_gen *gen ); /* clone generator */ + int (*reinit)(struct unur_gen *gen); /* pointer to reinit routine */ + +#ifdef UNUR_ENABLE_INFO + struct unur_string *infostr; /* pointer to info string */ + void (*info)(struct unur_gen *gen, int help); /* routine for creating info string */ +#endif + +#ifdef UNUR_COOKIES + unsigned cookie; /* magic cookie */ +#endif +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/parser/.libs/libparser.a b/vendor/unuran-1.11.0/src/parser/.libs/libparser.a new file mode 100644 index 0000000..e130052 Binary files /dev/null and b/vendor/unuran-1.11.0/src/parser/.libs/libparser.a differ diff --git a/vendor/unuran-1.11.0/src/parser/Makefile b/vendor/unuran-1.11.0/src/parser/Makefile new file mode 100644 index 0000000..475f9a7 --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/Makefile @@ -0,0 +1,658 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# src/parser/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/unuran +pkgincludedir = $(includedir)/unuran +pkglibdir = $(libdir)/unuran +pkglibexecdir = $(libexecdir)/unuran +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +subdir = src/parser +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libparser_la_LIBADD = +am_libparser_la_OBJECTS = parser.lo stringparser.lo functparser.lo +libparser_la_OBJECTS = $(am_libparser_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I. -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/functparser.Plo \ + ./$(DEPDIR)/parser.Plo ./$(DEPDIR)/stringparser.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libparser_la_SOURCES) +DIST_SOURCES = $(libparser_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_CFLAGS = -Wall -Wextra -Wshadow -Wstrict-prototypes +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf +AUTOHEADER = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader +AUTOMAKE = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -fPIC +CPP = gcc -E +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +FILECMD = file +GREP = /usr/bin/grep +HAVE_DIVIDE_BY_ZERO = +HAVE_IEEE_COMPARISONS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAINT = # +MAKEINFO = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = unuran +PACKAGE_BUGREPORT = unuran@statmath.wu.ac.at +PACKAGE_NAME = unuran +PACKAGE_STRING = unuran 1.11.0 +PACKAGE_TARNAME = unuran +PACKAGE_URL = +PACKAGE_VERSION = 1.11.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +UNURAN_LT_VERSION = 16:1:0 +UNURAN_SUPPORTS_GSL = +UNURAN_SUPPORTS_PRNG = +UNURAN_SUPPORTS_RNGSTREAM = +VERSION = 1.11.0 +abs_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src/parser +abs_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src/parser +abs_top_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +have_valgrind = false +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../../ +top_builddir = ../.. +top_srcdir = ../.. +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libparser.la +libparser_la_SOURCES = \ + parser.c parser.h parser_source.h \ + stringparser.c stringparser_lists.ch \ + functparser.c \ + functparser_source.h \ + functparser_struct.h \ + functparser_symbols.h \ + functparser_stringgen.ch \ + functparser_debug.ch \ + functparser_deriv.ch \ + functparser_eval.ch \ + functparser_init.ch \ + functparser_parser.ch \ + functparser_scanner.ch + +EXTRA_DIST = \ + make_stringparser.pl \ + functparser_doc.dh \ + stringparser_doc.dh \ + stringparser_lists.ch.in + +parser_srcdir = $(top_srcdir)/src/parser + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + stringparser_lists.ch \ + stringparser_doc.dh \ + .dep-stringparser_c \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/parser/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/parser/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libparser.la: $(libparser_la_OBJECTS) $(libparser_la_DEPENDENCIES) $(EXTRA_libparser_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libparser_la_OBJECTS) $(libparser_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/functparser.Plo # am--include-marker +include ./$(DEPDIR)/parser.Plo # am--include-marker +include ./$(DEPDIR)/stringparser.Plo # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ $< + +.c.obj: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: + $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +# $(AM_V_CC)source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/functparser.Plo + -rm -f ./$(DEPDIR)/parser.Plo + -rm -f ./$(DEPDIR)/stringparser.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/functparser.Plo + -rm -f ./$(DEPDIR)/parser.Plo + -rm -f ./$(DEPDIR)/stringparser.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# make stringparser.c (process file stringparser.c.in) +sinclude .dep-stringparser_c +stringparser.c: stringparser_lists.ch +stringparser_lists.ch: make_stringparser.pl stringparser_lists.ch.in + $(parser_srcdir)/make_stringparser.pl \ + < $(parser_srcdir)/stringparser_lists.ch.in \ + > $(parser_srcdir)/stringparser_lists.ch + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/parser/Makefile.am b/vendor/unuran-1.11.0/src/parser/Makefile.am new file mode 100644 index 0000000..ea5d3fc --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/Makefile.am @@ -0,0 +1,47 @@ +## Process this file with automake to produce Makefile.in + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libparser.la + +libparser_la_SOURCES = \ + parser.c parser.h parser_source.h \ + stringparser.c stringparser_lists.ch \ + functparser.c \ + functparser_source.h \ + functparser_struct.h \ + functparser_symbols.h \ + functparser_stringgen.ch \ + functparser_debug.ch \ + functparser_deriv.ch \ + functparser_eval.ch \ + functparser_init.ch \ + functparser_parser.ch \ + functparser_scanner.ch + +EXTRA_DIST = \ + make_stringparser.pl \ + functparser_doc.dh \ + stringparser_doc.dh \ + stringparser_lists.ch.in + +parser_srcdir = $(top_srcdir)/src/parser + +# make stringparser.c (process file stringparser.c.in) +sinclude .dep-stringparser_c +stringparser.c: stringparser_lists.ch +stringparser_lists.ch: make_stringparser.pl stringparser_lists.ch.in + $(parser_srcdir)/make_stringparser.pl \ + < $(parser_srcdir)/stringparser_lists.ch.in \ + > $(parser_srcdir)/stringparser_lists.ch + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + stringparser_lists.ch \ + stringparser_doc.dh \ + .dep-stringparser_c \ + Makefile.in diff --git a/vendor/unuran-1.11.0/src/parser/Makefile.in b/vendor/unuran-1.11.0/src/parser/Makefile.in new file mode 100644 index 0000000..59ee8d4 --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/Makefile.in @@ -0,0 +1,658 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/parser +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libparser_la_LIBADD = +am_libparser_la_OBJECTS = parser.lo stringparser.lo functparser.lo +libparser_la_OBJECTS = $(am_libparser_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/functparser.Plo \ + ./$(DEPDIR)/parser.Plo ./$(DEPDIR)/stringparser.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libparser_la_SOURCES) +DIST_SOURCES = $(libparser_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ +UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ +UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ +UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_valgrind = @have_valgrind@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libparser.la +libparser_la_SOURCES = \ + parser.c parser.h parser_source.h \ + stringparser.c stringparser_lists.ch \ + functparser.c \ + functparser_source.h \ + functparser_struct.h \ + functparser_symbols.h \ + functparser_stringgen.ch \ + functparser_debug.ch \ + functparser_deriv.ch \ + functparser_eval.ch \ + functparser_init.ch \ + functparser_parser.ch \ + functparser_scanner.ch + +EXTRA_DIST = \ + make_stringparser.pl \ + functparser_doc.dh \ + stringparser_doc.dh \ + stringparser_lists.ch.in + +parser_srcdir = $(top_srcdir)/src/parser + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + stringparser_lists.ch \ + stringparser_doc.dh \ + .dep-stringparser_c \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/parser/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/parser/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libparser.la: $(libparser_la_OBJECTS) $(libparser_la_DEPENDENCIES) $(EXTRA_libparser_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libparser_la_OBJECTS) $(libparser_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/functparser.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stringparser.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/functparser.Plo + -rm -f ./$(DEPDIR)/parser.Plo + -rm -f ./$(DEPDIR)/stringparser.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/functparser.Plo + -rm -f ./$(DEPDIR)/parser.Plo + -rm -f ./$(DEPDIR)/stringparser.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# make stringparser.c (process file stringparser.c.in) +sinclude .dep-stringparser_c +stringparser.c: stringparser_lists.ch +stringparser_lists.ch: make_stringparser.pl stringparser_lists.ch.in + $(parser_srcdir)/make_stringparser.pl \ + < $(parser_srcdir)/stringparser_lists.ch.in \ + > $(parser_srcdir)/stringparser_lists.ch + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/parser/functparser.c b/vendor/unuran-1.11.0/src/parser/functparser.c new file mode 100644 index 0000000..fde1ffd --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/functparser.c @@ -0,0 +1,649 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: functparser.c * + * * + * Parser function string, evaluate function, print programm code. * + * * + * DESCRIPTION: * + * Given a string for a function. * + * The string is parser. * + * A tree representing the function term is generated. * + * A tree for the derivative of the function is generated. * + * The tree is used to evalute the corresponding function for an x. * + * The source code for a program is produced. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Aho, A. and Ullman, J. (1972): The Theory of Parsing, Translating * + * and Compiling. Prentice-Hall. * + * * + ***************************************************************************** + * * + * Description: * + * * + * Function parser for use with UNU.RAN. For list of symbols and functions * + * see functparser_symbols.h. * + * * + * Important: * + * Blanks are ignored, e.g. "x>-1 and x < 1" is transformed to * + * "x>-1andx<1" and thus the parser aborts at the unknwn symbol "andx". * + * Use parenthesis to solve this problem: (x>-1) and (x<1). * + * * + * The first unknown symbol is treated as the variable. * + * * + ***************************************************************************** + * * + * Pattern in Backus-Naur notation: * + * * + *---------------------------------------------------------------------------* + * * + * * + * FunctDefinition ::= DefFunctDesignator '=' Expression * + * * + * '=' * + * / \ * + * DefFunctDesignator Expression * + * * + *---------------------------------------------------------------------------* + * * + * DefFunctDesignator ::= Identifier '(' DefParameterlist ')' * + * * + * Identifier * + * / \ * + * NULL DefParameterlist * + * * + *---------------------------------------------------------------------------* + * * + * DefParameterlist ::= '(' Identifier [ ',' Identifier ] ')' * + * * + * * + * Identifier ',' * + * / \ or: / \ * + * NULL NULL more identifiers tree Identifier * + * / \ * + * NULL NULL * + * * + *---------------------------------------------------------------------------* + * * + * Expression ::= SimpleExpression [ RelationOperator SimpleExpression ] * + * * + * RelationOperator * + * SimpleExpression or: / \ * + * SimpleExpression SimpleExpression * + * * + *---------------------------------------------------------------------------* + * * + * SimpleExpression ::= STerm { AddingOperator Term } * + * * + * AddingOperator * + * STerm or: / \ * + * more terms tree Term * + * * + *---------------------------------------------------------------------------* + * * + * STerm ::= [ '+' | '-' ] Term * + * * + * '-' * + * Term or: / \ * + * '0' Term * + * / \ * + * NULL NULL * + * * + *---------------------------------------------------------------------------* + * * + * Term ::= Factor [ MultiplyingOperator Factor ] * + * * + * MultiplyingOperator * + * Factor or: / \ * + * more factors tree Factor * + * * + *---------------------------------------------------------------------------* + * * + * Factor ::= Base [ '^' Exponent ] * + * * + * '^' * + * Bas_Exp or: / \ * + * Bas_Exp Bas_Exp * + * * + *---------------------------------------------------------------------------* + * * + * Base ::= Exponent * + * * + *---------------------------------------------------------------------------* + * * + * Exponent ::= UnsignedConstant | Identifier | FunctDesignator * + * | '(' Expression ')' * + * * + * UnsignedConstant Identifier * + * / \ or / \ or * + * NULL NULL NULL NULL * + * * + * FunctDesignator or Expression * + * * + *---------------------------------------------------------------------------* + * * + * FunctDesignator ::= FuncIdentifier '(' ActualParameterlist ')' * + * * + * Identifier * + * / \ * + * NULL ActualParameterlist * + * * + *---------------------------------------------------------------------------* + * * + * ActualParameterlist ::= ActualParameter [ ',' ActualParameter ] * + * * + * ',' * + * Expression or: / \ * + * more expressions tree Expression * + * * + *---------------------------------------------------------------------------* + * * + * UnsignedConstant::= UnsignedInteger | UnsignedReal * + * UnsignedInteger ::= DigitSequence * + * UnsignedReal ::= UnsignedInteger ['.' DigitSequence] ['e' ScaleFactor]* + * DigitSequence ::= Digit [ Digit [...] ] * + * Digit ::= '0' | '1' | '2' | ... | '8' | '9' * + * ScaleFactor ::= [Sign] DigitSequence * + * Sign ::= '+' | '-' * + * Identifier ::= Letter [ Letter | Digit [...] ] * + * Letter ::= 'a' | 'b' | ... | 'z' | '_' * + * RelationOperator::= RelationChar [ RelationChar ] * + * RelationChar ::= '<' | '=' | '>' * + * * + ***************************************************************************** + * * + * Simplification rules: * + * * + *---------------------------------------------------------------------------* + * Exp Exp * + * / \ / \ * + * NULL ',' ==> X Y * + * / \ * + * X Y * + *---------------------------------------------------------------------------* + * Operator Operator * + * / \ or / \ ==> Const (compute) * + * Const Const NULL Const * + *---------------------------------------------------------------------------* + * '+' '*' * + * / \ or / \ ==> X * + * 0 X 1 X * + *---------------------------------------------------------------------------* + * '+' '-' * + * / \ or / \ or * + * X 0 X 0 * + * * + * '*' '/' * + * / \ or / \ or * + * X 1 X 1 * + * * + * '^' * + * / \ ==> X * + * X 1 * + *---------------------------------------------------------------------------* + * '*' '*' * + * / \ or / \ or * + * 0 X X 0 * + * * + * '/' '^' * + * / \ or / \ or * + * 0 X 0 X * + * * + * "and" "and" * + * / \ or / \ ==> 0 * + * 0 X X 0 * + *---------------------------------------------------------------------------* + * '^' '^' * + * / \ or / \ ==> 1 * + * X 0 1 X * + *---------------------------------------------------------------------------* + * '/' * + * ___/ \___ * + * / \ * + * X X ==> 1 * + * / \ / \ * + * NULL NULL NULL NULL * + *---------------------------------------------------------------------------* + * '+' '-' * + * / \ / \ * + * X '-' ==> X Y * + * / \ * + * 0 Y * + *---------------------------------------------------------------------------* + * '-' '+' * + * / \ / \ * + * X '-' ==> X Y * + * / \ * + * 0 Y * + *---------------------------------------------------------------------------* + * '+' '-' * + * / \ / \ * + * '-' Y ==> Y X * + * / \ * + * 0 X * + *---------------------------------------------------------------------------* + * '*' '-' * + * / \ / \ * + * X '-' ==> 0 '*' * + * / \ / \ * + * 0 Y X Y * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include "parser.h" +#include "parser_source.h" +#include "functparser_source.h" + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "FSTRING" /* (pseudo) type of generator */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Structures and definitions **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Structure for storing data while tokizing and parsing the function string */ + +struct parser_data { + char *fstr; /* pointer to function string */ + int *token; /* array to store marker for each token in string */ + char *tstr; /* working array for tokenized string */ + char **tpos; /* array to store pointers to each token in string */ + int tno; /* pointer to token in list */ + int n_tokens; /* total number of tokens */ + char *variable_name; /* name of user defined identifier */ + char *function_name; /* name of user defined function */ + int scanpos; /* pointer to location in string */ + int lastpos; /* position in string before scanning next token */ + int len_fstr; /* length of function string */ + int perrno; /* error code */ + +#ifdef UNUR_COOKIES + unsigned cookie; /* magic cookie */ +#endif +}; + +/*---------------------------------------------------------------------------*/ +/* Error codes */ + +enum { + SUCCESS = 0, /* executed succesfully, no errors detected */ + ERR_UNFINISHED, /* incomplete. not all tokens parsed */ + ERR_UNKNOWN_SYMBOL, /* unknown symbol in function string */ + ERR_EXPECT_EQUAL, /* expected symbol: '=' */ + ERR_EXPECT_OPEN_P, /* expected symbol: '(' */ + ERR_EXPECT_CLOSE_P, /* expected symbol: ')' */ + ERR_INVALID_N_PARAMS, /* invalid number of parameters for function */ + ERR_EXPECT_FUNCT, /* function (name) expected */ + ERR_EXPECT_VAR, /* user identifier (variable name) expected */ + ERR_MISSING /* more tokens expected */ +}; + + +/*****************************************************************************/ +/** List of known symbols **/ +/*****************************************************************************/ + +#define PARSER +#include "functparser_symbols.h" +#undef PARSER + +/*****************************************************************************/ +/** Prototypes **/ +/*****************************************************************************/ + +/**-------------------------------------------------------------------------**/ +/** functparser_init.c **/ +/** Init and destroy function tree. **/ +/**-------------------------------------------------------------------------**/ + +static struct ftreenode *_unur_fstr_2_tree (const char *functstr, int withDefFunct); +/*---------------------------------------------------------------------------*/ +/* Compute funtion tree from string. */ +/*---------------------------------------------------------------------------*/ + + +/**-------------------------------------------------------------------------**/ +/** functparser_scanner.c **/ +/** Scan and tokenize function string **/ +/**-------------------------------------------------------------------------**/ + +/*---------------------------------------------------------------------------*/ +/* Initialize and destroy parser */ +/*---------------------------------------------------------------------------*/ + +static struct parser_data *_unur_fstr_parser_init (const char *fstr); +/*---------------------------------------------------------------------------*/ +/* Create and initialize parser object for given function string. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_fstr_symbols_init (void); +/*---------------------------------------------------------------------------*/ +/* Prepare table of known symbols for usage. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_fstr_parser_free (struct parser_data *pdata); +/*---------------------------------------------------------------------------*/ +/* Destroy parser object. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* Scan function string */ +/*---------------------------------------------------------------------------*/ + +static int _unur_fstr_tokenize (struct parser_data *pdata); +/*---------------------------------------------------------------------------*/ +/* Tokenize function string. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_fstr_next_symbol (struct parser_data *pdata, char *symb); +/*---------------------------------------------------------------------------*/ +/* Get next symbol in function string. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_fstr_find_symbol (const char *symb, int start, int end); +/*---------------------------------------------------------------------------*/ +/* Find symbol in table between position (start+1) and (end-1). */ +/*---------------------------------------------------------------------------*/ + +static int _unur_fstr_find_user_defined (struct parser_data *pdata, char *symb, int next_char); +/*---------------------------------------------------------------------------*/ +/* Find user defined symbol. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_fstr_UnsignedConstant (struct parser_data *pdata, char *uc); +/*---------------------------------------------------------------------------*/ +/* Get Unsigned Constant. */ +/* UnsignedConstant ::= UnsignedInteger | UnsignedReal */ +/* UnsignedInteger ::= DigitSequence */ +/* UnsignedReal ::= UnsignedInteger ['.' DigitSequence] ['e' ScaleFactor] */ +/*---------------------------------------------------------------------------*/ + +static int _unur_fstr_DigitalSequence (struct parser_data *pdata, char *ds); +/*---------------------------------------------------------------------------*/ +/* Get Digital Sequence. */ +/* DigitSequence ::= Digit [ Digit [...] ] */ +/* Digit ::= '0' | '1' | '2' | ... | '8' | '9' */ +/*---------------------------------------------------------------------------*/ + +static int _unur_fstr_ScaleFactor (struct parser_data *pdata, char *sf); +/*---------------------------------------------------------------------------*/ +/* Get Scale Factor. */ +/* ScaleFactor ::= [Sign] DigitSequence */ +/* Sign ::= '+' | '-' */ +/*---------------------------------------------------------------------------*/ + +static int _unur_fstr_Identifier (struct parser_data *pdata, char *id); +/*---------------------------------------------------------------------------*/ +/* Get Identifier. */ +/* Identifier ::= Letter [ Letter | Digit [...] ] */ +/* Letter ::= 'a' | 'b' | ... | 'z' | '_' */ +/* Digit ::= '0' | '1' | ... | '9' */ +/*---------------------------------------------------------------------------*/ + +static int _unur_fstr_RelationOperator (struct parser_data *pdata, char *ro); +/*---------------------------------------------------------------------------*/ +/* Get Relation Operator. */ +/* RelationOperator ::= RelationChar [ RelationChar [...] ] */ +/* RelationChar ::= '<' | '=' | '>' */ +/*---------------------------------------------------------------------------*/ + +static void _unur_fstr_error_scan (const struct parser_data *pdata, const char *symb, int line); +/*---------------------------------------------------------------------------*/ +/* Print error message when scanning function string. */ +/*---------------------------------------------------------------------------*/ + + +/**-------------------------------------------------------------------------**/ +/** functparser_parser.c **/ +/** Parse tokenized function string and construct function tree **/ +/**-------------------------------------------------------------------------**/ + +/*---------------------------------------------------------------------------*/ +/* Parser. */ +/*---------------------------------------------------------------------------*/ + +static struct ftreenode *_unur_FunctDefinition (struct parser_data *pdata); +/*---------------------------------------------------------------------------*/ +/* Get user defined function. */ +/* FunctDefinition ::= DefFunctDesignator '=' Expression */ +/*---------------------------------------------------------------------------*/ + +static struct ftreenode *_unur_DefFunctDesignator (struct parser_data *pdata); +/*---------------------------------------------------------------------------*/ +/* Definition of user defined function. */ +/* DefFunctDesignator ::= Identifier '(' DefParameterlist ')' */ +/*---------------------------------------------------------------------------*/ + +static struct ftreenode *_unur_DefParameterlist (struct parser_data *pdata, int *n_params); +/*---------------------------------------------------------------------------*/ +/* Parameter list for user defined function. */ +/* DefParameterlist ::= '(' Identifier [ ',' Identifier ] ')' */ +/*---------------------------------------------------------------------------*/ + +static struct ftreenode *_unur_Expression (struct parser_data *pdata); +/*---------------------------------------------------------------------------*/ +/* Expression ::= SimpleExpression [ RelationOperator SimpleExpression ] */ +/*---------------------------------------------------------------------------*/ + +static struct ftreenode *_unur_SimpleExpression (struct parser_data *pdata); +/*---------------------------------------------------------------------------*/ +/* SimpleExpression ::= STerm { AddingOperator Term } */ +/*---------------------------------------------------------------------------*/ + +static struct ftreenode *_unur_STerm (struct parser_data *pdata); +/*---------------------------------------------------------------------------*/ +/* STerm ::= [ '+' | '-' ] Term */ +/*---------------------------------------------------------------------------*/ + +static struct ftreenode *_unur_Term (struct parser_data *pdata); +/*---------------------------------------------------------------------------*/ +/* Term ::= Factor [ MultiplyingOperator Factor ] */ +/*---------------------------------------------------------------------------*/ + +static struct ftreenode *_unur_Factor (struct parser_data *pdata); +/*---------------------------------------------------------------------------*/ +/* Factor ::= Base [ '^' Exponent ] */ +/*---------------------------------------------------------------------------*/ + +static struct ftreenode *_unur_Bas_Exp (struct parser_data *pdata); +/*---------------------------------------------------------------------------*/ +/* Base ::= Exponent */ +/* Exponent ::= UnsignedConstant | Identifier | FunctDesignator | */ +/* '(' Expression ')' */ +/*---------------------------------------------------------------------------*/ + +static struct ftreenode *_unur_FunctDesignator (struct parser_data *pdata); +/*---------------------------------------------------------------------------*/ +/* FunctDesignator ::= FuncIdentifier '(' ActualParameterlist ')' */ +/*---------------------------------------------------------------------------*/ + +static struct ftreenode *_unur_ActualParameterlist (struct parser_data *pdata, int n_params); +/*---------------------------------------------------------------------------*/ +/* ActualParameterlist ::= ActualParameter [ ',' ActualParameter ] */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* Simplify tree. */ +/*---------------------------------------------------------------------------*/ + +static struct ftreenode *_unur_fstr_simplification (const char *symb, int token, + struct ftreenode *left, + struct ftreenode *right); +/*---------------------------------------------------------------------------*/ +/* Try to simpify nodes. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_fstr_reorganize (struct ftreenode *node); +/*---------------------------------------------------------------------------*/ +/* Try to reorganize tree at node. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* Auxilliary routines */ +/*---------------------------------------------------------------------------*/ + +static int _unur_fstr_next_token (struct parser_data *pdata, int *token, char **symb); +/*---------------------------------------------------------------------------*/ +/* Get next token from list. */ +/*---------------------------------------------------------------------------*/ + +static struct ftreenode *_unur_fstr_create_node (const char *symb, double val, int token, + struct ftreenode *left, + struct ftreenode *right); +/*---------------------------------------------------------------------------*/ +/* Create new node. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* Error messages */ +/*---------------------------------------------------------------------------*/ + +static struct ftreenode *_unur_fstr_error_parse ( struct parser_data *pdata, int perrno, int line ); +/*---------------------------------------------------------------------------*/ +/* Print error message when parsing function string. */ +/*---------------------------------------------------------------------------*/ + +static const char *_unur_fstr_error_code ( int perrno ); +/*---------------------------------------------------------------------------*/ +/* Print message for error number. */ +/*---------------------------------------------------------------------------*/ + + +/**-------------------------------------------------------------------------**/ +/** functparser_eval.c **/ +/** Evaluate function tree for given argument x. **/ +/** **/ +/** (see also functparser_symbols.h) **/ +/**-------------------------------------------------------------------------**/ + +static double _unur_fstr_eval_node (const struct ftreenode *node, double x); +/*---------------------------------------------------------------------------*/ +/* Evaluate function tree starting from `node' at x */ +/*---------------------------------------------------------------------------*/ + + +/**-------------------------------------------------------------------------**/ +/** functparser_deriv.c **/ +/** Compute function tree for derivative. **/ +/** **/ +/** (see also functparser_symbols.h) **/ +/**-------------------------------------------------------------------------**/ + +static void _unur_fstr_error_deriv (const struct ftreenode *node, int line); +/*---------------------------------------------------------------------------*/ +/* Print error message for unknown derivative. */ +/*---------------------------------------------------------------------------*/ + + +/**-------------------------------------------------------------------------**/ +/** functparser_stringgen.c **/ +/** Make string for function given by its tree. **/ +/**-------------------------------------------------------------------------**/ + +static int _unur_fstr_node2string ( struct unur_string *output, const struct ftreenode *node, + const char *variable, const char *function, int spaces ); +/*---------------------------------------------------------------------------*/ +/* Produce string from function tree. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_fstr_print ( struct unur_string *output, const char *symb, double number ); +/*---------------------------------------------------------------------------*/ +/* Print string or number into output string. */ +/* The number is only printed if symb is the NULL pointer. */ +/*---------------------------------------------------------------------------*/ + + +/**-------------------------------------------------------------------------**/ +/** functparser_debug.c **/ +/** Debugging tools for function parser. **/ +/**-------------------------------------------------------------------------**/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_fstr_debug_input ( const char *fstr ); +/*---------------------------------------------------------------------------*/ +/* Print function string on output stream. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_fstr_debug_token ( const struct parser_data *pdata ); +/*---------------------------------------------------------------------------*/ +/* Print tokenized string on output stream. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_fstr_debug_tree ( const struct parser_data *pdata, + const struct ftreenode *root ); +/*---------------------------------------------------------------------------*/ +/* Print function tree. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_fstr_debug_show_tree (const struct parser_data *pdata, + const struct ftreenode *node, + int level, int location); +/*---------------------------------------------------------------------------*/ +/* Print function tree by recursion. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_fstr_debug_deriv (const struct ftreenode *funct, + const struct ftreenode *deriv); +/*---------------------------------------------------------------------------*/ +/* Print function and its derivative. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +#endif +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Include sources **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#include "functparser_init.ch" +#include "functparser_scanner.ch" +#include "functparser_parser.ch" +#include "functparser_eval.ch" +#include "functparser_deriv.ch" +#include "functparser_stringgen.ch" +#include "functparser_debug.ch" +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** End **/ +/*****************************************************************************/ diff --git a/vendor/unuran-1.11.0/src/parser/functparser_debug.ch b/vendor/unuran-1.11.0/src/parser/functparser_debug.ch new file mode 100644 index 0000000..a9cac22 --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/functparser_debug.ch @@ -0,0 +1,224 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: functparser_debug.c * + * * + * Debugging tools for function parser. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_fstr_debug_input ( const char *fstr ) + /*----------------------------------------------------------------------*/ + /* Print function string on output stream */ + /* */ + /* parameters: */ + /* fstr ... string containing function definition */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG = unur_get_stream(); + + fprintf(LOG,"%s: Input string:\n",GENTYPE); + fprintf(LOG,"%s: %s\n",GENTYPE,fstr); + fprintf(LOG,"%s:\n",GENTYPE); + +} /* end of _unur_fstr_debug_input() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_fstr_debug_token ( const struct parser_data *pdata ) + /*----------------------------------------------------------------------*/ + /* Print tokenized string on output stream */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG = unur_get_stream(); + int i; + + /* check arguments */ + CHECK_NULL(pdata,RETURN_VOID); COOKIE_CHECK(pdata,CK_FSTR_PDATA,RETURN_VOID); + + fprintf(LOG,"%s: Tokenized string (token separated by blanks):\n",GENTYPE); + fprintf(LOG,"%s: ",GENTYPE); + + for (i=0; in_tokens; i++) + fprintf(LOG,"%s ",pdata->tpos[i]); + fprintf(LOG,"\n%s:\n",GENTYPE); + +} /* end of _unur_fstr_debug_input() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_fstr_debug_tree( const struct parser_data *pdata, + const struct ftreenode *root ) + /*----------------------------------------------------------------------*/ + /* Print function tree */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* root ... pointer to root of tree */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG = unur_get_stream(); + + /* check arguments */ + CHECK_NULL(pdata,RETURN_VOID); COOKIE_CHECK(pdata,CK_FSTR_PDATA,RETURN_VOID); + CHECK_NULL(root,RETURN_VOID); COOKIE_CHECK(root,CK_FSTR_TNODE,RETURN_VOID); + + fprintf(LOG,"%s: parse tree: (left nodes above right nodes)\n",GENTYPE); + fprintf(LOG,"%s:\n",GENTYPE); + _unur_fstr_debug_show_tree(pdata,root,0,0); + fprintf(LOG,"%s:\n",GENTYPE); + +} /* end of _unur_fstr_debug_tree() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_fstr_debug_show_tree(const struct parser_data *pdata, + const struct ftreenode *node, + int level, int location) + /*----------------------------------------------------------------------*/ + /* Print function tree by recursion */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* node ... pointer to node in tree */ + /* level ... depth in tree */ + /* location ... indicates location of node in tree by bit array */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG = unur_get_stream(); + const char *name; + int i, mask; + + /* check arguments */ + CHECK_NULL(pdata,RETURN_VOID); COOKIE_CHECK(pdata,CK_FSTR_PDATA,RETURN_VOID); + + fprintf(LOG,"%s: ",GENTYPE); + + /* draw vertical lines in tree */ + for (i = 0, mask = 1; i < level; i++, mask <<= 1) + if (mask & location) + fprintf(LOG,"| "); + else + fprintf(LOG," "); + + /* print node */ + if( node != NULL ) { + COOKIE_CHECK(node,CK_FSTR_TNODE,RETURN_VOID); + + /* draw horizontal line in tree */ + (mask & location) ? fprintf(LOG,"+--") : fprintf(LOG,"\\__"); + + /* print symbol */ + switch (node->type) { + case S_SCONST: + fprintf(LOG,"'%s'\t(const=%g)", node->symbol,node->val); break; + case S_UCONST: + fprintf(LOG,"'%g'\t(const)", node->val); break; + case S_UIDENT: + name = (pdata) ? pdata->variable_name : "x"; + fprintf(LOG,"'%s'\t(variable)", name); break; + case S_UFUNCT: + name = (pdata) ? pdata->function_name : "f"; + fprintf(LOG,"'%s'\t(user function)", name); break; + default: + fprintf(LOG,"'%s'", node->symbol); + } + /* end of line */ + fprintf(LOG,"\n"); + + /* print left and right node */ + if ( node->left || node->right) { + /* ... unless both leaves are empty */ + _unur_fstr_debug_show_tree(pdata,node->left, level+1,location|(mask<<1)); + _unur_fstr_debug_show_tree(pdata,node->right,level+1,location); + } + } + + else { /* empty leave */ + (mask & location) ? fprintf(LOG,"+--") : fprintf(LOG,"\\__"); + fprintf(LOG,"(void)\n"); + } +} /* end of _unur_fstr_debug_show_tree() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_fstr_debug_deriv (const struct ftreenode *funct, const struct ftreenode *deriv) + /*----------------------------------------------------------------------*/ + /* Print function and its derivative */ + /* */ + /* parameters: */ + /* funct ... pointer to function tree */ + /* deriv ... pointer to derivative */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG = unur_get_stream(); + char *str; + + /* check arguments */ + CHECK_NULL(funct,RETURN_VOID); COOKIE_CHECK(funct,CK_FSTR_TNODE,RETURN_VOID); + CHECK_NULL(deriv,RETURN_VOID); COOKIE_CHECK(deriv,CK_FSTR_TNODE,RETURN_VOID); + + fprintf(LOG,"%s: Derivative df/dx of \n",GENTYPE); + str = _unur_fstr_tree2string(funct,"x","f",TRUE); + fprintf(LOG,"%s: f(x) = %s\n",GENTYPE,str); + free (str); + + if (deriv) { + str = _unur_fstr_tree2string(deriv,"x","df",TRUE); + fprintf(LOG,"%s: f'(x) = %s\n",GENTYPE,str); + free (str); + } + else { + fprintf(LOG,"%s: f'(x) = (unknown)\n",GENTYPE); + } + + /* _unur_fstr_debug_tree(NULL,deriv); */ + + fprintf(LOG,"%s:\n",GENTYPE); + +} /* end of _unur_fstr_debug_deriv() */ + +/*---------------------------------------------------------------------------*/ +#endif /* end UNUR_ENABLE_LOGGING */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/parser/functparser_deriv.ch b/vendor/unuran-1.11.0/src/parser/functparser_deriv.ch new file mode 100644 index 0000000..dc0c2b0 --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/functparser_deriv.ch @@ -0,0 +1,689 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: functparser_deriv.c * + * * + * Compute function tree for derivative. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** API **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +_unur_fstr_make_derivative ( const struct ftreenode *root ) + /*----------------------------------------------------------------------*/ + /* Make function tree for derivate of given function (tree). */ + /* */ + /* parameters: */ + /* root ... pointer to root of function tree */ + /* */ + /* return: */ + /* pointer to tree of derivative */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct ftreenode *deriv = NULL; /* pointer to function tree of derivative */ + int error = 0; /* error code */ + + /* check arguments */ + _unur_check_NULL( GENTYPE,root,NULL ); + COOKIE_CHECK(root,CK_FSTR_TNODE,NULL); + + deriv = (*symbol[root->token].dcalc)(root,&error); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag) + _unur_fstr_debug_deriv(root,deriv); +#endif + + if (error == TRUE) { + /* set unuran error code */ + unur_errno = UNUR_ERR_FSTR_DERIV; + if (deriv) _unur_fstr_free(deriv); + return NULL; + } + + return deriv; +} /* end of _unur_fstr_make_derivative() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Routines for computing derivatives **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +d_error (const struct ftreenode *node, int *error) +{ + /* check arguments */ + CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); + + _unur_fstr_error_deriv(node,__LINE__); + *error = TRUE; + return NULL; +} /* end of d_error() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +d_const (const struct ftreenode *node ATTRIBUTE__UNUSED, int *error ATTRIBUTE__UNUSED) + /* (const)' = 0 */ + /* */ + /* Const 0. */ + /* / \ ==> / \ */ + /* NULL NULL NULL NULL */ +{ + /* check arguments */ + CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); + + return _unur_fstr_create_node(NULL,0.,s_uconst,NULL,NULL); +} /* end of d_const() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +d_var (const struct ftreenode *node ATTRIBUTE__UNUSED, int *error ATTRIBUTE__UNUSED) + /* x' = 1 */ + /* */ + /* Var 1. */ + /* / \ ==> / \ */ + /* NULL NULL NULL NULL */ +{ + /* check arguments */ + CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); + + return _unur_fstr_create_node(NULL,1.,s_uconst,NULL,NULL); +} /* end of d_var() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +d_add (const struct ftreenode *node, int *error) + /* summation rule: (l+r)' = l' + r' */ + /* */ + /* Op Op */ + /* / \ ==> / \ (Op ::= '+' | '-') */ + /* X Y X' Y' */ +{ + struct ftreenode *left, *right; + struct ftreenode *d_left, *d_right; + int op; + + /* check arguments */ + CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); + + /* left and right node */ + left = node->left; + right = node->right; + + /* token for operator */ + op = node->token; + + /* derivative of both branches */ + d_left = (left) ? (*symbol[left->token].dcalc) (left,error) : NULL; + d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; + + /* make subtree */ + return _unur_fstr_create_node(node->symbol,0.,op,d_left,d_right); +} /* end of d_add() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +d_mul (const struct ftreenode *node, int *error) + /* product rule: (l*r)' = l'*r + l*r' */ + /* */ + /* '*' __'+'__ */ + /* / \ / \ */ + /* X Y ==> '*' '*' */ + /* / \ / \ */ + /* X' Y X Y' */ +{ + struct ftreenode *left, *right; + struct ftreenode *d_left, *d_right; + struct ftreenode *br_left, *br_right; + + /* check arguments */ + CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); + + /* make a copy of the branches of node */ + left = _unur_fstr_dup_tree(node->left); + right = _unur_fstr_dup_tree(node->right); + + /* derivative of both branches */ + d_left = (left) ? (*symbol[left->token].dcalc) (left,error) : NULL; + d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; + + /* make subtree */ + br_left = _unur_fstr_create_node("*",0.,s_mul,d_left,right); + br_right = _unur_fstr_create_node("*",0.,s_mul,left,d_right); + + /* return subtree */ + return _unur_fstr_create_node("+",0.,s_plus,br_left,br_right); +} /* end of d_mul() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +d_div (const struct ftreenode *node, int *error) + /* Quotient rule: (l/r)' = (l'*r-l*r')/r^2 */ + /* */ + /* '/' ___'/'___ */ + /* / \ / \ */ + /* X Y ==> '-' '^' */ + /* / \ / \ */ + /* '*' '*' Y 2 */ + /* / \ / \ */ + /* X' Y X Y' */ + /* */ +{ + struct ftreenode *left, *right; + struct ftreenode *d_left, *d_right; + struct ftreenode *br_left, *br_right, *two; + struct ftreenode *numerator, *denominator; + + /* check arguments */ + CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); + + /* make a copy of the branches of node */ + left = _unur_fstr_dup_tree(node->left); + right = _unur_fstr_dup_tree(node->right); + + /* derivative of both branches */ + d_left = (left) ? (*symbol[left->token].dcalc) (left,error) : NULL; + d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; + + /* make nominator */ + two = _unur_fstr_create_node(NULL,2.,s_uconst,NULL,NULL); /* const 2 */ + denominator = _unur_fstr_create_node("^",0.,s_power,right,two); + + /* make numerator */ + right = _unur_fstr_dup_tree(node->right); /* we need another copy */ + br_left = _unur_fstr_create_node("*",0.,s_mul,d_left,right); + br_right = _unur_fstr_create_node("*",0.,s_mul,left,d_right); + numerator= _unur_fstr_create_node("-",0.,s_minus,br_left,br_right); + + /* subtree */ + return _unur_fstr_create_node("/",0.,s_div,numerator,denominator); +} /* end of d_div() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +d_power (const struct ftreenode *node, int *error) + /* case: r constant */ + /* (l^r)' = r * l^(r-1) * l' */ + /* */ + /* '^' '*' */ + /* / \ ==> / \ */ + /* X Y X' '*' */ + /* / \ / \ */ + /* NULL NULL Y '^' */ + /* / \ */ + /* X (Y-1) */ + /* */ + /* case: l constant */ + /* (l^r)' = r' * l^r * log(l) */ + /* */ + /* '^' '*' */ + /* / \ ==> / \ */ + /* X Y Y' _'*'_ */ + /* / \ / \ */ + /* NULL NULL "log" '^' */ + /* / \ / \ */ + /* NULL X X Y */ + /* */ + /* otherwise: */ + /* (l^r)' = l^(r-1) * ( r * l' + l * log(l) * r' ) */ + /* */ + /* '^' ______'*'_____ */ + /* / \ ==> / \ */ + /* X Y '^' __'+'__ */ + /* / \ / \ */ + /* X '-' '*' '*' */ + /* / \ / \ / \ */ + /* Y 1 Y X' X '*' */ + /* / \ */ + /* Y' "log" */ + /* / \ */ + /* NULL X */ + /* */ +{ + struct ftreenode *left, *right; + struct ftreenode *d_left, *d_right; + struct ftreenode *br_right; + struct ftreenode *dup_node, *tmp1, *tmp2; + + /* check arguments */ + CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); + + /* left and right node */ + left = node->left; + right = node->right; + + if (right && (right->type == S_UCONST || right->type == S_SCONST) ) { + /* '^' '*' */ + /* / \ ==> / \ */ + /* X Y X' '*' */ + /* / \ / \ */ + /* NULL NULL Y '^' */ + /* / \ */ + /* X (Y-1) */ + /* derivative of left branch */ + d_left = (left) ? (*symbol[left->token].dcalc) (left,error) : NULL; + /* make a copy of the branches of node */ + left = _unur_fstr_dup_tree(node->left); + right = _unur_fstr_dup_tree(node->right); + /* make right branch */ + tmp1 = _unur_fstr_create_node(NULL,right->val-1,s_uconst,NULL,NULL); + tmp2 = _unur_fstr_create_node("^",0.,s_power,left,tmp1); + br_right = _unur_fstr_create_node("*",0.,s_mul,right,tmp2); + /* subtree */ + return _unur_fstr_create_node("*",0.,s_mul,d_left,br_right); + } + + else if (left && (left->type == S_UCONST || left->type == S_SCONST) ) { + /* '^' '*' */ + /* / \ ==> / \ */ + /* X Y Y' _'*'_ */ + /* / \ / \ */ + /* NULL NULL "log" '^' */ + /* / \ / \ */ + /* NULL X X Y */ + /* */ + /* find symbol "log" */ + int s_log = _unur_fstr_find_symbol("log",_ans_start,_ans_end); + + /* derivative of right branch */ + d_right = (right) ? (*symbol[right->token].dcalc) (right,error) : NULL; + /* make copies of branches */ + left = _unur_fstr_dup_tree(node->left); + dup_node = _unur_fstr_dup_tree(node); + /* make right branch */ + tmp1 = _unur_fstr_create_node("log",0.,s_log,NULL,left); + br_right = _unur_fstr_create_node("*",0.,s_mul,tmp1,dup_node); + /* subtree */ + return _unur_fstr_create_node("*",0.,s_mul,d_right,br_right); + } + + else { + /* '^' ______'*'_____ */ + /* / \ ==> / \ */ + /* X Y '^' __'+'__ */ + /* / \ / \ */ + /* X '-' '*' '*' */ + /* / \ / \ / \ */ + /* Y 1 Y X' X '*' */ + /* / \ */ + /* Y' "log" */ + /* / \ */ + /* NULL X */ + /* */ + /** TODO **/ + _unur_fstr_error_deriv(node,__LINE__); + *error = TRUE; + return NULL; + } +} /* end of d_power() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +d_exp (const struct ftreenode *node, int *error) + /* (exp(r))' = r' * exp(r) */ + /* */ + /* "exp" '*' */ + /* / \ ==> / \ */ + /* NULL X X' "exp" */ + /* / \ */ + /* NULL X */ +{ + struct ftreenode *right; + struct ftreenode *d_right; + struct ftreenode *br_right; + + /* check arguments */ + CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); + + /* right node */ + right = node->right; + + /* derivative of right branch */ + d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; + + /* make a copy of whole subrtree at node */ + br_right = _unur_fstr_dup_tree(node); + + /* subtree */ + return _unur_fstr_create_node("*",0.,s_mul,d_right,br_right); +} /* ebd of d_exp() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +d_log (const struct ftreenode *node, int *error) + /* (log(r))' = r'/r */ + /* */ + /* "log" '/' */ + /* / \ ==> / \ */ + /* NULL X X' X */ +{ + struct ftreenode *right; + struct ftreenode *d_right; + + /* check arguments */ + CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); + + /* make a copy of the right branch of node */ + right = _unur_fstr_dup_tree(node->right); + + /* derivative of right branch */ + d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; + + /* subtree */ + return _unur_fstr_create_node("/",0.,s_div,d_right,right); +} /* end of d_log() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +d_sin (const struct ftreenode *node, int *error) + /* (sin(r))' = r' * cos(r) */ + /* */ + /* "sin" '*' */ + /* / \ ==> / \ */ + /* NULL X X' "cos" */ + /* / \ */ + /* NULL X */ +{ + struct ftreenode *right; + struct ftreenode *d_right; + struct ftreenode *br_right; + + /* find symbol "cos" */ + int s_cos = _unur_fstr_find_symbol("cos",_ans_start,_ans_end); + + /* check arguments */ + CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); + + /* make a copy of the right branch of node */ + right = _unur_fstr_dup_tree(node->right); + + /* derivative of right branch */ + d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; + + /* right branch of new tree */ + br_right = _unur_fstr_create_node("cos",0.,s_cos,NULL,right); + + /* subtree */ + return _unur_fstr_create_node(NULL,0.,s_mul,d_right,br_right); +} /* end of d_sin() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +d_cos (const struct ftreenode *node, int *error) + /* (cos(r))' = -r' * sin(r) */ + /* */ + /* "cos" ____'*'____ */ + /* / \ ==> / \ */ + /* NULL X '-' "sin" */ + /* / \ / \ */ + /* 0 X' NULL X */ +{ + struct ftreenode *right; + struct ftreenode *d_right; + struct ftreenode *br_left, *br_right; + struct ftreenode *zero; + + /* find symbol "sin" */ + int s_sin = _unur_fstr_find_symbol("sin",_ans_start,_ans_end); + + /* check arguments */ + CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); + + /* make a copy of the right branch of node */ + right = _unur_fstr_dup_tree(node->right); + + /* derivative of right branch */ + d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; + + /* branches of new tree */ + br_right = _unur_fstr_create_node("sin",0.,s_sin,NULL,right); + + zero = _unur_fstr_create_node(NULL,0.,s_uconst,NULL,NULL); + br_left = _unur_fstr_create_node("-",0.,s_minus,zero,d_right); + + /* subtree */ + return _unur_fstr_create_node("*",0.,s_mul,br_left,br_right); +} /* end of d_cos() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +d_tan (const struct ftreenode *node, int *error) + /* (tan(r))' = r' * (sec(r))^2 */ + /* */ + /* "tan" '*' */ + /* / \ ==> / \ */ + /* NULL X X' '^' */ + /* / \ */ + /* "sec" 2. */ + /* / \ */ + /* NULL X */ +{ + struct ftreenode *right; + struct ftreenode *d_right; + struct ftreenode *br_right, *sub_right; + struct ftreenode *two; + + /* find symbol "sec" */ + int s_sec = _unur_fstr_find_symbol("sec",_ans_start,_ans_end); + + /* check arguments */ + CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); + + /* make a copy of the right branch of node */ + right = _unur_fstr_dup_tree(node->right); + + /* derivative of right branch */ + d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; + + /* right branch of new tree */ + two = _unur_fstr_create_node(NULL,2.,s_uconst,NULL,NULL); /* const 2 */ + sub_right = _unur_fstr_create_node("sec",0.,s_sec,NULL,right); + br_right = _unur_fstr_create_node("^",0.,s_power,sub_right,two); + + /* subtree */ + return _unur_fstr_create_node("*",0.,s_mul,d_right,br_right); +} /* end of d_tan() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +d_sec (const struct ftreenode *node, int *error) + /* (sec(r))' = r' * tan(r) * sec(r) */ + /* */ + /* "sec" '*' */ + /* / \ ==> / \ */ + /* NULL X X' '*' */ + /* / \ */ + /* "tan" "sec" */ + /* / \ / \ */ + /* NULL X NULL X */ +{ + struct ftreenode *right; + struct ftreenode *d_right; + struct ftreenode *br_right, *sub_right, *dup_node; + + /* find symbols "tan" */ + int s_tan = _unur_fstr_find_symbol("tan",_ans_start,_ans_end); + + /* check arguments */ + CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); + + /* make a copy of the right branch of node */ + right = _unur_fstr_dup_tree(node->right); + + /* derivative of right branch */ + d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; + + /* make a copy of the whole subtree at node */ + dup_node = _unur_fstr_dup_tree(node); + + /* right branch of new tree */ + sub_right = _unur_fstr_create_node("tan",0.,s_tan,NULL,right); + br_right = _unur_fstr_create_node("*",0.,s_mul,sub_right,dup_node); + + /* subtree */ + return _unur_fstr_create_node("*",0.,s_mul,d_right,br_right); +} /* end of d_sec() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +d_sqrt (const struct ftreenode *node, int *error) + /* (sqrt(r))' = r'/(2*sqrt(r)) */ + /* */ + /* "sqrt" '/' */ + /* / \ ==> / \ */ + /* NULL X X' '*' */ + /* / \ */ + /* 2. "sqrt" */ + /* / \ */ + /* NULL X */ +{ + struct ftreenode *right; + struct ftreenode *d_right; + struct ftreenode *br_right; + struct ftreenode *two, *dup_tree; + + /* check arguments */ + CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); + + /* right node */ + right = node->right; + + /* derivative of right branch */ + d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; + + /* make a copy of the whole subtree at node */ + dup_tree = _unur_fstr_dup_tree(node); + + /* right branch of new tree */ + two = _unur_fstr_create_node(NULL,2.,s_uconst,NULL,NULL); /* const 2 */ + br_right = _unur_fstr_create_node("*",0.,s_mul,two,dup_tree); + + /* subtree */ + return _unur_fstr_create_node("/",0.,s_div,d_right,br_right); +} /* end of d_sqrt() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +d_abs (const struct ftreenode *node, int *error) + /* (abs(r))' = r' * sgn(x) */ + /* */ + /* "abs" '*' */ + /* / \ ==> / \ */ + /* NULL X X' "sgn" */ + /* / \ */ + /* NULL X */ +{ + struct ftreenode *right; + struct ftreenode *d_right; + struct ftreenode *br_right; + + /* find symbol "sgn" */ + int s_sgn = _unur_fstr_find_symbol("sgn",_ans_start,_ans_end); + + /* check arguments */ + CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); + + /* make a copy of the right branch of node */ + right = _unur_fstr_dup_tree(node->right); + + /* derivative of right branch */ + d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; + + /* right branch of new tree */ + br_right = _unur_fstr_create_node("sgn",0.,s_sgn,NULL,right); + + /* subtree */ + return _unur_fstr_create_node("*",0.,s_mul,d_right,br_right); +} /* end of d_abs() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Error messages **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +void +_unur_fstr_error_deriv (const struct ftreenode *node, int line) + /*----------------------------------------------------------------------*/ + /* Print error message for unknown derivative */ + /* */ + /* parameters: */ + /* node ... pointer to node of function tree */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *reason; + + /* check arguments */ + CHECK_NULL(node,RETURN_VOID); COOKIE_CHECK(node,CK_FSTR_TNODE,RETURN_VOID); + + /* create string for reason of error */ + reason = _unur_string_new(); + _unur_string_append( reason, "cannot derivate subtree at '%s'", node->symbol); + + /* report error */ + _unur_error_x( GENTYPE, __FILE__, line, "error", UNUR_ERR_FSTR_DERIV,reason->text); + + /* free working space */ + _unur_string_free( reason ); + +#ifdef UNUR_ENABLE_LOGGING + _unur_fstr_debug_tree(NULL,node); + _unur_log_debug ("%s:\n",GENTYPE); +#endif + +} /* end of _unur_fstr_error_deriv() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/parser/functparser_doc.dh b/vendor/unuran-1.11.0/src/parser/functparser_doc.dh new file mode 100644 index 0000000..93d8f13 --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/functparser_doc.dh @@ -0,0 +1,180 @@ + +/*---------------------------------------------------------------------------*/ +/* + +=NODEX StringFunct Function String +=UP StringAPI [25] + +=DESCRIPTION + +In unuran it is also possible to define functions (e.g. CDF or PDF) as +strings. As you can see in Example 2 (@ref{Example_2_str}) it is very +easy to define the PDF of a distribution object by means of a string. +The possibilities using this string interface are more restricted than +using a pointer to a routine coded in C (@ref{Example_2}). +But the differences in evaluation time is small. +When a distribution object is defined using this string interface then +of course the same conditions on the given density or CDF must be +satisfied for a chosen method as for the standard API. +This string interface can be used for both within the UNU.RAN string +API using the unur_str2gen() call, and for calls that define the +density or CDF for a particular distribution object as done with +(e.g.) the call unur_distr_cont_set_pdfstr(). +Here is an example for the latter case: + +@example + unur_distr_cont_set_pdfstr(distr,"1-x*x"); +@end example + + +@subheading Syntax + +The syntax for the function string is case insensitive, white spaces +are ingnored. The expressions are similar to most programming languages +and mathematical programs (see also the examples below). It is especially +influenced by C. The usual preceedence rules are used (from highest +to lowest preceedence: functions, power, multiplication, +addition, relation operators). Use parentheses in case of doubt or +when these preceedences should be changed. + +Relation operators can be used as indicator functions, i.e. the term +@code{(x>1)} is evaluted as @code{1} if this relation is satisfied, +and as @code{0} otherwise. + +The first unknown symbol (letter or word) is interpreted as the +variable of the function. It is recommended to use @code{x}. +Only one variable can be used. + +@noindent +@emph{Important}: The symbol @code{e} is used twice, for Euler's +constant (= 2.7182@dots{}) and as exponent. +The multiplication operator @code{*} must not be omitted, i.e. +@code{2 x} is interpreted as the string @code{2x} (which will result +in a syntax error). + + +@subheading List of symbols + +@cartouche +@noindent +@b{Numbers} + +@noindent +Numbers are composed using digits and, optionally, a sign, +a decimal point, and an exponent indicated by @code{e}. + +@multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} +@item Symbol @tab Explanation @tab Examples +@item @code{0@dots{}9} @tab @i{digits} @tab @code{2343} +@item @code{.} @tab @i{decimal point} @tab @code{165.567} +@item @code{-} @tab @i{negative sign} @tab @code{-465.223} +@item @code{e} @tab @i{exponet} @tab @code{13.2e-4} (=0.00132) +@end multitable +@end cartouche + +@cartouche +@noindent +@b{Constants} + +@multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} +@item @code{pi} @tab @i{pi = 3.1415@dots{}} @tab @code{3*pi+2} +@item @code{e} @tab @i{Euler's constant} @tab @code{3*e+2} (= 10.15@dots{}; + do not cofuse with @code{3e2} = 300) +@item @code{inf} @tab @i{infinity} @tab (used for domains) +@end multitable +@end cartouche + +@cartouche +@noindent +@b{Special symbols} + +@multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} +@item @code{(} @tab @i{opening parenthesis} @tab @code{2*(3+x)} +@item @code{)} @tab @i{closing parenthesis} @tab @code{2*(3+x)} +@item @code{,} @tab @i{(argument) list separator} @tab @code{mod(13,2)} +@end multitable +@end cartouche + +@cartouche +@noindent +@b{Relation operators (Indicator functions)} + +@multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} +@item @code{<} @tab @i{less than} @tab @code{(x<1)} +@item @code{=} @tab @i{equal} @tab @code{(2=x)} +@item @code{==} @tab @i{same as} @code{=} @tab @code{(x==3)} +@item @code{>} @tab @i{greater than} @tab @code{(x>0)} +@item @code{<=} @tab @i{less than or equal} @tab @code{(x<=1)} +@item @code{!=} @tab @i{not equal} @tab @code{(x!0)} +@item @code{<>} @tab @i{same as} @code{!=} @tab @code{(x<>pi)} +@item @code{>=} @tab @i{greater or equal} @tab @code{(x>=1)} +@end multitable +@end cartouche + +@cartouche +@noindent +@b{Arithmetic operators} + +@multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} +@item @code{+} @tab @i{addition} @tab @code{2+x} +@item @code{-} @tab @i{subtraction} @tab @code{2-x} +@item @code{*} @tab @i{multiplication} @tab @code{2*x} +@item @code{/} @tab @i{division} @tab @code{x/2} +@item @code{^} @tab @i{power} @tab @code{x^2} +@end multitable +@end cartouche + +@cartouche +@noindent +@b{Functions} + +@multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} +@item @code{mod} @tab @code{mod(m,n)} @i{remainder of devision m over n} @tab mod(x,2) +@item @code{exp} @tab @i{exponential function + (same as @code{e^x})} @tab @code{exp(-x^2)} (same as @code{e^(-x^2)}) +@item @code{log} @tab @i{natural logarithm} @tab @code{log(x)} +@item @code{sin} @tab @i{sine} @tab @code{sin(x)} +@item @code{cos} @tab @i{cosine} @tab @code{cos(x)} +@item @code{tan} @tab @i{tangent} @tab @code{tan(x)} +@item @code{sec} @tab @i{secant} @tab @code{sec(x*2)} +@item @code{sqrt} @tab @i{square root} @tab @code{sqrt(2*x)} +@item @code{abs} @tab @i{absolute value} @tab @code{abs(x)} +@item @code{sgn} @tab @i{sign function} @tab @code{sign(x)*3} +@end multitable +@end cartouche + +@cartouche +@noindent +@b{Variable} + +@multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} +@item @code{x} @tab @i{variable} @tab @code{3*x^2} +@end multitable +@end cartouche + + +@subheading Examples + +@example + 1.231+7.9876*x-1.234e-3*x^2+3.335e-5*x^3 + sin(2*pi*x)+x^2 + exp(-((x-3)/2.1)^2) +@end example + +@noindent +It is also possible to define functions using different terms +on separate domains. However, instead of constructs using +@code{if @dots{} then @dots{} else @dots{}} +indicator functions are available. + +@noindent +For example to define the density of triangular distribution +with domain (-1,1) and mode 0 use + +@example + (x>-1)*(x<0)*(1+x) + (x>=0)*(x<1)*(1-x) +@end example + +=EON +*/ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/parser/functparser_eval.ch b/vendor/unuran-1.11.0/src/parser/functparser_eval.ch new file mode 100644 index 0000000..1440002 --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/functparser_eval.ch @@ -0,0 +1,155 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: functparser_eval.c * + * * + * Evaluate function tree for given argument x. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** API **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +double +_unur_fstr_eval_tree (const struct ftreenode *root, double x) + /*----------------------------------------------------------------------*/ + /* Evaluate function tree at x */ + /* */ + /* parameters: */ + /* root ... pointer to root of function tree */ + /* x ... argument for which function should be evaluated */ + /* */ + /* return: */ + /* result of computation */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(root,UNUR_INFINITY); + COOKIE_CHECK(root,CK_FSTR_TNODE,UNUR_INFINITY); + return _unur_fstr_eval_node( root, x ); +} /* end of _unur_fstr_eval_tree() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Routines for evaluating nodes of the function tree **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#define CHECK_INF(x) if(_unur_FP_is_infinity((x))) return UNUR_INFINITY; +#define CHECK_INFS(l,r) do { CHECK_INF((l)); CHECK_INF((r)); } while(0) + +#define NODE_ARGS double l ATTRIBUTE__UNUSED, double r ATTRIBUTE__UNUSED +/*---------------------------------------------------------------------------*/ + +double v_dummy (NODE_ARGS) { return 0.; } +double v_const (NODE_ARGS) { return 0.; } /* nothing to do, value in node */ + +double v_less (NODE_ARGS) { return (double)(l < r); } +double v_equal (NODE_ARGS) { return (double)(_unur_FP_same(l,r)); } +double v_greater(NODE_ARGS) { return (double)(l > r); } +double v_less_or(NODE_ARGS) { return (double)(l <= r); } +double v_unequal(NODE_ARGS) { return (double)(!_unur_FP_same(l,r)); } +double v_grtr_or(NODE_ARGS) { return (double)(l >= r); } + +double v_plus (NODE_ARGS) { return (l + r); } +double v_minus (NODE_ARGS) { return (l - r); } +double v_mul (NODE_ARGS) { return (l * r); } +double v_div (NODE_ARGS) { return (l / r); } +double v_power (NODE_ARGS) { return pow(l,r); } + +double v_mod (NODE_ARGS) { return (double)((int)l % (int)r); } +double v_exp (NODE_ARGS) { return exp(r); } +double v_log (NODE_ARGS) { return (r<=0.) ? UNUR_INFINITY : log(r); } +double v_sin (NODE_ARGS) { CHECK_INF(r); return sin(r); } +double v_cos (NODE_ARGS) { CHECK_INF(r); return cos(r); } +double v_tan (NODE_ARGS) { CHECK_INF(r); return tan(r); } +double v_sec (NODE_ARGS) { double cosr; CHECK_INF(r); cosr=cos(r); + return _unur_iszero(cosr) ? UNUR_INFINITY : 1./cosr; } +double v_sqrt (NODE_ARGS) { return (r<0.) ? UNUR_INFINITY : sqrt(r); } +double v_abs (NODE_ARGS) { return fabs(r); } +double v_sgn (NODE_ARGS) { return ((r<0.) ? -1. : ((r>0.) ? 1. : 0.)); } + +/*---------------------------------------------------------------------------*/ +#undef CHECK_INF +#undef CHECK_INFS +#undef NODE_ARGS +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Evaluate function **/ +/*****************************************************************************/ + +double +_unur_fstr_eval_node (const struct ftreenode *node, double x) + /*----------------------------------------------------------------------*/ + /* Evaluate function tree starting from `node' at x */ + /* */ + /* parameters: */ + /* root ... pointer to node in function tree */ + /* x ... argument for which function should be evaluated */ + /* */ + /* return: */ + /* result of computation */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + double val_l, val_r; + + /* check arguments */ + CHECK_NULL(node,UNUR_INFINITY); + COOKIE_CHECK(node,CK_FSTR_TNODE,UNUR_INFINITY); + + switch (node->type) { + case S_UCONST: + case S_SCONST: + /* node contains constant */ + return node->val; + + case S_UIDENT: + /* variable */ + return x; + + default: + /* use evaluation function */ + /* compute values at leaves */ + val_l = (node->left) ? _unur_fstr_eval_node(node->left, x) : 0. ; + val_r = (node->right) ? _unur_fstr_eval_node(node->right,x) : 0. ; + return (*symbol[node->token].vcalc)(val_l,val_r); + } +} /* end of _unur_fstr_eval_node() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/parser/functparser_init.ch b/vendor/unuran-1.11.0/src/parser/functparser_init.ch new file mode 100644 index 0000000..3b6e9d2 --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/functparser_init.ch @@ -0,0 +1,223 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: functparser_init.c * + * * + * Init and destroy function tree. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** API **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +_unur_fstr2tree (const char *functstr) + /*----------------------------------------------------------------------*/ + /* Compute funtion tree from string. */ + /* */ + /* parameters: */ + /* functstr ... string containing function definition */ + /* */ + /* return: */ + /* pointer to root of function tree */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + return _unur_fstr_2_tree( functstr, FALSE ); +} /* end of _unur_fstr2tree() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +_unur_fstr2tree_DefFunct (const char *functstr) + /*----------------------------------------------------------------------*/ + /* Compute funtion tree from string. */ + /* (Same as _unur_fstr2tree() but string must start with "f(x)=". */ + /* */ + /* parameters: */ + /* functstr ... string containing function definition */ + /* */ + /* return: */ + /* pointer to root of function tree (function term only!) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + return _unur_fstr_2_tree( functstr, TRUE ); +} /* end of _unur_fstr2tree_DefFunct() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +_unur_fstr_dup_tree (const struct ftreenode *root) + /*----------------------------------------------------------------------*/ + /* Duplicate function tree rooted at root */ + /* */ + /* parameters: */ + /* root ... pointer to root of function tree */ + /* */ + /* return: */ + /* pointer to duplicated tree */ + /*----------------------------------------------------------------------*/ +{ + struct ftreenode *dup; + + if (root==NULL) return NULL; + + /* check arguments */ + COOKIE_CHECK(root,CK_FSTR_TNODE,NULL); + + dup = _unur_xmalloc(sizeof(struct ftreenode)); + memcpy(dup,root,sizeof(struct ftreenode)); + if (root->left) dup->left = _unur_fstr_dup_tree(root->left); + if (root->right) dup->right = _unur_fstr_dup_tree(root->right); + + return dup; + +} /* end of _unur_fstr_dup_tree() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_fstr_free (struct ftreenode *root) + /*----------------------------------------------------------------------*/ + /* Destroy function tree. */ + /* */ + /* parameters: */ + /* root ... pointer to root of function tree */ + /*----------------------------------------------------------------------*/ +{ + if( root != NULL ) { + /* check arguments */ + COOKIE_CHECK(root,CK_FSTR_TNODE,RETURN_VOID); + + if (root->left) _unur_fstr_free(root->left); + if (root->right) _unur_fstr_free(root->right); + free(root); + } +} /* end of _unur_fstr_free() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Auxilliary routines **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +_unur_fstr_2_tree (const char *functstr, int withDefFunct) + /*----------------------------------------------------------------------*/ + /* Compute funtion tree from string. */ + /* */ + /* parameters: */ + /* functstr ... string containing function definition */ + /* withDefFunct ... whether string is assumed to start with "f(x)=" */ + /* */ + /* return: */ + /* pointer to root of function tree */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct parser_data *pdata; + struct ftreenode *root; + + /* check arguments */ + _unur_check_NULL( GENTYPE,functstr,NULL ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag) + _unur_fstr_debug_input(functstr); +#endif + + /* initialize parser */ + pdata = _unur_fstr_parser_init(functstr); + + /* check for errors (eg. empty string) */ + if (pdata == NULL) + return NULL; + + /* tokenize function string */ + _unur_fstr_tokenize(pdata); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag) + _unur_fstr_debug_token(pdata); +#endif + + /* exit in case of error */ + if (pdata->perrno) { + _unur_fstr_parser_free(pdata); + return NULL; + } + + /* parse list of token */ + if (withDefFunct) { + struct ftreenode *tmp = _unur_FunctDefinition(pdata); + root = tmp->right; + /* clear left subtree */ + _unur_fstr_free(tmp->left); + free(tmp); + } + else { + root = _unur_Expression(pdata); + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if ((_unur_default_debugflag & UNUR_DEBUG_SETUP) && root) + _unur_fstr_debug_tree(pdata,root); +#endif + + /* check for possible errors */ + if (pdata->tno < pdata->n_tokens && !pdata->perrno) + _unur_fstr_error_parse(pdata,ERR_UNFINISHED,__LINE__); + if (pdata->perrno) { + _unur_fstr_parser_free(pdata); + _unur_fstr_free(root); + return NULL; + } + + /* free working space */ + _unur_fstr_parser_free(pdata); + + /* return pointer to function tree */ + return root; +} /* end of _unur_fstr_2_tree() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/parser/functparser_parser.ch b/vendor/unuran-1.11.0/src/parser/functparser_parser.ch new file mode 100644 index 0000000..2dc427d --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/functparser_parser.ch @@ -0,0 +1,1199 @@ +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: functparser_parser.c * + * * + * Parse tokenized function string and construct function tree * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Parser **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +_unur_FunctDefinition (struct parser_data *pdata) + /*----------------------------------------------------------------------*/ + /* Get user defined function. */ + /* */ + /* FunctDefinition ::= DefFunctDesignator '=' Expression */ + /* */ + /* '=' */ + /* / \ */ + /* DefFunctDesignator Expression */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* */ + /* return: */ + /* pointer to function tree */ + /*----------------------------------------------------------------------*/ +{ + struct ftreenode *node, *left, *right; + char *symb; + int token; + + /* check arguments */ + CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); + + /* left hand side: DefFunctDesignator */ + left = _unur_DefFunctDesignator(pdata); + if (pdata->perrno) { + _unur_fstr_free(left); return NULL; + } + + /* next token must be "=" sign */ + if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || + strcmp(symb,"=") != 0 ) { + _unur_fstr_free(left); + return _unur_fstr_error_parse(pdata,ERR_EXPECT_EQUAL,__LINE__); + } + + /* right hand side: function term */ + right = _unur_Expression(pdata); + if (pdata->perrno) { + _unur_fstr_free(left); _unur_fstr_free(right); + return NULL; + } + + /* store function in node */ + node = _unur_fstr_create_node(symb,0.,token,left,right); + + /* return pointer to function */ + return node; +} /* end of _unur_FunctDefinition() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +_unur_DefFunctDesignator (struct parser_data *pdata) + /*----------------------------------------------------------------------*/ + /* Definition of user defined function. */ + /* */ + /* DefFunctDesignator ::= Identifier '(' DefParameterlist ')' */ + /* */ + /* Identifier */ + /* / \ */ + /* NULL DefParameterlist */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* */ + /* return: */ + /* pointer to function tree */ + /*----------------------------------------------------------------------*/ +{ + struct ftreenode *node, *params; + char *fsymb, *symb; + int n_params; + int funct, token; + + /* check arguments */ + CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); + + /* get function identifier */ + if ( _unur_fstr_next_token(pdata,&funct,&fsymb) != UNUR_SUCCESS || + symbol[funct].type != S_UFUNCT ) + return _unur_fstr_error_parse(pdata,ERR_EXPECT_FUNCT,__LINE__); + + /* read opening parenthesis '(' */ + if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || + symb[0] != '(' ) + return _unur_fstr_error_parse(pdata,ERR_EXPECT_OPEN_P,__LINE__); + + /* read the parameter list */ + params = _unur_DefParameterlist(pdata,&n_params); + if (pdata->perrno) { + _unur_fstr_free(params); + return NULL; + } + + /* read closing parenthesis ')' */ + if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || + symb[0] != ')' ) { + _unur_fstr_free(params); + return _unur_fstr_error_parse(pdata,ERR_EXPECT_CLOSE_P,__LINE__); + } + + /* store function header in node */ + node = _unur_fstr_create_node(fsymb,0.,funct,NULL,params); + + /* return pointer to function desigatior */ + return node; +} /* end of _unur_DefFunctDesignator() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +_unur_DefParameterlist(struct parser_data *pdata, int *n_params) + /*----------------------------------------------------------------------*/ + /* Parameter list for user defined function. */ + /* */ + /* DefParameterlist ::= '(' Identifier [ ',' Identifier ] ')' */ + /* */ + /* Identifier ',' */ + /* / \ or: / \ */ + /* NULL NULL more identifiers tree Identifier */ + /* / \ */ + /* NULL NULL */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* n_params ... detected number of parameters for defined function */ + /* */ + /* return: */ + /* pointer to function tree */ + /*----------------------------------------------------------------------*/ +{ + struct ftreenode *node, *left, *right; + char *symb; + int token; + + /* check arguments */ + CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); + + /* read user defined identifier, i.e. a variable */ + if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || + symbol[token].type != S_UIDENT ) + return _unur_fstr_error_parse(pdata,ERR_EXPECT_VAR,__LINE__); + + /* make node for first parameter of function and set */ + /* counter for parameters to 1 */ + node = _unur_fstr_create_node(symb,0.,token,NULL,NULL); + *n_params = 1; + + /* scan token list while we find a list separator `,' */ + while ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || + symb[0] == ',' ) { + + /* get next variable */ + if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || + symbol[token].type != S_UIDENT ) { + _unur_fstr_free(node); + return _unur_fstr_error_parse(pdata,ERR_EXPECT_VAR,__LINE__); + } + + /* old node becomes left node of `,' node */ + left = node; + + /* make node for next variable (becomes right node) */ + /* and update counter for parameters */ + right = _unur_fstr_create_node(symb,0.,token,NULL,NULL); + (*n_params)++; + + /* make node for `,' separator */ + node = _unur_fstr_create_node(",",0.,s_comma,left,right); + } + + /* set token pointer to first element after parameter list */ + --(pdata->tno); + + /* return pointer to parameter list */ + return node; +} /* end of _unur_DefParameterlist() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +_unur_Expression (struct parser_data *pdata) + /*----------------------------------------------------------------------*/ + /* Expression ::= SimpleExpression [ RelationOperator SimpleExpression ] */ + /* */ + /* RelationOperator */ + /* SimpleExpression or: / \ */ + /* SimpleExpression SimpleExpression */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* */ + /* return: */ + /* pointer to function tree */ + /*----------------------------------------------------------------------*/ +{ + struct ftreenode *node, *left, *right; + char *symb; + int token; + + /* check arguments */ + CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); + + /* read simple expression from function string */ + left = _unur_SimpleExpression(pdata); + if (pdata->perrno) { + _unur_fstr_free(left); return NULL; + } + + /* get next token */ + if ( _unur_fstr_next_token(pdata,&token,&symb) == UNUR_SUCCESS && + symbol[token].type == S_REL_OP ) { + /* relation operator --> read r.h.s.*/ + right = _unur_SimpleExpression(pdata); + if (pdata->perrno) { + _unur_fstr_free(left); _unur_fstr_free(right); + return NULL; + } + /* create a new node */ + node = _unur_fstr_create_node(symb,0.,token,left,right); + } + + else { + /* we only have a simple expression */ + /* hence we set token pointer to get same token again */ + --(pdata->tno); + node = left; + } + + /* return pointer to Expression */ + return node; +} /* end of _unur_Expression() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +_unur_SimpleExpression (struct parser_data *pdata) + /*----------------------------------------------------------------------*/ + /* SimpleExpression ::= STerm { AddingOperator Term } */ + /* */ + /* AddingOperator */ + /* STerm or: / \ */ + /* more terms tree Term */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* */ + /* return: */ + /* pointer to function tree */ + /*----------------------------------------------------------------------*/ +{ + struct ftreenode *node, *left, *right; + char *symb; + int token; + + /* check arguments */ + CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); + + /* get next Term in string */ + node = _unur_STerm(pdata); + if (pdata->perrno) { + _unur_fstr_free(node); return NULL; + } + + /* get next token */ + while ( _unur_fstr_next_token(pdata,&token,&symb) == UNUR_SUCCESS && + symbol[token].type == S_ADD_OP) { + /* get Term after adding operator and */ + /* use node a right node of new operator node */ + left = node; + + right = _unur_Term(pdata); + if (pdata->perrno) { + _unur_fstr_free(left); _unur_fstr_free(right); + return NULL; + } + + node = _unur_fstr_create_node(symb,0.,token,left,right); + } + + /* set token pointer to get same token again */ + --(pdata->tno); + + /* return pointer */ + return node; +} /* end of _unur_SimpleExpression() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +_unur_STerm (struct parser_data *pdata) + /*----------------------------------------------------------------------*/ + /* STerm ::= [ '+' | '-' ] Term */ + /* */ + /* '-' */ + /* Term or: / \ */ + /* '0' Term */ + /* / \ */ + /* NULL NULL */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* */ + /* return: */ + /* pointer to function tree */ + /*----------------------------------------------------------------------*/ +{ + struct ftreenode *node, *left, *right; + char *symb; + int token; + + /* check arguments */ + CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); + + /* get next token */ + if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS) + /* there is no next token */ + return NULL; + + if ( symb[0] == '-' ) { + /* term with negative sign */ + /* "-" is interpreted as binary operator */ + /* thus "0" is added in front of it */ + left = _unur_fstr_create_node(NULL,0.,s_uconst,NULL,NULL); + right = _unur_Term(pdata); + if (pdata->perrno) { + _unur_fstr_free(left); _unur_fstr_free(right); + return NULL; + } + + node = _unur_fstr_create_node(symb,0.,token,left,right); + } + + else { + /* term with positive sign or without any sign */ + if( symb[0] != '+' ) { + /* set pointer to previous token again */ + --(pdata->tno); + } + node = _unur_Term(pdata); + if (pdata->perrno) { + _unur_fstr_free(node); return NULL; + } + } + + /* return pointer to term */ + return node; +} /* end of _unur_STerm() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +_unur_Term (struct parser_data *pdata) + /*----------------------------------------------------------------------*/ + /* Term ::= Factor [ MultiplyingOperator Factor ] */ + /* */ + /* MultiplyingOperator */ + /* Factor or: / \ */ + /* more factors tree Factor */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* */ + /* return: */ + /* pointer to function tree */ + /*----------------------------------------------------------------------*/ +{ + struct ftreenode *node, *left, *right; + char *symb; + int token; + + /* check arguments */ + CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); + + /* get next factor of multiplication */ + node = _unur_Factor(pdata); + if (pdata->perrno) { + _unur_fstr_free(node); return NULL; + } + + /* get next token */ + while ( _unur_fstr_next_token(pdata,&token,&symb) == UNUR_SUCCESS && + symbol[token].type == S_MUL_OP ) { + /* get Factor after multiplication operator and */ + /* use node a right node of new operator node */ + left = node; + + right = _unur_Factor(pdata); + if (pdata->perrno) { + _unur_fstr_free(left); _unur_fstr_free(right); + return NULL; + } + + node = _unur_fstr_create_node(symb,0.,token,left,right); + } + + /* set token pointer to get same token again */ + --(pdata->tno); + + /* return pointer to term */ + return node; +} /* end of _unur_Term() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +_unur_Factor (struct parser_data *pdata) + /*----------------------------------------------------------------------*/ + /* Factor ::= Base [ '^' Exponent ] */ + /* */ + /* '^' */ + /* Bas_Exp or: / \ */ + /* Bas_Exp Bas_Exp */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* */ + /* return: */ + /* pointer to function tree */ + /*----------------------------------------------------------------------*/ +{ + struct ftreenode *node, *left, *right; + char *symb; + int token; + + /* check arguments */ + CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); + + /* get base of factor */ + left = _unur_Bas_Exp(pdata); + if (pdata->perrno) { + _unur_fstr_free(left); return NULL; + } + + /* get next token */ + if ( _unur_fstr_next_token(pdata,&token,&symb) == UNUR_SUCCESS && + symb[0] == '^' ) { + /* get exponent of factor */ + right = _unur_Bas_Exp(pdata); + if (pdata->perrno) { + _unur_fstr_free(left); _unur_fstr_free(right); + return NULL; + } + + /* and create node for '^' operator */ + node = _unur_fstr_create_node(symb,0.,token,left,right); + } + + else { + /* no exponent */ + /* set pointer to previous token again */ + --(pdata->tno); + /* and return base */ + node = left; + } + + /* return pointer to factor */ + return node; +} /* end of _unur_Factor() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +_unur_Bas_Exp (struct parser_data *pdata) + /*----------------------------------------------------------------------*/ + /* Base ::= Exponent */ + /* Exponent ::= UnsignedConstant | Identifier | FunctDesignator */ + /* | '(' Expression ')' */ + /* */ + /* UnsignedConstant Identifier */ + /* / \ or / \ or */ + /* NULL NULL NULL NULL */ + /* */ + /* FunctDesignator or Expression */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* */ + /* return: */ + /* pointer to function tree */ + /*----------------------------------------------------------------------*/ +{ + struct ftreenode *node; + char *symb; + int token; + + /* check arguments */ + CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); + + /* get next token */ + if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS) + return _unur_fstr_error_parse(pdata,7,__LINE__); + + /* constant or and variable */ + if( symbol[token].type==S_UCONST || + symbol[token].type==S_UIDENT || + symbol[token].type==S_SCONST ) { + /* make a new end node */ + node = _unur_fstr_create_node(symb,0.,token,NULL,NULL); + } + + /* system function */ + else if( symbol[token].type == S_SFUNCT ) { + /* set pointer to previous token again */ + --(pdata->tno); + /* and get function */ + node = _unur_FunctDesignator(pdata); + if (pdata->perrno) { + _unur_fstr_free(node); return NULL; + } + } + + else if( symb[0] == '(' ) { + /* opening parenthesis --> read expression in side parenthesis */ + node = _unur_Expression(pdata); + if (pdata->perrno) { + _unur_fstr_free(node); return NULL; + } + + /* next symbol must be closing parenthesis */ + if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || + symb[0] != ')' ) + return _unur_fstr_error_parse(pdata,ERR_EXPECT_CLOSE_P,__LINE__); + } + + else { + /* unkown symbol */ + --(pdata->tno); + return _unur_fstr_error_parse(pdata,ERR_UNKNOWN_SYMBOL,__LINE__); + } + + /* return pointer to base or exponent of an expression */ + return node; +} /* end of _unur_Bas_Exp() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +_unur_FunctDesignator (struct parser_data *pdata) + /*----------------------------------------------------------------------*/ + /* FunctDesignator ::= FuncIdentifier '(' ActualParameterlist ')' */ + /* */ + /* Identifier */ + /* / \ */ + /* NULL ActualParameterlist */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* */ + /* return: */ + /* pointer to function tree */ + /*----------------------------------------------------------------------*/ +{ + struct ftreenode *node, *params; + char *fsymb, *symb; + int funct, token; + int n_params; + + /* check arguments */ + CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); + + /* get function identifier for system function */ + if ( _unur_fstr_next_token(pdata,&funct,&fsymb) != UNUR_SUCCESS || + symbol[funct].type != S_SFUNCT ) + return _unur_fstr_error_parse(pdata,ERR_EXPECT_FUNCT,__LINE__); + + /* get number of parameters for this function */ + n_params = symbol[funct].info; + + /* read opening parenthesis '(' */ + if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || + symb[0] != '(' ) + return _unur_fstr_error_parse(pdata,ERR_EXPECT_OPEN_P,__LINE__); + + /* read the parameter list */ + params = _unur_ActualParameterlist(pdata,n_params); + if (pdata->perrno) { + _unur_fstr_free(params); return NULL; + } + + /* read closing parenthesis ')' */ + if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || + symb[0] != ')' ) { + _unur_fstr_free(params); + return _unur_fstr_error_parse(pdata,ERR_EXPECT_CLOSE_P,__LINE__); + } + + /* store function in new node */ + node = _unur_fstr_create_node(fsymb,0.,funct,NULL,params); + + /* return pointer to function */ + return node; +} /* end of _unur_FunctDesignator() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +_unur_ActualParameterlist (struct parser_data *pdata, int n_params) + /*----------------------------------------------------------------------*/ + /* ActualParameterlist ::= ActualParameter [ ',' ActualParameter ] */ + /* */ + /* ',' */ + /* Expression or: / \ */ + /* more expressions tree Expression */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* n_params ... number of expected parameters in list */ + /* */ + /* return: */ + /* pointer to function tree */ + /*----------------------------------------------------------------------*/ +{ + struct ftreenode *node, *left, *right; + char *symb; + int token; + int c_params; /* counter for parameters */ + + /* check arguments */ + CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); + + /* read first parameter from string ... */ + node = _unur_Expression(pdata); + if (pdata->perrno) { + _unur_fstr_free(node); return NULL; + } + + /* .. and set counter for parameters to 1 */ + c_params = 1; + + /* scan token list while we find a list separator `,' */ + while ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || + symb[0] == ',' ) { + + /* update counter for parameters */ + c_params++; + if (c_params > n_params) { + _unur_fstr_free(node); + return _unur_fstr_error_parse(pdata,ERR_INVALID_N_PARAMS,__LINE__); + } + + /* old node becomes left node of `,' node */ + left = node; + + /* make node for next variable (becomes right node) */ + right = _unur_Expression(pdata); + if (pdata->perrno) { + _unur_fstr_free(left); _unur_fstr_free(right); + return NULL; + } + + /* make node for `,' separator */ + node = _unur_fstr_create_node(",",0.,s_comma,left,right); + } + + /* set token pointer to first element after parameter list */ + --(pdata->tno); + + /* check number of parameters */ + if (c_params < n_params) { + _unur_fstr_free(node); + return _unur_fstr_error_parse(pdata,ERR_INVALID_N_PARAMS,__LINE__); + } + + /* return pointer to parameter list */ + return node; +} /* end of _unur_ActualParameterlist() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Simplify tree **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +_unur_fstr_simplification (const char *symb, int token, + struct ftreenode *left, struct ftreenode *right) + /*----------------------------------------------------------------------*/ + /* Try to simpify nodes */ + /* */ + /* parameters: */ + /* symb ... symbol string */ + /* token ... token for which new node should be created */ + /* left ... pointer to left node */ + /* right ... pointer to right node */ + /* */ + /* return: */ + /* Pointer to simplified node */ + /* NULL if no simplication is possible */ + /* */ + /* Side effects: */ + /* 'left' or 'right' may be freed when the node is simplified. */ + /* This cannot happen if NULL is returned. */ + /*----------------------------------------------------------------------*/ +{ + /* some booleans */ + int l_const = left && (left->type == S_SCONST || left->type == S_UCONST); + int r_const = right && (right->type == S_SCONST || right->type == S_UCONST); + int l_0 = (l_const && _unur_iszero(left->val)); + int l_1 = (l_const && _unur_isone(left->val)); + int r_0 = (r_const && _unur_iszero(right->val)); + int r_1 = (r_const && _unur_isone(right->val)); + int and; + + char s = symb[0]; + + /* Exp Exp + * / \ / \ + * NULL ',' ==> X Y + * / \ + * X Y + */ + if ( left == NULL && right && right->symbol[0] == ',' ) { + COOKIE_CHECK(right,CK_FSTR_TNODE,NULL); + right->token = token; + right->symbol = symbol[token].name; + right->type = symbol[token].type; + return right; + } + + /* Operator Operator + * / \ or / \ ==> Const (result of computation) + * Const Const NULL Const + */ + if ( (l_const || left==NULL) && r_const && s!=',') { + CHECK_NULL(right,NULL); COOKIE_CHECK(right,CK_FSTR_TNODE,NULL); + /* compute new value */ + right->val = ( (left) + ? (*symbol[token].vcalc)(left->val,right->val) + : (*symbol[token].vcalc)(0.,right->val) ); + right->token = s_uconst; + right->type = S_UCONST; + right->left = NULL; + right->right = NULL; + _unur_fstr_free(left); + return right; + } + + /* '+' '*' + * / \ or / \ ==> X + * 0 X 1 X + */ + if ( (l_0 && s=='+' ) || (l_1 && s=='*') ) { + CHECK_NULL(left,NULL); COOKIE_CHECK(left,CK_FSTR_TNODE,NULL); + CHECK_NULL(right,NULL); COOKIE_CHECK(right,CK_FSTR_TNODE,NULL); + _unur_fstr_free(left); + return right; + } + + /* '+' '-' + * / \ or / \ or + * X 0 X 0 + * + * '*' '/' + * / \ or / \ or + * X 1 X 1 + * + * '^' + * / \ ==> X + * X 1 + */ + if ( (r_0 && (s=='+' || s=='-')) || + (r_1 && (s=='*' || s=='/' || s=='^')) ) { + CHECK_NULL(left,NULL); COOKIE_CHECK(left,CK_FSTR_TNODE,NULL); + CHECK_NULL(right,NULL); COOKIE_CHECK(right,CK_FSTR_TNODE,NULL); + _unur_fstr_free(right); + return left; + } + + /* '*' '*' + * / \ or / \ or + * 0 X X 0 + * + * '/' '^' + * / \ or / \ or + * 0 X 0 X + * + * "and" "and" + * / \ or / \ ==> 0 + * 0 X X 0 + */ + and = (strcmp(symb,"and")==0); + if ( l_0 && (s=='*' || s=='/' || s=='^' || and) ) { + CHECK_NULL(left,NULL); COOKIE_CHECK(left,CK_FSTR_TNODE,NULL); + CHECK_NULL(right,NULL); COOKIE_CHECK(right,CK_FSTR_TNODE,NULL); + _unur_fstr_free(right); + return left; + } + if (r_0 && (s=='*' || and ) ) { + CHECK_NULL(left,NULL); COOKIE_CHECK(left,CK_FSTR_TNODE,NULL); + CHECK_NULL(right,NULL); COOKIE_CHECK(right,CK_FSTR_TNODE,NULL); + _unur_fstr_free(left); + return right; + } + + /* '^' '^' + * / \ or / \ ==> 1 + * X 0 1 X + */ + if (r_0 && s=='^') { + CHECK_NULL(left,NULL); COOKIE_CHECK(left,CK_FSTR_TNODE,NULL); + CHECK_NULL(right,NULL); COOKIE_CHECK(right,CK_FSTR_TNODE,NULL); + _unur_fstr_free(left); + right->val = 1.; + return right; + } + if (l_1 && s=='^') { + CHECK_NULL(left,NULL); COOKIE_CHECK(left,CK_FSTR_TNODE,NULL); + CHECK_NULL(right,NULL); COOKIE_CHECK(right,CK_FSTR_TNODE,NULL); + _unur_fstr_free(right); + return left; + } + + /* '/' + * ___/ \___ + * / \ + * X X ==> 1 + * / \ / \ + * NULL NULL NULL NULL + */ + if ( ( symb[0] == '/' && + left && left->left==NULL && left->right==NULL && + right && right->left==NULL && right->right==NULL && + strcmp(left->symbol,right->symbol)== 0 ) ) { + CHECK_NULL(left,NULL); COOKIE_CHECK(left,CK_FSTR_TNODE,NULL); + CHECK_NULL(right,NULL); COOKIE_CHECK(right,CK_FSTR_TNODE,NULL); + _unur_fstr_free(left); + right->token = s_uconst; + right->symbol= symbol[s_uconst].name; + right->val = 1.; + right->type = S_UCONST; + right->left = NULL; + right->right = NULL; + return right; + } + + /* no simplification */ + return NULL; +} /* _unur_fstr_simplification() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_fstr_reorganize (struct ftreenode *node) + /*----------------------------------------------------------------------*/ + /* Try to reorganize tree at node */ + /* */ + /* parameters: */ + /* node ... pointer to node in tree */ + /* */ + /* return: */ + /* 1 if successful */ + /* 0 otherwise */ + /*----------------------------------------------------------------------*/ +{ + struct ftreenode *left, *right, *tmp; + char symb; + int l_const, r_const; + int rl_0, ll_0; + + /* check arguments */ + CHECK_NULL(node,0); COOKIE_CHECK(node,CK_FSTR_TNODE,0); + + left = node->left; + right = node->right; + symb = node->symbol[0]; + + /* some booleans */ + l_const = left && (left->type == S_SCONST || left->type == S_UCONST); + r_const = right && (right->type == S_SCONST || right->type == S_UCONST); + rl_0 = (right && right->left && right->left->type == S_UCONST && _unur_iszero(right->left->val)); + ll_0 = (left && left->left && left->left->type == S_UCONST && _unur_iszero(left->left->val)); + + /* Operator Operator + * / \ or / \ ==> Const (result of computation) + * Const Const NULL Const + */ + if ( (l_const || left==NULL) && r_const && symb!=',') { + /* compute new value */ + node->val = ( (left) + ? (*symbol[node->token].vcalc)(left->val,right->val) + : (*symbol[node->token].vcalc)(0.,right->val) ); + node->token = s_uconst; + node->type = S_UCONST; + node->left = NULL; + node->right = NULL; + if (left) free(left); + if (right) free(right); + return 1; + } + + /* '+' '-' + * / \ / \ + * X '-' ==> X Y + * / \ + * 0 Y + */ + if ( rl_0 && symb=='+' && right->symbol[0]=='-' ) { + node->symbol = symbol[s_minus].name; + node->token = s_minus; + node->type = symbol[s_minus].type; + node->right = right->right; + free(right->left); + free(right); + return 1; + } + + /* '-' '+' + * / \ / \ + * X '-' ==> X Y + * / \ + * 0 Y + */ + if ( rl_0 && symb=='-' && right->symbol[0]=='-' ) { + node->symbol = symbol[s_plus].name; + node->token = s_plus; + node->type = symbol[s_plus].type; + node->right = right->right; + free(right->left); + free(right); + return 1; + } + + /* '+' '-' + * / \ / \ + * '-' Y ==> Y X + * / \ + * 0 X + */ + if ( ll_0 && symb=='+' && left->symbol[0]=='-' ) { + node->symbol = symbol[s_minus].name; + node->token = s_minus; + node->type = symbol[s_minus].type; + tmp = node->right; + node->right = left->right; + node->left = tmp; + free(left->left); + free(left); + return 1; + } + + /* '*' '-' + * / \ / \ + * X '-' ==> 0 '*' + * / \ / \ + * 0 Y X Y + */ + if ( rl_0 && symb=='*' && right->symbol[0]=='-' ) { + node->symbol = symbol[s_minus].name; + node->token = s_minus; + node->type = symbol[s_minus].type; + right->symbol= symbol[s_mul].name; + right->token = s_mul; + right->type = symbol[s_mul].type; + tmp = left; + node->left = node->right->left; + node->right = tmp; + return 1; + } + + /* no reorganization */ + return 0; + +} /* end of _unur_fstr_reorganize() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Auxilliary routines **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_fstr_next_token (struct parser_data *pdata, int *token, char **symb) + /*----------------------------------------------------------------------*/ + /* Get next token from list. */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* token ... to store token */ + /* symb ... to store symbol for token */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(pdata,UNUR_ERR_NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,UNUR_ERR_COOKIE); + + if (pdata->tno < pdata->n_tokens) { + /* return token and increment scan position */ + *token = pdata->token[pdata->tno]; + *symb = pdata->tpos[pdata->tno]; + ++(pdata->tno); + return UNUR_SUCCESS; + } + else { + /* no more tokens */ + ++(pdata->tno); + return UNUR_ERR_SILENT; + } + +} /* end of _unur_fstr_next_token() */ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +_unur_fstr_create_node (const char *symb, double val, int token, + struct ftreenode *left, struct ftreenode *right) + /*----------------------------------------------------------------------*/ + /* Create new node. */ + /* */ + /* parameters: */ + /* symb ... symbol string */ + /* val ... value of constant (only used if symb is NULL) */ + /* token ... token for which node should be created */ + /* left ... pointer to left node */ + /* right ... pointer to right node */ + /* */ + /* return: */ + /* pointer to new node */ + /*----------------------------------------------------------------------*/ +{ + struct ftreenode *node; + + if ( symb && (node = _unur_fstr_simplification(symb,token,left,right)) ) { + /* node has been simplified --> use left node, remove right node */ + } + else { + /* make new node */ + node = _unur_xmalloc(sizeof(struct ftreenode)); + COOKIE_SET(node,CK_FSTR_TNODE); + + node->symbol = symbol[token].name; + node->token = token; + node->type = symbol[token].type; + node->left = left; + node->right = right; + + /* compute and/or store constants in val field */ + switch (symbol[token].type) { + case S_UCONST: /* user defined constant, i.e. a number */ + node->val = (symb) ? atof(symb) : val; break; + case S_SCONST: /* system constant */ + node->val = symbol[token].val; break; + default: + node->val = 0.; + } + } + + /* it might be possible to reorganize the tree */ + _unur_fstr_reorganize(node); + + /* return node */ + return node; + +} /* end of _unur_fstr_create_node() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Error messages **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct ftreenode * +_unur_fstr_error_parse ( struct parser_data *pdata, int perrno, int line ) + /*----------------------------------------------------------------------*/ + /* Print error message when parsing function string */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* perrno ... error number */ + /* line ... line (to be inserted by __LINE__) */ + /* */ + /* return: */ + /* NULL */ + /*----------------------------------------------------------------------*/ +{ + int i; + struct unur_string *reason; + + /* check arguments */ + CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); + + /* set parser error */ + if (!pdata->perrno) pdata->perrno = perrno; + + /* create string for reason of error */ + reason = _unur_string_new(); + _unur_string_append( reason, "%s: ", _unur_fstr_error_code(perrno) ); + for (i=0; itno-1; i++) + _unur_string_append( reason, "%s ", pdata->tpos[i]); + + if (in_tokens) + _unur_string_append( reason, " -->%s<-- ", pdata->tpos[i]); + else + _unur_string_append( reason, " <-- "); + + for (i++; in_tokens; i++) + _unur_string_append( reason, "%s ",pdata->tpos[i]); + + /* report error */ + _unur_error_x( GENTYPE, __FILE__, line, "error", UNUR_ERR_FSTR_SYNTAX,reason->text); + + /* free working space */ + _unur_string_free( reason ); + + return NULL; + +} /* _unur_fstr_error_parse() */ + +/*---------------------------------------------------------------------------*/ + +const char * +_unur_fstr_error_code ( int perrno ) + /*----------------------------------------------------------------------*/ + /* Print message for error number */ + /* */ + /* parameters: */ + /* perrno ... error number */ + /* */ + /* return: */ + /* pointer to message string */ + /*----------------------------------------------------------------------*/ +{ + switch (perrno) { + case ERR_UNFINISHED: + return "incomplete. not all tokens parsed"; + case ERR_UNKNOWN_SYMBOL: + return "unknown symbol in function string"; + case ERR_EXPECT_EQUAL: + return "expected symbol: '='"; + case ERR_EXPECT_OPEN_P: + return "expected symbol: '('"; + case ERR_EXPECT_CLOSE_P: + return "expected symbol: ')'"; + case ERR_INVALID_N_PARAMS: + return "invalid number of parameters for function"; + case ERR_EXPECT_FUNCT: + return "function (name) expected"; + case ERR_EXPECT_VAR: + return "user identifier (variable name) expected"; + case ERR_MISSING: + return "more tokens expected"; + + default: + return ""; + } +} /* end of _unur_fstr_error_code() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/parser/functparser_scanner.ch b/vendor/unuran-1.11.0/src/parser/functparser_scanner.ch new file mode 100644 index 0000000..612cf16 --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/functparser_scanner.ch @@ -0,0 +1,608 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: functparser_scanner.c * + * * + * Scan and tokenize function string * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Initialize and destroy parser object **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct parser_data * +_unur_fstr_parser_init ( const char *fstr ) + /*----------------------------------------------------------------------*/ + /* Create and initialize parser object for given function string. */ + /* */ + /* parameters: */ + /* fstr ... string containing function definition */ + /* */ + /* return: */ + /* pointer to created and initialized parser object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + static int symbols_initialized = FALSE; + struct parser_data *pdata; + + /* first we have to prepare the table of known symbols */ + if (symbols_initialized == FALSE) { + _unur_fstr_symbols_init(); + symbols_initialized = TRUE; + } + + /* allocate memory for parser object */ + pdata = _unur_xmalloc(sizeof(struct parser_data)); + COOKIE_SET(pdata,CK_FSTR_PDATA); + + /* make a working copy of the function string, */ + /* remove all white spaces and convert to lower case letters. */ + pdata->fstr = _unur_parser_prepare_string(fstr); + pdata->len_fstr = strlen(pdata->fstr); + + /* check whether string is empty */ + if (pdata->len_fstr <= 0) { + /* empty, there is nothing to do */ + _unur_error(GENTYPE,UNUR_ERR_STR,"empty string"); + free (pdata->fstr); + free(pdata); + return NULL; + } + + /* make arrays to store tokens in string */ + pdata->token = _unur_xmalloc( (pdata->len_fstr+1) * sizeof(int) ); + pdata->tpos = _unur_xmalloc( (pdata->len_fstr+1) * sizeof(char *) ); + pdata->tstr = _unur_xmalloc( (2*pdata->len_fstr+1) * sizeof(char) ); + + /* initialize arrays */ + pdata->n_tokens = 0; + memset(pdata->token,0 ,(size_t)pdata->len_fstr); + memset(pdata->tpos, 0 ,(size_t)pdata->len_fstr); + memset(pdata->tstr,'\0',(size_t)pdata->len_fstr); + + /* initialize for scanning */ + pdata->scanpos = 0; /* scan position at beginning */ + pdata->lastpos = -1; + pdata->perrno = 0; + + /* names of user defined symbols */ + pdata->variable_name = NULL; + pdata->function_name = NULL; + + /* initialize data for parsing */ + pdata->tno = 0; + + /* return pointer to parser object */ + return pdata; + +} /* end of _unur_fstr_parser_init() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_fstr_symbols_init (void) + /*----------------------------------------------------------------------*/ + /* Prepare table of known symbols for usage. */ + /* */ + /* parameters: none */ + /*----------------------------------------------------------------------*/ +{ + int i; + char *s; + + /* none of these positions found */ + _ros_start = 0; + _nas_start = 0; + _ans_start = 0; + + /* find marker in list */ + for (i=0; !_end; i++) { + s = symbol[i].name; + if (!_ros_start) { + if ( strcmp(s,"_ROS") == 0) _ros_start = i; + continue; + } + if (!_nas_start) { + if ( strcmp(s,"_NAS") == 0) _nas_start = i; + continue; + } + if (!_ans_start) { + if ( strcmp(s,"_ANS") == 0) _ans_start = i; + continue; + } + if (strcmp(s,"_END") == 0) _end = i; + } + + /* end of region markers for list */ + _ros_end = _nas_start; + _nas_end = _ans_start; + _ans_end = _end; + + /* find location of special symbols */ + s_comma = _unur_fstr_find_symbol(",",_nas_start,_nas_end); + s_minus = _unur_fstr_find_symbol("-",_nas_start,_nas_end); + s_plus = _unur_fstr_find_symbol("+",_nas_start,_nas_end); + s_mul = _unur_fstr_find_symbol("*",_nas_start,_nas_end); + s_div = _unur_fstr_find_symbol("/",_nas_start,_nas_end); + s_power = _unur_fstr_find_symbol("^",_nas_start,_nas_end); + +} /* end of _unur_fstr_symbols_init() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_fstr_parser_free ( struct parser_data *pdata ) + /*----------------------------------------------------------------------*/ + /* Destroy parser object. */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /*----------------------------------------------------------------------*/ +{ + if (pdata) { + COOKIE_CHECK(pdata,CK_FSTR_PDATA,RETURN_VOID); + free(pdata->fstr); + free(pdata->token); + free(pdata->tpos); + free(pdata->tstr); + free(pdata); + } + +} /* end of _unur_fstr_parser_free() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Tokenize function string **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_fstr_tokenize (struct parser_data *pdata) + /*----------------------------------------------------------------------*/ + /* Tokenize function string */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* */ + /* return: */ + /* error code of called subroutines */ + /*----------------------------------------------------------------------*/ +{ + int token; + + int n_token = 0; /* counter for token */ + char *symb = pdata->tstr; /* array to store token */ + + /* check arguments */ + CHECK_NULL(pdata,UNUR_ERR_COOKIE); COOKIE_CHECK(pdata,CK_FSTR_PDATA,UNUR_ERR_COOKIE); + + /* locate token in function string and copy into token string */ + while ((token = _unur_fstr_next_symbol(pdata,symb)) != S_NOSYMBOL) { + pdata->token[n_token] = token; /* marker for token */ + pdata->tpos[n_token] = symb; /* name of token */ + n_token++; /* increment counter for tokens */ + symb += pdata->scanpos - pdata->lastpos + 1; /* skip to unused space in string */ + } + + /* store total number of tokens */ + pdata->n_tokens = n_token; + + /* set token pointer to first token */ + pdata->tno = 0; + + /* return error code */ + return pdata->perrno; + +} /* end of _unur_fstr_tokenize() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_fstr_next_symbol (struct parser_data *pdata, char *symb) + /*----------------------------------------------------------------------*/ + /* Get next symbol in function string. */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* symb ... pointer to array for storing symbol */ + /* */ + /* return: */ + /* error code of called subroutines */ + /*----------------------------------------------------------------------*/ +{ + int token; + int errcode = 0; + char c; + + /* check arguments */ + CHECK_NULL(pdata,S_NOSYMBOL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,S_NOSYMBOL); + + /* store position of pointer */ + pdata->lastpos = pdata->scanpos; + + if (pdata->scanpos >= pdata->len_fstr) + /* end of string */ + return S_NOSYMBOL; + + /* next character in string */ + c = pdata->fstr[pdata->scanpos]; + + /* new get next symbol in list */ + if ( (c >= '0' && c <= '9') || c == '.') { + /* Unsigned Constant */ + _unur_fstr_UnsignedConstant(pdata,symb); + token = s_uconst; + } + + else if (c >= 'a' && c <= 'z') { + /* Identifier */ + _unur_fstr_Identifier(pdata,symb); + + if ( ( (token = _unur_fstr_find_symbol(symb,_ans_start,_ans_end)) == 0 ) && + ( (token = _unur_fstr_find_user_defined(pdata,symb,pdata->fstr[pdata->scanpos])) <= 0 ) ) + errcode = ERR_UNKNOWN_SYMBOL; + } + + else if ( c == '<' || c == '>' || c == '=' || c == '!' ) { + /* Relation Operator */ + _unur_fstr_RelationOperator(pdata,symb); + + if ((token = _unur_fstr_find_symbol(symb,_ros_start,_ros_end)) <= 0 ) + errcode = ERR_UNKNOWN_SYMBOL; + } + + else { + symb[0] = c; symb[1] = '\0'; /* all other charactors */ + (pdata->scanpos)++; + if ((token = _unur_fstr_find_symbol(symb,_nas_start,_nas_end)) <= 0 ) + errcode = ERR_UNKNOWN_SYMBOL; + } + + /* set errorcode */ + pdata->perrno = errcode; + + if (errcode) { + _unur_fstr_error_scan (pdata,symb,__LINE__); + } + + return (errcode) ? S_NOSYMBOL : token; + +} /* end of _unur_fstr_next_symbol() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_fstr_find_symbol (const char *symb, int start, int end) + /*----------------------------------------------------------------------*/ + /* find symbol in table between position (start+1) and (end-1) */ + /* */ + /* parameters: */ + /* symb ... symbol to look for */ + /* start ... starting point for searching */ + /* end ... endpoint for searching */ + /* */ + /* return: */ + /* location in table */ + /* */ + /* error: */ + /* return 0 */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* search for symbol in table */ + for (i = start + 1; i < end; i++) + if (strcmp(symb,symbol[i].name) == 0) break; + + /* return location if symbol found and 0 otherwise */ + return ((i < end ) ? i : 0); + +} /* end of _unur_fstr_find_symbol() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_fstr_find_user_defined (struct parser_data *pdata, char *symb, int next_char) + /*----------------------------------------------------------------------*/ + /* Find user defined symbol. */ + /* If there are no user defined symbols yet, store it. */ + /* If there are already user defined symbols, and this one is new, */ + /* make return an errorcode. */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* symb ... symbol to look for */ + /* next_char ... character following given symbol */ + /* */ + /* return: */ + /* location in table */ + /* */ + /* error: */ + /* return 0 */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(pdata,0); COOKIE_CHECK(pdata,CK_FSTR_PDATA,0); + + /* we use next_char to distinguish between variables and functions */ + + if (next_char == '(') { + /* symbol is user defined function */ + if (pdata->function_name == NULL) { + /* new function --> store name */ + pdata->function_name = symb; + /* return marker for user defined identifier */ + return s_ufunct; + } + else + /* the identifier name must match with variable name */ + return (strcmp(pdata->function_name,symb) == 0) ? s_ufunct : 0; + } + + else { + /* symbol is user defined identifier (i.e. a variable) */ + if (pdata->variable_name == NULL) { + /* new variable --> store name */ + pdata->variable_name = symb; + /* return marker for user defined identifier */ + return s_uident; + } + else + /* the identifier name must match with variable name */ + return (strcmp(pdata->variable_name,symb) == 0) ? s_uident : 0; + } + +} /* end of _unur_fstr_find_user_defined() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Scan function string **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_fstr_UnsignedConstant (struct parser_data *pdata, char *uc) + /*----------------------------------------------------------------------*/ + /* Get Unsigned Constant */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* uc ... pointer to array for storing symbol */ + /* */ + /* Syntax: */ + /* UnsignedConstant ::= UnsignedInteger | UnsignedReal */ + /* UnsignedInteger ::= DigitSequence */ + /* UnsignedReal ::= UnsignedInteger ['.' DigitSequence] ['e' ScaleFactor] */ + /* */ + /*----------------------------------------------------------------------*/ +{ + /* store scan position */ + int startpos = pdata->scanpos; + + /* check arguments */ + CHECK_NULL(pdata,UNUR_ERR_NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,UNUR_ERR_COOKIE); + + /* copy digit sequence into uc */ + _unur_fstr_DigitalSequence(pdata,uc); + + if( pdata->fstr[pdata->scanpos] == '.' ) { + /* decimal point --> copy point and following digits */ + *(uc + pdata->scanpos - startpos) = '.'; + (pdata->scanpos)++; + _unur_fstr_DigitalSequence(pdata, uc + pdata->scanpos - startpos); + } + + if( pdata->fstr[pdata->scanpos] == 'e' ) { + /* exponent --> copy indicator 'E' and following [sign and] digits */ + *(uc + pdata->scanpos - startpos) = 'e'; + (pdata->scanpos)++; + _unur_fstr_ScaleFactor(pdata, uc + pdata->scanpos - startpos); + } + + return UNUR_SUCCESS; +} /* end of _unur_fstr_UnsignedConstant() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_fstr_DigitalSequence (struct parser_data *pdata, char *ds) + /*----------------------------------------------------------------------*/ + /* Get Digital Sequence */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* ds ... pointer to array for storing symbol */ + /* */ + /* Syntax: */ + /* DigitSequence ::= Digit [ Digit [...] ] */ + /* Digit ::= '0' | '1' | '2' | ... | '8' | '9' */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(pdata,UNUR_ERR_NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,UNUR_ERR_COOKIE); + + /* copy digit */ + while ( (*ds = pdata->fstr[pdata->scanpos]) >= '0' && *ds <= '9' ) { + ds++; + (pdata->scanpos)++; + } + /* terminate string */ + *ds = '\0'; + + return UNUR_SUCCESS; +} /* end of _unur_fstr_DigitalSequence() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_fstr_ScaleFactor (struct parser_data *pdata, char *sf) + /*----------------------------------------------------------------------*/ + /* Get Scale Factor */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* sf ... pointer to array for storing symbol */ + /* */ + /* Syntax: */ + /* ScaleFactor ::= [Sign] DigitSequence */ + /* Sign ::= '+' | '-' */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(pdata,UNUR_ERR_NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,UNUR_ERR_COOKIE); + + /* copy sign */ + if ( (sf[0] = pdata->fstr[pdata->scanpos]) == '+' || sf[0] == '-' ) { + sf++; + (pdata->scanpos)++; + } + /* copy digital sequence (after sign) */ + _unur_fstr_DigitalSequence(pdata,sf); + + return UNUR_SUCCESS; +} /* _unur_fstr_ScaleFactor() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_fstr_Identifier (struct parser_data *pdata, char *id) + /*----------------------------------------------------------------------*/ + /* Get Identifier */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* id ... pointer to array for storing symbol */ + /* */ + /* Syntax: */ + /* Identifier ::= Letter [ Letter | Digit [...] ] */ + /* Letter ::= 'a' | 'b' | ... | 'z' | '_' */ + /* Digit ::= '0' | '1' | ... | '9' */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(pdata,UNUR_ERR_NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,UNUR_ERR_COOKIE); + + /* copy word */ + while ( ((*id = pdata->fstr[pdata->scanpos]) >= 'a' && *id <= 'z') + || *id == '_' + || ( *id >= '0' && *id <= '9')) { + id++; + (pdata->scanpos)++; + } + /* terminate string */ + *id = '\0'; + + return UNUR_SUCCESS; +} /* end of _unur_fstr_Identifier() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_fstr_RelationOperator (struct parser_data *pdata, char *ro) + /*----------------------------------------------------------------------*/ + /* Get Relation Operator */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* ro ... pointer to array for storing symbol */ + /* */ + /* Syntax: */ + /* RelationOperator ::= RelationChar [ RelationChar ] */ + /* RelationChar ::= '<' | '>' | '=' | '!' */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(pdata,1); COOKIE_CHECK(pdata,CK_FSTR_PDATA,1); + + /* copy relation operator */ + while ((*ro = pdata->fstr[pdata->scanpos]) == '<' || *ro == '>' || *ro == '=' || *ro == '!' ) { + ro++; + (pdata->scanpos)++; + } + /* terminate string */ + *ro = '\0'; + + return UNUR_SUCCESS; +} /* _unur_fstr_RelationOperator() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Error messages **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +void +_unur_fstr_error_scan (const struct parser_data *pdata, const char *symb, int line) + /*----------------------------------------------------------------------*/ + /* Print error message when scanning function string */ + /* */ + /* parameters: */ + /* pdata ... pointer to parser object */ + /* symb ... pointer to unknown symbol */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *reason; + char *c; + + /* check arguments */ + CHECK_NULL(pdata,RETURN_VOID); COOKIE_CHECK(pdata,CK_FSTR_PDATA,RETURN_VOID); + + /* create string for reason of error */ + reason = _unur_string_new(); + + /* print unknown symbol */ + _unur_string_append( reason, "unknown symbol '%s': ", symb ); + + /* print scanned part of function string to error stream */ + for (c=pdata->fstr; c < pdata->fstr+pdata->lastpos; c++) + _unur_string_append( reason, "%c", *c ); + + /* print remaining part of function string including unknown symbol */ + _unur_string_append( reason, " --> %s", pdata->fstr + pdata->lastpos); + + /* report error */ + _unur_error_x( GENTYPE, __FILE__, line, "error", UNUR_ERR_FSTR_SYNTAX,reason->text); + + /* free working space */ + _unur_string_free( reason ); + +} /* end of _unur_fstr_error_scan() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/parser/functparser_source.h b/vendor/unuran-1.11.0/src/parser/functparser_source.h new file mode 100644 index 0000000..b889f15 --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/functparser_source.h @@ -0,0 +1,84 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: functparser_source.h * + * * + * PURPOSE: * + * declares prototypes for function parser * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef FUNCTPARSER_SOURCE_H_SEEN +#define FUNCTPARSER_SOURCE_H_SEEN + +/*---------------------------------------------------------------------------*/ +/* Function prototypes for function string parser */ +/*---------------------------------------------------------------------------*/ + +struct ftreenode *_unur_fstr2tree ( const char *functstring ); +/*---------------------------------------------------------------------------*/ +/* Compute funtion tree from string. */ +/*---------------------------------------------------------------------------*/ + +struct ftreenode *_unur_fstr2tree_DefFunct ( const char *functstring ); +/*---------------------------------------------------------------------------*/ +/* Compute funtion tree from string. */ +/* (Same as _unur_fstr2tree() but string must start with "f(x)=". */ +/*---------------------------------------------------------------------------*/ + +double _unur_fstr_eval_tree ( const struct ftreenode *functtree_root, double x ); +/*---------------------------------------------------------------------------*/ +/* Evalutes function given by a function tree at x. */ +/*---------------------------------------------------------------------------*/ + +struct ftreenode *_unur_fstr_dup_tree (const struct ftreenode *functtree_root); +/*---------------------------------------------------------------------------*/ +/* Duplicate function tree rooted at root. */ +/*---------------------------------------------------------------------------*/ + +void _unur_fstr_free ( struct ftreenode *functtree_root ); +/*---------------------------------------------------------------------------*/ +/* Destroys function tree and frees memory. */ +/*---------------------------------------------------------------------------*/ + +char *_unur_fstr_tree2string ( const struct ftreenode *functtree_root, + const char *variable, const char *function, int spaces ); +/*---------------------------------------------------------------------------*/ +/* Produce string from function tree. */ +/* It returns a pointer to the resulting string. This should be freed when */ +/* it is not used any more. */ +/*---------------------------------------------------------------------------*/ + +struct ftreenode *_unur_fstr_make_derivative ( const struct ftreenode *functtree_root ); +/*---------------------------------------------------------------------------*/ +/* Make function tree for derivate of given function (tree). */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +#endif /* FUNCTPARSER_SOURCE_H_SEEN */ +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/parser/functparser_stringgen.ch b/vendor/unuran-1.11.0/src/parser/functparser_stringgen.ch new file mode 100644 index 0000000..f3db189 --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/functparser_stringgen.ch @@ -0,0 +1,225 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: functparser_codegen.c * + * * + * Make string or programming code for function given by its tree. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** API **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +char * +_unur_fstr_tree2string ( const struct ftreenode *root, + const char *variable, const char *function, int spaces ) + /*----------------------------------------------------------------------*/ + /* Produce string from function tree. */ + /* As a side effect a string is allocated. */ + /* */ + /* parameters: */ + /* root ... pointer to root of function tree */ + /* variable ... pointer to name of variable */ + /* function ... pointer to name of function */ + /* spaces ... whether spaces are inserted around binary operators */ + /* */ + /* return: */ + /* pointer to output string (should be freed when not used any more) */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string output = {NULL, 0, 0}; + + /* check arguments */ + _unur_check_NULL( GENTYPE,root,NULL ); + + /* make string */ + _unur_fstr_node2string(&output,root,variable,function,spaces); + + return output.text; + +} /* end of _unur_fstr_tree2string() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Create function string and source code. **/ +/*****************************************************************************/ + +int +_unur_fstr_node2string ( struct unur_string *output, const struct ftreenode *node, + const char *variable, const char *function, int spaces ) + /*----------------------------------------------------------------------*/ + /* Produce string from function subtree rooted at node. */ + /* As a side effect a string is allocated. */ + /* */ + /* parameters: */ + /* output ... pointer to string for output */ + /* node ... pointer to node in function tree */ + /* variable ... pointer to name of variable */ + /* function ... pointer to name of function */ + /* spaces ... whether spaces are inserted around binary operators */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + struct ftreenode *left = node->left; /* left branch of node */ + struct ftreenode *right = node->right; /* right branch of node */ + const char *symb; /* symbol for node (or NULL for constant) */ + int type = node->type; /* type of symbol */ + int priority = symbol[node->token].info; /* priority of symbol */ + int operator, parenthesis; /* booleans */ + + /* get symbol for node */ + switch (type) { + case S_UIDENT: /* variable */ + symb = variable; break; + case S_UFUNCT: /* function */ + symb = function; break; + case S_UCONST: /* node contains constant */ + /* use value in node instead of symbol */ + symb = NULL; break; + case S_SCONST: + default: + symb = node->symbol; + } + + if (type == S_SFUNCT || type == S_UFUNCT) { + /* node '(' left ',' right ')' */ + _unur_fstr_print( output, symb, 0. ); + _unur_fstr_print( output, "(", 0. ); + if (left) { + _unur_fstr_node2string(output,left,variable,function,spaces); + _unur_fstr_print( output, ",", 0. ); + } + if (right) { + _unur_fstr_node2string(output,right,variable,function,spaces); + } + _unur_fstr_print( output, ")", 0. ); + } + + else if (symb && symb[0] == ',') { + /* left ',' right */ + _unur_fstr_print( output, ",", 0. ); + if (left) { + _unur_fstr_node2string(output,left,variable,function,spaces); + _unur_fstr_print( output, ",", 0. ); + } + if (right) { + _unur_fstr_node2string(output,right,variable,function,spaces); + } + } + + else { + /* check whether enclosing blanks are required for typography */ + operator = (type==S_REL_OP || type==S_ADD_OP || type==S_MUL_OP); + + /* left branch */ + if (left) { + /* always use parenthesis ... */ + parenthesis = 1; + /* ... except ... */ + if (left->type == S_SCONST || left->type == S_UCONST || + left->type == S_SFUNCT || left->type == S_UFUNCT || + ( left->type == S_UIDENT && left->val >= 0. ) || + ( priority < symbol[left->token].info && !isalpha(node->symbol[0]) ) || + ( priority == symbol[left->token].info && (type == S_ADD_OP ) ) ) + parenthesis = 0; + if (parenthesis) _unur_fstr_print( output, "(", 0. ); + + if (left->type == S_UCONST && _unur_iszero(left->val) && node->symbol[0] == '-') + /* there is no need to print "0 - ..." */ ; + else + _unur_fstr_node2string(output,left,variable,function,spaces); + + if (parenthesis) _unur_fstr_print( output, ")", 0. ); + } + + /* symbol for node */ + if (operator && spaces) _unur_fstr_print( output, " ", 0. ); + _unur_fstr_print( output, symb, node->val ); + if (operator && spaces) _unur_fstr_print( output, " ", 0. ); + + /* right branch */ + if (right) { + /* always use parenthesis ... */ + parenthesis = 1; + /* ... except ... */ + if (right->type == S_SCONST || right->type == S_UCONST || + right->type == S_SFUNCT || right->type == S_UFUNCT || + ( right->type == S_UIDENT && right->val >= 0. ) || + ( priority < symbol[right->token].info && !isalpha(node->symbol[0]) ) ) + parenthesis = 0; + if (parenthesis) _unur_fstr_print( output, "(", 0. ); + _unur_fstr_node2string(output,right,variable,function,spaces); + if (parenthesis) _unur_fstr_print( output, ")", 0. ); + } + } + + return UNUR_SUCCESS; +} /* end of _unur_fstr_node2string() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Auxilliary routines **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_fstr_print ( struct unur_string *output, const char *symb, double number ) + /*----------------------------------------------------------------------*/ + /* Print string or number into output string. */ + /* The number is only printed if symb is the NULL pointer. */ + /* */ + /* parameters: */ + /* output ... pointer to string for output */ + /* symb ... string to be printed */ + /* number ... constant to be printed */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + if (symb) + /* copy symbol into string */ + _unur_string_appendtext( output, symb ); + else + /* copy number symbol into output */ + _unur_string_append( output, "%.16g", number); + + return UNUR_SUCCESS; +} /* end of _unur_fstr_print() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/parser/functparser_struct.h b/vendor/unuran-1.11.0/src/parser/functparser_struct.h new file mode 100644 index 0000000..c9cad9a --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/functparser_struct.h @@ -0,0 +1,53 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: functparser_struct.h * + * * + * PURPOSE: * + * declares structures for function parser * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Structure for function tree */ + +struct ftreenode { + char *symbol; /* name of token */ + int token; /* location of token in list of symbols */ + int type; /* type of token (e.g. S_ADD_OP) */ + double val; /* value of constant or (and) + value of node during evalution of tree */ + struct ftreenode *left; /* pointer to left branch/leave of node */ + struct ftreenode *right; /* pointer to right branch/leave of node */ + +#ifdef UNUR_COOKIES + unsigned cookie; /* magic cookie */ +#endif +}; + + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/parser/functparser_symbols.h b/vendor/unuran-1.11.0/src/parser/functparser_symbols.h new file mode 100644 index 0000000..c498888 --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/functparser_symbols.h @@ -0,0 +1,431 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: functparser_symbols.c * + * * + * Table of known symbols for function parser * + * * + * Parser function string, evaluate function, print programm code. * + * * + * DESCRIPTION: * + * Given a string for a function. * + * The string is parser. * + * A tree representing the function term is generated. * + * A tree for the derivative of the function is generated. * + * The tree is used to evalute the corresponding function for an x. * + * The source code for a program is produced. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* + #define one of the two marcos 'PARSER' or 'CODEGEN' before #including + this header file: + + 'PARSER' ... for parsing and evalution of function string + 'CODEGEN' ... for the code generating routines + + These two macros should be #undef-ined after this file has been #included! +*/ + +/* #define PARSER */ +/* #define CODEGEN */ + +#if defined(PARSER) && defined(CODEGEN) +# error \ + You have to #define either 'PARSER' or 'CODEGEN' before including this header file! +#endif + +#if !defined(PARSER) && !defined(CODEGEN) +# error \ + You have to #define either 'PARSER' or 'CODEGEN' before including this header file! +#endif + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Routines for evaluating nodes of the function tree **/ +/*****************************************************************************/ + +#ifdef PARSER +static double v_dummy (double l, double r); +static double v_less (double l, double r); +static double v_equal (double l, double r); +static double v_greater(double l, double r); +static double v_less_or(double l, double r); +static double v_unequal(double l, double r); +static double v_grtr_or(double l, double r); +static double v_plus (double l, double r); +static double v_minus (double l, double r); +static double v_mul (double l, double r); +static double v_div (double l, double r); +static double v_mod (double l, double r); +static double v_power (double l, double r); +static double v_const (double l, double r); +static double v_exp (double l, double r); +static double v_log (double l, double r); +static double v_sin (double l, double r); +static double v_cos (double l, double r); +static double v_tan (double l, double r); +static double v_sec (double l, double r); +static double v_sqrt (double l, double r); +static double v_abs (double l, double r); +static double v_sgn (double l, double r); +#endif + +/*****************************************************************************/ +/** Routines for computing derivatives **/ +/*****************************************************************************/ + +#ifdef PARSER +static struct ftreenode *d_error ( const struct ftreenode *node, int *error ); +static struct ftreenode *d_const ( const struct ftreenode *node, int *error ); +static struct ftreenode *d_var ( const struct ftreenode *node, int *error ); +static struct ftreenode *d_add ( const struct ftreenode *node, int *error ); +static struct ftreenode *d_mul ( const struct ftreenode *node, int *error ); +static struct ftreenode *d_div ( const struct ftreenode *node, int *error ); +static struct ftreenode *d_power ( const struct ftreenode *node, int *error ); +static struct ftreenode *d_exp ( const struct ftreenode *node, int *error ); +static struct ftreenode *d_log ( const struct ftreenode *node, int *error ); +static struct ftreenode *d_sin ( const struct ftreenode *node, int *error ); +static struct ftreenode *d_cos ( const struct ftreenode *node, int *error ); +static struct ftreenode *d_tan ( const struct ftreenode *node, int *error ); +static struct ftreenode *d_sec ( const struct ftreenode *node, int *error ); +static struct ftreenode *d_sqrt ( const struct ftreenode *node, int *error ); +static struct ftreenode *d_abs ( const struct ftreenode *node, int *error ); +#endif + + +/*****************************************************************************/ +/** Routines for printing C code **/ +/*****************************************************************************/ +#ifdef CODEGEN + +/* error */ +static unsigned C_error ( struct unur_string *output, const struct ftreenode *node, const char *variable ); + +/* constants and variables */ +static unsigned C_const ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned C_var ( struct unur_string *output, const struct ftreenode *node, const char *variable ); + +/* prefix operators (functions) (eg. exp(x)) */ +static unsigned C_prefix_generic ( struct unur_string *output, const struct ftreenode *node, + const char *variable, const char *symbol ); +/* operators where C routine is the same as parser name */ +static unsigned C_prefix ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +/* special operators */ +static unsigned C_power ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned C_sec ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned C_abs ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned C_sgn ( struct unur_string *output, const struct ftreenode *node, const char *variable ); + +/* infix (binary) operators (eg. x + y) */ +static unsigned C_infix_generic ( struct unur_string *output, const struct ftreenode *node, + const char *variable, const char *symbol ); +/* operators where C routine is the same as parser name */ +static unsigned C_infix ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +/* special operators */ +static unsigned C_equal ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned C_unequal( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned C_minus ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned C_mod ( struct unur_string *output, const struct ftreenode *node, const char *variable ); + +#endif + +/*****************************************************************************/ +/** Routines for printing FORTRAN code **/ +/*****************************************************************************/ +#ifdef CODEGEN + +/* error */ +static unsigned F_error ( struct unur_string *output, const struct ftreenode *node, const char *variable ); + +/* constants and variables */ +static unsigned F_const ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned F_var ( struct unur_string *output, const struct ftreenode *node, const char *variable ); + +/* prefix operators (functions) (eg. exp(x)) */ +static unsigned F_prefix_generic ( struct unur_string *output, const struct ftreenode *node, + const char *variable, const char *symbol ); +/* operators where C routine is the same as parser name */ +static unsigned F_prefix ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +/* relation operators */ +static unsigned F_lt ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned F_le ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned F_gt ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned F_ge ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned F_eq ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned F_ne ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +/* special operators */ +static unsigned F_sec ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned F_sgn ( struct unur_string *output, const struct ftreenode *node, const char *variable ); + +/* infix (binary) operators (eg. x + y) */ +static unsigned F_infix_generic ( struct unur_string *output, const struct ftreenode *node, + const char *variable, const char *symbol ); +/* operators where FORTRAN routine is the same as parser name */ +static unsigned F_infix ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +/* special operators */ +static unsigned F_minus ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned F_power ( struct unur_string *output, const struct ftreenode *node, const char *variable ); + +/* static unsigned F_equal ( struct unur_string *output, const struct ftreenode *node, const char *variable ); */ +/* static unsigned F_unequal( struct unur_string *output, const struct ftreenode *node, const char *variable ); */ + +#endif + +/*****************************************************************************/ +/** Routines for printing JAVA code **/ +/*****************************************************************************/ +#ifdef CODEGEN + +/* error */ +static unsigned J_error ( struct unur_string *output, const struct ftreenode *node, const char *variable ); + +/* constants and variables */ +static unsigned J_const ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned J_var ( struct unur_string *output, const struct ftreenode *node, const char *variable ); + +/* prefix operators (functions) (eg. exp(x)) */ +static unsigned J_prefix_generic ( struct unur_string *output, const struct ftreenode *node, + const char *variable, const char *symbol ); +/* operators where C routine is the same as parser name */ +static unsigned J_prefix ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +/* relation operators */ +static unsigned J_lt ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned J_le ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned J_gt ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned J_ge ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned J_eq ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned J_ne ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +/* special operators */ +static unsigned J_power ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned J_sec ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned J_sgn ( struct unur_string *output, const struct ftreenode *node, const char *variable ); + +/* infix (binary) operators (eg. x + y) */ +static unsigned J_infix_generic ( struct unur_string *output, const struct ftreenode *node, + const char *variable, const char *symbol ); +/* operators where C routine is the same as parser name */ +static unsigned J_infix ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +/* special operators */ +static unsigned J_minus ( struct unur_string *output, const struct ftreenode *node, const char *variable ); +static unsigned J_mod ( struct unur_string *output, const struct ftreenode *node, const char *variable ); + +#endif + +/*****************************************************************************/ +/** List of known symbols **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Symbol types for tokens */ + +enum { + S_NOSYMBOL = 0, /* token is not a symbol / is unknown */ + S_SFUNCT, /* system function */ + S_SCONST, /* system constant */ + S_UIDENT, /* user defined identifier (variable) */ + S_UFUNCT, /* user defined function */ + S_UCONST, /* user defined constant */ + S_REL_OP, /* relation operator */ + S_ADD_OP, /* addition operator */ + S_MUL_OP, /* multiplication operator */ + S_HPR_OP, /* higher priority operator */ + S_OTHERS /* other operator */ +}; + +/* IMPORTANT: symbol types S_ADD_OP, S_MUL_OP and S_HPR_OP indicate */ +/* priorities of the corresponding operators. */ + +/*---------------------------------------------------------------------------*/ +/* structure for storing known symbols */ + +#define SYMBLENGTH 10 /* Maximum length for symbols */ + +/* structure for storing known symbols */ +struct symbols { + char name[SYMBLENGTH]; /* name of symbols (e.g. "sin") */ + +#ifdef PARSER + int type; /* type of symbol */ + int info; /* priority or + number of argument for system function */ + double val; /* value of constant (0. otherwise) */ + + double (*vcalc)(double l, double r); + /* function for computing value of node */ + struct ftreenode *(*dcalc)(const struct ftreenode *node, int *error); + /* function for computing derivate */ +#endif + +#ifdef CODEGEN + unsigned (*node2C)(struct unur_string *output, const struct ftreenode *node, const char *variable ); + /* function for printing C code */ + unsigned (*node2F)(struct unur_string *output, const struct ftreenode *node, const char *variable ); + /* function for printing FORTRAN code */ + unsigned (*node2J)(struct unur_string *output, const struct ftreenode *node, const char *variable ); + /* function for printing JAVA code */ +#endif +}; + +/*---------------------------------------------------------------------------*/ +/* List of known symbols */ + +/* IMPORTANT: Symbols that do NOT start with a digit, a letter or `.' */ +/* must not have more than ONE single character. */ +/* The only exception are relation operators. */ +/* */ +/* IMPORTANT: symbol types S_ADD_OP, S_MUL_OP and S_HPR_OP indicate */ +/* priorities of the corresponding operators. */ +/* */ +/* In the current implementation system function must not have more than */ +/* two arguments. */ +/* */ +/* Constant should have highest priority to avoid enclosing parenthesis */ +/* in string output. */ +/* */ +/* The first entry in the list must be empty! */ +/* */ +/* There must be FOUR markers in the list (in this ordering!): */ +/* _ROS ... start of relation operators */ +/* _NAS ... start of non-alphanumeric symbols (single characters!) */ +/* _ANS ... start of alphanumeric symbols (constants and functions) */ +/* _END ... end of list */ +/* */ + +/* entries needed for parsing and evaluation of terms */ +#ifdef PARSER +# define S(name,type,priority,value,funct,deriv) \ + name,type,priority,value,funct,deriv +#else +# define S(name,type,priority,value,funct,deriv) \ + name, +#endif + +/* code generating functings */ +#ifdef CODEGEN +# define CG(cc,fortran,java) cc,fortran,java +#else +# define CG(cc,fortran,java) +#endif + +static struct symbols symbol[] = { + /* symbol, priority, evaluation routine, C function, Java function */ + /* type, value, derivative F function, */ + + /* void */ + {S ("" , S_NOSYMBOL, 0, 0.0 , v_dummy , d_error) CG (C_error , F_error , J_error )}, + + /* user defined symbols: */ + /* constant */ + {S ("UCONST",S_UCONST , 9, 0.0 , v_const , d_const) CG (C_const , F_const , J_const )}, + /* function */ + {S ("UFUNCT",S_UFUNCT , 0, 0.0 , v_dummy , d_error) CG (C_error , F_error , J_error )}, + /* variable */ + {S ("VAR" , S_UIDENT , 9, 0.0 , v_dummy , d_var ) CG (C_var , F_var , J_var )}, + + /* marker for relation operators */ + {S ("_ROS", S_NOSYMBOL, 0, 0.0 , v_dummy , d_error) CG (C_error , F_error , J_error )}, + + /* relation operators */ + {S ("<" , S_REL_OP , 1, 0.0 , v_less , d_const) CG (C_infix , F_lt , J_lt )}, + {S ("=" , S_REL_OP , 1, 0.0 , v_equal , d_const) CG (C_equal , F_eq , J_eq )}, + {S ("==" , S_REL_OP , 1, 0.0 , v_equal , d_const) CG (C_equal , F_eq , J_eq )}, + {S (">" , S_REL_OP , 1, 0.0 , v_greater, d_const) CG (C_infix , F_gt , J_gt )}, + {S ("<=" , S_REL_OP , 1, 0.0 , v_less_or, d_const) CG (C_infix , F_le , J_le )}, + {S ("<>" , S_REL_OP , 1, 0.0 , v_unequal, d_const) CG (C_unequal, F_ne , J_ne )}, + {S ("!=" , S_REL_OP , 1, 0.0 , v_unequal, d_const) CG (C_unequal, F_ne , J_ne )}, + {S (">=" , S_REL_OP , 1, 0.0 , v_grtr_or, d_const) CG (C_infix , F_ge , J_ge )}, + + /* marker for non-alphanumeric symbols */ + {S ("_NAS", S_NOSYMBOL, 0, 0.0 , v_dummy , d_error) CG (C_error , F_error , J_error )}, + + /* special symbols */ + {S ("(" , S_OTHERS , 0, 0.0 , v_dummy , d_error) CG (C_error , F_error , J_error )}, + {S (")" , S_OTHERS , 0, 0.0 , v_dummy , d_error) CG (C_error , F_error , J_error )}, + {S ("," , S_OTHERS , 0, 0.0 , v_dummy , d_error) CG (C_error , F_error , J_error )}, + + /* arithmetic operators */ + {S ("+" , S_ADD_OP , 2, 0.0 , v_plus , d_add ) CG (C_infix , F_infix , J_infix )}, + {S ("-" , S_ADD_OP , 2, 0.0 , v_minus , d_add ) CG (C_minus , F_minus , J_minus )}, + {S ("*" , S_MUL_OP , 4, 0.0 , v_mul , d_mul ) CG (C_infix , F_infix , J_infix )}, + {S ("/" , S_MUL_OP , 4, 0.0 , v_div , d_div ) CG (C_infix , F_infix , J_infix )}, + {S ("^" , S_HPR_OP , 5, 0.0 , v_power , d_power) CG (C_power , F_power , J_power )}, + + /* marker for alphanumeric symbols */ + {S ("_ANS", S_NOSYMBOL, 0, 0.0 , v_dummy , d_error) CG (C_error , F_error , J_error )}, + + /* logical operators: removed */ + + /* system constants */ + {S ("pi" , S_SCONST , 9, M_PI, v_const , d_const) CG (C_const , F_const , J_const )}, + {S ("e" , S_SCONST , 9, M_E , v_const , d_const) CG (C_const , F_const , J_const )}, + + /* system functions */ + {S ("mod" , S_SFUNCT , 2, 0.0 , v_mod , d_const) CG (C_mod , F_prefix, J_mod )}, + {S ("exp" , S_SFUNCT , 1, 0.0 , v_exp , d_exp ) CG (C_prefix , F_prefix, J_prefix )}, + {S ("log" , S_SFUNCT , 1, 0.0 , v_log , d_log ) CG (C_prefix , F_prefix, J_prefix )}, + {S ("sin" , S_SFUNCT , 1, 0.0 , v_sin , d_sin ) CG (C_prefix , F_prefix, J_prefix )}, + {S ("cos" , S_SFUNCT , 1, 0.0 , v_cos , d_cos ) CG (C_prefix , F_prefix, J_prefix )}, + {S ("tan" , S_SFUNCT , 1, 0.0 , v_tan , d_tan ) CG (C_prefix , F_prefix, J_prefix )}, + {S ("sec" , S_SFUNCT , 1, 0.0 , v_sec , d_sec ) CG (C_sec , F_sec , J_sec )}, + {S ("sqrt", S_SFUNCT , 1, 0.0 , v_sqrt , d_sqrt ) CG (C_prefix , F_prefix, J_prefix )}, + {S ("abs" , S_SFUNCT , 1, 0.0 , v_abs , d_abs ) CG (C_abs , F_prefix, J_prefix )}, + {S ("sgn" , S_SFUNCT , 1, 0.0 , v_sgn , d_const) CG (C_sgn , F_sgn , J_sgn )}, + + /* marker for end-of-table */ + {S ("_END", S_NOSYMBOL, 0, 0.0 , v_dummy , d_error) CG (C_error , F_error , J_error )}, +}; + +#undef S +#undef GC + +/*---------------------------------------------------------------------------*/ + +#ifdef PARSER + +/* location of special symbols in table */ +/** DO NOT CHANGE THEIR POSITION IN TABLE **/ +static int s_uconst = 1; /* user defined constant */ +static int s_ufunct = 2; /* user defined function */ +static int s_uident = 3; /* user defined variable */ + +/* location of special symbols */ +static int s_comma, s_minus, s_plus, s_mul, s_div, s_power; + +/* Marker for different regions in symbol table */ +static int _ros_start, _ros_end; /* relation symbols */ +static int _nas_start, _nas_end; /* non-alphanumeric symbols */ +static int _ans_start, _ans_end; /* alphanumeric symbols */ +static int _end; /* end of list */ + +#endif + +/*---------------------------------------------------------------------------*/ +/* #undef PARSER */ +/* #undef CODEGEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/parser/make_stringparser.pl b/vendor/unuran-1.11.0/src/parser/make_stringparser.pl new file mode 100755 index 0000000..2663f13 --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/make_stringparser.pl @@ -0,0 +1,1085 @@ +#!/usr/bin/perl +############################################################################## +# # +# UNURAN -- Universal Non-Uniform Random number generator # +# # +############################################################################## +# # +# FILE: make_stringparser.pl # +# # +# Read all UNU.RAN header files and create switch tables for stringparser # +# and write doc file for keywords # +# # +############################################################################## +# # +# Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold # +# Department of Statistics and Mathematics, WU Wien, Austria # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the # +# Free Software Foundation, Inc., # +# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA # +# # +############################################################################## + +use strict; + +my $VERBOSE = 1; + +# ---------------------------------------------------------------------------- +# +# File: make_stringparser.pl +# +############################################################################## + +sub usage { + my $progname = $0; + $progname =~ s#^.*/##g; + + print STDERR < Cfile + + Generates a stringparser. A template file is read from STDIN. + It contains the auxilliary routines and the skeleton for the + string interpreter. The routine reads all relevant information + from the corresponding header files and inserts the different + cases. The output is written on STDOUT. + Additionally the list of all key words produced for the manual + texi format. + + Notice: The keyword _orderstatistics_ is not treated automatically + but entered manually into the template file and in this script! + +EOM + + exit; +} + +############################################################################## +# Supported Distribution types +# +my %SUPPORTED_DISTR_TYPES = + ( 'cont' => 1, + 'cemp' => 1, + 'discr' => 1, + '-x-all-x-' => 1 # set calls unur_distr_set_... for all types + ); + +# Unsupported types: +# corder, cvec, cvemp, matr + +# Commands substituted by string parser +my %SUBST_COMMANDS = + ( 'unur_distr_cont_set_pdfstr' => 'pdf', + 'unur_distr_cont_set_logpdfstr' => 'logpdf', + 'unur_distr_cont_set_cdfstr' => 'cdf', + 'unur_distr_cont_set_logcdfstr' => 'logcdf', + 'unur_distr_cont_set_hrstr' => 'hr', + 'unur_distr_discr_set_pmfstr' => 'pmf', + 'unur_distr_discr_set_cdfstr' => 'cdf' , + 'unur_distr_discr_set_logcdfstr' => 'logcdf' + ); + +# Methods ignored by string parser +my %IGNORED_METHODS = + ( 'cext' => 1, + 'dext' => 1, + 'mixt' => 1, + ); + +# Commands ignored by string parser +my %IGNORED_COMMANDS = + ( 'unur_distr_set_extobj' => 1, + 'unur_distr_cont_set_pdf' => 1, + 'unur_distr_cont_set_dpdf' => 1, + 'unur_distr_cont_set_logpdf' => 1, + 'unur_distr_cont_set_dlogpdf' => 1, + 'unur_distr_cont_set_cdf' => 1, + 'unur_distr_cont_set_logcdf' => 1, + 'unur_distr_cont_set_hr' => 1, + 'unur_distr_discr_set_pmf' => 1, + 'unur_distr_discr_set_cdf' => 1, + 'unur_distr_discr_set_logcdf' => 1, + 'unur_mixt_set_useinversion' => 1, + ); + +# distributions ignored by string parser +# (We cannot handle this distributions yet. Thus we will ignore them +# until we find some time to fix this.) +my %IGNORED_DISTRIBUTIONS = + ( 'multinormal' => 1, + 'multicauchy' => 1, + 'multiexponential' => 1, + 'multistudent' => 1, + 'copula' => 1, + 'correlation' => 1 + ); + +############################################################################## + +# ---------------------------------------------------------------- +# Directory with sources + +my $top_srcdir = $ENV{'srcdir'} ? $ENV{'srcdir'} : '.'; +$top_srcdir .= "/../.."; + +# ---------------------------------------------------------------- +# Load routines for reading data about PDF from UNU.RAN files + +require "$top_srcdir/scripts/read_PDF.pl"; + +# ---------------------------------------------------------------- +# doc files to be generated + +my $doc_dir = $ENV{'srcdir'} ? $ENV{'srcdir'} : '.'; + +my $doc_file = "$doc_dir/stringparser_doc.dh"; + +my $distr_doc_string; +my $method_doc_string; + +############################################################################## +# Get all header files in methods directory +# +my $methods_dir = "$top_srcdir/src/methods"; +opendir (METHDIR, "$methods_dir") or die "can't open directory $methods_dir"; +my @methods_h_files = grep {/[^\#].*[.]h$/ } readdir METHDIR; +closedir METHDIR; + +############################################################################## +# Get all header files in distr directory +# +my $distr_dir = "$top_srcdir/src/distr"; +opendir (DISTRDIR, "$distr_dir") or die "can't open directory $distr_dir"; +my @distr_h_files = grep {/[^\#].*[.]h$/ } readdir DISTRDIR; +closedir DISTRDIR; + +foreach my $h (@distr_h_files) { + print STDERR "'$h' "; +} +print STDERR "\n"; + +############################################################################## +# Global variables + +# Store unsupported, substituted and ignored set calls for output on screen +my $msg_unsupported; +my $msg_substituted; +my $msg_ignored; +my $msg_ignored_methods; + +############################################################################## +# Read template C file from STDIN and insert C code for string interpreter +# +while ( ){ + + unless (/^s*=INPUT\s*(\w*)/){ + print $_; + } + + else { + my $type = $1; # INPUT type + + if ( $type eq "list_of_distributions" ){ + print make_list_of_distributions(); + } + elsif ( $type eq "list_of_distr_sets" ){ + print make_list_of_distr_sets(); + } + elsif ( $type eq "list_of_methods" ){ + print make_list_of_methods(); + } + elsif ( $type eq "list_of_par_sets" ){ + print make_list_of_par_sets(); + } + else{ + die "Error: unknown qualifier after =INPUT: $type\n"; + } + } +} + +if ($msg_substituted) { + print STDERR "Substituted set commands:\n"; + print STDERR "$msg_substituted\n"; +} + +if ($msg_ignored) { + print STDERR "Ignored set commands:\n"; + print STDERR "$msg_ignored\n"; +} + +if ($msg_ignored_methods) { + print STDERR "Ignored methods:\n"; + print STDERR "$msg_ignored_methods\n"; +} + +if ($msg_unsupported) { + print STDERR "Unsupported set commands:\n"; + print STDERR "$msg_unsupported\n"; +} + +# Print documentation. +open DOC, ">$doc_file" or die "Cannot open file $doc_file for writing"; +print DOC + "/*\n", + "=NODE KeysDistr Keys for Distribution String\n", + "=UP StringDistr [10]\n\n", + "=DESCRIPTION\n\n", + $distr_doc_string, + "\n=EON\n*/\n"; +print DOC + "/*\n", + "=NODE KeysMethod Keys for Method String\n", + "=UP StringMethod [10]\n\n", + "=DESCRIPTION\n\n", + $method_doc_string, + "\n=EON\n*/\n"; +close DOC; + +############################################################################## +# +# The end +# +exit (0); + +############################################################################## + +############################################################################## +# # +# Subroutines # +# # +############################################################################## + +############################################################################## +# +# Make subroutine for getting parameter object for method +# +sub make_list_of_distributions { + + my $code; + + # List of distributions + # For description of data fields in this list see file `read_PDF.pl'. + my $DISTR = read_PDFdata( $top_srcdir ); + + # print info on screen + print STDERR "\nDistributions:\n" if $VERBOSE; + + # print docu + $distr_doc_string .= "List of standard distributions " + ."\@pxref{Stddist,,Standard distributions}\n\n"; + $distr_doc_string .= "\@itemize \@minus\n"; + + # make switch for first letter of distribution name + $code .= "\t switch (*distribution) {\n"; + + my $last_char; + + # Make list of all distributions + sub caseinsensitive { ("\L$a" cmp "\L$b") }; + foreach my $distr (sort caseinsensitive keys %{$DISTR}) { + + # check whether command should be ignored + if ($IGNORED_DISTRIBUTIONS{$distr}) { + # ignore this distribution + $msg_ignored .= " unur_distr_$distr()\n"; + next; + } + + print STDERR $distr," "; + + my $char = lc substr $distr,0,1; + + if ($char ne $last_char) { + $code .= "\t\t break;\n" if $last_char; + $code .= "\t case '$char':\n"; + $last_char = $char; + } + + # print code + $code .= "\t\t if ( !strcmp( distribution, \"\L$distr\") ) {\n"; + $code .= "\t\t\t distr = unur_distr_$distr (darray,n_darray);\n"; + $code .= "\t\t\t break;\n"; + $code .= "\t\t }\n"; + + # print docu + $distr_doc_string .= "\@item \@code{[distr =] $distr(\@dots{})} \@ \@ \@ \@ " + ." \@result{} \@pxref{$distr}\n"; + } + + # end of switch for first letter + $code .= "\t }\n\n"; + + # print docu + $distr_doc_string .= "\@end itemize\n\n"; + + print STDERR "\n\n"; + + # Make list of generic distribution objects + print STDERR "Generic distributions:\n"; + + # print docu + $distr_doc_string .= "List of generic distributions " + ."\@pxref{Distribution_objects,,Handling Distribution Objects}\n\n"; + $distr_doc_string .= "\@itemize \@minus\n"; + + $code .= "\t /* get pointer to generic distribution object */\n"; + $code .= "\t if (distr == (struct unur_distr *) &distr_unknown) { \n"; + $code .= "\t\t do {\n"; + + foreach my $hfile (sort @distr_h_files) { + # Read content of header file + open H, "< $distr_dir/$hfile" or die ("can't open file: $distr_dir/$hfile"); + my $content = ''; + while () { $content .= $_; } + close H; + # there must be a unur_distr_...._new call + next unless $content =~ /[^\n]\s*unur\_distr\_(\w+)\_new/; + # ID for method + my $distr_type = "\L$1"; + # not all generic distributions are supported yet + next unless $SUPPORTED_DISTR_TYPES{$distr_type}; + + # make code + print STDERR " \U$distr_type" if $VERBOSE; + $code .= "\t\t\t if ( !strcmp( distribution, \"$distr_type\") ) {\n"; + $code .= "\t\t\t\t distr = unur\_distr\_$distr_type\_new();\n"; + $code .= "\t\t\t\t break;\n"; + $code .= "\t\t\t }\n"; + + # print docu + $distr_doc_string .= "\@item \@code{[distr =] $distr_type} \@ \@ \@ \@ " + ." \@result{} \@pxref{\U$distr_type}\n"; + } + + $code .= "\t\t } while (0);\n"; + $code .= "\t }\n\n"; + + # print docu + $distr_doc_string .= "\@end itemize\n\n"; + + # add comment for order statistics ... + $distr_doc_string .= comment_for_corder(); + + # end + print STDERR "\n\n"; + + # Return result + return $code; + +} # end of make_list_of_distributions() + +############################################################################## +# +# Make subroutine for setting parameters in distribution objects +# +sub make_list_of_distr_sets { + + my $set_commands; + my $set_doc; + my $code_unsupported; + my $code_substituted; + my $code_ignored; + my $code; + + # print info on screen + print STDERR "Set commands for Distributions:\n" if $VERBOSE; + + # Read all header files + foreach my $hfile (sort @distr_h_files) { + + # Read content of header file + open H, "< $distr_dir/$hfile" or die ("can't open file: $distr_dir/$hfile"); + my $content = ''; + while () { $content .= $_; } + close H; + + # there must be a unur_distr_..._set call + next unless $content =~ /[^\n]\s*unur\_distr\_.*\_set\_/; + + # distribution type + my $distr_type; + if ($content =~ /[^\n]\s*unur\_distr\_(\w+)\_new/) { + # set calls for special distribution type + $distr_type = "\L$1"; + } + else { + # set calls for all distribution types + $distr_type = "-x-all-x-"; + } + + # not all generic distributions are supported yet + next unless $SUPPORTED_DISTR_TYPES{$distr_type}; + print STDERR " \U$distr_type: " if $VERBOSE; + + # remove obsolete functions + $content =~ s {/\*\s*=OBSOLETE.*$} []gsx; + + # Remove all comments and empty lines ... + $content =~ s {/\*.*?\*/} []gsx; + $content =~ s /\n\s*\n/\n/gsx; + + # Split into lines ... + my @lines = split /\n/, $content; + + # Get all set calls + foreach my $l (@lines) { + next unless $l =~ /^\s*(\w*\s+)unur\_distr\_($distr_type\_)?set_(\w+)\s*\((.+)([^\s])\s*$/; + + # short name of set command + my $command = $3; + + # full name of command + my $command_name = "unur\_distr\_".$2."set_$command"; + + # list of arguments + my $args = $4; + + # Check syntax of set command + if ( $5 ne ';' ) { + # last character must be a ';' + die "Unknown syntax (terminating ';' missing) in $hfile:\n$l\n"; + } + if ( $1 !~ /^int\s+$/ ) { + # type must be 'int' + die "Unknown syntax (function type) in $hfile:\n$l\n"; + } + if ( unmatched_parenthesis($l) ) { + # parenthesis must match + die "Unknown syntax (umatched parenthesis) in $hfile:\n$l\n"; + } + + # print name of parameter + print STDERR "$command " if $VERBOSE; + + # process list of args + $args =~ s/\)\s*$//; # remove closing parenthesis + my @args_list = split /\,/, $args; + + # first argument must be of type UNUR_DISTR + my $a = shift @args_list; + unless ($a =~ /UNUR_DISTR/) { + die "Unknown syntax (first argument not of type UNUR_DISTR) in $hfile:\n$l\n"; + } + + # number of arguments + my $n_args = $#args_list+1; + + # get type of arguments + my $type_args = ""; + foreach my $a (@args_list) { + my $t; + # type of argument + if ($a =~ /double/) { $t = 'd'; } + elsif ($a =~ /int/) { $t = 'i'; } + elsif ($a =~ /unsigned/) { $t = 'u'; } + elsif ($a =~ /char/) { $t = 'c'; } + else { $t = '?'; } + + # arrays are indicated by capital letters + if ($a =~ /\*/ or $a =~ /\[/) { + # this is interprated as list + $t = "\U$t"; + } + $type_args .= $t; + } + + # check whether command should be ignored + if ($IGNORED_COMMANDS{$command_name}) { + # ignore this set command + $code_ignored .= "\t /* $l\n\t\t n = $n_args; type = $type_args\t */\n"; + $msg_ignored .= " $command_name()\n"; + next; + } + + # make set calls + my $set; + my $doc; + + # beginning of case + $set = "\t\t\t\t /* n = $n_args; type = $type_args: $args*/\n"; + + # use keyword "void" when no argument is required + $type_args = "void" if $type_args eq ""; + + # we support the following cases: + # "i" ... one argument of type int required + # "ii" ... two arguments of type int required + # "d" ... one argument of type double required + # "dd" ... two arguments of type double required + # "Di" ... a list of doubles and one argument of type int required + # (the second argument is considered as size of the double array) + # "C" ... one string (array of char) + + my %type_args_doc = + ( 'i' => '[= @i{}]', + 'ii' => '= @i{}, @i{} | (@i{})', + 'd' => '= @i{}', + 'dd' => '= @i{}, @i{} | (@i{})', + 'Di' => '= (@i{}) [, @i{}]', + 'C' => '= "@i{}"' + ); + + if ($type_args =~ /^(i|ii|d|dd|Di|C)$/) { + my $type = $1; + $set .= "\t\t\t\t result = _unur_str_distr_set_$type(distr,key,type_args,args,$command_name);\n"; + unless ($set_commands->{$distr_type}->{$command}) { + $set_commands->{$distr_type}->{$command} = $set; } + else { + die "\nset command redefined: $distr_type/$command"; } + + # check whether command should also have substitute + if ($SUBST_COMMANDS{$command_name}) { + my $command_subst = $SUBST_COMMANDS{$command_name}; + $msg_substituted .= " $command_name() --> $SUBST_COMMANDS{$command_name}\n"; + $code_substituted .= "\t /* $l\n\t\t n = $n_args; type = $type_args\t */\n"; + unless ($set_commands->{$distr_type}->{$command_subst}) { + $set_commands->{$distr_type}->{$command_subst} = $set; } + else { + die "\nset command redefined: $distr_type/$command_subst"; } + } + + # make docu + if ($SUBST_COMMANDS{$command_name}) { + $command = $SUBST_COMMANDS{$command_name}; } + $set_doc->{$distr_type}->{$command} = + "\@item $command $type_args_doc{$type_args}\n \@result{} " + ."\@pxref{funct:$command_name,,\@command{$command_name}}\n"; + } + + else { + # cannot handle this set command + $code_unsupported .= "\t/* $l\n\t\t n = $n_args; type = $type_args\t */\n"; + $msg_unsupported .= " $command_name()\n"; + } + } + + # end of distribution type + print STDERR "\n" if $VERBOSE; + } + + # print info on screen + print STDERR "\n" if $VERBOSE; + + + # get list of all distribution types + my @distr_type_list = sort (keys %{$set_commands}); + + # print docu + $distr_doc_string .= "List of keys that are available via the String API.\n" + ."For description see the corresponding UNU.RAN set calls.\n\n"; + $distr_doc_string .= "\@itemize \@bullet\n"; + + # first distribution type MUST be -x-all-x- + my $dt = shift @distr_type_list; + unless ($dt eq "-x-all-x-") { + die "first distribution type MUST be '-x-all-x-'\n"; + } + # List of set calls for all distribution types + $distr_doc_string .= "\@item All distribution types\n"; + my $code_x_all_x_ = make_distr_set_calls($dt,$set_commands,$set_doc); + + # List of set calls for distribution types + # switch for distribution types + $code .= "\n\t switch (distr->type) {\n"; + foreach $dt (@distr_type_list) { + + # print docu + $distr_doc_string .= "\@item \@code{$dt} \@ \@i{(Distribution Type)}\@ \@ \@ \@ " + ."(\@pxref{\U$dt})\n"; + + # make label for distribution type + $code .= "\t case UNUR_DISTR_\U$dt:\n"; + + # make list of all set commands for distribution type + $code .= make_distr_set_calls($dt,$set_commands,$set_doc); + + # end of case for distribution type + $code .= "\t\t break;\n"; + } + # end of switch for distribution types + $code .= "\t }\n"; + + # append list for set calls for all distribution types + $code .= "\n\t /* set calls for all distribution types */\n"; + $code .= "\t if (result == UNUR_ERR_STR_UNKNOWN) {\n"; + $code .= $code_x_all_x_; + $code .= "\t }\n\n"; + + # print docu + $distr_doc_string .= "\@end itemize\n\n"; + + # add comment on igored and unsupported code into C file + if ($code_ignored) { + $code .= "\n\t /* Ignored set commands: */\n $code_ignored\n"; } + if ($code_substituted) { + $code .= "\n\t /* Subsituted set commands: */\n $code_substituted\n"; } + if ($code_unsupported) { + $code .= "\n\t /* Unsupported set commands: */\n $code_unsupported\n"; } + + # Return result + return $code; + +} # end of make_list_of_distr_sets() + +############################################################################## +# +# Make subroutine for getting parameter object for method. +# Print set command. +# +sub make_distr_set_calls { + my $dt = $_[0]; + my $set_commands = $_[1]; + my $set_doc = $_[2]; + + my $code; + + # make list of set commands for distributions + my @command_list = sort (keys %{$set_commands->{$dt}}); + + # make switch for first letter of key name + $code .= "\t\t switch (*key) {\n"; + + # print docu + $distr_doc_string .= "\@table \@code\n"; + + my $last_char; + + foreach my $c (@command_list) { + + my $char = substr $c,0,1; + + if ($char ne $last_char) { + $code .= "\t\t\t break;\n" if $last_char; + $code .= "\t\t case '$char':\n"; + $last_char = $char; + } + + $code .= "\t\t\t if ( !strcmp(key, \"$c\") ) {\n"; + $code .= $set_commands->{$dt}->{$c}; + $code .= "\t\t\t\t break;\n"; + $code .= "\t\t\t }\n"; + + # print docu + $distr_doc_string .= $set_doc->{$dt}->{$c}; + } + + # end of switch for first letter + $code .= "\t\t }\n"; + + + # add comment about order statistics + if ($dt eq "cont") { + $distr_doc_string .= comment_for_orderstatistics(); + } + + # end of table + $distr_doc_string .= "\@end table\n\n"; + + # Return result + return $code; + +} # end of make_distr_set_calls() + +############################################################################## +# +# Make subroutine for getting parameter object for method +# +sub make_list_of_methods { + + my $code; + + # Get list of all methods + my @method_list; + + # Read all header files + foreach my $hfile (sort @methods_h_files) { + + # Read content of header file + open H, "< $methods_dir/$hfile" or die ("can't open file: $methods_dir/$hfile"); + my $content = ''; + while () { $content .= $_; } + close H; + + # We skip over all header files that do not correspond + # to a method. + next unless $content =~ /[^\n]\s*=METHOD\s+(\w+)/; + + # save ID for method + push @method_list, "\L$1"; + } + + # sort list of methods + @method_list = sort @method_list; + + # make code + + # make switch for first letter of method name + $code .= "\t switch (*method) {\n"; + + my $last_char; + + foreach my $method (@method_list) { + + # check whether method should be ignored + if ($IGNORED_METHODS{$method}) { + # ignore this method + $msg_ignored_methods .= " unur_$method\_new()\n"; + next; + } + + my $char = substr $method,0,1; + + if ($char ne $last_char) { + $code .= "\t\t break;\n" if $last_char; + $code .= "\t case '$char':\n"; + $last_char = $char; + } + + # print code + $code .= "\t\t if ( !strcmp( method, \"$method\") ) {\n"; + $code .= "\t\t\t par = unur_$method\_new(distr);\n"; + $code .= "\t\t\t break;\n"; + $code .= "\t\t }\n"; + } + + # end of switch for first letter + $code .= "\t }\n"; + + # Return result + return $code; + +} # end of make_list_of_methods() + +############################################################################## +# +# Make subroutine for setting parameters in parameter objects +# +sub make_list_of_par_sets { + + my $set_commands; + my $set_doc; + my $code_unsupported; + my $code_substituted; + my $code_ignored; + my $code; + + # print info on screen + print STDERR "Set commands for Methods:\n" if $VERBOSE; + + # Read all header files + foreach my $hfile (sort @methods_h_files) { + + # Read content of header file + open H, "< $methods_dir/$hfile" or die ("can't open file: $methods_dir/$hfile"); + my $content = ''; + while () { $content .= $_; } + close H; + + # We skip over all header files that do not correspond + # to a method. + next unless $content =~ /[^\n]\s*=METHOD\s+(\w+)/; + + # ID for method + print STDERR " $1: " if $VERBOSE; + my $method = "\L$1"; + + # remove obsolete functions + $content =~ s {/\*\s*=OBSOLETE.*$} []gsx; + + # Remove all comments and empty lines ... + $content =~ s {/\*.*?\*/} []gsx; + $content =~ s /\n\s*\n/\n/gsx; + + # Split into lines ... + my @lines = split /\n/, $content; + + # Get all set calls + foreach my $l (@lines) { + next unless $l =~ /^\s*(\w*\s+)unur_$method\_set_(\w+)\s*\((.+)([^\s])\s*$/; + + # short name of set command + my $command = $2; + + # full name of command + my $command_name = "unur\_$method\_set_$command"; + + # list of arguments + my $args = $3; + + # Check syntax of set command + if ( $4 ne ';' ) { + # last character must be a ';' + die "Unknown syntax (terminating ';' missing) in $hfile:\n$l\n"; + } + if ( $1 !~ /^int\s+$/ ) { + # type must be 'int' + die "Unknown syntax (function type) in $hfile:\n$l\n"; + } + if ( unmatched_parenthesis($l) ) { + # parenthesis must match + die "Unknown syntax (umatched parenthesis) in $hfile:\n$l\n"; + } + + # print name of parameter + print STDERR "$command " if $VERBOSE; + + # process list of args + $args =~ s/\)\s*$//; # remove closing parenthesis + my @args_list = split /\,/, $args; + + # first argument must be of type UNUR_PAR + my $a = shift @args_list; + unless ($a =~ /UNUR_PAR/) { + die "Unknown syntax (first argument not of type UNUR_PAR) in $hfile:\n$l\n"; + } + + # number of arguments + my $n_args = $#args_list+1; + + # get type of arguments + my $type_args = ""; + foreach my $a (@args_list) { + my $t; + # type of argument + if ($a =~ /double/) { $t = 'd'; } + elsif ($a =~ /int/) { $t = 'i'; } + elsif ($a =~ /unsigned/) { $t = 'u'; } + elsif ($a =~ /char/) { $t = 'c'; } + else { $t = '?'; } + + # arrays are indicated by capital letters + if ($a =~ /\*/ or $a =~ /\[/) { + # this is interprated as list + $t = "\U$t"; + } + $type_args .= $t; + } + + # check whether command should be ignored + if ($IGNORED_COMMANDS{$command_name}) { + # ignore this set command + $code_ignored .= "\t /* $l\n\t\t n = $n_args; type = $type_args\t */\n"; + $msg_ignored .= " $command_name()\n"; + next; + } + # check whether method should be ignored + for my $m (keys %IGNORED_METHODS) { + if ($command_name =~ /^unur_$m/) { + # ignore this method + $msg_ignored .= " $command_name()\n"; + next; + } + } + + # make set calls + my $set; + + # beginning of case + $set = "\t\t\t\t /* n = $n_args; type = $type_args: $args*/\n"; + + # use keyword "void" when no argument is required + $type_args = "void" if $type_args eq ""; + + # we support the following cases: + # void ... no argument required + # "i" ... one argument of type int required + # "ii" ... two arguments of type int required + # "u" ... one argument of type unsigned required + # "d" ... one argument of type double required + # "dd" ... two arguments of type double required + # "iD" ... one argument of type int and a list of doubles required + # (the first argument is considered as size of the double array) + # "Di" ... a list of doubles and one argument of type int required + + my %type_args_doc = + ( 'void' => ' ', + 'i' => '[= @i{}]', + 'ii' => '= @i{}, @i{} | (@i{})', + 'u' => '= @i{}', + 'd' => '= @i{}', + 'dd' => '= @i{}, @i{} | (@i{})', + 'iD' => '= @i{} [, (@i{})] | (@i{})', + 'Di' => '= (@i{}), @i{}' + ); + + if ($type_args =~ /^(void|i|ii|u|d|dd|iD|Di)$/) { + my $type = $1; + if ($type_args =~ /^(iD|Di)$/) { + $set .= "\t\t\t\t result = _unur_str_par_set_$type(par,key,type_args,args,$command_name,mlist);\n"; } + else { + $set .= "\t\t\t\t result = _unur_str_par_set_$type(par,key,type_args,args,$command_name);\n"; } + unless ($set_commands->{$method}->{$command}) { + $set_commands->{$method}->{$command} = $set; } + else { + die "\nset command redefined: $method/$command"; } + + # check whether command should also have substitute + if ($SUBST_COMMANDS{$command_name}) { + my $command_subst = $SUBST_COMMANDS{$command_name}; + $msg_substituted .= " $command_name() --> $SUBST_COMMANDS{$command_name}\n"; + $code_substituted .= "\t /* $l\n\t\t n = $n_args; type = $type_args\t */\n"; + unless ($set_commands->{$method}->{$command_subst}) { + $set_commands->{$method}->{$command_subst} = $set; } + else { + die "\nset command redefined: $method/$command_subst"; } + } + + # make docu + if ($SUBST_COMMANDS{$command_name}) { + $command = $SUBST_COMMANDS{$command_name}; } + $set_doc->{$method}->{$command} = + "\@item $command $type_args_doc{$type_args}\n \@result{} " + ."\@pxref{funct:$command_name,,\@command{$command_name}}\n"; + } + + else { + # cannot handle this set command + $code_unsupported .= "\t /* $l\n\t\t n = $n_args; type = $type_args\t */\n"; + $msg_unsupported .= " $command_name()\n"; + } + } + + # end of method + print STDERR "\n" if $VERBOSE; + } + + # print info on screen + print STDERR "\n" if $VERBOSE; + + + # get list of all methods + my @method_list = sort (keys %{$set_commands}); + + # make switch for methods + $code .= "\t switch (par->method) {\n"; + + # print docu + $method_doc_string .= "List of methods and keys that are available via the String API.\n" + ."For description see the corresponding UNU.RAN set calls.\n\n"; + $method_doc_string .= "\@itemize \@bullet\n"; + + foreach my $m (@method_list) { + + # print docu + $method_doc_string .= "\@item \@code{method = $m} \@ \@ \@ \@ " + ." \@result{} \@command{unur\_$m\_new}\n" + ."(\@pxref{\U$m})\n"; + + # make list of set commands for method + my @command_list = sort (keys %{$set_commands->{$m}}); + + # make label for method + $code .= "\t case UNUR_METH_\U$m:\n"; + + # make switch for first letter of key name + $code .= "\t\t switch (*key) {\n"; + + # print docu + $method_doc_string .= "\@table \@code\n"; + + my $last_char; + foreach my $c (@command_list) { + + my $char = substr $c,0,1; + + if ($char ne $last_char) { + $code .= "\t\t\t break;\n" if $last_char; + $code .= "\t\t case '$char':\n"; + $last_char = $char; + } + + $code .= "\t\t\t if ( !strcmp(key, \"$c\") ) {\n"; + $code .= $set_commands->{$m}->{$c}; + $code .= "\t\t\t\t break;\n"; + $code .= "\t\t\t }\n"; + + # print docu + $method_doc_string .= $set_doc->{$m}->{$c}; +# $method_doc_string .= "\@item $c\n \@result{} " +# ."\@pxref{funct:unur\_$m\_set\_$c,,\@command{unur\_$m\_set\_$c}}\n"; + } + + # end of switch for first letter + $code .= "\t\t }\n"; + $code .= "\t\t break;\n"; + + # print docu + $method_doc_string .= "\@end table\n\n"; + } + + # end of switch for methods + $code .= "\t }\n"; + + # print docu + $method_doc_string .= "\@end itemize\n\n"; + + # add comment on igored and unsupported code into C file + if ($code_ignored) { + $code .= "\n\t /* Ignored set commands: */\n $code_ignored\n"; } + if ($code_substituted) { + $code .= "\n\t /* Subsituted set commands: */\n $code_substituted\n"; } + if ($code_unsupported) { + $code .= "\n\t /* Unsupported set commands: */\n $code_unsupported\n"; } + + # Return result + return $code; + +} # end of make_list_of_par_sets() + +############################################################################## +# +# Simple test for unmatched parenthesis. +# It returns the number of opening parenthesis `(' minus the number +# of closing parenthesis `)' in argument $_. +# +sub unmatched_parenthesis { + my $open = 0; # number of unmatched `(' + + ++$open while /\(/g; + --$open while /\)/g; + + return $open; +} # end of unmachted_parenthesis() + +############################################################################## +# +# Some auxiliary comments. +# + +sub comment_for_corder { + + return <}, \@i{} | (\@i{}) + Make order statistics for given distribution. The first parameter + gives the sample size, the second parameter its rank. + (see \@pxref{funct:unur_distr_corder_new,,\@command{unur_distr_corder_new}}) +EOS + +} # end if comment_for_orderstatistics() + +############################################################################## diff --git a/vendor/unuran-1.11.0/src/parser/parser.c b/vendor/unuran-1.11.0/src/parser/parser.c new file mode 100644 index 0000000..9660467 --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/parser.c @@ -0,0 +1,93 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: parser.c * + * * + * common routines for parsing strings. * + * * + ***************************************************************************** + * * + * REMARK: * + * The parser always uses the default debugging flag. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include "parser.h" +#include "parser_source.h" + +/*---------------------------------------------------------------------------*/ + +char * +_unur_parser_prepare_string( const char *str ) + /*----------------------------------------------------------------------*/ + /* Prepare string for processing: */ + /* Make a working copy of the string. */ + /* Remove all white spaces and convert to lower case letters. */ + /* Single quotes (') are substituted with double quotes (") */ + /* */ + /* parameters: */ + /* str ... pointer to string */ + /* */ + /* return: */ + /* pointer to working string. */ + /* */ + /* as a side effect, a new string is allocated. */ + /*----------------------------------------------------------------------*/ +{ + char *tmp, *ptr; + char *new; /* pointer to working copy of string */ + size_t len; /* length of string */ + + /* length of string */ + len = strlen(str)+1; + /* allocate memory for copy */ + new = _unur_xmalloc( len * sizeof(char) ); + /* copy memory */ + ptr = memcpy(new,str,len); + + /* copy characters but skip all white spaces */ + for (tmp = ptr; *tmp != '\0'; tmp++) + if ( !isspace(*tmp) ) { + *ptr = tolower(*tmp); + /* substitute ' with " */ + if (*ptr == '\'') *ptr = '"'; + ptr++; + } + + /* terminate string */ + *ptr = '\0'; + + /* return pointer to working copy */ + return new; + +} /* end of _unur_parser_prepare_string() */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/parser/parser.h b/vendor/unuran-1.11.0/src/parser/parser.h new file mode 100644 index 0000000..7ad955b --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/parser.h @@ -0,0 +1,416 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: parser.h * + * * + * PURPOSE: * + * function prototypes for parser * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/* + +=NODE StringAPI String Interface +=UP TOP [25] + +=DESCRIPTION + + The string interface (string API) provided by the + unur_str2gen() call is the easiest way to use UNU.RAN. This + function takes a character string as its argument. The string is + parsed and the information obtained is used to create a generator + object. It returns NULL if this fails, either due to a syntax + error, or due to invalid data. In both cases @code{unur_error} is + set to the corresponding error codes + (@pxref{Error_reporting,,Error reporting}). + Additionally there exists the call unur_str2distr() that only + produces a distribution object. + + Notice that the string interface does not implement all features of + the UNU.RAN library. For trickier tasks it might be necessary to use + the UNU.RAN calls. + + In @ref{Examples}, all examples are given using both the + UNU.RAN standard API and this convenient string API. + The corresponding programm codes are equivalent. + +=END + +*/ + +/*---------------------------------------------------------------------------*/ +/* Routines for user interface */ + +/* =ROUTINES */ + +UNUR_GEN *unur_str2gen( const char *string ); +/* + Get a generator object for the distribution, method and uniform + random number generator as described in the given @var{string}. + See @ref{StringSyntax,,Syntax of String Interface}, for details. +*/ + +UNUR_DISTR *unur_str2distr( const char *string ); +/* + Get a distribution object for the distribution described in + @var{string}. + See @ref{StringSyntax,,Syntax of String Interface}, + and @ref{StringDistr,,Distribution String}, + for details. However, only the block for the distribution object is + allowed. +*/ + +UNUR_GEN *unur_makegen_ssu( const char *distrstr, const char *methodstr, UNUR_URNG *urng ); +/* */ + +UNUR_GEN *unur_makegen_dsu( const UNUR_DISTR *distribution, const char *methodstr, UNUR_URNG *urng ); +/* + Make a generator object for the distribution, method and uniform + random number generator. The distribution can be given either as + string @var{distrstr} or as a distribution object @var{distr}. + The method must be given as a string @var{methodstr}. + For the syntax of these strings see + @ref{StringSyntax,,Syntax of String Interface}. + However, the @code{method} keyword is optional for these calls + and can be omitted. If @var{methodstr} is the empty (blank) string + or NULL method AUTO is used. + The uniform random number generator is optional. If + @var{urng} is NULL then the default uniform random number generator + is used. +*/ + +/* +=EON +*/ + +/*...........................................................................*/ + + +UNUR_PAR *_unur_str2par( const UNUR_DISTR *distribution, const char *method, struct unur_slist **mlist ); +/* + Get a parameter object for the given distribution object and for the + method described in @var{method}. + See @ref{StringSyntax,,Syntax of String Interface}, + and @ref{StringMethod,,Method String}, + for details. However, only the block for the method is allowed. + + @var{mlist} is used to store memory blocks that have been allocated + while parsing and making the parameter object. These blocks + should (must) be free using _unur_slist_free() after initializing + the generator object to avoid a memory leak. + + (Not part of manual!!) +*/ + +/*---------------------------------------------------------------------------*/ +/* + +=NODE StringSyntax Syntax of String Interface +=UP StringAPI [10] + +=DESCRIPTION + + The given string holds information about the requested distribution + and (optional) about the sampling method and the uniform random + number generator invoked. The interpretation of the string is not + case-sensitive, all white spaces are ignored. + + The string consists of up to three blocks, separated by ampersands + @code{&}. + + Each block consists of @code{=} pairs, separated by + semicolons @code{;}. + + The first key in each block is used to indicate each block. + We have three different blocks with the following (first) keys: + @table @code + @item distr + definition of the distribution + (@pxref{StringDistr,,Distribution String}). + + @item method + description of the transformation method + (@pxref{StringMethod,,Method String}). + + @item urng + uniform random number generation + (@pxref{StringURNG,,Uniform RNG String}). + @end table + + The @code{distr} block must be the very first block and is + obligatory. All the other blocks are optional and can be arranged + in arbitrary order. + + For details see the following description of each block. + + In the following example + + @example + distr = normal(3.,0.75); domain = (0,inf) & method = tdr; c = 0 + @end example + + @noindent + we have a distribution block for the truncated normal distribution + with mean 3 and standard deviation 0.75 on domain (0,infinity); + and block for choosing method TDR with parameter c set to 0. + + The @code{=} pairs that follow the first (initial) pair + in each block are used to set parameters. + The name of the parameter is given by the @code{} string. It is + deduced from the UNU.RAN set calls by taking the part after + @code{@dots{}_set_}. + The @code{} string holds the parameters to be + set, separated by commata @code{,}. + There are three types of parameters: + @table @emph + @item string @code{"@dots{}"} or @code{'@dots{}'} + i.e. any sequence of characters enclosed by double quotes + @code{"@dots{}"} or single quotes @code{'@dots{}'} + (there is no distinction between double quotes @code{"} and + single quotes @code{'}). + @item list @code{(@dots{},@dots{})} + i.e. list of @emph{numbers}, separated by commata @code{,}, + enclosed in parenthesis @code{(...)}. + @item number + a sequence of characters that is not enclosed by double quotes + @code{"@dots{}"}, single quotes @code{'@dots{}'}, + or parenthesis @code{(...)}. + It is interpreted as float or integer depending on the type of + the corresponding parameter. + @end table + The @code{} string (including the character @code{=}) can be + omitted when no argument is required. + + At the moment not all @command{set} calls are supported. + The syntax for the @code{} can be directly derived from the + corresponding @command{set} calls. To simplify the syntax additional + shortcuts are possible. The following table lists the parameters for + the @code{set} calls that are supported by the string interface; the + entry in parenthesis gives the type of the argument as + @code{} string: + + @table @code + @item int @i{(number)}: + The @i{number} is interpreted as an integer. + @code{true} and @code{on} are transformed to @code{1}, + @code{false} and @code{off} are transformed to @code{0}. + A missing argument is interpreted as @code{1}. + + @item int, int @i{(number, number} @r{or} @i{list)}: + The two numbers or the first two entries in the list are + interpreted as a integers. + @code{inf} and @code{-inf} are transformed to @code{INT_MAX} and + @code{INT_MIN} respectively, i.e. the largest and smallest + integers that can be represented by the computer. + + @item unsigned @i{(number)}: + The @i{number} is interpreted as an unsigned hexadecimal + integer. + + @item double @i{(number)}: + The number is interpreted as a floating point number. + @code{inf} is transformed to @code{UNUR_INFINITY}. + + @item double, double @i{(number, number} @r{or} @i{list)}: + The two numbers or the first two entries in the list are + interpreted as a floating point numbers. + @code{inf} is transformed to @code{UNUR_INFINITY}. However using + @code{inf} in the list might not work for all versions of C. Then it + is recommended to use two single numbers instead of a list. + + @item int, double* @i{([number,] list} @r{or} @i{number)}: + @itemize @minus + @item + The list is interpreted as a double array. + The (first) number as its length. + If it is less than the actual size of the array only the + first entries of the array are used. + @item + If only the list is given (i.e., if the first number is omitted), + the first number is set to the actual size of the array. + @item + If only the number is given (i.e., if the list is omitted), the NULL + pointer is used instead an array as argument. + @end itemize + + @item double*, int @i{(list [,number])}: + The list is interpreted as a double array. + The (second) number as its length. + If the length is omitted, it is replaced by the actual size of the + array. (Only in the @code{distribution} block!) + + @item char* @i{(string)}: + The character string is passed as is to the corresponding set + call. + + @end table + + Notice that missing entries in a list of numbers are interpreted as + @code{0}. E.g, a the list @code{(1,,3)} is read as @code{(1,0,3)}, the + list @code{(1,2,)} as @code{(1,2,0)}. + + The the list of @code{key} strings in + @ref{KeysDistr,,Keys for Distribution String}, and + @ref{KeysMethod,,Keys for Method String}, for further details. + +=EON */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* + +=NODEX StringDistr Distribution String +=UP StringAPI [20] + +=DESCRIPTION + + The @code{distr} block must be the very first block and is + obligatory. For that reason the keyword @code{distr} is optional and + can be omitted (together with the @code{=} character). + Moreover it is ignored while parsing the string. However, to + avoid some possible confusion it has to start with the + letter @code{d} (if it is given at all). + + The value of the @code{distr} key is used to get the distribution + object, either via a @command{unur_distr_} call for a standard + distribution via a @command{unur_distr__new} call to get an + object of a generic distribution. + However not all generic distributions are supported yet. + + The parameters for the standard distribution are given + as a list. There must not be any character (other than white space) + between the name of the standard distribution and the opening + parenthesis @code{(} of this list. E.g., to get a beta distribution, + use + + @example + distr = beta(2,4) + @end example + + To get an object for a discrete distribution with probability + vector (0.5,0.2,0.3), use + + @example + distr = discr; pv = (0.5,0.2,0.3) + @end example + + It is also possible to set a PDF, PMF, or CDF using a string. + E.g., to create a continuous distribution with PDF proportional to + @code{exp(-sqrt(2+(x-1)^2) + (x-1))} and domain (0,inf) use + + @example + distr = cont; pdf = "exp(-sqrt(2+(x-1)^2) + (x-1))" + @end example + + @noindent + Notice: If this string is used in an unur_str2distr() or + unur_str2gen() call the double quotes @code{"} must be protected by + @code{\"}. Alternatively, single quotes may be used instead + + @example + distr = cont; pdf = 'exp(-sqrt(2+(x-1)^2) + (x-1))' + @end example + + For the details of function strings see + @ref{StringFunct,,Function String}. + +=EON +*/ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* + +=NODEX StringMethod Method String +=UP StringAPI [30] + +=DESCRIPTION + + The key @code{method} is obligatory, it must be the first key and its + value is the name of a method suitable for the choosen standard + distribution. E.g., if method AROU is chosen, use + + @example + method = arou + @end example + + Of course the all following keys dependend on the method choosen at + first. All corresponding @command{set} calls of UNU.RAN are available + and the key is the string after the @command{unur__set_} + part of the command. E.g., UNU.RAN provides the command + @command{unur_arou_set_max_sqhratio} to set a parameter of method AROU. + To call this function via the string-interface, the + key @code{max_sqhratio} can be used: + + @example + max_sqhratio = 0.9 + @end example + + @noindent + Additionally the keyword @code{debug} can be used to set debugging + flags (see @ref{Debug,,Debugging}, for details). + + If this block is omitted, a suitable default method is used. Notice + however that the default method may change in future versions of + UNU.RAN. + +=EON +*/ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* + +=NODEX StringURNG Uniform RNG String +=UP StringAPI [40] + +=DESCRIPTION + + The value of the @code{urng} key is passed to the PRNG interface (see + @ifinfo + @xref{Top,,Overview,prng,PRNG Manual}. + @end ifinfo + @ifnotinfo + @uref{http://statmath.wu.ac.at/prng/manual/,PRNG manual} + @end ifnotinfo + for details). + However it only works when using the PRNG library is enabled, + see @ref{Installation} for details. There are no other keys. + + IMPORTANT: UNU.RAN creates a new uniform random number generator for + the generator object. The pointer to this uniform generator + has to be read and saved via a unur_get_urng() call in order to + clear the memory @emph{before} the UNU.RAN generator object is + destroyed. + + If this block is omitted the UNU.RAN default generator is used + (which @emph{must not} be destroyed). + +=EON +*/ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/parser/parser_source.h b/vendor/unuran-1.11.0/src/parser/parser_source.h new file mode 100644 index 0000000..7bf3dd0 --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/parser_source.h @@ -0,0 +1,50 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: parser_source.h * + * * + * PURPOSE: * + * function prototypes for parser * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +char *_unur_parser_prepare_string( const char *str ); +/*---------------------------------------------------------------------------*/ +/* Prepare string for processing: */ +/* Make a working copy of the str, remove all white spaces and convert to */ +/* lower case letters. */ +/* The string returned by this call should be freed when it is not required */ +/* any more. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ + + + + + diff --git a/vendor/unuran-1.11.0/src/parser/stringparser.c b/vendor/unuran-1.11.0/src/parser/stringparser.c new file mode 100644 index 0000000..682213a --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/stringparser.c @@ -0,0 +1,2872 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: stringparser.c. * + * * + * * + * DESCRIPTION: * + * * + * The function unur_str2gen() takes a character string as its argument. * + * This string is parsed in the following ways and the information * + * obtained is used to make a generator object. (It returns NULL when * + * it is not possible to make a generator object either due to a syntax * + * error in the given string, or due to invalid data. * + * * + * First the given string is copied into a working string. Moreover letter * + * letters are transformed into their lower case counterparts and spaces * + * are eliminated (i.e. the working string does not contain any white * + * space characters any more.) Then the working string is splitted into * + * several blocks, separated by ampersands '&'. Each block consists of * + * = pairs, separated by semicolons ';'. The first key in * + * each block is used to indicate the corresponding block. * + * * + * We have three different blocks (yet): * + * distr ... contains the definition of the distribution * + * method ... contains the description of the transformation methdod * + * urng ... contains the definition of the uniform RNG * + * (currently it only supports URNGs from the PRNG library) * + * * + * The 'distr' block must be the very first block and is obligatory. * + * For that reason the keyword "distr" is optional and can be omitted * + * (together with the '=' character). Moreover it is almost ignored while * + * parsing the string. To avoid some possible confussion it only has to * + * start with the letter 'd' (if it is given at all). E.g. "dnormal" can * + * be used as keyword. * + * The value of the "distr" key is used to get a distribution object * + * either via a unur_distr_() call for a standard distribution * + * or the unur_distr__new() calls are used to get an object for a * + * generic distribution. However not all generic distributions are * + * supported yet (see the list %UNSUPPORTED_DISTR_TYPES in file * + * make_stringparser.pl). * + * The parameters for the standard distribution are given as a list of * + * numbers enclosed in parenthesis. There must not be any character (other * + * than white space) between the name of the standard distribution and * + * this list. * + * * + * All the other blocks are optional and can be arranged in arbitrary * + * order. * + * The value of the "method" key is the name of the transformation method * + * and is used to execute the unur__new() call. * + * * + * The value of the "urng" key is passed to the PRNG interface. * + * However, it only works when using the PRNG library is enabled * + * --with-urng-prng flag and libprng is linked by the executable. * + * * + * In each block consecuting = pairs, separated by semicolons * + * ';', are used to set parameters. The name of the parameter is given as * + * key, the argument list is given as value. The arguments of the * + * corresponding set calls are given as tokens, separated by commata ','. * + * There are two types of tokens: * + * single tokens, that represent numbers, and * + * list, i.e. a list of single tokens, separated by commata ',', * + * enclosed in parenthesis. * + * The value (including the character '=') can be omitted when no argument * + * are required. * + * The key is deduced from the UNU.RAN set calls, such that it uses only * + * the part of the set call beyond "..._set_". * + * Not all set commands are supported yet (see the output to STDERR of * + * the make_stringparser.pl script). * + * As a rule of thumb only those set calls are supported that only have * + * numbers or arrays of numbers as arguments (besides the pointer to the * + * distribution or parameter object). * + * (See the code of make_stringparser.pl for details.) * + * * + * There are additional transformations before executing the necessary * + * set calls (listed by argument types) * + * int: 'true' and 'on' are transformed to 1, * + * 'false' and 'off' are transformed to 0. * + * a missing argument is transformed to 1. * + * int, int: Instead of two integers, a list with at least two * + * numbers can be given. * + * 'inf[...]' is transformed to INT_MAX, * + * '-inf[...]' is transformed to INT_MIN. * + * unsigned: string is interpreted as hexadecimal number. * + * double: 'inf[...]' is transformed to UNUR_INFINITY, * + * '-inf[...]' is transformed to -UNUR_INFINITY. * + * double, double: Instead of two doubles, a list with at least two * + * numbers can be given. * + * 'inf[...]' is transformed to UNUR_INFINITY. * + * int, double*: If the first argument is missing, it is replaced * + * by the size of the array. * + * If the second argument is missing, the NULL pointer is * + * used instead an array as argument. * + * double*, int: Only for distributions! * + * If the second argument 'int' is missing, it is replaced * + * by the size of the array. * + * Important: there is no support for 'infinity' in lists! * + * (See also the source below for more details.) * + * * + ***************************************************************************** + * * + * REMARK: * + * The stringparser always uses the default debugging flag. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +#include +#include +#include +#include +#include +#include "parser_source.h" +#include "parser.h" + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(UNUR_URNG_UNURAN) && defined(UNURAN_HAS_PRNG) +#include +#endif + +/*---------------------------------------------------------------------------*/ +/* Variants: none */ + +/*---------------------------------------------------------------------------*/ +/* Debugging flags */ +/* bit 01 ... pameters and structure of generator (do not use here) */ +/* bits 02-12 ... setup */ +/* bits 13-24 ... adaptive steps */ +/* bits 25-32 ... trace sampling */ + +/*---------------------------------------------------------------------------*/ +/* Flags for logging set calls */ + +/*---------------------------------------------------------------------------*/ + +#define GENTYPE "STRING" /* (pseudo) type of generator */ + +/*---------------------------------------------------------------------------*/ + +static struct unur_distr *_unur_str_distr( char *str_distr ); +/*---------------------------------------------------------------------------*/ +/* get distribution object for given distribution. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_distr *_unur_str_distr_new( char *distribution ); +/*---------------------------------------------------------------------------*/ +/* get new distribution object. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_distr *_unur_str_distr_make_os( UNUR_DISTR *distr, + const char *key, + char *type_args, char **args ); +/*---------------------------------------------------------------------------*/ +/* Make distribution object for order statistics of given distribution. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_str_distr_set( UNUR_DISTR **ptr_distr, const char *key, char *value ); +/*---------------------------------------------------------------------------*/ +/* set parameters for distribution. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* Set parameter in given distribution object. */ +/*---------------------------------------------------------------------------*/ +typedef int distr_set_i( UNUR_DISTR *distr, int i ); +typedef int distr_set_ii( UNUR_DISTR *distr, int i1, int i2 ); +typedef int distr_set_d( UNUR_DISTR *distr, double d ); +typedef int distr_set_dd( UNUR_DISTR *distr, double d1, double d2 ); +typedef int distr_set_Di( UNUR_DISTR *distr, const double *array, int size ); +typedef int distr_set_C( UNUR_DISTR *distr, const char *string ); +/*---------------------------------------------------------------------------*/ +/* types of set calls */ +/*---------------------------------------------------------------------------*/ + +static int _unur_str_distr_set_i( UNUR_DISTR *distr, const char *key, char *type_args, char **args, + distr_set_i set ); +/*---------------------------------------------------------------------------*/ +/* integer. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_str_distr_set_ii( UNUR_DISTR *distr, const char *key, char *type_args, char **args, + distr_set_ii set ); +/*---------------------------------------------------------------------------*/ +/* 2 integers. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_str_distr_set_d( UNUR_DISTR *distr, const char *key, char *type_args, char **args, + distr_set_d set ); +/*---------------------------------------------------------------------------*/ +/* double. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_str_distr_set_dd( UNUR_DISTR *distr, const char *key, char *type_args, char **args, + distr_set_dd set ); +/*---------------------------------------------------------------------------*/ +/* 2 doubles. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_str_distr_set_Di( UNUR_DISTR *distr, const char *key, char *type_args, char **args, + distr_set_Di set ); +/*---------------------------------------------------------------------------*/ +/* array of doubles & integer. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_str_distr_set_C( UNUR_DISTR *distr, const char *key, char *type_args, char **args, + distr_set_C set ); +/*---------------------------------------------------------------------------*/ +/* constant string. */ +/*---------------------------------------------------------------------------*/ + + +static struct unur_par *_unur_str_par( char *str_method, const UNUR_DISTR *distr, + struct unur_slist *mlist ); +/*---------------------------------------------------------------------------*/ +/* get parameter object for distribution and method. */ +/*---------------------------------------------------------------------------*/ + +static struct unur_par *_unur_str_par_new( const char *method, const UNUR_DISTR *distr ); +/*---------------------------------------------------------------------------*/ +/* get new parameter object for method. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_str_par_set( UNUR_PAR *par, const char *key, char *value, + struct unur_slist *mlist ); +/*---------------------------------------------------------------------------*/ +/* set parameters for method. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* Set parameter in given parameter object. */ +/*---------------------------------------------------------------------------*/ +typedef int par_set_void( UNUR_PAR *par ); +typedef int par_set_i( UNUR_PAR *par, int i ); +typedef int par_set_ii( UNUR_PAR *par, int i1, int i2 ); +typedef int par_set_u( UNUR_PAR *par, unsigned u ); +typedef int par_set_d( UNUR_PAR *par, double d ); +typedef int par_set_dd( UNUR_PAR *par, double d1, double d2 ); +typedef int par_set_iD( UNUR_PAR *par, int size, const double *array ); +typedef int par_set_Di( UNUR_PAR *par, const double *array, int size ); +/*---------------------------------------------------------------------------*/ +/* types of set calls */ +/*---------------------------------------------------------------------------*/ + +static int _unur_str_par_set_void( UNUR_PAR *par, const char *key, char *type_args, char **args, + par_set_void set ); +/*---------------------------------------------------------------------------*/ +/* void (no argument required). */ +/*---------------------------------------------------------------------------*/ + +static int _unur_str_par_set_i( UNUR_PAR *par, const char *key, char *type_args, char **args, + par_set_i set ); +/*---------------------------------------------------------------------------*/ +/* integer. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_str_par_set_ii( UNUR_PAR *par, const char *key, char *type_args, char **args, + par_set_ii set ); +/*---------------------------------------------------------------------------*/ +/* 2 integers. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_str_par_set_u( UNUR_PAR *par, const char *key, char *type_args, char **args, + par_set_u set ); +/*---------------------------------------------------------------------------*/ +/* unsigned integer. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_str_par_set_d( UNUR_PAR *par, const char *key, char *type_args, char **args, + par_set_d set ); +/*---------------------------------------------------------------------------*/ +/* double. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_str_par_set_dd( UNUR_PAR *par, const char *key, char *type_args, char **args, + par_set_dd set ); + +/*---------------------------------------------------------------------------*/ +/* 2 doubles. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_str_par_set_iD( UNUR_PAR *par, const char *key, char *type_args, char **args, + par_set_iD set, struct unur_slist *mlist ); +/*---------------------------------------------------------------------------*/ +/* integer & array of doubles. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_str_par_set_Di( UNUR_PAR *par, const char *key, char *type_args, char **args, + par_set_Di set, struct unur_slist *mlist ); +/*---------------------------------------------------------------------------*/ +/* array of doubles & integer. */ +/*---------------------------------------------------------------------------*/ + + +static UNUR_URNG *_unur_str2urng( char *str_urng ); +/*---------------------------------------------------------------------------*/ +/* get uniform RNG. */ +/*---------------------------------------------------------------------------*/ + + +static int _unur_str_set_args( char *value, char *type_args, char **args, int max_args ); +/*---------------------------------------------------------------------------*/ +/* parse argument string for set call. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_parse_ilist( char *liststr, int **iarray ); +/*---------------------------------------------------------------------------*/ +/* Process a comma separated list of integers. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_parse_dlist( char *liststr, double **darray ); +/*---------------------------------------------------------------------------*/ +/* Process a comma separated list of numbers. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_atoi ( const char *str ); +/*---------------------------------------------------------------------------*/ +/* Convert string into its integer representation. */ +/*---------------------------------------------------------------------------*/ + +static unsigned _unur_atou ( const char *str ); +/*---------------------------------------------------------------------------*/ +/* Convert string into its unsigned representation (using hexadecimal). */ +/*---------------------------------------------------------------------------*/ + +static double _unur_atod ( const char *str ); +/*---------------------------------------------------------------------------*/ +/* Convert string into its double value. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ +/* the following functions print debugging information on output stream, */ +/* i.e., into the LOG file if not specified otherwise. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_str_debug_string( int level, const char *key, const char *value ); +/*---------------------------------------------------------------------------*/ +/* print key & value info into LOG file. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_str_debug_distr( int level, const char *name, double *params, int n_params ); +/*---------------------------------------------------------------------------*/ +/* write info about distribution into LOG file. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_str_debug_set( int level, const char *key, const char *type, ... ); + +/*---------------------------------------------------------------------------*/ +/* write info about set command into LOG file. */ +/*---------------------------------------------------------------------------*/ + +#endif +/*---------------------------------------------------------------------------*/ + + +static void _unur_str_error_unknown( const char *file, int line, const char *key, const char *type ); +/*---------------------------------------------------------------------------*/ +/* print error message: unknown keyword. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_str_error_invalid( const char *file, int line, const char *key, const char *type ); +/*---------------------------------------------------------------------------*/ +/* print error message: invalid data for keyword. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_str_error_args( const char *file, int line, const char *key ); +/*---------------------------------------------------------------------------*/ +/* print error message: invalid argument string for set call. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define _unur_error_unknown(key,what) \ + do { \ + _unur_str_error_unknown( __FILE__,__LINE__, (key), (what) ); \ + } while (0) + +/* invalid data for key */ +#define _unur_error_invalid(key,what) \ + do { \ + _unur_str_error_invalid( __FILE__,__LINE__, (key), (what) ); \ + } while (0) + +/* invalid argument string for set calls */ +#define _unur_error_args(key) \ + do { \ + _unur_str_error_args( __FILE__,__LINE__, (key) ); \ + } while (0) + + +/*---------------------------------------------------------------------------*/ +/* constants */ + +#define MAX_SET_ARGS (10) +/* maximal number of arguments for set calls (must be at least 2) */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Load lists of ..._new and ..._set calls **/ +/*****************************************************************************/ + +#include "stringparser_lists.ch" + +/*****************************************************************************/ +/** User Interface **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +unur_str2gen (const char *string) + /*----------------------------------------------------------------------*/ + /* get generator object for distribution and method */ + /* */ + /* parameters: */ + /* string ... string that contains description of generator */ + /* */ + /* return: */ + /* generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + UNUR_DISTR *distr = NULL; /* distribution object */ + UNUR_PAR *par = NULL; /* parameter object */ + UNUR_GEN *gen = NULL; /* generator object */ + UNUR_URNG *urng = NULL; /* uniform random number generator */ + + char *str_distr = NULL; /* string for distribution */ + char *str_method = NULL; /* string for method */ + char *str_urng = NULL; /* string for uniform RNG */ + + char *str = NULL; /* pointer to working string */ + char *token; + + struct unur_slist *mlist; /* list of allocated memory blocks */ + + /* check arguments */ + _unur_check_NULL( GENTYPE,string,NULL ); + + /* (empty) list of allocated memory blocks */ + mlist = _unur_slist_new(); + + /* Prepare string for processing: */ + /* Remove all white spaces, */ + /* convert to lower case letters, */ + /* copy into working string */ + str = _unur_parser_prepare_string( string ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag) + _unur_str_debug_string(0,"[input]",str); +#endif + + /* split string into blocks separated by ampersands '&' */ + + /* the first block must contain the distribution */ + str_distr = strtok(str, "&"); + + /* new get all the other tokens */ + for ( token = strtok(NULL, "&"); + token != NULL; + token = strtok(NULL, "&") ) { + + /* get type of block */ + if (!strncmp(token,"method=",(size_t)7)) { + str_method = token; + } + else if (!strncmp(token,"urng=",(size_t)5)) { + str_urng = token; + } + else { + _unur_error_unknown(token,"category"); + _unur_slist_free( mlist ); + if (str) free(str); + return NULL; + } + } + + /* make distribution object */ + distr = _unur_str_distr(str_distr); + if ( distr == NULL ) { + /* error */ + _unur_slist_free( mlist ); + if (str) free(str); + return NULL; + } + + /* get parameter object */ + if ( str_method != NULL ) + /* method is provided in string */ + par = _unur_str_par(str_method, distr, mlist); + else + /* otherwise use default method */ + par = unur_auto_new(distr); + + /* make generator object */ + gen = unur_init(par); + + /* destroy distribution object */ + unur_distr_free(distr); + + /* set uniform random number generator -- if provided */ + if ( str_urng != NULL ) + if (gen != NULL) { + /* we need a valid generator object */ + if ((urng = _unur_str2urng(str_urng)) != NULL ) + unur_chg_urng(gen, urng); + } + + /* free allocated memory blocks */ + _unur_slist_free(mlist); + if (str) free(str); + + /* check result: nothing to do */ + /* if ( gen == NULL ) { */ + /* error */ + /* return NULL; */ + /* } */ + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag) + _unur_str_debug_string(0,"",NULL); +#endif + + /* return pointer to generator object */ + return gen; + +} /* end of unur_str2gen() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_par * +_unur_str2par (const struct unur_distr *distr, const char *string, struct unur_slist **mlist ) + /*----------------------------------------------------------------------*/ + /* get parameter object for distribution and method */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* string ... string that contains description of method */ + /* mlist ... pointer to simple list for allocated memory blocks */ + /* */ + /* return: */ + /* parameter object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + UNUR_PAR *par = NULL; /* parameter object */ + char *str = NULL; /* pointer to working string */ + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + _unur_check_NULL( GENTYPE,string,NULL ); + + /* (empty) list of allocated memory blocks */ + *mlist = _unur_slist_new(); + + /* Prepare string for processing: */ + /* Remove all white spaces, */ + /* convert to lower case letters, */ + /* copy into working string */ + str = _unur_parser_prepare_string( string ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag) + _unur_str_debug_string(0,"[input]",str); +#endif + + /* get parameter object */ + par = _unur_str_par(str, distr, *mlist); + + /* free allocated memory blocks */ + if (str) free(str); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag) + if ( par != NULL ) + _unur_str_debug_string(0,"",NULL); +#endif + + /* return pointer to parameter object */ + return par; + +} /* end of _unur_str2par() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_str2distr (const char *string) + /*----------------------------------------------------------------------*/ + /* get distribution object for given distribution */ + /* */ + /* parameters: */ + /* string ... string that contains description of distribution */ + /* */ + /* return: */ + /* distribution object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + UNUR_DISTR *distr = NULL; /* distribution object */ + char *str = NULL; /* pointer to working string */ + + /* check arguments */ + _unur_check_NULL( GENTYPE,string,NULL ); + + /* Prepare string for processing: */ + /* Remove all white spaces, */ + /* convert to lower case letters, */ + /* copy into working string */ + str = _unur_parser_prepare_string( string ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag) + _unur_str_debug_string(0,"[input]",str); +#endif + + /* make distribution object */ + distr = _unur_str_distr(str); + + /* free allocated memory blocks */ + if (str) free(str); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag) + if ( distr != NULL ) + _unur_str_debug_string(0,"",NULL); +#endif + + /* return pointer to distribution object */ + return distr; + +} /* end of unur_str2distr() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +unur_makegen_ssu( const char *distrstr, const char *methodstr, UNUR_URNG *urng ) + /*----------------------------------------------------------------------*/ + /* get generator object for distribution and method */ + /* */ + /* parameters: */ + /* distrstr ... distribution described by a string */ + /* methodstr ... chosen method described by a string */ + /* urng ... pointer to uniform random number generator */ + /* (NULL = default generator) */ + /* */ + /* return: */ + /* generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + UNUR_DISTR *distr = NULL; /* distribution object */ + UNUR_PAR *par = NULL; /* parameter object */ + UNUR_GEN *gen = NULL; /* generator object */ + + char *str_distr = NULL; /* string for distribution */ + char *str_method = NULL; /* string for method */ + + struct unur_slist *mlist; /* list of allocated memory blocks */ + + /* check arguments */ + _unur_check_NULL( GENTYPE, distrstr, NULL ); + + /* (empty) list of allocated memory blocks */ + mlist = _unur_slist_new(); + + /* Prepare string for processing: */ + /* Remove all white spaces, */ + /* convert to lower case letters, */ + /* copy into working string */ + str_distr = _unur_parser_prepare_string( distrstr ); + str_method = (methodstr) + ? _unur_parser_prepare_string( methodstr ) + : NULL; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag) { + _unur_str_debug_string(0,"[input-distr]",str_distr); + _unur_str_debug_string(0,"[input-method]", + (str_method) ? str_method : "(NULL)" ); + } +#endif + + do { + /* make distribution object */ + distr = _unur_str_distr(str_distr); + if (distr == NULL) break; + + /* get parameter object */ + if ( str_method != NULL && strlen(str_method)>0 ) + /* method is provided in string */ + par = _unur_str_par(str_method, distr, mlist); + else + /* otherwise use default method */ + par = unur_auto_new(distr); + if (par == NULL) break; + + /* make generator object */ + gen = unur_init(par); + if (gen == NULL) break; + + /* set uniform RNG */ + if (urng != NULL) + unur_chg_urng(gen, urng); + + } while (0); + + /* destroy distribution object */ + unur_distr_free(distr); + + /* free allocated memory blocks */ + _unur_slist_free(mlist); + if (str_distr) free(str_distr); + if (str_method) free(str_method); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag) + _unur_str_debug_string(0,"",NULL); +#endif + + /* return pointer to generator object */ + return gen; + +} /* end of unur_makegen_ssu() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_gen * +unur_makegen_dsu( const struct unur_distr *distr, const char *methodstr, UNUR_URNG *urng ) + /*----------------------------------------------------------------------*/ + /* get generator object for distribution and method */ + /* */ + /* parameters: */ + /* distr ... distribution object */ + /* methodstr ... chosen method described by a string */ + /* urng ... pointer to uniform random number generator */ + /* (NULL = default generator) */ + /* */ + /* return: */ + /* generator object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + UNUR_PAR *par = NULL; /* parameter object */ + UNUR_GEN *gen = NULL; /* generator object */ + + char *str_method = NULL; /* string for method */ + + struct unur_slist *mlist; /* list of allocated memory blocks */ + + /* check arguments */ + _unur_check_NULL( GENTYPE,distr,NULL ); + + /* (empty) list of allocated memory blocks */ + mlist = _unur_slist_new(); + + /* Prepare string for processing: */ + /* Remove all white spaces, */ + /* convert to lower case letters, */ + /* copy into working string */ + str_method = (methodstr) + ? _unur_parser_prepare_string( methodstr ) + : NULL; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag) { + _unur_str_debug_string(0,"[input-distr]","(distribution object)"); + _unur_str_debug_string(0,"[input-method]", + (str_method) ? str_method : "(NULL)" ); + } +#endif + + do { + /* get parameter object */ + if ( str_method != NULL && strlen(str_method)>0 ) + /* method is provided in string */ + par = _unur_str_par(str_method, distr, mlist); + else + /* otherwise use default method */ + par = unur_auto_new(distr); + if (par == NULL) break; + + /* make generator object */ + gen = unur_init(par); + if (gen == NULL) break; + + /* set uniform RNG */ + if (urng != NULL) + unur_chg_urng(gen, urng); + + } while (0); + + /* free allocated memory blocks */ + _unur_slist_free(mlist); + if (str_method) free(str_method); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag) + _unur_str_debug_string(0,"",NULL); +#endif + + /* return pointer to generator object */ + return gen; + +} /* end of unur_makegen_dsu() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Distributions **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +_unur_str_distr( char *str_distr ) + /*----------------------------------------------------------------------*/ + /* get distribution object for given distribution */ + /* */ + /* parameters: */ + /* str_distr ... string that contains description of distribution */ + /* */ + /* return: */ + /* distribution object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_distr *distr = NULL; + + char *token; /* pointer to token in string */ + char *next; /* pointer to next token in string */ + char *key, *value; /* the key and its value */ + + + /* tokenize the string using ';' as separator and handle the tokens */ + for ( token = next = str_distr; + next != NULL && *token != '\0'; + token = next ) { + + /* find end of token (i.e. the pointer to next token) */ + next = strchr(token,';'); + if (next != NULL) { + /* next separator found */ + *next = '\0'; /* terminate token string */ + next++; /* set pointer to next token */ + } + + /* token points to a key */ + key = token; + + /* get the value from the pair key=value and terminate key string */ + value = strchr(key, '='); + if (value != NULL) { + *value = '\0'; /* terminate key string */ + value++; /* set pointer to value string */ + } + + /* the first key is treated differently: get new distribution object */ + if (key == str_distr) { + /* the keyword "distr" is optional */ + if (value == NULL) { + /* no "distribution" keyword given, so the key points to the value */ + value = key; + } + else { + if (*key != 'd') { + _unur_error(GENTYPE,UNUR_ERR_STR_SYNTAX,"key for distribution does not start with 'd'"); + _unur_distr_free(distr); /* remark: added for ROOT to make coverity integrity manager happy */ + return NULL; + } + } + + /* get new distribution object */ + if (distr != NULL) { + _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + _unur_distr_free(distr); + } + + distr = _unur_str_distr_new(value); + if (distr == NULL) { + /* error */ + /* _unur_error(GENTYPE,UNUR_ERR_STR,"setting distribution failed"); */ + return NULL; + } + } + + /* set parameters for distribution */ + else { + if (_unur_str_distr_set(&distr, key, value)!=UNUR_SUCCESS ) { + /* error */ + _unur_distr_free(distr); + /* _unur_error(GENTYPE,UNUR_ERR_STR,"setting distribution failed"); */ + return NULL; + } + } + } + + return distr; + +} /* end of _unur_str_distr() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +_unur_str_distr_make_os (UNUR_DISTR *distr, const char *key, char *type_args, char **args) + /*----------------------------------------------------------------------*/ + /* Make distribution object for order statistics of given distribution. */ + /* The given distribution `distr' is destroyed. */ + /* The list of arguments and their types are given as string. */ + /* */ + /* type: "ii" (int,int) */ + /* */ + /* input: "tt" (exactly two single tokens) */ + /* "L" (exactly one list) */ + /* */ + /* action: */ + /* if "tt": convert both to int. */ + /* execute set call. */ + /* if "L": convert list entries to int. */ + /* execute set call with first two entries. */ + /* (error if list has less than two entries) */ + /* otherwise: error */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* key ... name of parameter to be set */ + /* type_args ... contains types of arguments. Possible values: */ + /* 't' for single token */ + /* 'L' for a list */ + /* args ... array of pointers to argument strings */ + /* */ + /* return: */ + /* pointer to distribution object for order statistics */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + int *iarray = NULL; /* pointer to working array */ + struct unur_distr *os = NULL; /* pointer to order statistics object */ + + /* either exactly two arguments are given */ + if ( !strcmp(type_args, "tt") ) { + iarray = _unur_xmalloc( 2*sizeof(double) ); + iarray[0] = _unur_atoi( args[0] ); + iarray[1] = _unur_atoi( args[1] ); + } + + /* or one list with 2 entries is given */ + else if ( !strcmp(type_args, "L") ) { + if ( _unur_parse_ilist( args[0], &iarray ) < 2 ) { + free (iarray); + iarray = NULL; + } + } + + if (iarray == NULL ) { + /* data list empty (incorrect syntax) */ + _unur_error_args(key); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"!"); +#endif + return NULL; + } + + /* now make object to order statistics */ + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"ii",iarray[0],iarray[1] ); +#endif + + os = unur_distr_corder_new( distr, iarray[0], iarray[1] ); + + /* free memory */ + _unur_distr_free(distr); + free (iarray); + + /* return order statistics (or NULL we could not make such a thing) */ + return os; + +} /* end of _unur_str_distr_make_os() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_str_distr_set_i (UNUR_DISTR *distr, const char *key, char *type_args, char **args, distr_set_i set) + /*----------------------------------------------------------------------*/ + /* Set parameter in given distribution object. */ + /* The list of arguments and their types are given as string. */ + /* */ + /* type: "i" (int) */ + /* */ + /* input: "t" (exactly one single token) */ + /* void (no argument given) */ + /* */ + /* action: */ + /* convert token to int. */ + /* (if no argument is given, use 1.) */ + /* execute set call. */ + /* error if input != "t" */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* key ... name of parameter to be set */ + /* type_args ... contains types of arguments. Possible values: */ + /* 't' for single token */ + /* 'L' for a list */ + /* args ... array of pointers to argument strings */ + /* set ... pointer to UNU.RAN function for set call */ + /* */ + /* return: */ + /* return code from set call, i.e. */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int iarg; + + if ( !strcmp(type_args, "t") ) { + iarg = _unur_atoi( args[0] ); + } + else if ( strlen(type_args) == 0 ) { + iarg = 1; + } + else { + _unur_error_args(key); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"!"); +#endif + return UNUR_ERR_STR_INVALID; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"i",iarg); +#endif + + return set(distr,iarg); + +} /* end of _unur_str_distr_set_i() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_str_distr_set_ii (UNUR_DISTR *distr, const char *key, char *type_args, char **args, distr_set_ii set) + /*----------------------------------------------------------------------*/ + /* Set parameter in given distribution object. */ + /* The list of arguments and their types are given as string. */ + /* */ + /* type: "ii" (int,int) */ + /* */ + /* input: "tt" (exactly two single tokens) */ + /* "L" (exactly one list) */ + /* */ + /* action: */ + /* if "tt": convert both to int. */ + /* execute set call. */ + /* if "L": convert list entries to int. */ + /* execute set call with first two entries. */ + /* (error if list has less than two entries) */ + /* otherwise: error */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* key ... name of parameter to be set */ + /* type_args ... contains types of arguments. Possible values: */ + /* 't' for single token */ + /* 'L' for a list */ + /* args ... array of pointers to argument strings */ + /* set ... pointer to UNU.RAN function for set call */ + /* */ + /* return: */ + /* return code from set call, i.e. */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int *iarray = NULL; + int iarg[2]; + int result; + + /* either exactly two arguments are given */ + if ( !strcmp(type_args, "tt") ) { + iarg[0] = _unur_atoi( args[0] ); + iarg[1] = _unur_atoi( args[1] ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"ii",iarg[0],iarg[1]); +#endif + + return set( distr,iarg[0],iarg[1] ); + } + + /* or one list with 2 entries is given */ + else if ( !strcmp(type_args, "L") ) { + if ( _unur_parse_ilist( args[0], &iarray ) < 2 ) { + _unur_error_args(key); + free (iarray); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"!"); +#endif + return UNUR_ERR_STR_INVALID; + } + result = set( distr,iarray[0],iarray[1] ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"ii",iarray[0],iarray[1] ); +#endif + + free (iarray); + return result; + } + + else { + _unur_error_args(key); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"!"); +#endif + return UNUR_ERR_STR_INVALID; + } + +} /* end of _unur_str_distr_set_ii() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_str_distr_set_d (UNUR_DISTR *distr, const char *key, char *type_args, char **args, distr_set_d set) + /*----------------------------------------------------------------------*/ + /* Set parameter in given distribution object. */ + /* The list of arguments and their types are given as string. */ + /* */ + /* type: "d" (double) */ + /* */ + /* input: "t" (exactly one single token) */ + /* */ + /* action: */ + /* convert token to double. */ + /* execute set call. */ + /* error if input != "t" */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* key ... name of parameter to be set */ + /* type_args ... contains types of arguments. Possible values: */ + /* 't' for single token */ + /* 'L' for a list */ + /* args ... array of pointers to argument strings */ + /* set ... pointer to UNU.RAN function for set call */ + /* */ + /* return: */ + /* return code from set call, i.e. */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double darg; + + if ( strcmp(type_args, "t") ) { + _unur_error_args(key); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"!"); +#endif + return UNUR_ERR_STR_INVALID; + } + + darg = _unur_atod( args[0] ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"d",darg); +#endif + + return set(distr,darg); + +} /* end of _unur_str_distr_set_d() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_str_distr_set_dd (UNUR_DISTR *distr, const char *key, char *type_args, char **args, distr_set_dd set) + /*----------------------------------------------------------------------*/ + /* Set parameter in given distribution object. */ + /* The list of arguments and their types are given as string. */ + /* */ + /* type: "dd" (double,double) */ + /* */ + /* input: "tt" (exactly two single tokens) */ + /* "L" (exactly one list) */ + /* */ + /* action: */ + /* if "tt": convert both to double. */ + /* execute set call. */ + /* if "L": convert list entries to double. */ + /* execute set call with first two entries. */ + /* (error if list has less than two entries) */ + /* otherwise: error */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* key ... name of parameter to be set */ + /* type_args ... contains types of arguments. Possible values: */ + /* 't' for single token */ + /* 'L' for a list */ + /* args ... array of pointers to argument strings */ + /* set ... pointer to UNU.RAN function for set call */ + /* */ + /* return: */ + /* return code from set call, i.e. */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double *darray = NULL; + double darg[2]; + int result; + + /* either exactly two arguments are given */ + if ( !strcmp(type_args, "tt") ) { + darg[0] = _unur_atod( args[0] ); + darg[1] = _unur_atod( args[1] ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"dd",darg[0],darg[1]); +#endif + + return set( distr,darg[0],darg[1] ); + } + + /* or one list with 2 entries is given */ + else if ( !strcmp(type_args, "L") ) { + if ( _unur_parse_dlist( args[0], &darray ) < 2 ) { + _unur_error_args(key); + free (darray); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"!"); +#endif + return UNUR_ERR_STR_INVALID; + } + result = set( distr,darray[0],darray[1] ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"dd",darray[0],darray[1] ); +#endif + + free (darray); + return result; + } + + else { + _unur_error_args(key); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"!"); +#endif + return UNUR_ERR_STR_INVALID; + } + +} /* end of _unur_str_distr_set_dd() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_str_distr_set_Di (UNUR_DISTR *distr, const char *key, char *type_args, char **args, distr_set_Di set) + /*----------------------------------------------------------------------*/ + /* Set parameter in given distribution object. */ + /* The list of arguments and their types are given as string. */ + /* */ + /* type: "Di" (array of doubles, int) */ + /* */ + /* input: "Lt" (list & single token) */ + /* "L" (exactly one list) */ + /* */ + /* action: */ + /* if "L": convert list to array of doubles. */ + /* execute set with size if array as second argument. */ + /* if "Lt": convert list to array of doubles. */ + /* convert second token to int. */ + /* set int to min of int and size of array. */ + /* execute set call with int and array. */ + /* otherwise: error */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* key ... name of parameter to be set */ + /* type_args ... contains types of arguments. Possible values: */ + /* 't' for single token */ + /* 'L' for a list */ + /* args ... array of pointers to argument strings */ + /* set ... pointer to UNU.RAN function for set call */ + /* */ + /* return: */ + /* return code from set call, i.e. */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int result; + int t_size; + int size = -1; + double *darray = NULL; + + /* either an integer and a list are given */ + if ( !strcmp(type_args, "Lt") ) { + t_size = _unur_atoi( args[1] ); + size = _unur_parse_dlist( args[0], &darray ); + if (size > t_size) + size = t_size; + } + + /* or only a list is given */ + else if ( !strcmp(type_args, "L") ) { + size = _unur_parse_dlist( args[0], &darray ); + } + + /* or there is a syntax error */ + if ( !(size>0) ) { + _unur_error_args(key); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"!"); +#endif + result = UNUR_ERR_STR_INVALID; + } + + else { + /* execute set command */ + result = set( distr,darray,size ); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"Di",darray,size,size); +#endif + } + + if (darray) free (darray); + + return result; + +} /* end of _unur_str_distr_set_Di() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_str_distr_set_C (UNUR_DISTR *distr, const char *key, char *type_args, char **args, distr_set_C set) + /*----------------------------------------------------------------------*/ + /* Set parameter in given distribution object. */ + /* The list of arguments and their types are given as string. */ + /* */ + /* type: "C" (string = array of char) */ + /* */ + /* input: "s" (exactly one string) */ + /* */ + /* action: */ + /* execute set call. */ + /* error if input != "s" */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* key ... name of parameter to be set */ + /* type_args ... contains types of arguments. Possible values: */ + /* 's' for single string */ + /* args ... array of pointers to argument strings */ + /* set ... pointer to UNU.RAN function for set call */ + /* */ + /* return: */ + /* return code from set call, i.e. */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + char *string; + + if ( strcmp(type_args, "s") ) { + _unur_error_args(key); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"!"); +#endif + return UNUR_ERR_STR_INVALID; + } + + /* get string */ + string = args[0]; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"C",string); +#endif + + return set(distr,string); + +} /* end of _unur_str_distr_set_C() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Methods **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_par * +_unur_str_par( char *str_method, const UNUR_DISTR *distr, struct unur_slist *mlist ) + /*----------------------------------------------------------------------*/ + /* get parameter object for distribution and method */ + /* */ + /* parameters: */ + /* str_method ... string that contains method description */ + /* distr ... pointer to distribution object */ + /* mlist ... list of allocated memory blocks */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par = NULL; /* pointer to parameter object */ + + char *token; /* pointer to token in string */ + char *next; /* pointer to next token in string */ + char *key, *value; /* the key and its value */ + + /* tokenize the string using ';' as separator and handle the tokens */ + for ( token = next = str_method; + next != NULL && *token != '\0'; + token = next ) { + + /* find end of token (i.e. the pointer to next token) */ + next = strchr(token,';'); + if (next != NULL) { + /* next separator found */ + *next = '\0'; /* terminate token string */ + next++; /* set pointer to next token */ + } + + /* token points to a key */ + key = token; + + /* get the value from the pair key=value and terminate key string */ + value = strchr(key, '='); + if (value != NULL) { + *value = '\0'; /* terminate key string */ + value++; /* set pointer to value string */ + } + + /* the first key is treated differently: get new parameter object */ + if (key == str_method) { + /* the keyword "method" is optional */ + if (value == NULL) { + /* no "method" keyword given, so the key points to the value */ + value = key; + } + else { + if (*key != 'm') { + _unur_error(GENTYPE,UNUR_ERR_STR_SYNTAX,"key for method does not start with 'm'"); + return NULL; + } + } + + /* get new parameter object */ + par = _unur_str_par_new(value,distr); + if (par == NULL) { + /* error */ + _unur_error(GENTYPE,UNUR_ERR_STR,"setting method failed"); + return NULL; + } + } + + /* set parameters for method */ + else { + if ( !_unur_str_par_set(par, key, value, mlist) ) { + ; /* error: */ + } + } + } + + /* end */ + return par; + +} /* end of _unur_str_par() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_str_par_set_void (UNUR_PAR *par, const char *key, + char *type_args, char **args ATTRIBUTE__UNUSED, par_set_void set) + /*----------------------------------------------------------------------*/ + /* Set parameter in given parameter object. */ + /* The list of arguments and their types are given as string. */ + /* */ + /* type: void (no arguments required) */ + /* */ + /* input: void (no arguments should be given) */ + /* */ + /* action: */ + /* execute set call. */ + /* warning if any argument is given. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter object */ + /* key ... name of parameter to be set */ + /* type_args ... contains types of arguments. Possible values: */ + /* 't' for single token */ + /* 'L' for a list */ + /* args ... array of pointers to argument strings */ + /* set ... pointer to UNU.RAN function for set call */ + /* */ + /* return: */ + /* return code from set call, i.e. */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"v"); +#endif + + if (*type_args != '\0') + _unur_error_args(key); + + return set(par); + +} /* end of _unur_str_par_set_void() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_str_par_set_i (UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_i set) + /*----------------------------------------------------------------------*/ + /* Set parameter in given parameter object. */ + /* The list of arguments and their types are given as string. */ + /* */ + /* type: "i" (int) */ + /* */ + /* input: "t" (exactly one single token) */ + /* void (no argument given) */ + /* */ + /* action: */ + /* convert token to int. */ + /* (if no argument is given, use 1.) */ + /* execute set call. */ + /* error if input != "t" */ + /* */ + /* parameters: */ + /* par ... pointer to parameter object */ + /* key ... name of parameter to be set */ + /* type_args ... contains types of arguments. Possible values: */ + /* 't' for single token */ + /* 'L' for a list */ + /* args ... array of pointers to argument strings */ + /* set ... pointer to UNU.RAN function for set call */ + /* */ + /* return: */ + /* return code from set call, i.e. */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int iarg; + + if ( !strcmp(type_args, "t") ) { + iarg = _unur_atoi( args[0] ); + } + else if ( strlen(type_args) == 0 ) { + iarg = 1; + } + else { + _unur_error_args(key); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"!"); +#endif + return UNUR_ERR_STR_INVALID; + } + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"i",iarg); +#endif + + return set(par,iarg); + +} /* end of _unur_str_par_set_i() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_str_par_set_ii (UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_ii set) + /*----------------------------------------------------------------------*/ + /* Set parameter in given parameter object. */ + /* The list of arguments and their types are given as string. */ + /* */ + /* type: "ii" (int,int) */ + /* */ + /* input: "tt" (exactly two single tokens) */ + /* "L" (exactly one list) */ + /* */ + /* action: */ + /* if "tt": convert both to int. */ + /* execute set call. */ + /* if "L": convert list entries to int. */ + /* execute set call with first two entries. */ + /* (error if list has less than two entries) */ + /* otherwise: error */ + /* */ + /* parameters: */ + /* par ... pointer to parameter object */ + /* key ... name of parameter to be set */ + /* type_args ... contains types of arguments. Possible values: */ + /* 't' for single token */ + /* 'L' for a list */ + /* args ... array of pointers to argument strings */ + /* set ... pointer to UNU.RAN function for set call */ + /* */ + /* return: */ + /* return code from set call, i.e. */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int *iarray = NULL; + int iarg[2]; + int result; + + /* either exactly two arguments are given */ + if ( !strcmp(type_args, "tt") ) { + iarg[0] = _unur_atoi( args[0] ); + iarg[1] = _unur_atoi( args[1] ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"ii",iarg[0],iarg[1]); +#endif + + return set( par,iarg[0],iarg[1] ); + } + + /* or one list with 2 entries is given */ + else if ( !strcmp(type_args, "L") ) { + if ( _unur_parse_ilist( args[0], &iarray ) < 2 ) { + _unur_error_args(key); + free (iarray); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"!"); +#endif + return UNUR_ERR_STR_INVALID; + } + result = set( par,iarray[0],iarray[1] ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"ii",iarray[0],iarray[1] ); +#endif + + free (iarray); + return result; + } + + else { + _unur_error_args(key); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"!"); +#endif + return UNUR_ERR_STR_INVALID; + } + +} /* end of _unur_str_par_set_ii() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_str_par_set_u (UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_u set) + /*----------------------------------------------------------------------*/ + /* Set parameter in given parameter object. */ + /* The list of arguments and their types are given as string. */ + /* */ + /* type: "u" (unsigned) */ + /* */ + /* input: "t" (exactly one single token) */ + /* */ + /* action: */ + /* convert token to unsigned. */ + /* execute set call. */ + /* error if input != "t" */ + /* */ + /* parameters: */ + /* par ... pointer to parameter object */ + /* key ... name of parameter to be set */ + /* type_args ... contains types of arguments. Possible values: */ + /* 't' for single token */ + /* 'L' for a list */ + /* args ... array of pointers to argument strings */ + /* set ... pointer to UNU.RAN function for set call */ + /* */ + /* return: */ + /* return code from set call, i.e. */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + unsigned uarg; + + if ( strcmp(type_args, "t") ) { + _unur_error_args(key); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"!"); +#endif + return UNUR_ERR_STR_INVALID; + } + + uarg = _unur_atou( args[0] ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"u",uarg); +#endif + + return set(par,uarg); + +} /* end of _unur_str_par_set_u() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_str_par_set_d (UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_d set) + /*----------------------------------------------------------------------*/ + /* Set parameter in given parameter object. */ + /* The list of arguments and their types are given as string. */ + /* */ + /* type: "d" (double) */ + /* */ + /* input: "t" (exactly one single token) */ + /* */ + /* action: */ + /* convert token to double. */ + /* execute set call. */ + /* error if input != "t" */ + /* */ + /* parameters: */ + /* par ... pointer to parameter object */ + /* key ... name of parameter to be set */ + /* type_args ... contains types of arguments. Possible values: */ + /* 't' for single token */ + /* 'L' for a list */ + /* args ... array of pointers to argument strings */ + /* set ... pointer to UNU.RAN function for set call */ + /* */ + /* return: */ + /* return code from set call, i.e. */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double darg; + + if ( strcmp(type_args, "t") ) { + _unur_error_args(key); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"!"); +#endif + return UNUR_ERR_STR_INVALID; + } + + darg = _unur_atod( args[0] ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"d",darg); +#endif + + return set(par,darg); + +} /* end of _unur_str_par_set_d() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_str_par_set_dd (UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_dd set) + /*----------------------------------------------------------------------*/ + /* Set parameter in given parameter object. */ + /* The list of arguments and their types are given as string. */ + /* */ + /* type: "dd" (double,double) */ + /* */ + /* input: "tt" (exactly two single tokens) */ + /* "L" (exactly one list) */ + /* */ + /* action: */ + /* if "tt": convert both to double. */ + /* execute set call. */ + /* if "L": convert list entries to double. */ + /* execute set call with first two entries. */ + /* (error if list has less than two entries) */ + /* otherwise: error */ + /* */ + /* parameters: */ + /* par ... pointer to parameter object */ + /* key ... name of parameter to be set */ + /* type_args ... contains types of arguments. Possible values: */ + /* 't' for single token */ + /* 'L' for a list */ + /* args ... array of pointers to argument strings */ + /* set ... pointer to UNU.RAN function for set call */ + /* */ + /* return: */ + /* return code from set call, i.e. */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double *darray = NULL; + double darg[2]; + int result; + + /* either exactly two arguments are given */ + if ( !strcmp(type_args, "tt") ) { + darg[0] = _unur_atod( args[0] ); + darg[1] = _unur_atod( args[1] ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"dd",darg[0],darg[1]); +#endif + + return set( par,darg[0],darg[1] ); + } + + /* or one list with 2 entries is given */ + else if ( !strcmp(type_args, "L") ) { + if ( _unur_parse_dlist( args[0], &darray ) < 2 ) { + _unur_error_args(key); + free (darray); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"!"); +#endif + return UNUR_ERR_STR_INVALID; + } + result = set( par,darray[0],darray[1] ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"dd",darray[0],darray[1] ); +#endif + + free (darray); + return result; + } + + else { + _unur_error_args(key); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"!"); +#endif + return UNUR_ERR_STR_INVALID; + } + +} /* end of _unur_str_par_set_dd() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_str_par_set_iD (UNUR_PAR *par, const char *key, char *type_args, char **args, + par_set_iD set, struct unur_slist *mlist ) + /*----------------------------------------------------------------------*/ + /* Set parameter in given parameter object. */ + /* The list of arguments and their types are given as string. */ + /* */ + /* type: "iD" (int, array of doubles) */ + /* */ + /* input: "tL" (single token & list) */ + /* "L" (exactly one list) */ + /* "t" (single token) */ + /* */ + /* action: */ + /* if "L": convert list to array of doubles. */ + /* execute set with size if array as first argument. */ + /* if "t": convert token to int. */ + /* execute set call with NULL as its second argument. */ + /* if "tL": convert list to array of doubles. */ + /* convert first token to int. */ + /* set int to min of int and size of array. */ + /* execute set call with int and array. */ + /* otherwise: error */ + /* */ + /* parameters: */ + /* par ... pointer to parameter object */ + /* key ... name of parameter to be set */ + /* type_args ... contains types of arguments. Possible values: */ + /* 't' for single token */ + /* 'L' for a list */ + /* args ... array of pointers to argument strings */ + /* set ... pointer to UNU.RAN function for set call */ + /* mlist ... list of allocated memory blocks */ + /* */ + /* return: */ + /* return code from set call, i.e. */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int result; + int t_size; + int size = -1; + double *darray = NULL; + + /* either an integer and a list are given */ + if ( !strcmp(type_args, "tL") ) { + t_size = _unur_atoi( args[0] ); + size = _unur_parse_dlist( args[1], &darray ); + if (size > 0) { + if (size > t_size) size = t_size; + } + else { + /* empty list */ + size = t_size; + if (darray) free (darray); + darray = NULL; + } + } + + /* or only an integer is given */ + else if ( !strcmp(type_args, "t") ) { + size = _unur_atoi( args[0] ); + darray = NULL; + } + + /* or only a list is given */ + else if ( !strcmp(type_args, "L") ) { + size = _unur_parse_dlist( args[0], &darray ); + } + + /* or there is a syntax error */ + if ( !(size>0) ) { + _unur_error_args(key); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"!"); +#endif + result = UNUR_ERR_STR_INVALID; + } + + else { + /* execute set command */ + result = set( par,size,darray ); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"iD",size,darray,size); +#endif + } + + /* store pointer to allocated array */ + if (darray) + _unur_slist_append( mlist, darray ); + + return result; + +} /* end of _unur_str_par_set_iD() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_str_par_set_Di (UNUR_PAR *par, const char *key, char *type_args, char **args, + par_set_Di set, struct unur_slist *mlist ) + /*----------------------------------------------------------------------*/ + /* Set parameter in given parameter object. */ + /* The list of arguments and their types are given as string. */ + /* */ + /* type: "Di" (array of doubles, int) */ + /* */ + /* input: "Lt" (list & single token & list) */ + /* */ + /* action: */ + /* convert list to array of doubles. */ + /* convert token to int. */ + /* execute set call with array and int. */ + /* */ + /* parameters: */ + /* par ... pointer to parameter object */ + /* key ... name of parameter to be set */ + /* type_args ... contains types of arguments. Possible values: */ + /* 't' for single token */ + /* 'L' for a list */ + /* args ... array of pointers to argument strings */ + /* set ... pointer to UNU.RAN function for set call */ + /* mlist ... list of allocated memory blocks */ + /* */ + /* return: */ + /* return code from set call, i.e. */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int result; + int t_size; + int size; + double *darray = NULL; + + if ( !strcmp(type_args, "Lt") ) { + t_size = _unur_atoi( args[1] ); + size = _unur_parse_dlist( args[0], &darray ); + if (size > 0) { + result = set( par,darray,t_size ); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"Di",darray,size,size); +#endif + + /* store pointer to allocated array */ + if (darray) + _unur_slist_append( mlist, darray ); + + return result; + } + } + + /* there is a syntax error */ + _unur_error_args(key); +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_set(2,key,"!"); +#endif + + return UNUR_ERR_STR_INVALID; +} /* end of _unur_str_par_set_Di() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Uniform RNG **/ +/*****************************************************************************/ + +UNUR_URNG * +_unur_str2urng( char *str_urng ATTRIBUTE__UNUSED) + /*----------------------------------------------------------------------*/ + /* get uniform RNG */ + /* */ + /* parameters: */ + /* str_urng ... string that contains description of uniform RNG */ + /* */ + /* return: */ + /* pointer to uniform RNG */ + /* */ + /* The string must not contain any other keywords than "urng". */ + /* the argument is passed unchanged to the PRNG package. */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ +/*---------------------------------------------------------------------------*/ +#if defined(UNUR_URNG_UNURAN) && defined(UNURAN_HAS_PRNG) +/*---------------------------------------------------------------------------*/ + + UNUR_URNG *urng = NULL; + + char *token; /* pointer to token in string */ + char *next; /* pointer to next token in string */ + char *key, *value; /* the key and its value */ + + /* tokenize the string using ';' as separator and handle the tokens */ + for ( token = next = str_urng; + next != NULL && *token != '\0'; + token = next ) { + + /* find end of token (i.e. the pointer to next token) */ + next = strchr(token,';'); + if (next != NULL) { + /* next separator found */ + *next = '\0'; /* terminate token string */ + next++; /* set pointer to next token */ + } + + /* token points to a key */ + key = token; + + /* get the value from the pair key=value and terminate key string */ + value = strchr(key, '='); + if (value != NULL) { + *value = '\0'; /* terminate key string */ + value++; /* set pointer to value string */ + } + + /* get (default) parameter object for method */ + if ( !strcmp( key, "urng") ) { + if (key == str_urng) { + /* "urng" must be the first key. */ + /* (on the other hand, the first keyword always must be "urng" */ + /* since otherwise we had not called this subroutine. */ + /* hence, we only check, whether the keyword "urng" is unique.) */ + urng = unur_urng_prng_new(value); + if (urng == NULL) { + /* error */ + _unur_error(GENTYPE,UNUR_ERR_STR,"setting URNG failed"); + return NULL; + } + else { +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_string(1,"urng",value); +#endif + ; + } + } + else { + if (urng) unur_urng_free (urng); + _unur_error(GENTYPE,UNUR_ERR_STR_SYNTAX,"urng must be first key"); + return NULL; + } + } + + /* there are no other parameters */ + else { + /* error: unknown parameter */ + if (urng) unur_urng_free (urng); + _unur_error_unknown(key,"parameter for uniform RNG"); + return NULL; + } + } + + /*return pointer to uniform RNG */ + return urng; + +/*---------------------------------------------------------------------------*/ +#else +/*---------------------------------------------------------------------------*/ + + _unur_error(GENTYPE,UNUR_ERR_STR,"setting URNG requires PRNG library enabled"); + return NULL; + +/*---------------------------------------------------------------------------*/ +#endif /* end defined(UNUR_URNG_UNURAN) && defined(UNURAN_HAS_PRNG) */ +/*---------------------------------------------------------------------------*/ +} /* end of _unur_str2urng() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Misc **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_str_set_args( char *value, char *type_args, char **args, int max_args ) + /*----------------------------------------------------------------------*/ + /* parse argument string for set call */ + /* */ + /* parameters: */ + /* value ... string that contains list of arguments for set call */ + /* type_args ... array containing info about arguments */ + /* args ... pointers to argument strings */ + /* max_args ... maximal number of argments */ + /* */ + /* tokenize string with arguments and store the pointer to each */ + /* argument in 'args'. Evaluate the type of each argument and store it */ + /* in 'type_args'. We have the following types: */ + /* 't' ... a single token, or */ + /* 'L' ... a list, indicated by (...) */ + /* */ + /* return: */ + /* number of parsed arguments */ + /* */ + /* error: */ + /* return -1 */ + /*----------------------------------------------------------------------*/ +{ + char *token; /* pointer to token in string */ + char *next; /* pointer to next token in string */ + int n_args; /* number of arguments in set call */ + + /* initialize pointers */ + n_args = 0; + *type_args = '\0'; + *args = NULL; + + /* we have two types of arguments: + 't' ... a single token, or + 'L' ... a list, indicated by (...) + */ + + /* split value string into separate arguments */ + if (value && *value != '\0') { + /* there is at least one argument */ + + for ( token = next = value; + next != NULL && *token != '\0' && n_args < max_args; + token = next, n_args++ ) { + + /* get type of argument */ + + if ( *token == '(' ) { + /* argument is a list */ + type_args[n_args] = 'L'; + /* skip to next character */ + token++; + /* store pointer to argument */ + args[n_args] = token; + /* find end of list using ')' as terminating character */ + next = strchr(token,')'); + if (next != NULL) { + /* end of list found */ + *next = '\0'; /* terminate token string */ + token = ++next; /* set pointer to first character after ')' */ + /* first character after ')' must be ',' */ + if ( !(*token == ',' || *token == '\0') ) { + _unur_error(GENTYPE,UNUR_ERR_STR_SYNTAX,") not followed by comma"); + return -1; + } + } + else { + /* no ')' found */ + token = NULL; + } + } + + else if ( *token == '"' ) { + /* argument is a string */ + type_args[n_args] = 's'; + /* skip to next character */ + token++; + /* store pointer to argument */ + args[n_args] = token; + + /* find end of string using '"' as terminating character */ + next = strchr(token,'"'); + if (next != NULL) { + /* end of list found */ + *next = '\0'; /* terminate token string */ + token = ++next; /* set pointer to first character after ')' */ + /* first character after ')' must be ',' */ + if ( !(*token == ',' || *token == '\0') ) { + _unur_error(GENTYPE,UNUR_ERR_STR_SYNTAX,"closing '\"' not followed by comma"); + return -1; + } + } + else { + /* no '"' found */ + token = NULL; + } + } + + else { + /* argument is a sigle item */ + type_args[n_args] = 't'; + /* store pointer to argument */ + args[n_args] = token; + } + + /* find end of argument string using ',' as separator */ + if (token) { + next = strchr(token,','); + if (next != NULL) { + /* next separator found */ + *next = '\0'; /* terminate token string */ + next++; /* set pointer to next token */ + } + } + else { + next = NULL; + } + } + + /* terminate string */ + type_args[n_args] = '\0'; + + /* If there are two many arguments, we simply assume a syntax error */ + /* (This case should not happen.) */ + if (n_args >= max_args) { + _unur_error( GENTYPE, UNUR_ERR_STR_SYNTAX, "too many arguments"); + return -1; + } + } + + /* return number of parsed arguments */ + return n_args; + +} /* end of _unur_str_set_args() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Convert to numbers **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_parse_ilist( char *liststr, int **iarray ) + /*----------------------------------------------------------------------*/ + /* Process a comma separated list of integers, convert it to ints and */ + /* store it an array. The list (string) is terminated by a closing */ + /* parenthesis ')' or '\0'. */ + /* */ + /* parameters: */ + /* liststr ... string containing list of numbers */ + /* iarray ... pointer to adress of double array for storing result */ + /* */ + /* return: */ + /* number of elements extracted */ + /* */ + /* comment: */ + /* as a side effect an int array of appropriate size is allocated. */ + /*----------------------------------------------------------------------*/ +{ + int *iarr = NULL; /* pointer to int array */ + int n_iarray = 0; /* number of elements in processed list */ + int n_alloc = 0; /* number allocated elements */ + char *token; + + /* return 0 if no list is given */ + if (liststr == NULL) { + *iarray = iarr; + return 0; + } + + /* discard possible leading ',' or '(' characters in front of the numbers */ + while ( *liststr == ',' || *liststr == '(' ){ + liststr++; /* next char */ + } + + /* new get integers */ + for ( token = strtok(liststr, ",)"); + token != NULL; + token = strtok(NULL, ",)") ) { + + /* check if there is enough space in iarr */ + if (n_iarray >= n_alloc) { + /* no --> allocate memory */ + n_alloc += 100; + iarr = _unur_xrealloc( iarr, n_alloc * sizeof(int) ); + } + + /* get int */ + iarr[n_iarray++] = _unur_atoi(token); + + } /* end while -- all elements of list read */ + + /* store pointer to double array */ + *iarray = iarr; + + /* return number of elements in array */ + return n_iarray; + +} /* end of _unur_parse_ilist() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_parse_dlist( char *liststr, double **darray ) + /*----------------------------------------------------------------------*/ + /* Process a comma separated list of numbers (doubles), convert it to */ + /* doubles and store it an array. The list (string) is terminated by */ + /* a closing parenthesis ')' or '\0'. */ + /* */ + /* parameters: */ + /* liststr ... string containing list of numbers */ + /* darray ... pointer to adress of double array for storing result */ + /* */ + /* return: */ + /* number of elements extracted */ + /* */ + /* comment: */ + /* as a side effect a double array of appropriate size is allocated. */ + /*----------------------------------------------------------------------*/ +{ + double *darr = NULL; /* pointer to double array */ + int n_darray = 0; /* number of elements in processed list */ + int n_alloc = 0; /* number allocated elements */ + char *token; /* pointer to token in string */ + char *next; /* pointer to next token in string */ + + /* return 0 if no list is given */ + if (liststr == NULL) { + *darray = NULL; + return 0; + } + + /* extract doubles from string and write them to array of doubles. */ + /* end of list is indicated by right bracket ')' or '\0'. */ + + /* pointer to first token in string */ + token = liststr; + + /* remove (optional) leading parenthesis '(' */ + while (*token != '\0' && *token == '(') + ++token; + + /* tokenize the string using ',' as separator and handle the tokens */ + for ( next = token; + next != NULL && *token != '\0' &&*token != ')'; + token = next ) { + + /* find end of token (i.e. the pointer to next token) */ + next = strchr(token,','); + if (next != NULL) { + /* next separator found */ + *next = '\0'; /* terminate token string */ + next++; /* set pointer to next token */ + } + + /* check if there is enough space in darr */ + if (n_darray >= n_alloc) { + /* no --> allocate memory */ + n_alloc += 100; + darr = _unur_xrealloc( darr, n_alloc * sizeof(double) ); + } + + /* extract double and write to array and increase counter */ + darr[n_darray] = _unur_atod(token); + n_darray++; + + } + + /* store pointer to double array */ + *darray = darr; + + /* return number of elements in array */ + return n_darray; + +} /* end of _unur_parse_dlist() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_atoi ( const char *str ) + /*----------------------------------------------------------------------*/ + /* Converts the string into its integer representation. */ + /* 'true' and 'on' are converted to 1, 'false' and 'off' to 0. */ + /* */ + /* parameters: */ + /* str ... pointer to string */ + /* */ + /* return: */ + /* integer */ + /*----------------------------------------------------------------------*/ +{ + if ( !strcmp(str,"true") || !strcmp(str,"on") ) + return 1; + + else if ( !strcmp(str,"false") || !strcmp(str,"off") ) + return 0; + + else if ( !strncmp(str,"inf",(size_t)3) ) + return INT_MAX; + + else if ( !strncmp(str,"-inf",(size_t)4) ) + return INT_MIN; + + else + return atoi(str); + +} /* end of _unur_atoi() */ + +/*---------------------------------------------------------------------------*/ + +unsigned +_unur_atou ( const char *str ) + /*----------------------------------------------------------------------*/ + /* Converts the string into its unsigned representation. */ + /* strings are interprated as hexadecimal numbers. */ + /* 'true' and 'on' are converted to 1u, 'false' and 'off' to 0u. */ + /* */ + /* parameters: */ + /* str ... pointer to string */ + /* */ + /* return: */ + /* unsigned */ + /*----------------------------------------------------------------------*/ +{ + char *tail; + + if ( !strcmp(str,"true") || !strcmp(str,"on") ) + return 1u; + + else if ( !strcmp(str,"false") || !strcmp(str,"off") ) + return 0u; + + else + return ((unsigned) strtoul(str, &tail, 16)); +} /* end of _unur_atou() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_atod ( const char *str ) + /*----------------------------------------------------------------------*/ + /* Converts the string into its double value. */ + /* */ + /* parameters: */ + /* str ... pointer to string */ + /* */ + /* return: */ + /* double */ + /*----------------------------------------------------------------------*/ +{ + if ( !strncmp(str,"inf",(size_t)3) ) + return UNUR_INFINITY; + + else if ( !strncmp(str,"-inf",(size_t)4) ) + return -UNUR_INFINITY; + + else + return atof(str); +} /* end of _unur_atod() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Debugging utilities **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_ENABLE_LOGGING +/*---------------------------------------------------------------------------*/ + +void +_unur_str_debug_string( int level, const char *key, const char *value ) + /*----------------------------------------------------------------------*/ + /* print key & value info into LOG file */ + /* */ + /* parameters: */ + /* level ... level of indentation */ + /* key ... pointer to key string */ + /* value ... pointer to value string */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + + LOG = unur_get_stream(); + +/* fprintf(LOG,"%s: String Interface for UNU.RAN\n",GENTYPE); */ + fprintf(LOG,"%s: ",GENTYPE); + for (; level>0; level--) + fprintf(LOG,"\t"); + fprintf(LOG,"%s",key); + if (value) + fprintf(LOG,": %s",value); + fprintf(LOG,"\n"); + +/* fprintf(LOG,"%s:\n",GENTYPE); */ + +} /* end of _unur_str_debug_string() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_str_debug_distr( int level, const char *name, double *params, int n_params ) + /*----------------------------------------------------------------------*/ + /* write info about distribution into LOG file */ + /* */ + /* parameters: */ + /* level ... level of indentation */ + /* name ... name of distribution */ + /* params ... array of parameters */ + /* n_params ... number of parameters */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int i; + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: ",GENTYPE); + for (; level>0; level--) + fprintf(LOG,"\t"); + + fprintf(LOG,"distribution = %s (",name); + if (n_params >0) { + fprintf(LOG,"%g",params[0]); + for (i=1; i0; level--) + fprintf(LOG,"\t"); + fprintf(LOG,"%s: ",key); + + while (1) { + + switch (*type) { + case 'v': + fprintf(LOG," -none-"); + break; + case 'd': + fprintf(LOG," %g",va_arg(ap,double)); + break; + case 'i': + fprintf(LOG," %d",va_arg(ap,int)); + break; + case 'u': + fprintf(LOG," %x",va_arg(ap,unsigned int)); + break; + case 'C': + fprintf(LOG," %s",va_arg(ap,char *)); + break; + case 'D': { + int i,size; + double *darray; + darray = va_arg(ap,double *); + size = va_arg(ap,int); + if (size > 0 && darray != NULL) { + fprintf(LOG," (%g",darray[0]); + for (i=1; itext); + _unur_string_free( reason ); +} /* end of _unur_str_error_unknown() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_str_error_invalid( const char *file, int line, const char *key, const char *type ) + /*----------------------------------------------------------------------*/ + /* print error message: invalid data for keyword. */ + /* */ + /* parameters: */ + /* file ... file name (inserted by __FILE__) */ + /* line ... line number in source file (inserted by __LINE__) */ + /* key ... keyword */ + /* type ... type of keyword */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *reason = _unur_string_new(); + _unur_string_append( reason, "invalid data for %s '%s'", type, key ); + _unur_error_x( GENTYPE, file, line, "error", UNUR_ERR_STR_INVALID,reason->text); + _unur_string_free( reason ); +} /* end of _unur_str_error_invalid() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_str_error_args( const char *file, int line, const char *key ) + /*----------------------------------------------------------------------*/ + /* print error message: invalid argument string for set call. */ + /* */ + /* parameters: */ + /* file ... file name (inserted by __FILE__) */ + /* line ... line number in source file (inserted by __LINE__) */ + /* key ... keyword */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *reason = _unur_string_new(); + _unur_string_append( reason, "invalid argument string for '%s'", key ); + _unur_error_x( GENTYPE, file, line, "error", UNUR_ERR_STR_INVALID,reason->text); + _unur_string_free( reason ); +} /* end of _unur_str_error_args() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/parser/stringparser_doc.dh b/vendor/unuran-1.11.0/src/parser/stringparser_doc.dh new file mode 100644 index 0000000..7cce478 --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/stringparser_doc.dh @@ -0,0 +1,566 @@ +/* +=NODE KeysDistr Keys for Distribution String +=UP StringDistr [10] + +=DESCRIPTION + +List of standard distributions @pxref{Stddist,,Standard distributions} + +@itemize @minus +@item @code{[distr =] beta(@dots{})} @ @ @ @ @result{} @pxref{beta} +@item @code{[distr =] binomial(@dots{})} @ @ @ @ @result{} @pxref{binomial} +@item @code{[distr =] cauchy(@dots{})} @ @ @ @ @result{} @pxref{cauchy} +@item @code{[distr =] chi(@dots{})} @ @ @ @ @result{} @pxref{chi} +@item @code{[distr =] chisquare(@dots{})} @ @ @ @ @result{} @pxref{chisquare} +@item @code{[distr =] exponential(@dots{})} @ @ @ @ @result{} @pxref{exponential} +@item @code{[distr =] extremeI(@dots{})} @ @ @ @ @result{} @pxref{extremeI} +@item @code{[distr =] extremeII(@dots{})} @ @ @ @ @result{} @pxref{extremeII} +@item @code{[distr =] F(@dots{})} @ @ @ @ @result{} @pxref{F} +@item @code{[distr =] gamma(@dots{})} @ @ @ @ @result{} @pxref{gamma} +@item @code{[distr =] geometric(@dots{})} @ @ @ @ @result{} @pxref{geometric} +@item @code{[distr =] gig(@dots{})} @ @ @ @ @result{} @pxref{gig} +@item @code{[distr =] gig2(@dots{})} @ @ @ @ @result{} @pxref{gig2} +@item @code{[distr =] hyperbolic(@dots{})} @ @ @ @ @result{} @pxref{hyperbolic} +@item @code{[distr =] hypergeometric(@dots{})} @ @ @ @ @result{} @pxref{hypergeometric} +@item @code{[distr =] ig(@dots{})} @ @ @ @ @result{} @pxref{ig} +@item @code{[distr =] laplace(@dots{})} @ @ @ @ @result{} @pxref{laplace} +@item @code{[distr =] logarithmic(@dots{})} @ @ @ @ @result{} @pxref{logarithmic} +@item @code{[distr =] logistic(@dots{})} @ @ @ @ @result{} @pxref{logistic} +@item @code{[distr =] lognormal(@dots{})} @ @ @ @ @result{} @pxref{lognormal} +@item @code{[distr =] lomax(@dots{})} @ @ @ @ @result{} @pxref{lomax} +@item @code{[distr =] negativebinomial(@dots{})} @ @ @ @ @result{} @pxref{negativebinomial} +@item @code{[distr =] normal(@dots{})} @ @ @ @ @result{} @pxref{normal} +@item @code{[distr =] pareto(@dots{})} @ @ @ @ @result{} @pxref{pareto} +@item @code{[distr =] poisson(@dots{})} @ @ @ @ @result{} @pxref{poisson} +@item @code{[distr =] powerexponential(@dots{})} @ @ @ @ @result{} @pxref{powerexponential} +@item @code{[distr =] rayleigh(@dots{})} @ @ @ @ @result{} @pxref{rayleigh} +@item @code{[distr =] slash(@dots{})} @ @ @ @ @result{} @pxref{slash} +@item @code{[distr =] student(@dots{})} @ @ @ @ @result{} @pxref{student} +@item @code{[distr =] triangular(@dots{})} @ @ @ @ @result{} @pxref{triangular} +@item @code{[distr =] uniform(@dots{})} @ @ @ @ @result{} @pxref{uniform} +@item @code{[distr =] weibull(@dots{})} @ @ @ @ @result{} @pxref{weibull} +@end itemize + +List of generic distributions @pxref{Distribution_objects,,Handling Distribution Objects} + +@itemize @minus +@item @code{[distr =] cemp} @ @ @ @ @result{} @pxref{CEMP} +@item @code{[distr =] cont} @ @ @ @ @result{} @pxref{CONT} +@item @code{[distr =] discr} @ @ @ @ @result{} @pxref{DISCR} +@end itemize + +@emph{Notice}: +Order statistics for continuous distributions (@pxref{CORDER}) are +supported by using the key @code{orderstatistics} for distributions +of type @code{CONT}. + +List of keys that are available via the String API. +For description see the corresponding UNU.RAN set calls. + +@itemize @bullet +@item All distribution types +@table @code +@item name = "@i{}" + @result{} @pxref{funct:unur_distr_set_name,,@command{unur_distr_set_name}} +@end table + +@item @code{cemp} @ @i{(Distribution Type)}@ @ @ @ (@pxref{CEMP}) +@table @code +@item data = (@i{}) [, @i{}] + @result{} @pxref{funct:unur_distr_cemp_set_data,,@command{unur_distr_cemp_set_data}} +@item hist_bins = (@i{}) [, @i{}] + @result{} @pxref{funct:unur_distr_cemp_set_hist_bins,,@command{unur_distr_cemp_set_hist_bins}} +@item hist_domain = @i{}, @i{} | (@i{}) + @result{} @pxref{funct:unur_distr_cemp_set_hist_domain,,@command{unur_distr_cemp_set_hist_domain}} +@item hist_prob = (@i{}) [, @i{}] + @result{} @pxref{funct:unur_distr_cemp_set_hist_prob,,@command{unur_distr_cemp_set_hist_prob}} +@end table + +@item @code{cont} @ @i{(Distribution Type)}@ @ @ @ (@pxref{CONT}) +@table @code +@item cdf = "@i{}" + @result{} @pxref{funct:unur_distr_cont_set_cdfstr,,@command{unur_distr_cont_set_cdfstr}} +@item center = @i{} + @result{} @pxref{funct:unur_distr_cont_set_center,,@command{unur_distr_cont_set_center}} +@item domain = @i{}, @i{} | (@i{}) + @result{} @pxref{funct:unur_distr_cont_set_domain,,@command{unur_distr_cont_set_domain}} +@item hr = "@i{}" + @result{} @pxref{funct:unur_distr_cont_set_hrstr,,@command{unur_distr_cont_set_hrstr}} +@item logcdf = "@i{}" + @result{} @pxref{funct:unur_distr_cont_set_logcdfstr,,@command{unur_distr_cont_set_logcdfstr}} +@item logpdf = "@i{}" + @result{} @pxref{funct:unur_distr_cont_set_logpdfstr,,@command{unur_distr_cont_set_logpdfstr}} +@item mode = @i{} + @result{} @pxref{funct:unur_distr_cont_set_mode,,@command{unur_distr_cont_set_mode}} +@item pdf = "@i{}" + @result{} @pxref{funct:unur_distr_cont_set_pdfstr,,@command{unur_distr_cont_set_pdfstr}} +@item pdfarea = @i{} + @result{} @pxref{funct:unur_distr_cont_set_pdfarea,,@command{unur_distr_cont_set_pdfarea}} +@item pdfparams = (@i{}) [, @i{}] + @result{} @pxref{funct:unur_distr_cont_set_pdfparams,,@command{unur_distr_cont_set_pdfparams}} +@item orderstatistics = @i{}, @i{} | (@i{}) + Make order statistics for given distribution. The first parameter + gives the sample size, the second parameter its rank. + (see @pxref{funct:unur_distr_corder_new,,@command{unur_distr_corder_new}}) +@end table + +@item @code{discr} @ @i{(Distribution Type)}@ @ @ @ (@pxref{DISCR}) +@table @code +@item cdf = "@i{}" + @result{} @pxref{funct:unur_distr_discr_set_cdfstr,,@command{unur_distr_discr_set_cdfstr}} +@item domain = @i{}, @i{} | (@i{}) + @result{} @pxref{funct:unur_distr_discr_set_domain,,@command{unur_distr_discr_set_domain}} +@item mode [= @i{}] + @result{} @pxref{funct:unur_distr_discr_set_mode,,@command{unur_distr_discr_set_mode}} +@item pmf = "@i{}" + @result{} @pxref{funct:unur_distr_discr_set_pmfstr,,@command{unur_distr_discr_set_pmfstr}} +@item pmfparams = (@i{}) [, @i{}] + @result{} @pxref{funct:unur_distr_discr_set_pmfparams,,@command{unur_distr_discr_set_pmfparams}} +@item pmfsum = @i{} + @result{} @pxref{funct:unur_distr_discr_set_pmfsum,,@command{unur_distr_discr_set_pmfsum}} +@item pv = (@i{}) [, @i{}] + @result{} @pxref{funct:unur_distr_discr_set_pv,,@command{unur_distr_discr_set_pv}} +@end table + +@end itemize + + +=EON +*/ +/* +=NODE KeysMethod Keys for Method String +=UP StringMethod [10] + +=DESCRIPTION + +List of methods and keys that are available via the String API. +For description see the corresponding UNU.RAN set calls. + +@itemize @bullet +@item @code{method = arou} @ @ @ @ @result{} @command{unur_arou_new} +(@pxref{AROU}) +@table @code +@item cpoints = @i{} [, (@i{})] | (@i{}) + @result{} @pxref{funct:unur_arou_set_cpoints,,@command{unur_arou_set_cpoints}} +@item darsfactor = @i{} + @result{} @pxref{funct:unur_arou_set_darsfactor,,@command{unur_arou_set_darsfactor}} +@item guidefactor = @i{} + @result{} @pxref{funct:unur_arou_set_guidefactor,,@command{unur_arou_set_guidefactor}} +@item max_segments [= @i{}] + @result{} @pxref{funct:unur_arou_set_max_segments,,@command{unur_arou_set_max_segments}} +@item max_sqhratio = @i{} + @result{} @pxref{funct:unur_arou_set_max_sqhratio,,@command{unur_arou_set_max_sqhratio}} +@item pedantic [= @i{}] + @result{} @pxref{funct:unur_arou_set_pedantic,,@command{unur_arou_set_pedantic}} +@item usecenter [= @i{}] + @result{} @pxref{funct:unur_arou_set_usecenter,,@command{unur_arou_set_usecenter}} +@item usedars [= @i{}] + @result{} @pxref{funct:unur_arou_set_usedars,,@command{unur_arou_set_usedars}} +@item verify [= @i{}] + @result{} @pxref{funct:unur_arou_set_verify,,@command{unur_arou_set_verify}} +@end table + +@item @code{method = ars} @ @ @ @ @result{} @command{unur_ars_new} +(@pxref{ARS}) +@table @code +@item cpoints = @i{} [, (@i{})] | (@i{}) + @result{} @pxref{funct:unur_ars_set_cpoints,,@command{unur_ars_set_cpoints}} +@item max_intervals [= @i{}] + @result{} @pxref{funct:unur_ars_set_max_intervals,,@command{unur_ars_set_max_intervals}} +@item max_iter [= @i{}] + @result{} @pxref{funct:unur_ars_set_max_iter,,@command{unur_ars_set_max_iter}} +@item pedantic [= @i{}] + @result{} @pxref{funct:unur_ars_set_pedantic,,@command{unur_ars_set_pedantic}} +@item reinit_ncpoints [= @i{}] + @result{} @pxref{funct:unur_ars_set_reinit_ncpoints,,@command{unur_ars_set_reinit_ncpoints}} +@item reinit_percentiles = @i{} [, (@i{})] | (@i{}) + @result{} @pxref{funct:unur_ars_set_reinit_percentiles,,@command{unur_ars_set_reinit_percentiles}} +@item verify [= @i{}] + @result{} @pxref{funct:unur_ars_set_verify,,@command{unur_ars_set_verify}} +@end table + +@item @code{method = auto} @ @ @ @ @result{} @command{unur_auto_new} +(@pxref{AUTO}) +@table @code +@item logss [= @i{}] + @result{} @pxref{funct:unur_auto_set_logss,,@command{unur_auto_set_logss}} +@end table + +@item @code{method = cstd} @ @ @ @ @result{} @command{unur_cstd_new} +(@pxref{CSTD}) +@table @code +@item variant = @i{} + @result{} @pxref{funct:unur_cstd_set_variant,,@command{unur_cstd_set_variant}} +@end table + +@item @code{method = dari} @ @ @ @ @result{} @command{unur_dari_new} +(@pxref{DARI}) +@table @code +@item cpfactor = @i{} + @result{} @pxref{funct:unur_dari_set_cpfactor,,@command{unur_dari_set_cpfactor}} +@item squeeze [= @i{}] + @result{} @pxref{funct:unur_dari_set_squeeze,,@command{unur_dari_set_squeeze}} +@item tablesize [= @i{}] + @result{} @pxref{funct:unur_dari_set_tablesize,,@command{unur_dari_set_tablesize}} +@item verify [= @i{}] + @result{} @pxref{funct:unur_dari_set_verify,,@command{unur_dari_set_verify}} +@end table + +@item @code{method = dau} @ @ @ @ @result{} @command{unur_dau_new} +(@pxref{DAU}) +@table @code +@item urnfactor = @i{} + @result{} @pxref{funct:unur_dau_set_urnfactor,,@command{unur_dau_set_urnfactor}} +@end table + +@item @code{method = dgt} @ @ @ @ @result{} @command{unur_dgt_new} +(@pxref{DGT}) +@table @code +@item guidefactor = @i{} + @result{} @pxref{funct:unur_dgt_set_guidefactor,,@command{unur_dgt_set_guidefactor}} +@item variant = @i{} + @result{} @pxref{funct:unur_dgt_set_variant,,@command{unur_dgt_set_variant}} +@end table + +@item @code{method = dsrou} @ @ @ @ @result{} @command{unur_dsrou_new} +(@pxref{DSROU}) +@table @code +@item cdfatmode = @i{} + @result{} @pxref{funct:unur_dsrou_set_cdfatmode,,@command{unur_dsrou_set_cdfatmode}} +@item verify [= @i{}] + @result{} @pxref{funct:unur_dsrou_set_verify,,@command{unur_dsrou_set_verify}} +@end table + +@item @code{method = dstd} @ @ @ @ @result{} @command{unur_dstd_new} +(@pxref{DSTD}) +@table @code +@item variant = @i{} + @result{} @pxref{funct:unur_dstd_set_variant,,@command{unur_dstd_set_variant}} +@end table + +@item @code{method = empk} @ @ @ @ @result{} @command{unur_empk_new} +(@pxref{EMPK}) +@table @code +@item beta = @i{} + @result{} @pxref{funct:unur_empk_set_beta,,@command{unur_empk_set_beta}} +@item kernel = @i{} + @result{} @pxref{funct:unur_empk_set_kernel,,@command{unur_empk_set_kernel}} +@item positive [= @i{}] + @result{} @pxref{funct:unur_empk_set_positive,,@command{unur_empk_set_positive}} +@item smoothing = @i{} + @result{} @pxref{funct:unur_empk_set_smoothing,,@command{unur_empk_set_smoothing}} +@item varcor [= @i{}] + @result{} @pxref{funct:unur_empk_set_varcor,,@command{unur_empk_set_varcor}} +@end table + +@item @code{method = gibbs} @ @ @ @ @result{} @command{unur_gibbs_new} +(@pxref{GIBBS}) +@table @code +@item burnin [= @i{}] + @result{} @pxref{funct:unur_gibbs_set_burnin,,@command{unur_gibbs_set_burnin}} +@item c = @i{} + @result{} @pxref{funct:unur_gibbs_set_c,,@command{unur_gibbs_set_c}} +@item thinning [= @i{}] + @result{} @pxref{funct:unur_gibbs_set_thinning,,@command{unur_gibbs_set_thinning}} +@item variant_coordinate + @result{} @pxref{funct:unur_gibbs_set_variant_coordinate,,@command{unur_gibbs_set_variant_coordinate}} +@item variant_random_direction + @result{} @pxref{funct:unur_gibbs_set_variant_random_direction,,@command{unur_gibbs_set_variant_random_direction}} +@end table + +@item @code{method = hinv} @ @ @ @ @result{} @command{unur_hinv_new} +(@pxref{HINV}) +@table @code +@item boundary = @i{}, @i{} | (@i{}) + @result{} @pxref{funct:unur_hinv_set_boundary,,@command{unur_hinv_set_boundary}} +@item cpoints = (@i{}), @i{} + @result{} @pxref{funct:unur_hinv_set_cpoints,,@command{unur_hinv_set_cpoints}} +@item guidefactor = @i{} + @result{} @pxref{funct:unur_hinv_set_guidefactor,,@command{unur_hinv_set_guidefactor}} +@item max_intervals [= @i{}] + @result{} @pxref{funct:unur_hinv_set_max_intervals,,@command{unur_hinv_set_max_intervals}} +@item order [= @i{}] + @result{} @pxref{funct:unur_hinv_set_order,,@command{unur_hinv_set_order}} +@item u_resolution = @i{} + @result{} @pxref{funct:unur_hinv_set_u_resolution,,@command{unur_hinv_set_u_resolution}} +@end table + +@item @code{method = hitro} @ @ @ @ @result{} @command{unur_hitro_new} +(@pxref{HITRO}) +@table @code +@item adaptive_multiplier = @i{} + @result{} @pxref{funct:unur_hitro_set_adaptive_multiplier,,@command{unur_hitro_set_adaptive_multiplier}} +@item burnin [= @i{}] + @result{} @pxref{funct:unur_hitro_set_burnin,,@command{unur_hitro_set_burnin}} +@item r = @i{} + @result{} @pxref{funct:unur_hitro_set_r,,@command{unur_hitro_set_r}} +@item thinning [= @i{}] + @result{} @pxref{funct:unur_hitro_set_thinning,,@command{unur_hitro_set_thinning}} +@item use_adaptiveline [= @i{}] + @result{} @pxref{funct:unur_hitro_set_use_adaptiveline,,@command{unur_hitro_set_use_adaptiveline}} +@item use_adaptiverectangle [= @i{}] + @result{} @pxref{funct:unur_hitro_set_use_adaptiverectangle,,@command{unur_hitro_set_use_adaptiverectangle}} +@item use_boundingrectangle [= @i{}] + @result{} @pxref{funct:unur_hitro_set_use_boundingrectangle,,@command{unur_hitro_set_use_boundingrectangle}} +@item v = @i{} + @result{} @pxref{funct:unur_hitro_set_v,,@command{unur_hitro_set_v}} +@item variant_coordinate + @result{} @pxref{funct:unur_hitro_set_variant_coordinate,,@command{unur_hitro_set_variant_coordinate}} +@item variant_random_direction + @result{} @pxref{funct:unur_hitro_set_variant_random_direction,,@command{unur_hitro_set_variant_random_direction}} +@end table + +@item @code{method = hrb} @ @ @ @ @result{} @command{unur_hrb_new} +(@pxref{HRB}) +@table @code +@item upperbound = @i{} + @result{} @pxref{funct:unur_hrb_set_upperbound,,@command{unur_hrb_set_upperbound}} +@item verify [= @i{}] + @result{} @pxref{funct:unur_hrb_set_verify,,@command{unur_hrb_set_verify}} +@end table + +@item @code{method = hrd} @ @ @ @ @result{} @command{unur_hrd_new} +(@pxref{HRD}) +@table @code +@item verify [= @i{}] + @result{} @pxref{funct:unur_hrd_set_verify,,@command{unur_hrd_set_verify}} +@end table + +@item @code{method = hri} @ @ @ @ @result{} @command{unur_hri_new} +(@pxref{HRI}) +@table @code +@item p0 = @i{} + @result{} @pxref{funct:unur_hri_set_p0,,@command{unur_hri_set_p0}} +@item verify [= @i{}] + @result{} @pxref{funct:unur_hri_set_verify,,@command{unur_hri_set_verify}} +@end table + +@item @code{method = itdr} @ @ @ @ @result{} @command{unur_itdr_new} +(@pxref{ITDR}) +@table @code +@item cp = @i{} + @result{} @pxref{funct:unur_itdr_set_cp,,@command{unur_itdr_set_cp}} +@item ct = @i{} + @result{} @pxref{funct:unur_itdr_set_ct,,@command{unur_itdr_set_ct}} +@item verify [= @i{}] + @result{} @pxref{funct:unur_itdr_set_verify,,@command{unur_itdr_set_verify}} +@item xi = @i{} + @result{} @pxref{funct:unur_itdr_set_xi,,@command{unur_itdr_set_xi}} +@end table + +@item @code{method = mvtdr} @ @ @ @ @result{} @command{unur_mvtdr_new} +(@pxref{MVTDR}) +@table @code +@item boundsplitting = @i{} + @result{} @pxref{funct:unur_mvtdr_set_boundsplitting,,@command{unur_mvtdr_set_boundsplitting}} +@item maxcones [= @i{}] + @result{} @pxref{funct:unur_mvtdr_set_maxcones,,@command{unur_mvtdr_set_maxcones}} +@item stepsmin [= @i{}] + @result{} @pxref{funct:unur_mvtdr_set_stepsmin,,@command{unur_mvtdr_set_stepsmin}} +@item verify [= @i{}] + @result{} @pxref{funct:unur_mvtdr_set_verify,,@command{unur_mvtdr_set_verify}} +@end table + +@item @code{method = ninv} @ @ @ @ @result{} @command{unur_ninv_new} +(@pxref{NINV}) +@table @code +@item max_iter [= @i{}] + @result{} @pxref{funct:unur_ninv_set_max_iter,,@command{unur_ninv_set_max_iter}} +@item start = @i{}, @i{} | (@i{}) + @result{} @pxref{funct:unur_ninv_set_start,,@command{unur_ninv_set_start}} +@item table [= @i{}] + @result{} @pxref{funct:unur_ninv_set_table,,@command{unur_ninv_set_table}} +@item u_resolution = @i{} + @result{} @pxref{funct:unur_ninv_set_u_resolution,,@command{unur_ninv_set_u_resolution}} +@item usebisect + @result{} @pxref{funct:unur_ninv_set_usebisect,,@command{unur_ninv_set_usebisect}} +@item usenewton + @result{} @pxref{funct:unur_ninv_set_usenewton,,@command{unur_ninv_set_usenewton}} +@item useregula + @result{} @pxref{funct:unur_ninv_set_useregula,,@command{unur_ninv_set_useregula}} +@item x_resolution = @i{} + @result{} @pxref{funct:unur_ninv_set_x_resolution,,@command{unur_ninv_set_x_resolution}} +@end table + +@item @code{method = nrou} @ @ @ @ @result{} @command{unur_nrou_new} +(@pxref{NROU}) +@table @code +@item center = @i{} + @result{} @pxref{funct:unur_nrou_set_center,,@command{unur_nrou_set_center}} +@item r = @i{} + @result{} @pxref{funct:unur_nrou_set_r,,@command{unur_nrou_set_r}} +@item u = @i{}, @i{} | (@i{}) + @result{} @pxref{funct:unur_nrou_set_u,,@command{unur_nrou_set_u}} +@item v = @i{} + @result{} @pxref{funct:unur_nrou_set_v,,@command{unur_nrou_set_v}} +@item verify [= @i{}] + @result{} @pxref{funct:unur_nrou_set_verify,,@command{unur_nrou_set_verify}} +@end table + +@item @code{method = pinv} @ @ @ @ @result{} @command{unur_pinv_new} +(@pxref{PINV}) +@table @code +@item boundary = @i{}, @i{} | (@i{}) + @result{} @pxref{funct:unur_pinv_set_boundary,,@command{unur_pinv_set_boundary}} +@item extra_testpoints [= @i{}] + @result{} @pxref{funct:unur_pinv_set_extra_testpoints,,@command{unur_pinv_set_extra_testpoints}} +@item keepcdf [= @i{}] + @result{} @pxref{funct:unur_pinv_set_keepcdf,,@command{unur_pinv_set_keepcdf}} +@item max_intervals [= @i{}] + @result{} @pxref{funct:unur_pinv_set_max_intervals,,@command{unur_pinv_set_max_intervals}} +@item order [= @i{}] + @result{} @pxref{funct:unur_pinv_set_order,,@command{unur_pinv_set_order}} +@item searchboundary = @i{}, @i{} | (@i{}) + @result{} @pxref{funct:unur_pinv_set_searchboundary,,@command{unur_pinv_set_searchboundary}} +@item smoothness [= @i{}] + @result{} @pxref{funct:unur_pinv_set_smoothness,,@command{unur_pinv_set_smoothness}} +@item u_resolution = @i{} + @result{} @pxref{funct:unur_pinv_set_u_resolution,,@command{unur_pinv_set_u_resolution}} +@item use_upoints [= @i{}] + @result{} @pxref{funct:unur_pinv_set_use_upoints,,@command{unur_pinv_set_use_upoints}} +@item usecdf + @result{} @pxref{funct:unur_pinv_set_usecdf,,@command{unur_pinv_set_usecdf}} +@item usepdf + @result{} @pxref{funct:unur_pinv_set_usepdf,,@command{unur_pinv_set_usepdf}} +@end table + +@item @code{method = srou} @ @ @ @ @result{} @command{unur_srou_new} +(@pxref{SROU}) +@table @code +@item cdfatmode = @i{} + @result{} @pxref{funct:unur_srou_set_cdfatmode,,@command{unur_srou_set_cdfatmode}} +@item pdfatmode = @i{} + @result{} @pxref{funct:unur_srou_set_pdfatmode,,@command{unur_srou_set_pdfatmode}} +@item r = @i{} + @result{} @pxref{funct:unur_srou_set_r,,@command{unur_srou_set_r}} +@item usemirror [= @i{}] + @result{} @pxref{funct:unur_srou_set_usemirror,,@command{unur_srou_set_usemirror}} +@item usesqueeze [= @i{}] + @result{} @pxref{funct:unur_srou_set_usesqueeze,,@command{unur_srou_set_usesqueeze}} +@item verify [= @i{}] + @result{} @pxref{funct:unur_srou_set_verify,,@command{unur_srou_set_verify}} +@end table + +@item @code{method = ssr} @ @ @ @ @result{} @command{unur_ssr_new} +(@pxref{SSR}) +@table @code +@item cdfatmode = @i{} + @result{} @pxref{funct:unur_ssr_set_cdfatmode,,@command{unur_ssr_set_cdfatmode}} +@item pdfatmode = @i{} + @result{} @pxref{funct:unur_ssr_set_pdfatmode,,@command{unur_ssr_set_pdfatmode}} +@item usesqueeze [= @i{}] + @result{} @pxref{funct:unur_ssr_set_usesqueeze,,@command{unur_ssr_set_usesqueeze}} +@item verify [= @i{}] + @result{} @pxref{funct:unur_ssr_set_verify,,@command{unur_ssr_set_verify}} +@end table + +@item @code{method = tabl} @ @ @ @ @result{} @command{unur_tabl_new} +(@pxref{TABL}) +@table @code +@item areafraction = @i{} + @result{} @pxref{funct:unur_tabl_set_areafraction,,@command{unur_tabl_set_areafraction}} +@item boundary = @i{}, @i{} | (@i{}) + @result{} @pxref{funct:unur_tabl_set_boundary,,@command{unur_tabl_set_boundary}} +@item cpoints = @i{} [, (@i{})] | (@i{}) + @result{} @pxref{funct:unur_tabl_set_cpoints,,@command{unur_tabl_set_cpoints}} +@item darsfactor = @i{} + @result{} @pxref{funct:unur_tabl_set_darsfactor,,@command{unur_tabl_set_darsfactor}} +@item guidefactor = @i{} + @result{} @pxref{funct:unur_tabl_set_guidefactor,,@command{unur_tabl_set_guidefactor}} +@item max_intervals [= @i{}] + @result{} @pxref{funct:unur_tabl_set_max_intervals,,@command{unur_tabl_set_max_intervals}} +@item max_sqhratio = @i{} + @result{} @pxref{funct:unur_tabl_set_max_sqhratio,,@command{unur_tabl_set_max_sqhratio}} +@item nstp [= @i{}] + @result{} @pxref{funct:unur_tabl_set_nstp,,@command{unur_tabl_set_nstp}} +@item pedantic [= @i{}] + @result{} @pxref{funct:unur_tabl_set_pedantic,,@command{unur_tabl_set_pedantic}} +@item slopes = (@i{}), @i{} + @result{} @pxref{funct:unur_tabl_set_slopes,,@command{unur_tabl_set_slopes}} +@item usedars [= @i{}] + @result{} @pxref{funct:unur_tabl_set_usedars,,@command{unur_tabl_set_usedars}} +@item useear [= @i{}] + @result{} @pxref{funct:unur_tabl_set_useear,,@command{unur_tabl_set_useear}} +@item variant_ia [= @i{}] + @result{} @pxref{funct:unur_tabl_set_variant_ia,,@command{unur_tabl_set_variant_ia}} +@item variant_splitmode = @i{} + @result{} @pxref{funct:unur_tabl_set_variant_splitmode,,@command{unur_tabl_set_variant_splitmode}} +@item verify [= @i{}] + @result{} @pxref{funct:unur_tabl_set_verify,,@command{unur_tabl_set_verify}} +@end table + +@item @code{method = tdr} @ @ @ @ @result{} @command{unur_tdr_new} +(@pxref{TDR}) +@table @code +@item c = @i{} + @result{} @pxref{funct:unur_tdr_set_c,,@command{unur_tdr_set_c}} +@item cpoints = @i{} [, (@i{})] | (@i{}) + @result{} @pxref{funct:unur_tdr_set_cpoints,,@command{unur_tdr_set_cpoints}} +@item darsfactor = @i{} + @result{} @pxref{funct:unur_tdr_set_darsfactor,,@command{unur_tdr_set_darsfactor}} +@item guidefactor = @i{} + @result{} @pxref{funct:unur_tdr_set_guidefactor,,@command{unur_tdr_set_guidefactor}} +@item max_intervals [= @i{}] + @result{} @pxref{funct:unur_tdr_set_max_intervals,,@command{unur_tdr_set_max_intervals}} +@item max_sqhratio = @i{} + @result{} @pxref{funct:unur_tdr_set_max_sqhratio,,@command{unur_tdr_set_max_sqhratio}} +@item pedantic [= @i{}] + @result{} @pxref{funct:unur_tdr_set_pedantic,,@command{unur_tdr_set_pedantic}} +@item reinit_ncpoints [= @i{}] + @result{} @pxref{funct:unur_tdr_set_reinit_ncpoints,,@command{unur_tdr_set_reinit_ncpoints}} +@item reinit_percentiles = @i{} [, (@i{})] | (@i{}) + @result{} @pxref{funct:unur_tdr_set_reinit_percentiles,,@command{unur_tdr_set_reinit_percentiles}} +@item usecenter [= @i{}] + @result{} @pxref{funct:unur_tdr_set_usecenter,,@command{unur_tdr_set_usecenter}} +@item usedars [= @i{}] + @result{} @pxref{funct:unur_tdr_set_usedars,,@command{unur_tdr_set_usedars}} +@item usemode [= @i{}] + @result{} @pxref{funct:unur_tdr_set_usemode,,@command{unur_tdr_set_usemode}} +@item variant_gw + @result{} @pxref{funct:unur_tdr_set_variant_gw,,@command{unur_tdr_set_variant_gw}} +@item variant_ia + @result{} @pxref{funct:unur_tdr_set_variant_ia,,@command{unur_tdr_set_variant_ia}} +@item variant_ps + @result{} @pxref{funct:unur_tdr_set_variant_ps,,@command{unur_tdr_set_variant_ps}} +@item verify [= @i{}] + @result{} @pxref{funct:unur_tdr_set_verify,,@command{unur_tdr_set_verify}} +@end table + +@item @code{method = utdr} @ @ @ @ @result{} @command{unur_utdr_new} +(@pxref{UTDR}) +@table @code +@item cpfactor = @i{} + @result{} @pxref{funct:unur_utdr_set_cpfactor,,@command{unur_utdr_set_cpfactor}} +@item deltafactor = @i{} + @result{} @pxref{funct:unur_utdr_set_deltafactor,,@command{unur_utdr_set_deltafactor}} +@item pdfatmode = @i{} + @result{} @pxref{funct:unur_utdr_set_pdfatmode,,@command{unur_utdr_set_pdfatmode}} +@item verify [= @i{}] + @result{} @pxref{funct:unur_utdr_set_verify,,@command{unur_utdr_set_verify}} +@end table + +@item @code{method = vempk} @ @ @ @ @result{} @command{unur_vempk_new} +(@pxref{VEMPK}) +@table @code +@item smoothing = @i{} + @result{} @pxref{funct:unur_vempk_set_smoothing,,@command{unur_vempk_set_smoothing}} +@item varcor [= @i{}] + @result{} @pxref{funct:unur_vempk_set_varcor,,@command{unur_vempk_set_varcor}} +@end table + +@item @code{method = vnrou} @ @ @ @ @result{} @command{unur_vnrou_new} +(@pxref{VNROU}) +@table @code +@item r = @i{} + @result{} @pxref{funct:unur_vnrou_set_r,,@command{unur_vnrou_set_r}} +@item v = @i{} + @result{} @pxref{funct:unur_vnrou_set_v,,@command{unur_vnrou_set_v}} +@item verify [= @i{}] + @result{} @pxref{funct:unur_vnrou_set_verify,,@command{unur_vnrou_set_verify}} +@end table + +@end itemize + + +=EON +*/ diff --git a/vendor/unuran-1.11.0/src/parser/stringparser_lists.ch b/vendor/unuran-1.11.0/src/parser/stringparser_lists.ch new file mode 100644 index 0000000..8003958 --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/stringparser_lists.ch @@ -0,0 +1,1928 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: stringparser_lists.ch.in / stringparser_lists.ch * + * * + * * + * DESCRIPTION: * + * * + * Switch lists for string parser. * + * (See file stringparser.c) * + * * + ***************************************************************************** + * * + * This file is parsed by the perl script make_stringparser.pl which * + * replaces the * + * =INPUT keyword * + * tags with search lists created from the information found within the * + * header files of the source code. * + * These lists (implemented via 'if' rules together with switch lists to * + * with the first letter of the set calls as simple hash function) are * + * used to call the corresponding ..._set and ..._new calls for the * + * the keywords found in the string. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + + +/*****************************************************************************/ +/** Distributions **/ +/*****************************************************************************/ + +struct unur_distr * +_unur_str_distr_new( char *distribution ) + /*----------------------------------------------------------------------*/ + /* get new distribution object */ + /* */ + /* parameters: */ + /* distribution ... string that contains distribution name */ + /* params ... string that contains list of parameters */ + /* */ + /* return: */ + /* distribution object (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_distr *distr = NULL; /* pointer to distribution object */ + char distr_unknown; + +#ifdef UNUR_ENABLE_LOGGING + char *name; /* pointer to name of distribution */ +#endif + char *params; /* pointer to parameter list of distr */ + + double *darray = NULL; /* array of arguments for distribution */ + int n_darray = 0; /* size of array of parameters */ + +#ifdef UNUR_ENABLE_LOGGING + /* name of distribution */ + name = distribution; +#endif + + /* get parameter list */ + params = strchr(distribution,'('); + if (params != NULL) { + *params = '\0'; /* terminate key string */ + ++params; /* set pointer to value string */ + } + + /* get parameter list */ + n_darray = _unur_parse_dlist(params, &darray ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_distr(1,name,darray,n_darray); +#endif + + /* mark distribution as unknown (this is a very ugly hack) */ + distr = (struct unur_distr *) &distr_unknown; + + switch (*distribution) { + case 'b': + if ( !strcmp( distribution, "beta") ) { + distr = unur_distr_beta (darray,n_darray); + break; + } + if ( !strcmp( distribution, "binomial") ) { + distr = unur_distr_binomial (darray,n_darray); + break; + } + break; + case 'c': + if ( !strcmp( distribution, "cauchy") ) { + distr = unur_distr_cauchy (darray,n_darray); + break; + } + if ( !strcmp( distribution, "chi") ) { + distr = unur_distr_chi (darray,n_darray); + break; + } + if ( !strcmp( distribution, "chisquare") ) { + distr = unur_distr_chisquare (darray,n_darray); + break; + } + break; + case 'e': + if ( !strcmp( distribution, "exponential") ) { + distr = unur_distr_exponential (darray,n_darray); + break; + } + if ( !strcmp( distribution, "extremei") ) { + distr = unur_distr_extremeI (darray,n_darray); + break; + } + if ( !strcmp( distribution, "extremeii") ) { + distr = unur_distr_extremeII (darray,n_darray); + break; + } + break; + case 'f': + if ( !strcmp( distribution, "f") ) { + distr = unur_distr_F (darray,n_darray); + break; + } + break; + case 'g': + if ( !strcmp( distribution, "gamma") ) { + distr = unur_distr_gamma (darray,n_darray); + break; + } + if ( !strcmp( distribution, "geometric") ) { + distr = unur_distr_geometric (darray,n_darray); + break; + } + if ( !strcmp( distribution, "gig") ) { + distr = unur_distr_gig (darray,n_darray); + break; + } + if ( !strcmp( distribution, "gig2") ) { + distr = unur_distr_gig2 (darray,n_darray); + break; + } + break; + case 'h': + if ( !strcmp( distribution, "hyperbolic") ) { + distr = unur_distr_hyperbolic (darray,n_darray); + break; + } + if ( !strcmp( distribution, "hypergeometric") ) { + distr = unur_distr_hypergeometric (darray,n_darray); + break; + } + break; + case 'i': + if ( !strcmp( distribution, "ig") ) { + distr = unur_distr_ig (darray,n_darray); + break; + } + break; + case 'l': + if ( !strcmp( distribution, "laplace") ) { + distr = unur_distr_laplace (darray,n_darray); + break; + } + if ( !strcmp( distribution, "logarithmic") ) { + distr = unur_distr_logarithmic (darray,n_darray); + break; + } + if ( !strcmp( distribution, "logistic") ) { + distr = unur_distr_logistic (darray,n_darray); + break; + } + if ( !strcmp( distribution, "lognormal") ) { + distr = unur_distr_lognormal (darray,n_darray); + break; + } + if ( !strcmp( distribution, "lomax") ) { + distr = unur_distr_lomax (darray,n_darray); + break; + } + break; + case 'n': + if ( !strcmp( distribution, "negativebinomial") ) { + distr = unur_distr_negativebinomial (darray,n_darray); + break; + } + if ( !strcmp( distribution, "normal") ) { + distr = unur_distr_normal (darray,n_darray); + break; + } + break; + case 'p': + if ( !strcmp( distribution, "pareto") ) { + distr = unur_distr_pareto (darray,n_darray); + break; + } + if ( !strcmp( distribution, "poisson") ) { + distr = unur_distr_poisson (darray,n_darray); + break; + } + if ( !strcmp( distribution, "powerexponential") ) { + distr = unur_distr_powerexponential (darray,n_darray); + break; + } + break; + case 'r': + if ( !strcmp( distribution, "rayleigh") ) { + distr = unur_distr_rayleigh (darray,n_darray); + break; + } + break; + case 's': + if ( !strcmp( distribution, "slash") ) { + distr = unur_distr_slash (darray,n_darray); + break; + } + if ( !strcmp( distribution, "student") ) { + distr = unur_distr_student (darray,n_darray); + break; + } + break; + case 't': + if ( !strcmp( distribution, "triangular") ) { + distr = unur_distr_triangular (darray,n_darray); + break; + } + break; + case 'u': + if ( !strcmp( distribution, "uniform") ) { + distr = unur_distr_uniform (darray,n_darray); + break; + } + break; + case 'w': + if ( !strcmp( distribution, "weibull") ) { + distr = unur_distr_weibull (darray,n_darray); + break; + } + } + + /* get pointer to generic distribution object */ + if (distr == (struct unur_distr *) &distr_unknown) { + do { + if ( !strcmp( distribution, "cemp") ) { + distr = unur_distr_cemp_new(); + break; + } + if ( !strcmp( distribution, "cont") ) { + distr = unur_distr_cont_new(); + break; + } + if ( !strcmp( distribution, "discr") ) { + distr = unur_distr_discr_new(); + break; + } + } while (0); + } + + + if (distr == (struct unur_distr *) &distr_unknown) { + /* unknown method */ + _unur_error_unknown(distribution,"distribution"); + distr = NULL; + } + else if (distr == NULL) { + /* invalid data for chosen method */ + _unur_error_invalid(distribution,"distribution"); + } + + /* clear memory */ + if (darray) free(darray); + + /* return result */ + return distr; + +} /* end of _unur_str_distr_new() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_str_distr_set( UNUR_DISTR **ptr_distr, const char *key, char *value ) + /*----------------------------------------------------------------------*/ + /* set parameters for distribution */ + /* */ + /* it also makes a distribution object for an order statistics for */ + /* the given distribution when the key word "orderstatistics" occurs. */ + /* Thus the distribution object itself might be changed. */ + /* */ + /* parameters: */ + /* ptr_distr ... holds pointer to distribution object */ + /* key ... string that contains key for parameter */ + /* value ... string that contains list of arguments for parameter */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* error: */ + /* return error code */ + /*----------------------------------------------------------------------*/ +{ + int result; /* result of UNU.RAN set call */ + + /* derefence pointer to distribution object */ + struct unur_distr *distr = *ptr_distr; + + /* storing arguments of set calls: */ + char type_args[MAX_SET_ARGS+1]; /* array containing info about arguments */ + char *args[MAX_SET_ARGS+1]; /* pointers to argument strings */ + + /* tokenize argument string */ + if (_unur_str_set_args( value, type_args, args, MAX_SET_ARGS ) < 0) { + /* error */ + return UNUR_ERR_STR_SYNTAX; + } + + /* set result indicator to unknown */ + result = UNUR_ERR_STR_UNKNOWN; + + /* find and execute set call */ + + switch (distr->type) { + case UNUR_DISTR_CEMP: + switch (*key) { + case 'd': + if ( !strcmp(key, "data") ) { + /* n = 2; type = Di: UNUR_DISTR *distribution, const double *sample, int n_sample */ + result = _unur_str_distr_set_Di(distr,key,type_args,args,unur_distr_cemp_set_data); + break; + } + break; + case 'h': + if ( !strcmp(key, "hist_bins") ) { + /* n = 2; type = Di: UNUR_DISTR *distribution, const double *bins, int n_bins */ + result = _unur_str_distr_set_Di(distr,key,type_args,args,unur_distr_cemp_set_hist_bins); + break; + } + if ( !strcmp(key, "hist_domain") ) { + /* n = 2; type = dd: UNUR_DISTR *distribution, double xmin, double xmax */ + result = _unur_str_distr_set_dd(distr,key,type_args,args,unur_distr_cemp_set_hist_domain); + break; + } + if ( !strcmp(key, "hist_prob") ) { + /* n = 2; type = Di: UNUR_DISTR *distribution, const double *prob, int n_prob */ + result = _unur_str_distr_set_Di(distr,key,type_args,args,unur_distr_cemp_set_hist_prob); + break; + } + } + break; + case UNUR_DISTR_CONT: + switch (*key) { + case 'c': + if ( !strcmp(key, "cdf") ) { + /* n = 1; type = C: UNUR_DISTR *distribution, const char *cdfstr */ + result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_cdfstr); + break; + } + if ( !strcmp(key, "cdfstr") ) { + /* n = 1; type = C: UNUR_DISTR *distribution, const char *cdfstr */ + result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_cdfstr); + break; + } + if ( !strcmp(key, "center") ) { + /* n = 1; type = d: UNUR_DISTR *distribution, double center */ + result = _unur_str_distr_set_d(distr,key,type_args,args,unur_distr_cont_set_center); + break; + } + break; + case 'd': + if ( !strcmp(key, "domain") ) { + /* n = 2; type = dd: UNUR_DISTR *distribution, double left, double right */ + result = _unur_str_distr_set_dd(distr,key,type_args,args,unur_distr_cont_set_domain); + break; + } + break; + case 'h': + if ( !strcmp(key, "hr") ) { + /* n = 1; type = C: UNUR_DISTR *distribution, const char *hrstr */ + result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_hrstr); + break; + } + if ( !strcmp(key, "hrstr") ) { + /* n = 1; type = C: UNUR_DISTR *distribution, const char *hrstr */ + result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_hrstr); + break; + } + break; + case 'l': + if ( !strcmp(key, "logcdf") ) { + /* n = 1; type = C: UNUR_DISTR *distribution, const char *logcdfstr */ + result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_logcdfstr); + break; + } + if ( !strcmp(key, "logcdfstr") ) { + /* n = 1; type = C: UNUR_DISTR *distribution, const char *logcdfstr */ + result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_logcdfstr); + break; + } + if ( !strcmp(key, "logpdf") ) { + /* n = 1; type = C: UNUR_DISTR *distribution, const char *logpdfstr */ + result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_logpdfstr); + break; + } + if ( !strcmp(key, "logpdfstr") ) { + /* n = 1; type = C: UNUR_DISTR *distribution, const char *logpdfstr */ + result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_logpdfstr); + break; + } + break; + case 'm': + if ( !strcmp(key, "mode") ) { + /* n = 1; type = d: UNUR_DISTR *distribution, double mode */ + result = _unur_str_distr_set_d(distr,key,type_args,args,unur_distr_cont_set_mode); + break; + } + break; + case 'p': + if ( !strcmp(key, "pdf") ) { + /* n = 1; type = C: UNUR_DISTR *distribution, const char *pdfstr */ + result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_pdfstr); + break; + } + if ( !strcmp(key, "pdfarea") ) { + /* n = 1; type = d: UNUR_DISTR *distribution, double area */ + result = _unur_str_distr_set_d(distr,key,type_args,args,unur_distr_cont_set_pdfarea); + break; + } + if ( !strcmp(key, "pdfparams") ) { + /* n = 2; type = Di: UNUR_DISTR *distribution, const double *params, int n_params */ + result = _unur_str_distr_set_Di(distr,key,type_args,args,unur_distr_cont_set_pdfparams); + break; + } + if ( !strcmp(key, "pdfstr") ) { + /* n = 1; type = C: UNUR_DISTR *distribution, const char *pdfstr */ + result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_pdfstr); + break; + } + } + break; + case UNUR_DISTR_DISCR: + switch (*key) { + case 'c': + if ( !strcmp(key, "cdf") ) { + /* n = 1; type = C: UNUR_DISTR *distribution, const char *cdfstr */ + result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_discr_set_cdfstr); + break; + } + if ( !strcmp(key, "cdfstr") ) { + /* n = 1; type = C: UNUR_DISTR *distribution, const char *cdfstr */ + result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_discr_set_cdfstr); + break; + } + break; + case 'd': + if ( !strcmp(key, "domain") ) { + /* n = 2; type = ii: UNUR_DISTR *distribution, int left, int right */ + result = _unur_str_distr_set_ii(distr,key,type_args,args,unur_distr_discr_set_domain); + break; + } + break; + case 'm': + if ( !strcmp(key, "mode") ) { + /* n = 1; type = i: UNUR_DISTR *distribution, int mode */ + result = _unur_str_distr_set_i(distr,key,type_args,args,unur_distr_discr_set_mode); + break; + } + break; + case 'p': + if ( !strcmp(key, "pmf") ) { + /* n = 1; type = C: UNUR_DISTR *distribution, const char *pmfstr */ + result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_discr_set_pmfstr); + break; + } + if ( !strcmp(key, "pmfparams") ) { + /* n = 2; type = Di: UNUR_DISTR *distribution, const double *params, int n_params */ + result = _unur_str_distr_set_Di(distr,key,type_args,args,unur_distr_discr_set_pmfparams); + break; + } + if ( !strcmp(key, "pmfstr") ) { + /* n = 1; type = C: UNUR_DISTR *distribution, const char *pmfstr */ + result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_discr_set_pmfstr); + break; + } + if ( !strcmp(key, "pmfsum") ) { + /* n = 1; type = d: UNUR_DISTR *distribution, double sum */ + result = _unur_str_distr_set_d(distr,key,type_args,args,unur_distr_discr_set_pmfsum); + break; + } + if ( !strcmp(key, "pv") ) { + /* n = 2; type = Di: UNUR_DISTR *distribution, const double *pv, int n_pv */ + result = _unur_str_distr_set_Di(distr,key,type_args,args,unur_distr_discr_set_pv); + break; + } + } + break; + } + + /* set calls for all distribution types */ + if (result == UNUR_ERR_STR_UNKNOWN) { + switch (*key) { + case 'n': + if ( !strcmp(key, "name") ) { + /* n = 1; type = C: UNUR_DISTR *distribution, const char *name */ + result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_set_name); + break; + } + } + } + + + /* Ignored set commands: */ + /* int unur_distr_cont_set_pdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *pdf ); + n = 1; type = ? */ + /* int unur_distr_cont_set_dpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *dpdf ); + n = 1; type = ? */ + /* int unur_distr_cont_set_cdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *cdf ); + n = 1; type = ? */ + /* int unur_distr_cont_set_logpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *logpdf ); + n = 1; type = ? */ + /* int unur_distr_cont_set_dlogpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *dlogpdf ); + n = 1; type = ? */ + /* int unur_distr_cont_set_logcdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *logcdf ); + n = 1; type = ? */ + /* int unur_distr_cont_set_hr( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *hazard ); + n = 1; type = ? */ + /* int unur_distr_discr_set_pmf( UNUR_DISTR *distribution, UNUR_FUNCT_DISCR *pmf ); + n = 1; type = ? */ + /* int unur_distr_discr_set_cdf( UNUR_DISTR *distribution, UNUR_FUNCT_DISCR *cdf ); + n = 1; type = ? */ + /* int unur_distr_set_extobj( UNUR_DISTR *distribution, const void *extobj ); + n = 1; type = ? */ + + + /* Subsituted set commands: */ + /* int unur_distr_cont_set_pdfstr( UNUR_DISTR *distribution, const char *pdfstr ); + n = 1; type = C */ + /* int unur_distr_cont_set_cdfstr( UNUR_DISTR *distribution, const char *cdfstr ); + n = 1; type = C */ + /* int unur_distr_cont_set_logpdfstr( UNUR_DISTR *distribution, const char *logpdfstr ); + n = 1; type = C */ + /* int unur_distr_cont_set_logcdfstr( UNUR_DISTR *distribution, const char *logcdfstr ); + n = 1; type = C */ + /* int unur_distr_cont_set_hrstr( UNUR_DISTR *distribution, const char *hrstr ); + n = 1; type = C */ + /* int unur_distr_discr_set_pmfstr( UNUR_DISTR *distribution, const char *pmfstr ); + n = 1; type = C */ + /* int unur_distr_discr_set_cdfstr( UNUR_DISTR *distribution, const char *cdfstr ); + n = 1; type = C */ + + + /* Unsupported set commands: */ + /* int unur_distr_cemp_set_hist( UNUR_DISTR *distribution, const double *prob, int n_prob, double xmin, double xmax ); + n = 4; type = Didd */ + /* int unur_distr_cont_set_invcdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *invcdf ); + n = 1; type = ? */ + /* int unur_distr_cont_set_pdfparams_vec( UNUR_DISTR *distribution, int par, const double *param_vec, int n_param_vec ); + n = 3; type = iDi */ + /* int unur_distr_discr_set_invcdf( UNUR_DISTR *distribution, UNUR_IFUNCT_DISCR *invcdf ); + n = 1; type = ? */ + + + /* special keyword */ + if (result == UNUR_ERR_STR_UNKNOWN) + if (distr->type == UNUR_DISTR_CONT) { + if ( !strcmp(key, "orderstatistics") ) { + /* make order statistics and replace distribution object */ + *ptr_distr = _unur_str_distr_make_os (distr, key, type_args, args); + result = (*ptr_distr == NULL) ? UNUR_ERR_STR_SYNTAX : UNUR_SUCCESS; + } + } + + if (result == UNUR_ERR_STR_UNKNOWN) { + /* unknown parameter */ + _unur_error_unknown(key,"parameter for given distribution"); + return UNUR_ERR_STR_UNKNOWN; + } + else if (result != UNUR_SUCCESS) { + /* invalid data for parameter */ + _unur_error_invalid(key,"set call"); + return UNUR_ERR_STR_SYNTAX; + } + + return UNUR_SUCCESS; + +} /* end of _unur_str_distr_set() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Methods **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_par * +_unur_str_par_new( const char *method, const UNUR_DISTR *distr ) + /*----------------------------------------------------------------------*/ + /* get new parameter object for method */ + /* */ + /* parameters: */ + /* method ... string that contains method name */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par = NULL; + char method_unknown; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_string(1,"method",method); +#endif + + /* mark method as unknown (this is a very ugly hack) */ + par = (struct unur_par *) &method_unknown; + + switch (*method) { + case 'a': + if ( !strcmp( method, "arou") ) { + par = unur_arou_new(distr); + break; + } + if ( !strcmp( method, "ars") ) { + par = unur_ars_new(distr); + break; + } + if ( !strcmp( method, "auto") ) { + par = unur_auto_new(distr); + break; + } + break; + case 'c': + if ( !strcmp( method, "cstd") ) { + par = unur_cstd_new(distr); + break; + } + break; + case 'd': + if ( !strcmp( method, "dari") ) { + par = unur_dari_new(distr); + break; + } + if ( !strcmp( method, "dau") ) { + par = unur_dau_new(distr); + break; + } + if ( !strcmp( method, "dgt") ) { + par = unur_dgt_new(distr); + break; + } + if ( !strcmp( method, "dsrou") ) { + par = unur_dsrou_new(distr); + break; + } + if ( !strcmp( method, "dss") ) { + par = unur_dss_new(distr); + break; + } + if ( !strcmp( method, "dstd") ) { + par = unur_dstd_new(distr); + break; + } + break; + case 'e': + if ( !strcmp( method, "empk") ) { + par = unur_empk_new(distr); + break; + } + if ( !strcmp( method, "empl") ) { + par = unur_empl_new(distr); + break; + } + break; + case 'g': + if ( !strcmp( method, "gibbs") ) { + par = unur_gibbs_new(distr); + break; + } + break; + case 'h': + if ( !strcmp( method, "hinv") ) { + par = unur_hinv_new(distr); + break; + } + if ( !strcmp( method, "hist") ) { + par = unur_hist_new(distr); + break; + } + if ( !strcmp( method, "hitro") ) { + par = unur_hitro_new(distr); + break; + } + if ( !strcmp( method, "hrb") ) { + par = unur_hrb_new(distr); + break; + } + if ( !strcmp( method, "hrd") ) { + par = unur_hrd_new(distr); + break; + } + if ( !strcmp( method, "hri") ) { + par = unur_hri_new(distr); + break; + } + break; + case 'i': + if ( !strcmp( method, "itdr") ) { + par = unur_itdr_new(distr); + break; + } + break; + case 'm': + if ( !strcmp( method, "mcorr") ) { + par = unur_mcorr_new(distr); + break; + } + if ( !strcmp( method, "mvstd") ) { + par = unur_mvstd_new(distr); + break; + } + if ( !strcmp( method, "mvtdr") ) { + par = unur_mvtdr_new(distr); + break; + } + break; + case 'n': + if ( !strcmp( method, "ninv") ) { + par = unur_ninv_new(distr); + break; + } + if ( !strcmp( method, "norta") ) { + par = unur_norta_new(distr); + break; + } + if ( !strcmp( method, "nrou") ) { + par = unur_nrou_new(distr); + break; + } + break; + case 'p': + if ( !strcmp( method, "pinv") ) { + par = unur_pinv_new(distr); + break; + } + break; + case 's': + if ( !strcmp( method, "srou") ) { + par = unur_srou_new(distr); + break; + } + if ( !strcmp( method, "ssr") ) { + par = unur_ssr_new(distr); + break; + } + break; + case 't': + if ( !strcmp( method, "tabl") ) { + par = unur_tabl_new(distr); + break; + } + if ( !strcmp( method, "tdr") ) { + par = unur_tdr_new(distr); + break; + } + break; + case 'u': + if ( !strcmp( method, "unif") ) { + par = unur_unif_new(distr); + break; + } + if ( !strcmp( method, "utdr") ) { + par = unur_utdr_new(distr); + break; + } + break; + case 'v': + if ( !strcmp( method, "vempk") ) { + par = unur_vempk_new(distr); + break; + } + if ( !strcmp( method, "vnrou") ) { + par = unur_vnrou_new(distr); + break; + } + } + + if (par == (struct unur_par *) &method_unknown) { + /* unknown method */ + _unur_error_unknown(method,"method"); + par = NULL; + } + else if (par == NULL) { + /* invalid data for chosen method */ + _unur_error_invalid(method,"method"); + } + + return par; +} /* end of _unur_str_par_new() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_str_par_set( UNUR_PAR *par, const char *key, char *value, struct unur_slist *mlist ) + /*----------------------------------------------------------------------*/ + /* set parameters for method */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* key ... string that contains key for parameter */ + /* value ... string that contains list of arguments for parameter */ + /* mlist ... list of allocated memory blocks */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int result = 0; /* result of UNU.RAN set call (0 or 1) */ + + /* storing arguments of set calls: */ + char type_args[MAX_SET_ARGS+1]; /* array containing info about arguments */ + char *args[MAX_SET_ARGS+1]; /* pointers to argument strings */ + + /* tokenize argument string */ + if (_unur_str_set_args( value, type_args, args, MAX_SET_ARGS ) < 0) { + /* error */ + return UNUR_ERR_STR_SYNTAX; + } + + /* set result indicator to unknown */ + result = UNUR_ERR_STR_UNKNOWN; + + /* find and execute set call */ + switch (par->method) { + case UNUR_METH_AROU: + switch (*key) { + case 'c': + if ( !strcmp(key, "cpoints") ) { + /* n = 2; type = iD: UNUR_PAR *parameters, int n_stp, const double *stp */ + result = _unur_str_par_set_iD(par,key,type_args,args,unur_arou_set_cpoints,mlist); + break; + } + break; + case 'd': + if ( !strcmp(key, "darsfactor") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double factor */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_arou_set_darsfactor); + break; + } + break; + case 'g': + if ( !strcmp(key, "guidefactor") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double factor */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_arou_set_guidefactor); + break; + } + break; + case 'm': + if ( !strcmp(key, "max_segments") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int max_segs */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_arou_set_max_segments); + break; + } + if ( !strcmp(key, "max_sqhratio") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double max_ratio */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_arou_set_max_sqhratio); + break; + } + break; + case 'p': + if ( !strcmp(key, "pedantic") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int pedantic */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_arou_set_pedantic); + break; + } + break; + case 'u': + if ( !strcmp(key, "usecenter") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int usecenter */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_arou_set_usecenter); + break; + } + if ( !strcmp(key, "usedars") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int usedars */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_arou_set_usedars); + break; + } + break; + case 'v': + if ( !strcmp(key, "verify") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int verify */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_arou_set_verify); + break; + } + } + break; + case UNUR_METH_ARS: + switch (*key) { + case 'c': + if ( !strcmp(key, "cpoints") ) { + /* n = 2; type = iD: UNUR_PAR *parameters, int n_cpoints, const double *cpoints */ + result = _unur_str_par_set_iD(par,key,type_args,args,unur_ars_set_cpoints,mlist); + break; + } + break; + case 'm': + if ( !strcmp(key, "max_intervals") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int max_ivs */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_ars_set_max_intervals); + break; + } + if ( !strcmp(key, "max_iter") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int max_iter */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_ars_set_max_iter); + break; + } + break; + case 'p': + if ( !strcmp(key, "pedantic") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int pedantic */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_ars_set_pedantic); + break; + } + break; + case 'r': + if ( !strcmp(key, "reinit_ncpoints") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int ncpoints */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_ars_set_reinit_ncpoints); + break; + } + if ( !strcmp(key, "reinit_percentiles") ) { + /* n = 2; type = iD: UNUR_PAR *parameters, int n_percentiles, const double *percentiles */ + result = _unur_str_par_set_iD(par,key,type_args,args,unur_ars_set_reinit_percentiles,mlist); + break; + } + break; + case 'v': + if ( !strcmp(key, "verify") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int verify */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_ars_set_verify); + break; + } + } + break; + case UNUR_METH_AUTO: + switch (*key) { + case 'l': + if ( !strcmp(key, "logss") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int logss */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_auto_set_logss); + break; + } + } + break; + case UNUR_METH_CSTD: + switch (*key) { + case 'v': + if ( !strcmp(key, "variant") ) { + /* n = 1; type = u: UNUR_PAR *parameters, unsigned variant */ + result = _unur_str_par_set_u(par,key,type_args,args,unur_cstd_set_variant); + break; + } + } + break; + case UNUR_METH_DARI: + switch (*key) { + case 'c': + if ( !strcmp(key, "cpfactor") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double cp_factor */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_dari_set_cpfactor); + break; + } + break; + case 's': + if ( !strcmp(key, "squeeze") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int squeeze */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_dari_set_squeeze); + break; + } + break; + case 't': + if ( !strcmp(key, "tablesize") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int size */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_dari_set_tablesize); + break; + } + break; + case 'v': + if ( !strcmp(key, "verify") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int verify */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_dari_set_verify); + break; + } + } + break; + case UNUR_METH_DAU: + switch (*key) { + case 'u': + if ( !strcmp(key, "urnfactor") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double factor */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_dau_set_urnfactor); + break; + } + } + break; + case UNUR_METH_DGT: + switch (*key) { + case 'g': + if ( !strcmp(key, "guidefactor") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double factor */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_dgt_set_guidefactor); + break; + } + break; + case 'v': + if ( !strcmp(key, "variant") ) { + /* n = 1; type = u: UNUR_PAR *parameters, unsigned variant */ + result = _unur_str_par_set_u(par,key,type_args,args,unur_dgt_set_variant); + break; + } + } + break; + case UNUR_METH_DSROU: + switch (*key) { + case 'c': + if ( !strcmp(key, "cdfatmode") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double Fmode */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_dsrou_set_cdfatmode); + break; + } + break; + case 'v': + if ( !strcmp(key, "verify") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int verify */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_dsrou_set_verify); + break; + } + } + break; + case UNUR_METH_DSTD: + switch (*key) { + case 'v': + if ( !strcmp(key, "variant") ) { + /* n = 1; type = u: UNUR_PAR *parameters, unsigned variant */ + result = _unur_str_par_set_u(par,key,type_args,args,unur_dstd_set_variant); + break; + } + } + break; + case UNUR_METH_EMPK: + switch (*key) { + case 'b': + if ( !strcmp(key, "beta") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double beta */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_empk_set_beta); + break; + } + break; + case 'k': + if ( !strcmp(key, "kernel") ) { + /* n = 1; type = u: UNUR_PAR *parameters, unsigned kernel*/ + result = _unur_str_par_set_u(par,key,type_args,args,unur_empk_set_kernel); + break; + } + break; + case 'p': + if ( !strcmp(key, "positive") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int positive */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_empk_set_positive); + break; + } + break; + case 's': + if ( !strcmp(key, "smoothing") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double smoothing */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_empk_set_smoothing); + break; + } + break; + case 'v': + if ( !strcmp(key, "varcor") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int varcor */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_empk_set_varcor); + break; + } + } + break; + case UNUR_METH_GIBBS: + switch (*key) { + case 'b': + if ( !strcmp(key, "burnin") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int burnin */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_gibbs_set_burnin); + break; + } + break; + case 'c': + if ( !strcmp(key, "c") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double c */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_gibbs_set_c); + break; + } + break; + case 't': + if ( !strcmp(key, "thinning") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int thinning */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_gibbs_set_thinning); + break; + } + break; + case 'v': + if ( !strcmp(key, "variant_coordinate") ) { + /* n = 0; type = : UNUR_PAR *parameters */ + result = _unur_str_par_set_void(par,key,type_args,args,unur_gibbs_set_variant_coordinate); + break; + } + if ( !strcmp(key, "variant_random_direction") ) { + /* n = 0; type = : UNUR_PAR *parameters */ + result = _unur_str_par_set_void(par,key,type_args,args,unur_gibbs_set_variant_random_direction); + break; + } + } + break; + case UNUR_METH_HINV: + switch (*key) { + case 'b': + if ( !strcmp(key, "boundary") ) { + /* n = 2; type = dd: UNUR_PAR *parameters, double left, double right */ + result = _unur_str_par_set_dd(par,key,type_args,args,unur_hinv_set_boundary); + break; + } + break; + case 'c': + if ( !strcmp(key, "cpoints") ) { + /* n = 2; type = Di: UNUR_PAR *parameters, const double *stp, int n_stp */ + result = _unur_str_par_set_Di(par,key,type_args,args,unur_hinv_set_cpoints,mlist); + break; + } + break; + case 'g': + if ( !strcmp(key, "guidefactor") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double factor */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_hinv_set_guidefactor); + break; + } + break; + case 'm': + if ( !strcmp(key, "max_intervals") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int max_ivs */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_hinv_set_max_intervals); + break; + } + break; + case 'o': + if ( !strcmp(key, "order") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int order*/ + result = _unur_str_par_set_i(par,key,type_args,args,unur_hinv_set_order); + break; + } + break; + case 'u': + if ( !strcmp(key, "u_resolution") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double u_resolution*/ + result = _unur_str_par_set_d(par,key,type_args,args,unur_hinv_set_u_resolution); + break; + } + } + break; + case UNUR_METH_HITRO: + switch (*key) { + case 'a': + if ( !strcmp(key, "adaptive_multiplier") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double factor */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_hitro_set_adaptive_multiplier); + break; + } + break; + case 'b': + if ( !strcmp(key, "burnin") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int burnin */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_hitro_set_burnin); + break; + } + break; + case 'r': + if ( !strcmp(key, "r") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double r */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_hitro_set_r); + break; + } + break; + case 't': + if ( !strcmp(key, "thinning") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int thinning */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_hitro_set_thinning); + break; + } + break; + case 'u': + if ( !strcmp(key, "use_adaptiveline") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int adaptive */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_hitro_set_use_adaptiveline); + break; + } + if ( !strcmp(key, "use_adaptiverectangle") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int adaptive */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_hitro_set_use_adaptiverectangle); + break; + } + if ( !strcmp(key, "use_boundingrectangle") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int rectangle */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_hitro_set_use_boundingrectangle); + break; + } + break; + case 'v': + if ( !strcmp(key, "v") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double vmax */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_hitro_set_v); + break; + } + if ( !strcmp(key, "variant_coordinate") ) { + /* n = 0; type = : UNUR_PAR *parameters */ + result = _unur_str_par_set_void(par,key,type_args,args,unur_hitro_set_variant_coordinate); + break; + } + if ( !strcmp(key, "variant_random_direction") ) { + /* n = 0; type = : UNUR_PAR *parameters */ + result = _unur_str_par_set_void(par,key,type_args,args,unur_hitro_set_variant_random_direction); + break; + } + } + break; + case UNUR_METH_HRB: + switch (*key) { + case 'u': + if ( !strcmp(key, "upperbound") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double upperbound */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_hrb_set_upperbound); + break; + } + break; + case 'v': + if ( !strcmp(key, "verify") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int verify */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_hrb_set_verify); + break; + } + } + break; + case UNUR_METH_HRD: + switch (*key) { + case 'v': + if ( !strcmp(key, "verify") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int verify */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_hrd_set_verify); + break; + } + } + break; + case UNUR_METH_HRI: + switch (*key) { + case 'p': + if ( !strcmp(key, "p0") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double p0 */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_hri_set_p0); + break; + } + break; + case 'v': + if ( !strcmp(key, "verify") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int verify */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_hri_set_verify); + break; + } + } + break; + case UNUR_METH_ITDR: + switch (*key) { + case 'c': + if ( !strcmp(key, "cp") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double cp */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_itdr_set_cp); + break; + } + if ( !strcmp(key, "ct") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double ct */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_itdr_set_ct); + break; + } + break; + case 'v': + if ( !strcmp(key, "verify") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int verify */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_itdr_set_verify); + break; + } + break; + case 'x': + if ( !strcmp(key, "xi") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double xi */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_itdr_set_xi); + break; + } + } + break; + case UNUR_METH_MVTDR: + switch (*key) { + case 'b': + if ( !strcmp(key, "boundsplitting") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double boundsplitting */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_mvtdr_set_boundsplitting); + break; + } + break; + case 'm': + if ( !strcmp(key, "maxcones") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int maxcones */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_mvtdr_set_maxcones); + break; + } + break; + case 's': + if ( !strcmp(key, "stepsmin") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int stepsmin */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_mvtdr_set_stepsmin); + break; + } + break; + case 'v': + if ( !strcmp(key, "verify") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int verify */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_mvtdr_set_verify); + break; + } + } + break; + case UNUR_METH_NINV: + switch (*key) { + case 'm': + if ( !strcmp(key, "max_iter") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int max_iter */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_ninv_set_max_iter); + break; + } + break; + case 's': + if ( !strcmp(key, "start") ) { + /* n = 2; type = dd: UNUR_PAR *parameters, double left, double right*/ + result = _unur_str_par_set_dd(par,key,type_args,args,unur_ninv_set_start); + break; + } + break; + case 't': + if ( !strcmp(key, "table") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int no_of_points*/ + result = _unur_str_par_set_i(par,key,type_args,args,unur_ninv_set_table); + break; + } + break; + case 'u': + if ( !strcmp(key, "u_resolution") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double u_resolution*/ + result = _unur_str_par_set_d(par,key,type_args,args,unur_ninv_set_u_resolution); + break; + } + if ( !strcmp(key, "usebisect") ) { + /* n = 0; type = : UNUR_PAR *parameters */ + result = _unur_str_par_set_void(par,key,type_args,args,unur_ninv_set_usebisect); + break; + } + if ( !strcmp(key, "usenewton") ) { + /* n = 0; type = : UNUR_PAR *parameters */ + result = _unur_str_par_set_void(par,key,type_args,args,unur_ninv_set_usenewton); + break; + } + if ( !strcmp(key, "useregula") ) { + /* n = 0; type = : UNUR_PAR *parameters */ + result = _unur_str_par_set_void(par,key,type_args,args,unur_ninv_set_useregula); + break; + } + break; + case 'x': + if ( !strcmp(key, "x_resolution") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double x_resolution*/ + result = _unur_str_par_set_d(par,key,type_args,args,unur_ninv_set_x_resolution); + break; + } + } + break; + case UNUR_METH_NROU: + switch (*key) { + case 'c': + if ( !strcmp(key, "center") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double center */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_nrou_set_center); + break; + } + break; + case 'r': + if ( !strcmp(key, "r") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double r */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_nrou_set_r); + break; + } + break; + case 'u': + if ( !strcmp(key, "u") ) { + /* n = 2; type = dd: UNUR_PAR *parameters, double umin, double umax */ + result = _unur_str_par_set_dd(par,key,type_args,args,unur_nrou_set_u); + break; + } + break; + case 'v': + if ( !strcmp(key, "v") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double vmax */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_nrou_set_v); + break; + } + if ( !strcmp(key, "verify") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int verify */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_nrou_set_verify); + break; + } + } + break; + case UNUR_METH_PINV: + switch (*key) { + case 'b': + if ( !strcmp(key, "boundary") ) { + /* n = 2; type = dd: UNUR_PAR *parameters, double left, double right */ + result = _unur_str_par_set_dd(par,key,type_args,args,unur_pinv_set_boundary); + break; + } + break; + case 'e': + if ( !strcmp(key, "extra_testpoints") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int n_points*/ + result = _unur_str_par_set_i(par,key,type_args,args,unur_pinv_set_extra_testpoints); + break; + } + break; + case 'k': + if ( !strcmp(key, "keepcdf") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int keepcdf*/ + result = _unur_str_par_set_i(par,key,type_args,args,unur_pinv_set_keepcdf); + break; + } + break; + case 'm': + if ( !strcmp(key, "max_intervals") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int max_ivs */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_pinv_set_max_intervals); + break; + } + break; + case 'o': + if ( !strcmp(key, "order") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int order*/ + result = _unur_str_par_set_i(par,key,type_args,args,unur_pinv_set_order); + break; + } + break; + case 's': + if ( !strcmp(key, "searchboundary") ) { + /* n = 2; type = ii: UNUR_PAR *parameters, int left, int right */ + result = _unur_str_par_set_ii(par,key,type_args,args,unur_pinv_set_searchboundary); + break; + } + if ( !strcmp(key, "smoothness") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int smoothness*/ + result = _unur_str_par_set_i(par,key,type_args,args,unur_pinv_set_smoothness); + break; + } + break; + case 'u': + if ( !strcmp(key, "u_resolution") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double u_resolution*/ + result = _unur_str_par_set_d(par,key,type_args,args,unur_pinv_set_u_resolution); + break; + } + if ( !strcmp(key, "use_upoints") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int use_upoints */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_pinv_set_use_upoints); + break; + } + if ( !strcmp(key, "usecdf") ) { + /* n = 0; type = : UNUR_PAR *parameters */ + result = _unur_str_par_set_void(par,key,type_args,args,unur_pinv_set_usecdf); + break; + } + if ( !strcmp(key, "usepdf") ) { + /* n = 0; type = : UNUR_PAR *parameters */ + result = _unur_str_par_set_void(par,key,type_args,args,unur_pinv_set_usepdf); + break; + } + } + break; + case UNUR_METH_SROU: + switch (*key) { + case 'c': + if ( !strcmp(key, "cdfatmode") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double Fmode */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_srou_set_cdfatmode); + break; + } + break; + case 'p': + if ( !strcmp(key, "pdfatmode") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double fmode */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_srou_set_pdfatmode); + break; + } + break; + case 'r': + if ( !strcmp(key, "r") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double r */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_srou_set_r); + break; + } + break; + case 'u': + if ( !strcmp(key, "usemirror") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int usemirror */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_srou_set_usemirror); + break; + } + if ( !strcmp(key, "usesqueeze") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int usesqueeze */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_srou_set_usesqueeze); + break; + } + break; + case 'v': + if ( !strcmp(key, "verify") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int verify */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_srou_set_verify); + break; + } + } + break; + case UNUR_METH_SSR: + switch (*key) { + case 'c': + if ( !strcmp(key, "cdfatmode") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double Fmode */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_ssr_set_cdfatmode); + break; + } + break; + case 'p': + if ( !strcmp(key, "pdfatmode") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double fmode */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_ssr_set_pdfatmode); + break; + } + break; + case 'u': + if ( !strcmp(key, "usesqueeze") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int usesqueeze */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_ssr_set_usesqueeze); + break; + } + break; + case 'v': + if ( !strcmp(key, "verify") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int verify */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_ssr_set_verify); + break; + } + } + break; + case UNUR_METH_TABL: + switch (*key) { + case 'a': + if ( !strcmp(key, "areafraction") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double fraction */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_tabl_set_areafraction); + break; + } + break; + case 'b': + if ( !strcmp(key, "boundary") ) { + /* n = 2; type = dd: UNUR_PAR *parameters, double left, double right */ + result = _unur_str_par_set_dd(par,key,type_args,args,unur_tabl_set_boundary); + break; + } + break; + case 'c': + if ( !strcmp(key, "cpoints") ) { + /* n = 2; type = iD: UNUR_PAR *parameters, int n_cpoints, const double *cpoints */ + result = _unur_str_par_set_iD(par,key,type_args,args,unur_tabl_set_cpoints,mlist); + break; + } + break; + case 'd': + if ( !strcmp(key, "darsfactor") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double factor */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_tabl_set_darsfactor); + break; + } + break; + case 'g': + if ( !strcmp(key, "guidefactor") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double factor */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_tabl_set_guidefactor); + break; + } + break; + case 'm': + if ( !strcmp(key, "max_intervals") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int max_ivs */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_tabl_set_max_intervals); + break; + } + if ( !strcmp(key, "max_sqhratio") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double max_ratio */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_tabl_set_max_sqhratio); + break; + } + break; + case 'n': + if ( !strcmp(key, "nstp") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int n_stp */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_tabl_set_nstp); + break; + } + break; + case 'p': + if ( !strcmp(key, "pedantic") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int pedantic */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_tabl_set_pedantic); + break; + } + break; + case 's': + if ( !strcmp(key, "slopes") ) { + /* n = 2; type = Di: UNUR_PAR *parameters, const double *slopes, int n_slopes */ + result = _unur_str_par_set_Di(par,key,type_args,args,unur_tabl_set_slopes,mlist); + break; + } + break; + case 'u': + if ( !strcmp(key, "usedars") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int usedars */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_tabl_set_usedars); + break; + } + if ( !strcmp(key, "useear") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int useear */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_tabl_set_useear); + break; + } + break; + case 'v': + if ( !strcmp(key, "variant_ia") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int use_ia */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_tabl_set_variant_ia); + break; + } + if ( !strcmp(key, "variant_splitmode") ) { + /* n = 1; type = u: UNUR_PAR *parameters, unsigned splitmode */ + result = _unur_str_par_set_u(par,key,type_args,args,unur_tabl_set_variant_splitmode); + break; + } + if ( !strcmp(key, "verify") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int verify */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_tabl_set_verify); + break; + } + } + break; + case UNUR_METH_TDR: + switch (*key) { + case 'c': + if ( !strcmp(key, "c") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double c */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_tdr_set_c); + break; + } + if ( !strcmp(key, "cpoints") ) { + /* n = 2; type = iD: UNUR_PAR *parameters, int n_stp, const double *stp */ + result = _unur_str_par_set_iD(par,key,type_args,args,unur_tdr_set_cpoints,mlist); + break; + } + break; + case 'd': + if ( !strcmp(key, "darsfactor") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double factor */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_tdr_set_darsfactor); + break; + } + break; + case 'g': + if ( !strcmp(key, "guidefactor") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double factor */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_tdr_set_guidefactor); + break; + } + break; + case 'm': + if ( !strcmp(key, "max_intervals") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int max_ivs */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_tdr_set_max_intervals); + break; + } + if ( !strcmp(key, "max_sqhratio") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double max_ratio */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_tdr_set_max_sqhratio); + break; + } + break; + case 'p': + if ( !strcmp(key, "pedantic") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int pedantic */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_tdr_set_pedantic); + break; + } + break; + case 'r': + if ( !strcmp(key, "reinit_ncpoints") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int ncpoints */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_tdr_set_reinit_ncpoints); + break; + } + if ( !strcmp(key, "reinit_percentiles") ) { + /* n = 2; type = iD: UNUR_PAR *parameters, int n_percentiles, const double *percentiles */ + result = _unur_str_par_set_iD(par,key,type_args,args,unur_tdr_set_reinit_percentiles,mlist); + break; + } + break; + case 'u': + if ( !strcmp(key, "usecenter") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int usecenter */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_tdr_set_usecenter); + break; + } + if ( !strcmp(key, "usedars") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int usedars */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_tdr_set_usedars); + break; + } + if ( !strcmp(key, "usemode") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int usemode */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_tdr_set_usemode); + break; + } + break; + case 'v': + if ( !strcmp(key, "variant_gw") ) { + /* n = 0; type = : UNUR_PAR *parameters */ + result = _unur_str_par_set_void(par,key,type_args,args,unur_tdr_set_variant_gw); + break; + } + if ( !strcmp(key, "variant_ia") ) { + /* n = 0; type = : UNUR_PAR *parameters */ + result = _unur_str_par_set_void(par,key,type_args,args,unur_tdr_set_variant_ia); + break; + } + if ( !strcmp(key, "variant_ps") ) { + /* n = 0; type = : UNUR_PAR *parameters */ + result = _unur_str_par_set_void(par,key,type_args,args,unur_tdr_set_variant_ps); + break; + } + if ( !strcmp(key, "verify") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int verify */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_tdr_set_verify); + break; + } + } + break; + case UNUR_METH_UTDR: + switch (*key) { + case 'c': + if ( !strcmp(key, "cpfactor") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double cp_factor */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_utdr_set_cpfactor); + break; + } + break; + case 'd': + if ( !strcmp(key, "deltafactor") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double delta */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_utdr_set_deltafactor); + break; + } + break; + case 'p': + if ( !strcmp(key, "pdfatmode") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double fmode */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_utdr_set_pdfatmode); + break; + } + break; + case 'v': + if ( !strcmp(key, "verify") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int verify */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_utdr_set_verify); + break; + } + } + break; + case UNUR_METH_VEMPK: + switch (*key) { + case 's': + if ( !strcmp(key, "smoothing") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double smoothing */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_vempk_set_smoothing); + break; + } + break; + case 'v': + if ( !strcmp(key, "varcor") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int varcor */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_vempk_set_varcor); + break; + } + } + break; + case UNUR_METH_VNROU: + switch (*key) { + case 'r': + if ( !strcmp(key, "r") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double r */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_vnrou_set_r); + break; + } + break; + case 'v': + if ( !strcmp(key, "v") ) { + /* n = 1; type = d: UNUR_PAR *parameters, double vmax */ + result = _unur_str_par_set_d(par,key,type_args,args,unur_vnrou_set_v); + break; + } + if ( !strcmp(key, "verify") ) { + /* n = 1; type = i: UNUR_PAR *parameters, int verify */ + result = _unur_str_par_set_i(par,key,type_args,args,unur_vnrou_set_verify); + break; + } + } + break; + } + + /* Ignored set commands: */ + /* int unur_mixt_set_useinversion( UNUR_PAR *parameters, int useinv ); + n = 1; type = i */ + + + /* Unsupported set commands: */ + /* int unur_cext_set_init( UNUR_PAR *parameters, int (*init)(UNUR_GEN *gen) ); + n = 1; type = I */ + /* int unur_cext_set_sample( UNUR_PAR *parameters, double (*sample)(UNUR_GEN *gen) ); + n = 1; type = D */ + /* int unur_dext_set_init( UNUR_PAR *parameters, int (*init)(UNUR_GEN *gen) ); + n = 1; type = I */ + /* int unur_dext_set_sample( UNUR_PAR *parameters, int (*sample)(UNUR_GEN *gen) ); + n = 1; type = I */ + /* int unur_empk_set_kernelgen( UNUR_PAR *parameters, const UNUR_GEN *kernelgen, double alpha, double kernelvar ); + n = 3; type = ?dd */ + /* int unur_gibbs_set_startingpoint( UNUR_PAR *parameters, const double *x0 ); + n = 1; type = D */ + /* int unur_hitro_set_u( UNUR_PAR *parameters, const double *umin, const double *umax ); + n = 2; type = DD */ + /* int unur_hitro_set_startingpoint( UNUR_PAR *parameters, const double *x0 ); + n = 1; type = D */ + /* int unur_mcorr_set_eigenvalues( UNUR_PAR *par, const double *eigenvalues ); + n = 1; type = D */ + /* int unur_vnrou_set_u( UNUR_PAR *parameters, double *umin, double *umax ); + n = 2; type = DD */ + + + if (result == UNUR_ERR_STR_UNKNOWN) { + /* no valid parameter found */ + /* try extra keywords */ + if ( !strcmp(key, "debug") ) { + /* n = 1; type = u: UNUR_PAR *parameters, unsigned DEBUG */ + result = _unur_str_par_set_u(par,key,type_args,args,unur_set_debug); + } + } + + /* check result */ + if (result == UNUR_ERR_STR_UNKNOWN) { + /* unknown parameter */ + _unur_error_unknown(key,"parameter for given method"); + return UNUR_ERR_STR_UNKNOWN; + } + else if (result != UNUR_SUCCESS) { + /* invalid data for parameter */ + _unur_error_invalid(key,"set call"); + return UNUR_ERR_STR_SYNTAX; + } + + return UNUR_SUCCESS; + +} /* end of _unur_str_par_set() */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/parser/stringparser_lists.ch.in b/vendor/unuran-1.11.0/src/parser/stringparser_lists.ch.in new file mode 100644 index 0000000..8aff9c0 --- /dev/null +++ b/vendor/unuran-1.11.0/src/parser/stringparser_lists.ch.in @@ -0,0 +1,308 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: stringparser_lists.ch.in / stringparser_lists.ch * + * * + * * + * DESCRIPTION: * + * * + * Switch lists for string parser. * + * (See file stringparser.c) * + * * + ***************************************************************************** + * * + * This file is parsed by the perl script make_stringparser.pl which * + * replaces the * + * =INPUT keyword * + * tags with search lists created from the information found within the * + * header files of the source code. * + * These lists (implemented via 'if' rules together with switch lists to * + * with the first letter of the set calls as simple hash function) are * + * used to call the corresponding ..._set and ..._new calls for the * + * the keywords found in the string. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + + +/*****************************************************************************/ +/** Distributions **/ +/*****************************************************************************/ + +struct unur_distr * +_unur_str_distr_new( char *distribution ) + /*----------------------------------------------------------------------*/ + /* get new distribution object */ + /* */ + /* parameters: */ + /* distribution ... string that contains distribution name */ + /* params ... string that contains list of parameters */ + /* */ + /* return: */ + /* distribution object (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_distr *distr = NULL; /* pointer to distribution object */ + char distr_unknown; + +#ifdef UNUR_ENABLE_LOGGING + char *name; /* pointer to name of distribution */ +#endif + char *params; /* pointer to parameter list of distr */ + + double *darray = NULL; /* array of arguments for distribution */ + int n_darray = 0; /* size of array of parameters */ + +#ifdef UNUR_ENABLE_LOGGING + /* name of distribution */ + name = distribution; +#endif + + /* get parameter list */ + params = strchr(distribution,'('); + if (params != NULL) { + *params = '\0'; /* terminate key string */ + ++params; /* set pointer to value string */ + } + + /* get parameter list */ + n_darray = _unur_parse_dlist(params, &darray ); + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_distr(1,name,darray,n_darray); +#endif + + /* mark distribution as unknown (this is a very ugly hack) */ + distr = (struct unur_distr *) &distr_unknown; + +=INPUT list_of_distributions + + if (distr == (struct unur_distr *) &distr_unknown) { + /* unknown method */ + _unur_error_unknown(distribution,"distribution"); + distr = NULL; + } + else if (distr == NULL) { + /* invalid data for chosen method */ + _unur_error_invalid(distribution,"distribution"); + } + + /* clear memory */ + if (darray) free(darray); + + /* return result */ + return distr; + +} /* end of _unur_str_distr_new() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_str_distr_set( UNUR_DISTR **ptr_distr, const char *key, char *value ) + /*----------------------------------------------------------------------*/ + /* set parameters for distribution */ + /* */ + /* it also makes a distribution object for an order statistics for */ + /* the given distribution when the key word "orderstatistics" occurs. */ + /* Thus the distribution object itself might be changed. */ + /* */ + /* parameters: */ + /* ptr_distr ... holds pointer to distribution object */ + /* key ... string that contains key for parameter */ + /* value ... string that contains list of arguments for parameter */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* error: */ + /* return error code */ + /*----------------------------------------------------------------------*/ +{ + int result; /* result of UNU.RAN set call */ + + /* derefence pointer to distribution object */ + struct unur_distr *distr = *ptr_distr; + + /* storing arguments of set calls: */ + char type_args[MAX_SET_ARGS+1]; /* array containing info about arguments */ + char *args[MAX_SET_ARGS+1]; /* pointers to argument strings */ + + /* tokenize argument string */ + if (_unur_str_set_args( value, type_args, args, MAX_SET_ARGS ) < 0) { + /* error */ + return UNUR_ERR_STR_SYNTAX; + } + + /* set result indicator to unknown */ + result = UNUR_ERR_STR_UNKNOWN; + + /* find and execute set call */ +=INPUT list_of_distr_sets + + /* special keyword */ + if (result == UNUR_ERR_STR_UNKNOWN) + if (distr->type == UNUR_DISTR_CONT) { + if ( !strcmp(key, "orderstatistics") ) { + /* make order statistics and replace distribution object */ + *ptr_distr = _unur_str_distr_make_os (distr, key, type_args, args); + result = (*ptr_distr == NULL) ? UNUR_ERR_STR_SYNTAX : UNUR_SUCCESS; + } + } + + if (result == UNUR_ERR_STR_UNKNOWN) { + /* unknown parameter */ + _unur_error_unknown(key,"parameter for given distribution"); + return UNUR_ERR_STR_UNKNOWN; + } + else if (result != UNUR_SUCCESS) { + /* invalid data for parameter */ + _unur_error_invalid(key,"set call"); + return UNUR_ERR_STR_SYNTAX; + } + + return UNUR_SUCCESS; + +} /* end of _unur_str_distr_set() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Methods **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_par * +_unur_str_par_new( const char *method, const UNUR_DISTR *distr ) + /*----------------------------------------------------------------------*/ + /* get new parameter object for method */ + /* */ + /* parameters: */ + /* method ... string that contains method name */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* default parameters (pointer to structure) */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par = NULL; + char method_unknown; + +#ifdef UNUR_ENABLE_LOGGING + /* write info into LOG file */ + if (_unur_default_debugflag & UNUR_DEBUG_SETUP) + _unur_str_debug_string(1,"method",method); +#endif + + /* mark method as unknown (this is a very ugly hack) */ + par = (struct unur_par *) &method_unknown; + +=INPUT list_of_methods + + if (par == (struct unur_par *) &method_unknown) { + /* unknown method */ + _unur_error_unknown(method,"method"); + par = NULL; + } + else if (par == NULL) { + /* invalid data for chosen method */ + _unur_error_invalid(method,"method"); + } + + return par; +} /* end of _unur_str_par_new() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_str_par_set( UNUR_PAR *par, const char *key, char *value, struct unur_slist *mlist ) + /*----------------------------------------------------------------------*/ + /* set parameters for method */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* key ... string that contains key for parameter */ + /* value ... string that contains list of arguments for parameter */ + /* mlist ... list of allocated memory blocks */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + int result = 0; /* result of UNU.RAN set call (0 or 1) */ + + /* storing arguments of set calls: */ + char type_args[MAX_SET_ARGS+1]; /* array containing info about arguments */ + char *args[MAX_SET_ARGS+1]; /* pointers to argument strings */ + + /* tokenize argument string */ + if (_unur_str_set_args( value, type_args, args, MAX_SET_ARGS ) < 0) { + /* error */ + return UNUR_ERR_STR_SYNTAX; + } + + /* set result indicator to unknown */ + result = UNUR_ERR_STR_UNKNOWN; + + /* find and execute set call */ +=INPUT list_of_par_sets + + if (result == UNUR_ERR_STR_UNKNOWN) { + /* no valid parameter found */ + /* try extra keywords */ + if ( !strcmp(key, "debug") ) { + /* n = 1; type = u: UNUR_PAR *parameters, unsigned DEBUG */ + result = _unur_str_par_set_u(par,key,type_args,args,unur_set_debug); + } + } + + /* check result */ + if (result == UNUR_ERR_STR_UNKNOWN) { + /* unknown parameter */ + _unur_error_unknown(key,"parameter for given method"); + return UNUR_ERR_STR_UNKNOWN; + } + else if (result != UNUR_SUCCESS) { + /* invalid data for parameter */ + _unur_error_invalid(key,"set call"); + return UNUR_ERR_STR_SYNTAX; + } + + return UNUR_SUCCESS; + +} /* end of _unur_str_par_set() */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/specfunct/.libs/libspecfunct.a b/vendor/unuran-1.11.0/src/specfunct/.libs/libspecfunct.a new file mode 100644 index 0000000..a65cb7d Binary files /dev/null and b/vendor/unuran-1.11.0/src/specfunct/.libs/libspecfunct.a differ diff --git a/vendor/unuran-1.11.0/src/specfunct/Makefile b/vendor/unuran-1.11.0/src/specfunct/Makefile new file mode 100644 index 0000000..665c14a --- /dev/null +++ b/vendor/unuran-1.11.0/src/specfunct/Makefile @@ -0,0 +1,683 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# src/specfunct/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/unuran +pkgincludedir = $(includedir)/unuran +pkglibdir = $(libdir)/unuran +pkglibexecdir = $(libexecdir)/unuran +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +subdir = src/specfunct +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libspecfunct_la_LIBADD = +am__objects_1 = cephes_gamma.lo cephes_igam.lo cephes_incbet.lo \ + cephes_ndtr.lo cephes_ndtri.lo cephes_polevl.lo +am__objects_2 = +am__objects_3 = bessel_asympt.lo cgamma.lo hypot.lo log1p.lo +am_libspecfunct_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ + $(am__objects_3) +libspecfunct_la_OBJECTS = $(am_libspecfunct_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I. -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/bessel_asympt.Plo \ + ./$(DEPDIR)/cephes_gamma.Plo ./$(DEPDIR)/cephes_igam.Plo \ + ./$(DEPDIR)/cephes_incbet.Plo ./$(DEPDIR)/cephes_ndtr.Plo \ + ./$(DEPDIR)/cephes_ndtri.Plo ./$(DEPDIR)/cephes_polevl.Plo \ + ./$(DEPDIR)/cgamma.Plo ./$(DEPDIR)/hypot.Plo \ + ./$(DEPDIR)/log1p.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libspecfunct_la_SOURCES) +DIST_SOURCES = $(libspecfunct_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_CFLAGS = -Wall -Wextra -Wshadow -Wstrict-prototypes +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf +AUTOHEADER = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader +AUTOMAKE = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -fPIC +CPP = gcc -E +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +FILECMD = file +GREP = /usr/bin/grep +HAVE_DIVIDE_BY_ZERO = +HAVE_IEEE_COMPARISONS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAINT = # +MAKEINFO = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = unuran +PACKAGE_BUGREPORT = unuran@statmath.wu.ac.at +PACKAGE_NAME = unuran +PACKAGE_STRING = unuran 1.11.0 +PACKAGE_TARNAME = unuran +PACKAGE_URL = +PACKAGE_VERSION = 1.11.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +UNURAN_LT_VERSION = 16:1:0 +UNURAN_SUPPORTS_GSL = +UNURAN_SUPPORTS_PRNG = +UNURAN_SUPPORTS_RNGSTREAM = +VERSION = 1.11.0 +abs_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src/specfunct +abs_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src/specfunct +abs_top_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +have_valgrind = false +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../../ +top_builddir = ../.. +top_srcdir = ../.. +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libspecfunct.la + +# Routines taken from +# Cephes Math Library Release 2.3: June, 1995 +# by Stephen L. Moshier: +# [ See also README.cephes ] +CEPHES = \ + cephes_source.h \ + cephes_gamma.c \ + cephes_igam.c \ + cephes_incbet.c \ + cephes_ndtr.c \ + cephes_ndtri.c \ + cephes_polevl.c + +RMATH = +OTHER = \ + bessel_asympt.c \ + cgamma.c \ + hypot.c \ + log1p.c + +libspecfunct_la_SOURCES = $(CEPHES) $(RMATH) $(OTHER) +noinst_HEADERS = \ + unur_specfunct_source.h + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/specfunct/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/specfunct/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libspecfunct.la: $(libspecfunct_la_OBJECTS) $(libspecfunct_la_DEPENDENCIES) $(EXTRA_libspecfunct_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libspecfunct_la_OBJECTS) $(libspecfunct_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/bessel_asympt.Plo # am--include-marker +include ./$(DEPDIR)/cephes_gamma.Plo # am--include-marker +include ./$(DEPDIR)/cephes_igam.Plo # am--include-marker +include ./$(DEPDIR)/cephes_incbet.Plo # am--include-marker +include ./$(DEPDIR)/cephes_ndtr.Plo # am--include-marker +include ./$(DEPDIR)/cephes_ndtri.Plo # am--include-marker +include ./$(DEPDIR)/cephes_polevl.Plo # am--include-marker +include ./$(DEPDIR)/cgamma.Plo # am--include-marker +include ./$(DEPDIR)/hypot.Plo # am--include-marker +include ./$(DEPDIR)/log1p.Plo # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ $< + +.c.obj: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: + $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +# $(AM_V_CC)source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/bessel_asympt.Plo + -rm -f ./$(DEPDIR)/cephes_gamma.Plo + -rm -f ./$(DEPDIR)/cephes_igam.Plo + -rm -f ./$(DEPDIR)/cephes_incbet.Plo + -rm -f ./$(DEPDIR)/cephes_ndtr.Plo + -rm -f ./$(DEPDIR)/cephes_ndtri.Plo + -rm -f ./$(DEPDIR)/cephes_polevl.Plo + -rm -f ./$(DEPDIR)/cgamma.Plo + -rm -f ./$(DEPDIR)/hypot.Plo + -rm -f ./$(DEPDIR)/log1p.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/bessel_asympt.Plo + -rm -f ./$(DEPDIR)/cephes_gamma.Plo + -rm -f ./$(DEPDIR)/cephes_igam.Plo + -rm -f ./$(DEPDIR)/cephes_incbet.Plo + -rm -f ./$(DEPDIR)/cephes_ndtr.Plo + -rm -f ./$(DEPDIR)/cephes_ndtri.Plo + -rm -f ./$(DEPDIR)/cephes_polevl.Plo + -rm -f ./$(DEPDIR)/cgamma.Plo + -rm -f ./$(DEPDIR)/hypot.Plo + -rm -f ./$(DEPDIR)/log1p.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/specfunct/Makefile.am b/vendor/unuran-1.11.0/src/specfunct/Makefile.am new file mode 100644 index 0000000..7890629 --- /dev/null +++ b/vendor/unuran-1.11.0/src/specfunct/Makefile.am @@ -0,0 +1,39 @@ +## Process this file with automake to produce Makefile.in + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libspecfunct.la + +# Routines taken from +# Cephes Math Library Release 2.3: June, 1995 +# by Stephen L. Moshier: +# [ See also README.cephes ] +CEPHES = \ + cephes_source.h \ + cephes_gamma.c \ + cephes_igam.c \ + cephes_incbet.c \ + cephes_ndtr.c \ + cephes_ndtri.c \ + cephes_polevl.c + +RMATH = + +OTHER = \ + bessel_asympt.c \ + cgamma.c \ + hypot.c \ + log1p.c + +libspecfunct_la_SOURCES = $(CEPHES) $(RMATH) $(OTHER) + +noinst_HEADERS = \ + unur_specfunct_source.h + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/vendor/unuran-1.11.0/src/specfunct/Makefile.in b/vendor/unuran-1.11.0/src/specfunct/Makefile.in new file mode 100644 index 0000000..7135c03 --- /dev/null +++ b/vendor/unuran-1.11.0/src/specfunct/Makefile.in @@ -0,0 +1,683 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/specfunct +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libspecfunct_la_LIBADD = +am__objects_1 = cephes_gamma.lo cephes_igam.lo cephes_incbet.lo \ + cephes_ndtr.lo cephes_ndtri.lo cephes_polevl.lo +am__objects_2 = +am__objects_3 = bessel_asympt.lo cgamma.lo hypot.lo log1p.lo +am_libspecfunct_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ + $(am__objects_3) +libspecfunct_la_OBJECTS = $(am_libspecfunct_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/bessel_asympt.Plo \ + ./$(DEPDIR)/cephes_gamma.Plo ./$(DEPDIR)/cephes_igam.Plo \ + ./$(DEPDIR)/cephes_incbet.Plo ./$(DEPDIR)/cephes_ndtr.Plo \ + ./$(DEPDIR)/cephes_ndtri.Plo ./$(DEPDIR)/cephes_polevl.Plo \ + ./$(DEPDIR)/cgamma.Plo ./$(DEPDIR)/hypot.Plo \ + ./$(DEPDIR)/log1p.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libspecfunct_la_SOURCES) +DIST_SOURCES = $(libspecfunct_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ +UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ +UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ +UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_valgrind = @have_valgrind@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libspecfunct.la + +# Routines taken from +# Cephes Math Library Release 2.3: June, 1995 +# by Stephen L. Moshier: +# [ See also README.cephes ] +CEPHES = \ + cephes_source.h \ + cephes_gamma.c \ + cephes_igam.c \ + cephes_incbet.c \ + cephes_ndtr.c \ + cephes_ndtri.c \ + cephes_polevl.c + +RMATH = +OTHER = \ + bessel_asympt.c \ + cgamma.c \ + hypot.c \ + log1p.c + +libspecfunct_la_SOURCES = $(CEPHES) $(RMATH) $(OTHER) +noinst_HEADERS = \ + unur_specfunct_source.h + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/specfunct/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/specfunct/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libspecfunct.la: $(libspecfunct_la_OBJECTS) $(libspecfunct_la_DEPENDENCIES) $(EXTRA_libspecfunct_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libspecfunct_la_OBJECTS) $(libspecfunct_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bessel_asympt.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cephes_gamma.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cephes_igam.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cephes_incbet.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cephes_ndtr.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cephes_ndtri.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cephes_polevl.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cgamma.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hypot.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log1p.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/bessel_asympt.Plo + -rm -f ./$(DEPDIR)/cephes_gamma.Plo + -rm -f ./$(DEPDIR)/cephes_igam.Plo + -rm -f ./$(DEPDIR)/cephes_incbet.Plo + -rm -f ./$(DEPDIR)/cephes_ndtr.Plo + -rm -f ./$(DEPDIR)/cephes_ndtri.Plo + -rm -f ./$(DEPDIR)/cephes_polevl.Plo + -rm -f ./$(DEPDIR)/cgamma.Plo + -rm -f ./$(DEPDIR)/hypot.Plo + -rm -f ./$(DEPDIR)/log1p.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/bessel_asympt.Plo + -rm -f ./$(DEPDIR)/cephes_gamma.Plo + -rm -f ./$(DEPDIR)/cephes_igam.Plo + -rm -f ./$(DEPDIR)/cephes_incbet.Plo + -rm -f ./$(DEPDIR)/cephes_ndtr.Plo + -rm -f ./$(DEPDIR)/cephes_ndtri.Plo + -rm -f ./$(DEPDIR)/cephes_polevl.Plo + -rm -f ./$(DEPDIR)/cgamma.Plo + -rm -f ./$(DEPDIR)/hypot.Plo + -rm -f ./$(DEPDIR)/log1p.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/specfunct/bessel_asympt.c b/vendor/unuran-1.11.0/src/specfunct/bessel_asympt.c new file mode 100644 index 0000000..dfdb840 --- /dev/null +++ b/vendor/unuran-1.11.0/src/specfunct/bessel_asympt.c @@ -0,0 +1,89 @@ +/*---------------------------------------------------------------------------*/ +/* */ +/* Asymptotic expnasion of Bessel functions for large orders nu. */ +/* */ +/*---------------------------------------------------------------------------*/ + +#include + +/*---------------------------------------------------------------------------*/ + +double +_unur_bessel_k_nuasympt (double x, double nu, int islog, int expon_scaled) +/*---------------------------------------------------------------------------*/ +/* Asymptotic expansion of Bessel K_nu(x) function */ +/* when BOTH nu and x are large. */ +/* */ +/* parameters: */ +/* x ... argument for K_nu() */ +/* nu ... order or Bessel function */ +/* islog ... return logarithm of result TRUE and result when FALSE */ +/* expon_scaled ... return exp(-x)*K_nu(x) when TRUE and K_nu(x) when FALSE*/ +/* */ +/*---------------------------------------------------------------------------*/ +/* */ +/* references: */ +/* ## Abramowitz & Stegun , p.378, __ 9.7.8. __ */ +/* */ +/* ## K_nu(nu * z) ~ sqrt(pi/(2*nu)) * exp(-nu*eta)/(1+z^2)^(1/4) */ +/* ## * {1 - u_1(t)/nu + u_2(t)/nu^2 - ... } */ +/* */ +/* ## where t = 1 / sqrt(1 + z^2), */ +/* ## eta = sqrt(1 + z^2) + log(z / (1 + sqrt(1+z^2))) */ +/* ## */ +/* ## and u_k(t) from p.366 __ 9.3.9 __ */ +/* */ +/* ## u0(t) = 1 */ +/* ## u1(t) = (3*t - 5*t^3)/24 */ +/* ## u2(t) = (81*t^2 - 462*t^4 + 385*t^6)/1152 */ +/* ## ... */ +/* */ +/* ## with recursion 9.3.10 for k = 0, 1, .... : */ +/* ## */ +/* ## u_{k+1}(t) = t^2/2 * (1 - t^2) * u'_k(t) + */ +/* ## 1/8 \int_0^t (1 - 5*s^2)* u_k(s) ds */ +/*---------------------------------------------------------------------------*/ +/* */ +/* Original implementation in R code (R package "Bessel" v. 0.5-3) by */ +/* Martin Maechler, Date: 23 Nov 2009, 13:39 */ +/* */ +/* Translated into C code by Kemal Dingic, Oct. 2011. */ +/* */ +/* Modified by Josef Leydold on Tue Nov 1 13:22:09 CET 2011 */ +/* */ +/*---------------------------------------------------------------------------*/ +{ + double z; /* rescaled argument for K_nu() */ + double sz, t, t2, eta; /* auxiliary variables */ + double d, u1t,u2t,u3t,u4t; /* (auxiliary) results for Debye polynomials */ + double res; /* value of log(K_nu(x)) [= result] */ + + /* rescale: we comute K_nu(z * nu) */ + z = x / nu; + + /* auxiliary variables */ + sz = hypot(1,z); /* = sqrt(1+z^2) */ + t = 1. / sz; + t2 = t*t; + + eta = (expon_scaled) ? (1./(z + sz)) : sz; + eta += log(z) - log1p(sz); /* = log(z/(1+sz)) */ + + /* evaluate Debye polynomials u_j(t) */ + u1t = (t * (3. - 5.*t2))/24.; + u2t = t2 * (81. + t2*(-462. + t2 * 385.))/1152.; + u3t = t*t2 * (30375. + t2 * (-369603. + t2 * (765765. - t2 * 425425.)))/414720.; + u4t = t2*t2 * (4465125. + + t2 * (-94121676. + + t2 * (349922430. + + t2 * (-446185740. + + t2 * 185910725.)))) / 39813120.; + d = (-u1t + (u2t + (-u3t + u4t/nu)/nu)/nu)/nu; + + /* log(K_nu(x)) */ + res = log(1.+d) - nu*eta - 0.5*(log(2.*nu*sz) - M_LNPI); + + return (islog ? res : exp(res)); +} /* end of _unur_bessel_k_nuasympt() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/specfunct/cephes_gamma.c b/vendor/unuran-1.11.0/src/specfunct/cephes_gamma.c new file mode 100644 index 0000000..3f24b1a --- /dev/null +++ b/vendor/unuran-1.11.0/src/specfunct/cephes_gamma.c @@ -0,0 +1,402 @@ +/* Wed Jan 3, Josef Leydold: + Remark: the global (extern) variable sgngam has been removed + + Mon Apr 2 20:41:14 CEST 2012, Josef Leydold: + Replaced INFINITY by UNUR_INFINITY +*/ + +/* gamma.c + * + * Gamma function + * + * + * + * SYNOPSIS: + * + * double x, y, gamma(); + * extern int sgngam; + * + * y = gamma( x ); + * + * + * + * DESCRIPTION: + * + * Returns gamma function of the argument. The result is + * correctly signed, and the sign (+1 or -1) is also + * returned in a global (extern) variable named sgngam. + * This variable is also filled in by the logarithmic gamma + * function lgam(). + * + * Arguments |x| <= 34 are reduced by recurrence and the function + * approximated by a rational function of degree 6/7 in the + * interval (2,3). Large arguments are handled by Stirling's + * formula. Large negative arguments are made positive using + * a reflection formula. + * + * + * ACCURACY: + * + * Relative error: + * arithmetic domain # trials peak rms + * DEC -34, 34 10000 1.3e-16 2.5e-17 + * IEEE -170,-33 20000 2.3e-15 3.3e-16 + * IEEE -33, 33 20000 9.4e-16 2.2e-16 + * IEEE 33, 171.6 20000 2.3e-15 3.2e-16 + * + * Error for arguments outside the test range will be larger + * owing to error amplification by the exponential function. + * + */ + +/* lgam() + * + * Natural logarithm of gamma function + * + * + * + * SYNOPSIS: + * + * double x, y, lgam(); + * extern int sgngam; + * + * y = lgam( x ); + * + * + * + * DESCRIPTION: + * + * Returns the base e (2.718...) logarithm of the absolute + * value of the gamma function of the argument. + * The sign (+1 or -1) of the gamma function is returned in a + * global (extern) variable named sgngam. + * + * For arguments greater than 13, the logarithm of the gamma + * function is approximated by the logarithmic version of + * Stirling's formula using a polynomial approximation of + * degree 4. Arguments between -33 and +33 are reduced by + * recurrence to the interval [2,3] of a rational approximation. + * The cosecant reflection formula is employed for arguments + * less than -33. + * + * Arguments greater than MAXLGM return MAXNUM and an error + * message. MAXLGM = 2.035093e36 for DEC + * arithmetic or 2.556348e305 for IEEE arithmetic. + * + * + * + * ACCURACY: + * + * + * arithmetic domain # trials peak rms + * DEC 0, 3 7000 5.2e-17 1.3e-17 + * DEC 2.718, 2.035e36 5000 3.9e-17 9.9e-18 + * IEEE 0, 3 28000 5.4e-16 1.1e-16 + * IEEE 2.718, 2.556e305 40000 3.5e-16 8.3e-17 + * The error criterion was relative when the function magnitude + * was greater than one but absolute when it was less than one. + * + * The following test used the relative error criterion, though + * at certain points the relative error could be much higher than + * indicated. + * IEEE -200, -4 10000 4.8e-16 1.3e-16 + * + */ + +/* gamma.c */ +/* gamma function */ + +/* +Cephes Math Library Release 2.8: June, 2000 +Copyright 1984, 1987, 1989, 1992, 2000 by Stephen L. Moshier +*/ + +/* + Wed Jan 3, Josef Leydold: + made ANSI compliant declaration +*/ + +#include "cephes_source.h" + +/*---------------------------------------------------------------------------*/ +#ifdef COMPILE_CEPHES +/*---------------------------------------------------------------------------*/ + +static double P[] = { + 1.60119522476751861407E-4, + 1.19135147006586384913E-3, + 1.04213797561761569935E-2, + 4.76367800457137231464E-2, + 2.07448227648435975150E-1, + 4.94214826801497100753E-1, + 9.99999999999999996796E-1 +}; +static double Q[] = { +-2.31581873324120129819E-5, + 5.39605580493303397842E-4, +-4.45641913851797240494E-3, + 1.18139785222060435552E-2, + 3.58236398605498653373E-2, +-2.34591795718243348568E-1, + 7.14304917030273074085E-2, + 1.00000000000000000320E0 +}; + +#define LOGPI M_LNPI /* log(Pi) */ + +/* Stirling's formula for the gamma function */ +static double STIR[5] = { + 7.87311395793093628397E-4, +-2.29549961613378126380E-4, +-2.68132617805781232825E-3, + 3.47222221605458667310E-3, + 8.33333333333482257126E-2, +}; + +#define SQTPI M_SQRT2PI /* sqrt(2*pi) */ + +static double stirf ( double ); + +/*---------------------------------------------------------------------------*/ + +/* Gamma function computed by Stirling's formula. + * The polynomial STIR is valid for 33 <= x <= 172. + */ +static double stirf( double x) +{ +double y, w, v; + +w = 1.0/x; +w = 1.0 + w * _unur_cephes_polevl( w, STIR, 4 ); +y = exp(x); + +/* #define MAXSTIR MAXLOG/log(MAXLOG) */ + +if( x > MAXSTIR ) + { /* Avoid overflow in pow() */ + v = pow( x, 0.5 * x - 0.25 ); + y = v * (v / y); + } +else + { + y = pow( x, x - 0.5 ) / y; + } +y = SQTPI * y * w; +return( y ); +} + +/*---------------------------------------------------------------------------*/ + +double _unur_cephes_gamma( double x ) +{ +double p, q, z; +int i; + +int sgngam = 1; + +if (!_unur_isfinite(x)) + return(x); + +q = fabs(x); + +if( q > 33.0 ) + { + if( x < 0.0 ) + { + p = floor(q); + if( _unur_FP_same(p,q) ) + { + return( sgngam * UNUR_INFINITY); + } + i = (int) p; + if( (i & 1) == 0 ) + sgngam = -1; + z = q - p; + if( z > 0.5 ) + { + p += 1.0; + z = q - p; + } + z = q * sin( PI * z ); + if( _unur_iszero(z) ) + { + return( sgngam * UNUR_INFINITY); + } + z = fabs(z); + z = PI/(z * stirf(q) ); + } + else + { + z = stirf(x); + } + return( sgngam * z ); + } + +z = 1.0; +while( x >= 3.0 ) + { + x -= 1.0; + z *= x; + } + +while( x < 0.0 ) + { + if( x > -1.E-9 ) + goto small; + z /= x; + x += 1.0; + } + +while( x < 2.0 ) + { + if( x < 1.e-9 ) + goto small; + z /= x; + x += 1.0; + } + +if( _unur_isfsame(x, 2.0) ) + return(z); + +x -= 2.0; +p = _unur_cephes_polevl( x, P, 6 ); +q = _unur_cephes_polevl( x, Q, 7 ); +return( z * p / q ); + +small: +if( _unur_iszero(x) ) + return( UNUR_INFINITY ); +else + return( z/((1.0 + 0.5772156649015329 * x) * x) ); +} + +/*---------------------------------------------------------------------------*/ + +/* A[]: Stirling's formula expansion of log gamma + * B[], C[]: log gamma function between 2 and 3 + */ + +static double A[] = { + 8.11614167470508450300E-4, +-5.95061904284301438324E-4, + 7.93650340457716943945E-4, +-2.77777777730099687205E-3, + 8.33333333333331927722E-2 +}; +static double B[] = { +-1.37825152569120859100E3, +-3.88016315134637840924E4, +-3.31612992738871184744E5, +-1.16237097492762307383E6, +-1.72173700820839662146E6, +-8.53555664245765465627E5 +}; +static double C[] = { +/* 1.00000000000000000000E0, */ +-3.51815701436523470549E2, +-1.70642106651881159223E4, +-2.20528590553854454839E5, +-1.13933444367982507207E6, +-2.53252307177582951285E6, +-2.01889141433532773231E6 +}; + +/* log( sqrt( 2*pi ) ) */ +static double LS2PI = 0.91893853320467274178; + +#define MAXLGM 2.556348e305 + +/*---------------------------------------------------------------------------*/ + +/* Logarithm of gamma function */ + +double _unur_cephes_lgam( double x ) +{ +double p, q, u, w, z; +int i; + +int sgngam = 1; + +if (!_unur_isfinite(x)) + return(UNUR_INFINITY); + +if( x < -34.0 ) + { + q = -x; + w = _unur_cephes_lgam(q); + p = floor(q); + if( _unur_FP_same(p,q) ) + return (UNUR_INFINITY); + i = (int) p; + if( (i & 1) == 0 ) + sgngam = -1; + else + sgngam = 1; + z = q - p; + if( z > 0.5 ) + { + p += 1.0; + z = p - q; + } + z = q * sin( PI * z ); + if( _unur_iszero(z) ) + return (UNUR_INFINITY); +/* z = log(PI) - log( z ) - w;*/ + z = LOGPI - log( z ) - w; + return( z ); + } + +if( x < 13.0 ) + { + z = 1.0; + p = 0.0; + u = x; + while( u >= 3.0 ) + { + p -= 1.0; + u = x + p; + z *= u; + } + while( u < 2.0 ) + { + if( _unur_iszero(u) ) + return (UNUR_INFINITY); + z /= u; + p += 1.0; + u = x + p; + } + if( z < 0.0 ) + { + sgngam = -1; + z = -z; + } + else + sgngam = 1; + if( _unur_isfsame(u, 2.0) ) + return( log(z) ); + p -= 2.0; + x = x + p; + p = x * _unur_cephes_polevl( x, B, 5 ) / _unur_cephes_p1evl( x, C, 6); + return( log(z) + p ); + } + +if( x > MAXLGM ) + return( sgngam * UNUR_INFINITY ); + +q = ( x - 0.5 ) * log(x) - x + LS2PI; +if( x > 1.0e8 ) + return( q ); + +p = 1.0/(x*x); +if( x >= 1000.0 ) + q += (( 7.9365079365079365079365e-4 * p + - 2.7777777777777777777778e-3) *p + + 0.0833333333333333333333) / x; +else + q += _unur_cephes_polevl( p, A, 4 ) / x; +return( q ); +} + +/*---------------------------------------------------------------------------*/ +#endif /* COMPILE_CEPHES */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/specfunct/cephes_igam.c b/vendor/unuran-1.11.0/src/specfunct/cephes_igam.c new file mode 100644 index 0000000..3613df6 --- /dev/null +++ b/vendor/unuran-1.11.0/src/specfunct/cephes_igam.c @@ -0,0 +1,208 @@ +/* igam.c + * + * Incomplete gamma integral + * + * + * + * SYNOPSIS: + * + * double a, x, y, igam(); + * + * y = igam( a, x ); + * + * DESCRIPTION: + * + * The function is defined by + * + * x + * - + * 1 | | -t a-1 + * igam(a,x) = ----- | e t dt. + * - | | + * | (a) - + * 0 + * + * + * In this implementation both arguments must be positive. + * The integral is evaluated by either a power series or + * continued fraction expansion, depending on the relative + * values of a and x. + * + * ACCURACY: + * + * Relative error: + * arithmetic domain # trials peak rms + * IEEE 0,30 200000 3.6e-14 2.9e-15 + * IEEE 0,100 300000 9.9e-14 1.5e-14 + */ + /* igamc() + * + * Complemented incomplete gamma integral + * + * + * + * SYNOPSIS: + * + * double a, x, y, igamc(); + * + * y = igamc( a, x ); + * + * DESCRIPTION: + * + * The function is defined by + * + * + * igamc(a,x) = 1 - igam(a,x) + * + * inf. + * - + * 1 | | -t a-1 + * = ----- | e t dt. + * - | | + * | (a) - + * x + * + * + * In this implementation both arguments must be positive. + * The integral is evaluated by either a power series or + * continued fraction expansion, depending on the relative + * values of a and x. + * + * ACCURACY: + * + * Tested at random a, x. + * a x Relative error: + * arithmetic domain domain # trials peak rms + * IEEE 0.5,100 0,100 200000 1.9e-14 1.7e-15 + * IEEE 0.01,0.5 0,100 200000 1.4e-13 1.6e-15 + */ + +/* +Cephes Math Library Release 2.8: June, 2000 +Copyright 1985, 1987, 2000 by Stephen L. Moshier +*/ + +/* + Wed Jan 3, Josef Leydold: + made ANSI compliant declaration +*/ + +#include "cephes_source.h" + +/*---------------------------------------------------------------------------*/ +#ifdef COMPILE_CEPHES +/*---------------------------------------------------------------------------*/ + +static double big = 4.503599627370496e15; +static double biginv = 2.22044604925031308085e-16; + +/*---------------------------------------------------------------------------*/ + +double _unur_cephes_igamc( double a, double x ) +{ +double ans, ax, c, yc, r, t, y, z; +double pk, pkm1, pkm2, qk, qkm1, qkm2; + +if( (x <= 0) || ( a <= 0) ) + return( 1.0 ); + +if( (x < 1.0) || (x < a) ) + return( 1.0 - _unur_cephes_igam(a,x) ); + +ax = a * log(x) - x - _unur_cephes_lgam(a); +if( ax < -MAXLOG ) + return( 0.0 ); + +ax = exp(ax); + +/* continued fraction */ +y = 1.0 - a; +z = x + y + 1.0; +c = 0.0; +pkm2 = 1.0; +qkm2 = x; +pkm1 = x + 1.0; +qkm1 = z * x; +ans = pkm1/qkm1; + +do + { + c += 1.0; + y += 1.0; + z += 2.0; + yc = y * c; + pk = pkm1 * z - pkm2 * yc; + qk = qkm1 * z - qkm2 * yc; + if( !_unur_iszero(qk) ) + { + r = pk/qk; + t = fabs( (ans - r)/r ); + ans = r; + } + else + t = 1.0; + pkm2 = pkm1; + pkm1 = pk; + qkm2 = qkm1; + qkm1 = qk; + if( fabs(pk) > big ) + { + pkm2 *= biginv; + pkm1 *= biginv; + qkm2 *= biginv; + qkm1 *= biginv; + } + } +while( t > MACHEP ); + +return( ans * ax ); +} + +/*---------------------------------------------------------------------------*/ + +/* left tail of incomplete gamma function: + * + * inf. k + * a -x - x + * x e > ---------- + * - - + * k=0 | (a+k+1) + * + */ + +double _unur_cephes_igam( double a, double x ) +{ +double ans, ax, c, r; + +if( (x <= 0) || ( a <= 0) ) + return( 0.0 ); + +if( (x > 1.0) && (x > a ) ) + return( 1.0 - _unur_cephes_igamc(a,x) ); + +/* Compute x**a * exp(-x) / gamma(a) */ +ax = a * log(x) - x - _unur_cephes_lgam(a); +if( ax < -MAXLOG ) + return( 0.0 ); + +ax = exp(ax); + +/* power series */ +r = a; +c = 1.0; +ans = 1.0; + +do + { + r += 1.0; + c *= x/r; + ans += c; + } +while( c/ans > MACHEP ); + +return( ans * ax/a ); +} + +/*---------------------------------------------------------------------------*/ +#endif /* COMPILE_CEPHES */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/specfunct/cephes_incbet.c b/vendor/unuran-1.11.0/src/specfunct/cephes_incbet.c new file mode 100644 index 0000000..314467e --- /dev/null +++ b/vendor/unuran-1.11.0/src/specfunct/cephes_incbet.c @@ -0,0 +1,410 @@ +/* incbet.c + * + * Incomplete beta integral + * + * + * SYNOPSIS: + * + * double a, b, x, y, incbet(); + * + * y = incbet( a, b, x ); + * + * + * DESCRIPTION: + * + * Returns incomplete beta integral of the arguments, evaluated + * from zero to x. The function is defined as + * + * x + * - - + * | (a+b) | | a-1 b-1 + * ----------- | t (1-t) dt. + * - - | | + * | (a) | (b) - + * 0 + * + * The domain of definition is 0 <= x <= 1. In this + * implementation a and b are restricted to positive values. + * The integral from x to 1 may be obtained by the symmetry + * relation + * + * 1 - incbet( a, b, x ) = incbet( b, a, 1-x ). + * + * The integral is evaluated by a continued fraction expansion + * or, when b*x is small, by a power series. + * + * ACCURACY: + * + * Tested at uniformly distributed random points (a,b,x) with a and b + * in "domain" and x between 0 and 1. + * Relative error + * arithmetic domain # trials peak rms + * IEEE 0,5 10000 6.9e-15 4.5e-16 + * IEEE 0,85 250000 2.2e-13 1.7e-14 + * IEEE 0,1000 30000 5.3e-12 6.3e-13 + * IEEE 0,10000 250000 9.3e-11 7.1e-12 + * IEEE 0,100000 10000 8.7e-10 4.8e-11 + * Outputs smaller than the IEEE gradual underflow threshold + * were excluded from these statistics. + * + * ERROR MESSAGES: + * message condition value returned + * incbet domain x<0, x>1 0.0 + * incbet underflow 0.0 + */ + + +/* +Cephes Math Library, Release 2.8: June, 2000 +Copyright 1984, 1995, 2000 by Stephen L. Moshier +*/ + +/* + Wed Jan 3, Josef Leydold: + made ANSI compliant declaration +*/ + +#include "cephes_source.h" + +/*---------------------------------------------------------------------------*/ +#ifdef COMPILE_CEPHES +/*---------------------------------------------------------------------------*/ + +#define MAXGAM MAXSTIR + +static double incbcf(double, double, double); +static double incbd(double, double, double); +static double pseries(double, double, double); + +static double big = 4.503599627370496e15; +static double biginv = 2.22044604925031308085e-16; + +/*---------------------------------------------------------------------------*/ + +double _unur_cephes_incbet( double aa, double bb, double xx ) +{ +double a, b, t, x, xc, w, y; +int flag; + +if( aa <= 0.0 || bb <= 0.0 ) + return( 0.0 ); + +if( (xx <= 0.0) || ( xx >= 1.0) ) + { + if( _unur_iszero(xx) ) + return(0.0); + if( _unur_isone(xx) ) + return( 1.0 ); + return( 0.0 ); + } + +flag = 0; +if( (bb * xx) <= 1.0 && xx <= 0.95) + { + t = pseries(aa, bb, xx); + goto done; + } + +w = 1.0 - xx; + +/* Reverse a and b if x is greater than the mean. */ +if( xx > (aa/(aa+bb)) ) + { + flag = 1; + a = bb; + b = aa; + xc = xx; + x = w; + } +else + { + a = aa; + b = bb; + xc = w; + x = xx; + } + +if( flag == 1 && (b * x) <= 1.0 && x <= 0.95) + { + t = pseries(a, b, x); + goto done; + } + +/* Choose expansion for better convergence. */ +y = x * (a+b-2.0) - (a-1.0); +if( y < 0.0 ) + w = incbcf( a, b, x ); +else + w = incbd( a, b, x ) / xc; + +/* Multiply w by the factor + a b _ _ _ + x (1-x) | (a+b) / ( a | (a) | (b) ) . */ + +y = a * log(x); +t = b * log(xc); +if( (a+b) < MAXGAM && fabs(y) < MAXLOG && fabs(t) < MAXLOG ) + { + t = pow(xc,b); + t *= pow(x,a); + t /= a; + t *= w; + t *= _unur_cephes_gamma(a+b) / (_unur_cephes_gamma(a) * _unur_cephes_gamma(b)); + goto done; + } +/* Resort to logarithms. */ +y += t + _unur_cephes_lgam(a+b) - _unur_cephes_lgam(a) - _unur_cephes_lgam(b); +y += log(w/a); +if( y < MINLOG ) + t = 0.0; +else + t = exp(y); + +done: + +if( flag == 1 ) + { + if( t <= MACHEP ) + t = 1.0 - MACHEP; + else + t = 1.0 - t; + } +return( t ); +} + + +/*---------------------------------------------------------------------------*/ + +/* Continued fraction expansion #1 + * for incomplete beta integral + */ + +static double incbcf( double a, double b, double x ) +{ +double xk, pk, pkm1, pkm2, qk, qkm1, qkm2; +double k1, k2, k3, k4, k5, k6, k7, k8; +double r, t, ans, thresh; +int n; + +k1 = a; +k2 = a + b; +k3 = a; +k4 = a + 1.0; +k5 = 1.0; +k6 = b - 1.0; +k7 = k4; +k8 = a + 2.0; + +pkm2 = 0.0; +qkm2 = 1.0; +pkm1 = 1.0; +qkm1 = 1.0; +ans = 1.0; +r = 1.0; +n = 0; +thresh = 3.0 * MACHEP; +do + { + + xk = -( x * k1 * k2 )/( k3 * k4 ); + pk = pkm1 + pkm2 * xk; + qk = qkm1 + qkm2 * xk; + pkm2 = pkm1; + pkm1 = pk; + qkm2 = qkm1; + qkm1 = qk; + + xk = ( x * k5 * k6 )/( k7 * k8 ); + pk = pkm1 + pkm2 * xk; + qk = qkm1 + qkm2 * xk; + pkm2 = pkm1; + pkm1 = pk; + qkm2 = qkm1; + qkm1 = qk; + + if( !_unur_iszero(qk) ) + r = pk/qk; + if( !_unur_iszero(r) ) + { + t = fabs( (ans - r)/r ); + ans = r; + } + else + t = 1.0; + + if( t < thresh ) + goto cdone; + + k1 += 1.0; + k2 += 1.0; + k3 += 2.0; + k4 += 2.0; + k5 += 1.0; + k6 -= 1.0; + k7 += 2.0; + k8 += 2.0; + + if( (fabs(qk) + fabs(pk)) > big ) + { + pkm2 *= biginv; + pkm1 *= biginv; + qkm2 *= biginv; + qkm1 *= biginv; + } + if( (fabs(qk) < biginv) || (fabs(pk) < biginv) ) + { + pkm2 *= big; + pkm1 *= big; + qkm2 *= big; + qkm1 *= big; + } + } +while( ++n < 300 ); + +cdone: +return(ans); +} + + + +/*---------------------------------------------------------------------------*/ + +/* Continued fraction expansion #2 + * for incomplete beta integral + */ + +static double incbd( double a, double b, double x ) +{ +double xk, pk, pkm1, pkm2, qk, qkm1, qkm2; +double k1, k2, k3, k4, k5, k6, k7, k8; +double r, t, ans, z, thresh; +int n; + +k1 = a; +k2 = b - 1.0; +k3 = a; +k4 = a + 1.0; +k5 = 1.0; +k6 = a + b; +k7 = a + 1.0;; +k8 = a + 2.0; + +pkm2 = 0.0; +qkm2 = 1.0; +pkm1 = 1.0; +qkm1 = 1.0; +z = x / (1.0-x); +ans = 1.0; +r = 1.0; +n = 0; +thresh = 3.0 * MACHEP; +do + { + + xk = -( z * k1 * k2 )/( k3 * k4 ); + pk = pkm1 + pkm2 * xk; + qk = qkm1 + qkm2 * xk; + pkm2 = pkm1; + pkm1 = pk; + qkm2 = qkm1; + qkm1 = qk; + + xk = ( z * k5 * k6 )/( k7 * k8 ); + pk = pkm1 + pkm2 * xk; + qk = qkm1 + qkm2 * xk; + pkm2 = pkm1; + pkm1 = pk; + qkm2 = qkm1; + qkm1 = qk; + + if( !_unur_iszero(qk) ) + r = pk/qk; + if( !_unur_iszero(r) ) + { + t = fabs( (ans - r)/r ); + ans = r; + } + else + t = 1.0; + + if( t < thresh ) + goto cdone; + + k1 += 1.0; + k2 -= 1.0; + k3 += 2.0; + k4 += 2.0; + k5 += 1.0; + k6 += 1.0; + k7 += 2.0; + k8 += 2.0; + + if( (fabs(qk) + fabs(pk)) > big ) + { + pkm2 *= biginv; + pkm1 *= biginv; + qkm2 *= biginv; + qkm1 *= biginv; + } + if( (fabs(qk) < biginv) || (fabs(pk) < biginv) ) + { + pkm2 *= big; + pkm1 *= big; + qkm2 *= big; + qkm1 *= big; + } + } +while( ++n < 300 ); +cdone: +return(ans); +} + + +/*---------------------------------------------------------------------------*/ + +/* Power series for incomplete beta integral. + Use when b*x is small and x not too close to 1. */ + +static double pseries( double a, double b, double x ) +{ +double s, t, u, v, n, t1, z, ai; + +ai = 1.0 / a; +u = (1.0 - b) * x; +v = u / (a + 1.0); +t1 = v; +t = u; +n = 2.0; +s = 0.0; +z = MACHEP * ai; +while( fabs(v) > z ) + { + u = (n - b) * x / n; + t *= u; + v = t / (a + n); + s += v; + n += 1.0; + } +s += t1; +s += ai; + +u = a * log(x); +if( (a+b) < MAXGAM && fabs(u) < MAXLOG ) + { + t = _unur_cephes_gamma(a+b)/(_unur_cephes_gamma(a)*_unur_cephes_gamma(b)); + s = s * t * pow(x,a); + } +else + { + t = _unur_cephes_lgam(a+b) - _unur_cephes_lgam(a) - _unur_cephes_lgam(b) + u + log(s); + if( t < MINLOG ) + s = 0.0; + else + s = exp(t); + } +return(s); +} + +/*---------------------------------------------------------------------------*/ +#endif /* COMPILE_CEPHES */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/specfunct/cephes_ndtr.c b/vendor/unuran-1.11.0/src/specfunct/cephes_ndtr.c new file mode 100644 index 0000000..ad959ba --- /dev/null +++ b/vendor/unuran-1.11.0/src/specfunct/cephes_ndtr.c @@ -0,0 +1,300 @@ +/* ndtr.c + * + * Normal distribution function + * + * + * + * SYNOPSIS: + * + * double x, y, ndtr(); + * + * y = ndtr( x ); + * + * + * + * DESCRIPTION: + * + * Returns the area under the Gaussian probability density + * function, integrated from minus infinity to x: + * + * x + * - + * 1 | | 2 + * ndtr(x) = --------- | exp( - t /2 ) dt + * sqrt(2pi) | | + * - + * -inf. + * + * = ( 1 + erf(z) ) / 2 + * = erfc(z) / 2 + * + * where z = x/sqrt(2). Computation is via the functions + * erf and erfc. + * + * + * ACCURACY: + * + * Relative error: + * arithmetic domain # trials peak rms + * DEC -13,0 8000 2.1e-15 4.8e-16 + * IEEE -13,0 30000 3.4e-14 6.7e-15 + * + * + * ERROR MESSAGES: + * + * message condition value returned + * erfc underflow x > 37.519379347 0.0 + * + */ + /* erf.c + * + * Error function + * + * + * + * SYNOPSIS: + * + * double x, y, erf(); + * + * y = erf( x ); + * + * + * + * DESCRIPTION: + * + * The integral is + * + * x + * - + * 2 | | 2 + * erf(x) = -------- | exp( - t ) dt. + * sqrt(pi) | | + * - + * 0 + * + * The magnitude of x is limited to 9.231948545 for DEC + * arithmetic; 1 or -1 is returned outside this range. + * + * For 0 <= |x| < 1, erf(x) = x * P4(x**2)/Q5(x**2); otherwise + * erf(x) = 1 - erfc(x). + * + * + * + * ACCURACY: + * + * Relative error: + * arithmetic domain # trials peak rms + * DEC 0,1 14000 4.7e-17 1.5e-17 + * IEEE 0,1 30000 3.7e-16 1.0e-16 + * + */ + /* erfc.c + * + * Complementary error function + * + * + * + * SYNOPSIS: + * + * double x, y, erfc(); + * + * y = erfc( x ); + * + * + * + * DESCRIPTION: + * + * + * 1 - erf(x) = + * + * inf. + * - + * 2 | | 2 + * erfc(x) = -------- | exp( - t ) dt + * sqrt(pi) | | + * - + * x + * + * + * For small x, erfc(x) = 1 - erf(x); otherwise rational + * approximations are computed. + * + * + * + * ACCURACY: + * + * Relative error: + * arithmetic domain # trials peak rms + * DEC 0, 9.2319 12000 5.1e-16 1.2e-16 + * IEEE 0,26.6417 30000 5.7e-14 1.5e-14 + * + * + * ERROR MESSAGES: + * + * message condition value returned + * erfc underflow x > 9.231948545 (DEC) 0.0 + * + * + */ + + +/* +Cephes Math Library Release 2.8: June, 2000 +Copyright 1984, 1987, 1988, 1992, 2000 by Stephen L. Moshier +*/ + +/* + Wed Jan 3, Josef Leydold: + made ANSI compliant declaration +*/ + +#include "cephes_source.h" + +/*---------------------------------------------------------------------------*/ +#ifdef COMPILE_CEPHES +/*---------------------------------------------------------------------------*/ + +static double P[] = { + 2.46196981473530512524E-10, + 5.64189564831068821977E-1, + 7.46321056442269912687E0, + 4.86371970985681366614E1, + 1.96520832956077098242E2, + 5.26445194995477358631E2, + 9.34528527171957607540E2, + 1.02755188689515710272E3, + 5.57535335369399327526E2 +}; +static double Q[] = { +/* 1.00000000000000000000E0,*/ + 1.32281951154744992508E1, + 8.67072140885989742329E1, + 3.54937778887819891062E2, + 9.75708501743205489753E2, + 1.82390916687909736289E3, + 2.24633760818710981792E3, + 1.65666309194161350182E3, + 5.57535340817727675546E2 +}; +static double R[] = { + 5.64189583547755073984E-1, + 1.27536670759978104416E0, + 5.01905042251180477414E0, + 6.16021097993053585195E0, + 7.40974269950448939160E0, + 2.97886665372100240670E0 +}; +static double S[] = { +/* 1.00000000000000000000E0,*/ + 2.26052863220117276590E0, + 9.39603524938001434673E0, + 1.20489539808096656605E1, + 1.70814450747565897222E1, + 9.60896809063285878198E0, + 3.36907645100081516050E0 +}; +static double T[] = { + 9.60497373987051638749E0, + 9.00260197203842689217E1, + 2.23200534594684319226E3, + 7.00332514112805075473E3, + 5.55923013010394962768E4 +}; +static double U[] = { +/* 1.00000000000000000000E0,*/ + 3.35617141647503099647E1, + 5.21357949780152679795E2, + 4.59432382970980127987E3, + 2.26290000613890934246E4, + 4.92673942608635921086E4 +}; + +/*---------------------------------------------------------------------------*/ + +double _unur_cephes_ndtr( double a ) +{ +double x, y, z; + +x = a * SQRTH; +z = fabs(x); + +if( z < SQRTH ) + y = 0.5 + 0.5 * _unur_cephes_erf(x); + +else + { + y = 0.5 * _unur_cephes_erfc(z); + + if( x > 0 ) + y = 1.0 - y; + } + +return(y); +} + +/*---------------------------------------------------------------------------*/ + +double _unur_cephes_erfc( double a ) +{ +double p,q,x,y,z; + + +if( a < 0.0 ) + x = -a; +else + x = a; + +if( x < 1.0 ) + return( 1.0 - _unur_cephes_erf(a) ); + +z = -a * a; + +if( z < -MAXLOG ) + { +under: + if( a < 0 ) + return( 2.0 ); + else + return( 0.0 ); + } + +z = exp(z); + +if( x < 8.0 ) + { + p = _unur_cephes_polevl( x, P, 8 ); + q = _unur_cephes_p1evl( x, Q, 8 ); + } +else + { + p = _unur_cephes_polevl( x, R, 5 ); + q = _unur_cephes_p1evl( x, S, 6 ); + } +y = (z * p)/q; + +if( a < 0 ) + y = 2.0 - y; + +if( _unur_iszero(y) ) + goto under; + +return(y); +} + +/*---------------------------------------------------------------------------*/ + +double _unur_cephes_erf( double x) +{ +double y, z; + +if( fabs(x) > 1.0 ) + return( 1.0 - _unur_cephes_erfc(x) ); +z = x * x; +y = x * _unur_cephes_polevl( z, T, 4 ) / _unur_cephes_p1evl( z, U, 5 ); +return( y ); + +} + +/*---------------------------------------------------------------------------*/ +#endif /* COMPILE_CEPHES */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/specfunct/cephes_ndtri.c b/vendor/unuran-1.11.0/src/specfunct/cephes_ndtri.c new file mode 100644 index 0000000..b7f8551 --- /dev/null +++ b/vendor/unuran-1.11.0/src/specfunct/cephes_ndtri.c @@ -0,0 +1,187 @@ +/* ndtri.c + * + * Inverse of Normal distribution function + * + * + * + * SYNOPSIS: + * + * double x, y, ndtri(); + * + * x = ndtri( y ); + * + * + * + * DESCRIPTION: + * + * Returns the argument, x, for which the area under the + * Gaussian probability density function (integrated from + * minus infinity to x) is equal to y. + * + * + * For small arguments 0 < y < exp(-2), the program computes + * z = sqrt( -2.0 * log(y) ); then the approximation is + * x = z - log(z)/z - (1/z) P(1/z) / Q(1/z). + * There are two rational functions P/Q, one for 0 < y < exp(-32) + * and the other for y up to exp(-2). For larger arguments, + * w = y - 0.5, and x/sqrt(2pi) = w + w**3 R(w**2)/S(w**2)). + * + * + * ACCURACY: + * + * Relative error: + * arithmetic domain # trials peak rms + * DEC 0.125, 1 5500 9.5e-17 2.1e-17 + * DEC 6e-39, 0.135 3500 5.7e-17 1.3e-17 + * IEEE 0.125, 1 20000 7.2e-16 1.3e-16 + * IEEE 3e-308, 0.135 50000 4.6e-16 9.8e-17 + * + * + * ERROR MESSAGES: + * + * message condition value returned + * ndtri domain x <= 0 -MAXNUM + * ndtri domain x >= 1 MAXNUM + * + */ + + +/* +Cephes Math Library Release 2.8: June, 2000 +Copyright 1984, 1987, 1989, 2000 by Stephen L. Moshier +*/ + +/* + Wed Jan 3, Josef Leydold: + made ANSI compliant declaration +*/ + +#include "cephes_source.h" + +/*---------------------------------------------------------------------------*/ +#ifdef COMPILE_CEPHES +/*---------------------------------------------------------------------------*/ + +#define s2pi M_SQRT2PI /* sqrt(2pi) */ + +/* approximation for 0 <= |y - 0.5| <= 3/8 */ +static double P0[5] = { +-5.99633501014107895267E1, + 9.80010754185999661536E1, +-5.66762857469070293439E1, + 1.39312609387279679503E1, +-1.23916583867381258016E0, +}; +static double Q0[8] = { +/* 1.00000000000000000000E0,*/ + 1.95448858338141759834E0, + 4.67627912898881538453E0, + 8.63602421390890590575E1, +-2.25462687854119370527E2, + 2.00260212380060660359E2, +-8.20372256168333339912E1, + 1.59056225126211695515E1, +-1.18331621121330003142E0, +}; + + +/* Approximation for interval z = sqrt(-2 log y ) between 2 and 8 + * i.e., y between exp(-2) = .135 and exp(-32) = 1.27e-14. + */ +static double P1[9] = { + 4.05544892305962419923E0, + 3.15251094599893866154E1, + 5.71628192246421288162E1, + 4.40805073893200834700E1, + 1.46849561928858024014E1, + 2.18663306850790267539E0, +-1.40256079171354495875E-1, +-3.50424626827848203418E-2, +-8.57456785154685413611E-4, +}; +static double Q1[8] = { +/* 1.00000000000000000000E0,*/ + 1.57799883256466749731E1, + 4.53907635128879210584E1, + 4.13172038254672030440E1, + 1.50425385692907503408E1, + 2.50464946208309415979E0, +-1.42182922854787788574E-1, +-3.80806407691578277194E-2, +-9.33259480895457427372E-4, +}; + + +/* Approximation for interval z = sqrt(-2 log y ) between 8 and 64 + * i.e., y between exp(-32) = 1.27e-14 and exp(-2048) = 3.67e-890. + */ + +static double P2[9] = { + 3.23774891776946035970E0, + 6.91522889068984211695E0, + 3.93881025292474443415E0, + 1.33303460815807542389E0, + 2.01485389549179081538E-1, + 1.23716634817820021358E-2, + 3.01581553508235416007E-4, + 2.65806974686737550832E-6, + 6.23974539184983293730E-9, +}; +static double Q2[8] = { +/* 1.00000000000000000000E0,*/ + 6.02427039364742014255E0, + 3.67983563856160859403E0, + 1.37702099489081330271E0, + 2.16236993594496635890E-1, + 1.34204006088543189037E-2, + 3.28014464682127739104E-4, + 2.89247864745380683936E-6, + 6.79019408009981274425E-9, +}; + +/*---------------------------------------------------------------------------*/ + +double _unur_cephes_ndtri( double yval ) +{ +double x, y, z, y2, x0, x1; +int code; + +if( yval <= 0.0 ) + return( -MAXNUM ); +if( yval >= 1.0 ) + return( MAXNUM ); + +code = 1; +y = yval; +if( y > (1.0 - 0.13533528323661269189) ) /* 0.135... = exp(-2) */ + { + y = 1.0 - y; + code = 0; + } + +if( y > 0.13533528323661269189 ) + { + y = y - 0.5; + y2 = y * y; + x = y + y * (y2 * _unur_cephes_polevl( y2, P0, 4)/_unur_cephes_p1evl( y2, Q0, 8 )); + x = x * s2pi; + return(x); + } + +x = sqrt( -2.0 * log(y) ); +x0 = x - log(x)/x; + +z = 1.0/x; +if( x < 8.0 ) /* y > exp(-32) = 1.2664165549e-14 */ + x1 = z * _unur_cephes_polevl( z, P1, 8 )/_unur_cephes_p1evl( z, Q1, 8 ); +else + x1 = z * _unur_cephes_polevl( z, P2, 8 )/_unur_cephes_p1evl( z, Q2, 8 ); +x = x0 - x1; +if( code != 0 ) + x = -x; +return( x ); +} + +/*---------------------------------------------------------------------------*/ +#endif /* COMPILE_CEPHES */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/specfunct/cephes_polevl.c b/vendor/unuran-1.11.0/src/specfunct/cephes_polevl.c new file mode 100644 index 0000000..b43f223 --- /dev/null +++ b/vendor/unuran-1.11.0/src/specfunct/cephes_polevl.c @@ -0,0 +1,107 @@ +/* polevl.c + * p1evl.c + * + * Evaluate polynomial + * + * + * + * SYNOPSIS: + * + * int N; + * double x, y, coef[N+1], polevl[]; + * + * y = polevl( x, coef, N ); + * + * + * + * DESCRIPTION: + * + * Evaluates polynomial of degree N: + * + * 2 N + * y = C + C x + C x +...+ C x + * 0 1 2 N + * + * Coefficients are stored in reverse order: + * + * coef[0] = C , ..., coef[N] = C . + * N 0 + * + * The function p1evl() assumes that coef[N] = 1.0 and is + * omitted from the array. Its calling arguments are + * otherwise the same as polevl(). + * + * + * SPEED: + * + * In the interest of speed, there are no checks for out + * of bounds arithmetic. This routine is used by most of + * the functions in the library. Depending on available + * equipment features, the user may wish to rewrite the + * program in microcode or assembly language. + * + */ + + +/* +Cephes Math Library Release 2.1: December, 1988 +Copyright 1984, 1987, 1988 by Stephen L. Moshier +Direct inquiries to 30 Frost Street, Cambridge, MA 02140 +*/ + +/* + Wed Jan 3, Josef Leydold: + made ANSI compliant declaration +*/ + +#include "cephes_source.h" + +/*---------------------------------------------------------------------------*/ +#ifdef COMPILE_CEPHES +/*---------------------------------------------------------------------------*/ + +double _unur_cephes_polevl( double x, double coef[], int N ) +{ +double ans; +int i; +double *p; + +p = coef; +ans = *p++; +i = N; + +do + ans = ans * x + *p++; +while( --i ); + +return( ans ); +} + +/*---------------------------------------------------------------------------*/ + +/* p1evl() */ +/* N + * Evaluate polynomial when coefficient of x is 1.0. + * Otherwise same as polevl. + */ + +double _unur_cephes_p1evl( double x, double coef[], int N ) +{ +double ans; +double *p; +int i; + +p = coef; +ans = x + *p++; +i = N-1; + +do + ans = ans * x + *p++; +while( --i ); + +return( ans ); +} + +/*---------------------------------------------------------------------------*/ +#endif /* COMPILE_CEPHES */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/specfunct/cephes_source.h b/vendor/unuran-1.11.0/src/specfunct/cephes_source.h new file mode 100644 index 0000000..76e6fc3 --- /dev/null +++ b/vendor/unuran-1.11.0/src/specfunct/cephes_source.h @@ -0,0 +1,150 @@ +/* + + This file was considerably changed for UNU.RAN. + As a consequence it has been renamed from "mconf.h" to + "cephes_source.h" to avoid confusion. + + We were only interested in the files: + gamma.c + igamma.c + incbet.c + ndtr.c + ndtri.c + + to use these files we needed the auxiliary files: + isnan.c + mtherr.c + polevl.c + + The aim was to enhance portability for ANSI C without expert + knowledge of the floating point unit. + + The main changes are + numeric constants (in cephes - const.c) are replaced + by macros defined in this file (source_mconf.h). + + We changed these constants using the constants provided by + ANSI C in the math.h file. + + We changed also the definitions of MAXGAM (in incbet.c) and of + MAXSTIR (in gamma.c). + + Everything concerning NANS and INFINITY was moved into isnan.c. + (Also the defines to turn it off or on.) + We have only tested this version with NAN and INFINITY turned + off, but we have not changed anything concerning that + question. So turning this support on should (could) work. + + + March 26th, 2001, Josef Leydold and Wolfgang Hoermann. + +*/ + +/*---------------------------------------------------------------------------*/ + +/* mconf.h + * + * Common include file for math routines + * + * + * + * SYNOPSIS: + * + * #include "mconf.h" + * + * + * + * DESCRIPTION: + * + * This file contains definitions for error codes that are + * passed to the common error handling routine mtherr() + * (which see). + * + * The file also includes a conditional assembly definition + * for the type of computer arithmetic (IEEE, DEC, Motorola + * IEEE, or UNKnown). + * + * For Digital Equipment PDP-11 and VAX computers, certain + * IBM systems, and others that use numbers with a 56-bit + * significand, the symbol DEC should be defined. In this + * mode, most floating point constants are given as arrays + * of octal integers to eliminate decimal to binary conversion + * errors that might be introduced by the compiler. + * + * For little-endian computers, such as IBM PC, that follow the + * IEEE Standard for Binary Floating Point Arithmetic (ANSI/IEEE + * Std 754-1985), the symbol IBMPC should be defined. These + * numbers have 53-bit significands. In this mode, constants + * are provided as arrays of hexadecimal 16 bit integers. + * + * Big-endian IEEE format is denoted MIEEE. On some RISC + * systems such as Sun SPARC, double precision constants + * must be stored on 8-byte address boundaries. Since integer + * arrays may be aligned differently, the MIEEE configuration + * may fail on such machines. + * + * To accommodate other types of computer arithmetic, all + * constants are also provided in a normal decimal radix + * which one can hope are correctly converted to a suitable + * format by the available C language compiler. To invoke + * this mode, define the symbol UNK. + * + * An important difference among these modes is a predefined + * set of machine arithmetic constants for each. The numbers + * MACHEP (the machine roundoff error), MAXNUM (largest number + * represented), and several other parameters are preset by + * the configuration symbol. Check the file const.c to + * ensure that these values are correct for your computer. + * + * Configurations NANS, INFINITIES, MINUSZERO, and DENORMAL + * may fail on many systems. Verify that they are supposed + * to work on your computer. + */ +/* +Cephes Math Library Release 2.3: June, 1995 +Copyright 1984, 1987, 1989, 1995 by Stephen L. Moshier +*/ + +/*---------------------------------------------------------------------------*/ +/* Include constants used in UNU.RAN. */ + +#include + +/*---------------------------------------------------------------------------*/ +/* Define mathematical constants (see x_math_source.h). */ + +#define PI M_PI /* Pi */ +#define SQRTH M_SQRTH /* sqrt(1/2) */ + +/*---------------------------------------------------------------------------*/ +/* Define constant for floating point arithmetic. */ + +#define MAXNUM DBL_MAX /* largest number represented */ + +/*---------------------------------------------------------------------------*/ +/* Prototypes for functions from Cephes library */ + +/* gamma.c */ +double _unur_cephes_gamma( double x ); +double _unur_cephes_lgam( double x ); + +/* igam.c */ +double _unur_cephes_igamc( double a, double x ); +double _unur_cephes_igam( double a, double x ); + +/* incbet.c */ +double _unur_cephes_incbet( double aa, double bb, double xx ); + +/* ndtr.c */ +double _unur_cephes_ndtr( double a ); +double _unur_cephes_erfc( double a ); +double _unur_cephes_erf( double x ); + +/* ndtri.c */ +double _unur_cephes_ndtri( double yval ); + +/* polevl.c */ +double _unur_cephes_polevl( double x, double coef[], int N ); +double _unur_cephes_p1evl( double x, double coef[], int N ); + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/specfunct/cgamma.c b/vendor/unuran-1.11.0/src/specfunct/cgamma.c new file mode 100644 index 0000000..2620a36 --- /dev/null +++ b/vendor/unuran-1.11.0/src/specfunct/cgamma.c @@ -0,0 +1,154 @@ +/*---------------------------------------------------------------------------*/ +/* */ +/* Logarithm of complex gamma function */ +/* */ +/*---------------------------------------------------------------------------*/ + +#include + +/*---------------------------------------------------------------------------*/ + +double +_unur_Relcgamma (double x, double y) +/*---------------------------------------------------------------------------*/ +/* Real part of logarithm of complex gamma function: */ +/* log(Gamma(|z|)) = Re(log(Gamma(z)) */ +/* */ +/* parameters: */ +/* x ... real part of argument z */ +/* y ... imaginary part of argument z */ +/*---------------------------------------------------------------------------*/ +/* */ +/* references: */ +/* S. Zhang & J. Jin: "Computation of Special Functions" (Wiley, 1996). */ +/* */ +/*---------------------------------------------------------------------------*/ +/* */ +/* Original FORTRAN code by S. Zhang and J. Jin. */ +/* http://iris-lee3.ece.uiuc.edu/~jjin/routines/routines.html */ +/* */ +/* C All the programs and subroutines contained in this archive are */ +/* C copyrighted. However, we give permission to the user who downloads */ +/* C these routines to incorporate any of these routines into his or */ +/* C her programs provided that the copyright is acknowledged. */ +/* */ +/* C Contact Information */ +/* C Email: j-jin1@uiuc.edu */ +/* C Phone: (217) 244-0756 */ +/* C Fax: (217) 333-5962 */ +/* C Professor Jianming Jin */ +/* C Department of Electrical and Computer Engineering */ +/* C University of Illinois at Urbana-Champaign */ +/* C 461 William L Everitt Laboratory */ +/* C 1406 West Green Street */ +/* C Urbana, IL 61801-2991 */ +/* */ +/* We found the code in R package 'fAsiaOptions', Version: 2100.76 */ +/* */ +/* ......................................................................... */ +/* */ +/* Translation into C code found in */ +/* */ +/* cgamma.cpp -- Complex gamma function. */ +/* Algorithms and coefficient values from "Computation of Special */ +/* Functions", Zhang and Jin, John Wiley and Sons, 1996. */ +/* */ +/* (C) 2003, C. Bond. All rights reserved. */ +/* */ +/* See http:// www.crbond.com/ */ +/* */ +/* This website contains a variety of materials related to technology and */ +/* engineering. Downloadable software, much of it original, is available */ +/* from some of the pages. */ +/* All downloadable software is offered freely and without restriction -- */ +/* although in most cases the files should be considered as works in */ +/* progress (alpha or beta level). */ +/* Source code is also included for some applications. */ +/* */ +/* ......................................................................... */ +/* */ +/* Modified by Kemal Dingic Oct 2011. */ +/* Modified by Josef Leydold on Tue Nov 1 13:22:09 CET 2011 */ +/* */ +/*---------------------------------------------------------------------------*/ +{ + double t, x0, x1; + double q1, logq1, q2, th /* , th1, th2 */; + double gr1, /* gi1, */ sr, si; + int j, k, na; + + static const double a[] = { + 8.333333333333333e-02, -2.777777777777778e-03, + 7.936507936507937e-04, -5.952380952380952e-04, + 8.417508417508418e-04, -1.917526917526918e-03, + 6.410256410256410e-03, -2.955065359477124e-02, + 1.796443723688307e-01, -1.39243221690590 }; + + /* real part and imaginary part of Gamma(z) */ + double gr; /* gi; */ + + x1 = 0.0; + na = 0; + + if ((y == 0.0) && (x == (int)x) && (x <= 0.0)) + return UNUR_INFINITY; + else if (x < 0.0) { + x1 = x; + x = -x; + y = -y; + } + + x0 = x; + if (x <= 7.0) { + na = (int)(7.0-x); + x0 = x+na; + } + + q1 = hypot(x0,y); /* = sqrt(x0*x0+y*y) */ + th = atan(y/x0); + logq1 = log(q1); + gr = (x0-0.5)*logq1-th*y-x0+0.5*log(2.0*M_PI); + /* gi = th*(x0-0.5)+y*logq1-y; */ + + for (k=0; k<10; k++){ + t = pow(q1,-1.0-2.0*k); + gr += (a[k]*t*cos((2.0*k+1.0)*th)); + /* gi -= (a[k]*t*sin((2.0*k+1.0)*th)); */ + } + + if (x <= 7.0) { + gr1 = 0.0; + /* gi1 = 0.0; */ + for (j=0; j + +#if !HAVE_DECL_HYPOT +double _unur_hypot (const double x, const double y) +{ + double xabs = fabs(x) ; + double yabs = fabs(y) ; + double min, max; + + if (xabs < yabs) { + min = xabs ; + max = yabs ; + } else { + min = yabs ; + max = xabs ; + } + + if (min == 0) + { + return max ; + } + + { + double u = min / max ; + return max * sqrt (1 + u * u) ; + } +} /* end of _unur_hypot() */ +#endif diff --git a/vendor/unuran-1.11.0/src/specfunct/log1p.c b/vendor/unuran-1.11.0/src/specfunct/log1p.c new file mode 100644 index 0000000..da141e6 --- /dev/null +++ b/vendor/unuran-1.11.0/src/specfunct/log1p.c @@ -0,0 +1,39 @@ +/* _unur_log1p + * + * Compute log(1+x) + * + * Replacement for missing C99 function log1p + * + * Copied and renamed from gsl_log1p into _unur_log1p + * by Josef Leydold, Wed Jun 29 16:39:10 CEST 2005 + */ + +/* sys/log1p.c + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +#if !HAVE_DECL_LOG1P +double _unur_log1p (double x) +{ + volatile double y; + y = 1 + x; + return log(y) - ((y-1)-x)/y ; /* cancels errors with IEEE arithmetic */ +} +#endif diff --git a/vendor/unuran-1.11.0/src/specfunct/unur_specfunct_source.h b/vendor/unuran-1.11.0/src/specfunct/unur_specfunct_source.h new file mode 100644 index 0000000..3c0f4b9 --- /dev/null +++ b/vendor/unuran-1.11.0/src/specfunct/unur_specfunct_source.h @@ -0,0 +1,233 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unur_specfunct_source.h * + * * + * PURPOSE: * + * prototypes and macros for using special functions like erf(), * + * gamma(), beta(), etc., which are imported from other packages. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef UNUR_SPECFUNCT_SOURCE_H_SEEN +#define UNUR_SPECFUNCT_SOURCE_H_SEEN +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Prototypes for special functions like erf(), gamma(), beta(), etc. * + * which are imported from other packages. * + * * + * We use the package CEPHES/DOUBLE for computing these functions * + * (available from NETLIB, http://www.netlib.org/cephes/ * + * Copyright 1984 - 1994 by Stephen L. Moshier * + * * + * Alternatively, we also can use the functions from the Rmath library * + * from the R project for statistical computing, http://www.R-project.org/ * + * * + *****************************************************************************/ + +/* We define macros for special functions. + * + * The following macros must be defined: + * + * _unur_SF_incomplete_beta ... incomplete beta integral + * _unur_SF_ln_gamma ... logarithm of gamma function + * _unur_SF_ln_factorial ... logarithm of factorial + * _unur_SF_incomplete_gamma ... incomplete gamma function + * _unur_SF_cdf_normal ... CDF of normal distribution + * _unur_SF_invcdf_normal ... inverse CDF of normal distribution + * + * Additional functions: + * + * _unur_SF_bessel_k ... modified Bessel function K_nu of second kind + * _unur_SF_ln_bessel_k ... logarithm of K_n + * + *---------------------------------------------------------------------------*/ + +#ifdef HAVE_LIBRMATH + +/*---------------------------------------------------------------------------*/ +/* Routines from the Rmath library (R project). */ +/*---------------------------------------------------------------------------*/ + +/* we have to distinguish between two cases: */ +# ifdef R_UNURAN +/* Rmath for 'Runuran': nothing special to do. */ +# else +/* Rmath standalone library. */ +# define MATHLIB_STANDALONE +# endif + +/* include Rmath header file */ +# include + +/* we have to #undef some macros from Rmath.h */ +#ifdef trunc +#undef trunc +#endif + +#ifdef beta +#undef beta +#endif + +/* ......................................................................... */ + +/* incomplete beta integral */ +#define _unur_SF_incomplete_beta(x,a,b) pbeta((x),(a),(b),TRUE,FALSE) + +/* logarithm of gamma function */ +#define _unur_SF_ln_gamma(x) lgammafn(x) + +/* logarithm of factorial */ +#define _unur_SF_ln_factorial(x) lgammafn((x)+1.) + +/* incomplete gamma function */ +#define _unur_SF_incomplete_gamma(x,a) pgamma(x,a,1.,TRUE,FALSE) + +/* modified Bessel function K_nu of second kind (AKA third kind) */ +#define _unur_SF_bessel_k(x,nu) bessel_k((x),(nu),1) + +/* logarithm of modified Bessel function K_nu of second kind (AKA third kind)*/ +#define _unur_SF_ln_bessel_k(x,nu) (log(bessel_k((x),(nu),2)) - (x)) + +/* Normal distribution */ +#define _unur_SF_cdf_normal(x) pnorm((x),0.,1.,TRUE,FALSE) +#define _unur_SF_invcdf_normal(u) qnorm((u),0.,1.,TRUE,FALSE) + +/* ..........................................................................*/ + +/* Beta Distribution */ +#define _unur_SF_invcdf_beta(u,p,q) qbeta((u),(p),(q),TRUE,FALSE) + +/* F Distribution */ +#define _unur_SF_cdf_F(x,nua,nub) pf((x),(nua),(nub),TRUE,FALSE) +#define _unur_SF_invcdf_F(u,nua,nub) qf((u),(nua),(nub),TRUE,FALSE) + +/* Gamma Distribution */ +#define _unur_SF_invcdf_gamma(u,shape,scale) qgamma((u),(shape),(scale),TRUE,FALSE) + +/* Student t Distribution */ +#define _unur_SF_cdf_student(x,nu) pt((x),(nu),TRUE,FALSE) +#define _unur_SF_invcdf_student(u,nu) qt((u),(nu),TRUE,FALSE) + +/* Binomial Distribution */ +#define _unur_SF_invcdf_binomial(u,n,p) qbinom((u),(n),(p),TRUE,FALSE) + +/* Hypergeometric Distribution */ +#define _unur_SF_cdf_hypergeometric(x,N,M,n) phyper((x),(M),(N)-(M),(n),TRUE,FALSE) +#define _unur_SF_invcdf_hypergeometric(u,N,M,n) qhyper((u),(M),(N)-(M),(n),TRUE,FALSE) + +/* Negative Binomial Distribution */ +#define _unur_SF_cdf_negativebinomial(x,n,p) pnbinom((x),(n),(p),TRUE,FALSE) +#define _unur_SF_invcdf_negativebinomial(u,n,p) qnbinom((u),(n),(p),TRUE,FALSE) + +/* Poisson Distribution */ +#define _unur_SF_invcdf_poisson(u,theta) qpois((u),(theta),TRUE,FALSE) + +/*---------------------------------------------------------------------------*/ +/* end: Rmath library (R project) */ +/*---------------------------------------------------------------------------*/ + +#else + +/*---------------------------------------------------------------------------*/ +/* Routines from the CEPHES library. */ +/*---------------------------------------------------------------------------*/ + +#define COMPILE_CEPHES + +/* incomplete beta integral */ +double _unur_cephes_incbet(double a, double b, double x); +#define _unur_SF_incomplete_beta(x,a,b) _unur_cephes_incbet((a),(b),(x)) + +/* logarithm of gamma function */ +double _unur_cephes_lgam(double x); +#define _unur_SF_ln_gamma(x) _unur_cephes_lgam(x) + +/* logarithm of factorial */ +#define _unur_SF_ln_factorial(x) _unur_cephes_lgam((x)+1.) + +/* incomplete gamma function */ +double _unur_cephes_igam(double a, double x); +#define _unur_SF_incomplete_gamma(x,a) _unur_cephes_igam((a),(x)) + +/* normal distribution function */ +double _unur_cephes_ndtr(double x); +#define _unur_SF_cdf_normal(x) _unur_cephes_ndtr(x) + +/* inverse of normal distribution function */ +double _unur_cephes_ndtri(double x); +#define _unur_SF_invcdf_normal(x) _unur_cephes_ndtri(x) + +/*---------------------------------------------------------------------------*/ +/* end: CEPHES library */ +/*---------------------------------------------------------------------------*/ + +#endif + +/***************************************************************************** + * * + * Special functions implemented in UNU.RAN * + * * + *****************************************************************************/ + +/* modified Bessel function K_nu of second kind (AKA third kind) */ +/* when BOTH nu and x are large. */ +/* [ Experimental function! ] */ +double _unur_bessel_k_nuasympt (double x, double nu, int islog, int expon_scaled); +#define _unur_SF_bessel_k_nuasympt(x,nu,islog,exponscaled) \ + _unur_bessel_k_nuasympt((x),(nu),(islog),(exponscaled)) + +/* logarithm of complex gamma function */ +double _unur_Relcgamma (double x, double y); +#define _unur_SF_Relcgamma(x,y) _unur_Relcgamma((x),(y)) + + +/***************************************************************************** + * * + * Replacement for missing (system) functions * + * * + *****************************************************************************/ + +#if !HAVE_DECL_LOG1P +/* log(1+x) */ +/* (replacement for missing C99 function log1p) */ +double _unur_log1p(double x); +#define log1p _unur_log1p +#endif + +#if !HAVE_DECL_HYPOT +/* sqrt(x^2 + y^2) */ +/* (replacement for missing C99 function hypot) */ +double _unur_hypot(const double x, const double y); +#define hypot _unur_hypot +#endif + +/*---------------------------------------------------------------------------*/ +#endif /* UNUR_SPECFUNCT_SOURCE_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/tests/.libs/libtests.a b/vendor/unuran-1.11.0/src/tests/.libs/libtests.a new file mode 100644 index 0000000..0d59865 Binary files /dev/null and b/vendor/unuran-1.11.0/src/tests/.libs/libtests.a differ diff --git a/vendor/unuran-1.11.0/src/tests/Makefile b/vendor/unuran-1.11.0/src/tests/Makefile new file mode 100644 index 0000000..75bc594 --- /dev/null +++ b/vendor/unuran-1.11.0/src/tests/Makefile @@ -0,0 +1,723 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# src/tests/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/unuran +pkgincludedir = $(includedir)/unuran +pkglibdir = $(libdir)/unuran +pkglibexecdir = $(libexecdir)/unuran +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +subdir = src/tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libtests_la_LIBADD = +am_libtests_la_OBJECTS = chi2test.lo correlation.lo countpdf.lo \ + counturn.lo inverror.lo moments.lo printsample.lo quantiles.lo \ + tests.lo timing.lo +libtests_la_OBJECTS = $(am_libtests_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I. -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/chi2test.Plo \ + ./$(DEPDIR)/correlation.Plo ./$(DEPDIR)/countpdf.Plo \ + ./$(DEPDIR)/counturn.Plo ./$(DEPDIR)/inverror.Plo \ + ./$(DEPDIR)/moments.Plo ./$(DEPDIR)/printsample.Plo \ + ./$(DEPDIR)/quantiles.Plo ./$(DEPDIR)/tests.Plo \ + ./$(DEPDIR)/timing.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libtests_la_SOURCES) +DIST_SOURCES = $(libtests_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(includedir)" +HEADERS = $(include_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_CFLAGS = -Wall -Wextra -Wshadow -Wstrict-prototypes +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf +AUTOHEADER = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader +AUTOMAKE = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -fPIC +CPP = gcc -E +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +FILECMD = file +GREP = /usr/bin/grep +HAVE_DIVIDE_BY_ZERO = +HAVE_IEEE_COMPARISONS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAINT = # +MAKEINFO = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = unuran +PACKAGE_BUGREPORT = unuran@statmath.wu.ac.at +PACKAGE_NAME = unuran +PACKAGE_STRING = unuran 1.11.0 +PACKAGE_TARNAME = unuran +PACKAGE_URL = +PACKAGE_VERSION = 1.11.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +UNURAN_LT_VERSION = 16:1:0 +UNURAN_SUPPORTS_GSL = +UNURAN_SUPPORTS_PRNG = +UNURAN_SUPPORTS_RNGSTREAM = +VERSION = 1.11.0 +abs_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src/tests +abs_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src/tests +abs_top_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +have_valgrind = false +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../../ +top_builddir = ../.. +top_srcdir = ../.. +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libtests.la +libtests_la_SOURCES = \ + chi2test.c \ + correlation.c\ + countpdf.c \ + counturn.c \ + inverror.c \ + moments.c \ + printsample.c \ + quantiles.c \ + tests.c \ + timing.c + +include_HEADERS = \ + unuran_tests.h + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/tests/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libtests.la: $(libtests_la_OBJECTS) $(libtests_la_DEPENDENCIES) $(EXTRA_libtests_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libtests_la_OBJECTS) $(libtests_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/chi2test.Plo # am--include-marker +include ./$(DEPDIR)/correlation.Plo # am--include-marker +include ./$(DEPDIR)/countpdf.Plo # am--include-marker +include ./$(DEPDIR)/counturn.Plo # am--include-marker +include ./$(DEPDIR)/inverror.Plo # am--include-marker +include ./$(DEPDIR)/moments.Plo # am--include-marker +include ./$(DEPDIR)/printsample.Plo # am--include-marker +include ./$(DEPDIR)/quantiles.Plo # am--include-marker +include ./$(DEPDIR)/tests.Plo # am--include-marker +include ./$(DEPDIR)/timing.Plo # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ $< + +.c.obj: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: + $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +# $(AM_V_CC)source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/chi2test.Plo + -rm -f ./$(DEPDIR)/correlation.Plo + -rm -f ./$(DEPDIR)/countpdf.Plo + -rm -f ./$(DEPDIR)/counturn.Plo + -rm -f ./$(DEPDIR)/inverror.Plo + -rm -f ./$(DEPDIR)/moments.Plo + -rm -f ./$(DEPDIR)/printsample.Plo + -rm -f ./$(DEPDIR)/quantiles.Plo + -rm -f ./$(DEPDIR)/tests.Plo + -rm -f ./$(DEPDIR)/timing.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includeHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/chi2test.Plo + -rm -f ./$(DEPDIR)/correlation.Plo + -rm -f ./$(DEPDIR)/countpdf.Plo + -rm -f ./$(DEPDIR)/counturn.Plo + -rm -f ./$(DEPDIR)/inverror.Plo + -rm -f ./$(DEPDIR)/moments.Plo + -rm -f ./$(DEPDIR)/printsample.Plo + -rm -f ./$(DEPDIR)/quantiles.Plo + -rm -f ./$(DEPDIR)/tests.Plo + -rm -f ./$(DEPDIR)/timing.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includeHEADERS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-includeHEADERS install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-includeHEADERS + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/tests/Makefile.am b/vendor/unuran-1.11.0/src/tests/Makefile.am new file mode 100644 index 0000000..81acd72 --- /dev/null +++ b/vendor/unuran-1.11.0/src/tests/Makefile.am @@ -0,0 +1,28 @@ +## Process this file with automake to produce Makefile.in + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libtests.la + +libtests_la_SOURCES = \ + chi2test.c \ + correlation.c\ + countpdf.c \ + counturn.c \ + inverror.c \ + moments.c \ + printsample.c \ + quantiles.c \ + tests.c \ + timing.c + +include_HEADERS = \ + unuran_tests.h + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/vendor/unuran-1.11.0/src/tests/Makefile.in b/vendor/unuran-1.11.0/src/tests/Makefile.in new file mode 100644 index 0000000..9e1ba7c --- /dev/null +++ b/vendor/unuran-1.11.0/src/tests/Makefile.in @@ -0,0 +1,723 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libtests_la_LIBADD = +am_libtests_la_OBJECTS = chi2test.lo correlation.lo countpdf.lo \ + counturn.lo inverror.lo moments.lo printsample.lo quantiles.lo \ + tests.lo timing.lo +libtests_la_OBJECTS = $(am_libtests_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/chi2test.Plo \ + ./$(DEPDIR)/correlation.Plo ./$(DEPDIR)/countpdf.Plo \ + ./$(DEPDIR)/counturn.Plo ./$(DEPDIR)/inverror.Plo \ + ./$(DEPDIR)/moments.Plo ./$(DEPDIR)/printsample.Plo \ + ./$(DEPDIR)/quantiles.Plo ./$(DEPDIR)/tests.Plo \ + ./$(DEPDIR)/timing.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libtests_la_SOURCES) +DIST_SOURCES = $(libtests_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(includedir)" +HEADERS = $(include_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ +UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ +UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ +UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_valgrind = @have_valgrind@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libtests.la +libtests_la_SOURCES = \ + chi2test.c \ + correlation.c\ + countpdf.c \ + counturn.c \ + inverror.c \ + moments.c \ + printsample.c \ + quantiles.c \ + tests.c \ + timing.c + +include_HEADERS = \ + unuran_tests.h + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/tests/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libtests.la: $(libtests_la_OBJECTS) $(libtests_la_DEPENDENCIES) $(EXTRA_libtests_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libtests_la_OBJECTS) $(libtests_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chi2test.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/correlation.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/countpdf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/counturn.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inverror.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moments.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printsample.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quantiles.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tests.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timing.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/chi2test.Plo + -rm -f ./$(DEPDIR)/correlation.Plo + -rm -f ./$(DEPDIR)/countpdf.Plo + -rm -f ./$(DEPDIR)/counturn.Plo + -rm -f ./$(DEPDIR)/inverror.Plo + -rm -f ./$(DEPDIR)/moments.Plo + -rm -f ./$(DEPDIR)/printsample.Plo + -rm -f ./$(DEPDIR)/quantiles.Plo + -rm -f ./$(DEPDIR)/tests.Plo + -rm -f ./$(DEPDIR)/timing.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includeHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/chi2test.Plo + -rm -f ./$(DEPDIR)/correlation.Plo + -rm -f ./$(DEPDIR)/countpdf.Plo + -rm -f ./$(DEPDIR)/counturn.Plo + -rm -f ./$(DEPDIR)/inverror.Plo + -rm -f ./$(DEPDIR)/moments.Plo + -rm -f ./$(DEPDIR)/printsample.Plo + -rm -f ./$(DEPDIR)/quantiles.Plo + -rm -f ./$(DEPDIR)/tests.Plo + -rm -f ./$(DEPDIR)/timing.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includeHEADERS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-includeHEADERS install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-includeHEADERS + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/tests/chi2test.c b/vendor/unuran-1.11.0/src/tests/chi2test.c new file mode 100644 index 0000000..cf4c0f9 --- /dev/null +++ b/vendor/unuran-1.11.0/src/tests/chi2test.c @@ -0,0 +1,968 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * file: chi2test.c * + * * + * Chi^2 Tests (to validate implementation) * + * * + * WARNING! * + * A succesfull chi^2 test shows that the implementation is (probably) * + * correct. It DOES NOT mean that the generator is of good quality! * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "unuran_tests.h" + +/*---------------------------------------------------------------------------*/ +/* constants */ + +#define CHI2_SAMPLEFAC 40 +/* if samplesize<=0 use samplesize = CHI2_SAMPLEFAC * intervals^dim */ + +#define CHI2_CLASSMIN_DEFAULT 20 +/* default number of observations in class */ + +#define CHI2_INTERVALS_DEFAULT 50 +/* default number of intervals for chi^2 test if given number is <= 0 */ + +#define CHI2_DEFAULT_SAMPLESIZE 10000 +/* default sample size used when the given size is <= 0 */ + +#define CHI2_MAX_SAMPLESIZE 1000000 +/* maximal sample size to prevent extremely long run times */ + +#define CHI2_MAX_TOTALINTERVALS 1000000 +/* maximal product of intervals used in chi2vec test */ + +/*---------------------------------------------------------------------------*/ +static char test_name[] = "Chi^2-Test"; +/*---------------------------------------------------------------------------*/ + +static double _unur_test_chi2_discr( struct unur_gen *gen, int samplesize, int classmin, + int verbose, FILE *out ); + +static double _unur_test_chi2_cont( struct unur_gen *gen, int n_intervals, int samplesize, int classmin, + int verbose, FILE *out ); + +static double _unur_test_chi2_cemp( struct unur_gen *gen, int n_intervals, int samplesize, int classmin, + int verbose, FILE *out ); + +static double _unur_test_chi2_vec( struct unur_gen *gen, int n_intervals, int samplesize, int classmin, + int verbose, FILE *out ); + +static double _unur_test_chi2_cvemp( struct unur_gen *gen, int n_intervals, int samplesize, int classmin, + int verbose, FILE *out ); + +static double _unur_test_chi2test( double *prob, int *observed, int len, int classmin, + int verbose, FILE *out ); + +/*---------------------------------------------------------------------------*/ + +double +unur_test_chi2( struct unur_gen *gen, + int n_intervals, + int samplesize, + int classmin, + int verbose, + FILE *out ) + /*----------------------------------------------------------------------*/ + /* Chi^2 test for univariate distributions */ + /* */ + /* parameters: */ + /* gen ... pointer to generator */ + /* n_intervals .. number if intervals */ + /* case probability vector: use its length */ + /* otherwise and if <= 0 use default */ + /* samplesize ... samplesize for test */ + /* (if <= 0, (#classes)^2 is used as default.) */ + /* classmin ... minimum number of expected occurrences for each class */ + /* (if <= 0, a default value is used.) */ + /* verbose ... verbosity level */ + /* 0 = no output on out */ + /* 1 = print summary */ + /* 2 = print classes and summary */ + /* out ... output stream */ + /* */ + /* */ + /* return: */ + /* p-value of test statistics under H_0 */ + /* */ + /* error: */ + /* -2. ... missing data */ + /* -1. ... other errors */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL(test_name,gen,-1.); + + if (verbose >= 1) + fprintf(out,"\nGOODNESS-OF-FIT TESTS:\n"); + + switch (gen->method & UNUR_MASK_TYPE) { + + case UNUR_METH_DISCR: + return _unur_test_chi2_discr(gen, samplesize, classmin, verbose, out); + + case UNUR_METH_CONT: + return _unur_test_chi2_cont(gen, n_intervals, samplesize, classmin, verbose, out); + + case UNUR_METH_CEMP: + return _unur_test_chi2_cemp(gen, n_intervals, samplesize, classmin, verbose, out); + + case UNUR_METH_VEC: + return _unur_test_chi2_vec(gen, n_intervals, samplesize, classmin, verbose, out); + + case UNUR_METH_CVEMP: + return _unur_test_chi2_cvemp(gen, n_intervals, samplesize, classmin, verbose, out); + + default: + _unur_error(test_name,UNUR_ERR_GENERIC,"Not implemented for such distributions!"); + return -1.; + } +} /* end of unur_test_chi2() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_test_chi2_discr( struct unur_gen *gen, + int samplesize, + int classmin, + int verbose, + FILE *out) + /*----------------------------------------------------------------------*/ + /* Chi^2 test for univariate discrete distributions */ + /* with given probability vector. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* samplesize ... samplesize for test */ + /* (if <= 0, (#classes)^2 is used as default.) */ + /* classmin ... minimum number of expected occurrences for each class */ + /* (if <= 0, a default value is used.) */ + /* verbose ... verbosity level */ + /* 0 = no output */ + /* 1 = print summary */ + /* 2 = print classes and summary */ + /* out ... output stream */ + /* */ + /* return: */ + /* p-value of test statistics under H_0 */ + /* */ + /* error: */ + /* -2. ... missing data */ + /* -1. ... other errors */ + /*----------------------------------------------------------------------*/ +{ +#define DISTR gen->distr->data.discr + double *pv; /* pointer to probability vectors */ + int n_pv; /* length of probability vector */ + + int *observed; /* vector for observed occurrences */ + double pval; /* p-value */ + int had_PV; /* whether we had a PV for test or not */ + int i,j; + + /* check arguments */ + CHECK_NULL(gen,-1.); + + /* probability vector */ + if (DISTR.pv == NULL) { + had_PV = FALSE; + /* no PV given --> try to compute PV */ + if (!unur_distr_discr_make_pv( gen->distr )) { + /* not successful */ + return -2.; + } + } + else + had_PV = TRUE; + /* pointer to PV */ + pv = DISTR.pv; + n_pv = DISTR.n_pv; + + /* allocate memory for observations */ + observed = _unur_xmalloc( n_pv * sizeof(int)); + + /* clear array */ + for( i=0; i n_pv) ? n_pv * n_pv : 1000000; + samplesize = _unur_max(samplesize,1000000); + } + + samplesize = _unur_min( samplesize, CHI2_MAX_SAMPLESIZE ); + + /* now run generator */ + for( i=0; i= 3) fprintf(out,"i = %d\n",j); + /* shift vector */ + j -= DISTR.domain[0]; + /* check range of random variates !! */ + if (j >= 0 && j < n_pv) + ++observed[j]; + /* else: ignore number --> chop off tail */ + } + + if (verbose >= 1) { + fprintf(out,"\nChi^2-Test for discrete distribution with given probability vector:"); + fprintf(out,"\n length = %d\n",n_pv); + } + + /* and now make chi^2 test */ + pval = _unur_test_chi2test(pv, observed, n_pv, classmin, verbose, out); + + /* free memory */ + free(observed); + if (!had_PV) { + free (DISTR.pv); + DISTR.pv = NULL; + DISTR.n_pv = 0; + } + + /* return result of test */ + return pval; + +#undef DISTR +} /* end of _unur_test_chi2_discr() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_test_chi2_cont( struct unur_gen *gen, + int n_intervals, + int samplesize, + int classmin, + int verbose, + FILE *out ) + /*----------------------------------------------------------------------*/ + /* Chi^2 test for univariate continuous distributions. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* n_intervals .. number of intervals in which (0,1) is partitioned */ + /* samplesize ... samplesize for test */ + /* (if <= 0, intervals^2 is used as default.) */ + /* classmin ... minimum number of expected occurrences for each class */ + /* (if <= 0, a default value is used.) */ + /* verbose ... verbosity level */ + /* 0 = no output */ + /* 1 = print summary */ + /* 2 = print classes and summary */ + /* out ... output stream */ + /* */ + /* return: */ + /* p-value of test statistics under H_0 */ + /* */ + /* error: */ + /* -2. ... missing data */ + /* -1. ... other errors */ + /*----------------------------------------------------------------------*/ +{ +#define DISTR gen->distr->data.cont + + double F, Fl, Fr, Fdelta; /* value of CDF (at left and right boundary point) */ + UNUR_FUNCT_CONT *cdf; /* pointer to CDF */ + int *observed; /* vector for observed occurrences */ + double pval; /* p-value */ + int i,j; + + /* check arguments */ + CHECK_NULL(gen,-1.); + /* we do not check magic cookies here */ + + /* CDF required */ + cdf = DISTR.cdf; + if (DISTR.cdf == NULL) { + _unur_error(test_name,UNUR_ERR_GENERIC,"CDF required for continuous random variates!"); + return -2.; + } + + /* check given number of intervals */ + if (n_intervals <= 2) + n_intervals = CHI2_INTERVALS_DEFAULT; + + /* allocate memory for observations */ + observed = _unur_xmalloc( n_intervals * sizeof(int)); + + /* clear array */ + for( i=0; i n_intervals) ? n_intervals*n_intervals : INT_MAX; + + samplesize = _unur_min( samplesize, CHI2_MAX_SAMPLESIZE ); + + /* compute Fl and Fr */ + if (gen->distr->set & UNUR_DISTR_SET_TRUNCATED) { + Fl = (DISTR.trunc[0] <= -UNUR_INFINITY) ? 0. : cdf(DISTR.trunc[0], gen->distr); + Fr = (DISTR.trunc[1] >= UNUR_INFINITY) ? 1. : cdf(DISTR.trunc[1], gen->distr); + } + else { + Fl = (DISTR.domain[0] <= -UNUR_INFINITY) ? 0. : cdf(DISTR.domain[0], gen->distr); + Fr = (DISTR.domain[1] >= UNUR_INFINITY) ? 1. : cdf(DISTR.domain[1], gen->distr); + } + Fdelta = Fr - Fl; + + /* Fr - Fl <= 0. is a fatal error */ + if (Fdelta <= 0.) { + _unur_error(gen->genid,UNUR_ERR_GENERIC,"Fdelta <= 0."); + free (observed); + return -1.; + } + + /* now run generator */ + for( i=0; i= 3) { + double x = _unur_sample_cont(gen); + F = cdf( x, gen->distr ); + fprintf(out,"x = %g\n",x); + } + else { + F = cdf( _unur_sample_cont(gen), gen->distr ); + } + F = (F-Fl)/Fdelta; + j = (int)(n_intervals * F); + if (j > n_intervals) { + _unur_warning(test_name,UNUR_ERR_GENERIC,"F(x) > Fmax (out of domain)."); + j = n_intervals-1; + } + if (j >= n_intervals) /* cdf() might return 1. */ + j = n_intervals-1; + if (j < 0 ) { /* there is something wrong with the boundaries */ + _unur_warning(test_name,UNUR_ERR_GENERIC,"F(x) < 0 (out of domain)."); + j = 0; + } + ++observed[j]; + } + + if (verbose >= 1) { + fprintf(out,"\nChi^2-Test for continuous distribution:"); + fprintf(out,"\n intervals = %d\n",n_intervals); + } + + /* and now make chi^2 test */ + pval = _unur_test_chi2test(NULL, observed, n_intervals, classmin, verbose, out ); + + /* free memory */ + free(observed); + + /* return result of test */ + return pval; + +#undef DISTR +} /* end of _unur_test_chi2_cont() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_test_chi2_cemp( struct unur_gen *gen, + int n_intervals, + int samplesize, + int classmin, + int verbose, + FILE *out ) + /*----------------------------------------------------------------------*/ + /* Chi^2 test for continuous empirical distributions. */ + /* Tests for standard normal distribution only! */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* n_intervals .. number of intervals in which (0,1) is partitioned */ + /* samplesize ... samplesize for test */ + /* (if <= 0, intervals^2 is used as default.) */ + /* classmin ... minimum number of expected occurrences for each class */ + /* (if <= 0, a default value is used.) */ + /* verbose ... verbosity level */ + /* 0 = no output */ + /* 1 = print summary */ + /* 2 = print classes and summary */ + /* out ... output stream */ + /* */ + /* return: */ + /* p-value of test statistics under H_0 */ + /* */ + /* error: */ + /* -2. ... missing data */ + /* -1. ... other errors */ + /*----------------------------------------------------------------------*/ +{ + UNUR_DISTR *distr_normal; /* object for standard normal distribution */ + UNUR_FUNCT_CONT *cdf; /* pointer to CDF */ + double F; /* value of CDF */ + int *observed; /* vector for observed occurrences */ + double pval; /* p-value */ + int i,j; + + /* check arguments */ + CHECK_NULL(gen,-1.); + /* we do not check magic cookies here */ + + /* CDF for standard normal distribution */ + distr_normal = unur_distr_normal( NULL, 0 ); + cdf = distr_normal->data.cont.cdf; + + /* check given number of intervals */ + if (n_intervals <= 2) + n_intervals = CHI2_INTERVALS_DEFAULT; + + /* allocate memory for observations */ + observed = _unur_xmalloc( n_intervals * sizeof(int)); + + /* clear array */ + for( i=0; i n_intervals) ? n_intervals*n_intervals : INT_MAX; + samplesize = _unur_min( samplesize, CHI2_MAX_SAMPLESIZE ); + + /* now run generator */ + for( i=0; i n_intervals) { + _unur_warning(test_name,UNUR_ERR_GENERIC,"F(x) > Fmax (out of domain)."); + j = n_intervals-1; + } + if (j >= n_intervals) /* cdf() might return 1. */ + j = n_intervals-1; + if (j < 0 ) { /* there is something wrong with the boundaries */ + _unur_warning(test_name,UNUR_ERR_GENERIC,"F(x) < 0 (out of domain)."); + j = 0; + } + ++observed[j]; + } + + if (verbose >= 1) { + fprintf(out,"\nChi^2-Test for continuous empirical distribution:"); + fprintf(out,"\n(Assumes standard normal distribution!)"); + fprintf(out,"\n intervals = %d\n",n_intervals); + } + + /* and now make chi^2 test */ + pval = _unur_test_chi2test(NULL, observed, n_intervals, classmin, verbose, out ); + + /* free memory */ + _unur_distr_free(distr_normal); + free(observed); + + /* return result of test */ + return pval; + +} /* end of _unur_test_chi2_cemp() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_test_chi2_vec ( struct unur_gen *gen, + int n_intervals, + int samplesize, + int classmin, + int verbose, + FILE *out ) + /*----------------------------------------------------------------------*/ + /* Chi^2 test for multivariate (NORMAL) continuous distributions. */ + /* It runs a chi^2 test on all marginal distributions and on the */ + /* multivariate distributions. */ + /* For the marginal distributions the number of intervals is set to */ + /* n_intervals; for the global test we use n_intervals for the first */ + /* dimension, n_intervals/2 for the second, n_intervals/3 for the third */ + /* dimension as long as the total number of cells does not exceed */ + /* CHI2_MAX_TOTALINTERVALS. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* n_intervals... number of intervals in which (0,1) is partitioned */ + /* (each dimension is partitioned in n_intervals) */ + /* samplesize ... samplesize for test */ + /* (if <= 0, CHI2_SAMPLEFAC * intervals^dim is used) */ + /* classmin ... minimum number of expected occurrences for each class */ + /* (if <= 0, a default value is used.) */ + /* verbose ... verbosity level */ + /* 0 = no output */ + /* 1 = print summary */ + /* 2 = print classes and summary */ + /* out ... output stream */ + /* */ + /* return: */ + /* minimal p-value * number_of_tests of all test statistics under H_0 */ + /* */ + /* error: */ + /* -2. ... missing data */ + /* -1. ... other errors */ + /*----------------------------------------------------------------------*/ +{ +#define DISTR gen->distr->data.cvec +#define idx(i,j) ((i)*dim+(j)) + + int dim; /* dimension of multivariate distribution */ + double *Fl = NULL; /* value of CDF at left and right boundary point */ + double *Fr = NULL; + double *Fdelta = NULL; + + UNUR_DISTR **marginals = NULL; /* pointer to marginal distributions */ + UNUR_FUNCT_CONT **marginal_cdf = NULL; /* pointer to CDFs of marginal distributions */ + + const double *mean = NULL; /* pointer to mean vector */ + const double *L = NULL; /* pointer to Cholesky factor */ + double *Linv = NULL; /* pointer to inverse Cholesky factor */ + double Linv_det; /* determinant of Linv */ + + double *X = NULL; /* sampling vector */ + double *U = NULL; /* X transformed to uniform */ + + int *bm = NULL; /* array for counting bins for marginals */ + double pval, pval_min; /* p-value */ + + int i, j, k; /* auxiliary variables */ + + /* check arguments */ + CHECK_NULL(gen,-1.); + /* we do not check magic cookies here */ + + /* we need all marginal distributions */ + if (DISTR.marginals==NULL) { + _unur_error(gen->distr->name,UNUR_ERR_DISTR_REQUIRED,"marginals"); + return -2.; + } + + /* when the domain has been changed by a unur_distr_cvec_set_domain_...() */ + /* call and the covariance matrix is not the identity matrix then */ + /* the test may fail anyway. */ + if ((gen->distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) && + !(gen->distr->set & UNUR_DISTR_SET_COVAR_IDENT) ) + _unur_warning(test_name,UNUR_ERR_GENERIC,"correlated and domain truncated --> test might fail"); + + /* check given number of intervals */ + if (n_intervals <= 2) + n_intervals = CHI2_INTERVALS_DEFAULT; + + /* samplesize */ + if( samplesize <= 0 ) samplesize = CHI2_DEFAULT_SAMPLESIZE; + samplesize = _unur_min( samplesize, CHI2_MAX_SAMPLESIZE ); + + /* dimension of distribution */ + dim = gen->distr->dim; + if (dim < 1) { + _unur_error(test_name,UNUR_ERR_GENERIC,"distribution dimension < 1 ?"); + return -1.; + } + + /* we need mean vector and covariance matrix */ + mean = unur_distr_cvec_get_mean(gen->distr); + L = unur_distr_cvec_get_cholesky(gen->distr); + /* remark: mean or L might be NULL */ + + /* get marginal distributions and their CDFs */ + marginals = _unur_xmalloc(dim * sizeof(UNUR_DISTR *)); + marginal_cdf = _unur_xmalloc(dim * sizeof(UNUR_FUNCT_CONT *)); + for (i=0; idistr->name,UNUR_ERR_DISTR_REQUIRED,"CDF of continuous standardized marginal"); + pval_min = -2.; goto free_memory; + } + } + + /* compute Fl and Fr */ + Fl = _unur_xmalloc(dim * sizeof(double)); + Fr = _unur_xmalloc(dim * sizeof(double)); + Fdelta = _unur_xmalloc(dim * sizeof(double)); + if (gen->distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) { + for (i=0; igenid,UNUR_ERR_GENERIC,"Fdelta <= 0."); + pval_min = -1.; goto free_memory; + } + } + } + else { + for (i=0; i=n_intervals) iv = n_intervals-1; + if (iv < 0) iv = 0; + bm[j*n_intervals + iv] += 1; + } + } + + /* ----------------------------------------------------------------------------*/ + + /* make chi^2 test (marginal) */ + pval_min = 1.; + for (j=0; j= 1) { + fprintf(out,"\nChi^2-Test for marginal distribution [%d]\n",j); + } + + pval = _unur_test_chi2test(NULL, bm+(j*n_intervals), n_intervals, classmin, verbose, out ); + pval_min = _unur_min(pval_min,pval); + } + + if (verbose >= 1) { + fprintf(out,"\nSummary:\n"); + fprintf(out," Minimal p-value * number_of_tests = %g:\n\n",pval_min * dim); + } + + /* ----------------------------------------------------------------------------*/ + +free_memory: + /* free memory */ + if (X) free(X); + if (U) free(U); + if (bm) free(bm); + if (Linv) free(Linv); + if (marginals) free (marginals); + if (marginal_cdf) free (marginal_cdf); + if (Fl) free(Fl); + if (Fr) free(Fr); + if (Fdelta) free(Fdelta); + + /* return result of test */ + return pval_min * dim; + +#undef idx +#undef DISTR +} /* end of _unur_test_chi2_vec() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_test_chi2_cvemp ( struct unur_gen *gen, + int n_intervals, + int samplesize, + int classmin, + int verbose, + FILE *out ) + /*----------------------------------------------------------------------*/ + /* Chi^2 test for continuous multivariate empirical distributions */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* n_intervals... number of intervals in which (0,1) is partitioned */ + /* (each dimension is partitioned in n_intervals) */ + /* samplesize ... samplesize for test */ + /* (if <= 0, CHI2_SAMPLEFAC * intervals^dim is used) */ + /* classmin ... minimum number of expected occurrences for each class */ + /* (if <= 0, a default value is used.) */ + /* verbose ... verbosity level */ + /* 0 = no output */ + /* 1 = print summary */ + /* 2 = print classes and summary */ + /* out ... output stream */ + /* */ + /* return: */ + /* minimal p-value * number_of_tests of all test statistics under H_0 */ + /* */ + /* error: */ + /* -2. ... missing data */ + /* -1. ... other errors */ + /*----------------------------------------------------------------------*/ +{ +#define DISTR gen->distr->data.cvec +#define idx(i,j) ((i)*dim+(j)) + + int dim; /* dimension of multivariate distribution */ + UNUR_DISTR *distr_normal; /* object for standard normal distribution */ + UNUR_FUNCT_CONT *cdf; /* pointer to CDF */ + double *X = NULL; /* sampling vector */ + double *U = NULL; /* X transformed to uniform */ + + int *bm = NULL; /* array for counting bins for marginals */ + double pval, pval_min; /* p-value */ + + int i, j; /* auxiliary variables */ + + /* check arguments */ + CHECK_NULL(gen,-1.); + /* we do not check magic cookies here */ + + /* check given number of intervals */ + if (n_intervals <= 2) + n_intervals = CHI2_INTERVALS_DEFAULT; + + /* samplesize */ + if( samplesize <= 0 ) samplesize = CHI2_DEFAULT_SAMPLESIZE; + samplesize = _unur_min( samplesize, CHI2_MAX_SAMPLESIZE ); + + /* dimension of distribution */ + dim = gen->distr->dim; + if (dim < 1) { + _unur_error(test_name,UNUR_ERR_GENERIC,"distribution dimension < 1 ?"); + return -1.; + } + + /* we need the CDF for the standard normal distribution */ + distr_normal = unur_distr_normal( NULL, 0 ); + cdf = distr_normal->data.cont.cdf; + + /* allocate working space memory */ + X = _unur_xmalloc( dim * sizeof(double)); + U = _unur_xmalloc( dim * sizeof(double)); + bm = _unur_xmalloc( dim * n_intervals * sizeof(int)); /* bins for marginal tests */ + memset(bm , 0, dim * n_intervals * sizeof(int)); + + /* now run generator */ + for( i=0; i=n_intervals) iv = n_intervals-1; + if (iv < 0) iv = 0; + bm[j*n_intervals + iv] += 1; + } + } + + /* make chi^2 test (marginal) */ + pval_min = 1.; + for (j=0; j= 1) { + fprintf(out,"\nChi^2-Test for marginal distribution [%d]\n",j); + } + + pval = _unur_test_chi2test(NULL, bm+(j*n_intervals), n_intervals, classmin, verbose, out ); + pval_min = _unur_min(pval_min,pval); + } + + if (verbose >= 1) { + fprintf(out,"\nSummary:\n"); + fprintf(out," Minimal p-value * number_of_tests = %g:\n\n",pval_min * dim); + } + + /* free memory */ + _unur_distr_free(distr_normal); + free(X); + free(U); + free(bm); + + /* return result of test */ + return pval_min * dim; + +#undef idx +#undef DISTR +} /* end of _unur_test_chi2_cvemp() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_test_chi2test( double *prob, + int *observed, + int len, + int classmin, + int verbose, + FILE *out ) + /*----------------------------------------------------------------------*/ + /* Chi^2 test for discrete distributions. */ + /* */ + /* parameters: */ + /* prob ... probability vector (need not sum to 1) */ + /* NULL indicates a uniform distribution on (0,len-1) */ + /* observed ... vector containing the observed number of occurrences */ + /* len ... length of (both) vectors */ + /* classmin ... minimum number of expected occurrences for each class */ + /* (if <= 0, a default value is used.) */ + /* verbose ... verbosity level */ + /* 0 = no output */ + /* 1 = print summary */ + /* 2 = print classes and summary */ + /* out ... output stream */ + /* */ + /* return: */ + /* p-value of test statistics under H_0 */ + /* */ + /* error: */ + /* -2. ... missing data */ + /* -1. ... other errors */ + /* */ + /* comment: */ + /* joines classes if expected number of occurrences in some classes */ + /* is too small, i.e., less than "classmin". */ + /*----------------------------------------------------------------------*/ +{ + double chi2 = 0.; /* chi2-value */ + double df; /* degrees of freedom for chi^2 distribution */ + double pval; /* p-value */ + double clexpd = 0.; /* expected occurrences in class */ + int clobsd = 0; /* observed occurrences in class */ + int classes = 0; /* (total) number of classes */ + double probsum = 0.; /* sum of all "probabilities" (need not be 1, for convenience) */ + int samplesize = 0; + double factor; /* factor for calculating expected number of occurrences */ + int i; + + UNUR_DISTR *distr_chisquare = NULL; /* distribution object to chi^2 distribution */ + + /* check arguments */ + CHECK_NULL(observed,-1.); + + /* minimum number of occurrences in a class */ + classmin = (classmin > 0) ? classmin : CHI2_CLASSMIN_DEFAULT; + + /* compute sample size */ + for( samplesize=0, i=0; i prob[i] = 1/len */ + factor = ((double)samplesize)/len; + + /* compute chi^2 value */ + clexpd = 0.; + clobsd = 0; + classes = 0; + for( chi2=0., i=0; i= classmin || i == len-1) { + /* number of expected occurrences is large enough or end of array */ + if (clobsd <= 0 && clexpd <= 0.) break; + chi2 += (clobsd-clexpd)*(clobsd-clexpd)/clexpd; + if (verbose >= 2) + fprintf(out,"Class #%d:\tobserved %d\texpected %.2f\n",classes,clobsd,clexpd); + clexpd = 0.; + clobsd = 0; + classes++; + } + } + + /* there must be at least two classes */ + if (classes < 2) { + _unur_error(test_name,UNUR_ERR_GENERIC,"too few classes!"); + if (verbose >= 1) + fprintf(out,"\nCannot run chi^2-Test: too few classes\n"); + return -1.; + } + + /* evaluate test statistics */ + /* chisquare distribution with df degrees of freedom */ + df = (double)(classes-1); + distr_chisquare = unur_distr_chisquare( &df, 1 ); + /* p-value */ + if (distr_chisquare->data.cont.cdf) { + pval = 1. - _unur_cont_CDF( chi2, distr_chisquare ); + } + else { + _unur_error(test_name,UNUR_ERR_GENERIC,"CDF for CHI^2 distribution required"); + pval = -2.; + } + _unur_distr_free(distr_chisquare); + + /* print result (if requested) */ + if (verbose >= 1 && pval >= 0.) { + fprintf(out,"\nResult of chi^2-Test:\n samplesize = %d\n",samplesize); + fprintf(out," classes = %d\t (minimum per class = %d)\n", classes, classmin); + fprintf(out," chi2-value = %g\n p-value = %g\n\n", chi2, pval); + } + + /* return result of test */ + return pval; + +} /* end of _unur_test_chi2test() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/tests/correlation.c b/vendor/unuran-1.11.0/src/tests/correlation.c new file mode 100644 index 0000000..cb607e3 --- /dev/null +++ b/vendor/unuran-1.11.0/src/tests/correlation.c @@ -0,0 +1,288 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * file: correlation.c * + * * + * compute correlation coefficient of two samples * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Spicer C.C. (1972): Algorithm AS 52: Calculation of Power Sums of * + * Deviations about the mean, Applied Statistics 21(2), pp. 226-227. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "unuran_tests.h" + +/*---------------------------------------------------------------------------*/ +static char test_name[] = "Correlation"; +/*---------------------------------------------------------------------------*/ + +#define CORR_DEFAULT_SAMPLESIZE 10000 +/* default sample size used when the given size is <= 0 */ + +#define CORR_MAX_SAMPLESIZE 10000000 +/* maximal sample size to prevent extremely long run times */ + +/*---------------------------------------------------------------------------*/ + +double +unur_test_correlation( UNUR_GEN *genx, UNUR_GEN *geny, int samplesize, int verbosity, FILE *out ) + /*----------------------------------------------------------------------*/ + /* compute correlation coefficient of two samples. */ + /* */ + /* parameters: */ + /* genx ... pointer to generator object */ + /* geny ... pointer to another generator object */ + /* samplesize ... sample size */ + /* verbosity ... verbosity level, 0 = no output, 1 = output */ + /* out ... output stream */ + /* */ + /* return: */ + /* correlation coefficient */ + /* */ + /* error: */ + /* -2. ... missing data */ + /* -3. ... other errors */ + /*----------------------------------------------------------------------*/ +{ + double x =0., y =0.; /* contains random numbers */ + double mx =0., my=0.; /* mean values (analog to s1 in [1] */ + double dx =0., dy=0.; /* analog to delta in [1] */ + double sx =0., sy=0.; /* analog to s2 in [1] */ + double sxy=0.; /* analog to s2 in [1] */ + double factor; + int n; + + /* check parameter */ + _unur_check_NULL(test_name,genx,-3.); + _unur_check_NULL(test_name,geny,-3.); + + /* type of distribution */ + if (! ( ((genx->method & UNUR_MASK_TYPE) == UNUR_METH_DISCR) || + ((genx->method & UNUR_MASK_TYPE) == UNUR_METH_CONT) )) { + _unur_error(test_name,UNUR_ERR_GENERIC, + "dont know how to compute correlation coefficient for distribution"); + return -2.; + } + if (! ( ((geny->method & UNUR_MASK_TYPE) == UNUR_METH_DISCR) || + ((geny->method & UNUR_MASK_TYPE) == UNUR_METH_CONT) )) { + _unur_error(test_name,UNUR_ERR_GENERIC, + "dont know how to compute correlation coefficient for distribution"); + return -2.; + } + + /* samplesize */ + if( samplesize <= 0 ) samplesize = CORR_DEFAULT_SAMPLESIZE; + samplesize = _unur_min( samplesize, CORR_MAX_SAMPLESIZE ); + + /* sampling */ + for (n=1; n<=samplesize; n++) { + + /* which type of distribution */ + switch (genx->method & UNUR_MASK_TYPE) { + case UNUR_METH_DISCR: + x = _unur_sample_discr(genx); break; + case UNUR_METH_CONT: + x = _unur_sample_cont(genx); break; + } + switch (geny->method & UNUR_MASK_TYPE) { + case UNUR_METH_DISCR: + y = _unur_sample_discr(geny); break; + case UNUR_METH_CONT: + y = _unur_sample_cont(geny); break; + } + + factor = (double) ( n*(n-1) ); + + dx = (x - mx) / n; + dy = (y - my) / n; + mx += dx; + my += dy; + + sx += factor * dx*dx; + sy += factor * dy*dy; + sxy += factor * dx*dy; + /* fprintf(out,"sx:%f sy:%f sxy:%f, c:%f\n",sx,sy,sxy, sxy/(sqrt(sx*sy)) ); */ + + } + + /* now print results */ + if (verbosity) { + fprintf(out,"\nCorrelation coefficient: %g\n\n", sxy/(sqrt(sx*sy)) ); + } + + return ( sxy/(sqrt(sx*sy)) ); + +} /* end of unur_test_correlation() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_test_cvec_rankcorr( double *rc, struct unur_gen *gen, int samplesize, int verbose, FILE *out ) + /*----------------------------------------------------------------------*/ + /* compute rank correlations between components of random vector. */ + /* */ + /* parameters: */ + /* rc ... pointer to dimxdim array to result */ + /* gen ... pointer to multivariate generator object */ + /* samplesize ... sample size */ + /* verbose ... verbosity level, 0 = no output, 1 = output */ + /* out ... output stream */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ +#define DISTR gen->distr->data.cvec +#define idx(a,b) ((a)*dim+(b)) + + double *mx; /* mean values (analog to s1 in [1] */ + double *dx; /* analog to delta in [1] */ + double factor; + + int dim; /* dimension of multivariate distribution */ + + UNUR_DISTR **marginals; /* pointer to marginal distributions */ + UNUR_FUNCT_CONT **marginal_cdf; /* pointer to CDFs of marginal distributions */ + + double *X; /* sampling vector */ + double *U; /* X transformed to uniform */ + + int i, j, n; /* auxiliary variables */ + + /* check arguments */ + CHECK_NULL(gen,UNUR_ERR_NULL); + /* we do not check magic cookies here */ + + if (verbose >= 1) + fprintf(out,"\nRank correlations of random vector:\n"); + + /* samplesize */ + if( samplesize <= 0 ) samplesize = CORR_DEFAULT_SAMPLESIZE; + samplesize = _unur_min( samplesize, CORR_MAX_SAMPLESIZE ); + + /* dimension of distribution */ + dim = gen->distr->dim; + if (dim < 1) { + _unur_error(test_name,UNUR_ERR_GENERIC,"distribution dimension < 1 ?"); + return UNUR_ERR_GENERIC; + } + + /* type of distribution */ + if ( (gen->method & UNUR_MASK_TYPE) != UNUR_METH_VEC ) { + _unur_error(test_name,UNUR_ERR_GENERIC, + "rank correlation coefficients cannot be computed"); + return UNUR_ERR_GENERIC; + } + + /* we need all marginal distributions */ + if (DISTR.marginals==NULL) { + _unur_error(gen->distr->name,UNUR_ERR_DISTR_REQUIRED,"marginal distributions"); + return UNUR_ERR_DISTR_REQUIRED; } + marginals = _unur_xmalloc(dim * sizeof(UNUR_DISTR *)); + marginal_cdf = _unur_xmalloc(dim * sizeof(UNUR_FUNCT_CONT *)); + for (i=0; idistr->name,UNUR_ERR_DISTR_REQUIRED,"CDF of continuous marginal"); + free (marginals); free (marginal_cdf); + return UNUR_ERR_DISTR_REQUIRED; } + } + + /* allocate working space memory */ + X = _unur_xmalloc( dim * sizeof(double)); + U = _unur_xmalloc( dim * sizeof(double)); + mx = _unur_xmalloc( dim * sizeof(double)); + dx = _unur_xmalloc( dim * sizeof(double)); + + /* clear working arrays */ + for (i=0; i= 1) + _unur_matrix_print_matrix( dim, rc, "rank correlation =", + out, "", "\t"); + + /* free memory */ + if (X) free(X); + if (U) free(U); + if (mx) free(mx); + if (dx) free(dx); + if (marginals) free (marginals); + if (marginal_cdf) free (marginal_cdf); + + /* return result of test */ + return UNUR_SUCCESS; + +#undef DISTR +#undef idx +} /* end of unur_test_cvec_rankcorr() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/tests/countpdf.c b/vendor/unuran-1.11.0/src/tests/countpdf.c new file mode 100644 index 0000000..0e86de1 --- /dev/null +++ b/vendor/unuran-1.11.0/src/tests/countpdf.c @@ -0,0 +1,525 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * file: countpdf.c * + * * + * Count evaluations of PDF and similar functions * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include "unuran_tests.h" + +/*---------------------------------------------------------------------------*/ +static char test_name[] = "CountPDF"; + +/*---------------------------------------------------------------------------*/ +/* common variables */ +/*---------------------------------------------------------------------------*/ + +/* counter for evaluations of PDF and similar functions */ +static int counter_pdf = 0; +static int counter_dpdf = 0; +static int counter_pdpdf = 0; +static int counter_logpdf = 0; +static int counter_dlogpdf = 0; +static int counter_pdlogpdf = 0; +static int counter_cdf = 0; +static int counter_hr = 0; +static int counter_pmf = 0; + +/* pointer to original functions */ +static double (*cont_pdf_to_use)(double x, const struct unur_distr *distr); +static double (*cont_dpdf_to_use)(double x, const struct unur_distr *distr); +static double (*cont_logpdf_to_use)(double x, const struct unur_distr *distr); +static double (*cont_dlogpdf_to_use)(double x, const struct unur_distr *distr); +static double (*cont_cdf_to_use)(double x, const struct unur_distr *distr); +static double (*cont_hr_to_use)(double x, const struct unur_distr *distr); + +static double (*discr_pmf_to_use)(int x, const struct unur_distr *distr); +static double (*discr_cdf_to_use)(int x, const struct unur_distr *distr); + +static double (*cvec_pdf_to_use)(const double *x, struct unur_distr *distr); +static int (*cvec_dpdf_to_use)(double *result, const double *x, struct unur_distr *distr); +static double (*cvec_pdpdf_to_use)(const double *x, int coord, struct unur_distr *distr); +static double (*cvec_logpdf_to_use)(const double *x, struct unur_distr *distr); +static int (*cvec_dlogpdf_to_use)(double *result, const double *x, struct unur_distr *distr); +static double (*cvec_pdlogpdf_to_use)(const double *x, int coord, struct unur_distr *distr); + +/*---------------------------------------------------------------------------*/ +/* wrapper for functions */ +/*---------------------------------------------------------------------------*/ + +static double cont_pdf_with_counter( double x, const struct unur_distr *distr ) { + ++counter_pdf; return cont_pdf_to_use(x,distr); } + +static double cont_dpdf_with_counter( double x, const struct unur_distr *distr ) { + ++counter_dpdf; return cont_dpdf_to_use(x,distr); } + +static double cont_logpdf_with_counter( double x, const struct unur_distr *distr ) { + ++counter_logpdf; return cont_logpdf_to_use(x,distr); } + +static double cont_dlogpdf_with_counter( double x, const struct unur_distr *distr ) { + ++counter_dlogpdf; return cont_dlogpdf_to_use(x,distr); } + +static double cont_cdf_with_counter( double x, const struct unur_distr *distr ) { + ++counter_cdf; return cont_cdf_to_use(x,distr); } + +static double cont_hr_with_counter( double x, const struct unur_distr *distr ) { + ++counter_hr; return cont_hr_to_use(x,distr); } + +/*---------------------------------------------------------------------------*/ + +static double discr_pmf_with_counter( int x, const struct unur_distr *distr ) { + ++counter_pmf; return discr_pmf_to_use(x,distr); } + +static double discr_cdf_with_counter( int x, const struct unur_distr *distr ) { + ++counter_cdf; return discr_cdf_to_use(x,distr); } + +/*---------------------------------------------------------------------------*/ + +static double cvec_pdf_with_counter( const double *x, struct unur_distr *distr ) { + ++counter_pdf; return cvec_pdf_to_use(x,distr); } + +static int cvec_dpdf_with_counter( double *result, const double *x, struct unur_distr *distr ) { + ++counter_dpdf; return cvec_dpdf_to_use(result,x,distr); } + +static double cvec_pdpdf_with_counter( const double *x, int coord, struct unur_distr *distr ) { + ++counter_pdpdf; return cvec_pdpdf_to_use(x,coord,distr); } + +static double cvec_logpdf_with_counter( const double *x, struct unur_distr *distr ) { + ++counter_logpdf; return cvec_logpdf_to_use(x,distr); } + +static int cvec_dlogpdf_with_counter( double *result, const double *x, struct unur_distr *distr ) { + ++counter_dlogpdf; return cvec_dlogpdf_to_use(result,x,distr); } + +static double cvec_pdlogpdf_with_counter( const double *x, int coord, struct unur_distr *distr ) { + ++counter_pdlogpdf; return cvec_pdlogpdf_to_use(x,coord,distr); } + +/*****************************************************************************/ + +int +unur_test_count_pdf( struct unur_gen *gen, int samplesize, int verbosity, FILE *out ) + /*----------------------------------------------------------------------*/ + /* count evaluations of PDF and similar functions */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* samplesize ... sample size */ + /* verbosity ... verbosity level, 0 = no output, 1 = output */ + /* out ... output stream */ + /* */ + /* return: */ + /* total number of evaluations of PDF and similar functions */ + /* */ + /* error: */ + /* return -1 */ + /*----------------------------------------------------------------------*/ +{ + int j; + int count; + struct unur_gen *genclone; + struct unur_distr *distr; + + /* check arguments */ + _unur_check_NULL(test_name,gen,-1); + + /* make a copy (clone) of the generator object */ + genclone = _unur_gen_clone(gen); + + /* get pointer to distribution object */ + if (genclone->distr_is_privatecopy) + distr = genclone->distr; + else { + /* we need a private copy of the distribution object in genclone */ + distr = genclone->distr = _unur_distr_clone( gen->distr ); + genclone->distr_is_privatecopy = TRUE; + } + + /* exchange pointer to PDF etc. with counting wrapper */ + switch (distr->type) { + case UNUR_DISTR_CONT: + cont_pdf_to_use = distr->data.cont.pdf; + distr->data.cont.pdf = cont_pdf_with_counter; + cont_dpdf_to_use = distr->data.cont.dpdf; + distr->data.cont.dpdf = cont_dpdf_with_counter; + cont_cdf_to_use = distr->data.cont.cdf; + distr->data.cont.cdf = cont_cdf_with_counter; + cont_hr_to_use = distr->data.cont.hr; + distr->data.cont.hr = cont_hr_with_counter; + if (distr->data.cont.logpdf) { + cont_logpdf_to_use = distr->data.cont.logpdf; + distr->data.cont.logpdf = cont_logpdf_with_counter; + } + if (distr->data.cont.dlogpdf) { + cont_dlogpdf_to_use = distr->data.cont.dlogpdf; + distr->data.cont.dlogpdf = cont_dlogpdf_with_counter; + } + break; + case UNUR_DISTR_DISCR: + discr_pmf_to_use = distr->data.discr.pmf; + distr->data.discr.pmf = discr_pmf_with_counter; + discr_cdf_to_use = distr->data.discr.cdf; + distr->data.discr.cdf = discr_cdf_with_counter; + break; + case UNUR_DISTR_CVEC: + cvec_pdf_to_use = distr->data.cvec.pdf; + distr->data.cvec.pdf = cvec_pdf_with_counter; + cvec_dpdf_to_use = distr->data.cvec.dpdf; + distr->data.cvec.dpdf = cvec_dpdf_with_counter; + cvec_pdpdf_to_use = distr->data.cvec.pdpdf; + distr->data.cvec.pdpdf = cvec_pdpdf_with_counter; + if (distr->data.cvec.logpdf) { + cvec_logpdf_to_use = distr->data.cvec.logpdf; + distr->data.cvec.logpdf = cvec_logpdf_with_counter; + } + if (distr->data.cvec.dlogpdf) { + cvec_dlogpdf_to_use = distr->data.cvec.dlogpdf; + distr->data.cvec.dlogpdf = cvec_dlogpdf_with_counter; + } + if (distr->data.cvec.pdlogpdf) { + cvec_pdlogpdf_to_use = distr->data.cvec.pdlogpdf; + distr->data.cvec.pdlogpdf = cvec_pdlogpdf_with_counter; + } + break; + default: + if (verbosity) + fprintf(out,"\nCOUNT-PDF: cannot count PDF for distribution type)\n"); + _unur_free(genclone); + return -1; + } + + /* reset counter */ + counter_pdf = 0; + counter_dpdf = 0; + counter_pdpdf = 0; + counter_logpdf = 0; + counter_dlogpdf = 0; + counter_pdlogpdf = 0; + counter_cdf = 0; + counter_hr = 0; + counter_pmf = 0; + + /* run generator */ + switch (genclone->method & UNUR_MASK_TYPE) { + case UNUR_METH_DISCR: + for( j=0; jtype) { + case UNUR_DISTR_CONT: + fprintf(out,"\tPDF: %7d (%g)\n",counter_pdf,((double)counter_pdf)/((double) samplesize)); + fprintf(out,"\tdPDF: %7d (%g)\n",counter_dpdf,((double)counter_dpdf)/((double) samplesize)); + fprintf(out,"\tlogPDF: %7d (%g)\n",counter_logpdf,((double)counter_logpdf)/((double) samplesize)); + fprintf(out,"\tdlogPDF: %7d (%g)\n",counter_dlogpdf,((double)counter_dlogpdf)/((double) samplesize)); + fprintf(out,"\tCDF: %7d (%g)\n",counter_cdf,((double)counter_cdf)/((double) samplesize)); + fprintf(out,"\tHR: %7d (%g)\n",counter_hr,((double)counter_hr)/((double) samplesize)); + break; + case UNUR_DISTR_CVEC: + fprintf(out,"\tPDF: %7d (%g)\n",counter_pdf,((double)counter_pdf)/((double) samplesize)); + fprintf(out,"\tdPDF: %7d (%g)\n",counter_dpdf,((double)counter_dpdf)/((double) samplesize)); + fprintf(out,"\tpdPDF: %7d (%g)\n",counter_pdpdf,((double)counter_pdpdf)/((double) samplesize)); + fprintf(out,"\tlogPDF: %7d (%g)\n",counter_logpdf,((double)counter_logpdf)/((double) samplesize)); + fprintf(out,"\tdlogPDF: %7d (%g)\n",counter_dlogpdf,((double)counter_dlogpdf)/((double) samplesize)); + fprintf(out,"\tpdlogPDF:%7d (%g)\n",counter_dlogpdf,((double)counter_dlogpdf)/((double) samplesize)); + break; + case UNUR_DISTR_DISCR: + fprintf(out,"\tPMF: %7d (%g)\n",counter_pmf,((double)counter_pmf)/((double) samplesize)); + fprintf(out,"\tCDF: %7d (%g)\n",counter_cdf,((double)counter_cdf)/((double) samplesize)); + break; + } + } + + /* remove clone */ + _unur_free(genclone); + + /* return total number of evaluations */ + return count; + +} /* end of unur_test_count_pdf() */ + +/*****************************************************************************/ + +int +unur_test_par_count_pdf( struct unur_par *par, int samplesize, int verbosity, FILE *out ) + /*----------------------------------------------------------------------*/ + /* count evaluations of PDF and similar functions */ + /* */ + /* parameters: */ + /* par ... pointer to parameter object */ + /* samplesize ... sample size */ + /* verbosity ... verbosity level, 0 = no output, 1 = output */ + /* out ... output stream */ + /* */ + /* return: */ + /* total number of evaluations of PDF and similar functions */ + /* */ + /* error: */ + /* return -1 */ + /*----------------------------------------------------------------------*/ +{ + int j; + int count, count_total; + struct unur_par *parclone; + struct unur_gen *gen; + struct unur_distr *distr; + + /* check arguments */ + _unur_check_NULL(test_name,par,-1); + + /* make a copy (clone) of the parameter object */ + parclone = _unur_par_clone(par); + parclone->distr_is_privatecopy = TRUE; + + /* make a copy (clone) of the distribution object */ + distr = _unur_distr_clone(par->distr); + + /* set pointer to distribution object in parameter object to cloned one */ + parclone->distr = distr; + + /* exchange pointer to PDF etc. with counting wrapper */ + switch (distr->type) { + case UNUR_DISTR_CONT: + cont_pdf_to_use = distr->data.cont.pdf; + distr->data.cont.pdf = cont_pdf_with_counter; + cont_dpdf_to_use = distr->data.cont.dpdf; + distr->data.cont.dpdf = cont_dpdf_with_counter; + cont_cdf_to_use = distr->data.cont.cdf; + distr->data.cont.cdf = cont_cdf_with_counter; + cont_hr_to_use = distr->data.cont.hr; + distr->data.cont.hr = cont_hr_with_counter; + if (distr->data.cont.logpdf) { + cont_logpdf_to_use = distr->data.cont.logpdf; + distr->data.cont.logpdf = cont_logpdf_with_counter; + } + if (distr->data.cont.dlogpdf) { + cont_dlogpdf_to_use = distr->data.cont.dlogpdf; + distr->data.cont.dlogpdf = cont_dlogpdf_with_counter; + } + break; + case UNUR_DISTR_DISCR: + discr_pmf_to_use = distr->data.discr.pmf; + distr->data.discr.pmf = discr_pmf_with_counter; + discr_cdf_to_use = distr->data.discr.cdf; + distr->data.discr.cdf = discr_cdf_with_counter; + break; + case UNUR_DISTR_CVEC: + cvec_pdf_to_use = distr->data.cvec.pdf; + distr->data.cvec.pdf = cvec_pdf_with_counter; + cvec_dpdf_to_use = distr->data.cvec.dpdf; + distr->data.cvec.dpdf = cvec_dpdf_with_counter; + cvec_pdpdf_to_use = distr->data.cvec.pdpdf; + distr->data.cvec.pdpdf = cvec_pdpdf_with_counter; + if (distr->data.cvec.logpdf) { + cvec_logpdf_to_use = distr->data.cvec.logpdf; + distr->data.cvec.logpdf = cvec_logpdf_with_counter; + } + if (distr->data.cvec.dlogpdf) { + cvec_dlogpdf_to_use = distr->data.cvec.dlogpdf; + distr->data.cvec.dlogpdf = cvec_dlogpdf_with_counter; + } + if (distr->data.cvec.pdlogpdf) { + cvec_pdlogpdf_to_use = distr->data.cvec.pdlogpdf; + distr->data.cvec.pdlogpdf = cvec_pdlogpdf_with_counter; + } + break; + default: + if (verbosity) + fprintf(out,"\nCOUNT-PDF: cannot count PDF for distribution type)\n"); + _unur_par_free(parclone); + _unur_distr_free(distr); + return -1; + } + + /* reset counter */ + counter_pdf = 0; + counter_dpdf = 0; + counter_pdpdf = 0; + counter_logpdf = 0; + counter_dlogpdf = 0; + counter_pdlogpdf = 0; + counter_cdf = 0; + counter_hr = 0; + counter_pmf = 0; + + /* init generator */ + gen = _unur_init(parclone); + + /* total number of function calls */ + count = ( counter_pdf + counter_dpdf + counter_pdpdf + + counter_logpdf + counter_dlogpdf + counter_pdlogpdf + + counter_cdf + counter_hr + counter_pmf); + count_total = count; + + /* print result */ + if (verbosity) { + fprintf(out, "\nCOUNT: Initializing Generator:\n"); + fprintf(out, "\tfunction calls\n"); + fprintf(out, "\ttotal: %7d\n",count); + switch (distr->type) { + case UNUR_DISTR_CONT: + fprintf(out,"\tPDF: %7d\n",counter_pdf); + fprintf(out,"\tdPDF: %7d\n",counter_dpdf); + fprintf(out,"\tlogPDF: %7d\n",counter_logpdf); + fprintf(out,"\tdlogPDF: %7d\n",counter_dlogpdf); + fprintf(out,"\tCDF: %7d\n",counter_cdf); + fprintf(out,"\tHR: %7d\n",counter_hr); + break; + case UNUR_DISTR_CVEC: + fprintf(out,"\tPDF: %7d\n",counter_pdf); + fprintf(out,"\tdPDF: %7d\n",counter_dpdf); + fprintf(out,"\tpdPDF: %7d\n",counter_pdpdf); + fprintf(out,"\tlogPDF: %7d\n",counter_logpdf); + fprintf(out,"\tdlogPDF: %7d\n",counter_dlogpdf); + fprintf(out,"\tpdlogPDF:%7d\n",counter_pdlogpdf); + break; + case UNUR_DISTR_DISCR: + fprintf(out,"\tPMF: %7d\n",counter_pmf); + fprintf(out,"\tCDF: %7d\n",counter_cdf); + break; + } + } + + /* reset counter */ + counter_pdf = 0; + counter_dpdf = 0; + counter_pdpdf = 0; + counter_logpdf = 0; + counter_dlogpdf = 0; + counter_pdlogpdf = 0; + counter_cdf = 0; + counter_hr = 0; + counter_pmf = 0; + + /* run generator */ + switch (gen->method & UNUR_MASK_TYPE) { + case UNUR_METH_DISCR: + for( j=0; jtype) { + case UNUR_DISTR_CONT: + fprintf(out,"\tPDF: %7d (%g)\n",counter_pdf,((double)counter_pdf)/((double) samplesize)); + fprintf(out,"\tdPDF: %7d (%g)\n",counter_dpdf,((double)counter_dpdf)/((double) samplesize)); + fprintf(out,"\tlogPDF: %7d (%g)\n",counter_logpdf,((double)counter_logpdf)/((double) samplesize)); + fprintf(out,"\tdlogPDF: %7d (%g)\n",counter_dlogpdf,((double)counter_dlogpdf)/((double) samplesize)); + fprintf(out,"\tCDF: %7d (%g)\n",counter_cdf,((double)counter_cdf)/((double) samplesize)); + fprintf(out,"\tHR: %7d (%g)\n",counter_hr,((double)counter_hr)/((double) samplesize)); + break; + case UNUR_DISTR_CVEC: + fprintf(out,"\tPDF: %7d (%g)\n",counter_pdf,((double)counter_pdf)/((double) samplesize)); + fprintf(out,"\tdPDF: %7d (%g)\n",counter_dpdf,((double)counter_dpdf)/((double) samplesize)); + fprintf(out,"\tpdPDF: %7d (%g)\n",counter_pdpdf,((double)counter_pdpdf)/((double) samplesize)); + fprintf(out,"\tlogPDF: %7d (%g)\n",counter_logpdf,((double)counter_logpdf)/((double) samplesize)); + fprintf(out,"\tdlogPDF: %7d (%g)\n",counter_dlogpdf,((double)counter_dlogpdf)/((double) samplesize)); + fprintf(out,"\tpdlogPDF:%7d (%g)\n",counter_pdlogpdf,((double)counter_pdlogpdf)/((double) samplesize)); + break; + case UNUR_DISTR_DISCR: + fprintf(out,"\tPMF: %7d (%g)\n",counter_pmf,((double)counter_pmf)/((double) samplesize)); + fprintf(out,"\tCDF: %7d (%g)\n",counter_cdf,((double)counter_cdf)/((double) samplesize)); + break; + } + } + + /* free memory */ + _unur_free(gen); + _unur_distr_free(distr); + + /* return total number of evaluations */ + return count; + +} /* end of unur_test_count_pdf() */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/tests/counturn.c b/vendor/unuran-1.11.0/src/tests/counturn.c new file mode 100644 index 0000000..7d7c1e9 --- /dev/null +++ b/vendor/unuran-1.11.0/src/tests/counturn.c @@ -0,0 +1,167 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * file: counturn.c * + * * + * Count used uniform random numbers * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include "unuran_tests.h" + +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +static char test_name[] = "CountURN"; + +/*---------------------------------------------------------------------------*/ +/* common variables */ + +static long urng_counter = 0; /* count uniform random numbers */ + +/*---------------------------------------------------------------------------*/ +/* wrapper for uniform random number generator that performs counting */ +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_URNG_UNURAN +/*---------------------------------------------------------------------------*/ + +static double (*urng_to_use)(void*); /* pointer to real uniform RNG */ +/*---------------------------------------------------------------------------*/ + +static double +_urng_with_counter(void *params) + /*----------------------------------------------------------------------*/ + /* wrapper for uniform random number generator that performs counting */ + /*----------------------------------------------------------------------*/ +{ + ++urng_counter; + return urng_to_use(params); +} /* end of urng_with_counter() */ + +/*---------------------------------------------------------------------------*/ +#endif /* UNUR_URNG_UNURAN */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ + +int +unur_test_count_urn( struct unur_gen *gen, int samplesize, int verbosity, FILE *out ) + /*----------------------------------------------------------------------*/ + /* count used uniform random numbers */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* samplesize ... sample size */ + /* verbosity ... verbosity level, 0 = no output, 1 = output */ + /* out ... output stream */ + /* */ + /* return: */ + /* total number of used uniform random numbers */ + /* */ + /* error: */ + /* return -1 */ + /*----------------------------------------------------------------------*/ +{ + long j; + UNUR_URNG *urng_aux; + + /* check arguments */ + _unur_check_NULL(test_name,gen,-1); + + /* reset counter */ + urng_counter = 0; + + /* save auxilliary generator */ + urng_aux = gen->urng_aux; + + /* exchange pointer to uniform rng with counting wrapper */ +#ifdef UNUR_URNG_UNURAN + urng_to_use = gen->urng->sampleunif; + gen->urng->sampleunif = _urng_with_counter; + if (gen->urng_aux) gen->urng_aux = gen->urng; +#else + /* no counter available */ + if (verbosity) + fprintf(out,"\nCOUNT: --- (cannot count URNs)\n"); + return -1; +#endif + + /* run generator */ + switch (gen->method & UNUR_MASK_TYPE) { + case UNUR_METH_DISCR: + for( j=0; jurng->sampleunif = urng_to_use; +#endif + + /* restore auxilliary generator */ + gen->urng_aux = urng_aux; + + /* print result */ + if (verbosity) { + fprintf(out,"\nCOUNT: %g urng per generated number (total = %ld)\n", + ((double)urng_counter)/((double) samplesize),urng_counter); + } + + /* return total number of used uniform random numbers */ + return urng_counter; + +} /* end of unur_test_count_urn() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/tests/inverror.c b/vendor/unuran-1.11.0/src/tests/inverror.c new file mode 100644 index 0000000..87346c4 --- /dev/null +++ b/vendor/unuran-1.11.0/src/tests/inverror.c @@ -0,0 +1,427 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * file: inverror.c * + * * + * Estimate u and x-errors for inversion methods * + * * + ***************************************************************************** + * * + * Copyright (c) 2008-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "unuran_tests.h" + +/*---------------------------------------------------------------------------*/ + +static char test_name[] = "InvError"; + +static double uerror_cont ( const UNUR_GEN *gen, + double *max_error, double *MAE, double threshold, + int samplesize, int randomized, int testtails, + int verbosity, FILE *out ); + +static double uerror_discr( const UNUR_GEN *gen, + double *max_error, double *MAE, double threshold, + int samplesize, int randomized, int testtails, + int verbosity, FILE *out ); + +static double qrng (int i, int samplesize); + +/*---------------------------------------------------------------------------*/ + +double +unur_test_u_error( const UNUR_GEN *gen, + double *max_error, double *MAE, double threshold, + int samplesize, int randomized, int testtails, + int verbosity, FILE *out ) + /*----------------------------------------------------------------------*/ + /* Estimate maximal u-error and mean absolute error (MAE) by means of */ + /* (Quasi-) Monte-Carlo simulation. */ + /* In addition a penalty value is computed and returned. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* max_error ... pointer for storing maximal u-error */ + /* MEA ... pointer for storing MA u-error */ + /* threshold ... maximum allowed error */ + /* samplesize ... sample size for Monte Carlo simulation */ + /* randomized ... use pseudo-random (TRUE) or quasi-random (FALSE) */ + /* testtails ... when TRUE then run a special test for tails */ + /* verbosity ... verbosity level, 0 = no output, 1 = output */ + /* out ... output stream */ + /* */ + /* return: */ + /* penalty score */ + /* */ + /* error: */ + /* return -1 */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL(test_name,gen,-1.); + if (verbosity) { _unur_check_NULL(test_name,out,-1.); } + if (samplesize < 1000) { + _unur_error(test_name,UNUR_ERR_GENERIC,"samplesize too small --> increased to 1000"); + samplesize = 1000; + } + + /* type of generator object */ + if ( (gen->method == UNUR_METH_HINV) || + (gen->method == UNUR_METH_NINV) || + (gen->method == UNUR_METH_PINV) || + (gen->method == UNUR_METH_CSTD && ((struct unur_cstd_gen*)gen->datap)->is_inversion) || + (gen->method == UNUR_METH_MIXT && ((struct unur_mixt_gen*)gen->datap)->is_inversion) + ) { + /* continuous distribution */ + return uerror_cont(gen,max_error,MAE,threshold,samplesize, + randomized,testtails,verbosity,out); + } + if ( (gen->method == UNUR_METH_DGT) || + (gen->method == UNUR_METH_DSTD && ((struct unur_dstd_gen*)gen->datap)->is_inversion) + ) { + /* continuous distribution */ + return uerror_discr(gen,max_error,MAE,threshold,samplesize, + randomized,testtails,verbosity,out); + } + + _unur_error(test_name,UNUR_ERR_GENERIC,"inversion method required"); + return -1.; + +} /* end of unur_test_estimate_u_error() */ + +/*---------------------------------------------------------------------------*/ + +double +uerror_cont( const UNUR_GEN *gen, + double *max_error, double *MAE, double threshold, + int samplesize, int randomized, int testtails, + int verbosity, FILE *out ) + /*----------------------------------------------------------------------*/ + /* Estimate u-error for continuous distributions. */ + /* */ + /* return: */ + /* penalty score */ + /* */ + /* error: */ + /* return -1 */ + /*----------------------------------------------------------------------*/ +{ +#define DISTR gen->distr->data.cont + + double CDFmin, CDFmax; /* minimum and maximum of CDF in given domain */ + + double (*quantile)(const UNUR_GEN *, double); /* pointer to quantile function */ + + double U; /* uniform and non-uniform (Q)RN */ + double X; /* non-uniform RV */ + double cdfX; /* CDF at X */ + + double uerror, umax, usum; /* last, maximum, sum of U-error(s) */ + double penalty = 0; /* score for error */ + + int j; /* aux variable */ + + /* get pointer to function that approximates quantiles */ + switch (gen->method) { + case UNUR_METH_HINV: + quantile = unur_hinv_eval_approxinvcdf; + break; + + case UNUR_METH_NINV: + quantile = unur_ninv_eval_approxinvcdf; + break; + + case UNUR_METH_PINV: + quantile = unur_pinv_eval_approxinvcdf; + break; + + case UNUR_METH_CSTD: + if (! (((struct unur_cstd_gen*)gen->datap)->is_inversion)) + return -1.; + quantile = unur_cstd_eval_invcdf; + break; + + case UNUR_METH_MIXT: + if (! (((struct unur_mixt_gen*)gen->datap)->is_inversion)) + return -1.; + quantile = unur_cstd_eval_invcdf; + break; + + default: + _unur_error(test_name,UNUR_ERR_GENERIC,"inversion method required"); + return -1.; + } + + /* CDF required */ + if (DISTR.cdf == NULL) { + _unur_error(test_name,UNUR_ERR_GENERIC,"CDF required"); + return -2.; + } + + /* range of CDF */ + CDFmin = ((DISTR.trunc[0] > -UNUR_INFINITY) + ? _unur_cont_CDF((DISTR.trunc[0]),(gen->distr)) : 0.); + CDFmax = ((DISTR.trunc[1] < UNUR_INFINITY) + ? _unur_cont_CDF((DISTR.trunc[1]),(gen->distr)) : 1.); + + /* initialize variables */ + umax = 0.; + usum = 0.; + + /* get sample */ + for(j=0;jurng); + else + U = (testtails) ? qrng(j,samplesize) : (j+0.5) / ((double) samplesize); + + /* compute inverse CDF */ + X = quantile(gen,U); + + /* compute CDF at X */ + cdfX = _unur_cont_CDF(X,gen->distr); + + /* compute U-error: U-error = | U - CDF(X) | + However, we have first to rescale CDF(X): + CDFrescaled = (CDF(X) - CDFmin) / (CDFmax - CDFmin) + as we have to deal with truncated distribution. + But then the computed U error might be too large; thus + we have to correct it by the factor (CDFmax - CDFmin) + to unavoidably high U-errors. + */ + uerror = fabs( U*(CDFmax - CDFmin) - (cdfX-CDFmin)); + + /* update error estimates */ + usum += uerror; + if (uerror > umax) { + umax = uerror; + } + + /* update penalty */ + if (_unur_FP_less(threshold,uerror)) { + penalty += 1. + 10.*(uerror - threshold) / threshold; + if (verbosity) + fprintf(out,"\tmax u-error exceeded at %g: %g (>%g)\n", + X,uerror,threshold); + } + } + + /* save data */ + *max_error = umax; + *MAE = usum/samplesize; + + /* return penalty */ + return penalty/samplesize; + +#undef DISTR +} /* end of uerror_cont() */ + +/*---------------------------------------------------------------------------*/ + +double +uerror_discr( const UNUR_GEN *gen, + double *max_error, double *MAE, double threshold, + int samplesize, int randomized, + int testtails ATTRIBUTE__UNUSED, + int verbosity, FILE *out ) + /*----------------------------------------------------------------------*/ + /* Estimate u-error for discrete distributions. */ + /* */ + /* return: */ + /* penalty score */ + /* */ + /* error: */ + /* return -1 */ + /*----------------------------------------------------------------------*/ +{ +#define DISTR gen->distr->data.discr + + /* double CDFmin, CDFmax; /\* minimum and maximum of CDF in given domain *\/ */ + + int (*quantile)(const UNUR_GEN *, double); /* pointer to quantile function */ + + double U; /* uniform and non-uniform (Q)RN */ + int K; /* non-uniform RV */ + + double cdfK; /* CDF at K */ + double uerror, umax, usum; /* uerror, maximum u-error and sum of all uerrors */ + double penalty = 0; /* score for error */ + + int j; /* aux variable */ + + /* get pointer to function that approximates quantiles */ + switch (gen->method) { + case UNUR_METH_DGT: + quantile = unur_dgt_eval_invcdf; + break; + + case UNUR_METH_DSTD: + if (! (((struct unur_dstd_gen*)gen->datap)->is_inversion)) + return -1.; + quantile = unur_dstd_eval_invcdf; + break; + + default: + _unur_error(test_name,UNUR_ERR_GENERIC,"inversion method required"); + return -1.; + } + + /* CDF required */ + if (DISTR.cdf == NULL) { + _unur_error(test_name,UNUR_ERR_GENERIC,"CDF required"); + return -2.; + } + + /* range of CDF */ + /* CDFmin = (DISTR.trunc[0] <= INT_MIN) ? 0. : _unur_discr_CDF((DISTR.trunc[0]),(gen->distr)); */ + /* CDFmax = _unur_discr_CDF((DISTR.trunc[1]),(gen->distr)); */ + + /* initialize variables */ + umax = 0.; + usum = 0.; + + /* get sample */ + for(j=0;jurng); + else + U = (j+0.5) / ((double) samplesize); + + /* compute inverse CDF */ + K = (int) quantile(gen,U); + + /* estimate uerror */ + uerror = 0.; + cdfK = _unur_discr_CDF(K,gen->distr); + if (cdfK < U) { + uerror = U - cdfK; + } + else { + cdfK = _unur_discr_CDF(K-1,gen->distr); + uerror = cdfK - U; + uerror = _unur_max(0.,uerror); + } + /* Remark: we could save a lot of time if we store CDF values in a table. */ + + /* Remark: we do not consider truncated distributions here !! */ + + /* update error estimates */ + usum += uerror; + if (uerror > umax) + umax = uerror; + + + /* update error estimates */ + if (uerror > umax) { + umax = uerror; + } + + /* update penalty */ + if (_unur_FP_less(threshold,uerror)) { + penalty += 1. + 10.*(uerror - threshold) / threshold; + if (verbosity) + fprintf(out,"\tmax u-error exceeded at U=%g: %g (>%g)\n", + U,uerror,threshold); + } + } + + /* save data */ + *max_error = umax; + *MAE = usum/samplesize; + + /* return penalty */ + return penalty/samplesize; + +#undef DISTR +} /* end of uerror_discr() */ + +/*---------------------------------------------------------------------------*/ + +double +qrng (int i, int samplesize) + /*----------------------------------------------------------------------*/ + /* Quasi-random sequence for testing inversion error. */ + /* 90% of the sample size is used for equidistributed points in (0,1), */ + /* 5% for left tail in (0,1e-5) and */ + /* 5% for the right tail in (1-1e-5,1). */ + /* */ + /* parameters: */ + /* i ... index of pointe in sequence */ + /* samplesize ... sample size for Monte Carlo simulation */ + /* */ + /* return: */ + /* point in sequence */ + /*----------------------------------------------------------------------*/ +{ + double U; + int tail; + + /* theshold values for tail parts */ + tail = (int) (0.05 * samplesize); + + /* i must be in 0, ..., samplesize-1 */ + i = i % samplesize; + + if (i < tail) { + /* lower tail */ + U = (i+0.5) / (1.e5 * tail); + } + else if (i >= samplesize-tail) { + /* upper tail */ + i -= samplesize-tail; + U = 1. - (i+0.5) / (1.e5 * tail); + } + else { + /* central part */ + i -= tail; + U = (i+0.5) / (samplesize - 2.*tail); + } + + /* return point */ + return U; + +} /* end of qrng() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/tests/moments.c b/vendor/unuran-1.11.0/src/tests/moments.c new file mode 100644 index 0000000..393a141 --- /dev/null +++ b/vendor/unuran-1.11.0/src/tests/moments.c @@ -0,0 +1,177 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * file: moments.c * + * * + * compute central moments of samples * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Spicer C.C. (1972): Algorithm AS 52: Calculation of Power Sums of * + * Deviations about the mean, Applied Statistics 21(2), pp. 226-227. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "unuran_tests.h" + +/*---------------------------------------------------------------------------*/ +static char test_name[] = "Moments"; +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ + +int +unur_test_moments( UNUR_GEN *gen, double *moments, int n_moments, int samplesize, + int verbosity, FILE *out ) + /*----------------------------------------------------------------------*/ + /* compute central moments of samples. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* moments ... array for storing moments */ + /* for multivariate distributions the moments are */ + /* stored consecutively for each dimension. */ + /* arraylength = (n_moments+1) * dim */ + /* n_moments ... number of moments to be calculated (at most 4) */ + /* samplesize ... sample size */ + /* verbosity ... verbosity level, 0 = no output, 1 = output */ + /* out ... output stream */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ +#define idx(d,n) ((d)*(n_moments+1)+(n)) + + double an, an1, dx, dx2; + int n, mom, d, dim; + double *x; + + /* check parameter */ + _unur_check_NULL(test_name, gen, UNUR_ERR_NULL); + + /* type of distribution */ + if (! ( ((gen->method & UNUR_MASK_TYPE) == UNUR_METH_DISCR) || + ((gen->method & UNUR_MASK_TYPE) == UNUR_METH_CONT) || + ((gen->method & UNUR_MASK_TYPE) == UNUR_METH_VEC) )) { + _unur_error(test_name,UNUR_ERR_GENERIC,"dont know how to compute moments for distribution"); + return UNUR_ERR_GENERIC; + } + /* array for storing moments */ + CHECK_NULL(moments,0); + if (n_moments <= 0 || n_moments > 4) { + _unur_error(test_name,UNUR_ERR_GENERIC,"number of moments < 1 or > 4"); + return UNUR_ERR_GENERIC; + } + + /* sample size >= 10 */ + if (samplesize < 10) + samplesize = 10; + + /* number of dimensions can only be > 1 for multivariate case */ + dim = 1; + if ((gen->method & UNUR_MASK_TYPE) == UNUR_METH_VEC) dim = gen->distr->dim; + + /* allocating memory for sampling "vector" */ + x = _unur_xmalloc(dim * sizeof(double)); + + /* clear array of moments */ + for (d=0; dmethod & UNUR_MASK_TYPE) { + case UNUR_METH_DISCR: + x[0] = _unur_sample_discr(gen); break; + case UNUR_METH_CONT: + x[0] = _unur_sample_cont(gen); break; + case UNUR_METH_VEC: + _unur_sample_vec(gen, x); break; + } + + for (d=0; d +#include +#include +#include +#include "unuran_tests.h" + +/*---------------------------------------------------------------------------*/ +static char test_name[] = "Sample"; +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ + +void +unur_test_printsample( struct unur_gen *gen, int n_rows, int n_cols, FILE *out ) + /*----------------------------------------------------------------------*/ + /* print a sample of generator output in small (n_rows x n_cols) table */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* n_rows ... number of rows */ + /* n_cols ... number of columns (for univariate case only) */ + /* out ... output stream */ + /*----------------------------------------------------------------------*/ +{ + int i,j,k; + + /* check arguments */ + _unur_check_NULL(test_name,gen,RETURN_VOID); + + fprintf(out,"\nSAMPLE: "); + + switch (gen->method & UNUR_MASK_TYPE) { + + case UNUR_METH_DISCR: + for( j=0; j +#include +#include +#include "unuran_tests.h" + +/*---------------------------------------------------------------------------*/ +static char test_name[] = "Quantiles"; +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ + +int +unur_test_quartiles( UNUR_GEN *gen, double *q0 ,double *q1, double *q2, double *q3, double *q4, + int samplesize, int verbosity, FILE *out ) + /*----------------------------------------------------------------------*/ + /* compute estimate for quartiles and mean of samples. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* q0 ... minimum */ + /* q1 ... 1st quartile (25%) */ + /* q2 ... median (2nd quartile, 50%) */ + /* q3 ... 3rd quartile (75%) */ + /* q4 ... maximum */ + /* samplesize ... sample size */ + /* verbosity ... verbosity level, 0 = no output, 1 = output */ + /* out ... output stream */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + double x = 0.; + int n; + + double p = 0.5; /* p-quantile -- median */ + double h[5]; /* marker height */ + int pos[5]; /* marker position */ + double dpos[5]; /* desired position */ + int i, j; /* loop variables */ + int sgnd; /* sign of d */ + double tmp; + double d; /* (dp-p) at first, then sign */ + + + /* check parameter */ + _unur_check_NULL(test_name, gen, UNUR_ERR_NULL); + + /* type of distribution */ + if (! ( ((gen->method & UNUR_MASK_TYPE) == UNUR_METH_DISCR) || + ((gen->method & UNUR_MASK_TYPE) == UNUR_METH_CONT) )) { + _unur_error(test_name,UNUR_ERR_GENERIC,"dont know how to compute quartiles for distribution"); + return UNUR_ERR_GENERIC; + } + + /* sample size >= 10 */ + if (samplesize < 10) + samplesize = 10; + + /* sampling */ + /* estimate quartiles using algorithm [1]. */ + + for (n=0; nmethod & UNUR_MASK_TYPE) { + case UNUR_METH_DISCR: + x = _unur_sample_discr(gen); break; + case UNUR_METH_CONT: + x = _unur_sample_cont(gen); break; + } + + /* ******************************************* */ + /* PP-algorithm */ + + + if ( n==0 ){ /* BEGIN OF INITIALIZATION */ + + h[n] = x; + pos[n] = n; + + /* initialize desired positions */ + dpos[0] = 0.; + dpos[1] = p/2.; + dpos[2] = 4.*p; + dpos[3] = 2. + 2.*p; + dpos[4] = 4.; + + } /* end of n==0 */ + else if ( n<4 ){ /* 0 h[j+1] ){ /* swap */ + tmp = h[j]; + h[j] = h[j+1]; + h[j+1] = tmp; + } + } + } /* end of sorting */ + + } /* end of n==4 -- END OF INITIALIZATION */ + else{ /* n > 4 */ + + + /* adjust height of extreme markers */ + if ( x < h[0] ) + h[0] = x; + if ( x > h[4] ) + h[4] = x; + + + /* adjust position of all markers */ + for (i=1; i<4; i++){ + if ( x < h[i] ){ + pos[i]++; + } + } /* end of for */ + pos[4]++; /* will always be at the last positon */ + + + /* adjust desired position of all markers */ + dpos[1] = (double) n * p/2.; + dpos[2] = (double) n * p; + dpos[3] = (double) n * (1.+p)/2.; + dpos[4] = (double) n; + + + /* adjust height of markers if necessary */ + for (i=1; i<4; i++){ + + d = dpos[i] - pos[i]; /* discrepancy of position*/ + + /* decide on update of markers */ + if ( (d >= 1. && pos[i+1]-pos[i] > 1) || + (d <= -1. && pos[i-1]-pos[i] < -1) ){ + + /* markers are shifted by at most 1 */ + sgnd = (d < 0.) ? -1 : 1; + d = (double) sgnd; + + /* try parabolic formula */ + tmp = h[i] + d/(pos[i+1]-pos[i-1]) * + ( (pos[i]-pos[i-1]+d) * (h[i+1]-h[i])/(pos[i+1]-pos[i]) + + (pos[i+1]-pos[i]-d) * (h[i]-h[i-1])/(pos[i]-pos[i-1]) ); + + + /* use linear formula -- parabolic model failed */ + if ( tmp <= h[i-1] || tmp >= h[i+1]){ + tmp = h[i] + d*(h[i]-h[i+sgnd])/(pos[i]-pos[i+sgnd]); + } + + h[i] = tmp; /* update height */ + pos[i] += sgnd; /* update position */ + + } /* end if -- marker i updated */ + + } /* end for -- all markers updated */ + + +/* + for (i=0;i<5;i++) + fprintf(out,"%6.2f ", h[i]); + fprintf(out,"\n"); +*/ + + } /* end n>4 */ + + /* end of PP-algorithm */ + /* ******************************************* */ + + } + + /* copy results */ + *q0 = h[0]; + *q1 = h[1]; + *q2 = h[2]; + *q3 = h[3]; + *q4 = h[4]; + + /* now print results */ + if (verbosity) { + fprintf(out,"\nQuartiles:\n"); + fprintf(out,"\tmin = \t%6.5g\n",*q0); + fprintf(out,"\t25%% =\t%6.5g\n",*q1); + fprintf(out,"\t50%% =\t%6.5g\n",*q2); + fprintf(out,"\t75%% =\t%6.5g\n",*q3); + fprintf(out,"\tmax = \t%6.5g\n",*q4); + } + + return UNUR_SUCCESS; + +} /* end of unur_test_quartiles() */ + +/*---------------------------------------------------------------------------*/ + + + + + diff --git a/vendor/unuran-1.11.0/src/tests/tests.c b/vendor/unuran-1.11.0/src/tests/tests.c new file mode 100644 index 0000000..0f6c0d0 --- /dev/null +++ b/vendor/unuran-1.11.0/src/tests/tests.c @@ -0,0 +1,322 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: testw.c * + * * + * run various statistical tests, timing, ... * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include "unuran_tests.h" + +/*---------------------------------------------------------------------------*/ + +#define TEST_TIMING_LOG_SAMPLESIZE 5 /* common log of sample size for timing (>= 2!!) */ + +#define TEST_COUNTER_SAMPLESIZE 100000 /* sample size for counting number of URNs */ + +#define TEST_SAMPLE_ROWS 10 /* number of rows and columns for sample */ +#define TEST_SAMPLE_COLS 10 + + +#define TEST_CHI2_VERBOSE 1 /* output switch for chi^2 test */ +#define TEST_CHI2_INTERVALS 100 /* number of intervals for chi^2 test */ + +/*---------------------------------------------------------------------------*/ +/* some tools */ +static int _unur_print_method( struct unur_par *par, FILE *out ); + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Run different tests * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +void +unur_run_tests( struct unur_par *par, unsigned tests, FILE *out ) + /*----------------------------------------------------------------------*/ + /* test generator */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* tests ... list of tests (stored as bit array) */ + /* out ... output stream */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen = NULL; + struct unur_par *par_clone = NULL; + double time_setup, time_sample; + + /* check arguments */ + _unur_check_NULL("Tests",par,RETURN_VOID); + + if (!out) out = stdout; + + /* print info about method */ + if (_unur_print_method(par,out)!=UNUR_SUCCESS) + return; /* unknown method */ + + /* make a clone of the parameter object which will be needed for counting PDF calls */ + par_clone = _unur_par_clone(par); + + /* init generator object */ + if (tests & UNUR_TEST_TIME) + /* evaluate setup time and generation time */ + gen = unur_test_timing(par,TEST_TIMING_LOG_SAMPLESIZE, &time_setup, &time_sample, TRUE, out); + else + gen = _unur_init(par); + + /* init successful ? */ + if (!gen) { _unur_par_free(par_clone); return; } + + /* count number of uniform random numbers */ + if (tests & UNUR_TEST_N_URNG ) + unur_test_count_urn(gen,TEST_COUNTER_SAMPLESIZE, TRUE, out); + + /* count PDF calls */ + if (tests & UNUR_TEST_N_PDF ) + unur_test_par_count_pdf(par_clone,TEST_COUNTER_SAMPLESIZE, TRUE, out); + + /* print a sample */ + if (tests & UNUR_TEST_SAMPLE ) + unur_test_printsample(gen,TEST_SAMPLE_ROWS,TEST_SAMPLE_COLS, out); + + /* run chi2-test*/ + if (tests & UNUR_TEST_CHI2) + unur_test_chi2(gen,TEST_CHI2_INTERVALS,0,0,TEST_CHI2_VERBOSE, out); + + /* free generator */ + _unur_free(gen); + + /* free parameter object */ + _unur_par_free(par_clone); + + return; + +} /* end of unur_run_tests() */ + +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * * + * Some tools * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +_unur_print_method( struct unur_par *par, FILE *out ) + /*----------------------------------------------------------------------*/ + /* print name of method */ + /* */ + /* parameters: */ + /* par ... pointer to paramters for building generator object */ + /* out ... output stream */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* first print type */ + switch (par->distr->type) { + case UNUR_DISTR_DISCR: + fprintf(out,"\nTYPE:\t\tdiscrete univariate distribution\n"); + break; + case UNUR_DISTR_CONT: + fprintf(out,"\nTYPE:\t\tcontinuous univariate distribution\n"); + break; + case UNUR_DISTR_CEMP: + fprintf(out,"\nTYPE:\t\tcontinuous univariate empirical distribution\n"); + break; + case UNUR_DISTR_CVEC: + fprintf(out,"\nTYPE:\t\tcontinuous multivariate distribution\n"); + break; + default: /* unknown ! */ + _unur_error("Tests",UNUR_ERR_GENERIC,"type of method unknown!"); + return UNUR_ERR_GENERIC; + } + + /* print method description */ + switch (par->method) { + + /* automatic method */ + case UNUR_METH_AUTO: + COOKIE_CHECK(par,CK_AUTO_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tautomatic selection (AUTO)\n"); + break; + + /* discrete, univariate */ + case UNUR_METH_DAU: + COOKIE_CHECK(par,CK_DAU_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\talias and alias-urn method (DAU)\n"); + break; + case UNUR_METH_DGT: + COOKIE_CHECK(par,CK_DGT_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tindexed search -- guide table (DGT)\n"); + break; + case UNUR_METH_DSROU: + COOKIE_CHECK(par,CK_DSROU_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tdiscrete simple universal ratio-of-uniforms search (DSROU)\n"); + break; + case UNUR_METH_DSS: + COOKIE_CHECK(par,CK_DSS_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tsequential search (DSS)\n"); + break; + case UNUR_METH_DSTD: + COOKIE_CHECK(par,CK_DSTD_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tspecial (DSTD)\n"); + break; + case UNUR_METH_DEXT: + COOKIE_CHECK(par,CK_DEXT_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\texternal generator (DEXT)\n"); + break; + + /* continuous, univariate */ + case UNUR_METH_AROU: + COOKIE_CHECK(par,CK_AROU_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tautomatic ratio-of-uniforms method (NINV)\n"); + break; + case UNUR_METH_HINV: + COOKIE_CHECK(par,CK_HINV_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tnumerical inversion of CDF by Hermite Interpolation (HINV)\n"); + break; + case UNUR_METH_ITDR: + COOKIE_CHECK(par,CK_ITDR_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tinverse transformed density rejection (ITDR)\n"); + break; + case UNUR_METH_NINV: + COOKIE_CHECK(par,CK_NINV_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tnumerical inversion of CDF (NINV)\n"); + break; + case UNUR_METH_NROU: + COOKIE_CHECK(par,CK_NROU_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tnaive universal ratio-of-uniforms method (NROU)\n"); + break; + case UNUR_METH_PINV: + COOKIE_CHECK(par,CK_PINV_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tpolynomial interpolation based inversion of CDF (PINV)\n"); + break; + case UNUR_METH_SROU: + COOKIE_CHECK(par,CK_SROU_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tsimple universal ratio-of-uniforms method (SROU)\n"); + break; + case UNUR_METH_SSR: + COOKIE_CHECK(par,CK_SSR_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tsimple transformed density rejection with universal bounds (SSR)\n"); + break; + case UNUR_METH_TABL: + COOKIE_CHECK(par,CK_TABL_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\trejection from piecewise constant hat (TABL)\n"); + break; + case UNUR_METH_TDR: + COOKIE_CHECK(par,CK_TDR_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\ttransformed density rejection (TDR)\n"); + break; + case UNUR_METH_UTDR: + COOKIE_CHECK(par,CK_UTDR_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\ttransformed density rejection, 3-point method (UTDR)\n"); + break; + case UNUR_METH_CSTD: + COOKIE_CHECK(par,CK_CSTD_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tspecial (CSTD)\n"); + break; + case UNUR_METH_CEXT: + COOKIE_CHECK(par,CK_CEXT_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\texternal generator (CEXT)\n"); + break; + + + /* continuous, empirical */ + case UNUR_METH_EMPK: + COOKIE_CHECK(par,CK_EMPK_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tempirical distribution with kernel smoothing (EMPK)\n"); + break; + + /* continuous, multivariate (random vector) */ + case UNUR_METH_GIBBS: + COOKIE_CHECK(par,CK_GIBBS_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tMarkov Chain - GIBBS sampler (GIBBS)\n"); + break; + + case UNUR_METH_HITRO: + COOKIE_CHECK(par,CK_HITRO_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\thit&run ratio-of-uniforms (HITRO)\n"); + break; + + case UNUR_METH_MVSTD: + COOKIE_CHECK(par,CK_MVSTD_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tspecial (MVSTD)\n"); + break; + + case UNUR_METH_MVTDR: + COOKIE_CHECK(par,CK_MVTDR_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tmultivariate transformed density rejection (MVTDR)\n"); + break; + + case UNUR_METH_NORTA: + COOKIE_CHECK(par,CK_NORTA_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tnormal to anything (NORTA)\n"); + break; + + case UNUR_METH_VMT: + COOKIE_CHECK(par,CK_VMT_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tvector matrix transformation (VMT)\n"); + break; + + case UNUR_METH_VNROU: + COOKIE_CHECK(par,CK_VNROU_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\tvector naive ratio-of-uniforms (VNROU)\n"); + break; + + /* misc */ + case UNUR_METH_UNIF: + COOKIE_CHECK(par,CK_UNIF_PAR,UNUR_ERR_COOKIE); + fprintf(out,"METHOD:\t\twrapper for uniform (UNIF)\n"); + break; + + default: /* unknown ! */ + _unur_error("Tests",UNUR_ERR_GENERIC,"method unknown!"); + return UNUR_ERR_GENERIC; + } + + /* everything o.k. */ + return UNUR_SUCCESS; + +} /* end of _unur_print_method() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/tests/timing.c b/vendor/unuran-1.11.0/src/tests/timing.c new file mode 100644 index 0000000..eff38cc --- /dev/null +++ b/vendor/unuran-1.11.0/src/tests/timing.c @@ -0,0 +1,693 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * file: timing.c * + * * + * estimate setup and (marginal) generation time * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "unuran_tests.h" + +/*---------------------------------------------------------------------------*/ +/* define timer */ + +#if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) +/* use gettimeofday() command. Not in ANSI C! */ +#include +static struct timeval tv; +#define _unur_get_time() ( gettimeofday(&tv, NULL), ((tv).tv_sec * 1.e6 + (tv).tv_usec) ) +#else +/* use clock() command. ANSI C but less accurate */ +#include +#define _unur_get_time() ( (1.e6 * clock()) / CLOCKS_PER_SEC ) +#endif + +/*---------------------------------------------------------------------------*/ +static char test_name[] = "Timing"; +/*---------------------------------------------------------------------------*/ + +static double unur_test_timing_total_run( const struct unur_par *par, int samplesize, int repeat ); +/*---------------------------------------------------------------------------*/ +/* estimate average time (in micro seconds) for sampling 1 random variate */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ + +/* compare two doubles (needed for sorting) */ +inline static int +compare_doubles (const void *a, const void *b) +{ + const double *da = (const double *) a; + const double *db = (const double *) b; + return (*da > *db) - (*da < *db); +} + +/*---------------------------------------------------------------------------*/ + +struct unur_gen* +unur_test_timing( struct unur_par *par, + int log10_samplesize, + double *time_setup, + double *time_sample, + int verbosity, + FILE *out ) + /*----------------------------------------------------------------------*/ + /* init generator and estimate setup and generation time. */ + /* */ + /* parameters: */ + /* par ... pointer to parameters for generator object */ + /* log10_samplesize ... common log of maximal sample size */ + /* time_setup ... time for setup */ + /* time_sample ... marginal generation time (i.e. for one r.n.) */ + /* verbosity ... verbosity level, 0 = no output, 1 = output */ + /* out ... output stream */ + /* */ + /* return: */ + /* pointer to generator object. */ + /* setup time and marginal generation time are stored in */ + /* setup_time and marginal_time, respectively. */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_gen *gen; + int k ATTRIBUTE__UNUSED; + double x ATTRIBUTE__UNUSED; + double *vec = NULL; + double time_uniform, time_exponential; + double time_start, *time_gen; + long samples, samplesize, log10_samples; + + /* check parameter */ + _unur_check_NULL(test_name,par,NULL); + if (log10_samplesize < 2) log10_samplesize = 2; + + /* need an array to store timings */ + time_gen = _unur_xmalloc((log10_samplesize+1) * sizeof(double)); + + /* marginal generation time for one unifrom random number */ + time_uniform = unur_test_timing_uniform( par,log10_samplesize ); + /* marginal generation time for one exponential random variate */ + time_exponential = unur_test_timing_exponential( par,log10_samplesize ); + + /* we need an array for the vector */ + if (par->distr && _unur_gen_is_vec(par)) + vec = _unur_xmalloc( par->distr->dim * sizeof(double) ); + + /* initialize generator (and estimate setup time) */ + time_start = _unur_get_time(); + gen = _unur_init(par); + *time_setup = _unur_get_time(); + + /* init successful ? */ + if (!gen) { + free (time_gen); + if (vec) free(vec); + return NULL; + } + + /* evaluate generation time */ + samplesize = 10; + samples = 0; + for( log10_samples=1; log10_samples<=log10_samplesize; log10_samples++ ) { + + switch (gen->method & UNUR_MASK_TYPE) { + case UNUR_METH_DISCR: + for( ; samples < samplesize; samples++ ) + k = unur_sample_discr(gen); + break; + case UNUR_METH_CONT: + case UNUR_METH_CEMP: + for( ; samples < samplesize; samples++ ) + x = unur_sample_cont(gen); + break; + case UNUR_METH_VEC: + for( ; samples < samplesize; samples++ ) + unur_sample_vec(gen,vec); + break; + default: /* unknown ! */ + _unur_error(test_name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); + free(time_gen); + if (vec) free(vec); + return NULL; + } + + time_gen[log10_samples] = _unur_get_time(); + samplesize *= 10; + } + + /* compute generation times */ + + /* marginal generation time */ + *time_sample = (time_gen[log10_samplesize] - time_gen[log10_samplesize-1]) / (0.09 * samplesize); + /* mean time per random number including setup */ + samplesize = 1; + for( log10_samples=1; log10_samples<=log10_samplesize; log10_samples++ ) { + samplesize *= 10; + time_gen[log10_samples] = (time_gen[log10_samples] - time_start) / samplesize; + } + /* setup time */ + *time_setup -= time_start; + + /* now print times */ + if (verbosity) { + fprintf(out,"\nTIMING:\t\t usec \t relative to \t relative to\n"); + fprintf(out,"\t\t\t\t uniform\t exponential\n\n"); + /* setup time */ + fprintf(out," setup time:\t %#g \t %#g \t %#g\n", + (*time_setup), + (*time_setup)/time_uniform, + (*time_setup)/time_exponential); + /* marginal generation time */ + fprintf(out," generation time: %#g \t %#g \t %#g\n", + (*time_sample), + (*time_sample)/time_uniform, + (*time_sample)/time_exponential); + /* generation times */ + fprintf(out,"\n average generation time for samplesize:\n"); + for( log10_samples=1; log10_samples<=log10_samplesize; log10_samples++ ) + fprintf(out,"\t10^%ld:\t %#g \t %#g \t %#g\n",log10_samples, + time_gen[log10_samples], + time_gen[log10_samples]/time_uniform, + time_gen[log10_samples]/time_exponential); + } + + /* free memory */ + free(time_gen); + if (vec) free(vec); + + /* return generator object */ + return gen; + +} /* end of unur_test_timing() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_test_timing_R( struct unur_par *par, const char *distrstr, const char *methodstr, + double log10_samplesize, double *time_setup, double *time_marginal ) + /*----------------------------------------------------------------------*/ + /* setup time and marginal generation time via linear regression. */ + /* */ + /* parameters: */ + /* par ... pointer to parameters for generator object */ + /* distrstr ... distribution described by a string */ + /* methodstr ... chosen method described by a string */ + /* log10_samplesize ... common log of maximal sample size */ + /* time_setup ... time for setup */ + /* time_marginal ... marginal generation time (i.e. for one r.n.) */ + /* */ + /* return: */ + /* coefficient of determination R^2 */ + /* */ + /* error: */ + /* return -100. */ + /*----------------------------------------------------------------------*/ +{ + const int n_steps = 2; /* number of sample sizes */ + const int n_reps = 10; /* number of repetitions for each sample size */ + + struct unur_distr *distr_tmp = NULL; /* temporary distribution object */ + struct unur_par *par_tmp = NULL; /* working copy of parameter object */ + struct unur_gen *gen_tmp = NULL; /* temporary generator object */ + struct unur_slist *mlist = NULL; /* auxiliary table for _unur_str2par()*/ + + int k ATTRIBUTE__UNUSED; + double x ATTRIBUTE__UNUSED; + double *vec = NULL; + + double time_start, *time_gen = NULL; + int sample, rep; + long samplesize, n; + + double sx = 0.; /* sums for linear regression */ + double sy = 0.; + double sxx = 0.; + double syy = 0.; + double sxy = 0.; + + double Rsq = -100.; /* coefficient of determination */ + + /* set initial values */ + *time_setup = -100.; + *time_marginal = -100.; + Rsq = -100.; + + /* check parameter */ + if (log10_samplesize < 2) log10_samplesize = 2; + + /* create parameter object (if necessary) */ + if (par == NULL) { + distr_tmp = unur_str2distr(distrstr); + if (distr_tmp == NULL) goto error; + par = _unur_str2par( distr_tmp, methodstr, &mlist ); + if (par == NULL) goto error; + } + + /* we need an array for storing timing results */ + time_gen = _unur_xmalloc( n_reps * sizeof(double) ); + + /* we need an array for a random vector */ + if (par->distr && _unur_gen_is_vec(par)) + vec = _unur_xmalloc( par->distr->dim * sizeof(double) ); + + /* measure timings for various sample sizes */ + for (sample=0; samplemethod & UNUR_MASK_TYPE) { + case UNUR_METH_DISCR: + for( n=0; n 1000) { + /* make second pilot study with double sample size */ + time_2nd = unur_test_timing_total_run(par, 2*size_pilot, repeat_pilot); + if (time_2nd < 0) return -1.; + + /* estimate time for given sample size */ + d = 2*time_pilot - time_2nd; + if (d<0.) d=0.; + k = (time_2nd - time_pilot)/size_pilot; + if (k<=0.) k = time_pilot/size_pilot; + time_pilot = d + samplesize * k; + } + else { + /* this is not required, but it prevents an error in case of a programming bug */ + d = 0; + k = time_pilot / size_pilot; + } + + /* now run timing test */ + + repeat_result = (int) (avg_duration / time_pilot); + if (repeat_result > 1000) repeat_result = 1000; + /* there is no need for more than 1000 repetitions */ + + size_result = samplesize; + + if (repeat_result >= 1) { + repeat_result = _unur_max(4,repeat_result); + if (repeat_result <= repeat_pilot && size_result == size_pilot) { + /* there is no need to run this test again */ + time_result = time_pilot; + } + else { + time_result = unur_test_timing_total_run(par,size_result,repeat_result); + } + } + else { + /* do not generate the full sample */ + repeat_result = 4; + size_result = (int) ((avg_duration - d)/k); + size_result /= 2; + time_result = unur_test_timing_total_run(par,size_result,repeat_result); + time_2nd = unur_test_timing_total_run(par,2*size_result,repeat_result); + /* estimate time from shorter sample sizes */ + d = 2*time_result - time_2nd; + if (d<0.) d=0.; + k = (time_2nd - time_result)/size_result; + if (k<=0.) k = time_result/size_result; + time_result = d + samplesize * k; + } + + /* o.k. */ + return time_result; + +} /* end of unur_test_timing_total() */ + +/*---------------------------------------------------------------------------*/ + +double unur_test_timing_total_run( const struct unur_par *par, int samplesize, int n_repeat ) + /*----------------------------------------------------------------------*/ + /* estimate average time (in micro seconds) for sampling */ + /* */ + /* parameters: */ + /* par ... pointer to parameters for generator object */ + /* samplesize ... sample size */ + /* n_repeat ... number of samples (repetitions of sampling) */ + /* */ + /* return: */ + /* total time in micro seconds */ + /* */ + /* error: */ + /* return -1 */ + /*----------------------------------------------------------------------*/ +{ + struct unur_par *par_tmp; /* temporary working copy of parameter object */ + struct unur_gen *gen_tmp; /* temporary generator object */ + double *time; + int n, rep; + double time_total; /* total time for sampling */ + double time_start; + int i; + int k ATTRIBUTE__UNUSED; + double x ATTRIBUTE__UNUSED; + double *vec = NULL; + + /* check parameter */ + _unur_check_NULL(test_name,par,-1.); + if (samplesize < 0 || n_repeat < 1) + return -1.; + + /* we need an array for storing timing results */ + time = _unur_xmalloc( n_repeat * sizeof(double) ); + + /* we need an array for a random vector */ + if (par->distr && _unur_gen_is_vec(par)) + vec = _unur_xmalloc( par->distr->dim * sizeof(double) ); + + /* make samples */ + for (rep = 0; rep < n_repeat; rep++) { + + /* make a working copy of parameter object */ + par_tmp = _unur_par_clone(par); + + /* start timer */ + time_start = _unur_get_time(); + + /* make generator object (init) */ + gen_tmp = _unur_init(par_tmp); + if (!gen_tmp) { /* init failed */ + if (vec) free(vec); + free(time); + /* wait a little bit till writing log entry is completed */ + for (x=0,i=0; i<100000; i++) x+=i; + return -1.; + } + + /* run generator */ + switch (gen_tmp->method & UNUR_MASK_TYPE) { + case UNUR_METH_DISCR: + for( n=0; nurng); + + /* evaluate marginal generation times */ + for( n=0; nurng); + + /* evaluate marginal generation times */ + for( n=0; n&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/unuran +pkgincludedir = $(includedir)/unuran +pkglibdir = $(libdir)/unuran +pkglibexecdir = $(libexecdir)/unuran +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +subdir = src/uniform +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libuniform_la_LIBADD = +am_libuniform_la_OBJECTS = urng_builtin.lo mrg31k3p.lo fish.lo mstd.lo \ + urng_fvoid.lo urng_gsl.lo urng_gslqrng.lo urng_prng.lo \ + urng_randomshift.lo urng_rngstreams.lo +libuniform_la_OBJECTS = $(am_libuniform_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I. -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/fish.Plo ./$(DEPDIR)/mrg31k3p.Plo \ + ./$(DEPDIR)/mstd.Plo ./$(DEPDIR)/urng_builtin.Plo \ + ./$(DEPDIR)/urng_fvoid.Plo ./$(DEPDIR)/urng_gsl.Plo \ + ./$(DEPDIR)/urng_gslqrng.Plo ./$(DEPDIR)/urng_prng.Plo \ + ./$(DEPDIR)/urng_randomshift.Plo \ + ./$(DEPDIR)/urng_rngstreams.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libuniform_la_SOURCES) +DIST_SOURCES = $(libuniform_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(includedir)" +HEADERS = $(include_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_CFLAGS = -Wall -Wextra -Wshadow -Wstrict-prototypes +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf +AUTOHEADER = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader +AUTOMAKE = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -fPIC +CPP = gcc -E +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +FILECMD = file +GREP = /usr/bin/grep +HAVE_DIVIDE_BY_ZERO = +HAVE_IEEE_COMPARISONS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAINT = # +MAKEINFO = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = unuran +PACKAGE_BUGREPORT = unuran@statmath.wu.ac.at +PACKAGE_NAME = unuran +PACKAGE_STRING = unuran 1.11.0 +PACKAGE_TARNAME = unuran +PACKAGE_URL = +PACKAGE_VERSION = 1.11.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +UNURAN_LT_VERSION = 16:1:0 +UNURAN_SUPPORTS_GSL = +UNURAN_SUPPORTS_PRNG = +UNURAN_SUPPORTS_RNGSTREAM = +VERSION = 1.11.0 +abs_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src/uniform +abs_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src/uniform +abs_top_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +have_valgrind = false +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../../ +top_builddir = ../.. +top_srcdir = ../.. +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libuniform.la +libuniform_la_SOURCES = \ + urng_builtin.c urng_builtin.h mrg31k3p.c fish.c mstd.c \ + urng_fvoid.c urng_fvoid.h \ + urng_gsl.c urng_gsl.h \ + urng_gslqrng.c urng_gslqrng.h \ + urng_prng.c urng_prng.h \ + urng_randomshift.c urng_randomshift.h \ + urng_rngstreams.c urng_rngstreams.h + +URNG_HEADER_FILES = \ + unuran_urng_gsl.h \ + unuran_urng_prng.h \ + unuran_urng_rngstreams.h + +include_HEADERS = $(URNG_HEADER_FILES) + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in \ + $(URNG_HEADER_FILES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/uniform/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/uniform/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libuniform.la: $(libuniform_la_OBJECTS) $(libuniform_la_DEPENDENCIES) $(EXTRA_libuniform_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libuniform_la_OBJECTS) $(libuniform_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/fish.Plo # am--include-marker +include ./$(DEPDIR)/mrg31k3p.Plo # am--include-marker +include ./$(DEPDIR)/mstd.Plo # am--include-marker +include ./$(DEPDIR)/urng_builtin.Plo # am--include-marker +include ./$(DEPDIR)/urng_fvoid.Plo # am--include-marker +include ./$(DEPDIR)/urng_gsl.Plo # am--include-marker +include ./$(DEPDIR)/urng_gslqrng.Plo # am--include-marker +include ./$(DEPDIR)/urng_prng.Plo # am--include-marker +include ./$(DEPDIR)/urng_randomshift.Plo # am--include-marker +include ./$(DEPDIR)/urng_rngstreams.Plo # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ $< + +.c.obj: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: + $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +# $(AM_V_CC)source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/fish.Plo + -rm -f ./$(DEPDIR)/mrg31k3p.Plo + -rm -f ./$(DEPDIR)/mstd.Plo + -rm -f ./$(DEPDIR)/urng_builtin.Plo + -rm -f ./$(DEPDIR)/urng_fvoid.Plo + -rm -f ./$(DEPDIR)/urng_gsl.Plo + -rm -f ./$(DEPDIR)/urng_gslqrng.Plo + -rm -f ./$(DEPDIR)/urng_prng.Plo + -rm -f ./$(DEPDIR)/urng_randomshift.Plo + -rm -f ./$(DEPDIR)/urng_rngstreams.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includeHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/fish.Plo + -rm -f ./$(DEPDIR)/mrg31k3p.Plo + -rm -f ./$(DEPDIR)/mstd.Plo + -rm -f ./$(DEPDIR)/urng_builtin.Plo + -rm -f ./$(DEPDIR)/urng_fvoid.Plo + -rm -f ./$(DEPDIR)/urng_gsl.Plo + -rm -f ./$(DEPDIR)/urng_gslqrng.Plo + -rm -f ./$(DEPDIR)/urng_prng.Plo + -rm -f ./$(DEPDIR)/urng_randomshift.Plo + -rm -f ./$(DEPDIR)/urng_rngstreams.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includeHEADERS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-includeHEADERS install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-includeHEADERS + +.PRECIOUS: Makefile + + +# make header files for installation +unuran_urng_gsl.h: urng_gsl.h urng_gslqrng.h + $(top_srcdir)/scripts/make_urng_header.pl urng_gsl.h urng_gslqrng.h > unuran_urng_gsl.h + +unuran_urng_prng.h: urng_prng.h + $(top_srcdir)/scripts/make_urng_header.pl urng_prng.h > unuran_urng_prng.h + +unuran_urng_rngstreams.h: urng_rngstreams.h + $(top_srcdir)/scripts/make_urng_header.pl urng_rngstreams.h > unuran_urng_rngstreams.h + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/uniform/Makefile.am b/vendor/unuran-1.11.0/src/uniform/Makefile.am new file mode 100644 index 0000000..eb86982 --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/Makefile.am @@ -0,0 +1,40 @@ +## Process this file with automake to produce Makefile.in + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libuniform.la + +libuniform_la_SOURCES = \ + urng_builtin.c urng_builtin.h mrg31k3p.c fish.c mstd.c \ + urng_fvoid.c urng_fvoid.h \ + urng_gsl.c urng_gsl.h \ + urng_gslqrng.c urng_gslqrng.h \ + urng_prng.c urng_prng.h \ + urng_randomshift.c urng_randomshift.h \ + urng_rngstreams.c urng_rngstreams.h + +URNG_HEADER_FILES = \ + unuran_urng_gsl.h \ + unuran_urng_prng.h \ + unuran_urng_rngstreams.h + +include_HEADERS = $(URNG_HEADER_FILES) + +# make header files for installation +unuran_urng_gsl.h: urng_gsl.h urng_gslqrng.h + $(top_srcdir)/scripts/make_urng_header.pl urng_gsl.h urng_gslqrng.h > unuran_urng_gsl.h + +unuran_urng_prng.h: urng_prng.h + $(top_srcdir)/scripts/make_urng_header.pl urng_prng.h > unuran_urng_prng.h + +unuran_urng_rngstreams.h: urng_rngstreams.h + $(top_srcdir)/scripts/make_urng_header.pl urng_rngstreams.h > unuran_urng_rngstreams.h + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in \ + $(URNG_HEADER_FILES) diff --git a/vendor/unuran-1.11.0/src/uniform/Makefile.in b/vendor/unuran-1.11.0/src/uniform/Makefile.in new file mode 100644 index 0000000..07ee9fa --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/Makefile.in @@ -0,0 +1,734 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/uniform +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libuniform_la_LIBADD = +am_libuniform_la_OBJECTS = urng_builtin.lo mrg31k3p.lo fish.lo mstd.lo \ + urng_fvoid.lo urng_gsl.lo urng_gslqrng.lo urng_prng.lo \ + urng_randomshift.lo urng_rngstreams.lo +libuniform_la_OBJECTS = $(am_libuniform_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/fish.Plo ./$(DEPDIR)/mrg31k3p.Plo \ + ./$(DEPDIR)/mstd.Plo ./$(DEPDIR)/urng_builtin.Plo \ + ./$(DEPDIR)/urng_fvoid.Plo ./$(DEPDIR)/urng_gsl.Plo \ + ./$(DEPDIR)/urng_gslqrng.Plo ./$(DEPDIR)/urng_prng.Plo \ + ./$(DEPDIR)/urng_randomshift.Plo \ + ./$(DEPDIR)/urng_rngstreams.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libuniform_la_SOURCES) +DIST_SOURCES = $(libuniform_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(includedir)" +HEADERS = $(include_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ +UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ +UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ +UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_valgrind = @have_valgrind@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libuniform.la +libuniform_la_SOURCES = \ + urng_builtin.c urng_builtin.h mrg31k3p.c fish.c mstd.c \ + urng_fvoid.c urng_fvoid.h \ + urng_gsl.c urng_gsl.h \ + urng_gslqrng.c urng_gslqrng.h \ + urng_prng.c urng_prng.h \ + urng_randomshift.c urng_randomshift.h \ + urng_rngstreams.c urng_rngstreams.h + +URNG_HEADER_FILES = \ + unuran_urng_gsl.h \ + unuran_urng_prng.h \ + unuran_urng_rngstreams.h + +include_HEADERS = $(URNG_HEADER_FILES) + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in \ + $(URNG_HEADER_FILES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/uniform/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/uniform/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libuniform.la: $(libuniform_la_OBJECTS) $(libuniform_la_DEPENDENCIES) $(EXTRA_libuniform_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libuniform_la_OBJECTS) $(libuniform_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fish.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mrg31k3p.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mstd.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_builtin.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_fvoid.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_gsl.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_gslqrng.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_prng.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_randomshift.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_rngstreams.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/fish.Plo + -rm -f ./$(DEPDIR)/mrg31k3p.Plo + -rm -f ./$(DEPDIR)/mstd.Plo + -rm -f ./$(DEPDIR)/urng_builtin.Plo + -rm -f ./$(DEPDIR)/urng_fvoid.Plo + -rm -f ./$(DEPDIR)/urng_gsl.Plo + -rm -f ./$(DEPDIR)/urng_gslqrng.Plo + -rm -f ./$(DEPDIR)/urng_prng.Plo + -rm -f ./$(DEPDIR)/urng_randomshift.Plo + -rm -f ./$(DEPDIR)/urng_rngstreams.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includeHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/fish.Plo + -rm -f ./$(DEPDIR)/mrg31k3p.Plo + -rm -f ./$(DEPDIR)/mstd.Plo + -rm -f ./$(DEPDIR)/urng_builtin.Plo + -rm -f ./$(DEPDIR)/urng_fvoid.Plo + -rm -f ./$(DEPDIR)/urng_gsl.Plo + -rm -f ./$(DEPDIR)/urng_gslqrng.Plo + -rm -f ./$(DEPDIR)/urng_prng.Plo + -rm -f ./$(DEPDIR)/urng_randomshift.Plo + -rm -f ./$(DEPDIR)/urng_rngstreams.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includeHEADERS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-includeHEADERS install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-includeHEADERS + +.PRECIOUS: Makefile + + +# make header files for installation +unuran_urng_gsl.h: urng_gsl.h urng_gslqrng.h + $(top_srcdir)/scripts/make_urng_header.pl urng_gsl.h urng_gslqrng.h > unuran_urng_gsl.h + +unuran_urng_prng.h: urng_prng.h + $(top_srcdir)/scripts/make_urng_header.pl urng_prng.h > unuran_urng_prng.h + +unuran_urng_rngstreams.h: urng_rngstreams.h + $(top_srcdir)/scripts/make_urng_header.pl urng_rngstreams.h > unuran_urng_rngstreams.h + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/uniform/fish.c b/vendor/unuran-1.11.0/src/uniform/fish.c new file mode 100644 index 0000000..5d02ea3 --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/fish.c @@ -0,0 +1,110 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: fish.c * + * * + * PURPOSE: * + * uniform random number generator provided by UNU.RAN * + * random number generators inside UNU.RAN. * + * * + * DESCRIPTION: * + * Linear congruential generator with * + * m = 2^31-1, a = 742938285, c = 0. * + * * + * WARNING: * + * Not state-of-the-art. SHOULD NOT BE USED ANY MORE. * + * In UNU.RAN only as auxilliary second stream. * + * Should be replaced in future releases. * + * * + * REFERENCE: * + * Fishman G.S., Moore L.R. (1986): An exhaustive analysis of * + * multiplicative congruential number generators with modulus 2^31-1, * + * SIAM Journal Sci. Stat. Comput., 24-45. * + * * + * Copyright for generator code by Ernst Stadlober. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#include +#include "urng_builtin.h" +/*---------------------------------------------------------------------------*/ + +/* seed (must not be 0!) */ +#define SEED (12345L) + +/* status variable */ +static unsigned long x = SEED; +static unsigned long x_start = SEED; /* seed of last stream */ + +/*---------------------------------------------------------------------------*/ + +double +unur_urng_fish (void *dummy ATTRIBUTE__UNUSED) +{ + +# define A 742938285 +# define AHI (A>>15) +# define ALO (A&0x7FFF) + + unsigned long xhi, xlo, mid; /* for intermediate results */ + + /* generator */ + xhi = x>>16; + xlo = x&0xFFFF; + mid = AHI*xlo + (ALO<<1)*xhi; + x = AHI*xhi + (mid>>16) + ALO*xlo; + if (x&0x80000000) x -= 0x7FFFFFFF; + x += ((mid&0xFFFF)<<15); + if (x&0x80000000) x -= 0x7FFFFFFF; + + return (x*4.656612875245797e-10); +} /* end of unur_urng_fish() */ + +/*---------------------------------------------------------------------------*/ + +void +unur_urng_fish_seed (void *dummy ATTRIBUTE__UNUSED, unsigned long seed) +{ + if (seed==0) { + _unur_error("URNG.fish",UNUR_ERR_GENERIC,"seed = 0"); + return; + } + + x_start = seed; + x = seed; + +} /* end of unur_urng_fish_seed() */ + +/*---------------------------------------------------------------------------*/ + +void +unur_urng_fish_reset (void *dummy ATTRIBUTE__UNUSED) +{ + x = x_start; +} /* end of unur_urng_fish_reset() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/uniform/mrg31k3p.c b/vendor/unuran-1.11.0/src/uniform/mrg31k3p.c new file mode 100644 index 0000000..75da94b --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/mrg31k3p.c @@ -0,0 +1,159 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: mrg31k3p.c * + * * + * PURPOSE: * + * uniform random number generator provided by UNU.RAN * + * random number generators inside UNU.RAN. * + * * + * DESCRIPTION: * + * Combined multiple recursive generator. * + * The two components of the generator are * + * * + * x_{1,k} = (2^{22} x_{1,k-2} + (2^7 +1)x_{1,k-3}) mod (2^{31}-1) * + * x_{2,k} = (2^{15} x_{2,k-1} + (2^{15} +1)x_{2,k-3} mod (2^{31}-21069) * + * * + * x_{1,k} and x_{2,k} are combined together and the result is * + * multiplied by 1/(2^{31}-1) to have a number between 0 and 1. * + * * + * REFERENCE: * + * L'Ecuyer, P. and R. Touzin (2000): Fast Combined Multiple Recursive * + * Generators with Multipliers of the Form a = 2^q2^r. * + * in: J.A. Jones, R.R. Barton, K. Kang, and P.A. Fishwick (eds.), * + * Proc. 2000 Winter Simulation Conference, 683-689. * + * * + * Copyright for generator code by Renee Touzin. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#include +#include "urng_builtin.h" +/*---------------------------------------------------------------------------*/ + +/* seed (must not be 0!) */ +#define SEED10 (12345L) +#define SEED11 (23456L) +#define SEED12 (34067L) +#define SEED20 (45678L) +#define SEED21 (56789L) +#define SEED22 (67890L) + +/* status variable */ +static unsigned long x10 = SEED10; +static unsigned long x11 = SEED11; +static unsigned long x12 = SEED12; +static unsigned long x20 = SEED20; +static unsigned long x21 = SEED21; +static unsigned long x22 = SEED22; + +/* seed of last stream */ +static unsigned long x10_start = SEED10; +static unsigned long x11_start = SEED11; +static unsigned long x12_start = SEED12; +static unsigned long x20_start = SEED20; +static unsigned long x21_start = SEED21; +static unsigned long x22_start = SEED22; + +/*---------------------------------------------------------------------------*/ + +double +unur_urng_MRG31k3p (void *dummy ATTRIBUTE__UNUSED) + /* Combined multiple recursive generator. */ + /* Copyright (c) 2002 Renee Touzin. */ +{ + +# define m1 2147483647 +# define m2 2147462579 +# define norm 4.656612873077393e-10 +# define mask11 511 +# define mask12 16777215 +# define mask20 65535 + + + register unsigned long yy1, yy2; /* For intermediate results */ + + /* First component */ + yy1 = ( (((x11 & mask11) << 22) + (x11 >> 9)) + + (((x12 & mask12) << 7) + (x12 >> 24)) ); + if (yy1 > m1) yy1 -= m1; + yy1 += x12; + if (yy1 > m1) yy1 -= m1; + x12 = x11; x11 = x10; x10 = yy1; + + /* Second component */ + yy1 = ((x20 & mask20) << 15) + 21069 * (x20 >> 16); + if (yy1 > m2) yy1 -= m2; + yy2 = ((x22 & mask20) << 15) + 21069 * (x22 >> 16); + if (yy2 > m2) yy2 -= m2; + yy2 += x22; + if (yy2 > m2) yy2 -= m2; + yy2 += yy1; + if (yy2 > m2) yy2 -= m2; + x22 = x21; x21 = x20; x20 = yy2; + + /* Combination */ + if (x10 <= x20) + return ((x10 - x20 + m1) * norm); + else + return ((x10 - x20) * norm); + +} /* end of unur_urng_MRG31k3p() */ + +/*---------------------------------------------------------------------------*/ + +void +unur_urng_MRG31k3p_seed (void *dummy ATTRIBUTE__UNUSED, unsigned long seed) +{ + if (seed==0) { + _unur_error("URNG.mrg31k3p",UNUR_ERR_GENERIC,"seed = 0"); + return; + } + + /* the following is not really optimal */ + x10 = x10_start = seed; + x11 = x11_start = seed; + x12 = x12_start = seed; + x20 = x20_start = seed; + x21 = x21_start = seed; + x22 = x22_start = seed; +} /* end of unur_urng_MRG31k3p_seed() */ + +/*---------------------------------------------------------------------------*/ + +void +unur_urng_MRG31k3p_reset (void *dummy ATTRIBUTE__UNUSED) +{ + x10 = x10_start; + x11 = x11_start; + x12 = x12_start; + x20 = x20_start; + x21 = x21_start; + x22 = x22_start; +} /* end of unur_urng_MRG31k3p_reset() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/uniform/mstd.c b/vendor/unuran-1.11.0/src/uniform/mstd.c new file mode 100644 index 0000000..56129e9 --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/mstd.c @@ -0,0 +1,104 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: fish.c * + * * + * PURPOSE: * + * uniform random number generator provided by UNU.RAN * + * random number generators inside UNU.RAN. * + * * + * DESCRIPTION: * + * Linear congruential generator * + * x_(n+1) = 16807 * x_n mod (2^32 - 1) ["Minimal Standard"] * + * * + * WARNING: * + * Not state-of-the-art. SHOULD NOT BE USED ANY MORE. * + * In UNU.RAN only as auxilliary second stream. * + * Should be replaced in future releases. * + * * + * REFERENCE: * + * Park, S. K. and Miller, K. W. (1988): * + * Random number generators: good ones are hard to find, * + * Comm. ACM 31, 1192--1201. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#include +#include "urng_builtin.h" +/*---------------------------------------------------------------------------*/ + +/* seed (must not be 0!) */ +#define SEED (1804289L) + +/* status variable */ +static unsigned long x = SEED; +static unsigned long x_start = SEED; /* seed of last stream */ + +/*---------------------------------------------------------------------------*/ + +double +unur_urng_mstd (void *dummy ATTRIBUTE__UNUSED) +{ + +# define a 16807 /* multiplicator */ +# define m 2147483647 /* modulus */ +# define q 127773 /* m / a */ +# define r 2836 /* m % a */ + + int hi, lo, test; /* intermediate results */ + + hi = x / q; + lo = x % q; + test = a * lo - r * hi; + x = (test > 0 ) ? test : test + m; + return (x * 4.656612875245796924105750827e-10); + +} /* end of unur_urng_mstd() */ + +/*---------------------------------------------------------------------------*/ + +void +unur_urng_mstd_seed (void *dummy ATTRIBUTE__UNUSED, unsigned long seed) +{ + if (seed==0) { + _unur_error("URNG.mstd",UNUR_ERR_GENERIC,"seed = 0"); + return; + } + + x = x_start = seed; + +} /* end of unur_urng_mstd_seed() */ + +/*---------------------------------------------------------------------------*/ + +void +unur_urng_mstd_reset (void *dummy ATTRIBUTE__UNUSED) +{ + x = x_start; +} /* end of unur_urng_mstd_reset() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/uniform/unuran_urng_gsl.h b/vendor/unuran-1.11.0/src/uniform/unuran_urng_gsl.h new file mode 100644 index 0000000..da7d869 --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/unuran_urng_gsl.h @@ -0,0 +1,31 @@ +/*******************************************************************\ + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + ******************************************************************* + * Copyright (c) 2000-2023 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * +\*******************************************************************/ +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +#ifndef UNURAN_URNG_GSL_H_SEEN +#define UNURAN_URNG_GSL_H_SEEN + +#include +UNUR_URNG *unur_urng_gsl_new( const gsl_rng_type *urngtype ); +UNUR_URNG *unur_urng_gslptr_new( gsl_rng *urng ); + +#include +UNUR_URNG *unur_urng_gslqrng_new( const gsl_qrng_type *qrngtype, unsigned int dim ); +#endif /* UNURAN_URNG_GSL_H_SEEN */ +__END_DECLS diff --git a/vendor/unuran-1.11.0/src/uniform/unuran_urng_prng.h b/vendor/unuran-1.11.0/src/uniform/unuran_urng_prng.h new file mode 100644 index 0000000..5f524e9 --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/unuran_urng_prng.h @@ -0,0 +1,28 @@ +/*******************************************************************\ + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + ******************************************************************* + * Copyright (c) 2000-2023 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * +\*******************************************************************/ +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +#ifndef UNURAN_URNG_PRNG_H_SEEN +#define UNURAN_URNG_PRNG_H_SEEN + +#include +UNUR_URNG *unur_urng_prng_new( const char *prngstr ); +UNUR_URNG *unur_urng_prngptr_new( struct prng *urng ); +#endif /* UNURAN_URNG_PRNG_H_SEEN */ +__END_DECLS diff --git a/vendor/unuran-1.11.0/src/uniform/unuran_urng_rngstreams.h b/vendor/unuran-1.11.0/src/uniform/unuran_urng_rngstreams.h new file mode 100644 index 0000000..992a3ce --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/unuran_urng_rngstreams.h @@ -0,0 +1,28 @@ +/*******************************************************************\ + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + ******************************************************************* + * Copyright (c) 2000-2023 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * +\*******************************************************************/ +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +#ifndef UNURAN_URNG_RNGSTREAMS_H_SEEN +#define UNURAN_URNG_RNGSTREAMS_H_SEEN + +#include +UNUR_URNG *unur_urng_rngstream_new( const char *urngstr ); +UNUR_URNG *unur_urng_rngstreamptr_new( RngStream rngstream ); +#endif /* UNURAN_URNG_RNGSTREAMS_H_SEEN */ +__END_DECLS diff --git a/vendor/unuran-1.11.0/src/uniform/urng_builtin.c b/vendor/unuran-1.11.0/src/uniform/urng_builtin.c new file mode 100644 index 0000000..901e338 --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/urng_builtin.c @@ -0,0 +1,68 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: urng_builtin.c * + * * + * routines for default built-in uniform random number generators. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#include +#include +#include "urng_fvoid.h" +#include "urng_builtin.h" +/*---------------------------------------------------------------------------*/ + +UNUR_URNG *unur_urng_builtin( void ) + /*----------------------------------------------------------------------*/ + /* get new URNG object of FVOID. */ + /* */ + /* parameters: none */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng; + urng = unur_urng_fvoid_new(unur_urng_MRG31k3p, unur_urng_MRG31k3p_reset); + unur_urng_set_seed(urng, unur_urng_MRG31k3p_seed); + return urng; +} /* unur_urng_builtin() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG *unur_urng_builtin_aux( void ) + /*----------------------------------------------------------------------*/ + /* get new URNG object of FVOID. */ + /* */ + /* parameters: none */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng; + urng = unur_urng_fvoid_new(unur_urng_fish, unur_urng_fish_reset); + unur_urng_set_seed(urng, unur_urng_fish_seed); + return urng; +} /* end of unur_urng_builtin_aux() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/uniform/urng_builtin.h b/vendor/unuran-1.11.0/src/uniform/urng_builtin.h new file mode 100644 index 0000000..9afee30 --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/urng_builtin.h @@ -0,0 +1,74 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unur_uniform.h * + * * + * PURPOSE: * + * function prototypes for built-in uniform random number generators * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef URNG_BUILTIN_H_SEEN +#define URNG_BUILTIN_H_SEEN +/*---------------------------------------------------------------------------*/ + +/* Combined multiple recursive generator by Pierre L'Ecuyer and Renee Touzin */ +/* Copyright (c) 2002 Renee Touzin. */ + +double unur_urng_MRG31k3p (void *dummy); +void unur_urng_MRG31k3p_seed (void *dummy, unsigned long seed); +void unur_urng_MRG31k3p_reset (void *dummy); + +/* Linear congruential generator by Fishman and Moore */ +/* m = 2^31-1, a = 742938285, c = 0. */ + +double unur_urng_fish (void *dummy); +void unur_urng_fish_seed (void *dummy, unsigned long seed); +void unur_urng_fish_reset (void *dummy); + +/* Linear congruential generator "Minimal Standard" */ +/* m = 2^31-1, a = 16807, c = 0. */ + +double unur_urng_mstd (void *dummy); +void unur_urng_mstd_seed (void *dummy, unsigned long seed); +void unur_urng_mstd_reset (void *dummy); + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG *unur_urng_builtin( void ); +/* + Make object for the default builtin URNG. +*/ + +UNUR_URNG *unur_urng_builtin_aux( void ); +/* + Make object for the default builtin URNG. +*/ + +/*---------------------------------------------------------------------------*/ +#endif /* URNG_BUILTIN_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/uniform/urng_fvoid.c b/vendor/unuran-1.11.0/src/uniform/urng_fvoid.c new file mode 100644 index 0000000..1db8680 --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/urng_fvoid.c @@ -0,0 +1,61 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: urng_fvoid.c * + * * + * routines to get new URNG object with sampling routine of type FVOID: * + * double(*urng)(void), NULL) and global state variable. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#include +/*---------------------------------------------------------------------------*/ +#if defined(UNUR_URNG_UNURAN) +/*---------------------------------------------------------------------------*/ +#include +#include "urng_fvoid.h" +/*---------------------------------------------------------------------------*/ + +UNUR_URNG * +unur_urng_fvoid_new( double (*urand)(void *state), void (*reset)(void *state) ) + /*----------------------------------------------------------------------*/ + /* get new URNG object of type FVOID */ + /* */ + /* parameters: */ + /* urand ... pointer to uniform random number generator */ + /* reset ... pointer to reset function for URNG */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng = unur_urng_new( urand, NULL ); + unur_urng_set_reset( urng, reset ); + return urng; +} /* end of unur_urng_fvoid_new() */ + +/*---------------------------------------------------------------------------*/ +#endif /* #if defined(UNUR_URNG_UNURAN) */ +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/uniform/urng_fvoid.h b/vendor/unuran-1.11.0/src/uniform/urng_fvoid.h new file mode 100644 index 0000000..ad42744 --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/urng_fvoid.h @@ -0,0 +1,107 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: urng_fvoid.h * + * * + * PURPOSE: * + * Function prototypes for using uniform of type FVOID * + * (i.e. routine without an argment: double uniform(void) * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef URNG_FVOID_H_SEEN +#define URNG_FVOID_H_SEEN +/*---------------------------------------------------------------------------*/ + +/* + =NODE URNG-FVOID Simple interface for uniform random number generators + + =UP URNG [10] + + =DESCRIPTION + Simple interface for URNGs of type @code{double uniform(void *state)}. + + UNU.RAN contains some build-in URNGs of this type: + @table @code + @item unur_urng_MRG31k3p + Combined multiple recursive generator by Pierre L'Ecuyer and + Renee Touzin. + @item unur_urng_fish + Linear congruential generator by Fishman and Moore. + @item unur_urng_mstd + Linear congruential generator "Minimal Standard" by Park and Miller. + @end table + + Notice, however, that these generators are provided as a + fallback for the case that no state-of-the-art uniform random + number generators (e.g. @pxref{URNG-RNGSTREAM,Pierre L'Ecuyer's + @file{Rngstream} library, Pierre L'Ecuyer's @file{Rngstream} + library}) are used. + + =HOWTOUSE + Create an URNG object using unur_urng_fvoid_new(). + By this call a pointer to the sampling routine and (optional) a + pointer to a reset routine are copied into the URNG object. + Other functions, like seeding the URNG, switching to antithetic + random number, or jumping to next substream, can be added to the + URNG object by the respective calls, e.g. by + unur_urng_set_seed(). + + The following routines are supported for URNG objects of this + type: + + @itemize @minus + @item unur_urng_sample() + @item unur_urng_sample_array() + @item unur_urng_seed() [optional] + @item unur_urng_reset() [optional] + @item unur_urng_free() + @end itemize + + =END +*/ + +/*---------------------------------------------------------------------------*/ + +/* =ROUTINES */ + +UNUR_URNG *unur_urng_fvoid_new( double (*urand)(void *state), void (*reset)(void *state) ); +/* + Make a URNG object for a generator that consists of a single + function call @var{urand}. + + If there is no @var{reset} function use NULL for the second argument. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ +#endif /* URNG_FVOID_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/uniform/urng_gsl.c b/vendor/unuran-1.11.0/src/uniform/urng_gsl.c new file mode 100644 index 0000000..0a999d8 --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/urng_gsl.c @@ -0,0 +1,84 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: urng_gsl.c * + * * + * routines to get new URNG object with sampling routine of type GSL. * + * GSL (GNU Scientific Library), see http://www.gnu.org/software/gsl/. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#include +/*---------------------------------------------------------------------------*/ +#if defined(UNURAN_HAS_GSL) && defined(UNUR_URNG_UNURAN) +/*---------------------------------------------------------------------------*/ +#include +#include "urng_gsl.h" +/*---------------------------------------------------------------------------*/ + +UNUR_URNG * +unur_urng_gslptr_new( gsl_rng *gsl ) + /*----------------------------------------------------------------------*/ + /* get new URNG object of type GSL. */ + /* */ + /* parameters: */ + /* gsl ... pointer to generator structure */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng; + + /* check argument */ + if (gsl == NULL) { + _unur_error("URNG",UNUR_ERR_NULL,"Cannot create GSL object"); + return NULL; + } + + urng = unur_urng_new( (double(*)(void*)) gsl_rng_uniform_pos, gsl ); + unur_urng_set_delete(urng, (void(*)(void*)) gsl_rng_free); + unur_urng_set_seed(urng, (void(*)(void*,unsigned long)) gsl_rng_set); + return urng; +} /* end of unur_urng_gslptr_new() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG * +unur_urng_gsl_new( const gsl_rng_type *urngtype ) + /*----------------------------------------------------------------------*/ + /* get new URNG object of type GSL. */ + /* */ + /* parameters: */ + /* urngtype ... type of generator */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng = unur_urng_gslptr_new(gsl_rng_alloc(urngtype)); + unur_urng_seed(urng,gsl_rng_default_seed); + return urng; +} /* end of unur_urng_gsl_new() */ + +/*---------------------------------------------------------------------------*/ +#endif /* defined(UNURAN_HAS_GSL) && defined(UNUR_URNG_UNURAN) */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/uniform/urng_gsl.h b/vendor/unuran-1.11.0/src/uniform/urng_gsl.h new file mode 100644 index 0000000..3f60621 --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/urng_gsl.h @@ -0,0 +1,125 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: urng_gsl.h * + * * + * PURPOSE: * + * Function prototypes for using URNG of type GSL: * + * uniform random number from GSL (GNU Scientific Library), * + * see http://www.gnu.org/software/gsl/. * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef URNG_GSL_H_SEEN +#define URNG_GSL_H_SEEN +/*---------------------------------------------------------------------------*/ +#include +/*---------------------------------------------------------------------------*/ + +/* + =NODE URNG-GSL Interface to GSL uniform random number generators + + =UP URNG [20] + + =DESCRIPTION + Interface to the uniform random number generators from the + GNU Scientific Library (GSL). Documentation and source code + of this library is available from + @uref{http://www.gnu.org/software/gsl/}. + + The interface to the GSL must be compiled into UNU.RAN using the + configure flag @code{--with-urng-gsl}. + Notice that the GSL has to be installed before running + @code{./configure}. + + =HOWTOUSE + When using this interface @file{unuran_urng_gsl.h} must be included + in the corresponding C file, i.e., one must add the line + + @example + #include + @end example + + @noindent + Moreover, one must not forget to link the executable against + @file{libgsl}. + + The following routines are supported for URNG objects of + type GSL: + + @itemize @minus + @item unur_urng_sample() + @item unur_urng_sample_array() + @item unur_urng_seed() + @item unur_urng_reset() + @item unur_urng_free() + @end itemize + + @smallexample + @include ref_example_gsl.texi + @end smallexample + + =END + +*/ + +/*---------------------------------------------------------------------------*/ + +/* =ROUTINES */ + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG *unur_urng_gsl_new( const gsl_rng_type *urngtype ); +/* + Make object for URNGs from the @file{GSL} (GNU Scientific Library). + @var{urngtype} is the type of the chosen generator as described in the + GSL manual (see Section Random Number Generation). This library is + available from @uref{http://www.gnu.org/software/gsl/}. +*/ + +UNUR_URNG *unur_urng_gslptr_new( gsl_rng *urng ); +/* + Similar to unur_urng_gsl_new() but it uses a pointer to a + generator object as returned by @code{gsl_rng_alloc(rng_type)}; + see @file{GSL} manual for details. + + @emph{Notice}: There is a subtle but important difference between + these two calls. When a generator object is created by a + unur_urng_gsl_new() call, then resetting of the generator works. + When a generator object is created by a unur_urng_gslptr_new() + call, then resetting only works after a + @code{unur_urng_seed(urng,myseed)} call. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ +#endif /* URNG_GSL_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/uniform/urng_gslqrng.c b/vendor/unuran-1.11.0/src/uniform/urng_gslqrng.c new file mode 100644 index 0000000..c9096fd --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/urng_gslqrng.c @@ -0,0 +1,261 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: urng_gslqmc.c * + * * + * routines to get new URNG object (of type GSL-QRNG) to use * + * quasi-random sequences from the GSL (GNU Scientific Library), * + * see http://www.gnu.org/software/gsl/. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#include +/*---------------------------------------------------------------------------*/ +#if defined(UNURAN_HAS_GSL) && defined(UNUR_URNG_UNURAN) +/*---------------------------------------------------------------------------*/ +#include +#include "urng_gslqrng.h" +/*---------------------------------------------------------------------------*/ + +/* structure for storing QRNG */ +struct unur_urng_gslqrng { + gsl_qrng *qrng; /* pointer to GSL QRNG obejct */ + double *X; /* working array for storing points */ + unsigned dim; /* dimension for QRNG */ + unsigned n; /* current coordinate */ +}; + +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* We need wrapper functions for the GSL API. */ + +static UNUR_URNG *_unur_urng_gslqrngptr_new( gsl_qrng *qrngptr, unsigned int dim ); +/*---------------------------------------------------------------------------*/ +/* Get new URNG object of type GSL-QRNG. */ +/*---------------------------------------------------------------------------*/ + +static double _unur_urng_gslqrng_sample( struct unur_urng_gslqrng *qrng ); +/*---------------------------------------------------------------------------*/ +/* Sample next coordinate of random point. */ +/* Skip to first coordinate of next point after last coordinate. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_urng_gslqrng_sample_array( struct unur_urng_gslqrng *qrng, double *X, unsigned dim ); +/*---------------------------------------------------------------------------*/ +/* Sample random point and store in X. use only the first dim coordinates */ +/* if dim is less than the dimension of the generated points. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_urng_gslqrng_free( struct unur_urng_gslqrng *qrng ); +/*---------------------------------------------------------------------------*/ +/* Free generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_urng_gslqrng_reset( struct unur_urng_gslqrng *qrng ); +/*---------------------------------------------------------------------------*/ +/* Reset generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_urng_gslqrng_nextpoint( struct unur_urng_gslqrng *qrng ); +/*---------------------------------------------------------------------------*/ +/* Skip to first coordinate of next point. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ + +double +_unur_urng_gslqrng_sample( struct unur_urng_gslqrng *qrng ) + /*----------------------------------------------------------------------*/ + /* Sample next coordinate of random point. */ + /* Skip to first coordinate of next point after last coordinate. */ + /* */ + /* parameters: */ + /* qrng ... pointer to URNG object */ + /* */ + /* return: */ + /* next coordinate */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + int n = qrng->n; + + if (n==0) + /* first coordinate --> get new point */ + gsl_qrng_get( qrng->qrng, qrng->X ); + + /* increment counter for coordinate */ + qrng->n = (n+1) % qrng->dim; + + /* return result */ + return qrng->X[n]; +} /* end of _unur_urng_gslqrng_sample() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_urng_gslqrng_sample_array( struct unur_urng_gslqrng *qrng, double *X, unsigned dim ) + /*----------------------------------------------------------------------*/ + /* Sample random point and store in X. use only the first dim coordin. */ + /* if dim is less than the dimension of the generated points. */ + /* Return number of entries filled into array X. */ + /* */ + /* parameters: */ + /* qrng ... pointer to URNG object */ + /* X ... pointer to array of length dim */ + /* dim ... (maximal) number of entries in X to be set */ + /* */ + /* return: */ + /* number of uniform random numbers filled into array */ + /* */ + /* error: */ + /* return 0 */ + /*----------------------------------------------------------------------*/ +{ + if (dim < qrng->dim) { + /* size of array X to small --> use working array */ + gsl_qrng_get( qrng->qrng, qrng->X ); + memcpy( X, qrng->X, dim*sizeof(double) ); + return dim; + } + else { + gsl_qrng_get( qrng->qrng, X ); + return qrng->dim; + } +} /* end of _unur_urng_gslqrng_sample_array() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_urng_gslqrng_free( struct unur_urng_gslqrng *qrng ) + /*----------------------------------------------------------------------*/ + /* Free URNG object. */ + /* */ + /* parameters: */ + /* qrng ... pointer to URNG object */ + /*----------------------------------------------------------------------*/ +{ + if (qrng) { + gsl_qrng_free( qrng->qrng ); + free( qrng->X ); + free (qrng); + } +} /* end of _unur_urng_gslqrng_free() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_urng_gslqrng_reset( struct unur_urng_gslqrng *qrng ) + /*----------------------------------------------------------------------*/ + /* Reset URNG object. */ + /* */ + /* parameters: */ + /* qrng ... pointer to URNG object */ + /*----------------------------------------------------------------------*/ +{ + gsl_qrng_init( qrng->qrng ); + qrng->n = 0u; +} /* end of _unur_urng_gslqrng_reset() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_urng_gslqrng_nextpoint( struct unur_urng_gslqrng *qrng ) + /*----------------------------------------------------------------------*/ + /* Skip to first coordinate of next point. */ + /* */ + /* parameters: */ + /* qrng ... pointer to URNG object */ + /*----------------------------------------------------------------------*/ +{ + qrng->n = 0u; +} /* end of _unur_urng_gslqrng_nextpoint() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG * +_unur_urng_gslqrngptr_new( gsl_qrng *qrngptr, unsigned int dim ) + /*----------------------------------------------------------------------*/ + /* get new URNG object of type GSL-QRNG */ + /* */ + /* parameters: */ + /* qrngptr ... pointer to generator structure */ + /* dim ... dimension of point sets */ + /*----------------------------------------------------------------------*/ +{ + struct unur_urng_gslqrng *qrng; + UNUR_URNG *urng; + + /* check argument */ + if (qrngptr == NULL) { + _unur_error("URNG",UNUR_ERR_NULL,"Cannot create GSL-QRNG object"); + return NULL; + } + + /* make structure to store QRNG object */ + qrng = _unur_xmalloc( sizeof(struct unur_urng_gslqrng) ); + qrng->X = _unur_xmalloc( dim * sizeof(double) ); + qrng->qrng = qrngptr; + qrng->dim = dim; + qrng->n = 0u; + + /* make UNURAN_URNG object */ + urng = unur_urng_new ( (double(*)(void*)) _unur_urng_gslqrng_sample, qrng ); + unur_urng_set_sample_array (urng, (unsigned int(*)(void*,double*,int)) _unur_urng_gslqrng_sample_array); + unur_urng_set_delete (urng, (void(*)(void*)) _unur_urng_gslqrng_free); + unur_urng_set_reset (urng, (void(*)(void*)) _unur_urng_gslqrng_reset); + unur_urng_set_sync (urng, (void(*)(void*)) _unur_urng_gslqrng_nextpoint); + + return urng; +} /* end of _unur_urng_gslqrngptr_new() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG * +unur_urng_gslqrng_new( const gsl_qrng_type *qrngtype, unsigned int dim ) + /*----------------------------------------------------------------------*/ + /* get new URNG object of type GSL-QRNG */ + /* */ + /* parameters: */ + /* qrngtype ... type of generator */ + /* dim ... dimension of point sets */ + /*----------------------------------------------------------------------*/ +{ + /* check argument */ + if (dim == 0u) { + _unur_error("URNG",UNUR_ERR_GENERIC,"Cannot create GSL-QRNG object for dimension 0"); + return NULL; + } + + return _unur_urng_gslqrngptr_new( gsl_qrng_alloc(qrngtype, dim), dim ); +} /* end of unur_urng_gslqrng_new() */ + +/*---------------------------------------------------------------------------*/ +#endif /* defined(UNURAN_HAS_GSL) && defined(UNUR_URNG_UNURAN) */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/uniform/urng_gslqrng.h b/vendor/unuran-1.11.0/src/uniform/urng_gslqrng.h new file mode 100644 index 0000000..fbd634a --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/urng_gslqrng.h @@ -0,0 +1,112 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: urng_gslqmc.h * + * * + * PURPOSE: * + * Function prototypes for using URNG of type GSL-: * + * Function prototypes for using uniform of type GSL: * + * uniform random number from GSL (GNU Scientific Library), * + * see http://www.gnu.org/software/gsl/. * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef URNG_GSLQRNG_H_SEEN +#define URNG_GSLQRNG_H_SEEN +/*---------------------------------------------------------------------------*/ +#include +/*---------------------------------------------------------------------------*/ + +/* + =NODE URNG-GSLQRNG Interface to GSL generators for quasi-random points + + =UP URNG [30] + + =DESCRIPTION + Interface to the generators for quasi-random points (also called + low discrepancy point sets) from the GNU Scientific Library (GSL). + Documentation and source code of this library is available from + @uref{http://www.gnu.org/software/gsl/}. + + The interface to the GSL must be compiled into UNU.RAN using the + configure flag @code{--with-urng-gsl}. + Notice that the GSL has to be installed before running + @code{./configure}. + + =HOWTOUSE + When using this interface @file{unuran_urng_gsl.h} must be included + in the corresponding C file, i.e., one must add the line + + @example + #include + @end example + + @noindent + Moreover, one must not forget to link the executable against + @file{libgsl}. + + The following routines are supported for URNG objects of this + type: + + @itemize @minus + @item unur_urng_sample() + @item unur_urng_sample_array() + @item unur_urng_reset() + @item unur_urng_sync() + @item unur_urng_free() + @end itemize + + unur_urng_sync() is used to jump to the first coordinate of + the next point generated by the generator. + + =END + +*/ + +/*---------------------------------------------------------------------------*/ + +/* =ROUTINES */ + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG *unur_urng_gslqrng_new( const gsl_qrng_type *qrngtype, unsigned int dim ); +/* + Make object for quasi-random point generators for dimension + @var{dim} from the @file{GSL} (GNU Scientific Library). + @var{qrngtype} is the type of the chosen generator as described in + the GSL manual (see section Quasi-Random Sequences). + This library is available from @uref{http://www.gnu.org/software/gsl/}. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ +#endif /* URNG_GSLQRNG_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/uniform/urng_prng.c b/vendor/unuran-1.11.0/src/uniform/urng_prng.c new file mode 100644 index 0000000..6fc8230 --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/urng_prng.c @@ -0,0 +1,92 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: urng_prng.c * + * * + * routines to get new URNG object with sampling routine of type PRNG. * + * (Lendl's prng package, see http://statmath.wu.ac.at/prng/ or * + * http://random.mat.sbg.ac.at/. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#include +/*---------------------------------------------------------------------------*/ +#if defined(UNURAN_HAS_PRNG) && defined(UNUR_URNG_UNURAN) +/*---------------------------------------------------------------------------*/ +#include +#include "urng_prng.h" +/*---------------------------------------------------------------------------*/ + +UNUR_URNG * +unur_urng_prngptr_new( struct prng *prng ) + /*----------------------------------------------------------------------*/ + /* get new URNG object of type PRNG. */ + /* */ + /* parameters: */ + /* prng ... pointer to generator structure */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng; + + if (prng==NULL) { + _unur_error("URNG",UNUR_ERR_NULL,"Cannot create PRNG object"); + return NULL; + } + + urng = unur_urng_new( (double(*)(void*)) prng->get_next, prng ); + unur_urng_set_reset(urng, (void(*)(void*)) prng->reset); + unur_urng_set_delete(urng, (void(*)(void*)) prng->destroy); + + if (prng_can_seed(prng)) { + unur_urng_set_seed(urng, (void(*)(void*,unsigned long))prng->seed); + } + + return urng; +} /* end of unur_urng_prngptr_new() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG * +unur_urng_prng_new( const char *prngstr ) + /*----------------------------------------------------------------------*/ + /* get new URNG object of type PRNG. */ + /* */ + /* parameters: */ + /* prngstr ... string that describes generator */ + /*----------------------------------------------------------------------*/ +{ + struct prng *prng = prng_new(prngstr); + if (prng==NULL) { + _unur_error("URNG",UNUR_ERR_NULL,"Cannot create PRNG object for given string"); + return NULL; + } + return unur_urng_prngptr_new (prng); +} /* end of unur_urng_prng_new() */ + +/*---------------------------------------------------------------------------*/ +#endif /* defined(UNURAN_HAS_PRNG) && defined(UNUR_URNG_UNURAN) */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/uniform/urng_prng.h b/vendor/unuran-1.11.0/src/uniform/urng_prng.h new file mode 100644 index 0000000..7b3bc64 --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/urng_prng.h @@ -0,0 +1,135 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: urng_prng.h * + * * + * PURPOSE: * + * Function prototypes for using uniform of type PRNG: * + * Otmar Lendl's prng package, * + * see http://statmath.wu.ac.at/prng/ or * + * http://random.mat.sbg.ac.at/. * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef URNG_PRNG_H_SEEN +#define URNG_PRNG_H_SEEN +/*---------------------------------------------------------------------------*/ +#include +/*---------------------------------------------------------------------------*/ + +/* + =NODE URNG-PRNG Interface to Otmar Lendl's pseudo-random number generators + + =UP URNG [40] + + =DESCRIPTION + URNGs from Otmar Lendl's @code{prng} library. It provides a very + flexible way to sample form arbitrary URNGs by means of an object + oriented programing paradigma. Similarly to the UNU.RAN library + independent generator objects can be build and used. + + This library has been developed by the pLab group at the university + of Salzburg (Austria, EU) and implemented by Otmar Lendl. + It is available from + @uref{http://statmath.wu.ac.at/prng/} + or from the pLab site at + @uref{http://random.mat.sbg.ac.at/}. + + The interface to the PRNG library must be compiled into UNU.RAN using the + configure flag @code{--with-urng-prng}. + Notice that the PRNG library has to be installed before running + @code{./configure}. + + =HOWTOUSE + When using this interface @file{unuran_urng_prng.h} must be included + in the corresponding C file, i.e., one must add the line + + @example + #include + @end example + + @noindent + Moreover, one must not forget to link the executable against + @file{libprng}. + + The following routines are supported for URNG objects of + type PRNG: + + @itemize @minus + @item unur_urng_sample() + @item unur_urng_sample_array() + @item unur_urng_seed() + (availability depends on chosen PRNG generator!) + @item unur_urng_reset() + @item unur_urng_free() + @end itemize + + =END + +*/ + +/*---------------------------------------------------------------------------*/ + +/* =ROUTINES */ + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG *unur_urng_prng_new( const char *prngstr ); +/* + Make object for URNGs from Otmar Lendl's @file{prng} package. + @var{prngstr} is a string that contains the necessary information + to create a uniform random number generator. For the format of this + string see the @file{prng} user manual. + + The @file{prng} library provides a very flexible way to sample form + arbitrary URNGs by means of an object oriented programing + paradigma. Similarly to the UNU.RAN library independent generator + objects can be build and used. The library has been developed + and implemented by Otmar Lendl as member of the pLab group at the + university of Salzburg (Austria, EU). + + It is available via anonymous ftp from + @uref{http://statmath.wu.ac.at/prng/} + or from the pLab site at + @uref{http://random.mat.sbg.ac.at/}. +*/ + +UNUR_URNG *unur_urng_prngptr_new( struct prng *urng ); +/* + Similar to unur_urng_prng_new() but it uses a pointer to a + generator object as returned by @code{prng_new(prngstr)}; + see @file{prng} manual for details. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ +#endif /* URNG_PRNG_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/uniform/urng_randomshift.c b/vendor/unuran-1.11.0/src/uniform/urng_randomshift.c new file mode 100644 index 0000000..5913b5f --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/urng_randomshift.c @@ -0,0 +1,291 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: urng_randomshift.c * + * * + * Meta uniform random number generator for Randomized Quasi-Monte Carlo * + * integration. * + * * + * (1) Sample and store a random vector S. * + * (2) Run a QMC simulation where S is added to each point of the * + * quasi-random point (mod 1). * + * (3) Repeat steps (1) and (2). * + * (4) Return sample mean and sample variance. * + * * + ***************************************************************************** + * * + * References: * + * * + * [1] Cranley, R. and Patterson T.N.L. (1976), * + * Randomization of number theoretic methods for multiple integration. * + * SIAM J. Num. Anal. 13, 904-914. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#include +/*---------------------------------------------------------------------------*/ +#if defined(UNUR_URNG_UNURAN) +/*---------------------------------------------------------------------------*/ +#include +#include "urng_randomshift.h" +/*---------------------------------------------------------------------------*/ + +/* structure for storing generators */ +struct unur_urng_randomshift { + UNUR_URNG *qrng; /* generator for point set */ + UNUR_URNG *srng; /* generator for shift vector */ + double *shift; /* shift vector */ + double *X; /* working array for storing points */ + int dim; /* dimension for QRNG */ + int n; /* current coordinate */ +}; + +/*---------------------------------------------------------------------------*/ + +static double _unur_urng_randomshift_sample( struct unur_urng_randomshift *rs ); +/*---------------------------------------------------------------------------*/ +/* Sample next coordinate of random point. */ +/* Skip to first coordinate of next point after last coordinate. */ +/*---------------------------------------------------------------------------*/ + +static int _unur_urng_randomshift_sample_array( struct unur_urng_randomshift *rs, double *X, int dim ); +/*---------------------------------------------------------------------------*/ +/* Sample random point and store in X. use only the first dim coordinates */ +/* if dim is less than the dimension of the generated points. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_urng_randomshift_free( struct unur_urng_randomshift *rs ); +/*---------------------------------------------------------------------------*/ +/* Free generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_urng_randomshift_reset( struct unur_urng_randomshift *rs ); +/*---------------------------------------------------------------------------*/ +/* Reset generator object. */ +/*---------------------------------------------------------------------------*/ + +static void _unur_urng_randomshift_nextpoint( struct unur_urng_randomshift *rs ); +/*---------------------------------------------------------------------------*/ +/* Skip to first coordinate of next point. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ + +double +_unur_urng_randomshift_sample( struct unur_urng_randomshift *rs ) + /*----------------------------------------------------------------------*/ + /* Sample next coordinate of random point. */ + /* Skip to first coordinate of next point after last coordinate. */ + /* */ + /* parameters: */ + /* rs ... pointer to URNG object */ + /* */ + /* return: */ + /* next coordinate */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + int i; + int n = rs->n; + double *X = rs->X; + + if (n==0) { + /* first coordinate --> get new point */ + unur_urng_sample_array(rs->qrng,X,rs->dim); + /* make shift */ + for (i=0; idim; i++) { + X[i] += rs->shift[i]; + if (X[i] >= 1.) X[i] -= 1.; + if (X[i] < 0.) X[i] += 1.; + } + } + + /* increment counter for coordinate */ + rs->n = (n+1) % rs->dim; + + /* return result */ + return X[n]; + +} /* end of _unur_urng_randomshift_sample() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_urng_randomshift_sample_array( struct unur_urng_randomshift *rs, double *X, int dim ) + /*----------------------------------------------------------------------*/ + /* Sample random point and store in X. use only the first dim coordin. */ + /* if dim is less than the dimension of the generated points. */ + /* Return number of entries filled into array X. */ + /* */ + /* parameters: */ + /* rs ... pointer to URNG object */ + /* X ... pointer to array of length dim */ + /* dim ... (maximal) number of entries in X to be set */ + /* */ + /* return: */ + /* number of uniform random numbers filled into array */ + /* */ + /* error: */ + /* return 0 */ + /*----------------------------------------------------------------------*/ +{ + int i; + + if (dim > rs->dim) dim = rs->dim; + + if (dim == rs->dim) { + unur_urng_sample_array(rs->qrng,X,dim); } + else { /* dim < rs->dim */ + /* size of array X to small --> use working array */ + unur_urng_sample_array(rs->qrng,rs->X,dim); + memcpy( X, rs->X, dim*sizeof(double) ); + } + + /* make shift */ + for (i=0; ishift[i]; + if (X[i] >= 1.) X[i] -= 1.; + if (X[i] < 0.) X[i] += 1.; + } + + return dim; +} /* end of _unur_urng_randomshift_sample_array() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_urng_randomshift_free( struct unur_urng_randomshift *rs ) + /*----------------------------------------------------------------------*/ + /* Free URNG object. */ + /* */ + /* parameters: */ + /* rs ... pointer to URNG object */ + /*----------------------------------------------------------------------*/ +{ + if (rs) { + free( rs->shift ); + free( rs->X ); + free( rs ); + } +} /* end of _unur_urng_randomshift_free() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_urng_randomshift_reset( struct unur_urng_randomshift *rs ) + /*----------------------------------------------------------------------*/ + /* Reset URNG object. */ + /* */ + /* parameters: */ + /* rs ... pointer to URNG object */ + /*----------------------------------------------------------------------*/ +{ + unur_urng_reset( rs->qrng ); + unur_urng_reset( rs->srng ); + rs->n = 0u; +} /* end of _unur_urng_randomshift_reset() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_urng_randomshift_nextpoint( struct unur_urng_randomshift *rs ) + /*----------------------------------------------------------------------*/ + /* Skip to first coordinate of next point. */ + /* */ + /* parameters: */ + /* rs ... pointer to URNG object */ + /*----------------------------------------------------------------------*/ +{ + rs->n = 0u; +} /* end of _unur_urng_randomshift_nextpoint() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG * +unur_urng_randomshift_new( UNUR_URNG *qrng, UNUR_URNG *srng, int dim ) + /*----------------------------------------------------------------------*/ + /* get new URNG object of type GSL-QRNG */ + /* */ + /* parameters: */ + /* qrng ... generator for point set */ + /* srng ... generator for random shifts */ + /* dim ... dimension of point sets */ + /*----------------------------------------------------------------------*/ +{ + struct unur_urng_randomshift *rs; + UNUR_URNG *urng; + + /* check argument */ + _unur_check_NULL( "URNG", qrng, NULL ); COOKIE_CHECK(qrng,CK_URNG,NULL); + _unur_check_NULL( "URNG", srng, NULL ); COOKIE_CHECK(srng,CK_URNG,NULL); + + /* make structure to store random shift object */ + rs = _unur_xmalloc( sizeof(struct unur_urng_randomshift) ); + rs->shift = _unur_xmalloc( dim * sizeof(double) ); + rs->X = _unur_xmalloc( dim * sizeof(double) ); + rs->qrng = qrng; + rs->srng = srng; + rs->dim = dim; + rs->n = 0u; + + /* make UNURAN_URNG object */ + urng = unur_urng_new ( (double(*)(void*)) _unur_urng_randomshift_sample, rs ); + unur_urng_set_sample_array (urng, (unsigned int(*)(void*,double*,int)) _unur_urng_randomshift_sample_array); + unur_urng_set_delete (urng, (void(*)(void*)) _unur_urng_randomshift_free); + unur_urng_set_reset (urng, (void(*)(void*)) _unur_urng_randomshift_reset); + unur_urng_set_sync (urng, (void(*)(void*)) _unur_urng_randomshift_nextpoint); + + /* initialize random shift */ + unur_urng_sample_array(rs->srng,rs->shift,rs->dim); + + return urng; + +} /* end of unur_urng_randomshift_new() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_urng_randomshift_nextshift( UNUR_URNG *urng ) + /*----------------------------------------------------------------------*/ + /* Get the next (randomly chosen) vector for shifting the points set. */ + /* */ + /* parameters: */ + /* rs ... pointer to URNG object */ + /*----------------------------------------------------------------------*/ +{ + struct unur_urng_randomshift *rs = urng->state; + unur_urng_sample_array(rs->srng,rs->shift,rs->dim); + unur_urng_reset( rs->qrng ); + rs->n = 0u; + return UNUR_SUCCESS; +} /* end of unur_urng_randomshift_nextshift() */ + +/*---------------------------------------------------------------------------*/ +#endif /* #if defined(UNUR_URNG_UNURAN) */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/uniform/urng_randomshift.h b/vendor/unuran-1.11.0/src/uniform/urng_randomshift.h new file mode 100644 index 0000000..ad94def --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/urng_randomshift.h @@ -0,0 +1,131 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: urng_fvoid.h * + * * + * PURPOSE: * + * Function prototypes for meta uniform random number generator to * + * combine point set generator with random shifts. * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef URNG_RANDOMSHIFT_H_SEEN +#define URNG_RANDOMSHIFT_H_SEEN +/*---------------------------------------------------------------------------*/ + +/* + =NODE URNG-RANDOMSHIFT Combine point set generator with random shifts + + =UP URNG [90] + + =DESCRIPTION + Generators of type RANDOMSHIFT combine a point set generator with + generators to apply random shifts as proposed in + @unurbibref{CPa76}: + + @enumerate + @item + Sample and store a random vector S. + @item + Run a QMC simulation where S is added to each point of the + generated quasi-random point (mod 1). + @item + Repeat steps 1 and 2. + @end enumerate + + =HOWTOUSE + Create a URNG object for a point set generator and a URNG object + for a generator to create shift vectors at random. + The meta URNG object can then be created using + unur_urng_randomshift_new(). + Notice that only pointers to the two underlying URNG generator + objects are copied into the newly created meta generator. Thus + manipulating the meta URNG also changes the underlying URNGs + and vice versa. + + The following routines are supported for URNG objects of + type RANDOMSHIFT: + + @itemize @minus + @item unur_urng_sample() + @item unur_urng_sample_array() + @item unur_urng_reset() + @item unur_urng_sync() + @item unur_urng_randomshift_nextshift() + @item unur_urng_free() + @end itemize + + unur_urng_sync() is used to jump to the first coordinate of + the next point generated by the generator. + + unur_urng_randomshift_nextshift() allows to replace the shift + vector by another randomly chosen shift vector. + + @emph{Important:} unur_urng_sync() is only available if it is + if it is implemented for the underlying point set generator. + + @emph{Important:} unur_urng_reset() is only available if it is + available for both underlying generators. + + =END + +*/ + +/*---------------------------------------------------------------------------*/ + +/* =ROUTINES */ + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG *unur_urng_randomshift_new( UNUR_URNG *qrng, UNUR_URNG *srng, int dim ); +/* + Make object for URNG with randomly shifted point sets. + @var{qrng} is a generated that generates point sets of dimension @var{dim}. + @var{srng} is a generated that generates random numbers or vectors. + + @emph{Notice:} Only pointers to the respective objects @var{qrng} + and @var{srng} are copied into the created meta generator. Thus + manipulating the meta URNG also changes the underlying URNGs + and vice versa. +*/ + +int unur_urng_randomshift_nextshift( UNUR_URNG *urng ); +/* + Get the next (randomly chosen) vector for shifting the points set, and the + underlying point generator @var{qrng} is reset. +*/ + +/* + =END +*/ + +/*---------------------------------------------------------------------------*/ +#endif /* URNG_RANDOMSHIFT_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/uniform/urng_rngstreams.c b/vendor/unuran-1.11.0/src/uniform/urng_rngstreams.c new file mode 100644 index 0000000..f39930e --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/urng_rngstreams.c @@ -0,0 +1,108 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: urng_rngstreams.c * + * * + * routines to get new URNG object with sampling routine of type * + * RNGSTREAMSPRNG (Pierre L'Ecuyer's RNGSTREAMS package). * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#include +/*---------------------------------------------------------------------------*/ +#if defined(UNURAN_HAS_RNGSTREAM) && defined(UNUR_URNG_UNURAN) +/*---------------------------------------------------------------------------*/ +#include +#include "urng_rngstreams.h" +/*---------------------------------------------------------------------------*/ + +static void _unur_urng_rngstream_delete( RngStream rngstream ); +/* wrapper for destructor of rngstream object */ + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG * +unur_urng_rngstreamptr_new( RngStream rngstream ) + /*----------------------------------------------------------------------*/ + /* get new URNG object of type RNGSTREAMS. */ + /* */ + /* parameters: */ + /* rngstream ... pointer to generator structure */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng; + + /* check argument */ + if (rngstream == NULL) { + _unur_error("URNG",UNUR_ERR_NULL,"Cannot create RNGSTREAM object"); + return NULL; + } + + urng = unur_urng_new( (double(*)(void*)) RngStream_RandU01, rngstream ); + unur_urng_set_reset (urng, (void(*)(void*)) RngStream_ResetStartStream); + unur_urng_set_delete (urng, (void(*)(void*)) _unur_urng_rngstream_delete); + unur_urng_set_anti (urng, (void(*)(void*,int)) RngStream_SetAntithetic); + unur_urng_set_nextsub (urng, (void(*)(void*)) RngStream_ResetNextSubstream); + unur_urng_set_resetsub (urng, (void(*)(void*)) RngStream_ResetStartSubstream); + + /* There is only a function for seeding the RngStreams package, but no */ + /* function for seeding an individual random stream. */ + + return urng; +} /* end of unur_urng_rngstreamptr_new() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG * +unur_urng_rngstream_new( const char *urngstr ) + /*----------------------------------------------------------------------*/ + /* get new URNG object of type RNGSTREAMS. */ + /* */ + /* parameters: */ + /* prngstr ... string that describes generator */ + /*----------------------------------------------------------------------*/ +{ + return unur_urng_rngstreamptr_new(RngStream_CreateStream(urngstr)); +} /* end of unur_urng_prng_new() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_urng_rngstream_delete( RngStream rngstream ) + /*----------------------------------------------------------------------*/ + /* wrapper for destructor of rngstream object */ + /* */ + /* parameters: */ + /* rngstream ... pointer to generator structure */ + /*----------------------------------------------------------------------*/ +{ + RngStream_DeleteStream(&rngstream); +} /* end of _unur_urng_rngstream_delete() */ + +/*---------------------------------------------------------------------------*/ +#endif /* defined(UNURAN_HAS_RNGSTREAM) && defined(UNUR_URNG_UNURAN) */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/uniform/urng_rngstreams.h b/vendor/unuran-1.11.0/src/uniform/urng_rngstreams.h new file mode 100644 index 0000000..ec38224 --- /dev/null +++ b/vendor/unuran-1.11.0/src/uniform/urng_rngstreams.h @@ -0,0 +1,130 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: urng_fvoid.h * + * * + * PURPOSE: * + * Function prototypes for using uniform of type RNGSTREAMSPRNG: * + * Pierre L'Ecuyer's RNGSTREAMS package. * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef URNG_RNGSTREAMS_H_SEEN +#define URNG_RNGSTREAMS_H_SEEN +/*---------------------------------------------------------------------------*/ +#include +/*---------------------------------------------------------------------------*/ + +/* + =NODE URNG-RNGSTREAM Interface to L'Ecuyer's RNGSTREAM random number generators + + =UP URNG [50] + + =DESCRIPTION + URNGs from Pierre L'Ecuyer's @file{RngStream} library for multiple + independent streams of pseudo-random numbers. + This library provides multiple independent streams of + pseudo-random numbers which itselves can be splitted into many + substreams. It is available from + @uref{http://www.iro.umontreal.ca/~lecuyer/myftp/streams00/c/}. + A GNU-style package is available from + @uref{http://statmath.wu.ac.at/software/RngStreams/}. + + The interface to the RngStream library must be compiled into UNU.RAN using the + configure flag @code{--with-urng-rngstream}. + Notice that the RngStream library has to be installed before running + @code{./configure}. + + =HOWTOUSE + When using this interface @file{unuran_urng_rngstream.h} must be included + in the corresponding C file, i.e., one must add the line + + @example + #include + @end example + + @noindent + Moreover, one must not forget to link the executable against the + @file{RngStream} library (i.e., when using the GNU-style package + in UNIX like environments one has to add @code{-lrngstreams} + when linking an executable). + + Notice that the @file{rngstream} library uses a package seed, + that means one should seed the uniform random number generator + only once in an application using the routine + @uref{http://statmath.wu.ac.at/software/RngStreams/doc/rngstreams.html#index-RngStream_005fSetPackageSeed-2,,@code{RngStream_SetPackageSeed}}: + + @example + unsigned long seed[] = @{111u, 222u, 333u, 444u, 555u, 666u@}; + RngStream_SetPackageSeed(seed); + @end example + + @noindent + The following routines are supported for URNG objects of this + type: + + @itemize @minus + @item unur_urng_sample() + @item unur_urng_sample_array() + @item unur_urng_reset() + @item unur_urng_nextsub() + @item unur_urng_resetsub() + @item unur_urng_anti() + @item unur_urng_free() + @end itemize + + =END + +*/ + +/*---------------------------------------------------------------------------*/ + +/* =ROUTINES */ + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG *unur_urng_rngstream_new( const char *urngstr ); +/* + Make object for URNGs from Pierre L'Ecuyer's @file{RngStream} + library. @var{urngstr} is an arbitrary string to label a stream. It + need not be unique. +*/ + +UNUR_URNG *unur_urng_rngstreamptr_new( RngStream rngstream ); +/* + Similar to unur_urng_rngstream_new() but it uses a pointer to a + generator object as returned by @code{RngStream_CreateStream()}. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ +#endif /* URNG_RNGSTREAMS_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/unur_cookies.h b/vendor/unuran-1.11.0/src/unur_cookies.h new file mode 100644 index 0000000..a0e2913 --- /dev/null +++ b/vendor/unuran-1.11.0/src/unur_cookies.h @@ -0,0 +1,213 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: source_cookies.h * + * * + * PURPOSE: * + * defines magic cookies. * + * * + * USAGE: * + * internal header file * + * included only in source_unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef SOURCE_COOKIES_H_SEEN +#define SOURCE_COOKIES_H_SEEN +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_COOKIES /* use magic cookies */ +/*---------------------------------------------------------------------------*/ +/* name of cookies */ + +/* generators discrete distributions */ +#define CK_DARI_PAR 0x00000010u +#define CK_DARI_GEN 0x00000011u +#define CK_DAU_PAR 0x00000020u +#define CK_DAU_GEN 0x00000021u +#define CK_DGT_PAR 0x00000030u +#define CK_DGT_GEN 0x00000031u +#define CK_DSROU_PAR 0x00000040u +#define CK_DSROU_GEN 0x00000041u +#define CK_DSS_PAR 0x00000050u +#define CK_DSS_GEN 0x00000051u + +/* generators continuous distributions */ +#define CK_AROU_PAR 0x00100010u +#define CK_AROU_GEN 0x00100011u +#define CK_AROU_SEG 0x00100012u +#define CK_ARS_PAR 0x001000d0u +#define CK_ARS_GEN 0x001000d1u +#define CK_ARS_IV 0x001000d2u +#define CK_HINV_PAR 0x00100020u +#define CK_HINV_GEN 0x00100021u +#define CK_HINV_IV 0x00100022u +#define CK_HRB_PAR 0x00100030u +#define CK_HRB_GEN 0x00100031u +#define CK_HRD_PAR 0x00100040u +#define CK_HRD_GEN 0x00100041u +#define CK_HRI_PAR 0x00100050u +#define CK_HRI_GEN 0x00100051u +#define CK_ITDR_PAR 0x00100080u +#define CK_ITDR_GEN 0x00100081u +#define CK_NINV_PAR 0x00100060u +#define CK_NINV_GEN 0x00100061u +#define CK_NROU_PAR 0x00100070u +#define CK_NROU_GEN 0x00100071u +#define CK_PINV_PAR 0x00100130u +#define CK_PINV_GEN 0x00100131u +#define CK_PINV_IV 0x00100132u +#define CK_SROU_PAR 0x00100090u +#define CK_SROU_GEN 0x00100091u +#define CK_SSR_PAR 0x001000a0u +#define CK_SSR_GEN 0x001000a1u +#define CK_TABL_PAR 0x001000b0u +#define CK_TABL_GEN 0x001000b1u +#define CK_TABL_IV 0x001000b2u +#define CK_TDR_PAR 0x001000c0u +#define CK_TDR_GEN 0x001000c1u +#define CK_TDR_IV 0x001000c2u +#define CK_UNIF_PAR 0x001000e0u +#define CK_UNIF_GEN 0x001000e1u +#define CK_UTDR_PAR 0x001000f0u +#define CK_UTDR_GEN 0x001000f1u +#define CK_EMPK_PAR 0x00100100u +#define CK_EMPK_GEN 0x00100101u +#define CK_EMPL_PAR 0x00100110u +#define CK_EMPL_GEN 0x00100111u +#define CK_HIST_PAR 0x00100120u +#define CK_HIST_GEN 0x00100121u +/* meta generators */ +#define CK_MIXT_PAR 0x00110130u +#define CK_MIXT_GEN 0x00110131u + +/* generators multivariate continuous distributions */ +#define CK_MVTDR_PAR 0x00200010u +#define CK_MVTDR_GEN 0x00200010u +#define CK_VMT_PAR 0x00200020u +#define CK_VMT_GEN 0x00200021u +#define CK_VEMPK_PAR 0x00200030u +#define CK_VEMPK_GEN 0x00200031u +#define CK_VNROU_PAR 0x00200040u +#define CK_VNROU_GEN 0x00200041u +#define CK_VAROU_PAR 0x00200050u +#define CK_VAROU_GEN 0x00200051u +#define CK_NORTA_PAR 0x00200060u +#define CK_NORTA_GEN 0x00200061u +/* Markov chain samplers */ +#define CK_BALL_PAR 0x00201010u +#define CK_BALL_GEN 0x00201011u +#define CK_GIBBS_PAR 0x00201020u +#define CK_GIBBS_GEN 0x00201021u +#define CK_HITRO_PAR 0x00201030u +#define CK_HITRO_GEN 0x00201031u +#define CK_WALK_PAR 0x00201040u +#define CK_WALK_GEN 0x00201041u + +/* generators for random matrices */ +#define CK_MCORR_PAR 0x00400010u +#define CK_MCORR_GEN 0x00400011u + +/* special generators */ +#define CK_CSTD_PAR 0x10000010u +#define CK_CSTD_GEN 0x10000011u +#define CK_DSTD_PAR 0x10000020u +#define CK_DSTD_GEN 0x10000021u +#define CK_MVSTD_PAR 0x10000040u +#define CK_MVSTD_GEN 0x10000041u + +#define CK_CEXT_PAR 0x10000110u +#define CK_CEXT_GEN 0x10000111u +#define CK_DEXT_PAR 0x10000120u +#define CK_DEXT_GEN 0x10000121u + +#define CK_MBLOCK 0xf0000001u + +/* misc methods */ +#define CK_AUTO_PAR 0xa0000010u + +/* distribution objects */ +#define CK_DISTR 0xe0000000u +#define CK_DISTR_CONT 0xe0000001u +#define CK_DISTR_CEMP 0xe0000002u +#define CK_DISTR_MATR 0xe0000003u +#define CK_DISTR_CVEC 0xe0000004u +#define CK_DISTR_CVEMP 0xe0000005u +#define CK_DISTR_DISCR 0xe0000006u + +#define CK_SPECIALGEN_CONT 0xd00001u + +/* URNG (uniform random number generator objects) */ +#define CK_URNG 0xb0000001u + +/* function parser */ +#define CK_FSTR_PDATA 0xa0000001u +#define CK_FSTR_TNODE 0xa0000002u + +/* auxiliary tools */ +#define CK_SLIST 0xa0000004u + +/*---------------------------------------------------------------------------*/ +/* macros for dealing with magic cookies */ + +/* set magic cookies */ +#define COOKIE_SET(ptr,ck) (ptr)->cookie=(ck) + +#define COOKIE_SET_ARRAY(ptr,ck,n) { \ + register int i; \ + for (i=0;i<(n);i++) \ + ((ptr)+(i))->cookie=(ck); \ +} + +/* check magic cookies */ +#define COOKIE_CHECK(ptr,ck,rval) \ + if((ptr)->cookie!=(ck)) { \ + _unur_error_cookies(__FILE__,__LINE__,(ptr)->cookie, (ck)); \ + return rval; \ + } + +/* clear magic cookies (set to 0u). To be used in connection with free() to */ +/* to detect access to freed object. */ +#define COOKIE_CLEAR(ptr) (ptr)->cookie=0u + +/*---------------------------------------------------------------------------*/ +#else /* do not use magic cookies */ +/*---------------------------------------------------------------------------*/ + +#define COOKIE_SET(ptr,ck) +#define COOKIE_SET_ARRAY(ptr,ck,n) +#define COOKIE_CHECK(ptr,ck,rval) +#define COOKIE_CLEAR(ptr) + +/*---------------------------------------------------------------------------*/ +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +#endif /* SOURCE_COOKIES_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/unur_source.h b/vendor/unuran-1.11.0/src/unur_source.h new file mode 100644 index 0000000..6d9a04f --- /dev/null +++ b/vendor/unuran-1.11.0/src/unur_source.h @@ -0,0 +1,128 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unur_source.h * + * * + * PURPOSE: * + * To be included as first header file in all sources. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef UNUR_SOURCE_H_SEEN +#define UNUR_SOURCE_H_SEEN +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* config file generated be autoconf */ + +#ifdef HAVE_CONFIG_H +# include +#else +# error "config.h" required +#endif + +/*---------------------------------------------------------------------------*/ +/* compiler switches and defaults */ +#include + +/*---------------------------------------------------------------------------*/ +/* define macros for GCC attributes */ + +#ifdef __GNUC__ +# define ATTRIBUTE__FORMAT(a,b) __attribute__ (( __format__ (printf, (a), (b)) )) +# define ATTRIBUTE__UNUSED __attribute__ ((unused)) +# define ATTRIBUTE__MALLOC __attribute__ ((malloc)) +#else +# define ATTRIBUTE__FORMAT(a,b) +# define ATTRIBUTE__UNUSED +# define ATTRIBUTE__MALLOC +#endif + +/*---------------------------------------------------------------------------*/ +/* include standard header files */ + +#include +#include +#include +#include +#include + +#ifdef HAVE_LIMITS_H +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* globally used types */ + +#include +#include + +/*---------------------------------------------------------------------------*/ +/* Utilities used by almost all sources */ + +/* uniform random number generators */ +#include + +/* magic cookies */ +#include + +/* debugging, warnings and error messages */ +#include +#include +#include +#include +#include +#include +#include + +/* floating point arithmetic */ +#include +#include + +/* mathematics */ +#include +#include +#include + +/* special functions */ +#include + +/* vectors */ +#include + +/* strings */ +#include + +/* allocate memory */ +#include + +/* simple lists */ +#include + +/*---------------------------------------------------------------------------*/ +#endif /* UNUR_SOURCE_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/unur_struct.h b/vendor/unuran-1.11.0/src/unur_struct.h new file mode 100644 index 0000000..869dc88 --- /dev/null +++ b/vendor/unuran-1.11.0/src/unur_struct.h @@ -0,0 +1,107 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unur_struct.h * + * * + * PURPOSE: * + * declares structures for distribution, parameter, and generator * + * objects. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef UNUR_STRUCT_H_SEEN +#define UNUR_STRUCT_H_SEEN +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Basic header files **/ +/*****************************************************************************/ + +/*****************************************************************************/ +/** UNU.RAN objects **/ +/*****************************************************************************/ + +struct unur_distr; /* distribution object */ +struct unur_par; /* parameters for generator */ +struct unur_gen; /* generator object */ + +/*****************************************************************************/ +/** Generic functions **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Generic functions */ + +typedef double UNUR_FUNCT_GENERIC (double x, void *params); +typedef double UNUR_FUNCT_VGENERIC (double *x, void *params); + +/* for univariate functions with optional parameter array */ +struct unur_funct_generic { + UNUR_FUNCT_GENERIC *f; + void *params; +}; + +/* for multivariate functions with optional parameter array */ +struct unur_funct_vgeneric { + UNUR_FUNCT_VGENERIC *f; + void *params; +}; + +/*****************************************************************************/ +/** Auxiliary tools **/ +/*****************************************************************************/ + +#include +#include + +/*****************************************************************************/ +/** Declaration for parser **/ +/*****************************************************************************/ + +#include + +/*****************************************************************************/ +/** URNG (uniform random number generator) objects **/ +/*****************************************************************************/ + +#include + +/*****************************************************************************/ +/** Distribution objects **/ +/*****************************************************************************/ + +#include + +/*****************************************************************************/ +/** Parameter and generators objects **/ +/*****************************************************************************/ + +#include + +/*---------------------------------------------------------------------------*/ +#endif /* UNUR_STRUCT_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/unur_typedefs.h b/vendor/unuran-1.11.0/src/unur_typedefs.h new file mode 100644 index 0000000..c417a88 --- /dev/null +++ b/vendor/unuran-1.11.0/src/unur_typedefs.h @@ -0,0 +1,88 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unur_typedefs.h * + * * + * PURPOSE: * + * typedefs and names of globally used structures * + * (not already defined in unuran_config.h) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef UNUR_TYPEDEFS_H_SEEN +#define UNUR_TYPEDEFS_H_SEEN +/*---------------------------------------------------------------------------*/ +/* UNURAN objects */ + +struct unur_distr; /* distribution object */ +typedef struct unur_distr UNUR_DISTR; + +struct unur_par; /* parameters for generator */ +typedef struct unur_par UNUR_PAR; + +struct unur_gen; /* generator object */ +typedef struct unur_gen UNUR_GEN; + +struct unur_urng; /* uniform random number generator */ +typedef struct unur_urng UNUR_URNG; +/* comment out the following definition when type 'UNUR_URNG' is changed !! */ +/* You have to define _unur_call_urng(urng) and _unur_call_reset(urng) */ +/* in file 'src/urng/urng_source.h' then! */ +#define UNUR_URNG_UNURAN 1 + +/*---------------------------------------------------------------------------*/ +/* functions for continuous univariate PDF, CDF, and their derivatives */ + +typedef double UNUR_FUNCT_CONT (double x, const struct unur_distr *distr); +typedef double UNUR_FUNCT_DISCR (int x, const struct unur_distr *distr); +typedef int UNUR_IFUNCT_DISCR(double x, const struct unur_distr *distr); + +/*---------------------------------------------------------------------------*/ +/* functions for continuous multivariate PDF, CDF, and their gradients */ + +/* Remark: we cannot use a const pointer to distr as some data are */ +/* computed "on the fly" when they are needed and stored in the */ +/* distribution object. */ + +typedef double UNUR_FUNCT_CVEC (const double *x, struct unur_distr *distr); +typedef int UNUR_VFUNCT_CVEC(double *result, const double *x, struct unur_distr *distr); +typedef double UNUR_FUNCTD_CVEC(const double *x, int coord, struct unur_distr *distr); + +/*---------------------------------------------------------------------------*/ +/* structures for auxiliary tools */ + +struct unur_slist; /* structure for simple list */ + +/*---------------------------------------------------------------------------*/ +/* error handler */ + +typedef void UNUR_ERROR_HANDLER( const char *objid, const char *file, int line, + const char *errortype, int unur_errno, const char *reason ); + +/*---------------------------------------------------------------------------*/ +#endif /* UNUR_TYPEDEFS_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/unuran.h b/vendor/unuran-1.11.0/src/unuran.h new file mode 100644 index 0000000..a748040 --- /dev/null +++ b/vendor/unuran-1.11.0/src/unuran.h @@ -0,0 +1,1271 @@ +/* file automatically generated by unuran/scripts/merge_h.pl */ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Dept. for Statistics, University of Economics, Vienna, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +#ifndef UNURAN_H_IN_SEEN +#define UNURAN_H_IN_SEEN + +#include + + +#include + + +#include + +/*-----*/ +/* <1> `unur_typedefs.h' */ +#ifndef UNUR_TYPEDEFS_H_SEEN +#define UNUR_TYPEDEFS_H_SEEN +struct unur_distr; +typedef struct unur_distr UNUR_DISTR; +struct unur_par; +typedef struct unur_par UNUR_PAR; +struct unur_gen; +typedef struct unur_gen UNUR_GEN; +struct unur_urng; +typedef struct unur_urng UNUR_URNG; +#define UNUR_URNG_UNURAN 1 +typedef double UNUR_FUNCT_CONT (double x, const struct unur_distr *distr); +typedef double UNUR_FUNCT_DISCR (int x, const struct unur_distr *distr); +typedef int UNUR_IFUNCT_DISCR(double x, const struct unur_distr *distr); +typedef double UNUR_FUNCT_CVEC (const double *x, struct unur_distr *distr); +typedef int UNUR_VFUNCT_CVEC(double *result, const double *x, struct unur_distr *distr); +typedef double UNUR_FUNCTD_CVEC(const double *x, int coord, struct unur_distr *distr); +struct unur_slist; +typedef void UNUR_ERROR_HANDLER( const char *objid, const char *file, int line, + const char *errortype, int unur_errno, const char *reason ); +#endif +/* end of `unur_typedefs.h' */ +/*-----*/ +/*-----*/ +/* <1> `urng.h' */ +#ifndef URNG_H_SEEN +#define URNG_H_SEEN +UNUR_URNG *unur_get_default_urng( void ); +UNUR_URNG *unur_set_default_urng( UNUR_URNG *urng_new ); +UNUR_URNG *unur_set_default_urng_aux( UNUR_URNG *urng_new ); +UNUR_URNG *unur_get_default_urng_aux( void ); +int unur_set_urng( UNUR_PAR *parameters, UNUR_URNG *urng ); +UNUR_URNG *unur_chg_urng( UNUR_GEN *generator, UNUR_URNG *urng ); +UNUR_URNG *unur_get_urng( UNUR_GEN *generator ); +int unur_set_urng_aux( UNUR_PAR *parameters, UNUR_URNG *urng_aux ); +int unur_use_urng_aux_default( UNUR_PAR *parameters ); +int unur_chgto_urng_aux_default( UNUR_GEN *generator ); +UNUR_URNG *unur_chg_urng_aux( UNUR_GEN *generator, UNUR_URNG *urng_aux ); +UNUR_URNG *unur_get_urng_aux( UNUR_GEN *generator ); +double unur_urng_sample (UNUR_URNG *urng); +double unur_sample_urng (UNUR_GEN *gen); +int unur_urng_sample_array (UNUR_URNG *urng, double *X, int dim); +int unur_urng_reset (UNUR_URNG *urng); +#ifdef UNUR_URNG_UNURAN +int unur_urng_sync (UNUR_URNG *urng); +int unur_urng_seed (UNUR_URNG *urng, unsigned long seed); +int unur_urng_anti (UNUR_URNG *urng, int anti); +int unur_urng_nextsub (UNUR_URNG *urng); +int unur_urng_resetsub (UNUR_URNG *urng); +int unur_gen_sync (UNUR_GEN *generator); +int unur_gen_seed (UNUR_GEN *generator, unsigned long seed); +int unur_gen_anti (UNUR_GEN *generator, int anti); +int unur_gen_reset (UNUR_GEN *generator); +int unur_gen_nextsub (UNUR_GEN *generator); +int unur_gen_resetsub (UNUR_GEN *generator); +UNUR_URNG *unur_urng_new( double (*sampleunif)(void *state), void *state ); +void unur_urng_free (UNUR_URNG *urng); +int unur_urng_set_sample_array( UNUR_URNG *urng, unsigned int (*samplearray)(void *state, double *X, int dim) ); +int unur_urng_set_sync( UNUR_URNG *urng, void (*sync)(void *state) ); +int unur_urng_set_seed( UNUR_URNG *urng, void (*setseed)(void *state, unsigned long seed) ); +int unur_urng_set_anti( UNUR_URNG *urng, void (*setanti)(void *state, int anti) ); +int unur_urng_set_reset( UNUR_URNG *urng, void (*reset)(void *state) ); +int unur_urng_set_nextsub( UNUR_URNG *urng, void (*nextsub)(void *state) ); +int unur_urng_set_resetsub( UNUR_URNG *urng, void (*resetsub)(void *state) ); +int unur_urng_set_delete( UNUR_URNG *urng, void (*fpdelete)(void *state) ); +#endif +#endif +/* end of `urng.h' */ +/*-----*/ +/*-----*/ +/* <1> `urng_builtin.h' */ +#ifndef URNG_BUILTIN_H_SEEN +#define URNG_BUILTIN_H_SEEN +double unur_urng_MRG31k3p (void *dummy); +void unur_urng_MRG31k3p_seed (void *dummy, unsigned long seed); +void unur_urng_MRG31k3p_reset (void *dummy); +double unur_urng_fish (void *dummy); +void unur_urng_fish_seed (void *dummy, unsigned long seed); +void unur_urng_fish_reset (void *dummy); +double unur_urng_mstd (void *dummy); +void unur_urng_mstd_seed (void *dummy, unsigned long seed); +void unur_urng_mstd_reset (void *dummy); +UNUR_URNG *unur_urng_builtin( void ); +UNUR_URNG *unur_urng_builtin_aux( void ); +#endif +/* end of `urng_builtin.h' */ +/*-----*/ +/*-----*/ +/* <1> `urng_fvoid.h' */ +#ifndef URNG_FVOID_H_SEEN +#define URNG_FVOID_H_SEEN +UNUR_URNG *unur_urng_fvoid_new( double (*urand)(void *state), void (*reset)(void *state) ); +#endif +/* end of `urng_fvoid.h' */ +/*-----*/ +/*-----*/ +/* <1> `urng_randomshift.h' */ +#ifndef URNG_RANDOMSHIFT_H_SEEN +#define URNG_RANDOMSHIFT_H_SEEN +UNUR_URNG *unur_urng_randomshift_new( UNUR_URNG *qrng, UNUR_URNG *srng, int dim ); +int unur_urng_randomshift_nextshift( UNUR_URNG *urng ); +#endif +/* end of `urng_randomshift.h' */ +/*-----*/ +/*-----*/ +/* <1> `distr.h' */ +enum { + UNUR_DISTR_CONT = 0x010u, + UNUR_DISTR_CEMP = 0x011u, + UNUR_DISTR_CVEC = 0x110u, + UNUR_DISTR_CVEMP = 0x111u, + UNUR_DISTR_MATR = 0x210u, + UNUR_DISTR_DISCR = 0x020u +}; +void unur_distr_free( UNUR_DISTR *distribution ); +int unur_distr_set_name( UNUR_DISTR *distribution, const char *name ); +const char *unur_distr_get_name( const UNUR_DISTR *distribution ); +int unur_distr_get_dim( const UNUR_DISTR *distribution ); +unsigned int unur_distr_get_type( const UNUR_DISTR *distribution ); +int unur_distr_is_cont( const UNUR_DISTR *distribution ); +int unur_distr_is_cvec( const UNUR_DISTR *distribution ); +int unur_distr_is_cemp( const UNUR_DISTR *distribution ); +int unur_distr_is_cvemp( const UNUR_DISTR *distribution ); +int unur_distr_is_discr( const UNUR_DISTR *distribution ); +int unur_distr_is_matr( const UNUR_DISTR *distribution ); +int unur_distr_set_extobj( UNUR_DISTR *distribution, const void *extobj ); +const void *unur_distr_get_extobj( const UNUR_DISTR *distribution ); +UNUR_DISTR *unur_distr_clone( const UNUR_DISTR *distr ); +/* end of `distr.h' */ +/*-----*/ +/*-----*/ +/* <1> `cemp.h' */ +UNUR_DISTR *unur_distr_cemp_new( void ); +int unur_distr_cemp_set_data( UNUR_DISTR *distribution, const double *sample, int n_sample ); +int unur_distr_cemp_read_data( UNUR_DISTR *distribution, const char *filename ); +int unur_distr_cemp_get_data( const UNUR_DISTR *distribution, const double **sample ); +int unur_distr_cemp_set_hist( UNUR_DISTR *distribution, const double *prob, int n_prob, double xmin, double xmax ); +int unur_distr_cemp_set_hist_prob( UNUR_DISTR *distribution, const double *prob, int n_prob ); +int unur_distr_cemp_set_hist_domain( UNUR_DISTR *distribution, double xmin, double xmax ); +int unur_distr_cemp_set_hist_bins( UNUR_DISTR *distribution, const double *bins, int n_bins ); +/* end of `cemp.h' */ +/*-----*/ +/*-----*/ +/* <1> `cont.h' */ +UNUR_DISTR *unur_distr_cont_new( void ); +int unur_distr_cont_set_pdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *pdf ); +int unur_distr_cont_set_dpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *dpdf ); +int unur_distr_cont_set_cdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *cdf ); +int unur_distr_cont_set_invcdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *invcdf ); +UNUR_FUNCT_CONT *unur_distr_cont_get_pdf( const UNUR_DISTR *distribution ); +UNUR_FUNCT_CONT *unur_distr_cont_get_dpdf( const UNUR_DISTR *distribution ); +UNUR_FUNCT_CONT *unur_distr_cont_get_cdf( const UNUR_DISTR *distribution ); +UNUR_FUNCT_CONT *unur_distr_cont_get_invcdf( const UNUR_DISTR *distribution ); +double unur_distr_cont_eval_pdf( double x, const UNUR_DISTR *distribution ); +double unur_distr_cont_eval_dpdf( double x, const UNUR_DISTR *distribution ); +double unur_distr_cont_eval_cdf( double x, const UNUR_DISTR *distribution ); +double unur_distr_cont_eval_invcdf( double u, const UNUR_DISTR *distribution ); +int unur_distr_cont_set_logpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *logpdf ); +int unur_distr_cont_set_dlogpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *dlogpdf ); +int unur_distr_cont_set_logcdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *logcdf ); +UNUR_FUNCT_CONT *unur_distr_cont_get_logpdf( const UNUR_DISTR *distribution ); +UNUR_FUNCT_CONT *unur_distr_cont_get_dlogpdf( const UNUR_DISTR *distribution ); +UNUR_FUNCT_CONT *unur_distr_cont_get_logcdf( const UNUR_DISTR *distribution ); +double unur_distr_cont_eval_logpdf( double x, const UNUR_DISTR *distribution ); +double unur_distr_cont_eval_dlogpdf( double x, const UNUR_DISTR *distribution ); +double unur_distr_cont_eval_logcdf( double x, const UNUR_DISTR *distribution ); +int unur_distr_cont_set_pdfstr( UNUR_DISTR *distribution, const char *pdfstr ); +int unur_distr_cont_set_cdfstr( UNUR_DISTR *distribution, const char *cdfstr ); +char *unur_distr_cont_get_pdfstr( const UNUR_DISTR *distribution ); +char *unur_distr_cont_get_dpdfstr( const UNUR_DISTR *distribution ); +char *unur_distr_cont_get_cdfstr( const UNUR_DISTR *distribution ); +int unur_distr_cont_set_pdfparams( UNUR_DISTR *distribution, const double *params, int n_params ); +int unur_distr_cont_get_pdfparams( const UNUR_DISTR *distribution, const double **params ); +int unur_distr_cont_set_pdfparams_vec( UNUR_DISTR *distribution, int par, const double *param_vec, int n_param_vec ); +int unur_distr_cont_get_pdfparams_vec( const UNUR_DISTR *distribution, int par, const double **param_vecs ); +int unur_distr_cont_set_logpdfstr( UNUR_DISTR *distribution, const char *logpdfstr ); +char *unur_distr_cont_get_logpdfstr( const UNUR_DISTR *distribution ); +char *unur_distr_cont_get_dlogpdfstr( const UNUR_DISTR *distribution ); +int unur_distr_cont_set_logcdfstr( UNUR_DISTR *distribution, const char *logcdfstr ); +char *unur_distr_cont_get_logcdfstr( const UNUR_DISTR *distribution ); +int unur_distr_cont_set_domain( UNUR_DISTR *distribution, double left, double right ); +int unur_distr_cont_get_domain( const UNUR_DISTR *distribution, double *left, double *right ); +int unur_distr_cont_get_truncated( const UNUR_DISTR *distribution, double *left, double *right ); +int unur_distr_cont_set_hr( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *hazard ); +UNUR_FUNCT_CONT *unur_distr_cont_get_hr( const UNUR_DISTR *distribution ); +double unur_distr_cont_eval_hr( double x, const UNUR_DISTR *distribution ); +int unur_distr_cont_set_hrstr( UNUR_DISTR *distribution, const char *hrstr ); +char *unur_distr_cont_get_hrstr( const UNUR_DISTR *distribution ); +int unur_distr_cont_set_mode( UNUR_DISTR *distribution, double mode ); +int unur_distr_cont_upd_mode( UNUR_DISTR *distribution ); +double unur_distr_cont_get_mode( UNUR_DISTR *distribution ); +int unur_distr_cont_set_center( UNUR_DISTR *distribution, double center ); +double unur_distr_cont_get_center( const UNUR_DISTR *distribution ); +int unur_distr_cont_set_pdfarea( UNUR_DISTR *distribution, double area ); +int unur_distr_cont_upd_pdfarea( UNUR_DISTR *distribution ); +double unur_distr_cont_get_pdfarea( UNUR_DISTR *distribution ); +/* end of `cont.h' */ +/*-----*/ +/*-----*/ +/* <1> `cxtrans.h' */ +UNUR_DISTR *unur_distr_cxtrans_new( const UNUR_DISTR *distribution ); +const UNUR_DISTR *unur_distr_cxtrans_get_distribution( const UNUR_DISTR *distribution ); +int unur_distr_cxtrans_set_alpha( UNUR_DISTR *distribution, double alpha ); +int unur_distr_cxtrans_set_rescale( UNUR_DISTR *distribution, double mu, double sigma ); +double unur_distr_cxtrans_get_alpha( const UNUR_DISTR *distribution ); +double unur_distr_cxtrans_get_mu( const UNUR_DISTR *distribution ); +double unur_distr_cxtrans_get_sigma( const UNUR_DISTR *distribution ); +int unur_distr_cxtrans_set_logpdfpole( UNUR_DISTR *distribution, double logpdfpole, double dlogpdfpole ); +#define unur_distr_cxtrans_get_pdf(distr) unur_distr_cont_get_pdf((distr)) +#define unur_distr_cxtrans_get_dpdf(distr) unur_distr_cont_get_dpdf((distr)) +#define unur_distr_cxtrans_get_cdf(distr) unur_distr_cont_get_cdf((distr)) +#define unur_distr_cxtrans_eval_pdf(x,distr) unur_distr_cont_eval_pdf((x),(distr)) +#define unur_distr_cxtrans_eval_dpdf(x,distr) unur_distr_cont_eval_dpdf((x),(distr)) +#define unur_distr_cxtrans_eval_cdf(x,distr) unur_distr_cont_eval_cdf((x),(distr)) +int unur_distr_cxtrans_set_domain( UNUR_DISTR *distribution, double left, double right ); +#define unur_distr_cxtrans_get_domain(distr,left,right) unur_distr_cont_get_domain((distr),(left),(right)) +#define unur_distr_cxtrans_get_truncated(distr,left,right) unur_distr_cont_get_truncated((distr),(left),(right)) +#define unur_distr_cxtrans_set_mode(distr,mode) unur_distr_cont_set_mode((distr),(mode)) +#define unur_distr_cxtrans_upd_mode(distr) unur_distr_cont_upd_mode((distr)) +#define unur_distr_cxtrans_get_mode(distr) unur_distr_cont_get_mode((distr)) +#define unur_distr_cxtrans_set_pdfarea(distr,area) unur_distr_cont_set_pdfarea((distr),(area)) +#define unur_distr_cxtrans_upd_pdfarea(distr) unur_distr_cont_upd_pdfarea((distr)) +#define unur_distr_cxtrans_get_pdfarea(distr) unur_distr_cont_get_pdfarea((distr)) +/* end of `cxtrans.h' */ +/*-----*/ +/*-----*/ +/* <1> `corder.h' */ +UNUR_DISTR *unur_distr_corder_new( const UNUR_DISTR *distribution, int n, int k ); +const UNUR_DISTR *unur_distr_corder_get_distribution( const UNUR_DISTR *distribution ); +int unur_distr_corder_set_rank( UNUR_DISTR *distribution, int n, int k ); +int unur_distr_corder_get_rank( const UNUR_DISTR *distribution, int *n, int *k ); +#define unur_distr_corder_get_pdf(distr) unur_distr_cont_get_pdf((distr)) +#define unur_distr_corder_get_dpdf(distr) unur_distr_cont_get_dpdf((distr)) +#define unur_distr_corder_get_cdf(distr) unur_distr_cont_get_cdf((distr)) +#define unur_distr_corder_eval_pdf(x,distr) unur_distr_cont_eval_pdf((x),(distr)) +#define unur_distr_corder_eval_dpdf(x,distr) unur_distr_cont_eval_dpdf((x),(distr)) +#define unur_distr_corder_eval_cdf(x,distr) unur_distr_cont_eval_cdf((x),(distr)) +#define unur_distr_corder_set_pdfparams(distr,params,n) unur_distr_cont_set_pdfparams((distr),(params),(n)) +#define unur_distr_corder_get_pdfparams(distr,params) unur_distr_cont_get_pdfparams((distr),(params)) +#define unur_distr_corder_set_domain(distr,left,right) unur_distr_cont_set_domain((distr),(left),(right)) +#define unur_distr_corder_get_domain(distr,left,right) unur_distr_cont_get_domain((distr),(left),(right)) +#define unur_distr_corder_get_truncated(distr,left,right) unur_distr_cont_get_truncated((distr),(left),(right)) +#define unur_distr_corder_set_mode(distr,mode) unur_distr_cont_set_mode((distr),(mode)) +#define unur_distr_corder_upd_mode(distr) unur_distr_cont_upd_mode((distr)) +#define unur_distr_corder_get_mode(distr) unur_distr_cont_get_mode((distr)) +#define unur_distr_corder_set_pdfarea(distr,area) unur_distr_cont_set_pdfarea((distr),(area)) +#define unur_distr_corder_upd_pdfarea(distr) unur_distr_cont_upd_pdfarea((distr)) +#define unur_distr_corder_get_pdfarea(distr) unur_distr_cont_get_pdfarea((distr)) +/* end of `corder.h' */ +/*-----*/ +/*-----*/ +/* <1> `cvec.h' */ +UNUR_DISTR *unur_distr_cvec_new( int dim ); +int unur_distr_cvec_set_pdf( UNUR_DISTR *distribution, UNUR_FUNCT_CVEC *pdf ); +int unur_distr_cvec_set_dpdf( UNUR_DISTR *distribution, UNUR_VFUNCT_CVEC *dpdf ); +int unur_distr_cvec_set_pdpdf( UNUR_DISTR *distribution, UNUR_FUNCTD_CVEC *pdpdf ); +UNUR_FUNCT_CVEC *unur_distr_cvec_get_pdf( const UNUR_DISTR *distribution ); +UNUR_VFUNCT_CVEC *unur_distr_cvec_get_dpdf( const UNUR_DISTR *distribution ); +UNUR_FUNCTD_CVEC *unur_distr_cvec_get_pdpdf( const UNUR_DISTR *distribution ); +double unur_distr_cvec_eval_pdf( const double *x, UNUR_DISTR *distribution ); +int unur_distr_cvec_eval_dpdf( double *result, const double *x, UNUR_DISTR *distribution ); +double unur_distr_cvec_eval_pdpdf( const double *x, int coord, UNUR_DISTR *distribution ); +int unur_distr_cvec_set_logpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CVEC *logpdf ); +int unur_distr_cvec_set_dlogpdf( UNUR_DISTR *distribution, UNUR_VFUNCT_CVEC *dlogpdf ); +int unur_distr_cvec_set_pdlogpdf( UNUR_DISTR *distribution, UNUR_FUNCTD_CVEC *pdlogpdf ); +UNUR_FUNCT_CVEC *unur_distr_cvec_get_logpdf( const UNUR_DISTR *distribution ); +UNUR_VFUNCT_CVEC *unur_distr_cvec_get_dlogpdf( const UNUR_DISTR *distribution ); +UNUR_FUNCTD_CVEC *unur_distr_cvec_get_pdlogpdf( const UNUR_DISTR *distribution ); +double unur_distr_cvec_eval_logpdf( const double *x, UNUR_DISTR *distribution ); +int unur_distr_cvec_eval_dlogpdf( double *result, const double *x, UNUR_DISTR *distribution ); +double unur_distr_cvec_eval_pdlogpdf( const double *x, int coord, UNUR_DISTR *distribution ); +int unur_distr_cvec_set_mean( UNUR_DISTR *distribution, const double *mean ); +const double *unur_distr_cvec_get_mean( const UNUR_DISTR *distribution ); +int unur_distr_cvec_set_covar( UNUR_DISTR *distribution, const double *covar ); +int unur_distr_cvec_set_covar_inv( UNUR_DISTR *distribution, const double *covar_inv ); +const double *unur_distr_cvec_get_covar( const UNUR_DISTR *distribution ); +const double *unur_distr_cvec_get_cholesky( const UNUR_DISTR *distribution ); +const double *unur_distr_cvec_get_covar_inv( UNUR_DISTR *distribution ); +int unur_distr_cvec_set_rankcorr( UNUR_DISTR *distribution, const double *rankcorr ); +const double *unur_distr_cvec_get_rankcorr( const UNUR_DISTR *distribution ); +const double *unur_distr_cvec_get_rk_cholesky( const UNUR_DISTR *distribution ); +int unur_distr_cvec_set_marginals( UNUR_DISTR *distribution, UNUR_DISTR *marginal ); +int unur_distr_cvec_set_marginal_array( UNUR_DISTR *distribution, UNUR_DISTR **marginals ); +int unur_distr_cvec_set_marginal_list( UNUR_DISTR *distribution, ... ); +const UNUR_DISTR *unur_distr_cvec_get_marginal( const UNUR_DISTR *distribution, int n ); +int unur_distr_cvec_set_pdfparams( UNUR_DISTR *distribution, const double *params, int n_params ); +int unur_distr_cvec_get_pdfparams( const UNUR_DISTR *distribution, const double **params ); +int unur_distr_cvec_set_pdfparams_vec( UNUR_DISTR *distribution, int par, const double *param_vec, int n_params ); +int unur_distr_cvec_get_pdfparams_vec( const UNUR_DISTR *distribution, int par, const double **param_vecs ); +int unur_distr_cvec_set_domain_rect( UNUR_DISTR *distribution, const double *lowerleft, const double *upperright ); +int unur_distr_cvec_is_indomain( const double *x, const UNUR_DISTR *distribution ); +int unur_distr_cvec_set_mode( UNUR_DISTR *distribution, const double *mode ); +int unur_distr_cvec_upd_mode( UNUR_DISTR *distribution ); +const double *unur_distr_cvec_get_mode( UNUR_DISTR *distribution ); +int unur_distr_cvec_set_center( UNUR_DISTR *distribution, const double *center ); +const double *unur_distr_cvec_get_center( UNUR_DISTR *distribution ); +int unur_distr_cvec_set_pdfvol( UNUR_DISTR *distribution, double volume ); +int unur_distr_cvec_upd_pdfvol( UNUR_DISTR *distribution ); +double unur_distr_cvec_get_pdfvol( UNUR_DISTR *distribution ); +/* end of `cvec.h' */ +/*-----*/ +/*-----*/ +/* <1> `condi.h' */ +UNUR_DISTR *unur_distr_condi_new( const UNUR_DISTR *distribution, const double *pos, const double *dir, int k ); +int unur_distr_condi_set_condition( struct unur_distr *distribution, const double *pos, const double *dir, int k ); +int unur_distr_condi_get_condition( struct unur_distr *distribution, const double **pos, const double **dir, int *k ); +const UNUR_DISTR *unur_distr_condi_get_distribution( const UNUR_DISTR *distribution ); +/* end of `condi.h' */ +/*-----*/ +/*-----*/ +/* <1> `cvemp.h' */ +UNUR_DISTR *unur_distr_cvemp_new( int dim ); +int unur_distr_cvemp_set_data( UNUR_DISTR *distribution, const double *sample, int n_sample ); +int unur_distr_cvemp_read_data( UNUR_DISTR *distribution, const char *filename ); +int unur_distr_cvemp_get_data( const UNUR_DISTR *distribution, const double **sample ); +/* end of `cvemp.h' */ +/*-----*/ +/*-----*/ +/* <1> `discr.h' */ +UNUR_DISTR *unur_distr_discr_new( void ); +int unur_distr_discr_set_pv( UNUR_DISTR *distribution, const double *pv, int n_pv ); +int unur_distr_discr_make_pv( UNUR_DISTR *distribution ); +int unur_distr_discr_get_pv( const UNUR_DISTR *distribution, const double **pv ); +int unur_distr_discr_set_pmf( UNUR_DISTR *distribution, UNUR_FUNCT_DISCR *pmf ); +int unur_distr_discr_set_cdf( UNUR_DISTR *distribution, UNUR_FUNCT_DISCR *cdf ); +int unur_distr_discr_set_invcdf( UNUR_DISTR *distribution, UNUR_IFUNCT_DISCR *invcdf ); +UNUR_FUNCT_DISCR *unur_distr_discr_get_pmf( const UNUR_DISTR *distribution ); +UNUR_FUNCT_DISCR *unur_distr_discr_get_cdf( const UNUR_DISTR *distribution ); +UNUR_IFUNCT_DISCR *unur_distr_discr_get_invcdf( const UNUR_DISTR *distribution ); +double unur_distr_discr_eval_pv(int k, const UNUR_DISTR *distribution ); +double unur_distr_discr_eval_pmf( int k, const UNUR_DISTR *distribution ); +double unur_distr_discr_eval_cdf( int k, const UNUR_DISTR *distribution ); +int unur_distr_discr_eval_invcdf( double u, const UNUR_DISTR *distribution ); +int unur_distr_discr_set_pmfstr( UNUR_DISTR *distribution, const char *pmfstr ); +int unur_distr_discr_set_cdfstr( UNUR_DISTR *distribution, const char *cdfstr ); +char *unur_distr_discr_get_pmfstr( const UNUR_DISTR *distribution ); +char *unur_distr_discr_get_cdfstr( const UNUR_DISTR *distribution ); +int unur_distr_discr_set_pmfparams( UNUR_DISTR *distribution, const double *params, int n_params ); +int unur_distr_discr_get_pmfparams( const UNUR_DISTR *distribution, const double **params ); +int unur_distr_discr_set_domain( UNUR_DISTR *distribution, int left, int right ); +int unur_distr_discr_get_domain( const UNUR_DISTR *distribution, int *left, int *right ); +int unur_distr_discr_set_mode( UNUR_DISTR *distribution, int mode ); +int unur_distr_discr_upd_mode( UNUR_DISTR *distribution ); +int unur_distr_discr_get_mode( UNUR_DISTR *distribution ); +int unur_distr_discr_set_pmfsum( UNUR_DISTR *distribution, double sum ); +int unur_distr_discr_upd_pmfsum( UNUR_DISTR *distribution ); +double unur_distr_discr_get_pmfsum( UNUR_DISTR *distribution ); +/* end of `discr.h' */ +/*-----*/ +/*-----*/ +/* <1> `matr.h' */ +UNUR_DISTR *unur_distr_matr_new( int n_rows, int n_cols ); +int unur_distr_matr_get_dim( const UNUR_DISTR *distribution, int *n_rows, int *n_cols ); +/* end of `matr.h' */ +/*-----*/ +/*-----*/ +/* <1> `auto.h' */ +UNUR_PAR *unur_auto_new( const UNUR_DISTR *distribution ); +int unur_auto_set_logss( UNUR_PAR *parameters, int logss ); +/* end of `auto.h' */ +/*-----*/ +/*-----*/ +/* <1> `dari.h' */ +UNUR_PAR *unur_dari_new( const UNUR_DISTR *distribution ); +int unur_dari_set_squeeze( UNUR_PAR *parameters, int squeeze ); +int unur_dari_set_tablesize( UNUR_PAR *parameters, int size ); +int unur_dari_set_cpfactor( UNUR_PAR *parameters, double cp_factor ); +int unur_dari_set_verify( UNUR_PAR *parameters, int verify ); +int unur_dari_chg_verify( UNUR_GEN *generator, int verify ); +/* end of `dari.h' */ +/*-----*/ +/*-----*/ +/* <1> `dau.h' */ +UNUR_PAR *unur_dau_new( const UNUR_DISTR *distribution ); +int unur_dau_set_urnfactor( UNUR_PAR *parameters, double factor ); +/* end of `dau.h' */ +/*-----*/ +/*-----*/ +/* <1> `dgt.h' */ +UNUR_PAR *unur_dgt_new( const UNUR_DISTR *distribution ); +int unur_dgt_set_guidefactor( UNUR_PAR *parameters, double factor ); +int unur_dgt_set_variant( UNUR_PAR *parameters, unsigned variant ); +int unur_dgt_eval_invcdf_recycle( const UNUR_GEN *generator, double u, double *recycle ); +int unur_dgt_eval_invcdf( const UNUR_GEN *generator, double u ); +/* end of `dgt.h' */ +/*-----*/ +/*-----*/ +/* <1> `dsrou.h' */ +UNUR_PAR *unur_dsrou_new( const UNUR_DISTR *distribution ); +int unur_dsrou_set_cdfatmode( UNUR_PAR *parameters, double Fmode ); +int unur_dsrou_set_verify( UNUR_PAR *parameters, int verify ); +int unur_dsrou_chg_verify( UNUR_GEN *generator, int verify ); +int unur_dsrou_chg_cdfatmode( UNUR_GEN *generator, double Fmode ); +/* end of `dsrou.h' */ +/*-----*/ +/*-----*/ +/* <1> `dss.h' */ +UNUR_PAR *unur_dss_new( const UNUR_DISTR *distribution ); +/* end of `dss.h' */ +/*-----*/ +/*-----*/ +/* <1> `arou.h' */ +UNUR_PAR *unur_arou_new( const UNUR_DISTR *distribution ); +int unur_arou_set_usedars( UNUR_PAR *parameters, int usedars ); +int unur_arou_set_darsfactor( UNUR_PAR *parameters, double factor ); +int unur_arou_set_max_sqhratio( UNUR_PAR *parameters, double max_ratio ); +double unur_arou_get_sqhratio( const UNUR_GEN *generator ); +double unur_arou_get_hatarea( const UNUR_GEN *generator ); +double unur_arou_get_squeezearea( const UNUR_GEN *generator ); +int unur_arou_set_max_segments( UNUR_PAR *parameters, int max_segs ); +int unur_arou_set_cpoints( UNUR_PAR *parameters, int n_stp, const double *stp ); +int unur_arou_set_usecenter( UNUR_PAR *parameters, int usecenter ); +int unur_arou_set_guidefactor( UNUR_PAR *parameters, double factor ); +int unur_arou_set_verify( UNUR_PAR *parameters, int verify ); +int unur_arou_chg_verify( UNUR_GEN *generator, int verify ); +int unur_arou_set_pedantic( UNUR_PAR *parameters, int pedantic ); +/* end of `arou.h' */ +/*-----*/ +/*-----*/ +/* <1> `ars.h' */ +UNUR_PAR *unur_ars_new( const UNUR_DISTR* distribution ); +int unur_ars_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); +int unur_ars_set_cpoints( UNUR_PAR *parameters, int n_cpoints, const double *cpoints ); +int unur_ars_set_reinit_percentiles( UNUR_PAR *parameters, int n_percentiles, const double *percentiles ); +int unur_ars_chg_reinit_percentiles( UNUR_GEN *generator, int n_percentiles, const double *percentiles ); +int unur_ars_set_reinit_ncpoints( UNUR_PAR *parameters, int ncpoints ); +int unur_ars_chg_reinit_ncpoints( UNUR_GEN *generator, int ncpoints ); +int unur_ars_set_max_iter( UNUR_PAR *parameters, int max_iter ); +int unur_ars_set_verify( UNUR_PAR *parameters, int verify ); +int unur_ars_chg_verify( UNUR_GEN *generator, int verify ); +int unur_ars_set_pedantic( UNUR_PAR *parameters, int pedantic ); +double unur_ars_get_loghatarea( const UNUR_GEN *generator ); +double unur_ars_eval_invcdfhat( const UNUR_GEN *generator, double u ); +/* end of `ars.h' */ +/*-----*/ +/*-----*/ +/* <1> `hinv.h' */ +UNUR_PAR *unur_hinv_new( const UNUR_DISTR *distribution ); +int unur_hinv_set_order( UNUR_PAR *parameters, int order); +int unur_hinv_set_u_resolution( UNUR_PAR *parameters, double u_resolution); +int unur_hinv_set_cpoints( UNUR_PAR *parameters, const double *stp, int n_stp ); +int unur_hinv_set_boundary( UNUR_PAR *parameters, double left, double right ); +int unur_hinv_set_guidefactor( UNUR_PAR *parameters, double factor ); +int unur_hinv_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); +int unur_hinv_get_n_intervals( const UNUR_GEN *generator ); +double unur_hinv_eval_approxinvcdf( const UNUR_GEN *generator, double u ); +int unur_hinv_chg_truncated( UNUR_GEN *generator, double left, double right ); +int unur_hinv_estimate_error( const UNUR_GEN *generator, int samplesize, double *max_error, double *MAE ); +/* end of `hinv.h' */ +/*-----*/ +/*-----*/ +/* <1> `hrb.h' */ +UNUR_PAR *unur_hrb_new( const UNUR_DISTR *distribution ); +int unur_hrb_set_upperbound( UNUR_PAR *parameters, double upperbound ); +int unur_hrb_set_verify( UNUR_PAR *parameters, int verify ); +int unur_hrb_chg_verify( UNUR_GEN *generator, int verify ); +/* end of `hrb.h' */ +/*-----*/ +/*-----*/ +/* <1> `hrd.h' */ +UNUR_PAR *unur_hrd_new( const UNUR_DISTR *distribution ); +int unur_hrd_set_verify( UNUR_PAR *parameters, int verify ); +int unur_hrd_chg_verify( UNUR_GEN *generator, int verify ); +/* end of `hrd.h' */ +/*-----*/ +/*-----*/ +/* <1> `hri.h' */ +UNUR_PAR *unur_hri_new( const UNUR_DISTR *distribution ); +int unur_hri_set_p0( UNUR_PAR *parameters, double p0 ); +int unur_hri_set_verify( UNUR_PAR *parameters, int verify ); +int unur_hri_chg_verify( UNUR_GEN *generator, int verify ); +/* end of `hri.h' */ +/*-----*/ +/*-----*/ +/* <1> `itdr.h' */ +UNUR_PAR *unur_itdr_new( const UNUR_DISTR *distribution ); +int unur_itdr_set_xi( UNUR_PAR *parameters, double xi ); +int unur_itdr_set_cp( UNUR_PAR *parameters, double cp ); +int unur_itdr_set_ct( UNUR_PAR *parameters, double ct ); +double unur_itdr_get_xi( UNUR_GEN *generator ); +double unur_itdr_get_cp( UNUR_GEN *generator ); +double unur_itdr_get_ct( UNUR_GEN *generator ); +double unur_itdr_get_area( UNUR_GEN *generator ); +int unur_itdr_set_verify( UNUR_PAR *parameters, int verify ); +int unur_itdr_chg_verify( UNUR_GEN *generator, int verify ); +/* end of `itdr.h' */ +/*-----*/ +/*-----*/ +/* <1> `mcorr.h' */ +UNUR_PAR *unur_mcorr_new( const UNUR_DISTR *distribution ); +int unur_mcorr_set_eigenvalues( UNUR_PAR *par, const double *eigenvalues ); +int unur_mcorr_chg_eigenvalues( UNUR_GEN *gen, const double *eigenvalues ); +/* end of `mcorr.h' */ +/*-----*/ +/*-----*/ +/* <1> `ninv.h' */ +UNUR_PAR *unur_ninv_new( const UNUR_DISTR *distribution ); +int unur_ninv_set_useregula( UNUR_PAR *parameters ); +int unur_ninv_set_usenewton( UNUR_PAR *parameters ); +int unur_ninv_set_usebisect( UNUR_PAR *parameters ); +int unur_ninv_set_max_iter( UNUR_PAR *parameters, int max_iter ); +int unur_ninv_chg_max_iter(UNUR_GEN *generator, int max_iter); +int unur_ninv_set_x_resolution( UNUR_PAR *parameters, double x_resolution); +int unur_ninv_chg_x_resolution(UNUR_GEN *generator, double x_resolution); +int unur_ninv_set_u_resolution( UNUR_PAR *parameters, double u_resolution); +int unur_ninv_chg_u_resolution(UNUR_GEN *generator, double u_resolution); +int unur_ninv_set_start( UNUR_PAR *parameters, double left, double right); +int unur_ninv_chg_start(UNUR_GEN *gen, double left, double right); +int unur_ninv_set_table(UNUR_PAR *parameters, int no_of_points); +int unur_ninv_chg_table(UNUR_GEN *gen, int no_of_points); +int unur_ninv_chg_truncated(UNUR_GEN *gen, double left, double right); +double unur_ninv_eval_approxinvcdf( const UNUR_GEN *generator, double u ); +/* end of `ninv.h' */ +/*-----*/ +/*-----*/ +/* <1> `nrou.h' */ +UNUR_PAR *unur_nrou_new( const UNUR_DISTR *distribution ); +int unur_nrou_set_u( UNUR_PAR *parameters, double umin, double umax ); +int unur_nrou_set_v( UNUR_PAR *parameters, double vmax ); +int unur_nrou_set_r( UNUR_PAR *parameters, double r ); +int unur_nrou_set_center( UNUR_PAR *parameters, double center ); +int unur_nrou_set_verify( UNUR_PAR *parameters, int verify ); +int unur_nrou_chg_verify( UNUR_GEN *generator, int verify ); +/* end of `nrou.h' */ +/*-----*/ +/*-----*/ +/* <1> `pinv.h' */ +UNUR_PAR *unur_pinv_new( const UNUR_DISTR *distribution ); +int unur_pinv_set_order( UNUR_PAR *parameters, int order); +int unur_pinv_set_smoothness( UNUR_PAR *parameters, int smoothness); +int unur_pinv_set_u_resolution( UNUR_PAR *parameters, double u_resolution); +int unur_pinv_set_extra_testpoints( UNUR_PAR *parameters, int n_points); +int unur_pinv_set_use_upoints( UNUR_PAR *parameters, int use_upoints ); +int unur_pinv_set_usepdf( UNUR_PAR *parameters ); +int unur_pinv_set_usecdf( UNUR_PAR *parameters ); +int unur_pinv_set_boundary( UNUR_PAR *parameters, double left, double right ); +int unur_pinv_set_searchboundary( UNUR_PAR *parameters, int left, int right ); +int unur_pinv_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); +int unur_pinv_get_n_intervals( const UNUR_GEN *generator ); +int unur_pinv_set_keepcdf( UNUR_PAR *parameters, int keepcdf); +double unur_pinv_eval_approxinvcdf( const UNUR_GEN *generator, double u ); +double unur_pinv_eval_approxcdf( const UNUR_GEN *generator, double x ); +int unur_pinv_estimate_error( const UNUR_GEN *generator, int samplesize, double *max_error, double *MAE ); +/* end of `pinv.h' */ +/*-----*/ +/*-----*/ +/* <1> `srou.h' */ +UNUR_PAR *unur_srou_new( const UNUR_DISTR *distribution ); +int unur_srou_set_r( UNUR_PAR *parameters, double r ); +int unur_srou_set_cdfatmode( UNUR_PAR *parameters, double Fmode ); +int unur_srou_set_pdfatmode( UNUR_PAR *parameters, double fmode ); +int unur_srou_set_usesqueeze( UNUR_PAR *parameters, int usesqueeze ); +int unur_srou_set_usemirror( UNUR_PAR *parameters, int usemirror ); +int unur_srou_set_verify( UNUR_PAR *parameters, int verify ); +int unur_srou_chg_verify( UNUR_GEN *generator, int verify ); +int unur_srou_chg_cdfatmode( UNUR_GEN *generator, double Fmode ); +int unur_srou_chg_pdfatmode( UNUR_GEN *generator, double fmode ); +/* end of `srou.h' */ +/*-----*/ +/*-----*/ +/* <1> `ssr.h' */ +UNUR_PAR *unur_ssr_new( const UNUR_DISTR *distribution ); +int unur_ssr_set_cdfatmode( UNUR_PAR *parameters, double Fmode ); +int unur_ssr_set_pdfatmode( UNUR_PAR *parameters, double fmode ); +int unur_ssr_set_usesqueeze( UNUR_PAR *parameters, int usesqueeze ); +int unur_ssr_set_verify( UNUR_PAR *parameters, int verify ); +int unur_ssr_chg_verify( UNUR_GEN *generator, int verify ); +int unur_ssr_chg_cdfatmode( UNUR_GEN *generator, double Fmode ); +int unur_ssr_chg_pdfatmode( UNUR_GEN *generator, double fmode ); +/* end of `ssr.h' */ +/*-----*/ +/*-----*/ +/* <1> `tabl.h' */ +UNUR_PAR *unur_tabl_new( const UNUR_DISTR* distribution ); +int unur_tabl_set_variant_ia( UNUR_PAR *parameters, int use_ia ); +int unur_tabl_set_cpoints( UNUR_PAR *parameters, int n_cpoints, const double *cpoints ); +int unur_tabl_set_nstp( UNUR_PAR *parameters, int n_stp ); +int unur_tabl_set_useear( UNUR_PAR *parameters, int useear ); +int unur_tabl_set_areafraction( UNUR_PAR *parameters, double fraction ); +int unur_tabl_set_usedars( UNUR_PAR *parameters, int usedars ); +int unur_tabl_set_darsfactor( UNUR_PAR *parameters, double factor ); +int unur_tabl_set_variant_splitmode( UNUR_PAR *parameters, unsigned splitmode ); +int unur_tabl_set_max_sqhratio( UNUR_PAR *parameters, double max_ratio ); +double unur_tabl_get_sqhratio( const UNUR_GEN *generator ); +double unur_tabl_get_hatarea( const UNUR_GEN *generator ); +double unur_tabl_get_squeezearea( const UNUR_GEN *generator ); +int unur_tabl_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); +int unur_tabl_get_n_intervals( const UNUR_GEN *generator ); +int unur_tabl_set_slopes( UNUR_PAR *parameters, const double *slopes, int n_slopes ); +int unur_tabl_set_guidefactor( UNUR_PAR *parameters, double factor ); +int unur_tabl_set_boundary( UNUR_PAR *parameters, double left, double right ); +int unur_tabl_chg_truncated(UNUR_GEN *gen, double left, double right); +int unur_tabl_set_verify( UNUR_PAR *parameters, int verify ); +int unur_tabl_chg_verify( UNUR_GEN *generator, int verify ); +int unur_tabl_set_pedantic( UNUR_PAR *parameters, int pedantic ); +/* end of `tabl.h' */ +/*-----*/ +/*-----*/ +/* <1> `tdr.h' */ +UNUR_PAR *unur_tdr_new( const UNUR_DISTR* distribution ); +int unur_tdr_set_c( UNUR_PAR *parameters, double c ); +int unur_tdr_set_variant_gw( UNUR_PAR *parameters ); +int unur_tdr_set_variant_ps( UNUR_PAR *parameters ); +int unur_tdr_set_variant_ia( UNUR_PAR *parameters ); +int unur_tdr_set_usedars( UNUR_PAR *parameters, int usedars ); +int unur_tdr_set_darsfactor( UNUR_PAR *parameters, double factor ); +int unur_tdr_set_cpoints( UNUR_PAR *parameters, int n_stp, const double *stp ); +int unur_tdr_set_reinit_percentiles( UNUR_PAR *parameters, int n_percentiles, const double *percentiles ); +int unur_tdr_chg_reinit_percentiles( UNUR_GEN *generator, int n_percentiles, const double *percentiles ); +int unur_tdr_set_reinit_ncpoints( UNUR_PAR *parameters, int ncpoints ); +int unur_tdr_chg_reinit_ncpoints( UNUR_GEN *generator, int ncpoints ); +int unur_tdr_chg_truncated(UNUR_GEN *gen, double left, double right); +int unur_tdr_set_max_sqhratio( UNUR_PAR *parameters, double max_ratio ); +double unur_tdr_get_sqhratio( const UNUR_GEN *generator ); +double unur_tdr_get_hatarea( const UNUR_GEN *generator ); +double unur_tdr_get_squeezearea( const UNUR_GEN *generator ); +int unur_tdr_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); +int unur_tdr_set_usecenter( UNUR_PAR *parameters, int usecenter ); +int unur_tdr_set_usemode( UNUR_PAR *parameters, int usemode ); +int unur_tdr_set_guidefactor( UNUR_PAR *parameters, double factor ); +int unur_tdr_set_verify( UNUR_PAR *parameters, int verify ); +int unur_tdr_chg_verify( UNUR_GEN *generator, int verify ); +int unur_tdr_set_pedantic( UNUR_PAR *parameters, int pedantic ); +double unur_tdr_eval_invcdfhat( const UNUR_GEN *generator, double u, + double *hx, double *fx, double *sqx ); +int _unur_tdr_is_ARS_running( const UNUR_GEN *generator ); +/* end of `tdr.h' */ +/*-----*/ +/*-----*/ +/* <1> `utdr.h' */ +UNUR_PAR *unur_utdr_new( const UNUR_DISTR *distribution ); +int unur_utdr_set_pdfatmode( UNUR_PAR *parameters, double fmode ); +int unur_utdr_set_cpfactor( UNUR_PAR *parameters, double cp_factor ); +int unur_utdr_set_deltafactor( UNUR_PAR *parameters, double delta ); +int unur_utdr_set_verify( UNUR_PAR *parameters, int verify ); +int unur_utdr_chg_verify( UNUR_GEN *generator, int verify ); +int unur_utdr_chg_pdfatmode( UNUR_GEN *generator, double fmode ); +/* end of `utdr.h' */ +/*-----*/ +/*-----*/ +/* <1> `empk.h' */ +UNUR_PAR *unur_empk_new( const UNUR_DISTR *distribution ); +int unur_empk_set_kernel( UNUR_PAR *parameters, unsigned kernel); +int unur_empk_set_kernelgen( UNUR_PAR *parameters, const UNUR_GEN *kernelgen, double alpha, double kernelvar ); +int unur_empk_set_beta( UNUR_PAR *parameters, double beta ); +int unur_empk_set_smoothing( UNUR_PAR *parameters, double smoothing ); +int unur_empk_chg_smoothing( UNUR_GEN *generator, double smoothing ); +int unur_empk_set_varcor( UNUR_PAR *parameters, int varcor ); +int unur_empk_chg_varcor( UNUR_GEN *generator, int varcor ); +int unur_empk_set_positive( UNUR_PAR *parameters, int positive ); +/* end of `empk.h' */ +/*-----*/ +/*-----*/ +/* <1> `empl.h' */ +UNUR_PAR *unur_empl_new( const UNUR_DISTR *distribution ); +/* end of `empl.h' */ +/*-----*/ +/*-----*/ +/* <1> `hist.h' */ +UNUR_PAR *unur_hist_new( const UNUR_DISTR *distribution ); +/* end of `hist.h' */ +/*-----*/ +/*-----*/ +/* <1> `mvtdr.h' */ +UNUR_PAR *unur_mvtdr_new( const UNUR_DISTR *distribution ); +int unur_mvtdr_set_stepsmin( UNUR_PAR *parameters, int stepsmin ); +int unur_mvtdr_set_boundsplitting( UNUR_PAR *parameters, double boundsplitting ); +int unur_mvtdr_set_maxcones( UNUR_PAR *parameters, int maxcones ); +int unur_mvtdr_get_ncones( const UNUR_GEN *generator ); +double unur_mvtdr_get_hatvol( const UNUR_GEN *generator ); +int unur_mvtdr_set_verify( UNUR_PAR *parameters, int verify ); +int unur_mvtdr_chg_verify( UNUR_GEN *generator, int verify ); +/* end of `mvtdr.h' */ +/*-----*/ +/*-----*/ +/* <1> `norta.h' */ +UNUR_PAR *unur_norta_new( const UNUR_DISTR *distribution ); +/* end of `norta.h' */ +/*-----*/ +/*-----*/ +/* <1> `vempk.h' */ +UNUR_PAR *unur_vempk_new( const UNUR_DISTR *distribution ); +int unur_vempk_set_smoothing( UNUR_PAR *parameters, double smoothing ); +int unur_vempk_chg_smoothing( UNUR_GEN *generator, double smoothing ); +int unur_vempk_set_varcor( UNUR_PAR *parameters, int varcor ); +int unur_vempk_chg_varcor( UNUR_GEN *generator, int varcor ); +/* end of `vempk.h' */ +/*-----*/ +/*-----*/ +/* <1> `vnrou.h' */ +UNUR_PAR *unur_vnrou_new( const UNUR_DISTR *distribution ); +int unur_vnrou_set_u( UNUR_PAR *parameters, double *umin, double *umax ); +int unur_vnrou_chg_u( UNUR_GEN *generator, double *umin, double *umax ); +int unur_vnrou_set_v( UNUR_PAR *parameters, double vmax ); +int unur_vnrou_chg_v( UNUR_GEN *generator, double vmax ); +int unur_vnrou_set_r( UNUR_PAR *parameters, double r ); +int unur_vnrou_set_verify( UNUR_PAR *parameters, int verify ); +int unur_vnrou_chg_verify( UNUR_GEN *generator, int verify ); +double unur_vnrou_get_volumehat( const UNUR_GEN *generator ); +/* end of `vnrou.h' */ +/*-----*/ +/*-----*/ +/* <1> `gibbs.h' */ +UNUR_PAR *unur_gibbs_new( const UNUR_DISTR *distribution ); +int unur_gibbs_set_variant_coordinate( UNUR_PAR *parameters ); +int unur_gibbs_set_variant_random_direction( UNUR_PAR *parameters ); +int unur_gibbs_set_c( UNUR_PAR *parameters, double c ); +int unur_gibbs_set_startingpoint( UNUR_PAR *parameters, const double *x0 ); +int unur_gibbs_set_thinning( UNUR_PAR *parameters, int thinning ); +int unur_gibbs_set_burnin( UNUR_PAR *parameters, int burnin ); +const double *unur_gibbs_get_state( UNUR_GEN *generator ); +int unur_gibbs_chg_state( UNUR_GEN *generator, const double *state ); +int unur_gibbs_reset_state( UNUR_GEN *generator ); +/* end of `gibbs.h' */ +/*-----*/ +/*-----*/ +/* <1> `hitro.h' */ +UNUR_PAR *unur_hitro_new( const UNUR_DISTR *distribution ); +int unur_hitro_set_variant_coordinate( UNUR_PAR *parameters ); +int unur_hitro_set_variant_random_direction( UNUR_PAR *parameters ); +int unur_hitro_set_use_adaptiveline( UNUR_PAR *parameters, int adaptive ); +int unur_hitro_set_use_boundingrectangle( UNUR_PAR *parameters, int rectangle ); +int unur_hitro_set_use_adaptiverectangle( UNUR_PAR *parameters, int adaptive ); +int unur_hitro_set_r( UNUR_PAR *parameters, double r ); +int unur_hitro_set_v( UNUR_PAR *parameters, double vmax ); +int unur_hitro_set_u( UNUR_PAR *parameters, const double *umin, const double *umax ); +int unur_hitro_set_adaptive_multiplier( UNUR_PAR *parameters, double factor ); +int unur_hitro_set_startingpoint( UNUR_PAR *parameters, const double *x0 ); +int unur_hitro_set_thinning( UNUR_PAR *parameters, int thinning ); +int unur_hitro_set_burnin( UNUR_PAR *parameters, int burnin ); +const double *unur_hitro_get_state( UNUR_GEN *generator ); +int unur_hitro_chg_state( UNUR_GEN *generator, const double *state ); +int unur_hitro_reset_state( UNUR_GEN *generator ); +/* end of `hitro.h' */ +/*-----*/ +/*-----*/ +/* <1> `cstd.h' */ +#define UNUR_STDGEN_DEFAULT 0 +#define UNUR_STDGEN_INVERSION (~0u) +#define UNUR_STDGEN_FAST (0) +UNUR_PAR *unur_cstd_new( const UNUR_DISTR *distribution ); +int unur_cstd_set_variant( UNUR_PAR *parameters, unsigned variant ); +int unur_cstd_chg_truncated( UNUR_GEN *generator, double left, double right ); +double unur_cstd_eval_invcdf( const UNUR_GEN *generator, double u ); +/* end of `cstd.h' */ +/*-----*/ +/*-----*/ +/* <1> `dstd.h' */ +UNUR_PAR *unur_dstd_new( const UNUR_DISTR *distribution ); +int unur_dstd_set_variant( UNUR_PAR *parameters, unsigned variant ); +int unur_dstd_chg_truncated( UNUR_GEN *generator, int left, int right ); +int unur_dstd_eval_invcdf( const UNUR_GEN *generator, double u ); +/* end of `dstd.h' */ +/*-----*/ +/*-----*/ +/* <1> `mvstd.h' */ +UNUR_PAR *unur_mvstd_new( const UNUR_DISTR *distribution ); +/* end of `mvstd.h' */ +/*-----*/ +/*-----*/ +/* <1> `mixt.h' */ +UNUR_PAR *unur_mixt_new( int n, const double *prob, UNUR_GEN **comp ); +int unur_mixt_set_useinversion( UNUR_PAR *parameters, int useinv ); +double unur_mixt_eval_invcdf( const UNUR_GEN *generator, double u ); +/* end of `mixt.h' */ +/*-----*/ +/*-----*/ +/* <1> `cext.h' */ +UNUR_PAR *unur_cext_new( const UNUR_DISTR *distribution ); +int unur_cext_set_init( UNUR_PAR *parameters, int (*init)(UNUR_GEN *gen) ); +int unur_cext_set_sample( UNUR_PAR *parameters, double (*sample)(UNUR_GEN *gen) ); +void *unur_cext_get_params( UNUR_GEN *generator, size_t size ); +double *unur_cext_get_distrparams( UNUR_GEN *generator ); +int unur_cext_get_ndistrparams( UNUR_GEN *generator ); +/* end of `cext.h' */ +/*-----*/ +/*-----*/ +/* <1> `dext.h' */ +UNUR_PAR *unur_dext_new( const UNUR_DISTR *distribution ); +int unur_dext_set_init( UNUR_PAR *parameters, int (*init)(UNUR_GEN *gen) ); +int unur_dext_set_sample( UNUR_PAR *parameters, int (*sample)(UNUR_GEN *gen) ); +void *unur_dext_get_params( UNUR_GEN *generator, size_t size ); +double *unur_dext_get_distrparams( UNUR_GEN *generator ); +int unur_dext_get_ndistrparams( UNUR_GEN *generator ); +/* end of `dext.h' */ +/*-----*/ +/*-----*/ +/* <1> `unif.h' */ +UNUR_PAR *unur_unif_new( const UNUR_DISTR *dummy ); +/* end of `unif.h' */ +/*-----*/ +/*-----*/ +/* <1> `unur_methods.h' */ +#ifndef UNUR_METHODS_H_SEEN +#define UNUR_METHODS_H_SEEN +#define UNUR_MASK_TYPE 0xff000000u +#define UNUR_METH_DISCR 0x01000000u +#define UNUR_METH_DARI 0x01000001u +#define UNUR_METH_DAU 0x01000002u +#define UNUR_METH_DGT 0x01000003u +#define UNUR_METH_DSROU 0x01000004u +#define UNUR_METH_DSS 0x01000005u +#define UNUR_METH_CONT 0x02000000u +#define UNUR_METH_AROU 0x02000100u +#define UNUR_METH_ARS 0x02000d00u +#define UNUR_METH_HINV 0x02000200u +#define UNUR_METH_HRB 0x02000300u +#define UNUR_METH_HRD 0x02000400u +#define UNUR_METH_HRI 0x02000500u +#define UNUR_METH_ITDR 0x02000800u +#define UNUR_METH_NINV 0x02000600u +#define UNUR_METH_NROU 0x02000700u +#define UNUR_METH_PINV 0x02001000u +#define UNUR_METH_SROU 0x02000900u +#define UNUR_METH_SSR 0x02000a00u +#define UNUR_METH_TABL 0x02000b00u +#define UNUR_METH_TDR 0x02000c00u +#define UNUR_METH_UNIF 0x02000e00u +#define UNUR_METH_UTDR 0x02000f00u +#define UNUR_METH_CEMP 0x04000000u +#define UNUR_METH_EMPK 0x04001100u +#define UNUR_METH_EMPL 0x04001200u +#define UNUR_METH_HIST 0x04001300u +#define UNUR_METH_VEC 0x08000000u +#define UNUR_METH_MVTDR 0x08010000u +#define UNUR_METH_VMT 0x08020000u +#define UNUR_METH_VNROU 0x08030000u +#define UNUR_METH_VAROU 0x08040000u +#define UNUR_METH_NORTA 0x08050000u +#define UNUR_METH_GIBBS 0x08060000u +#define UNUR_METH_HITRO 0x08070000u +#define UNUR_METH_BALL 0x08080000u +#define UNUR_METH_WALK 0x08090000u +#define UNUR_METH_CVEMP 0x10000000u +#define UNUR_METH_VEMPK 0x10010000u +#define UNUR_METH_MAT 0x20000000u +#define UNUR_METH_MCORR 0x20010000u +#define UNUR_METH_CSTD 0x0200f100u +#define UNUR_METH_DSTD 0x0100f200u +#define UNUR_METH_MVSTD 0x0800f300u +#define UNUR_METH_MIXT 0x0200e100u +#define UNUR_METH_CEXT 0x0200f400u +#define UNUR_METH_DEXT 0x0100f500u +#define UNUR_METH_AUTO 0x00a00000u +#define UNUR_METH_UNKNOWN 0xff000000u +#endif +/* end of `unur_methods.h' */ +/*-----*/ +/*-----*/ +/* <1> `deprecated_distr.h' */ +#ifndef UNUR_DEPRECATED_DISTR_H_SEEN +#define UNUR_DEPRECATED_DISTR_H_SEEN +int unur_distr_cvec_set_stdmarginals( UNUR_DISTR *distribution, UNUR_DISTR *marginal ); +int unur_distr_cvec_set_stdmarginal_array( UNUR_DISTR *distribution, UNUR_DISTR **marginals ); +int unur_distr_cvec_set_stdmarginal_list( UNUR_DISTR *distribution, ... ); +const UNUR_DISTR *unur_distr_cvec_get_stdmarginal( const UNUR_DISTR *distribution, int n ); +#endif +/* end of `deprecated_distr.h' */ +/*-----*/ +/*-----*/ +/* <1> `deprecated_methods.h' */ +#ifndef UNUR_DEPRECATED_METHODS_H_SEEN +#define UNUR_DEPRECATED_METHODS_H_SEEN +int unur_cstd_chg_pdfparams( UNUR_GEN *generator, double *params, int n_params ); +int unur_dari_reinit( UNUR_GEN *generator ); +int unur_dari_chg_pmfparams( UNUR_GEN *generator, double *params, int n_params ); +int unur_dari_chg_domain( UNUR_GEN *generator, int left, int right ); +int unur_dari_chg_mode( UNUR_GEN *generator, int mode ); +int unur_dari_upd_mode( UNUR_GEN *generator ); +int unur_dari_chg_pmfsum( UNUR_GEN *generator, double sum ); +int unur_dari_upd_pmfsum( UNUR_GEN *generator ); +int unur_dsrou_reinit( UNUR_GEN *generator ); +int unur_dsrou_chg_pmfparams( UNUR_GEN *generator, double *params, int n_params ); +int unur_dsrou_chg_domain( UNUR_GEN *generator, int left, int right ); +int unur_dsrou_chg_mode( UNUR_GEN *generator, int mode ); +int unur_dsrou_upd_mode( UNUR_GEN *generator ); +int unur_dsrou_chg_pmfsum( UNUR_GEN *generator, double sum ); +int unur_dsrou_upd_pmfsum( UNUR_GEN *generator ); +int unur_dstd_chg_pmfparams( UNUR_GEN *gen, double *params, int n_params ); +int unur_ninv_chg_pdfparams(UNUR_GEN *generator, double *params, int n_params); +int unur_srou_reinit( UNUR_GEN *generator ); +int unur_srou_chg_pdfparams( UNUR_GEN *generator, double *params, int n_params ); +int unur_srou_chg_domain( UNUR_GEN *generator, double left, double right ); +int unur_srou_chg_mode( UNUR_GEN *generator, double mode ); +int unur_srou_upd_mode( UNUR_GEN *generator ); +int unur_srou_chg_pdfarea( UNUR_GEN *generator, double area ); +int unur_srou_upd_pdfarea( UNUR_GEN *generator ); +int unur_ssr_reinit( UNUR_GEN *generator ); +int unur_ssr_chg_pdfparams( UNUR_GEN *generator, double *params, int n_params ); +int unur_ssr_chg_domain( UNUR_GEN *generator, double left, double right ); +int unur_ssr_chg_mode( UNUR_GEN *generator, double mode ); +int unur_ssr_upd_mode( UNUR_GEN *generator ); +int unur_ssr_chg_pdfarea( UNUR_GEN *generator, double area ); +int unur_ssr_upd_pdfarea( UNUR_GEN *generator ); +int unur_tdr_reinit( UNUR_GEN *generator ); +int unur_tdrgw_reinit( UNUR_GEN *generator ); +int unur_utdr_reinit( UNUR_GEN *generator ); +int unur_utdr_chg_pdfparams( UNUR_GEN *generator, double *params, int n_params ); +int unur_utdr_chg_domain( UNUR_GEN *generator, double left, double right ); +int unur_utdr_chg_mode( UNUR_GEN *generator, double mode ); +int unur_utdr_upd_mode( UNUR_GEN *generator ); +int unur_utdr_chg_pdfarea( UNUR_GEN *generator, double area ); +int unur_utdr_upd_pdfarea( UNUR_GEN *generator ); +#endif +/* end of `deprecated_methods.h' */ +/*-----*/ +/*-----*/ +/* <1> `deprecated_tdrgw.h' */ +#define unur_tdrgw_new( distr ) \ + (unur_ars_new( distr )) +#define unur_tdrgw_set_max_intervals( par,max_ivs ) \ + (unur_ars_set_max_intervals( (par),(max_ivs) )) +#define unur_tdrgw_set_cpoints( par,n_cpoints,cpoints ) \ + (unur_ars_set_cpoints( (par),(n_cpoints),(cpoints) )) +#define unur_tdrgw_set_reinit_percentiles( par,n_percentiles,percentiles ) \ + (unur_ars_set_reinit_percentiles( (par),(n_percentiles),(percentiles) )) +#define unur_tdrgw_chg_reinit_percentiles( gen,n_percentiles,percentiles ) \ + (unur_ars_chg_reinit_percentiles( (gen),(n_percentiles),(percentiles) )) +#define unur_tdrgw_set_reinit_ncpoints( par,ncpoints ) \ + (unur_ars_set_reinit_ncpoints( (par),(ncpoints) )) +#define unur_tdrgw_chg_reinit_ncpoints( gen,ncpoints ) \ + (unur_ars_chg_reinit_ncpoints( (gen),(ncpoints) )) +#define unur_tdrgw_set_verify( par,verify ) \ + (unur_ars_set_verify( (par),(verify) )) +#define unur_tdrgw_chg_verify( gen,verify ) \ + (unur_ars_chg_verify( (gen),(verify) )) +#define unur_tdrgw_set_pedantic( par,pedantic ) \ + (unur_ars_set_pedantic( (par),(pedantic) )) +#define unur_tdrgw_get_loghatarea( gen ) \ + (unur_ars_get_loghatarea( gen )) +#define unur_tdrgw_eval_invcdfhat( gen,u ) \ + (unur_ars_eval_invcdfhat( (gen),(u) )) +/* end of `deprecated_tdrgw.h' */ +/*-----*/ +/*-----*/ +/* <1> `deprecated_vmt.h' */ +UNUR_PAR *unur_vmt_new( const UNUR_DISTR *distribution ); +/* end of `deprecated_vmt.h' */ +/*-----*/ +/*-----*/ +/* <1> `parser.h' */ +UNUR_GEN *unur_str2gen( const char *string ); +UNUR_DISTR *unur_str2distr( const char *string ); +UNUR_GEN *unur_makegen_ssu( const char *distrstr, const char *methodstr, UNUR_URNG *urng ); +UNUR_GEN *unur_makegen_dsu( const UNUR_DISTR *distribution, const char *methodstr, UNUR_URNG *urng ); +UNUR_PAR *_unur_str2par( const UNUR_DISTR *distribution, const char *method, struct unur_slist **mlist ); +/* end of `parser.h' */ +/*-----*/ +/*-----*/ +/* <1> `x_gen.h' */ +UNUR_GEN *unur_init( UNUR_PAR *parameters ); +int unur_reinit( UNUR_GEN *generator ); +int unur_sample_discr(UNUR_GEN *generator); +double unur_sample_cont(UNUR_GEN *generator); +int unur_sample_vec(UNUR_GEN *generator, double *vector); +int unur_sample_matr(UNUR_GEN *generator, double *matrix); +double unur_quantile ( UNUR_GEN *generator, double U ); +void unur_free( UNUR_GEN *generator ); +const char *unur_gen_info( UNUR_GEN *generator, int help ); +int unur_get_dimension( const UNUR_GEN *generator ); +const char *unur_get_genid( const UNUR_GEN *generator ); +unsigned int unur_get_method( const UNUR_GEN *generator ); +int unur_gen_is_inversion ( const UNUR_GEN *gen ); +UNUR_DISTR *unur_get_distr( const UNUR_GEN *generator ); +int unur_set_use_distr_privatecopy( UNUR_PAR *parameters, int use_privatecopy ); +UNUR_GEN *unur_gen_clone( const UNUR_GEN *gen ); +void unur_par_free( UNUR_PAR *par); +/* end of `x_gen.h' */ +/*-----*/ +/*-----*/ +/* <1> `unur_distributions.h' */ +#ifndef UNURAN_DISTRIBUTIONS_H_SEEN +#define UNURAN_DISTRIBUTIONS_H_SEEN +/*-----*/ +/* <2> `unur_stddistr.h' */ +#ifndef UNUR_STDDISTR_H_SEEN +#define UNUR_STDDISTR_H_SEEN +#define UNUR_DISTR_STD (0x00000001u) +enum { + UNUR_DISTR_GENERIC = 0x00000000u, + UNUR_DISTR_CORDER = 0x00000010u, + UNUR_DISTR_CXTRANS = 0x00000020u, + UNUR_DISTR_CONDI = 0x00000030u, + UNUR_DISTR_BETA = 0x00000101u, + UNUR_DISTR_CAUCHY = 0x00000201u, + UNUR_DISTR_CHI = 0x00000301u, + UNUR_DISTR_CHISQUARE = 0x00000401u, + UNUR_DISTR_EPANECHNIKOV = 0x00000501u, + UNUR_DISTR_EXPONENTIAL = 0x00000601u, + UNUR_DISTR_EXTREME_I = 0x00000701u, + UNUR_DISTR_EXTREME_II = 0x00000801u, + UNUR_DISTR_F = 0x00000901u, + UNUR_DISTR_GAMMA = 0x00000a01u, + UNUR_DISTR_GHYP = 0x00002401u, + UNUR_DISTR_GIG = 0x00000b01u, + UNUR_DISTR_GIG2 = 0x00002201u, + UNUR_DISTR_HYPERBOLIC = 0x00002301u, + UNUR_DISTR_IG = 0x00002101u, + UNUR_DISTR_LAPLACE = 0x00000c01u, + UNUR_DISTR_LOGISTIC = 0x00000d01u, + UNUR_DISTR_LOGNORMAL = 0x00000e01u, + UNUR_DISTR_LOMAX = 0x00000f01u, + UNUR_DISTR_MEIXNER = 0x00002601u, + UNUR_DISTR_NORMAL = 0x00001001u, + UNUR_DISTR_GAUSSIAN = 0x00001001u, + UNUR_DISTR_PARETO = 0x00001101u, + UNUR_DISTR_POWEREXPONENTIAL = 0x00001201u, + UNUR_DISTR_RAYLEIGH = 0x00001301u, + UNUR_DISTR_SLASH = 0x00001401u, + UNUR_DISTR_STUDENT = 0x00001501u, + UNUR_DISTR_TRIANGULAR = 0x00001601u, + UNUR_DISTR_UNIFORM = 0x00002001u, + UNUR_DISTR_BOXCAR = 0x00002001u, + UNUR_DISTR_VG = 0x00002501u, + UNUR_DISTR_WEIBULL = 0x00001801u, + UNUR_DISTR_BURR_I = 0x0000b001u, + UNUR_DISTR_BURR_II = 0x0000b101u, + UNUR_DISTR_BURR_III = 0x0000b201u, + UNUR_DISTR_BURR_IV = 0x0000b301u, + UNUR_DISTR_BURR_V = 0x0000b401u, + UNUR_DISTR_BURR_VI = 0x0000b501u, + UNUR_DISTR_BURR_VII = 0x0000b601u, + UNUR_DISTR_BURR_VIII = 0x0000b701u, + UNUR_DISTR_BURR_IX = 0x0000b801u, + UNUR_DISTR_BURR_X = 0x0000b901u, + UNUR_DISTR_BURR_XI = 0x0000ba01u, + UNUR_DISTR_BURR_XII = 0x0000bb01u, + UNUR_DISTR_BINOMIAL = 0x00010001u, + UNUR_DISTR_GEOMETRIC = 0x00020001u, + UNUR_DISTR_HYPERGEOMETRIC = 0x00030001u, + UNUR_DISTR_LOGARITHMIC = 0x00040001u, + UNUR_DISTR_NEGATIVEBINOMIAL = 0x00050001u, + UNUR_DISTR_POISSON = 0x00060001u, + UNUR_DISTR_ZIPF = 0x00070001u, + UNUR_DISTR_MCAUCHY = 0x01000001u, + UNUR_DISTR_MNORMAL = 0x02000001u, + UNUR_DISTR_MSTUDENT = 0x03000001u, + UNUR_DISTR_MEXPONENTIAL = 0x04000001u, + UNUR_DISTR_COPULA = 0x05000001u, + UNUR_DISTR_MCORRELATION = 0x10000001u +}; +#endif +/* end of `unur_stddistr.h' */ +/*-----*/ +UNUR_DISTR *unur_distr_beta(const double *params, int n_params); +UNUR_DISTR *unur_distr_burr(const double *params, int n_params); +UNUR_DISTR *unur_distr_cauchy(const double *params, int n_params); +UNUR_DISTR *unur_distr_chi(const double *params, int n_params); +UNUR_DISTR *unur_distr_chisquare(const double *params, int n_params); +UNUR_DISTR *unur_distr_exponential(const double *params, int n_params); +UNUR_DISTR *unur_distr_extremeI(const double *params, int n_params); +UNUR_DISTR *unur_distr_extremeII(const double *params, int n_params); +UNUR_DISTR *unur_distr_F(const double *params, int n_params); +UNUR_DISTR *unur_distr_gamma(const double *params, int n_params); +UNUR_DISTR *unur_distr_ghyp(const double *params, int n_params); +UNUR_DISTR *unur_distr_gig(const double *params, int n_params); +UNUR_DISTR *unur_distr_gig2(const double *params, int n_params); +UNUR_DISTR *unur_distr_hyperbolic(const double *params, int n_params); +UNUR_DISTR *unur_distr_ig(const double *params, int n_params); +UNUR_DISTR *unur_distr_laplace(const double *params, int n_params); +UNUR_DISTR *unur_distr_logistic(const double *params, int n_params); +UNUR_DISTR *unur_distr_lognormal(const double *params, int n_params); +UNUR_DISTR *unur_distr_lomax(const double *params, int n_params); +UNUR_DISTR *unur_distr_meixner(const double *params, int n_params); +UNUR_DISTR *unur_distr_normal( const double *params, int n_params ); +UNUR_DISTR *unur_distr_pareto( const double *params, int n_params ); +UNUR_DISTR *unur_distr_powerexponential(const double *params, int n_params); +UNUR_DISTR *unur_distr_rayleigh(const double *params, int n_params); +UNUR_DISTR *unur_distr_slash(const double *params, int n_params); +UNUR_DISTR *unur_distr_student(const double *params, int n_params); +UNUR_DISTR *unur_distr_triangular(const double *params, int n_params); +UNUR_DISTR *unur_distr_uniform(const double *params, int n_params); +UNUR_DISTR *unur_distr_vg(const double *params, int n_params); +UNUR_DISTR *unur_distr_weibull(const double *params, int n_params); +UNUR_DISTR *unur_distr_multinormal(int dim, const double *mean, const double *covar); +UNUR_DISTR *unur_distr_multicauchy(int dim, const double *mean, const double *covar); +UNUR_DISTR *unur_distr_multistudent(int dim, double nu, const double *mean, const double *covar); +UNUR_DISTR *unur_distr_multiexponential(int dim, const double *sigma, const double *theta); +UNUR_DISTR *unur_distr_copula(int dim, const double *rankcorr); +UNUR_DISTR *unur_distr_correlation( int n ); +UNUR_DISTR *unur_distr_binomial(const double *params, int n_params); +UNUR_DISTR *unur_distr_geometric(const double *params, int n_params); +UNUR_DISTR *unur_distr_hypergeometric(const double *params, int n_params); +UNUR_DISTR *unur_distr_logarithmic(const double *params, int n_params); +UNUR_DISTR *unur_distr_negativebinomial(const double *params, int n_params); +UNUR_DISTR *unur_distr_poisson(const double *params, int n_params); +UNUR_DISTR *unur_distr_zipf(const double *params, int n_params); +#endif +/* end of `unur_distributions.h' */ +/*-----*/ +/*-----*/ +/* <1> `stream.h' */ +FILE *unur_set_stream( FILE *new_stream ); +FILE *unur_get_stream( void ); +/* end of `stream.h' */ +/*-----*/ +/*-----*/ +/* <1> `debug.h' */ +#ifndef DEBUG_H_SEEN +#define DEBUG_H_SEEN +#define UNUR_DEBUG_OFF (0u) +#define UNUR_DEBUG_ALL (~0u) +#define UNUR_DEBUG_INIT 0x00000001u +#define UNUR_DEBUG_SETUP 0x00000fffu +#define UNUR_DEBUG_ADAPT 0x00fff000u +#define UNUR_DEBUG_SAMPLE 0xff000000u +int unur_set_debug( UNUR_PAR *parameters, unsigned debug ); +int unur_chg_debug( UNUR_GEN *generator, unsigned debug ); +int unur_set_default_debug( unsigned debug ); +#endif +/* end of `debug.h' */ +/*-----*/ +/*-----*/ +/* <1> `error.h' */ +extern int unur_errno; +int unur_get_errno ( void ); +void unur_reset_errno ( void ); +const char *unur_get_strerror ( const int errnocode ); +UNUR_ERROR_HANDLER *unur_set_error_handler( UNUR_ERROR_HANDLER *new_handler ); +UNUR_ERROR_HANDLER *unur_set_error_handler_off( void ); +/* end of `error.h' */ +/*-----*/ +/*-----*/ +/* <1> `unur_errno.h' */ +#ifndef UNUR_ERRNO_H_SEEN +#define UNUR_ERRNO_H_SEEN +enum { + UNUR_SUCCESS = 0x00, + UNUR_FAILURE = 0x01, + UNUR_ERR_DISTR_SET = 0x11, + UNUR_ERR_DISTR_GET = 0x12, + UNUR_ERR_DISTR_NPARAMS = 0x13, + UNUR_ERR_DISTR_DOMAIN = 0x14, + UNUR_ERR_DISTR_GEN = 0x15, + UNUR_ERR_DISTR_REQUIRED = 0x16, + UNUR_ERR_DISTR_UNKNOWN = 0x17, + UNUR_ERR_DISTR_INVALID = 0x18, + UNUR_ERR_DISTR_DATA = 0x19, + UNUR_ERR_DISTR_PROP = 0x20, + UNUR_ERR_PAR_SET = 0x21, + UNUR_ERR_PAR_VARIANT = 0x22, + UNUR_ERR_PAR_INVALID = 0x23, + UNUR_ERR_GEN = 0x31, + UNUR_ERR_GEN_DATA = 0x32, + UNUR_ERR_GEN_CONDITION = 0x33, + UNUR_ERR_GEN_INVALID = 0x34, + UNUR_ERR_GEN_SAMPLING = 0x35, + UNUR_ERR_NO_REINIT = 0x36, + UNUR_ERR_NO_QUANTILE = 0x37, + UNUR_ERR_URNG = 0x41, + UNUR_ERR_URNG_MISS = 0x42, + UNUR_ERR_STR = 0x51, + UNUR_ERR_STR_UNKNOWN = 0x52, + UNUR_ERR_STR_SYNTAX = 0x53, + UNUR_ERR_STR_INVALID = 0x54, + UNUR_ERR_FSTR_SYNTAX = 0x55, + UNUR_ERR_FSTR_DERIV = 0x56, + UNUR_ERR_DOMAIN = 0x61, + UNUR_ERR_ROUNDOFF = 0x62, + UNUR_ERR_MALLOC = 0x63, + UNUR_ERR_NULL = 0x64, + UNUR_ERR_COOKIE = 0x65, + UNUR_ERR_GENERIC = 0x66, + UNUR_ERR_SILENT = 0x67, + UNUR_ERR_INF = 0x68, + UNUR_ERR_NAN = 0x69, + UNUR_ERR_COMPILE = 0xa0, + UNUR_ERR_SHOULD_NOT_HAPPEN = 0xf0 +}; +#endif +/* end of `unur_errno.h' */ +/*-----*/ +/*-----*/ +/* <1> `umath.h' */ +#ifndef MATH_H_SEEN +#define MATH_H_SEEN + +#include + +#ifndef INFINITY +extern const double INFINITY; +#endif +#define UNUR_INFINITY (INFINITY) +#ifndef TRUE +#define TRUE (1) +#endif +#ifndef FALSE +#define FALSE (0) +#endif +#endif +/* end of `umath.h' */ +/*-----*/ +/*-----*/ +/* <1> `slist.h' */ +#ifndef SLIST_H_SEEN +#define SLIST_H_SEEN +struct unur_slist *_unur_slist_new( void ); +int _unur_slist_append( struct unur_slist *slist, void *element ); +int _unur_slist_length( const struct unur_slist *slist ); +void *_unur_slist_get( const struct unur_slist *slist, int n ); +void *_unur_slist_replace( struct unur_slist *slist, int n, void *element ); +void _unur_slist_free( struct unur_slist *slist ); +#endif +/* end of `slist.h' */ +/*-----*/ +#ifndef TRUE +#define TRUE (1) +#endif +#ifndef FALSE +#define FALSE (0) +#endif +#endif +__END_DECLS diff --git a/vendor/unuran-1.11.0/src/unuran.h.in b/vendor/unuran-1.11.0/src/unuran.h.in new file mode 100644 index 0000000..9707f7b --- /dev/null +++ b/vendor/unuran-1.11.0/src/unuran.h.in @@ -0,0 +1,206 @@ +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unuran.h * + * * + * PURPOSE: * + * defines macros and declares structures and function prototypes * + * for all UNU.RAN methods * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef UNURAN_H_IN_SEEN +#define UNURAN_H_IN_SEEN +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** Basic header files **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* basic header files */ +#include +#include +#include + +/*****************************************************************************/ +/** Typedefs **/ +/*****************************************************************************/ + +#include + +/*****************************************************************************/ +/** Declarations for uniform random number generators **/ +/*****************************************************************************/ + +#include +#include +#include +#include + +/* The following are now separate header files! */ +/* #include */ +/* #include */ +/* #include */ +/* #include */ + +/*****************************************************************************/ +/** Function prototypes for manipulating distribution objects **/ +/*****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/*****************************************************************************/ +/** Function prototypes for manipulating generator objects **/ +/*****************************************************************************/ + +/* automatically selected method */ +#include + +/* methods for discrete distributions */ +#include +#include +#include +#include +#include + +/* methods for continuous distributions */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* methods for continuous multivariate distributions */ +#include +#include +#include +#include + +/* methods for Markov chain sampler */ +#include +#include + +/* wrapper for special generators for standard distributions */ +#include /* continuous */ +#include /* discrete */ +#include /* multivariate continuous */ + +/* meta methods */ +#include + +/* wrapper for external random variate generators */ +#include /* continuous */ +#include /* discrete */ + +/* wrapper for uniform random number generator */ +#include + +/*****************************************************************************/ +/** IDs for generating methods **/ +/*****************************************************************************/ + +#include + +/*****************************************************************************/ +/** Deprecated routines **/ +/*****************************************************************************/ + +#include +#include +#include +#include + +/*****************************************************************************/ +/** String parser **/ +/*****************************************************************************/ + +#include + +/*****************************************************************************/ +/** Invoke generators **/ +/*****************************************************************************/ + +#include + +/*****************************************************************************/ +/** Distributions **/ +/*****************************************************************************/ + +#include + +/*****************************************************************************/ +/** Debugging and Error messages **/ +/*****************************************************************************/ + +#include +#include +#include +#include + +/*****************************************************************************/ +/** Additional header files for further function prototypes **/ +/*****************************************************************************/ + +#include +#include + + +#ifndef TRUE +#define TRUE (1) +#endif + +#ifndef FALSE +#define FALSE (0) +#endif + +/*---------------------------------------------------------------------------*/ +#endif /* UNURAN_H_IN_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/unuran_config.h b/vendor/unuran-1.11.0/src/unuran_config.h new file mode 100644 index 0000000..49323d2 --- /dev/null +++ b/vendor/unuran-1.11.0/src/unuran_config.h @@ -0,0 +1,134 @@ +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * file: unuran_config.h * + * * + * compiler switches, compile time options and default values * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef UNURAN_CONFIG_H_SEEN +#define UNURAN_CONFIG_H_SEEN +/*---------------------------------------------------------------------------*/ + +/***************************************************************************** + * Logging and debugging. * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Default name of log file. */ +/* */ + +#define UNUR_LOG_FILE "unuran.log" + +/*---------------------------------------------------------------------------*/ +/* Set default flag for debugging of generators: */ +/* */ +/* UNUR_DEBUG_OFF ... switch off debugging information */ +/* UNUR_DEBUG_INIT ... pameters and structure of generator only */ +/* UNUR_DEBUG_SETUP ... information for setup step */ +/* UNUR_DEBUG_ADAPT ... trace adaptive steps */ +/* UNUR_DEBUG_SAMPLE ... trace sampling */ +/* UNUR_DEBUG_ALL ... write all available debugging information */ +/* */ +/* Detailed discription of possible flags in file `./utils/debug.h' */ +/* */ +/* Debugging information is written into the log file. */ +/* It only works if the library is built with the ----enable-logging */ +/* configure flag. */ + +#define UNUR_DEBUGFLAG_DEFAULT UNUR_DEBUG_INIT + + +/***************************************************************************** + * Compile time parameters for generators. * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Distribution objects. */ + +/* Maximal number of parameters for the PDF of a distribution. */ +/* (It must be at least 5!) */ +#define UNUR_DISTR_MAXPARAMS 5 + +/* Maximal size of automatically created probability vectors. */ +#define UNUR_MAX_AUTO_PV 100000 + + +/***************************************************************************** + * Interface for uniform random number generators. * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Default generators */ + +/* Macros 'UNUR_URNG_DEFAULT' and 'UNUR_URNG_AUX_DEFAULT' must expand to */ +/* (a function returning) an object of type UNUR_URNG. */ +/* */ +/* IMPORTANT! */ +/* */ +/* When a particular default is chosen then the corresponding library must */ +/* be installed and the wrapper functions must be enabled by defining the */ +/* above macros. Moreover, the library must linked when creating an */ +/* executable. */ +/* */ +/* If you have none of these libraries use type FVOID. */ +/* */ + +/* The following is switched on by the configure flag */ +/* --with-urng-default=rngstream */ + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +/* use type RNGSTREAM (recommended!) */ +# define UNUR_URNG_DEFAULT (unur_urng_rngstream_new("URNG_main")) +# define UNUR_URNG_AUX_DEFAULT (unur_urng_rngstream_new("URNG_aux")) + +/* else we assume that we have */ +/* --with-urng-default=builtin */ + +#else +/* use type FVOID (built-in) */ +# define UNUR_URNG_DEFAULT (unur_urng_builtin()) +# define UNUR_URNG_AUX_DEFAULT (unur_urng_builtin_aux()) +#endif + +/* However, it is also possible to use any other URNG. */ +/* Then one must comment out the above #definitions (and thus disables the */ +/* the corresponding configure flags) and #defines new ones. */ +/* Here are two examples: */ + +/* use type PRNG */ +/* #define UNUR_URNG_DEFAULT (unur_urng_prng_new("mt19937(19863)")) */ +/* #define UNUR_URNG_AUX_DEFAULT (unur_urng_prng_new("LCG(2147483647,16807,0,1)")) */ + +/* use type GSL */ +/* #define UNUR_URNG_DEFAULT (unur_urng_gsl_new(gsl_rng_mt19937)) */ +/* #define UNUR_URNG_AUX_DEFAULT (unur_urng_gsl_new(gsl_rng_cmrg)) */ + +/*---------------------------------------------------------------------------*/ +#endif /* UNURAN_CONFIG_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/urng/.libs/liburng.a b/vendor/unuran-1.11.0/src/urng/.libs/liburng.a new file mode 100644 index 0000000..1901530 Binary files /dev/null and b/vendor/unuran-1.11.0/src/urng/.libs/liburng.a differ diff --git a/vendor/unuran-1.11.0/src/urng/Makefile b/vendor/unuran-1.11.0/src/urng/Makefile new file mode 100644 index 0000000..08cd498 --- /dev/null +++ b/vendor/unuran-1.11.0/src/urng/Makefile @@ -0,0 +1,635 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# src/urng/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/unuran +pkgincludedir = $(includedir)/unuran +pkglibdir = $(libdir)/unuran +pkglibexecdir = $(libexecdir)/unuran +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +subdir = src/urng +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +liburng_la_LIBADD = +am_liburng_la_OBJECTS = urng.lo urng_set.lo urng_default.lo \ + urng_unuran.lo +liburng_la_OBJECTS = $(am_liburng_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I. -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/urng.Plo \ + ./$(DEPDIR)/urng_default.Plo ./$(DEPDIR)/urng_set.Plo \ + ./$(DEPDIR)/urng_unuran.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(liburng_la_SOURCES) +DIST_SOURCES = $(liburng_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_CFLAGS = -Wall -Wextra -Wshadow -Wstrict-prototypes +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf +AUTOHEADER = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader +AUTOMAKE = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -fPIC +CPP = gcc -E +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +FILECMD = file +GREP = /usr/bin/grep +HAVE_DIVIDE_BY_ZERO = +HAVE_IEEE_COMPARISONS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAINT = # +MAKEINFO = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = unuran +PACKAGE_BUGREPORT = unuran@statmath.wu.ac.at +PACKAGE_NAME = unuran +PACKAGE_STRING = unuran 1.11.0 +PACKAGE_TARNAME = unuran +PACKAGE_URL = +PACKAGE_VERSION = 1.11.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +UNURAN_LT_VERSION = 16:1:0 +UNURAN_SUPPORTS_GSL = +UNURAN_SUPPORTS_PRNG = +UNURAN_SUPPORTS_RNGSTREAM = +VERSION = 1.11.0 +abs_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src/urng +abs_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src/urng +abs_top_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +have_valgrind = false +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../../ +top_builddir = ../.. +top_srcdir = ../.. +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = liburng.la +liburng_la_SOURCES = \ + urng_source.h urng_struct.h \ + urng.h urng.c urng_set.c urng_default.c \ + urng_unuran.c + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/urng/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/urng/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +liburng.la: $(liburng_la_OBJECTS) $(liburng_la_DEPENDENCIES) $(EXTRA_liburng_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(liburng_la_OBJECTS) $(liburng_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/urng.Plo # am--include-marker +include ./$(DEPDIR)/urng_default.Plo # am--include-marker +include ./$(DEPDIR)/urng_set.Plo # am--include-marker +include ./$(DEPDIR)/urng_unuran.Plo # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ $< + +.c.obj: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: + $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +# $(AM_V_CC)source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/urng.Plo + -rm -f ./$(DEPDIR)/urng_default.Plo + -rm -f ./$(DEPDIR)/urng_set.Plo + -rm -f ./$(DEPDIR)/urng_unuran.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/urng.Plo + -rm -f ./$(DEPDIR)/urng_default.Plo + -rm -f ./$(DEPDIR)/urng_set.Plo + -rm -f ./$(DEPDIR)/urng_unuran.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/urng/Makefile.am b/vendor/unuran-1.11.0/src/urng/Makefile.am new file mode 100644 index 0000000..d799583 --- /dev/null +++ b/vendor/unuran-1.11.0/src/urng/Makefile.am @@ -0,0 +1,18 @@ +## Process this file with automake to produce Makefile.in + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = liburng.la + +liburng_la_SOURCES = \ + urng_source.h urng_struct.h \ + urng.h urng.c urng_set.c urng_default.c \ + urng_unuran.c + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/vendor/unuran-1.11.0/src/urng/Makefile.in b/vendor/unuran-1.11.0/src/urng/Makefile.in new file mode 100644 index 0000000..a771344 --- /dev/null +++ b/vendor/unuran-1.11.0/src/urng/Makefile.in @@ -0,0 +1,635 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/urng +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +liburng_la_LIBADD = +am_liburng_la_OBJECTS = urng.lo urng_set.lo urng_default.lo \ + urng_unuran.lo +liburng_la_OBJECTS = $(am_liburng_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/urng.Plo \ + ./$(DEPDIR)/urng_default.Plo ./$(DEPDIR)/urng_set.Plo \ + ./$(DEPDIR)/urng_unuran.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(liburng_la_SOURCES) +DIST_SOURCES = $(liburng_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ +UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ +UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ +UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_valgrind = @have_valgrind@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = liburng.la +liburng_la_SOURCES = \ + urng_source.h urng_struct.h \ + urng.h urng.c urng_set.c urng_default.c \ + urng_unuran.c + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/urng/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/urng/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +liburng.la: $(liburng_la_OBJECTS) $(liburng_la_DEPENDENCIES) $(EXTRA_liburng_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(liburng_la_OBJECTS) $(liburng_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_default.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_set.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_unuran.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/urng.Plo + -rm -f ./$(DEPDIR)/urng_default.Plo + -rm -f ./$(DEPDIR)/urng_set.Plo + -rm -f ./$(DEPDIR)/urng_unuran.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/urng.Plo + -rm -f ./$(DEPDIR)/urng_default.Plo + -rm -f ./$(DEPDIR)/urng_set.Plo + -rm -f ./$(DEPDIR)/urng_unuran.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/urng/urng.c b/vendor/unuran-1.11.0/src/urng/urng.c new file mode 100644 index 0000000..8f81ea3 --- /dev/null +++ b/vendor/unuran-1.11.0/src/urng/urng.c @@ -0,0 +1,173 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: urng.c * + * * + * Unified interface for UNURAN uniform random number generators. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#include +#include "urng.h" +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Sample from and reset an URNG object **/ +/** **/ +/*****************************************************************************/ + +double +unur_urng_sample (UNUR_URNG *urng) + /*----------------------------------------------------------------------*/ + /* Sample from URNG object. */ + /* */ + /* parameters: */ + /* urng ... pointer to URNG object */ + /* */ + /* return: */ + /* uniform random number */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + /* check argument */ + if (urng == NULL) + /* use default generator */ + urng = unur_get_default_urng(); + + return _unur_call_urng(urng); +} /* end of unur_urng_sample() */ + +/*---------------------------------------------------------------------------*/ + +double +unur_sample_urng (UNUR_GEN *gen) + /*----------------------------------------------------------------------*/ + /* Sample from underlying URNG object. */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* uniform random number */ + /* */ + /* error: */ + /* return UNUR_INFINITY */ + /*----------------------------------------------------------------------*/ +{ + struct unur_urng *urng = (gen) ? gen->urng : unur_get_default_urng(); + return _unur_call_urng(urng); +} /* end of unur_sample_urng() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_urng_sample_array (UNUR_URNG *urng, double *X, int dim) + /*----------------------------------------------------------------------*/ + /* Sample from URNG object and fill array X. */ + /* if URNG has a "natural" dimension s then only the first min(s,dim) */ + /* entries are filled. */ + /* */ + /* parameters: */ + /* urng ... pointer to URNG object */ + /* X ... pointer to array of (at least) length dim */ + /* dim ... (maximal) number of entries in X to be set */ + /* */ + /* return: */ + /* number of uniform random numbers filled into array */ + /* */ + /* error: */ + /* return 0 */ + /*----------------------------------------------------------------------*/ +{ + /* check argument */ + if (urng == NULL) + /* use default generator */ + urng = unur_get_default_urng(); + + if (urng->samplearray) { + return (urng->samplearray(urng->state,X,dim)); + } + else { + int i; + for (i=0; ireset != NULL) { + urng->reset (urng->state); + return UNUR_SUCCESS; + } + + /* if no reset function exists, we look for an initial seed */ + if (urng->setseed != NULL && urng->seed != ULONG_MAX) { + unur_urng_seed(urng,urng->seed); + return UNUR_SUCCESS; + } + + /* neither works */ + _unur_error("URNG",UNUR_ERR_URNG_MISS,"reset"); + return UNUR_ERR_URNG_MISS; + +#else + + return _unur_call_reset(urng); + +#endif + +} /* end of unur_urng_reset() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/urng/urng.h b/vendor/unuran-1.11.0/src/urng/urng.h new file mode 100644 index 0000000..9438a23 --- /dev/null +++ b/vendor/unuran-1.11.0/src/urng/urng.h @@ -0,0 +1,579 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: urng.h * + * * + * PURPOSE: * + * declares macros and function prototypes for using uniform * + * random number generators inside UNU.RAN. * + * * + * USAGE: * + * only included in unuran.h * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef URNG_H_SEEN +#define URNG_H_SEEN +/*---------------------------------------------------------------------------*/ + +/* + =NODE URNG Using uniform random number generators + + =UP TOP [50] + + =DESCRIPTION + UNU.RAN is designed to work with many sources of (pseudo-) random + numbers or low discrepancy numbers (so called quasi-random + numbers) for almost all tasks in discrete event simulation, + (quasi-) Monte Carlo integration or any other stochastic + methods. Hence UNU.RAN uses pointers to access uniform (pseudo-) + random number generators (URNG). + + Each UNU.RAN (non-uniform random variate) generator object has a + pointer to a URNG object. Thus each UNU.RAN generator object may + have its own (independent) URNG or several generator objects can + share the same URNG. + + If no URNG is provided for a parameter or generator object a default + generator is used which is the same for all generators. This URNG is + defined in @file{unuran_config.h} at compile time and can be + changed at runtime. + + UNU.RAN uses a unified interface for all sources of random numbers. + Unfortunately, the API for random number generators, like the + @file{GSL} (GNU Scientific Library), Otmar Lendl's @file{prng} + (Pseudo random number generators), or a single function + implemented by the user herself, are quite different. + Hence an object of type @code{UNUR_URNG} is introduced to store + the URNG. Thus it is possible to handle different sources of + such URNGs with the unified API. It is inspired from similar to + Pierre L'Ecuyers @file{RngStreams} library: + + @itemize @minus + @item seed the random number generator; + @item get a uniform random number; + @item reset the URNG; + @item skip to the begining next substream; + @item sample antithetic numbers; + @item delete the URNG object. + @end itemize + + The routine to create a URNG depends on the chosen random number + generator (i.e. library). Nevertheless, there exist wrapper + functions to simplify this task. + + Currently the following sources of uniform random numbers are + directly supported (i.e., there exist wrapper functions). + Of course other random number generation libraries can be used. + + @enumerate + + @item + @code{FVOID} + + URNGs of type @code{double uniform(void *state)}. + The argument @var{state} can be simply ignored in the + implementation of @code{uniform} when a global state variable is + used. + UNU.RAN contains some build-in URNGs of this type in directory + @file{src/uniform/}. + + @item + @code{PRNG} + + URNGs from Otmar Lendl's @code{prng} library. It provides a very + flexible way to sample form arbitrary URNGs by means of an object + oriented programing paradigma. Similarly to the UNU.RAN library + independent generator objects can be build and used. + + This library has been developed by the pLab group at the university + of Salzburg (Austria, EU) and implemented by Otmar Lendl. + It is available from + @uref{http://statmath.wu.ac.at/prng/} + or from the pLab site at + @uref{http://random.mat.sbg.ac.at/}. + + This interface must be compiled into UNU.RAN using the + configure flag @code{--with-urng-prng}. + + @item + @code{RNGSTREAM} + + Pierre L'Ecuyer's @code{RngStream} library for multiple + independent streams of pseudo-random numbers. + A GNU-style package is available from + @uref{http://statmath.wu.ac.at/software/RngStreams/}. + + This interface must be compiled into UNU.RAN using the + configure flag @code{--with-urng-rngstream}. + + @item + @code{GSL} + + URNG from the GNU Scientific Library (GSL). + It is available from + @uref{http://www.gnu.org/software/gsl/}. + + This interface must be compiled into UNU.RAN using the + configure flag @code{--with-urng-gsl}. + + @end enumerate + + =HOWTOUSE + Each UNU.RAN generator object has a pointer to a uniform + (pseudo-) random number generator (URNG). It can be set via the + unur_set_urng() call. It is also possible to read this pointer + via unur_get_urng() or change the URNG for an existing generator + object by means of unur_chg_urng(). + + It is important to note that these calls only copy the pointer + to the URNG object into the generator object. + + If no URNG is provided for a parameter or generator object a default + URNG is used which is the same for all generators. This URNG is + defined in @file{unuran_config.h} at compile time. A pointer to + this default URNG can be obtained via unur_get_default_urng(). + Nevertheless, it is also possible to change this default URNG by + another one at runtime by means of the unur_set_default_urng() + call. However, this only takes effect for new parameter objects. + + Some generating methods provide the possibility of correlation + induction. For this feature a second auxiliary URNG is required. + It can be set and changed by unur_set_urng_aux() and + unur_chg_urng_aux() calls, respectively. Since the auxiliary + URNG is by default the same as the main URNG, the + auxiliary URNG must be set after any unur_set_urng() or + unur_chg_urng() call! Since in special cases mixing of two URNG + might cause problems, we supply a default auxiliary generator + that can be used by a unur_use_urng_aux_default() call (after + the main URNG has been set). This default auxiliary generator + can be changed with analogous calls as the (main) default + uniform generator. + + Uniform random number generators form different sources have + different programming interfaces. Thus UNU.RAN stores all + information about a particular uniform random number generator + in a structure of type @code{UNUR_URNG}. Before a URNG can be + used with UNU.RAN an appropriate object has to be created ba a + unur_urng_new() call. + This call takes two arguments: the pointer to the sampling + routine of the generator and a pointer to a possible argument + that stores the state of the generator. The function must be of + type @code{double (*sampleunif)(void *params)}, but functions + without any argument also work. + Additionally one can set pointers to functions for reseting or + jumping the streams generated by the URNG by the corresponding + @code{set} calls. + + UNU.RAN provides a unified API to all sources of random numbers. + Notice, however, that not all functions work for all random + number generators (as the respective library has not implemented + the corresponding feature). + + There are wrapper functions for some libraries of uniform random + number generators to simplify the task of creating a UNU.RAN + object for URNGs. + These functions must be compiled into UNU.RAN using the + corresponding configure flags (see description of the respective + interface below). + + =END + +*/ + +/*---------------------------------------------------------------------------*/ + +/* =ROUTINES */ + +/*---------------------------------------------------------------------------*/ + +/* ==DOC + @subheading Set and get default uniform RNGs +*/ + +UNUR_URNG *unur_get_default_urng( void ); +/* + Get the pointer to the default URNG. The default URNG is used by all + generators where no URNG was set explicitly by a unur_set_urng() + call. +*/ + +UNUR_URNG *unur_set_default_urng( UNUR_URNG *urng_new ); +/* + Change the default URNG that is used for new parameter objects. + It returns the pointer to the old default URNG that has been used. +*/ + + +UNUR_URNG *unur_set_default_urng_aux( UNUR_URNG *urng_new ); +/* */ + +UNUR_URNG *unur_get_default_urng_aux( void ); +/* + Analogous calls for default auxiliary generator. +*/ + +/*---------------------------------------------------------------------------*/ + +/* ==DOC + @subheading Set, change and get uniform RNGs in generator objects +*/ + +int unur_set_urng( UNUR_PAR *parameters, UNUR_URNG *urng ); +/* + Use the URNG @code{urng} for the new generator. This overrides the + default URNG. It also sets the auxiliary URNG to @code{urng}. + + @emph{Important}: For multivariate distributions that use + marginal distributions this call does not work properly. + It is then better first to create the generator object (by + a unur_init() call) and then change the URNG by means of + unur_chg_urng(). +*/ + +UNUR_URNG *unur_chg_urng( UNUR_GEN *generator, UNUR_URNG *urng ); +/* + Change the URNG for the given generator. It returns the pointer to + the old URNG that has been used by the generator. + It also changes the auxiliary URNG to @code{urng} and thus it + overrides the last unur_chg_urng_aux() call. +*/ + +UNUR_URNG *unur_get_urng( UNUR_GEN *generator ); +/* + Get the pointer to the URNG that is used by the @var{generator}. + This is usefull if two generators should share the same URNG. +*/ + +int unur_set_urng_aux( UNUR_PAR *parameters, UNUR_URNG *urng_aux ); +/* + Use the auxiliary URNG @code{urng_aux} for the new generator. + (Default is the default URNG or the URNG from the last + unur_set_urng() call. Thus if the auxiliary generator should be + different to the main URNG, unur_set_urng_aux() must be called after + unur_set_urng(). + The auxiliary URNG is used as second stream of uniform random + number for correlation induction. + It is not possible to set an auxiliary URNG for a method that does + not need one. In this case an error code is returned. +*/ + +int unur_use_urng_aux_default( UNUR_PAR *parameters ); +/* + Use the default auxiliary URNG. + (It must be set after unur_get_urng().) + It is not possible to set an auxiliary URNG for a method that does + not use one (i.e. the call returns an error code). +*/ + +int unur_chgto_urng_aux_default( UNUR_GEN *generator ); +/* + Switch to default auxiliary URNG. + (It must be set after unur_get_urng().) + It is not possible to set an auxiliary URNG for a method that does + not use one (i.e. the call returns an error code). +*/ + +UNUR_URNG *unur_chg_urng_aux( UNUR_GEN *generator, UNUR_URNG *urng_aux ); +/* + Change the auxiliary URNG for the given @var{generator}. It returns + the pointer to the old auxiliary URNG that has been used by the + generator. It has to be called after each unur_chg_urng() when the + auxiliary URNG should be different from the main URNG. + It is not possible to change the auxiliary URNG for a method that + does not use one (i.e. the call NULL). +*/ + +UNUR_URNG *unur_get_urng_aux( UNUR_GEN *generator ); +/* + Get the pointer to the auxiliary URNG that is used by the + @var{generator}. This is usefull if two generators should share the same + URNG. +*/ + +/*---------------------------------------------------------------------------*/ + +/* ==DOC + @subheading Handle uniform RNGs + + @emph{Notice:} Some of the below function calls do not work for + every source of random numbers since not every library has + implemented these features. + +*/ + +double unur_urng_sample (UNUR_URNG *urng); +/* + Get a uniform random number from @var{urng}. + If the NULL pointer is given, the default uniform generator is + used. +*/ + +double unur_sample_urng (UNUR_GEN *gen); +/* + Get a uniform random number from the underlying uniform + random number generator of generator @var{gen}. + If the NULL pointer is given, the default uniform generator is + used. +*/ + +int unur_urng_sample_array (UNUR_URNG *urng, double *X, int dim); +/* + Set array @var{X} of length @var{dim} with uniform random numbers + sampled from generator @var{urng}. If @var{urng} is the NULL + pointer, the default uniform generator is used. + + @emph{Important:} + If @var{urng} is based on a point set generator (this is the case + for generators of low discrepance point sets as used in quasi-Monte + Carlo methods) it has a ``natural dimension'' @i{s}. + In this case either only the first @i{s} entries of @var{X} are + filled (if @i{s} < @var{dim}), or the first @var{dim} coordinates + of the generated point are filled. + + The called returns the actual number of entries filled. In case of + an error @code{0} is returned. +*/ + +int unur_urng_reset (UNUR_URNG *urng); +/* + Reset @var{urng} object. + The routine tries two ways to reset the generator (in this order): + + @enumerate + @item + It uses the reset function given by an unur_urng_set_reset() + call. + + @item + It uses the seed given by the last unur_urng_seed() call (which + requires a seeding function given by a unur_urng_set_seed() + call). + @end enumerate + + If neither of the two methods work resetting of the generator is + not possible and an error code is returned. + + If the NULL pointer is given, the default uniform generator is + reset. +*/ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_URNG_UNURAN +/*---------------------------------------------------------------------------*/ + +int unur_urng_sync (UNUR_URNG *urng); +/* + Jump into defined state ("sync") of the generator. This is useful + when point generators are used where the coordinates are + sampled via unur_urng_sample(). Then this call can be used to + jump to the first coordinate of the next generated point. +*/ + +int unur_urng_seed (UNUR_URNG *urng, unsigned long seed); +/* + Set @var{seed} for generator @var{urng}. + It returns an error code if this is not possible for the given + URNG. If the NULL pointer is given, the default uniform generator is + seeded (if possible). + + @emph{Notice}: Seeding should be done only once for a particular + generator (except for resetting it to the initial state). + Expertise is required when multiple seeds are used to get independent + streams. Thus we recommend appropriate libraries for this task, + e.g. Pierre L'Ecuyer's @file{RngStreams} package. For this library + only a package seed can be set and thus the unur_urng_seed() call + will not have any effect to generators of this type. Use + unur_urng_reset() or unur_urng_rngstream_new() instead, depending + whether one wants to reset the stream or get a new stream that is + independent from the previous ones. +*/ + +int unur_urng_anti (UNUR_URNG *urng, int anti); +/* + Switch to antithetic random numbers in @var{urng}. + It returns an error code if this is not possible for the given + URNG. + + If the NULL pointer is given, the antithetic flag of the default + uniform generator is switched (if possible). +*/ + +int unur_urng_nextsub (UNUR_URNG *urng); +/* + Jump to start of the next substream of @var{urng}. + It returns an error code if this is not possible for the given + URNG. + + If the NULL pointer is given, the default uniform generator is set + to the start of the next substream (if possible). +*/ + +int unur_urng_resetsub (UNUR_URNG *urng); +/* + Jump to start of the current substream of @var{urng}. + It returns an error code if this is not possible for the given + URNG. + + If the NULL pointer is given, the default uniform generator is set + to the start of the current substream (if possible). +*/ + +int unur_gen_sync (UNUR_GEN *generator); +/* */ + +int unur_gen_seed (UNUR_GEN *generator, unsigned long seed); +/* */ + +int unur_gen_anti (UNUR_GEN *generator, int anti); +/* */ + +int unur_gen_reset (UNUR_GEN *generator); +/* */ + +int unur_gen_nextsub (UNUR_GEN *generator); +/* */ + +int unur_gen_resetsub (UNUR_GEN *generator); +/* + Analogous to unur_urng_sync(), unur_urng_seed(), unur_urng_anti(), + unur_urng_reset(), unur_urng_nextsub(), and unur_urng_resetsub(), + but act on the URNG object used by the @var{generator} object. + + @emph{Warning:} These calls should be used with care as it + influences all generator objects that share the same URNG object! +*/ + +/*---------------------------------------------------------------------------*/ + +/* ==DOC + @subheading API to create a new URNG object + + @emph{Notice:} These functions are provided to built a + UNUR_URNG object for a particular external random number + generator from scratch. For some libraries that contain random + number generators (like the GSL) there are special calls, + e.g. unur_urng_gsl_new(), to get such an object. Then there is no + need to change the UNUR_URNG object as it already contains all + available features. + + If you have a particular library for random number generators you + can either write wrapper function like those in + @file{src/uniform/urng_gsl.c} or write an email to the authors of + UNU.RAN to write it for you. +*/ + +UNUR_URNG *unur_urng_new( double (*sampleunif)(void *state), void *state ); +/* + Get a new URNG object. + @var{sampleunif} is a function to the uniform sampling routine, + @var{state} a pointer to its arguments which usually contains the + state variables of the generator. + + Functions @var{sampleunif} with a different type for @var{p} or + without an argument at all also work. A typecast might be necessary + to avoid compiler warnings or error messages. + + For functions @var{sampleunif} that does not have any argument + should use NULL for @var{state}. + + @emph{Important:} @var{sampleunif} must not be the NULL pointer. + + There are appropriate calls that simplifies the task of creating + URNG objects for some libraries with uniform random number + generators, see below. +*/ + +void unur_urng_free (UNUR_URNG *urng); +/* + Destroy @var{urng} object. + It returns an error code if this is not possible. + + If the NULL is given, this function does nothing. + + @emph{Warning:} This call must be used with care. The @var{urng} + object must not be used by any existing generator object! + It is designed to work in conjunction with the wrapper functions + to create URNG objects for generators of a particular library. + Thus an object created by an unur_urng_prng_new() call can be + simply destroyed by an unur_urng_free() call. +*/ + +int unur_urng_set_sample_array( UNUR_URNG *urng, unsigned int (*samplearray)(void *state, double *X, int dim) ); +/* + Set function to fill array @var{X} of length @var{dim} with random + numbers generated by generator @var{urng} (if available). +*/ + +int unur_urng_set_sync( UNUR_URNG *urng, void (*sync)(void *state) ); +/* + Set function for jumping into a defined state (``sync''). +*/ + +int unur_urng_set_seed( UNUR_URNG *urng, void (*setseed)(void *state, unsigned long seed) ); +/* + Set function to seed generator @var{urng} (if available). +*/ + +int unur_urng_set_anti( UNUR_URNG *urng, void (*setanti)(void *state, int anti) ); +/* + Set function to switch the antithetic flag of generator @var{urng} + (if available). +*/ + +int unur_urng_set_reset( UNUR_URNG *urng, void (*reset)(void *state) ); +/* + Set function for reseting the uniform random number generator + @var{urng} (if available). +*/ + +int unur_urng_set_nextsub( UNUR_URNG *urng, void (*nextsub)(void *state) ); +/* + Set function that allows jumping to start of the next substream of + @var{urng} (if available). +*/ + +int unur_urng_set_resetsub( UNUR_URNG *urng, void (*resetsub)(void *state) ); +/* + Set function that allows jumping to start of the current substream + of @var{urng} (if available). +*/ + +int unur_urng_set_delete( UNUR_URNG *urng, void (*fpdelete)(void *state) ); +/* + Set function for destroying @var{urng} (if available). +*/ + +/*---------------------------------------------------------------------------*/ +#endif /* end defined(UNUR_URNG_UNURAN) */ +/*---------------------------------------------------------------------------*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ +#endif /* URNG_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/urng/urng_default.c b/vendor/unuran-1.11.0/src/urng/urng_default.c new file mode 100644 index 0000000..009f4c2 --- /dev/null +++ b/vendor/unuran-1.11.0/src/urng/urng_default.c @@ -0,0 +1,197 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: urng_default.c * + * * + * routines to set, change and get the pointers to the * + * UNURAN default uniform random number generators. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include "urng.h" +#include +#include +#include + +#if defined(UNURAN_HAS_GSL) && defined(UNUR_URNG_UNURAN) +# include +# include +#endif + +#if defined(UNURAN_HAS_PRNG) && defined(UNUR_URNG_UNURAN) +# include +#endif + +#if defined(UNURAN_HAS_RNGSTREAM) && defined(UNUR_URNG_UNURAN) +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* pointer to default uniform random number generator */ + +static UNUR_URNG *urng_default = NULL; +static UNUR_URNG *urng_aux_default = NULL; + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Main uniform random number generator **/ +/** **/ +/*****************************************************************************/ + +UNUR_URNG * +unur_get_default_urng( void ) + /*----------------------------------------------------------------------*/ + /* return default uniform random number generator */ + /* (initialize generator if necessary) */ + /* */ + /* parameters: none */ + /* */ + /* return: */ + /* pointer to default generator */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + /* default generator already running ? */ + if( urng_default == NULL ) { + /* have to initialize default generator first */ + urng_default = UNUR_URNG_DEFAULT; + + if( urng_default == NULL ) { + /* some parameters invalid! */ + _unur_error("URNG",UNUR_ERR_NULL,"Cannot set default URNG. EXIT !!!"); +#ifndef R_UNURAN + /* we cannot recover from this error */ + exit(EXIT_FAILURE); +#endif + /* Remark: When the library is used in R package 'Runuran', */ + /* then this case should not happen. */ + } + } + + /* return default generator */ + return (urng_default); +} /* end of unur_get_default_urng() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG * +unur_set_default_urng( UNUR_URNG *urng_new ) + /*----------------------------------------------------------------------*/ + /* set default uniform random number generator and return old one */ + /* */ + /* parameters: pointer to new default uniform random number generator */ + /* */ + /* return: */ + /* pointer to old uniform random number generator */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng_old = urng_default; + + /* NULL pointer not allowed */ + _unur_check_NULL("URNG", urng_new, urng_default); + + urng_default = urng_new; /* set urng */ + + /* return old default generator */ + return (urng_old); +} /* end of unur_set_default_urng() */ + + +/*****************************************************************************/ +/** **/ +/** Auxiliary uniform random number generator **/ +/** **/ +/*****************************************************************************/ + +UNUR_URNG * +unur_get_default_urng_aux( void ) + /*----------------------------------------------------------------------*/ + /* return default auxilliary uniform random number generator */ + /* (initialize generator if necessary) */ + /* */ + /* parameters: none */ + /* */ + /* return: */ + /* pointer to default auxilliary uniform generator */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + /* default generator already running ? */ + if( urng_aux_default == NULL ) { + /* have to initialize default generator first */ + urng_aux_default = UNUR_URNG_AUX_DEFAULT; + + if( urng_aux_default == NULL ) { + /* some parameters invalid! */ + _unur_error("URNG",UNUR_ERR_NULL,"Cannot set default auxilliary URNG. EXIT !!!"); +#ifndef R_UNURAN + /* we cannot recover from this error */ + exit(EXIT_FAILURE); +#endif + /* Remark: When the library is used in R package 'Runuran', */ + /* then this case should not happen. */ + } + } + + /* return default generator */ + return (urng_aux_default); +} /* end of unur_get_default_urng_aux() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG * +unur_set_default_urng_aux( UNUR_URNG *urng_aux_new ) + /*----------------------------------------------------------------------*/ + /* set default auxilliary uniform RNG and return old one. */ + /* */ + /* parameters: pointer to new default auxilliary uniform RNG */ + /* */ + /* return: */ + /* pointer to old auxilliary uniform RNG */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng_aux_old = urng_aux_default; + + /* NULL pointer not allowed */ + _unur_check_NULL("URNG", urng_aux_new, urng_aux_default); + + urng_aux_default = urng_aux_new; /* set auxilliary urng */ + + /* return old default generator */ + return (urng_aux_old); +} /* end of unur_set_default_urng_aux() */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/urng/urng_set.c b/vendor/unuran-1.11.0/src/urng/urng_set.c new file mode 100644 index 0000000..7ba6193 --- /dev/null +++ b/vendor/unuran-1.11.0/src/urng/urng_set.c @@ -0,0 +1,306 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: urng_set.c * + * * + * routines to set, change and get the pointers to the * + * uniform random number generators used in generator objects. + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include "urng.h" + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Main uniform random number generator **/ +/** **/ +/*****************************************************************************/ + +int +unur_set_urng( struct unur_par *par, UNUR_URNG *urng ) + /*----------------------------------------------------------------------*/ + /* set uniform random number generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* urng ... pointer to uniform random number generator */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, par, UNUR_ERR_NULL ); + _unur_check_NULL("URNG", urng, UNUR_ERR_NULL); + + /* main generator */ + par->urng = urng; + + /* overwrite auxilliary generator */ + if (par->urng_aux) par->urng_aux = urng; + + return UNUR_SUCCESS; +} /* end of unur_set_urng() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG * +unur_get_urng( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get uniform random number generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* Pointer to old uniform RNG */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(gen,NULL); + + return gen->urng; +} /* end of unur_get_urng() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG * +unur_chg_urng( struct unur_gen *gen, UNUR_URNG *urng ) + /*----------------------------------------------------------------------*/ + /* set uniform random number generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* urng ... pointer to uniform random number generator */ + /* */ + /* return: */ + /* Pointer to old uniform RNG */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng_old; + + /* check arguments */ + CHECK_NULL(gen,NULL); + CHECK_NULL(urng,NULL); + + urng_old = gen->urng; + + /* set pointer to main URNG */ + gen->urng = urng; + + /* also set pointer in auxiliary generator objects */ + if (gen->gen_aux) + unur_chg_urng(gen->gen_aux,urng); + + if (gen->gen_aux_list && gen->n_gen_aux_list) { + int i; + for (i=0; in_gen_aux_list; i++) { + if (gen->gen_aux_list[i]) + unur_chg_urng(gen->gen_aux_list[i],urng); + } + } + + /* overwrite auxilliary URNG */ + if (gen->urng_aux) gen->urng_aux = urng; + + return urng_old; +} /* end of unur_chg_urng() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Auxiliary uniform random number generator **/ +/** **/ +/*****************************************************************************/ + +int +unur_set_urng_aux( struct unur_par *par, UNUR_URNG *urng_aux ) + /*----------------------------------------------------------------------*/ + /* set auxilliary uniform random number generator */ + /* */ + /* parameters: */ + /* par_aux ... pointer to parameter for building generator object */ + /* urng ... pointer to auxilliary uniform random number generator */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( NULL, par, UNUR_ERR_NULL ); + _unur_check_NULL("URNGaux", urng_aux, UNUR_ERR_NULL); + + if (par->urng_aux == NULL) + /* no auxilliary generator is required */ + return UNUR_ERR_GENERIC; + + par->urng_aux = urng_aux; + + return UNUR_SUCCESS; +} /* end of unur_set_urng_aux() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG * +unur_get_urng_aux( struct unur_gen *gen ) + /*----------------------------------------------------------------------*/ + /* get auxilliary uniform random number generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* Pointer to old auxilliary uniform RNG */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(gen,NULL); + + return gen->urng_aux; +} /* end of unur_get_urng_aux() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_URNG * +unur_chg_urng_aux( struct unur_gen *gen, UNUR_URNG *urng_aux ) + /*----------------------------------------------------------------------*/ + /* set auxilliary uniform random number generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* urng_aux ... pointer to auxilliary uniform random number generator */ + /* */ + /* return: */ + /* Pointer to old auxilliary uniform RNG */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng_aux_old; + + /* check arguments */ + CHECK_NULL(gen,NULL); + CHECK_NULL(urng_aux,NULL); + + if (gen->urng_aux == NULL) + /* no auxilliary generator is required */ + return NULL; + + urng_aux_old = gen->urng_aux; + + /* set pointer to main URNG */ + gen->urng_aux = urng_aux; + + /* also set pointer in auxiliary generator objects */ + if (gen->gen_aux) + unur_chg_urng_aux(gen->gen_aux,urng_aux); + + if (gen->gen_aux_list && gen->n_gen_aux_list) { + int i; + for (i=0; in_gen_aux_list; i++) { + if (gen->gen_aux_list[i]) + unur_chg_urng_aux(gen->gen_aux_list[i],urng_aux); + } + } + + return urng_aux_old; +} /* end of unur_chg_urng_aux() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_use_urng_aux_default( UNUR_PAR *par ) + /*----------------------------------------------------------------------*/ + /* set auxilliary uniform random number generator to default */ + /* (initialize generator if necessary) */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + if (par->urng_aux == NULL) + /* no auxilliary generator is required */ + return UNUR_ERR_GENERIC; + + /* set aux URNG */ + par->urng_aux = unur_get_default_urng_aux(); + + return UNUR_SUCCESS; + +} /* end of unur_use_urng_aux_default() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_chgto_urng_aux_default( UNUR_GEN *gen ) + /*----------------------------------------------------------------------*/ + /* set auxilliary uniform random number generator to default */ + /* (initialize generator if necessary) */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + if (gen->urng_aux == NULL) + /* no auxilliary generator is required */ + return UNUR_ERR_GENERIC; + + /* set aux URNG */ + gen->urng_aux = unur_get_default_urng_aux(); + + return UNUR_SUCCESS; + +} /* end of unur_chgto_urng_aux_default() */ + +/*---------------------------------------------------------------------------*/ + + diff --git a/vendor/unuran-1.11.0/src/urng/urng_source.h b/vendor/unuran-1.11.0/src/urng/urng_source.h new file mode 100644 index 0000000..6c7e67f --- /dev/null +++ b/vendor/unuran-1.11.0/src/urng/urng_source.h @@ -0,0 +1,87 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unur_source.h * + * * + * macros for calling and resetting uniform random number generators * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef URNG_SOURCE_H_SEEN +#define URNG_SOURCE_H_SEEN +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_URNG_UNURAN +/*---------------------------------------------------------------------------*/ + +/* function call to uniform RNG */ +#define _unur_call_urng(urng) ((urng)->sampleunif((urng)->state)) + +/*---------------------------------------------------------------------------*/ +#else +/*---------------------------------------------------------------------------*/ +#error +#error UNUR_URNG changed! +#error +#error Define _unur_call_urng(urng) and _unur_call_reset(urng) in +#error file 'urng_source' +#error +/*---------------------------------------------------------------------------*/ +/* The UNU.RAN API to uniform random number generator should be flexible */ +/* enough to use any source of uniform random number generators. */ +/* */ +/* Please, report any problem with this interface to this interface to the */ +/* UNU.RAN development team. */ +/* */ +/* When the UNU.RAN interface to uniform random number generator must be */ +/* changed (not recommended), proceed as following: */ +/* */ +/* (1) Change the typedef for 'UNUR_URNG' in file 'src/unur_typedefs.h'. */ +/* (2) Comment out the #definition of 'UNUR_URNG_UNURAN' to remove all */ +/* code from the UNU.RAN API. */ +/* (3) Comment out the above error directives. */ +/* (4) Define _unur_call_urng(urng) and _unur_call_reset(urng). */ +/* Here is a template: */ +/* */ +/* - function call to uniform RNG: */ +/* #define _unur_call_urng(urng) (my_uniform_generator(urng)) */ +/* */ +/* - reset uniform RNG: */ +/* #define _unur_call_reset(urng) (my_reset_unif(urng),UNUR_SUCCESS) */ +/* if no such reset call exists: */ +/* #define _unur_call_reset(urng) (UNUR_FAILURE) */ +/* */ +/* (5) Define defaults 'UNUR_URNG_DEFAULT' and 'UNUR_URNG_AUX_DEFAULT' */ +/* in file 'src/unuran_config.h'. */ +/* */ +/* Notice that some test routines (like counting URNGs) and the test suite */ +/* do not work for a non-UNU.RAN interface. */ +/*---------------------------------------------------------------------------*/ +#endif /* UNUR_URNG_UNURAN */ +/*---------------------------------------------------------------------------*/ +#endif /* #ifndef URNG_SOURCE_H_SEEN */ +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/urng/urng_struct.h b/vendor/unuran-1.11.0/src/urng/urng_struct.h new file mode 100644 index 0000000..d876f06 --- /dev/null +++ b/vendor/unuran-1.11.0/src/urng/urng_struct.h @@ -0,0 +1,66 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unur_struct.h * + * * + * structures used for included uniform random number generators * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +struct unur_urng { + double (*sampleunif)(void *state); /* function for generating uniform RNG */ + void *state; /* state of the generator */ + unsigned int (*samplearray)(void *state, double *X, int dim); + /* function for generating array of points */ + void (*sync)(void *state); /* jump into defined state ("sync") */ + unsigned long seed; /* initial seed of the generator */ + void (*setseed)(void *state, unsigned long seed); /* set initial seed of the generator */ + void (*reset)(void *state); /* reset object */ + void (*nextsub)(void *state); /* skip to next substream */ + void (*resetsub)(void *state); /* reset current substream */ + void (*anti)(void *state, int a); /* set antithetic flag */ + void (*delete)(void *state); /* function for destroying URNG */ + +#ifdef UNUR_COOKIES + unsigned cookie; /* magic cookie */ +#endif +}; + +/* Remark: */ +/* The 'seed' is used to fill the state variable(s) of a generator with */ +/* initial values. For some generators the size of the 'state' is larger */ +/* than the size if the 'seed'. In such a case some function is used to */ +/* expand the 'seed' to the appropriate size (often this is done with a */ +/* LCG (linear congruental generator) with starting state 'seed'; e.g. this */ +/* happens for the Mersenne twister). */ +/* Often the seed is not stored in the structure for the generator object */ +/* (which is stored in 'state'). */ +/* Thus we have introduced an additional field 'seed' to store the */ +/* starting value. */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/urng/urng_unuran.c b/vendor/unuran-1.11.0/src/urng/urng_unuran.c new file mode 100644 index 0000000..e1f04b0 --- /dev/null +++ b/vendor/unuran-1.11.0/src/urng/urng_unuran.c @@ -0,0 +1,631 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: urng_unuran.c * + * * + * Unified interface for UNURAN uniform random number generators. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#include +#include "urng.h" +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_URNG_UNURAN +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Create new URNG object **/ +/** **/ +/*****************************************************************************/ + +UNUR_URNG * +unur_urng_new( double (*sampleunif)(void *state), void *state ) + /*----------------------------------------------------------------------*/ + /* create a new URNG object for uniform random number generator. */ + /* */ + /* parameters: */ + /* sampleunif ... pointer to sampling routine */ + /* */ + /* return: */ + /* pointer to URNG object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + UNUR_URNG *urng = NULL; /* pointer to URNG object */ + + /* check arguments */ + _unur_check_NULL( "URNG", sampleunif, NULL ); + + /* allocate memory for URNG object */ + urng = _unur_xmalloc( sizeof(struct unur_urng) ); + + /* copy parameters into object */ + urng->sampleunif = sampleunif; + urng->state = state; + + /* initialize optional functions (set to not available) */ + urng->samplearray = NULL; + urng->sync = NULL; + urng->seed = ULONG_MAX; + urng->setseed = NULL; + urng->delete = NULL; + urng->reset = NULL; + urng->nextsub = NULL; + urng->resetsub = NULL; + urng->anti = NULL; + + /* set magic cookie */ + COOKIE_SET(urng,CK_URNG); + + /* return object */ + return urng; +} /* end of unur_urng_new() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_urng_set_sample_array( UNUR_URNG *urng, + unsigned int (*samplearray)(void *state, double *X, int dim) ) + /*----------------------------------------------------------------------*/ + /* Set function to sample random point */ + /* */ + /* parameters: */ + /* urng ... pointer to URNG object */ + /* samplearray ... function for sampling random point */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( "URNG", urng, UNUR_ERR_NULL ); + COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); + + urng->samplearray = samplearray; + return UNUR_SUCCESS; + +} /* end of unur_urng_set_sample_array() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_urng_set_sync( UNUR_URNG *urng, void (*sync)(void *state) ) + /*----------------------------------------------------------------------*/ + /* Set function for jumping into defined state ("sync") */ + /* */ + /* parameters: */ + /* urng ... pointer to URNG object */ + /* sync ... function for syncing generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( "URNG", urng, UNUR_ERR_NULL ); + COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); + + urng->sync = sync; + return UNUR_SUCCESS; +} /* end of unur_urng_set_reset() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_urng_set_seed( UNUR_URNG *urng, void (*setseed)(void *state, unsigned long seed) ) + /*----------------------------------------------------------------------*/ + /* Set function to seed. */ + /* */ + /* parameters: */ + /* urng ... pointer to URNG object */ + /* setseed ... function for seeding generator */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( "URNG", urng, UNUR_ERR_NULL ); + COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); + + urng->setseed = setseed; + return UNUR_SUCCESS; +} /* end of unur_urng_set_seed() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_urng_set_anti( UNUR_URNG *urng, void (*setanti)(void *state, int anti) ) + /*----------------------------------------------------------------------*/ + /* Set function to switch to antithetic random numbers. */ + /* */ + /* parameters: */ + /* urng ... pointer to URNG object */ + /* setanti ... function for switching antithetic flag */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( "URNG", urng, UNUR_ERR_NULL ); + COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); + + urng->anti = setanti; + return UNUR_SUCCESS; +} /* end of unur_urng_set_anti() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_urng_set_reset( UNUR_URNG *urng, void (*reset)(void *state) ) + /*----------------------------------------------------------------------*/ + /* Set function for reseting URNG. */ + /* */ + /* parameters: */ + /* urng ... pointer to URNG object */ + /* reset ... function for reseting generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( "URNG", urng, UNUR_ERR_NULL ); + COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); + + urng->reset = reset; + return UNUR_SUCCESS; +} /* end of unur_urng_set_reset() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_urng_set_nextsub( UNUR_URNG *urng, void (*nextsub)(void *state) ) + /*----------------------------------------------------------------------*/ + /* Set function for jumping to start of the next substream of URNG. */ + /* */ + /* parameters: */ + /* urng ... pointer to URNG object */ + /* nextsub ... function for jumping to next substream */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( "URNG", urng, UNUR_ERR_NULL ); + COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); + + urng->nextsub = nextsub; + return UNUR_SUCCESS; +} /* end of unur_urng_set_nextsub() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_urng_set_resetsub( UNUR_URNG *urng, void (*resetsub)(void *state) ) + /*----------------------------------------------------------------------*/ + /* Set function for jumping to start of the current substream of URNG. */ + /* */ + /* parameters: */ + /* urng ... pointer to URNG object */ + /* resetsub ... function for reseting current substream */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( "URNG", urng, UNUR_ERR_NULL ); + COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); + + urng->resetsub = resetsub; + return UNUR_SUCCESS; +} /* end of unur_urng_set_resetsub() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_urng_set_delete( UNUR_URNG *urng, void (*delete)(void *state) ) + /*----------------------------------------------------------------------*/ + /* Set function for destroying URNG. */ + /* */ + /* parameters: */ + /* urng ... pointer to URNG object */ + /* delete ... function for destroying generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + _unur_check_NULL( "URNG", urng, UNUR_ERR_NULL ); + COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); + + urng->delete = delete; + return UNUR_SUCCESS; +} /* end of unur_urng_set_delete() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Handle a URNG object **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +int +unur_urng_sync (UNUR_URNG *urng) + /*----------------------------------------------------------------------*/ + /* Jump into defined state ("sync") */ + /* */ + /* parameters: */ + /* urng ... pointer to URNG object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check argument */ + if (urng == NULL) + /* use default generator */ + urng = unur_get_default_urng(); + + COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); + + /* check whether we can reset the URNG object */ + if (urng->sync == NULL) { + _unur_error("URNG",UNUR_ERR_URNG_MISS,"sync"); + return UNUR_ERR_URNG_MISS; + } + + /* jump to next substream */ + urng->sync (urng->state); + + return UNUR_SUCCESS; +} /* end of unur_urng_sync() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_urng_seed (UNUR_URNG *urng, unsigned long seed) + /*----------------------------------------------------------------------*/ + /* (Re-)Seed URNG. */ + /* */ + /* parameters: */ + /* urng ... pointer to URNG object */ + /* seed ... new seed for generator */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check argument */ + if (urng == NULL) + /* use default generator */ + urng = unur_get_default_urng(); + + COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); + + /* check whether we can set the antithetic flag */ + if (urng->setseed == NULL) { + _unur_error("URNG",UNUR_ERR_URNG_MISS,"seeding function"); + return UNUR_ERR_URNG_MISS; + } + + /* set seed */ + urng->setseed (urng->state,seed); + + /* store seed */ + urng->seed = seed; + + return UNUR_SUCCESS; +} /* end of unur_urng_seed() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_urng_anti (UNUR_URNG *urng, int anti) + /*----------------------------------------------------------------------*/ + /* Set antithetic flag for URNG. */ + /* */ + /* parameters: */ + /* urng ... pointer to URNG object */ + /* anti ... antithetic flag */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check argument */ + if (urng == NULL) + /* use default generator */ + urng = unur_get_default_urng(); + + COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); + + /* check whether we can set the antithetic flag */ + if (urng->anti == NULL) { + _unur_error("URNG",UNUR_ERR_URNG_MISS,"antithetic flag"); + return UNUR_ERR_URNG_MISS; + } + + /* set flag */ + urng->anti (urng->state,anti); + + return UNUR_SUCCESS; +} /* end of unur_urng_anti() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_urng_nextsub (UNUR_URNG *urng) + /*----------------------------------------------------------------------*/ + /* Jump to start of next substream in URNG. */ + /* */ + /* parameters: */ + /* urng ... pointer to URNG object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check argument */ + if (urng == NULL) + /* use default generator */ + urng = unur_get_default_urng(); + + COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); + + /* check whether we can reset the URNG object */ + if (urng->nextsub == NULL) { + _unur_error("URNG",UNUR_ERR_URNG_MISS,"next substream"); + return UNUR_ERR_URNG_MISS; + } + + /* jump to next substream */ + urng->nextsub (urng->state); + + return UNUR_SUCCESS; +} /* end of unur_urng_nextsub() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_urng_resetsub (UNUR_URNG *urng) + /*----------------------------------------------------------------------*/ + /* Reset current substream of the URNG object. */ + /* */ + /* parameters: */ + /* urng ... pointer to URNG object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check argument */ + if (urng == NULL) + /* use default generator */ + urng = unur_get_default_urng(); + + COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); + + /* check whether we can reset the URNG object */ + if (urng->resetsub == NULL) { + _unur_error("URNG",UNUR_ERR_URNG_MISS,"reset substream"); + return UNUR_ERR_URNG_MISS; + } + + /* reset substream */ + urng->resetsub (urng->state); + + return UNUR_SUCCESS; +} /* end of unur_urng_resetsub() */ + +/*---------------------------------------------------------------------------*/ + +void +unur_urng_free (UNUR_URNG *urng) + /*----------------------------------------------------------------------*/ + /* Destroy URNG object. */ + /* */ + /* parameters: */ + /* urng ... pointer to URNG object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check argument */ + if (urng == NULL) return; /* nothing to do */ + COOKIE_CHECK(urng,CK_URNG,RETURN_VOID); + + if (urng->delete != NULL) urng->delete (urng->state); + free (urng); + urng = NULL; + + return; +} /* end of unur_urng_free() */ + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Handle URNG object in a generator object **/ +/** **/ +/*****************************************************************************/ + +int +unur_gen_sync (UNUR_GEN *gen) + /*----------------------------------------------------------------------*/ + /* Jump into defined state ("sync") of uniform generator in */ + /* generator object. */ + /* */ + /* parameters: */ + /* gen ... generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check argument */ + _unur_check_NULL( "URNG", gen, UNUR_ERR_NULL ); + return unur_urng_sync(gen->urng); +} /* end of unur_gen_sync() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_gen_seed (UNUR_GEN *gen, unsigned long seed) + /*----------------------------------------------------------------------*/ + /* (Re-) Seed uniform generator in generator object. */ + /* */ + /* parameters: */ + /* gen ... generator object */ + /* seed ... new seed for generator */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check argument */ + _unur_check_NULL( "URNG", gen, UNUR_ERR_NULL ); + + return unur_urng_seed(gen->urng, seed); +} /* end of unur_gen_seed() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_gen_anti (UNUR_GEN *gen, int anti) + /*----------------------------------------------------------------------*/ + /* Set antithetic flag of uniform generator in generator object. */ + /* */ + /* parameters: */ + /* gen ... generator object */ + /* anti ... antithetic flag */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check argument */ + _unur_check_NULL( "URNG", gen, UNUR_ERR_NULL ); + + return unur_urng_anti(gen->urng, anti); +} /* end of unur_gen_anti() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_gen_reset (UNUR_GEN *gen) + /*----------------------------------------------------------------------*/ + /* Reset uniform generator in generator object. */ + /* */ + /* parameters: */ + /* gen ... generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check argument */ + _unur_check_NULL( "URNG", gen, UNUR_ERR_NULL ); + return unur_urng_reset(gen->urng); +} /* end of unur_gen_reset() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_gen_nextsub (UNUR_GEN *gen) + /*----------------------------------------------------------------------*/ + /* Jump uniform generator in generator object to start of next */ + /* substream. */ + /* */ + /* parameters: */ + /* gen ... generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check argument */ + _unur_check_NULL( "URNG", gen, UNUR_ERR_NULL ); + + return unur_urng_nextsub(gen->urng); +} /* end of unur_gen_nextsub() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_gen_resetsub (UNUR_GEN *gen) + /*----------------------------------------------------------------------*/ + /* Reset current substream of uniform generator in generator object. */ + /* */ + /* parameters: */ + /* gen ... generator object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + /* check argument */ + _unur_check_NULL( "URNG", gen, UNUR_ERR_NULL ); + + return unur_urng_resetsub(gen->urng); +} /* end of unur_gen_resetsub() */ + +/*---------------------------------------------------------------------------*/ +#endif /* UNUR_URNG_UNURAN */ +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/utils/.libs/libutils.a b/vendor/unuran-1.11.0/src/utils/.libs/libutils.a new file mode 100644 index 0000000..4071ce4 Binary files /dev/null and b/vendor/unuran-1.11.0/src/utils/.libs/libutils.a differ diff --git a/vendor/unuran-1.11.0/src/utils/Makefile b/vendor/unuran-1.11.0/src/utils/Makefile new file mode 100644 index 0000000..7c76476 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/Makefile @@ -0,0 +1,696 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# src/utils/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/unuran +pkgincludedir = $(includedir)/unuran +pkglibdir = $(libdir)/unuran +pkglibexecdir = $(libexecdir)/unuran +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +subdir = src/utils +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libutils_la_LIBADD = +am_libutils_la_OBJECTS = debug.lo eigensystem.lo error.lo fmax.lo \ + hooke.lo lobatto.lo matrix.lo mrou_rectangle.lo slist.lo \ + stream.lo string.lo umalloc.lo umath.lo unur_fp.lo vector.lo +libutils_la_OBJECTS = $(am_libutils_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I. -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/debug.Plo \ + ./$(DEPDIR)/eigensystem.Plo ./$(DEPDIR)/error.Plo \ + ./$(DEPDIR)/fmax.Plo ./$(DEPDIR)/hooke.Plo \ + ./$(DEPDIR)/lobatto.Plo ./$(DEPDIR)/matrix.Plo \ + ./$(DEPDIR)/mrou_rectangle.Plo ./$(DEPDIR)/slist.Plo \ + ./$(DEPDIR)/stream.Plo ./$(DEPDIR)/string.Plo \ + ./$(DEPDIR)/umalloc.Plo ./$(DEPDIR)/umath.Plo \ + ./$(DEPDIR)/unur_fp.Plo ./$(DEPDIR)/vector.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libutils_la_SOURCES) +DIST_SOURCES = $(libutils_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_CFLAGS = -Wall -Wextra -Wshadow -Wstrict-prototypes +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf +AUTOHEADER = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader +AUTOMAKE = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -fPIC +CPP = gcc -E +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +FILECMD = file +GREP = /usr/bin/grep +HAVE_DIVIDE_BY_ZERO = +HAVE_IEEE_COMPARISONS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAINT = # +MAKEINFO = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = unuran +PACKAGE_BUGREPORT = unuran@statmath.wu.ac.at +PACKAGE_NAME = unuran +PACKAGE_STRING = unuran 1.11.0 +PACKAGE_TARNAME = unuran +PACKAGE_URL = +PACKAGE_VERSION = 1.11.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +UNURAN_LT_VERSION = 16:1:0 +UNURAN_SUPPORTS_GSL = +UNURAN_SUPPORTS_PRNG = +UNURAN_SUPPORTS_RNGSTREAM = +VERSION = 1.11.0 +abs_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src/utils +abs_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/src/utils +abs_top_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +have_valgrind = false +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../../ +top_builddir = ../.. +top_srcdir = ../.. +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libutils.la +libutils_la_DEPENDENCIES = unur_fp_const_source.h +libutils_la_SOURCES = \ + debug.c debug.h debug_source.h \ + eigensystem.c \ + error.c error.h error_source.h \ + fmax.c fmax_source.h \ + hooke.c hooke_source.h \ + lobatto.c lobatto_source.h lobatto_struct.h \ + matrix.c matrix_source.h \ + mrou_rectangle.c mrou_rectangle_source.h mrou_rectangle_struct.h \ + slist.c slist.h slist_struct.h \ + stream.c stream.h stream_source.h \ + string.c string_source.h string_struct.h \ + umalloc.c umalloc_source.h \ + umath.c umath.h umath_source.h \ + unur_fp.c \ + vector.c vector_source.h + +noinst_HEADERS = \ + unur_fp_source.h unur_fp_const_source.h \ + unur_errno.h \ + unur_math_source.h + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in \ + unur_fp_const_source.h + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/utils/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/utils/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libutils.la: $(libutils_la_OBJECTS) $(libutils_la_DEPENDENCIES) $(EXTRA_libutils_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libutils_la_OBJECTS) $(libutils_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/debug.Plo # am--include-marker +include ./$(DEPDIR)/eigensystem.Plo # am--include-marker +include ./$(DEPDIR)/error.Plo # am--include-marker +include ./$(DEPDIR)/fmax.Plo # am--include-marker +include ./$(DEPDIR)/hooke.Plo # am--include-marker +include ./$(DEPDIR)/lobatto.Plo # am--include-marker +include ./$(DEPDIR)/matrix.Plo # am--include-marker +include ./$(DEPDIR)/mrou_rectangle.Plo # am--include-marker +include ./$(DEPDIR)/slist.Plo # am--include-marker +include ./$(DEPDIR)/stream.Plo # am--include-marker +include ./$(DEPDIR)/string.Plo # am--include-marker +include ./$(DEPDIR)/umalloc.Plo # am--include-marker +include ./$(DEPDIR)/umath.Plo # am--include-marker +include ./$(DEPDIR)/unur_fp.Plo # am--include-marker +include ./$(DEPDIR)/vector.Plo # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ $< + +.c.obj: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: + $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +# $(AM_V_CC)source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/debug.Plo + -rm -f ./$(DEPDIR)/eigensystem.Plo + -rm -f ./$(DEPDIR)/error.Plo + -rm -f ./$(DEPDIR)/fmax.Plo + -rm -f ./$(DEPDIR)/hooke.Plo + -rm -f ./$(DEPDIR)/lobatto.Plo + -rm -f ./$(DEPDIR)/matrix.Plo + -rm -f ./$(DEPDIR)/mrou_rectangle.Plo + -rm -f ./$(DEPDIR)/slist.Plo + -rm -f ./$(DEPDIR)/stream.Plo + -rm -f ./$(DEPDIR)/string.Plo + -rm -f ./$(DEPDIR)/umalloc.Plo + -rm -f ./$(DEPDIR)/umath.Plo + -rm -f ./$(DEPDIR)/unur_fp.Plo + -rm -f ./$(DEPDIR)/vector.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/debug.Plo + -rm -f ./$(DEPDIR)/eigensystem.Plo + -rm -f ./$(DEPDIR)/error.Plo + -rm -f ./$(DEPDIR)/fmax.Plo + -rm -f ./$(DEPDIR)/hooke.Plo + -rm -f ./$(DEPDIR)/lobatto.Plo + -rm -f ./$(DEPDIR)/matrix.Plo + -rm -f ./$(DEPDIR)/mrou_rectangle.Plo + -rm -f ./$(DEPDIR)/slist.Plo + -rm -f ./$(DEPDIR)/stream.Plo + -rm -f ./$(DEPDIR)/string.Plo + -rm -f ./$(DEPDIR)/umalloc.Plo + -rm -f ./$(DEPDIR)/umath.Plo + -rm -f ./$(DEPDIR)/unur_fp.Plo + -rm -f ./$(DEPDIR)/vector.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/utils/Makefile.am b/vendor/unuran-1.11.0/src/utils/Makefile.am new file mode 100644 index 0000000..38a7c0d --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/Makefile.am @@ -0,0 +1,42 @@ +## Process this file with automake to produce Makefile.in + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libutils.la + +libutils_la_DEPENDENCIES = unur_fp_const_source.h + +libutils_la_SOURCES = \ + debug.c debug.h debug_source.h \ + eigensystem.c \ + error.c error.h error_source.h \ + fmax.c fmax_source.h \ + hooke.c hooke_source.h \ + lobatto.c lobatto_source.h lobatto_struct.h \ + matrix.c matrix_source.h \ + mrou_rectangle.c mrou_rectangle_source.h mrou_rectangle_struct.h \ + slist.c slist.h slist_struct.h \ + stream.c stream.h stream_source.h \ + string.c string_source.h string_struct.h \ + umalloc.c umalloc_source.h \ + umath.c umath.h umath_source.h \ + unur_fp.c \ + vector.c vector_source.h + +noinst_HEADERS = \ + unur_fp_source.h unur_fp_const_source.h \ + unur_errno.h \ + unur_math_source.h + +# clean backup files +CLEANFILES = *~ + +# clean generated files +##DISTCLEANFILES = \ +## unur_fp_const_source.h + +MAINTAINERCLEANFILES = \ + Makefile.in \ + unur_fp_const_source.h + diff --git a/vendor/unuran-1.11.0/src/utils/Makefile.in b/vendor/unuran-1.11.0/src/utils/Makefile.in new file mode 100644 index 0000000..1e39700 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/Makefile.in @@ -0,0 +1,696 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/utils +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libutils_la_LIBADD = +am_libutils_la_OBJECTS = debug.lo eigensystem.lo error.lo fmax.lo \ + hooke.lo lobatto.lo matrix.lo mrou_rectangle.lo slist.lo \ + stream.lo string.lo umalloc.lo umath.lo unur_fp.lo vector.lo +libutils_la_OBJECTS = $(am_libutils_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/debug.Plo \ + ./$(DEPDIR)/eigensystem.Plo ./$(DEPDIR)/error.Plo \ + ./$(DEPDIR)/fmax.Plo ./$(DEPDIR)/hooke.Plo \ + ./$(DEPDIR)/lobatto.Plo ./$(DEPDIR)/matrix.Plo \ + ./$(DEPDIR)/mrou_rectangle.Plo ./$(DEPDIR)/slist.Plo \ + ./$(DEPDIR)/stream.Plo ./$(DEPDIR)/string.Plo \ + ./$(DEPDIR)/umalloc.Plo ./$(DEPDIR)/umath.Plo \ + ./$(DEPDIR)/unur_fp.Plo ./$(DEPDIR)/vector.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libutils_la_SOURCES) +DIST_SOURCES = $(libutils_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ +UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ +UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ +UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_valgrind = @have_valgrind@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libutils.la +libutils_la_DEPENDENCIES = unur_fp_const_source.h +libutils_la_SOURCES = \ + debug.c debug.h debug_source.h \ + eigensystem.c \ + error.c error.h error_source.h \ + fmax.c fmax_source.h \ + hooke.c hooke_source.h \ + lobatto.c lobatto_source.h lobatto_struct.h \ + matrix.c matrix_source.h \ + mrou_rectangle.c mrou_rectangle_source.h mrou_rectangle_struct.h \ + slist.c slist.h slist_struct.h \ + stream.c stream.h stream_source.h \ + string.c string_source.h string_struct.h \ + umalloc.c umalloc_source.h \ + umath.c umath.h umath_source.h \ + unur_fp.c \ + vector.c vector_source.h + +noinst_HEADERS = \ + unur_fp_source.h unur_fp_const_source.h \ + unur_errno.h \ + unur_math_source.h + + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in \ + unur_fp_const_source.h + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/utils/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/utils/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libutils.la: $(libutils_la_OBJECTS) $(libutils_la_DEPENDENCIES) $(EXTRA_libutils_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libutils_la_OBJECTS) $(libutils_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eigensystem.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fmax.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hooke.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lobatto.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mrou_rectangle.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slist.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umalloc.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umath.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unur_fp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/debug.Plo + -rm -f ./$(DEPDIR)/eigensystem.Plo + -rm -f ./$(DEPDIR)/error.Plo + -rm -f ./$(DEPDIR)/fmax.Plo + -rm -f ./$(DEPDIR)/hooke.Plo + -rm -f ./$(DEPDIR)/lobatto.Plo + -rm -f ./$(DEPDIR)/matrix.Plo + -rm -f ./$(DEPDIR)/mrou_rectangle.Plo + -rm -f ./$(DEPDIR)/slist.Plo + -rm -f ./$(DEPDIR)/stream.Plo + -rm -f ./$(DEPDIR)/string.Plo + -rm -f ./$(DEPDIR)/umalloc.Plo + -rm -f ./$(DEPDIR)/umath.Plo + -rm -f ./$(DEPDIR)/unur_fp.Plo + -rm -f ./$(DEPDIR)/vector.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/debug.Plo + -rm -f ./$(DEPDIR)/eigensystem.Plo + -rm -f ./$(DEPDIR)/error.Plo + -rm -f ./$(DEPDIR)/fmax.Plo + -rm -f ./$(DEPDIR)/hooke.Plo + -rm -f ./$(DEPDIR)/lobatto.Plo + -rm -f ./$(DEPDIR)/matrix.Plo + -rm -f ./$(DEPDIR)/mrou_rectangle.Plo + -rm -f ./$(DEPDIR)/slist.Plo + -rm -f ./$(DEPDIR)/stream.Plo + -rm -f ./$(DEPDIR)/string.Plo + -rm -f ./$(DEPDIR)/umalloc.Plo + -rm -f ./$(DEPDIR)/umath.Plo + -rm -f ./$(DEPDIR)/unur_fp.Plo + -rm -f ./$(DEPDIR)/vector.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/src/utils/debug.c b/vendor/unuran-1.11.0/src/utils/debug.c new file mode 100644 index 0000000..a726bff --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/debug.c @@ -0,0 +1,154 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: debug.c * + * * + * debugging routines * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include + +/*---------------------------------------------------------------------------*/ + +/*****************************************************************************/ +/** **/ +/** Set debuging flags **/ +/** **/ +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/* global variable for default debugging flags */ +unsigned _unur_default_debugflag = UNUR_DEBUGFLAG_DEFAULT; + +/*---------------------------------------------------------------------------*/ + +int +unur_set_debug( struct unur_par *par ATTRIBUTE__UNUSED, + unsigned debug ATTRIBUTE__UNUSED ) + /*----------------------------------------------------------------------*/ + /* set debugging flag for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* debug ... debugging flag */ + /*----------------------------------------------------------------------*/ +{ +#ifdef UNUR_ENABLE_LOGGING + _unur_check_NULL( NULL,par,UNUR_ERR_NULL ); + par->debug = debug; + return UNUR_SUCCESS; +#else + _unur_warning("DEBUG",UNUR_ERR_COMPILE,"debugging not enabled"); + return UNUR_ERR_COMPILE; +#endif + +} /* end of unur_set_debug() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_chg_debug( struct unur_gen *gen ATTRIBUTE__UNUSED, + unsigned debug ATTRIBUTE__UNUSED ) + /*----------------------------------------------------------------------*/ + /* change debugging flag for generator */ + /* */ + /* parameters: */ + /* gen ... pointer to generator object */ + /* debug ... debugging flag */ + /*----------------------------------------------------------------------*/ +{ +#ifdef UNUR_ENABLE_LOGGING + CHECK_NULL( gen, UNUR_ERR_NULL ); + gen->debug = debug; + return UNUR_SUCCESS; +#else + _unur_warning("DEBUG",UNUR_ERR_COMPILE,"debugging not enabled"); + return UNUR_ERR_COMPILE; +#endif + +} /* end of unur_chg_debug() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_set_default_debug( unsigned debug ) + /*----------------------------------------------------------------------*/ + /* set default debugging flag for generator */ + /* */ + /* parameters: */ + /* par ... pointer to parameter for building generator object */ + /* debug ... debugging flag */ + /*----------------------------------------------------------------------*/ +{ + _unur_default_debugflag = debug; + return UNUR_SUCCESS; +} /* end of unur_set_default_debug() */ + +/*---------------------------------------------------------------------------*/ + +char * +_unur_make_genid( const char *gentype ) + /*----------------------------------------------------------------------*/ + /* make a new generator identifier */ + /* */ + /* parameters: */ + /* gentype ... type of generator */ + /* */ + /* return: */ + /* pointer generator id (char string) */ + /*----------------------------------------------------------------------*/ +{ + static int count = 0; /* counter for identifiers */ + char *genid; + size_t len; + + /* allocate memory for identifier */ + len = strlen(gentype); + genid = _unur_xmalloc(sizeof(char)*(len+5)); + + /* make new identifier */ + ++count; count %= 1000; + /* 1000 different generators should be enough */ + +#if HAVE_DECL_SNPRINTF + /* this is part of ISO C99 */ + snprintf(genid, len+5, "%s.%03d", gentype, count); +#else + #error Function snprintf() required. + /* Fallback: */ + /* sprintf(genid, "%s.%03d", gentype, count); */ +#endif + + return genid; + +} /* end of _unur_make_genid() */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/utils/debug.h b/vendor/unuran-1.11.0/src/utils/debug.h new file mode 100644 index 0000000..676a0b7 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/debug.h @@ -0,0 +1,147 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: debug.h * + * * + * PURPOSE: * + * defines macros and function prototypes for debugging routines. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef DEBUG_H_SEEN +#define DEBUG_H_SEEN +/*---------------------------------------------------------------------------*/ + +/* + =NODE Debug Debugging + + =UP Error_Debug [20] + + =DESCRIPTION + The UNU.RAN library has several debugging levels which + can be switched on/off by debugging flags. This debugging + feature must be enabled when building the library using the + @code{--enable-logging} configure flag. + + The debugging levels range from print a short description of the + created generator object to a detailed description of hat + functions and tracing the sampling routines. The output is printed + onto the debugging output stream + (@pxref{Output_streams,,Output streams}). + + The debugging flags can be set or changed by the respective calls + unur_set_debug() and unur_chg_debug() independently for each + generator. + + By default flag @code{UNUR_DEBUG_INIT} (see + below) is used. This default flags is set by the macro + @code{UNUR_DEBUGFLAG_DEFAULT} in @file{unuran_config.h} and can + be changed at runtime by a unur_set_default_debug() call. + + Off course these debugging flags + depend on the chosen method. Since most of these are merely for + debugging the library itself, a description of the flags are given + in the corresponding source files of the method. + Nevertheless, the following flags can be used with all methods. + + Common debug flags: + + @ftable @code + @item UNUR_DEBUG_OFF + @findex UNUR_DEBUG_OFF + switch off all debuging information + @item UNUR_DEBUG_ALL + @findex UNUR_DEBUG_ALL + all avaivable information + @item UNUR_DEBUG_INIT + @findex UNUR_DEBUG_INIT + parameters of generator object after initialization + @item UNUR_DEBUG_SETUP + @findex UNUR_DEBUG_SETUP + data created at setup + @item UNUR_DEBUG_ADAPT + @findex UNUR_DEBUG_ADAPT + data created during adaptive steps + @item UNUR_DEBUG_SAMPLE + @findex UNUR_DEBUG_SAMPLE + trace sampling + @end ftable + + Notice that these are flags which could be combined using the + @code{|} operator. + + Almost all routines check a given pointer before they read from or write + to the given address. This does not hold for time-critical routines + like all sampling routines. Thus you are responsible for checking a + pointer that is returned from a unur_init() call. + However, it is possible to turn on checking for invalid NULL pointers + even in such time-critical routines by building the library + using the @code{--enable-check-struct} configure flag. + + Another debugging tool used in the library are magic cookies that + validate a given pointer. It produces an error whenever a given + pointer points to an object that is invalid in the context. + The usage of magic cookies is also switched on by the + @code{--enable-check-struct} configure flag. + + =END +*/ + +/* common debug flags */ +#define UNUR_DEBUG_OFF (0u) /* switch off debugging information */ +#define UNUR_DEBUG_ALL (~0u) /* write all avaivable information */ + +#define UNUR_DEBUG_INIT 0x00000001u /* bit 01 ... parameters of gen. */ +#define UNUR_DEBUG_SETUP 0x00000fffu /* bits 02-12 ... setup */ +#define UNUR_DEBUG_ADAPT 0x00fff000u /* bits 13-24 ... adaptive steps */ +#define UNUR_DEBUG_SAMPLE 0xff000000u /* bits 25-32 ... trace sampling */ + +/*---------------------------------------------------------------------------*/ +/* set debugging flag for generator */ + +/* =ROUTINES */ + +int unur_set_debug( UNUR_PAR *parameters, unsigned debug ); +/* + Set debugging flags for generator. +*/ + +int unur_chg_debug( UNUR_GEN *generator, unsigned debug ); +/* + Change debugging flags for generator. +*/ + +int unur_set_default_debug( unsigned debug ); +/* + Change default debugging flag. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ +#endif /* DEBUG_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/debug_source.h b/vendor/unuran-1.11.0/src/utils/debug_source.h new file mode 100644 index 0000000..60e16db --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/debug_source.h @@ -0,0 +1,81 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: debug_source.h * + * * + * PURPOSE: * + * defines macros and function prototypes for debugging routines. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* set generator id */ + +char *_unur_make_genid( const char *gentype ); +#define _unur_set_genid(gentype) _unur_make_genid(gentype) +#define _unur_free_genid(gen) do {if (gen->genid) free((gen)->genid);} while(0) + +/*---------------------------------------------------------------------------*/ +/* default debugging flag for generator */ + +extern unsigned _unur_default_debugflag; /* default debugging flags */ + +/*---------------------------------------------------------------------------*/ +/* warnings and error messages */ + +/* an abbreviation */ +#define _unur_print_if_default(par,flag) if(!((par)->set & (flag))) fprintf(LOG," [default]") + +/*---------------------------------------------------------------------------*/ +/* Check for NULL pointer */ + +#ifdef UNUR_ENABLE_CHECKNULL + +#define CHECK_NULL(ptr,rval) \ + if (!(ptr)) { \ + _unur_error(NULL,UNUR_ERR_NULL,""); \ + return rval; \ + } + +#else /* do not check (be carefull) */ + +#define CHECK_NULL(ptr,rval) do {} while(0) + +#endif + +/* the second macro cannot be switched off by a compiler switch */ +#define _unur_check_NULL(gid,ptr,rval) \ + if (!(ptr)) { \ + _unur_error((gid),UNUR_ERR_NULL,""); \ + return rval; \ + } + +/* Some preprocessor (e.g. in MacOS X) fail when 'rval' is an empty string. */ +/* The following should fix this problem. */ + +#define RETURN_VOID ; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/eigensystem.c b/vendor/unuran-1.11.0/src/utils/eigensystem.c new file mode 100644 index 0000000..3514a93 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/eigensystem.c @@ -0,0 +1,551 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: eigensystem.c * + * * + * Routines for calculating eigenvalues and eigenvectors of real * + * symmetric matrices. * + * * + * Mainly adapted and modified from FORTRAN77 code POLYEN created by * + * G. Derflinger * + * * + ***************************************************************************** + * FORTRAN version by Gerhard Derflinger. * + * Translated into C and adapted for UNU.RAN by Roman Karawatzki. * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +#include +#include "matrix_source.h" + +/* ---------------------------------------------------------------------------- */ + +static const double EPS = DBL_EPSILON; +static const double EPS2 = (DBL_EPSILON * DBL_EPSILON); + +/* ---------------------------------------------------------------------------- */ + +static int _unur_eigensystem_house ( int dim, double *A, double *d, double *e, double *e2 ); +/* householder reduction of a real symmetric matrix A to its tridiagonal form */ + +static int _unur_eigensystem_newqr(int dim, double *a, double *b, double *b2, double *g); +/* computes the eigenvalues of a real symmetric tri-diagonal matrix */ + +static int _unur_eigensystem_trinv(int dim, double *a, double *b, double *g, double *c, + double *p, double *q, double *r, double *w, double *y, + int *in); +/* computes the eigenvectors of a real symmetric tri-diagonal matrix */ + +static int _unur_eigensystem_back(int dim, double *a, double *e, double *c); +/* backtransformation of eigenvectors of tridiagonal matrix to original matrix */ + +/* ---------------------------------------------------------------------------- */ + + +int _unur_matrix_eigensystem(int dim, const double *M, double *values, double *vectors) + /*----------------------------------------------------------------------*/ + /* Computes the eigenvalues and the corresponding eigenvectors */ + /* of a real symmetric matrix M. */ + /* The eigenvectors are normalized and (almost) orthognal. */ + /* The eigenvectors are stored consecutively in vectors. */ + /* */ + /* Method: */ + /* Householder tri-diagonalization */ + /* Secant-QR method */ + /* Inverse iteration */ + /* */ + /* Parameters: */ + /* dim : dimension */ + /* M : real symmetric dim x dim matrix */ + /* */ + /* Output: */ + /* values : eigenvalues of M in ascending order */ + /* vectors : normalized eigenvectors of M stored row-wise */ + /* */ + /* Return: */ + /* UNUR_SUCCESS : eignesystem successfully computed */ + /* UNUR_FAILURE : qr algorithm did not converge */ + /* UNUR_ERR_NULL: invalid NULL pointer occurred */ + /*----------------------------------------------------------------------*/ +{ + double *A; /* local working copy of M (elements of A will be overwritten) */ + double *diag; + double *codiag; + double *wk; + int *in; + + int i; + int ret = 0; /* UNUR_SUCCESS */ + + /* Check arguments */ + CHECK_NULL(M,UNUR_ERR_NULL); + + /* Special case when M is one-dimensional */ + if (dim==1) { + values[0]=M[0]; + vectors[0]=1.; + return ret; + } + + /* make a local copy of the matrix M -> A */ + A = _unur_xmalloc(dim*dim*sizeof(double)); + memcpy(A, M, dim*dim*sizeof(double)); + + /* alocate working arrays */ + diag = _unur_xmalloc(dim*sizeof(double)); + codiag = _unur_xmalloc(dim*sizeof(double)); /* stored in 0..(dim-2) */ + wk = _unur_xmalloc((5*dim+2)*sizeof(double)); /*working array */ + in = _unur_xmalloc(dim*sizeof(int)); /*working array */ + + /* calculate tridiagonal Householder matrix */ + _unur_eigensystem_house(dim, A, diag, codiag, &wk[0]); + for (i=1; icrit && w>oldw); + +label_9: + g[ll-1]=xnull+shift; + + if (ll EPS2) { + cosec = p / b2[i-1] + ONE; + if (sec > TWO) gamm = (aa+oldgam)/sec - oldgam; + else gamm = aa - (aa+oldgam)/cosec; + p = gamm*gamm*sec; + b2[i-1] = (p + b2[i]) / cosec; + } + else { + gamm = aa; + p = gamm * gamm; + b2[i-1] = ZERO; + } + } + else { + gamm = -oldgam; + if (i==1) sec = ONE; + if ( ! _unur_iszero(sec) ) p = b2[i-1] / sec; + sec = ZERO; + b2[i-1] = p + b2[i]; + } + a[i-1] = a[i] - gamm + oldgam; + if (a[i-1] <= a[k-1]) k=i; + } + + a[l-1] = gamm + shift; + if (a[l-1] <= a[k-1]) k=l; + + /* convergence */ + if (k>1) { + if (b2[k-2]>crit2) continue; + b2[k-2] = ZERO; + } + if (kcrit2) continue; + for (i=k; i=1; i--) { + for (j=1; j<=dim; j++) { + p[j-1]=0.; + q[j-1]=b[j-1]; + r[j-1]=a[j-1]-g[i-1]; + y[j-1]=epsa; + } + if (i= fabs(b[j-1])) { + if ( _unur_iszero(r[j-1]) ) r[j-1]=EPS2; + in[j-1]=0; + f=b[j-1]/r[j-1]; + } + else { + in[j-1]=1; + f=r[j-1]/b[j-1]; + r[j-1]=b[j-1]; + t=r[j]; + r[j]=q[j-1]; + q[j-1]=t; + p[j-1]=q[j]; + q[j]=0.; + } + w[j-1]=f; + q[j] -= f*p[j-1]; + r[j] -= f*q[j-1]; + if ( _unur_iszero(r[j-1]) ) r[j-1]=EPS2; + } + if ( _unur_iszero(r[dim-1]) ) r[dim-1]=EPS2; + + /* two iterations */ + for (j=dim; j>=1; j--) { + y[j-1]=(y[j-1]-y[j]*q[j-1]-y[j+1]*p[j-1])/r[j-1]; + c[idx1(1,j)]=y[j-1]; + } + for (j=1; j=1; j--) { + y[j-1]=(y[j-1]-y[j]*q[j-1]-y[j+1]*p[j-1])/r[j-1]; + t += y[j-1]*y[j-1]; + } + /* Orthogonalize in case of close eigenvalues */ + if (close) { + for (k=i+1; k<=i+l; k++) { + t=0.; + for (j=1; j<=dim; j++) t += y[j-1]*c[idx1(k,j)]; + for (j=1; j<=dim; j++) y[j-1] -= t*c[idx1(k,j)]; + } + t=0.; + for (j=1; j<=dim; j++) t += y[j-1]*y[j-1]; + } + + /* normalize and store eigenvector */ + t=sqrt(t); + for (j=1; j<=dim; j++) { + c[idx1(i,j)]=y[j-1]/t; + } + + } + + return UNUR_SUCCESS; + +#undef idx1 +} /* end of _unur_eigensystem_trinv() */ + +/* ---------------------------------------------------------------------------- */ + +int _unur_eigensystem_back(int dim, double *a, double *e, double *c) +{ + /*----------------------------------------------------------------------*/ + /* Performas a back-transformation on the eigenvectors of the tri- */ + /* diagonal matrix in order to obtain the eigenvectors of the original */ + /* matrix. */ + /* */ + /* Parameters */ + /* dim : dimension */ + /* a, e : the strictly lower triangle of a and e contain the */ + /* : necessary information on the householder reduction */ + /* : (diagonal and co-diagonal elements) */ + /* : a and e are left unaltered by this routine */ + /* c : eigenvectors of tridiagonal matrix - overwritten by */ + /* : resultant eigenvectors */ + /*----------------------------------------------------------------------*/ +#define idx1(a,b) ((a-1)*dim+(b-1)) + + int i,j,k,k1; + double h, s, s2; + + for (k=dim-2; k>=1; k--) { + if( ! _unur_iszero(e[k-1]) ) { + k1=k+1; + h=-e[k-1]*a[idx1(k1,k)]; + for (j=1; j<=dim; j++) { + s=0.; + for (i=k1; i<=dim; i++) s += a[idx1(i,k)]*c[idx1(j,i)]; + s=s/h; + for (i=k1; i<=dim; i++) c[idx1(j,i)] -= s*a[idx1(i,k)]; + + /* non-negative sum of eigenvector components */ + s=0.; + for (i=1; i<=dim; i++) s += c[idx1(j,i)]; + if (s < 0.) { + for (i=1; i<=dim; i++) c[idx1(j,i)] = -c[idx1(j,i)]; + } + + /* eigenvector normalization */ + s2=0.; + for (i=1; i<=dim; i++) s2 += c[idx1(j,i)]*c[idx1(j,i)] ; + s2 = sqrt(s2); + for (i=1; i<=dim; i++) c[idx1(j,i)] /= s2 ; + + } + } + } + + return UNUR_SUCCESS; + +#undef idx1 +} /* end of _unur_eigensystem_back() */ + +/* ------------------------------------------------------------------------- */ diff --git a/vendor/unuran-1.11.0/src/utils/error.c b/vendor/unuran-1.11.0/src/utils/error.c new file mode 100644 index 0000000..23f0b9c --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/error.c @@ -0,0 +1,325 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: error.c * + * * + * routines for warnings and error messages * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include + +#include +#include + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +/* global variable used to record errors */ +int unur_errno = UNUR_SUCCESS; + +/* error handler used to report errors in UNURAN */ +static UNUR_ERROR_HANDLER *_unur_error_handler = _unur_error_handler_default; + +/*---------------------------------------------------------------------------*/ + +void +_unur_error_x( const char *objid, const char *file, int line, + const char *errortype, int errorcode, const char *reason ) + /*----------------------------------------------------------------------*/ + /* error handler */ + /* */ + /* parameters: */ + /* objid ... id/type of object */ + /* file ... file name (inserted by __FILE__) */ + /* line ... line number in source file (inserted by __LINE__) */ + /* errortype ... "warning" or "error" */ + /* errorcode ... UNURAN error code */ + /* reason ... (very) short description of reason for error */ + /*----------------------------------------------------------------------*/ +{ + _unur_error_handler(objid, file, line, errortype, errorcode, reason); + unur_errno = errorcode; +} /* end of _unur_error_x() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_error_handler_default( const char *objid, const char *file, int line, + const char *errortype, int errorcode, const char *reason ) + /*----------------------------------------------------------------------*/ + /* default error handler */ + /* */ + /* parameters: */ + /* objid ... id/type of object */ + /* file ... file name (inserted by __FILE__) */ + /* line ... line number in source file (inserted by __LINE__) */ + /* errortype ... "warning" or "error" */ + /* errorcode ... UNURAN error code */ + /* reason ... (very) short description of reason for error */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG = unur_get_stream(); + + /* generator identifier known ? */ + if (!objid) objid = "UNURAN"; + + fprintf(LOG,"%s: [%s] %s:%d - %s:\n", objid, errortype, file, line, + unur_get_strerror(errorcode)); + if (reason && strlen(reason)) + fprintf(LOG,"%s: ..> %s\n", objid, reason); + fflush(LOG); /* in case of a segmentation fault */ + +} /* end of _unur_error_handler_default() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_error_handler_off( const char *objid ATTRIBUTE__UNUSED, + const char *file ATTRIBUTE__UNUSED, + int line ATTRIBUTE__UNUSED, + const char *errortype ATTRIBUTE__UNUSED, + int errorcode ATTRIBUTE__UNUSED, + const char *reason ATTRIBUTE__UNUSED ) + /*----------------------------------------------------------------------*/ + /* disable error handler (except for logging) */ + /* */ + /* parameters: */ + /* objid ... id/type of object */ + /* file ... file name (inserted by __FILE__) */ + /* line ... line number in source file (inserted by __LINE__) */ + /* errortype ... "warning" or "error" */ + /* errorcode ... UNURAN error code */ + /* reason ... (very) short description of reason for error */ + /*----------------------------------------------------------------------*/ +{ + return; +} /* end of _unur_error_handler_off() */ + +/*---------------------------------------------------------------------------*/ +#ifdef UNUR_COOKIES + +void +_unur_error_cookies( const char *file, int line, unsigned observed, unsigned expected ) + /*----------------------------------------------------------------------*/ + /* print error message: invalid cookie detected */ + /* */ + /* parameters: */ + /* file ... file name (inserted by __FILE__) */ + /* line ... line number in source file (inserted by __LINE__) */ + /* observed ... observed cookie */ + /* expected ... expected cookie */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *reason = _unur_string_new(); + _unur_string_append( reason, "observed = %#x, expected = %#x", observed, expected ); + _unur_error_x( "COOKIE", file, line, "error", UNUR_ERR_COOKIE, reason->text); + _unur_string_free( reason ); +} /* end of _unur_error_cookies() */ + +#endif +/*---------------------------------------------------------------------------*/ + +const char * +unur_get_strerror ( const int errorcode ) + /*----------------------------------------------------------------------*/ + /* return string that describes error */ + /* */ + /* parameters: */ + /* errorcode ... error code */ + /* */ + /* return: */ + /* pointer to charater string */ + /* */ + /*----------------------------------------------------------------------*/ +{ + switch (errorcode) { + + /** procedure executed successfully **/ + case UNUR_SUCCESS: + return "(no error)"; + + /** distribution object **/ + case UNUR_ERR_DISTR_NPARAMS: + return "(distribution) invalid number of parameters"; + case UNUR_ERR_DISTR_DOMAIN: + return "(distribution) parameter out of domain"; + case UNUR_ERR_DISTR_GEN: + return "(distribution) invalid variant for special generator"; + case UNUR_ERR_DISTR_INVALID: + return "(distribution) invalid distribution object"; + case UNUR_ERR_DISTR_REQUIRED: + return "(distribution) incomplete distribution object, entry missing"; + case UNUR_ERR_DISTR_UNKNOWN: + return "(distribution) unknown distribution, cannot handle"; + case UNUR_ERR_DISTR_SET: + return "(distribution) set failed (invalid parameter)"; + case UNUR_ERR_DISTR_GET: + return "(distribution) get failed (parameter not set)"; + case UNUR_ERR_DISTR_DATA: + return "(distribution) data are missing (cannot execute)"; + case UNUR_ERR_DISTR_PROP: + return "(distribution) desired property does not exist"; + + /** parameter object **/ + case UNUR_ERR_PAR_SET: + return "(parameter) set failed, invalid parameter -> using default"; + case UNUR_ERR_PAR_VARIANT: + return "(parameter) invalid variant -> using default"; + case UNUR_ERR_PAR_INVALID: + return "(parameter) invalid parameter object"; + + /** generator object **/ + case UNUR_ERR_GEN_DATA: + return "(generator) (possible) invalid data"; + case UNUR_ERR_GEN_CONDITION: + return "(generator) condition for method violated"; + case UNUR_ERR_GEN_INVALID: + return "(generator) invalid generator object"; + case UNUR_ERR_GEN_SAMPLING: + return "(generator) sampling error"; + case UNUR_ERR_NO_REINIT: + return "(generator) reinit not implemented"; + case UNUR_ERR_NO_QUANTILE: + return "(generator) quantile not implemented"; + case UNUR_ERR_GEN: + return "(generator)"; + + /** uniform random number generator (URNG) object **/ + case UNUR_ERR_URNG: + return "(URNG)"; + case UNUR_ERR_URNG_MISS: + return "(URNG) missing functionality"; + + /** string parser **/ + case UNUR_ERR_STR: + return "(parser) invalid string"; + case UNUR_ERR_STR_UNKNOWN: + return "(parser) unknown keyword"; + case UNUR_ERR_STR_SYNTAX: + return "(parser) syntax error"; + case UNUR_ERR_STR_INVALID: + return "(parser) invalid parameter"; + case UNUR_ERR_FSTR_SYNTAX: + return "(function parser) syntax error"; + case UNUR_ERR_FSTR_DERIV: + return "(function parser) cannot derivate function"; + + /** misc **/ + case UNUR_ERR_DOMAIN: + return "argument out of domain"; + case UNUR_ERR_ROUNDOFF: + return "(serious) round-off error"; + case UNUR_ERR_MALLOC: + return "virtual memory exhausted"; + case UNUR_ERR_NULL: + return "invalid NULL pointer"; + case UNUR_ERR_COOKIE: + return "invalid cookie"; + case UNUR_ERR_SILENT: + return "(silent error)"; + case UNUR_ERR_GENERIC: + return ""; + case UNUR_ERR_INF: + return "invalid infinity occured"; + case UNUR_ERR_NAN: + return "NaN occured"; + + /** compilation switches **/ + case UNUR_ERR_COMPILE: + return "not available, recompile library"; + + /** this should not happen **/ + case UNUR_ERR_SHOULD_NOT_HAPPEN: + default: + return "error should not happen, report this!"; + + } + +} /* end of unur_get_strerror() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_ERROR_HANDLER * +unur_set_error_handler( UNUR_ERROR_HANDLER *new_handler ) + /*----------------------------------------------------------------------*/ + /* (re)set error handler */ + /* */ + /* parameters: */ + /* new_handler ... new error handler */ + /* */ + /* return: */ + /* pointer to old error handler */ + /*----------------------------------------------------------------------*/ +{ + UNUR_ERROR_HANDLER *old_handler = _unur_error_handler; + _unur_error_handler = (new_handler) ? new_handler : _unur_error_handler_default; + return old_handler; +} /* end of unur_set_error_handler() */ + +/*---------------------------------------------------------------------------*/ + +UNUR_ERROR_HANDLER * +unur_set_error_handler_off( void ) + /*----------------------------------------------------------------------*/ + /* disable error messages */ + /* */ + /* parameters: none */ + /* */ + /* return: */ + /* pointer to old error handler */ + /*----------------------------------------------------------------------*/ +{ + UNUR_ERROR_HANDLER *old_handler = _unur_error_handler; + _unur_error_handler = _unur_error_handler_off; + return old_handler; +} /* end of unur_set_error_handler_off() */ + +/*---------------------------------------------------------------------------*/ + +int +unur_get_errno ( void ) + /*----------------------------------------------------------------------*/ + /* get current value of global variable 'unur_errno' */ + /*----------------------------------------------------------------------*/ +{ + return unur_errno; +} + +/*---------------------------------------------------------------------------*/ + +void +unur_reset_errno ( void ) + /*----------------------------------------------------------------------*/ + /* reset global variable 'unur_errno' to UNUR_SUCCESS */ + /*----------------------------------------------------------------------*/ +{ + unur_errno = UNUR_SUCCESS; +} + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/error.h b/vendor/unuran-1.11.0/src/utils/error.h new file mode 100644 index 0000000..add249c --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/error.h @@ -0,0 +1,266 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: error.h * + * * + * PURPOSE: * + * Global variables and prototypes for error handling. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* + =NODE Error_reporting Error reporting + + =UP Error_Debug [30] + + =DESCRIPTION + UNU.RAN routines report an error whenever they cannot perform the + requested task. For example, applying transformed density + rejection to a distribution that violates the T-concavity + condition, or trying to set a parameter that is out of range, + result in an error message. + It might also happen that the setup fails for transformed density + rejection for a T-concave distribution with some extreme density + function simply because of round-off errors that makes the + generation of a hat function numerically impossible. + Situations like this may happen when using black box algorithms and + you should check the return values of all routines. + + All @command{..._set_...}, and @command{..._chg_...} calls + return @code{UNUR_SUCCESS} if they could be executed + successfully. Otherwise, some error codes are returned if it was + not possible to set or change the desired parameters, + e.g. because the given values are out of range, or simply + because the set call does not work for the chosen method. + + All routines that return a pointer to the requested object will + return a NULL pointer in case of error. + (Thus you should always check the pointer to avoid possible + segmentation faults. Sampling routines usually do not check the + given pointer to the generator object.) + + The library distinguishes between two major classes of error: + + @table @emph + + @item (fatal) errors: + The library was not able to construct the + requested object. + + @item warnings: + Some problems encounters while constructing a generator + object. The routine has tried to solve the problem but the resulting + object might not be what you want. For example, chosing a special + variant of a method does not work and the initialization routine + might switch to another variant. Then the generator produces random + variates of the requested distribution but correlation induction + is not possible. However, it also might happen that + changing the domain of a distribution has failed. Then the generator + produced random variates with too large/too small range, i.e. their + distribution is not correct. + @end table + + It is obvious from the example that this distinction between errors + and warning is rather crude and sometimes arbitrary. + + UNU.RAN routines use the global variable @var{unur_errno} to + report errors, completely analogously to @var{errno} in the ANSI + C standard library. + (However this approach is not thread-safe. There can + be only one instance of a global variable per program. Different + threads of execution may overwrite @var{unur_errno} + simultaneously). + Thus when an error occurs the caller of the routine can examine the + error code in @var{unur_errno} to get more details about the + reason why a routine failed. You get a short + description of the error by a unur_get_strerror() call. + All the error code numbers have prefix @code{UNUR_ERR_} and expand + to non-zero constant unsigned integer values. + Error codes are divided into six main groups, + see @ref{Errno,,Error codes}. + + Alternatively, the variable @var{unur_errno} can also read by a + unur_get_errno() call and can be reset by the unur_reset_errno() + call (this is in particular required for the Windows version of the + library). + + Additionally, there exists a error handler + (@pxref{Error_handlers,,Error handlers}) that is invoked in case + of an error. + + + In addition to reporting errors by setting error codes in + @var{unur_errno}, the library also has an error handler + function. This function is called by other library functions + when they report an error, just before they return to the + caller (@pxref{Error_handlers,,Error handlers}). + The default behavior of the error handler is to print a short + message: + + @example + AROU.004: [error] arou.c:1500 - (generator) condition for method violated: + AROU.004: ..> PDF not unimodal + @end example + + The purpose of the error handler is to provide a function + where a breakpoint can be set that will catch library errors when + running under the debugger. It is not intended for use in production + programs, which should handle any errors using the return codes. + + =END +*/ + +/*---------------------------------------------------------------------------*/ + +/* =ROUTINES */ + +extern int unur_errno; +/* + Global variable for reporting diagnostics of error. +*/ + +int unur_get_errno ( void ); +/* + Get current value of global variable @var{unur_errno}. +*/ + +void unur_reset_errno ( void ); +/* + Reset global variable @var{unur_errno} to @code{UNUR_SUCCESS} + (i.e., no errors occured). +*/ + +const char *unur_get_strerror ( const int errnocode ); +/* + Get a short description for error code value. +*/ + +/* =END */ + +/* =EON */ + +/*---------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ + +/* + =NODE Error_handlers Error handlers + + =UP Error_Debug [50] + + =DESCRIPTION + The default behavior of the UNU.RAN error handler is to print a + short message onto the output stream, usually a logfile + (@pxref{Output_streams,,Output streams}), e.g., + + @example + AROU.004: [error] arou.c:1500 - (generator) condition for method violated: + AROU.004: ..> PDF not unimodal + @end example + + This error handler can be switched off using the + unur_set_error_handler_off() call, or replace it by a new one. + Thus it allows to set a breakpoint that will catch library errors when + running under the debugger. It also can be used to redirect + error messages when UNU.RAN is included in general purpose + libraries or in interactive programming environments. + + @deftp {Data Type} UNUR_ERROR_HANDLER + + This is the type of UNU.RAN error handler functions. An error + handler will be passed six arguments which specify + the identifier of the object where the error occured (a string), + the name of the source file in which it occurred (also a string), + the line number in that file (an integer), + the type of error (a string: @code{"error"} or @code{"warning"}), + the error number (an integert), and + the reason for the error (a string). + The source file and line number are set at compile time + using the @code{__FILE__} and @code{__LINE__} directives in the + preprocessor. + The error number can be translated into a short description + using a unur_get_strerror() call. + An error handler function returns type @code{void}. + + Error handler functions should be defined like this, + @example + void my_handler( + @ @ @ @ @ @ @ @ @ @ @ const char *objid, + @ @ @ @ @ @ @ @ @ @ @ const char *file, + @ @ @ @ @ @ @ @ @ @ @ int line, + @ @ @ @ @ @ @ @ @ @ @ const char *errortype, + @ @ @ @ @ @ @ @ @ @ @ int unur_errno, + @ @ @ @ @ @ @ @ @ @ @ const char *reason ) + @end example + @end deftp + + To request the use of your own error handler you need the call + unur_set_error_handler(). + + =END + +*/ + +/* =ROUTINES */ + + +UNUR_ERROR_HANDLER *unur_set_error_handler( UNUR_ERROR_HANDLER *new_handler ); +/* + This function sets a new error handler, @var{new_handler}, for the + UNU.RAN library routines. The previous handler is returned (so that you + can restore it later). Note that the pointer to a user defined + error handler function is stored in a static variable, so there + can be only one error handler per program. This function should + be not be used in multi-threaded programs except to set up a + program-wide error handler from a master thread. + + To use the default behavior set the error handler to NULL. +*/ + +UNUR_ERROR_HANDLER *unur_set_error_handler_off( void ); +/* + This function turns off the error handler by defining an error + handler which does nothing (except of setting @var{unur_errno}. + The previous handler is returned (so that you can restore it later). +*/ + +/* =END */ + +/* =EON */ + +/*---------------------------------------------------------------------------*/ + +/* + + @example + void my_handler( const char *objid, const char *file, int line, + const char *errortype, int unur_errno, const char *reason ); + void handler (const char * reason, + const char * file, + int line, + int gsl_errno) + @end example +*/ diff --git a/vendor/unuran-1.11.0/src/utils/error_source.h b/vendor/unuran-1.11.0/src/utils/error_source.h new file mode 100644 index 0000000..11f66b1 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/error_source.h @@ -0,0 +1,89 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: error_source.h * + * * + * PURPOSE: * + * defines macros and function prototypes error messages * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + + +/*---------------------------------------------------------------------------*/ +#ifndef UNUR_ERROR_SOURCE_H_SEEN +#define UNUR_ERROR_SOURCE_H_SEEN +/*---------------------------------------------------------------------------*/ + +void _unur_error_x( const char *objid, const char *file, int line, + const char *errortype, int errorcode, const char *reason ); +/*---------------------------------------------------------------------------*/ +/* set unur_errno and call error handler. */ +/*---------------------------------------------------------------------------*/ + +/* void _unur_error_formated( const char *objid, const char *file, int line, */ +/* const char *errortype, int errorcode, const char *format, ... ); */ +/*---------------------------------------------------------------------------*/ +/* like _unur_error_x but used a template for more sophisticated messages. */ +/*---------------------------------------------------------------------------*/ + +void _unur_error_handler_default( const char *objid, const char *file, int line, + const char *errortype, int errorcode, const char *reason ); +/*---------------------------------------------------------------------------*/ +/* unuran default error handler */ +/*---------------------------------------------------------------------------*/ + +void _unur_error_handler_off( const char *objid, const char *file, int line, + const char *errortype, int errorcode, const char *reason ); +/*---------------------------------------------------------------------------*/ +/* disabled error handler (suppress all warnings and error messages */ +/*---------------------------------------------------------------------------*/ + +#ifdef UNUR_COOKIES +void _unur_error_cookies( const char *file, int line, unsigned observed, unsigned expected ); +/*---------------------------------------------------------------------------*/ +/* report invalid cookie */ +/*---------------------------------------------------------------------------*/ +#endif + +#define _unur_error(genid,errorcode,reason) \ + do { \ + _unur_error_x((genid),__FILE__,__LINE__,"error",(errorcode),(reason)); \ + } while (0) +/*---------------------------------------------------------------------------*/ +/* call error handler in case of a (fatal) error. */ +/*---------------------------------------------------------------------------*/ + +#define _unur_warning(genid,errorcode,reason) \ + do { \ + _unur_error_x((genid),__FILE__,__LINE__,"warning",(errorcode),(reason)); \ + } while (0) +/*---------------------------------------------------------------------------*/ +/* call error handler in case of a warning. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +#endif /* UNUR_ERROR_SOURCE_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/fmax.c b/vendor/unuran-1.11.0/src/utils/fmax.c new file mode 100644 index 0000000..c10f594 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/fmax.c @@ -0,0 +1,467 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: fmax.c * + * * + * Find maximum of a function using Brent's algorithm. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include "fmax_source.h" + +/*---------------------------------------------------------------------------*/ + +double +_unur_util_find_max( struct unur_funct_generic fs, /* function structure */ + double interval_min, /* lower bound of interval */ + double interval_max, /* upper bound of interval */ + double guess_max /* initial guess for maximum */ + ) + /*----------------------------------------------------------------------*/ + /* find max of univariate continuous distribution numerically */ + /* */ + /* This is achieved by the following steps: */ + /* -- Determine a interval containing the max and a third */ + /* point within ( x0< x1 < x2 ) */ + /* ++ Determine a region where to search the max; this will be the */ + /* interval [max-100, max+100] if this is no contrdiction to */ + /* the given interval;`max' is the best known approx to the max */ + /* ++ Find a point in the interval with a positve pdf */ + /* This is done by two geometric sequences of MAX_SRCH elements */ + /* and find two other points within the given domain */ + /* ++ Unbounded domains: refine x0, x1, x2 until: */ + /* f(x0) < f(x1) > f(x2) */ + /* -- invoke a maximization-routine to determine the max */ + /* */ + /* parameters: */ + /* fs ... function structure */ + /* interval_min ... left boundary of function definition interval */ + /* interval_max ... right boundary of function definition interval */ + /* guess_max ... initial guess for max position */ + /* */ + /* return: */ + /* x ... approximate position of max on success */ + /* UNUR_INFINITY ... on error */ + /*----------------------------------------------------------------------*/ +{ +#define MAX_SRCH (100) + + int i; + + double x[3]; /* max (and x[2]) should be between x[0] and x[2] ...*/ + double fx[3]; /* ... and the respective funtion values */ + double max; /* (approximative) max of the distribution */ + double max_l; /* lower bound for max search */ + double max_u; /* upper bound for max search */ + double step; + + int unbound_left; + int unbound_right; + + /* first guess for max */ + max = (_unur_FP_is_infinity(guess_max)) ? 0. : guess_max; + + /* determine where to look for the max */ + + /* unbounded domain */ + if ( _unur_FP_is_minus_infinity(interval_min) && + _unur_FP_is_infinity(interval_max) ){ + + unbound_left = 1; + unbound_right = 1; + + x[1] = max; + fx[1] = fs.f(x[1], fs.params); + max_l = max - 100.0; + max_u = max + 100.0; + + } + /* domain unbounded on the right */ + else if ( ! _unur_FP_is_minus_infinity(interval_min) && + _unur_FP_is_infinity(interval_max) ){ + + unbound_left = 0; + unbound_right = 1; + + if ( max >= interval_min ){ + x[1] = max; + fx[1] = fs.f(x[1], fs.params); + max_l = interval_min; + max_u = 2 * max - interval_min; + } + else{ + x[1] = interval_min + 100.0; + fx[1] = fs.f(x[1], fs.params); + max_l = interval_min; + max_u = x[1] + 100.0; + } + + } + /* domain unbounded on the left */ + else if ( _unur_FP_is_minus_infinity(interval_min) && + ! _unur_FP_is_infinity(interval_max) ){ + + unbound_left = 1; + unbound_right = 0; + + if ( max <= interval_max ){ + x[1] = max; + fx[1] = fs.f(x[1], fs.params); + max_l = interval_max - 2 * max; + max_u = interval_max; + } + else{ + x[1] = interval_max - 100.0; + fx[1] = fs.f(x[1], fs.params); + max_l = x[1] - 100.0; + max_u = interval_max; + } + + } + /* domain is bounded */ + else { + + unbound_left = 0; + unbound_right = 0; + + if ( max >= interval_min && max <= interval_max ){ + x[1] = max; + fx[1] = fs.f(x[1], fs.params); + } + else{ + x[1] = interval_min/2.0 + interval_max/2.0; + fx[1] = fs.f(x[1], fs.params); + } + max_l = interval_min; + max_u = interval_max; + + } + + max = x[1]; /* not exact mode -- best guess */ + + + /* find point with pdf > 0.0 -- max MAX_SRCH trials */ + + /* search on the left side */ + step = pow(x[1]-max_l, 1.0/MAX_SRCH); + i = 0; + while (i <= MAX_SRCH && _unur_FP_same(0.0, fx[1]) ){ + x[1] = max - pow(step, (double)i); + fx[1] = fs.f(x[1], fs.params); + i++; + } + + /* search on the right side */ + if( _unur_FP_same(0.0, fx[1]) ){ + step = pow(max_u-x[1], 1.0/MAX_SRCH); + i = 0; + while (i <= MAX_SRCH && _unur_FP_same(0.0, fx[1]) ){ + x[1] = max + pow(step, (double)i); + fx[1] = fs.f(x[1], fs.params); + i++; + } + } + + /* no success -- exit routine */ + if( _unur_FP_same(fx[1], 0.0) ) + return UNUR_INFINITY; /* can't find max in flat region */ + + /* x[1] has f > 0 or routines already terminated */ + + + + /* determine 3 points in the given domain -- + at least one with pdf > 0 */ + if ( unbound_left ){ + + x[2] = x[1]; fx[2] = fx[1]; + x[1] = x[2] - 1.0; fx[1] = fs.f(x[1], fs.params); + x[0] = x[2] - 2.0; fx[0] = fs.f(x[0], fs.params); + + } + else if ( unbound_right ){ + + x[0] = x[1]; fx[0] = fx[1]; + x[1] = x[0] + 1.0; fx[1] = fs.f(x[1], fs.params); + x[2] = x[0] + 2.0; fx[2] = fs.f(x[2], fs.params); + + } + else{ /* bounded */ + + x[0] = interval_min; fx[0] = fs.f(x[0], fs.params); + x[2] = interval_max; fx[2] = fs.f(x[2], fs.params); + + if ( _unur_FP_same(x[1], interval_min) || + _unur_FP_same(x[1], interval_max) ){ + x[1] = interval_min/2.0 + interval_max/2.0; + fx[1] = fs.f(x[1], fs.params); + } + + } + /* points x[i] with their function values determined */ + + /* find interval containing the max */ + + step = 1.0; + if ( unbound_right ){ + while(fx[0] <= fx[1] && fx[1] <= fx[2]){ /* on the left side of the max */ + + step *= 2.0; + x[0] = x[1]; fx[0] = fx[1]; + x[1] = x[2]; fx[1] = fx[2]; + x[2] += step; fx[2] = fs.f(x[2], fs.params); + } + } + + step = 1.0; /* reset step size */ + if ( unbound_left ){ + while(fx[0] >= fx[1] && fx[1] >= fx[2]){ /* on the right side of the max */ + + step *= 2.0; + x[2] = x[1]; fx[2] = fx[1]; + x[1] = x[0]; fx[1] = fx[0]; + x[0] -= step; fx[0] = fs.f(x[0], fs.params); + + } + } + + /* now: the max is between x[0] and x[2] */ + + /* printf("x0: %f, fx0: %e\n", x[0], fx[0]); */ + /* printf("x1: %f, fx1: %e\n", x[1], fx[1]); */ + /* printf("x2: %f, fx2: %e\n", x[2], fx[2]); */ + + /** TODO: FLT_MIN must be much larger than DBL_MIN **/ + + max = _unur_util_brent( fs, x[0], x[2], x[1], FLT_MIN ); + if (!(_unur_FP_is_infinity( max )) ){ + /* mode successfully computed */ + + } + else { + /* computing max did not work */ + return UNUR_INFINITY; + } + + /* o.k. */ + return max; + +#undef MAX_SRCH +} /* end of _unur_util_find_max() */ + +/*---------------------------------------------------------------------------*/ +/* */ +/* Brent algorithm for maximum-calculation of a continous function */ +/* */ +/*---------------------------------------------------------------------------*/ +/* + ***************************************************************************** + * C math library * + * function FMINBR - one-dimensional search for a function minimum * + * over the given range * + * * + * Author: Oleg Keselyov. * + * * + * modified by Josef Leydold (documentation unchanged) * + * computed maximum instead of minimum. * + * * + * Input * + * double fminbr(f, a,b,c,tol) * + * double a; Minimum will be seeked for over * + * double b; a range [a,b], a being < b. * + * double c; c within (a,b) is first guess * + * double (*f)(double x); Name of the function whose minimum * + * will be seeked for * + * double tol; Acceptable tolerance for the minimum * + * location. It have to be positive * + * (e.g. may be specified as EPSILON) * + * * + * Output * + * Fminbr returns an estimate for the minimum location with accuracy * + * 3*SQRT_EPSILON*abs(x) + tol. * + * The function always obtains a local minimum which coincides with * + * the global one only if a function under investigation being * + * unimodular. * + * If a function being examined possesses no local minimum within * + * the given range, Fminbr returns 'a' (if f(a) < f(b)), otherwise * + * it returns the right range boundary value b. * + * * + * Algorithm * + * G.Forsythe, M.Malcolm, C.Moler, Computer methods for mathematical * + * computations. M., Mir, 1980, p.202 of the Russian edition * + * * + * The function makes use of the "gold section" procedure combined with * + * the parabolic interpolation. * + * At every step program operates three abscissae - x,v, and w. * + * x - the last and the best approximation to the minimum location, * + * i.e. f(x) <= f(a) or/and f(x) <= f(b) * + * (if the function f has a local minimum in (a,b), then the both * + * conditions are fulfiled after one or two steps). * + * v,w are previous approximations to the minimum location. They may * + * coincide with a, b, or x (although the algorithm tries to make all * + * u, v, and w distinct). Points x, v, and w are used to construct * + * interpolating parabola whose minimum will be treated as a new * + * approximation to the minimum location if the former falls within * + * [a,b] and reduces the range enveloping minimum more efficient than * + * the gold section procedure. * + * When f(x) has a second derivative positive at the minimum location * + * (not coinciding with a or b) the procedure converges superlinearly * + * at a rate order about 1.324 * + * * + *****************************************************************************/ + +/* in case of any error UNUR_INFINITY is returned */ + +double +_unur_util_brent( /* An estimate to the min or max location */ + struct unur_funct_generic fs, /* Function struct */ + double a, /* Left border | of the range */ + double b, /* Right border| the min is seeked */ + double c, /* first guess for the min/max */ + double tol) /* Acceptable tolerance */ +{ +#define SQRT_EPSILON (1.e-7) /* tolerance for relative error */ +#define MAXIT (1000) /* maximum number of iterations */ + + /* compute maximum (instead of minimum as in original implementation ) */ +#define f(x) ( (-1) * ((fs.f)(x, fs.params)) ) + + + int i; + + double x,v,w; /* Abscissae, descr. see above */ + double fx; /* f(x) */ + double fv; /* f(v) */ + double fw; /* f(w) */ + const double r = (3.-sqrt(5.0))/2; /* Gold section ratio */ + + /* check arguments */ + CHECK_NULL(fs.f, UNUR_INFINITY); + if ( tol < 0. || b <= a || c <= a || b <= c) { + _unur_error("CMAX",UNUR_ERR_SHOULD_NOT_HAPPEN,""); + return UNUR_INFINITY; + } + + + /* Origially the third point was computed by golden section. In the */ + /* modified version it is given as point `c' by the calling function. */ + /* v = a + r*(b-a); fv = f(v); First step - always gold section */ + + v = c; fv = f(v); /* First step */ + x = v; w = v; + fx=fv; fw=fv; + + for(i=0; i < MAXIT; i++) { /* Main iteration loop */ + double range = b-a; /* Range over which the minimum is */ + /* seeked for */ + double middle_range = (a+b)/2; + double tol_act = /* Actual tolerance */ + SQRT_EPSILON*fabs(x) + tol/3; + double new_step; /* Step at this iteration */ + + if( fabs(x-middle_range) + range/2 <= 2*tol_act ) + return x; /* Acceptable approx. is found */ + + /* Obtain the gold section step */ + new_step = r * ( x= tol_act ) { /* If x and w are distinct */ + /* interpolatiom may be tried */ + register double p; /* Interpolation step is calculated */ + register double q; /* as p/q; division operation */ + /* is delayed until last moment */ + register double t; + + t = (x-w) * (fx-fv); + q = (x-v) * (fx-fw); + p = (x-v)*q - (x-w)*t; + q = 2*(q-t); + + if( q>(double)0 ) /* q was calculated with the */ + p = -p; /* opposite sign; make q positive */ + else /* and assign possible minus to p */ + q = -q; + + if( fabs(p) < fabs(new_step*q) && /* If x + p/q falls in [a,b] not too */ + p > q*(a-x+2*tol_act) && /* close to a and b, and isn't too */ + p < q*(b-x-2*tol_act) ) /* large, it is accepted. */ + new_step = p/q; /* If p/q is too large then the */ + /* gold section procedure can reduce */ + /* [a,b] range to more extent. */ + } + + if( fabs(new_step) < tol_act ) { /* Adjust the step to be not less */ + if( new_step > (double)0 ) /* than tolerance. */ + new_step = tol_act; + else + new_step = -tol_act; + } + /* Obtain the next approximation to min */ + { /* and reduce the enveloping range. */ + register double t = x + new_step; /* Tentative point for the min */ + register double ft = f(t); + + if( ft <= fx ) { /* t is a better approximation */ + if( t < x ) + b = x; /* Reduce the range so that */ + else /* t would fall within it */ + a = x; + + v = w; w = x; x = t; /* Assign the best approx to x */ + fv=fw; fw=fx; fx=ft; + } + else { /* x remains the better approx */ + if( t < x ) + a = t; /* Reduce the range enclosing x */ + else + b = t; + + if( ft <= fw || _unur_FP_same(w,x) ) { + v = w; w = t; + fv=fw; fw=ft; + } + else if( ft<=fv || _unur_FP_same(v,x) || _unur_FP_same(v,w) ) { + v = t; + fv=ft; + } + } + } /* ----- end-of-block ----- */ + } /* ===== End of for loop ===== */ + + /* maximal number of iterations exceeded */ + return UNUR_INFINITY; + +#undef f +#undef MAXIT +#undef SQRT_EPSILON +} /* end of _unur_util_brent() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/fmax_source.h b/vendor/unuran-1.11.0/src/utils/fmax_source.h new file mode 100644 index 0000000..929c384 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/fmax_source.h @@ -0,0 +1,48 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: fmax_source.h * + * * + * PURPOSE: * + * find minimum or maximum of continuous function * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/* find maximum of a generic function in an interval providing initial guess */ +double _unur_util_find_max( struct unur_funct_generic fs, + double interval_min, + double interval_max, + double max_guess ); + +/*---------------------------------------------------------------------------*/ + +/* brent algorithm for maximum-calculation of a continous function */ +double _unur_util_brent(struct unur_funct_generic fs, + double a, double b, double c, double tol); + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/hooke.c b/vendor/unuran-1.11.0/src/utils/hooke.c new file mode 100644 index 0000000..0f2976b --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/hooke.c @@ -0,0 +1,291 @@ +/********************************************************************/ +/** **/ +/** hooke.c **/ +/** **/ +/** find minimum of a multivariate function **/ +/** **/ +/** authors: see below **/ +/** minor changes by Josef Leydold **/ +/** **/ +/** adapted for unuran in June 2004 **/ +/** **/ +/********************************************************************/ + +/*-----------------------------------------------------------------*/ + +/* Nonlinear Optimization using the algorithm of Hooke and Jeeves */ +/* 12 February 1994 author: Mark G. Johnson */ + + +/* Find a point X where the nonlinear function f(X) has a local */ +/* minimum. X is an n-vector and f(X) is a scalar. In mathe- */ +/* matical notation f: R^n -> R^1. The objective function f() */ +/* is not required to be continuous. Nor does f() need to be */ +/* differentiable. The program does not use or require */ +/* derivatives of f(). */ + +/* The software user supplies three things: a subroutine that */ +/* computes f(X), an initial "starting guess" of the minimum point */ +/* X, and values for the algorithm convergence parameters. Then */ +/* the program searches for a local minimum, beginning from the */ +/* starting guess, using the Direct Search algorithm of Hooke and */ +/* Jeeves. */ + +/* This C program is adapted from the Algol pseudocode found in */ +/* "Algorithm 178: Direct Search" by Arthur F. Kaupe Jr., Commun- */ +/* ications of the ACM, Vol 6. p.313 (June 1963). It includes the */ +/* improvements suggested by Bell and Pike (CACM v.9, p. 684, Sept */ +/* 1966) and those of Tomlin and Smith, "Remark on Algorithm 178" */ +/* (CACM v.12). The original paper, which I don't recommend as */ +/* highly as the one by A. Kaupe, is: R. Hooke and T. A. Jeeves, */ +/* "Direct Search Solution of Numerical and Statistical Problems", */ +/* Journal of the ACM, Vol. 8, April 1961, pp. 212-229. */ + +/* Calling sequence: */ +/* int hooke(dim, startpt, endpt, rho, epsilon, itermax) */ +/* */ +/* dim {an integer} This is the number of dimensions */ +/* in the domain of f(). It is the number of */ +/* coordinates of the starting point (and the */ +/* minimum point.) */ +/* startpt {an array of doubles} This is the user- */ +/* supplied guess at the minimum. */ +/* endpt {an array of doubles} This is the location of */ +/* the local minimum, calculated by the program */ +/* rho {a double} This is a user-supplied convergence */ +/* parameter (more detail below), which should be */ +/* set to a value between 0.0 and 1.0. Larger */ +/* values of rho give greater probability of */ +/* convergence on highly nonlinear functions, at a */ +/* cost of more function evaluations. Smaller */ +/* values of rho reduces the number of evaluations */ +/* (and the program running time), but increases */ +/* the risk of nonconvergence. See below. */ +/* epsilon {a double} This is the criterion for halting */ +/* the search for a minimum. When the algorithm */ +/* begins to make less and less progress on each */ +/* iteration, it checks the halting criterion: if */ +/* the stepsize is below epsilon, terminate the */ +/* iteration and return the current best estimate */ +/* of the minimum. Larger values of epsilon (such */ +/* as 1.0e-4) give quicker running time, but a */ +/* less accurate estimate of the minimum. Smaller */ +/* values of epsilon (such as 1.0e-7) give longer */ +/* running time, but a more accurate estimate of */ +/* the minimum. */ +/* itermax {an integer} A second, rarely used, halting */ +/* criterion. If the algorithm uses >= itermax */ +/* iterations, halt. */ + + +/* The user-supplied objective function f(x) is provided as the */ +/* member-function of the struct unur_funct_vgeneric */ + +/* rho, the algorithm convergence control */ +/* The algorithm works by taking "steps" from one estimate of */ +/* a minimum, to another (hopefully better) estimate. Taking */ +/* big steps gets to the minimum more quickly, at the risk of */ +/* "stepping right over" an excellent point. The stepsize is */ +/* controlled by a user supplied parameter called rho. At each */ +/* iteration, the stepsize is multiplied by rho (0 < rho < 1), */ +/* so the stepsize is successively reduced. */ +/* Small values of rho correspond to big stepsize changes, */ +/* which make the algorithm run more quickly. However, there */ +/* is a chance (especially with highly nonlinear functions) */ +/* that these big changes will accidentally overlook a */ +/* promising search vector, leading to nonconvergence. */ +/* Large values of rho correspond to small stepsize changes, */ +/* which force the algorithm to carefully examine nearby points */ +/* instead of optimistically forging ahead. This improves the */ +/* probability of convergence. */ +/* The stepsize is reduced until it is equal to (or smaller */ +/* than) epsilon. So the number of iterations performed by */ +/* Hooke-Jeeves is determined by rho and epsilon: */ +/* rho**(number_of_iterations) = epsilon */ +/* In general it is a good idea to set rho to an aggressively */ +/* small value like 0.5 (hoping for fast convergence). Then, */ +/* if the user suspects that the reported minimum is incorrect */ +/* (or perhaps not accurate enough), the program can be run */ +/* again with a larger value of rho such as 0.85, using the */ +/* result of the first minimization as the starting guess to */ +/* begin the second minimization. */ + +/* Normal use: (1) Code your function f() in the C language */ +/* (2) Install your starting guess {or read it in} */ +/* (3) Run the program */ +/* (4) {for the skeptical}: Use the computed minimum */ +/* as the starting point for another run */ + +/* Data Fitting: */ +/* Code your function f() to be the sum of the squares of the */ +/* errors (differences) between the computed values and the */ +/* measured values. Then minimize f() using Hooke-Jeeves. */ +/* EXAMPLE: you have 20 datapoints (ti, yi) and you want to */ +/* find A,B,C such that (A*t*t) + (B*exp(t)) + (C*tan(t)) */ +/* fits the data as closely as possible. Then f() is just */ +/* f(x) = SUM (measured_y[i] - ((A*t[i]*t[i]) + (B*exp(t[i])) */ +/* + (C*tan(t[i]))))^2 */ +/* where x[] is a 3-vector consisting of {A, B, C}. */ + +/* */ +/* The author of this software is M.G. Johnson. */ +/* Permission to use, copy, modify, and distribute this software */ +/* for any purpose without fee is hereby granted, provided that */ +/* this entire notice is included in all copies of any software */ +/* which is or includes a copy or modification of this software */ +/* and in all copies of the supporting documentation for such */ +/* software. THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT */ +/* ANY EXPRESS OR IMPLIED WARRANTY. IN PARTICULAR, NEITHER THE */ +/* AUTHOR NOR AT&T MAKE ANY REPRESENTATION OR WARRANTY OF ANY */ +/* KIND CONCERNING THE MERCHANTABILITY OF THIS SOFTWARE OR ITS */ +/* FITNESS FOR ANY PARTICULAR PURPOSE. */ +/* */ +/*-----------------------------------------------------------------*/ + +#include +#include "hooke_source.h" + +/* The following maximum number of 'sub-iterations' has been */ +/* introduced in order to avoid potential infinite loops in the */ +/* main hooke algorithm. */ +#define HOOKE_SUBITERMAX 10 + +/*-----------------------------------------------------------------*/ + +/* prototypes */ + +/* given a point, look for a better one nearby, one coord at a time */ +static double best_nearby(struct unur_funct_vgeneric faux, + double *delta, double *point, + double prevbest, int dim); + +/*-----------------------------------------------------------------*/ + +static double best_nearby(struct unur_funct_vgeneric faux, + double *delta, double *point, + double prevbest, int dim) +/* + Given a point, look for a better one nearby, one coord at a time +*/ +{ + double *z; + double minf, ftmp; + int i; + + z=(double *) malloc( dim*sizeof(double)); + + minf = prevbest; + for (i = 0; i < dim; i++) + z[i] = point[i]; + for (i = 0; i < dim; i++) { + z[i] = point[i] + delta[i]; + ftmp = faux.f(z, faux.params); + if (ftmp < minf) + minf = ftmp; + else { + delta[i] = 0.0 - delta[i]; + z[i] = point[i] + delta[i]; + ftmp = faux.f(z, faux.params); + if (ftmp < minf) + minf = ftmp; + else + z[i] = point[i]; + } + } + for (i = 0; i < dim; i++) + point[i] = z[i]; + + + free(z); + + return (minf); +} /* end of best_nearby() */ + +/*-----------------------------------------------------------------*/ + +int _unur_hooke(struct unur_funct_vgeneric faux, + int dim, double *startpt, double *endpt, + double rho, double epsilon, long itermax) +/* + Direct search minimization algorithm +*/ +{ + double *delta, *xbefore, *newx; + double newf, fbefore, steplength, tmp; + int i, keep; + int iters, isubiters; + + delta = (double *) malloc( dim*sizeof(double)); + xbefore = (double *) malloc( dim*sizeof(double)); + newx = (double *) malloc( dim*sizeof(double)); + + for (i = 0; i < dim; i++) { + newx[i] = xbefore[i] = startpt[i]; + delta[i] = fabs(startpt[i] * rho); + if (_unur_iszero(delta[i])) delta[i] = rho; + } + + steplength = rho; + iters = 0; + fbefore = faux.f(newx, faux.params); + newf = fbefore; + + while ((iters < itermax) && (steplength > epsilon)) { + iters++; + + /* find best new point, one coord at a time */ + for (i = 0; i < dim; i++) { + newx[i] = xbefore[i]; + } + newf = best_nearby(faux, delta, newx, fbefore, dim); + /* if we made some improvements, pursue that direction */ + keep = 1; + isubiters=0; + while ((newf < fbefore) && (keep == 1) ) { + for (i = 0; i < dim; i++) { + /* firstly, arrange the sign of delta[] */ + if (newx[i] <= xbefore[i]) + delta[i] = 0.0 - fabs(delta[i]); + else + delta[i] = fabs(delta[i]); + /* now, move further in this direction */ + tmp = xbefore[i]; + xbefore[i] = newx[i]; + newx[i] = newx[i] + newx[i] - tmp; + } + fbefore = newf; + newf = best_nearby(faux, delta, newx, fbefore, dim); + /* if the further (optimistic) move was bad.... */ + if (newf >= fbefore) + break; + /* make sure that the differences between the new */ + /* and the old points are due to actual */ + /* displacements; beware of roundoff errors that */ + /* might cause newf < fbefore */ + keep = 0; + for (i = 0; i < dim; i++) { + if (fabs(newx[i] - xbefore[i]) > (0.5 * fabs(delta[i]))) { + keep = 1; + break; + } + } + + /* stopping condition to avoid infinite while-loop */ + if ( isubiters++ >= HOOKE_SUBITERMAX) break; + } + if ((steplength >= epsilon) && (newf >= fbefore)) { + steplength = steplength * rho; + for (i = 0; i < dim; i++) { + delta[i] *= rho; + } + } + } + for (i = 0; i < dim; i++) + endpt[i] = xbefore[i]; + + free(delta); free(xbefore); free(newx); + + return (iters); +} /* end of hooke() */ + +/*-----------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/hooke_source.h b/vendor/unuran-1.11.0/src/utils/hooke_source.h new file mode 100644 index 0000000..f25f884 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/hooke_source.h @@ -0,0 +1,44 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: hooke_source.h * + * * + * PURPOSE: * + * defines function prototypes for finding extremum of multivariate * + * function * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Function prototypes */ + +/* Algorithm by Hooke and Jeeves */ +/* (direct search minimization algorithm) */ +int _unur_hooke( struct unur_funct_vgeneric faux, + int dim, double *startpt, double *endpt, + double rho, double epsilon, long itermax); + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/lobatto.c b/vendor/unuran-1.11.0/src/utils/lobatto.c new file mode 100644 index 0000000..0ecf43c --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/lobatto.c @@ -0,0 +1,766 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: lobatto.c * + * * + * Routines for Gauss-Lobatto integration with 5 points. * + * We store integral values for subintervals to speed up repeated * + * computations. * + * * + ***************************************************************************** + * * + * Copyright (c) 2009-2011 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include "lobatto_source.h" +#include "lobatto_struct.h" + +/*---------------------------------------------------------------------------*/ +/* Function prototypes */ + +static double +_unur_lobatto5_simple (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, + double x, double h, double *fx); +/*---------------------------------------------------------------------------*/ +/* numerical integration of 'funct' over the interval (x,x+h) */ +/* using Gauss-Lobatto integration with 5 points. (non-adaptive) */ +/*---------------------------------------------------------------------------*/ + +static double +_unur_lobatto5_adaptive (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, + double x, double h, double tol, UNUR_LOBATTO_ERROR uerror, + struct unur_lobatto_table *Itable); +/*---------------------------------------------------------------------------*/ +/* numerical integration of 'funct' over the interval (x,x+h) using */ +/* adaptive Gauss-Lobatto integration with 5 points for each recursion. */ +/*---------------------------------------------------------------------------*/ + +static double +_unur_lobatto5_recursion (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, + double x, double h, double tol, UNUR_LOBATTO_ERROR uerror, + double int1, double fl, double fr, double fc, + int *W_accuracy, int *n_calls, + struct unur_lobatto_table *Itable); +/*---------------------------------------------------------------------------*/ +/* run recursion for adaptive Lobatto integration. */ +/*---------------------------------------------------------------------------*/ + +static int +_unur_lobatto_table_append (struct unur_lobatto_table *Itable, double x, double u); +/*---------------------------------------------------------------------------*/ +/* append entry to table of integral values. */ +/*---------------------------------------------------------------------------*/ + +static void +_unur_lobatto_table_resize (struct unur_lobatto_table *Itable); +/*---------------------------------------------------------------------------*/ +/* resize table of integral values. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* abbreviations */ + +#define FKT(x) (funct((x),gen)) /* call to integrand */ + +/*---------------------------------------------------------------------------*/ +/* points for Lobatto integration */ + +#define W1 (0.17267316464601146) /* = 0.5-sqrt(3/28) */ +#define W2 (1.-W1) + +/*---------------------------------------------------------------------------*/ +/* emergency break for adaptive Lobatto integration: */ +/* abort recursive calls to _unur_lobatto5_recursion() after this number */ +/* of calls. */ + +#define LOBATTO_MAX_CALLS (1000000) + +/*---------------------------------------------------------------------------*/ + +double +_unur_lobatto5_simple (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, + double x, double h, double *fx) + /*----------------------------------------------------------------------*/ + /* Numerical integration of 'funct' over the interval (x,x+h) */ + /* using Gauss-Lobatto integration with 5 points. (non-adaptive) */ + /* */ + /* parameters: */ + /* funct ... integrand */ + /* gen ... pointer to generator object */ + /* x ... left boundary point of interval */ + /* h ... length of interval */ + /* fx ... funct(x) (ignored if NULL or *fx<0) */ + /* set *fx <- funct(x+h) */ + /* */ + /* return: */ + /* integral */ + /* */ + /* store: */ + /* funct(x+h) in *fx if fx!=NULL */ + /*----------------------------------------------------------------------*/ +{ + double fl, fr; + + if (fx==NULL) { + fl = FKT(x); + fr = FKT(x+h); + } + else { + fl = (*fx>=0.) ? *fx : FKT(x); + fr = *fx = FKT(x+h); + } + + return (9*(fl+fr)+49.*(FKT(x+h*W1)+FKT(x+h*W2))+64*FKT(x+h/2.))*h/180.; +} /* end of _unur_lobatto5_simple() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_lobatto_adaptive (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, + double x, double h, double tol, UNUR_LOBATTO_ERROR uerror) + /*----------------------------------------------------------------------*/ + /* Numerical integration of the 'funct' over the interval (x,x+h) */ + /* using adaptive Gauss-Lobatto integration with 5 points. */ + /*----------------------------------------------------------------------*/ +{ + return _unur_lobatto5_adaptive(funct,gen,x,h,tol,uerror,NULL); +} /* end of _unur_lobatto_adaptive() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_lobatto5_adaptive (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, + double x, double h, double tol, UNUR_LOBATTO_ERROR uerror, + struct unur_lobatto_table *Itable) + /*----------------------------------------------------------------------*/ + /* Numerical integration of the 'funct' over the interval (x,x+h) */ + /* using adaptive Gauss-Lobatto integration with 5 points. */ + /* */ + /* Halfs intervals recursively if error is too large. */ + /* */ + /* The recursion stops when the ABSOLUTE error is less than the */ + /* respective given tolerances. */ + /* */ + /* As a side effect, it stores boundaries and integrals for all */ + /* subintervals in each recursion step where no further adaptation is */ + /* required. */ + /* The values are stored in Itable (unless it equals NULL) in */ + /* chronological order. It is important to take care when calling this */ + /* function for several subintervals and 'Itable' is given. */ + /* */ + /* parameters: */ + /* funct ... integrand */ + /* gen ... pointer to generator object */ + /* x ... left boundary point of interval */ + /* h ... length of interval */ + /* tol ... tolerated ABSOLUTE error */ + /* Itable ... table for storing integral values (may be NULL) */ + /* */ + /* return: */ + /* integral */ + /*----------------------------------------------------------------------*/ +{ + double fl, fc, fr; /* values of PDF at x, x+h/2, and x+h */ + double int1, int2; /* estimated values for integral */ + int W_accuracy = 0; /* raise flag for printing warning about accuracy */ + int n_calls = 0; /* number of recursive calls */ + + /* check length of interval */ + if (_unur_iszero(h)) + return 0.; + + /* arguments which are not finite (inf or NaN) cause infinite recursions */ + if (!_unur_isfinite(x+h)) { + _unur_error(gen->genid,UNUR_ERR_INF,"boundaries of integration domain not finite"); + return UNUR_INFINITY; + } + + /* compute function values */ + fl = FKT(x); + fc = FKT(x+h/2.); + fr = FKT(x+h); + + /* first estimate for integral on [x,x+h] */ + int1 = (9*(fl+fr)+49.*(FKT(x+h*W1)+FKT(x+h*W2))+64*fc)*h/180.; + + /* run adaptive steps */ + int2 = _unur_lobatto5_recursion(funct,gen,x,h,tol,uerror,int1,fl,fc,fr,&W_accuracy,&n_calls,Itable); + + /* check warning flag */ + if (W_accuracy) { + if (W_accuracy == 1) + _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF, + "numeric integration did not reach full accuracy"); + else + _unur_error(gen->genid,UNUR_ERR_ROUNDOFF, + "adaptive numeric integration aborted (too many function calls)"); + + } + + /* return result */ + return int2; + +} /* end of _unur_lobatto5_adaptive() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_lobatto5_recursion (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, + double x, double h, double tol, UNUR_LOBATTO_ERROR uerror, + double int1, double fl, double fc, double fr, + int *W_accuracy, int *n_calls, + struct unur_lobatto_table *Itable) + /*----------------------------------------------------------------------*/ + /* run recursion for adaptive Lobatto integration. */ + /* */ + /* parameters: */ + /* funct ... integrand */ + /* gen ... pointer to generator object */ + /* x ... left boundary point of interval */ + /* h ... length of interval */ + /* tol ... tolerated ABSOLUTE error */ + /* fl ... PDF at x */ + /* fc ... PDF at x+h/2 */ + /* fr ... PDF at x+h */ + /* W_accuracy.. warning about accuracy */ + /* n_calls ... number of recursive calls */ + /* Itable ... table for storing integral values (may be NULL) */ + /* */ + /* return: */ + /* integral */ + /*----------------------------------------------------------------------*/ +{ + double flc, frc; /* values at PDF at x+h/4 and x+3*h/4 */ + double int2; /* estimated values of integrals */ + double intl, intr; /* left and right part of int2 */ + double ierror; /* integration error */ + + /* First check number of recursive calls */ + if (++(*n_calls) > LOBATTO_MAX_CALLS) { + /* maximum allowed number of calls exceeded. */ + /* Remark: this may happen, when the initial guess */ + /* for the integral is too small. */ + *W_accuracy = 2; + return UNUR_INFINITY; + } + + /* compute function values */ + flc = FKT(x+h/4); + frc = FKT(x+3*h/4); + + /* compute integral on [x,x+h/2] and on [x+h/2,x+h] */ + intl = (9*(fl+fc)+49.*(FKT(x+h*W1*0.5)+FKT(x+h*W2*0.5))+64*flc)*h/360.; + intr = (9*(fc+fr)+49.*(FKT(x+h*(0.5+W1*0.5))+FKT(x+h*(0.5+W2*0.5)))+64*frc)*h/360.; + int2 = intl + intr; + + /* integration error */ + if (uerror!=NULL) + ierror = uerror(gen, fabs(int1-int2), x+h/2.); + else + ierror = fabs(int1-int2); + + /* check whether accuracy goal is reached */ + if (ierror >= tol) { + /* error above tolerance */ + /* if (_unur_FP_equal(x+h/2.,x) || _unur_FP_equal(int1,int2) ) { */ + if (_unur_FP_equal(x+h/2.,x)) { + /* we cannot decrease length of subintervals any more */ + *W_accuracy = 1; + /* Remark: Since we are halving intervals, this comparision */ + /* limits the maximal number of iterations to at most 2048. */ + } + else { + /* recompute with shorter intervals */ + /* Remark: it is important that the two calls to + _unur_lobatto5_recursion() must be done in exactly this order! + Otherwise 'Itable' gets corrupted. + So we need to two seperate statements and store the results + in the temporary variabel 'int2' to prevent the compiler to + revert this order. + */ + int2 = _unur_lobatto5_recursion(funct,gen,x,h/2,tol/1.,uerror, + intl,fl,flc,fc, W_accuracy,n_calls, Itable); + int2 += _unur_lobatto5_recursion(funct,gen,x+h/2,h/2,tol/1.,uerror, + intr,fc,frc,fr, W_accuracy,n_calls, Itable); + return int2; + } + } + + /* store integral values */ + if (Itable) { + /* l.h.s. subinterval */ + _unur_lobatto_table_append(Itable, x+h/2., intl); + /* r.h.s. subinterval */ + _unur_lobatto_table_append(Itable, x+h, intr); + } + /* Remark: we do not throw a warning if the table size is exceeded. */ + + /* return estimate for integral */ + return int2; + +} /* end of _unur_lobatto5_recursion() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_lobatto_eval_diff (struct unur_lobatto_table *Itable, double x, double h, double *fx) + /*----------------------------------------------------------------------*/ + /* Numerical integration of 'funct' over the interval (x,x+h) using */ + /* table of integral values together with (adaptive) Gauss-Lobatto */ + /* integration with 5 points. */ + /* */ + /* It is important that the pointer points to an entry in the table of */ + /* integral values with x-value larger than the given 'x'. */ + /* */ + /* parameters: */ + /* Itable ... table for storing integral values (may be NULL) */ + /* x ... left boundary point of interval */ + /* h ... length of interval */ + /* fx ... funct(x) (ignored if NULL or *fx<0) */ + /* set *fx <- funct(x+h) if _unur_lobatto5_simple called */ + /* set *fx <- -1. otherwise */ + /* */ + /* return: */ + /* integral */ + /* */ + /* store: */ + /* if (fx!=NULL) */ + /* *fx = funct(x+h) if _unur_lobatto5_simple is called */ + /* *fx = -1. (=unknown) if _unur_lobatto5_adaptive is called */ + /*----------------------------------------------------------------------*/ +{ + int cur; /* pointer to current position in table */ + double x1; /* left and right boundary of a subinterval */ + double Q; /* value of integral */ + struct unur_lobatto_nodes *values; + int n_values; + + /* clear function values if it does not contain the correct value. */ + /* this is in particular necessary whenever we call */ + /* _unur_lobatto5_adaptive instead if _unur_lobatto5_simple !! */ +#define clear_fx() if(fx!=NULL){*fx=-1.;} + + /* check for invalid NULL pointer */ + CHECK_NULL(Itable,UNUR_INFINITY); + + /* read data from table */ + values = Itable->values; + n_values = Itable->n_values; + + /* arguments which are not finite (inf or NaN) cause infinite recursions */ + if (!_unur_isfinite(x+h)) { + /* _unur_warning(gen->genid,UNUR_ERR_INF,"boundaries of integration domain not finite"); */ + clear_fx(); + return UNUR_INFINITY; + } + + /* check for boundaries of integration table */ + if (x < Itable->bleft || x+h > Itable->bright) { + clear_fx(); + return _unur_lobatto5_adaptive(Itable->funct, Itable->gen, x, h, + Itable->tol, Itable->uerror, NULL); + } + + /* move pointer for reading to start position in interval */ + cur = Itable->cur_iv; + + /* first entry in interval */ + while (cur < n_values && values[cur].x < x) + ++cur; + + /* did we find such an entry ? */ + if (cur >= n_values) { + /* we must use adaptive Lobatto integration if the table for */ + /* integral values was too small. */ + clear_fx(); + return _unur_lobatto5_adaptive(Itable->funct, Itable->gen, x, h, + Itable->tol, Itable->uerror, NULL); + } + + /* store x value and goto next entry */ + x1 = values[cur].x; + ++cur; + + /* are there more than one entry in interval ? */ + if (cur >= n_values || + values[cur].x > x+h) { + /* there is at most one entry in the interval [x,x+h]. */ + /* thus we (can) use simple Lobatto integration. */ + return _unur_lobatto5_simple(Itable->funct, Itable->gen, x, h, fx); + } + + /* else: */ + /* there are more than one entries in the interval. */ + /* thus there is at least one subinterval from adapative Lobatto */ + /* integration within [x,x+h]. we reuse the stored values. */ + /* for the remaining two subintervals at the boundary [x,x+h] */ + /* we use simple Gauss-Lobatto integration. */ + + Q = _unur_lobatto5_simple(Itable->funct, Itable->gen, x, x1-x, fx); + do { + Q += values[cur].u; + /* = _unur_lobatto5(gen, funct, x1, x2-x1) */ + x1 = values[cur].x; + ++cur; + } while (cur < n_values && values[cur].x <= x+h); + /* now *fx does not hold PDF(x1). so we have to clear it */ + clear_fx(); + + /* We have to distinguish two cases: */ + if (cur >= n_values) { + /* the table of integral values is too small */ + Q += _unur_lobatto5_adaptive(Itable->funct, Itable->gen, x1, x+h-x1, + Itable->tol, Itable->uerror, NULL); + } + else { + /* the table is not too small but x+h is outside the computational domain */ + Q += _unur_lobatto5_simple(Itable->funct, Itable->gen, x1, x+h-x1, fx); + } + + return Q; + +#undef clear_fx + +} /* end of _unur_lobatto_eval_diff() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_lobatto_eval_CDF (struct unur_lobatto_table *Itable, double x) + /*----------------------------------------------------------------------*/ + /* Numerical integration of 'funct' over the interval (-UNUR_INFINITY,x)*/ + /* using a table of integral values together with */ + /* (adaptive) Gauss-Lobatto integration with 5 points. */ + /* It is important, that the integration object 'Itable' already exists.*/ + /* */ + /* parameters: */ + /* Itable ... table for storing integral values (may be NULL) */ + /* x ... argument */ + /* */ + /* return: */ + /* integral */ + /*----------------------------------------------------------------------*/ +{ + struct unur_lobatto_nodes *values; + int n_values; /* table size */ + double area; /* integral over (-UNUR_INFINITY, UNUR_INFINITY) */ + double xr; /* most right point from table */ + double cdf; /* cdf at x */ + int cur; /* current interval (position in table) */ + + /* check for invalid NULL pointer */ + CHECK_NULL(Itable, UNUR_INFINITY); + + /* check boundary */ + if (x <= Itable->bleft) return 0.; + if (x >= Itable->bright) return 1.; + + /* read data from table */ + values = Itable->values; + n_values = Itable->n_values; + area = Itable->integral; + + /* the area must not equal 0 (this should not happen anyway) */ + if (area <= 0.) { + _unur_error(Itable->gen->genid,UNUR_ERR_NAN,"area below PDF 0."); + return UNUR_INFINITY; + } + + /* sum values over all intervals that are on the l.h.s. of x */ + cdf = 0; + xr = Itable->bleft; + for (cdf=0, cur=0; cur < n_values && x > values[cur].x; cur++) { + cdf += values[cur].u; + xr = values[cur].x; + } + + /* integrate from xr to x */ + if (cur >= n_values) { + cdf += _unur_lobatto5_adaptive(Itable->funct, Itable->gen, xr, x-xr, + Itable->tol, Itable->uerror, NULL); + } + else { + cdf += _unur_lobatto5_simple(Itable->funct, Itable->gen, xr, x-xr, NULL); + } + + /* compute CDF */ + cdf /= area; + cdf = _unur_max(0., cdf); + cdf = _unur_min(1., cdf); + + /* return CDF */ + return cdf; + +} /* end of _unur_lobatto_eval_CDF() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_lobatto_integral (struct unur_lobatto_table *Itable) + /*----------------------------------------------------------------------*/ + /* Get value of integral from Lobatto object. */ + /* Get integration from Lobatto object. */ + /* */ + /* parameters: */ + /* Itable ... table for storing integral values (may be NULL) */ + /* */ + /* return: */ + /* integral */ + /*----------------------------------------------------------------------*/ +{ + CHECK_NULL(Itable, UNUR_INFINITY); + return Itable->integral; +} /* end of _unur_lobatto_eval_integral() */ + + +/*****************************************************************************/ +/* */ +/* Table with integral values */ +/* */ +/*****************************************************************************/ + +struct unur_lobatto_table * +_unur_lobatto_init (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, + double left, double center, double right, + double tol, UNUR_LOBATTO_ERROR uerror, int size) + /*----------------------------------------------------------------------*/ + /* create and initialize table of integral values. */ + /* */ + /* parameters: */ + /* funct ... pointer to integrand */ + /* gen ... pointer to generator object */ + /* left ... left boundary of computational domain */ + /* center... central ("typical") point of computational domain */ + /* right ... right boundary of computational domain */ + /* tol ... tolerated ABSOLUTE integration error */ + /* size ... (maximal) size of table (MUST BE >=2) */ + /* */ + /* return: */ + /* pointer to table */ + /*----------------------------------------------------------------------*/ +{ + struct unur_lobatto_table *Itable; + + /* check argument */ + if (size<2) { + _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,"size<2"); + return NULL; + } + + /* allocate memory */ + Itable = _unur_xmalloc( sizeof(struct unur_lobatto_table) ); + Itable->values = _unur_xmalloc(size * sizeof(struct unur_lobatto_nodes) ); + + /* set counter */ + Itable->size = size; + Itable->n_values = 0; + Itable->cur_iv = 0; + + /* store integrand */ + Itable->funct = funct; + Itable->gen = gen; + Itable->bleft = left; + Itable->bright = right; + + /* tolerated integration error */ + Itable->tol = tol; + Itable->uerror = uerror; + + /* store left boundary point in table */ + _unur_lobatto_table_append(Itable,left,0.); + + /* compute integral over whole domain */ + /* Remark: it is important that the two calls to + _unur_lobatto5_adaptive() must be done in exactly this order! + Otherwise 'Itable' gets corrupted. + So we need two seperate statements to prevent the compiler to + revert this order. + */ + Itable->integral = + _unur_lobatto5_adaptive(funct, gen, left, center-left, tol, uerror, Itable ); + Itable->integral += + _unur_lobatto5_adaptive(funct, gen, center, right-center, tol, uerror, Itable ); + + /* possibly shrink memory block for table of integral values */ + _unur_lobatto_table_resize(Itable); + + return Itable; +} /* end of _unur_lobatto_table_create() */ + +/*---------------------------------------------------------------------------*/ + +int _unur_lobatto_find_linear (struct unur_lobatto_table *Itable, double x) + /*----------------------------------------------------------------------*/ + /* Find first subinterval where left boundary is not less than x. */ + /* we start at last position found by this routine and continue with */ + /* linear search. */ + /* (We set a bookmark in the table of integral values.) */ + /* */ + /* parameters: */ + /* Itables ... table with integral values */ + /* x ... value to be found */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + if (Itable != NULL) { + /* search for first entry in interval. */ + /* we can continue from the position in the last interval. */ + /* otherwise, to restart from the first entry uncomment this line */ + /* Itable->cur_iv = 0; */ + + while (Itable->cur_iv < Itable->n_values && + Itable->values[Itable->cur_iv].x < x) + ++(Itable->cur_iv); + + return UNUR_SUCCESS; + } + else { + /* nothing to do */ + return UNUR_ERR_SILENT; + } + +} /* end of _unur_lobatto_find_linear() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_lobatto_table_append (struct unur_lobatto_table *Itable, double x, double u) + /*----------------------------------------------------------------------*/ + /* append entry to the end of the table of integral values. */ + /* */ + /* parameters: */ + /* Itables ... table with integral values */ + /* x ... right boundary of subinterval */ + /* u ... integral over subinterval */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /*----------------------------------------------------------------------*/ +{ + if (Itable==NULL) + return UNUR_ERR_NULL; + + if (Itable->n_values >= Itable->size - 1) + /* we do not write a warning here */ + return UNUR_ERR_GENERIC; + + Itable->values[Itable->n_values].x = x; + Itable->values[Itable->n_values].u = u; + ++(Itable->n_values); + + return UNUR_SUCCESS; +} /* end of _unur_lobatto_table_append() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_lobatto_table_resize (struct unur_lobatto_table *Itable) + /*----------------------------------------------------------------------*/ + /* resize table of integral values. */ + /* */ + /* parameters: */ + /* Itable ... pointer to pointer to table of integral values */ + /*----------------------------------------------------------------------*/ +{ + if (Itable) { + Itable->size = Itable->n_values; + Itable->values = _unur_xrealloc(Itable->values, + Itable->size * sizeof(struct unur_lobatto_nodes)); + } + /* else: nothing to do */ + +} /* end of _unur_lobatto_table_resize() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_lobatto_free (struct unur_lobatto_table **Itable) + /*----------------------------------------------------------------------*/ + /* destroy table of integral values and set pointer to NULL. */ + /* */ + /* parameters: */ + /* Itable ... pointer to pointer to table with integral values */ + /*----------------------------------------------------------------------*/ +{ + if (*Itable) { + free ((*Itable)->values); + free (*Itable); + *Itable = NULL; + } + /* else: nothing to do */ + +} /* end of _unur_lobatto_free() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_lobatto_debug_table (struct unur_lobatto_table *Itable, const struct unur_gen *gen, + int print_Itable ) + /*----------------------------------------------------------------------*/ + /* print size and entries of table of integral values. */ + /* */ + /* parameters: */ + /* Itable ... table with integral values */ + /* gen ... pointer to generator object */ + /* print_Itable ... whether table is printed */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG; + int n; + + /* check arguments */ + CHECK_NULL(Itable,RETURN_VOID); + + LOG = unur_get_stream(); + + fprintf(LOG,"%s: subintervals for Lobatto integration: %d\n",gen->genid, + Itable->n_values - 1); + + for (n=0; print_Itable && n < Itable->n_values; n++) { + fprintf(LOG,"%s: [%3d] x = %.16g, u = %.16g\n",gen->genid, + n, Itable->values[n].x, Itable->values[n].u ); + } + +} /* end of _unur_lobatto_debug_table() */ + +/*---------------------------------------------------------------------------*/ + +int _unur_lobatto_size_table (struct unur_lobatto_table *Itable) + /*----------------------------------------------------------------------*/ + /* size of table of integral values. */ + /* */ + /* parameters: */ + /* Itable ... table with integral values */ + /*----------------------------------------------------------------------*/ +{ + return (Itable->n_values - 1); +} /* end of _unur_lobatto_size_table() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/lobatto_source.h b/vendor/unuran-1.11.0/src/utils/lobatto_source.h new file mode 100644 index 0000000..51092fc --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/lobatto_source.h @@ -0,0 +1,99 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: lobatto_source.c * + * * + * PURPOSE: * + * macros and function prototypes for Gauss-Lobatto integration * + * * + ***************************************************************************** + * * + * Copyright (c) 2009 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* typedefs */ + +/* Integrand */ +typedef double UNUR_LOBATTO_FUNCT(double x, struct unur_gen *gen); + +/* Error estimate */ +typedef double UNUR_LOBATTO_ERROR(struct unur_gen *gen, double delta, double x); + +struct unur_lobatto_table; + +/*---------------------------------------------------------------------------*/ +/* Function prototypes */ + +double _unur_lobatto_adaptive (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, + double x, double h, double tol, UNUR_LOBATTO_ERROR uerror); +/*---------------------------------------------------------------------------*/ +/* numerical integration of 'funct' over the interval (x,x+h) using */ +/* adaptive Gauss-Lobatto integration with 5 points for each recursion. */ +/*---------------------------------------------------------------------------*/ + +struct unur_lobatto_table * +_unur_lobatto_init (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, + double left, double center, double right, + double tol, UNUR_LOBATTO_ERROR uerror, int size); +/*---------------------------------------------------------------------------*/ +/* create object for Lobatto integral. */ +/*---------------------------------------------------------------------------*/ + +int _unur_lobatto_find_linear (struct unur_lobatto_table *Itable, double x); +/*---------------------------------------------------------------------------*/ +/* find first subinterval where left boundary is not less than x. */ +/*---------------------------------------------------------------------------*/ + +double _unur_lobatto_eval_diff (struct unur_lobatto_table *Itable, double x, double h, double *fx); +/*---------------------------------------------------------------------------*/ +/* evaluate integration object over the interval (x,x+h). */ +/*---------------------------------------------------------------------------*/ + +double _unur_lobatto_eval_CDF (struct unur_lobatto_table *Itable, double x); +/*---------------------------------------------------------------------------*/ +/* evaluate integration object over the interval (-UNUR_INFINITY, x). */ +/* it is important, that the integration object 'Itable' already exists. */ +/*---------------------------------------------------------------------------*/ + +double _unur_lobatto_integral (struct unur_lobatto_table *Itable ); +/*---------------------------------------------------------------------------*/ +/* get value of integral from Lobatto object. */ +/*---------------------------------------------------------------------------*/ + +void _unur_lobatto_free (struct unur_lobatto_table **Itable); +/*---------------------------------------------------------------------------*/ +/* destroy Lobatto object and set pointer to NULL. */ +/*---------------------------------------------------------------------------*/ + +void _unur_lobatto_debug_table (struct unur_lobatto_table *Itable, + const struct unur_gen *gen, int print_Itable ); +/*---------------------------------------------------------------------------*/ +/* print size and entries of table of integral values. */ +/*---------------------------------------------------------------------------*/ + +int _unur_lobatto_size_table (struct unur_lobatto_table *Itable); +/*---------------------------------------------------------------------------*/ +/* size of table of integral values. */ +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/utils/lobatto_struct.h b/vendor/unuran-1.11.0/src/utils/lobatto_struct.h new file mode 100644 index 0000000..d199564 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/lobatto_struct.h @@ -0,0 +1,61 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: lobatto_struct.h * + * * + * PURPOSE: * + * declares structures for Gauss-Lobatto integration * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* 'Lobatto object': */ +/* store integrand, boundaries and integrals of subintervals computed */ +/* during adaptive Gauss-Lobatto integration. */ + +struct unur_lobatto_nodes { + double x; /* right boundary of subinterval */ + double u; /* integral of PDF over subinterval */ +}; + +struct unur_lobatto_table { + struct unur_lobatto_nodes *values; /* boundaries and integral values */ + int n_values; /* number of stored integral values (nodes) */ + int cur_iv; /* position of first entry whose x value is + larger than left boundary of current interval*/ + int size; /* size of table */ + + UNUR_LOBATTO_FUNCT *funct; /* pointer to integrand */ + struct unur_gen *gen; /* pointer to generator object */ + double tol; /* tolerated ABSOLUTE integration error */ + UNUR_LOBATTO_ERROR *uerror; /* function for estimating error */ + double bleft; /* left boundary of computational domain */ + double bright; /* right boundary of computational domain */ + double integral; /* integral over whole domain */ +}; + + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/matrix.c b/vendor/unuran-1.11.0/src/utils/matrix.c new file mode 100644 index 0000000..b6ea766 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/matrix.c @@ -0,0 +1,770 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: matrix.c * + * * + * Routines for computations with square matrices. * + * Matrices are stored as double array (i.e.: double *matrix). * + * The rows of the matrix have to be stored consecutively in this array, * + * i.e. the entry with index [i,j] can be entered via (i*dim+j), where * + * dim is the dimension of the dim x dim - matrix. * + * * + ***************************************************************************** + * * + * Routines are mainly adapted from the GSL (GNU Scientifiy Library) * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman, Brian Gough * + * * + * adapted by Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*--------------------------------------------------------------------------*/ + +#include +#include "matrix_source.h" + +/*---------------------------------------------------------------------------*/ + +static int _unur_matrix_swap_rows (int dim, double *A, int i, int j); +/* Swap rows i and j in square matrix A of dimension dim. */ + +static int _unur_matrix_permutation_swap (int dim, int *p, int i, int j); +/* Swap entries i and j of the integer array p. */ + +static int _unur_matrix_LU_decomp (int dim, double *A, int *P, int *signum); +/* Factorise a general dim x dim matrix A into P A = L U. */ + +static int _unur_matrix_backsubstitution_dtrsv(int dim, double *LU, double *X); +/* Backsubstitution used for inversion alg. _unur_matrix_LU_invert(). */ + +static int _unur_matrix_forwardsubstitution_dtrsv(int dim, double *LU, double *X); +/* Forwardsubstitution used for inversion alg. _unur_matrix_LU_invert(). */ + +static int _unur_matrix_LU_invert (int dim, double *LU, int *p, double *inverse); +/* Compute inverse of matrix with given LU decomposition. */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_matrix_transform_diagonal (int dim, const double *M, const double *D, double *res) + /*----------------------------------------------------------------------*/ + /* Computes the transformation M^t . D . M of diagonal matrix D */ + /* and stores it in matrix 'res'. */ + /* */ + /* input: */ + /* dim ... number of columns and rows of m and diag */ + /* M ... square matrix */ + /* D ... diagonal entries of a diagonal matrix */ + /* */ + /* output: */ + /* res ... square matrix to store result */ + /* */ + /* return: */ + /* UNUR_SUCCESS on success */ + /* error code otherwise */ + /*----------------------------------------------------------------------*/ +{ +#define idx(a,b) ((a)*dim+(b)) + + int i,j,k; + double sum; + + /* check arguments */ + CHECK_NULL(M,UNUR_ERR_NULL); + CHECK_NULL(D,UNUR_ERR_NULL); + CHECK_NULL(res,UNUR_ERR_NULL); + + for (i=0; idata[j] */ + /* */ + /* signum gives the sign of the permutation, (-1)^n, where n is the */ + /* number of interchanges in the permutation. */ + /* */ + /* See Golub & Van Loan, Matrix Computations, Algorithm 3.4.1 (Gauss */ + /* Elimination with Partial Pivoting). */ + /* */ + /* input: */ + /* dim ... number of columns and rows of */ + /* A ... dim x dim matrix */ + /* p ... pointer to array where permutation should be stored */ + /* signum ... pointer where sign of permutation should be stored */ + /* */ + /* output: */ + /* A ... L (strict lower triangular part) and U (upper part) */ + /* p ... permutation vector of length dim */ + /* (contains all integers between 0 and dim-1) */ + /* signum ... sign of the permutation (1 or -1) */ + /* */ + /* return: */ + /* UNUR_SUCCESS on success */ + /* error code otherwise */ + /*----------------------------------------------------------------------*/ +{ +#define idx(a,b) ((a)*dim+(b)) + int i, j, k; + + /* check arguments */ + CHECK_NULL(A,UNUR_ERR_NULL); + CHECK_NULL(p,UNUR_ERR_NULL); + CHECK_NULL(signum,UNUR_ERR_NULL); + + /* initialize permutation vector */ + *signum = 1; + for(i=0;i max){ + max = aij; + i_pivot = i; + } + } + if (i_pivot != j){ + _unur_matrix_swap_rows (dim, A, j, i_pivot); + _unur_matrix_permutation_swap (dim, p, j, i_pivot); + *signum = -(*signum); + } + + ajj = A[idx(j,j)]; + + if ( !_unur_iszero(ajj) ){ + for (i = j + 1; i < dim; i++){ + double aij = A[idx(i,j)] / ajj; + A[idx(i,j)] = aij; + for (k = j + 1; k < dim; k++){ + double aik = A[idx(i,k)]; + double ajk = A[idx(j,k)]; + A[idx(i,k)]= aik - aij * ajk; + } + } + } + } + + return UNUR_SUCCESS; + +#undef idx +} /* end of _unur_matrix_LU_decomp() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_matrix_backsubstitution_dtrsv(int dim, double *LU, double *X) + /*----------------------------------------------------------------------*/ + /* Backsubstitution used for inversion alg. _unur_matrix_LU_invert() */ + /* */ + /* input: */ + /* dim ... number of columns and rows of */ + /* LU ... dim x dim -matrix that contains LU decomposition of matrix */ + /* X ... vector */ + /* */ + /* output: */ + /* X */ + /* */ + /* return: */ + /* UNUR_SUCCESS on success */ + /* error code otherwise */ + /*----------------------------------------------------------------------*/ +{ +#define idx(a,b) ((a)*dim+(b)) + + int ix,jx,i,j; + + /* check arguments */ + CHECK_NULL(LU,UNUR_ERR_NULL); + CHECK_NULL(X,UNUR_ERR_NULL); + + /* backsubstitution */ + ix = (dim - 1); + + X[ix] = X[ix] / LU[idx(ix,ix)]; + + ix--; + for (i = dim - 1; i > 0 && i--;) { + double tmp = X[ix]; + jx = ix + 1; + for (j = i + 1; j < dim; j++) { + tmp -= LU[idx(i,j)] * X[jx]; + jx ++; + } + + X[ix] = tmp / LU[idx(i,i)]; + ix --; + } + + return UNUR_SUCCESS; + +#undef idx +} /* end of _unur_matrix_backsubstitution_dtrsv() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_matrix_forwardsubstitution_dtrsv(int dim, double *LU, double *X) + /*----------------------------------------------------------------------*/ + /* Forwardsubstitution used for inversion alg. _unur_matrix_LU_invert() */ + /* */ + /* input: */ + /* dim ... number of columns and rows of */ + /* LU ... dim x dim -matrix that contains LU decomposition of matrix */ + /* X ... vector */ + /* */ + /* output: */ + /* X */ + /* */ + /* return: */ + /* UNUR_SUCCESS on success */ + /* error code otherwise */ + /*----------------------------------------------------------------------*/ +{ +#define idx(a,b) ((a)*dim+(b)) + + int ix,jx,i,j; + + /* check arguments */ + CHECK_NULL(LU,UNUR_ERR_NULL); + CHECK_NULL(X,UNUR_ERR_NULL); + + /* forward substitution */ + ix = 0; + ix++; + for (i = 1; i < dim; i++) { + double tmp = X[ix]; + jx = 0; + for (j = 0; j < i; j++) { + tmp -= LU[idx(i,j)] * X[jx]; + jx += 1; + } + X[ix] = tmp; + ix ++; + } + + return UNUR_SUCCESS; + +#undef idx +} /* end of _unur_matrix_forwardsubstitution_dtrsv() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_matrix_LU_invert (int dim, double *LU, int *p, double *inverse) + /*----------------------------------------------------------------------*/ + /* Compute inverse of matrix with given LU decomposition. */ + /* */ + /* input: */ + /* dim ... number of columns and rows of */ + /* LU ... dim x dim -matrix, LU decomposition */ + /* p ... permutation vector of length dim */ + /* (contains all integers between 0 and dim-1) */ + /* inverse ... pointer to array where inverse should be stored */ + /* */ + /* output */ + /* inverse ... the inverse matrix */ + /* */ + /* return: */ + /* UNUR_SUCCESS on success */ + /* error code otherwise */ + /*----------------------------------------------------------------------*/ +{ +#define idx(a,b) ((a)*dim+(b)) + + double *vector; + int i,j; + + /* check arguments */ + CHECK_NULL(LU,UNUR_ERR_NULL); + CHECK_NULL(p,UNUR_ERR_NULL); + CHECK_NULL(inverse,UNUR_ERR_NULL); + + /* allocate working array */ + vector = _unur_xmalloc(dim*sizeof(double)); + + for (i = 0; i < dim; i++){ + for(j=0;j sum1)) { + /* covariance matrix not positive definite */ + return UNUR_FAILURE; + } + + L[idx(j,j)] = sqrt( S[idx(j,j)] - sum1 ); + } + + /* although not necessary upper triangular of L - matrix is set to 0 */ + for(j=0; j entries */ + /* info ... additional info-string to be printed as first line */ + /* LOG ... output stream */ + /* genid ... id string */ + /* indent ... left margin of printed vector */ + /*----------------------------------------------------------------------*/ +{ + int i; + + if (vec) { + fprintf(LOG,"%s: %s\n", genid, info ); + fprintf(LOG,"%s: %s( %g", genid, indent, vec[0]); + for (i=1; ix square matrix into LOG file. */ + /* The matrix is stored row-wise in . */ + /* */ + /* parameters: */ + /* dim ... dimension */ + /* mat ... square matrix with rows and columns */ + /* info ... additional info-string to be printed as first line */ + /* LOG ... output stream */ + /* genid ... id string */ + /* indent ... left margin of printed vector */ + /*----------------------------------------------------------------------*/ +{ +#define idx(a,b) ((a)*dim+(b)) + int i,j; + + if (mat) { + fprintf(LOG,"%s: %s\n", genid, info); + for (i=0; i: */ +/* is printed in a (first) separate line. */ +/* A blank line is inserted after the printed vector. */ +/* If the NULL pointer is given, the string "[unknown]" is printed. */ + +void _unur_matrix_print_matrix ( int dim, const double *mat, const char *info, + FILE *LOG, const char *genid, const char *indent ); +/* Print elements of the given x square matrix into LOG file. */ +/* The matrix is stored row-wise in . */ +/* The lines start with : */ +/* is printed in a (first) separate line. */ +/* A blank line is inserted after the printed matrix. */ +/* If the NULL pointer is given, the string "[unknown]" is printed. */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/mrou_rectangle.c b/vendor/unuran-1.11.0/src/utils/mrou_rectangle.c new file mode 100644 index 0000000..d1cf7cd --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/mrou_rectangle.c @@ -0,0 +1,375 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: mrou_rectangle.c * + * * + * * + * DESCRIPTION: * + * The bounding rectangle for the multivariate RoU-methods is computed * + * numerically. * + * Only power transformations with parameter r are considered. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************** + * * + * Notation follows [2]. * + * * + ***************************************************************************** + * * + * REFERENCES: * + * [1] Wakefield J.C., Gelfand A.E., Smith A.F.M. * + * Efficient generation of random variates via the ratio-of-uniforms * + * method. * + * Statistics and Computing (1991) 1, pp (129-133) * + * * + * [2] Hoermann, W., Leydold J., and Derflinger, G. (2004): * + * Automatic non-uniform random variate generation, Springer, Berlin. * + * Section 2.4, Algorithm 2.9 (RoU), p.35 * + * * + * [3] Hooke, R. and Jeeves, T.A. (1961): * + * Direct Search Solution of Numerical and Statistical Problems. * + * Journal of the ACM, Vol. 8, April 1961, pp. 212-229. * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/*---------------------------------------------------------------------------*/ +/* Constants */ + +/* Convergence parameters for the hooke optimization algorithm */ + +#define MROU_HOOKE_RHO (0.5) +#define MROU_HOOKE_EPSILON (1.e-7) +#define MROU_HOOKE_MAXITER (1000L) + +/* Scaling factor for the computed minimum bounding rectangle. */ +/* The computed rectangle (0, vmax)x(umin[d], umax[d]) is scaled by this */ +/* factor, i.e. : */ +/* vmax = vmax * ( 1+ MROU_RECT_SCALING) */ +/* umin[i] = umin[i] - (umax[i]-umin[i])*MROU_RECT_SCALING/2. */ +/* umax[i] = umax[i] + (umax[i]-umin[i])*MROU_RECT_SCALING/2. */ +#define MROU_RECT_SCALING (1.e-4) + + +static double _unur_mrou_rectangle_aux_vmax(double *x, void *p ); +static double _unur_mrou_rectangle_aux_umin(double *x, void *p ); +static double _unur_mrou_rectangle_aux_umax(double *x, void *p ); +/*---------------------------------------------------------------------------*/ +/* Auxiliary functions used in the computation of the bounding rectangle */ +/*---------------------------------------------------------------------------*/ + +#define PDF(x) _unur_cvec_PDF((x),(distr)) /* call to PDF */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_mrou_rectangle_aux_vmax(double *x, void *p ) + /*----------------------------------------------------------------------*/ + /* Auxiliary function used in the computation of the bounding rectangle */ + /*----------------------------------------------------------------------*/ +{ + struct MROU_RECTANGLE *rr; + rr = p; /* typecast from void* to unur_rou_rectangle* */ + + return -pow( _unur_cvec_PDF((x),(rr->distr)) , + 1./(1.+ rr->r * rr->dim) ); +} + +/*---------------------------------------------------------------------------*/ + +double +_unur_mrou_rectangle_aux_umin(double *x, void *p) + /*----------------------------------------------------------------------*/ + /* Auxiliary function used in the computation of the bounding rectangle */ + /*----------------------------------------------------------------------*/ +{ + struct MROU_RECTANGLE *rr; + rr = p; /* typecast from void* to unur_rou_rectangle* */ + + return ( (x[rr->aux_dim] - rr->center[rr->aux_dim]) + * pow( _unur_cvec_PDF((x),(rr->distr)), + rr->r / (1.+ rr->r * rr->dim) ) ); +} + +/*---------------------------------------------------------------------------*/ + +double +_unur_mrou_rectangle_aux_umax(double *x, void *p) + /*----------------------------------------------------------------------*/ + /* Auxiliary function used in the computation of the bounding rectangle */ + /*----------------------------------------------------------------------*/ +{ + return (- _unur_mrou_rectangle_aux_umin(x,p)) ; +} + +/*---------------------------------------------------------------------------*/ + +struct MROU_RECTANGLE * +_unur_mrou_rectangle_new( void ) + /*----------------------------------------------------------------------*/ + /* create empty MROU rectangle object. */ + /* */ + /* parameters: none */ + /* */ + /* return: */ + /* pointer to allocated and initialized MROU_RECTANGLE object */ + /*----------------------------------------------------------------------*/ +{ + struct MROU_RECTANGLE *rr; + + rr = _unur_xmalloc(sizeof(struct MROU_RECTANGLE )); + + rr->distr = NULL; + rr->dim = 0; + rr->umin = NULL; + rr->umax = NULL; + rr->r = 1; + rr->bounding_rectangle = 1; + rr->center = NULL; + rr->genid = ""; + + return rr; +} /* end of _unur_mrou_rectangle_new() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_mrou_rectangle_compute( struct MROU_RECTANGLE *rr ) + /*----------------------------------------------------------------------*/ + /* compute universal bounding hyper-rectangle */ + /* */ + /* parameters: */ + /* rr ... mRoU object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... on success */ + /* error code ... on error */ + /* */ + /* remark: */ + /* This routine computes two parameters of the bounding rectangle: */ + /* vmax .... the upper bound of the v-coordinate */ + /* umin, umax ... left lower and right upper vertex of rectangle */ + /* in u-hyperplane */ + /* */ + /* vmax is computed by means of the mode of the given distribution. */ + /* If this is not available, a method by Hooke and Jeeves [3] is */ + /* used. */ + /* */ + /* umin and umax is computed if flag rr->bounding_rectangle is */ + /* nonzero. Again the algorithm by Hooke and Jeeves [3] is used. */ + /* In this case rr->umin and rr->umax must contain points to */ + /* to double arrays each of size (at least) (rr->dim)+1. */ + /* Otherwise, these two pointers are not needed and can be NULL. */ + /* */ + /*----------------------------------------------------------------------*/ +{ + struct unur_funct_vgeneric faux; /* function to be minimized/maximized */ + double *xstart, *xend, *xumin, *xumax; /* coordinate arrays used in maximum/minimum calculations */ + int d, dim; /* index used in dimension loops (0 <= d < dim) */ + int hooke_iters_vmax; /* actual number of min/max iterations = return value of hooke()*/ + int hooke_iters_umin; /* actual number of min/max iterations = return value of hooke()*/ + int hooke_iters_umax; /* actual number of min/max iterations = return value of hooke()*/ + double scaled_epsilon; /* to be used in the hooke algorithm */ + int flag_finite = TRUE; /* sanity flag FALSE when some of the rectangle (u,v)-values are not finite */ + + /* dimension of the distribution */ + dim = rr->dim; + + /* allocate memory for the coordinate vectors */ + xstart = _unur_xmalloc(dim * sizeof(double)); + xend = _unur_xmalloc(dim * sizeof(double)); + xumin = _unur_xmalloc(dim * sizeof(double)); + xumax = _unur_xmalloc(dim * sizeof(double)); + + /* --- compute vmax --- */ + + if ( (rr->distr->set & UNUR_DISTR_SET_MODE) && (rr->distr->data.cvec.mode != NULL)) { + /* position of mode is known ... vmax = f(mode)^(1/r*dim+1)) */ + faux.f = (UNUR_FUNCT_VGENERIC*) _unur_mrou_rectangle_aux_vmax; + faux.params = rr; + + rr->vmax = -faux.f(rr->distr->data.cvec.mode, faux.params); + } + else { + /* calculation of vmax */ + faux.f = (UNUR_FUNCT_VGENERIC*) _unur_mrou_rectangle_aux_vmax; + faux.params = rr; + + /* starting point */ + memcpy(xstart, rr->center, dim * sizeof(double)); + + hooke_iters_vmax = _unur_hooke( faux, dim, xstart, xend, + MROU_HOOKE_RHO, MROU_HOOKE_EPSILON, MROU_HOOKE_MAXITER); + + rr->vmax = -faux.f(xend, faux.params); + + if (hooke_iters_vmax >= MROU_HOOKE_MAXITER) { + scaled_epsilon = MROU_HOOKE_EPSILON * rr->vmax; + if (scaled_epsilon>MROU_HOOKE_EPSILON) scaled_epsilon=MROU_HOOKE_EPSILON; + + /* recalculating extremum with scaled_epsilon and new starting point */ + memcpy(xstart, xend, dim * sizeof(double)); + hooke_iters_vmax = _unur_hooke( faux, dim, xstart, xend, + MROU_HOOKE_RHO, scaled_epsilon , MROU_HOOKE_MAXITER); + rr->vmax = -faux.f(xend, faux.params); + if (hooke_iters_vmax >= MROU_HOOKE_MAXITER) { + _unur_warning(rr->genid , UNUR_ERR_GENERIC, "Bounding rect uncertain (vmax)"); + } + } + + /* additional scaling of boundary rectangle */ + rr->vmax = rr->vmax * ( 1+ MROU_RECT_SCALING); + } + + /* check for finite results */ + flag_finite = _unur_isfinite(rr->vmax); + + /* --- compute umin and umax --- */ + + if (rr->bounding_rectangle) { + + /* check pointers to avoid segfault */ + if (rr->umin == NULL || rr->umax == NULL) { + free(xstart); free(xend); free(xumin); free(xumax); + _unur_error(rr->genid,UNUR_ERR_NULL,""); + return UNUR_ERR_NULL; + } + + /* calculation of umin and umax */ + for (d=0; daux_dim = d; + + /* starting point at center */ + memcpy(xstart, rr->center, dim * sizeof(double)); + + /*-----------------------------------------------------------------------------*/ + /* calculation for umin */ + + faux.f = (UNUR_FUNCT_VGENERIC*) _unur_mrou_rectangle_aux_umin; + faux.params = rr; + + hooke_iters_umin = _unur_hooke( faux, dim, xstart, xend, + MROU_HOOKE_RHO, MROU_HOOKE_EPSILON, MROU_HOOKE_MAXITER); + rr->umin[d] = faux.f(xend, faux.params); + + /* storing actual endpoint in case we need a recalculation */ + memcpy(xumin, xend, dim * sizeof(double)); + + /*-----------------------------------------------------------------------------*/ + /* and now, an analogue calculation for umax */ + + faux.f = (UNUR_FUNCT_VGENERIC*) _unur_mrou_rectangle_aux_umax; + faux.params = rr; + + hooke_iters_umax = _unur_hooke( faux, dim, xstart, xend, + MROU_HOOKE_RHO, MROU_HOOKE_EPSILON, MROU_HOOKE_MAXITER); + rr->umax[d] = -faux.f(xend, faux.params); + + /* storing actual endpoint in case we need a recalculation */ + memcpy(xumax, xend, dim * sizeof(double)); + + /*-----------------------------------------------------------------------------*/ + /* checking if we need to recalculate umin */ + if (hooke_iters_umin >= MROU_HOOKE_MAXITER) { + scaled_epsilon = MROU_HOOKE_EPSILON * (rr->umax[d]-rr->umin[d]); + if (scaled_epsilon>MROU_HOOKE_EPSILON) scaled_epsilon=MROU_HOOKE_EPSILON; + + /* recalculating extremum with scaled_epsilon and new starting point */ + faux.f = (UNUR_FUNCT_VGENERIC*) _unur_mrou_rectangle_aux_umin; + faux.params = rr; + + memcpy(xstart, xumin, dim * sizeof(double)); + hooke_iters_umin = _unur_hooke( faux, dim, xstart, xend, + MROU_HOOKE_RHO, scaled_epsilon , MROU_HOOKE_MAXITER); + rr->umin[d] = faux.f(xend, faux.params); + if (hooke_iters_umin >= MROU_HOOKE_MAXITER) { + _unur_warning(rr->genid , UNUR_ERR_GENERIC, "Bounding rect uncertain (umin)"); + } + } + + /* checking if we need to recalculate umax */ + if (hooke_iters_umax >= MROU_HOOKE_MAXITER) { + scaled_epsilon = MROU_HOOKE_EPSILON * (rr->umax[d]-rr->umin[d]); + if (scaled_epsilon>MROU_HOOKE_EPSILON) scaled_epsilon=MROU_HOOKE_EPSILON; + + /* recalculating extremum with scaled_epsilon and new starting point */ + faux.f = (UNUR_FUNCT_VGENERIC*) _unur_mrou_rectangle_aux_umax; + faux.params = rr; + + memcpy(xstart, xumax, dim * sizeof(double)); + hooke_iters_umax = _unur_hooke( faux, dim, xstart, xend, + MROU_HOOKE_RHO, scaled_epsilon , MROU_HOOKE_MAXITER); + rr->umin[d] = faux.f(xend, faux.params); + if (hooke_iters_umax >= MROU_HOOKE_MAXITER) { + _unur_warning(rr->genid , UNUR_ERR_GENERIC, "Bounding rect uncertain (umax)"); + } + } + + /*-----------------------------------------------------------------------------*/ + /* additional scaling of boundary rectangle */ + rr->umin[d] = rr->umin[d] - (rr->umax[d]-rr->umin[d])*MROU_RECT_SCALING/2.; + rr->umax[d] = rr->umax[d] + (rr->umax[d]-rr->umin[d])*MROU_RECT_SCALING/2.; + + /* check for finite results */ + flag_finite = flag_finite && _unur_isfinite(rr->umin[d]) && _unur_isfinite(rr->umax[d]); + } + } + + /* free working arrays */ + free(xstart); free(xend); free(xumin); free(xumax); + + if (rr->vmax <= 0.) { + /* vmax must be strictly positive! */ + _unur_error("RoU",UNUR_ERR_DISTR_DATA,"cannot find bounding rectangle"); + return UNUR_ERR_DISTR_DATA; + } + + /* return status of computation */ + return (flag_finite ? UNUR_SUCCESS : UNUR_ERR_INF); + +} /* end of _unur_mrou_rectangle() */ + + +#undef PDF +#undef MROU_HOOKE_RHO +#undef MROU_HOOKE_EPSILON +#undef MROU_HOOKE_MAXITER +#undef MROU_RECT_SCALING + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/utils/mrou_rectangle_source.h b/vendor/unuran-1.11.0/src/utils/mrou_rectangle_source.h new file mode 100644 index 0000000..a5dd4a6 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/mrou_rectangle_source.h @@ -0,0 +1,46 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: rou_rectangle_source.c * + * * + * * + * DESCRIPTION: * + * Declarations for the bounding rectangle calculations used in * + * the multivariate RoU-methods. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* create MROU rectangle object. */ +/*---------------------------------------------------------------------------*/ +struct MROU_RECTANGLE *_unur_mrou_rectangle_new( void ); + +/*---------------------------------------------------------------------------*/ +/* compute (minimal) bounding hyper-rectangle. */ +/*---------------------------------------------------------------------------*/ +int _unur_mrou_rectangle_compute( struct MROU_RECTANGLE *rr ); + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/mrou_rectangle_struct.h b/vendor/unuran-1.11.0/src/utils/mrou_rectangle_struct.h new file mode 100644 index 0000000..0434cf4 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/mrou_rectangle_struct.h @@ -0,0 +1,48 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: rou_rectangle_source.c * + * * + * * + * DESCRIPTION: * + * Structure needed for the bounding rectangle calculations used in * + * the multivariate RoU-methods. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +struct MROU_RECTANGLE { + UNUR_DISTR *distr; /* distribution object */ + int dim; /* dimension of distribution */ + double r; /* r-parameter of the mrou method */ + int bounding_rectangle; /* flag to calculate bounding rectangle / strip */ + double *umin, *umax; /* boundary rectangle u-coordinates */ + double vmax; /* boundary rectangle v-coordinate */ + const double *center; /* center of distribution */ + int aux_dim; /* parameter used in auxiliary functions */ + const char *genid; /* generator id */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/slist.c b/vendor/unuran-1.11.0/src/utils/slist.c new file mode 100644 index 0000000..35375fc --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/slist.c @@ -0,0 +1,224 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: slist.c * + * * + * Handling simple lists * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include + +/*---------------------------------------------------------------------------*/ + +struct unur_slist * +_unur_slist_new( void ) + /*----------------------------------------------------------------------*/ + /* Make new simple list. */ + /* Append pointer to element to simple list. */ + /* */ + /* parameters: none */ + /* */ + /* return: */ + /* pointer to new empty simple list */ + /*----------------------------------------------------------------------*/ +{ + struct unur_slist *slist; + + /* allocate structure */ + slist = _unur_xmalloc(sizeof(struct unur_slist)); + COOKIE_SET(slist,CK_SLIST); + + /* initialize */ + + slist->ptr = NULL; + slist->n_ptr = 0; + + return slist; +} /* end of _unur_slist_new() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_slist_length( const struct unur_slist *slist ) + /*----------------------------------------------------------------------*/ + /* Get length if list (number of list entries). */ + /* */ + /* parameters: */ + /* slist ... pointer to simple list */ + /* */ + /* return: */ + /* number of elements */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(slist,0); + COOKIE_CHECK(slist,CK_SLIST,0); + + if (slist->ptr==NULL) + return 0; + + return (slist->n_ptr); + +} /* end of _unur_slist_length() */ + +/*---------------------------------------------------------------------------*/ + +void * +_unur_slist_get( const struct unur_slist *slist, int n ) + /*----------------------------------------------------------------------*/ + /* Get pointer to n-th element. */ + /* */ + /* parameters: */ + /* slist ... pointer to simple list */ + /* n ... index element */ + /* */ + /* return: */ + /* pointer to element */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(slist,NULL); + COOKIE_CHECK(slist,CK_SLIST,NULL); + + if (slist->ptr==NULL || n >= slist->n_ptr || n < 0) { + _unur_warning("list",UNUR_ERR_GENERIC,"element does not exist"); + return NULL; + } + + return (slist->ptr[n]); + +} /* end of _unur_slist_get() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_slist_append( struct unur_slist *slist, void *element ) + /*----------------------------------------------------------------------*/ + /* Append pointer to element to simple list. */ + /* */ + /* parameters: */ + /* slist ... pointer to simple list */ + /* element ... pointer to element to be appended */ + /* */ + /* return: */ + /* success ... UNUR_SUCCESS */ + /* error ... error code */ + /*----------------------------------------------------------------------*/ +{ + /* check arguments */ + CHECK_NULL(slist,UNUR_ERR_NULL); + COOKIE_CHECK(slist,CK_SLIST,UNUR_ERR_COOKIE); + + /* allocate memory for the list of blocks */ + slist->ptr = _unur_xrealloc(slist->ptr,(slist->n_ptr+1)*sizeof(void *)); + + /* store allocated element */ + slist->ptr[slist->n_ptr] = element; + + /* update number of allocated elements */ + ++(slist->n_ptr); + + return UNUR_SUCCESS; + +} /* end of _unur_slist_append() */ + +/*---------------------------------------------------------------------------*/ + +void * +_unur_slist_replace( struct unur_slist *slist, int n, void *element ) + /*----------------------------------------------------------------------*/ + /* Replace (existing) pointer to n-th element by 'element'. */ + /* */ + /* If n-th element does not exist, no new element is inserted! */ + /* */ + /* parameters: */ + /* slist ... pointer to simple list */ + /* n ... index element */ + /* element ... pointer to new element to be inserted */ + /* */ + /* return: */ + /* pointer to old element */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + void *old_element; + + /* check arguments */ + CHECK_NULL(slist,NULL); + COOKIE_CHECK(slist,CK_SLIST,NULL); + + if (slist->ptr==NULL || n >= slist->n_ptr || n < 0) { + _unur_warning("list",UNUR_ERR_GENERIC,"element does not exist"); + return NULL; + } + + old_element = slist->ptr[n]; + slist->ptr[n] = element; + return old_element; + +} /* end of _unur_slist_replace() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_slist_free( struct unur_slist *slist ) + /*----------------------------------------------------------------------*/ + /* Free all elements and list in simple list. */ + /* compute "arctan mean" of two numbers. */ + /* */ + /* parameters: */ + /* slist ... pointer to simple list */ + /*----------------------------------------------------------------------*/ +{ + int i; + + /* check arguments */ + if (slist == NULL) return; /* nothing to do */ + COOKIE_CHECK(slist,CK_SLIST,RETURN_VOID); + + if ( slist->ptr != NULL ) { + /* free memory blocks */ + for (i=0; i < slist->n_ptr; i++) + if (slist->ptr[i]) free(slist->ptr[i]); + free(slist->ptr); + slist->ptr = NULL; + } + + /* free list */ + free (slist); + +} /* end of _unur_slist_free() */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/utils/slist.h b/vendor/unuran-1.11.0/src/utils/slist.h new file mode 100644 index 0000000..6ea8b00 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/slist.h @@ -0,0 +1,80 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: slist.h * + * * + * PURPOSE: * + * defines function prototypes for simple list * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef SLIST_H_SEEN +#define SLIST_H_SEEN +/*---------------------------------------------------------------------------*/ +/* Not part of manual! */ +/*---------------------------------------------------------------------------*/ +/* */ +/* A simple list can be used to store an arbitrary numbers of pointers */ +/* to allocated memory in a list. */ +/* */ +/* IMPORTANT: These elements must be allocated via (c|m|re)alloc()!! */ +/* */ +/*---------------------------------------------------------------------------*/ + +struct unur_slist *_unur_slist_new( void ); +/*---------------------------------------------------------------------------*/ +/* Make new simple list. */ +/*---------------------------------------------------------------------------*/ + +int _unur_slist_append( struct unur_slist *slist, void *element ); +/*---------------------------------------------------------------------------*/ +/* Append pointer to element to simple list. */ +/*---------------------------------------------------------------------------*/ + +int _unur_slist_length( const struct unur_slist *slist ); +/*---------------------------------------------------------------------------*/ +/* Get length if list (number of list entries). */ +/*---------------------------------------------------------------------------*/ + +void *_unur_slist_get( const struct unur_slist *slist, int n ); +/*---------------------------------------------------------------------------*/ +/* Get pointer to n-th element. */ +/*---------------------------------------------------------------------------*/ + +void *_unur_slist_replace( struct unur_slist *slist, int n, void *element ); +/*---------------------------------------------------------------------------*/ +/* Replace (existing) pointer to n-th element by 'element'. */ +/*---------------------------------------------------------------------------*/ + +void _unur_slist_free( struct unur_slist *slist ); +/*---------------------------------------------------------------------------*/ +/* Free all elements and list in simple list. */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +#endif /* SLIST_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/slist_struct.h b/vendor/unuran-1.11.0/src/utils/slist_struct.h new file mode 100644 index 0000000..74c6980 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/slist_struct.h @@ -0,0 +1,46 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: slist_struct.h * + * * + * PURPOSE: * + * declares structures for simple list * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Store simple list. */ + +struct unur_slist { + void **ptr; /* pointer to array with pointers to list elements */ + int n_ptr; /* number of list elements */ + +#ifdef UNUR_COOKIES + unsigned cookie; /* magic cookie */ +#endif +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/stream.c b/vendor/unuran-1.11.0/src/utils/stream.c new file mode 100644 index 0000000..d7c7407 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/stream.c @@ -0,0 +1,358 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: stream.c * + * * + * routines for output streams and reading data * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2012 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include + +#include +#include +#include + +#ifdef R_UNURAN +#include +#endif + +/*---------------------------------------------------------------------------*/ + +/* we check whether 'UNUR_LOG_FILE' is defined. use a fallback otherwise. */ +#ifndef UNUR_LOG_FILE +# define UNUR_LOG_FILE "unuran.log" +#endif + +/*---------------------------------------------------------------------------*/ + +static FILE *_unur_logfile_open( void ); + +/*---------------------------------------------------------------------------*/ + +static FILE *unur_stream = NULL; +static const char GENID_UNKNOWN[] = "UNURAN"; + +/*---------------------------------------------------------------------------*/ + +void +_unur_log_printf( const char *genid ATTRIBUTE__UNUSED, + const char *filename ATTRIBUTE__UNUSED, + int line ATTRIBUTE__UNUSED, + const char *format ATTRIBUTE__UNUSED, ... ) + /*----------------------------------------------------------------------*/ + /* write messages on output stream(s) */ + /* */ + /* parameters: */ + /* genid ... identifier of generator object (NULL if not known) */ + /* filename ... name of source file (provided by __FILE__) */ + /* line ... line number in source file (provided by __LINE__) */ + /* format ... format for fprintf() */ + /* ... ... (optional) arguments to be be printed */ + /*----------------------------------------------------------------------*/ +{ +#ifdef UNUR_ENABLE_LOGGING + va_list ap; + + /* generator identifier known ? */ + if (!genid) genid = GENID_UNKNOWN; + + va_start(ap, format); + + /* write onto output stream */ + if (!unur_stream) unur_get_stream(); + fprintf(unur_stream,"%s: %s:%d - ",genid,filename,line); + vfprintf(unur_stream,format,ap); + fprintf(unur_stream,"\n"); + fflush(unur_stream); /* in case of a segmentation fault */ + + va_end(ap); +#else + return; +#endif +} /* end of _unur_log_printf() */ + +/*---------------------------------------------------------------------------*/ + +void _unur_log_debug( const char *format ATTRIBUTE__UNUSED, ... ) + /*----------------------------------------------------------------------*/ + /* write debugging messages on output stream(s) */ + /* (same as _unur_stream_printf() but without file and line number) */ + /* */ + /* parameters: */ + /* format ... format for fprintf() */ + /* ... ... (optional) arguments to be be printed */ + /*----------------------------------------------------------------------*/ +{ +#ifdef UNUR_ENABLE_LOGGING + va_list ap; + + va_start(ap, format); + + /* write onto output stream */ + if (!unur_stream) unur_get_stream(); + vfprintf(unur_stream,format,ap); + fflush(unur_stream); /* in case of a segmentation fault */ + + va_end(ap); +#else + return; +#endif +} /* end of _unur_log_debug() */ + +/*---------------------------------------------------------------------------*/ + +FILE * +unur_set_stream( FILE *new_stream ) + /*----------------------------------------------------------------------*/ + /* (re)set output stream for (error) messages */ + /* */ + /* parameters: */ + /* new_stream ... pointer to new output stream */ + /* */ + /* return: */ + /* pointer to old stream */ + /*----------------------------------------------------------------------*/ +{ + FILE * previous_stream; + + _unur_check_NULL( GENID_UNKNOWN,new_stream,NULL ); + + previous_stream = unur_stream; + unur_stream = new_stream; + + return previous_stream; +} /* end of unur_set_stream() */ + +/*---------------------------------------------------------------------------*/ + +FILE * +unur_get_stream( void ) + /*----------------------------------------------------------------------*/ + /* get output stream for (error) messages */ + /* */ + /* parameters: none */ + /* */ + /* return: */ + /* pointer to output stream */ + /*----------------------------------------------------------------------*/ +{ + if (unur_stream == NULL) { + unur_stream = _unur_logfile_open(); + } + + return unur_stream; +} /* end of unur_get_stream() */ + +/*---------------------------------------------------------------------------*/ + +FILE * +_unur_logfile_open( void ) + /*----------------------------------------------------------------------*/ + /* open log file */ + /*----------------------------------------------------------------------*/ +{ + static FILE* LOG = NULL; + + if (LOG) return LOG; /* log file already open */ + +#if defined(UNUR_ENABLE_LOGGING) + /* logging enabled: print error messages into log file */ + + /* open log file */ + LOG = fopen(UNUR_LOG_FILE,"w"); + + if (!LOG) { + fprintf(stderr,"Warning: cannot open logfile %s !\n",UNUR_LOG_FILE); + fprintf(stderr,"Use STDERR instead !\n"); + LOG = stderr; + } + + /* write header into log file */ + fprintf(LOG,"\nUNU.RAN - Universal Non-Uniform RANdom number generator\n\n"); + fprintf(LOG,"Version: %s\n",PACKAGE_VERSION); + + /* time when created */ + { + time_t started; + if (time( &started ) != -1) + fprintf(LOG,"%s",ctime(&started)); + } + + fprintf(LOG,"\n=======================================================\n\n"); + +#elif defined(R_UNURAN) + /* Inside R package 'Runuran'. */ + /* We do not need an output stream. So we could use 'stderr' as we */ + /* do not write anything at all. However, R CMD check complains. */ + /* We also just could use NULL. However, this surely results in a */ + /* segfault in the unlikely case that we accidently ask for */ + /* output handle 'LOG'. Thus we open file UNUR_LOG_FILE. */ + + LOG = fopen(UNUR_LOG_FILE,"w"); + + if (!LOG) { error("Cannot open LOG file."); } + +#else + /* logging disabled: print error messages into stderr */ + + LOG = stderr; + +#endif + + /* return file handler */ + return LOG; + +} /* end of _unur_logfile_open() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_read_data( const char *filename, int no_of_entries, double **ar ) + /*----------------------------------------------------------------------*/ + /* get default parameters */ + /* */ + /* parameters: */ + /* filename ... name of data file */ + /* no_of_entries ... number of entries per line */ + /* ar ... to store pointer to array */ + /* */ + /* return: */ + /* number of valid lines read. */ + /* the pointer to the double array is stored in ar. */ + /* */ + /* error: */ + /* return 0, ar is set to NULL. */ + /* */ + /* comment: */ + /* This function takes the name of a data file and read the first */ + /* `no_of_entries' double numbers of each line successive into an */ + /* array. All lines not starting with a number are skipped */ + /* (including lines starting with white space!). */ + /* If a line contains less than `no_of_entries' numbers, the */ + /* function reports an error, `ar' is set to NULL, and 0 is returned. */ + /* The function allocates the required double array as a side effect. */ + /* In case of an error this array is freed. */ + /*----------------------------------------------------------------------*/ +{ + +#define LINELENGTH 1024 /* max length of lines allowed */ + + /* ------------------------------------------------------- */ + /* variable declarations */ + + const int datasize = 1000; /* initial size of data array */ + int i, j; + char *c; + int memfactor = 1; + + char line[LINELENGTH]; + char *toline; + char *chktoline; + + double *data; /* pointer to data array */ + int n_data; /* number of data in array */ + + FILE *fp; + + /* ------------------------------------------------------- */ + + /* initialize array ar */ + *ar = NULL; + n_data = 0; + + /* array must be able to hold at least no_of_entries numbers */ + if (datasize < no_of_entries) { + _unur_error("read_data",UNUR_ERR_GEN_DATA,"No of entries > max datasize"); + return 0; + } + + /* allocate memory for data */ + data = _unur_xmalloc(memfactor * datasize * sizeof(double)); + + /* open the file with the data */ + fp = fopen(filename, "r"); + if (fp == NULL) { + _unur_error("read_data",UNUR_ERR_GENERIC,"cannot open file"); + free(data); + return 0; + } + + /* read lines until eof */ + for ( c = fgets(line, LINELENGTH, fp), i=0; + !feof(fp) && c; + c = fgets(line, LINELENGTH, fp) ) { + + /* if necessary allocate more memory for array */ + if (i > memfactor*datasize - no_of_entries-2){ + memfactor++; + data = _unur_xrealloc(data, memfactor*datasize*sizeof(double)); + } + + /* ignore all lines not starting with a double number */ + if ( ! (isdigit(line[0]) || line[0] == '.' || line[0] == '+' + || line[0] == '-' ) ) + continue; + + /* increase counter */ + ++n_data; + + /* read data from line */ + toline = line; /* pointer to first element of array */ + for (j=0 ; j toline changes */ + + /* no success reading a double */ + if (chktoline == toline) { + _unur_error("read_data",UNUR_ERR_GEN_DATA,"data file not valid"); + free(data); + fclose(fp); + return 0; /* terminate routine */ + } + + } /* end of for -- read data from line */ + } /* end of for -- read lines of file */ + + /* close input stream */ + fclose(fp); + + /* allocate exactly the memory needed */ + data = _unur_xrealloc( data, (i+1) * sizeof(double) ); + + /* o.k. */ + *ar = data; + return n_data; + + /* ------------------------------------------------------- */ + +#undef LINELENGTH + +} /* end of _unur_read_data() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/stream.h b/vendor/unuran-1.11.0/src/utils/stream.h new file mode 100644 index 0000000..0d7bc8f --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/stream.h @@ -0,0 +1,100 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: stream.h * + * * + * PURPOSE: * + * routines for output streams and reading data * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* + =NODE Output_streams Output streams + + =UP Error_Debug [10] + + =DESCRIPTION + @cindex Error handlers + @cindex Output streams + + UNU.RAN uses a logfile for writing all error messages, warnings, + and debugging information onto an output stream. This stream can + be set at runtime by the unur_set_stream() call. + If no such stream is given by the user a default stream is used + by the library: all messages are written into the file + @file{unuran.log} in the current working directory. The name of + this logfile is defined by the macro @code{UNUR_LOG_FILE} in + @file{unuran_config.h}. + (If UNU.RAN fails to open this file for writing, @file{stderr} + is used instead.) + + To destinguish between messages for different objects each of + these has its own identifier which is composed by the name of + the distribution obejct and generator type, resp., followed by a + dot and three digits. + (If there are more than 999 generators then the identifiers are + not unique.) + + @emph{Remark:} Writting debugging information must be switched + on at compile time using the configure flag + @code{--enable-logging}, see @ref{Debug,,Debugging}. + + =END +*/ + +/* =ROUTINES */ + +/*---------------------------------------------------------------------------*/ +/* manipulate output stream */ + +FILE *unur_set_stream( FILE *new_stream ); +/* + This function sets a new file handler for the output stream, + @var{new_stream}, for the UNU.RAN library routines. The previous + handler is returned (so that you can restore it later). + Note that the pointer to a user defined file handler is stored in a + static variable, so there can be only one output stream handler per + program. This function should be not be used in multi-threaded + programs except to set up a program-wide error handler from a + master thread. + + The NULL pointer is not allowed. + (If you want to disable logging of debugging information use + unur_set_default_debug(UNUR_DEBUG_OFF) instead. + If you want to disable error messages at all use + unur_set_error_handler_off().) +*/ + +FILE *unur_get_stream( void ); +/* + Get the file handle for the current output stream. It can be used to + allow applications to write additional information into the logfile. +*/ + +/* =END */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/stream_source.h b/vendor/unuran-1.11.0/src/utils/stream_source.h new file mode 100644 index 0000000..7e389c2 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/stream_source.h @@ -0,0 +1,46 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: stream_source.h * + * * + * PURPOSE: * + * defines macros and function prototypes for input/output streams * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Function prototypes */ +void _unur_log_printf (const char *genid, const char *filename, int line, const char *format, ...) + ATTRIBUTE__FORMAT(4,5); +void _unur_log_debug (const char *format, ...) + ATTRIBUTE__FORMAT(1,2); + +/*---------------------------------------------------------------------------*/ + +/* Read data from file into double array. */ +int _unur_read_data (const char *file, int no_of_entries, double **array); + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/string.c b/vendor/unuran-1.11.0/src/utils/string.c new file mode 100644 index 0000000..8d7146c --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/string.c @@ -0,0 +1,185 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: string.c * + * * + * routines for handling strings * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include + +#include +#include +#include + +#define MEMBLOCKSIZE 128 /* block size for allocating memory */ +#define MAXSTRINGSIZE 1024 /* maximum size of printed string */ + +/*---------------------------------------------------------------------------*/ + +struct unur_string * +_unur_string_new ( void ) + /*----------------------------------------------------------------------*/ + /* Make new string */ + /* */ + /* parameters: none */ + /*----------------------------------------------------------------------*/ +{ + struct unur_string *string; + + string = _unur_xmalloc(sizeof(struct unur_string)); + string->text = NULL; + string->length = 0; + string->allocated = 0; + + return string; +} /* end of _unur_string_new() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_string_append ( struct unur_string *string, const char *format, ... ) + /*----------------------------------------------------------------------*/ + /* Append to string */ + /* */ + /* parameters: */ + /* string ... structure for string */ + /* format ... format for sprintf() */ + /* ... ... (optional) arguments to be be printed */ + /* */ + /* Important! */ + /* The generated string must not be longer than 1023 characters! */ + /*----------------------------------------------------------------------*/ +{ + size_t len; + va_list ap; + + /* optional list of arguments */ + va_start(ap, format); + + /* Resize the allocated memory if necessary */ + while (string->length + MAXSTRINGSIZE + 1 > string->allocated) { + string->allocated += MEMBLOCKSIZE; + string->text = _unur_xrealloc( string->text, (size_t)string->allocated ); + } + + /* print into string */ +#if HAVE_DECL_VSNPRINTF + /* this is part of ISO C99 */ + len = vsnprintf (string->text+string->length, (size_t)MAXSTRINGSIZE, format, ap); +#else + #error Function vsnprintf() required. + /* Fallback: */ + /** TODO: this is dangerous, since we have to take care, that + the generated string text is not longer than MAXSTRINGSIZE-1. **/ + /* len = vsprintf (string->text+string->length, format, ap); */ + /* if (len >= MAXSTRINGSIZE) { */ + /* _unur_error("UTIL",UNUR_ERR_SHOULD_NOT_HAPPEN,"string too long"); */ + /* exit (-1); /\* fatal error *\/ */ + /* } */ +#endif + + /* update length of string */ + string->length += len; + + /* close optional list of arguments */ + va_end(ap); + + return UNUR_SUCCESS; +} /* end of _unur_string_append() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_string_appendtext ( struct unur_string *string, const char *text ) + /*----------------------------------------------------------------------*/ + /* Append text to string */ + /* */ + /* parameters: */ + /* string ... structure for stringing string */ + /* text ... char array with text to be appended */ + /*----------------------------------------------------------------------*/ +{ + int len; + + /* length of text string */ + len = strlen(text); + + /* Resize the allocated memory if necessary */ + while (string->length + len + 1 > string->allocated) { + string->allocated += MEMBLOCKSIZE; + string->text = _unur_xrealloc( string->text, (size_t)string->allocated ); + } + + /* copy text into string */ + strncpy( string->text+string->length, text, len+1 ); + + /* update length of string */ + string->length += len; + + return UNUR_SUCCESS; +} /* end of _unur_string_appendtext() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_string_free ( struct unur_string *string ) + /*----------------------------------------------------------------------*/ + /* Destroy string (free all memory) */ + /* */ + /* parameters: */ + /* string ... structure for stringing string */ + /*----------------------------------------------------------------------*/ +{ + if (string) { + if (string->text) free (string->text); + free (string); + string = NULL; + } +} /* end of _unur_string_free() */ + +/*---------------------------------------------------------------------------*/ + +void +_unur_string_clear ( struct unur_string *string ) + /*----------------------------------------------------------------------*/ + /* Clear string (set length of string to 0) */ + /* */ + /* parameters: */ + /* string ... structure for stringing string */ + /*----------------------------------------------------------------------*/ +{ + if (string) { + string->length = 0; + *(string->text) = '\0'; + } +} /* end of _unur_string_clear() */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/src/utils/string_source.h b/vendor/unuran-1.11.0/src/utils/string_source.h new file mode 100644 index 0000000..c162987 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/string_source.h @@ -0,0 +1,54 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: string_source.h * + * * + * PURPOSE: * + * defines macros and function prototypes for strings * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Function prototypes */ + +/* Make new string */ +struct unur_string * _unur_string_new ( void ); + +/* Append to string */ +/* Important: The generated string must not be longer than 1023 characters! */ +int _unur_string_append ( struct unur_string *string, const char *format, ... ) + ATTRIBUTE__FORMAT(2,3); + +/* Append text to string */ +int _unur_string_appendtext ( struct unur_string *string, const char *text ); + +/* Destroy string */ +void _unur_string_free ( struct unur_string *string ); + +/* Clear string (set length of string to 0) */ +void _unur_string_clear ( struct unur_string *string ); + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/string_struct.h b/vendor/unuran-1.11.0/src/utils/string_struct.h new file mode 100644 index 0000000..fd09d27 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/string_struct.h @@ -0,0 +1,43 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: string_struct.h * + * * + * PURPOSE: * + * declares structures for strings * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* String */ + +struct unur_string { + char *text; /* pointer to string text */ + int length; /* length of string */ + int allocated; /* length allocated memory block */ +}; + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/umalloc.c b/vendor/unuran-1.11.0/src/utils/umalloc.c new file mode 100644 index 0000000..24d7c8b --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/umalloc.c @@ -0,0 +1,109 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: umalloc.c * + * * + * allocate memory * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include + +#ifdef R_UNURAN +#include +#endif + +/*---------------------------------------------------------------------------*/ + +void* +_unur_xmalloc(size_t size) + /*----------------------------------------------------------------------*/ + /* allocate memory */ + /* */ + /* parameters: */ + /* size ... size of allocated block */ + /* */ + /* error: */ + /* abort program */ + /*----------------------------------------------------------------------*/ +{ + register void *ptr; + + /* allocate memory */ + ptr = malloc( size ); + + /* successful ? */ + if (ptr == NULL) { + _unur_error(NULL,UNUR_ERR_MALLOC,""); +#ifdef R_UNURAN + error("memory exhausted"); +#else + exit (EXIT_FAILURE); +#endif + } + + return ptr; + +} /* end of _unur_xmalloc() */ + +/*---------------------------------------------------------------------------*/ + +void* +_unur_xrealloc(void *ptr, size_t size) + /*----------------------------------------------------------------------*/ + /* reallocate memory */ + /* */ + /* parameters: */ + /* ptr ... address of memory block previously allocated by malloc. */ + /* size ... size of reallocated block */ + /* */ + /* error: */ + /* abort program */ + /*----------------------------------------------------------------------*/ +{ + register void *new_ptr; + + /* reallocate memory */ + + new_ptr = realloc( ptr, size ); + + /* successful ? */ + if (new_ptr == NULL) { + _unur_error(NULL,UNUR_ERR_MALLOC,""); +#ifdef R_UNURAN + error("memory exhausted"); +#else + exit (EXIT_FAILURE); +#endif + } + + return new_ptr; + +} /* end of _unur_xrealloc() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/umalloc_source.h b/vendor/unuran-1.11.0/src/utils/umalloc_source.h new file mode 100644 index 0000000..bd12c07 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/umalloc_source.h @@ -0,0 +1,40 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: umalloc_source.h * + * * + * PURPOSE: * + * prototypes for allocating memory blocks * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* Function prototypes for allocating memory blocks */ + +/*---------------------------------------------------------------------------*/ +void *_unur_xmalloc(size_t size) ATTRIBUTE__MALLOC; +void *_unur_xrealloc(void *ptr, size_t size) ATTRIBUTE__MALLOC; +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/umath.c b/vendor/unuran-1.11.0/src/utils/umath.c new file mode 100644 index 0000000..7ca4994 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/umath.c @@ -0,0 +1,119 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: umath.c * + * * + * miscelleanous mathematical routines * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include + +/*---------------------------------------------------------------------------*/ + +/* If the macro INFINITY is not already defined we store infinity in the */ +/* global variable INFINITY. */ +#ifndef INFINITY + +# if defined(HAVE_DECL_HUGE_VAL) + + const double INFINITY = HUGE_VAL; + +# elif defined(HAVE_DIVIDE_BY_ZERO) + + const double INFINITY = 1.0 / 0.0; + +# elif defined(HAVE_DECL_DBL_MAX) + + const double INFINITY = DBL_MAX; + +# else + +# error +# error +--------------------------------------------+ +# error ! Sorry, Cannot define INFINITY correctly!.. ! +# error ! Please contact . ! +# error +--------------------------------------------+ +# error + +# endif + +#endif + +/*---------------------------------------------------------------------------*/ + +#define ARCMEAN_HARMONIC (1.e3) /* use harmonic mean when abs larger than this value */ +#define ARCMEAN_ARITHMETIC (1.e-6) /* use harmonic mean when abs larger than this value */ + +double +_unur_arcmean( double x0, double x1 ) + /*----------------------------------------------------------------------*/ + /* compute "arctan mean" of two numbers. */ + /* */ + /* parameters: */ + /* x0, x1 ... two numbers */ + /* */ + /* return: */ + /* mean */ + /* */ + /* comment: */ + /* "arctan mean" = tan(0.5*(arctan(x0)+arctan(x1))) */ + /* */ + /* a combination of arithmetical mean (for x0 and x1 close to 0) */ + /* and the harmonic mean (for |x0| and |x1| large). */ + /*----------------------------------------------------------------------*/ +{ + double a0,a1; + double r; + + /* we need x0 < x1 */ + if (x0>x1) {double tmp = x0; x0=x1; x1=tmp;} + + if (x1 < -ARCMEAN_HARMONIC || x0 > ARCMEAN_HARMONIC) + /* use harmonic mean */ + return (2./(1./x0 + 1./x1)); + + a0 = (x0<=-UNUR_INFINITY) ? -M_PI/2. : atan(x0); + a1 = (x1>= UNUR_INFINITY) ? M_PI/2. : atan(x1); + + if (fabs(a0-a1) < ARCMEAN_ARITHMETIC) + /* use arithmetic mean */ + r = 0.5*x0 + 0.5*x1; + + else + /* use "arc mean" */ + r = tan((a0 + a1)/2.); + + return r; +} /* end of _unur_arcmean() */ + +/*---------------------------------------------------------------------------*/ + + + + diff --git a/vendor/unuran-1.11.0/src/utils/umath.h b/vendor/unuran-1.11.0/src/utils/umath.h new file mode 100644 index 0000000..0fc2dc7 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/umath.h @@ -0,0 +1,100 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: umath.h * + * * + * PURPOSE: * + * defines macros and function prototypes for miscelleanous * + * mathematical routines * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef MATH_H_SEEN +#define MATH_H_SEEN +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ + +/* + =NODE Math Mathematics + + =UP Misc [0] + + =DESCRIPTION + The following macros have been defined + + @ftable @code + @item UNUR_INFINITY + indicates infinity for floating point numbers (of type @code{double}). + Internally @code{HUGE_VAL} is used. + + @item INT_MAX + @itemx INT_MIN + indicate infinity and minus infinity, resp., for integers + (defined by ISO C standard). + + @item TRUE + @itemx FALSE + bolean expression for return values of @code{set} functions. + @end ftable + + =END +*/ + +/*---------------------------------------------------------------------------*/ +/* Define INFINITY */ +/* (we use the largest possible value to indicate infinity) */ +#include + +#ifndef INFINITY +/* use a global variable to store infinity */ +/* (definition in umath.c) */ +extern const double INFINITY; +#endif + +#define UNUR_INFINITY (INFINITY) + +/*---------------------------------------------------------------------------*/ +/* True and false */ + +#ifndef TRUE +#define TRUE (1) +#endif + +#ifndef FALSE +#define FALSE (0) +#endif + +/*---------------------------------------------------------------------------*/ +#endif /* MATH_H_SEEN */ +/*---------------------------------------------------------------------------*/ + + + + + + diff --git a/vendor/unuran-1.11.0/src/utils/umath_source.h b/vendor/unuran-1.11.0/src/utils/umath_source.h new file mode 100644 index 0000000..2ad50de --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/umath_source.h @@ -0,0 +1,60 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: umath_source.h * + * * + * PURPOSE: * + * declares macros, constants, structures, function prototypes, etc. * + * for using mathematics in UNU.RAN. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef UMATH_SOURCE_H_SEEN +#define UMATH_SOURCE_H_SEEN +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* Prototypes for various functions used in library */ + +/* Compute a "mean" defined as combibation of arithmetic and harmonic mean */ +double _unur_arcmean( double x0, double x1 ); + +/*---------------------------------------------------------------------------*/ +/* Macros */ + +#define _unur_min(x,y) (((x)<(y)) ? (x) : (y)) +#define _unur_max(x,y) (((x)>(y)) ? (x) : (y)) + +/*---------------------------------------------------------------------------*/ +#endif /* UMATH_SOURCE_H_SEEN */ +/*---------------------------------------------------------------------------*/ + + + + + + diff --git a/vendor/unuran-1.11.0/src/utils/unur_errno.h b/vendor/unuran-1.11.0/src/utils/unur_errno.h new file mode 100644 index 0000000..97c3327 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/unur_errno.h @@ -0,0 +1,272 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unur_errno.h * + * * + * PURPOSE: * + * defines error codes. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef UNUR_ERRNO_H_SEEN +#define UNUR_ERRNO_H_SEEN +/*---------------------------------------------------------------------------*/ + +/* + =NODE Errno Error codes + + =UP Error_Debug [40] + + =DESCRIPTION + + @subsubheading List of error codes + + @itemize @bullet + @item Procedure executed successfully (no error) + @ftable @code + @item UNUR_SUCCESS (0x0u) + success (no error) + @end ftable + + @item Errors that occurred while handling distribution objects. + @ftable @code + @item UNUR_ERR_DISTR_SET + set failed (invalid parameter). + @item UNUR_ERR_DISTR_GET + get failed (parameter not set). + @item UNUR_ERR_DISTR_NPARAMS + invalid number of parameters. + @item UNUR_ERR_DISTR_DOMAIN + parameter(s) out of domain. + @item UNUR_ERR_DISTR_GEN + invalid variant for special generator. + @item UNUR_ERR_DISTR_REQUIRED + incomplete distribution object, entry missing. + @item UNUR_ERR_DISTR_UNKNOWN + unknown distribution, cannot handle. + @item UNUR_ERR_DISTR_INVALID + invalid distribution object. + @item UNUR_ERR_DISTR_DATA + data are missing. + @item UNUR_ERR_DISTR_PROP + desired property does not exist + @end ftable + + @item Errors that occurred while handling parameter objects. + @ftable @code + @item UNUR_ERR_PAR_SET + set failed (invalid parameter) + @item UNUR_ERR_PAR_VARIANT + invalid variant -> using default + @item UNUR_ERR_PAR_INVALID + invalid parameter object + @end ftable + + @item Errors that occurred while handling generator objects. + @ftable @code + @item UNUR_ERR_GEN + error with generator object. + @item UNUR_ERR_GEN_DATA + (possibly) invalid data. + @item UNUR_ERR_GEN_CONDITION + condition for method violated. + @item UNUR_ERR_GEN_INVALID + invalid generator object. + @item UNUR_ERR_GEN_SAMPLING + sampling error. + @item UNUR_ERR_NO_REINIT + reinit routine not implemented. + @item UNUR_ERR_NO_QUANTILE + quantile routine not implemented. + @end ftable + + @item Errors that occurred while handling URNG objects. + @ftable @code + @item UNUR_ERR_URNG + generic error with URNG object. + @item UNUR_ERR_URNG_MISS + missing functionality. + @end ftable + + @item Errors that occurred while parsing strings. + @ftable @code + @item UNUR_ERR_STR + error in string. + @item UNUR_ERR_STR_UNKNOWN + unknown keyword. + @item UNUR_ERR_STR_SYNTAX + syntax error. + @item UNUR_ERR_STR_INVALID + invalid parameter. + @item UNUR_ERR_FSTR_SYNTAX + syntax error in function string. + @item UNUR_ERR_FSTR_DERIV + cannot derivate function. + @end ftable + + @item Other run time errors. + @ftable @code + @item UNUR_ERR_DOMAIN + argument out of domain. + @item UNUR_ERR_ROUNDOFF + (serious) round-off error. + @item UNUR_ERR_MALLOC + virtual memory exhausted. + @item UNUR_ERR_NULL + invalid NULL pointer. + @item UNUR_ERR_COOKIE + invalid cookie. + @item UNUR_ERR_GENERIC + generic error. + @item UNUR_ERR_SILENT + silent error (no error message). + @item UNUR_ERR_INF + infinity occured. + @item UNUR_ERR_NAN + NaN occured. + @item UNUR_ERR_COMPILE + Requested routine requires different compilation switches. + Recompilation of library necessary. + @item UNUR_ERR_SHOULD_NOT_HAPPEN + Internal error, that should not happen. + Please report this bug! + @end ftable + + @end itemize + + =END + + =EON +*/ + +/*---------------------------------------------------------------------------*/ + +enum { + + /** procedure executed successfully **/ + UNUR_SUCCESS = 0x00, /* exited successfully */ + + /** procedure executed with error (for internal use) **/ + UNUR_FAILURE = 0x01, /* failure */ + + /** distribution object **/ + /* + @code{UNUR_ERR_DISTR_...} + Errors that occurred while handling distribution objects. + */ + UNUR_ERR_DISTR_SET = 0x11, /* set failed (invalid parameter) */ + UNUR_ERR_DISTR_GET = 0x12, /* get failed (parameter not set) */ + UNUR_ERR_DISTR_NPARAMS = 0x13, /* invalid number of parameters */ + UNUR_ERR_DISTR_DOMAIN = 0x14, /* parameter out of domain */ + UNUR_ERR_DISTR_GEN = 0x15, /* invalid variant for special generator */ + UNUR_ERR_DISTR_REQUIRED = 0x16, /* incomplete distribution object, entry missing */ + UNUR_ERR_DISTR_UNKNOWN = 0x17, /* unknown distribution, cannot handle */ + UNUR_ERR_DISTR_INVALID = 0x18, /* invalid distribution object */ + UNUR_ERR_DISTR_DATA = 0x19, /* data are missing */ + UNUR_ERR_DISTR_PROP = 0x20, /* desired property does not exist */ + + /** parameter object **/ + /* + @code{UNUR_ERR_PAR_...} + Errors that occurred while handling parameter objects. + */ + UNUR_ERR_PAR_SET = 0x21, /* set failed (invalid parameter) */ + UNUR_ERR_PAR_VARIANT = 0x22, /* invalid variant -> using default */ + UNUR_ERR_PAR_INVALID = 0x23, /* invalid parameter object */ + + /** generator object **/ + /* + @code{UNUR_ERR_GEN_...} + Errors that occurred while handling generator objects. + */ + UNUR_ERR_GEN = 0x31, /* bit for generator object */ + UNUR_ERR_GEN_DATA = 0x32, /* (possible) invalid data */ + UNUR_ERR_GEN_CONDITION = 0x33, /* condition for method violated */ + UNUR_ERR_GEN_INVALID = 0x34, /* invalid generator object */ + UNUR_ERR_GEN_SAMPLING = 0x35, /* sampling error */ + UNUR_ERR_NO_REINIT = 0x36, /* reinit not implemented */ + UNUR_ERR_NO_QUANTILE = 0x37, /* qunantile not implemented */ + + /** uniform random number generator (URNG) object **/ + /* + @code{UNUR_ERR_URNG_...} + Errors that occurred while handling URNG objects. + */ + + UNUR_ERR_URNG = 0x41, /* generic error with URNG object */ + UNUR_ERR_URNG_MISS = 0x42, /* missing functionality */ + + /** string parser **/ + /* + @code{UNUR_ERR_STR_...} + Errors that occurred while parsing strings. + */ + UNUR_ERR_STR = 0x51, /* error in stringparser */ + UNUR_ERR_STR_UNKNOWN = 0x52, /* unknown key word in string */ + UNUR_ERR_STR_SYNTAX = 0x53, /* syntax error in string */ + UNUR_ERR_STR_INVALID = 0x54, /* invalid parameter in argument */ + UNUR_ERR_FSTR_SYNTAX = 0x55, /* syntax error in function parser */ + UNUR_ERR_FSTR_DERIV = 0x56, /* cannot derivate function */ + + /** misc **/ + /* + @code{UNUR_ERR_...} + Other errors. + */ + UNUR_ERR_DOMAIN = 0x61, /* argument out of domain */ + UNUR_ERR_ROUNDOFF = 0x62, /* (serious) round-off error */ + UNUR_ERR_MALLOC = 0x63, /* virtual memory exhausted */ + UNUR_ERR_NULL = 0x64, /* invalid NULL pointer */ + UNUR_ERR_COOKIE = 0x65, /* invalid cookie */ + UNUR_ERR_GENERIC = 0x66, /* generic error */ + UNUR_ERR_SILENT = 0x67, /* silent error (no error message) */ + UNUR_ERR_INF = 0x68, /* infinity occured */ + UNUR_ERR_NAN = 0x69, /* NaN occured */ + + /** compilation switches **/ + /* + @code{UNUR_ERR_COMPILE} + Requested routine requires different compilation switches. + Recompilation of library necessary. + */ + UNUR_ERR_COMPILE = 0xa0, /* not available, recompile library */ + + /** this should not happen **/ + /* + @code{UNUR_ERR_SHOULD_NOT_HAPPEN} + Internal error. This should not happen. + Please make a bug report. + */ + UNUR_ERR_SHOULD_NOT_HAPPEN = 0xf0 /* error should not happen, report this! */ + +}; + +/*---------------------------------------------------------------------------*/ +#endif /* UNUR_ERRNO_H_SEEN */ +/*---------------------------------------------------------------------------*/ + + diff --git a/vendor/unuran-1.11.0/src/utils/unur_fp.c b/vendor/unuran-1.11.0/src/utils/unur_fp.c new file mode 100644 index 0000000..b6714b1 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/unur_fp.c @@ -0,0 +1,258 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unur_fp.c * + * * + * miscelleanous routines for floating point arithmetic * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include + +/*---------------------------------------------------------------------------*/ + +int +_unur_FP_cmp( double x1, double x2, double eps) + /*----------------------------------------------------------------------*/ + /* Compare two floats: */ + /* x1 eq x2 iff |x1-x2| <= min(|x1|,|x2) * eps */ + /* */ + /* parameters: */ + /* x1 ... double */ + /* x2 ... double */ + /* eps ... maximal relative deviation */ + /* */ + /* return: */ + /* -1 if x1 < x2 */ + /* 0 if x1 eq x2 */ + /* +1 if x1 > x2 */ + /* */ + /* remark: */ + /* This is similar to Knuth's algorithm. However, we use */ + /* instead of max(|x1|,|x2). */ + /* We also have to deal with +-INFINITY correctly. */ + /* */ + /* (For an implementation of Knuth's algorithm see */ + /* fcmp 1.2.2 Copyright (c) 1998-2000 Theodore C. Belding */ + /* University of Michigan Center for the Study of Complex Systems */ + /* Ted.Belding@umich.edu) */ + /*----------------------------------------------------------------------*/ +{ + double fx1 = (x1>=0.) ? x1 : -x1; + double fx2 = (x2>=0.) ? x2 : -x2; + double delta = eps * _unur_min(fx1,fx2); + double difference = x1 - x2; + + /* we have to take care about INFINITY */ + if (_unur_isinf(delta)) { + delta = eps * DBL_MAX; + } + + /* denormalized numbers (close to zero) may cause problems. */ + /* so we check this special case. */ + if (fx1 <= 2.*DBL_MIN && fx2 <= 2.*DBL_MIN) + return 0; + + if (difference > delta) /* x1 > x2 */ + return +1; + else if (difference < -delta) /* x1 < x2 */ + return -1; + else /* -delta <= difference <= delta */ + return 0; /* x1 ~=~ x2 */ + +} /* end of _unur_FP_cmp() */ + +/*---------------------------------------------------------------------------*/ + +#ifndef _unur_iszero +int _unur_iszero (const double x) + /*----------------------------------------------------------------------*/ + /* Check whether x is equal to 0.0 */ + /* */ + /* parameters: */ + /* x ... floating-point number */ + /* */ + /* return: */ + /* TRUE if x == 0 */ + /* FALSE otherwise */ + /*----------------------------------------------------------------------*/ +{ + return (x==0.); +} /* end of _unur_iszero() */ +#endif + +/*---------------------------------------------------------------------------*/ + +#ifndef _unur_isone +int _unur_isone (const double x) + /*----------------------------------------------------------------------*/ + /* Check whether x is equal to 1.0 */ + /* */ + /* parameters: */ + /* x ... floating-point number */ + /* */ + /* return: */ + /* TRUE if x == 1 */ + /* FALSE otherwise */ + /*----------------------------------------------------------------------*/ +{ + return (x==1.); +} /* end of _unur_isone() */ +#endif + +/*---------------------------------------------------------------------------*/ + +#ifndef _unur_isfsame +int _unur_isfsame (const double x, const double y) + /*----------------------------------------------------------------------*/ + /* Check whether x == y */ + /* (Unsafe version that should only be used for powers of 2) */ + /* */ + /* parameters: */ + /* x ... floating-point number */ + /* y ... floating-point number */ + /* */ + /* return: */ + /* TRUE if x == y */ + /* FALSE otherwise */ + /*----------------------------------------------------------------------*/ +{ + return (x==y); +} /* end of _unur_isfsame() */ +#endif + +/*---------------------------------------------------------------------------*/ + +int +_unur_isfinite (const double x) + /*----------------------------------------------------------------------*/ + /* Check whether x is a finite number. */ + /* */ + /* parameters: */ + /* x ... floating-point number */ + /* */ + /* return: */ + /* TRUE if x is finite */ + /* FALSE otherwise (i.e., if x is +/- infinity or NaN) */ + /*----------------------------------------------------------------------*/ +{ +#if HAVE_DECL_ISFINITE + return (isfinite(x) ? TRUE : FALSE); +#elif defined(_MSC_VER) /* Microsoft Visual C++ */ + return (_finite(x) ? TRUE : FALSE); +#elif HAVE_IEEE_COMPARISONS + if (x < UNUR_INFINITY && x > -UNUR_INFINITY) + return TRUE; + else + return FALSE; +#else +# error +# error +--------------------------------------------+ +# error ! Sorry, Cannot handle INFINITY correctly! . ! +# error ! Please contact . ! +# error +--------------------------------------------+ +# error +#endif +} /* end of _unur_isfinite() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_isnan (const double x) + /*----------------------------------------------------------------------*/ + /* Check whether x is a NaN (not a number) value. */ + /* */ + /* parameters: */ + /* x ... floating-point number */ + /* */ + /* return: */ + /* TRUE if x is NaN */ + /* FALSE otherwise */ + /*----------------------------------------------------------------------*/ +{ +#if HAVE_DECL_ISNAN + return (isnan(x) ? TRUE : FALSE); +#elif defined(_MSC_VER) /* Microsoft Visual C++ */ + return (_isnan(x) ? TRUE : FALSE); +#elif HAVE_IEEE_COMPARISONS + return ((x!=x) ? TRUE : FALSE); +#else +# error +# error +--------------------------------------------+ +# error ! Sorry, Cannot handle NaN correctly! ...... ! +# error ! Please contact . ! +# error +--------------------------------------------+ +# error +#endif +} /* end of _unur_isnan() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_isinf (const double x) + /*----------------------------------------------------------------------*/ + /* Check whether x is infinity. */ + /* */ + /* parameters: */ + /* x ... floating-point number */ + /* */ + /* return: */ + /* -1 ... if x is -infinity */ + /* 1 ... if x is +infinity */ + /* 0 ... otherwise */ + /*----------------------------------------------------------------------*/ +{ +#if HAVE_DECL_ISINF + return isinf(x); +#elif defined(_MSC_VER) /* Microsoft Visual C++ */ + int fpc = _fpclass(x); + + if (fpc == _FPCLASS_PINF) + return +1; + else if (fpc == _FPCLASS_NINF) + return -1; + else + return 0; +#elif HAVE_IEEE_COMPARISONS + if (x>=UNUR_INFINITY) + return 1; + else if (x<=-UNUR_INFINITY) + return -1; + else + return 0; +#else +# error +# error +--------------------------------------------+ +# error ! Sorry, Cannot handle INFINITY correctly! . ! +# error ! Please contact . ! +# error +--------------------------------------------+ +# error +#endif +} /* end of _unur_isinf() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/unur_fp_const_source.h b/vendor/unuran-1.11.0/src/utils/unur_fp_const_source.h new file mode 100644 index 0000000..b60a13d --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/unur_fp_const_source.h @@ -0,0 +1,38 @@ +/** File automatically created by scripts/compute_machine_constants **/ + +/***************************************************************************** + * * + * unuran -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef UNUR_FP_CONST_SOURCE_H_SEEN +#define UNUR_FP_CONST_SOURCE_H_SEEN +/*---------------------------------------------------------------------------*/ + +/* maximal relative error when testing equality of two doubles */ +#define UNUR_EPSILON 2.22044604925031308084726333618e-14 + +/* square root of DBL_EPSILON */ +#define UNUR_SQRT_DBL_EPSILON 1.490116119384765625e-08 + +/* log of DBL_EPSILON */ +#define UNUR_LOG_DBL_EPSILON -36.0436533891171535515240975656 + +/* the machine roundoff error */ +#define MACHEP 1.11022302462515654042363166809e-16 + +/* largest argument for exp() */ +#define MAXLOG 709.782712893383973096206318587 + +/* smallest argument for exp() without underflow */ +#define MINLOG -708.396418532264078748994506896 + +/* the maximal number that pow(x,x-0.5) has no overflow */ +/* we use a (very) conservative portable bound */ +#define MAXSTIR 108.116855767857671821730036754 + +/*---------------------------------------------------------------------------*/ +#endif /* UNUR_FP_CONST_SOURCE_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/unur_fp_source.h b/vendor/unuran-1.11.0/src/utils/unur_fp_source.h new file mode 100644 index 0000000..e7217ef --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/unur_fp_source.h @@ -0,0 +1,115 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unur_fp_source.h * + * * + * PURPOSE: * + * declares macros for floating point arithmetic. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef UNUR_FP_SOURCE_H_SEEN +#define UNUR_FP_SOURCE_H_SEEN +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* Comparisons */ + +int _unur_FP_cmp( double x1, double x2, double eps); +/* compare two floats: */ +/* x1 eq x2 iff |x1-x2| <= min(|x1|,|x2) * eps */ +/* return: */ +/* -1 if x1 < x2 */ +/* 0 if x1 eq x2 */ +/* +1 if x1 > x2 */ + +/* macros for different levels of accuracy */ +#define _unur_FP_cmp_same(a,b) (_unur_FP_cmp((a),(b),DBL_EPSILON)) +#define _unur_FP_cmp_equal(a,b) (_unur_FP_cmp((a),(b),UNUR_EPSILON)) +#define _unur_FP_cmp_approx(a,b) (_unur_FP_cmp((a),(b),UNUR_SQRT_DBL_EPSILON)) + +/* a == b (except precision bit) */ +#define _unur_FP_same(a,b) (_unur_FP_cmp((a),(b),DBL_EPSILON)==0) + +/* a == b */ +#define _unur_FP_equal(a,b) (_unur_FP_cmp((a),(b),UNUR_EPSILON)==0) + +/* a is approximately equal to b */ +#define _unur_FP_approx(a,b) (_unur_FP_cmp((a),(b),UNUR_SQRT_DBL_EPSILON)==0) + +/* a < b */ +#define _unur_FP_less(a,b) ((_unur_FP_cmp((a),(b),UNUR_EPSILON)<0) ? TRUE : FALSE) + +/* a > b */ +#define _unur_FP_greater(a,b) ((_unur_FP_cmp((a),(b),UNUR_EPSILON)>0) ? TRUE : FALSE) + +/*---------------------------------------------------------------------------*/ +/* Comparing floating point with == or != is unsafe. */ +/* However, we assume that comparing with 0.0 and powers of 2.0 is safe. */ +/* Thus we use the followig functions to mark these "safe" comparisons in */ +/* the code and thus we can use the GCC to detect all other comparisons. */ +/* For the latter _unur_FP_cmp_same() must be used. */ + +/* defined as macros */ +#define _unur_iszero(x) ((x)==0.0) +#define _unur_isone(x) ((x)==1.0) +#define _unur_isfsame(x,y) ((x)==(y)) + +/* defined as functions: only used for debugging. */ +/* (it switches off GCC warnings) */ +#ifndef _unur_iszero +int _unur_iszero (const double x); +#endif + +#ifndef _unur_isone +int _unur_isone (const double x); +#endif + +#ifndef _unur_isfsame +int _unur_isfsame (const double x, const double y); +#endif + +/*---------------------------------------------------------------------------*/ +/* Infinity and NaN (Not a Number) */ + +/* wrapper / replacement for corresponding C99 functions */ +int _unur_isfinite (const double x); +int _unur_isnan (const double x); +int _unur_isinf (const double x); + +/*---------------------------------------------------------------------------*/ +/* Other checks for infinity */ + +/* +oo */ +#define _unur_FP_is_infinity(a) ((a) >= UNUR_INFINITY) + +/* -oo */ +#define _unur_FP_is_minus_infinity(a) ((a) <= -UNUR_INFINITY) + +/*---------------------------------------------------------------------------*/ +#endif /* UNUR_FP_SOURCE_H_SEEN */ +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/src/utils/unur_math_source.h b/vendor/unuran-1.11.0/src/utils/unur_math_source.h new file mode 100644 index 0000000..2ddcffc --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/unur_math_source.h @@ -0,0 +1,99 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: unur_math_source.h * + * * + * PURPOSE: * + * declares macros, constants, structures, function prototypes, etc. * + * for using mathematics in UNU.RAN. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef UNUR_MATH_SOURCE_H_SEEN +#define UNUR_MATH_SOURCE_H_SEEN +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* mathematical constants */ + +#ifndef M_E +#define M_E 2.71828182845904523536028747135 /* e */ +#endif + +#ifndef M_SQRT2 +#define M_SQRT2 1.41421356237309504880168872421 /* sqrt(2) */ +#endif + +#ifndef M_SQRT3 +#define M_SQRT3 1.73205080756887729352744634151 /* sqrt(3) */ +#endif + +#ifndef M_SQRTH +#define M_SQRTH 0.707106781186547524400844362105 /* sqrt(1/2) */ +#endif + +#ifndef M_PI +#define M_PI 3.14159265358979323846264338328 /* pi */ +#endif + +#ifndef M_PI_4 +#define M_PI_4 0.78539816339744830966156608458 /* pi/4 */ +#endif + +#ifndef M_SQRTPI +#define M_SQRTPI 1.77245385090551602729816748334 /* sqrt(pi) */ +#endif + +#ifndef M_SQRT2PI +#define M_SQRT2PI 2.50662827463100050241576528481 /* sqrt(2*pi) */ +#endif + +#ifndef M_LN10 +#define M_LN10 2.30258509299404568401799145468 /* ln(10) */ +#endif + +#ifndef M_LN2 +#define M_LN2 0.69314718055994530941723212146 /* ln(2) */ +#endif + +#ifndef M_LNPI +#define M_LNPI 1.14472988584940017414342735135 /* ln(pi) */ +#endif + +#ifndef M_EULER +#define M_EULER 0.57721566490153286060651209008 /* Euler constant */ +#endif + +/*---------------------------------------------------------------------------*/ +#endif /* UNUR_MATH_SOURCE_H_SEEN */ +/*---------------------------------------------------------------------------*/ + + + + + + diff --git a/vendor/unuran-1.11.0/src/utils/vector.c b/vendor/unuran-1.11.0/src/utils/vector.c new file mode 100644 index 0000000..bc0f348 --- /dev/null +++ b/vendor/unuran-1.11.0/src/utils/vector.c @@ -0,0 +1,140 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: vector.c * + * * + * Routines for computations with vectors (arrays). * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*--------------------------------------------------------------------------*/ + +#include + +/*---------------------------------------------------------------------------*/ + +/* allocate memory for new vector */ +double * +_unur_vector_new(int dim) +{ + int i; + double *v; + + v = _unur_xmalloc(dim*sizeof(double)); + + /* setting all coordinates to 0 */ + for (i=0; i&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/unuran +pkgincludedir = $(includedir)/unuran +pkglibdir = $(libdir)/unuran +pkglibexecdir = $(libexecdir)/unuran +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +check_PROGRAMS = t_x_gen$(EXEEXT) t_unur_tests$(EXEEXT) \ + t_unur_error$(EXEEXT) t_urng$(EXEEXT) t_distr$(EXEEXT) \ + t_distr_cemp$(EXEEXT) t_distr_cont$(EXEEXT) \ + t_distr_corder$(EXEEXT) t_distr_cvec$(EXEEXT) \ + t_distr_condi$(EXEEXT) t_distr_cvemp$(EXEEXT) \ + t_distr_cxtrans$(EXEEXT) t_distr_discr$(EXEEXT) \ + t_distr_matr$(EXEEXT) t_auto$(EXEEXT) t_arou$(EXEEXT) \ + t_ars$(EXEEXT) t_cext$(EXEEXT) t_cstd$(EXEEXT) t_dari$(EXEEXT) \ + t_dau$(EXEEXT) t_dext$(EXEEXT) t_dgt$(EXEEXT) t_dsrou$(EXEEXT) \ + t_dss$(EXEEXT) t_dstd$(EXEEXT) t_empk$(EXEEXT) t_empl$(EXEEXT) \ + t_gibbs$(EXEEXT) t_hinv$(EXEEXT) t_hist$(EXEEXT) \ + t_hitro$(EXEEXT) t_hrb$(EXEEXT) t_hrd$(EXEEXT) t_hri$(EXEEXT) \ + t_itdr$(EXEEXT) t_mcorr$(EXEEXT) t_mixt$(EXEEXT) \ + t_mvstd$(EXEEXT) t_mvtdr$(EXEEXT) t_ninv$(EXEEXT) \ + t_norta$(EXEEXT) t_nrou$(EXEEXT) t_pinv$(EXEEXT) \ + t_srou$(EXEEXT) t_ssr$(EXEEXT) t_tabl$(EXEEXT) t_tdr$(EXEEXT) \ + t_tdr_gw$(EXEEXT) t_tdr_ps$(EXEEXT) t_tdr_ia$(EXEEXT) \ + t_unif$(EXEEXT) t_utdr$(EXEEXT) t_vempk$(EXEEXT) \ + t_vnrou$(EXEEXT) t_stringparser$(EXEEXT) t_info$(EXEEXT) \ + t_util_matrix$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) +test_StdDistr_DEPENDENCIES = \ + libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +test_functionparser_DEPENDENCIES = \ + libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +subdir = tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +#am__EXEEXT_1 = t_deprecated_vmt$(EXEEXT) \ +# t_deprecated_tdrgw$(EXEEXT) +#am__EXEEXT_2 = test_StdDistr$(EXEEXT) \ +# test_functionparser$(EXEEXT) +LTLIBRARIES = $(noinst_LTLIBRARIES) +libtestroutines_la_LIBADD = +am_libtestroutines_la_OBJECTS = testroutines.lo testcounter.lo +libtestroutines_la_OBJECTS = $(am_libtestroutines_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__v_lt_1 = +t_arou_SOURCES = t_arou.c +t_arou_OBJECTS = t_arou.$(OBJEXT) +t_arou_LDADD = $(LDADD) +t_arou_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_ars_SOURCES = t_ars.c +t_ars_OBJECTS = t_ars.$(OBJEXT) +t_ars_LDADD = $(LDADD) +t_ars_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_auto_SOURCES = t_auto.c +t_auto_OBJECTS = t_auto.$(OBJEXT) +t_auto_LDADD = $(LDADD) +t_auto_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_cext_SOURCES = t_cext.c +t_cext_OBJECTS = t_cext.$(OBJEXT) +t_cext_LDADD = $(LDADD) +t_cext_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_cstd_SOURCES = t_cstd.c +t_cstd_OBJECTS = t_cstd.$(OBJEXT) +t_cstd_LDADD = $(LDADD) +t_cstd_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_dari_SOURCES = t_dari.c +t_dari_OBJECTS = t_dari.$(OBJEXT) +t_dari_LDADD = $(LDADD) +t_dari_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_dau_SOURCES = t_dau.c +t_dau_OBJECTS = t_dau.$(OBJEXT) +t_dau_LDADD = $(LDADD) +t_dau_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_deprecated_tdrgw_SOURCES = t_deprecated_tdrgw.c +t_deprecated_tdrgw_OBJECTS = t_deprecated_tdrgw.$(OBJEXT) +t_deprecated_tdrgw_LDADD = $(LDADD) +t_deprecated_tdrgw_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_deprecated_vmt_SOURCES = t_deprecated_vmt.c +t_deprecated_vmt_OBJECTS = t_deprecated_vmt.$(OBJEXT) +t_deprecated_vmt_LDADD = $(LDADD) +t_deprecated_vmt_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_dext_SOURCES = t_dext.c +t_dext_OBJECTS = t_dext.$(OBJEXT) +t_dext_LDADD = $(LDADD) +t_dext_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_dgt_SOURCES = t_dgt.c +t_dgt_OBJECTS = t_dgt.$(OBJEXT) +t_dgt_LDADD = $(LDADD) +t_dgt_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_SOURCES = t_distr.c +t_distr_OBJECTS = t_distr.$(OBJEXT) +t_distr_LDADD = $(LDADD) +t_distr_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_cemp_SOURCES = t_distr_cemp.c +t_distr_cemp_OBJECTS = t_distr_cemp.$(OBJEXT) +t_distr_cemp_LDADD = $(LDADD) +t_distr_cemp_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_condi_SOURCES = t_distr_condi.c +t_distr_condi_OBJECTS = t_distr_condi.$(OBJEXT) +t_distr_condi_LDADD = $(LDADD) +t_distr_condi_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_cont_SOURCES = t_distr_cont.c +t_distr_cont_OBJECTS = t_distr_cont.$(OBJEXT) +t_distr_cont_LDADD = $(LDADD) +t_distr_cont_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_corder_SOURCES = t_distr_corder.c +t_distr_corder_OBJECTS = t_distr_corder.$(OBJEXT) +t_distr_corder_LDADD = $(LDADD) +t_distr_corder_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_cvec_SOURCES = t_distr_cvec.c +t_distr_cvec_OBJECTS = t_distr_cvec.$(OBJEXT) +t_distr_cvec_LDADD = $(LDADD) +t_distr_cvec_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_cvemp_SOURCES = t_distr_cvemp.c +t_distr_cvemp_OBJECTS = t_distr_cvemp.$(OBJEXT) +t_distr_cvemp_LDADD = $(LDADD) +t_distr_cvemp_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_cxtrans_SOURCES = t_distr_cxtrans.c +t_distr_cxtrans_OBJECTS = t_distr_cxtrans.$(OBJEXT) +t_distr_cxtrans_LDADD = $(LDADD) +t_distr_cxtrans_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_discr_SOURCES = t_distr_discr.c +t_distr_discr_OBJECTS = t_distr_discr.$(OBJEXT) +t_distr_discr_LDADD = $(LDADD) +t_distr_discr_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_matr_SOURCES = t_distr_matr.c +t_distr_matr_OBJECTS = t_distr_matr.$(OBJEXT) +t_distr_matr_LDADD = $(LDADD) +t_distr_matr_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_dsrou_SOURCES = t_dsrou.c +t_dsrou_OBJECTS = t_dsrou.$(OBJEXT) +t_dsrou_LDADD = $(LDADD) +t_dsrou_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_dss_SOURCES = t_dss.c +t_dss_OBJECTS = t_dss.$(OBJEXT) +t_dss_LDADD = $(LDADD) +t_dss_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_dstd_SOURCES = t_dstd.c +t_dstd_OBJECTS = t_dstd.$(OBJEXT) +t_dstd_LDADD = $(LDADD) +t_dstd_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_empk_SOURCES = t_empk.c +t_empk_OBJECTS = t_empk.$(OBJEXT) +t_empk_LDADD = $(LDADD) +t_empk_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_empl_SOURCES = t_empl.c +t_empl_OBJECTS = t_empl.$(OBJEXT) +t_empl_LDADD = $(LDADD) +t_empl_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_gibbs_SOURCES = t_gibbs.c +t_gibbs_OBJECTS = t_gibbs.$(OBJEXT) +t_gibbs_LDADD = $(LDADD) +t_gibbs_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_hinv_SOURCES = t_hinv.c +t_hinv_OBJECTS = t_hinv.$(OBJEXT) +t_hinv_LDADD = $(LDADD) +t_hinv_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_hist_SOURCES = t_hist.c +t_hist_OBJECTS = t_hist.$(OBJEXT) +t_hist_LDADD = $(LDADD) +t_hist_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_hitro_SOURCES = t_hitro.c +t_hitro_OBJECTS = t_hitro.$(OBJEXT) +t_hitro_LDADD = $(LDADD) +t_hitro_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_hrb_SOURCES = t_hrb.c +t_hrb_OBJECTS = t_hrb.$(OBJEXT) +t_hrb_LDADD = $(LDADD) +t_hrb_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_hrd_SOURCES = t_hrd.c +t_hrd_OBJECTS = t_hrd.$(OBJEXT) +t_hrd_LDADD = $(LDADD) +t_hrd_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_hri_SOURCES = t_hri.c +t_hri_OBJECTS = t_hri.$(OBJEXT) +t_hri_LDADD = $(LDADD) +t_hri_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_info_SOURCES = t_info.c +t_info_OBJECTS = t_info.$(OBJEXT) +t_info_LDADD = $(LDADD) +t_info_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_itdr_SOURCES = t_itdr.c +t_itdr_OBJECTS = t_itdr.$(OBJEXT) +t_itdr_LDADD = $(LDADD) +t_itdr_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_mcorr_SOURCES = t_mcorr.c +t_mcorr_OBJECTS = t_mcorr.$(OBJEXT) +t_mcorr_LDADD = $(LDADD) +t_mcorr_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_mixt_SOURCES = t_mixt.c +t_mixt_OBJECTS = t_mixt.$(OBJEXT) +t_mixt_LDADD = $(LDADD) +t_mixt_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_mvstd_SOURCES = t_mvstd.c +t_mvstd_OBJECTS = t_mvstd.$(OBJEXT) +t_mvstd_LDADD = $(LDADD) +t_mvstd_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_mvtdr_SOURCES = t_mvtdr.c +t_mvtdr_OBJECTS = t_mvtdr.$(OBJEXT) +t_mvtdr_LDADD = $(LDADD) +t_mvtdr_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_ninv_SOURCES = t_ninv.c +t_ninv_OBJECTS = t_ninv.$(OBJEXT) +t_ninv_LDADD = $(LDADD) +t_ninv_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_norta_SOURCES = t_norta.c +t_norta_OBJECTS = t_norta.$(OBJEXT) +t_norta_LDADD = $(LDADD) +t_norta_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_nrou_SOURCES = t_nrou.c +t_nrou_OBJECTS = t_nrou.$(OBJEXT) +t_nrou_LDADD = $(LDADD) +t_nrou_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_pinv_SOURCES = t_pinv.c +t_pinv_OBJECTS = t_pinv.$(OBJEXT) +t_pinv_LDADD = $(LDADD) +t_pinv_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_srou_SOURCES = t_srou.c +t_srou_OBJECTS = t_srou.$(OBJEXT) +t_srou_LDADD = $(LDADD) +t_srou_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_ssr_SOURCES = t_ssr.c +t_ssr_OBJECTS = t_ssr.$(OBJEXT) +t_ssr_LDADD = $(LDADD) +t_ssr_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_stringparser_SOURCES = t_stringparser.c +t_stringparser_OBJECTS = t_stringparser.$(OBJEXT) +t_stringparser_LDADD = $(LDADD) +t_stringparser_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_tabl_SOURCES = t_tabl.c +t_tabl_OBJECTS = t_tabl.$(OBJEXT) +t_tabl_LDADD = $(LDADD) +t_tabl_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_tdr_SOURCES = t_tdr.c +t_tdr_OBJECTS = t_tdr.$(OBJEXT) +t_tdr_LDADD = $(LDADD) +t_tdr_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_tdr_gw_SOURCES = t_tdr_gw.c +t_tdr_gw_OBJECTS = t_tdr_gw.$(OBJEXT) +t_tdr_gw_LDADD = $(LDADD) +t_tdr_gw_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_tdr_ia_SOURCES = t_tdr_ia.c +t_tdr_ia_OBJECTS = t_tdr_ia.$(OBJEXT) +t_tdr_ia_LDADD = $(LDADD) +t_tdr_ia_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_tdr_ps_SOURCES = t_tdr_ps.c +t_tdr_ps_OBJECTS = t_tdr_ps.$(OBJEXT) +t_tdr_ps_LDADD = $(LDADD) +t_tdr_ps_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_unif_SOURCES = t_unif.c +t_unif_OBJECTS = t_unif.$(OBJEXT) +t_unif_LDADD = $(LDADD) +t_unif_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_unur_error_SOURCES = t_unur_error.c +t_unur_error_OBJECTS = t_unur_error.$(OBJEXT) +t_unur_error_LDADD = $(LDADD) +t_unur_error_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_unur_tests_SOURCES = t_unur_tests.c +t_unur_tests_OBJECTS = t_unur_tests.$(OBJEXT) +t_unur_tests_LDADD = $(LDADD) +t_unur_tests_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_urng_SOURCES = t_urng.c +t_urng_OBJECTS = t_urng.$(OBJEXT) +t_urng_LDADD = $(LDADD) +t_urng_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_utdr_SOURCES = t_utdr.c +t_utdr_OBJECTS = t_utdr.$(OBJEXT) +t_utdr_LDADD = $(LDADD) +t_utdr_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_util_matrix_SOURCES = t_util_matrix.c +t_util_matrix_OBJECTS = t_util_matrix.$(OBJEXT) +t_util_matrix_LDADD = $(LDADD) +t_util_matrix_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_vempk_SOURCES = t_vempk.c +t_vempk_OBJECTS = t_vempk.$(OBJEXT) +t_vempk_LDADD = $(LDADD) +t_vempk_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_vnrou_SOURCES = t_vnrou.c +t_vnrou_OBJECTS = t_vnrou.$(OBJEXT) +t_vnrou_LDADD = $(LDADD) +t_vnrou_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_x_gen_SOURCES = t_x_gen.c +t_x_gen_OBJECTS = t_x_gen.$(OBJEXT) +t_x_gen_LDADD = $(LDADD) +t_x_gen_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +am__test_StdDistr_SOURCES_DIST = test_StdDistr.c +#am_test_StdDistr_OBJECTS = \ +# test_StdDistr.$(OBJEXT) +test_StdDistr_OBJECTS = $(am_test_StdDistr_OBJECTS) +test_StdDistr_LDADD = $(LDADD) +am__test_functionparser_SOURCES_DIST = test_functionparser.c +#am_test_functionparser_OBJECTS = \ +# test_functionparser.$(OBJEXT) +test_functionparser_OBJECTS = $(am_test_functionparser_OBJECTS) +test_functionparser_LDADD = $(LDADD) +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I. -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/t_arou.Po ./$(DEPDIR)/t_ars.Po \ + ./$(DEPDIR)/t_auto.Po ./$(DEPDIR)/t_cext.Po \ + ./$(DEPDIR)/t_cstd.Po ./$(DEPDIR)/t_dari.Po \ + ./$(DEPDIR)/t_dau.Po ./$(DEPDIR)/t_deprecated_tdrgw.Po \ + ./$(DEPDIR)/t_deprecated_vmt.Po ./$(DEPDIR)/t_dext.Po \ + ./$(DEPDIR)/t_dgt.Po ./$(DEPDIR)/t_distr.Po \ + ./$(DEPDIR)/t_distr_cemp.Po ./$(DEPDIR)/t_distr_condi.Po \ + ./$(DEPDIR)/t_distr_cont.Po ./$(DEPDIR)/t_distr_corder.Po \ + ./$(DEPDIR)/t_distr_cvec.Po ./$(DEPDIR)/t_distr_cvemp.Po \ + ./$(DEPDIR)/t_distr_cxtrans.Po ./$(DEPDIR)/t_distr_discr.Po \ + ./$(DEPDIR)/t_distr_matr.Po ./$(DEPDIR)/t_dsrou.Po \ + ./$(DEPDIR)/t_dss.Po ./$(DEPDIR)/t_dstd.Po \ + ./$(DEPDIR)/t_empk.Po ./$(DEPDIR)/t_empl.Po \ + ./$(DEPDIR)/t_gibbs.Po ./$(DEPDIR)/t_hinv.Po \ + ./$(DEPDIR)/t_hist.Po ./$(DEPDIR)/t_hitro.Po \ + ./$(DEPDIR)/t_hrb.Po ./$(DEPDIR)/t_hrd.Po ./$(DEPDIR)/t_hri.Po \ + ./$(DEPDIR)/t_info.Po ./$(DEPDIR)/t_itdr.Po \ + ./$(DEPDIR)/t_mcorr.Po ./$(DEPDIR)/t_mixt.Po \ + ./$(DEPDIR)/t_mvstd.Po ./$(DEPDIR)/t_mvtdr.Po \ + ./$(DEPDIR)/t_ninv.Po ./$(DEPDIR)/t_norta.Po \ + ./$(DEPDIR)/t_nrou.Po ./$(DEPDIR)/t_pinv.Po \ + ./$(DEPDIR)/t_srou.Po ./$(DEPDIR)/t_ssr.Po \ + ./$(DEPDIR)/t_stringparser.Po ./$(DEPDIR)/t_tabl.Po \ + ./$(DEPDIR)/t_tdr.Po ./$(DEPDIR)/t_tdr_gw.Po \ + ./$(DEPDIR)/t_tdr_ia.Po ./$(DEPDIR)/t_tdr_ps.Po \ + ./$(DEPDIR)/t_unif.Po ./$(DEPDIR)/t_unur_error.Po \ + ./$(DEPDIR)/t_unur_tests.Po ./$(DEPDIR)/t_urng.Po \ + ./$(DEPDIR)/t_utdr.Po ./$(DEPDIR)/t_util_matrix.Po \ + ./$(DEPDIR)/t_vempk.Po ./$(DEPDIR)/t_vnrou.Po \ + ./$(DEPDIR)/t_x_gen.Po ./$(DEPDIR)/test_StdDistr.Po \ + ./$(DEPDIR)/test_functionparser.Po ./$(DEPDIR)/testcounter.Plo \ + ./$(DEPDIR)/testroutines.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libtestroutines_la_SOURCES) t_arou.c t_ars.c t_auto.c \ + t_cext.c t_cstd.c t_dari.c t_dau.c t_deprecated_tdrgw.c \ + t_deprecated_vmt.c t_dext.c t_dgt.c t_distr.c t_distr_cemp.c \ + t_distr_condi.c t_distr_cont.c t_distr_corder.c t_distr_cvec.c \ + t_distr_cvemp.c t_distr_cxtrans.c t_distr_discr.c \ + t_distr_matr.c t_dsrou.c t_dss.c t_dstd.c t_empk.c t_empl.c \ + t_gibbs.c t_hinv.c t_hist.c t_hitro.c t_hrb.c t_hrd.c t_hri.c \ + t_info.c t_itdr.c t_mcorr.c t_mixt.c t_mvstd.c t_mvtdr.c \ + t_ninv.c t_norta.c t_nrou.c t_pinv.c t_srou.c t_ssr.c \ + t_stringparser.c t_tabl.c t_tdr.c t_tdr_gw.c t_tdr_ia.c \ + t_tdr_ps.c t_unif.c t_unur_error.c t_unur_tests.c t_urng.c \ + t_utdr.c t_util_matrix.c t_vempk.c t_vnrou.c t_x_gen.c \ + $(test_StdDistr_SOURCES) $(test_functionparser_SOURCES) +DIST_SOURCES = $(libtestroutines_la_SOURCES) t_arou.c t_ars.c t_auto.c \ + t_cext.c t_cstd.c t_dari.c t_dau.c t_deprecated_tdrgw.c \ + t_deprecated_vmt.c t_dext.c t_dgt.c t_distr.c t_distr_cemp.c \ + t_distr_condi.c t_distr_cont.c t_distr_corder.c t_distr_cvec.c \ + t_distr_cvemp.c t_distr_cxtrans.c t_distr_discr.c \ + t_distr_matr.c t_dsrou.c t_dss.c t_dstd.c t_empk.c t_empl.c \ + t_gibbs.c t_hinv.c t_hist.c t_hitro.c t_hrb.c t_hrd.c t_hri.c \ + t_info.c t_itdr.c t_mcorr.c t_mixt.c t_mvstd.c t_mvtdr.c \ + t_ninv.c t_norta.c t_nrou.c t_pinv.c t_srou.c t_ssr.c \ + t_stringparser.c t_tabl.c t_tdr.c t_tdr_gw.c t_tdr_ia.c \ + t_tdr_ps.c t_unif.c t_unur_error.c t_unur_tests.c t_urng.c \ + t_utdr.c t_util_matrix.c t_vempk.c t_vnrou.c t_x_gen.c \ + $(am__test_StdDistr_SOURCES_DIST) \ + $(am__test_functionparser_SOURCES_DIST) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + check recheck distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' +RECHECK_LOGS = $(TEST_LOGS) +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/autoconf/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/autoconf/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp \ + $(top_srcdir)/autoconf/test-driver +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_CFLAGS = -Wall -Wextra -Wshadow -Wstrict-prototypes +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf +AUTOHEADER = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader +AUTOMAKE = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -fPIC +CPP = gcc -E +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +FILECMD = file +GREP = /usr/bin/grep +HAVE_DIVIDE_BY_ZERO = +HAVE_IEEE_COMPARISONS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAINT = # +MAKEINFO = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = unuran +PACKAGE_BUGREPORT = unuran@statmath.wu.ac.at +PACKAGE_NAME = unuran +PACKAGE_STRING = unuran 1.11.0 +PACKAGE_TARNAME = unuran +PACKAGE_URL = +PACKAGE_VERSION = 1.11.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +UNURAN_LT_VERSION = 16:1:0 +UNURAN_SUPPORTS_GSL = +UNURAN_SUPPORTS_PRNG = +UNURAN_SUPPORTS_RNGSTREAM = +VERSION = 1.11.0 +abs_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/tests +abs_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/tests +abs_top_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +have_valgrind = false +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../ +top_builddir = .. +top_srcdir = .. +AUTOMAKE_OPTIONS = parallel-tests color-tests +SUBDIRS = testdistributions . +AM_CPPFLAGS = \ + $(UNURAN_SUPPORTS_GSL) \ + $(UNURAN_SUPPORTS_PRNG) \ + $(UNURAN_SUPPORTS_RNGSTREAM) \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/tests + +noinst_LTLIBRARIES = libtestroutines.la +libtestroutines_la_SOURCES = testroutines.c testcounter.c +LDADD = \ + libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la + +MATHEMATICA_PROGS = + +# Special files for tests with Mathematica(TM) +#MATHEMATICA_PROGS = test_StdDistr test_functionparser +DEPRECATED_TESTS = + +# Files that contain deprecated routines +#DEPRECATED_TESTS = t_deprecated_vmt t_deprecated_tdrgw +TESTS = $(check_PROGRAMS) + +# These tests fail until we fix some bugs +#XFAIL_TESTS = +noinst_HEADERS = \ + testunuran.h + +EXTRA_DIST = \ + test_StdDistr.m \ + test_functionparser.m \ + make_test_files.pl \ + README.conf \ + t_info.conf \ + t_stringparser.conf \ + t_x_gen.conf \ + t_unur_tests.conf \ + t_unur_error.conf \ + t_urng.conf \ + t_util_matrix.conf \ + t_distr.conf \ + t_distr_cemp.conf \ + t_distr_cont.conf \ + t_distr_corder.conf \ + t_distr_cvec.conf \ + t_distr_condi.conf \ + t_distr_cvemp.conf \ + t_distr_cxtrans.conf \ + t_distr_discr.conf \ + t_distr_matr.conf \ + t_auto.conf \ + t_arou.conf \ + t_ars.conf \ + t_cext.conf \ + t_cstd.conf \ + t_dari.conf \ + t_dau.conf \ + t_dext.conf \ + t_dgt.conf \ + t_dsrou.conf \ + t_dss.conf \ + t_dstd.conf \ + t_empk.conf \ + t_empl.conf \ + t_gibbs.conf \ + t_hinv.conf \ + t_hinv.conf \ + t_hist.conf \ + t_hrb.conf \ + t_hrd.conf \ + t_hri.conf \ + t_itdr.conf \ + t_mcorr.conf \ + t_mvstd.conf \ + t_ninv.conf \ + t_norta.conf \ + t_nrou.conf \ + t_pinv.conf \ + t_srou.conf \ + t_ssr.conf \ + t_tabl.conf \ + t_tdr.conf t_tdr_gw.conf t_tdr_ps.conf t_tdr_ia.conf \ + t_unif.conf \ + t_utdr.conf \ + t_vempk.conf \ + t_vnrou.conf \ +\ + t_deprecated_vmt.conf + + +# Compare results of CDF, PDF, and dPDF of standard distributions +# and results of function parser to those produced with +# Mathematica(TM) ... +#test_StdDistr_SOURCES = test_StdDistr.c +#test_StdDistr_DEPENDENCIES = t_StdDistr.data +#test_functionparser_SOURCES = test_functionparser.c +#test_functionparser_DEPENDENCIES = t_functionparser.data + +# Generate C sources for tests +SUFFIXES = .c + +# clean log files and backup files +CLEANFILES = \ + *.log \ + valgrind-* \ + unuran-valgrind-* \ + *~ + + +# clean generated files +DISTCLEANFILES = \ + rm -f t_*.data + + +# clean generated files +MAINTAINERCLEANFILES = \ + rm -f t_*.c \ + Makefile.in + +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .conf .lo .log .o .obj .test .test$(EXEEXT) .trs +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign tests/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libtestroutines.la: $(libtestroutines_la_OBJECTS) $(libtestroutines_la_DEPENDENCIES) $(EXTRA_libtestroutines_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libtestroutines_la_OBJECTS) $(libtestroutines_la_LIBADD) $(LIBS) + +t_arou$(EXEEXT): $(t_arou_OBJECTS) $(t_arou_DEPENDENCIES) $(EXTRA_t_arou_DEPENDENCIES) + @rm -f t_arou$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_arou_OBJECTS) $(t_arou_LDADD) $(LIBS) + +t_ars$(EXEEXT): $(t_ars_OBJECTS) $(t_ars_DEPENDENCIES) $(EXTRA_t_ars_DEPENDENCIES) + @rm -f t_ars$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_ars_OBJECTS) $(t_ars_LDADD) $(LIBS) + +t_auto$(EXEEXT): $(t_auto_OBJECTS) $(t_auto_DEPENDENCIES) $(EXTRA_t_auto_DEPENDENCIES) + @rm -f t_auto$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_auto_OBJECTS) $(t_auto_LDADD) $(LIBS) + +t_cext$(EXEEXT): $(t_cext_OBJECTS) $(t_cext_DEPENDENCIES) $(EXTRA_t_cext_DEPENDENCIES) + @rm -f t_cext$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_cext_OBJECTS) $(t_cext_LDADD) $(LIBS) + +t_cstd$(EXEEXT): $(t_cstd_OBJECTS) $(t_cstd_DEPENDENCIES) $(EXTRA_t_cstd_DEPENDENCIES) + @rm -f t_cstd$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_cstd_OBJECTS) $(t_cstd_LDADD) $(LIBS) + +t_dari$(EXEEXT): $(t_dari_OBJECTS) $(t_dari_DEPENDENCIES) $(EXTRA_t_dari_DEPENDENCIES) + @rm -f t_dari$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_dari_OBJECTS) $(t_dari_LDADD) $(LIBS) + +t_dau$(EXEEXT): $(t_dau_OBJECTS) $(t_dau_DEPENDENCIES) $(EXTRA_t_dau_DEPENDENCIES) + @rm -f t_dau$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_dau_OBJECTS) $(t_dau_LDADD) $(LIBS) + +t_deprecated_tdrgw$(EXEEXT): $(t_deprecated_tdrgw_OBJECTS) $(t_deprecated_tdrgw_DEPENDENCIES) $(EXTRA_t_deprecated_tdrgw_DEPENDENCIES) + @rm -f t_deprecated_tdrgw$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_deprecated_tdrgw_OBJECTS) $(t_deprecated_tdrgw_LDADD) $(LIBS) + +t_deprecated_vmt$(EXEEXT): $(t_deprecated_vmt_OBJECTS) $(t_deprecated_vmt_DEPENDENCIES) $(EXTRA_t_deprecated_vmt_DEPENDENCIES) + @rm -f t_deprecated_vmt$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_deprecated_vmt_OBJECTS) $(t_deprecated_vmt_LDADD) $(LIBS) + +t_dext$(EXEEXT): $(t_dext_OBJECTS) $(t_dext_DEPENDENCIES) $(EXTRA_t_dext_DEPENDENCIES) + @rm -f t_dext$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_dext_OBJECTS) $(t_dext_LDADD) $(LIBS) + +t_dgt$(EXEEXT): $(t_dgt_OBJECTS) $(t_dgt_DEPENDENCIES) $(EXTRA_t_dgt_DEPENDENCIES) + @rm -f t_dgt$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_dgt_OBJECTS) $(t_dgt_LDADD) $(LIBS) + +t_distr$(EXEEXT): $(t_distr_OBJECTS) $(t_distr_DEPENDENCIES) $(EXTRA_t_distr_DEPENDENCIES) + @rm -f t_distr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_OBJECTS) $(t_distr_LDADD) $(LIBS) + +t_distr_cemp$(EXEEXT): $(t_distr_cemp_OBJECTS) $(t_distr_cemp_DEPENDENCIES) $(EXTRA_t_distr_cemp_DEPENDENCIES) + @rm -f t_distr_cemp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_cemp_OBJECTS) $(t_distr_cemp_LDADD) $(LIBS) + +t_distr_condi$(EXEEXT): $(t_distr_condi_OBJECTS) $(t_distr_condi_DEPENDENCIES) $(EXTRA_t_distr_condi_DEPENDENCIES) + @rm -f t_distr_condi$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_condi_OBJECTS) $(t_distr_condi_LDADD) $(LIBS) + +t_distr_cont$(EXEEXT): $(t_distr_cont_OBJECTS) $(t_distr_cont_DEPENDENCIES) $(EXTRA_t_distr_cont_DEPENDENCIES) + @rm -f t_distr_cont$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_cont_OBJECTS) $(t_distr_cont_LDADD) $(LIBS) + +t_distr_corder$(EXEEXT): $(t_distr_corder_OBJECTS) $(t_distr_corder_DEPENDENCIES) $(EXTRA_t_distr_corder_DEPENDENCIES) + @rm -f t_distr_corder$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_corder_OBJECTS) $(t_distr_corder_LDADD) $(LIBS) + +t_distr_cvec$(EXEEXT): $(t_distr_cvec_OBJECTS) $(t_distr_cvec_DEPENDENCIES) $(EXTRA_t_distr_cvec_DEPENDENCIES) + @rm -f t_distr_cvec$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_cvec_OBJECTS) $(t_distr_cvec_LDADD) $(LIBS) + +t_distr_cvemp$(EXEEXT): $(t_distr_cvemp_OBJECTS) $(t_distr_cvemp_DEPENDENCIES) $(EXTRA_t_distr_cvemp_DEPENDENCIES) + @rm -f t_distr_cvemp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_cvemp_OBJECTS) $(t_distr_cvemp_LDADD) $(LIBS) + +t_distr_cxtrans$(EXEEXT): $(t_distr_cxtrans_OBJECTS) $(t_distr_cxtrans_DEPENDENCIES) $(EXTRA_t_distr_cxtrans_DEPENDENCIES) + @rm -f t_distr_cxtrans$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_cxtrans_OBJECTS) $(t_distr_cxtrans_LDADD) $(LIBS) + +t_distr_discr$(EXEEXT): $(t_distr_discr_OBJECTS) $(t_distr_discr_DEPENDENCIES) $(EXTRA_t_distr_discr_DEPENDENCIES) + @rm -f t_distr_discr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_discr_OBJECTS) $(t_distr_discr_LDADD) $(LIBS) + +t_distr_matr$(EXEEXT): $(t_distr_matr_OBJECTS) $(t_distr_matr_DEPENDENCIES) $(EXTRA_t_distr_matr_DEPENDENCIES) + @rm -f t_distr_matr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_matr_OBJECTS) $(t_distr_matr_LDADD) $(LIBS) + +t_dsrou$(EXEEXT): $(t_dsrou_OBJECTS) $(t_dsrou_DEPENDENCIES) $(EXTRA_t_dsrou_DEPENDENCIES) + @rm -f t_dsrou$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_dsrou_OBJECTS) $(t_dsrou_LDADD) $(LIBS) + +t_dss$(EXEEXT): $(t_dss_OBJECTS) $(t_dss_DEPENDENCIES) $(EXTRA_t_dss_DEPENDENCIES) + @rm -f t_dss$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_dss_OBJECTS) $(t_dss_LDADD) $(LIBS) + +t_dstd$(EXEEXT): $(t_dstd_OBJECTS) $(t_dstd_DEPENDENCIES) $(EXTRA_t_dstd_DEPENDENCIES) + @rm -f t_dstd$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_dstd_OBJECTS) $(t_dstd_LDADD) $(LIBS) + +t_empk$(EXEEXT): $(t_empk_OBJECTS) $(t_empk_DEPENDENCIES) $(EXTRA_t_empk_DEPENDENCIES) + @rm -f t_empk$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_empk_OBJECTS) $(t_empk_LDADD) $(LIBS) + +t_empl$(EXEEXT): $(t_empl_OBJECTS) $(t_empl_DEPENDENCIES) $(EXTRA_t_empl_DEPENDENCIES) + @rm -f t_empl$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_empl_OBJECTS) $(t_empl_LDADD) $(LIBS) + +t_gibbs$(EXEEXT): $(t_gibbs_OBJECTS) $(t_gibbs_DEPENDENCIES) $(EXTRA_t_gibbs_DEPENDENCIES) + @rm -f t_gibbs$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_gibbs_OBJECTS) $(t_gibbs_LDADD) $(LIBS) + +t_hinv$(EXEEXT): $(t_hinv_OBJECTS) $(t_hinv_DEPENDENCIES) $(EXTRA_t_hinv_DEPENDENCIES) + @rm -f t_hinv$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_hinv_OBJECTS) $(t_hinv_LDADD) $(LIBS) + +t_hist$(EXEEXT): $(t_hist_OBJECTS) $(t_hist_DEPENDENCIES) $(EXTRA_t_hist_DEPENDENCIES) + @rm -f t_hist$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_hist_OBJECTS) $(t_hist_LDADD) $(LIBS) + +t_hitro$(EXEEXT): $(t_hitro_OBJECTS) $(t_hitro_DEPENDENCIES) $(EXTRA_t_hitro_DEPENDENCIES) + @rm -f t_hitro$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_hitro_OBJECTS) $(t_hitro_LDADD) $(LIBS) + +t_hrb$(EXEEXT): $(t_hrb_OBJECTS) $(t_hrb_DEPENDENCIES) $(EXTRA_t_hrb_DEPENDENCIES) + @rm -f t_hrb$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_hrb_OBJECTS) $(t_hrb_LDADD) $(LIBS) + +t_hrd$(EXEEXT): $(t_hrd_OBJECTS) $(t_hrd_DEPENDENCIES) $(EXTRA_t_hrd_DEPENDENCIES) + @rm -f t_hrd$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_hrd_OBJECTS) $(t_hrd_LDADD) $(LIBS) + +t_hri$(EXEEXT): $(t_hri_OBJECTS) $(t_hri_DEPENDENCIES) $(EXTRA_t_hri_DEPENDENCIES) + @rm -f t_hri$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_hri_OBJECTS) $(t_hri_LDADD) $(LIBS) + +t_info$(EXEEXT): $(t_info_OBJECTS) $(t_info_DEPENDENCIES) $(EXTRA_t_info_DEPENDENCIES) + @rm -f t_info$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_info_OBJECTS) $(t_info_LDADD) $(LIBS) + +t_itdr$(EXEEXT): $(t_itdr_OBJECTS) $(t_itdr_DEPENDENCIES) $(EXTRA_t_itdr_DEPENDENCIES) + @rm -f t_itdr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_itdr_OBJECTS) $(t_itdr_LDADD) $(LIBS) + +t_mcorr$(EXEEXT): $(t_mcorr_OBJECTS) $(t_mcorr_DEPENDENCIES) $(EXTRA_t_mcorr_DEPENDENCIES) + @rm -f t_mcorr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_mcorr_OBJECTS) $(t_mcorr_LDADD) $(LIBS) + +t_mixt$(EXEEXT): $(t_mixt_OBJECTS) $(t_mixt_DEPENDENCIES) $(EXTRA_t_mixt_DEPENDENCIES) + @rm -f t_mixt$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_mixt_OBJECTS) $(t_mixt_LDADD) $(LIBS) + +t_mvstd$(EXEEXT): $(t_mvstd_OBJECTS) $(t_mvstd_DEPENDENCIES) $(EXTRA_t_mvstd_DEPENDENCIES) + @rm -f t_mvstd$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_mvstd_OBJECTS) $(t_mvstd_LDADD) $(LIBS) + +t_mvtdr$(EXEEXT): $(t_mvtdr_OBJECTS) $(t_mvtdr_DEPENDENCIES) $(EXTRA_t_mvtdr_DEPENDENCIES) + @rm -f t_mvtdr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_mvtdr_OBJECTS) $(t_mvtdr_LDADD) $(LIBS) + +t_ninv$(EXEEXT): $(t_ninv_OBJECTS) $(t_ninv_DEPENDENCIES) $(EXTRA_t_ninv_DEPENDENCIES) + @rm -f t_ninv$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_ninv_OBJECTS) $(t_ninv_LDADD) $(LIBS) + +t_norta$(EXEEXT): $(t_norta_OBJECTS) $(t_norta_DEPENDENCIES) $(EXTRA_t_norta_DEPENDENCIES) + @rm -f t_norta$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_norta_OBJECTS) $(t_norta_LDADD) $(LIBS) + +t_nrou$(EXEEXT): $(t_nrou_OBJECTS) $(t_nrou_DEPENDENCIES) $(EXTRA_t_nrou_DEPENDENCIES) + @rm -f t_nrou$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_nrou_OBJECTS) $(t_nrou_LDADD) $(LIBS) + +t_pinv$(EXEEXT): $(t_pinv_OBJECTS) $(t_pinv_DEPENDENCIES) $(EXTRA_t_pinv_DEPENDENCIES) + @rm -f t_pinv$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_pinv_OBJECTS) $(t_pinv_LDADD) $(LIBS) + +t_srou$(EXEEXT): $(t_srou_OBJECTS) $(t_srou_DEPENDENCIES) $(EXTRA_t_srou_DEPENDENCIES) + @rm -f t_srou$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_srou_OBJECTS) $(t_srou_LDADD) $(LIBS) + +t_ssr$(EXEEXT): $(t_ssr_OBJECTS) $(t_ssr_DEPENDENCIES) $(EXTRA_t_ssr_DEPENDENCIES) + @rm -f t_ssr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_ssr_OBJECTS) $(t_ssr_LDADD) $(LIBS) + +t_stringparser$(EXEEXT): $(t_stringparser_OBJECTS) $(t_stringparser_DEPENDENCIES) $(EXTRA_t_stringparser_DEPENDENCIES) + @rm -f t_stringparser$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_stringparser_OBJECTS) $(t_stringparser_LDADD) $(LIBS) + +t_tabl$(EXEEXT): $(t_tabl_OBJECTS) $(t_tabl_DEPENDENCIES) $(EXTRA_t_tabl_DEPENDENCIES) + @rm -f t_tabl$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_tabl_OBJECTS) $(t_tabl_LDADD) $(LIBS) + +t_tdr$(EXEEXT): $(t_tdr_OBJECTS) $(t_tdr_DEPENDENCIES) $(EXTRA_t_tdr_DEPENDENCIES) + @rm -f t_tdr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_tdr_OBJECTS) $(t_tdr_LDADD) $(LIBS) + +t_tdr_gw$(EXEEXT): $(t_tdr_gw_OBJECTS) $(t_tdr_gw_DEPENDENCIES) $(EXTRA_t_tdr_gw_DEPENDENCIES) + @rm -f t_tdr_gw$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_tdr_gw_OBJECTS) $(t_tdr_gw_LDADD) $(LIBS) + +t_tdr_ia$(EXEEXT): $(t_tdr_ia_OBJECTS) $(t_tdr_ia_DEPENDENCIES) $(EXTRA_t_tdr_ia_DEPENDENCIES) + @rm -f t_tdr_ia$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_tdr_ia_OBJECTS) $(t_tdr_ia_LDADD) $(LIBS) + +t_tdr_ps$(EXEEXT): $(t_tdr_ps_OBJECTS) $(t_tdr_ps_DEPENDENCIES) $(EXTRA_t_tdr_ps_DEPENDENCIES) + @rm -f t_tdr_ps$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_tdr_ps_OBJECTS) $(t_tdr_ps_LDADD) $(LIBS) + +t_unif$(EXEEXT): $(t_unif_OBJECTS) $(t_unif_DEPENDENCIES) $(EXTRA_t_unif_DEPENDENCIES) + @rm -f t_unif$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_unif_OBJECTS) $(t_unif_LDADD) $(LIBS) + +t_unur_error$(EXEEXT): $(t_unur_error_OBJECTS) $(t_unur_error_DEPENDENCIES) $(EXTRA_t_unur_error_DEPENDENCIES) + @rm -f t_unur_error$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_unur_error_OBJECTS) $(t_unur_error_LDADD) $(LIBS) + +t_unur_tests$(EXEEXT): $(t_unur_tests_OBJECTS) $(t_unur_tests_DEPENDENCIES) $(EXTRA_t_unur_tests_DEPENDENCIES) + @rm -f t_unur_tests$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_unur_tests_OBJECTS) $(t_unur_tests_LDADD) $(LIBS) + +t_urng$(EXEEXT): $(t_urng_OBJECTS) $(t_urng_DEPENDENCIES) $(EXTRA_t_urng_DEPENDENCIES) + @rm -f t_urng$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_urng_OBJECTS) $(t_urng_LDADD) $(LIBS) + +t_utdr$(EXEEXT): $(t_utdr_OBJECTS) $(t_utdr_DEPENDENCIES) $(EXTRA_t_utdr_DEPENDENCIES) + @rm -f t_utdr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_utdr_OBJECTS) $(t_utdr_LDADD) $(LIBS) + +t_util_matrix$(EXEEXT): $(t_util_matrix_OBJECTS) $(t_util_matrix_DEPENDENCIES) $(EXTRA_t_util_matrix_DEPENDENCIES) + @rm -f t_util_matrix$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_util_matrix_OBJECTS) $(t_util_matrix_LDADD) $(LIBS) + +t_vempk$(EXEEXT): $(t_vempk_OBJECTS) $(t_vempk_DEPENDENCIES) $(EXTRA_t_vempk_DEPENDENCIES) + @rm -f t_vempk$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_vempk_OBJECTS) $(t_vempk_LDADD) $(LIBS) + +t_vnrou$(EXEEXT): $(t_vnrou_OBJECTS) $(t_vnrou_DEPENDENCIES) $(EXTRA_t_vnrou_DEPENDENCIES) + @rm -f t_vnrou$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_vnrou_OBJECTS) $(t_vnrou_LDADD) $(LIBS) + +t_x_gen$(EXEEXT): $(t_x_gen_OBJECTS) $(t_x_gen_DEPENDENCIES) $(EXTRA_t_x_gen_DEPENDENCIES) + @rm -f t_x_gen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_x_gen_OBJECTS) $(t_x_gen_LDADD) $(LIBS) + +test_StdDistr$(EXEEXT): $(test_StdDistr_OBJECTS) $(test_StdDistr_DEPENDENCIES) $(EXTRA_test_StdDistr_DEPENDENCIES) + @rm -f test_StdDistr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_StdDistr_OBJECTS) $(test_StdDistr_LDADD) $(LIBS) + +test_functionparser$(EXEEXT): $(test_functionparser_OBJECTS) $(test_functionparser_DEPENDENCIES) $(EXTRA_test_functionparser_DEPENDENCIES) + @rm -f test_functionparser$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_functionparser_OBJECTS) $(test_functionparser_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/t_arou.Po # am--include-marker +include ./$(DEPDIR)/t_ars.Po # am--include-marker +include ./$(DEPDIR)/t_auto.Po # am--include-marker +include ./$(DEPDIR)/t_cext.Po # am--include-marker +include ./$(DEPDIR)/t_cstd.Po # am--include-marker +include ./$(DEPDIR)/t_dari.Po # am--include-marker +include ./$(DEPDIR)/t_dau.Po # am--include-marker +include ./$(DEPDIR)/t_deprecated_tdrgw.Po # am--include-marker +include ./$(DEPDIR)/t_deprecated_vmt.Po # am--include-marker +include ./$(DEPDIR)/t_dext.Po # am--include-marker +include ./$(DEPDIR)/t_dgt.Po # am--include-marker +include ./$(DEPDIR)/t_distr.Po # am--include-marker +include ./$(DEPDIR)/t_distr_cemp.Po # am--include-marker +include ./$(DEPDIR)/t_distr_condi.Po # am--include-marker +include ./$(DEPDIR)/t_distr_cont.Po # am--include-marker +include ./$(DEPDIR)/t_distr_corder.Po # am--include-marker +include ./$(DEPDIR)/t_distr_cvec.Po # am--include-marker +include ./$(DEPDIR)/t_distr_cvemp.Po # am--include-marker +include ./$(DEPDIR)/t_distr_cxtrans.Po # am--include-marker +include ./$(DEPDIR)/t_distr_discr.Po # am--include-marker +include ./$(DEPDIR)/t_distr_matr.Po # am--include-marker +include ./$(DEPDIR)/t_dsrou.Po # am--include-marker +include ./$(DEPDIR)/t_dss.Po # am--include-marker +include ./$(DEPDIR)/t_dstd.Po # am--include-marker +include ./$(DEPDIR)/t_empk.Po # am--include-marker +include ./$(DEPDIR)/t_empl.Po # am--include-marker +include ./$(DEPDIR)/t_gibbs.Po # am--include-marker +include ./$(DEPDIR)/t_hinv.Po # am--include-marker +include ./$(DEPDIR)/t_hist.Po # am--include-marker +include ./$(DEPDIR)/t_hitro.Po # am--include-marker +include ./$(DEPDIR)/t_hrb.Po # am--include-marker +include ./$(DEPDIR)/t_hrd.Po # am--include-marker +include ./$(DEPDIR)/t_hri.Po # am--include-marker +include ./$(DEPDIR)/t_info.Po # am--include-marker +include ./$(DEPDIR)/t_itdr.Po # am--include-marker +include ./$(DEPDIR)/t_mcorr.Po # am--include-marker +include ./$(DEPDIR)/t_mixt.Po # am--include-marker +include ./$(DEPDIR)/t_mvstd.Po # am--include-marker +include ./$(DEPDIR)/t_mvtdr.Po # am--include-marker +include ./$(DEPDIR)/t_ninv.Po # am--include-marker +include ./$(DEPDIR)/t_norta.Po # am--include-marker +include ./$(DEPDIR)/t_nrou.Po # am--include-marker +include ./$(DEPDIR)/t_pinv.Po # am--include-marker +include ./$(DEPDIR)/t_srou.Po # am--include-marker +include ./$(DEPDIR)/t_ssr.Po # am--include-marker +include ./$(DEPDIR)/t_stringparser.Po # am--include-marker +include ./$(DEPDIR)/t_tabl.Po # am--include-marker +include ./$(DEPDIR)/t_tdr.Po # am--include-marker +include ./$(DEPDIR)/t_tdr_gw.Po # am--include-marker +include ./$(DEPDIR)/t_tdr_ia.Po # am--include-marker +include ./$(DEPDIR)/t_tdr_ps.Po # am--include-marker +include ./$(DEPDIR)/t_unif.Po # am--include-marker +include ./$(DEPDIR)/t_unur_error.Po # am--include-marker +include ./$(DEPDIR)/t_unur_tests.Po # am--include-marker +include ./$(DEPDIR)/t_urng.Po # am--include-marker +include ./$(DEPDIR)/t_utdr.Po # am--include-marker +include ./$(DEPDIR)/t_util_matrix.Po # am--include-marker +include ./$(DEPDIR)/t_vempk.Po # am--include-marker +include ./$(DEPDIR)/t_vnrou.Po # am--include-marker +include ./$(DEPDIR)/t_x_gen.Po # am--include-marker +include ./$(DEPDIR)/test_StdDistr.Po # am--include-marker +include ./$(DEPDIR)/test_functionparser.Po # am--include-marker +include ./$(DEPDIR)/testcounter.Plo # am--include-marker +include ./$(DEPDIR)/testroutines.Plo # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ $< + +.c.obj: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: + $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +# $(AM_V_CC)source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: $(check_PROGRAMS) + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_PROGRAMS) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +t_x_gen.log: t_x_gen$(EXEEXT) + @p='t_x_gen$(EXEEXT)'; \ + b='t_x_gen'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_unur_tests.log: t_unur_tests$(EXEEXT) + @p='t_unur_tests$(EXEEXT)'; \ + b='t_unur_tests'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_unur_error.log: t_unur_error$(EXEEXT) + @p='t_unur_error$(EXEEXT)'; \ + b='t_unur_error'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_urng.log: t_urng$(EXEEXT) + @p='t_urng$(EXEEXT)'; \ + b='t_urng'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr.log: t_distr$(EXEEXT) + @p='t_distr$(EXEEXT)'; \ + b='t_distr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr_cemp.log: t_distr_cemp$(EXEEXT) + @p='t_distr_cemp$(EXEEXT)'; \ + b='t_distr_cemp'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr_cont.log: t_distr_cont$(EXEEXT) + @p='t_distr_cont$(EXEEXT)'; \ + b='t_distr_cont'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr_corder.log: t_distr_corder$(EXEEXT) + @p='t_distr_corder$(EXEEXT)'; \ + b='t_distr_corder'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr_cvec.log: t_distr_cvec$(EXEEXT) + @p='t_distr_cvec$(EXEEXT)'; \ + b='t_distr_cvec'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr_condi.log: t_distr_condi$(EXEEXT) + @p='t_distr_condi$(EXEEXT)'; \ + b='t_distr_condi'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr_cvemp.log: t_distr_cvemp$(EXEEXT) + @p='t_distr_cvemp$(EXEEXT)'; \ + b='t_distr_cvemp'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr_cxtrans.log: t_distr_cxtrans$(EXEEXT) + @p='t_distr_cxtrans$(EXEEXT)'; \ + b='t_distr_cxtrans'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr_discr.log: t_distr_discr$(EXEEXT) + @p='t_distr_discr$(EXEEXT)'; \ + b='t_distr_discr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr_matr.log: t_distr_matr$(EXEEXT) + @p='t_distr_matr$(EXEEXT)'; \ + b='t_distr_matr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_auto.log: t_auto$(EXEEXT) + @p='t_auto$(EXEEXT)'; \ + b='t_auto'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_arou.log: t_arou$(EXEEXT) + @p='t_arou$(EXEEXT)'; \ + b='t_arou'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_ars.log: t_ars$(EXEEXT) + @p='t_ars$(EXEEXT)'; \ + b='t_ars'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_cext.log: t_cext$(EXEEXT) + @p='t_cext$(EXEEXT)'; \ + b='t_cext'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_cstd.log: t_cstd$(EXEEXT) + @p='t_cstd$(EXEEXT)'; \ + b='t_cstd'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_dari.log: t_dari$(EXEEXT) + @p='t_dari$(EXEEXT)'; \ + b='t_dari'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_dau.log: t_dau$(EXEEXT) + @p='t_dau$(EXEEXT)'; \ + b='t_dau'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_dext.log: t_dext$(EXEEXT) + @p='t_dext$(EXEEXT)'; \ + b='t_dext'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_dgt.log: t_dgt$(EXEEXT) + @p='t_dgt$(EXEEXT)'; \ + b='t_dgt'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_dsrou.log: t_dsrou$(EXEEXT) + @p='t_dsrou$(EXEEXT)'; \ + b='t_dsrou'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_dss.log: t_dss$(EXEEXT) + @p='t_dss$(EXEEXT)'; \ + b='t_dss'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_dstd.log: t_dstd$(EXEEXT) + @p='t_dstd$(EXEEXT)'; \ + b='t_dstd'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_empk.log: t_empk$(EXEEXT) + @p='t_empk$(EXEEXT)'; \ + b='t_empk'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_empl.log: t_empl$(EXEEXT) + @p='t_empl$(EXEEXT)'; \ + b='t_empl'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_gibbs.log: t_gibbs$(EXEEXT) + @p='t_gibbs$(EXEEXT)'; \ + b='t_gibbs'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_hinv.log: t_hinv$(EXEEXT) + @p='t_hinv$(EXEEXT)'; \ + b='t_hinv'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_hist.log: t_hist$(EXEEXT) + @p='t_hist$(EXEEXT)'; \ + b='t_hist'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_hitro.log: t_hitro$(EXEEXT) + @p='t_hitro$(EXEEXT)'; \ + b='t_hitro'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_hrb.log: t_hrb$(EXEEXT) + @p='t_hrb$(EXEEXT)'; \ + b='t_hrb'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_hrd.log: t_hrd$(EXEEXT) + @p='t_hrd$(EXEEXT)'; \ + b='t_hrd'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_hri.log: t_hri$(EXEEXT) + @p='t_hri$(EXEEXT)'; \ + b='t_hri'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_itdr.log: t_itdr$(EXEEXT) + @p='t_itdr$(EXEEXT)'; \ + b='t_itdr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_mcorr.log: t_mcorr$(EXEEXT) + @p='t_mcorr$(EXEEXT)'; \ + b='t_mcorr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_mixt.log: t_mixt$(EXEEXT) + @p='t_mixt$(EXEEXT)'; \ + b='t_mixt'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_mvstd.log: t_mvstd$(EXEEXT) + @p='t_mvstd$(EXEEXT)'; \ + b='t_mvstd'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_mvtdr.log: t_mvtdr$(EXEEXT) + @p='t_mvtdr$(EXEEXT)'; \ + b='t_mvtdr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_ninv.log: t_ninv$(EXEEXT) + @p='t_ninv$(EXEEXT)'; \ + b='t_ninv'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_norta.log: t_norta$(EXEEXT) + @p='t_norta$(EXEEXT)'; \ + b='t_norta'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_nrou.log: t_nrou$(EXEEXT) + @p='t_nrou$(EXEEXT)'; \ + b='t_nrou'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_pinv.log: t_pinv$(EXEEXT) + @p='t_pinv$(EXEEXT)'; \ + b='t_pinv'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_srou.log: t_srou$(EXEEXT) + @p='t_srou$(EXEEXT)'; \ + b='t_srou'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_ssr.log: t_ssr$(EXEEXT) + @p='t_ssr$(EXEEXT)'; \ + b='t_ssr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_tabl.log: t_tabl$(EXEEXT) + @p='t_tabl$(EXEEXT)'; \ + b='t_tabl'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_tdr.log: t_tdr$(EXEEXT) + @p='t_tdr$(EXEEXT)'; \ + b='t_tdr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_tdr_gw.log: t_tdr_gw$(EXEEXT) + @p='t_tdr_gw$(EXEEXT)'; \ + b='t_tdr_gw'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_tdr_ps.log: t_tdr_ps$(EXEEXT) + @p='t_tdr_ps$(EXEEXT)'; \ + b='t_tdr_ps'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_tdr_ia.log: t_tdr_ia$(EXEEXT) + @p='t_tdr_ia$(EXEEXT)'; \ + b='t_tdr_ia'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_unif.log: t_unif$(EXEEXT) + @p='t_unif$(EXEEXT)'; \ + b='t_unif'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_utdr.log: t_utdr$(EXEEXT) + @p='t_utdr$(EXEEXT)'; \ + b='t_utdr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_vempk.log: t_vempk$(EXEEXT) + @p='t_vempk$(EXEEXT)'; \ + b='t_vempk'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_vnrou.log: t_vnrou$(EXEEXT) + @p='t_vnrou$(EXEEXT)'; \ + b='t_vnrou'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_stringparser.log: t_stringparser$(EXEEXT) + @p='t_stringparser$(EXEEXT)'; \ + b='t_stringparser'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_info.log: t_info$(EXEEXT) + @p='t_info$(EXEEXT)'; \ + b='t_info'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_util_matrix.log: t_util_matrix$(EXEEXT) + @p='t_util_matrix$(EXEEXT)'; \ + b='t_util_matrix'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_deprecated_vmt.log: t_deprecated_vmt$(EXEEXT) + @p='t_deprecated_vmt$(EXEEXT)'; \ + b='t_deprecated_vmt'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_deprecated_tdrgw.log: t_deprecated_tdrgw$(EXEEXT) + @p='t_deprecated_tdrgw$(EXEEXT)'; \ + b='t_deprecated_tdrgw'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_StdDistr.log: test_StdDistr$(EXEEXT) + @p='test_StdDistr$(EXEEXT)'; \ + b='test_StdDistr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_functionparser.log: test_functionparser$(EXEEXT) + @p='test_functionparser$(EXEEXT)'; \ + b='test_functionparser'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +#.test$(EXEEXT).log: +# @p='$<'; \ +# $(am__set_b); \ +# $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +# --log-file $$b.log --trs-file $$b.trs \ +# $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +# "$$tst" $(AM_TESTS_FD_REDIRECT) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-recursive +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -f ./$(DEPDIR)/t_arou.Po + -rm -f ./$(DEPDIR)/t_ars.Po + -rm -f ./$(DEPDIR)/t_auto.Po + -rm -f ./$(DEPDIR)/t_cext.Po + -rm -f ./$(DEPDIR)/t_cstd.Po + -rm -f ./$(DEPDIR)/t_dari.Po + -rm -f ./$(DEPDIR)/t_dau.Po + -rm -f ./$(DEPDIR)/t_deprecated_tdrgw.Po + -rm -f ./$(DEPDIR)/t_deprecated_vmt.Po + -rm -f ./$(DEPDIR)/t_dext.Po + -rm -f ./$(DEPDIR)/t_dgt.Po + -rm -f ./$(DEPDIR)/t_distr.Po + -rm -f ./$(DEPDIR)/t_distr_cemp.Po + -rm -f ./$(DEPDIR)/t_distr_condi.Po + -rm -f ./$(DEPDIR)/t_distr_cont.Po + -rm -f ./$(DEPDIR)/t_distr_corder.Po + -rm -f ./$(DEPDIR)/t_distr_cvec.Po + -rm -f ./$(DEPDIR)/t_distr_cvemp.Po + -rm -f ./$(DEPDIR)/t_distr_cxtrans.Po + -rm -f ./$(DEPDIR)/t_distr_discr.Po + -rm -f ./$(DEPDIR)/t_distr_matr.Po + -rm -f ./$(DEPDIR)/t_dsrou.Po + -rm -f ./$(DEPDIR)/t_dss.Po + -rm -f ./$(DEPDIR)/t_dstd.Po + -rm -f ./$(DEPDIR)/t_empk.Po + -rm -f ./$(DEPDIR)/t_empl.Po + -rm -f ./$(DEPDIR)/t_gibbs.Po + -rm -f ./$(DEPDIR)/t_hinv.Po + -rm -f ./$(DEPDIR)/t_hist.Po + -rm -f ./$(DEPDIR)/t_hitro.Po + -rm -f ./$(DEPDIR)/t_hrb.Po + -rm -f ./$(DEPDIR)/t_hrd.Po + -rm -f ./$(DEPDIR)/t_hri.Po + -rm -f ./$(DEPDIR)/t_info.Po + -rm -f ./$(DEPDIR)/t_itdr.Po + -rm -f ./$(DEPDIR)/t_mcorr.Po + -rm -f ./$(DEPDIR)/t_mixt.Po + -rm -f ./$(DEPDIR)/t_mvstd.Po + -rm -f ./$(DEPDIR)/t_mvtdr.Po + -rm -f ./$(DEPDIR)/t_ninv.Po + -rm -f ./$(DEPDIR)/t_norta.Po + -rm -f ./$(DEPDIR)/t_nrou.Po + -rm -f ./$(DEPDIR)/t_pinv.Po + -rm -f ./$(DEPDIR)/t_srou.Po + -rm -f ./$(DEPDIR)/t_ssr.Po + -rm -f ./$(DEPDIR)/t_stringparser.Po + -rm -f ./$(DEPDIR)/t_tabl.Po + -rm -f ./$(DEPDIR)/t_tdr.Po + -rm -f ./$(DEPDIR)/t_tdr_gw.Po + -rm -f ./$(DEPDIR)/t_tdr_ia.Po + -rm -f ./$(DEPDIR)/t_tdr_ps.Po + -rm -f ./$(DEPDIR)/t_unif.Po + -rm -f ./$(DEPDIR)/t_unur_error.Po + -rm -f ./$(DEPDIR)/t_unur_tests.Po + -rm -f ./$(DEPDIR)/t_urng.Po + -rm -f ./$(DEPDIR)/t_utdr.Po + -rm -f ./$(DEPDIR)/t_util_matrix.Po + -rm -f ./$(DEPDIR)/t_vempk.Po + -rm -f ./$(DEPDIR)/t_vnrou.Po + -rm -f ./$(DEPDIR)/t_x_gen.Po + -rm -f ./$(DEPDIR)/test_StdDistr.Po + -rm -f ./$(DEPDIR)/test_functionparser.Po + -rm -f ./$(DEPDIR)/testcounter.Plo + -rm -f ./$(DEPDIR)/testroutines.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f ./$(DEPDIR)/t_arou.Po + -rm -f ./$(DEPDIR)/t_ars.Po + -rm -f ./$(DEPDIR)/t_auto.Po + -rm -f ./$(DEPDIR)/t_cext.Po + -rm -f ./$(DEPDIR)/t_cstd.Po + -rm -f ./$(DEPDIR)/t_dari.Po + -rm -f ./$(DEPDIR)/t_dau.Po + -rm -f ./$(DEPDIR)/t_deprecated_tdrgw.Po + -rm -f ./$(DEPDIR)/t_deprecated_vmt.Po + -rm -f ./$(DEPDIR)/t_dext.Po + -rm -f ./$(DEPDIR)/t_dgt.Po + -rm -f ./$(DEPDIR)/t_distr.Po + -rm -f ./$(DEPDIR)/t_distr_cemp.Po + -rm -f ./$(DEPDIR)/t_distr_condi.Po + -rm -f ./$(DEPDIR)/t_distr_cont.Po + -rm -f ./$(DEPDIR)/t_distr_corder.Po + -rm -f ./$(DEPDIR)/t_distr_cvec.Po + -rm -f ./$(DEPDIR)/t_distr_cvemp.Po + -rm -f ./$(DEPDIR)/t_distr_cxtrans.Po + -rm -f ./$(DEPDIR)/t_distr_discr.Po + -rm -f ./$(DEPDIR)/t_distr_matr.Po + -rm -f ./$(DEPDIR)/t_dsrou.Po + -rm -f ./$(DEPDIR)/t_dss.Po + -rm -f ./$(DEPDIR)/t_dstd.Po + -rm -f ./$(DEPDIR)/t_empk.Po + -rm -f ./$(DEPDIR)/t_empl.Po + -rm -f ./$(DEPDIR)/t_gibbs.Po + -rm -f ./$(DEPDIR)/t_hinv.Po + -rm -f ./$(DEPDIR)/t_hist.Po + -rm -f ./$(DEPDIR)/t_hitro.Po + -rm -f ./$(DEPDIR)/t_hrb.Po + -rm -f ./$(DEPDIR)/t_hrd.Po + -rm -f ./$(DEPDIR)/t_hri.Po + -rm -f ./$(DEPDIR)/t_info.Po + -rm -f ./$(DEPDIR)/t_itdr.Po + -rm -f ./$(DEPDIR)/t_mcorr.Po + -rm -f ./$(DEPDIR)/t_mixt.Po + -rm -f ./$(DEPDIR)/t_mvstd.Po + -rm -f ./$(DEPDIR)/t_mvtdr.Po + -rm -f ./$(DEPDIR)/t_ninv.Po + -rm -f ./$(DEPDIR)/t_norta.Po + -rm -f ./$(DEPDIR)/t_nrou.Po + -rm -f ./$(DEPDIR)/t_pinv.Po + -rm -f ./$(DEPDIR)/t_srou.Po + -rm -f ./$(DEPDIR)/t_ssr.Po + -rm -f ./$(DEPDIR)/t_stringparser.Po + -rm -f ./$(DEPDIR)/t_tabl.Po + -rm -f ./$(DEPDIR)/t_tdr.Po + -rm -f ./$(DEPDIR)/t_tdr_gw.Po + -rm -f ./$(DEPDIR)/t_tdr_ia.Po + -rm -f ./$(DEPDIR)/t_tdr_ps.Po + -rm -f ./$(DEPDIR)/t_unif.Po + -rm -f ./$(DEPDIR)/t_unur_error.Po + -rm -f ./$(DEPDIR)/t_unur_tests.Po + -rm -f ./$(DEPDIR)/t_urng.Po + -rm -f ./$(DEPDIR)/t_utdr.Po + -rm -f ./$(DEPDIR)/t_util_matrix.Po + -rm -f ./$(DEPDIR)/t_vempk.Po + -rm -f ./$(DEPDIR)/t_vnrou.Po + -rm -f ./$(DEPDIR)/t_x_gen.Po + -rm -f ./$(DEPDIR)/test_StdDistr.Po + -rm -f ./$(DEPDIR)/test_functionparser.Po + -rm -f ./$(DEPDIR)/testcounter.Plo + -rm -f ./$(DEPDIR)/testroutines.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) check-am install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool \ + clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am recheck tags tags-am \ + uninstall uninstall-am + +.PRECIOUS: Makefile + + +#test_StdDistr.o: t_StdDistr.data + +#t_StdDistr.data: test_StdDistr.m +# math -initfile $(top_srcdir)/tests/test_StdDistr.m + +#test_functionparser.o: t_functionparser.data + +#t_functionparser.data: test_functionparser.m +# math -initfile $(top_srcdir)/tests/test_functionparser.m +.conf.c: + ./make_test_files.pl $(top_srcdir) $< > $@ + +t_*.c: make_test_files.pl + +# run tests with valgrind +#valgrind: $(check_PROGRAMS) +# @list='$(check_PROGRAMS)'; for p in $$list; do \ +# $(top_srcdir)/scripts/run_valgrind.sh ./$$p; \ +# done + +# run tests in fullcheck mode +fullcheck: + UNURANFULLCHECK=true $(MAKE) check + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/tests/Makefile.am b/vendor/unuran-1.11.0/tests/Makefile.am new file mode 100644 index 0000000..84a1cb6 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/Makefile.am @@ -0,0 +1,223 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = parallel-tests color-tests + +SUBDIRS = testdistributions . + +AM_CPPFLAGS = \ + $(UNURAN_SUPPORTS_GSL) \ + $(UNURAN_SUPPORTS_PRNG) \ + $(UNURAN_SUPPORTS_RNGSTREAM) \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/tests + +noinst_LTLIBRARIES = libtestroutines.la +libtestroutines_la_SOURCES = testroutines.c testcounter.c + +LDADD = \ + libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la + +# Special files for tests with Mathematica(TM) +if HAVE_MATHEMATICA +MATHEMATICA_PROGS = test_StdDistr test_functionparser +else +MATHEMATICA_PROGS = +endif + +# Files that contain deprecated routines +if ENABLE_DEPRECATED +DEPRECATED_TESTS = t_deprecated_vmt t_deprecated_tdrgw +else +DEPRECATED_TESTS = +endif + +check_PROGRAMS = \ + t_x_gen \ + t_unur_tests \ + t_unur_error \ + t_urng \ + t_distr \ + t_distr_cemp \ + t_distr_cont \ + t_distr_corder \ + t_distr_cvec \ + t_distr_condi \ + t_distr_cvemp \ + t_distr_cxtrans \ + t_distr_discr \ + t_distr_matr \ + t_auto \ + t_arou \ + t_ars \ + t_cext \ + t_cstd \ + t_dari \ + t_dau \ + t_dext \ + t_dgt \ + t_dsrou \ + t_dss \ + t_dstd \ + t_empk \ + t_empl \ + t_gibbs \ + t_hinv \ + t_hist \ + t_hitro \ + t_hrb \ + t_hrd \ + t_hri \ + t_itdr \ + t_mcorr \ + t_mixt \ + t_mvstd \ + t_mvtdr \ + t_ninv \ + t_norta \ + t_nrou \ + t_pinv \ + t_srou \ + t_ssr \ + t_tabl \ + t_tdr t_tdr_gw t_tdr_ps t_tdr_ia \ + t_unif \ + t_utdr \ + t_vempk \ + t_vnrou \ + t_stringparser \ + t_info \ + t_util_matrix \ + $(DEPRECATED_TESTS) \ + $(MATHEMATICA_PROGS) + +TESTS = $(check_PROGRAMS) + +# These tests fail until we fix some bugs +#XFAIL_TESTS = + +noinst_HEADERS = \ + testunuran.h + +EXTRA_DIST = \ + test_StdDistr.m \ + test_functionparser.m \ + make_test_files.pl \ + README.conf \ + t_info.conf \ + t_stringparser.conf \ + t_x_gen.conf \ + t_unur_tests.conf \ + t_unur_error.conf \ + t_urng.conf \ + t_util_matrix.conf \ + t_distr.conf \ + t_distr_cemp.conf \ + t_distr_cont.conf \ + t_distr_corder.conf \ + t_distr_cvec.conf \ + t_distr_condi.conf \ + t_distr_cvemp.conf \ + t_distr_cxtrans.conf \ + t_distr_discr.conf \ + t_distr_matr.conf \ + t_auto.conf \ + t_arou.conf \ + t_ars.conf \ + t_cext.conf \ + t_cstd.conf \ + t_dari.conf \ + t_dau.conf \ + t_dext.conf \ + t_dgt.conf \ + t_dsrou.conf \ + t_dss.conf \ + t_dstd.conf \ + t_empk.conf \ + t_empl.conf \ + t_gibbs.conf \ + t_hinv.conf \ + t_hinv.conf \ + t_hist.conf \ + t_hrb.conf \ + t_hrd.conf \ + t_hri.conf \ + t_itdr.conf \ + t_mcorr.conf \ + t_mvstd.conf \ + t_ninv.conf \ + t_norta.conf \ + t_nrou.conf \ + t_pinv.conf \ + t_srou.conf \ + t_ssr.conf \ + t_tabl.conf \ + t_tdr.conf t_tdr_gw.conf t_tdr_ps.conf t_tdr_ia.conf \ + t_unif.conf \ + t_utdr.conf \ + t_vempk.conf \ + t_vnrou.conf \ +\ + t_deprecated_vmt.conf + + +if HAVE_MATHEMATICA + +# Compare results of CDF, PDF, and dPDF of standard distributions +# and results of function parser to those produced with +# Mathematica(TM) ... + +test_StdDistr_SOURCES = test_StdDistr.c +test_StdDistr_DEPENDENCIES = t_StdDistr.data + +test_StdDistr.o: t_StdDistr.data + +t_StdDistr.data: test_StdDistr.m + math -initfile $(top_srcdir)/tests/test_StdDistr.m + +test_functionparser_SOURCES = test_functionparser.c +test_functionparser_DEPENDENCIES = t_functionparser.data + +test_functionparser.o: t_functionparser.data + +t_functionparser.data: test_functionparser.m + math -initfile $(top_srcdir)/tests/test_functionparser.m + +endif + + +# Generate C sources for tests +SUFFIXES = .c +.conf.c: + ./make_test_files.pl $(top_srcdir) $< > $@ + +t_*.c: make_test_files.pl + +# run tests with valgrind +if HAVE_VALGRIND +valgrind: $(check_PROGRAMS) + @list='$(check_PROGRAMS)'; for p in $$list; do \ + $(top_srcdir)/scripts/run_valgrind.sh ./$$p; \ + done +endif + +# run tests in fullcheck mode +fullcheck: + UNURANFULLCHECK=true $(MAKE) check + +# clean log files and backup files +CLEANFILES = \ + *.log \ + valgrind-* \ + unuran-valgrind-* \ + *~ + +# clean generated files +DISTCLEANFILES = \ + rm -f t_*.data + +# clean generated files +MAINTAINERCLEANFILES = \ + rm -f t_*.c \ + Makefile.in diff --git a/vendor/unuran-1.11.0/tests/Makefile.in b/vendor/unuran-1.11.0/tests/Makefile.in new file mode 100644 index 0000000..db5f851 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/Makefile.in @@ -0,0 +1,2577 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +check_PROGRAMS = t_x_gen$(EXEEXT) t_unur_tests$(EXEEXT) \ + t_unur_error$(EXEEXT) t_urng$(EXEEXT) t_distr$(EXEEXT) \ + t_distr_cemp$(EXEEXT) t_distr_cont$(EXEEXT) \ + t_distr_corder$(EXEEXT) t_distr_cvec$(EXEEXT) \ + t_distr_condi$(EXEEXT) t_distr_cvemp$(EXEEXT) \ + t_distr_cxtrans$(EXEEXT) t_distr_discr$(EXEEXT) \ + t_distr_matr$(EXEEXT) t_auto$(EXEEXT) t_arou$(EXEEXT) \ + t_ars$(EXEEXT) t_cext$(EXEEXT) t_cstd$(EXEEXT) t_dari$(EXEEXT) \ + t_dau$(EXEEXT) t_dext$(EXEEXT) t_dgt$(EXEEXT) t_dsrou$(EXEEXT) \ + t_dss$(EXEEXT) t_dstd$(EXEEXT) t_empk$(EXEEXT) t_empl$(EXEEXT) \ + t_gibbs$(EXEEXT) t_hinv$(EXEEXT) t_hist$(EXEEXT) \ + t_hitro$(EXEEXT) t_hrb$(EXEEXT) t_hrd$(EXEEXT) t_hri$(EXEEXT) \ + t_itdr$(EXEEXT) t_mcorr$(EXEEXT) t_mixt$(EXEEXT) \ + t_mvstd$(EXEEXT) t_mvtdr$(EXEEXT) t_ninv$(EXEEXT) \ + t_norta$(EXEEXT) t_nrou$(EXEEXT) t_pinv$(EXEEXT) \ + t_srou$(EXEEXT) t_ssr$(EXEEXT) t_tabl$(EXEEXT) t_tdr$(EXEEXT) \ + t_tdr_gw$(EXEEXT) t_tdr_ps$(EXEEXT) t_tdr_ia$(EXEEXT) \ + t_unif$(EXEEXT) t_utdr$(EXEEXT) t_vempk$(EXEEXT) \ + t_vnrou$(EXEEXT) t_stringparser$(EXEEXT) t_info$(EXEEXT) \ + t_util_matrix$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) +@HAVE_MATHEMATICA_FALSE@test_StdDistr_DEPENDENCIES = \ +@HAVE_MATHEMATICA_FALSE@ libtestroutines.la \ +@HAVE_MATHEMATICA_FALSE@ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ +@HAVE_MATHEMATICA_FALSE@ $(top_builddir)/src/libunuran.la +@HAVE_MATHEMATICA_FALSE@test_functionparser_DEPENDENCIES = \ +@HAVE_MATHEMATICA_FALSE@ libtestroutines.la \ +@HAVE_MATHEMATICA_FALSE@ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ +@HAVE_MATHEMATICA_FALSE@ $(top_builddir)/src/libunuran.la +subdir = tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +@ENABLE_DEPRECATED_TRUE@am__EXEEXT_1 = t_deprecated_vmt$(EXEEXT) \ +@ENABLE_DEPRECATED_TRUE@ t_deprecated_tdrgw$(EXEEXT) +@HAVE_MATHEMATICA_TRUE@am__EXEEXT_2 = test_StdDistr$(EXEEXT) \ +@HAVE_MATHEMATICA_TRUE@ test_functionparser$(EXEEXT) +LTLIBRARIES = $(noinst_LTLIBRARIES) +libtestroutines_la_LIBADD = +am_libtestroutines_la_OBJECTS = testroutines.lo testcounter.lo +libtestroutines_la_OBJECTS = $(am_libtestroutines_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +t_arou_SOURCES = t_arou.c +t_arou_OBJECTS = t_arou.$(OBJEXT) +t_arou_LDADD = $(LDADD) +t_arou_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_ars_SOURCES = t_ars.c +t_ars_OBJECTS = t_ars.$(OBJEXT) +t_ars_LDADD = $(LDADD) +t_ars_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_auto_SOURCES = t_auto.c +t_auto_OBJECTS = t_auto.$(OBJEXT) +t_auto_LDADD = $(LDADD) +t_auto_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_cext_SOURCES = t_cext.c +t_cext_OBJECTS = t_cext.$(OBJEXT) +t_cext_LDADD = $(LDADD) +t_cext_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_cstd_SOURCES = t_cstd.c +t_cstd_OBJECTS = t_cstd.$(OBJEXT) +t_cstd_LDADD = $(LDADD) +t_cstd_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_dari_SOURCES = t_dari.c +t_dari_OBJECTS = t_dari.$(OBJEXT) +t_dari_LDADD = $(LDADD) +t_dari_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_dau_SOURCES = t_dau.c +t_dau_OBJECTS = t_dau.$(OBJEXT) +t_dau_LDADD = $(LDADD) +t_dau_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_deprecated_tdrgw_SOURCES = t_deprecated_tdrgw.c +t_deprecated_tdrgw_OBJECTS = t_deprecated_tdrgw.$(OBJEXT) +t_deprecated_tdrgw_LDADD = $(LDADD) +t_deprecated_tdrgw_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_deprecated_vmt_SOURCES = t_deprecated_vmt.c +t_deprecated_vmt_OBJECTS = t_deprecated_vmt.$(OBJEXT) +t_deprecated_vmt_LDADD = $(LDADD) +t_deprecated_vmt_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_dext_SOURCES = t_dext.c +t_dext_OBJECTS = t_dext.$(OBJEXT) +t_dext_LDADD = $(LDADD) +t_dext_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_dgt_SOURCES = t_dgt.c +t_dgt_OBJECTS = t_dgt.$(OBJEXT) +t_dgt_LDADD = $(LDADD) +t_dgt_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_SOURCES = t_distr.c +t_distr_OBJECTS = t_distr.$(OBJEXT) +t_distr_LDADD = $(LDADD) +t_distr_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_cemp_SOURCES = t_distr_cemp.c +t_distr_cemp_OBJECTS = t_distr_cemp.$(OBJEXT) +t_distr_cemp_LDADD = $(LDADD) +t_distr_cemp_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_condi_SOURCES = t_distr_condi.c +t_distr_condi_OBJECTS = t_distr_condi.$(OBJEXT) +t_distr_condi_LDADD = $(LDADD) +t_distr_condi_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_cont_SOURCES = t_distr_cont.c +t_distr_cont_OBJECTS = t_distr_cont.$(OBJEXT) +t_distr_cont_LDADD = $(LDADD) +t_distr_cont_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_corder_SOURCES = t_distr_corder.c +t_distr_corder_OBJECTS = t_distr_corder.$(OBJEXT) +t_distr_corder_LDADD = $(LDADD) +t_distr_corder_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_cvec_SOURCES = t_distr_cvec.c +t_distr_cvec_OBJECTS = t_distr_cvec.$(OBJEXT) +t_distr_cvec_LDADD = $(LDADD) +t_distr_cvec_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_cvemp_SOURCES = t_distr_cvemp.c +t_distr_cvemp_OBJECTS = t_distr_cvemp.$(OBJEXT) +t_distr_cvemp_LDADD = $(LDADD) +t_distr_cvemp_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_cxtrans_SOURCES = t_distr_cxtrans.c +t_distr_cxtrans_OBJECTS = t_distr_cxtrans.$(OBJEXT) +t_distr_cxtrans_LDADD = $(LDADD) +t_distr_cxtrans_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_discr_SOURCES = t_distr_discr.c +t_distr_discr_OBJECTS = t_distr_discr.$(OBJEXT) +t_distr_discr_LDADD = $(LDADD) +t_distr_discr_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_distr_matr_SOURCES = t_distr_matr.c +t_distr_matr_OBJECTS = t_distr_matr.$(OBJEXT) +t_distr_matr_LDADD = $(LDADD) +t_distr_matr_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_dsrou_SOURCES = t_dsrou.c +t_dsrou_OBJECTS = t_dsrou.$(OBJEXT) +t_dsrou_LDADD = $(LDADD) +t_dsrou_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_dss_SOURCES = t_dss.c +t_dss_OBJECTS = t_dss.$(OBJEXT) +t_dss_LDADD = $(LDADD) +t_dss_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_dstd_SOURCES = t_dstd.c +t_dstd_OBJECTS = t_dstd.$(OBJEXT) +t_dstd_LDADD = $(LDADD) +t_dstd_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_empk_SOURCES = t_empk.c +t_empk_OBJECTS = t_empk.$(OBJEXT) +t_empk_LDADD = $(LDADD) +t_empk_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_empl_SOURCES = t_empl.c +t_empl_OBJECTS = t_empl.$(OBJEXT) +t_empl_LDADD = $(LDADD) +t_empl_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_gibbs_SOURCES = t_gibbs.c +t_gibbs_OBJECTS = t_gibbs.$(OBJEXT) +t_gibbs_LDADD = $(LDADD) +t_gibbs_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_hinv_SOURCES = t_hinv.c +t_hinv_OBJECTS = t_hinv.$(OBJEXT) +t_hinv_LDADD = $(LDADD) +t_hinv_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_hist_SOURCES = t_hist.c +t_hist_OBJECTS = t_hist.$(OBJEXT) +t_hist_LDADD = $(LDADD) +t_hist_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_hitro_SOURCES = t_hitro.c +t_hitro_OBJECTS = t_hitro.$(OBJEXT) +t_hitro_LDADD = $(LDADD) +t_hitro_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_hrb_SOURCES = t_hrb.c +t_hrb_OBJECTS = t_hrb.$(OBJEXT) +t_hrb_LDADD = $(LDADD) +t_hrb_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_hrd_SOURCES = t_hrd.c +t_hrd_OBJECTS = t_hrd.$(OBJEXT) +t_hrd_LDADD = $(LDADD) +t_hrd_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_hri_SOURCES = t_hri.c +t_hri_OBJECTS = t_hri.$(OBJEXT) +t_hri_LDADD = $(LDADD) +t_hri_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_info_SOURCES = t_info.c +t_info_OBJECTS = t_info.$(OBJEXT) +t_info_LDADD = $(LDADD) +t_info_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_itdr_SOURCES = t_itdr.c +t_itdr_OBJECTS = t_itdr.$(OBJEXT) +t_itdr_LDADD = $(LDADD) +t_itdr_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_mcorr_SOURCES = t_mcorr.c +t_mcorr_OBJECTS = t_mcorr.$(OBJEXT) +t_mcorr_LDADD = $(LDADD) +t_mcorr_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_mixt_SOURCES = t_mixt.c +t_mixt_OBJECTS = t_mixt.$(OBJEXT) +t_mixt_LDADD = $(LDADD) +t_mixt_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_mvstd_SOURCES = t_mvstd.c +t_mvstd_OBJECTS = t_mvstd.$(OBJEXT) +t_mvstd_LDADD = $(LDADD) +t_mvstd_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_mvtdr_SOURCES = t_mvtdr.c +t_mvtdr_OBJECTS = t_mvtdr.$(OBJEXT) +t_mvtdr_LDADD = $(LDADD) +t_mvtdr_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_ninv_SOURCES = t_ninv.c +t_ninv_OBJECTS = t_ninv.$(OBJEXT) +t_ninv_LDADD = $(LDADD) +t_ninv_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_norta_SOURCES = t_norta.c +t_norta_OBJECTS = t_norta.$(OBJEXT) +t_norta_LDADD = $(LDADD) +t_norta_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_nrou_SOURCES = t_nrou.c +t_nrou_OBJECTS = t_nrou.$(OBJEXT) +t_nrou_LDADD = $(LDADD) +t_nrou_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_pinv_SOURCES = t_pinv.c +t_pinv_OBJECTS = t_pinv.$(OBJEXT) +t_pinv_LDADD = $(LDADD) +t_pinv_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_srou_SOURCES = t_srou.c +t_srou_OBJECTS = t_srou.$(OBJEXT) +t_srou_LDADD = $(LDADD) +t_srou_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_ssr_SOURCES = t_ssr.c +t_ssr_OBJECTS = t_ssr.$(OBJEXT) +t_ssr_LDADD = $(LDADD) +t_ssr_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_stringparser_SOURCES = t_stringparser.c +t_stringparser_OBJECTS = t_stringparser.$(OBJEXT) +t_stringparser_LDADD = $(LDADD) +t_stringparser_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_tabl_SOURCES = t_tabl.c +t_tabl_OBJECTS = t_tabl.$(OBJEXT) +t_tabl_LDADD = $(LDADD) +t_tabl_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_tdr_SOURCES = t_tdr.c +t_tdr_OBJECTS = t_tdr.$(OBJEXT) +t_tdr_LDADD = $(LDADD) +t_tdr_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_tdr_gw_SOURCES = t_tdr_gw.c +t_tdr_gw_OBJECTS = t_tdr_gw.$(OBJEXT) +t_tdr_gw_LDADD = $(LDADD) +t_tdr_gw_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_tdr_ia_SOURCES = t_tdr_ia.c +t_tdr_ia_OBJECTS = t_tdr_ia.$(OBJEXT) +t_tdr_ia_LDADD = $(LDADD) +t_tdr_ia_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_tdr_ps_SOURCES = t_tdr_ps.c +t_tdr_ps_OBJECTS = t_tdr_ps.$(OBJEXT) +t_tdr_ps_LDADD = $(LDADD) +t_tdr_ps_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_unif_SOURCES = t_unif.c +t_unif_OBJECTS = t_unif.$(OBJEXT) +t_unif_LDADD = $(LDADD) +t_unif_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_unur_error_SOURCES = t_unur_error.c +t_unur_error_OBJECTS = t_unur_error.$(OBJEXT) +t_unur_error_LDADD = $(LDADD) +t_unur_error_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_unur_tests_SOURCES = t_unur_tests.c +t_unur_tests_OBJECTS = t_unur_tests.$(OBJEXT) +t_unur_tests_LDADD = $(LDADD) +t_unur_tests_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_urng_SOURCES = t_urng.c +t_urng_OBJECTS = t_urng.$(OBJEXT) +t_urng_LDADD = $(LDADD) +t_urng_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_utdr_SOURCES = t_utdr.c +t_utdr_OBJECTS = t_utdr.$(OBJEXT) +t_utdr_LDADD = $(LDADD) +t_utdr_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_util_matrix_SOURCES = t_util_matrix.c +t_util_matrix_OBJECTS = t_util_matrix.$(OBJEXT) +t_util_matrix_LDADD = $(LDADD) +t_util_matrix_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_vempk_SOURCES = t_vempk.c +t_vempk_OBJECTS = t_vempk.$(OBJEXT) +t_vempk_LDADD = $(LDADD) +t_vempk_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_vnrou_SOURCES = t_vnrou.c +t_vnrou_OBJECTS = t_vnrou.$(OBJEXT) +t_vnrou_LDADD = $(LDADD) +t_vnrou_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +t_x_gen_SOURCES = t_x_gen.c +t_x_gen_OBJECTS = t_x_gen.$(OBJEXT) +t_x_gen_LDADD = $(LDADD) +t_x_gen_DEPENDENCIES = libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la +am__test_StdDistr_SOURCES_DIST = test_StdDistr.c +@HAVE_MATHEMATICA_TRUE@am_test_StdDistr_OBJECTS = \ +@HAVE_MATHEMATICA_TRUE@ test_StdDistr.$(OBJEXT) +test_StdDistr_OBJECTS = $(am_test_StdDistr_OBJECTS) +test_StdDistr_LDADD = $(LDADD) +am__test_functionparser_SOURCES_DIST = test_functionparser.c +@HAVE_MATHEMATICA_TRUE@am_test_functionparser_OBJECTS = \ +@HAVE_MATHEMATICA_TRUE@ test_functionparser.$(OBJEXT) +test_functionparser_OBJECTS = $(am_test_functionparser_OBJECTS) +test_functionparser_LDADD = $(LDADD) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/t_arou.Po ./$(DEPDIR)/t_ars.Po \ + ./$(DEPDIR)/t_auto.Po ./$(DEPDIR)/t_cext.Po \ + ./$(DEPDIR)/t_cstd.Po ./$(DEPDIR)/t_dari.Po \ + ./$(DEPDIR)/t_dau.Po ./$(DEPDIR)/t_deprecated_tdrgw.Po \ + ./$(DEPDIR)/t_deprecated_vmt.Po ./$(DEPDIR)/t_dext.Po \ + ./$(DEPDIR)/t_dgt.Po ./$(DEPDIR)/t_distr.Po \ + ./$(DEPDIR)/t_distr_cemp.Po ./$(DEPDIR)/t_distr_condi.Po \ + ./$(DEPDIR)/t_distr_cont.Po ./$(DEPDIR)/t_distr_corder.Po \ + ./$(DEPDIR)/t_distr_cvec.Po ./$(DEPDIR)/t_distr_cvemp.Po \ + ./$(DEPDIR)/t_distr_cxtrans.Po ./$(DEPDIR)/t_distr_discr.Po \ + ./$(DEPDIR)/t_distr_matr.Po ./$(DEPDIR)/t_dsrou.Po \ + ./$(DEPDIR)/t_dss.Po ./$(DEPDIR)/t_dstd.Po \ + ./$(DEPDIR)/t_empk.Po ./$(DEPDIR)/t_empl.Po \ + ./$(DEPDIR)/t_gibbs.Po ./$(DEPDIR)/t_hinv.Po \ + ./$(DEPDIR)/t_hist.Po ./$(DEPDIR)/t_hitro.Po \ + ./$(DEPDIR)/t_hrb.Po ./$(DEPDIR)/t_hrd.Po ./$(DEPDIR)/t_hri.Po \ + ./$(DEPDIR)/t_info.Po ./$(DEPDIR)/t_itdr.Po \ + ./$(DEPDIR)/t_mcorr.Po ./$(DEPDIR)/t_mixt.Po \ + ./$(DEPDIR)/t_mvstd.Po ./$(DEPDIR)/t_mvtdr.Po \ + ./$(DEPDIR)/t_ninv.Po ./$(DEPDIR)/t_norta.Po \ + ./$(DEPDIR)/t_nrou.Po ./$(DEPDIR)/t_pinv.Po \ + ./$(DEPDIR)/t_srou.Po ./$(DEPDIR)/t_ssr.Po \ + ./$(DEPDIR)/t_stringparser.Po ./$(DEPDIR)/t_tabl.Po \ + ./$(DEPDIR)/t_tdr.Po ./$(DEPDIR)/t_tdr_gw.Po \ + ./$(DEPDIR)/t_tdr_ia.Po ./$(DEPDIR)/t_tdr_ps.Po \ + ./$(DEPDIR)/t_unif.Po ./$(DEPDIR)/t_unur_error.Po \ + ./$(DEPDIR)/t_unur_tests.Po ./$(DEPDIR)/t_urng.Po \ + ./$(DEPDIR)/t_utdr.Po ./$(DEPDIR)/t_util_matrix.Po \ + ./$(DEPDIR)/t_vempk.Po ./$(DEPDIR)/t_vnrou.Po \ + ./$(DEPDIR)/t_x_gen.Po ./$(DEPDIR)/test_StdDistr.Po \ + ./$(DEPDIR)/test_functionparser.Po ./$(DEPDIR)/testcounter.Plo \ + ./$(DEPDIR)/testroutines.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libtestroutines_la_SOURCES) t_arou.c t_ars.c t_auto.c \ + t_cext.c t_cstd.c t_dari.c t_dau.c t_deprecated_tdrgw.c \ + t_deprecated_vmt.c t_dext.c t_dgt.c t_distr.c t_distr_cemp.c \ + t_distr_condi.c t_distr_cont.c t_distr_corder.c t_distr_cvec.c \ + t_distr_cvemp.c t_distr_cxtrans.c t_distr_discr.c \ + t_distr_matr.c t_dsrou.c t_dss.c t_dstd.c t_empk.c t_empl.c \ + t_gibbs.c t_hinv.c t_hist.c t_hitro.c t_hrb.c t_hrd.c t_hri.c \ + t_info.c t_itdr.c t_mcorr.c t_mixt.c t_mvstd.c t_mvtdr.c \ + t_ninv.c t_norta.c t_nrou.c t_pinv.c t_srou.c t_ssr.c \ + t_stringparser.c t_tabl.c t_tdr.c t_tdr_gw.c t_tdr_ia.c \ + t_tdr_ps.c t_unif.c t_unur_error.c t_unur_tests.c t_urng.c \ + t_utdr.c t_util_matrix.c t_vempk.c t_vnrou.c t_x_gen.c \ + $(test_StdDistr_SOURCES) $(test_functionparser_SOURCES) +DIST_SOURCES = $(libtestroutines_la_SOURCES) t_arou.c t_ars.c t_auto.c \ + t_cext.c t_cstd.c t_dari.c t_dau.c t_deprecated_tdrgw.c \ + t_deprecated_vmt.c t_dext.c t_dgt.c t_distr.c t_distr_cemp.c \ + t_distr_condi.c t_distr_cont.c t_distr_corder.c t_distr_cvec.c \ + t_distr_cvemp.c t_distr_cxtrans.c t_distr_discr.c \ + t_distr_matr.c t_dsrou.c t_dss.c t_dstd.c t_empk.c t_empl.c \ + t_gibbs.c t_hinv.c t_hist.c t_hitro.c t_hrb.c t_hrd.c t_hri.c \ + t_info.c t_itdr.c t_mcorr.c t_mixt.c t_mvstd.c t_mvtdr.c \ + t_ninv.c t_norta.c t_nrou.c t_pinv.c t_srou.c t_ssr.c \ + t_stringparser.c t_tabl.c t_tdr.c t_tdr_gw.c t_tdr_ia.c \ + t_tdr_ps.c t_unif.c t_unur_error.c t_unur_tests.c t_urng.c \ + t_utdr.c t_util_matrix.c t_vempk.c t_vnrou.c t_x_gen.c \ + $(am__test_StdDistr_SOURCES_DIST) \ + $(am__test_functionparser_SOURCES_DIST) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + check recheck distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' +RECHECK_LOGS = $(TEST_LOGS) +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/autoconf/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/autoconf/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp \ + $(top_srcdir)/autoconf/test-driver +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ +UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ +UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ +UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_valgrind = @have_valgrind@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = parallel-tests color-tests +SUBDIRS = testdistributions . +AM_CPPFLAGS = \ + $(UNURAN_SUPPORTS_GSL) \ + $(UNURAN_SUPPORTS_PRNG) \ + $(UNURAN_SUPPORTS_RNGSTREAM) \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/tests + +noinst_LTLIBRARIES = libtestroutines.la +libtestroutines_la_SOURCES = testroutines.c testcounter.c +LDADD = \ + libtestroutines.la \ + $(top_builddir)/tests/testdistributions/libtestdistributions.la \ + $(top_builddir)/src/libunuran.la + +@HAVE_MATHEMATICA_FALSE@MATHEMATICA_PROGS = + +# Special files for tests with Mathematica(TM) +@HAVE_MATHEMATICA_TRUE@MATHEMATICA_PROGS = test_StdDistr test_functionparser +@ENABLE_DEPRECATED_FALSE@DEPRECATED_TESTS = + +# Files that contain deprecated routines +@ENABLE_DEPRECATED_TRUE@DEPRECATED_TESTS = t_deprecated_vmt t_deprecated_tdrgw +TESTS = $(check_PROGRAMS) + +# These tests fail until we fix some bugs +#XFAIL_TESTS = +noinst_HEADERS = \ + testunuran.h + +EXTRA_DIST = \ + test_StdDistr.m \ + test_functionparser.m \ + make_test_files.pl \ + README.conf \ + t_info.conf \ + t_stringparser.conf \ + t_x_gen.conf \ + t_unur_tests.conf \ + t_unur_error.conf \ + t_urng.conf \ + t_util_matrix.conf \ + t_distr.conf \ + t_distr_cemp.conf \ + t_distr_cont.conf \ + t_distr_corder.conf \ + t_distr_cvec.conf \ + t_distr_condi.conf \ + t_distr_cvemp.conf \ + t_distr_cxtrans.conf \ + t_distr_discr.conf \ + t_distr_matr.conf \ + t_auto.conf \ + t_arou.conf \ + t_ars.conf \ + t_cext.conf \ + t_cstd.conf \ + t_dari.conf \ + t_dau.conf \ + t_dext.conf \ + t_dgt.conf \ + t_dsrou.conf \ + t_dss.conf \ + t_dstd.conf \ + t_empk.conf \ + t_empl.conf \ + t_gibbs.conf \ + t_hinv.conf \ + t_hinv.conf \ + t_hist.conf \ + t_hrb.conf \ + t_hrd.conf \ + t_hri.conf \ + t_itdr.conf \ + t_mcorr.conf \ + t_mvstd.conf \ + t_ninv.conf \ + t_norta.conf \ + t_nrou.conf \ + t_pinv.conf \ + t_srou.conf \ + t_ssr.conf \ + t_tabl.conf \ + t_tdr.conf t_tdr_gw.conf t_tdr_ps.conf t_tdr_ia.conf \ + t_unif.conf \ + t_utdr.conf \ + t_vempk.conf \ + t_vnrou.conf \ +\ + t_deprecated_vmt.conf + + +# Compare results of CDF, PDF, and dPDF of standard distributions +# and results of function parser to those produced with +# Mathematica(TM) ... +@HAVE_MATHEMATICA_TRUE@test_StdDistr_SOURCES = test_StdDistr.c +@HAVE_MATHEMATICA_TRUE@test_StdDistr_DEPENDENCIES = t_StdDistr.data +@HAVE_MATHEMATICA_TRUE@test_functionparser_SOURCES = test_functionparser.c +@HAVE_MATHEMATICA_TRUE@test_functionparser_DEPENDENCIES = t_functionparser.data + +# Generate C sources for tests +SUFFIXES = .c + +# clean log files and backup files +CLEANFILES = \ + *.log \ + valgrind-* \ + unuran-valgrind-* \ + *~ + + +# clean generated files +DISTCLEANFILES = \ + rm -f t_*.data + + +# clean generated files +MAINTAINERCLEANFILES = \ + rm -f t_*.c \ + Makefile.in + +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .conf .lo .log .o .obj .test .test$(EXEEXT) .trs +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign tests/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libtestroutines.la: $(libtestroutines_la_OBJECTS) $(libtestroutines_la_DEPENDENCIES) $(EXTRA_libtestroutines_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libtestroutines_la_OBJECTS) $(libtestroutines_la_LIBADD) $(LIBS) + +t_arou$(EXEEXT): $(t_arou_OBJECTS) $(t_arou_DEPENDENCIES) $(EXTRA_t_arou_DEPENDENCIES) + @rm -f t_arou$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_arou_OBJECTS) $(t_arou_LDADD) $(LIBS) + +t_ars$(EXEEXT): $(t_ars_OBJECTS) $(t_ars_DEPENDENCIES) $(EXTRA_t_ars_DEPENDENCIES) + @rm -f t_ars$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_ars_OBJECTS) $(t_ars_LDADD) $(LIBS) + +t_auto$(EXEEXT): $(t_auto_OBJECTS) $(t_auto_DEPENDENCIES) $(EXTRA_t_auto_DEPENDENCIES) + @rm -f t_auto$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_auto_OBJECTS) $(t_auto_LDADD) $(LIBS) + +t_cext$(EXEEXT): $(t_cext_OBJECTS) $(t_cext_DEPENDENCIES) $(EXTRA_t_cext_DEPENDENCIES) + @rm -f t_cext$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_cext_OBJECTS) $(t_cext_LDADD) $(LIBS) + +t_cstd$(EXEEXT): $(t_cstd_OBJECTS) $(t_cstd_DEPENDENCIES) $(EXTRA_t_cstd_DEPENDENCIES) + @rm -f t_cstd$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_cstd_OBJECTS) $(t_cstd_LDADD) $(LIBS) + +t_dari$(EXEEXT): $(t_dari_OBJECTS) $(t_dari_DEPENDENCIES) $(EXTRA_t_dari_DEPENDENCIES) + @rm -f t_dari$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_dari_OBJECTS) $(t_dari_LDADD) $(LIBS) + +t_dau$(EXEEXT): $(t_dau_OBJECTS) $(t_dau_DEPENDENCIES) $(EXTRA_t_dau_DEPENDENCIES) + @rm -f t_dau$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_dau_OBJECTS) $(t_dau_LDADD) $(LIBS) + +t_deprecated_tdrgw$(EXEEXT): $(t_deprecated_tdrgw_OBJECTS) $(t_deprecated_tdrgw_DEPENDENCIES) $(EXTRA_t_deprecated_tdrgw_DEPENDENCIES) + @rm -f t_deprecated_tdrgw$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_deprecated_tdrgw_OBJECTS) $(t_deprecated_tdrgw_LDADD) $(LIBS) + +t_deprecated_vmt$(EXEEXT): $(t_deprecated_vmt_OBJECTS) $(t_deprecated_vmt_DEPENDENCIES) $(EXTRA_t_deprecated_vmt_DEPENDENCIES) + @rm -f t_deprecated_vmt$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_deprecated_vmt_OBJECTS) $(t_deprecated_vmt_LDADD) $(LIBS) + +t_dext$(EXEEXT): $(t_dext_OBJECTS) $(t_dext_DEPENDENCIES) $(EXTRA_t_dext_DEPENDENCIES) + @rm -f t_dext$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_dext_OBJECTS) $(t_dext_LDADD) $(LIBS) + +t_dgt$(EXEEXT): $(t_dgt_OBJECTS) $(t_dgt_DEPENDENCIES) $(EXTRA_t_dgt_DEPENDENCIES) + @rm -f t_dgt$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_dgt_OBJECTS) $(t_dgt_LDADD) $(LIBS) + +t_distr$(EXEEXT): $(t_distr_OBJECTS) $(t_distr_DEPENDENCIES) $(EXTRA_t_distr_DEPENDENCIES) + @rm -f t_distr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_OBJECTS) $(t_distr_LDADD) $(LIBS) + +t_distr_cemp$(EXEEXT): $(t_distr_cemp_OBJECTS) $(t_distr_cemp_DEPENDENCIES) $(EXTRA_t_distr_cemp_DEPENDENCIES) + @rm -f t_distr_cemp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_cemp_OBJECTS) $(t_distr_cemp_LDADD) $(LIBS) + +t_distr_condi$(EXEEXT): $(t_distr_condi_OBJECTS) $(t_distr_condi_DEPENDENCIES) $(EXTRA_t_distr_condi_DEPENDENCIES) + @rm -f t_distr_condi$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_condi_OBJECTS) $(t_distr_condi_LDADD) $(LIBS) + +t_distr_cont$(EXEEXT): $(t_distr_cont_OBJECTS) $(t_distr_cont_DEPENDENCIES) $(EXTRA_t_distr_cont_DEPENDENCIES) + @rm -f t_distr_cont$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_cont_OBJECTS) $(t_distr_cont_LDADD) $(LIBS) + +t_distr_corder$(EXEEXT): $(t_distr_corder_OBJECTS) $(t_distr_corder_DEPENDENCIES) $(EXTRA_t_distr_corder_DEPENDENCIES) + @rm -f t_distr_corder$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_corder_OBJECTS) $(t_distr_corder_LDADD) $(LIBS) + +t_distr_cvec$(EXEEXT): $(t_distr_cvec_OBJECTS) $(t_distr_cvec_DEPENDENCIES) $(EXTRA_t_distr_cvec_DEPENDENCIES) + @rm -f t_distr_cvec$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_cvec_OBJECTS) $(t_distr_cvec_LDADD) $(LIBS) + +t_distr_cvemp$(EXEEXT): $(t_distr_cvemp_OBJECTS) $(t_distr_cvemp_DEPENDENCIES) $(EXTRA_t_distr_cvemp_DEPENDENCIES) + @rm -f t_distr_cvemp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_cvemp_OBJECTS) $(t_distr_cvemp_LDADD) $(LIBS) + +t_distr_cxtrans$(EXEEXT): $(t_distr_cxtrans_OBJECTS) $(t_distr_cxtrans_DEPENDENCIES) $(EXTRA_t_distr_cxtrans_DEPENDENCIES) + @rm -f t_distr_cxtrans$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_cxtrans_OBJECTS) $(t_distr_cxtrans_LDADD) $(LIBS) + +t_distr_discr$(EXEEXT): $(t_distr_discr_OBJECTS) $(t_distr_discr_DEPENDENCIES) $(EXTRA_t_distr_discr_DEPENDENCIES) + @rm -f t_distr_discr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_discr_OBJECTS) $(t_distr_discr_LDADD) $(LIBS) + +t_distr_matr$(EXEEXT): $(t_distr_matr_OBJECTS) $(t_distr_matr_DEPENDENCIES) $(EXTRA_t_distr_matr_DEPENDENCIES) + @rm -f t_distr_matr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_distr_matr_OBJECTS) $(t_distr_matr_LDADD) $(LIBS) + +t_dsrou$(EXEEXT): $(t_dsrou_OBJECTS) $(t_dsrou_DEPENDENCIES) $(EXTRA_t_dsrou_DEPENDENCIES) + @rm -f t_dsrou$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_dsrou_OBJECTS) $(t_dsrou_LDADD) $(LIBS) + +t_dss$(EXEEXT): $(t_dss_OBJECTS) $(t_dss_DEPENDENCIES) $(EXTRA_t_dss_DEPENDENCIES) + @rm -f t_dss$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_dss_OBJECTS) $(t_dss_LDADD) $(LIBS) + +t_dstd$(EXEEXT): $(t_dstd_OBJECTS) $(t_dstd_DEPENDENCIES) $(EXTRA_t_dstd_DEPENDENCIES) + @rm -f t_dstd$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_dstd_OBJECTS) $(t_dstd_LDADD) $(LIBS) + +t_empk$(EXEEXT): $(t_empk_OBJECTS) $(t_empk_DEPENDENCIES) $(EXTRA_t_empk_DEPENDENCIES) + @rm -f t_empk$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_empk_OBJECTS) $(t_empk_LDADD) $(LIBS) + +t_empl$(EXEEXT): $(t_empl_OBJECTS) $(t_empl_DEPENDENCIES) $(EXTRA_t_empl_DEPENDENCIES) + @rm -f t_empl$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_empl_OBJECTS) $(t_empl_LDADD) $(LIBS) + +t_gibbs$(EXEEXT): $(t_gibbs_OBJECTS) $(t_gibbs_DEPENDENCIES) $(EXTRA_t_gibbs_DEPENDENCIES) + @rm -f t_gibbs$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_gibbs_OBJECTS) $(t_gibbs_LDADD) $(LIBS) + +t_hinv$(EXEEXT): $(t_hinv_OBJECTS) $(t_hinv_DEPENDENCIES) $(EXTRA_t_hinv_DEPENDENCIES) + @rm -f t_hinv$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_hinv_OBJECTS) $(t_hinv_LDADD) $(LIBS) + +t_hist$(EXEEXT): $(t_hist_OBJECTS) $(t_hist_DEPENDENCIES) $(EXTRA_t_hist_DEPENDENCIES) + @rm -f t_hist$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_hist_OBJECTS) $(t_hist_LDADD) $(LIBS) + +t_hitro$(EXEEXT): $(t_hitro_OBJECTS) $(t_hitro_DEPENDENCIES) $(EXTRA_t_hitro_DEPENDENCIES) + @rm -f t_hitro$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_hitro_OBJECTS) $(t_hitro_LDADD) $(LIBS) + +t_hrb$(EXEEXT): $(t_hrb_OBJECTS) $(t_hrb_DEPENDENCIES) $(EXTRA_t_hrb_DEPENDENCIES) + @rm -f t_hrb$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_hrb_OBJECTS) $(t_hrb_LDADD) $(LIBS) + +t_hrd$(EXEEXT): $(t_hrd_OBJECTS) $(t_hrd_DEPENDENCIES) $(EXTRA_t_hrd_DEPENDENCIES) + @rm -f t_hrd$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_hrd_OBJECTS) $(t_hrd_LDADD) $(LIBS) + +t_hri$(EXEEXT): $(t_hri_OBJECTS) $(t_hri_DEPENDENCIES) $(EXTRA_t_hri_DEPENDENCIES) + @rm -f t_hri$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_hri_OBJECTS) $(t_hri_LDADD) $(LIBS) + +t_info$(EXEEXT): $(t_info_OBJECTS) $(t_info_DEPENDENCIES) $(EXTRA_t_info_DEPENDENCIES) + @rm -f t_info$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_info_OBJECTS) $(t_info_LDADD) $(LIBS) + +t_itdr$(EXEEXT): $(t_itdr_OBJECTS) $(t_itdr_DEPENDENCIES) $(EXTRA_t_itdr_DEPENDENCIES) + @rm -f t_itdr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_itdr_OBJECTS) $(t_itdr_LDADD) $(LIBS) + +t_mcorr$(EXEEXT): $(t_mcorr_OBJECTS) $(t_mcorr_DEPENDENCIES) $(EXTRA_t_mcorr_DEPENDENCIES) + @rm -f t_mcorr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_mcorr_OBJECTS) $(t_mcorr_LDADD) $(LIBS) + +t_mixt$(EXEEXT): $(t_mixt_OBJECTS) $(t_mixt_DEPENDENCIES) $(EXTRA_t_mixt_DEPENDENCIES) + @rm -f t_mixt$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_mixt_OBJECTS) $(t_mixt_LDADD) $(LIBS) + +t_mvstd$(EXEEXT): $(t_mvstd_OBJECTS) $(t_mvstd_DEPENDENCIES) $(EXTRA_t_mvstd_DEPENDENCIES) + @rm -f t_mvstd$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_mvstd_OBJECTS) $(t_mvstd_LDADD) $(LIBS) + +t_mvtdr$(EXEEXT): $(t_mvtdr_OBJECTS) $(t_mvtdr_DEPENDENCIES) $(EXTRA_t_mvtdr_DEPENDENCIES) + @rm -f t_mvtdr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_mvtdr_OBJECTS) $(t_mvtdr_LDADD) $(LIBS) + +t_ninv$(EXEEXT): $(t_ninv_OBJECTS) $(t_ninv_DEPENDENCIES) $(EXTRA_t_ninv_DEPENDENCIES) + @rm -f t_ninv$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_ninv_OBJECTS) $(t_ninv_LDADD) $(LIBS) + +t_norta$(EXEEXT): $(t_norta_OBJECTS) $(t_norta_DEPENDENCIES) $(EXTRA_t_norta_DEPENDENCIES) + @rm -f t_norta$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_norta_OBJECTS) $(t_norta_LDADD) $(LIBS) + +t_nrou$(EXEEXT): $(t_nrou_OBJECTS) $(t_nrou_DEPENDENCIES) $(EXTRA_t_nrou_DEPENDENCIES) + @rm -f t_nrou$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_nrou_OBJECTS) $(t_nrou_LDADD) $(LIBS) + +t_pinv$(EXEEXT): $(t_pinv_OBJECTS) $(t_pinv_DEPENDENCIES) $(EXTRA_t_pinv_DEPENDENCIES) + @rm -f t_pinv$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_pinv_OBJECTS) $(t_pinv_LDADD) $(LIBS) + +t_srou$(EXEEXT): $(t_srou_OBJECTS) $(t_srou_DEPENDENCIES) $(EXTRA_t_srou_DEPENDENCIES) + @rm -f t_srou$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_srou_OBJECTS) $(t_srou_LDADD) $(LIBS) + +t_ssr$(EXEEXT): $(t_ssr_OBJECTS) $(t_ssr_DEPENDENCIES) $(EXTRA_t_ssr_DEPENDENCIES) + @rm -f t_ssr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_ssr_OBJECTS) $(t_ssr_LDADD) $(LIBS) + +t_stringparser$(EXEEXT): $(t_stringparser_OBJECTS) $(t_stringparser_DEPENDENCIES) $(EXTRA_t_stringparser_DEPENDENCIES) + @rm -f t_stringparser$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_stringparser_OBJECTS) $(t_stringparser_LDADD) $(LIBS) + +t_tabl$(EXEEXT): $(t_tabl_OBJECTS) $(t_tabl_DEPENDENCIES) $(EXTRA_t_tabl_DEPENDENCIES) + @rm -f t_tabl$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_tabl_OBJECTS) $(t_tabl_LDADD) $(LIBS) + +t_tdr$(EXEEXT): $(t_tdr_OBJECTS) $(t_tdr_DEPENDENCIES) $(EXTRA_t_tdr_DEPENDENCIES) + @rm -f t_tdr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_tdr_OBJECTS) $(t_tdr_LDADD) $(LIBS) + +t_tdr_gw$(EXEEXT): $(t_tdr_gw_OBJECTS) $(t_tdr_gw_DEPENDENCIES) $(EXTRA_t_tdr_gw_DEPENDENCIES) + @rm -f t_tdr_gw$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_tdr_gw_OBJECTS) $(t_tdr_gw_LDADD) $(LIBS) + +t_tdr_ia$(EXEEXT): $(t_tdr_ia_OBJECTS) $(t_tdr_ia_DEPENDENCIES) $(EXTRA_t_tdr_ia_DEPENDENCIES) + @rm -f t_tdr_ia$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_tdr_ia_OBJECTS) $(t_tdr_ia_LDADD) $(LIBS) + +t_tdr_ps$(EXEEXT): $(t_tdr_ps_OBJECTS) $(t_tdr_ps_DEPENDENCIES) $(EXTRA_t_tdr_ps_DEPENDENCIES) + @rm -f t_tdr_ps$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_tdr_ps_OBJECTS) $(t_tdr_ps_LDADD) $(LIBS) + +t_unif$(EXEEXT): $(t_unif_OBJECTS) $(t_unif_DEPENDENCIES) $(EXTRA_t_unif_DEPENDENCIES) + @rm -f t_unif$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_unif_OBJECTS) $(t_unif_LDADD) $(LIBS) + +t_unur_error$(EXEEXT): $(t_unur_error_OBJECTS) $(t_unur_error_DEPENDENCIES) $(EXTRA_t_unur_error_DEPENDENCIES) + @rm -f t_unur_error$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_unur_error_OBJECTS) $(t_unur_error_LDADD) $(LIBS) + +t_unur_tests$(EXEEXT): $(t_unur_tests_OBJECTS) $(t_unur_tests_DEPENDENCIES) $(EXTRA_t_unur_tests_DEPENDENCIES) + @rm -f t_unur_tests$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_unur_tests_OBJECTS) $(t_unur_tests_LDADD) $(LIBS) + +t_urng$(EXEEXT): $(t_urng_OBJECTS) $(t_urng_DEPENDENCIES) $(EXTRA_t_urng_DEPENDENCIES) + @rm -f t_urng$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_urng_OBJECTS) $(t_urng_LDADD) $(LIBS) + +t_utdr$(EXEEXT): $(t_utdr_OBJECTS) $(t_utdr_DEPENDENCIES) $(EXTRA_t_utdr_DEPENDENCIES) + @rm -f t_utdr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_utdr_OBJECTS) $(t_utdr_LDADD) $(LIBS) + +t_util_matrix$(EXEEXT): $(t_util_matrix_OBJECTS) $(t_util_matrix_DEPENDENCIES) $(EXTRA_t_util_matrix_DEPENDENCIES) + @rm -f t_util_matrix$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_util_matrix_OBJECTS) $(t_util_matrix_LDADD) $(LIBS) + +t_vempk$(EXEEXT): $(t_vempk_OBJECTS) $(t_vempk_DEPENDENCIES) $(EXTRA_t_vempk_DEPENDENCIES) + @rm -f t_vempk$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_vempk_OBJECTS) $(t_vempk_LDADD) $(LIBS) + +t_vnrou$(EXEEXT): $(t_vnrou_OBJECTS) $(t_vnrou_DEPENDENCIES) $(EXTRA_t_vnrou_DEPENDENCIES) + @rm -f t_vnrou$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_vnrou_OBJECTS) $(t_vnrou_LDADD) $(LIBS) + +t_x_gen$(EXEEXT): $(t_x_gen_OBJECTS) $(t_x_gen_DEPENDENCIES) $(EXTRA_t_x_gen_DEPENDENCIES) + @rm -f t_x_gen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_x_gen_OBJECTS) $(t_x_gen_LDADD) $(LIBS) + +test_StdDistr$(EXEEXT): $(test_StdDistr_OBJECTS) $(test_StdDistr_DEPENDENCIES) $(EXTRA_test_StdDistr_DEPENDENCIES) + @rm -f test_StdDistr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_StdDistr_OBJECTS) $(test_StdDistr_LDADD) $(LIBS) + +test_functionparser$(EXEEXT): $(test_functionparser_OBJECTS) $(test_functionparser_DEPENDENCIES) $(EXTRA_test_functionparser_DEPENDENCIES) + @rm -f test_functionparser$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_functionparser_OBJECTS) $(test_functionparser_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_arou.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_ars.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_auto.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_cext.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_cstd.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_dari.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_dau.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_deprecated_tdrgw.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_deprecated_vmt.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_dext.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_dgt.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr_cemp.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr_condi.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr_cont.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr_corder.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr_cvec.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr_cvemp.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr_cxtrans.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr_discr.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr_matr.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_dsrou.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_dss.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_dstd.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_empk.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_empl.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_gibbs.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_hinv.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_hist.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_hitro.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_hrb.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_hrd.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_hri.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_info.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_itdr.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_mcorr.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_mixt.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_mvstd.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_mvtdr.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_ninv.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_norta.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_nrou.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_pinv.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_srou.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_ssr.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_stringparser.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_tabl.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_tdr.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_tdr_gw.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_tdr_ia.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_tdr_ps.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_unif.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_unur_error.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_unur_tests.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_urng.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_utdr.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_util_matrix.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_vempk.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_vnrou.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_x_gen.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_StdDistr.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_functionparser.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcounter.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testroutines.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: $(check_PROGRAMS) + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_PROGRAMS) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +t_x_gen.log: t_x_gen$(EXEEXT) + @p='t_x_gen$(EXEEXT)'; \ + b='t_x_gen'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_unur_tests.log: t_unur_tests$(EXEEXT) + @p='t_unur_tests$(EXEEXT)'; \ + b='t_unur_tests'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_unur_error.log: t_unur_error$(EXEEXT) + @p='t_unur_error$(EXEEXT)'; \ + b='t_unur_error'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_urng.log: t_urng$(EXEEXT) + @p='t_urng$(EXEEXT)'; \ + b='t_urng'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr.log: t_distr$(EXEEXT) + @p='t_distr$(EXEEXT)'; \ + b='t_distr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr_cemp.log: t_distr_cemp$(EXEEXT) + @p='t_distr_cemp$(EXEEXT)'; \ + b='t_distr_cemp'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr_cont.log: t_distr_cont$(EXEEXT) + @p='t_distr_cont$(EXEEXT)'; \ + b='t_distr_cont'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr_corder.log: t_distr_corder$(EXEEXT) + @p='t_distr_corder$(EXEEXT)'; \ + b='t_distr_corder'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr_cvec.log: t_distr_cvec$(EXEEXT) + @p='t_distr_cvec$(EXEEXT)'; \ + b='t_distr_cvec'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr_condi.log: t_distr_condi$(EXEEXT) + @p='t_distr_condi$(EXEEXT)'; \ + b='t_distr_condi'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr_cvemp.log: t_distr_cvemp$(EXEEXT) + @p='t_distr_cvemp$(EXEEXT)'; \ + b='t_distr_cvemp'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr_cxtrans.log: t_distr_cxtrans$(EXEEXT) + @p='t_distr_cxtrans$(EXEEXT)'; \ + b='t_distr_cxtrans'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr_discr.log: t_distr_discr$(EXEEXT) + @p='t_distr_discr$(EXEEXT)'; \ + b='t_distr_discr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_distr_matr.log: t_distr_matr$(EXEEXT) + @p='t_distr_matr$(EXEEXT)'; \ + b='t_distr_matr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_auto.log: t_auto$(EXEEXT) + @p='t_auto$(EXEEXT)'; \ + b='t_auto'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_arou.log: t_arou$(EXEEXT) + @p='t_arou$(EXEEXT)'; \ + b='t_arou'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_ars.log: t_ars$(EXEEXT) + @p='t_ars$(EXEEXT)'; \ + b='t_ars'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_cext.log: t_cext$(EXEEXT) + @p='t_cext$(EXEEXT)'; \ + b='t_cext'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_cstd.log: t_cstd$(EXEEXT) + @p='t_cstd$(EXEEXT)'; \ + b='t_cstd'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_dari.log: t_dari$(EXEEXT) + @p='t_dari$(EXEEXT)'; \ + b='t_dari'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_dau.log: t_dau$(EXEEXT) + @p='t_dau$(EXEEXT)'; \ + b='t_dau'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_dext.log: t_dext$(EXEEXT) + @p='t_dext$(EXEEXT)'; \ + b='t_dext'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_dgt.log: t_dgt$(EXEEXT) + @p='t_dgt$(EXEEXT)'; \ + b='t_dgt'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_dsrou.log: t_dsrou$(EXEEXT) + @p='t_dsrou$(EXEEXT)'; \ + b='t_dsrou'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_dss.log: t_dss$(EXEEXT) + @p='t_dss$(EXEEXT)'; \ + b='t_dss'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_dstd.log: t_dstd$(EXEEXT) + @p='t_dstd$(EXEEXT)'; \ + b='t_dstd'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_empk.log: t_empk$(EXEEXT) + @p='t_empk$(EXEEXT)'; \ + b='t_empk'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_empl.log: t_empl$(EXEEXT) + @p='t_empl$(EXEEXT)'; \ + b='t_empl'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_gibbs.log: t_gibbs$(EXEEXT) + @p='t_gibbs$(EXEEXT)'; \ + b='t_gibbs'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_hinv.log: t_hinv$(EXEEXT) + @p='t_hinv$(EXEEXT)'; \ + b='t_hinv'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_hist.log: t_hist$(EXEEXT) + @p='t_hist$(EXEEXT)'; \ + b='t_hist'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_hitro.log: t_hitro$(EXEEXT) + @p='t_hitro$(EXEEXT)'; \ + b='t_hitro'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_hrb.log: t_hrb$(EXEEXT) + @p='t_hrb$(EXEEXT)'; \ + b='t_hrb'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_hrd.log: t_hrd$(EXEEXT) + @p='t_hrd$(EXEEXT)'; \ + b='t_hrd'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_hri.log: t_hri$(EXEEXT) + @p='t_hri$(EXEEXT)'; \ + b='t_hri'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_itdr.log: t_itdr$(EXEEXT) + @p='t_itdr$(EXEEXT)'; \ + b='t_itdr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_mcorr.log: t_mcorr$(EXEEXT) + @p='t_mcorr$(EXEEXT)'; \ + b='t_mcorr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_mixt.log: t_mixt$(EXEEXT) + @p='t_mixt$(EXEEXT)'; \ + b='t_mixt'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_mvstd.log: t_mvstd$(EXEEXT) + @p='t_mvstd$(EXEEXT)'; \ + b='t_mvstd'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_mvtdr.log: t_mvtdr$(EXEEXT) + @p='t_mvtdr$(EXEEXT)'; \ + b='t_mvtdr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_ninv.log: t_ninv$(EXEEXT) + @p='t_ninv$(EXEEXT)'; \ + b='t_ninv'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_norta.log: t_norta$(EXEEXT) + @p='t_norta$(EXEEXT)'; \ + b='t_norta'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_nrou.log: t_nrou$(EXEEXT) + @p='t_nrou$(EXEEXT)'; \ + b='t_nrou'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_pinv.log: t_pinv$(EXEEXT) + @p='t_pinv$(EXEEXT)'; \ + b='t_pinv'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_srou.log: t_srou$(EXEEXT) + @p='t_srou$(EXEEXT)'; \ + b='t_srou'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_ssr.log: t_ssr$(EXEEXT) + @p='t_ssr$(EXEEXT)'; \ + b='t_ssr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_tabl.log: t_tabl$(EXEEXT) + @p='t_tabl$(EXEEXT)'; \ + b='t_tabl'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_tdr.log: t_tdr$(EXEEXT) + @p='t_tdr$(EXEEXT)'; \ + b='t_tdr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_tdr_gw.log: t_tdr_gw$(EXEEXT) + @p='t_tdr_gw$(EXEEXT)'; \ + b='t_tdr_gw'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_tdr_ps.log: t_tdr_ps$(EXEEXT) + @p='t_tdr_ps$(EXEEXT)'; \ + b='t_tdr_ps'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_tdr_ia.log: t_tdr_ia$(EXEEXT) + @p='t_tdr_ia$(EXEEXT)'; \ + b='t_tdr_ia'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_unif.log: t_unif$(EXEEXT) + @p='t_unif$(EXEEXT)'; \ + b='t_unif'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_utdr.log: t_utdr$(EXEEXT) + @p='t_utdr$(EXEEXT)'; \ + b='t_utdr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_vempk.log: t_vempk$(EXEEXT) + @p='t_vempk$(EXEEXT)'; \ + b='t_vempk'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_vnrou.log: t_vnrou$(EXEEXT) + @p='t_vnrou$(EXEEXT)'; \ + b='t_vnrou'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_stringparser.log: t_stringparser$(EXEEXT) + @p='t_stringparser$(EXEEXT)'; \ + b='t_stringparser'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_info.log: t_info$(EXEEXT) + @p='t_info$(EXEEXT)'; \ + b='t_info'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_util_matrix.log: t_util_matrix$(EXEEXT) + @p='t_util_matrix$(EXEEXT)'; \ + b='t_util_matrix'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_deprecated_vmt.log: t_deprecated_vmt$(EXEEXT) + @p='t_deprecated_vmt$(EXEEXT)'; \ + b='t_deprecated_vmt'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +t_deprecated_tdrgw.log: t_deprecated_tdrgw$(EXEEXT) + @p='t_deprecated_tdrgw$(EXEEXT)'; \ + b='t_deprecated_tdrgw'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_StdDistr.log: test_StdDistr$(EXEEXT) + @p='test_StdDistr$(EXEEXT)'; \ + b='test_StdDistr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_functionparser.log: test_functionparser$(EXEEXT) + @p='test_functionparser$(EXEEXT)'; \ + b='test_functionparser'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-recursive +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -f ./$(DEPDIR)/t_arou.Po + -rm -f ./$(DEPDIR)/t_ars.Po + -rm -f ./$(DEPDIR)/t_auto.Po + -rm -f ./$(DEPDIR)/t_cext.Po + -rm -f ./$(DEPDIR)/t_cstd.Po + -rm -f ./$(DEPDIR)/t_dari.Po + -rm -f ./$(DEPDIR)/t_dau.Po + -rm -f ./$(DEPDIR)/t_deprecated_tdrgw.Po + -rm -f ./$(DEPDIR)/t_deprecated_vmt.Po + -rm -f ./$(DEPDIR)/t_dext.Po + -rm -f ./$(DEPDIR)/t_dgt.Po + -rm -f ./$(DEPDIR)/t_distr.Po + -rm -f ./$(DEPDIR)/t_distr_cemp.Po + -rm -f ./$(DEPDIR)/t_distr_condi.Po + -rm -f ./$(DEPDIR)/t_distr_cont.Po + -rm -f ./$(DEPDIR)/t_distr_corder.Po + -rm -f ./$(DEPDIR)/t_distr_cvec.Po + -rm -f ./$(DEPDIR)/t_distr_cvemp.Po + -rm -f ./$(DEPDIR)/t_distr_cxtrans.Po + -rm -f ./$(DEPDIR)/t_distr_discr.Po + -rm -f ./$(DEPDIR)/t_distr_matr.Po + -rm -f ./$(DEPDIR)/t_dsrou.Po + -rm -f ./$(DEPDIR)/t_dss.Po + -rm -f ./$(DEPDIR)/t_dstd.Po + -rm -f ./$(DEPDIR)/t_empk.Po + -rm -f ./$(DEPDIR)/t_empl.Po + -rm -f ./$(DEPDIR)/t_gibbs.Po + -rm -f ./$(DEPDIR)/t_hinv.Po + -rm -f ./$(DEPDIR)/t_hist.Po + -rm -f ./$(DEPDIR)/t_hitro.Po + -rm -f ./$(DEPDIR)/t_hrb.Po + -rm -f ./$(DEPDIR)/t_hrd.Po + -rm -f ./$(DEPDIR)/t_hri.Po + -rm -f ./$(DEPDIR)/t_info.Po + -rm -f ./$(DEPDIR)/t_itdr.Po + -rm -f ./$(DEPDIR)/t_mcorr.Po + -rm -f ./$(DEPDIR)/t_mixt.Po + -rm -f ./$(DEPDIR)/t_mvstd.Po + -rm -f ./$(DEPDIR)/t_mvtdr.Po + -rm -f ./$(DEPDIR)/t_ninv.Po + -rm -f ./$(DEPDIR)/t_norta.Po + -rm -f ./$(DEPDIR)/t_nrou.Po + -rm -f ./$(DEPDIR)/t_pinv.Po + -rm -f ./$(DEPDIR)/t_srou.Po + -rm -f ./$(DEPDIR)/t_ssr.Po + -rm -f ./$(DEPDIR)/t_stringparser.Po + -rm -f ./$(DEPDIR)/t_tabl.Po + -rm -f ./$(DEPDIR)/t_tdr.Po + -rm -f ./$(DEPDIR)/t_tdr_gw.Po + -rm -f ./$(DEPDIR)/t_tdr_ia.Po + -rm -f ./$(DEPDIR)/t_tdr_ps.Po + -rm -f ./$(DEPDIR)/t_unif.Po + -rm -f ./$(DEPDIR)/t_unur_error.Po + -rm -f ./$(DEPDIR)/t_unur_tests.Po + -rm -f ./$(DEPDIR)/t_urng.Po + -rm -f ./$(DEPDIR)/t_utdr.Po + -rm -f ./$(DEPDIR)/t_util_matrix.Po + -rm -f ./$(DEPDIR)/t_vempk.Po + -rm -f ./$(DEPDIR)/t_vnrou.Po + -rm -f ./$(DEPDIR)/t_x_gen.Po + -rm -f ./$(DEPDIR)/test_StdDistr.Po + -rm -f ./$(DEPDIR)/test_functionparser.Po + -rm -f ./$(DEPDIR)/testcounter.Plo + -rm -f ./$(DEPDIR)/testroutines.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f ./$(DEPDIR)/t_arou.Po + -rm -f ./$(DEPDIR)/t_ars.Po + -rm -f ./$(DEPDIR)/t_auto.Po + -rm -f ./$(DEPDIR)/t_cext.Po + -rm -f ./$(DEPDIR)/t_cstd.Po + -rm -f ./$(DEPDIR)/t_dari.Po + -rm -f ./$(DEPDIR)/t_dau.Po + -rm -f ./$(DEPDIR)/t_deprecated_tdrgw.Po + -rm -f ./$(DEPDIR)/t_deprecated_vmt.Po + -rm -f ./$(DEPDIR)/t_dext.Po + -rm -f ./$(DEPDIR)/t_dgt.Po + -rm -f ./$(DEPDIR)/t_distr.Po + -rm -f ./$(DEPDIR)/t_distr_cemp.Po + -rm -f ./$(DEPDIR)/t_distr_condi.Po + -rm -f ./$(DEPDIR)/t_distr_cont.Po + -rm -f ./$(DEPDIR)/t_distr_corder.Po + -rm -f ./$(DEPDIR)/t_distr_cvec.Po + -rm -f ./$(DEPDIR)/t_distr_cvemp.Po + -rm -f ./$(DEPDIR)/t_distr_cxtrans.Po + -rm -f ./$(DEPDIR)/t_distr_discr.Po + -rm -f ./$(DEPDIR)/t_distr_matr.Po + -rm -f ./$(DEPDIR)/t_dsrou.Po + -rm -f ./$(DEPDIR)/t_dss.Po + -rm -f ./$(DEPDIR)/t_dstd.Po + -rm -f ./$(DEPDIR)/t_empk.Po + -rm -f ./$(DEPDIR)/t_empl.Po + -rm -f ./$(DEPDIR)/t_gibbs.Po + -rm -f ./$(DEPDIR)/t_hinv.Po + -rm -f ./$(DEPDIR)/t_hist.Po + -rm -f ./$(DEPDIR)/t_hitro.Po + -rm -f ./$(DEPDIR)/t_hrb.Po + -rm -f ./$(DEPDIR)/t_hrd.Po + -rm -f ./$(DEPDIR)/t_hri.Po + -rm -f ./$(DEPDIR)/t_info.Po + -rm -f ./$(DEPDIR)/t_itdr.Po + -rm -f ./$(DEPDIR)/t_mcorr.Po + -rm -f ./$(DEPDIR)/t_mixt.Po + -rm -f ./$(DEPDIR)/t_mvstd.Po + -rm -f ./$(DEPDIR)/t_mvtdr.Po + -rm -f ./$(DEPDIR)/t_ninv.Po + -rm -f ./$(DEPDIR)/t_norta.Po + -rm -f ./$(DEPDIR)/t_nrou.Po + -rm -f ./$(DEPDIR)/t_pinv.Po + -rm -f ./$(DEPDIR)/t_srou.Po + -rm -f ./$(DEPDIR)/t_ssr.Po + -rm -f ./$(DEPDIR)/t_stringparser.Po + -rm -f ./$(DEPDIR)/t_tabl.Po + -rm -f ./$(DEPDIR)/t_tdr.Po + -rm -f ./$(DEPDIR)/t_tdr_gw.Po + -rm -f ./$(DEPDIR)/t_tdr_ia.Po + -rm -f ./$(DEPDIR)/t_tdr_ps.Po + -rm -f ./$(DEPDIR)/t_unif.Po + -rm -f ./$(DEPDIR)/t_unur_error.Po + -rm -f ./$(DEPDIR)/t_unur_tests.Po + -rm -f ./$(DEPDIR)/t_urng.Po + -rm -f ./$(DEPDIR)/t_utdr.Po + -rm -f ./$(DEPDIR)/t_util_matrix.Po + -rm -f ./$(DEPDIR)/t_vempk.Po + -rm -f ./$(DEPDIR)/t_vnrou.Po + -rm -f ./$(DEPDIR)/t_x_gen.Po + -rm -f ./$(DEPDIR)/test_StdDistr.Po + -rm -f ./$(DEPDIR)/test_functionparser.Po + -rm -f ./$(DEPDIR)/testcounter.Plo + -rm -f ./$(DEPDIR)/testroutines.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) check-am install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool \ + clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am recheck tags tags-am \ + uninstall uninstall-am + +.PRECIOUS: Makefile + + +@HAVE_MATHEMATICA_TRUE@test_StdDistr.o: t_StdDistr.data + +@HAVE_MATHEMATICA_TRUE@t_StdDistr.data: test_StdDistr.m +@HAVE_MATHEMATICA_TRUE@ math -initfile $(top_srcdir)/tests/test_StdDistr.m + +@HAVE_MATHEMATICA_TRUE@test_functionparser.o: t_functionparser.data + +@HAVE_MATHEMATICA_TRUE@t_functionparser.data: test_functionparser.m +@HAVE_MATHEMATICA_TRUE@ math -initfile $(top_srcdir)/tests/test_functionparser.m +.conf.c: + ./make_test_files.pl $(top_srcdir) $< > $@ + +t_*.c: make_test_files.pl + +# run tests with valgrind +@HAVE_VALGRIND_TRUE@valgrind: $(check_PROGRAMS) +@HAVE_VALGRIND_TRUE@ @list='$(check_PROGRAMS)'; for p in $$list; do \ +@HAVE_VALGRIND_TRUE@ $(top_srcdir)/scripts/run_valgrind.sh ./$$p; \ +@HAVE_VALGRIND_TRUE@ done + +# run tests in fullcheck mode +fullcheck: + UNURANFULLCHECK=true $(MAKE) check + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/tests/README.conf b/vendor/unuran-1.11.0/tests/README.conf new file mode 100644 index 0000000..83f6f00 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/README.conf @@ -0,0 +1,381 @@ +############################################################################# +# +# Config file for test routines +# +# This file contains section with subsections. +# Sections are indicated by [], subsections by [ - :] +# (the brackets '[]', the dash '-' and the colon ':' are required). +# There must be a line break after the closing bracket ']'. +# +# The names of the other sections can be arbitrary. However there are some +# restrictions: +# +# (*) There alway must be a section [main]. +# +# (*) There must no be section [start] nor a subjection [ - start:]. +# +# (*) The sections [main], [verbatim], [validate], and [special] +# are reserved and have a special meaning. +# +# Lines starting with '#' are ignored (comments). Similarly any text from +# '#' til the end of a line is deleted. +# `#' can be inserted by using `\#'. +# +############################################################################# +# +# [main] +# +# Section [main] contains global data and there must be two subsections: +# [main - data:] and [main - header:] +# +# Subsection [main - data:] must contain the following keywords: +# +# (*) method: +# e.g. +# method: AROU +# +# Everything in the subsection [main - header:] is copied verbatim +# into the C file header. +# eg. for prototypes for functions defined in section [verbatim]. +# +# Important: C header files can be included here. However, the path +# must be relative to the 'top_srcdir' directory. +# +# Moreover this subsection must contain the following to definitions: +# static int COMPARE_SAMPLE_SIZE = 500; +# static int VIOLATE_SAMPLE_SIZE = 20; /* or any appropriate samples size */ +# +# Optionally the following macros can be defined: +# (defaults given in brackets) +# +# CHI2_FAILURES_TOLERATED (2): +# number of failures in section [validate - test chi2:], see below +# +# SEED: +# if defined it is used to set the seed of the random number generator +# +# Notice: One also can set a global seed by setting the environment +# variable 'SEED'. This is used in every generated C test file instead +# of a randomly chosen one. However, it is overridden by the macro +# 'SEED' #defined in the conf file. +# +# Both settings, however, are overwritten at runtime when the +# environmental variable 'SEED' is defined. +# +############################################################################# +# +# [verbatim] +# +# Everthing in section [verbatim] is copies AS IS into the C file immediately +# after the C file header. +# +# +############################################################################# +# +# [special] +# +# There any tests can be added. There must be two subsections: +# +# [special - decl:] +# Contains all declarations. +# +# [special - start:] +# Contains the actual code +# The variable FAILED should be set to a nonzero interger if one (or more) +# tests have failed. +# +############################################################################# +# +# [validate] +# +# Section [validate] describes tests for the implemented generators. +# +# It contains the following subsections: +# +# [validate - generators:] +# List of generator types. Each type has to be declared by the +# corresponding UNU.RAN calls to build a parameter object. +# Different types are separated by empty lines. +# The parameter object must be called `par[x]', where `x' +# is an integer. It can be used for numbering the objects. However +# this is just for convinience since it is ignored when scanning +# the file. internally the first parameter object that appear in +# the file is labeled with `0' the second with `1', and so on. +# +# IMPORTANT: the distribution object in the unur_..._new() call +# has to be encoded by `@distr@'. +# Example: to get a parameter object for method TDR and change +# the parameter c you have to write: +# par[0] = unur_tdr_new(@distr@); +# unur_tdr_set_c(par[0],0.); +# +# It is also possible to change an existing generator object. +# The generator object must be called `gen'. +# It is not necessary (and even verboten) to call unur_init(). +# Example: To get a generator for method SROU, change the domain +# of the distribution, and reinitialize the generator +# you have to write: +# par[1] = unur_srou_new(@distr@); +# unur_srou_chg_domain(gen,0.9,0.91); +# unur_srou_upd_pdfarea(gen); +# unur_srou_upd_mode(gen); +# unur_srou_reinit(gen); +# +# +# [validate - distributions:] +# List of distributions. Each distribution object has to be +# declared by the corresponding UNU.RAN calls. +# Different distibutions are separated by empty lines. +# If a pointer to a double array is required use `darray'. +# If an array for parameters of the PDF is required use `fpm'. +# The distribution object must be called `distr[x]', where +# `x' is an integer. `x' is used to refer to this distribution +# object. +# +# IMPORTANT: when there n distributions, all the `x' must be +# different and run through 1,...,n. There is no checking! (However +# the C compiler might complain.) +# +# +# [validate - test chi2:] +# Run chi-square goodness-of-fit tests. +# The threshold p-value for a failure is set by the constant +# PVAL_LIMIT in file 'testunuran.h' (currently 1.e-3). +# A failed test is repeated once. +# The entire test is failed if +# - a particular test fails twice +# - more than 'CHI2_FAILURES_TOLERATED' particular tests fail +# at least once +# The default for CHI2_FAILURES_TOLERATED is 2 and can be changed +# In section [main] in the '*.conf' file (see above). +# Notice: "Real" failures count for 1000 "soft" failures. +# +# The section contains a table which test has to be performed. +# Each line starts with `
' where `dd' indicates the number of the +# distributions as declared in section [validate - distributions:]. +# One lines contains the tests that should be performed by with +# a particular distribution. +# Each line consists of the `
' marker followed by a list of +# one character symbols. All entries are separated by white space +# characters. There must be one symbol for each of the generator +# types declared in subsection [validate - generators:] that +# describes the expected result of the test when performed with the +# choosen generator and the choosen distribution. +# The following symbols can be used: +# + should pass test +# % should initialize generator and draw small sample (for memory debugging) +# 0 should fail to initialize generator +# - should fail to iniialize or fail the test (not implemented yet) +# / either init fails or test successful (necessary for special generators) +# . do not run the test +# +# Each line can be preceded by the letters 'x' or 'X' to exclude the +# corresponding tests from 'make check' runs. +# These optional tests are then only run when the environment variable +# 'UNURANFULLCHECK' is defined (regardless of the actual value of the +# variable). Likewise it is possible to mark particular tests for a +# distribution by prefixing the corresponding symbol ('+', '0', '-', +# '/', or '.') by a single 'x' or 'X'; no blanks are allowed between +# 'x' and the symbol. +# +# Example: +# +# #par [0] [1] [2] +# #--------------------------- +# <0> + + . +# <1> - + 0 +# <2> - + 0 +# <3> + + - +# <4> + - . +# x<5> + . - +# <6> x+ + x+ +# +# That is: +# run test and expect that the test is passed for +# distribution 0 with generator 0 and 1 +# distribution 1 with generator 1 +# distribution 2 with generator 1 +# distribution 3 with generator 0 and 1 +# distribution 4 with generator 0 +# expect that initialization of the generator fails +# distribution 1 with generator 2 +# distribution 2 with generator 2 +# expect that initialization of the generator fails or +# that the test is expected to fail for +# distribution 1 with generator 0 +# distribution 2 with generator 0 +# distribution 3 with generator 2 +# distribution 4 with generator 1 +# do not run the test for +# distribution 0 with generator 2 +# distribution 4 with generator 2 +# +# run the tests only in fullcheck mode for +# distribution 5 +# distribution 6 with generators 0 and 2 +# +# Notice that the line +# #par [0] [1] [2] +# is just a comment line for convinience. Moreover the numbering +# [0], [1], and [2] coincides with the order of definition in the +# subsection [validate - generators:]. +# +# [validate - verify hat:] +# Tests if condition of method is satisfied. It counts the number +# occurences when unur_errno is equal to UNUR_ERR_GEN_CONDITION, +# i.e. when when one of the following conditions is violated +# squeeze <= PDF <= hat +# or a violation is detected during an adaptive step. +# +# Contains a table which test has to be performed. +# Each line starts with `
' where `dd' indicates the number of the +# distributions as declared in section [validate - distributions:]. +# One lines contains the tests that should be performed by with +# a particular distribution. +# Each line consists of the `
' marker followed by a list of +# one character symbols. All entries are separated by white space +# characters. There must be one symbol for each of the generator +# types declared in subsection [validate - generators:] that +# describes the expected result of the test when performed with the +# choosen generator and the choosen distribution. +# The following symbols can be used: +# + should pass test +# ~ condition might fail in at most 1% of all samples +# 0 should fail to initialize generator +# - should fail to iniialize or fail the test (not implemented yet) +# / either init fails or test successful (necessary for special generators) +# . do not run the test +# +# Each line can be preceded by the letters 'x' or 'X' to exclude the +# corresponding tests from 'make check' runs. +# These optional tests are then only run when the environment variable +# 'UNURANFULLCHECK' is defined (regardless of the actual value of the +# variable). Likewise it is possible to mark particular tests for a +# distribution by prefixing the corresponding symbol ('+', '~', '0', '-', +# '/', or '.') by a single 'x' or 'X'; no blanks are allowed between +# 'x' and the symbol. +# +# Example: +# +# #par [0] [1] [2] +# #--------------------------- +# <0> + ~ . +# <1> - + 0 +# <2> - + 0 +# <3> + + - +# <4> + - . +# x<5> + . - +# <6> x+ + x+ +# +# That is: +# run test and expect that the test is passed for +# distribution 0 with generator 0 +# distribution 1 with generator 1 +# distribution 2 with generator 1 +# distribution 3 with generator 0 and 1 +# distribution 4 with generator 0 +# run test and expect that in at most of 1% the test fails for +# distribution 0 with generator 1 +# expect that initialization of the generator fails +# distribution 1 with generator 2 +# distribution 2 with generator 2 +# expect that initialization of the generator fails or +# that the test is expected to fail for +# distribution 1 with generator 0 +# distribution 2 with generator 0 +# distribution 3 with generator 2 +# distribution 4 with generator 1 +# do not run the test for +# distribution 0 with generator 2 +# distribution 4 with generator 2 +# +# run the tests only in fullcheck mode for +# distribution 5 +# distribution 6 with generators 0 and 2 +# +# Notice that the line +# #par [0] [1] [2] +# is just a comment line for convinience. Moreover the numbering +# [0], [1], and [2] coincides with the order of definition in the +# subsection [validate - generators:]. +# +# +############################################################################# +# +# All other sections +# +# Each of these sections decribe tests. +# For each subsection definitions can be but into the subsection label, +# eg.: [reinit - exist: +# double fpar[2] = {0.,1.}; +# distr = unur_distr_normal(fpar,2); +# par = unur_srou_new(distr); +# gen = unur_init( par ); <-- ! NULL ] +# (the "<-- ! NULL" (in the same line) indicates, that the result should +# be checked for an invalid NULL pointer.) +# +# The following names _must_ be used through out. +# distr ... for distribution objects. +# par ... for parameter objects. +# gen ... for generator objects. +# These there variables are declared automatically whenever they occur. +# +# Tests are separated by empty lines. Each test has the form +# [ ] --> [ --> ] +# (the first and the third part are optional). +# +# eg.: +# unur_srou_new( distr ); +# --> expected_NULL --> UNUR_ERR_NULL +# +# It is also possible to insert C code without a test, e.g. for +# freeing some memory. +# +# A ~ (tilde) at the beginning of a line is expanded to +# unur__. +# e.g. in file srou.c, section [set] +# ~_cdfatmode(par,0.); is equivalent to unur_srou_set_cdfatmode(par,0.); +# +# +# List of tests: +# +# --> none +# do not check return value (useful if only error code in unur_errno +# should be tested). +# +# --> expected_NULL +# check if the last C call returns a NULL pointer. +# +# --> expected_zero +# check if the last C call return zero (int 0). +# +# --> expected_INFINITY +# --> expected_negINFINITY +# check if last C call returns UNUR_INFINITY or -UNUR_INFINITY, resp. +# +# --> expected_INTMAX +# check if the last C call return INTMAX (of type int). +# +# --> expected_setfailed +# check if the last set of chg call has failed. +# +# --> expected_reinit +# check if unur_reinit works. +# +# --> run_verify_generator +# run a generator in the verifying mode. +# +# --> compare_sequence_par_start +# --> compare_sequence_par +# compare random string generated by generator created by last +# parameter object with the random string generated by generator +# object from the last compare_double_sequence_par_start test. +# +# --> compare_sequence_gen +# --> compare_sequence_gen_start +# Analogously except that a generator object is used. +# +# -->compare_double_sequence_urng_start +# Analogously but for the output of uniform random number generators. +# +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/make_test_files.pl b/vendor/unuran-1.11.0/tests/make_test_files.pl new file mode 100755 index 0000000..2869ea4 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/make_test_files.pl @@ -0,0 +1,1232 @@ +#!/usr/bin/perl +############################################################################## +# # +# UNURAN -- Universal Non-Uniform Random number generator # +# # +############################################################################## +# # +# FILE: make_test_files.pl # +# # +# Read test config file and create C file for tests # +# # +############################################################################## +# # +# Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold # +# Department of Statistics and Mathematics, WU Wien, Austria # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the # +# Free Software Foundation, Inc., # +# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA # +# # +############################################################################## + +use English; +use strict; + +# --------------------------------------------------------------------------- + +sub usage { + my $progname = $0; + $progname =~ s#^.*/##g; + + print STDERR < + + Scans , generates the C source for test routines, + and writes it on stdout. + File must have suffix "conf". + +EOM + +} # end of usage() + +# --------------------------------------------------------------------------- +# read arguments + +# src directory +my $src_dir = shift or die "No argument given"; +usage and die "$src_dir: No such directory" unless -d $src_dir; + +# --------------------------------------------------------------------------- +# Constants + +# unuran header file +my $unuran_h_file = "$src_dir/src/unuran.h"; + +# program name +my $name_program = $0; +$name_program =~ s#^.*/##g; + +# --------------------------------------------------------------------------- +# seed for uniform random number generator. + +my $seed = $ENV{SEED} + 0.; +unless ($seed) { $seed = int(rand 1000000) + 1; } + +# --------------------------------------------------------------------------- +# Global variables + +my %DATA; # store all data in config file + +# special data we want ... +my $method; # generation method (lower case letters) +my $METHOD; # (upper case letters) +my $gen_type; # type of generation method +my $distr_type; # type of distribution +my $C_header_aux; # part to be added to C header +my @header_files; # additional header file included in *.conf + +my @othersections = ("new", "set", "get", "chg", "init", "reinit", "sample"); + +my $test_routines; + +my $verify_prototype; +my $verify_routine; + +# --------------------------------------------------------------------------- + +############################################################################# +# # +# Main # +# # +############################################################################# + +# --------------------------------------------------------------------------- +# read in input file name from argument list ... +# it must hve suffix .conf +my $file_in = shift; +usage and die unless $file_in and $file_in =~ /\.conf$/; + +# get base name of file +my $file_name = $file_in; +$file_name =~ s#^.*/##g; +$file_name =~ s/\.conf$//; + +# name of log files +my $file_testlog = "$file_name\_test\.log"; +my $file_unuranlog = "$file_name\_unuran\.log"; + +# add unuran header file +push @header_files, $unuran_h_file; + +# read data +read_data($file_in); + +# scan data and print +scan_main(); + +# create verify routine (if necessary) +make_unur_set_verify_routine(); + +# print +print_C_header(); +scan_verbatim(); +foreach my $s (@othersections) { + scan_other($s); } +scan_validate(); +scan_special(); +print_C_routines(); +print $verify_routine; +print_C_main(); + +# --------------------------------------------------------------------------- +# End + +exit(0); + +############################################################################# +# # +# Read data # +# # +############################################################################# + +sub read_data { + my $file = shift; + + open (CONF, "$file") or die "Cannot open file $file for reading"; + + my $section = "start"; # lines before first section are stored in section "start" + my $subsection = "start"; # lines before first subsection are stored in subsection "start" + my $header; # header of subsection + my $body; # body of subsection + my $ssc = 0; # number of subsection (to store order in input file) + + while () { + # first remove comments + next if /^\#/; + s/(? # + s/\\\#/\#/g; + + # search for included header files + if (/^\s*\#\s*include\s+[\"\<](.*)[\"\>]/) { + push @header_files, "$src_dir/$1"; + } + + if (/^\s*\[/) { + # new (sub)section starts here + # save body of last subsection + $DATA{$section}[$ssc]{"title"} = $subsection; + $DATA{$section}[$ssc]{"header"} = $header; + $DATA{$section}[$ssc]{"body"} = $body; + + ++$ssc; # increment counter + $header = ""; # reset entry of subsection header + $body = ""; # reset entry of subsection body + + if (/^\s*\[\s*(.*?)\s*-\s*(.*?)\s*\:/) { + # subsection header + if ($1 ne $section) { die "Invalid subsection $_ in section [$section]"; } + # update subsection name + $subsection = $2; + # find header of subsection (search for closing "]") + unless (/\]\s*$/) { + until ($header =~ /\]\s*$/) { $header .= "$INPUT_LINE_NUMBER:".; } + # chop off closing bracket + $header =~ s/\]\s*$//; + } + } + + elsif (/^\s*\[\s*(.*?)\s*\]/) { + # section header + if ($DATA{$1}) { die "section already defined"; } + # update section name and reset subsection name + $section = $1; + $subsection = "start"; + $ssc = 0; + } + + else { + die "Line $INPUT_LINE_NUMBER startet with '[' but is neither section nor subsection"; + } + } + + else { + # subsection body + $body .= ($INPUT_LINE_NUMBER-1).":$_"; + } + } + close CONF; + + # store last section + $DATA{$section}[$ssc]{"title"} = $subsection; + $DATA{$section}[$ssc]{"header"} = $header; + $DATA{$section}[$ssc]{"body"} = $body; + + # debug_print_data(); + +} # end of read_data() + +# --------------------------------------------------------------------------- + +sub debug_print_data { + + foreach my $s (keys %DATA) { + print "[$s]\n"; + foreach my $subs (@{$DATA{$s}}) { + print "[$s \@ ".${$subs}{"title"}."]\n"; + print ${$subs}{"header"}."\n"; + print ${$subs}{"body"}."\n"; + } + } +} # end of debug_print_data() + + +############################################################################# +# # +# Scan section [main] # +# # +############################################################################# + +sub scan_main { + + $DATA{"main"} or die "section [main] missing"; + + # scan subsection + foreach my $subs (@{$DATA{"main"}}) { + my $title = ${$subs}{"title"}; + my $body = ${$subs}{"body"}; + MAINSUBS: { + if ($title eq "start") { + # ignore + last MAINSUBS; + } + if ($title eq "data") { + # name of method + if ("\n$body" =~ /\n\d+\:\s*method\s*:\s*(\w+)/) { + $method = $1; + $method =~ tr/[A-Z]/[a-z]/; + $METHOD = $method; + $METHOD =~ tr/[a-z]/[A-Z]/; + } + last MAINSUBS; + } + if ($title eq "header") { + # additonal part for C header + $C_header_aux = $body; + $C_header_aux =~ s/(^|\n)\d+\:/\n/g; # remove line info + last MAINSUBS; + } + else { + die "Unknown subsection $title for [main]"; + } + } + } + + # check data + $method or die "Data missing"; + + # mark as read + undef $DATA{"main"}; + +} # end if scan_main() + + +############################################################################# +# # +# Scan section [verbatim] # +# # +############################################################################# + +sub scan_verbatim { + + $DATA{"verbatim"} or return ""; + + print "/*---------------------------------------------------------------------------*/\n"; + print "/* [verbatim] */\n\n"; + + # There must be only one subsection: [start] + + # scan subsection + foreach my $subs (@{$DATA{"verbatim"}}) { + my $title = ${$subs}{"title"}; + my $body = ${$subs}{"body"}; + if ($title eq "start") { + $body =~ s/(^|\n)\d+\:/\n/g; # remove line info + print $body; + } + else { + die "No subsections allowed in [verbatim]"; + } + } + + # mark as read + undef $DATA{"verbatim"}; + +} # end if scan_verbatim() + + +############################################################################# +# # +# Scan section [validate] # +# # +############################################################################# + +sub scan_validate { + + $DATA{"validate"} or return ""; + + $test_routines .= "test_validate();\n"; + + print "/*---------------------------------------------------------------------------*/\n"; + print "/* [validate] */\n\n"; + + my $section = "validate"; + my @generators; + my @distributions; + my $chi2; + my $verifyhat; + + # scan subsection + foreach my $subs (@{$DATA{"validate"}}) { + my $title = ${$subs}{"title"}; + my $body = ${$subs}{"body"}; + + VALIDATESUBS: { + if ($title eq "start") { + last VALIDATESUBS; } + if ($title eq "generators") { + @generators = get_blocks( $section, $body, 0 ); + last VALIDATESUBS; } + if ($title eq "distributions") { + @distributions = get_blocks( $section, $body, 0 ); + last VALIDATESUBS; } + + # remove line info and empty lines + $body =~ s/(^|\n)\d+\:/\n/g; + $body =~ s/\n\s*\n/\n/g; + $body =~ s/^\s*\n//; + + if ($title eq "test chi2") { + $chi2 = $body; + last VALIDATESUBS; } + if ($title eq "verify hat") { + $verifyhat = $body; + last VALIDATESUBS; } + else { + die "Unknown subsection $title for [$section]"; + } + } + } + + # number of given distributions + my $n_distributions = $#distributions + 1; + + # number of generators + my $n_generators = $#generators + 1; + + print "/*---------------------------------------------------------------------------*/\n\n"; + print "/* [$section] */\n\n"; + print "void test_validate (void)\n{\n"; + + print "\t/* suppress GCC compiler warning */\n"; + print "GCC_DIAG_OFF(unused-variable)\n\n"; + + print "\tUNUR_DISTR *distr[".($n_distributions?$n_distributions:1)."];\n"; + print "\tUNUR_PAR *par;\n"; + print "\tUNUR_GEN *gen;\n"; + print "\tdouble *darray;\n"; + print "\tdouble fpm[10];\n"; + + print "\tint n_tests_failed;\n"; + print "\tint rcode;\n"; + + print "\n\t/* start test */\n"; + print "\tprintf(\"[validate \"); fflush(stdout);\n"; + print "\tfprintf(TESTLOG,\"\\n[validate]\\n\");\n\n"; + print "\t/* reset counter */\n\tn_tests_failed = 0;\n\n"; + + print "\t/* set stop watch */\n"; + print "\tstopwatch_lap(&watch);\n\n"; + + ## list of distributions ## + + print "\n/* distributions: $n_distributions */\n"; + foreach my $d (@distributions) { + print "{\n$d}\n\n"; + } + + print "\t/* timing */\n"; + print "\tstopwatch_print(TESTLOG,\"\\n<*>setup time = %.3f ms\\n\", stopwatch_lap(&watch));\n\n"; + + # --- chisquare GoF tests ----- + + if ($chi2) { + + # analyse chi^2 tests + my @chi2tests = split /\n/, $chi2; + + unless ($#chi2tests <= $#distributions) { + die "wrong number of chi2 tests ($#chi2tests > $#distributions)"; + } + + print "\tprintf(\"\\n(chi^2) \"); fflush(stdout);\n"; + print "\n/* chi^2 tests: ".($#generators+1)*$n_distributions." */\n\n"; + print "\tunur_set_default_debug(~UNUR_DEBUG_SAMPLE);\n"; + print "\tfprintf( TESTLOG,\"\\nChi^2 Test:\\n\");\n\n"; + + foreach my $test (@chi2tests) { + die "invalide test line" unless ($test =~ /^\s*([fFxX]?)\s*<(\d+)>\s*(.+)/); + my $fullcheck_dist = $1; + my $n_distr = $2; + $test = $3; + $test =~ s/^\s+//; + $test =~ s/\s+$//; + my @gentest = split /\s+/, $test; + die "invalide number of test indicators" unless ($#gentest == $#generators); + + print "/* distribution [$n_distr] */\n\n"; + + foreach (@generators) { + # get entry for generator + my $genline = $_; + + # remove [..] from par[..] + # (it is just to number generators for convience) + $genline =~ s/par\[(\d+)\]/par/g; + + # insert local copy of distribution object + $genline =~ s/\@distr\@/distr_localcopy/g; + + # read what we have to test + my $todo = shift @gentest; + + # test for an "fullcheckonly" flag + my $fullcheck_gen = 0; + if ($todo =~ /^[fFxX](.+)/) { + $fullcheck_gen = 1; + $todo = $1; + } + + # we encapsulate test into "if(TRUE)" or + # "if(fullcheck)" statements. + if ($fullcheck_dist || $fullcheck_gen) { + print "\tif(fullcheck) {\n"; + } + else { + print "\tif(TRUE) {\n"; + } + + # nothing to do + if ( $todo eq '.' ) { + print "\tprintf(\".\"); fflush(stdout);\n"; + print "\t}\n\n"; + next; + } + + # split into lines again + my @lines = split /\n/, $genline; + + # print lines + print "\tunur_reset_errno();\n"; + print "\tdo {\n"; + print "\tUNUR_DISTR *distr_localcopy = unur_distr_clone(distr[$n_distr]);\n"; + + my $have_gen_lines = 0; + foreach my $l (@lines) { + if ($l =~ /gen/ and !$have_gen_lines) { + $have_gen_lines = 1; + print "\tgen = unur_init(par);\n\tif (gen) {\n"; + } + + print "$l\n"; + + # we cannot run the test if par == NULL. + # then essential parameters are missing. + # if ($l =~ /^\s*par\s*=\s*/) { + # print "\tif (par==NULL) { printf(\"X\"); fflush(stdout); break; }\n"; + #} + } + + if ($have_gen_lines) { + print "\t}\n"; + } + else { + print "\tgen = unur_init(par);\n"; + } + print "\trcode = run_validate_chi2(TESTLOG,0,gen,distr[$n_distr],'$todo');\n"; + print "\tn_tests_failed += (rcode==UNUR_SUCCESS)?0:1;\n"; + print "\tn_tests_failed += (rcode==UNUR_FAILURE)?1000:0;\n"; + print "\tunur_free(gen);\n"; + print "\tunur_distr_free(distr_localcopy);\n"; + print "\t} while (0);\n"; + + # end of if() statement + print "\t}\n\n"; + } + } + + print "\t/* timing */\n"; + print "\tstopwatch_print(TESTLOG,\"\\n<*>time = %.0f ms\\n\", stopwatch_lap(&watch));\n\n"; + } + + ## run in verify mode ## + + if ($verifyhat) { + + # analyse verify hat tests + my @verifyhattests = split /\n/, $verifyhat; + die "wrong number of verify hat tests" unless ($#verifyhattests <= $#distributions); + + print "\tprintf(\"\\n(verify hat) \"); fflush(stdout);\n"; + print "\n/* verify hat tests: ".($#generators+1)*$n_distributions." */\n\n"; + print "\tunur_set_default_debug(~UNUR_DEBUG_SAMPLE);\n"; + print "\tfprintf( TESTLOG,\"\\nVerify Hat Test (squeeze <= PDF <= hat):\\n\");\n\n"; + + foreach my $test (@verifyhattests) { + die "invalide test line" unless ($test =~ /^\s*([fFxX]?)\s*<(\d+)>\s*(.+)/); + my $fullcheck_dist = $1; + my $n_distr = $2; + $test = $3; + $test =~ s/^\s+//; + $test =~ s/\s+$//; + my @gentest = split /\s+/, $test; + die "invalide number of test indicators" unless ($#gentest == $#generators); + + print "/* distribution [$n_distr] */\n\n"; + + foreach (@generators) { + # get entry for generator + my $genline = $_; + + # remove [..] from par[..] + # (it is just to number generators for convience) + $genline =~ s/par\[(\d+)\]/par/g; + + # insert local copy of distribution object + $genline =~ s/\@distr\@/distr_localcopy/g; + + # read what we have to test + my $todo = shift @gentest; + + # replace '+' by '~' + $todo =~ s/\+/\~/; + + # test for an "fullcheckonly" flag + my $fullcheck_gen = 0; + if ($todo =~ /^[fFxX](.+)/) { + $fullcheck_gen = 1; + $todo = $1; + } + + # we encapsulate test into "if(TRUE)" or + # "if(fullcheck)" statements. + if ($fullcheck_dist || $fullcheck_gen) { + print "\tif(fullcheck) {\n"; + } + else { + print "\tif(TRUE) {\n"; + } + + # nothing to do + if ( $todo eq '.' ) { + print "\tprintf(\".\"); fflush(stdout);\n"; + print "\t}\n\n"; + next; + } + + # split into lines again + my @lines = split /\n/, $genline; + + # print lines + print "\tunur_reset_errno();\n"; + print "\tdo {\n"; + print "\tUNUR_DISTR *distr_localcopy = unur_distr_clone(distr[$n_distr]);\n"; + + my $have_gen_lines = 0; + foreach my $l (@lines) { + if ($l =~ /gen/ and !$have_gen_lines) { + $have_gen_lines = 1; + print "\tgen = unur_init(par);\n\tif (gen) {\n"; + } + + print "$l\n"; + if ($l =~ /^\s*par\s*=/) { + print "\tunur_$method\_set_pedantic(par,0);\n"; + + # we cannot run the test if par == NULL. + # then essential parameters are missing. + # print "\tif (par==NULL) { printf(\"X\"); fflush(stdout); break; }\n"; + } + + } + + if ($have_gen_lines) { + print "\t}\n"; + } + else { + print "\tgen = unur_init(par);\n"; + } + print "\tif (gen) unur_$method\_chg_verify(gen,1);\n"; + # such an error is fatal. so we must make sure that we get a FAIL + # and override the sloppy definition of FAIL (CHI2_FAILURES_TOLERATED are allowed for chi^2) + print "\tn_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[$n_distr],'$todo')==UNUR_SUCCESS)?0:1000;\n"; + print "\tunur_free(gen);\n\n"; + print "\tunur_distr_free(distr_localcopy);\n"; + print "\t} while (0);\n"; + + # end of if() statement + print "\t}\n\n"; + } + } + + print "\t/* timing */\n"; + print "\tstopwatch_print(TESTLOG,\"\\n<*>time = %.0f ms\\n\", stopwatch_lap(&watch));\n\n"; + } + + ## free distributions ## + + print "\n/* free distributions */\n"; + for (my $i=0; $i<$n_distributions; ++$i) { + print "\tunur_distr_free(distr[$i]);\n"; + } + + ## end ## + + print "\n\t/* test finished */\n"; + print "\ttest_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1;\n"; + print "\t/* we accept CHI2_FAILURES_TOLERATED failures */\n"; + print "\t(n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(\" ==> failed] \") : printf(\" ==> ok] \");\n"; + + print "\n} /* end of test_validate */\n\n"; + print "/* enable GCC compiler warning */\n"; + print "GCC_DIAG_ON(unused-variable)\n\n"; + + # mark as read + undef $DATA{"validate"}; + +} # end if scan_validate() + + + +############################################################################# +# # +# Scan section [special] # +# # +############################################################################# + +sub scan_special { + + my $section = "special"; + + $DATA{"$section"} or return ""; + + $test_routines .= "test_$section();\n"; + + print <time = %.3f ms\\n\\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (FAILED) ? 0 : 1; + (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_$section() */ + +EOM + + # mark as read + undef $DATA{$section}; + +} # end if scan_special() + + +############################################################################# +# # +# Scan all other sections # +# # +############################################################################# + +sub scan_other { + my $section = shift; + + $DATA{$section} or return ""; + + $test_routines .= "test_$section();\n"; + + print </, $block; + + # is there any test ? + unless ($test_command) { + print $code if defined $code; + next; + } + + # split code into lines again ... + my @blines = split /\n/, $code; + + # get last C command ... + undef my $last_C_line; + while ( $last_C_line = pop @blines ) { + last if $last_C_line =~ /\w+/; + last if !defined $last_C_line; + } + $last_C_line =~ s/;\s*$// if defined $last_C_line; + + # print ... + print "\nunur_reset_errno();\n"; + + # C lines ... + foreach my $bl (@blines) { + print "$bl\n"; + } + + # test ... + print_test_command( $test_command, $last_C_line, $lineno ); + + # error code ... + $errno =~ s/[\s\n]+//g if defined $errno; + print "n_tests_failed += (check_errorcode(TESTLOG,$lineno,$errno)==UNUR_SUCCESS)?0:1\;\n" if $errno; + } + + # close subsection ... + print "$subsection_closing}\n\n"; + } + + # print section closing ... + print <time = %.3f ms\\n\\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_$section() */ + +EOM + + # mark as read + undef $DATA{$section}; + +} # end if scan_other() + + +############################################################################# +# # +# break into blocks (separated by blank lines) # +# # +############################################################################# + +sub get_blocks { + my $section = shift; + my $body = shift; + my $withlineno = shift; + + my @blocks; + my $block; + my @lines = split /\n/, $body; + + foreach my $line (@lines) { + $line .= "\n"; + $line =~ s/^(\d+)\://; + my $lineno = $1 or die "internal error"; + + # convert line starting with ~ ... + $line =~ s/~/unur_$method\_$section/ if $line =~ /^~/; + + if ($line =~ /\w+/) { + # append line to block + $block .= $line; } + else { + # empty line --> block completed + # (we ignore lines without letters) + $lineno = $withlineno ? "$lineno:" : ""; + push @blocks, "$lineno$block" if $block =~ /\w+/; + + # goto next block + $block = ""; + } + } + + return @blocks; +} # end of get_blocks() + + +############################################################################# +# # +# print test command # +# # +############################################################################# + +sub print_test_command { + my $test_command = $_[0]; + my $last_C_line = $_[1]; + my $lineno = $_[2]; + + SWITCH: { + if ($test_command =~ /^\s*none\s*/ ) { + $test_command =~ s/\s+//g; + print "$last_C_line\;\n"; + last SWITCH; + } + if ($test_command =~ /^\s*expected_NULL\s*/ or + $test_command =~ /^\s*expected_setfailed\s*/ or + $test_command =~ /^\s*expected_zero\s*/ or + $test_command =~ /^\s*expected_INFINITY\s*/ or + $test_command =~ /^\s*expected_negINFINITY\s*/ or + $test_command =~ /^\s*expected_INTMAX\s*/ or + $test_command =~ /^\s*expected_reinit\s*/) { + $test_command =~ s/\s+//g; + print "n_tests_failed += (check_$test_command\(TESTLOG,$lineno,($last_C_line))==UNUR_SUCCESS)?0:1\;\n"; + last SWITCH; + } + if ($test_command =~ /^\s*compare_sequence_gen\s*$/ or + $test_command =~ /^\s*compare_sequence_gen_start\s*$/ ) { + $test_command =~ s/\s+//g; + print "$last_C_line\;\n"; + print "n_tests_failed += ($test_command\(TESTLOG,$lineno,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1;\n"; + last SWITCH; + } + if ($test_command =~ /^\s*compare_sequence_par\s*$/ or + $test_command =~ /^\s*compare_sequence_par_start\s*$/ ) { + $test_command =~ s/\s+//g; + print "$last_C_line\;\n"; + print "n_tests_failed += ($test_command\(TESTLOG,$lineno,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1;\n"; + last SWITCH; + } + if ($test_command =~ /^\s*compare_sequence_urng_start\s*$/ ) { + $test_command =~ s/\s+//g; + print "$last_C_line\;\n"; + print "$test_command\(TESTLOG,$lineno,COMPARE_SAMPLE_SIZE);\n"; + last SWITCH; + } + if ($test_command =~ /^\s*run_verify_generator\s*$/) { + print "$last_C_line\;\n"; + print "$test_command(TESTLOG,$lineno,par);\n"; + last SWITCH; + } + + # otherwise + die "Unknown test command: \"$test_command\""; + } + +} # end print_test_command() + +############################################################################# +# # +# print C header, main, and auxiliary routines # +# # +############################################################################# + +sub print_C_header { + + print "/*\n\tfile automatically generated by $name_program\n\t"; + print scalar localtime; + print "\n*/\n\n"; + + print < +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +$verify_prototype + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + +$C_header_aux + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +EOM + +} # end of print_C_header() + +############################################################################# + +sub print_C_main { + + print <total time = %.0f ms\\n\\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + +EOM + +} # end of print_C_main() + +############################################################################# + +sub print_C_routines { + + print <) { + $have_found = 1 if /$verify/; + } + close (H); + } + + unless ($have_found) { + $verify_routine = "int $verify(UNUR_PAR *par ATTRIBUTE__UNUSED, int verify ATTRIBUTE__UNUSED) {return 0;}\n"; + $verify_prototype = "int unur_$method\_set_verify( UNUR_PAR *par, int verify);\n"; + + } + else { + $verify_routine = ""; + $verify_prototype = ""; + } +} + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_arou.c b/vendor/unuran-1.11.0/tests/t_arou.c new file mode 100644 index 0000000..cfa6862 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_arou.c @@ -0,0 +1,4420 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for AROU + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ +double pdf( double x, const UNUR_DISTR *distr ); + +double pdf_bimodal( double x, const UNUR_DISTR *distr ); +double dpdf_bimodal( double x, const UNUR_DISTR *distr ); + +double pdf_negative( double x, const UNUR_DISTR *distr ); +double dpdf_negative( double x, const UNUR_DISTR *distr ); + +double pdf_partnegative( double x, const UNUR_DISTR *distr ); +double dpdf_partnegative( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + +/* #define SEED (298346) */ + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* pdf of bimodal density */ +double pdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ( exp(-(x-1.)*(x-1.)) + exp(-(x+1.)*(x+1.)) ); +} +double dpdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ( -2. * (x-1.) * exp(-(x-1.)*(x-1.)) -2. * (x+1.) * exp(-(x+1.)*(x+1.)) ); +} + +/* pdf with negative value */ +double pdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-x*x); +} +double dpdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-2.*x); +} + +/* pdf with partial negative value */ +double pdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((x>-0.89 && x<0.89) ? -1.: exp(-x*x)); +} +double dpdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((x>-0.89 && x<0.89) ?0.: -2.*x*exp(-x*x)); +} + +/* pdf of normal density */ +double pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return exp(-x*x/2.); +} /* end of pdf */ + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt */ +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ +double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1.; + y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1.; + y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x -= 1.; + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,45,(unur_arou_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,51,(unur_arou_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,51,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +/* pdf, dpdf */ +n_tests_failed += (check_expected_NULL(TESTLOG,58,(unur_arou_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,58,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* dpdf */ +unur_distr_cont_set_pdf(distr,pdf); +n_tests_failed += (check_expected_NULL(TESTLOG,63,(unur_arou_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,73,(unur_arou_set_usedars( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,73,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,76,(unur_arou_set_darsfactor( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_arou_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,82,(unur_arou_set_guidefactor( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,82,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,85,(unur_arou_set_max_sqhratio( par, 0.95 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,85,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,88,(unur_arou_set_max_segments( par, 100 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,91,(unur_arou_set_usecenter( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,94,(unur_arou_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,97,(unur_arou_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,97,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_tdr_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_arou_set_usedars( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,109,(unur_arou_set_darsfactor( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,109,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,112,(unur_arou_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,112,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,115,(unur_arou_set_guidefactor( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,115,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,118,(unur_arou_set_max_sqhratio( par, 0.95 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,118,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,121,(unur_arou_set_max_segments( par, 100 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,121,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,124,(unur_arou_set_usecenter( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,124,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,127,(unur_arou_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,127,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,130,(unur_arou_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,130,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double stp[] = {1.,0.,1.}; + int n_stp = 3; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,143,(unur_arou_set_darsfactor( par, -1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,143,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,146,(unur_arou_set_cpoints( par, -1, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,146,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,149,(unur_arou_set_cpoints( par, n_stp, stp )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,149,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,152,(unur_arou_set_guidefactor( par, -1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,152,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,155,(unur_arou_set_max_sqhratio( par, -1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,155,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,158,(unur_arou_set_max_sqhratio( par, 2. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,158,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,161,(unur_arou_set_max_segments( par, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,161,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 171, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,175,(unur_arou_get_sqhratio(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,175,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,178,(unur_arou_get_hatarea(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,178,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,181,(unur_arou_get_squeezearea(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,181,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_srou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 191, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,195,(unur_arou_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,195,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,206,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,206,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* stp out of domain */ +UNUR_GEN *gen = NULL; +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double stp[] = {-2.5,-1.,0.,1.,2.5}; + int n_stp = 5; + gen = NULL; + distr = unur_distr_normal(NULL,0); + unur_distr_cont_set_domain(distr,-2.,2.); + par = unur_arou_new(distr); + unur_arou_set_cpoints( par, n_stp, stp ); + + +unur_reset_errno(); +gen = unur_init( par ); +n_tests_failed += (check_errorcode(TESTLOG,218,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; +unur_free(gen); +unur_distr_free(distr); +} + +{ /* bimodal */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_bimodal); + unur_distr_cont_set_dpdf(distr,dpdf_bimodal); + par = unur_arou_new(distr); + unur_arou_set_cpoints( par, 30, NULL ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,228,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,228,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* negative value of pdf */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_negative); + unur_distr_cont_set_dpdf(distr,dpdf_negative); + par = NULL; + + +unur_reset_errno(); +par = unur_arou_new(distr); +unur_arou_set_cpoints( par, 30, NULL ); +n_tests_failed += (check_expected_NULL(TESTLOG,239,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,239,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_distr_cont_set_domain(distr,-2.,2.); +par = unur_arou_new(distr); +unur_arou_set_cpoints( par, 30, NULL ); +n_tests_failed += (check_expected_NULL(TESTLOG,245,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,245,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* does not exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 253, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,257,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,257,UNUR_ERR_NO_REINIT)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,260,(unur_sample_cont( gen )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,260,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* partial negative value of pdf */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + int i; + double x; + double stp[] = {-0.9,0.9}; + int n_stp = 2; + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_partnegative); + unur_distr_cont_set_dpdf(distr,dpdf_partnegative); + par = unur_arou_new(distr); + unur_arou_set_usedars(par,FALSE); + unur_arou_set_cpoints( par, n_stp, stp ); + unur_arou_set_pedantic( par, 1 ); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 278, gen ); + + +unur_reset_errno(); +for (i=0; i<100; i++) { x = unur_sample_cont(gen); } +n_tests_failed += (check_expected_INFINITY(TESTLOG,283,(x))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,283,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_arou_new(distr); +unur_arou_set_max_sqhratio(par,0.); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,297,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,303,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[10]; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_normal(NULL,0); +par = unur_arou_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,333,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal & method = arou" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,338,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +gen = unur_str2gen( "normal() & method = arou" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,342,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +gen = unur_str2gen( "normal(0.,1.) & method = arou" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,346,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +gen = unur_str2gen( "normal(0,1) & method = arou" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,350,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +gen = unur_str2gen( "distr = normal(0,1) & method = arou" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,354,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +fpar[0] = 1.; +fpar[1] = 2.; +distr = unur_distr_normal(fpar,2); +par = unur_arou_new(distr); +unur_arou_set_usedars(par,1); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,363,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal(1,2) & method = arou; usedars" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,368,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +fpar[0] = 1.; +fpar[1] = 2.; +distr = unur_distr_normal(fpar,2); +par = unur_arou_new(distr); +unur_arou_set_usedars(par,1); +unur_arou_set_darsfactor(par,0.1); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,378,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal(1,2) & method = arou; usedars; darsfactor=0.1" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,383,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +fpar[0] = 1.; +fpar[1] = 2.; +distr = unur_distr_normal(fpar,2); +unur_distr_cont_set_domain(distr,0.,2.); +par = unur_arou_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,392,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal(1,2); domain = 0, 2 & method = arou" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,397,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +gen = unur_str2gen( "normal(1,2); domain = (0,2) & method = arou" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,401,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_normal(NULL,0); +par = unur_arou_new(distr); +fpar[0] = -2; +fpar[1] = -1.5; +fpar[2] = -1; +fpar[3] = -0.5; +fpar[4] = 0; +fpar[5] = 0.5; +fpar[6] = 1; +fpar[7] = 1.5; +fpar[8] = 2; +unur_arou_set_cpoints(par,9,fpar); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,417,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal() & \ + method = arou; cpoints = (-2,-1.5,-1,-0.5,0,0.5,1,1.5,2)" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,423,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_normal(NULL,0); +unur_distr_cont_set_center(distr,0.); +par = unur_arou_new(distr); +unur_arou_set_cpoints(par,20,NULL); +unur_arou_set_guidefactor(par,1.); +unur_arou_set_max_segments(par,40); +unur_arou_set_max_sqhratio(par,0.5); +unur_arou_set_pedantic(par,FALSE); +unur_arou_set_usecenter(par,TRUE); +unur_arou_set_verify(par,TRUE); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,437,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal(); center=0. & \ + method = arou; \ + cpoints = 20; guidefactor = 1.; max_segments = 40; \ + max_sqhratio = 0.5; pedantic = off; usecenter = true; verify = on" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,445,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[33]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 33 */ +{ +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 2.; +fpm[1] = 1.; +distr[32] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 2.; +fpm[1] = 5.; +distr[30] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 2.; +distr[31] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); +} + +{ +distr[7] = unur_distr_cauchy(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); +} + +{ +distr[24] = unur_distr_exponential(NULL,0); +} + +{ +fpm[0] = 30.; +fpm[1] = -5.; +distr[25] = unur_distr_exponential(fpm,2); +} + +{ +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[16] = unur_distr_gamma(fpm,3); +} + +{ +distr[26] = unur_distr_laplace(NULL,0); +} + +{ +fpm[0] = -10.; +fpm[1] = 100.; +distr[27] = unur_distr_laplace(fpm,2); +} + +{ +distr[17] = unur_distr_normal(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); +} + +{ +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); +} + +{ +distr[20] = unur_distr_uniform(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); +} + +{ +distr[28] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[28],pdf_sqrtlin); +unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlin); +unur_distr_cont_set_cdf(distr[28],cdf_sqrtlin); +unur_distr_set_name(distr[28],"sqrtlin"); +} + +{ +distr[29] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[29],pdf_sqrtlinshft); +unur_distr_cont_set_dpdf(distr[29],dpdf_sqrtlinshft); +unur_distr_cont_set_cdf(distr[29],cdf_sqrtlinshft); +unur_distr_set_name(distr[29],"sqrtlin"); +} + +{ +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[23] = unur_distr_beta(fpm,2); +unur_distr_cont_set_domain(distr[23],-2.,5.); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 99 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [32] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [31] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 99 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [32] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [31] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_arou_new(distr_localcopy); + unur_arou_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + gen = unur_init(par); + if (gen) unur_arou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + unur_distr_free(distr[30]); + unur_distr_free(distr[31]); + unur_distr_free(distr[32]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_arou_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_arou.conf b/vendor/unuran-1.11.0/tests/t_arou.conf new file mode 100644 index 0000000..79b8a35 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_arou.conf @@ -0,0 +1,803 @@ +############################################################################# + +[main] + +[main - data:] + +# method +method: AROU + +[main - header:] + +/* prototypes */ +double pdf( double x, const UNUR_DISTR *distr ); + +double pdf_bimodal( double x, const UNUR_DISTR *distr ); +double dpdf_bimodal( double x, const UNUR_DISTR *distr ); + +double pdf_negative( double x, const UNUR_DISTR *distr ); +double dpdf_negative( double x, const UNUR_DISTR *distr ); + +double pdf_partnegative( double x, const UNUR_DISTR *distr ); +double dpdf_partnegative( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* \#define SEED (298346) */ + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_cont_new(); ] + +/* pdf, dpdf */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +/* dpdf */ +unur_distr_cont_set_pdf(distr,pdf); +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_usedars( par, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_darsfactor( par, 1. ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_cpoints( par, 0, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_guidefactor( par, 1. ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_max_sqhratio( par, 0.95 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_max_segments( par, 100 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_usecenter( par, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_verify( par, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_pedantic( par, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameter object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_tdr_new(distr); ] + +~_usedars( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_darsfactor( par, 1. ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_cpoints( par, 0, NULL ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_guidefactor( par, 1. ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_max_sqhratio( par, 0.95 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_max_segments( par, 100 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_usecenter( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_verify( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_pedantic( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + +[set - invalid parameters: + double stp[] = {1.,0.,1.}; + int n_stp = 3; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); ] + + +~_darsfactor( par, -1. ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_cpoints( par, -1, NULL ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_cpoints( par, n_stp, stp ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_guidefactor( par, -1. ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_max_sqhratio( par, -1. ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_max_sqhratio( par, 2. ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_max_segments( par, 0 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + +############################################################################# + +[get] + +[get - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + gen = unur_init(par); <-- ! NULL ] + +~_sqhratio(gen); + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + +~_hatarea(gen); + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + +~_squeezearea(gen); + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + +############################################################################# + +[chg] + +[chg - invalid generator object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_srou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_verify(gen,1); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + +[init - stp out of domain: + double stp[] = {-2.5,-1.,0.,1.,2.5}; + int n_stp = 5; + gen = NULL; + distr = unur_distr_normal(NULL,0); + unur_distr_cont_set_domain(distr,-2.,2.); + par = unur_arou_new(distr); + unur_arou_set_cpoints( par, n_stp, stp ); ] + +gen = unur_init( par ); + --> none --> UNUR_ERR_GEN_DATA + +[init - bimodal: + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_bimodal); + unur_distr_cont_set_dpdf(distr,dpdf_bimodal); + par = unur_arou_new(distr); + unur_arou_set_cpoints( par, 30, NULL ); ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_CONDITION + +[init - negative value of pdf: + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_negative); + unur_distr_cont_set_dpdf(distr,dpdf_negative); + par = NULL; ] + +par = unur_arou_new(distr); +unur_arou_set_cpoints( par, 30, NULL ); +unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_CONDITION + +unur_distr_cont_set_domain(distr,-2.,2.); +par = unur_arou_new(distr); +unur_arou_set_cpoints( par, 30, NULL ); +unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_DATA + +############################################################################# + +[reinit] + +[reinit - does not exist: + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_setfailed --> UNUR_ERR_NO_REINIT + +unur_sample_cont( gen ); + --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION + + +############################################################################# + +[sample] + +[sample - partial negative value of pdf: + int i; + double x; + double stp[] = {-0.9,0.9}; + int n_stp = 2; + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_partnegative); + unur_distr_cont_set_dpdf(distr,dpdf_partnegative); + par = unur_arou_new(distr); + unur_arou_set_usedars(par,FALSE); + unur_arou_set_cpoints( par, n_stp, stp ); + unur_arou_set_pedantic( par, 1 ); + gen = unur_init( par ); <-- ! NULL ] + +for (i=0; i<100; i++) { x = unur_sample_cont(gen); } +x; + --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_arou_new(distr); +unur_arou_set_max_sqhratio(par,0.); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + + +# due to optimizations of the compiler the following test +# fails for some compilers with some options (!?) +# +#[sample - compare: +# distr = unur_distr_normal(NULL,0); +# par = NULL; ] +# +#/* default algorithm */ +#par = unur_arou_new(distr); +# -->compare_sequence_par_start +# +#/* verifying mode */ +#par = unur_arou_new(distr); +#unur_arou_set_verify(par,1); +# -->compare_sequence_par + +#..................................................................... + +[sample - compare stringparser: + double fpar[10]; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_normal(NULL,0); +par = unur_arou_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal & method = arou" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "normal() & method = arou" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "normal(0.,1.) & method = arou" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "normal(0,1) & method = arou" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "distr = normal(0,1) & method = arou" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +fpar[0] = 1.; +fpar[1] = 2.; +distr = unur_distr_normal(fpar,2); +par = unur_arou_new(distr); +unur_arou_set_usedars(par,1); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal(1,2) & method = arou; usedars" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +fpar[0] = 1.; +fpar[1] = 2.; +distr = unur_distr_normal(fpar,2); +par = unur_arou_new(distr); +unur_arou_set_usedars(par,1); +unur_arou_set_darsfactor(par,0.1); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal(1,2) & method = arou; usedars; darsfactor=0.1" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +fpar[0] = 1.; +fpar[1] = 2.; +distr = unur_distr_normal(fpar,2); +unur_distr_cont_set_domain(distr,0.,2.); +par = unur_arou_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal(1,2); domain = 0, 2 & method = arou" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "normal(1,2); domain = (0,2) & method = arou" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +distr = unur_distr_normal(NULL,0); +par = unur_arou_new(distr); +fpar[0] = -2; +fpar[1] = -1.5; +fpar[2] = -1; +fpar[3] = -0.5; +fpar[4] = 0; +fpar[5] = 0.5; +fpar[6] = 1; +fpar[7] = 1.5; +fpar[8] = 2; +unur_arou_set_cpoints(par,9,fpar); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal() & \ + method = arou; cpoints = (-2,-1.5,-1,-0.5,0,0.5,1,1.5,2)" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +distr = unur_distr_normal(NULL,0); +unur_distr_cont_set_center(distr,0.); +par = unur_arou_new(distr); +unur_arou_set_cpoints(par,20,NULL); +unur_arou_set_guidefactor(par,1.); +unur_arou_set_max_segments(par,40); +unur_arou_set_max_sqhratio(par,0.5); +unur_arou_set_pedantic(par,FALSE); +unur_arou_set_usecenter(par,TRUE); +unur_arou_set_verify(par,TRUE); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal(); center=0. & \ + method = arou; \ + cpoints = 20; guidefactor = 1.; max_segments = 40; \ + max_sqhratio = 0.5; pedantic = off; usecenter = true; verify = on" ); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default program (without DARS) +par[0] = unur_arou_new(@distr@); +unur_arou_set_usedars(par,0); + +# use dars +par[1] = unur_arou_new(@distr@); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + +# small squeeze / hat ratio +par[2] = unur_arou_new(@distr@); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_max_sqhratio(par,0.5); + +[validate - distributions:] + +# Beta distributions +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); + +fpm[0] = 2.; +fpm[1] = 1.; +distr[32] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); + +fpm[0] = 2.; +fpm[1] = 5.; +distr[30] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 2.; +distr[31] = unur_distr_beta(fpm,2); + +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); + +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); + +# Cauchy distributions +distr[7] = unur_distr_cauchy(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); + +# Exponential distributions +distr[24] = unur_distr_exponential(NULL,0); + +fpm[0] = 30.; +fpm[1] = -5.; +distr[25] = unur_distr_exponential(fpm,2); + +# Gamma distributions +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); + +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); + +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); + +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); + +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); + +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[16] = unur_distr_gamma(fpm,3); + +# Laplace distributions +distr[26] = unur_distr_laplace(NULL,0); + +fpm[0] = -10.; +fpm[1] = 100.; +distr[27] = unur_distr_laplace(fpm,2); + +# Normal distributions +distr[17] = unur_distr_normal(NULL,0); + +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); + +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); + +# Uniform distributions +distr[20] = unur_distr_uniform(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); + +# pdf with piecewise linear function as transformed density with T = -1/sqrt +distr[28] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[28],pdf_sqrtlin); +unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlin); +unur_distr_cont_set_cdf(distr[28],cdf_sqrtlin); +unur_distr_set_name(distr[28],"sqrtlin"); + +# pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode +distr[29] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[29],pdf_sqrtlinshft); +unur_distr_cont_set_dpdf(distr[29],dpdf_sqrtlinshft); +unur_distr_cont_set_cdf(distr[29],cdf_sqrtlinshft); +unur_distr_set_name(distr[29],"sqrtlin"); + +# truncated distributions +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); + +# domain exceeds support of pdf +fpm[0] = 3.; +fpm[1] = 4.; +distr[23] = unur_distr_beta(fpm,2); +unur_distr_cont_set_domain(distr[23],-2.,5.); + + +# number of distributions: 33 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] without DARS +# [1] with DARS +# [2] small squeeze / hat ratio +# +#gen [0] [1] [2] # distribution +#--------------------------------------------- + <0> + + + # beta (1, 2) + <32> + + + # beta (2, 1) + <1> + + + # beta (1, 5) +x <2> + + + # beta (1, 100) + <30> + + + # beta (2, 5) + <31> + + + # beta (5, 2) + <3> + + + # beta (3, 4) +x <4> + + + # beta (5, 100) +x <5> + + + # beta (500, 300) + <6> + + + # beta (5, 10, -3, 15) + <24> + + + # exponential () +x<25> + + + # exponential (30, -5) + <7> + + + # cauchy () +x <8> + + + # cauchy (1, 20) + <9> + + + # gamma (1) + <10> + + + # gamma (2) + <11> + + + # gamma (3) + <12> + + + # gamma (10) +x<13> + + + # gamma (1000) + <14> + + + # gamma (5, 1000, 0) +x<15> + + + # gamma (5, 1e-05, 0) +x<16> + + + # gamma (5, 10, 100000) + <26> + + + # laplace () + <27> + + + # laplace (-10, 100) + <17> + + + # normal () +x<18> + + . # normal (1, 1e-05) + <19> + + + # normal (1, 1e+05) + <20> + + + # uniform () + <21> + + + # uniform (1, 20) + + <22> + + + # cauchy () - truncated + <23> + + + # beta () - domain superset of support + +#<28> + + + # pdf with piecewise linear function as transformed density with T = -1/sqrt +#<29> . . . # [28] with shifted mode + + +[validate - verify hat:] + +# + ... pass test +# ~ ... fail in at most 1% of samples +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] without DARS +# [1] with DARS +# [2] small squeeze / hat ratio +# +#gen [0] [1] [2] # distribution +#--------------------------------------------- + <0> + + + # beta (1, 2) + <32> + + + # beta (2, 1) + <1> + + + # beta (1, 5) +x <2> + + + # beta (1, 100) + <30> + + + # beta (2, 5) + <31> + + + # beta (5, 2) + <3> + + + # beta (3, 4) +x <4> + + + # beta (5, 100) +x <5> + + + # beta (500, 300) + <6> + + + # beta (5, 10, -3, 15) + <24> + + + # exponential () +x<25> + + + # exponential (30, -5) + <7> + + + # cauchy () + <8> + + + # cauchy (1, 20) + <9> + + + # gamma (1) + <10> + + + # gamma (2) + <11> + + + # gamma (3) + <12> + + + # gamma (10) +x<13> + + + # gamma (1000) + <14> + + + # gamma (5, 1000, 0) +x<15> + + + # gamma (5, 1e-05, 0) +x<16> + + + # gamma (5, 10, 100000) + <26> + + + # laplace () + <27> + + + # laplace (-10, 100) + <17> + + + # normal () +x<18> + + + # normal (1, 1e-05) + <19> + + + # normal (1, 1e+05) + <20> + + + # uniform () + <21> + + + # uniform (1, 20) + + <22> + + + # cauchy () - truncated + <23> + + + # beta () - domain superset of support + +#<28> + + + # pdf with piecewise linear function as transformed density with T = -1/sqrt +#<29> . . . # [28] with shifted mode + + + +############################################################################# +############################################################################# + +[verbatim] + +/* pdf of bimodal density */ +double pdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ( exp(-(x-1.)*(x-1.)) + exp(-(x+1.)*(x+1.)) ); +} +double dpdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ( -2. * (x-1.) * exp(-(x-1.)*(x-1.)) -2. * (x+1.) * exp(-(x+1.)*(x+1.)) ); +} + +/* pdf with negative value */ +double pdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-x*x); +} +double dpdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-2.*x); +} + +/* pdf with partial negative value */ +double pdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((x>-0.89 && x<0.89) ? -1.: exp(-x*x)); +} +double dpdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((x>-0.89 && x<0.89) ?0.: -2.*x*exp(-x*x)); +} + +/* pdf of normal density */ +double pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return exp(-x*x/2.); +} /* end of pdf */ + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt */ +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ +double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1.; + y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1.; + y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x -= 1.; + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_ars.c b/vendor/unuran-1.11.0/tests/t_ars.c new file mode 100644 index 0000000..8ac5eb4 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_ars.c @@ -0,0 +1,7965 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for ARS + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ +double logpdf_normal_1( double x, const UNUR_DISTR *distr ); +double dlogpdf_normal_1( double x, const UNUR_DISTR *distr ); +double cdf_normal_1( double x, const UNUR_DISTR *distr ); +double logpdf_normal_2( double x, const UNUR_DISTR *distr ); +double dlogpdf_normal_2( double x, const UNUR_DISTR *distr ); +double cdf_normal_2( double x, const UNUR_DISTR *distr ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + +/* #define SEED (298346) */ + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* logPDF of normal density */ +double logpdf_normal_1( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-x*x/2. - 10000.); +} +double dlogpdf_normal_1( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-x); +} + +static UNUR_DISTR *normal_1 = NULL; +void remove_normal_1(void) { unur_distr_free(normal_1); } + +double cdf_normal_1( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + static double fpm[2] = {0., 1.}; + if (normal_1 == NULL) { + normal_1 = unur_distr_normal(fpm,2); + atexit(remove_normal_1); + } + return unur_distr_cont_eval_cdf( x, normal_1 ); +} + +/* ......................................................................... */ + +#define mu_2 (100.) + +double logpdf_normal_2( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-(x-mu_2)*(x-mu_2)/2. - 10000.); +} +double dlogpdf_normal_2( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-(x-mu_2)); +} + +double cdf_normal_2( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + static UNUR_DISTR *normal_2 = NULL; + static double fpm[2] = {mu_2, 1.}; + if (normal_2 == NULL) normal_2 = unur_distr_normal(fpm,2); + return unur_distr_cont_eval_cdf( x, normal_2 ); +} + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,33,(unur_ars_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,33,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,39,(unur_ars_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,39,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_normal_wo_logpdf(NULL,0); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,45,(unur_ars_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +/* logpdf, dlogpdf */ +n_tests_failed += (check_expected_NULL(TESTLOG,53,(unur_ars_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* dlogpdf */ +unur_distr_cont_set_logpdf(distr,logpdf_normal_1); +n_tests_failed += (check_expected_NULL(TESTLOG,58,(unur_ars_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,58,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_ars_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,71,(unur_ars_set_reinit_percentiles( par, 0, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,71,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,74,(unur_ars_set_reinit_ncpoints( par, 20 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,74,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,77,(unur_ars_set_max_intervals( par, 100 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,77,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,80,(unur_ars_set_max_iter( par, 100 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,80,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,83,(unur_ars_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,83,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,86,(unur_ars_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,86,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,94,(unur_ars_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,97,(unur_ars_set_reinit_percentiles( par, 0, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,97,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,100,(unur_ars_set_reinit_ncpoints( par, 30 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,100,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,103,(unur_ars_set_max_intervals( par, 100 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,103,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_ars_set_max_iter( par, 100 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,109,(unur_ars_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,109,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,112,(unur_ars_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,112,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double stp[] = {1.,0.,1.}; + double perc[] = {0.1,0.4,0.2}; + int n_stp = 3; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_ars_new(distr); + + +unur_reset_errno(); +unur_ars_set_cpoints( par, -1, NULL ); +n_tests_failed += (check_errorcode(TESTLOG,125,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,128,(unur_ars_set_cpoints( par, n_stp, stp )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,128,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_ars_set_reinit_percentiles( par, -1, NULL ); +n_tests_failed += (check_errorcode(TESTLOG,131,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,134,(unur_ars_set_reinit_percentiles( par, n_stp, stp )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,134,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,137,(unur_ars_set_reinit_percentiles( par, n_stp, perc )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,137,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,140,(unur_ars_set_reinit_ncpoints( par, 9 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,140,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,143,(unur_ars_set_max_intervals( par, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,143,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,146,(unur_ars_set_max_iter( par, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,146,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 156, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,160,(unur_ars_get_loghatarea(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,160,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_tdr_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 170, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,174,(unur_ars_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,174,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,177,(unur_ars_chg_reinit_percentiles(gen, -1, NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,177,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,180,(unur_ars_chg_reinit_ncpoints(gen, 30)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,180,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double percmon[] = {0.1,0.4,0.2}; + double percdom[] = {0.1,0.4,2.}; + int n_perc = 3; + distr = unur_distr_normal(NULL,0); + par = unur_ars_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 189, gen ); + + +unur_reset_errno(); +unur_ars_chg_reinit_percentiles( gen, -1, NULL ); +n_tests_failed += (check_errorcode(TESTLOG,193,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,196,(unur_ars_chg_reinit_percentiles( gen, n_perc, percmon )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,196,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,199,(unur_ars_chg_reinit_percentiles( gen, n_perc, percdom )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,199,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,202,(unur_ars_chg_reinit_ncpoints( gen, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,202,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,213,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,213,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* stp out of domain */ +UNUR_GEN *gen = NULL; +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double stp[] = {-2.5,-1.,0.,1.,2.5}; + int n_stp = 5; + gen = NULL; + distr = unur_distr_normal(NULL,0); + unur_distr_cont_set_domain(distr,-2.,2.); + par = unur_ars_new(distr); + unur_ars_set_cpoints( par, n_stp, stp ); + + +unur_reset_errno(); +gen = unur_init( par ); +n_tests_failed += (check_errorcode(TESTLOG,225,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; +unur_free(gen); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_ars_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 234, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,238,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,248,(unur_ars_eval_invcdfhat(gen,0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,248,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 254, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,258,(unur_ars_eval_invcdfhat(gen,0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,258,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid domain */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_ars_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 264, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,268,(unur_ars_eval_invcdfhat(gen,1.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,268,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_negINFINITY(TESTLOG,271,(unur_ars_eval_invcdfhat(gen,-0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,271,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; + + +unur_reset_errno(); +/* default */ +par = unur_ars_new(distr); +n_tests_failed += (compare_sequence_par_start(TESTLOG,281,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* verifying mode */ +par = unur_ars_new(distr); +unur_ars_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,286,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* don't use private copy for distr object */ +par = unur_ars_new(distr); +unur_set_use_distr_privatecopy(par,FALSE); +n_tests_failed += (compare_sequence_par(TESTLOG,291,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* verifying mode, don't use private copy for distr object */ +par = unur_ars_new(distr); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,297,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double fpar[] = {1.23456,2.3456}; + distr = unur_distr_normal(fpar,2); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_ars_new(distr); +unur_ars_set_max_intervals(par,2); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,312,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,318,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* dont use private copy for distr object */ +/* original generator object */ +unur_free(clone); +par = unur_ars_new(distr); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_max_intervals(par,2); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,327,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,333,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_ars_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,345,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,349,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {3.,3.}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_gamma(fpar,2); +par = unur_ars_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,362,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & method = ars "); +n_tests_failed += (compare_sequence_gen(TESTLOG,367,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_gamma(fpar,2); +par = unur_ars_new(distr); +unur_ars_set_cpoints(par,20,NULL); +unur_ars_set_max_intervals(par,32); +unur_ars_set_verify(par,TRUE); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,377,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & \ + method = ars; cpoints = 20; \ + max_intervals = 32; verify" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,384,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[31]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 31 */ +{ +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 2.; +fpm[1] = 5.; +distr[3] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 2.; +distr[4] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[5] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 100.; +distr[6] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 500.; +fpm[1] = 300.; +distr[7] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[8] = unur_distr_beta(fpm,4); +} + +{ +distr[9] = unur_distr_cauchy(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[10] = unur_distr_cauchy(fpm,2); +} + +{ +distr[11] = unur_distr_exponential(NULL,0); +} + +{ +fpm[0] = 30.; +fpm[1] = -5.; +distr[12] = unur_distr_exponential(fpm,2); +} + +{ +fpm[0] = 1.; +distr[13] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 2.; +distr[14] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 3.; +distr[15] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 10.; +distr[16] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 1000.; +distr[17] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 5.; +fpm[1] = 1000.; +distr[18] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[19] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[20] = unur_distr_gamma(fpm,3); +} + +{ +distr[21] = unur_distr_laplace(NULL,0); +} + +{ +fpm[0] = -10.; +fpm[1] = 100.; +distr[22] = unur_distr_laplace(fpm,2); +} + +{ +distr[23] = unur_distr_normal(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[24] = unur_distr_normal(fpm,2); +} + +{ +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[25] = unur_distr_normal(fpm,2); +} + +{ +distr[26] = unur_distr_uniform(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[27] = unur_distr_uniform(fpm,2); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[28] = unur_distr_beta(fpm,2); +unur_distr_cont_set_domain(distr[23],-2.,5.); +} + +{ +distr[29] = unur_distr_cont_new(); +unur_distr_cont_set_logpdf(distr[29],logpdf_normal_1); +unur_distr_cont_set_dlogpdf(distr[29],dlogpdf_normal_1); +unur_distr_cont_set_cdf(distr[29],cdf_normal_1); +unur_distr_set_name(distr[29],"normal_1"); +} + +{ +distr[30] = unur_distr_cont_new(); +unur_distr_cont_set_logpdf(distr[30],logpdf_normal_2); +unur_distr_cont_set_dlogpdf(distr[30],dlogpdf_normal_2); +unur_distr_cont_set_cdf(distr[30],cdf_normal_2); +unur_distr_set_name(distr[30],"normal_2"); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 217 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [17] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [18] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [19] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [20] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [29] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [30] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ars_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ars_new(distr_localcopy); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ars_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 217 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [17] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [18] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [19] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [20] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [29] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [30] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ars_new(distr_localcopy); + unur_ars_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_ars_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + unur_distr_free(distr[30]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_ars_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_ars.conf b/vendor/unuran-1.11.0/tests/t_ars.conf new file mode 100644 index 0000000..f64be7b --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_ars.conf @@ -0,0 +1,729 @@ +############################################################################# + +[main] + +[main - data:] + +# method +method: ARS + +[main - header:] + +/* prototypes */ +double logpdf_normal_1( double x, const UNUR_DISTR *distr ); +double dlogpdf_normal_1( double x, const UNUR_DISTR *distr ); +double cdf_normal_1( double x, const UNUR_DISTR *distr ); +double logpdf_normal_2( double x, const UNUR_DISTR *distr ); +double dlogpdf_normal_2( double x, const UNUR_DISTR *distr ); +double cdf_normal_2( double x, const UNUR_DISTR *distr ); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* \#define SEED (298346) */ + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_normal_wo_logpdf(NULL,0); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + + +[new - data missing in distribution object: + distr = unur_distr_cont_new(); ] + +/* logpdf, dlogpdf */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +/* dlogpdf */ +unur_distr_cont_set_logpdf(distr,logpdf_normal_1); +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_cpoints( par, 0, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_reinit_percentiles( par, 0, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_reinit_ncpoints( par, 20 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_max_intervals( par, 100 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_max_iter( par, 100 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_verify( par, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_pedantic( par, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameter object: + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); ] + +~_cpoints( par, 0, NULL ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_reinit_percentiles( par, 0, NULL ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_reinit_ncpoints( par, 30 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_max_intervals( par, 100 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_max_iter( par, 100 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_verify( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_pedantic( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + +[set - invalid parameters: + double stp[] = {1.,0.,1.}; + double perc[] = {0.1,0.4,0.2}; + int n_stp = 3; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_ars_new(distr); ] + +~_cpoints( par, -1, NULL ); + --> none --> UNUR_ERR_PAR_SET + +~_cpoints( par, n_stp, stp ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_reinit_percentiles( par, -1, NULL ); + --> none --> UNUR_ERR_PAR_SET + +~_reinit_percentiles( par, n_stp, stp ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_reinit_percentiles( par, n_stp, perc ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_reinit_ncpoints( par, 9 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_max_intervals( par, 0 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_max_iter( par, 0 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + +############################################################################# + +[get] + +[get - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + gen = unur_init(par); <-- ! NULL ] + +~_loghatarea(gen); + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + +############################################################################# + +[chg] + +[chg - invalid generator object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_tdr_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_verify(gen,1); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +~_reinit_percentiles(gen, -1, NULL); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +~_reinit_ncpoints(gen, 30); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + + +[chg - invalid parameters: + double percmon[] = {0.1,0.4,0.2}; + double percdom[] = {0.1,0.4,2.}; + int n_perc = 3; + distr = unur_distr_normal(NULL,0); + par = unur_ars_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_reinit_percentiles( gen, -1, NULL ); + --> none --> UNUR_ERR_PAR_SET + +~_reinit_percentiles( gen, n_perc, percmon ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_reinit_percentiles( gen, n_perc, percdom ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_reinit_ncpoints( gen, 0 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + +[init - stp out of domain: + double stp[] = {-2.5,-1.,0.,1.,2.5}; + int n_stp = 5; + gen = NULL; + distr = unur_distr_normal(NULL,0); + unur_distr_cont_set_domain(distr,-2.,2.); + par = unur_ars_new(distr); + unur_ars_set_cpoints( par, n_stp, stp ); ] + +gen = unur_init( par ); + --> none --> UNUR_ERR_GEN_DATA + + +############################################################################# + +[reinit] + +[reinit - exist: + distr = unur_distr_normal(NULL,0); + par = unur_ars_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - invalid NULL ptr: + gen = NULL; ] + +unur_ars_eval_invcdfhat(gen,0.5); + --> expected_INFINITY --> UNUR_ERR_NULL + +#..................................................................... + +[sample - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init(par); <-- ! NULL ] + +unur_ars_eval_invcdfhat(gen,0.5); + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + +#..................................................................... + +[sample - invalid domain: + distr = unur_distr_normal(NULL,0); + par = unur_ars_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_ars_eval_invcdfhat(gen,1.5); + --> expected_INFINITY --> UNUR_ERR_DOMAIN + +unur_ars_eval_invcdfhat(gen,-0.5); + --> expected_negINFINITY --> UNUR_ERR_DOMAIN + +#..................................................................... + +[sample - compare: + distr = unur_distr_normal(NULL,0); + par = NULL; ] + +/* default */ +par = unur_ars_new(distr); + -->compare_sequence_par_start + +/* verifying mode */ +par = unur_ars_new(distr); +unur_ars_set_verify(par,1); + -->compare_sequence_par + +/* don't use private copy for distr object */ +par = unur_ars_new(distr); +unur_set_use_distr_privatecopy(par,FALSE); + -->compare_sequence_par + +/* verifying mode, don't use private copy for distr object */ +par = unur_ars_new(distr); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_verify(par,1); + -->compare_sequence_par + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + double fpar[] = {1.23456,2.3456}; + distr = unur_distr_normal(fpar,2); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_ars_new(distr); +unur_ars_set_max_intervals(par,2); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +/* dont use private copy for distr object */ +/* original generator object */ +unur_free(clone); +par = unur_ars_new(distr); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_max_intervals(par,2); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare reinit: + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_ars_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + double fpar[2] = {3.,3.}; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_gamma(fpar,2); +par = unur_ars_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & method = ars "); + -->compare_sequence_gen + + +unur_free(gen); gen = NULL; +distr = unur_distr_gamma(fpar,2); +par = unur_ars_new(distr); +unur_ars_set_cpoints(par,20,NULL); +unur_ars_set_max_intervals(par,32); +unur_ars_set_verify(par,TRUE); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & \ + method = ars; cpoints = 20; \ + max_intervals = 32; verify" ); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default (few starting points) +par[0] = unur_ars_new(@distr@); + +# many starting points +par[1] = unur_ars_new(@distr@); +unur_ars_set_cpoints(par,30,NULL); + +# few starting points, ARS switchted off +par[2] = unur_ars_new(@distr@); +unur_ars_set_cpoints(par,3,NULL); +unur_ars_set_max_intervals(par,10); + +# no private copy of distr object, many starting points +par[3] = unur_ars_new(@distr@); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,30,NULL); + +# reinitialized with changed parameters +par[4] = unur_ars_new(@distr@); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(@distr@,fpm,2); +unur_reinit(gen); + +# reinitialized with changed parameters, use percentiles +par[5] = unur_ars_new(@distr@); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(@distr@,fpm,2); +unur_ars_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + +# reinitialized with changed parameters, use percentiles +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par[6] = unur_ars_new(@distr@); +unur_set_use_distr_privatecopy(par,FALSE); +unur_ars_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(@distr@,fpm,2); +unur_ars_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + + +[validate - distributions:] + +# Beta distributions +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); + +fpm[0] = 2.; +fpm[1] = 5.; +distr[3] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 2.; +distr[4] = unur_distr_beta(fpm,2); + +fpm[0] = 3.; +fpm[1] = 4.; +distr[5] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 100.; +distr[6] = unur_distr_beta(fpm,2); + +fpm[0] = 500.; +fpm[1] = 300.; +distr[7] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[8] = unur_distr_beta(fpm,4); + +# Cauchy distributions +distr[9] = unur_distr_cauchy(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[10] = unur_distr_cauchy(fpm,2); + +# Exponential distributions +distr[11] = unur_distr_exponential(NULL,0); + +fpm[0] = 30.; +fpm[1] = -5.; +distr[12] = unur_distr_exponential(fpm,2); + +# Gamma distributions +fpm[0] = 1.; +distr[13] = unur_distr_gamma(fpm,1); + +fpm[0] = 2.; +distr[14] = unur_distr_gamma(fpm,1); + +fpm[0] = 3.; +distr[15] = unur_distr_gamma(fpm,1); + +fpm[0] = 10.; +distr[16] = unur_distr_gamma(fpm,1); + +fpm[0] = 1000.; +distr[17] = unur_distr_gamma(fpm,1); + +fpm[0] = 5.; +fpm[1] = 1000.; +distr[18] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[19] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[20] = unur_distr_gamma(fpm,3); + +# Laplace distributions +distr[21] = unur_distr_laplace(NULL,0); + +fpm[0] = -10.; +fpm[1] = 100.; +distr[22] = unur_distr_laplace(fpm,2); + +# Normal distributions +distr[23] = unur_distr_normal(NULL,0); + +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[24] = unur_distr_normal(fpm,2); + +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[25] = unur_distr_normal(fpm,2); + +# Uniform distributions +distr[26] = unur_distr_uniform(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[27] = unur_distr_uniform(fpm,2); + +# domain exceeds support of pdf +fpm[0] = 3.; +fpm[1] = 4.; +distr[28] = unur_distr_beta(fpm,2); +unur_distr_cont_set_domain(distr[23],-2.,5.); + +# normal distributions with very bad normalization constant +distr[29] = unur_distr_cont_new(); +unur_distr_cont_set_logpdf(distr[29],logpdf_normal_1); +unur_distr_cont_set_dlogpdf(distr[29],dlogpdf_normal_1); +unur_distr_cont_set_cdf(distr[29],cdf_normal_1); +unur_distr_set_name(distr[29],"normal_1"); + +distr[30] = unur_distr_cont_new(); +unur_distr_cont_set_logpdf(distr[30],logpdf_normal_2); +unur_distr_cont_set_dlogpdf(distr[30],dlogpdf_normal_2); +unur_distr_cont_set_cdf(distr[30],cdf_normal_2); +unur_distr_set_name(distr[30],"normal_2"); + + +# number of distributions: 31 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] default (few starting points) +# [1] many starting points +# [2] few starting points, ARS switchted off +# [3] no private copy of distr object, many starting points +# [4] reinitialized with changed parameters +# [5] reinitialized with changed parameters, use percentiles +# [6] reinitialized with changed parameters, use percentiles +# +# 0 1 2 3 4 5 6 # distribution +#---------------------------------------- +x <0> + + + + + + + # beta (1, 2) + <1> + + + + + + + # beta (1, 5) +x <2> + + + + + + + # beta (1, 100) +x <3> + + + + + + + # beta (2, 5) + <4> + + + + + + + # beta (5, 2) + <5> + + + + + + + # beta (3, 4) +x <6> + + + + + + + # beta (5, 100) +x <7> + + + + + + + # beta (500, 300) + <8> + + + + + + + # beta (5, 10, -3, 15) + <9> - - - - . . . # cauchy () +x<10> - - - - . . . # cauchy (1, 20) + <11> + + + + + + + # exponential () + <12> + + + + + + + # exponential (30, -5) +x<13> + + + + . . . # gamma (1) + <14> + + + + . . . # gamma (2) + <15> + + + + . . . # gamma (3) + <16> + + + + . . . # gamma (10) +x<17> + + . + . . . # gamma (1000) + <18> + + . + . . . # gamma (5, 1000, 0) +x<19> + + . + . . . # gamma (5, 1e-05, 0) +x<20> + + . + . . . # gamma (5, 10, 100000) + <21> + + + + + + + # laplace () + <22> + + + + + + + # laplace (-10, 100) + <23> + + + + + + + # normal () + <24> + + . + + + + # normal (1, 1e-05) + <25> + + . + + + + # normal (1, 1e+05) + <26> + + + + + + + # uniform () +x<27> + + + + + + + # uniform (1, 20) + + <28> + + + + + + + # beta (3,4) - domain superset of support + <29> + + + + . . . # normal(0,1) with bad normalization constant +x<30> + + . + . . . # normal(100,1) with bad normalization constant + + +[validate - verify hat:] + +# + ... pass test +# ~ ... fail in at most 1% of samples +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] default (few starting points) +# [1] many starting points +# [2] few starting points, ARS switchted off +# [3] no private copy of distr object, many starting points +# [4] reinitialized with changed parameters +# [5] reinitialized with changed parameters, use percentiles +# [6] reinitialized with changed parameters, use percentiles +# +# 0 1 2 3 4 5 6 # distribution +#---------------------------------------- +x <0> + + + + + + + # beta (1, 2) + <1> + + + + + + + # beta (1, 5) +x <2> + + + + + + + # beta (1, 100) +x <3> + + + + + + + # beta (2, 5) + <4> + + + + + + + # beta (5, 2) + <5> + + + + + + + # beta (3, 4) +x <6> + + + + + + + # beta (5, 100) +x <7> + + + + + + + # beta (500, 300) + <8> + + + + + + + # beta (5, 10, -3, 15) + <9> - - - - . . . # cauchy () +x<10> - - . - . . . # cauchy (1, 20) + <11> + + + + + + + # exponential () + <12> + + + + . . . # exponential (30, -5) +x<13> + + + + . . . # gamma (1) + <14> + + + + . . . # gamma (2) + <15> + + + + . . . # gamma (3) + <16> + + + + . . . # gamma (10) +x<17> + + . + . . . # gamma (1000) + <18> + + . + . . . # gamma (5, 1000, 0) +x<19> + + . + . . . # gamma (5, 1e-05, 0) +x<20> + + . + . . . # gamma (5, 10, 100000) + <21> + + + + + + + # laplace () + <22> + + + + + + + # laplace (-10, 100) + <23> + + + + + + + # normal () + <24> + + . + + + + # normal (1, 1e-05) + <25> + + . + + + + # normal (1, 1e+05) + <26> + + + + + + + # uniform () +x<27> + + + + + + + # uniform (1, 20) + + <28> + + + + + + + # beta (3,4) - domain superset of support + <29> + + + + . . . # normal(0,1) with bad normalization constant +x<30> + + . + . . . # normal(100,1) with bad normalization constant + + +############################################################################# +############################################################################# + +[verbatim] + +/* logPDF of normal density */ +double logpdf_normal_1( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-x*x/2. - 10000.); +} +double dlogpdf_normal_1( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-x); +} + +static UNUR_DISTR *normal_1 = NULL; +void remove_normal_1(void) { unur_distr_free(normal_1); } + +double cdf_normal_1( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + static double fpm[2] = {0., 1.}; + if (normal_1 == NULL) { + normal_1 = unur_distr_normal(fpm,2); + atexit(remove_normal_1); + } + return unur_distr_cont_eval_cdf( x, normal_1 ); +} + +/* ......................................................................... */ + +\#define mu_2 (100.) + +double logpdf_normal_2( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-(x-mu_2)*(x-mu_2)/2. - 10000.); +} +double dlogpdf_normal_2( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-(x-mu_2)); +} + +double cdf_normal_2( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + static UNUR_DISTR *normal_2 = NULL; + static double fpm[2] = {mu_2, 1.}; + if (normal_2 == NULL) normal_2 = unur_distr_normal(fpm,2); + return unur_distr_cont_eval_cdf( x, normal_2 ); +} + +############################################################################## diff --git a/vendor/unuran-1.11.0/tests/t_auto.c b/vendor/unuran-1.11.0/tests/t_auto.c new file mode 100644 index 0000000..3c9a53e --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_auto.c @@ -0,0 +1,469 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for AUTO + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_auto_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +int unur_auto_set_pedantic( struct unur_par *par, int pedantic ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* no such function */ +int unur_auto_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,27,(unur_auto_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,27,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + +unur_auto_set_logss(par,1); +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,44,(unur_auto_set_logss(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,44,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_auto_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,53,(unur_auto_set_logss(par,-1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,0); + par = NULL; + + +unur_reset_errno(); +/* TDR */ +par = unur_tdr_new(distr); +n_tests_failed += (compare_sequence_par_start(TESTLOG,96,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* AUTO */ +par = unur_auto_new(distr); +n_tests_failed += (compare_sequence_par(TESTLOG,100,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[] = {0.1}; + distr = unur_distr_geometric(fpar,1); + par = NULL; + + +unur_reset_errno(); +/* DARI */ +par = unur_dari_new(distr); +n_tests_failed += (compare_sequence_par_start(TESTLOG,109,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* AUTO */ +par = unur_auto_new(distr); +n_tests_failed += (compare_sequence_par(TESTLOG,113,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_auto_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,126,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,132,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser - cont */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_normal(NULL,0); +par = unur_auto_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,144,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal()" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,149,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal() & method = auto" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,154,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser discr */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[] = {0.4}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_geometric(fpar,1); +par = unur_auto_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,167,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "geometric(0.4)"); +n_tests_failed += (compare_sequence_gen(TESTLOG,172,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "geometric(0.4) & method = auto"); +n_tests_failed += (compare_sequence_gen(TESTLOG,177,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_auto_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_auto.conf b/vendor/unuran-1.11.0/tests/t_auto.conf new file mode 100644 index 0000000..8a0cba8 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_auto.conf @@ -0,0 +1,192 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: AUTO + +[main - header:] + +/* prototypes */ + +int unur_auto_set_pedantic( struct unur_par *par, int pedantic ); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_logss(par,1); + +[set - invalid parameter object: + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); ] + +~_logss(par,1); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + +[set - invalid parameters: + distr = unur_distr_normal(NULL,0); + par = unur_auto_new(distr); ] + +~_logss(par,-1); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################# + +# [init] + +############################################################################# + +# [reinit] + +#[reinit - does not exist: +# distr = unur_distr_normal(NULL,0); +# par = unur_auto_new(distr); +# gen = unur_init( par ); <-- ! NULL ] + +#unur_reinit( gen ); +# --> expected_setfailed --> UNUR_ERR_NO_REINIT + +#unur_sample_cont( gen ); +# --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION + + +############################################################################# + +[sample] + +[sample - compare: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,0); + par = NULL; ] + +/* TDR */ +par = unur_tdr_new(distr); + -->compare_sequence_par_start + +/* AUTO */ +par = unur_auto_new(distr); + -->compare_sequence_par + +[sample - compare: + double fpar[] = {0.1}; + distr = unur_distr_geometric(fpar,1); + par = NULL; ] + +/* DARI */ +par = unur_dari_new(distr); + -->compare_sequence_par_start + +/* AUTO */ +par = unur_auto_new(distr); + -->compare_sequence_par + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_auto_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser - cont: + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_normal(NULL,0); +par = unur_auto_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal()" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal() & method = auto" ); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser discr: + double fpar[] = {0.4}; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_geometric(fpar,1); +par = unur_auto_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "geometric(0.4)"); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "geometric(0.4) & method = auto"); + -->compare_sequence_gen + +############################################################################# + +# [validate] + +############################################################################# +############################################################################# + +[verbatim] + +/* no such function */ +int unur_auto_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_cext.c b/vendor/unuran-1.11.0/tests/t_cext.c new file mode 100644 index 0000000..6bcb9a7 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_cext.c @@ -0,0 +1,988 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for CEXT + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_cext_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +int check_init(UNUR_GEN *gen); +double check_sample(UNUR_GEN *gen); + +double exp1_sample(UNUR_GEN *gen); + +double expa_sample(UNUR_GEN *gen); + +int expb_init(UNUR_GEN *gen); +double expb_sample(UNUR_GEN *gen); + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + +/* #define SEED (298346) */ + + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +int check_init(UNUR_GEN *gen ATTRIBUTE__UNUSED) { return UNUR_SUCCESS; } +double check_sample(UNUR_GEN *gen ATTRIBUTE__UNUSED) { return 0.; } + +/* ............. */ + +double exp1_sample(UNUR_GEN *gen) { + double U = unur_sample_urng(gen); + return (-log(1. - U)); +} + +/* ............. */ + +double expa_sample(UNUR_GEN *gen) { +# define sigma (params[0]) /* scale */ + double U = unur_sample_urng(gen); + double X = -log(1. - U); + double *params = unur_cext_get_distrparams(gen); + if (params) + return sigma * X; + else + return X; +# undef sigma +} + +/* ............. */ + +int expb_init(UNUR_GEN *gen) { +# define sigma (params[0]) /* scale */ + double *params = unur_cext_get_distrparams(gen); + double *genpar = unur_cext_get_params(gen, sizeof(double)); + genpar[0] = (params) ? sigma : 1.; + return UNUR_SUCCESS; +# undef sigma +} + +double expb_sample(UNUR_GEN *gen) { +# define sigma (params[0]) /* scale */ + double U = unur_sample_urng(gen); + double X = -log(1. - U); + double *params = unur_cext_get_params(gen,(size_t)0); + return sigma * X; +# undef sigma +} + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,38,(unur_cext_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,38,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,49,(unur_cext_set_init(par,NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,52,(unur_cext_set_sample(par,NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,60,(unur_cext_set_init(par,NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,63,(unur_cext_set_sample(par,NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,66,(unur_cext_set_sample(par,check_sample)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,79,(unur_cext_get_params(gen,(size_t)0)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,93,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,93,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* does not exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_exponential(NULL,0); + par = unur_cext_new(distr); + unur_cext_set_sample(par,exp1_sample); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 103, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,107,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + distr = unur_distr_exponential(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* external generator 1 */ +par = unur_cext_new(distr); +unur_cext_set_sample(par,exp1_sample); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,124,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,130,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* cstd */ +unur_free(gen); +par = unur_cstd_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen(TESTLOG,136,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* external generator A */ +unur_free(gen); +par = unur_cext_new(distr); +unur_cext_set_sample(par,expa_sample); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen(TESTLOG,144,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,150,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* external generator B */ +unur_free(gen); +par = unur_cext_new(distr); +unur_cext_set_init(par,expb_init); +unur_cext_set_sample(par,expb_sample); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen(TESTLOG,158,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,164,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double fpar[1] = { 1. }; + distr = unur_distr_exponential(fpar,1); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* external generator 1 */ +par = unur_cext_new(distr); +unur_cext_set_sample(par,exp1_sample); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,179,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,185,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* cstd */ +unur_free(gen); +par = unur_cstd_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen(TESTLOG,191,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* external generator A */ +unur_free(gen); +par = unur_cext_new(distr); +unur_cext_set_sample(par,expa_sample); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen(TESTLOG,198,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,204,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* external generator B */ +unur_free(gen); +par = unur_cext_new(distr); +unur_cext_set_init(par,expb_init); +unur_cext_set_sample(par,expb_sample); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen(TESTLOG,212,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,218,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double fpar[1] = { 5. }; + distr = unur_distr_exponential(fpar,1); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* external generator A */ +unur_free(gen); +par = unur_cext_new(distr); +unur_cext_set_sample(par,expa_sample); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,234,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,240,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* external generator B */ +unur_free(gen); +par = unur_cext_new(distr); +unur_cext_set_init(par,expb_init); +unur_cext_set_sample(par,expb_sample); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen(TESTLOG,248,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,254,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* cstd */ +unur_free(gen); +par = unur_cstd_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen(TESTLOG,260,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[3]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 3 */ +{ +distr[0] = unur_distr_exponential(NULL,0); +} + +{ +fpm[0] = 5.; +distr[1] = unur_distr_exponential(fpm,1); +} + +{ +fpm[0] = 1.; +distr[2] = unur_distr_exponential(fpm,1); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 12 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_cext_new(distr_localcopy); +unur_cext_set_sample(par,exp1_sample); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_cext_new(distr_localcopy); +unur_cext_set_sample(par,expa_sample); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_cext_new(distr_localcopy); +unur_cext_set_init(par,expb_init); +unur_cext_set_sample(par,expb_sample); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_cext_new(distr_localcopy); +unur_cext_set_init(par,expb_init); +unur_cext_set_sample(par,expb_sample); +fpm[0] = 2.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,1); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_cext_new(distr_localcopy); +unur_cext_set_sample(par,exp1_sample); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_cext_new(distr_localcopy); +unur_cext_set_sample(par,expa_sample); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_cext_new(distr_localcopy); +unur_cext_set_init(par,expb_init); +unur_cext_set_sample(par,expb_sample); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_cext_new(distr_localcopy); +unur_cext_set_init(par,expb_init); +unur_cext_set_sample(par,expb_sample); +fpm[0] = 2.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,1); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_cext_new(distr_localcopy); +unur_cext_set_sample(par,exp1_sample); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_cext_new(distr_localcopy); +unur_cext_set_sample(par,expa_sample); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_cext_new(distr_localcopy); +unur_cext_set_init(par,expb_init); +unur_cext_set_sample(par,expb_sample); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_cext_new(distr_localcopy); +unur_cext_set_init(par,expb_init); +unur_cext_set_sample(par,expb_sample); +fpm[0] = 2.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,1); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_cext_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_cext.conf b/vendor/unuran-1.11.0/tests/t_cext.conf new file mode 100644 index 0000000..a639703 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_cext.conf @@ -0,0 +1,383 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: CEXT + +[main - header:] + +/* prototypes */ + +int check_init(UNUR_GEN *gen); +double check_sample(UNUR_GEN *gen); + +double exp1_sample(UNUR_GEN *gen); + +double expa_sample(UNUR_GEN *gen); + +int expb_init(UNUR_GEN *gen); +double expb_sample(UNUR_GEN *gen); + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* \#define SEED (298346) */ + + +############################################################################# + +[new] + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_init(par,NULL); + --> expected_setfailed --> UNUR_ERR_NULL + +~_sample(par,NULL); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameter object: + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); ] + +~_init(par,NULL); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_sample(par,NULL); + --> expected_setfailed --> UNUR_ERR_NULL + +~_sample(par,check_sample); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + + +############################################################################# + +[get] + +[get - invalid NULL ptr: + gen = NULL; ] + +~_params(gen,(size_t)0); + --> expected_NULL --> UNUR_ERR_NULL + +############################################################################# + +# [chg] + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + + +############################################################################# + +[reinit] + +[reinit - does not exist: + distr = unur_distr_exponential(NULL,0); + par = unur_cext_new(distr); + unur_cext_set_sample(par,exp1_sample); + gen = unur_init(par); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + + +############################################################################# + +[sample] + +[sample - compare clone: + UNUR_GEN *clone; + distr = unur_distr_exponential(NULL,0); + par = NULL; + gen = NULL; ] + +/* external generator 1 */ +par = unur_cext_new(distr); +unur_cext_set_sample(par,exp1_sample); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +/* cstd */ +unur_free(gen); +par = unur_cstd_new(distr); +gen = unur_init(par); + -->compare_sequence_gen + + +/* external generator A */ +unur_free(gen); +par = unur_cext_new(distr); +unur_cext_set_sample(par,expa_sample); +gen = unur_init(par); + -->compare_sequence_gen + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +/* external generator B */ +unur_free(gen); +par = unur_cext_new(distr); +unur_cext_set_init(par,expb_init); +unur_cext_set_sample(par,expb_sample); +gen = unur_init(par); + -->compare_sequence_gen + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + double fpar[1] = { 1. }; + distr = unur_distr_exponential(fpar,1); + par = NULL; + gen = NULL; ] + +/* external generator 1 */ +par = unur_cext_new(distr); +unur_cext_set_sample(par,exp1_sample); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +/* cstd */ +unur_free(gen); +par = unur_cstd_new(distr); +gen = unur_init(par); + -->compare_sequence_gen + +/* external generator A */ +unur_free(gen); +par = unur_cext_new(distr); +unur_cext_set_sample(par,expa_sample); +gen = unur_init(par); + -->compare_sequence_gen + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +/* external generator B */ +unur_free(gen); +par = unur_cext_new(distr); +unur_cext_set_init(par,expb_init); +unur_cext_set_sample(par,expb_sample); +gen = unur_init(par); + -->compare_sequence_gen + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + double fpar[1] = { 5. }; + distr = unur_distr_exponential(fpar,1); + par = NULL; + gen = NULL; ] + +/* external generator A */ +unur_free(gen); +par = unur_cext_new(distr); +unur_cext_set_sample(par,expa_sample); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +/* external generator B */ +unur_free(gen); +par = unur_cext_new(distr); +unur_cext_set_init(par,expb_init); +unur_cext_set_sample(par,expb_sample); +gen = unur_init(par); + -->compare_sequence_gen + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +/* cstd */ +unur_free(gen); +par = unur_cstd_new(distr); +gen = unur_init(par); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# exponential(1): +# standard distribution; do not read any parameters +par[0] = unur_cext_new(@distr@); +unur_cext_set_sample(par,exp1_sample); + +# exponential(lambda): +# use pointer to parameter of distribution in sampling routine +par[1] = unur_cext_new(@distr@); +unur_cext_set_sample(par,expa_sample); + +# exponential(lambda): +# store parameter of distribution in generator object during init +par[2] = unur_cext_new(@distr@); +unur_cext_set_init(par,expb_init); +unur_cext_set_sample(par,expb_sample); + +# exponential +# store parameter of distribution in generator object during init +# change parameters +{ UNUR_DISTR *dg =NULL; +par[3] = unur_cext_new(@distr@); +unur_cext_set_init(par,expb_init); +unur_cext_set_sample(par,expb_sample); +fpm[0] = 2.; +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,1); +unur_reinit(gen); } + + +[validate - distributions:] + +# Exponential distribution +distr[0] = unur_distr_exponential(NULL,0); + +fpm[0] = 5.; +distr[1] = unur_distr_exponential(fpm,1); + +fpm[0] = 1.; +distr[2] = unur_distr_exponential(fpm,1); + + +## number of distributions: 3 + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator (given variant does not exist) +# - ... fail test +# / ... either init fails or test passes +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... Exponential(0) +# [1] ... Exponential(lambda): use pointer to distribution +# [2] ... Exponential(lambda): store distrparams in object +# [3] ... Exponential, reinit with changed parameters +# +#gen 0 1 2 3 # distribution +#------------------------------------------------------------- + <0> + + + + # standard exponential + <1> - + + + # exponential (5) + <2> + + + + # exponential (1) + + +############################################################################# +############################################################################# + +[verbatim] + +int check_init(UNUR_GEN *gen ATTRIBUTE__UNUSED) { return UNUR_SUCCESS; } +double check_sample(UNUR_GEN *gen ATTRIBUTE__UNUSED) { return 0.; } + +/* ............. */ + +double exp1_sample(UNUR_GEN *gen) { + double U = unur_sample_urng(gen); + return (-log(1. - U)); +} + +/* ............. */ + +double expa_sample(UNUR_GEN *gen) { +\# define sigma (params[0]) /* scale */ + double U = unur_sample_urng(gen); + double X = -log(1. - U); + double *params = unur_cext_get_distrparams(gen); + if (params) + return sigma * X; + else + return X; +\# undef sigma +} + +/* ............. */ + +int expb_init(UNUR_GEN *gen) { +\# define sigma (params[0]) /* scale */ + double *params = unur_cext_get_distrparams(gen); + double *genpar = unur_cext_get_params(gen, sizeof(double)); + genpar[0] = (params) ? sigma : 1.; + return UNUR_SUCCESS; +\# undef sigma +} + +double expb_sample(UNUR_GEN *gen) { +\# define sigma (params[0]) /* scale */ + double U = unur_sample_urng(gen); + double X = -log(1. - U); + double *params = unur_cext_get_params(gen,(size_t)0); + return sigma * X; +\# undef sigma +} + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_cstd.c b/vendor/unuran-1.11.0/tests/t_cstd.c new file mode 100644 index 0000000..44fc76a --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_cstd.c @@ -0,0 +1,8674 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for CSTD + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_cstd_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* -- prototypes -- */ + +int estimate_uerror( UNUR_DISTR *distr, double u_resolution, int samplesize ); + +double cdf_exp(double x, const UNUR_DISTR *distr); +double invcdf_exp(double u, const UNUR_DISTR *distr); + +/* -- constants -- */ + +/* sample size */ +static const int UERROR_SAMPLESIZE = 100000; +static const double UERROR_RESOLUTION = 1.e-14; + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + + +int +estimate_uerror( UNUR_DISTR *distr, /* distribution object */ + double u_resolution, /* maximal tolerated u-error */ + int samplesize ) /* sample size for error experiment */ +/* returns 0 if maxerror < u_resolution, errorcode otherwise */ +{ + UNUR_PAR *par; + UNUR_GEN *gen; + int i, nfpar; + const double *fpar; + double score; + + /* print data about distribution */ + fprintf(TESTLOG,"> %s (",unur_distr_get_name(distr)); + nfpar = unur_distr_cont_get_pdfparams(distr,&fpar); + for(i=0;i inversion method not implemented !!\n\n"); + printf("0"); fflush(stdout); + if (par) unur_par_free(par); + unur_distr_free(distr); + return 0; + } + + /* initialize generator object */ + gen = unur_init(par); + + /* run test */ + score = run_validate_u_error( TESTLOG, gen, distr, u_resolution, samplesize ); + + /* clear working space */ + unur_distr_free(distr); + unur_free(gen); + + /* return */ + fprintf(TESTLOG,"\n"); + return score; + +} /* end of estimate_uerror() */ + + +double cdf_exp(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { + return ((x<0.) ? 0. : 1.-exp(-x)); +} + +double invcdf_exp(double u, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { + return (-log(1.- u)); +} + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,36,(unur_cstd_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,36,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,42,(unur_cstd_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* not a standard distribution and missing inverse CDF */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,48,(unur_cstd_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,48,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,58,(unur_cstd_set_variant(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,58,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,66,(unur_cstd_set_variant(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_cstd_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,75,(unur_cstd_set_variant(par,9999)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,75,UNUR_ERR_PAR_VARIANT)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 91, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,95,(unur_cstd_chg_truncated(gen, 0., 1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,95,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,106,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* does not exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_cstd_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 115, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,119,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double fpar[] = { 1., 2.}; + distr = unur_distr_normal(fpar,2); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_cstd_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,135,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,141,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[] = {3., 4.}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_gamma(fpar,2); +par = unur_cstd_new(distr); +unur_cstd_set_variant(par,2); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,155,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,4.) & method = cstd; variant = 2" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,160,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[87]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 87 */ +{ +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 1.; +distr[80] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 1.; +distr[81] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 7.; +fpm[1] = 0.5; +distr[60] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 0.7; +fpm[1] = 0.5; +distr[61] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 7.; +fpm[1] = 0.1; +fpm[2] = -1.; +fpm[3] = 2.; +distr[62] = unur_distr_beta(fpm,4); +} + +{ +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); +} + +{ +fpm[0] = 1; +distr[66] = unur_distr_burr(fpm,1); +} + +{ +fpm[0] = 2; +fpm[1] = 2; +distr[67] = unur_distr_burr(fpm,2); +} + +{ +fpm[0] = 3; +fpm[1] = 2; +fpm[2] = 2; +distr[68] = unur_distr_burr(fpm,3); +} + +{ +fpm[0] = 4; +fpm[1] = 2; +fpm[2] = 2; +distr[69] = unur_distr_burr(fpm,3); +} + +{ +fpm[0] = 5; +fpm[1] = 2; +fpm[2] = 2; +distr[70] = unur_distr_burr(fpm,3); +} + +{ +fpm[0] = 6; +fpm[1] = 2; +fpm[2] = 2; +distr[71] = unur_distr_burr(fpm,3); +} + +{ +fpm[0] = 7; +fpm[1] = 2; +distr[72] = unur_distr_burr(fpm,2); +} + +{ +fpm[0] = 8; +fpm[1] = 2; +distr[73] = unur_distr_burr(fpm,2); +} + +{ +fpm[0] = 9; +fpm[1] = 2; +fpm[2] = 2; +distr[74] = unur_distr_burr(fpm,3); +} + +{ +fpm[0] = 10; +fpm[1] = 2; +distr[75] = unur_distr_burr(fpm,2); +} + +{ +fpm[0] = 11; +fpm[1] = 2; +distr[76] = unur_distr_burr(fpm,2); +} + +{ +fpm[0] = 12; +fpm[1] = 2; +fpm[2] = 2; +distr[77] = unur_distr_burr(fpm,3); +} + +{ +distr[7] = unur_distr_cauchy(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); +} + +{ +fpm[0] = 0.5; +distr[23] = unur_distr_chi(fpm,1); +} + +{ +fpm[0] = 1.; +distr[24] = unur_distr_chi(fpm,1); +} + +{ +fpm[0] = 2.; +distr[25] = unur_distr_chi(fpm,1); +} + +{ +fpm[0] = 50.; +distr[26] = unur_distr_chi(fpm,1); +} + +{ +distr[27] = unur_distr_exponential(NULL,0); +} + +{ +fpm[0] = 0.5; +distr[28] = unur_distr_exponential(fpm,1); +} + +{ +fpm[0] = 5.; +fpm[1] = -3.; +distr[29] = unur_distr_exponential(fpm,2); +} + +{ +distr[30] = unur_distr_extremeI(NULL,0); +} + +{ +fpm[0] = -3.; +distr[31] = unur_distr_extremeI(fpm,1); +} + +{ +fpm[0] = -1.; +fpm[1] = 5.; +distr[32] = unur_distr_extremeI(fpm,2); +} + +{ +fpm[0] = 3.; +distr[33] = unur_distr_extremeII(fpm,1); +} + +{ +fpm[0] = 0.5; +fpm[1] = -3.; +distr[34] = unur_distr_extremeII(fpm,2); +} + +{ +fpm[0] = 0.8; +fpm[1] = -1.; +fpm[2] = 5.; +distr[35] = unur_distr_extremeII(fpm,3); +} + +{ +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[16] = unur_distr_gamma(fpm,3); +} + +{ +fpm[0] = 0.5; +distr[63] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 0.2; +distr[64] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 0.5; +fpm[1] = 7; +fpm[2] = 1; +distr[83] = unur_distr_gig(fpm,3); +} + +{ +fpm[0] = 0.5; +fpm[1] = 0.5; +fpm[2] = 1; +distr[86] = unur_distr_gig(fpm,3); +} + +{ +distr[36] = unur_distr_laplace(NULL,0); +} + +{ +fpm[0] = -3.; +distr[37] = unur_distr_laplace(fpm,1); +} + +{ +fpm[0] = -1.; +fpm[1] = 5.; +distr[38] = unur_distr_laplace(fpm,2); +} + +{ +distr[39] = unur_distr_logistic(NULL,0); +} + +{ +fpm[0] = -3.; +distr[40] = unur_distr_logistic(fpm,1); +} + +{ +fpm[0] = -1.; +fpm[1] = 5.; +distr[41] = unur_distr_logistic(fpm,2); +} + +{ +fpm[0] = 2.; +fpm[1] = 3.; +distr[56] = unur_distr_lomax(fpm,2); +} + +{ +fpm[0] = 20.; +fpm[1] = 0.4; +distr[57] = unur_distr_lomax(fpm,2); +} + +{ +fpm[0] = 0.2; +fpm[1] = 40.; +distr[58] = unur_distr_lomax(fpm,2); +} + +{ +fpm[0] = 0.2; +fpm[1] = 0.5; +distr[59] = unur_distr_lomax(fpm,2); +} + +{ +distr[17] = unur_distr_normal(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); +} + +{ +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); +} + +{ +fpm[0] = 2.; +fpm[1] = 3.; +distr[52] = unur_distr_pareto(fpm,2); +} + +{ +fpm[0] = 20.; +fpm[1] = 0.4; +distr[53] = unur_distr_pareto(fpm,2); +} + +{ +fpm[0] = 0.2; +fpm[1] = 40.; +distr[54] = unur_distr_pareto(fpm,2); +} + +{ +fpm[0] = 0.2; +fpm[1] = 0.5; +distr[55] = unur_distr_pareto(fpm,2); +} + +{ +fpm[0] = 0.5; +distr[42] = unur_distr_powerexponential(fpm,1); +} + +{ +fpm[0] = 1.; +distr[43] = unur_distr_powerexponential(fpm,1); +} + +{ +fpm[0] = 2.; +distr[44] = unur_distr_powerexponential(fpm,1); +} + +{ +fpm[0] = 10.; +distr[45] = unur_distr_powerexponential(fpm,1); +} + +{ +fpm[0] = 1.; +distr[65] = unur_distr_rayleigh(fpm,1); +} + +{ +distr[82] = unur_distr_slash(NULL,0); +} + +{ +fpm[0] = 2; +distr[84] = unur_distr_student(fpm,1); +} + +{ +fpm[0] = 0.5; +distr[85] = unur_distr_student(fpm,1); +} + +{ +fpm[0] = 0.7; +distr[46] = unur_distr_triangular(fpm,1); +} + +{ +fpm[0] = 0.; +distr[47] = unur_distr_triangular(fpm,1); +} + +{ +fpm[0] = 1.; +distr[48] = unur_distr_triangular(fpm,1); +} + +{ +distr[20] = unur_distr_uniform(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); +} + +{ +fpm[0] = 3.; +distr[49] = unur_distr_weibull(fpm,1); +} + +{ +fpm[0] = 0.5; +fpm[1] = 3.; +distr[50] = unur_distr_weibull(fpm,2); +} + +{ +fpm[0] = 1.5; +fpm[1] = 2.; +fpm[2] = -5.; +distr[51] = unur_distr_weibull(fpm,3); +} + +{ +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); +} + +{ +distr[78] = unur_distr_cont_new(); +unur_distr_set_name( distr[78], "CDF_only" ); +unur_distr_cont_set_domain( distr[78], 0, UNUR_INFINITY ); +unur_distr_cont_set_cdf( distr[78], cdf_exp ); +} + +{ +distr[79] = unur_distr_cont_new(); +unur_distr_set_name( distr[79], "CDF&invCDF" ); +unur_distr_cont_set_domain( distr[79], 0, UNUR_INFINITY ); +unur_distr_cont_set_cdf( distr[79], cdf_exp ); +unur_distr_cont_set_invcdf( distr[79], invcdf_exp ); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 1044 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [1] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [80] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[80]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[80],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[80]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[80],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [81] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[81]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[81],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[81]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[81],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [2] */ + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [3] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [60] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[60]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[60],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[60]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[60],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [61] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[61]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[61],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[61]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[61],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [4] */ + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [6] */ + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [66] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[66]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[66],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [67] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[67]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[67],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [68] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[68]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[68],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [69] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[69]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[69],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [70] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[70]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[70],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [71] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[71]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[71],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [72] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[72]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[72],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [73] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[73]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[73],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [74] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[74]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[74],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [75] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[75]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[75],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [76] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[76]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[76],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [77] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[77]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[77],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [24] */ + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [26] */ + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [28] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [29] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [31] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [32] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [33] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [34] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [35] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [14] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [15] */ + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [16] */ + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [63] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[63]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[63],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[63]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[63],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[63]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[63],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [64] */ + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[64]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[64],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[64]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[64],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[64]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[64],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [83] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[83]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[83],'%'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [86] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[86]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[86],'%'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [36] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [37] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [38] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [39] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[39]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[39],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[39]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[39],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[39]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[39],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [40] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [41] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[41],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[41],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[41],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [56] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[56]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[56],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[56]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[56],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[56]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[56],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [57] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[57]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[57],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[57]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[57],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[57]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[57],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [58] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[58]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[58],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[58]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[58],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[58]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[58],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [59] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[59]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[59],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[59]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[59],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[59]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[59],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,3)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,4)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,5)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,6)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,7)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'/'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,3)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,4)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,5)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,6)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,7)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,3)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,4)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,5)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,6)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,7)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'/'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [52] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[52]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[52],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[52]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[52],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [53] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[53]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[53],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[53]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[53],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [54] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[54]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[54],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[54]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[54],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [55] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[55]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[55],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[55]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[55],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[55]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[55],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [42] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[42],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[42],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [43] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [44] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[44]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[44],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[44]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[44],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [45] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[45]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[45],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [65] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[65]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[65],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[65]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[65],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [82] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[82]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[82],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[82]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[82],'%'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [84] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[84]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[84],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[84]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[84],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[84]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[84],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [85] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[85]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[85],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[85]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[85],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[85]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[85],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [46] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[46]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[46],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[46]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[46],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [47] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[47]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[47],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[47]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[47],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [48] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[48]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[48],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[48]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[48],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [49] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[49]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[49],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[49]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[49],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[49]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[49],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [50] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[50]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[50],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[50]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[50],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[50]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[50],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [51] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[51]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[51],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[51]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[51],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[51]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[51],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + if (gen) { +unur_cstd_chg_truncated(gen,0.5,0.55); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_cstd_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 5.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [78] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[78]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[78],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [79] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[79]); +par = unur_cstd_new(distr_localcopy); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[79],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + unur_distr_free(distr[30]); + unur_distr_free(distr[31]); + unur_distr_free(distr[32]); + unur_distr_free(distr[33]); + unur_distr_free(distr[34]); + unur_distr_free(distr[35]); + unur_distr_free(distr[36]); + unur_distr_free(distr[37]); + unur_distr_free(distr[38]); + unur_distr_free(distr[39]); + unur_distr_free(distr[40]); + unur_distr_free(distr[41]); + unur_distr_free(distr[42]); + unur_distr_free(distr[43]); + unur_distr_free(distr[44]); + unur_distr_free(distr[45]); + unur_distr_free(distr[46]); + unur_distr_free(distr[47]); + unur_distr_free(distr[48]); + unur_distr_free(distr[49]); + unur_distr_free(distr[50]); + unur_distr_free(distr[51]); + unur_distr_free(distr[52]); + unur_distr_free(distr[53]); + unur_distr_free(distr[54]); + unur_distr_free(distr[55]); + unur_distr_free(distr[56]); + unur_distr_free(distr[57]); + unur_distr_free(distr[58]); + unur_distr_free(distr[59]); + unur_distr_free(distr[60]); + unur_distr_free(distr[61]); + unur_distr_free(distr[62]); + unur_distr_free(distr[63]); + unur_distr_free(distr[64]); + unur_distr_free(distr[65]); + unur_distr_free(distr[66]); + unur_distr_free(distr[67]); + unur_distr_free(distr[68]); + unur_distr_free(distr[69]); + unur_distr_free(distr[70]); + unur_distr_free(distr[71]); + unur_distr_free(distr[72]); + unur_distr_free(distr[73]); + unur_distr_free(distr[74]); + unur_distr_free(distr[75]); + unur_distr_free(distr[76]); + unur_distr_free(distr[77]); + unur_distr_free(distr[78]); + unur_distr_free(distr[79]); + unur_distr_free(distr[80]); + unur_distr_free(distr[81]); + unur_distr_free(distr[82]); + unur_distr_free(distr[83]); + unur_distr_free(distr[84]); + unur_distr_free(distr[85]); + unur_distr_free(distr[86]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + +/*---------------------------------------------------------------------------*/ +/* [special] */ + +void test_special (void) +{ + /* set boolean to FALSE */ + int FAILED = 0; + + + + + + + int samplesize = UERROR_SAMPLESIZE; + double ures = UERROR_RESOLUTION; + + int errorsum = 0; + double fpar[5]; + + UNUR_DISTR *distr; + +/* start test */ +printf("[special "); fflush(stdout); +fprintf(TESTLOG,"\n[special]\n"); + +/* set stop watch */ +stopwatch_lap(&watch); + + + + /* test for maximal u-error */ + printf("\n[test maximal u-error for inversion method]\n"); + fprintf(TESTLOG,"\n* Test maximal u-error for inversion method *\n"); + + + printf(" beta"); + + fpar[0] = 3.; + fpar[1] = 4.; + distr = unur_distr_beta(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 1.; + fpar[1] = 2.; + fpar[2] = 3.; + fpar[3] = 4.; + distr = unur_distr_beta(fpar,4); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" burr"); + + fpar[0] = 1.; + distr = unur_distr_burr(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 2.; + fpar[1] = 2.; + distr = unur_distr_burr(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 3.; + fpar[1] = 2.; + fpar[2] = 3.; + distr = unur_distr_burr(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 4.; + fpar[1] = 1.; + fpar[2] = 2.; + distr = unur_distr_burr(fpar,3); + errorsum += estimate_uerror(distr,1e-10,samplesize); + /* computation of CDF and /or inverse CDF is not seem very accurate */ + + fpar[0] = 5.; + fpar[1] = 2.; + fpar[2] = 3.; + distr = unur_distr_burr(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 6.; + fpar[1] = 2.; + fpar[2] = 3.; + distr = unur_distr_burr(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 7.; + fpar[1] = 2.; + fpar[2] = 3.; + distr = unur_distr_burr(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 8.; + fpar[1] = 2.; + distr = unur_distr_burr(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 9.; + fpar[1] = 2.; + fpar[2] = 3.; + distr = unur_distr_burr(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 10.; + fpar[1] = 2.; + distr = unur_distr_burr(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 11.; + fpar[1] = 2.; + distr = unur_distr_burr(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 12.; + fpar[1] = 2.; + fpar[2] = 3.; + distr = unur_distr_burr(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" cauchy"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_cauchy(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" chi"); + fpar[0] = 3.; + distr = unur_distr_chi(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" chisquare"); + fpar[0] = 3.; + distr = unur_distr_chisquare(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" exponential"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_exponential(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" extremeI"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_extremeI(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" extremeII"); + fpar[0] = 1.; + fpar[1] = 2.; + fpar[2] = 3.; + distr = unur_distr_extremeII(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" F"); + fpar[0] = 3.; + fpar[1] = 4.; + distr = unur_distr_F(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" gamma"); + + fpar[0] = 5.; + distr = unur_distr_gamma(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 4.; + fpar[1] = 3.; + distr = unur_distr_gamma(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 3.; + fpar[1] = 2.; + fpar[2] = 1.; + distr = unur_distr_gamma(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" gig"); + fpar[0] = 1.; + fpar[1] = 2.; + fpar[1] = 3.; + distr = unur_distr_gig(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" gig2"); + fpar[0] = 1.; + fpar[1] = 2.; + fpar[2] = 3.; + distr = unur_distr_gig2(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" ghyp"); + fpar[0] = 1.; + fpar[1] = 3.; + fpar[2] = 2.; + fpar[3] = 4.; + fpar[4] = 5.; + distr = unur_distr_ghyp(fpar,5); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" hyperbolic"); + fpar[0] = 3.; + fpar[1] = 2.; + fpar[2] = 2.; + fpar[3] = 2.; + distr = unur_distr_hyperbolic(fpar,4); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" ig"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_ig(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" laplace"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_laplace(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" logistic"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_logistic(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" lognormal"); + fpar[0] = 1.; + fpar[1] = 2.; + fpar[2] = 3.; + distr = unur_distr_lognormal(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" lomax"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_lomax(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" normal"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_normal(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" pareto"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_pareto(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" powerexponential"); + fpar[0] = 3.; + distr = unur_distr_powerexponential(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" rayleigh"); + fpar[0] = 2.; + distr = unur_distr_rayleigh(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" slash"); + distr = unur_distr_slash(NULL,0); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" student"); + fpar[0] = 4.4; + distr = unur_distr_student(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" triangular"); + fpar[0] = 0.7; + distr = unur_distr_triangular(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" uniform"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_uniform(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" weibull"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_weibull(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + +/*---------------------------------------------------------------------------*/ + + /* test finished */ + FAILED = (errorsum < 2) ? 0 : 1; + + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (FAILED) ? 0 : 1; + (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_special() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_cstd_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_cstd.conf b/vendor/unuran-1.11.0/tests/t_cstd.conf new file mode 100644 index 0000000..993744a --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_cstd.conf @@ -0,0 +1,1097 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: CSTD + +[main - header:] + +/* -- prototypes -- */ + +int estimate_uerror( UNUR_DISTR *distr, double u_resolution, int samplesize ); + +double cdf_exp(double x, const UNUR_DISTR *distr); +double invcdf_exp(double u, const UNUR_DISTR *distr); + +/* -- constants -- */ + +/* sample size */ +static const int UERROR_SAMPLESIZE = 100000; +static const double UERROR_RESOLUTION = 1.e-14; + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - not a standard distribution and missing inverse CDF: + distr = unur_distr_cont_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_variant(par,1); + --> expected_setfailed --> UNUR_ERR_NULL + +[set - invalid parameter object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); ] + +~_variant(par,1); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + +[set - invalid parameters: + distr = unur_distr_normal(NULL,0); + par = unur_cstd_new(distr); ] + +~_variant(par,9999); + --> expected_setfailed --> UNUR_ERR_PAR_VARIANT + +unur_par_free(par); + +############################################################################# + +# [get] + +############################################################################# + +[chg] + +[chg - invalid generator object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_truncated(gen, 0., 1.); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + + +############################################################################# + +[reinit] + +[reinit - does not exist: + distr = unur_distr_normal(NULL,0); + par = unur_cstd_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - compare clone: + UNUR_GEN *clone; + double fpar[] = { 1., 2.}; + distr = unur_distr_normal(fpar,2); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_cstd_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + double fpar[] = {3., 4.}; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_gamma(fpar,2); +par = unur_cstd_new(distr); +unur_cstd_set_variant(par,2); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,4.) & method = cstd; variant = 2" ); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# inversion +par[0] = unur_cstd_new(@distr@); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + +par[1] = unur_cstd_new(@distr@); +if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + +par[2] = unur_cstd_new(@distr@); +if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + +par[3] = unur_cstd_new(@distr@); +if (unur_cstd_set_variant(par,3)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + +par[4] = unur_cstd_new(@distr@); +if (unur_cstd_set_variant(par,4)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + +par[5] = unur_cstd_new(@distr@); +if (unur_cstd_set_variant(par,5)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + +par[6] = unur_cstd_new(@distr@); +if (unur_cstd_set_variant(par,6)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + +par[7] = unur_cstd_new(@distr@); +if (unur_cstd_set_variant(par,7)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + +par[8] = unur_cstd_new(@distr@); +if (unur_cstd_set_variant(par,8)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + +par[9] = unur_cstd_new(@distr@); +if (unur_cstd_set_variant(par,9)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } + +# change domain +par[10] = unur_cstd_new(@distr@); +if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } +unur_cstd_chg_truncated(gen,0.5,0.55); + +## change parameters (use default variant) +{ UNUR_DISTR *dg =NULL; +par[11] = unur_cstd_new(@distr@); +fpm[0] = 2.; +fpm[1] = 5.; +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + + +[validate - distributions:] + +# Beta distributions +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 1.; +distr[80] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 1.; +distr[81] = unur_distr_beta(fpm,2); + +fpm[0] = 7.; +fpm[1] = 0.5; +distr[60] = unur_distr_beta(fpm,2); + +fpm[0] = 0.7; +fpm[1] = 0.5; +distr[61] = unur_distr_beta(fpm,2); + +fpm[0] = 7.; +fpm[1] = 0.1; +fpm[2] = -1.; +fpm[3] = 2.; +distr[62] = unur_distr_beta(fpm,4); + +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); + +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); + +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); + +# Burr distributions +fpm[0] = 1; +distr[66] = unur_distr_burr(fpm,1); + +fpm[0] = 2; +fpm[1] = 2; +distr[67] = unur_distr_burr(fpm,2); + +fpm[0] = 3; +fpm[1] = 2; +fpm[2] = 2; +distr[68] = unur_distr_burr(fpm,3); + +fpm[0] = 4; +fpm[1] = 2; +fpm[2] = 2; +distr[69] = unur_distr_burr(fpm,3); + +fpm[0] = 5; +fpm[1] = 2; +fpm[2] = 2; +distr[70] = unur_distr_burr(fpm,3); + +fpm[0] = 6; +fpm[1] = 2; +fpm[2] = 2; +distr[71] = unur_distr_burr(fpm,3); + +fpm[0] = 7; +fpm[1] = 2; +distr[72] = unur_distr_burr(fpm,2); + +fpm[0] = 8; +fpm[1] = 2; +distr[73] = unur_distr_burr(fpm,2); + +fpm[0] = 9; +fpm[1] = 2; +fpm[2] = 2; +distr[74] = unur_distr_burr(fpm,3); + +fpm[0] = 10; +fpm[1] = 2; +distr[75] = unur_distr_burr(fpm,2); + +fpm[0] = 11; +fpm[1] = 2; +distr[76] = unur_distr_burr(fpm,2); + +fpm[0] = 12; +fpm[1] = 2; +fpm[2] = 2; +distr[77] = unur_distr_burr(fpm,3); + + +# Cauchy distributions +distr[7] = unur_distr_cauchy(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); + +# Chi distribution +fpm[0] = 0.5; +distr[23] = unur_distr_chi(fpm,1); + +fpm[0] = 1.; +distr[24] = unur_distr_chi(fpm,1); + +fpm[0] = 2.; +distr[25] = unur_distr_chi(fpm,1); + +fpm[0] = 50.; +distr[26] = unur_distr_chi(fpm,1); + +# Exponential distribution +distr[27] = unur_distr_exponential(NULL,0); + +fpm[0] = 0.5; +distr[28] = unur_distr_exponential(fpm,1); + +fpm[0] = 5.; +fpm[1] = -3.; +distr[29] = unur_distr_exponential(fpm,2); + +# Extreme value type I +distr[30] = unur_distr_extremeI(NULL,0); + +fpm[0] = -3.; +distr[31] = unur_distr_extremeI(fpm,1); + +fpm[0] = -1.; +fpm[1] = 5.; +distr[32] = unur_distr_extremeI(fpm,2); + +# Extreme value type II +fpm[0] = 3.; +distr[33] = unur_distr_extremeII(fpm,1); + +fpm[0] = 0.5; +fpm[1] = -3.; +distr[34] = unur_distr_extremeII(fpm,2); + +fpm[0] = 0.8; +fpm[1] = -1.; +fpm[2] = 5.; +distr[35] = unur_distr_extremeII(fpm,3); + +# Gamma distributions +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); + +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); + +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); + +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); + +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); + +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[16] = unur_distr_gamma(fpm,3); + +fpm[0] = 0.5; +distr[63] = unur_distr_gamma(fpm,1); + +fpm[0] = 0.2; +distr[64] = unur_distr_gamma(fpm,1); + +# Generalized Inverse Gaussian +fpm[0] = 0.5; +fpm[1] = 7; +fpm[2] = 1; +distr[83] = unur_distr_gig(fpm,3); + +fpm[0] = 0.5; +fpm[1] = 0.5; +fpm[2] = 1; +distr[86] = unur_distr_gig(fpm,3); + +# Laplace distribution +distr[36] = unur_distr_laplace(NULL,0); + +fpm[0] = -3.; +distr[37] = unur_distr_laplace(fpm,1); + +fpm[0] = -1.; +fpm[1] = 5.; +distr[38] = unur_distr_laplace(fpm,2); + +# Logistic distribution +distr[39] = unur_distr_logistic(NULL,0); + +fpm[0] = -3.; +distr[40] = unur_distr_logistic(fpm,1); + +fpm[0] = -1.; +fpm[1] = 5.; +distr[41] = unur_distr_logistic(fpm,2); + +# Lomax +fpm[0] = 2.; +fpm[1] = 3.; +distr[56] = unur_distr_lomax(fpm,2); + +fpm[0] = 20.; +fpm[1] = 0.4; +distr[57] = unur_distr_lomax(fpm,2); + +fpm[0] = 0.2; +fpm[1] = 40.; +distr[58] = unur_distr_lomax(fpm,2); + +fpm[0] = 0.2; +fpm[1] = 0.5; +distr[59] = unur_distr_lomax(fpm,2); + +# Normal distributions +distr[17] = unur_distr_normal(NULL,0); + +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); + +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); + +# Pareto +fpm[0] = 2.; +fpm[1] = 3.; +distr[52] = unur_distr_pareto(fpm,2); + +fpm[0] = 20.; +fpm[1] = 0.4; +distr[53] = unur_distr_pareto(fpm,2); + +fpm[0] = 0.2; +fpm[1] = 40.; +distr[54] = unur_distr_pareto(fpm,2); + +fpm[0] = 0.2; +fpm[1] = 0.5; +distr[55] = unur_distr_pareto(fpm,2); + +# Power exponential distribution +fpm[0] = 0.5; +distr[42] = unur_distr_powerexponential(fpm,1); + +fpm[0] = 1.; +distr[43] = unur_distr_powerexponential(fpm,1); + +fpm[0] = 2.; +distr[44] = unur_distr_powerexponential(fpm,1); + +fpm[0] = 10.; +distr[45] = unur_distr_powerexponential(fpm,1); + +# Rayleigh +fpm[0] = 1.; +distr[65] = unur_distr_rayleigh(fpm,1); + +# Slash +distr[82] = unur_distr_slash(NULL,0); + +# Student t +fpm[0] = 2; +distr[84] = unur_distr_student(fpm,1); + +fpm[0] = 0.5; +distr[85] = unur_distr_student(fpm,1); + +# Triangular +fpm[0] = 0.7; +distr[46] = unur_distr_triangular(fpm,1); + +fpm[0] = 0.; +distr[47] = unur_distr_triangular(fpm,1); + +fpm[0] = 1.; +distr[48] = unur_distr_triangular(fpm,1); + +# Uniform distributions +distr[20] = unur_distr_uniform(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); + +# Weibull +fpm[0] = 3.; +distr[49] = unur_distr_weibull(fpm,1); + +fpm[0] = 0.5; +fpm[1] = 3.; +distr[50] = unur_distr_weibull(fpm,2); + +fpm[0] = 1.5; +fpm[1] = 2.; +fpm[2] = -5.; +distr[51] = unur_distr_weibull(fpm,3); + + +# truncated distributions +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); + +# distributions from scratch +distr[78] = unur_distr_cont_new(); +unur_distr_set_name( distr[78], "CDF_only" ); +unur_distr_cont_set_domain( distr[78], 0, UNUR_INFINITY ); +unur_distr_cont_set_cdf( distr[78], cdf_exp ); + +distr[79] = unur_distr_cont_new(); +unur_distr_set_name( distr[79], "CDF&invCDF" ); +unur_distr_cont_set_domain( distr[79], 0, UNUR_INFINITY ); +unur_distr_cont_set_cdf( distr[79], cdf_exp ); +unur_distr_cont_set_invcdf( distr[79], invcdf_exp ); + + +# number of distributions: 87 + + +[validate - test chi2:] + +# + ... pass test +# % ... initialize generator and draw small sample +# (for memory debugging when the CDF is not available) +# 0 ... fail to initialize generator (given variant does not exist) +# - ... fail test +# / ... either init fails or test passes +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... Inversion +# [1] -- [9] ... Variants 1 to 9 +# [10] ... inversion domain changed after initialization +# [11] ... change parameters to {2., 5.} (use default variant) +# +# 1 1 +#gen 0 1 2 3 4 5 6 7 8 9 0 1 # distribution +#------------------------------------------------------------- + <0> 0 + + . . . . . . . . . # beta (1, 2) + <1> . + + . . . . . . . . . # beta (1, 5) + <80> . + + . . . . . . . . . # beta (5, 1) + <81> . + + . . . . . . . . . # beta (1, 1) +x <2> . + . . . . . . . . . . # beta (1, 100) + <3> . + + . . . . . . . . . # beta (3, 4) + <60> . + + . . . . . . . . . # beta (7, 0.5) + <61> . + + . . . . . . . . . # beta (0.7, 0.5) +#<62> . + + . . . . . . . . . # beta (7, 0.1, -1, 2) +x <4> . + . . . . . . . . . . # beta (5, 100) +x <5> . + . . . . . . . . . . # beta (500, 300) +x <6> . + . . . . . . . . . . # beta (5, 10, -3, 15) + <66> + . . . . . . . . . . . # burr (1) + <67> + . . . . . . . . . . . # burr (2,2) + <68> + . . . . . . . . . . . # burr (3,2,2) + <69> + . . . . . . . . . . . # burr (4,2,2) + <70> + . . . . . . . . . . . # burr (5,2,2) + <71> + . . . . . . . . . . . # burr (6,2,2) + <72> + . . . . . . . . . . . # burr (7,2) + <73> + . . . . . . . . . . . # burr (8,2) + <74> + . . . . . . . . . . . # burr (9,2,2) + <75> + . . . . . . . . . . . # burr (10,2) + <76> 0 . . . . . . . . . . . # burr (11,2) + <77> + . . . . . . . . . . . # burr (12,2,2) + <7> + . . . . . . . . . + + # cauchy () + <8> + . . . . . . . . . + + # cauchy (1, 20) + <23> 0 - . . . . . . . . . . # chi (0.5) +x<24> . + . . . . . . . . . + # chi (1) + <25> 0 + . . . . . . . . . . # chi (2) +x<26> . + . . . . . . . . . + # chi (50) + <27> + . . . . . . . . . + + # exponential () +x<28> + . . . . . . . . . + + # exponential (0.5) + <29> + . . . . . . . . . + + # exponential (5, -3) + <30> + . . . . . . . . . + + # extremeI () + <31> + . . . . . . . . . + + # extremeI (-3) + <32> + . . . . . . . . . + + # extremeI (-1, 5) + <33> + . . . . . . . . . + + # extremeII (3) + <34> + . . . . . . . . . + + # extremeII (0.5, -3) + <35> + . . . . . . . . . + + # extremeII (0.8, -1, 5) + <9> 0 + + . . . . . . . . + # gamma (1) +x<10> . + + . . . . . . . . + # gamma (2) + <11> . + + . . . . . . . . + # gamma (3) + <12> . + + . . . . . . . . + # gamma (10) +x<13> . + + . . . . . . . . + # gamma (1000) + <14> . + + . . . . . . . . + # gamma (5, 1000, 0) +x<15> . + + . . . . . . . . + # gamma (5, 1e-05, 0) +x<16> . + + . . . . . . . . + # gamma (5, 10, 100000) + <63> . + + . . . . . . . . + # gamma (0.5) +x<64> . + + . . . . . . . . + # gamma (0.2) + <83> . % . . . . . . . . . . # gig (0.5, 7, 1) + <86> . % . . . . . . . . . . # gig (0.5, 0.5, 1) + <36> + . . . . . . . . . + + # laplace () + <37> + . . . . . . . . . + + # laplace (-3) + <38> + . . . . . . . . . + + # laplace (-1, 5) + <39> + . . . . . . . . . + + # logistic () + <40> + . . . . . . . . . + + # logistic (-3) + <41> + . . . . . . . . . + + # logistic (-1, 5) + <56> + . . . . . . . . . + + # lomax (2, 3) + <57> + . . . . . . . . . + + # lomax (20, 0.4) + <58> + . . . . . . . . . + + # lomax (0.2, 40) + <59> + . . . . . . . . . + + # lomax (0.2, 0.5) + <17> + + + + + + + + . . / + # normal () +x<18> + + + + + + + + . . . + # normal (1, 1e-05) + <19> + + + + + + + + . . / + # normal (1, 1e+05) + <52> + . . . . . . . . . . + # pareto (2, 3) + <53> + . . . . . . . . . . + # pareto (20, 0.4) + <54> + . . . . . . . . . . + # pareto (0.2, 40) + <55> + . . . . . . . . . + + # pareto (0.2, 0.5) + <42> 0 - . . . . . . . . . . # powerexponential (0.5) + <43> . + . . . . . . . . . + # powerexponential (1) + <44> 0 + . . . . . . . . . . # powerexponential (2) + <45> . + . . . . . . . . . . # powerexponential (10) + <65> 0 - . . . . . . . . . . # rayleigh (1.) + <82> 0 % . . . . . . . . . . # slash () + <84> 0 + + . . . . . . . . . # student (2) + <85> 0 + 0 . . . . . . . . . # student (0.5) + <46> + . . . . . . . . . + . # triangular (0.7) +x<47> + . . . . . . . . . + . # triangular (0) +x<48> + . . . . . . . . . + . # triangular (1) + <49> + . . . . . . . . . + + # weibull (3) + <50> + . . . . . . . . . + + # weibull (0.5, 3) + <51> + . . . . . . . . . + + # weibull (1.5, 2, -5.) + <20> + . . . . . . . . . + + # uniform (1.5, 2, -5) + <21> + . . . . . . . . . . + # uniform (1, 20) + <22> + . . . . . . . . . + + # cauchy () - truncated + + <78> 0 . . . . . . . . . . . # given CDF + <79> + . . . . . . . . . . . # given CDF + invCDF + + +## F +## chisquare +## ghyp +## hyperbolic +## ig +## lognormal + + +############################################################################# + +[special] + +## Remark: +## +## In this section we merely test the existence of inversion. +## A few implementations seem to be rather inaccurate with respect to +## their u-errors. +## + +[special - decl:] + + int samplesize = UERROR_SAMPLESIZE; + double ures = UERROR_RESOLUTION; + + int errorsum = 0; + double fpar[5]; + + UNUR_DISTR *distr; + +[special - start:] + + /* test for maximal u-error */ + printf("\n[test maximal u-error for inversion method]\n"); + fprintf(TESTLOG,"\n* Test maximal u-error for inversion method *\n"); + +## ---------------------------------------------------- + + printf(" beta"); + + fpar[0] = 3.; + fpar[1] = 4.; + distr = unur_distr_beta(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 1.; + fpar[1] = 2.; + fpar[2] = 3.; + fpar[3] = 4.; + distr = unur_distr_beta(fpar,4); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" burr"); + + fpar[0] = 1.; + distr = unur_distr_burr(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 2.; + fpar[1] = 2.; + distr = unur_distr_burr(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 3.; + fpar[1] = 2.; + fpar[2] = 3.; + distr = unur_distr_burr(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 4.; + fpar[1] = 1.; + fpar[2] = 2.; + distr = unur_distr_burr(fpar,3); + errorsum += estimate_uerror(distr,1e-10,samplesize); + /* computation of CDF and /or inverse CDF is not seem very accurate */ + + fpar[0] = 5.; + fpar[1] = 2.; + fpar[2] = 3.; + distr = unur_distr_burr(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 6.; + fpar[1] = 2.; + fpar[2] = 3.; + distr = unur_distr_burr(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 7.; + fpar[1] = 2.; + fpar[2] = 3.; + distr = unur_distr_burr(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 8.; + fpar[1] = 2.; + distr = unur_distr_burr(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 9.; + fpar[1] = 2.; + fpar[2] = 3.; + distr = unur_distr_burr(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 10.; + fpar[1] = 2.; + distr = unur_distr_burr(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 11.; + fpar[1] = 2.; + distr = unur_distr_burr(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 12.; + fpar[1] = 2.; + fpar[2] = 3.; + distr = unur_distr_burr(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" cauchy"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_cauchy(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" chi"); + fpar[0] = 3.; + distr = unur_distr_chi(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" chisquare"); + fpar[0] = 3.; + distr = unur_distr_chisquare(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" exponential"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_exponential(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" extremeI"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_extremeI(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" extremeII"); + fpar[0] = 1.; + fpar[1] = 2.; + fpar[2] = 3.; + distr = unur_distr_extremeII(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" F"); + fpar[0] = 3.; + fpar[1] = 4.; + distr = unur_distr_F(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" gamma"); + + fpar[0] = 5.; + distr = unur_distr_gamma(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 4.; + fpar[1] = 3.; + distr = unur_distr_gamma(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 3.; + fpar[1] = 2.; + fpar[2] = 1.; + distr = unur_distr_gamma(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" gig"); + fpar[0] = 1.; + fpar[1] = 2.; + fpar[1] = 3.; + distr = unur_distr_gig(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" gig2"); + fpar[0] = 1.; + fpar[1] = 2.; + fpar[2] = 3.; + distr = unur_distr_gig2(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" ghyp"); + fpar[0] = 1.; + fpar[1] = 3.; + fpar[2] = 2.; + fpar[3] = 4.; + fpar[4] = 5.; + distr = unur_distr_ghyp(fpar,5); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" hyperbolic"); + fpar[0] = 3.; + fpar[1] = 2.; + fpar[2] = 2.; + fpar[3] = 2.; + distr = unur_distr_hyperbolic(fpar,4); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" ig"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_ig(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" laplace"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_laplace(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" logistic"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_logistic(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" lognormal"); + fpar[0] = 1.; + fpar[1] = 2.; + fpar[2] = 3.; + distr = unur_distr_lognormal(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" lomax"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_lomax(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" normal"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_normal(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" pareto"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_pareto(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" powerexponential"); + fpar[0] = 3.; + distr = unur_distr_powerexponential(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" rayleigh"); + fpar[0] = 2.; + distr = unur_distr_rayleigh(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" slash"); + distr = unur_distr_slash(NULL,0); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" student"); + fpar[0] = 4.4; + distr = unur_distr_student(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" triangular"); + fpar[0] = 0.7; + distr = unur_distr_triangular(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" uniform"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_uniform(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" weibull"); + fpar[0] = 1.; + fpar[1] = 2.; + distr = unur_distr_weibull(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + +/*---------------------------------------------------------------------------*/ + + /* test finished */ + FAILED = (errorsum < 2) ? 0 : 1; + +############################################################################# + +[verbatim] + +############################################################################# +# +# routines for special tests +# +############################################################################# + +int +estimate_uerror( UNUR_DISTR *distr, /* distribution object */ + double u_resolution, /* maximal tolerated u-error */ + int samplesize ) /* sample size for error experiment */ +/* returns 0 if maxerror < u_resolution, errorcode otherwise */ +{ + UNUR_PAR *par; + UNUR_GEN *gen; + int i, nfpar; + const double *fpar; + double score; + + /* print data about distribution */ + fprintf(TESTLOG,"> %s (",unur_distr_get_name(distr)); + nfpar = unur_distr_cont_get_pdfparams(distr,&fpar); + for(i=0;i inversion method not implemented !!\n\n"); + printf("0"); fflush(stdout); + if (par) unur_par_free(par); + unur_distr_free(distr); + return 0; + } + + /* initialize generator object */ + gen = unur_init(par); + + /* run test */ + score = run_validate_u_error( TESTLOG, gen, distr, u_resolution, samplesize ); + + /* clear working space */ + unur_distr_free(distr); + unur_free(gen); + + /* return */ + fprintf(TESTLOG,"\n"); + return score; + +} /* end of estimate_uerror() */ + +############################################################################# +# +# PDFs and CDF for test distributions +# +############################################################################# + +double cdf_exp(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { + return ((x<0.) ? 0. : 1.-exp(-x)); +} + +double invcdf_exp(double u, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { + return (-log(1.- u)); +} + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_dari.c b/vendor/unuran-1.11.0/tests/t_dari.c new file mode 100644 index 0000000..3a9d926 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_dari.c @@ -0,0 +1,5098 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for DARI + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +int unur_dari_set_pedantic( struct unur_par *par, int pedantic ); + +double pmf_poisson5(int k, const UNUR_DISTR *distr); +double pmf_poisson5_NaN(int k, const UNUR_DISTR *distr); +double pmf_poisson50(int k, const UNUR_DISTR *distr); + +double pmf_negpoisson5(int k, const UNUR_DISTR *distr); +double pmf_negpoisson50(int k, const UNUR_DISTR *distr); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + +/* #define SEED (298346) */ + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* no such function */ +int unur_dari_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +#include + +double pmf_poisson5(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double theta = 5.; + return ((k<0) ? 0. : exp( -theta + k * log(theta) - _unur_SF_ln_factorial(k) )); +} + +double pmf_poisson5_NaN(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double theta = 5.; + return ((k<0) ? 0. : exp( -theta + k * log(theta)) / exp (_unur_SF_ln_factorial(k) )); +} + +double pmf_poisson50(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double theta = 50.; + return ((k<0) ? 0. : exp( -theta + k * log(theta) - _unur_SF_ln_factorial(k) )); +} + +double pmf_negpoisson5(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double theta = 5.; + k *= -1; + return ((k<0) ? 0. : exp( -theta + k * log(theta) - _unur_SF_ln_factorial(k) )); +} + +double pmf_negpoisson50(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double theta = 50.; + k *= -1; + return ((k<0) ? 0. : exp( -theta + k * log(theta) - _unur_SF_ln_factorial(k) )); +} + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,36,(unur_dari_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,36,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,42,(unur_dari_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); /* no PMF */ + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,48,(unur_dari_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,48,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,58,(unur_dari_set_cpfactor(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,58,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,61,(unur_dari_set_squeeze(par, 1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,61,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,64,(unur_dari_set_tablesize(par,100)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,64,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,67,(unur_dari_set_verify(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,67,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[1] = {0.5}; + distr = unur_distr_geometric(fpar,1); + par = unur_dgt_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,76,(unur_dari_set_cpfactor(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_dari_set_squeeze(par, 1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,82,(unur_dari_set_tablesize(par,100)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,82,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,85,(unur_dari_set_verify(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,85,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[1] = {0.5}; + distr = unur_distr_geometric(fpar,1); + par = unur_dari_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,95,(unur_dari_set_cpfactor(par,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,95,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_dari_set_cpfactor(par,3.); +n_tests_failed += (check_errorcode(TESTLOG,98,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,101,(unur_dari_set_tablesize(par,-100)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[1] = {0.5}; + distr = unur_distr_geometric(fpar,1); + par = unur_dgt_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 117, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,121,(unur_dari_chg_verify( gen,1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,121,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[1] = {0.5}; + distr = unur_distr_geometric(fpar,1); + par = unur_dari_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 135, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,139,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[] = {0.1}; + distr = unur_distr_geometric(fpar,1); + par = NULL; + + +unur_reset_errno(); +/* default algorithm */ +par = unur_dari_new(distr); +n_tests_failed += (compare_sequence_par_start(TESTLOG,152,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* default algorithm - verifying mode */ +par = unur_dari_new(distr); +unur_dari_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,157,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_dari_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,171,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,177,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_dari_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,190,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,194,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[] = {20, 0.8}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_binomial(fpar,2); +par = unur_dari_new(distr); +unur_dari_set_cpfactor(par,0.7); +unur_dari_set_squeeze(par,TRUE); +unur_dari_set_tablesize(par,30); +unur_dari_set_verify(par,FALSE); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,211,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "binomial(20,0.8) & \ + method = dari; cpfactor = 0.7; squeeze; tablesize = 30; verify = off" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,217,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[23]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 23 */ +{ +fpm[0] = 0.5; +distr[0] = unur_distr_geometric(fpm,1); +} + +{ +fpm[0] = 0.1; +distr[1] = unur_distr_geometric(fpm,1); +} + +{ +fpm[0] = 0.001; +distr[2] = unur_distr_geometric(fpm,1); +} + +{ +fpm[0] = 0.1; +distr[3] = unur_distr_logarithmic(fpm,1); +} + +{ +fpm[0] = 0.9; +distr[4] = unur_distr_logarithmic(fpm,1); +} + +{ +fpm[0] = 0.5; +fpm[1] = 10.; +distr[5] = unur_distr_negativebinomial(fpm,2); +} + +{ +fpm[0] = 0.7; +fpm[1] = 5.; +distr[6] = unur_distr_negativebinomial(fpm,2); +} + +{ +fpm[0] = 0.1; +fpm[1] = 20.; +distr[7] = unur_distr_negativebinomial(fpm,2); +} + +{ +fpm[0] = 3.; +distr[8] = unur_distr_poisson(fpm,1); +} + +{ +fpm[0] = 50.; +distr[9] = unur_distr_poisson(fpm,1); +} + +{ +fpm[0] = 2.; +fpm[1] = 1.; +distr[10] = unur_distr_zipf(fpm,2); +unur_distr_discr_set_domain(distr[10],1,1000); +} + +{ +fpm[0] = 20.; +fpm[1] = 0.8; +distr[11] = unur_distr_binomial(fpm,2); +} + +{ +fpm[0] = 2000.; +fpm[1] = 0.0013; +distr[12] = unur_distr_binomial(fpm,2); +} + +{ +fpm[0] = 2000.; +fpm[1] = 200.; +fpm[2] = 20; +distr[13] = unur_distr_hypergeometric(fpm,3); +} + +{ +fpm[0] = 2000.; +fpm[1] = 200.; +fpm[2] = 220; +distr[14] = unur_distr_hypergeometric(fpm,3); +} + +{ +distr[15] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[15],pmf_poisson5); +unur_distr_set_name(distr[15],"test-poisson"); +} + +{ +distr[16] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[16],pmf_poisson5); +unur_distr_set_name(distr[16],"test-poisson"); +} + +{ +distr[17] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[17],pmf_poisson5); +unur_distr_set_name(distr[17],"test-poisson"); +} + +{ +distr[18] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[18],pmf_poisson5); +unur_distr_discr_set_domain(distr[18],INT_MIN,INT_MAX); +unur_distr_set_name(distr[18],"test-poisson"); +} + +{ +distr[19] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[19],pmf_negpoisson5); +unur_distr_discr_set_domain(distr[19],INT_MIN,INT_MAX); +unur_distr_set_name(distr[19],"test-poisson"); +} + +{ +distr[20] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[20],pmf_negpoisson5); +unur_distr_discr_set_domain(distr[20],INT_MIN,0); +unur_distr_set_name(distr[20],"test-poisson"); +} + +{ +distr[21] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[21],pmf_negpoisson50); +unur_distr_discr_set_domain(distr[21],INT_MIN,INT_MAX); +unur_distr_set_name(distr[21],"test-poisson"); +} + +{ +distr[22] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[22],pmf_negpoisson50); +unur_distr_discr_set_domain(distr[22],INT_MIN,0); +unur_distr_set_name(distr[22],"test-poisson"); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 161 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); +fpm[0] = 0.4; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,1); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); +fpm[0] = 0.4; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,1); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); +fpm[0] = 0.4; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,1); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); +fpm[0] = 0.4; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,1); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); +fpm[0] = 0.4; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,1); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_dari_new(distr_localcopy); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 161 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +fpm[0] = 0.4; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,1); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +fpm[0] = 0.4; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,1); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +fpm[0] = 0.4; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,1); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +fpm[0] = 0.4; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,1); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +fpm[0] = 0.4; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,1); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + gen = unur_init(par); + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_dari_new(distr_localcopy); + unur_dari_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dari_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_dari_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_dari.conf b/vendor/unuran-1.11.0/tests/t_dari.conf new file mode 100644 index 0000000..31d9bad --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_dari.conf @@ -0,0 +1,513 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: DARI + +[main - header:] + +/* prototypes */ + +int unur_dari_set_pedantic( struct unur_par *par, int pedantic ); + +double pmf_poisson5(int k, const UNUR_DISTR *distr); +double pmf_poisson5_NaN(int k, const UNUR_DISTR *distr); +double pmf_poisson50(int k, const UNUR_DISTR *distr); + +double pmf_negpoisson5(int k, const UNUR_DISTR *distr); +double pmf_negpoisson50(int k, const UNUR_DISTR *distr); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* \#define SEED (298346) */ + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_cont_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_discr_new(); /* no PMF */ ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################## + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_cpfactor(par,1.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_squeeze(par, 1); + --> expected_setfailed --> UNUR_ERR_NULL + +~_tablesize(par,100); + --> expected_setfailed --> UNUR_ERR_NULL + +~_verify(par,1); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameter object: + double fpar[1] = {0.5}; + distr = unur_distr_geometric(fpar,1); + par = unur_dgt_new(distr); ] + +~_cpfactor(par,1.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_squeeze(par, 1); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_tablesize(par,100); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_verify(par,1); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + +[set - invalid parameters: + double fpar[1] = {0.5}; + distr = unur_distr_geometric(fpar,1); + par = unur_dari_new(distr); ] + +~_cpfactor(par,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_cpfactor(par,3.); + --> none --> UNUR_ERR_PAR_SET + +~_tablesize(par,-100); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + +############################################################################## + +# [get] + +############################################################################## + +[chg] + +[chg - invalid generator object: + double fpar[1] = {0.5}; + distr = unur_distr_geometric(fpar,1); + par = unur_dgt_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_verify( gen,1 ); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + + +############################################################################# + +# [init] + +############################################################################## + +[reinit] + +[reinit - exist: + double fpar[1] = {0.5}; + distr = unur_distr_geometric(fpar,1); + par = unur_dari_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################## + +[sample] + +[sample - compare: + double fpar[] = {0.1}; + distr = unur_distr_geometric(fpar,1); + par = NULL; ] + +/* default algorithm */ +par = unur_dari_new(distr); + -->compare_sequence_par_start + +/* default algorithm - verifying mode */ +par = unur_dari_new(distr); +unur_dari_set_verify(par,1); + -->compare_sequence_par + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_dari_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare reinit: + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_dari_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + double fpar[] = {20, 0.8}; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_binomial(fpar,2); +par = unur_dari_new(distr); +unur_dari_set_cpfactor(par,0.7); +unur_dari_set_squeeze(par,TRUE); +unur_dari_set_tablesize(par,30); +unur_dari_set_verify(par,FALSE); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "binomial(20,0.8) & \ + method = dari; cpfactor = 0.7; squeeze; tablesize = 30; verify = off" ); + -->compare_sequence_gen + + +############################################################################## + +[validate] + +[validate - generators:] + +# default +par[0] = unur_dari_new(@distr@); + +# with table and with squeeze +par[1] = unur_dari_new(@distr@); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 1); + +# with table and without squeeze +par[2] = unur_dari_new(@distr@); +unur_dari_set_tablesize(par, 100); +unur_dari_set_squeeze(par, 0); + +# without table and with squeeze +par[3] = unur_dari_new(@distr@); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 1); + +# without table and without squeeze +par[4] = unur_dari_new(@distr@); +unur_dari_set_tablesize(par, 0); +unur_dari_set_squeeze(par, 0); + +# default variant but reinitialized with changed domain +{ UNUR_DISTR *dg =NULL; +par[5] = unur_dari_new(@distr@); +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,5); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + +# default variant but reinitialized with changed pmf parameters +{ UNUR_DISTR *dg =NULL; +par[6] = unur_dari_new(@distr@); +fpm[0] = 0.4; +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,1); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + + +[validate - distributions:] + +# geometric disctribution +fpm[0] = 0.5; +distr[0] = unur_distr_geometric(fpm,1); + +fpm[0] = 0.1; +distr[1] = unur_distr_geometric(fpm,1); + +fpm[0] = 0.001; +distr[2] = unur_distr_geometric(fpm,1); + +# logarithmic distribution +fpm[0] = 0.1; +distr[3] = unur_distr_logarithmic(fpm,1); + +fpm[0] = 0.9; +distr[4] = unur_distr_logarithmic(fpm,1); + +# negative binomial distribution +fpm[0] = 0.5; +fpm[1] = 10.; +distr[5] = unur_distr_negativebinomial(fpm,2); + +fpm[0] = 0.7; +fpm[1] = 5.; +distr[6] = unur_distr_negativebinomial(fpm,2); + +fpm[0] = 0.1; +fpm[1] = 20.; +distr[7] = unur_distr_negativebinomial(fpm,2); + +# poisson distribution +fpm[0] = 3.; +distr[8] = unur_distr_poisson(fpm,1); + +fpm[0] = 50.; +distr[9] = unur_distr_poisson(fpm,1); + +# zipf distribution +fpm[0] = 2.; +fpm[1] = 1.; +distr[10] = unur_distr_zipf(fpm,2); +unur_distr_discr_set_domain(distr[10],1,1000); + +# binomial distribution +fpm[0] = 20.; +fpm[1] = 0.8; +distr[11] = unur_distr_binomial(fpm,2); + +# binomial distribution +fpm[0] = 2000.; +fpm[1] = 0.0013; +distr[12] = unur_distr_binomial(fpm,2); + +# Hyper geometric distribution +fpm[0] = 2000.; +fpm[1] = 200.; +fpm[2] = 20; +distr[13] = unur_distr_hypergeometric(fpm,3); + +# Hyper geometric distribution +fpm[0] = 2000.; +fpm[1] = 200.; +fpm[2] = 220; +distr[14] = unur_distr_hypergeometric(fpm,3); + +# Special tests with Poission distribution +distr[15] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[15],pmf_poisson5); +unur_distr_set_name(distr[15],"test-poisson"); + +distr[16] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[16],pmf_poisson5); +unur_distr_set_name(distr[16],"test-poisson"); + +distr[17] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[17],pmf_poisson5); +unur_distr_set_name(distr[17],"test-poisson"); + +distr[18] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[18],pmf_poisson5); +unur_distr_discr_set_domain(distr[18],INT_MIN,INT_MAX); +unur_distr_set_name(distr[18],"test-poisson"); + +distr[19] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[19],pmf_negpoisson5); +unur_distr_discr_set_domain(distr[19],INT_MIN,INT_MAX); +unur_distr_set_name(distr[19],"test-poisson"); + +distr[20] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[20],pmf_negpoisson5); +unur_distr_discr_set_domain(distr[20],INT_MIN,0); +unur_distr_set_name(distr[20],"test-poisson"); + +distr[21] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[21],pmf_negpoisson50); +unur_distr_discr_set_domain(distr[21],INT_MIN,INT_MAX); +unur_distr_set_name(distr[21],"test-poisson"); + +distr[22] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[22],pmf_negpoisson50); +unur_distr_discr_set_domain(distr[22],INT_MIN,0); +unur_distr_set_name(distr[22],"test-poisson"); + + +# number of distributions: 23 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator (given variant does not exist) +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default +# [1] ... with table and with squeeze +# [2] ... with table and without squeeze +# [3] ... without table and with squeeze +# [4] ... without table and without squeeze +# [5] ... default variant but reinitialized with changed domain +# [6] ... default variant but reinitialized with changed pmf parameters +# +#gen 0 1 2 3 4 5 6 # distribution +#------------------------------------------------------------- + <0> + + + + + + + # geometric (0.5) +x <1> + + + + + + + # geometric (0.1) + <2> + + + + + + + # geometric (0.001) + <3> + + + + + + + # logarithmic (0.1) + <4> + + + + + + + # logarithmic (0.9) +x <5> + + + + + + . # negativebinomial (0.5, 10) + <6> + + + + + + . # negativebinomial (0.7, 5) + <7> + + + + + + . # negativebinomial (0.1, 20) + <8> + + + + + + . # poisson (3) + <9> + + + + + + . # poisson (50) + <10> + + + + + + . # zipf (2, 1) + <11> + + + + + + . # binomial (20, 0.8) + <12> + + + + + + . # binomial (2000, 0.0013) + <13> + + + + + + . # hypergeometric (2000, 200, 20) +x<14> + + + + + + . # hypergeometric (2000, 200, 220) + + <15> + + + + + + . # poisson (5), search for mode + <16> + + + + + + . # poisson (5), search for mode, returns NaN + <17> + + + + + + . # poisson (50), search for mode +#<18> + + + + + + . # poisson (5), search for mode, domain = (-oo,oo) +#<19> + + + + + + . # -poisson (5), search for mode, domain = (-oo,oo) +#<20> + + + + + + . # -poisson (5), search for mode, domain = (-oo,0) +#<21> + + + + + + . # -poisson (50), search for mode, domain = (-oo,oo) +#<22> + + + + + + . # -poisson (50), search for mode, domain = (-oo,0) + + +[validate - verify hat:] + +# + ... pass test +# ~ ... fail in at most 1% of samples +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# + +# generators: +# [0] ... default +# [1] ... with table and with squeeze +# [2] ... with table and without squeeze +# [3] ... without table and with squeeze +# [4] ... without table and without squeeze +# [5] ... default variant but reinitialized with changed domain +# [6] ... default variant but reinitialized with changed pmf parameters +# +#gen 0 1 2 3 4 5 6 # distribution +#------------------------------------------------------------- + <0> + + + + + + + # geometric (0.5) +x <1> + + + + + + + # geometric (0.1) + <2> + + + + + + + # geometric (0.001) + <3> + + + + + + + # logarithmic (0.1) + <4> + + + + + + + # logarithmic (0.9 ) +x <5> + + + + + + . # negativebinomial (0.5, 10) + <6> + + + + + + . # negativebinomial (0.7, 5) + <7> + + + + + + . # negativebinomial (0.1, 20) + <8> + + + + + + . # poisson (3) + <9> + + + + + + . # poisson (50) + <10> + + + + + + . # zipf (2, 1) + <11> + + + + + + . # binomial (20, 0.8) + <12> + + + + + + . # binomial (2000, 0.0013) + <13> + + + + + + . # hypergeometric (2000, 200, 20) +x<14> + + + + + + . # hypergeometric (2000, 200, 220) + + <15> + + + + + + . # poisson (5), search for mode + <16> + + + + + + . # poisson (5), search for mode, returns NaN + <17> + + + + + + . # poisson (50), search for mode +#<18> + + + + + + . # poisson (5), search for mode, domain = (-oo,oo) + <19> 0 0 0 0 0 0 . # -poisson (5), search for mode, domain = (-oo,oo) +#<20> + + + + + + . # -poisson (5), search for mode, domain = (-oo,0) +#<21> + + + + + + . # -poisson (50), search for mode, domain = (-oo,oo) +#<22> + + + + + + . # -poisson (50), search for mode, domain = (-oo,0) + + +############################################################################## +############################################################################## + +[verbatim] + +/* no such function */ +int unur_dari_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +\#include + +double pmf_poisson5(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double theta = 5.; + return ((k<0) ? 0. : exp( -theta + k * log(theta) - _unur_SF_ln_factorial(k) )); +} + +double pmf_poisson5_NaN(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double theta = 5.; + return ((k<0) ? 0. : exp( -theta + k * log(theta)) / exp (_unur_SF_ln_factorial(k) )); +} + +double pmf_poisson50(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double theta = 50.; + return ((k<0) ? 0. : exp( -theta + k * log(theta) - _unur_SF_ln_factorial(k) )); +} + +double pmf_negpoisson5(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double theta = 5.; + k *= -1; + return ((k<0) ? 0. : exp( -theta + k * log(theta) - _unur_SF_ln_factorial(k) )); +} + +double pmf_negpoisson50(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double theta = 50.; + k *= -1; + return ((k<0) ? 0. : exp( -theta + k * log(theta) - _unur_SF_ln_factorial(k) )); +} + +############################################################################## diff --git a/vendor/unuran-1.11.0/tests/t_dau.c b/vendor/unuran-1.11.0/tests/t_dau.c new file mode 100644 index 0000000..ebbca5c --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_dau.c @@ -0,0 +1,2255 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for DAU + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_dau_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + +double *make_geometric_vector(double q, int len); +double *make_random_vector(int len); +UNUR_DISTR *get_distr_with_invalid_pv( void ); +UNUR_DISTR *get_distr_with_pv( void ); + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/*---------------------------------------------------------------------------*/ + +/* make a probability vector (need not sum to one) + (use random entries) */ +double *make_random_vector(int len) +{ + double *pv; + int i; + + /* allocate memory */ + pv = malloc(len*sizeof(double)); + if (!pv) abort(); + + /* main part of geometric distribution */ + for( i=0; itime = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,52,(unur_dau_set_urnfactor(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = get_distr_with_pv(); + par = unur_dgt_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,59,(unur_dau_set_urnfactor(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,59,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = get_distr_with_pv(); + par = unur_dau_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_dau_set_urnfactor(par,0.8)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,88,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid data */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = get_distr_with_invalid_pv(); + par = unur_dau_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,96,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,96,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dau_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 107, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,111,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_dau_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,128,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,134,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_dau_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,147,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,151,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double pv[] = {.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.}; + double fpar[] = {0.8}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_discr_new(); +unur_distr_discr_set_pv(distr,pv,10); +par = unur_dau_new(distr); +unur_dau_set_urnfactor(par,3.); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,167,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.) & \ + method = dau; urnfactor = 3." ); +n_tests_failed += (compare_sequence_gen(TESTLOG,173,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_geometric(fpar,1); +par = unur_dau_new(distr); +unur_dau_set_urnfactor(par,3.); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,181,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "geometric(0.8) & method = dau; urnfactor = 3." ); +n_tests_failed += (compare_sequence_gen(TESTLOG,186,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[23]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 23 */ +{ +distr[0] = unur_distr_discr_new(); +darray = make_random_vector(10); +unur_distr_discr_set_pv(distr[0],darray,10); +free(darray); +unur_distr_set_name(distr[0],"pv(random)"); +} + +{ +distr[1] = unur_distr_discr_new(); +darray = make_random_vector(100); +unur_distr_discr_set_pv(distr[1],darray,100); +free(darray); +unur_distr_set_name(distr[1],"pv(random)"); +} + +{ +distr[2] = unur_distr_discr_new(); +darray = make_random_vector(1000); +unur_distr_discr_set_pv(distr[2],darray,1000); +free(darray); +unur_distr_set_name(distr[2],"pv(random)"); +} + +{ +distr[3] = unur_distr_discr_new(); +darray = make_random_vector(10000); +unur_distr_discr_set_pv(distr[3],darray,10000); +free(darray); +unur_distr_set_name(distr[3],"pv(random)"); +} + +{ +distr[4] = unur_distr_discr_new(); +darray = make_geometric_vector(1.,1000); +unur_distr_discr_set_pv(distr[4],darray,1000); +free(darray); +unur_distr_set_name(distr[4],"pv(geometric)"); +} + +{ +distr[5] = unur_distr_discr_new(); +darray = make_geometric_vector(0.99,1000); +unur_distr_discr_set_pv(distr[5],darray,1000); +free(darray); +unur_distr_set_name(distr[5],"pv(geometric)"); +} + +{ +distr[6] = unur_distr_discr_new(); +darray = make_geometric_vector(0.9,1000); +unur_distr_discr_set_pv(distr[6],darray,1000); +free(darray); +unur_distr_set_name(distr[6],"pv(geometric)"); +} + +{ +distr[7] = unur_distr_discr_new(); +darray = make_geometric_vector(0.5,1000); +unur_distr_discr_set_pv(distr[7],darray,1000); +free(darray); +unur_distr_set_name(distr[7],"pv(geometric)"); +} + +{ +distr[8] = unur_distr_discr_new(); +darray = make_geometric_vector(0.1,1000); +unur_distr_discr_set_pv(distr[8],darray,1000); +free(darray); +unur_distr_set_name(distr[8],"pv(geometric)"); +} + +{ +distr[9] = unur_distr_discr_new(); +darray = make_geometric_vector(0.9,100); +unur_distr_discr_set_pv(distr[9],darray,100); +unur_distr_discr_set_domain(distr[9],10,209); +free(darray); +unur_distr_set_name(distr[9],"pv(geometric) - shifted domain"); +} + +{ +distr[10] = unur_distr_discr_new(); +darray = make_geometric_vector(0.9,100); +unur_distr_discr_set_pv(distr[10],darray,100); +unur_distr_discr_set_domain(distr[10],-10,209); +free(darray); +unur_distr_set_name(distr[10],"pv(geometric) - shifted domain"); +} + +{ +fpm[0] = 0.5; +distr[11] = unur_distr_geometric(fpm,1); +} + +{ +fpm[0] = 0.001; +distr[12] = unur_distr_geometric(fpm,1); +} + +{ +fpm[0] = 0.1; +distr[13] = unur_distr_logarithmic(fpm,1); +} + +{ +fpm[0] = 0.999; +distr[14] = unur_distr_logarithmic(fpm,1); +} + +{ +fpm[0] = 0.5; +fpm[1] = 10.; +distr[15] = unur_distr_negativebinomial(fpm,2); +} + +{ +fpm[0] = 0.01; +fpm[1] = 20.; +distr[16] = unur_distr_negativebinomial(fpm,2); +} + +{ +fpm[0] = 0.1; +distr[17] = unur_distr_poisson(fpm,1); +} + +{ +fpm[0] = 0.999; +distr[18] = unur_distr_poisson(fpm,1); +} + +{ +fpm[0] = 2.; +fpm[1] = 1.; +distr[19] = unur_distr_zipf(fpm,2); +unur_distr_discr_set_domain(distr[19],1,1000); +} + +{ +fpm[0] = 0.001; +fpm[1] = 1.; +distr[20] = unur_distr_zipf(fpm,2); +unur_distr_discr_set_domain(distr[20],1,1000); +} + +{ +fpm[0] = 20.; +fpm[1] = 0.8; +distr[21] = unur_distr_binomial(fpm,2); +} + +{ +fpm[0] = 2000.; +fpm[1] = 0.0013; +distr[22] = unur_distr_binomial(fpm,2); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 92 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [3] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [4] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [6] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [8] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [17] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [18] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [20] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); +fpm[0] = 10.; +fpm[1] = 0.63; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_dau_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_dau_new(distr_localcopy); +unur_dau_set_urnfactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_dau_new(distr_localcopy); +fpm[0] = 10.; +fpm[1] = 0.63; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_dau_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_dau.conf b/vendor/unuran-1.11.0/tests/t_dau.conf new file mode 100644 index 0000000..5f42cc6 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_dau.conf @@ -0,0 +1,489 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: DAU + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +double *make_geometric_vector(double q, int len); +double *make_random_vector(int len); +UNUR_DISTR *get_distr_with_invalid_pv( void ); +UNUR_DISTR *get_distr_with_pv( void ); + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_cont_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_discr_new(); /* no probability vector */ ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_urnfactor(par,1.); + --> expected_setfailed --> UNUR_ERR_NULL + +[set - invalid parameter object: + distr = get_distr_with_pv(); + par = unur_dgt_new(distr); ] + +~_urnfactor(par,1.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + +[set - invalid parameters: + distr = get_distr_with_pv(); + par = unur_dau_new(distr); ] + +~_urnfactor(par,0.8); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + + +[init - invalid data: + distr = get_distr_with_invalid_pv(); + par = unur_dau_new(distr); ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_DATA + + + +############################################################################# + +[reinit] + +[reinit - exist: + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dau_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + + +############################################################################# + +[sample] + +[sample - compare clone: + UNUR_GEN *clone; + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_dau_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare reinit: + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_dau_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + double pv[] = {.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.}; + double fpar[] = {0.8}; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_discr_new(); +unur_distr_discr_set_pv(distr,pv,10); +par = unur_dau_new(distr); +unur_dau_set_urnfactor(par,3.); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.) & \ + method = dau; urnfactor = 3." ); + -->compare_sequence_gen + + +unur_free(gen); gen = NULL; +distr = unur_distr_geometric(fpar,1); +par = unur_dau_new(distr); +unur_dau_set_urnfactor(par,3.); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "geometric(0.8) & method = dau; urnfactor = 3." ); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default program +par[0] = unur_dau_new(@distr@); +unur_set_debug(par, 1u); + +# larger urn table size +par[1] = unur_dau_new(@distr@); +unur_dau_set_urnfactor(par[1],10.); +unur_set_debug(par, 1u); + +# default variant but reinitialized with changed domain +{ UNUR_DISTR *dg =NULL; +par[2] = unur_dau_new(@distr@); +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + +# default variant but reinitialized with changed pdf parameters +{ UNUR_DISTR *dg =NULL; +par[3] = unur_dau_new(@distr@); +fpm[0] = 10.; +fpm[1] = 0.63; +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + +[validate - distributions:] + +# probability vector with random entries +distr[0] = unur_distr_discr_new(); +darray = make_random_vector(10); +unur_distr_discr_set_pv(distr[0],darray,10); +free(darray); +unur_distr_set_name(distr[0],"pv(random)"); + +distr[1] = unur_distr_discr_new(); +darray = make_random_vector(100); +unur_distr_discr_set_pv(distr[1],darray,100); +free(darray); +unur_distr_set_name(distr[1],"pv(random)"); + +distr[2] = unur_distr_discr_new(); +darray = make_random_vector(1000); +unur_distr_discr_set_pv(distr[2],darray,1000); +free(darray); +unur_distr_set_name(distr[2],"pv(random)"); + +distr[3] = unur_distr_discr_new(); +darray = make_random_vector(10000); +unur_distr_discr_set_pv(distr[3],darray,10000); +free(darray); +unur_distr_set_name(distr[3],"pv(random)"); + +# probability vector with geometrically distributed entries +distr[4] = unur_distr_discr_new(); +darray = make_geometric_vector(1.,1000); +unur_distr_discr_set_pv(distr[4],darray,1000); +free(darray); +unur_distr_set_name(distr[4],"pv(geometric)"); + +distr[5] = unur_distr_discr_new(); +darray = make_geometric_vector(0.99,1000); +unur_distr_discr_set_pv(distr[5],darray,1000); +free(darray); +unur_distr_set_name(distr[5],"pv(geometric)"); + +distr[6] = unur_distr_discr_new(); +darray = make_geometric_vector(0.9,1000); +unur_distr_discr_set_pv(distr[6],darray,1000); +free(darray); +unur_distr_set_name(distr[6],"pv(geometric)"); + +distr[7] = unur_distr_discr_new(); +darray = make_geometric_vector(0.5,1000); +unur_distr_discr_set_pv(distr[7],darray,1000); +free(darray); +unur_distr_set_name(distr[7],"pv(geometric)"); + +distr[8] = unur_distr_discr_new(); +darray = make_geometric_vector(0.1,1000); +unur_distr_discr_set_pv(distr[8],darray,1000); +free(darray); +unur_distr_set_name(distr[8],"pv(geometric)"); + +# probability vecotr with geometrically distributed entries and shifted domain +distr[9] = unur_distr_discr_new(); +darray = make_geometric_vector(0.9,100); +unur_distr_discr_set_pv(distr[9],darray,100); +unur_distr_discr_set_domain(distr[9],10,209); +free(darray); +unur_distr_set_name(distr[9],"pv(geometric) - shifted domain"); + +distr[10] = unur_distr_discr_new(); +darray = make_geometric_vector(0.9,100); +unur_distr_discr_set_pv(distr[10],darray,100); +unur_distr_discr_set_domain(distr[10],-10,209); +free(darray); +unur_distr_set_name(distr[10],"pv(geometric) - shifted domain"); + +# PMF instead of PV + +# geometric disctribution +fpm[0] = 0.5; +distr[11] = unur_distr_geometric(fpm,1); + +fpm[0] = 0.001; +distr[12] = unur_distr_geometric(fpm,1); + +# logarithmic distribution +fpm[0] = 0.1; +distr[13] = unur_distr_logarithmic(fpm,1); + +fpm[0] = 0.999; +distr[14] = unur_distr_logarithmic(fpm,1); + +# negative binomial distribution +fpm[0] = 0.5; +fpm[1] = 10.; +distr[15] = unur_distr_negativebinomial(fpm,2); + +fpm[0] = 0.01; +fpm[1] = 20.; +distr[16] = unur_distr_negativebinomial(fpm,2); + +# poisson distribution +fpm[0] = 0.1; +distr[17] = unur_distr_poisson(fpm,1); + +fpm[0] = 0.999; +distr[18] = unur_distr_poisson(fpm,1); + +# zipf distribution +fpm[0] = 2.; +fpm[1] = 1.; +distr[19] = unur_distr_zipf(fpm,2); +unur_distr_discr_set_domain(distr[19],1,1000); + +fpm[0] = 0.001; +fpm[1] = 1.; +distr[20] = unur_distr_zipf(fpm,2); +unur_distr_discr_set_domain(distr[20],1,1000); + +# binomial distribution +fpm[0] = 20.; +fpm[1] = 0.8; +distr[21] = unur_distr_binomial(fpm,2); + +fpm[0] = 2000.; +fpm[1] = 0.0013; +distr[22] = unur_distr_binomial(fpm,2); + +# number of distributions: 23 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# [0] ... default +# [1] ... larger urn table size +# [2] ... default variant but reinitialized with changed domain +# [3] ....default variant but reinitialized with changed pdf parameters +# +#gen 0 1 2 3 # distribution +#------------------------------------- + <0> + + + . # PV with random entries + <1> + + + . + <2> + + + . +x <3> + + + . + +x <4> + + + . # PV with geometrically distributed entries + <5> + + + . +x <6> + + + . + <7> + + + . +x <8> + + + . + + <9> + + + . # PV with geom. distr. entries and shifted domain + <10> + + + . + +# PMF instead of PV + + <11> + + + . # geometric (0.5) + <12> + + + . # geometric (0.001) + <13> + + + . # logarithmic (0.1) + <14> + + + . # logarithmic (0.999) + <15> + + + . # negativebinomial (0.5, 10) +x<16> + + + . # negativebinomial (0.01, 20) +x<17> + + + . # poisson (0.1) + <18> + + + . # poisson (0.999) + <19> + + + . # zipf (2, 1) +x<20> + + + . # zipf (0.001, 1) + <21> + + + + # binomial (20, 0.8) +x<22> + + + + # binomial (2000, 0.0013) + + +# number of distributions: 23 + +############################################################################# +############################################################################# + +[verbatim] + +/*---------------------------------------------------------------------------*/ + +/* make a probability vector (need not sum to one) + (use random entries) */ +double *make_random_vector(int len) +{ + double *pv; + int i; + + /* allocate memory */ + pv = malloc(len*sizeof(double)); + if (!pv) abort(); + + /* main part of geometric distribution */ + for( i=0; i +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ +double logpdf_normal_1( double x, const UNUR_DISTR *distr ); +double dlogpdf_normal_1( double x, const UNUR_DISTR *distr ); +double cdf_normal_1( double x, const UNUR_DISTR *distr ); +double logpdf_normal_2( double x, const UNUR_DISTR *distr ); +double dlogpdf_normal_2( double x, const UNUR_DISTR *distr ); +double cdf_normal_2( double x, const UNUR_DISTR *distr ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + +/* #define SEED (298346) */ + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* logPDF of normal density */ +double logpdf_normal_1( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-x*x/2. - 10000.); +} +double dlogpdf_normal_1( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-x); +} + +double cdf_normal_1( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + static UNUR_DISTR *normal = NULL; + static double fpm[2] = {0., 1.}; + if (normal == NULL) normal = unur_distr_normal(fpm,2); + return unur_distr_cont_eval_cdf( x, normal ); +} + +/* ......................................................................... */ + +#define mu_2 (100.) + +double logpdf_normal_2( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-(x-mu_2)*(x-mu_2)/2. - 10000.); +} +double dlogpdf_normal_2( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-(x-mu_2)); +} + +double cdf_normal_2( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + static UNUR_DISTR *normal_2 = NULL; + static double fpm[2] = {mu_2, 1.}; + if (normal_2 == NULL) normal_2 = unur_distr_normal(fpm,2); + return unur_distr_cont_eval_cdf( x, normal_2 ); +} + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,33,(unur_tdrgw_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,33,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,39,(unur_tdrgw_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,39,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_normal_wo_logpdf(NULL,0); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,45,(unur_tdrgw_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +/* logpdf, dlogpdf */ +n_tests_failed += (check_expected_NULL(TESTLOG,53,(unur_tdrgw_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* dlogpdf */ +unur_distr_cont_set_logpdf(distr,logpdf_normal_1); +n_tests_failed += (check_expected_NULL(TESTLOG,58,(unur_tdrgw_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,58,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_tdrgw_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,71,(unur_tdrgw_set_reinit_percentiles( par, 0, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,71,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,74,(unur_tdrgw_set_reinit_ncpoints( par, 20 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,74,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,77,(unur_tdrgw_set_max_intervals( par, 100 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,77,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,80,(unur_tdrgw_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,80,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,83,(unur_tdrgw_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,83,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,91,(unur_tdrgw_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,94,(unur_tdrgw_set_reinit_percentiles( par, 0, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,97,(unur_tdrgw_set_reinit_ncpoints( par, 30 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,97,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,100,(unur_tdrgw_set_max_intervals( par, 100 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,100,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,103,(unur_tdrgw_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,103,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_tdrgw_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double stp[] = {1.,0.,1.}; + double perc[] = {0.1,0.4,0.2}; + int n_stp = 3; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_tdrgw_new(distr); + + +unur_reset_errno(); +unur_tdrgw_set_cpoints( par, -1, NULL ); +n_tests_failed += (check_errorcode(TESTLOG,119,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,122,(unur_tdrgw_set_cpoints( par, n_stp, stp )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,122,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_tdrgw_set_reinit_percentiles( par, -1, NULL ); +n_tests_failed += (check_errorcode(TESTLOG,125,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,128,(unur_tdrgw_set_reinit_percentiles( par, n_stp, stp )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,128,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,131,(unur_tdrgw_set_reinit_percentiles( par, n_stp, perc )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,131,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,134,(unur_tdrgw_set_reinit_ncpoints( par, 9 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,134,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,137,(unur_tdrgw_set_max_intervals( par, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,137,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 147, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,151,(unur_tdrgw_get_loghatarea(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,151,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_tdr_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 161, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,165,(unur_tdrgw_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,165,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,168,(unur_tdrgw_chg_reinit_percentiles(gen, -1, NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,168,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,171,(unur_tdrgw_chg_reinit_ncpoints(gen, 30)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,171,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double percmon[] = {0.1,0.4,0.2}; + double percdom[] = {0.1,0.4,2.}; + int n_perc = 3; + distr = unur_distr_normal(NULL,0); + par = unur_tdrgw_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 180, gen ); + + +unur_reset_errno(); +unur_tdrgw_chg_reinit_percentiles( gen, -1, NULL ); +n_tests_failed += (check_errorcode(TESTLOG,184,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,187,(unur_tdrgw_chg_reinit_percentiles( gen, n_perc, percmon )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,187,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,190,(unur_tdrgw_chg_reinit_percentiles( gen, n_perc, percdom )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,190,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,193,(unur_tdrgw_chg_reinit_ncpoints( gen, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,193,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,204,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,204,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* stp out of domain */ +UNUR_GEN *gen = NULL; +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double stp[] = {-2.5,-1.,0.,1.,2.5}; + int n_stp = 5; + gen = NULL; + distr = unur_distr_normal(NULL,0); + unur_distr_cont_set_domain(distr,-2.,2.); + par = unur_tdrgw_new(distr); + unur_tdrgw_set_cpoints( par, n_stp, stp ); + + +unur_reset_errno(); +gen = unur_init( par ); +n_tests_failed += (check_errorcode(TESTLOG,216,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; +unur_free(gen); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_tdrgw_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 225, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,229,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,239,(unur_tdrgw_eval_invcdfhat(gen,0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,239,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 245, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,249,(unur_tdrgw_eval_invcdfhat(gen,0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,249,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid domain */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_tdrgw_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 255, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,259,(unur_tdrgw_eval_invcdfhat(gen,1.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,259,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_negINFINITY(TESTLOG,262,(unur_tdrgw_eval_invcdfhat(gen,-0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,262,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; + + +unur_reset_errno(); +/* default */ +par = unur_tdrgw_new(distr); +n_tests_failed += (compare_sequence_par_start(TESTLOG,272,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* verifying mode */ +par = unur_tdrgw_new(distr); +unur_tdrgw_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,277,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* don't use private copy for distr object */ +par = unur_tdrgw_new(distr); +unur_set_use_distr_privatecopy(par,FALSE); +n_tests_failed += (compare_sequence_par(TESTLOG,282,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* verifying mode, don't use private copy for distr object */ +par = unur_tdrgw_new(distr); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,288,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double fpar[] = {1.23456,2.3456}; + distr = unur_distr_normal(fpar,2); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_tdrgw_new(distr); +unur_tdrgw_set_max_intervals(par,2); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,303,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,309,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* dont use private copy for distr object */ +/* original generator object */ +unur_free(clone); +par = unur_tdrgw_new(distr); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_max_intervals(par,2); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,318,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,324,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_tdrgw_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,336,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,340,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {3.,3.}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_gamma(fpar,2); +par = unur_tdrgw_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,353,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & method = ars "); +n_tests_failed += (compare_sequence_gen(TESTLOG,358,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_gamma(fpar,2); +par = unur_tdrgw_new(distr); +unur_tdrgw_set_cpoints(par,20,NULL); +unur_tdrgw_set_max_intervals(par,32); +unur_tdrgw_set_verify(par,TRUE); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,368,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & \ + method = ars; cpoints = 20; \ + max_intervals = 32; verify" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,375,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[31]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 31 */ +{ +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 2.; +fpm[1] = 5.; +distr[3] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 2.; +distr[4] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[5] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 100.; +distr[6] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 500.; +fpm[1] = 300.; +distr[7] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[8] = unur_distr_beta(fpm,4); +} + +{ +distr[9] = unur_distr_cauchy(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[10] = unur_distr_cauchy(fpm,2); +} + +{ +distr[11] = unur_distr_exponential(NULL,0); +} + +{ +fpm[0] = 30.; +fpm[1] = -5.; +distr[12] = unur_distr_exponential(fpm,2); +} + +{ +fpm[0] = 1.; +distr[13] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 2.; +distr[14] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 3.; +distr[15] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 10.; +distr[16] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 1000.; +distr[17] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 5.; +fpm[1] = 1000.; +distr[18] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[19] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[20] = unur_distr_gamma(fpm,3); +} + +{ +distr[21] = unur_distr_laplace(NULL,0); +} + +{ +fpm[0] = -10.; +fpm[1] = 100.; +distr[22] = unur_distr_laplace(fpm,2); +} + +{ +distr[23] = unur_distr_normal(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[24] = unur_distr_normal(fpm,2); +} + +{ +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[25] = unur_distr_normal(fpm,2); +} + +{ +distr[26] = unur_distr_uniform(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[27] = unur_distr_uniform(fpm,2); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[28] = unur_distr_beta(fpm,2); +unur_distr_cont_set_domain(distr[23],-2.,5.); +} + +{ +distr[29] = unur_distr_cont_new(); +unur_distr_cont_set_logpdf(distr[29],logpdf_normal_1); +unur_distr_cont_set_dlogpdf(distr[29],dlogpdf_normal_1); +unur_distr_cont_set_cdf(distr[29],cdf_normal_1); +unur_distr_set_name(distr[29],"normal_1"); +} + +{ +distr[30] = unur_distr_cont_new(); +unur_distr_cont_set_logpdf(distr[30],logpdf_normal_2); +unur_distr_cont_set_dlogpdf(distr[30],dlogpdf_normal_2); +unur_distr_cont_set_cdf(distr[30],cdf_normal_2); +unur_distr_set_name(distr[30],"normal_2"); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 217 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [17] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [19] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [20] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [21] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [28] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [29] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [30] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdrgw_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdrgw_new(distr_localcopy); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdrgw_new(distr_localcopy); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 217 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [17] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [19] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [20] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [21] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [28] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +double perc[] = {0.1,0.3,0.5,0.7,0.9}; +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,10,NULL); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); +unur_reinit(gen); + } + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [29] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,3,NULL); +unur_tdrgw_set_max_intervals(par,10); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [30] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdrgw_new(distr_localcopy); + unur_tdrgw_set_pedantic(par,0); +unur_set_use_distr_privatecopy(par,FALSE); +unur_tdrgw_set_cpoints(par,30,NULL); + gen = unur_init(par); + if (gen) unur_tdrgw_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + unur_distr_free(distr[30]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_tdrgw_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_deprecated_vmt.c b/vendor/unuran-1.11.0/tests/t_deprecated_vmt.c new file mode 100644 index 0000000..48e3557 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_deprecated_vmt.c @@ -0,0 +1,2013 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for VMT + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_vmt_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + +/* #define SEED (298346) */ + +/* we need marginal distributions for the chi2 tests */ +#define unur_distr_multicauchy unur_distr_multicauchy_w_marginals +#define unur_distr_multinormal unur_distr_multinormal_w_marginals +#define unur_distr_multistudent unur_distr_multistudent_w_marginals + + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,37,(unur_vmt_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,37,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,44,(unur_vmt_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,44,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + double mean[] = {1.,2.}; + double covar[] = {2.,1., 1., 2.}; + distr = unur_distr_cvec_new(2); + + +unur_reset_errno(); +/* mean */ +n_tests_failed += (check_expected_NULL(TESTLOG,54,(unur_vmt_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,54,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* covariance matrix */ +unur_distr_cvec_set_mean(distr,mean); +unur_distr_cvec_set_covar(distr,covar); +n_tests_failed += (check_expected_NULL(TESTLOG,60,(unur_vmt_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* exists */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_multinormal(3,NULL,NULL); + par = unur_vmt_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 85, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,89,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + UNUR_GEN *clone; + distr = unur_distr_multinormal( dim, mean, covar ); + par = unur_vmt_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 101, gen ); + + +unur_reset_errno(); +/* normal distribution */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,105,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,111,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + double beta_params[] = {3.,5.}; + UNUR_GEN *clone; + distr = unur_distr_cvec_new(dim); + unur_distr_cvec_set_mean(distr,mean); + unur_distr_cvec_set_covar(distr,covar); + unur_distr_cvec_set_marginal_list(distr, + unur_distr_normal(NULL,0), + unur_distr_cauchy(NULL,0), + unur_distr_beta(beta_params,2) ); + unur_distr_cvec_set_stdmarginal_list(distr, + unur_distr_normal(NULL,0), + unur_distr_cauchy(NULL,0), + unur_distr_beta(beta_params,2) ); + par = unur_vmt_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 132, gen ); + + +unur_reset_errno(); +/* multivariate distribution with given marginals */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,136,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,142,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + double beta_params[] = {3.,5.}; + UNUR_DISTR *marginals[3]; + UNUR_GEN *clone; + distr = unur_distr_cvec_new(3); + unur_distr_cvec_set_mean(distr,mean); + unur_distr_cvec_set_covar(distr,covar); + marginals[0] = unur_distr_normal(NULL,0); + marginals[1] = unur_distr_cauchy(NULL,0); + marginals[2] = unur_distr_beta(beta_params,2); + unur_distr_cvec_set_marginal_array(distr,marginals); + unur_distr_cvec_set_stdmarginal_array(distr,marginals); + unur_distr_free(marginals[0]); + unur_distr_free(marginals[1]); + unur_distr_free(marginals[2]); + par = unur_vmt_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 163, gen ); + + +unur_reset_errno(); +/* multivariate distribution with given marginals */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,167,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,173,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone 1dim */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 1; + double mean[] = {1.}; + double covar[] = {2.}; + double beta_params[] = {3.,5.}; + UNUR_GEN *clone; + distr = unur_distr_cvec_new(dim); + unur_distr_cvec_set_mean(distr,mean); + unur_distr_cvec_set_covar(distr,covar); + unur_distr_cvec_set_marginal_list(distr, + unur_distr_beta(beta_params,2) ); + unur_distr_cvec_set_stdmarginal_list(distr, + unur_distr_beta(beta_params,2) ); + par = unur_vmt_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 190, gen ); + + +unur_reset_errno(); +/* multivariate distribution with given marginals */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,194,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,200,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone 1dim */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double mean[] = {1.}; + double covar[] = {2.}; + double beta_params[] = {3.,5.}; + UNUR_DISTR *marginals[1]; + UNUR_GEN *clone; + distr = unur_distr_cvec_new(1); + unur_distr_cvec_set_mean(distr,mean); + unur_distr_cvec_set_covar(distr,covar); + marginals[0] = unur_distr_beta(beta_params,2); + unur_distr_cvec_set_marginal_array(distr,marginals); + unur_distr_cvec_set_stdmarginal_array(distr,marginals); + unur_distr_free(marginals[0]); + par = unur_vmt_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 217, gen ); + + +unur_reset_errno(); +/* multivariate distribution with given marginals */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,221,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,227,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_multinormal(3,NULL,NULL); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_vmt_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,239,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,243,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* set domain and compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + double ll[] = {0.,0.,0.}; + double ru[] = {UNUR_INFINITY, 1., 2.}; + UNUR_GEN *clone; + distr = unur_distr_multinormal( dim, mean, covar ); + unur_distr_cvec_set_domain_rect( distr, ll, ru ); + par = unur_vmt_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 256, gen ); + + +unur_reset_errno(); +/* normal distribution */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,260,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,266,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[33]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 33 */ +{ +distr[0] = unur_distr_multinormal(3,NULL,NULL); +} + +{ +double mean[] = { 1., 2., 3. }; +double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; +distr[1] = unur_distr_multinormal(3,mean,covar); +} + +{ +double ll[3] = {0.,0.,0.}; +double ru[3] = {UNUR_INFINITY,UNUR_INFINITY,UNUR_INFINITY}; +distr[30] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[30],ll,ru); +} + +{ +double ll[3] = {0.,0.,0.}; +double ru[3] = {1.,UNUR_INFINITY,UNUR_INFINITY}; +distr[31] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[31],ll,ru); +} + +{ +double ll[3] = {-1.,-1.,1.}; +double ru[3] = {1.,0.,2.}; +distr[32] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[32],ll,ru); +} + +{ +#define dim (2) +int i; +double mean[dim], covar[dim*dim]; +UNUR_DISTR *covar_distr; +UNUR_GEN *covar_gen; +UNUR_GEN *mean_gen; +covar_distr = unur_distr_correlation(dim); +covar_gen = unur_init(unur_mcorr_new(covar_distr)); +mean_gen = unur_str2gen("normal(5,1)"); +for (i=0; isetup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 66 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [3] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [6] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [7] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [8] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [26] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [27] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [29] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [16] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [20] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [21] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [22] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [23] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [24] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [25] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [30] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [31] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [32] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_vmt_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + unur_distr_free(distr[30]); + unur_distr_free(distr[31]); + unur_distr_free(distr[32]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_vmt_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_deprecated_vmt.conf b/vendor/unuran-1.11.0/tests/t_deprecated_vmt.conf new file mode 100644 index 0000000..f70b4fb --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_deprecated_vmt.conf @@ -0,0 +1,881 @@ +############################################################################# +# # +# THIS METHOD AND THE CORRESPONDING ROUTINES SHOULD NOT BE USED ANY MORE! # +# # +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: VMT + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* \#define SEED (298346) */ + +/* we need marginal distributions for the chi2 tests */ +\#define unur_distr_multicauchy unur_distr_multicauchy_w_marginals +\#define unur_distr_multinormal unur_distr_multinormal_w_marginals +\#define unur_distr_multistudent unur_distr_multistudent_w_marginals + + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + + +[new - data missing in distribution object: + double mean[] = {1.,2.}; + double covar[] = {2.,1., 1., 2.}; + distr = unur_distr_cvec_new(2); ] + +/* mean */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +/* covariance matrix */ +unur_distr_cvec_set_mean(distr,mean); +unur_distr_cvec_set_covar(distr,covar); +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + + +############################################################################# + +# [set] + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################# + +# [init] + +############################################################################# + +[reinit] + +[reinit - exists: + distr = unur_distr_multinormal(3,NULL,NULL); + par = unur_vmt_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - compare clone: + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + UNUR_GEN *clone; + distr = unur_distr_multinormal( dim, mean, covar ); + par = unur_vmt_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* normal distribution */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare clone: + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + double beta_params[] = {3.,5.}; + UNUR_GEN *clone; + distr = unur_distr_cvec_new(dim); + unur_distr_cvec_set_mean(distr,mean); + unur_distr_cvec_set_covar(distr,covar); + unur_distr_cvec_set_marginal_list(distr, + unur_distr_normal(NULL,0), + unur_distr_cauchy(NULL,0), + unur_distr_beta(beta_params,2) ); + unur_distr_cvec_set_stdmarginal_list(distr, + unur_distr_normal(NULL,0), + unur_distr_cauchy(NULL,0), + unur_distr_beta(beta_params,2) ); + par = unur_vmt_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* multivariate distribution with given marginals */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare clone: + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + double beta_params[] = {3.,5.}; + UNUR_DISTR *marginals[3]; + UNUR_GEN *clone; + distr = unur_distr_cvec_new(3); + unur_distr_cvec_set_mean(distr,mean); + unur_distr_cvec_set_covar(distr,covar); + marginals[0] = unur_distr_normal(NULL,0); + marginals[1] = unur_distr_cauchy(NULL,0); + marginals[2] = unur_distr_beta(beta_params,2); + unur_distr_cvec_set_marginal_array(distr,marginals); + unur_distr_cvec_set_stdmarginal_array(distr,marginals); + unur_distr_free(marginals[0]); + unur_distr_free(marginals[1]); + unur_distr_free(marginals[2]); + par = unur_vmt_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* multivariate distribution with given marginals */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare clone 1dim: + const int dim = 1; + double mean[] = {1.}; + double covar[] = {2.}; + double beta_params[] = {3.,5.}; + UNUR_GEN *clone; + distr = unur_distr_cvec_new(dim); + unur_distr_cvec_set_mean(distr,mean); + unur_distr_cvec_set_covar(distr,covar); + unur_distr_cvec_set_marginal_list(distr, + unur_distr_beta(beta_params,2) ); + unur_distr_cvec_set_stdmarginal_list(distr, + unur_distr_beta(beta_params,2) ); + par = unur_vmt_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* multivariate distribution with given marginals */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare clone 1dim: + double mean[] = {1.}; + double covar[] = {2.}; + double beta_params[] = {3.,5.}; + UNUR_DISTR *marginals[1]; + UNUR_GEN *clone; + distr = unur_distr_cvec_new(1); + unur_distr_cvec_set_mean(distr,mean); + unur_distr_cvec_set_covar(distr,covar); + marginals[0] = unur_distr_beta(beta_params,2); + unur_distr_cvec_set_marginal_array(distr,marginals); + unur_distr_cvec_set_stdmarginal_array(distr,marginals); + unur_distr_free(marginals[0]); + par = unur_vmt_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* multivariate distribution with given marginals */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare reinit: + distr = unur_distr_multinormal(3,NULL,NULL); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_vmt_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +#..................................................................... + +[sample - set domain and compare clone: + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + double ll[] = {0.,0.,0.}; + double ru[] = {UNUR_INFINITY, 1., 2.}; + UNUR_GEN *clone; + distr = unur_distr_multinormal( dim, mean, covar ); + unur_distr_cvec_set_domain_rect( distr, ll, ru ); + par = unur_vmt_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* normal distribution */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default program +par[0] = unur_vmt_new(@distr@); + +# default variant but reinitialized with changed distribution +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par[1] = unur_vmt_new(@distr@); +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_reinit(gen); } + + +[validate - distributions:] + +# standard multinormal distribution +distr[0] = unur_distr_multinormal(3,NULL,NULL); + + +# multinormal distribution, dim = 3 +double mean[] = { 1., 2., 3. }; +double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; +distr[1] = unur_distr_multinormal(3,mean,covar); + +# standard multinormal distribution with rectangular domain +double ll[3] = {0.,0.,0.}; +double ru[3] = {UNUR_INFINITY,UNUR_INFINITY,UNUR_INFINITY}; +distr[30] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[30],ll,ru); + + +# standard multinormal distribution with rectangular domain +double ll[3] = {0.,0.,0.}; +double ru[3] = {1.,UNUR_INFINITY,UNUR_INFINITY}; +distr[31] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[31],ll,ru); + +# standard multinormal distribution with rectangular domain +double ll[3] = {-1.,-1.,1.}; +double ru[3] = {1.,0.,2.}; +distr[32] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[32],ll,ru); + + +# random multinormal distribution +\#define dim (2) +int i; +double mean[dim], covar[dim*dim]; +UNUR_DISTR *covar_distr; +UNUR_GEN *covar_gen; +UNUR_GEN *mean_gen; +covar_distr = unur_distr_correlation(dim); +covar_gen = unur_init(unur_mcorr_new(covar_distr)); +mean_gen = unur_str2gen("normal(5,1)"); +for (i=0; i + + # standard multinormal (dim=3) + <1> + + # multinormal (dim=3) +x <2> + . # random multinormal (dim=2) +x <3> + + # random multinormal (dim=3) +x <4> + . # random multinormal (dim=4) +x <5> + . # random multinormal (dim=5) +x <6> + . # random multinormal (dim=7) +x <7> + . # random multinormal (dim=10) +x <8> + . # random multinormal (dim=15) +x <9> + . # random multinormal (dim=20) +x<10> + . # random multinormal (dim=100) +x<26> + . # multinormal with AR(1) corr matrix (rho=0.5, dim=100) +x<27> + . # multinormal with AR(1) corr matrix (rho=0.9, dim=100) + <28> + . # multinormal with AR(1) corr matrix (rho=0.99, dim=100) +x<29> + . # multinormal with AR(1) corr matrix (rho=0.999, dim=100) +x<11> + . # random distribution with non-normal marginals (dim=5) + <12> + . # standard multinormal (dim=1) +x<13> + . # random multinormal (dim=1) + <14> 0 . # invalid distribution + <15> + + # standard multicauchy (dim=3) + <16> + + # multicauchy (dim=3) +x<17> + . # random multicauchy (dim=2) +x<18> + + # random multicauchy (dim=3) +x<19> + . # random multicauchy (dim=4) +x<20> + . # random multicauchy (dim=5) +x<21> + . # random multicauchy (dim=7) +x<22> + . # random multicauchy (dim=10) +x<23> + . # random multicauchy (dim=15) +x<24> + . # random multicauchy (dim=20) +x<25> + . # random multicauchy (dim=100) +x<30> + - # standard multinormal (dim=3) with rectangular domain + <31> + . # standard multinormal (dim=3) with rectangular domain +x<32> + . # standard multinormal (dim=3) with rectangular domain + + +############################################################################# +############################################################################# + +[verbatim] + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_dext.c b/vendor/unuran-1.11.0/tests/t_dext.c new file mode 100644 index 0000000..17737fd --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_dext.c @@ -0,0 +1,825 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for DEXT + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_dext_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +int check_init(UNUR_GEN *gen); +int check_sample(UNUR_GEN *gen); + +int geom12_sample(UNUR_GEN *gen); + +int geoma_sample(UNUR_GEN *gen); + +int geomb_init(UNUR_GEN *gen); +int geomb_sample(UNUR_GEN *gen); + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + +/* #define SEED (298346) */ + + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +int check_init(UNUR_GEN *gen ATTRIBUTE__UNUSED) { return UNUR_SUCCESS; } +int check_sample(UNUR_GEN *gen ATTRIBUTE__UNUSED) { return 0; } + +/* ............. */ + +int geom12_sample(UNUR_GEN *gen) { + double U = unur_sample_urng(gen); + return ((int) ceil(log(1.-U) / log(0.5) - 1.)); +} + +/* ............. */ + +int geoma_sample(UNUR_GEN *gen) { +# define p (params[0]) /* scale */ + double U = unur_sample_urng(gen); + double *params = unur_dext_get_distrparams(gen); + return ((int) ceil(log(1.-U) / log(1.-p) - 1.)); +# undef p +} + +/* ............. */ + +int geomb_init(UNUR_GEN *gen) { +# define p (params[0]) /* scale */ + double *params = unur_dext_get_distrparams(gen); + double *genpar = unur_dext_get_params(gen, sizeof(double)); + genpar[0] = p; + return UNUR_SUCCESS; +# undef p +} + +int geomb_sample(UNUR_GEN *gen) { +# define p (params[0]) /* scale */ + double *params = unur_dext_get_params(gen,(size_t)0); + double U = unur_sample_urng(gen); + return ((int) ceil(log(1.-U) / log(1.-p) - 1.)); +# undef p +} + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,38,(unur_dext_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,38,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,49,(unur_dext_set_init(par,NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,52,(unur_dext_set_sample(par,NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,60,(unur_dext_set_init(par,NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,63,(unur_dext_set_sample(par,NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,66,(unur_dext_set_sample(par,check_sample)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,79,(unur_dext_get_params(gen,(size_t)0)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,93,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,93,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double fpar[1] = {0.5}; + distr = unur_distr_geometric(fpar,1); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* external generator 1 */ +par = unur_dext_new(distr); +unur_dext_set_sample(par,geom12_sample); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,125,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,131,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* dstd */ +unur_free(gen); +par = unur_dstd_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen(TESTLOG,137,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* external generator A */ +unur_free(gen); +par = unur_dext_new(distr); +unur_dext_set_sample(par,geoma_sample); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen(TESTLOG,145,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,151,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* external generator B */ +unur_free(gen); +par = unur_dext_new(distr); +unur_dext_set_init(par,geomb_init); +unur_dext_set_sample(par,geomb_sample); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen(TESTLOG,159,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,165,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double fpar[1] = {0.1}; + distr = unur_distr_geometric(fpar,1); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* external generator A */ +unur_free(gen); +par = unur_dext_new(distr); +unur_dext_set_sample(par,geoma_sample); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,181,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,187,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* external generator B */ +unur_free(gen); +par = unur_dext_new(distr); +unur_dext_set_init(par,geomb_init); +unur_dext_set_sample(par,geomb_sample); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen(TESTLOG,195,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,201,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* dstd */ +unur_free(gen); +par = unur_dstd_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen(TESTLOG,207,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[2]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 2 */ +{ +fpm[0] = 0.5; +distr[0] = unur_distr_geometric(fpm,1); +} + +{ +fpm[0] = 0.1; +distr[1] = unur_distr_geometric(fpm,1); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 8 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dext_new(distr_localcopy); +unur_dext_set_sample(par,geom12_sample); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dext_new(distr_localcopy); +unur_dext_set_sample(par,geoma_sample); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dext_new(distr_localcopy); +unur_dext_set_init(par,geomb_init); +unur_dext_set_sample(par,geomb_sample); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_dext_new(distr_localcopy); +unur_dext_set_init(par,geomb_init); +unur_dext_set_sample(par,geomb_sample); +fpm[0] = 0.2; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,1); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dext_new(distr_localcopy); +unur_dext_set_sample(par,geom12_sample); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dext_new(distr_localcopy); +unur_dext_set_sample(par,geoma_sample); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dext_new(distr_localcopy); +unur_dext_set_init(par,geomb_init); +unur_dext_set_sample(par,geomb_sample); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_dext_new(distr_localcopy); +unur_dext_set_init(par,geomb_init); +unur_dext_set_sample(par,geomb_sample); +fpm[0] = 0.2; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,1); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_dext_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_dext.conf b/vendor/unuran-1.11.0/tests/t_dext.conf new file mode 100644 index 0000000..36177c2 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_dext.conf @@ -0,0 +1,321 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: DEXT + +[main - header:] + +/* prototypes */ + +int check_init(UNUR_GEN *gen); +int check_sample(UNUR_GEN *gen); + +int geom12_sample(UNUR_GEN *gen); + +int geoma_sample(UNUR_GEN *gen); + +int geomb_init(UNUR_GEN *gen); +int geomb_sample(UNUR_GEN *gen); + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* \#define SEED (298346) */ + + +############################################################################# + +[new] + +[new - invalid distribution type: + distr = unur_distr_cont_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_init(par,NULL); + --> expected_setfailed --> UNUR_ERR_NULL + +~_sample(par,NULL); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameter object: + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); ] + +~_init(par,NULL); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_sample(par,NULL); + --> expected_setfailed --> UNUR_ERR_NULL + +~_sample(par,check_sample); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + + +############################################################################# + +[get] + +[get - invalid NULL ptr: + gen = NULL; ] + +~_params(gen,(size_t)0); + --> expected_NULL --> UNUR_ERR_NULL + +############################################################################# + +# [chg] + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + + +############################################################################# + +[reinit] + +#[reinit - does not exist: +# distr = unur_distr_exponential(NULL,0); +# par = unur_dext_new(distr); +# unur_dext_set_sample(par,geom12_sample); +# gen = unur_init(par); <-- ! NULL ] + +#unur_reinit( gen ); +# --> expected_reinit + + +############################################################################# + +[sample] + +[sample - compare clone: + UNUR_GEN *clone; + double fpar[1] = {0.5}; + distr = unur_distr_geometric(fpar,1); + par = NULL; + gen = NULL; ] + +/* external generator 1 */ +par = unur_dext_new(distr); +unur_dext_set_sample(par,geom12_sample); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +/* dstd */ +unur_free(gen); +par = unur_dstd_new(distr); +gen = unur_init(par); + -->compare_sequence_gen + + +/* external generator A */ +unur_free(gen); +par = unur_dext_new(distr); +unur_dext_set_sample(par,geoma_sample); +gen = unur_init(par); + -->compare_sequence_gen + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +/* external generator B */ +unur_free(gen); +par = unur_dext_new(distr); +unur_dext_set_init(par,geomb_init); +unur_dext_set_sample(par,geomb_sample); +gen = unur_init(par); + -->compare_sequence_gen + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + double fpar[1] = {0.1}; + distr = unur_distr_geometric(fpar,1); + par = NULL; + gen = NULL; ] + +/* external generator A */ +unur_free(gen); +par = unur_dext_new(distr); +unur_dext_set_sample(par,geoma_sample); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +/* external generator B */ +unur_free(gen); +par = unur_dext_new(distr); +unur_dext_set_init(par,geomb_init); +unur_dext_set_sample(par,geomb_sample); +gen = unur_init(par); + -->compare_sequence_gen + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +/* dstd */ +unur_free(gen); +par = unur_dstd_new(distr); +gen = unur_init(par); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# geometric(0.5): +# geometric distribution; do not read any parameters +par[0] = unur_dext_new(@distr@); +unur_dext_set_sample(par,geom12_sample); + +# geometric(p): +# use pointer to parameter of distribution in sampling routine +par[1] = unur_dext_new(@distr@); +unur_dext_set_sample(par,geoma_sample); + +# geometric(p): +# store parameter of distribution in generator object during init +par[2] = unur_dext_new(@distr@); +unur_dext_set_init(par,geomb_init); +unur_dext_set_sample(par,geomb_sample); + +# geometric(p): +# store parameter of distribution in generator object during init +# change parameters +{ UNUR_DISTR *dg =NULL; +par[3] = unur_dext_new(@distr@); +unur_dext_set_init(par,geomb_init); +unur_dext_set_sample(par,geomb_sample); +fpm[0] = 0.2; +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,1); +unur_reinit(gen); } + + +[validate - distributions:] + +# Geometric +fpm[0] = 0.5; +distr[0] = unur_distr_geometric(fpm,1); + +fpm[0] = 0.1; +distr[1] = unur_distr_geometric(fpm,1); + +## number of distributions: 2 + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator (given variant does not exist) +# - ... fail test +# / ... either init fails or test passes +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... Geometric(p) +# [1] ... Geometric(p): use pointer to distribution +# [2] ... Geometric(p): store distrparams in object +# [3] ... Geometric, reinit with changed parameters +# +#gen 0 1 2 3 # distribution +#------------------------------------------------------------- + <0> + + + + # geometric(0.5) + <1> - + + + # geometric(0.1) + + +############################################################################# +############################################################################# + +[verbatim] + +int check_init(UNUR_GEN *gen ATTRIBUTE__UNUSED) { return UNUR_SUCCESS; } +int check_sample(UNUR_GEN *gen ATTRIBUTE__UNUSED) { return 0; } + +/* ............. */ + +int geom12_sample(UNUR_GEN *gen) { + double U = unur_sample_urng(gen); + return ((int) ceil(log(1.-U) / log(0.5) - 1.)); +} + +/* ............. */ + +int geoma_sample(UNUR_GEN *gen) { +\# define p (params[0]) /* scale */ + double U = unur_sample_urng(gen); + double *params = unur_dext_get_distrparams(gen); + return ((int) ceil(log(1.-U) / log(1.-p) - 1.)); +\# undef p +} + +/* ............. */ + +int geomb_init(UNUR_GEN *gen) { +\# define p (params[0]) /* scale */ + double *params = unur_dext_get_distrparams(gen); + double *genpar = unur_dext_get_params(gen, sizeof(double)); + genpar[0] = p; + return UNUR_SUCCESS; +\# undef p +} + +int geomb_sample(UNUR_GEN *gen) { +\# define p (params[0]) /* scale */ + double *params = unur_dext_get_params(gen,(size_t)0); + double U = unur_sample_urng(gen); + return ((int) ceil(log(1.-U) / log(1.-p) - 1.)); +\# undef p +} + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_dgt.c b/vendor/unuran-1.11.0/tests/t_dgt.c new file mode 100644 index 0000000..3ae0b3a --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_dgt.c @@ -0,0 +1,3443 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for DGT + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_dgt_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (15000) +#define VIOLATE_SAMPLE_SIZE (20) + +double *make_geometric_vector(double q, int len); +double *make_random_vector(int len); +UNUR_DISTR *get_distr_with_invalid_pv( void ); +UNUR_DISTR *get_distr_with_pv( void ); + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/*---------------------------------------------------------------------------*/ + +/* make a probability vector (need not sum to one) + (use random entries) */ +double *make_random_vector(int len) +{ + double *pv; + int i; + + /* allocate memory */ + pv = malloc(len*sizeof(double)); + if (!pv) abort(); + + /* main part of geometric distribution */ + for( i=0; itime = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,52,(unur_dgt_set_variant(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,55,(unur_dgt_set_guidefactor(par,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,55,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = get_distr_with_pv(); + par = unur_dau_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,62,(unur_dgt_set_variant(par,10)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,65,(unur_dgt_set_guidefactor(par,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = get_distr_with_pv(); + par = unur_dgt_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,74,(unur_dgt_set_variant(par,10)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,74,UNUR_ERR_PAR_VARIANT)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,77,(unur_dgt_set_guidefactor(par,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,77,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,97,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,97,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid data */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = get_distr_with_invalid_pv(); + par = unur_dgt_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,105,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,105,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dgt_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 114, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,118,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_INTMAX(TESTLOG,128,(unur_dgt_eval_invcdf_recycle(gen,0.5,NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,128,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INTMAX(TESTLOG,131,(unur_dgt_eval_invcdf(gen,0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,131,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_srou_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 137, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INTMAX(TESTLOG,141,(unur_dgt_eval_invcdf_recycle(gen,0.5,NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,141,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INTMAX(TESTLOG,144,(unur_dgt_eval_invcdf(gen,0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,144,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid domain */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = unur_dgt_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 150, gen ); + + +unur_reset_errno(); +unur_dgt_eval_invcdf_recycle(gen,1.5,NULL); +n_tests_failed += (check_errorcode(TESTLOG,154,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,157,(unur_dgt_eval_invcdf_recycle(gen,-0.5,NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,157,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_dgt_eval_invcdf(gen,1.5); +n_tests_failed += (check_errorcode(TESTLOG,160,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,163,(unur_dgt_eval_invcdf(gen,-0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,163,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = get_distr_with_pv(); + par = NULL; + + +unur_reset_errno(); +/* default algorithm */ +par = unur_dgt_new(distr); +n_tests_failed += (compare_sequence_par_start(TESTLOG,173,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* variant 1 */ +par = unur_dgt_new(distr); +unur_dgt_set_variant(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,178,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* variant 2 */ +par = unur_dgt_new(distr); +unur_dgt_set_variant(par,2); +n_tests_failed += (compare_sequence_par(TESTLOG,183,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* larger guide table size */ +par = unur_dgt_new(distr); +unur_dgt_set_guidefactor(par,10.); +n_tests_failed += (compare_sequence_par(TESTLOG,188,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* smaller guide table size */ +par = unur_dgt_new(distr); +unur_dgt_set_guidefactor(par,0.1); +n_tests_failed += (compare_sequence_par(TESTLOG,193,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* sequential search */ +par = unur_dgt_new(distr); +unur_dgt_set_guidefactor(par,0.); +n_tests_failed += (compare_sequence_par(TESTLOG,198,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_dgt_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,212,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,218,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_dgt_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,231,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,235,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double pv[] = {.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.}; + double fpar[] = {0.8}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_discr_new(); +unur_distr_discr_set_pv(distr,pv,10); +par = unur_dgt_new(distr); +unur_dgt_set_guidefactor(par,3.); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,251,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.) & \ + method = dgt; guidefactor = 3." ); +n_tests_failed += (compare_sequence_gen(TESTLOG,257,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_discr_new(); +unur_distr_discr_set_pv(distr,pv,10); +par = unur_dgt_new(distr); +unur_dgt_set_variant(par,1); +unur_dgt_set_guidefactor(par,3.); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,267,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.) & \ + method = dgt; guidefactor = 3.; variant = 1" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,273,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_free(gen); gen = NULL; +distr = unur_distr_discr_new(); +unur_distr_discr_set_pv(distr,pv,10); +par = unur_dgt_new(distr); +unur_dgt_set_variant(par,2); +unur_dgt_set_guidefactor(par,3.); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,284,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.) & \ + method = dgt; guidefactor = 3.; variant = 2" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,290,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_geometric(fpar,1); +par = unur_dgt_new(distr); +unur_dgt_set_guidefactor(par,3.); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,298,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "geometric(0.8) & method = dgt; guidefactor = 3." ); +n_tests_failed += (compare_sequence_gen(TESTLOG,303,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[24]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 24 */ +{ +distr[0] = unur_distr_discr_new(); +darray = make_random_vector(10); +unur_distr_discr_set_pv(distr[0],darray,10); +free(darray); +unur_distr_set_name(distr[0],"pv(random)"); +} + +{ +distr[1] = unur_distr_discr_new(); +darray = make_random_vector(100); +unur_distr_discr_set_pv(distr[1],darray,100); +free(darray); +unur_distr_set_name(distr[1],"pv(random)"); +} + +{ +distr[2] = unur_distr_discr_new(); +darray = make_random_vector(1000); +unur_distr_discr_set_pv(distr[2],darray,1000); +free(darray); +unur_distr_set_name(distr[2],"pv(random)"); +} + +{ +distr[3] = unur_distr_discr_new(); +darray = make_random_vector(10000); +unur_distr_discr_set_pv(distr[3],darray,10000); +free(darray); +unur_distr_set_name(distr[3],"pv(random)"); +} + +{ +distr[4] = unur_distr_discr_new(); +darray = make_geometric_vector(1.,1000); +unur_distr_discr_set_pv(distr[4],darray,1000); +free(darray); +unur_distr_set_name(distr[4],"pv(geometric)"); +} + +{ +distr[5] = unur_distr_discr_new(); +darray = make_geometric_vector(0.99,1000); +unur_distr_discr_set_pv(distr[5],darray,1000); +free(darray); +unur_distr_set_name(distr[5],"pv(geometric)"); +} + +{ +distr[6] = unur_distr_discr_new(); +darray = make_geometric_vector(0.9,1000); +unur_distr_discr_set_pv(distr[6],darray,1000); +free(darray); +unur_distr_set_name(distr[6],"pv(geometric)"); +} + +{ +distr[7] = unur_distr_discr_new(); +darray = make_geometric_vector(0.5,1000); +unur_distr_discr_set_pv(distr[7],darray,1000); +free(darray); +unur_distr_set_name(distr[7],"pv(geometric)"); +} + +{ +distr[8] = unur_distr_discr_new(); +darray = make_geometric_vector(0.1,1000); +unur_distr_discr_set_pv(distr[8],darray,1000); +free(darray); +unur_distr_set_name(distr[8],"pv(geometric)"); +} + +{ +distr[9] = unur_distr_discr_new(); +darray = make_geometric_vector(0.5,100); +unur_distr_discr_set_pv(distr[9],darray,100); +unur_distr_discr_set_domain(distr[9],10,209); +free(darray); +unur_distr_set_name(distr[9],"pv(geometric) - shifted domain"); +} + +{ +distr[10] = unur_distr_discr_new(); +darray = make_geometric_vector(0.9,100); +unur_distr_discr_set_pv(distr[10],darray,100); +unur_distr_discr_set_domain(distr[10],-10,209); +free(darray); +unur_distr_set_name(distr[10],"pv(geometric) - shifted domain"); +} + +{ +fpm[0] = 0.5; +distr[11] = unur_distr_geometric(fpm,1); +} + +{ +fpm[0] = 0.001; +distr[12] = unur_distr_geometric(fpm,1); +} + +{ +fpm[0] = 0.1; +distr[13] = unur_distr_logarithmic(fpm,1); +} + +{ +fpm[0] = 0.999; +distr[14] = unur_distr_logarithmic(fpm,1); +} + +{ +fpm[0] = 0.5; +fpm[1] = 10.; +distr[15] = unur_distr_negativebinomial(fpm,2); +} + +{ +fpm[0] = 0.8; +fpm[1] = 10.; +distr[21] = unur_distr_negativebinomial(fpm,2); +} + +{ +fpm[0] = 0.01; +fpm[1] = 20.; +distr[16] = unur_distr_negativebinomial(fpm,2); +} + +{ +fpm[0] = 0.1; +distr[17] = unur_distr_poisson(fpm,1); +} + +{ +fpm[0] = 0.999; +distr[18] = unur_distr_poisson(fpm,1); +} + +{ +fpm[0] = 2.; +fpm[1] = 1.; +distr[19] = unur_distr_zipf(fpm,2); +unur_distr_discr_set_domain(distr[19],1,1000); +} + +{ +fpm[0] = 0.001; +fpm[1] = 1.; +distr[20] = unur_distr_zipf(fpm,2); +unur_distr_discr_set_domain(distr[20],1,1000); +} + +{ +fpm[0] = 20.; +fpm[1] = 0.8; +distr[22] = unur_distr_binomial(fpm,2); +} + +{ +fpm[0] = 2000.; +fpm[1] = 0.0013; +distr[23] = unur_distr_binomial(fpm,2); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 168 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [3] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [4] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [6] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [8] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_dgt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_dgt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_dgt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_dgt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +par = unur_dgt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [21] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_dgt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_dgt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [17] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_dgt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [18] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_dgt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_dgt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [20] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_dgt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_dgt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_dgt_new(distr_localcopy); +fpm[0] = 10.; +fpm[1] = 0.63; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_dgt_new(distr_localcopy); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_dgt_new(distr_localcopy); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_dgt_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_dgt_new(distr_localcopy); +fpm[0] = 10.; +fpm[1] = 0.63; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_dgt_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_dgt.conf b/vendor/unuran-1.11.0/tests/t_dgt.conf new file mode 100644 index 0000000..13b391d --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_dgt.conf @@ -0,0 +1,629 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: DGT + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (15000) +\#define VIOLATE_SAMPLE_SIZE (20) + +double *make_geometric_vector(double q, int len); +double *make_random_vector(int len); +UNUR_DISTR *get_distr_with_invalid_pv( void ); +UNUR_DISTR *get_distr_with_pv( void ); + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_cont_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_discr_new(); /* no probability vector */ ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_variant(par,1); + --> expected_setfailed --> UNUR_ERR_NULL + +~_guidefactor(par,-1.); + --> expected_setfailed --> UNUR_ERR_NULL + +[set - invalid parameter object: + distr = get_distr_with_pv(); + par = unur_dau_new(distr); ] + +~_variant(par,10); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_guidefactor(par,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + +[set - invalid parameters: + distr = get_distr_with_pv(); + par = unur_dgt_new(distr); ] + +~_variant(par,10); + --> expected_setfailed --> UNUR_ERR_PAR_VARIANT + +~_guidefactor(par,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + + +[init - invalid data: + distr = get_distr_with_invalid_pv(); + par = unur_dgt_new(distr); ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_DATA + +############################################################################# + +[reinit] + +[reinit - exist: + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dgt_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - invalid NULL ptr: + gen = NULL; ] + +unur_dgt_eval_invcdf_recycle(gen,0.5,NULL); + --> expected_INTMAX --> UNUR_ERR_NULL + +unur_dgt_eval_invcdf(gen,0.5); + --> expected_INTMAX --> UNUR_ERR_NULL + +#..................................................................... + +[sample - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_srou_new(distr); + gen = unur_init(par); <-- ! NULL ] + +unur_dgt_eval_invcdf_recycle(gen,0.5,NULL); + --> expected_INTMAX --> UNUR_ERR_GEN_INVALID + +unur_dgt_eval_invcdf(gen,0.5); + --> expected_INTMAX --> UNUR_ERR_GEN_INVALID + +[sample - invalid domain: + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = unur_dgt_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +unur_dgt_eval_invcdf_recycle(gen,1.5,NULL); + --> none --> UNUR_ERR_DOMAIN + +unur_dgt_eval_invcdf_recycle(gen,-0.5,NULL); + --> expected_zero --> UNUR_ERR_DOMAIN + +unur_dgt_eval_invcdf(gen,1.5); + --> none --> UNUR_ERR_DOMAIN + +unur_dgt_eval_invcdf(gen,-0.5); + --> expected_zero --> UNUR_ERR_DOMAIN + +#..................................................................... + +[sample - compare: + distr = get_distr_with_pv(); + par = NULL; ] + +/* default algorithm */ +par = unur_dgt_new(distr); + -->compare_sequence_par_start + +/* variant 1 */ +par = unur_dgt_new(distr); +unur_dgt_set_variant(par,1); + -->compare_sequence_par + +/* variant 2 */ +par = unur_dgt_new(distr); +unur_dgt_set_variant(par,2); + -->compare_sequence_par + +/* larger guide table size */ +par = unur_dgt_new(distr); +unur_dgt_set_guidefactor(par,10.); + -->compare_sequence_par + +/* smaller guide table size */ +par = unur_dgt_new(distr); +unur_dgt_set_guidefactor(par,0.1); + -->compare_sequence_par + +/* sequential search */ +par = unur_dgt_new(distr); +unur_dgt_set_guidefactor(par,0.); + -->compare_sequence_par + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_dgt_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare reinit: + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_dgt_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + double pv[] = {.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.}; + double fpar[] = {0.8}; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_discr_new(); +unur_distr_discr_set_pv(distr,pv,10); +par = unur_dgt_new(distr); +unur_dgt_set_guidefactor(par,3.); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.) & \ + method = dgt; guidefactor = 3." ); + -->compare_sequence_gen + + +unur_free(gen); gen = NULL; +distr = unur_distr_discr_new(); +unur_distr_discr_set_pv(distr,pv,10); +par = unur_dgt_new(distr); +unur_dgt_set_variant(par,1); +unur_dgt_set_guidefactor(par,3.); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.) & \ + method = dgt; guidefactor = 3.; variant = 1" ); + -->compare_sequence_gen + + +unur_free(gen); gen = NULL; +unur_free(gen); gen = NULL; +distr = unur_distr_discr_new(); +unur_distr_discr_set_pv(distr,pv,10); +par = unur_dgt_new(distr); +unur_dgt_set_variant(par,2); +unur_dgt_set_guidefactor(par,3.); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.) & \ + method = dgt; guidefactor = 3.; variant = 2" ); + -->compare_sequence_gen + + +unur_free(gen); gen = NULL; +distr = unur_distr_geometric(fpar,1); +par = unur_dgt_new(distr); +unur_dgt_set_guidefactor(par,3.); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "geometric(0.8) & method = dgt; guidefactor = 3." ); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default program +par[0] = unur_dgt_new(@distr@); +unur_set_debug(par, 1u); + +# variant 1 +par[1] = unur_dgt_new(@distr@); +unur_dgt_set_variant(par,1); +unur_set_debug(par, 1u); + +# variant 2 +par[2] = unur_dgt_new(@distr@); +unur_dgt_set_variant(par,2); +unur_set_debug(par, 1u); + +# larger guide table size +par[3] = unur_dgt_new(@distr@); +unur_dgt_set_guidefactor(par,10.); +unur_set_debug(par, 1u); + +# smaller guide table size +par[4] = unur_dgt_new(@distr@); +unur_dgt_set_guidefactor(par,0.1); +unur_set_debug(par, 1u); + + +# default variant but reinitialized with changed domain +{ UNUR_DISTR *dg =NULL; +par[5] = unur_dgt_new(@distr@); +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + +# default variant but reinitialized with changed pdf parameters +{ UNUR_DISTR *dg =NULL; +par[6] = unur_dgt_new(@distr@); +fpm[0] = 10.; +fpm[1] = 0.63; +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + + +[validate - distributions:] + +# probability vector with random entries +distr[0] = unur_distr_discr_new(); +darray = make_random_vector(10); +unur_distr_discr_set_pv(distr[0],darray,10); +free(darray); +unur_distr_set_name(distr[0],"pv(random)"); + +distr[1] = unur_distr_discr_new(); +darray = make_random_vector(100); +unur_distr_discr_set_pv(distr[1],darray,100); +free(darray); +unur_distr_set_name(distr[1],"pv(random)"); + +distr[2] = unur_distr_discr_new(); +darray = make_random_vector(1000); +unur_distr_discr_set_pv(distr[2],darray,1000); +free(darray); +unur_distr_set_name(distr[2],"pv(random)"); + +distr[3] = unur_distr_discr_new(); +darray = make_random_vector(10000); +unur_distr_discr_set_pv(distr[3],darray,10000); +free(darray); +unur_distr_set_name(distr[3],"pv(random)"); + +# probability vector with geometrically distributed entries +distr[4] = unur_distr_discr_new(); +darray = make_geometric_vector(1.,1000); +unur_distr_discr_set_pv(distr[4],darray,1000); +free(darray); +unur_distr_set_name(distr[4],"pv(geometric)"); + +distr[5] = unur_distr_discr_new(); +darray = make_geometric_vector(0.99,1000); +unur_distr_discr_set_pv(distr[5],darray,1000); +free(darray); +unur_distr_set_name(distr[5],"pv(geometric)"); + +distr[6] = unur_distr_discr_new(); +darray = make_geometric_vector(0.9,1000); +unur_distr_discr_set_pv(distr[6],darray,1000); +free(darray); +unur_distr_set_name(distr[6],"pv(geometric)"); + +distr[7] = unur_distr_discr_new(); +darray = make_geometric_vector(0.5,1000); +unur_distr_discr_set_pv(distr[7],darray,1000); +free(darray); +unur_distr_set_name(distr[7],"pv(geometric)"); + +distr[8] = unur_distr_discr_new(); +darray = make_geometric_vector(0.1,1000); +unur_distr_discr_set_pv(distr[8],darray,1000); +free(darray); +unur_distr_set_name(distr[8],"pv(geometric)"); + +# probability vector with geometrically distributed entries and shifted domain +distr[9] = unur_distr_discr_new(); +darray = make_geometric_vector(0.5,100); +unur_distr_discr_set_pv(distr[9],darray,100); +unur_distr_discr_set_domain(distr[9],10,209); +free(darray); +unur_distr_set_name(distr[9],"pv(geometric) - shifted domain"); + +distr[10] = unur_distr_discr_new(); +darray = make_geometric_vector(0.9,100); +unur_distr_discr_set_pv(distr[10],darray,100); +unur_distr_discr_set_domain(distr[10],-10,209); +free(darray); +unur_distr_set_name(distr[10],"pv(geometric) - shifted domain"); + +# PMF instead of PV + +# geometric disctribution +fpm[0] = 0.5; +distr[11] = unur_distr_geometric(fpm,1); + +fpm[0] = 0.001; +distr[12] = unur_distr_geometric(fpm,1); + +# logarithmic distribution +fpm[0] = 0.1; +distr[13] = unur_distr_logarithmic(fpm,1); + +fpm[0] = 0.999; +distr[14] = unur_distr_logarithmic(fpm,1); + +# negative binomial distribution +fpm[0] = 0.5; +fpm[1] = 10.; +distr[15] = unur_distr_negativebinomial(fpm,2); + +fpm[0] = 0.8; +fpm[1] = 10.; +distr[21] = unur_distr_negativebinomial(fpm,2); + +fpm[0] = 0.01; +fpm[1] = 20.; +distr[16] = unur_distr_negativebinomial(fpm,2); + +# poisson distribution +fpm[0] = 0.1; +distr[17] = unur_distr_poisson(fpm,1); + +fpm[0] = 0.999; +distr[18] = unur_distr_poisson(fpm,1); + +# zipf distribution +fpm[0] = 2.; +fpm[1] = 1.; +distr[19] = unur_distr_zipf(fpm,2); +unur_distr_discr_set_domain(distr[19],1,1000); + +fpm[0] = 0.001; +fpm[1] = 1.; +distr[20] = unur_distr_zipf(fpm,2); +unur_distr_discr_set_domain(distr[20],1,1000); + +# binomial distribution +fpm[0] = 20.; +fpm[1] = 0.8; +distr[22] = unur_distr_binomial(fpm,2); + +fpm[0] = 2000.; +fpm[1] = 0.0013; +distr[23] = unur_distr_binomial(fpm,2); + + +# number of distributions: 24 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# [0] ... default program +# [1] ... variant 1 +# [2] ... variant 2 +# [3] ... larger guide table size +# [4] ... smaller guide table size +# [5] ... default variant but reinitialized with changed domain +# [6] ... default variant but reinitialized with changed pdf parameters +# +#gen 0 1 2 3 4 5 6 # distribution +#------------------------------------------------------------- + <0> + + + + + . . # PV with random entries + <1> + + + + + . . + <2> + + + + + . . +x <3> + + + + + . . + +x <4> + + + + + . . # PV with geometrically distributed entries + <5> + + + + + . . +x <6> + + + + + . . + <7> + + + + + . . +x <8> + + + + + . . + + <9> + + + + + . . # PV with geom. distr. entries and shifted domain + <10> + + + + + . . + +# PMF instead of PV + + <11> + + + + + + . # geometric (0.5) + <12> + + + + + + . # geometric (0.001) + <13> + + + + + + . # logarithmic (0.1) + <14> + + + + + + . # logarithmic (0.999) + <15> + + + + + + . # negativebinomial (0.5, 10) +x<21> + + + + + + . # negativebinomial (0.8, 10) + <16> + + + + + + . # negativebinomial (0.01, 20) +x<17> + + + + + + . # poisson (0.1) + <18> + + + + + + . # poisson (0.999) + <19> + + + + + + . # zipf (2, 1) +x<20> + + + + + + . # zipf (0.001, 1) + <22> + + + + + + + # binomial (20, 0.8) + <23> + + + + + + + # binomial (2000, 0.0013) + +############################################################################# +############################################################################# + +[verbatim] + +/*---------------------------------------------------------------------------*/ + +/* make a probability vector (need not sum to one) + (use random entries) */ +double *make_random_vector(int len) +{ + double *pv; + int i; + + /* allocate memory */ + pv = malloc(len*sizeof(double)); + if (!pv) abort(); + + /* main part of geometric distribution */ + for( i=0; i +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_distr_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,29,(unur_distr_set_name( distr, "nix" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,29,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,32,(unur_distr_set_extobj( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,32,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,43,(unur_distr_get_name( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,43,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,46,((int) unur_distr_get_type( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,46,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,49,(unur_distr_get_dim( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,52,(unur_distr_is_cont( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,55,(unur_distr_is_cvec( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,55,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,58,(unur_distr_is_cemp( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,58,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,61,(unur_distr_is_cvemp( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,61,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,64,(unur_distr_is_matr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,64,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,67,(unur_distr_is_discr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,67,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,70,(unur_distr_get_extobj( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_distr_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_distr.conf b/vendor/unuran-1.11.0/tests/t_distr.conf new file mode 100644 index 0000000..fd11ecc --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_distr.conf @@ -0,0 +1,97 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: DISTR + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +############################################################################# + +[set] + +[set - invalid NULL ptr: + distr = NULL; ] + +unur_distr_set_name( distr, "nix" ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_set_extobj( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + + +############################################################################# + +[get] + +[get - invalid NULL ptr: + distr = NULL; ] + +unur_distr_get_name( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +(int) unur_distr_get_type( distr ); + --> expected_zero --> UNUR_ERR_NULL + +unur_distr_get_dim( distr ); + --> expected_zero --> UNUR_ERR_NULL + +unur_distr_is_cont( distr ); + --> expected_zero --> UNUR_ERR_NULL + +unur_distr_is_cvec( distr ); + --> expected_zero --> UNUR_ERR_NULL + +unur_distr_is_cemp( distr ); + --> expected_zero --> UNUR_ERR_NULL + +unur_distr_is_cvemp( distr ); + --> expected_zero --> UNUR_ERR_NULL + +unur_distr_is_matr( distr ); + --> expected_zero --> UNUR_ERR_NULL + +unur_distr_is_discr( distr ); + --> expected_zero --> UNUR_ERR_NULL + +unur_distr_get_extobj( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +############################################################################# + +# [chg] + +############################################################################## + +# [init] + +############################################################################# + +# [reinit] + +############################################################################# + +# [sample] + +############################################################################# + +# [validate] + +############################################################################# +############################################################################# + +[verbatim] + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_distr_cemp.c b/vendor/unuran-1.11.0/tests/t_distr_cemp.c new file mode 100644 index 0000000..26f5197 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_distr_cemp.c @@ -0,0 +1,664 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for DISTR_CEMP + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_distr_cemp_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,29,(unur_distr_cemp_set_data( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,29,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,32,(unur_distr_cemp_read_data( distr, "junk" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,32,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,35,(unur_distr_cemp_set_hist( distr, NULL, 0, 0., 2. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,35,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,38,(unur_distr_cemp_set_hist_prob( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,38,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,41,(unur_distr_cemp_set_hist_domain( distr, 0., 2. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,41,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,44,(unur_distr_cemp_set_hist_bins( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,44,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,51,(unur_distr_cemp_set_data( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,51,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,54,(unur_distr_cemp_read_data( distr, "junk" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,54,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,57,(unur_distr_cemp_set_hist( distr, NULL, 0, 0., 2. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,57,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,60,(unur_distr_cemp_set_hist_prob( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,63,(unur_distr_cemp_set_hist_domain( distr, 0., 2. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,66,(unur_distr_cemp_set_hist_bins( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cemp_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,73,(unur_distr_cemp_set_data( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,73,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,76,(unur_distr_cemp_set_hist( distr, NULL, 0, 0., 2. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_distr_cemp_set_hist_prob( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,82,(unur_distr_cemp_set_hist_bins( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,82,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; + double data[] = {1.,2.,3.}; + distr = unur_distr_cemp_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,90,(unur_distr_cemp_set_data( distr, data, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,90,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,93,(unur_distr_cemp_read_data( distr, "there-should-be-no-such-file" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,93,UNUR_ERR_GENERIC)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,96,(unur_distr_cemp_set_hist( distr, data, 0, 0., 2. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,96,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,99,(unur_distr_cemp_set_hist_prob( distr, data, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,99,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,102,(unur_distr_cemp_set_hist( distr, data, 3, 5., 2. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,102,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,105,(unur_distr_cemp_set_hist_domain( distr, 5., 2. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,105,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,108,(unur_distr_cemp_set_hist_domain( distr, -UNUR_INFINITY, 2. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,108,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,111,(unur_distr_cemp_set_hist_domain( distr, 0., UNUR_INFINITY )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,111,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,114,(unur_distr_cemp_set_hist_bins( distr, data, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,114,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,117,(unur_distr_cemp_set_hist_bins( distr, data, 4 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,117,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; + double prob[] = {1.,2.,3.}; + double bins[] = {1.,2.,3.,4.}; + distr = unur_distr_cemp_new(); + unur_distr_cemp_set_hist_prob( distr, prob, 3 ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,127,(unur_distr_cemp_set_hist_bins( distr, bins, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,127,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,130,(unur_distr_cemp_set_hist_bins( distr, bins, 3 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,130,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,133,(unur_distr_cemp_set_hist_bins( distr, bins, 5 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,133,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; + double prob[] = {1.,2.,3.}; + double bins[] = {1.,2.,-3.,4.}; + double binsinf[] = {1.,2.,3.,UNUR_INFINITY}; + distr = unur_distr_cemp_new(); + unur_distr_cemp_set_hist_prob( distr, prob, 3 ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,144,(unur_distr_cemp_set_hist_bins( distr, bins, 4 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,144,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,147,(unur_distr_cemp_set_hist_bins( distr, binsinf, 4 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,147,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + const double *sample; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,159,(unur_distr_cemp_get_data( distr, &sample )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,159,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + const double *sample; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,167,(unur_distr_cemp_get_data( distr, &sample )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,167,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double data[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_cemp_new(); +unur_distr_cemp_set_data(distr,data,9); +par = unur_auto_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,196,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.)" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,200,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ + method = auto" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,205,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_cemp_new(); +unur_distr_cemp_set_hist_prob(distr,hist,9); +unur_distr_cemp_set_hist_domain(distr,1.,10.); +par = unur_auto_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,220,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen=NULL; +gen = unur_str2gen("cemp; hist_prob=(0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1); \ + hist_domain=(1.,10.)"); +n_tests_failed += (compare_sequence_gen(TESTLOG,225,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen=NULL; +gen = unur_str2gen("cemp; hist_prob=(0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1); \ + hist_domain=(1.,10.) & method = hist"); +n_tests_failed += (compare_sequence_gen(TESTLOG,230,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_distr_cemp_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_distr_cemp.conf b/vendor/unuran-1.11.0/tests/t_distr_cemp.conf new file mode 100644 index 0000000..fe3e266 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_distr_cemp.conf @@ -0,0 +1,241 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: DISTR_CEMP + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +############################################################################# + +[set] + +[set - invalid NULL ptr: + distr = NULL; ] + +unur_distr_cemp_set_data( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cemp_read_data( distr, "junk" ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cemp_set_hist( distr, NULL, 0, 0., 2. ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cemp_set_hist_prob( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cemp_set_hist_domain( distr, 0., 2. ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cemp_set_hist_bins( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid distribution type: + distr = unur_distr_discr_new(); ] + +unur_distr_cemp_set_data( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cemp_read_data( distr, "junk" ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cemp_set_hist( distr, NULL, 0, 0., 2. ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cemp_set_hist_prob( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cemp_set_hist_domain( distr, 0., 2. ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cemp_set_hist_bins( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + + +[set - invalid NULL ptr: + distr = unur_distr_cemp_new(); ] + +unur_distr_cemp_set_data( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cemp_set_hist( distr, NULL, 0, 0., 2. ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cemp_set_hist_prob( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cemp_set_hist_bins( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameters: + double data[] = {1.,2.,3.}; + distr = unur_distr_cemp_new(); ] + +unur_distr_cemp_set_data( distr, data, 0 ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cemp_read_data( distr, "there-should-be-no-such-file" ); + --> expected_setfailed --> UNUR_ERR_GENERIC + +unur_distr_cemp_set_hist( distr, data, 0, 0., 2. ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cemp_set_hist_prob( distr, data, 0 ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cemp_set_hist( distr, data, 3, 5., 2. ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cemp_set_hist_domain( distr, 5., 2. ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cemp_set_hist_domain( distr, -UNUR_INFINITY, 2. ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cemp_set_hist_domain( distr, 0., UNUR_INFINITY ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cemp_set_hist_bins( distr, data, 0 ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cemp_set_hist_bins( distr, data, 4 ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + + +[set - invalid parameters: + double prob[] = {1.,2.,3.}; + double bins[] = {1.,2.,3.,4.}; + distr = unur_distr_cemp_new(); + unur_distr_cemp_set_hist_prob( distr, prob, 3 ); ] + +unur_distr_cemp_set_hist_bins( distr, bins, 0 ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cemp_set_hist_bins( distr, bins, 3 ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cemp_set_hist_bins( distr, bins, 5 ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + + +[set - invalid parameters: + double prob[] = {1.,2.,3.}; + double bins[] = {1.,2.,-3.,4.}; + double binsinf[] = {1.,2.,3.,UNUR_INFINITY}; + distr = unur_distr_cemp_new(); + unur_distr_cemp_set_hist_prob( distr, prob, 3 ); ] + +unur_distr_cemp_set_hist_bins( distr, bins, 4 ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cemp_set_hist_bins( distr, binsinf, 4 ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + + +############################################################################# + +[get] + +[get - invalid NULL ptr: + const double *sample; + distr = NULL; ] + +unur_distr_cemp_get_data( distr, &sample ) + --> expected_zero --> UNUR_ERR_NULL + + +[get - invalid distribution type: + const double *sample; + distr = unur_distr_discr_new(); ] + +unur_distr_cemp_get_data( distr, &sample ) + --> expected_zero --> UNUR_ERR_DISTR_INVALID + + +############################################################################# + +[chg] + +############################################################################## + +[init] + +############################################################################# + +[reinit] + +############################################################################# + +[sample] + +[sample - compare stringparser: + double data[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.}; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_cemp_new(); +unur_distr_cemp_set_data(distr,data,9); +par = unur_auto_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.)" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ + method = auto" ); + -->compare_sequence_gen + +#............................................................................ + +[sample - compare stringparser: + double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_cemp_new(); +unur_distr_cemp_set_hist_prob(distr,hist,9); +unur_distr_cemp_set_hist_domain(distr,1.,10.); +par = unur_auto_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen=NULL; +gen = unur_str2gen("cemp; hist_prob=(0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1); \ + hist_domain=(1.,10.)"); + -->compare_sequence_gen + +unur_free(gen); gen=NULL; +gen = unur_str2gen("cemp; hist_prob=(0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1); \ + hist_domain=(1.,10.) & method = hist"); + -->compare_sequence_gen + +############################################################################# + +# [validate] + +############################################################################# +############################################################################# + +[verbatim] + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_distr_condi.c b/vendor/unuran-1.11.0/tests/t_distr_condi.c new file mode 100644 index 0000000..ee9dabf --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_distr_condi.c @@ -0,0 +1,1235 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for DISTR_CONDI + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_distr_condi_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + +int unur_distr_condi_set_pedantic(UNUR_PAR *par, int pedantic); +int unur_distr_condi_chg_verify(UNUR_GEN *gen, int verify); + + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +int unur_distr_condi_set_pedantic(UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return UNUR_FAILURE; } + +int unur_distr_condi_chg_verify(UNUR_GEN *gen, int verify) +{ + if (unur_arou_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; + if (unur_srou_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; + if (unur_tabl_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; + if (unur_tdr_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; + if (unur_ars_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; + return UNUR_FAILURE; +} + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,30,(unur_distr_condi_new( distr, NULL, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,30,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_multinormal(3,NULL,NULL); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,37,(unur_distr_condi_new( distr, NULL, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,37,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + double p[] = { 1., 2., 3., 4.}; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,45,(unur_distr_condi_new( distr, p, NULL, 4 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid data */ +UNUR_DISTR *distr = NULL; + double p[] = { 1., 2., 3., 4.}; + distr = unur_distr_multinormal(3,NULL,NULL); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,53,(unur_distr_condi_new( distr, p, NULL, -1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,56,(unur_distr_condi_new( distr, p, NULL, 3 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,56,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,67,(unur_distr_condi_set_condition( distr, NULL, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,67,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,74,(unur_distr_condi_set_condition( distr, NULL, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,74,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid data */ +UNUR_DISTR *distr = NULL; + double p[] = { 1., 2., 3., 4.}; + UNUR_DISTR *condi; + distr = unur_distr_multinormal(3,NULL,NULL); + condi = unur_distr_condi_new( distr, p, NULL, 0 ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,84,(unur_distr_condi_set_condition( condi, p, NULL, -1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,84,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,87,(unur_distr_condi_set_condition( condi, p, NULL, 3 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,87,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(condi); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + const double *pos, *dir; + int k; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,102,(unur_distr_condi_get_distribution( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,102,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,105,(unur_distr_condi_get_condition( distr, &pos, &dir, &k )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,105,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + const double *pos, *dir; + int k; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,114,(unur_distr_condi_get_distribution( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,114,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,117,(unur_distr_condi_get_condition( distr, &pos, &dir, &k )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,117,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* check for memory leaks */ +UNUR_DISTR *distr = NULL; + double p[] = { 1., 2., 3., 4.}; + double dir[] = { 1., -1., 2., -2.}; + UNUR_DISTR *condi; + distr = unur_distr_multinormal(3,NULL,NULL); + condi = unur_distr_condi_new( distr, p, NULL, 0 ); + + +unur_reset_errno(); +unur_distr_condi_set_condition( condi, p, NULL, 1 ); +n_tests_failed += (check_errorcode(TESTLOG,144,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_distr_condi_set_condition( condi, p, dir, 1 ); +n_tests_failed += (check_errorcode(TESTLOG,147,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; +unur_distr_free(condi); +unur_distr_free(distr); +} + +{ /* check for memory leaks */ +UNUR_DISTR *distr = NULL; + double p[] = { 1., 2., 3., 4.}; + double dir[] = { 1., -1., 2., -2.}; + UNUR_DISTR *condi; + distr = unur_distr_multinormal(4,NULL,NULL); + condi = unur_distr_condi_new( distr, p, dir, 0 ); + + +unur_reset_errno(); +unur_distr_condi_set_condition( condi, p, dir, 1 ); +n_tests_failed += (check_errorcode(TESTLOG,160,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_distr_condi_set_condition( condi, p, NULL, 1 ); +n_tests_failed += (check_errorcode(TESTLOG,163,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_distr_condi_set_condition( condi, p, dir, 3 ); +n_tests_failed += (check_errorcode(TESTLOG,166,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; +unur_distr_free(condi); +unur_distr_free(distr); +} + +{ /* check for memory leaks */ +UNUR_DISTR *distr = NULL; + double p[] = { 1., 2., 3., 4.}; + double dir[] = { 1., -1., 2., -2.}; + UNUR_DISTR *condi; + distr = unur_distr_multinormal(4,NULL,NULL); + condi = unur_distr_condi_new( distr, p, NULL, 0 ); + + +unur_reset_errno(); +unur_distr_condi_set_condition( condi, p, NULL, 1 ); +n_tests_failed += (check_errorcode(TESTLOG,179,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_distr_condi_set_condition( condi, p, dir, 1 ); +n_tests_failed += (check_errorcode(TESTLOG,182,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_distr_condi_set_condition( condi, p, NULL, 3 ); +n_tests_failed += (check_errorcode(TESTLOG,185,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; +unur_distr_free(condi); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[7]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 7 */ +{ +#define dim (3) +UNUR_DISTR *normal = unur_distr_multinormal(dim,NULL,NULL); +int i; +double p[dim]; +for(i=0;isetup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 35 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_arou_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ars_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tabl_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_arou_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ars_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tabl_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_arou_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ars_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tabl_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ars_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tabl_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_arou_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ars_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tabl_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_arou_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ars_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [6] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_arou_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ars_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tabl_new(distr_localcopy); + unur_distr_condi_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_condi_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_distr_condi_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_distr_condi.conf b/vendor/unuran-1.11.0/tests/t_distr_condi.conf new file mode 100644 index 0000000..5fccec0 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_distr_condi.conf @@ -0,0 +1,392 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: DISTR_CONDI + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +## work-around for missing functions +int unur_distr_condi_set_pedantic(UNUR_PAR *par, int pedantic); +int unur_distr_condi_chg_verify(UNUR_GEN *gen, int verify); + + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +unur_distr_condi_new( distr, NULL, NULL, 0 ); + --> expected_NULL --> UNUR_ERR_NULL + + +[new - invalid NULL ptr: + distr = unur_distr_multinormal(3,NULL,NULL); ] + +unur_distr_condi_new( distr, NULL, NULL, 0 ); + --> expected_NULL --> UNUR_ERR_NULL + + +[new - invalid distribution type: + double p[] = { 1., 2., 3., 4.}; + distr = unur_distr_discr_new(); ] + +unur_distr_condi_new( distr, p, NULL, 4 ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + + +[new - invalid data: + double p[] = { 1., 2., 3., 4.}; + distr = unur_distr_multinormal(3,NULL,NULL); ] + +unur_distr_condi_new( distr, p, NULL, -1 ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_condi_new( distr, p, NULL, 3 ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + + +############################################################################# + +[set] + +[set - invalid NULL ptr: + distr = NULL; ] + +unur_distr_condi_set_condition( distr, NULL, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid distribution type: + distr = unur_distr_discr_new(); ] + +unur_distr_condi_set_condition( distr, NULL, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + + +[set - invalid data: + double p[] = { 1., 2., 3., 4.}; + UNUR_DISTR *condi; + distr = unur_distr_multinormal(3,NULL,NULL); + condi = unur_distr_condi_new( distr, p, NULL, 0 ); ] + +unur_distr_condi_set_condition( condi, p, NULL, -1 ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_condi_set_condition( condi, p, NULL, 3 ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_free(condi); + + +############################################################################# + +[get] + +[get - invalid NULL ptr: + const double *pos, *dir; + int k; + distr = NULL; ] + +unur_distr_condi_get_distribution( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_condi_get_condition( distr, &pos, &dir, &k ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[get - invalid distribution type: + const double *pos, *dir; + int k; + distr = unur_distr_cont_new(); ] + +unur_distr_condi_get_distribution( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_condi_get_condition( distr, &pos, &dir, &k ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + + +############################################################################# + +# [chg] + +############################################################################## + +# [init] + +############################################################################# + +# [reinit] + +############################################################################# + +[sample] + +[sample - check for memory leaks: + double p[] = { 1., 2., 3., 4.}; + double dir[] = { 1., -1., 2., -2.}; + UNUR_DISTR *condi; + distr = unur_distr_multinormal(3,NULL,NULL); + condi = unur_distr_condi_new( distr, p, NULL, 0 ); ] + +unur_distr_condi_set_condition( condi, p, NULL, 1 ); + --> none --> UNUR_SUCCESS + +unur_distr_condi_set_condition( condi, p, dir, 1 ); + --> none --> UNUR_SUCCESS + +unur_distr_free(condi); + + +[sample - check for memory leaks: + double p[] = { 1., 2., 3., 4.}; + double dir[] = { 1., -1., 2., -2.}; + UNUR_DISTR *condi; + distr = unur_distr_multinormal(4,NULL,NULL); + condi = unur_distr_condi_new( distr, p, dir, 0 ); ] + +unur_distr_condi_set_condition( condi, p, dir, 1 ); + --> none --> UNUR_SUCCESS + +unur_distr_condi_set_condition( condi, p, NULL, 1 ); + --> none --> UNUR_SUCCESS + +unur_distr_condi_set_condition( condi, p, dir, 3 ); + --> none --> UNUR_SUCCESS + +unur_distr_free(condi); + + +[sample - check for memory leaks: + double p[] = { 1., 2., 3., 4.}; + double dir[] = { 1., -1., 2., -2.}; + UNUR_DISTR *condi; + distr = unur_distr_multinormal(4,NULL,NULL); + condi = unur_distr_condi_new( distr, p, NULL, 0 ); ] + +unur_distr_condi_set_condition( condi, p, NULL, 1 ); + --> none --> UNUR_SUCCESS + +unur_distr_condi_set_condition( condi, p, dir, 1 ); + --> none --> UNUR_SUCCESS + +unur_distr_condi_set_condition( condi, p, NULL, 3 ); + --> none --> UNUR_SUCCESS + +unur_distr_free(condi); + + +############################################################################# + +[validate] + +[validate - generators:] + +# AROU (default) +par[0] = unur_arou_new(@distr@); + +# TDR (default) +par[1] = unur_tdr_new(@distr@); + +# TDR (T=log) +par[2] = unur_tdr_new(@distr@); +unur_tdr_set_c(par,0.); + +# ARS +par[3] = unur_ars_new(@distr@); + +# TABL (default) +par[4] = unur_tabl_new(@distr@); + + +[validate - distributions:] + +# conditional: standard multinormal distribution +\#define dim (3) +UNUR_DISTR *normal = unur_distr_multinormal(dim,NULL,NULL); +int i; +double p[dim]; +for(i=0;i + + + + + # standard multinormal (dim=3, coord=0) + <1> + + + + + # standard multinormal (dim=3, coord=2) + <2> x+ + + + + # standard multinormal (dim=4, random dir) +x<3> . + + + + # multinormal (dim=3, random dir) + <4> x+ + + + + # conditional: multinormal distribution with rectangular domain + <5> x+ + + + . # conditional: multinormal distribution with rectangular domain + <6> x+ + + + + # conditional: multinormal distribution with rectangular domain + +############################################################################# +############################################################################# + +[verbatim] + +## work-around for missing functions +int unur_distr_condi_set_pedantic(UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return UNUR_FAILURE; } + +int unur_distr_condi_chg_verify(UNUR_GEN *gen, int verify) +{ + if (unur_arou_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; + if (unur_srou_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; + if (unur_tabl_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; + if (unur_tdr_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; + if (unur_ars_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; + return UNUR_FAILURE; +} + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_distr_cont.c b/vendor/unuran-1.11.0/tests/t_distr_cont.c new file mode 100644 index 0000000..001fc84 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_distr_cont.c @@ -0,0 +1,2336 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for DISTR_CONT + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_distr_cont_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +#include + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + +double pdf(double x, const UNUR_DISTR *distr); +double dpdf(double x, const UNUR_DISTR *distr); +double cdf(double x, const UNUR_DISTR *distr); +double invcdf(double x, const UNUR_DISTR *distr); +double hr(double x, const UNUR_DISTR *distr); + +int unur_distr_cont_set_pedantic(UNUR_PAR *par, int pedantic); +int unur_distr_cont_chg_verify(UNUR_GEN *gen, int verify); + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +double pdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } +double dpdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } +double cdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } +double invcdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } +double hr(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } + +int unur_distr_cont_set_pedantic(UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { + return UNUR_FAILURE; +} + +int unur_distr_cont_chg_verify(UNUR_GEN *gen, int verify) +{ + if (unur_arou_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; + if (unur_srou_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; + return UNUR_FAILURE; +} + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,42,(unur_distr_cont_set_pdf( distr, pdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,45,(unur_distr_cont_set_dpdf( distr, dpdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,48,(unur_distr_cont_set_logpdf( distr, pdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,48,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,51,(unur_distr_cont_set_dlogpdf( distr, dpdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,51,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,54,(unur_distr_cont_set_cdf( distr, cdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,54,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,57,(unur_distr_cont_set_invcdf( distr, invcdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,57,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,60,(unur_distr_cont_set_hr( distr, hr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,63,(unur_distr_cont_set_pdfstr( distr, "pdf" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,66,(unur_distr_cont_set_logpdfstr( distr, "pdf" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,69,(unur_distr_cont_set_cdfstr( distr, "cdf" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,69,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,72,(unur_distr_cont_set_hrstr( distr, "hr" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,72,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,75,(unur_distr_cont_set_pdfparams( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,75,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,78,(unur_distr_cont_set_pdfparams_vec( distr, 0, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,78,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,81,(unur_distr_cont_set_domain( distr, 0., 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,81,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,84,(unur_distr_cont_set_mode( distr, 0. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,84,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,87,(unur_distr_cont_set_center( distr, 0. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,87,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,90,(unur_distr_cont_set_pdfarea( distr, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,90,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,97,(unur_distr_cont_set_pdf( distr, pdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,97,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,100,(unur_distr_cont_set_dpdf( distr, dpdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,100,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,103,(unur_distr_cont_set_logpdf( distr, pdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,103,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_distr_cont_set_dlogpdf( distr, dpdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,109,(unur_distr_cont_set_cdf( distr, cdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,109,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,112,(unur_distr_cont_set_invcdf( distr, invcdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,112,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,115,(unur_distr_cont_set_hr( distr, hr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,115,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,118,(unur_distr_cont_set_pdfstr( distr, "exp(-x)" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,118,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,121,(unur_distr_cont_set_pdfstr( distr, "-x" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,121,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,124,(unur_distr_cont_set_cdfstr( distr, "exp(-x)" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,124,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,127,(unur_distr_cont_set_hrstr( distr, "exp(-x)" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,127,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,130,(unur_distr_cont_set_pdfparams( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,130,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,133,(unur_distr_cont_set_domain( distr, 0., 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,133,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,136,(unur_distr_cont_set_mode( distr, 0. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,136,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,139,(unur_distr_cont_set_center( distr, 0. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,139,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,142,(unur_distr_cont_set_pdfarea( distr, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,142,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,149,(unur_distr_cont_set_pdf( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,149,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,152,(unur_distr_cont_set_dpdf( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,152,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,155,(unur_distr_cont_set_logpdf( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,155,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,158,(unur_distr_cont_set_dlogpdf( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,158,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,161,(unur_distr_cont_set_cdf( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,161,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,164,(unur_distr_cont_set_invcdf( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,164,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,167,(unur_distr_cont_set_hr( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,167,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,170,(unur_distr_cont_set_pdfstr( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,170,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,173,(unur_distr_cont_set_logpdfstr( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,173,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,176,(unur_distr_cont_set_cdfstr( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,176,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,179,(unur_distr_cont_set_hrstr( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,179,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,182,(unur_distr_cont_set_pdfparams( distr, NULL, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,182,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; + double pv[] = {1.,2.,3.}; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,190,(unur_distr_cont_set_pdfstr( distr, "" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,190,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,193,(unur_distr_cont_set_pdfstr( distr, "x * y * z" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,193,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,196,(unur_distr_cont_set_pdfstr( distr, "beta(2.)" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,196,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,199,(unur_distr_cont_set_logpdfstr( distr, "" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,199,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,202,(unur_distr_cont_set_logpdfstr( distr, "x * y * z" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,202,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,205,(unur_distr_cont_set_logpdfstr( distr, "beta(2.)" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,205,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,208,(unur_distr_cont_set_cdfstr( distr, "" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,208,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,211,(unur_distr_cont_set_cdfstr( distr, "beta(2.)" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,211,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,214,(unur_distr_cont_set_hrstr( distr, "" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,214,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,217,(unur_distr_cont_set_pdfparams( distr, pv, -1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,217,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,220,(unur_distr_cont_set_pdfparams( distr, pv, UNUR_DISTR_MAXPARAMS +1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,220,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,223,(unur_distr_cont_set_pdfparams_vec( distr, -1, pv, 2 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,223,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,226,(unur_distr_cont_set_pdfparams_vec( distr, 100000, pv, 2 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,226,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,229,(unur_distr_cont_set_domain( distr, 0., -1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,229,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,232,(unur_distr_cont_set_pdfarea( distr, -1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,232,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid set parameters */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_normal(NULL,0); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,239,(unur_distr_cont_set_pdf( distr, pdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,239,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,242,(unur_distr_cont_set_dpdf( distr, dpdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,242,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,245,(unur_distr_cont_set_logpdf( distr, pdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,245,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,248,(unur_distr_cont_set_dlogpdf( distr, dpdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,248,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + double a, b; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,261,(unur_distr_cont_get_pdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,261,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,264,(unur_distr_cont_get_dpdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,264,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,267,(unur_distr_cont_get_logpdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,267,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,270,(unur_distr_cont_get_dlogpdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,270,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,273,(unur_distr_cont_get_cdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,273,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,276,(unur_distr_cont_get_invcdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,276,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,279,(unur_distr_cont_get_hr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,279,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,282,(unur_distr_cont_get_pdfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,282,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,285,(unur_distr_cont_get_dpdfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,285,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,288,(unur_distr_cont_get_logpdfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,288,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,291,(unur_distr_cont_get_dlogpdfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,291,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,294,(unur_distr_cont_get_cdfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,294,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,297,(unur_distr_cont_get_hrstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,297,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,300,(unur_distr_cont_get_pdfparams( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,300,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,303,(unur_distr_cont_get_pdfparams_vec( distr, 0, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,303,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,306,(unur_distr_cont_get_domain( distr, &a, &b )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,306,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,309,(unur_distr_cont_get_mode( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,309,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,312,(unur_distr_cont_get_pdfarea( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,312,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + double a,b; + const double *ar; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,321,(unur_distr_cont_get_pdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,321,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,324,(unur_distr_cont_get_dpdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,324,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,327,(unur_distr_cont_get_logpdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,327,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,330,(unur_distr_cont_get_dlogpdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,330,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,333,(unur_distr_cont_get_cdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,333,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,336,(unur_distr_cont_get_invcdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,336,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,339,(unur_distr_cont_get_hr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,339,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,342,(unur_distr_cont_get_pdfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,342,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,345,(unur_distr_cont_get_dpdfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,345,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,348,(unur_distr_cont_get_logpdfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,348,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,351,(unur_distr_cont_get_dlogpdfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,351,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,354,(unur_distr_cont_get_cdfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,354,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,357,(unur_distr_cont_get_hrstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,357,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,360,(unur_distr_cont_get_pdfparams( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,360,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,363,(unur_distr_cont_get_pdfparams_vec( distr, 0, &ar )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,363,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,366,(unur_distr_cont_get_domain( distr, &a, &b )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,366,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,369,(unur_distr_cont_get_mode( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,369,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,372,(unur_distr_cont_get_pdfarea( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,372,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* parameters not unknown */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,379,(unur_distr_cont_get_pdfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,379,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,382,(unur_distr_cont_get_dpdfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,382,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,385,(unur_distr_cont_get_logpdfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,385,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,388,(unur_distr_cont_get_dlogpdfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,388,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,391,(unur_distr_cont_get_cdfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,391,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,394,(unur_distr_cont_get_hrstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,394,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,397,(unur_distr_cont_get_mode( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,397,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,400,(unur_distr_cont_get_pdfarea( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,400,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,411,(unur_distr_cont_upd_mode( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,411,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,414,(unur_distr_cont_upd_pdfarea( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,414,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,421,(unur_distr_cont_upd_mode( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,421,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,424,(unur_distr_cont_upd_pdfarea( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,424,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* missing data */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,431,(unur_distr_cont_upd_mode( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,431,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,434,(unur_distr_cont_upd_pdfarea( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,434,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,453,(unur_distr_cont_eval_pdf( 1., distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,453,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,456,(unur_distr_cont_eval_dpdf( 1., distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,456,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,459,(unur_distr_cont_eval_logpdf( 1., distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,459,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,462,(unur_distr_cont_eval_dlogpdf( 1., distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,462,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,465,(unur_distr_cont_eval_cdf( 1., distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,465,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,468,(unur_distr_cont_eval_invcdf( 0.5, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,468,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,471,(unur_distr_cont_eval_hr( 1., distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,471,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,478,(unur_distr_cont_eval_pdf( 1., distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,478,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,481,(unur_distr_cont_eval_dpdf( 1., distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,481,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,484,(unur_distr_cont_eval_logpdf( 1., distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,484,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,487,(unur_distr_cont_eval_dlogpdf( 1., distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,487,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,490,(unur_distr_cont_eval_cdf( 1., distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,490,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,493,(unur_distr_cont_eval_invcdf( 0.5, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,493,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,496,(unur_distr_cont_eval_hr( 1., distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,496,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* missing data */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,503,(unur_distr_cont_eval_pdf( 1., distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,503,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,506,(unur_distr_cont_eval_dpdf( 1., distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,506,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,509,(unur_distr_cont_eval_logpdf( 1., distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,509,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,512,(unur_distr_cont_eval_dlogpdf( 1., distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,512,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,515,(unur_distr_cont_eval_cdf( 1., distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,515,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,518,(unur_distr_cont_eval_invcdf( 0.5, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,518,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,521,(unur_distr_cont_eval_hr( 1., distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,521,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* check for memory leaks */ +UNUR_DISTR *distr = NULL; + double x[] = { 1., 2., 3. }; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +unur_distr_cont_set_pdfparams_vec( distr, 0, x, 3 ); +n_tests_failed += (check_errorcode(TESTLOG,529,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[12]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 12 */ +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[0] = unur_distr_beta_w_pdf_from_logpdf(fpm,2); +} + +{ +distr[1] = unur_distr_cauchy_w_pdf_from_logpdf(NULL,0); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[2] = unur_distr_cauchy_w_pdf_from_logpdf(fpm,2); +} + +{ +distr[3] = unur_distr_exponential_w_pdf_from_logpdf(NULL,0); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[4] = unur_distr_exponential_w_pdf_from_logpdf(fpm,2); +} + +{ +fpm[0] = 1.; +distr[5] = unur_distr_gamma_w_pdf_from_logpdf(fpm,1); +} + +{ +fpm[0] = 1.; +fpm[1] = 4.; +distr[6] = unur_distr_gamma_w_pdf_from_logpdf(fpm,2); +} + +{ +fpm[0] = 3.; +distr[7] = unur_distr_gamma_w_pdf_from_logpdf(fpm,1); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[8] = unur_distr_gamma_w_pdf_from_logpdf(fpm,2); +} + +{ +distr[9] = unur_distr_normal_w_pdf_from_logpdf(NULL,0); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[10] = unur_distr_normal_w_pdf_from_logpdf(fpm,2); +} + +{ +fpm[0] = 5.; +distr[11] = unur_distr_powerexponential_w_pdf_from_logpdf(fpm,1); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 36 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_arou_new(distr_localcopy); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 36 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_srou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_srou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_srou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_srou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_srou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_srou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_srou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_srou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_srou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_srou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_srou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_usedars(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_arou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_srou_new(distr_localcopy); + unur_distr_cont_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_distr_cont_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_distr_cont_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_distr_cont.conf b/vendor/unuran-1.11.0/tests/t_distr_cont.conf new file mode 100644 index 0000000..c3133df --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_distr_cont.conf @@ -0,0 +1,700 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: DISTR_CONT + +[main - header:] + +## we need UNUR_DISTR_MAXPARAMS for a test: +\#include + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +double pdf(double x, const UNUR_DISTR *distr); +double dpdf(double x, const UNUR_DISTR *distr); +double cdf(double x, const UNUR_DISTR *distr); +double invcdf(double x, const UNUR_DISTR *distr); +double hr(double x, const UNUR_DISTR *distr); + +## work-around for missing functions +int unur_distr_cont_set_pedantic(UNUR_PAR *par, int pedantic); +int unur_distr_cont_chg_verify(UNUR_GEN *gen, int verify); + +############################################################################# + +[new] + +############################################################################# + +[set] + +[set - invalid NULL ptr: + distr = NULL; ] + +unur_distr_cont_set_pdf( distr, pdf ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_dpdf( distr, dpdf ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_logpdf( distr, pdf ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_dlogpdf( distr, dpdf ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_cdf( distr, cdf ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_invcdf( distr, invcdf ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_hr( distr, hr ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_pdfstr( distr, "pdf" ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_logpdfstr( distr, "pdf" ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_cdfstr( distr, "cdf" ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_hrstr( distr, "hr" ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_pdfparams( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_pdfparams_vec( distr, 0, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_domain( distr, 0., 1. ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_mode( distr, 0. ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_center( distr, 0. ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_pdfarea( distr, 1. ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid distribution type: + distr = unur_distr_discr_new(); ] + +unur_distr_cont_set_pdf( distr, pdf ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_set_dpdf( distr, dpdf ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_set_logpdf( distr, pdf ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_set_dlogpdf( distr, dpdf ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_set_cdf( distr, cdf ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_set_invcdf( distr, invcdf ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_set_hr( distr, hr ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_set_pdfstr( distr, "exp(-x)" ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_set_pdfstr( distr, "-x" ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_set_cdfstr( distr, "exp(-x)" ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_set_hrstr( distr, "exp(-x)" ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_set_pdfparams( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_set_domain( distr, 0., 1. ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_set_mode( distr, 0. ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_set_center( distr, 0. ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_set_pdfarea( distr, 1. ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + + +[set - invalid NULL ptr: + distr = unur_distr_cont_new(); ] + +unur_distr_cont_set_pdf( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_dpdf( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_logpdf( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_dlogpdf( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_cdf( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_invcdf( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_hr( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_pdfstr( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_logpdfstr( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_cdfstr( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_hrstr( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_set_pdfparams( distr, NULL, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameters: + double pv[] = {1.,2.,3.}; + distr = unur_distr_cont_new(); ] + +unur_distr_cont_set_pdfstr( distr, "" ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cont_set_pdfstr( distr, "x * y * z" ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cont_set_pdfstr( distr, "beta(2.)" ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cont_set_logpdfstr( distr, "" ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cont_set_logpdfstr( distr, "x * y * z" ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cont_set_logpdfstr( distr, "beta(2.)" ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cont_set_cdfstr( distr, "" ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cont_set_cdfstr( distr, "beta(2.)" ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cont_set_hrstr( distr, "" ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cont_set_pdfparams( distr, pv, -1 ); + --> expected_setfailed --> UNUR_ERR_DISTR_NPARAMS + +unur_distr_cont_set_pdfparams( distr, pv, UNUR_DISTR_MAXPARAMS +1 ); + --> expected_setfailed --> UNUR_ERR_DISTR_NPARAMS + +unur_distr_cont_set_pdfparams_vec( distr, -1, pv, 2 ); + --> expected_setfailed --> UNUR_ERR_DISTR_NPARAMS + +unur_distr_cont_set_pdfparams_vec( distr, 100000, pv, 2 ); + --> expected_setfailed --> UNUR_ERR_DISTR_NPARAMS + +unur_distr_cont_set_domain( distr, 0., -1. ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cont_set_pdfarea( distr, -1. ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + + +[set - invalid set parameters: + distr = unur_distr_normal(NULL,0); ] + +unur_distr_cont_set_pdf( distr, pdf ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cont_set_dpdf( distr, dpdf ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cont_set_logpdf( distr, pdf ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cont_set_dlogpdf( distr, dpdf ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + + + +############################################################################# + +[get] + +[get - invalid NULL ptr: + double a, b; + distr = NULL; ] + +unur_distr_cont_get_pdf( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cont_get_dpdf( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cont_get_logpdf( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cont_get_dlogpdf( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cont_get_cdf( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cont_get_invcdf( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cont_get_hr( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cont_get_pdfstr( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cont_get_dpdfstr( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cont_get_logpdfstr( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cont_get_dlogpdfstr( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cont_get_cdfstr( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cont_get_hrstr( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cont_get_pdfparams( distr, NULL ); + --> expected_zero --> UNUR_ERR_NULL + +unur_distr_cont_get_pdfparams_vec( distr, 0, NULL ); + --> expected_zero --> UNUR_ERR_NULL + +unur_distr_cont_get_domain( distr, &a, &b ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_get_mode( distr ); + --> expected_INFINITY --> UNUR_ERR_NULL + +unur_distr_cont_get_pdfarea( distr ); + --> expected_INFINITY --> UNUR_ERR_NULL + + +[get - invalid distribution type: + double a,b; + const double *ar; + distr = unur_distr_discr_new(); ] + +unur_distr_cont_get_pdf( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_get_dpdf( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_get_logpdf( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_get_dlogpdf( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_get_cdf( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_get_invcdf( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_get_hr( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_get_pdfstr( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_get_dpdfstr( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_get_logpdfstr( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_get_dlogpdfstr( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_get_cdfstr( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_get_hrstr( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_get_pdfparams( distr, NULL ); + --> expected_zero --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_get_pdfparams_vec( distr, 0, &ar ); + --> expected_zero --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_get_domain( distr, &a, &b ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_get_mode( distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_get_pdfarea( distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID + + +[get - parameters not unknown: + distr = unur_distr_cont_new(); ] + +unur_distr_cont_get_pdfstr( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cont_get_dpdfstr( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cont_get_logpdfstr( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cont_get_dlogpdfstr( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cont_get_cdfstr( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cont_get_hrstr( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cont_get_mode( distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_GET + +unur_distr_cont_get_pdfarea( distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_GET + + +############################################################################# + +[chg] + +[chg - invalid NULL ptr: + distr = NULL; ] + +unur_distr_cont_upd_mode( distr ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cont_upd_pdfarea( distr ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[chg - invalid distribution type: + distr = unur_distr_discr_new(); ] + +unur_distr_cont_upd_mode( distr ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_upd_pdfarea( distr ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + + +[chg - missing data: + distr = unur_distr_cont_new(); ] + +unur_distr_cont_upd_mode( distr ); + --> expected_setfailed --> UNUR_ERR_DISTR_DATA + +unur_distr_cont_upd_pdfarea( distr ); + --> expected_setfailed --> UNUR_ERR_DISTR_DATA + + +############################################################################## + +# [init] + +############################################################################# + +# [reinit] + +############################################################################# + +[sample] + +[sample - invalid NULL ptr: + distr = NULL; ] + +unur_distr_cont_eval_pdf( 1., distr ); + --> expected_INFINITY --> UNUR_ERR_NULL + +unur_distr_cont_eval_dpdf( 1., distr ); + --> expected_INFINITY --> UNUR_ERR_NULL + +unur_distr_cont_eval_logpdf( 1., distr ); + --> expected_INFINITY --> UNUR_ERR_NULL + +unur_distr_cont_eval_dlogpdf( 1., distr ); + --> expected_INFINITY --> UNUR_ERR_NULL + +unur_distr_cont_eval_cdf( 1., distr ); + --> expected_INFINITY --> UNUR_ERR_NULL + +unur_distr_cont_eval_invcdf( 0.5, distr ); + --> expected_INFINITY --> UNUR_ERR_NULL + +unur_distr_cont_eval_hr( 1., distr ); + --> expected_INFINITY --> UNUR_ERR_NULL + + +[sample - invalid distribution object: + distr = unur_distr_discr_new(); ] + +unur_distr_cont_eval_pdf( 1., distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_eval_dpdf( 1., distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_eval_logpdf( 1., distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_eval_dlogpdf( 1., distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_eval_cdf( 1., distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_eval_invcdf( 0.5, distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID + +unur_distr_cont_eval_hr( 1., distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID + + +[sample - missing data: + distr = unur_distr_cont_new(); ] + +unur_distr_cont_eval_pdf( 1., distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_DATA + +unur_distr_cont_eval_dpdf( 1., distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_DATA + +unur_distr_cont_eval_logpdf( 1., distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_DATA + +unur_distr_cont_eval_dlogpdf( 1., distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_DATA + +unur_distr_cont_eval_cdf( 1., distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_DATA + +unur_distr_cont_eval_invcdf( 0.5, distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_DATA + +unur_distr_cont_eval_hr( 1., distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_DATA + + +[sample - check for memory leaks: + double x[] = { 1., 2., 3. }; + distr = unur_distr_cont_new(); ] + +unur_distr_cont_set_pdfparams_vec( distr, 0, x, 3 ); + --> none --> UNUR_SUCCESS + +############################################################################# + +[validate] + +## test wrapper functions + +[validate - generators:] + +# AROU without DARS +par[0] = unur_arou_new(@distr@); +unur_arou_set_usedars(par,0); + +# AROU, use dars +par[1] = unur_arou_new(@distr@); +unur_arou_set_cpoints( par, 8, NULL ); +unur_arou_set_usedars(par,1); + +# SROU (default) +#par[2] = unur_srou_new(@distr@); + +# small squeeze / hat ratio +par[2] = unur_srou_new(@distr@); +#unur_arou_set_cpoints( par, 8, NULL ); +#unur_arou_set_max_sqhratio(par,0.5); + + + +[validate - distributions:] + +## distributions where PDF is computed from logPDF + +# beta +fpm[0] = 3.; +fpm[1] = 4.; +distr[0] = unur_distr_beta_w_pdf_from_logpdf(fpm,2); + +# cauchy +distr[1] = unur_distr_cauchy_w_pdf_from_logpdf(NULL,0); + +# cauchy +fpm[0] = 3.; +fpm[1] = 4.; +distr[2] = unur_distr_cauchy_w_pdf_from_logpdf(fpm,2); + +# exponential +distr[3] = unur_distr_exponential_w_pdf_from_logpdf(NULL,0); + +# exponential +fpm[0] = 3.; +fpm[1] = 4.; +distr[4] = unur_distr_exponential_w_pdf_from_logpdf(fpm,2); + +# gamma +fpm[0] = 1.; +distr[5] = unur_distr_gamma_w_pdf_from_logpdf(fpm,1); + +# gamma +fpm[0] = 1.; +fpm[1] = 4.; +distr[6] = unur_distr_gamma_w_pdf_from_logpdf(fpm,2); + +# gamma +fpm[0] = 3.; +distr[7] = unur_distr_gamma_w_pdf_from_logpdf(fpm,1); + +# gamma +fpm[0] = 3.; +fpm[1] = 4.; +distr[8] = unur_distr_gamma_w_pdf_from_logpdf(fpm,2); + +# normal +distr[9] = unur_distr_normal_w_pdf_from_logpdf(NULL,0); + +# normal +fpm[0] = 3.; +fpm[1] = 4.; +distr[10] = unur_distr_normal_w_pdf_from_logpdf(fpm,2); + +# powerexponential +fpm[0] = 5.; +distr[11] = unur_distr_powerexponential_w_pdf_from_logpdf(fpm,1); + + +# number of distributions: 12 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] AROU without DARS +# [1] AROU with DARS +# [2] SROU +# +#gen [0] [1] [2] # distribution +#--------------------------------------------- +## distributions where PDF is computed from logPDF + <0> + + + # beta (3,4) + <1> + + + # cauchy () + <2> + + + # cauchy (3,4) + <3> + + + # exponential () + <4> + + + # exponential (3,4) +x <5> + + + # gamma (1) +x <6> + + + # gamma (1,4) +x <7> + + + # gamma (3) + <8> + + + # gamma (3,4) + <9> + + + # normal () + <10> + + + # normal (3,4) + <11> + + + # powerexponential (5) + + +[validate - verify hat:] + +# + ... pass test +# ~ ... fail in at most 1% of samples +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] AROU without DARS +# [1] AROU with DARS +# [2] SROU +# +#gen [0] [1] [2] # distribution +#--------------------------------------------- +## distributions where PDF is computed from logPDF + <0> + + + # beta (3,4) + <1> + + + # cauchy () + <2> + + + # cauchy (3,4) + <3> + + + # exponential () + <4> + + + # exponential (3,4) +x <5> + + + # gamma (1) +x <6> + + + # gamma (1,4) +x <7> + + + # gamma (3) + <8> + + + # gamma (3,4) + <9> + + + # normal () + <10> + + + # normal (3,4) + <11> + + + # powerexponential (5) + +############################################################################# +############################################################################# + +[verbatim] + +double pdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } +double dpdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } +double cdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } +double invcdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } +double hr(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } + +## work-around for missing functions +int unur_distr_cont_set_pedantic(UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { + return UNUR_FAILURE; +} + +int unur_distr_cont_chg_verify(UNUR_GEN *gen, int verify) +{ + if (unur_arou_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; + if (unur_srou_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; + return UNUR_FAILURE; +} + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_distr_corder.c b/vendor/unuran-1.11.0/tests/t_distr_corder.c new file mode 100644 index 0000000..fb129a7 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_distr_corder.c @@ -0,0 +1,1499 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for DISTR_CORDER + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_distr_corder_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,25,(unur_distr_corder_new( distr, 5, 2 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,25,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,32,(unur_distr_corder_new( distr, 5, 2 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,32,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid order statistics */ +UNUR_DISTR *distr = NULL; + UNUR_DISTR *os; + distr = unur_distr_normal(NULL,0); + os = unur_distr_corder_new( distr, 5, 2 ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,41,(unur_distr_corder_new( os, 5, 2 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,41,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(os); +unur_distr_free(distr); +} + +{ /* invalid data */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_normal(NULL,0); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,50,(unur_distr_corder_new( distr, 5, 6 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,50,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,53,(unur_distr_corder_new( distr, 1, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,56,(unur_distr_corder_new( distr, 2, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,56,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,67,(unur_distr_corder_set_rank( distr, 5, 2 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,67,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,70,(unur_distr_corder_set_pdfparams( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,73,(unur_distr_corder_set_domain( distr, 0., 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,73,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,76,(unur_distr_corder_set_mode( distr, 0. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_distr_corder_set_pdfarea( distr, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_normal(NULL,0); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,86,(unur_distr_corder_set_rank( distr, 5, 2 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,86,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,92,(unur_distr_corder_set_pdfparams( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,92,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,95,(unur_distr_corder_set_domain( distr, 0., 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,95,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,98,(unur_distr_corder_set_mode( distr, 0. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,98,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,101,(unur_distr_corder_set_pdfarea( distr, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + UNUR_DISTR *os; + distr = unur_distr_normal(NULL,0); + os = unur_distr_corder_new( distr, 5, 2 ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,109,(unur_distr_corder_set_pdfparams( distr, NULL, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,109,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(os); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; + UNUR_DISTR *os; + distr = unur_distr_normal(NULL,0); + os = unur_distr_corder_new( distr, 5, 2 ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,119,(unur_distr_corder_set_rank( os, 5, 20 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,119,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,122,(unur_distr_cont_set_pdfarea( distr, -1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,122,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(os); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + int n, k; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,136,(unur_distr_corder_get_distribution( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,136,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,139,(unur_distr_corder_get_rank( distr, &n, &k )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,139,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + int n, k; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,147,(unur_distr_corder_get_distribution( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,147,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,150,(unur_distr_corder_get_rank( distr, &n, &k )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,150,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* parameters not unknown */ +UNUR_DISTR *distr = NULL; + int n, k; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,158,(unur_distr_corder_get_distribution( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,158,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,161,(unur_distr_corder_get_rank( distr, &n, &k )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,161,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + UNUR_DISTR *d; + d = unur_distr_cauchy(NULL,0); + distr = unur_distr_corder_new( d, 10, 8); + unur_distr_free(d); + par = unur_arou_new(distr); + unur_arou_set_max_sqhratio(par,0.); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 187, gen ); + + +unur_reset_errno(); +/* original generator object */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,191,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,197,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_DISTR *os = NULL; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_normal(NULL,0); +unur_distr_cont_set_domain(distr,0.,UNUR_INFINITY); +os = unur_distr_corder_new(distr,10,7); +par = unur_arou_new(os); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,212,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +unur_distr_free(os); os = NULL; +gen = unur_str2gen("normal; domain=(0.,inf); orderstatistics=(10,7) & \ + method = arou"); +n_tests_failed += (compare_sequence_gen(TESTLOG,219,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[16]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 16 */ +{ +{ UNUR_DISTR *d; +fpm[0] = 1.; +fpm[1] = 2.; +d = unur_distr_beta(fpm,2); +distr[0] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +fpm[0] = 3.; +fpm[1] = 4.; +d = unur_distr_beta(fpm,2); +distr[1] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +fpm[0] = 5.; +fpm[1] = 100.; +d = unur_distr_beta(fpm,2); +distr[2] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +d = unur_distr_cauchy(NULL,0); +distr[3] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +fpm[0] = 1.; +d = unur_distr_gamma( fpm,1 ); +distr[4] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +fpm[0] = 2.; +d = unur_distr_gamma( fpm,1 ); +distr[5] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +fpm[0] = 3.; +d = unur_distr_gamma( fpm,1 ); +distr[6] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +fpm[0] = 10.; +d = unur_distr_gamma( fpm,1 ); +distr[7] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +fpm[0] = 100.; +d = unur_distr_gamma( fpm,1 ); +distr[8] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +d = unur_distr_normal( NULL,0 ); +distr[9] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +fpm[0] = 1.; +fpm[1] = 0.01; +d = unur_distr_normal( fpm,2 ); +distr[10] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +fpm[0] = 0.; +fpm[1] = 100.; +d = unur_distr_normal( fpm,2 ); +distr[11] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +d = unur_distr_uniform(NULL,0); +distr[12] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +d = unur_distr_cauchy(NULL,0); +distr[13] = unur_distr_corder_new( d, 10, 8); +unur_distr_cont_set_domain(distr[13],0.1,1.); +unur_distr_cont_upd_pdfarea(distr[13]); +unur_distr_free(d); } +} + +{ +{UNUR_DISTR *d; +d = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(d,0.1,1.); +unur_distr_cont_upd_mode(d); +unur_distr_cont_upd_pdfarea(d); +distr[14] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } +} + +{ +{UNUR_DISTR *d; +d = unur_str2distr("cont; pdf=\"exp(-x)\"; cdf=\"1-exp(-x)\"; domain=(0,inf); mode=0; pdfarea=1;"); +distr[15] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 48 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_cpoints(par,50,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_cpoints(par,50,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_cpoints(par,50,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_cpoints(par,50,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_cpoints(par,50,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_cpoints(par,50,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_cpoints(par,50,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_cpoints(par,50,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_cpoints(par,50,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_cpoints(par,50,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_cpoints(par,50,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_cpoints(par,50,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_cpoints(par,50,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_cpoints(par,50,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_cpoints(par,50,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [15] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_cpoints(par,50,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_distr_corder_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_distr_corder.conf b/vendor/unuran-1.11.0/tests/t_distr_corder.conf new file mode 100644 index 0000000..74b3499 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_distr_corder.conf @@ -0,0 +1,389 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: DISTR_CORDER + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +unur_distr_corder_new( distr, 5, 2 ); + --> expected_NULL --> UNUR_ERR_NULL + + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +unur_distr_corder_new( distr, 5, 2 ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + + +[new - invalid order statistics: + UNUR_DISTR *os; + distr = unur_distr_normal(NULL,0); + os = unur_distr_corder_new( distr, 5, 2 ); ] + +unur_distr_corder_new( os, 5, 2 ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_free(os); + + +[new - invalid data: + distr = unur_distr_normal(NULL,0); ] + +unur_distr_corder_new( distr, 5, 6 ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_corder_new( distr, 1, 1 ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_corder_new( distr, 2, 0 ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + + +############################################################################# + +[set] + +[set - invalid NULL ptr: + distr = NULL; ] + +unur_distr_corder_set_rank( distr, 5, 2 ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_corder_set_pdfparams( distr, NULL, 0 ) + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_corder_set_domain( distr, 0., 1. ) + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_corder_set_mode( distr, 0. ) + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_corder_set_pdfarea( distr, 1. ) + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid distribution object: + distr = unur_distr_normal(NULL,0); ] + +unur_distr_corder_set_rank( distr, 5, 2 ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +[set - invalid distribution object: + distr = unur_distr_discr_new(); ] + +unur_distr_corder_set_pdfparams( distr, NULL, 0 ) + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_corder_set_domain( distr, 0., 1. ) + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_corder_set_mode( distr, 0. ) + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_corder_set_pdfarea( distr, 1. ) + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +[set - invalid NULL ptr: + UNUR_DISTR *os; + distr = unur_distr_normal(NULL,0); + os = unur_distr_corder_new( distr, 5, 2 ); ] + +unur_distr_corder_set_pdfparams( distr, NULL, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_free(os); + +[set - invalid parameters: + UNUR_DISTR *os; + distr = unur_distr_normal(NULL,0); + os = unur_distr_corder_new( distr, 5, 2 ); ] + +unur_distr_corder_set_rank( os, 5, 20 ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cont_set_pdfarea( distr, -1. ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_free(os); + + +############################################################################# + +[get] + +[get - invalid NULL ptr: + int n, k; + distr = NULL; ] + +unur_distr_corder_get_distribution( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_corder_get_rank( distr, &n, &k ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[get - invalid distribution type: + int n, k; + distr = unur_distr_discr_new(); ] + +unur_distr_corder_get_distribution( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_corder_get_rank( distr, &n, &k ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + + +[get - parameters not unknown: + int n, k; + distr = unur_distr_cont_new(); ] + +unur_distr_corder_get_distribution( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_corder_get_rank( distr, &n, &k ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + + +############################################################################# + +# [chg] + +############################################################################# + +# [init] + +############################################################################# + +# [reinit] + +############################################################################# + +[sample] + +[sample - compare clone: + UNUR_GEN *clone; + UNUR_DISTR *d; + d = unur_distr_cauchy(NULL,0); + distr = unur_distr_corder_new( d, 10, 8); + unur_distr_free(d); + par = unur_arou_new(distr); + unur_arou_set_max_sqhratio(par,0.); + gen = unur_init( par ); <-- ! NULL ] + +/* original generator object */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + UNUR_DISTR *os = NULL; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_normal(NULL,0); +unur_distr_cont_set_domain(distr,0.,UNUR_INFINITY); +os = unur_distr_corder_new(distr,10,7); +par = unur_arou_new(os); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +unur_distr_free(os); os = NULL; +gen = unur_str2gen("normal; domain=(0.,inf); orderstatistics=(10,7) & \ + method = arou"); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# TDR +par[0] = unur_tdr_new(@distr@); +unur_tdr_set_cpoints(par,50,NULL); + +# AROU +par[1] = unur_arou_new(@distr@); + +# NINV +par[4] = unur_ninv_new(@distr@); + +[validate - distributions:] + +# Beta distributions +{ UNUR_DISTR *d; +fpm[0] = 1.; +fpm[1] = 2.; +d = unur_distr_beta(fpm,2); +distr[0] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +fpm[0] = 3.; +fpm[1] = 4.; +d = unur_distr_beta(fpm,2); +distr[1] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +fpm[0] = 5.; +fpm[1] = 100.; +d = unur_distr_beta(fpm,2); +distr[2] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } + + +# Cauchy distributions +{ UNUR_DISTR *d; +d = unur_distr_cauchy(NULL,0); +distr[3] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } + + +# Gamma distributions +{ UNUR_DISTR *d; +fpm[0] = 1.; +d = unur_distr_gamma( fpm,1 ); +distr[4] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +fpm[0] = 2.; +d = unur_distr_gamma( fpm,1 ); +distr[5] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +fpm[0] = 3.; +d = unur_distr_gamma( fpm,1 ); +distr[6] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +fpm[0] = 10.; +d = unur_distr_gamma( fpm,1 ); +distr[7] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +fpm[0] = 100.; +d = unur_distr_gamma( fpm,1 ); +distr[8] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } + +# Normal distributions +{ UNUR_DISTR *d; +d = unur_distr_normal( NULL,0 ); +distr[9] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +fpm[0] = 1.; +fpm[1] = 0.01; +d = unur_distr_normal( fpm,2 ); +distr[10] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +fpm[0] = 0.; +fpm[1] = 100.; +d = unur_distr_normal( fpm,2 ); +distr[11] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } + +# Uniform distributions +{ UNUR_DISTR *d; +d = unur_distr_uniform(NULL,0); +distr[12] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } + +# truncated distributions +{ UNUR_DISTR *d; +d = unur_distr_cauchy(NULL,0); +distr[13] = unur_distr_corder_new( d, 10, 8); +unur_distr_cont_set_domain(distr[13],0.1,1.); +unur_distr_cont_upd_pdfarea(distr[13]); +unur_distr_free(d); } + +{UNUR_DISTR *d; +d = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(d,0.1,1.); +unur_distr_cont_upd_mode(d); +unur_distr_cont_upd_pdfarea(d); +distr[14] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } + +# function string +{UNUR_DISTR *d; +d = unur_str2distr("cont; pdf=\"exp(-x)\"; cdf=\"1-exp(-x)\"; domain=(0,inf); mode=0; pdfarea=1;"); +distr[15] = unur_distr_corder_new( d, 10, 8); +unur_distr_free(d); } + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] TDR +# [1] AROU +# [2] NINV +# +# [0] [1] [2] # distribution +#----------------------------------------------------- + <0> + + + # beta (1, 2) + <1> + + + # beta (3, 4) + <2> + + + # beta (5, 100) + <3> + + + # cauchy () + <4> + + + # gamma (1) + <5> + + + # gamma (2) + <6> + + + # gamma (3) + <7> + + + # gamma (10) +x <8> + + + # gamma (100) + <9> + + + # normal () + <10> + + + # normal (1, 0.01) + <11> + + + # normal (0, 100) + <12> + + + # uniform () + + <13> + + + # cauchy () - truncated + <14> + + + # cauchy () - truncated + + <15> + + + # exponential(1) (function string) + +############################################################################# +############################################################################# + +[verbatim] + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_distr_cvec.c b/vendor/unuran-1.11.0/tests/t_distr_cvec.c new file mode 100644 index 0000000..c022675 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_distr_cvec.c @@ -0,0 +1,1024 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for DISTR_CVEC + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_distr_cvec_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + +double mvpdf(const double *x, UNUR_DISTR *distr); +int mvdpdf(double *result, const double *x, UNUR_DISTR *distr); +double mvpdpdf(const double *x, int coord, UNUR_DISTR *distr); + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +double mvpdf(const double *x ATTRIBUTE__UNUSED, UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } +int mvdpdf(double *result ATTRIBUTE__UNUSED, const double *x ATTRIBUTE__UNUSED, UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1; } +double mvpdpdf(const double *x ATTRIBUTE__UNUSED, int coord ATTRIBUTE__UNUSED, UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid data */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,29,(unur_distr_cvec_new(0)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,29,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,40,(unur_distr_cvec_set_pdf( distr, mvpdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,40,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,43,(unur_distr_cvec_set_dpdf( distr, mvdpdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,43,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,46,(unur_distr_cvec_set_pdpdf( distr, mvpdpdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,46,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,49,(unur_distr_cvec_set_logpdf( distr, mvpdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,52,(unur_distr_cvec_set_dlogpdf( distr, mvdpdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,55,(unur_distr_cvec_set_pdlogpdf( distr, mvpdpdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,55,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,58,(unur_distr_cvec_set_mean( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,58,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,61,(unur_distr_cvec_set_covar( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,61,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,64,(unur_distr_cvec_set_covar_inv( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,64,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,67,(unur_distr_cvec_set_rankcorr( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,67,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,70,(unur_distr_cvec_set_mode( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,73,(unur_distr_cvec_set_center( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,73,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,76,(unur_distr_cvec_set_pdfparams( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_distr_cvec_set_pdfparams_vec( distr, 0, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,82,(unur_distr_cvec_set_pdfvol( distr, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,82,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,85,(unur_distr_cvec_set_marginals( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,85,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,88,(unur_distr_cvec_set_marginal_array( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,91,(unur_distr_cvec_set_domain_rect( distr, NULL, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + double fpm[2] = {1.,2.}; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,99,(unur_distr_cvec_set_pdf( distr, mvpdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,99,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,102,(unur_distr_cvec_set_dpdf( distr, mvdpdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,102,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,105,(unur_distr_cvec_set_pdpdf( distr, mvpdpdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,105,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,108,(unur_distr_cvec_set_logpdf( distr, mvpdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,108,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,111,(unur_distr_cvec_set_dlogpdf( distr, mvdpdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,111,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,114,(unur_distr_cvec_set_pdlogpdf( distr, mvpdpdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,114,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,117,(unur_distr_cvec_set_mean( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,117,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,120,(unur_distr_cvec_set_covar( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,120,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,123,(unur_distr_cvec_set_covar_inv( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,123,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,126,(unur_distr_cvec_set_rankcorr( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,126,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,129,(unur_distr_cvec_set_mode( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,129,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,132,(unur_distr_cvec_set_center( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,132,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,135,(unur_distr_cvec_set_pdfparams( distr, fpm, 2 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,135,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,138,(unur_distr_cvec_set_pdfparams_vec( distr, 0, fpm, 2 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,138,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,141,(unur_distr_cvec_set_pdfvol( distr, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,141,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,144,(unur_distr_cvec_set_marginals( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,144,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,147,(unur_distr_cvec_set_marginal_array( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,147,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,150,(unur_distr_cvec_set_domain_rect( distr, NULL, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,150,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cvec_new(2); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,157,(unur_distr_cvec_set_pdf( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,157,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,160,(unur_distr_cvec_set_dpdf( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,160,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,163,(unur_distr_cvec_set_pdpdf( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,163,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,166,(unur_distr_cvec_set_logpdf( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,166,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,169,(unur_distr_cvec_set_dlogpdf( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,169,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,172,(unur_distr_cvec_set_pdlogpdf( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,172,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,175,(unur_distr_cvec_set_pdfparams( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,175,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,178,(unur_distr_cvec_set_marginals( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,178,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,181,(unur_distr_cvec_set_marginal_array( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,181,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,184,(unur_distr_cvec_set_domain_rect( distr, NULL, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,184,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; + double fpm[2] = {1.,2.}; + double dpm[2] = {4., 0.5}; + double covar_invalid_negative[4] = {-1.,0.,0.,1.}; + double covar_invalid_nonsym[4] = {1.,0.5,0.,1.}; + double covar_invalid_nonpositive[4] = {0.5,1.,1.,0.5}; + double ll[] = { 0., 0. }; + double ru[] = { 0., 0. }; + UNUR_DISTR *marginal = unur_distr_binomial(dpm,2); + UNUR_DISTR *marginal_array[2]; + marginal_array[0] = marginal; + marginal_array[1] = marginal; + distr = unur_distr_cvec_new(2); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,202,(unur_distr_cvec_set_pdfvol( distr, -1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,202,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,205,(unur_distr_cvec_set_covar( distr, covar_invalid_negative )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,205,UNUR_ERR_DISTR_DOMAIN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,208,(unur_distr_cvec_set_covar_inv( distr, covar_invalid_negative )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,208,UNUR_ERR_DISTR_DOMAIN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,211,(unur_distr_cvec_set_covar( distr, covar_invalid_nonsym )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,211,UNUR_ERR_DISTR_DOMAIN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,214,(unur_distr_cvec_set_covar_inv( distr, covar_invalid_nonsym )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,214,UNUR_ERR_DISTR_DOMAIN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,217,(unur_distr_cvec_set_covar( distr, covar_invalid_nonpositive )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,217,UNUR_ERR_DISTR_DOMAIN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,220,(unur_distr_cvec_set_rankcorr( distr, covar_invalid_negative )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,220,UNUR_ERR_DISTR_DOMAIN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,223,(unur_distr_cvec_set_rankcorr( distr, covar_invalid_nonsym )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,223,UNUR_ERR_DISTR_DOMAIN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,226,(unur_distr_cvec_set_pdfparams( distr, fpm, -1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,226,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,229,(unur_distr_cvec_set_pdfparams_vec( distr, -1, fpm, 2 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,229,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,232,(unur_distr_cvec_set_pdfparams_vec( distr, 100000, fpm, 2 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,232,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,235,(unur_distr_cvec_set_marginals( distr, marginal )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,235,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,238,(unur_distr_cvec_set_marginal_array( distr, marginal_array )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,238,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,241,(unur_distr_cvec_set_domain_rect( distr, ll, ru )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,241,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(marginal); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,254,(unur_distr_cvec_get_pdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,254,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,257,(unur_distr_cvec_get_dpdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,257,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,260,(unur_distr_cvec_get_pdpdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,260,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,263,(unur_distr_cvec_get_logpdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,263,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,266,(unur_distr_cvec_get_dlogpdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,266,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,269,(unur_distr_cvec_get_pdlogpdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,269,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,272,(unur_distr_cvec_get_pdfvol( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,272,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,275,(unur_distr_cvec_get_mean( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,275,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,278,(unur_distr_cvec_get_covar( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,278,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,281,(unur_distr_cvec_get_covar_inv( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,281,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,284,(unur_distr_cvec_get_rankcorr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,284,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,287,(unur_distr_cvec_get_cholesky( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,287,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,290,(unur_distr_cvec_get_mode( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,290,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,293,(unur_distr_cvec_get_center( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,293,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,296,(unur_distr_cvec_get_pdfparams( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,296,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,299,(unur_distr_cvec_get_pdfparams_vec( distr, 0, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,299,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,302,(unur_distr_cvec_get_marginal( distr, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,302,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + const double *fpm; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,310,(unur_distr_cvec_get_pdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,310,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,313,(unur_distr_cvec_get_dpdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,313,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,316,(unur_distr_cvec_get_pdpdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,316,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,319,(unur_distr_cvec_get_logpdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,319,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,322,(unur_distr_cvec_get_dlogpdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,322,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,325,(unur_distr_cvec_get_pdlogpdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,325,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,328,(unur_distr_cvec_get_pdfvol( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,328,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,331,(unur_distr_cvec_get_mean( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,331,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,334,(unur_distr_cvec_get_covar( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,334,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,337,(unur_distr_cvec_get_covar_inv( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,337,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,340,(unur_distr_cvec_get_rankcorr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,340,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,343,(unur_distr_cvec_get_cholesky( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,343,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,346,(unur_distr_cvec_get_mode( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,346,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,349,(unur_distr_cvec_get_center( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,349,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,352,(unur_distr_cvec_get_pdfparams( distr, &fpm )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,352,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,355,(unur_distr_cvec_get_pdfparams_vec( distr, 0, &fpm )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,355,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,358,(unur_distr_cvec_get_marginal( distr, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,358,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* parameters not unknown */ +UNUR_DISTR *distr = NULL; + const double *fpm; + distr = unur_distr_cvec_new(2); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,366,(unur_distr_cvec_get_pdfvol( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,366,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,369,(unur_distr_cvec_get_mean( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,369,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,372,(unur_distr_cvec_get_covar( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,372,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,375,(unur_distr_cvec_get_covar_inv( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,375,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,378,(unur_distr_cvec_get_rankcorr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,378,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,381,(unur_distr_cvec_get_cholesky( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,381,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,384,(unur_distr_cvec_get_mode( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,384,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,387,(unur_distr_cvec_get_pdfparams_vec( distr, -1, &fpm )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,387,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,390,(unur_distr_cvec_get_pdfparams_vec( distr, 1000, &fpm )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,390,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,393,(unur_distr_cvec_get_marginal( distr, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,393,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; + double covar_invalid_noninv[4] = {1.,1.,1.,1.}; + UNUR_DISTR *marginal = unur_distr_normal(NULL,0); + distr = unur_distr_cvec_new(2); + unur_distr_cvec_set_marginals( distr, marginal ); + unur_distr_cvec_set_covar( distr, covar_invalid_noninv ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,404,(unur_distr_cvec_get_covar( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,404,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,407,(unur_distr_cvec_get_rankcorr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,407,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,410,(unur_distr_cvec_get_marginal( distr, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,410,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,413,(unur_distr_cvec_get_marginal( distr, 3 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,413,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; +unur_distr_free(marginal); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,425,(unur_distr_cvec_upd_mode( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,425,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,428,(unur_distr_cvec_upd_pdfvol( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,428,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,434,(unur_distr_cvec_upd_mode( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,434,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,437,(unur_distr_cvec_upd_pdfvol( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,437,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* missing data */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cvec_new(3); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,443,(unur_distr_cvec_upd_mode( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,443,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,446,(unur_distr_cvec_upd_pdfvol( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,446,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,465,(unur_distr_cvec_eval_pdf( NULL, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,465,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,468,(unur_distr_cvec_eval_dpdf( NULL, NULL, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,468,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,471,(unur_distr_cvec_eval_pdpdf( NULL, 1, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,471,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,474,(unur_distr_cvec_eval_logpdf( NULL, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,474,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,477,(unur_distr_cvec_eval_dlogpdf( NULL, NULL, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,477,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,480,(unur_distr_cvec_eval_pdlogpdf( NULL, 1, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,480,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,487,(unur_distr_cvec_eval_pdf( NULL, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,487,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,490,(unur_distr_cvec_eval_dpdf( NULL, NULL, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,490,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,493,(unur_distr_cvec_eval_pdpdf( NULL, 1, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,493,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,496,(unur_distr_cvec_eval_logpdf( NULL, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,496,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,499,(unur_distr_cvec_eval_dlogpdf( NULL, NULL, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,499,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,502,(unur_distr_cvec_eval_pdlogpdf( NULL, 1, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,502,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* missing data */ +UNUR_DISTR *distr = NULL; + double x[2], result[2]; + distr = unur_distr_cvec_new(2); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,510,(unur_distr_cvec_eval_pdf( x, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,510,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,513,(unur_distr_cvec_eval_dpdf( result, x, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,513,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,516,(unur_distr_cvec_eval_pdpdf( x, 1, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,516,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,519,(unur_distr_cvec_eval_logpdf( x, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,519,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,522,(unur_distr_cvec_eval_dlogpdf( result, x, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,522,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,525,(unur_distr_cvec_eval_pdlogpdf( x, 1, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,525,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* check for memory leaks */ +UNUR_DISTR *distr = NULL; + double x[] = { 1., 2., 3. }; + distr = unur_distr_cvec_new(3); + + +unur_reset_errno(); +unur_distr_cvec_set_pdfparams_vec( distr, 0, x, 3 ); +n_tests_failed += (check_errorcode(TESTLOG,533,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_distr_cvec_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_distr_cvec.conf b/vendor/unuran-1.11.0/tests/t_distr_cvec.conf new file mode 100644 index 0000000..63454d4 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_distr_cvec.conf @@ -0,0 +1,549 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: DISTR_CVEC + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +double mvpdf(const double *x, UNUR_DISTR *distr); +int mvdpdf(double *result, const double *x, UNUR_DISTR *distr); +double mvpdpdf(const double *x, int coord, UNUR_DISTR *distr); + +############################################################################# + +[new] + +[new - invalid data: + distr = NULL; ] + +unur_distr_cvec_new(0); + --> expected_NULL --> UNUR_ERR_DISTR_SET + + +############################################################################# + +[set] + +[set - invalid NULL ptr: + distr = NULL; ] + +~_pdf( distr, mvpdf ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_dpdf( distr, mvdpdf ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_pdpdf( distr, mvpdpdf ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_logpdf( distr, mvpdf ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_dlogpdf( distr, mvdpdf ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_pdlogpdf( distr, mvpdpdf ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_mean( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_covar( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_covar_inv( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_rankcorr( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_mode( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_center( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_pdfparams( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_pdfparams_vec( distr, 0, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_pdfvol( distr, 1. ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_marginals( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_marginal_array( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_domain_rect( distr, NULL, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid distribution type: + double fpm[2] = {1.,2.}; + distr = unur_distr_discr_new(); ] + +~_pdf( distr, mvpdf ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +~_dpdf( distr, mvdpdf ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +~_pdpdf( distr, mvpdpdf ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +~_logpdf( distr, mvpdf ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +~_dlogpdf( distr, mvdpdf ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +~_pdlogpdf( distr, mvpdpdf ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +~_mean( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +~_covar( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +~_covar_inv( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +~_rankcorr( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +~_mode( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +~_center( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +~_pdfparams( distr, fpm, 2 ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +~_pdfparams_vec( distr, 0, fpm, 2 ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +~_pdfvol( distr, 1. ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +~_marginals( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +~_marginal_array( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +~_domain_rect( distr, NULL, NULL ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + + +[set - invalid NULL ptr: + distr = unur_distr_cvec_new(2); ] + +~_pdf( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_dpdf( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_pdpdf( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_logpdf( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_dlogpdf( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_pdlogpdf( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_pdfparams( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_marginals( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_marginal_array( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_domain_rect( distr, NULL, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameters: + double fpm[2] = {1.,2.}; + double dpm[2] = {4., 0.5}; + double covar_invalid_negative[4] = {-1.,0.,0.,1.}; + double covar_invalid_nonsym[4] = {1.,0.5,0.,1.}; + double covar_invalid_nonpositive[4] = {0.5,1.,1.,0.5}; + double ll[] = { 0., 0. }; + double ru[] = { 0., 0. }; + UNUR_DISTR *marginal = unur_distr_binomial(dpm,2); + UNUR_DISTR *marginal_array[2]; + marginal_array[0] = marginal; + marginal_array[1] = marginal; + distr = unur_distr_cvec_new(2); ] + +~_pdfvol( distr, -1. ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +~_covar( distr, covar_invalid_negative ); + --> expected_setfailed --> UNUR_ERR_DISTR_DOMAIN + +~_covar_inv( distr, covar_invalid_negative ); + --> expected_setfailed --> UNUR_ERR_DISTR_DOMAIN + +~_covar( distr, covar_invalid_nonsym ); + --> expected_setfailed --> UNUR_ERR_DISTR_DOMAIN + +~_covar_inv( distr, covar_invalid_nonsym ); + --> expected_setfailed --> UNUR_ERR_DISTR_DOMAIN + +~_covar( distr, covar_invalid_nonpositive ); + --> expected_setfailed --> UNUR_ERR_DISTR_DOMAIN + +~_rankcorr( distr, covar_invalid_negative ); + --> expected_setfailed --> UNUR_ERR_DISTR_DOMAIN + +~_rankcorr( distr, covar_invalid_nonsym ); + --> expected_setfailed --> UNUR_ERR_DISTR_DOMAIN + +~_pdfparams( distr, fpm, -1 ); + --> expected_setfailed --> UNUR_ERR_DISTR_NPARAMS + +~_pdfparams_vec( distr, -1, fpm, 2 ); + --> expected_setfailed --> UNUR_ERR_DISTR_NPARAMS + +~_pdfparams_vec( distr, 100000, fpm, 2 ); + --> expected_setfailed --> UNUR_ERR_DISTR_NPARAMS + +~_marginals( distr, marginal ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +~_marginal_array( distr, marginal_array ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +~_domain_rect( distr, ll, ru ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + + +unur_distr_free(marginal); + +############################################################################# + +[get] + +[get - invalid NULL ptr: + distr = NULL; ] + +~_pdf( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +~_dpdf( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +~_pdpdf( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +~_logpdf( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +~_dlogpdf( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +~_pdlogpdf( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +~_pdfvol( distr ); + --> expected_INFINITY --> UNUR_ERR_NULL + +~_mean( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +~_covar( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +~_covar_inv( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +~_rankcorr( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +~_cholesky( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +~_mode( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +~_center( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +~_pdfparams( distr, NULL ); + --> expected_zero --> UNUR_ERR_NULL + +~_pdfparams_vec( distr, 0, NULL ); + --> expected_zero --> UNUR_ERR_NULL + +~_marginal( distr, 1 ); + --> expected_NULL --> UNUR_ERR_NULL + + +[get - invalid distribution type: + const double *fpm; + distr = unur_distr_discr_new(); ] + +unur_distr_cvec_get_pdf( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cvec_get_dpdf( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cvec_get_pdpdf( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cvec_get_logpdf( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cvec_get_dlogpdf( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cvec_get_pdlogpdf( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +~_pdfvol( distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID + +~_mean( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +~_covar( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +~_covar_inv( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +~_rankcorr( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +~_cholesky( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +~_mode( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +~_center( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +~_pdfparams( distr, &fpm ); + --> expected_zero --> UNUR_ERR_DISTR_INVALID + +~_pdfparams_vec( distr, 0, &fpm ); + --> expected_zero --> UNUR_ERR_DISTR_INVALID + +~_marginal( distr, 1 ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + + +[get - parameters not unknown: + const double *fpm; + distr = unur_distr_cvec_new(2); ] + +~_pdfvol( distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_GET + +~_mean( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_GET + +~_covar( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_GET + +~_covar_inv( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_GET + +~_rankcorr( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_GET + +~_cholesky( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_GET + +~_mode( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_GET + +~_pdfparams_vec( distr, -1, &fpm ); + --> expected_zero --> UNUR_ERR_DISTR_NPARAMS + +~_pdfparams_vec( distr, 1000, &fpm ); + --> expected_zero --> UNUR_ERR_DISTR_NPARAMS + +~_marginal( distr, 1 ); + --> expected_NULL --> UNUR_ERR_DISTR_GET + + +[get - invalid parameters: + double covar_invalid_noninv[4] = {1.,1.,1.,1.}; + UNUR_DISTR *marginal = unur_distr_normal(NULL,0); + distr = unur_distr_cvec_new(2); + unur_distr_cvec_set_marginals( distr, marginal ); + unur_distr_cvec_set_covar( distr, covar_invalid_noninv ); ] + +~_covar( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_GET + +~_rankcorr( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_GET + +~_marginal( distr, 0 ); + --> expected_NULL --> UNUR_ERR_DISTR_GET + +~_marginal( distr, 3 ); + --> expected_NULL --> UNUR_ERR_DISTR_GET + +unur_distr_free(marginal); + +############################################################################# + +[chg] + +[chg - invalid NULL ptr: + distr = NULL; ] + +unur_distr_cvec_upd_mode( distr ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cvec_upd_pdfvol( distr ); + --> expected_setfailed --> UNUR_ERR_NULL + +[chg - invalid distribution type: + distr = unur_distr_cont_new(); ] + +unur_distr_cvec_upd_mode( distr ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cvec_upd_pdfvol( distr ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +[chg - missing data: + distr = unur_distr_cvec_new(3); ] + +unur_distr_cvec_upd_mode( distr ); + --> expected_setfailed --> UNUR_ERR_DISTR_DATA + +unur_distr_cvec_upd_pdfvol( distr ); + --> expected_setfailed --> UNUR_ERR_DISTR_DATA + + +############################################################################## + +# [init] + +############################################################################# + +# [reinit] + +############################################################################# + +[sample] + +[sample - invalid NULL ptr: + distr = NULL; ] + +unur_distr_cvec_eval_pdf( NULL, distr ); + --> expected_INFINITY --> UNUR_ERR_NULL + +unur_distr_cvec_eval_dpdf( NULL, NULL, distr ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cvec_eval_pdpdf( NULL, 1, distr ); + --> expected_INFINITY --> UNUR_ERR_NULL + +unur_distr_cvec_eval_logpdf( NULL, distr ); + --> expected_INFINITY --> UNUR_ERR_NULL + +unur_distr_cvec_eval_dlogpdf( NULL, NULL, distr ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cvec_eval_pdlogpdf( NULL, 1, distr ); + --> expected_INFINITY --> UNUR_ERR_NULL + + +[sample - invalid distribution object: + distr = unur_distr_discr_new(); ] + +unur_distr_cvec_eval_pdf( NULL, distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID + +unur_distr_cvec_eval_dpdf( NULL, NULL, distr ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cvec_eval_pdpdf( NULL, 1, distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID + +unur_distr_cvec_eval_logpdf( NULL, distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID + +unur_distr_cvec_eval_dlogpdf( NULL, NULL, distr ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cvec_eval_pdlogpdf( NULL, 1, distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID + + +[sample - missing data: + double x[2], result[2]; + distr = unur_distr_cvec_new(2); ] + +unur_distr_cvec_eval_pdf( x, distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_DATA + +unur_distr_cvec_eval_dpdf( result, x, distr ); + --> expected_setfailed --> UNUR_ERR_DISTR_DATA + +unur_distr_cvec_eval_pdpdf( x, 1, distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_DATA + +unur_distr_cvec_eval_logpdf( x, distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_DATA + +unur_distr_cvec_eval_dlogpdf( result, x, distr ); + --> expected_setfailed --> UNUR_ERR_DISTR_DATA + +unur_distr_cvec_eval_pdlogpdf( x, 1, distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_DATA + + +[sample - check for memory leaks: + double x[] = { 1., 2., 3. }; + distr = unur_distr_cvec_new(3); ] + +unur_distr_cvec_set_pdfparams_vec( distr, 0, x, 3 ); + --> none --> UNUR_SUCCESS + + +############################################################################# + +# [validate] + +############################################################################# +############################################################################# + +[verbatim] + +double mvpdf(const double *x ATTRIBUTE__UNUSED, UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } +int mvdpdf(double *result ATTRIBUTE__UNUSED, const double *x ATTRIBUTE__UNUSED, UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1; } +double mvpdpdf(const double *x ATTRIBUTE__UNUSED, int coord ATTRIBUTE__UNUSED, UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_distr_cvemp.c b/vendor/unuran-1.11.0/tests/t_distr_cvemp.c new file mode 100644 index 0000000..3986026 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_distr_cvemp.c @@ -0,0 +1,382 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for DISTR_CVEMP + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_distr_cvemp_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid data */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,25,(unur_distr_cvemp_new(1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,25,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,36,(unur_distr_cvemp_set_data( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,36,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,39,(unur_distr_cvemp_read_data( distr, "junk" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,39,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,46,(unur_distr_cvemp_set_data( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,46,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,49,(unur_distr_cvemp_read_data( distr, "junk" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cvemp_new(2); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,56,(unur_distr_cvemp_set_data( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,56,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; + double data[] = {1.,2.,3.,4.}; + distr = unur_distr_cvemp_new(2); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,64,(unur_distr_cvemp_set_data( distr, data, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,64,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,67,(unur_distr_cvemp_read_data( distr, "there-should-be-no-such-file.junk" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,67,UNUR_ERR_GENERIC)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + const double *sample; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,79,(unur_distr_cvemp_get_data( distr, &sample )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + const double *sample; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,87,(unur_distr_cvemp_get_data( distr, &sample )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,87,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_distr_cvemp_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_distr_cvemp.conf b/vendor/unuran-1.11.0/tests/t_distr_cvemp.conf new file mode 100644 index 0000000..72eb2fd --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_distr_cvemp.conf @@ -0,0 +1,115 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: DISTR_CVEMP + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +[new - invalid data: + distr = NULL; ] + +unur_distr_cvemp_new(1); + --> expected_NULL --> UNUR_ERR_DISTR_SET + + +############################################################################# + +[set] + +[set - invalid NULL ptr: + distr = NULL; ] + +unur_distr_cvemp_set_data( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cvemp_read_data( distr, "junk" ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid distribution type: + distr = unur_distr_discr_new(); ] + +unur_distr_cvemp_set_data( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cvemp_read_data( distr, "junk" ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + + +[set - invalid NULL ptr: + distr = unur_distr_cvemp_new(2); ] + +unur_distr_cvemp_set_data( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameters: + double data[] = {1.,2.,3.,4.}; + distr = unur_distr_cvemp_new(2); ] + +unur_distr_cvemp_set_data( distr, data, 0 ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cvemp_read_data( distr, "there-should-be-no-such-file.junk" ); + --> expected_setfailed --> UNUR_ERR_GENERIC + + +############################################################################# + +[get] + +[get - invalid NULL ptr: + const double *sample; + distr = NULL; ] + +unur_distr_cvemp_get_data( distr, &sample ) + --> expected_zero --> UNUR_ERR_NULL + + +[get - invalid distribution type: + const double *sample; + distr = unur_distr_discr_new(); ] + +unur_distr_cvemp_get_data( distr, &sample ) + --> expected_zero --> UNUR_ERR_DISTR_INVALID + + +############################################################################# + +# [chg] + +############################################################################## + +# [init] + +############################################################################# + +# [reinit] + +############################################################################# + +# [sample] + +############################################################################# + +# [validate] + +############################################################################# +############################################################################# + +[verbatim] + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_distr_cxtrans.c b/vendor/unuran-1.11.0/tests/t_distr_cxtrans.c new file mode 100644 index 0000000..d379e8d --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_distr_cxtrans.c @@ -0,0 +1,1605 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for DISTR_CXTRANS + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_distr_cxtrans_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,25,(unur_distr_cxtrans_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,25,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,32,(unur_distr_cxtrans_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,32,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,43,(unur_distr_cxtrans_set_alpha( distr, 5. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,43,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,46,(unur_distr_cxtrans_set_rescale( distr, 1., 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,46,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,49,(unur_distr_cxtrans_set_domain( distr, 0., 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,52,(unur_distr_cxtrans_set_mode( distr, 0. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,55,(unur_distr_cxtrans_set_logpdfpole( distr, 0., 0. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,55,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,62,(unur_distr_cxtrans_set_alpha( distr, 5. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,65,(unur_distr_cxtrans_set_rescale( distr, 1., 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_distr_cxtrans_set_domain( distr, 0., 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,71,(unur_distr_cxtrans_set_logpdfpole( distr, 0., 0. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,71,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_normal(NULL,0); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,78,(unur_distr_cxtrans_set_alpha( distr, 5. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,78,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,81,(unur_distr_cxtrans_set_rescale( distr, 1., 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,81,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,84,(unur_distr_cxtrans_set_domain( distr, 0., 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,84,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,87,(unur_distr_cxtrans_set_logpdfpole( distr, 0., 0. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,87,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; + UNUR_DISTR *cxt; + distr = unur_distr_normal(NULL,0); + cxt = unur_distr_cxtrans_new( distr ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,96,(unur_distr_cxtrans_set_alpha( cxt, -5. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,96,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,99,(unur_distr_cxtrans_set_rescale( cxt, 1., -1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,99,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,102,(unur_distr_cxtrans_set_alpha( cxt, 0. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,102,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_distr_cxtrans_set_alpha( cxt, UNUR_INFINITY ); +n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_distr_cxtrans_set_domain( cxt, -1., 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(cxt); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,119,(unur_distr_cxtrans_get_distribution( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,119,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_negINFINITY(TESTLOG,122,(unur_distr_cxtrans_get_alpha( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,122,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_negINFINITY(TESTLOG,125,(unur_distr_cxtrans_get_mu( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,125,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_negINFINITY(TESTLOG,128,(unur_distr_cxtrans_get_sigma( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,128,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,135,(unur_distr_cxtrans_get_distribution( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,135,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_negINFINITY(TESTLOG,138,(unur_distr_cxtrans_get_alpha( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,138,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_negINFINITY(TESTLOG,141,(unur_distr_cxtrans_get_mu( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,141,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_negINFINITY(TESTLOG,144,(unur_distr_cxtrans_get_sigma( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,144,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution id */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,151,(unur_distr_cxtrans_get_distribution( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,151,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_negINFINITY(TESTLOG,154,(unur_distr_cxtrans_get_alpha( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,154,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_negINFINITY(TESTLOG,157,(unur_distr_cxtrans_get_mu( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,157,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_negINFINITY(TESTLOG,160,(unur_distr_cxtrans_get_sigma( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,160,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + UNUR_DISTR *d; + d = unur_distr_cauchy(NULL,0); + unur_distr_cont_set_domain(d,0.,UNUR_INFINITY); + distr = unur_distr_cxtrans_new( d ); + unur_distr_cxtrans_set_alpha(distr, 0.5 ); + unur_distr_free(d); + par = unur_arou_new(distr); + unur_arou_set_max_sqhratio(par,0.); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 188, gen ); + + +unur_reset_errno(); +/* original generator object */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,192,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,198,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[14]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 14 */ +{ +{ UNUR_DISTR *d; +d = unur_distr_exponential( NULL, 0 ); +distr[0] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[0], UNUR_INFINITY ); +unur_distr_cxtrans_set_mode(distr[0],1.); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +d = unur_distr_exponential( NULL, 0 ); +distr[1] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[1], 2.); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +d = unur_distr_exponential( NULL, 0 ); +distr[2] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[2], 1.); +unur_distr_cxtrans_set_mode(distr[2],0.); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +d = unur_distr_exponential( NULL, 0 ); +distr[3] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[3], 0.5); +unur_distr_cxtrans_set_mode(distr[3],0.7071067811865475); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +d = unur_distr_exponential( NULL, 0 ); +distr[4] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[4], 0.1); +unur_distr_cxtrans_set_mode(distr[4],0.9895192582062144); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +d = unur_distr_exponential( NULL, 0 ); +distr[5] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[5], 0.001); +unur_distr_cxtrans_set_mode(distr[5],0.9999989995001669); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +d = unur_distr_exponential( NULL, 0 ); +distr[6] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[6], 0.); +unur_distr_cxtrans_set_mode(distr[6],0.); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +d = unur_distr_exponential_wo_logpdf( NULL, 0 ); +distr[7] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[7], UNUR_INFINITY ); +unur_distr_cxtrans_set_mode(distr[7],1.); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +d = unur_distr_exponential_wo_logpdf( NULL, 0 ); +distr[8] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[8], 2.); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +d = unur_distr_exponential_wo_logpdf( NULL, 0 ); +distr[9] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[9], 1.); +unur_distr_cxtrans_set_mode(distr[9],0.); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +d = unur_distr_exponential_wo_logpdf( NULL, 0 ); +distr[10] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[10], 0.5); +unur_distr_cxtrans_set_mode(distr[10],0.7071067811865475); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +d = unur_distr_exponential_wo_logpdf( NULL, 0 ); +distr[11] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[11], 0.1); +unur_distr_cxtrans_set_mode(distr[11],0.9895192582062144); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +d = unur_distr_exponential_wo_logpdf( NULL, 0 ); +distr[12] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[12], 0.001); +unur_distr_cxtrans_set_mode(distr[12],0.9999989995001669); +unur_distr_free(d); } +} + +{ +{ UNUR_DISTR *d; +d = unur_distr_exponential_wo_logpdf( NULL, 0 ); +distr[13] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[13], 0.); +unur_distr_cxtrans_set_mode(distr[13],0.); +unur_distr_free(d); } +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 70 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_arou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ninv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_distr_cxtrans_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_distr_cxtrans.conf b/vendor/unuran-1.11.0/tests/t_distr_cxtrans.conf new file mode 100644 index 0000000..c738d2e --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_distr_cxtrans.conf @@ -0,0 +1,375 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: DISTR_CXTRANS + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +unur_distr_cxtrans_new( distr ); + --> expected_NULL --> UNUR_ERR_NULL + + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +unur_distr_cxtrans_new( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + + +############################################################################# + +[set] + +[set - invalid NULL ptr: + distr = NULL; ] + +unur_distr_cxtrans_set_alpha( distr, 5. ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cxtrans_set_rescale( distr, 1., 1. ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cxtrans_set_domain( distr, 0., 1. ) + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cxtrans_set_mode( distr, 0. ) + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_cxtrans_set_logpdfpole( distr, 0., 0. ) + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid distribution object: + distr = unur_distr_discr_new(); ] + +unur_distr_cxtrans_set_alpha( distr, 5. ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cxtrans_set_rescale( distr, 1., 1. ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cxtrans_set_domain( distr, 0., 1. ) + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cxtrans_set_logpdfpole( distr, 0., 0. ) + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + + +[set - invalid distribution object: + distr = unur_distr_normal(NULL,0); ] + +unur_distr_cxtrans_set_alpha( distr, 5. ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cxtrans_set_rescale( distr, 1., 1. ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cxtrans_set_domain( distr, 0., 1. ) + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_cxtrans_set_logpdfpole( distr, 0., 0. ) + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + + +[set - invalid parameters: + UNUR_DISTR *cxt; + distr = unur_distr_normal(NULL,0); + cxt = unur_distr_cxtrans_new( distr ); ] + +unur_distr_cxtrans_set_alpha( cxt, -5. ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cxtrans_set_rescale( cxt, 1., -1. ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cxtrans_set_alpha( cxt, 0. ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_cxtrans_set_alpha( cxt, UNUR_INFINITY ); +unur_distr_cxtrans_set_domain( cxt, -1., 1. ) + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_free(cxt); + + +############################################################################# + +[get] + +[get - invalid NULL ptr: + distr = NULL; ] + +unur_distr_cxtrans_get_distribution( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_cxtrans_get_alpha( distr ); + --> expected_negINFINITY --> UNUR_ERR_NULL + +unur_distr_cxtrans_get_mu( distr ); + --> expected_negINFINITY --> UNUR_ERR_NULL + +unur_distr_cxtrans_get_sigma( distr ); + --> expected_negINFINITY --> UNUR_ERR_NULL + + +[get - invalid distribution type: + distr = unur_distr_discr_new(); ] + +unur_distr_cxtrans_get_distribution( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cxtrans_get_alpha( distr ); + --> expected_negINFINITY --> UNUR_ERR_DISTR_INVALID + +unur_distr_cxtrans_get_mu( distr ); + --> expected_negINFINITY --> UNUR_ERR_DISTR_INVALID + +unur_distr_cxtrans_get_sigma( distr ); + --> expected_negINFINITY --> UNUR_ERR_DISTR_INVALID + + +[get - invalid distribution id: + distr = unur_distr_cont_new(); ] + +unur_distr_cxtrans_get_distribution( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_cxtrans_get_alpha( distr ); + --> expected_negINFINITY --> UNUR_ERR_DISTR_INVALID + +unur_distr_cxtrans_get_mu( distr ); + --> expected_negINFINITY --> UNUR_ERR_DISTR_INVALID + +unur_distr_cxtrans_get_sigma( distr ); + --> expected_negINFINITY --> UNUR_ERR_DISTR_INVALID + + +############################################################################# + +# [chg] + +############################################################################# + +# [init] + +############################################################################# + +# [reinit] + +############################################################################# + +[sample] + +[sample - compare clone: + UNUR_GEN *clone; + UNUR_DISTR *d; + d = unur_distr_cauchy(NULL,0); + unur_distr_cont_set_domain(d,0.,UNUR_INFINITY); + distr = unur_distr_cxtrans_new( d ); + unur_distr_cxtrans_set_alpha(distr, 0.5 ); + unur_distr_free(d); + par = unur_arou_new(distr); + unur_arou_set_max_sqhratio(par,0.); + gen = unur_init( par ); <-- ! NULL ] + +/* original generator object */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +#[sample - compare stringparser: ] + + +############################################################################# + +[validate] + +[validate - generators:] + +# TDR +par[0] = unur_tdr_new(@distr@); + +# AROU +par[1] = unur_arou_new(@distr@); + +# SROU +par[2] = unur_srou_new(@distr@); + +# HINV +par[3] = unur_ninv_new(@distr@); + +# TABL +par[4] = unur_tabl_new(@distr@); + +[validate - distributions:] + +# Exponential distribution with logPDF +{ UNUR_DISTR *d; +d = unur_distr_exponential( NULL, 0 ); +distr[0] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[0], UNUR_INFINITY ); +unur_distr_cxtrans_set_mode(distr[0],1.); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +d = unur_distr_exponential( NULL, 0 ); +distr[1] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[1], 2.); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +d = unur_distr_exponential( NULL, 0 ); +distr[2] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[2], 1.); +unur_distr_cxtrans_set_mode(distr[2],0.); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +d = unur_distr_exponential( NULL, 0 ); +distr[3] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[3], 0.5); +unur_distr_cxtrans_set_mode(distr[3],0.7071067811865475); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +d = unur_distr_exponential( NULL, 0 ); +distr[4] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[4], 0.1); +unur_distr_cxtrans_set_mode(distr[4],0.9895192582062144); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +d = unur_distr_exponential( NULL, 0 ); +distr[5] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[5], 0.001); +unur_distr_cxtrans_set_mode(distr[5],0.9999989995001669); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +d = unur_distr_exponential( NULL, 0 ); +distr[6] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[6], 0.); +unur_distr_cxtrans_set_mode(distr[6],0.); +unur_distr_free(d); } + + +# Exponential distribution without logPDF +{ UNUR_DISTR *d; +d = unur_distr_exponential_wo_logpdf( NULL, 0 ); +distr[7] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[7], UNUR_INFINITY ); +unur_distr_cxtrans_set_mode(distr[7],1.); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +d = unur_distr_exponential_wo_logpdf( NULL, 0 ); +distr[8] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[8], 2.); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +d = unur_distr_exponential_wo_logpdf( NULL, 0 ); +distr[9] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[9], 1.); +unur_distr_cxtrans_set_mode(distr[9],0.); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +d = unur_distr_exponential_wo_logpdf( NULL, 0 ); +distr[10] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[10], 0.5); +unur_distr_cxtrans_set_mode(distr[10],0.7071067811865475); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +d = unur_distr_exponential_wo_logpdf( NULL, 0 ); +distr[11] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[11], 0.1); +unur_distr_cxtrans_set_mode(distr[11],0.9895192582062144); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +d = unur_distr_exponential_wo_logpdf( NULL, 0 ); +distr[12] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[12], 0.001); +unur_distr_cxtrans_set_mode(distr[12],0.9999989995001669); +unur_distr_free(d); } + +{ UNUR_DISTR *d; +d = unur_distr_exponential_wo_logpdf( NULL, 0 ); +distr[13] = unur_distr_cxtrans_new( d ); +unur_distr_cxtrans_set_alpha(distr[13], 0.); +unur_distr_cxtrans_set_mode(distr[13],0.); +unur_distr_free(d); } + + + +# Gamma distributions +#{ UNUR_DISTR *d; +#fpm[0] = 1.; +#d = unur_distr_gamma( fpm,1 ); +#distr[4] = unur_distr_cxtrans_new( d, 10, 8); +#unur_distr_free(d); } + + +[validate - test chi2:] +# +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] TDR +# [1] AROU +# [2] SROU +# [3] HINV +# [4] TABL +# +# [0] [1] [2] [3] [4] # distribution +#----------------------------------------------------- +x <0> + + + + + # exponential (1), alpha=inf (exp) +x <1> . . . + . # exponential (1), alpha=2 + <2> + x+ + + + # exponential (1), alpha=1 +x <3> + + + + + # exponential (1), alpha=0.5 +x <4> + + + + + # exponential (1), alpha=0.1 +x <5> + . + + + # exponential (1), alpha=0.001 +x <6> . . + + + # exponential (1), alpha=0 (log) +x <7> + + + + + # exponential_wo_logpdf (1), alpha=inf (exp) +x <8> . . . + . # exponential_wo_logpdf (1), alpha=2 +x <9> + + + + + # exponential_wo_logpdf (1), alpha=1 +x<10> + + + + + # exponential_wo_logpdf (1), alpha=0.5 +x<11> + + + + + # exponential_wo_logpdf (1), alpha=0.1 +x<12> + . + + + # exponential_wo_logpdf (1), alpha=0.001 +x<13> . . + + + # exponential_wo_logpdf (1), alpha=0 (log) + + +############################################################################# +############################################################################# + +[verbatim] + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_distr_discr.c b/vendor/unuran-1.11.0/tests/t_distr_discr.c new file mode 100644 index 0000000..d4fd5c4 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_distr_discr.c @@ -0,0 +1,741 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for DISTR_DISCR + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_distr_discr_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +#include + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + +double pmf(int k, const UNUR_DISTR *distr); +double icdf(int k, const UNUR_DISTR *distr); +int invcdf(double x, const UNUR_DISTR *distr); + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +double pmf(int k ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } +double icdf(int k ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } +int invcdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1; } + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,36,(unur_distr_discr_set_pv( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,36,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,39,(unur_distr_discr_set_pmf( distr, pmf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,39,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,42,(unur_distr_discr_set_cdf( distr, icdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,45,(unur_distr_discr_set_invcdf( distr, invcdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,48,(unur_distr_discr_set_pmfstr( distr, "pmf" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,48,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,51,(unur_distr_discr_set_cdfstr( distr, "cdf" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,51,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,54,(unur_distr_discr_set_pmfparams( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,54,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,57,(unur_distr_discr_set_domain( distr, 0, 10 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,57,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,60,(unur_distr_discr_set_mode( distr, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,63,(unur_distr_discr_set_pmfsum( distr, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,70,(unur_distr_discr_set_pv( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,73,(unur_distr_discr_set_pmf( distr, pmf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,73,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,76,(unur_distr_discr_set_cdf( distr, icdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_distr_discr_set_invcdf( distr, invcdf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,82,(unur_distr_discr_set_pmfstr( distr, "exp(-k)" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,82,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,85,(unur_distr_discr_set_cdfstr( distr, "exp(-k)" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,85,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,88,(unur_distr_discr_set_pmfparams( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,91,(unur_distr_discr_set_domain( distr, 0, 10 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,94,(unur_distr_discr_set_mode( distr, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,97,(unur_distr_discr_set_pmfsum( distr, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,97,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,104,(unur_distr_discr_set_pmf( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,104,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,107,(unur_distr_discr_set_cdf( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,107,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,110,(unur_distr_discr_set_invcdf( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,110,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,113,(unur_distr_discr_set_pmfstr( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,113,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,116,(unur_distr_discr_set_cdfstr( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,116,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,119,(unur_distr_discr_set_pmfparams( distr, NULL, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,119,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; + double pv[] = {1.,2.,3.}; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,127,(unur_distr_discr_set_pmfstr( distr, "" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,127,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,130,(unur_distr_discr_set_pmfstr( distr, "beta(2.)" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,130,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,133,(unur_distr_discr_set_cdfstr( distr, "" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,133,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,136,(unur_distr_discr_set_cdfstr( distr, "beta(2.)" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,136,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,139,(unur_distr_discr_set_pmfparams( distr, pv, -1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,139,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,142,(unur_distr_discr_set_pmfparams( distr, pv, UNUR_DISTR_MAXPARAMS +1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,142,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,145,(unur_distr_discr_set_domain( distr, 10, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,145,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,148,(unur_distr_discr_set_pmfsum( distr, -1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,148,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,159,(unur_distr_discr_get_pv( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,159,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,162,(unur_distr_discr_get_pmf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,162,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,165,(unur_distr_discr_get_cdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,165,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,168,(unur_distr_discr_get_invcdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,168,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,171,(unur_distr_discr_get_pmfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,171,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,174,(unur_distr_discr_get_cdfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,174,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,177,(unur_distr_discr_get_pmfparams( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,177,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,180,(unur_distr_discr_get_pmfsum( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,180,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,183,(unur_distr_discr_make_pv( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,183,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + int ia, ib; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,191,(unur_distr_discr_get_pmf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,191,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,194,(unur_distr_discr_get_cdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,194,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,197,(unur_distr_discr_get_invcdf( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,197,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,200,(unur_distr_discr_get_pmfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,200,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,203,(unur_distr_discr_get_cdfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,203,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,206,(unur_distr_discr_get_pv( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,206,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,209,(unur_distr_discr_get_domain( distr, &ia, &ib )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,209,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,212,(unur_distr_discr_get_pmfparams( distr, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,212,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,215,(unur_distr_discr_get_pmfsum( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,215,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,218,(unur_distr_discr_make_pv( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,218,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* parameters not unknown */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,225,(unur_distr_discr_get_pmfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,225,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,228,(unur_distr_discr_get_cdfstr( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,228,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,231,(unur_distr_discr_get_pmfsum( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,231,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INTMAX(TESTLOG,234,(unur_distr_discr_get_mode( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,234,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,237,(unur_distr_discr_make_pv( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,237,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,248,(unur_distr_discr_upd_mode( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,248,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,251,(unur_distr_discr_upd_pmfsum( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,251,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,258,(unur_distr_discr_upd_mode( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,258,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,261,(unur_distr_discr_upd_pmfsum( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,261,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* missing data */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,268,(unur_distr_discr_upd_mode( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,268,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,271,(unur_distr_discr_upd_pmfsum( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,271,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,290,(unur_distr_discr_eval_pmf( 1, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,290,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,293,(unur_distr_discr_eval_cdf( 1, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,293,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INTMAX(TESTLOG,296,(unur_distr_discr_eval_invcdf( 0.5, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,296,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,304,(unur_distr_discr_eval_pmf( 1, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,304,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,307,(unur_distr_discr_eval_cdf( 1, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,307,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INTMAX(TESTLOG,310,(unur_distr_discr_eval_invcdf( 0.5, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,310,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* missing data */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,318,(unur_distr_discr_eval_pmf( 1, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,318,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,321,(unur_distr_discr_eval_cdf( 1, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,321,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INTMAX(TESTLOG,324,(unur_distr_discr_eval_invcdf( 0.5, distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,324,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_distr_discr_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_distr_discr.conf b/vendor/unuran-1.11.0/tests/t_distr_discr.conf new file mode 100644 index 0000000..aed4edc --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_distr_discr.conf @@ -0,0 +1,340 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: DISTR_DISCR + +[main - header:] + +## we need UNUR_DISTR_MAXPARAMS for a test: +\#include + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +double pmf(int k, const UNUR_DISTR *distr); +double icdf(int k, const UNUR_DISTR *distr); +int invcdf(double x, const UNUR_DISTR *distr); + +############################################################################# + +[new] + +############################################################################# + +[set] + +[set - invalid NULL ptr: + distr = NULL; ] + +unur_distr_discr_set_pv( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_discr_set_pmf( distr, pmf ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_discr_set_cdf( distr, icdf ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_discr_set_invcdf( distr, invcdf ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_discr_set_pmfstr( distr, "pmf" ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_discr_set_cdfstr( distr, "cdf" ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_discr_set_pmfparams( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_discr_set_domain( distr, 0, 10 ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_discr_set_mode( distr, 0 ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_discr_set_pmfsum( distr, 1. ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid distribution type: + distr = unur_distr_cont_new(); ] + +unur_distr_discr_set_pv( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_set_pmf( distr, pmf ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_set_cdf( distr, icdf ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_set_invcdf( distr, invcdf ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_set_pmfstr( distr, "exp(-k)" ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_set_cdfstr( distr, "exp(-k)" ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_set_pmfparams( distr, NULL, 0 ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_set_domain( distr, 0, 10 ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_set_mode( distr, 0 ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_set_pmfsum( distr, 1. ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + + +[set - invalid NULL ptr: + distr = unur_distr_discr_new(); ] + +unur_distr_discr_set_pmf( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_discr_set_cdf( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_discr_set_invcdf( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_discr_set_pmfstr( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_discr_set_cdfstr( distr, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_discr_set_pmfparams( distr, NULL, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameters: + double pv[] = {1.,2.,3.}; + distr = unur_distr_discr_new(); ] + +unur_distr_discr_set_pmfstr( distr, "" ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_discr_set_pmfstr( distr, "beta(2.)" ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_discr_set_cdfstr( distr, "" ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_discr_set_cdfstr( distr, "beta(2.)" ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_discr_set_pmfparams( distr, pv, -1 ); + --> expected_setfailed --> UNUR_ERR_DISTR_NPARAMS + +unur_distr_discr_set_pmfparams( distr, pv, UNUR_DISTR_MAXPARAMS +1 ); + --> expected_setfailed --> UNUR_ERR_DISTR_NPARAMS + +unur_distr_discr_set_domain( distr, 10, 1 ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +unur_distr_discr_set_pmfsum( distr, -1. ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + + +############################################################################# + +[get] + +[get - invalid NULL ptr: + distr = NULL; ] + +unur_distr_discr_get_pv( distr, NULL ); + --> expected_zero --> UNUR_ERR_NULL + +unur_distr_discr_get_pmf( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_discr_get_cdf( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_discr_get_invcdf( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_discr_get_pmfstr( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_discr_get_cdfstr( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_discr_get_pmfparams( distr, NULL ); + --> expected_zero --> UNUR_ERR_NULL + +unur_distr_discr_get_pmfsum( distr ); + --> expected_INFINITY --> UNUR_ERR_NULL + +unur_distr_discr_make_pv( distr ); + --> expected_zero --> UNUR_ERR_NULL + + +[get - invalid distribution type: + int ia, ib; + distr = unur_distr_cont_new(); ] + +unur_distr_discr_get_pmf( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_get_cdf( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_get_invcdf( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_get_pmfstr( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_get_cdfstr( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_get_pv( distr, NULL ); + --> expected_zero --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_get_domain( distr, &ia, &ib ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_get_pmfparams( distr, NULL ); + --> expected_zero --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_get_pmfsum( distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_make_pv( distr ); + --> expected_zero --> UNUR_ERR_DISTR_INVALID + + +[get - parameters not unknown: + distr = unur_distr_discr_new(); ] + +unur_distr_discr_get_pmfstr( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_discr_get_cdfstr( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +unur_distr_discr_get_pmfsum( distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_GET + +unur_distr_discr_get_mode( distr ); + --> expected_INTMAX --> UNUR_ERR_DISTR_GET + +unur_distr_discr_make_pv( distr ); + --> expected_zero --> UNUR_ERR_DISTR_GET + + +############################################################################# + +[chg] + +[chg - invalid NULL ptr: + distr = NULL; ] + +unur_distr_discr_upd_mode( distr ); + --> expected_setfailed --> UNUR_ERR_NULL + +unur_distr_discr_upd_pmfsum( distr ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[chg - invalid distribution type: + distr = unur_distr_cont_new(); ] + +unur_distr_discr_upd_mode( distr ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_upd_pmfsum( distr ); + --> expected_setfailed --> UNUR_ERR_DISTR_INVALID + + +[chg - missing data: + distr = unur_distr_discr_new(); ] + +unur_distr_discr_upd_mode( distr ); + --> expected_setfailed --> UNUR_ERR_DISTR_DATA + +unur_distr_discr_upd_pmfsum( distr ); + --> expected_setfailed --> UNUR_ERR_DISTR_DATA + + +############################################################################## + +# [init] + +############################################################################# + +# [reinit] + +############################################################################# + +[sample] + +[sample - invalid NULL ptr: + distr = NULL; ] + +unur_distr_discr_eval_pmf( 1, distr ); + --> expected_INFINITY --> UNUR_ERR_NULL + +unur_distr_discr_eval_cdf( 1, distr ); + --> expected_INFINITY --> UNUR_ERR_NULL + +unur_distr_discr_eval_invcdf( 0.5, distr ); + --> expected_INTMAX --> UNUR_ERR_NULL + +#..................................................................... + +[sample - invalid distribution object: + distr = unur_distr_cont_new(); ] + +unur_distr_discr_eval_pmf( 1, distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_eval_cdf( 1, distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID + +unur_distr_discr_eval_invcdf( 0.5, distr ); + --> expected_INTMAX --> UNUR_ERR_DISTR_INVALID + +#..................................................................... + +[sample - missing data: + distr = unur_distr_discr_new(); ] + +unur_distr_discr_eval_pmf( 1, distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_DATA + +unur_distr_discr_eval_cdf( 1, distr ); + --> expected_INFINITY --> UNUR_ERR_DISTR_DATA + +unur_distr_discr_eval_invcdf( 0.5, distr ); + --> expected_INTMAX --> UNUR_ERR_DISTR_DATA + + +############################################################################# + +# [validate] + +############################################################################# +############################################################################# + +[verbatim] + +double pmf(int k ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } +double icdf(int k ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } +int invcdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1; } + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_distr_matr.c b/vendor/unuran-1.11.0/tests/t_distr_matr.c new file mode 100644 index 0000000..b6d16b1 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_distr_matr.c @@ -0,0 +1,301 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for DISTR_MATR + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_distr_matr_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid data */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,25,(unur_distr_matr_new(0,3)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,25,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,28,(unur_distr_matr_new(3,0)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,28,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + int n_rows, n_cols; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,44,(unur_distr_matr_get_dim( distr, &n_rows, &n_cols )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,44,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + int n_rows, n_cols; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,51,(unur_distr_matr_get_dim( distr, &n_rows, &n_cols )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,51,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_distr_matr_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_distr_matr.conf b/vendor/unuran-1.11.0/tests/t_distr_matr.conf new file mode 100644 index 0000000..b65fcdc --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_distr_matr.conf @@ -0,0 +1,79 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: DISTR_MATR + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +[new - invalid data: + distr = NULL; ] + +unur_distr_matr_new(0,3); + --> expected_NULL --> UNUR_ERR_DISTR_SET + +unur_distr_matr_new(3,0); + --> expected_NULL --> UNUR_ERR_DISTR_SET + + +############################################################################# + +# [set] + +############################################################################# + +[get] + +[get - invalid NULL ptr: + int n_rows, n_cols; + distr = NULL; ] + +~_dim( distr, &n_rows, &n_cols ); + --> expected_zero --> UNUR_ERR_NULL + +[get - invalid distribution type: + int n_rows, n_cols; + distr = unur_distr_discr_new(); ] + +~_dim( distr, &n_rows, &n_cols ); + --> expected_zero --> UNUR_ERR_DISTR_INVALID + + +############################################################################# + +# [chg] + +############################################################################## + +# [init] + +############################################################################# + +# [reinit] + +############################################################################# + +# [sample] + +############################################################################# + +# [validate] + +############################################################################# +############################################################################# + +[verbatim] + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_dsrou.c b/vendor/unuran-1.11.0/tests/t_dsrou.c new file mode 100644 index 0000000..39755e3 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_dsrou.c @@ -0,0 +1,2691 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for DSROU + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ +int unur_dsrou_set_pedantic( struct unur_par *par, int pedantic ); + +double pmf( int k, const UNUR_DISTR *distr ); +double pmf_invalidmode( int k, const UNUR_DISTR *distr ); + +double pmf_geom05( int k, const UNUR_DISTR *distr ); +double cdf_geom05( int k, const UNUR_DISTR *distr ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (10000) + +/* #define SEED (298346) */ + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* pmf that does not work */ +double pmf( int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((k==2) ? 0. : pow(0.5,(double)k)); +} /* end of pmf */ + +double pmf_invalidmode( int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((k==2) ? 0.01 : pow(0.5,(double)k)); +} /* end of pmf */ + + +/* pmf for geometric(0.5) distribution with domain (1,inf) */ +double pmf_geom05( int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (pow(0.5,(double)k)); +} + +double cdf_geom05( int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (1.-pow(0.5,(double)k)); +} + + +/* dummy function */ +int unur_dsrou_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,34,(unur_dsrou_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,34,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,40,(unur_dsrou_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,40,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +/* pmf, mode, pmfsum */ +n_tests_failed += (check_expected_NULL(TESTLOG,47,(unur_dsrou_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,47,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,57,(unur_dsrou_set_cdfatmode(par,0.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,57,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,60,(unur_dsrou_set_verify(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {10,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dari_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_dsrou_set_cdfatmode(par,0.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,71,(unur_dsrou_set_verify(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,71,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dsrou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,81,(unur_dsrou_set_cdfatmode(par,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,81,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dari_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 97, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,101,(unur_dsrou_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,104,(unur_dsrou_chg_cdfatmode(gen,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,104,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dsrou_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 110, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,114,(unur_dsrou_chg_cdfatmode(gen,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,114,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,125,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,125,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid data */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_discr_new(); + unur_distr_discr_set_pmf(distr,pmf); + unur_distr_discr_set_mode(distr,2); + unur_distr_discr_set_pmfsum(distr,1.); + par = unur_dsrou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,136,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,136,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_discr_new(); + par = NULL; + + +unur_reset_errno(); +/* mode, pmfsum */ +unur_distr_discr_set_pmf(distr,pmf); +par = unur_dsrou_new( distr ); +n_tests_failed += (check_expected_NULL(TESTLOG,146,(unur_init(par)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,146,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* pmfsum */ +unur_distr_discr_set_mode(distr,0); +par = unur_dsrou_new( distr ); +n_tests_failed += (check_expected_NULL(TESTLOG,152,(unur_init(par)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,152,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dsrou_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 161, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,165,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + + +unur_reset_errno(); +/* default algorithm */ +par = unur_dsrou_new(distr); +n_tests_failed += (compare_sequence_par_start(TESTLOG,178,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* default algorithm - verifying mode */ +par = unur_dsrou_new(distr); +unur_dsrou_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,183,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* violate condition */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + + +unur_reset_errno(); +/* use cdf at mode */ +par = unur_dsrou_new(distr); +unur_dsrou_set_cdfatmode(par,0.1); + run_verify_generator (TESTLOG,195,par); +n_tests_failed += (check_errorcode(TESTLOG,195,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_dsrou_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,209,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,215,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_dsrou_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,228,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,232,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[] = {3.}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_poisson(fpar,1); +par = unur_dsrou_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,245,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "poisson(3.) & method = dsrou" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,250,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_poisson(fpar,1); +par = unur_dsrou_new(distr); +unur_dsrou_set_cdfatmode(par,0.3); +unur_dsrou_set_verify(par,1); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,259,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "poisson(3.) & method = dsrou; cdfatmode=0.3; verify=on" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,264,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[16]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 16 */ +{ +fpm[0] = 0.5; +distr[0] = unur_distr_geometric(fpm,1); +} + +{ +fpm[0] = 0.1; +distr[1] = unur_distr_geometric(fpm,1); +} + +{ +fpm[0] = 0.001; +distr[2] = unur_distr_geometric(fpm,1); +} + +{ +fpm[0] = 0.1; +distr[3] = unur_distr_logarithmic(fpm,1); +} + +{ +fpm[0] = 0.9; +distr[4] = unur_distr_logarithmic(fpm,1); +} + +{ +fpm[0] = 0.5; +fpm[1] = 10.; +distr[5] = unur_distr_negativebinomial(fpm,2); +} + +{ +fpm[0] = 0.7; +fpm[1] = 5.; +distr[6] = unur_distr_negativebinomial(fpm,2); +} + +{ +fpm[0] = 0.1; +fpm[1] = 20.; +distr[7] = unur_distr_negativebinomial(fpm,2); +} + +{ +fpm[0] = 3.; +distr[8] = unur_distr_poisson(fpm,1); +} + +{ +fpm[0] = 50.; +distr[9] = unur_distr_poisson(fpm,1); +} + +{ +fpm[0] = 2.; +fpm[1] = 1.; +distr[10] = unur_distr_zipf(fpm,2); +} + +{ +fpm[0] = 20.; +fpm[1] = 0.8; +distr[11] = unur_distr_binomial(fpm,2); +} + +{ +fpm[0] = 2000.; +fpm[1] = 0.0013; +distr[12] = unur_distr_binomial(fpm,2); +} + +{ +fpm[0] = 2000.; +fpm[1] = 200.; +fpm[2] = 20; +distr[13] = unur_distr_hypergeometric(fpm,3); +} + +{ +fpm[0] = 2000.; +fpm[1] = 200.; +fpm[2] = 220; +distr[14] = unur_distr_hypergeometric(fpm,3); +} + +{ +distr[15] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[15],pmf_geom05); +unur_distr_discr_set_cdf(distr[15],cdf_geom05); +unur_distr_set_name(distr[15],"test find_mode"); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 64 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); +fpm[0] = 10.; +fpm[1] = 0.63; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); +fpm[0] = 10.; +fpm[1] = 0.63; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dsrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 64 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); +fpm[0] = 10.; +fpm[1] = 0.63; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); +fpm[0] = 10.; +fpm[1] = 0.63; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); +unur_dsrou_set_cdfatmode(par,Fmode); } + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dsrou_new(distr_localcopy); + unur_dsrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_dsrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_dsrou_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_dsrou.conf b/vendor/unuran-1.11.0/tests/t_dsrou.conf new file mode 100644 index 0000000..52324e4 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_dsrou.conf @@ -0,0 +1,483 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: DSROU + +[main - header:] + +/* prototypes */ +int unur_dsrou_set_pedantic( struct unur_par *par, int pedantic ); + +double pmf( int k, const UNUR_DISTR *distr ); +double pmf_invalidmode( int k, const UNUR_DISTR *distr ); + +double pmf_geom05( int k, const UNUR_DISTR *distr ); +double cdf_geom05( int k, const UNUR_DISTR *distr ); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (10000) + +/* \#define SEED (298346) */ + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_cont_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_discr_new(); ] + +/* pmf, mode, pmfsum */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_cdfatmode(par,0.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_verify(par,1); + --> expected_setfailed --> UNUR_ERR_NULL + +[set - invalid parameter object: + double fpar[2] = {10,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dari_new(distr); ] + +~_cdfatmode(par,0.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_verify(par,1); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + +[set - invalid parameters: + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dsrou_new(distr); ] + +~_cdfatmode(par,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + +############################################################################# + +# [get] + +############################################################################# + +[chg] + +[chg - invalid generator object: + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dari_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_verify(gen,1); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +~_cdfatmode(gen,1.); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + + +[chg - invalid parameters: + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dsrou_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +~_cdfatmode(gen,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + + +[init - invalid data: + distr = unur_distr_discr_new(); + unur_distr_discr_set_pmf(distr,pmf); + unur_distr_discr_set_mode(distr,2); + unur_distr_discr_set_pmfsum(distr,1.); + par = unur_dsrou_new(distr); ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_DATA + +[init - data missing in distribution object: + distr = unur_distr_discr_new(); + par = NULL; ] + +/* mode, pmfsum */ +unur_distr_discr_set_pmf(distr,pmf); +par = unur_dsrou_new( distr ); +unur_init(par); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +/* pmfsum */ +unur_distr_discr_set_mode(distr,0); +par = unur_dsrou_new( distr ); +unur_init(par); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[reinit] + +[reinit - exist: + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dsrou_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - compare: + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = NULL; ] + +/* default algorithm */ +par = unur_dsrou_new(distr); + -->compare_sequence_par_start + +/* default algorithm - verifying mode */ +par = unur_dsrou_new(distr); +unur_dsrou_set_verify(par,1); + -->compare_sequence_par + +#..................................................................... + +[sample - violate condition: + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = NULL; ] + +/* use cdf at mode */ +par = unur_dsrou_new(distr); +unur_dsrou_set_cdfatmode(par,0.1); + --> run_verify_generator --> UNUR_ERR_GEN_CONDITION + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_dsrou_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare reinit: + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_dsrou_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + double fpar[] = {3.}; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_poisson(fpar,1); +par = unur_dsrou_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "poisson(3.) & method = dsrou" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_poisson(fpar,1); +par = unur_dsrou_new(distr); +unur_dsrou_set_cdfatmode(par,0.3); +unur_dsrou_set_verify(par,1); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "poisson(3.) & method = dsrou; cdfatmode=0.3; verify=on" ); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default variant +par[0] = unur_dsrou_new(@distr@); + +# use cdf at mode +{ double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(@distr@), @distr@ ); +par[1] = unur_dsrou_new(@distr@); +unur_dsrou_set_cdfatmode(par,Fmode); } + +# default variant but reinitialized with changed domain +{ UNUR_DISTR *dg =NULL; +par[2] = unur_dsrou_new(@distr@); +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + +# default variant but reinitialized with changed pdf parameters +{ UNUR_DISTR *dg =NULL; +par[3] = unur_dsrou_new(@distr@); +fpm[0] = 10.; +fpm[1] = 0.63; +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_distr_discr_upd_pmfsum(dg); +unur_distr_discr_upd_mode(dg); +unur_reinit(gen); } + + +[validate - distributions:] + +# geometric disctribution +fpm[0] = 0.5; +distr[0] = unur_distr_geometric(fpm,1); + +fpm[0] = 0.1; +distr[1] = unur_distr_geometric(fpm,1); + +fpm[0] = 0.001; +distr[2] = unur_distr_geometric(fpm,1); + +# logarithmic distribution +fpm[0] = 0.1; +distr[3] = unur_distr_logarithmic(fpm,1); + +fpm[0] = 0.9; +distr[4] = unur_distr_logarithmic(fpm,1); + +# negative binomial distribution +fpm[0] = 0.5; +fpm[1] = 10.; +distr[5] = unur_distr_negativebinomial(fpm,2); + +fpm[0] = 0.7; +fpm[1] = 5.; +distr[6] = unur_distr_negativebinomial(fpm,2); + +fpm[0] = 0.1; +fpm[1] = 20.; +distr[7] = unur_distr_negativebinomial(fpm,2); + +# poisson distribution +fpm[0] = 3.; +distr[8] = unur_distr_poisson(fpm,1); + +fpm[0] = 50.; +distr[9] = unur_distr_poisson(fpm,1); + +# zipf distribution +fpm[0] = 2.; +fpm[1] = 1.; +distr[10] = unur_distr_zipf(fpm,2); + +# binomial distribution +fpm[0] = 20.; +fpm[1] = 0.8; +distr[11] = unur_distr_binomial(fpm,2); + +# binomial distribution +fpm[0] = 2000.; +fpm[1] = 0.0013; +distr[12] = unur_distr_binomial(fpm,2); + +# Hyper geometric distribution +fpm[0] = 2000.; +fpm[1] = 200.; +fpm[2] = 20; +distr[13] = unur_distr_hypergeometric(fpm,3); + +# Hyper geometric distribution +fpm[0] = 2000.; +fpm[1] = 200.; +fpm[2] = 220; +distr[14] = unur_distr_hypergeometric(fpm,3); + +# Test for mode finding algorithm +distr[15] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[15],pmf_geom05); +unur_distr_discr_set_cdf(distr[15],cdf_geom05); +unur_distr_set_name(distr[15],"test find_mode"); + +# number of distributions: 16 + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator (given variant does not exist) +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default +# [1] ... use cdf at mode-1 +# [2] ... default variant but reinitialized with changed domain +# [3] ....default variant but reinitialized with changed pdf parameters +# +#gen 0 1 2 3 # distribution +#---------------------------------------------------- + <0> + + + . # geometric (0.5) + <1> + + + . # geometric (0.1) + <2> + + + . # geometric (0.001) + <3> + + + . # logarithmic (0.1) + <4> + + + . # logarithmic (0.9) + <5> + + + . # negativebinomial (0.5, 10) + <6> + + + . # negativebinomial (0.7, 5) + <7> + + + . # negativebinomial (0.1, 20) + <8> + + + . # poisson (3) + <9> + + + . # poisson (20) +#<10> . . . . # zipf (2, 1) + <11> + + + + # binomial (20, 0.8) + <12> + + + + # binomial (2000, 0.0013) + <13> + + + . # hypergeometric (2000, 200, 20) + <14> + + + . # hypergeometric (2000, 200, 220) + <15> + . . . # geomtric(0.5) with domain (1,inf) + +# number of distributions: 16 + + +[validate - verify hat:] + +# + ... pass test +# ~ ... fail in at most 1% of samples +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# +# generators: +# [0] ... default +# [1] ... use cdf at mode-1 +# [2] ... default variant but reinitialized with changed domain +# [3] ....default variant but reinitialized with changed pdf parameters +# +#gen 0 1 2 3 # distribution +#---------------------------------------------------- + <0> + + + . # geometric (0.5) + <1> + + + . # geometric (0.1) + <2> + + + . # geometric (0.001) + <3> + + + . # logarithmic (0.1) + <4> + + + . # logarithmic (0.9) + <5> + + + . # negativebinomial (0.5, 10) + <6> + + + . # negativebinomial (0.7, 5) + <7> + + . . # negativebinomial (0.1, 20) + <8> + + + . # poisson (3) + <9> + + + . # poisson (20) +#<10> . . . . # zipf (2, 1) + <11> + + + + # binomial (20, 0.8) + <12> + + + + # binomial (2000, 0.0013) + <13> + + + . # hypergeometric (2000, 200, 20) + <14> + + + . # hypergeometric (2000, 200, 220) + <15> + . . . # geomtric(0.5) with domain (1,inf) + +# number of distributions: 16 + + +############################################################################# +############################################################################# + +[verbatim] + +/* pmf that does not work */ +double pmf( int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((k==2) ? 0. : pow(0.5,(double)k)); +} /* end of pmf */ + +double pmf_invalidmode( int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((k==2) ? 0.01 : pow(0.5,(double)k)); +} /* end of pmf */ + + +/* pmf for geometric(0.5) distribution with domain (1,inf) */ +double pmf_geom05( int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (pow(0.5,(double)k)); +} + +double cdf_geom05( int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (1.-pow(0.5,(double)k)); +} + + +/* dummy function */ +int unur_dsrou_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_dss.c b/vendor/unuran-1.11.0/tests/t_dss.c new file mode 100644 index 0000000..a3a453a --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_dss.c @@ -0,0 +1,1421 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for DSS + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_dss_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (15000) +#define VIOLATE_SAMPLE_SIZE (20) + +const int n_pv = 36; +const double pv[36]={1,2,3,4,5,6,5,3,6,7,5,4,3,4,6,7,5,3,4,3,8,6,5,4,7,7,2,2,1,4,7,4,3,7,3,2}; +const double pvsum = 158.; + +const double pvre[10] = {1,2,3,4,5,6,7,8,9,10}; +const double pvresum = 55.; + +double my_pmf(int k, const UNUR_DISTR *distr); +double my_cdf(int k, const UNUR_DISTR *distr); + +/* #define SEED (298346) */ + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +double my_pmf(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (k<0 || k>35) return 0.; + else return pv[k]; +} + +double my_cdf(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double sum; + int j; + + if (k<0) return 0.; + if (k>=35) return 1.; + + for (sum=0.,j=0; j<=k; j++) + sum += pv[j]; + + return sum/pvsum; +} + +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,37,(unur_dss_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,37,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,43,(unur_dss_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,43,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); /* no probability vector */ + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,49,(unur_dss_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,71,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,71,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dss_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 81, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,85,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_dss_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,102,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,108,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_dss_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,121,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,125,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double pvec[] = {.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_discr_new(); +unur_distr_discr_set_pv(distr,pvec,10); +unur_distr_discr_set_pmfsum(distr,46.); +par = unur_dss_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,140,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.); pmfsum=46 \ + & method = dss" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,146,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[16]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 16 */ +{ +distr[0] = unur_distr_discr_new(); +unur_distr_discr_set_pv(distr[0],pv,n_pv); +unur_distr_discr_set_pmfsum(distr[0],pvsum); +unur_distr_set_name(distr[0],"pv(0..35)"); +} + +{ +distr[1] = unur_distr_discr_new(); +unur_distr_discr_set_pv(distr[1],pv,n_pv); +unur_distr_discr_set_domain(distr[1],100,135); +unur_distr_discr_set_pmfsum(distr[1],pvsum); +unur_distr_set_name(distr[1],"pv(100..135)"); +} + +{ +distr[2] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[2],my_pmf); +unur_distr_discr_set_pmfsum(distr[2],pvsum); +unur_distr_set_name(distr[2],"pmf(0..35)"); +} + +{ +distr[14] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[14],my_pmf); +unur_distr_discr_set_domain(distr[14],0,35); +unur_distr_discr_set_pmfsum(distr[14],pvsum); +unur_distr_set_name(distr[14],"pmf(0..35)"); +} + +{ +distr[3] = unur_distr_discr_new(); +unur_distr_discr_set_cdf(distr[3],my_cdf); +unur_distr_set_name(distr[3],"cdf(0..35)"); +} + +{ +distr[15] = unur_distr_discr_new(); +unur_distr_discr_set_cdf(distr[15],my_cdf); +unur_distr_discr_set_domain(distr[15],0,35); +unur_distr_set_name(distr[15],"cdf(0..35)"); +} + +{ +fpm[0] = 0.5; +distr[4] = unur_distr_geometric(fpm,1); +} + +{ +fpm[0] = 0.01; +distr[5] = unur_distr_geometric(fpm,1); +} + +{ +fpm[0] = 0.1; +distr[6] = unur_distr_logarithmic(fpm,1); +} + +{ +fpm[0] = 0.99; +distr[7] = unur_distr_logarithmic(fpm,1); +} + +{ +fpm[0] = 0.5; +fpm[1] = 10.; +distr[8] = unur_distr_negativebinomial(fpm,2); +} + +{ +fpm[0] = 0.8; +fpm[1] = 10.; +distr[9] = unur_distr_negativebinomial(fpm,2); +} + +{ +fpm[0] = 0.1; +distr[10] = unur_distr_poisson(fpm,1); +} + +{ +fpm[0] = 0.999; +distr[11] = unur_distr_poisson(fpm,1); +} + +{ +fpm[0] = 20.; +fpm[1] = 0.8; +distr[12] = unur_distr_binomial(fpm,2); +} + +{ +fpm[0] = 2000.; +fpm[1] = 0.0013; +distr[13] = unur_distr_binomial(fpm,2); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 64 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pv(dg,pvre,10); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pv(dg,pvre,10); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [7] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [8] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [12] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_dss_new(distr_localcopy); +fpm[0] = 10.; +fpm[1] = 0.63; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_dss_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_dss_new(distr_localcopy); +fpm[0] = 10.; +fpm[1] = 0.63; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_dss_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_dss.conf b/vendor/unuran-1.11.0/tests/t_dss.conf new file mode 100644 index 0000000..6c51ca5 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_dss.conf @@ -0,0 +1,324 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: DSS + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (15000) +\#define VIOLATE_SAMPLE_SIZE (20) + +const int n_pv = 36; +const double pv[36]={1,2,3,4,5,6,5,3,6,7,5,4,3,4,6,7,5,3,4,3,8,6,5,4,7,7,2,2,1,4,7,4,3,7,3,2}; +const double pvsum = 158.; + +const double pvre[10] = {1,2,3,4,5,6,7,8,9,10}; +const double pvresum = 55.; + +double my_pmf(int k, const UNUR_DISTR *distr); +double my_cdf(int k, const UNUR_DISTR *distr); + +/* \#define SEED (298346) */ + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_cont_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_discr_new(); /* no probability vector */ ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +# [set] + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + + +############################################################################# + +[reinit] + +[reinit - exist: + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dss_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + + +############################################################################# + +[sample] + +[sample - compare clone: + UNUR_GEN *clone; + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_dss_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare reinit: + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_dss_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + double pvec[] = {.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.}; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_discr_new(); +unur_distr_discr_set_pv(distr,pvec,10); +unur_distr_discr_set_pmfsum(distr,46.); +par = unur_dss_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.); pmfsum=46 \ + & method = dss" ); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default program +par[0] = unur_dss_new(@distr@); + +# reinitialized with changed domain +{ UNUR_DISTR *dg =NULL; +par[1] = unur_dss_new(@distr@); +dg = unur_get_distr(gen); +unur_distr_discr_set_domain(dg,2,7); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + +# reinitialized with changed pdf parameters +{ UNUR_DISTR *dg =NULL; +par[2] = unur_dss_new(@distr@); +fpm[0] = 10.; +fpm[1] = 0.63; +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + +# reinitialized with changed pv +{ UNUR_DISTR *dg =NULL; +par[3] = unur_dss_new(@distr@); +dg = unur_get_distr(gen); +unur_distr_discr_set_pv(dg,pvre,10); +unur_distr_discr_upd_pmfsum(dg); +unur_reinit(gen); } + + +[validate - distributions:] + +# probability vector with random entries +distr[0] = unur_distr_discr_new(); +unur_distr_discr_set_pv(distr[0],pv,n_pv); +unur_distr_discr_set_pmfsum(distr[0],pvsum); +unur_distr_set_name(distr[0],"pv(0..35)"); + +distr[1] = unur_distr_discr_new(); +unur_distr_discr_set_pv(distr[1],pv,n_pv); +unur_distr_discr_set_domain(distr[1],100,135); +unur_distr_discr_set_pmfsum(distr[1],pvsum); +unur_distr_set_name(distr[1],"pv(100..135)"); + +## PMF instead of PV +distr[2] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[2],my_pmf); +unur_distr_discr_set_pmfsum(distr[2],pvsum); +unur_distr_set_name(distr[2],"pmf(0..35)"); + +distr[14] = unur_distr_discr_new(); +unur_distr_discr_set_pmf(distr[14],my_pmf); +unur_distr_discr_set_domain(distr[14],0,35); +unur_distr_discr_set_pmfsum(distr[14],pvsum); +unur_distr_set_name(distr[14],"pmf(0..35)"); + +## CDF instead of PV +distr[3] = unur_distr_discr_new(); +unur_distr_discr_set_cdf(distr[3],my_cdf); +unur_distr_set_name(distr[3],"cdf(0..35)"); + +distr[15] = unur_distr_discr_new(); +unur_distr_discr_set_cdf(distr[15],my_cdf); +unur_distr_discr_set_domain(distr[15],0,35); +unur_distr_set_name(distr[15],"cdf(0..35)"); + +# geometric disctribution +fpm[0] = 0.5; +distr[4] = unur_distr_geometric(fpm,1); + +fpm[0] = 0.01; +distr[5] = unur_distr_geometric(fpm,1); + +# logarithmic distribution +fpm[0] = 0.1; +distr[6] = unur_distr_logarithmic(fpm,1); + +fpm[0] = 0.99; +distr[7] = unur_distr_logarithmic(fpm,1); + +# negative binomial distribution +fpm[0] = 0.5; +fpm[1] = 10.; +distr[8] = unur_distr_negativebinomial(fpm,2); + +fpm[0] = 0.8; +fpm[1] = 10.; +distr[9] = unur_distr_negativebinomial(fpm,2); + +# poisson distribution +fpm[0] = 0.1; +distr[10] = unur_distr_poisson(fpm,1); + +fpm[0] = 0.999; +distr[11] = unur_distr_poisson(fpm,1); + +# binomial distribution +fpm[0] = 20.; +fpm[1] = 0.8; +distr[12] = unur_distr_binomial(fpm,2); + +# binomial distribution +fpm[0] = 2000.; +fpm[1] = 0.0013; +distr[13] = unur_distr_binomial(fpm,2); + + +# number of distributions: 16 + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# [0] ... default +# [1] ... reinitialized with changed domain +# [2] ... reinitialized with changed pdf parameters +# [3] ... reinitialized with changed pv +# +#gen 0 1 2 3 # distribution +#------------------------------------------------------------- + <0> + + . + # PV on [0..35] with random entries + <1> + + . + # PV on [100..135] with random entries + <2> + + . . # PMF on [0..35] with random entries + <14> + + . . # PMF on [0..35] with random entries + <3> + . . . # CDF on [0..35] with random entries + <15> + . . . # CDF on [0..35] with random entries + <4> + + . . # geometric (0.5) +x <5> + + . . # geometric (0.01) + <6> + + . . # logarithmic (0.1) +x <7> + + . . # logarithmic (0.99) +x <8> + + . . # negativebinomial (0.5, 10) + <9> + + . . # negativebinomial (0.8, 10) + <10> + + . . # poisson (0.1) + <11> + + . . # poisson (0.999) +x<12> + + + . # binomial (20, 0.8) +x<13> + + + . # binomial (2000, 0.0013) + + +############################################################################# +############################################################################# + +[verbatim] + +double my_pmf(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (k<0 || k>35) return 0.; + else return pv[k]; +} + +double my_cdf(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double sum; + int j; + + if (k<0) return 0.; + if (k>=35) return 1.; + + for (sum=0.,j=0; j<=k; j++) + sum += pv[j]; + + return sum/pvsum; +} + +/*---------------------------------------------------------------------------*/ + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_dstd.c b/vendor/unuran-1.11.0/tests/t_dstd.c new file mode 100644 index 0000000..929d2b0 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_dstd.c @@ -0,0 +1,2802 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for DSTD + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_dstd_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +int estimate_uerror( UNUR_DISTR *distr, double u_resolution, int samplesize ); + +double cdf_geom(int k, const UNUR_DISTR *distr); +int invcdf_geom(double u, const UNUR_DISTR *distr); + +/* -- constants -- */ + +/* sample size */ +static const int UERROR_SAMPLESIZE = 100000; +static const double UERROR_RESOLUTION = 1.e-14; + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + +/* #define SEED (298346) */ + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + + +int +estimate_uerror( UNUR_DISTR *distr, /* distribution object */ + double u_resolution, /* maximal tolerated u-error */ + int samplesize ) /* sample size for error experiment */ +/* returns 0 if maxerror < u_resolution, errorcode otherwise */ +{ + UNUR_PAR *par; + UNUR_GEN *gen; + int i, nfpar; + const double *fpar; + double score; + + /* print data about distribution */ + fprintf(TESTLOG,"> %s (",unur_distr_get_name(distr)); + nfpar = unur_distr_discr_get_pmfparams(distr,&fpar); + for(i=0;i inversion method not implemented !!\n\n"); + printf("0"); fflush(stdout); + if (par) unur_par_free(par); + unur_distr_free(distr); + return 0; + } + + /* initialize generator object */ + gen = unur_init(par); + + /* run test */ + score = run_validate_u_error( TESTLOG, gen, distr, u_resolution, samplesize ); + + /* clear working space */ + unur_distr_free(distr); + unur_free(gen); + + /* return */ + fprintf(TESTLOG,"\n"); + return score; + +} /* end of estimate_uerror() */ + + + +double cdf_geom(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + const double p = 0.3; + return ((k<0) ? 0. : (1. - pow(1. - p, k+1.)) ); +} + +int invcdf_geom(double u, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + const double p = 0.3; + return ((int) (log(u) / log(1.-p))); +} + + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,38,(unur_dstd_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,38,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,44,(unur_dstd_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,44,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* not a standard distribution */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,50,(unur_dstd_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,50,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,60,(unur_dstd_set_variant(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[1] = {0.5}; + distr = unur_distr_geometric(fpar,1); + par = unur_dgt_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_dstd_set_variant(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[1] = {0.5}; + distr = unur_distr_geometric(fpar,1); + par = unur_dstd_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,78,(unur_dstd_set_variant(par,9999)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,78,UNUR_ERR_PAR_VARIANT)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {10,0.4}; + distr = unur_distr_binomial(fpar,2); + par = unur_dgt_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 94, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,98,(unur_dstd_chg_truncated(gen, 1, 5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,98,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,108,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,108,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* does not exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dstd_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 118, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,122,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_dstd_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,138,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,144,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[] = {3.}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_poisson(fpar,1); +par = unur_dstd_new(distr); +unur_dstd_set_variant(par,2); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,158,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "poisson(3.) & method = dstd; variant = 2" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,163,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[30]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 30 */ +{ +fpm[0] = 50.; +fpm[1] = 0.4; +distr[1] = unur_distr_binomial(fpm,2); +} + +{ +fpm[0] = 100.; +fpm[1] = 0.87; +distr[2] = unur_distr_binomial(fpm,2); +} + +{ +fpm[0] = 100.; +fpm[1] = 0.01; +distr[3] = unur_distr_binomial(fpm,2); +} + +{ +fpm[0] = 10000.; +fpm[1] = 0.7 ; +distr[4] = unur_distr_binomial(fpm,2); +} + +{ +fpm[0] = 0.5; +distr[0] = unur_distr_geometric(fpm,1); +} + +{ +fpm[0] = 0.001; +distr[11] = unur_distr_geometric(fpm,1); +} + +{ +fpm[0] = 0.999; +distr[12] = unur_distr_geometric(fpm,1); +} + +{ +fpm[0] = 10000.; +fpm[1] = 100. ; +fpm[2] = 50. ; +distr[5] = unur_distr_hypergeometric(fpm,3); +} + +{ +fpm[0] = 10000.; +fpm[1] = 9000. ; +fpm[2] = 50. ; +distr[6] = unur_distr_hypergeometric(fpm,3); +} + +{ +fpm[0] = 10000.; +fpm[1] = 80. ; +fpm[2] = 90. ; +distr[7] = unur_distr_hypergeometric(fpm,3); +} + +{ +fpm[0] = 10000.; +fpm[1] = 1000. ; +fpm[2] = 150. ; +distr[8] = unur_distr_hypergeometric(fpm,3); +} + +{ +fpm[0] = 10000.; +fpm[1] = 9000. ; +fpm[2] = 500. ; +distr[9] = unur_distr_hypergeometric(fpm,3); +} + +{ +fpm[0] = 10000.; +fpm[1] = 9000. ; +fpm[2] = 250. ; +distr[10] = unur_distr_hypergeometric(fpm,3); +} + +{ +fpm[0] = 0.001; +distr[25] = unur_distr_logarithmic(fpm,1); +} + +{ +fpm[0] = 0.01; +distr[13] = unur_distr_logarithmic(fpm,1); +} + +{ +fpm[0] = 0.1; +distr[14] = unur_distr_logarithmic(fpm,1); +} + +{ +fpm[0] = 0.5; +distr[15] = unur_distr_logarithmic(fpm,1); +} + +{ +fpm[0] = 0.9; +distr[16] = unur_distr_logarithmic(fpm,1); +} + +{ +fpm[0] = 0.999; +distr[17] = unur_distr_logarithmic(fpm,1); +} + +{ +fpm[0] = 0.001; +distr[18] = unur_distr_poisson(fpm,1); +} + +{ +fpm[0] = 0.1; +distr[19] = unur_distr_poisson(fpm,1); +} + +{ +fpm[0] = 0.5; +distr[20] = unur_distr_poisson(fpm,1); +} + +{ +fpm[0] = 1.; +distr[21] = unur_distr_poisson(fpm,1); +} + +{ +fpm[0] = 10.; +distr[22] = unur_distr_poisson(fpm,1); +} + +{ +fpm[0] = 1000.; +distr[23] = unur_distr_poisson(fpm,1); +} + +{ +fpm[0] = 2.; +fpm[1] = 3.; +distr[28] = unur_distr_zipf(fpm,2); +} + +{ +fpm[0] = 3.; +fpm[1] = 2.; +distr[29] = unur_distr_zipf(fpm,2); +} + +{ +fpm[0] = 0.5; +fpm[1] = 10.; +distr[24] = unur_distr_negativebinomial(fpm,2); +} + +{ +distr[26] = unur_distr_discr_new(); +unur_distr_set_name( distr[26], "CDF_only" ); +unur_distr_discr_set_domain( distr[26], 0, INT_MAX ); +unur_distr_discr_set_cdf( distr[26], cdf_geom ); +} + +{ +distr[27] = unur_distr_discr_new(); +unur_distr_set_name( distr[27], "CDF&invCDF" ); +unur_distr_discr_set_domain( distr[27], 0, INT_MAX ); +unur_distr_discr_set_cdf( distr[27], cdf_geom ); +unur_distr_discr_set_invcdf( distr[27], invcdf_geom ); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 210 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [1] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 20; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [2] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 20; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [3] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 20; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [4] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 20; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 0.2; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 0.2; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 0.2; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 200; +fpm[1] = 50; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 200; +fpm[1] = 50; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 200; +fpm[1] = 50; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 200; +fpm[1] = 50; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 200; +fpm[1] = 50; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 200; +fpm[1] = 50; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 0.2; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 0.2; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 0.2; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 0.2; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 0.2; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [17] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 0.2; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [18] */ + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,2)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 0.2; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 20; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [19] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,2)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 0.2; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 20; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [20] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,2)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 0.2; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 20; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [21] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,2)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 0.2; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 20; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [22] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,2)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 0.2; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 20; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [23] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,2)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 0.2; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_dstd_new(distr_localcopy); +fpm[0] = 20; +fpm[1] = 0.5; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [28] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [29] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_dstd_new(distr_localcopy); +if (unur_dstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + +/*---------------------------------------------------------------------------*/ +/* [special] */ + +void test_special (void) +{ + /* set boolean to FALSE */ + int FAILED = 0; + + + + + + + int samplesize = UERROR_SAMPLESIZE; + double ures = UERROR_RESOLUTION; + + int errorsum = 0; + double fpar[5]; + + UNUR_DISTR *distr; + +/* start test */ +printf("[special "); fflush(stdout); +fprintf(TESTLOG,"\n[special]\n"); + +/* set stop watch */ +stopwatch_lap(&watch); + + + + /* test for maximal u-error */ + printf("\n[test maximal u-error for inversion method]\n"); + fprintf(TESTLOG,"\n* Test maximal u-error for inversion method *\n"); + + + printf(" binomial"); + + fpar[0] = 20; + fpar[1] = 0.2; + distr = unur_distr_binomial(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 10000; + fpar[1] = 0.2; + distr = unur_distr_binomial(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" geometric"); + + fpar[0] = 0.1; + distr = unur_distr_geometric(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" hypergeometric"); + + fpar[0] = 10000; + fpar[1] = 1000; + fpar[2] = 150; + distr = unur_distr_hypergeometric(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" negativebinomial"); + + fpar[0] = 0.2; + fpar[1] = 20; + distr = unur_distr_negativebinomial(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 0.2; + fpar[1] = 10000; + distr = unur_distr_negativebinomial(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + + printf(" poisson"); + + fpar[0] = 0.1; + distr = unur_distr_poisson(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 10; + distr = unur_distr_poisson(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + + +/*---------------------------------------------------------------------------*/ + + /* test finished */ + FAILED = (errorsum < 2) ? 0 : 1; + + + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (FAILED) ? 0 : 1; + (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_special() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_dstd_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_dstd.conf b/vendor/unuran-1.11.0/tests/t_dstd.conf new file mode 100644 index 0000000..31e251e --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_dstd.conf @@ -0,0 +1,574 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: DSTD + +[main - header:] + +/* prototypes */ + +int estimate_uerror( UNUR_DISTR *distr, double u_resolution, int samplesize ); + +double cdf_geom(int k, const UNUR_DISTR *distr); +int invcdf_geom(double u, const UNUR_DISTR *distr); + +/* -- constants -- */ + +/* sample size */ +static const int UERROR_SAMPLESIZE = 100000; +static const double UERROR_RESOLUTION = 1.e-14; + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* \#define SEED (298346) */ + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_cont_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - not a standard distribution: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################## + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_variant(par,1); + --> expected_setfailed --> UNUR_ERR_NULL + +[set - invalid parameter object: + double fpar[1] = {0.5}; + distr = unur_distr_geometric(fpar,1); + par = unur_dgt_new(distr); ] + +~_variant(par,1); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + +[set - invalid parameters: + double fpar[1] = {0.5}; + distr = unur_distr_geometric(fpar,1); + par = unur_dstd_new(distr); ] + +~_variant(par,9999); + --> expected_setfailed --> UNUR_ERR_PAR_VARIANT + +unur_par_free(par); + +############################################################################## + +# [get] + +############################################################################## + +[chg] + +[chg - invalid generator object: + double fpar[2] = {10,0.4}; + distr = unur_distr_binomial(fpar,2); + par = unur_dgt_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_truncated(gen, 1, 5); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +############################################################################## + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + + +############################################################################## + +[reinit] + +[reinit - does not exist: + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dstd_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################## + +[sample] + +[sample - compare clone: + UNUR_GEN *clone; + double fpar[] = {10,0.3}; + distr = unur_distr_binomial(fpar,2); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_dstd_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + double fpar[] = {3.}; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_poisson(fpar,1); +par = unur_dstd_new(distr); +unur_dstd_set_variant(par,2); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "poisson(3.) & method = dstd; variant = 2" ); + -->compare_sequence_gen + + +############################################################################## + +[validate] + +[validate - generators:] + +# inversion +par[0] = unur_dstd_new(@distr@); +if (unur_dstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + +par[1] = unur_dstd_new(@distr@); +if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + +par[2] = unur_dstd_new(@distr@); +if (unur_dstd_set_variant(par,2)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } + +# change domain +par[10] = unur_dstd_new(@distr@); +if (unur_dstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } +unur_dstd_chg_truncated(gen,1,4); + +# change parameters (use default variant) +{ UNUR_DISTR *dg =NULL; +par[11] = unur_dstd_new(@distr@); +fpm[0] = 0.2; +fpm[1] = 0.5; +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + +# change parameters (use default variant) +{ UNUR_DISTR *dg =NULL; +par[12] = unur_dstd_new(@distr@); +fpm[0] = 20; +fpm[1] = 0.5; +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + +# change parameters (use default variant) +{ UNUR_DISTR *dg =NULL; +par[13] = unur_dstd_new(@distr@); +fpm[0] = 200; +fpm[1] = 50; +dg = unur_get_distr(gen); +unur_distr_discr_set_pmfparams(dg,fpm,2); +unur_reinit(gen); } + + +[validate - distributions:] + +# Binomial distribution +fpm[0] = 50.; +fpm[1] = 0.4; +distr[1] = unur_distr_binomial(fpm,2); + +fpm[0] = 100.; +fpm[1] = 0.87; +distr[2] = unur_distr_binomial(fpm,2); + +fpm[0] = 100.; +fpm[1] = 0.01; +distr[3] = unur_distr_binomial(fpm,2); + +fpm[0] = 10000.; +fpm[1] = 0.7 ; +distr[4] = unur_distr_binomial(fpm,2); + + +# Geometric disctribution +fpm[0] = 0.5; +distr[0] = unur_distr_geometric(fpm,1); + +fpm[0] = 0.001; +distr[11] = unur_distr_geometric(fpm,1); + +fpm[0] = 0.999; +distr[12] = unur_distr_geometric(fpm,1); + + +# Hypergeometric +fpm[0] = 10000.; +fpm[1] = 100. ; +fpm[2] = 50. ; +distr[5] = unur_distr_hypergeometric(fpm,3); + +fpm[0] = 10000.; +fpm[1] = 9000. ; +fpm[2] = 50. ; +distr[6] = unur_distr_hypergeometric(fpm,3); + +fpm[0] = 10000.; +fpm[1] = 80. ; +fpm[2] = 90. ; +distr[7] = unur_distr_hypergeometric(fpm,3); + +fpm[0] = 10000.; +fpm[1] = 1000. ; +fpm[2] = 150. ; +distr[8] = unur_distr_hypergeometric(fpm,3); + +fpm[0] = 10000.; +fpm[1] = 9000. ; +fpm[2] = 500. ; +distr[9] = unur_distr_hypergeometric(fpm,3); + +fpm[0] = 10000.; +fpm[1] = 9000. ; +fpm[2] = 250. ; +distr[10] = unur_distr_hypergeometric(fpm,3); + + +# Logarithmic disctribution +fpm[0] = 0.001; +distr[25] = unur_distr_logarithmic(fpm,1); + +fpm[0] = 0.01; +distr[13] = unur_distr_logarithmic(fpm,1); + +fpm[0] = 0.1; +distr[14] = unur_distr_logarithmic(fpm,1); + +fpm[0] = 0.5; +distr[15] = unur_distr_logarithmic(fpm,1); + +fpm[0] = 0.9; +distr[16] = unur_distr_logarithmic(fpm,1); + +fpm[0] = 0.999; +distr[17] = unur_distr_logarithmic(fpm,1); + +# Poisson distribution +fpm[0] = 0.001; +distr[18] = unur_distr_poisson(fpm,1); + +fpm[0] = 0.1; +distr[19] = unur_distr_poisson(fpm,1); + +fpm[0] = 0.5; +distr[20] = unur_distr_poisson(fpm,1); + +fpm[0] = 1.; +distr[21] = unur_distr_poisson(fpm,1); + +fpm[0] = 10.; +distr[22] = unur_distr_poisson(fpm,1); + +fpm[0] = 1000.; +distr[23] = unur_distr_poisson(fpm,1); + +# Zipf +fpm[0] = 2.; +fpm[1] = 3.; +distr[28] = unur_distr_zipf(fpm,2); + +fpm[0] = 3.; +fpm[1] = 2.; +distr[29] = unur_distr_zipf(fpm,2); + +# negative binomial distribution +fpm[0] = 0.5; +fpm[1] = 10.; +distr[24] = unur_distr_negativebinomial(fpm,2); + +# distributions from scratch +distr[26] = unur_distr_discr_new(); +unur_distr_set_name( distr[26], "CDF_only" ); +unur_distr_discr_set_domain( distr[26], 0, INT_MAX ); +unur_distr_discr_set_cdf( distr[26], cdf_geom ); + +distr[27] = unur_distr_discr_new(); +unur_distr_set_name( distr[27], "CDF&invCDF" ); +unur_distr_discr_set_domain( distr[27], 0, INT_MAX ); +unur_distr_discr_set_cdf( distr[27], cdf_geom ); +unur_distr_discr_set_invcdf( distr[27], invcdf_geom ); + + +# number of distributions: 30 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator (given variant does not exist) +# - ... fail test +# / ... either init fails or test passes +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... Inversion +# [1] -- [2] ... Variants 1 to 9 +# [10] ... domain changed after initialization +# [11] ... change parameters to {0.2, 0.5} (use default variant) +# [12] ... change parameters to {20, 0.5} (use default variant) +# [13] ... change parameters to {200, 50} (use default variant) +# +# 1 1 1 1 +#gen 0 1 2 0 1 2 3 # distribution +#------------------------------------------------------------- + <1> . + . . . + . # binomial (50, 0.4) + <2> . + . . . + . # binomial (100, 0.87) + <3> . + . . . + . # binomial (100, 0.01) + <4> . + . . . + . # binomial (10000, 0.7) + + <0> + . . . + . . # geometric (0.5) + <11> + . . . + . . # geometric (0.01) + <12> + . . . + . . # geometric (0.999) + + <5> . + . . . . + # hypergeometric (10000, 100, 50) + <6> . + . . . . + # hypergeometric (10000, 9000, 50) + <7> . + . . . . + # hypergeometric (10000, 80, 90) + <8> . + . . . . + # hypergeometric (10000, 1000, 150) + <9> . + . . . . + # hypergeometric (10000, 9000, 500) + <10> . + . . . . + # hypergeometric (10000, 9000, 5000) + +x<25> . + . . + . . # logarithmic (0.001) + <13> . + . . + . . # logarithmic (0.01) + <14> . + . . + . . # logarithmic (0.1) + <15> . + . . + . . # logarithmic (0.5) + <16> . + . . + . . # logarithmic (0.9) + <17> . + . . + . . # logarithmic (0.999) + +x<18> . + + . + + . # poisson (0.001) + <19> . + + . + + . # poisson (0.1) + <20> . + + . + + . # poisson (0.5) + <21> . + + . + + . # poisson (1) + <22> . + + . + + . # poisson (10) + <23> . + + . + + . # poisson (1000) + + <28> . + . . . . . # zipf (2,3) + <29> . + . . . . . # zipf (3,2) + +#<24> . . . . . . . # negativebinomial (0.5, 10) + + <26> 0 . . . . . . # given CDF + <27> + . . . . . . # given CDF + invCDF + + +############################################################################## +############################################################################## + +[special] + +## Remark: +## +## In this section we merely test the existence of inversion. +## A few implementations seem to be rather inaccurate with respect to +## their u-errors. +## + +[special - decl:] + + int samplesize = UERROR_SAMPLESIZE; + double ures = UERROR_RESOLUTION; + + int errorsum = 0; + double fpar[5]; + + UNUR_DISTR *distr; + +[special - start:] + + /* test for maximal u-error */ + printf("\n[test maximal u-error for inversion method]\n"); + fprintf(TESTLOG,"\n* Test maximal u-error for inversion method *\n"); + +## ---------------------------------------------------- + + printf(" binomial"); + + fpar[0] = 20; + fpar[1] = 0.2; + distr = unur_distr_binomial(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 10000; + fpar[1] = 0.2; + distr = unur_distr_binomial(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" geometric"); + + fpar[0] = 0.1; + distr = unur_distr_geometric(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" hypergeometric"); + + fpar[0] = 10000; + fpar[1] = 1000; + fpar[2] = 150; + distr = unur_distr_hypergeometric(fpar,3); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" negativebinomial"); + + fpar[0] = 0.2; + fpar[1] = 20; + distr = unur_distr_negativebinomial(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 0.2; + fpar[1] = 10000; + distr = unur_distr_negativebinomial(fpar,2); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + + printf(" poisson"); + + fpar[0] = 0.1; + distr = unur_distr_poisson(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + + fpar[0] = 10; + distr = unur_distr_poisson(fpar,1); + errorsum += estimate_uerror(distr,ures,samplesize); + +## ---------------------------------------------------- + +/*---------------------------------------------------------------------------*/ + + /* test finished */ + FAILED = (errorsum < 2) ? 0 : 1; + + +############################################################################## + +[verbatim] + +############################################################################# +# +# routines for special tests +# +############################################################################# + +int +estimate_uerror( UNUR_DISTR *distr, /* distribution object */ + double u_resolution, /* maximal tolerated u-error */ + int samplesize ) /* sample size for error experiment */ +/* returns 0 if maxerror < u_resolution, errorcode otherwise */ +{ + UNUR_PAR *par; + UNUR_GEN *gen; + int i, nfpar; + const double *fpar; + double score; + + /* print data about distribution */ + fprintf(TESTLOG,"> %s (",unur_distr_get_name(distr)); + nfpar = unur_distr_discr_get_pmfparams(distr,&fpar); + for(i=0;i inversion method not implemented !!\n\n"); + printf("0"); fflush(stdout); + if (par) unur_par_free(par); + unur_distr_free(distr); + return 0; + } + + /* initialize generator object */ + gen = unur_init(par); + + /* run test */ + score = run_validate_u_error( TESTLOG, gen, distr, u_resolution, samplesize ); + + /* clear working space */ + unur_distr_free(distr); + unur_free(gen); + + /* return */ + fprintf(TESTLOG,"\n"); + return score; + +} /* end of estimate_uerror() */ + + +############################################################################# +# +# PDFs and CDF for test distributions +# +############################################################################# + +double cdf_geom(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + const double p = 0.3; + return ((k<0) ? 0. : (1. - pow(1. - p, k+1.)) ); +} + +int invcdf_geom(double u, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + const double p = 0.3; + return ((int) (log(u) / log(1.-p))); +} + + +############################################################################## diff --git a/vendor/unuran-1.11.0/tests/t_empk.c b/vendor/unuran-1.11.0/tests/t_empk.c new file mode 100644 index 0000000..cc5aa57 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_empk.c @@ -0,0 +1,923 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for EMPK + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_empk_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + +/* sample size for Gaussian distributet sample */ +#define samplesize (5000) + +UNUR_DISTR *get_distr_with_data( void ); +UNUR_DISTR *get_distr_with_Gaussian_data( void ); +double urng_ed (void *dummy); + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/*---------------------------------------------------------------------------*/ + +UNUR_DISTR *get_distr_with_data( void ) +{ +#define PV_SIZE 20 + double pv[PV_SIZE]; + UNUR_DISTR *distr; + int i; + + for (i=0; itime = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,54,(unur_empk_set_kernel(par,UNUR_DISTR_GAUSSIAN)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,54,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,57,(unur_empk_set_kernelgen(par, NULL, 1., 1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,57,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,60,(unur_empk_set_beta(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,63,(unur_empk_set_smoothing(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,66,(unur_empk_set_varcor(par,TRUE)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,69,(unur_empk_set_positive(par,TRUE)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,69,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_cstd_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,77,(unur_empk_set_kernel(par,UNUR_DISTR_GAUSSIAN)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,77,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,80,(unur_empk_set_kernelgen(par, NULL, 1., 1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,80,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,83,(unur_empk_set_beta(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,83,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,86,(unur_empk_set_smoothing(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,86,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,89,(unur_empk_set_varcor(par,TRUE)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,89,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,92,(unur_empk_set_positive(par,TRUE)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,92,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = get_distr_with_data(); + par = unur_empk_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,101,(unur_empk_set_kernel(par,UNUR_DISTR_BETA)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,104,(unur_empk_set_kernelgen(par, NULL, -1., 1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,104,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,107,(unur_empk_set_beta(par,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,107,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,110,(unur_empk_set_smoothing(par,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,110,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_cstd_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 124, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,128,(unur_empk_chg_smoothing(gen,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,128,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,131,(unur_empk_chg_varcor(gen,TRUE)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,131,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = get_distr_with_data(); + par = unur_empk_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 135, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,139,(unur_empk_chg_smoothing(gen,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,139,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,150,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,150,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* run init */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = get_distr_with_data(); + par = unur_empk_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 155, gen ); + + +unur_reset_errno(); +; +n_tests_failed += (check_errorcode(TESTLOG,159,0x0u)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* does not exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = get_distr_with_data(); + par = unur_empk_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 167, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,171,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,171,UNUR_ERR_NO_REINIT)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,174,(unur_sample_cont( gen )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,174,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + UNUR_GEN *kerngen; + distr = get_distr_with_data(); + par = unur_empk_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 184, gen ); + + +unur_reset_errno(); +/* default generator object */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,188,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,194,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* set kernel generator */ +unur_free(gen); +par = unur_empk_new(distr); +kerngen = unur_str2gen("normal & method=cstd"); +unur_empk_set_kernelgen(par,kerngen,0.7763884,1.); +gen = unur_init( par ); +n_tests_failed += (compare_sequence_gen(TESTLOG,202,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* set kernel */ +unur_free(gen); unur_free(kerngen); +par = unur_empk_new(distr); +unur_empk_set_kernel(par,UNUR_DISTR_GAUSSIAN); +gen = unur_init( par ); +n_tests_failed += (compare_sequence_gen(TESTLOG,209,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double data[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_cemp_new(); +unur_distr_cemp_set_data(distr,data,9); +par = unur_empk_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,223,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ + method = empk" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,229,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_cemp_new(); +unur_distr_cemp_set_data(distr,data,9); +par = unur_empk_new(distr); +unur_empk_set_beta(par,1.2); +unur_empk_set_kernel(par,UNUR_DISTR_UNIFORM); +unur_empk_set_positive(par,TRUE); +unur_empk_set_smoothing(par,0.); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,240,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ + method = empk; beta = 1.2; kernel = 2001; positive; smoothing = 0." ); +n_tests_failed += (compare_sequence_gen(TESTLOG,246,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_cemp_new(); +unur_distr_cemp_set_data(distr,data,9); +par = unur_empk_new(distr); +unur_empk_set_varcor(par,TRUE); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,254,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ + method = empk; varcor" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,260,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[1]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 1 */ +{ +distr[0] = get_distr_with_Gaussian_data(); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 7 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_empk_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_empk_new(distr_localcopy); +unur_empk_set_varcor(par, TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_empk_new(distr_localcopy); +unur_empk_set_kernel( par, UNUR_DISTR_GAUSSIAN); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_empk_new(distr_localcopy); +unur_empk_set_kernel( par, UNUR_DISTR_EPANECHNIKOV); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_empk_new(distr_localcopy); +unur_empk_set_kernel( par, UNUR_DISTR_BOXCAR); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_empk_new(distr_localcopy); +unur_empk_set_kernel( par, UNUR_DISTR_STUDENT); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_empk_new(distr_localcopy); +unur_empk_set_kernel( par, UNUR_DISTR_LOGISTIC); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_empk_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_empk.conf b/vendor/unuran-1.11.0/tests/t_empk.conf new file mode 100644 index 0000000..d44d054 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_empk.conf @@ -0,0 +1,383 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: EMPK + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* sample size for Gaussian distributet sample */ +\#define samplesize (5000) + +UNUR_DISTR *get_distr_with_data( void ); +UNUR_DISTR *get_distr_with_Gaussian_data( void ); +double urng_ed (void *dummy); + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_cont_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_cemp_new(); /* no data given */ ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_kernel(par,UNUR_DISTR_GAUSSIAN); + --> expected_setfailed --> UNUR_ERR_NULL + +~_kernelgen(par, NULL, 1., 1.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_beta(par,1.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_smoothing(par,1.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_varcor(par,TRUE); + --> expected_setfailed --> UNUR_ERR_NULL + +~_positive(par,TRUE); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameter object: + distr = unur_distr_normal(NULL,0); + par = unur_cstd_new(distr); ] + +~_kernel(par,UNUR_DISTR_GAUSSIAN); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_kernelgen(par, NULL, 1., 1.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_beta(par,1.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_smoothing(par,1.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_varcor(par,TRUE); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_positive(par,TRUE); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + +[set - invalid parameters: + distr = get_distr_with_data(); + par = unur_empk_new(distr); ] + +~_kernel(par,UNUR_DISTR_BETA); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_kernelgen(par, NULL, -1., 1.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_beta(par,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_smoothing(par,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + +############################################################################# + +# [get] + +############################################################################# + +[chg] + +[chg - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_cstd_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +~_smoothing(gen,1.); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +~_varcor(gen,TRUE); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +[chg - invalid parameters: + distr = get_distr_with_data(); + par = unur_empk_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +~_smoothing(gen,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + + +[init - run init: + distr = get_distr_with_data(); + par = unur_empk_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +# this should be o.k. + --> none --> 0x0u + +############################################################################# + +[reinit] + +[reinit - does not exist: + distr = get_distr_with_data(); + par = unur_empk_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_setfailed --> UNUR_ERR_NO_REINIT + +unur_sample_cont( gen ); + --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION + +############################################################################# + +[sample] + +[sample - compare clone: + UNUR_GEN *clone; + UNUR_GEN *kerngen; + distr = get_distr_with_data(); + par = unur_empk_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* default generator object */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +/* set kernel generator */ +unur_free(gen); +par = unur_empk_new(distr); +kerngen = unur_str2gen("normal & method=cstd"); +unur_empk_set_kernelgen(par,kerngen,0.7763884,1.); +gen = unur_init( par ); + -->compare_sequence_gen + +/* set kernel */ +unur_free(gen); unur_free(kerngen); +par = unur_empk_new(distr); +unur_empk_set_kernel(par,UNUR_DISTR_GAUSSIAN); +gen = unur_init( par ); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + double data[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.}; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_cemp_new(); +unur_distr_cemp_set_data(distr,data,9); +par = unur_empk_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ + method = empk" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +distr = unur_distr_cemp_new(); +unur_distr_cemp_set_data(distr,data,9); +par = unur_empk_new(distr); +unur_empk_set_beta(par,1.2); +unur_empk_set_kernel(par,UNUR_DISTR_UNIFORM); +unur_empk_set_positive(par,TRUE); +unur_empk_set_smoothing(par,0.); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ + method = empk; beta = 1.2; kernel = 2001; positive; smoothing = 0." ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +distr = unur_distr_cemp_new(); +unur_distr_cemp_set_data(distr,data,9); +par = unur_empk_new(distr); +unur_empk_set_varcor(par,TRUE); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ + method = empk; varcor" ); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default +par[0] = unur_empk_new(@distr@); + +# use variance correction +par[1] = unur_empk_new(@distr@); +unur_empk_set_varcor(par, TRUE); + +# use UNUR_DISTR_GAUSSIAN +par[2] = unur_empk_new(@distr@); +unur_empk_set_kernel( par, UNUR_DISTR_GAUSSIAN); + +# use UNUR_DISTR_EPANECHNIKOV +par[3] = unur_empk_new(@distr@); +unur_empk_set_kernel( par, UNUR_DISTR_EPANECHNIKOV); + +# use UNUR_DISTR_BOXCAR +par[4] = unur_empk_new(@distr@); +unur_empk_set_kernel( par, UNUR_DISTR_BOXCAR); + +# use UNUR_DISTR_STUDENT +par[5] = unur_empk_new(@distr@); +unur_empk_set_kernel( par, UNUR_DISTR_STUDENT); + +# use UNUR_DISTR_LOGISTIC +par[6] = unur_empk_new(@distr@); +unur_empk_set_kernel( par, UNUR_DISTR_LOGISTIC); + + +[validate - distributions:] + +# approximate normal distribution +distr[0] = get_distr_with_Gaussian_data(); + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default +# [1] ... use variance correction +# +# 0 1 2 3 4 5 6 # distribution +#---------------------------------------------------------------- + <0> + + + + + + + # approximate normal distribution + + +############################################################################# +############################################################################# + +[verbatim] + +/*---------------------------------------------------------------------------*/ + +UNUR_DISTR *get_distr_with_data( void ) +{ +\#define PV_SIZE 20 + double pv[PV_SIZE]; + UNUR_DISTR *distr; + int i; + + for (i=0; i +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_empl_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + +/* sample size for Gaussian distributet sample */ +#define samplesize (5000) + +UNUR_DISTR *get_distr_with_data( void ); +UNUR_DISTR *get_distr_with_Gaussian_data( void ); +double urng_ed (void *dummy); + + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/*---------------------------------------------------------------------------*/ + +UNUR_DISTR *get_distr_with_data( void ) +{ +#define PV_SIZE 20 + double pv[PV_SIZE]; + UNUR_DISTR *distr; + int i; + + for (i=0; itime = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,67,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,67,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* run init */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = get_distr_with_data(); + par = unur_empl_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 72, gen ); + + +unur_reset_errno(); +; +n_tests_failed += (check_errorcode(TESTLOG,76,0x0u)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* does not exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = get_distr_with_data(); + par = unur_empl_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 84, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,88,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_NO_REINIT)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,91,(unur_sample_cont( gen )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + distr = get_distr_with_data(); + par = unur_empl_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 101, gen ); + + +unur_reset_errno(); +/* default generator object */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,105,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,111,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double data[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_cemp_new(); +unur_distr_cemp_set_data(distr,data,9); +par = unur_empl_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,126,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ + method = empl" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,132,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[1]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 1 */ +{ +distr[0] = get_distr_with_Gaussian_data(); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 1 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_empl_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_empl_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_empl.conf b/vendor/unuran-1.11.0/tests/t_empl.conf new file mode 100644 index 0000000..83912e9 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_empl.conf @@ -0,0 +1,230 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: EMPL + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* sample size for Gaussian distributet sample */ +\#define samplesize (5000) + +UNUR_DISTR *get_distr_with_data( void ); +UNUR_DISTR *get_distr_with_Gaussian_data( void ); +double urng_ed (void *dummy); + + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_cont_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_cemp_new(); /* no data given */ ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +# [set] + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + + +[init - run init: + distr = get_distr_with_data(); + par = unur_empl_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +# this should be o.k. + --> none --> 0x0u + +############################################################################# + +[reinit] + +[reinit - does not exist: + distr = get_distr_with_data(); + par = unur_empl_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_setfailed --> UNUR_ERR_NO_REINIT + +unur_sample_cont( gen ); + --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION + + +############################################################################# + +[sample] + +[sample - compare clone: + UNUR_GEN *clone; + distr = get_distr_with_data(); + par = unur_empl_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* default generator object */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + + +#..................................................................... + +[sample - compare stringparser: + double data[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.}; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_cemp_new(); +unur_distr_cemp_set_data(distr,data,9); +par = unur_empl_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ + method = empl" ); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default +par[0] = unur_empl_new(@distr@); + + +[validate - distributions:] + +# approximate normal distribution +distr[0] = get_distr_with_Gaussian_data(); + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] default +# +# [0] # distribution +#---------------------------------------------------------------- + <0> + # approximate normal distribution (sample size 200000) + + +############################################################################# +############################################################################# + +[verbatim] + +/*---------------------------------------------------------------------------*/ + +UNUR_DISTR *get_distr_with_data( void ) +{ +\#define PV_SIZE 20 + double pv[PV_SIZE]; + UNUR_DISTR *distr; + int i; + + for (i=0; i +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_gibbs_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +int unur_gibbs_set_pedantic( UNUR_PAR *par, int pedantic ); + +#define COMPARE_SAMPLE_SIZE (9999) +#define VIOLATE_SAMPLE_SIZE (20) + +/* For running chi2 tests we use a thinning of dimension * THINNING */ +#define THINNING (2) + +/* GIBBS is a Markov Chain Monte Carlo method and thus it is likely to */ +/* fail the chi-square goodness-of-fit test with the used sample size. */ +/* Thus we accept one "hard" failer and more "soft" failures then usual. */ +#define CHI2_FAILURES_TOLERATED (1010) + + +/* we need marginal distributions for the chi2 tests */ +#define unur_distr_multicauchy unur_distr_multicauchy_w_marginals +#define unur_distr_multinormal unur_distr_multinormal_w_marginals +#define unur_distr_multistudent unur_distr_multistudent_w_marginals + + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* dummy function */ +int unur_gibbs_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,42,(unur_gibbs_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,49,(unur_gibbs_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + double x0[] = {1., 2., 3.}; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,61,(unur_gibbs_set_variant_coordinate( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,61,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,64,(unur_gibbs_set_variant_random_direction( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,64,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,67,(unur_gibbs_set_startingpoint( par, x0)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,67,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,70,(unur_gibbs_set_thinning( par, 3 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,73,(unur_gibbs_set_burnin( par, 100 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,73,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double x0[] = {1., 2., 3.}; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,82,(unur_gibbs_set_variant_coordinate( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,82,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,85,(unur_gibbs_set_variant_random_direction( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,85,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,88,(unur_gibbs_set_startingpoint( par, x0)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,91,(unur_gibbs_set_thinning( par, 3 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,94,(unur_gibbs_set_burnin( par, 100 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_multinormal( 3, NULL, NULL ); + par = unur_gibbs_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,103,(unur_gibbs_set_thinning( par, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,103,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_gibbs_set_burnin( par, -1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 117, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,121,(unur_gibbs_get_state(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,121,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double x[] = {0.,0.}; + distr = unur_distr_normal(NULL,0); + par = unur_ssr_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 131, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,135,(unur_gibbs_chg_state(gen,x)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,135,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid NULL */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_multinormal(2,NULL,NULL); + par = unur_gibbs_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 139, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,143,(unur_gibbs_chg_state(gen,NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,143,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* does not exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double x[3]; + distr = unur_distr_multinormal(3,NULL,NULL); + par = unur_gibbs_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 157, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,161,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,161,UNUR_ERR_NO_REINIT)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_sample_vec( gen, x ); +n_tests_failed += (check_expected_INFINITY(TESTLOG,165,(x[0]))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,165,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* test clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + UNUR_GEN *clone; + distr = unur_distr_multinormal( dim, mean, covar ); + par = unur_gibbs_new(distr); + /* unur_gibbs_set_variant_random_direction(par); */ + unur_set_debug(par,1u); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 180, gen ); + + +unur_reset_errno(); +/* clone */ +/* currently we cannot compare clone with original generator. */ +/* thus we just run it to test whether cloning works without a segfault. */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +unur_gibbs_reset_state(gen); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,190,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[35]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 35 */ +{ +distr[0] = unur_distr_multinormal(1,NULL,NULL); +} + +{ +distr[1] = unur_distr_multinormal(2,NULL,NULL); +} + +{ +distr[2] = unur_distr_multinormal(3,NULL,NULL); +} + +{ +double mean[] = { 1., 2., 3. }; +distr[34] = unur_distr_multinormal(3,mean,NULL); +} + +{ +double mean[] = { -1. }; +double covar[] = { 2. }; +distr[3] = unur_distr_multinormal(1,mean,covar); +unur_distr_cvec_set_center(distr[3],NULL); +} + +{ +double mean[] = { 1., 2., 3. }; +double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; +distr[4] = unur_distr_multinormal(3,mean,covar); +} + +{ +distr[5] = unur_distr_multinormal_ar1(3,NULL,0.9); +} + +{ +distr[6] = unur_distr_multinormal_ar1(4,NULL,0.8); +} + +{ +distr[7] = unur_distr_multinormal_ar1(5,NULL,0.7); +} + +{ +distr[8] = unur_distr_multinormal_ar1(10,NULL,0.6); +} + +{ +double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; +distr[9] = unur_distr_multinormal_ar1(3,mean,0.9); +} + +{ +double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; +distr[10] = unur_distr_multinormal_ar1(4,mean,0.8); +} + +{ +double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; +distr[11] = unur_distr_multinormal_ar1(5,mean,0.7); +} + +{ +double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; +distr[12] = unur_distr_multinormal_ar1(10,mean,0.6); +} + +{ +distr[13] = unur_distr_multinormal_constantrho(3,NULL,0.9); +} + +{ +distr[14] = unur_distr_multinormal_constantrho(4,NULL,0.8); +} + +{ +distr[15] = unur_distr_multinormal_constantrho(5,NULL,0.7); +} + +{ +distr[16] = unur_distr_multinormal_constantrho(10,NULL,0.6); +} + +{ +distr[17] = unur_distr_multicauchy(2,NULL,NULL); +} + +{ +distr[18] = unur_distr_multicauchy(3,NULL,NULL); +} + +{ +double mean[] = { 1., 2., 3. }; +double covar[] = { 1., 0.5, 0.25, 0.5, 1., 0.5, 0.25, 0.5, 1. }; +distr[19] = unur_distr_multicauchy(3,mean,covar); +} + +{ +distr[20] = unur_distr_multicauchy_ar1(3,NULL,0.7); +} + +{ +distr[21] = unur_distr_multicauchy_ar1(4,NULL,0.6); +} + +{ +distr[22] = unur_distr_multicauchy_ar1(5,NULL,0.5); +} + +{ +distr[23] = unur_distr_multicauchy_ar1(10,NULL,0.4); +} + +{ +distr[24] = unur_distr_multistudent_ar1(2,3.,NULL,0.7); +} + +{ +distr[25] = unur_distr_multistudent_ar1(2,5.,NULL,0.7); +} + +{ +distr[26] = unur_distr_multistudent_ar1(2,15.,NULL,0.7); +} + +{ +distr[27] = unur_distr_multistudent_ar1(2,0.5,NULL,0.7); +} + +{ +distr[28] = unur_distr_multistudent_ar1(2,1.5,NULL,0.7); +} + +{ +distr[29] = unur_distr_multistudent_ar1(2,2.5,NULL,0.7); +} + +{ +double ll[3] = {0.,0.,0.}; +double ru[3] = {UNUR_INFINITY,UNUR_INFINITY,UNUR_INFINITY}; +distr[30] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[30],ll,ru); +} + +{ +double ll[3] = {0.,0.,0.}; +double ru[3] = {1.,UNUR_INFINITY,UNUR_INFINITY}; +distr[31] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[31],ll,ru); +} + +{ +double ll[3] = {-1.,-1.,1.}; +double ru[3] = {1.,0.,2.}; +double center[3] = {0.,-0.5,1.5}; +distr[32] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[32],ll,ru); +unur_distr_cvec_set_center(distr[32],center); +} + +{ +double ll[3] = {-1.,-1.,1.}; +double ru[3] = {1.,0.,2.}; +distr[33] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[33],ll,ru); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 140 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [34] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [7] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [8] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [12] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [20] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [23] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [28] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [29] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [31] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [32] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [33] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_burnin(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_gibbs_new(distr_localcopy); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); +unur_gibbs_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + unur_distr_free(distr[30]); + unur_distr_free(distr[31]); + unur_distr_free(distr[32]); + unur_distr_free(distr[33]); + unur_distr_free(distr[34]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_gibbs_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_gibbs.conf b/vendor/unuran-1.11.0/tests/t_gibbs.conf new file mode 100644 index 0000000..0a3e40d --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_gibbs.conf @@ -0,0 +1,414 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: GIBBS + +[main - header:] + +/* prototypes */ + +int unur_gibbs_set_pedantic( UNUR_PAR *par, int pedantic ); + +\#define COMPARE_SAMPLE_SIZE (9999) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* For running chi2 tests we use a thinning of dimension * THINNING */ +\#define THINNING (2) + +/* GIBBS is a Markov Chain Monte Carlo method and thus it is likely to */ +/* fail the chi-square goodness-of-fit test with the used sample size. */ +/* Thus we accept one "hard" failer and more "soft" failures then usual. */ +\#define CHI2_FAILURES_TOLERATED (1010) + + +/* we need marginal distributions for the chi2 tests */ +\#define unur_distr_multicauchy unur_distr_multicauchy_w_marginals +\#define unur_distr_multinormal unur_distr_multinormal_w_marginals +\#define unur_distr_multistudent unur_distr_multistudent_w_marginals + + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + + +############################################################################# + +[set] + +[set - invalid NULL ptr: + double x0[] = {1., 2., 3.}; + par = NULL; ] + +~_variant_coordinate( par ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_variant_random_direction( par ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_startingpoint( par, x0); + --> expected_setfailed --> UNUR_ERR_NULL + +~_thinning( par, 3 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_burnin( par, 100 ); + --> expected_setfailed --> UNUR_ERR_NULL + +[set - invalid parameter object: + double x0[] = {1., 2., 3.}; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); ] + +~_variant_coordinate( par ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_variant_random_direction( par ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_startingpoint( par, x0); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_thinning( par, 3 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_burnin( par, 100 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + +[set - invalid parameters: + distr = unur_distr_multinormal( 3, NULL, NULL ); + par = unur_gibbs_new(distr); ] + +~_thinning( par, 0 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_burnin( par, -1 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + + +############################################################################# + +[get] + +[get - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init(par); <-- ! NULL ] + +~_state(gen); + --> expected_NULL --> UNUR_ERR_GEN_INVALID + + +############################################################################# + +[chg] + +[chg - invalid generator object: + double x[] = {0.,0.}; + distr = unur_distr_normal(NULL,0); + par = unur_ssr_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +~_state(gen,x); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +[chg - invalid NULL: + distr = unur_distr_multinormal(2,NULL,NULL); + par = unur_gibbs_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +~_state(gen,NULL); + --> expected_setfailed --> UNUR_ERR_NULL + + +############################################################################# + +# [init] + +############################################################################# + +[reinit] + +[reinit - does not exist: + double x[3]; + distr = unur_distr_multinormal(3,NULL,NULL); + par = unur_gibbs_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_setfailed --> UNUR_ERR_NO_REINIT + +unur_sample_vec( gen, x ); +x[0]; + --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION + + +############################################################################# + +[sample] + +[sample - test clone: + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + UNUR_GEN *clone; + distr = unur_distr_multinormal( dim, mean, covar ); + par = unur_gibbs_new(distr); + /* unur_gibbs_set_variant_random_direction(par); */ + unur_set_debug(par,1u); + gen = unur_init( par ); <-- ! NULL ] + +/* clone */ +/* currently we cannot compare clone with original generator. */ +/* thus we just run it to test whether cloning works without a segfault. */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +unur_gibbs_reset_state(gen); + -->compare_sequence_gen_start + + +############################################################################# + +[validate] + +[validate - generators:] + +# T=log, coordinate sampling, thinning = THINNIG*dim +par[0] = unur_gibbs_new(@distr@); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(@distr@)); +unur_gibbs_set_burnin(par,1000); + +# T=log, random direction sampling, thinning = THINNIG*dim +par[1] = unur_gibbs_new(@distr@); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(@distr@)); +unur_gibbs_set_burnin(par,1000); + + +# T=sqrt, coordinate sampling, thinning = THINNIG*dim +par[2] = unur_gibbs_new(@distr@); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(@distr@)); +unur_gibbs_set_c(par,-0.5); +##unur_set_debug(par,~0u); + +# T=sqrt, random direction sampling, thinning = THINNIG*dim +par[3] = unur_gibbs_new(@distr@); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(@distr@)); +unur_gibbs_set_c(par,-0.5); + + +[validate - distributions:] + +# standard multinormal distribution +distr[0] = unur_distr_multinormal(1,NULL,NULL); + +distr[1] = unur_distr_multinormal(2,NULL,NULL); + +distr[2] = unur_distr_multinormal(3,NULL,NULL); + +# standard multinormal distribution, shifted center +double mean[] = { 1., 2., 3. }; +distr[34] = unur_distr_multinormal(3,mean,NULL); + + +# multinormal distribution, dim = 1, shifted center +double mean[] = { -1. }; +double covar[] = { 2. }; +distr[3] = unur_distr_multinormal(1,mean,covar); +unur_distr_cvec_set_center(distr[3],NULL); + +# multinormal distribution, dim = 3, shifted center +double mean[] = { 1., 2., 3. }; +double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; +distr[4] = unur_distr_multinormal(3,mean,covar); + + +# multinormal with AR(1) +distr[5] = unur_distr_multinormal_ar1(3,NULL,0.9); + +distr[6] = unur_distr_multinormal_ar1(4,NULL,0.8); + +distr[7] = unur_distr_multinormal_ar1(5,NULL,0.7); + +distr[8] = unur_distr_multinormal_ar1(10,NULL,0.6); + + +# multinormal with AR(1) (rho=0.9, dim=3), shifted center +double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; +distr[9] = unur_distr_multinormal_ar1(3,mean,0.9); + +double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; +distr[10] = unur_distr_multinormal_ar1(4,mean,0.8); + +double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; +distr[11] = unur_distr_multinormal_ar1(5,mean,0.7); + +double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; +distr[12] = unur_distr_multinormal_ar1(10,mean,0.6); + + +# multinormal with constant rho +distr[13] = unur_distr_multinormal_constantrho(3,NULL,0.9); + +distr[14] = unur_distr_multinormal_constantrho(4,NULL,0.8); + +distr[15] = unur_distr_multinormal_constantrho(5,NULL,0.7); + +distr[16] = unur_distr_multinormal_constantrho(10,NULL,0.6); + + +# standard multicauchy distribution +distr[17] = unur_distr_multicauchy(2,NULL,NULL); + +distr[18] = unur_distr_multicauchy(3,NULL,NULL); + + +# multicauchy distribution, dim = 3 +double mean[] = { 1., 2., 3. }; +double covar[] = { 1., 0.5, 0.25, 0.5, 1., 0.5, 0.25, 0.5, 1. }; +distr[19] = unur_distr_multicauchy(3,mean,covar); + +# multicauchy with AR(1) covariance matrix +distr[20] = unur_distr_multicauchy_ar1(3,NULL,0.7); + +distr[21] = unur_distr_multicauchy_ar1(4,NULL,0.6); + +distr[22] = unur_distr_multicauchy_ar1(5,NULL,0.5); + +distr[23] = unur_distr_multicauchy_ar1(10,NULL,0.4); + + +# multistudent with AR(1) covariance matrix +distr[24] = unur_distr_multistudent_ar1(2,3.,NULL,0.7); + +distr[25] = unur_distr_multistudent_ar1(2,5.,NULL,0.7); + +distr[26] = unur_distr_multistudent_ar1(2,15.,NULL,0.7); + +distr[27] = unur_distr_multistudent_ar1(2,0.5,NULL,0.7); + +distr[28] = unur_distr_multistudent_ar1(2,1.5,NULL,0.7); + +distr[29] = unur_distr_multistudent_ar1(2,2.5,NULL,0.7); + +# standard multinormal distribution with rectangular domain +double ll[3] = {0.,0.,0.}; +double ru[3] = {UNUR_INFINITY,UNUR_INFINITY,UNUR_INFINITY}; +distr[30] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[30],ll,ru); + +# standard multinormal distribution with rectangular domain +double ll[3] = {0.,0.,0.}; +double ru[3] = {1.,UNUR_INFINITY,UNUR_INFINITY}; +distr[31] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[31],ll,ru); + +# standard multinormal distribution with rectangular domain +double ll[3] = {-1.,-1.,1.}; +double ru[3] = {1.,0.,2.}; +double center[3] = {0.,-0.5,1.5}; +distr[32] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[32],ll,ru); +unur_distr_cvec_set_center(distr[32],center); + +# invalid: default center of distribution out of truncated domain +double ll[3] = {-1.,-1.,1.}; +double ru[3] = {1.,0.,2.}; +distr[33] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[33],ll,ru); + + +# number of distributions: 35 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... T=log, coordinate sampling, thinning = THINNIG*dim +# [1] ... T=log, random direction sampling, thinning = THINNIG*dim +# [2] ... T=sqrt, coordinate sampling, thinning = THINNIG*dim +# [3] ... T=sqrt, random direction sampling, thinning = THINNIG*dim +# +#gen 0 1 2 3 # distribution +#--------------------------------------------- + <0> + + + + # standard multinormal (dim=1) + <1> + + + + # standard multinormal (dim=2) + <2> + + x+ x+ # standard multinormal (dim=3) + <34> + + x+ x+ # standard multinormal distribution (dim=3), shifted center +x <3> + + + + # multinormal (dim=1), shifted center +x <4> + + + + # multinormal (dim=3), shifted center +x <5> + + + + # multinormal with AR(1) (rho=0.9, dim=3) +x <6> + + . . # multinormal with AR(1) (rho=0.8, dim=4) +x <7> + + . . # multinormal with AR(1) (rho=0.7, dim=5) +x <8> + + . . # multinormal with AR(1) (rho=0.6, dim=10) +x <9> + + . . # multinormal with AR(1) (rho=0.9, dim=3), shifted center +x<10> + + . . # multinormal with AR(1) (rho=0.8, dim=4), shifted center +x<11> + + . . # multinormal with AR(1) (rho=0.7, dim=5), shifted center +x<12> + + + + # multinormal with AR(1) (rho=0.6, dim=10), shifted center +x<13> + + . . # multinormal with constant rho (rho=0.9, dim=3) +x<14> + + . . # multinormal with constant rho (rho=0.8, dim=4) +x<15> + + + + # multinormal with constant rho (rho=0.7, dim=5) +x<16> + + . . # multinormal with constant rho (rho=0.6, dim=10) + + <17> 0 0 + + # standard multicauchy (dim=2) + <18> 0 0 + + # standard multicauchy (dim=3) + <19> 0 0 + + # multicauchy (dim=3), shifted center +x<20> 0 0 + + # multicauchy with AR(1) covariance matrix (rho=0.7, dim=3) +x<21> 0 0 + + # multicauchy with AR(1) covariance matrix (rho=0.6, dim=4) +x<22> 0 0 + + # multicauchy with AR(1) covariance matrix (rho=0.5, dim=5) +x<23> 0 0 + + # multicauchy with AR(1) covariance matrix (rho=0.4, dim=10) + + <24> 0 0 + + # multistudent with AR(1) covariance matrix (rho=0.7, dim=2, nu = 3) +x<25> 0 0 + + # multistudent with AR(1) covariance matrix (rho=0.7, dim=2, nu = 5) +x<26> 0 0 + + # multistudent with AR(1) covariance matrix (rho=0.7, dim=2, nu = 15) +x<27> 0 0 + + # multistudent with AR(1) covariance matrix (rho=0.7, dim=2, nu = 0.5) +x<28> 0 0 + + # multistudent with AR(1) covariance matrix (rho=0.7, dim=2, nu = 1.5) +x<29> 0 0 + + # multistudent with AR(1) covariance matrix (rho=0.7, dim=2, nu = 2.5) + + <30> + . + . # standard multinormal distribution with rectangular domain + <31> + . + . # standard multinormal distribution with rectangular domain +x<32> + . + . # standard multinormal distribution with rectangular domain +x<33> 0 0 0 0 # invalid: default center of distribution out of truncated domain + + +############################################################################# +############################################################################# + +[verbatim] + +/* dummy function */ +int unur_gibbs_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +############################################################################# + diff --git a/vendor/unuran-1.11.0/tests/t_hinv.c b/vendor/unuran-1.11.0/tests/t_hinv.c new file mode 100644 index 0000000..f5a97fe --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_hinv.c @@ -0,0 +1,8669 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for HINV + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_hinv_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +#include + +/* constants */ + +#define UERROR_SAMPLESIZE (10000) + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + +/* #define SEED (298346) */ + +#ifndef M_PI +#define M_PI 3.14159265358979323846264338328 /* pi */ +#endif + +#define set_debug_flag(par) \ + do { \ + if (fullcheck) unur_set_debug((par),~0u); \ + else unur_set_debug((par),1u); \ + } while (0); + +/* prototypes */ + +double sin_cdf( double x, const UNUR_DISTR *distr ); +double sin_pdf( double x, const UNUR_DISTR *distr ); +double sin_dpdf( double x, const UNUR_DISTR *distr ); + +double sin0_cdf( double x, const UNUR_DISTR *distr ); +double sin0_pdf( double x, const UNUR_DISTR *distr ); +double sin0_dpdf( double x, const UNUR_DISTR *distr ); + + +int hinv_error_experiment( UNUR_PAR *par, int samplesize ); + +int chg_domain_experiment( UNUR_PAR *par, int samplesize ); + +int hinv_error_gen_experiment( UNUR_GEN *gen, + double u_resolution, int order, int samplesize ); + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/*---------------------------------------------------------------------------*/ +/* Example of a distribution with f(x)=0 at x=-0.25 and x=0.75 */ +/* */ +/* / (1 +sin(2 Pi x))/2 if |x| <= 1 */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ +double sin_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (fabs(x) > 1.) + return 0.; + else + return (0.5*(1.+sin((2.*M_PI)*x))); +} /* end of sin_pdf() */ + +/* The derivative of the PDF of our distribution: */ +double sin_dpdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (fabs(x) > 1.) + return 0.; + else + return (M_PI*cos((2.*M_PI)*x)); +} /* end of sin_dpdf() */ + +/* The CDF of our distribution: */ +double sin_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x < -1.) + return 0.; + else if(x<=1.) + return (1.+2.*M_PI*(1+x)-cos((2.*M_PI)*x))/(4.*M_PI); + else return 1.; +} /* end of sin_cdf() */ + +/*---------------------------------------------------------------------------*/ + +/* Example of a distribution with f(x)=0 in (-0.5,0) */ +/* */ +/* / Max(sin(2 Pi x)),0)Pi/2 if -1 < x <0.5 */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ +double sin0_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x < -1.) return 0.; + if (x <= -0.5) return sin((2.*M_PI)*x)*0.5*M_PI; + if (x < 0.) return 0.; + if (x <= 0.5) return sin((2.*M_PI)*x)*0.5*M_PI; + return 0.; +} /* end of sin0_pdf() */ + +/* The derivative of the PDF of our distribution: */ +double sin0_dpdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x < -1.) return 0.; + if (x <= -0.5) return cos((2.*M_PI)*x)*M_PI*M_PI; + if (x < 0.) return 0.; + if (x <= 0.5) return cos((2.*M_PI)*x)*M_PI*M_PI; + return 0.; +} /* end of sin0_dpdf() */ + +/* The CDF of our distribution: */ +double sin0_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x < -1.) return 0.; + if(x<= -0.5) return 0.25*(1-cos((2.*M_PI)*x)); + if (x < 0.) return 0.5; + if (x <= 0.5) return 0.75-0.25*cos((2.*M_PI)*x); + return 1.; +} /* end of sin0_cdf() */ + + + +/*****************************************************************************/ +/* run unur_test_u_error for a particular generator object and print result */ + +int +hinv_error_gen_experiment( UNUR_GEN *gen, /* generator object */ + double u_resolution, /* maximal tolerated u-error */ + int order, /* order of polynomial */ + int samplesize ) /* sample size for error experiment */ + /* returns 0 if maxerror < u_resolution, errorcode otherwise */ +{ + int i, nfpar; + const double *fpar; + const UNUR_DISTR *distr = unur_get_distr(gen); + const char *genid = unur_get_genid(gen); + double score; + + /* print data about distribution */ + fprintf(TESTLOG,"%s: %s distribution",genid,unur_distr_get_name(distr)); + nfpar = unur_distr_cont_get_pdfparams(distr,&fpar); + if (nfpar) { + fprintf(TESTLOG," with parameters "); + for(i=0;i 1.e-13; u_resolution *= 0.01 ) { + for ( order=(u_resolution<1.e-9 ? 3:1); order<=5; order+=2) { + + /* make a working copy */ + par_clone = _unur_par_clone(par); + + /* create generator object */ + unur_hinv_set_order(par_clone,order); + unur_hinv_set_u_resolution(par_clone,u_resolution); + set_debug_flag(par_clone); + gen = unur_init(par_clone); + + /* run test */ + errorsum += hinv_error_gen_experiment(gen, u_resolution, order, samplesize); + fprintf(TESTLOG,"\n"); + + /* clear memory */ + unur_free(gen); + } + } + + unur_par_free(par); + + return errorsum; +} /* end of hinv_error_experiment() */ + +/*****************************************************************************/ +/* run test with truncated distributions */ + +int +chg_domain_experiment( UNUR_PAR *par, /* generator object */ + int samplesize ) /* sample size for experiment */ + /* returns 0 if maxerror < u_resolution, errorcode otherwise */ +{ + int k; + int result = 0; + UNUR_GEN *gen; /* generator object */ + double left, right; /* border of userdefined original domain */ + double newleft, newright; + + double u_resolution = 1.e-10; /* maximal tolerated u-error */ + int order = 3; /* order of polynomial */ + + unur_hinv_set_order(par,order); + unur_hinv_set_u_resolution(par,u_resolution); + gen = unur_init(par); + + unur_distr_cont_get_domain(unur_get_distr(gen), &left, &right ); + if (left <= UNUR_INFINITY) + left = unur_hinv_eval_approxinvcdf(gen, 1.e-10); + if (right >= UNUR_INFINITY) + right = unur_hinv_eval_approxinvcdf(gen, 1-1.e-10); + + for(k=1; k<=10;k++){ + newleft = left + k*0.05*(right-left); + newright = right - k*0.04*(right-left); + unur_hinv_chg_truncated(gen, newleft, newright); + result += hinv_error_gen_experiment(gen, u_resolution, order, samplesize/10); + } + + unur_hinv_chg_truncated(gen, left, right); + result += hinv_error_gen_experiment(gen, u_resolution, order, samplesize/10); + + unur_free(gen); + + return result; +} /* end of chg_domain_experiment() */ + +/*****************************************************************************/ +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,60,(unur_hinv_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,66,(unur_hinv_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +/* cdf */ +n_tests_failed += (check_expected_NULL(TESTLOG,73,(unur_hinv_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,73,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + double stp[] = {1.,2.,3.}; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,84,(unur_hinv_set_order( par, 3 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,84,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,87,(unur_hinv_set_u_resolution( par, 1.e-8 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,87,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,90,(unur_hinv_set_cpoints(par,stp,3)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,90,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,93,(unur_hinv_set_boundary(par,1.,3.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,93,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,96,(unur_hinv_set_guidefactor( par, 2. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,96,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,99,(unur_hinv_set_max_intervals(par,10000)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,99,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + double stp[] = {1.,2.,3.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,108,(unur_hinv_set_order( par, 3 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,108,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,111,(unur_hinv_set_u_resolution( par, 1.e-8 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,111,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,114,(unur_hinv_set_cpoints(par,stp,3)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,114,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,117,(unur_hinv_set_boundary(par,1.,3.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,117,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,120,(unur_hinv_set_guidefactor( par, 2. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,120,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,123,(unur_hinv_set_max_intervals(par,10000)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,123,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + double stp[] = {1.,2.,-3.}; + distr = unur_distr_normal(fpar,2); + par = unur_hinv_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,134,(unur_hinv_set_order( par, 30 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,134,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,137,(unur_hinv_set_u_resolution( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,137,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,140,(unur_hinv_set_cpoints(par,stp,3)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,140,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,143,(unur_hinv_set_boundary(par,1.,-3.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,143,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,146,(unur_hinv_set_boundary(par,1.,UNUR_INFINITY)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,146,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,149,(unur_hinv_set_guidefactor( par, -2. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,149,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,152,(unur_hinv_set_max_intervals(par,0)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,152,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 162, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,166,(unur_hinv_get_n_intervals(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,166,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + unur_distr_cont_set_domain(distr,-1.,2.); + par = unur_hinv_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 178, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,182,(unur_hinv_chg_truncated( gen, 1., 0. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,182,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_hinv_chg_truncated( gen, -2., 0. ); +n_tests_failed += (check_errorcode(TESTLOG,185,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_hinv_chg_truncated( gen, 0., 10. ); +n_tests_failed += (check_errorcode(TESTLOG,188,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* exists */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_hinv_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 201, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,205,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,215,(unur_hinv_eval_approxinvcdf(gen,0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,215,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 221, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,225,(unur_hinv_eval_approxinvcdf(gen,0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,225,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid domain */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_hinv_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 231, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,235,(unur_hinv_eval_approxinvcdf(gen,1.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,235,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_negINFINITY(TESTLOG,238,(unur_hinv_eval_approxinvcdf(gen,-0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,238,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_hinv_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,251,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,257,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_hinv_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,269,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,273,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[] = {3.,4.}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_gamma(fpar,2); +unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); +par = unur_hinv_new(distr); +set_debug_flag(par); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,289,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,4.); domain = 2,infinity & \ + method = hinv; debug = 0x1" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,295,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_normal(NULL,0); +unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); +par = unur_hinv_new(distr); +unur_hinv_set_order(par,1); +unur_hinv_set_max_intervals(par,1000); +unur_hinv_set_u_resolution(par,0.001); +unur_hinv_set_boundary(par,2.,5.); +set_debug_flag(par); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,308,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal; domain = (2,inf) & \ + method = hinv; order = 1; max_intervals = 1000; u_resolution = 0.001; \ + boundary = (2,5); debug = 0x1" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,315,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[44]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 44 */ +{ +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); +} + +{ +fpm[0] = 0.5; +fpm[1] = 3.; +distr[28] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 0.3; +distr[29] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 0.5; +fpm[1] = 0.4; +distr[30] = unur_distr_beta(fpm,2); +} + +{ +distr[7] = unur_distr_cauchy(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); +} + +{ +distr[24] = unur_distr_exponential(NULL,0); +} + +{ +fpm[0] = 30.; +fpm[1] = -5.; +distr[25] = unur_distr_exponential(fpm,2); +} + +{ +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[16] = unur_distr_gamma(fpm,3); +} + +{ +fpm[0] = 0.5; +distr[31] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 0.2; +distr[32] = unur_distr_gamma(fpm,1); +} + +{ +distr[26] = unur_distr_laplace(NULL,0); +} + +{ +fpm[0] = -10.; +fpm[1] = 100.; +distr[27] = unur_distr_laplace(fpm,2); +} + +{ +distr[17] = unur_distr_normal(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); +} + +{ +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); +} + +{ +distr[20] = unur_distr_uniform(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 10.; +distr[35] = unur_distr_F(fpm,2); +} + +{ +fpm[0] = 2.; +fpm[1] = 10.; +distr[36] = unur_distr_F(fpm,2); +} + +{ +fpm[0] = 4.; +fpm[1] = 10.; +distr[37] = unur_distr_F(fpm,2); +} + +{ +fpm[0] = 10.; +fpm[1] = 10.; +distr[38] = unur_distr_F(fpm,2); +} + +{ +fpm[0] = 10.; +fpm[1] = 1; +distr[40] = unur_distr_F(fpm,2); +} + +{ +fpm[0] = 0.1; +fpm[1] = 10.; +distr[43] = unur_distr_F(fpm,2); +} + +{ +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[23] = unur_distr_beta(fpm,2); +unur_distr_cont_set_domain(distr[23],-2.,5.); +} + +{ +distr[33] = unur_distr_cont_new(); +unur_distr_cont_set_cdf( distr[33], sin_cdf ); +unur_distr_cont_set_pdf( distr[33], sin_pdf ); +unur_distr_cont_set_dpdf( distr[33], sin_dpdf ); +unur_distr_cont_set_domain( distr[33], -1., 1. ); +} + +{ +distr[34] = unur_distr_cont_new(); +unur_distr_cont_set_cdf( distr[34], sin0_cdf ); +unur_distr_cont_set_pdf( distr[34], sin0_pdf ); +unur_distr_cont_set_dpdf( distr[34], sin0_dpdf ); +unur_distr_cont_set_domain( distr[34], -1., 1. ); +} + +{ +distr[39] = unur_distr_cont_new(); +unur_distr_cont_set_cdfstr(distr[39], "(x<=2)*(0.5-x+0.5*x*x)+(x>2)*(-3.5+3*x-0.5*x*x)"); +unur_distr_cont_set_domain(distr[39],1.,3.); +unur_distr_set_name(distr[39],"triangular-string"); +} + +{ +distr[41] = unur_distr_cont_new(); +unur_distr_cont_set_cdfstr(distr[41], "(x<=2)*(0.5-x+0.5*x*x)+(x>2)*(-3.5+3*x-0.5*x*x)"); +unur_distr_cont_set_domain(distr[41],1.,5.); +unur_distr_set_name(distr[41],"triangular-invalid-string"); +} + +{ +distr[42] = unur_distr_cont_new(); +unur_distr_cont_set_cdfstr(distr[42], "(x<=2)*(0.5-x+0.5*x*x)+(x>2)*(-3.5+3*x-0.5*x*x)"); +unur_distr_cont_set_domain(distr[42],-1.,3.); +unur_distr_set_name(distr[42],"triangular-invalid-string"); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 396 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [29] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [31] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [32] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [35] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [36] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [37] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [38] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [40] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [43] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [33] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [34] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + if (gen) { +unur_hinv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +{ UNUR_DISTR *dg =NULL; +par = unur_hinv_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [39] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[39]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[39],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[39]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[39],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[39]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[39],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [41] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[41],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[41],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[41],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [42] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[42],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[42],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); +par = unur_hinv_new(distr_localcopy); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[42],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + unur_distr_free(distr[30]); + unur_distr_free(distr[31]); + unur_distr_free(distr[32]); + unur_distr_free(distr[33]); + unur_distr_free(distr[34]); + unur_distr_free(distr[35]); + unur_distr_free(distr[36]); + unur_distr_free(distr[37]); + unur_distr_free(distr[38]); + unur_distr_free(distr[39]); + unur_distr_free(distr[40]); + unur_distr_free(distr[41]); + unur_distr_free(distr[42]); + unur_distr_free(distr[43]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + +/*---------------------------------------------------------------------------*/ +/* [special] */ + +void test_special (void) +{ + /* set boolean to FALSE */ + int FAILED = 0; + + + + + + int samplesize = UERROR_SAMPLESIZE; + int errorsum = 0; + double fpar[4]; + double cpoints[10]; + + UNUR_DISTR *distr; + UNUR_PAR *par; + +/* start test */ +printf("[special "); fflush(stdout); +fprintf(TESTLOG,"\n[special]\n"); + +/* set stop watch */ +stopwatch_lap(&watch); + + + + /* test for maximal u-error */ + printf("\ntest maximal u-error: "); + fprintf(TESTLOG,"\nTest maximal u-error:\n"); + + distr = unur_distr_normal(NULL,0); + par = unur_hinv_new(distr); + errorsum += hinv_error_experiment(par,samplesize); + unur_distr_free(distr); + + distr = unur_distr_cauchy(NULL,0); + par = unur_hinv_new(distr); + errorsum += hinv_error_experiment(par,samplesize); + unur_distr_free(distr); + + distr = unur_distr_exponential(NULL,0); + par = unur_hinv_new(distr); + errorsum += hinv_error_experiment(par,samplesize); + unur_distr_free(distr); + + fpar[0]= 5.; + distr = unur_distr_gamma(fpar,1); + par = unur_hinv_new(distr); + errorsum += hinv_error_experiment(par,samplesize); + unur_distr_free(distr); + + fpar[0]= 0.5; + distr = unur_distr_gamma(fpar,1); + par = unur_hinv_new(distr); + errorsum += hinv_error_experiment(par,samplesize); + unur_distr_free(distr); + + fpar[0]=2.; fpar[1]=2.;fpar[2]= 0.; fpar[3]=1.; + distr = unur_distr_beta(fpar,4); + par = unur_hinv_new(distr); + errorsum += hinv_error_experiment(par,samplesize); + unur_distr_free(distr); + + fpar[0]=0.3; fpar[1]=3.;fpar[2]= 0.; fpar[3]=1.; + distr = unur_distr_beta(fpar,4); + par = unur_hinv_new(distr); + errorsum += hinv_error_experiment(par,samplesize); + unur_distr_free(distr); + + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"sin-example"); + unur_distr_cont_set_cdf( distr, sin_cdf ); + unur_distr_cont_set_pdf( distr, sin_pdf ); + unur_distr_cont_set_dpdf( distr, sin_dpdf ); + unur_distr_cont_set_domain( distr, -1., 1. ); + cpoints[0]= -0.75; + cpoints[1]= -0.25; + cpoints[2]= 0.25; + cpoints[3]= 0.75; + par = unur_hinv_new(distr); + unur_hinv_set_cpoints(par, cpoints, 4); + errorsum += hinv_error_experiment(par,samplesize); + unur_distr_free(distr); + + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"sin-0-example"); + unur_distr_cont_set_cdf( distr, sin0_cdf ); + unur_distr_cont_set_pdf( distr, sin0_pdf ); + unur_distr_cont_set_dpdf( distr, sin0_dpdf ); + unur_distr_cont_set_domain( distr, -1., 0.5 ); + cpoints[0]= -0.75; + cpoints[1]= -0.5; + cpoints[2]= 0.; + cpoints[3]= 0.25; + par = unur_hinv_new(distr); + unur_hinv_set_cpoints(par, cpoints, 4); + errorsum += hinv_error_experiment(par,samplesize); + unur_distr_free(distr); + + + /* extra test for changeing the domain of the generator object */ + + printf("\ntest unur_chg_truncated(): "); + fprintf(TESTLOG,"\nTests unur_chg_truncated():\n\n"); + + printf(" normal"); + + distr = unur_distr_normal(NULL,0); + par = unur_hinv_new(distr); + + errorsum += chg_domain_experiment(par,samplesize); + + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); + + /****/ + + printf(" sinus1"); + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"sin-example"); + unur_distr_cont_set_cdf( distr, sin_cdf ); + unur_distr_cont_set_pdf( distr, sin_pdf ); + unur_distr_cont_set_dpdf( distr, sin_dpdf ); + unur_distr_cont_set_domain( distr, -1., 1. ); + cpoints[0]= -0.75; + cpoints[1]= -0.25; + cpoints[2]= 0.25; + cpoints[3]= 0.75; + par = unur_hinv_new(distr); + unur_hinv_set_cpoints(par, cpoints, 4); + + errorsum += chg_domain_experiment(par,samplesize); + + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); + + /****/ + + printf(" sinus2"); + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"sin-0-example"); + unur_distr_cont_set_cdf( distr, sin0_cdf ); + unur_distr_cont_set_pdf( distr, sin0_pdf ); + unur_distr_cont_set_dpdf( distr, sin0_dpdf ); + unur_distr_cont_set_domain( distr, -1., 0.5 ); + cpoints[0]= -0.75; + cpoints[1]= -0.5; + cpoints[2]= 0.; + cpoints[3]= 0.25; + par = unur_hinv_new(distr); + unur_hinv_set_cpoints(par, cpoints, 4); + + errorsum += chg_domain_experiment(par,samplesize); + + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); + + + /* test finished */ + FAILED = (errorsum < 2) ? 0 : 1; + + + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (FAILED) ? 0 : 1; + (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_special() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_hinv_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_hinv.conf b/vendor/unuran-1.11.0/tests/t_hinv.conf new file mode 100644 index 0000000..6284d98 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_hinv.conf @@ -0,0 +1,1030 @@ +############################################################################ + +[main] + +[main - data:] + +# method +method: HINV + +[main - header:] + +\#include + +/* constants */ + +## \#define UERROR_SAMPLESIZE (100000) +\#define UERROR_SAMPLESIZE (10000) + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* \#define SEED (298346) */ + +\#ifndef M_PI +\#define M_PI 3.14159265358979323846264338328 /* pi */ +\#endif + +\#define set_debug_flag(par) \ + do { \ + if (fullcheck) unur_set_debug((par),~0u); \ + else unur_set_debug((par),1u); \ + } while (0); + +/* prototypes */ + +double sin_cdf( double x, const UNUR_DISTR *distr ); +double sin_pdf( double x, const UNUR_DISTR *distr ); +double sin_dpdf( double x, const UNUR_DISTR *distr ); + +double sin0_cdf( double x, const UNUR_DISTR *distr ); +double sin0_pdf( double x, const UNUR_DISTR *distr ); +double sin0_dpdf( double x, const UNUR_DISTR *distr ); + + +int hinv_error_experiment( UNUR_PAR *par, int samplesize ); + +int chg_domain_experiment( UNUR_PAR *par, int samplesize ); + +int hinv_error_gen_experiment( UNUR_GEN *gen, + double u_resolution, int order, int samplesize ); + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_cont_new(); ] + +/* cdf */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + double stp[] = {1.,2.,3.}; + par = NULL; ] + +~_order( par, 3 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_u_resolution( par, 1.e-8 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_cpoints(par,stp,3); + --> expected_setfailed --> UNUR_ERR_NULL + +~_boundary(par,1.,3.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_guidefactor( par, 2. ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_max_intervals(par,10000); + --> expected_setfailed --> UNUR_ERR_NULL + +[set - invalid parameter object: + double fpar[2] = {0.,1.}; + double stp[] = {1.,2.,3.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); ] + +~_order( par, 3 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_u_resolution( par, 1.e-8 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_cpoints(par,stp,3); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_boundary(par,1.,3.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_guidefactor( par, 2. ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_max_intervals(par,10000); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + +[set - invalid parameters: + double fpar[2] = {0.,1.}; + double stp[] = {1.,2.,-3.}; + distr = unur_distr_normal(fpar,2); + par = unur_hinv_new(distr); ] + +~_order( par, 30 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_u_resolution( par, 1. ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_cpoints(par,stp,3); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_boundary(par,1.,-3.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_boundary(par,1.,UNUR_INFINITY); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_guidefactor( par, -2. ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_max_intervals(par,0); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + +############################################################################# + +[get] + +[get - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + gen = unur_init(par); <-- ! NULL ] + +~_n_intervals(gen); + --> expected_zero --> UNUR_ERR_GEN_INVALID + + +############################################################################# + +[chg] + +[chg - invalid generator object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + unur_distr_cont_set_domain(distr,-1.,2.); + par = unur_hinv_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_truncated( gen, 1., 0. ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +~_truncated( gen, -2., 0. ); + --> none --> UNUR_ERR_DISTR_SET + +~_truncated( gen, 0., 10. ); + --> none --> UNUR_ERR_DISTR_SET + + +############################################################################# + +# [init] + +############################################################################# + +[reinit] + +[reinit - exists: + distr = unur_distr_normal(NULL,0); + par = unur_hinv_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - invalid NULL ptr: + gen = NULL; ] + +unur_hinv_eval_approxinvcdf(gen,0.5); + --> expected_INFINITY --> UNUR_ERR_NULL + +#..................................................................... + +[sample - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + gen = unur_init(par); <-- ! NULL ] + +unur_hinv_eval_approxinvcdf(gen,0.5); + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + + +[sample - invalid domain: + distr = unur_distr_normal(NULL,0); + par = unur_hinv_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +unur_hinv_eval_approxinvcdf(gen,1.5); + --> expected_INFINITY --> UNUR_ERR_DOMAIN + +unur_hinv_eval_approxinvcdf(gen,-0.5); + --> expected_negINFINITY --> UNUR_ERR_DOMAIN + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_hinv_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare reinit: + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_hinv_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + double fpar[] = {3.,4.}; + distr = NULL; + par = NULL; + gen = NULL; ] + + +distr = unur_distr_gamma(fpar,2); +unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); +par = unur_hinv_new(distr); +set_debug_flag(par); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,4.); domain = 2,infinity & \ + method = hinv; debug = 0x1" ); + -->compare_sequence_gen + + +unur_free(gen); gen = NULL; +distr = unur_distr_normal(NULL,0); +unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); +par = unur_hinv_new(distr); +unur_hinv_set_order(par,1); +unur_hinv_set_max_intervals(par,1000); +unur_hinv_set_u_resolution(par,0.001); +unur_hinv_set_boundary(par,2.,5.); +set_debug_flag(par); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal; domain = (2,inf) & \ + method = hinv; order = 1; max_intervals = 1000; u_resolution = 0.001; \ + boundary = (2,5); debug = 0x1" ); + -->compare_sequence_gen + + +## not tested: +## int unur_hinv_set_cpoints( UNUR_PAR *parameters, const double *stp, int n_stp ); +## int unur_hinv_set_guidefactor( UNUR_PAR *parameters, double factor ); + + +############################################################################# + +[validate] + +[validate - generators:] + +# linear with default precision +par[0] = unur_hinv_new(@distr@); +unur_hinv_set_order(par,1); +unur_hinv_set_u_resolution(par,1.e-8); +set_debug_flag(par); + +# cubic with precision 1.e-10 +par[1] = unur_hinv_new(@distr@); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + +# quintic with precision 1.e-10 +par[2] = unur_hinv_new(@distr@); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); + +# cubic with truncated distribution +par[3] = unur_hinv_new(@distr@); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +unur_hinv_chg_truncated(gen,0.5,0.9); + +# quintic with precision 1.e-12 +par[4] = unur_hinv_new(@distr@); +unur_hinv_set_order(par,5); +unur_hinv_set_u_resolution(par,1.e-12); +set_debug_flag(par); + +# cubic with starting construction points for distribution 33 +par[5] = unur_hinv_new(@distr@); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.25; +fpm[2]= 0.25; +fpm[3]= 0.75; +unur_hinv_set_cpoints(par,fpm,4); + +# cubic with starting construction points for distribution 34 +par[6] = unur_hinv_new(@distr@); +unur_hinv_set_order(par,3); +unur_hinv_set_u_resolution(par,1.e-10); +set_debug_flag(par); +fpm[0]= -0.75; +fpm[1]= -0.5; +fpm[2]= 0.; +fpm[3]= 0.25; +unur_hinv_set_cpoints(par,fpm,4); + +# default variant but reinitialized with changed domain +{ UNUR_DISTR *dg =NULL; +par[7] = unur_hinv_new(@distr@); +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + +# default variant but reinitialized with changed pdf parameters +{ UNUR_DISTR *dg =NULL; +par[8] = unur_hinv_new(@distr@); +fpm[0] = 1.; +fpm[1] = 4.; +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_reinit(gen); } + + +[validate - distributions:] + +# Beta distributions +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); + +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); + +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); + +fpm[0] = 0.5; +fpm[1] = 3.; +distr[28] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 0.3; +distr[29] = unur_distr_beta(fpm,2); + +fpm[0] = 0.5; +fpm[1] = 0.4; +distr[30] = unur_distr_beta(fpm,2); + +# Cauchy distributions +distr[7] = unur_distr_cauchy(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); + +# Exponential distributions +distr[24] = unur_distr_exponential(NULL,0); + +fpm[0] = 30.; +fpm[1] = -5.; +distr[25] = unur_distr_exponential(fpm,2); + +# Gamma distributions +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); + +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); + +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); + +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); + +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); + +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[16] = unur_distr_gamma(fpm,3); + +fpm[0] = 0.5; +distr[31] = unur_distr_gamma(fpm,1); + +fpm[0] = 0.2; +distr[32] = unur_distr_gamma(fpm,1); + +# Laplace distributions +distr[26] = unur_distr_laplace(NULL,0); + +fpm[0] = -10.; +fpm[1] = 100.; +distr[27] = unur_distr_laplace(fpm,2); + +# Normal distributions +distr[17] = unur_distr_normal(NULL,0); + +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); + +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); + +# Uniform distributions +distr[20] = unur_distr_uniform(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); + +# F distributions +fpm[0] = 1.; +fpm[1] = 10.; +distr[35] = unur_distr_F(fpm,2); + +fpm[0] = 2.; +fpm[1] = 10.; +distr[36] = unur_distr_F(fpm,2); + +fpm[0] = 4.; +fpm[1] = 10.; +distr[37] = unur_distr_F(fpm,2); + +fpm[0] = 10.; +fpm[1] = 10.; +distr[38] = unur_distr_F(fpm,2); + +fpm[0] = 10.; +fpm[1] = 1; +distr[40] = unur_distr_F(fpm,2); + +fpm[0] = 0.1; +fpm[1] = 10.; +distr[43] = unur_distr_F(fpm,2); + +# truncated distributions +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); + +# domain exceeds support of pdf +fpm[0] = 3.; +fpm[1] = 4.; +distr[23] = unur_distr_beta(fpm,2); +unur_distr_cont_set_domain(distr[23],-2.,5.); + +# distribution with vanishing density +distr[33] = unur_distr_cont_new(); +unur_distr_cont_set_cdf( distr[33], sin_cdf ); +unur_distr_cont_set_pdf( distr[33], sin_pdf ); +unur_distr_cont_set_dpdf( distr[33], sin_dpdf ); +unur_distr_cont_set_domain( distr[33], -1., 1. ); + +# distribution with vanishing density +distr[34] = unur_distr_cont_new(); +unur_distr_cont_set_cdf( distr[34], sin0_cdf ); +unur_distr_cont_set_pdf( distr[34], sin0_pdf ); +unur_distr_cont_set_dpdf( distr[34], sin0_dpdf ); +unur_distr_cont_set_domain( distr[34], -1., 1. ); + +# triangular distribution, defined by CDF via string API +distr[39] = unur_distr_cont_new(); +unur_distr_cont_set_cdfstr(distr[39], "(x<=2)*(0.5-x+0.5*x*x)+(x>2)*(-3.5+3*x-0.5*x*x)"); +unur_distr_cont_set_domain(distr[39],1.,3.); +unur_distr_set_name(distr[39],"triangular-string"); + +# triangular distribution with invalid CDF via string API +distr[41] = unur_distr_cont_new(); +unur_distr_cont_set_cdfstr(distr[41], "(x<=2)*(0.5-x+0.5*x*x)+(x>2)*(-3.5+3*x-0.5*x*x)"); +unur_distr_cont_set_domain(distr[41],1.,5.); +unur_distr_set_name(distr[41],"triangular-invalid-string"); + +# triangular distribution with invalid CDF via string API +distr[42] = unur_distr_cont_new(); +unur_distr_cont_set_cdfstr(distr[42], "(x<=2)*(0.5-x+0.5*x*x)+(x>2)*(-3.5+3*x-0.5*x*x)"); +unur_distr_cont_set_domain(distr[42],-1.,3.); +unur_distr_set_name(distr[42],"triangular-invalid-string"); + + +# number of distributions: 44 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... linear with default precision +# [1] ... cubic with precision 1.e-10 +# [2] ... quintic with precision 1.e-10 +# [3] ... cubic with truncated distribution on [0.5,0.9] +# [4] ... quintic with precision 1.e-12 +# [5] ... cubic with starting construction points for distribution 34 +# [6] ... cubic with starting construction points for distribution 34 +# [7] ... default variant but reinitialized with changed domain +# [8] ... default variant but reinitialized with changed pdf parameters +# +# 0 1 2 3 4 5 6 7 8 # distribution +#------------------------------------- +x <0> + + + + + + + + + # beta (1, 2) + <1> + + + + + + + + + # beta (1, 5) +x <2> + + + . + + + + + # beta (1, 100) + <3> + + + + + + + + + # beta (3, 4) + <4> + + + . + + + + + # beta (5, 100) + <5> + + + + + + + + + # beta (500, 300) + <6> + + + + + + + + + # beta (5, 10, -3, 15) + <28> + + + + + + + + + # beta (0.5, 3) + <29> + + + + + + + + + # beta (5, 0.3) + <30> + + + + + + + + + # beta (0.5, 0.4) + <7> + + + + + + + + + # cauchy () + <8> + + + + + + + + + # cauchy (1, 20) + <24> + + + + + + + + + # exponential () + <25> + + + + + + + + + # exponential (30, -5) +x <9> + + + + + + + + + # gamma (1) + <10> + + + + + + + + + # gamma (2) + <11> + + + + + + + + + # gamma (3) + <12> + + + + + + + + + # gamma (10) +x<13> + + + . + + + . + # gamma (1000) + <14> + + + . + + + + + # gamma (5, 1000, 0) +x<15> + + + . + + + . + # gamma (5, 1e-05, 0) +x<16> + + + . + + + . + # gamma (5, 10, 100000) + <31> + + + + + + + + + # gamma (0.5) + <32> + + + + + + + . + # gamma (0.2) + <26> + + + + + + + + + # laplace () + <27> + + + + + + + . + # laplace (-10, 100) + <17> + + + + + + + + + # normal () +x<18> + + + . + + + . + # normal (1, 1e-05) + <19> + + + + + + + + + # normal (1, 1e+05) + <20> + + + + + + + + + # uniform () + <21> + + + . + + + - + # uniform (1, 20) + <35> + + + + + + + + + # F (1, 10) + <36> + + + + + + + + + # F (2, 10) + <37> + + + + + + + + + # F (4, 10) + <38> + + + + + + + + + # F (10, 10) + <40> + + + + + + + + + # F (10, 1) + <43> + + + + + + + + + # F (0.1, 10) + + <22> + + + + + + + . . # cauchy () - truncated + <23> + + + + + + + + . # beta () - domain superset of support + + <33> + + + + + + . + . # distribution with vanishing PDF + <34> + + + + + . + + . # distribution with vanishing PDF + <39> + + + . . . . . . # triangular distribution + <41> 0 0 0 . . . . . . # invalid triangular distribution + <42> 0 0 0 . . . . . . # invalid triangular distribution + +# Remark: +# No tests with truncated distribution where the call +# unur_hinv_chg_truncated() fails since the CDF values at the +# boundaries are too close. +# generator 6 has the cpoints for the special distribution 33 +# generator 6 has the cpoints for the special distribution 34 + +############################################################################# + +[special] + +[special - decl:] + + int samplesize = UERROR_SAMPLESIZE; + int errorsum = 0; + double fpar[4]; + double cpoints[10]; + + UNUR_DISTR *distr; + UNUR_PAR *par; + +[special - start:] + + /* test for maximal u-error */ + printf("\ntest maximal u-error: "); + fprintf(TESTLOG,"\nTest maximal u-error:\n"); + + distr = unur_distr_normal(NULL,0); + par = unur_hinv_new(distr); + errorsum += hinv_error_experiment(par,samplesize); + unur_distr_free(distr); + + distr = unur_distr_cauchy(NULL,0); + par = unur_hinv_new(distr); + errorsum += hinv_error_experiment(par,samplesize); + unur_distr_free(distr); + + distr = unur_distr_exponential(NULL,0); + par = unur_hinv_new(distr); + errorsum += hinv_error_experiment(par,samplesize); + unur_distr_free(distr); + + fpar[0]= 5.; + distr = unur_distr_gamma(fpar,1); + par = unur_hinv_new(distr); + errorsum += hinv_error_experiment(par,samplesize); + unur_distr_free(distr); + + fpar[0]= 0.5; + distr = unur_distr_gamma(fpar,1); + par = unur_hinv_new(distr); + errorsum += hinv_error_experiment(par,samplesize); + unur_distr_free(distr); + + fpar[0]=2.; fpar[1]=2.;fpar[2]= 0.; fpar[3]=1.; + distr = unur_distr_beta(fpar,4); + par = unur_hinv_new(distr); + errorsum += hinv_error_experiment(par,samplesize); + unur_distr_free(distr); + + fpar[0]=0.3; fpar[1]=3.;fpar[2]= 0.; fpar[3]=1.; + distr = unur_distr_beta(fpar,4); + par = unur_hinv_new(distr); + errorsum += hinv_error_experiment(par,samplesize); + unur_distr_free(distr); + + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"sin-example"); + unur_distr_cont_set_cdf( distr, sin_cdf ); + unur_distr_cont_set_pdf( distr, sin_pdf ); + unur_distr_cont_set_dpdf( distr, sin_dpdf ); + unur_distr_cont_set_domain( distr, -1., 1. ); + cpoints[0]= -0.75; + cpoints[1]= -0.25; + cpoints[2]= 0.25; + cpoints[3]= 0.75; + par = unur_hinv_new(distr); + unur_hinv_set_cpoints(par, cpoints, 4); + errorsum += hinv_error_experiment(par,samplesize); + unur_distr_free(distr); + + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"sin-0-example"); + unur_distr_cont_set_cdf( distr, sin0_cdf ); + unur_distr_cont_set_pdf( distr, sin0_pdf ); + unur_distr_cont_set_dpdf( distr, sin0_dpdf ); + unur_distr_cont_set_domain( distr, -1., 0.5 ); + cpoints[0]= -0.75; + cpoints[1]= -0.5; + cpoints[2]= 0.; + cpoints[3]= 0.25; + par = unur_hinv_new(distr); + unur_hinv_set_cpoints(par, cpoints, 4); + errorsum += hinv_error_experiment(par,samplesize); + unur_distr_free(distr); + + + /* extra test for changeing the domain of the generator object */ + + printf("\ntest unur_chg_truncated(): "); + fprintf(TESTLOG,"\nTests unur_chg_truncated():\n\n"); + + printf(" normal"); + + distr = unur_distr_normal(NULL,0); + par = unur_hinv_new(distr); + + errorsum += chg_domain_experiment(par,samplesize); + + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); + + /****/ + + printf(" sinus1"); + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"sin-example"); + unur_distr_cont_set_cdf( distr, sin_cdf ); + unur_distr_cont_set_pdf( distr, sin_pdf ); + unur_distr_cont_set_dpdf( distr, sin_dpdf ); + unur_distr_cont_set_domain( distr, -1., 1. ); + cpoints[0]= -0.75; + cpoints[1]= -0.25; + cpoints[2]= 0.25; + cpoints[3]= 0.75; + par = unur_hinv_new(distr); + unur_hinv_set_cpoints(par, cpoints, 4); + + errorsum += chg_domain_experiment(par,samplesize); + + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); + + /****/ + + printf(" sinus2"); + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"sin-0-example"); + unur_distr_cont_set_cdf( distr, sin0_cdf ); + unur_distr_cont_set_pdf( distr, sin0_pdf ); + unur_distr_cont_set_dpdf( distr, sin0_dpdf ); + unur_distr_cont_set_domain( distr, -1., 0.5 ); + cpoints[0]= -0.75; + cpoints[1]= -0.5; + cpoints[2]= 0.; + cpoints[3]= 0.25; + par = unur_hinv_new(distr); + unur_hinv_set_cpoints(par, cpoints, 4); + + errorsum += chg_domain_experiment(par,samplesize); + + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); + + + /* test finished */ + FAILED = (errorsum < 2) ? 0 : 1; + + +############################################################################# + +[verbatim] + +/*---------------------------------------------------------------------------*/ +/* Example of a distribution with f(x)=0 at x=-0.25 and x=0.75 */ +/* */ +/* / (1 +sin(2 Pi x))/2 if |x| <= 1 */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ +double sin_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (fabs(x) > 1.) + return 0.; + else + return (0.5*(1.+sin((2.*M_PI)*x))); +} /* end of sin_pdf() */ + +/* The derivative of the PDF of our distribution: */ +double sin_dpdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (fabs(x) > 1.) + return 0.; + else + return (M_PI*cos((2.*M_PI)*x)); +} /* end of sin_dpdf() */ + +/* The CDF of our distribution: */ +double sin_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x < -1.) + return 0.; + else if(x<=1.) + return (1.+2.*M_PI*(1+x)-cos((2.*M_PI)*x))/(4.*M_PI); + else return 1.; +} /* end of sin_cdf() */ + +/*---------------------------------------------------------------------------*/ + +/* Example of a distribution with f(x)=0 in (-0.5,0) */ +/* */ +/* / Max(sin(2 Pi x)),0)Pi/2 if -1 < x <0.5 */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ +double sin0_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x < -1.) return 0.; + if (x <= -0.5) return sin((2.*M_PI)*x)*0.5*M_PI; + if (x < 0.) return 0.; + if (x <= 0.5) return sin((2.*M_PI)*x)*0.5*M_PI; + return 0.; +} /* end of sin0_pdf() */ + +/* The derivative of the PDF of our distribution: */ +double sin0_dpdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x < -1.) return 0.; + if (x <= -0.5) return cos((2.*M_PI)*x)*M_PI*M_PI; + if (x < 0.) return 0.; + if (x <= 0.5) return cos((2.*M_PI)*x)*M_PI*M_PI; + return 0.; +} /* end of sin0_dpdf() */ + +/* The CDF of our distribution: */ +double sin0_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x < -1.) return 0.; + if(x<= -0.5) return 0.25*(1-cos((2.*M_PI)*x)); + if (x < 0.) return 0.5; + if (x <= 0.5) return 0.75-0.25*cos((2.*M_PI)*x); + return 1.; +} /* end of sin0_cdf() */ + +############################################################################# +# +# routines for special tests +# +############################################################################# + + +/*****************************************************************************/ +/* run unur_test_u_error for a particular generator object and print result */ + +int +hinv_error_gen_experiment( UNUR_GEN *gen, /* generator object */ + double u_resolution, /* maximal tolerated u-error */ + int order, /* order of polynomial */ + int samplesize ) /* sample size for error experiment */ + /* returns 0 if maxerror < u_resolution, errorcode otherwise */ +{ + int i, nfpar; + const double *fpar; + const UNUR_DISTR *distr = unur_get_distr(gen); + const char *genid = unur_get_genid(gen); + double score; + + /* print data about distribution */ + fprintf(TESTLOG,"%s: %s distribution",genid,unur_distr_get_name(distr)); + nfpar = unur_distr_cont_get_pdfparams(distr,&fpar); + if (nfpar) { + fprintf(TESTLOG," with parameters "); + for(i=0;i 1.e-13; u_resolution *= 0.01 ) { + for ( order=(u_resolution<1.e-9 ? 3:1); order<=5; order+=2) { + + /* make a working copy */ + par_clone = _unur_par_clone(par); + + /* create generator object */ + unur_hinv_set_order(par_clone,order); + unur_hinv_set_u_resolution(par_clone,u_resolution); + set_debug_flag(par_clone); + gen = unur_init(par_clone); + + /* run test */ + errorsum += hinv_error_gen_experiment(gen, u_resolution, order, samplesize); + fprintf(TESTLOG,"\n"); + + /* clear memory */ + unur_free(gen); + } + } + + unur_par_free(par); + + return errorsum; +} /* end of hinv_error_experiment() */ + +/*****************************************************************************/ +/* run test with truncated distributions */ + +int +chg_domain_experiment( UNUR_PAR *par, /* generator object */ + int samplesize ) /* sample size for experiment */ + /* returns 0 if maxerror < u_resolution, errorcode otherwise */ +{ + int k; + int result = 0; + UNUR_GEN *gen; /* generator object */ + double left, right; /* border of userdefined original domain */ + double newleft, newright; + + double u_resolution = 1.e-10; /* maximal tolerated u-error */ + int order = 3; /* order of polynomial */ + + unur_hinv_set_order(par,order); + unur_hinv_set_u_resolution(par,u_resolution); + gen = unur_init(par); + + unur_distr_cont_get_domain(unur_get_distr(gen), &left, &right ); + if (left <= UNUR_INFINITY) + left = unur_hinv_eval_approxinvcdf(gen, 1.e-10); + if (right >= UNUR_INFINITY) + right = unur_hinv_eval_approxinvcdf(gen, 1-1.e-10); + + for(k=1; k<=10;k++){ + newleft = left + k*0.05*(right-left); + newright = right - k*0.04*(right-left); + unur_hinv_chg_truncated(gen, newleft, newright); + result += hinv_error_gen_experiment(gen, u_resolution, order, samplesize/10); + } + + unur_hinv_chg_truncated(gen, left, right); + result += hinv_error_gen_experiment(gen, u_resolution, order, samplesize/10); + + unur_free(gen); + + return result; +} /* end of chg_domain_experiment() */ + +/*****************************************************************************/ diff --git a/vendor/unuran-1.11.0/tests/t_hist.c b/vendor/unuran-1.11.0/tests/t_hist.c new file mode 100644 index 0000000..6e48896 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_hist.c @@ -0,0 +1,718 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for HIST + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_hist_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + +UNUR_DISTR *get_distr_with_data( void ); +UNUR_DISTR *get_distr_with_data2( void ); + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/*---------------------------------------------------------------------------*/ + +UNUR_DISTR *get_distr_with_data( void ) +{ +#define HIST_SIZE 20 + double hist[HIST_SIZE]; + UNUR_DISTR *distr; + int i; + + unur_urng_fish_reset(NULL); + + for (i=0; itime = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* run init */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = get_distr_with_data(); + par = unur_hist_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 72, gen ); + + +unur_reset_errno(); +; +n_tests_failed += (check_errorcode(TESTLOG,76,0x0u)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare variants */ +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_DISTR *distr1 = get_distr_with_data(); + UNUR_DISTR *distr2 = get_distr_with_data2(); + par = unur_hist_new(distr1); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 101, gen ); + + +unur_reset_errno(); +/* default generator object */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,105,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* variant */ +unur_free(gen); +par = unur_hist_new(distr2); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen(TESTLOG,111,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr1); +unur_distr_free(distr2); +unur_free(gen); +} + +{ /* compare variant */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; + double bins[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.,10.}; + distr = unur_distr_cemp_new(); + unur_distr_cemp_set_hist_prob(distr,hist,9); + unur_distr_cemp_set_hist_domain(distr,1.,10.); + par = unur_hist_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 124, gen ); + + +unur_reset_errno(); +/* default generator object */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,128,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* variant */ +unur_free(gen); +unur_distr_free(distr); +distr = unur_distr_cemp_new(); +unur_distr_cemp_set_hist_prob(distr,hist,9); +unur_distr_cemp_set_hist_bins(distr,bins,10); +unur_distr_cemp_set_hist_domain(distr,1.,100.); +par = unur_hist_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen(TESTLOG,139,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; + double bins[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.,10.}; + distr = unur_distr_cemp_new(); + unur_distr_cemp_set_hist_prob(distr,hist,9); + unur_distr_cemp_set_hist_bins(distr,bins,10); + par = unur_hist_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 150, gen ); + + +unur_reset_errno(); +/* default generator object */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,154,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,160,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + distr = get_distr_with_data(); + par = unur_hist_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 167, gen ); + + +unur_reset_errno(); +/* default generator object */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,171,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,177,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; + distr = unur_distr_cemp_new(); + unur_distr_cemp_set_hist_prob(distr,hist,9); + unur_distr_cemp_set_hist_domain(distr,1.,10.); + par = unur_hist_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 186, gen ); + + +unur_reset_errno(); +/* default generator object */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,190,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* string API */ +unur_free(gen); +gen = unur_str2gen("cemp; hist_prob=(0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1); \ + hist_domain=(1.,10.) & method = hist"); +n_tests_failed += (compare_sequence_gen(TESTLOG,196,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* string API */ +unur_free(gen); +gen = unur_str2gen("cemp; hist_prob=(0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1); \ + hist_bins=(1.,2.,3.,4.,5.,6.,7.,8.,9.,10.) & method = hist"); +n_tests_failed += (compare_sequence_gen(TESTLOG,202,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[2]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 2 */ +{ +{ double pv[1000]; + UNUR_DISTR *normal_dist; + int i; + double xmin, xmax; + double fxmin, fxmax; + /* xmin = -5.; */ + fxmin = 0.; + normal_dist = unur_distr_normal(NULL,0); + for (i=0; i<1000; i++) { + xmax = -5. + i/100.; + fxmax = unur_distr_cont_eval_cdf(xmax,normal_dist); + pv[i] = fxmax - fxmin; + /* xmin = xmax; */ + fxmin = fxmax; } + unur_distr_free(normal_dist); + distr[0] = unur_distr_cemp_new(); + unur_distr_cemp_set_hist(distr[0],pv,1000,-5.,5.); } +} + +{ +{ double pv[1000]; + double bins[1001]; + UNUR_DISTR *normal_dist; + int i; + double xmin, xmax; + double fxmin, fxmax; + normal_dist = unur_distr_normal(NULL,0); + bins[500] = 0.; + for (i=501; i<=1000; i++) + bins[i] = bins[i-1] + (i-500)/25000.; + for (i=499; i>=0; i--) + bins[i] = bins[i+1] + (i-500)/25000.; + xmin = bins[0]; + fxmin = unur_distr_cont_eval_cdf(xmin,normal_dist); + pv[0] = unur_distr_cont_eval_cdf(bins[0],normal_dist); + for (i=0; i<1000; i++) { + xmax = bins[i+1]; + fxmax = unur_distr_cont_eval_cdf(xmax,normal_dist); + pv[i] = fxmax - fxmin; + xmin = xmax; + fxmin = fxmax; } + unur_distr_free(normal_dist); + distr[1] = unur_distr_cemp_new(); + unur_distr_cemp_set_hist_prob(distr[1],pv,1000); + unur_distr_cemp_set_hist_bins(distr[1],bins,1001); } +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 2 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hist_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hist_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_hist_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_hist.conf b/vendor/unuran-1.11.0/tests/t_hist.conf new file mode 100644 index 0000000..50446e7 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_hist.conf @@ -0,0 +1,332 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: HIST + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +UNUR_DISTR *get_distr_with_data( void ); +UNUR_DISTR *get_distr_with_data2( void ); + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + + +[new - invalid distribution type: + distr = unur_distr_cont_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + + +[new - data missing in distribution object: + distr = unur_distr_cemp_new(); /* no data given */ ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + + +[new - data missing in distribution object: + double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; + distr = unur_distr_cemp_new(); + unur_distr_cemp_set_hist_prob(distr,hist,9); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + + +############################################################################# + +# [set] + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################# + +[init] + +[init - run init: + distr = get_distr_with_data(); + par = unur_hist_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +# this should be o.k. + --> none --> 0x0u + +############################################################################# + +[reinit] + +#[reinit - does not exist: +# distr = get_distr_with_data(); +# par = unur_hist_new(distr); +# gen = unur_init( par ); <-- ! NULL ] +# +#unur_reinit( gen ); +# --> expected_setfailed --> UNUR_ERR_NO_REINIT +# +#unur_sample_cont( gen ); +# --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION +# + +############################################################################# + +[sample] + +[sample - compare variants: + UNUR_DISTR *distr1 = get_distr_with_data(); + UNUR_DISTR *distr2 = get_distr_with_data2(); + par = unur_hist_new(distr1); + gen = unur_init( par ); <-- ! NULL ] + +/* default generator object */ + -->compare_sequence_gen_start + +/* variant */ +unur_free(gen); +par = unur_hist_new(distr2); +gen = unur_init(par); + -->compare_sequence_gen + +unur_distr_free(distr1); +unur_distr_free(distr2); + +# ........................................................................... + +[sample - compare variant: + double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; + double bins[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.,10.}; + distr = unur_distr_cemp_new(); + unur_distr_cemp_set_hist_prob(distr,hist,9); + unur_distr_cemp_set_hist_domain(distr,1.,10.); + par = unur_hist_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* default generator object */ + -->compare_sequence_gen_start + +/* variant */ +unur_free(gen); +unur_distr_free(distr); +distr = unur_distr_cemp_new(); +unur_distr_cemp_set_hist_prob(distr,hist,9); +unur_distr_cemp_set_hist_bins(distr,bins,10); +unur_distr_cemp_set_hist_domain(distr,1.,100.); +par = unur_hist_new(distr); +gen = unur_init(par); + -->compare_sequence_gen + +# ........................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; + double bins[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.,10.}; + distr = unur_distr_cemp_new(); + unur_distr_cemp_set_hist_prob(distr,hist,9); + unur_distr_cemp_set_hist_bins(distr,bins,10); + par = unur_hist_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* default generator object */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +# ........................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + distr = get_distr_with_data(); + par = unur_hist_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* default generator object */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +# ........................................................................... + +[sample - compare stringparser: + double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; + distr = unur_distr_cemp_new(); + unur_distr_cemp_set_hist_prob(distr,hist,9); + unur_distr_cemp_set_hist_domain(distr,1.,10.); + par = unur_hist_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* default generator object */ + -->compare_sequence_gen_start + +/* string API */ +unur_free(gen); +gen = unur_str2gen("cemp; hist_prob=(0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1); \ + hist_domain=(1.,10.) & method = hist"); + -->compare_sequence_gen + +/* string API */ +unur_free(gen); +gen = unur_str2gen("cemp; hist_prob=(0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1); \ + hist_bins=(1.,2.,3.,4.,5.,6.,7.,8.,9.,10.) & method = hist"); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default +par[0] = unur_hist_new(@distr@); + +[validate - distributions:] + +# approximate normal distribution, bins with equal width +{ double pv[1000]; + UNUR_DISTR *normal_dist; + int i; + double xmin, xmax; + double fxmin, fxmax; + /* xmin = -5.; */ + fxmin = 0.; + normal_dist = unur_distr_normal(NULL,0); + for (i=0; i<1000; i++) { + xmax = -5. + i/100.; + fxmax = unur_distr_cont_eval_cdf(xmax,normal_dist); + pv[i] = fxmax - fxmin; + /* xmin = xmax; */ + fxmin = fxmax; } + unur_distr_free(normal_dist); + distr[0] = unur_distr_cemp_new(); + unur_distr_cemp_set_hist(distr[0],pv,1000,-5.,5.); } + +# approximate normal distribution, bins with different widths +{ double pv[1000]; + double bins[1001]; + UNUR_DISTR *normal_dist; + int i; + double xmin, xmax; + double fxmin, fxmax; + normal_dist = unur_distr_normal(NULL,0); + bins[500] = 0.; + for (i=501; i<=1000; i++) + bins[i] = bins[i-1] + (i-500)/25000.; + for (i=499; i>=0; i--) + bins[i] = bins[i+1] + (i-500)/25000.; + xmin = bins[0]; + fxmin = unur_distr_cont_eval_cdf(xmin,normal_dist); + pv[0] = unur_distr_cont_eval_cdf(bins[0],normal_dist); + for (i=0; i<1000; i++) { + xmax = bins[i+1]; + fxmax = unur_distr_cont_eval_cdf(xmax,normal_dist); + pv[i] = fxmax - fxmin; + xmin = xmax; + fxmin = fxmax; } + unur_distr_free(normal_dist); + distr[1] = unur_distr_cemp_new(); + unur_distr_cemp_set_hist_prob(distr[1],pv,1000); + unur_distr_cemp_set_hist_bins(distr[1],bins,1001); } + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] default +# +# [0] # distribution +#---------------------------------------------------------------- + <0> + # approximate normal distribution, bins with equal width + <1> + # approximate normal distribution, bins with different widths + + +############################################################################# +############################################################################# + +[verbatim] + +/*---------------------------------------------------------------------------*/ + +UNUR_DISTR *get_distr_with_data( void ) +{ +\#define HIST_SIZE 20 + double hist[HIST_SIZE]; + UNUR_DISTR *distr; + int i; + + unur_urng_fish_reset(NULL); + + for (i=0; i +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_hitro_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +int unur_hitro_set_pedantic( UNUR_PAR *par, int pedantic ); + +#define COMPARE_SAMPLE_SIZE (9999) +#define VIOLATE_SAMPLE_SIZE (20) + +/* For running chi2 tests we use a thinning of dimension * THINNING */ +#define THINNING (2) + +/* HITRO is a Markov Chain Monte Carlo method and thus it is likely to */ +/* fail the chi-square goodness-of-fit test with the used sample size. */ +/* Thus we accept one "hard" failer and more "soft" failures then usual. */ +#define CHI2_FAILURES_TOLERATED (1010) + + +/* we need marginal distributions for the chi2 tests */ +#define unur_distr_multicauchy unur_distr_multicauchy_w_marginals +#define unur_distr_multinormal unur_distr_multinormal_w_marginals +#define unur_distr_multistudent unur_distr_multistudent_w_marginals + +/* HITRO tests are sensitive against SEED. */ +/* So we at least ignore the random seed from the script */ +/* the transforms t_hitro.conf to t_hitro.c. */ +#ifndef SEED +#define SEED (123456) +#endif + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* dummy function */ +int unur_hitro_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,48,(unur_hitro_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,48,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,55,(unur_hitro_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,55,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* missing data */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cvec_new(3); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,62,(unur_hitro_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + double x0[] = {1., 2., 3.}; + double umin[] = {0.,0.,0.}; + double umax[] = {1.,1.,1.}; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,76,(unur_hitro_set_variant_coordinate( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_hitro_set_variant_random_direction( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,82,(unur_hitro_set_startingpoint( par, x0)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,82,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,85,(unur_hitro_set_thinning( par, 3 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,85,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,88,(unur_hitro_set_burnin( par, 100 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,91,(unur_hitro_set_use_adaptiveline( par, TRUE )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,94,(unur_hitro_set_use_boundingrectangle( par, TRUE )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,97,(unur_hitro_set_use_adaptiverectangle( par, TRUE ) ))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,97,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,100,(unur_hitro_set_r( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,100,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,103,(unur_hitro_set_v( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,103,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_hitro_set_u( par, umin, umax )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,109,(unur_hitro_set_adaptive_multiplier( par, 1.1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,109,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double x0[] = {1., 2., 3.}; + double umin[] = {0.,0.,0.}; + double umax[] = {1.,1.,1.}; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,121,(unur_hitro_set_variant_coordinate( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,121,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,124,(unur_hitro_set_variant_random_direction( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,124,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,127,(unur_hitro_set_startingpoint( par, x0)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,127,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,130,(unur_hitro_set_thinning( par, 3 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,130,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,133,(unur_hitro_set_burnin( par, 100 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,133,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,136,(unur_hitro_set_use_adaptiveline( par, TRUE )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,136,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,139,(unur_hitro_set_use_boundingrectangle( par, TRUE )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,139,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,142,(unur_hitro_set_use_adaptiverectangle( par, TRUE ) ))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,142,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,145,(unur_hitro_set_r( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,145,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,148,(unur_hitro_set_v( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,148,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,151,(unur_hitro_set_u( par, umin, umax )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,151,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,154,(unur_hitro_set_adaptive_multiplier( par, 1.1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,154,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double umin[] = {0.,0.,0.}; + double umax[] = {1.,-1.,1.}; + double umaxinf[] = {1.,UNUR_INFINITY,1.}; + distr = unur_distr_multinormal( 3, NULL, NULL ); + par = unur_hitro_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,167,(unur_hitro_set_thinning( par, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,167,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,170,(unur_hitro_set_burnin( par, -1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,170,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,173,(unur_hitro_set_r( par, 0. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,173,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,176,(unur_hitro_set_v( par, 0. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,176,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,179,(unur_hitro_set_v( par, UNUR_INFINITY )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,179,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,182,(unur_hitro_set_u( par, umin, umax )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,182,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,185,(unur_hitro_set_u( par, umin, umaxinf )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,185,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,188,(unur_hitro_set_adaptive_multiplier( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,188,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 200, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,204,(unur_hitro_get_state(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,204,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double x[] = {0.,0.}; + distr = unur_distr_normal(NULL,0); + par = unur_ssr_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 214, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,218,(unur_hitro_chg_state(gen,x)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,218,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid NULL */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_multinormal(2,NULL,NULL); + par = unur_hitro_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 222, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,226,(unur_hitro_chg_state(gen,NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,226,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid state */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double state[] = {1000.,1000.,1000.}; + distr = unur_distr_multinormal(2,NULL,NULL); + par = unur_hitro_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 231, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,235,(unur_hitro_chg_state(gen,state)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,235,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* does not exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double x[3]; + distr = unur_distr_multinormal(3,NULL,NULL); + par = unur_hitro_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 249, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,253,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,253,UNUR_ERR_NO_REINIT)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_sample_vec( gen, x ); +n_tests_failed += (check_expected_INFINITY(TESTLOG,257,(x[0]))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,257,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* test clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + UNUR_GEN *clone; + distr = unur_distr_multinormal( dim, mean, covar ); + par = unur_hitro_new(distr); + unur_hitro_set_variant_coordinate(par); + unur_hitro_set_use_adaptiveline(par,TRUE); + unur_hitro_set_use_adaptiverectangle(par,FALSE); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 273, gen ); + + +unur_reset_errno(); +; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,277,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +unur_hitro_reset_state(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,284,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* test clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + UNUR_GEN *clone; + distr = unur_distr_multinormal( dim, mean, covar ); + par = unur_hitro_new(distr); + unur_hitro_set_variant_random_direction(par); + unur_hitro_set_use_adaptiveline(par,TRUE); + unur_hitro_set_use_adaptiverectangle(par,FALSE); + unur_hitro_set_use_boundingrectangle(par,TRUE); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 298, gen ); + + +unur_reset_errno(); +; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,302,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +unur_hitro_reset_state(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,309,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[37]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 37 */ +{ +distr[0] = unur_distr_multinormal(1,NULL,NULL); +} + +{ +distr[1] = unur_distr_multinormal(2,NULL,NULL); +} + +{ +distr[2] = unur_distr_multinormal(3,NULL,NULL); +} + +{ +double mean[] = { -1. }; +double covar[] = { 2. }; +distr[3] = unur_distr_multinormal(1,mean,covar); +unur_distr_cvec_set_center(distr[3],NULL); +} + +{ +double mean[] = { 1., 2., 3. }; +double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; +distr[4] = unur_distr_multinormal(3,mean,covar); +} + +{ +distr[5] = unur_distr_multinormal_ar1(3,NULL,0.9); +} + +{ +distr[6] = unur_distr_multinormal_ar1(4,NULL,0.9); +} + +{ +distr[7] = unur_distr_multinormal_ar1(5,NULL,0.9); +} + +{ +distr[8] = unur_distr_multinormal_ar1(10,NULL,0.7); +} + +{ +double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; +distr[9] = unur_distr_multinormal_ar1(3,mean,0.9); +} + +{ +double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; +distr[10] = unur_distr_multinormal_ar1(4,mean,0.9); +} + +{ +double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; +distr[11] = unur_distr_multinormal_ar1(5,mean,0.9); +} + +{ +double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; +distr[12] = unur_distr_multinormal_ar1(10,mean,0.7); +} + +{ +distr[13] = unur_distr_multinormal_constantrho(3,NULL,0.9); +} + +{ +distr[14] = unur_distr_multinormal_constantrho(4,NULL,0.9); +} + +{ +distr[15] = unur_distr_multinormal_constantrho(5,NULL,0.9); +} + +{ +distr[16] = unur_distr_multinormal_constantrho(10,NULL,0.7); +} + +{ +distr[17] = unur_distr_multicauchy(2,NULL,NULL); +} + +{ +distr[18] = unur_distr_multicauchy(3,NULL,NULL); +} + +{ +double mean[] = { 1., 2., 3. }; +double covar[] = { 1., 0.5, 0.25, 0.5, 1., 0.5, 0.25, 0.5, 1. }; +distr[19] = unur_distr_multicauchy(3,mean,covar); +} + +{ +distr[20] = unur_distr_multicauchy_ar1(3,NULL,0.9); +} + +{ +distr[21] = unur_distr_multicauchy_ar1(4,NULL,0.9); +} + +{ +distr[22] = unur_distr_multicauchy_ar1(5,NULL,0.9); +} + +{ +distr[23] = unur_distr_multicauchy_ar1(10,NULL,0.7); +} + +{ +distr[24] = unur_distr_multistudent_ar1(2,3.,NULL,0.9); +} + +{ +distr[25] = unur_distr_multistudent_ar1(2,5.,NULL,0.9); +} + +{ +distr[26] = unur_distr_multistudent_ar1(2,15.,NULL,0.9); +} + +{ +distr[27] = unur_distr_multistudent_ar1(2,0.5,NULL,0.9); +} + +{ +distr[28] = unur_distr_multistudent_ar1(2,1.5,NULL,0.9); +} + +{ +distr[29] = unur_distr_multistudent_ar1(2,2.5,NULL,0.9); +} + +{ +double ll[3] = {0.,0.,0.}; +double ru[3] = {UNUR_INFINITY,UNUR_INFINITY,UNUR_INFINITY}; +distr[30] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[30],ll,ru); +} + +{ +double ll[3] = {-0.5,-0.5,-0.5}; +double ru[3] = {UNUR_INFINITY,UNUR_INFINITY,UNUR_INFINITY}; +distr[34] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[34],ll,ru); +} + +{ +double ll[3] = {0.,0.,0.}; +double ru[3] = {1.,UNUR_INFINITY,UNUR_INFINITY}; +distr[31] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[31],ll,ru); +} + +{ +double ll[3] = {-0.5,-0.5,-0.5}; +double ru[3] = {1.,UNUR_INFINITY,UNUR_INFINITY}; +distr[35] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[35],ll,ru); +} + +{ +double ll[3] = {-1.,-1.,1.}; +double ru[3] = {1.,0.,2.}; +double center[3] = {0.,0.,1.}; +distr[32] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[32],ll,ru); +unur_distr_cvec_set_center(distr[32],center); +} + +{ +double ll[3] = {-1.,-1.,1.}; +double ru[3] = {1.,0.,2.}; +double center[3] = {0.,-0.5,1.5}; +distr[36] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[36],ll,ru); +unur_distr_cvec_set_center(distr[36],center); +} + +{ +double ll[3] = {-1.,-1.,1.}; +double ru[3] = {1.,0.,2.}; +distr[33] = unur_distr_multinormal(3,NULL,NULL); +unur_distr_cvec_set_domain_rect(distr[33],ll,ru); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 333 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [14] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [20] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [23] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [28] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [29] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [30] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [34] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [31] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [35] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [32] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [36] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [33] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,FALSE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,FALSE); +unur_hitro_set_use_boundingrectangle(par,FALSE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_coordinate(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_hitro_new(distr_localcopy); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,3.); +unur_hitro_set_use_adaptiveline(par,TRUE); +unur_hitro_set_use_adaptiverectangle(par,TRUE); +unur_hitro_set_use_boundingrectangle(par,TRUE); +unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + unur_distr_free(distr[30]); + unur_distr_free(distr[31]); + unur_distr_free(distr[32]); + unur_distr_free(distr[33]); + unur_distr_free(distr[34]); + unur_distr_free(distr[35]); + unur_distr_free(distr[36]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_hitro_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_hrb.c b/vendor/unuran-1.11.0/tests/t_hrb.c new file mode 100644 index 0000000..71df883 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_hrb.c @@ -0,0 +1,995 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for HRB + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +double HR_decreasing(double x, const UNUR_DISTR *distr); +double CDF_decreasing(double x, const UNUR_DISTR *distr); + +double HR_constant(double x, const UNUR_DISTR *distr); +double CDF_constant(double x, const UNUR_DISTR *distr); + +double HR_increasing(double x, const UNUR_DISTR *distr); +double CDF_increasing(double x, const UNUR_DISTR *distr); + +int unur_hrb_set_pedantic( UNUR_PAR *par, int pedantic ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +double HR_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with decreasing hazard rate */ +{ return (1./(1.+x)); } + +double CDF_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with decreasing hazard rate */ +{ return (x/(1. + x)); } + + +double HR_constant(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with constant hazard rate: standard expontential */ +{ return 1.; } + +double CDF_constant(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with constant hazard rate: standard expontential */ +{ return (1.-exp(-x)); } + + +double HR_increasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with increasing hazard rate: Weibull (alpha=3,beta=1) */ +{ return (3*x*x); } + +double CDF_increasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with increasing hazard rate: Weibull (alpha=3,beta=1) */ +{ return (1.-exp(-x*x*x)); } + + +/* dummy function */ +int unur_hrb_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,36,(unur_hrb_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,36,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,42,(unur_hrb_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +/* hazard rate */ +n_tests_failed += (check_expected_NULL(TESTLOG,49,(unur_hrb_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,59,(unur_hrb_set_upperbound(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,59,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,62,(unur_hrb_set_verify(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,70,(unur_hrb_set_upperbound(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,73,(unur_hrb_set_verify(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,73,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_decreasing); + par = unur_hrb_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,84,(unur_hrb_set_upperbound(par,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,84,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,87,(unur_hrb_set_upperbound(par,UNUR_INFINITY)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,87,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 102, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_hrb_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* left border no valid upper bound */ +UNUR_GEN *gen = NULL; +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + gen = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_increasing); + par = unur_hrb_new(distr); +abort_if_NULL(TESTLOG, 116, par ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,120,(gen = unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,120,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_free(gen); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* does not exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_decreasing); + par = unur_hrb_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 131, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,135,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_decreasing); + par = NULL; + + +unur_reset_errno(); +/* default algorithm */ +par = unur_hrb_new(distr); +n_tests_failed += (compare_sequence_par_start(TESTLOG,148,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* default algorithm - set upper bound */ +par = unur_hrb_new(distr); +unur_hrb_set_upperbound(par,1.); +n_tests_failed += (compare_sequence_par(TESTLOG,153,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* default algorithm - verifying mode */ +par = unur_hrb_new(distr); +unur_hrb_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,158,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* default algorithm - ignore invalid boundary */ +unur_distr_cont_set_domain(distr,-10.,10.); +par = unur_hrb_new(distr); +n_tests_failed += (compare_sequence_par_start(TESTLOG,163,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_decreasing); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_hrb_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,176,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,180,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_cont_new(); +unur_distr_cont_set_hrstr(distr,"1/(1+x)"); +par = unur_hrb_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,194,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ + method = hrb" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,200,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_cont_new(); +unur_distr_cont_set_hrstr(distr,"1/(1+x)"); +par = unur_hrb_new(distr); +unur_hrb_set_upperbound(par,2.); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,208,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ + method = hrb; upperbound = 2" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,214,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[3]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 3 */ +{ +distr[0] = unur_distr_cont_new(); +unur_distr_set_name(distr[0],"decreasing HR"); +unur_distr_cont_set_hr(distr[0],HR_decreasing); +unur_distr_cont_set_cdf(distr[0],CDF_decreasing); +} + +{ +distr[1] = unur_distr_cont_new(); +unur_distr_set_name(distr[1],"constant HR"); +unur_distr_cont_set_hr(distr[1],HR_constant); +unur_distr_cont_set_cdf(distr[1],CDF_constant); +} + +{ +distr[2] = unur_distr_cont_new(); +unur_distr_set_name(distr[2],"increasing HR"); +unur_distr_cont_set_hr(distr[2],HR_increasing); +unur_distr_cont_set_cdf(distr[2],CDF_increasing); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 9 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hrb_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hrb_new(distr_localcopy); +unur_hrb_set_upperbound(par,1.2); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hrb_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hrb_new(distr_localcopy); +unur_hrb_set_upperbound(par,1.2); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hrb_new(distr_localcopy); +unur_hrb_set_upperbound(par,0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hrb_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hrb_new(distr_localcopy); +unur_hrb_set_upperbound(par,1.2); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 9 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hrb_new(distr_localcopy); + unur_hrb_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_hrb_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hrb_new(distr_localcopy); + unur_hrb_set_pedantic(par,0); +unur_hrb_set_upperbound(par,1.2); + gen = unur_init(par); + if (gen) unur_hrb_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hrb_new(distr_localcopy); + unur_hrb_set_pedantic(par,0); +unur_hrb_set_upperbound(par,0.9); + gen = unur_init(par); + if (gen) unur_hrb_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hrb_new(distr_localcopy); + unur_hrb_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_hrb_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hrb_new(distr_localcopy); + unur_hrb_set_pedantic(par,0); +unur_hrb_set_upperbound(par,1.2); + gen = unur_init(par); + if (gen) unur_hrb_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hrb_new(distr_localcopy); + unur_hrb_set_pedantic(par,0); +unur_hrb_set_upperbound(par,0.9); + gen = unur_init(par); + if (gen) unur_hrb_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hrb_new(distr_localcopy); + unur_hrb_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_hrb_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hrb_new(distr_localcopy); + unur_hrb_set_pedantic(par,0); +unur_hrb_set_upperbound(par,1.2); + gen = unur_init(par); + if (gen) unur_hrb_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_hrb_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_hrb.conf b/vendor/unuran-1.11.0/tests/t_hrb.conf new file mode 100644 index 0000000..c7ef776 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_hrb.conf @@ -0,0 +1,333 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: HRB + +[main - header:] + +/* prototypes */ + +double HR_decreasing(double x, const UNUR_DISTR *distr); +double CDF_decreasing(double x, const UNUR_DISTR *distr); + +double HR_constant(double x, const UNUR_DISTR *distr); +double CDF_constant(double x, const UNUR_DISTR *distr); + +double HR_increasing(double x, const UNUR_DISTR *distr); +double CDF_increasing(double x, const UNUR_DISTR *distr); + +int unur_hrb_set_pedantic( UNUR_PAR *par, int pedantic ); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_cont_new(); ] + +/* hazard rate */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_upperbound(par,1.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_verify(par,1); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameter object: + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); ] + +~_upperbound(par,1.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_verify(par,1); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + + +[set - invalid parameters: + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_decreasing); + par = unur_hrb_new(distr); ] + +~_upperbound(par,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_upperbound(par,UNUR_INFINITY); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + +############################################################################# + +# [get] + +############################################################################# + +[chg] + +[chg - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_verify(gen,1); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + + +############################################################################# + +[init] + +[init - left border no valid upper bound: + gen = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_increasing); + par = unur_hrb_new(distr); <-- ! NULL] + +gen = unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_CONDITION + + +############################################################################# + +[reinit] + + +[reinit - does not exist: + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_decreasing); + par = unur_hrb_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - compare: + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_decreasing); + par = NULL; ] + +/* default algorithm */ +par = unur_hrb_new(distr); + -->compare_sequence_par_start + +/* default algorithm - set upper bound */ +par = unur_hrb_new(distr); +unur_hrb_set_upperbound(par,1.); + -->compare_sequence_par + +/* default algorithm - verifying mode */ +par = unur_hrb_new(distr); +unur_hrb_set_verify(par,1); + -->compare_sequence_par + +/* default algorithm - ignore invalid boundary */ +unur_distr_cont_set_domain(distr,-10.,10.); +par = unur_hrb_new(distr); + -->compare_sequence_par_start + +#..................................................................... + +[sample - compare reinit: + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_decreasing); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_hrb_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + distr = NULL; + par = NULL; + gen = NULL; ] + + +distr = unur_distr_cont_new(); +unur_distr_cont_set_hrstr(distr,"1/(1+x)"); +par = unur_hrb_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ + method = hrb" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +distr = unur_distr_cont_new(); +unur_distr_cont_set_hrstr(distr,"1/(1+x)"); +par = unur_hrb_new(distr); +unur_hrb_set_upperbound(par,2.); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ + method = hrb; upperbound = 2" ); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default program +par[0] = unur_hrb_new(@distr@); + +# set upper bound +par[1] = unur_hrb_new(@distr@); +unur_hrb_set_upperbound(par,1.2); + +# set upper bound too small +par[2] = unur_hrb_new(@distr@); +unur_hrb_set_upperbound(par,0.9); + + +[validate - distributions:] + +# decreasing hazard rate +distr[0] = unur_distr_cont_new(); +unur_distr_set_name(distr[0],"decreasing HR"); +unur_distr_cont_set_hr(distr[0],HR_decreasing); +unur_distr_cont_set_cdf(distr[0],CDF_decreasing); + +# constant hazard rate +distr[1] = unur_distr_cont_new(); +unur_distr_set_name(distr[1],"constant HR"); +unur_distr_cont_set_hr(distr[1],HR_constant); +unur_distr_cont_set_cdf(distr[1],CDF_constant); + +# increasing hazard rate +distr[2] = unur_distr_cont_new(); +unur_distr_set_name(distr[2],"increasing HR"); +unur_distr_cont_set_hr(distr[2],HR_increasing); +unur_distr_cont_set_cdf(distr[2],CDF_increasing); + +# number of distributions: 3 + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default variant +# [1] ... set upper bound +# [2] ... set upper bound too small +# +#gen 0 1 2 # distribution +#--------------------------------------------- + <0> + + . # hazard rate decreasing + <1> + + - # hazard rate constant + <2> - - . # hazard rate increasing + +[validate - verify hat:] + +# + ... pass test +# ~ ... fail in at most 1% of samples +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default variant +# [1] ... set upper bound +# [2] ... set upper bound too small +# +#gen 0 1 2 # distribution +#--------------------------------------------- + <0> + + - # hazard rate decreasing + <1> + + - # hazard rate constant + <2> - - . # hazard rate increasing + + +############################################################################# +############################################################################# + +[verbatim] + +double HR_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with decreasing hazard rate */ +{ return (1./(1.+x)); } + +double CDF_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with decreasing hazard rate */ +{ return (x/(1. + x)); } + + +double HR_constant(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with constant hazard rate: standard expontential */ +{ return 1.; } + +double CDF_constant(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with constant hazard rate: standard expontential */ +{ return (1.-exp(-x)); } + + +double HR_increasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with increasing hazard rate: Weibull (alpha=3,beta=1) */ +{ return (3*x*x); } + +double CDF_increasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with increasing hazard rate: Weibull (alpha=3,beta=1) */ +{ return (1.-exp(-x*x*x)); } + + +/* dummy function */ +int unur_hrb_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_hrd.c b/vendor/unuran-1.11.0/tests/t_hrd.c new file mode 100644 index 0000000..4085a55 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_hrd.c @@ -0,0 +1,805 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for HRD + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +double HR_decreasing(double x, const UNUR_DISTR *distr); +double CDF_decreasing(double x, const UNUR_DISTR *distr); +double HR_constant(double x, const UNUR_DISTR *distr); +double CDF_constant(double x, const UNUR_DISTR *distr); +double HR_increasing(double x, const UNUR_DISTR *distr); +double CDF_increasing(double x, const UNUR_DISTR *distr); + +int unur_hrd_set_pedantic( UNUR_PAR *par, int pedantic ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +double HR_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with decreasing hazard rate */ +{ return (1./(1.+x)); } + +double CDF_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with decreasing hazard rate */ +{ return (x/(1. + x)); } + +double HR_constant(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with constant hazard rate: standard expontential */ +{ return 1.; } + +double CDF_constant(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with constant hazard rate: standard expontential */ +{ return (1.-exp(-x)); } + +double HR_increasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with increasing hazard rate: Weibull (alpha=3,beta=1) */ +{ return (3*x*x); } + +double CDF_increasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with increasing hazard rate: Weibull (alpha=3,beta=1) */ +{ return (1.-exp(-x*x*x)); } + + +/* dummy function */ +int unur_hrd_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,34,(unur_hrd_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,34,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,40,(unur_hrd_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,40,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +/* hazard rate */ +n_tests_failed += (check_expected_NULL(TESTLOG,47,(unur_hrd_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,47,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,57,(unur_hrd_set_verify(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,57,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,65,(unur_hrd_set_verify(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 81, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,85,(unur_hrd_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,85,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* left border no valid upper bound */ +UNUR_GEN *gen = NULL; +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + gen = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_increasing); + par = unur_hrd_new(distr); +abort_if_NULL(TESTLOG, 95, par ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,99,(gen = unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,99,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_free(gen); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* does not exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_decreasing); + par = unur_hrd_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 109, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,113,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_decreasing); + par = NULL; + + +unur_reset_errno(); +/* default algorithm */ +par = unur_hrd_new(distr); +n_tests_failed += (compare_sequence_par_start(TESTLOG,126,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* default algorithm - verifying mode */ +par = unur_hrd_new(distr); +unur_hrd_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,131,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* default algorithm - ignore invalid boundary */ +unur_distr_cont_set_domain(distr,-10.,10.); +par = unur_hrd_new(distr); +n_tests_failed += (compare_sequence_par_start(TESTLOG,136,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_decreasing); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_hrd_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,149,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,153,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_cont_new(); +unur_distr_cont_set_hrstr(distr,"1/(1+x)"); +par = unur_hrd_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,166,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ + method = hrd" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,172,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_cont_new(); +unur_distr_cont_set_hrstr(distr,"1/(1+x)"); +par = unur_hrd_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,179,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ + method = hrd" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,185,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[3]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 3 */ +{ +distr[0] = unur_distr_cont_new(); +unur_distr_set_name(distr[0],"decreasing HR"); +unur_distr_cont_set_hr(distr[0],HR_decreasing); +unur_distr_cont_set_cdf(distr[0],CDF_decreasing); +} + +{ +distr[1] = unur_distr_cont_new(); +unur_distr_set_name(distr[1],"constant HR"); +unur_distr_cont_set_hr(distr[1],HR_constant); +unur_distr_cont_set_cdf(distr[1],CDF_constant); +} + +{ +distr[2] = unur_distr_cont_new(); +unur_distr_set_name(distr[2],"increasing HR"); +unur_distr_cont_set_hr(distr[2],HR_increasing); +unur_distr_cont_set_cdf(distr[2],CDF_increasing); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 3 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hrd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hrd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hrd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 3 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hrd_new(distr_localcopy); + unur_hrd_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_hrd_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hrd_new(distr_localcopy); + unur_hrd_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_hrd_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hrd_new(distr_localcopy); + unur_hrd_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_hrd_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_hrd_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_hrd.conf b/vendor/unuran-1.11.0/tests/t_hrd.conf new file mode 100644 index 0000000..6fd85dd --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_hrd.conf @@ -0,0 +1,290 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: HRD + +[main - header:] + +/* prototypes */ + +double HR_decreasing(double x, const UNUR_DISTR *distr); +double CDF_decreasing(double x, const UNUR_DISTR *distr); +double HR_constant(double x, const UNUR_DISTR *distr); +double CDF_constant(double x, const UNUR_DISTR *distr); +double HR_increasing(double x, const UNUR_DISTR *distr); +double CDF_increasing(double x, const UNUR_DISTR *distr); + +int unur_hrd_set_pedantic( UNUR_PAR *par, int pedantic ); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_cont_new(); ] + +/* hazard rate */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_verify(par,1); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameter object: + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); ] + +~_verify(par,1); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + + +############################################################################# + +# [get] + +############################################################################# + +[chg] + +[chg - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_verify(gen,1); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + + +############################################################################# + +[init] + +[init - left border no valid upper bound: + gen = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_increasing); + par = unur_hrd_new(distr); <-- ! NULL] + +gen = unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_CONDITION + + +############################################################################# + +[reinit] + +[reinit - does not exist: + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_decreasing); + par = unur_hrd_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - compare: + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_decreasing); + par = NULL; ] + +/* default algorithm */ +par = unur_hrd_new(distr); + -->compare_sequence_par_start + +/* default algorithm - verifying mode */ +par = unur_hrd_new(distr); +unur_hrd_set_verify(par,1); + -->compare_sequence_par + +/* default algorithm - ignore invalid boundary */ +unur_distr_cont_set_domain(distr,-10.,10.); +par = unur_hrd_new(distr); + -->compare_sequence_par_start + +#..................................................................... + +[sample - compare reinit: + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_decreasing); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_hrd_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_cont_new(); +unur_distr_cont_set_hrstr(distr,"1/(1+x)"); +par = unur_hrd_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ + method = hrd" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +distr = unur_distr_cont_new(); +unur_distr_cont_set_hrstr(distr,"1/(1+x)"); +par = unur_hrd_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ + method = hrd" ); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default program +par[0] = unur_hrd_new(@distr@); + + +[validate - distributions:] + +# decreasing hazard rate +distr[0] = unur_distr_cont_new(); +unur_distr_set_name(distr[0],"decreasing HR"); +unur_distr_cont_set_hr(distr[0],HR_decreasing); +unur_distr_cont_set_cdf(distr[0],CDF_decreasing); + +# constant hazard rate +distr[1] = unur_distr_cont_new(); +unur_distr_set_name(distr[1],"constant HR"); +unur_distr_cont_set_hr(distr[1],HR_constant); +unur_distr_cont_set_cdf(distr[1],CDF_constant); + +# increasing hazard rate +distr[2] = unur_distr_cont_new(); +unur_distr_set_name(distr[2],"increasing HR"); +unur_distr_cont_set_hr(distr[2],HR_increasing); +unur_distr_cont_set_cdf(distr[2],CDF_increasing); + +# number of distributions: 3 + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default variant +# +#gen 0 # distribution +#--------------------------------------------- + <0> + # hazard rate decreasing + <1> + # hazard rate constant + <2> - # hazard rate increasing + +[validate - verify hat:] + +# + ... pass test +# ~ ... fail in at most 1% of samples +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default variant +# +#gen 0 # distribution +#--------------------------------------------- + <0> + # hazard rate decreasing + <1> + # hazard rate constant + <2> - # hazard rate increasing + + +############################################################################# +############################################################################# + +[verbatim] + +double HR_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with decreasing hazard rate */ +{ return (1./(1.+x)); } + +double CDF_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with decreasing hazard rate */ +{ return (x/(1. + x)); } + +double HR_constant(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with constant hazard rate: standard expontential */ +{ return 1.; } + +double CDF_constant(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with constant hazard rate: standard expontential */ +{ return (1.-exp(-x)); } + +double HR_increasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with increasing hazard rate: Weibull (alpha=3,beta=1) */ +{ return (3*x*x); } + +double CDF_increasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with increasing hazard rate: Weibull (alpha=3,beta=1) */ +{ return (1.-exp(-x*x*x)); } + + +/* dummy function */ +int unur_hrd_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_hri.c b/vendor/unuran-1.11.0/tests/t_hri.c new file mode 100644 index 0000000..b4a23b8 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_hri.c @@ -0,0 +1,1058 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for HRI + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +double HR_invalid(double x, const UNUR_DISTR *distr); + +double HR_decreasing(double x, const UNUR_DISTR *distr); +double CDF_decreasing(double x, const UNUR_DISTR *distr); + +double HR_constant(double x, const UNUR_DISTR *distr); +double CDF_constant(double x, const UNUR_DISTR *distr); + +double HR_increasing_wb31(double x, const UNUR_DISTR *distr); +double CDF_increasing_wb31(double x, const UNUR_DISTR *distr); + +double HR_increasing_gm31(double x, const UNUR_DISTR *distr); +double CDF_increasing_gm31(double x, const UNUR_DISTR *distr); + +double HR_increasing_gm51(double x, const UNUR_DISTR *distr); +double CDF_increasing_gm51(double x, const UNUR_DISTR *distr); + +int unur_hri_set_pedantic( UNUR_PAR *par, int pedantic ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +double HR_invalid(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with invalid hazard rate */ +{ return 0.; } + + +double HR_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with decreasing hazard rate */ +{ return (1./(1.+x)); } + +double CDF_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with decreasing hazard rate */ +{ return (x/(1. + x)); } + + +double HR_constant(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with constant hazard rate: standard expontential */ +{ return 1.; } + +double CDF_constant(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with constant hazard rate: standard expontential */ +{ return (1.-exp(-x)); } + + +double HR_increasing_wb31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with increasing hazard rate: Weibull (alpha=3,beta=1) */ +{ return (3*x*x); } + +double CDF_increasing_wb31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with increasing hazard rate: Weibull (alpha=3,beta=1) */ +{ return (1.-exp(-x*x*x)); } + + +double HR_increasing_gm31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with increasing hazard rate: gamma (alpha=3,beta=1) */ +{ return (x*x)/(x*x+2*x+2.); } + +double CDF_increasing_gm31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with increasing hazard rate: gamma (alpha=3,beta=1) */ +{ return 1.-(x*x*exp(-x))/2.-(x*exp(-x))-exp(-x); } + + +double HR_increasing_gm51(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with increasing hazard rate: gamma (alpha=5,beta=1) */ +{ return pow(x,4.)/(pow(x,4.)+4*pow(x,3.)+12.*x*x+24.*x+24.); } + +double CDF_increasing_gm51(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with increasing hazard rate: gamma (alpha=5,beta=1) */ +{ return (-exp(-x)/24.)*((pow(x,4.)+4*pow(x,3.)+12.*x*x+24.*x+24.))+1.; } + + +/* dummy function */ +int unur_hri_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,44,(unur_hri_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,44,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,50,(unur_hri_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,50,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +/* hazard rate */ +n_tests_failed += (check_expected_NULL(TESTLOG,57,(unur_hri_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,57,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,67,(unur_hri_set_verify(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,67,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,70,(unur_hri_set_p0(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,78,(unur_hri_set_verify(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,78,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,81,(unur_hri_set_p0(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,81,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 97, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,101,(unur_hri_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* left border no valid upper bound */ +UNUR_GEN *gen = NULL; +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + gen = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_invalid); + par = unur_hri_new(distr); +abort_if_NULL(TESTLOG, 111, par ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,115,(gen = unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,115,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_free(gen); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* does not exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_increasing_wb31); + par = unur_hri_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 125, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,129,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_increasing_wb31); + par = NULL; + + +unur_reset_errno(); +/* default algorithm */ +par = unur_hri_new(distr); +n_tests_failed += (compare_sequence_par_start(TESTLOG,142,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* default algorithm - verifying mode */ +par = unur_hri_new(distr); +unur_hri_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,147,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* default algorithm - ignore invalid boundary */ +unur_distr_cont_set_domain(distr,-10.,10.); +par = unur_hri_new(distr); +n_tests_failed += (compare_sequence_par_start(TESTLOG,152,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_increasing_wb31); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_hri_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,165,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,169,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_cont_new(); +unur_distr_cont_set_hrstr(distr,"3*x^2"); +par = unur_hri_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,182,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; hr = \"3*x^2\"; domain = (0,inf)& \ + method = hri" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,188,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[5]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 5 */ +{ +distr[0] = unur_distr_cont_new(); +unur_distr_set_name(distr[0],"decreasing HR"); +unur_distr_cont_set_hr(distr[0],HR_decreasing); +unur_distr_cont_set_cdf(distr[0],CDF_decreasing); +} + +{ +distr[1] = unur_distr_cont_new(); +unur_distr_set_name(distr[1],"constant HR"); +unur_distr_cont_set_hr(distr[1],HR_constant); +unur_distr_cont_set_cdf(distr[1],CDF_constant); +} + +{ +distr[2] = unur_distr_cont_new(); +unur_distr_set_name(distr[2],"increasing HR wb31"); +unur_distr_cont_set_hr(distr[2],HR_increasing_wb31); +unur_distr_cont_set_cdf(distr[2],CDF_increasing_wb31); +} + +{ +distr[3] = unur_distr_cont_new(); +unur_distr_set_name(distr[3],"increasing HR gm31"); +unur_distr_cont_set_hr(distr[3],HR_increasing_gm31); +unur_distr_cont_set_cdf(distr[3],CDF_increasing_gm31); +} + +{ +distr[4] = unur_distr_cont_new(); +unur_distr_set_name(distr[4],"increasing HR gm51"); +unur_distr_cont_set_hr(distr[4],HR_increasing_gm51); +unur_distr_cont_set_cdf(distr[4],CDF_increasing_gm51); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 10 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hri_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hri_new(distr_localcopy); +unur_hri_set_p0(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hri_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hri_new(distr_localcopy); +unur_hri_set_p0(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hri_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hri_new(distr_localcopy); +unur_hri_set_p0(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hri_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hri_new(distr_localcopy); +unur_hri_set_p0(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_hri_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_hri_new(distr_localcopy); +unur_hri_set_p0(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 10 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_hri_new(distr_localcopy); + unur_hri_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_hri_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hri_new(distr_localcopy); + unur_hri_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_hri_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_hri_new(distr_localcopy); + unur_hri_set_pedantic(par,0); +unur_hri_set_p0(par,2.); + gen = unur_init(par); + if (gen) unur_hri_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hri_new(distr_localcopy); + unur_hri_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_hri_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_hri_new(distr_localcopy); + unur_hri_set_pedantic(par,0); +unur_hri_set_p0(par,2.); + gen = unur_init(par); + if (gen) unur_hri_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hri_new(distr_localcopy); + unur_hri_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_hri_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_hri_new(distr_localcopy); + unur_hri_set_pedantic(par,0); +unur_hri_set_p0(par,2.); + gen = unur_init(par); + if (gen) unur_hri_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_hri_new(distr_localcopy); + unur_hri_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_hri_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_hri_new(distr_localcopy); + unur_hri_set_pedantic(par,0); +unur_hri_set_p0(par,2.); + gen = unur_init(par); + if (gen) unur_hri_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_hri_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_hri.conf b/vendor/unuran-1.11.0/tests/t_hri.conf new file mode 100644 index 0000000..1e66fdb --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_hri.conf @@ -0,0 +1,352 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: HRI + +[main - header:] + +/* prototypes */ + +double HR_invalid(double x, const UNUR_DISTR *distr); + +double HR_decreasing(double x, const UNUR_DISTR *distr); +double CDF_decreasing(double x, const UNUR_DISTR *distr); + +double HR_constant(double x, const UNUR_DISTR *distr); +double CDF_constant(double x, const UNUR_DISTR *distr); + +double HR_increasing_wb31(double x, const UNUR_DISTR *distr); +double CDF_increasing_wb31(double x, const UNUR_DISTR *distr); + +double HR_increasing_gm31(double x, const UNUR_DISTR *distr); +double CDF_increasing_gm31(double x, const UNUR_DISTR *distr); + +double HR_increasing_gm51(double x, const UNUR_DISTR *distr); +double CDF_increasing_gm51(double x, const UNUR_DISTR *distr); + +int unur_hri_set_pedantic( UNUR_PAR *par, int pedantic ); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_cont_new(); ] + +/* hazard rate */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_verify(par,1); + --> expected_setfailed --> UNUR_ERR_NULL + +~_p0(par,1.); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameter object: + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); ] + +~_verify(par,1); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_p0(par,1.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + + +############################################################################# + +# [get] + +############################################################################# + +[chg] + +[chg - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_verify(gen,1); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + + +############################################################################# + +[init] + +[init - left border no valid upper bound: + gen = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_invalid); + par = unur_hri_new(distr); <-- ! NULL] + +gen = unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_CONDITION + + +############################################################################# + +[reinit] + +[reinit - does not exist: + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_increasing_wb31); + par = unur_hri_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - compare: + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_increasing_wb31); + par = NULL; ] + +/* default algorithm */ +par = unur_hri_new(distr); + -->compare_sequence_par_start + +/* default algorithm - verifying mode */ +par = unur_hri_new(distr); +unur_hri_set_verify(par,1); + -->compare_sequence_par + +/* default algorithm - ignore invalid boundary */ +unur_distr_cont_set_domain(distr,-10.,10.); +par = unur_hri_new(distr); + -->compare_sequence_par_start + +#..................................................................... + +[sample - compare reinit: + distr = unur_distr_cont_new(); + unur_distr_cont_set_hr(distr,HR_increasing_wb31); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_hri_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_cont_new(); +unur_distr_cont_set_hrstr(distr,"3*x^2"); +par = unur_hri_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; hr = \"3*x^2\"; domain = (0,inf)& \ + method = hri" ); + -->compare_sequence_gen + +#unur_free(gen); gen = NULL; +#distr = unur_distr_cont_new(); +#unur_distr_cont_set_hrstr(distr,"3*x^2"); +#par = unur_hri_new(distr); +#unur_hri_set_p0(par,2.); +#gen = unur_init(par); +# -->compare_sequence_gen_start + +#unur_free(gen); gen = NULL; +#unur_distr_free(distr); distr = NULL; +#gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ +# method = hri; p0 = 1." ); +# -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default program +par[0] = unur_hri_new(@distr@); + +# set design point +par[0] = unur_hri_new(@distr@); +unur_hri_set_p0(par,2.); + +[validate - distributions:] + +# decreasing hazard rate +distr[0] = unur_distr_cont_new(); +unur_distr_set_name(distr[0],"decreasing HR"); +unur_distr_cont_set_hr(distr[0],HR_decreasing); +unur_distr_cont_set_cdf(distr[0],CDF_decreasing); + +# constant hazard rate +distr[1] = unur_distr_cont_new(); +unur_distr_set_name(distr[1],"constant HR"); +unur_distr_cont_set_hr(distr[1],HR_constant); +unur_distr_cont_set_cdf(distr[1],CDF_constant); + +# increasing hazard rate +distr[2] = unur_distr_cont_new(); +unur_distr_set_name(distr[2],"increasing HR wb31"); +unur_distr_cont_set_hr(distr[2],HR_increasing_wb31); +unur_distr_cont_set_cdf(distr[2],CDF_increasing_wb31); + +distr[3] = unur_distr_cont_new(); +unur_distr_set_name(distr[3],"increasing HR gm31"); +unur_distr_cont_set_hr(distr[3],HR_increasing_gm31); +unur_distr_cont_set_cdf(distr[3],CDF_increasing_gm31); + +distr[4] = unur_distr_cont_new(); +unur_distr_set_name(distr[4],"increasing HR gm51"); +unur_distr_cont_set_hr(distr[4],HR_increasing_gm51); +unur_distr_cont_set_cdf(distr[4],CDF_increasing_gm51); + +# number of distributions: 5 + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default variant +# [1] ... set design point +# +#gen 0 1 # distribution +#--------------------------------------------- +x<0> - - # hazard rate decreasing + <1> + + # hazard rate constant + <2> + + # hazard rate increasing wb31 + <3> + + # hazard rate increasing gm31 + <4> + + # hazard rate increasing gm51 + + +[validate - verify hat:] + +# + ... pass test +# ~ ... fail in at most 1% of samples +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default variant +# [1] ... set design point +# +#gen 0 1 # distribution +#--------------------------------------------- +x<0> - . # hazard rate decreasing + <1> + + # hazard rate constant + <2> + + # hazard rate increasing wb31 + <3> + + # hazard rate increasing gm31 + <4> + + # hazard rate increasing gm51 + + +############################################################################# +############################################################################# + +[verbatim] + +double HR_invalid(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with invalid hazard rate */ +{ return 0.; } + + +double HR_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with decreasing hazard rate */ +{ return (1./(1.+x)); } + +double CDF_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with decreasing hazard rate */ +{ return (x/(1. + x)); } + + +double HR_constant(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with constant hazard rate: standard expontential */ +{ return 1.; } + +double CDF_constant(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with constant hazard rate: standard expontential */ +{ return (1.-exp(-x)); } + + +double HR_increasing_wb31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with increasing hazard rate: Weibull (alpha=3,beta=1) */ +{ return (3*x*x); } + +double CDF_increasing_wb31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with increasing hazard rate: Weibull (alpha=3,beta=1) */ +{ return (1.-exp(-x*x*x)); } + + +double HR_increasing_gm31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with increasing hazard rate: gamma (alpha=3,beta=1) */ +{ return (x*x)/(x*x+2*x+2.); } + +double CDF_increasing_gm31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with increasing hazard rate: gamma (alpha=3,beta=1) */ +{ return 1.-(x*x*exp(-x))/2.-(x*exp(-x))-exp(-x); } + + +double HR_increasing_gm51(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with increasing hazard rate: gamma (alpha=5,beta=1) */ +{ return pow(x,4.)/(pow(x,4.)+4*pow(x,3.)+12.*x*x+24.*x+24.); } + +double CDF_increasing_gm51(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* CDF for example with increasing hazard rate: gamma (alpha=5,beta=1) */ +{ return (-exp(-x)/24.)*((pow(x,4.)+4*pow(x,3.)+12.*x*x+24.*x+24.))+1.; } + + +/* dummy function */ +int unur_hri_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_info.c b/vendor/unuran-1.11.0/tests/t_info.c new file mode 100644 index 0000000..bc4b96b --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_info.c @@ -0,0 +1,1095 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for INFO + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_info_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +/* CEXT: */ +double exp1_sample(UNUR_GEN *gen); + +/* DEXT: */ +int geom12_sample(UNUR_GEN *gen); + + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + + +/* macros for running info test */ + +#define INFO_TEST(genstr) \ + gen = unur_str2gen((genstr)); \ + fprintf(TESTLOG,"GEN = \"%s\"\n",(genstr)); \ + fprintf(TESTLOG,"INFO = \n%s\n",unur_gen_info(gen,FALSE)); \ + fprintf(TESTLOG,"HELP = \n%s\n",unur_gen_info(gen,TRUE)); \ + fprintf(TESTLOG,"---------------------\n"); \ + unur_free(gen); gen = NULL; + +#define INFO_TEST_chg(genstr,run_chg) \ + gen = unur_str2gen((genstr)); \ + run_chg; \ + fprintf(TESTLOG,"GEN = \"%s\"\n",(genstr)); \ + fprintf(TESTLOG,"INFO = \n%s\n",unur_gen_info(gen,FALSE)); \ + fprintf(TESTLOG,"HELP = \n%s\n",unur_gen_info(gen,TRUE)); \ + fprintf(TESTLOG,"---------------------\n"); \ + unur_free(gen); gen = NULL; + +#define METHOD(m) \ + printf("%s ",(m)); \ + fprintf(TESTLOG,"*********************\n"); \ + fprintf(TESTLOG,"* %s\n",(m)); \ + fprintf(TESTLOG,"*********************\n\n"); \ + fflush(stdout); + +#define INFO_TEST_par(genstr,gen) \ + fprintf(TESTLOG,"GEN = \"%s\"\n",(genstr)); \ + fprintf(TESTLOG,"INFO = \n%s\n",unur_gen_info((gen),FALSE)); \ + fprintf(TESTLOG,"HELP = \n%s\n",unur_gen_info((gen),TRUE)); \ + fprintf(TESTLOG,"---------------------\n"); \ + unur_free(gen); gen = NULL; + + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + + +double exp1_sample(UNUR_GEN *gen) { + double U = unur_sample_urng(gen); + return (-log(1. - U)); +} + + +int geom12_sample(UNUR_GEN *gen) { + double U = unur_sample_urng(gen); + return ((int) (log(U) / log(0.5))); +} + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* set debugging flags */ +UNUR_GEN *gen = NULL; + gen = NULL; + +unur_set_default_debug(UNUR_DEBUG_INIT); +unur_free(gen); +} + +{ /* AROU */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("AROU"); +INFO_TEST("normal & method=arou"); +INFO_TEST("normal & method=arou; max_segments=10; cpoints=3"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=arou; max_segments=1000"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=arou; max_segments=1000; max_sqhratio=0.90"); +#endif +unur_free(gen); +} + +{ /* ARS */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("ARS"); +INFO_TEST("normal & method=ars"); +INFO_TEST("normal & method=ars; cpoints=100"); +INFO_TEST("cont; logpdf='-x^2' & method=ars"); +#endif +unur_free(gen); +} + +{ /* CEXT */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = NULL; + par = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("CEXT"); +distr = unur_distr_exponential(NULL,0); +par = unur_cext_new(distr); +unur_cext_set_sample(par,exp1_sample); +gen = unur_init(par); +INFO_TEST_par("... & method=cext",gen); +#endif +unur_distr_free(distr); +unur_free(gen); +} + +{ /* CSTD */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("CSTD"); +INFO_TEST("normal & method=cstd"); +INFO_TEST("normal & method=cstd; variant=0"); +INFO_TEST("normal & method=cstd; variant=-1"); +INFO_TEST("normal & method=cstd; variant=1"); +INFO_TEST("normal & method=cstd; variant=2"); +INFO_TEST("normal & method=cstd; variant=3"); +#endif +unur_free(gen); +} + +{ /* DARI */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("DARI"); +INFO_TEST("geometric(0.5) & method=dari"); +INFO_TEST("binomial(20,0.5) & method=dari"); +INFO_TEST("binomial(20,0.5) & method=dari;squeeze=on"); +INFO_TEST("binomial(20,0.5) & method=dari;tablesize=0"); +INFO_TEST("binomial(20,0.5) & method=dari;cpfactor=0.6"); +INFO_TEST("discr; pmf='0.5^x';domain=(0,inf) & method=dari"); +INFO_TEST("discr; pmf='2*0.5^x';domain=(1,inf) & method=dari"); +#endif +unur_free(gen); +} + +{ /* DAU */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("DAU"); +INFO_TEST("geometric(0.5) & method=dau"); +INFO_TEST("geometric(0.5) & method=dau;urnfactor=2"); +INFO_TEST("discr; pv=(.1,.2,.3,.4,.5,.6,.7) & method=dau"); +#endif +unur_free(gen); +} + +{ /* DGT */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("DGT"); +INFO_TEST("geometric(0.5) & method=dgt"); +INFO_TEST("geometric(0.5) & method=dgt;guidefactor=2"); +INFO_TEST("discr; pv=(.1,.2,.3,.4,.5,.6,.7) & method=dgt"); +#endif +unur_free(gen); +} + +{ /* DSROU */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("DSROU"); +INFO_TEST("geometric(0.5) & method=dsrou"); +INFO_TEST("binomial(20,0.5) & method=dsrou;cdfatmode=0.5"); +INFO_TEST("binomial(20,0.5) & method=dsrou"); +INFO_TEST("discr; pmf='0.5^x';domain=(0,inf);pmfsum=2 & method=dsrou"); +INFO_TEST("discr; pmf='2*0.5^x';domain=(1,inf);pmfsum=2 & method=dsrou"); +#endif +unur_free(gen); +} + +{ /* DSS */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("DSS"); +INFO_TEST("geometric(0.5) & method=dss"); +INFO_TEST("discr; pv=(.1,.2,.3,.4,.5,.6,.7);pmfsum=2.8 & method=dss"); +INFO_TEST("discr; cdf='1-exp(-x)';pmfsum=1 & method=dss"); +#endif +unur_free(gen); +} + +{ /* DSTD */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("DSTD"); +INFO_TEST("poisson(10) & method=dstd"); +INFO_TEST("poisson(10) & method=dstd;variant=0"); +INFO_TEST("poisson(10) & method=dstd;variant=2"); +INFO_TEST("geometric(0.5) & method=dstd"); +INFO_TEST("geometric(0.5) & method=dstd;variant=0"); +INFO_TEST("geometric(0.5) & method=dstd;variant=-1"); +#endif +unur_free(gen); +} + +{ /* DEXT */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[1] = {0.5}; + distr = NULL; + par = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("DEXT"); +distr = unur_distr_geometric(fpar,1); +par = unur_dext_new(distr); +unur_dext_set_sample(par,geom12_sample); +gen = unur_init(par); +INFO_TEST_par("... & method=dext",gen); +#endif +unur_distr_free(distr); +unur_free(gen); +} + +{ /* EMPK */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("EMPK"); +INFO_TEST("cemp; data=(1.,2.,3.,4.,5.,6.,7.,8.,9.) & method=empk"); +INFO_TEST("cemp; data=(1.,2.,3.,4.,5.,6.,7.,8.,9.) & method=empk\ + ;beta=1.5;positive=on;smoothing=1.2;varcor=on"); +#endif +unur_free(gen); +} + +{ /* EMPL */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("EMPL"); +INFO_TEST("cemp; data=(1.,2.,3.,4.,5.,6.,7.,8.,9.) & method = empl"); +#endif +unur_free(gen); +} + +{ /* GIBBS */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + double ll[] = {0.,0.,0.}; + double ru[] = {1.,UNUR_INFINITY,UNUR_INFINITY}; + distr = NULL; + par = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("GIBBS"); +distr = unur_distr_multinormal( dim, mean, covar ); +par = unur_gibbs_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=gibbs",gen); +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +unur_distr_cvec_set_domain_rect( distr, ll, ru); +par = unur_gibbs_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=gibbs",gen); +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +par = unur_gibbs_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=gibbs",gen); +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +par = unur_gibbs_new(distr); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_c(par,-0.5); +unur_gibbs_set_thinning(par,3); +unur_gibbs_set_burnin(par,1000); +gen = unur_init(par); +INFO_TEST_par("... & method=gibbs",gen); +#endif +unur_distr_free(distr); +unur_free(gen); +} + +{ /* HINV */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("HINV"); +INFO_TEST("normal & method=hinv"); +INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=hinv"); +INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=hinv; order=5"); +INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf); mode=0 & method=hinv"); +INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=hinv; u_resolution=1e-16"); +INFO_TEST_chg("normal & method=hinv", unur_hinv_chg_truncated(gen,0.,1.)); +#endif +unur_free(gen); +} + +{ /* HIST */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; + double bins[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.,10.}; + distr = NULL; + par = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("HIST"); +distr = unur_distr_cemp_new(); +unur_distr_cemp_set_hist_prob(distr,hist,9); +unur_distr_cemp_set_hist_domain(distr,1.,10.); +par = unur_hist_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=hist",gen); +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_cemp_new(); +unur_distr_cemp_set_hist_prob(distr,hist,9); +unur_distr_cemp_set_hist_bins(distr,bins,10); +unur_distr_cemp_set_hist_domain(distr,1.,10.); +par = unur_hist_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=hist",gen); +#endif +unur_distr_free(distr); +unur_free(gen); +} + +{ /* HITRO */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + double ll[] = {0.,0.,0.}; + double ru[] = {1.,UNUR_INFINITY,UNUR_INFINITY}; + distr = NULL; + par = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("HITRO"); +distr = unur_distr_multinormal( dim, mean, covar ); +par = unur_hitro_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=hitro",gen); +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +unur_distr_cvec_set_domain_rect( distr, ll, ru); +par = unur_hitro_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=hitro",gen); +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +par = unur_hitro_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=hitro",gen); +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +par = unur_hitro_new(distr); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,2.); +unur_hitro_set_thinning(par,3); +unur_hitro_set_burnin(par,1000); +gen = unur_init(par); +INFO_TEST_par("... & method=hitro",gen); +#endif +unur_distr_free(distr); +unur_free(gen); +} + +{ /* HRB */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("HRB"); +INFO_TEST("cont; hr='1./(1.+x)' & method=hrb"); +INFO_TEST("cont; hr='1./(1.+x)' & method=hrb;upperbound=1.1"); +#endif +unur_free(gen); +} + +{ /* HRD */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("HRD"); +INFO_TEST("cont; hr='1./(1.+x)' & method=hrd"); +#endif +unur_free(gen); +} + +{ /* HRI */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("HRI"); +INFO_TEST("cont; hr='3*x*x' & method=hri"); +INFO_TEST("cont; hr='3*x*x' & method=hri;p0=0.8"); +#endif +unur_free(gen); +} + +{ /* ITDR */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("ITDR"); +INFO_TEST("gamma(0.5) & method=itdr"); +INFO_TEST("gamma(0.5) & method=itdr; cp=-0.5; ct=-0.5"); +INFO_TEST("gamma(0.5) & method=itdr; cp=-0.5; ct=-0.5; xi=0.4"); +INFO_TEST("cont; pdf='exp(-x)/sqrt(x)';mode=0;domain=(0,inf) & method=itdr"); +#endif +unur_free(gen); +} + +{ /* MCORR */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double eigenvalues[] = {1.,2.,3.,4.}; + distr = NULL; + par = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("MCORR"); +distr = unur_distr_correlation(4); +par = unur_mcorr_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=mcorr",gen); +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_correlation(4); +par = unur_mcorr_new(distr); +unur_mcorr_set_eigenvalues( par, eigenvalues ); +gen = unur_init(par); +INFO_TEST_par("... & method=mcorr",gen); +#endif +unur_distr_free(distr); +unur_free(gen); +} + +{ /* MIXT */ +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *comp[3]; + double prob[3] = {1,2,3}; + par = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("MIXT"); +comp[0] = unur_str2gen("normal;domain=(-inf,-1)&method=pinv"); +comp[1] = unur_str2gen("uniform(-1,1)&method=cstd"); +comp[2] = unur_str2gen("exponential;domain=(1,inf)&method=pinv"); +par = unur_mixt_new(3,prob,comp); +gen = unur_init(par); +INFO_TEST_par("... & method=mixt",gen); +par = unur_mixt_new(3,prob,comp); +unur_mixt_set_useinversion(par,TRUE); +gen = unur_init(par); +INFO_TEST_par("... & method=mixt; useinversion=ON",gen); +unur_free(comp[0]); +unur_free(comp[1]); +unur_free(comp[2]); +comp[0] = unur_str2gen("exponential&method=pinv"); +comp[1] = unur_str2gen("poisson(5)&method=dgt"); +par = unur_mixt_new(2,prob,comp); +gen = unur_init(par); +INFO_TEST_par("... & method=mixt",gen); +unur_free(comp[0]); +unur_free(comp[1]); +comp[0] = unur_str2gen("binomial(100,0.05)&method=dgt"); +comp[1] = unur_str2gen("poisson(5)&method=dgt"); +par = unur_mixt_new(2,prob,comp); +gen = unur_init(par); +INFO_TEST_par("... & method=mixt",gen); +unur_free(comp[0]); +unur_free(comp[1]); +#endif +unur_free(gen); +} + +{ /* MVSTD */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + distr = NULL; + par = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("MVSTD"); +distr = unur_distr_multinormal( dim, mean, covar ); +par = unur_mvstd_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=mvstd",gen); +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +par = unur_mvstd_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=mvstd",gen); +#endif +unur_distr_free(distr); +unur_free(gen); +} + +{ /* MVTDR */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + double ll[] = {0.,0.,0.}; + double ru[] = {1.,UNUR_INFINITY,UNUR_INFINITY}; + distr = NULL; + par = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("MVTDR"); +distr = unur_distr_multinormal( dim, mean, covar ); +par = unur_mvtdr_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=mvtdr",gen); +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +unur_distr_cvec_set_domain_rect( distr, ll, ru); +par = unur_mvtdr_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=mvtdr",gen); +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +par = unur_mvtdr_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=mvtdr",gen); +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +par = unur_mvtdr_new(distr); +unur_mvtdr_set_stepsmin( par, 7 ); +unur_mvtdr_set_boundsplitting( par, 1.2 ); +unur_mvtdr_set_maxcones( par, 9999 ); +gen = unur_init(par); +INFO_TEST_par("... & method=mvtdr",gen); +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +par = unur_mvtdr_new(distr); +unur_mvtdr_set_maxcones( par, 10 ); +gen = unur_init(par); +INFO_TEST_par("... & method=mvtdr",gen); +#endif +unur_distr_free(distr); +unur_free(gen); +} + +{ /* NINV */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("NINV"); +INFO_TEST("normal & method=ninv"); +INFO_TEST("normal & method=ninv; usenewton"); +INFO_TEST("normal & method=ninv; usebisect"); +INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=ninv"); +INFO_TEST_chg("normal & method=ninv", unur_ninv_chg_truncated(gen,0.,1.)); +INFO_TEST("normal & method=ninv; x_resolution=1e-10"); +INFO_TEST("normal & method=ninv; u_resolution=1e-10"); +INFO_TEST("normal & method=ninv; u_resolution=1e-10; x_resolution=1e-10"); +INFO_TEST("normal & method=ninv; u_resolution=1e-10; x_resolution=-1"); +INFO_TEST("normal & method=ninv; max_iter=100"); +INFO_TEST("normal & method=ninv; start=(-1,1)"); +INFO_TEST("normal & method=ninv; table=123"); +#endif +unur_free(gen); +} + +{ /* NORTA */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; + double gamma_params[] = {5.}; + double beta_params[] = {3.,5.}; + UNUR_DISTR *marginal = NULL; + distr = NULL; + par = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("NORTA"); +distr = unur_distr_copula(dim, rankcorr); +par = unur_norta_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=norta",gen); +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_cvec_new(dim); +unur_distr_cvec_set_rankcorr(distr,rankcorr); +marginal = unur_distr_gamma(gamma_params,1); +unur_distr_cvec_set_marginals(distr,marginal); +unur_distr_free(marginal); +par = unur_norta_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=norta",gen); +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_cvec_new(dim); +unur_distr_cvec_set_rankcorr(distr,rankcorr); +unur_distr_cvec_set_marginal_list(distr, + unur_distr_cauchy(NULL,0), + unur_distr_gamma(gamma_params,1), + unur_distr_beta(beta_params,2) ); +par = unur_norta_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=norta",gen); +#endif +unur_distr_free(distr); +unur_free(gen); +} + +{ /* NROU */ +UNUR_GEN *gen = NULL; + gen = NULL; + +METHOD("NROU"); +INFO_TEST("normal & method=nrou"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou; r=2"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou; v=1"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou; u=(-0.61, 0.61)"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou; v=1; u=(-0.61, 0.61)"); +unur_free(gen); +} + +{ /* PINV */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("PINV"); +INFO_TEST("normal & method=pinv"); +INFO_TEST("normal & method=pinv; smoothness=1"); +INFO_TEST("normal & method=pinv; smoothness=2"); +INFO_TEST("normal & method=pinv; smoothness=1; order=6"); +INFO_TEST("normal & method=pinv; usecdf"); +INFO_TEST("normal & method=pinv; order=7; u_resolution=1e-14; use_upoints=on"); +INFO_TEST("normal & method=pinv; boundary=(-10,10); searchboundary=(1,0)"); +INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=pinv"); +INFO_TEST("chisquare(2) & method=pinv"); +INFO_TEST("normal & method=pinv; keepcdf=on"); +#endif +unur_free(gen); +} + +{ /* SROU */ +UNUR_GEN *gen = NULL; + gen = NULL; + +METHOD("SROU"); +INFO_TEST("normal & method=srou"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou; usemirror"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou; cdfatmode=0.5; usesqueeze"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou; r=2"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou; r=2; cdfatmode=0.5"); +unur_free(gen); +} + +{ /* SSR */ +UNUR_GEN *gen = NULL; + gen = NULL; + +METHOD("SSR"); +INFO_TEST("normal & method=ssr"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=ssr"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=ssr; cdfatmode=0.5; usesqueeze"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=ssr; cdfatmode=0.5"); +INFO_TEST("cont; pdf='exp(-x^2)';domain=(0,inf);pdfarea=0.887 & method=ssr"); +unur_free(gen); +} + +{ /* TABL */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("TABL"); +INFO_TEST("normal & method=tabl"); +INFO_TEST("normal & method=tabl;variant_ia=off;max_intervals=50"); +INFO_TEST("cont; pdf='exp(-x^2)';mode=0 & method=tabl"); +INFO_TEST("cont; pdf='exp(-x^2)';mode=0 & method=tabl; max_intervals=100; max_sqhratio=0.99"); +INFO_TEST_chg("normal & method=tabl", unur_tabl_chg_truncated(gen,0.,1.)); +#endif +unur_free(gen); +} + +{ /* TDR */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("TDR"); +INFO_TEST("normal & method=tdr"); +INFO_TEST("normal & method=tdr; max_intervals=10; cpoints=3"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr; c=0"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr; c=0; variant_ia"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr; c=0; variant_ia; max_intervals=1000"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr; c=0; variant_ia; max_intervals=1000; max_sqhratio=0.90"); +INFO_TEST_chg("normal & method=tdr", unur_tdr_chg_truncated(gen,0.,1.)); +#endif +unur_free(gen); +} + +{ /* UNIF */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("UNIF"); +INFO_TEST("uniform(0,1) & method=unif"); +#endif +unur_free(gen); +} + +{ /* UTDR */ +UNUR_GEN *gen = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("UTDR"); +INFO_TEST("normal & method=utdr"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=utdr"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=utdr;pdfatmode=1.0"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=utdr;deltafactor=1e-8"); +#endif +unur_free(gen); +} + +{ /* VEMPK */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; + distr = NULL; + par = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("VEMPK"); +distr = unur_distr_cvemp_new(2); +unur_distr_cvemp_set_data(distr, data, 4); +par = unur_vempk_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=vempk",gen); +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_cvemp_new(2); +unur_distr_cvemp_set_data(distr, data, 4); +par = unur_vempk_new(distr); +unur_vempk_set_smoothing(par,1.5); +unur_vempk_set_varcor(par,TRUE); +gen = unur_init(par); +INFO_TEST_par("... & method=vempk",gen); +#endif +unur_distr_free(distr); +unur_free(gen); +} + +{ /* VNROU */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + double ll[] = {0.,0.,0.}; + double ru[] = {1.,UNUR_INFINITY,UNUR_INFINITY}; + distr = NULL; + par = NULL; + gen = NULL; + +#ifdef UNUR_ENABLE_INFO +METHOD("VNROU"); +distr = unur_distr_multinormal( dim, mean, covar ); +par = unur_vnrou_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=vnrou",gen); +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +unur_distr_cvec_set_domain_rect( distr, ll, ru); +par = unur_vnrou_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=vnrou",gen); +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +par = unur_vnrou_new(distr); +unur_vnrou_set_r(par,2.); +gen = unur_init(par); +INFO_TEST_par("... & method=vnrou",gen); +#endif +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_info_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_info.conf b/vendor/unuran-1.11.0/tests/t_info.conf new file mode 100644 index 0000000..f53e3b7 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_info.conf @@ -0,0 +1,952 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: INFO + +[main - header:] + +/* prototypes */ + +/* CEXT: */ +double exp1_sample(UNUR_GEN *gen); + +/* DEXT: */ +int geom12_sample(UNUR_GEN *gen); + + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + + +/* macros for running info test */ + +\#define INFO_TEST(genstr) \ + gen = unur_str2gen((genstr)); \ + fprintf(TESTLOG,"GEN = \"%s\"\n",(genstr)); \ + fprintf(TESTLOG,"INFO = \n%s\n",unur_gen_info(gen,FALSE)); \ + fprintf(TESTLOG,"HELP = \n%s\n",unur_gen_info(gen,TRUE)); \ + fprintf(TESTLOG,"---------------------\n"); \ + unur_free(gen); gen = NULL; + +\#define INFO_TEST_chg(genstr,run_chg) \ + gen = unur_str2gen((genstr)); \ + run_chg; \ + fprintf(TESTLOG,"GEN = \"%s\"\n",(genstr)); \ + fprintf(TESTLOG,"INFO = \n%s\n",unur_gen_info(gen,FALSE)); \ + fprintf(TESTLOG,"HELP = \n%s\n",unur_gen_info(gen,TRUE)); \ + fprintf(TESTLOG,"---------------------\n"); \ + unur_free(gen); gen = NULL; + +\#define METHOD(m) \ + printf("%s ",(m)); \ + fprintf(TESTLOG,"*********************\n"); \ + fprintf(TESTLOG,"* %s\n",(m)); \ + fprintf(TESTLOG,"*********************\n\n"); \ + fflush(stdout); + +\#define INFO_TEST_par(genstr,gen) \ + fprintf(TESTLOG,"GEN = \"%s\"\n",(genstr)); \ + fprintf(TESTLOG,"INFO = \n%s\n",unur_gen_info((gen),FALSE)); \ + fprintf(TESTLOG,"HELP = \n%s\n",unur_gen_info((gen),TRUE)); \ + fprintf(TESTLOG,"---------------------\n"); \ + unur_free(gen); gen = NULL; + + +############################################################################# + +[new] + +############################################################################# + +# [set] + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################# + +# [init] + +############################################################################# + +# [reinit] + +############################################################################# + +[sample] + +[sample - set debugging flags: + gen = NULL; ] + +unur_set_default_debug(UNUR_DEBUG_INIT); + +#--------------------------------------------------------------------- + +[sample - AROU: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("AROU"); + +INFO_TEST("normal & method=arou"); +INFO_TEST("normal & method=arou; max_segments=10; cpoints=3"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=arou; max_segments=1000"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=arou; max_segments=1000; max_sqhratio=0.90"); + +\#endif + +#--------------------------------------------------------------------- + +[sample - ARS: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("ARS"); + +INFO_TEST("normal & method=ars"); +INFO_TEST("normal & method=ars; cpoints=100"); +INFO_TEST("cont; logpdf='-x^2' & method=ars"); + +\#endif + +#--------------------------------------------------------------------- + +[sample - CEXT: + distr = NULL; + par = NULL; + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("CEXT"); + +distr = unur_distr_exponential(NULL,0); +par = unur_cext_new(distr); +unur_cext_set_sample(par,exp1_sample); +gen = unur_init(par); +INFO_TEST_par("... & method=cext",gen); + +\#endif + +#--------------------------------------------------------------------- + +[sample - CSTD: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("CSTD"); + +INFO_TEST("normal & method=cstd"); +INFO_TEST("normal & method=cstd; variant=0"); +INFO_TEST("normal & method=cstd; variant=-1"); +INFO_TEST("normal & method=cstd; variant=1"); +INFO_TEST("normal & method=cstd; variant=2"); +INFO_TEST("normal & method=cstd; variant=3"); + +\#endif + +#--------------------------------------------------------------------- + +[sample - DARI: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("DARI"); + +INFO_TEST("geometric(0.5) & method=dari"); +INFO_TEST("binomial(20,0.5) & method=dari"); +INFO_TEST("binomial(20,0.5) & method=dari;squeeze=on"); +INFO_TEST("binomial(20,0.5) & method=dari;tablesize=0"); +INFO_TEST("binomial(20,0.5) & method=dari;cpfactor=0.6"); + +INFO_TEST("discr; pmf='0.5^x';domain=(0,inf) & method=dari"); +INFO_TEST("discr; pmf='2*0.5^x';domain=(1,inf) & method=dari"); + +\#endif + +#--------------------------------------------------------------------- + +[sample - DAU: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("DAU"); + +INFO_TEST("geometric(0.5) & method=dau"); +INFO_TEST("geometric(0.5) & method=dau;urnfactor=2"); +INFO_TEST("discr; pv=(.1,.2,.3,.4,.5,.6,.7) & method=dau"); + +\#endif + +#--------------------------------------------------------------------- + +[sample - DGT: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("DGT"); + +INFO_TEST("geometric(0.5) & method=dgt"); +INFO_TEST("geometric(0.5) & method=dgt;guidefactor=2"); +INFO_TEST("discr; pv=(.1,.2,.3,.4,.5,.6,.7) & method=dgt"); + +\#endif + +#--------------------------------------------------------------------- + +[sample - DSROU: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("DSROU"); + +INFO_TEST("geometric(0.5) & method=dsrou"); +INFO_TEST("binomial(20,0.5) & method=dsrou;cdfatmode=0.5"); +INFO_TEST("binomial(20,0.5) & method=dsrou"); +INFO_TEST("discr; pmf='0.5^x';domain=(0,inf);pmfsum=2 & method=dsrou"); +INFO_TEST("discr; pmf='2*0.5^x';domain=(1,inf);pmfsum=2 & method=dsrou"); + +\#endif + +#--------------------------------------------------------------------- + +[sample - DSS: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("DSS"); + +INFO_TEST("geometric(0.5) & method=dss"); +INFO_TEST("discr; pv=(.1,.2,.3,.4,.5,.6,.7);pmfsum=2.8 & method=dss"); +INFO_TEST("discr; cdf='1-exp(-x)';pmfsum=1 & method=dss"); + +\#endif + +#--------------------------------------------------------------------- + +[sample - DSTD: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("DSTD"); + +INFO_TEST("poisson(10) & method=dstd"); +INFO_TEST("poisson(10) & method=dstd;variant=0"); +INFO_TEST("poisson(10) & method=dstd;variant=2"); +INFO_TEST("geometric(0.5) & method=dstd"); +INFO_TEST("geometric(0.5) & method=dstd;variant=0"); +INFO_TEST("geometric(0.5) & method=dstd;variant=-1"); + +\#endif + +#--------------------------------------------------------------------- + +[sample - DEXT: + double fpar[1] = {0.5}; + distr = NULL; + par = NULL; + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("DEXT"); + +distr = unur_distr_geometric(fpar,1); +par = unur_dext_new(distr); +unur_dext_set_sample(par,geom12_sample); +gen = unur_init(par); +INFO_TEST_par("... & method=dext",gen); + +\#endif + +#--------------------------------------------------------------------- + +[sample - EMPK: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("EMPK"); + +INFO_TEST("cemp; data=(1.,2.,3.,4.,5.,6.,7.,8.,9.) & method=empk"); +INFO_TEST("cemp; data=(1.,2.,3.,4.,5.,6.,7.,8.,9.) & method=empk\ + ;beta=1.5;positive=on;smoothing=1.2;varcor=on"); + +\#endif + +#--------------------------------------------------------------------- + +[sample - EMPL: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("EMPL"); + +INFO_TEST("cemp; data=(1.,2.,3.,4.,5.,6.,7.,8.,9.) & method = empl"); + +\#endif + +#--------------------------------------------------------------------- + +[sample - GIBBS: + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + double ll[] = {0.,0.,0.}; + double ru[] = {1.,UNUR_INFINITY,UNUR_INFINITY}; + distr = NULL; + par = NULL; + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("GIBBS"); + +distr = unur_distr_multinormal( dim, mean, covar ); +par = unur_gibbs_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=gibbs",gen); + +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +unur_distr_cvec_set_domain_rect( distr, ll, ru); +par = unur_gibbs_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=gibbs",gen); + +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +par = unur_gibbs_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=gibbs",gen); + +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +par = unur_gibbs_new(distr); +unur_gibbs_set_variant_random_direction(par); +unur_gibbs_set_c(par,-0.5); +unur_gibbs_set_thinning(par,3); +unur_gibbs_set_burnin(par,1000); +gen = unur_init(par); +INFO_TEST_par("... & method=gibbs",gen); + +\#endif + +#--------------------------------------------------------------------- + +[sample - HINV: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("HINV"); + +INFO_TEST("normal & method=hinv"); +INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=hinv"); +INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=hinv; order=5"); +INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf); mode=0 & method=hinv"); +INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=hinv; u_resolution=1e-16"); +INFO_TEST_chg("normal & method=hinv", unur_hinv_chg_truncated(gen,0.,1.)); + +\#endif + +#--------------------------------------------------------------------- + +[sample - HIST: + double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; + double bins[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.,10.}; + distr = NULL; + par = NULL; + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("HIST"); + +distr = unur_distr_cemp_new(); +unur_distr_cemp_set_hist_prob(distr,hist,9); +unur_distr_cemp_set_hist_domain(distr,1.,10.); +par = unur_hist_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=hist",gen); + +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_cemp_new(); +unur_distr_cemp_set_hist_prob(distr,hist,9); +unur_distr_cemp_set_hist_bins(distr,bins,10); +unur_distr_cemp_set_hist_domain(distr,1.,10.); +par = unur_hist_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=hist",gen); + +\#endif + +#--------------------------------------------------------------------- + +[sample - HITRO: + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + double ll[] = {0.,0.,0.}; + double ru[] = {1.,UNUR_INFINITY,UNUR_INFINITY}; + distr = NULL; + par = NULL; + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("HITRO"); + +distr = unur_distr_multinormal( dim, mean, covar ); +par = unur_hitro_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=hitro",gen); + +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +unur_distr_cvec_set_domain_rect( distr, ll, ru); +par = unur_hitro_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=hitro",gen); + +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +par = unur_hitro_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=hitro",gen); + +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +par = unur_hitro_new(distr); +unur_hitro_set_variant_random_direction(par); +unur_hitro_set_r(par,2.); +unur_hitro_set_thinning(par,3); +unur_hitro_set_burnin(par,1000); +gen = unur_init(par); +INFO_TEST_par("... & method=hitro",gen); + +\#endif + +#--------------------------------------------------------------------- + +[sample - HRB: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("HRB"); + +INFO_TEST("cont; hr='1./(1.+x)' & method=hrb"); +INFO_TEST("cont; hr='1./(1.+x)' & method=hrb;upperbound=1.1"); + +\#endif + +#--------------------------------------------------------------------- + +[sample - HRD: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("HRD"); + +INFO_TEST("cont; hr='1./(1.+x)' & method=hrd"); + +\#endif + +#--------------------------------------------------------------------- + +[sample - HRI: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("HRI"); + +INFO_TEST("cont; hr='3*x*x' & method=hri"); +INFO_TEST("cont; hr='3*x*x' & method=hri;p0=0.8"); + +\#endif + +#--------------------------------------------------------------------- + +[sample - ITDR: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("ITDR"); + +INFO_TEST("gamma(0.5) & method=itdr"); +INFO_TEST("gamma(0.5) & method=itdr; cp=-0.5; ct=-0.5"); +INFO_TEST("gamma(0.5) & method=itdr; cp=-0.5; ct=-0.5; xi=0.4"); +INFO_TEST("cont; pdf='exp(-x)/sqrt(x)';mode=0;domain=(0,inf) & method=itdr"); + +\#endif + +#--------------------------------------------------------------------- + +[sample - MCORR: + double eigenvalues[] = {1.,2.,3.,4.}; + distr = NULL; + par = NULL; + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("MCORR"); + +distr = unur_distr_correlation(4); +par = unur_mcorr_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=mcorr",gen); + +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_correlation(4); +par = unur_mcorr_new(distr); +unur_mcorr_set_eigenvalues( par, eigenvalues ); +gen = unur_init(par); +INFO_TEST_par("... & method=mcorr",gen); + +\#endif + +#--------------------------------------------------------------------- + +[sample - MIXT: + UNUR_GEN *comp[3]; + double prob[3] = {1,2,3}; + par = NULL; + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("MIXT"); + +comp[0] = unur_str2gen("normal;domain=(-inf,-1)&method=pinv"); +comp[1] = unur_str2gen("uniform(-1,1)&method=cstd"); +comp[2] = unur_str2gen("exponential;domain=(1,inf)&method=pinv"); + +par = unur_mixt_new(3,prob,comp); +gen = unur_init(par); +INFO_TEST_par("... & method=mixt",gen); + +par = unur_mixt_new(3,prob,comp); +unur_mixt_set_useinversion(par,TRUE); +gen = unur_init(par); +INFO_TEST_par("... & method=mixt; useinversion=ON",gen); + +unur_free(comp[0]); +unur_free(comp[1]); +unur_free(comp[2]); + +comp[0] = unur_str2gen("exponential&method=pinv"); +comp[1] = unur_str2gen("poisson(5)&method=dgt"); + +par = unur_mixt_new(2,prob,comp); +gen = unur_init(par); +INFO_TEST_par("... & method=mixt",gen); + +unur_free(comp[0]); +unur_free(comp[1]); + +comp[0] = unur_str2gen("binomial(100,0.05)&method=dgt"); +comp[1] = unur_str2gen("poisson(5)&method=dgt"); + +par = unur_mixt_new(2,prob,comp); +gen = unur_init(par); +INFO_TEST_par("... & method=mixt",gen); + +unur_free(comp[0]); +unur_free(comp[1]); + +\#endif + +#--------------------------------------------------------------------- + +[sample - MVSTD: + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + distr = NULL; + par = NULL; + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("MVSTD"); + +distr = unur_distr_multinormal( dim, mean, covar ); +par = unur_mvstd_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=mvstd",gen); + +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +par = unur_mvstd_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=mvstd",gen); + +\#endif + +#--------------------------------------------------------------------- + +[sample - MVTDR: + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + double ll[] = {0.,0.,0.}; + double ru[] = {1.,UNUR_INFINITY,UNUR_INFINITY}; + distr = NULL; + par = NULL; + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("MVTDR"); + +distr = unur_distr_multinormal( dim, mean, covar ); +par = unur_mvtdr_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=mvtdr",gen); + +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +unur_distr_cvec_set_domain_rect( distr, ll, ru); +par = unur_mvtdr_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=mvtdr",gen); + +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +par = unur_mvtdr_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=mvtdr",gen); + +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +par = unur_mvtdr_new(distr); +unur_mvtdr_set_stepsmin( par, 7 ); +unur_mvtdr_set_boundsplitting( par, 1.2 ); +unur_mvtdr_set_maxcones( par, 9999 ); +gen = unur_init(par); +INFO_TEST_par("... & method=mvtdr",gen); + +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +par = unur_mvtdr_new(distr); +unur_mvtdr_set_maxcones( par, 10 ); +gen = unur_init(par); +INFO_TEST_par("... & method=mvtdr",gen); + +\#endif + +#--------------------------------------------------------------------- + +[sample - NINV: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("NINV"); + +INFO_TEST("normal & method=ninv"); +INFO_TEST("normal & method=ninv; usenewton"); +INFO_TEST("normal & method=ninv; usebisect"); +INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=ninv"); +INFO_TEST_chg("normal & method=ninv", unur_ninv_chg_truncated(gen,0.,1.)); +INFO_TEST("normal & method=ninv; x_resolution=1e-10"); +INFO_TEST("normal & method=ninv; u_resolution=1e-10"); +INFO_TEST("normal & method=ninv; u_resolution=1e-10; x_resolution=1e-10"); +INFO_TEST("normal & method=ninv; u_resolution=1e-10; x_resolution=-1"); +INFO_TEST("normal & method=ninv; max_iter=100"); +INFO_TEST("normal & method=ninv; start=(-1,1)"); +INFO_TEST("normal & method=ninv; table=123"); + +\#endif + +#--------------------------------------------------------------------- + +[sample - NORTA: + const int dim = 3; + double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; + double gamma_params[] = {5.}; + double beta_params[] = {3.,5.}; + UNUR_DISTR *marginal = NULL; + distr = NULL; + par = NULL; + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("NORTA"); + +distr = unur_distr_copula(dim, rankcorr); +par = unur_norta_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=norta",gen); + +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_cvec_new(dim); +unur_distr_cvec_set_rankcorr(distr,rankcorr); +marginal = unur_distr_gamma(gamma_params,1); +unur_distr_cvec_set_marginals(distr,marginal); +unur_distr_free(marginal); +par = unur_norta_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=norta",gen); + +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_cvec_new(dim); +unur_distr_cvec_set_rankcorr(distr,rankcorr); +unur_distr_cvec_set_marginal_list(distr, + unur_distr_cauchy(NULL,0), + unur_distr_gamma(gamma_params,1), + unur_distr_beta(beta_params,2) ); +par = unur_norta_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=norta",gen); + +\#endif + +#--------------------------------------------------------------------- + +[sample - NROU: + gen = NULL; ] + +METHOD("NROU"); + +INFO_TEST("normal & method=nrou"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou; r=2"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou; v=1"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou; u=(-0.61, 0.61)"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou; v=1; u=(-0.61, 0.61)"); + +#--------------------------------------------------------------------- + +[sample - PINV: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("PINV"); + +INFO_TEST("normal & method=pinv"); +INFO_TEST("normal & method=pinv; smoothness=1"); +INFO_TEST("normal & method=pinv; smoothness=2"); +INFO_TEST("normal & method=pinv; smoothness=1; order=6"); +INFO_TEST("normal & method=pinv; usecdf"); +INFO_TEST("normal & method=pinv; order=7; u_resolution=1e-14; use_upoints=on"); +INFO_TEST("normal & method=pinv; boundary=(-10,10); searchboundary=(1,0)"); +INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=pinv"); +INFO_TEST("chisquare(2) & method=pinv"); +INFO_TEST("normal & method=pinv; keepcdf=on"); + +\#endif + +#--------------------------------------------------------------------- + +[sample - SROU: + gen = NULL; ] + +METHOD("SROU"); + +INFO_TEST("normal & method=srou"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou; usemirror"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou; cdfatmode=0.5; usesqueeze"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou; r=2"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou; r=2; cdfatmode=0.5"); + +#--------------------------------------------------------------------- + +[sample - SSR: + gen = NULL; ] + +METHOD("SSR"); + +INFO_TEST("normal & method=ssr"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=ssr"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=ssr; cdfatmode=0.5; usesqueeze"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=ssr; cdfatmode=0.5"); +INFO_TEST("cont; pdf='exp(-x^2)';domain=(0,inf);pdfarea=0.887 & method=ssr"); + +#--------------------------------------------------------------------- + +[sample - TABL: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("TABL"); + +INFO_TEST("normal & method=tabl"); +INFO_TEST("normal & method=tabl;variant_ia=off;max_intervals=50"); +INFO_TEST("cont; pdf='exp(-x^2)';mode=0 & method=tabl"); +INFO_TEST("cont; pdf='exp(-x^2)';mode=0 & method=tabl; max_intervals=100; max_sqhratio=0.99"); +INFO_TEST_chg("normal & method=tabl", unur_tabl_chg_truncated(gen,0.,1.)); + +\#endif + +#--------------------------------------------------------------------- + +[sample - TDR: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("TDR"); + +INFO_TEST("normal & method=tdr"); +INFO_TEST("normal & method=tdr; max_intervals=10; cpoints=3"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr; c=0"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr; c=0; variant_ia"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr; c=0; variant_ia; max_intervals=1000"); +INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr; c=0; variant_ia; max_intervals=1000; max_sqhratio=0.90"); +INFO_TEST_chg("normal & method=tdr", unur_tdr_chg_truncated(gen,0.,1.)); + +\#endif + +#--------------------------------------------------------------------- + +[sample - UNIF: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("UNIF"); + +INFO_TEST("uniform(0,1) & method=unif"); + +\#endif + +#--------------------------------------------------------------------- + +[sample - UTDR: + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("UTDR"); + +INFO_TEST("normal & method=utdr"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=utdr"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=utdr;pdfatmode=1.0"); +INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=utdr;deltafactor=1e-8"); + +\#endif + +#--------------------------------------------------------------------- + +[sample - VEMPK: + double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; + distr = NULL; + par = NULL; + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("VEMPK"); + +distr = unur_distr_cvemp_new(2); +unur_distr_cvemp_set_data(distr, data, 4); +par = unur_vempk_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=vempk",gen); + +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_cvemp_new(2); +unur_distr_cvemp_set_data(distr, data, 4); +par = unur_vempk_new(distr); +unur_vempk_set_smoothing(par,1.5); +unur_vempk_set_varcor(par,TRUE); +gen = unur_init(par); +INFO_TEST_par("... & method=vempk",gen); + +\#endif + +#--------------------------------------------------------------------- + +[sample - VNROU: + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + double ll[] = {0.,0.,0.}; + double ru[] = {1.,UNUR_INFINITY,UNUR_INFINITY}; + distr = NULL; + par = NULL; + gen = NULL; ] + +\#ifdef UNUR_ENABLE_INFO + +METHOD("VNROU"); + +distr = unur_distr_multinormal( dim, mean, covar ); +par = unur_vnrou_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=vnrou",gen); + +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +unur_distr_cvec_set_domain_rect( distr, ll, ru); +par = unur_vnrou_new(distr); +gen = unur_init(par); +INFO_TEST_par("... & method=vnrou",gen); + +unur_distr_free(distr);unur_free(gen); +distr = unur_distr_multinormal( dim, NULL, NULL ); +par = unur_vnrou_new(distr); +unur_vnrou_set_r(par,2.); +gen = unur_init(par); +INFO_TEST_par("... & method=vnrou",gen); + +\#endif + +#--------------------------------------------------------------------- + +############################################################################# + +# [validate] + +############################################################################# +############################################################################# + +[verbatim] + +## -------------------------------------------------------------------------- +## CEXT: + +double exp1_sample(UNUR_GEN *gen) { + double U = unur_sample_urng(gen); + return (-log(1. - U)); +} + +## -------------------------------------------------------------------------- +## DEXT: + +int geom12_sample(UNUR_GEN *gen) { + double U = unur_sample_urng(gen); + return ((int) (log(U) / log(0.5))); +} + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_itdr.c b/vendor/unuran-1.11.0/tests/t_itdr.c new file mode 100644 index 0000000..ebd799d --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_itdr.c @@ -0,0 +1,8226 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for ITDR + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ +/* pdf of gamma density (a=1/2) */ +double pdf_gamma12( double x, const UNUR_DISTR *distr ); +double dpdf_gamma12( double x, const UNUR_DISTR *distr ); + +int unur_itdr_set_pedantic( struct unur_par *par, int pedantic ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + +/* #define SEED (298346) */ + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* pdf of gamma density (a=1/2) */ +double pdf_gamma12( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return exp(-x)/sqrt(x); +} + +double dpdf_gamma12( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return -exp(-x)/sqrt(x) * (1.+1./(2.*x)); +} + + +/* dummy function */ +int unur_itdr_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,32,(unur_itdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,32,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,38,(unur_itdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,38,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +/* pdf, mode (pole) */ +n_tests_failed += (check_expected_NULL(TESTLOG,45,(unur_itdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr, pdf_gamma12); + + +unur_reset_errno(); +/* mode (pole) */ +n_tests_failed += (check_expected_NULL(TESTLOG,53,(unur_itdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,63,(unur_itdr_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,66,(unur_itdr_set_xi(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,69,(unur_itdr_set_cp(par, -0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,69,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,72,(unur_itdr_set_ct(par, -0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,72,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,81,(unur_itdr_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,81,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,84,(unur_itdr_set_xi(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,84,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,87,(unur_itdr_set_cp(par, -0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,87,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,90,(unur_itdr_set_ct(par, -0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,90,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[1] = {0.5}; + distr = unur_distr_gamma(fpar,1); + par = unur_itdr_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,101,(unur_itdr_set_xi(par,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,104,(unur_itdr_set_cp(par, 0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,104,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,107,(unur_itdr_set_cp(par, -1.0)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,107,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,110,(unur_itdr_set_ct(par, 0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,110,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,113,(unur_itdr_set_ct(par, -1.0)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,113,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,126,(unur_itdr_get_xi(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,126,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,129,(unur_itdr_get_cp(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,129,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,132,(unur_itdr_get_ct(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,132,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,135,(unur_itdr_get_area(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,135,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 140, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,144,(unur_itdr_get_xi(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,144,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,147,(unur_itdr_get_cp(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,147,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,150,(unur_itdr_get_ct(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,150,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,153,(unur_itdr_get_area(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,153,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,163,(unur_itdr_chg_verify( gen, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,163,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 167, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,171,(unur_itdr_chg_verify( gen, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,171,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,183,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,183,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_cont_new(); + par = NULL; + + +unur_reset_errno(); +/* dpdf, mode */ +unur_distr_cont_set_pdf(distr,pdf_gamma12); +n_tests_failed += (check_expected_NULL(TESTLOG,192,(par = unur_itdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,192,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* mode */ +unur_distr_cont_set_dpdf(distr,dpdf_gamma12); +n_tests_failed += (check_expected_NULL(TESTLOG,197,(par = unur_itdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,197,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_distr_cont_set_mode(distr,0.); +n_tests_failed += (check_expected_NULL(TESTLOG,201,(par = unur_itdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,201,UNUR_ERR_DISTR_PROP)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* does not exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpm[] = { 0.8 }; + distr = unur_distr_gamma(fpm,1); + par = unur_itdr_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 211, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,215,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpm[] = { 0.8, 1., 1. }; + distr = unur_distr_gamma(fpm,3); + par = NULL; + + +unur_reset_errno(); +/* default algorithm */ +par = unur_itdr_new(distr); +n_tests_failed += (compare_sequence_par_start(TESTLOG,228,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* default algorithm - verifying mode */ +par = unur_itdr_new(distr); +unur_itdr_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,233,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double xi, cp, ct; + double fpm[] = { 0.8, 1., 1. }; + distr = unur_distr_gamma(fpm,3); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* default algorithm */ +par = unur_itdr_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,247,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* set bx, ct and cp */ +xi = unur_itdr_get_xi(gen); +ct = unur_itdr_get_ct(gen); +cp = unur_itdr_get_cp(gen); +unur_free(gen); +par = unur_itdr_new(distr); +unur_itdr_set_xi(par,xi); +unur_itdr_set_cp(par,cp); +unur_itdr_set_ct(par,ct); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen(TESTLOG,259,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double xi, cp, ct; + double fpm[] = { 0.3, 1., 1. }; + distr = unur_distr_gamma(fpm,3); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* default algorithm */ +par = unur_itdr_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,273,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* set bx, ct and cp */ +xi = unur_itdr_get_xi(gen); +ct = unur_itdr_get_ct(gen); +cp = unur_itdr_get_cp(gen); +unur_free(gen); +par = unur_itdr_new(distr); +unur_itdr_set_xi(par,xi); +unur_itdr_set_cp(par,cp); +unur_itdr_set_ct(par,ct); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen(TESTLOG,285,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double xi, cp, ct; + double fpm[] = { 3., 0.3, 1., 2. }; + distr = unur_distr_beta(fpm,4); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* default algorithm */ +par = unur_itdr_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,299,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* set bx, ct and cp */ +xi = unur_itdr_get_xi(gen); +ct = unur_itdr_get_ct(gen); +cp = unur_itdr_get_cp(gen); +unur_free(gen); +par = unur_itdr_new(distr); +unur_itdr_set_xi(par,xi); +unur_itdr_set_cp(par,cp); +unur_itdr_set_ct(par,ct); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen(TESTLOG,311,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double fpm[] = { 0.3, 1., 1. }; + distr = unur_distr_gamma(fpm,3); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_itdr_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,325,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,331,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpm[] = { 0.8 }; + distr = unur_distr_gamma(fpm,1); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_itdr_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,344,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,348,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[] = { 0.3, 1., 1. }; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_gamma(fpar,3); +par = unur_itdr_new(distr); +unur_itdr_set_xi(par,1.3); +unur_itdr_set_cp(par,-0.7); +unur_itdr_set_ct(par,-0.3); +unur_itdr_set_verify(par,TRUE); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,365,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(0.3,1.,1.) & \ + method = itdr; xi = 1.3; cp = -0.7; ct = -0.3; verify" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,371,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[53]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 53 */ +{ +fpm[0] = 0.1; +distr[0] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 0.1; +distr[1] = unur_distr_gamma_wo_logpdf(fpm,1); +} + +{ +fpm[0] = 0.5; +distr[2] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 0.5; +distr[3] = unur_distr_gamma_wo_logpdf(fpm,1); +} + +{ +fpm[0] = 0.9; +distr[4] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 0.9; +distr[5] = unur_distr_gamma_wo_logpdf(fpm,1); +} + +{ +fpm[0] = 1.; +distr[6] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 1.; +distr[7] = unur_distr_gamma_wo_logpdf(fpm,1); +} + +{ +fpm[0] = 2.; +distr[8] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 2.; +distr[9] = unur_distr_gamma_wo_logpdf(fpm,1); +} + +{ +fpm[0] = 0.5; +fpm[1] = 2.; +fpm[2] = 1.; +distr[10] = unur_distr_gamma(fpm,3); +} + +{ +fpm[0] = 0.5; +fpm[1] = 2.; +fpm[2] = 1.; +distr[11] = unur_distr_gamma_wo_logpdf(fpm,3); +} + +{ +fpm[0] = 0.5; +fpm[1] = 2.; +fpm[2] = -1.; +distr[12] = unur_distr_gamma(fpm,3); +} + +{ +fpm[0] = 0.5; +fpm[1] = 2.; +fpm[2] = -1.; +distr[13] = unur_distr_gamma_wo_logpdf(fpm,3); +} + +{ +fpm[0] = 0.5; +fpm[1] = 1.; +fpm[2] = 1.; +distr[14] = unur_distr_gamma(fpm,3); +unur_distr_cont_set_domain(distr[14],1.,1.1); +} + +{ +fpm[0] = 0.5; +fpm[1] = 1.; +fpm[2] = 1.; +distr[15] = unur_distr_gamma_wo_logpdf(fpm,3); +unur_distr_cont_set_domain(distr[15],1.,1.1); +} + +{ +fpm[0] = 0.5; +fpm[1] = 1.; +fpm[2] = 1.; +distr[16] = unur_distr_gamma(fpm,3); +unur_distr_cont_set_domain(distr[16],1.,2.); +} + +{ +fpm[0] = 0.5; +fpm[1] = 1.; +fpm[2] = 1.; +distr[17] = unur_distr_gamma_wo_logpdf(fpm,3); +unur_distr_cont_set_domain(distr[17],1.,2.); +} + +{ +fpm[0] = 0.5; +fpm[1] = 1.; +fpm[2] = 1.; +distr[18] = unur_distr_gamma(fpm,3); +unur_distr_cont_set_domain(distr[18],1.,4.); +} + +{ +fpm[0] = 0.5; +fpm[1] = 1.; +fpm[2] = 1.; +distr[19] = unur_distr_gamma_wo_logpdf(fpm,3); +unur_distr_cont_set_domain(distr[19],1.,4.); +} + +{ +fpm[0] = 1.5; +distr[48] = unur_distr_gamma(fpm,1); +unur_distr_cont_set_domain(distr[48],1.,UNUR_INFINITY); +} + +{ +fpm[0] = 1.5; +distr[49] = unur_distr_gamma_wo_logpdf(fpm,1); +unur_distr_cont_set_domain(distr[49],1.,UNUR_INFINITY); +} + +{ +distr[20] = unur_distr_normal(NULL,0); +} + +{ +distr[21] = unur_distr_normal_wo_logpdf(NULL,0); +} + +{ +distr[22] = unur_distr_normal(NULL,0); +unur_distr_cont_set_domain(distr[22],0.,UNUR_INFINITY); +} + +{ +distr[23] = unur_distr_normal_wo_logpdf(NULL,0); +unur_distr_cont_set_domain(distr[23],0.,UNUR_INFINITY); +} + +{ +distr[24] = unur_distr_normal(NULL,0); +unur_distr_cont_set_domain(distr[24],0.,4.); +} + +{ +distr[25] = unur_distr_normal_wo_logpdf(NULL,0); +unur_distr_cont_set_domain(distr[25],0.,4.); +} + +{ +distr[26] = unur_distr_normal(NULL,0); +unur_distr_cont_set_domain(distr[26],1.,4.); +} + +{ +distr[27] = unur_distr_normal_wo_logpdf(NULL,0); +unur_distr_cont_set_domain(distr[27],1.,4.); +} + +{ +distr[28] = unur_distr_normal(NULL,0); +unur_distr_cont_set_domain(distr[28],-0.5,4.); +unur_distr_cont_set_mode(distr[28],-0.5); +} + +{ +distr[29] = unur_distr_normal_wo_logpdf(NULL,0); +unur_distr_cont_set_domain(distr[29],-0.5,4.); +unur_distr_cont_set_mode(distr[29],-0.5); +} + +{ +distr[30] = unur_distr_cauchy(NULL,0); +} + +{ +distr[31] = unur_distr_cauchy_wo_logpdf(NULL,0); +} + +{ +distr[32] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[32],0.,UNUR_INFINITY); +} + +{ +distr[33] = unur_distr_cauchy_wo_logpdf(NULL,0); +unur_distr_cont_set_domain(distr[33],0.,UNUR_INFINITY); +} + +{ +distr[34] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[34],0.,4.); +} + +{ +distr[35] = unur_distr_cauchy_wo_logpdf(NULL,0); +unur_distr_cont_set_domain(distr[35],0.,4.); +} + +{ +distr[36] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[36],1.,4.); +} + +{ +distr[37] = unur_distr_cauchy_wo_logpdf(NULL,0); +unur_distr_cont_set_domain(distr[37],1.,4.); +} + +{ +distr[38] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[38],-0.5,4.); +unur_distr_cont_set_mode(distr[38],-0.5); +} + +{ +distr[39] = unur_distr_cauchy_wo_logpdf(NULL,0); +unur_distr_cont_set_domain(distr[39],-0.5,4.); +unur_distr_cont_set_mode(distr[39],-0.5); +} + +{ +fpm[0] = 0.5; +fpm[1] = 3.; +distr[40] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 0.5; +fpm[1] = 3.; +distr[41] = unur_distr_beta_wo_logpdf(fpm,2); +} + +{ +fpm[0] = 0.5; +fpm[1] = 3.; +fpm[2] = 1.; +fpm[3] = 2.; +distr[42] = unur_distr_beta(fpm,4); +} + +{ +fpm[0] = 0.5; +fpm[1] = 3.; +fpm[2] = 1.; +fpm[3] = 2.; +distr[43] = unur_distr_beta_wo_logpdf(fpm,4); +} + +{ +fpm[0] = 3.; +fpm[1] = 0.5; +fpm[2] = -1.; +fpm[3] = 0.; +distr[44] = unur_distr_beta(fpm,4); +} + +{ +fpm[0] = 3.; +fpm[1] = 0.5; +fpm[2] = -1.; +fpm[3] = 0.; +distr[45] = unur_distr_beta_wo_logpdf(fpm,4); +} + +{ +fpm[0] = 3.; +fpm[1] = 0.5; +distr[46] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 3.; +fpm[1] = 0.5; +distr[47] = unur_distr_beta_wo_logpdf(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 5.; +distr[50] = unur_distr_F(fpm,2); +} + +{ +fpm[0] = 1.99; +fpm[1] = 5.; +distr[51] = unur_distr_F(fpm,2); +} + +{ +fpm[0] = 0.1; +fpm[1] = 5.; +distr[52] = unur_distr_F(fpm,2); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 265 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_itdr_new(distr_localcopy); +unur_itdr_set_xi(par,0.1); +unur_itdr_set_cp(par,-0.9); +unur_itdr_set_ct(par,-0.54); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_itdr_new(distr_localcopy); +unur_itdr_set_xi(par,0.5); +unur_itdr_set_cp(par,-0.5); +unur_itdr_set_ct(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [16] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [48] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[48]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[48],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[48]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[48],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[48]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[48],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_itdr_new(distr_localcopy); +unur_itdr_set_xi(par,0.1); +unur_itdr_set_cp(par,-0.9); +unur_itdr_set_ct(par,-0.54); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_itdr_new(distr_localcopy); +unur_itdr_set_xi(par,0.5); +unur_itdr_set_cp(par,-0.5); +unur_itdr_set_ct(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [15] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [49] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[49]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[49],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[49]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[49],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[49]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[49],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [29] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [32] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [34] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [36] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [38] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [31] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [33] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [35] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [37] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [39] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[39]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[39],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [40] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [42] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[42],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[42],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[42],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [44] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[44]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[44],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[44]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[44],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[44]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[44],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [46] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[46]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[46],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[46]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[46],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[46]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[46],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [41] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[41],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[41],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[41],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [43] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [45] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[45]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[45],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[45]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[45],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[45]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[45],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [47] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[47]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[47],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[47]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[47],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[47]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[47],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [50] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[50]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[50],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[50]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[50],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[50]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[50],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [51] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[51]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[51],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[51]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[51],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[51]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[51],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [52] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[52]); +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[52],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[52]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[52],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[52]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[52],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 265 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +unur_itdr_set_xi(par,0.1); +unur_itdr_set_cp(par,-0.9); +unur_itdr_set_ct(par,-0.54); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +unur_itdr_set_xi(par,0.5); +unur_itdr_set_cp(par,-0.5); +unur_itdr_set_ct(par,-0.5); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [16] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [48] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[48]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[48],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[48]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[48],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[48]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[48],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +unur_itdr_set_xi(par,0.1); +unur_itdr_set_cp(par,-0.9); +unur_itdr_set_ct(par,-0.54); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +unur_itdr_set_xi(par,0.5); +unur_itdr_set_cp(par,-0.5); +unur_itdr_set_ct(par,-0.5); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [15] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [49] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[49]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[49],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[49]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[49],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[49]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[49],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [29] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [32] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [34] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[34],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[34],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[34],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [36] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[36],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[36],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[36],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [38] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[38],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [31] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [33] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[33],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[33],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[33],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [35] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[35],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[35],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[35],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [37] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[37],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[37],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[37],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [39] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[39]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[39],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [40] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[40],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[40],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[40],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [42] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[42],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[42],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[42],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [44] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[44]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[44],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[44]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[44],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[44]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[44],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [46] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[46]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[46],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[46]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[46],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[46]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[46],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [41] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[41],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[41],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[41],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [43] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[43],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[43],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[43],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [45] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[45]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[45],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[45]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[45],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[45]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[45],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [47] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[47]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[47],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[47]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[47],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[47]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[47],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [50] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[50]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[50],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[50]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[50],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[50]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[50],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [51] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[51]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[51],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[51]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[51],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[51]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[51],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [52] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[52]); +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[52],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[52]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[52],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[52]); +{ UNUR_DISTR *dg =NULL; +par = unur_itdr_new(distr_localcopy); + unur_itdr_set_pedantic(par,0); +fpm[0] = 0.5; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_itdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[52],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + unur_distr_free(distr[30]); + unur_distr_free(distr[31]); + unur_distr_free(distr[32]); + unur_distr_free(distr[33]); + unur_distr_free(distr[34]); + unur_distr_free(distr[35]); + unur_distr_free(distr[36]); + unur_distr_free(distr[37]); + unur_distr_free(distr[38]); + unur_distr_free(distr[39]); + unur_distr_free(distr[40]); + unur_distr_free(distr[41]); + unur_distr_free(distr[42]); + unur_distr_free(distr[43]); + unur_distr_free(distr[44]); + unur_distr_free(distr[45]); + unur_distr_free(distr[46]); + unur_distr_free(distr[47]); + unur_distr_free(distr[48]); + unur_distr_free(distr[49]); + unur_distr_free(distr[50]); + unur_distr_free(distr[51]); + unur_distr_free(distr[52]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_itdr_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_itdr.conf b/vendor/unuran-1.11.0/tests/t_itdr.conf new file mode 100644 index 0000000..c6ad182 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_itdr.conf @@ -0,0 +1,798 @@ +############################################################################# + +[main] + +[main - data:] + +# method +method: ITDR + +[main - header:] + +/* prototypes */ +/* pdf of gamma density (a=1/2) */ +double pdf_gamma12( double x, const UNUR_DISTR *distr ); +double dpdf_gamma12( double x, const UNUR_DISTR *distr ); + +int unur_itdr_set_pedantic( struct unur_par *par, int pedantic ); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* \#define SEED (298346) */ + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_cont_new(); ] + +/* pdf, mode (pole) */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +[new - data missing in distribution object: + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr, pdf_gamma12); ] + +/* mode (pole) */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_verify( par, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_xi(par,1.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_cp(par, -0.5); + --> expected_setfailed --> UNUR_ERR_NULL + +~_ct(par, -0.5); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameter object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); ] + +~_verify( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_xi(par,1.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_cp(par, -0.5); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_ct(par, -0.5); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + + +[set - invalid parameters: + double fpar[1] = {0.5}; + distr = unur_distr_gamma(fpar,1); + par = unur_itdr_new(distr); ] + +~_xi(par,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_cp(par, 0.5); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_cp(par, -1.0); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_ct(par, 0.5); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_ct(par, -1.0); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + + +############################################################################# + +[get] + +[get - invalid NULL ptr: + gen = NULL; ] + +~_xi(gen) + --> expected_INFINITY --> UNUR_ERR_NULL + +~_cp(gen) + --> expected_INFINITY --> UNUR_ERR_NULL + +~_ct(gen) + --> expected_INFINITY --> UNUR_ERR_NULL + +~_area(gen) + --> expected_INFINITY --> UNUR_ERR_NULL + + +[get - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init(par); <-- ! NULL ] + +~_xi(gen) + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + +~_cp(gen) + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + +~_ct(gen) + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + +~_area(gen) + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + +############################################################################# + +[chg] + +[chg - invalid NULL ptr: + gen = NULL; ] + +~_verify( gen, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + +[chg - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init(par); <-- ! NULL ] + +~_verify( gen, 1 ); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + + + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + +[init - data missing in distribution object: + distr = unur_distr_cont_new(); + par = NULL; ] + +/* dpdf, mode */ +unur_distr_cont_set_pdf(distr,pdf_gamma12); +par = unur_itdr_new( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +/* mode */ +unur_distr_cont_set_dpdf(distr,dpdf_gamma12); +par = unur_itdr_new( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +unur_distr_cont_set_mode(distr,0.); +par = unur_itdr_new( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_PROP + + +############################################################################# + +[reinit] + +[reinit - does not exist: + double fpm[] = { 0.8 }; + distr = unur_distr_gamma(fpm,1); + par = unur_itdr_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - compare: + double fpm[] = { 0.8, 1., 1. }; + distr = unur_distr_gamma(fpm,3); + par = NULL; ] + +/* default algorithm */ +par = unur_itdr_new(distr); + -->compare_sequence_par_start + +/* default algorithm - verifying mode */ +par = unur_itdr_new(distr); +unur_itdr_set_verify(par,1); + -->compare_sequence_par + +#..................................................................... + +[sample - compare: + double xi, cp, ct; + double fpm[] = { 0.8, 1., 1. }; + distr = unur_distr_gamma(fpm,3); + par = NULL; + gen = NULL; ] + +/* default algorithm */ +par = unur_itdr_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* set bx, ct and cp */ +xi = unur_itdr_get_xi(gen); +ct = unur_itdr_get_ct(gen); +cp = unur_itdr_get_cp(gen); +unur_free(gen); +par = unur_itdr_new(distr); +unur_itdr_set_xi(par,xi); +unur_itdr_set_cp(par,cp); +unur_itdr_set_ct(par,ct); +gen = unur_init(par); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare: + double xi, cp, ct; + double fpm[] = { 0.3, 1., 1. }; + distr = unur_distr_gamma(fpm,3); + par = NULL; + gen = NULL; ] + +/* default algorithm */ +par = unur_itdr_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* set bx, ct and cp */ +xi = unur_itdr_get_xi(gen); +ct = unur_itdr_get_ct(gen); +cp = unur_itdr_get_cp(gen); +unur_free(gen); +par = unur_itdr_new(distr); +unur_itdr_set_xi(par,xi); +unur_itdr_set_cp(par,cp); +unur_itdr_set_ct(par,ct); +gen = unur_init(par); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare: + double xi, cp, ct; + double fpm[] = { 3., 0.3, 1., 2. }; + distr = unur_distr_beta(fpm,4); + par = NULL; + gen = NULL; ] + +/* default algorithm */ +par = unur_itdr_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* set bx, ct and cp */ +xi = unur_itdr_get_xi(gen); +ct = unur_itdr_get_ct(gen); +cp = unur_itdr_get_cp(gen); +unur_free(gen); +par = unur_itdr_new(distr); +unur_itdr_set_xi(par,xi); +unur_itdr_set_cp(par,cp); +unur_itdr_set_ct(par,ct); +gen = unur_init(par); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + double fpm[] = { 0.3, 1., 1. }; + distr = unur_distr_gamma(fpm,3); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_itdr_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare reinit: + double fpm[] = { 0.8 }; + distr = unur_distr_gamma(fpm,1); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_itdr_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + double fpar[] = { 0.3, 1., 1. }; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_gamma(fpar,3); +par = unur_itdr_new(distr); +unur_itdr_set_xi(par,1.3); +unur_itdr_set_cp(par,-0.7); +unur_itdr_set_ct(par,-0.3); +unur_itdr_set_verify(par,TRUE); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(0.3,1.,1.) & \ + method = itdr; xi = 1.3; cp = -0.7; ct = -0.3; verify" ); + -->compare_sequence_gen + +############################################################################# + +[validate] + +[validate - generators:] + +# default program +par[0] = unur_itdr_new(@distr@); + +# set xi, cp, and ct for gamm(0.1) +par[1] = unur_itdr_new(@distr@); +unur_itdr_set_xi(par,0.1); +unur_itdr_set_cp(par,-0.9); +unur_itdr_set_ct(par,-0.54); + +# set xi, cp, and ct for gamm(0.5) +par[2] = unur_itdr_new(@distr@); +unur_itdr_set_xi(par,0.5); +unur_itdr_set_cp(par,-0.5); +unur_itdr_set_ct(par,-0.5); + +# default variant but reinitialized with changed domain +{ UNUR_DISTR *dg =NULL; +par[3] = unur_itdr_new(@distr@); +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.2,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + +# default variant but reinitialized with changed pdf parameters +{ UNUR_DISTR *dg =NULL; +par[4] = unur_itdr_new(@distr@); +fpm[0] = 0.5; +fpm[1] = 4.; +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + + +[validate - distributions:] + +# Gamma distributions +fpm[0] = 0.1; +distr[0] = unur_distr_gamma(fpm,1); + +fpm[0] = 0.1; +distr[1] = unur_distr_gamma_wo_logpdf(fpm,1); + +fpm[0] = 0.5; +distr[2] = unur_distr_gamma(fpm,1); + +fpm[0] = 0.5; +distr[3] = unur_distr_gamma_wo_logpdf(fpm,1); + +fpm[0] = 0.9; +distr[4] = unur_distr_gamma(fpm,1); + +fpm[0] = 0.9; +distr[5] = unur_distr_gamma_wo_logpdf(fpm,1); + +fpm[0] = 1.; +distr[6] = unur_distr_gamma(fpm,1); + +fpm[0] = 1.; +distr[7] = unur_distr_gamma_wo_logpdf(fpm,1); + +fpm[0] = 2.; +distr[8] = unur_distr_gamma(fpm,1); + +fpm[0] = 2.; +distr[9] = unur_distr_gamma_wo_logpdf(fpm,1); + +fpm[0] = 0.5; +fpm[1] = 2.; +fpm[2] = 1.; +distr[10] = unur_distr_gamma(fpm,3); + +fpm[0] = 0.5; +fpm[1] = 2.; +fpm[2] = 1.; +distr[11] = unur_distr_gamma_wo_logpdf(fpm,3); + +fpm[0] = 0.5; +fpm[1] = 2.; +fpm[2] = -1.; +distr[12] = unur_distr_gamma(fpm,3); + +fpm[0] = 0.5; +fpm[1] = 2.; +fpm[2] = -1.; +distr[13] = unur_distr_gamma_wo_logpdf(fpm,3); + +fpm[0] = 0.5; +fpm[1] = 1.; +fpm[2] = 1.; +distr[14] = unur_distr_gamma(fpm,3); +unur_distr_cont_set_domain(distr[14],1.,1.1); + +fpm[0] = 0.5; +fpm[1] = 1.; +fpm[2] = 1.; +distr[15] = unur_distr_gamma_wo_logpdf(fpm,3); +unur_distr_cont_set_domain(distr[15],1.,1.1); + +fpm[0] = 0.5; +fpm[1] = 1.; +fpm[2] = 1.; +distr[16] = unur_distr_gamma(fpm,3); +unur_distr_cont_set_domain(distr[16],1.,2.); + +fpm[0] = 0.5; +fpm[1] = 1.; +fpm[2] = 1.; +distr[17] = unur_distr_gamma_wo_logpdf(fpm,3); +unur_distr_cont_set_domain(distr[17],1.,2.); + +fpm[0] = 0.5; +fpm[1] = 1.; +fpm[2] = 1.; +distr[18] = unur_distr_gamma(fpm,3); +unur_distr_cont_set_domain(distr[18],1.,4.); + +fpm[0] = 0.5; +fpm[1] = 1.; +fpm[2] = 1.; +distr[19] = unur_distr_gamma_wo_logpdf(fpm,3); +unur_distr_cont_set_domain(distr[19],1.,4.); + +fpm[0] = 1.5; +distr[48] = unur_distr_gamma(fpm,1); +unur_distr_cont_set_domain(distr[48],1.,UNUR_INFINITY); + +fpm[0] = 1.5; +distr[49] = unur_distr_gamma_wo_logpdf(fpm,1); +unur_distr_cont_set_domain(distr[49],1.,UNUR_INFINITY); + +# Normal distributions +distr[20] = unur_distr_normal(NULL,0); + +distr[21] = unur_distr_normal_wo_logpdf(NULL,0); + +distr[22] = unur_distr_normal(NULL,0); +unur_distr_cont_set_domain(distr[22],0.,UNUR_INFINITY); + +distr[23] = unur_distr_normal_wo_logpdf(NULL,0); +unur_distr_cont_set_domain(distr[23],0.,UNUR_INFINITY); + +distr[24] = unur_distr_normal(NULL,0); +unur_distr_cont_set_domain(distr[24],0.,4.); + +distr[25] = unur_distr_normal_wo_logpdf(NULL,0); +unur_distr_cont_set_domain(distr[25],0.,4.); + +distr[26] = unur_distr_normal(NULL,0); +unur_distr_cont_set_domain(distr[26],1.,4.); + +distr[27] = unur_distr_normal_wo_logpdf(NULL,0); +unur_distr_cont_set_domain(distr[27],1.,4.); + +distr[28] = unur_distr_normal(NULL,0); +unur_distr_cont_set_domain(distr[28],-0.5,4.); +unur_distr_cont_set_mode(distr[28],-0.5); + +distr[29] = unur_distr_normal_wo_logpdf(NULL,0); +unur_distr_cont_set_domain(distr[29],-0.5,4.); +unur_distr_cont_set_mode(distr[29],-0.5); + +# Cauchy distributions +distr[30] = unur_distr_cauchy(NULL,0); + +distr[31] = unur_distr_cauchy_wo_logpdf(NULL,0); + +distr[32] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[32],0.,UNUR_INFINITY); + +distr[33] = unur_distr_cauchy_wo_logpdf(NULL,0); +unur_distr_cont_set_domain(distr[33],0.,UNUR_INFINITY); + +distr[34] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[34],0.,4.); + +distr[35] = unur_distr_cauchy_wo_logpdf(NULL,0); +unur_distr_cont_set_domain(distr[35],0.,4.); + +distr[36] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[36],1.,4.); + +distr[37] = unur_distr_cauchy_wo_logpdf(NULL,0); +unur_distr_cont_set_domain(distr[37],1.,4.); + +distr[38] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[38],-0.5,4.); +unur_distr_cont_set_mode(distr[38],-0.5); + +distr[39] = unur_distr_cauchy_wo_logpdf(NULL,0); +unur_distr_cont_set_domain(distr[39],-0.5,4.); +unur_distr_cont_set_mode(distr[39],-0.5); + +# Beta distributions +fpm[0] = 0.5; +fpm[1] = 3.; +distr[40] = unur_distr_beta(fpm,2); + +fpm[0] = 0.5; +fpm[1] = 3.; +distr[41] = unur_distr_beta_wo_logpdf(fpm,2); + +fpm[0] = 0.5; +fpm[1] = 3.; +fpm[2] = 1.; +fpm[3] = 2.; +distr[42] = unur_distr_beta(fpm,4); + +fpm[0] = 0.5; +fpm[1] = 3.; +fpm[2] = 1.; +fpm[3] = 2.; +distr[43] = unur_distr_beta_wo_logpdf(fpm,4); + +fpm[0] = 3.; +fpm[1] = 0.5; +fpm[2] = -1.; +fpm[3] = 0.; +distr[44] = unur_distr_beta(fpm,4); + +fpm[0] = 3.; +fpm[1] = 0.5; +fpm[2] = -1.; +fpm[3] = 0.; +distr[45] = unur_distr_beta_wo_logpdf(fpm,4); + +fpm[0] = 3.; +fpm[1] = 0.5; +distr[46] = unur_distr_beta(fpm,2); + +fpm[0] = 3.; +fpm[1] = 0.5; +distr[47] = unur_distr_beta_wo_logpdf(fpm,2); + +# F distributions +fpm[0] = 1.; +fpm[1] = 5.; +distr[50] = unur_distr_F(fpm,2); + +fpm[0] = 1.99; +fpm[1] = 5.; +distr[51] = unur_distr_F(fpm,2); + +fpm[0] = 0.1; +fpm[1] = 5.; +distr[52] = unur_distr_F(fpm,2); + +# number of distributions: 53 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default +# [1] ... set xi, cp, and ct for gamm(0.1) +# [2] ... set xi, cp, and ct for gamm(0.5) +# [3] ... default variant but reinitialized with changed domain (0.2,0.99) +# [4] ... default variant but reinitialized with changed pdf parameters (0.5, 4.) +# +#gen 0 1 2 3 4 # distribution +#--------------------------------------------- + <0> + + . + + # gamma(0.1) + <2> + . + + + # gamma(0.5) + <4> + . . + + # gamma(0.9) + <6> + . . + + # gamma(1.) + <8> 0 . . . . # gamma(2.) + <10> + . . - + # gamma(0.5,2.,1.) + <12> + . . + + # gamma(0.5,2.,-1.) + <14> + . . - + # gamma(0.5,1.,1.), domain=(1.,1.1) + <16> + . . - + # gamma(0.5,1.,1.), domain=(1.,2.) + <18> + . . - + # gamma(0.5,1.,1.), domain=(1.,4.) + <48> + . . - + # gamma(1.5), domain=(1.,inf) + <1> + + . + + # gamma(0.1), w/o logpdf + <3> + . + + + # gamma(0.5), w/o logpdf + <5> + . . + + # gamma(0.9), w/o logpdf + <7> + . . + + # gamma(1.), w/o logpdf + <9> 0 . . . . # gamma(2.), w/o logpdf + <11> + . . - + # gamma(0.5,2.,1.), w/o logpdf + <13> + . . + + # gamma(0.5,2.,-1.), w/o logpdf + <15> + . . - + # gamma(0.5,1.,1.), domain=(1.,1.1), w/o logpdf + <17> + . . - + # gamma(0.5,1.,1.), domain=(1.,2.), w/o logpdf + <19> + . . - + # gamma(0.5,1.,1.), domain=(1.,4.), w/o logpdf + <49> + . . - + # gamma(1.5), domain=(1.,inf), w/o logpdf + <20> 0 . . . . # normal() + <22> + . . + - # normal(), domain=(0.,inf) + <24> + . . + - # normal(), domain=(0.,4.) + <26> + . . + + # normal(), domain=(1.,4.) + <28> 0 . . . . # normal(), domain=(-0.5,4.) + <21> 0 . . . . # normal(), w/o logpdf + <23> + . . + - # normal(), domain=(0.,inf), w/o logpdf + <25> + . . + - # normal(), domain=(0.,4.), w/o logpdf + <27> + . . + + # normal(), domain=(1.,4.), w/o logpdf + <29> 0 . . . . # normal(), domain=(-0.5,4.), w/o logpdf + <30> 0 . . . . # cauchy() + <32> + . . + - # cauchy(), domain=(0.,inf) + <34> + . . + - # cauchy(), domain=(0.,4.) + <36> + . . + + # cauchy(), domain=(1.,4.) + <38> 0 . . . . # cauchy(), domain=(-0.5,4.) + <31> 0 . . . . # cauchy(), w/o logpdf + <33> + . . + - # cauchy(), domain=(0.,inf), w/o logpdf + <35> + . . + - # cauchy(), domain=(0.,4.), w/o logpdf + <37> + . . + + # cauchy(), domain=(1.,4.), w/o logpdf + <39> 0 . . . . # cauchy(), domain=(-0.5,4.), w/o logpdf + <40> + . . + + # beta(0.5,3.) + <42> + . . - + # beta(0.5,3.; 1.,2.) + <44> + . . - + # beta(3.,0.5; -1.,0.) + <46> + . . + + # beta(3.,0.5) + <41> + . . + + # beta(0.5,3.), w/o logpdf + <43> + . . - + # beta(0.5,3.; 1.,2.), w/o logpdf + <45> + . . - + # beta(3.,0.5; -1.,0.), w/o logpdf + <47> + . . + + # beta(3.,0.5), w/o logpdf + <50> + . . + + # F (1,5) + <51> + . . + + # F (1.99,5) + <52> + . . + + # F (0.1,5) + + +[validate - verify hat:] + +# + ... pass test +# ~ ... fail in at most 1% of samples +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default +# [1] ... set xi, cp, and ct for gamm(0.1) +# [2] ... set xi, cp, and ct for gamm(0.5) +# [3] ... default variant but reinitialized with changed domain (0.2,0.99) +# [4] ... default variant but reinitialized with changed pdf parameters (0.5, 4.) +# +#gen 0 1 2 3 4 # distribution +#--------------------------------------------- + <0> + + . + + # gamma(0.1) + <2> + . + + + # gamma(0.5) + <4> + . . + + # gamma(0.9) + <6> + . . + + # gamma(1.) + <8> 0 . . . . # gamma(2.) + <10> + . . - + # gamma(0.5,2.,1.) + <12> + . . + + # gamma(0.5,2.,-1.) + <14> + . . - + # gamma(0.5,1.,1.), domain=(1.,1.1) + <16> + . . - + # gamma(0.5,1.,1.), domain=(1.,2.) + <18> + . . - + # gamma(0.5,1.,1.), domain=(1.,4.) + <48> + . . - + # gamma(1.5), domain=(1.,inf) + <1> + + . + + # gamma(0.1), w/o logpdf + <3> + . + + + # gamma(0.5), w/o logpdf + <5> + . . + + # gamma(0.9), w/o logpdf + <7> + . . + + # gamma(1.), w/o logpdf + <9> 0 . . . . # gamma(2.), w/o logpdf + <11> + . . - + # gamma(0.5,2.,1.), w/o logpdf + <13> + . . + + # gamma(0.5,2.,-1.), w/o logpdf + <15> + . . - + # gamma(0.5,1.,1.), domain=(1.,1.1), w/o logpdf + <17> + . . - + # gamma(0.5,1.,1.), domain=(1.,2.), w/o logpdf + <19> + . . - + # gamma(0.5,1.,1.), domain=(1.,4.), w/o logpdf + <49> + . . - + # gamma(1.5), domain=(1.,inf), w/o logpdf + <20> 0 . . . . # normal() + <22> + . . + - # normal(), domain=(0.,inf) + <24> + . . + - # normal(), domain=(0.,4.) + <26> + . . + + # normal(), domain=(1.,4.) + <28> 0 . . . . # normal(), domain=(-0.5,4.) + <21> 0 . . . . # normal(), w/o logpdf + <23> + . . + - # normal(), domain=(0.,inf), w/o logpdf + <25> + . . + - # normal(), domain=(0.,4.), w/o logpdf + <27> + . . + + # normal(), domain=(1.,4.), w/o logpdf + <29> 0 . . . . # normal(), domain=(-0.5,4.), w/o logpdf + <30> 0 . . . . # cauchy() + <32> + . . + - # cauchy(), domain=(0.,inf) + <34> + . . + - # cauchy(), domain=(0.,4.) + <36> + . . + + # cauchy(), domain=(1.,4.) + <38> 0 . . . . # cauchy(), domain=(-0.5,4.) + <31> 0 . . . . # cauchy(), w/o logpdf + <33> + . . + - # cauchy(), domain=(0.,inf), w/o logpdf + <35> + . . + - # cauchy(), domain=(0.,4.), w/o logpdf + <37> + . . + + # cauchy(), domain=(1.,4.), w/o logpdf + <39> 0 . . . . # cauchy(), domain=(-0.5,4.), w/o logpdf + <40> + . . + + # beta(0.5,3.) + <42> + . . - + # beta(0.5,3.; 1.,2.) + <44> + . . - + # beta(3.,0.5; -1.,0.) + <46> + . . + + # beta(3.,0.5) + <41> + . . + + # beta(0.5,3.), w/o logpdf + <43> + . . - + # beta(0.5,3.; 1.,2.), w/o logpdf + <45> + . . - + # beta(3.,0.5; -1.,0.), w/o logpdf + <47> + . . + + # beta(3.,0.5), w/o logpdf + <50> + . . + + # F (1,5) + <51> + . . + + # F (1.99,5) + <52> + . . + + # F (0.1,5) + + +############################################################################# +############################################################################# + +[verbatim] + +/* pdf of gamma density (a=1/2) */ +double pdf_gamma12( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return exp(-x)/sqrt(x); +} + +double dpdf_gamma12( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return -exp(-x)/sqrt(x) * (1.+1./(2.*x)); +} + + +/* dummy function */ +int unur_itdr_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_mcorr.c b/vendor/unuran-1.11.0/tests/t_mcorr.c new file mode 100644 index 0000000..08105f3 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_mcorr.c @@ -0,0 +1,668 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for MCORR + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_mcorr_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + +#include +#include + +int mcorr_eigenvalues_test(int dim); + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +int +mcorr_eigenvalues_test(int dim) +/* returns 0 if everything is OK, 1 otherwise */ +{ + UNUR_DISTR *corr_distr; + UNUR_PAR *corr_par; + UNUR_GEN *corr_gen; + + int i; + int err = 0; + + double *mean; + double *corr; + double *eigenvalues, *eigenvalues_set; + double *eigenvectors; + + mean = _unur_vector_new(dim); + corr = _unur_vector_new(dim*dim); + eigenvalues_set = _unur_vector_new(dim); + eigenvalues = _unur_vector_new(dim); + eigenvectors = _unur_vector_new(dim*dim); + + /* setting eigenvalues to const*{1,2,...,dim} with sum=dim */ + for (i=0; itime = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + double *eigenvalues = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,48,(unur_mcorr_set_eigenvalues( par, eigenvalues )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,48,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double *eigenvalues = NULL; + distr = unur_distr_correlation(4); + par = unur_mcorr_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,57,(unur_mcorr_set_eigenvalues( par, eigenvalues )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,57,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double eigenvalues[] = {1,2,3}; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_mcorr_set_eigenvalues( par, eigenvalues )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double eigenvalues[] = {1,-2,3}; + distr = unur_distr_correlation(4); + par = unur_mcorr_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_mcorr_set_eigenvalues( par, eigenvalues )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,100,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,100,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* exists */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_correlation(3); + par = unur_mcorr_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 109, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,113,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + distr = unur_distr_correlation(4); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_mcorr_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,128,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,134,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone */ +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; +UNUR_DISTR *distr = NULL; + UNUR_GEN *clone; + double eigenvalues[] = {1.,2.,3.,4.}; + par = NULL; + gen = NULL; + distr = unur_distr_correlation(4); + + +unur_reset_errno(); +/* original generator object */ +par = unur_mcorr_new(distr); +unur_mcorr_set_eigenvalues( par, eigenvalues ); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,149,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,155,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_free(gen); +unur_distr_free(distr); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_correlation(4); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_mcorr_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,167,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,171,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double eigenvalues[] = {1.,2.,3.,4.}; + distr = unur_distr_correlation(4); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_mcorr_new(distr); +unur_mcorr_set_eigenvalues( par, eigenvalues ); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,185,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,189,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [special] */ + +void test_special (void) +{ + /* set boolean to FALSE */ + int FAILED = 0; + + + + + int errorsum = 0; + int dim; + +/* start test */ +printf("[special "); fflush(stdout); +fprintf(TESTLOG,"\n[special]\n"); + +/* set stop watch */ +stopwatch_lap(&watch); + + + + /* test for eigenvalues */ + printf("\ntest eigenvalues"); + fprintf(TESTLOG,"\nTest eigenvalues:\n"); + + for (dim=2; dim<10; dim++) { + if (mcorr_eigenvalues_test(dim)) errorsum++; + } + + /* test finished */ + FAILED = (errorsum==0) ? 0: 1; + + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (FAILED) ? 0 : 1; + (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_special() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_mcorr_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_mcorr.conf b/vendor/unuran-1.11.0/tests/t_mcorr.conf new file mode 100644 index 0000000..0873b32 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_mcorr.conf @@ -0,0 +1,286 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: MCORR + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +\#include +\#include + +int mcorr_eigenvalues_test(int dim); + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + + +############################################################################# + +[set] + +[set - invalid NULL ptr: + double *eigenvalues = NULL; + par = NULL; ] + +~_eigenvalues( par, eigenvalues ) + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid NULL ptr: + double *eigenvalues = NULL; + distr = unur_distr_correlation(4); + par = unur_mcorr_new(distr); ] + +~_eigenvalues( par, eigenvalues ) + --> expected_setfailed --> UNUR_ERR_NULL + +unur_par_free(par); + + +[set - invalid parameter object: + double eigenvalues[] = {1,2,3}; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); ] + +~_eigenvalues( par, eigenvalues ) + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + + +[set - invalid parameters: + double eigenvalues[] = {1,-2,3}; + distr = unur_distr_correlation(4); + par = unur_mcorr_new(distr); ] + +~_eigenvalues( par, eigenvalues ) + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + + +############################################################################# + +[reinit] + +[reinit - exists: + distr = unur_distr_correlation(3); + par = unur_mcorr_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - compare clone: + UNUR_GEN *clone; + distr = unur_distr_correlation(4); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_mcorr_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + double eigenvalues[] = {1.,2.,3.,4.}; + par = NULL; + gen = NULL; + distr = unur_distr_correlation(4); ] + +/* original generator object */ +par = unur_mcorr_new(distr); +unur_mcorr_set_eigenvalues( par, eigenvalues ); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare reinit: + distr = unur_distr_correlation(4); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_mcorr_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare reinit: + double eigenvalues[] = {1.,2.,3.,4.}; + distr = unur_distr_correlation(4); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_mcorr_new(distr); +unur_mcorr_set_eigenvalues( par, eigenvalues ); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + + +############################################################################# + +# [validate] + +############################################################################# + +[special] + +[special - decl:] + int errorsum = 0; + int dim; + +[special - start:] + + /* test for eigenvalues */ + printf("\ntest eigenvalues"); + fprintf(TESTLOG,"\nTest eigenvalues:\n"); + + for (dim=2; dim<10; dim++) { + if (mcorr_eigenvalues_test(dim)) errorsum++; + } + + /* test finished */ + FAILED = (errorsum==0) ? 0: 1; + +############################################################################# + +[verbatim] + +int +mcorr_eigenvalues_test(int dim) +/* returns 0 if everything is OK, 1 otherwise */ +{ + UNUR_DISTR *corr_distr; + UNUR_PAR *corr_par; + UNUR_GEN *corr_gen; + + int i; + int err = 0; + + double *mean; + double *corr; + double *eigenvalues, *eigenvalues_set; + double *eigenvectors; + + mean = _unur_vector_new(dim); + corr = _unur_vector_new(dim*dim); + eigenvalues_set = _unur_vector_new(dim); + eigenvalues = _unur_vector_new(dim); + eigenvectors = _unur_vector_new(dim*dim); + + /* setting eigenvalues to const*{1,2,...,dim} with sum=dim */ + for (i=0; i +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_mixt_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +double cdf_cont_1 ( double x, const UNUR_DISTR *distr ); +double cdf_cont_inv ( double x, const UNUR_DISTR *distr ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + +/* #define SEED (1656256) */ + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +static UNUR_DISTR *d0 = NULL; +static UNUR_DISTR *d1 = NULL; +static UNUR_DISTR *d2 = NULL; +void remove_cont_1(void) { + unur_distr_free(d0); + unur_distr_free(d1); + unur_distr_free(d2); +} + +double cdf_cont_1 ( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED ) +{ + double p[3] = {1./6., 2./6., 3./6.}; + double y; + + if (d0 == NULL) { + double fpar[2] = {-2,-1}; + d0 = unur_distr_exponential(NULL,0); + d1 = unur_distr_normal(NULL,0); + d2 = unur_distr_uniform(fpar,2); + atexit(remove_cont_1); + } + + y = ( p[0] * unur_distr_cont_eval_cdf(x,d0) + + p[1] * unur_distr_cont_eval_cdf(x,d1) + + p[2] * unur_distr_cont_eval_cdf(x,d2) ); + + return y; +} + +static UNUR_DISTR *di = NULL; +void remove_cont_inv(void) { unur_distr_free(di); } + +double cdf_cont_inv ( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED ) +{ + double p[3] = {1./6., 2./6., 3./6.}; + double y; + + if (di == NULL) { + di = unur_distr_normal(NULL,0); + atexit(remove_cont_inv); + } + + if (x < -1.) { + y = p[0] * unur_distr_cont_eval_cdf(x,di) / 0.1586553; + } + else if (x < 1.) { + y = p[0] + p[1] * (unur_distr_cont_eval_cdf(x,di) - 0.1586553) / (0.8413447 - 0.1586553); + } + else { + y = p[0] + p[1] + p[2] * (unur_distr_cont_eval_cdf(x,di) - 0.8413447) / (1 - 0.8413447); + } + + return y; +} + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ + double prob[2] = {1,2}; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,30,(unur_mixt_new( 0, NULL, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,30,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,33,(unur_mixt_new( 2, prob, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,33,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid arguments */ + double prob[2] = {1,2}; + UNUR_GEN *comp[2]; + +comp[0] = unur_str2gen("normal"); +comp[1] = unur_str2gen("normal"); + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,44,(unur_mixt_new( -1, prob, comp )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,44,UNUR_ERR_DISTR_DOMAIN)==UNUR_SUCCESS)?0:1; +unur_free(comp[0]); +unur_free(comp[1]); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,58,(unur_mixt_set_useinversion(par,0.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,58,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,65,(unur_mixt_set_useinversion(par,0.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL in list of components */ +UNUR_PAR *par = NULL; + double prob[2] = {1,2}; + UNUR_GEN *comp[2] = {NULL, NULL}; + par = unur_mixt_new(2,prob,comp); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,87,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,87,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid distribution type */ + double prob[2] = {1,2}; + UNUR_DISTR *distr; + UNUR_PAR *par; + UNUR_GEN *comp[2]; + +distr = unur_distr_multinormal(2,NULL,NULL); +comp[0] = unur_init(unur_hitro_new(distr)); +comp[1] = unur_str2gen("normal"); + +unur_reset_errno(); +par = unur_mixt_new( 2, prob, comp ); +n_tests_failed += (check_expected_NULL(TESTLOG,101,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(comp[0]); +unur_free(comp[1]); +} + +{ /* invalid probabilities */ + double prob[2] = {1,-2}; + UNUR_PAR *par; + UNUR_GEN *comp[2]; + +comp[0] = unur_str2gen("normal"); +comp[1] = unur_str2gen("normal"); + +unur_reset_errno(); +par = unur_mixt_new( 2, prob, comp ); +n_tests_failed += (check_expected_NULL(TESTLOG,118,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,118,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; +unur_free(comp[0]); +unur_free(comp[1]); +} + +{ /* no inversion method */ + double prob[2] = {1,2}; + UNUR_PAR *par; + UNUR_GEN *comp[2]; + +comp[0] = unur_str2gen("normal&method=ssr"); +comp[1] = unur_str2gen("normal&method=ssr"); + +unur_reset_errno(); +par = unur_mixt_new( 2, prob, comp ); +unur_mixt_set_useinversion(par,TRUE); +n_tests_failed += (check_expected_NULL(TESTLOG,135,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,135,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_free(comp[0]); +unur_free(comp[1]); +} + +{ /* overlapping domains cont+cont */ + double prob[2] = {1,2}; + UNUR_PAR *par; + UNUR_GEN *comp[2]; + +comp[0] = unur_str2gen("normal;domain=(-2,1)&method=pinv"); +comp[1] = unur_str2gen("normal;domain=(-1,2)&method=pinv"); + +unur_reset_errno(); +par = unur_mixt_new( 2, prob, comp ); +unur_mixt_set_useinversion(par,TRUE); +n_tests_failed += (check_expected_NULL(TESTLOG,152,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,152,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_free(comp[0]); +unur_free(comp[1]); +} + +{ /* overlapping domains cont+discr */ + double prob[2] = {1,2}; + UNUR_PAR *par; + UNUR_GEN *comp[2]; + +comp[0] = unur_str2gen("normal;domain=(-2,3)&method=pinv"); +comp[1] = unur_str2gen("binomial(100,0.2)&method=dgt"); + +unur_reset_errno(); +par = unur_mixt_new( 2, prob, comp ); +unur_mixt_set_useinversion(par,TRUE); +n_tests_failed += (check_expected_NULL(TESTLOG,169,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,169,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_free(comp[0]); +unur_free(comp[1]); +} + +{ /* overlapping domains discr+discr */ + double prob[2] = {1,2}; + UNUR_PAR *par; + UNUR_GEN *comp[2]; + +comp[0] = unur_str2gen("geometric(0.1)&method=dgt"); +comp[1] = unur_str2gen("binomial(100,0.2)&method=dgt"); + +unur_reset_errno(); +par = unur_mixt_new( 2, prob, comp ); +unur_mixt_set_useinversion(par,TRUE); +n_tests_failed += (check_expected_NULL(TESTLOG,186,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,186,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_free(comp[0]); +unur_free(comp[1]); +} + +{ /* unsorted domains */ + double prob[2] = {1,2}; + UNUR_PAR *par; + UNUR_GEN *comp[2]; + +comp[0] = unur_str2gen("normal;domain=(1,2)&method=pinv"); +comp[1] = unur_str2gen("normal;domain=(-2,-1)&method=pinv"); + +unur_reset_errno(); +par = unur_mixt_new( 2, prob, comp ); +unur_mixt_set_useinversion(par,TRUE); +n_tests_failed += (check_expected_NULL(TESTLOG,203,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,203,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_free(comp[0]); +unur_free(comp[1]); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare clone cont+cont */ +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double prob[2] = {1,2}; + UNUR_GEN *comp[2]; + par = NULL; + gen = NULL; + +comp[0] = unur_str2gen("normal"); +comp[1] = unur_str2gen("exponential"); + +unur_reset_errno(); +/* original generator object */ +par = unur_mixt_new( 2, prob, comp ); +gen = unur_init( par ); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,230,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,236,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_free(comp[0]); +unur_free(comp[1]); +unur_free(gen); +} + +{ /* compare clone cont+discr */ +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double prob[2] = {1,2}; + UNUR_GEN *comp[2]; + par = NULL; + gen = NULL; + +comp[0] = unur_str2gen("normal&method=tdr"); +comp[1] = unur_str2gen("binomial(100,0.2)&method=dgt"); + +unur_reset_errno(); +/* original generator object */ +par = unur_mixt_new( 2, prob, comp ); +gen = unur_init( par ); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,256,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,262,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_free(comp[0]); +unur_free(comp[1]); +unur_free(gen); +} + +{ /* compare clone discr+discr */ +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double prob[2] = {1,2}; + UNUR_GEN *comp[2]; + par = NULL; + gen = NULL; + +comp[0] = unur_str2gen("geometric(0.1)&method=dgt"); +comp[1] = unur_str2gen("binomial(100,0.2)&method=dgt"); + +unur_reset_errno(); +/* original generator object */ +par = unur_mixt_new( 2, prob, comp ); +gen = unur_init( par ); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,282,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,288,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_free(comp[0]); +unur_free(comp[1]); +unur_free(gen); +} + +{ /* compare clone cont+discr */ +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double prob[2] = {1,2}; + UNUR_GEN *comp[2]; + par = NULL; + gen = NULL; + +comp[0] = unur_str2gen("normal"); +comp[1] = unur_str2gen("binomial(100,0.2)&method=dgt"); + +unur_reset_errno(); +/* original generator object */ +par = unur_mixt_new( 2, prob, comp ); +gen = unur_init( par ); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,308,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,314,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_free(comp[0]); +unur_free(comp[1]); +unur_free(gen); +} + +{ /* compare clone empirical+discr */ +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double prob[2] = {1,2}; + UNUR_GEN *comp[2]; + par = NULL; + gen = NULL; + +comp[0] = unur_str2gen("distr = cemp; \ + data=(-0.10, 0.05,-0.50, 0.08, 0.13, \ + -0.21,-0.44,-0.43,-0.33,-0.30, \ + 0.18, 0.20,-0.37,-0.29,-0.90) \ + & method=empk; smoothing=0.8"); +comp[1] = unur_str2gen("binomial(100,0.2)&method=dgt"); + +unur_reset_errno(); +/* original generator object */ +par = unur_mixt_new( 2, prob, comp ); +gen = unur_init( par ); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,338,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,344,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_free(comp[0]); +unur_free(comp[1]); +unur_free(gen); +} + +{ /* compare clone mixt+cont */ +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double prob[2] = {1,2}; + UNUR_GEN *comp[2]; + par = NULL; + gen = NULL; + +comp[0] = unur_str2gen("normal&method=tdr"); +comp[1] = unur_str2gen("exponential&method=arou"); +par = unur_mixt_new( 2, prob, comp ); +gen = unur_init( par ); +unur_free(comp[0]); +unur_free(comp[1]); +comp[0] = gen; +comp[1] = unur_str2gen("cauchy&method=srou"); + +unur_reset_errno(); +/* original generator object */ +par = unur_mixt_new( 2, prob, comp ); +gen = unur_init( par ); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,371,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,377,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_free(comp[0]); +unur_free(comp[1]); +unur_free(gen); +} + +{ /* compare clone mixt+cont+inversion */ +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + double prob[2] = {1,2}; + UNUR_GEN *comp[2]; + par = NULL; + gen = NULL; + +comp[0] = unur_str2gen("normal;domain=(-inf,-1)&method=pinv"); +comp[1] = unur_str2gen("normal;domain=(-1,1)&method=pinv"); +par = unur_mixt_new( 2, prob, comp ); +unur_mixt_set_useinversion(par,TRUE); +gen = unur_init( par ); +unur_free(comp[0]); +unur_free(comp[1]); +comp[0] = gen; +comp[1] = unur_str2gen("normal;domain=(1,inf)&method=pinv"); + +unur_reset_errno(); +/* original generator object */ +par = unur_mixt_new( 2, prob, comp ); +unur_mixt_set_useinversion(par,TRUE); +gen = unur_init( par ); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,406,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,412,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_free(comp[0]); +unur_free(comp[1]); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [special] */ + +void test_special (void) +{ + /* set boolean to FALSE */ + int FAILED = 0; + + + + + +int rcode = 0; +int errorsum = 0; + +UNUR_DISTR *dtmp; +UNUR_PAR *par; +UNUR_GEN *gen; +UNUR_GEN *comp[3]; +double prob[3] = {1.,2.,3.}; + +/* start test */ +printf("[special "); fflush(stdout); +fprintf(TESTLOG,"\n[special]\n"); + +/* set stop watch */ +stopwatch_lap(&watch); + + + +/* very ugly hack */ + +comp[0] = unur_str2gen("exponential&method=pinv"); +comp[1] = unur_str2gen("normal&method=pinv"); +comp[2] = unur_str2gen("uniform(-2,-1)&method=pinv"); + +unur_reset_errno(); +par = unur_mixt_new( 3, prob, comp ); +gen = unur_init(par); +dtmp = unur_get_distr(gen); +unur_distr_set_name(dtmp,"cont"); +unur_distr_cont_set_cdf(dtmp,cdf_cont_1); +rcode = run_validate_chi2(TESTLOG,0,gen,dtmp,'+'); +errorsum += (rcode==UNUR_SUCCESS)?0:1; +unur_free(gen); + +unur_free(comp[0]); +unur_free(comp[1]); +unur_free(comp[2]); + +/* ---------------------------------- */ + +comp[0] = unur_str2gen("normal;domain=(-inf,-1)&method=pinv"); +comp[1] = unur_str2gen("normal;domain=(-1,1)&method=pinv"); +comp[2] = unur_str2gen("normal;domain=(1,inf)&method=pinv"); + +unur_reset_errno(); +par = unur_mixt_new( 3, prob, comp ); +gen = unur_init(par); +dtmp = unur_get_distr(gen); +unur_distr_set_name(dtmp,"cont"); +unur_distr_cont_set_cdf(dtmp,cdf_cont_inv); +rcode = run_validate_chi2(TESTLOG,0,gen,dtmp,'+'); +errorsum += (rcode==UNUR_SUCCESS)?0:1; +unur_free(gen); + +unur_free(comp[0]); +unur_free(comp[1]); +unur_free(comp[2]); + +comp[0] = unur_str2gen("normal;domain=(-inf,-1)&method=pinv"); +comp[1] = unur_str2gen("normal;domain=(-1,1)&method=pinv"); +comp[2] = unur_str2gen("normal;domain=(1,inf)&method=pinv"); + +unur_reset_errno(); +par = unur_mixt_new( 3, prob, comp ); +unur_mixt_set_useinversion(par,TRUE); +gen = unur_init(par); +dtmp = unur_get_distr(gen); +unur_distr_set_name(dtmp,"cont_inv"); +unur_distr_cont_set_cdf(dtmp,cdf_cont_inv); +rcode = run_validate_chi2(TESTLOG,0,gen,dtmp,'+'); +errorsum += (rcode==UNUR_SUCCESS)?0:1; +unur_free(gen); + +unur_free(comp[0]); +unur_free(comp[1]); +unur_free(comp[2]); + +/* ---------------------------------- */ + +/* test finished */ +FAILED = (errorsum < 1) ? 0 : 1; + + + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (FAILED) ? 0 : 1; + (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_special() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_mixt_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_mvstd.c b/vendor/unuran-1.11.0/tests/t_mvstd.c new file mode 100644 index 0000000..8d458d5 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_mvstd.c @@ -0,0 +1,1157 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for MVSTD + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_mvstd_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + +/* #define SEED (298346) */ + +/* we need marginal distributions for the chi2 tests */ +#define unur_distr_multinormal unur_distr_multinormal_w_marginals + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,30,(unur_mvstd_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,30,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,36,(unur_mvstd_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,36,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* not a standard distribution */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cvec_new(3); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,42,(unur_mvstd_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* exists */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_multinormal(3,NULL,NULL); + par = unur_mvstd_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 66, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,70,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + UNUR_GEN *clone; + distr = unur_distr_multinormal( dim, mean, covar ); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* normal distribution */ +par = unur_mvstd_new(distr); +gen = unur_init( par ); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,88,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,94,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[19]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 19 */ +{ +distr[0] = unur_distr_multinormal(3,NULL,NULL); +} + +{ +double mean[] = { -1., 2., -3. }; +double covar[] = { 1., 0.8, 0.64, 0.8, 1., 0.8, 0.64, 0.8, 1. }; +distr[1] = unur_distr_multinormal(3,mean,covar); +} + +{ +#define dim (2) +int i; +double mean[dim], covar[dim*dim]; +UNUR_DISTR *covar_distr; +UNUR_GEN *covar_gen; +UNUR_GEN *mean_gen; +covar_distr = unur_distr_correlation(dim); +covar_gen = unur_init(unur_mcorr_new(covar_distr)); +mean_gen = unur_str2gen("normal(5,1)"); +for (i=0; isetup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 38 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 1., 0.8, 0.64, 0.8, 1., 0.8, 0.64, 0.8, 1. }; +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 1., 0.8, 0.64, 0.8, 1., 0.8, 0.64, 0.8, 1. }; +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 1., 0.8, 0.64, 0.8, 1., 0.8, 0.64, 0.8, 1. }; +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [18] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_mvstd_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_mvstd_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_mvstd.conf b/vendor/unuran-1.11.0/tests/t_mvstd.conf new file mode 100644 index 0000000..a882136 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_mvstd.conf @@ -0,0 +1,420 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: MVSTD + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* \#define SEED (298346) */ + +/* we need marginal distributions for the chi2 tests */ +\#define unur_distr_multinormal unur_distr_multinormal_w_marginals + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_cont_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - not a standard distribution: + distr = unur_distr_cvec_new(3); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +############################################################################# + +# [set] + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################# + +# [init] + +############################################################################# + +[reinit] + +[reinit - exists: + distr = unur_distr_multinormal(3,NULL,NULL); + par = unur_mvstd_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - compare clone: + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + UNUR_GEN *clone; + distr = unur_distr_multinormal( dim, mean, covar ); + par = NULL; + gen = NULL; ] + +/* normal distribution */ +par = unur_mvstd_new(distr); +gen = unur_init( par ); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default program +par[0] = unur_mvstd_new(@distr@); + +# default variant but reinitialized with changed distribution +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 1., 0.8, 0.64, 0.8, 1., 0.8, 0.64, 0.8, 1. }; +par[1] = unur_mvstd_new(@distr@); +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_reinit(gen); } + + +[validate - distributions:] + +# standard multinormal distribution +distr[0] = unur_distr_multinormal(3,NULL,NULL); + +# multinormal distribution, dim = 3 +double mean[] = { -1., 2., -3. }; +double covar[] = { 1., 0.8, 0.64, 0.8, 1., 0.8, 0.64, 0.8, 1. }; +distr[1] = unur_distr_multinormal(3,mean,covar); + +# random multinormal distribution +\#define dim (2) +int i; +double mean[dim], covar[dim*dim]; +UNUR_DISTR *covar_distr; +UNUR_GEN *covar_gen; +UNUR_GEN *mean_gen; +covar_distr = unur_distr_correlation(dim); +covar_gen = unur_init(unur_mcorr_new(covar_distr)); +mean_gen = unur_str2gen("normal(5,1)"); +for (i=0; i + + # standard multinormal (dim=3) + <1> + + # multinormal (dim=3) + <2> + . # random multinormal (dim=2) + <3> + + # random multinormal (dim=3) + <4> + . # random multinormal (dim=4) + <5> + . # random multinormal (dim=5) + <6> + . # random multinormal (dim=7) + <7> + . # random multinormal (dim=10) + <8> + . # random multinormal (dim=15) + <9> + . # random multinormal (dim=20) + <10> + . # random multinormal (dim=100) +x<11> + . # multinormal with AR(1) corr matrix (rho=0.5, dim=100) + <12> + . # multinormal with AR(1) corr matrix (rho=0.9, dim=100) +x<13> + . # multinormal with AR(1) corr matrix (rho=0.99, dim=100) +x<14> + . # multinormal with AR(1) corr matrix (rho=0.999, dim=100) + <15> + . # standard multinormal (dim=1) +x<16> + . # random multinormal (dim=1) + <17> 0 . # standard multinormal distribution with rectangular domain + <18> 0 . # invalid distribution (standard multicauchy, dim=3) + + +############################################################################# +############################################################################# + +[verbatim] + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_mvtdr.c b/vendor/unuran-1.11.0/tests/t_mvtdr.c new file mode 100644 index 0000000..2f07ad2 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_mvtdr.c @@ -0,0 +1,2185 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for MVTDR + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +int unur_mvtdr_set_pedantic( UNUR_PAR *par, int pedantic ); + +#define COMPARE_SAMPLE_SIZE (9999) +#define VIOLATE_SAMPLE_SIZE (20) + +double pdf_normal(const double *coord, UNUR_DISTR *distr); +int dpdf_normal(double *grad, const double *coord, UNUR_DISTR *distr); + +double logpdf_normal(const double *coord, UNUR_DISTR *distr); +int dlogpdf_normal(double *grad, const double *coord, UNUR_DISTR *distr); + + +/* we need marginal distributions for the chi2 tests */ +#define unur_distr_multicauchy unur_distr_multicauchy_w_marginals +#define unur_distr_multinormal unur_distr_multinormal_w_marginals +#define unur_distr_multistudent unur_distr_multistudent_w_marginals + + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* dummy function */ +int unur_mvtdr_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +/*-----------------------------------------------------------------*/ + +double pdf_normal(const double *coord, UNUR_DISTR *distr ATTRIBUTE__UNUSED) +/* multinormal density function */ +{ + int i; + double f = 0.; + + for( i=0; i<3; i++ ) + f += coord[i] * coord[i]; + + return( exp(-f) ); +} /* end of pdf_normal() */ + + +int dpdf_normal(double *grad, const double *coord, UNUR_DISTR *distr ATTRIBUTE__UNUSED) +/* gradient of multinormal density function */ +{ + int i; + double f = 0.; + + /* d(e^{-\sum j*x_j^2})/d x_i = -2*x_i*e^{-\sum j*x_j^2} */ + + for( i=0; i<3; i++ ) + f += coord[i] * coord[i]; + f = exp( -f ); + + for( i=0; i<3; i++ ) + grad[i] = (-2) * coord[i] * f; + + return 0; + +} /* end of dpdf_normal() */ + + +/*-----------------------------------------------------------------*/ + +double logpdf_normal(const double *coord, UNUR_DISTR *distr ATTRIBUTE__UNUSED) +/* multinormal density function */ +{ + int i; + double f = 0.; + + for( i=0; i<3; i++ ) + f += coord[i] * coord[i]; + + return (-f); +} /* end of logpdf_normal() */ + + +int dlogpdf_normal(double *grad, const double *coord, UNUR_DISTR *distr ATTRIBUTE__UNUSED) +/* gradient of multinormal density function */ +{ + int i; + + /* d(e^{-\sum j*x_j^2})/d x_i = -2*i*x_i*e^{-\sum j*x_j^2} */ + + for( i=0; i<3; i++ ) + grad[i] = -2 * coord[i]; + + return 0; + +} /* end of dlogpdf_normal() */ + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,40,(unur_mvtdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,40,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,47,(unur_mvtdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,47,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid number of dimensions */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cvec_new(1); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,53,(unur_mvtdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_DISTR_PROP)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* missing data */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cvec_new(3); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,60,(unur_mvtdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* missing data */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cvec_new(3); + unur_distr_cvec_set_pdf(distr,pdf_normal); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,68,(unur_mvtdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* missing data */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cvec_new(3); + unur_distr_cvec_set_logpdf(distr,logpdf_normal); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,76,(unur_mvtdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,88,(unur_mvtdr_set_stepsmin( par, 5 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,91,(unur_mvtdr_set_maxcones( par, 5000 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,94,(unur_mvtdr_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,102,(unur_mvtdr_set_stepsmin( par, 5 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,102,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,105,(unur_mvtdr_set_maxcones( par, 5000 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,105,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,108,(unur_mvtdr_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,108,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_multinormal( 3, NULL, NULL ); + par = unur_mvtdr_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,118,(unur_mvtdr_set_stepsmin( par, -1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,118,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,131,(unur_mvtdr_get_hatvol(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,131,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,134,(unur_mvtdr_get_ncones(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,134,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 139, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,143,(unur_mvtdr_get_hatvol(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,143,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,146,(unur_mvtdr_get_ncones(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,146,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,157,(unur_mvtdr_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,157,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_srou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 164, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,168,(unur_mvtdr_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,168,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* does not exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double x[3]; + distr = unur_distr_multinormal(3,NULL,NULL); + par = unur_mvtdr_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 182, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,186,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,186,UNUR_ERR_NO_REINIT)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_sample_vec( gen, x ); +n_tests_failed += (check_expected_INFINITY(TESTLOG,190,(x[0]))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,190,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* test clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + UNUR_GEN *clone; + distr = unur_distr_multinormal( dim, mean, covar ); + par = unur_mvtdr_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 203, gen ); + + +unur_reset_errno(); +; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,206,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,212,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[39]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 39 */ +{ +distr[0] = unur_distr_multinormal(2,NULL,NULL); +} + +{ +distr[1] = unur_distr_multinormal(3,NULL,NULL); +} + +{ +distr[2] = unur_distr_multinormal(4,NULL,NULL); +} + +{ +distr[3] = unur_distr_multinormal(5,NULL,NULL); +} + +{ +distr[4] = unur_distr_multinormal(6,NULL,NULL); +} + +{ +distr[5] = unur_distr_multinormal(7,NULL,NULL); +} + +{ +{double ll[2] = {-1.,-1.}; + double ru[2] = { 1., 1.}; + distr[6] = unur_distr_multinormal(2,NULL,NULL); + unur_distr_cvec_set_domain_rect(distr[6],ll,ru); } +} + +{ +{double ll[3] = {-.1,-.1,-.1}; + double ru[3] = { 1., 1., 1.}; + distr[7] = unur_distr_multinormal(3,NULL,NULL); + unur_distr_cvec_set_domain_rect(distr[7],ll,ru); } +} + +{ +{double ll[3] = {-.1,-.1,-.1}; + double ru[3] = {UNUR_INFINITY,UNUR_INFINITY,UNUR_INFINITY}; + distr[8] = unur_distr_multinormal(3,NULL,NULL); + unur_distr_cvec_set_domain_rect(distr[8],ll,ru); } +} + +{ +{double ll[3] = {-UNUR_INFINITY,-UNUR_INFINITY,-UNUR_INFINITY}; + double ru[3] = {0.1,0.1,0.1}; + distr[9] = unur_distr_multinormal(3,NULL,NULL); + unur_distr_cvec_set_domain_rect(distr[9],ll,ru); } +} + +{ +{double ll[6] = {-1.,-1.,-1.,-1.,-1.,-1.}; + double ru[6] = { 1., 1., 1., 1., 1., 1.}; + distr[10] = unur_distr_multinormal(6,NULL,NULL); + unur_distr_cvec_set_domain_rect(distr[10],ll,ru); } +} + +{ +{double mean[] = { 10., 20., 30.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + distr[11] = unur_distr_multinormal(3,mean,covar); } +} + +{ +distr[12] = unur_distr_multinormal_ar1(3,NULL,0.9); +} + +{ +distr[13] = unur_distr_multinormal_ar1(4,NULL,0.9); +} + +{ +distr[14] = unur_distr_multinormal_ar1(5,NULL,0.9); +} + +{ +distr[15] = unur_distr_multinormal_ar1(6,NULL,0.5); +} + +{ +distr[16] = unur_distr_multinormal_ar1(7,NULL,0.3); +} + +{ +{double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; + distr[17] = unur_distr_multinormal_ar1(3,mean,0.9); } +} + +{ +{double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; + distr[18] = unur_distr_multinormal_ar1(4,mean,0.9); } +} + +{ +{double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; + distr[19] = unur_distr_multinormal_ar1(5,mean,0.9); } +} + +{ +distr[20] = unur_distr_multinormal_constantrho(3,NULL,0.99); +} + +{ +distr[21] = unur_distr_multinormal_constantrho(4,NULL,0.9); +} + +{ +distr[22] = unur_distr_multinormal_constantrho(5,NULL,0.5); +} + +{ +{double ll[3] = {-.1,-.1,-.1}; + double ru[3] = { 1., 1., 1.}; + distr[23] = unur_distr_multinormal_ar1(3,NULL,0.9); + unur_distr_cvec_set_domain_rect(distr[23],ll,ru); } +} + +{ +{double ll[3] = { 0., 0., 0.}; + double ru[3] = { 1., 1., 1.}; + distr[24] = unur_distr_multinormal_ar1(3,NULL,0.9); + unur_distr_cvec_set_domain_rect(distr[24],ll,ru); } +} + +{ +{double ll[3] = {-1.,-1.,-1.}; + double ru[3] = { 0., 0., 0.}; + distr[25] = unur_distr_multinormal_ar1(3,NULL,0.9); + unur_distr_cvec_set_domain_rect(distr[25],ll,ru); } +} + +{ +{double ll[3] = {-1., 0.,-1.}; + double ru[3] = { 0., 1., 0.}; + distr[26] = unur_distr_multinormal_ar1(3,NULL,0.9); + unur_distr_cvec_set_domain_rect(distr[26],ll,ru); } +} + +{ +{double ll[3] = { 0., 0., 0.}; + double ru[3] = { UNUR_INFINITY, UNUR_INFINITY, UNUR_INFINITY}; + distr[27] = unur_distr_multinormal_ar1(3,NULL,0.9); + unur_distr_cvec_set_domain_rect(distr[27],ll,ru); } +} + +{ +{double ll[3] = { -UNUR_INFINITY, -UNUR_INFINITY, -UNUR_INFINITY}; + double ru[3] = { 0., 0., 0.}; + distr[28] = unur_distr_multinormal_ar1(3,NULL,0.9); + unur_distr_cvec_set_domain_rect(distr[28],ll,ru); } +} + +{ +{double ll[3] = { -UNUR_INFINITY, -UNUR_INFINITY, -UNUR_INFINITY}; + double ru[3] = { 0., 0., UNUR_INFINITY}; + distr[29] = unur_distr_multinormal_ar1(3,NULL,0.9); + unur_distr_cvec_set_domain_rect(distr[29],ll,ru); } +} + +{ +{double ll[3] = {-1.,-1.,-1.}; + double ru[3] = { UNUR_INFINITY, UNUR_INFINITY, UNUR_INFINITY}; + distr[30] = unur_distr_multinormal_ar1(3,NULL,0.9); + unur_distr_cvec_set_domain_rect(distr[30],ll,ru); } +} + +{ +{double ll[3] = {-.1,-.1,-.1}; + double ru[3] = { 1., 1., 1.}; + distr[31] = unur_distr_multinormal(3,NULL,NULL); + unur_distr_cvec_set_domain_rect(distr[31],ll,ru); } +} + +{ +{double ll[3] = { 0., 0., 0.}; + double ru[3] = { 1., 1., 1.}; + distr[32] = unur_distr_multinormal(3,NULL,NULL); + unur_distr_cvec_set_domain_rect(distr[32],ll,ru); } +} + +{ +{double ll[3] = {-1.,-1.,-1.}; + double ru[3] = { 0., 0., 0.}; + distr[33] = unur_distr_multinormal(3,NULL,NULL); + unur_distr_cvec_set_domain_rect(distr[33],ll,ru); } +} + +{ +{double ll[3] = {-1., 0.,-1.}; + double ru[3] = { 0., 1., 0.}; + distr[34] = unur_distr_multinormal(3,NULL,NULL); + unur_distr_cvec_set_domain_rect(distr[34],ll,ru); } +} + +{ +{double ll[3] = { 0., 0., 0.}; + double ru[3] = { UNUR_INFINITY, UNUR_INFINITY, UNUR_INFINITY}; + distr[35] = unur_distr_multinormal(3,NULL,NULL); + unur_distr_cvec_set_domain_rect(distr[35],ll,ru); } +} + +{ +{double ll[3] = { -UNUR_INFINITY, -UNUR_INFINITY, -UNUR_INFINITY}; + double ru[3] = { 0., 0., 0.}; + distr[36] = unur_distr_multinormal(3,NULL,NULL); + unur_distr_cvec_set_domain_rect(distr[36],ll,ru); } +} + +{ +{double ll[3] = { -UNUR_INFINITY, -UNUR_INFINITY, -UNUR_INFINITY}; + double ru[3] = { 0., 0., UNUR_INFINITY}; + distr[37] = unur_distr_multinormal(3,NULL,NULL); + unur_distr_cvec_set_domain_rect(distr[37],ll,ru); } +} + +{ +{double ll[3] = {-1.,-1.,-1.}; + double ru[3] = { UNUR_INFINITY, UNUR_INFINITY, UNUR_INFINITY}; + distr[38] = unur_distr_multinormal(3,NULL,NULL); + unur_distr_cvec_set_domain_rect(distr[38],ll,ru); } +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 39 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [15] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [16] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [31] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [32] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [33] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [34] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [35] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [36] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [37] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [38] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); +par = unur_mvtdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 39 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [15] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [16] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [29] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [31] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [32] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [33] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[33],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [34] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[34],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [35] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[35],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [36] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[36],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [37] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[37],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [38] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); +par = unur_mvtdr_new(distr_localcopy); + unur_mvtdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_mvtdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[38],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + unur_distr_free(distr[30]); + unur_distr_free(distr[31]); + unur_distr_free(distr[32]); + unur_distr_free(distr[33]); + unur_distr_free(distr[34]); + unur_distr_free(distr[35]); + unur_distr_free(distr[36]); + unur_distr_free(distr[37]); + unur_distr_free(distr[38]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_mvtdr_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_ninv.c b/vendor/unuran-1.11.0/tests/t_ninv.c new file mode 100644 index 0000000..2d2f52b --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_ninv.c @@ -0,0 +1,13792 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for NINV + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_ninv_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +#include + +/* -- which tests for u-error should be performed (for development) -- */ + +#define DEVEL (0) /* whether to run tests in development mode */ +#define ALL (1) + +#define UERROR_STANDARDDIST (1) +#define UERROR_QUASIPDF DEVEL +#define UERROR_VANISHINGPDF DEVEL +#define UERROR_TRUNCATED (1) +#define UERROR_UNBOUNDEDPDF (0) +#define UERROR_MULTIMODAL DEVEL +#define UERROR_MULTIMODAL_VANISHINGPDF DEVEL + +/* variants */ +static int UERROR_REGULA = TRUE; +static int UERROR_NEWTON = TRUE; + + +/* constants */ + +#define UERROR_SAMPLESIZE (10000) + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + +/* Chi-square goodness-of-fit tests some times fail once due to numerical */ +/* errors. So we accept more such failure than for other methods. */ +#define CHI2_FAILURES_TOLERATED (5) + +/* prototypes */ + +#define set_debug_flag(par) \ + do { \ + if (fullcheck) unur_set_debug((par),~0u); \ + else unur_set_debug((par),1u); \ + } while (0); + +int ninv_error_experiment( UNUR_PAR *par, int samplesize ); + +int chg_domain_experiment( UNUR_PAR *par, int samplesize ); + +int ninv_error_gen_experiment( UNUR_GEN *gen, + double u_resolution, const char *method, int samplesize ); + + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + + + +/*****************************************************************************/ +/* run unur_test_u_error for a particular generator object and print result */ + +int +ninv_error_gen_experiment( UNUR_GEN *gen, /* generator object */ + double u_resolution, /* maximal tolerated u-error */ + const char *method, /* chosen method */ + int samplesize ) /* sample size for error experiment */ + /* returns 0 if maxerror < u_resolution, errorcode otherwise */ +{ + int i, nfpar; + const double *fpar; + const UNUR_DISTR *distr = unur_get_distr(gen); + const char *genid = unur_get_genid(gen); + double score; + + /* print data about distribution */ + fprintf(TESTLOG,"%s: %s distribution",genid,unur_distr_get_name(distr)); + nfpar = unur_distr_cont_get_pdfparams(distr,&fpar); + if (nfpar) { + fprintf(TESTLOG," with parameters "); + for(i=0;i use regula falsi */ + /* variant==1 --> use Newton */ + /* variant==2 --> use bisection */ + + switch (variant) { + case 0: /* run regula */ + method = "regula"; + if (UERROR_REGULA) printf(""); + else continue; + break; + case 1: /* run Newton */ + method = "newton"; + if (UERROR_NEWTON) printf(""); + else continue; + break; + case 2: /* run bisection method */ + method = "bisect"; + if (UERROR_NEWTON) printf(""); + else continue; + break; + default: + continue; + } + + for ( u_resolution = 1.e-6; u_resolution > 1.e-10; u_resolution *= 0.01 ) { + + /* make a working copy */ + par_clone = _unur_par_clone(par); + + /* set variant */ + switch (variant) { + case 0: unur_ninv_set_useregula(par_clone); break; + case 1: unur_ninv_set_usenewton(par_clone); break; + case 2: unur_ninv_set_usebisect(par_clone); break; + } + + /* create generator object */ + unur_ninv_set_x_resolution(par_clone,-1.); + unur_ninv_set_u_resolution(par_clone,u_resolution); + set_debug_flag(par_clone); + gen = unur_init(par_clone); + + /* run test */ + errorsum += ninv_error_gen_experiment(gen, u_resolution, method, samplesize); + fprintf(TESTLOG,"\n"); + + /* clear memory */ + unur_free(gen); + } + + } + + unur_par_free(par); + + return errorsum; +} /* end of ninv_error_experiment() */ + +/*****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,68,(unur_ninv_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,74,(unur_ninv_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,74,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +/* cdf */ +n_tests_failed += (check_expected_NULL(TESTLOG,81,(unur_ninv_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,81,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,91,(unur_ninv_set_usenewton( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,94,(unur_ninv_set_useregula( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,97,(unur_ninv_set_max_iter( par, 40 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,97,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,100,(unur_ninv_set_x_resolution( par, 0.001 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,100,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,103,(unur_ninv_set_u_resolution( par, 0.001 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,103,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_ninv_set_start( par, 0., 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,109,(unur_ninv_set_table( par, 100 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,109,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,118,(unur_ninv_set_usenewton( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,118,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,121,(unur_ninv_set_useregula( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,121,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,124,(unur_ninv_set_max_iter( par, 40 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,124,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,127,(unur_ninv_set_x_resolution( par, 0.001 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,127,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,130,(unur_ninv_set_u_resolution( par, 0.001 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,130,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,133,(unur_ninv_set_start( par, 0., 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,133,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,136,(unur_ninv_set_table( par, 100 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,136,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_ninv_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,147,(unur_ninv_set_max_iter( par, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,147,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_ninv_set_x_resolution( par, 1e-30 ); +n_tests_failed += (check_errorcode(TESTLOG,150,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_ninv_set_u_resolution( par, 1e-30 ); +n_tests_failed += (check_errorcode(TESTLOG,153,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + unur_distr_cont_set_domain(distr,-1.,2.); + par = unur_tdr_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 171, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,175,(unur_ninv_chg_max_iter( gen, 100 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,175,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,178,(unur_ninv_chg_x_resolution( gen, 1.e-10)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,178,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,181,(unur_ninv_chg_u_resolution( gen, 1.e-10)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,181,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,184,(unur_ninv_chg_truncated( gen, 0., 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,184,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + unur_distr_cont_set_domain(distr,-1.,2.); + par = unur_ninv_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 192, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,197,(unur_ninv_chg_max_iter( gen, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,197,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_ninv_chg_x_resolution( gen, 1.e-30); +n_tests_failed += (check_errorcode(TESTLOG,200,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_ninv_chg_u_resolution( gen, 1.e-30); +n_tests_failed += (check_errorcode(TESTLOG,203,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,206,(unur_ninv_chg_truncated( gen, 1., 0. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,206,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_ninv_chg_truncated( gen, -2., 0. ); +n_tests_failed += (check_errorcode(TESTLOG,209,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_ninv_chg_truncated( gen, 0., 10. ); +n_tests_failed += (check_errorcode(TESTLOG,212,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,223,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,223,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* does not exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_ninv_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 231, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,235,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,245,(unur_ninv_eval_approxinvcdf(gen,0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,245,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_hinv_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 249, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,253,(unur_ninv_eval_approxinvcdf(gen,0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,253,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid domain */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_ninv_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 258, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,262,(unur_ninv_eval_approxinvcdf(gen,1.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,262,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_negINFINITY(TESTLOG,265,(unur_ninv_eval_approxinvcdf(gen,-0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,265,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_ninv_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,278,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,284,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_ninv_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,296,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,300,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[] = {3.,4.}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_gamma(fpar,2); +unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); +par = unur_ninv_new(distr); +unur_ninv_set_max_iter(par,10); +unur_ninv_set_start(par,4.,10.); +unur_ninv_set_table(par,100); +unur_ninv_set_usenewton(par); +unur_ninv_set_x_resolution(par,1.E-6); +unur_set_debug(par,1u); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,321,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,4.); domain = 2,infinity & \ + method = ninv; max_iter = 10; start = 4., 10.; table = 100; \ + usenewton; x_resolution = 1.E-6; debug = 0x1" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,328,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_gamma(fpar,2); +unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); +par = unur_ninv_new(distr); +unur_ninv_set_useregula(par); +unur_set_debug(par,1u); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,337,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,4.); domain = (2,inf) & method = ninv; useregula; debug = 0x1" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,342,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[33]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 33 */ +{ +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); +} + +{ +fpm[0] = 0.5; +fpm[1] = 3.; +distr[28] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 0.3; +distr[29] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 0.5; +fpm[1] = 0.4; +distr[30] = unur_distr_beta(fpm,2); +} + +{ +distr[7] = unur_distr_cauchy(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); +} + +{ +distr[24] = unur_distr_exponential(NULL,0); +} + +{ +fpm[0] = 30.; +fpm[1] = -5.; +distr[25] = unur_distr_exponential(fpm,2); +} + +{ +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[16] = unur_distr_gamma(fpm,3); +} + +{ +fpm[0] = 0.5; +distr[31] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 0.2; +distr[32] = unur_distr_gamma(fpm,1); +} + +{ +distr[26] = unur_distr_laplace(NULL,0); +} + +{ +fpm[0] = -10.; +fpm[1] = 100.; +distr[27] = unur_distr_laplace(fpm,2); +} + +{ +distr[17] = unur_distr_normal(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); +} + +{ +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); +} + +{ +distr[20] = unur_distr_uniform(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); +} + +{ +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[23] = unur_distr_beta(fpm,2); +unur_distr_cont_set_domain(distr[23],-2.,5.); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 660 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [28] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [29] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [30] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [31] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [32] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + gen = unur_init(par); + if (gen) { +unur_ninv_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_ninv_new(distr_localcopy); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + unur_distr_free(distr[30]); + unur_distr_free(distr[31]); + unur_distr_free(distr[32]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + +/*---------------------------------------------------------------------------*/ +/* [special] */ + +void test_special (void) +{ + /* set boolean to FALSE */ + int FAILED = 0; + + + + + + int samplesize = UERROR_SAMPLESIZE; + int errorsum = 0; + + UNUR_DISTR *distr; + UNUR_PAR *par; + +/* start test */ +printf("[special "); fflush(stdout); +fprintf(TESTLOG,"\n[special]\n"); + +/* set stop watch */ +stopwatch_lap(&watch); + + + + /* test for maximal u-error */ + printf("\n[test maximal u-error]"); + fprintf(TESTLOG,"\n* Test maximal u-error *\n"); + +if (UERROR_STANDARDDIST) { /* --------------------------- */ + + printf("\nStandard distributions:\n"); + fprintf(TESTLOG,"\n--- Standard distributions --- \n\n"); + + +if (ALL) { + printf(" normal"); + distr = unur_distr_normal(NULL,0); + par = unur_ninv_new(distr); + errorsum += ninv_error_experiment(par,samplesize); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +} /* endif (UERROR_STANDARDDIST) */ + + /* test finished */ + FAILED = (errorsum < 2) ? 0 : 1; + + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (FAILED) ? 0 : 1; + (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_special() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_ninv_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_ninv.conf b/vendor/unuran-1.11.0/tests/t_ninv.conf new file mode 100644 index 0000000..d6ff131 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_ninv.conf @@ -0,0 +1,866 @@ +############################################################################# + +[main] + +[main - data:] + +# method +method: NINV + +[main - header:] + +\#include + +/* -- which tests for u-error should be performed (for development) -- */ + +\#define DEVEL (0) /* whether to run tests in development mode */ +\#define ALL (1) + +\#define UERROR_STANDARDDIST (1) +\#define UERROR_QUASIPDF DEVEL +\#define UERROR_VANISHINGPDF DEVEL +\#define UERROR_TRUNCATED (1) +\#define UERROR_UNBOUNDEDPDF (0) +\#define UERROR_MULTIMODAL DEVEL +\#define UERROR_MULTIMODAL_VANISHINGPDF DEVEL + +/* variants */ +static int UERROR_REGULA = TRUE; +static int UERROR_NEWTON = TRUE; + + +/* constants */ + +## \#define UERROR_SAMPLESIZE (100000) +\#define UERROR_SAMPLESIZE (10000) + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* Chi-square goodness-of-fit tests some times fail once due to numerical */ +/* errors. So we accept more such failure than for other methods. */ +\#define CHI2_FAILURES_TOLERATED (5) + +/* prototypes */ + +\#define set_debug_flag(par) \ + do { \ + if (fullcheck) unur_set_debug((par),~0u); \ + else unur_set_debug((par),1u); \ + } while (0); + +int ninv_error_experiment( UNUR_PAR *par, int samplesize ); + +int chg_domain_experiment( UNUR_PAR *par, int samplesize ); + +int ninv_error_gen_experiment( UNUR_GEN *gen, + double u_resolution, const char *method, int samplesize ); + + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_cont_new(); ] + +/* cdf */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_usenewton( par ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_useregula( par ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_max_iter( par, 40 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_x_resolution( par, 0.001 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_u_resolution( par, 0.001 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_start( par, 0., 1. ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_table( par, 100 ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameter object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); ] + +~_usenewton( par ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_useregula( par ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_max_iter( par, 40 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_x_resolution( par, 0.001 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_u_resolution( par, 0.001 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_start( par, 0., 1. ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_table( par, 100 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + + +[set - invalid parameters: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_ninv_new(distr); ] + +~_max_iter( par, 0 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_x_resolution( par, 1e-30 ); + --> none --> UNUR_ERR_PAR_SET + +~_u_resolution( par, 1e-30 ); + --> none --> UNUR_ERR_PAR_SET + +unur_par_free(par); + + +############################################################################# + +# [get] + +############################################################################# + +[chg] + +[chg - invalid generator object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + unur_distr_cont_set_domain(distr,-1.,2.); + par = unur_tdr_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_max_iter( gen, 100 ); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +~_x_resolution( gen, 1.e-10); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +~_u_resolution( gen, 1.e-10); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +~_truncated( gen, 0., 1. ); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + + +[chg - invalid parameters: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + unur_distr_cont_set_domain(distr,-1.,2.); + par = unur_ninv_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + + +~_max_iter( gen, 0 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_x_resolution( gen, 1.e-30); + --> none --> UNUR_ERR_PAR_SET + +~_u_resolution( gen, 1.e-30); + --> none --> UNUR_ERR_PAR_SET + +~_truncated( gen, 1., 0. ); + --> expected_setfailed --> UNUR_ERR_DISTR_SET + +~_truncated( gen, -2., 0. ); + --> none --> UNUR_ERR_DISTR_SET + +~_truncated( gen, 0., 10. ); + --> none --> UNUR_ERR_DISTR_SET + + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + +############################################################################# + +[reinit] + +[reinit - does not exist: + distr = unur_distr_normal(NULL,0); + par = unur_ninv_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - invalid NULL ptr: + gen = NULL; ] + +unur_ninv_eval_approxinvcdf(gen,0.5); + --> expected_INFINITY --> UNUR_ERR_NULL + +[sample - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_hinv_new(distr); + gen = unur_init(par); <-- ! NULL ] + +unur_ninv_eval_approxinvcdf(gen,0.5); + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + +[sample - invalid domain: + distr = unur_distr_normal(NULL,0); + par = unur_ninv_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +unur_ninv_eval_approxinvcdf(gen,1.5); + --> expected_INFINITY --> UNUR_ERR_DOMAIN + +unur_ninv_eval_approxinvcdf(gen,-0.5); + --> expected_negINFINITY --> UNUR_ERR_DOMAIN + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_ninv_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare reinit: + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_ninv_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + double fpar[] = {3.,4.}; + distr = NULL; + par = NULL; + gen = NULL; ] + + +distr = unur_distr_gamma(fpar,2); +unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); +par = unur_ninv_new(distr); +unur_ninv_set_max_iter(par,10); +unur_ninv_set_start(par,4.,10.); +unur_ninv_set_table(par,100); +unur_ninv_set_usenewton(par); +unur_ninv_set_x_resolution(par,1.E-6); +unur_set_debug(par,1u); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,4.); domain = 2,infinity & \ + method = ninv; max_iter = 10; start = 4., 10.; table = 100; \ + usenewton; x_resolution = 1.E-6; debug = 0x1" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +distr = unur_distr_gamma(fpar,2); +unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); +par = unur_ninv_new(distr); +unur_ninv_set_useregula(par); +unur_set_debug(par,1u); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,4.); domain = (2,inf) & method = ninv; useregula; debug = 0x1" ); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default (Newton) +par[0] = unur_ninv_new(@distr@); +unur_ninv_set_usenewton(par); + +# no table, starting points (Newton) +par[1] = unur_ninv_new(@distr@); +unur_ninv_set_usenewton(par); +unur_ninv_set_start(par, 0.1, 0.9); + +# use small table (Newton) +par[2] = unur_ninv_new(@distr@); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); + +# use large table (Newton) +par[3] = unur_ninv_new(@distr@); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); + +# default with truncated distribution (Newton) +par[4] = unur_ninv_new(@distr@); +unur_ninv_set_usenewton(par); +unur_ninv_chg_truncated(gen,0.5,0.9); + +# use small table with truncated distribution (Newton) +par[5] = unur_ninv_new(@distr@); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +unur_ninv_chg_truncated(gen,0.5,0.9); + +# use large table with truncated distribution (Newton) +par[6] = unur_ninv_new(@distr@); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +unur_ninv_chg_truncated(gen,0.5,0.9); + +# default with changed pdf parameters after setup (Newton) +{ UNUR_DISTR *dg =NULL; +par[7] = unur_ninv_new(@distr@); +unur_ninv_set_usenewton(par); +fpm[0] = 2.; +fpm[1] = 4.; +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + +# use small table with changed pdf parameters after setup (Newton) +{ UNUR_DISTR *dg =NULL; +par[8] = unur_ninv_new(@distr@); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + +# use large table with changed pdf parameters after setup (Newton) +{ UNUR_DISTR *dg =NULL; +par[9] = unur_ninv_new(@distr@); +unur_ninv_set_usenewton(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + +# default (regula falsi) +par[10] = unur_ninv_new(@distr@); +unur_ninv_set_useregula(par); + +# no table, starting points (regula falsi) +par[11] = unur_ninv_new(@distr@); +unur_ninv_set_useregula(par); +unur_ninv_set_start(par, 0.1, 0.9); + +# use small table (regula falsi) +par[12] = unur_ninv_new(@distr@); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); + +# use large table (regula falsi) +par[13] = unur_ninv_new(@distr@); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); + +# default with truncated distribution (regula falsi) +par[14] = unur_ninv_new(@distr@); +unur_ninv_set_useregula(par); +unur_ninv_chg_truncated(gen,0.5,0.9); + +# use small table with truncated distribution (regula falsi) +par[15] = unur_ninv_new(@distr@); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +unur_ninv_chg_truncated(gen,0.5,0.9); + +# use large table with truncated distribution (regula falsi) +par[16] = unur_ninv_new(@distr@); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +unur_ninv_chg_truncated(gen,0.5,0.9); + +# default with changed pdf parameters after setup (regula falsi) +{ UNUR_DISTR *dg =NULL; +par[17] = unur_ninv_new(@distr@); +unur_ninv_set_useregula(par); +fpm[0] = 2.; +fpm[1] = 4.; +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + +# use small table with changed pdf parameters after setup (regula falsi) +{ UNUR_DISTR *dg =NULL; +par[18] = unur_ninv_new(@distr@); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,11); +fpm[0] = 2.; +fpm[1] = 4.; +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + +# use large table with changed pdf parameters after setup (regula falsi) +{ UNUR_DISTR *dg =NULL; +par[19] = unur_ninv_new(@distr@); +unur_ninv_set_useregula(par); +unur_ninv_set_table(par,1000); +fpm[0] = 2.; +fpm[1] = 4.; +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_reinit(gen); } + + +[validate - distributions:] + +# Beta distributions +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); + +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); + +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); + +fpm[0] = 0.5; +fpm[1] = 3.; +distr[28] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 0.3; +distr[29] = unur_distr_beta(fpm,2); + +fpm[0] = 0.5; +fpm[1] = 0.4; +distr[30] = unur_distr_beta(fpm,2); + +# Cauchy distributions +distr[7] = unur_distr_cauchy(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); + +# Exponential distributions +distr[24] = unur_distr_exponential(NULL,0); + +fpm[0] = 30.; +fpm[1] = -5.; +distr[25] = unur_distr_exponential(fpm,2); + +# Gamma distributions +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); + +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); + +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); + +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); + +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); + +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[16] = unur_distr_gamma(fpm,3); + +fpm[0] = 0.5; +distr[31] = unur_distr_gamma(fpm,1); + +fpm[0] = 0.2; +distr[32] = unur_distr_gamma(fpm,1); + +# Laplace distributions +distr[26] = unur_distr_laplace(NULL,0); + +fpm[0] = -10.; +fpm[1] = 100.; +distr[27] = unur_distr_laplace(fpm,2); + +# Normal distributions +distr[17] = unur_distr_normal(NULL,0); + +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); + +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); + +# Uniform distributions +distr[20] = unur_distr_uniform(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); + +# truncated distributions +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); + +# domain exceeds support of pdf +fpm[0] = 3.; +fpm[1] = 4.; +distr[23] = unur_distr_beta(fpm,2); +unur_distr_cont_set_domain(distr[23],-2.,5.); + + +# number of distributions: 33 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... (Newton) default (no table) (but with increased number of max iterations) +# [1] ... (Newton) no table, starting points +# [2] ... (Newton) use small table +# [3] ... (Newton) use large table +# [4] ... (Newton) default with truncated distribution +# [5] ... (Newton) use small table with truncated distribution +# [6] ... (Newton) use large table with truncated distribution +# [7] ... (Newton) default with changed pdf parameters after setup +# [8] ... (Newton) use small table with changed pdf parameters after setup +# [9] ... (Newton) use large table with changed pdf parameters after setup +# +# [10] ... (regula) default (no table) +# [11] ... (regula) no table, starting points +# [12] ... (regula) use small table +# [13] ... (regula) use large table +# [14] ... (regula) default with truncated distribution +# [15] ... (regula) use small table with truncated distribution +# [16] ... (regula) use large table with truncated distribution +# [17] ... (regula) default with changed pdf parameters after setup +# [18] ... (regula) use small table with changed pdf parameters after setup +# [19] ... (regula) use large table with changed pdf parameters after setup +# +# 1 1 1 1 1 1 1 1 1 1 +# 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 # distribution +#------------------------------------------------------------------------------------------ +x <0> + + + + + + + + + + + + + + + + + + + + # beta (1, 2) + <1> + + + + + + + + + + + + + + + + + + + + # beta (1, 5) +x <2> + + + + + + + + + + + + + + + + + + + + # beta (1, 100) + <3> + + + + + + + + + + + + + + + + + + + + # beta (3, 4) + <4> x+ x+ x+ + x+ x+ + + + + x+ x+ x+ + x+ x+ + + + + # beta (5, 100) + <5> x+ x+ x+ + x+ x+ + + + + x+ x+ x+ + x+ x+ + + + + # beta (500, 300) + <6> + + + + + + + + + + + + + + + + + + + + # beta (5, 10, -3, 15) + <28> x+ x+ x+ + x+ x+ + + + + x+ x+ x+ + x+ x+ + + + + # beta (0.5, 3) + <29> x+ x+ x. + x+ x+ + + + + x+ x+ x+ + x+ x+ + + + + # beta (5, 0.3) + <30> x+ x+ x. + x+ x+ + + + + x+ x+ x+ + x+ x+ + + + + # beta (0.5, 0.4) + <7> + + + + + + + + + + + + + + + + + + + + # cauchy () + <8> + + + + + + + + + + + + + + + + + + + + # cauchy (1, 20) + <24> + + + + + + + + + + + + + + + + + + + + # exponential () + <25> + + + + + + + + + + + + + + + + + + + + # exponential (30, -5) +x <9> + + + + + + + + + + + + + + + + + + + + # gamma (1) + <10> + + + + + + + + + + + + + + + + + + + + # gamma (2) + <11> + + + + + + + + + + + + + + + + + + + + # gamma (3) + <12> + . + + + + + + + + + + + + + + + + + + # gamma (10) +x<13> + . + + + + + + + + + + + + + + + + + + # gamma (1000) + <14> + . + + + + + + + + + + + + + + + + + + # gamma (5, 1000, 0) +x<15> + + + + + + + + + + + + + + + + + + + + # gamma (5, 1e-05, 0) +x<16> + + + + + + + + + + + . + + + + + + + + # gamma (5, 10, 1000) + <31> + + + + + + + + + + + + + + + + + + + + # gamma (0.5) + <32> + + + + + + + + + + + + + + + + + + + + # gamma (0.2) + <26> + + + + + + + + + + + + + + + + + + + + # laplace () + <27> + + + + + + + + + + + + + + + + + + + + # laplace (-10, 100) + <17> + + + + + + + + + + + + + + + + + + + + # normal () +x<18> + + + + + + + + + + + + + + + + + + + + # normal (1, 1e-05) + <19> + + + + + + + + + + + + + + + + + + + + # normal (1, 1e+05) + <20> + + + + + + + + + + + + + + + + + + + + # uniform () + <21> + + + + + + + + + + + + + + + + + + + + # uniform (1, 20) + <22> + + + + + + + + + + + + + + + + + + + + # cauchy () - truncated + <23> + + + + + + + + + + + + + + + + + + + + # beta () - domain superset of support + +############################################################################# + +[special] + +[special - decl:] + + int samplesize = UERROR_SAMPLESIZE; + int errorsum = 0; +# double fpar[4]; +# double cpoints[10]; + + UNUR_DISTR *distr; + UNUR_PAR *par; + +[special - start:] + + /* test for maximal u-error */ + printf("\n[test maximal u-error]"); + fprintf(TESTLOG,"\n* Test maximal u-error *\n"); + +## ---------------------------------------------------- +if (UERROR_STANDARDDIST) { /* --------------------------- */ + + printf("\nStandard distributions:\n"); + fprintf(TESTLOG,"\n--- Standard distributions --- \n\n"); + + ## --- Normal --- +if (ALL) { + printf(" normal"); + distr = unur_distr_normal(NULL,0); + par = unur_ninv_new(distr); + errorsum += ninv_error_experiment(par,samplesize); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +} /* endif (UERROR_STANDARDDIST) */ +## ---------------------------------------------------- + + /* test finished */ + FAILED = (errorsum < 2) ? 0 : 1; + +############################################################################# + +[verbatim] + +############################################################################# +# +# routines for special tests +# +############################################################################# + + +/*****************************************************************************/ +/* run unur_test_u_error for a particular generator object and print result */ + +int +ninv_error_gen_experiment( UNUR_GEN *gen, /* generator object */ + double u_resolution, /* maximal tolerated u-error */ + const char *method, /* chosen method */ + int samplesize ) /* sample size for error experiment */ + /* returns 0 if maxerror < u_resolution, errorcode otherwise */ +{ + int i, nfpar; + const double *fpar; + const UNUR_DISTR *distr = unur_get_distr(gen); + const char *genid = unur_get_genid(gen); + double score; + + /* print data about distribution */ + fprintf(TESTLOG,"%s: %s distribution",genid,unur_distr_get_name(distr)); + nfpar = unur_distr_cont_get_pdfparams(distr,&fpar); + if (nfpar) { + fprintf(TESTLOG," with parameters "); + for(i=0;i use regula falsi */ + /* variant==1 --> use Newton */ + /* variant==2 --> use bisection */ + + switch (variant) { + case 0: /* run regula */ + method = "regula"; + if (UERROR_REGULA) printf(""); + else continue; + break; + case 1: /* run Newton */ + method = "newton"; + if (UERROR_NEWTON) printf(""); + else continue; + break; + case 2: /* run bisection method */ + method = "bisect"; + if (UERROR_NEWTON) printf(""); + else continue; + break; + default: + continue; + } + + for ( u_resolution = 1.e-6; u_resolution > 1.e-10; u_resolution *= 0.01 ) { + + /* make a working copy */ + par_clone = _unur_par_clone(par); + + /* set variant */ + switch (variant) { + case 0: unur_ninv_set_useregula(par_clone); break; + case 1: unur_ninv_set_usenewton(par_clone); break; + case 2: unur_ninv_set_usebisect(par_clone); break; + } + + /* create generator object */ + unur_ninv_set_x_resolution(par_clone,-1.); + unur_ninv_set_u_resolution(par_clone,u_resolution); + set_debug_flag(par_clone); + gen = unur_init(par_clone); + + /* run test */ + errorsum += ninv_error_gen_experiment(gen, u_resolution, method, samplesize); + fprintf(TESTLOG,"\n"); + + /* clear memory */ + unur_free(gen); + } + + } + + unur_par_free(par); + + return errorsum; +} /* end of ninv_error_experiment() */ + +/*****************************************************************************/ + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_norta.c b/vendor/unuran-1.11.0/tests/t_norta.c new file mode 100644 index 0000000..238b963 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_norta.c @@ -0,0 +1,948 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for NORTA + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_norta_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,25,(unur_norta_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,25,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,32,(unur_norta_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,32,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + double mean[] = {1.,2.}; + double covar[] = {2.,1., 1., 2.}; + distr = unur_distr_cvec_new(2); + + +unur_reset_errno(); +/* mean */ +n_tests_failed += (check_expected_NULL(TESTLOG,42,(unur_norta_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* covariance matrix */ +unur_distr_cvec_set_mean(distr,mean); +unur_distr_cvec_set_covar(distr,covar); +n_tests_failed += (check_expected_NULL(TESTLOG,48,(unur_norta_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,48,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* does not exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double x[3]; + const int dim = 3; + double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; + distr = unur_distr_copula(dim, rankcorr); + par = unur_norta_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 76, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,80,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,80,UNUR_ERR_NO_REINIT)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_sample_vec( gen, x ); +n_tests_failed += (check_expected_INFINITY(TESTLOG,84,(x[0]))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,84,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + UNUR_GEN *clone; + distr = unur_distr_copula(dim, NULL); + par = unur_norta_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 95, gen ); + + +unur_reset_errno(); +/* copula without correlation */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,99,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,105,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; + UNUR_GEN *clone; + distr = unur_distr_copula(dim, rankcorr); + par = unur_norta_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 114, gen ); + + +unur_reset_errno(); +/* copula with correlation */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,118,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,124,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; + double gamma_params[] = {5.}; + UNUR_GEN *clone; + UNUR_DISTR *marginal; + distr = unur_distr_cvec_new(dim); + unur_distr_cvec_set_rankcorr(distr,rankcorr); + marginal = unur_distr_gamma(gamma_params,1); + unur_distr_cvec_set_marginals(distr,marginal); + unur_distr_free(marginal); + par = unur_norta_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 139, gen ); + + +unur_reset_errno(); +/* gamma marginals with correlation */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,143,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,149,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; + double gamma_params[] = {5.}; + double beta_params[] = {3.,5.}; + UNUR_GEN *clone; + distr = unur_distr_cvec_new(dim); + unur_distr_cvec_set_rankcorr(distr,rankcorr); + unur_distr_cvec_set_marginal_list(distr, + unur_distr_cauchy(NULL,0), + unur_distr_gamma(gamma_params,1), + unur_distr_beta(beta_params,2) ); + par = unur_norta_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 165, gen ); + + +unur_reset_errno(); +/* multivariate distribution with given marginals */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,169,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,175,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; + double gamma_params[] = {5.}; + double beta_params[] = {3.,5.}; + UNUR_GEN *clone; + UNUR_DISTR *marginals[3]; + distr = unur_distr_cvec_new(3); + unur_distr_cvec_set_rankcorr(distr,rankcorr); + marginals[0] = unur_distr_gamma(gamma_params,1); + marginals[1] = unur_distr_cauchy(NULL,0); + marginals[2] = unur_distr_beta(beta_params,2); + unur_distr_cvec_set_marginal_array(distr,marginals); + unur_distr_free(marginals[0]); + unur_distr_free(marginals[1]); + unur_distr_free(marginals[2]); + par = unur_norta_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 194, gen ); + + +unur_reset_errno(); +/* multivariate distribution with given marginals */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,198,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,204,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone 1dim */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 1; + double beta_params[] = {3.,5.}; + UNUR_GEN *clone; + distr = unur_distr_cvec_new(dim); + unur_distr_cvec_set_rankcorr(distr,NULL); + unur_distr_cvec_set_marginal_list(distr, + unur_distr_beta(beta_params,2) ); + par = unur_norta_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 216, gen ); + + +unur_reset_errno(); +/* multivariate distribution with given marginals */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,220,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,226,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[11]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 11 */ +{ +distr[0] = unur_distr_copula(3,NULL); +} + +{ +double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; +distr[1] = unur_distr_copula(3, rankcorr); +} + +{ +#define dim (3) +double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; +double gamma_params[] = {5.}; +UNUR_DISTR *marginal; +distr[2] = unur_distr_cvec_new(dim); +unur_distr_cvec_set_rankcorr(distr[2],rankcorr); +marginal = unur_distr_gamma(gamma_params,1); +unur_distr_cvec_set_marginals(distr[2],marginal); +unur_distr_free(marginal); +unur_distr_set_name(distr[2],"gamma marginals"); +#undef dim +} + +{ +#define dim (3) +double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; +double gamma_params[] = {5.}; +double beta_params[] = {3.,5.}; +distr[3] = unur_distr_cvec_new(dim); +unur_distr_cvec_set_rankcorr(distr[3],rankcorr); +unur_distr_cvec_set_marginal_list(distr[3], + unur_distr_gamma(gamma_params,1), + unur_distr_cauchy(NULL,0), + unur_distr_beta(beta_params,2) ); +unur_distr_set_name(distr[3],"gamma-cauchy-beta marginals"); +#undef dim +} + +{ +#define dim (3) +UNUR_DISTR *corr_distr; +UNUR_GEN *corr_gen; +double corr[dim*dim]; +corr_distr = unur_distr_correlation(dim); +corr_gen = unur_init(unur_mcorr_new(corr_distr)); +do { + unur_sample_matr(corr_gen,corr); + distr[4] = unur_distr_copula(dim, corr); +} while (distr[4]==NULL); +unur_distr_free(corr_distr); +unur_free(corr_gen); +unur_distr_set_name(distr[4],"copula with random correlations"); +#undef dim +} + +{ +#define dim (10) +UNUR_DISTR *corr_distr; +UNUR_GEN *corr_gen; +double corr[dim*dim]; +corr_distr = unur_distr_correlation(dim); +corr_gen = unur_init(unur_mcorr_new(corr_distr)); +do { + unur_sample_matr(corr_gen,corr); + distr[5] = unur_distr_copula(dim, corr); +} while (distr[5]==NULL); +unur_distr_free(corr_distr); +unur_free(corr_gen); +unur_distr_set_name(distr[5],"copula with random correlations"); +#undef dim +} + +{ +#define dim (30) +UNUR_DISTR *corr_distr; +UNUR_GEN *corr_gen; +double corr[dim*dim]; +corr_distr = unur_distr_correlation(dim); +corr_gen = unur_init(unur_mcorr_new(corr_distr)); +do { + unur_sample_matr(corr_gen,corr); + distr[6] = unur_distr_copula(dim, corr); +} while (distr[6]==NULL); +unur_distr_free(corr_distr); +unur_free(corr_gen); +unur_distr_set_name(distr[6],"copula with random correlations"); +#undef dim +} + +{ +#define dim (100) +UNUR_DISTR *corr_distr; +UNUR_GEN *corr_gen; +double corr[dim*dim]; +corr_distr = unur_distr_correlation(dim); +corr_gen = unur_init(unur_mcorr_new(corr_distr)); +do { + unur_sample_matr(corr_gen,corr); + distr[7] = unur_distr_copula(dim, corr); +} while (distr[7]==NULL); +unur_distr_free(corr_distr); +unur_free(corr_gen); +unur_distr_set_name(distr[7],"copula with random correlations"); +#undef dim +} + +{ +#define dim (3) +double ll[3] = {0.,1.,0.}; +double ru[3] = {1.,UNUR_INFINITY,UNUR_INFINITY}; +double rankcorr[] = { 1., 0., 0., 0., 1., 0., 0., 0., 1. }; +double gamma_params[] = {5.}; +UNUR_DISTR *marginal; +distr[8] = unur_distr_cvec_new(dim); +unur_distr_cvec_set_rankcorr(distr[8],rankcorr); +marginal = unur_distr_gamma(gamma_params,1); +unur_distr_cvec_set_marginals(distr[8],marginal); +unur_distr_cvec_set_domain_rect(distr[8],ll,ru); +unur_distr_free(marginal); +unur_distr_set_name(distr[8],"gamma marginals with rectangular domain"); +#undef dim +} + +{ +#define dim (3) +double ll[3] = {0.,1.,2.}; +double ru[3] = {1.,2., 3.}; +double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; +double gamma_params[] = {5.}; +UNUR_DISTR *marginal; +distr[9] = unur_distr_cvec_new(dim); +unur_distr_cvec_set_rankcorr(distr[9],rankcorr); +marginal = unur_distr_gamma(gamma_params,1); +unur_distr_cvec_set_marginals(distr[9],marginal); +unur_distr_cvec_set_domain_rect(distr[9],ll,ru); +unur_distr_free(marginal); +unur_distr_set_name(distr[9],"gamma marginals with rectangular domain"); +#undef dim +} + +{ +#define dim (3) +double ll[3] = {0.,1.,2.}; +double ru[3] = {1.,2., 3.}; +double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; +double gamma_params[] = {5.}; +distr[10] = unur_distr_cvec_new(dim); +unur_distr_cvec_set_rankcorr(distr[10],rankcorr); +unur_distr_cvec_set_marginal_list(distr[10], + unur_distr_gamma(gamma_params,1), + unur_distr_gamma(gamma_params,1), + unur_distr_gamma(gamma_params,1)); +unur_distr_cvec_set_domain_rect(distr[10],ll,ru); +unur_distr_set_name(distr[10],"gamma marginals with rectangular domain"); +#undef dim +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 11 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_norta_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_norta_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_norta_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_norta_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_norta_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_norta_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_norta_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_norta_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_norta_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_norta_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_norta_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_norta_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_norta.conf b/vendor/unuran-1.11.0/tests/t_norta.conf new file mode 100644 index 0000000..f37619b --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_norta.conf @@ -0,0 +1,423 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: NORTA + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + + +[new - data missing in distribution object: + double mean[] = {1.,2.}; + double covar[] = {2.,1., 1., 2.}; + distr = unur_distr_cvec_new(2); ] + +/* mean */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +/* covariance matrix */ +unur_distr_cvec_set_mean(distr,mean); +unur_distr_cvec_set_covar(distr,covar); +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + + +############################################################################# + +# [set] + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################# + +# [init] + +############################################################################# + +[reinit] + +[reinit - does not exist: + double x[3]; + const int dim = 3; + double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; + distr = unur_distr_copula(dim, rankcorr); + par = unur_norta_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_setfailed --> UNUR_ERR_NO_REINIT + +unur_sample_vec( gen, x ); +x[0]; + --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION + + +############################################################################# + +[sample] + +[sample - compare clone: + const int dim = 3; + UNUR_GEN *clone; + distr = unur_distr_copula(dim, NULL); + par = unur_norta_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* copula without correlation */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare clone: + const int dim = 3; + double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; + UNUR_GEN *clone; + distr = unur_distr_copula(dim, rankcorr); + par = unur_norta_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* copula with correlation */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare clone: + const int dim = 3; + double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; + double gamma_params[] = {5.}; + UNUR_GEN *clone; + UNUR_DISTR *marginal; + distr = unur_distr_cvec_new(dim); + unur_distr_cvec_set_rankcorr(distr,rankcorr); + marginal = unur_distr_gamma(gamma_params,1); + unur_distr_cvec_set_marginals(distr,marginal); + unur_distr_free(marginal); + par = unur_norta_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* gamma marginals with correlation */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare clone: + const int dim = 3; + double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; + double gamma_params[] = {5.}; + double beta_params[] = {3.,5.}; + UNUR_GEN *clone; + distr = unur_distr_cvec_new(dim); + unur_distr_cvec_set_rankcorr(distr,rankcorr); + unur_distr_cvec_set_marginal_list(distr, + unur_distr_cauchy(NULL,0), + unur_distr_gamma(gamma_params,1), + unur_distr_beta(beta_params,2) ); + par = unur_norta_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* multivariate distribution with given marginals */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare clone: + double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; + double gamma_params[] = {5.}; + double beta_params[] = {3.,5.}; + UNUR_GEN *clone; + UNUR_DISTR *marginals[3]; + distr = unur_distr_cvec_new(3); + unur_distr_cvec_set_rankcorr(distr,rankcorr); + marginals[0] = unur_distr_gamma(gamma_params,1); + marginals[1] = unur_distr_cauchy(NULL,0); + marginals[2] = unur_distr_beta(beta_params,2); + unur_distr_cvec_set_marginal_array(distr,marginals); + unur_distr_free(marginals[0]); + unur_distr_free(marginals[1]); + unur_distr_free(marginals[2]); + par = unur_norta_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* multivariate distribution with given marginals */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare clone 1dim: + const int dim = 1; + double beta_params[] = {3.,5.}; + UNUR_GEN *clone; + distr = unur_distr_cvec_new(dim); + unur_distr_cvec_set_rankcorr(distr,NULL); + unur_distr_cvec_set_marginal_list(distr, + unur_distr_beta(beta_params,2) ); + par = unur_norta_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* multivariate distribution with given marginals */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default program +par[0] = unur_norta_new(@distr@); + +[validate - distributions:] + +# copula without correlation +distr[0] = unur_distr_copula(3,NULL); + +# copula with correlation +double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; +distr[1] = unur_distr_copula(3, rankcorr); + +# gamma marginals +\#define dim (3) +double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; +double gamma_params[] = {5.}; +UNUR_DISTR *marginal; +distr[2] = unur_distr_cvec_new(dim); +unur_distr_cvec_set_rankcorr(distr[2],rankcorr); +marginal = unur_distr_gamma(gamma_params,1); +unur_distr_cvec_set_marginals(distr[2],marginal); +unur_distr_free(marginal); +unur_distr_set_name(distr[2],"gamma marginals"); +\#undef dim + + +# gamma-cauchy-beta marginals +\#define dim (3) +double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; +double gamma_params[] = {5.}; +double beta_params[] = {3.,5.}; +distr[3] = unur_distr_cvec_new(dim); +unur_distr_cvec_set_rankcorr(distr[3],rankcorr); +unur_distr_cvec_set_marginal_list(distr[3], + unur_distr_gamma(gamma_params,1), + unur_distr_cauchy(NULL,0), + unur_distr_beta(beta_params,2) ); +unur_distr_set_name(distr[3],"gamma-cauchy-beta marginals"); +\#undef dim + + +# copula with random correlations +\#define dim (3) +UNUR_DISTR *corr_distr; +UNUR_GEN *corr_gen; +double corr[dim*dim]; +corr_distr = unur_distr_correlation(dim); +corr_gen = unur_init(unur_mcorr_new(corr_distr)); +do { + unur_sample_matr(corr_gen,corr); + distr[4] = unur_distr_copula(dim, corr); +} while (distr[4]==NULL); +unur_distr_free(corr_distr); +unur_free(corr_gen); +unur_distr_set_name(distr[4],"copula with random correlations"); +\#undef dim + +# copula with random correlations +\#define dim (10) +UNUR_DISTR *corr_distr; +UNUR_GEN *corr_gen; +double corr[dim*dim]; +corr_distr = unur_distr_correlation(dim); +corr_gen = unur_init(unur_mcorr_new(corr_distr)); +do { + unur_sample_matr(corr_gen,corr); + distr[5] = unur_distr_copula(dim, corr); +} while (distr[5]==NULL); +unur_distr_free(corr_distr); +unur_free(corr_gen); +unur_distr_set_name(distr[5],"copula with random correlations"); +\#undef dim + +# copula with random correlations +\#define dim (30) +UNUR_DISTR *corr_distr; +UNUR_GEN *corr_gen; +double corr[dim*dim]; +corr_distr = unur_distr_correlation(dim); +corr_gen = unur_init(unur_mcorr_new(corr_distr)); +do { + unur_sample_matr(corr_gen,corr); + distr[6] = unur_distr_copula(dim, corr); +} while (distr[6]==NULL); +unur_distr_free(corr_distr); +unur_free(corr_gen); +unur_distr_set_name(distr[6],"copula with random correlations"); +\#undef dim + +# copula with random correlations +\#define dim (100) +UNUR_DISTR *corr_distr; +UNUR_GEN *corr_gen; +double corr[dim*dim]; +corr_distr = unur_distr_correlation(dim); +corr_gen = unur_init(unur_mcorr_new(corr_distr)); +do { + unur_sample_matr(corr_gen,corr); + distr[7] = unur_distr_copula(dim, corr); +} while (distr[7]==NULL); +unur_distr_free(corr_distr); +unur_free(corr_gen); +unur_distr_set_name(distr[7],"copula with random correlations"); +\#undef dim + +# gamma marginals with rectangular domain +\#define dim (3) +double ll[3] = {0.,1.,0.}; +double ru[3] = {1.,UNUR_INFINITY,UNUR_INFINITY}; +#double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; +double rankcorr[] = { 1., 0., 0., 0., 1., 0., 0., 0., 1. }; +double gamma_params[] = {5.}; +UNUR_DISTR *marginal; +distr[8] = unur_distr_cvec_new(dim); +unur_distr_cvec_set_rankcorr(distr[8],rankcorr); +marginal = unur_distr_gamma(gamma_params,1); +unur_distr_cvec_set_marginals(distr[8],marginal); +unur_distr_cvec_set_domain_rect(distr[8],ll,ru); +unur_distr_free(marginal); +unur_distr_set_name(distr[8],"gamma marginals with rectangular domain"); +\#undef dim + +# gamma marginals with rectangular domain +\#define dim (3) +double ll[3] = {0.,1.,2.}; +double ru[3] = {1.,2., 3.}; +double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; +double gamma_params[] = {5.}; +UNUR_DISTR *marginal; +distr[9] = unur_distr_cvec_new(dim); +unur_distr_cvec_set_rankcorr(distr[9],rankcorr); +marginal = unur_distr_gamma(gamma_params,1); +unur_distr_cvec_set_marginals(distr[9],marginal); +unur_distr_cvec_set_domain_rect(distr[9],ll,ru); +unur_distr_free(marginal); +unur_distr_set_name(distr[9],"gamma marginals with rectangular domain"); +\#undef dim + +# gamma marginals with rectangular domain +\#define dim (3) +double ll[3] = {0.,1.,2.}; +double ru[3] = {1.,2., 3.}; +double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; +double gamma_params[] = {5.}; +distr[10] = unur_distr_cvec_new(dim); +unur_distr_cvec_set_rankcorr(distr[10],rankcorr); +unur_distr_cvec_set_marginal_list(distr[10], + unur_distr_gamma(gamma_params,1), + unur_distr_gamma(gamma_params,1), + unur_distr_gamma(gamma_params,1)); +unur_distr_cvec_set_domain_rect(distr[10],ll,ru); +unur_distr_set_name(distr[10],"gamma marginals with rectangular domain"); +\#undef dim + +# number of distributions: 11 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default variant +# +#gen 0 # distribution +#--------------------------------------------- + <0> + # copula without correlations (dim=3) + <1> + # copula with correlations (dim=3) + <2> + # gamma marginals (dim=3) + <3> + # gamma-cauchy-beta marginals (dim=3) + <4> + # copula with random correlations (dim=3) + <5> + # copula with random correlations (dim=10) + <6> + # copula with random correlations (dim=30) + <7> + # copula with random correlations (dim=100) + <8> + # gamma marginals with rectangular domain + <9> + # gamma marginals with rectangular domain + <10> + # gamma marginals with rectangular domain + + +############################################################################# +############################################################################# + +[verbatim] + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_nrou.c b/vendor/unuran-1.11.0/tests/t_nrou.c new file mode 100644 index 0000000..cbe8ec1 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_nrou.c @@ -0,0 +1,6502 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for NROU + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); + + +int unur_nrou_set_pedantic( struct unur_par *par, int pedantic ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (100) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt */ +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ +double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x -= 1000.; + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* dummy function */ +int unur_nrou_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,36,(unur_nrou_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,36,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,42,(unur_nrou_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +/* pdf */ +n_tests_failed += (check_expected_NULL(TESTLOG,49,(unur_nrou_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,59,(unur_nrou_set_u(par,-1.,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,59,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,62,(unur_nrou_set_v(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,65,(unur_nrou_set_center(par,0.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_nrou_set_verify(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,77,(unur_nrou_set_u(par,-1.,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,77,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,80,(unur_nrou_set_v(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,80,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,83,(unur_nrou_set_center(par,0.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,83,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,86,(unur_nrou_set_verify(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,86,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_nrou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,96,(unur_nrou_set_u(par,-1.,-2.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,96,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,99,(unur_nrou_set_v(par,0.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,99,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 115, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,119,(unur_nrou_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,119,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,129,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,129,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_nrou_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 138, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,142,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; + + +unur_reset_errno(); +/* default algorithm */ +par = unur_nrou_new(distr); +unur_nrou_set_u(par,-0.56,0.56); +unur_nrou_set_v(par,0.64); +n_tests_failed += (compare_sequence_par_start(TESTLOG,156,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* default algorithm - verifying mode */ +par = unur_nrou_new(distr); +unur_nrou_set_u(par,-0.56,0.56); +unur_nrou_set_v(par,0.64); +unur_nrou_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,163,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* violate condition */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; + + +unur_reset_errno(); +/* v-value is too small */ +par = unur_nrou_new(distr); +unur_nrou_set_u(par,-0.56,0.56); +unur_nrou_set_v(par,0.1); + run_verify_generator (TESTLOG,175,par); +n_tests_failed += (check_errorcode(TESTLOG,175,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* u-value is too small */ +par = unur_nrou_new(distr); +unur_nrou_set_u(par,-0.2,0.56); +unur_nrou_set_v(par,0.64); + run_verify_generator (TESTLOG,181,par); +n_tests_failed += (check_errorcode(TESTLOG,181,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* u-value is too small */ +par = unur_nrou_new(distr); +unur_nrou_set_u(par,-0.56,0.26); +unur_nrou_set_v(par,0.64); + run_verify_generator (TESTLOG,187,par); +n_tests_failed += (check_errorcode(TESTLOG,187,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_nrou_new(distr); +unur_nrou_set_u(par,-0.56,0.56); +unur_nrou_set_v(par,0.64); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,202,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,208,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_nrou_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,220,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,224,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_normal(NULL,0); +par = unur_nrou_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,236,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal() & method = nrou" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,241,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_normal(NULL,0); +par = unur_nrou_new(distr); +unur_nrou_set_u(par,-0.6,0.6); +unur_nrou_set_v(par,1.); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,249,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal() & method = nrou; u=(-0.6,0.6); v=1" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,254,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[31]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 31 */ +{ +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); +} + +{ +distr[7] = unur_distr_cauchy(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); +} + +{ +distr[23] = unur_distr_exponential(NULL,0); +} + +{ +fpm[0] = 30.; +fpm[1] = -5.; +distr[24] = unur_distr_exponential(fpm,2); +} + +{ +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[16] = unur_distr_gamma(fpm,3); +} + +{ +fpm[0] = 1.; +fpm[1] = 4.; +distr[29] = unur_distr_gamma(fpm,2); +} + +{ +distr[25] = unur_distr_laplace(NULL,0); +} + +{ +fpm[0] = -10.; +fpm[1] = 100.; +distr[26] = unur_distr_laplace(fpm,2); +} + +{ +distr[17] = unur_distr_normal(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); +} + +{ +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); +} + +{ +distr[20] = unur_distr_uniform(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); +} + +{ +distr[27] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[27],pdf_sqrtlin); +unur_distr_cont_set_dpdf(distr[27],dpdf_sqrtlin); +unur_distr_cont_set_cdf(distr[27],cdf_sqrtlin); +unur_distr_set_name(distr[27],"sqrtlin"); +unur_distr_cont_set_mode(distr[27],0.); +unur_distr_cont_set_pdfarea(distr[27],2.); +} + +{ +distr[28] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[28],pdf_sqrtlinshft); +unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlinshft); +unur_distr_cont_set_cdf(distr[28],cdf_sqrtlinshft); +unur_distr_set_name(distr[28],"sqrtlin"); +unur_distr_cont_set_mode(distr[28],1000.); +unur_distr_cont_set_pdfarea(distr[28],2.); +} + +{ +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); +} + +{ +distr[30] = unur_distr_exponential(NULL,0); +unur_distr_cont_set_center(distr[30],2.); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 186 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [29] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_u(par,-0.6,0.6); +unur_nrou_set_v(par,1.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_u(par,-0.6,0.6); +unur_nrou_set_v(par,1.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_nrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_nrou_new(distr_localcopy); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 186 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [29] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_u(par,-0.6,0.6); +unur_nrou_set_v(par,1.); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_u(par,-0.6,0.6); +unur_nrou_set_v(par,1.); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 0.5); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_nrou_new(distr_localcopy); + unur_nrou_set_pedantic(par,0); +unur_nrou_set_r(par, 2.0 ); + gen = unur_init(par); + if (gen) unur_nrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + unur_distr_free(distr[30]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_nrou_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_nrou.conf b/vendor/unuran-1.11.0/tests/t_nrou.conf new file mode 100644 index 0000000..8c5b4f1 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_nrou.conf @@ -0,0 +1,595 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: NROU + +[main - header:] + +/* prototypes */ + +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); + + +int unur_nrou_set_pedantic( struct unur_par *par, int pedantic ); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (100) + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_cont_new(); ] + +/* pdf */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_u(par,-1.,1.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_v(par,1.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_center(par,0.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_verify(par,1); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameter object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); ] + +~_u(par,-1.,1.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_v(par,1.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_center(par,0.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_verify(par,1); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + +[set - invalid parameters: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_nrou_new(distr); ] + +~_u(par,-1.,-2.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_v(par,0.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + +############################################################################# + +# [get] + +############################################################################# + +[chg] + +[chg - invalid generator object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_verify(gen,1); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + + +############################################################################# + +[reinit] + +[reinit - exist: + distr = unur_distr_normal(NULL,0); + par = unur_nrou_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - compare: + distr = unur_distr_normal(NULL,0); + par = NULL; ] + +/* default algorithm */ +par = unur_nrou_new(distr); +unur_nrou_set_u(par,-0.56,0.56); +unur_nrou_set_v(par,0.64); + -->compare_sequence_par_start + +/* default algorithm - verifying mode */ +par = unur_nrou_new(distr); +unur_nrou_set_u(par,-0.56,0.56); +unur_nrou_set_v(par,0.64); +unur_nrou_set_verify(par,1); + -->compare_sequence_par + +#..................................................................... + +[sample - violate condition: + distr = unur_distr_normal(NULL,0); + par = NULL; ] + +/* v-value is too small */ +par = unur_nrou_new(distr); +unur_nrou_set_u(par,-0.56,0.56); +unur_nrou_set_v(par,0.1); + --> run_verify_generator --> UNUR_ERR_GEN_CONDITION + +/* u-value is too small */ +par = unur_nrou_new(distr); +unur_nrou_set_u(par,-0.2,0.56); +unur_nrou_set_v(par,0.64); + --> run_verify_generator --> UNUR_ERR_GEN_CONDITION + +/* u-value is too small */ +par = unur_nrou_new(distr); +unur_nrou_set_u(par,-0.56,0.26); +unur_nrou_set_v(par,0.64); + --> run_verify_generator --> UNUR_ERR_GEN_CONDITION + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_nrou_new(distr); +unur_nrou_set_u(par,-0.56,0.56); +unur_nrou_set_v(par,0.64); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare reinit: + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_nrou_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_normal(NULL,0); +par = unur_nrou_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal() & method = nrou" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +distr = unur_distr_normal(NULL,0); +par = unur_nrou_new(distr); +unur_nrou_set_u(par,-0.6,0.6); +unur_nrou_set_v(par,1.); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal() & method = nrou; u=(-0.6,0.6); v=1" ); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default variant +par[0] = unur_nrou_new(@distr@); + +# use bounding rectangle +par[1] = unur_nrou_new(@distr@); +unur_nrou_set_u(par,-0.6,0.6); +unur_nrou_set_v(par,1.); + +# r-parameter = 0.5 +par[2] = unur_nrou_new(@distr@); +unur_nrou_set_r(par, 0.5); + +# r-parameter = 2.0 +par[3] = unur_nrou_new(@distr@); +unur_nrou_set_r(par, 2.0 ); + +# default variant but reinitialized with changed domain +{ UNUR_DISTR *dg =NULL; +par[4] = unur_nrou_new(@distr@); +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.1,0.99); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + +# default variant but reinitialized with changed pdf parameters +{ UNUR_DISTR *dg =NULL; +par[5] = unur_nrou_new(@distr@); +fpm[0] = 1.; +fpm[1] = 4.; +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + +[validate - distributions:] + +# Beta distributions +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); + +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); + +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); + +# Cauchy distributions +distr[7] = unur_distr_cauchy(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); + +# Exponential distributions +distr[23] = unur_distr_exponential(NULL,0); + +fpm[0] = 30.; +fpm[1] = -5.; +distr[24] = unur_distr_exponential(fpm,2); + +# Gamma distributions +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); + +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); + +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); + +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); + +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); + +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[16] = unur_distr_gamma(fpm,3); + +fpm[0] = 1.; +fpm[1] = 4.; +distr[29] = unur_distr_gamma(fpm,2); + +# Laplace distributions +distr[25] = unur_distr_laplace(NULL,0); + +fpm[0] = -10.; +fpm[1] = 100.; +distr[26] = unur_distr_laplace(fpm,2); + +# Normal distributions +distr[17] = unur_distr_normal(NULL,0); + +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); + +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); + +# Uniform distributions +distr[20] = unur_distr_uniform(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); + +# pdf with piecewise linear function as transformed density with T = -1/sqrt +distr[27] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[27],pdf_sqrtlin); +unur_distr_cont_set_dpdf(distr[27],dpdf_sqrtlin); +unur_distr_cont_set_cdf(distr[27],cdf_sqrtlin); +unur_distr_set_name(distr[27],"sqrtlin"); +unur_distr_cont_set_mode(distr[27],0.); +unur_distr_cont_set_pdfarea(distr[27],2.); + +# pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode +distr[28] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[28],pdf_sqrtlinshft); +unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlinshft); +unur_distr_cont_set_cdf(distr[28],cdf_sqrtlinshft); +unur_distr_set_name(distr[28],"sqrtlin"); +unur_distr_cont_set_mode(distr[28],1000.); +unur_distr_cont_set_pdfarea(distr[28],2.); + +# truncated distributions +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); + +# distribution with center +distr[30] = unur_distr_exponential(NULL,0); +unur_distr_cont_set_center(distr[30],2.); + +# number of distributions: 31 + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default variant +# [1] ... use rectangle +# [2] ... r=0.5 +# [3] ... r=2.0 +# [4] ... default variant but reinitialized with changed domain +# [5] ... default variant but reinitialized with changed pdf parameters +# +# 0 1 2 3 4 5 # distribution +#--------------------------------------------------------------------- + <0> + . + + + + # beta (1, 2) + <1> + . + + + + # beta (1, 5) + <2> + . + + + + # beta (1, 100) + <3> + . + + + + # beta (3, 4) + <4> + . + + + + # beta (5, 100) +x <5> + . + + + + # beta (500, 300) + <6> + . + + + + # beta (5, 10, -3, 15) + <23> + . + + + + # exponential () + <24> + . + + + + # exponential (30, -5) + <7> + . . + + + # cauchy () + <8> + . . + + + # cauchy (1, 20) + <9> + . + + + + # gamma (1) + <10> + . + + + + # gamma (2) + <11> + . + + + + # gamma (3) + <12> + . + + + + # gamma (10) +x<13> + . + + . + # gamma (1000) + <29> + . + + + + # gamma (1, 4) + <14> + . + + . + # gamma (5, 1000, 0) +x<15> + . + + . + # gamma (5, 1e-05, 0) +x<16> + . + + . + # gamma (5, 10, 100000) + <25> + . + + + + # laplace () + <26> + - + + . + # laplace (-10, 100) + <17> + + + + + + # normal () +x<18> + . + + . + # normal (1, 1e-05) + <19> + . + + + + # normal (1, 1e+05) + <20> + . + + + + # uniform () + <21> + . + + . + # uniform (1, 20) + <22> + . + + . . # cauchy () - truncated + <27> + . . + . . # pdf with piecewise linear function as transformed density with T = -1/sqrt + <28> + . . + . . # [27] with shifted mode + <30> + . + + . . # standard exponential distribution with center at 2 + +# number of distributions: 31 + + +[validate - verify hat:] + +# + ... pass test +# ~ ... fail in at most 1% of samples +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default variant +# [1] ... use rectangle +# [2] ... r=0.5 +# [3] ... r=2.0 +# [4] ... default variant but reinitialized with changed domain +# [5] ... default variant but reinitialized with changed pdf parameters +# +# 0 1 2 3 4 5 # distribution +#--------------------------------------------------------------------- + <0> + . + + + + # beta (1, 2) + <1> + . + + + + # beta (1, 5) + <2> + . + + + + # beta (1, 100) + <3> + . + + + + # beta (3, 4) + <4> + . + + + + # beta (5, 100) +x <5> + . + + + + # beta (500, 300) + <6> + . + + + + # beta (5, 10, -3, 15) + <23> + . + + + + # exponential () + <24> + . + + + + # exponential (30, -5) + <7> + . . + + + # cauchy () + <8> + . . + + + # cauchy (1, 20) + <9> + . + + + + # gamma (1) + <10> + . + + + + # gamma (2) + <11> + . + + + + # gamma (3) + <12> + . + + + + # gamma (10) +x<13> + . + + . + # gamma (1000) + <29> + . + + + + # gamma (1, 4) + <14> + . + + . + # gamma (5, 1000, 0) +x<15> + . + + . + # gamma (5, 1e-05, 0) +x<16> + . + + . + # gamma (5, 10, 100000) + <25> + . + + + + # laplace () + <26> + - + + . + # laplace (-10, 100) + <17> + + + + + + # normal () +x<18> + . + + . + # normal (1, 1e-05) + <19> + . + + + + # normal (1, 1e+05) + <20> + . + + + + # uniform () + <21> + . + + . + # uniform (1, 20) + <22> + . + + . . # cauchy () - truncated + <27> + . . + . . # pdf with piecewise linear function as transformed density with T = -1/sqrt + <28> + . . + . . # [27] with shifted mode + <30> + . + + . . # standard exponential distribution with center at 2 + +# number of distributions: 31 + + +############################################################################# +############################################################################# + +[verbatim] + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt */ +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ +double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x -= 1000.; + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* dummy function */ +int unur_nrou_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_pinv.c b/vendor/unuran-1.11.0/tests/t_pinv.c new file mode 100644 index 0000000..790799a --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_pinv.c @@ -0,0 +1,1911 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for PINV + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_pinv_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* header files */ +#include + +/* -- which tests for u-error should be performed (for development) -- */ + +#define DEVEL FALSE /* whether to run tests in development mode */ +#define ALL TRUE + +/* Remark: + Setting ALL to FALSE is useful if a only a single validation test + should be run. Thus the "if(ALL)" condition for that particular test + has to be replaced by "if(TRUE)". +*/ + +#define UERROR_STANDARDDIST TRUE +#define UERROR_QUASIPDF TRUE +#define UERROR_VANISHINGPDF TRUE +#define UERROR_TRUNCATED TRUE +#define UERROR_UNBOUNDEDPDF TRUE +#define UERROR_MULTIMODAL TRUE +#define UERROR_MULTIMODAL_VANISHINGPDF TRUE + +/* orders */ +static int UERROR_ORDER_MIN = 3; +static int UERROR_ORDER_MAX = 17; +static int UERROR_ORDER_STEP = 1; + +/* smoothness */ +static int SMOOTHNESS_MAX = 2; + +/* u-resolutions */ +static double UERROR_URESOLUTION_MAX = 1.e-8; +static double UERROR_URESOLUTION_MIN = 0.99e-13; +static double UERROR_URESOLUTION_STEP = 0.1; + +/* we run all tests only in 'fullcheck' mode */ +#define set_uerror_tests() \ + if (!fullcheck) { \ + /* UERROR_ORDER_STEP = 3; */ \ + UERROR_URESOLUTION_MAX = 1.e-8; \ + UERROR_URESOLUTION_MIN = 0.99e-12; \ + UERROR_URESOLUTION_STEP = 0.01; \ + } +/* see also SKIPORDER in routine pinv_error_experiment() below */ + +/* sample size */ +static const int UERROR_SAMPLESIZE = 100000; + + +/* -- constants -- */ + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + +/* #define SEED (298346) */ + +#ifndef M_PI +#define M_PI 3.14159265358979323846264338328 /* pi */ +#endif + + +/* -- macros -- */ + +#define set_debug_flag(par) \ + do { \ + if (fullcheck) unur_set_debug((par),~0u); \ + else unur_set_debug((par),0x00010000u); \ + } while (0); + + +/* -- prototypes -- */ + +int pinv_error_experiment( UNUR_PAR *par, int samplesize, int UERROR_PDF, int UERROR_CDF); +int pinv_error_gen_experiment( UNUR_GEN *gen, + double u_resolution, int order, int samplesize ); + +double neg_exponential_cdf( double x, const UNUR_DISTR *distr ); +double neg_exponential_pdf( double x, const UNUR_DISTR *distr ); + +double neg_exponential_1_cdf( double x, const UNUR_DISTR *distr ); +double neg_exponential_1_pdf( double x, const UNUR_DISTR *distr ); + +double sin_2_cdf( double x, const UNUR_DISTR *distr ); +double sin_2_pdf( double x, const UNUR_DISTR *distr ); + +double sin_10_cdf( double x, const UNUR_DISTR *distr ); +double sin_10_pdf( double x, const UNUR_DISTR *distr ); + + + + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + + + +/*****************************************************************************/ +/* run unur_test_u_error for a particular generator object and print result */ + +int +pinv_error_gen_experiment( UNUR_GEN *gen, /* generator object */ + double u_resolution, /* maximal tolerated u-error */ + int order, /* order of polynomial */ + int samplesize ) /* sample size for error experiment */ + /* returns 0 if maxerror < u_resolution, errorcode otherwise */ +{ + int i, nfpar; + const double *fpar; + const UNUR_DISTR *distr; + const char *genid; + int score; + + /* check for invalid NULL pointer */ + if (gen==NULL) { + fprintf(TESTLOG,"\n--setup failed !! --\n"); + printf("(!!+)"); fflush(stdout); + return 100; + } + + /* get data about generator object */ + distr = unur_get_distr(gen); + genid = unur_get_genid(gen); + + /* print data about distribution */ + fprintf(TESTLOG,"%s: %s distribution",genid,unur_distr_get_name(distr)); + nfpar = unur_distr_cont_get_pdfparams(distr,&fpar); + if (nfpar) { + fprintf(TESTLOG," with parameters "); + for(i=0;i 0) { + fprintf(TESTLOG,"\t#PDF calls = %d\t(per interval = %d)", + get_counter_pdf(), + ( (unur_pinv_get_n_intervals(gen)!=0) ? + get_counter_pdf() / unur_pinv_get_n_intervals(gen) : -1 ) ); + } + if (get_counter_logpdf() > 0) { + fprintf(TESTLOG,"\t#logPDF calls = %d\t(per interval = %d)", + get_counter_logpdf(), + ( (unur_pinv_get_n_intervals(gen)!=0) ? + get_counter_logpdf() / unur_pinv_get_n_intervals(gen) : -1 ) ); + } + if (get_counter_cdf() > 0) { + fprintf(TESTLOG,"\t#CDF calls = %d\t(per interval = %d)", + get_counter_cdf(), + ( (unur_pinv_get_n_intervals(gen)!=0) ? + get_counter_cdf() / unur_pinv_get_n_intervals(gen) : -1 ) ); + } + fprintf(TESTLOG,"\n"); + + /* run test */ + score = run_validate_u_error( TESTLOG, gen, distr, u_resolution, samplesize ); + + /* return score */ + fprintf(TESTLOG,"\n"); fflush(TESTLOG); + return score; + +} /* end of pinv_error_gen_experiment() */ + +/*****************************************************************************/ +/* run experiment for a particular distribution object */ + +int +pinv_error_experiment( UNUR_PAR *par, /* parameter object */ + int samplesize, /* samplesize for error experiment */ + int UERROR_PDF, /* if TRUE, check variant usePDF */ + int UERROR_CDF) /* if TRUE, check variant useCDF */ + /* returns 0 if maxerror < u_resolution, errorcode otherwise */ +{ + UNUR_PAR *par_clone; /* working copy of parameter object */ + UNUR_GEN *gen; /* generator object */ + + int order = 3; + int smooth = 0; + double u_resolution = 1.e-8; /* maximal tolerated u-error */ + int errorsum = 0; + + int variant; + + /* check for invalid NULL pointer */ + if (par==NULL) { + printf(" NULL! "); + return 1000; + } + + /* -- loop smoothness -- */ + for (smooth=0; smooth <= SMOOTHNESS_MAX; smooth++) { + + /* -- loop variante -- */ + for (variant=0; variant <= 1; ++variant) { + /* variant==0 --> use PDF */ + /* variant==1 --> use CDF */ + + switch (variant) { + + case 0: /* run variant PDF+Lobatto */ + if (UERROR_PDF) printf("",smooth); + else continue; + break; + + case 1: /* run variant CDF */ + if (UERROR_CDF) printf("",smooth); + else continue; + break; + + default: + continue; + } + + /* -- loop order -- */ + for ( order=UERROR_ORDER_MIN; order<=UERROR_ORDER_MAX; order+=UERROR_ORDER_STEP) { + + /* prevent warning from invalid order */ + if (smooth==1 && order % 2 != 1) continue; + if (smooth==2 && order % 3 != 2) continue; + + /* SKIPORDER: + * when we do not run in fullcheck mode, we skip some orders. */ + if (!fullcheck) { + switch (smooth) { + case 0: + if (! (order==3 || order==5 || order==8 || order==12 || order==17) ) + continue; + break; + case 1: + if (order==7 || order==11 || order==15) + continue; + break; + case 2: + if (order == 14) + continue; + break; + } + } + + /* -- loop u-resolution -- */ + for ( u_resolution = UERROR_URESOLUTION_MAX; + u_resolution > UERROR_URESOLUTION_MIN; u_resolution *= UERROR_URESOLUTION_STEP ) { + + if (!fullcheck) { + if (smooth==2 && u_resolution < 0.99e-10) + /* setup fails for some truncated distributions. */ + /* so we skip it when not run in fullcheck mode. */ + continue; + } + + /* make a working copy */ + par_clone = _unur_par_clone(par); + + /* set variant */ + switch (variant) { + case 0: unur_pinv_set_usepdf(par_clone); break; + case 1: unur_pinv_set_usecdf(par_clone); break; + } + + /* maximum number of subintervals */ + /**/ if (order <= 3 && u_resolution < 1.e-12) { + unur_pinv_set_max_intervals(par_clone,100000); + } else if (u_resolution < 1.e13) { + unur_pinv_set_max_intervals(par_clone,100000); + } + + /* start counter for PDF calls */ + start_counter_fcalls(par_clone); + + /* create generator object */ + unur_pinv_set_order(par_clone,order); + unur_pinv_set_smoothness(par_clone,smooth); + unur_pinv_set_u_resolution(par_clone,u_resolution); + set_debug_flag(par_clone); + gen = unur_init(par_clone); + + /* run test */ + errorsum += pinv_error_gen_experiment(gen, u_resolution, order, samplesize); + + /* clear memory */ + unur_free(gen); + stop_counter_fcalls(); + + } /* -- end loop u-resolution -- */ + + } /* -- end end loop order -- */ + + } /* -- end loop variant */ + + } /* -- end loop smoothness -- */ + + unur_par_free(par); + + return errorsum; +} /* end of pinv_error_experiment() */ + +/*****************************************************************************/ + + +/*---------------------------------------------------------------------------*/ +/* "negative" exponential distribution */ +/* */ +/* / exp(x) if x <= 0 */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ +double neg_exponential_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x>0.) + return 0.; + else + return (exp(x)); +} + +double neg_exponential_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x>0.) + return 1.; + else + return (exp(x)); +} + +/*---------------------------------------------------------------------------*/ +/* "shifted negative" exponential distribution */ +/* */ +/* / exp(x-s) if x <= s */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ + +#define shift (-1.) + +double neg_exponential_1_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x = x-shift; + + if (x>0.) + return 0.; + else + return (exp(x)); +} + +double neg_exponential_1_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x = x-shift; + + if (x>=0.) + return 1.; + else + return (exp(x)); +} + +#undef shift + + +/*---------------------------------------------------------------------------*/ +/* */ +/* / 0.05 + 0.45*(1 +sin(2 Pi x)) if |x| <= 1 */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ +double sin_2_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (fabs(x) > 1.) + return 0.; + else + return (0.05 + 0.45*(1.+sin(2.*M_PI*x))); +} /* end of sin_pdf() */ + +/* The CDF of our distribution: */ +double sin_2_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x < -1.) + return 0.; + else if(x<=1.) + return (0.05*(x+1) + 0.9*(1.+2.*M_PI*(1+x)-cos((2.*M_PI)*x))/(4.*M_PI)); + else return 1.; +} /* end of sin_cdf() */ + + +/*---------------------------------------------------------------------------*/ +/* */ +/* / 0.05 + 0.45*(1 +sin(2 Pi x)) if |x| <= 5 */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ +double sin_10_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (fabs(x) > 5.) + return 0.; + else + return (0.05 + 0.45*(1.+sin(2.*M_PI*x))); +} /* end of sin_pdf() */ + +/* The CDF of our distribution: */ +double sin_10_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x < -5.) + return 0.; + else if(x<=5.) + return ((x/10.+0.5) + 0.09/(2*M_PI)*(cos(10*M_PI)-cos(2*M_PI*x))); + else return 1.; +} /* end of sin_cdf() */ + +/*---------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,111,(unur_pinv_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,111,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,117,(unur_pinv_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,117,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +/* pdf */ +n_tests_failed += (check_expected_NULL(TESTLOG,124,(unur_pinv_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,124,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + /* double stp[] = {1.,2.,3.}; */ + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,135,(unur_pinv_set_order( par, 3 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,135,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,138,(unur_pinv_set_smoothness( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,138,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,141,(unur_pinv_set_u_resolution( par, 1.e-8 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,141,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,144,(unur_pinv_set_use_upoints( par, TRUE )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,144,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,147,(unur_pinv_set_usepdf( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,147,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,150,(unur_pinv_set_usecdf( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,150,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,153,(unur_pinv_set_boundary(par,1.,3.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,153,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,156,(unur_pinv_set_searchboundary(par, TRUE, TRUE )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,156,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,159,(unur_pinv_set_max_intervals(par,1000)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,159,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,162,(unur_pinv_set_extra_testpoints(par,10)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,162,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,165,(unur_pinv_set_keepcdf(par,TRUE)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,165,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + /* double stp[] = {1.,2.,3.}; */ + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,174,(unur_pinv_set_order( par, 3 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,174,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,177,(unur_pinv_set_smoothness( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,177,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,180,(unur_pinv_set_u_resolution( par, 1.e-8 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,180,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,183,(unur_pinv_set_use_upoints( par, TRUE )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,183,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,186,(unur_pinv_set_usepdf( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,186,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,189,(unur_pinv_set_usecdf( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,189,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,192,(unur_pinv_set_boundary(par,1.,3.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,192,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,195,(unur_pinv_set_searchboundary(par, TRUE, TRUE )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,195,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,198,(unur_pinv_set_max_intervals(par,1000)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,198,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,201,(unur_pinv_set_extra_testpoints(par,10)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,201,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,204,(unur_pinv_set_keepcdf(par,TRUE)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,204,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_pinv_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,214,(unur_pinv_set_order( par, 30 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,214,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,217,(unur_pinv_set_order( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,217,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,220,(unur_pinv_set_smoothness( par, 4 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,220,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,223,(unur_pinv_set_boundary(par,1.,-3.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,223,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,226,(unur_pinv_set_boundary(par,1.,UNUR_INFINITY)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,226,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,229,(unur_pinv_set_max_intervals(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,229,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,232,(unur_pinv_set_max_intervals(par,10000000)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,232,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,235,(unur_pinv_set_extra_testpoints(par,-1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,235,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; + UNUR_PAR *par; + UNUR_GEN *gen; + distr = unur_distr_normal(NULL,0); + + +unur_reset_errno(); +par = unur_pinv_new(distr); +unur_pinv_set_order( par, 4 ); +unur_pinv_set_smoothness( par, 1 ); +gen = unur_init(par); +n_tests_failed += (check_errorcode(TESTLOG,249,UNUR_ERR_GENERIC)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); +par = unur_pinv_new(distr); +unur_pinv_set_order( par, 4 ); +unur_pinv_set_smoothness( par, 2 ); +gen = unur_init(par); +n_tests_failed += (check_errorcode(TESTLOG,256,UNUR_ERR_GENERIC)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); +par = unur_pinv_new(distr); +unur_pinv_set_order( par, 6 ); +unur_pinv_set_smoothness( par, 2 ); +gen = unur_init(par); +n_tests_failed += (check_errorcode(TESTLOG,263,UNUR_ERR_GENERIC)==UNUR_SUCCESS)?0:1; +unur_free(gen); +unur_distr_free(distr); +} + +{ /* missing CDF */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr, neg_exponential_pdf); + par = unur_pinv_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,274,(unur_pinv_set_usecdf( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,274,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* missing PDF */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_cdf(distr, neg_exponential_cdf); + par = unur_pinv_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,285,(unur_pinv_set_usepdf( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,285,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* missing PDF */ +UNUR_DISTR *distr = NULL; + UNUR_PAR *par; + UNUR_GEN *gen; + distr = unur_distr_cont_new(); + unur_distr_cont_set_cdf(distr, neg_exponential_cdf); + + +unur_reset_errno(); +par = unur_pinv_new(distr); +unur_pinv_set_usecdf( par ); +unur_pinv_set_smoothness( par, 1 ); +gen = unur_init(par); +n_tests_failed += (check_errorcode(TESTLOG,300,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); +par = unur_pinv_new(distr); +unur_pinv_set_usecdf( par ); +unur_pinv_set_smoothness( par, 2 ); +gen = unur_init(par); +n_tests_failed += (check_errorcode(TESTLOG,307,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); +unur_distr_cont_set_pdf(distr, neg_exponential_pdf); +par = unur_pinv_new(distr); +unur_pinv_set_usecdf( par ); +unur_pinv_set_smoothness( par, 2 ); +gen = unur_init(par); +n_tests_failed += (check_errorcode(TESTLOG,315,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_free(gen); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_srou_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 326, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,330,(unur_pinv_get_n_intervals(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,330,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,361,(unur_pinv_eval_approxinvcdf(gen,0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,361,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_srou_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 367, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,371,(unur_pinv_eval_approxinvcdf(gen,0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,371,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid domain */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_pinv_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 377, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,381,(unur_pinv_eval_approxinvcdf(gen,1.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,381,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_negINFINITY(TESTLOG,384,(unur_pinv_eval_approxinvcdf(gen,-0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,384,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* cdf table removed */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_pinv_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 391, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,395,(unur_pinv_eval_approxcdf(gen,1.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,395,UNUR_ERR_GENERIC)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* check approximate cdf */ +UNUR_GEN *gen = NULL; + int i, cdffailed=0; + double x,u,d; + gen = unur_str2gen("cont;logpdf='5-x';domain=(0,infinity)&method=pinv;keepcdf=on;debug=0"); + + +unur_reset_errno(); +for (i=1; i<1000; i++) { + x = 5.*i/1000.; + u = unur_pinv_eval_approxcdf(gen,x); + d = fabs(u - (1-exp(-x))); + if (d > 1.e-11) { cdffailed = 1; }} +n_tests_failed += (check_expected_zero(TESTLOG,410,(cdffailed))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,410,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_pinv_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,423,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,429,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[] = {3.,4.}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_gamma(fpar,2); +unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); +par = unur_pinv_new(distr); +set_debug_flag(par); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,461,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,4.); domain = (2,infinity) & \ + method = pinv; debug = 0x1" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,467,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_normal(NULL,0); +unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); +par = unur_pinv_new(distr); +unur_pinv_set_order(par,10); +unur_pinv_set_u_resolution(par,1.e-6); +unur_pinv_set_boundary(par,1.,1000.); +unur_pinv_set_max_intervals(par,1000); +set_debug_flag(par); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,480,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal; domain = (2,inf) & \ + method = pinv; order = 10; u_resolution = 1.e-6; \ + boundary = (1,1000); max_intervals = 1000; debug = 0x1" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,487,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[6]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 6 */ +{ +distr[0] = unur_distr_normal(NULL,0); +} + +{ +distr[1] = unur_distr_multPDF( distr[0], 100. ); +} + +{ +distr[2] = unur_str2distr( "cont; pdf='x/(1+x*x*x*x)'; center=1" ); +} + +{ +distr[3] = unur_str2distr( "cont; pdf='-x/(1+x*x*x*x)'; center=-1" ); +} + +{ +distr[4] = unur_str2distr( "cont; pdf='cos(2*x)'; cdf='(1+sin(2*x))/2'; center=0; domain=(-0.7853981633974482, 0.7853981633974482)" ); +} + +{ +distr[5] = unur_str2distr( "cont; pdf='1-x^2+1e-16'; cdf='( 2-(x^2-3)*x) / 4'; center=0; domain=(-1, 1)" ); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 6 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_pinv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_pinv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_pinv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_pinv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_pinv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_pinv_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + +/*---------------------------------------------------------------------------*/ +/* [special] */ + +void test_special (void) +{ + /* set boolean to FALSE */ + int FAILED = 0; + + + + + + int samplesize = UERROR_SAMPLESIZE; + int errorsum = 0; + double fpar[4]; + + UNUR_DISTR *distr, *qdistr; + UNUR_PAR *par; + +/* start test */ +printf("[special "); fflush(stdout); +fprintf(TESTLOG,"\n[special]\n"); + +/* set stop watch */ +stopwatch_lap(&watch); + + + + /* set u-error tests */ + set_uerror_tests(); + + /* test for maximal u-error */ + printf("\n[test maximal u-error]"); + fprintf(TESTLOG,"\n* Test maximal u-error *\n"); + +if (UERROR_STANDARDDIST) { /* --------------------------- */ + + printf("\nStandard distributions:\n"); + fprintf(TESTLOG,"\n--- Standard distributions --- \n\n"); + + +if (ALL) { + printf(" normal"); + distr = unur_distr_normal(NULL,0); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + +if (ALL) { + printf(" cauchy"); + distr = unur_distr_cauchy(NULL,0); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + +if (ALL) { + printf(" exponential"); + distr = unur_distr_exponential(NULL,0); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + +if (ALL) { + printf(" gamma(0.9)"); + fpar[0] = 0.9; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + +if (ALL) { + printf(" gamma(1.02)"); + fpar[0] = 1.02; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + +if (ALL) { + printf(" gamma(1.5)"); + fpar[0] = 1.5; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + +if (ALL) { + printf(" gamma(2)"); + fpar[0] = 2.; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + par = unur_pinv_new(distr); + unur_pinv_set_boundary(par,0., 1.e100); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + +if (ALL) { + printf(" gamma(5)"); + fpar[0] = 5.; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + par = unur_pinv_new(distr); + unur_pinv_set_boundary(par,0., 1.e100); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + +if (ALL) { + printf(" beta(2,3)"); + fpar[0] = 2; + fpar[1] = 3; + distr = unur_distr_beta(fpar,2); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + +if (ALL) { + printf(" Gumbel"); + distr = unur_distr_extremeI(NULL,0); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + +if (ALL) { + printf(" shifted normal"); + fpar[0] = 200.; + fpar[1] = 1.; + distr = unur_distr_normal(fpar,2); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); + + printf(" shifted normal"); + fpar[0] = -200; + fpar[1] = 1.; + distr = unur_distr_normal(fpar,2); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + +if (0) { + printf(" lognormal(2,0.5)"); + fpar[0] = 2.; + fpar[1] = 0.5; + distr = unur_distr_lognormal(fpar,2); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); + + printf(" lognormal(2.0.5,4.)"); + fpar[0] = 2.; + fpar[1] = 0.5; + fpar[2] = 4.; + distr = unur_distr_lognormal(fpar,3); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +} /* endif (UERROR_STANDARDDIST) */ +if (UERROR_QUASIPDF) { /* --------------------------- */ + + printf("\nDistributions with quasi-densities:\n"); + fprintf(TESTLOG,"\n--- Distributions with quasi-densities --- \n\n"); + +if (ALL) { + distr = unur_distr_normal(NULL,0); + + printf(" (normal*1e10)"); + qdistr = unur_distr_multPDF( distr, 1.e10 ); + par = unur_pinv_new(qdistr); + errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); + unur_distr_free(qdistr); + fprintf(TESTLOG,"\n"); + + printf(" (normal*1e-10)"); + qdistr = unur_distr_multPDF( distr, 1.e-10 ); + par = unur_pinv_new(qdistr); + errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); + unur_distr_free(qdistr); + fprintf(TESTLOG,"\n"); + + unur_distr_free(distr); +} + +} /* endif (UERROR_QUASIPDF) */ +if (UERROR_VANISHINGPDF) { /* --------------------------- */ + + printf("\nDistributions with vanishing PDF:\n"); + fprintf(TESTLOG,"\n--- Distributions with vanishing PDF --- \n\n"); + + +if (ALL) { + printf(" (exponential_on_(-oo,oo))"); + distr = unur_distr_exponential(NULL,0); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + unur_distr_set_name(distr,"exponential_(-oo,oo)"); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +if (ALL) { + printf(" (exponential(1,1)_on_(-oo,oo))"); + fpar[0] = 1.; + fpar[1] = 1.; + distr = unur_distr_exponential(fpar,2); + unur_distr_cont_set_center(distr,2.); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + unur_distr_set_name(distr,"exponential(1,1)_(-oo,oo)"); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +if (ALL) { + printf(" (exponential(1,1)_on_(-oo,oo))"); + fpar[0] = 1.; + fpar[1] = 1.; + distr = unur_distr_exponential(fpar,2); + unur_distr_cont_set_center(distr,2.); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + unur_distr_cont_set_center(distr,2.); + unur_distr_set_name(distr,"exponential(1,1)_(-oo,oo)"); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +if (ALL) { + printf(" (exponential(1,-1)_on_(-oo,oo))"); + fpar[0] = 1.; + fpar[1] = -1.; + distr = unur_distr_exponential(fpar,2); + unur_distr_cont_set_center(distr,2.); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + unur_distr_set_name(distr,"exponential(1,-1)_(-oo,oo)"); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +if (ALL) { + printf(" (exponential(0.1,0.1)_on_(-oo,oo))"); + fpar[0] = 0.1; + fpar[1] = 0.1; + distr = unur_distr_exponential(fpar,2); + unur_distr_cont_set_center(distr,2.); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + unur_distr_set_name(distr,"exponential(0.1,0.1)_(-oo,oo)"); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +if (ALL) { + printf(" (exponential(1000,1000)_on_(-oo,oo))"); + fpar[0] = 1000; + fpar[1] = 1000; + distr = unur_distr_exponential(fpar,2); + unur_distr_cont_set_center(distr,1000.); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + unur_distr_set_name(distr,"exponential(1000,1000)_(-oo,oo)"); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + +if (ALL) { + printf(" neg_exponential"); + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"neg_exponential"); + unur_distr_cont_set_cdf( distr, neg_exponential_cdf ); + unur_distr_cont_set_pdf( distr, neg_exponential_pdf ); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +if (ALL) { + printf(" neg_exponential_1"); + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"neg_exponential_1"); + unur_distr_cont_set_cdf( distr, neg_exponential_1_cdf ); + unur_distr_cont_set_pdf( distr, neg_exponential_1_pdf ); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + unur_distr_cont_set_center(distr,-2.); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + +if (ALL) { + printf(" gamma(2)"); + fpar[0] = 2.; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + par = unur_pinv_new(distr); + unur_pinv_set_boundary(par,0., 1.e100); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + +if (ALL) { + printf(" gamma(5)"); + fpar[0] = 5.; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + par = unur_pinv_new(distr); + unur_pinv_set_boundary(par,0., 1.e100); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + +if (ALL) { + printf(" gamma(1.02)"); + fpar[0] = 1.02; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +} /* endif (UERROR_VANISHINGPDF) */ +if (UERROR_TRUNCATED) { /* --------------------------- */ + + printf("\nTruncated Distributions:\n"); + fprintf(TESTLOG,"\n--- Truncated Distributions --- \n\n"); + + +if (ALL) { + printf(" truncated normal[3,inf]"); + distr = unur_distr_normal(NULL,0); + unur_distr_cont_set_domain(distr,3.,UNUR_INFINITY); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +if (ALL && DEVEL) { + printf(" truncated normal[15,inf]"); + distr = unur_distr_normal(NULL,0); + unur_distr_cont_set_domain(distr,15.,UNUR_INFINITY); + par = unur_pinv_new(distr); + /* using CDF does not work here. */ + errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +} /* endif (UERROR_TRUNCATED) */ +if (UERROR_UNBOUNDEDPDF) { /* --------------------------- */ + + printf("\nDistributions with unbounded PDF:\n"); + fprintf(TESTLOG,"\n--- Distributions with unbounded PDF --- \n\n"); + + +if (ALL) { + printf(" gamma(0.2)"); + fpar[0] = 0.2; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + par = unur_pinv_new(distr); + unur_pinv_set_extra_testpoints(par,50); + errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + +if (ALL) { + printf(" gamma(0.5)"); + fpar[0] = 0.5; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + par = unur_pinv_new(distr); + unur_pinv_set_extra_testpoints(par,40); + errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +} /* endif (UERROR_UNBOUNDEDPDF) */ +if (UERROR_MULTIMODAL) { /* --------------------------- */ + + printf("\nMultimodal distributions:\n"); + fprintf(TESTLOG,"\n--- Multimodal distributions --- \n\n"); + + +if (ALL) { + printf(" sin-2-example"); + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"sin-2-example"); + unur_distr_cont_set_cdf( distr, sin_2_cdf ); + unur_distr_cont_set_pdf( distr, sin_2_pdf ); + unur_distr_cont_set_domain( distr, -1., 1. ); + unur_distr_cont_set_center(distr,0.25); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + +if (ALL) { + printf(" sin-10-example"); + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"sin-10-example"); + unur_distr_cont_set_cdf( distr, sin_10_cdf ); + unur_distr_cont_set_pdf( distr, sin_10_pdf ); + unur_distr_cont_set_domain( distr, -5., 5. ); + unur_distr_cont_set_center(distr,0.25); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +} /* endif (UERROR_MULTIMODAL) */ +if (UERROR_MULTIMODAL_VANISHINGPDF) { /* --------------------------- */ + + printf("\nMultimodal distributions with vanishing PDF:\n"); + fprintf(TESTLOG,"\n--- Multimodal distributions with vanishing PDF --- \n\n"); + + +if (ALL) { + printf(" sin-2-example");fflush(stdout); + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"sin-0-example"); + unur_distr_cont_set_cdf( distr, sin_2_cdf ); + unur_distr_cont_set_pdf( distr, sin_2_pdf ); + unur_distr_cont_set_domain( distr, -2., 2. ); + unur_distr_cont_set_center(distr,0.25); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +if (ALL) { + printf(" sin-2-example");fflush(stdout); + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"sin-0-example"); + unur_distr_cont_set_cdf( distr, sin_2_cdf ); + unur_distr_cont_set_pdf( distr, sin_2_pdf ); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + unur_distr_cont_set_center(distr,0.25); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + +if (ALL) { + printf(" sin-10-example"); + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"sin-10-example"); + unur_distr_cont_set_cdf( distr, sin_10_cdf ); + unur_distr_cont_set_pdf( distr, sin_10_pdf ); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + unur_distr_cont_set_center(distr,0.25); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +} /* endif (UERROR_MULTIMODAL_VANISHINGPDF) */ + + +/*---------------------------------------------------------------------------*/ + + /* test finished */ + FAILED = (errorsum < 2) ? 0 : 1; + + + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (FAILED) ? 0 : 1; + (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_special() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_pinv_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_pinv.conf b/vendor/unuran-1.11.0/tests/t_pinv.conf new file mode 100644 index 0000000..0cc55d6 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_pinv.conf @@ -0,0 +1,1404 @@ +############################################################################ + +[main] + +[main - data:] + +# method +method: PINV + +[main - header:] + +/* header files */ +\#include + +/* -- which tests for u-error should be performed (for development) -- */ + +\#define DEVEL FALSE /* whether to run tests in development mode */ +\#define ALL TRUE + +/* Remark: + Setting ALL to FALSE is useful if a only a single validation test + should be run. Thus the "if(ALL)" condition for that particular test + has to be replaced by "if(TRUE)". +*/ + +\#define UERROR_STANDARDDIST TRUE +\#define UERROR_QUASIPDF TRUE +\#define UERROR_VANISHINGPDF TRUE +\#define UERROR_TRUNCATED TRUE +\#define UERROR_UNBOUNDEDPDF TRUE +\#define UERROR_MULTIMODAL TRUE +\#define UERROR_MULTIMODAL_VANISHINGPDF TRUE + +/* orders */ +static int UERROR_ORDER_MIN = 3; +static int UERROR_ORDER_MAX = 17; +static int UERROR_ORDER_STEP = 1; + +/* smoothness */ +static int SMOOTHNESS_MAX = 2; + +/* u-resolutions */ +static double UERROR_URESOLUTION_MAX = 1.e-8; +static double UERROR_URESOLUTION_MIN = 0.99e-13; +static double UERROR_URESOLUTION_STEP = 0.1; + +/* we run all tests only in 'fullcheck' mode */ +\#define set_uerror_tests() \ + if (!fullcheck) { \ + /* UERROR_ORDER_STEP = 3; */ \ + UERROR_URESOLUTION_MAX = 1.e-8; \ + UERROR_URESOLUTION_MIN = 0.99e-12; \ + UERROR_URESOLUTION_STEP = 0.01; \ + } +/* see also SKIPORDER in routine pinv_error_experiment() below */ + +/* sample size */ +static const int UERROR_SAMPLESIZE = 100000; + + +/* -- constants -- */ + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* \#define SEED (298346) */ + +\#ifndef M_PI +\#define M_PI 3.14159265358979323846264338328 /* pi */ +\#endif + + +/* -- macros -- */ + +\#define set_debug_flag(par) \ + do { \ + if (fullcheck) unur_set_debug((par),~0u); \ + else unur_set_debug((par),0x00010000u); \ + } while (0); + + +/* -- prototypes -- */ + +int pinv_error_experiment( UNUR_PAR *par, int samplesize, int UERROR_PDF, int UERROR_CDF); +int pinv_error_gen_experiment( UNUR_GEN *gen, + double u_resolution, int order, int samplesize ); + +double neg_exponential_cdf( double x, const UNUR_DISTR *distr ); +double neg_exponential_pdf( double x, const UNUR_DISTR *distr ); + +double neg_exponential_1_cdf( double x, const UNUR_DISTR *distr ); +double neg_exponential_1_pdf( double x, const UNUR_DISTR *distr ); + +double sin_2_cdf( double x, const UNUR_DISTR *distr ); +double sin_2_pdf( double x, const UNUR_DISTR *distr ); + +double sin_10_cdf( double x, const UNUR_DISTR *distr ); +double sin_10_pdf( double x, const UNUR_DISTR *distr ); + + + + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_cont_new(); ] + +/* pdf */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + /* double stp[] = {1.,2.,3.}; */ + par = NULL; ] + +~_order( par, 3 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_smoothness( par, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_u_resolution( par, 1.e-8 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_use_upoints( par, TRUE ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_usepdf( par ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_usecdf( par ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_boundary(par,1.,3.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_searchboundary(par, TRUE, TRUE ) + --> expected_setfailed --> UNUR_ERR_NULL + +~_max_intervals(par,1000) + --> expected_setfailed --> UNUR_ERR_NULL + +~_extra_testpoints(par,10) + --> expected_setfailed --> UNUR_ERR_NULL + +~_keepcdf(par,TRUE) + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameter object: + /* double stp[] = {1.,2.,3.}; */ + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); ] + +~_order( par, 3 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_smoothness( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_u_resolution( par, 1.e-8 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_use_upoints( par, TRUE ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_usepdf( par ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_usecdf( par ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_boundary(par,1.,3.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_searchboundary(par, TRUE, TRUE ) + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_max_intervals(par,1000) + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_extra_testpoints(par,10) + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_keepcdf(par,TRUE) + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + + +[set - invalid parameters: + distr = unur_distr_normal(NULL,0); + par = unur_pinv_new(distr); ] + +~_order( par, 30 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_order( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_smoothness( par, 4 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_boundary(par,1.,-3.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_boundary(par,1.,UNUR_INFINITY); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_max_intervals(par,1) + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_max_intervals(par,10000000) + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_extra_testpoints(par,-1) + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + + +[set - invalid parameters: + UNUR_PAR *par; + UNUR_GEN *gen; + distr = unur_distr_normal(NULL,0); ] + +par = unur_pinv_new(distr); +~_order( par, 4 ); +~_smoothness( par, 1 ); +gen = unur_init(par); + --> none --> UNUR_ERR_GENERIC + +unur_free(gen); +par = unur_pinv_new(distr); +~_order( par, 4 ); +~_smoothness( par, 2 ); +gen = unur_init(par); + --> none --> UNUR_ERR_GENERIC + +unur_free(gen); +par = unur_pinv_new(distr); +~_order( par, 6 ); +~_smoothness( par, 2 ); +gen = unur_init(par); + --> none --> UNUR_ERR_GENERIC + +unur_free(gen); + + +[set - missing CDF: + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr, neg_exponential_pdf); + par = unur_pinv_new(distr); ] + +~_usecdf( par ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + + +[set - missing PDF: + distr = unur_distr_cont_new(); + unur_distr_cont_set_cdf(distr, neg_exponential_cdf); + par = unur_pinv_new(distr); ] + +~_usepdf( par ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + + +[set - missing PDF: + UNUR_PAR *par; + UNUR_GEN *gen; + distr = unur_distr_cont_new(); + unur_distr_cont_set_cdf(distr, neg_exponential_cdf); ] + +par = unur_pinv_new(distr); +~_usecdf( par ); +~_smoothness( par, 1 ); +gen = unur_init(par); + --> none --> UNUR_ERR_DISTR_REQUIRED + +unur_free(gen); +par = unur_pinv_new(distr); +~_usecdf( par ); +~_smoothness( par, 2 ); +gen = unur_init(par); + --> none --> UNUR_ERR_DISTR_REQUIRED + +unur_free(gen); +unur_distr_cont_set_pdf(distr, neg_exponential_pdf); +par = unur_pinv_new(distr); +~_usecdf( par ); +~_smoothness( par, 2 ); +gen = unur_init(par); + --> none --> UNUR_ERR_DISTR_REQUIRED + +unur_free(gen); + + +############################################################################# + +[get] + +[get - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_srou_new(distr); + gen = unur_init(par); <-- ! NULL ] + +~_n_intervals(gen); + --> expected_zero --> UNUR_ERR_GEN_INVALID + + +############################################################################# + +#[chg] + +############################################################################# + +# [init] + +############################################################################# + +#[reinit] + +#[reinit - exists: +# distr = unur_distr_normal(NULL,0); +# par = unur_pinv_new(distr); +# gen = unur_init( par ); <-- ! NULL ] +# +#unur_reinit( gen ); +# --> expected_reinit + +############################################################################# + +[sample] + +[sample - invalid NULL ptr: + gen = NULL; ] + +unur_pinv_eval_approxinvcdf(gen,0.5); + --> expected_INFINITY --> UNUR_ERR_NULL + +#..................................................................... + +[sample - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_srou_new(distr); + gen = unur_init(par); <-- ! NULL ] + +unur_pinv_eval_approxinvcdf(gen,0.5); + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + + +[sample - invalid domain: + distr = unur_distr_normal(NULL,0); + par = unur_pinv_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +unur_pinv_eval_approxinvcdf(gen,1.5); + --> expected_INFINITY --> UNUR_ERR_DOMAIN + +unur_pinv_eval_approxinvcdf(gen,-0.5); + --> expected_negINFINITY --> UNUR_ERR_DOMAIN + +#..................................................................... + +[sample - cdf table removed: + distr = unur_distr_normal(NULL,0); + par = unur_pinv_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +unur_pinv_eval_approxcdf(gen,1.5); + --> expected_INFINITY --> UNUR_ERR_GENERIC + +#..................................................................... + +[sample - check approximate cdf: + int i, cdffailed=0; + double x,u,d; + gen = unur_str2gen("cont;logpdf='5-x';domain=(0,infinity)&method=pinv;keepcdf=on;debug=0"); ] + +for (i=1; i<1000; i++) { + x = 5.*i/1000.; + u = unur_pinv_eval_approxcdf(gen,x); + d = fabs(u - (1-exp(-x))); + if (d > 1.e-11) { cdffailed = 1; }} +cdffailed; + --> expected_zero --> UNUR_SUCCESS + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_pinv_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... +# +#[sample - compare reinit: +# distr = unur_distr_normal(NULL,0); +# par = NULL; +# gen = NULL; ] +# +#/* original generator object */ +#par = unur_pinv_new(distr); +#gen = unur_init(par); +# -->compare_sequence_gen_start +# +#/* reinit */ +#unur_reinit(gen); +# -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + double fpar[] = {3.,4.}; + distr = NULL; + par = NULL; + gen = NULL; ] + + +distr = unur_distr_gamma(fpar,2); +unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); +par = unur_pinv_new(distr); +set_debug_flag(par); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,4.); domain = (2,infinity) & \ + method = pinv; debug = 0x1" ); + -->compare_sequence_gen + + +unur_free(gen); gen = NULL; +distr = unur_distr_normal(NULL,0); +unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); +par = unur_pinv_new(distr); +unur_pinv_set_order(par,10); +unur_pinv_set_u_resolution(par,1.e-6); +unur_pinv_set_boundary(par,1.,1000.); +unur_pinv_set_max_intervals(par,1000); +set_debug_flag(par); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal; domain = (2,inf) & \ + method = pinv; order = 10; u_resolution = 1.e-6; \ + boundary = (1,1000); max_intervals = 1000; debug = 0x1" ); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default +par[0] = unur_pinv_new(@distr@); + + +[validate - distributions:] + +# Normal distributions +distr[0] = unur_distr_normal(NULL,0); + +# Normal distributions with quasi density +distr[1] = unur_distr_multPDF( distr[0], 100. ); + +# distributions with negative PDF +distr[2] = unur_str2distr( "cont; pdf='x/(1+x*x*x*x)'; center=1" ); + +distr[3] = unur_str2distr( "cont; pdf='-x/(1+x*x*x*x)'; center=-1" ); + +# distributions with almost vanishing PDF +distr[4] = unur_str2distr( "cont; pdf='cos(2*x)'; cdf='(1+sin(2*x))/2'; center=0; domain=(-0.7853981633974482, 0.7853981633974482)" ); + +distr[5] = unur_str2distr( "cont; pdf='1-x^2+1e-16'; cdf='( 2-(x^2-3)*x) / 4'; center=0; domain=(-1, 1)" ); + + +# number of distributions: 3 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default +# +# 0 # distribution +#----------------------------- +<0> + # normal () +<1> + # normal () +<2> 0 # PDF(x) < 0 +<3> 0 # PDF(x) < 0 +<4> + # PDF(x) \approx 0 +<5> + # PDF(x) \approx 0 + + +############################################################################# + +[special] + +[special - decl:] + + int samplesize = UERROR_SAMPLESIZE; + int errorsum = 0; + double fpar[4]; + + UNUR_DISTR *distr, *qdistr; + UNUR_PAR *par; + +[special - start:] + + /* set u-error tests */ + set_uerror_tests(); + + /* test for maximal u-error */ + printf("\n[test maximal u-error]"); + fprintf(TESTLOG,"\n* Test maximal u-error *\n"); + +## ---------------------------------------------------- +if (UERROR_STANDARDDIST) { /* --------------------------- */ + + printf("\nStandard distributions:\n"); + fprintf(TESTLOG,"\n--- Standard distributions --- \n\n"); + + ## --- Normal --- +if (ALL) { + printf(" normal"); + distr = unur_distr_normal(NULL,0); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + ## --- Cauchy --- +if (ALL) { + printf(" cauchy"); + distr = unur_distr_cauchy(NULL,0); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + ## --- Exponential - Gamma(1) --- +if (ALL) { + printf(" exponential"); + distr = unur_distr_exponential(NULL,0); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + ## --- Gamma(0.9) --- +if (ALL) { + printf(" gamma(0.9)"); + fpar[0] = 0.9; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + ## --- Gamma(1.02) --- +if (ALL) { + printf(" gamma(1.02)"); + fpar[0] = 1.02; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + ## --- Gamma(1.5) --- +if (ALL) { + printf(" gamma(1.5)"); + fpar[0] = 1.5; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + ## --- Gamma(2) --- +if (ALL) { + printf(" gamma(2)"); + fpar[0] = 2.; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + par = unur_pinv_new(distr); + unur_pinv_set_boundary(par,0., 1.e100); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + ## --- Gamma(5) --- +if (ALL) { + printf(" gamma(5)"); + fpar[0] = 5.; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + par = unur_pinv_new(distr); + unur_pinv_set_boundary(par,0., 1.e100); +## unur_pinv_set_searchboundary(par,FALSE,TRUE); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + ## --- beta(2,3) --- +if (ALL) { + printf(" beta(2,3)"); + fpar[0] = 2; + fpar[1] = 3; + distr = unur_distr_beta(fpar,2); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + ## --- Gumbel - ExtremeI --- +if (ALL) { + printf(" Gumbel"); + distr = unur_distr_extremeI(NULL,0); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + ## --- Shifted Normal --- +if (ALL) { + printf(" shifted normal"); + fpar[0] = 200.; + fpar[1] = 1.; + distr = unur_distr_normal(fpar,2); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); + + printf(" shifted normal"); + fpar[0] = -200; + fpar[1] = 1.; + distr = unur_distr_normal(fpar,2); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + ## --- Lognormal --- +if (0) { + printf(" lognormal(2,0.5)"); + fpar[0] = 2.; + fpar[1] = 0.5; + distr = unur_distr_lognormal(fpar,2); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); + + printf(" lognormal(2.0.5,4.)"); + fpar[0] = 2.; + fpar[1] = 0.5; + fpar[2] = 4.; + distr = unur_distr_lognormal(fpar,3); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +} /* endif (UERROR_STANDARDDIST) */ +## ---------------------------------------------------- +if (UERROR_QUASIPDF) { /* --------------------------- */ + + printf("\nDistributions with quasi-densities:\n"); + fprintf(TESTLOG,"\n--- Distributions with quasi-densities --- \n\n"); + +if (ALL) { + distr = unur_distr_normal(NULL,0); + + printf(" (normal*1e10)"); + qdistr = unur_distr_multPDF( distr, 1.e10 ); + par = unur_pinv_new(qdistr); + errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); + unur_distr_free(qdistr); + fprintf(TESTLOG,"\n"); + + printf(" (normal*1e-10)"); + qdistr = unur_distr_multPDF( distr, 1.e-10 ); + par = unur_pinv_new(qdistr); + errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); + unur_distr_free(qdistr); + fprintf(TESTLOG,"\n"); + + unur_distr_free(distr); +} + +} /* endif (UERROR_QUASIPDF) */ +## ---------------------------------------------------- +if (UERROR_VANISHINGPDF) { /* --------------------------- */ + + printf("\nDistributions with vanishing PDF:\n"); + fprintf(TESTLOG,"\n--- Distributions with vanishing PDF --- \n\n"); + + ## --- Exponential --- +if (ALL) { + printf(" (exponential_on_(-oo,oo))"); + distr = unur_distr_exponential(NULL,0); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + unur_distr_set_name(distr,"exponential_(-oo,oo)"); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +if (ALL) { + printf(" (exponential(1,1)_on_(-oo,oo))"); + fpar[0] = 1.; + fpar[1] = 1.; + distr = unur_distr_exponential(fpar,2); + unur_distr_cont_set_center(distr,2.); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + unur_distr_set_name(distr,"exponential(1,1)_(-oo,oo)"); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +if (ALL) { + printf(" (exponential(1,1)_on_(-oo,oo))"); + fpar[0] = 1.; + fpar[1] = 1.; + distr = unur_distr_exponential(fpar,2); + unur_distr_cont_set_center(distr,2.); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + unur_distr_cont_set_center(distr,2.); + unur_distr_set_name(distr,"exponential(1,1)_(-oo,oo)"); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +if (ALL) { + printf(" (exponential(1,-1)_on_(-oo,oo))"); + fpar[0] = 1.; + fpar[1] = -1.; + distr = unur_distr_exponential(fpar,2); + unur_distr_cont_set_center(distr,2.); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + unur_distr_set_name(distr,"exponential(1,-1)_(-oo,oo)"); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +if (ALL) { + printf(" (exponential(0.1,0.1)_on_(-oo,oo))"); + fpar[0] = 0.1; + fpar[1] = 0.1; + distr = unur_distr_exponential(fpar,2); + unur_distr_cont_set_center(distr,2.); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + unur_distr_set_name(distr,"exponential(0.1,0.1)_(-oo,oo)"); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +if (ALL) { + printf(" (exponential(1000,1000)_on_(-oo,oo))"); + fpar[0] = 1000; + fpar[1] = 1000; + distr = unur_distr_exponential(fpar,2); + unur_distr_cont_set_center(distr,1000.); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + unur_distr_set_name(distr,"exponential(1000,1000)_(-oo,oo)"); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + ## --- "Negative" exponential --- +if (ALL) { + printf(" neg_exponential"); + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"neg_exponential"); + unur_distr_cont_set_cdf( distr, neg_exponential_cdf ); + unur_distr_cont_set_pdf( distr, neg_exponential_pdf ); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +if (ALL) { + printf(" neg_exponential_1"); + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"neg_exponential_1"); + unur_distr_cont_set_cdf( distr, neg_exponential_1_cdf ); + unur_distr_cont_set_pdf( distr, neg_exponential_1_pdf ); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + unur_distr_cont_set_center(distr,-2.); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + ## --- Gamma(2) --- +if (ALL) { + printf(" gamma(2)"); + fpar[0] = 2.; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + par = unur_pinv_new(distr); + unur_pinv_set_boundary(par,0., 1.e100); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + ## --- Gamma(5) --- +if (ALL) { + printf(" gamma(5)"); + fpar[0] = 5.; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + par = unur_pinv_new(distr); + unur_pinv_set_boundary(par,0., 1.e100); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + ## --- Gamma(1.02) --- +if (ALL) { + printf(" gamma(1.02)"); + fpar[0] = 1.02; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +} /* endif (UERROR_VANISHINGPDF) */ +## ---------------------------------------------------- +if (UERROR_TRUNCATED) { /* --------------------------- */ + + printf("\nTruncated Distributions:\n"); + fprintf(TESTLOG,"\n--- Truncated Distributions --- \n\n"); + + ## --- Normal --- +if (ALL) { + printf(" truncated normal[3,inf]"); + distr = unur_distr_normal(NULL,0); + unur_distr_cont_set_domain(distr,3.,UNUR_INFINITY); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +if (ALL && DEVEL) { + printf(" truncated normal[15,inf]"); + distr = unur_distr_normal(NULL,0); + unur_distr_cont_set_domain(distr,15.,UNUR_INFINITY); + par = unur_pinv_new(distr); + /* using CDF does not work here. */ + errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +} /* endif (UERROR_TRUNCATED) */ +## ---------------------------------------------------- +if (UERROR_UNBOUNDEDPDF) { /* --------------------------- */ + + printf("\nDistributions with unbounded PDF:\n"); + fprintf(TESTLOG,"\n--- Distributions with unbounded PDF --- \n\n"); + + ## --- Gamma(0.2) --- +if (ALL) { + printf(" gamma(0.2)"); + fpar[0] = 0.2; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + par = unur_pinv_new(distr); + unur_pinv_set_extra_testpoints(par,50); + errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + ## --- Gamma(0.5) --- +if (ALL) { + printf(" gamma(0.5)"); + fpar[0] = 0.5; + distr = unur_distr_gamma(fpar,1); + unur_distr_cont_set_center(distr,1.); + par = unur_pinv_new(distr); + unur_pinv_set_extra_testpoints(par,40); + errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +} /* endif (UERROR_UNBOUNDEDPDF) */ +## ---------------------------------------------------- +if (UERROR_MULTIMODAL) { /* --------------------------- */ + + printf("\nMultimodal distributions:\n"); + fprintf(TESTLOG,"\n--- Multimodal distributions --- \n\n"); + + ## --- sin-2-example --- +if (ALL) { + printf(" sin-2-example"); + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"sin-2-example"); + unur_distr_cont_set_cdf( distr, sin_2_cdf ); + unur_distr_cont_set_pdf( distr, sin_2_pdf ); + unur_distr_cont_set_domain( distr, -1., 1. ); + unur_distr_cont_set_center(distr,0.25); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + ## --- sin-10-example --- +if (ALL) { + printf(" sin-10-example"); + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"sin-10-example"); + unur_distr_cont_set_cdf( distr, sin_10_cdf ); + unur_distr_cont_set_pdf( distr, sin_10_pdf ); + unur_distr_cont_set_domain( distr, -5., 5. ); + unur_distr_cont_set_center(distr,0.25); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +} /* endif (UERROR_MULTIMODAL) */ +## ---------------------------------------------------- +if (UERROR_MULTIMODAL_VANISHINGPDF) { /* --------------------------- */ + + printf("\nMultimodal distributions with vanishing PDF:\n"); + fprintf(TESTLOG,"\n--- Multimodal distributions with vanishing PDF --- \n\n"); + + ## --- sin-0-example --- +if (ALL) { + printf(" sin-2-example");fflush(stdout); + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"sin-0-example"); + unur_distr_cont_set_cdf( distr, sin_2_cdf ); + unur_distr_cont_set_pdf( distr, sin_2_pdf ); + unur_distr_cont_set_domain( distr, -2., 2. ); + unur_distr_cont_set_center(distr,0.25); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +if (ALL) { + printf(" sin-2-example");fflush(stdout); + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"sin-0-example"); + unur_distr_cont_set_cdf( distr, sin_2_cdf ); + unur_distr_cont_set_pdf( distr, sin_2_pdf ); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + unur_distr_cont_set_center(distr,0.25); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + + ## --- sin-10-example --- +if (ALL) { + printf(" sin-10-example"); + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"sin-10-example"); + unur_distr_cont_set_cdf( distr, sin_10_cdf ); + unur_distr_cont_set_pdf( distr, sin_10_pdf ); + unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); + unur_distr_cont_set_center(distr,0.25); + par = unur_pinv_new(distr); + errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); + unur_distr_free(distr); + fprintf(TESTLOG,"\n"); +} + +} /* endif (UERROR_MULTIMODAL_VANISHINGPDF) */ +## ---------------------------------------------------- + + +/*---------------------------------------------------------------------------*/ + + /* test finished */ + FAILED = (errorsum < 2) ? 0 : 1; + + +############################################################################# + +[verbatim] + + +############################################################################# +# +# routines for special tests +# +############################################################################# + +/*****************************************************************************/ +/* run unur_test_u_error for a particular generator object and print result */ + +int +pinv_error_gen_experiment( UNUR_GEN *gen, /* generator object */ + double u_resolution, /* maximal tolerated u-error */ + int order, /* order of polynomial */ + int samplesize ) /* sample size for error experiment */ + /* returns 0 if maxerror < u_resolution, errorcode otherwise */ +{ + int i, nfpar; + const double *fpar; + const UNUR_DISTR *distr; + const char *genid; + int score; + + /* check for invalid NULL pointer */ + if (gen==NULL) { + fprintf(TESTLOG,"\n--setup failed !! --\n"); + printf("(!!+)"); fflush(stdout); + return 100; + } + + /* get data about generator object */ + distr = unur_get_distr(gen); + genid = unur_get_genid(gen); + + /* print data about distribution */ + fprintf(TESTLOG,"%s: %s distribution",genid,unur_distr_get_name(distr)); + nfpar = unur_distr_cont_get_pdfparams(distr,&fpar); + if (nfpar) { + fprintf(TESTLOG," with parameters "); + for(i=0;i 0) { + fprintf(TESTLOG,"\t\#PDF calls = %d\t(per interval = %d)", + get_counter_pdf(), + ( (unur_pinv_get_n_intervals(gen)!=0) ? + get_counter_pdf() / unur_pinv_get_n_intervals(gen) : -1 ) ); + } + if (get_counter_logpdf() > 0) { + fprintf(TESTLOG,"\t\#logPDF calls = %d\t(per interval = %d)", + get_counter_logpdf(), + ( (unur_pinv_get_n_intervals(gen)!=0) ? + get_counter_logpdf() / unur_pinv_get_n_intervals(gen) : -1 ) ); + } + if (get_counter_cdf() > 0) { + fprintf(TESTLOG,"\t\#CDF calls = %d\t(per interval = %d)", + get_counter_cdf(), + ( (unur_pinv_get_n_intervals(gen)!=0) ? + get_counter_cdf() / unur_pinv_get_n_intervals(gen) : -1 ) ); + } + fprintf(TESTLOG,"\n"); + + /* run test */ + score = run_validate_u_error( TESTLOG, gen, distr, u_resolution, samplesize ); + + /* return score */ + fprintf(TESTLOG,"\n"); fflush(TESTLOG); + return score; + +} /* end of pinv_error_gen_experiment() */ + +/*****************************************************************************/ +/* run experiment for a particular distribution object */ + +int +pinv_error_experiment( UNUR_PAR *par, /* parameter object */ + int samplesize, /* samplesize for error experiment */ + int UERROR_PDF, /* if TRUE, check variant usePDF */ + int UERROR_CDF) /* if TRUE, check variant useCDF */ + /* returns 0 if maxerror < u_resolution, errorcode otherwise */ +{ + UNUR_PAR *par_clone; /* working copy of parameter object */ + UNUR_GEN *gen; /* generator object */ + + int order = 3; + int smooth = 0; + double u_resolution = 1.e-8; /* maximal tolerated u-error */ + int errorsum = 0; + + int variant; + + /* check for invalid NULL pointer */ + if (par==NULL) { + printf(" NULL! "); + return 1000; + } + + /* -- loop smoothness -- */ + for (smooth=0; smooth <= SMOOTHNESS_MAX; smooth++) { + + /* -- loop variante -- */ + for (variant=0; variant <= 1; ++variant) { + /* variant==0 --> use PDF */ + /* variant==1 --> use CDF */ + + switch (variant) { + + case 0: /* run variant PDF+Lobatto */ + if (UERROR_PDF) printf("",smooth); + else continue; + break; + + case 1: /* run variant CDF */ + if (UERROR_CDF) printf("",smooth); + else continue; + break; + + default: + continue; + } + + /* -- loop order -- */ + for ( order=UERROR_ORDER_MIN; order<=UERROR_ORDER_MAX; order+=UERROR_ORDER_STEP) { + + /* prevent warning from invalid order */ + if (smooth==1 && order % 2 != 1) continue; + if (smooth==2 && order % 3 != 2) continue; + + /* SKIPORDER: + * when we do not run in fullcheck mode, we skip some orders. */ + if (!fullcheck) { + switch (smooth) { + case 0: + if (! (order==3 || order==5 || order==8 || order==12 || order==17) ) + continue; + break; + case 1: + if (order==7 || order==11 || order==15) + continue; + break; + case 2: + if (order == 14) + continue; + break; + } + } + + /* -- loop u-resolution -- */ + for ( u_resolution = UERROR_URESOLUTION_MAX; + u_resolution > UERROR_URESOLUTION_MIN; u_resolution *= UERROR_URESOLUTION_STEP ) { + + if (!fullcheck) { + if (smooth==2 && u_resolution < 0.99e-10) + /* setup fails for some truncated distributions. */ + /* so we skip it when not run in fullcheck mode. */ + continue; + } + + /* make a working copy */ + par_clone = _unur_par_clone(par); + + /* set variant */ + switch (variant) { + case 0: unur_pinv_set_usepdf(par_clone); break; + case 1: unur_pinv_set_usecdf(par_clone); break; + } + + /* maximum number of subintervals */ + /**/ if (order <= 3 && u_resolution < 1.e-12) { + unur_pinv_set_max_intervals(par_clone,100000); + } else if (u_resolution < 1.e13) { + unur_pinv_set_max_intervals(par_clone,100000); + } + + /* start counter for PDF calls */ + start_counter_fcalls(par_clone); + + /* create generator object */ + unur_pinv_set_order(par_clone,order); + unur_pinv_set_smoothness(par_clone,smooth); + unur_pinv_set_u_resolution(par_clone,u_resolution); + set_debug_flag(par_clone); + gen = unur_init(par_clone); + + /* run test */ + errorsum += pinv_error_gen_experiment(gen, u_resolution, order, samplesize); + + /* clear memory */ + unur_free(gen); + stop_counter_fcalls(); + + } /* -- end loop u-resolution -- */ + + } /* -- end end loop order -- */ + + } /* -- end loop variant */ + + } /* -- end loop smoothness -- */ + + unur_par_free(par); + + return errorsum; +} /* end of pinv_error_experiment() */ + +/*****************************************************************************/ + +############################################################################# +# +# PDFs and CDF for test distributions +# +############################################################################# + +/*---------------------------------------------------------------------------*/ +/* "negative" exponential distribution */ +/* */ +/* / exp(x) if x <= 0 */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ +double neg_exponential_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x>0.) + return 0.; + else + return (exp(x)); +} + +double neg_exponential_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x>0.) + return 1.; + else + return (exp(x)); +} + +/*---------------------------------------------------------------------------*/ +/* "shifted negative" exponential distribution */ +/* */ +/* / exp(x-s) if x <= s */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ + +\#define shift (-1.) + +double neg_exponential_1_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x = x-shift; + + if (x>0.) + return 0.; + else + return (exp(x)); +} + +double neg_exponential_1_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x = x-shift; + + if (x>=0.) + return 1.; + else + return (exp(x)); +} + +\#undef shift + + +/*---------------------------------------------------------------------------*/ +/* */ +/* / 0.05 + 0.45*(1 +sin(2 Pi x)) if |x| <= 1 */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ +double sin_2_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (fabs(x) > 1.) + return 0.; + else + return (0.05 + 0.45*(1.+sin(2.*M_PI*x))); +} /* end of sin_pdf() */ + +/* The CDF of our distribution: */ +double sin_2_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x < -1.) + return 0.; + else if(x<=1.) + return (0.05*(x+1) + 0.9*(1.+2.*M_PI*(1+x)-cos((2.*M_PI)*x))/(4.*M_PI)); + else return 1.; +} /* end of sin_cdf() */ + + +/*---------------------------------------------------------------------------*/ +/* */ +/* / 0.05 + 0.45*(1 +sin(2 Pi x)) if |x| <= 5 */ +/* f(x) = < */ +/* \ 0 otherwise */ +/* */ +double sin_10_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (fabs(x) > 5.) + return 0.; + else + return (0.05 + 0.45*(1.+sin(2.*M_PI*x))); +} /* end of sin_pdf() */ + +/* The CDF of our distribution: */ +double sin_10_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x < -5.) + return 0.; + else if(x<=5.) + return ((x/10.+0.5) + 0.09/(2*M_PI)*(cos(10*M_PI)-cos(2*M_PI*x))); + else return 1.; +} /* end of sin_cdf() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/tests/t_srou.c b/vendor/unuran-1.11.0/tests/t_srou.c new file mode 100644 index 0000000..13081f0 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_srou.c @@ -0,0 +1,13058 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for SROU + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ +double pdf_normal( double x, const UNUR_DISTR *distr ); +double pdf_invalid( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); + +int unur_srou_set_pedantic( struct unur_par *par, int pedantic ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + +/* #define SEED (3984364) */ + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* pdf for normal distribution */ +double pdf_normal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return exp(-x*x/2.); +} /* end of pdf_normal */ + +/* pdf that does not work */ +double pdf_invalid( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((fabs(x)<0.001) ? 0. : exp(-x*x/2.)); +} /* end of pdf_invalid */ + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt */ +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ +double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x -= 1000.; + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* dummy function */ +int unur_srou_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,39,(unur_srou_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,39,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,45,(unur_srou_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +/* pdf, mode, pdfarea */ +n_tests_failed += (check_expected_NULL(TESTLOG,52,(unur_srou_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,62,(unur_srou_set_r(par,2.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,65,(unur_srou_set_cdfatmode(par,0.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_srou_set_pdfatmode(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,71,(unur_srou_set_verify(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,71,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,74,(unur_srou_set_usesqueeze(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,74,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,77,(unur_srou_set_usemirror(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,77,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,85,(unur_srou_set_r(par,2.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,85,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,88,(unur_srou_set_cdfatmode(par,0.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,91,(unur_srou_set_pdfatmode(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,94,(unur_srou_set_verify(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,97,(unur_srou_set_usesqueeze(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,97,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,100,(unur_srou_set_usemirror(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,100,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_srou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,110,(unur_srou_set_r(par,0.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,110,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,113,(unur_srou_set_cdfatmode(par,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,113,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,116,(unur_srou_set_pdfatmode(par,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,116,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 132, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,136,(unur_srou_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,136,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,139,(unur_srou_chg_cdfatmode(gen,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,139,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,142,(unur_srou_chg_pdfatmode(gen,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,142,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {2.,5.}; + distr = unur_distr_gamma(fpar,2); + par = unur_srou_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 148, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,152,(unur_srou_chg_cdfatmode(gen,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,152,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,155,(unur_srou_chg_pdfatmode(gen,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,155,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,166,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,166,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid data */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_invalid); + unur_distr_cont_set_mode(distr,0.); + unur_distr_cont_set_pdfarea(distr,1.); + par = unur_srou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,177,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,177,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid data */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_invalid); + unur_distr_cont_set_mode(distr,0.); + unur_distr_cont_set_pdfarea(distr,1.); + par = unur_srou_new(distr); + unur_srou_set_r(par,2.); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,188,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,188,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_cont_new(); + par = NULL; + + +unur_reset_errno(); +/* mode, pdfarea */ +unur_distr_cont_set_pdf(distr,pdf_normal); +par = unur_srou_new( distr ); +n_tests_failed += (check_expected_NULL(TESTLOG,198,(unur_init(par)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,198,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* pdfarea */ +unur_distr_cont_set_mode(distr,1.); +par = unur_srou_new( distr ); +n_tests_failed += (check_expected_NULL(TESTLOG,204,(unur_init(par)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,204,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_srou_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 212, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,216,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_srou_new(distr); + unur_srou_set_r(par,2.); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 221, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,225,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {1.,2.}; + distr = unur_distr_normal(fpar,0); + par = NULL; + + +unur_reset_errno(); +/* default algorithm */ +par = unur_srou_new(distr); +n_tests_failed += (compare_sequence_par_start(TESTLOG,238,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* default algorithm - verifying mode */ +par = unur_srou_new(distr); +unur_srou_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,243,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* generalized algorithm, r=2 */ +par = unur_srou_new(distr); +unur_srou_set_r(par,2.); +n_tests_failed += (compare_sequence_par_start(TESTLOG,248,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* generalized algorithm, r=2 - verifying mode */ +par = unur_srou_new(distr); +unur_srou_set_r(par,2.); +unur_srou_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,254,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = NULL; + + +unur_reset_errno(); +/* use cdf at mode */ +par = unur_srou_new(distr); +unur_srou_set_cdfatmode(par,0.5); +n_tests_failed += (compare_sequence_par_start(TESTLOG,266,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* use cdf at mode and squeeze */ +par = unur_srou_new(distr); +unur_srou_set_cdfatmode(par,0.5); +unur_srou_set_usesqueeze(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,272,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* use cdf at mode - verifying mode */ +par = unur_srou_new(distr); +unur_srou_set_cdfatmode(par,0.5); +unur_srou_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,278,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* use cdf at mode and squeeze - verifying mode */ +par = unur_srou_new(distr); +unur_srou_set_cdfatmode(par,0.5); +unur_srou_set_usesqueeze(par,1); +unur_srou_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,285,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = NULL; + + +unur_reset_errno(); +/* use mirror principle */ +par = unur_srou_new(distr); +unur_srou_set_usemirror(par,1); +n_tests_failed += (compare_sequence_par_start(TESTLOG,297,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* use mirror principle - verifying mode */ +par = unur_srou_new(distr); +unur_srou_set_usemirror(par,1); +unur_srou_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,303,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* violate condition */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = NULL; + +/* pdf at mode is too small: hat < pdf near mode */ + +unur_reset_errno(); +/* default algorithm */ +par = unur_srou_new(distr); +unur_srou_set_pdfatmode(par,0.1); + run_verify_generator (TESTLOG,317,par); +n_tests_failed += (check_errorcode(TESTLOG,317,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* use cdf at mode and squeeze */ +par = unur_srou_new(distr); +unur_srou_set_pdfatmode(par,0.1); +unur_srou_set_cdfatmode(par,0.5); +unur_srou_set_usesqueeze(par,1); + run_verify_generator (TESTLOG,324,par); +n_tests_failed += (check_errorcode(TESTLOG,324,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +/* pdf at mode is too large: squeeze > pdf near mode */ + +unur_reset_errno(); +/* use cdf at mode and squeeze */ +unur_distr_cont_set_pdfarea(distr,10.); +par = unur_srou_new(distr); +unur_srou_set_cdfatmode(par,0.5); +unur_srou_set_pdfatmode(par,10.); +unur_srou_set_usesqueeze(par,1); + run_verify_generator (TESTLOG,334,par); +n_tests_failed += (check_errorcode(TESTLOG,334,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_srou_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,347,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,353,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_srou_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,365,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,369,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_srou_new(distr); +unur_srou_set_r(par,2.); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,380,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,384,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {3.,3.}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_beta(fpar,2); +unur_distr_cont_set_pdfarea(distr,2.); +par = unur_srou_new(distr); +unur_srou_set_cdfatmode(par,0.5); +unur_srou_set_pdfatmode(par,1.9); +unur_srou_set_usemirror(par,TRUE); +unur_srou_set_usesqueeze(par,FALSE); +unur_srou_set_verify(par,TRUE); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,403,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "beta(3.,3.); pdfarea = 2. & \ + method = srou; cdfatmode = 0.5; usemirror; usesqueeze = off; pdfatmode = 1.9; verify" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,409,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_beta(fpar,2); +unur_distr_cont_set_pdfarea(distr,2.); +par = unur_srou_new(distr); +unur_srou_set_r(par,3.); +unur_srou_set_cdfatmode(par,0.5); +unur_srou_set_pdfatmode(par,1.9); +unur_srou_set_verify(par,TRUE); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,420,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "beta(3.,3.); pdfarea = 2. & \ + method = srou; r=3; cdfatmode = 0.5; pdfatmode = 1.9; verify" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,426,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[31]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 31 */ +{ +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); +} + +{ +distr[7] = unur_distr_cauchy(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); +} + +{ +distr[23] = unur_distr_exponential(NULL,0); +} + +{ +fpm[0] = 30.; +fpm[1] = -5.; +distr[24] = unur_distr_exponential(fpm,2); +} + +{ +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 1.; +fpm[1] = 4.; +distr[29] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[16] = unur_distr_gamma(fpm,3); +} + +{ +fpm[0] = 0.5; +distr[30] = unur_distr_gamma(fpm,1); +} + +{ +distr[25] = unur_distr_laplace(NULL,0); +} + +{ +fpm[0] = -10.; +fpm[1] = 100.; +distr[26] = unur_distr_laplace(fpm,2); +} + +{ +distr[17] = unur_distr_normal(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); +} + +{ +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); +} + +{ +distr[20] = unur_distr_uniform(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); +} + +{ +distr[27] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[27],pdf_sqrtlin); +unur_distr_cont_set_dpdf(distr[27],dpdf_sqrtlin); +unur_distr_cont_set_cdf(distr[27],cdf_sqrtlin); +unur_distr_set_name(distr[27],"sqrtlin"); +unur_distr_cont_set_mode(distr[27],0.); +unur_distr_cont_set_pdfarea(distr[27],2.); +} + +{ +distr[28] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[28],pdf_sqrtlinshft); +unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlinshft); +unur_distr_cont_set_cdf(distr[28],cdf_sqrtlinshft); +unur_distr_set_name(distr[28],"sqrtlin"); +unur_distr_cont_set_mode(distr[28],1000.); +unur_distr_cont_set_pdfarea(distr[28],2.); +} + +{ +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 341 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [29] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_srou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,10.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 341 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [29] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{UNUR_DISTR *dg =NULL; +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_usemirror(par,1); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,1.001); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,10.); + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_srou_new(distr_localcopy); + unur_srou_set_pedantic(par,0); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + gen = unur_init(par); + if (gen) unur_srou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + unur_distr_free(distr[30]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_srou_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_srou.conf b/vendor/unuran-1.11.0/tests/t_srou.conf new file mode 100644 index 0000000..3699bfd --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_srou.conf @@ -0,0 +1,835 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: SROU + +[main - header:] + +/* prototypes */ +double pdf_normal( double x, const UNUR_DISTR *distr ); +double pdf_invalid( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); + +int unur_srou_set_pedantic( struct unur_par *par, int pedantic ); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* \#define SEED (3984364) */ + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_cont_new(); ] + +/* pdf, mode, pdfarea */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_r(par,2.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_cdfatmode(par,0.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_pdfatmode(par,1.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_verify(par,1); + --> expected_setfailed --> UNUR_ERR_NULL + +~_usesqueeze(par,1); + --> expected_setfailed --> UNUR_ERR_NULL + +~_usemirror(par,1); + --> expected_setfailed --> UNUR_ERR_NULL + +[set - invalid parameter object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); ] + +~_r(par,2.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_cdfatmode(par,0.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_pdfatmode(par,1.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_verify(par,1); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_usesqueeze(par,1); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_usemirror(par,1); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + +[set - invalid parameters: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_srou_new(distr); ] + +~_r(par,0.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_cdfatmode(par,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_pdfatmode(par,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + +############################################################################# + +# [get] + +############################################################################# + +[chg] + +[chg - invalid generator object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_verify(gen,1); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +~_cdfatmode(gen,1.); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +~_pdfatmode(gen,1.); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + + +[chg - invalid parameters: + double fpar[2] = {2.,5.}; + distr = unur_distr_gamma(fpar,2); + par = unur_srou_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +~_cdfatmode(gen,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_pdfatmode(gen,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + + +[init - invalid data: + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_invalid); + unur_distr_cont_set_mode(distr,0.); + unur_distr_cont_set_pdfarea(distr,1.); + par = unur_srou_new(distr); ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_DATA + +[init - invalid data: + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_invalid); + unur_distr_cont_set_mode(distr,0.); + unur_distr_cont_set_pdfarea(distr,1.); + par = unur_srou_new(distr); + unur_srou_set_r(par,2.); ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_DATA + +[init - data missing in distribution object: + distr = unur_distr_cont_new(); + par = NULL; ] + +/* mode, pdfarea */ +unur_distr_cont_set_pdf(distr,pdf_normal); +par = unur_srou_new( distr ); +unur_init(par); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +/* pdfarea */ +unur_distr_cont_set_mode(distr,1.); +par = unur_srou_new( distr ); +unur_init(par); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[reinit] + +[reinit - exist: + distr = unur_distr_normal(NULL,0); + par = unur_srou_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +[reinit - exist: + distr = unur_distr_normal(NULL,0); + par = unur_srou_new(distr); + unur_srou_set_r(par,2.); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - compare: + double fpar[2] = {1.,2.}; + distr = unur_distr_normal(fpar,0); + par = NULL; ] + +/* default algorithm */ +par = unur_srou_new(distr); + -->compare_sequence_par_start + +/* default algorithm - verifying mode */ +par = unur_srou_new(distr); +unur_srou_set_verify(par,1); + -->compare_sequence_par + +/* generalized algorithm, r=2 */ +par = unur_srou_new(distr); +unur_srou_set_r(par,2.); + -->compare_sequence_par_start + +/* generalized algorithm, r=2 - verifying mode */ +par = unur_srou_new(distr); +unur_srou_set_r(par,2.); +unur_srou_set_verify(par,1); + -->compare_sequence_par + +#..................................................................... + +[sample - compare: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = NULL; ] + +/* use cdf at mode */ +par = unur_srou_new(distr); +unur_srou_set_cdfatmode(par,0.5); + -->compare_sequence_par_start + +/* use cdf at mode and squeeze */ +par = unur_srou_new(distr); +unur_srou_set_cdfatmode(par,0.5); +unur_srou_set_usesqueeze(par,1); + -->compare_sequence_par + +/* use cdf at mode - verifying mode */ +par = unur_srou_new(distr); +unur_srou_set_cdfatmode(par,0.5); +unur_srou_set_verify(par,1); + --> compare_sequence_par + +/* use cdf at mode and squeeze - verifying mode */ +par = unur_srou_new(distr); +unur_srou_set_cdfatmode(par,0.5); +unur_srou_set_usesqueeze(par,1); +unur_srou_set_verify(par,1); + --> compare_sequence_par + +#..................................................................... + +[sample - compare: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = NULL; ] + +/* use mirror principle */ +par = unur_srou_new(distr); +unur_srou_set_usemirror(par,1); + -->compare_sequence_par_start + +/* use mirror principle - verifying mode */ +par = unur_srou_new(distr); +unur_srou_set_usemirror(par,1); +unur_srou_set_verify(par,1); + --> compare_sequence_par + +#..................................................................... + +[sample - violate condition: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = NULL; ] + +/* pdf at mode is too small: hat < pdf near mode */ + +/* default algorithm */ +par = unur_srou_new(distr); +unur_srou_set_pdfatmode(par,0.1); + --> run_verify_generator --> UNUR_ERR_GEN_CONDITION + +/* use cdf at mode and squeeze */ +par = unur_srou_new(distr); +unur_srou_set_pdfatmode(par,0.1); +unur_srou_set_cdfatmode(par,0.5); +unur_srou_set_usesqueeze(par,1); + --> run_verify_generator --> UNUR_ERR_GEN_CONDITION + +/* pdf at mode is too large: squeeze > pdf near mode */ + +/* use cdf at mode and squeeze */ +unur_distr_cont_set_pdfarea(distr,10.); +par = unur_srou_new(distr); +unur_srou_set_cdfatmode(par,0.5); +unur_srou_set_pdfatmode(par,10.); +unur_srou_set_usesqueeze(par,1); + --> run_verify_generator --> UNUR_ERR_GEN_CONDITION + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_srou_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare reinit: + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_srou_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +[sample - compare reinit: + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_srou_new(distr); +unur_srou_set_r(par,2.); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + double fpar[2] = {3.,3.}; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_beta(fpar,2); +unur_distr_cont_set_pdfarea(distr,2.); +par = unur_srou_new(distr); +unur_srou_set_cdfatmode(par,0.5); +unur_srou_set_pdfatmode(par,1.9); +unur_srou_set_usemirror(par,TRUE); +unur_srou_set_usesqueeze(par,FALSE); +unur_srou_set_verify(par,TRUE); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "beta(3.,3.); pdfarea = 2. & \ + method = srou; cdfatmode = 0.5; usemirror; usesqueeze = off; pdfatmode = 1.9; verify" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +distr = unur_distr_beta(fpar,2); +unur_distr_cont_set_pdfarea(distr,2.); +par = unur_srou_new(distr); +unur_srou_set_r(par,3.); +unur_srou_set_cdfatmode(par,0.5); +unur_srou_set_pdfatmode(par,1.9); +unur_srou_set_verify(par,TRUE); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "beta(3.,3.); pdfarea = 2. & \ + method = srou; r=3; cdfatmode = 0.5; pdfatmode = 1.9; verify" ); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default variant +par[0] = unur_srou_new(@distr@); + +# use mirror principle +par[1] = unur_srou_new(@distr@); +unur_srou_set_usemirror(par,1); + +# use cdf at mode and squeeze +# IMPORTANT: This method does not work properly for truncated standard distributions, +# since unur_distr_cont_eval_cdf() returns the CDF of the untruncated distribution! +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(@distr@), @distr@ ); +par[2] = unur_srou_new(@distr@); +unur_srou_set_cdfatmode(par,cdfatmode); +unur_srou_set_usesqueeze(par,1); } + +# default variant but reinitialized with changed domain +{UNUR_DISTR *dg =NULL; +par[3] = unur_srou_new(@distr@); +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + +# default variant but reinitialized with changed pdf parameters +{UNUR_DISTR *dg =NULL; +par[4] = unur_srou_new(@distr@); +fpm[0] = 2.; +fpm[1] = 4.; +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + +# generalized SROU + +# r = 1.001 +par[10] = unur_srou_new(@distr@); +unur_srou_set_r(par,1.001); + +# r = 2 +par[11] = unur_srou_new(@distr@); +unur_srou_set_r(par,2.); + +# r = 10 +par[12] = unur_srou_new(@distr@); +unur_srou_set_r(par,10.); + +# r = 2, use cdf at mode +# IMPORTANT: This method does not work properly for truncated standard distributions, +# since unur_distr_cont_eval_cdf() returns the CDF of the untruncated distribution! +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(@distr@), @distr@ ); +par[13] = unur_srou_new(@distr@); +unur_srou_set_r(par,2.); +unur_srou_set_cdfatmode(par,cdfatmode); } + +# r = 2, reinitialized with changed domain +{UNUR_DISTR *dg =NULL; +par[14] = unur_srou_new(@distr@); +unur_srou_set_r(par,2.); +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.95); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + +# r = 2, reinitialized with changed pdf parameters +{UNUR_DISTR *dg =NULL; +par[15] = unur_srou_new(@distr@); +unur_srou_set_r(par,2.); +fpm[0] = 2.; +fpm[1] = 4.; +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + +[validate - distributions:] + +# Beta distributions +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); + +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); + +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); + +# Cauchy distributions +distr[7] = unur_distr_cauchy(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); + +# Exponential distributions +distr[23] = unur_distr_exponential(NULL,0); + +fpm[0] = 30.; +fpm[1] = -5.; +distr[24] = unur_distr_exponential(fpm,2); + +# Gamma distributions +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); + +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); + +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); + +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); + +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); + +fpm[0] = 1.; +fpm[1] = 4.; +distr[29] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[16] = unur_distr_gamma(fpm,3); + +fpm[0] = 0.5; +distr[30] = unur_distr_gamma(fpm,1); + +# Laplace distributions +distr[25] = unur_distr_laplace(NULL,0); + +fpm[0] = -10.; +fpm[1] = 100.; +distr[26] = unur_distr_laplace(fpm,2); + +# Normal distributions +distr[17] = unur_distr_normal(NULL,0); + +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); + +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); + +# Uniform distributions +distr[20] = unur_distr_uniform(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); + +# pdf with piecewise linear function as transformed density with T = -1/sqrt +distr[27] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[27],pdf_sqrtlin); +unur_distr_cont_set_dpdf(distr[27],dpdf_sqrtlin); +unur_distr_cont_set_cdf(distr[27],cdf_sqrtlin); +unur_distr_set_name(distr[27],"sqrtlin"); +unur_distr_cont_set_mode(distr[27],0.); +unur_distr_cont_set_pdfarea(distr[27],2.); + +# pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode +distr[28] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[28],pdf_sqrtlinshft); +unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlinshft); +unur_distr_cont_set_cdf(distr[28],cdf_sqrtlinshft); +unur_distr_set_name(distr[28],"sqrtlin"); +unur_distr_cont_set_mode(distr[28],1000.); +unur_distr_cont_set_pdfarea(distr[28],2.); + +# truncated distributions +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); + +# number of distributions: 31 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default variant +# [1] ... use mirror principle +# [2] ... use cdf at mode and squeeze (not for truncated std distributions) +# [3] ... default variant but reinitialized with changed domain +# [4] ... default variant but reinitialized with changed pdf parameters +# generalized SROU +# [10] ... r = 1.001 +# [11] ... r = 2 +# [12] ... r = 10 +# [13] ... r = 2, use cdf at mode +# [14] ... r = 2, reinitialized with changed domain +# [15] ... r = 2, reinitialized with changed pdf parameters + +# +# 0 1 2 3 4 10 11 12 13 14 15 # distribution +#--------------------------------------------------------------------- +x <0> + + + + + + + + + + + # beta (1, 2) + <1> + + + + + + + + + + + # beta (1, 5) +x <2> + + + . + + + + + . + # beta (1, 100) + <3> + + + + + + + + + + + # beta (3, 4) +x <4> + + + . + + + + + . + # beta (5, 100) + <5> + + + . + + + + + . + # beta (500, 300) + <6> + + + + + + + + + + + # beta (5, 10, -3, 15) + <23> + + + + + + + + + + + # exponential () + <24> + + + + + + + + + + + # exponential (30, -5) + <7> + + + + + + + + + + + # cauchy () + <8> + + + + + + + + + + + # cauchy (1, 20) +x <9> + + + + + + + + + + + # gamma (1) + <10> + + + + + + + + + + + # gamma (2) + <11> + + + + + + + + + + + # gamma (3) + <12> + + + + + + + + + + + # gamma (10) +x<13> + + + . + + + + + . + # gamma (1000) + <29> + + + + + + + + + + + # gamma (1, 4) + <14> + + + + + + + + + + + # gamma (5, 1000, 0) +x<15> + + + . + + + + + . + # gamma (5, 1e-05, 0) +x<16> + + + - + + + + + - + # gamma (5, 10, 100000) + <30> 0 0 0 0 0 0 0 0 0 0 0 # gamma (0.5) + <25> + + + + + + + + + + + # laplace () + <26> + + + + + + + + + + + # laplace (-10, 100) + <17> + + + + + + + + + + + # normal () +x<18> + + + . + + + + + . + # normal (1, 1e-05) + <19> + + + . + + + + + . + # normal (1, 1e+05) + <20> + + + + + + + + + + + # uniform () + <21> + + + - + + + + + - + # uniform (1, 20) + + <22> + + - + + + + + - + + # cauchy () - truncated + + <27> + + + . . + + + + . . # pdf with piecewise linear function as transformed density with T = -1/sqrt + <28> + + + . . + + + + . . # [27] with shifted mode + + +[validate - verify hat:] + +# + ... pass test +# ~ ... fail in at most 1% of samples +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default variant +# [1] ... use mirror principle +# [2] ... use cdf at mode and squeeze (not for truncated std distributions) +# [3] ... default variant but reinitialized with changed domain +# [4] ... default variant but reinitialized with changed pdf parameters +# generalized SROU +# [10] ... r = 1.001 +# [11] ... r = 2 +# [12] ... r = 10 +# [13] ... r = 2, use cdf at mode +# [14] ... r = 2, reinitialized with changed domain +# [15] ... r = 2, reinitialized with changed pdf parameters + +# +# 0 1 2 3 4 10 11 12 13 14 15 # distribution +#--------------------------------------------------------------------- +x <0> + + + + + + + + + + + # beta (1, 2) + <1> + + + + + + + + + + + # beta (1, 5) +x <2> + + + . + + + + + . + # beta (1, 100) + <3> + + + + + + + + + + + # beta (3, 4) +x <4> + + + . + + + + + . + # beta (5, 100) + <5> + + + . + + + + + . + # beta (500, 300) + <6> + + + + + + + + + + + # beta (5, 10, -3, 15) + <23> + + + + + + + + + + + # exponential () + <24> + + + + + + + + + + + # exponential (30, -5) + <7> + + + + + + + + + + + # cauchy () + <8> + + + + + + + + + + + # cauchy (1, 20) +x <9> + + + + + + + + + + + # gamma (1) + <10> + + + + + + + + + + + # gamma (2) + <11> + + + + + + + + + + + # gamma (3) + <12> + + + + + + + + + + + # gamma (10) +x<13> + + + . + + + + + . + # gamma (1000) + <29> + + + + + + + + + + + # gamma (1, 4) + <14> + + + + + + + + + + + # gamma (5, 1000, 0) +x<15> + + + . + + + + + . + # gamma (5, 1e-05, 0) +x<16> + + + . + + + + + . + # gamma (5, 10, 100000) + <25> + + + + + + + + + + + # laplace () + <26> + + + + + + + + + + + # laplace (-10, 100) + <17> + + + + + + + + + + + # normal () +x<18> + + + . + + + + + . + # normal (1, 1e-05) + <19> + + + . + + + + + . + # normal (1, 1e+05) + <20> + + + + + + + + + + + # uniform () + <21> + + + . + + + + + . + # uniform (1, 20) + + <22> + + . + + + + + . + + # cauchy () - truncated + + <27> + + + . . + + + + . . # pdf with piecewise linear function as transformed density with T = -1/sqrt + <28> + + . . . + + + + . . # [27] with shifted mode + + +############################################################################# +############################################################################# + +[verbatim] + +/* pdf for normal distribution */ +double pdf_normal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return exp(-x*x/2.); +} /* end of pdf_normal */ + +/* pdf that does not work */ +double pdf_invalid( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((fabs(x)<0.001) ? 0. : exp(-x*x/2.)); +} /* end of pdf_invalid */ + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt */ +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ +double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x -= 1000.; + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* dummy function */ +int unur_srou_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_ssr.c b/vendor/unuran-1.11.0/tests/t_ssr.c new file mode 100644 index 0000000..2f7a966 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_ssr.c @@ -0,0 +1,4985 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for SSR + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ +double pdf_normal( double x, const UNUR_DISTR *distr ); +double pdf_invalid( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); + +int unur_ssr_set_pedantic( struct unur_par *par, int pedantic ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + +/* #define SEED (1656256) */ + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* pdf for normal distribution */ +double pdf_normal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return exp(-x*x/2.); +} /* end of pdf_normal */ + +/* pdf that does not work */ +double pdf_invalid( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((fabs(x)<0.001) ? 0. : exp(-x*x/2.)); +} /* end of pdf_invalid */ + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt */ +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ +double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x -= 1000.; + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* dummy function */ +int unur_ssr_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,39,(unur_ssr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,39,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,45,(unur_ssr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +/* pdf, mode, pdfarea */ +n_tests_failed += (check_expected_NULL(TESTLOG,52,(unur_ssr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,62,(unur_ssr_set_cdfatmode(par,0.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,65,(unur_ssr_set_pdfatmode(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_ssr_set_verify(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,71,(unur_ssr_set_usesqueeze(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,71,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_ssr_set_cdfatmode(par,0.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,82,(unur_ssr_set_pdfatmode(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,82,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,85,(unur_ssr_set_verify(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,85,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,88,(unur_ssr_set_usesqueeze(par,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_ssr_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,98,(unur_ssr_set_cdfatmode(par,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,98,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,101,(unur_ssr_set_pdfatmode(par,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 117, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,121,(unur_ssr_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,121,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,124,(unur_ssr_chg_cdfatmode(gen,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,124,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,127,(unur_ssr_chg_pdfatmode(gen,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,127,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {2.,5.}; + distr = unur_distr_gamma(fpar,2); + par = unur_ssr_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 133, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,137,(unur_ssr_chg_cdfatmode(gen,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,137,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,140,(unur_ssr_chg_pdfatmode(gen,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,140,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,151,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,151,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid data */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_invalid); + unur_distr_cont_set_mode(distr,0.); + unur_distr_cont_set_pdfarea(distr,1.); + par = unur_ssr_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,161,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,161,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_cont_new(); + par = NULL; + + +unur_reset_errno(); +/* mode, pdfarea */ +unur_distr_cont_set_pdf(distr,pdf_normal); +par = unur_ssr_new( distr ); +n_tests_failed += (check_expected_NULL(TESTLOG,171,(unur_init(par)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,171,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* pdfarea */ +unur_distr_cont_set_mode(distr,1.); +par = unur_ssr_new( distr ); +n_tests_failed += (check_expected_NULL(TESTLOG,177,(unur_init(par)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,177,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_ssr_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 185, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,189,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,0); + par = NULL; + + +unur_reset_errno(); +/* default algorithm */ +par = unur_ssr_new(distr); +n_tests_failed += (compare_sequence_par_start(TESTLOG,202,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* default algorithm - verifying mode */ +par = unur_ssr_new(distr); +unur_ssr_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,207,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = NULL; + + +unur_reset_errno(); +/* use cdf at mode */ +par = unur_ssr_new(distr); +unur_ssr_set_cdfatmode(par,0.5); +n_tests_failed += (compare_sequence_par_start(TESTLOG,219,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* use cdf at mode and squeeze */ +par = unur_ssr_new(distr); +unur_ssr_set_cdfatmode(par,0.5); +unur_ssr_set_usesqueeze(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,225,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* use cdf at mode - verifying mode */ +par = unur_ssr_new(distr); +unur_ssr_set_cdfatmode(par,0.5); +unur_ssr_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,231,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* use cdf at mode and squeeze - verifying mode */ +par = unur_ssr_new(distr); +unur_ssr_set_cdfatmode(par,0.5); +unur_ssr_set_usesqueeze(par,1); +unur_ssr_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,238,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* violate condition */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = NULL; + +/* pdf at mode is too small: hat < pdf near mode */ + +unur_reset_errno(); +/* default algorithm */ +par = unur_ssr_new(distr); +unur_ssr_set_pdfatmode(par,0.1); + run_verify_generator (TESTLOG,252,par); +n_tests_failed += (check_errorcode(TESTLOG,252,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* use cdf at mode and squeeze */ +par = unur_ssr_new(distr); +unur_ssr_set_pdfatmode(par,0.1); +unur_ssr_set_cdfatmode(par,0.5); +unur_ssr_set_usesqueeze(par,1); + run_verify_generator (TESTLOG,259,par); +n_tests_failed += (check_errorcode(TESTLOG,259,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +/* pdf at mode is too large: squeeze > pdf near mode */ + +unur_reset_errno(); +/* use cdf at mode and squeeze */ +unur_distr_cont_set_pdfarea(distr,10.); +par = unur_ssr_new(distr); +unur_ssr_set_cdfatmode(par,0.5); +unur_ssr_set_pdfatmode(par,10.); +unur_ssr_set_usesqueeze(par,1); + run_verify_generator (TESTLOG,269,par); +n_tests_failed += (check_errorcode(TESTLOG,269,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_ssr_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,282,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,288,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_ssr_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,300,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,304,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {3.,3.}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_beta(fpar,2); +unur_distr_cont_set_pdfarea(distr,2.); +par = unur_ssr_new(distr); +unur_ssr_set_cdfatmode(par,0.5); +unur_ssr_set_pdfatmode(par,1.9); +unur_ssr_set_usesqueeze(par,FALSE); +unur_ssr_set_verify(par,TRUE); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,322,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "beta(3.,3.); pdfarea = 2. & \ + method = ssr; cdfatmode = 0.5; usesqueeze = off; pdfatmode = 1.9; verify" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,328,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[31]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 31 */ +{ +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); +} + +{ +distr[7] = unur_distr_cauchy(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); +} + +{ +distr[23] = unur_distr_exponential(NULL,0); +} + +{ +fpm[0] = 30.; +fpm[1] = -5.; +distr[24] = unur_distr_exponential(fpm,2); +} + +{ +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 1.; +fpm[1] = 4.; +distr[29] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[16] = unur_distr_gamma(fpm,3); +} + +{ +fpm[0] = 0.5; +distr[30] = unur_distr_gamma(fpm,1); +} + +{ +distr[25] = unur_distr_laplace(NULL,0); +} + +{ +fpm[0] = -10.; +fpm[1] = 100.; +distr[26] = unur_distr_laplace(fpm,2); +} + +{ +distr[17] = unur_distr_normal(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); +} + +{ +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); +} + +{ +distr[20] = unur_distr_uniform(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); +} + +{ +distr[27] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[27],pdf_sqrtlin); +unur_distr_cont_set_dpdf(distr[27],dpdf_sqrtlin); +unur_distr_cont_set_cdf(distr[27],cdf_sqrtlin); +unur_distr_set_name(distr[27],"sqrtlin"); +unur_distr_cont_set_mode(distr[27],0.); +unur_distr_cont_set_pdfarea(distr[27],2.); +} + +{ +distr[28] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[28],pdf_sqrtlinshft); +unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlinshft); +unur_distr_cont_set_cdf(distr[28],cdf_sqrtlinshft); +unur_distr_set_name(distr[28],"sqrtlin"); +unur_distr_cont_set_mode(distr[28],1000.); +unur_distr_cont_set_pdfarea(distr[28],2.); +} + +{ +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 124 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [4] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [29] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ssr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 124 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [4] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); +par = unur_ssr_new(distr_localcopy); + unur_ssr_set_pedantic(par,0); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + gen = unur_init(par); + if (gen) unur_ssr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + unur_distr_free(distr[30]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_ssr_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_ssr.conf b/vendor/unuran-1.11.0/tests/t_ssr.conf new file mode 100644 index 0000000..97032ce --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_ssr.conf @@ -0,0 +1,670 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: SSR + +[main - header:] + +/* prototypes */ +double pdf_normal( double x, const UNUR_DISTR *distr ); +double pdf_invalid( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); + +int unur_ssr_set_pedantic( struct unur_par *par, int pedantic ); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* \#define SEED (1656256) */ + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_cont_new(); ] + +/* pdf, mode, pdfarea */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_cdfatmode(par,0.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_pdfatmode(par,1.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_verify(par,1); + --> expected_setfailed --> UNUR_ERR_NULL + +~_usesqueeze(par,1); + --> expected_setfailed --> UNUR_ERR_NULL + +[set - invalid parameter object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); ] + +~_cdfatmode(par,0.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_pdfatmode(par,1.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_verify(par,1); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_usesqueeze(par,1); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + +[set - invalid parameters: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_ssr_new(distr); ] + +~_cdfatmode(par,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_pdfatmode(par,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + +############################################################################# + +# [get] + +############################################################################# + +[chg] + +[chg - invalid generator object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_verify(gen,1); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +~_cdfatmode(gen,1.); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +~_pdfatmode(gen,1.); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + + +[chg - invalid parameters: + double fpar[2] = {2.,5.}; + distr = unur_distr_gamma(fpar,2); + par = unur_ssr_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +~_cdfatmode(gen,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_pdfatmode(gen,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + +[init - invalid data: + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_invalid); + unur_distr_cont_set_mode(distr,0.); + unur_distr_cont_set_pdfarea(distr,1.); + par = unur_ssr_new(distr); ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_DATA + +[init - data missing in distribution object: + distr = unur_distr_cont_new(); + par = NULL; ] + +/* mode, pdfarea */ +unur_distr_cont_set_pdf(distr,pdf_normal); +par = unur_ssr_new( distr ); +unur_init(par); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +/* pdfarea */ +unur_distr_cont_set_mode(distr,1.); +par = unur_ssr_new( distr ); +unur_init(par); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[reinit] + +[reinit - exist: + distr = unur_distr_normal(NULL,0); + par = unur_ssr_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - compare: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,0); + par = NULL; ] + +/* default algorithm */ +par = unur_ssr_new(distr); + -->compare_sequence_par_start + +/* default algorithm - verifying mode */ +par = unur_ssr_new(distr); +unur_ssr_set_verify(par,1); + -->compare_sequence_par + +#..................................................................... + +[sample - compare: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = NULL; ] + +/* use cdf at mode */ +par = unur_ssr_new(distr); +unur_ssr_set_cdfatmode(par,0.5); + -->compare_sequence_par_start + +/* use cdf at mode and squeeze */ +par = unur_ssr_new(distr); +unur_ssr_set_cdfatmode(par,0.5); +unur_ssr_set_usesqueeze(par,1); + -->compare_sequence_par + +/* use cdf at mode - verifying mode */ +par = unur_ssr_new(distr); +unur_ssr_set_cdfatmode(par,0.5); +unur_ssr_set_verify(par,1); + --> compare_sequence_par + +/* use cdf at mode and squeeze - verifying mode */ +par = unur_ssr_new(distr); +unur_ssr_set_cdfatmode(par,0.5); +unur_ssr_set_usesqueeze(par,1); +unur_ssr_set_verify(par,1); + --> compare_sequence_par + +#..................................................................... + +[sample - violate condition: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = NULL; ] + +/* pdf at mode is too small: hat < pdf near mode */ + +/* default algorithm */ +par = unur_ssr_new(distr); +unur_ssr_set_pdfatmode(par,0.1); + --> run_verify_generator --> UNUR_ERR_GEN_CONDITION + +/* use cdf at mode and squeeze */ +par = unur_ssr_new(distr); +unur_ssr_set_pdfatmode(par,0.1); +unur_ssr_set_cdfatmode(par,0.5); +unur_ssr_set_usesqueeze(par,1); + --> run_verify_generator --> UNUR_ERR_GEN_CONDITION + +/* pdf at mode is too large: squeeze > pdf near mode */ + +/* use cdf at mode and squeeze */ +unur_distr_cont_set_pdfarea(distr,10.); +par = unur_ssr_new(distr); +unur_ssr_set_cdfatmode(par,0.5); +unur_ssr_set_pdfatmode(par,10.); +unur_ssr_set_usesqueeze(par,1); + --> run_verify_generator --> UNUR_ERR_GEN_CONDITION + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_ssr_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare reinit: + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_ssr_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + double fpar[2] = {3.,3.}; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_beta(fpar,2); +unur_distr_cont_set_pdfarea(distr,2.); +par = unur_ssr_new(distr); +unur_ssr_set_cdfatmode(par,0.5); +unur_ssr_set_pdfatmode(par,1.9); +unur_ssr_set_usesqueeze(par,FALSE); +unur_ssr_set_verify(par,TRUE); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "beta(3.,3.); pdfarea = 2. & \ + method = ssr; cdfatmode = 0.5; usesqueeze = off; pdfatmode = 1.9; verify" ); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default program +par[0] = unur_ssr_new(@distr@); + +# use cdf at mode and squeeze +{ double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(@distr@), @distr@ ); +par[1] = unur_ssr_new(@distr@); +unur_ssr_set_cdfatmode(par,cdfatmode); +unur_ssr_set_usesqueeze(par,1); } + +# default variant but reinitialized with changed domain +{ UNUR_DISTR *dg =NULL; +par[2] = unur_ssr_new(@distr@); +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + +# default variant but reinitialized with changed pdf parameters +{ UNUR_DISTR *dg =NULL; +par[3] = unur_ssr_new(@distr@); +fpm[0] = 1.; +fpm[1] = 4.; +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + + +[validate - distributions:] + +# Beta distributions +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); + +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); + +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); + +# Cauchy distributions +distr[7] = unur_distr_cauchy(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); + +# Exponential distributions +distr[23] = unur_distr_exponential(NULL,0); + +fpm[0] = 30.; +fpm[1] = -5.; +distr[24] = unur_distr_exponential(fpm,2); + +# Gamma distributions +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); + +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); + +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); + +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); + +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); + +fpm[0] = 1.; +fpm[1] = 4.; +distr[29] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[16] = unur_distr_gamma(fpm,3); + +fpm[0] = 0.5; +distr[30] = unur_distr_gamma(fpm,1); + +# Laplace distributions +distr[25] = unur_distr_laplace(NULL,0); + +fpm[0] = -10.; +fpm[1] = 100.; +distr[26] = unur_distr_laplace(fpm,2); + +# Normal distributions +distr[17] = unur_distr_normal(NULL,0); + +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); + +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); + +# Uniform distributions +distr[20] = unur_distr_uniform(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); + +# pdf with piecewise linear function as transformed density with T = -1/sqrt +distr[27] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[27],pdf_sqrtlin); +unur_distr_cont_set_dpdf(distr[27],dpdf_sqrtlin); +unur_distr_cont_set_cdf(distr[27],cdf_sqrtlin); +unur_distr_set_name(distr[27],"sqrtlin"); +unur_distr_cont_set_mode(distr[27],0.); +unur_distr_cont_set_pdfarea(distr[27],2.); + +# pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode +distr[28] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[28],pdf_sqrtlinshft); +unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlinshft); +unur_distr_cont_set_cdf(distr[28],cdf_sqrtlinshft); +unur_distr_set_name(distr[28],"sqrtlin"); +unur_distr_cont_set_mode(distr[28],1000.); +unur_distr_cont_set_pdfarea(distr[28],2.); + +# truncated distributions +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); + +# number of distributions: 31 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default variant +# [1] ... use cdf at mode and squeeze +# [2] ... default variant but reinitialized with changed domain +# [3] ... default variant but reinitialized with changed pdf parameters +# +#gen 0 1 2 3 # distribution +#--------------------------------------------- +x <0> + + + + # beta (1, 2) + <1> + + + + # beta (1, 5) +x <2> + + . . # beta (1, 100) + <3> + + + . # beta (3, 4) +x <4> + + . . # beta (5, 100) +x <5> + + . . # beta (500, 300) + <6> + + + . # beta (5, 10, -3, 15) + <23> + + + + # exponential () + <24> + + + + # exponential (30, -5) + <7> + + + + # cauchy () + <8> + + + + # cauchy (1, 20) +x <9> + + + + # gamma (1) + <0> + + + + # gamma (2) + <11> + + + . # gamma (3) + <12> + + + . # gamma (10) +x<13> + + . . # gamma (1000) + <29> + + + + # gamma (1, 4) + <14> + + + . # gamma (5, 1000, 0) +x<15> + + . . # gamma (5, 1e-05, 0) +x<16> + + - . # gamma (5, 10, 100000) + <30> 0 0 0 0 # gamma (0.5) + <25> + + + + # laplace () + <26> + + + + # laplace (-10, 100) + <17> + + + + # normal () +x<18> + + . + # normal (1, 1e-05) + <19> + + . . # normal (1, 1e+05) + <20> + + + + # uniform () + <21> + + - + # uniform (1, 20) + + <22> + . + + # cauchy () - truncated + + <27> + + . . # pdf with piecewise linear function as transformed density with T = -1/sqrt + <28> + + . . # [27] with shifted mode + + +[validate - verify hat:] + +# + ... pass test +# ~ ... fail in at most 1% of samples +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# +# generators: +# [0] ... default variant +# [1] ... use cdf at mode and squeeze +# [2] ... default variant but reinitialized with changed domain +# [3] ... default variant but reinitialized with changed pdf parameters +# +#gen 0 1 2 3 # distribution +#--------------------------------------------- +x <0> + + + + # beta (1, 2) + <1> + + + + # beta (1, 5) +x <2> + + . . # beta (1, 100) + <3> + + + . # beta (3, 4) +x <4> + + . . # beta (5, 100) + <5> + + . . # beta (500, 300) + <6> + + + . # beta (5, 10, -3, 15) + <23> + + + + # exponential () + <24> + + + + # exponential (30, -5) + <7> + + + + # cauchy () + <8> + + + + # cauchy (1, 20) +x <9> + + + + # gamma (1) + <0> + + + + # gamma (2) + <11> + + + . # gamma (3) + <12> + + + . # gamma (10) +x<13> + + . . # gamma (1000) + <14> + + + . # gamma (5, 1000, 0) +x<15> + + . . # gamma (5, 1e-05, 0) +x<16> + + . . # gamma (5, 10, 100000) + <25> + + + + # laplace () + <26> + + + + # laplace (-10, 100) + <17> + + + + # normal () +x<18> + + . + # normal (1, 1e-05) + <19> + + . . # normal (1, 1e+05) + <20> + + + . # uniform () + <21> + + . + # uniform (1, 20) + + <22> + . + + # cauchy () - truncated + + <27> + + . . # pdf with piecewise linear function as transformed density with T = -1/sqrt + <28> + + . . # [27] with shifted mode + + +############################################################################# +############################################################################# + +[verbatim] + +/* pdf for normal distribution */ +double pdf_normal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return exp(-x*x/2.); +} /* end of pdf_normal */ + +/* pdf that does not work */ +double pdf_invalid( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((fabs(x)<0.001) ? 0. : exp(-x*x/2.)); +} /* end of pdf_invalid */ + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt */ +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ +double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x -= 1000.; + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* dummy function */ +int unur_ssr_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_stringparser.c b/vendor/unuran-1.11.0/tests/t_stringparser.c new file mode 100644 index 0000000..3f438df --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_stringparser.c @@ -0,0 +1,879 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for STRINGPARSER + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_stringparser_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ +int unur_ssr_set_pedantic( struct unur_par *par, int pedantic ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; +UNUR_GEN *gen = NULL; + distr = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,45,(gen = unur_str2gen( NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,48,(distr = unur_str2distr( NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,48,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,51,(gen = unur_makegen_ssu(NULL,NULL,NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,51,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid distribution block */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,58,(gen = unur_str2gen( "xxxx" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,58,UNUR_ERR_STR_UNKNOWN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +n_tests_failed += (check_expected_NULL(TESTLOG,62,(gen = unur_str2gen( "method = xxxx" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_STR_SYNTAX)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +n_tests_failed += (check_expected_NULL(TESTLOG,66,(gen = unur_str2gen( "normal; xxxx=1" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_STR_UNKNOWN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +n_tests_failed += (check_expected_NULL(TESTLOG,70,(gen = unur_str2gen( "normal; pv=(1,2,3)" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_ERR_STR_UNKNOWN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +n_tests_failed += (check_expected_NULL(TESTLOG,74,(gen = unur_str2gen( "normal,(1,2)" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,74,UNUR_ERR_STR_UNKNOWN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +n_tests_failed += (check_expected_NULL(TESTLOG,78,(gen = unur_str2gen( "beta" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,78,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +n_tests_failed += (check_expected_NULL(TESTLOG,82,(gen = unur_str2gen( "beta()" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,82,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +n_tests_failed += (check_expected_NULL(TESTLOG,86,(gen = unur_str2gen( "beta(1)" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,86,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +gen = unur_str2gen( "beta(1,2,3)" ); +n_tests_failed += (check_errorcode(TESTLOG,90,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +gen = unur_str2gen( "beta(1,2,3,4,5)" ); +n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +n_tests_failed += (check_expected_NULL(TESTLOG,98,(gen = unur_str2gen( "gamma(-0.5)" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,98,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +n_tests_failed += (check_expected_NULL(TESTLOG,102,(gen = unur_str2gen( "normal(); domain" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,102,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* invalid other block */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,109,(gen = unur_str2gen( "normal() & xxxx = arou" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,109,UNUR_ERR_STR_UNKNOWN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +n_tests_failed += (check_expected_NULL(TESTLOG,113,(gen = unur_str2gen( "normal() & distr=gamma(2)" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,113,UNUR_ERR_STR_UNKNOWN)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* invalid method block */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +gen = unur_str2gen( "normal() & method = arou; c = 0" ); +n_tests_failed += (check_errorcode(TESTLOG,120,UNUR_ERR_STR_UNKNOWN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +n_tests_failed += (check_expected_NULL(TESTLOG,124,(gen = unur_str2gen( "normal() & method = xxx" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,124,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* invalid urng block */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +gen = unur_str2gen( "normal & urng = xxx" ); +n_tests_failed += (check_errorcode(TESTLOG,131,UNUR_ERR_STR)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +#ifdef UNURAN_SUPPORTS_PRNG +gen = unur_str2gen( "normal & urng = mt19937(123); xxx = 1" ); +n_tests_failed += (check_errorcode(TESTLOG,136,UNUR_ERR_STR_UNKNOWN)==UNUR_SUCCESS)?0:1; +#endif +unur_free(gen); +} + +{ /* invalid data */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,145,(gen = unur_str2gen( "gamma(0.5) & method = tdr" )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,145,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* invalid data */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + struct unur_slist *mlist = NULL; + distr = NULL; + par = NULL; + gen = NULL; + +distr = unur_str2distr("normal()"); +par = _unur_str2par(distr, "tdr", &mlist); +gen = unur_init(par); +_unur_slist_free(mlist); +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid distribution block */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,168,(distr = unur_str2distr("cont; pdf='exp'")))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,168,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,173,(distr = unur_str2distr("cont; pdf='abc(x)'")))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,173,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,178,(distr = unur_str2distr("cont; pdf='exp(x*y)'")))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,178,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,182,(distr = unur_str2distr("cont; pdf='exp(x'")))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,182,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,185,(distr = unur_str2distr("cont; pdf='exp((x)'")))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,185,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,188,(distr = unur_str2distr("cont; pdf='exp(x))'")))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,188,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,192,(distr = unur_str2distr("cont; pdf='x^'")))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,192,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,196,(distr = unur_str2distr("cont; pdf='exp(x)x'")))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,196,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,199,(distr = unur_str2distr("cont; pdf='2x'")))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,199,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,202,(distr = unur_str2distr("cont; pdf='x***2'")))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,202,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,205,(distr = unur_str2distr("cont; pdf='x*exp(x^(x*y))'")))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,205,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare function parser - cont */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpm[10]; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_normal(NULL,0); +par = unur_srou_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,231,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ + method = srou" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,237,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1 & \ + method = srou" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,243,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1", \ + "method = srou", NULL ); +n_tests_failed += (compare_sequence_gen(TESTLOG,249,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1", \ + "srou", NULL ); +n_tests_failed += (compare_sequence_gen(TESTLOG,255,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_str2distr("cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1"); +gen = unur_makegen_dsu( distr, "srou", NULL ); +n_tests_failed += (compare_sequence_gen(TESTLOG,262,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_normal(NULL,0); +par = unur_ssr_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,271,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ + method = ssr" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,278,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_normal(NULL,0); +par = unur_utdr_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,287,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ + method = utdr" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,293,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1 & \ + method = utdr" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,299,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_normal(NULL,0); +par = unur_tdr_new(distr); +unur_tdr_set_cpoints(par,8,NULL); +unur_tdr_set_max_sqhratio(par,0.); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,310,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ + method = tdr; cpoints = 8; max_sqhratio = 0." ); +n_tests_failed += (compare_sequence_gen(TESTLOG,316,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1 & \ + method = tdr; cpoints = 8; max_sqhratio = 0." ); +n_tests_failed += (compare_sequence_gen(TESTLOG,322,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1", \ + "method = tdr; cpoints = 8; max_sqhratio = 0.", NULL ); +n_tests_failed += (compare_sequence_gen(TESTLOG,328,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1", \ + "tdr; cpoints = 8; max_sqhratio = 0.", NULL ); +n_tests_failed += (compare_sequence_gen(TESTLOG,334,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_normal(NULL,0); +par = unur_arou_new(distr); +unur_arou_set_cpoints(par,8,NULL); +unur_arou_set_max_sqhratio(par,0.); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,345,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ + method = arou; cpoints = 8; max_sqhratio = 0." ); +n_tests_failed += (compare_sequence_gen(TESTLOG,351,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_cont_new(); +unur_distr_cont_set_cdfstr(distr,"1-exp(-x)"); +par = unur_ninv_new(distr); +unur_ninv_set_usenewton(par); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,362,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; cdf = \"1-exp(-x)\"; domain = (0,inf)& \ + method = ninv; usenewton" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,368,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_cont_new(); +unur_distr_cont_set_hrstr(distr,"1/(1+x)"); +par = unur_hrb_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,378,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ + method = hrb" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,384,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_normal(NULL,0); +par = unur_auto_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,393,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal() & method=auto" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,398,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "normal()", "method=auto", NULL ); +n_tests_failed += (compare_sequence_gen(TESTLOG,403,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "normal()", "auto", NULL ); +n_tests_failed += (compare_sequence_gen(TESTLOG,408,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "normal()", "", NULL ); +n_tests_failed += (compare_sequence_gen(TESTLOG,413,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "normal()", NULL, NULL ); +n_tests_failed += (compare_sequence_gen(TESTLOG,418,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "normal", NULL, NULL ); +n_tests_failed += (compare_sequence_gen(TESTLOG,423,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +fpm[0] = 1.; +fpm[1] = 2.; +distr = unur_distr_normal(fpm,2); +par = unur_auto_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,434,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal(1.,2.) & method=auto" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,439,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "normal(1,2)", "method=auto", NULL ); +n_tests_failed += (compare_sequence_gen(TESTLOG,444,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "normal(1,2.)", "auto", NULL ); +n_tests_failed += (compare_sequence_gen(TESTLOG,449,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "normal(1.,2)", "", NULL ); +n_tests_failed += (compare_sequence_gen(TESTLOG,454,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "normal(1,2)", NULL, NULL ); +n_tests_failed += (compare_sequence_gen(TESTLOG,459,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +fpm[0] = 1.; +fpm[1] = 2.; +distr = unur_distr_normal(fpm,2); +gen = unur_makegen_dsu( distr, "method=auto", NULL ); +n_tests_failed += (compare_sequence_gen(TESTLOG,467,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +fpm[0] = 1.; +fpm[1] = 2.; +distr = unur_distr_normal(fpm,2); +gen = unur_makegen_dsu( distr, "auto", NULL ); +n_tests_failed += (compare_sequence_gen(TESTLOG,475,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +fpm[0] = 1.; +fpm[1] = 2.; +distr = unur_distr_normal(fpm,2); +gen = unur_makegen_dsu( distr, "", NULL ); +n_tests_failed += (compare_sequence_gen(TESTLOG,483,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +fpm[0] = 1.; +fpm[1] = 2.; +distr = unur_distr_normal(fpm,2); +gen = unur_makegen_dsu( distr, NULL, NULL ); +n_tests_failed += (compare_sequence_gen(TESTLOG,491,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare function parser - discr */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[] = {0.4}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_geometric(fpar,1); +par = unur_dsrou_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,510,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "discr; pmf = \"0.4 * (1-0.4)^k\"; domain = (0,inf); mode = 0; pmfsum = 1 & \ + method = dsrou" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,516,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_geometric(fpar,1); +par = unur_dau_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,524,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "discr; pmf = \"0.4 * (1-0.4)^k\"; domain = (0,inf); mode = 0; pmfsum = 1 & \ + method = dau" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,530,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_geometric(fpar,1); +par = unur_dgt_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,538,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "discr; pmf = \"0.4 * (1-0.4)^k\"; domain = (0,inf); mode = 0; pmfsum = 1 & \ + method = dgt" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,544,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_geometric(fpar,1); +par = unur_dari_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,552,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "discr; pmf = \"0.4 * (1-0.4)^k\"; domain = (0,inf); mode = 0; pmfsum = 1 & \ + method = dari" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,559,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_stringparser_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_stringparser.conf b/vendor/unuran-1.11.0/tests/t_stringparser.conf new file mode 100644 index 0000000..12fd86e --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_stringparser.conf @@ -0,0 +1,576 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: STRINGPARSER + +[main - header:] + +/* prototypes */ +int unur_ssr_set_pedantic( struct unur_par *par, int pedantic ); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +############################################################################# + +# [set] + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################# + +[init] + +# unur_str2gen ... + +[init - invalid NULL ptr: + distr = NULL; + gen = NULL; ] + +gen = unur_str2gen( NULL ); + --> expected_NULL --> UNUR_ERR_NULL + +distr = unur_str2distr( NULL ); + --> expected_NULL --> UNUR_ERR_NULL + +gen = unur_makegen_ssu(NULL,NULL,NULL); + --> expected_NULL --> UNUR_ERR_NULL + + +[init - invalid distribution block: + gen = NULL; ] + +gen = unur_str2gen( "xxxx" ); + --> expected_NULL --> UNUR_ERR_STR_UNKNOWN + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "method = xxxx" ); + --> expected_NULL --> UNUR_ERR_STR_SYNTAX + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "normal; xxxx=1" ); + --> expected_NULL --> UNUR_ERR_STR_UNKNOWN + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "normal; pv=(1,2,3)" ); + --> expected_NULL --> UNUR_ERR_STR_UNKNOWN + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "normal,(1,2)" ); + --> expected_NULL --> UNUR_ERR_STR_UNKNOWN + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "beta" ); + --> expected_NULL --> UNUR_ERR_STR_INVALID + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "beta()" ); + --> expected_NULL --> UNUR_ERR_STR_INVALID + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "beta(1)" ); + --> expected_NULL --> UNUR_ERR_STR_INVALID + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "beta(1,2,3)" ); + --> none --> UNUR_ERR_DISTR_NPARAMS + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "beta(1,2,3,4,5)" ); + --> none --> UNUR_ERR_DISTR_NPARAMS + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "gamma(-0.5)" ); + --> expected_NULL --> UNUR_ERR_STR_INVALID + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "normal(); domain" ); + --> expected_NULL --> UNUR_ERR_STR_INVALID + + +[init - invalid other block: + gen = NULL; ] + +gen = unur_str2gen( "normal() & xxxx = arou" ); + --> expected_NULL --> UNUR_ERR_STR_UNKNOWN + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "normal() & distr=gamma(2)" ); + --> expected_NULL --> UNUR_ERR_STR_UNKNOWN + + +[init - invalid method block: + gen = NULL; ] + +gen = unur_str2gen( "normal() & method = arou; c = 0" ); + --> none --> UNUR_ERR_STR_UNKNOWN + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "normal() & method = xxx" ); + --> expected_NULL --> UNUR_ERR_NULL + + +[init - invalid urng block: + gen = NULL; ] + +gen = unur_str2gen( "normal & urng = xxx" ); + --> none --> UNUR_ERR_STR + +unur_free(gen); gen = NULL; +\#ifdef UNURAN_SUPPORTS_PRNG +gen = unur_str2gen( "normal & urng = mt19937(123); xxx = 1" ); + --> none --> UNUR_ERR_STR_UNKNOWN + +\#endif + + +[init - invalid data: + gen = NULL; ] + +gen = unur_str2gen( "gamma(0.5) & method = tdr" ); + --> expected_NULL --> UNUR_ERR_GEN_DATA + + +# unur_str2par ... + +[init - invalid data: + struct unur_slist *mlist = NULL; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_str2distr("normal()"); +par = _unur_str2par(distr, "tdr", &mlist); +gen = unur_init(par); +_unur_slist_free(mlist); + +## Function parser + +[init - invalid distribution block: + distr = NULL; ] + +## missing parenthesis for function +distr = unur_str2distr("cont; pdf='exp'"); + --> expected_NULL --> UNUR_ERR_STR_INVALID + + +## unknown function name +distr = unur_str2distr("cont; pdf='abc(x)'"); + --> expected_NULL --> UNUR_ERR_STR_INVALID + +## the first symbol ('x') is interpreted as variable, +## the second one causes an error. +distr = unur_str2distr("cont; pdf='exp(x*y)'"); + --> expected_NULL --> UNUR_ERR_STR_INVALID + +## invalid number of parentheses +distr = unur_str2distr("cont; pdf='exp(x'"); + --> expected_NULL --> UNUR_ERR_STR_INVALID + +distr = unur_str2distr("cont; pdf='exp((x)'"); + --> expected_NULL --> UNUR_ERR_STR_INVALID + +distr = unur_str2distr("cont; pdf='exp(x))'"); + --> expected_NULL --> UNUR_ERR_STR_INVALID + +## variable name expected +distr = unur_str2distr("cont; pdf='x^'"); + --> expected_NULL --> UNUR_ERR_STR_INVALID + +## +distr = unur_str2distr("cont; pdf='exp(x)x'"); + --> expected_NULL --> UNUR_ERR_STR_INVALID + +distr = unur_str2distr("cont; pdf='2x'"); + --> expected_NULL --> UNUR_ERR_STR_INVALID + +distr = unur_str2distr("cont; pdf='x***2'"); + --> expected_NULL --> UNUR_ERR_STR_INVALID + +distr = unur_str2distr("cont; pdf='x*exp(x^(x*y))'"); + --> expected_NULL --> UNUR_ERR_STR_INVALID + + + +# unur_makegen_ssu ... + + +############################################################################# + +# [reinit] + +############################################################################# + +[sample] + +#---------------------------------------------------------------------------- + +[sample - compare function parser - cont: + double fpm[10]; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_normal(NULL,0); +par = unur_srou_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ + method = srou" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1 & \ + method = srou" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1", \ + "method = srou", NULL ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1", \ + "srou", NULL ); + -->compare_sequence_gen + + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_str2distr("cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1"); +gen = unur_makegen_dsu( distr, "srou", NULL ); + -->compare_sequence_gen + +# ........................................................................... + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_normal(NULL,0); +par = unur_ssr_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +#if(fullcheck) { +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ + method = ssr" ); + -->compare_sequence_gen + +# ........................................................................... + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_normal(NULL,0); +par = unur_utdr_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ + method = utdr" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1 & \ + method = utdr" ); + -->compare_sequence_gen + +# ........................................................................... + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_normal(NULL,0); +par = unur_tdr_new(distr); +unur_tdr_set_cpoints(par,8,NULL); +unur_tdr_set_max_sqhratio(par,0.); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ + method = tdr; cpoints = 8; max_sqhratio = 0." ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1 & \ + method = tdr; cpoints = 8; max_sqhratio = 0." ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1", \ + "method = tdr; cpoints = 8; max_sqhratio = 0.", NULL ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1", \ + "tdr; cpoints = 8; max_sqhratio = 0.", NULL ); + -->compare_sequence_gen + +# ........................................................................... + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_normal(NULL,0); +par = unur_arou_new(distr); +unur_arou_set_cpoints(par,8,NULL); +unur_arou_set_max_sqhratio(par,0.); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ + method = arou; cpoints = 8; max_sqhratio = 0." ); + -->compare_sequence_gen + +# ........................................................................... + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_cont_new(); +unur_distr_cont_set_cdfstr(distr,"1-exp(-x)"); +par = unur_ninv_new(distr); +unur_ninv_set_usenewton(par); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; cdf = \"1-exp(-x)\"; domain = (0,inf)& \ + method = ninv; usenewton" ); + -->compare_sequence_gen + +# ........................................................................... + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_cont_new(); +unur_distr_cont_set_hrstr(distr,"1/(1+x)"); +par = unur_hrb_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ + method = hrb" ); + -->compare_sequence_gen + +# ........................................................................... + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_normal(NULL,0); +par = unur_auto_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal() & method=auto" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "normal()", "method=auto", NULL ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "normal()", "auto", NULL ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "normal()", "", NULL ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "normal()", NULL, NULL ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "normal", NULL, NULL ); + -->compare_sequence_gen + +# ........................................................................... + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +fpm[0] = 1.; +fpm[1] = 2.; +distr = unur_distr_normal(fpm,2); +par = unur_auto_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "normal(1.,2.) & method=auto" ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "normal(1,2)", "method=auto", NULL ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "normal(1,2.)", "auto", NULL ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "normal(1.,2)", "", NULL ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_makegen_ssu( "normal(1,2)", NULL, NULL ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +fpm[0] = 1.; +fpm[1] = 2.; +distr = unur_distr_normal(fpm,2); +gen = unur_makegen_dsu( distr, "method=auto", NULL ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +fpm[0] = 1.; +fpm[1] = 2.; +distr = unur_distr_normal(fpm,2); +gen = unur_makegen_dsu( distr, "auto", NULL ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +fpm[0] = 1.; +fpm[1] = 2.; +distr = unur_distr_normal(fpm,2); +gen = unur_makegen_dsu( distr, "", NULL ); + -->compare_sequence_gen + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +fpm[0] = 1.; +fpm[1] = 2.; +distr = unur_distr_normal(fpm,2); +gen = unur_makegen_dsu( distr, NULL, NULL ); + -->compare_sequence_gen + +# ........................................................................... + +## Not tested: +## +## unur_distr_cont_set_pdfparams(); + +#--------------------------------------------------------------------- + +[sample - compare function parser - discr: + double fpar[] = {0.4}; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_geometric(fpar,1); +par = unur_dsrou_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "discr; pmf = \"0.4 * (1-0.4)^k\"; domain = (0,inf); mode = 0; pmfsum = 1 & \ + method = dsrou" ); + -->compare_sequence_gen + + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_geometric(fpar,1); +par = unur_dau_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "discr; pmf = \"0.4 * (1-0.4)^k\"; domain = (0,inf); mode = 0; pmfsum = 1 & \ + method = dau" ); + -->compare_sequence_gen + + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_geometric(fpar,1); +par = unur_dgt_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "discr; pmf = \"0.4 * (1-0.4)^k\"; domain = (0,inf); mode = 0; pmfsum = 1 & \ + method = dgt" ); + -->compare_sequence_gen + + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +distr = unur_distr_geometric(fpar,1); +par = unur_dari_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "discr; pmf = \"0.4 * (1-0.4)^k\"; domain = (0,inf); mode = 0; pmfsum = 1 & \ + method = dari" ); + -->compare_sequence_gen + +## Not tested: +## +## unur_distr_discr_set_mode(); +## unur_distr_discr_set_pmfparams(); + +############################################################################# + +# [validate] + +############################################################################# +############################################################################# + +[verbatim] + +############################################################################# + diff --git a/vendor/unuran-1.11.0/tests/t_tabl.c b/vendor/unuran-1.11.0/tests/t_tabl.c new file mode 100644 index 0000000..fb1651e --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_tabl.c @@ -0,0 +1,8715 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for TABL + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ +double pdf( double x, UNUR_DISTR *distr ); + +double pdf_negative( double x, const UNUR_DISTR *distr ); +double pdf_partnegative( double x, const UNUR_DISTR *distr ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* pdf with negative value */ +double pdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ return (-x*x); } + +/* pdf with partial negative value */ +double pdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ return ((x>-0.89 && x<0.89) ? -1.: exp(-x*x)); } + + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,29,(unur_tabl_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,29,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,35,(unur_tabl_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,35,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +/* pdf */ +n_tests_failed += (check_expected_NULL(TESTLOG,42,(unur_tabl_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + double slopes[2] = {0.,1.}; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,53,(unur_tabl_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,56,(unur_tabl_set_useear( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,56,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,59,(unur_tabl_set_usedars( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,59,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,62,(unur_tabl_set_darsfactor( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,65,(unur_tabl_set_variant_splitmode( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_tabl_set_areafraction( par, 0.2 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,71,(unur_tabl_set_nstp( par, 30 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,71,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,74,(unur_tabl_set_slopes( par, slopes, 2 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,74,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,77,(unur_tabl_set_boundary( par, 0.,1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,77,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,80,(unur_tabl_set_guidefactor( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,80,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,83,(unur_tabl_set_max_sqhratio( par, 0.95 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,83,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,86,(unur_tabl_set_max_intervals( par, 100 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,86,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,89,(unur_tabl_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,89,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,92,(unur_tabl_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,92,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,95,(unur_tabl_set_variant_ia( par, TRUE )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,95,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + double slopes[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,105,(unur_tabl_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,105,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,108,(unur_tabl_set_useear( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,108,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,111,(unur_tabl_set_usedars( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,111,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,114,(unur_tabl_set_darsfactor( par, -1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,114,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,117,(unur_tabl_set_variant_splitmode( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,117,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,120,(unur_tabl_set_areafraction( par, 0.2 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,120,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,123,(unur_tabl_set_nstp( par, 30 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,123,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,126,(unur_tabl_set_slopes( par, slopes, 2 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,126,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,129,(unur_tabl_set_boundary( par, 0.,1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,129,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,132,(unur_tabl_set_guidefactor( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,132,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,135,(unur_tabl_set_max_sqhratio( par, 0.95 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,135,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,138,(unur_tabl_set_max_intervals( par, 100 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,138,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,141,(unur_tabl_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,141,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,144,(unur_tabl_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,144,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,147,(unur_tabl_set_variant_ia( par, TRUE )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,147,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double slopesA[4] = {0.,1.,0.5,2.}; + double slopesB[4] = {1.,2.,0.,1.}; + double stp[] = {1.,0.,1.}; + int n_stp = 3; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_tabl_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,162,(unur_tabl_set_cpoints( par, -1, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,162,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,165,(unur_tabl_set_cpoints( par, n_stp, stp )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,165,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,168,(unur_tabl_set_variant_splitmode( par, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,168,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,171,(unur_tabl_set_variant_splitmode( par, 4 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,171,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,174,(unur_tabl_set_areafraction( par, -0.1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,174,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,177,(unur_tabl_set_nstp( par, -1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,177,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,180,(unur_tabl_set_slopes( par, slopesA, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,180,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,183,(unur_tabl_set_slopes( par, slopesA, 4 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,183,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,186,(unur_tabl_set_slopes( par, slopesB, 4 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,186,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,189,(unur_tabl_set_boundary( par, 2., 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,189,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,192,(unur_tabl_set_boundary( par, 0., UNUR_INFINITY )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,192,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,195,(unur_tabl_set_boundary( par, -UNUR_INFINITY, 0. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,195,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,198,(unur_tabl_set_guidefactor( par, -0.1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,198,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,201,(unur_tabl_set_max_sqhratio( par, -0.1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,201,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,204,(unur_tabl_set_max_sqhratio( par, 1.1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,204,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,207,(unur_tabl_set_max_intervals( par, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,207,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,219,(unur_tabl_get_sqhratio(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,219,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,222,(unur_tabl_get_hatarea(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,222,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,225,(unur_tabl_get_squeezearea(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,225,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,228,(unur_tabl_get_n_intervals(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,228,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 233, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,237,(unur_tabl_get_sqhratio(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,237,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,240,(unur_tabl_get_hatarea(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,240,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,243,(unur_tabl_get_squeezearea(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,243,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,246,(unur_tabl_get_n_intervals(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,246,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 257, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,261,(unur_tabl_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,261,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,272,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,272,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* wrong mode */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; + + +unur_reset_errno(); +unur_distr_cont_set_mode(distr,-1.); +par = unur_tabl_new(distr); +n_tests_failed += (check_expected_NULL(TESTLOG,281,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,281,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_distr_cont_set_mode(distr,1.); +par = unur_tabl_new(distr); +n_tests_failed += (check_expected_NULL(TESTLOG,286,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,286,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* negative value of pdf */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_negative); + par = NULL; + + +unur_reset_errno(); +par = unur_tabl_new(distr); +n_tests_failed += (check_expected_NULL(TESTLOG,295,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,295,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_distr_cont_set_domain(distr,-2.,2.); +par = unur_tabl_new(distr); +n_tests_failed += (check_expected_NULL(TESTLOG,300,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,300,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* does not exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_tabl_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 309, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,313,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,313,UNUR_ERR_NO_REINIT)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,316,(unur_sample_cont( gen )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,316,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; + + +unur_reset_errno(); +par = unur_tabl_new(distr); +n_tests_failed += (compare_sequence_par_start(TESTLOG,328,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +par = unur_tabl_new(distr); +unur_tabl_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,333,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +par = unur_tabl_new(distr); +unur_tabl_set_variant_ia(par,FALSE); +n_tests_failed += (compare_sequence_par_start(TESTLOG,338,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +par = unur_tabl_new(distr); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,344,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_tabl_new(distr); +unur_tabl_set_max_sqhratio(par,0.); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,358,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,364,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {3.,3.}; + double slopes[] = {0.5,-1,0.5,1}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_beta(fpar,2); +par = unur_tabl_new(distr); +unur_tabl_set_areafraction(par,0.25); +unur_tabl_set_boundary(par,0.1,0.9); +unur_tabl_set_guidefactor(par,5.); +unur_tabl_set_max_intervals(par,50); +unur_tabl_set_max_sqhratio(par,0.8); +unur_tabl_set_nstp(par,30); +unur_tabl_set_usedars(par,0); +unur_tabl_set_variant_splitmode(par,3); +unur_tabl_set_verify(par,TRUE); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,387,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "beta(3.,3.) & \ + method = tabl; areafraction = 0.25; boundary = (0.1,0.9); \ + guidefactor = 5; max_intervals = 50; max_sqhratio = 0.8; \ + nstp = 30; usedars = 0; variant_splitmode = 3; verify" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,395,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_beta(fpar,2); +par = unur_tabl_new(distr); +unur_tabl_set_slopes(par,slopes,2); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,403,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "beta(3.,3.) & \ + method = tabl; slopes = (0.5,-1,0.5,1),2 " ); +n_tests_failed += (compare_sequence_gen(TESTLOG,409,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_beta(fpar,2); +par = unur_tabl_new(distr); +unur_tabl_set_usedars(par,TRUE); +unur_tabl_set_darsfactor(par,0.5); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,418,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "beta(3.,3.) & method = tabl; usedars=on; darsfactor=0.5" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,423,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[31]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 31 */ +{ +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); +} + +{ +distr[7] = unur_distr_cauchy(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); +} + +{ +distr[23] = unur_distr_exponential(NULL,0); +} + +{ +fpm[0] = 30.; +fpm[1] = -5.; +distr[24] = unur_distr_exponential(fpm,2); +} + +{ +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[16] = unur_distr_gamma(fpm,3); +} + +{ +distr[25] = unur_distr_laplace(NULL,0); +} + +{ +fpm[0] = -10.; +fpm[1] = 100.; +distr[26] = unur_distr_laplace(fpm,2); +} + +{ +distr[17] = unur_distr_normal(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); +} + +{ +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); +} + +{ +distr[20] = unur_distr_uniform(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); +} + +{ +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); +} + +{ +{ double domain[2] = {0., 3.}; +distr[27] = unur_distr_sawtooth_contpdf(domain, 2); } +} + +{ +{ double domain[2] = {0., 5.}; +distr[28] = unur_distr_sawtooth_contpdf(domain, 2); } +} + +{ +{ double domain[2] = {0., 3.}; +distr[29] = unur_distr_sawtooth_discpdf(domain, 2); } +} + +{ +{ double domain[2] = {-2., 2.}; +distr[30] = unur_distr_sawtooth_discpdf(domain, 2); } +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 310 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [29] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tabl_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) { +unur_tabl_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,3);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_slopes(par,slopes,4);} + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tabl_new(distr_localcopy); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 310 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,TRUE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_usedars(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_variant_ia(par,FALSE); + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{double slopes[4] = {0.,-0.5,0.,2.}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_slopes(par,slopes,2);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [27] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par = unur_tabl_new(distr_localcopy); + unur_tabl_set_pedantic(par,0); +unur_tabl_set_cpoints(par,7,cpoints);} + gen = unur_init(par); + if (gen) unur_tabl_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [28] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [29] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [30] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + unur_distr_free(distr[30]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_tabl_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_tabl.conf b/vendor/unuran-1.11.0/tests/t_tabl.conf new file mode 100644 index 0000000..ced41df --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_tabl.conf @@ -0,0 +1,733 @@ +############################################################################# + +[main] + +[main - data:] + +# method +method: TABL + +[main - header:] + +/* prototypes */ +double pdf( double x, UNUR_DISTR *distr ); + +double pdf_negative( double x, const UNUR_DISTR *distr ); +double pdf_partnegative( double x, const UNUR_DISTR *distr ); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_cont_new(); ] + +/* pdf */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + double slopes[2] = {0.,1.}; + par = NULL; ] + +~_cpoints( par, 0, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_useear( par, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_usedars( par, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_darsfactor( par, 1. ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_variant_splitmode( par, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_areafraction( par, 0.2 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_nstp( par, 30 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_slopes( par, slopes, 2 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_boundary( par, 0.,1. ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_guidefactor( par, 1. ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_max_sqhratio( par, 0.95 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_max_intervals( par, 100 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_verify( par, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_pedantic( par, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_variant_ia( par, TRUE ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameter object: + double fpar[2] = {0.,1.}; + double slopes[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); ] + +~_cpoints( par, 0, NULL ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_useear( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_usedars( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_darsfactor( par, -1. ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_variant_splitmode( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_areafraction( par, 0.2 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_nstp( par, 30 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_slopes( par, slopes, 2 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_boundary( par, 0.,1. ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_guidefactor( par, 1. ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_max_sqhratio( par, 0.95 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_max_intervals( par, 100 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_verify( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_pedantic( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_variant_ia( par, TRUE ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + + +unur_par_free(par); + +[set - invalid parameters: + double slopesA[4] = {0.,1.,0.5,2.}; + double slopesB[4] = {1.,2.,0.,1.}; + double stp[] = {1.,0.,1.}; + int n_stp = 3; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_tabl_new(distr); ] + +~_cpoints( par, -1, NULL ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_cpoints( par, n_stp, stp ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_variant_splitmode( par, 0 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_variant_splitmode( par, 4 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_areafraction( par, -0.1 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_nstp( par, -1 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_slopes( par, slopesA, 0 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_slopes( par, slopesA, 4 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_slopes( par, slopesB, 4 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_boundary( par, 2., 1. ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_boundary( par, 0., UNUR_INFINITY ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_boundary( par, -UNUR_INFINITY, 0. ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_guidefactor( par, -0.1 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_max_sqhratio( par, -0.1 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_max_sqhratio( par, 1.1 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_max_intervals( par, 0 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + +############################################################################# + +[get] + +[get - invalid NULL ptr: + gen = NULL; ] + +~_sqhratio(gen); + --> expected_INFINITY --> UNUR_ERR_NULL + +~_hatarea(gen); + --> expected_INFINITY --> UNUR_ERR_NULL + +~_squeezearea(gen); + --> expected_INFINITY --> UNUR_ERR_NULL + +~_n_intervals(gen); + --> expected_zero --> UNUR_ERR_NULL + + +[get - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init(par); <-- ! NULL ] + +~_sqhratio(gen); + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + +~_hatarea(gen); + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + +~_squeezearea(gen); + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + +~_n_intervals(gen); + --> expected_zero --> UNUR_ERR_GEN_INVALID + + +############################################################################# + +[chg] + +[chg - invalid generator object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_verify(gen,1); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + +[init - wrong mode: + distr = unur_distr_normal(NULL,0); + par = NULL; ] + +unur_distr_cont_set_mode(distr,-1.); +par = unur_tabl_new(distr); +unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_CONDITION + +unur_distr_cont_set_mode(distr,1.); +par = unur_tabl_new(distr); +unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_CONDITION + +[init - negative value of pdf: + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_negative); + par = NULL; ] + +par = unur_tabl_new(distr); +unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_CONDITION + +unur_distr_cont_set_domain(distr,-2.,2.); +par = unur_tabl_new(distr); +unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_CONDITION + + +############################################################################# + +[reinit] + +[reinit - does not exist: + distr = unur_distr_normal(NULL,0); + par = unur_tabl_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_setfailed --> UNUR_ERR_NO_REINIT + +unur_sample_cont( gen ); + --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION + +############################################################################# + +[sample] + +[sample - compare: + distr = unur_distr_normal(NULL,0); + par = NULL; ] + +# default (immediate acceptance) +par = unur_tabl_new(distr); + -->compare_sequence_par_start + +# default - verifying mode */ +par = unur_tabl_new(distr); +unur_tabl_set_verify(par,1); + -->compare_sequence_par + +# "classical" acceptance/rejection (RH) +par = unur_tabl_new(distr); +unur_tabl_set_variant_ia(par,FALSE); + -->compare_sequence_par_start + +# "classical" acceptance/rejection (RH) - verifying mode */ +par = unur_tabl_new(distr); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_verify(par,1); + -->compare_sequence_par + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_tabl_new(distr); +unur_tabl_set_max_sqhratio(par,0.); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + double fpar[2] = {3.,3.}; + double slopes[] = {0.5,-1,0.5,1}; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_beta(fpar,2); +par = unur_tabl_new(distr); +unur_tabl_set_areafraction(par,0.25); +unur_tabl_set_boundary(par,0.1,0.9); +unur_tabl_set_guidefactor(par,5.); +unur_tabl_set_max_intervals(par,50); +unur_tabl_set_max_sqhratio(par,0.8); +unur_tabl_set_nstp(par,30); +unur_tabl_set_usedars(par,0); +unur_tabl_set_variant_splitmode(par,3); +unur_tabl_set_verify(par,TRUE); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "beta(3.,3.) & \ + method = tabl; areafraction = 0.25; boundary = (0.1,0.9); \ + guidefactor = 5; max_intervals = 50; max_sqhratio = 0.8; \ + nstp = 30; usedars = 0; variant_splitmode = 3; verify" ); + -->compare_sequence_gen + + +unur_free(gen); gen = NULL; +distr = unur_distr_beta(fpar,2); +par = unur_tabl_new(distr); +unur_tabl_set_slopes(par,slopes,2); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "beta(3.,3.) & \ + method = tabl; slopes = (0.5,-1,0.5,1),2 " ); + -->compare_sequence_gen + + +unur_free(gen); gen = NULL; +distr = unur_distr_beta(fpar,2); +par = unur_tabl_new(distr); +unur_tabl_set_usedars(par,TRUE); +unur_tabl_set_darsfactor(par,0.5); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "beta(3.,3.) & method = tabl; usedars=on; darsfactor=0.5" ); + -->compare_sequence_gen + + +############################################################################ + +[validate] + +[validate - generators:] + +# with DARS (default - immediate accatance) +par[0] = unur_tabl_new(@distr@); +unur_tabl_set_usedars(par,TRUE); + +# default, truncated +par[1] = unur_tabl_new(@distr@); +unur_tabl_chg_truncated(gen,0.5,0.9); + +# without DARS (immediate accatance) +par[2] = unur_tabl_new(@distr@); +unur_tabl_set_usedars(par,FALSE); + +# "classical" acceptance/rejection +par[3] = unur_tabl_new(@distr@); +unur_tabl_set_variant_ia(par,FALSE); + +# "classical" acceptance/rejection +par[4] = unur_tabl_new(@distr@); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_chg_truncated(gen,0.5,0.9); + +# give slopes of the distribution +{double slopes[4] = {0.,-0.5,0.,2.}; +par[5] = unur_tabl_new(@distr@); +unur_tabl_set_slopes(par,slopes,2);} + +# give construction points +{double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; +par[6] = unur_tabl_new(@distr@); +unur_tabl_set_cpoints(par,7,cpoints);} + +# give slopes of the distribution +{double slopes[6] = {1.,0.,2.,1.,3.,2.}; +par[7] = unur_tabl_new(@distr@); +unur_tabl_set_slopes(par,slopes,3);} + +{double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; +par[8] = unur_tabl_new(@distr@); +unur_tabl_set_slopes(par,slopes,4);} + +# dars disabled, ear disabled, urng_aux +par[9] = unur_tabl_new(@distr@); +unur_tabl_set_variant_ia(par,FALSE); +unur_tabl_set_usedars(par,FALSE); +unur_tabl_set_useear(par,FALSE); +unur_use_urng_aux_default(par); + + +[validate - distributions:] + +# Beta distributions +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); + +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); + +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); + +# Cauchy distributions +distr[7] = unur_distr_cauchy(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); + +# Exponential distributions +distr[23] = unur_distr_exponential(NULL,0); + +fpm[0] = 30.; +fpm[1] = -5.; +distr[24] = unur_distr_exponential(fpm,2); + +# Gamma distributions +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); + +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); + +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); + +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); + +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); + +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[16] = unur_distr_gamma(fpm,3); + +# Laplace distributions +distr[25] = unur_distr_laplace(NULL,0); + +fpm[0] = -10.; +fpm[1] = 100.; +distr[26] = unur_distr_laplace(fpm,2); + +# Normal distributions +distr[17] = unur_distr_normal(NULL,0); + +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); + +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); + +# Uniform distributions +distr[20] = unur_distr_uniform(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); + +# truncated distributions +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); + +# sawtooth distribution with continuous PDF +{ double domain[2] = {0., 3.}; +distr[27] = unur_distr_sawtooth_contpdf(domain, 2); } + +{ double domain[2] = {0., 5.}; +distr[28] = unur_distr_sawtooth_contpdf(domain, 2); } + +# sawtooth distribution with discontinuous PDF +{ double domain[2] = {0., 3.}; +distr[29] = unur_distr_sawtooth_discpdf(domain, 2); } + +{ double domain[2] = {-2., 2.}; +distr[30] = unur_distr_sawtooth_discpdf(domain, 2); } + + +# number of distributions: 31 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default (immediate acceptance) +# [1] ... default, truncated +# [2] ... without DARS +# [3] ... "classical" acceptance/rejection +# [4] ... "classical" acceptance/rejection, truncated +# [5] ... use slopes (-0.5, 0.) and (0.,2.) +# [6] ... give construction points +# [7] ... use slopes [for particular sawtooth distribution only] +# [8] ... use slopes [for particular sawtooth distribution only] +# [9] ... dars disabled, ear disabled, urng_aux +# +# [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] # distribution +#----------------------------------------------------------------------------- +x <0> + + + + + + + 0 0 + # beta (1, 2) + <1> + + + + + + + 0 0 + # beta (1, 5) +x <2> + + + + + + + 0 0 + # beta (1, 100) + <3> + + + + + 0 . 0 0 + # beta (3, 4) + <4> + . + + . 0 0 0 0 + # beta (5, 100) + <5> + + + + + 0 0 0 0 + # beta (500, 300) + <6> + + + + + 0 + 0 0 + # beta (5, 10, -3, 15) + <7> + + + + + 0 + 0 0 + # cauchy () + <8> + + + + + 0 + 0 0 + # cauchy (1, 20) + <23> + + + + + 0 + 0 0 + # exponential () + <24> + + + + + 0 + 0 0 + # exponential (30, -5) +x <9> + + + + + 0 + 0 0 + # gamma (1) + <10> + + + + + 0 + 0 0 + # gamma (2) + <11> + + + + + 0 + 0 0 + # gamma (3) + <12> + + + + + 0 0 0 0 + # gamma (10) +x<13> + . + + . 0 0 0 0 + # gamma (1000) + <14> + + + + + 0 - 0 0 + # gamma (5, 1000, 0) +x<15> + + + + + 0 0 0 0 + # gamma (5, 1e-05, 0) +x<16> + . + + . 0 0 0 0 + # gamma (5, 10, 100000) + <25> + + + + + 0 + 0 0 + # laplace () + <26> + + + + + 0 . 0 0 + # laplace (-10, 100) + <17> + + + + + 0 + 0 0 + # normal () +x<18> + . + + . 0 + 0 0 + # normal (1, 1e-05) + <19> + + + + + 0 + 0 0 + # normal (1, 1e+05) + <20> + + + + + + + + + + # uniform () + <21> + . + + . 0 + 0 0 + # uniform (1, 20) + + <22> + + + + + + + 0 0 + # cauchy () - truncated + + <27> 0 0 0 0 0 0 + 0 0 0 # sawtooth-cont (0,3) + <28> 0 0 0 0 0 0 0 0 0 0 # sawtooth-cont (0,5) + <29> 0 0 0 0 0 0 0 + 0 0 # sawtooth-disc (0,3) + <30> 0 0 0 0 0 0 0 0 + 0 # sawtooth-disc (-2,2) + + +[validate - verify hat:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default (immediate acceptance) +# [1] ... default, truncated +# [2] ... without DARS +# [3] ... "classical" acceptance/rejection +# [4] ... "classical" acceptance/rejection, truncated +# [5] ... use slopes (-0.5, 0.) and (0.,2.) +# [6] ... give construction points +# [7] ... use slopes [for particular sawtooth distribution only] +# [8] ... use slopes [for particular sawtooth distribution only] +# [9] ... dars disabled, ear disabled, urng_aux +# +# [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] # distribution +#----------------------------------------------------------------------------- +x <0> + . + + . + + . . . # beta (1, 2) + <1> + . + + . + + . . . # beta (1, 5) +x <2> + . + + . + + . . . # beta (1, 100) + <3> + . + + . . . . . . # beta (3, 4) + <4> + . + + . . . . . . # beta (5, 100) + <5> + . + + . . . . . . # beta (500, 300) + <6> + . + + . . . . . . # beta (5, 10, -3, 15) + <7> + . + + . . + . . . # cauchy () + <8> + . + + . . + . . . # cauchy (1, 20) + <23> + . + + . . + . . . # exponential () + <24> + . + + . . + . . . # exponential (30, -5) +x <9> + . + + . . + . . . # gamma (1) + <10> + . + + . . + . . . # gamma (2) + <11> + . + + . . + . . . # gamma (3) + <12> + . + + . . . . . . # gamma (10) +x<13> + . + + . . . . . . # gamma (1000) + <14> + . + + . . . . . . # gamma (5, 1000, 0) +x<15> + . + + . . . . . . # gamma (5, 1e-05, 0) +x<16> + . + + . . . . . . # gamma (5, 10, 100000) + <25> + . + + . . + . . . # laplace () + <26> + . + + . . - . . . # laplace (-10, 100) + <17> + . + + . . + . . . # normal () +x<18> + . + + . . + . . . # normal (1, 1e-05) + <19> + . + + . . + . . . # normal (1, 1e+05) + <20> + . + + . + + . . . # uniform () + <21> + . + + . . + . . . # uniform (1, 20) + + <22> + . + + . + + . . . # cauchy () - truncated + + <27> . . . . . . + . . . # sawtooth-cont (0,3) + <28> . . . . . . . . . . # sawtooth-cont (0,5) + <29> . . . . . . . . . . # sawtooth-disc (0,3) + <30> . . . . . . . . . . # sawtooth-disc (-2,2) + + +############################################################################# +############################################################################# + +[verbatim] + +/* pdf with negative value */ +double pdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ return (-x*x); } + +/* pdf with partial negative value */ +double pdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ return ((x>-0.89 && x<0.89) ? -1.: exp(-x*x)); } + +############################################################################# + diff --git a/vendor/unuran-1.11.0/tests/t_tdr.c b/vendor/unuran-1.11.0/tests/t_tdr.c new file mode 100644 index 0000000..3a65bdc --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_tdr.c @@ -0,0 +1,1236 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for TDR + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ +double pdf( double x, const UNUR_DISTR *distr ); + +double pdf_bimodal( double x, const UNUR_DISTR *distr ); +double dpdf_bimodal( double x, const UNUR_DISTR *distr ); + +double pdf_negative( double x, const UNUR_DISTR *distr ); +double dpdf_negative( double x, const UNUR_DISTR *distr ); + +double pdf_partnegative( double x, const UNUR_DISTR *distr ); +double dpdf_partnegative( double x, const UNUR_DISTR *distr ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* pdf of bimodal density */ +double pdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ( exp(-(x-1.)*(x-1.)) + exp(-(x+1.)*(x+1.)) ); +} +double dpdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ( -2. * (x-1.) * exp(-(x-1.)*(x-1.)) -2. * (x+1.) * exp(-(x+1.)*(x+1.)) ); +} + +/* pdf with negative value */ +double pdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-x*x); +} +double dpdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-2.*x); +} + +/* pdf with partial negative value */ +double pdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((x>-0.89 && x<0.89) ? -1.: exp(-x*x)); +} +double dpdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((x>-0.89 && x<0.89) ?0.: -2.*x*exp(-x*x)); +} + +/* pdf of normal density */ +double pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return exp(-x*x/2.); +} /* end of pdf */ + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,35,(unur_tdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,35,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,41,(unur_tdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,41,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +/* pdf, dpdf */ +n_tests_failed += (check_expected_NULL(TESTLOG,48,(unur_tdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,48,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* dpdf */ +unur_distr_cont_set_pdf(distr,pdf); +n_tests_failed += (check_expected_NULL(TESTLOG,53,(unur_tdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,63,(unur_tdr_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,66,(unur_tdr_set_reinit_percentiles( par, 0, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,69,(unur_tdr_set_guidefactor( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,69,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,72,(unur_tdr_set_max_sqhratio( par, 0.95 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,72,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,75,(unur_tdr_set_max_intervals( par, 100 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,75,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,78,(unur_tdr_set_usecenter( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,78,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,81,(unur_tdr_set_usemode( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,81,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,84,(unur_tdr_set_variant_gw( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,84,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,87,(unur_tdr_set_variant_ps( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,87,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,90,(unur_tdr_set_variant_ia( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,90,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,93,(unur_tdr_set_usedars( par, TRUE )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,93,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,96,(unur_tdr_set_darsfactor( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,96,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,99,(unur_tdr_set_c( par, -0.5 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,99,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,102,(unur_tdr_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,102,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,105,(unur_tdr_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,105,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,114,(unur_tdr_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,114,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,117,(unur_tdr_set_reinit_percentiles( par, 0, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,117,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,120,(unur_tdr_set_guidefactor( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,120,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,123,(unur_tdr_set_max_sqhratio( par, 0.95 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,123,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,126,(unur_tdr_set_max_intervals( par, 100 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,126,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,129,(unur_tdr_set_usecenter( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,129,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,132,(unur_tdr_set_usemode( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,132,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,135,(unur_tdr_set_variant_gw( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,135,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,138,(unur_tdr_set_variant_ps( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,138,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,141,(unur_tdr_set_variant_ia( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,141,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,144,(unur_tdr_set_usedars( par, TRUE )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,144,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,147,(unur_tdr_set_darsfactor( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,147,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,150,(unur_tdr_set_c( par, -0.5 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,150,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,153,(unur_tdr_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,153,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,156,(unur_tdr_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,156,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double perc[] = {0.1,0.4,0.2}; + double stp[] = {1.,0.,1.}; + int n_stp = 3; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_tdr_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,169,(unur_tdr_set_cpoints( par, -1, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,169,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,172,(unur_tdr_set_cpoints( par, n_stp, stp )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,172,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_tdr_set_reinit_percentiles( par, -1, NULL ); +n_tests_failed += (check_errorcode(TESTLOG,175,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,178,(unur_tdr_set_reinit_percentiles( par, n_stp, stp )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,178,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,181,(unur_tdr_set_reinit_percentiles( par, n_stp, perc )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,181,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,184,(unur_tdr_set_guidefactor( par, -1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,184,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,187,(unur_tdr_set_max_sqhratio( par, -1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,187,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,190,(unur_tdr_set_max_sqhratio( par, 2. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,190,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,193,(unur_tdr_set_max_intervals( par, 0 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,193,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,196,(unur_tdr_set_usedars( par, -1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,196,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,199,(unur_tdr_set_darsfactor( par, -1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,199,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,202,(unur_tdr_set_c( par, 0.5 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,202,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,205,(unur_tdr_set_c( par, -0.6 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,205,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_tdr_set_c( par, -0.3 ); +n_tests_failed += (check_errorcode(TESTLOG,208,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 218, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,222,(unur_tdr_get_sqhratio(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,222,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,225,(unur_tdr_get_hatarea(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,225,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,228,(unur_tdr_get_squeezearea(gen)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,228,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 239, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,243,(unur_tdr_chg_reinit_percentiles(gen, -1, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,243,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,246,(unur_tdr_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,246,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double percmon[] = {0.1,0.4,0.2}; + double percdom[] = {0.1,0.4,2.}; + int n_perc = 3; + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 255, gen ); + + +unur_reset_errno(); +unur_tdr_chg_reinit_percentiles( gen, -1, NULL ); +n_tests_failed += (check_errorcode(TESTLOG,259,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,262,(unur_tdr_chg_reinit_percentiles( gen, n_perc, percmon )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,262,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,265,(unur_tdr_chg_reinit_percentiles( gen, n_perc, percdom )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,265,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,276,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,276,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* stp out of domain */ +UNUR_GEN *gen = NULL; +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double stp[] = {-2.5,-1.,0.,1.,2.5}; + int n_stp = 5; + gen = NULL; + distr = unur_distr_normal(NULL,0); + unur_distr_cont_set_domain(distr,-2.,2.); + par = unur_tdr_new(distr); + unur_tdr_set_usedars(par,FALSE); + unur_tdr_set_cpoints( par, n_stp, stp ); + + +unur_reset_errno(); +gen = unur_init( par ); +n_tests_failed += (check_errorcode(TESTLOG,289,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; +unur_free(gen); +unur_distr_free(distr); +} + +{ /* bimodal */ +UNUR_GEN *gen = NULL; +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + gen = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_bimodal); + unur_distr_cont_set_dpdf(distr,dpdf_bimodal); + par = unur_tdr_new(distr); + unur_tdr_set_usedars(par,FALSE); + unur_tdr_set_cpoints( par, 30, NULL ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,301,(gen = unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,301,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_free(gen); +unur_distr_free(distr); +} + +{ /* wrong mode */ +UNUR_GEN *gen = NULL; +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + gen = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; + + +unur_reset_errno(); +unur_distr_cont_set_mode(distr,-1.); +par = unur_tdr_new(distr); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints( par, 30, NULL ); +n_tests_failed += (check_expected_NULL(TESTLOG,313,(gen = unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,313,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_distr_cont_set_mode(distr,1.); +par = unur_tdr_new(distr); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints( par, 30, NULL ); +gen = unur_init( par ); +n_tests_failed += (check_errorcode(TESTLOG,320,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; +unur_free(gen); +unur_distr_free(distr); +} + +{ /* negative value of pdf */ +UNUR_GEN *gen = NULL; +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + gen = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_negative); + unur_distr_cont_set_dpdf(distr,dpdf_negative); + par = NULL; + + +unur_reset_errno(); +par = unur_tdr_new(distr); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints( par, 30, NULL ); +n_tests_failed += (check_expected_NULL(TESTLOG,333,(gen = unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,333,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_distr_cont_set_domain(distr,-2.,2.); +par = unur_tdr_new(distr); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints( par, 30, NULL ); +n_tests_failed += (check_expected_NULL(TESTLOG,340,(gen = unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,340,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; +unur_free(gen); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 348, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,352,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,362,(unur_tdr_eval_invcdfhat(gen,0.5,NULL,NULL,NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,362,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 368, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,372,(unur_tdr_eval_invcdfhat(gen,0.5,NULL,NULL,NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,372,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid domain */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 379, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,383,(unur_tdr_eval_invcdfhat(gen,1.5,NULL,NULL,NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,383,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_negINFINITY(TESTLOG,386,(unur_tdr_eval_invcdfhat(gen,-0.5,NULL,NULL,NULL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,386,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* partial negative value of pdf */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + int i; + double x; + double stp[] = {-0.9,0.9}; + int n_stp = 2; + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_partnegative); + unur_distr_cont_set_dpdf(distr,dpdf_partnegative); + par = unur_tdr_new(distr); + unur_tdr_set_usedars(par,FALSE); + unur_tdr_set_usecenter(par,FALSE); + unur_tdr_set_cpoints( par, n_stp, stp ); + unur_tdr_set_pedantic( par, 1 ); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 402, gen ); + + +unur_reset_errno(); +for (i=0; i<100; i++) { x = unur_sample_cont(gen); } +n_tests_failed += (check_expected_INFINITY(TESTLOG,407,(x))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,407,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; + + +unur_reset_errno(); +/* GW, c = -0.5 */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +n_tests_failed += (compare_sequence_par_start(TESTLOG,422,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* GW, c = -0.5 - verifying mode */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_verify(par,1); +unur_tdr_set_usedars(par,FALSE); +n_tests_failed += (compare_sequence_par(TESTLOG,430,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* PS, c = -0.5 */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +n_tests_failed += (compare_sequence_par_start(TESTLOG,437,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* PS, c = -0.5 - verifying mode */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_verify(par,1); +unur_tdr_set_usedars(par,FALSE); +n_tests_failed += (compare_sequence_par(TESTLOG,445,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* IA, c = -0.5 */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +n_tests_failed += (compare_sequence_par_start(TESTLOG,452,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* IA, c = -0.5 - verifying mode */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_verify(par,1); +unur_tdr_set_usedars(par,FALSE); +n_tests_failed += (compare_sequence_par(TESTLOG,460,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* GW, c = 0 */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +n_tests_failed += (compare_sequence_par_start(TESTLOG,470,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* GW, c = 0, verifying mode */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_verify(par,1); +unur_tdr_set_usedars(par,FALSE); +n_tests_failed += (compare_sequence_par(TESTLOG,478,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* PS, c = 0 */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +n_tests_failed += (compare_sequence_par_start(TESTLOG,485,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* PS, c = 0, verifying mode */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_verify(par,1); +unur_tdr_set_usedars(par,FALSE); +n_tests_failed += (compare_sequence_par(TESTLOG,493,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* IA, c = 0 */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +n_tests_failed += (compare_sequence_par_start(TESTLOG,500,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* IA, c = 0, verifying mode */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_verify(par,1); +unur_tdr_set_usedars(par,FALSE); +n_tests_failed += (compare_sequence_par(TESTLOG,508,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_tdr_new(distr); +unur_tabl_set_max_sqhratio(par,0.); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,522,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,528,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {3.,3.}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_gamma(fpar,2); +unur_distr_cont_set_center(distr,2.1); +par = unur_tdr_new(distr); +unur_tdr_set_cpoints(par,20,NULL); +unur_tdr_set_guidefactor(par,2.); +unur_tdr_set_max_intervals(par,32); +unur_tdr_set_max_sqhratio(par,0.9); +unur_tdr_set_usecenter(par,TRUE); +unur_tdr_set_verify(par,TRUE); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,548,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.); center = 2.1 & \ + method = tdr; usecenter; cpoints = 20; guidefactor = 2.; \ + max_intervals = 32; max_sqhratio = 0.9; verify" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,555,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_gamma(fpar,2); +par = unur_tdr_new(distr); +unur_tdr_set_cpoints(par,9,NULL); +unur_tdr_set_pedantic(par,TRUE); +unur_tdr_set_usemode(par,FALSE); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,565,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & \ + method = tdr; cpoints = 9; pedantic; usemode = false" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,571,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_gamma(fpar,2); +par = unur_tdr_new(distr); +unur_tdr_set_c(par,0.); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,579,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & \ + method = tdr; c = 0." ); +n_tests_failed += (compare_sequence_gen(TESTLOG,585,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_gamma(fpar,2); +par = unur_tdr_new(distr); +unur_tdr_set_c(par,-0.5); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,593,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & \ + method = tdr; c = -0.5" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,599,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_gamma(fpar,2); +par = unur_tdr_new(distr); +unur_tdr_set_variant_gw(par); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,607,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & \ + method = tdr; variant_gw" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,613,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_gamma(fpar,2); +par = unur_tdr_new(distr); +unur_tdr_set_variant_ia(par); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,621,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & \ + method = tdr; variant_ia" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,627,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +distr = unur_distr_gamma(fpar,2); +par = unur_tdr_new(distr); +unur_tdr_set_variant_ps(par); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,635,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & \ + method = tdr; variant_ps" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,641,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_tdr_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_tdr.conf b/vendor/unuran-1.11.0/tests/t_tdr.conf new file mode 100644 index 0000000..3f448fe --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_tdr.conf @@ -0,0 +1,688 @@ +############################################################################# + +[main] + +[main - data:] + +# method +method: TDR + +[main - header:] + +/* prototypes */ +double pdf( double x, const UNUR_DISTR *distr ); + +double pdf_bimodal( double x, const UNUR_DISTR *distr ); +double dpdf_bimodal( double x, const UNUR_DISTR *distr ); + +double pdf_negative( double x, const UNUR_DISTR *distr ); +double dpdf_negative( double x, const UNUR_DISTR *distr ); + +double pdf_partnegative( double x, const UNUR_DISTR *distr ); +double dpdf_partnegative( double x, const UNUR_DISTR *distr ); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_cont_new(); ] + +/* pdf, dpdf */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +/* dpdf */ +unur_distr_cont_set_pdf(distr,pdf); +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_cpoints( par, 0, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_reinit_percentiles( par, 0, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_guidefactor( par, 1. ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_max_sqhratio( par, 0.95 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_max_intervals( par, 100 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_usecenter( par, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_usemode( par, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_variant_gw( par ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_variant_ps( par ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_variant_ia( par ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_usedars( par, TRUE ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_darsfactor( par, 1. ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_c( par, -0.5 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_verify( par, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_pedantic( par, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameter object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); ] + +~_cpoints( par, 0, NULL ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_reinit_percentiles( par, 0, NULL ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_guidefactor( par, 1. ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_max_sqhratio( par, 0.95 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_max_intervals( par, 100 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_usecenter( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_usemode( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_variant_gw( par ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_variant_ps( par ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_variant_ia( par ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_usedars( par, TRUE ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_darsfactor( par, 1. ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_c( par, -0.5 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_verify( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_pedantic( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + +[set - invalid parameters: + double perc[] = {0.1,0.4,0.2}; + double stp[] = {1.,0.,1.}; + int n_stp = 3; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_tdr_new(distr); ] + +~_cpoints( par, -1, NULL ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_cpoints( par, n_stp, stp ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_reinit_percentiles( par, -1, NULL ); + --> none --> UNUR_ERR_PAR_SET + +~_reinit_percentiles( par, n_stp, stp ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_reinit_percentiles( par, n_stp, perc ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_guidefactor( par, -1. ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_max_sqhratio( par, -1. ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_max_sqhratio( par, 2. ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_max_intervals( par, 0 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_usedars( par, -1 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_darsfactor( par, -1. ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_c( par, 0.5 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_c( par, -0.6 ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_c( par, -0.3 ); + --> none --> UNUR_ERR_PAR_SET + +unur_par_free(par); + +############################################################################# + +[get] + +[get - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init(par); <-- ! NULL ] + +~_sqhratio(gen); + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + +~_hatarea(gen); + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + +~_squeezearea(gen); + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + + +############################################################################# + +[chg] + +[chg - invalid generator object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_reinit_percentiles(gen, -1, NULL ); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +~_verify(gen,1); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + + +[chg - invalid parameters: + double percmon[] = {0.1,0.4,0.2}; + double percdom[] = {0.1,0.4,2.}; + int n_perc = 3; + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_reinit_percentiles( gen, -1, NULL ); + --> none --> UNUR_ERR_PAR_SET + +~_reinit_percentiles( gen, n_perc, percmon ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_reinit_percentiles( gen, n_perc, percdom ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + +[init - stp out of domain: + double stp[] = {-2.5,-1.,0.,1.,2.5}; + int n_stp = 5; + gen = NULL; + distr = unur_distr_normal(NULL,0); + unur_distr_cont_set_domain(distr,-2.,2.); + par = unur_tdr_new(distr); + unur_tdr_set_usedars(par,FALSE); + unur_tdr_set_cpoints( par, n_stp, stp ); ] + +gen = unur_init( par ); + --> none --> UNUR_ERR_GEN_DATA + +[init - bimodal: + gen = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_bimodal); + unur_distr_cont_set_dpdf(distr,dpdf_bimodal); + par = unur_tdr_new(distr); + unur_tdr_set_usedars(par,FALSE); + unur_tdr_set_cpoints( par, 30, NULL ); ] + +gen = unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_CONDITION + +[init - wrong mode: + gen = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; ] + +unur_distr_cont_set_mode(distr,-1.); +par = unur_tdr_new(distr); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints( par, 30, NULL ); +gen = unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_DATA + +unur_distr_cont_set_mode(distr,1.); +par = unur_tdr_new(distr); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints( par, 30, NULL ); +gen = unur_init( par ); + --> none --> UNUR_ERR_GEN_DATA + +[init - negative value of pdf: + gen = NULL; + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_negative); + unur_distr_cont_set_dpdf(distr,dpdf_negative); + par = NULL; ] + +par = unur_tdr_new(distr); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints( par, 30, NULL ); +gen = unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_DATA + +unur_distr_cont_set_domain(distr,-2.,2.); +par = unur_tdr_new(distr); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints( par, 30, NULL ); +gen = unur_init( par ); + --> expected_NULL --> UNUR_ERR_GEN_DATA + +############################################################################# + +[reinit] + +[reinit - exist: + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - invalid NULL ptr: + gen = NULL; ] + +unur_tdr_eval_invcdfhat(gen,0.5,NULL,NULL,NULL); + --> expected_INFINITY --> UNUR_ERR_NULL + +#..................................................................... + +[sample - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init(par); <-- ! NULL ] + +unur_tdr_eval_invcdfhat(gen,0.5,NULL,NULL,NULL); + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + +#..................................................................... + +[sample - invalid domain: + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +unur_tdr_eval_invcdfhat(gen,1.5,NULL,NULL,NULL); + --> expected_INFINITY --> UNUR_ERR_DOMAIN + +unur_tdr_eval_invcdfhat(gen,-0.5,NULL,NULL,NULL); + --> expected_negINFINITY --> UNUR_ERR_DOMAIN + +#..................................................................... + +[sample - partial negative value of pdf: + int i; + double x; + double stp[] = {-0.9,0.9}; + int n_stp = 2; + distr = unur_distr_cont_new(); + unur_distr_cont_set_pdf(distr,pdf_partnegative); + unur_distr_cont_set_dpdf(distr,dpdf_partnegative); + par = unur_tdr_new(distr); + unur_tdr_set_usedars(par,FALSE); + unur_tdr_set_usecenter(par,FALSE); + unur_tdr_set_cpoints( par, n_stp, stp ); + unur_tdr_set_pedantic( par, 1 ); + gen = unur_init( par ); <-- ! NULL ] + +for (i=0; i<100; i++) { x = unur_sample_cont(gen); } +x; + --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION + +#..................................................................... + +[sample - compare: + distr = unur_distr_normal(NULL,0); + par = NULL; ] + +# T = -1/sqrt + +/* GW, c = -0.5 */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); + -->compare_sequence_par_start + +/* GW, c = -0.5 - verifying mode */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_verify(par,1); +unur_tdr_set_usedars(par,FALSE); + -->compare_sequence_par + +/* PS, c = -0.5 */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); + -->compare_sequence_par_start + +/* PS, c = -0.5 - verifying mode */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_verify(par,1); +unur_tdr_set_usedars(par,FALSE); + -->compare_sequence_par + +/* IA, c = -0.5 */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); + -->compare_sequence_par_start + +/* IA, c = -0.5 - verifying mode */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_verify(par,1); +unur_tdr_set_usedars(par,FALSE); + -->compare_sequence_par + + +# T = log + +/* GW, c = 0 */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); + -->compare_sequence_par_start + +/* GW, c = 0, verifying mode */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_verify(par,1); +unur_tdr_set_usedars(par,FALSE); + -->compare_sequence_par + +/* PS, c = 0 */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); + -->compare_sequence_par_start + +/* PS, c = 0, verifying mode */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_verify(par,1); +unur_tdr_set_usedars(par,FALSE); + -->compare_sequence_par + +/* IA, c = 0 */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); + -->compare_sequence_par_start + +/* IA, c = 0, verifying mode */ +par = unur_tdr_new(distr); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_verify(par,1); +unur_tdr_set_usedars(par,FALSE); + -->compare_sequence_par + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_tdr_new(distr); +unur_tabl_set_max_sqhratio(par,0.); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + double fpar[2] = {3.,3.}; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_gamma(fpar,2); +unur_distr_cont_set_center(distr,2.1); +par = unur_tdr_new(distr); +unur_tdr_set_cpoints(par,20,NULL); +unur_tdr_set_guidefactor(par,2.); +unur_tdr_set_max_intervals(par,32); +unur_tdr_set_max_sqhratio(par,0.9); +unur_tdr_set_usecenter(par,TRUE); +unur_tdr_set_verify(par,TRUE); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.); center = 2.1 & \ + method = tdr; usecenter; cpoints = 20; guidefactor = 2.; \ + max_intervals = 32; max_sqhratio = 0.9; verify" ); + -->compare_sequence_gen + + +unur_free(gen); gen = NULL; +distr = unur_distr_gamma(fpar,2); +par = unur_tdr_new(distr); +unur_tdr_set_cpoints(par,9,NULL); +unur_tdr_set_pedantic(par,TRUE); +unur_tdr_set_usemode(par,FALSE); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & \ + method = tdr; cpoints = 9; pedantic; usemode = false" ); + -->compare_sequence_gen + + +unur_free(gen); gen = NULL; +distr = unur_distr_gamma(fpar,2); +par = unur_tdr_new(distr); +unur_tdr_set_c(par,0.); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & \ + method = tdr; c = 0." ); + -->compare_sequence_gen + + +unur_free(gen); gen = NULL; +distr = unur_distr_gamma(fpar,2); +par = unur_tdr_new(distr); +unur_tdr_set_c(par,-0.5); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & \ + method = tdr; c = -0.5" ); + -->compare_sequence_gen + + +unur_free(gen); gen = NULL; +distr = unur_distr_gamma(fpar,2); +par = unur_tdr_new(distr); +unur_tdr_set_variant_gw(par); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & \ + method = tdr; variant_gw" ); + -->compare_sequence_gen + + +unur_free(gen); gen = NULL; +distr = unur_distr_gamma(fpar,2); +par = unur_tdr_new(distr); +unur_tdr_set_variant_ia(par); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & \ + method = tdr; variant_ia" ); + -->compare_sequence_gen + + +unur_free(gen); gen = NULL; +distr = unur_distr_gamma(fpar,2); +par = unur_tdr_new(distr); +unur_tdr_set_variant_ps(par); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & \ + method = tdr; variant_ps" ); + -->compare_sequence_gen + + +############################################################################# + +# [validate] + +############################################################################# + +[verbatim] + +/* pdf of bimodal density */ +double pdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ( exp(-(x-1.)*(x-1.)) + exp(-(x+1.)*(x+1.)) ); +} +double dpdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ( -2. * (x-1.) * exp(-(x-1.)*(x-1.)) -2. * (x+1.) * exp(-(x+1.)*(x+1.)) ); +} + +/* pdf with negative value */ +double pdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-x*x); +} +double dpdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-2.*x); +} + +/* pdf with partial negative value */ +double pdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((x>-0.89 && x<0.89) ? -1.: exp(-x*x)); +} +double dpdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((x>-0.89 && x<0.89) ?0.: -2.*x*exp(-x*x)); +} + +/* pdf of normal density */ +double pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return exp(-x*x/2.); +} /* end of pdf */ + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_tdr_gw.c b/vendor/unuran-1.11.0/tests/t_tdr_gw.c new file mode 100644 index 0000000..c015c86 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_tdr_gw.c @@ -0,0 +1,10542 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for TDR + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt */ +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ +double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x -= 1000.; + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[32]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 32 */ +{ +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 2.; +fpm[1] = 5.; +distr[30] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 2.; +distr[31] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); +} + +{ +distr[7] = unur_distr_cauchy(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); +} + +{ +distr[24] = unur_distr_exponential(NULL,0); +} + +{ +fpm[0] = 30.; +fpm[1] = -5.; +distr[25] = unur_distr_exponential(fpm,2); +} + +{ +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000.; +distr[16] = unur_distr_gamma(fpm,3); +} + +{ +distr[26] = unur_distr_laplace(NULL,0); +} + +{ +fpm[0] = -10.; +fpm[1] = 100.; +distr[27] = unur_distr_laplace(fpm,2); +} + +{ +distr[17] = unur_distr_normal(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); +} + +{ +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); +} + +{ +distr[20] = unur_distr_uniform(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); +} + +{ +distr[28] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[28],pdf_sqrtlin); +unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlin); +unur_distr_cont_set_cdf(distr[28],cdf_sqrtlin); +unur_distr_set_name(distr[28],"sqrtlin"); +} + +{ +distr[29] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[29],pdf_sqrtlinshft); +unur_distr_cont_set_dpdf(distr[29],dpdf_sqrtlinshft); +unur_distr_cont_set_cdf(distr[29],cdf_sqrtlinshft); +unur_distr_set_name(distr[29],"sqrtlin"); +} + +{ +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[23] = unur_distr_beta(fpm,2); +unur_distr_cont_set_domain(distr[23],-2.,5.); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 288 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [31] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [29] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 288 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [31] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [28] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [29] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + unur_distr_free(distr[30]); + unur_distr_free(distr[31]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_tdr_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_tdr_gw.conf b/vendor/unuran-1.11.0/tests/t_tdr_gw.conf new file mode 100644 index 0000000..04f2e61 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_tdr_gw.conf @@ -0,0 +1,438 @@ +############################################################################# + +[main] + +[main - data:] + +# method +method: TDR + +[main - header:] + +/* prototypes */ + +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +############################################################################# + +# [set] + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################# + +# [init] + +############################################################################# + +# [reinit] + +############################################################################# + +[validate] + +[validate - generators:] + +# sqrt, GW +par[0] = unur_tdr_new(@distr@); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); + +# sqrt, GW, few starting points, ARS +par[1] = unur_tdr_new(@distr@); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + +# sqrt, GW, few construction points +par[2] = unur_tdr_new(@distr@); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + +# sqrt, GW, truncated +par[3] = unur_tdr_new(@distr@); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_chg_truncated(gen,0.5,0.9); + +# log, GW +par[4] = unur_tdr_new(@distr@); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); + +# log, GW, few starting points, ARS +par[5] = unur_tdr_new(@distr@); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + +# log, GW, few construction points +par[6] = unur_tdr_new(@distr@); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + +# reinit, sqrt, GW +par[7] = unur_tdr_new(@distr@); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(@distr@,fpm,2); +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + +# reinit, log, GW +par[8] = unur_tdr_new(@distr@); +unur_tdr_set_variant_gw(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,20,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(@distr@,fpm,2); +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + + + +[validate - distributions:] + +# Beta distributions +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); + +fpm[0] = 2.; +fpm[1] = 5.; +distr[30] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 2.; +distr[31] = unur_distr_beta(fpm,2); + +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); + +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); + +# Cauchy distributions +distr[7] = unur_distr_cauchy(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); + +# Exponential distributions +distr[24] = unur_distr_exponential(NULL,0); + +fpm[0] = 30.; +fpm[1] = -5.; +distr[25] = unur_distr_exponential(fpm,2); + +# Gamma distributions +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); + +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); + +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); + +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); + +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); + +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000.; +distr[16] = unur_distr_gamma(fpm,3); + +# Laplace distributions +distr[26] = unur_distr_laplace(NULL,0); + +fpm[0] = -10.; +fpm[1] = 100.; +distr[27] = unur_distr_laplace(fpm,2); + +# Normal distributions +distr[17] = unur_distr_normal(NULL,0); + +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); + +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); + +# Uniform distributions +distr[20] = unur_distr_uniform(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); + +# pdf with piecewise linear function as transformed density with T = -1/sqrt +distr[28] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[28],pdf_sqrtlin); +unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlin); +unur_distr_cont_set_cdf(distr[28],cdf_sqrtlin); +unur_distr_set_name(distr[28],"sqrtlin"); + +# pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode +distr[29] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[29],pdf_sqrtlinshft); +unur_distr_cont_set_dpdf(distr[29],dpdf_sqrtlinshft); +unur_distr_cont_set_cdf(distr[29],cdf_sqrtlinshft); +unur_distr_set_name(distr[29],"sqrtlin"); + +# truncated distributions +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); + +# domain exceeds support of pdf +fpm[0] = 3.; +fpm[1] = 4.; +distr[23] = unur_distr_beta(fpm,2); +unur_distr_cont_set_domain(distr[23],-2.,5.); + + +# number of distributions: 32 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] sqrt, GW +# [1] sqrt, GW, few starting points, ARS +# [2] sqrt, GW, few construction points +# [3] sqrt, GW, truncated +# [4] log, GW +# [5] log, GW, few starting points, ARS +# [6] log, GW, few construction points +# [7] reinit, log, GW +# [8] reinit, sqrt, GW +# +# +# 0 1 2 3 4 5 6 7 8 # distribution +#----------------------------------------------------- +x <0> + + + + + + + + + # beta (1, 2) + <1> + + + + + + + . . # beta (1, 5) +x <2> + + + + + + + + + # beta (1, 100) + <30> + + + + + + + . . # beta (2, 5) + <31> + + + + + + + + + # beta (5, 2) + <3> + + + + + + + . . # beta (3, 4) + <4> + + + + + + + . . # beta (5, 100) + <5> + + + + + + + + + # beta (500, 300) + <6> + + + + + + + + + # beta (5, 10, -3, 15) + <7> + + + + 0 - - + 0 # cauchy () + <8> + + + + 0 - - + 0 # cauchy (1, 20) + <24> + + + + + + + + + # exponential () + <25> + + + + + + + + + # exponential (30, -5) +x <9> + + + + + + + . . # gamma (1) + <10> + + + + + + + . . # gamma (2) + <11> + + + + + + + + + # gamma (3) + <12> + + + x+ + + + . . # gamma (10) +x<13> + + + . + + + . . # gamma (1000) + <14> + + + . + + + . . # gamma (5, 1000, 0) +x<15> + + + . + + + . . # gamma (5, 1e-05, 0) +x<16> + + + . + + + . . # gamma (5, 10, 1000) + <26> + + + + + + + + + # laplace () + <27> + + + + + + + . . # laplace (-10, 100) + <17> + + + + + + + + + # normal () +x<18> + + + + + + + + + # normal (1, 1e-05) + <19> + + + + + + + + + # normal (1, 1e+05) + <20> + + + + + + + + + # uniform () + <21> + + + + + + + . . # uniform (1, 20) + + <22> + + + + + + + . . # cauchy () - truncated + <23> + + + + + + + . . # beta () - domain superset of support + <28> + + + + 0 0 0 . . # sqrtlin + <29> + + + + 0 0 0 . . # sqrtlin with shifted mode + + +# sqrtlin ... pdf with piecewise linear function as +# transformed density with T = -1/sqrt + +[validate - verify hat:] + +# + ... pass test +# ~ ... fail in at most 1% of samples +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] sqrt, GW +# [1] sqrt, GW, few starting points, ARS +# [2] sqrt, GW, few construction points +# [3] sqrt, GW, truncated +# [4] log, GW +# [5] log, GW, few starting points, ARS +# [6] log, GW, few construction points +# [7] reinit, log, GW +# [8] reinit, sqrt, GW +# +# +# 0 1 2 3 4 5 6 7 8 # distribution +#----------------------------------------------------- +x <0> + + + + + + + + + # beta (1, 2) + <1> + + + + + + + . . # beta (1, 5) +x <2> + + + + + + + + + # beta (1, 100) + <30> + + + + + + + . . # beta (2, 5) + <31> + + + + + + + + + # beta (5, 2) + <3> + + + + + + + . . # beta (3, 4) + <4> + + + + + + + . . # beta (5, 100) + <5> + + + + + + + + + # beta (500,300) + <6> + + + + + + + + + # beta (5, 10, -3, 15) + <7> + + + + 0 - - + 0 # cauchy () + <8> + + + + 0 - - + 0 # cauchy (1, 20) + <24> + + + + + + + + + # exponential () + <25> + + + + + + + + + # exponential (30, -5) +x <9> + + + + + + + . . # gamma (1) + <10> + + + + + + + . . # gamma (2) + <11> + + + + + + + + + # gamma (3) + <12> + + + x+ + + + + + # gamma (10) +x<13> + + + . + + + . . # gamma (1000) + <14> + + + . + + + . . # gamma (5, 1000, 0) +x<15> + + + . + + + . . # gamma (5, 1e-05, 0) +x<16> + + + . + + + . . # gamma (5, 10, 100000) + <26> + + + + + + + + + # laplace () + <27> + + + + + + + . . # laplace (-10, 100) + <17> + + + + + + + + + # normal () +x<18> + + + + + + + + + # normal (1, 1e-05) + <19> + + + + + + x+ + + # normal (1, 1e+05) + <20> + + + + + + + + + # uniform () + <21> + + + + + + + . . # uniform (1, 20) + + <22> + + + + + + + . . # cauchy () - truncated + <23> + + + + + + + . . # beta () - domain superset of support +x<28> + + + + 0 0 0 . . # sqrtlin + <29> . . . . . . . . . # sqrtlin with shifted mode + + +# sqrtlin ... pdf with piecewise linear function as +# transformed density with T = -1/sqrt + + +############################################################################# +############################################################################# + +[verbatim] + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt */ +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ +double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x -= 1000.; + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_tdr_ia.c b/vendor/unuran-1.11.0/tests/t_tdr_ia.c new file mode 100644 index 0000000..8825553 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_tdr_ia.c @@ -0,0 +1,6974 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for TDR + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt */ +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ +double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x -= 1000.; + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[32]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 32 */ +{ +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 2.; +fpm[1] = 5.; +distr[30] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 2.; +distr[31] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); +} + +{ +distr[7] = unur_distr_cauchy(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); +} + +{ +distr[24] = unur_distr_exponential(NULL,0); +} + +{ +fpm[0] = 30.; +fpm[1] = -5.; +distr[25] = unur_distr_exponential(fpm,2); +} + +{ +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000.; +distr[16] = unur_distr_gamma(fpm,3); +} + +{ +distr[26] = unur_distr_laplace(NULL,0); +} + +{ +fpm[0] = -10.; +fpm[1] = 100.; +distr[27] = unur_distr_laplace(fpm,2); +} + +{ +distr[17] = unur_distr_normal(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); +} + +{ +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); +} + +{ +distr[20] = unur_distr_uniform(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); +} + +{ +distr[28] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[28],pdf_sqrtlin); +unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlin); +unur_distr_cont_set_cdf(distr[28],cdf_sqrtlin); +unur_distr_set_name(distr[28],"sqrtlin"); +} + +{ +distr[29] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[29],pdf_sqrtlinshft); +unur_distr_cont_set_dpdf(distr[29],dpdf_sqrtlinshft); +unur_distr_cont_set_cdf(distr[29],cdf_sqrtlinshft); +unur_distr_set_name(distr[29],"sqrtlin"); +} + +{ +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[23] = unur_distr_beta(fpm,2); +unur_distr_cont_set_domain(distr[23],-2.,5.); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 192 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [31] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [29] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 192 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [31] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [29] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + unur_distr_free(distr[30]); + unur_distr_free(distr[31]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_tdr_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_tdr_ia.conf b/vendor/unuran-1.11.0/tests/t_tdr_ia.conf new file mode 100644 index 0000000..caa2b98 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_tdr_ia.conf @@ -0,0 +1,410 @@ +############################################################################# + +[main] + +[main - data:] + +# method +method: TDR + +[main - header:] + +/* prototypes */ + +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +############################################################################# + +# [set] + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################# + +# [init] + +############################################################################# + +# [reinit] + +############################################################################# + +[validate] + +[validate - generators:] + +# sqrt, IA +par[0] = unur_tdr_new(@distr@); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); + +# sqrt, IA, few starting points, ARS +par[1] = unur_tdr_new(@distr@); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + +# sqrt, IA, few construction points +par[2] = unur_tdr_new(@distr@); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + +# log, IA +par[3] = unur_tdr_new(@distr@); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); + +# reinit, sqrt, IA +par[4] = unur_tdr_new(@distr@); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(@distr@,fpm,2); +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + +# reinit, log, IA +par[5] = unur_tdr_new(@distr@); +unur_tdr_set_variant_ia(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,30,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(@distr@,fpm,2); +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + + +[validate - distributions:] + +# Beta distributions +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); + +fpm[0] = 2.; +fpm[1] = 5.; +distr[30] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 2.; +distr[31] = unur_distr_beta(fpm,2); + +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); + +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); + +# Cauchy distributions +distr[7] = unur_distr_cauchy(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); + +# Exponential distributions +distr[24] = unur_distr_exponential(NULL,0); + +fpm[0] = 30.; +fpm[1] = -5.; +distr[25] = unur_distr_exponential(fpm,2); + +# Gamma distributions +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); + +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); + +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); + +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); + +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); + +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000.; +distr[16] = unur_distr_gamma(fpm,3); + +# Laplace distributions +distr[26] = unur_distr_laplace(NULL,0); + +fpm[0] = -10.; +fpm[1] = 100.; +distr[27] = unur_distr_laplace(fpm,2); + +# Normal distributions +distr[17] = unur_distr_normal(NULL,0); + +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); + +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); + +# Uniform distributions +distr[20] = unur_distr_uniform(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); + +# pdf with piecewise linear function as transformed density with T = -1/sqrt +distr[28] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[28],pdf_sqrtlin); +unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlin); +unur_distr_cont_set_cdf(distr[28],cdf_sqrtlin); +unur_distr_set_name(distr[28],"sqrtlin"); + +# pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode +distr[29] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[29],pdf_sqrtlinshft); +unur_distr_cont_set_dpdf(distr[29],dpdf_sqrtlinshft); +unur_distr_cont_set_cdf(distr[29],cdf_sqrtlinshft); +unur_distr_set_name(distr[29],"sqrtlin"); + +# truncated distributions +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); + +# domain exceeds support of pdf +fpm[0] = 3.; +fpm[1] = 4.; +distr[23] = unur_distr_beta(fpm,2); +unur_distr_cont_set_domain(distr[23],-2.,5.); + + +# number of distributions: 32 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] sqrt, IA +# [1] sqrt, IA, few starting points, ARS +# [2] sqrt, IA, few construction points +# [3] log, IA +# [4] reinit, log, IA +# [5] reinit, sqrt, IA +# +# +# 0 1 2 3 4 5 # distribution +#--------------------------------------------- +x <0> + + + + + + # beta (1, 2) + <1> + + + + . . # beta (1, 5) +x <2> + + + + + + # beta (1, 100) + <30> + + + + . . # beta (2, 5) + <31> + + + + + + # beta (5, 2) + <3> + + + + . . # beta (3, 4) + <4> + + + + . . # beta (5, 100) + <5> + + + + + + # beta (500, 300) + <6> + + + + + + # beta (5, 10, -3, 15) + <7> + + + 0 + 0 # cauchy () + <8> + + + 0 + 0 # cauchy (1, 20) + <24> + + + + + + # exponential () + <25> + + + + + + # exponential (30, -5) +x <9> + + + + . . # gamma (1) + <10> + + + + + + # gamma (2) + <11> + + + + . . # gamma (3) + <12> + + + + . . # gamma (10) +x<13> + + + + . . # gamma (1000) + <14> + + + + . . # gamma (5, 1000, 0) +x<15> + + + + . . # gamma (5, 1e-05, 0) +x<16> + + + + . . # gamma (5, 10, 1000) + <26> + + + + + + # laplace () + <27> + + + + + + # laplace (-10, 100) + <17> + + + + + + # normal () +x<18> + + + + + + # normal (1, 1e-05) + <19> + + + + + + # normal (1, 1e+05) + <20> + + + + + + # uniform () + <21> + + + + . . # uniform (1, 20) + + <22> + + + + . . # cauchy () - truncated + <23> + + + + . . # beta () - domain superset of support + <28> + + + 0 . . # sqrtlin + <29> + + + 0 . . # sqrtlin with shifted mode + + +# sqrtlin ... pdf with piecewise linear function as +# transformed density with T = -1/sqrt + +[validate - verify hat:] + +# + ... pass test +# ~ ... fail in at most 1% of samples +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] sqrt, IA +# [1] sqrt, IA, few starting points, ARS +# [2] sqrt, IA, few construction points +# [3] log, IA +# [4] reinit, log, IA +# [5] reinit, sqrt, IA +# +# +# 0 1 2 3 4 5 # distribution +#--------------------------------------------- +x <0> + + + + + + # beta (1, 2) + <1> + + + + . . # beta (1, 5) +x <2> + + + + + + # beta (1, 100) + <30> + + + + . . # beta (2, 5) + <31> + + + + + + # beta (5, 2) + <3> + + + + . . # beta (3, 4) + <4> + + + + . . # beta (5, 100) + <5> + + + + + + # beta (500,300) + <6> + + + + + + # beta (5, 10, -3, 15) + <7> + + + 0 + 0 # cauchy () + <8> + + + 0 + 0 # cauchy (1, 20) + <24> + + + + + + # exponential () + <25> + + + + + + # exponential (30, -5) +x <9> + + + + . . # gamma (1) + <10> + + + + . . # gamma (2) + <11> + + + + + + # gamma (3) + <12> + + + + . . # gamma (10) +x<13> + + + + . . # gamma (1000) + <14> + + + + . . # gamma (5, 1000, 0) +x<15> + + + + . . # gamma (5, 1e-05, 0) +x<16> + + + + . . # gamma (5, 10, 100000) + <26> + + + + + + # laplace () + <27> + + + + + + # laplace (-10, 100) + <17> + + + + + + # normal () +x<18> + + + + . . # normal (1, 1e-05) + <19> + + + + . . # normal (1, 1e+05) + <20> + + + + + + # uniform () + <21> + + + + . . # uniform (1, 20) + + <22> + + + + . . # cauchy () - truncated + <23> + + + + . . # beta () - domain superset of support + <28> + + + . . . # sqrtlin + <29> . . . . . . # sqrtlin with shifted mode + + +# sqrtlin ... pdf with piecewise linear function as +# transformed density with T = -1/sqrt + + +############################################################################# +############################################################################# + +[verbatim] + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt */ +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ +double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x -= 1000.; + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_tdr_ps.c b/vendor/unuran-1.11.0/tests/t_tdr_ps.c new file mode 100644 index 0000000..762750e --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_tdr_ps.c @@ -0,0 +1,11900 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for TDR + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt */ +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ +double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x -= 1000.; + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[33]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 33 */ +{ +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 2.; +fpm[1] = 5.; +distr[30] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 2.; +distr[31] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); +} + +{ +distr[7] = unur_distr_cauchy(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); +} + +{ +distr[24] = unur_distr_exponential(NULL,0); +} + +{ +fpm[0] = 30.; +fpm[1] = -5.; +distr[25] = unur_distr_exponential(fpm,2); +} + +{ +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000.; +distr[16] = unur_distr_gamma(fpm,3); +} + +{ +distr[26] = unur_distr_laplace(NULL,0); +} + +{ +fpm[0] = -10.; +fpm[1] = 100.; +distr[27] = unur_distr_laplace(fpm,2); +} + +{ +distr[17] = unur_distr_normal(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); +} + +{ +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); +} + +{ +distr[20] = unur_distr_uniform(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); +} + +{ +fpm[0] = 4.; +fpm[1] = 10.; +distr[32] = unur_distr_F(fpm,2); +} + +{ +distr[28] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[28],pdf_sqrtlin); +unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlin); +unur_distr_cont_set_cdf(distr[28],cdf_sqrtlin); +unur_distr_set_name(distr[28],"sqrtlin"); +} + +{ +distr[29] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[29],pdf_sqrtlinshft); +unur_distr_cont_set_dpdf(distr[29],dpdf_sqrtlinshft); +unur_distr_cont_set_cdf(distr[29],cdf_sqrtlinshft); +unur_distr_set_name(distr[29],"sqrtlin"); +} + +{ +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[23] = unur_distr_beta(fpm,2); +unur_distr_cont_set_domain(distr[23],-2.,5.); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 330 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [31] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [32] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [29] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_tdr_new(distr_localcopy); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 330 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [31] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [32] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + gen = unur_init(par); + if (gen) { +unur_tdr_chg_truncated(gen,0.5,0.9); + } + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_tdr_new(distr_localcopy); + unur_tdr_set_pedantic(par,0); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + gen = unur_init(par); + if (gen) unur_tdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [29] */ + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + unur_distr_free(distr[30]); + unur_distr_free(distr[31]); + unur_distr_free(distr[32]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_tdr_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_tdr_ps.conf b/vendor/unuran-1.11.0/tests/t_tdr_ps.conf new file mode 100644 index 0000000..1acacba --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_tdr_ps.conf @@ -0,0 +1,455 @@ +############################################################################# + +[main] + +[main - data:] + +# method +method: TDR + +[main - header:] + +/* prototypes */ + +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +############################################################################# + +# [set] + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################# + +# [init] + +############################################################################# + +# [reinit] + +############################################################################# + +[validate] + +[validate - generators:] + +# sqrt, PS +par[0] = unur_tdr_new(@distr@); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); + +# sqrt, PS, few starting points, ARS +par[1] = unur_tdr_new(@distr@); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + +# sqrt, PS, few construction points +par[2] = unur_tdr_new(@distr@); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + +# sqrt, PS, truncated +par[3] = unur_tdr_new(@distr@); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_chg_truncated(gen,0.5,0.9); + +# log, PS +par[4] = unur_tdr_new(@distr@); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); + +# log, PS, few starting points, ARS +par[5] = unur_tdr_new(@distr@); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); + +# log, PS, few construction points +par[6] = unur_tdr_new(@distr@); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); + +# sqrt, PS, few construction points, urng_aux +par[7] = unur_tdr_new(@distr@); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_usedars(par,FALSE); +unur_tdr_set_cpoints(par,10,NULL); +unur_tdr_set_max_sqhratio(par,0.25); +unur_use_urng_aux_default(par); + +# reinit, sqrt, PS +par[8] = unur_tdr_new(@distr@); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,-0.5); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(@distr@,fpm,2); +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + +# reinit, log, PS +par[9] = unur_tdr_new(@distr@); +unur_tdr_set_variant_ps(par); +unur_tdr_set_c(par,0.); +unur_tdr_set_cpoints(par,10,NULL); +unur_set_use_distr_privatecopy(par,FALSE); +fpm[0] = 1.; +fpm[1] = 4.; +unur_distr_cont_set_pdfparams(@distr@,fpm,2); +unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); +unur_reinit(gen); + + +[validate - distributions:] + +# Beta distributions +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); + +fpm[0] = 2.; +fpm[1] = 5.; +distr[30] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 2.; +distr[31] = unur_distr_beta(fpm,2); + +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); + +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); + +# Cauchy distributions +distr[7] = unur_distr_cauchy(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); + +# Exponential distributions +distr[24] = unur_distr_exponential(NULL,0); + +fpm[0] = 30.; +fpm[1] = -5.; +distr[25] = unur_distr_exponential(fpm,2); + +# Gamma distributions +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); + +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); + +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); + +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); + +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); + +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000.; +distr[16] = unur_distr_gamma(fpm,3); + +# Laplace distributions +distr[26] = unur_distr_laplace(NULL,0); + +fpm[0] = -10.; +fpm[1] = 100.; +distr[27] = unur_distr_laplace(fpm,2); + +# Normal distributions +distr[17] = unur_distr_normal(NULL,0); + +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); + +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); + +# Uniform distributions +distr[20] = unur_distr_uniform(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); + +# F distributions +fpm[0] = 4.; +fpm[1] = 10.; +distr[32] = unur_distr_F(fpm,2); + +# pdf with piecewise linear function as transformed density with T = -1/sqrt +distr[28] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[28],pdf_sqrtlin); +unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlin); +unur_distr_cont_set_cdf(distr[28],cdf_sqrtlin); +unur_distr_set_name(distr[28],"sqrtlin"); + +# pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode +distr[29] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[29],pdf_sqrtlinshft); +unur_distr_cont_set_dpdf(distr[29],dpdf_sqrtlinshft); +unur_distr_cont_set_cdf(distr[29],cdf_sqrtlinshft); +unur_distr_set_name(distr[29],"sqrtlin"); + +# truncated distributions +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); + +# domain exceeds support of pdf +fpm[0] = 3.; +fpm[1] = 4.; +distr[23] = unur_distr_beta(fpm,2); +unur_distr_cont_set_domain(distr[23],-2.,5.); + + +# number of distributions: 33 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] sqrt, PS +# [1] sqrt, PS, few starting points, ARS +# [2] sqrt, PS, few construction points +# [3] sqrt, PS, truncated +# [4] log, PS +# [5] log, PS, few starting points, ARS +# [6] log, PS, few construction points +# [7] sqrt, PS, few construction points, urng_aux +# [8] reinit, log, PS +# [9] reinit, sqrt, PS +# +# +# 0 1 2 3 4 5 6 7 8 9 # distribution +#----------------------------------------------------- +x <0> + + + + + + + + + + # beta (1, 2) + <1> + + + + + + + + . . # beta (1, 5) +x <2> + + + + + + + + + + # beta (1, 100) + <30> + + + + + + + + . . # beta (2, 5) + <31> + + + + + + + + + + # beta (5, 2) + <3> + + + + + + + + . . # beta (3, 4) + <4> + + + + + + + + . . # beta (5, 100) + <5> + + + + + + + + + + # beta (500, 300) + <6> + + + + + + + + + + # beta (5, 10, -3, 15) + <7> + + + + 0 - - + + 0 # cauchy () + <8> + + + + 0 - - + + 0 # cauchy (1, 20) + <24> + + + + + + + + + + # exponential () + <25> + + + + + + + + + + # exponential (30, -5) +x <9> + + + + + + + + . . # gamma (1) + <10> + + + + + + + + . . # gamma (2) + <11> + + + + + + + + + + # gamma (3) + <12> + + + x+ + + + + . . # gamma (10) +x<13> + + + . + + + + . . # gamma (1000) + <14> + + + . + + + + . . # gamma (5, 1000, 0) +x<15> + + + . + + + + . . # gamma (5, 1e-05, 0) +x<16> + + + . + + + + . . # gamma (5, 10, 1000) + <26> + + + + + + + + + + # laplace () + <27> + + + + + + + + . . # laplace (-10, 100) + <17> + + + + + + + + + + # normal () +x<18> + + + + + + + + . . # normal (1, 1e-05) + <19> + + + + + + + + . . # normal (1, 1e+05) + <20> + + + + + + + + + + # uniform () + <21> + + + + + + + + . . # uniform (1, 20) + <32> + + + + 0 0 0 + - - # F (4, 10) + + <22> + + + + + + + + . . # cauchy () - truncated + <23> + + + + + + + + . . # beta () - domain superset of support + <28> + + + + 0 0 0 + . . # sqrtlin + <29> + + + + 0 0 0 + . . # sqrtlin with shifted mode + + +# sqrtlin ... pdf with piecewise linear function as +# transformed density with T = -1/sqrt + +[validate - verify hat:] + +# + ... pass test +# ~ ... fail in at most 1% of samples +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] sqrt, PS +# [1] sqrt, PS, few starting points, ARS +# [2] sqrt, PS, few construction points +# [3] sqrt, PS, truncated +# [4] log, PS +# [5] log, PS, few starting points, ARS +# [6] log, PS, few construction points +# [7] sqrt, PS, few construction points, urng_aux +# [8] reinit, log, PS +# [9] reinit, sqrt, PS +# +# +# 0 1 2 3 4 5 6 7 8 9 # distribution +#----------------------------------------------------- +x <0> + + + + + + + + + + # beta (1, 2) + <1> + + + + + + + + . . # beta (1, 5) +x <2> + + + + + + + + + + # beta (1, 100) + <30> + + + + + + + + . . # beta (2, 5) + <31> + + + + + + + + + + # beta (5, 2) + <3> + + + + + + + + . . # beta (3, 4) + <4> + + + + + + + + . . # beta (5, 100) + <5> + + + + + + + + + + # beta (500,300) + <6> + + + + + + + + + + # beta (5, 10, -3, 15) + <7> + + + + 0 - - + . . # cauchy () + <8> + + + + 0 - - + . . # cauchy (1, 20) + <24> + + + + + + + + + + # exponential () + <25> + + + + + + + + + + # exponential (30, -5) +x <9> + + + + + + + + . . # gamma (1) + <10> + + + + + + + + . . # gamma (2) + <11> + + + + + + + + + + # gamma (3) + <12> + + + x+ + + + + . . # gamma (10) +x<13> + + + . + + + + . . # gamma (1000) + <14> + + + . + + + + . . # gamma (5, 1000, 0) +x<15> + + + . + + + + . . # gamma (5, 1e-05, 0) +x<16> + + + . + + + + . . # gamma (5, 10, 100000) + <26> + + + + + + + + + + # laplace () + <27> + + + + + + + + . . # laplace (-10, 100) + <17> + + + + + + + + + + # normal () +x<18> + + + + + + + + . . # normal (1, 1e-05) + <19> + + + + + + + + . . # normal (1, 1e+05) + <20> + + + + + + + + + + # uniform () + <21> + + + + + + + + . . # uniform (1, 20) + <32> + + + + 0 0 0 + - - # F (4, 10) + + <22> + + + + + + + + . . # cauchy () - truncated + <23> + + + + + + + + . . # beta () - domain superset of support + <28> + + + + . . . + . . # sqrtlin + <29> . . . . . . . . . . # sqrtlin with shifted mode + + +# sqrtlin ... pdf with piecewise linear function as +# transformed density with T = -1/sqrt + + +############################################################################# +############################################################################# + +[verbatim] + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt */ +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ +double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x -= 1000.; + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_unif.c b/vendor/unuran-1.11.0/tests/t_unif.c new file mode 100644 index 0000000..2b805f7 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_unif.c @@ -0,0 +1,434 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for UNIF + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_unif_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,41,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,41,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* exist */ +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + par = unur_unif_new(NULL); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 49, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,53,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +; +compare_sequence_urng_start(TESTLOG,63,COMPARE_SAMPLE_SIZE); + +unur_reset_errno(); +par = unur_unif_new(NULL); +n_tests_failed += (compare_sequence_par(TESTLOG,66,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +} + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_uniform(NULL,0); + par = NULL; + + +unur_reset_errno(); +; +compare_sequence_urng_start(TESTLOG,75,COMPARE_SAMPLE_SIZE); + +unur_reset_errno(); +par = unur_unif_new(distr); +n_tests_failed += (compare_sequence_par(TESTLOG,78,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare clone */ +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_unif_new(NULL); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,90,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,96,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* compare reinit */ +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_unif_new(NULL); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,107,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,111,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +par = unur_unif_new(NULL); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,121,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +gen = unur_str2gen( "uniform & method = unif" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,125,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_unif_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_unif.conf b/vendor/unuran-1.11.0/tests/t_unif.conf new file mode 100644 index 0000000..221a87f --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_unif.conf @@ -0,0 +1,137 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: UNIF + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +############################################################################# + +# [set] + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + + +############################################################################# + +[reinit] + +[reinit - exist: + par = unur_unif_new(NULL); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - compare: + par = NULL; ] + + + -->compare_sequence_urng_start + +par = unur_unif_new(NULL); + -->compare_sequence_par + +#..................................................................... + +[sample - compare: + distr = unur_distr_uniform(NULL,0); + par = NULL; ] + + + -->compare_sequence_urng_start + +par = unur_unif_new(distr); + -->compare_sequence_par + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_unif_new(NULL); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare reinit: + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_unif_new(NULL); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + par = NULL; + gen = NULL; ] + +par = unur_unif_new(NULL); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +gen = unur_str2gen( "uniform & method = unif" ); + -->compare_sequence_gen + + +############################################################################# + +# [validate] + +############################################################################# +############################################################################# + +[verbatim] + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_unur_error.c b/vendor/unuran-1.11.0/tests/t_unur_error.c new file mode 100644 index 0000000..fcf180b --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_unur_error.c @@ -0,0 +1,336 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for ERROR + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_error_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +void my_error_handler( const char *objid, const char *file, int line, + const char *errortype, int errorcode, const char *reason ); + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +void my_error_handler( const char *objid, const char *file, int line, + const char *errortype, int errorcode, const char *reason ) + /*----------------------------------------------------------------------*/ + /* parameters: */ + /* objid ... id/type of object */ + /* file ... file name (inserted by __FILE__) */ + /* line ... line number in source file (inserted by __LINE__) */ + /* errortype ... "warning" or "error" */ + /* errorcode ... UNU.RAN error code */ + /* reason ... (very) short description of reason for error */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG = UNURANLOG; + static int n = 0; + + fprintf(LOG,"\n"); + fprintf(LOG,"[[ %d ]] my_error_handler: [ %s ]\n",++n,errortype); + fprintf(LOG,"\tobject = %s\n",objid); + fprintf(LOG,"\tfile = %s\n",file); + fprintf(LOG,"\tline = %d\n",line); + fprintf(LOG,"\tcode = [%#x] %s\n",errorcode,unur_get_strerror(errorcode)); + fprintf(LOG,"\treason = %s\n",reason); + fprintf(LOG,"\n"); + +} /* end of my_error_handler() */ + + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [special] */ + +void test_special (void) +{ + /* set boolean to FALSE */ + int FAILED = 0; + + + + + +GCC_DIAG_OFF(unused-but-set-variable) + + double fpm[2] = {0., -1.}; + UNUR_DISTR *distr = NULL; + UNUR_ERROR_HANDLER *default_error_handler = NULL; + +/* start test */ +printf("[special "); fflush(stdout); +fprintf(TESTLOG,"\n[special]\n"); + +/* set stop watch */ +stopwatch_lap(&watch); + + + + /* invoke default error handler */ + distr = unur_distr_normal(fpm,2); + + /* change error handler */ + default_error_handler = unur_set_error_handler( my_error_handler ); + distr = unur_distr_normal(fpm,2); + + /* change to old error handler */ + default_error_handler = unur_set_error_handler( default_error_handler ); + distr = unur_distr_normal(fpm,2); + + /* change to new error handler again */ + default_error_handler = unur_set_error_handler( default_error_handler ); + distr = unur_distr_normal(fpm,2); + + /* change to default error handler */ + default_error_handler = unur_set_error_handler( NULL ); + distr = unur_distr_normal(fpm,2); + + /* switch off error reporting */ + default_error_handler = unur_set_error_handler_off(); + distr = unur_distr_normal(fpm,2); + + /* change to old error handler */ + default_error_handler = unur_set_error_handler( default_error_handler ); + distr = unur_distr_normal(fpm,2); + + /* test finished */ + FAILED = 0; + +GCC_DIAG_ON(unused-but-set-variable) + + + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (FAILED) ? 0 : 1; + (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_special() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_error_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_unur_error.conf b/vendor/unuran-1.11.0/tests/t_unur_error.conf new file mode 100644 index 0000000..0d9d466 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_unur_error.conf @@ -0,0 +1,130 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: ERROR + +[main - header:] + +/* prototypes */ + +void my_error_handler( const char *objid, const char *file, int line, + const char *errortype, int errorcode, const char *reason ); + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +############################################################################# + +# [set] + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################# + +# [init] + +############################################################################# + +# [reinit] + +############################################################################# + +# [sample] + +############################################################################# + +# [validate] + +############################################################################# + +[special] + +[special - decl:] + +GCC_DIAG_OFF(unused-but-set-variable) + + double fpm[2] = {0., -1.}; + UNUR_DISTR *distr = NULL; + UNUR_ERROR_HANDLER *default_error_handler = NULL; + +[special - start:] + + /* invoke default error handler */ + distr = unur_distr_normal(fpm,2); + + /* change error handler */ + default_error_handler = unur_set_error_handler( my_error_handler ); + distr = unur_distr_normal(fpm,2); + + /* change to old error handler */ + default_error_handler = unur_set_error_handler( default_error_handler ); + distr = unur_distr_normal(fpm,2); + + /* change to new error handler again */ + default_error_handler = unur_set_error_handler( default_error_handler ); + distr = unur_distr_normal(fpm,2); + + /* change to default error handler */ + default_error_handler = unur_set_error_handler( NULL ); + distr = unur_distr_normal(fpm,2); + + /* switch off error reporting */ + default_error_handler = unur_set_error_handler_off(); + distr = unur_distr_normal(fpm,2); + + /* change to old error handler */ + default_error_handler = unur_set_error_handler( default_error_handler ); + distr = unur_distr_normal(fpm,2); + + /* test finished */ + FAILED = 0; + +GCC_DIAG_ON(unused-but-set-variable) + + +############################################################################# + +[verbatim] + +void my_error_handler( const char *objid, const char *file, int line, + const char *errortype, int errorcode, const char *reason ) + /*----------------------------------------------------------------------*/ + /* parameters: */ + /* objid ... id/type of object */ + /* file ... file name (inserted by __FILE__) */ + /* line ... line number in source file (inserted by __LINE__) */ + /* errortype ... "warning" or "error" */ + /* errorcode ... UNU.RAN error code */ + /* reason ... (very) short description of reason for error */ + /*----------------------------------------------------------------------*/ +{ + FILE *LOG = UNURANLOG; + static int n = 0; + + fprintf(LOG,"\n"); + fprintf(LOG,"[[ %d ]] my_error_handler: [ %s ]\n",++n,errortype); + fprintf(LOG,"\tobject = %s\n",objid); + fprintf(LOG,"\tfile = %s\n",file); + fprintf(LOG,"\tline = %d\n",line); + fprintf(LOG,"\tcode = [%\#x] %s\n",errorcode,unur_get_strerror(errorcode)); + fprintf(LOG,"\treason = %s\n",reason); + fprintf(LOG,"\n"); + +} /* end of my_error_handler() */ + + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_unur_tests.c b/vendor/unuran-1.11.0/tests/t_unur_tests.c new file mode 100644 index 0000000..22a8045 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_unur_tests.c @@ -0,0 +1,488 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for TEST + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_test_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ +double HR_increasing_gm31(double x, const UNUR_DISTR *distr); + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + +/* we need marginal distributions for the chi2 tests */ +#define unur_distr_multinormal unur_distr_multinormal_w_marginals + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +double HR_increasing_gm31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with increasing hazard rate: gamma (alpha=3,beta=1) */ +{ return (x*x)/(x*x+2.*x+2.); } + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* run_tests for AUTO */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; + + +unur_reset_errno(); +par = unur_auto_new(distr); +unur_run_tests(par,~0u,TESTLOG); +n_tests_failed += (check_errorcode(TESTLOG,55,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* run_tests for AUTO */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpm[1] = {0.5}; + distr = unur_distr_geometric(fpm,1); + par = NULL; + + +unur_reset_errno(); +par = unur_auto_new(distr); +unur_run_tests(par,~0u,TESTLOG); +n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* run_tests for AUTO */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double data[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.}; + distr = unur_distr_cemp_new(); + unur_distr_cemp_set_data(distr,data,9); + par = NULL; + + +unur_reset_errno(); +par = unur_auto_new(distr); +unur_run_tests(par,~0u,TESTLOG); +n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* run_tests for AUTO */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + distr = unur_distr_multinormal( dim, mean, covar ); + par = NULL; + + +unur_reset_errno(); +par = unur_auto_new(distr); +unur_run_tests(par,~0u,TESTLOG); +n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [special] */ + +void test_special (void) +{ + /* set boolean to FALSE */ + int FAILED = 0; + + + + + + int samplesize = 10000; + double fpm[10]; + double Rsq, time_setup, time_marginal; + + UNUR_DISTR *distr; + UNUR_PAR *par; + UNUR_GEN *gen; + +/* start test */ +printf("[special "); fflush(stdout); +fprintf(TESTLOG,"\n[special]\n"); + +/* set stop watch */ +stopwatch_lap(&watch); + + + + /* unur_test_par_count_pdf() */ + + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + unur_tdr_set_usedars(par,0); + unur_test_par_count_pdf(par,samplesize,1,TESTLOG); + gen = unur_init(par); + unur_test_count_pdf(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + distr = unur_distr_normal_wo_logpdf(NULL,0); + par = unur_tdr_new(distr); + unur_test_par_count_pdf(par,samplesize,1,TESTLOG); + gen = unur_init(par); + unur_test_count_pdf(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + distr = unur_distr_normal(NULL,0); + par = unur_ninv_new(distr); + unur_test_par_count_pdf(par,samplesize,1,TESTLOG); + gen = unur_init(par); + unur_test_count_pdf(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + distr = unur_distr_normal(NULL,0); + par = unur_hinv_new(distr); + unur_test_par_count_pdf(par,samplesize,1,TESTLOG); + gen = unur_init(par); + unur_test_count_pdf(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"HR"); + unur_distr_cont_set_hr(distr,HR_increasing_gm31); + par = unur_hri_new(distr); + unur_test_par_count_pdf(par,samplesize,1,TESTLOG); + gen = unur_init(par); + unur_test_count_pdf(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + fpm[0] = 0.5; + distr = unur_distr_geometric(fpm,1); + par = unur_dgt_new(distr); + unur_test_par_count_pdf(par,samplesize,1,TESTLOG); + gen = unur_init(par); + unur_test_count_pdf(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + fpm[0] = 0.5; + distr = unur_distr_geometric(fpm,1); + par = unur_dari_new(distr); + unur_test_par_count_pdf(par,samplesize,1,TESTLOG); + gen = unur_init(par); + unur_test_count_pdf(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + distr = unur_distr_multinormal(3,NULL,NULL); + par = unur_vnrou_new(distr); + unur_test_par_count_pdf(par,samplesize,1,TESTLOG); + gen = unur_init(par); + unur_test_count_pdf(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + distr = unur_distr_multinormal_wo_logpdf(3,NULL,NULL); + par = unur_vnrou_new(distr); + unur_test_par_count_pdf(par,samplesize,1,TESTLOG); + gen = unur_init(par); + unur_test_count_pdf(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + /* unur_test_count_urng() */ + + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + unur_tdr_set_usedars(par,0); + gen = unur_init(par); + unur_test_count_urn(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + + /* test timing routines */ + + Rsq = unur_test_timing_R(NULL,NULL,NULL,5,&time_setup,&time_marginal); + fprintf(TESTLOG,"\nR^2 = %g, setup time = %g, marginal generation time = %g\n", + Rsq, time_setup, time_marginal); + + Rsq = unur_test_timing_R(NULL,"cont","pinv",5,&time_setup,&time_marginal); + fprintf(TESTLOG,"\nR^2 = %g, setup time = %g, marginal generation time = %g\n", + Rsq, time_setup, time_marginal); + + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + Rsq = unur_test_timing_R(par,NULL,NULL,5,&time_setup,&time_marginal); + unur_distr_free(distr); + fprintf(TESTLOG,"\nR^2 = %g, setup time = %g, marginal generation time = %g\n", + Rsq, time_setup, time_marginal); + + Rsq = unur_test_timing_R(NULL,"normal","pinv",5,&time_setup,&time_marginal); + fprintf(TESTLOG,"\nR^2 = %g, setup time = %g, marginal generation time = %g\n", + Rsq, time_setup, time_marginal); + + + /* test finished */ + FAILED = 0; + + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (FAILED) ? 0 : 1; + (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_special() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_test_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_unur_tests.conf b/vendor/unuran-1.11.0/tests/t_unur_tests.conf new file mode 100644 index 0000000..835a7f1 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_unur_tests.conf @@ -0,0 +1,234 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: TEST + +[main - header:] + +/* prototypes */ +double HR_increasing_gm31(double x, const UNUR_DISTR *distr); + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* we need marginal distributions for the chi2 tests */ +\#define unur_distr_multinormal unur_distr_multinormal_w_marginals + +############################################################################# + +[new] + +############################################################################# + +# [set] + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################## + +# [init] + +############################################################################# + +# [reinit] + +############################################################################# + +[sample] + +[sample - run_tests for AUTO: + distr = unur_distr_normal(NULL,0); + par = NULL; ] + +par = unur_auto_new(distr); +unur_run_tests(par,~0u,TESTLOG); + -->none --> UNUR_SUCCESS + + +[sample - run_tests for AUTO: + double fpm[1] = {0.5}; + distr = unur_distr_geometric(fpm,1); + par = NULL; ] + +par = unur_auto_new(distr); +unur_run_tests(par,~0u,TESTLOG); + -->none --> UNUR_SUCCESS + + +[sample - run_tests for AUTO: + double data[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.}; + distr = unur_distr_cemp_new(); + unur_distr_cemp_set_data(distr,data,9); + par = NULL; ] + +par = unur_auto_new(distr); +unur_run_tests(par,~0u,TESTLOG); + -->none --> UNUR_SUCCESS + + +[sample - run_tests for AUTO: + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + distr = unur_distr_multinormal( dim, mean, covar ); + par = NULL; ] + +par = unur_auto_new(distr); +unur_run_tests(par,~0u,TESTLOG); + -->none --> UNUR_SUCCESS + + +############################################################################# + +# [validate] + +############################################################################# + +[special] + +[special - decl:] + + int samplesize = 10000; + double fpm[10]; + double Rsq, time_setup, time_marginal; + + UNUR_DISTR *distr; + UNUR_PAR *par; + UNUR_GEN *gen; + +[special - start:] + + /* unur_test_par_count_pdf() */ + + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + unur_tdr_set_usedars(par,0); + unur_test_par_count_pdf(par,samplesize,1,TESTLOG); + gen = unur_init(par); + unur_test_count_pdf(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + distr = unur_distr_normal_wo_logpdf(NULL,0); + par = unur_tdr_new(distr); + unur_test_par_count_pdf(par,samplesize,1,TESTLOG); + gen = unur_init(par); + unur_test_count_pdf(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + distr = unur_distr_normal(NULL,0); + par = unur_ninv_new(distr); + unur_test_par_count_pdf(par,samplesize,1,TESTLOG); + gen = unur_init(par); + unur_test_count_pdf(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + distr = unur_distr_normal(NULL,0); + par = unur_hinv_new(distr); + unur_test_par_count_pdf(par,samplesize,1,TESTLOG); + gen = unur_init(par); + unur_test_count_pdf(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + distr = unur_distr_cont_new(); + unur_distr_set_name(distr,"HR"); + unur_distr_cont_set_hr(distr,HR_increasing_gm31); + par = unur_hri_new(distr); + unur_test_par_count_pdf(par,samplesize,1,TESTLOG); + gen = unur_init(par); + unur_test_count_pdf(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + fpm[0] = 0.5; + distr = unur_distr_geometric(fpm,1); + par = unur_dgt_new(distr); + unur_test_par_count_pdf(par,samplesize,1,TESTLOG); + gen = unur_init(par); + unur_test_count_pdf(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + fpm[0] = 0.5; + distr = unur_distr_geometric(fpm,1); + par = unur_dari_new(distr); + unur_test_par_count_pdf(par,samplesize,1,TESTLOG); + gen = unur_init(par); + unur_test_count_pdf(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + distr = unur_distr_multinormal(3,NULL,NULL); + par = unur_vnrou_new(distr); + unur_test_par_count_pdf(par,samplesize,1,TESTLOG); + gen = unur_init(par); + unur_test_count_pdf(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + distr = unur_distr_multinormal_wo_logpdf(3,NULL,NULL); + par = unur_vnrou_new(distr); + unur_test_par_count_pdf(par,samplesize,1,TESTLOG); + gen = unur_init(par); + unur_test_count_pdf(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + /* unur_test_count_urng() */ + + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + unur_tdr_set_usedars(par,0); + gen = unur_init(par); + unur_test_count_urn(gen,samplesize,1,TESTLOG); + unur_free(gen); + unur_distr_free(distr); + + + /* test timing routines */ + + Rsq = unur_test_timing_R(NULL,NULL,NULL,5,&time_setup,&time_marginal); + fprintf(TESTLOG,"\nR^2 = %g, setup time = %g, marginal generation time = %g\n", + Rsq, time_setup, time_marginal); + + Rsq = unur_test_timing_R(NULL,"cont","pinv",5,&time_setup,&time_marginal); + fprintf(TESTLOG,"\nR^2 = %g, setup time = %g, marginal generation time = %g\n", + Rsq, time_setup, time_marginal); + + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + Rsq = unur_test_timing_R(par,NULL,NULL,5,&time_setup,&time_marginal); + unur_distr_free(distr); + fprintf(TESTLOG,"\nR^2 = %g, setup time = %g, marginal generation time = %g\n", + Rsq, time_setup, time_marginal); + + Rsq = unur_test_timing_R(NULL,"normal","pinv",5,&time_setup,&time_marginal); + fprintf(TESTLOG,"\nR^2 = %g, setup time = %g, marginal generation time = %g\n", + Rsq, time_setup, time_marginal); + + + /* test finished */ + FAILED = 0; + +############################################################################# + +[verbatim] + +double HR_increasing_gm31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) + /* example with increasing hazard rate: gamma (alpha=3,beta=1) */ +{ return (x*x)/(x*x+2.*x+2.); } + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_urng.c b/vendor/unuran-1.11.0/tests/t_urng.c new file mode 100644 index 0000000..7830504 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_urng.c @@ -0,0 +1,366 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for URNG + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_urng_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ + +#ifdef UNUR_URNG_UNURAN + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,26,(unur_urng_new( NULL, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,26,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +#endif +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ + UNUR_URNG *urng = NULL; + +#ifdef UNUR_URNG_UNURAN + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,40,(unur_urng_set_seed( urng, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,40,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,43,(unur_urng_set_anti( urng, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,43,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,46,(unur_urng_set_reset( urng, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,46,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,49,(unur_urng_set_nextsub( urng, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,52,(unur_urng_set_resetsub( urng, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,55,(unur_urng_set_delete( urng, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,55,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +#endif +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* missing functions */ + UNUR_URNG *urng = NULL; + double (*sampleunif)(void*); + sampleunif = unur_urng_fish; + +#ifdef UNUR_URNG_UNURAN +urng = unur_urng_new(sampleunif,NULL); + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,89,(unur_urng_reset (urng)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,89,UNUR_ERR_URNG_MISS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,92,(unur_urng_seed (urng, 0UL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,92,UNUR_ERR_URNG_MISS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,95,(unur_urng_anti (urng, 0)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,95,UNUR_ERR_URNG_MISS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,98,(unur_urng_nextsub (urng)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,98,UNUR_ERR_URNG_MISS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,101,(unur_urng_resetsub (urng)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_URNG_MISS)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,104,(unur_urng_seed (urng, 0UL)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,104,UNUR_ERR_URNG_MISS)==UNUR_SUCCESS)?0:1; +unur_urng_free(urng); +#endif +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_urng_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_urng.conf b/vendor/unuran-1.11.0/tests/t_urng.conf new file mode 100644 index 0000000..62746b6 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_urng.conf @@ -0,0 +1,120 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: URNG + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +[new - invalid NULL ptr: ] + +\#ifdef UNUR_URNG_UNURAN + +~( NULL, NULL ); + --> expected_NULL --> UNUR_ERR_NULL + +\#endif + +############################################################################# + +[set] + +[set - invalid NULL ptr: + UNUR_URNG *urng = NULL; ] + +\#ifdef UNUR_URNG_UNURAN + +~_seed( urng, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_anti( urng, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_reset( urng, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_nextsub( urng, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_resetsub( urng, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_delete( urng, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +\#endif + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################# + +# [init] + +############################################################################# + +# [reinit] + +############################################################################# + +[sample] + +[sample - missing functions: + UNUR_URNG *urng = NULL; + double (*sampleunif)(void*); + sampleunif = unur_urng_fish; ] + +\#ifdef UNUR_URNG_UNURAN + +urng = unur_urng_new(sampleunif,NULL); + +unur_urng_reset (urng); + --> expected_setfailed --> UNUR_ERR_URNG_MISS + +unur_urng_seed (urng, 0UL); + --> expected_setfailed --> UNUR_ERR_URNG_MISS + +unur_urng_anti (urng, 0); + --> expected_setfailed --> UNUR_ERR_URNG_MISS + +unur_urng_nextsub (urng); + --> expected_setfailed --> UNUR_ERR_URNG_MISS + +unur_urng_resetsub (urng); + --> expected_setfailed --> UNUR_ERR_URNG_MISS + +unur_urng_seed (urng, 0UL); + --> expected_setfailed --> UNUR_ERR_URNG_MISS + +unur_urng_free(urng); + +\#endif + + +############################################################################# + +# [validate] + +############################################################################# +############################################################################# + +[verbatim] + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_utdr.c b/vendor/unuran-1.11.0/tests/t_utdr.c new file mode 100644 index 0000000..022e537 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_utdr.c @@ -0,0 +1,3760 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for UTDR + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ +double pdf( double x, const UNUR_DISTR *distr ); + +double pdf_bimodal( double x, const UNUR_DISTR *distr ); +double dpdf_bimodal( double x, const UNUR_DISTR *distr ); + +double pdf_negative( double x, const UNUR_DISTR *distr ); +double dpdf_negative( double x, const UNUR_DISTR *distr ); + +double pdf_partnegative( double x, const UNUR_DISTR *distr ); +double dpdf_partnegative( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); + +int unur_utdr_set_pedantic( struct unur_par *par, int pedantic ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + +/* #define SEED (2346412) */ + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* pdf of bimodal density */ +double pdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ( exp(-(x-1.)*(x-1.)) + exp(-(x+1.)*(x+1.)) ); +} +double dpdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ( -2. * (x-1.) * exp(-(x-1.)*(x-1.)) -2. * (x+1.) * exp(-(x+1.)*(x+1.)) ); +} + +/* pdf with negative value */ +double pdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-x*x); +} +double dpdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-2.*x); +} + +/* pdf with partial negative value */ +double pdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((x>-0.89 && x<0.89) ? -1.: exp(-x*x)); +} +double dpdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((x>-0.89 && x<0.89) ?0.: -2.*x*exp(-x*x)); +} + +/* pdf of normal density */ +double pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return exp(-x*x/2.); +} /* end of pdf */ + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt */ +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ +double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x -= 1000.; + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* dummy function */ +int unur_utdr_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,47,(unur_utdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,47,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,53,(unur_utdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cont_new(); + + +unur_reset_errno(); +/* pdf, mode, pdfarea */ +n_tests_failed += (check_expected_NULL(TESTLOG,60,(unur_utdr_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,70,(unur_utdr_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,73,(unur_utdr_set_pdfatmode(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,73,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,76,(unur_utdr_set_cpfactor(par, 1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_utdr_set_deltafactor(par, 1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,89,(unur_utdr_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,89,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,92,(unur_utdr_set_pdfatmode(par,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,92,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,95,(unur_utdr_set_cpfactor(par, 1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,95,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,98,(unur_utdr_set_deltafactor(par, 1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,98,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_utdr_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,108,(unur_utdr_set_pdfatmode(par,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,108,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,111,(unur_utdr_set_cpfactor(par, -1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,111,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,114,(unur_utdr_set_deltafactor(par, -1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,114,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,117,(unur_utdr_set_deltafactor(par, 1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,117,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 133, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,137,(unur_utdr_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,137,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,140,(unur_utdr_chg_pdfatmode(gen,1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,140,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {2.,5.}; + distr = unur_distr_gamma(fpar,2); + par = unur_utdr_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 146, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,150,(unur_utdr_chg_pdfatmode(gen,-1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,150,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [init] */ + +void test_init (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[init "); fflush(stdout); + fprintf(TESTLOG,"\n[init]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,161,(unur_init( par )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,161,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_cont_new(); + par = NULL; + + +unur_reset_errno(); +/* mode, pdfarea */ +unur_distr_cont_set_pdf(distr,pdf); +par = unur_utdr_new( distr ); +n_tests_failed += (check_expected_NULL(TESTLOG,171,(unur_init(par)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,171,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* pdfarea */ +unur_distr_cont_set_mode(distr,1.); +par = unur_utdr_new( distr ); +n_tests_failed += (check_expected_NULL(TESTLOG,177,(unur_init(par)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,177,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_init() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_utdr_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 185, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,189,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; + + +unur_reset_errno(); +/* default algorithm */ +par = unur_utdr_new(distr); +n_tests_failed += (compare_sequence_par_start(TESTLOG,201,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* default algorithm - verifying mode */ +par = unur_utdr_new(distr); +unur_utdr_set_verify(par,1); +n_tests_failed += (compare_sequence_par(TESTLOG,206,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_utdr_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,219,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,225,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_utdr_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,237,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,241,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare stringparser */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {3.,3.}; + distr = NULL; + par = NULL; + gen = NULL; + + +unur_reset_errno(); +distr = unur_distr_gamma(fpar,2); +par = unur_utdr_new(distr); +unur_utdr_set_cpfactor(par,0.660); +unur_utdr_set_deltafactor(par,1.e-4); +unur_utdr_set_verify(par,TRUE); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,257,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & \ + method = utdr; cpfactor = 0.66; deltafactor = 1.e-4; verify" ); +n_tests_failed += (compare_sequence_gen(TESTLOG,263,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[29]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 29 */ +{ +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); +} + +{ +distr[7] = unur_distr_cauchy(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); +} + +{ +distr[23] = unur_distr_exponential(NULL,0); +} + +{ +fpm[0] = 30.; +fpm[1] = -5.; +distr[24] = unur_distr_exponential(fpm,2); +} + +{ +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); +} + +{ +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); +} + +{ +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[16] = unur_distr_gamma(fpm,3); +} + +{ +distr[25] = unur_distr_laplace(NULL,0); +} + +{ +fpm[0] = -10.; +fpm[1] = 100.; +distr[26] = unur_distr_laplace(fpm,2); +} + +{ +distr[17] = unur_distr_normal(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); +} + +{ +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); +} + +{ +distr[20] = unur_distr_uniform(NULL,0); +} + +{ +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); +} + +{ +distr[27] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[27],pdf_sqrtlin); +unur_distr_cont_set_dpdf(distr[27],dpdf_sqrtlin); +unur_distr_cont_set_cdf(distr[27],cdf_sqrtlin); +unur_distr_set_name(distr[27],"sqrtlin"); +unur_distr_cont_set_mode(distr[27],0.); +unur_distr_cont_set_pdfarea(distr[27],2.); +} + +{ +distr[28] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[28],pdf_sqrtlinshft); +unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlinshft); +unur_distr_cont_set_cdf(distr[28],cdf_sqrtlinshft); +unur_distr_set_name(distr[28],"sqrtlin"); +unur_distr_cont_set_mode(distr[28],1000.); +unur_distr_cont_set_pdfarea(distr[28],2.); +} + +{ +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); +} + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 87 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [28] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_utdr_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 87 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [3] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [10] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [13] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [22] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +{ UNUR_DISTR *dg =NULL; +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); +fpm[0] = 1.; +fpm[1] = 4.; + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + } + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_utdr_new(distr_localcopy); + unur_utdr_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_utdr_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_utdr_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_utdr.conf b/vendor/unuran-1.11.0/tests/t_utdr.conf new file mode 100644 index 0000000..230fdc2 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_utdr.conf @@ -0,0 +1,613 @@ +############################################################################# + +[main] + +[main - data:] + +# method +method: UTDR + +[main - header:] + +/* prototypes */ +double pdf( double x, const UNUR_DISTR *distr ); + +double pdf_bimodal( double x, const UNUR_DISTR *distr ); +double dpdf_bimodal( double x, const UNUR_DISTR *distr ); + +double pdf_negative( double x, const UNUR_DISTR *distr ); +double dpdf_negative( double x, const UNUR_DISTR *distr ); + +double pdf_partnegative( double x, const UNUR_DISTR *distr ); +double dpdf_partnegative( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); + +double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); + +int unur_utdr_set_pedantic( struct unur_par *par, int pedantic ); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* \#define SEED (2346412) */ + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + +[new - data missing in distribution object: + distr = unur_distr_cont_new(); ] + +/* pdf, mode, pdfarea */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_verify( par, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_pdfatmode(par,1.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_cpfactor(par, 1.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_deltafactor(par, 1.); + --> expected_setfailed --> UNUR_ERR_NULL + + + +[set - invalid parameter object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); ] + +~_verify( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_pdfatmode(par,1.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_cpfactor(par, 1.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_deltafactor(par, 1.); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + +[set - invalid parameters: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_utdr_new(distr); ] + +~_pdfatmode(par,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_cpfactor(par, -1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_deltafactor(par, -1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_deltafactor(par, 1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + +############################################################################# + +# [get] + +############################################################################# + +[chg] + +[chg - invalid generator object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_verify(gen,1); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +~_pdfatmode(gen,1.); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + + +[chg - invalid parameters: + double fpar[2] = {2.,5.}; + distr = unur_distr_gamma(fpar,2); + par = unur_utdr_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +~_pdfatmode(gen,-1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + + +############################################################################# + +[init] + +[init - invalid NULL ptr: + par = NULL; ] + +unur_init( par ); + --> expected_NULL --> UNUR_ERR_NULL + +[init - data missing in distribution object: + distr = unur_distr_cont_new(); + par = NULL; ] + +/* mode, pdfarea */ +unur_distr_cont_set_pdf(distr,pdf); +par = unur_utdr_new( distr ); +unur_init(par); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +/* pdfarea */ +unur_distr_cont_set_mode(distr,1.); +par = unur_utdr_new( distr ); +unur_init(par); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + +############################################################################# + +[reinit] + +[reinit - exist: + distr = unur_distr_normal(NULL,0); + par = unur_utdr_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - compare: + distr = unur_distr_normal(NULL,0); + par = NULL; ] + +/* default algorithm */ +par = unur_utdr_new(distr); + -->compare_sequence_par_start + +/* default algorithm - verifying mode */ +par = unur_utdr_new(distr); +unur_utdr_set_verify(par,1); + -->compare_sequence_par + +#..................................................................... + +[sample - compare clone: + UNUR_GEN *clone; + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_utdr_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare reinit: + distr = unur_distr_normal(NULL,0); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_utdr_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + +#..................................................................... + +[sample - compare stringparser: + double fpar[2] = {3.,3.}; + distr = NULL; + par = NULL; + gen = NULL; ] + +distr = unur_distr_gamma(fpar,2); +par = unur_utdr_new(distr); +unur_utdr_set_cpfactor(par,0.660); +unur_utdr_set_deltafactor(par,1.e-4); +unur_utdr_set_verify(par,TRUE); +gen = unur_init(par); + -->compare_sequence_gen_start + +unur_free(gen); gen = NULL; +unur_distr_free(distr); distr = NULL; +gen = unur_str2gen( "gamma(3.,3.) & \ + method = utdr; cpfactor = 0.66; deltafactor = 1.e-4; verify" ); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default program +par[0] = unur_utdr_new(@distr@); + +# default variant but reinitialized with changed domain +{ UNUR_DISTR *dg =NULL; +par[1] = unur_utdr_new(@distr@); +dg = unur_get_distr(gen); +unur_distr_cont_set_domain(dg,0.9,0.92); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + +# default variant but reinitialized with changed pdf parameters +{ UNUR_DISTR *dg =NULL; +par[2] = unur_utdr_new(@distr@); +fpm[0] = 1.; +fpm[1] = 4.; +dg = unur_get_distr(gen); +unur_distr_cont_set_pdfparams(dg,fpm,2); +unur_distr_cont_upd_pdfarea(dg); +unur_distr_cont_upd_mode(dg); +unur_reinit(gen); } + +[validate - distributions:] + +# Beta distributions +fpm[0] = 1.; +fpm[1] = 2.; +distr[0] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 5.; +distr[1] = unur_distr_beta(fpm,2); + +fpm[0] = 1.; +fpm[1] = 100.; +distr[2] = unur_distr_beta(fpm,2); + +fpm[0] = 3.; +fpm[1] = 4.; +distr[3] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 100.; +distr[4] = unur_distr_beta(fpm,2); + +fpm[0] = 500.; +fpm[1] = 300.; +distr[5] = unur_distr_beta(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = -3.; +fpm[3] = 15.; +distr[6] = unur_distr_beta(fpm,4); + +# Cauchy distributions +distr[7] = unur_distr_cauchy(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[8] = unur_distr_cauchy(fpm,2); + +# Exponential distributions +distr[23] = unur_distr_exponential(NULL,0); + +fpm[0] = 30.; +fpm[1] = -5.; +distr[24] = unur_distr_exponential(fpm,2); + +# Gamma distributions +fpm[0] = 1.; +distr[9] = unur_distr_gamma(fpm,1); + +fpm[0] = 2.; +distr[10] = unur_distr_gamma(fpm,1); + +fpm[0] = 3.; +distr[11] = unur_distr_gamma(fpm,1); + +fpm[0] = 10.; +distr[12] = unur_distr_gamma(fpm,1); + +fpm[0] = 1000.; +distr[13] = unur_distr_gamma(fpm,1); + +fpm[0] = 5.; +fpm[1] = 1000.; +distr[14] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 1.e-5; +distr[15] = unur_distr_gamma(fpm,2); + +fpm[0] = 5.; +fpm[1] = 10.; +fpm[2] = 1000; +distr[16] = unur_distr_gamma(fpm,3); + +# Laplace distributions +distr[25] = unur_distr_laplace(NULL,0); + +fpm[0] = -10.; +fpm[1] = 100.; +distr[26] = unur_distr_laplace(fpm,2); + +# Normal distributions +distr[17] = unur_distr_normal(NULL,0); + +fpm[0] = 1.; +fpm[1] = 1.e-5; +distr[18] = unur_distr_normal(fpm,2); + +fpm[0] = 0.; +fpm[1] = 1.e+5; +distr[19] = unur_distr_normal(fpm,2); + +# Uniform distributions +distr[20] = unur_distr_uniform(NULL,0); + +fpm[0] = 1.; +fpm[1] = 20.; +distr[21] = unur_distr_uniform(fpm,2); + +# pdf with piecewise linear function as transformed density with T = -1/sqrt +distr[27] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[27],pdf_sqrtlin); +unur_distr_cont_set_dpdf(distr[27],dpdf_sqrtlin); +unur_distr_cont_set_cdf(distr[27],cdf_sqrtlin); +unur_distr_set_name(distr[27],"sqrtlin"); +unur_distr_cont_set_mode(distr[27],0.); +unur_distr_cont_set_pdfarea(distr[27],2.); + +# pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode +distr[28] = unur_distr_cont_new(); +unur_distr_cont_set_pdf(distr[28],pdf_sqrtlinshft); +unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlinshft); +unur_distr_cont_set_cdf(distr[28],cdf_sqrtlinshft); +unur_distr_set_name(distr[28],"sqrtlin"); +unur_distr_cont_set_mode(distr[28],1000.); +unur_distr_cont_set_pdfarea(distr[28],2.); + +# truncated distributions +distr[22] = unur_distr_cauchy(NULL,0); +unur_distr_cont_set_domain(distr[22],0.1,1.); +unur_distr_cont_upd_mode(distr[22]); +unur_distr_cont_upd_pdfarea(distr[22]); + +# number of distributions: 29 + + +[validate - test chi2:] + +# + ... pass test +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] default +# [1] default, but reinitialized with changed domain +# [2] default, but reinitialized with changed PDF parameters +# +#gen 0 1 2 # distribution +#--------------------------------------------- +x <0> + + + # beta (1, 2) + <1> + + + # beta (1, 5) +x <2> + . . # beta (1, 100) + <3> + + + # beta (3, 4) + <4> + . . # beta (5, 100) + <5> + . . # beta (500, 300) + <6> + + . # beta (5, 10, -3, 15) + <23> + + + # exponential () + <24> + + + # exponential (30, -5) + <7> + + + # cauchy () + <8> + + + # cauchy (1, 20) +x <9> + + + # gamma (1) + <10> + + + # gamma (2) + <11> + + . # gamma (3) + <12> + + . # gamma (10) +x<13> + . . # gamma (1000) + <14> + + . # gamma (5, 1000, 0) +x<15> + . . # gamma (5, 1e-05, 0) +x<16> + - . # gamma (5, 10, 100000) + <25> + + + # laplace () + <26> + + + # laplace (-10, 100) + <17> + + + # normal () +x<18> + . + # normal (1, 1e-05) + <19> + . . # normal (1, 1e+05) + <20> + + . # uniform () + <21> + - + # uniform (1, 20) + + <22> + + + # cauchy () - truncated + + <27> + . . # pdf with piecewise linear function as transformed density with T = -1/sqrt + <28> + . . # [27] with shifted mode + + + +[validate - verify hat:] + +# + ... pass test +# ~ ... fail in at most 1% of samples +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# +# generators: +# [0] default +# [1] default, but reinitialized with changed domain +# [2] default, but reinitialized with changed PDF parameters +# +#gen 0 1 2 # distribution +#--------------------------------------------- +x <0> + + + # beta (1, 2) + <1> + + + # beta (1, 5) +x <2> + . . # beta (1, 100) + <3> + + + # beta (3, 4) + <4> + . . # beta (5, 100) + <5> + . . # beta (500, 300) + <6> + + . # beta (5, 10, -3, 15) + <23> + + + # exponential () + <24> + + + # exponential (30, -5) + <7> + + + # cauchy () + <8> + + + # cauchy (1, 20) +x <9> + + + # gamma (1) + <10> + + + # gamma (2) + <11> + + . # gamma (3) + <12> + + . # gamma (10) +x<13> + . . # gamma (1000) + <14> + + . # gamma (5, 1000, 0) +x<15> + . . # gamma (5, 1e-05, 0) +x<16> + . . # gamma (5, 10, 100000) + <25> + + + # laplace () + <26> + + + # laplace (-10, 100) + <17> + + + # normal () +x<18> + . + # normal (1, 1e-05) + <19> + . . # normal (1, 1e+05) + <20> + + . # uniform () + <21> + . + # uniform (1, 20) + + <22> + + + # cauchy () - truncated + + <27> + . . # pdf with piecewise linear function as transformed density with T = -1/sqrt + + + +############################################################################# +############################################################################# + +[verbatim] + +/* pdf of bimodal density */ +double pdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ( exp(-(x-1.)*(x-1.)) + exp(-(x+1.)*(x+1.)) ); +} +double dpdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ( -2. * (x-1.) * exp(-(x-1.)*(x-1.)) -2. * (x+1.) * exp(-(x+1.)*(x+1.)) ); +} + +/* pdf with negative value */ +double pdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-x*x); +} +double dpdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return (-2.*x); +} + +/* pdf with partial negative value */ +double pdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((x>-0.89 && x<0.89) ? -1.: exp(-x*x)); +} +double dpdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return ((x>-0.89 && x<0.89) ?0.: -2.*x*exp(-x*x)); +} + +/* pdf of normal density */ +double pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + return exp(-x*x/2.); +} /* end of pdf */ + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt */ +double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ +double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + return y*y; +} +double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y; + x -= 1000.; + y = 1./(fabs(x)+1.); + y = 2.*y*y*y; + return ((x<0.) ? y : - y); +} +double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + x -= 1000.; + if (x<=0.) + return 0.5/(1.-x); + else + return (1.-0.5/(1.+x)); +} + +/* dummy function */ +int unur_utdr_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_util_matrix.c b/vendor/unuran-1.11.0/tests/t_util_matrix.c new file mode 100644 index 0000000..3735d27 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_util_matrix.c @@ -0,0 +1,398 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for MATRIX + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_matrix_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* header files */ +#include +#include + +/* function prototypes */ +void _unur_test_set_matrix_1(int dim, double *M); +void _unur_test_set_matrix_2(int dim, double *M); +int _unur_test_matrix(int dim); + +/* dimension of test matrix */ +static const int dim_testmatrix = 50; + +/* max tolerable absolute error */ +static const double error_absolute_max = 1.e-12; + +#ifndef M_PI +#define M_PI 3.14159265358979323846264338328 /* pi */ +#endif + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +void _unur_test_set_matrix_1(int dim, double *M) { +#define idx1(a,b) ((a-1)*dim+(b-1)) + int i,j,k; + double p; + + /* original derflinger test-matrix */ + p = M_PI/(dim+1); + for (i=1; i<=dim; i++) { + for (k=1; k<=i; k++) { + M[idx1(i,k)]=0.; + for (j=1; j<=dim; j++) { + M[idx1(i,k)] += sin(p*i*j)*j*sin(p*j*k); + } + M[idx1(k,i)] = M[idx1(i,k)]; + }} + +#undef idx1 +} /* end of _unur_test_set_matrix_1() */ + +/*-------------------------------------------------------------------------*/ + +void _unur_test_set_matrix_2(int dim, double *M) { +#define idx1(a,b) ((a-1)*dim+(b-1)) + int i,j,k; + + /* another test-matrix */ + for (i=1; i<=dim; i++) { + for (k=1; k<=i; k++) { + M[idx1(i,k)]=0.; + for (j=1; j<=dim; j++) { + M[idx1(i,k)] = 1./(i+k); + } + M[idx1(k,i)] = M[idx1(i,k)]; + }} + +#undef idx1 +} /* end of _unur_test_set_matrix_2() */ + +/*-------------------------------------------------------------------------*/ + +int _unur_test_matrix(int dim) { +#define idx1(a,b) ((a-1)*dim+(b-1)) + + int i, ret; + + double *M; + double *values; + double *vectors; + + double error_absolute; + double error_relative; + + int error_counter = 0; + char error_char; + + /* allocate memory */ + M = malloc(dim*dim*sizeof(double)); + values = malloc(dim*sizeof(double)); + vectors = malloc(dim*dim*sizeof(double)); + + _unur_test_set_matrix_1(dim, M); + + error_counter = 0; + ret = _unur_matrix_eigensystem(dim, M, values, vectors); + if (ret == UNUR_SUCCESS) { + fprintf(TESTLOG, " # \t Eigenvalue \t\t Expected \t\t Abs. Error \t Rel. Error\n"); + for (i=0; i error_absolute_max) { + /* eigenvalue is not ok */ + error_char = '*'; + error_counter++; + } + else + { + /* eigenvalue is ok */ + error_char = ' '; + } + + fprintf(TESTLOG, "%02d : \t%18.15f \t%18.15f \t% 8.4e \t% 8.4e %c\n", + i+1, + 2.*values[i]/(dim+1), + (double) (i+1) , + error_absolute, + error_relative, + error_char); + } + if (error_counter!=0) + printf(" failed at %d eigenvalues", error_counter); + } + else { + ++error_counter; + printf(": init"); + } + + /* free memory */ + free(M); + free(values); + free(vectors); + + /* return number of errors */ + return error_counter; + +#undef idx1 +} /* end of _unur_test_matrix() */ + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [special] */ + +void test_special (void) +{ + /* set boolean to FALSE */ + int FAILED = 0; + + + + + +/* start test */ +printf("[special "); fflush(stdout); +fprintf(TESTLOG,"\n[special]\n"); + +/* set stop watch */ +stopwatch_lap(&watch); + + + + printf("\nEigensystem"); + + /* run tests */ + FAILED = _unur_test_matrix(dim_testmatrix); + + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (FAILED) ? 0 : 1; + (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_special() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_matrix_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_util_matrix.conf b/vendor/unuran-1.11.0/tests/t_util_matrix.conf new file mode 100644 index 0000000..045bd9a --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_util_matrix.conf @@ -0,0 +1,192 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: MATRIX + +[main - header:] + +/* header files */ +\#include +\#include + +/* function prototypes */ +void _unur_test_set_matrix_1(int dim, double *M); +void _unur_test_set_matrix_2(int dim, double *M); +int _unur_test_matrix(int dim); + +/* dimension of test matrix */ +static const int dim_testmatrix = 50; + +/* max tolerable absolute error */ +static const double error_absolute_max = 1.e-12; + +\#ifndef M_PI +\#define M_PI 3.14159265358979323846264338328 /* pi */ +\#endif + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + + +############################################################################# + +[new] + +############################################################################# + +# [set] + +############################################################################# + +# [get] + +############################################################################# + +# [chg] + +############################################################################# + +# [init] + +############################################################################# + +# [reinit] + +############################################################################# + +# [sample] + +############################################################################# + +# [validate] + +############################################################################# + +[special] + +[special - decl:] + +[special - start:] + + printf("\nEigensystem"); + + /* run tests */ + FAILED = _unur_test_matrix(dim_testmatrix); + +############################################################################# + +[verbatim] + +void _unur_test_set_matrix_1(int dim, double *M) { +\#define idx1(a,b) ((a-1)*dim+(b-1)) + int i,j,k; + double p; + + /* original derflinger test-matrix */ + p = M_PI/(dim+1); + for (i=1; i<=dim; i++) { + for (k=1; k<=i; k++) { + M[idx1(i,k)]=0.; + for (j=1; j<=dim; j++) { + M[idx1(i,k)] += sin(p*i*j)*j*sin(p*j*k); + } + M[idx1(k,i)] = M[idx1(i,k)]; + }} + +\#undef idx1 +} /* end of _unur_test_set_matrix_1() */ + +/*-------------------------------------------------------------------------*/ + +void _unur_test_set_matrix_2(int dim, double *M) { +\#define idx1(a,b) ((a-1)*dim+(b-1)) + int i,j,k; + + /* another test-matrix */ + for (i=1; i<=dim; i++) { + for (k=1; k<=i; k++) { + M[idx1(i,k)]=0.; + for (j=1; j<=dim; j++) { + M[idx1(i,k)] = 1./(i+k); + } + M[idx1(k,i)] = M[idx1(i,k)]; + }} + +\#undef idx1 +} /* end of _unur_test_set_matrix_2() */ + +/*-------------------------------------------------------------------------*/ + +int _unur_test_matrix(int dim) { +\#define idx1(a,b) ((a-1)*dim+(b-1)) + + int i, ret; + + double *M; + double *values; + double *vectors; + + double error_absolute; + double error_relative; + + int error_counter = 0; + char error_char; + + /* allocate memory */ + M = malloc(dim*dim*sizeof(double)); + values = malloc(dim*sizeof(double)); + vectors = malloc(dim*dim*sizeof(double)); + + _unur_test_set_matrix_1(dim, M); + + error_counter = 0; + ret = _unur_matrix_eigensystem(dim, M, values, vectors); + if (ret == UNUR_SUCCESS) { + fprintf(TESTLOG, " \# \t Eigenvalue \t\t Expected \t\t Abs. Error \t Rel. Error\n"); + for (i=0; i error_absolute_max) { + /* eigenvalue is not ok */ + error_char = '*'; + error_counter++; + } + else + { + /* eigenvalue is ok */ + error_char = ' '; + } + + fprintf(TESTLOG, "%02d : \t%18.15f \t%18.15f \t% 8.4e \t% 8.4e %c\n", + i+1, + 2.*values[i]/(dim+1), + (double) (i+1) , + error_absolute, + error_relative, + error_char); + } + if (error_counter!=0) + printf(" failed at %d eigenvalues", error_counter); + } + else { + ++error_counter; + printf(": init"); + } + + /* free memory */ + free(M); + free(values); + free(vectors); + + /* return number of errors */ + return error_counter; + +\#undef idx1 +} /* end of _unur_test_matrix() */ + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_vempk.c b/vendor/unuran-1.11.0/tests/t_vempk.c new file mode 100644 index 0000000..313d0cf --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_vempk.c @@ -0,0 +1,708 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for VEMPK + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_vempk_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,25,(unur_vempk_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,25,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,32,(unur_vempk_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,32,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* data missing in distribution object */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_cvemp_new(2); + + +unur_reset_errno(); +/* data */ +n_tests_failed += (check_expected_NULL(TESTLOG,40,(unur_vempk_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,40,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,51,(unur_vempk_set_smoothing( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,51,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,54,(unur_vempk_set_varcor( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,54,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,62,(unur_vempk_set_smoothing( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,65,(unur_vempk_set_varcor( par, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free (par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; + distr = unur_distr_cvemp_new(2); + unur_distr_cvemp_set_data(distr, data, 4); + par = unur_vempk_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,76,(unur_vempk_set_smoothing( par, -1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,93,(unur_vempk_chg_smoothing( gen, 1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,93,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,96,(unur_vempk_chg_varcor( gen, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,96,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* invalid generator object */ +UNUR_GEN *gen = NULL; + gen = unur_str2gen("normal"); +abort_if_NULL(TESTLOG, 99, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,103,(unur_vempk_chg_smoothing( gen, 1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,103,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_vempk_chg_varcor( gen, 1 )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; + distr = unur_distr_cvemp_new(2); + unur_distr_cvemp_set_data(distr, data, 4); + par = unur_vempk_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 113, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,117,(unur_vempk_chg_smoothing( gen, -1.)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,117,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* does not exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double x[2]; + double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; + distr = unur_distr_cvemp_new(2); + unur_distr_cvemp_set_data(distr, data, 4); + par = unur_vempk_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 133, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,137,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,137,UNUR_ERR_NO_REINIT)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_sample_vec( gen, x ); +n_tests_failed += (check_expected_INFINITY(TESTLOG,141,(x[0]))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,141,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; + UNUR_GEN *clone = NULL; + distr = unur_distr_cvemp_new(2); + unur_distr_cvemp_set_data(distr, data, 4); + par = unur_vempk_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 153, gen ); + + +unur_reset_errno(); +/* default generator object */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,157,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,163,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* set smoothing factor */ +unur_free(gen); +par = unur_vempk_new(distr); +unur_vempk_set_smoothing( par, 3. ); +gen = unur_init( par ); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,170,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,176,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[2]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 2 */ +{ +#define dim (2) +{ double *data; + UNUR_DISTR *dist_mnormal; + UNUR_GEN *gen_mnormal; + int i; + const int ss = 100000; + data = malloc(dim*ss*sizeof(double)); + dist_mnormal = unur_distr_multinormal(dim,NULL,NULL); + gen_mnormal = unur_init(unur_mvstd_new(dist_mnormal)); + for (i=0;isetup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 4 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_vempk_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_vempk_new(distr_localcopy); +unur_vempk_set_varcor(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_vempk_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_vempk_new(distr_localcopy); +unur_vempk_set_varcor(par,TRUE); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_vempk_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_vempk.conf b/vendor/unuran-1.11.0/tests/t_vempk.conf new file mode 100644 index 0000000..0adefd9 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_vempk.conf @@ -0,0 +1,266 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: VEMPK + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + + +[new - data missing in distribution object: + distr = unur_distr_cvemp_new(2); ] + +/* data */ +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED + + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_smoothing( par, 1. ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_varcor( par, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameter object: + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); ] + +~_smoothing( par, 1. ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_varcor( par, 1 ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free (par); + +[set - invalid parameters: + double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; + distr = unur_distr_cvemp_new(2); + unur_distr_cvemp_set_data(distr, data, 4); + par = unur_vempk_new(distr); ] + +~_smoothing( par, -1. ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +unur_par_free(par); + + +############################################################################# + +# [get] + +############################################################################# + +[chg] + +[chg - invalid NULL ptr: + gen = NULL; ] + +~_smoothing( gen, 1.); + --> expected_setfailed --> UNUR_ERR_NULL + +~_varcor( gen, 1 ); + --> expected_setfailed --> UNUR_ERR_NULL + + +[chg - invalid generator object: + gen = unur_str2gen("normal"); <-- ! NULL ] + +~_smoothing( gen, 1.); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +~_varcor( gen, 1 ); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + + +[chg - invalid parameters: + double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; + distr = unur_distr_cvemp_new(2); + unur_distr_cvemp_set_data(distr, data, 4); + par = unur_vempk_new(distr); + gen = unur_init(par); <-- ! NULL ] + +~_smoothing( gen, -1.); + --> expected_setfailed --> UNUR_ERR_PAR_SET + + +############################################################################# + +# [init] + +############################################################################# + +[reinit] + +[reinit - does not exist: + double x[2]; + double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; + distr = unur_distr_cvemp_new(2); + unur_distr_cvemp_set_data(distr, data, 4); + par = unur_vempk_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_setfailed --> UNUR_ERR_NO_REINIT + +unur_sample_vec( gen, x ); +x[0]; + --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION + + +############################################################################# + +[sample] + +[sample - compare clone: + double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; + UNUR_GEN *clone = NULL; + distr = unur_distr_cvemp_new(2); + unur_distr_cvemp_set_data(distr, data, 4); + par = unur_vempk_new(distr); + gen = unur_init(par); <-- ! NULL ] + +/* default generator object */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +/* set smoothing factor */ +unur_free(gen); +par = unur_vempk_new(distr); +unur_vempk_set_smoothing( par, 3. ); +gen = unur_init( par ); + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +#[sample - compare stringparser: +# distr = NULL; +# par = NULL; +# gen = NULL; ] +# +# Not implemented yet! +# + +############################################################################# + +[validate] + +[validate - generators:] + +# default +par[0] = unur_vempk_new(@distr@); + +# use variance correction +par[1] = unur_vempk_new(@distr@); +unur_vempk_set_varcor(par,TRUE); + + +[validate - distributions:] + +# approximate normal distribution +\#define dim (2) +{ double *data; + UNUR_DISTR *dist_mnormal; + UNUR_GEN *gen_mnormal; + int i; + const int ss = 100000; + data = malloc(dim*ss*sizeof(double)); + dist_mnormal = unur_distr_multinormal(dim,NULL,NULL); + gen_mnormal = unur_init(unur_mvstd_new(dist_mnormal)); + for (i=0;i + + # approximate normal distribution (dim=2, sample size 100000) + <1> + + # approximate normal distribution (dim=3, sample size 100000) + + +############################################################################# +############################################################################# + +[verbatim] + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_vnrou.c b/vendor/unuran-1.11.0/tests/t_vnrou.c new file mode 100644 index 0000000..decc42c --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_vnrou.c @@ -0,0 +1,5804 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for VNROU + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +int unur_vnrou_set_pedantic( UNUR_PAR *par, int pedantic ); + +#define COMPARE_SAMPLE_SIZE (10000) +#define VIOLATE_SAMPLE_SIZE (20) + +/* Chi-square goodness-of-fit tests sometimes fail once due to numerical */ +/* errors. So we accept more such failure than for other methods. */ +#define CHI2_FAILURES_TOLERATED (5) + +/* we need marginal distributions for the chi2 tests */ +#define unur_distr_multicauchy unur_distr_multicauchy_w_marginals +#define unur_distr_multinormal unur_distr_multinormal_w_marginals +#define unur_distr_multistudent unur_distr_multistudent_w_marginals + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [verbatim] */ + + + +/* dummy function */ +int unur_vnrou_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_DISTR *distr = NULL; + distr = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,36,(unur_vnrou_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,36,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + +{ /* invalid distribution type */ +UNUR_DISTR *distr = NULL; + distr = unur_distr_discr_new(); + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,43,(unur_vnrou_new( distr )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,43,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [set] */ + +void test_set (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[set "); fflush(stdout); + fprintf(TESTLOG,"\n[set]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_PAR *par = NULL; + par = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,54,(unur_vnrou_set_u( par, NULL, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,54,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,57,(unur_vnrou_set_v( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,57,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,60,(unur_vnrou_set_r( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,63,(unur_vnrou_set_verify( par, 1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +} + +{ /* invalid parameter object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,72,(unur_vnrou_set_u( par, NULL, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,72,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,75,(unur_vnrou_set_v( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,75,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,78,(unur_vnrou_set_r( par, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,78,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,81,(unur_vnrou_set_verify( par, 1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,81,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + double umin[] = {1.,1.,1.}; + double umax[] = {2.,1.,2.}; + distr = unur_distr_multinormal( dim, mean, covar ); + par = unur_vnrou_new(distr); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,95,(unur_vnrou_set_u( par, NULL, NULL )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,95,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,98,(unur_vnrou_set_u( par, umin, umax )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,98,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,101,(unur_vnrou_set_v( par, -1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,104,(unur_vnrou_set_v( par, 0. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,104,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_vnrou_set_r( par, 0. ); +n_tests_failed += (check_errorcode(TESTLOG,107,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_par_free(par); +unur_distr_free(distr); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_set() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL ptr */ +UNUR_GEN *gen = NULL; + gen = NULL; + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,120,(unur_vnrou_get_volumehat( gen )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,120,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; +unur_free(gen); +} + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 124, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,128,(unur_vnrou_get_volumehat( gen )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,128,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [chg] */ + +void test_chg (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[chg "); fflush(stdout); + fprintf(TESTLOG,"\n[chg]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double umin[] = {1.,1.,1.}; + double umax[] = {2.,2.,2.}; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 139, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,143,(unur_vnrou_chg_u( gen, umin, umax )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,143,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,146,(unur_vnrou_chg_v( gen, 1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,146,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,149,(unur_vnrou_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,149,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* invalid parameters */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + double umin[] = {1.,1.,1.}; + double umax[] = {2.,1.,2.}; + distr = unur_distr_multinormal( dim, mean, covar ); + par = unur_vnrou_new(distr); + gen = unur_init(par); +abort_if_NULL(TESTLOG, 158, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,162,(unur_vnrou_chg_u( gen, umin, umax )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,162,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_setfailed(TESTLOG,165,(unur_vnrou_chg_v( gen, -1. )))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,165,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_chg() */ + +/*---------------------------------------------------------------------------*/ +/* [reinit] */ + +void test_reinit (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[reinit "); fflush(stdout); + fprintf(TESTLOG,"\n[reinit]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* does not exist */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_multinormal(3,NULL,NULL); + par = unur_vnrou_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 178, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_reinit(TESTLOG,182,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* compare */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + distr = unur_distr_multinormal( dim, mean, covar ); + par = unur_vnrou_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 193, gen ); + + +unur_reset_errno(); +; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,197,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); +par = unur_vnrou_new(distr); +unur_vnrou_set_verify(par,1); +gen = unur_init( par ); +n_tests_failed += (compare_sequence_gen(TESTLOG,204,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); +par = unur_vnrou_new(distr); +unur_vnrou_set_r(par,0.5); +gen = unur_init( par ); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,212,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); +par = unur_vnrou_new(distr); +unur_vnrou_set_r(par,0.5); +unur_vnrou_set_verify(par,1); +gen = unur_init( par ); +n_tests_failed += (compare_sequence_gen(TESTLOG,220,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare 1dim */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 1; + double mean[] = {1.}; + double covar[] = {2.}; + distr = unur_distr_multinormal( dim, mean, covar ); + par = unur_vnrou_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 228, gen ); + + +unur_reset_errno(); +; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,232,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +unur_free(gen); +par = unur_vnrou_new(distr); +unur_vnrou_set_verify(par,1); +gen = unur_init( par ); +n_tests_failed += (compare_sequence_gen(TESTLOG,239,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + UNUR_GEN *clone; + distr = unur_distr_multinormal( dim, mean, covar ); + par = unur_vnrou_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 248, gen ); + + +unur_reset_errno(); +/* normal distribution */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,252,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,258,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare clone 1dim */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + const int dim = 1; + double mean[] = {1.}; + double covar[] = {2.}; + UNUR_GEN *clone; + distr = unur_distr_multinormal( dim, mean, covar ); + par = unur_vnrou_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 268, gen ); + + +unur_reset_errno(); +/* normal distribution */; +n_tests_failed += (compare_sequence_gen_start(TESTLOG,272,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; +n_tests_failed += (compare_sequence_gen(TESTLOG,278,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* compare reinit */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_multinormal(3,NULL,NULL); + par = NULL; + gen = NULL; + + +unur_reset_errno(); +/* original generator object */ +par = unur_vnrou_new(distr); +gen = unur_init(par); +n_tests_failed += (compare_sequence_gen_start(TESTLOG,290,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +/* reinit */ +unur_reinit(gen); +n_tests_failed += (compare_sequence_gen(TESTLOG,294,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + +/*---------------------------------------------------------------------------*/ +/* [validate] */ + +/*---------------------------------------------------------------------------*/ + +/* [validate] */ + +void test_validate (void) +{ + /* suppress GCC compiler warning */ +GCC_DIAG_OFF(unused-variable) + + UNUR_DISTR *distr[35]; + UNUR_PAR *par; + UNUR_GEN *gen; + double *darray; + double fpm[10]; + int n_tests_failed; + int rcode; + + /* start test */ + printf("[validate "); fflush(stdout); + fprintf(TESTLOG,"\n[validate]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + +/* distributions: 35 */ +{ +distr[0] = unur_distr_multinormal(3,NULL,NULL); +} + +{ +double mean[] = { 1., 2., 3. }; +double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; +distr[1] = unur_distr_multinormal(3,mean,covar); +} + +{ +#define dim (2) +int i; +double mean[dim], covar[dim*dim]; +UNUR_DISTR *covar_distr; +UNUR_GEN *covar_gen; +UNUR_GEN *mean_gen; +covar_distr = unur_distr_correlation(dim); +covar_gen = unur_init(unur_mcorr_new(covar_distr)); +mean_gen = unur_str2gen("normal(5,1)"); +for (i=0; isetup time = %.3f ms\n", stopwatch_lap(&watch)); + + printf("\n(chi^2) "); fflush(stdout); + +/* chi^2 tests: 210 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nChi^2 Test:\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ double umin[] = {-0.608928,-0.608928,-0.608928}; +double umax[] = { 0.608928, 0.608928, 0.608928}; +double vmax = 0.51; +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_u(par,umin,umax); +unur_vnrou_set_v(par,vmax); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ double umin[] = {-0.608928,-0.608928,-0.608928}; +double umax[] = { 0.608928, 0.608928, 0.608928}; +double vmax = 0.51; +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_u(par,umin,umax); +unur_vnrou_set_v(par,vmax); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'-'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [3] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ double umin[] = {-0.608928,-0.608928,-0.608928}; +double umax[] = { 0.608928, 0.608928, 0.608928}; +double vmax = 0.70; +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_u(par,umin,umax); +unur_vnrou_set_v(par,vmax); } + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [22] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [28] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [29] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [31] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [32] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [33] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [34] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_vnrou_new(distr_localcopy); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_vnrou_new(distr_localcopy); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'0'); + n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; + n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; + unur_free(gen); + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + printf("\n(verify hat) "); fflush(stdout); + +/* verify hat tests: 210 */ + + unur_set_default_debug(~UNUR_DEBUG_SAMPLE); + fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); + +/* distribution [0] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ double umin[] = {-0.608928,-0.608928,-0.608928}; +double umax[] = { 0.608928, 0.608928, 0.608928}; +double vmax = 0.51; +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_u(par,umin,umax); +unur_vnrou_set_v(par,vmax); } + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [1] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ double umin[] = {-0.608928,-0.608928,-0.608928}; +double umax[] = { 0.608928, 0.608928, 0.608928}; +double vmax = 0.51; +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_u(par,umin,umax); +unur_vnrou_set_v(par,vmax); } + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'-')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [2] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [3] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [4] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [5] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); +{ double umin[] = {-0.608928,-0.608928,-0.608928}; +double umax[] = { 0.608928, 0.608928, 0.608928}; +double vmax = 0.70; +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_u(par,umin,umax); +unur_vnrou_set_v(par,vmax); } + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [6] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [7] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [8] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [9] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [10] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [11] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [12] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [13] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [14] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [15] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [16] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [17] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [18] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [19] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [20] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [21] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [22] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + +/* distribution [23] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [24] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [25] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [26] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [27] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [28] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [29] */ + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + printf("."); fflush(stdout); + } + + if(fullcheck) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [30] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) { +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + } + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + +/* distribution [31] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [32] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [33] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[33],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[33],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[33],'~')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + +/* distribution [34] */ + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[34],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,0.5); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[34],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + unur_reset_errno(); + do { + UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); +par = unur_vnrou_new(distr_localcopy); + unur_vnrou_set_pedantic(par,0); +unur_vnrou_set_r(par,2.); + gen = unur_init(par); + if (gen) unur_vnrou_chg_verify(gen,1); + n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[34],'0')==UNUR_SUCCESS)?0:1000; + unur_free(gen); + + unur_distr_free(distr_localcopy); + } while (0); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + if(TRUE) { + printf("."); fflush(stdout); + } + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); + + +/* free distributions */ + unur_distr_free(distr[0]); + unur_distr_free(distr[1]); + unur_distr_free(distr[2]); + unur_distr_free(distr[3]); + unur_distr_free(distr[4]); + unur_distr_free(distr[5]); + unur_distr_free(distr[6]); + unur_distr_free(distr[7]); + unur_distr_free(distr[8]); + unur_distr_free(distr[9]); + unur_distr_free(distr[10]); + unur_distr_free(distr[11]); + unur_distr_free(distr[12]); + unur_distr_free(distr[13]); + unur_distr_free(distr[14]); + unur_distr_free(distr[15]); + unur_distr_free(distr[16]); + unur_distr_free(distr[17]); + unur_distr_free(distr[18]); + unur_distr_free(distr[19]); + unur_distr_free(distr[20]); + unur_distr_free(distr[21]); + unur_distr_free(distr[22]); + unur_distr_free(distr[23]); + unur_distr_free(distr[24]); + unur_distr_free(distr[25]); + unur_distr_free(distr[26]); + unur_distr_free(distr[27]); + unur_distr_free(distr[28]); + unur_distr_free(distr[29]); + unur_distr_free(distr[30]); + unur_distr_free(distr[31]); + unur_distr_free(distr[32]); + unur_distr_free(distr[33]); + unur_distr_free(distr[34]); + + /* test finished */ + test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; + /* we accept CHI2_FAILURES_TOLERATED failures */ + (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_validate */ + +/* enable GCC compiler warning */ +GCC_DIAG_ON(unused-variable) + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_vnrou_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_vnrou.conf b/vendor/unuran-1.11.0/tests/t_vnrou.conf new file mode 100644 index 0000000..05b62e9 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_vnrou.conf @@ -0,0 +1,640 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: VNROU + +[main - header:] + +/* prototypes */ + +int unur_vnrou_set_pedantic( UNUR_PAR *par, int pedantic ); + +\#define COMPARE_SAMPLE_SIZE (10000) +\#define VIOLATE_SAMPLE_SIZE (20) + +/* Chi-square goodness-of-fit tests sometimes fail once due to numerical */ +/* errors. So we accept more such failure than for other methods. */ +\#define CHI2_FAILURES_TOLERATED (5) + +/* we need marginal distributions for the chi2 tests */ +\#define unur_distr_multicauchy unur_distr_multicauchy_w_marginals +\#define unur_distr_multinormal unur_distr_multinormal_w_marginals +\#define unur_distr_multistudent unur_distr_multistudent_w_marginals + +############################################################################# + +[new] + +[new - invalid NULL ptr: + distr = NULL; ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_NULL + + +[new - invalid distribution type: + distr = unur_distr_discr_new(); ] + +~( distr ); + --> expected_NULL --> UNUR_ERR_DISTR_INVALID + + +############################################################################# + +[set] + +[set - invalid NULL ptr: + par = NULL; ] + +~_u( par, NULL, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_v( par, 1. ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_r( par, 1. ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_verify( par, 1); + --> expected_setfailed --> UNUR_ERR_NULL + + +[set - invalid parameter object: + double fpar[2] = {0.,1.}; + distr = unur_distr_normal(fpar,2); + par = unur_arou_new(distr); ] + +~_u( par, NULL, NULL ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_v( par, 1. ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_r( par, 1. ); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +~_verify( par, 1); + --> expected_setfailed --> UNUR_ERR_PAR_INVALID + +unur_par_free(par); + +[set - invalid parameters: + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + double umin[] = {1.,1.,1.}; + double umax[] = {2.,1.,2.}; + distr = unur_distr_multinormal( dim, mean, covar ); + par = unur_vnrou_new(distr); ] + +~_u( par, NULL, NULL ); + --> expected_setfailed --> UNUR_ERR_NULL + +~_u( par, umin, umax ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_v( par, -1. ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_v( par, 0. ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_r( par, 0. ); + --> none --> UNUR_ERR_PAR_SET + +unur_par_free(par); + + +############################################################################# + +[get] + +[get - invalid NULL ptr: + gen = NULL; ] + +~_volumehat( gen ); + --> expected_INFINITY --> UNUR_ERR_NULL + +[get - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + gen = unur_init(par); <-- ! NULL ] + +~_volumehat( gen ); + --> expected_INFINITY --> UNUR_ERR_GEN_INVALID + +############################################################################# + +[chg] + +[chg - invalid generator object: + double umin[] = {1.,1.,1.}; + double umax[] = {2.,2.,2.}; + distr = unur_distr_normal(NULL,0); + par = unur_arou_new(distr); + unur_set_debug(par,0); + gen = unur_init( par ); <-- ! NULL ] + +~_u( gen, umin, umax ); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +~_v( gen, 1. ); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +~_verify(gen,1); + --> expected_setfailed --> UNUR_ERR_GEN_INVALID + +[chg - invalid parameters: + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + double umin[] = {1.,1.,1.}; + double umax[] = {2.,1.,2.}; + distr = unur_distr_multinormal( dim, mean, covar ); + par = unur_vnrou_new(distr); + gen = unur_init(par); <-- ! NULL ] + +~_u( gen, umin, umax ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + +~_v( gen, -1. ); + --> expected_setfailed --> UNUR_ERR_PAR_SET + + +############################################################################# + +# [init] + +############################################################################# + +[reinit] + +[reinit - does not exist: + distr = unur_distr_multinormal(3,NULL,NULL); + par = unur_vnrou_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_reinit( gen ); + --> expected_reinit + +############################################################################# + +[sample] + +[sample - compare: + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + distr = unur_distr_multinormal( dim, mean, covar ); + par = unur_vnrou_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +# default + -->compare_sequence_gen_start + +# default - verifying mode +unur_free(gen); +par = unur_vnrou_new(distr); +unur_vnrou_set_verify(par,1); +gen = unur_init( par ); + -->compare_sequence_gen + + +# r = 0.5 +unur_free(gen); +par = unur_vnrou_new(distr); +unur_vnrou_set_r(par,0.5); +gen = unur_init( par ); + -->compare_sequence_gen_start + +# r = 0.5 - verifying mode +unur_free(gen); +par = unur_vnrou_new(distr); +unur_vnrou_set_r(par,0.5); +unur_vnrou_set_verify(par,1); +gen = unur_init( par ); + -->compare_sequence_gen + + +[sample - compare 1dim: + const int dim = 1; + double mean[] = {1.}; + double covar[] = {2.}; + distr = unur_distr_multinormal( dim, mean, covar ); + par = unur_vnrou_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +# default + -->compare_sequence_gen_start + +# default - verifying mode +unur_free(gen); +par = unur_vnrou_new(distr); +unur_vnrou_set_verify(par,1); +gen = unur_init( par ); + -->compare_sequence_gen + + +[sample - compare clone: + const int dim = 3; + double mean[] = {1.,2.,3.}; + double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; + UNUR_GEN *clone; + distr = unur_distr_multinormal( dim, mean, covar ); + par = unur_vnrou_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* normal distribution */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare clone 1dim: + const int dim = 1; + double mean[] = {1.}; + double covar[] = {2.}; + UNUR_GEN *clone; + distr = unur_distr_multinormal( dim, mean, covar ); + par = unur_vnrou_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +/* normal distribution */ + -->compare_sequence_gen_start + +/* clone */ +clone = unur_gen_clone(gen); +unur_free(gen); +gen = clone; + -->compare_sequence_gen + +#..................................................................... + +[sample - compare reinit: + distr = unur_distr_multinormal(3,NULL,NULL); + par = NULL; + gen = NULL; ] + +/* original generator object */ +par = unur_vnrou_new(distr); +gen = unur_init(par); + -->compare_sequence_gen_start + +/* reinit */ +unur_reinit(gen); + -->compare_sequence_gen + + +############################################################################# + +[validate] + +[validate - generators:] + +# default program +par[0] = unur_vnrou_new(@distr@); + +# r = 0.5 +par[1] = unur_vnrou_new(@distr@); +unur_vnrou_set_r(par,0.5); + +# r = 2 +par[2] = unur_vnrou_new(@distr@); +unur_vnrou_set_r(par,2.); + +# default with bounding rectangle +{ double umin[] = {-0.608928,-0.608928,-0.608928}; +double umax[] = { 0.608928, 0.608928, 0.608928}; +double vmax = 0.51; +par[3] = unur_vnrou_new(@distr@); +unur_vnrou_set_u(par,umin,umax); +unur_vnrou_set_v(par,vmax); } + + +# default with bounding rectangle +{ double umin[] = {-0.608928,-0.608928,-0.608928}; +double umax[] = { 0.608928, 0.608928, 0.608928}; +double vmax = 0.70; +par[4] = unur_vnrou_new(@distr@); +unur_vnrou_set_u(par,umin,umax); +unur_vnrou_set_v(par,vmax); } + +# default variant but reinitialized with changed distribution +{ UNUR_DISTR *dg =NULL; +double mean[] = { -1., 2., -3. }; +double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; +par[5] = unur_vnrou_new(@distr@); +dg = unur_get_distr(gen); +unur_distr_cvec_set_mean(dg,mean); +unur_distr_cvec_set_covar(dg,covar); +unur_distr_cvec_upd_mode(dg); +unur_distr_cvec_upd_pdfvol(dg); +unur_reinit(gen); } + + +[validate - distributions:] + +# standard multinormal distribution +distr[0] = unur_distr_multinormal(3,NULL,NULL); + + +# multinormal distribution, dim = 3 +double mean[] = { 1., 2., 3. }; +double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; +distr[1] = unur_distr_multinormal(3,mean,covar); + + +# random multinormal distribution +\#define dim (2) +int i; +double mean[dim], covar[dim*dim]; +UNUR_DISTR *covar_distr; +UNUR_GEN *covar_gen; +UNUR_GEN *mean_gen; +covar_distr = unur_distr_correlation(dim); +covar_gen = unur_init(unur_mcorr_new(covar_distr)); +mean_gen = unur_str2gen("normal(5,1)"); +for (i=0; i + + + + . + # standard multinormal (dim=3) + <1> + + + - . + # multinormal (dim=3) +x <2> + + + . . . # random multinormal (dim=2) +x <3> + + + . . + # random multinormal (dim=3) + <4> + + + . . + # multinormal (dim=3), shifted center + <5> + + + . + . # standard multinormal (dim=1) + <6> + + + . . . # multinormal (dim=1), shifted center + <7> + + + . . . # multinormal with AR(1) (rho=0.5, dim=2) + <8> + + + . . + # multinormal with AR(1) (rho=0.5, dim=3) + <9> + + + . . . # multinormal with AR(1) (rho=0.5, dim=4) +x<10> + + + . . . # multinormal with AR(1) (rho=0.5, dim=5) + <11> + . + . . . # multicauchy with AR(1) (rho=0.2, dim=2) + <12> + . + . . + # multicauchy with AR(1) (rho=0.2, dim=3) + <13> + . + . . . # multicauchy with AR(1) (rho=0.2, dim=4) + <14> + . + . . . # multicauchy with AR(1) (rho=0.2, dim=5) + <15> + + + . . + # multistudent with AR(1) (rho=0.4, dim=3, nu=4) +x<16> + + + . . + # multistudent with AR(1) (rho=0.4, dim=3, nu=5) + <17> + + + . . + # multistudent with AR(1) (rho=0.4, dim=3, nu=6) +x<18> + + + . . + # multistudent with AR(1) (rho=0.4, dim=3, nu=7) + <19> + + + . . . # multinormal with constant rho (rho=0.5, dim=2) + <20> + + + . . + # multinormal with constant rho (rho=0.5, dim=3) + <21> + + + . . . # multinormal with constant rho (rho=0.5, dim=4) +x<22> + + + . . . # multinormal with constant rho (rho=0.5, dim=5) + <23> + . + . . . # multicauchy with constant rho (rho=0.2, dim=2) + <24> + . + . . + # multicauchy with constant rho (rho=0.2, dim=3) + <25> + . + . . . # multicauchy with constant rho (rho=0.2, dim=4) + <26> + . + . . . # multicauchy with constant rho (rho=0.2, dim=5) + <27> + + + . . + # multistudent with constant rho (rho=0.4, dim=3, nu=4) +x<28> + + + . . + # multistudent with constant rho (rho=0.4, dim=3, nu=5) +x<29> + + + . . + # multistudent with constant rho (rho=0.4, dim=3, nu=6) + <30> + + + . . + # multistudent with constant rho (rho=0.4, dim=3, nu=7) + <31> + + + . . . # standard multinormal distribution with rectangular domain + <32> + + + . . . # standard multinormal distribution with rectangular domain + <33> + + + . . . # standard multinormal distribution with rectangular domain + <34> 0 0 0 . . . # invalid: default center of distribution out of truncated domain + + +[validate - verify hat:] + +# + ... pass test +# ~ ... fail in at most 1% of samples +# 0 ... fail to initialize generator +# - ... fail test +# . ... do not run test +# # ... comment +# +# generators: +# [0] ... default variant +# [1] ... r = 0.5 +# [2] ... r = 2 +# [3] ... r = default, given rectangle +# [4] ... r = default, given rectangle +# [5] ... default variant but reinitialized with changed distribution +# +#gen 0 1 2 3 4 5 # distribution +#--------------------------------------------- + <0> + + + + . + # standard multinormal (dim=3) + <1> + + + - . + # multinormal (dim=3) +x <2> + + + . . . # random multinormal (dim=2) +x <3> + + + . . + # random multinormal (dim=3) + <4> + + + . . + # multinormal (dim=3), shifted center + <5> + + + . + . # standard multinormal (dim=1) + <6> + + + . . . # multinormal (dim=1), shifted center + <7> + + + . . . # multinormal with AR(1) (rho=0.5, dim=2) + <8> + + + . . + # multinormal with AR(1) (rho=0.5, dim=3) + <9> + + + . . . # multinormal with AR(1) (rho=0.5, dim=4) +x<10> + + + . . . # multinormal with AR(1) (rho=0.5, dim=5) + <11> + . + . . . # multicauchy with AR(1) (rho=0.2, dim=2) + <12> + . + . . + # multicauchy with AR(1) (rho=0.2, dim=3) + <13> + . + . . . # multicauchy with AR(1) (rho=0.2, dim=4) + <14> + . + . . . # multicauchy with AR(1) (rho=0.2, dim=5) +x<15> + + + . . + # multistudent with AR(1) (rho=0.4, dim=3, nu=4) +x<16> + + + . . + # multistudent with AR(1) (rho=0.4, dim=3, nu=5) + <17> + + + . . + # multistudent with AR(1) (rho=0.4, dim=3, nu=6) + <18> + + + . . + # multistudent with AR(1) (rho=0.4, dim=3, nu=7) + <19> + + + . . . # multinormal with constant rho (rho=0.5, dim=2) + <20> + + + . . + # multinormal with constant rho (rho=0.5, dim=3) + <21> + + + . . . # multinormal with constant rho (rho=0.5, dim=4) +x<22> + + + . . . # multinormal with constant rho (rho=0.5, dim=5) + <23> + . + . . . # multicauchy with constant rho (rho=0.2, dim=2) + <24> + . + . . + # multicauchy with constant rho (rho=0.2, dim=3) + <25> + . + . . . # multicauchy with constant rho (rho=0.2, dim=4) + <26> + . + . . . # multicauchy with constant rho (rho=0.2, dim=5) + <27> + + + . . + # multistudent with constant rho (rho=0.4, dim=3, nu=4) +x<28> + + + . . + # multistudent with constant rho (rho=0.4, dim=3, nu=5) +x<29> + + + . . + # multistudent with constant rho (rho=0.4, dim=3, nu=6) + <30> + + + . . + # multistudent with constant rho (rho=0.4, dim=3, nu=7) + <31> + + + . . . # standard multinormal distribution with rectangular domain + <32> + + + . . . # standard multinormal distribution with rectangular domain + <33> + + + . . . # standard multinormal distribution with rectangular domain + <34> 0 0 0 . . . # invalid: default center of distribution out of truncated domain + + +############################################################################# +############################################################################# + +[verbatim] + +/* dummy function */ +int unur_vnrou_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) +{ return 1; } + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/t_x_gen.c b/vendor/unuran-1.11.0/tests/t_x_gen.c new file mode 100644 index 0000000..66388a4 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_x_gen.c @@ -0,0 +1,419 @@ +/* + file automatically generated by make_test_files.pl + Tue May 16 16:46:35 2023 +*/ + +/***************************************************************************** + * * + * UNU.RAN -- Universal Non-Uniform Random number generator * + * * + *****************************************************************************/ + +/** + ** Tests for X_GEN + **/ + +/*---------------------------------------------------------------------------*/ +#include "testunuran.h" + +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM +#include +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +static FILE *TESTLOG; /* test log file */ +static FILE *UNURANLOG; /* unuran log file */ + +static int test_ok = TRUE; /* all tests ok (boolean) */ +static int fullcheck = FALSE; /* whether all checks are performed */ + +static TIMER watch; /* stop watch */ + +/*---------------------------------------------------------------------------*/ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); + +int unur_x_gen_set_verify( UNUR_PAR *par, int verify); + + +/*---------------------------------------------------------------------------*/ + +void test_new (void); +void test_set (void); +void test_get (void); +void test_chg (void); +void test_init (void); +void test_reinit (void); +void test_sample (void); +void test_validate (void); +void test_special(void); + +/*---------------------------------------------------------------------------*/ + + + +/* prototypes */ + +#define COMPARE_SAMPLE_SIZE (500) +#define VIOLATE_SAMPLE_SIZE (20) + + + + + +/*---------------------------------------------------------------------------*/ + +#ifndef CHI2_FAILURES_TOLERATED +# define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED +#endif + +/*---------------------------------------------------------------------------*/ +/* [new] */ + +void test_new (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[new "); fflush(stdout); + fprintf(TESTLOG,"\n[new]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_new() */ + +/*---------------------------------------------------------------------------*/ +/* [get] */ + +void test_get (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[get "); fflush(stdout); + fprintf(TESTLOG,"\n[get]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid NULL */ + + +unur_reset_errno(); +n_tests_failed += (check_expected_NULL(TESTLOG,33,(unur_get_genid(NULL)))==UNUR_SUCCESS)?0:1; + +unur_reset_errno(); +n_tests_failed += (check_expected_zero(TESTLOG,36,(unur_get_method(NULL)))==UNUR_SUCCESS)?0:1; +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_get() */ + +/*---------------------------------------------------------------------------*/ +/* [sample] */ + +void test_sample (void) +{ + int n_tests_failed; /* number of failed tests */ + + /* start test */ + printf("[sample "); fflush(stdout); + fprintf(TESTLOG,"\n[sample]\n"); + + /* reset counter */ + n_tests_failed = 0; + + /* set stop watch */ + stopwatch_lap(&watch); + +{ /* invalid generator object */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 56, gen ); + + +unur_reset_errno(); +n_tests_failed += (check_expected_INFINITY(TESTLOG,60,(unur_quantile(gen,0.5)))==UNUR_SUCCESS)?0:1; +n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_NO_QUANTILE)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* CSTD quantile function */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_cstd_new(distr); + unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 66, gen ); + + +unur_reset_errno(); +unur_quantile(gen,0.5); +n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* DGT quantile function */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dgt_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 76, gen ); + + +unur_reset_errno(); +unur_quantile(gen,0.5); +n_tests_failed += (check_errorcode(TESTLOG,80,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* DSTD quantile function */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + double fpar[1] = {0.3}; + distr = unur_distr_geometric(fpar,1); + par = unur_dstd_new(distr); + unur_dstd_set_variant(par,UNUR_STDGEN_INVERSION); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 87, gen ); + + +unur_reset_errno(); +unur_quantile(gen,0.5); +n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* HINV quantile function */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_hinv_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 96, gen ); + + +unur_reset_errno(); +unur_quantile(gen,0.5); +n_tests_failed += (check_errorcode(TESTLOG,100,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* NINV quantile function */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_ninv_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 105, gen ); + + +unur_reset_errno(); +unur_quantile(gen,0.5); +n_tests_failed += (check_errorcode(TESTLOG,109,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + +{ /* PINV quantile function */ +UNUR_DISTR *distr = NULL; +UNUR_PAR *par = NULL; +UNUR_GEN *gen = NULL; + distr = unur_distr_normal(NULL,0); + par = unur_pinv_new(distr); + gen = unur_init( par ); +abort_if_NULL(TESTLOG, 114, gen ); + + +unur_reset_errno(); +unur_quantile(gen,0.5); +n_tests_failed += (check_errorcode(TESTLOG,118,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; +unur_distr_free(distr); +unur_free(gen); +} + + + /* timing */ + stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); + + /* test finished */ + test_ok &= (n_tests_failed) ? 0 : 1; + (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); + +} /* end of test_sample() */ + + +/*---------------------------------------------------------------------------*/ +/* run generator in verifying mode */ + +void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) +{ + UNUR_GEN *gen; + int i; + + /* switch to verifying mode */ + unur_x_gen_set_verify(par,1); + + /* initialize generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line, gen); + + /* run generator */ + for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); + + fclose(UNURANLOG); + fclose(TESTLOG); + + /* free memory */ + compare_free_memory(); + unur_urng_free(unur_get_default_urng()); + unur_urng_free(unur_get_default_urng_aux()); + + /* exit */ + exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); + +} /* end of main */ + diff --git a/vendor/unuran-1.11.0/tests/t_x_gen.conf b/vendor/unuran-1.11.0/tests/t_x_gen.conf new file mode 100644 index 0000000..2db5c26 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/t_x_gen.conf @@ -0,0 +1,129 @@ +############################################################################# + +[main] + +[main - data:] + +# method (for information only: the program scans the file name) +method: X_GEN + +[main - header:] + +/* prototypes */ + +\#define COMPARE_SAMPLE_SIZE (500) +\#define VIOLATE_SAMPLE_SIZE (20) + + +############################################################################# + +[new] + +############################################################################# + +# [set] + +############################################################################# + +[get] + +[get - invalid NULL: ] + +unur_get_genid(NULL) + --> expected_NULL + +unur_get_method(NULL) + --> expected_zero + +############################################################################# + +# [chg] + +############################################################################## + +# [init] + +############################################################################# + +# [reinit] + +############################################################################# + +[sample] + +[sample - invalid generator object: + distr = unur_distr_normal(NULL,0); + par = unur_tdr_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_quantile(gen,0.5); + --> expected_INFINITY --> UNUR_ERR_NO_QUANTILE + + +[sample - CSTD quantile function: + distr = unur_distr_normal(NULL,0); + par = unur_cstd_new(distr); + unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION); + gen = unur_init( par ); <-- ! NULL ] + +unur_quantile(gen,0.5); + --> none --> UNUR_SUCCESS + + +[sample - DGT quantile function: + double fpar[2] = {10.,0.63}; + distr = unur_distr_binomial(fpar,2); + par = unur_dgt_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_quantile(gen,0.5); + --> none --> UNUR_SUCCESS + + +[sample - DSTD quantile function: + double fpar[1] = {0.3}; + distr = unur_distr_geometric(fpar,1); + par = unur_dstd_new(distr); + unur_dstd_set_variant(par,UNUR_STDGEN_INVERSION); + gen = unur_init( par ); <-- ! NULL ] + +unur_quantile(gen,0.5); + --> none --> UNUR_SUCCESS + + +[sample - HINV quantile function: + distr = unur_distr_normal(NULL,0); + par = unur_hinv_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_quantile(gen,0.5); + --> none --> UNUR_SUCCESS + + +[sample - NINV quantile function: + distr = unur_distr_normal(NULL,0); + par = unur_ninv_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_quantile(gen,0.5); + --> none --> UNUR_SUCCESS + + +[sample - PINV quantile function: + distr = unur_distr_normal(NULL,0); + par = unur_pinv_new(distr); + gen = unur_init( par ); <-- ! NULL ] + +unur_quantile(gen,0.5); + --> none --> UNUR_SUCCESS + + +############################################################################# + +# [validate] + +############################################################################# + +# [special] + +############################################################################# diff --git a/vendor/unuran-1.11.0/tests/test_StdDistr.c b/vendor/unuran-1.11.0/tests/test_StdDistr.c new file mode 100644 index 0000000..a4a3d74 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/test_StdDistr.c @@ -0,0 +1,613 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: test_StdDistr.c * + * * + * Compare CDF, PDF and derivatives of PDF of varios distributions * + * with Mathematica(TM) output. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +/* #define DEBUG 1 */ + +/*---------------------------------------------------------------------------*/ +#include +#include +#include +#include +#include + +#include +#include + +/*---------------------------------------------------------------------------*/ + +/* PDF test: maximal difference allowed (relative to maximal value) */ +#define MAX_REL_DIFF 1.e-10 + +/* mode test: */ +#define EPSX 1.e-5 /* stepsize */ +#define EPSY 1.e-12 /* maximal allowed relative error */ + +/*---------------------------------------------------------------------------*/ + +/* name of data file */ +static const char datafile[] = "t_StdDistr.data"; + +/* file handles */ +static FILE *DATA; /* file with data */ +static FILE *UNURANLOG; /* unuran log file */ +static FILE *TESTLOG; /* test log file */ + +/*---------------------------------------------------------------------------*/ + +static int _unur_test_StdDistr (int *n_failed); +/* main loop for testing standard distributions */ + +static int test_cdf_pdf( UNUR_DISTR *distr, char *datafile ); +/* compare CDF, PDF and dPDF for continuous univariate distributions */ + +static int modetest_cont( UNUR_DISTR *distr); +static int modetest_discr( UNUR_DISTR *distr); +/* test mode of distribution */ + +/*---------------------------------------------------------------------------*/ + +#define MAX(a,b) ( ((a) < (b)) ? (b) : (a)) +#define MIN(a,b) ( ((a) > (b)) ? (b) : (a)) + +/*---------------------------------------------------------------------------*/ + +int main() +{ + /* number of failed tests */ + int n_failed = 0; + + /* open log file for unuran and set output stream for unuran messages */ + if ( (UNURANLOG = fopen( "t_StdDistr_unuran.log","w" )) == NULL ) + exit (EXIT_FAILURE); + unur_set_stream( UNURANLOG ); + + /* open log file for testing */ + if ( (TESTLOG = fopen( "t_StdDistr_test.log","w" )) == NULL ) + exit (EXIT_FAILURE); + + /* write header into log file */ + { + time_t started; + fprintf(TESTLOG,"\nUNU.RAN - Universal Non-Uniform RANdom number generator\n\n"); + if (time( &started ) != -1) + fprintf(TESTLOG,"%s",ctime(&started)); + fprintf(TESTLOG,"\n=======================================================\n\n"); + fprintf(TESTLOG,"(Search for string \"distr=\" to find new section.)\n\n"); + } + + /* open data file */ + if ( (DATA = fopen( datafile,"r" )) == NULL ) { + printf("ERROR: could not open file %s \n", datafile); + fprintf(TESTLOG,"ERROR: could not open file %s \n", datafile); + exit (77); /* ignore this error */ + } + + /* run tests on all distributions */ + while (_unur_test_StdDistr(&n_failed)==TRUE); + + /* close files */ + fclose (UNURANLOG); + fclose (TESTLOG); + fclose (DATA); + + /* end */ + if (n_failed > 0) { + printf("[StdDistr --> failed]\n"); + exit (EXIT_FAILURE); + } + else { + printf("[StdDistr --> ok]\n"); + exit (EXIT_SUCCESS); + } +} /* end of main() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_test_StdDistr (int *n_failed) +{ +#define BUFSIZE 1024 /* size of line buffer */ + + char buffer[BUFSIZE]; /* buffer for reading line */ + char dstr[BUFSIZE]; /* distribution string */ + + UNUR_DISTR *distr; /* distribution object */ + + /* find next function string */ + while (1) { + /* read next line */ + fgets(buffer, BUFSIZE, DATA); + if (feof(DATA)) return FALSE; + if (strncmp(buffer,"distr=",6)==0) break; + } + + /* get function string */ + strcpy( dstr, buffer+6 ); + /* remove newline character */ + dstr[strlen(dstr)-1] = '\0'; + + /* make distribution object with given function as PDF */ + if ( (distr = unur_str2distr(dstr)) == NULL ) { + printf("ERROR: syntax error in \"%s\"\n", dstr); + fprintf(TESTLOG,"ERROR: syntax error in \"%s\"\n", dstr); + exit (EXIT_FAILURE); + } + + /* now run test */ + if (test_cdf_pdf( distr,dstr ) == UNUR_FAILURE) + (*n_failed)++; + + /* free memory */ + unur_distr_free(distr); + + return TRUE; + +#undef BUFSIZE +} /* end of _unur_test_StdDistr() */ + +/*---------------------------------------------------------------------------*/ + +int +test_cdf_pdf( UNUR_DISTR *distr, char *distrAPI ) + /*----------------------------------------------------------------------*/ + /* test CDF, PDF and derivative of PDF by comparing to data */ + /* read from file created by Mathematica. */ + /* */ + /* the ordering in this file is: */ + /* n par[1] par[2] ... par[n] x CDF PDF dPDF */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* distrAPI ... string that contains name for distribution */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... if test was successful */ + /* UNUR_FAILURE ... failed (difference too large) */ + /* UNUR_ERR_NULL ... could not run test */ + /*----------------------------------------------------------------------*/ +{ +#define BUFSIZE 1024 /* size of line buffer */ +#define MAX_FPARAMS 10 /* maximal number of parameters for distribution */ + + char buffer[BUFSIZE]; /* buffer for reading line */ + char *ptr_buffer; /* pointer into buffer */ + + int n_fparams; /* number of parameters for distribution */ + double fparams[10]; /* array for parameters for distribution */ + double x; /* double argument */ + int k = 0; /* integer argument */ + double CDF_e, PDF_e, dPDF_e; /* expected values for CDF, PDF and derivative of PDF at x */ + double CDF_o, PDF_o, dPDF_o; /* observed values for CDF, PDF and derivative of PDF at x */ + double CDF_d, PDF_d, dPDF_d; /* differences between observed and expected values */ + + double CDF_md, PDF_md, dPDF_md; /* maximal difference (absolute) */ + double CDF_me, PDF_me, dPDF_me; /* maximal expected absolute values */ + + int have_CDF, have_PDF, have_dPDF, have_upd_pdfarea; + + int is_DISCR; /* 1 if discrete distribution, 0 otherwise */ + int n_failed = 0; /* number of failed tests */ + + const char *dname; /* name of distribution */ + + int i; + + /* discrete distribution ? */ + is_DISCR = unur_distr_is_discr( distr ); + + /* name of distribution */ + dname = unur_distr_get_name(distr); + + /* initialize */ + CDF_md = PDF_md = dPDF_md = 0.; + CDF_me = PDF_me = dPDF_me = 0.; + + /* check existence of CDF, PDF and dPDF */ + if (is_DISCR==TRUE) { + have_CDF = (unur_distr_discr_get_cdf(distr)) ? TRUE : FALSE; + have_PDF = (unur_distr_discr_get_pmf(distr)) ? TRUE : FALSE; + have_dPDF = FALSE; + } + else { /* is_CONT */ + have_CDF = (unur_distr_cont_get_cdf(distr)) ? TRUE : FALSE; + have_PDF = (unur_distr_cont_get_pdf(distr)) ? TRUE : FALSE; + have_dPDF = (unur_distr_cont_get_dpdf(distr)) ? TRUE : FALSE; + } + + /* check whether unur_distr_cont_upd_pdfarea() works */ + if (is_DISCR==TRUE) + have_upd_pdfarea = (unur_distr_discr_upd_pmfsum(distr)==UNUR_SUCCESS) ? TRUE : FALSE; + else /* is_CONT */ + have_upd_pdfarea = (unur_distr_cont_upd_pdfarea(distr)==UNUR_SUCCESS) ? TRUE : FALSE; + + if (have_upd_pdfarea==FALSE) { + /* if we cannot update the area below the PDF, then the + given PDF is not a "real" PDF, i.e. not normalized */ + have_PDF = FALSE; + have_dPDF = FALSE; + } + + /* print info into log file */ + fprintf(TESTLOG,"%s: distr= %s ...\n", dname, distrAPI); + + if (have_CDF==FALSE) + fprintf(TESTLOG,"%s: no CDF!\n", dname); + if (have_PDF==FALSE) + fprintf(TESTLOG,"%s: no PDF!\n", dname); + if (have_dPDF==FALSE) + fprintf(TESTLOG,"%s: no dPDF!\n", dname); + + /* read data file */ + while (1) { + + /* read next line */ + fgets(buffer, BUFSIZE-1, DATA); + if (feof(DATA) || isspace(buffer[0])) break; + + ptr_buffer = buffer; + + /* get number of parameters */ + n_fparams = strtol(buffer, &ptr_buffer, 10); + if (n_fparams < 0 || n_fparams >= MAX_FPARAMS) { + printf("%s: ERROR: invalid number of parameters for distribution: %d \n", dname,n_fparams); + fprintf(TESTLOG,"%s: ERROR: invalid number of parameters for distribution: %d \n", dname,n_fparams); + return UNUR_ERR_NULL; + } + + /* read parameters */ + for (i=0; i CDF_md) CDF_md = CDF_d; + if (PDF_d > PDF_md) PDF_md = PDF_d; + if (dPDF_d > dPDF_md) dPDF_md = dPDF_d; + + /* maximal values */ + if (CDF_e > CDF_me) CDF_me = CDF_e; + if (PDF_e > PDF_me) PDF_me = PDF_e; + if (dPDF_e > dPDF_me) dPDF_me = dPDF_e; + + /* test mode of distribution */ + if (is_DISCR) { + if (modetest_discr(distr) == UNUR_FAILURE) + ++n_failed; + } + else { /* is_CONT */ + if (modetest_cont(distr) == UNUR_FAILURE) + ++n_failed; + } + + } + + /* print info on screen */ + fprintf(TESTLOG, "%s: \tmaximal difference:\n", dname); + + if (have_CDF) { + fprintf(TESTLOG,"%s: \t\tCDF = %g ... ", dname,CDF_md); + if (CDF_md > MAX_REL_DIFF * CDF_me) { + fprintf(TESTLOG, "failed!!\n"); + ++n_failed; + } + else + fprintf(TESTLOG, "ok\n"); + } + + if (have_PDF) { + fprintf(TESTLOG,"%s: \t\tPDF = %g (rel = %g) ... ", dname,PDF_md,PDF_md/PDF_me); + if (PDF_md > MAX_REL_DIFF * PDF_me) { + fprintf(TESTLOG, "failed!!\n"); + ++n_failed; + } + else + fprintf(TESTLOG, "ok\n"); + } + + if (have_dPDF) { + fprintf(TESTLOG,"%s: \t\tdPDF = %g (rel = %g) ... ", dname,dPDF_md,dPDF_md/dPDF_me); + if (dPDF_md > MAX_REL_DIFF * dPDF_me) { + fprintf(TESTLOG, "failed!!\n"); + ++n_failed; + } + else + fprintf(TESTLOG, "ok\n"); + } + + fprintf(TESTLOG, "\n----------------------------------------\n\n"); + + /* print result on screen */ + printf("%-17s ... ", dname ); + if (n_failed > 0) { + printf("failed!!\n"); + return UNUR_FAILURE; + } + else { + printf("ok\n"); + return UNUR_SUCCESS; + } + +#undef BUFSIZE +#undef MAX_FPARAMS +} /* end of test_cdf_pdf() */ + +/*---------------------------------------------------------------------------*/ + +int modetest_cont( UNUR_DISTR *distr) + /*----------------------------------------------------------------------*/ + /* Tests whether the mode of continuous distribution is correct. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... if test was successful */ + /* UNUR_FAILURE ... failed (difference too large) */ + /* UNUR_ERR_NULL ... could not run test */ + /*----------------------------------------------------------------------*/ +{ + double m, fm; /* mode and value of PDF at mode */ + double x, fx; /* argument x and value of PDF at x */ + double domain[2]; /* boundaries of the domain of distribution */ + const char *dname; /* name of distribution */ + int n_failed = 0; /* number of failed tests */ + int i; /* loop variable */ + + /* name of distribution */ + dname = unur_distr_get_name(distr); + + /* get mode */ + if (unur_distr_cont_upd_mode(distr)!=UNUR_SUCCESS ) { + /* cannot read mode */ + printf("%s: ERROR: cannot get mode\n", dname); + fprintf(TESTLOG,"%s: ERROR: cannot get mode\n", dname); + return UNUR_ERR_NULL; + } + m = unur_distr_cont_get_mode(distr); + + /* Correct possible problems if the mode m is on the boundary of domain */ + unur_distr_cont_get_domain(distr,domain, domain+1); + if(domain[1] - m < 1.e-11) + m = MIN( m-EPSX/2., m*(m<0?(1.+EPSX/2.):1.-EPSX/2.) ); + if(m - domain[0] < 1.e-11) + m = MAX( m+EPSX/2., m*(m>0?(1.+EPSX/2.):1.-EPSX/2.) ); + + /* evaluate PDF at mode */ + fm = unur_distr_cont_eval_pdf(m, distr); + +#ifdef DEBUG + fprintf(TESTLOG,"%s: mode: m = %.20g, f(m) = %.20g\n", dname,m,fm); +#endif + + /* test PDF left and right of mode */ + for (i=0; i<2; i++) { + + if (i==0) + /* right of mode */ + x = MAX( m+EPSX, m*(m>0?(1.+EPSX):1.-EPSX) ); + + else + /* left of mode */ + x = MIN( m-EPSX, m*(m<0?(1.+EPSX):1.-EPSX) ); + + /* evaluate PDF */ + fx = unur_distr_cont_eval_pdf(x, distr); + +#ifdef DEBUG + fprintf(TESTLOG,"%s: x = %.20g, f(x) = %.20g", dname,x,fx); +#endif + + if(fm * (1.+EPSY) < fx) { +#ifdef DEBUG + fprintf(TESTLOG," ... failed! f(mode) not maximal!"); +#endif + ++n_failed; + } + +#ifdef DEBUG + fprintf(TESTLOG,"\n"); +#endif + } + +#ifdef DEBUG + fprintf(TESTLOG,"%s:\n",dname); +#endif + + /* end */ + return ((n_failed > 0) ? UNUR_FAILURE : UNUR_SUCCESS); + +} /* end of modetest_cont() */ + +/*---------------------------------------------------------------------------*/ + +int modetest_discr( UNUR_DISTR *distr) + /*----------------------------------------------------------------------*/ + /* Tests whether the mode of discr distribution is correct. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... if test was successful */ + /* UNUR_FAILURE ... failed (difference too large) */ + /* UNUR_ERR_NULL ... could not run test */ + /*----------------------------------------------------------------------*/ +{ + int m, x; /* mode and other argument for PDF */ + double fm, fx; /* value of PDF at m and x */ + const char *dname; /* name of distribution */ + int n_failed = 0; /* number of failed tests */ + int i; /* loop variable */ + + /* name of distribution */ + dname = unur_distr_get_name(distr); + + /* get mode */ + if (unur_distr_discr_upd_mode(distr)!=UNUR_SUCCESS ) { + /* cannot read mode */ + printf("%s: ERROR: cannot get mode\n", dname); + fprintf(TESTLOG,"%s: ERROR: cannot get mode\n", dname); + return UNUR_ERR_NULL; + } + m = unur_distr_discr_get_mode(distr); + + /* evaluate PMF at mode */ + fm = unur_distr_discr_eval_pmf(m, distr); + +#ifdef DEBUG + fprintf(TESTLOG,"%s: mode: m = %d, f(m) = %.20g\n", dname,m,fm); +#endif + + /* test PMF left and right of mode */ + for (i=-1; i<2; i+=2 ) { + + /* left and right of mode */ + x = m + i; + + /* evaluate PMF */ + fx = unur_distr_discr_eval_pmf(x, distr); + +#ifdef DEBUG + fprintf(TESTLOG,"%s: x = %d, f(x) = %.20g", dname,x,fx); +#endif + + if(fm * (1.+EPSY) < fx) { +#ifdef DEBUG + fprintf(TESTLOG," ... failed! f(mode) not maximal!"); +#endif + ++n_failed; + } + +#ifdef DEBUG + fprintf(TESTLOG,"\n"); +#endif + } + +#ifdef DEBUG + fprintf(TESTLOG,"%s:\n",dname); +#endif + + /* end */ + return ((n_failed > 0) ? UNUR_FAILURE : UNUR_SUCCESS); + +} /* end of modetest_cont() */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/tests/test_StdDistr.m b/vendor/unuran-1.11.0/tests/test_StdDistr.m new file mode 100644 index 0000000..c8e55c0 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/test_StdDistr.m @@ -0,0 +1,403 @@ +(***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: test_StdDistr.m * + * * + * Create file with results of CDF, PDF and derivatives of PDF * + * for various distributions and make C test file. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************) + +(* === Set Constants ========================================================*) + +If [ Environment["srcdir"] != $Failed, + SrcDir = Environment["srcdir"], +(* Else *) + SrcDir = "./" ]; + +(* name of C file for running tests *) +SrcFileName = "t_StdDistr.c"; + +(* name of data file for running tests *) +DataFileName = "t_StdDistr.data"; + +(* sample size for tests *) +RunSampleSize = 10000; + +(* constants *) +isCONT = 1; +isDISCR = 2; + +(* === Declare additional distributions ==================================== *) + +(* --- Defaults (to avoid error with C program) ---------------------------- *) + +(* --- Extreme Value II Distribution --------------------------------------- *) + +ExtremeValueIIDistribution/: Domain[ExtremeValueIIDistribution[k_,zeta_,theta_]] := + Interval[{zeta, Infinity}]; + +ExtremeValueIIDistribution/: PDF[ExtremeValueIIDistribution[k_,zeta_,theta_], x_] := + If [ x > zeta, + Exp[ -((x-zeta)/theta)^(-k)] * ((x-zeta)/theta)^(-k-1) * k/theta, + (* else *) + 0 + ]; + +ExtremeValueIIDistribution/: CDF[ExtremeValueIIDistribution[k_,zeta_,theta_], x_] := + If [ x > zeta, + Exp[ -((x-zeta)/theta)^(-k)], + (* else *) + 0 + ]; + +ExtremeValueIIDistribution/: Random[ExtremeValueIIDistribution[k_,zeta_,theta_]] := + zeta + theta * Exp[ -Log[ -Log[Random[]] ]/k ]; + +(* --- Lomax Distribution -------------------------------------------------- *) + +LomaxDistribution/: Domain[LomaxDistribution[___]] := + Interval[{0,1}]; + +LomaxDistribution/: PDF[LomaxDistribution[a_,C_], x_] := + (x+C)^(-(a+1)) * a * C^a; + +LomaxDistribution/: CDF[LomaxDistribution[a_,C_], x_] := + 1 - C^a/(C + x)^a; + +LomaxDistribution/: Random[LomaxDistribution[a_,C_]] := + -C + (-(C^a/(-1 + Random[])))^(1/a); + +(* --- Powerexponential Distribution --------------------------------------- *) + +PowerexponentialDistribution/: Domain[PowerexponentialDistribution[___]] := + Interval[{-Infinity, Infinity}]; + +PowerexponentialDistribution/: PDF[PowerexponentialDistribution[r_], x_] := + If [ x>0, + Exp[-x^r]/(2 Gamma[1+1/r]), + (* Else *) + Exp[-(-x)^r]/(2 Gamma[1+1/r]) ]; + +PowerexponentialDistribution/: CDF[PowerexponentialDistribution[r_], x_] := + If [ x<0, + Gamma[1/r, (-x)^r] / (2*r*Gamma[1 + 1/r]), + (* Else *) + 1/2 + (Gamma[1 + 1/r] - Gamma[1/r, x^r]/r) / (2 Gamma[1+1/r]) ]; + +PowerexponentialDistribution/: Random[PowerexponentialDistribution[r_]] := + (* Warning!! This not a generator for the Powerexponential Distribution!! *) + (* FindRoot[ PDF[PowerexponentialDistribution[r],x] == Random[],{x,0.3}][[1,2]] *) + (* is correct but very slow. So we use a Laplace random variate instead !! *) + If[ Random[] < 0.5, 1, -1] * If[ Random[] < Max[0.3,(1-1/r)], Random[], 1-Log[Random[]]/r ]; + +(* --- Triangular Distribution --------------------------------------------- *) + +(* We use our own version of the triangular distribution. *) +Unprotect[TriangularDistribution]; +Clear[TriangularDistribution]; + +TriangularDistribution/: Domain[TriangularDistribution[___]] := + Interval[{0,1}]; + +TriangularDistribution/: PDF[TriangularDistribution[H_], x_] := + Which [ x > 0 && x <= H, + 2*x / H, + x > H && x < 1, + 2*(1-x) / (1-H), + True, + 0 + ]; + +TriangularDistribution/: CDF[TriangularDistribution[H_], x_] := + Which [ x <= 0, + 0, + x > 0 && x <= H, + x*x / H, + x > H && x < 1, + (H + x * (x-2))/(H-1), + True, + 1 + ]; + +TriangularDistribution/: Random[TriangularDistribution[H_]] := + (* Warning!! This not a generator for the Triangular Distribution!! *) + (* We simply use uniform distribution!! *) + Random[]; + +(* === End of Distributions ================================================ *) + +(* === Format and write output ============================================= *) + +(* --- Write result for parameter/argument combination into file ----------- *) + +UnurTestDistrResultLine[stream_, distr_, dtype_, fparams__, x_] := Module [ + (* stream ... output stream *) + (* distr ... distribution *) + (* dtype ... type of distribution (CONT|DISCR|...) *) + (* fparams ... parameters for distribution *) + (* x ... argument where 'distr' should be evaluated *) + + (* local variables *) + {i,Fx}, + + (* number of parameters *) + WriteString[stream, Length[fparams]," "]; + + (* list of parameters *) + Table[ + WriteString[stream, CForm[ N[ fparams[[i]] ]]," "], + {i,1,Length[fparams]} ]; + + (* argument *) + WriteString[stream, CForm[x]," "]; + + (* CDF *) + WriteString[stream, CForm[ N[ CDF[ Apply[distr,fparams], x ]]]," "]; + + (* PDF *) + WriteString[stream, CForm[ N[ PDF[ Apply[distr,fparams], x ]]]," "]; + + (* derivative of PDF *) + Switch [ dtype, + isCONT, + Fx = N[ 0. + D[ PDF[ Apply[distr,fparams], t ], t] /. t->x], + isDISCR, (* discrete distribution: no derivative *) + Fx = 0, + _, (* default: should not happen *) + Fx = 0 + ]; + WriteString[stream, CForm[ Fx ]]; + + (* end *) + WriteString[stream, "\n"]; + +]; (* end of UnurTestDistrResultLine[] *) + +(* --- make file with results for given distribution ----------------------- *) + +UnurTestDistrResultFile[dname_, dtype_, datafile_, fparbd__, size_, distribution___] := Module [ + (* dname ... UNU.RAN name of distribution *) + (* dtype ... type of distribution (CONT|DISCR|...) *) + (* srcfile ... output stream for C file running tests *) + (* datafile... output stream for data for running tests *) + (* fparbd ... bounds for parameters for distribution *) + (* (use isDISCR as 3rd entry in list for *) + (* discrete parameters) *) + (* size ... size of sample *) + (* distribution ... (optional) *) + + (* local variables *) + {distr, distrAPI, distrstring, i, j, nfparams, fparams, x}, + + (* name of distribution for Mathematica *) + If [ Length[{distribution}] > 0, + (* distribution given as third argument *) + distr = distribution, + (* else *) + (* get distribution from dname *) + distrstring = ToUpperCase[ StringTake[dname,1] ] + <> StringDrop[dname,1] + <> "Distribution"; + distr = ToExpression[distrstring]; + ]; + + (* number of parameters for distribution *) + nfparams = Length[fparbd]; + + (* compose string for UNU.RAN string API *) + distrAPI = dname <> "("; + For [ i=0, i ToString[ N[fparbd[[i+1,2]]] ]; + If [ i ", " ]; + ]; + distrAPI = distrAPI <> ")"; + Print[ distrAPI ]; + + (* print distribution into data file *) + WriteString[datafile,"distr=" <> distrAPI <> "\n"]; + + (* print results into data file *) + Do[ + (* make parameters for distribution at random *) + fparams = + Table[ + If [ Length[fparbd[[j]]]>2 && fparbd[[j,3]] == isDISCR, + Round[ fparbd[[j,1]] + Random[] * (fparbd[[j,2]]-fparbd[[j,1]]) ], + (* else: isCONT *) + N[ fparbd[[j,1]] + Random[] * (fparbd[[j,2]]-fparbd[[j,1]]) ] + ], + {j,nfparams} ]; + + (* make an argument at random (use importance sampling) *) + x = Random[ Apply[distr,fparams] ]; + If [ dtype == isCONT, x = N[x] ]; + + (* print line with this parameters *) + UnurTestDistrResultLine[datafile,distr,dtype,fparams,x], + + {i,size} ]; + + (* empty line as separator between distributions *) + WriteString[datafile,"\n"]; + +]; (* end of UnurTestDistrResultFile[] *) + + +(* === Start of Main ======================================================= *) + +(* Open data file *) +datafile = OpenWrite[ DataFileName ]; + +(* --- List of Continuous Distributions ------------------------------------ *) + +(* Beta *) +fparams = {{1,10}, {1,100}}; +UnurTestDistrResultFile["beta", isCONT, datafile, fparams, RunSampleSize]; + +(* Cauchy *) +fparams = {{-100,100},{1/100,100}}; +UnurTestDistrResultFile["cauchy", isCONT, datafile, fparams, RunSampleSize]; + +(* Chi *) +fparams = {{1,100}}; +UnurTestDistrResultFile["chi", isCONT, datafile, fparams, RunSampleSize]; + +(* Chisquare *) +fparams = {{1,100}}; +UnurTestDistrResultFile["chisquare", isCONT, datafile, fparams, RunSampleSize, ChiSquareDistribution]; + +(* Exponential -- parameters differ *) +fparams = {{1/100,100}}; +ed[mu_] = ExponentialDistribution[1/mu]; +UnurTestDistrResultFile["exponential", isCONT, datafile, fparams, RunSampleSize, ed]; + +(* ExtremeValue I *) +fparams = {{-100,100},{1/100,100}}; +UnurTestDistrResultFile["extremeI",isCONT, datafile, fparams, RunSampleSize, ExtremeValueDistribution]; + +(* ExtremeValue II *) +fparams = {{1/100,100}, {-100,100}, {1/100,100}}; +UnurTestDistrResultFile["extremeII",isCONT, datafile, fparams, RunSampleSize, ExtremeValueIIDistribution]; + +(* F *) +fparams = {{1/100,10}, {1/100,10}}; +UnurTestDistrResultFile["F", isCONT, datafile, fparams, RunSampleSize, FRatioDistribution]; + +(* Gamma *) +fparams = {{1/2,10}, {1/100,100}}; +UnurTestDistrResultFile["gamma", isCONT, datafile, fparams, RunSampleSize]; + +(* InverseGaussianDistribution *) +(* Remark: the CDF values differ for mu < 0 *) +fparams = {{1,100}, {1/100,10}}; +UnurTestDistrResultFile["ig", isCONT, datafile, fparams, RunSampleSize, InverseGaussianDistribution]; + +(* Laplace *) +(* Remark: dPDF is computed incorrectly! *) +fparams = {{-100,100}, {1/100,100}}; +UnurTestDistrResultFile["laplace", isCONT, datafile, fparams, RunSampleSize]; + +(* Lomax *) +fparams = {{1/100,100}, {1/100,100}}; +UnurTestDistrResultFile["lomax", isCONT, datafile, fparams, RunSampleSize]; + +(* Logistic *) +fparams = {{-100,100},{1/100,100}}; +UnurTestDistrResultFile["logistic", isCONT, datafile, fparams, RunSampleSize]; + +(* Normal *) +fparams = {{-100,100}, {1/100,100}}; +UnurTestDistrResultFile["normal", isCONT, datafile, fparams, RunSampleSize]; + +(* Pareto *) +fparams = {{1/100,100},{1/100,100}}; +UnurTestDistrResultFile["pareto", isCONT, datafile, fparams, RunSampleSize]; + +(* Powerexponential *) +fparams = {{1/1000,3}}; +UnurTestDistrResultFile["powerexponential", isCONT, datafile, fparams, RunSampleSize]; + +(* Rayleigh *) +fparams = {{1/100,100}}; +UnurTestDistrResultFile["rayleigh", isCONT, datafile, fparams, RunSampleSize]; + +(* Student *) +fparams = {{1/100,100}}; +UnurTestDistrResultFile["student", isCONT, datafile, fparams, RunSampleSize, StudentTDistribution]; + +(* Triangular *) +fparams = {{0,1}}; +UnurTestDistrResultFile["triangular", isCONT, datafile, fparams, RunSampleSize]; + +(* +(* Uniform *) +(* Disabled! since Mathematica 3.0 computes wrong values for the derivative *) +fparams = {{-100,1}, {1001/1000,100}}; +UnurTestDistrResultFile["uniform", isCONT, datafile, fparams, RunSampleSize]; +*) + +(* Weibull *) +fparams = {{1/2,10},{1/100,100}}; +UnurTestDistrResultFile["weibull", isCONT, datafile, fparams, RunSampleSize]; + +(* --- List of Discrete Distributions -------------------------------------- *) + +(* Binomial *) +fparams = {{2,1000,isDISCR}, {1/1000,999/1000}}; +UnurTestDistrResultFile["binomial", is_DISCR, datafile, fparams, RunSampleSize]; + +(* Geometric *) +fparams = {{1/1000,999/1000}}; +UnurTestDistrResultFile["geometric", is_DISCR, datafile, fparams, RunSampleSize]; + +(* Hypergeometric; order of parameters is different *) +hgd[N_,M_,n_] = HypergeometricDistribution[n,M,N]; +fparams = {{100,1000,isDISCR}, {1,99,isDISCR}, {1,99,isDISCR}}; +UnurTestDistrResultFile["hypergeometric", is_DISCR, datafile, fparams, RunSampleSize, hgd]; + +(* Logarithmic *) +fparams = {{1/1000,999/1000}}; +UnurTestDistrResultFile["logarithmic", is_DISCR, datafile, fparams, RunSampleSize, LogSeriesDistribution]; + +(* NegativeBinomial; order of parameters is different *) +nb[p_,n_] = NegativeBinomialDistribution[n,p]; +fparams = {{1/1000,999/1000}, {1,100,isDISCR}}; +UnurTestDistrResultFile["negativebinomial", is_DISCR, datafile, fparams, RunSampleSize, nb]; + +(* Poisson *) +fparams = {{1/100,100}}; +UnurTestDistrResultFile["poisson", is_DISCR, datafile, fparams, RunSampleSize]; + + +(* --- Done ---------------------------------------------------------------- *) + +(* close data file *) +Close[datafile]; + +(* === Exit ================================================================ *) + +Quit[] diff --git a/vendor/unuran-1.11.0/tests/test_functionparser.c b/vendor/unuran-1.11.0/tests/test_functionparser.c new file mode 100644 index 0000000..74754e2 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/test_functionparser.c @@ -0,0 +1,243 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: test_functionparser * + * * + * Compare evaluation result of function parser with those of * + * Mathematica(TM) * + * * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +/* #define DEBUG 1 */ +/*---------------------------------------------------------------------------*/ +#include +#include +#include +#include +#include + +#include +#include + +/* macros and functions for handling floats */ +#include +#include + +/*---------------------------------------------------------------------------*/ + +/* name of data file */ +static const char datafile[] = "t_functionparser.data"; + +/* number of failed tests */ +static int n_failed = 0; + +/* file handles */ +FILE *DATA; /* file with data */ +FILE *UNURANLOG; /* unuran log file */ +FILE *TESTLOG; /* test log file */ + +/*---------------------------------------------------------------------------*/ + +static int _unur_test_function (void); + +/*---------------------------------------------------------------------------*/ + +int main(void) +{ + /* open log file for unuran and set output stream for unuran messages */ + if ( (UNURANLOG = fopen( "t_functionparser_unuran.log","w" )) == NULL ) + exit (EXIT_FAILURE); + unur_set_stream( UNURANLOG ); + + /* open log file for testing */ + if ( (TESTLOG = fopen( "t_functionparser_test.log","w" )) == NULL ) + exit (EXIT_FAILURE); + + /* write header into log file */ + { + time_t started; + fprintf(TESTLOG,"\nUNU.RAN - Universal Non-Uniform RANdom number generator\n\n"); + if (time( &started ) != -1) + fprintf(TESTLOG,"%s",ctime(&started)); + fprintf(TESTLOG,"\n=======================================================\n\n"); + /* fprintf(TESTLOG,"(Search for string \"data\" to find new section.)\n\n"); */ + } + + /* open data file */ + if ( (DATA = fopen( datafile,"r" )) == NULL ) { + printf("ERROR: could not open file %s \n", datafile); + fprintf(TESTLOG,"ERROR: could not open file %s \n", datafile); + exit (77); /* ignore this error */ + } + + while (_unur_test_function()==TRUE); + + /* close files */ + fclose (UNURANLOG); + fclose (TESTLOG); + fclose (DATA); + + /* end */ + if (n_failed > 0) { + printf("[function parser --> failed]\n"); + exit (EXIT_FAILURE); + } + else { + printf("[function parser --> ok]\n"); + exit (EXIT_SUCCESS); + } +} /* end of main() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_test_function (void) +{ +#define BUFSIZE 1024 /* size of line buffer */ + + char buffer[BUFSIZE]; /* buffer for reading line */ + char *ptr_buffer; /* pointer into buffer */ + + char fstr[BUFSIZE]; /* function string */ + + double x; /* argument x */ + double fx_exp, dfx_exp; /* expected values for f(x) and f'(x) */ + double fx_obs, dfx_obs; /* observed values for f(x) and f'(x) */ + double fx_rep, dfx_rep; /* observed values for f(x) and f'(x) + for reparsed string */ + double diff; + char *repstr = NULL; /* string generated from parsed tree */ + + UNUR_DISTR *distr, *rep; + + int failed = 0; + + /* find next function string */ + while (1) { + /* read next line */ + fgets(buffer, BUFSIZE, DATA); + if (feof(DATA)) return FALSE; + if (strncmp(buffer,"function=",8)==0) break; + } + + /* get function string */ + strcpy( fstr, buffer+9 ); + /* remove newline character */ + fstr[strlen(fstr)-1] = '\0'; + + /* print info into log file */ + fprintf(TESTLOG,"function = \"%s\"\n", fstr); + + /* make distribution object with given function as PDF */ + distr = unur_distr_cont_new(); + if (unur_distr_cont_set_pdfstr(distr,fstr)!=UNUR_SUCCESS) { + printf("ERROR: syntax error in \"%s\"\n", fstr); + fprintf(TESTLOG,"ERROR: syntax error in \"%s\"\n", fstr); + exit (EXIT_FAILURE); + } + + /* reparse function string and make duplicate distribution object */ + repstr = unur_distr_cont_get_pdfstr(distr); + fprintf(TESTLOG,"parsed = \"%s\"\n", repstr); + rep = unur_distr_cont_new(); + if (unur_distr_cont_set_pdfstr(rep,repstr)!=UNUR_SUCCESS) { + printf("ERROR: syntax error in \"%s\"\n", repstr); + fprintf(TESTLOG,"ERROR: syntax error in reparsed string \"%s\"\n", repstr); + exit (EXIT_FAILURE); + } + + /* read all the data */ + while (1) { + /* read next line */ + fgets(buffer, BUFSIZE, DATA); + if (feof(DATA)) break; + + /* stop if blank line */ + if (isspace(buffer[0])) + break; + + /* read x and expected values for f(x) and f'(x) */ + ptr_buffer = buffer; + x = strtod( ptr_buffer, &ptr_buffer ); + fx_exp = strtod( ptr_buffer, &ptr_buffer ); + dfx_exp = strtod( ptr_buffer, &ptr_buffer ); + + /* compute function values for function tree */ + fx_obs = unur_distr_cont_eval_pdf(x,distr); + dfx_obs = unur_distr_cont_eval_dpdf(x,distr); + + /* compute function values for reparsed function tree */ + fx_rep = unur_distr_cont_eval_pdf(x,rep); + dfx_rep = unur_distr_cont_eval_dpdf(x,rep); + + /* compare */ + if (!(_unur_FP_approx(fx_exp,fx_obs))) { + ++failed; + diff = fx_obs - fx_exp; + fprintf(TESTLOG,"[fx]\tx = %g:\t(exp) = %g\t(obs) = %g\tdiff = %g --> error\n", + x,fx_exp,fx_obs,diff); + } + if (!(_unur_FP_approx(fx_obs,fx_rep))) { + ++failed; + diff = fx_rep - fx_obs; + fprintf(TESTLOG,"[fx]\tx = %g:\t(obs) = %g\t(rep) = %g\tdiff = %g --> error\n", + x,fx_obs,fx_rep,diff); + } + if (!(_unur_FP_approx(dfx_exp,dfx_obs))) { + ++failed; + diff = dfx_obs - dfx_exp; + fprintf(TESTLOG,"[dfx]\tx = %g:\t(exp) = %g\t(obs) = %g\tdiff = %g --> error\n", + x,dfx_exp,dfx_obs,diff); + } + if (!(_unur_FP_approx(dfx_obs,dfx_rep))) { + ++failed; + diff = dfx_rep - dfx_obs; + fprintf(TESTLOG,"[dfx]\tx = %g:\t(obs) = %g\t(rep) = %g\tdiff = %g --> error\n", + x,dfx_obs,dfx_rep,diff); + } + } + + /* free memory */ + unur_distr_free(distr); + unur_distr_free(rep); + if (repstr) free(repstr); + + /* write result */ + if (failed) { + fprintf(TESTLOG,"\t--> FAILED\n\n"); + ++n_failed; + } + else { + fprintf(TESTLOG,"\t--> OK\n\n"); + } + + return TRUE; +#undef BUFSIZE +} /* end of _unur_test_function() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/tests/test_functionparser.m b/vendor/unuran-1.11.0/tests/test_functionparser.m new file mode 100644 index 0000000..9d622b4 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/test_functionparser.m @@ -0,0 +1,301 @@ +(***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: test_functionparser.m * + * * + * Create file with results of evaluations of algebraic expersions * + * and make C test file. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************) + +(* === List of tests ========================================================*) + +(* Input the function of testing in the following format : + {"function_string",{minimal_function_value,maximal_function_value,\ +number_of_function_value} *) +Testsample = { + + (* --- arithmetic operator --- *) + + {"3.45+x", {-2, 2, 5}}, + {"x-4.673", {-200, 200000, 5}}, + {"3*x", {-2, 2, 5}}, + {"x/5.8", {-2, 2, 5}}, + {"x^12-3.345+5", {-2, 2, 5}}, + {"3*x", {-2, 2, 5}}, + {"2.894736*10^2", {-2, 2, 5}}, + {"2.784e-2", {-2,2,5}}, + {"2.784*e",{-2,2,5}}, + {"-4.7285e-7*x",{-2,2,5}}, + + (* --- brackets --- *) + + {"3*(x^5-x^4/(1.5-x))", {-2, 2, 5}}, + + (* --- relational operators --- *) + + (* + (* Does not work for Mathematica 5.1 any more! *) + {"3*(x>1)" ,{-2,2,5}}, + {"3*(x<1)" ,{-2,2,5}}, + {"3*(x>=1)",{-2,2,5}}, + {"3*(x<=1)",{-2,2,5}}, + {"3*(x==1)",{-2,2,5}}, + {"3*(2==x)",{-2,2,5}}, + {"3*(x<>1)",{-2,2,5}}, + {"3*(2<>x)",{-2,2,5}}, + {"3*(2!=x)",{-2,2,5}}, + {"3*(2=x)",{-2,2,5}}, + *) + + (* --- system functions --- *) + + {"exp[-4*X]", {-2, 2, 5}}, + {"log[x]", {1,6,6}}, + {"sqrt[x]", {1,6,6}}, + {"sin[x]", {1,6,6}}, + {"mod[x,3]", {1,6,6}}, + {"sgn[x]", {-2,2,5}}, + {"sec[x]", {-2,2,5}}, + {"exp[-x^2]+log[2]-Pi*sin[x+x*2]", {-5*10^1, 2.3454*10^2,7}}, + {"Sin[x]*3*log[x]", {2, 4, 2}}, + {"abs[x]-3*x", {-2, 2, 5}} + + (* + (* does not work with Mathematica 3.0 *) + {"(sin[ ln[3*x*(cos[ 3*x^3-4.6789/(x+4)])]])-1", {-38.828,454.4*10^3,7}}, + *) + + (* + (* Does not work for Mathematica 5.1 any more! *) + {"exp[x^2]*(sin[x*cos[x^2-1]]+1)*((x-3*pi*x)<1)", {-3,7,5}} + *) +}; + + + +(* === Set Constants ========================================================*) + +(* name of datafile file for running tests *) +DataFile = "t_functionparser.data"; + + +(* === Define cosntants and functions for function parser ===================*) + +(* --- Constants ----------------------------------------------------------- *) + +pi = Pi; +e = E; + +(* --- Functions ----------------------------------------------------------- *) + +mod[x_,y_] := Mod[x,y]; +exp[x_] := Exp[x]; +log[x_] := Log[x]; +sin[x_] := Sin[x]; +cos[x_] := Cos[x]; +tan[x_] := Tan[x]; +sec[x_] := 1/Cos[x]; +sqrt[x_] := Sqrt[x]; +abs[x_] := Abs[x]; +sgn[x_] := Sign[x]; + +(* === Define derivatives for these functions (according to function parser) *) + +Unprotect[Derivative]; + +(* --- Relation Operators -------------------------------------------------- *) + +Derivative[1][Sign][x_] := 0; + +Derivative[1, 0][Unequal][x_, y_] := 0; +Derivative[0, 1][Unequal][x_, y_] := 0; + +Derivative[1, 0][Greater][x_, y_] := 0; +Derivative[0, 1][Greater][x_, y_] := 0; + +Derivative[1, 0][GreaterEqual][x_, y_] := 0; +Derivative[0, 1][GreaterEqual][x_, y_] := 0; + +Derivative[1, 0][Less][x_, y_] := 0; +Derivative[0, 1][Less][x_, y_] := 0; + +Derivative[1, 0][LessEqual][x_, y_] := 0; +Derivative[0, 1][LessEqual][x_, y_] := 0; + +Derivative[1, 0][Mod][x_, y_] := 0; +Derivative[0, 1][Mod][x_, y_] := 0; + + +(* --- Functions ----------------------------------------------------------- *) + +Derivative[1][Abs][x_] := sgn[x]; + +(* ------------------------------------------------------------------------- *) + +Protect[Derivative]; + + +(* === Write results for an expression into data file ====================== *) + +UnurWriteData[expression_,points__] := Module [ + (* expression ... function term *) + (* points ... list {x_min, x_max, number of points} *) + + (* local variables *) + { + funct, (* string use to compute expression with Mathematica *) + x, (* argument for function *) + xmin, (* minimal value for x *) + xmax, (* maximal value for x *) + xstep (* step width *) + }, + + (* convert to lower case letters *) + funct = ToLowerCase[expression]; + + (* print function string into data file *) + WriteString[DataFile, + "function=", + UnurTransformExpression[funct], + "\n"]; + + (* get values for x *) + xmin = points[[1]]; + xmax = points[[2]]; + xstep = (xmax - xmin) / (points[[3]]-1); + xmax += xstep/2; + + (* print function and its derivative at all given points *) + Do[ UnurWriteLine[x,funct],{x,xmin,xmax,xstep}]; + + (* add blank line *) + WriteString[DataFile,"\n"]; + +]; (* end of UnurWriteData[] *) + + +(* --- Transform expression into string for function parser ---------------- *) + +UnurTransformExpression[expression_] := Module [ + (* expression ... function term *) + + (* local variables *) + {fstr}, + + (* Replace square brackets by parenthesis *) + fstr = StringReplace[ expression, {"[" -> "(", "]" -> ")"}]; + + (* return result *) + Return[fstr]; + +]; (* end of UnurTransformExpression[] *) + +(* --- Transform expression into string for Mathematica computation ----------*) + + +UnurTransformMathExpression[expression_] := Module [ + (* expression ... function term *) + + (* local variables *) + {fstr}, + + (* replace '<>' -> '!=' *) + fstr = StringReplace[expression, {"<>" -> "!="}]; + + (* replace 'and' -> '&&', 'or' -> '||' *) + fstr = StringReplace[fstr,{"and" -> "&&","or" -> "||"}]; + + (* replace '=' -> '==' *) + fstr = StringReplace[fstr,{"=" -> "=="}]; + fstr = StringReplace[fstr,{"====" -> "==","<==" -> "<=",">=="->">=", + "!==" -> "!="}]; + + (* replace e.g'2.45e-3' -> '1.45*10^2' *) + fstr = StringReplace[fstr,{"0e" -> "0*10^","1e" -> "1*10^", + "2e" -> "2*10^","3e" -> "3*10^", + "3e" -> "3*10^","4e" -> "4*10^", + "5e" -> "5*10^","6e" -> "6*10^", + "7e" -> "7*10^","8e" -> "8*10^", + "8e" -> "8*10^","9e" -> "9*10^"}]; + + (* return result *) + Return[fstr]; + +]; (* end of UnurTransformMathExpression[] *) + + + +(* --- Compute function and write line into date file ---------------- *) + +UnurWriteLine[xarg_,funct_] := Module [ + (* xarg ... argument *) + (* funct ... function term *) + + (* local variables *) + { + xval, (* numerical value of argument x *) + fx, (* value of function at x *) + dfx, (* value of derivative of function at x *) + fstr (* function term *) + }, + + (* argument *) + xval = N[xarg]; + WriteString[DataFile, CForm[xval],"\t"]; + + fstr = UnurTransformMathExpression[funct]; + + (* function *) + fx = N[ToExpression[fstr]] /. x -> xval /. {True -> 1, False -> 0}; + (* if fx is Complex the output is 'inf' *) + If[Head[fx]===Complex, + WriteString[DataFile, "inf" ,"\t"], + WriteString[DataFile, CForm[fx],"\t"] ]; + + (* derivative *) + dfx = N[ D[ ToExpression[fstr], x ]] /. x -> xval /. {True -> 1, False -> 0}; + (* if dfx is Complex the output is 'inf' *) + If[Head[dfx]===Complex, + WriteString[DataFile, "inf" ,"\n"], + WriteString[DataFile, CForm[dfx],"\n"] ]; + +]; (* end of UnurWriteLine[] *) + +(* === Main ================================================================ *) + +Do [ + fstr = Testsample[[i]][[1]]; + points = Testsample[[i]][[2]]; + UnurWriteData[fstr, points], + {i, 1, Length[Testsample]} +]; + +(* === Exit ================================================================ *) + +Quit[] + + diff --git a/vendor/unuran-1.11.0/tests/testcounter.c b/vendor/unuran-1.11.0/tests/testcounter.c new file mode 100644 index 0000000..e33a6e2 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/testcounter.c @@ -0,0 +1,166 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: testcounter.c * + * * + * Count function evaluations * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include "testunuran.h" +#include +#include +#include + +/*---------------------------------------------------------------------------*/ +/* count number of function evaluations */ + +/* -- global varibales ------------------------------------------------------*/ + +/* pointer for storing distribution object */ +struct unur_distr *distr_to_use = NULL; + +/* counter for evaluations of PDF and similar functions */ +static int counter_pdf = 0; +static int counter_logpdf = 0; +static int counter_cdf = 0; + +/* pointer to original functions */ +static double (*cont_pdf_to_use)(double x, const struct unur_distr *distr); +static double (*cont_logpdf_to_use)(double x, const struct unur_distr *distr); +static double (*cont_cdf_to_use)(double x, const struct unur_distr *distr); + +/*---------------------------------------------------------------------------*/ +/* wrapper for functions */ + +static double +cont_pdf_with_counter( double x, const struct unur_distr *distr ) { + ++counter_pdf; return cont_pdf_to_use(x,distr); } + +static double +cont_logpdf_with_counter( double x, const struct unur_distr *distr ) { + ++counter_logpdf; return cont_logpdf_to_use(x,distr); } + +static double +cont_cdf_with_counter( double x, const struct unur_distr *distr ) { + ++counter_cdf; return cont_cdf_to_use(x,distr); } + +/*---------------------------------------------------------------------------*/ +/* set and start counter for PDF calls in parameter object */ + +int +start_counter_fcalls( UNUR_PAR *par ) +{ + /* clear object if necessary */ + stop_counter_fcalls(); + + /* make a copy (clone) of the distribution object */ + distr_to_use = _unur_distr_clone(par->distr); + + /* set pointer to distribution object in parameter object to cloned one */ + par->distr = distr_to_use; + par->distr_is_privatecopy = FALSE; + + /* exchange pointer to PDF etc. with counting wrapper */ + switch (distr_to_use->type) { + case UNUR_DISTR_CONT: + /* this only works for continuous distributions */ + + /* PDF */ + if (distr_to_use->data.cont.pdf) { + if (distr_to_use->data.cont.pdf == cont_pdf_with_counter) { + /* we must avoid this situation as it causes infinite recursion */ + return UNUR_FAILURE; + } + cont_pdf_to_use = distr_to_use->data.cont.pdf; + distr_to_use->data.cont.pdf = cont_pdf_with_counter; + } + + /* logPDF */ + if (distr_to_use->data.cont.logpdf) { + if (distr_to_use->data.cont.logpdf == cont_logpdf_with_counter) { + /* we must avoid this situation as it causes infinite recursion */ + return UNUR_FAILURE; + } + cont_logpdf_to_use = distr_to_use->data.cont.logpdf; + distr_to_use->data.cont.logpdf = cont_logpdf_with_counter; + } + + /* CDF */ + if (distr_to_use->data.cont.cdf) { + if (distr_to_use->data.cont.cdf == cont_cdf_with_counter) { + return UNUR_FAILURE; + } + cont_cdf_to_use = distr_to_use->data.cont.cdf; + distr_to_use->data.cont.cdf = cont_cdf_with_counter; + } + + break; + + default: + return UNUR_FAILURE; + } + + /* reset counter */ + reset_counter_fcalls(); + + return UNUR_SUCCESS; +} + +/*---------------------------------------------------------------------------*/ +/* stop counter for PDF calls and clear memory */ + +int +stop_counter_fcalls(void) +{ + if (distr_to_use) unur_distr_free(distr_to_use); + distr_to_use = NULL; + cont_pdf_to_use = NULL; + cont_logpdf_to_use = NULL; + cont_cdf_to_use = NULL; + return UNUR_SUCCESS; +} + +/*---------------------------------------------------------------------------*/ +/* reset counter to 0 */ + +void reset_counter_fcalls(void) +{ + counter_pdf = 0; + counter_logpdf = 0; + counter_cdf = 0; +} + +/*---------------------------------------------------------------------------*/ +/* get number of PDF evaluations */ + +int get_counter_pdf(void) { return counter_pdf; } +int get_counter_logpdf(void) { return counter_logpdf; } +int get_counter_cdf(void) { return counter_cdf; } + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/tests/testdistributions/.libs/libtestdistributions.a b/vendor/unuran-1.11.0/tests/testdistributions/.libs/libtestdistributions.a new file mode 100644 index 0000000..4b528ee Binary files /dev/null and b/vendor/unuran-1.11.0/tests/testdistributions/.libs/libtestdistributions.a differ diff --git a/vendor/unuran-1.11.0/tests/testdistributions/Makefile b/vendor/unuran-1.11.0/tests/testdistributions/Makefile new file mode 100644 index 0000000..df2ed03 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/testdistributions/Makefile @@ -0,0 +1,673 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# tests/testdistributions/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/unuran +pkgincludedir = $(includedir)/unuran +pkglibdir = $(libdir)/unuran +pkglibexecdir = $(libexecdir)/unuran +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +subdir = tests/testdistributions +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libtestdistributions_la_LIBADD = +am_libtestdistributions_la_OBJECTS = c_with_multiple_of_pdf.lo \ + c_wo_logpdf.lo c_w_pdf_from_logpdf.lo c_sawtooth_discpdf.lo \ + c_sawtooth_contpdf.lo vc_w_marginals.lo vc_wo_logpdf.lo \ + vc_cauchy_RoU_ball.lo vc_special_correlations_ar1.lo \ + vc_special_correlations_constantrho.lo +libtestdistributions_la_OBJECTS = \ + $(am_libtestdistributions_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I. -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/c_sawtooth_contpdf.Plo \ + ./$(DEPDIR)/c_sawtooth_discpdf.Plo \ + ./$(DEPDIR)/c_w_pdf_from_logpdf.Plo \ + ./$(DEPDIR)/c_with_multiple_of_pdf.Plo \ + ./$(DEPDIR)/c_wo_logpdf.Plo ./$(DEPDIR)/vc_cauchy_RoU_ball.Plo \ + ./$(DEPDIR)/vc_special_correlations_ar1.Plo \ + ./$(DEPDIR)/vc_special_correlations_constantrho.Plo \ + ./$(DEPDIR)/vc_w_marginals.Plo ./$(DEPDIR)/vc_wo_logpdf.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libtestdistributions_la_SOURCES) +DIST_SOURCES = $(libtestdistributions_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_CFLAGS = -Wall -Wextra -Wshadow -Wstrict-prototypes +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AUTOCONF = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoconf +AUTOHEADER = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' autoheader +AUTOMAKE = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' automake-1.16 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -fPIC +CPP = gcc -E +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +FILECMD = file +GREP = /usr/bin/grep +HAVE_DIVIDE_BY_ZERO = +HAVE_IEEE_COMPARISONS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAINT = # +MAKEINFO = ${SHELL} '/home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = unuran +PACKAGE_BUGREPORT = unuran@statmath.wu.ac.at +PACKAGE_NAME = unuran +PACKAGE_STRING = unuran 1.11.0 +PACKAGE_TARNAME = unuran +PACKAGE_URL = +PACKAGE_VERSION = 1.11.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +UNURAN_LT_VERSION = 16:1:0 +UNURAN_SUPPORTS_GSL = +UNURAN_SUPPORTS_PRNG = +UNURAN_SUPPORTS_RNGSTREAM = +VERSION = 1.11.0 +abs_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/tests/testdistributions +abs_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/tests/testdistributions +abs_top_builddir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +abs_top_srcdir = /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +have_valgrind = false +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/wrdx/5_sem/pysatl-core/vendor/unuran-1.11.0/autoconf/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /home/wrdx/5_sem/pysatl-core/vendor/unuran-build +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../../ +top_builddir = ../.. +top_srcdir = ../.. +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libtestdistributions.la +libtestdistributions_la_SOURCES = \ + c_with_multiple_of_pdf.c \ + c_wo_logpdf.c \ + c_w_pdf_from_logpdf.c \ + c_sawtooth_discpdf.c \ + c_sawtooth_contpdf.c \ + vc_w_marginals.c \ + vc_wo_logpdf.c \ + vc_cauchy_RoU_ball.c \ + vc_special_correlations_ar1.c \ + vc_special_correlations_constantrho.c + +noinst_HEADERS = testdistributions.h + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/testdistributions/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign tests/testdistributions/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libtestdistributions.la: $(libtestdistributions_la_OBJECTS) $(libtestdistributions_la_DEPENDENCIES) $(EXTRA_libtestdistributions_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libtestdistributions_la_OBJECTS) $(libtestdistributions_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/c_sawtooth_contpdf.Plo # am--include-marker +include ./$(DEPDIR)/c_sawtooth_discpdf.Plo # am--include-marker +include ./$(DEPDIR)/c_w_pdf_from_logpdf.Plo # am--include-marker +include ./$(DEPDIR)/c_with_multiple_of_pdf.Plo # am--include-marker +include ./$(DEPDIR)/c_wo_logpdf.Plo # am--include-marker +include ./$(DEPDIR)/vc_cauchy_RoU_ball.Plo # am--include-marker +include ./$(DEPDIR)/vc_special_correlations_ar1.Plo # am--include-marker +include ./$(DEPDIR)/vc_special_correlations_constantrho.Plo # am--include-marker +include ./$(DEPDIR)/vc_w_marginals.Plo # am--include-marker +include ./$(DEPDIR)/vc_wo_logpdf.Plo # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ $< + +.c.obj: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: + $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +# $(AM_V_CC)source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/c_sawtooth_contpdf.Plo + -rm -f ./$(DEPDIR)/c_sawtooth_discpdf.Plo + -rm -f ./$(DEPDIR)/c_w_pdf_from_logpdf.Plo + -rm -f ./$(DEPDIR)/c_with_multiple_of_pdf.Plo + -rm -f ./$(DEPDIR)/c_wo_logpdf.Plo + -rm -f ./$(DEPDIR)/vc_cauchy_RoU_ball.Plo + -rm -f ./$(DEPDIR)/vc_special_correlations_ar1.Plo + -rm -f ./$(DEPDIR)/vc_special_correlations_constantrho.Plo + -rm -f ./$(DEPDIR)/vc_w_marginals.Plo + -rm -f ./$(DEPDIR)/vc_wo_logpdf.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/c_sawtooth_contpdf.Plo + -rm -f ./$(DEPDIR)/c_sawtooth_discpdf.Plo + -rm -f ./$(DEPDIR)/c_w_pdf_from_logpdf.Plo + -rm -f ./$(DEPDIR)/c_with_multiple_of_pdf.Plo + -rm -f ./$(DEPDIR)/c_wo_logpdf.Plo + -rm -f ./$(DEPDIR)/vc_cauchy_RoU_ball.Plo + -rm -f ./$(DEPDIR)/vc_special_correlations_ar1.Plo + -rm -f ./$(DEPDIR)/vc_special_correlations_constantrho.Plo + -rm -f ./$(DEPDIR)/vc_w_marginals.Plo + -rm -f ./$(DEPDIR)/vc_wo_logpdf.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/tests/testdistributions/Makefile.am b/vendor/unuran-1.11.0/tests/testdistributions/Makefile.am new file mode 100644 index 0000000..2a348da --- /dev/null +++ b/vendor/unuran-1.11.0/tests/testdistributions/Makefile.am @@ -0,0 +1,27 @@ +## Process this file with automake to produce Makefile.in + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libtestdistributions.la + +libtestdistributions_la_SOURCES = \ + c_with_multiple_of_pdf.c \ + c_wo_logpdf.c \ + c_w_pdf_from_logpdf.c \ + c_sawtooth_discpdf.c \ + c_sawtooth_contpdf.c \ + vc_w_marginals.c \ + vc_wo_logpdf.c \ + vc_cauchy_RoU_ball.c \ + vc_special_correlations_ar1.c \ + vc_special_correlations_constantrho.c + +noinst_HEADERS = testdistributions.h + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/vendor/unuran-1.11.0/tests/testdistributions/Makefile.in b/vendor/unuran-1.11.0/tests/testdistributions/Makefile.in new file mode 100644 index 0000000..edb0961 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/testdistributions/Makefile.in @@ -0,0 +1,673 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = tests/testdistributions +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libtestdistributions_la_LIBADD = +am_libtestdistributions_la_OBJECTS = c_with_multiple_of_pdf.lo \ + c_wo_logpdf.lo c_w_pdf_from_logpdf.lo c_sawtooth_discpdf.lo \ + c_sawtooth_contpdf.lo vc_w_marginals.lo vc_wo_logpdf.lo \ + vc_cauchy_RoU_ball.lo vc_special_correlations_ar1.lo \ + vc_special_correlations_constantrho.lo +libtestdistributions_la_OBJECTS = \ + $(am_libtestdistributions_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/c_sawtooth_contpdf.Plo \ + ./$(DEPDIR)/c_sawtooth_discpdf.Plo \ + ./$(DEPDIR)/c_w_pdf_from_logpdf.Plo \ + ./$(DEPDIR)/c_with_multiple_of_pdf.Plo \ + ./$(DEPDIR)/c_wo_logpdf.Plo ./$(DEPDIR)/vc_cauchy_RoU_ball.Plo \ + ./$(DEPDIR)/vc_special_correlations_ar1.Plo \ + ./$(DEPDIR)/vc_special_correlations_constantrho.Plo \ + ./$(DEPDIR)/vc_w_marginals.Plo ./$(DEPDIR)/vc_wo_logpdf.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libtestdistributions_la_SOURCES) +DIST_SOURCES = $(libtestdistributions_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ +HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ +UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ +UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ +UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_valgrind = @have_valgrind@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = \ + -I$(top_srcdir)/src + +noinst_LTLIBRARIES = libtestdistributions.la +libtestdistributions_la_SOURCES = \ + c_with_multiple_of_pdf.c \ + c_wo_logpdf.c \ + c_w_pdf_from_logpdf.c \ + c_sawtooth_discpdf.c \ + c_sawtooth_contpdf.c \ + vc_w_marginals.c \ + vc_wo_logpdf.c \ + vc_cauchy_RoU_ball.c \ + vc_special_correlations_ar1.c \ + vc_special_correlations_constantrho.c + +noinst_HEADERS = testdistributions.h + +# clean backup files +CLEANFILES = *~ + +# clean generated files +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/testdistributions/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign tests/testdistributions/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libtestdistributions.la: $(libtestdistributions_la_OBJECTS) $(libtestdistributions_la_DEPENDENCIES) $(EXTRA_libtestdistributions_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libtestdistributions_la_OBJECTS) $(libtestdistributions_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_sawtooth_contpdf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_sawtooth_discpdf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_w_pdf_from_logpdf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_with_multiple_of_pdf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_wo_logpdf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_cauchy_RoU_ball.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_special_correlations_ar1.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_special_correlations_constantrho.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_w_marginals.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_wo_logpdf.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/c_sawtooth_contpdf.Plo + -rm -f ./$(DEPDIR)/c_sawtooth_discpdf.Plo + -rm -f ./$(DEPDIR)/c_w_pdf_from_logpdf.Plo + -rm -f ./$(DEPDIR)/c_with_multiple_of_pdf.Plo + -rm -f ./$(DEPDIR)/c_wo_logpdf.Plo + -rm -f ./$(DEPDIR)/vc_cauchy_RoU_ball.Plo + -rm -f ./$(DEPDIR)/vc_special_correlations_ar1.Plo + -rm -f ./$(DEPDIR)/vc_special_correlations_constantrho.Plo + -rm -f ./$(DEPDIR)/vc_w_marginals.Plo + -rm -f ./$(DEPDIR)/vc_wo_logpdf.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/c_sawtooth_contpdf.Plo + -rm -f ./$(DEPDIR)/c_sawtooth_discpdf.Plo + -rm -f ./$(DEPDIR)/c_w_pdf_from_logpdf.Plo + -rm -f ./$(DEPDIR)/c_with_multiple_of_pdf.Plo + -rm -f ./$(DEPDIR)/c_wo_logpdf.Plo + -rm -f ./$(DEPDIR)/vc_cauchy_RoU_ball.Plo + -rm -f ./$(DEPDIR)/vc_special_correlations_ar1.Plo + -rm -f ./$(DEPDIR)/vc_special_correlations_constantrho.Plo + -rm -f ./$(DEPDIR)/vc_w_marginals.Plo + -rm -f ./$(DEPDIR)/vc_wo_logpdf.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/vendor/unuran-1.11.0/tests/testdistributions/c_sawtooth_contpdf.c b/vendor/unuran-1.11.0/tests/testdistributions/c_sawtooth_contpdf.c new file mode 100644 index 0000000..90a8d08 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/testdistributions/c_sawtooth_contpdf.c @@ -0,0 +1,222 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * Sawtooth distribution with discontinuous PDF * + * * + * pdf: / y if y < 0.5 * + * f(x) = < [ where y = |x| - floor(|x|) ] * + * \ 1-y otherwise * + * domain: closed interval * + * constant: depends on interval * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include "testdistributions.h" + +/*---------------------------------------------------------------------------*/ +static const char distr_name[] = "sawtooth_contpdf"; + +/* parameters */ +#define DISTR distr->data.cont +#define bd_left (params[0]) +#define bd_right (params[1]) + +/* function prototypes */ +static double _unur_pdf_sawtooth_contpdf( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_sawtooth_contpdf( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_sawtooth_contpdf( double x, const UNUR_DISTR *distr ); + +static int _unur_set_params_sawtooth_contpdf( UNUR_DISTR *distr, const double *params, int n_params ); +static int _unur_upd_area_sawtooth_contpdf( UNUR_DISTR *distr ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_sawtooth_contpdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) +{ + double y = fabs(x) - floor(fabs(x)); + return ((y<=0.5) ? y : 1. - y); +} /* end of _unur_pdf_sawtooth_contpdf() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_sawtooth_contpdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED ) +{ + double y = fabs(x) - floor(fabs(x)); + return ((y <= 0.5 && x > 0.) || (y >= 0.5 && x < 0.) ? 1. : -1.); +} /* end of _unur_dpdf_sawtooth_contpdf() */ + +/*---------------------------------------------------------------------------*/ + +static double integral_0_x( double x ) +{ + double absx = fabs(x); + double intx = floor(absx); + double y = absx - intx; + + double val = 0.25 * intx; + if (y <= 0.5) + val += 0.5 * y * y; + else + val += 0.125 + 0.5*(y-0.5)*(1.5-y); + + return val; +} /* end of integral_0_x() */ + +static double integral_x_y( double x, double y ) +{ + double ix = integral_0_x(x); + double iy = integral_0_x(y); + double sign = 1.; + + if (x>y) { double tmp=x; x=y; y=tmp; sign=-1.; } + + if (x<0. && y<0.) return sign*(ix - iy); + if (x<0. && y>=0.) return sign*(ix + iy); + /* otherwise */ + return sign*(iy -ix); +} /* end of integral_x_y() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_sawtooth_contpdf( double x, const UNUR_DISTR *distr ) +{ + return (integral_x_y(DISTR.domain[0],x) / integral_x_y(DISTR.domain[0],DISTR.domain[1])); +} /* end of _unur_cdf_sawtooth_contpdf() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_sawtooth_contpdf( UNUR_DISTR *distr ) +{ + double area = integral_x_y(DISTR.domain[0],DISTR.domain[1]); + if (!_unur_isfinite(area)) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"invalid domain"); + return UNUR_ERR_DISTR_DOMAIN; + } + + DISTR.area = area; + return UNUR_SUCCESS; +} /* end of _unur_upd_area_sawtooth_contpdf() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_sawtooth_contpdf( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params != 2) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,""); + return UNUR_ERR_DISTR_NPARAMS; + } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameters */ + if (! (_unur_FP_less(bd_left,bd_right) || _unur_isfinite(bd_left) || _unur_isfinite(bd_right)) ) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"invalid domain"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* set domain */ + DISTR.domain[0] = bd_left; + DISTR.domain[1] = bd_right; + + /* update area below PDF */ + if (_unur_upd_area_sawtooth_contpdf(distr) != UNUR_SUCCESS) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"invalid domain"); + return UNUR_ERR_DISTR_DOMAIN; + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_sawtooth_contpdf() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_sawtooth_contpdf( const double *params, int n_params ) + /* boundary of domain as parameters */ +{ + register struct unur_distr *distr; + + if (! (_unur_FP_less(bd_left,bd_right) || _unur_isfinite(bd_left) || _unur_isfinite(bd_right)) ) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"invalid domain"); + return NULL; + } + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_GENERIC; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = NULL; */ + + /* functions */ + DISTR.pdf = _unur_pdf_sawtooth_contpdf; /* pointer to PDF */ + DISTR.dpdf = _unur_dpdf_sawtooth_contpdf; /* pointer to derivative of PDF */ + DISTR.cdf = _unur_cdf_sawtooth_contpdf; /* pointer to CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_PDFAREA ); + + /* set parameters for distribution */ + if (_unur_set_params_sawtooth_contpdf(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); return NULL; + } + + /* log of normalization constant */ + /* NORMCONSTANT = 1.; */ + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_sawtooth_contpdf; + + /* function for updating derived parameters */ + DISTR.upd_area = _unur_upd_area_sawtooth_contpdf; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_sawtooth_contpdf() */ + +/*---------------------------------------------------------------------------*/ +#undef DISTR +#undef bd_left +#undef bd_right +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/tests/testdistributions/c_sawtooth_discpdf.c b/vendor/unuran-1.11.0/tests/testdistributions/c_sawtooth_discpdf.c new file mode 100644 index 0000000..a0753d5 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/testdistributions/c_sawtooth_discpdf.c @@ -0,0 +1,221 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * Sawtooth distribution with discontinuous PDF * + * * + * pdf: / 1 if x is integer != 0 * + * f(x) = < * + * \ |x| - floor(|x|) otherwise * + * domain: closed interval * + * constant: depends on interval * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "testdistributions.h" + +/*---------------------------------------------------------------------------*/ +static const char distr_name[] = "sawtooth_discpdf"; + +/* parameters */ +#define DISTR distr->data.cont +#define bd_left (params[0]) +#define bd_right (params[1]) + +/* function prototypes */ +static double _unur_pdf_sawtooth_discpdf( double x, const UNUR_DISTR *distr ); +static double _unur_dpdf_sawtooth_discpdf( double x, const UNUR_DISTR *distr ); +static double _unur_cdf_sawtooth_discpdf( double x, const UNUR_DISTR *distr ); + +static int _unur_set_params_sawtooth_discpdf( UNUR_DISTR *distr, const double *params, int n_params ); +static int _unur_upd_area_sawtooth_discpdf( UNUR_DISTR *distr ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_sawtooth_discpdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED ) +{ + double pdf; + + if (_unur_iszero(x)) + return 0.; + + /* else */ + x = fabs(x); + pdf = x - floor(x); + return _unur_iszero(pdf) ? 1. : pdf; +} /* end of _unur_pdf_sawtooth_discpdf() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_sawtooth_discpdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED ) +{ + return (x<0.) ? -1. : 1.; +} /* end of _unur_dpdf_sawtooth_discpdf() */ + +/*---------------------------------------------------------------------------*/ + +static double integral_0_x( double x ) +{ + double absx = fabs(x); + double intx = floor(absx); + return 0.5*(intx + (absx-intx)*(absx-intx)); +} /* end of integral_0_x() */ + +static double integral_x_y( double x, double y ) +{ + double ix = integral_0_x(x); + double iy = integral_0_x(y); + double sign = 1.; + + if (x>y) { double tmp=x; x=y; y=tmp; sign=-1.; } + + if (x<0. && y<0.) return sign*(ix - iy); + if (x<0. && y>=0.) return sign*(ix + iy); + /* otherwise */ + return sign*(iy -ix); +} /* end of integral_x_y() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_sawtooth_discpdf( double x, const UNUR_DISTR *distr ) +{ + return (integral_x_y(DISTR.domain[0],x) / integral_x_y(DISTR.domain[0],DISTR.domain[1])); +} /* end of _unur_cdf_sawtooth_discpdf() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_upd_area_sawtooth_discpdf( UNUR_DISTR *distr ) +{ + double area = integral_x_y(DISTR.domain[0],DISTR.domain[1]); + if (!_unur_isfinite(area)) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"invalid domain"); + return UNUR_ERR_DISTR_DOMAIN; + } + + DISTR.area = area; + return UNUR_SUCCESS; +} /* end of _unur_upd_area_sawtooth_discpdf() */ + +/*---------------------------------------------------------------------------*/ + +int +_unur_set_params_sawtooth_discpdf( UNUR_DISTR *distr, const double *params, int n_params ) +{ + /* check number of parameters for distribution */ + if (n_params != 2) { + _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,""); + return UNUR_ERR_DISTR_NPARAMS; + } + CHECK_NULL(params,UNUR_ERR_NULL); + + /* check parameters */ + if (! (_unur_FP_less(bd_left,bd_right) || _unur_isfinite(bd_left) || _unur_isfinite(bd_right)) ) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"invalid domain"); + return UNUR_ERR_DISTR_DOMAIN; + } + + /* set domain */ + DISTR.domain[0] = bd_left; + DISTR.domain[1] = bd_right; + + /* update area below PDF */ + if (_unur_upd_area_sawtooth_discpdf(distr) != UNUR_SUCCESS) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"invalid domain"); + return UNUR_ERR_DISTR_DOMAIN; + } + + return UNUR_SUCCESS; +} /* end of _unur_set_params_sawtooth_discpdf() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_sawtooth_discpdf( const double *params, int n_params ) + /* boundary of domain as parameters */ +{ + register struct unur_distr *distr; + + if (! (_unur_FP_less(bd_left,bd_right) || _unur_isfinite(bd_left) || _unur_isfinite(bd_right)) ) { + _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"invalid domain"); + return NULL; + } + + /* get new (empty) distribution object */ + distr = unur_distr_cont_new(); + + /* set distribution id */ + distr->id = UNUR_DISTR_GENERIC; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + /* DISTR.init = NULL; */ + + /* functions */ + DISTR.pdf = _unur_pdf_sawtooth_discpdf; /* pointer to PDF */ + DISTR.dpdf = _unur_dpdf_sawtooth_discpdf; /* pointer to derivative of PDF */ + DISTR.cdf = _unur_cdf_sawtooth_discpdf; /* pointer to CDF */ + + /* indicate which parameters are set */ + distr->set = ( UNUR_DISTR_SET_DOMAIN | + UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_PDFAREA ); + + /* set parameters for distribution */ + if (_unur_set_params_sawtooth_discpdf(distr,params,n_params)!=UNUR_SUCCESS) { + free(distr); return NULL; + } + + /* log of normalization constant */ + /* NORMCONSTANT = 1.; */ + + /* function for setting parameters and updating domain */ + DISTR.set_params = _unur_set_params_sawtooth_discpdf; + + /* function for updating derived parameters */ + DISTR.upd_area = _unur_upd_area_sawtooth_discpdf; /* funct for computing area */ + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_sawtooth_discpdf() */ + +/*---------------------------------------------------------------------------*/ +#undef DISTR +#undef bd_left +#undef bd_right +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/tests/testdistributions/c_w_pdf_from_logpdf.c b/vendor/unuran-1.11.0/tests/testdistributions/c_w_pdf_from_logpdf.c new file mode 100644 index 0000000..ba1ca51 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/testdistributions/c_w_pdf_from_logpdf.c @@ -0,0 +1,177 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * Distribution objects of standard distributions with logPDF where the * + * PDF and its derivatives are computed from the logPDF and its derivatives * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "testdistributions.h" + +/*---------------------------------------------------------------------------*/ +/* Cont. univariate distributions with logPDF with PDF computed from logPDF */ +/*---------------------------------------------------------------------------*/ +#define DISTR distr->data.cont +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_beta_w_pdf_from_logpdf( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get distribution object for beta distribution */ + distr = unur_distr_beta( params, n_params ); + + /* name of distribution */ + distr->name = "beta_w_pdf_from_logpdf"; + + /* replace PDF by wrapper function */ + DISTR.pdf = _unur_distr_cont_eval_pdf_from_logpdf; + DISTR.dpdf = _unur_distr_cont_eval_dpdf_from_dlogpdf; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_beta_w_pdf_from_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_cauchy_w_pdf_from_logpdf( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get distribution object for cauchy distribution */ + distr = unur_distr_cauchy( params, n_params ); + + /* name of distribution */ + distr->name = "cauchy_w_pdf_from_logpdf"; + + /* replace PDF by wrapper function */ + DISTR.pdf = _unur_distr_cont_eval_pdf_from_logpdf; + DISTR.dpdf = _unur_distr_cont_eval_dpdf_from_dlogpdf; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_cauchy_w_pdf_from_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_exponential_w_pdf_from_logpdf( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get distribution object for exponential distribution */ + distr = unur_distr_exponential( params, n_params ); + + /* name of distribution */ + distr->name = "exponential_w_pdf_from_logpdf"; + + /* replace PDF by wrapper function */ + DISTR.pdf = _unur_distr_cont_eval_pdf_from_logpdf; + DISTR.dpdf = _unur_distr_cont_eval_dpdf_from_dlogpdf; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_exponential_w_pdf_from_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_gamma_w_pdf_from_logpdf( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get distribution object for gamma distribution */ + distr = unur_distr_gamma( params, n_params ); + + /* name of distribution */ + distr->name = "gamma_w_pdf_from_logpdf"; + + /* replace PDF by wrapper function */ + DISTR.pdf = _unur_distr_cont_eval_pdf_from_logpdf; + DISTR.dpdf = _unur_distr_cont_eval_dpdf_from_dlogpdf; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_gamma_w_pdf_from_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_normal_w_pdf_from_logpdf( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get distribution object for normal distribution */ + distr = unur_distr_normal( params, n_params ); + + /* name of distribution */ + distr->name = "normal_w_pdf_from_logpdf"; + + /* replace PDF by wrapper function */ + DISTR.pdf = _unur_distr_cont_eval_pdf_from_logpdf; + DISTR.dpdf = _unur_distr_cont_eval_dpdf_from_dlogpdf; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_normal_w_pdf_from_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_powerexponential_w_pdf_from_logpdf( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get distribution object for powerexponential distribution */ + distr = unur_distr_powerexponential( params, n_params ); + + /* name of distribution */ + distr->name = "powerexponential_w_pdf_from_logpdf"; + + /* replace PDF by wrapper function */ + DISTR.pdf = _unur_distr_cont_eval_pdf_from_logpdf; + DISTR.dpdf = _unur_distr_cont_eval_dpdf_from_dlogpdf; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_powerexponential_w_pdf_from_logpdf() */ + +/*---------------------------------------------------------------------------*/ +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/tests/testdistributions/c_with_multiple_of_pdf.c b/vendor/unuran-1.11.0/tests/testdistributions/c_with_multiple_of_pdf.c new file mode 100644 index 0000000..6c91fa5 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/testdistributions/c_with_multiple_of_pdf.c @@ -0,0 +1,213 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * Distribution objects of with multiple of PDFs generated from other * + * distribution objects. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "testdistributions.h" + +/*---------------------------------------------------------------------------*/ +/* Continuous univariate distributions */ +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "multPDF"; + +/*---------------------------------------------------------------------------*/ +/* prototypes for wrapper functions */ +static double _unur_cdf_mult (double x, const struct unur_distr *q); +static double _unur_logcdf_mult (double x, const struct unur_distr *q); +static double _unur_pdf_mult (double x, const struct unur_distr *q); +static double _unur_logpdf_mult (double x, const struct unur_distr *q); +static double _unur_dpdf_mult (double x, const struct unur_distr *q); +static double _unur_dlogpdf_mult (double x, const struct unur_distr *q); + +#define DISTR distr->data.cont + +#define MULT params[0] /* multiplicator */ + +#define CDF(x) ((*(q->base->data.cont.cdf)) ((x), q->base)) +#define logCDF(x) ((*(q->base->data.cont.logcdf)) ((x), q->base)) +#define PDF(x) ((*(q->base->data.cont.pdf)) ((x), q->base)) +#define logPDF(x) ((*(q->base->data.cont.logpdf)) ((x), q->base)) +#define dPDF(x) ((*(q->base->data.cont.dpdf)) ((x), q->base)) +#define dlogPDF(x) ((*(q->base->data.cont.dlogpdf)) ((x), q->base)) + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_multPDF( const struct unur_distr *distr, double mult ) + /*----------------------------------------------------------------------*/ + /* Create an object where the PDF is a multiple of the PDF of 'distr'. */ + /* `distr' must be a pointer to a univariate continuous distribution. */ + /* */ + /* parameters: */ + /* distr ... pointer to univariate continuous distribution. */ + /* mult ... multiplicator for PDF */ + /* */ + /* return: */ + /* pointer to distribution object */ + /* */ + /* error: */ + /* return NULL */ + /*----------------------------------------------------------------------*/ +{ + struct unur_distr *q; + + /* check arguments */ + _unur_check_NULL( distr_name,distr,NULL ); + + /* check distribution */ + if (distr->type != UNUR_DISTR_CONT) { + _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return NULL; } + COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); + + /* check multiplitor */ + if (mult <= 0.) { + _unur_error(distr_name,UNUR_ERR_PAR_SET,"mult <= 0"); return NULL; + } + + /* get distribution object for generic continuous univariate distribution */ + q = _unur_distr_cont_clone(distr); + if (!q) return NULL; + + /* this is a derived distribution */ + /* clone base distribution ... */ + q->base = _unur_distr_cont_clone( distr ); + if (!q->base) { _unur_distr_free(q); return NULL; } + + /* pointer to PDF, its derivative, and CDF */ + if (DISTR.cdf) q->data.cont.cdf = _unur_cdf_mult; /* pointer to CDF */ + if (DISTR.logcdf) q->data.cont.logcdf = _unur_logcdf_mult; /* pointer to CDF */ + if (DISTR.pdf) q->data.cont.pdf = _unur_pdf_mult; /* pointer to PDF */ + if (DISTR.dpdf) q->data.cont.dpdf = _unur_dpdf_mult; /* derivative of PDF */ + if (DISTR.logpdf) q->data.cont.logpdf = _unur_logpdf_mult; /* pointer to logPDF */ + if (DISTR.dlogpdf) q->data.cont.dlogpdf = _unur_dlogpdf_mult; /* derivative of logPDF */ + + /* disable all other pointers */ + q->data.cont.dlogpdf = NULL; /* pointer to HR */ + + /* set multiplicator */ + q->data.cont.MULT = mult; + q->data.cont.n_params = 1; + + /* return pointer to object */ + return q; + +} /* end of unur_distr_multPDF() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_cdf_mult( double x, const struct unur_distr *q ) +{ + /* check arguments */ + CHECK_NULL( q, UNUR_INFINITY ); + CHECK_NULL( q->base, UNUR_INFINITY ); + CHECK_NULL( q->base->data.cont.pdf, UNUR_INFINITY ); + + return CDF(x); + +} /* end of _unur_cdf_mult() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logcdf_mult( double x, const struct unur_distr *q ) +{ + /* check arguments */ + CHECK_NULL( q, UNUR_INFINITY ); + CHECK_NULL( q->base, UNUR_INFINITY ); + CHECK_NULL( q->base->data.cont.pdf, UNUR_INFINITY ); + + return logCDF(x); + +} /* end of _unur_logcdf_mult() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_mult( double x, const struct unur_distr *q ) +{ + /* check arguments */ + CHECK_NULL( q, UNUR_INFINITY ); + CHECK_NULL( q->base, UNUR_INFINITY ); + CHECK_NULL( q->base->data.cont.pdf, UNUR_INFINITY ); + + return q->data.cont.MULT * PDF(x); + +} /* end of _unur_pdf_mult() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dpdf_mult( double x, const struct unur_distr *q ) +{ + /* check arguments */ + CHECK_NULL( q, UNUR_INFINITY ); + CHECK_NULL( q->base, UNUR_INFINITY ); + CHECK_NULL( q->base->data.cont.dpdf, UNUR_INFINITY ); + + return q->data.cont.MULT * dPDF(x); + +} /* end of _unur_dpdf_mult() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_mult( double x, const struct unur_distr *q ) +{ + /* check arguments */ + CHECK_NULL( q, UNUR_INFINITY ); + CHECK_NULL( q->base, UNUR_INFINITY ); + CHECK_NULL( q->base->data.cont.logpdf, UNUR_INFINITY ); + + return log(q->data.cont.MULT) + logPDF(x); + +} /* end of _unur_logpdf_mult() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_dlogpdf_mult( double x, const struct unur_distr *q ) +{ + /* check arguments */ + CHECK_NULL( q, UNUR_INFINITY ); + CHECK_NULL( q->base, UNUR_INFINITY ); + CHECK_NULL( q->base->data.cont.dlogpdf, UNUR_INFINITY ); + + return dlogPDF(x); + +} /* end of _unur_dlogpdf_mult() */ + +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/tests/testdistributions/c_wo_logpdf.c b/vendor/unuran-1.11.0/tests/testdistributions/c_wo_logpdf.c new file mode 100644 index 0000000..4f01860 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/testdistributions/c_wo_logpdf.c @@ -0,0 +1,219 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * Distribution objects of standard distributions without logPDF * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include "testdistributions.h" + +/*---------------------------------------------------------------------------*/ +/* Continuous univariate distributions without logPDF */ +/*---------------------------------------------------------------------------*/ +#define DISTR distr->data.cont +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_beta_wo_logpdf( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get distribution object for beta distribution */ + distr = unur_distr_beta( params, n_params ); + + /* name of distribution */ + distr->name = "beta_wo_logpdf"; + + /* disable logPDF */ + DISTR.logpdf = NULL; + DISTR.dlogpdf = NULL; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_beta_wo_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_cauchy_wo_logpdf( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get distribution object for cauchy distribution */ + distr = unur_distr_cauchy( params, n_params ); + + /* name of distribution */ + distr->name = "cauchy_wo_logpdf"; + + /* disable logPDF */ + DISTR.logpdf = NULL; + DISTR.dlogpdf = NULL; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_cauchy_wo_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_exponential_wo_logpdf( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get distribution object for exponential distribution */ + distr = unur_distr_exponential( params, n_params ); + + /* name of distribution */ + distr->name = "exponential_wo_logpdf"; + + /* disable logPDF */ + DISTR.logpdf = NULL; + DISTR.dlogpdf = NULL; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_exponential_wo_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_gamma_wo_logpdf( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get distribution object for gamma distribution */ + distr = unur_distr_gamma( params, n_params ); + + /* name of distribution */ + distr->name = "gamma_wo_logpdf"; + + /* disable logPDF */ + DISTR.logpdf = NULL; + DISTR.dlogpdf = NULL; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_gamma_wo_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_laplace_wo_logpdf( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get distribution object for laplace distribution */ + distr = unur_distr_laplace( params, n_params ); + + /* name of distribution */ + distr->name = "laplace_wo_logpdf"; + + /* disable logPDF */ + DISTR.logpdf = NULL; + DISTR.dlogpdf = NULL; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_laplace_wo_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_normal_wo_logpdf( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get distribution object for normal distribution */ + distr = unur_distr_normal( params, n_params ); + + /* name of distribution */ + distr->name = "normal_wo_logpdf"; + + /* disable logPDF */ + DISTR.logpdf = NULL; + DISTR.dlogpdf = NULL; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_normal_wo_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_powerexponential_wo_logpdf( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get distribution object for powerexponential distribution */ + distr = unur_distr_powerexponential( params, n_params ); + + /* name of distribution */ + distr->name = "powerexponential_wo_logpdf"; + + /* disable logPDF */ + DISTR.logpdf = NULL; + DISTR.dlogpdf = NULL; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_powerexponential_wo_logpdf() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_uniform_wo_logpdf( const double *params, int n_params ) +{ + register struct unur_distr *distr; + + /* get distribution object for uniform distribution */ + distr = unur_distr_uniform( params, n_params ); + + /* name of distribution */ + distr->name = "uniform_wo_logpdf"; + + /* disable logPDF */ + DISTR.logpdf = NULL; + DISTR.dlogpdf = NULL; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_uniform_wo_logpdf() */ + +/*---------------------------------------------------------------------------*/ +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/tests/testdistributions/testdistributions.h b/vendor/unuran-1.11.0/tests/testdistributions/testdistributions.h new file mode 100644 index 0000000..6d73dfe --- /dev/null +++ b/vendor/unuran-1.11.0/tests/testdistributions/testdistributions.h @@ -0,0 +1,162 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: testdistributions.h * + * * + * PURPOSE: * + * Make distribution objects for special tests. * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ +#ifndef UNURAN_TESTDISTRIBUTIONS_H_SEEN +#define UNURAN_TESTDISTRIBUTIONS_H_SEEN +/*---------------------------------------------------------------------------*/ + +/* Distribution objects of with multiple of PDFs generated from other */ +/* distribution objects. */ +UNUR_DISTR *unur_distr_multPDF( const UNUR_DISTR *distr, double mult ); + +/*---------------------------------------------------------------------------*/ +/* Special continuous univariate distributions */ + +/* sawtooth distributions with discontinuous PDF */ +/* pdf(x) = |x| - floor(|x|) (and 1 at integers != 0) */ +/* (boundary of domain as parameters) */ +UNUR_DISTR *unur_distr_sawtooth_discpdf(const double *params, int n_params); + +/* sawtooth distributions with continuous PDF */ +/* pdf(x) = y for y < 0.5 and 1-y otherwise (where y = |x| - floor(|x|)) */ +/* (boundary of domain as parameters) */ +UNUR_DISTR *unur_distr_sawtooth_contpdf(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Continuous univariate distributions without logPDF */ + +/* Beta distribution [3; ch.25, p.210] */ +UNUR_DISTR *unur_distr_beta_wo_logpdf(const double *params, int n_params); + +/* Cauchy distribution [2; ch.16, p.299] */ +UNUR_DISTR *unur_distr_cauchy_wo_logpdf(const double *params, int n_params); + +/* Exponential distribution [2; ch.19, p.494] */ +UNUR_DISTR *unur_distr_exponential_wo_logpdf(const double *params, int n_params); + +/* Gamma distribution [2; ch.17, p.337] */ +UNUR_DISTR *unur_distr_gamma_wo_logpdf(const double *params, int n_params); + +/* Laplace distribution [3; ch.24, p.164] */ +UNUR_DISTR *unur_distr_laplace_wo_logpdf(const double *params, int n_params); + +/* Normal distribution [2; ch.13, p.80] */ +UNUR_DISTR *unur_distr_normal_wo_logpdf( const double *params, int n_params ); + +/* Power-exponential (Subbotin) distribution [3; ch.24, p.195] */ +UNUR_DISTR *unur_distr_powerexponential_wo_logpdf(const double *params, int n_params); + +/* Uniform distribution [3; ch.26, p.276] */ +UNUR_DISTR *unur_distr_uniform_wo_logpdf(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Continuous univariate distributions where PDF is computed from logPDF */ + +/* Beta distribution [3; ch.25, p.210] */ +UNUR_DISTR *unur_distr_beta_w_pdf_from_logpdf(const double *params, int n_params); + +/* Cauchy distribution [2; ch.16, p.299] */ +UNUR_DISTR *unur_distr_cauchy_w_pdf_from_logpdf(const double *params, int n_params); + +/* Exponential distribution [2; ch.19, p.494] */ +UNUR_DISTR *unur_distr_exponential_w_pdf_from_logpdf(const double *params, int n_params); + +/* Gamma distribution [2; ch.17, p.337] */ +UNUR_DISTR *unur_distr_gamma_w_pdf_from_logpdf(const double *params, int n_params); + +/* Normal distribution [2; ch.13, p.80] */ +UNUR_DISTR *unur_distr_normal_w_pdf_from_logpdf(const double *params, int n_params ); + +/* Power-exponential (Subbotin) distribution [3; ch.24, p.195] */ +UNUR_DISTR *unur_distr_powerexponential_w_pdf_from_logpdf(const double *params, int n_params); + +/*---------------------------------------------------------------------------*/ +/* Continuous multivariate distributions with marginal distributions */ + +/* Multicauchy distribution [5; ch.45, p.219] */ +UNUR_DISTR *unur_distr_multicauchy_w_marginals(int dim, const double *mean, const double *covar); + +/* Multinormal distribution [5; ch.45, p.105] */ +UNUR_DISTR *unur_distr_multinormal_w_marginals(int dim, const double *mean, const double *covar); + +/* Multistudent distribution */ +UNUR_DISTR *unur_distr_multistudent_w_marginals(int dim, double df, const double *mean, const double *covar); + +/*---------------------------------------------------------------------------*/ +/* Continuous multivariate distributions without logPDF */ + +/* Multinormal distribution [5; ch.45, p.105] */ +UNUR_DISTR *unur_distr_multinormal_wo_logpdf(int dim, const double *mean, const double *covar); + +/*---------------------------------------------------------------------------*/ +/* Continuous multivariate distributions where PDF is computed from logPDF */ + +/* Multinormal distribution [5; ch.45, p.105] */ +UNUR_DISTR *unur_distr_multinormal_w_pdf_from_logpdf(int dim, const double *mean, const double *covar); + +/*---------------------------------------------------------------------------*/ +/* Specially shaped multivariate distributions */ + +/* Multi-Cauchy distribution where RoU region with r=1 is a ball */ +UNUR_DISTR *unur_distr_multicauchy_RoU_ball( int dim ); + +/*---------------------------------------------------------------------------*/ +/* Multivariate distributions with correlation matrix of AR(1) process */ + +/* Multinormal distribution - AR(1) */ +UNUR_DISTR *unur_distr_multinormal_ar1(int dim, const double *mean, double rho); + +/* Multicauchy distribution - AR(1) */ +UNUR_DISTR *unur_distr_multicauchy_ar1(int dim, const double *mean, double rho); + +/* Multistudent distribution - AR(1) */ +UNUR_DISTR *unur_distr_multistudent_ar1(int dim, double df, const double *mean, double rho); + +/*---------------------------------------------------------------------------*/ +/* Multivariate distributions with equal off-diagonal entries in */ +/* correlation matrix */ + +/* Multinormal distribution - constant rho */ +UNUR_DISTR *unur_distr_multinormal_constantrho(int dim, const double *mean, double rho); + +/* Multicauchy distribution - constant rho */ +UNUR_DISTR *unur_distr_multicauchy_constantrho(int dim, const double *mean, double rho); + +/* Multistudent distribution - constant rho */ +UNUR_DISTR *unur_distr_multistudent_constantrho(int dim, double df, const double *mean, double rho); + +/*---------------------------------------------------------------------------*/ +#endif /* UNURAN_TESTDISTRIBUTIONS_H_SEEN */ +/*---------------------------------------------------------------------------*/ + diff --git a/vendor/unuran-1.11.0/tests/testdistributions/vc_cauchy_RoU_ball.c b/vendor/unuran-1.11.0/tests/testdistributions/vc_cauchy_RoU_ball.c new file mode 100644 index 0000000..22032d1 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/testdistributions/vc_cauchy_RoU_ball.c @@ -0,0 +1,168 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * Distribution objects of cauchy distribution whch becomes a ball when * + * the ratio-of-uniforms transformation is applied. * + * * + ***************************************************************************** + * * + * PDF(x) = (2 / (1+||x||^2) )^{dim+1} * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include "testdistributions.h" + +/*---------------------------------------------------------------------------*/ + +static const char distr_name[] = "multicauchy-RoU-ball"; + +/*---------------------------------------------------------------------------*/ +/* parameters */ + +#define DISTR distr->data.cvec + +/*---------------------------------------------------------------------------*/ +/* function prototypes */ + +static double _unur_pdf_multicauchy_RoU_ball( const double *x, UNUR_DISTR *distr ); +static double _unur_logpdf_multicauchy_RoU_ball( const double *x, UNUR_DISTR *distr ); +static int _unur_dlogpdf_multicauchy_RoU_ball( double *result, const double *x, UNUR_DISTR *distr ); + +/*---------------------------------------------------------------------------*/ + +double +_unur_pdf_multicauchy_RoU_ball( const double *x, UNUR_DISTR *distr ) +{ + return exp(_unur_logpdf_multicauchy_RoU_ball( x, distr )); +} /* end of _unur_pdf_multicauchy_RoU_ball() */ + +/*---------------------------------------------------------------------------*/ + +double +_unur_logpdf_multicauchy_RoU_ball( const double *x, UNUR_DISTR *distr ) +{ + int i,dim; + double normsq; + + dim = distr->dim; + for (i=0, normsq=0.; idim; + for (i=0, normsq=0.; iid = UNUR_DISTR_MCAUCHY; + + /* name of distribution */ + distr->name = distr_name; + + /* how to get special generators */ + DISTR.init = NULL; + + /* functions */ + DISTR.pdf = _unur_pdf_multicauchy_RoU_ball; /* pointer to PDF */ + DISTR.logpdf = _unur_logpdf_multicauchy_RoU_ball; /* pointer to logPDF */ + DISTR.dpdf = _unur_distr_cvec_eval_dpdf_from_dlogpdf; /* pointer to derivative of PDF */ + DISTR.dlogpdf = _unur_dlogpdf_multicauchy_RoU_ball; /* pointer to derivative of logPDF */ + + /* copy other parameters of distribution */ + /* none */ + + /* number of other parameters */ + /* DISTR.n_params = 0; ... default */ + + /* domain */ + + /* log of normalization constant */ + + /* mode */ + DISTR.mode = _unur_xmalloc( distr->dim * sizeof(double) ); + for (i=0; iset |= ( UNUR_DISTR_SET_STDDOMAIN | + UNUR_DISTR_SET_MODE ); + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_multicauchy_RoU_ball() */ + +/*---------------------------------------------------------------------------*/ +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/tests/testdistributions/vc_special_correlations_ar1.c b/vendor/unuran-1.11.0/tests/testdistributions/vc_special_correlations_ar1.c new file mode 100644 index 0000000..1f41f30 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/testdistributions/vc_special_correlations_ar1.c @@ -0,0 +1,275 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * Distribution objects of multivariate distributions having the * + * correlation matrix of AR(1) process. * + * * + ***************************************************************************** + * * + * Use correlation matrix of AR(1): * + * * + * +- -+ * + * | 1 r r^2 ... r^(d-1) | * + * | r 1 r ... r^(d-2) | * + * | r^2 r 1 ... r^(d-3) | * + * | ... ... | * + * | r^(d-1) r^(d-2) r^(d-3) ... 1 | * + * +- -+ * + * * + * in this case the inverse matrix is given as * + * * + * +- -+ * + * | a b 0 0 ... 0 0 | * + * | b c b 0 ... 0 0 | * + * | 0 b c b ... 0 0 | * + * | ... | * + * | 0 0 0 0 ... c b | * + * | 0 0 0 0 ... b a | * + * +- -+ * + * * + * with * + * * + * a = 1 / (1-r^2) * + * b = - r / (1-r^2) * + * c = (1+r^2) / (1-r^2) * + * * + * and the determinant of the covariance matrix is * + * * + * det = (1-r^2)^(d-1) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "testdistributions.h" + +/*---------------------------------------------------------------------------*/ + +#define LOGNORMCONSTANT (distr->data.cvec.norm_constant) +#define NORMCONSTANT (distr->data.cvec.norm_constant) + +/*---------------------------------------------------------------------------*/ +/* Set correlation matrix and its inverse of AR(1) process */ +static int _unur_vc_set_corrmatrix_ar1( UNUR_DISTR *distr, int dim, double rho ); + +/*---------------------------------------------------------------------------*/ + +int +_unur_vc_set_corrmatrix_ar1( UNUR_DISTR *distr, int dim, double rho ) + /*----------------------------------------------------------------------*/ + /* Create and set correlation matrix and its inverse of AR(1) process. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* dim ... dimension of random vector */ + /* rho ... correlation between consecutive elements in process */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... success */ + /* UNUR_FAILURE ... failure */ + /*----------------------------------------------------------------------*/ +{ +#define idx(a,b) ((a)*dim+(b)) + + double *covar, *covar_inv, *rhop; + double a, b, c, denominator; + int i,j; + int error = UNUR_FAILURE; + + /* checking parameters */ + if (_unur_iszero(rho)) /* nothing to do */ + return UNUR_SUCCESS; + + /* entries of matrix */ + denominator = 1.-rho*rho; + a = 1./denominator; + b = -rho/denominator; + c = (1.+rho*rho)/denominator; + + if ( rho<0. || rho>=1. || dim<1) + /* invalid arguments */ + return UNUR_FAILURE; + + /* allocate memory */ + covar = malloc( dim * dim * sizeof(double) ); + covar_inv = malloc( dim * dim * sizeof(double) ); + rhop = malloc( dim * sizeof(double) ); + if (covar == NULL || covar_inv == NULL || rhop == NULL) { + if (covar) free (covar); + if (covar_inv) free (covar_inv); + if (rhop) free (rhop); + return UNUR_FAILURE; + } + + /* compute powers of rho */ + rhop[0] = 1.; + for (i=1; i=1. || dim<1) + return NULL; + + /* get distribution object for multinormal distribution */ + distr = unur_distr_multinormal_w_marginals( dim, mean, NULL ); + + /* set the name of distribution */ + unur_distr_set_name(distr, "multinormal_ar1"); + + /* set the correlation matrix and its inverse */ + if (_unur_vc_set_corrmatrix_ar1(distr, dim, rho) != UNUR_SUCCESS) { + /* error */ + unur_distr_free(distr); distr = NULL; return NULL; + } + + /* compute normalization constant */ + det_covar = _unur_matrix_determinant(distr->dim, distr->data.cvec.covar); + LOGNORMCONSTANT = - ( distr->dim * log(2 * M_PI) + log(det_covar) ) / 2.; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_multinormal_ar1() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_multicauchy_ar1(int dim, const double *mean, double rho) + /*---------------------------------------------------------------------------*/ + /* Multinormal distribution (corr-matrix from AR(1) process) */ + /*---------------------------------------------------------------------------*/ +{ + struct unur_distr *distr; + double det_covar; + + /* checking parameters */ + if ( rho<0. || rho>=1. || dim<1) + return NULL; + + /* get distribution object for multicauchy distribution */ + distr = unur_distr_multicauchy_w_marginals( dim, mean, NULL ); + + /* set the name of distribution */ + unur_distr_set_name(distr, "multicauchy_ar1"); + + /* set the correlation matrix and its inverse */ + if (_unur_vc_set_corrmatrix_ar1(distr, dim, rho) != UNUR_SUCCESS) { + /* error */ + unur_distr_free(distr); distr = NULL; return NULL; + } + + /* compute normalization constant */ + det_covar = _unur_matrix_determinant(distr->dim, distr->data.cvec.covar); + LOGNORMCONSTANT = _unur_SF_ln_gamma((distr->dim+1)/2.) + - ( (distr->dim+1) * log(M_PI) + log(det_covar) ) / 2.; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_multicauchy_ar1() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_multistudent_ar1(int dim, double df, const double *mean, double rho) + /*---------------------------------------------------------------------------*/ + /* Multistudent distribution (corr-matrix from AR(1) process) */ + /*---------------------------------------------------------------------------*/ +{ + struct unur_distr *distr; + double det_covar; + + /* checking parameters */ + if ( rho<0. || rho>=1. || dim<1) + return NULL; + + /* get distribution object for multistudent distribution */ + distr = unur_distr_multistudent_w_marginals( dim, df, mean, NULL ); + + /* set the name of distribution */ + unur_distr_set_name(distr, "multistudent_ar1"); + + /* set the correlation matrix and its inverse */ + if (_unur_vc_set_corrmatrix_ar1(distr, dim, rho) != UNUR_SUCCESS) { + /* error */ + unur_distr_free(distr); distr = NULL; return NULL; + } + + /* compute normalization constant */ + det_covar = _unur_matrix_determinant(distr->dim, distr->data.cvec.covar); + LOGNORMCONSTANT = _unur_SF_ln_gamma((distr->dim+df)/2.) - _unur_SF_ln_gamma(df/2.) + - ( distr->dim * log(df*M_PI) + log(det_covar) ) / 2.; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_multistudent_ar1() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/tests/testdistributions/vc_special_correlations_constantrho.c b/vendor/unuran-1.11.0/tests/testdistributions/vc_special_correlations_constantrho.c new file mode 100644 index 0000000..0620747 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/testdistributions/vc_special_correlations_constantrho.c @@ -0,0 +1,263 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * Distribution objects of multivariate distributions having a * + * correlation matrix with constant off-diagonal elements * + * * + ***************************************************************************** + * * + * Use correlation matrix of the form: * + * * + * +- -+ * + * | 1 r r ... r | * + * | r 1 r ... r | * + * | r r 1 ... r | * + * | ... | * + * | r r r ... 1 | * + * +- -+ * + * * + * in this case the inverse matrix is given as * + * * + * +- -+ * + * | a b b ... b b | * + * | b a b ... b b | * + * | b b a ... b b | * + * | ... | * + * | b b b ... a b | * + * | b b b ... b a | * + * +- -+ * + * * + * with * + * * + * a = (1+(d-2)*r) / (1+(d-2)*r-(d-1)*r^2) * + * b = - r / (1+(d-2)*r-(d-1)*r^2) * + * * + * and the determinant of the covariance matrix is * + * * + * det = (1-r)^(d-1) * (1+(d-1)*r) * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include "testdistributions.h" + +/*---------------------------------------------------------------------------*/ + +#define LOGNORMCONSTANT (distr->data.cvec.norm_constant) +#define NORMCONSTANT (distr->data.cvec.norm_constant) + +/*---------------------------------------------------------------------------*/ + +/* Set correlation matrix with constant off-diagonal elements and its inverse */ +static int _unur_vc_set_corrmatrix_constantrho( UNUR_DISTR *distr, int dim, double rho ); + +/*---------------------------------------------------------------------------*/ + +int +_unur_vc_set_corrmatrix_constantrho( UNUR_DISTR *distr, int dim, double rho ) + /*----------------------------------------------------------------------*/ + /* Create and set correlation matrix with constant off-diagonal */ + /* elements and its inverse. */ + /* */ + /* parameters: */ + /* distr ... pointer to distribution object */ + /* dim ... dimension of random vector */ + /* rho ... correlation between consecutive elements in process */ + /* */ + /* return: */ + /* UNUR_SUCCESS ... success */ + /* UNUR_FAILURE ... failure */ + /*----------------------------------------------------------------------*/ +{ +#define idx(a,b) ((a)*dim+(b)) + + double *covar, *covar_inv; + double a, b, denominator; + int i,j; + int error = UNUR_FAILURE; + + /* checking parameters */ + if (_unur_iszero(rho)) /* nothing to do */ + return UNUR_SUCCESS; + + if ( rho<0. || rho>=1. || dim<1) + /* invalid arguments */ + return UNUR_FAILURE; + + /* entries of matrix */ + denominator = 1.+(dim-2)*rho-(dim-1)*rho*rho; + a = (1.+(dim-2)*rho)/denominator; + b = -rho/denominator; + + /* allocate memory */ + covar = malloc( dim * dim * sizeof(double) ); + covar_inv = malloc( dim * dim * sizeof(double) ); + if (covar == NULL || covar_inv == NULL) { + if (covar) free (covar); + if (covar_inv) free (covar_inv); + return UNUR_FAILURE; + } + + /* create correlation matrix */ + for (i=0; i=1. || dim<1) + return NULL; + + /* get distribution object for multinormal distribution */ + distr = unur_distr_multinormal_w_marginals( dim, mean, NULL ); + + /* set the name of distribution */ + unur_distr_set_name(distr, "multinormal_constantrho"); + + /* set the correlation matrix and its inverse */ + if (_unur_vc_set_corrmatrix_constantrho(distr, dim, rho) != UNUR_SUCCESS) { + /* error */ + unur_distr_free(distr); distr = NULL; return NULL; + } + + /* compute normalization constant */ + det_covar = _unur_matrix_determinant(distr->dim, distr->data.cvec.covar); + LOGNORMCONSTANT = - ( distr->dim * log(2 * M_PI) + log(det_covar) ) / 2.; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_multinormal_constantrho() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_multicauchy_constantrho(int dim, const double *mean, double rho) + /*---------------------------------------------------------------------------*/ + /* Multinormal distribution (corr-matrix : constant off-diagonal elements) */ + /*---------------------------------------------------------------------------*/ +{ + struct unur_distr *distr; + double det_covar; + + /* checking parameters */ + if ( rho<0. || rho>=1. || dim<1) + return NULL; + + /* get distribution object for multicauchy distribution */ + distr = unur_distr_multicauchy_w_marginals( dim, mean, NULL ); + + /* set the name of distribution */ + unur_distr_set_name(distr, "multicauchy_constantrho"); + + /* set the correlation matrix and its inverse */ + if (_unur_vc_set_corrmatrix_constantrho(distr, dim, rho) != UNUR_SUCCESS) { + /* error */ + unur_distr_free(distr); distr = NULL; return NULL; + } + + /* compute normalization constant */ + det_covar = _unur_matrix_determinant(distr->dim, distr->data.cvec.covar); + LOGNORMCONSTANT = _unur_SF_ln_gamma((distr->dim+1)/2.) + - ( (distr->dim+1) * log(M_PI) + log(det_covar) ) / 2.; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_multicauchy_constantrho() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_multistudent_constantrho(int dim, double df, const double *mean, double rho) + /*---------------------------------------------------------------------------*/ + /* Multistudent distribution (corr-matrix : constant off-diagonal elements) */ + /*---------------------------------------------------------------------------*/ +{ + struct unur_distr *distr; + double det_covar; + + /* checking parameters */ + if ( rho<0. || rho>=1. || dim<1) + return NULL; + + /* get distribution object for multistudent distribution */ + distr = unur_distr_multistudent_w_marginals( dim, df, mean, NULL ); + + /* set the name of distribution */ + unur_distr_set_name(distr, "multistudent_constantrho"); + + /* set the correlation matrix and its inverse */ + if (_unur_vc_set_corrmatrix_constantrho(distr, dim, rho) != UNUR_SUCCESS) { + /* error */ + unur_distr_free(distr); distr = NULL; return NULL; + } + + /* compute normalization constant */ + det_covar = _unur_matrix_determinant(distr->dim, distr->data.cvec.covar); + LOGNORMCONSTANT = _unur_SF_ln_gamma((distr->dim+df)/2.) - _unur_SF_ln_gamma(df/2.) + - ( distr->dim * log(df*M_PI) + log(det_covar) ) / 2.; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_multistudent_constantrho() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/tests/testdistributions/vc_w_marginals.c b/vendor/unuran-1.11.0/tests/testdistributions/vc_w_marginals.c new file mode 100644 index 0000000..59ee78c --- /dev/null +++ b/vendor/unuran-1.11.0/tests/testdistributions/vc_w_marginals.c @@ -0,0 +1,112 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * Distribution objects of standard distributions without logPDF * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include "testdistributions.h" + +/*---------------------------------------------------------------------------*/ +/* Continuous multivariate distributions without logPDF */ +/*---------------------------------------------------------------------------*/ +#define DISTR distr->data.cvec +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_multicauchy_w_marginals( int dim, const double *mean, const double *covar ) +{ + struct unur_distr *distr; + struct unur_distr *marginal; + + /* get distribution object for beta distribution */ + distr = unur_distr_multicauchy( dim, mean, covar ); + + /* set marginal distributions */ + if (distr != NULL && DISTR.marginals == NULL) { + marginal = unur_distr_cauchy(NULL,0); + unur_distr_cvec_set_marginals(distr,marginal); + unur_distr_free(marginal); + } + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_multicauchy_w_marginals() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_multinormal_w_marginals( int dim, const double *mean, const double *covar ) +{ + struct unur_distr *distr; + struct unur_distr *marginal; + + /* get distribution object for beta distribution */ + distr = unur_distr_multinormal( dim, mean, covar ); + + /* set marginal distributions */ + if (distr != NULL && DISTR.marginals == NULL) { + marginal = unur_distr_normal(NULL,0); + unur_distr_cvec_set_marginals(distr,marginal); + unur_distr_free(marginal); + } + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_multinormal_w_marginals() */ + +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_multistudent_w_marginals( int dim, double df, const double *mean, const double *covar ) +{ + struct unur_distr *distr; + struct unur_distr *marginal; + + /* get distribution object for beta distribution */ + distr = unur_distr_multistudent( dim, df, mean, covar ); + + /* set marginal distributions */ + if (distr != NULL && DISTR.marginals == NULL) { + marginal = unur_distr_student(&df,1); + unur_distr_cvec_set_marginals(distr,marginal); + unur_distr_free(marginal); + } + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_multistudent_w_marginals() */ + +/*---------------------------------------------------------------------------*/ +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/tests/testdistributions/vc_wo_logpdf.c b/vendor/unuran-1.11.0/tests/testdistributions/vc_wo_logpdf.c new file mode 100644 index 0000000..d6fc646 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/testdistributions/vc_wo_logpdf.c @@ -0,0 +1,66 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * Distribution objects of standard distributions without logPDF * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include "testdistributions.h" + +/*---------------------------------------------------------------------------*/ +/* Continuous multivariate distributions without logPDF */ +/*---------------------------------------------------------------------------*/ +#define DISTR distr->data.cvec +/*---------------------------------------------------------------------------*/ + +struct unur_distr * +unur_distr_multinormal_wo_logpdf( int dim, const double *mean, const double *covar ) +{ + register struct unur_distr *distr; + + /* get distribution object for beta distribution */ + distr = unur_distr_multinormal_w_marginals( dim, mean, covar ); + + /* name of distribution */ + distr->name = "multinormal_wo_logpdf"; + + /* disable logPDF */ + DISTR.logpdf = NULL; + DISTR.dlogpdf = NULL; + DISTR.pdlogpdf = NULL; + + /* return pointer to object */ + return distr; + +} /* end of unur_distr_multinormal_wo_logpdf() */ + +/*---------------------------------------------------------------------------*/ +#undef DISTR +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/tests/testroutines.c b/vendor/unuran-1.11.0/tests/testroutines.c new file mode 100644 index 0000000..c200f35 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/testroutines.c @@ -0,0 +1,1622 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: testroutines.c * + * * + * Common test routines * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include "testunuran.h" +#include + +#ifdef HAVE_UNISTD_H +# include +#endif + +/*---------------------------------------------------------------------------*/ +/* Compiler switches */ + +/* whether to test U-errors for inversion method in tails more accurately */ +#define TEST_INVERROR_TAILS (FALSE) + +/*---------------------------------------------------------------------------*/ +/* global switches */ + +static int stopwatch = FALSE; /* whether to use a stop watch for checks */ +static TIMER vw; /* timer for particular tests */ + +/*---------------------------------------------------------------------------*/ + +#if defined(HAVE_ALARM) && defined(HAVE_SIGNAL) + +/* time limit before SIGALRM is sent to process */ +int time_limit = 0u; + +/* handle SIGALRM signals */ +static void catch_alarm (int sig); + +/* test log file */ +static FILE *TESTLOG = NULL; + +#endif + +/*---------------------------------------------------------------------------*/ + +/* draw sample */ +static int draw_sample_and_discard ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); + +/* compare two doubles */ +static int compare_doubles ( double x1, double x2 ); + +/* compare double sequences generated by generator */ +static int compare_double_sequence_gen_start ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); +static int compare_double_sequence_gen ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); + +/* compare int sequences generated by generator */ +static int compare_int_sequence_gen_start ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); +static int compare_int_sequence_gen ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); + +/* compare sequences of double vectors generated by generator */ +static int compare_cvec_sequence_gen_start ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); +static int compare_cvec_sequence_gen ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); + +/* compare sequences of double matrices generated by generator */ +static int compare_matr_sequence_gen_start ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); +static int compare_matr_sequence_gen ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); + +/*---------------------------------------------------------------------------*/ +/* check whether unur_urng_reset() works */ + +static int +cannot_compare_sequence ( FILE *LOG ) +{ + fprintf (LOG,"\nURNG cannot be reset. Cannot compare sequences. (Skip)\n"); + printf ("URNG cannot be reset. Cannot compare sequences. (Skip)\n"); + + return UNUR_SUCCESS; /* indicate as "not failed" for practical reasons */ +} /* end of cannot_compare_sequence() */ + +/*---------------------------------------------------------------------------*/ +/* stop watch */ + +void stopwatch_start(TIMER *t) +/* start stop watch */ +{ + t->stop = stopwatch_get_time(t->tv); + t->interim = t->stop; + t->start = t->stop; +} + +double stopwatch_lap(TIMER *t) +/* return elapsed time (in ms) since last call to stopwatch_start(), + stopwatch_stop(), or stopwatch_lap() */ +{ + double etime; + + t->stop = stopwatch_get_time(t->tv); + etime = t->stop - t->interim; + + t->interim = t->stop; + + return etime; +} + +double stopwatch_stop(TIMER *t) +/* return elapsed time (in ms) since last call to stopwatch_start() + or stopwatch_stop() */ +{ + double etime; + + t->stop = stopwatch_get_time(t->tv); + etime = t->stop - t->start; + + t->interim = t->stop; + t->start = t->stop; + + return etime; +} + +void stopwatch_init(void) +/* initialize watch */ +{ + /* detect whether stopwatch should be used */ + stopwatch = (getenv("UNURANSTOPWATCH")==NULL) ? FALSE : TRUE; + stopwatch_start(&vw); +} + +void stopwatch_print( FILE *LOG, const char *format, double etime ) +/* print time depending whether watch is enabled or not */ +{ + if (stopwatch) + fprintf(LOG,format,etime); +} + +/*---------------------------------------------------------------------------*/ +/* exit with FAIL when run time exceeds limit */ + +#if defined(HAVE_ALARM) && defined(HAVE_SIGNAL) + +void catch_alarm (int sig ATTRIBUTE__UNUSED) +{ + fprintf(stdout," aborted! time limit of %d seconds exceeded ...\n",time_limit); + fprintf(TESTLOG,"\n\n=== ABORTED! ===\ntime limit of %d seconds exceeded ...\n\n",time_limit); + exit (EXIT_FAILURE); +} + +void set_alarm(FILE *LOG) +{ + char *read_timer; + + /* file handle for test log file */ + TESTLOG = LOG; + + /* read time limit from environment */ + read_timer = getenv("UNURANTIMER"); + time_limit = (read_timer!=NULL) ? atoi(read_timer) : 0; + + /* alarm is only set when environment variable is defined */ + if (time_limit<=0) return; + + /* Establish a handler for SIGALRM signals. */ + signal(SIGALRM, catch_alarm); + + /* set in alarm in 'time' seconds */ + alarm((unsigned)time_limit); + + /* print message into test log file */ + fprintf(TESTLOG,"Send alarm in %d seconds\n",time_limit); + fprintf(TESTLOG,"\n====================================================\n\n"); + +} + +#else + +void set_alarm(FILE *LOG ATTRIBUTE__UNUSED) {;} + +#endif + +/*---------------------------------------------------------------------------*/ +/* print header for test log file */ + +void print_test_log_header( FILE *LOG, unsigned long seed, int fullcheck ) +{ + time_t started; + + /* Title */ + fprintf(LOG,"\nUNU.RAN - Universal Non-Uniform RANdom number generator\n\n"); + if (time( &started ) != -1) + fprintf(LOG,"%s",ctime(&started)); + fprintf(LOG,"\n=======================================================\n\n"); + + /* version */ + fprintf(LOG,"UNU.RAN version: %s\n", PACKAGE_STRING); + + /* deprecated code */ + fprintf(LOG,"Use deprecated code: %s\n", +#ifdef USE_DEPRECATED_CODE + "yes" +#else + "no" +#endif + ); + + /* runtime checks */ + fprintf(LOG,"Enable runtime checks: %s\n", +#if defined(UNUR_ENABLE_CHECKNULL) || defined(UNUR_COOKIES) + "yes" +#else + "no" +#endif + ); + + /* printing debugging info into log file */ + fprintf(LOG,"Enable logging of data: %s\n", +#ifdef UNUR_ENABLE_LOGGING + "yes" +#else + "no" +#endif + ); + + /* creating info string */ + fprintf(LOG,"Enable info routine: %s\n", +#ifdef UNUR_ENABLE_INFO + "yes" +#else + "no" +#endif + ); + + fprintf(LOG,"\n"); + + /* Uniform random number generator */ + fprintf(LOG,"Uniform random number generator: %s\n", +#ifdef UNUR_URNG_DEFAULT_RNGSTREAM + "RngStreams" +#else + "[default] (built-in or user supplied)" +#endif + ); + + /* seed */ + if (seed != ~0u) + fprintf(LOG,"SEED = %lu\n",seed); + else + fprintf(LOG,"SEED = (not set)\n"); + + fprintf(LOG,"\n"); + + /* whether all checks are performed */ + fprintf(LOG,"check mode: %s\n", + fullcheck ? "fullcheck" : "installation"); + + /* end */ + fprintf(LOG,"\n=======================================================\n\n"); + +} /* end of print_test_log_header() */ + +/*---------------------------------------------------------------------------*/ +/* check for invalid NULL pointer, that should not happen in this program */ + +void abort_if_NULL( FILE *LOG, int line, const void *ptr ) +{ + if (ptr) return; /* o.k. */ + + /* + There must not be a NULL pointer. + Since we do not expect a NULL pointer something serious has + happend. So it is better to abort the tests. + */ + fprintf(LOG,"line %4d: Unexpected NULL pointer. Panik --> Abort tests!!\n\n",line); + printf(" Panik --> Tests aborted\n"); fflush(stdout); + + /* test finished */ + printf("\n"); fflush(stdout); + + /* close log files and exit */ + fclose(LOG); + exit(EXIT_FAILURE); + +} /* abort_if_NULL() */ + +/*---------------------------------------------------------------------------*/ +/* compare error code */ + +int check_errorcode( FILE *LOG, int line, int errno_exp ) +{ + int errno_obs = unur_get_errno(); + + fprintf(LOG,"line %4d: Error code ...\t\t",line); + + if (errno_obs != errno_exp) { + fprintf(LOG," Failed"); + fprintf(LOG," (observed = %#x, expected = %#x)\n",errno_obs,errno_exp); + fflush(LOG); + return UNUR_FAILURE; + } + + else { + fprintf(LOG," ok\n"); + fflush(LOG); + return UNUR_SUCCESS; + } +} /* end of check_errorcode() */ + +/*---------------------------------------------------------------------------*/ +/* check for expected NULL pointer */ + +int do_check_expected_NULL( FILE *LOG, int line, int is_NULL ) +{ + fprintf(LOG,"line %4d: NULL pointer expected ...\t",line); + + if (is_NULL) { + fprintf(LOG," ok\n"); + fflush(LOG); + return UNUR_SUCCESS; + } + + else { + fprintf(LOG," Failed\n"); + fflush(LOG); + return UNUR_FAILURE; + } + +} /* end of check_expected_NULL() */ + +/*---------------------------------------------------------------------------*/ +/* check for "set failed" */ + +int check_expected_setfailed( FILE *LOG, int line, int rcode ) +{ + fprintf(LOG,"line %4d: `failed' expected ...\t",line); + if (rcode==UNUR_SUCCESS) { + fprintf(LOG," Failed\n"); + fflush(LOG); + return UNUR_FAILURE; + } + + else { + fprintf(LOG," ok\n"); + fflush(LOG); + return UNUR_SUCCESS; + } +} /* end of check_expected_setfailed() */ + +/*---------------------------------------------------------------------------*/ +/* check for O (zero) */ + +int check_expected_zero( FILE *LOG, int line, int k ) +{ + fprintf(LOG,"line %4d: 0 (zero) expected ...\t",line); + + if (k != 0) { + fprintf(LOG," Failed\n"); + fflush(LOG); + return UNUR_FAILURE; + } + + else { + fprintf(LOG," ok\n"); + fflush(LOG); + return UNUR_SUCCESS; + } +} /* end of check_expected_zero() */ + +/*---------------------------------------------------------------------------*/ +/* check for INFINITY */ + +int check_expected_INFINITY( FILE *LOG, int line, double x ) +{ + fprintf(LOG,"line %4d: INFINITY expected ...\t",line); + + if (x < UNUR_INFINITY) { + fprintf(LOG," Failed\n"); + fflush(LOG); + return UNUR_FAILURE; + } + + else { + fprintf(LOG," ok\n"); + fflush(LOG); + return UNUR_SUCCESS; + } +} /* end of check_expected_INFINITY() */ + +int check_expected_negINFINITY( FILE *LOG, int line, double x ) +{ + fprintf(LOG,"line %4d: -INFINITY expected ...\t",line); + + if (x > -UNUR_INFINITY) { + fprintf(LOG," Failed\n"); + fflush(LOG); + return UNUR_FAILURE; + } + + else { + fprintf(LOG," ok\n"); + fflush(LOG); + return UNUR_SUCCESS; + } +} /* end of check_expected_negINFINITY() */ + +int check_expected_INTMAX( FILE *LOG, int line, int k ) +{ + fprintf(LOG,"line %4d: INT_MAX expected ...\t",line); + + if (k < INT_MAX) { + fprintf(LOG," Failed\n"); + fflush(LOG); + return UNUR_FAILURE; + } + + else { + fprintf(LOG," ok\n"); + fflush(LOG); + return UNUR_SUCCESS; + } +} /* end of check_expected_INTMAX() */ + +/*---------------------------------------------------------------------------*/ +/* check for reinit */ + +int check_expected_reinit( FILE *LOG, int line, int rcode ) +{ + fprintf(LOG,"line %4d: reinit ...\t\t\t",line); + + if (rcode!=UNUR_SUCCESS) { + fprintf(LOG," Failed\n"); + fflush(LOG); + return UNUR_FAILURE; + } + + else { + fprintf(LOG," ok\n"); + fflush(LOG); + return UNUR_SUCCESS; + } +} /* end of check_expected_reinit() */ + +/*---------------------------------------------------------------------------*/ +/* check for non existing reinit */ + +int check_expected_no_reinit( FILE *LOG, int line, int rcode ) +{ + fprintf(LOG,"line %4d: no reinit ...\t\t",line); + + if (rcode==UNUR_SUCCESS) { + fprintf(LOG," Failed\n"); + fflush(LOG); + return UNUR_FAILURE; + } + + else { + fprintf(LOG," ok\n"); + fflush(LOG); + return UNUR_SUCCESS; + } +} /* end of check_expected_no_reinit() */ + + +/*---------------------------------------------------------------------------*/ +/* draw sample */ + +int draw_sample_and_discard ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ) +{ + /* int J; */ + /* double X; */ + double *vec; + + switch (unur_distr_get_type(unur_get_distr(gen)) ) { + + case UNUR_DISTR_DISCR: + for( ; sample_size>0; --sample_size) + /* J = unur_sample_discr(gen); */ + unur_sample_discr(gen); + return UNUR_SUCCESS; + + case UNUR_DISTR_CONT: + case UNUR_DISTR_CEMP: + for( ; sample_size>0; --sample_size) + /* X = unur_sample_cont(gen); */ + unur_sample_cont(gen); + return UNUR_SUCCESS; + + case UNUR_DISTR_CVEC: + case UNUR_DISTR_CVEMP: + /* we need an array for the vector */ + vec = malloc( unur_get_dimension(gen) * sizeof(double) ); + abort_if_NULL(LOG, line, vec); + for( ; sample_size>0; --sample_size) + unur_sample_vec(gen,vec); + free(vec); + return UNUR_SUCCESS; + + default: /* unknown ! */ + fprintf(stderr,"\ncannot handle distribution type! ... aborted\n"); + exit (EXIT_FAILURE); + } + +} /* end of unur_test_printsample() */ + +/*---------------------------------------------------------------------------*/ +/* compare two doubles */ + +int +compare_doubles ( double x1, double x2 ) +{ + if (_unur_FP_approx(x1,x2)) + return TRUE; + else if (fabs(x1-x2) < UNUR_EPSILON) + return TRUE; + else + return FALSE; +} /* end of compare_doubles() */ + +/*---------------------------------------------------------------------------*/ +/* compare sequences generated by generator */ + +int +compare_sequence_gen_start( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ) +{ + + if (gen == NULL) return UNUR_FAILURE; + + /* reset uniform RNG */ + if (unur_urng_reset(unur_get_urng(gen)) != UNUR_SUCCESS) + return UNUR_SUCCESS; + + switch( unur_distr_get_type(unur_get_distr(gen)) ) { + + case UNUR_DISTR_CONT: + case UNUR_DISTR_CEMP: + case 0: /* method UNIF */ + return compare_double_sequence_gen_start(LOG,line,gen,sample_size ); + + case UNUR_DISTR_CVEC: + case UNUR_DISTR_CVEMP: + return compare_cvec_sequence_gen_start(LOG,line,gen,sample_size ); + + case UNUR_DISTR_DISCR: + return compare_int_sequence_gen_start(LOG,line,gen,sample_size ); + + case UNUR_DISTR_MATR: + return compare_matr_sequence_gen_start(LOG,line,gen,sample_size ); + + default: + fprintf(stderr,"\ncannot handle distribution type! ... aborted\n"); + exit (EXIT_FAILURE); + } + +} /* end of compare_sequence_gen_start() */ + +int +compare_sequence_gen ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ) +{ + if (gen == NULL) return UNUR_FAILURE; + + /* reset uniform RNG */ + if (unur_urng_reset(unur_get_urng(gen)) != UNUR_SUCCESS) + return cannot_compare_sequence(LOG); + + switch( unur_distr_get_type(unur_get_distr(gen)) ) { + + case UNUR_DISTR_CONT: + case UNUR_DISTR_CEMP: + case 0: /* method UNIF */ + return compare_double_sequence_gen(LOG,line,gen,sample_size ); + + case UNUR_DISTR_CVEC: + case UNUR_DISTR_CVEMP: + return compare_cvec_sequence_gen(LOG,line,gen,sample_size ); + + case UNUR_DISTR_DISCR: + return compare_int_sequence_gen(LOG,line,gen,sample_size ); + + case UNUR_DISTR_MATR: + return compare_matr_sequence_gen(LOG,line,gen,sample_size ); + + default: + fprintf(stderr,"\ncannot handle distribution type! ... aborted\n"); + exit (EXIT_FAILURE); + } +} /* end of compare_sequence_gen() */ + +/*---------------------------------------------------------------------------*/ + +int +compare_sequence_par_start( FILE *LOG, int line, UNUR_PAR *par, int sample_size ) +{ + UNUR_GEN *gen; + int result; + + /* reset uniform RNG */ + if (unur_urng_reset(unur_get_default_urng()) != UNUR_SUCCESS) { + if (par) { + free(par); + } + return UNUR_SUCCESS; + } + + /* init generator */ + gen = unur_init( par ); abort_if_NULL(LOG,line,gen); + + /* run test */ + result = compare_sequence_gen_start(LOG,line,gen,sample_size); + + unur_free(gen); + return result; + +} /* end of compare_sequence_par_start() */ + +int +compare_sequence_par ( FILE *LOG, int line, UNUR_PAR *par, int sample_size ) +{ + UNUR_GEN *gen; + int result; + + /* reset uniform RNG */ + if (unur_urng_reset(unur_get_default_urng()) != UNUR_SUCCESS) { + if (par) { + free(par); + } + return cannot_compare_sequence(LOG); + } + + /* init generator */ + gen = unur_init( par ); abort_if_NULL(LOG, line,gen); + + /* run test */ + result = compare_sequence_gen(LOG,line,gen,sample_size); + + unur_free(gen); + + return result; + +} /* end of compare_sequence_par() */ + +/*---------------------------------------------------------------------------*/ +/* compare double sequences generated by generator */ +/* only when when we can reset the uniform RNG */ + +static double *double_sequence_A = NULL; + +int compare_sequence_urng_start( FILE *LOG, int line, int sample_size ) +{ + int i; + UNUR_URNG *urng = unur_get_default_urng(); + + /* allocate memory for storing sequence */ + if (double_sequence_A == NULL) { + double_sequence_A = malloc( sample_size * sizeof(double) ); + abort_if_NULL(LOG, line, double_sequence_A); + } + + /* reset uniform RNG */ + if (unur_urng_reset(urng) != UNUR_SUCCESS) + return UNUR_SUCCESS; + + /* generate sequence */ + for (i=0; i1) ? pval : pval*(dim+1); + + + if (pval < -1.5) { + /* was not able to run test (CDF missing) */ + + fprintf(LOG," not performed (missing data)\t"); + /* print distribution name */ + print_distr_name( LOG, distr, gen ? unur_get_genid(gen):"???\t" ); + fprintf(LOG,"\n"); + + printf("X"); + + fflush(stdout); + fflush(LOG); + + /* test failed */ + return UNUR_FAILURE; + } + + if (pval < 0.) { + fprintf(LOG," setup failed\t\t"); + } + else { + fprintf(LOG," pval = %8.6f ",pval); + l = _unur_isnan(pval_corrected) + ? 10000 + : -(int) ((pval_corrected > 1e-6) ? (log(pval_corrected) / M_LN10) : 6.); + switch (l) { + case 0: + fprintf(LOG," "); break; + case 1: + fprintf(LOG,". "); break; + case 2: + fprintf(LOG,"** "); break; + case 3: + fprintf(LOG,"XXX "); break; + case 4: + fprintf(LOG,"XXXX "); break; + case 5: + fprintf(LOG,"XXXXX "); break; + default: + fprintf(LOG,"######"); break; + } + } + + switch (todo) { + case '+': + if (pval_corrected >= PVAL_LIMIT) { + fprintf(LOG,"\t ok"); + printf("+"); + } + else { + failed = 1; + if (trial > 2) { + fprintf(LOG,"\t Failed"); + printf("(!+)"); + } + else { + fprintf(LOG,"\t Try again"); + printf("?"); + } + } + break; + case '0': + case '/': + fprintf(LOG,"\t ok (expected to fail)"); + printf("0"); + break; + case '-': + if (pval_corrected < PVAL_LIMIT) { + /* in this case it is expected to fail */ + failed = 0; + fprintf(LOG,"\t ok (expected to fail)"); + printf("-"); + } + else { + /* the test has failed which was not what we have expected */ + failed = 1; + fprintf(LOG,"\t Not ok (expected to fail)"); + printf("(!-)"); + } + break; + default: + fprintf(stderr, "%s:%d: invalid test symbol\n", __FILE__, __LINE__); + exit (-1); + } + + /* timing */ + stopwatch_print(LOG,"\ttime=%.1f ms ", stopwatch_lap(&vw)); + + /* print distribution name */ + fprintf(LOG,"\t"); + print_distr_name( LOG, distr, gen ? unur_get_genid(gen):"???\t" ); + fprintf(LOG,"\n"); + + fflush(stdout); + fflush(LOG); + return (failed ? UNUR_FAILURE : UNUR_SUCCESS); + +} /* end of print_pval() */ + +/*---------------------------------------------------------------------------*/ +/* run chi2 test */ + +int run_validate_chi2( FILE *LOG, int line ATTRIBUTE__UNUSED, + UNUR_GEN *gen, const UNUR_DISTR *distr, int todo ) + /* UNUR_SUCCESS ... on success */ + /* UNUR_ERR_SILENT ... test failed only once */ + /* UNUR_FAILURE ... serious failure */ +{ +#define BUFSIZE 128 + const char *distr_name; + static char last_distr_name[BUFSIZE] = ""; + unsigned int type; + int i; + double pval; + int failed = 0; + + /* check input */ + if (distr == NULL) { + printf(" [!!no distribution!!] "); fflush(stdout); + return UNUR_FAILURE; + } + + /* timer */ + stopwatch_lap(&vw); + + /* get name of distribution */ + distr_name = unur_distr_get_name( distr ); + + /* get type of distribution */ + type = unur_distr_get_type( distr ); + + if ( strcmp(distr_name,last_distr_name) ) { + /* different distributions */ + strncpy(last_distr_name,distr_name,(size_t)BUFSIZE); + last_distr_name[BUFSIZE-1] = '\0'; + printf(" %s",distr_name); fflush(stdout); + } + + if (todo == '.') { + /* nothing to do */ + printf("."); fflush(stdout); + return UNUR_SUCCESS; + } + + if (todo == '0') { + /* initialization of generator is expected to fail */ + if (gen == NULL) { + printf("0"); fflush(stdout); + return UNUR_SUCCESS; + } + else { + /* error */ + printf("(!0)"); fflush(stdout); + return UNUR_FAILURE; + } + } + + if (gen == NULL) { + if (todo == '-') { + print_pval(LOG,gen,distr,-0.5,10,todo); + return UNUR_SUCCESS; + } + else if (todo == '/') { + printf("/"); fflush(stdout); + return UNUR_SUCCESS; + } + else { + /* initialization failed --> cannot run test */ + print_pval(LOG,gen,distr,-0.5,10,todo); + return UNUR_FAILURE; + } + } + + if (todo == '%') { + /* initialize generator and draw small sample. */ + /* (for memory debugging when the CDF is not available) */ + printf("%%"); fflush(stdout); + draw_sample_and_discard(LOG, line, gen, 100); + fprintf(LOG," not performed (sample only)\t"); + print_distr_name( LOG, distr, gen ? unur_get_genid(gen):"???\t" ); + fprintf(LOG,"\n"); + return UNUR_SUCCESS; + } + + /* init successful */ + if ( todo == '/' ) todo = '+'; + + /* run chi^2 test */ + for (i=1; i<=3; i++) { + /* we run the test up to three times when it fails */ + + switch (type) { + case UNUR_DISTR_DISCR: + pval = unur_test_chi2( gen, CHI_TEST_INTERVALS, 100000, 20, CHI_TEST_VERBOSITY, LOG); + break; + case UNUR_DISTR_CONT: + case UNUR_DISTR_CEMP: + pval = unur_test_chi2( gen, CHI_TEST_INTERVALS, 0, 20, CHI_TEST_VERBOSITY, LOG); + break; + case UNUR_DISTR_CVEC: + case UNUR_DISTR_CVEMP: + pval = unur_test_chi2( gen, CHI_TEST_INTERVALS, 0, 20, CHI_TEST_VERBOSITY, LOG); + break; + default: + fprintf(stderr, "\n%s:%d: run_validate_chi2: this should not happen\n", __FILE__, __LINE__); + exit (EXIT_FAILURE); + } + + if ( print_pval(LOG,gen,distr,pval,i,todo) != UNUR_SUCCESS ) + /* test failed */ + failed++; + else + /* test ok */ + break; + } + + return (failed==0 ? UNUR_SUCCESS : (failed<=2 ? UNUR_ERR_SILENT : UNUR_FAILURE)); + +#undef BUFSIZE +} /* end of run_validate_chi2() */ + +/*---------------------------------------------------------------------------*/ +/* run verify hat test */ + +#define VERIFYHAT_SAMPLESIZE 10000 + +int run_validate_verifyhat( FILE *LOG, int line, UNUR_GEN *gen, + const UNUR_DISTR *distr, int todo ) +{ +#define BUFSIZE 128 + const char *distr_name; + static char last_distr_name[BUFSIZE] = ""; + unsigned int type; + int i; + int failed = 0; + int dim; + double *x = NULL; + int errno_obs; + + /* check input */ + if (distr == NULL) { + printf(" [!!no distribution!!]" ); fflush(stdout); + return UNUR_FAILURE; + } + + /* timer */ + stopwatch_lap(&vw); + + /* get name of distribution */ + distr_name = unur_distr_get_name( distr ); + + /* get type of distribution */ + type = unur_distr_get_type( distr ); + + if (strcmp(distr_name,last_distr_name) ) { + /* different distributions */ + strncpy(last_distr_name,distr_name,(size_t)BUFSIZE); + last_distr_name[BUFSIZE-1] = '\0'; + printf(" %s",distr_name); fflush(stdout); + } + + if (todo == '.') { + /* nothing to do */ + printf("."); fflush(stdout); + return UNUR_SUCCESS; + } + + if (todo == '0') { + /* initialization of generator is expected to fail */ + if (gen == NULL) { + printf("0"); fflush(stdout); + print_verifyhat_result(LOG,gen,distr,-1,todo); + return UNUR_SUCCESS; + } + else { + /* error */ + printf("(!0)"); fflush(stdout); + return UNUR_FAILURE; + } + } + + if (gen == NULL) { + if (todo == '-') { + printf("-"); fflush(stdout); + print_verifyhat_result(LOG,gen,distr,-1,todo); + return UNUR_SUCCESS; + } + else { + /* initialization failed --> cannot run test */ + printf("(!+)"); fflush(stdout); + print_verifyhat_result(LOG,gen,distr,-1,todo); + return UNUR_FAILURE; + } + } + + /* get dimension of distribution */ + dim = unur_get_dimension (gen); + + /* allocate working space */ + if (dim > 0) { + x = malloc( dim * sizeof(double) ); + abort_if_NULL(LOG, line, x); + } + + /* run verify hat test */ + for (i=0; i= 0) { + fprintf(LOG," failures = %d (%g%%) ",failed, 100. * failed_ratio); + switch (todo) { + case '+': + if (failed > 0) { + fprintf(LOG,"\t Failed"); + printf("(!+)"); + failed_test = 1; + } + else { + fprintf(LOG,"\t ok"); + printf("+"); + } + break; + case '~': + if (failed == 0) { + fprintf(LOG,"\t ok"); + printf("+"); + } + else if (failed_ratio <= 0.01) { + fprintf(LOG,"\t tolerated"); + printf("(~+)"); + } + else { + fprintf(LOG,"\t Failed"); + printf("(!~+)"); + failed_test = 1; + } + break; + case '-': + if (failed_ratio > 0.01) { + /* in this case it is expected to fail */ + fprintf(LOG,"\t ok (expected to fail)"); + printf("-"); + } + else { + /* the test has failed which was not what we have expected */ + fprintf(LOG,"\t Not ok (expected to fail)"); + printf("(!-)"); + failed_test = 1; + } + break; + default: + fprintf(stderr,"%s:%d: invalid test symbol\n", __FILE__, __LINE__); + exit (EXIT_FAILURE); + } + } + + else { + fprintf(LOG," setup failed\t"); + switch (todo) { + case '0': + case '-': + fprintf(LOG,"\t ok (expected to fail)"); + break; + default: + fprintf(LOG,"\t Failed"); + } + } + + /* timing */ + stopwatch_print(LOG,"\ttime=%.1f ms ", stopwatch_lap(&vw)); + + /* print distribution name */ + fprintf(LOG,"\t"); + print_distr_name( LOG, distr, gen ? unur_get_genid(gen):"???\t" ); + fprintf(LOG,"\n"); + + fflush(stdout); + fflush(LOG); + + return (failed_test ? UNUR_ERR_SILENT : UNUR_SUCCESS); + +} /* end of print_verifyhat_result() */ +#undef VERIFYHAT_SAMPLESIZE + +/*---------------------------------------------------------------------------*/ +/* print result of timings */ + +void print_timing_results( FILE *LOG, int line ATTRIBUTE__UNUSED, const UNUR_DISTR *distr, + double *timing_setup, double *timing_marginal, int n_results ) +{ + const char *distr_name; + static const char *last_distr_name = ""; + int i; + + /* get name of distribution */ + distr_name = unur_distr_get_name( distr ); + + if (strcmp(distr_name,last_distr_name) ) { + /* different distributions */ + last_distr_name = distr_name; + printf(" %s=",distr_name); fflush(stdout); + } + else { + printf("="); fflush(stdout); + } + + /* print timings into log file */ + for (i=0; i u_resolution) { + fprintf(LOG,"(NOT <= %g)\n",u_resolution); + fprintf(LOG,"%s: Warning: precision problem, maxerror > u_resolution\n",genid); + } + else { + fprintf(LOG,"(<= %g)\n",u_resolution); + } + + fprintf(LOG,"%s: score = %5.2f %%\t--> %s\n", genid, + score*100, (score<0.001) ? "passed" : "failed"); + + /* print result of test on screen and return result */ + if (score == 0.) { + printf("+"); fflush(stdout); + return 0; + } + if (score < 0.001) { + printf("(?+)"); fflush(stdout); + return 1; + } + else { + printf("(!+)"); fflush(stdout); + return 2; + } + +} /* end of run_validate_u_error() */ + +/*---------------------------------------------------------------------------*/ diff --git a/vendor/unuran-1.11.0/tests/testunuran.h b/vendor/unuran-1.11.0/tests/testunuran.h new file mode 100644 index 0000000..aa76f82 --- /dev/null +++ b/vendor/unuran-1.11.0/tests/testunuran.h @@ -0,0 +1,246 @@ +/***************************************************************************** + * * + * UNURAN -- Universal Non-Uniform Random number generator * + * * + ***************************************************************************** + * * + * FILE: testunuran.h * + * * + * Prototypes for common test routines * + * * + ***************************************************************************** + * * + * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * + * Department of Statistics and Mathematics, WU Wien, Austria * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * + * * + *****************************************************************************/ + +/*---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include "testdistributions/testdistributions.h" + +/* macros and functions for handling floats */ +#include +#include + +/*---------------------------------------------------------------------------*/ +/* global variables */ + +/* tresholds */ +#define PVAL_LIMIT (1.e-3) /* treshold for p-value for stat. test */ +#define DEFAULT_CHI2_FAILURES_TOLERATED (3) /* tolerated number of failed tests */ + +/* chisquare test */ +#define CHI_TEST_INTERVALS 100 /* number of intervals for chi^2 test */ +#define CHI_TEST_VERBOSITY 0 /* verbosity level for chi^2 test: 0 | 1 | 2 */ + +/*---------------------------------------------------------------------------*/ +/* constants */ + +#ifndef TRUE +#define TRUE (1) +#endif + +#ifndef FALSE +#define FALSE (0) +#endif + +#ifndef M_LN10 +#define M_LN10 2.302585092994046 +#endif + +/*---------------------------------------------------------------------------*/ +/* define macros for GCC attributes */ + +#ifdef __GNUC__ +# define ATTRIBUTE__UNUSED __attribute__ ((unused)) +#else +# define ATTRIBUTE__UNUSED +#endif + +/*---------------------------------------------------------------------------*/ +/* suppress GCC warnings */ +/* from Jonathan Wakely (copied from Patrick Horgan */ +/* http://dbp-consulting.com/tutorials/SuppressingGCCWarnings.html ) */ + +#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402 +#define GCC_DIAG_STR(s) #s +#define GCC_DIAG_JOINSTR(x,y) GCC_DIAG_STR(x ## y) +# define GCC_DIAG_DO_PRAGMA(x) _Pragma (#x) +# define GCC_DIAG_PRAGMA(x) GCC_DIAG_DO_PRAGMA(GCC diagnostic x) +# if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406 +# define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) \ + GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x)) +# define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(pop) +# else +# define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x)) +# define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(warning GCC_DIAG_JOINSTR(-W,x)) +# endif +#else +# define GCC_DIAG_OFF(x) +# define GCC_DIAG_ON(x) +#endif + +/*---------------------------------------------------------------------------*/ +/* stop watch (return milliseconds) */ + +#if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) +/* use gettimeofday() command. Not in ANSI C! */ + +#include +typedef struct timer { + struct timeval tv; + double start; + double interim; + double stop; +} TIMER; +#define stopwatch_get_time(tv) \ + ( gettimeofday(&tv, NULL), ((tv).tv_sec * 1.e3 + (tv).tv_usec * 1.e-3) ) + +#else +/* use clock() command. ANSI C but less accurate */ + +#include +typedef struct timer { + clock_t tv; + double start; + double interim; + double stop; +} TIMER; +#define stopwatch_get_time(tv) \ + ( (1.e3 * clock()) / CLOCKS_PER_SEC ) + +#endif + +void stopwatch_start(TIMER *t); +double stopwatch_lap(TIMER *t); +double stopwatch_stop(TIMER *t); + +void stopwatch_init(void); +void stopwatch_print( FILE *LOG, const char *format, double etime ); + +/*---------------------------------------------------------------------------*/ +/* set alarm when run time exceeds given limit */ +void set_alarm(FILE *LOG); + +/*---------------------------------------------------------------------------*/ +/* count number of function evaluations */ + +/* set and start counter for PDF and similar functions in parameter object */ +int start_counter_fcalls( UNUR_PAR *par ); +/* IMPORTANT: + * This function uses global variables. + * Thus the corresponding parameter/generator object has to be DESTROYED + * before this routine is called again. + * In addition, it creates a clone of the distribution object to which + * the parameter objects points to. + * Thus one should run + * stop_counter_fcalls() + * immediately after the corresponding parameter/generator object has been + * destroyed to avoid memory leaks. + */ + +int stop_counter_fcalls(void); +/* stop counter for PDF calls and clear memory */ + +/* reset counter to 0 */ +void reset_counter_fcalls(void); + +/* get number of PDF evaluations */ +int get_counter_pdf(void); +int get_counter_logpdf(void); +int get_counter_cdf(void); + +/*---------------------------------------------------------------------------*/ +/* print header for test log file */ +void print_test_log_header( FILE *LOG, unsigned long seed, int fullcheck ); + +/*---------------------------------------------------------------------------*/ +/* check for invalid NULL pointer, that should not happen in this program */ +void abort_if_NULL( FILE *LOG, int line, const void *ptr ); + +/* compare error code */ +int check_errorcode( FILE *LOG, int line, int cherrno ); + +/* check for expected NULL pointer */ +/* int do_check_expected_NULL( FILE *LOG, int line, const void *ptr ); */ +int do_check_expected_NULL( FILE *LOG, int line, int is_NULL ); +#define check_expected_NULL(LOG,line,ptr) \ + do_check_expected_NULL((LOG),(line),((ptr)==NULL)?1:0 ) + +/* check for "set failed" */ +int check_expected_setfailed( FILE *LOG, int line, int rcode ); + +/* check for expected zero (int 0) */ +int check_expected_zero( FILE *LOG, int line, int k ); + +/* check for INFINITY */ +int check_expected_INFINITY( FILE *LOG, int line, double x ); +int check_expected_negINFINITY( FILE *LOG, int line, double x ); +int check_expected_INTMAX( FILE *LOG, int line, int k ); + +/* check for reinit */ +int check_expected_reinit( FILE *LOG, int line, int rcode ); + +/* check for non existing reinit */ +int check_expected_no_reinit( FILE *LOG, int line, int rcode ); + +/* compare sequences generated by generator */ +int compare_sequence_gen_start ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); +int compare_sequence_gen ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); +int compare_sequence_par_start ( FILE *LOG, int line, UNUR_PAR *par, int sample_size ); +int compare_sequence_par ( FILE *LOG, int line, UNUR_PAR *par, int sample_size ); +int compare_sequence_urng_start( FILE *LOG, int line, int sample_size ); + +/* free memory used for comparing sequences */ +void compare_free_memory( void ); + +/* print name of distribution */ +void print_distr_name( FILE *LOG, const UNUR_DISTR *distr, const char *genid ); + +/* check p-value of statistical test and print result */ +int print_pval( FILE *LOG, UNUR_GEN *gen, const UNUR_DISTR *distr, double pval, int trial, int todo ); + +/* run chi2 test */ +int run_validate_chi2( FILE *LOG, int line, UNUR_GEN *gen, const UNUR_DISTR *distr, int todo ); + +/* run verify hat test */ +int run_validate_verifyhat( FILE *LOG, int line, UNUR_GEN *gen, const UNUR_DISTR *distr, int todo ); + +/* print result of verify hat test */ +int print_verifyhat_result( FILE *LOG, UNUR_GEN *gen, const UNUR_DISTR *distr, int failed, int todo ); + +/* print result of timings */ +void print_timing_results( FILE *LOG, int line, const UNUR_DISTR *distr, + double *timing_setup, double *timing_marginal, int n_results ); + +/* run test for u-error of inversion method and print results */ +int run_validate_u_error( FILE *LOG, UNUR_GEN *gen, const UNUR_DISTR *distr, + double u_resolution, int samplesize ); + +/*---------------------------------------------------------------------------*/